var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/pro/skuDetailModal/components/weighing/grid.tsx
var grid_exports = {};
__export(grid_exports, {
  WEIGHING_METRIC_CARD_MIN_WIDTH: () => WEIGHING_METRIC_CARD_MIN_WIDTH,
  getWeighingMetricGridColumns: () => getWeighingMetricGridColumns,
  getWeighingMetricGridStyle: () => getWeighingMetricGridStyle
});
module.exports = __toCommonJS(grid_exports);
var WEIGHING_METRIC_CARD_MIN_WIDTH = 140;
var DEFAULT_METRIC_CARD_COUNT = 4;
var DEFAULT_COLUMNS = 2;
function getWeighingMetricGridColumns(params) {
  const {
    containerWidth,
    gap,
    minCardWidth = WEIGHING_METRIC_CARD_MIN_WIDTH,
    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;
  const singleRowMinWidth = minCardWidth * cardCount + normalizedGap * Math.max(cardCount - 1, 0);
  if (containerWidth >= singleRowMinWidth) {
    return cardCount;
  }
  if (containerWidth >= twoColumnMinWidth) {
    return 2;
  }
  return 1;
}
function getWeighingMetricGridStyle(params) {
  const columns = getWeighingMetricGridColumns(params);
  return {
    gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  WEIGHING_METRIC_CARD_MIN_WIDTH,
  getWeighingMetricGridColumns,
  getWeighingMetricGridStyle
});
