//#region src/internal/charts/timeSeriesLineChartHelpers.ts
var e = 6, t = 5;
function n(t) {
	let n = t[0];
	if (n == null || n.data.length <= e) return n == null ? [] : n.data.map((e) => e.x);
	let r = Math.ceil(n.data.length / e), i = n.data.filter((e, t) => t % r === 0).map((e) => e.x), a = n.data.at(-1);
	return a != null && i.at(-1) !== a.x && i.push(a.x), i;
}
function r(e) {
	return (/* @__PURE__ */ new Date(`${e}T00:00:00Z`)).toLocaleDateString(void 0, {
		month: "short",
		day: "2-digit"
	});
}
function i(e) {
	return Number(e.toPrecision(12));
}
function a(e) {
	if (!Number.isFinite(e) || e <= 0) return 1;
	let t = 10 ** Math.floor(Math.log10(e)), n = e / t;
	return n <= 1 ? t : n <= 2 ? 2 * t : n <= 5 ? 5 * t : 10 * t;
}
function o(e, t, n, r) {
	if (t <= e) return [i(e)];
	let o = (t - e) / (r - 1), s = a(Math.max(o, n)), c = [];
	for (let n = e; n <= t + s / 10 && c.length < r; n += s) c.push(i(n));
	let l = i(t);
	return c.at(-1) !== l && c.length < r && c.push(l), c;
}
function s(e) {
	let t = 0;
	for (let n of e) for (let e of n.data) Number.isFinite(e.y) && e.y > t && (t = e.y);
	return t;
}
function c(e) {
	let t = new Intl.NumberFormat("en-US", {
		notation: "compact",
		maximumFractionDigits: 1
	}).format(e);
	return e !== 0 && t === "0" ? new Intl.NumberFormat("en-US", { maximumSignificantDigits: 2 }).format(e) : t;
}
function l(e, n) {
	let r = 0;
	Number.isFinite(n.min) && (r = n.min ?? 0);
	let c = 0;
	n.minTickStep != null && Number.isFinite(n.minTickStep) && (c = Math.max(n.minTickStep, 0));
	let l = t;
	if (n.maxTickCount != null && Number.isFinite(n.maxTickCount) && (l = Math.max(Math.floor(n.maxTickCount), 2)), typeof n.max == "number" && Number.isFinite(n.max)) {
		let e = Math.max(n.max, r);
		return {
			min: r,
			max: e,
			tickValues: o(r, e, c, l)
		};
	}
	let u = Math.max(s(e), r) - r, d = c;
	u > 0 && (d = u / (l - 1));
	let f = a(Math.max(d, c)), p = i(r + Math.max(Math.ceil(u / f), 1) * f);
	return {
		min: r,
		max: p,
		tickValues: o(r, p, f, l)
	};
}
//#endregion
export { r as formatDayTick, c as formatYAxisTick, s as getSeriesYMax, n as getVisibleDayTicks, l as resolveYAxisState };

//# sourceMappingURL=timeSeriesLineChartHelpers.js.map