UNPKG

14.5 kBJavaScriptView Raw
1import { $ as un, a0 as I, a1 as U, a2 as Y, a3 as fn } from "./mermaid-9f2aa176.js";
2import { i as cn } from "./init-f9637058.js";
3function F(n, t) {
4 return n == null || t == null ? NaN : n < t ? -1 : n > t ? 1 : n >= t ? 0 : NaN;
5}
6function hn(n, t) {
7 return n == null || t == null ? NaN : t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN;
8}
9function _(n) {
10 let t, e, r;
11 n.length !== 2 ? (t = F, e = (u, c) => F(n(u), c), r = (u, c) => n(u) - c) : (t = n === F || n === hn ? n : mn, e = n, r = n);
12 function i(u, c, o = 0, l = u.length) {
13 if (o < l) {
14 if (t(c, c) !== 0)
15 return l;
16 do {
17 const h = o + l >>> 1;
18 e(u[h], c) < 0 ? o = h + 1 : l = h;
19 } while (o < l);
20 }
21 return o;
22 }
23 function f(u, c, o = 0, l = u.length) {
24 if (o < l) {
25 if (t(c, c) !== 0)
26 return l;
27 do {
28 const h = o + l >>> 1;
29 e(u[h], c) <= 0 ? o = h + 1 : l = h;
30 } while (o < l);
31 }
32 return o;
33 }
34 function a(u, c, o = 0, l = u.length) {
35 const h = i(u, c, o, l - 1);
36 return h > o && r(u[h - 1], c) > -r(u[h], c) ? h - 1 : h;
37 }
38 return { left: i, center: a, right: f };
39}
40function mn() {
41 return 0;
42}
43function sn(n) {
44 return n === null ? NaN : +n;
45}
46const ln = _(F), dn = ln.right;
47_(sn).center;
48const gn = dn, yn = Math.sqrt(50), Mn = Math.sqrt(10), pn = Math.sqrt(2);
49function R(n, t, e) {
50 const r = (t - n) / Math.max(0, e), i = Math.floor(Math.log10(r)), f = r / Math.pow(10, i), a = f >= yn ? 10 : f >= Mn ? 5 : f >= pn ? 2 : 1;
51 let u, c, o;
52 return i < 0 ? (o = Math.pow(10, -i) / a, u = Math.round(n * o), c = Math.round(t * o), u / o < n && ++u, c / o > t && --c, o = -o) : (o = Math.pow(10, i) * a, u = Math.round(n / o), c = Math.round(t / o), u * o < n && ++u, c * o > t && --c), c < u && 0.5 <= e && e < 2 ? R(n, t, e * 2) : [u, c, o];
53}
54function wn(n, t, e) {
55 if (t = +t, n = +n, e = +e, !(e > 0))
56 return [];
57 if (n === t)
58 return [n];
59 const r = t < n, [i, f, a] = r ? R(t, n, e) : R(n, t, e);
60 if (!(f >= i))
61 return [];
62 const u = f - i + 1, c = new Array(u);
63 if (r)
64 if (a < 0)
65 for (let o = 0; o < u; ++o)
66 c[o] = (f - o) / -a;
67 else
68 for (let o = 0; o < u; ++o)
69 c[o] = (f - o) * a;
70 else if (a < 0)
71 for (let o = 0; o < u; ++o)
72 c[o] = (i + o) / -a;
73 else
74 for (let o = 0; o < u; ++o)
75 c[o] = (i + o) * a;
76 return c;
77}
78function L(n, t, e) {
79 return t = +t, n = +n, e = +e, R(n, t, e)[2];
80}
81function Nn(n, t, e) {
82 t = +t, n = +n, e = +e;
83 const r = t < n, i = r ? L(t, n, e) : L(n, t, e);
84 return (r ? -1 : 1) * (i < 0 ? 1 / -i : i);
85}
86function kn(n, t) {
87 t || (t = []);
88 var e = n ? Math.min(t.length, n.length) : 0, r = t.slice(), i;
89 return function(f) {
90 for (i = 0; i < e; ++i)
91 r[i] = n[i] * (1 - f) + t[i] * f;
92 return r;
93 };
94}
95function xn(n) {
96 return ArrayBuffer.isView(n) && !(n instanceof DataView);
97}
98function An(n, t) {
99 var e = t ? t.length : 0, r = n ? Math.min(e, n.length) : 0, i = new Array(r), f = new Array(e), a;
100 for (a = 0; a < r; ++a)
101 i[a] = C(n[a], t[a]);
102 for (; a < e; ++a)
103 f[a] = t[a];
104 return function(u) {
105 for (a = 0; a < r; ++a)
106 f[a] = i[a](u);
107 return f;
108 };
109}
110function vn(n, t) {
111 var e = /* @__PURE__ */ new Date();
112 return n = +n, t = +t, function(r) {
113 return e.setTime(n * (1 - r) + t * r), e;
114 };
115}
116function Sn(n, t) {
117 var e = {}, r = {}, i;
118 (n === null || typeof n != "object") && (n = {}), (t === null || typeof t != "object") && (t = {});
119 for (i in t)
120 i in n ? e[i] = C(n[i], t[i]) : r[i] = t[i];
121 return function(f) {
122 for (i in e)
123 r[i] = e[i](f);
124 return r;
125 };
126}
127function C(n, t) {
128 var e = typeof t, r;
129 return t == null || e === "boolean" ? un(t) : (e === "number" ? I : e === "string" ? (r = U(t)) ? (t = r, Y) : fn : t instanceof U ? Y : t instanceof Date ? vn : xn(t) ? kn : Array.isArray(t) ? An : typeof t.valueOf != "function" && typeof t.toString != "function" || isNaN(t) ? Sn : I)(n, t);
130}
131function bn(n, t) {
132 return n = +n, t = +t, function(e) {
133 return Math.round(n * (1 - e) + t * e);
134 };
135}
136function jn(n) {
137 return Math.abs(n = Math.round(n)) >= 1e21 ? n.toLocaleString("en").replace(/,/g, "") : n.toString(10);
138}
139function E(n, t) {
140 if ((e = (n = t ? n.toExponential(t - 1) : n.toExponential()).indexOf("e")) < 0)
141 return null;
142 var e, r = n.slice(0, e);
143 return [
144 r.length > 1 ? r[0] + r.slice(2) : r,
145 +n.slice(e + 1)
146 ];
147}
148function v(n) {
149 return n = E(Math.abs(n)), n ? n[1] : NaN;
150}
151function Pn(n, t) {
152 return function(e, r) {
153 for (var i = e.length, f = [], a = 0, u = n[0], c = 0; i > 0 && u > 0 && (c + u + 1 > r && (u = Math.max(1, r - c)), f.push(e.substring(i -= u, i + u)), !((c += u + 1) > r)); )
154 u = n[a = (a + 1) % n.length];
155 return f.reverse().join(t);
156 };
157}
158function zn(n) {
159 return function(t) {
160 return t.replace(/[0-9]/g, function(e) {
161 return n[+e];
162 });
163 };
164}
165var $n = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
166function D(n) {
167 if (!(t = $n.exec(n)))
168 throw new Error("invalid format: " + n);
169 var t;
170 return new B({
171 fill: t[1],
172 align: t[2],
173 sign: t[3],
174 symbol: t[4],
175 zero: t[5],
176 width: t[6],
177 comma: t[7],
178 precision: t[8] && t[8].slice(1),
179 trim: t[9],
180 type: t[10]
181 });
182}
183D.prototype = B.prototype;
184function B(n) {
185 this.fill = n.fill === void 0 ? " " : n.fill + "", this.align = n.align === void 0 ? ">" : n.align + "", this.sign = n.sign === void 0 ? "-" : n.sign + "", this.symbol = n.symbol === void 0 ? "" : n.symbol + "", this.zero = !!n.zero, this.width = n.width === void 0 ? void 0 : +n.width, this.comma = !!n.comma, this.precision = n.precision === void 0 ? void 0 : +n.precision, this.trim = !!n.trim, this.type = n.type === void 0 ? "" : n.type + "";
186}
187B.prototype.toString = function() {
188 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;
189};
190function Fn(n) {
191 n:
192 for (var t = n.length, e = 1, r = -1, i; e < t; ++e)
193 switch (n[e]) {
194 case ".":
195 r = i = e;
196 break;
197 case "0":
198 r === 0 && (r = e), i = e;
199 break;
200 default:
201 if (!+n[e])
202 break n;
203 r > 0 && (r = 0);
204 break;
205 }
206 return r > 0 ? n.slice(0, r) + n.slice(i + 1) : n;
207}
208var nn;
209function Rn(n, t) {
210 var e = E(n, t);
211 if (!e)
212 return n + "";
213 var r = e[0], i = e[1], f = i - (nn = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, a = r.length;
214 return f === a ? r : f > a ? r + new Array(f - a + 1).join("0") : f > 0 ? r.slice(0, f) + "." + r.slice(f) : "0." + new Array(1 - f).join("0") + E(n, Math.max(0, t + f - 1))[0];
215}
216function Z(n, t) {
217 var e = E(n, t);
218 if (!e)
219 return n + "";
220 var r = e[0], i = e[1];
221 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");
222}
223const H = {
224 "%": (n, t) => (n * 100).toFixed(t),
225 b: (n) => Math.round(n).toString(2),
226 c: (n) => n + "",
227 d: jn,
228 e: (n, t) => n.toExponential(t),
229 f: (n, t) => n.toFixed(t),
230 g: (n, t) => n.toPrecision(t),
231 o: (n) => Math.round(n).toString(8),
232 p: (n, t) => Z(n * 100, t),
233 r: Z,
234 s: Rn,
235 X: (n) => Math.round(n).toString(16).toUpperCase(),
236 x: (n) => Math.round(n).toString(16)
237};
238function J(n) {
239 return n;
240}
241var K = Array.prototype.map, Q = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
242function En(n) {
243 var t = n.grouping === void 0 || n.thousands === void 0 ? J : Pn(K.call(n.grouping, Number), n.thousands + ""), e = n.currency === void 0 ? "" : n.currency[0] + "", r = n.currency === void 0 ? "" : n.currency[1] + "", i = n.decimal === void 0 ? "." : n.decimal + "", f = n.numerals === void 0 ? J : zn(K.call(n.numerals, String)), a = n.percent === void 0 ? "%" : n.percent + "", u = n.minus === void 0 ? "−" : n.minus + "", c = n.nan === void 0 ? "NaN" : n.nan + "";
244 function o(h) {
245 h = D(h);
246 var s = h.fill, p = h.align, y = h.sign, S = h.symbol, k = h.zero, b = h.width, T = h.comma, w = h.precision, G = h.trim, d = h.type;
247 d === "n" ? (T = !0, d = "g") : H[d] || (w === void 0 && (w = 12), G = !0, d = "g"), (k || s === "0" && p === "=") && (k = !0, s = "0", p = "=");
248 var en = S === "$" ? e : S === "#" && /[boxX]/.test(d) ? "0" + d.toLowerCase() : "", on = S === "$" ? r : /[%p]/.test(d) ? a : "", O = H[d], an = /[defgprs%]/.test(d);
249 w = w === void 0 ? 6 : /[gprs]/.test(d) ? Math.max(1, Math.min(21, w)) : Math.max(0, Math.min(20, w));
250 function V(m) {
251 var N = en, g = on, x, X, j;
252 if (d === "c")
253 g = O(m) + g, m = "";
254 else {
255 m = +m;
256 var P = m < 0 || 1 / m < 0;
257 if (m = isNaN(m) ? c : O(Math.abs(m), w), G && (m = Fn(m)), P && +m == 0 && y !== "+" && (P = !1), N = (P ? y === "(" ? y : u : y === "-" || y === "(" ? "" : y) + N, g = (d === "s" ? Q[8 + nn / 3] : "") + g + (P && y === "(" ? ")" : ""), an) {
258 for (x = -1, X = m.length; ++x < X; )
259 if (j = m.charCodeAt(x), 48 > j || j > 57) {
260 g = (j === 46 ? i + m.slice(x + 1) : m.slice(x)) + g, m = m.slice(0, x);
261 break;
262 }
263 }
264 }
265 T && !k && (m = t(m, 1 / 0));
266 var z = N.length + m.length + g.length, M = z < b ? new Array(b - z + 1).join(s) : "";
267 switch (T && k && (m = t(M + m, M.length ? b - g.length : 1 / 0), M = ""), p) {
268 case "<":
269 m = N + m + g + M;
270 break;
271 case "=":
272 m = N + M + m + g;
273 break;
274 case "^":
275 m = M.slice(0, z = M.length >> 1) + N + m + g + M.slice(z);
276 break;
277 default:
278 m = M + N + m + g;
279 break;
280 }
281 return f(m);
282 }
283 return V.toString = function() {
284 return h + "";
285 }, V;
286 }
287 function l(h, s) {
288 var p = o((h = D(h), h.type = "f", h)), y = Math.max(-8, Math.min(8, Math.floor(v(s) / 3))) * 3, S = Math.pow(10, -y), k = Q[8 + y / 3];
289 return function(b) {
290 return p(S * b) + k;
291 };
292 }
293 return {
294 format: o,
295 formatPrefix: l
296 };
297}
298var $, tn, rn;
299Dn({
300 thousands: ",",
301 grouping: [3],
302 currency: ["$", ""]
303});
304function Dn(n) {
305 return $ = En(n), tn = $.format, rn = $.formatPrefix, $;
306}
307function Tn(n) {
308 return Math.max(0, -v(Math.abs(n)));
309}
310function In(n, t) {
311 return Math.max(0, Math.max(-8, Math.min(8, Math.floor(v(t) / 3))) * 3 - v(Math.abs(n)));
312}
313function Ln(n, t) {
314 return n = Math.abs(n), t = Math.abs(t) - n, Math.max(0, v(t) - v(n)) + 1;
315}
316function qn(n) {
317 return function() {
318 return n;
319 };
320}
321function Cn(n) {
322 return +n;
323}
324var W = [0, 1];
325function A(n) {
326 return n;
327}
328function q(n, t) {
329 return (t -= n = +n) ? function(e) {
330 return (e - n) / t;
331 } : qn(isNaN(t) ? NaN : 0.5);
332}
333function Bn(n, t) {
334 var e;
335 return n > t && (e = n, n = t, t = e), function(r) {
336 return Math.max(n, Math.min(t, r));
337 };
338}
339function Gn(n, t, e) {
340 var r = n[0], i = n[1], f = t[0], a = t[1];
341 return i < r ? (r = q(i, r), f = e(a, f)) : (r = q(r, i), f = e(f, a)), function(u) {
342 return f(r(u));
343 };
344}
345function On(n, t, e) {
346 var r = Math.min(n.length, t.length) - 1, i = new Array(r), f = new Array(r), a = -1;
347 for (n[r] < n[0] && (n = n.slice().reverse(), t = t.slice().reverse()); ++a < r; )
348 i[a] = q(n[a], n[a + 1]), f[a] = e(t[a], t[a + 1]);
349 return function(u) {
350 var c = gn(n, u, 1, r) - 1;
351 return f[c](i[c](u));
352 };
353}
354function Vn(n, t) {
355 return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown());
356}
357function Xn() {
358 var n = W, t = W, e = C, r, i, f, a = A, u, c, o;
359 function l() {
360 var s = Math.min(n.length, t.length);
361 return a !== A && (a = Bn(n[0], n[s - 1])), u = s > 2 ? On : Gn, c = o = null, h;
362 }
363 function h(s) {
364 return s == null || isNaN(s = +s) ? f : (c || (c = u(n.map(r), t, e)))(r(a(s)));
365 }
366 return h.invert = function(s) {
367 return a(i((o || (o = u(t, n.map(r), I)))(s)));
368 }, h.domain = function(s) {
369 return arguments.length ? (n = Array.from(s, Cn), l()) : n.slice();
370 }, h.range = function(s) {
371 return arguments.length ? (t = Array.from(s), l()) : t.slice();
372 }, h.rangeRound = function(s) {
373 return t = Array.from(s), e = bn, l();
374 }, h.clamp = function(s) {
375 return arguments.length ? (a = s ? !0 : A, l()) : a !== A;
376 }, h.interpolate = function(s) {
377 return arguments.length ? (e = s, l()) : e;
378 }, h.unknown = function(s) {
379 return arguments.length ? (f = s, h) : f;
380 }, function(s, p) {
381 return r = s, i = p, l();
382 };
383}
384function Un() {
385 return Xn()(A, A);
386}
387function Yn(n, t, e, r) {
388 var i = Nn(n, t, e), f;
389 switch (r = D(r ?? ",f"), r.type) {
390 case "s": {
391 var a = Math.max(Math.abs(n), Math.abs(t));
392 return r.precision == null && !isNaN(f = In(i, a)) && (r.precision = f), rn(r, a);
393 }
394 case "":
395 case "e":
396 case "g":
397 case "p":
398 case "r": {
399 r.precision == null && !isNaN(f = Ln(i, Math.max(Math.abs(n), Math.abs(t)))) && (r.precision = f - (r.type === "e"));
400 break;
401 }
402 case "f":
403 case "%": {
404 r.precision == null && !isNaN(f = Tn(i)) && (r.precision = f - (r.type === "%") * 2);
405 break;
406 }
407 }
408 return tn(r);
409}
410function Zn(n) {
411 var t = n.domain;
412 return n.ticks = function(e) {
413 var r = t();
414 return wn(r[0], r[r.length - 1], e ?? 10);
415 }, n.tickFormat = function(e, r) {
416 var i = t();
417 return Yn(i[0], i[i.length - 1], e ?? 10, r);
418 }, n.nice = function(e) {
419 e == null && (e = 10);
420 var r = t(), i = 0, f = r.length - 1, a = r[i], u = r[f], c, o, l = 10;
421 for (u < a && (o = a, a = u, u = o, o = i, i = f, f = o); l-- > 0; ) {
422 if (o = L(a, u, e), o === c)
423 return r[i] = a, r[f] = u, t(r);
424 if (o > 0)
425 a = Math.floor(a / o) * o, u = Math.ceil(u / o) * o;
426 else if (o < 0)
427 a = Math.ceil(a * o) / o, u = Math.floor(u * o) / o;
428 else
429 break;
430 c = o;
431 }
432 return n;
433 }, n;
434}
435function Hn() {
436 var n = Un();
437 return n.copy = function() {
438 return Vn(n, Hn());
439 }, cn.apply(n, arguments), Zn(n);
440}
441export {
442 Vn as a,
443 _ as b,
444 Un as c,
445 Hn as l,
446 Nn as t
447};