@equinor/esv-intersection
Version:
Intersection component package with testing and automatic documentation.
1,455 lines (1,453 loc) • 312 kB
JavaScript
import * as ot from "pixi.js";
import { autoDetectRenderer as cs, Container as Gi, Renderer as hs, RENDERER_TYPE as ls, Graphics as Gt, Point as qi, Texture as V, WRAP_MODES as ke, Rectangle as qt, groupD8 as Pn, MeshGeometry as Cn, Mesh as Ln, MeshMaterial as kn, SimpleRope as Qn } from "pixi.js";
function us(e) {
return e;
}
var Ue = 1, he = 2, nn = 3, ne = 4, Jn = 1e-6;
function fs(e) {
return "translate(" + e + ",0)";
}
function ds(e) {
return "translate(0," + e + ")";
}
function ps(e) {
return (t) => +e(t);
}
function gs(e, t) {
return t = Math.max(0, e.bandwidth() - t * 2) / 2, e.round() && (t = Math.round(t)), (n) => +e(n) + t;
}
function ms() {
return !this.__axis;
}
function ji(e, t) {
var n = [], i = null, r = null, s = 6, o = 6, a = 3, c = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, h = e === Ue || e === ne ? -1 : 1, l = e === ne || e === he ? "x" : "y", u = e === Ue || e === nn ? fs : ds;
function f(d) {
var p = i ?? (t.ticks ? t.ticks.apply(t, n) : t.domain()), g = r ?? (t.tickFormat ? t.tickFormat.apply(t, n) : us), y = Math.max(s, 0) + a, m = t.range(), x = +m[0] + c, v = +m[m.length - 1] + c, M = (t.bandwidth ? gs : ps)(t.copy(), c), b = d.selection ? d.selection() : d, S = b.selectAll(".domain").data([null]), T = b.selectAll(".tick").data(p, t).order(), C = T.exit(), k = T.enter().append("g").attr("class", "tick"), R = T.select("line"), P = T.select("text");
S = S.merge(S.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), T = T.merge(k), R = R.merge(k.append("line").attr("stroke", "currentColor").attr(l + "2", h * s)), P = P.merge(k.append("text").attr("fill", "currentColor").attr(l, h * y).attr("dy", e === Ue ? "0em" : e === nn ? "0.71em" : "0.32em")), d !== b && (S = S.transition(d), T = T.transition(d), R = R.transition(d), P = P.transition(d), C = C.transition(d).attr("opacity", Jn).attr("transform", function(I) {
return isFinite(I = M(I)) ? u(I + c) : this.getAttribute("transform");
}), k.attr("opacity", Jn).attr("transform", function(I) {
var N = this.parentNode.__axis;
return u((N && isFinite(N = N(I)) ? N : M(I)) + c);
})), C.remove(), S.attr("d", e === ne || e === he ? o ? "M" + h * o + "," + x + "H" + c + "V" + v + "H" + h * o : "M" + c + "," + x + "V" + v : o ? "M" + x + "," + h * o + "V" + c + "H" + v + "V" + h * o : "M" + x + "," + c + "H" + v), T.attr("opacity", 1).attr("transform", function(I) {
return u(M(I) + c);
}), R.attr(l + "2", h * s), P.attr(l, h * y).text(g), b.filter(ms).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", e === he ? "start" : e === ne ? "end" : "middle"), b.each(function() {
this.__axis = M;
});
}
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 ? (i = d == null ? null : Array.from(d), f) : i && i.slice();
}, f.tickFormat = function(d) {
return arguments.length ? (r = d, f) : r;
}, f.tickSize = function(d) {
return arguments.length ? (s = o = +d, f) : s;
}, f.tickSizeInner = function(d) {
return arguments.length ? (s = +d, f) : s;
}, f.tickSizeOuter = function(d) {
return arguments.length ? (o = +d, f) : o;
}, f.tickPadding = function(d) {
return arguments.length ? (a = +d, f) : a;
}, f.offset = function(d) {
return arguments.length ? (c = +d, f) : c;
}, f;
}
function ys(e) {
return ji(he, e);
}
function _s(e) {
return ji(nn, e);
}
function le(e, t) {
return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function xs(e, t) {
return e == null || t == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function Zi(e) {
let t, n, i;
e.length !== 2 ? (t = le, n = (a, c) => le(e(a), c), i = (a, c) => e(a) - c) : (t = e === le || e === xs ? e : vs, n = e, i = e);
function r(a, c, h = 0, l = a.length) {
if (h < l) {
if (t(c, c) !== 0)
return l;
do {
const u = h + l >>> 1;
n(a[u], c) < 0 ? h = u + 1 : l = u;
} while (h < l);
}
return h;
}
function s(a, c, h = 0, l = a.length) {
if (h < l) {
if (t(c, c) !== 0)
return l;
do {
const u = h + l >>> 1;
n(a[u], c) <= 0 ? h = u + 1 : l = u;
} while (h < l);
}
return h;
}
function o(a, c, h = 0, l = a.length) {
const u = r(a, c, h, l - 1);
return u > h && i(a[u - 1], c) > -i(a[u], c) ? u - 1 : u;
}
return { left: r, center: o, right: s };
}
function vs() {
return 0;
}
function ws(e) {
return e === null ? NaN : +e;
}
const bs = Zi(le), Ts = bs.right;
Zi(ws).center;
const Ss = Ts;
class ti extends Map {
constructor(t, n = Ps) {
if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), t != null)
for (const [i, r] of t)
this.set(i, r);
}
get(t) {
return super.get(ei(this, t));
}
has(t) {
return super.has(ei(this, t));
}
set(t, n) {
return super.set(Ms(this, t), n);
}
delete(t) {
return super.delete(As(this, t));
}
}
function ei({ _intern: e, _key: t }, n) {
const i = t(n);
return e.has(i) ? e.get(i) : n;
}
function Ms({ _intern: e, _key: t }, n) {
const i = t(n);
return e.has(i) ? e.get(i) : (e.set(i, n), n);
}
function As({ _intern: e, _key: t }, n) {
const i = t(n);
return e.has(i) && (n = e.get(n), e.delete(i)), n;
}
function Ps(e) {
return e !== null && typeof e == "object" ? e.valueOf() : e;
}
const Cs = Math.sqrt(50), Ls = Math.sqrt(10), ks = Math.sqrt(2);
function me(e, t, n) {
const i = (t - e) / Math.max(0, n), r = Math.floor(Math.log10(i)), s = i / Math.pow(10, r), o = s >= Cs ? 10 : s >= Ls ? 5 : s >= ks ? 2 : 1;
let a, c, h;
return r < 0 ? (h = Math.pow(10, -r) / o, a = Math.round(e * h), c = Math.round(t * h), a / h < e && ++a, c / h > t && --c, h = -h) : (h = Math.pow(10, r) * o, a = Math.round(e / h), c = Math.round(t / h), a * h < e && ++a, c * h > t && --c), c < a && 0.5 <= n && n < 2 ? me(e, t, n * 2) : [a, c, h];
}
function Es(e, t, n) {
if (t = +t, e = +e, n = +n, !(n > 0))
return [];
if (e === t)
return [e];
const i = t < e, [r, s, o] = i ? me(t, e, n) : me(e, t, n);
if (!(s >= r))
return [];
const a = s - r + 1, c = new Array(a);
if (i)
if (o < 0)
for (let h = 0; h < a; ++h)
c[h] = (s - h) / -o;
else
for (let h = 0; h < a; ++h)
c[h] = (s - h) * o;
else if (o < 0)
for (let h = 0; h < a; ++h)
c[h] = (r + h) / -o;
else
for (let h = 0; h < a; ++h)
c[h] = (r + h) * o;
return c;
}
function rn(e, t, n) {
return t = +t, e = +e, n = +n, me(e, t, n)[2];
}
function Fs(e, t, n) {
t = +t, e = +e, n = +n;
const i = t < e, r = i ? rn(t, e, n) : rn(e, t, n);
return (i ? -1 : 1) * (r < 0 ? 1 / -r : r);
}
function sn(e, t) {
let n;
if (t === void 0)
for (const i of e)
i != null && (n < i || n === void 0 && i >= i) && (n = i);
else {
let i = -1;
for (let r of e)
(r = t(r, ++i, e)) != null && (n < r || n === void 0 && r >= r) && (n = r);
}
return n;
}
function Ve(e, t) {
let n = 0;
if (t === void 0)
for (let i of e)
(i = +i) && (n += i);
else {
let i = -1;
for (let r of e)
(r = +t(r, ++i, e)) && (n += r);
}
return n;
}
function Ki(e, t) {
switch (arguments.length) {
case 0:
break;
case 1:
this.range(e);
break;
default:
this.range(t).domain(e);
break;
}
return this;
}
const ni = Symbol("implicit");
function Qi() {
var e = new ti(), t = [], n = [], i = ni;
function r(s) {
let o = e.get(s);
if (o === void 0) {
if (i !== ni)
return i;
e.set(s, o = t.push(s) - 1);
}
return n[o % n.length];
}
return r.domain = function(s) {
if (!arguments.length)
return t.slice();
t = [], e = new ti();
for (const o of s)
e.has(o) || e.set(o, t.push(o) - 1);
return r;
}, r.range = function(s) {
return arguments.length ? (n = Array.from(s), r) : n.slice();
}, r.unknown = function(s) {
return arguments.length ? (i = s, r) : i;
}, r.copy = function() {
return Qi(t, n).unknown(i);
}, Ki.apply(r, arguments), r;
}
function En(e, t, n) {
e.prototype = t.prototype = n, n.constructor = e;
}
function Ji(e, t) {
var n = Object.create(e.prototype);
for (var i in t)
n[i] = t[i];
return n;
}
function te() {
}
var jt = 0.7, ye = 1 / jt, zt = "\\s*([+-]?\\d+)\\s*", Zt = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", at = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Rs = /^#([0-9a-f]{3,8})$/, Is = new RegExp(`^rgb\\(${zt},${zt},${zt}\\)$`), zs = new RegExp(`^rgb\\(${at},${at},${at}\\)$`), Ds = new RegExp(`^rgba\\(${zt},${zt},${zt},${Zt}\\)$`), Os = new RegExp(`^rgba\\(${at},${at},${at},${Zt}\\)$`), Ns = new RegExp(`^hsl\\(${Zt},${at},${at}\\)$`), $s = new RegExp(`^hsla\\(${Zt},${at},${at},${Zt}\\)$`), ii = {
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
};
En(te, dt, {
copy(e) {
return Object.assign(new this.constructor(), this, e);
},
displayable() {
return this.rgb().displayable();
},
hex: ri,
// Deprecated! Use color.formatHex.
formatHex: ri,
formatHex8: Bs,
formatHsl: Hs,
formatRgb: si,
toString: si
});
function ri() {
return this.rgb().formatHex();
}
function Bs() {
return this.rgb().formatHex8();
}
function Hs() {
return tr(this).formatHsl();
}
function si() {
return this.rgb().formatRgb();
}
function dt(e) {
var t, n;
return e = (e + "").trim().toLowerCase(), (t = Rs.exec(e)) ? (n = t[1].length, t = parseInt(t[1], 16), n === 6 ? oi(t) : n === 3 ? new G(t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, (t & 15) << 4 | t & 15, 1) : n === 8 ? ie(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, (t & 255) / 255) : n === 4 ? ie(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 = Is.exec(e)) ? new G(t[1], t[2], t[3], 1) : (t = zs.exec(e)) ? new G(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, 1) : (t = Ds.exec(e)) ? ie(t[1], t[2], t[3], t[4]) : (t = Os.exec(e)) ? ie(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, t[4]) : (t = Ns.exec(e)) ? hi(t[1], t[2] / 100, t[3] / 100, 1) : (t = $s.exec(e)) ? hi(t[1], t[2] / 100, t[3] / 100, t[4]) : ii.hasOwnProperty(e) ? oi(ii[e]) : e === "transparent" ? new G(NaN, NaN, NaN, 0) : null;
}
function oi(e) {
return new G(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
}
function ie(e, t, n, i) {
return i <= 0 && (e = t = n = NaN), new G(e, t, n, i);
}
function Xs(e) {
return e instanceof te || (e = dt(e)), e ? (e = e.rgb(), new G(e.r, e.g, e.b, e.opacity)) : new G();
}
function on(e, t, n, i) {
return arguments.length === 1 ? Xs(e) : new G(e, t, n, i ?? 1);
}
function G(e, t, n, i) {
this.r = +e, this.g = +t, this.b = +n, this.opacity = +i;
}
En(G, on, Ji(te, {
brighter(e) {
return e = e == null ? ye : Math.pow(ye, e), new G(this.r * e, this.g * e, this.b * e, this.opacity);
},
darker(e) {
return e = e == null ? jt : Math.pow(jt, e), new G(this.r * e, this.g * e, this.b * e, this.opacity);
},
rgb() {
return this;
},
clamp() {
return new G(At(this.r), At(this.g), At(this.b), _e(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: ai,
// Deprecated! Use color.formatHex.
formatHex: ai,
formatHex8: Us,
formatRgb: ci,
toString: ci
}));
function ai() {
return `#${Mt(this.r)}${Mt(this.g)}${Mt(this.b)}`;
}
function Us() {
return `#${Mt(this.r)}${Mt(this.g)}${Mt(this.b)}${Mt((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function ci() {
const e = _e(this.opacity);
return `${e === 1 ? "rgb(" : "rgba("}${At(this.r)}, ${At(this.g)}, ${At(this.b)}${e === 1 ? ")" : `, ${e})`}`;
}
function _e(e) {
return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
}
function At(e) {
return Math.max(0, Math.min(255, Math.round(e) || 0));
}
function Mt(e) {
return e = At(e), (e < 16 ? "0" : "") + e.toString(16);
}
function hi(e, t, n, i) {
return i <= 0 ? e = t = n = NaN : n <= 0 || n >= 1 ? e = t = NaN : t <= 0 && (e = NaN), new nt(e, t, n, i);
}
function tr(e) {
if (e instanceof nt)
return new nt(e.h, e.s, e.l, e.opacity);
if (e instanceof te || (e = dt(e)), !e)
return new nt();
if (e instanceof nt)
return e;
e = e.rgb();
var t = e.r / 255, n = e.g / 255, i = e.b / 255, r = Math.min(t, n, i), s = Math.max(t, n, i), o = NaN, a = s - r, c = (s + r) / 2;
return a ? (t === s ? o = (n - i) / a + (n < i) * 6 : n === s ? o = (i - t) / a + 2 : o = (t - n) / a + 4, a /= c < 0.5 ? s + r : 2 - s - r, o *= 60) : a = c > 0 && c < 1 ? 0 : o, new nt(o, a, c, e.opacity);
}
function Vs(e, t, n, i) {
return arguments.length === 1 ? tr(e) : new nt(e, t, n, i ?? 1);
}
function nt(e, t, n, i) {
this.h = +e, this.s = +t, this.l = +n, this.opacity = +i;
}
En(nt, Vs, Ji(te, {
brighter(e) {
return e = e == null ? ye : Math.pow(ye, e), new nt(this.h, this.s, this.l * e, this.opacity);
},
darker(e) {
return e = e == null ? jt : Math.pow(jt, e), new nt(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, i = n + (n < 0.5 ? n : 1 - n) * t, r = 2 * n - i;
return new G(
We(e >= 240 ? e - 240 : e + 120, r, i),
We(e, r, i),
We(e < 120 ? e + 240 : e - 120, r, i),
this.opacity
);
},
clamp() {
return new nt(li(this.h), re(this.s), re(this.l), _e(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 = _e(this.opacity);
return `${e === 1 ? "hsl(" : "hsla("}${li(this.h)}, ${re(this.s) * 100}%, ${re(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
}
}));
function li(e) {
return e = (e || 0) % 360, e < 0 ? e + 360 : e;
}
function re(e) {
return Math.max(0, Math.min(1, e || 0));
}
function We(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 Fn = (e) => () => e;
function Ws(e, t) {
return function(n) {
return e + n * t;
};
}
function Ys(e, t, n) {
return e = Math.pow(e, n), t = Math.pow(t, n) - e, n = 1 / n, function(i) {
return Math.pow(e + i * t, n);
};
}
function Gs(e) {
return (e = +e) == 1 ? er : function(t, n) {
return n - t ? Ys(t, n, e) : Fn(isNaN(t) ? n : t);
};
}
function er(e, t) {
var n = t - e;
return n ? Ws(e, n) : Fn(isNaN(e) ? t : e);
}
const Kt = function e(t) {
var n = Gs(t);
function i(r, s) {
var o = n((r = on(r)).r, (s = on(s)).r), a = n(r.g, s.g), c = n(r.b, s.b), h = er(r.opacity, s.opacity);
return function(l) {
return r.r = o(l), r.g = a(l), r.b = c(l), r.opacity = h(l), r + "";
};
}
return i.gamma = e, i;
}(1);
function qs(e, t) {
t || (t = []);
var n = e ? Math.min(t.length, e.length) : 0, i = t.slice(), r;
return function(s) {
for (r = 0; r < n; ++r)
i[r] = e[r] * (1 - s) + t[r] * s;
return i;
};
}
function js(e) {
return ArrayBuffer.isView(e) && !(e instanceof DataView);
}
function Zs(e, t) {
var n = t ? t.length : 0, i = e ? Math.min(n, e.length) : 0, r = new Array(i), s = new Array(n), o;
for (o = 0; o < i; ++o)
r[o] = Rn(e[o], t[o]);
for (; o < n; ++o)
s[o] = t[o];
return function(a) {
for (o = 0; o < i; ++o)
s[o] = r[o](a);
return s;
};
}
function Ks(e, t) {
var n = /* @__PURE__ */ new Date();
return e = +e, t = +t, function(i) {
return n.setTime(e * (1 - i) + t * i), n;
};
}
function et(e, t) {
return e = +e, t = +t, function(n) {
return e * (1 - n) + t * n;
};
}
function Qs(e, t) {
var n = {}, i = {}, r;
(e === null || typeof e != "object") && (e = {}), (t === null || typeof t != "object") && (t = {});
for (r in t)
r in e ? n[r] = Rn(e[r], t[r]) : i[r] = t[r];
return function(s) {
for (r in n)
i[r] = n[r](s);
return i;
};
}
var an = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Ye = new RegExp(an.source, "g");
function Js(e) {
return function() {
return e;
};
}
function to(e) {
return function(t) {
return e(t) + "";
};
}
function nr(e, t) {
var n = an.lastIndex = Ye.lastIndex = 0, i, r, s, o = -1, a = [], c = [];
for (e = e + "", t = t + ""; (i = an.exec(e)) && (r = Ye.exec(t)); )
(s = r.index) > n && (s = t.slice(n, s), a[o] ? a[o] += s : a[++o] = s), (i = i[0]) === (r = r[0]) ? a[o] ? a[o] += r : a[++o] = r : (a[++o] = null, c.push({ i: o, x: et(i, r) })), n = Ye.lastIndex;
return n < t.length && (s = t.slice(n), a[o] ? a[o] += s : a[++o] = s), a.length < 2 ? c[0] ? to(c[0].x) : Js(t) : (t = c.length, function(h) {
for (var l = 0, u; l < t; ++l)
a[(u = c[l]).i] = u.x(h);
return a.join("");
});
}
function Rn(e, t) {
var n = typeof t, i;
return t == null || n === "boolean" ? Fn(t) : (n === "number" ? et : n === "string" ? (i = dt(t)) ? (t = i, Kt) : nr : t instanceof dt ? Kt : t instanceof Date ? Ks : js(t) ? qs : Array.isArray(t) ? Zs : typeof t.valueOf != "function" && typeof t.toString != "function" || isNaN(t) ? Qs : et)(e, t);
}
function eo(e, t) {
return e = +e, t = +t, function(n) {
return Math.round(e * (1 - n) + t * n);
};
}
var ui = 180 / Math.PI, cn = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function ir(e, t, n, i, r, s) {
var o, a, c;
return (o = Math.sqrt(e * e + t * t)) && (e /= o, t /= o), (c = e * n + t * i) && (n -= e * c, i -= t * c), (a = Math.sqrt(n * n + i * i)) && (n /= a, i /= a, c /= a), e * i < t * n && (e = -e, t = -t, c = -c, o = -o), {
translateX: r,
translateY: s,
rotate: Math.atan2(t, e) * ui,
skewX: Math.atan(c) * ui,
scaleX: o,
scaleY: a
};
}
var se;
function no(e) {
const t = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(e + "");
return t.isIdentity ? cn : ir(t.a, t.b, t.c, t.d, t.e, t.f);
}
function io(e) {
return e == null || (se || (se = document.createElementNS("http://www.w3.org/2000/svg", "g")), se.setAttribute("transform", e), !(e = se.transform.baseVal.consolidate())) ? cn : (e = e.matrix, ir(e.a, e.b, e.c, e.d, e.e, e.f));
}
function rr(e, t, n, i) {
function r(h) {
return h.length ? h.pop() + " " : "";
}
function s(h, l, u, f, d, p) {
if (h !== u || l !== f) {
var g = d.push("translate(", null, t, null, n);
p.push({ i: g - 4, x: et(h, u) }, { i: g - 2, x: et(l, f) });
} else
(u || f) && d.push("translate(" + u + t + f + n);
}
function o(h, l, u, f) {
h !== l ? (h - l > 180 ? l += 360 : l - h > 180 && (h += 360), f.push({ i: u.push(r(u) + "rotate(", null, i) - 2, x: et(h, l) })) : l && u.push(r(u) + "rotate(" + l + i);
}
function a(h, l, u, f) {
h !== l ? f.push({ i: u.push(r(u) + "skewX(", null, i) - 2, x: et(h, l) }) : l && u.push(r(u) + "skewX(" + l + i);
}
function c(h, l, u, f, d, p) {
if (h !== u || l !== f) {
var g = d.push(r(d) + "scale(", null, ",", null, ")");
p.push({ i: g - 4, x: et(h, u) }, { i: g - 2, x: et(l, f) });
} else
(u !== 1 || f !== 1) && d.push(r(d) + "scale(" + u + "," + f + ")");
}
return function(h, l) {
var u = [], f = [];
return h = e(h), l = e(l), s(h.translateX, h.translateY, l.translateX, l.translateY, u, f), o(h.rotate, l.rotate, u, f), a(h.skewX, l.skewX, u, f), c(h.scaleX, h.scaleY, l.scaleX, l.scaleY, u, f), h = l = null, function(d) {
for (var p = -1, g = f.length, y; ++p < g; )
u[(y = f[p]).i] = y.x(d);
return u.join("");
};
};
}
var ro = rr(no, "px, ", "px)", "deg)"), so = rr(io, ", ", ")", ")"), oo = 1e-12;
function fi(e) {
return ((e = Math.exp(e)) + 1 / e) / 2;
}
function ao(e) {
return ((e = Math.exp(e)) - 1 / e) / 2;
}
function co(e) {
return ((e = Math.exp(2 * e)) - 1) / (e + 1);
}
const ho = function e(t, n, i) {
function r(s, o) {
var a = s[0], c = s[1], h = s[2], l = o[0], u = o[1], f = o[2], d = l - a, p = u - c, g = d * d + p * p, y, m;
if (g < oo)
m = Math.log(f / h) / t, y = function(T) {
return [
a + T * d,
c + T * p,
h * Math.exp(t * T * m)
];
};
else {
var x = Math.sqrt(g), v = (f * f - h * h + i * g) / (2 * h * n * x), M = (f * f - h * h - i * g) / (2 * f * n * x), b = Math.log(Math.sqrt(v * v + 1) - v), S = Math.log(Math.sqrt(M * M + 1) - M);
m = (S - b) / t, y = function(T) {
var C = T * m, k = fi(b), R = h / (n * x) * (k * co(t * C + b) - ao(b));
return [
a + R * d,
c + R * p,
h * k / fi(t * C + b)
];
};
}
return y.duration = m * 1e3 * t / Math.SQRT2, y;
}
return r.rho = function(s) {
var o = Math.max(1e-3, +s), a = o * o, c = a * a;
return e(o, a, c);
}, r;
}(Math.SQRT2, 2, 4);
function lo(e, t) {
for (var n = new Array(t), i = 0; i < t; ++i)
n[i] = e(i / (t - 1));
return n;
}
function uo(e) {
return function() {
return e;
};
}
function fo(e) {
return +e;
}
var di = [0, 1];
function Et(e) {
return e;
}
function hn(e, t) {
return (t -= e = +e) ? function(n) {
return (n - e) / t;
} : uo(isNaN(t) ? NaN : 0.5);
}
function po(e, t) {
var n;
return e > t && (n = e, e = t, t = n), function(i) {
return Math.max(e, Math.min(t, i));
};
}
function go(e, t, n) {
var i = e[0], r = e[1], s = t[0], o = t[1];
return r < i ? (i = hn(r, i), s = n(o, s)) : (i = hn(i, r), s = n(s, o)), function(a) {
return s(i(a));
};
}
function mo(e, t, n) {
var i = Math.min(e.length, t.length) - 1, r = new Array(i), s = new Array(i), o = -1;
for (e[i] < e[0] && (e = e.slice().reverse(), t = t.slice().reverse()); ++o < i; )
r[o] = hn(e[o], e[o + 1]), s[o] = n(t[o], t[o + 1]);
return function(a) {
var c = Ss(e, a, 1, i) - 1;
return s[c](r[c](a));
};
}
function yo(e, t) {
return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
}
function _o() {
var e = di, t = di, n = Rn, i, r, s, o = Et, a, c, h;
function l() {
var f = Math.min(e.length, t.length);
return o !== Et && (o = po(e[0], e[f - 1])), a = f > 2 ? mo : go, c = h = null, u;
}
function u(f) {
return f == null || isNaN(f = +f) ? s : (c || (c = a(e.map(i), t, n)))(i(o(f)));
}
return u.invert = function(f) {
return o(r((h || (h = a(t, e.map(i), et)))(f)));
}, u.domain = function(f) {
return arguments.length ? (e = Array.from(f, fo), l()) : e.slice();
}, u.range = function(f) {
return arguments.length ? (t = Array.from(f), l()) : t.slice();
}, u.rangeRound = function(f) {
return t = Array.from(f), n = eo, l();
}, u.clamp = function(f) {
return arguments.length ? (o = f ? !0 : Et, l()) : o !== Et;
}, u.interpolate = function(f) {
return arguments.length ? (n = f, l()) : n;
}, u.unknown = function(f) {
return arguments.length ? (s = f, u) : s;
}, function(f, d) {
return i = f, r = d, l();
};
}
function xo() {
return _o()(Et, Et);
}
function vo(e) {
return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
}
function xe(e, t) {
if ((n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e")) < 0)
return null;
var n, i = e.slice(0, n);
return [
i.length > 1 ? i[0] + i.slice(2) : i,
+e.slice(n + 1)
];
}
function Dt(e) {
return e = xe(Math.abs(e)), e ? e[1] : NaN;
}
function wo(e, t) {
return function(n, i) {
for (var r = n.length, s = [], o = 0, a = e[0], c = 0; r > 0 && a > 0 && (c + a + 1 > i && (a = Math.max(1, i - c)), s.push(n.substring(r -= a, r + a)), !((c += a + 1) > i)); )
a = e[o = (o + 1) % e.length];
return s.reverse().join(t);
};
}
function bo(e) {
return function(t) {
return t.replace(/[0-9]/g, function(n) {
return e[+n];
});
};
}
var To = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function ve(e) {
if (!(t = To.exec(e)))
throw new Error("invalid format: " + e);
var t;
return new In({
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]
});
}
ve.prototype = In.prototype;
function In(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 + "";
}
In.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 So(e) {
t:
for (var t = e.length, n = 1, i = -1, r; n < t; ++n)
switch (e[n]) {
case ".":
i = r = n;
break;
case "0":
i === 0 && (i = n), r = n;
break;
default:
if (!+e[n])
break t;
i > 0 && (i = 0);
break;
}
return i > 0 ? e.slice(0, i) + e.slice(r + 1) : e;
}
var sr;
function Mo(e, t) {
var n = xe(e, t);
if (!n)
return e + "";
var i = n[0], r = n[1], s = r - (sr = Math.max(-8, Math.min(8, Math.floor(r / 3))) * 3) + 1, o = i.length;
return s === o ? i : s > o ? i + new Array(s - o + 1).join("0") : s > 0 ? i.slice(0, s) + "." + i.slice(s) : "0." + new Array(1 - s).join("0") + xe(e, Math.max(0, t + s - 1))[0];
}
function pi(e, t) {
var n = xe(e, t);
if (!n)
return e + "";
var i = n[0], r = n[1];
return r < 0 ? "0." + new Array(-r).join("0") + i : i.length > r + 1 ? i.slice(0, r + 1) + "." + i.slice(r + 1) : i + new Array(r - i.length + 2).join("0");
}
const gi = {
"%": (e, t) => (e * 100).toFixed(t),
b: (e) => Math.round(e).toString(2),
c: (e) => e + "",
d: vo,
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) => pi(e * 100, t),
r: pi,
s: Mo,
X: (e) => Math.round(e).toString(16).toUpperCase(),
x: (e) => Math.round(e).toString(16)
};
function mi(e) {
return e;
}
var yi = Array.prototype.map, _i = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function Ao(e) {
var t = e.grouping === void 0 || e.thousands === void 0 ? mi : wo(yi.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", i = e.currency === void 0 ? "" : e.currency[1] + "", r = e.decimal === void 0 ? "." : e.decimal + "", s = e.numerals === void 0 ? mi : bo(yi.call(e.numerals, String)), o = e.percent === void 0 ? "%" : e.percent + "", a = e.minus === void 0 ? "−" : e.minus + "", c = e.nan === void 0 ? "NaN" : e.nan + "";
function h(u) {
u = ve(u);
var f = u.fill, d = u.align, p = u.sign, g = u.symbol, y = u.zero, m = u.width, x = u.comma, v = u.precision, M = u.trim, b = u.type;
b === "n" ? (x = !0, b = "g") : gi[b] || (v === void 0 && (v = 12), M = !0, b = "g"), (y || f === "0" && d === "=") && (y = !0, f = "0", d = "=");
var S = g === "$" ? n : g === "#" && /[boxX]/.test(b) ? "0" + b.toLowerCase() : "", T = g === "$" ? i : /[%p]/.test(b) ? o : "", C = gi[b], k = /[defgprs%]/.test(b);
v = v === void 0 ? 6 : /[gprs]/.test(b) ? Math.max(1, Math.min(21, v)) : Math.max(0, Math.min(20, v));
function R(P) {
var I = S, N = T, _, A, w;
if (b === "c")
N = C(P) + N, P = "";
else {
P = +P;
var L = P < 0 || 1 / P < 0;
if (P = isNaN(P) ? c : C(Math.abs(P), v), M && (P = So(P)), L && +P == 0 && p !== "+" && (L = !1), I = (L ? p === "(" ? p : a : p === "-" || p === "(" ? "" : p) + I, N = (b === "s" ? _i[8 + sr / 3] : "") + N + (L && p === "(" ? ")" : ""), k) {
for (_ = -1, A = P.length; ++_ < A; )
if (w = P.charCodeAt(_), 48 > w || w > 57) {
N = (w === 46 ? r + P.slice(_ + 1) : P.slice(_)) + N, P = P.slice(0, _);
break;
}
}
}
x && !y && (P = t(P, 1 / 0));
var E = I.length + P.length + N.length, F = E < m ? new Array(m - E + 1).join(f) : "";
switch (x && y && (P = t(F + P, F.length ? m - N.length : 1 / 0), F = ""), d) {
case "<":
P = I + P + N + F;
break;
case "=":
P = I + F + P + N;
break;
case "^":
P = F.slice(0, E = F.length >> 1) + I + P + N + F.slice(E);
break;
default:
P = F + I + P + N;
break;
}
return s(P);
}
return R.toString = function() {
return u + "";
}, R;
}
function l(u, f) {
var d = h((u = ve(u), u.type = "f", u)), p = Math.max(-8, Math.min(8, Math.floor(Dt(f) / 3))) * 3, g = Math.pow(10, -p), y = _i[8 + p / 3];
return function(m) {
return d(g * m) + y;
};
}
return {
format: h,
formatPrefix: l
};
}
var oe, or, ar;
Po({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function Po(e) {
return oe = Ao(e), or = oe.format, ar = oe.formatPrefix, oe;
}
function Co(e) {
return Math.max(0, -Dt(Math.abs(e)));
}
function Lo(e, t) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Dt(t) / 3))) * 3 - Dt(Math.abs(e)));
}
function ko(e, t) {
return e = Math.abs(e), t = Math.abs(t) - e, Math.max(0, Dt(t) - Dt(e)) + 1;
}
function Eo(e, t, n, i) {
var r = Fs(e, t, n), s;
switch (i = ve(i ?? ",f"), i.type) {
case "s": {
var o = Math.max(Math.abs(e), Math.abs(t));
return i.precision == null && !isNaN(s = Lo(r, o)) && (i.precision = s), ar(i, o);
}
case "":
case "e":
case "g":
case "p":
case "r": {
i.precision == null && !isNaN(s = ko(r, Math.max(Math.abs(e), Math.abs(t)))) && (i.precision = s - (i.type === "e"));
break;
}
case "f":
case "%": {
i.precision == null && !isNaN(s = Co(r)) && (i.precision = s - (i.type === "%") * 2);
break;
}
}
return or(i);
}
function Fo(e) {
var t = e.domain;
return e.ticks = function(n) {
var i = t();
return Es(i[0], i[i.length - 1], n ?? 10);
}, e.tickFormat = function(n, i) {
var r = t();
return Eo(r[0], r[r.length - 1], n ?? 10, i);
}, e.nice = function(n) {
n == null && (n = 10);
var i = t(), r = 0, s = i.length - 1, o = i[r], a = i[s], c, h, l = 10;
for (a < o && (h = o, o = a, a = h, h = r, r = s, s = h); l-- > 0; ) {
if (h = rn(o, a, n), h === c)
return i[r] = o, i[s] = a, t(i);
if (h > 0)
o = Math.floor(o / h) * h, a = Math.ceil(a / h) * h;
else if (h < 0)
o = Math.ceil(o * h) / h, a = Math.floor(a * h) / h;
else
break;
c = h;
}
return e;
}, e;
}
function Pt() {
var e = xo();
return e.copy = function() {
return yo(e, Pt());
}, Ki.apply(e, arguments), Fo(e);
}
class Ro {
constructor(t, n = !0, i, r, s, o) {
this._showLabels = !0, this._offsetX = 0, this._offsetY = 0, this._flipX = !1, this._flipY = !1, this.visible = !0, this.createOrGet = (a) => {
const { mainGroup: c } = this;
let h = c.select(`g.${a}`);
return h.empty() && (h = c.append("g").attr("class", a)), h;
}, this.mainGroup = t, this._showLabels = n, this._labelXDesc = i, this._labelYDesc = r, this._unitOfMeasure = s, o && o.offsetX && (this._offsetX = o.offsetX), o && o.offsetX && (this._offsetY = o.offsetY), o && o.visible && (this.visible = o.visible), this.mainGroup.style("pointer-events", "none"), this._scaleX = Pt().domain([0, 1]).range([0, 1]), this._scaleY = Pt().domain([0, 1]).range([0, 1]);
}
renderLabelx() {
const { _labelXDesc: t, _unitOfMeasure: n, _showLabels: i, _scaleX: r } = this, [, s] = r.range(), o = this.renderGx();
let a = o.select("text.axis-labelx");
return i ? a.empty() && (a = o.append("text").attr("class", "axis-labelx").attr("fill", "rgba(0,0,0,0.3)").style("text-anchor", "middle").style("font-weight", "800").style("font-size", "10px").text(`${t} (${n})`)) : a.remove(), a.attr("transform", `translate(${s / 2},-4)`), a;
}
renderLabely() {
const { _labelYDesc: t, _unitOfMeasure: n, _showLabels: i, _scaleY: r } = this, [, s] = r.range(), o = this.renderGy();
let a = o.select("text.axis-labely");
return i ? (a.empty() && (a = o.append("text").attr("class", "axis-labely").attr("fill", "rgba(0,0,0,0.3)").style("text-anchor", "middle").style("font-weight", "800").style("font-size", "10px").text(`${t} (${n})`)), a.attr("transform", `translate(-10,${s / 2})rotate(90)`)) : a.remove(), a;
}
renderGy() {
const { _scaleX: t, _scaleY: n } = this, i = ys(n), [, r] = t.range(), s = this.createOrGet("y-axis");
return s.call(i), s.attr("transform", `translate(${r},0)`), s;
}
renderGx() {
const { _scaleX: t, _scaleY: n } = this, i = _s(t), [, r] = n.range(), s = this.createOrGet("x-axis");
return s.attr("transform", `translate(0 ${r})`), s.call(i), s;
}
render() {
this.renderLabelx(), this.renderLabely();
}
onResize(t) {
this.mainGroup.attr("height", `${t.height}px`).attr("width", `${t.width}px`);
}
onRescale(t) {
const { _scaleX: n, _scaleY: i, offsetX: r, offsetY: s } = this, { xScale: o, yScale: a } = t, c = o.domain(), h = a.domain(), l = o.range(), u = a.range();
n.domain([c[0] - r, c[1] - r]).range(l), i.domain([h[0] - s, h[1] - s]).range(u), this.flipX(this._flipX), this.flipY(this._flipY), this.visible && this.render();
}
show() {
return this.visible = !0, this.mainGroup.attr("visibility", "visible"), this.render(), this;
}
hide() {
return this.visible = !1, this.mainGroup.attr("visibility", "hidden"), this;
}
flipX(t) {
this._flipX = t;
const n = this._scaleX.domain(), i = t ? -1 : 1;
return this._scaleX.domain([i * n[0], i * n[1]]), this;
}
flipY(t) {
this._flipY = t;
const n = this._scaleY.domain(), i = t ? -1 : 1;
return this._scaleY.domain([i * n[0], i * n[1]]), this;
}
showLabels() {
return this._showLabels = !0, this.render(), this;
}
hideLabels() {
return this._showLabels = !1, this.render(), this;
}
setLabelX(t) {
return this._labelXDesc = t, this;
}
setLabelY(t) {
return this._labelYDesc = t, this;
}
setUnitOfMeasure(t) {
return this._unitOfMeasure = t, this;
}
setLabels(t, n, i) {
return this._labelXDesc = t, this._labelYDesc = n, this._unitOfMeasure = i, this;
}
get offsetX() {
return this._offsetX;
}
set offsetX(t) {
this._offsetX = t;
}
get offsetY() {
return this._offsetY;
}
set offsetY(t) {
this._offsetY = t;
}
get scaleX() {
return this._scaleX.copy();
}
get scaleY() {
return this._scaleY.copy();
}
}
var Io = Math.PI / 180;
function _t(e, t, n) {
return t === void 0 && (t = 0), n === void 0 && (n = 1), e < t ? t : e > n ? n : e;
}
function zo(e) {
return e * Io;
}
function xi(e) {
var t = new Array(e), n = 1 / (e - 1);
t[0] = 0;
for (var i = 1; i < e - 1; i++)
t[i] = i * n;
return t[e - 1] = 1, t;
}
function $t(e, t, n) {
n === void 0 && (n = e);
for (var i = 0; i < e.length; i++)
n[i] = e[i] + t[i];
return n;
}
function Bt(e, t, n) {
n === void 0 && (n = e);
for (var i = 0; i < e.length; i++)
n[i] = e[i] - t[i];
return n;
}
function Tt(e, t, n) {
n === void 0 && (n = e);
for (var i = 0; i < e.length; i++)
n[i] = e[i] * t;
return n;
}
function Do(e) {
for (var t = 0, n = 0; n < e.length; n++)
t += Math.pow(e[n], 2);
return t;
}
function Vt(e) {
var t = Do(e);
return t === 0 ? t : Math.sqrt(t);
}
function vi(e, t) {
t === void 0 && (t = e);
var n = Vt(e);
return n === 0 ? Oo(0, t) : Tt(e, 1 / n, t);
}
function Oo(e, t) {
for (var n = 0; n < t.length; n++)
t[n] = e;
return t;
}
function No(e, t) {
for (var n = 0, i = 0; i < e.length; i++)
n += Math.pow(t[i] - e[i], 2);
return n === 0 ? n : Math.sqrt(n);
}
function $o(e, t) {
for (var n = 0, i = 0; i < e.length; i++)
n += e[i] * t[i];
return n;
}
function Bo(e, t, n, i) {
i === void 0 && (i = e);
for (var r = _t(n, 0, 1), s = 1 - r, o = 0; o < e.length; o++)
i[o] = e[o] * s + t[o] * r;
return i;
}
function Ho(e, t, n) {
n === void 0 && (n = e);
for (var i = 0; i < e.length; i++)
n[i] = t(e[i], i);
return n;
}
function wi(e, t) {
t === void 0 && (t = 0), t === void 0 && (t = 0);
for (var n = 0; n < e.length; n++)
if (Math.abs(e[n]) > t)
return !1;
return !0;
}
var Ge = 180 / Math.PI, Xo = Math.PI / 180;
function qe(e, t, n) {
var i = Math.cos(t), r = Math.sin(t), s = e[0];
return n[0] = i * s - r * e[1], n[1] = r * s + i * e[1], n;
}
function bi(e) {
return Math.atan2(e[1], e[0]);
}
function Ht(e, t) {
var n = Math.atan2(t[1], t[0]) - Math.atan2(e[1], e[0]);
return n > Math.PI ? n -= 2 * Math.PI : n <= -Math.PI && (n += 2 * Math.PI), n;
}
var D = function() {
function e(t) {
for (var n = [], i = 1; i < arguments.length; i++)
n[i - 1] = arguments[i];
this.isMutating = !1, this.length = 2, typeof t == "number" ? typeof n[0] == "number" ? (this[0] = t, this[1] = n[0]) : (this[0] = t, this[1] = t) : "x" in t && "y" in t ? (this[0] = t.x, this[1] = t.y) : (this[0] = t[0], this[1] = t[1]);
}
return Object.defineProperty(e.prototype, "x", { get: function() {
return this[0];
}, set: function(t) {
this[0] = t;
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y", { get: function() {
return this[1];
}, set: function(t) {
this[1] = t;
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "magnitude", { get: function() {
return Vt(this);
}, set: function(t) {
var n = Vt(this);
Tt(this, t / n, this);
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "mutable", { get: function() {
return this.isMutating = !0, this;
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "immutable", { get: function() {
return this.isMutating = !1, this;
}, enumerable: !0, configurable: !0 }), e.prototype.set = function(t, n) {
return typeof t == "number" ? typeof n == "number" ? (this[0] = t, this[1] = n) : (this[0] = t, this[1] = t) : (this[0] = t[0], this[1] = t[1]), this;
}, e.prototype.add = function(t, n) {
return n === void 0 && (n = 0), typeof t == "number" ? this.isMutating ? $t(this, [t, n]) : $t(this.clone(), [t, n]) : this.isMutating ? $t(this, t) : $t(this.clone(), t);
}, e.add = function(t, n) {
var i = new e(t);
return $t(i, n);
}, e.prototype.sub = function(t, n) {
return n === void 0 && (n = 0), typeof t == "number" ? this.isMutating ? Bt(this, [t, n]) : Bt(this.clone(), [t, n]) : this.isMutating ? Bt(this, t) : Bt(this.clone(), t);
}, e.sub = function(t, n) {
var i = new e(t);
return Bt(i, n);
}, e.prototype.subFrom = function(t, n) {
return n === void 0 && (n = 0), typeof t == "number" ? this.isMutating ? (this[0] = t - this[0], this[1] = n - this[1], this) : new e(t - this[0], n - this[1]) : this.isMutating ? (this[0] = t[0] - this[0], this[1] = t[1] - this[1], this) : new e(t[0] - this[0], t[1] - this[1]);
}, e.divide = function(t, n) {
var i = new e(t);
return Tt(i, 1 / n);
}, e.multiply = function(t, n) {
var i = new e(t);
return Tt(i, n);
}, e.prototype.scale = function(t) {
return Tt(this, t, this.isMutating ? this : e.zero);
}, e.prototype.rescale = function(t) {
var n = Vt(this);
return n <= 0 ? this.isMutating ? this : e.zero : Tt(this, t / n, this.isMutating ? this : e.zero);
}, e.prototype.clampMagnitude = function(t) {
var n = Vt(this);
return n > t ? Tt(this, t / n, this.isMutating ? this : e.zero) : this.isMutating ? this : this.clone();
}, e.prototype.rotate = function(t) {
return qe(this, t, this.isMutating ? this : e.zero);
}, e.prototype.rotateDeg = function(t) {
return qe(this, t * Xo, this.isMutating ? this : e.zero);
}, e.prototype.rotate90 = function() {
return t = this, n = this.isMutating ? this : e.zero, i = t[0], n[0] = -t[1], n[1] = i, n;
var t, n, i;
}, e.prototype.rotate180 = function() {
return t = this, (n = this.isMutating ? this : e.zero)[0] = -t[0], n[1] = -t[1], n;
var t, n;
}, e.prototype.rotate270 = function() {
return t = this, n = this.isMutating ? this : e.zero, i = t[0], n[0] = t[1], n[1] = -i, n;
var t, n, i;
}, e.prototype.normalize = function() {
return vi(this);
}, e.prototype.normalized = function() {
return vi(this, e.zero);
}, e.distance = function(t, n) {
return No(t, n);
}, e.dot = function(t, n) {
return $o(t, n);
}, e.cross = function(t, n) {
return function(i, r) {
return i[0] * r[1] - i[1] * r[0];
}(t, n);
}, e.angleRight = function(t) {
return bi(t);
}, e.angleRightDeg = function(t) {
return bi(t) * Ge;
}, e.angle = function(t, n) {
return Math.abs(Ht(t, n));
}, e.angleDeg = function(t, n) {
return Math.abs(Ht(t, n)) * Ge;
}, e.signedAngle = function(t, n) {
return Ht(t, n);
}, e.signedAngleDeg = function(t, n) {
return Ht(t, n) * Ge;
}, e.lerp = function(t, n, i) {
var r = new e(t);
return Bo(r, n, i);
}, e.lerpRot = function(t, n, i) {
return function(r, s, o, a) {
return a === void 0 && (a = r), qe(r, o * Ht(r, s), a);
}(t, n, i, e.zero);
}, e.prototype.clone = function() {
return new e(this[0], this[1]);
}, e.equals = function(t, n, i) {
return i === void 0 && (i = 0), !(Math.abs(t[0] - n[0]) > i) && !(Math.abs(t[1] - n[1]) > i);
}, e.prototype.equals = function(t, n) {
return n === void 0 && (n = 0), e.equals(this, t, n);
}, e.isZeroVector = function(t, n) {
return n === void 0 && (n = 0), wi(t, n);
}, e.prototype.isZeroVector = function(t) {
return t === void 0 && (t = 0), wi(this, t);
}, e.prototype.toArray = function() {
return [this[0], this[1]];
}, e.prototype.modify = function(t) {
return Ho(this, t);
}, e.prototype[Symbol.iterator] = function() {
var t = this, n = 0;
return { next: function() {
switch (n++) {
case 0:
return { value: t[0], done: !1 };
case 1:
return { value: t[1], done: !1 };
default:
return { value: -1, done: !0 };
}
} };
}, Object.defineProperty(e, "zero", { get: function() {
return new e(0, 0);
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "one", { get: function() {
return new e(1, 1);
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "positiveInfinity", { get: function() {
return new e(1 / 0, 1 / 0);
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "negativeInfinity", { get: function() {
return new e(-1 / 0, -1 / 0);
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "up", { get: function() {
return new e(0, 1);
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "right", { get: function() {
return new e(1, 0);
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "down", { get: function() {
return new e(0, -1);
}, enumerable: !0, configurable: !0 }), Object.defineProperty(e, "left", { get: function() {
return new e(-1, 0);
}, enumerable: !0, configurable: !0 }), e;
}();
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var ln = function(e, t) {
return ln = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var r in i)
i.hasOwnProperty(r) && (n[r] = i[r]);
}, ln(e, t);
};
function zn(e, t) {
function n() {
this.constructor = e;
}
ln(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}
var un = function() {
return un = Object.assign || function(e) {
for (var t, n = 1, i = arguments.length; n < i; n++)
for (var r in t = arguments[n])
Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
return e;
}, un.apply(this, arguments);
};
function Ti(e, t) {
for (var n = new Array(e.length), i = 0; i < e.length; i++)
n[i] = 2 * e[i] - t[i];
return n;
}
function fn(e, t, n) {
var i, r, s, o, a = t.length - 1;
if (n)
i = t[e - 1 < 0 ? a : e - 1], r = t[e % t.length], s = t[(e + 1) % t.length], o = t[(e + 2) % t.length];
else {
if (e === a)
throw Error("There is no spline segment at this index for a closed curve!");
r = t[e], s = t[e + 1], i = e > 0 ? t[e - 1] : Ti(r, s), o = e < a - 1 ? t[e + 2] : Ti(s, r);
}
return [i, r, s, o];
}
function Uo(e, t, n) {
n === void 0 && (n = !1);
var i = n ? t.length : t.length - 1;
if (e === 1)
return { index: i - 1, weight: 1 };
var r = i * e, s = Math.floor(r);
return { index: s, weight: r - s };
}
function Vo(e, t) {
for (var n = 0; n < e.length; n++)
e[n] = t;
return e;
}
function Wo(e, t) {
for (var n = 0; n < e.length; n++)
e[n] = t(e[n], n);
re