@deltares/fews-web-oc-charts
Version:
FEWS Chart Library
14,093 lines • 501 kB
JavaScript
function Dr(e, t) {
return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function oh(e, t) {
return e == null || t == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function te(e) {
let t, n, r;
e.length !== 2 ? (t = Dr, n = (o, l) => Dr(e(o), l), r = (o, l) => e(o) - l) : (t = e === Dr || e === oh ? e : lh, n = e, r = e);
function i(o, l, u = 0, c = o.length) {
if (u < c) {
if (t(l, l) !== 0) return c;
do {
const h = u + c >>> 1;
n(o[h], l) < 0 ? u = h + 1 : c = h;
} while (u < c);
}
return u;
}
function s(o, l, u = 0, c = o.length) {
if (u < c) {
if (t(l, l) !== 0) return c;
do {
const h = u + c >>> 1;
n(o[h], l) <= 0 ? u = h + 1 : c = h;
} while (u < c);
}
return u;
}
function a(o, l, u = 0, c = o.length) {
const h = i(o, l, u, c - 1);
return h > u && r(o[h - 1], l) > -r(o[h], l) ? h - 1 : h;
}
return { left: i, center: a, right: s };
}
function lh() {
return 0;
}
function uh(e) {
return e === null ? NaN : +e;
}
const ch = te(Dr), Ys = ch.right;
te(uh).center;
function _t(e, t) {
let n, r;
if (t === void 0)
for (const i of e)
i != null && (n === void 0 ? i >= i && (n = r = i) : (n > i && (n = i), r < i && (r = i)));
else {
let i = -1;
for (let s of e)
(s = t(s, ++i, e)) != null && (n === void 0 ? s >= s && (n = r = s) : (n > s && (n = s), r < s && (r = s)));
}
return [n, r];
}
class ka extends Map {
constructor(t, n = dh) {
if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), t != null) for (const [r, i] of t) this.set(r, i);
}
get(t) {
return super.get(Oa(this, t));
}
has(t) {
return super.has(Oa(this, t));
}
set(t, n) {
return super.set(hh(this, t), n);
}
delete(t) {
return super.delete(fh(this, t));
}
}
function Oa({ _intern: e, _key: t }, n) {
const r = t(n);
return e.has(r) ? e.get(r) : n;
}
function hh({ _intern: e, _key: t }, n) {
const r = t(n);
return e.has(r) ? e.get(r) : (e.set(r, n), n);
}
function fh({ _intern: e, _key: t }, n) {
const r = t(n);
return e.has(r) && (n = e.get(r), e.delete(r)), n;
}
function dh(e) {
return e !== null && typeof e == "object" ? e.valueOf() : e;
}
const ph = Math.sqrt(50), mh = Math.sqrt(10), gh = Math.sqrt(2);
function Wr(e, t, n) {
const r = (t - e) / Math.max(0, n), i = Math.floor(Math.log10(r)), s = r / Math.pow(10, i), a = s >= ph ? 10 : s >= mh ? 5 : s >= gh ? 2 : 1;
let o, l, u;
return i < 0 ? (u = Math.pow(10, -i) / a, o = Math.round(e * u), l = Math.round(t * u), o / u < e && ++o, l / u > t && --l, u = -u) : (u = Math.pow(10, i) * a, o = Math.round(e / u), l = Math.round(t / u), o * u < e && ++o, l * u > t && --l), l < o && 0.5 <= n && n < 2 ? Wr(e, t, n * 2) : [o, l, u];
}
function yh(e, t, n) {
if (t = +t, e = +e, n = +n, !(n > 0)) return [];
if (e === t) return [e];
const r = t < e, [i, s, a] = r ? Wr(t, e, n) : Wr(e, t, n);
if (!(s >= i)) return [];
const o = s - i + 1, l = new Array(o);
if (r)
if (a < 0) for (let u = 0; u < o; ++u) l[u] = (s - u) / -a;
else for (let u = 0; u < o; ++u) l[u] = (s - u) * a;
else if (a < 0) for (let u = 0; u < o; ++u) l[u] = (i + u) / -a;
else for (let u = 0; u < o; ++u) l[u] = (i + u) * a;
return l;
}
function Bn(e, t, n) {
return t = +t, e = +e, n = +n, Wr(e, t, n)[2];
}
function cs(e, t, n) {
t = +t, e = +e, n = +n;
const r = t < e, i = r ? Bn(t, e, n) : Bn(e, t, n);
return (r ? -1 : 1) * (i < 0 ? 1 / -i : i);
}
function Hr(e, t) {
let n;
if (t === void 0)
for (const r of e)
r != null && (n < r || n === void 0 && r >= r) && (n = r);
else {
let r = -1;
for (let i of e)
(i = t(i, ++r, e)) != null && (n < i || n === void 0 && i >= i) && (n = i);
}
return n;
}
function Ca(e, t) {
let n;
if (t === void 0)
for (const r of e)
r != null && (n > r || n === void 0 && r >= r) && (n = r);
else {
let r = -1;
for (let i of e)
(i = t(i, ++r, e)) != null && (n > i || n === void 0 && i >= i) && (n = i);
}
return n;
}
function hi(e, t) {
let n = 0, r = 0;
for (let i of e)
i != null && (i = +i) >= i && (++n, r += i);
if (n) return r / n;
}
function* vh(e) {
for (const t of e)
yield* t;
}
function hs(e) {
return Array.from(vh(e));
}
function Ks(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 = Math.max(0, Math.ceil((t - e) / n)) | 0, s = new Array(i); ++r < i; )
s[r] = e + r * n;
return s;
}
function bh(e) {
return e;
}
var $r = 1, Fr = 2, fs = 3, Vn = 4, Ia = 1e-6;
function xh(e) {
return "translate(" + e + ",0)";
}
function wh(e) {
return "translate(0," + e + ")";
}
function Sh(e) {
return (t) => +e(t);
}
function Th(e, t) {
return t = Math.max(0, e.bandwidth() - t * 2) / 2, e.round() && (t = Math.round(t)), (n) => +e(n) + t;
}
function _h() {
return !this.__axis;
}
function fi(e, t) {
var n = [], r = null, i = null, s = 6, a = 6, o = 3, l = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, u = e === $r || e === Vn ? -1 : 1, c = e === Vn || e === Fr ? "x" : "y", h = e === $r || e === fs ? xh : wh;
function f(d) {
var p = r ?? (t.ticks ? t.ticks.apply(t, n) : t.domain()), g = i ?? (t.tickFormat ? t.tickFormat.apply(t, n) : bh), m = Math.max(s, 0) + o, y = t.range(), x = +y[0] + l, b = +y[y.length - 1] + l, v = (t.bandwidth ? Th : Sh)(t.copy(), l), w = d.selection ? d.selection() : d, S = w.selectAll(".domain").data([null]), _ = w.selectAll(".tick").data(p, t).order(), A = _.exit(), F = _.enter().append("g").attr("class", "tick"), N = _.select("line"), k = _.select("text");
S = S.merge(S.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), _ = _.merge(F), N = N.merge(F.append("line").attr("stroke", "currentColor").attr(c + "2", u * s)), k = k.merge(F.append("text").attr("fill", "currentColor").attr(c, u * m).attr("dy", e === $r ? "0em" : e === fs ? "0.71em" : "0.32em")), d !== w && (S = S.transition(d), _ = _.transition(d), N = N.transition(d), k = k.transition(d), A = A.transition(d).attr("opacity", Ia).attr("transform", function($) {
return isFinite($ = v($)) ? h($ + l) : this.getAttribute("transform");
}), F.attr("opacity", Ia).attr("transform", function($) {
var C = this.parentNode.__axis;
return h((C && isFinite(C = C($)) ? C : v($)) + l);
})), A.remove(), S.attr("d", e === Vn || e === Fr ? a ? "M" + u * a + "," + x + "H" + l + "V" + b + "H" + u * a : "M" + l + "," + x + "V" + b : a ? "M" + x + "," + u * a + "V" + l + "H" + b + "V" + u * a : "M" + x + "," + l + "H" + b), _.attr("opacity", 1).attr("transform", function($) {
return h(v($) + l);
}), N.attr(c + "2", u * s), k.attr(c, u * m).text(g), w.filter(_h).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", e === Fr ? "start" : e === Vn ? "end" : "middle"), w.each(function() {
this.__axis = v;
});
}
return f.scale = function(d) {
return arguments.length ? (t = d, f) : t;
}, f.ticks = function() {
return n = Array.from(arguments), f;
}, f.tickArguments = function(d) {
return arguments.length ? (n = d == null ? [] : Array.from(d), f) : n.slice();
}, f.tickValues = function(d) {
return arguments.length ? (r = d == null ? null : Array.from(d), f) : r && r.slice();
}, f.tickFormat = function(d) {
return arguments.length ? (i = d, f) : i;
}, f.tickSize = function(d) {
return arguments.length ? (s = a = +d, f) : s;
}, f.tickSizeInner = function(d) {
return arguments.length ? (s = +d, f) : s;
}, f.tickSizeOuter = function(d) {
return arguments.length ? (a = +d, f) : a;
}, f.tickPadding = function(d) {
return arguments.length ? (o = +d, f) : o;
}, f.offset = function(d) {
return arguments.length ? (l = +d, f) : l;
}, f;
}
function jr(e) {
return fi($r, e);
}
function or(e) {
return fi(Fr, e);
}
function di(e) {
return fi(fs, e);
}
function ds(e) {
return fi(Vn, e);
}
var Mh = { value: () => {
} };
function pi() {
for (var e = 0, t = arguments.length, n = {}, r; e < t; ++e) {
if (!(r = arguments[e] + "") || r in n || /[\s.]/.test(r)) throw new Error("illegal type: " + r);
n[r] = [];
}
return new Lr(n);
}
function Lr(e) {
this._ = e;
}
function kh(e, t) {
return e.trim().split(/^|\s+/).map(function(n) {
var r = "", i = n.indexOf(".");
if (i >= 0 && (r = n.slice(i + 1), n = n.slice(0, i)), n && !t.hasOwnProperty(n)) throw new Error("unknown type: " + n);
return { type: n, name: r };
});
}
Lr.prototype = pi.prototype = {
constructor: Lr,
on: function(e, t) {
var n = this._, r = kh(e + "", n), i, s = -1, a = r.length;
if (arguments.length < 2) {
for (; ++s < a; ) if ((i = (e = r[s]).type) && (i = Oh(n[i], e.name))) return i;
return;
}
if (t != null && typeof t != "function") throw new Error("invalid callback: " + t);
for (; ++s < a; )
if (i = (e = r[s]).type) n[i] = Aa(n[i], e.name, t);
else if (t == null) for (i in n) n[i] = Aa(n[i], e.name, null);
return this;
},
copy: function() {
var e = {}, t = this._;
for (var n in t) e[n] = t[n].slice();
return new Lr(e);
},
call: function(e, t) {
if ((i = arguments.length - 2) > 0) for (var n = new Array(i), r = 0, i, s; r < i; ++r) n[r] = arguments[r + 2];
if (!this._.hasOwnProperty(e)) throw new Error("unknown type: " + e);
for (s = this._[e], r = 0, i = s.length; r < i; ++r) s[r].value.apply(t, n);
},
apply: function(e, t, n) {
if (!this._.hasOwnProperty(e)) throw new Error("unknown type: " + e);
for (var r = this._[e], i = 0, s = r.length; i < s; ++i) r[i].value.apply(t, n);
}
};
function Oh(e, t) {
for (var n = 0, r = e.length, i; n < r; ++n)
if ((i = e[n]).name === t)
return i.value;
}
function Aa(e, t, n) {
for (var r = 0, i = e.length; r < i; ++r)
if (e[r].name === t) {
e[r] = Mh, e = e.slice(0, r).concat(e.slice(r + 1));
break;
}
return n != null && e.push({ name: t, value: n }), e;
}
var ps = "http://www.w3.org/1999/xhtml";
const Na = {
svg: "http://www.w3.org/2000/svg",
xhtml: ps,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
function mi(e) {
var t = e += "", n = t.indexOf(":");
return n >= 0 && (t = e.slice(0, n)) !== "xmlns" && (e = e.slice(n + 1)), Na.hasOwnProperty(t) ? { space: Na[t], local: e } : e;
}
function Ch(e) {
return function() {
var t = this.ownerDocument, n = this.namespaceURI;
return n === ps && t.documentElement.namespaceURI === ps ? t.createElement(e) : t.createElementNS(n, e);
};
}
function Ih(e) {
return function() {
return this.ownerDocument.createElementNS(e.space, e.local);
};
}
function Gs(e) {
var t = mi(e);
return (t.local ? Ih : Ch)(t);
}
function Ah() {
}
function qs(e) {
return e == null ? Ah : function() {
return this.querySelector(e);
};
}
function Nh(e) {
typeof e != "function" && (e = qs(e));
for (var t = this._groups, n = t.length, r = new Array(n), i = 0; i < n; ++i)
for (var s = t[i], a = s.length, o = r[i] = new Array(a), l, u, c = 0; c < a; ++c)
(l = s[c]) && (u = e.call(l, l.__data__, c, s)) && ("__data__" in l && (u.__data__ = l.__data__), o[c] = u);
return new Ct(r, this._parents);
}
function Ph(e) {
return e == null ? [] : Array.isArray(e) ? e : Array.from(e);
}
function Eh() {
return [];
}
function Tl(e) {
return e == null ? Eh : function() {
return this.querySelectorAll(e);
};
}
function Dh(e) {
return function() {
return Ph(e.apply(this, arguments));
};
}
function $h(e) {
typeof e == "function" ? e = Dh(e) : e = Tl(e);
for (var t = this._groups, n = t.length, r = [], i = [], s = 0; s < n; ++s)
for (var a = t[s], o = a.length, l, u = 0; u < o; ++u)
(l = a[u]) && (r.push(e.call(l, l.__data__, u, a)), i.push(l));
return new Ct(r, i);
}
function _l(e) {
return function() {
return this.matches(e);
};
}
function Ml(e) {
return function(t) {
return t.matches(e);
};
}
var Fh = Array.prototype.find;
function Lh(e) {
return function() {
return Fh.call(this.children, e);
};
}
function Rh() {
return this.firstElementChild;
}
function Vh(e) {
return this.select(e == null ? Rh : Lh(typeof e == "function" ? e : Ml(e)));
}
var Uh = Array.prototype.filter;
function Wh() {
return Array.from(this.children);
}
function Hh(e) {
return function() {
return Uh.call(this.children, e);
};
}
function jh(e) {
return this.selectAll(e == null ? Wh : Hh(typeof e == "function" ? e : Ml(e)));
}
function zh(e) {
typeof e != "function" && (e = _l(e));
for (var t = this._groups, n = t.length, r = new Array(n), i = 0; i < n; ++i)
for (var s = t[i], a = s.length, o = r[i] = [], l, u = 0; u < a; ++u)
(l = s[u]) && e.call(l, l.__data__, u, s) && o.push(l);
return new Ct(r, this._parents);
}
function kl(e) {
return new Array(e.length);
}
function Zh() {
return new Ct(this._enter || this._groups.map(kl), this._parents);
}
function zr(e, t) {
this.ownerDocument = e.ownerDocument, this.namespaceURI = e.namespaceURI, this._next = null, this._parent = e, this.__data__ = t;
}
zr.prototype = {
constructor: zr,
appendChild: function(e) {
return this._parent.insertBefore(e, this._next);
},
insertBefore: function(e, t) {
return this._parent.insertBefore(e, t);
},
querySelector: function(e) {
return this._parent.querySelector(e);
},
querySelectorAll: function(e) {
return this._parent.querySelectorAll(e);
}
};
function Yh(e) {
return function() {
return e;
};
}
function Kh(e, t, n, r, i, s) {
for (var a = 0, o, l = t.length, u = s.length; a < u; ++a)
(o = t[a]) ? (o.__data__ = s[a], r[a] = o) : n[a] = new zr(e, s[a]);
for (; a < l; ++a)
(o = t[a]) && (i[a] = o);
}
function Gh(e, t, n, r, i, s, a) {
var o, l, u = /* @__PURE__ */ new Map(), c = t.length, h = s.length, f = new Array(c), d;
for (o = 0; o < c; ++o)
(l = t[o]) && (f[o] = d = a.call(l, l.__data__, o, t) + "", u.has(d) ? i[o] = l : u.set(d, l));
for (o = 0; o < h; ++o)
d = a.call(e, s[o], o, s) + "", (l = u.get(d)) ? (r[o] = l, l.__data__ = s[o], u.delete(d)) : n[o] = new zr(e, s[o]);
for (o = 0; o < c; ++o)
(l = t[o]) && u.get(f[o]) === l && (i[o] = l);
}
function qh(e) {
return e.__data__;
}
function Bh(e, t) {
if (!arguments.length) return Array.from(this, qh);
var n = t ? Gh : Kh, r = this._parents, i = this._groups;
typeof e != "function" && (e = Yh(e));
for (var s = i.length, a = new Array(s), o = new Array(s), l = new Array(s), u = 0; u < s; ++u) {
var c = r[u], h = i[u], f = h.length, d = Xh(e.call(c, c && c.__data__, u, r)), p = d.length, g = o[u] = new Array(p), m = a[u] = new Array(p), y = l[u] = new Array(f);
n(c, h, g, m, y, d, t);
for (var x = 0, b = 0, v, w; x < p; ++x)
if (v = g[x]) {
for (x >= b && (b = x + 1); !(w = m[b]) && ++b < p; ) ;
v._next = w || null;
}
}
return a = new Ct(a, r), a._enter = o, a._exit = l, a;
}
function Xh(e) {
return typeof e == "object" && "length" in e ? e : Array.from(e);
}
function Jh() {
return new Ct(this._exit || this._groups.map(kl), this._parents);
}
function Qh(e, t, n) {
var r = this.enter(), i = this, s = this.exit();
return typeof e == "function" ? (r = e(r), r && (r = r.selection())) : r = r.append(e + ""), t != null && (i = t(i), i && (i = i.selection())), n == null ? s.remove() : n(s), r && i ? r.merge(i).order() : i;
}
function tf(e) {
for (var t = e.selection ? e.selection() : e, n = this._groups, r = t._groups, i = n.length, s = r.length, a = Math.min(i, s), o = new Array(i), l = 0; l < a; ++l)
for (var u = n[l], c = r[l], h = u.length, f = o[l] = new Array(h), d, p = 0; p < h; ++p)
(d = u[p] || c[p]) && (f[p] = d);
for (; l < i; ++l)
o[l] = n[l];
return new Ct(o, this._parents);
}
function ef() {
for (var e = this._groups, t = -1, n = e.length; ++t < n; )
for (var r = e[t], i = r.length - 1, s = r[i], a; --i >= 0; )
(a = r[i]) && (s && a.compareDocumentPosition(s) ^ 4 && s.parentNode.insertBefore(a, s), s = a);
return this;
}
function nf(e) {
e || (e = rf);
function t(h, f) {
return h && f ? e(h.__data__, f.__data__) : !h - !f;
}
for (var n = this._groups, r = n.length, i = new Array(r), s = 0; s < r; ++s) {
for (var a = n[s], o = a.length, l = i[s] = new Array(o), u, c = 0; c < o; ++c)
(u = a[c]) && (l[c] = u);
l.sort(t);
}
return new Ct(i, this._parents).order();
}
function rf(e, t) {
return e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function sf() {
var e = arguments[0];
return arguments[0] = this, e.apply(null, arguments), this;
}
function af() {
return Array.from(this);
}
function of() {
for (var e = this._groups, t = 0, n = e.length; t < n; ++t)
for (var r = e[t], i = 0, s = r.length; i < s; ++i) {
var a = r[i];
if (a) return a;
}
return null;
}
function lf() {
let e = 0;
for (const t of this) ++e;
return e;
}
function uf() {
return !this.node();
}
function cf(e) {
for (var t = this._groups, n = 0, r = t.length; n < r; ++n)
for (var i = t[n], s = 0, a = i.length, o; s < a; ++s)
(o = i[s]) && e.call(o, o.__data__, s, i);
return this;
}
function hf(e) {
return function() {
this.removeAttribute(e);
};
}
function ff(e) {
return function() {
this.removeAttributeNS(e.space, e.local);
};
}
function df(e, t) {
return function() {
this.setAttribute(e, t);
};
}
function pf(e, t) {
return function() {
this.setAttributeNS(e.space, e.local, t);
};
}
function mf(e, t) {
return function() {
var n = t.apply(this, arguments);
n == null ? this.removeAttribute(e) : this.setAttribute(e, n);
};
}
function gf(e, t) {
return function() {
var n = t.apply(this, arguments);
n == null ? this.removeAttributeNS(e.space, e.local) : this.setAttributeNS(e.space, e.local, n);
};
}
function yf(e, t) {
var n = mi(e);
if (arguments.length < 2) {
var r = this.node();
return n.local ? r.getAttributeNS(n.space, n.local) : r.getAttribute(n);
}
return this.each((t == null ? n.local ? ff : hf : typeof t == "function" ? n.local ? gf : mf : n.local ? pf : df)(n, t));
}
function Ol(e) {
return e.ownerDocument && e.ownerDocument.defaultView || e.document && e || e.defaultView;
}
function vf(e) {
return function() {
this.style.removeProperty(e);
};
}
function bf(e, t, n) {
return function() {
this.style.setProperty(e, t, n);
};
}
function xf(e, t, n) {
return function() {
var r = t.apply(this, arguments);
r == null ? this.style.removeProperty(e) : this.style.setProperty(e, r, n);
};
}
function wf(e, t, n) {
return arguments.length > 1 ? this.each((t == null ? vf : typeof t == "function" ? xf : bf)(e, t, n ?? "")) : dn(this.node(), e);
}
function dn(e, t) {
return e.style.getPropertyValue(t) || Ol(e).getComputedStyle(e, null).getPropertyValue(t);
}
function Sf(e) {
return function() {
delete this[e];
};
}
function Tf(e, t) {
return function() {
this[e] = t;
};
}
function _f(e, t) {
return function() {
var n = t.apply(this, arguments);
n == null ? delete this[e] : this[e] = n;
};
}
function Mf(e, t) {
return arguments.length > 1 ? this.each((t == null ? Sf : typeof t == "function" ? _f : Tf)(e, t)) : this.node()[e];
}
function Cl(e) {
return e.trim().split(/^|\s+/);
}
function Bs(e) {
return e.classList || new Il(e);
}
function Il(e) {
this._node = e, this._names = Cl(e.getAttribute("class") || "");
}
Il.prototype = {
add: function(e) {
var t = this._names.indexOf(e);
t < 0 && (this._names.push(e), this._node.setAttribute("class", this._names.join(" ")));
},
remove: function(e) {
var t = this._names.indexOf(e);
t >= 0 && (this._names.splice(t, 1), this._node.setAttribute("class", this._names.join(" ")));
},
contains: function(e) {
return this._names.indexOf(e) >= 0;
}
};
function Al(e, t) {
for (var n = Bs(e), r = -1, i = t.length; ++r < i; ) n.add(t[r]);
}
function Nl(e, t) {
for (var n = Bs(e), r = -1, i = t.length; ++r < i; ) n.remove(t[r]);
}
function kf(e) {
return function() {
Al(this, e);
};
}
function Of(e) {
return function() {
Nl(this, e);
};
}
function Cf(e, t) {
return function() {
(t.apply(this, arguments) ? Al : Nl)(this, e);
};
}
function If(e, t) {
var n = Cl(e + "");
if (arguments.length < 2) {
for (var r = Bs(this.node()), i = -1, s = n.length; ++i < s; ) if (!r.contains(n[i])) return !1;
return !0;
}
return this.each((typeof t == "function" ? Cf : t ? kf : Of)(n, t));
}
function Af() {
this.textContent = "";
}
function Nf(e) {
return function() {
this.textContent = e;
};
}
function Pf(e) {
return function() {
var t = e.apply(this, arguments);
this.textContent = t ?? "";
};
}
function Ef(e) {
return arguments.length ? this.each(e == null ? Af : (typeof e == "function" ? Pf : Nf)(e)) : this.node().textContent;
}
function Df() {
this.innerHTML = "";
}
function $f(e) {
return function() {
this.innerHTML = e;
};
}
function Ff(e) {
return function() {
var t = e.apply(this, arguments);
this.innerHTML = t ?? "";
};
}
function Lf(e) {
return arguments.length ? this.each(e == null ? Df : (typeof e == "function" ? Ff : $f)(e)) : this.node().innerHTML;
}
function Rf() {
this.nextSibling && this.parentNode.appendChild(this);
}
function Vf() {
return this.each(Rf);
}
function Uf() {
this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function Wf() {
return this.each(Uf);
}
function Hf(e) {
var t = typeof e == "function" ? e : Gs(e);
return this.select(function() {
return this.appendChild(t.apply(this, arguments));
});
}
function jf() {
return null;
}
function zf(e, t) {
var n = typeof e == "function" ? e : Gs(e), r = t == null ? jf : typeof t == "function" ? t : qs(t);
return this.select(function() {
return this.insertBefore(n.apply(this, arguments), r.apply(this, arguments) || null);
});
}
function Zf() {
var e = this.parentNode;
e && e.removeChild(this);
}
function Yf() {
return this.each(Zf);
}
function Kf() {
var e = this.cloneNode(!1), t = this.parentNode;
return t ? t.insertBefore(e, this.nextSibling) : e;
}
function Gf() {
var e = this.cloneNode(!0), t = this.parentNode;
return t ? t.insertBefore(e, this.nextSibling) : e;
}
function qf(e) {
return this.select(e ? Gf : Kf);
}
function Bf(e) {
return arguments.length ? this.property("__data__", e) : this.node().__data__;
}
function Xf(e) {
return function(t) {
e.call(this, t, this.__data__);
};
}
function Jf(e) {
return e.trim().split(/^|\s+/).map(function(t) {
var n = "", r = t.indexOf(".");
return r >= 0 && (n = t.slice(r + 1), t = t.slice(0, r)), { type: t, name: n };
});
}
function Qf(e) {
return function() {
var t = this.__on;
if (t) {
for (var n = 0, r = -1, i = t.length, s; n < i; ++n)
s = t[n], (!e.type || s.type === e.type) && s.name === e.name ? this.removeEventListener(s.type, s.listener, s.options) : t[++r] = s;
++r ? t.length = r : delete this.__on;
}
};
}
function td(e, t, n) {
return function() {
var r = this.__on, i, s = Xf(t);
if (r) {
for (var a = 0, o = r.length; a < o; ++a)
if ((i = r[a]).type === e.type && i.name === e.name) {
this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = s, i.options = n), i.value = t;
return;
}
}
this.addEventListener(e.type, s, n), i = { type: e.type, name: e.name, value: t, listener: s, options: n }, r ? r.push(i) : this.__on = [i];
};
}
function ed(e, t, n) {
var r = Jf(e + ""), i, s = r.length, a;
if (arguments.length < 2) {
var o = this.node().__on;
if (o) {
for (var l = 0, u = o.length, c; l < u; ++l)
for (i = 0, c = o[l]; i < s; ++i)
if ((a = r[i]).type === c.type && a.name === c.name)
return c.value;
}
return;
}
for (o = t ? td : Qf, i = 0; i < s; ++i) this.each(o(r[i], t, n));
return this;
}
function Pl(e, t, n) {
var r = Ol(e), i = r.CustomEvent;
typeof i == "function" ? i = new i(t, n) : (i = r.document.createEvent("Event"), n ? (i.initEvent(t, n.bubbles, n.cancelable), i.detail = n.detail) : i.initEvent(t, !1, !1)), e.dispatchEvent(i);
}
function nd(e, t) {
return function() {
return Pl(this, e, t);
};
}
function rd(e, t) {
return function() {
return Pl(this, e, t.apply(this, arguments));
};
}
function id(e, t) {
return this.each((typeof t == "function" ? rd : nd)(e, t));
}
function* sd() {
for (var e = this._groups, t = 0, n = e.length; t < n; ++t)
for (var r = e[t], i = 0, s = r.length, a; i < s; ++i)
(a = r[i]) && (yield a);
}
var El = [null];
function Ct(e, t) {
this._groups = e, this._parents = t;
}
function Mn() {
return new Ct([[document.documentElement]], El);
}
function ad() {
return this;
}
Ct.prototype = Mn.prototype = {
constructor: Ct,
select: Nh,
selectAll: $h,
selectChild: Vh,
selectChildren: jh,
filter: zh,
data: Bh,
enter: Zh,
exit: Jh,
join: Qh,
merge: tf,
selection: ad,
order: ef,
sort: nf,
call: sf,
nodes: af,
node: of,
size: lf,
empty: uf,
each: cf,
attr: yf,
style: wf,
property: Mf,
classed: If,
text: Ef,
html: Lf,
raise: Vf,
lower: Wf,
append: Hf,
insert: zf,
remove: Yf,
clone: qf,
datum: Bf,
on: ed,
dispatch: id,
[Symbol.iterator]: sd
};
function mt(e) {
return typeof e == "string" ? new Ct([[document.querySelector(e)]], [document.documentElement]) : new Ct([[e]], El);
}
function Lt(e) {
return mt(Gs(e).call(document.documentElement));
}
function od(e) {
let t;
for (; t = e.sourceEvent; ) e = t;
return e;
}
function J(e, t) {
if (e = od(e), t === void 0 && (t = e.currentTarget), t) {
var n = t.ownerSVGElement || t;
if (n.createSVGPoint) {
var r = n.createSVGPoint();
return r.x = e.clientX, r.y = e.clientY, r = r.matrixTransform(t.getScreenCTM().inverse()), [r.x, r.y];
}
if (t.getBoundingClientRect) {
var i = t.getBoundingClientRect();
return [e.clientX - i.left - t.clientLeft, e.clientY - i.top - t.clientTop];
}
}
return [e.pageX, e.pageY];
}
const ld = { passive: !1 }, Xn = { capture: !0, passive: !1 };
function Vi(e) {
e.stopImmediatePropagation();
}
function on(e) {
e.preventDefault(), e.stopImmediatePropagation();
}
function ud(e) {
var t = e.document.documentElement, n = mt(e).on("dragstart.drag", on, Xn);
"onselectstart" in t ? n.on("selectstart.drag", on, Xn) : (t.__noselect = t.style.MozUserSelect, t.style.MozUserSelect = "none");
}
function cd(e, t) {
var n = e.document.documentElement, r = mt(e).on("dragstart.drag", null);
t && (r.on("click.drag", on, Xn), setTimeout(function() {
r.on("click.drag", null);
}, 0)), "onselectstart" in n ? r.on("selectstart.drag", null) : (n.style.MozUserSelect = n.__noselect, delete n.__noselect);
}
const gr = (e) => () => e;
function ms(e, {
sourceEvent: t,
subject: n,
target: r,
identifier: i,
active: s,
x: a,
y: o,
dx: l,
dy: u,
dispatch: c
}) {
Object.defineProperties(this, {
type: { value: e, enumerable: !0, configurable: !0 },
sourceEvent: { value: t, enumerable: !0, configurable: !0 },
subject: { value: n, enumerable: !0, configurable: !0 },
target: { value: r, enumerable: !0, configurable: !0 },
identifier: { value: i, enumerable: !0, configurable: !0 },
active: { value: s, enumerable: !0, configurable: !0 },
x: { value: a, enumerable: !0, configurable: !0 },
y: { value: o, enumerable: !0, configurable: !0 },
dx: { value: l, enumerable: !0, configurable: !0 },
dy: { value: u, enumerable: !0, configurable: !0 },
_: { value: c }
});
}
ms.prototype.on = function() {
var e = this._.on.apply(this._, arguments);
return e === this._ ? this : e;
};
function hd(e) {
return !e.ctrlKey && !e.button;
}
function fd() {
return this.parentNode;
}
function dd(e, t) {
return t ?? { x: e.x, y: e.y };
}
function pd() {
return navigator.maxTouchPoints || "ontouchstart" in this;
}
function Dl() {
var e = hd, t = fd, n = dd, r = pd, i = {}, s = pi("start", "drag", "end"), a = 0, o, l, u, c, h = 0;
function f(v) {
v.on("mousedown.drag", d).filter(r).on("touchstart.drag", m).on("touchmove.drag", y, ld).on("touchend.drag touchcancel.drag", x).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
}
function d(v, w) {
if (!(c || !e.call(this, v, w))) {
var S = b(this, t.call(this, v, w), v, w, "mouse");
S && (mt(v.view).on("mousemove.drag", p, Xn).on("mouseup.drag", g, Xn), ud(v.view), Vi(v), u = !1, o = v.clientX, l = v.clientY, S("start", v));
}
}
function p(v) {
if (on(v), !u) {
var w = v.clientX - o, S = v.clientY - l;
u = w * w + S * S > h;
}
i.mouse("drag", v);
}
function g(v) {
mt(v.view).on("mousemove.drag mouseup.drag", null), cd(v.view, u), on(v), i.mouse("end", v);
}
function m(v, w) {
if (e.call(this, v, w)) {
var S = v.changedTouches, _ = t.call(this, v, w), A = S.length, F, N;
for (F = 0; F < A; ++F)
(N = b(this, _, v, w, S[F].identifier, S[F])) && (Vi(v), N("start", v, S[F]));
}
}
function y(v) {
var w = v.changedTouches, S = w.length, _, A;
for (_ = 0; _ < S; ++_)
(A = i[w[_].identifier]) && (on(v), A("drag", v, w[_]));
}
function x(v) {
var w = v.changedTouches, S = w.length, _, A;
for (c && clearTimeout(c), c = setTimeout(function() {
c = null;
}, 500), _ = 0; _ < S; ++_)
(A = i[w[_].identifier]) && (Vi(v), A("end", v, w[_]));
}
function b(v, w, S, _, A, F) {
var N = s.copy(), k = J(F || S, w), $, C, E;
if ((E = n.call(v, new ms("beforestart", {
sourceEvent: S,
target: f,
identifier: A,
active: a,
x: k[0],
y: k[1],
dx: 0,
dy: 0,
dispatch: N
}), _)) != null)
return $ = E.x - k[0] || 0, C = E.y - k[1] || 0, function nt(rt, Q, j) {
var Z = k, ft;
switch (rt) {
case "start":
i[A] = nt, ft = a++;
break;
case "end":
delete i[A], --a;
// falls through
case "drag":
k = J(j || Q, w), ft = a;
break;
}
N.call(
rt,
v,
new ms(rt, {
sourceEvent: Q,
subject: E,
target: f,
identifier: A,
active: ft,
x: k[0] + $,
y: k[1] + C,
dx: k[0] - Z[0],
dy: k[1] - Z[1],
dispatch: N
}),
_
);
};
}
return f.filter = function(v) {
return arguments.length ? (e = typeof v == "function" ? v : gr(!!v), f) : e;
}, f.container = function(v) {
return arguments.length ? (t = typeof v == "function" ? v : gr(v), f) : t;
}, f.subject = function(v) {
return arguments.length ? (n = typeof v == "function" ? v : gr(v), f) : n;
}, f.touchable = function(v) {
return arguments.length ? (r = typeof v == "function" ? v : gr(!!v), f) : r;
}, f.on = function() {
var v = s.on.apply(s, arguments);
return v === s ? f : v;
}, f.clickDistance = function(v) {
return arguments.length ? (h = (v = +v) * v, f) : Math.sqrt(h);
}, f;
}
function gi(e, t, n) {
e.prototype = t.prototype = n, n.constructor = e;
}
function Xs(e, t) {
var n = Object.create(e.prototype);
for (var r in t) n[r] = t[r];
return n;
}
function kn() {
}
var He = 0.7, pn = 1 / He, ln = "\\s*([+-]?\\d+)\\s*", Jn = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", Qt = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", md = /^#([0-9a-f]{3,8})$/, gd = new RegExp(`^rgb\\(${ln},${ln},${ln}\\)$`), yd = new RegExp(`^rgb\\(${Qt},${Qt},${Qt}\\)$`), vd = new RegExp(`^rgba\\(${ln},${ln},${ln},${Jn}\\)$`), bd = new RegExp(`^rgba\\(${Qt},${Qt},${Qt},${Jn}\\)$`), xd = new RegExp(`^hsl\\(${Jn},${Qt},${Qt}\\)$`), wd = new RegExp(`^hsla\\(${Jn},${Qt},${Qt},${Jn}\\)$`), Pa = {
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
};
gi(kn, je, {
copy(e) {
return Object.assign(new this.constructor(), this, e);
},
displayable() {
return this.rgb().displayable();
},
hex: Ea,
// Deprecated! Use color.formatHex.
formatHex: Ea,
formatHex8: Sd,
formatHsl: Td,
formatRgb: Da,
toString: Da
});
function Ea() {
return this.rgb().formatHex();
}
function Sd() {
return this.rgb().formatHex8();
}
function Td() {
return Fl(this).formatHsl();
}
function Da() {
return this.rgb().formatRgb();
}
function je(e) {
var t, n;
return e = (e + "").trim().toLowerCase(), (t = md.exec(e)) ? (n = t[1].length, t = parseInt(t[1], 16), n === 6 ? $a(t) : n === 3 ? new ht(t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, (t & 15) << 4 | t & 15, 1) : n === 8 ? yr(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, (t & 255) / 255) : n === 4 ? yr(t >> 12 & 15 | t >> 8 & 240, t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, ((t & 15) << 4 | t & 15) / 255) : null) : (t = gd.exec(e)) ? new ht(t[1], t[2], t[3], 1) : (t = yd.exec(e)) ? new ht(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, 1) : (t = vd.exec(e)) ? yr(t[1], t[2], t[3], t[4]) : (t = bd.exec(e)) ? yr(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, t[4]) : (t = xd.exec(e)) ? Ra(t[1], t[2] / 100, t[3] / 100, 1) : (t = wd.exec(e)) ? Ra(t[1], t[2] / 100, t[3] / 100, t[4]) : Pa.hasOwnProperty(e) ? $a(Pa[e]) : e === "transparent" ? new ht(NaN, NaN, NaN, 0) : null;
}
function $a(e) {
return new ht(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
}
function yr(e, t, n, r) {
return r <= 0 && (e = t = n = NaN), new ht(e, t, n, r);
}
function $l(e) {
return e instanceof kn || (e = je(e)), e ? (e = e.rgb(), new ht(e.r, e.g, e.b, e.opacity)) : new ht();
}
function gs(e, t, n, r) {
return arguments.length === 1 ? $l(e) : new ht(e, t, n, r ?? 1);
}
function ht(e, t, n, r) {
this.r = +e, this.g = +t, this.b = +n, this.opacity = +r;
}
gi(ht, gs, Xs(kn, {
brighter(e) {
return e = e == null ? pn : Math.pow(pn, e), new ht(this.r * e, this.g * e, this.b * e, this.opacity);
},
darker(e) {
return e = e == null ? He : Math.pow(He, e), new ht(this.r * e, this.g * e, this.b * e, this.opacity);
},
rgb() {
return this;
},
clamp() {
return new ht(Ue(this.r), Ue(this.g), Ue(this.b), Zr(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: Fa,
// Deprecated! Use color.formatHex.
formatHex: Fa,
formatHex8: _d,
formatRgb: La,
toString: La
}));
function Fa() {
return `#${Le(this.r)}${Le(this.g)}${Le(this.b)}`;
}
function _d() {
return `#${Le(this.r)}${Le(this.g)}${Le(this.b)}${Le((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function La() {
const e = Zr(this.opacity);
return `${e === 1 ? "rgb(" : "rgba("}${Ue(this.r)}, ${Ue(this.g)}, ${Ue(this.b)}${e === 1 ? ")" : `, ${e})`}`;
}
function Zr(e) {
return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
}
function Ue(e) {
return Math.max(0, Math.min(255, Math.round(e) || 0));
}
function Le(e) {
return e = Ue(e), (e < 16 ? "0" : "") + e.toString(16);
}
function Ra(e, t, n, r) {
return r <= 0 ? e = t = n = NaN : n <= 0 || n >= 1 ? e = t = NaN : t <= 0 && (e = NaN), new zt(e, t, n, r);
}
function Fl(e) {
if (e instanceof zt) return new zt(e.h, e.s, e.l, e.opacity);
if (e instanceof kn || (e = je(e)), !e) return new zt();
if (e instanceof zt) return e;
e = e.rgb();
var t = e.r / 255, n = e.g / 255, r = e.b / 255, i = Math.min(t, n, r), s = Math.max(t, n, r), a = NaN, o = s - i, l = (s + i) / 2;
return o ? (t === s ? a = (n - r) / o + (n < r) * 6 : n === s ? a = (r - t) / o + 2 : a = (t - n) / o + 4, o /= l < 0.5 ? s + i : 2 - s - i, a *= 60) : o = l > 0 && l < 1 ? 0 : a, new zt(a, o, l, e.opacity);
}
function Md(e, t, n, r) {
return arguments.length === 1 ? Fl(e) : new zt(e, t, n, r ?? 1);
}
function zt(e, t, n, r) {
this.h = +e, this.s = +t, this.l = +n, this.opacity = +r;
}
gi(zt, Md, Xs(kn, {
brighter(e) {
return e = e == null ? pn : Math.pow(pn, e), new zt(this.h, this.s, this.l * e, this.opacity);
},
darker(e) {
return e = e == null ? He : Math.pow(He, e), new zt(this.h, this.s, this.l * e, this.opacity);
},
rgb() {
var e = this.h % 360 + (this.h < 0) * 360, t = isNaN(e) || isNaN(this.s) ? 0 : this.s, n = this.l, r = n + (n < 0.5 ? n : 1 - n) * t, i = 2 * n - r;
return new ht(
Ui(e >= 240 ? e - 240 : e + 120, i, r),
Ui(e, i, r),
Ui(e < 120 ? e + 240 : e - 120, i, r),
this.opacity
);
},
clamp() {
return new zt(Va(this.h), vr(this.s), vr(this.l), Zr(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 = Zr(this.opacity);
return `${e === 1 ? "hsl(" : "hsla("}${Va(this.h)}, ${vr(this.s) * 100}%, ${vr(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
}
}));
function Va(e) {
return e = (e || 0) % 360, e < 0 ? e + 360 : e;
}
function vr(e) {
return Math.max(0, Math.min(1, e || 0));
}
function Ui(e, t, n) {
return (e < 60 ? t + (n - t) * e / 60 : e < 180 ? n : e < 240 ? t + (n - t) * (240 - e) / 60 : t) * 255;
}
const kd = Math.PI / 180, Od = 180 / Math.PI;
var Ll = -0.14861, Js = 1.78277, Qs = -0.29227, yi = -0.90649, Qn = 1.97294, Ua = Qn * yi, Wa = Qn * Js, Ha = Js * Qs - yi * Ll;
function Cd(e) {
if (e instanceof We) return new We(e.h, e.s, e.l, e.opacity);
e instanceof ht || (e = $l(e));
var t = e.r / 255, n = e.g / 255, r = e.b / 255, i = (Ha * r + Ua * t - Wa * n) / (Ha + Ua - Wa), s = r - i, a = (Qn * (n - i) - Qs * s) / yi, o = Math.sqrt(a * a + s * s) / (Qn * i * (1 - i)), l = o ? Math.atan2(a, s) * Od - 120 : NaN;
return new We(l < 0 ? l + 360 : l, o, i, e.opacity);
}
function Ie(e, t, n, r) {
return arguments.length === 1 ? Cd(e) : new We(e, t, n, r ?? 1);
}
function We(e, t, n, r) {
this.h = +e, this.s = +t, this.l = +n, this.opacity = +r;
}
gi(We, Ie, Xs(kn, {
brighter(e) {
return e = e == null ? pn : Math.pow(pn, e), new We(this.h, this.s, this.l * e, this.opacity);
},
darker(e) {
return e = e == null ? He : Math.pow(He, e), new We(this.h, this.s, this.l * e, this.opacity);
},
rgb() {
var e = isNaN(this.h) ? 0 : (this.h + 120) * kd, t = +this.l, n = isNaN(this.s) ? 0 : this.s * t * (1 - t), r = Math.cos(e), i = Math.sin(e);
return new ht(
255 * (t + n * (Ll * r + Js * i)),
255 * (t + n * (Qs * r + yi * i)),
255 * (t + n * (Qn * r)),
this.opacity
);
}
}));
const vi = (e) => () => e;
function Rl(e, t) {
return function(n) {
return e + n * t;
};
}
function Id(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);
};
}
function Ad(e, t) {
var n = t - e;
return n ? Rl(e, n > 180 || n < -180 ? n - 360 * Math.round(n / 360) : n) : vi(isNaN(e) ? t : e);
}
function Nd(e) {
return (e = +e) == 1 ? un : function(t, n) {
return n - t ? Id(t, n, e) : vi(isNaN(t) ? n : t);
};
}
function un(e, t) {
var n = t - e;
return n ? Rl(e, n) : vi(isNaN(e) ? t : e);
}
const Yr = function e(t) {
var n = Nd(t);
function r(i, s) {
var a = n((i = gs(i)).r, (s = gs(s)).r), o = n(i.g, s.g), l = n(i.b, s.b), u = un(i.opacity, s.opacity);
return function(c) {
return i.r = a(c), i.g = o(c), i.b = l(c), i.opacity = u(c), i + "";
};
}
return r.gamma = e, r;
}(1);
function Vl(e, t) {
t || (t = []);
var n = e ? Math.min(t.length, e.length) : 0, r = t.slice(), i;
return function(s) {
for (i = 0; i < n; ++i) r[i] = e[i] * (1 - s) + t[i] * s;
return r;
};
}
function Ul(e) {
return ArrayBuffer.isView(e) && !(e instanceof DataView);
}
function Kr(e, t) {
return (Ul(t) ? Vl : Wl)(e, t);
}
function Wl(e, t) {
var n = t ? t.length : 0, r = e ? Math.min(n, e.length) : 0, i = new Array(r), s = new Array(n), a;
for (a = 0; a < r; ++a) i[a] = Pt(e[a], t[a]);
for (; a < n; ++a) s[a] = t[a];
return function(o) {
for (a = 0; a < r; ++a) s[a] = i[a](o);
return s;
};
}
function Pd(e, t) {
var n = /* @__PURE__ */ new Date();
return e = +e, t = +t, function(r) {
return n.setTime(e * (1 - r) + t * r), n;
};
}
function jt(e, t) {
return e = +e, t = +t, function(n) {
return e * (1 - n) + t * n;
};
}
function Ed(e, t) {
var n = {}, r = {}, i;
(e === null || typeof e != "object") && (e = {}), (t === null || typeof t != "object") && (t = {});
for (i in t)
i in e ? n[i] = Pt(e[i], t[i]) : r[i] = t[i];
return function(s) {
for (i in n) r[i] = n[i](s);
return r;
};
}
var ys = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Wi = new RegExp(ys.source, "g");
function Dd(e) {
return function() {
return e;
};
}
function $d(e) {
return function(t) {
return e(t) + "";
};
}
function Hl(e, t) {
var n = ys.lastIndex = Wi.lastIndex = 0, r, i, s, a = -1, o = [], l = [];
for (e = e + "", t = t + ""; (r = ys.exec(e)) && (i = Wi.exec(t)); )
(s = i.index) > n && (s = t.slice(n, s), o[a] ? o[a] += s : o[++a] = s), (r = r[0]) === (i = i[0]) ? o[a] ? o[a] += i : o[++a] = i : (o[++a] = null, l.push({ i: a, x: jt(r, i) })), n = Wi.lastIndex;
return n < t.length && (s = t.slice(n), o[a] ? o[a] += s : o[++a] = s), o.length < 2 ? l[0] ? $d(l[0].x) : Dd(t) : (t = l.length, function(u) {
for (var c = 0, h; c < t; ++c) o[(h = l[c]).i] = h.x(u);
return o.join("");
});
}
function Pt(e, t) {
var n = typeof t, r;
return t == null || n === "boolean" ? vi(t) : (n === "number" ? jt : n === "string" ? (r = je(t)) ? (t = r, Yr) : Hl : t instanceof je ? Yr : t instanceof Date ? Pd : Ul(t) ? Vl : Array.isArray(t) ? Wl : typeof t.valueOf != "function" && typeof t.toString != "function" || isNaN(t) ? Ed : jt)(e, t);
}
function jl(e, t) {
return e = +e, t = +t, function(n) {
return Math.round(e * (1 - n) + t * n);
};
}
var ja = 180 / Math.PI, vs = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function zl(e, t, n, r, i, s) {
var a, o, l;
return (a = Math.sqrt(e * e + t * t)) && (e /= a, t /= a), (l = e * n + t * r) && (n -= e * l, r -= t * l), (o = Math.sqrt(n * n + r * r)) && (n /= o, r /= o, l /= o), e * r < t * n && (e = -e, t = -t, l = -l, a = -a), {
translateX: i,
translateY: s,
rotate: Math.atan2(t, e) * ja,
skewX: Math.atan(l) * ja,
scaleX: a,
scaleY: o
};
}
var br;
function Fd(e) {
const t = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(e + "");
return t.isIdentity ? vs : zl(t.a, t.b, t.c, t.d, t.e, t.f);
}
function Ld(e) {
return e == null || (br || (br = document.createElementNS("http://www.w3.org/2000/svg", "g")), br.setAttribute("transform", e), !(e = br.transform.baseVal.consolidate())) ? vs : (e = e.matrix, zl(e.a, e.b, e.c, e.d, e.e, e.f));
}
function Zl(e, t, n, r) {
function i(u) {
return u.length ? u.pop() + " " : "";
}
function s(u, c, h, f, d, p) {
if (u !== h || c !== f) {
var g = d.push("translate(", null, t, null, n);
p.push({ i: g - 4, x: jt(u, h) }, { i: g - 2, x: jt(c, f) });
} else (h || f) && d.push("translate(" + h + t + f + n);
}
function a(u, c, h, f) {
u !== c ? (u - c > 180 ? c += 360 : c - u > 180 && (u += 360), f.push({ i: h.push(i(h) + "rotate(", null, r) - 2, x: jt(u, c) })) : c && h.push(i(h) + "rotate(" + c + r);
}
function o(u, c, h, f) {
u !== c ? f.push({ i: h.push(i(h) + "skewX(", null, r) - 2, x: jt(u, c) }) : c && h.push(i(h) + "skewX(" + c + r);
}
function l(u, c, h, f, d, p) {
if (u !== h || c !== f) {
var g = d.push(i(d) + "scale(", null, ",", null, ")");
p.push({ i: g - 4, x: jt(u, h) }, { i: g - 2, x: jt(c, f) });
} else (h !== 1 || f !== 1) && d.push(i(d) + "scale(" + h + "," + f + ")");
}
return function(u, c) {
var h = [], f = [];
return u = e(u), c = e(c), s(u.translateX, u.translateY, c.translateX, c.translateY, h, f), a(u.rotate, c.rotate, h, f), o(u.skewX, c.skewX, h, f), l(u.scaleX, u.scaleY, c.scaleX, c.scaleY, h, f), u = c = null, function(d) {
for (var p = -1, g = f.length, m; ++p < g; ) h[(m = f[p]).i] = m.x(d);
return h.join("");
};
};
}
var Rd = Zl(Fd, "px, ", "px)", "deg)"), Vd = Zl(Ld, ", ", ")", ")");
function Yl(e) {
return function t(n) {
n = +n;
function r(i, s) {
var a = e((i = Ie(i)).h, (s = Ie(s)).h), o = un(i.s, s.s), l = un(i.l, s.l), u = un(i.opacity, s.opacity);
return function(c) {
return i.h = a(c), i.s = o(c), i.l = l(Math.pow(c, n)), i.opacity = u(c), i + "";
};
}
return r.gamma = t, r;
}(1);
}
Yl(Ad);
var Kl = Yl(un), mn = 0, Un = 0, En = 0, Gl = 1e3, Gr, Wn, qr = 0, ze = 0, bi = 0, tr = typeof performance == "object" && performance.now ? performance : Date, ql = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(e) {
setTimeout(e, 17);
};
function xi() {
return ze || (ql(Ud), ze = tr.now() + bi);
}
function Ud() {
ze = 0;
}
function er() {
this._call = this._time = this._next = null;
}
er.prototype = ta.prototype = {
constructor: er,
restart: function(e, t, n) {
if (typeof e != "function") throw new TypeError("callback is not a function");
n = (n == null ? xi() : +n) + (t == null ? 0 : +t), !this._next && Wn !== this && (Wn ? Wn._next = this : Gr = this, Wn = this), this._call = e, this._time = n, bs();
},
stop: function() {
this._call && (this._call = null, this._time = 1 / 0, bs());
}
};
function ta(e, t, n) {
var r = new er();
return r.restart(e, t, n), r;
}
function Wd() {
xi(), ++mn;
for (var e = Gr, t; e; )
(t = ze - e._time) >= 0 && e._call.call(void 0, t), e = e._next;
--mn;
}
function za() {
ze = (qr = tr.now()) + bi, mn = Un = 0;
try {
Wd();
} finally {
mn = 0, jd(), ze = 0;
}
}
function Hd() {
var e = tr.now(), t = e - qr;
t > Gl && (bi -= t, qr = e);
}
function jd() {
for (var e, t = Gr, n, r = 1 / 0; t; )
t._call ? (r > t._time && (r = t._time), e = t, t = t._next) : (n = t._next, t._next = null, t = e ? e._next = n : Gr = n);
Wn = e, bs(r);
}
function bs(e) {
if (!mn) {
Un && (Un = clearTimeout(Un));
var t = e - ze;
t > 24 ? (e < 1 / 0 && (Un = setTimeout(za, e - tr.now() - bi)), En && (En = clearInterval(En))) : (En || (qr = tr.now(), En = setInterval(Hd, Gl)), mn = 1, ql(za));
}
}
function Za(e, t, n) {
var r = new er();
return t = t == null ? 0 : +t, r.restart((i) => {
r.stop(), e(i + t);
}, t, n), r;
}
function zd(e, t, n) {
var r = new er(), i = t;
return t == null ? (r.restart(e, t, n), r) : (r._restart = r.restart, r.restart = function(s, a, o) {
a = +a, o = o == null ? xi() : +o, r._restart(function l(u) {
u += i, r._restart(l, i += a, o), s(u);
}, a, o);
}, r.restart(e, t, n), r);
}
var Zd = pi("start", "end", "cancel", "interrupt"), Yd = [], Bl = 0, Ya = 1, xs = 2, Rr = 3, Ka = 4, ws = 5, Vr = 6;
function wi(e, t, n, r, i, s) {
var a = e.__transition;
if (!a) e.__transition = {};
else if (n in a) return;
Kd(e, n, {
name: t,
index: r,
// For context during callback.
group: i,
// For context during callback.
on: Zd,
tween: Yd,
time: s.time,
delay: s.delay,
duration: s.duration,
ease: s.ease,
timer: null,
state: Bl
});
}
function ea(e, t) {
var n = Gt(e, t);
if (n.state > Bl) throw new Error("too late; already scheduled");
return n;
}
function re(e, t) {
var n = Gt(e, t);
if (n.state > Rr) throw new Error("too late; already running");
return n;
}
function Gt(e, t) {
var n = e.__transition;
if (!n || !(n = n[t])) throw new Error("transition not found");
return n;
}
function Kd(e, t, n) {
var r = e.__transition, i;
r[t] = n, n.timer = ta(s, 0, n.time);
function s(u) {
n.state = Ya, n.timer.restart(a, n.delay, n.time), n.delay <= u && a(u - n.delay);
}
function a(u) {
var c, h, f, d;
if (n.state !== Ya) return l();
for (c in r)
if (d = r[c], d.name === n.name) {
if (d.state === Rr) return Za(a);
d.state === Ka ? (d.state = Vr, d.timer.stop(), d.on.call("interrupt", e, e.__data__, d.index, d.group), delete r[c]) : +c < t && (d.state = Vr, d.timer.stop(), d.on.call("cancel", e, e.__data__, d.index, d.group), delete r[c]);
}
if (Za(function() {
n.state === Rr && (n.state = Ka, n.timer.restart(o, n.delay, n.time), o(u));
}), n.state = xs, n.on.call("start", e, e.__data__, n.index, n.group), n.state === xs) {
for (n.state = Rr, i = new Array(f = n.tween.length), c = 0, h = -1; c < f; ++c)
(d = n.tween[c].value.call(e, e.__data__, n.index, n.group)) && (i[++h] = d);
i.length = h + 1;
}
}
function o(u) {
for (var c = u < n.duration ? n.ease.call(null, u / n.duration) : (n.timer.restart(l), n.state = ws, 1), h = -1, f = i.length; ++h < f; )
i[h].call(e, c);
n.state === ws && (n.on.call("end", e, e.__data__, n.index, n.group), l());
}
function l() {
n.state = Vr, n.timer.stop(), delete r[t];
for (var u in r) return;
delete e.__transition;
}
}
function Gd(e, t) {
var n = e.__transition, r, i, s = !0, a;
if (n) {
t = t == null ? null : t + "";
for (a in n) {
if ((r = n[a]).name !== t) {
s = !1;
continue;
}
i = r.state > xs && r.state < ws, r.state = Vr, r.timer.stop(), r.on.call(i ? "interrupt" : "cancel", e, e.__data__, r.index, r.group), delete n[a];
}
s && delete e.__transition;
}
}
function qd(e) {
return this.each(function() {
Gd(this, e);
});
}
function Bd(e, t) {
var n, r;
return function() {
var i = re(this, e), s = i.tween;
if (s !== n) {
r = n = s;
for (var a = 0, o = r.length; a < o; ++a)
if (r[a].name === t) {
r = r.slice(), r.splice(a, 1);
break;
}
}
i.tween = r;
};
}
function Xd(e, t, n) {
var r, i;
if (typeof n != "function") throw new Error();
return function() {
var s = re(this, e), a = s.tween;
if (a !== r) {
i = (r = a).slice();
for (var o = { name: t, value: n }, l = 0, u = i.length; l < u; ++l)
if (i[l].name === t) {
i[l] = o;
break;
}
l === u && i.push(o);
}
s.tween = i;
};
}
function Jd(e, t) {
var n = this._id;
if (e += "", arguments.length < 2) {
for (var r = Gt(this.node(), n).tween, i = 0, s = r.length, a; i < s; ++i)
if ((a = r[i]).name === e)
return a.value;
return null;
}
return this.each((t == null ? Bd : Xd)(n, e, t));
}
function na(e, t, n) {
var r = e._id;
return e.each(function() {
var i = re(this, r);
(i.value || (i.value = {}))[t] = n.apply(this, arguments);
}), function(i) {
return Gt(i, r).value[t];
};
}
function Xl(e, t) {
var n;
return (typeof t == "number" ? jt : t instanceof je ? Yr : (n = je(t)) ? (t = n, Yr) : Hl)(e, t);
}
function Qd(e) {
return function() {
this.removeAttribute(e);
};
}
function tp(e) {
return function() {
this.removeAttributeNS(e.space, e.local);
};
}
function ep(e, t, n) {
var r, i = n + "", s;
return function() {
var a = this.getAttribute(e);
return a === i ? null : a === r ? s : s = t(r = a, n);
};
}
function np(e, t, n) {
var r, i = n + "", s;
return function() {
var a = this.getAttributeNS(e.space, e.local);
return a === i ? null : a === r ? s : s = t(r = a, n);
};
}
function rp(e, t, n) {
var r, i, s;
return function() {
var a, o = n(this), l;
return o == null ? void this.removeAttribute(e) : (a = this.getAttribute(e), l = o + "", a === l ? null : a === r && l === i ? s : (i = l, s = t(r = a, o)));
};
}
function ip(e, t, n) {
var r, i, s;
return function() {
var a, o = n(this), l;
return o == null ? void this.removeAttributeNS(e.space, e.local) : (a = this.getAttributeNS(e.space, e.local), l = o + "", a === l ? null : a === r && l === i ? s : (i = l, s = t(r = a, o)));
};
}
function sp(e, t) {
var n = mi(e), r = n === "transform" ? Vd : Xl;
return this.attrTween(e, typeof t == "function" ? (n.local ? ip : rp)(n, r, na(this, "attr." + e, t)) : t == null ? (n.local ? tp : Qd)(n) : (n.local ? np : ep)(n, r, t));
}
function ap(e, t) {
return function(n) {
this.setAttribute(e, t.call(this, n));
};
}
function op(e, t) {
return function(n) {
this.setAttributeNS(e.space, e.local, t.call(this, n));
};
}
function lp(e, t) {
var n, r;
function i() {
var s = t.apply(this, arguments);
return s !== r && (n = (r = s) && op(e, s)), n;
}
return i._value = t, i;
}
function up(e, t) {
var n, r;
function i() {
var s = t.apply(this, arguments);
return s !== r && (n = (r = s) && ap(e, s)), n;
}
return i._value = t, i;
}
function cp(e, t) {
var n = "attr." + e;
if (arguments.length < 2) return (n = this.tween(n)) && n._value;
if (t == null) return this.tween(n, null);
if (typeof t != "function") throw new Error();
var r = mi(e);
return this.tween(n, (r.local ? lp : up)(r, t));
}
function hp(e, t) {
return function() {
ea(this, e).delay = +t.apply(this, arguments);
};
}
function fp(e, t) {
return t = +t, function() {
ea(this, e).delay = t;
};
}
function dp(e) {
var t = this._id;
return arguments.length ? this.each((typeof e == "function" ? hp : fp)(t, e)) : Gt(this.node(), t).delay;
}
function pp(e, t) {
return function() {
re(this, e).duration = +t.apply(this, arguments);
};
}
function mp(e, t) {
return t = +t, function() {
re(this, e).duration = t;
};
}
function gp(e) {
var t = this._id;
return arguments.length ? this.each((typeof e == "function" ? pp : mp)(t, e)) : Gt(this.node(), t).duration;
}
function yp(e, t) {
if (typeof t != "function") throw new Error();
return function() {
re(this, e).ease = t;
};
}
function vp(e) {
var t = this._id;
return arguments.length ? this.each(yp(t, e)) : Gt(this.node(), t).ease;
}
function bp(e, t) {
return function() {
var n = t.apply(this, arguments);
if (typeof n != "function") throw new Error();
re(this, e).ease = n;
};
}
function xp(e) {
if (typeof e != "function") throw new Error();
return this.each(bp(this._id, e));
}
function wp(e) {
typeof e != "function" && (e = _l(e));
for (var t = this._groups, n = t.length, r = new Array(n), i = 0; i < n; ++i)
for (var s = t[i], a = s.length, o = r[i] = [], l, u = 0; u < a; ++u)
(l = s[u]) && e.call(l, l.__data__, u, s) && o.push(l);
return new fe(r, this._parents, this._name, this._id);
}
function Sp(e) {
if (e._id !== this._id) throw new Error();
for (var t = this._groups, n = e._groups, r = t.length, i = n.length, s = Math.min(r, i), a = new Array(r), o = 0; o < s; ++o)
for (var l = t[o], u = n[o], c = l.length, h = a[o] = new Array(c), f, d = 0; d < c; ++d)
(f = l[d] || u[d]) && (h[d] = f);
for (; o < r; ++o)
a[o] = t[o];
return new fe(a, this._parents, this._name, this._id);
}
function Tp(e) {
return (e + "").trim().split(/^|\s+/).every(function(t) {
var n = t.indexOf(".");
return n >= 0 && (t = t.slice(0, n)), !t || t === "start";
});
}
function _p(e, t, n) {
var r, i, s = Tp(t) ? ea : re;
return function() {
var a = s(this, e), o = a.on;
o !== r && (i = (r = o).copy()).on(t, n), a.on = i;
};
}
function Mp(e, t) {
var n = this._id;
return arguments.length < 2 ? Gt(this.node(), n).on.on(e) : this.each(_p(n, e, t));
}
function kp(e) {
return function() {
var t = this.parentNode;
for (var n in this.__transition) if (+n !== e) return;
t && t.removeChild(this);
};
}
function Op() {
return this.on("end.remove", kp(this._id));
}
function Cp(e) {
var t = this._name, n = this._id;
typeof e != "function" && (e = qs(e));
for (var r = this._groups, i = r.length, s = new Array(i), a = 0; a < i; ++a)
for (var o = r[a], l = o.length, u = s[a] = new Array(l), c, h, f = 0; f < l; ++f)
(c = o[f]) && (h = e.call(c, c.__data__, f, o)) && ("__data__" in c && (h.__data__ = c.__data__), u[f] = h, wi(u[f], t, n, f, u, Gt(c, n)));
return new fe(s, this._parents, t, n);
}
function Ip(e) {
var t = this._name, n = this._id;
typeof e != "function" && (e = Tl(e));
for (var r = this._groups, i = r.length, s = [], a = [], o = 0; o < i; ++o)
for (var l = r[o], u = l.length, c, h = 0; h < u; ++h)
if (c = l[h]) {
for (var f = e.call(c, c.__data__, h, l), d, p = Gt(c, n), g = 0, m = f.length; g < m; ++g)
(d = f[g]) && wi(d, t, n, g, f, p);
s.push(f), a.push(c);
}
return new fe(s, a, t, n);
}
var Ap = Mn.prototype.constructor;
function Np() {
return new Ap(this._groups, this._parents);
}
function Pp(e, t) {
var n, r, i;
return function() {
var s = dn(this, e), a = (this.style.removeProperty(e), dn(this, e));
return s === a ? null : s === n && a === r ? i : i = t(n = s, r = a);
};
}
function Jl(e) {
return function() {
this.style.removeProperty(e);
};
}
function Ep(e, t, n) {
var r, i = n + "", s;
return function() {
var a = dn(this, e);
return a === i ? null : a === r ? s : s = t(r = a, n);
};
}
function Dp(e, t, n) {
var r, i, s;
return function() {
var a = dn(this, e), o = n(this), l = o + "";
return o == null && (l = o = (this.style.removeProperty(e), dn(this, e))), a === l ? null : a === r && l === i ? s : (i = l, s = t(r = a, o));
};
}
function $p(e, t) {
var n, r, i, s = "style." + t, a = "end." + s, o;
return function() {
var l = re(this, e), u = l.on, c = l.value[s] == null ? o || (o = Jl(t)) : void 0;
(u !== n || i !== c) && (r = (n = u).copy()).on(a, i = c), l.on = r;
};
}
function Fp(e, t, n) {
var r = (e += "") == "transform" ? Rd : Xl;
return t == null ? this.styleTween(e, Pp(e, r)).on("end.style." + e, Jl(e)) : typeof t == "function" ? this.styleTween(e, Dp(e, r, na(this, "style." + e, t))).each($p(this._id, e)) : this.styleTween(e, Ep(e, r, t), n).on("end.style." + e, null);
}
function Lp(e, t, n) {
return function(r) {
this.style.setProperty(e, t.call(this, r), n);
};
}
function Rp(e, t, n) {
var r, i;
function s() {
var a = t.apply(this, arguments);
return a !== i && (r = (i = a) && Lp(e, a, n)), r;
}
return s._value = t, s;
}
function Vp(e, t, n) {
var r = "style." + (e += "");
if (arguments.length < 2) return (r = this.tween(r)) && r._value;
if (t == null) return this.tween(r, null);
if (typeof t != "function") throw new Error();
return this.tween(r, Rp(e, t, n ?? ""));
}
function Up(e) {
return function() {
this.textContent = e;
};
}
function Wp(e) {
return function() {
var t = e(this);
this.textContent = t ?? "";
};
}
function Hp(e) {
return this.tween("text", typeof e == "function" ? Wp(na(this, "text", e)) : Up(e == null ? "" : e + ""));
}
function jp(e) {
return function(t) {
this.textContent = e.call(this, t);
};
}
function zp(e) {
var t, n;
function r() {
var i = e.apply(this, arguments);
return i !== n && (t = (n = i) && jp(i)), t;
}
return r._value = e, r;
}
function Zp(e) {
var t = "text";
if (arguments.length < 1) return (t = this.tween(t)) && t._value;
if (e == null) return this.tween(t, null);
if (typeof e != "function") throw new Error();
return this.tween(t, zp(e));
}
function Yp() {
for (var e = this._name, t = this._id, n = Ql(), r = this._groups, i = r.length, s = 0; s < i; ++s)
for (var a = r[s], o = a.length, l, u = 0; u < o; ++u)
if (l = a[u]) {
var c = Gt(l, t);
wi(l, e, n, u, a, {
time: c.time + c.delay + c.duration,
delay: 0,
duration: c.duration,
ease: c.ease
});
}
return new fe(r, this._parents, e, n);
}
function Kp() {
var e, t, n = this, r = n._id, i = n.size();
return new Promise(function(s, a) {
var o = { value: a }, l = { value: function() {
--i === 0 && s();
} };
n.each(function() {
var u = re(this, r), c = u.on;
c !== e && (t = (e = c).copy(), t._.cancel.push(o), t._.interrupt.push(o), t._.end.push(l)), u.on = t;
}), i === 0 && s();
});
}
var Gp = 0;
function fe(e, t, n, r) {
this._groups = e, this._parents = t, this._name = n, this._id = r;
}
function ee(e) {
return Mn().transition(e);
}
function Ql() {
return ++Gp;
}
var se = Mn.prototype;
fe.prototype = ee.prototype = {
constructor: fe,
select: Cp,
selectAll: Ip,
selectChild: se.selectChild,
selectChildren: se.selectChildren,
filter: wp,
merge: Sp,
selection: Np,
transition: Yp,
call: se.call,
nodes: se.nodes,
node: se.node,
size: se.size,
empty: se.empty,
each: se.each,
on: Mp,
attr: sp,
attrTween: cp,
style: Fp,
styleTween: Vp,
text: Hp,
textTween: Zp,
remove: Op,
tween: Jd,
delay: dp,
duration: gp,
ease: vp,
easeVarying: xp,
end: Kp,
[Symbol.iterator]: se[Symbol.iterator]
};
const Ae = (e) => +e;
function qp(e) {
return ((e *= 2) <= 1 ? e * e * e : (e -= 2) * e * e + 2) / 2;
}
var Bp = {
time: null,
// Set on use.
delay: 0,
duration: 250,
ease: qp
};
function Xp(e, t) {
for (var n; !(n = e.__transition) || !(n = n[t]); )
if (!(e = e.parentNode))
throw new Error(`transition ${t} not found`);
return n;
}
function Jp(e) {
var t, n;
e instanceof fe ? (t = e._id, e = e._name) : (t = Ql(), (n = Bp).time = xi(), e = e == null ? null : e + "");
for (var r = this._groups, i = r.length, s = 0; s < i; ++s)
for (var a = r[s], o = a.length, l, u = 0; u < o; ++u)
(l = a[u]) && wi(l, e, t, u, a, n || Xp(l, t));
return new fe(r, this._parents, e, t);
}
Mn.prototype.interrupt = qd;
Mn.prototype.transition = Jp;
const Ss = Math.PI, Ts = 2 * Ss, Fe = 1e-6, Qp = Ts - Fe;
function tu(e) {
this._ += e[0];
for (let t = 1, n = e.length; t < n; ++t)
this._ += arguments[t] + e[t];
}
function tm(e) {
let t = Math.floor(e);
if (!(t >= 0)) throw new Error(`invalid digits: ${e}`);
if (t > 15) return tu;
const n = 10 ** t;
return function(r) {
this._ += r[0];
for (let i = 1, s = r.length; i < s; ++i)
this._ += Math.round(arguments[i] * n) / n + r[i];
};
}
class ra {
constructor(t) {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null, this._ = "", this._append = t == null ? tu : tm(t);
}
moveTo(t, n) {
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +n}`;
}
closePath() {
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
}
lineTo(t, n) {
this._append`L${this._x1 = +t},${this._y1 = +n}`;
}
quadraticCurveTo(t, n, r, i) {
this._append`Q${+t},${+n},${this._x1 = +r},${this._y1 = +i}`;
}
bezierCurveTo(t, n, r, i, s, a) {
this._append`C${+t},${+n},${+r},${+i},${this._x1 = +s},${this._y1 = +a}`;
}
arcTo(t, n, r, i, s) {
if (t = +t, n = +n, r = +r, i = +i, s = +s, s < 0) throw new Error(`negative radius: ${s}`);
let a = this._x1, o = this._y1, l = r - t, u = i - n, c = a - t, h = o - n, f = c * c + h * h;
if (this._x1 === null)
this._append`M${this._x1 = t},${this._y1 = n}`;
else if (f > Fe) if (!(Math.abs(h * l - u * c) > Fe) || !s)
this._append`L${this._x1 = t},${this._y1 = n}`;
else {
let d = r - a, p = i - o, g = l * l + u * u, m = d * d + p * p, y = Math.sqrt(g), x = Math.sqrt(f), b = s * Math.tan((Ss - Math.acos((g + f - m) / (2 * y * x))) / 2), v = b / x, w = b / y;
Math.abs(v - 1) > Fe && this._append`L${t + v * c},${n + v * h}`, this._append`A${s},${s},0,0,${+(h * d > c * p)},${this._x1 = t + w * l},${this._y1 = n + w * u}`;
}
}
arc(t, n, r, i, s, a) {
if (t = +t, n = +n, r = +r, a = !!a, r < 0) throw new Error(`negative radius: ${r}`);
let o = r * Math.cos(i), l = r * Math.sin(i), u = t + o, c = n + l, h = 1 ^ a, f = a ? i - s : s - i;
this._x1 === null ? this._append`M${u},${c}` : (Math.abs(this._x1 - u) > Fe || Math.abs(this._y1 - c) > Fe) && this._append`L${u},${c}`, r && (f < 0 && (f = f % Ts + Ts), f > Qp ? this._append`A${r},${r},0,1,${h},${t - o},${n - l}A${r},${r},0,1,${h},${this._x1 = u},${this._y1 = c}` : f > Fe && this._append`A${r},${r},0,${+(f >= Ss)},${h},${this._x1 = t + r * Math.cos(s)},${this._y1 = n + r * Math.sin(s)}`);
}
rect(t, n, r, i) {
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +n}h${r = +r}v${+i}h${-r}Z`;
}
toString() {
return this._;
}
}
function eu() {
return new ra();
}
eu.prototype = ra.prototype;
function em(e) {
const t = +this._x.call(null, e), n = +this._y.call(null, e);
return nu(this.cover(t, n), t, n, e);
}
function nu(e, t, n, r) {
if (isNaN(t) || isNaN(n)) return e;
var i, s = e._root, a = { data: r }, o = e._x0, l = e._y0, u = e._x1, c = e._y1, h, f, d, p, g, m, y, x;
if (!s) return e._root = a, e;
for (; s.length; )
if ((g = t >= (h = (o + u) / 2)) ? o = h : u = h, (m = n >= (f = (l + c) / 2)) ? l = f : c = f, i = s, !(s = s[y = m << 1 | g])) return i[y] = a, e;
if (d = +e._x.call(null, s.data), p = +e._y.call(null, s.data), t === d && n === p) return a.next = s, i ? i[y] = a : e._root = a, e;
do
i = i ? i[y] = new Array(4) : e._root = new Array(4), (g = t >= (h = (o + u) / 2)) ? o = h : u = h, (m = n >= (f = (l + c) / 2)) ? l = f : c = f;
while ((y = m << 1 | g) === (x = (p >= f) << 1 | d >= h));
return i[x] = s, i[y] = a, e;
}
function nm(e) {
var t, n, r = e.length, i, s, a = new Array(r), o = new Array(r), l = 1 / 0, u = 1 / 0, c = -1 / 0, h = -1 / 0;
for (n = 0; n < r; ++n)
isNaN(i = +this._x.call(null, t = e[n])) || isNaN(s = +this._y.call(null, t)) || (a[n] = i, o[n] = s, i < l && (l = i), i > c && (c = i), s < u && (u = s), s > h && (h = s));
if (l > c || u > h) return this;
for (this.cover(l, u).cover(c, h), n = 0; n < r; ++n)
nu(this, a[n], o[n], e[n]);
return this;
}
function rm(e, t) {
if (isNaN(e = +e) || isNaN(t = +t)) return this;
var n = this._x0, r = this._y0, i = this._x1, s = this._y1;
if (isNaN(n))
i = (n = Math.floor(e)) + 1, s = (r = Math.floor(t)) + 1;
else {
for (var a = i - n || 1, o = this._root, l, u; n > e || e >= i || r > t || t >= s; )
switch (u = (t < r) << 1 | e < n, l = new Array(4), l[u] = o, o = l, a *= 2, u) {
case 0:
i = n + a, s = r + a;
break;
case 1:
n = i - a, s = r + a;
break;
case 2:
i = n + a, r = s - a;
break;
case 3:
n = i - a, r = s - a;
break;
}
this._root && this._root.length && (this._root = o);
}
return this._x0 = n, this._y0 = r, this._x1 = i, this._y1 = s, this;
}
function im() {
var e = [];
return this.visit(function(t) {
if (!t.length) do
e.push(t.data);
while (t = t.next);
}), e;
}
function sm(e) {
return arguments.length ? this.cover(+e[0][0], +e[0][1]).cover(+e[1][0], +e[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
}
function dt(e, t, n, r, i) {
this.node = e, this.x0 = t, this.y0 = n, this.x1 = r, this.y1 = i;
}
function am(e, t, n) {
var r, i = this._x0, s = this._y0, a, o, l, u, c = this._x1, h = this._y1, f = [], d = this._root, p, g;
for (d && f.push(new dt(d, i, s, c, h)), n == null ? n = 1 / 0 : (i = e - n, s = t - n, c = e + n, h = t + n, n *= n); p = f.pop(); )
if (!(!(d = p.node) || (a = p.x0) > c || (o = p.y0) > h || (l = p.x1) < i || (u = p.y1) < s))
if (d.length) {
var m = (a + l) / 2, y = (o + u) / 2;
f.push(
new dt(d[3], m, y, l, u),
new dt(d[2], a, y, m, u),
new dt(d[1], m, o, l, y),
new dt(d[0], a, o, m, y)
), (g = (t >= y) << 1 | e >= m) && (p = f[f.length - 1], f[f.length - 1] = f[f.length - 1 - g], f[f.length - 1 - g] = p);
} else {
var x = e - +this._x.call(null, d.data), b = t - +this._y.call(null, d.data), v = x * x + b * b;
if (v < n) {
var w = Math.sqrt(n = v);
i = e - w, s = t - w, c = e + w, h = t + w, r = d.data;
}
}
return r;
}
function om(e) {
if (isNaN(c = +this._x.call(null, e)) || isNaN(h = +this._y.call(null, e))) return this;
var t, n = this._root, r, i, s, a = this._x0, o = this._y0, l = this._x1, u = this._y1, c, h, f, d, p, g, m, y;
if (!n) return this;
if (n.length) for (; ; ) {
if ((p = c >= (f = (a + l) / 2)) ? a = f : l = f, (g = h >= (d = (o + u) / 2)) ? o = d : u = d, t = n, !(n = n[m = g << 1 | p])) return this;
if (!n.length) break;
(t[m + 1 & 3] || t[m + 2 & 3] || t[m + 3 & 3]) && (r = t, y = m);
}
for (; n.data !== e; ) if (i = n, !(n = n.next)) return this;
return (s = n.next) && delete n.next, i ? (s ? i.next = s : delete i.next, this) : t ? (s ? t[m] = s : delete t[m], (n = t[0] || t[1] || t[2] || t[3]) && n === (t[3] || t[2] || t[1] || t[0]) && !n.length && (r ? r[y] = n : this._root = n), this) : (this._root = s, this);
}
function lm(e) {
for (var t = 0, n = e.length; t < n; ++t) this.remove(e[t]);
return this;
}
function um() {
return this._root;
}
function cm() {
var e = 0;
return this.visit(function(t) {
if (!t.length) do
++e;
while (t = t.next);
}), e;
}
function hm(e) {
var t = [], n, r = this._root, i, s, a, o, l;
for (r && t.push(new dt(r, this._x0, this._y0, this._x1, this._y1)); n = t.pop(); )
if (!e(r = n.node, s = n.x0, a = n.y0, o = n.x1, l = n.y1) && r.length) {
var u = (s + o) / 2, c = (a + l) / 2;
(i = r[3]) && t.push(new dt(i, u, c, o, l)), (i = r[2]) && t.push(new dt(i, s, c, u, l)), (i = r[1]) && t.push(new dt(i, u, a, o, c)), (i = r[0]) && t.push(new dt(i, s, a, u, c));
}
return this;
}
function fm(e) {
var t = [], n = [], r;
for (this._root && t.push(new dt(this._root, this._x0, this._y0, this._x1, this._y1)); r = t.pop(); ) {
var i = r.node;
if (i.length) {
var s, a = r.x0, o = r.y0, l = r.x1, u = r.y1, c = (a + l) / 2, h = (o + u) / 2;
(s = i[0]) && t.push(new dt(s, a, o, c, h)), (s = i[1]) && t.push(new dt(s, c, o, l, h)), (s = i[2]) && t.push(new dt(s, a, h, c, u)), (s = i[3]) && t.push(new dt(s, c, h, l, u));
}
n.push(r);
}
for (; r = n.pop(); )
e(r.node, r.x0, r.y0, r.x1, r.y1);
return this;
}
function dm(e) {
return e[0];
}
function pm(e) {
return arguments.length ? (this._x = e, this) : this._x;
}
function mm(e) {
return e[1];
}
function gm(e) {
return arguments.length ? (this._y = e, this) : this._y;
}
function ru(e, t, n) {
var r = new ia(t ?? dm, n ?? mm, NaN, NaN, NaN, NaN);
return e == null ? r : r.addAll(e);
}
function ia(e, t, n, r, i, s) {
this._x = e, this._y = t, this._x0 = n, this._y0 = r, this._x1 = i, this._y1 = s, this._root = void 0;
}
function Ga(e) {
for (var t = { data: e.data }, n = t; e = e.next; ) n = n.next = { data: e.data };
return t;
}
var gt = ru.prototype = ia.prototype;
gt.copy = function() {
var e = new ia(this._x, this._y, this._x0, this._y0, this._x1, this._y1), t = this._root, n, r;
if (!t) return e;
if (!t.length) return e._root = Ga(t), e;
for (n = [{ source: t, target: e._root = new Array(4) }]; t = n.pop(); )
for (var i = 0; i < 4; ++i)
(r = t.source[i]) && (r.length ? n.push({ source: r, target: t.target[i] = new Array(4) }) : t.target[i] = Ga(r));
return e;
};
gt.add = em;
gt.addAll = nm;
gt.cover = rm;
gt.data = im;
gt.extent = sm;
gt.find = am;
gt.remove = om;
gt.removeAll = lm;
gt.root = um;
gt.size = cm;
gt.visit = hm;
gt.visitAfter = fm;
gt.x = pm;
gt.y = gm;
const ym = 1664525, vm = 1013904223, qa = 4294967296;
function bm() {
let e = 1;
return () => (e = (ym * e + vm) % qa) / qa;
}
var xm = 10, wm = Math.PI * (3 - Math.sqrt(5));
function Sm(e) {
var t, n = 1, r = 1e-3, i = 1 - Math.pow(r, 1 / 300), s = 0, a = 0.6, o = /* @__PURE__ */ new Map(), l = ta(h), u = pi("tick", "end"), c = bm();
e == null && (e = []);
function h() {
f(), u.call("tick", t), n < r && (l.stop(), u.call("end", t));
}
function f(g) {
var m, y = e.length, x;
g === void 0 && (g = 1);
for (var b = 0; b < g; ++b)
for (n += (s - n) * i, o.forEach(function(v) {
v(n);
}), m = 0; m < y; ++m)
x = e[m], x.fx == null ? x.x += x.vx *= a : (x.x = x.fx, x.vx = 0), x.fy == null ? x.y += x.vy *= a : (x.y = x.fy, x.vy = 0);
return t;
}
function d() {
for (var g = 0, m = e.length, y; g < m; ++g) {
if (y = e[g], y.index = g, y.fx != null && (y.x = y.fx), y.fy != null && (y.y = y.fy), isNaN(y.x) || isNaN(y.y)) {
var x = xm * Math.sqrt(0.5 + g), b = g * wm;
y.x = x * Math.cos(b), y.y = x * Math.sin(b);
}
(isNaN(y.vx) || isNaN(y.vy)) && (y.vx = y.vy = 0);
}
}
function p(g) {
return g.initialize && g.initialize(e, c), g;
}
return d(), t = {
tick: f,
restart: function() {
return l.restart(h), t;
},
stop: function() {
return l.stop(), t;
},
nodes: function(g) {
return arguments.length ? (e = g, d(), o.forEach(p), t) : e;
},
alpha: function(g) {
return arguments.length ? (n = +g, t) : n;
},
alphaMin: function(g) {
return arguments.length ? (r = +g, t) : r;
},
alphaDecay: function(g) {
return arguments.length ? (i = +g, t) : +i;
},
alphaTarget: function(g) {
return arguments.length ? (s = +g, t) : s;
},
velocityDecay: function(g) {
return arguments.length ? (a = 1 - g, t) : 1 - a;
},
randomSource: function(g) {
return arguments.length ? (c = g, o.forEach(p), t) : c;
},
force: function(g, m) {
return arguments.length > 1 ? (m == null ? o.delete(g) : o.set(g, p(m)), t) : o.get(g);
},
find: function(g, m, y) {
var x = 0, b = e.length, v, w, S, _, A;
for (y == null ? y = 1 / 0 : y *= y, x = 0; x < b; ++x)
_ = e[x], v = g - _.x, w = m - _.y, S = v * v + w * w, S < y && (A = _, y = S);
return A;
},
on: function(g, m) {
return arguments.length > 1 ? (u.on(g, m), t) : u.on(g);
}
};
}
function Tm(e) {
return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
}
function Br(e, t) {
if ((n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e")) < 0) return null;
var n, r = e.slice(0, n);
return [
r.length > 1 ? r[0] + r.slice(2) : r,
+e.slice(n + 1)
];
}
function gn(e) {
return e = Br(Math.abs(e)), e ? e[1] : NaN;
}
function _m(e, t) {
return function(n, r) {
for (var i = n.length, s = [], a = 0, o = e[0], l = 0; i > 0 && o > 0 && (l + o + 1 > r && (o = Math.max(1, r - l)), s.push(n.substring(i -= o, i + o)), !((l += o + 1) > r)); )
o = e[a = (a + 1) % e.length];
return s.reverse().join(t);
};
}
function Mm(e) {
return function(t) {
return t.replace(/[0-9]/g, function(n) {
return e[+n];
});
};
}
var km = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function de(e) {
if (!(t = km.exec(e))) throw new Error("invalid format: " + e);
var t;
return new sa({
fill: t[1],
align: t[2],
sign: t[3],
symbol: t[4],
zero: t[5],
width: t[6],
comma: t[7],
precision: t[8] && t[8].slice(1),
trim: t[9],
type: t[10]
});
}
de.prototype = sa.prototype;
function sa(e) {
this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
}
sa.prototype.toString = function() {
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
function Om(e) {
t: for (var t = e.length, n = 1, r = -1, i; n < t; ++n)
switch (e[n]) {
case ".":
r = i = n;
break;
case "0":
r === 0 && (r = n), i = n;
break;
default:
if (!+e[n]) break t;
r > 0 && (r = 0);
break;
}
return r > 0 ? e.slice(0, r) + e.slice(i + 1) : e;
}
var iu;
function Cm(e, t) {
var n = Br(e, t);
if (!n) return e + "";
var r = n[0], i = n[1], s = i - (iu = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, a = r.length;
return s === a ? r : s > a ? r + new Array(s - a + 1).join("0") : s > 0 ? r.slice(0, s) + "." + r.slice(s) : "0." + new Array(1 - s).join("0") + Br(e, Math.max(0, t + s - 1))[0];
}
function Ba(e, t) {
var n = Br(e, t);
if (!n) return e + "";
var r = n[0], i = n[1];
return i < 0 ? "0." + new Array(-i).join("0") + r : r.length > i + 1 ? r.slice(0, i + 1) + "." + r.slice(i + 1) : r + new Array(i - r.length + 2).join("0");
}
const Xa = {
"%": (e, t) => (e * 100).toFixed(t),
b: (e) => Math.round(e).toString(2),
c: (e) => e + "",
d: Tm,
e: (e, t) => e.toExponential(t),
f: (e, t) => e.toFixed(t),
g: (e, t) => e.toPrecision(t),
o: (e) => Math.round(e).toString(8),
p: (e, t) => Ba(e * 100, t),
r: Ba,
s: Cm,
X: (e) => Math.round(e).toString(16).toUpperCase(),
x: (e) => Math.round(e).toString(16)
};
function Ja(e) {
return e;
}
var Qa = Array.prototype.map, to = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function Im(e) {
var t = e.grouping === void 0 || e.thousands === void 0 ? Ja : _m(Qa.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", r = e.currency === void 0 ? "" : e.currency[1] + "", i = e.decimal === void 0 ? "." : e.decimal + "", s = e.numerals === void 0 ? Ja : Mm(Qa.call(e.numerals, String)), a = e.percent === void 0 ? "%" : e.percent + "", o = e.minus === void 0 ? "−" : e.minus + "", l = e.nan === void 0 ? "NaN" : e.nan + "";
function u(h) {
h = de(h);
var f = h.fill, d = h.align, p = h.sign, g = h.symbol, m = h.zero, y = h.width, x = h.comma, b = h.precision, v = h.trim, w = h.type;
w === "n" ? (x = !0, w = "g") : Xa[w] || (b === void 0 && (b = 12), v = !0, w = "g"), (m || f === "0" && d === "=") && (m = !0, f = "0", d = "=");
var S = g === "$" ? n : g === "#" && /[boxX]/.test(w) ? "0" + w.toLowerCase() : "", _ = g === "$" ? r : /[%p]/.test(w) ? a : "", A = Xa[w], F = /[defgprs%]/.test(w);
b = b === void 0 ? 6 : /[gprs]/.test(w) ? Math.max(1, Math.min(21, b)) : Math.max(0, Math.min(20, b));
function N(k) {
var $ = S, C = _, E, nt, rt;
if (w === "c")
C = A(k) + C, k = "";
else {
k = +k;
var Q = k < 0 || 1 / k < 0;
if (k = isNaN(k) ? l : A(Math.abs(k), b), v && (k = Om(k)), Q && +k == 0 && p !== "+" && (Q = !1), $ = (Q ? p === "(" ? p : o : p === "-" || p === "(" ? "" : p) + $, C = (w === "s" ? to[8 + iu / 3] : "") + C + (Q && p === "(" ? ")" : ""), F) {
for (E = -1, nt = k.length; ++E < nt; )
if (rt = k.charCodeAt(E), 48 > rt || rt > 57) {
C = (rt === 46 ? i + k.slice(E + 1) : k.slice(E)) + C, k = k.slice(0, E);
break;
}
}
}
x && !m && (k = t(k, 1 / 0));
var j = $.length + k.length + C.length, Z = j < y ? new Array(y - j + 1).join(f) : "";
switch (x && m && (k = t(Z + k, Z.length ? y - C.length : 1 / 0), Z = ""), d) {
case "<":
k = $ + k + C + Z;
break;
case "=":
k = $ + Z + k + C;
break;
case "^":
k = Z.slice(0, j = Z.length >> 1) + $ + k + C + Z.slice(j);
break;
default:
k = Z + $ + k + C;
break;
}
return s(k);
}
return N.toString = function() {
return h + "";
}, N;
}
function c(h, f) {
var d = u((h = de(h), h.type = "f", h)), p = Math.max(-8, Math.min(8, Math.floor(gn(f) / 3))) * 3, g = Math.pow(10, -p), m = to[8 + p / 3];
return function(y) {
return d(g * y) + m;
};
}
return {
format: u,
formatPrefix: c
};
}
var xr, Mt, su;
au({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function au(e) {
return xr = Im(e), Mt = xr.format, su = xr.formatPrefix, xr;
}
function yn(e) {
return Math.max(0, -gn(Math.abs(e)));
}
function Am(e, t) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(gn(t) / 3))) * 3 - gn(Math.abs(e)));
}
function Nm(e, t) {
return e = Math.abs(e), t = Math.abs(t) - e, Math.max(0, gn(t) - gn(e)) + 1;
}
function On(e, t) {
switch (arguments.length) {
case 0:
break;
case 1:
this.range(e);
break;
default:
this.range(t).domain(e);
break;
}
return this;
}
function Pm(e, t) {
switch (arguments.length) {
case 0:
break;
case 1: {
typeof e == "function" ? this.interpolator(e) : this.range(e);
break;
}
default: {
this.domain(e), typeof t == "function" ? this.interpolator(t) : this.range(t);
break;
}
}
return this;
}
const eo = Symbol("implicit");
function ou() {
var e = new ka(), t = [], n = [], r = eo;
function i(s) {
let a = e.get(s);
if (a === void 0) {
if (r !== eo) return r;
e.set(s, a = t.push(s) - 1);
}
return n[a % n.length];
}
return i.domain = function(s) {
if (!arguments.length) return t.slice();
t = [], e = new ka();
for (const a of s)
e.has(a) || e.set(a, t.push(a) - 1);
return i;
}, i.range = function(s) {
return arguments.length ? (n = Array.from(s), i) : n.slice();
}, i.unknown = function(s) {
return arguments.length ? (r = s, i) : r;
}, i.copy = function() {
return ou(t, n).unknown(r);
}, On.apply(i, arguments), i;
}
function vn() {
var e = ou().unknown(void 0), t = e.domain, n = e.range, r = 0, i = 1, s, a, o = !1, l = 0, u = 0, c = 0.5;
delete e.unknown;
function h() {
var f = t().length, d = i < r, p = d ? i : r, g = d ? r : i;
s = (g - p) / Math.max(1, f - l + u * 2), o && (s = Math.floor(s)), p += (g - p - s * (f - l)) * c, a = s * (1 - l), o && (p = Math.round(p), a = Math.round(a));
var m = Ks(f).map(function(y) {
return p + s * y;
});
return n(d ? m.reverse() : m);
}
return e.domain = function(f) {
return arguments.length ? (t(f), h()) : t();
}, e.range = function(f) {
return arguments.length ? ([r, i] = f, r = +r, i = +i, h()) : [r, i];
}, e.rangeRound = function(f) {
return [r, i] = f, r = +r, i = +i, o = !0, h();
}, e.bandwidth = function() {
return a;
}, e.step = function() {
return s;
}, e.round = function(f) {
return arguments.length ? (o = !!f, h()) : o;
}, e.padding = function(f) {
return arguments.length ? (l = Math.min(1, u = +f), h()) : l;
}, e.paddingInner = function(f) {
return arguments.length ? (l = Math.min(1, f), h()) : l;
}, e.paddingOuter = function(f) {
return arguments.length ? (u = +f, h()) : u;
}, e.align = function(f) {
return arguments.length ? (c = Math.max(0, Math.min(1, f)), h()) : c;
}, e.copy = function() {
return vn(t(), [r, i]).round(o).paddingInner(l).paddingOuter(u).align(c);
}, On.apply(h(), arguments);
}
function Em(e) {
return function() {
return e;
};
}
function Dm(e) {
return +e;
}
var no = [0, 1];
function ke(e) {
return e;
}
function _s(e, t) {
return (t -= e = +e) ? function(n) {
return (n - e) / t;
} : Em(isNaN(t) ? NaN : 0.5);
}
function $m(e, t) {
var n;
return e > t && (n = e, e = t, t = n), function(r) {
return Math.max(e, Math.min(t, r));
};
}
function Fm(e, t, n) {
var r = e[0], i = e[1], s = t[0], a = t[1];
return i < r ? (r = _s(i, r), s = n(a, s)) : (r = _s(r, i), s = n(s, a)), function(o) {
return s(r(o));
};
}
function Lm(e, t, n) {
var r = Math.min(e.length, t.length) - 1, i = new Array(r), s = new Array(r), a = -1;
for (e[r] < e[0] && (e = e.slice().reverse(), t = t.slice().reverse()); ++a < r; )
i[a] = _s(e[a], e[a + 1]), s[a] = n(t[a], t[a + 1]);
return function(o) {
var l = Ys(e, o, 1, r) - 1;
return s[l](i[l](o));
};
}
function lu(e, t) {
return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
}
function Rm() {
var e = no, t = no, n = Pt, r, i, s, a = ke, o, l, u;
function c() {
var f = Math.min(e.length, t.length);
return a !== ke && (a = $m(e[0], e[f - 1])), o = f > 2 ? Lm : Fm, l = u = null, h;
}
function h(f) {
return f == null || isNaN(f = +f) ? s : (l || (l = o(e.map(r), t, n)))(r(a(f)));
}
return h.invert = function(f) {
return a(i((u || (u = o(t, e.map(r), jt)))(f)));
}, h.domain = function(f) {
return arguments.length ? (e = Array.from(f, Dm), c()) : e.slice();
}, h.range = function(f) {
return arguments.length ? (t = Array.from(f), c()) : t.slice();
}, h.rangeRound = function(f) {
return t = Array.from(f), n = jl, c();
}, h.clamp = function(f) {
return arguments.length ? (a = f ? !0 : ke, c()) : a !== ke;
}, h.interpolate = function(f) {
return arguments.length ? (n = f, c()) : n;
}, h.unknown = function(f) {
return arguments.length ? (s = f, h) : s;
}, function(f, d) {
return r = f, i = d, c();
};
}
function uu() {
return Rm()(ke, ke);
}
function Vm(e, t, n, r) {
var i = cs(e, t, n), s;
switch (r = de(r ?? ",f"), r.type) {
case "s": {
var a = Math.max(Math.abs(e), Math.abs(t));
return r.precision == null && !isNaN(s = Am(i, a)) && (r.precision = s), su(r, a);
}
case "":
case "e":
case "g":
case "p":
case "r": {
r.precision == null && !isNaN(s = Nm(i, Math.max(Math.abs(e), Math.abs(t)))) && (r.precision = s - (r.type === "e"));
break;
}
case "f":
case "%": {
r.precision == null && !isNaN(s = yn(i)) && (r.precision = s - (r.type === "%") * 2);
break;
}
}
return Mt(r);
}
function aa(e) {
var t = e.domain;
return e.ticks = function(n) {
var r = t();
return yh(r[0], r[r.length - 1], n ?? 10);
}, e.tickFormat = function(n, r) {
var i = t();
return Vm(i[0], i[i.length - 1], n ?? 10, r);
}, e.nice = function(n) {
n == null && (n = 10);
var r = t(), i = 0, s = r.length - 1, a = r[i], o = r[s], l, u, c = 10;
for (o < a && (u = a, a = o, o = u, u = i, i = s, s = u); c-- > 0; ) {
if (u = Bn(a, o, n), u === l)
return r[i] = a, r[s] = o, t(r);
if (u > 0)
a = Math.floor(a / u) * u, o = Math.ceil(o / u) * u;
else if (u < 0)
a = Math.ceil(a * u) / u, o = Math.floor(o * u) / u;
else
break;
l = u;
}
return e;
}, e;
}
function wt() {
var e = uu();
return e.copy = function() {
return lu(e, wt());
}, On.apply(e, arguments), aa(e);
}
function Um(e, t) {
e = e.slice();
var n = 0, r = e.length - 1, i = e[n], s = e[r], a;
return s < i && (a = n, n = r, r = a, a = i, i = s, s = a), e[n] = t.floor(i), e[r] = t.ceil(s), e;
}
function oa() {
var e = 0, t = 1, n = 1, r = [0.5], i = [0, 1], s;
function a(l) {
return l != null && l <= l ? i[Ys(r, l, 0, n)] : s;
}
function o() {
var l = -1;
for (r = new Array(n); ++l < n; ) r[l] = ((l + 1) * t - (l - n) * e) / (n + 1);
return a;
}
return a.domain = function(l) {
return arguments.length ? ([e, t] = l, e = +e, t = +t, o()) : [e, t];
}, a.range = function(l) {
return arguments.length ? (n = (i = Array.from(l)).length - 1, o()) : i.slice();
}, a.invertExtent = function(l) {
var u = i.indexOf(l);
return u < 0 ? [NaN, NaN] : u < 1 ? [e, r[0]] : u >= n ? [r[n - 1], t] : [r[u - 1], r[u]];
}, a.unknown = function(l) {
return arguments.length && (s = l), a;
}, a.thresholds = function() {
return r.slice();
}, a.copy = function() {
return oa().domain([e, t]).range(i).unknown(s);
}, On.apply(aa(a), arguments);
}
function cu() {
var e = [0.5], t = [0, 1], n, r = 1;
function i(s) {
return s != null && s <= s ? t[Ys(e, s, 0, r)] : n;
}
return i.domain = function(s) {
return arguments.length ? (e = Array.from(s), r = Math.min(e.length, t.length - 1), i) : e.slice();
}, i.range = function(s) {
return arguments.length ? (t = Array.from(s), r = Math.min(e.length, t.length - 1), i) : t.slice();
}, i.invertExtent = function(s) {
var a = t.indexOf(s);
return [e[a - 1], e[a]];
}, i.unknown = function(s) {
return arguments.length ? (n = s, i) : n;
}, i.copy = function() {
return cu().domain(e).range(t).unknown(n);
}, On.apply(i, arguments);
}
const Hi = /* @__PURE__ */ new Date(), ji = /* @__PURE__ */ new Date();
function et(e, t, n, r) {
function i(s) {
return e(s = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+s)), s;
}
return i.floor = (s) => (e(s = /* @__PURE__ */ new Date(+s)), s), i.ceil = (s) => (e(s = new Date(s - 1)), t(s, 1), e(s), s), i.round = (s) => {
const a = i(s), o = i.ceil(s);
return s - a < o - s ? a : o;
}, i.offset = (s, a) => (t(s = /* @__PURE__ */ new Date(+s), a == null ? 1 : Math.floor(a)), s), i.range = (s, a, o) => {
const l = [];
if (s = i.ceil(s), o = o == null ? 1 : Math.floor(o), !(s < a) || !(o > 0)) return l;
let u;
do
l.push(u = /* @__PURE__ */ new Date(+s)), t(s, o), e(s);
while (u < s && s < a);
return l;
}, i.filter = (s) => et((a) => {
if (a >= a) for (; e(a), !s(a); ) a.setTime(a - 1);
}, (a, o) => {
if (a >= a)
if (o < 0) for (; ++o <= 0; )
for (; t(a, -1), !s(a); )
;
else for (; --o >= 0; )
for (; t(a, 1), !s(a); )
;
}), n && (i.count = (s, a) => (Hi.setTime(+s), ji.setTime(+a), e(Hi), e(ji), Math.floor(n(Hi, ji))), i.every = (s) => (s = Math.floor(s), !isFinite(s) || !(s > 0) ? null : s > 1 ? i.filter(r ? (a) => r(a) % s === 0 : (a) => i.count(0, a) % s === 0) : i)), i;
}
const Xr = et(() => {
}, (e, t) => {
e.setTime(+e + t);
}, (e, t) => t - e);
Xr.every = (e) => (e = Math.floor(e), !isFinite(e) || !(e > 0) ? null : e > 1 ? et((t) => {
t.setTime(Math.floor(t / e) * e);
}, (t, n) => {
t.setTime(+t + n * e);
}, (t, n) => (n - t) / e) : Xr);
Xr.range;
const ue = 1e3, Et = ue * 60, ce = Et * 60, pe = ce * 24, la = pe * 7, ro = pe * 30, zi = pe * 365, Re = et((e) => {
e.setTime(e - e.getMilliseconds());
}, (e, t) => {
e.setTime(+e + t * ue);
}, (e, t) => (t - e) / ue, (e) => e.getUTCSeconds());
Re.range;
const Wm = et((e) => {
e.setTime(e - e.getMilliseconds() - e.getSeconds() * ue);
}, (e, t) => {
e.setTime(+e + t * Et);
}, (e, t) => (t - e) / Et, (e) => e.getMinutes());
Wm.range;
const Si = et((e) => {
e.setUTCSeconds(0, 0);
}, (e, t) => {
e.setTime(+e + t * Et);
}, (e, t) => (t - e) / Et, (e) => e.getUTCMinutes());
Si.range;
const Hm = et((e) => {
e.setTime(e - e.getMilliseconds() - e.getSeconds() * ue - e.getMinutes() * Et);
}, (e, t) => {
e.setTime(+e + t * ce);
}, (e, t) => (t - e) / ce, (e) => e.getHours());
Hm.range;
const Ti = et((e) => {
e.setUTCMinutes(0, 0, 0);
}, (e, t) => {
e.setTime(+e + t * ce);
}, (e, t) => (t - e) / ce, (e) => e.getUTCHours());
Ti.range;
const ua = et(
(e) => e.setHours(0, 0, 0, 0),
(e, t) => e.setDate(e.getDate() + t),
(e, t) => (t - e - (t.getTimezoneOffset() - e.getTimezoneOffset()) * Et) / pe,
(e) => e.getDate() - 1
);
ua.range;
const lr = et((e) => {
e.setUTCHours(0, 0, 0, 0);
}, (e, t) => {
e.setUTCDate(e.getUTCDate() + t);
}, (e, t) => (t - e) / pe, (e) => e.getUTCDate() - 1);
lr.range;
const hu = et((e) => {
e.setUTCHours(0, 0, 0, 0);
}, (e, t) => {
e.setUTCDate(e.getUTCDate() + t);
}, (e, t) => (t - e) / pe, (e) => Math.floor(e / pe));
hu.range;
function Ge(e) {
return et((t) => {
t.setDate(t.getDate() - (t.getDay() + 7 - e) % 7), t.setHours(0, 0, 0, 0);
}, (t, n) => {
t.setDate(t.getDate() + n * 7);
}, (t, n) => (n - t - (n.getTimezoneOffset() - t.getTimezoneOffset()) * Et) / la);
}
const fu = Ge(0), Jr = Ge(1), jm = Ge(2), zm = Ge(3), bn = Ge(4), Zm = Ge(5), Ym = Ge(6);
fu.range;
Jr.range;
jm.range;
zm.range;
bn.range;
Zm.range;
Ym.range;
function qe(e) {
return et((t) => {
t.setUTCDate(t.getUTCDate() - (t.getUTCDay() + 7 - e) % 7), t.setUTCHours(0, 0, 0, 0);
}, (t, n) => {
t.setUTCDate(t.getUTCDate() + n * 7);
}, (t, n) => (n - t) / la);
}
const ur = qe(0), Qr = qe(1), Km = qe(2), Gm = qe(3), xn = qe(4), qm = qe(5), Bm = qe(6);
ur.range;
Qr.range;
Km.range;
Gm.range;
xn.range;
qm.range;
Bm.range;
const Xm = et((e) => {
e.setDate(1), e.setHours(0, 0, 0, 0);
}, (e, t) => {
e.setMonth(e.getMonth() + t);
}, (e, t) => t.getMonth() - e.getMonth() + (t.getFullYear() - e.getFullYear()) * 12, (e) => e.getMonth());
Xm.range;
const _i = et((e) => {
e.setUTCDate(1), e.setUTCHours(0, 0, 0, 0);
}, (e, t) => {
e.setUTCMonth(e.getUTCMonth() + t);
}, (e, t) => t.getUTCMonth() - e.getUTCMonth() + (t.getUTCFullYear() - e.getUTCFullYear()) * 12, (e) => e.getUTCMonth());
_i.range;
const Ze = et((e) => {
e.setMonth(0, 1), e.setHours(0, 0, 0, 0);
}, (e, t) => {
e.setFullYear(e.getFullYear() + t);
}, (e, t) => t.getFullYear() - e.getFullYear(), (e) => e.getFullYear());
Ze.every = (e) => !isFinite(e = Math.floor(e)) || !(e > 0) ? null : et((t) => {
t.setFullYear(Math.floor(t.getFullYear() / e) * e), t.setMonth(0, 1), t.setHours(0, 0, 0, 0);
}, (t, n) => {
t.setFullYear(t.getFullYear() + n * e);
});
Ze.range;
const ne = et((e) => {
e.setUTCMonth(0, 1), e.setUTCHours(0, 0, 0, 0);
}, (e, t) => {
e.setUTCFullYear(e.getUTCFullYear() + t);
}, (e, t) => t.getUTCFullYear() - e.getUTCFullYear(), (e) => e.getUTCFullYear());
ne.every = (e) => !isFinite(e = Math.floor(e)) || !(e > 0) ? null : et((t) => {
t.setUTCFullYear(Math.floor(t.getUTCFullYear() / e) * e), t.setUTCMonth(0, 1), t.setUTCHours(0, 0, 0, 0);
}, (t, n) => {
t.setUTCFullYear(t.getUTCFullYear() + n * e);
});
ne.range;
function Jm(e, t, n, r, i, s) {
const a = [
[Re, 1, ue],
[Re, 5, 5 * ue],
[Re, 15, 15 * ue],
[Re, 30, 30 * ue],
[s, 1, Et],
[s, 5, 5 * Et],
[s, 15, 15 * Et],
[s, 30, 30 * Et],
[i, 1, ce],
[i, 3, 3 * ce],
[i, 6, 6 * ce],
[i, 12, 12 * ce],
[r, 1, pe],
[r, 2, 2 * pe],
[n, 1, la],
[t, 1, ro],
[t, 3, 3 * ro],
[e, 1, zi]
];
function o(u, c, h) {
const f = c < u;
f && ([u, c] = [c, u]);
const d = h && typeof h.range == "function" ? h : l(u, c, h), p = d ? d.range(u, +c + 1) : [];
return f ? p.reverse() : p;
}
function l(u, c, h) {
const f = Math.abs(c - u) / h, d = te(([, , m]) => m).right(a, f);
if (d === a.length) return e.every(cs(u / zi, c / zi, h));
if (d === 0) return Xr.every(Math.max(cs(u, c, h), 1));
const [p, g] = a[f / a[d - 1][2] < a[d][2] / f ? d - 1 : d];
return p.every(g);
}
return [o, l];
}
const [Qm, tg] = Jm(ne, _i, ur, hu, Ti, Si);
function Zi(e) {
if (0 <= e.y && e.y < 100) {
var t = new Date(-1, e.m, e.d, e.H, e.M, e.S, e.L);
return t.setFullYear(e.y), t;
}
return new Date(e.y, e.m, e.d, e.H, e.M, e.S, e.L);
}
function Yi(e) {
if (0 <= e.y && e.y < 100) {
var t = new Date(Date.UTC(-1, e.m, e.d, e.H, e.M, e.S, e.L));
return t.setUTCFullYear(e.y), t;
}
return new Date(Date.UTC(e.y, e.m, e.d, e.H, e.M, e.S, e.L));
}
function Dn(e, t, n) {
return { y: e, m: t, d: n, H: 0, M: 0, S: 0, L: 0 };
}
function eg(e) {
var t = e.dateTime, n = e.date, r = e.time, i = e.periods, s = e.days, a = e.shortDays, o = e.months, l = e.shortMonths, u = $n(i), c = Fn(i), h = $n(s), f = Fn(s), d = $n(a), p = Fn(a), g = $n(o), m = Fn(o), y = $n(l), x = Fn(l), b = {
a: Q,
A: j,
b: Z,
B: ft,
c: null,
d: uo,
e: uo,
f: _g,
g: Dg,
G: Fg,
H: wg,
I: Sg,
j: Tg,
L: du,
m: Mg,
M: kg,
p: Vt,
q: Ut,
Q: fo,
s: po,
S: Og,
u: Cg,
U: Ig,
V: Ag,
w: Ng,
W: Pg,
x: null,
X: null,
y: Eg,
Y: $g,
Z: Lg,
"%": ho
}, v = {
a: Bt,
A: ve,
b: yt,
B: be,
c: null,
d: co,
e: co,
f: Wg,
g: Xg,
G: Qg,
H: Rg,
I: Vg,
j: Ug,
L: mu,
m: Hg,
M: jg,
p: xe,
q: Xt,
Q: fo,
s: po,
S: zg,
u: Zg,
U: Yg,
V: Kg,
w: Gg,
W: qg,
x: null,
X: null,
y: Bg,
Y: Jg,
Z: ty,
"%": ho
}, w = {
a: N,
A: k,
b: $,
B: C,
c: E,
d: oo,
e: oo,
f: yg,
g: ao,
G: so,
H: lo,
I: lo,
j: dg,
L: gg,
m: fg,
M: pg,
p: F,
q: hg,
Q: bg,
s: xg,
S: mg,
u: ag,
U: og,
V: lg,
w: sg,
W: ug,
x: nt,
X: rt,
y: ao,
Y: so,
Z: cg,
"%": vg
};
b.x = S(n, b), b.X = S(r, b), b.c = S(t, b), v.x = S(n, v), v.X = S(r, v), v.c = S(t, v);
function S(O, D) {
return function(L) {
var T = [], at = -1, Y = 0, St = O.length, Tt, Pe, Ma;
for (L instanceof Date || (L = /* @__PURE__ */ new Date(+L)); ++at < St; )
O.charCodeAt(at) === 37 && (T.push(O.slice(Y, at)), (Pe = io[Tt = O.charAt(++at)]) != null ? Tt = O.charAt(++at) : Pe = Tt === "e" ? " " : "0", (Ma = D[Tt]) && (Tt = Ma(L, Pe)), T.push(Tt), Y = at + 1);
return T.push(O.slice(Y, at)), T.join("");
};
}
function _(O, D) {
return function(L) {
var T = Dn(1900, void 0, 1), at = A(T, O, L += "", 0), Y, St;
if (at != L.length) return null;
if ("Q" in T) return new Date(T.Q);
if ("s" in T) return new Date(T.s * 1e3 + ("L" in T ? T.L : 0));
if (D && !("Z" in T) && (T.Z = 0), "p" in T && (T.H = T.H % 12 + T.p * 12), T.m === void 0 && (T.m = "q" in T ? T.q : 0), "V" in T) {
if (T.V < 1 || T.V > 53) return null;
"w" in T || (T.w = 1), "Z" in T ? (Y = Yi(Dn(T.y, 0, 1)), St = Y.getUTCDay(), Y = St > 4 || St === 0 ? Qr.ceil(Y) : Qr(Y), Y = lr.offset(Y, (T.V - 1) * 7), T.y = Y.getUTCFullYear(), T.m = Y.getUTCMonth(), T.d = Y.getUTCDate() + (T.w + 6) % 7) : (Y = Zi(Dn(T.y, 0, 1)), St = Y.getDay(), Y = St > 4 || St === 0 ? Jr.ceil(Y) : Jr(Y), Y = ua.offset(Y, (T.V - 1) * 7), T.y = Y.getFullYear(), T.m = Y.getMonth(), T.d = Y.getDate() + (T.w + 6) % 7);
} else ("W" in T || "U" in T) && ("w" in T || (T.w = "u" in T ? T.u % 7 : "W" in T ? 1 : 0), St = "Z" in T ? Yi(Dn(T.y, 0, 1)).getUTCDay() : Zi(Dn(T.y, 0, 1)).getDay(), T.m = 0, T.d = "W" in T ? (T.w + 6) % 7 + T.W * 7 - (St + 5) % 7 : T.w + T.U * 7 - (St + 6) % 7);
return "Z" in T ? (T.H += T.Z / 100 | 0, T.M += T.Z % 100, Yi(T)) : Zi(T);
};
}
function A(O, D, L, T) {
for (var at = 0, Y = D.length, St = L.length, Tt, Pe; at < Y; ) {
if (T >= St) return -1;
if (Tt = D.charCodeAt(at++), Tt === 37) {
if (Tt = D.charAt(at++), Pe = w[Tt in io ? D.charAt(at++) : Tt], !Pe || (T = Pe(O, L, T)) < 0) return -1;
} else if (Tt != L.charCodeAt(T++))
return -1;
}
return T;
}
function F(O, D, L) {
var T = u.exec(D.slice(L));
return T ? (O.p = c.get(T[0].toLowerCase()), L + T[0].length) : -1;
}
function N(O, D, L) {
var T = d.exec(D.slice(L));
return T ? (O.w = p.get(T[0].toLowerCase()), L + T[0].length) : -1;
}
function k(O, D, L) {
var T = h.exec(D.slice(L));
return T ? (O.w = f.get(T[0].toLowerCase()), L + T[0].length) : -1;
}
function $(O, D, L) {
var T = y.exec(D.slice(L));
return T ? (O.m = x.get(T[0].toLowerCase()), L + T[0].length) : -1;
}
function C(O, D, L) {
var T = g.exec(D.slice(L));
return T ? (O.m = m.get(T[0].toLowerCase()), L + T[0].length) : -1;
}
function E(O, D, L) {
return A(O, t, D, L);
}
function nt(O, D, L) {
return A(O, n, D, L);
}
function rt(O, D, L) {
return A(O, r, D, L);
}
function Q(O) {
return a[O.getDay()];
}
function j(O) {
return s[O.getDay()];
}
function Z(O) {
return l[O.getMonth()];
}
function ft(O) {
return o[O.getMonth()];
}
function Vt(O) {
return i[+(O.getHours() >= 12)];
}
function Ut(O) {
return 1 + ~~(O.getMonth() / 3);
}
function Bt(O) {
return a[O.getUTCDay()];
}
function ve(O) {
return s[O.getUTCDay()];
}
function yt(O) {
return l[O.getUTCMonth()];
}
function be(O) {
return o[O.getUTCMonth()];
}
function xe(O) {
return i[+(O.getUTCHours() >= 12)];
}
function Xt(O) {
return 1 + ~~(O.getUTCMonth() / 3);
}
return {
format: function(O) {
var D = S(O += "", b);
return D.toString = function() {
return O;
}, D;
},
parse: function(O) {
var D = _(O += "", !1);
return D.toString = function() {
return O;
}, D;
},
utcFormat: function(O) {
var D = S(O += "", v);
return D.toString = function() {
return O;
}, D;
},
utcParse: function(O) {
var D = _(O += "", !0);
return D.toString = function() {
return O;
}, D;
}
};
}
var io = { "-": "", _: " ", 0: "0" }, st = /^\s*\d+/, ng = /^%/, rg = /[\\^$*+?|[\]().{}]/g;
function V(e, t, n) {
var r = e < 0 ? "-" : "", i = (r ? -e : e) + "", s = i.length;
return r + (s < n ? new Array(n - s + 1).join(t) + i : i);
}
function ig(e) {
return e.replace(rg, "\\$&");
}
function $n(e) {
return new RegExp("^(?:" + e.map(ig).join("|") + ")", "i");
}
function Fn(e) {
return new Map(e.map((t, n) => [t.toLowerCase(), n]));
}
function sg(e, t, n) {
var r = st.exec(t.slice(n, n + 1));
return r ? (e.w = +r[0], n + r[0].length) : -1;
}
function ag(e, t, n) {
var r = st.exec(t.slice(n, n + 1));
return r ? (e.u = +r[0], n + r[0].length) : -1;
}
function og(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.U = +r[0], n + r[0].length) : -1;
}
function lg(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.V = +r[0], n + r[0].length) : -1;
}
function ug(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.W = +r[0], n + r[0].length) : -1;
}
function so(e, t, n) {
var r = st.exec(t.slice(n, n + 4));
return r ? (e.y = +r[0], n + r[0].length) : -1;
}
function ao(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.y = +r[0] + (+r[0] > 68 ? 1900 : 2e3), n + r[0].length) : -1;
}
function cg(e, t, n) {
var r = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n, n + 6));
return r ? (e.Z = r[1] ? 0 : -(r[2] + (r[3] || "00")), n + r[0].length) : -1;
}
function hg(e, t, n) {
var r = st.exec(t.slice(n, n + 1));
return r ? (e.q = r[0] * 3 - 3, n + r[0].length) : -1;
}
function fg(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.m = r[0] - 1, n + r[0].length) : -1;
}
function oo(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.d = +r[0], n + r[0].length) : -1;
}
function dg(e, t, n) {
var r = st.exec(t.slice(n, n + 3));
return r ? (e.m = 0, e.d = +r[0], n + r[0].length) : -1;
}
function lo(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.H = +r[0], n + r[0].length) : -1;
}
function pg(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.M = +r[0], n + r[0].length) : -1;
}
function mg(e, t, n) {
var r = st.exec(t.slice(n, n + 2));
return r ? (e.S = +r[0], n + r[0].length) : -1;
}
function gg(e, t, n) {
var r = st.exec(t.slice(n, n + 3));
return r ? (e.L = +r[0], n + r[0].length) : -1;
}
function yg(e, t, n) {
var r = st.exec(t.slice(n, n + 6));
return r ? (e.L = Math.floor(r[0] / 1e3), n + r[0].length) : -1;
}
function vg(e, t, n) {
var r = ng.exec(t.slice(n, n + 1));
return r ? n + r[0].length : -1;
}
function bg(e, t, n) {
var r = st.exec(t.slice(n));
return r ? (e.Q = +r[0], n + r[0].length) : -1;
}
function xg(e, t, n) {
var r = st.exec(t.slice(n));
return r ? (e.s = +r[0], n + r[0].length) : -1;
}
function uo(e, t) {
return V(e.getDate(), t, 2);
}
function wg(e, t) {
return V(e.getHours(), t, 2);
}
function Sg(e, t) {
return V(e.getHours() % 12 || 12, t, 2);
}
function Tg(e, t) {
return V(1 + ua.count(Ze(e), e), t, 3);
}
function du(e, t) {
return V(e.getMilliseconds(), t, 3);
}
function _g(e, t) {
return du(e, t) + "000";
}
function Mg(e, t) {
return V(e.getMonth() + 1, t, 2);
}
function kg(e, t) {
return V(e.getMinutes(), t, 2);
}
function Og(e, t) {
return V(e.getSeconds(), t, 2);
}
function Cg(e) {
var t = e.getDay();
return t === 0 ? 7 : t;
}
function Ig(e, t) {
return V(fu.count(Ze(e) - 1, e), t, 2);
}
function pu(e) {
var t = e.getDay();
return t >= 4 || t === 0 ? bn(e) : bn.ceil(e);
}
function Ag(e, t) {
return e = pu(e), V(bn.count(Ze(e), e) + (Ze(e).getDay() === 4), t, 2);
}
function Ng(e) {
return e.getDay();
}
function Pg(e, t) {
return V(Jr.count(Ze(e) - 1, e), t, 2);
}
function Eg(e, t) {
return V(e.getFullYear() % 100, t, 2);
}
function Dg(e, t) {
return e = pu(e), V(e.getFullYear() % 100, t, 2);
}
function $g(e, t) {
return V(e.getFullYear() % 1e4, t, 4);
}
function Fg(e, t) {
var n = e.getDay();
return e = n >= 4 || n === 0 ? bn(e) : bn.ceil(e), V(e.getFullYear() % 1e4, t, 4);
}
function Lg(e) {
var t = e.getTimezoneOffset();
return (t > 0 ? "-" : (t *= -1, "+")) + V(t / 60 | 0, "0", 2) + V(t % 60, "0", 2);
}
function co(e, t) {
return V(e.getUTCDate(), t, 2);
}
function Rg(e, t) {
return V(e.getUTCHours(), t, 2);
}
function Vg(e, t) {
return V(e.getUTCHours() % 12 || 12, t, 2);
}
function Ug(e, t) {
return V(1 + lr.count(ne(e), e), t, 3);
}
function mu(e, t) {
return V(e.getUTCMilliseconds(), t, 3);
}
function Wg(e, t) {
return mu(e, t) + "000";
}
function Hg(e, t) {
return V(e.getUTCMonth() + 1, t, 2);
}
function jg(e, t) {
return V(e.getUTCMinutes(), t, 2);
}
function zg(e, t) {
return V(e.getUTCSeconds(), t, 2);
}
function Zg(e) {
var t = e.getUTCDay();
return t === 0 ? 7 : t;
}
function Yg(e, t) {
return V(ur.count(ne(e) - 1, e), t, 2);
}
function gu(e) {
var t = e.getUTCDay();
return t >= 4 || t === 0 ? xn(e) : xn.ceil(e);
}
function Kg(e, t) {
return e = gu(e), V(xn.count(ne(e), e) + (ne(e).getUTCDay() === 4), t, 2);
}
function Gg(e) {
return e.getUTCDay();
}
function qg(e, t) {
return V(Qr.count(ne(e) - 1, e), t, 2);
}
function Bg(e, t) {
return V(e.getUTCFullYear() % 100, t, 2);
}
function Xg(e, t) {
return e = gu(e), V(e.getUTCFullYear() % 100, t, 2);
}
function Jg(e, t) {
return V(e.getUTCFullYear() % 1e4, t, 4);
}
function Qg(e, t) {
var n = e.getUTCDay();
return e = n >= 4 || n === 0 ? xn(e) : xn.ceil(e), V(e.getUTCFullYear() % 1e4, t, 4);
}
function ty() {
return "+0000";
}
function ho() {
return "%";
}
function fo(e) {
return +e;
}
function po(e) {
return Math.floor(+e / 1e3);
}
var tn, yu;
ey({
dateTime: "%x, %X",
date: "%-m/%-d/%Y",
time: "%-I:%M:%S %p",
periods: ["AM", "PM"],
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
});
function ey(e) {
return tn = eg(e), tn.format, tn.parse, yu = tn.utcFormat, tn.utcParse, tn;
}
function ny(e) {
return new Date(e);
}
function ry(e) {
return e instanceof Date ? +e : +/* @__PURE__ */ new Date(+e);
}
function vu(e, t, n, r, i, s, a, o, l, u) {
var c = uu(), h = c.invert, f = c.domain, d = u(".%L"), p = u(":%S"), g = u("%I:%M"), m = u("%I %p"), y = u("%a %d"), x = u("%b %d"), b = u("%B"), v = u("%Y");
function w(S) {
return (l(S) < S ? d : o(S) < S ? p : a(S) < S ? g : s(S) < S ? m : r(S) < S ? i(S) < S ? y : x : n(S) < S ? b : v)(S);
}
return c.invert = function(S) {
return new Date(h(S));
}, c.domain = function(S) {
return arguments.length ? f(Array.from(S, ry)) : f().map(ny);
}, c.ticks = function(S) {
var _ = f();
return e(_[0], _[_.length - 1], S ?? 10);
}, c.tickFormat = function(S, _) {
return _ == null ? w : u(_);
}, c.nice = function(S) {
var _ = f();
return (!S || typeof S.range != "function") && (S = t(_[0], _[_.length - 1], S ?? 10)), S ? f(Um(_, S)) : c;
}, c.copy = function() {
return lu(c, vu(e, t, n, r, i, s, a, o, l, u));
}, c;
}
function cn() {
return On.apply(vu(Qm, tg, ne, _i, ur, lr, Ti, Si, Re, yu).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments);
}
function iy() {
var e = 0, t = 1, n, r, i, s, a = ke, o = !1, l;
function u(h) {
return h == null || isNaN(h = +h) ? l : a(i === 0 ? 0.5 : (h = (s(h) - n) * i, o ? Math.max(0, Math.min(1, h)) : h));
}
u.domain = function(h) {
return arguments.length ? ([e, t] = h, n = s(e = +e), r = s(t = +t), i = n === r ? 0 : 1 / (r - n), u) : [e, t];
}, u.clamp = function(h) {
return arguments.length ? (o = !!h, u) : o;
}, u.interpolator = function(h) {
return arguments.length ? (a = h, u) : a;
};
function c(h) {
return function(f) {
var d, p;
return arguments.length ? ([d, p] = f, a = h(d, p), u) : [a(0), a(1)];
};
}
return u.range = c(Pt), u.rangeRound = c(jl), u.unknown = function(h) {
return arguments.length ? (l = h, u) : l;
}, function(h) {
return s = h, n = h(e), r = h(t), i = n === r ? 0 : 1 / (r - n), u;
};
}
function sy(e, t) {
return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown());
}
function Mi() {
var e = aa(iy()(ke));
return e.copy = function() {
return sy(e, Mi());
}, Pm.apply(e, arguments);
}
function ay(e) {
for (var t = e.length / 6 | 0, n = new Array(t), r = 0; r < t; ) n[r] = "#" + e.slice(r * 6, ++r * 6);
return n;
}
const oy = ay("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
var ca = Kl(Ie(-100, 0.75, 0.35), Ie(80, 1.5, 0.8));
Kl(Ie(260, 0.75, 0.35), Ie(80, 1.5, 0.8));
Ie();
function W(e) {
return function() {
return e;
};
}
const mo = Math.abs, lt = Math.atan2, le = Math.cos, ly = Math.max, Ki = Math.min, bt = Math.sin, ot = Math.sqrt, vt = 1e-12, Ne = Math.PI, ti = Ne / 2, cr = 2 * Ne;
function uy(e) {
return e > 1 ? 0 : e < -1 ? Ne : Math.acos(e);
}
function go(e) {
return e >= 1 ? ti : e <= -1 ? -ti : Math.asin(e);
}
function ki(e) {
let t = 3;
return e.digits = function(n) {
if (!arguments.length) return t;
if (n == null)
t = null;
else {
const r = Math.floor(n);
if (!(r >= 0)) throw new RangeError(`invalid digits: ${n}`);
t = r;
}
return e;
}, () => new ra(t);
}
function cy(e) {
return e.innerRadius;
}
function hy(e) {
return e.outerRadius;
}
function fy(e) {
return e.startAngle;
}
function dy(e) {
return e.endAngle;
}
function py(e) {
return e && e.padAngle;
}
function my(e, t, n, r, i, s, a, o) {
var l = n - e, u = r - t, c = a - i, h = o - s, f = h * l - c * u;
if (!(f * f < vt))
return f = (c * (t - s) - h * (e - i)) / f, [e + f * l, t + f * u];
}
function wr(e, t, n, r, i, s, a) {
var o = e - n, l = t - r, u = (a ? s : -s) / ot(o * o + l * l), c = u * l, h = -u * o, f = e + c, d = t + h, p = n + c, g = r + h, m = (f + p) / 2, y = (d + g) / 2, x = p - f, b = g - d, v = x * x + b * b, w = i - s, S = f * g - p * d, _ = (b < 0 ? -1 : 1) * ot(ly(0, w * w * v - S * S)), A = (S * b - x * _) / v, F = (-S * x - b * _) / v, N = (S * b + x * _) / v, k = (-S * x + b * _) / v, $ = A - m, C = F - y, E = N - m, nt = k - y;
return $ * $ + C * C > E * E + nt * nt && (A = N, F = k), {
cx: A,
cy: F,
x01: -c,
y01: -h,
x11: A * (i / w - 1),
y11: F * (i / w - 1)
};
}
function ei() {
var e = cy, t = hy, n = W(0), r = null, i = fy, s = dy, a = py, o = null, l = ki(u);
function u() {
var c, h, f = +e.apply(this, arguments), d = +t.apply(this, arguments), p = i.apply(this, arguments) - ti, g = s.apply(this, arguments) - ti, m = mo(g - p), y = g > p;
if (o || (o = c = l()), d < f && (h = d, d = f, f = h), !(d > vt)) o.moveTo(0, 0);
else if (m > cr - vt)
o.moveTo(d * le(p), d * bt(p)), o.arc(0, 0, d, p, g, !y), f > vt && (o.moveTo(f * le(g), f * bt(g)), o.arc(0, 0, f, g, p, y));
else {
var x = p, b = g, v = p, w = g, S = m, _ = m, A = a.apply(this, arguments) / 2, F = A > vt && (r ? +r.apply(this, arguments) : ot(f * f + d * d)), N = Ki(mo(d - f) / 2, +n.apply(this, arguments)), k = N, $ = N, C, E;
if (F > vt) {
var nt = go(F / f * bt(A)), rt = go(F / d * bt(A));
(S -= nt * 2) > vt ? (nt *= y ? 1 : -1, v += nt, w -= nt) : (S = 0, v = w = (p + g) / 2), (_ -= rt * 2) > vt ? (rt *= y ? 1 : -1, x += rt, b -= rt) : (_ = 0, x = b = (p + g) / 2);
}
var Q = d * le(x), j = d * bt(x), Z = f * le(w), ft = f * bt(w);
if (N > vt) {
var Vt = d * le(b), Ut = d * bt(b), Bt = f * le(v), ve = f * bt(v), yt;
if (m < Ne)
if (yt = my(Q, j, Bt, ve, Vt, Ut, Z, ft)) {
var be = Q - yt[0], xe = j - yt[1], Xt = Vt - yt[0], O = Ut - yt[1], D = 1 / bt(uy((be * Xt + xe * O) / (ot(be * be + xe * xe) * ot(Xt * Xt + O * O))) / 2), L = ot(yt[0] * yt[0] + yt[1] * yt[1]);
k = Ki(N, (f - L) / (D - 1)), $ = Ki(N, (d - L) / (D + 1));
} else
k = $ = 0;
}
_ > vt ? $ > vt ? (C = wr(Bt, ve, Q, j, d, $, y), E = wr(Vt, Ut, Z, ft, d, $, y), o.moveTo(C.cx + C.x01, C.cy + C.y01), $ < N ? o.arc(C.cx, C.cy, $, lt(C.y01, C.x01), lt(E.y01, E.x01), !y) : (o.arc(C.cx, C.cy, $, lt(C.y01, C.x01), lt(C.y11, C.x11), !y), o.arc(0, 0, d, lt(C.cy + C.y11, C.cx + C.x11), lt(E.cy + E.y11, E.cx + E.x11), !y), o.arc(E.cx, E.cy, $, lt(E.y11, E.x11), lt(E.y01, E.x01), !y))) : (o.moveTo(Q, j), o.arc(0, 0, d, x, b, !y)) : o.moveTo(Q, j), !(f > vt) || !(S > vt) ? o.lineTo(Z, ft) : k > vt ? (C = wr(Z, ft, Vt, Ut, f, -k, y), E = wr(Q, j, Bt, ve, f, -k, y), o.lineTo(C.cx + C.x01, C.cy + C.y01), k < N ? o.arc(C.cx, C.cy, k, lt(C.y01, C.x01), lt(E.y01, E.x01), !y) : (o.arc(C.cx, C.cy, k, lt(C.y01, C.x01), lt(C.y11, C.x11), !y), o.arc(0, 0, f, lt(C.cy + C.y11, C.cx + C.x11), lt(E.cy + E.y11, E.cx + E.x11), y), o.arc(E.cx, E.cy, k, lt(E.y11, E.x11), lt(E.y01, E.x01), !y))) : o.arc(0, 0, f, w, v, y);
}
if (o.closePath(), c) return o = null, c + "" || null;
}
return u.centroid = function() {
var c = (+e.apply(this, arguments) + +t.apply(this, arguments)) / 2, h = (+i.apply(this, arguments) + +s.apply(this, arguments)) / 2 - Ne / 2;
return [le(h) * c, bt(h) * c];
}, u.innerRadius = function(c) {
return arguments.length ? (e = typeof c == "function" ? c : W(+c), u) : e;
}, u.outerRadius = function(c) {
return arguments.length ? (t = typeof c == "function" ? c : W(+c), u) : t;
}, u.cornerRadius = function(c) {
return arguments.length ? (n = typeof c == "function" ? c : W(+c), u) : n;
}, u.padRadius = function(c) {
return arguments.length ? (r = c == null ? null : typeof c == "function" ? c : W(+c), u) : r;
}, u.startAngle = function(c) {
return arguments.length ? (i = typeof c == "function" ? c : W(+c), u) : i;
}, u.endAngle = function(c) {
return arguments.length ? (s = typeof c == "function" ? c : W(+c), u) : s;
}, u.padAngle = function(c) {
return arguments.length ? (a = typeof c == "function" ? c : W(+c), u) : a;
}, u.context = function(c) {
return arguments.length ? (o = c ?? null, u) : o;
}, u;
}
function bu(e) {
return typeof e == "object" && "length" in e ? e : Array.from(e);
}
function xu(e) {
this._context = e;
}
xu.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(e, t) {
switch (e = +e, t = +t, this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
break;
case 1:
this._point = 2;
// falls through
default:
this._context.lineTo(e, t);
break;
}
}
};
function Oi(e) {
return new xu(e);
}
function wu(e) {
return e[0];
}
function Su(e) {
return e[1];
}
function Ci(e, t) {
var n = W(!0), r = null, i = Oi, s = null, a = ki(o);
e = typeof e == "function" ? e : e === void 0 ? wu : W(e), t = typeof t == "function" ? t : t === void 0 ? Su : W(t);
function o(l) {
var u, c = (l = bu(l)).length, h, f = !1, d;
for (r == null && (s = i(d = a())), u = 0; u <= c; ++u)
!(u < c && n(h = l[u], u, l)) === f && ((f = !f) ? s.lineStart() : s.lineEnd()), f && s.point(+e(h, u, l), +t(h, u, l));
if (d) return s = null, d + "" || null;
}
return o.x = function(l) {
return arguments.length ? (e = typeof l == "function" ? l : W(+l), o) : e;
}, o.y = function(l) {
return arguments.length ? (t = typeof l == "function" ? l : W(+l), o) : t;
}, o.defined = function(l) {
return arguments.length ? (n = typeof l == "function" ? l : W(!!l), o) : n;
}, o.curve = function(l) {
return arguments.length ? (i = l, r != null && (s = i(r)), o) : i;
}, o.context = function(l) {
return arguments.length ? (l == null ? r = s = null : s = i(r = l), o) : r;
}, o;
}
function Tu(e, t, n) {
var r = null, i = W(!0), s = null, a = Oi, o = null, l = ki(u);
e = typeof e == "function" ? e : e === void 0 ? wu : W(+e), t = typeof t == "function" ? t : W(t === void 0 ? 0 : +t), n = typeof n == "function" ? n : n === void 0 ? Su : W(+n);
function u(h) {
var f, d, p, g = (h = bu(h)).length, m, y = !1, x, b = new Array(g), v = new Array(g);
for (s == null && (o = a(x = l())), f = 0; f <= g; ++f) {
if (!(f < g && i(m = h[f], f, h)) === y)
if (y = !y)
d = f, o.areaStart(), o.lineStart();
else {
for (o.lineEnd(), o.lineStart(), p = f - 1; p >= d; --p)
o.point(b[p], v[p]);
o.lineEnd(), o.areaEnd();
}
y && (b[f] = +e(m, f, h), v[f] = +t(m, f, h), o.point(r ? +r(m, f, h) : b[f], n ? +n(m, f, h) : v[f]));
}
if (x) return o = null, x + "" || null;
}
function c() {
return Ci().defined(i).curve(a).context(s);
}
return u.x = function(h) {
return arguments.length ? (e = typeof h == "function" ? h : W(+h), r = null, u) : e;
}, u.x0 = function(h) {
return arguments.length ? (e = typeof h == "function" ? h : W(+h), u) : e;
}, u.x1 = function(h) {
return arguments.length ? (r = h == null ? null : typeof h == "function" ? h : W(+h), u) : r;
}, u.y = function(h) {
return arguments.length ? (t = typeof h == "function" ? h : W(+h), n = null, u) : t;
}, u.y0 = function(h) {
return arguments.length ? (t = typeof h == "function" ? h : W(+h), u) : t;
}, u.y1 = function(h) {
return arguments.length ? (n = h == null ? null : typeof h == "function" ? h : W(+h), u) : n;
}, u.lineX0 = u.lineY0 = function() {
return c().x(e).y(t);
}, u.lineY1 = function() {
return c().x(e).y(n);
}, u.lineX1 = function() {
return c().x(r).y(t);
}, u.defined = function(h) {
return arguments.length ? (i = typeof h == "function" ? h : W(!!h), u) : i;
}, u.curve = function(h) {
return arguments.length ? (a = h, s != null && (o = a(s)), u) : a;
}, u.context = function(h) {
return arguments.length ? (h == null ? s = o = null : o = a(s = h), u) : s;
}, u;
}
var gy = Mu(Oi);
function _u(e) {
this._curve = e;
}
_u.prototype = {
areaStart: function() {
this._curve.areaStart();
},
areaEnd: function() {
this._curve.areaEnd();
},
lineStart: function() {
this._curve.lineStart();
},
lineEnd: function() {
this._curve.lineEnd();
},
point: function(e, t) {
this._curve.point(t * Math.sin(e), t * -Math.cos(e));
}
};
function Mu(e) {
function t(n) {
return new _u(e(n));
}
return t._curve = e, t;
}
function yy(e) {
var t = e.curve;
return e.angle = e.x, delete e.x, e.radius = e.y, delete e.y, e.curve = function(n) {
return arguments.length ? t(Mu(n)) : t()._curve;
}, e;
}
function ku() {
return yy(Ci().curve(gy));
}
const Ou = {
draw(e, t) {
const n = ot(t / Ne);
e.moveTo(n, 0), e.arc(0, 0, n, 0, cr);
}
}, vy = {
draw(e, t) {
const n = ot(t / 5) / 2;
e.moveTo(-3 * n, -n), e.lineTo(-n, -n), e.lineTo(-n, -3 * n), e.lineTo(n, -3 * n), e.lineTo(n, -n), e.lineTo(3 * n, -n), e.lineTo(3 * n, n), e.lineTo(n, n), e.lineTo(n, 3 * n), e.lineTo(-n, 3 * n), e.lineTo(-n, n), e.lineTo(-3 * n, n), e.closePath();
}
}, Cu = ot(1 / 3), by = Cu * 2, xy = {
draw(e, t) {
const n = ot(t / by), r = n * Cu;
e.moveTo(0, -n), e.lineTo(r, 0), e.lineTo(0, n), e.lineTo(-r, 0), e.closePath();
}
}, wy = {
draw(e, t) {
const n = ot(t), r = -n / 2;
e.rect(r, r, n, n);
}
}, Sy = 0.8908130915292852, Iu = bt(Ne / 10) / bt(7 * Ne / 10), Ty = bt(cr / 10) * Iu, _y = -le(cr / 10) * Iu, My = {
draw(e, t) {
const n = ot(t * Sy), r = Ty * n, i = _y * n;
e.moveTo(0, -n), e.lineTo(r, i);
for (let s = 1; s < 5; ++s) {
const a = cr * s / 5, o = le(a), l = bt(a);
e.lineTo(l * n, -o * n), e.lineTo(o * r - l * i, l * r + o * i);
}
e.closePath();
}
}, Gi = ot(3), ky = {
draw(e, t) {
const n = -ot(t / (Gi * 3));
e.moveTo(0, n * 2), e.lineTo(-Gi * n, -n), e.lineTo(Gi * n, -n), e.closePath();
}
}, It = -0.5, At = ot(3) / 2, Ms = 1 / ot(12), Oy = (Ms / 2 + 1) * 3, Cy = {
draw(e, t) {
const n = ot(t / Oy), r = n / 2, i = n * Ms, s = r, a = n * Ms + n, o = -s, l = a;
e.moveTo(r, i), e.lineTo(s, a), e.lineTo(o, l), e.lineTo(It * r - At * i, At * r + It * i), e.lineTo(It * s - At * a, At * s + It * a), e.lineTo(It * o - At * l, At * o + It * l), e.lineTo(It * r + At * i, It * i - At * r), e.lineTo(It * s + At * a, It * a - At * s), e.lineTo(It * o + At * l, It * l - At * o), e.closePath();
}
}, qi = [
Ou,
vy,
xy,
wy,
My,
ky,
Cy
];
function Oe(e, t) {
let n = null, r = ki(i);
e = typeof e == "function" ? e : W(e || Ou), t = typeof t == "function" ? t : W(t === void 0 ? 64 : +t);
function i() {
let s;
if (n || (n = s = r()), e.apply(this, arguments).draw(n, +t.apply(this, arguments)), s) return n = null, s + "" || null;
}
return i.type = function(s) {
return arguments.length ? (e = typeof s == "function" ? s : W(s), i) : e;
}, i.size = function(s) {
return arguments.length ? (t = typeof s == "function" ? s : W(+s), i) : t;
}, i.context = function(s) {
return arguments.length ? (n = s ?? null, i) : n;
}, i;
}
function yo(e, t, n) {
e._context.bezierCurveTo(
(2 * e._x0 + e._x1) / 3,
(2 * e._y0 + e._y1) / 3,
(e._x0 + 2 * e._x1) / 3,
(e._y0 + 2 * e._y1) / 3,
(e._x0 + 4 * e._x1 + t) / 6,
(e._y0 + 4 * e._y1 + n) / 6
);
}
function Au(e) {
this._context = e;
}
Au.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 3:
yo(this, this._x1, this._y1);
// falls through
case 2:
this._context.lineTo(this._x1, this._y1);
break;
}
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(e, t) {
switch (e = +e, t = +t, this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3, this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
// falls through
default:
yo(this, e, t);
break;
}
this._x0 = this._x1, this._x1 = e, this._y0 = this._y1, this._y1 = t;
}
};
function Iy(e) {
return new Au(e);
}
function Ii(e, t) {
this._context = e, this._t = t;
}
Ii.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x = this._y = NaN, this._point = 0;
},
lineEnd: function() {
0 < this._t && this._t < 1 && this._point === 2 && this._context.lineTo(this._x, this._y), (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
},
point: function(e, t) {
switch (e = +e, t = +t, this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
break;
case 1:
this._point = 2;
// falls through
default: {
if (this._t <= 0)
this._context.lineTo(this._x, t), this._context.lineTo(e, t);
else {
var n = this._x * (1 - this._t) + e * this._t;
this._context.lineTo(n, this._y), this._context.lineTo(n, t);
}
break;
}
}
this._x = e, this._y = t;
}
};
function Ay(e) {
return new Ii(e, 0.5);
}
function Ny(e) {
return new Ii(e, 0);
}
function Nu(e) {
return new Ii(e, 1);
}
function Hn(e, t, n) {
this.k = e, this.x = t, this.y = n;
}
Hn.prototype = {
constructor: Hn,
scale: function(e) {
return e === 1 ? this : new Hn(this.k * e, this.x, this.y);
},
translate: function(e, t) {
return e === 0 & t === 0 ? this : new Hn(this.k, this.x + this.k * e, this.y + this.k * t);
},
apply: function(e) {
return [e[0] * this.k + this.x, e[1] * this.k + this.y];
},
applyX: function(e) {
return e * this.k + this.x;
},
applyY: function(e) {
return e * this.k + this.y;
},
invert: function(e) {
return [(e[0] - this.x) / this.k, (e[1] - this.y) / this.k];
},
invertX: function(e) {
return (e - this.x) / this.k;
},
invertY: function(e) {
return (e - this.y) / this.k;
},
rescaleX: function(e) {
return e.copy().domain(e.range().map(this.invertX, this).map(e.invert, e));
},
rescaleY: function(e) {
return e.copy().domain(e.range().map(this.invertY, this).map(e.invert, e));
},
toString: function() {
return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
}
};
Hn.prototype;
var Pu = typeof global == "object" && global && global.Object === Object && global, Py = typeof self == "object" && self && self.Object === Object && self, ie = Pu || Py || Function("return this")(), wn = ie.Symbol, Eu = Object.prototype, Ey = Eu.hasOwnProperty, Dy = Eu.toString, Ln = wn ? wn.toStringTag : void 0;
function $y(e) {
var t = Ey.call(e, Ln), n = e[Ln];
try {
e[Ln] = void 0;
var r = !0;
} catch {
}
var i = Dy.call(e);
return r && (t ? e[Ln] = n : delete e[Ln]), i;
}
var Fy = Object.prototype, Ly = Fy.toString;
function Ry(e) {
return Ly.call(e);
}
var Vy = "[object Null]", Uy = "[object Undefined]", vo = wn ? wn.toStringTag : void 0;
function Cn(e) {
return e == null ? e === void 0 ? Uy : Vy : vo && vo in Object(e) ? $y(e) : Ry(e);
}
function Ye(e) {
return e != null && typeof e == "object";
}
var Sn = Array.isArray;
function me(e) {
var t = typeof e;
return e != null && (t == "object" || t == "function");
}
function Du(e) {
return e;
}
var Wy = "[object AsyncFunction]", Hy = "[object Function]", jy = "[object GeneratorFunction]", zy = "[object Proxy]";
function ha(e) {
if (!me(e))
return !1;
var t = Cn(e);
return t == Hy || t == jy || t == Wy || t == zy;
}
var Bi = ie["__core-js_shared__"], bo = function() {
var e = /[^.]+$/.exec(Bi && Bi.keys && Bi.keys.IE_PROTO || "");
return e ? "Symbol(src)_1." + e : "";
}();
function Zy(e) {
return !!bo && bo in e;
}
var Yy = Function.prototype, Ky = Yy.toString;
function Be(e) {
if (e != null) {
try {
return Ky.call(e);
} catch {
}
try {
return e + "";
} catch {
}
}
return "";
}
var Gy = /[\\^$.*+?()[\]{}|]/g, qy = /^\[object .+?Constructor\]$/, By = Function.prototype, Xy = Object.prototype, Jy = By.toString, Qy = Xy.hasOwnProperty, t0 = RegExp(
"^" + Jy.call(Qy).replace(Gy, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function e0(e) {
if (!me(e) || Zy(e))
return !1;
var t = ha(e) ? t0 : qy;
return t.test(Be(e));
}
function n0(e, t) {
return e == null ? void 0 : e[t];
}
function Xe(e, t) {
var n = n0(e, t);
return e0(n) ? n : void 0;
}
var ks = Xe(ie, "WeakMap"), xo = Object.create, r0 = /* @__PURE__ */ function() {
function e() {
}
return function(t) {
if (!me(t))
return {};
if (xo)
return xo(t);
e.prototype = t;
var n = new e();
return e.prototype = void 0, n;
};
}();
function $u(e, t, n) {
switch (n.length) {
case 0:
return e.call(t);
case 1:
return e.call(t, n[0]);
case 2:
return e.call(t, n[0], n[1]);
case 3:
return e.call(t, n[0], n[1], n[2]);
}
return e.apply(t, n);
}
function i0(e, t) {
var n = -1, r = e.length;
for (t || (t = Array(r)); ++n < r; )
t[n] = e[n];
return t;
}
var s0 = 800, a0 = 16, o0 = Date.now;
function l0(e) {
var t = 0, n = 0;
return function() {
var r = o0(), i = a0 - (r - n);
if (n = r, i > 0) {
if (++t >= s0)
return arguments[0];
} else
t = 0;
return e.apply(void 0, arguments);
};
}
function u0(e) {
return function() {
return e;
};
}
var ni = function() {
try {
var e = Xe(Object, "defineProperty");
return e({}, "", {}), e;
} catch {
}
}(), c0 = ni ? function(e, t) {
return ni(e, "toString", {
configurable: !0,
enumerable: !1,
value: u0(t),
writable: !0
});
} : Du, h0 = l0(c0), f0 = 9007199254740991, d0 = /^(?:0|[1-9]\d*)$/;
function Fu(e, t) {
var n = typeof e;
return t = t ?? f0, !!t && (n == "number" || n != "symbol" && d0.test(e)) && e > -1 && e % 1 == 0 && e < t;
}
function fa(e, t, n) {
t == "__proto__" && ni ? ni(e, t, {
configurable: !0,
enumerable: !0,
value: n,
writable: !0
}) : e[t] = n;
}
function hr(e, t) {
return e === t || e !== e && t !== t;
}
var p0 = Object.prototype, m0 = p0.hasOwnProperty;
function g0(e, t, n) {
var r = e[t];
(!(m0.call(e, t) && hr(r, n)) || n === void 0 && !(t in e)) && fa(e, t, n);
}
function y0(e, t, n, r) {
var i = !n;
n || (n = {});
for (var s = -1, a = t.length; ++s < a; ) {
var o = t[s], l = void 0;
l === void 0 && (l = e[o]), i ? fa(n, o, l) : g0(n, o, l);
}
return n;
}
var wo = Math.max;
function v0(e, t, n) {
return t = wo(t === void 0 ? e.length - 1 : t, 0), function() {
for (var r = arguments, i = -1, s = wo(r.length - t, 0), a = Array(s); ++i < s; )
a[i] = r[t + i];
i = -1;
for (var o = Array(t + 1); ++i < t; )
o[i] = r[i];
return o[t] = n(a), $u(e, this, o);
};
}
function Lu(e, t) {
return h0(v0(e, t, Du), e + "");
}
var b0 = 9007199254740991;
function Ru(e) {
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= b0;
}
function Ai(e) {
return e != null && Ru(e.length) && !ha(e);
}
function x0(e, t, n) {
if (!me(n))
return !1;
var r = typeof t;
return (r == "number" ? Ai(n) && Fu(t, n.length) : r == "string" && t in n) ? hr(n[t], e) : !1;
}
function Vu(e) {
return Lu(function(t, n) {
var r = -1, i = n.length, s = i > 1 ? n[i - 1] : void 0, a = i > 2 ? n[2] : void 0;
for (s = e.length > 3 && typeof s == "function" ? (i--, s) : void 0, a && x0(n[0], n[1], a) && (s = i < 3 ? void 0 : s, i = 1), t = Object(t); ++r < i; ) {
var o = n[r];
o && e(t, o, r, s);
}
return t;
});
}
var w0 = Object.prototype;
function da(e) {
var t = e && e.constructor, n = typeof t == "function" && t.prototype || w0;
return e === n;
}
function S0(e, t) {
for (var n = -1, r = Array(e); ++n < e; )
r[n] = t(n);
return r;
}
var T0 = "[object Arguments]";
function So(e) {
return Ye(e) && Cn(e) == T0;
}
var Uu = Object.prototype, _0 = Uu.hasOwnProperty, M0 = Uu.propertyIsEnumerable, Os = So(/* @__PURE__ */ function() {
return arguments;
}()) ? So : function(e) {
return Ye(e) && _0.call(e, "callee") && !M0.call(e, "callee");
};
function k0() {
return !1;
}
var Wu = typeof exports == "object" && exports && !exports.nodeType && exports, To = Wu && typeof module == "object" && module && !module.nodeType && module, O0 = To && To.exports === Wu, _o = O0 ? ie.Buffer : void 0, C0 = _o ? _o.isBuffer : void 0, ri = C0 || k0, I0 = "[object Arguments]", A0 = "[object Array]", N0 = "[object Boolean]", P0 = "[object Date]", E0 = "[object Error]", D0 = "[object Function]", $0 = "[object Map]", F0 = "[object Number]", L0 = "[object Object]", R0 = "[object RegExp]", V0 = "[object Set]", U0 = "[object String]", W0 = "[object WeakMap]", H0 = "[object ArrayBuffer]", j0 = "[object DataView]", z0 = "[object Float32Array]", Z0 = "[object Float64Array]", Y0 = "[object Int8Array]", K0 = "[object Int16Array]", G0 = "[object Int32Array]", q0 = "[object Uint8Array]", B0 = "[object Uint8ClampedArray]", X0 = "[object Uint16Array]", J0 = "[object Uint32Array]", K = {};
K[z0] = K[Z0] = K[Y0] = K[K0] = K[G0] = K[q0] = K[B0] = K[X0] = K[J0] = !0;
K[I0] = K[A0] = K[H0] = K[N0] = K[j0] = K[P0] = K[E0] = K[D0] = K[$0] = K[F0] = K[L0] = K[R0] = K[V0] = K[U0] = K[W0] = !1;
function Q0(e) {
return Ye(e) && Ru(e.length) && !!K[Cn(e)];
}
function tv(e) {
return function(t) {
return e(t);
};
}
var Hu = typeof exports == "object" && exports && !exports.nodeType && exports, Kn = Hu && typeof module == "object" && module && !module.nodeType && module, ev = Kn && Kn.exports === Hu, Xi = ev && Pu.process, Mo = function() {
try {
var e = Kn && Kn.require && Kn.require("util").types;
return e || Xi && Xi.binding && Xi.binding("util");
} catch {
}
}(), ko = Mo && Mo.isTypedArray, pa = ko ? tv(ko) : Q0, nv = Object.prototype, rv = nv.hasOwnProperty;
function ju(e, t) {
var n = Sn(e), r = !n && Os(e), i = !n && !r && ri(e), s = !n && !r && !i && pa(e), a = n || r || i || s, o = a ? S0(e.length, String) : [], l = o.length;
for (var u in e)
(t || rv.call(e, u)) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
(u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
i && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
s && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
Fu(u, l))) && o.push(u);
return o;
}
function zu(e, t) {
return function(n) {
return e(t(n));
};
}
var iv = zu(Object.keys, Object), sv = Object.prototype, av = sv.hasOwnProperty;
function ov(e) {
if (!da(e))
return iv(e);
var t = [];
for (var n in Object(e))
av.call(e, n) && n != "constructor" && t.push(n);
return t;
}
function lv(e) {
return Ai(e) ? ju(e) : ov(e);
}
function uv(e) {
var t = [];
if (e != null)
for (var n in Object(e))
t.push(n);
return t;
}
var cv = Object.prototype, hv = cv.hasOwnProperty;
function fv(e) {
if (!me(e))
return uv(e);
var t = da(e), n = [];
for (var r in e)
r == "constructor" && (t || !hv.call(e, r)) || n.push(r);
return n;
}
function Zu(e) {
return Ai(e) ? ju(e, !0) : fv(e);
}
var nr = Xe(Object, "create");
function dv() {
this.__data__ = nr ? nr(null) : {}, this.size = 0;
}
function pv(e) {
var t = this.has(e) && delete this.__data__[e];
return this.size -= t ? 1 : 0, t;
}
var mv = "__lodash_hash_undefined__", gv = Object.prototype, yv = gv.hasOwnProperty;
function vv(e) {
var t = this.__data__;
if (nr) {
var n = t[e];
return n === mv ? void 0 : n;
}
return yv.call(t, e) ? t[e] : void 0;
}
var bv = Object.prototype, xv = bv.hasOwnProperty;
function wv(e) {
var t = this.__data__;
return nr ? t[e] !== void 0 : xv.call(t, e);
}
var Sv = "__lodash_hash_undefined__";
function Tv(e, t) {
var n = this.__data__;
return this.size += this.has(e) ? 0 : 1, n[e] = nr && t === void 0 ? Sv : t, this;
}
function Ke(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
Ke.prototype.clear = dv;
Ke.prototype.delete = pv;
Ke.prototype.get = vv;
Ke.prototype.has = wv;
Ke.prototype.set = Tv;
function _v() {
this.__data__ = [], this.size = 0;
}
function Ni(e, t) {
for (var n = e.length; n--; )
if (hr(e[n][0], t))
return n;
return -1;
}
var Mv = Array.prototype, kv = Mv.splice;
function Ov(e) {
var t = this.__data__, n = Ni(t, e);
if (n < 0)
return !1;
var r = t.length - 1;
return n == r ? t.pop() : kv.call(t, n, 1), --this.size, !0;
}
function Cv(e) {
var t = this.__data__, n = Ni(t, e);
return n < 0 ? void 0 : t[n][1];
}
function Iv(e) {
return Ni(this.__data__, e) > -1;
}
function Av(e, t) {
var n = this.__data__, r = Ni(n, e);
return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
}
function ye(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
ye.prototype.clear = _v;
ye.prototype.delete = Ov;
ye.prototype.get = Cv;
ye.prototype.has = Iv;
ye.prototype.set = Av;
var rr = Xe(ie, "Map");
function Nv() {
this.size = 0, this.__data__ = {
hash: new Ke(),
map: new (rr || ye)(),
string: new Ke()
};
}
function Pv(e) {
var t = typeof e;
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
}
function Pi(e, t) {
var n = e.__data__;
return Pv(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
}
function Ev(e) {
var t = Pi(this, e).delete(e);
return this.size -= t ? 1 : 0, t;
}
function Dv(e) {
return Pi(this, e).get(e);
}
function $v(e) {
return Pi(this, e).has(e);
}
function Fv(e, t) {
var n = Pi(this, e), r = n.size;
return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
}
function Je(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
Je.prototype.clear = Nv;
Je.prototype.delete = Ev;
Je.prototype.get = Dv;
Je.prototype.has = $v;
Je.prototype.set = Fv;
function Lv(e, t) {
for (var n = -1, r = t.length, i = e.length; ++n < r; )
e[i + n] = t[n];
return e;
}
var Yu = zu(Object.getPrototypeOf, Object), Rv = "[object Object]", Vv = Function.prototype, Uv = Object.prototype, Ku = Vv.toString, Wv = Uv.hasOwnProperty, Hv = Ku.call(Object);
function jv(e) {
if (!Ye(e) || Cn(e) != Rv)
return !1;
var t = Yu(e);
if (t === null)
return !0;
var n = Wv.call(t, "constructor") && t.constructor;
return typeof n == "function" && n instanceof n && Ku.call(n) == Hv;
}
function zv() {
this.__data__ = new ye(), this.size = 0;
}
function Zv(e) {
var t = this.__data__, n = t.delete(e);
return this.size = t.size, n;
}
function Yv(e) {
return this.__data__.get(e);
}
function Kv(e) {
return this.__data__.has(e);
}
var Gv = 200;
function qv(e, t) {
var n = this.__data__;
if (n instanceof ye) {
var r = n.__data__;
if (!rr || r.length < Gv - 1)
return r.push([e, t]), this.size = ++n.size, this;
n = this.__data__ = new Je(r);
}
return n.set(e, t), this.size = n.size, this;
}
function he(e) {
var t = this.__data__ = new ye(e);
this.size = t.size;
}
he.prototype.clear = zv;
he.prototype.delete = Zv;
he.prototype.get = Yv;
he.prototype.has = Kv;
he.prototype.set = qv;
var Gu = typeof exports == "object" && exports && !exports.nodeType && exports, Oo = Gu && typeof module == "object" && module && !module.nodeType && module, Bv = Oo && Oo.exports === Gu, Co = Bv ? ie.Buffer : void 0;
Co && Co.allocUnsafe;
function Xv(e, t) {
return e.slice();
}
function Jv(e, t) {
for (var n = -1, r = e == null ? 0 : e.length, i = 0, s = []; ++n < r; ) {
var a = e[n];
t(a, n, e) && (s[i++] = a);
}
return s;
}
function Qv() {
return [];
}
var tb = Object.prototype, eb = tb.propertyIsEnumerable, Io = Object.getOwnPropertySymbols, nb = Io ? function(e) {
return e == null ? [] : (e = Object(e), Jv(Io(e), function(t) {
return eb.call(e, t);
}));
} : Qv;
function rb(e, t, n) {
var r = t(e);
return Sn(e) ? r : Lv(r, n(e));
}
function Ao(e) {
return rb(e, lv, nb);
}
var Cs = Xe(ie, "DataView"), Is = Xe(ie, "Promise"), As = Xe(ie, "Set"), No = "[object Map]", ib = "[object Object]", Po = "[object Promise]", Eo = "[object Set]", Do = "[object WeakMap]", $o = "[object DataView]", sb = Be(Cs), ab = Be(rr), ob = Be(Is), lb = Be(As), ub = Be(ks), Te = Cn;
(Cs && Te(new Cs(new ArrayBuffer(1))) != $o || rr && Te(new rr()) != No || Is && Te(Is.resolve()) != Po || As && Te(new As()) != Eo || ks && Te(new ks()) != Do) && (Te = function(e) {
var t = Cn(e), n = t == ib ? e.constructor : void 0, r = n ? Be(n) : "";
if (r)
switch (r) {
case sb:
return $o;
case ab:
return No;
case ob:
return Po;
case lb:
return Eo;
case ub:
return Do;
}
return t;
});
var ii = ie.Uint8Array;
function cb(e) {
var t = new e.constructor(e.byteLength);
return new ii(t).set(new ii(e)), t;
}
function hb(e, t) {
var n = cb(e.buffer);
return new e.constructor(n, e.byteOffset, e.length);
}
function fb(e) {
return typeof e.constructor == "function" && !da(e) ? r0(Yu(e)) : {};
}
var db = "__lodash_hash_undefined__";
function pb(e) {
return this.__data__.set(e, db), this;
}
function mb(e) {
return this.__data__.has(e);
}
function si(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.__data__ = new Je(); ++t < n; )
this.add(e[t]);
}
si.prototype.add = si.prototype.push = pb;
si.prototype.has = mb;
function gb(e, t) {
for (var n = -1, r = e == null ? 0 : e.length; ++n < r; )
if (t(e[n], n, e))
return !0;
return !1;
}
function yb(e, t) {
return e.has(t);
}
var vb = 1, bb = 2;
function qu(e, t, n, r, i, s) {
var a = n & vb, o = e.length, l = t.length;
if (o != l && !(a && l > o))
return !1;
var u = s.get(e), c = s.get(t);
if (u && c)
return u == t && c == e;
var h = -1, f = !0, d = n & bb ? new si() : void 0;
for (s.set(e, t), s.set(t, e); ++h < o; ) {
var p = e[h], g = t[h];
if (r)
var m = a ? r(g, p, h, t, e, s) : r(p, g, h, e, t, s);
if (m !== void 0) {
if (m)
continue;
f = !1;
break;
}
if (d) {
if (!gb(t, function(y, x) {
if (!yb(d, x) && (p === y || i(p, y, n, r, s)))
return d.push(x);
})) {
f = !1;
break;
}
} else if (!(p === g || i(p, g, n, r, s))) {
f = !1;
break;
}
}
return s.delete(e), s.delete(t), f;
}
function xb(e) {
var t = -1, n = Array(e.size);
return e.forEach(function(r, i) {
n[++t] = [i, r];
}), n;
}
function wb(e) {
var t = -1, n = Array(e.size);
return e.forEach(function(r) {
n[++t] = r;
}), n;
}
var Sb = 1, Tb = 2, _b = "[object Boolean]", Mb = "[object Date]", kb = "[object Error]", Ob = "[object Map]", Cb = "[object Number]", Ib = "[object RegExp]", Ab = "[object Set]", Nb = "[object String]", Pb = "[object Symbol]", Eb = "[object ArrayBuffer]", Db = "[object DataView]", Fo = wn ? wn.prototype : void 0, Ji = Fo ? Fo.valueOf : void 0;
function $b(e, t, n, r, i, s, a) {
switch (n) {
case Db:
if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset)
return !1;
e = e.buffer, t = t.buffer;
case Eb:
return !(e.byteLength != t.byteLength || !s(new ii(e), new ii(t)));
case _b:
case Mb:
case Cb:
return hr(+e, +t);
case kb:
return e.name == t.name && e.message == t.message;
case Ib:
case Nb:
return e == t + "";
case Ob:
var o = xb;
case Ab:
var l = r & Sb;
if (o || (o = wb), e.size != t.size && !l)
return !1;
var u = a.get(e);
if (u)
return u == t;
r |= Tb, a.set(e, t);
var c = qu(o(e), o(t), r, i, s, a);
return a.delete(e), c;
case Pb:
if (Ji)
return Ji.call(e) == Ji.call(t);
}
return !1;
}
var Fb = 1, Lb = Object.prototype, Rb = Lb.hasOwnProperty;
function Vb(e, t, n, r, i, s) {
var a = n & Fb, o = Ao(e), l = o.length, u = Ao(t), c = u.length;
if (l != c && !a)
return !1;
for (var h = l; h--; ) {
var f = o[h];
if (!(a ? f in t : Rb.call(t, f)))
return !1;
}
var d = s.get(e), p = s.get(t);
if (d && p)
return d == t && p == e;
var g = !0;
s.set(e, t), s.set(t, e);
for (var m = a; ++h < l; ) {
f = o[h];
var y = e[f], x = t[f];
if (r)
var b = a ? r(x, y, f, t, e, s) : r(y, x, f, e, t, s);
if (!(b === void 0 ? y === x || i(y, x, n, r, s) : b)) {
g = !1;
break;
}
m || (m = f == "constructor");
}
if (g && !m) {
var v = e.constructor, w = t.constructor;
v != w && "constructor" in e && "constructor" in t && !(typeof v == "function" && v instanceof v && typeof w == "function" && w instanceof w) && (g = !1);
}
return s.delete(e), s.delete(t), g;
}
var Ub = 1, Lo = "[object Arguments]", Ro = "[object Array]", Sr = "[object Object]", Wb = Object.prototype, Vo = Wb.hasOwnProperty;
function Hb(e, t, n, r, i, s) {
var a = Sn(e), o = Sn(t), l = a ? Ro : Te(e), u = o ? Ro : Te(t);
l = l == Lo ? Sr : l, u = u == Lo ? Sr : u;
var c = l == Sr, h = u == Sr, f = l == u;
if (f && ri(e)) {
if (!ri(t))
return !1;
a = !0, c = !1;
}
if (f && !c)
return s || (s = new he()), a || pa(e) ? qu(e, t, n, r, i, s) : $b(e, t, l, n, r, i, s);
if (!(n & Ub)) {
var d = c && Vo.call(e, "__wrapped__"), p = h && Vo.call(t, "__wrapped__");
if (d || p) {
var g = d ? e.value() : e, m = p ? t.value() : t;
return s || (s = new he()), i(g, m, n, r, s);
}
}
return f ? (s || (s = new he()), Vb(e, t, n, r, i, s)) : !1;
}
function Bu(e, t, n, r, i) {
return e === t ? !0 : e == null || t == null || !Ye(e) && !Ye(t) ? e !== e && t !== t : Hb(e, t, n, r, Bu, i);
}
function jb(e) {
return function(t, n, r) {
for (var i = -1, s = Object(t), a = r(t), o = a.length; o--; ) {
var l = a[++i];
if (n(s[l], l, s) === !1)
break;
}
return t;
};
}
var zb = jb();
function Ns(e, t, n) {
(n !== void 0 && !hr(e[t], n) || n === void 0 && !(t in e)) && fa(e, t, n);
}
function Zb(e) {
return Ye(e) && Ai(e);
}
function Ps(e, t) {
if (!(t === "constructor" && typeof e[t] == "function") && t != "__proto__")
return e[t];
}
function Yb(e) {
return y0(e, Zu(e));
}
function Kb(e, t, n, r, i, s, a) {
var o = Ps(e, n), l = Ps(t, n), u = a.get(l);
if (u) {
Ns(e, n, u);
return;
}
var c = s ? s(o, l, n + "", e, t, a) : void 0, h = c === void 0;
if (h) {
var f = Sn(l), d = !f && ri(l), p = !f && !d && pa(l);
c = l, f || d || p ? Sn(o) ? c = o : Zb(o) ? c = i0(o) : d ? (h = !1, c = Xv(l)) : p ? (h = !1, c = hb(l)) : c = [] : jv(l) || Os(l) ? (c = o, Os(o) ? c = Yb(o) : (!me(o) || ha(o)) && (c = fb(l))) : h = !1;
}
h && (a.set(l, c), i(c, l, r, s, a), a.delete(l)), Ns(e, n, c);
}
function Ei(e, t, n, r, i) {
e !== t && zb(t, function(s, a) {
if (i || (i = new he()), me(s))
Kb(e, t, a, n, Ei, r, i);
else {
var o = r ? r(Ps(e, a), s, a + "", e, t, i) : void 0;
o === void 0 && (o = s), Ns(e, a, o);
}
}, Zu);
}
function Xu(e, t, n, r, i, s) {
return me(e) && me(t) && (s.set(t, e), Ei(e, t, void 0, Xu, s), s.delete(t)), e;
}
var Gb = Vu(function(e, t, n, r) {
Ei(e, t, n, r);
}), qt = Lu(function(e) {
return e.push(void 0, Xu), $u(Gb, void 0, e);
});
function qb(e, t) {
return Bu(e, t);
}
function Dt(e) {
return e === null;
}
var ir = Vu(function(e, t, n) {
Ei(e, t, n);
}), it;
(function(e) {
e.Top = "top", e.Bottom = "bottom", e.Left = "left", e.Right = "right";
})(it || (it = {}));
var G;
(function(e) {
e.Top = "top", e.Bottom = "bottom", e.Left = "left", e.Right = "right", e.Center = "center", e.Pointer = "pointer";
})(G || (G = {}));
class Bb {
constructor(t) {
Object.defineProperty(this, "tooltip", {
enumerable: !0,
configurable: !0,
writable: !0,
value: null
}), Object.defineProperty(this, "tooltipText", {
enumerable: !0,
configurable: !0,
writable: !0,
value: null
}), Object.defineProperty(this, "container", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "isHidden", {
enumerable: !0,
configurable: !0,
writable: !0,
value: !0
}), this.container = t, this.createTooltip();
}
createTooltip() {
this.tooltip = mt(this.container).append("div").attr("class", "tooltip").style("opacity", 0), this.tooltipText = this.tooltip.append("div").attr("class", "tooltiptext right");
}
show() {
this.isHidden = !1, this.tooltip.transition().duration(50).style("opacity", 1);
}
update(t, n, r, i) {
this.tooltip.style("left", r + "px").style("top", i + "px"), this.tooltipText.attr("class", `tooltiptext ${n}`).node().replaceChildren(t);
}
hide() {
this.isHidden = !0, this.tooltip.transition().duration(50).style("opacity", 0);
}
}
class Ju {
constructor(t, n, r, i, s) {
Object.defineProperty(this, "container", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "svg", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "chartGroup", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "canvas", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "defs", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "tooltip", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "observer", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "themeObserver", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "width", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "height", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "margin", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: {}
}), Object.defineProperty(this, "charts", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "visitors", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.container = t, this.options = qt(this.options, i, s), this.observer = new ResizeObserver((a) => {
a[0].contentBoxSize && this.resize();
}), this.observer.observe(t), this.themeObserver = new MutationObserver((a) => {
a.forEach((o) => {
o.attributeName === "class" && this.redraw(this.options);
});
}), this.themeObserver.observe(t, { attributes: !0 }), this.themeObserver.observe(document.documentElement, { attributes: !0 }), au({
decimal: ".",
thousands: " ",
grouping: [3],
currency: ["$", ""]
}), this.margin = { top: 40, right: 40, bottom: 40, left: 40, ...i.margin }, this.svg = mt(t).append("svg").attr("class", "wb-charts").attr("overflow", "visible"), this.defs = this.svg.append("defs"), this.canvas = this.svg.append("g"), this.setSize(r, n), this.tooltip = new Bb(t), this.charts = [], this.visitors = [];
}
setDefaultTimeOptions(t) {
const n = Array.isArray(t) ? t : [t];
for (const r of n)
r.timeZone = r.timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone, r.locale = r.locale ?? navigator.language;
}
setOptions(t) {
ir(this.options, t);
}
setSize(t, n) {
const r = n ?? this.container.offsetWidth, i = t ?? this.container.offsetHeight;
this.height = i - this.margin.top - this.margin.bottom, this.width = r - this.margin.left - this.margin.right, (this.height < 0 || this.width < 0) && (this.height = 0, this.width = 0), this.svg.attr("width", r).attr("height", i).attr("viewBox", `0 0 ${r} ${i}`), this.canvas.attr("transform", `translate(${this.margin.left}, ${this.margin.top})`);
}
resize() {
this.setSize(), this.setRange(), this.redraw();
}
resetZoom() {
this.redraw();
}
removeChart(t) {
let n;
for (n = 0; n < this.charts.length; n++)
if (this.charts[n].id === t) {
this.charts[n].group = null;
break;
}
this.charts.splice(n, 1), this.chartGroup.selectAll(`[data-chart-id="${t}"]`).remove();
const r = this.canvas.select(".front");
r && r.selectAll(`[data-chart-id="${t}"]`).remove();
}
removeAllCharts() {
for (const t of this.charts)
this.removeChart(t.id);
this.charts = [], this.chartGroup.selectAll("g").remove();
}
accept(t) {
this.visitors.push(t), t.visit(this);
}
get extent() {
const t = {};
for (const n of this.charts) {
const r = n.extent;
for (const i in r)
i in t ? t[i] = _t([...t[i], ...r[i]]) : t[i] = r[i];
}
return t;
}
createChartGroup() {
this.chartGroup = this.canvas.append("g").attr("class", "charts");
}
}
var z;
(function(e) {
e.time = "time", e.value = "value", e.degrees = "degrees", e.band = "band";
})(z || (z = {}));
var sn;
(function(e) {
e.initial = "initial", e.full = "full", e.toggle = "toggle";
})(sn || (sn = {}));
const Xb = [1, 2, 2.5, 5, 10], Jb = [1, 5, 15, 30, 45, 60, 90];
function Qb(e, t, n = z.value) {
if (n === z.band)
return e;
if (e === void 0)
return;
let r = e[1], i = e[0];
i === r && (i === 0 ? r = 1 : (i = i * (1 - Math.sign(i) * 0.1), r = r * (1 + Math.sign(r) * 0.1)));
const s = (r - i) * 1e-6;
r += s, i -= s;
const o = (r - i) / (t - 1);
let l = 1;
if (n === z.degrees)
l = Jb.find((h) => h >= o);
else {
const h = Math.pow(10, -Math.floor(Math.log10(Math.abs(o)))), f = o * h;
l = Xb.find((p) => p >= f) / h;
}
const u = Math.abs(e[1]) < s ? 0 : (Math.ceil(r / l) + 1) * l;
return [Math.abs(e[0]) < s ? 0 : (Math.floor(i / l) - 1) * l, u];
}
class Uo {
constructor(t, n, r, i) {
Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "span", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.options = i, this.axis = n, this.span = r, this.create(t);
}
create(t) {
this.group = t.append("g").attr("class", `grid ${this.class}`);
}
get class() {
return `${this.options.axisKey}-grid-${this.options.axisIndex}`;
}
redraw() {
const t = this.axis.scale();
if (this.options.axisKey === "x") {
const n = di(t), r = Hr(this.span.range());
n.tickSize(r), n.ticks(5), this.axis.tickValues() !== null && n.tickValues(this.axis.tickValues()), this.updateTicks(this.group, n);
} else if (this.options.axisKey === "y") {
const n = or(t), r = Hr(this.span.range());
n.tickSize(r), n.ticks(5), this.axis.tickValues() !== null && n.tickValues(this.axis.tickValues()), this.updateTicks(this.group, n);
}
}
updateTicks(t, n) {
t.call(n).call((r) => r.selectAll(".tick").attr("class", (i) => i === 0 ? "tick zero-crossing" : "tick"));
}
}
const Zt = {
Top: "top",
Bottom: "bottom",
Left: "left",
Right: "right"
};
function tx(e) {
return e - 360 * Math.floor(e / 360);
}
function Qu(e, t) {
let n;
switch (t) {
case Zt.Top:
n = 180;
break;
case Zt.Right:
n = -90;
break;
case Zt.Bottom:
n = 0;
break;
case Zt.Left:
default:
n = 90;
}
const r = tx(e - n);
return r === 0 ? "middle" : r < 180 ? "start" : r > 180 ? "end" : "middle";
}
class Qe extends Error {
}
class ex extends Qe {
constructor(t) {
super(`Invalid DateTime: ${t.toMessage()}`);
}
}
class nx extends Qe {
constructor(t) {
super(`Invalid Interval: ${t.toMessage()}`);
}
}
class rx extends Qe {
constructor(t) {
super(`Invalid Duration: ${t.toMessage()}`);
}
}
class an extends Qe {
}
class tc extends Qe {
constructor(t) {
super(`Invalid unit ${t}`);
}
}
class ut extends Qe {
}
class we extends Qe {
constructor() {
super("Zone is an abstract class");
}
}
const M = "numeric", Kt = "short", kt = "long", ai = {
year: M,
month: M,
day: M
}, ec = {
year: M,
month: Kt,
day: M
}, ix = {
year: M,
month: Kt,
day: M,
weekday: Kt
}, nc = {
year: M,
month: kt,
day: M
}, rc = {
year: M,
month: kt,
day: M,
weekday: kt
}, ic = {
hour: M,
minute: M
}, sc = {
hour: M,
minute: M,
second: M
}, ac = {
hour: M,
minute: M,
second: M,
timeZoneName: Kt
}, oc = {
hour: M,
minute: M,
second: M,
timeZoneName: kt
}, lc = {
hour: M,
minute: M,
hourCycle: "h23"
}, uc = {
hour: M,
minute: M,
second: M,
hourCycle: "h23"
}, cc = {
hour: M,
minute: M,
second: M,
hourCycle: "h23",
timeZoneName: Kt
}, hc = {
hour: M,
minute: M,
second: M,
hourCycle: "h23",
timeZoneName: kt
}, fc = {
year: M,
month: M,
day: M,
hour: M,
minute: M
}, dc = {
year: M,
month: M,
day: M,
hour: M,
minute: M,
second: M
}, pc = {
year: M,
month: Kt,
day: M,
hour: M,
minute: M
}, mc = {
year: M,
month: Kt,
day: M,
hour: M,
minute: M,
second: M
}, sx = {
year: M,
month: Kt,
day: M,
weekday: Kt,
hour: M,
minute: M
}, gc = {
year: M,
month: kt,
day: M,
hour: M,
minute: M,
timeZoneName: Kt
}, yc = {
year: M,
month: kt,
day: M,
hour: M,
minute: M,
second: M,
timeZoneName: Kt
}, vc = {
year: M,
month: kt,
day: M,
weekday: kt,
hour: M,
minute: M,
timeZoneName: kt
}, bc = {
year: M,
month: kt,
day: M,
weekday: kt,
hour: M,
minute: M,
second: M,
timeZoneName: kt
};
class fr {
/**
* The type of zone
* @abstract
* @type {string}
*/
get type() {
throw new we();
}
/**
* The name of this zone.
* @abstract
* @type {string}
*/
get name() {
throw new we();
}
/**
* The IANA name of this zone.
* Defaults to `name` if not overwritten by a subclass.
* @abstract
* @type {string}
*/
get ianaName() {
return this.name;
}
/**
* Returns whether the offset is known to be fixed for the whole year.
* @abstract
* @type {boolean}
*/
get isUniversal() {
throw new we();
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
offsetName(t, n) {
throw new we();
}
/**
* Returns the offset's value as a string
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(t, n) {
throw new we();
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @abstract
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
offset(t) {
throw new we();
}
/**
* Return whether this Zone is equal to another zone
* @abstract
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(t) {
throw new we();
}
/**
* Return whether this Zone is valid.
* @abstract
* @type {boolean}
*/
get isValid() {
throw new we();
}
}
let Qi = null;
class Di extends fr {
/**
* Get a singleton instance of the local zone
* @return {SystemZone}
*/
static get instance() {
return Qi === null && (Qi = new Di()), Qi;
}
/** @override **/
get type() {
return "system";
}
/** @override **/
get name() {
return new Intl.DateTimeFormat().resolvedOptions().timeZone;
}
/** @override **/
get isUniversal() {
return !1;
}
/** @override **/
offsetName(t, { format: n, locale: r }) {
return Ac(t, n, r);
}
/** @override **/
formatOffset(t, n) {
return Gn(this.offset(t), n);
}
/** @override **/
offset(t) {
return -new Date(t).getTimezoneOffset();
}
/** @override **/
equals(t) {
return t.type === "system";
}
/** @override **/
get isValid() {
return !0;
}
}
const Es = /* @__PURE__ */ new Map();
function ax(e) {
let t = Es.get(e);
return t === void 0 && (t = new Intl.DateTimeFormat("en-US", {
hour12: !1,
timeZone: e,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
era: "short"
}), Es.set(e, t)), t;
}
const ox = {
year: 0,
month: 1,
day: 2,
era: 3,
hour: 4,
minute: 5,
second: 6
};
function lx(e, t) {
const n = e.format(t).replace(/\u200E/g, ""), r = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n), [, i, s, a, o, l, u, c] = r;
return [a, i, s, o, l, u, c];
}
function ux(e, t) {
const n = e.formatToParts(t), r = [];
for (let i = 0; i < n.length; i++) {
const { type: s, value: a } = n[i], o = ox[s];
s === "era" ? r[o] = a : P(o) || (r[o] = parseInt(a, 10));
}
return r;
}
const ts = /* @__PURE__ */ new Map();
class ge extends fr {
/**
* @param {string} name - Zone name
* @return {IANAZone}
*/
static create(t) {
let n = ts.get(t);
return n === void 0 && ts.set(t, n = new ge(t)), n;
}
/**
* Reset local caches. Should only be necessary in testing scenarios.
* @return {void}
*/
static resetCache() {
ts.clear(), Es.clear();
}
/**
* Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.
* @param {string} s - The string to check validity on
* @example IANAZone.isValidSpecifier("America/New_York") //=> true
* @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false
* @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead.
* @return {boolean}
*/
static isValidSpecifier(t) {
return this.isValidZone(t);
}
/**
* Returns whether the provided string identifies a real zone
* @param {string} zone - The string to check
* @example IANAZone.isValidZone("America/New_York") //=> true
* @example IANAZone.isValidZone("Fantasia/Castle") //=> false
* @example IANAZone.isValidZone("Sport~~blorp") //=> false
* @return {boolean}
*/
static isValidZone(t) {
if (!t)
return !1;
try {
return new Intl.DateTimeFormat("en-US", { timeZone: t }).format(), !0;
} catch {
return !1;
}
}
constructor(t) {
super(), this.zoneName = t, this.valid = ge.isValidZone(t);
}
/**
* The type of zone. `iana` for all instances of `IANAZone`.
* @override
* @type {string}
*/
get type() {
return "iana";
}
/**
* The name of this zone (i.e. the IANA zone name).
* @override
* @type {string}
*/
get name() {
return this.zoneName;
}
/**
* Returns whether the offset is known to be fixed for the whole year:
* Always returns false for all IANA zones.
* @override
* @type {boolean}
*/
get isUniversal() {
return !1;
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @override
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
offsetName(t, { format: n, locale: r }) {
return Ac(t, n, r, this.name);
}
/**
* Returns the offset's value as a string
* @override
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(t, n) {
return Gn(this.offset(t), n);
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @override
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
offset(t) {
if (!this.valid) return NaN;
const n = new Date(t);
if (isNaN(n)) return NaN;
const r = ax(this.name);
let [i, s, a, o, l, u, c] = r.formatToParts ? ux(r, n) : lx(r, n);
o === "BC" && (i = -Math.abs(i) + 1);
const f = Fi({
year: i,
month: s,
day: a,
hour: l === 24 ? 0 : l,
minute: u,
second: c,
millisecond: 0
});
let d = +n;
const p = d % 1e3;
return d -= p >= 0 ? p : 1e3 + p, (f - d) / (60 * 1e3);
}
/**
* Return whether this Zone is equal to another zone
* @override
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(t) {
return t.type === "iana" && t.name === this.name;
}
/**
* Return whether this Zone is valid.
* @override
* @type {boolean}
*/
get isValid() {
return this.valid;
}
}
let Wo = {};
function cx(e, t = {}) {
const n = JSON.stringify([e, t]);
let r = Wo[n];
return r || (r = new Intl.ListFormat(e, t), Wo[n] = r), r;
}
const Ds = /* @__PURE__ */ new Map();
function $s(e, t = {}) {
const n = JSON.stringify([e, t]);
let r = Ds.get(n);
return r === void 0 && (r = new Intl.DateTimeFormat(e, t), Ds.set(n, r)), r;
}
const Fs = /* @__PURE__ */ new Map();
function hx(e, t = {}) {
const n = JSON.stringify([e, t]);
let r = Fs.get(n);
return r === void 0 && (r = new Intl.NumberFormat(e, t), Fs.set(n, r)), r;
}
const Ls = /* @__PURE__ */ new Map();
function fx(e, t = {}) {
const { base: n, ...r } = t, i = JSON.stringify([e, r]);
let s = Ls.get(i);
return s === void 0 && (s = new Intl.RelativeTimeFormat(e, t), Ls.set(i, s)), s;
}
let jn = null;
function dx() {
return jn || (jn = new Intl.DateTimeFormat().resolvedOptions().locale, jn);
}
const Rs = /* @__PURE__ */ new Map();
function xc(e) {
let t = Rs.get(e);
return t === void 0 && (t = new Intl.DateTimeFormat(e).resolvedOptions(), Rs.set(e, t)), t;
}
const Vs = /* @__PURE__ */ new Map();
function px(e) {
let t = Vs.get(e);
if (!t) {
const n = new Intl.Locale(e);
t = "getWeekInfo" in n ? n.getWeekInfo() : n.weekInfo, "minimalDays" in t || (t = { ...wc, ...t }), Vs.set(e, t);
}
return t;
}
function mx(e) {
const t = e.indexOf("-x-");
t !== -1 && (e = e.substring(0, t));
const n = e.indexOf("-u-");
if (n === -1)
return [e];
{
let r, i;
try {
r = $s(e).resolvedOptions(), i = e;
} catch {
const l = e.substring(0, n);
r = $s(l).resolvedOptions(), i = l;
}
const { numberingSystem: s, calendar: a } = r;
return [i, s, a];
}
}
function gx(e, t, n) {
return (n || t) && (e.includes("-u-") || (e += "-u"), n && (e += `-ca-${n}`), t && (e += `-nu-${t}`)), e;
}
function yx(e) {
const t = [];
for (let n = 1; n <= 12; n++) {
const r = I.utc(2009, n, 1);
t.push(e(r));
}
return t;
}
function vx(e) {
const t = [];
for (let n = 1; n <= 7; n++) {
const r = I.utc(2016, 11, 13 + n);
t.push(e(r));
}
return t;
}
function Tr(e, t, n, r) {
const i = e.listingMode();
return i === "error" ? null : i === "en" ? n(t) : r(t);
}
function bx(e) {
return e.numberingSystem && e.numberingSystem !== "latn" ? !1 : e.numberingSystem === "latn" || !e.locale || e.locale.startsWith("en") || xc(e.locale).numberingSystem === "latn";
}
class xx {
constructor(t, n, r) {
this.padTo = r.padTo || 0, this.floor = r.floor || !1;
const { padTo: i, floor: s, ...a } = r;
if (!n || Object.keys(a).length > 0) {
const o = { useGrouping: !1, ...r };
r.padTo > 0 && (o.minimumIntegerDigits = r.padTo), this.inf = hx(t, o);
}
}
format(t) {
if (this.inf) {
const n = this.floor ? Math.floor(t) : t;
return this.inf.format(n);
} else {
const n = this.floor ? Math.floor(t) : ba(t, 3);
return X(n, this.padTo);
}
}
}
class wx {
constructor(t, n, r) {
this.opts = r, this.originalZone = void 0;
let i;
if (this.opts.timeZone)
this.dt = t;
else if (t.zone.type === "fixed") {
const a = -1 * (t.offset / 60), o = a >= 0 ? `Etc/GMT+${a}` : `Etc/GMT${a}`;
t.offset !== 0 && ge.create(o).valid ? (i = o, this.dt = t) : (i = "UTC", this.dt = t.offset === 0 ? t : t.setZone("UTC").plus({ minutes: t.offset }), this.originalZone = t.zone);
} else t.zone.type === "system" ? this.dt = t : t.zone.type === "iana" ? (this.dt = t, i = t.zone.name) : (i = "UTC", this.dt = t.setZone("UTC").plus({ minutes: t.offset }), this.originalZone = t.zone);
const s = { ...this.opts };
s.timeZone = s.timeZone || i, this.dtf = $s(n, s);
}
format() {
return this.originalZone ? this.formatToParts().map(({ value: t }) => t).join("") : this.dtf.format(this.dt.toJSDate());
}
formatToParts() {
const t = this.dtf.formatToParts(this.dt.toJSDate());
return this.originalZone ? t.map((n) => {
if (n.type === "timeZoneName") {
const r = this.originalZone.offsetName(this.dt.ts, {
locale: this.dt.locale,
format: this.opts.timeZoneName
});
return {
...n,
value: r
};
} else
return n;
}) : t;
}
resolvedOptions() {
return this.dtf.resolvedOptions();
}
}
class Sx {
constructor(t, n, r) {
this.opts = { style: "long", ...r }, !n && Cc() && (this.rtf = fx(t, r));
}
format(t, n) {
return this.rtf ? this.rtf.format(t, n) : zx(n, t, this.opts.numeric, this.opts.style !== "long");
}
formatToParts(t, n) {
return this.rtf ? this.rtf.formatToParts(t, n) : [];
}
}
const wc = {
firstDay: 1,
minimalDays: 4,
weekend: [6, 7]
};
class H {
static fromOpts(t) {
return H.create(
t.locale,
t.numberingSystem,
t.outputCalendar,
t.weekSettings,
t.defaultToEN
);
}
static create(t, n, r, i, s = !1) {
const a = t || B.defaultLocale, o = a || (s ? "en-US" : dx()), l = n || B.defaultNumberingSystem, u = r || B.defaultOutputCalendar, c = Ws(i) || B.defaultWeekSettings;
return new H(o, l, u, c, a);
}
static resetCache() {
jn = null, Ds.clear(), Fs.clear(), Ls.clear(), Rs.clear(), Vs.clear();
}
static fromObject({ locale: t, numberingSystem: n, outputCalendar: r, weekSettings: i } = {}) {
return H.create(t, n, r, i);
}
constructor(t, n, r, i, s) {
const [a, o, l] = mx(t);
this.locale = a, this.numberingSystem = n || o || null, this.outputCalendar = r || l || null, this.weekSettings = i, this.intl = gx(this.locale, this.numberingSystem, this.outputCalendar), this.weekdaysCache = { format: {}, standalone: {} }, this.monthsCache = { format: {}, standalone: {} }, this.meridiemCache = null, this.eraCache = {}, this.specifiedLocale = s, this.fastNumbersCached = null;
}
get fastNumbers() {
return this.fastNumbersCached == null && (this.fastNumbersCached = bx(this)), this.fastNumbersCached;
}
listingMode() {
const t = this.isEnglish(), n = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
return t && n ? "en" : "intl";
}
clone(t) {
return !t || Object.getOwnPropertyNames(t).length === 0 ? this : H.create(
t.locale || this.specifiedLocale,
t.numberingSystem || this.numberingSystem,
t.outputCalendar || this.outputCalendar,
Ws(t.weekSettings) || this.weekSettings,
t.defaultToEN || !1
);
}
redefaultToEN(t = {}) {
return this.clone({ ...t, defaultToEN: !0 });
}
redefaultToSystem(t = {}) {
return this.clone({ ...t, defaultToEN: !1 });
}
months(t, n = !1) {
return Tr(this, t, Ec, () => {
const r = n ? { month: t, day: "numeric" } : { month: t }, i = n ? "format" : "standalone";
return this.monthsCache[i][t] || (this.monthsCache[i][t] = yx((s) => this.extract(s, r, "month"))), this.monthsCache[i][t];
});
}
weekdays(t, n = !1) {
return Tr(this, t, Fc, () => {
const r = n ? { weekday: t, year: "numeric", month: "long", day: "numeric" } : { weekday: t }, i = n ? "format" : "standalone";
return this.weekdaysCache[i][t] || (this.weekdaysCache[i][t] = vx(
(s) => this.extract(s, r, "weekday")
)), this.weekdaysCache[i][t];
});
}
meridiems() {
return Tr(
this,
void 0,
() => Lc,
() => {
if (!this.meridiemCache) {
const t = { hour: "numeric", hourCycle: "h12" };
this.meridiemCache = [I.utc(2016, 11, 13, 9), I.utc(2016, 11, 13, 19)].map(
(n) => this.extract(n, t, "dayperiod")
);
}
return this.meridiemCache;
}
);
}
eras(t) {
return Tr(this, t, Rc, () => {
const n = { era: t };
return this.eraCache[t] || (this.eraCache[t] = [I.utc(-40, 1, 1), I.utc(2017, 1, 1)].map(
(r) => this.extract(r, n, "era")
)), this.eraCache[t];
});
}
extract(t, n, r) {
const i = this.dtFormatter(t, n), s = i.formatToParts(), a = s.find((o) => o.type.toLowerCase() === r);
return a ? a.value : null;
}
numberFormatter(t = {}) {
return new xx(this.intl, t.forceSimple || this.fastNumbers, t);
}
dtFormatter(t, n = {}) {
return new wx(t, this.intl, n);
}
relFormatter(t = {}) {
return new Sx(this.intl, this.isEnglish(), t);
}
listFormatter(t = {}) {
return cx(this.intl, t);
}
isEnglish() {
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || xc(this.intl).locale.startsWith("en-us");
}
getWeekSettings() {
return this.weekSettings ? this.weekSettings : Ic() ? px(this.locale) : wc;
}
getStartOfWeek() {
return this.getWeekSettings().firstDay;
}
getMinDaysInFirstWeek() {
return this.getWeekSettings().minimalDays;
}
getWeekendDays() {
return this.getWeekSettings().weekend;
}
equals(t) {
return this.locale === t.locale && this.numberingSystem === t.numberingSystem && this.outputCalendar === t.outputCalendar;
}
toString() {
return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;
}
}
let es = null;
class pt extends fr {
/**
* Get a singleton instance of UTC
* @return {FixedOffsetZone}
*/
static get utcInstance() {
return es === null && (es = new pt(0)), es;
}
/**
* Get an instance with a specified offset
* @param {number} offset - The offset in minutes
* @return {FixedOffsetZone}
*/
static instance(t) {
return t === 0 ? pt.utcInstance : new pt(t);
}
/**
* Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6"
* @param {string} s - The offset string to parse
* @example FixedOffsetZone.parseSpecifier("UTC+6")
* @example FixedOffsetZone.parseSpecifier("UTC+06")
* @example FixedOffsetZone.parseSpecifier("UTC-6:00")
* @return {FixedOffsetZone}
*/
static parseSpecifier(t) {
if (t) {
const n = t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
if (n)
return new pt(Li(n[1], n[2]));
}
return null;
}
constructor(t) {
super(), this.fixed = t;
}
/**
* The type of zone. `fixed` for all instances of `FixedOffsetZone`.
* @override
* @type {string}
*/
get type() {
return "fixed";
}
/**
* The name of this zone.
* All fixed zones' names always start with "UTC" (plus optional offset)
* @override
* @type {string}
*/
get name() {
return this.fixed === 0 ? "UTC" : `UTC${Gn(this.fixed, "narrow")}`;
}
/**
* The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`
*
* @override
* @type {string}
*/
get ianaName() {
return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Gn(-this.fixed, "narrow")}`;
}
/**
* Returns the offset's common name at the specified timestamp.
*
* For fixed offset zones this equals to the zone name.
* @override
*/
offsetName() {
return this.name;
}
/**
* Returns the offset's value as a string
* @override
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(t, n) {
return Gn(this.fixed, n);
}
/**
* Returns whether the offset is known to be fixed for the whole year:
* Always returns true for all fixed offset zones.
* @override
* @type {boolean}
*/
get isUniversal() {
return !0;
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
*
* For fixed offset zones, this is constant and does not depend on a timestamp.
* @override
* @return {number}
*/
offset() {
return this.fixed;
}
/**
* Return whether this Zone is equal to another zone (i.e. also fixed and same offset)
* @override
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(t) {
return t.type === "fixed" && t.fixed === this.fixed;
}
/**
* Return whether this Zone is valid:
* All fixed offset zones are valid.
* @override
* @type {boolean}
*/
get isValid() {
return !0;
}
}
class Tx extends fr {
constructor(t) {
super(), this.zoneName = t;
}
/** @override **/
get type() {
return "invalid";
}
/** @override **/
get name() {
return this.zoneName;
}
/** @override **/
get isUniversal() {
return !1;
}
/** @override **/
offsetName() {
return null;
}
/** @override **/
formatOffset() {
return "";
}
/** @override **/
offset() {
return NaN;
}
/** @override **/
equals() {
return !1;
}
/** @override **/
get isValid() {
return !1;
}
}
function Me(e, t) {
if (P(e) || e === null)
return t;
if (e instanceof fr)
return e;
if (Ix(e)) {
const n = e.toLowerCase();
return n === "default" ? t : n === "local" || n === "system" ? Di.instance : n === "utc" || n === "gmt" ? pt.utcInstance : pt.parseSpecifier(n) || ge.create(e);
} else return Ce(e) ? pt.instance(e) : typeof e == "object" && "offset" in e && typeof e.offset == "function" ? e : new Tx(e);
}
const ma = {
arab: "[٠-٩]",
arabext: "[۰-۹]",
bali: "[᭐-᭙]",
beng: "[০-৯]",
deva: "[०-९]",
fullwide: "[0-9]",
gujr: "[૦-૯]",
hanidec: "[〇|一|二|三|四|五|六|七|八|九]",
khmr: "[០-៩]",
knda: "[೦-೯]",
laoo: "[໐-໙]",
limb: "[᥆-᥏]",
mlym: "[൦-൯]",
mong: "[᠐-᠙]",
mymr: "[၀-၉]",
orya: "[୦-୯]",
tamldec: "[௦-௯]",
telu: "[౦-౯]",
thai: "[๐-๙]",
tibt: "[༠-༩]",
latn: "\\d"
}, Ho = {
arab: [1632, 1641],
arabext: [1776, 1785],
bali: [6992, 7001],
beng: [2534, 2543],
deva: [2406, 2415],
fullwide: [65296, 65303],
gujr: [2790, 2799],
khmr: [6112, 6121],
knda: [3302, 3311],
laoo: [3792, 3801],
limb: [6470, 6479],
mlym: [3430, 3439],
mong: [6160, 6169],
mymr: [4160, 4169],
orya: [2918, 2927],
tamldec: [3046, 3055],
telu: [3174, 3183],
thai: [3664, 3673],
tibt: [3872, 3881]
}, _x = ma.hanidec.replace(/[\[|\]]/g, "").split("");
function Mx(e) {
let t = parseInt(e, 10);
if (isNaN(t)) {
t = "";
for (let n = 0; n < e.length; n++) {
const r = e.charCodeAt(n);
if (e[n].search(ma.hanidec) !== -1)
t += _x.indexOf(e[n]);
else
for (const i in Ho) {
const [s, a] = Ho[i];
r >= s && r <= a && (t += r - s);
}
}
return parseInt(t, 10);
} else
return t;
}
const Us = /* @__PURE__ */ new Map();
function kx() {
Us.clear();
}
function Wt({ numberingSystem: e }, t = "") {
const n = e || "latn";
let r = Us.get(n);
r === void 0 && (r = /* @__PURE__ */ new Map(), Us.set(n, r));
let i = r.get(t);
return i === void 0 && (i = new RegExp(`${ma[n]}${t}`), r.set(t, i)), i;
}
let jo = () => Date.now(), zo = "system", Zo = null, Yo = null, Ko = null, Go = 60, qo, Bo = null;
class B {
/**
* Get the callback for returning the current timestamp.
* @type {function}
*/
static get now() {
return jo;
}
/**
* Set the callback for returning the current timestamp.
* The function should return a number, which will be interpreted as an Epoch millisecond count
* @type {function}
* @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future
* @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
*/
static set now(t) {
jo = t;
}
/**
* Set the default time zone to create DateTimes in. Does not affect existing instances.
* Use the value "system" to reset this value to the system's time zone.
* @type {string}
*/
static set defaultZone(t) {
zo = t;
}
/**
* Get the default time zone object currently used to create DateTimes. Does not affect existing instances.
* The default value is the system's time zone (the one set on the machine that runs this code).
* @type {Zone}
*/
static get defaultZone() {
return Me(zo, Di.instance);
}
/**
* Get the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultLocale() {
return Zo;
}
/**
* Set the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultLocale(t) {
Zo = t;
}
/**
* Get the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultNumberingSystem() {
return Yo;
}
/**
* Set the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultNumberingSystem(t) {
Yo = t;
}
/**
* Get the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultOutputCalendar() {
return Ko;
}
/**
* Set the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultOutputCalendar(t) {
Ko = t;
}
/**
* @typedef {Object} WeekSettings
* @property {number} firstDay
* @property {number} minimalDays
* @property {number[]} weekend
*/
/**
* @return {WeekSettings|null}
*/
static get defaultWeekSettings() {
return Bo;
}
/**
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
* how many days are required in the first week of a year.
* Does not affect existing instances.
*
* @param {WeekSettings|null} weekSettings
*/
static set defaultWeekSettings(t) {
Bo = Ws(t);
}
/**
* Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
* @type {number}
*/
static get twoDigitCutoffYear() {
return Go;
}
/**
* Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
* @type {number}
* @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century
* @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century
* @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950
* @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
*/
static set twoDigitCutoffYear(t) {
Go = t % 100;
}
/**
* Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
static get throwOnInvalid() {
return qo;
}
/**
* Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
static set throwOnInvalid(t) {
qo = t;
}
/**
* Reset Luxon's global caches. Should only be necessary in testing scenarios.
* @return {void}
*/
static resetCaches() {
H.resetCache(), ge.resetCache(), I.resetCache(), kx();
}
}
class Yt {
constructor(t, n) {
this.reason = t, this.explanation = n;
}
toMessage() {
return this.explanation ? `${this.reason}: ${this.explanation}` : this.reason;
}
}
const Sc = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], Tc = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
function $t(e, t) {
return new Yt(
"unit out of range",
`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`
);
}
function ga(e, t, n) {
const r = new Date(Date.UTC(e, t - 1, n));
e < 100 && e >= 0 && r.setUTCFullYear(r.getUTCFullYear() - 1900);
const i = r.getUTCDay();
return i === 0 ? 7 : i;
}
function _c(e, t, n) {
return n + (dr(e) ? Tc : Sc)[t - 1];
}
function Mc(e, t) {
const n = dr(e) ? Tc : Sc, r = n.findIndex((s) => s < t), i = t - n[r];
return { month: r + 1, day: i };
}
function ya(e, t) {
return (e - t + 7) % 7 + 1;
}
function oi(e, t = 4, n = 1) {
const { year: r, month: i, day: s } = e, a = _c(r, i, s), o = ya(ga(r, i, s), n);
let l = Math.floor((a - o + 14 - t) / 7), u;
return l < 1 ? (u = r - 1, l = sr(u, t, n)) : l > sr(r, t, n) ? (u = r + 1, l = 1) : u = r, { weekYear: u, weekNumber: l, weekday: o, ...Ri(e) };
}
function Xo(e, t = 4, n = 1) {
const { weekYear: r, weekNumber: i, weekday: s } = e, a = ya(ga(r, 1, t), n), o = hn(r);
let l = i * 7 + s - a - 7 + t, u;
l < 1 ? (u = r - 1, l += hn(u)) : l > o ? (u = r + 1, l -= hn(r)) : u = r;
const { month: c, day: h } = Mc(u, l);
return { year: u, month: c, day: h, ...Ri(e) };
}
function ns(e) {
const { year: t, month: n, day: r } = e, i = _c(t, n, r);
return { year: t, ordinal: i, ...Ri(e) };
}
function Jo(e) {
const { year: t, ordinal: n } = e, { month: r, day: i } = Mc(t, n);
return { year: t, month: r, day: i, ...Ri(e) };
}
function Qo(e, t) {
if (!P(e.localWeekday) || !P(e.localWeekNumber) || !P(e.localWeekYear)) {
if (!P(e.weekday) || !P(e.weekNumber) || !P(e.weekYear))
throw new an(
"Cannot mix locale-based week fields with ISO-based week fields"
);
return P(e.localWeekday) || (e.weekday = e.localWeekday), P(e.localWeekNumber) || (e.weekNumber = e.localWeekNumber), P(e.localWeekYear) || (e.weekYear = e.localWeekYear), delete e.localWeekday, delete e.localWeekNumber, delete e.localWeekYear, {
minDaysInFirstWeek: t.getMinDaysInFirstWeek(),
startOfWeek: t.getStartOfWeek()
};
} else
return { minDaysInFirstWeek: 4, startOfWeek: 1 };
}
function Ox(e, t = 4, n = 1) {
const r = $i(e.weekYear), i = Ft(
e.weekNumber,
1,
sr(e.weekYear, t, n)
), s = Ft(e.weekday, 1, 7);
return r ? i ? s ? !1 : $t("weekday", e.weekday) : $t("week", e.weekNumber) : $t("weekYear", e.weekYear);
}
function Cx(e) {
const t = $i(e.year), n = Ft(e.ordinal, 1, hn(e.year));
return t ? n ? !1 : $t("ordinal", e.ordinal) : $t("year", e.year);
}
function kc(e) {
const t = $i(e.year), n = Ft(e.month, 1, 12), r = Ft(e.day, 1, li(e.year, e.month));
return t ? n ? r ? !1 : $t("day", e.day) : $t("month", e.month) : $t("year", e.year);
}
function Oc(e) {
const { hour: t, minute: n, second: r, millisecond: i } = e, s = Ft(t, 0, 23) || t === 24 && n === 0 && r === 0 && i === 0, a = Ft(n, 0, 59), o = Ft(r, 0, 59), l = Ft(i, 0, 999);
return s ? a ? o ? l ? !1 : $t("millisecond", i) : $t("second", r) : $t("minute", n) : $t("hour", t);
}
function P(e) {
return typeof e > "u";
}
function Ce(e) {
return typeof e == "number";
}
function $i(e) {
return typeof e == "number" && e % 1 === 0;
}
function Ix(e) {
return typeof e == "string";
}
function Ax(e) {
return Object.prototype.toString.call(e) === "[object Date]";
}
function Cc() {
try {
return typeof Intl < "u" && !!Intl.RelativeTimeFormat;
} catch {
return !1;
}
}
function Ic() {
try {
return typeof Intl < "u" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
} catch {
return !1;
}
}
function Nx(e) {
return Array.isArray(e) ? e : [e];
}
function tl(e, t, n) {
if (e.length !== 0)
return e.reduce((r, i) => {
const s = [t(i), i];
return r && n(r[0], s[0]) === r[0] ? r : s;
}, null)[1];
}
function Px(e, t) {
return t.reduce((n, r) => (n[r] = e[r], n), {});
}
function Tn(e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}
function Ws(e) {
if (e == null)
return null;
if (typeof e != "object")
throw new ut("Week settings must be an object");
if (!Ft(e.firstDay, 1, 7) || !Ft(e.minimalDays, 1, 7) || !Array.isArray(e.weekend) || e.weekend.some((t) => !Ft(t, 1, 7)))
throw new ut("Invalid week settings");
return {
firstDay: e.firstDay,
minimalDays: e.minimalDays,
weekend: Array.from(e.weekend)
};
}
function Ft(e, t, n) {
return $i(e) && e >= t && e <= n;
}
function Ex(e, t) {
return e - t * Math.floor(e / t);
}
function X(e, t = 2) {
const n = e < 0;
let r;
return n ? r = "-" + ("" + -e).padStart(t, "0") : r = ("" + e).padStart(t, "0"), r;
}
function _e(e) {
if (!(P(e) || e === null || e === ""))
return parseInt(e, 10);
}
function Ee(e) {
if (!(P(e) || e === null || e === ""))
return parseFloat(e);
}
function va(e) {
if (!(P(e) || e === null || e === "")) {
const t = parseFloat("0." + e) * 1e3;
return Math.floor(t);
}
}
function ba(e, t, n = !1) {
const r = 10 ** t;
return (n ? Math.trunc : Math.round)(e * r) / r;
}
function dr(e) {
return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
}
function hn(e) {
return dr(e) ? 366 : 365;
}
function li(e, t) {
const n = Ex(t - 1, 12) + 1, r = e + (t - n) / 12;
return n === 2 ? dr(r) ? 29 : 28 : [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][n - 1];
}
function Fi(e) {
let t = Date.UTC(
e.year,
e.month - 1,
e.day,
e.hour,
e.minute,
e.second,
e.millisecond
);
return e.year < 100 && e.year >= 0 && (t = new Date(t), t.setUTCFullYear(e.year, e.month - 1, e.day)), +t;
}
function el(e, t, n) {
return -ya(ga(e, 1, t), n) + t - 1;
}
function sr(e, t = 4, n = 1) {
const r = el(e, t, n), i = el(e + 1, t, n);
return (hn(e) - r + i) / 7;
}
function Hs(e) {
return e > 99 ? e : e > B.twoDigitCutoffYear ? 1900 + e : 2e3 + e;
}
function Ac(e, t, n, r = null) {
const i = new Date(e), s = {
hourCycle: "h23",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit"
};
r && (s.timeZone = r);
const a = { timeZoneName: t, ...s }, o = new Intl.DateTimeFormat(n, a).formatToParts(i).find((l) => l.type.toLowerCase() === "timezonename");
return o ? o.value : null;
}
function Li(e, t) {
let n = parseInt(e, 10);
Number.isNaN(n) && (n = 0);
const r = parseInt(t, 10) || 0, i = n < 0 || Object.is(n, -0) ? -r : r;
return n * 60 + i;
}
function Nc(e) {
const t = Number(e);
if (typeof e == "boolean" || e === "" || Number.isNaN(t))
throw new ut(`Invalid unit value ${e}`);
return t;
}
function ui(e, t) {
const n = {};
for (const r in e)
if (Tn(e, r)) {
const i = e[r];
if (i == null) continue;
n[t(r)] = Nc(i);
}
return n;
}
function Gn(e, t) {
const n = Math.trunc(Math.abs(e / 60)), r = Math.trunc(Math.abs(e % 60)), i = e >= 0 ? "+" : "-";
switch (t) {
case "short":
return `${i}${X(n, 2)}:${X(r, 2)}`;
case "narrow":
return `${i}${n}${r > 0 ? `:${r}` : ""}`;
case "techie":
return `${i}${X(n, 2)}${X(r, 2)}`;
default:
throw new RangeError(`Value format ${t} is out of range for property format`);
}
}
function Ri(e) {
return Px(e, ["hour", "minute", "second", "millisecond"]);
}
const Dx = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
], Pc = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
], $x = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"];
function Ec(e) {
switch (e) {
case "narrow":
return [...$x];
case "short":
return [...Pc];
case "long":
return [...Dx];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
case "2-digit":
return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
default:
return null;
}
}
const Dc = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
], $c = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], Fx = ["M", "T", "W", "T", "F", "S", "S"];
function Fc(e) {
switch (e) {
case "narrow":
return [...Fx];
case "short":
return [...$c];
case "long":
return [...Dc];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7"];
default:
return null;
}
}
const Lc = ["AM", "PM"], Lx = ["Before Christ", "Anno Domini"], Rx = ["BC", "AD"], Vx = ["B", "A"];
function Rc(e) {
switch (e) {
case "narrow":
return [...Vx];
case "short":
return [...Rx];
case "long":
return [...Lx];
default:
return null;
}
}
function Ux(e) {
return Lc[e.hour < 12 ? 0 : 1];
}
function Wx(e, t) {
return Fc(t)[e.weekday - 1];
}
function Hx(e, t) {
return Ec(t)[e.month - 1];
}
function jx(e, t) {
return Rc(t)[e.year < 0 ? 0 : 1];
}
function zx(e, t, n = "always", r = !1) {
const i = {
years: ["year", "yr."],
quarters: ["quarter", "qtr."],
months: ["month", "mo."],
weeks: ["week", "wk."],
days: ["day", "day", "days"],
hours: ["hour", "hr."],
minutes: ["minute", "min."],
seconds: ["second", "sec."]
}, s = ["hours", "minutes", "seconds"].indexOf(e) === -1;
if (n === "auto" && s) {
const h = e === "days";
switch (t) {
case 1:
return h ? "tomorrow" : `next ${i[e][0]}`;
case -1:
return h ? "yesterday" : `last ${i[e][0]}`;
case 0:
return h ? "today" : `this ${i[e][0]}`;
}
}
const a = Object.is(t, -0) || t < 0, o = Math.abs(t), l = o === 1, u = i[e], c = r ? l ? u[1] : u[2] || u[1] : l ? i[e][0] : e;
return a ? `${o} ${c} ago` : `in ${o} ${c}`;
}
function nl(e, t) {
let n = "";
for (const r of e)
r.literal ? n += r.val : n += t(r.val);
return n;
}
const Zx = {
D: ai,
DD: ec,
DDD: nc,
DDDD: rc,
t: ic,
tt: sc,
ttt: ac,
tttt: oc,
T: lc,
TT: uc,
TTT: cc,
TTTT: hc,
f: fc,
ff: pc,
fff: gc,
ffff: vc,
F: dc,
FF: mc,
FFF: yc,
FFFF: bc
};
class ct {
static create(t, n = {}) {
return new ct(t, n);
}
static parseFormat(t) {
let n = null, r = "", i = !1;
const s = [];
for (let a = 0; a < t.length; a++) {
const o = t.charAt(a);
o === "'" ? (r.length > 0 && s.push({ literal: i || /^\s+$/.test(r), val: r }), n = null, r = "", i = !i) : i || o === n ? r += o : (r.length > 0 && s.push({ literal: /^\s+$/.test(r), val: r }), r = o, n = o);
}
return r.length > 0 && s.push({ literal: i || /^\s+$/.test(r), val: r }), s;
}
static macroTokenToFormatOpts(t) {
return Zx[t];
}
constructor(t, n) {
this.opts = n, this.loc = t, this.systemLoc = null;
}
formatWithSystemDefault(t, n) {
return this.systemLoc === null && (this.systemLoc = this.loc.redefaultToSystem()), this.systemLoc.dtFormatter(t, { ...this.opts, ...n }).format();
}
dtFormatter(t, n = {}) {
return this.loc.dtFormatter(t, { ...this.opts, ...n });
}
formatDateTime(t, n) {
return this.dtFormatter(t, n).format();
}
formatDateTimeParts(t, n) {
return this.dtFormatter(t, n).formatToParts();
}
formatInterval(t, n) {
return this.dtFormatter(t.start, n).dtf.formatRange(t.start.toJSDate(), t.end.toJSDate());
}
resolvedOptions(t, n) {
return this.dtFormatter(t, n).resolvedOptions();
}
num(t, n = 0) {
if (this.opts.forceSimple)
return X(t, n);
const r = { ...this.opts };
return n > 0 && (r.padTo = n), this.loc.numberFormatter(r).format(t);
}
formatDateTimeFromString(t, n) {
const r = this.loc.listingMode() === "en", i = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", s = (d, p) => this.loc.extract(t, d, p), a = (d) => t.isOffsetFixed && t.offset === 0 && d.allowZ ? "Z" : t.isValid ? t.zone.formatOffset(t.ts, d.format) : "", o = () => r ? Ux(t) : s({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), l = (d, p) => r ? Hx(t, d) : s(p ? { month: d } : { month: d, day: "numeric" }, "month"), u = (d, p) => r ? Wx(t, d) : s(
p ? { weekday: d } : { weekday: d, month: "long", day: "numeric" },
"weekday"
), c = (d) => {
const p = ct.macroTokenToFormatOpts(d);
return p ? this.formatWithSystemDefault(t, p) : d;
}, h = (d) => r ? jx(t, d) : s({ era: d }, "era"), f = (d) => {
switch (d) {
// ms
case "S":
return this.num(t.millisecond);
case "u":
// falls through
case "SSS":
return this.num(t.millisecond, 3);
// seconds
case "s":
return this.num(t.second);
case "ss":
return this.num(t.second, 2);
// fractional seconds
case "uu":
return this.num(Math.floor(t.millisecond / 10), 2);
case "uuu":
return this.num(Math.floor(t.millisecond / 100));
// minutes
case "m":
return this.num(t.minute);
case "mm":
return this.num(t.minute, 2);
// hours
case "h":
return this.num(t.hour % 12 === 0 ? 12 : t.hour % 12);
case "hh":
return this.num(t.hour % 12 === 0 ? 12 : t.hour % 12, 2);
case "H":
return this.num(t.hour);
case "HH":
return this.num(t.hour, 2);
// offset
case "Z":
return a({ format: "narrow", allowZ: this.opts.allowZ });
case "ZZ":
return a({ format: "short", allowZ: this.opts.allowZ });
case "ZZZ":
return a({ format: "techie", allowZ: this.opts.allowZ });
case "ZZZZ":
return t.zone.offsetName(t.ts, { format: "short", locale: this.loc.locale });
case "ZZZZZ":
return t.zone.offsetName(t.ts, { format: "long", locale: this.loc.locale });
// zone
case "z":
return t.zoneName;
// meridiems
case "a":
return o();
// dates
case "d":
return i ? s({ day: "numeric" }, "day") : this.num(t.day);
case "dd":
return i ? s({ day: "2-digit" }, "day") : this.num(t.day, 2);
// weekdays - standalone
case "c":
return this.num(t.weekday);
case "ccc":
return u("short", !0);
case "cccc":
return u("long", !0);
case "ccccc":
return u("narrow", !0);
// weekdays - format
case "E":
return this.num(t.weekday);
case "EEE":
return u("short", !1);
case "EEEE":
return u("long", !1);
case "EEEEE":
return u("narrow", !1);
// months - standalone
case "L":
return i ? s({ month: "numeric", day: "numeric" }, "month") : this.num(t.month);
case "LL":
return i ? s({ month: "2-digit", day: "numeric" }, "month") : this.num(t.month, 2);
case "LLL":
return l("short", !0);
case "LLLL":
return l("long", !0);
case "LLLLL":
return l("narrow", !0);
// months - format
case "M":
return i ? s({ month: "numeric" }, "month") : this.num(t.month);
case "MM":
return i ? s({ month: "2-digit" }, "month") : this.num(t.month, 2);
case "MMM":
return l("short", !1);
case "MMMM":
return l("long", !1);
case "MMMMM":
return l("narrow", !1);
// years
case "y":
return i ? s({ year: "numeric" }, "year") : this.num(t.year);
case "yy":
return i ? s({ year: "2-digit" }, "year") : this.num(t.year.toString().slice(-2), 2);
case "yyyy":
return i ? s({ year: "numeric" }, "year") : this.num(t.year, 4);
case "yyyyyy":
return i ? s({ year: "numeric" }, "year") : this.num(t.year, 6);
// eras
case "G":
return h("short");
case "GG":
return h("long");
case "GGGGG":
return h("narrow");
case "kk":
return this.num(t.weekYear.toString().slice(-2), 2);
case "kkkk":
return this.num(t.weekYear, 4);
case "W":
return this.num(t.weekNumber);
case "WW":
return this.num(t.weekNumber, 2);
case "n":
return this.num(t.localWeekNumber);
case "nn":
return this.num(t.localWeekNumber, 2);
case "ii":
return this.num(t.localWeekYear.toString().slice(-2), 2);
case "iiii":
return this.num(t.localWeekYear, 4);
case "o":
return this.num(t.ordinal);
case "ooo":
return this.num(t.ordinal, 3);
case "q":
return this.num(t.quarter);
case "qq":
return this.num(t.quarter, 2);
case "X":
return this.num(Math.floor(t.ts / 1e3));
case "x":
return this.num(t.ts);
default:
return c(d);
}
};
return nl(ct.parseFormat(n), f);
}
formatDurationFromString(t, n) {
const r = (l) => {
switch (l[0]) {
case "S":
return "millisecond";
case "s":
return "second";
case "m":
return "minute";
case "h":
return "hour";
case "d":
return "day";
case "w":
return "week";
case "M":
return "month";
case "y":
return "year";
default:
return null;
}
}, i = (l) => (u) => {
const c = r(u);
return c ? this.num(l.get(c), u.length) : u;
}, s = ct.parseFormat(n), a = s.reduce(
(l, { literal: u, val: c }) => u ? l : l.concat(c),
[]
), o = t.shiftTo(...a.map(r).filter((l) => l));
return nl(s, i(o));
}
}
const Vc = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
function In(...e) {
const t = e.reduce((n, r) => n + r.source, "");
return RegExp(`^${t}$`);
}
function An(...e) {
return (t) => e.reduce(
([n, r, i], s) => {
const [a, o, l] = s(t, i);
return [{ ...n, ...a }, o || r, l];
},
[{}, null, 1]
).slice(0, 2);
}
function Nn(e, ...t) {
if (e == null)
return [null, null];
for (const [n, r] of t) {
const i = n.exec(e);
if (i)
return r(i);
}
return [null, null];
}
function Uc(...e) {
return (t, n) => {
const r = {};
let i;
for (i = 0; i < e.length; i++)
r[e[i]] = _e(t[n + i]);
return [r, null, n + i];
};
}
const Wc = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, Yx = `(?:${Wc.source}?(?:\\[(${Vc.source})\\])?)?`, xa = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, Hc = RegExp(`${xa.source}${Yx}`), wa = RegExp(`(?:T${Hc.source})?`), Kx = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Gx = /(\d{4})-?W(\d\d)(?:-?(\d))?/, qx = /(\d{4})-?(\d{3})/, Bx = Uc("weekYear", "weekNumber", "weekDay"), Xx = Uc("year", "ordinal"), Jx = /(\d{4})-(\d\d)-(\d\d)/, jc = RegExp(
`${xa.source} ?(?:${Wc.source}|(${Vc.source}))?`
), Qx = RegExp(`(?: ${jc.source})?`);
function fn(e, t, n) {
const r = e[t];
return P(r) ? n : _e(r);
}
function tw(e, t) {
return [{
year: fn(e, t),
month: fn(e, t + 1, 1),
day: fn(e, t + 2, 1)
}, null, t + 3];
}
function Pn(e, t) {
return [{
hours: fn(e, t, 0),
minutes: fn(e, t + 1, 0),
seconds: fn(e, t + 2, 0),
milliseconds: va(e[t + 3])
}, null, t + 4];
}
function pr(e, t) {
const n = !e[t] && !e[t + 1], r = Li(e[t + 1], e[t + 2]), i = n ? null : pt.instance(r);
return [{}, i, t + 3];
}
function mr(e, t) {
const n = e[t] ? ge.create(e[t]) : null;
return [{}, n, t + 1];
}
const ew = RegExp(`^T?${xa.source}$`), nw = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
function rw(e) {
const [t, n, r, i, s, a, o, l, u] = e, c = t[0] === "-", h = l && l[0] === "-", f = (d, p = !1) => d !== void 0 && (p || d && c) ? -d : d;
return [
{
years: f(Ee(n)),
months: f(Ee(r)),
weeks: f(Ee(i)),
days: f(Ee(s)),
hours: f(Ee(a)),
minutes: f(Ee(o)),
seconds: f(Ee(l), l === "-0"),
milliseconds: f(va(u), h)
}
];
}
const iw = {
GMT: 0,
EDT: -4 * 60,
EST: -5 * 60,
CDT: -5 * 60,
CST: -6 * 60,
MDT: -6 * 60,
MST: -7 * 60,
PDT: -7 * 60,
PST: -8 * 60
};
function Sa(e, t, n, r, i, s, a) {
const o = {
year: t.length === 2 ? Hs(_e(t)) : _e(t),
month: Pc.indexOf(n) + 1,
day: _e(r),
hour: _e(i),
minute: _e(s)
};
return a && (o.second = _e(a)), e && (o.weekday = e.length > 3 ? Dc.indexOf(e) + 1 : $c.indexOf(e) + 1), o;
}
const sw = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
function aw(e) {
const [
,
t,
n,
r,
i,
s,
a,
o,
l,
u,
c,
h
] = e, f = Sa(t, i, r, n, s, a, o);
let d;
return l ? d = iw[l] : u ? d = 0 : d = Li(c, h), [f, new pt(d)];
}
function ow(e) {
return e.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
}
const lw = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, uw = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, cw = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
function rl(e) {
const [, t, n, r, i, s, a, o] = e;
return [Sa(t, i, r, n, s, a, o), pt.utcInstance];
}
function hw(e) {
const [, t, n, r, i, s, a, o] = e;
return [Sa(t, o, n, r, i, s, a), pt.utcInstance];
}
const fw = In(Kx, wa), dw = In(Gx, wa), pw = In(qx, wa), mw = In(Hc), zc = An(
tw,
Pn,
pr,
mr
), gw = An(
Bx,
Pn,
pr,
mr
), yw = An(
Xx,
Pn,
pr,
mr
), vw = An(
Pn,
pr,
mr
);
function bw(e) {
return Nn(
e,
[fw, zc],
[dw, gw],
[pw, yw],
[mw, vw]
);
}
function xw(e) {
return Nn(ow(e), [sw, aw]);
}
function ww(e) {
return Nn(
e,
[lw, rl],
[uw, rl],
[cw, hw]
);
}
function Sw(e) {
return Nn(e, [nw, rw]);
}
const Tw = An(Pn);
function _w(e) {
return Nn(e, [ew, Tw]);
}
const Mw = In(Jx, Qx), kw = In(jc), Ow = An(
Pn,
pr,
mr
);
function Cw(e) {
return Nn(
e,
[Mw, zc],
[kw, Ow]
);
}
const il = "Invalid Duration", Zc = {
weeks: {
days: 7,
hours: 7 * 24,
minutes: 7 * 24 * 60,
seconds: 7 * 24 * 60 * 60,
milliseconds: 7 * 24 * 60 * 60 * 1e3
},
days: {
hours: 24,
minutes: 24 * 60,
seconds: 24 * 60 * 60,
milliseconds: 24 * 60 * 60 * 1e3
},
hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1e3 },
minutes: { seconds: 60, milliseconds: 60 * 1e3 },
seconds: { milliseconds: 1e3 }
}, Iw = {
years: {
quarters: 4,
months: 12,
weeks: 52,
days: 365,
hours: 365 * 24,
minutes: 365 * 24 * 60,
seconds: 365 * 24 * 60 * 60,
milliseconds: 365 * 24 * 60 * 60 * 1e3
},
quarters: {
months: 3,
weeks: 13,
days: 91,
hours: 91 * 24,
minutes: 91 * 24 * 60,
seconds: 91 * 24 * 60 * 60,
milliseconds: 91 * 24 * 60 * 60 * 1e3
},
months: {
weeks: 4,
days: 30,
hours: 30 * 24,
minutes: 30 * 24 * 60,
seconds: 30 * 24 * 60 * 60,
milliseconds: 30 * 24 * 60 * 60 * 1e3
},
...Zc
}, Nt = 146097 / 400, en = 146097 / 4800, Aw = {
years: {
quarters: 4,
months: 12,
weeks: Nt / 7,
days: Nt,
hours: Nt * 24,
minutes: Nt * 24 * 60,
seconds: Nt * 24 * 60 * 60,
milliseconds: Nt * 24 * 60 * 60 * 1e3
},
quarters: {
months: 3,
weeks: Nt / 28,
days: Nt / 4,
hours: Nt * 24 / 4,
minutes: Nt * 24 * 60 / 4,
seconds: Nt * 24 * 60 * 60 / 4,
milliseconds: Nt * 24 * 60 * 60 * 1e3 / 4
},
months: {
weeks: en / 7,
days: en,
hours: en * 24,
minutes: en * 24 * 60,
seconds: en * 24 * 60 * 60,
milliseconds: en * 24 * 60 * 60 * 1e3
},
...Zc
}, Ve = [
"years",
"quarters",
"months",
"weeks",
"days",
"hours",
"minutes",
"seconds",
"milliseconds"
], Nw = Ve.slice(0).reverse();
function Se(e, t, n = !1) {
const r = {
values: n ? t.values : { ...e.values, ...t.values || {} },
loc: e.loc.clone(t.loc),
conversionAccuracy: t.conversionAccuracy || e.conversionAccuracy,
matrix: t.matrix || e.matrix
};
return new R(r);
}
function Yc(e, t) {
let n = t.milliseconds ?? 0;
for (const r of Nw.slice(1))
t[r] && (n += t[r] * e[r].milliseconds);
return n;
}
function sl(e, t) {
const n = Yc(e, t) < 0 ? -1 : 1;
Ve.reduceRight((r, i) => {
if (P(t[i]))
return r;
if (r) {
const s = t[r] * n, a = e[i][r], o = Math.floor(s / a);
t[i] += o * n, t[r] -= o * a * n;
}
return i;
}, null), Ve.reduce((r, i) => {
if (P(t[i]))
return r;
if (r) {
const s = t[r] % 1;
t[r] -= s, t[i] += s * e[r][i];
}
return i;
}, null);
}
function Pw(e) {
const t = {};
for (const [n, r] of Object.entries(e))
r !== 0 && (t[n] = r);
return t;
}
class R {
/**
* @private
*/
constructor(t) {
const n = t.conversionAccuracy === "longterm" || !1;
let r = n ? Aw : Iw;
t.matrix && (r = t.matrix), this.values = t.values, this.loc = t.loc || H.create(), this.conversionAccuracy = n ? "longterm" : "casual", this.invalid = t.invalid || null, this.matrix = r, this.isLuxonDuration = !0;
}
/**
* Create Duration from a number of milliseconds.
* @param {number} count of milliseconds
* @param {Object} opts - options for parsing
* @param {string} [opts.locale='en-US'] - the locale to use
* @param {string} opts.numberingSystem - the numbering system to use
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
* @return {Duration}
*/
static fromMillis(t, n) {
return R.fromObject({ milliseconds: t }, n);
}
/**
* Create a Duration from a JavaScript object with keys like 'years' and 'hours'.
* If this object is empty then a zero milliseconds duration is returned.
* @param {Object} obj - the object to create the DateTime from
* @param {number} obj.years
* @param {number} obj.quarters
* @param {number} obj.months
* @param {number} obj.weeks
* @param {number} obj.days
* @param {number} obj.hours
* @param {number} obj.minutes
* @param {number} obj.seconds
* @param {number} obj.milliseconds
* @param {Object} [opts=[]] - options for creating this Duration
* @param {string} [opts.locale='en-US'] - the locale to use
* @param {string} opts.numberingSystem - the numbering system to use
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
* @param {string} [opts.matrix=Object] - the custom conversion system to use
* @return {Duration}
*/
static fromObject(t, n = {}) {
if (t == null || typeof t != "object")
throw new ut(
`Duration.fromObject: argument expected to be an object, got ${t === null ? "null" : typeof t}`
);
return new R({
values: ui(t, R.normalizeUnit),
loc: H.fromObject(n),
conversionAccuracy: n.conversionAccuracy,
matrix: n.matrix
});
}
/**
* Create a Duration from DurationLike.
*
* @param {Object | number | Duration} durationLike
* One of:
* - object with keys like 'years' and 'hours'.
* - number representing milliseconds
* - Duration instance
* @return {Duration}
*/
static fromDurationLike(t) {
if (Ce(t))
return R.fromMillis(t);
if (R.isDuration(t))
return t;
if (typeof t == "object")
return R.fromObject(t);
throw new ut(
`Unknown duration argument ${t} of type ${typeof t}`
);
}
/**
* Create a Duration from an ISO 8601 duration string.
* @param {string} text - text to parse
* @param {Object} opts - options for parsing
* @param {string} [opts.locale='en-US'] - the locale to use
* @param {string} opts.numberingSystem - the numbering system to use
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
* @param {string} [opts.matrix=Object] - the preset conversion system to use
* @see https://en.wikipedia.org/wiki/ISO_8601#Durations
* @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }
* @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }
* @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }
* @return {Duration}
*/
static fromISO(t, n) {
const [r] = Sw(t);
return r ? R.fromObject(r, n) : R.invalid("unparsable", `the input "${t}" can't be parsed as ISO 8601`);
}
/**
* Create a Duration from an ISO 8601 time string.
* @param {string} text - text to parse
* @param {Object} opts - options for parsing
* @param {string} [opts.locale='en-US'] - the locale to use
* @param {string} opts.numberingSystem - the numbering system to use
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
* @param {string} [opts.matrix=Object] - the conversion system to use
* @see https://en.wikipedia.org/wiki/ISO_8601#Times
* @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }
* @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
* @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
* @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
* @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
* @return {Duration}
*/
static fromISOTime(t, n) {
const [r] = _w(t);
return r ? R.fromObject(r, n) : R.invalid("unparsable", `the input "${t}" can't be parsed as ISO 8601`);
}
/**
* Create an invalid Duration.
* @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
* @return {Duration}
*/
static invalid(t, n = null) {
if (!t)
throw new ut("need to specify a reason the Duration is invalid");
const r = t instanceof Yt ? t : new Yt(t, n);
if (B.throwOnInvalid)
throw new rx(r);
return new R({ invalid: r });
}
/**
* @private
*/
static normalizeUnit(t) {
const n = {
year: "years",
years: "years",
quarter: "quarters",
quarters: "quarters",
month: "months",
months: "months",
week: "weeks",
weeks: "weeks",
day: "days",
days: "days",
hour: "hours",
hours: "hours",
minute: "minutes",
minutes: "minutes",
second: "seconds",
seconds: "seconds",
millisecond: "milliseconds",
milliseconds: "milliseconds"
}[t && t.toLowerCase()];
if (!n) throw new tc(t);
return n;
}
/**
* Check if an object is a Duration. Works across context boundaries
* @param {object} o
* @return {boolean}
*/
static isDuration(t) {
return t && t.isLuxonDuration || !1;
}
/**
* Get the locale of a Duration, such 'en-GB'
* @type {string}
*/
get locale() {
return this.isValid ? this.loc.locale : null;
}
/**
* Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration
*
* @type {string}
*/
get numberingSystem() {
return this.isValid ? this.loc.numberingSystem : null;
}
/**
* Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:
* * `S` for milliseconds
* * `s` for seconds
* * `m` for minutes
* * `h` for hours
* * `d` for days
* * `w` for weeks
* * `M` for months
* * `y` for years
* Notes:
* * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits
* * Tokens can be escaped by wrapping with single quotes.
* * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting.
* @param {string} fmt - the format string
* @param {Object} opts - options
* @param {boolean} [opts.floor=true] - floor numerical values
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2"
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002"
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000"
* @return {string}
*/
toFormat(t, n = {}) {
const r = {
...n,
floor: n.round !== !1 && n.floor !== !1
};
return this.isValid ? ct.create(this.loc, r).formatDurationFromString(this, t) : il;
}
/**
* Returns a string representation of a Duration with all units included.
* To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
* @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
* @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.
* @example
* ```js
* var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
* dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
* dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
* dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
* ```
*/
toHuman(t = {}) {
if (!this.isValid) return il;
const n = Ve.map((r) => {
const i = this.values[r];
return P(i) ? null : this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...t, unit: r.slice(0, -1) }).format(i);
}).filter((r) => r);
return this.loc.listFormatter({ type: "conjunction", style: t.listStyle || "narrow", ...t }).format(n);
}
/**
* Returns a JavaScript object with this Duration's values.
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
* @return {Object}
*/
toObject() {
return this.isValid ? { ...this.values } : {};
}
/**
* Returns an ISO 8601-compliant string representation of this Duration.
* @see https://en.wikipedia.org/wiki/ISO_8601#Durations
* @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'
* @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'
* @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'
* @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'
* @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'
* @return {string}
*/
toISO() {
if (!this.isValid) return null;
let t = "P";
return this.years !== 0 && (t += this.years + "Y"), (this.months !== 0 || this.quarters !== 0) && (t += this.months + this.quarters * 3 + "M"), this.weeks !== 0 && (t += this.weeks + "W"), this.days !== 0 && (t += this.days + "D"), (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) && (t += "T"), this.hours !== 0 && (t += this.hours + "H"), this.minutes !== 0 && (t += this.minutes + "M"), (this.seconds !== 0 || this.milliseconds !== 0) && (t += ba(this.seconds + this.milliseconds / 1e3, 3) + "S"), t === "P" && (t += "T0S"), t;
}
/**
* Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.
* Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.
* @see https://en.wikipedia.org/wiki/ISO_8601#Times
* @param {Object} opts - options
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
* @param {boolean} [opts.includePrefix=false] - include the `T` prefix
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'
* @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'
* @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'
* @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'
* @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'
* @return {string}
*/
toISOTime(t = {}) {
if (!this.isValid) return null;
const n = this.toMillis();
return n < 0 || n >= 864e5 ? null : (t = {
suppressMilliseconds: !1,
suppressSeconds: !1,
includePrefix: !1,
format: "extended",
...t,
includeOffset: !1
}, I.fromMillis(n, { zone: "UTC" }).toISOTime(t));
}
/**
* Returns an ISO 8601 representation of this Duration appropriate for use in JSON.
* @return {string}
*/
toJSON() {
return this.toISO();
}
/**
* Returns an ISO 8601 representation of this Duration appropriate for use in debugging.
* @return {string}
*/
toString() {
return this.toISO();
}
/**
* Returns a string representation of this Duration appropriate for the REPL.
* @return {string}
*/
[Symbol.for("nodejs.util.inspect.custom")]() {
return this.isValid ? `Duration { values: ${JSON.stringify(this.values)} }` : `Duration { Invalid, reason: ${this.invalidReason} }`;
}
/**
* Returns an milliseconds value of this Duration.
* @return {number}
*/
toMillis() {
return this.isValid ? Yc(this.matrix, this.values) : NaN;
}
/**
* Returns an milliseconds value of this Duration. Alias of {@link toMillis}
* @return {number}
*/
valueOf() {
return this.toMillis();
}
/**
* Make this Duration longer by the specified amount. Return a newly-constructed Duration.
* @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
* @return {Duration}
*/
plus(t) {
if (!this.isValid) return this;
const n = R.fromDurationLike(t), r = {};
for (const i of Ve)
(Tn(n.values, i) || Tn(this.values, i)) && (r[i] = n.get(i) + this.get(i));
return Se(this, { values: r }, !0);
}
/**
* Make this Duration shorter by the specified amount. Return a newly-constructed Duration.
* @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
* @return {Duration}
*/
minus(t) {
if (!this.isValid) return this;
const n = R.fromDurationLike(t);
return this.plus(n.negate());
}
/**
* Scale this Duration by the specified amount. Return a newly-constructed Duration.
* @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 }
* @return {Duration}
*/
mapUnits(t) {
if (!this.isValid) return this;
const n = {};
for (const r of Object.keys(this.values))
n[r] = Nc(t(this.values[r], r));
return Se(this, { values: n }, !0);
}
/**
* Get the value of unit.
* @param {string} unit - a unit such as 'minute' or 'day'
* @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2
* @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0
* @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3
* @return {number}
*/
get(t) {
return this[R.normalizeUnit(t)];
}
/**
* "Set" the values of specified units. Return a newly-constructed Duration.
* @param {Object} values - a mapping of units to numbers
* @example dur.set({ years: 2017 })
* @example dur.set({ hours: 8, minutes: 30 })
* @return {Duration}
*/
set(t) {
if (!this.isValid) return this;
const n = { ...this.values, ...ui(t, R.normalizeUnit) };
return Se(this, { values: n });
}
/**
* "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration.
* @example dur.reconfigure({ locale: 'en-GB' })
* @return {Duration}
*/
reconfigure({ locale: t, numberingSystem: n, conversionAccuracy: r, matrix: i } = {}) {
const a = { loc: this.loc.clone({ locale: t, numberingSystem: n }), matrix: i, conversionAccuracy: r };
return Se(this, a);
}
/**
* Return the length of the duration in the specified unit.
* @param {string} unit - a unit such as 'minutes' or 'days'
* @example Duration.fromObject({years: 1}).as('days') //=> 365
* @example Duration.fromObject({years: 1}).as('months') //=> 12
* @example Duration.fromObject({hours: 60}).as('days') //=> 2.5
* @return {number}
*/
as(t) {
return this.isValid ? this.shiftTo(t).get(t) : NaN;
}
/**
* Reduce this Duration to its canonical representation in its current units.
* Assuming the overall value of the Duration is positive, this means:
* - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)
* - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise
* the overall value would be negative, see third example)
* - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)
*
* If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.
* @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }
* @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }
* @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }
* @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }
* @return {Duration}
*/
normalize() {
if (!this.isValid) return this;
const t = this.toObject();
return sl(this.matrix, t), Se(this, { values: t }, !0);
}
/**
* Rescale units to its largest representation
* @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 }
* @return {Duration}
*/
rescale() {
if (!this.isValid) return this;
const t = Pw(this.normalize().shiftToAll().toObject());
return Se(this, { values: t }, !0);
}
/**
* Convert this Duration into its representation in a different set of units.
* @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }
* @return {Duration}
*/
shiftTo(...t) {
if (!this.isValid) return this;
if (t.length === 0)
return this;
t = t.map((a) => R.normalizeUnit(a));
const n = {}, r = {}, i = this.toObject();
let s;
for (const a of Ve)
if (t.indexOf(a) >= 0) {
s = a;
let o = 0;
for (const u in r)
o += this.matrix[u][a] * r[u], r[u] = 0;
Ce(i[a]) && (o += i[a]);
const l = Math.trunc(o);
n[a] = l, r[a] = (o * 1e3 - l * 1e3) / 1e3;
} else Ce(i[a]) && (r[a] = i[a]);
for (const a in r)
r[a] !== 0 && (n[s] += a === s ? r[a] : r[a] / this.matrix[s][a]);
return sl(this.matrix, n), Se(this, { values: n }, !0);
}
/**
* Shift this Duration to all available units.
* Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds")
* @return {Duration}
*/
shiftToAll() {
return this.isValid ? this.shiftTo(
"years",
"months",
"weeks",
"days",
"hours",
"minutes",
"seconds",
"milliseconds"
) : this;
}
/**
* Return the negative of this Duration.
* @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }
* @return {Duration}
*/
negate() {
if (!this.isValid) return this;
const t = {};
for (const n of Object.keys(this.values))
t[n] = this.values[n] === 0 ? 0 : -this.values[n];
return Se(this, { values: t }, !0);
}
/**
* Get the years.
* @type {number}
*/
get years() {
return this.isValid ? this.values.years || 0 : NaN;
}
/**
* Get the quarters.
* @type {number}
*/
get quarters() {
return this.isValid ? this.values.quarters || 0 : NaN;
}
/**
* Get the months.
* @type {number}
*/
get months() {
return this.isValid ? this.values.months || 0 : NaN;
}
/**
* Get the weeks
* @type {number}
*/
get weeks() {
return this.isValid ? this.values.weeks || 0 : NaN;
}
/**
* Get the days.
* @type {number}
*/
get days() {
return this.isValid ? this.values.days || 0 : NaN;
}
/**
* Get the hours.
* @type {number}
*/
get hours() {
return this.isValid ? this.values.hours || 0 : NaN;
}
/**
* Get the minutes.
* @type {number}
*/
get minutes() {
return this.isValid ? this.values.minutes || 0 : NaN;
}
/**
* Get the seconds.
* @return {number}
*/
get seconds() {
return this.isValid ? this.values.seconds || 0 : NaN;
}
/**
* Get the milliseconds.
* @return {number}
*/
get milliseconds() {
return this.isValid ? this.values.milliseconds || 0 : NaN;
}
/**
* Returns whether the Duration is invalid. Invalid durations are returned by diff operations
* on invalid DateTimes or Intervals.
* @return {boolean}
*/
get isValid() {
return this.invalid === null;
}
/**
* Returns an error code if this Duration became invalid, or null if the Duration is valid
* @return {string}
*/
get invalidReason() {
return this.invalid ? this.invalid.reason : null;
}
/**
* Returns an explanation of why this Duration became invalid, or null if the Duration is valid
* @type {string}
*/
get invalidExplanation() {
return this.invalid ? this.invalid.explanation : null;
}
/**
* Equality check
* Two Durations are equal iff they have the same units and the same values for each unit.
* @param {Duration} other
* @return {boolean}
*/
equals(t) {
if (!this.isValid || !t.isValid || !this.loc.equals(t.loc))
return !1;
function n(r, i) {
return r === void 0 || r === 0 ? i === void 0 || i === 0 : r === i;
}
for (const r of Ve)
if (!n(this.values[r], t.values[r]))
return !1;
return !0;
}
}
const nn = "Invalid Interval";
function Ew(e, t) {
return !e || !e.isValid ? q.invalid("missing or invalid start") : !t || !t.isValid ? q.invalid("missing or invalid end") : t < e ? q.invalid(
"end before start",
`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`
) : null;
}
class q {
/**
* @private
*/
constructor(t) {
this.s = t.start, this.e = t.end, this.invalid = t.invalid || null, this.isLuxonInterval = !0;
}
/**
* Create an invalid Interval.
* @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
* @return {Interval}
*/
static invalid(t, n = null) {
if (!t)
throw new ut("need to specify a reason the Interval is invalid");
const r = t instanceof Yt ? t : new Yt(t, n);
if (B.throwOnInvalid)
throw new nx(r);
return new q({ invalid: r });
}
/**
* Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.
* @param {DateTime|Date|Object} start
* @param {DateTime|Date|Object} end
* @return {Interval}
*/
static fromDateTimes(t, n) {
const r = Rn(t), i = Rn(n), s = Ew(r, i);
return s ?? new q({
start: r,
end: i
});
}
/**
* Create an Interval from a start DateTime and a Duration to extend to.
* @param {DateTime|Date|Object} start
* @param {Duration|Object|number} duration - the length of the Interval.
* @return {Interval}
*/
static after(t, n) {
const r = R.fromDurationLike(n), i = Rn(t);
return q.fromDateTimes(i, i.plus(r));
}
/**
* Create an Interval from an end DateTime and a Duration to extend backwards to.
* @param {DateTime|Date|Object} end
* @param {Duration|Object|number} duration - the length of the Interval.
* @return {Interval}
*/
static before(t, n) {
const r = R.fromDurationLike(n), i = Rn(t);
return q.fromDateTimes(i.minus(r), i);
}
/**
* Create an Interval from an ISO 8601 string.
* Accepts `<start>/<end>`, `<start>/<duration>`, and `<duration>/<end>` formats.
* @param {string} text - the ISO string to parse
* @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
* @return {Interval}
*/
static fromISO(t, n) {
const [r, i] = (t || "").split("/", 2);
if (r && i) {
let s, a;
try {
s = I.fromISO(r, n), a = s.isValid;
} catch {
a = !1;
}
let o, l;
try {
o = I.fromISO(i, n), l = o.isValid;
} catch {
l = !1;
}
if (a && l)
return q.fromDateTimes(s, o);
if (a) {
const u = R.fromISO(i, n);
if (u.isValid)
return q.after(s, u);
} else if (l) {
const u = R.fromISO(r, n);
if (u.isValid)
return q.before(o, u);
}
}
return q.invalid("unparsable", `the input "${t}" can't be parsed as ISO 8601`);
}
/**
* Check if an object is an Interval. Works across context boundaries
* @param {object} o
* @return {boolean}
*/
static isInterval(t) {
return t && t.isLuxonInterval || !1;
}
/**
* Returns the start of the Interval
* @type {DateTime}
*/
get start() {
return this.isValid ? this.s : null;
}
/**
* Returns the end of the Interval
* @type {DateTime}
*/
get end() {
return this.isValid ? this.e : null;
}
/**
* Returns the last DateTime included in the interval (since end is not part of the interval)
* @type {DateTime}
*/
get lastDateTime() {
return this.isValid && this.e ? this.e.minus(1) : null;
}
/**
* Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.
* @type {boolean}
*/
get isValid() {
return this.invalidReason === null;
}
/**
* Returns an error code if this Interval is invalid, or null if the Interval is valid
* @type {string}
*/
get invalidReason() {
return this.invalid ? this.invalid.reason : null;
}
/**
* Returns an explanation of why this Interval became invalid, or null if the Interval is valid
* @type {string}
*/
get invalidExplanation() {
return this.invalid ? this.invalid.explanation : null;
}
/**
* Returns the length of the Interval in the specified unit.
* @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.
* @return {number}
*/
length(t = "milliseconds") {
return this.isValid ? this.toDuration(t).get(t) : NaN;
}
/**
* Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.
* Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
* asks 'what dates are included in this interval?', not 'how many days long is this interval?'
* @param {string} [unit='milliseconds'] - the unit of time to count.
* @param {Object} opts - options
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime
* @return {number}
*/
count(t = "milliseconds", n) {
if (!this.isValid) return NaN;
const r = this.start.startOf(t, n);
let i;
return n != null && n.useLocaleWeeks ? i = this.end.reconfigure({ locale: r.locale }) : i = this.end, i = i.startOf(t, n), Math.floor(i.diff(r, t).get(t)) + (i.valueOf() !== this.end.valueOf());
}
/**
* Returns whether this Interval's start and end are both in the same unit of time
* @param {string} unit - the unit of time to check sameness on
* @return {boolean}
*/
hasSame(t) {
return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, t) : !1;
}
/**
* Return whether this Interval has the same start and end DateTimes.
* @return {boolean}
*/
isEmpty() {
return this.s.valueOf() === this.e.valueOf();
}
/**
* Return whether this Interval's start is after the specified DateTime.
* @param {DateTime} dateTime
* @return {boolean}
*/
isAfter(t) {
return this.isValid ? this.s > t : !1;
}
/**
* Return whether this Interval's end is before the specified DateTime.
* @param {DateTime} dateTime
* @return {boolean}
*/
isBefore(t) {
return this.isValid ? this.e <= t : !1;
}
/**
* Return whether this Interval contains the specified DateTime.
* @param {DateTime} dateTime
* @return {boolean}
*/
contains(t) {
return this.isValid ? this.s <= t && this.e > t : !1;
}
/**
* "Sets" the start and/or end dates. Returns a newly-constructed Interval.
* @param {Object} values - the values to set
* @param {DateTime} values.start - the starting DateTime
* @param {DateTime} values.end - the ending DateTime
* @return {Interval}
*/
set({ start: t, end: n } = {}) {
return this.isValid ? q.fromDateTimes(t || this.s, n || this.e) : this;
}
/**
* Split this Interval at each of the specified DateTimes
* @param {...DateTime} dateTimes - the unit of time to count.
* @return {Array}
*/
splitAt(...t) {
if (!this.isValid) return [];
const n = t.map(Rn).filter((a) => this.contains(a)).sort((a, o) => a.toMillis() - o.toMillis()), r = [];
let { s: i } = this, s = 0;
for (; i < this.e; ) {
const a = n[s] || this.e, o = +a > +this.e ? this.e : a;
r.push(q.fromDateTimes(i, o)), i = o, s += 1;
}
return r;
}
/**
* Split this Interval into smaller Intervals, each of the specified length.
* Left over time is grouped into a smaller interval
* @param {Duration|Object|number} duration - The length of each resulting interval.
* @return {Array}
*/
splitBy(t) {
const n = R.fromDurationLike(t);
if (!this.isValid || !n.isValid || n.as("milliseconds") === 0)
return [];
let { s: r } = this, i = 1, s;
const a = [];
for (; r < this.e; ) {
const o = this.start.plus(n.mapUnits((l) => l * i));
s = +o > +this.e ? this.e : o, a.push(q.fromDateTimes(r, s)), r = s, i += 1;
}
return a;
}
/**
* Split this Interval into the specified number of smaller intervals.
* @param {number} numberOfParts - The number of Intervals to divide the Interval into.
* @return {Array}
*/
divideEqually(t) {
return this.isValid ? this.splitBy(this.length() / t).slice(0, t) : [];
}
/**
* Return whether this Interval overlaps with the specified Interval
* @param {Interval} other
* @return {boolean}
*/
overlaps(t) {
return this.e > t.s && this.s < t.e;
}
/**
* Return whether this Interval's end is adjacent to the specified Interval's start.
* @param {Interval} other
* @return {boolean}
*/
abutsStart(t) {
return this.isValid ? +this.e == +t.s : !1;
}
/**
* Return whether this Interval's start is adjacent to the specified Interval's end.
* @param {Interval} other
* @return {boolean}
*/
abutsEnd(t) {
return this.isValid ? +t.e == +this.s : !1;
}
/**
* Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise.
* @param {Interval} other
* @return {boolean}
*/
engulfs(t) {
return this.isValid ? this.s <= t.s && this.e >= t.e : !1;
}
/**
* Return whether this Interval has the same start and end as the specified Interval.
* @param {Interval} other
* @return {boolean}
*/
equals(t) {
return !this.isValid || !t.isValid ? !1 : this.s.equals(t.s) && this.e.equals(t.e);
}
/**
* Return an Interval representing the intersection of this Interval and the specified Interval.
* Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.
* Returns null if the intersection is empty, meaning, the intervals don't intersect.
* @param {Interval} other
* @return {Interval}
*/
intersection(t) {
if (!this.isValid) return this;
const n = this.s > t.s ? this.s : t.s, r = this.e < t.e ? this.e : t.e;
return n >= r ? null : q.fromDateTimes(n, r);
}
/**
* Return an Interval representing the union of this Interval and the specified Interval.
* Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.
* @param {Interval} other
* @return {Interval}
*/
union(t) {
if (!this.isValid) return this;
const n = this.s < t.s ? this.s : t.s, r = this.e > t.e ? this.e : t.e;
return q.fromDateTimes(n, r);
}
/**
* Merge an array of Intervals into an equivalent minimal set of Intervals.
* Combines overlapping and adjacent Intervals.
* The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval
* and ending with the latest.
*
* @param {Array} intervals
* @return {Array}
*/
static merge(t) {
const [n, r] = t.sort((i, s) => i.s - s.s).reduce(
([i, s], a) => s ? s.overlaps(a) || s.abutsStart(a) ? [i, s.union(a)] : [i.concat([s]), a] : [i, a],
[[], null]
);
return r && n.push(r), n;
}
/**
* Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.
* @param {Array} intervals
* @return {Array}
*/
static xor(t) {
let n = null, r = 0;
const i = [], s = t.map((l) => [
{ time: l.s, type: "s" },
{ time: l.e, type: "e" }
]), a = Array.prototype.concat(...s), o = a.sort((l, u) => l.time - u.time);
for (const l of o)
r += l.type === "s" ? 1 : -1, r === 1 ? n = l.time : (n && +n != +l.time && i.push(q.fromDateTimes(n, l.time)), n = null);
return q.merge(i);
}
/**
* Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.
* @param {...Interval} intervals
* @return {Array}
*/
difference(...t) {
return q.xor([this].concat(t)).map((n) => this.intersection(n)).filter((n) => n && !n.isEmpty());
}
/**
* Returns a string representation of this Interval appropriate for debugging.
* @return {string}
*/
toString() {
return this.isValid ? `[${this.s.toISO()} – ${this.e.toISO()})` : nn;
}
/**
* Returns a string representation of this Interval appropriate for the REPL.
* @return {string}
*/
[Symbol.for("nodejs.util.inspect.custom")]() {
return this.isValid ? `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }` : `Interval { Invalid, reason: ${this.invalidReason} }`;
}
/**
* Returns a localized string representing this Interval. Accepts the same options as the
* Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
* {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method
* is browser-specific, but in general it will return an appropriate representation of the
* Interval in the assigned locale. Defaults to the system's locale if no locale has been
* specified.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or
* Intl.DateTimeFormat constructor options.
* @param {Object} opts - Options to override the configuration of the start DateTime.
* @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022
* @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022
* @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022
* @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM
* @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p
* @return {string}
*/
toLocaleString(t = ai, n = {}) {
return this.isValid ? ct.create(this.s.loc.clone(n), t).formatInterval(this) : nn;
}
/**
* Returns an ISO 8601-compliant string representation of this Interval.
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
* @param {Object} opts - The same options as {@link DateTime#toISO}
* @return {string}
*/
toISO(t) {
return this.isValid ? `${this.s.toISO(t)}/${this.e.toISO(t)}` : nn;
}
/**
* Returns an ISO 8601-compliant string representation of date of this Interval.
* The time components are ignored.
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
* @return {string}
*/
toISODate() {
return this.isValid ? `${this.s.toISODate()}/${this.e.toISODate()}` : nn;
}
/**
* Returns an ISO 8601-compliant string representation of time of this Interval.
* The date components are ignored.
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
* @param {Object} opts - The same options as {@link DateTime#toISO}
* @return {string}
*/
toISOTime(t) {
return this.isValid ? `${this.s.toISOTime(t)}/${this.e.toISOTime(t)}` : nn;
}
/**
* Returns a string representation of this Interval formatted according to the specified format
* string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible
* formatting tool.
* @param {string} dateFormat - The format string. This string formats the start and end time.
* See {@link DateTime#toFormat} for details.
* @param {Object} opts - Options.
* @param {string} [opts.separator = ' – '] - A separator to place between the start and end
* representations.
* @return {string}
*/
toFormat(t, { separator: n = " – " } = {}) {
return this.isValid ? `${this.s.toFormat(t)}${n}${this.e.toFormat(t)}` : nn;
}
/**
* Return a Duration representing the time spanned by this interval.
* @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.
* @param {Object} opts - options that affect the creation of the Duration
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
* @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }
* @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }
* @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }
* @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }
* @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }
* @return {Duration}
*/
toDuration(t, n) {
return this.isValid ? this.e.diff(this.s, t, n) : R.invalid(this.invalidReason);
}
/**
* Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes
* @param {function} mapFn
* @return {Interval}
* @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())
* @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))
*/
mapEndpoints(t) {
return q.fromDateTimes(t(this.s), t(this.e));
}
}
class _r {
/**
* Return whether the specified zone contains a DST.
* @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.
* @return {boolean}
*/
static hasDST(t = B.defaultZone) {
const n = I.now().setZone(t).set({ month: 12 });
return !t.isUniversal && n.offset !== n.set({ month: 6 }).offset;
}
/**
* Return whether the specified zone is a valid IANA specifier.
* @param {string} zone - Zone to check
* @return {boolean}
*/
static isValidIANAZone(t) {
return ge.isValidZone(t);
}
/**
* Converts the input into a {@link Zone} instance.
*
* * If `input` is already a Zone instance, it is returned unchanged.
* * If `input` is a string containing a valid time zone name, a Zone instance
* with that name is returned.
* * If `input` is a string that doesn't refer to a known time zone, a Zone
* instance with {@link Zone#isValid} == false is returned.
* * If `input is a number, a Zone instance with the specified fixed offset
* in minutes is returned.
* * If `input` is `null` or `undefined`, the default zone is returned.
* @param {string|Zone|number} [input] - the value to be converted
* @return {Zone}
*/
static normalizeZone(t) {
return Me(t, B.defaultZone);
}
/**
* Get the weekday on which the week starts according to the given locale.
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.locObj=null] - an existing locale object to use
* @returns {number} the start of the week, 1 for Monday through 7 for Sunday
*/
static getStartOfWeek({ locale: t = null, locObj: n = null } = {}) {
return (n || H.create(t)).getStartOfWeek();
}
/**
* Get the minimum number of days necessary in a week before it is considered part of the next year according
* to the given locale.
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.locObj=null] - an existing locale object to use
* @returns {number}
*/
static getMinimumDaysInFirstWeek({ locale: t = null, locObj: n = null } = {}) {
return (n || H.create(t)).getMinDaysInFirstWeek();
}
/**
* Get the weekdays, which are considered the weekend according to the given locale
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.locObj=null] - an existing locale object to use
* @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
*/
static getWeekendWeekdays({ locale: t = null, locObj: n = null } = {}) {
return (n || H.create(t)).getWeekendDays().slice();
}
/**
* Return an array of standalone month names.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @param {string} [opts.outputCalendar='gregory'] - the calendar
* @example Info.months()[0] //=> 'January'
* @example Info.months('short')[0] //=> 'Jan'
* @example Info.months('numeric')[0] //=> '1'
* @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'
* @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'
* @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
* @return {Array}
*/
static months(t = "long", { locale: n = null, numberingSystem: r = null, locObj: i = null, outputCalendar: s = "gregory" } = {}) {
return (i || H.create(n, r, s)).months(t);
}
/**
* Return an array of format month names.
* Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that
* changes the string.
* See {@link Info#months}
* @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @param {string} [opts.outputCalendar='gregory'] - the calendar
* @return {Array}
*/
static monthsFormat(t = "long", { locale: n = null, numberingSystem: r = null, locObj: i = null, outputCalendar: s = "gregory" } = {}) {
return (i || H.create(n, r, s)).months(t, !0);
}
/**
* Return an array of standalone week names.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long".
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @example Info.weekdays()[0] //=> 'Monday'
* @example Info.weekdays('short')[0] //=> 'Mon'
* @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'
* @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
* @return {Array}
*/
static weekdays(t = "long", { locale: n = null, numberingSystem: r = null, locObj: i = null } = {}) {
return (i || H.create(n, r, null)).weekdays(t);
}
/**
* Return an array of format week names.
* Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that
* changes the string.
* See {@link Info#weekdays}
* @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long".
* @param {Object} opts - options
* @param {string} [opts.locale=null] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @return {Array}
*/
static weekdaysFormat(t = "long", { locale: n = null, numberingSystem: r = null, locObj: i = null } = {}) {
return (i || H.create(n, r, null)).weekdays(t, !0);
}
/**
* Return an array of meridiems.
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @example Info.meridiems() //=> [ 'AM', 'PM' ]
* @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
* @return {Array}
*/
static meridiems({ locale: t = null } = {}) {
return H.create(t).meridiems();
}
/**
* Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.
* @param {string} [length='short'] - the length of the era representation, such as "short" or "long".
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @example Info.eras() //=> [ 'BC', 'AD' ]
* @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]
* @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
* @return {Array}
*/
static eras(t = "short", { locale: n = null } = {}) {
return H.create(n, null, "gregory").eras(t);
}
/**
* Return the set of available features in this environment.
* Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.
* Keys:
* * `relative`: whether this environment supports relative time formatting
* * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale
* @example Info.features() //=> { relative: false, localeWeek: true }
* @return {Object}
*/
static features() {
return { relative: Cc(), localeWeek: Ic() };
}
}
function al(e, t) {
const n = (i) => i.toUTC(0, { keepLocalTime: !0 }).startOf("day").valueOf(), r = n(t) - n(e);
return Math.floor(R.fromMillis(r).as("days"));
}
function Dw(e, t, n) {
const r = [
["years", (l, u) => u.year - l.year],
["quarters", (l, u) => u.quarter - l.quarter + (u.year - l.year) * 4],
["months", (l, u) => u.month - l.month + (u.year - l.year) * 12],
[
"weeks",
(l, u) => {
const c = al(l, u);
return (c - c % 7) / 7;
}
],
["days", al]
], i = {}, s = e;
let a, o;
for (const [l, u] of r)
n.indexOf(l) >= 0 && (a = l, i[l] = u(e, t), o = s.plus(i), o > t ? (i[l]--, e = s.plus(i), e > t && (o = e, i[l]--, e = s.plus(i))) : e = o);
return [e, i, o, a];
}
function $w(e, t, n, r) {
let [i, s, a, o] = Dw(e, t, n);
const l = t - i, u = n.filter(
(h) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(h) >= 0
);
u.length === 0 && (a < t && (a = i.plus({ [o]: 1 })), a !== i && (s[o] = (s[o] || 0) + l / (a - i)));
const c = R.fromObject(s, r);
return u.length > 0 ? R.fromMillis(l, r).shiftTo(...u).plus(c) : c;
}
const Fw = "missing Intl.DateTimeFormat.formatToParts support";
function U(e, t = (n) => n) {
return { regex: e, deser: ([n]) => t(Mx(n)) };
}
const Lw = " ", Kc = `[ ${Lw}]`, Gc = new RegExp(Kc, "g");
function Rw(e) {
return e.replace(/\./g, "\\.?").replace(Gc, Kc);
}
function ol(e) {
return e.replace(/\./g, "").replace(Gc, " ").toLowerCase();
}
function Ht(e, t) {
return e === null ? null : {
regex: RegExp(e.map(Rw).join("|")),
deser: ([n]) => e.findIndex((r) => ol(n) === ol(r)) + t
};
}
function ll(e, t) {
return { regex: e, deser: ([, n, r]) => Li(n, r), groups: t };
}
function Mr(e) {
return { regex: e, deser: ([t]) => t };
}
function Vw(e) {
return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
}
function Uw(e, t) {
const n = Wt(t), r = Wt(t, "{2}"), i = Wt(t, "{3}"), s = Wt(t, "{4}"), a = Wt(t, "{6}"), o = Wt(t, "{1,2}"), l = Wt(t, "{1,3}"), u = Wt(t, "{1,6}"), c = Wt(t, "{1,9}"), h = Wt(t, "{2,4}"), f = Wt(t, "{4,6}"), d = (m) => ({ regex: RegExp(Vw(m.val)), deser: ([y]) => y, literal: !0 }), g = ((m) => {
if (e.literal)
return d(m);
switch (m.val) {
// era
case "G":
return Ht(t.eras("short"), 0);
case "GG":
return Ht(t.eras("long"), 0);
// years
case "y":
return U(u);
case "yy":
return U(h, Hs);
case "yyyy":
return U(s);
case "yyyyy":
return U(f);
case "yyyyyy":
return U(a);
// months
case "M":
return U(o);
case "MM":
return U(r);
case "MMM":
return Ht(t.months("short", !0), 1);
case "MMMM":
return Ht(t.months("long", !0), 1);
case "L":
return U(o);
case "LL":
return U(r);
case "LLL":
return Ht(t.months("short", !1), 1);
case "LLLL":
return Ht(t.months("long", !1), 1);
// dates
case "d":
return U(o);
case "dd":
return U(r);
// ordinals
case "o":
return U(l);
case "ooo":
return U(i);
// time
case "HH":
return U(r);
case "H":
return U(o);
case "hh":
return U(r);
case "h":
return U(o);
case "mm":
return U(r);
case "m":
return U(o);
case "q":
return U(o);
case "qq":
return U(r);
case "s":
return U(o);
case "ss":
return U(r);
case "S":
return U(l);
case "SSS":
return U(i);
case "u":
return Mr(c);
case "uu":
return Mr(o);
case "uuu":
return U(n);
// meridiem
case "a":
return Ht(t.meridiems(), 0);
// weekYear (k)
case "kkkk":
return U(s);
case "kk":
return U(h, Hs);
// weekNumber (W)
case "W":
return U(o);
case "WW":
return U(r);
// weekdays
case "E":
case "c":
return U(n);
case "EEE":
return Ht(t.weekdays("short", !1), 1);
case "EEEE":
return Ht(t.weekdays("long", !1), 1);
case "ccc":
return Ht(t.weekdays("short", !0), 1);
case "cccc":
return Ht(t.weekdays("long", !0), 1);
// offset/zone
case "Z":
case "ZZ":
return ll(new RegExp(`([+-]${o.source})(?::(${r.source}))?`), 2);
case "ZZZ":
return ll(new RegExp(`([+-]${o.source})(${r.source})?`), 2);
// we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing
// because we don't have any way to figure out what they are
case "z":
return Mr(/[a-z_+-/]{1,256}?/i);
// this special-case "token" represents a place where a macro-token expanded into a white-space literal
// in this case we accept any non-newline white-space
case " ":
return Mr(/[^\S\n\r]/);
default:
return d(m);
}
})(e) || {
invalidReason: Fw
};
return g.token = e, g;
}
const Ww = {
year: {
"2-digit": "yy",
numeric: "yyyyy"
},
month: {
numeric: "M",
"2-digit": "MM",
short: "MMM",
long: "MMMM"
},
day: {
numeric: "d",
"2-digit": "dd"
},
weekday: {
short: "EEE",
long: "EEEE"
},
dayperiod: "a",
dayPeriod: "a",
hour12: {
numeric: "h",
"2-digit": "hh"
},
hour24: {
numeric: "H",
"2-digit": "HH"
},
minute: {
numeric: "m",
"2-digit": "mm"
},
second: {
numeric: "s",
"2-digit": "ss"
},
timeZoneName: {
long: "ZZZZZ",
short: "ZZZ"
}
};
function Hw(e, t, n) {
const { type: r, value: i } = e;
if (r === "literal") {
const l = /^\s+$/.test(i);
return {
literal: !l,
val: l ? " " : i
};
}
const s = t[r];
let a = r;
r === "hour" && (t.hour12 != null ? a = t.hour12 ? "hour12" : "hour24" : t.hourCycle != null ? t.hourCycle === "h11" || t.hourCycle === "h12" ? a = "hour12" : a = "hour24" : a = n.hour12 ? "hour12" : "hour24");
let o = Ww[a];
if (typeof o == "object" && (o = o[s]), o)
return {
literal: !1,
val: o
};
}
function jw(e) {
return [`^${e.map((n) => n.regex).reduce((n, r) => `${n}(${r.source})`, "")}$`, e];
}
function zw(e, t, n) {
const r = e.match(t);
if (r) {
const i = {};
let s = 1;
for (const a in n)
if (Tn(n, a)) {
const o = n[a], l = o.groups ? o.groups + 1 : 1;
!o.literal && o.token && (i[o.token.val[0]] = o.deser(r.slice(s, s + l))), s += l;
}
return [r, i];
} else
return [r, {}];
}
function Zw(e) {
const t = (s) => {
switch (s) {
case "S":
return "millisecond";
case "s":
return "second";
case "m":
return "minute";
case "h":
case "H":
return "hour";
case "d":
return "day";
case "o":
return "ordinal";
case "L":
case "M":
return "month";
case "y":
return "year";
case "E":
case "c":
return "weekday";
case "W":
return "weekNumber";
case "k":
return "weekYear";
case "q":
return "quarter";
default:
return null;
}
};
let n = null, r;
return P(e.z) || (n = ge.create(e.z)), P(e.Z) || (n || (n = new pt(e.Z)), r = e.Z), P(e.q) || (e.M = (e.q - 1) * 3 + 1), P(e.h) || (e.h < 12 && e.a === 1 ? e.h += 12 : e.h === 12 && e.a === 0 && (e.h = 0)), e.G === 0 && e.y && (e.y = -e.y), P(e.u) || (e.S = va(e.u)), [Object.keys(e).reduce((s, a) => {
const o = t(a);
return o && (s[o] = e[a]), s;
}, {}), n, r];
}
let rs = null;
function Yw() {
return rs || (rs = I.fromMillis(1555555555555)), rs;
}
function Kw(e, t) {
if (e.literal)
return e;
const n = ct.macroTokenToFormatOpts(e.val), r = Jc(n, t);
return r == null || r.includes(void 0) ? e : r;
}
function qc(e, t) {
return Array.prototype.concat(...e.map((n) => Kw(n, t)));
}
class Bc {
constructor(t, n) {
if (this.locale = t, this.format = n, this.tokens = qc(ct.parseFormat(n), t), this.units = this.tokens.map((r) => Uw(r, t)), this.disqualifyingUnit = this.units.find((r) => r.invalidReason), !this.disqualifyingUnit) {
const [r, i] = jw(this.units);
this.regex = RegExp(r, "i"), this.handlers = i;
}
}
explainFromTokens(t) {
if (this.isValid) {
const [n, r] = zw(t, this.regex, this.handlers), [i, s, a] = r ? Zw(r) : [null, null, void 0];
if (Tn(r, "a") && Tn(r, "H"))
throw new an(
"Can't include meridiem when specifying 24-hour format"
);
return {
input: t,
tokens: this.tokens,
regex: this.regex,
rawMatches: n,
matches: r,
result: i,
zone: s,
specificOffset: a
};
} else
return { input: t, tokens: this.tokens, invalidReason: this.invalidReason };
}
get isValid() {
return !this.disqualifyingUnit;
}
get invalidReason() {
return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;
}
}
function Xc(e, t, n) {
return new Bc(e, n).explainFromTokens(t);
}
function Gw(e, t, n) {
const { result: r, zone: i, specificOffset: s, invalidReason: a } = Xc(e, t, n);
return [r, i, s, a];
}
function Jc(e, t) {
if (!e)
return null;
const r = ct.create(t, e).dtFormatter(Yw()), i = r.formatToParts(), s = r.resolvedOptions();
return i.map((a) => Hw(a, e, s));
}
const is = "Invalid DateTime", ul = 864e13;
function zn(e) {
return new Yt("unsupported zone", `the zone "${e.name}" is not supported`);
}
function ss(e) {
return e.weekData === null && (e.weekData = oi(e.c)), e.weekData;
}
function as(e) {
return e.localWeekData === null && (e.localWeekData = oi(
e.c,
e.loc.getMinDaysInFirstWeek(),
e.loc.getStartOfWeek()
)), e.localWeekData;
}
function De(e, t) {
const n = {
ts: e.ts,
zone: e.zone,
c: e.c,
o: e.o,
loc: e.loc,
invalid: e.invalid
};
return new I({ ...n, ...t, old: n });
}
function Qc(e, t, n) {
let r = e - t * 60 * 1e3;
const i = n.offset(r);
if (t === i)
return [r, t];
r -= (i - t) * 60 * 1e3;
const s = n.offset(r);
return i === s ? [r, i] : [e - Math.min(i, s) * 60 * 1e3, Math.max(i, s)];
}
function kr(e, t) {
e += t * 60 * 1e3;
const n = new Date(e);
return {
year: n.getUTCFullYear(),
month: n.getUTCMonth() + 1,
day: n.getUTCDate(),
hour: n.getUTCHours(),
minute: n.getUTCMinutes(),
second: n.getUTCSeconds(),
millisecond: n.getUTCMilliseconds()
};
}
function Ur(e, t, n) {
return Qc(Fi(e), t, n);
}
function cl(e, t) {
const n = e.o, r = e.c.year + Math.trunc(t.years), i = e.c.month + Math.trunc(t.months) + Math.trunc(t.quarters) * 3, s = {
...e.c,
year: r,
month: i,
day: Math.min(e.c.day, li(r, i)) + Math.trunc(t.days) + Math.trunc(t.weeks) * 7
}, a = R.fromObject({
years: t.years - Math.trunc(t.years),
quarters: t.quarters - Math.trunc(t.quarters),
months: t.months - Math.trunc(t.months),
weeks: t.weeks - Math.trunc(t.weeks),
days: t.days - Math.trunc(t.days),
hours: t.hours,
minutes: t.minutes,
seconds: t.seconds,
milliseconds: t.milliseconds
}).as("milliseconds"), o = Fi(s);
let [l, u] = Qc(o, n, e.zone);
return a !== 0 && (l += a, u = e.zone.offset(l)), { ts: l, o: u };
}
function rn(e, t, n, r, i, s) {
const { setZone: a, zone: o } = n;
if (e && Object.keys(e).length !== 0 || t) {
const l = t || o, u = I.fromObject(e, {
...n,
zone: l,
specificOffset: s
});
return a ? u : u.setZone(o);
} else
return I.invalid(
new Yt("unparsable", `the input "${i}" can't be parsed as ${r}`)
);
}
function Or(e, t, n = !0) {
return e.isValid ? ct.create(H.create("en-US"), {
allowZ: n,
forceSimple: !0
}).formatDateTimeFromString(e, t) : null;
}
function os(e, t) {
const n = e.c.year > 9999 || e.c.year < 0;
let r = "";
return n && e.c.year >= 0 && (r += "+"), r += X(e.c.year, n ? 6 : 4), t ? (r += "-", r += X(e.c.month), r += "-", r += X(e.c.day)) : (r += X(e.c.month), r += X(e.c.day)), r;
}
function hl(e, t, n, r, i, s) {
let a = X(e.c.hour);
return t ? (a += ":", a += X(e.c.minute), (e.c.millisecond !== 0 || e.c.second !== 0 || !n) && (a += ":")) : a += X(e.c.minute), (e.c.millisecond !== 0 || e.c.second !== 0 || !n) && (a += X(e.c.second), (e.c.millisecond !== 0 || !r) && (a += ".", a += X(e.c.millisecond, 3))), i && (e.isOffsetFixed && e.offset === 0 && !s ? a += "Z" : e.o < 0 ? (a += "-", a += X(Math.trunc(-e.o / 60)), a += ":", a += X(Math.trunc(-e.o % 60))) : (a += "+", a += X(Math.trunc(e.o / 60)), a += ":", a += X(Math.trunc(e.o % 60)))), s && (a += "[" + e.zone.ianaName + "]"), a;
}
const th = {
month: 1,
day: 1,
hour: 0,
minute: 0,
second: 0,
millisecond: 0
}, qw = {
weekNumber: 1,
weekday: 1,
hour: 0,
minute: 0,
second: 0,
millisecond: 0
}, Bw = {
ordinal: 1,
hour: 0,
minute: 0,
second: 0,
millisecond: 0
}, eh = ["year", "month", "day", "hour", "minute", "second", "millisecond"], Xw = [
"weekYear",
"weekNumber",
"weekday",
"hour",
"minute",
"second",
"millisecond"
], Jw = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
function Qw(e) {
const t = {
year: "year",
years: "year",
month: "month",
months: "month",
day: "day",
days: "day",
hour: "hour",
hours: "hour",
minute: "minute",
minutes: "minute",
quarter: "quarter",
quarters: "quarter",
second: "second",
seconds: "second",
millisecond: "millisecond",
milliseconds: "millisecond",
weekday: "weekday",
weekdays: "weekday",
weeknumber: "weekNumber",
weeksnumber: "weekNumber",
weeknumbers: "weekNumber",
weekyear: "weekYear",
weekyears: "weekYear",
ordinal: "ordinal"
}[e.toLowerCase()];
if (!t) throw new tc(e);
return t;
}
function fl(e) {
switch (e.toLowerCase()) {
case "localweekday":
case "localweekdays":
return "localWeekday";
case "localweeknumber":
case "localweeknumbers":
return "localWeekNumber";
case "localweekyear":
case "localweekyears":
return "localWeekYear";
default:
return Qw(e);
}
}
function t1(e) {
if (Zn === void 0 && (Zn = B.now()), e.type !== "iana")
return e.offset(Zn);
const t = e.name;
let n = js.get(t);
return n === void 0 && (n = e.offset(Zn), js.set(t, n)), n;
}
function dl(e, t) {
const n = Me(t.zone, B.defaultZone);
if (!n.isValid)
return I.invalid(zn(n));
const r = H.fromObject(t);
let i, s;
if (P(e.year))
i = B.now();
else {
for (const l of eh)
P(e[l]) && (e[l] = th[l]);
const a = kc(e) || Oc(e);
if (a)
return I.invalid(a);
const o = t1(n);
[i, s] = Ur(e, o, n);
}
return new I({ ts: i, zone: n, loc: r, o: s });
}
function pl(e, t, n) {
const r = P(n.round) ? !0 : n.round, i = (a, o) => (a = ba(a, r || n.calendary ? 0 : 2, !0), t.loc.clone(n).relFormatter(n).format(a, o)), s = (a) => n.calendary ? t.hasSame(e, a) ? 0 : t.startOf(a).diff(e.startOf(a), a).get(a) : t.diff(e, a).get(a);
if (n.unit)
return i(s(n.unit), n.unit);
for (const a of n.units) {
const o = s(a);
if (Math.abs(o) >= 1)
return i(o, a);
}
return i(e > t ? -0 : 0, n.units[n.units.length - 1]);
}
function ml(e) {
let t = {}, n;
return e.length > 0 && typeof e[e.length - 1] == "object" ? (t = e[e.length - 1], n = Array.from(e).slice(0, e.length - 1)) : n = Array.from(e), [t, n];
}
let Zn;
const js = /* @__PURE__ */ new Map();
class I {
/**
* @access private
*/
constructor(t) {
const n = t.zone || B.defaultZone;
let r = t.invalid || (Number.isNaN(t.ts) ? new Yt("invalid input") : null) || (n.isValid ? null : zn(n));
this.ts = P(t.ts) ? B.now() : t.ts;
let i = null, s = null;
if (!r)
if (t.old && t.old.ts === this.ts && t.old.zone.equals(n))
[i, s] = [t.old.c, t.old.o];
else {
const o = Ce(t.o) && !t.old ? t.o : n.offset(this.ts);
i = kr(this.ts, o), r = Number.isNaN(i.year) ? new Yt("invalid input") : null, i = r ? null : i, s = r ? null : o;
}
this._zone = n, this.loc = t.loc || H.create(), this.invalid = r, this.weekData = null, this.localWeekData = null, this.c = i, this.o = s, this.isLuxonDateTime = !0;
}
// CONSTRUCT
/**
* Create a DateTime for the current instant, in the system's time zone.
*
* Use Settings to override these default values if needed.
* @example DateTime.now().toISO() //~> now in the ISO format
* @return {DateTime}
*/
static now() {
return new I({});
}
/**
* Create a local DateTime
* @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used
* @param {number} [month=1] - The month, 1-indexed
* @param {number} [day=1] - The day of the month, 1-indexed
* @param {number} [hour=0] - The hour of the day, in 24-hour time
* @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59
* @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59
* @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999
* @example DateTime.local() //~> now
* @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time
* @example DateTime.local(2017) //~> 2017-01-01T00:00:00
* @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00
* @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale
* @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00
* @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC
* @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00
* @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10
* @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765
* @return {DateTime}
*/
static local() {
const [t, n] = ml(arguments), [r, i, s, a, o, l, u] = n;
return dl({ year: r, month: i, day: s, hour: a, minute: o, second: l, millisecond: u }, t);
}
/**
* Create a DateTime in UTC
* @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used
* @param {number} [month=1] - The month, 1-indexed
* @param {number} [day=1] - The day of the month
* @param {number} [hour=0] - The hour of the day, in 24-hour time
* @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59
* @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59
* @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999
* @param {Object} options - configuration options for the DateTime
* @param {string} [options.locale] - a locale to set on the resulting DateTime instance
* @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance
* @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance
* @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance
* @example DateTime.utc() //~> now
* @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z
* @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z
* @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z
* @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z
* @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z
* @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale
* @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z
* @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale
* @return {DateTime}
*/
static utc() {
const [t, n] = ml(arguments), [r, i, s, a, o, l, u] = n;
return t.zone = pt.utcInstance, dl({ year: r, month: i, day: s, hour: a, minute: o, second: l, millisecond: u }, t);
}
/**
* Create a DateTime from a JavaScript Date object. Uses the default zone.
* @param {Date} date - a JavaScript Date object
* @param {Object} options - configuration options for the DateTime
* @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
* @return {DateTime}
*/
static fromJSDate(t, n = {}) {
const r = Ax(t) ? t.valueOf() : NaN;
if (Number.isNaN(r))
return I.invalid("invalid input");
const i = Me(n.zone, B.defaultZone);
return i.isValid ? new I({
ts: r,
zone: i,
loc: H.fromObject(n)
}) : I.invalid(zn(i));
}
/**
* Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
* @param {number} milliseconds - a number of milliseconds since 1970 UTC
* @param {Object} options - configuration options for the DateTime
* @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
* @param {string} [options.locale] - a locale to set on the resulting DateTime instance
* @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance
* @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance
* @return {DateTime}
*/
static fromMillis(t, n = {}) {
if (Ce(t))
return t < -ul || t > ul ? I.invalid("Timestamp out of range") : new I({
ts: t,
zone: Me(n.zone, B.defaultZone),
loc: H.fromObject(n)
});
throw new ut(
`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`
);
}
/**
* Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
* @param {number} seconds - a number of seconds since 1970 UTC
* @param {Object} options - configuration options for the DateTime
* @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
* @param {string} [options.locale] - a locale to set on the resulting DateTime instance
* @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance
* @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance
* @return {DateTime}
*/
static fromSeconds(t, n = {}) {
if (Ce(t))
return new I({
ts: t * 1e3,
zone: Me(n.zone, B.defaultZone),
loc: H.fromObject(n)
});
throw new ut("fromSeconds requires a numerical input");
}
/**
* Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.
* @param {Object} obj - the object to create the DateTime from
* @param {number} obj.year - a year, such as 1987
* @param {number} obj.month - a month, 1-12
* @param {number} obj.day - a day of the month, 1-31, depending on the month
* @param {number} obj.ordinal - day of the year, 1-365 or 366
* @param {number} obj.weekYear - an ISO week year
* @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
* @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
* @param {number} obj.localWeekYear - a week year, according to the locale
* @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale
* @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale
* @param {number} obj.hour - hour of the day, 0-23
* @param {number} obj.minute - minute of the hour, 0-59
* @param {number} obj.second - second of the minute, 0-59
* @param {number} obj.millisecond - millisecond of the second, 0-999
* @param {Object} opts - options for creating this DateTime
* @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()
* @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
* @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance
* @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
* @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })
* @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
* @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26'
* @return {DateTime}
*/
static fromObject(t, n = {}) {
t = t || {};
const r = Me(n.zone, B.defaultZone);
if (!r.isValid)
return I.invalid(zn(r));
const i = H.fromObject(n), s = ui(t, fl), { minDaysInFirstWeek: a, startOfWeek: o } = Qo(s, i), l = B.now(), u = P(n.specificOffset) ? r.offset(l) : n.specificOffset, c = !P(s.ordinal), h = !P(s.year), f = !P(s.month) || !P(s.day), d = h || f, p = s.weekYear || s.weekNumber;
if ((d || c) && p)
throw new an(
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
);
if (f && c)
throw new an("Can't mix ordinal dates with month/day");
const g = p || s.weekday && !d;
let m, y, x = kr(l, u);
g ? (m = Xw, y = qw, x = oi(x, a, o)) : c ? (m = Jw, y = Bw, x = ns(x)) : (m = eh, y = th);
let b = !1;
for (const N of m) {
const k = s[N];
P(k) ? b ? s[N] = y[N] : s[N] = x[N] : b = !0;
}
const v = g ? Ox(s, a, o) : c ? Cx(s) : kc(s), w = v || Oc(s);
if (w)
return I.invalid(w);
const S = g ? Xo(s, a, o) : c ? Jo(s) : s, [_, A] = Ur(S, u, r), F = new I({
ts: _,
zone: r,
o: A,
loc: i
});
return s.weekday && d && t.weekday !== F.weekday ? I.invalid(
"mismatched weekday",
`you can't specify both a weekday of ${s.weekday} and a date of ${F.toISO()}`
) : F.isValid ? F : I.invalid(F.invalid);
}
/**
* Create a DateTime from an ISO 8601 string
* @param {string} text - the ISO string
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone
* @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
* @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance
* @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance
* @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance
* @example DateTime.fromISO('2016-05-25T09:08:34.123')
* @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')
* @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})
* @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})
* @example DateTime.fromISO('2016-W05-4')
* @return {DateTime}
*/
static fromISO(t, n = {}) {
const [r, i] = bw(t);
return rn(r, i, n, "ISO 8601", t);
}
/**
* Create a DateTime from an RFC 2822 string
* @param {string} text - the RFC 2822 string
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.
* @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
* @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance
* @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')
* @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')
* @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')
* @return {DateTime}
*/
static fromRFC2822(t, n = {}) {
const [r, i] = xw(t);
return rn(r, i, n, "RFC 2822", t);
}
/**
* Create a DateTime from an HTTP header date
* @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
* @param {string} text - the HTTP header date
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.
* @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
* @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance
* @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')
* @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')
* @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')
* @return {DateTime}
*/
static fromHTTP(t, n = {}) {
const [r, i] = ww(t);
return rn(r, i, n, "HTTP", n);
}
/**
* Create a DateTime from an input string and format string.
* Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens).
* @param {string} text - the string to parse
* @param {string} fmt - the format the string is expected to be in (see the link below for the formats)
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone
* @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale
* @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system
* @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @return {DateTime}
*/
static fromFormat(t, n, r = {}) {
if (P(t) || P(n))
throw new ut("fromFormat requires an input string and a format");
const { locale: i = null, numberingSystem: s = null } = r, a = H.fromOpts({
locale: i,
numberingSystem: s,
defaultToEN: !0
}), [o, l, u, c] = Gw(a, t, n);
return c ? I.invalid(c) : rn(o, l, r, `format ${n}`, t, u);
}
/**
* @deprecated use fromFormat instead
*/
static fromString(t, n, r = {}) {
return I.fromFormat(t, n, r);
}
/**
* Create a DateTime from a SQL date, time, or datetime
* Defaults to en-US if no locale has been specified, regardless of the system's locale
* @param {string} text - the string to parse
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone
* @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale
* @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system
* @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @example DateTime.fromSQL('2017-05-15')
* @example DateTime.fromSQL('2017-05-15 09:12:34')
* @example DateTime.fromSQL('2017-05-15 09:12:34.342')
* @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')
* @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')
* @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })
* @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })
* @example DateTime.fromSQL('09:12:34.342')
* @return {DateTime}
*/
static fromSQL(t, n = {}) {
const [r, i] = Cw(t);
return rn(r, i, n, "SQL", t);
}
/**
* Create an invalid DateTime.
* @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
* @return {DateTime}
*/
static invalid(t, n = null) {
if (!t)
throw new ut("need to specify a reason the DateTime is invalid");
const r = t instanceof Yt ? t : new Yt(t, n);
if (B.throwOnInvalid)
throw new ex(r);
return new I({ invalid: r });
}
/**
* Check if an object is an instance of DateTime. Works across context boundaries
* @param {object} o
* @return {boolean}
*/
static isDateTime(t) {
return t && t.isLuxonDateTime || !1;
}
/**
* Produce the format string for a set of options
* @param formatOpts
* @param localeOpts
* @returns {string}
*/
static parseFormatForOpts(t, n = {}) {
const r = Jc(t, H.fromObject(n));
return r ? r.map((i) => i ? i.val : null).join("") : null;
}
/**
* Produce the the fully expanded format token for the locale
* Does NOT quote characters, so quoted tokens will not round trip correctly
* @param fmt
* @param localeOpts
* @returns {string}
*/
static expandFormat(t, n = {}) {
return qc(ct.parseFormat(t), H.fromObject(n)).map((i) => i.val).join("");
}
static resetCache() {
Zn = void 0, js.clear();
}
// INFO
/**
* Get the value of unit.
* @param {string} unit - a unit such as 'minute' or 'day'
* @example DateTime.local(2017, 7, 4).get('month'); //=> 7
* @example DateTime.local(2017, 7, 4).get('day'); //=> 4
* @return {number}
*/
get(t) {
return this[t];
}
/**
* Returns whether the DateTime is valid. Invalid DateTimes occur when:
* * The DateTime was created from invalid calendar information, such as the 13th month or February 30
* * The DateTime was created by an operation on another invalid date
* @type {boolean}
*/
get isValid() {
return this.invalid === null;
}
/**
* Returns an error code if this DateTime is invalid, or null if the DateTime is valid
* @type {string}
*/
get invalidReason() {
return this.invalid ? this.invalid.reason : null;
}
/**
* Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid
* @type {string}
*/
get invalidExplanation() {
return this.invalid ? this.invalid.explanation : null;
}
/**
* Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime
*
* @type {string}
*/
get locale() {
return this.isValid ? this.loc.locale : null;
}
/**
* Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime
*
* @type {string}
*/
get numberingSystem() {
return this.isValid ? this.loc.numberingSystem : null;
}
/**
* Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime
*
* @type {string}
*/
get outputCalendar() {
return this.isValid ? this.loc.outputCalendar : null;
}
/**
* Get the time zone associated with this DateTime.
* @type {Zone}
*/
get zone() {
return this._zone;
}
/**
* Get the name of the time zone.
* @type {string}
*/
get zoneName() {
return this.isValid ? this.zone.name : null;
}
/**
* Get the year
* @example DateTime.local(2017, 5, 25).year //=> 2017
* @type {number}
*/
get year() {
return this.isValid ? this.c.year : NaN;
}
/**
* Get the quarter
* @example DateTime.local(2017, 5, 25).quarter //=> 2
* @type {number}
*/
get quarter() {
return this.isValid ? Math.ceil(this.c.month / 3) : NaN;
}
/**
* Get the month (1-12).
* @example DateTime.local(2017, 5, 25).month //=> 5
* @type {number}
*/
get month() {
return this.isValid ? this.c.month : NaN;
}
/**
* Get the day of the month (1-30ish).
* @example DateTime.local(2017, 5, 25).day //=> 25
* @type {number}
*/
get day() {
return this.isValid ? this.c.day : NaN;
}
/**
* Get the hour of the day (0-23).
* @example DateTime.local(2017, 5, 25, 9).hour //=> 9
* @type {number}
*/
get hour() {
return this.isValid ? this.c.hour : NaN;
}
/**
* Get the minute of the hour (0-59).
* @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30
* @type {number}
*/
get minute() {
return this.isValid ? this.c.minute : NaN;
}
/**
* Get the second of the minute (0-59).
* @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52
* @type {number}
*/
get second() {
return this.isValid ? this.c.second : NaN;
}
/**
* Get the millisecond of the second (0-999).
* @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654
* @type {number}
*/
get millisecond() {
return this.isValid ? this.c.millisecond : NaN;
}
/**
* Get the week year
* @see https://en.wikipedia.org/wiki/ISO_week_date
* @example DateTime.local(2014, 12, 31).weekYear //=> 2015
* @type {number}
*/
get weekYear() {
return this.isValid ? ss(this).weekYear : NaN;
}
/**
* Get the week number of the week year (1-52ish).
* @see https://en.wikipedia.org/wiki/ISO_week_date
* @example DateTime.local(2017, 5, 25).weekNumber //=> 21
* @type {number}
*/
get weekNumber() {
return this.isValid ? ss(this).weekNumber : NaN;
}
/**
* Get the day of the week.
* 1 is Monday and 7 is Sunday
* @see https://en.wikipedia.org/wiki/ISO_week_date
* @example DateTime.local(2014, 11, 31).weekday //=> 4
* @type {number}
*/
get weekday() {
return this.isValid ? ss(this).weekday : NaN;
}
/**
* Returns true if this date is on a weekend according to the locale, false otherwise
* @returns {boolean}
*/
get isWeekend() {
return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
}
/**
* Get the day of the week according to the locale.
* 1 is the first day of the week and 7 is the last day of the week.
* If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,
* @returns {number}
*/
get localWeekday() {
return this.isValid ? as(this).weekday : NaN;
}
/**
* Get the week number of the week year according to the locale. Different locales assign week numbers differently,
* because the week can start on different days of the week (see localWeekday) and because a different number of days
* is required for a week to count as the first week of a year.
* @returns {number}
*/
get localWeekNumber() {
return this.isValid ? as(this).weekNumber : NaN;
}
/**
* Get the week year according to the locale. Different locales assign week numbers (and therefor week years)
* differently, see localWeekNumber.
* @returns {number}
*/
get localWeekYear() {
return this.isValid ? as(this).weekYear : NaN;
}
/**
* Get the ordinal (meaning the day of the year)
* @example DateTime.local(2017, 5, 25).ordinal //=> 145
* @type {number|DateTime}
*/
get ordinal() {
return this.isValid ? ns(this.c).ordinal : NaN;
}
/**
* Get the human readable short month name, such as 'Oct'.
* Defaults to the system's locale if no locale has been specified
* @example DateTime.local(2017, 10, 30).monthShort //=> Oct
* @type {string}
*/
get monthShort() {
return this.isValid ? _r.months("short", { locObj: this.loc })[this.month - 1] : null;
}
/**
* Get the human readable long month name, such as 'October'.
* Defaults to the system's locale if no locale has been specified
* @example DateTime.local(2017, 10, 30).monthLong //=> October
* @type {string}
*/
get monthLong() {
return this.isValid ? _r.months("long", { locObj: this.loc })[this.month - 1] : null;
}
/**
* Get the human readable short weekday, such as 'Mon'.
* Defaults to the system's locale if no locale has been specified
* @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon
* @type {string}
*/
get weekdayShort() {
return this.isValid ? _r.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null;
}
/**
* Get the human readable long weekday, such as 'Monday'.
* Defaults to the system's locale if no locale has been specified
* @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday
* @type {string}
*/
get weekdayLong() {
return this.isValid ? _r.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null;
}
/**
* Get the UTC offset of this DateTime in minutes
* @example DateTime.now().offset //=> -240
* @example DateTime.utc().offset //=> 0
* @type {number}
*/
get offset() {
return this.isValid ? +this.o : NaN;
}
/**
* Get the short human name for the zone's current offset, for example "EST" or "EDT".
* Defaults to the system's locale if no locale has been specified
* @type {string}
*/
get offsetNameShort() {
return this.isValid ? this.zone.offsetName(this.ts, {
format: "short",
locale: this.locale
}) : null;
}
/**
* Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time".
* Defaults to the system's locale if no locale has been specified
* @type {string}
*/
get offsetNameLong() {
return this.isValid ? this.zone.offsetName(this.ts, {
format: "long",
locale: this.locale
}) : null;
}
/**
* Get whether this zone's offset ever changes, as in a DST.
* @type {boolean}
*/
get isOffsetFixed() {
return this.isValid ? this.zone.isUniversal : null;
}
/**
* Get whether the DateTime is in a DST.
* @type {boolean}
*/
get isInDST() {
return this.isOffsetFixed ? !1 : this.offset > this.set({ month: 1, day: 1 }).offset || this.offset > this.set({ month: 5 }).offset;
}
/**
* Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC
* in this DateTime's zone. During DST changes local time can be ambiguous, for example
* `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.
* This method will return both possible DateTimes if this DateTime's local time is ambiguous.
* @returns {DateTime[]}
*/
getPossibleOffsets() {
if (!this.isValid || this.isOffsetFixed)
return [this];
const t = 864e5, n = 6e4, r = Fi(this.c), i = this.zone.offset(r - t), s = this.zone.offset(r + t), a = this.zone.offset(r - i * n), o = this.zone.offset(r - s * n);
if (a === o)
return [this];
const l = r - a * n, u = r - o * n, c = kr(l, a), h = kr(u, o);
return c.hour === h.hour && c.minute === h.minute && c.second === h.second && c.millisecond === h.millisecond ? [De(this, { ts: l }), De(this, { ts: u })] : [this];
}
/**
* Returns true if this DateTime is in a leap year, false otherwise
* @example DateTime.local(2016).isInLeapYear //=> true
* @example DateTime.local(2013).isInLeapYear //=> false
* @type {boolean}
*/
get isInLeapYear() {
return dr(this.year);
}
/**
* Returns the number of days in this DateTime's month
* @example DateTime.local(2016, 2).daysInMonth //=> 29
* @example DateTime.local(2016, 3).daysInMonth //=> 31
* @type {number}
*/
get daysInMonth() {
return li(this.year, this.month);
}
/**
* Returns the number of days in this DateTime's year
* @example DateTime.local(2016).daysInYear //=> 366
* @example DateTime.local(2013).daysInYear //=> 365
* @type {number}
*/
get daysInYear() {
return this.isValid ? hn(this.year) : NaN;
}
/**
* Returns the number of weeks in this DateTime's year
* @see https://en.wikipedia.org/wiki/ISO_week_date
* @example DateTime.local(2004).weeksInWeekYear //=> 53
* @example DateTime.local(2013).weeksInWeekYear //=> 52
* @type {number}
*/
get weeksInWeekYear() {
return this.isValid ? sr(this.weekYear) : NaN;
}
/**
* Returns the number of weeks in this DateTime's local week year
* @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52
* @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53
* @type {number}
*/
get weeksInLocalWeekYear() {
return this.isValid ? sr(
this.localWeekYear,
this.loc.getMinDaysInFirstWeek(),
this.loc.getStartOfWeek()
) : NaN;
}
/**
* Returns the resolved Intl options for this DateTime.
* This is useful in understanding the behavior of formatting methods
* @param {Object} opts - the same options as toLocaleString
* @return {Object}
*/
resolvedLocaleOptions(t = {}) {
const { locale: n, numberingSystem: r, calendar: i } = ct.create(
this.loc.clone(t),
t
).resolvedOptions(this);
return { locale: n, numberingSystem: r, outputCalendar: i };
}
// TRANSFORM
/**
* "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime.
*
* Equivalent to {@link DateTime#setZone}('utc')
* @param {number} [offset=0] - optionally, an offset from UTC in minutes
* @param {Object} [opts={}] - options to pass to `setZone()`
* @return {DateTime}
*/
toUTC(t = 0, n = {}) {
return this.setZone(pt.instance(t), n);
}
/**
* "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.
*
* Equivalent to `setZone('local')`
* @return {DateTime}
*/
toLocal() {
return this.setZone(B.defaultZone);
}
/**
* "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.
*
* By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones.
* @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class.
* @param {Object} opts - options
* @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.
* @return {DateTime}
*/
setZone(t, { keepLocalTime: n = !1, keepCalendarTime: r = !1 } = {}) {
if (t = Me(t, B.defaultZone), t.equals(this.zone))
return this;
if (t.isValid) {
let i = this.ts;
if (n || r) {
const s = t.offset(this.ts), a = this.toObject();
[i] = Ur(a, s, t);
}
return De(this, { ts: i, zone: t });
} else
return I.invalid(zn(t));
}
/**
* "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.
* @param {Object} properties - the properties to set
* @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })
* @return {DateTime}
*/
reconfigure({ locale: t, numberingSystem: n, outputCalendar: r } = {}) {
const i = this.loc.clone({ locale: t, numberingSystem: n, outputCalendar: r });
return De(this, { loc: i });
}
/**
* "Set" the locale. Returns a newly-constructed DateTime.
* Just a convenient alias for reconfigure({ locale })
* @example DateTime.local(2017, 5, 25).setLocale('en-GB')
* @return {DateTime}
*/
setLocale(t) {
return this.reconfigure({ locale: t });
}
/**
* "Set" the values of specified units. Returns a newly-constructed DateTime.
* You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.
*
* This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.
* They cannot be mixed with ISO-week units like `weekday`.
* @param {Object} values - a mapping of units to numbers
* @example dt.set({ year: 2017 })
* @example dt.set({ hour: 8, minute: 30 })
* @example dt.set({ weekday: 5 })
* @example dt.set({ year: 2005, ordinal: 234 })
* @return {DateTime}
*/
set(t) {
if (!this.isValid) return this;
const n = ui(t, fl), { minDaysInFirstWeek: r, startOfWeek: i } = Qo(n, this.loc), s = !P(n.weekYear) || !P(n.weekNumber) || !P(n.weekday), a = !P(n.ordinal), o = !P(n.year), l = !P(n.month) || !P(n.day), u = o || l, c = n.weekYear || n.weekNumber;
if ((u || a) && c)
throw new an(
"Can't mix weekYear/weekNumber units with year/month/day or ordinals"
);
if (l && a)
throw new an("Can't mix ordinal dates with month/day");
let h;
s ? h = Xo(
{ ...oi(this.c, r, i), ...n },
r,
i
) : P(n.ordinal) ? (h = { ...this.toObject(), ...n }, P(n.day) && (h.day = Math.min(li(h.year, h.month), h.day))) : h = Jo({ ...ns(this.c), ...n });
const [f, d] = Ur(h, this.o, this.zone);
return De(this, { ts: f, o: d });
}
/**
* Add a period of time to this DateTime and return the resulting DateTime
*
* Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.
* @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
* @example DateTime.now().plus(123) //~> in 123 milliseconds
* @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes
* @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow
* @example DateTime.now().plus({ days: -1 }) //~> this time yesterday
* @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min
* @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min
* @return {DateTime}
*/
plus(t) {
if (!this.isValid) return this;
const n = R.fromDurationLike(t);
return De(this, cl(this, n));
}
/**
* Subtract a period of time to this DateTime and return the resulting DateTime
* See {@link DateTime#plus}
* @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
@return {DateTime}
*/
minus(t) {
if (!this.isValid) return this;
const n = R.fromDurationLike(t).negate();
return De(this, cl(this, n));
}
/**
* "Set" this DateTime to the beginning of a unit of time.
* @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
* @param {Object} opts - options
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
* @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
* @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
* @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
* @return {DateTime}
*/
startOf(t, { useLocaleWeeks: n = !1 } = {}) {
if (!this.isValid) return this;
const r = {}, i = R.normalizeUnit(t);
switch (i) {
case "years":
r.month = 1;
// falls through
case "quarters":
case "months":
r.day = 1;
// falls through
case "weeks":
case "days":
r.hour = 0;
// falls through
case "hours":
r.minute = 0;
// falls through
case "minutes":
r.second = 0;
// falls through
case "seconds":
r.millisecond = 0;
break;
}
if (i === "weeks")
if (n) {
const s = this.loc.getStartOfWeek(), { weekday: a } = this;
a < s && (r.weekNumber = this.weekNumber - 1), r.weekday = s;
} else
r.weekday = 1;
if (i === "quarters") {
const s = Math.ceil(this.month / 3);
r.month = (s - 1) * 3 + 1;
}
return this.set(r);
}
/**
* "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
* @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
* @param {Object} opts - options
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
* @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
* @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
* @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
* @return {DateTime}
*/
endOf(t, n) {
return this.isValid ? this.plus({ [t]: 1 }).startOf(t, n).minus(1) : this;
}
// OUTPUT
/**
* Returns a string representation of this DateTime formatted according to the specified format string.
* **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens).
* Defaults to en-US if no locale has been specified, regardless of the system's locale.
* @param {string} fmt - the format string
* @param {Object} opts - opts to override the configuration options on this DateTime
* @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'
* @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'
* @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22'
* @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes'
* @return {string}
*/
toFormat(t, n = {}) {
return this.isValid ? ct.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this, t) : is;
}
/**
* Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.
* The exact behavior of this method is browser-specific, but in general it will return an appropriate representation
* of the DateTime in the assigned locale.
* Defaults to the system's locale if no locale has been specified
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options
* @param {Object} opts - opts to override the configuration options on this DateTime
* @example DateTime.now().toLocaleString(); //=> 4/20/2017
* @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'
* @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'
* @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'
* @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'
* @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'
* @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'
* @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'
* @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32'
* @return {string}
*/
toLocaleString(t = ai, n = {}) {
return this.isValid ? ct.create(this.loc.clone(n), t).formatDateTime(this) : is;
}
/**
* Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.
* Defaults to the system's locale if no locale has been specified
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts
* @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.
* @example DateTime.now().toLocaleParts(); //=> [
* //=> { type: 'day', value: '25' },
* //=> { type: 'literal', value: '/' },
* //=> { type: 'month', value: '05' },
* //=> { type: 'literal', value: '/' },
* //=> { type: 'year', value: '1982' }
* //=> ]
*/
toLocaleParts(t = {}) {
return this.isValid ? ct.create(this.loc.clone(t), t).formatDateTimeParts(this) : [];
}
/**
* Returns an ISO 8601-compliant string representation of this DateTime
* @param {Object} opts - options
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {boolean} [opts.extendedZone=false] - add the time zone format extension
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
* @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
* @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
* @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
* @return {string|null}
*/
toISO({
format: t = "extended",
suppressSeconds: n = !1,
suppressMilliseconds: r = !1,
includeOffset: i = !0,
extendedZone: s = !1
} = {}) {
if (!this.isValid)
return null;
const a = t === "extended";
let o = os(this, a);
return o += "T", o += hl(this, a, n, r, i, s), o;
}
/**
* Returns an ISO 8601-compliant string representation of this DateTime's date component
* @param {Object} opts - options
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
* @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
* @return {string|null}
*/
toISODate({ format: t = "extended" } = {}) {
return this.isValid ? os(this, t === "extended") : null;
}
/**
* Returns an ISO 8601-compliant string representation of this DateTime's week date
* @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'
* @return {string}
*/
toISOWeekDate() {
return Or(this, "kkkk-'W'WW-c");
}
/**
* Returns an ISO 8601-compliant string representation of this DateTime's time component
* @param {Object} opts - options
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {boolean} [opts.extendedZone=true] - add the time zone format extension
* @param {boolean} [opts.includePrefix=false] - include the `T` prefix
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
* @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
* @return {string}
*/
toISOTime({
suppressMilliseconds: t = !1,
suppressSeconds: n = !1,
includeOffset: r = !0,
includePrefix: i = !1,
extendedZone: s = !1,
format: a = "extended"
} = {}) {
return this.isValid ? (i ? "T" : "") + hl(
this,
a === "extended",
n,
t,
r,
s
) : null;
}
/**
* Returns an RFC 2822-compatible string representation of this DateTime
* @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'
* @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'
* @return {string}
*/
toRFC2822() {
return Or(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", !1);
}
/**
* Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.
* Specifically, the string conforms to RFC 1123.
* @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
* @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'
* @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'
* @return {string}
*/
toHTTP() {
return Or(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
}
/**
* Returns a string representation of this DateTime appropriate for use in SQL Date
* @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'
* @return {string|null}
*/
toSQLDate() {
return this.isValid ? os(this, !0) : null;
}
/**
* Returns a string representation of this DateTime appropriate for use in SQL Time
* @param {Object} opts - options
* @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'
* @example DateTime.utc().toSQL() //=> '05:15:16.345'
* @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'
* @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'
* @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'
* @return {string}
*/
toSQLTime({ includeOffset: t = !0, includeZone: n = !1, includeOffsetSpace: r = !0 } = {}) {
let i = "HH:mm:ss.SSS";
return (n || t) && (r && (i += " "), n ? i += "z" : t && (i += "ZZ")), Or(this, i, !0);
}
/**
* Returns a string representation of this DateTime appropriate for use in SQL DateTime
* @param {Object} opts - options
* @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'
* @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'
* @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'
* @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'
* @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'
* @return {string}
*/
toSQL(t = {}) {
return this.isValid ? `${this.toSQLDate()} ${this.toSQLTime(t)}` : null;
}
/**
* Returns a string representation of this DateTime appropriate for debugging
* @return {string}
*/
toString() {
return this.isValid ? this.toISO() : is;
}
/**
* Returns a string representation of this DateTime appropriate for the REPL.
* @return {string}
*/
[Symbol.for("nodejs.util.inspect.custom")]() {
return this.isValid ? `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }` : `DateTime { Invalid, reason: ${this.invalidReason} }`;
}
/**
* Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}
* @return {number}
*/
valueOf() {
return this.toMillis();
}
/**
* Returns the epoch milliseconds of this DateTime.
* @return {number}
*/
toMillis() {
return this.isValid ? this.ts : NaN;
}
/**
* Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime.
* @return {number}
*/
toSeconds() {
return this.isValid ? this.ts / 1e3 : NaN;
}
/**
* Returns the epoch seconds (as a whole number) of this DateTime.
* @return {number}
*/
toUnixInteger() {
return this.isValid ? Math.floor(this.ts / 1e3) : NaN;
}
/**
* Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.
* @return {string}
*/
toJSON() {
return this.toISO();
}
/**
* Returns a BSON serializable equivalent to this DateTime.
* @return {Date}
*/
toBSON() {
return this.toJSDate();
}
/**
* Returns a JavaScript object with this DateTime's year, month, day, and so on.
* @param opts - options for generating the object
* @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output
* @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }
* @return {Object}
*/
toObject(t = {}) {
if (!this.isValid) return {};
const n = { ...this.c };
return t.includeConfig && (n.outputCalendar = this.outputCalendar, n.numberingSystem = this.loc.numberingSystem, n.locale = this.loc.locale), n;
}
/**
* Returns a JavaScript Date equivalent to this DateTime.
* @return {Date}
*/
toJSDate() {
return new Date(this.isValid ? this.ts : NaN);
}
// COMPARE
/**
* Return the difference between two DateTimes as a Duration.
* @param {DateTime} otherDateTime - the DateTime to compare this one to
* @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.
* @param {Object} opts - options that affect the creation of the Duration
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
* @example
* var i1 = DateTime.fromISO('1982-05-25T09:45'),
* i2 = DateTime.fromISO('1983-10-14T10:30');
* i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }
* i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }
* i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }
* i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }
* @return {Duration}
*/
diff(t, n = "milliseconds", r = {}) {
if (!this.isValid || !t.isValid)
return R.invalid("created by diffing an invalid DateTime");
const i = { locale: this.locale, numberingSystem: this.numberingSystem, ...r }, s = Nx(n).map(R.normalizeUnit), a = t.valueOf() > this.valueOf(), o = a ? this : t, l = a ? t : this, u = $w(o, l, s, i);
return a ? u.negate() : u;
}
/**
* Return the difference between this DateTime and right now.
* See {@link DateTime#diff}
* @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration
* @param {Object} opts - options that affect the creation of the Duration
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
* @return {Duration}
*/
diffNow(t = "milliseconds", n = {}) {
return this.diff(I.now(), t, n);
}
/**
* Return an Interval spanning between this DateTime and another DateTime
* @param {DateTime} otherDateTime - the other end point of the Interval
* @return {Interval|DateTime}
*/
until(t) {
return this.isValid ? q.fromDateTimes(this, t) : this;
}
/**
* Return whether this DateTime is in the same unit of time as another DateTime.
* Higher-order units must also be identical for this function to return `true`.
* Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.
* @param {DateTime} otherDateTime - the other DateTime
* @param {string} unit - the unit of time to check sameness on
* @param {Object} opts - options
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used
* @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
* @return {boolean}
*/
hasSame(t, n, r) {
if (!this.isValid) return !1;
const i = t.valueOf(), s = this.setZone(t.zone, { keepLocalTime: !0 });
return s.startOf(n, r) <= i && i <= s.endOf(n, r);
}
/**
* Equality check
* Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid.
* To compare just the millisecond values, use `+dt1 === +dt2`.
* @param {DateTime} other - the other DateTime
* @return {boolean}
*/
equals(t) {
return this.isValid && t.isValid && this.valueOf() === t.valueOf() && this.zone.equals(t.zone) && this.loc.equals(t.loc);
}
/**
* Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your
* platform supports Intl.RelativeTimeFormat. Rounds down by default.
* @param {Object} options - options that affect the output
* @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
* @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow"
* @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds"
* @param {boolean} [options.round=true] - whether to round the numbers in the output.
* @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.
* @param {string} options.locale - override the locale of this DateTime
* @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
* @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day"
* @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día"
* @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures"
* @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago"
* @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago"
* @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago"
*/
toRelative(t = {}) {
if (!this.isValid) return null;
const n = t.base || I.fromObject({}, { zone: this.zone }), r = t.padding ? this < n ? -t.padding : t.padding : 0;
let i = ["years", "months", "days", "hours", "minutes", "seconds"], s = t.unit;
return Array.isArray(t.unit) && (i = t.unit, s = void 0), pl(n, this.plus(r), {
...t,
numeric: "always",
units: i,
unit: s
});
}
/**
* Returns a string representation of this date relative to today, such as "yesterday" or "next month".
* Only internationalizes on platforms that supports Intl.RelativeTimeFormat.
* @param {Object} options - options that affect the output
* @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
* @param {string} options.locale - override the locale of this DateTime
* @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days"
* @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
* @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow"
* @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana"
* @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain"
* @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago"
*/
toRelativeCalendar(t = {}) {
return this.isValid ? pl(t.base || I.fromObject({}, { zone: this.zone }), this, {
...t,
numeric: "auto",
units: ["years", "months", "days"],
calendary: !0
}) : null;
}
/**
* Return the min of several date times
* @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum
* @return {DateTime} the min DateTime, or undefined if called with no argument
*/
static min(...t) {
if (!t.every(I.isDateTime))
throw new ut("min requires all arguments be DateTimes");
return tl(t, (n) => n.valueOf(), Math.min);
}
/**
* Return the max of several date times
* @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum
* @return {DateTime} the max DateTime, or undefined if called with no argument
*/
static max(...t) {
if (!t.every(I.isDateTime))
throw new ut("max requires all arguments be DateTimes");
return tl(t, (n) => n.valueOf(), Math.max);
}
// MISC
/**
* Explain how a string would be parsed by fromFormat()
* @param {string} text - the string to parse
* @param {string} fmt - the format the string is expected to be in (see description)
* @param {Object} options - options taken by fromFormat()
* @return {Object}
*/
static fromFormatExplain(t, n, r = {}) {
const { locale: i = null, numberingSystem: s = null } = r, a = H.fromOpts({
locale: i,
numberingSystem: s,
defaultToEN: !0
});
return Xc(a, t, n);
}
/**
* @deprecated use fromFormatExplain instead
*/
static fromStringExplain(t, n, r = {}) {
return I.fromFormatExplain(t, n, r);
}
/**
* Build a parser for `fmt` using the given locale. This parser can be passed
* to {@link DateTime.fromFormatParser} to a parse a date in this format. This
* can be used to optimize cases where many dates need to be parsed in a
* specific format.
*
* @param {String} fmt - the format the string is expected to be in (see
* description)
* @param {Object} options - options used to set locale and numberingSystem
* for parser
* @returns {TokenParser} - opaque object to be used
*/
static buildFormatParser(t, n = {}) {
const { locale: r = null, numberingSystem: i = null } = n, s = H.fromOpts({
locale: r,
numberingSystem: i,
defaultToEN: !0
});
return new Bc(s, t);
}
/**
* Create a DateTime from an input string and format parser.
*
* The format parser must have been created with the same locale as this call.
*
* @param {String} text - the string to parse
* @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser}
* @param {Object} opts - options taken by fromFormat()
* @returns {DateTime}
*/
static fromFormatParser(t, n, r = {}) {
if (P(t) || P(n))
throw new ut(
"fromFormatParser requires an input string and a format parser"
);
const { locale: i = null, numberingSystem: s = null } = r, a = H.fromOpts({
locale: i,
numberingSystem: s,
defaultToEN: !0
});
if (!a.equals(n.locale))
throw new ut(
`fromFormatParser called with a locale of ${a}, but the format parser was created for ${n.locale}`
);
const { result: o, zone: l, specificOffset: u, invalidReason: c } = n.explainFromTokens(t);
return c ? I.invalid(c) : rn(
o,
l,
r,
`format ${n.format}`,
t,
u
);
}
// FORMAT PRESETS
/**
* {@link DateTime#toLocaleString} format like 10/14/1983
* @type {Object}
*/
static get DATE_SHORT() {
return ai;
}
/**
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983'
* @type {Object}
*/
static get DATE_MED() {
return ec;
}
/**
* {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983'
* @type {Object}
*/
static get DATE_MED_WITH_WEEKDAY() {
return ix;
}
/**
* {@link DateTime#toLocaleString} format like 'October 14, 1983'
* @type {Object}
*/
static get DATE_FULL() {
return nc;
}
/**
* {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983'
* @type {Object}
*/
static get DATE_HUGE() {
return rc;
}
/**
* {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get TIME_SIMPLE() {
return ic;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get TIME_WITH_SECONDS() {
return sc;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.
* @type {Object}
*/
static get TIME_WITH_SHORT_OFFSET() {
return ac;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.
* @type {Object}
*/
static get TIME_WITH_LONG_OFFSET() {
return oc;
}
/**
* {@link DateTime#toLocaleString} format like '09:30', always 24-hour.
* @type {Object}
*/
static get TIME_24_SIMPLE() {
return lc;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour.
* @type {Object}
*/
static get TIME_24_WITH_SECONDS() {
return uc;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour.
* @type {Object}
*/
static get TIME_24_WITH_SHORT_OFFSET() {
return cc;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.
* @type {Object}
*/
static get TIME_24_WITH_LONG_OFFSET() {
return hc;
}
/**
* {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_SHORT() {
return fc;
}
/**
* {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_SHORT_WITH_SECONDS() {
return dc;
}
/**
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_MED() {
return pc;
}
/**
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_MED_WITH_SECONDS() {
return mc;
}
/**
* {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_MED_WITH_WEEKDAY() {
return sx;
}
/**
* {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_FULL() {
return gc;
}
/**
* {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_FULL_WITH_SECONDS() {
return yc;
}
/**
* {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_HUGE() {
return vc;
}
/**
* {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_HUGE_WITH_SECONDS() {
return bc;
}
}
function Rn(e) {
if (I.isDateTime(e))
return e;
if (e && e.valueOf && Ce(e.valueOf()))
return I.fromJSDate(e);
if (e && typeof e == "object")
return I.fromObject(e);
throw new ut(
`Unknown datetime argument: ${e}, of type ${typeof e}`
);
}
function e1(e, t) {
switch (e) {
case "bottom":
return di(t).ticks(5);
case "top":
return jr(t).ticks(5);
case "right":
return or(t).ticks(5);
case "left":
default:
return ds(t).ticks(5);
}
}
function Ta(e, t, n) {
const r = (n == null ? void 0 : n.timeZone) ?? Intl.DateTimeFormat().resolvedOptions().timeZone, i = (n == null ? void 0 : n.locale) ?? navigator.language;
return I.fromJSDate(e).setZone(r).setLocale(i).toFormat(t);
}
function n1(e, t) {
return function(n) {
const r = I.fromJSDate(n).setZone(e).setLocale(t ?? navigator.language), i = new Date(n.getTime() + r.offset * 6e4);
let s;
return Re(i) < i ? s = ".SSS" : Si(i) < i ? s = ":ss" : Ti(i) < i || lr(i) < i ? s = "HH:mm" : _i(i) < i ? s = ur(i) < i ? "EEE dd" : "MMM dd" : s = ne(i) < i ? "MMMM" : "yyyy", r.toFormat(s);
};
}
function nh(e) {
return e >= 100 ? 90 : e >= 50 ? 45 : e >= 20 ? 15 : e;
}
class rh {
constructor(t, n, r, i) {
Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "position", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "orientation", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "spanScale", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "clientRect", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.options = i, this.orientation = i.orientation, this.position = i.position, this.spanScale = r, this.create(t, n);
}
get class() {
return `${this.options.axisKey}-axis-${this.options.axisIndex}`;
}
create(t, n) {
this.group = t.append("g").attr("class", `axis ${this.class}`), this.axis = e1(this.orientation, n), this.redraw();
}
redraw() {
this.options.type === z.time ? this.updateTicksForTime() : this.options.type === z.degrees && this.updateTicksForDegrees(), this.group.attr("transform", this.translateAxis(this.position)).call(this.axis), this.options.labelAngle !== void 0 && this.translateTickLabels(this.orientation, this.options.labelAngle), this.clientRect = this.group.node().getClientRects()[0];
}
updateTicksForTime() {
const n = this.axis.scale().domain().map((a) => {
const o = I.fromJSDate(a).setZone(this.options.timeZone);
return new Date(a.getTime() + o.offset * 6e4);
}), s = cn().domain(n).ticks(5).map((a) => {
const o = I.fromJSDate(a).setZone(this.options.timeZone);
return new Date(a.getTime() - o.offset * 6e4);
});
this.axis.tickValues(s), this.axis.tickFormat(n1(this.options.timeZone, this.options.locale));
}
updateTicksForDegrees() {
const n = this.axis.scale().domain();
let r = Bn(n[0], n[1], 5);
r = nh(r);
const i = Math.ceil(n[0] / r) * r, s = Math.floor(n[1] / r + 1) * r;
this.axis.tickValues(Ks(i, s, r));
}
}
const tt = {
AtZero: "atzero",
...Zt
};
class r1 extends rh {
constructor(t, n, r, i) {
i.orientation === void 0 && (i.orientation = i.position !== void 0 && i.position !== tt.AtZero ? i.position : Zt.Bottom), i.position === void 0 && (i.position = Zt.Bottom), super(t, n, r, i);
}
translateAxis(t) {
return t === tt.AtZero ? `translate(0,${this.spanScale(0)})` : t === tt.Bottom ? `translate(0,${this.spanScale.range()[0]})` : "";
}
translateTickLabels(t, n) {
switch (n) {
case 0:
break;
case 180:
this.group.selectAll("text").attr("transform", `rotate(${n})`);
break;
default:
const r = Qu(n, t), i = t === Zt.Top ? -15 : 15;
this.group.selectAll("text").attr("x", null).attr("dx", null).attr("y", null).attr("dy", null).attr("text-anchor", r).attr("dominant-baseline", "middle").attr("transform", `translate(0, ${i}) rotate(${n})`);
}
}
}
class i1 extends rh {
constructor(t, n, r, i) {
i.orientation === void 0 && (i.orientation = i.position !== void 0 && i.position !== tt.AtZero ? i.position : Zt.Left), i.position === void 0 && (i.position = Zt.Left), super(t, n, r, i);
}
translateAxis(t) {
return t === tt.AtZero ? `translate(${this.spanScale(0)},0)` : t === tt.Right ? `translate(${this.spanScale.range()[1]},0)` : "";
}
translateTickLabels(t, n) {
switch (n) {
case 0:
break;
case 180:
this.group.selectAll("text").attr("transform", `rotate(${n})`);
break;
default:
const r = Qu(n, t), i = t === Zt.Right ? 15 : -15;
this.group.selectAll("text").attr("x", null).attr("dx", null).attr("y", null).attr("dy", null).attr("text-anchor", r).attr("dominant-baseline", "middle").attr("transform", `translate(${i}, 0) rotate(${n})`);
}
}
}
const gl = {
canvas: void 0,
grid: void 0,
axis: void 0,
labels: void 0,
charts: void 0,
front: void 0,
mouse: void 0
};
function s1(e, t, n) {
const r = { ...gl };
for (const i in gl)
r[i] = e.append("g").attr("class", i);
return r;
}
const Cr = {
Vertical: "vertical",
Horizontal: "horizontal"
};
function Ir(e, t) {
return Math.ceil(e / t) * t;
}
const ls = {
margin: { top: 20, right: 50, bottom: 20, left: 50 },
automargin: !1,
x: [{ type: z.value, labelAngle: 0 }],
y: [{ type: z.value, labelAngle: 0 }]
};
class ih extends Ju {
constructor(t, n, r, i) {
super(t, n, r, i, ls), Object.defineProperty(this, "gridHandles", {
enumerable: !0,
configurable: !0,
writable: !0,
value: {}
}), Object.defineProperty(this, "axisHandles", {
enumerable: !0,
configurable: !0,
writable: !0,
value: {}
}), Object.defineProperty(this, "layers", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "xScales", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), Object.defineProperty(this, "yScales", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), Object.defineProperty(this, "xInitialExtent", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), Object.defineProperty(this, "yInitialExtent", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), Object.defineProperty(this, "clipPathId", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "xDomainCallbacks", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), Object.defineProperty(this, "isDomainChangeFromZoomReset", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.isDomainChangeFromZoomReset = !1, this.setDefaultAxisOptions(this.options.x, ls.x[0]), this.setDefaultAxisOptions(this.options.y, ls.y[0]), this.setDefaultTimeOptions(this.options.x), this.setDefaultTimeOptions(this.options.y), this.clipPathId = "id-" + Math.random().toString(36).substring(2, 18), this.setClipPath(), this.layers = s1(this.canvas, this.width, this.height), this.chartGroup = this.layers.charts.attr("clip-path", `url(#${this.clipPathId})`).append("g"), this.createCanvas(), this.createMouseLayer(), this.initXScales(this.options.x), this.initYScales(this.options.y), this.initLabels(), this.initAxisX(this.options.x), this.initAxisY(this.options.y), this.update();
}
get xScalesDomains() {
return this.xScales.map((t) => t.domain());
}
get yScalesDomains() {
return this.yScales.map((t) => t.domain());
}
addEventListener(t, n) {
this.xDomainCallbacks.push(n);
}
removeEventListener(t, n) {
this.xDomainCallbacks = this.xDomainCallbacks.filter((r) => r !== n);
}
setDefaultAxisOptions(t, n) {
for (const r of t)
qt(r, n);
}
setOptions(t) {
ir(this.options, t);
}
createCanvas() {
this.layers.canvas.attr("clip-path", `url(#${this.clipPathId})`).append("rect").attr("width", this.width).attr("height", this.height);
}
createMouseLayer() {
this.layers.mouse.append("rect").attr("width", this.width).attr("height", this.height).attr("fill", "none").attr("pointer-events", "all");
}
updateCanvas() {
this.layers.canvas.select("rect").attr("height", this.height).attr("width", this.width);
}
updateMouseLayer() {
this.layers.mouse.select("rect").attr("height", this.height).attr("width", this.width);
}
setClipPath() {
const t = this.defs.select(`#${this.clipPathId}`);
t.size() === 0 ? this.defs.append("clipPath").attr("id", this.clipPathId).append("rect").attr("height", this.height).attr("width", this.width) : t.select("rect").attr("height", this.height).attr("width", this.width);
}
updateAxisScales(t, n) {
let r, i;
n === "x" ? (r = this.xScales, i = this.xInitialExtent) : (r = this.yScales, i = this.yInitialExtent);
for (const s of [0, 1]) {
const a = r[s];
if (!a)
continue;
const o = this.options[n][s], l = (d) => this.setDomain(n, s, d), u = () => {
const d = Qb(a.domain(), 16, o.type);
l(d);
}, h = { autoScale: !1, ...{
domain: o.domain,
nice: o.nice,
includeZero: o.includeZero,
symmetric: o.symmetric
}, ...t };
if (h != null && h.domain)
l(h.domain), (h == null ? void 0 : h.nice) === !0 && u();
else if (o.type === z.band) {
const p = this.charts.filter((g) => {
var m;
return ((m = g.axisIndex[n]) == null ? void 0 : m.axisIndex) === s;
}).flatMap((g) => g.data.map((m) => m[g.dataKeys[n]]));
l(p);
} else if (h.autoScale === !0 || h.fullExtent === !0) {
let d, p = new Array(2);
if ((o == null ? void 0 : o.defaultDomain) !== void 0 && (d = o == null ? void 0 : o.defaultDomain), p = this.chartsExtent(n, s, h), (h == null ? void 0 : h.symmetric) === !0) {
const g = Math.max(Math.abs(p[0]), Math.abs(p[1]));
p[0] = -g, p[1] = g;
}
d !== void 0 && ((d[0] < p[0] || d[1] > p[1]) && (p = _t([...d, ...p])), (h == null ? void 0 : h.includeZero) === !0 && (p = _t([...p, 0]))), l(p), (h == null ? void 0 : h.nice) === !0 && u();
}
const f = a.domain();
i[s] === void 0 && !isNaN(f[0]) && !isNaN(f[1]) && (i[s] = f);
}
}
chartsExtent(t, n, r) {
var s;
let i = new Array(2);
for (const a of this.charts)
if ((r.fullExtent || a.options[t].includeInAutoScale) && ((s = a.axisIndex[t]) == null ? void 0 : s.axisIndex) === +n) {
const o = a.extent[a.dataKeys[t]];
i = _t(hs([i, [].concat(...o)]));
}
return i;
}
redraw(t) {
this.updateAxisScales((t == null ? void 0 : t.x) ?? {}, "x"), this.updateAxisScales((t == null ? void 0 : t.y) ?? {}, "y"), this.update();
for (const n of this.charts)
n.plotter(this, n.axisIndex);
for (const n of this.visitors)
n.redraw();
this.isDomainChangeFromZoomReset = !1;
}
removeInitialExtent() {
this.xInitialExtent = [], this.yInitialExtent = [];
}
resetZoom() {
const t = { autoScale: !0 };
(this.options.x[0].resetZoom === sn.full || this.options.x[0].resetZoom === sn.toggle && this.atInitialExtent(this.xScales[0].domain(), this.xInitialExtent[0])) && (t.fullExtent = !0);
const n = { autoScale: !0 };
(this.options.y[0].resetZoom === sn.full || this.options.y[0].resetZoom === sn.toggle && this.atInitialExtent(this.yScales[0].domain(), this.yInitialExtent[0])) && (n.fullExtent = !0), this.isDomainChangeFromZoomReset = !0, this.redraw({ x: t, y: n });
}
atInitialExtent(t, n) {
return n !== void 0 && t[0] === n[0] && t[1] === n[1];
}
resize() {
this.setSize(), this.setRange(), this.zoom();
}
zoom() {
for (const t of this.charts)
t.plotter(this, t.axisIndex);
this.update();
for (const t of this.visitors)
t.redraw();
}
update() {
this.redrawAxes() && (this.setSize(), this.setRange(), Object.values(this.axisHandles).forEach((n) => {
n.redraw();
})), this.setClipPath(), this.updateCanvas(), this.updateMouseLayer(), this.updateLabels(), Object.values(this.gridHandles).forEach((n) => n.redraw());
}
redrawAxes() {
let t = !1;
return Object.values(this.axisHandles).forEach((n) => {
n.redraw(), this.options.automargin && n.clientRect && (n.position === tt.Left && n.clientRect.width > this.margin.left && (this.margin.left = Ir(n.clientRect.width, 10), t = !0), n.position === tt.Right && n.clientRect.width > this.margin.right && (this.margin.right = Ir(n.clientRect.width, 10), t = !0), n.position === tt.Bottom && n.clientRect.height > this.margin.bottom && (this.margin.bottom = Ir(n.clientRect.height, 10), t = !0), n.position === tt.Top && n.clientRect.height > this.margin.top && (this.margin.top = Ir(n.clientRect.height, 10), t = !0));
}), t;
}
updateLabels() {
var n, r, i, s, a, o, l;
const t = this.canvas.select("g.labels");
if (this.options.y) {
if ((n = this.options.y[0]) != null && n.label) {
const u = t.select(".y0.label").text(this.options.y[0].label);
if (this.options.y[0].labelOrientation === Cr.Vertical) {
const c = this.options.y[0].labelOffset ?? 0;
u.attr("x", -this.height / 2).attr("y", -30 - c);
}
}
if ((r = this.options.y[0]) != null && r.unit && t.select(".y0.unit").text(this.options.y[0].unit), (i = this.options.y[1]) != null && i.label) {
const u = t.select(".y1.label").text(this.options.y[1].label);
if (this.options.y[0].labelOrientation === Cr.Vertical) {
const c = this.options.y[1].labelOffset ?? 0;
u.attr("x", -this.height / 2).attr("y", this.width + 39 + c);
} else
u.attr("x", this.width);
}
(s = this.options.y[1]) != null && s.unit && t.select(".y1.unit").attr("x", this.width + 10).text(this.options.y[1].unit);
}
if ((a = this.options.x[0]) != null && a.label) {
const u = this.options.x[0].labelOffset ?? 0;
t.select(".x0.label").attr("x", this.width / 2).attr("y", this.height + 30 + u).text(this.options.x[0].label);
}
(o = this.options.x[0]) != null && o.unit && t.select(".x0.unit").attr("x", this.width + 10).attr("y", this.height + 9).text(this.options.x[0].unit), (l = this.options.x[1]) != null && l.unit && t.select(".x1.unit").attr("x", this.width + 10).text(this.options.x[1].unit);
}
getScale(t, n) {
return (t === "x" ? this.xScales : this.yScales)[n];
}
setDomain(t, n, r) {
const i = this.getScale(t, n);
if (!i)
throw new Error(`Cannot set domain of ${t}-axis ${n} because the axis does not exist.`);
const s = i.domain();
if (i.domain(r), t === "x" && this.xDomainCallbacks.length > 0 && !qb(s, r)) {
const a = {
axisIndex: n,
old: s,
new: r,
fromZoomReset: this.isDomainChangeFromZoomReset
};
this.xDomainCallbacks.forEach((o) => o(a));
}
}
initXScales(t) {
for (const n in t) {
let r;
switch (t[n].type) {
case z.time:
r = cn();
break;
case z.band:
r = vn();
break;
default:
r = wt();
}
this.setRangeX(t), this.xScales.push(r);
}
}
initYScales(t) {
for (const n in t) {
let r;
switch (t[n].type) {
case z.time:
r = cn();
break;
case z.band:
r = vn();
break;
default:
r = wt();
}
this.setRangeY(t), this.yScales.push(r);
}
}
setRange() {
this.setRangeX(this.options.x), this.setRangeY(this.options.y);
}
setRangeX(t) {
for (const n in this.xScales) {
const r = this.xScales[n];
t[n].reverse ? r.range([this.width, 0]) : r.range([0, this.width]);
}
}
setRangeY(t) {
for (const n in this.yScales) {
const r = this.yScales[n];
t[n].reverse ? r.range([0, this.height]) : r.range([this.height, 0]);
}
}
initAxisX(t) {
for (const n in t)
this.axisHandles[`x${n}`] = new r1(this.layers.axis, this.xScales[n], this.yScales[0], {
axisKey: "x",
axisIndex: Number.parseInt(n),
...t[n]
}), t[n].showGrid && (this.gridHandles[`x${n}`] = new Uo(this.layers.grid, this.axisHandles[`x${n}`].axis, this.yScales[0], { axisKey: "x", axisIndex: Number.parseInt(n) }));
}
initAxisY(t) {
for (const n in t)
this.axisHandles[`y${n}`] = new i1(this.layers.axis, this.yScales[n], this.xScales[0], {
axisKey: "y",
axisIndex: Number.parseInt(n),
...t[n]
}), t[n].showGrid && (this.gridHandles[`y${n}`] = new Uo(this.layers.grid, this.axisHandles[`y${n}`].axis, this.xScales[0], { axisKey: "y", axisIndex: Number.parseInt(n) }));
}
initLabels() {
var n, r, i, s, a, o, l;
const t = this.layers.labels.attr("font-family", "sans-serif");
if (this.options.y) {
if ((n = this.options.y[0]) != null && n.label) {
const u = t.append("text").attr("class", "y0 label").text(this.options.y[0].label);
if (this.options.y[0].labelOrientation === Cr.Vertical) {
const c = this.options.y[0].labelOffset ?? 0;
u.attr("transform", "rotate(-90)").attr("x", -this.height / 2).attr("y", -30 - c).attr("text-anchor", "middle");
} else
u.attr("x", 0).attr("y", -9).attr("text-anchor", "start");
}
if ((r = this.options.y[0]) != null && r.unit && t.append("text").attr("class", "y0 unit").attr("x", -9).attr("y", -9).attr("text-anchor", "end").text(this.options.y[0].unit), (i = this.options.y[1]) != null && i.label) {
const u = t.append("text").attr("class", "y1 label").text(this.options.y[1].label);
if (this.options.y[1].labelOrientation === Cr.Vertical) {
const c = this.options.y[1].labelOffset ?? 0;
u.attr("transform", "rotate(-90)").attr("x", -this.height / 2).attr("y", this.width + 39 + c).attr("text-anchor", "middle");
} else
u.attr("x", this.width).attr("y", -9).attr("text-anchor", "end");
}
(s = this.options.y[1]) != null && s.unit && t.append("text").attr("class", "y1 unit").attr("x", this.width + 10).attr("y", -9).attr("text-anchor", "start").text(this.options.y[1].unit);
}
if ((a = this.options.x[0]) != null && a.label) {
const u = this.options.x[0].labelOffset ?? 0;
t.append("text").attr("class", "x0 label").attr("x", this.width / 2).attr("y", this.height + 30 + u).attr("text-anchor", "middle").text(this.options.x[0].label);
}
(o = this.options.x[0]) != null && o.unit && t.append("text").attr("class", "x0 unit").attr("x", this.width + 10).attr("y", this.height + 9).attr("dy", "0.71em").attr("text-anchor", "start").text(this.options.x[0].unit), (l = this.options.x[1]) != null && l.unit && t.append("text").attr("class", "x1 unit").attr("x", this.width + 10).attr("y", -9).attr("text-anchor", "start").text(this.options.x[1].unit);
}
}
function a1(e) {
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", n = t.length;
let r = "";
for (let i = 0; i < e; i++)
r += t.charAt(Math.floor(Math.random() * n));
return r;
}
class w1 {
/**
* Creates a colour bar
* @param group d3 selection of the SVG group to add the colour bar to
* @param colourMap colour map to display
* @param width width of the colour bar
* @param height height of the colour bar
* @param options colour bar options
*/
constructor(t, n, r, i, s) {
Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "colourMap", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "width", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "height", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "scale", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.group = t instanceof SVGGElement ? mt(t) : t, this.colourMap = n, this.width = r, this.height = i, this.options = qt({}, s, {
position: tt.Bottom,
useGradients: !0,
type: "normal"
}), this.createScale();
const a = this.createFills();
this.createBarSegments(a), this.createAxis();
}
get numColours() {
return this.colourMap.length;
}
get minimum() {
return this.colourMap[0].lowerValue;
}
get maximum() {
return this.colourMap[this.numColours - 1].lowerValue;
}
get range() {
return this.maximum - this.minimum;
}
get sizeAlongAxis() {
return this.isHorizontal ? this.width : this.height;
}
get sizeAcrossAxis() {
return this.isHorizontal ? this.height : this.width;
}
get isHorizontal() {
return this.options.position === tt.Bottom || this.options.position === tt.Top;
}
/**
* Generate fill colours for the colour bar elements.
*
* These can be either gradients or solid colours.
*/
createFills() {
let t = [];
return this.options.useGradients ? t = this.addColourMapGradients().map((r) => `url(#${r})`) : t = this.colourMap.slice(0, this.colourMap.length - 1).map((n) => n.color), t;
}
/**
* Defines gradients in the SVG for the specified colour map
*
* Ids are generated with a random prefix to prevent clashes when multiple colour bars are present.
*
* @returns Ids of the generated gradients.
*/
addColourMapGradients() {
const t = this.colourMap.length, n = this.group.append("defs"), r = [], i = a1(8);
for (let s = 0; s < t - 1; s++) {
const a = `${i}_${s}`;
this.addGradient(n, a, this.colourMap[s].color, this.colourMap[s + 1].color), r.push(a);
}
return r;
}
createScale() {
const t = this.colourMap.map((r) => r.lowerValue), n = wt();
if (this.options.type === "nonlinear") {
let r = t.map((i, s) => s * this.sizeAlongAxis / (t.length - 1));
this.isHorizontal || (r = r.reverse()), n.domain(t).range(r);
} else
n.domain([this.minimum, this.maximum]).range(this.isHorizontal ? [0, this.sizeAlongAxis] : [this.sizeAlongAxis, 0]);
this.scale = n;
}
/**
* Creates rectangles for each segment of the colour bar.
* @param fills colour values (or e.g. gradient references) for each segment
*/
createBarSegments(t) {
const n = this.isHorizontal ? (s, a) => this.scale(s) : (s, a) => this.scale(a), r = (s, a) => Math.abs(this.scale(a) - this.scale(s)), i = this.group.append("g");
for (let s = 0; s < this.colourMap.length - 1; s++) {
const a = this.colourMap[s].lowerValue, o = this.colourMap[s + 1].lowerValue, l = n(a, o), u = r(a, o);
i.append("rect").attr("x", this.isHorizontal ? l : 0).attr("y", this.isHorizontal ? 0 : l).attr("width", this.isHorizontal ? u : this.sizeAcrossAxis).attr("height", this.isHorizontal ? this.sizeAcrossAxis : u).attr("stroke", "none").attr("fill", t[s]).attr("shape-rendering", "crispEdges");
}
}
/**
* Creates the axis along the colour bar.
*/
createAxis() {
const t = `translate(${this.options.position === tt.Right ? this.width : 0}, ${this.options.position === tt.Bottom ? this.height : 0})`, n = this.colourMap.map((c) => c.lowerValue), r = this.scale, i = this.initAxis(r, this.options);
if (this.options.tickValues)
i.tickValues(this.options.tickValues);
else if (this.options.type === "nonlinear") {
const c = this.options.ticks ?? 5, h = Math.round(n.length / c);
i.tickValues(n.filter((f, d) => d % h === 0)), i.tickFormat((f) => f.toString());
} else this.options.ticks ? i.ticks(this.options.ticks) : i.tickValues(n);
const s = this.group.append("g").attr("transform", t).attr("class", "axis colourbar");
s.call(i), s.select("path").remove();
const a = `translate(${this.isHorizontal ? 0 : this.width}, ${this.isHorizontal ? this.height : 0})`, o = this.group.append("g").attr("class", "grid colourbar").attr("transform", a), l = this.isHorizontal ? jr(r) : ds(r);
l.tickValues(i.tickValues()), l.tickSize(this.sizeAcrossAxis), o.call(l), o.select("path").remove(), o.selectAll(".tick").selectAll("text").remove();
const u = this.group.append("g").attr("class", "title").attr("font-family", "sans-serif");
this.options.title && u.append("text").attr("x", this.width / 2).attr("y", -9).attr("text-anchor", "middle").text(this.options.title);
}
initAxis(t, n) {
switch (n.position) {
case tt.Bottom:
return di(t);
case tt.Top:
return jr(t);
case tt.Right:
return or(t);
case tt.Left:
default:
return ds(t);
}
}
/**
* Adds a gradient definition to the SVG.
*
* Depending on the isHorizontal property, the gradient is created either
* horizontally (isHorizontal = true) or vertically (isHorizontal = false).
*
* @param defs d3 selection of the <defs> tag in the SVG
* @param id unique ID of the gradient
* @param colorStart start colour of the gradient
* @param colorEnd end colour of the gradient
*/
addGradient(t, n, r, i) {
const s = t.append("linearGradient").attr("id", n).attr("x1", this.isHorizontal ? "0%" : "100%").attr("y1", this.isHorizontal ? "100%" : "0%").attr("x2", "100%").attr("y2", "100%");
s.append("stop").attr("offset", "0%").style("stop-color", this.isHorizontal ? r : i).style("stop-opacity", 1), s.append("stop").attr("offset", "100%").style("stop-color", this.isHorizontal ? i : r).style("stop-opacity", 1);
}
}
var ar;
(function(e) {
e[e.CLOCKWISE = -1] = "CLOCKWISE", e[e.ANTICLOCKWISE = 1] = "ANTICLOCKWISE";
})(ar || (ar = {}));
const Ar = {
innerRadius: 0,
angular: {
direction: ar.ANTICLOCKWISE,
intercept: 0,
range: [0, 2 * Math.PI],
domain: [0, 360]
},
radial: {
type: z.value
}
};
class yl extends Ju {
constructor(t, n, r, i) {
super(t, n, r, i, Ar), Object.defineProperty(this, "radialScale", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "angularScale", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "radialAxis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: null
}), Object.defineProperty(this, "angularAxis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: null
}), Object.defineProperty(this, "radialGrid", {
enumerable: !0,
configurable: !0,
writable: !0,
value: null
}), Object.defineProperty(this, "angularGrid", {
enumerable: !0,
configurable: !0,
writable: !0,
value: null
}), this.canvas = this.canvas.append("g"), this.setDefaultTimeOptions(this.options.angular), this.setDefaultTimeOptions(this.options.radial), this.canvas.append("g").attr("class", "canvas").append("path"), this.updateCanvas(), this.setRange(), this.initGrid(), this.createChartGroup();
}
setOptions(t) {
ir(this.options, t);
}
get direction() {
return this.options.angular.direction ? this.options.angular.direction : Ar.angular.direction;
}
get intercept() {
return this.options.angular.intercept ? this.options.angular.intercept : Ar.angular.intercept;
}
get innerRadiusFactor() {
return this.options.innerRadius ? this.options.innerRadius : Ar.innerRadius;
}
get innerRadius() {
return this.innerRadiusFactor * this.outerRadius;
}
get outerRadius() {
return Math.min(this.width, this.height) / 2;
}
updateCanvas() {
this.canvas.attr("transform", "translate(" + this.width / 2 + "," + this.height / 2 + " )");
let t = Math.PI / 2 - this.intercept + this.options.angular.range[0], n = Math.PI / 2 - this.intercept + this.options.angular.range[1];
this.direction === ar.ANTICLOCKWISE && (t = Math.PI + t, n = Math.PI + n), this.canvas.select(".canvas").select("path").attr("d", ei().innerRadius(this.innerRadius).outerRadius(this.outerRadius).startAngle(t).endAngle(n));
}
redraw() {
let t = new Array(0);
for (const n of this.charts) {
const r = n.extent[n.dataKeys.radial];
this.options.radial.type === z.band ? t = hs([t, [].concat(...r)]) : t = _t(hs([t, [].concat(...r)]));
}
this.radialScale.domain(t);
for (const n of this.charts)
n.plotter(this, n.axisIndex);
this.update();
for (const n of this.visitors)
n.redraw();
}
radToDegrees(t) {
return t * 180 / Math.PI;
}
update() {
const t = di(this.radialScale).ticks(5);
this.radialAxis.call(t);
const n = (h, f) => (h.arc(0, 0, f, -this.direction * this.options.angular.range[0] - this.intercept, -this.direction * this.options.angular.range[1] - this.intercept, this.direction === ar.ANTICLOCKWISE), h);
if (this.options.radial.type !== z.band) {
const h = this.radialScale.ticks(5).map(this.radialScale), f = this.radialGrid.selectAll("path").data(h);
f.exit().remove(), f.enter().append("path").merge(f).attr("d", (d) => n(eu(), d));
}
let r;
if (this.options.angular.type === z.time) {
const f = this.angularScale.copy().domain().map((m) => {
const y = I.fromJSDate(m).setZone(this.options.angular.timeZone);
return new Date(m.getTime() + y.offset * 6e4);
});
r = cn().domain(f).ticks(10).map((m) => {
const y = I.fromJSDate(m).setZone(this.options.angular.timeZone);
return new Date(m.getTime() - y.offset * 6e4);
});
} else {
const h = this.options.angular.domain;
let f = Bn(h[0], h[1], 8);
f = nh(f);
const d = Math.ceil(h[0] / f) * f, p = Math.floor(h[1] / f + 1) * f;
r = Ks(d, p, f);
}
Math.cos(this.options.angular.range[0]) - Math.cos(this.options.angular.range[1]) < 1e-6 && Math.sin(this.options.angular.range[0]) - Math.sin(this.options.angular.range[1]) < 1e-6 && r.shift();
const i = this.angularGrid.selectAll("line").data(r);
i.exit().remove(), i.enter().append("line").merge(i).attr("x1", this.innerRadius).attr("y1", 0).attr("x2", this.outerRadius).attr("y2", 0).attr("transform", (h) => "rotate(" + this.radToDegrees(-this.intercept - this.direction * this.angularScale(h)) + ")");
const s = (function(h) {
return "rotate(" + this.radToDegrees(-this.direction * this.angularScale(h)) + ")";
}).bind(this), o = this.angularAxis.selectAll("g").data(r).enter().append("g").attr("class", "tick").attr("transform", s);
o.append("line"), o.append("text"), this.angularAxis.selectAll(".tick").select("line").attr("x1", this.outerRadius).attr("y1", 0).attr("x2", this.outerRadius + 6).attr("y2", 0);
const l = (function(h) {
return "rotate(" + this.radToDegrees(this.direction * this.angularScale(h) + this.intercept) + "," + (this.outerRadius + 15) + ",0)";
}).bind(this), u = (function(h) {
const f = (this.radToDegrees(Math.PI / 2 - this.intercept - this.direction * this.angularScale(h)) % 360 + 360) % 360;
return f > 0 && f < 180 ? "start" : f > 180 && f < 360 ? "end" : "middle";
}).bind(this), c = this.options.angular.format ? this.options.angular.format : (h) => h;
this.angularAxis.selectAll(".tick").select("text").attr("text-anchor", u).attr("alignment-baseline", "middle").attr("x", this.outerRadius + 15).attr("y", 0).text(c).attr("transform", l), this.updateCanvas();
}
setRange() {
switch (this.options.angular.type) {
case z.time:
this.angularScale = cn();
break;
case z.value:
default:
this.angularScale = wt();
}
switch (this.angularScale.domain(this.options.angular.domain).range(this.options.angular.range), this.options.radial.type) {
case z.time:
this.radialScale = cn();
break;
case z.band:
this.radialScale = vn();
break;
case z.value:
default:
this.radialScale = wt();
}
this.radialScale.range([this.innerRadius, this.outerRadius]);
}
initGrid() {
this.radialGrid = this.canvas.append("g").attr("class", "grid r-grid"), this.angularGrid = this.canvas.append("g").attr("class", "grid t-grid"), this.radialAxis = this.canvas.append("g").attr("class", "axis r-axis").attr("font-family", "sans-serif"), this.angularAxis = this.canvas.append("g").attr("class", "axis t-axis").attr("transform", "rotate(" + -this.intercept * 180 / Math.PI + ")").attr("font-family", "sans-serif"), this.update();
}
}
function o1(e, t, n) {
const r = n ? e.filter(n) : e;
if (r.length === 0)
return [void 0, void 0];
if (Array.isArray(r[0][t])) {
const i = Ca(r, function(a) {
if (a[t] !== null)
return Ca(a[t]);
}), s = Hr(r, function(a) {
if (a[t] !== null)
return Hr(a[t]);
});
return [i, s];
} else
return _t(r, (i) => i[t]);
}
function l1(e, t) {
return e.startsWith("rgba") || e.startsWith("hsla") ? e.replace(/[\d\.]+\)/, `${t})`) : e.startsWith("#") && e.length === 9 ? e.slice(0, -2) + Math.round(255 * t).toString(16).toUpperCase() : e;
}
const _n = 1;
var zs;
(function(e) {
e.Top = "top", e.Bottom = "bottom";
})(zs || (zs = {}));
var xt;
(function(e) {
e.Linear = "linear", e.Basis = "basis", e.Step = "step", e.StepAfter = "stepAfter", e.StepBefore = "stepBefore";
})(xt || (xt = {}));
const u1 = ["x", "x1", "y", "radial", "angular"];
class Rt {
constructor(t, n) {
Object.defineProperty(this, "_data", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "datum", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_extent", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_isVisible", {
enumerable: !0,
configurable: !0,
writable: !0,
value: !0
}), Object.defineProperty(this, "highlight", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "colorMap", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "id", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axisIndex", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "style", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "cssSelector", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "legend", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), this.data = t, this.options = qt({}, n, {
radial: { includeInTooltip: !0, includeInAutoScale: !0 },
angular: { includeInTooltip: !0, includeInAutoScale: !0 },
x: { includeInTooltip: !0, includeInAutoScale: !0 },
y: { includeInTooltip: !0, includeInAutoScale: !0 },
transitionTime: 100
}), this.colorMap = Mi(ca);
}
set data(t) {
this._data = t, this.extent = void 0;
}
get data() {
return this._data;
}
set extent(t) {
this._extent = t;
}
get extent() {
var t;
this._extent || (this._extent = {});
for (const n in this.dataKeys) {
const r = this.dataKeys[n];
this._extent[r] === void 0 && (this._extent[r] = o1(this._data, r, (t = this.options[n]) == null ? void 0 : t.extentFilter));
}
return this._extent;
}
get visible() {
return this._isVisible;
}
set visible(t) {
var n, r;
t ? (this.group.style("visibility", "visible"), (n = this.highlight) == null || n.style("visibility", "visible")) : (this.group.style("visibility", "hidden"), (r = this.highlight) == null || r.style("visibility", "hidden")), this._isVisible = t;
}
addTo(t, n, r, i) {
return this.id = r || "", typeof i == "string" ? this.cssSelector = i : this.style = i, this.axisIndex = n, n.x && n.x.axisIndex === void 0 && (this.axisIndex.x.axisIndex = 0), n.y && n.y.axisIndex === void 0 && (this.axisIndex.y.axisIndex = 0), n.radial && n.radial.axisIndex === void 0 && (this.axisIndex.radial.axisIndex = 0), n.angular && n.angular.axisIndex === void 0 && (this.axisIndex.angular.axisIndex = 0), t.charts.push(this), this;
}
setOptions(t) {
for (const n of u1)
n in t && t[n].extentFilter !== void 0 && (this._extent[n] = void 0);
ir(this.options, t);
}
setAxisIndex(t) {
ir(this.axisIndex, t);
}
plotter(t, n) {
t instanceof ih ? this.plotterCartesian(t, n) : t instanceof yl && this.plotterPolar(t, n);
}
mouseOverFormatterCartesian(t, n) {
var r;
return ((r = this.options.mouseover) == null ? void 0 : r.formatter) === void 0 ? this.defaultMouseOverFormatterCartesian(t, n) : this.options.mouseover.formatter(t, n);
}
defaultMouseOverFormatterCartesian(t, n) {
var r;
if (t) {
let i = (r = t.style) == null ? void 0 : r.color;
i && (i = l1(i, 1));
const s = t.point;
if (s.y !== void 0) {
const a = this.mouseOverTextFormatter(s.y, n), o = document.createElement("span");
return o.style.color = i, o.innerText = a, o;
}
}
}
defaultMouseOverTextFormatter(t, n) {
const r = de("f");
r.precision = n;
const i = Mt(r.toString());
if (Array.isArray(t))
return [...t].sort((a, o) => a - o).map(i).join("–");
if (typeof t == "number")
return i(t);
if (t instanceof Date)
return t.toISOString();
}
mouseOverTextFormatter(t, n) {
var r;
return ((r = this.options.mouseover) == null ? void 0 : r.textFormatter) === void 0 ? this.defaultMouseOverTextFormatter(t, n) : this.options.mouseover.textFormatter(t, n);
}
defaultToolTipFormatterCartesian(t) {
const n = this.dataKeys.x, r = this.dataKeys.y, i = document.createElement("div");
if (this.options.x.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText(t[n], n, 2), i.appendChild(s);
}
if (this.options.y.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText(t[r], r, 2), i.appendChild(s);
}
return i;
}
toolTipFormatterCartesian(t) {
if (this.options.tooltip !== void 0)
return this.options.tooltip.toolTipFormatter === void 0 ? this.defaultToolTipFormatterCartesian(t) : this.options.tooltip.toolTipFormatter(t);
}
toolTipFormatterPolar(t) {
if (this.options.tooltip !== void 0)
return this.options.tooltip.toolTipFormatter === void 0 ? this.defaultToolTipFormatterPolar(t) : this.options.tooltip.toolTipFormatter(t);
}
defaultToolTipFormatterPolar(t) {
const n = this.dataKeys.angular, r = this.dataKeys.radial, i = document.createElement("div");
if (this.options.angular.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText(t[n], n, 0), i.appendChild(s);
}
if (this.options.radial.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText(t[r], r, 0), i.appendChild(s);
}
return i;
}
defaultToolTipText(t, n, r) {
return t instanceof Array ? t[0] != t[1] ? n + ": " + t[0].toFixed(r) + " - " + t[1].toFixed(r) : n + ": " + t[0].toFixed(r) : typeof t == "number" ? n + ": " + t.toFixed(r) : n + ": " + t;
}
legendId(t) {
return this.legend.findIndex((n) => n === t);
}
onPointerOver() {
}
onPointerMove(t, n, r) {
}
onPointerOut() {
}
findXIndex(t, n) {
const r = this.datum;
if (r.length === 0)
return;
const i = this.dataKeys.x, s = this.dataKeys.y;
let a = (u) => Dt(u[s]);
Array.isArray(r[0][s]) && (a = (u) => Dt(u[s][0]));
const o = te((u) => u[i])[n === "middle" ? "center" : "left"];
let l = o(r, t);
if (n === "left" && (l = l - 1), !(l === 0 && r[l][i] > t) && !(l === r.length - 1 && r[l][i] < t) && !(!r[l] || a(r[l])) && !(n === "middle" && (t < r[l][i] && a(r[l - 1]) || t > r[l][i] && a(r[l + 1]))))
return l;
}
selectGroup(t, n) {
if (this.group === void 0) {
if (this.group = t.chartGroup.append("g"), t instanceof yl) {
const r = -t.direction, i = 90 - 180 * t.intercept / Math.PI;
this.group.attr("transform", "rotate(" + i + ")scale(" + r + " ,1)");
}
this.group.attr("data-chart-id", this.id), this.cssSelector ? (this.cssSelector.lastIndexOf("#", 0) === 0 && this.group.attr("id", this.cssSelector.substring(1)), this.cssSelector.lastIndexOf(".", 0) === 0 ? this.group.attr("class", n + " " + this.cssSelector.substring(1)) : this.group.attr("class", n)) : this.style && Object.entries(this.style).forEach(([r, i]) => this.group.style(r, i));
}
return this.group;
}
selectHighlight(t, n) {
if (this.highlight === void 0) {
const r = t.canvas.select(".front");
this.highlight = r.append("g").attr("clip-path", "url(#" + t.clipPathId + ")"), this.highlight.attr("data-chart-id", this.id), this.highlight.append(n);
}
return this.highlight;
}
get dataKeys() {
const t = {};
for (const n in this.axisIndex)
t[n] = this.axisIndex[n].key ? this.axisIndex[n].key : n;
return t;
}
get curveGenerator() {
if (this.options.curve === void 0)
return;
let t;
switch (this.options.curve) {
case xt.Basis:
t = Iy;
break;
case xt.Linear:
t = Oi;
break;
case xt.Step:
t = Ay;
break;
case xt.StepAfter:
t = Nu;
break;
case xt.StepBefore:
t = Ny;
}
return t;
}
mapDataCartesian(t) {
const n = this.dataKeys.x, r = te(function(a) {
return a[n];
});
let i = r.right(this.data, t[0]), s = r.left(this.data, t[1]);
return i = i > 0 ? i - 1 : 0, s = s < this.data.length - 1 ? s + 1 : this.data.length, this.data.slice(i, s);
}
applyStyle(t, n, r) {
if (this.style === void 0) {
const i = window.getComputedStyle(t);
for (const s of r)
n.style(s, i.getPropertyValue(s));
} else
for (const i of r)
this.style[i] && n.style(i, this.style[i]);
}
}
class S1 extends Rt {
constructor() {
super(...arguments), Object.defineProperty(this, "_areaGenerator", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
});
}
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.y, s = this.dataKeys.color, a = t.xScales[n.x.axisIndex], o = t.yScales[n.y.axisIndex];
this.highlight = this.selectHighlight(t, "path");
const l = this.highlight.select("path").style("opacity", 0).style("stroke-width", 1);
this.highlight.append("marker").attr("id", "marker-" + this.id).attr("viewBox", "-5 -5 10 10").attr("markerWidth", 10).attr("markerHeight", 10).attr("stroke", "currentColor").attr("orient", 90).append("path").attr("d", "M0,-5v10");
let u;
switch (this.options.curve) {
case xt.StepAfter:
case xt.StepBefore:
break;
default:
u = "tick";
}
u ? (l.attr("marker-start", "url(#marker-" + this.id + ")"), l.attr("marker-mid", "url(#marker-" + this.id + ")"), l.style("stroke", "none")) : l.style("fill", "currentColor");
const c = wt().domain([0, 1]);
this.options.colorScale === _n && c.domain(_t(this.data, function(m) {
return m[s];
}));
const h = te(function(m) {
return m[r];
});
let f = h.right(this.data, a.domain()[0]), d = h.left(this.data, a.domain()[1]);
f = f > 0 ? f - 1 : 0, d = d < this.data.length - 1 ? d + 1 : this.data.length, this.datum = this.data, this.group = this.selectGroup(t, "chart-area"), this.group.select("path").size() === 0 && this.group.append("path");
const p = Tu().x(function(m) {
return a(m[r]);
});
this.data !== void 0 && this.data.length > 0 && Array.isArray(this.data[0][i]) ? p.defined((m) => !Dt(m[i][0]) && !Dt(m[i][1])).y0(function(m) {
return o(m[i][0]);
}).y1(function(m) {
return o(m[i][1]);
}) : p.defined((m) => !Dt(m[i])).y0(function(m) {
return o(0);
}).y1(function(m) {
return o(m[i]);
});
const g = this.curveGenerator;
g !== void 0 && p.curve(g), this._areaGenerator = p, this.group.select("path").datum(this.data.slice(f, d)).join("path").attr("d", p);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
plotterPolar(t, n) {
console.error("plotterPolar is not implemented for ChartArea");
}
drawLegendSymbol(t, n) {
const r = ["fill"], i = this.group.select("path").node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("rect").attr("x", 0).attr("y", -5).attr("width", 20).attr("height", 10);
return this.applyStyle(i, o, r), n ? o.node() : s.node();
}
onPointerOver() {
const t = this.group.select("path");
if (t.node() === null)
return;
const n = window.getComputedStyle(t.node()).getPropertyValue("fill");
this.highlight.select("path").style("opacity", 1).style("fill", n).attr("transform", null);
}
onPointerOut() {
this.highlight.select("path").style("opacity", 0);
}
onPointerMove(t, n, r) {
var h;
let i = ((h = this.options.tooltip) == null ? void 0 : h.alignment) ?? "middle";
(this.options.curve === xt.StepBefore || this.options.curve === xt.StepAfter) && (i = "right");
const s = this.findXIndex(t, i);
s === void 0 && this.highlight.select("path").style("opacity", 0);
const a = this.datum[s - 1], o = this.datum[s];
if (a === void 0)
return;
const l = [];
switch (this.options.curve) {
case xt.StepAfter:
l.push({
x: a[this.dataKeys.x],
y: a[this.dataKeys.y]
}), l.push({
x: o[this.dataKeys.x],
y: a[this.dataKeys.y]
});
break;
case xt.StepBefore:
l.push({
x: a[this.dataKeys.x],
y: o[this.dataKeys.y]
}), l.push({
x: o[this.dataKeys.x],
y: o[this.dataKeys.y]
});
break;
default:
l.push({
x: o[this.dataKeys.x],
y: o[this.dataKeys.y]
});
}
const u = this.options.curve === xt.StepBefore ? l[1] : l[0];
this.highlight.select("path").datum(l).join("path").attr("d", this._areaGenerator).style("opacity", 1);
const c = this.group.select("path");
if (c.node() === null)
return { point: u, style: {} };
{
const f = window.getComputedStyle(c.node()).getPropertyValue("fill");
return { point: u, style: { color: f } };
}
}
}
const qn = 2.5, Yn = {
draw: function(e, t) {
let n = Math.sqrt(t * qn);
const r = n / qn;
n = n / 3, e.moveTo(0, 0), e.lineTo(-r, n), e.lineTo(0, -2 * n), e.lineTo(r, n), e.closePath();
}
};
function Nr(e) {
return e instanceof Array ? hi(e) : e;
}
const c1 = {
size: 10
};
class T1 extends Rt {
constructor(t, n) {
super(t, n), Object.defineProperty(this, "previousData", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), this.options = qt(this.options, this.options, { symbol: c1 });
}
defaultToolTipFormatterCartesian(t) {
throw new Error("defaultToolTipFormatterCartesian is not implemented for ChartArrow");
}
defaultToolTipFormatterPolar(t) {
const n = this.dataKeys.angular, r = this.dataKeys.radial, i = document.createElement("div");
if (this.options.angular.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText([t[0][n][0], t[0][n][1]], n, 0), i.appendChild(s);
}
if (this.options.radial.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText([t[0][r][0], t[0][r][1]], r, 0), i.appendChild(s);
}
return i;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
plotterCartesian(t, n) {
throw new Error("plotterCartesian is not implemented for ChartArrow");
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
plotterPolar(t, n) {
const r = this.dataKeys.radial, i = this.dataKeys.angular, s = this.options.symbol.size;
function a(c) {
const h = t.radialScale(c[r][0]), f = t.radialScale(c[r][1]), d = t.angularScale(c[i][0]), p = t.angularScale(c[i][1]), g = Math.sqrt(h ** 2 + f ** 2 - 2 * h * f * Math.cos(d - p));
let m = Math.sqrt(s * qn);
const y = m / qn;
return m = m / 3, `M0,0
L0,${-(g - 2 * m)}
L${y},${-(g - 3 * m)}
L0,${-g}
L${-y},${-(g - 3 * m)}
L0,${-(g - 2 * m)}`;
}
function o(c) {
return function(h, f, d) {
if (c.length === 0)
return function(b) {
return "translate()";
};
const p = c[f];
Nr(p[i][0]) - Nr(h[f][i][0]) > 180 ? p[i][0] = p[i][0] - 360 : Nr(p[i][0]) - Nr(h[f][i][0]) < -180 && (p[i][0] = p[i][0] + 360);
const g = Pt(p[i][0], h[f][i][0]), m = Pt(p[i][1], h[f][i][1]), y = Pt(p[r][0], h[f][r][0]), x = Pt(p[r][1], h[f][r][1]);
return function(b) {
const v = t.angularScale(g(b)), w = t.angularScale(m(b)), S = t.radialScale(y(b)), _ = t.radialScale(x(b)), A = -S * Math.sin(-v), F = -_ * Math.sin(-w), N = -S * Math.cos(-v), k = -_ * Math.cos(-w), $ = Math.atan2(k - N, F - A), C = Math.PI / 2 + $;
return "translate(" + A + "," + N + ") rotate(" + t.radToDegrees(C) + ")";
};
};
}
this.group = this.selectGroup(t, "chart-arrow"), this.group.select("path").size() === 0 && this.group.append("path");
const l = this.group.select("path").data(this.data), u = ee().duration(this.options.transitionTime).ease(Ae);
l.transition(u).attr("d", (c, h) => a(this.data[h])), l.transition(u).attrTween("transform", o(this.previousData)), l.join("path").datum(this.data), this.options.tooltip !== void 0 && l.on("pointerover", (c, h) => {
t.tooltip.show();
const f = J(c, t.container);
t.tooltip.update(this.toolTipFormatterPolar(h), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, f[0], f[1]);
}).on("pointerout", () => {
t.tooltip.hide();
}), this.previousData = this.data;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
drawLegendSymbol(t, n) {
const r = ["stroke", "stroke-width", "stroke-dasharray", "fill"], i = this.group.select("path").node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("g"), l = Math.sqrt(this.options.symbol.size * qn) / 3 * 2, u = o.append("line").attr("x1", 0).attr("x2", l).attr("y1", 0).attr("y2", 0), c = o.append("path").attr("d", Oe().type(Yn).size(this.options.symbol.size)).attr("transform", `translate(${l}, 0) rotate(90)`);
return this.applyStyle(i, u, r), this.applyStyle(i, c, r), n ? o.node() : s.node();
}
}
class sh extends Rt {
constructor() {
super(...arguments), Object.defineProperty(this, "_xRect", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "_widthRect", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
});
}
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.y, s = this.dataKeys.x1, a = this.dataKeys.color, o = t.xScales[n.x.axisIndex], l = t.yScales[n.y.axisIndex];
let u = this.mapDataCartesian(o.domain());
const c = o.copy();
this.setPadding(c, this.options.x), this.highlight = this.selectHighlight(t, "rect"), this.highlight.select("rect").style("opacity", 0).style("stroke-width", "1px");
const h = wt().domain([0, 1]);
this.options.colorScale === _n && h.domain(_t(this.data, function(m) {
return m[a];
}));
const f = this.getColorMap(h);
this.group = this.selectGroup(t, sh.GROUP_CLASS);
let d = (m, y) => y === 0 ? 0 : o(u[y - 1][r]), p = (m, y) => y === 0 ? o(u[y][r]) : o(u[y][r]) - o(u[y - 1][r]);
if (s) {
const m = Array.from(new Set(this.data.map((x) => x[s])));
this.legend = m, c.domain(this.data.map((x) => x[r]));
const y = vn().domain(m).range([0, c.bandwidth()]);
this.setPadding(y, this.options.x1), d = (x) => c(x[r]) + y(x[s]), p = () => y.bandwidth(), u = this.data;
}
this.datum = u, this._xRect = d, this._widthRect = p;
const g = this.group.selectAll("rect").data(u).join("rect").attr("data-legend-id", (m) => this.legendId(m[s])).attr("x", d).attr("y", (m) => m[i] === null ? l(0) : Math.min(l(m[i]), l(0))).attr("width", p).attr("height", function(m) {
return m[i] === null ? 0 : Math.abs(l(0) - l(m[i]));
}).attr("fill", (m) => m[a] !== null ? f(m[a]) : "none");
if (this.options.tooltip !== void 0 && g.on("pointerover", (m, y) => {
const x = m.target;
t.tooltip.show(), this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Bottom && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Bottom, " instead."), t.tooltip.update(this.toolTipFormatterCartesian(y), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, t.margin.left + +x.getAttribute("x") + +x.getAttribute("width") / 2, t.margin.top + +x.getAttribute("y"));
}).on("pointerout", () => {
t.tooltip.hide();
}), g.data(u).order().attr("x", d), this.options.text !== void 0) {
const m = this.group.selectAll("text").data(u).join("text");
m.attr("x", (y, x) => d(y, x) + p(y, x) / 2).attr("y", (y) => Math.min(l(y[i]), l(0))).attr("dx", this.options.text.dx).attr("dy", this.options.text.dy).text((y) => this.options.text.formatter(y));
for (const [y, x] of Object.entries(this.options.text.attributes))
m.attr(y, x);
}
}
plotterPolar(t, n) {
throw new Error("plotterPolar is not implemented for ChartBar");
}
drawLegendSymbol(t, n) {
const r = ["fill"], i = this.group.select(`[data-legend-id="${t}"]`).node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("g");
return o.append("rect").attr("x", 5).attr("y", -5).attr("width", 10).attr("height", 10), this.applyStyle(i, o, r), n ? o.node() : s.node();
}
getColorMap(t) {
var n, r;
return (n = this.options.color) != null && n.map ? (r = this.options.color) == null ? void 0 : r.map : (i) => Mi(ca)(t(i));
}
setPadding(t, n) {
n != null && n.paddingOuter && t.paddingOuter(n.paddingOuter), n != null && n.paddingInner && t.paddingInner(n.paddingInner);
}
onPointerOver() {
this.highlight.select("rect").style("opacity", 1).style("fill", () => {
const t = this.group.select("rect");
if (t.node() !== null)
return window.getComputedStyle(t.node()).getPropertyValue("fill");
}).style("stroke", "currentColor");
}
onPointerOut() {
this.highlight.select("rect").style("opacity", 0);
}
onPointerMove(t, n, r) {
const i = this.findXIndex(t), s = this.datum[i];
if (s === void 0) {
this.highlight.select("rect").style("opacity", 0);
return;
}
this.highlight.select("rect").style("opacity", 1).attr("y", Math.min(r(s.y), r(0))).attr("height", Math.abs(r(0) - r(s.y))).attr("x", (o) => this._xRect(o, i)).attr("width", (o) => this._widthRect(o, i));
const a = this.group.select("rect");
if (a.node() === null)
return { point: s, style: {} };
{
const o = window.getComputedStyle(a.node()).getPropertyValue("fill");
return { point: s, style: { color: o } };
}
}
}
function Pr(e) {
return e instanceof Array ? hi(e) : e;
}
const h1 = {
id: 0,
size: 10,
skip: 0
};
class _1 extends Rt {
constructor(t, n) {
super(t, n), Object.defineProperty(this, "previousData", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), this.options = qt(this.options, this.options, { symbol: h1 });
}
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.value, s = this.dataKeys.y, a = t.xScales[n.x.axisIndex], o = t.yScales[n.y.axisIndex], l = this.mapDataCartesian(a.domain());
let u = 1;
l.length > 2 && this.options.symbol.skip === 0 && (u = Math.ceil(1 / (a(l[1][r]) - a(l[0][r])) * Math.sqrt(this.options.symbol.size) * 2)), this.group = this.selectGroup(t, "chart-marker").datum(l);
const c = this.group.selectAll("g").data((h) => h.filter((f, d) => (d + 1) % u === 0 ? f : void 0));
c.exit().remove(), c.enter().append("g").attr("transform", (h, f) => "translate(" + a(h[r]) + "," + o(h[i]) + ")").append("path").attr("d", Oe().type(Yn).size(this.options.symbol.size)).attr("transform", (h, f) => `rotate(${h[s] - 180})`), this.options.tooltip !== void 0 && c.on("pointerover", (h, f) => {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Pointer && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Pointer, " instead."), t.tooltip.show();
const d = J(h, t.container);
t.tooltip.update(this.toolTipFormatterPolar(f), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, d[0], d[1]);
}).on("pointerout", () => {
t.tooltip.hide();
}), c.attr("transform", (h, f) => "translate(" + a(h[r]) + "," + o(h[i]) + ")").select("path").attr("d", Oe().type(Yn).size(this.options.symbol.size)).attr("transform", (h, f) => `rotate(${h[s] - 180})`);
}
plotterPolar(t, n) {
this.group = this.selectGroup(t, "chart-marker");
const r = this.dataKeys.radial, i = this.dataKeys.angular, s = this.group.selectAll("path").data(this.data);
function a(l) {
return function(u, c, h) {
const f = l[c];
Pr(f[i]) - Pr(u[i]) > 180 ? f[i] = f[i] - 360 : Pr(f[i]) - Pr(u[i]) < -180 && (f[i] = f[i] + 360);
const d = Pt(f[i], u[i]), p = Pt(f[r], u[r]);
return function(g) {
const m = t.angularScale(d(g)), y = t.radialScale(p(g));
return "translate(" + -y * Math.sin(-m) + "," + -y * Math.cos(-m) + ") rotate(" + t.radToDegrees(m) + ")";
};
};
}
s.exit().remove(), s.enter().append("path").attr("transform", (l, u) => {
const c = t.radialScale(l[r]), h = t.angularScale(l[i]);
return "translate(" + -c * Math.sin(-h) + "," + -c * Math.cos(-h) + ")";
}).attr("d", Oe().type(Yn).size(this.options.symbol.size)).merge(s), this.options.tooltip !== void 0 && s.on("pointerover", (l, u) => {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Pointer && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Pointer, " instead.");
const c = J(l, t.container), h = c[0], f = c[1];
t.tooltip.show(), t.tooltip.update(this.toolTipFormatterPolar(u), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, h, f);
}).on("pointerout", () => {
t.tooltip.hide();
});
const o = ee().duration(this.options.transitionTime).ease(Ae);
s.transition(o).attrTween("transform", a(this.previousData)), this.previousData = this.data;
}
drawLegendSymbol(t, n) {
const r = ["fill", "stroke"], i = this.group.select("path").node(), s = Lt("svg").append("svg").attr("width", 20).attr("height", 20), a = s.append("g").attr("transform", "translate(10, 0)"), o = a.append("path").attr("d", Oe().type(Yn).size(this.options.symbol.size));
return this.applyStyle(i, o, r), n ? a.node() : s.node();
}
}
class M1 extends Rt {
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.y, s = this.dataKeys.color, a = this.data, o = t.xScales[n.x.axisIndex], l = t.yScales[n.y.axisIndex], u = vn().domain(a.map(function(m) {
return m[r];
}));
u.range(o.range()), this.setPadding(u, this.options.x);
const c = wt().domain([0, 1]);
this.options.colorScale === _n && c.domain(_t(this.data, function(m) {
return m[s];
}));
const h = this.colorMap;
this.group = this.selectGroup(t, "chart-range");
const f = ee().duration(this.options.transitionTime).ease(Ae), d = this.group.selectAll("rect").data(this.data);
d.exit().remove();
const p = d.enter().append("rect").attr("y", function(m) {
return m[i] === null ? l(0) : Math.min(l(m[i]), l(0));
}).attr("height", function(m) {
return m[i] === null ? 0 : Math.abs(l(0) - l(m[i]));
}).merge(d).attr("x", function(m) {
return u(m[r]);
}).attr("width", u.bandwidth()), g = this;
g.options.tooltip !== void 0 && p.on("pointerover", function(m, y) {
g.options.tooltip.anchor !== void 0 && g.options.tooltip.anchor !== G.Top && console.error("Tooltip not implemented for anchor ", g.options.tooltip.anchor, ", using ", G.Top, " instead."), t.tooltip.show(), t.tooltip.update(g.toolTipFormatterCartesian(y), g.options.tooltip.position !== void 0 ? g.options.tooltip.position : it.Top, t.margin.left + u(y[r]) + u.bandwidth() / 2, t.margin.top + Math.min(l(y[i]), l(0)));
}).on("pointerout", () => {
t.tooltip.hide();
}), p.style("fill", function(m) {
return h(c(m[s]));
}), d.transition(f).style("fill", function(m) {
return h(c(m[s]));
}).attr("y", function(m) {
return m[i] === null ? l(0) : Math.min(l(m[i]), l(0));
}).attr("height", function(m) {
return m[i] === null ? 0 : Math.abs(l(0) - l(m[i]));
});
}
plotterPolar(t, n) {
throw new Error("plotterPolar is not implemented for ChartHistogram");
}
drawLegendSymbol(t, n) {
const r = ["fill"], i = this.group.select("rect").node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("g");
return o.append("rect").attr("x", 0).attr("y", -8).attr("width", 5).attr("height", 18), this.applyStyle(i, o, r), o.append("rect").attr("x", 5).attr("y", -6).attr("width", 5).attr("height", 16), this.applyStyle(i, o, r), o.append("rect").attr("x", 10).attr("y", -5).attr("width", 5).attr("height", 15), this.applyStyle(i, o, r), n ? o.node() : s.node();
}
setPadding(t, n) {
n != null && n.paddingOuter && t.paddingOuter(n.paddingOuter), n != null && n.paddingInner && t.paddingInner(n.paddingInner);
}
}
class k1 extends Rt {
defaultToolTipFormatterCartesian(t) {
const n = this.dataKeys.x, r = this.dataKeys.y, i = document.createElement("div");
if (this.options.x.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText([t[0][n], t[1][n]], n, 2), i.appendChild(s);
}
if (this.options.y.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText([t[0][r], t[1][r]], r, 2), i.appendChild(s);
}
return i;
}
defaultToolTipFormatterPolar(t) {
const n = this.dataKeys.angular, r = this.dataKeys.radial, i = document.createElement("div");
if (this.options.angular.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText([t[0][n], t[1][n]], n, 0), i.appendChild(s);
}
if (this.options.radial.includeInTooltip) {
const s = document.createElement("span");
s.innerText = this.defaultToolTipText([t[0][r], t[1][r]], r, 0), i.appendChild(s);
}
return i;
}
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.y, s = t.xScales[n.x.axisIndex], a = t.yScales[n.y.axisIndex], o = this.mapDataCartesian(s.domain());
this.datum = o, this.highlight = this.selectHighlight(t, "circle"), this.highlight.select("circle").attr("r", 3).style("opacity", 0).style("stroke-width", "1px");
const l = Ci().x(function(h) {
return s(h[r]);
}).y(function(h) {
return a(h[i]);
}).defined(function(h) {
return h[i] != null;
}), u = this.curveGenerator;
u !== void 0 && l.curve(u), this.group = this.selectGroup(t, "chart-line"), this.group.select("path").size() === 0 && this.group.append("path");
const c = this.group.select("path").datum(o).join("path").attr("d", l);
this.options.tooltip !== void 0 && c.on("pointerover", (h, f) => {
t.tooltip.show();
const d = J(h, t.container);
t.tooltip.update(this.toolTipFormatterCartesian(f), it.Top, d[0], d[1]);
}).on("pointerout", () => {
t.tooltip.hide();
});
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
plotterPolar(t, n) {
const r = this.dataKeys.radial, i = this.dataKeys.angular, s = ku().angle(function(l) {
return t.angularScale(l[i]);
}).radius(function(l) {
return t.radialScale(l[r]);
});
this.group = this.selectGroup(t, "chart-line"), this.group.select("path").size() === 0 && this.group.append("path");
const a = this.group.select("path"), o = ee().duration(this.options.transitionTime).ease(Ae);
a.transition(o).attr("d", s(this.data)), a.join("path").datum(this.data), this.options.tooltip !== void 0 && a.on("pointerover", (l, u) => {
t.tooltip.show();
const c = J(l, t.container);
t.tooltip.update(this.toolTipFormatterPolar(u), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, c[0], c[1]);
}).on("pointerout", () => {
t.tooltip.hide();
});
}
drawLegendSymbol(t, n) {
const r = ["stroke", "stroke-width", "stroke-dasharray"], i = this.group.select("path").node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("line").attr("x1", 0).attr("x2", 20).attr("y1", 0).attr("y2", 0);
return this.applyStyle(i, o, r), n ? o.node() : s.node();
}
onPointerOver() {
this.highlight.select("circle").style("opacity", 1).style("fill", () => {
const t = this.group.select("path");
if (t.node() !== null)
return window.getComputedStyle(t.node()).getPropertyValue("stroke");
}).attr("transform", null);
}
onPointerOut() {
this.highlight.select("circle").style("opacity", 0);
}
onPointerMove(t, n, r) {
var l;
const i = this.findXIndex(t, ((l = this.options.tooltip) == null ? void 0 : l.alignment) ?? "middle"), s = this.datum[i];
if (s === void 0) {
this.highlight.select("circle").style("opacity", 0);
return;
}
const a = this.group.select("path"), o = a.node() === null ? null : window.getComputedStyle(a.node()).getPropertyValue("stroke");
return this.highlight.select("circle").attr("transform", () => `translate(${n(s.x)}, ${r(s.y)})`).style("opacity", 1).style("fill", o), o === null ? { point: s, style: {} } : { point: s, style: { color: o } };
}
}
const f1 = {
id: 0,
size: 10,
skip: 1
};
class O1 extends Rt {
constructor(t, n) {
super(t, n), this.options = qt(this.options, this.options, { symbol: f1 });
}
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.y, s = t.xScales[n.x.axisIndex], a = t.yScales[n.y.axisIndex], o = this.options.symbol.skip, l = this.mapDataCartesian(s.domain()).filter((m, y) => y % o === 0 && m[i] !== null);
this.datum = l, this.highlight = this.selectHighlight(t, "circle"), this.highlight.select("circle").attr("r", 3).style("opacity", 0).style("stroke-width", "1px");
const u = Ci().x(function(m) {
return s(m[r]);
}).y(function(m) {
return a(m[i]);
}).defined(function(m) {
return m[i] != null;
}), c = this.curveGenerator;
c !== void 0 && u.curve(c), this.group = this.selectGroup(t, "chart-marker"), this.group.select("path").size() === 0 && this.group.append("path");
const h = this.options.symbol.size, f = this.options.symbol.id, d = `marker-${f}-${h}`;
t.defs.select(`#${d}`).empty() && t.defs.append("marker").attr("id", d).attr("fill", "context-fill").attr("stroke", "context-stroke").attr("markerWidth", h).attr("markerHeight", h).attr("refX", h / 2).attr("refY", h / 2).append("path").attr("d", Oe(qi[f], h)).attr("transform", `translate(${h / 2}, ${h / 2})`);
const g = this.group.select("path").datum(l).join("path").attr("d", u).attr("fill-opacity", 0).attr("stroke-opacity", 0).attr("marker-start", `url(#${d})`).attr("marker-mid", `url(#${d})`).attr("marker-end", `url(#${d})`);
this.options.tooltip !== void 0 && g.on("pointerover", (m, y) => {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Pointer && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Pointer, " instead."), t.tooltip.show();
const x = J(m, t.container);
t.tooltip.update(this.toolTipFormatterPolar(y), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, x[0], x[1]);
}).on("pointerout", () => {
t.tooltip.hide();
});
}
plotterPolar(t, n) {
const r = this.dataKeys.radial, i = this.dataKeys.angular, s = ku().angle(function(f) {
return t.angularScale(f[i]);
}).radius(function(f) {
return t.radialScale(f[r]);
});
this.group = this.selectGroup(t, "chart-marker"), this.group.select("path").size() === 0 && this.group.append("path");
const a = this.options.symbol.size, o = this.options.symbol.id, l = `marker-${o}-${a}`;
t.defs.select(`#${l}`).empty() && t.defs.append("marker").attr("id", l).attr("fill", "context-fill").attr("stroke", "context-stroke").attr("markerWidth", a).attr("markerHeight", a).attr("refX", a / 2).attr("refY", a / 2).append("path").attr("d", Oe(qi[o], a)).attr("transform", `translate(${a / 2}, ${a / 2})`);
const c = this.group.select("path"), h = ee().duration(this.options.transitionTime).ease(Ae);
c.transition(h).attr("d", s(this.data)), c.join("path").datum(this.data).attr("fill-opacity", 0).attr("stroke-opacity", 0).attr("marker-start", `url(#${l})`).attr("marker-mid", `url(#${l})`).attr("marker-end", `url(#${l})`), this.options.tooltip !== void 0 && c.on("pointerover", (f, d) => {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Pointer && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Pointer, " instead.");
const p = J(f, t.container), g = p[0], m = p[1];
t.tooltip.show(), t.tooltip.update(this.toolTipFormatterPolar(d), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, g, m);
}).on("pointerout", () => {
t.tooltip.hide();
});
}
drawLegendSymbol(t, n) {
const r = ["fill", "stroke"], i = this.group.select("path").node(), s = Lt("svg").append("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("g").attr("transform", "translate(10, 0)");
return o.append("path").attr("d", Oe(qi[this.options.symbol.id], this.options.symbol.size)), this.applyStyle(i, o, r), n ? o.node() : s.node();
}
onPointerOver() {
this.highlight.select("circle").style("opacity", 1).style("fill", () => {
const t = this.group.select("path");
if (t.node() !== null)
return window.getComputedStyle(t.node()).getPropertyValue("stroke");
}).attr("transform", null);
}
onPointerOut() {
this.highlight.select("circle").style("opacity", 0);
}
onPointerMove(t, n, r) {
var l;
const i = this.findXIndex(t, ((l = this.options.tooltip) == null ? void 0 : l.alignment) ?? "middle"), s = this.datum[i];
if (s === void 0) {
this.highlight.select("rect").style("opacity", 0);
return;
}
const a = this.group.select("path"), o = a.node() === null ? null : window.getComputedStyle(a.node()).getPropertyValue("stroke");
return this.highlight.select("circle").attr("transform", () => `translate(${n(s.x)}, ${r(s.y)})`).style("opacity", 1).style("fill", o), o === null ? { point: s, style: {} } : { point: s, style: { color: o } };
}
}
class ah extends Rt {
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.y, s = this.dataKeys.color, a = this.dataKeys.value ? this.dataKeys.value : this.dataKeys.color, o = this.data, l = t.xScales[n.x.axisIndex], u = t.yScales[n.y.axisIndex], c = l.copy(), h = u.copy();
this.setPadding(c, this.options.x), this.setPadding(h, this.options.y);
const f = t.options.x[n.x.axisIndex], d = (f == null ? void 0 : f.type) === z.band, p = this.mapDataCartesian(l.domain()), g = (v, w) => w === 0 ? 0 : l(p[w - 1][r]), m = (v, w) => w === 0 ? 0 : l(p[w][r]) - l(p[w - 1][r]), y = wt().domain([0, 1]);
this.options.colorScale === _n && y.domain(_t(this.data, function(v) {
return v[s];
}));
const x = this.getColorMap(y);
this.group = this.selectGroup(t, ah.GROUP_CLASS), ee().duration(this.options.transitionTime);
const b = this.group.selectAll("rect").data(d ? o : p).join("rect").attr("display", (v) => v[a] === null ? "none" : void 0).attr("x", d ? (v) => c(v[r]) : g).attr("y", (v) => h(v[i])).attr("width", d ? c.bandwidth() : m).attr("height", h.bandwidth()).attr("stroke-width", 0).attr("shape-rendering", "crispEdges").attr("fill", (v) => v[s] !== null ? x(v[s]) : "none");
if (this.options.tooltip !== void 0 && b.on("pointerover", (v, w) => {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Top && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Top, " instead."), t.tooltip.show(), t.tooltip.update(this.toolTipFormatterCartesian(w), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, t.margin.left + c(w[r]) + c.bandwidth() / 2, t.margin.top + h(w[i]));
}).on("pointerout", () => {
t.tooltip.hide();
}), this.options.text !== void 0) {
const v = this.group.selectAll("text").data(o).join("text");
v.attr("x", (w) => c(w[r]) + c.bandwidth() / 2).attr("y", (w) => h(w[i]) + h.bandwidth() / 2).attr("dx", this.options.text.dx).attr("dy", this.options.text.dy).text((w) => this.options.text.formatter(w));
for (const [w, S] of Object.entries(this.options.text.attributes))
v.attr(w, S);
}
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
plotterPolar(t, n) {
throw new Error("plotterPolar is not implemented for ChartMatrix");
}
drawLegendSymbol(t, n) {
const r = ["fill"], i = this.group.select("rect").node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("g");
return o.append("rect").attr("x", 0).attr("y", -8).attr("width", 5).attr("height", 18), this.applyStyle(i, o, r), o.append("rect").attr("x", 5).attr("y", -6).attr("width", 5).attr("height", 16), this.applyStyle(i, o, r), o.append("rect").attr("x", 10).attr("y", -5).attr("width", 5).attr("height", 15), this.applyStyle(i, o, r), n ? o.node() : s.node();
}
getColorMap(t) {
var n, r;
return (n = this.options.color) != null && n.map ? (r = this.options.color) == null ? void 0 : r.map : (i) => Mi(ca)(t(i));
}
setPadding(t, n) {
n != null && n.paddingOuter && t.paddingOuter(n.paddingOuter), n != null && n.paddingInner && t.paddingInner(n.paddingInner);
}
}
function Er(e) {
return e instanceof Array ? hi(e) : e;
}
class C1 extends Rt {
constructor() {
super(...arguments), Object.defineProperty(this, "previousData", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
});
}
plotterCartesian(t, n) {
throw new Error("Not implemented");
}
plotterPolar(t, n) {
const r = this.dataKeys.angular, i = this.dataKeys.radial, s = this.dataKeys.color, a = t.radialScale.copy();
a.padding(0.1);
const o = oy, l = ee().duration(this.options.transitionTime).ease(Ae), u = ei().innerRadius(function(p, g) {
return a(p[i]);
}).outerRadius(function(p, g) {
return a(p[i]) + a.bandwidth();
}).startAngle(function(p, g) {
return t.angularScale(p[r][0]);
}).endAngle(function(p, g) {
return t.angularScale(p[r][1]);
}).cornerRadius(a.bandwidth() / 8);
this.group = this.selectGroup(t, "chart-range");
const c = this.group.selectAll("path").data(this.data);
c.exit().remove();
const h = c.enter().append("path").attr("d", u).attr("data-chart-element-id", (p) => p[i]);
this.options.tooltip !== void 0 && h.on("pointerover", (p, g) => {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Pointer && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Pointer, " instead.");
const m = J(p, t.container), y = m[0], x = m[1];
t.tooltip.show(), t.tooltip.update(this.toolTipFormatterPolar(g), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, y, x);
}).on("pointerout", () => {
t.tooltip.hide();
}), s && h.style("fill", (p) => o[p[s]]).style("stroke", (p) => o[p[s]]);
const f = c.transition(l).call(d, this.previousData);
s && f.style("fill", (p) => o[p[s]]).style("stroke", (p) => o[p[s]]), this.previousData = { ...this.data };
function d(p, g) {
p.attrTween("d", (m, y, x) => {
const b = g[y];
Er(b[r]) - Er(m[r]) > 180 ? b[r] = b[r].map((S) => S - 360) : Er(b[r]) - Er(m[r]) < -180 && (b[r] = b[r].map((S) => S + 360));
const v = Kr(b[r], m[r]), w = Kr(b[i], m[i]);
return function(S) {
return m[r] = v(S), m[i] = w(S), u(m);
};
});
}
}
drawLegendSymbol(t, n) {
const r = ["fill"], i = this.group.select("path").node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(10 0)").append("rect").attr("x", 0).attr("y", -5).attr("width", 20).attr("height", 10);
return this.applyStyle(i, o, r), n ? o.node() : s.node();
}
}
function $e(e) {
return e instanceof Array ? hi(e) : e;
}
class I1 extends Rt {
constructor() {
super(...arguments), Object.defineProperty(this, "previousData", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
});
}
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.y, s = t.xScales[n.x.axisIndex], a = t.yScales[n.y.axisIndex], o = this.dataKeys.color, l = wt().domain([0, 1]);
this.options.colorScale === _n && l.domain(_t(this.data, (p) => p[o]));
const u = this.colorMap;
this.group = this.selectGroup(t, "chart-range"), this.group.style("stroke", "none");
const c = this.group.selectAll("rect").data(this.data), h = ee().duration(this.options.transitionTime).ease(Ae);
c.exit().remove();
const f = c.enter().append("rect").attr("x", (p) => s(p[r][0])).attr("y", (p) => a(p[i][1])).attr("width", (p) => s(p[r][1]) - s(p[r][0])).attr("height", (p) => a(p[i][0]) - a(p[i][1]));
this.options.tooltip !== void 0 && f.on("pointerover", (p, g) => {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Center && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Center, " instead."), t.tooltip.show(), t.tooltip.update(this.toolTipFormatterCartesian(g), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, t.margin.left + (s(g[r][1]) + s(g[r][0])) / 2, t.margin.top + (a(g[i][1]) + a(g[i][0])) / 2);
}).on("pointerout", () => {
t.tooltip.hide();
}), o && f.style("fill", (p) => u(l($e(p[o]))));
const d = c.transition(h).attr("x", (p) => s(p[r][0])).attr("y", (p) => a(p[i][1])).attr("width", (p) => s(p[r][1]) - s(p[r][0])).attr("height", (p) => a(p[i][0]) - a(p[i][1]));
o && d.style("fill", (p) => p.color);
}
plotterPolar(t, n) {
const r = this.dataKeys.radial, i = this.dataKeys.angular, s = this.dataKeys.color, a = wt().domain([0, 1]);
this.options.colorScale === _n && a.domain(_t(this.data, (g) => g[s]));
const o = this.colorMap, l = ee().duration(this.options.transitionTime).ease(Ae), u = ei().innerRadius((g, m) => t.radialScale(g[r][0])).outerRadius((g, m) => t.radialScale(g[r][1])).startAngle((g, m) => t.angularScale(g[i][0])).endAngle((g, m) => t.angularScale(g[i][1]));
this.group = this.selectGroup(t, "chart-range"), this.group.style("stroke", "none");
const c = this.group.selectAll("path").data(this.data);
c.exit().remove();
function h(g) {
const m = -t.direction, y = 90 - 180 * t.intercept / Math.PI, x = [
180 * t.angularScale.range()[0] / Math.PI,
180 * t.angularScale.range()[1] / Math.PI
], b = (t.angularScale.domain()[1] - t.angularScale.domain()[0]) / (x[1] - x[0]);
return (g + m * y * b + (x[0] - m * x[0]) * b) * m;
}
const f = c.enter().append("path").attr("d", u);
this.options.tooltip !== void 0 && f.on("pointerover", (g, m) => {
t.tooltip.show();
let y = 0, x = 0;
if (this.options.tooltip.anchor === G.Center) {
const b = h(m[i][0]), v = h(m[i][1]), w = ei().centroid({
innerRadius: t.radialScale(m[r][0]),
outerRadius: t.radialScale(m[r][1]),
startAngle: t.angularScale(b),
endAngle: t.angularScale(v)
});
y = t.margin.left + t.width / 2 + w[0], x = t.margin.top + t.height / 2 + w[1];
} else {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Pointer && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Pointer, " instead.");
const b = J(g, t.container);
y = b[0], x = b[1];
}
t.tooltip.update(this.toolTipFormatterPolar(m), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, y, x);
}).on("pointerout", () => {
t.tooltip.hide();
}), s && f.style("fill", (g) => o(a($e(g[s]))));
const d = c.transition(l).call(p, this.previousData);
s && d.style("fill", (g) => o(a($e(g[s])))), this.previousData = { ...this.data };
function p(g, m) {
g.attrTween("d", (y, x, b) => {
const v = m[x];
$e(v[i]) - $e(y[i]) > 180 ? v[i] = v[i].map((_) => _ - 360) : $e(v[i]) - $e(y[i]) < -180 && (v[i] = v[i].map((_) => _ + 360));
const w = Kr(v[i], y[i]), S = Kr(v[r], y[r]);
return (_) => (y[i] = w(_), y[r] = S(_), u(y));
});
}
}
drawLegendSymbol(t, n) {
const r = ["fill"], i = this.group.select("path").node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("rect").attr("x", 0).attr("y", -5).attr("width", 20).attr("height", 10);
return this.applyStyle(i, o, r), n ? o.node() : s.node();
}
}
class A1 extends Rt {
plotterCartesian(t, n) {
const r = this.dataKeys.x, i = this.dataKeys.y, s = t.xScales[n.x.axisIndex], a = t.yScales[n.y.axisIndex], o = this.mapDataCartesian(s.domain());
this.group = this.selectGroup(t, "chart-marker").datum(o);
const l = this.group.selectAll("line").data((u) => u);
l.exit().remove(), l.enter().append("line").merge(l).attr("x1", (u) => s(u[r])).attr("x2", (u) => s(u[r])).attr("y1", (u) => a(u[i][0])).attr("y2", (u) => a(u[i][1])), this.options.tooltip !== void 0 && l.on("pointerover", (u, c) => {
this.options.tooltip.anchor !== void 0 && this.options.tooltip.anchor !== G.Pointer && console.error("Tooltip not implemented for anchor ", this.options.tooltip.anchor, ", using ", G.Pointer, " instead."), t.tooltip.show();
const h = J(u, t.container);
t.tooltip.update(this.toolTipFormatterPolar(c), this.options.tooltip.position !== void 0 ? this.options.tooltip.position : it.Top, h[0], h[1]);
}).on("pointerout", () => {
t.tooltip.hide();
});
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
plotterPolar(t, n) {
console.error("plotterPolar is not implemented for ChartRule");
}
drawLegendSymbol(t, n) {
const r = ["stroke", "stroke-width"], i = this.group.select("line").node(), s = Lt("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(0, 10)").append("line").attr("x1", 10).attr("x2", 10).attr("y1", -8).attr("y2", 8);
return this.applyStyle(i, o, r), n ? o.node() : s.node();
}
}
class N1 extends Rt {
constructor(t, n) {
super(t, n), Object.defineProperty(this, "symbol", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
});
}
plotterCartesian(t, n) {
var h, f, d, p, g, m;
const r = this.dataKeys.x, i = this.dataKeys.y, s = this.dataKeys.value, a = t.xScales[n.x.axisIndex], o = n.y ? t.yScales[n.y.axisIndex] : () => {
}, l = this.mapDataCartesian(a.domain());
switch (this.group = this.selectGroup(t, "chart-marker").datum(l).attr("class", "chart-text"), (f = (h = this.options) == null ? void 0 : h.text) == null ? void 0 : f.position) {
case zs.Bottom:
this.group.attr("transform", `translate(0, ${t.height})`);
break;
}
const u = (p = (d = this.options) == null ? void 0 : d.text) != null && p.angle ? ` rotate(${this.options.text.angle})` : "", c = this.group.selectAll("text").data(this.data).join("text").attr("dominant-baseline", "middle").attr("transform", (y) => `translate(${a(y[r])}, ${o(y[i]) ?? 0})${u}`).text((y) => y[s]);
if ((m = (g = this.options) == null ? void 0 : g.text) != null && m.attributes)
for (const [y, x] of Object.entries(this.options.text.attributes))
c.attr(y, x);
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
plotterPolar(t, n) {
throw new Error("Polar axis are not supported by ChartText");
}
drawLegendSymbol(t, n) {
const r = ["stroke", "fill"], i = this.group.select("path").node(), s = Lt("svg").append("svg").attr("width", 20).attr("height", 20), o = s.append("g").attr("transform", "translate(10 10)").append("text").attr("text-anchor", "middle").text("+1.0");
return this.applyStyle(i, o, r), n ? o.node() : s.node();
}
}
class P1 {
constructor(t, n) {
Object.defineProperty(this, "labels", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "svg", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "configuredLabels", {
enumerable: !0,
configurable: !0,
writable: !0,
value: !1
}), t && (this.labels = t, this.configuredLabels = !0), this.svg = mt(n).append("svg").attr("class", "legend"), this.group = this.svg.append("g");
}
visit(t) {
this.axis = t, this.redraw();
}
redraw() {
this.updateDimensions(), this.group.attr("transform", "translate(" + this.axis.margin.left + ", 0)"), this.group.selectAll("g").remove(), this.configuredLabels || this.updateLabels();
const t = this.group.selectAll("g").data(this.labels), n = this;
let r = 1;
t.exit().remove();
const i = t.enter().append("g").attr("class", "legend-entry"), s = t.merge(i).each(function(a, o) {
const l = mt(this), u = n.axis.charts.filter((h) => h.id === a.selector), c = l.append("g");
n.createLegendSymbol(a.selector, a.legendId, c.node()), n.configuredLabels && (l.style("cursor", "pointer"), l.on("click", () => {
for (const h of u)
h.visible = !h.visible;
l.style("opacity", 0.5), n.axis.redraw();
})), l.append("text").text(a.label).attr("x", 25).attr("dominant-baseline", "middle"), r = Math.max(r, l.node().getBoundingClientRect().width);
});
this.updateLabelPositions(s, r);
}
createLegendSymbol(t, n, r) {
const i = this.axis.charts.filter((s) => s.id === t);
for (const s of i) {
const a = s.drawLegendSymbol(n, !0);
r.appendChild(a);
}
}
updateDimensions() {
this.svg.attr("width", this.axis.margin.left + this.axis.width + this.axis.margin.right).attr("height", 100);
}
updateLabels() {
this.labels = [];
for (const t of this.axis.charts)
for (const n of t.legend)
this.labels.push({
selector: t.id,
label: n,
legendId: t.legendId(n)
});
}
updateLabelPositions(t, n) {
if (this.labels.length > 0) {
const { columns: r, rows: i } = this.optimalColumnsRows(this.axis.width, n, this.labels.length), s = this.axis.width / r, a = 15, o = 25;
this.svg.attr("height", i * o), t.attr("transform", function(l, u) {
const c = Math.floor(u / i), h = u % i;
return "translate(" + c * s + "," + (a + h * o) + ")";
});
}
}
optimalColumnsRows(t, n, r) {
let i = Math.floor(t / n), s = 1;
return i >= r ? i = r : (s = Math.ceil(r / i), i = Math.ceil(r / s)), { columns: i, rows: s };
}
}
class E1 {
constructor(t, n) {
Object.defineProperty(this, "escalationLevels", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "scale", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "warningAxis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "sections", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.escalationLevels = t, this.options = {
y: { axisIndex: 0 },
...n
};
}
visit(t) {
this.axis = t, this.create(t);
}
create(t) {
const n = this.scale = wt();
this.scale.domain(t.yScales[this.options.y.axisIndex].domain()).range(t.yScales[this.options.y.axisIndex].range());
const r = this.escalationLevels, i = r.filter((a) => {
const o = n.domain();
return !Dt(a.val) && a.val >= o[0] && a.val <= o[1];
}).map((a) => a.val);
this.warningAxis = or(this.scale).tickValues(i).tickFormat((a, o) => r.find((u) => u.val === a).id), this.group = t.canvas.append("g").attr("class", "axis y2-axis").attr("transform", "translate(" + t.width + " ,0)"), t.canvas.select(".y2-axis").call(this.warningAxis).selectAll(".tick text").append("title").attr("class", "tooltip").text((a, o) => "waarschuwing waardes" + r[o].c + a), this.sections = this.axis.canvas.select(".canvas").append("g").attr("class", "warning-sections"), this.redraw();
}
redraw() {
const t = this.axis.yScales[0].copy(), n = this.axis.xScales[0].copy(), r = t.domain(), i = te((c) => c.date).left, s = this.escalationLevels ?? [], a = s.map((c) => {
const h = i(c.events, n.domain()[1]);
return { id: c.id, val: c.events[Math.max(0, h - 1)].value };
}).filter((c) => !Dt(c.val) && c.val >= r[0] && c.val <= r[1]), o = a.map((c) => c.val);
this.warningAxis.scale(t).tickValues(o).tickFormat((c, h) => a[h].id), this.axis.canvas.select(".y2-axis").attr("transform", "translate(" + this.axis.width + " ,0)").call(this.warningAxis);
function l(c, h) {
const f = Tu().curve(Nu).defined((d) => !Dt(d.value)).x((d, p) => n(d.date));
return c.c === "<" ? (h === 0 ? f.y0((d, p) => t(r[0])) : f.y0((d, p) => t(s[h - 1].events[p].value)), f.y1((d, p) => t(d.value))) : c.c === ">" && (f.y0((d, p) => t(d.value)), h === s.length - 1 ? f.y1((d, p) => t(r[1])) : f.y1((d, p) => t(s[h + 1].events[p].value))), f;
}
const u = this.sections.selectAll("path").data(s);
u.exit().remove(), u.enter().append("path").merge(u).style("fill", (c) => c.color).attr("d", (c, h) => l(c, h)(c.events));
}
}
class D1 {
constructor(t, n) {
Object.defineProperty(this, "trace", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axes", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "mouseGroup", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "customNumberFormatter", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.setTrace(t), this.customNumberFormatter = n ?? null;
}
setTrace(t) {
this.trace = t;
}
visit(t) {
this.axes = t, this.create(t);
}
create(t) {
this.mouseGroup = t.canvas.select(".mouse"), this.mouseGroup.attr("pointer-events", "all"), this.group = t.canvas.insert("g", ".mouse").attr("class", "mouse-over").attr("font-family", "sans-serif"), this.group.append("path").attr("class", "mouse-line").style("opacity", "0").attr("d", function() {
let n = "M0," + t.height;
return n += " 0,0", n;
}), this.group.append("g").attr("class", "mouse-x").attr("transform", "translate(0," + t.height + ")").append("text").text(""), this.mouseGroup.on("pointerout", () => this.onPointerout()).on("pointerover", () => this.onPointerover()).on("pointermove", (n) => {
const r = J(n);
this.update(r);
});
}
// pointer event handlers
onPointerout() {
this.group.select(".mouse-line").style("opacity", "0"), this.group.selectAll(".mouse-x text").style("fill-opacity", "0");
for (const t of this.axes.charts)
t.onPointerOut();
this.axes.tooltip.hide();
}
onPointerover() {
this.axes.tooltip.show(), this.group.select(".mouse-line").style("opacity", "1");
const t = this.trace !== void 0 ? this.trace : this.axes.charts.map((n) => n.id);
for (const n of this.axes.charts)
t.includes(n.id) ? n.onPointerOver() : n.onPointerOut();
this.group.select(".mouse-x text").style("fill-opacity", "1");
}
updateChartIndicators(t) {
const n = this.trace !== void 0 ? this.trace : this.axes.charts.map((s) => s.id), r = [], i = /* @__PURE__ */ new Set();
for (const s of this.axes.charts) {
if (n.includes(s.id) && s.visible && !i.has(s.id)) {
const a = s.axisIndex.x.axisIndex, o = this.axes.xScales[a], l = s.axisIndex.y.axisIndex, u = this.axes.yScales[l], c = this.axes.chartsExtent("y", s.axisIndex.y.axisIndex, {}), h = yn((c[1] - c[0]) / 100), f = s.onPointerMove(o.invert(t[0]), o, u), d = s.mouseOverFormatterCartesian(f, h);
d && r.push(d);
}
i.add(s.id);
}
this.updateTooltip(r, t);
}
update(t) {
this.updateXLine(t[0]), this.updateXValue(t[0]), this.updateChartIndicators(t);
}
updateXLine(t) {
this.group.select(".mouse-line").attr("transform", "translate(" + t + ",0)");
}
updateXValue(t) {
const n = this.axes;
this.group.select(".mouse-x").attr("transform", "translate(" + (t + 2) + "," + (n.height - 5) + ")").select("text").text(this.xText(n, t));
}
updateTooltip(t, n) {
const r = this.axes;
if (t.length === 0)
r.tooltip.hide();
else {
const i = document.createElement("div");
for (const s of t)
i.appendChild(s), i.appendChild(document.createElement("br"));
r.tooltip.update(i, it.Right, n[0] + r.margin.left, n[1] + r.margin.top), r.tooltip.isHidden && r.tooltip.show();
}
}
xText(t, n) {
if (t.options.x[0].type === z.time)
return Ta(t.xScales[0].invert(n), "yyyy-MM-dd HH:mm ZZZZ", {
timeZone: t.options.x[0].timeZone,
locale: t.options.x[0].locale
});
{
const r = de("f"), i = t.xScales[0].domain();
return r.precision = yn(i[1] / 100), (this.customNumberFormatter !== null ? (a) => this.customNumberFormatter(a, i) : Mt(r.toString()))(t.xScales[0].invert(n));
}
}
redraw() {
this.group.select(".mouse-line").attr("d", () => {
let t = "M0," + this.axes.height;
return t += " 0,0", t;
});
for (const t of this.axes.charts)
t.onPointerOut();
}
}
function vl(e, t) {
return (e - t) ** 2;
}
class $1 {
constructor(t, n) {
Object.defineProperty(this, "trace", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axes", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "mouseGroup", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "mousePerLine", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "customNumberFormatter", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.setTrace(t), this.customNumberFormatter = n ?? null;
}
setTrace(t) {
this.trace = t;
}
visit(t) {
this.axes = t, this.create(t);
}
create(t) {
this.mouseGroup = t.canvas.select(".mouse"), this.mouseGroup.attr("pointer-events", "all"), this.group = t.canvas.insert("g", ".mouse").attr("class", "mouse-over").attr("font-family", "sans-serif"), this.group.append("path").attr("class", "mouse-line").style("opacity", "0").attr("d", function() {
let n = "M" + t.width + ",0";
return n += " 0,0", n;
}), this.group.append("g").attr("class", "mouse-y").append("text").text(""), this.updateLineIndicators(), this.mouseGroup.on("pointerout", () => this.onPointerout()).on("pointerover", () => this.onPointerover()).on("pointermove", (n) => {
const r = J(n), i = this.yPosForCharts(r);
this.update(r, i);
});
}
// pointer event handlers
onPointerout() {
this.group.select(".mouse-line").style("opacity", "0"), this.group.selectAll(".mouse-per-line circle").style("opacity", "0"), this.group.selectAll(".mouse-y text").style("fill-opacity", "0"), this.axes.tooltip.hide();
}
onPointerover() {
this.axes.tooltip.show(), this.group.select(".mouse-line").style("opacity", "1"), this.group.selectAll(".mouse-per-line circle").style("opacity", "1").style("fill", (t) => {
const n = `[data-chart-id="${t}"]`, r = this.axes.chartGroup.select(n).select("path");
if (r.node() !== null)
return window.getComputedStyle(r.node()).getPropertyValue("stroke");
}), this.group.select(".mouse-y text").style("fill-opacity", "1");
}
yPosForCharts(t) {
const n = this.axes;
let r = 1 / 0, i = t[1];
return this.mousePerLine.each((s) => {
const a = `[data-chart-id="${s}"]`, o = n.canvas.selectAll(a).select("path");
if (o.node() !== null && !(this.isHidden(o) || o.datum().length === 0)) {
const l = o.datum();
[i, r] = this.closestPointForChart(s, l, t[1], i, r);
}
}), i;
}
isHidden(t) {
const n = window.getComputedStyle(t.node());
return n === null || n.getPropertyValue("visibility") === "hidden";
}
closestPointForChart(t, n, r, i, s) {
const a = this.axes, o = a.charts.find((m) => m.id === t), l = o.axisIndex.y.axisIndex, u = a.yScales[l], c = u.invert(r), h = o.dataKeys.x, f = o.dataKeys.y;
let d = (m) => Dt(m[h]);
Array.isArray(n[0][h]) && (d = (m) => Dt(m[h][0]));
const p = te((m) => m[f]).right, g = p(n, c);
if (g - 1 >= 0 && !d(n[g - 1])[h]) {
const m = u(n[g - 1][f]), y = vl(m, r);
y < s && (s = y, i = m);
}
if (g < n.length && !d(n[g])[h]) {
const m = u(n[g][f]), y = vl(m, r);
y < s && (s = y, i = m);
}
return [i, s];
}
update(t, n) {
const r = this.axes, i = {};
this.mousePerLine.each((s, a) => {
const o = `[data-chart-id="${s}"]`, l = r.charts.find((N) => N.id === s), u = l.axisIndex.x.axisIndex, c = r.xScales[u], h = l.axisIndex.y.axisIndex, f = r.yScales[h], d = l.dataKeys.x, p = l.dataKeys.y, g = r.canvas.select(o).select("path");
if (g.node() === null || this.isHidden(g))
return;
const y = window.getComputedStyle(g.node()).getPropertyValue("stroke"), x = g.datum();
if (x === null || Array.isArray(x) && x.length === 0)
return;
const b = f.invert(t[1]);
let v = this.findIndex(x, d, p, b);
if (v === void 0)
return;
let w = f(x[v][p]);
if (v - 1 >= 0) {
const N = f(x[v - 1][p]), k = f(x[v][p]), [$, C] = this.findClosestPoint(n, N, k);
w = $, v = v - 1 + C;
}
const S = x[v][d], _ = c(S), A = this.axes.chartsExtent("x", u, {}), F = this.determineLabel(A, S);
_ > c.range()[1] || _ < c.range()[0] ? i[s] = { x0: -window.innerWidth, y0: w, y: f.invert(w), color: y } : i[s] = { x0: _, y0: w, y: f.invert(w), x: F, color: y };
}), this.updatePoints(i), Object.keys(i).length === 0 && (n = t[1]), this.updateYLine(n), this.updateYValue(n), this.updateTooltip(i, t);
}
findClosestPoint(t, n, r) {
return t - n < r - t ? [r, 1] : [n, 0];
}
findIndex(t, n, r, i) {
const s = t[t.length - 1][r] < t[0][r], a = s ? t.reverse() : t, o = te((c) => c[r]).left;
let l = (c) => Dt(c[n]);
Array.isArray(a[0][n]) && (l = (c) => Dt(c[n][0]));
const u = o(a, i);
if (!(u === 0 && a[u][r] > i) && !(u === a.length - 1 && a[u][r] < i) && !(!a[u] || l(a[u])))
return s ? t.length - 1 - u : u;
}
determineLabel(t, n) {
const r = de("f");
r.precision = yn((t[1] - t[0]) / 100);
const i = this.customNumberFormatter !== null ? (s) => this.customNumberFormatter(s, t) : Mt(r.toString());
return Array.isArray(n) ? [...n].sort((a, o) => a - o).map(i).join("–") : i(n);
}
updatePoints(t) {
const n = Object.keys(t);
this.mousePerLine.attr("transform", (r, i) => n.includes(r) ? `translate(${t[r].x0} , ${t[r].y0})` : `translate(0, ${-window.innerWidth})`).style("opacity", (r, i) => n.includes(r) && t[r].x0 !== void 0 && t[r].y0 !== void 0 ? "1" : "0");
}
updateYLine(t) {
this.group.select(".mouse-line").attr("transform", "translate(0," + t + ")");
}
updateYValue(t) {
const n = this.axes;
this.group.select(".mouse-y").attr("transform", "translate(2," + (t - 2) + ")").select("text").text(this.yText(n, t));
}
yText(t, n) {
if (t.options.y[0].type === z.time)
return Ta(t.yScales[0].invert(n), "yyyy-MM-dd HH:mm ZZZZ", {
timeZone: t.options.y[0].timeZone,
locale: t.options.y[0].locale
});
{
const r = de("f"), i = t.yScales[0].domain();
return r.precision = yn(i[1] / 100), (this.customNumberFormatter !== null ? (a) => this.customNumberFormatter(a, i) : Mt(r.toString()))(t.yScales[0].invert(n));
}
}
updateTooltip(t, n) {
const r = this.axes;
if (Object.keys(t).length === 0)
r.tooltip.hide();
else {
const i = document.createElement("div");
for (const s in t) {
const a = t[s];
if (a.x !== void 0) {
const o = document.createElement("span");
o.style.color = a.color, o.innerText = a.x, i.appendChild(o), i.appendChild(document.createElement("br"));
}
}
r.tooltip.update(i, it.Top, n[0] + r.margin.left, n[1] + r.margin.top), r.tooltip.isHidden && r.tooltip.show();
}
}
updateLineIndicators() {
const t = this.trace !== void 0 ? this.trace : this.axes.charts.map((i) => i.id), n = this.group.selectAll(".mouse-per-line").data(t), r = n.enter().append("g").attr("class", "mouse-per-line").attr("data-mouse-id", (i) => i);
r.append("circle").attr("r", 3).style("fill", "white").style("opacity", "0").style("stroke-width", "1px"), n.exit().remove(), this.mousePerLine = r.merge(n);
}
redraw() {
this.updateLineIndicators(), this.group.select(".mouse-line").attr("d", () => {
let t = "M" + this.axes.width + ",0";
return t += " 0,0", t;
});
}
}
const ae = {
CANCEL: "CANCEL",
X: "X",
XY: "XY",
Y: "Y"
}, oe = {
X: "X",
XY: "XY",
Y: "Y"
};
var Jt;
(function(e) {
e[e.X = 0] = "X", e[e.XY = 1] = "XY", e[e.Y = 2] = "Y", e[e.NONE = 3] = "NONE";
})(Jt || (Jt = {}));
function d1(e) {
return e in Jt;
}
class F1 {
constructor(t, n) {
Object.defineProperty(this, "brushStartPoint", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axes", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "mode", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "MINMOVE", {
enumerable: !0,
configurable: !0,
writable: !0,
value: 15
}), Object.defineProperty(this, "lastPoint", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.options = {
wheelMode: Jt.NONE,
sharedZoomMode: oe.XY,
scrollModifierKey: Ot.None
}, d1(t) ? (this.options.wheelMode = t ?? Jt.NONE, this.options.scrollModifierKey = n ?? Ot.None) : this.options = { ...this.options, ...t }, this.axes = [];
}
visit(t) {
this.axes.push(t), this.createHandler(t);
}
updateOptions(t) {
this.options = { ...this.options, ...t }, "wheelMode" in t && this.axes.forEach((n) => this.updateWheelMode(n));
}
createHandler(t) {
const n = t.layers.mouse, r = n.select("rect"), i = t.canvas.insert("g", ".mouse").attr("class", "brush");
i.append("rect").attr("class", "select-rect").attr("visibility", "hidden"), i.append("rect").attr("class", "handle east").attr("visibility", "hidden").attr("height", 2 * this.MINMOVE).attr("width", 4), i.append("rect").attr("class", "handle west").attr("visibility", "hidden").attr("height", 2 * this.MINMOVE).attr("width", 4), i.append("rect").attr("class", "handle south").attr("visibility", "hidden").attr("width", 2 * this.MINMOVE).attr("height", 4), i.append("rect").attr("class", "handle north").attr("visibility", "hidden").attr("width", 2 * this.MINMOVE).attr("height", 4);
const s = (a) => {
r.nodes().some((l) => l === a.target) || this.endSelection(t, n, i, null);
};
r.on("mousedown", (a) => {
a.button === 0 && (a.ctrlKey || a.shiftKey || (a.preventDefault(), this.initSelection(t, n, i, J(a)), r.on("mouseup", (o) => {
this.endSelection(t, n, i, J(o)), this.axes.forEach((l) => {
this.dispatchZoomEvent(l);
}), n.dispatch("pointerover");
}, { once: !0 }), document.addEventListener("mouseup", s, { once: !0 })));
}).on("dblclick", () => {
this.axes.forEach((a) => this.resetZoom(a)), n.dispatch("pointerover");
}), this.updateWheelMode(t);
}
updateWheelMode(t) {
const n = t.layers.mouse.select("rect");
this.options.wheelMode === Jt.NONE ? n.on("wheel", null) : n.on("wheel", (r) => {
if (!y1(r, this.options.scrollModifierKey))
return;
r.preventDefault();
const s = r.deltaY > 0 ? 1.1 : 0.9;
this.zoom(t, s, J(r)), this.axes.forEach((a) => {
this.dispatchZoomEvent(a);
});
});
}
dispatchZoomEvent(t) {
const n = new CustomEvent("zoom", {
detail: {
xScalesDomains: t.xScalesDomains,
yScalesDomains: t.yScalesDomains
}
});
t.container.dispatchEvent(n);
}
updateZoomAxisScales(t, n, r, i) {
for (const s of [0, 1]) {
const a = t.getScale(n, s);
if (!a)
continue;
const o = t.options[n][s];
if ((o == null ? void 0 : o.type) === "band")
continue;
const u = a.invert(r), [c, h] = a.domain(), f = [Pt(u, c)(i), Pt(u, h)(i)];
t.setDomain(n, s, f);
}
}
zoom(t, n, r) {
const i = () => {
([oe.X, oe.XY].includes(this.options.sharedZoomMode) ? this.axes : [t]).forEach((o) => this.updateZoomAxisScales(o, "x", r[0], n));
}, s = () => {
([oe.Y, oe.XY].includes(this.options.sharedZoomMode) ? this.axes : [t]).forEach((o) => this.updateZoomAxisScales(o, "y", r[1], n));
};
switch (this.options.wheelMode) {
case Jt.X:
i();
break;
case Jt.Y:
s();
break;
case Jt.XY:
i(), s();
break;
case Jt.NONE:
break;
}
this.axes.forEach((a) => {
a.update(), a.zoom();
});
}
initSelection(t, n, r, i) {
this.brushStartPoint = i, this.lastPoint = null, this.mode = ae.CANCEL;
const s = n.select("rect");
n.dispatch("pointerout"), s.on("mousemove", (a) => {
this.updateSelection(t, r, J(a));
}), r.select(".select-rect").attr("visibility", "initial").attr("width", 0).attr("height", 0).attr("x", 0).attr("y", 0);
}
updateSelection(t, n, r) {
if (!this.brushStartPoint)
return;
this.lastPoint = r;
const i = [0, 0];
i[0] = r[0] - this.brushStartPoint[0], i[1] = r[1] - this.brushStartPoint[1];
let s = this.brushStartPoint[0], a = this.brushStartPoint[1];
const o = Math.abs(i[0]), l = Math.abs(i[1]), u = n.select(".select-rect");
i[0] < 0 && (s = this.brushStartPoint[0] + i[0]), i[1] < 0 && (a = this.brushStartPoint[1] + i[1]), Math.abs(i[0]) <= this.MINMOVE && Math.abs(i[1]) <= this.MINMOVE ? (this.mode = ae.CANCEL, u.attr("visibility", "hidden"), n.selectAll(".handle").attr("visibility", "hidden")) : Math.abs(i[0]) > this.MINMOVE && Math.abs(i[1]) < this.MINMOVE ? (this.mode = ae.X, u.attr("width", o).attr("x", s).attr("y", 0).attr("height", t.height).attr("visibility", "initial"), n.select(".west").attr("visibility", "initial").attr("x", s - 4).attr("y", this.brushStartPoint[1] - this.MINMOVE), n.select(".east").attr("visibility", "initial").attr("x", s + o).attr("y", this.brushStartPoint[1] - this.MINMOVE), n.select(".north").attr("visibility", "hidden"), n.select(".south").attr("visibility", "hidden")) : Math.abs(i[1]) > this.MINMOVE && Math.abs(i[0]) < this.MINMOVE ? (this.mode = ae.Y, u.attr("height", l).attr("y", a).attr("x", 0).attr("width", t.width).attr("visibility", "initial"), n.select(".north").attr("visibility", "initial").attr("x", this.brushStartPoint[0] - this.MINMOVE).attr("y", a - 4), n.select(".south").attr("visibility", "initial").attr("y", a + l).attr("x", this.brushStartPoint[0] - this.MINMOVE), n.select(".east").attr("visibility", "hidden"), n.select(".west").attr("visibility", "hidden")) : (this.mode = ae.XY, u.attr("height", l).attr("y", a).attr("x", s).attr("width", o).attr("visibility", "initial"), n.selectAll(".handle").attr("visibility", "hidden"));
}
updateAxisScales(t, n, r, i) {
for (const s of [0, 1]) {
const a = t.getScale(n, s);
if (!a)
continue;
const o = t.options[n][s];
if ((o == null ? void 0 : o.type) === "band")
continue;
const u = _t([r[i], this.brushStartPoint[i]].map(a.invert));
t.setDomain(n, s, u);
}
}
endSelection(t, n, r, i) {
if (!this.brushStartPoint)
return;
i = i !== null ? i : this.lastPoint, n.select("rect").on("mousemove", null), r.select(".select-rect").attr("visibility", "hidden");
const a = () => {
([oe.X, oe.XY].includes(this.options.sharedZoomMode) ? this.axes : [t]).forEach((u) => this.updateAxisScales(u, "x", i, 0));
}, o = () => {
([oe.Y, oe.XY].includes(this.options.sharedZoomMode) ? this.axes : [t]).forEach((u) => this.updateAxisScales(u, "y", i, 1));
};
switch (this.mode) {
case ae.X: {
a();
break;
}
case ae.Y: {
o();
break;
}
case ae.XY: {
a(), o();
break;
}
case ae.CANCEL: {
r.selectAll("*").attr("visibility", "hidden");
return;
}
default:
return;
}
r.selectAll("*").attr("visibility", "hidden"), n.dispatch("pointerover"), this.axes.forEach((l) => l.zoom());
}
resetZoom(t) {
t.resetZoom();
}
redraw() {
this.axes.forEach((t) => {
t.layers.mouse.select("rect").attr("height", t.height).attr("width", t.width);
});
}
}
class _a {
constructor(t) {
Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "line", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "indicator", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "datetime", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.datetime = null, this.options = t;
}
setDateTime(t) {
this.datetime = t;
}
visit(t) {
this.axis = t, this.create(t), this.redraw(), zd(() => {
this.redraw();
}, _a.REFRESH_INTERVAL);
}
create(t) {
const n = t.canvas.select(".front");
this.group = n.append("g").attr("class", "current-time"), this.line = this.group.append("line").attr("class", "current-time"), this.redraw();
}
redraw() {
const t = this.datetime || /* @__PURE__ */ new Date();
let n;
if (this.options.x) {
const s = this.options.x.axisIndex;
n = this.axis.xScales[s];
} else if (this.options.y) {
const s = this.options.y.axisIndex;
n = this.axis.yScales[s];
} else
return;
const r = n(t), i = n.domain();
if (this.line || (this.line = this.group.append("line")), t > i[0] && t < i[1]) {
this.group.attr("display", "initial"), this.line.attr("x1", r).attr("x2", r).attr("y1", this.axis.height).attr("y2", 0), this.indicator || (this.indicator = this.group.append("g").attr("class", "current-time-indicator"), this.indicator.append("polygon").attr("points", "0,0 5,5 -5,5"), this.indicator.append("text")), this.indicator.attr("transform", "translate(" + r + "," + this.axis.height + ")");
const s = this.options.x.axisIndex;
this.indicator.select("text").attr("x", 5).attr("y", -5).text(Ta(t, "yyyy-MM-dd HH:mm ZZZZ", {
timeZone: this.axis.options.x[s].timeZone,
locale: this.axis.options.x[s].locale
}));
} else
this.group.attr("display", "none");
}
}
Object.defineProperty(_a, "REFRESH_INTERVAL", {
enumerable: !0,
configurable: !0,
writable: !0,
value: 1e4
});
class L1 {
// tslint:disable-next-line:no-empty
constructor(t) {
Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "indicator", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "dstDate", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.options = qt({}, t, {
x: { axisIndex: 0 }
});
}
visit(t) {
if (this.axis = t, "x" in this.options) {
const n = this.options.x.axisIndex;
if (this.axis.options.x[n] && this.axis.options.x[n].type === z.time)
this.create(t);
else
throw new Error(`x-axis [${n}] does not exist or is not of type 'time'`);
}
}
create(t) {
this.group || (this.group = t.canvas.append("g").attr("class", "dst-indicator")), this.redraw();
}
redraw() {
if ("x" in this.options) {
const t = this.options.x.axisIndex, n = this.axis.xScales[t], r = n.domain(), i = I.fromJSDate(r[0]).setZone(this.axis.options.x[t].timeZone), s = I.fromJSDate(r[1]).setZone(this.axis.options.x[t].timeZone);
if (i.isInDST !== s.isInDST) {
this.dstDate = this.findDst(i, s);
const a = n(this.dstDate);
this.group.attr("display", "initial"), this.indicator || (this.indicator = this.group.append("g").attr("class", "dst-indicator"), this.indicator.append("polygon").attr("points", "0,0 6,6 -6,6"), this.indicator.append("text")), this.indicator.attr("transform", "translate(" + a + "," + this.axis.height + ")"), this.indicator.select("text").attr("x", 5).attr("y", -5).attr("text-anchor", "middle").text("dst transition");
} else
this.group.attr("display", "none");
}
}
findDst(t, n) {
let r = t, i = n, s = i.diff(r);
for (; s.as("minutes") > 1; ) {
const a = r.plus(R.fromMillis(s.valueOf() / 2));
r.offset === a.offset ? r = a : i = a, s = i.diff(r);
}
return i.set({ second: 0 }).toJSDate();
}
}
class R1 {
// use shared Visitor constuctor (Visitor should be a abstract class)
constructor(t, n, r) {
Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "line", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "value", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "callback", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "format", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: {
y: { axisIndex: 0 }
}
}), this.value = t, this.callback = n, this.format = Mt(".2f"), this.options = qt(this.options, r);
}
visit(t) {
this.axis = t, this.create(t);
}
create(t) {
this.group || (this.group = t.canvas.append("g").attr("class", "level-select"), this.group.append("line"), this.group.append("polygon").attr("points", "0,0 -5,-5 -8,-5 -8,5 -5,5").attr("class", "level-select-handle").call(Dl().on("start", (n) => {
this.start(n);
}).on("drag", (n) => {
this.drag(n);
}).on("end", (n) => {
this.end(n);
}))), this.redraw();
}
redraw() {
const t = this.options.y.axisIndex, n = this.axis.yScales[t];
let r = n(this.value);
r = r === void 0 ? n.range()[1] : r, this.group.select("line").attr("x1", 0).attr("x2", this.axis.width).attr("transform", "translate( 0, " + r + ")"), this.group.select("text").attr("y", r).text(this.format(this.value)), this.group.select("polygon").attr("transform", "translate( 0, " + r + ")");
}
start(t) {
const n = this.options.y.axisIndex, r = this.axis.yScales[n];
this.value = r.invert(t.y), this.group.append("text").attr("x", 0).attr("y", t.y).attr("dx", 10).attr("dy", -5).text(this.format(this.value)), this.redraw();
}
drag(t) {
const n = this.options.y.axisIndex, r = this.axis.yScales[n];
this.value = r.invert(t.y), this.redraw();
}
end(t) {
this.group.select("text").remove(), typeof this.callback == "function" && this.callback(this.value);
}
}
function p1(e) {
function t(f) {
return f.x + f.vx;
}
function n(f) {
return f.y + f.vy;
}
function r(f) {
return function() {
return f;
};
}
function i(f, d) {
return f[1][d] - f[0][d];
}
let s, a, o = 0.05, l = 1;
typeof e != "function" && (e = r(e === null ? [
[0, 0],
[1, 1]
] : e));
function u() {
const f = [];
return s.forEach(function(d, p) {
f.push({
node: d,
vx: d.vx,
vy: d.vy,
x: d.x + (a[p][1][0] + a[p][0][0]) / 2,
y: d.y + (a[p][0][1] + a[p][1][1]) / 2
}), f.push({
node: d,
vx: d.vx,
vy: d.vy,
x: d.x + a[p][0][0],
y: d.y + a[p][0][1]
}), f.push({
node: d,
vx: d.vx,
vy: d.vy,
x: d.x + a[p][0][0],
y: d.y + a[p][1][1]
}), f.push({
node: d,
vx: d.vx,
vy: d.vy,
x: d.x + a[p][1][0],
y: d.y + a[p][0][1]
}), f.push({
node: d,
vx: d.vx,
vy: d.vy,
x: d.x + a[p][1][0],
y: d.y + a[p][1][1]
});
}), f;
}
function c() {
let f, d, p, g, m, y, x, b, v, w;
const S = u(), _ = S.length;
let A;
for (let N = 0; N < l; ++N)
for (d = ru(S, t, n).visitAfter(h), f = 0; f < _; ++f)
A = ~~(f / 5), p = s[A], y = a[A], g = p.x + p.vx, m = p.y + p.vy, x = g + y[0][0], b = m + y[0][1], v = g + y[1][0], w = m + y[1][1], d.visit(F);
function F(N, k, $, C, E) {
const nt = N.data;
if (nt) {
const rt = i(y, 0), Q = i(y, 1);
if (nt.node.index !== A) {
const j = nt.node, Z = a[j.index], ft = j.x + j.vx + Z[0][0], Vt = j.y + j.vy + Z[0][1], Ut = j.x + j.vx + Z[1][0], Bt = j.y + j.vy + Z[1][1], ve = i(Z, 0), yt = i(Z, 1);
if (x <= Ut && ft <= v && b <= Bt && Vt <= w) {
const be = [
Math.min.apply(null, [ft, Ut, x, v]),
Math.max.apply(null, [ft, Ut, x, v])
], xe = [
Math.min.apply(null, [Vt, Bt, b, w]),
Math.max.apply(null, [Vt, Bt, b, w])
], Xt = rt + ve - (be[1] - be[0]), O = Q + yt - (xe[1] - xe[0]), D = Xt * o * Math.min(0.5, O / Q), L = O * o * Math.min(0.5, Xt / rt), T = Xt * o * Math.min(0.5, O / yt), at = O * o * Math.min(0.5, Xt / ve);
(x + v) / 2 < (ft + Ut) / 2 ? (p.vx -= D, j.vx += T) : (p.vx += D, j.vx -= T), (b + w) / 2 < (Vt + Bt) / 2 ? (p.vy -= L, j.vy += at) : (p.vy += L, j.vy -= at);
}
}
return;
}
return k > v || C < x || $ > w || E < b;
}
}
function h(f) {
if (f.data)
return f.bb = a[f.data.node.index], f.bb;
f.bb = [
[0, 0],
[0, 0]
];
for (let d = 0; d < 4; ++d)
f[d] && f[d].bb[0][0] < f.bb[0][0] && (f.bb[0][0] = f[d].bb[0][0]), f[d] && f[d].bb[0][1] < f.bb[0][1] && (f.bb[0][1] = f[d].bb[0][1]), f[d] && f[d].bb[1][0] > f.bb[1][0] && (f.bb[1][0] = f[d].bb[1][0]), f[d] && f[d].bb[1][1] > f.bb[1][1] && (f.bb[1][1] = f[d].bb[1][1]);
}
return c.initialize = function(f) {
let d;
s = f;
const p = s.length;
for (a = new Array(p), d = 0; d < p; ++d)
a[d] = e(s[d], d, s);
}, c.iterations = function(f) {
return arguments.length ? (l = +f, c) : l;
}, c.strength = function(f) {
return arguments.length ? (o = +f, c) : o;
}, c.bbox = function(f) {
return arguments.length ? (e = typeof f == "function" ? f : r(+f), c) : e;
}, c;
}
class V1 {
// use shared Visitor constuctor (Visitor should be a abstract class)
constructor(t, n, r, i) {
Object.defineProperty(this, "trace", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "backGroup", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "frontGroup", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "pointRadius", {
enumerable: !0,
configurable: !0,
writable: !0,
value: 3
}), Object.defineProperty(this, "simulation", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "value", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "currentData", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "callback", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "format", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: {
x: { axisIndex: 0 },
draggable: !1
}
}), Object.defineProperty(this, "visible", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.value = t, this.callback = n, this.format = Mt(".2f"), this.options = qt(r, this.options), this.setTrace(i), this.visible = !0;
}
setTrace(t) {
this.trace = t;
}
visit(t) {
this.axis = t, this.create(t);
}
create(t) {
this.group = t.canvas.insert("g", ".mouse").attr("class", "cross-section-select").attr("font-family", "sans-serif"), this.backGroup = this.group.append("g"), this.frontGroup = this.group.append("g"), this.backGroup.append("line");
const n = this.backGroup.append("polygon").attr("points", "0,0 -5,5 -5,8 5,8 5,5").attr("class", "cross-section-select-handle");
this.options.draggable && n.call(Dl().on("start", (r) => {
this.start(r);
}).on("drag", (r) => {
this.drag(r);
}).on("end", () => {
this.end();
})), this.frontGroup.append("g").attr("class", "data-point-per-line"), this.redraw();
}
redraw() {
const t = this.axis, n = this.options.x.axisIndex, r = t.xScales[n], i = r.domain(), s = r(this.value);
this.visible = this.value >= i[0] && this.value <= i[1], this.updateLine(s);
const a = this.trace || this.axis.charts.map((u) => u.id);
let o = [];
const l = {};
for (const u of this.axis.charts)
a.includes(u.id) && u.visible && (o.push(this.findNearestPoint(u, s)), l[u.id] = this.styleForChart(u.id));
this.currentData = o.map((u) => ({
id: u.id,
data: u.d,
value: u.value
})), o = o.filter((u) => u.y !== void 0), this.updateLabels(o, l), this.updateDataPoints(o, l);
}
start(t) {
const n = this.options.x.axisIndex, r = this.axis.xScales[n];
this.value = r.invert(t.x), this.backGroup.append("text").classed("date-label", !0).attr("x", t.x).attr("y", this.axis.height).attr("dx", 10).attr("dy", -5).text(this.format(this.value)), this.redraw();
}
drag(t) {
const n = this.options.x.axisIndex, r = this.axis.xScales[n];
this.value = r.invert(t.x), this.limitValue(), this.redraw();
}
end() {
this.backGroup.select(".date-label").remove(), typeof this.callback == "function" && this.callback(this.value);
}
styleForChart(t) {
const n = `[data-chart-id="${t}"]`, r = this.axis.chartGroup.select(n).select("path");
if (r.node() !== null)
return window.getComputedStyle(r.node());
}
updateLine(t) {
const n = this.visible ? "visible" : "hidden";
this.backGroup.select("line").attr("y1", 0).attr("y2", this.axis.height).attr("transform", "translate(" + t + ", 0)").style("visibility", n);
const r = this.format(this.value);
this.backGroup.select(".date-label").attr("x", t).text(r).style("visibility", n), this.backGroup.select("polygon").attr("transform", "translate(" + t + "," + this.axis.height + ")").style("visibility", n);
}
updateDataPoints(t, n) {
const r = this.visible ? "visible" : "hidden";
this.frontGroup.selectAll(".data-point-per-line").selectAll("circle").data(t).join("circle").filter((i) => i.y !== void 0).attr("data-point-id", (i) => i.id).attr("r", this.pointRadius).style("fill", (i) => n[i.id].getPropertyValue("stroke")).style("visibility", r).style("stroke-width", "1px").style("opacity", "1").attr("transform", (i) => `translate( ${i.x}, ${i.y})`);
}
updateLabels(t, n) {
const r = [], i = [];
let s = 0;
const a = [...t].sort((b, v) => b.y - v.y);
a.reduce((b, v) => b + v.y, 0) / a.length;
for (const b of a)
b.y !== void 0 && (r.push({
id: b.id,
fx: b.x + 50,
y: b.y + Math.random() / 10,
py: b.y,
label: b.value,
width: 100,
height: 20
}), r.push({ fx: b.x, fy: b.y, width: 4, height: 4 }), i.push({ source: r[s + 1], target: r[s], label: b.value }), s = s + 2);
const o = this.visible ? "visible" : "hidden", u = this.frontGroup.selectAll(".back").data(r.filter((b) => b.label !== void 0)).join("rect").classed("back", !0).attr("fill", "rgb(0, 0 , 0)").attr("stroke", "none").style("visibility", o), h = this.frontGroup.selectAll(".label").data(r.filter((b) => b.label !== void 0)).join("text").classed("label", !0).attr("dominant-baseline", "middle").attr("fill", (b) => n[b.id].getPropertyValue("stroke")).style("visibility", o).attr("stroke", "none").text((b) => b.label), f = this.backGroup.selectAll(".link").data(i).join("line").style("visibility", o).classed("link", !0), d = [], p = [], g = 2, m = 2 * this.pointRadius;
h.each(function() {
const b = this.getBoundingClientRect().height + 2 * g;
p.push(b), p.push(m);
const v = this.getBoundingClientRect().width + b;
d.push(v), d.push(m);
}), u.attr("rx", (b, v) => p[2 * v] / 2).attr("ry", (b, v) => p[2 * v] / 2).attr("width", (b, v) => d[2 * v]).attr("height", (b, v) => p[2 * v]);
const y = () => {
f.attr("x1", (b) => b.source.x).attr("y1", (b) => b.source.y).attr("x2", (b) => b.target.x).attr("y2", (b) => b.target.y), u.attr("x", (b, v) => b.x - p[2 * v] / 2).attr("y", (b, v) => b.y - p[2 * v] / 2), h.attr("x", (b) => b.x).attr("y", (b) => b.y);
};
this.simulation !== void 0 && this.simulation.stop();
const x = p1(function(b, v) {
let w;
return b.label !== void 0 ? w = [
[-p[v] / 2, -p[v] / 2],
[d[v] - p[v] / 2, p[v] / 2]
] : w = [
[-d[v] / 2, -p[v] / 2],
[d[v] / 2, p[v] / 2]
], w;
});
this.simulation = Sm().alphaDecay(0.01).nodes(r).force("center", x).on("tick", y), this.simulation.stop(), this.simulation.tick(50), y();
}
limitValue() {
const t = this.options.x.axisIndex, i = this.axis.xScales[t].domain();
return this.value < i[0] ? (this.value = i[0], !0) : this.value > i[1] ? (this.value = i[1], !0) : !1;
}
findNearestPoint(t, n) {
const r = this.axis;
if (t.data.length < 2)
return { id: t.id, x: void 0, y: void 0, d: void 0 };
const i = t.axisIndex.x.axisIndex, s = r.xScales[i], a = t.axisIndex.y.axisIndex, o = r.yScales[a], l = t.dataKeys.x, u = t.dataKeys.y, c = t.data, h = te(function(v) {
return v[l];
}).left, f = s.invert(n);
let d = h(c, f);
if (d < 0)
return { id: t.id, x: void 0, y: void 0, d: void 0 };
d = Math.min(d, c.length - 1);
let p = c[d][u];
if (p === null) {
for (let v = d; v >= 0; v--)
if (p = c[v][u], p !== null) {
d = v;
break;
}
}
const g = s(c[d][l]), m = o(p), y = this.axis.chartsExtent("y", a, {}), x = c[d];
if (p === null || p < o.domain()[0] || p > o.domain()[1])
return { id: t.id, x: void 0, y: void 0, d: x };
const b = this.determineLabel(y, p);
return { id: t.id, x: g, y: m, value: b, d: x };
}
determineLabel(t, n) {
const r = de("f");
r.precision = yn((t[1] - t[0]) / 100);
let i;
if (Array.isArray(n)) {
const s = [];
for (let a = 0; a < n.length; a++)
s[a] = Mt(r.toString())(n[a]);
i = s.join("–");
} else
i = Mt(r.toString())(n);
return i;
}
}
class U1 {
constructor(t, n, r) {
Object.defineProperty(this, "container", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "text", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "value", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "selectors", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "units", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}), Object.defineProperty(this, "formatter", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "clickCount", {
enumerable: !0,
configurable: !0,
writable: !0,
value: 0
}), this.container = t, this.options = qt({}, n), this.formatter = r !== void 0 ? r : this.valueFormatter;
}
visit(t) {
this.axis = t, this.create(t);
}
create(t) {
var n;
this.group || (this.group = this.container.append("g").attr("class", "data-field"), this.text = this.group.append("text").attr("class", "data-field-label").text(this.options.labelField.text), this.value = this.group.append("text").attr("class", "data-field-value"), this.selectors = this.options.selector instanceof Array ? this.options.selector : [this.options.selector], this.units = ((n = this.options.valueField) == null ? void 0 : n.units) ?? [], this.units.length > 1 && (this.value.on("click", () => {
this.onClick();
}), this.value.style("cursor", "pointer"))), this.updateOffsets(), this.redraw();
}
updateOffsets() {
const t = this.container.selectChildren(".data-field"), n = t.size() - 1, r = 1.25;
t.each(function(i, s) {
const a = mt(this).selectChildren();
a.attr("dy", (o, l) => `${(s * a.size() + l - n) * r * 16}px`);
});
}
redraw() {
this.value.html(null);
const t = this.selectors.map((n) => mt(`[data-chart-id="${n}"]`).select("path")).filter((n) => n.node() !== null);
t.forEach((n, r) => {
const i = r === t.length - 1, s = n.datum(), a = window.getComputedStyle(n.node());
this.value.append("tspan").text(this.formatter(s, r, i)).style("fill", a.getPropertyValue("stroke"));
});
}
onClick() {
this.clickCount++, this.redraw();
}
valueFormatter(t, n, r) {
const i = this.getValue(t), s = this.getUnit(), a = this.options.valueField.hyphen ?? "", o = r ? (s == null ? void 0 : s.unit) ?? "" : a;
if (i === null)
return "-" + o;
const l = (c) => c === null ? "-" : (s == null ? void 0 : s.factor) !== void 0 ? ((s == null ? void 0 : s.precision) !== void 0 ? Mt(s.precision) : Mt(".1f"))(c * s.factor) : (s == null ? void 0 : s.scale) !== void 0 ? s.scale(c) : c;
if (Array.isArray(i)) {
if (i.every((d) => d === null))
return "-" + o;
const c = Math.min(...i), h = Math.max(...i);
return c === h ? l(c) + o : `${l(c)} - ${l(h)}` + o;
}
return l(i) + o;
}
getUnit() {
const t = this.clickCount % this.units.length;
return this.units[t];
}
getValue(t) {
return t[0] !== void 0 ? t[0].y : null;
}
}
class W1 {
constructor(t) {
Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), t ? this.options = t : this.options = [];
}
visit(t) {
this.axis = t, this.create(t);
}
create(t) {
this.group = this.axis.canvas.select(".front").append("g").attr("class", "alert-lines").attr("clip-path", "url(#" + t.clipPathId + ")"), this.redraw();
}
redraw() {
if (this.group.selectAll("g").remove(), this.options.length === 0)
return;
const t = this.axis.xScales[0], r = this.group.selectAll("g").data(this.options).enter().append("g");
r.append("line").style("stroke", (i) => i.color).style("stroke-dasharray", "40 2").style("stroke-width", "40 2").attr("x1", (i) => {
const s = Math.max(t(i.x1) ?? NaN, 0);
return Number.isFinite(s) ? s : 0;
}).attr("y1", (i) => {
const s = this.axis.yScales[i.yAxisIndex];
return Number.isFinite(s(i.value)) ? s(i.value) : 0;
}).attr("x2", (i) => {
const s = Math.min(this.axis.width, t(i.x2) ?? NaN);
return Number.isFinite(s) ? s : this.axis.width;
}).attr("y2", (i) => {
const s = this.axis.yScales[i.yAxisIndex];
return Number.isFinite(s(i.value)) ? s(i.value) : 0;
}), r.append("text").filter((i) => t(i.x1) < this.axis.width - 10).attr("text-anchor", (i) => i.labelPosition === "left" ? "start" : "end").attr("x", (i) => i.labelPosition === "left" ? Math.max(t(i.x1), 0) + 10 : Math.min(t(i.x2), this.axis.width) - 10).attr("y", (i) => {
const s = this.axis.yScales[i.yAxisIndex];
return s(i.value);
}).attr("dy", "-.35em").style("fill", (i) => i.color).text((i) => i.description);
}
}
const H1 = oa().domain([-11.25, 371.25]).range([
"N",
"NNO",
"NO",
"ONO",
"O",
"OZO",
"ZO",
"ZZO",
"Z",
"ZZW",
"ZW",
"WZW",
"W",
"WNW",
"NW",
"NNW",
"N"
]), m1 = [0.3, 1.6, 3.4, 5.5, 8, 10.8, 13.9, 17.2, 20.8, 24.5, 28.5, 32.7], g1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], bl = cu().domain(m1).range(g1), j1 = oa().domain([-11.25, 371.25]).range([
"N",
"NNO",
"NO",
"ONO",
"O",
"OZO",
"ZO",
"ZZO",
"Z",
"ZZW",
"ZW",
"WZW",
"W",
"WNW",
"NW",
"NNW",
"N"
]);
class z1 {
constructor(t) {
Object.defineProperty(this, "group", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "axis", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "isVertical", {
enumerable: !0,
configurable: !0,
writable: !0,
value: !0
}), this.options = t;
}
visit(t) {
this.axis = t, this.create(t);
}
create(t) {
this.isVertical = this.options.x === void 0, this.group = t.canvas.insert("g", ".group"), this.isVertical ? this.group.attr("class", "axis y2-axis") : this.group.attr("class", "axis x2-axis"), this.group.attr("pointer-events", "none"), this.redraw();
}
redraw() {
const t = this.axis, n = this.isVertical ? this.axis.yScales[0] : this.axis.xScales[0], r = n.domain(), i = bl.domain();
i.unshift(r[0]);
const s = i.filter((g) => r[0] <= g && r[1] > g), a = s.map((g) => n(g)), o = s.map((g) => bl(g)), l = wt();
l.domain(o), l.range(a);
const u = this.isVertical ? or(l) : jr(l);
u.tickValues(o), u.tickFormat((g) => g === 0 ? "" : Mt(".0f")(g));
const c = (g) => {
const m = g.selectAll(".tick text"), y = m.data().map((b) => l(b));
this.isVertical ? y.push(0) : y.push(this.axis.width);
const x = (b) => (y[b + 1] - y[b]) / 2;
m.attr("transform", (b, v) => this.isVertical ? `translate(0,${x(v)})` : `translate( ${x(v)} ,0)`);
}, h = this.isVertical ? `translate(${t.width},0)` : "translate(0,0)", f = this.group.attr("transform", h).call(u).call(c), d = this.isVertical, p = this.options.colors === void 0 ? {} : this.options.colors;
f.selectAll(".tick").each(function(g, m) {
mt(this).select("rect").size() === 0 && mt(this).append("rect");
const y = mt(this).select("rect");
let x = d ? t.width - 1 : l(g + 1) - l(g), b = d ? l(g) - l(g + 1) : t.height - 1;
this.nextSibling || (b = d ? l(g) : t.height - 1, x = d ? t.width - 1 : t.width - l(g));
const v = d ? -x : 0, w = d ? -b : 1;
y.attr("width", x).attr("x", v).attr("y", w).attr("height", b).style("fill", p[g] ? p[g] : "none");
});
}
}
function Z1(e, t) {
for (const n of e.charts.filter((r) => r.id === t))
n.visible = !n.visible;
}
var Ot;
(function(e) {
e.None = "none", e.Ctrl = "ctrl", e.Shift = "shift";
})(Ot || (Ot = {}));
function xl(e, t) {
switch (t) {
case Ot.None:
return !1;
case Ot.Ctrl:
return e.key === "Control";
case Ot.Shift:
return e.key === "Shift";
}
}
function y1(e, t) {
switch (t) {
case Ot.None:
return !0;
case Ot.Ctrl:
return e.ctrlKey;
case Ot.Shift:
return e.shiftKey;
}
}
function v1(e) {
return "paddingInner" in e;
}
var Zs;
(function(e) {
e.X = "x", e.Y = "y", e.XY = "xy";
})(Zs || (Zs = {}));
var ci;
(function(e) {
e[e.Left = 0] = "Left", e[e.Middle = 1] = "Middle";
})(ci || (ci = {}));
function b1(e, t) {
return t === ci.Left ? e.button === 0 : e.button === 1;
}
function x1(e, t) {
return t.includes(e);
}
class Y1 {
constructor(t) {
Object.defineProperty(this, "id", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "allAxes", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "enabled", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "isPanningEnabled", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "isPanning", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "mouseButton", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "modifierKey", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "direction", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "changeHoveringCursor", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "changePanningCursor", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "hoveringCursor", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "panningCursor", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "keyDownCallback", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperty(this, "keyUpCallback", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), this.id = Math.random().toString(36).substring(2, 18), this.allAxes = [], this.enabled = !1, this.isPanning = !1, this.mouseButton = (t == null ? void 0 : t.mouseButton) ?? ci.Middle, this.modifierKey = (t == null ? void 0 : t.modifierKey) ?? Ot.None, this.direction = (t == null ? void 0 : t.direction) ?? Zs.XY, this.changeHoveringCursor = (t == null ? void 0 : t.changeHoveringCursor) ?? !0, this.changePanningCursor = (t == null ? void 0 : t.changePanningCursor) ?? !0, this.hoveringCursor = (t == null ? void 0 : t.hoveringCursor) ?? "grab", this.panningCursor = (t == null ? void 0 : t.panningCursor) ?? "grabbing", this.keyDownCallback = (r) => this.onKeyDown(r), this.keyUpCallback = (r) => this.onKeyUp(r), ((t == null ? void 0 : t.startEnabled) ?? !0) && this.enable();
}
get mouseDownHandlerId() {
return `mousedown.${this.id}`;
}
visit(t) {
if (!(t instanceof ih))
throw new Error("Panning is only supported on Cartesian axes.");
this.allAxes.push(t), this.enabled && this.modifierKey === Ot.None && this.enablePanningForAxes(t);
}
redraw() {
}
isEnabled() {
return this.enabled;
}
enable() {
this.enabled = !0, this.modifierKey === Ot.None ? this.enablePanning() : window.addEventListener("keydown", this.keyDownCallback);
}
disable() {
this.enabled = !1, this.disablePanning(), window.removeEventListener("keydown", this.keyDownCallback);
}
destroy() {
window.removeEventListener("keydown", this.keyDownCallback), window.removeEventListener("keyup", this.keyUpCallback);
}
enablePanning() {
this.allAxes.forEach((t) => this.enablePanningForAxes(t)), this.isPanningEnabled = !0;
}
disablePanning() {
this.allAxes.forEach((t) => this.disablePanningForAxes(t)), this.isPanningEnabled = !1;
}
enablePanningForAxes(t) {
const n = wl(t, "mouse");
this.changeHoveringCursor && (n.node().style.cursor = this.hoveringCursor), n.on(this.mouseDownHandlerId, (r) => this.onMouseDown(r));
}
disablePanningForAxes(t) {
const n = wl(t, "mouse");
this.changeHoveringCursor && !this.isPanning && (n.node().style.cursor = ""), n.on(this.mouseDownHandlerId, null);
}
onKeyDown(t) {
xl(t, this.modifierKey) && (window.addEventListener("keyup", this.keyUpCallback), window.removeEventListener("keydown", this.keyDownCallback), window.addEventListener("blur", () => this.disablePanning(), { once: !0 }), this.enablePanning());
}
onKeyUp(t) {
xl(t, this.modifierKey) && (window.removeEventListener("keyup", this.keyUpCallback), window.addEventListener("keydown", this.keyDownCallback), this.disablePanning());
}
onMouseDown(t) {
if (!b1(t, this.mouseButton))
return;
this.isPanning = !0;
const n = t.target;
this.changePanningCursor && (n.style.cursor = this.panningCursor);
const r = J(t, n), i = this.allAxes.flatMap((a) => this.createAxisUpdateCallbacks(a, r)), s = (a) => {
const o = J(a, n);
i.forEach((l) => l(o)), this.allAxes.forEach((l) => l.zoom());
};
window.addEventListener("mousemove", s), window.addEventListener("mouseup", () => {
window.removeEventListener("mousemove", s), this.isPanning = !1, this.changePanningCursor && (n.style.cursor = this.changeHoveringCursor && this.isPanningEnabled ? this.hoveringCursor : "");
}, { once: !0 });
}
createAxisUpdateCallbacks(t, n) {
const r = [];
for (const i of ["x", "y"]) {
if (!x1(i, this.direction))
continue;
const s = Sl(i, n);
for (const a of [0, 1]) {
const o = t.getScale(i, a);
if (!o || v1(o))
continue;
const l = o.copy(), u = l.domain()[0] instanceof Date, c = l.domain().map(us), h = us(l.invert(s)), f = (d) => {
const p = Sl(i, d), g = us(l.invert(p)), m = h - g, y = c.map((x) => x + m);
u ? t.setDomain(i, a, y.map((x) => new Date(x))) : t.setDomain(i, a, y);
};
r.push(f);
}
}
return r;
}
}
function wl(e, t) {
return e.layers[t].select("rect");
}
function Sl(e, t) {
return e === "x" ? t[0] : t[1];
}
function us(e) {
return e instanceof Date ? e.getTime() : e;
}
export {
_n as AUTO_SCALE,
W1 as AlertLines,
Ju as Axes,
Zt as AxisOrientation,
tt as AxisPosition,
z as AxisType,
z1 as BeaufortAxis,
ih as CartesianAxes,
Rt as Chart,
S1 as ChartArea,
T1 as ChartArrow,
sh as ChartBar,
_1 as ChartDirection,
M1 as ChartHistogram,
k1 as ChartLine,
O1 as ChartMarker,
ah as ChartMatrix,
C1 as ChartProgress,
I1 as ChartRange,
A1 as ChartRule,
N1 as ChartText,
w1 as ColourBar,
V1 as CrossSectionSelect,
_a as CurrentTime,
xt as CurveType,
U1 as DataField,
ar as Direction,
L1 as DstIndicator,
Cr as LabelOrientation,
P1 as Legend,
R1 as LevelSelect,
Ot as ModifierKey,
ci as MouseButton,
D1 as MouseOver,
Y1 as PanHandler,
Zs as PanningDirection,
yl as PolarAxes,
sn as ResetZoom,
zs as TextPosition,
Bb as Tooltip,
G as TooltipAnchor,
it as TooltipPosition,
$1 as VerticalMouseOver,
E1 as WarningLevels,
Jt as WheelMode,
F1 as ZoomHandler,
oe as ZoomMode,
Ta as dateFormatter,
n1 as generateMultiFormat,
xl as isModifierKeyPress,
y1 as matchesModifierKey,
nh as niceDegreeSteps,
bl as scaleBeaufort,
j1 as scaleCurrentCategories,
H1 as scaleWindCategories,
Z1 as toggleChartVisibility
};