var e = .6, t = 100 * e, n = .7, r = .85;
function i(e) {
	return Array.isArray(e) ? e.filter(Number.isFinite) : [];
}
function a(n, r, i = e) {
	let a = n === "line" || n === "area" || n === "gradient" ? Math.max(r - 1, 1) : r, o = Number.isFinite(i) && i > 0 ? i : e;
	return {
		width: n === "line" ? a * 100 * o : a * t,
		height: 100
	};
}
function o(e, t = {}) {
	if (e.length === 0) return;
	let { explicitMin: n, explicitMax: r, includeZero: i = !1 } = t, a = Math.min(...e), o = Math.max(...e);
	return {
		min: n ?? (i ? Math.min(a, 0) : a),
		max: r ?? (i ? Math.max(o, 0) : o)
	};
}
function s(e, t, n = 100) {
	let r = t.max - t.min;
	return r === 0 ? n / 2 : n - (e - t.min) / r * n;
}
function c(e, t, n) {
	let r = n.height ?? 100, i = e.length > 1 ? n.width / (e.length - 1) : 0;
	return e.map((e, n) => ({
		x: n * i,
		y: s(e, t, r)
	}));
}
function l(e, t) {
	let n = /* @__PURE__ */ new Set();
	if (e.length === 0 || (t.first && n.add(0), t.last && n.add(e.length - 1), !(t.min || t.max))) return n;
	let r = Math.min(...e), i = Math.max(...e);
	return e.forEach((e, a) => {
		t.min && e === r && n.add(a), t.max && e === i && n.add(a);
	}), n;
}
function u(e) {
	switch (e) {
		case "linear": return "linear";
		case "smooth": return "smooth";
		case "step": return "step";
		default: return "linear";
	}
}
function d(e, t, n) {
	if (e.length === 0) return "";
	if (e.length === 1) {
		let t = e[0].y.toFixed(2);
		return `M 0 ${t} L ${n.toFixed(2)} ${t}`;
	}
	switch (t) {
		case "step": return _(e);
		case "smooth": return g(e);
		case "linear": return h(e);
		default: return h(e);
	}
}
function f(e, t, n = 100) {
	if (e.length === 0) return "";
	let r = "";
	switch (t) {
		case "step":
			r = _(e);
			break;
		case "smooth":
			r = g(e);
			break;
		case "linear":
			r = h(e);
			break;
		default:
			r = h(e);
			break;
	}
	let i = e[e.length - 1], a = e[0];
	return r += ` L ${i.x.toFixed(2)} ${n.toFixed(2)}`, r += ` L ${a.x.toFixed(2)} ${n.toFixed(2)} Z`, r;
}
function p(e, t, r) {
	let { bandSize: i, stepSize: a } = v(e.length, r, n);
	return e.map((e, n) => {
		let r = n * a + (a - i) / 2, o = Math.abs(e.y - t);
		return {
			x: r,
			y: Math.min(e.y, t),
			width: i,
			height: o
		};
	});
}
function m(e, t, n) {
	let { bandSize: i, stepSize: a } = v(e.length, n.width, r), o = n.height / 2;
	return e.map((e, n) => {
		let r = n * a + (a - i) / 2;
		return e > 0 ? {
			className: "win",
			x: r,
			y: t - o,
			width: i,
			height: o
		} : e < 0 ? {
			className: "loss",
			x: r,
			y: t,
			width: i,
			height: o
		} : {
			className: "draw",
			x: r,
			y: t - o / 4,
			width: i,
			height: o / 2
		};
	});
}
function h(e) {
	return e.reduce((e, t, n) => n === 0 ? `M ${t.x.toFixed(2)} ${t.y.toFixed(2)}` : `${e} L ${t.x.toFixed(2)} ${t.y.toFixed(2)}`, "");
}
function g(e) {
	return e.map((t, n) => {
		if (n === 0) return `M ${t.x.toFixed(2)} ${t.y.toFixed(2)}`;
		let r = e[n - 1], i = (t.x - r.x) / 3;
		return `C ${(r.x + i).toFixed(2)} ${r.y.toFixed(2)} ${(t.x - i).toFixed(2)} ${t.y.toFixed(2)} ${t.x.toFixed(2)} ${t.y.toFixed(2)}`;
	}).join(" ");
}
function _(e) {
	let t = `M ${e[0].x.toFixed(2)} ${e[0].y.toFixed(2)}`;
	for (let n = 1; n < e.length; n++) {
		let r = e[n];
		t += ` H ${r.x.toFixed(2)} V ${r.y.toFixed(2)}`;
	}
	return t;
}
function v(e, t, n) {
	if (e <= 0) return {
		bandSize: 0,
		stepSize: 0
	};
	let r = t / e;
	return {
		bandSize: r * n,
		stepSize: r
	};
}
//#endregion
export { o as calculateDomain, l as calculateSymbolIndices, a as calculateViewBox, f as toAreaPath, p as toColumnRects, u as toInterpolation, d as toLinePath, c as toPlotPoints, i as toValidData, m as toWinLossRects, s as valueToY };

//# sourceMappingURL=sparkline.utils.js.map