const DEFAULT_METRIC_CARD_COUNT = 4;
const DEFAULT_COLUMNS = 2;
/**
* 根据容器可用宽度计算四个指标卡片的列数。
* 仅返回 1 / 2 / 4 列，避免 3+1 的视觉断层。
*/
function getWeighingMetricGridColumns(params) {
	const { containerWidth, gap, minCardWidth = 140, cardCount = DEFAULT_METRIC_CARD_COUNT } = params;
	if (!Number.isFinite(containerWidth) || containerWidth <= 0) return DEFAULT_COLUMNS;
	const normalizedGap = Math.max(gap, 0);
	const twoColumnMinWidth = minCardWidth * 2 + normalizedGap;
	if (containerWidth >= minCardWidth * cardCount + normalizedGap * Math.max(cardCount - 1, 0)) return cardCount;
	if (containerWidth >= twoColumnMinWidth) return 2;
	return 1;
}
function getWeighingMetricGridStyle(params) {
	return { gridTemplateColumns: `repeat(${getWeighingMetricGridColumns(params)}, minmax(0, 1fr))` };
}
//#endregion
export { getWeighingMetricGridColumns, getWeighingMetricGridStyle };
