const COLUMN_SIZE_TO_COLS = {
  SMALL: 4,
  MEDIUM: 3,
  LARGE: 2,
  EXTRA_LARGE: 1
};
const RESPONSIVE_COLS = {
  SMALL: 2,
  MEDIUM: 2,
  LARGE: 1,
  EXTRA_LARGE: 1
};
const getColumnsPerRow = (columnSize) => COLUMN_SIZE_TO_COLS[columnSize] ?? 3;
const getResponsiveColumnsPerRow = (columnSize) => RESPONSIVE_COLS[columnSize] ?? 2;
const getCellPositionDataAttrs = (cellIndex, totalCells, columnSize) => {
  const lrp = calculateLastRowPosition(
    cellIndex,
    totalCells,
    getColumnsPerRow(columnSize),
    getResponsiveColumnsPerRow(columnSize)
  );
  return {
    "data-cell-index": cellIndex,
    "data-cells-total": totalCells,
    "data-last-row": lrp.isInLastRow || void 0,
    "data-last-row-cells": lrp.isInLastRow ? lrp.cellsInLastRow : void 0,
    "data-last-row-2col": lrp.isInLastRow2Col || void 0,
    "data-last-row-cells-2col": lrp.isInLastRow2Col ? lrp.cellsInLastRow2Col : void 0
  };
};
const calculateLastRowPosition = (cellIndex, totalCells, columnsPerRow, responsiveColumnsPerRow) => {
  const cellsInLastRow = totalCells % columnsPerRow || columnsPerRow;
  const lastRowStart = totalCells - cellsInLastRow;
  const cellsInLastRow2 = totalCells % responsiveColumnsPerRow || responsiveColumnsPerRow;
  const lastRowStart2 = totalCells - cellsInLastRow2;
  return {
    isInLastRow: cellIndex >= lastRowStart,
    cellsInLastRow,
    isInLastRow2Col: cellIndex >= lastRowStart2,
    cellsInLastRow2Col: cellsInLastRow2
  };
};
const getCellMidAngleDeg = (cellIndex, totalCells) => {
  if (totalCells <= 1) {
    return -90;
  }
  return -180 / totalCells + cellIndex * (360 / totalCells);
};
const isBottomCenterCell = (cellIndex, totalCells) => {
  if (totalCells <= 1) {
    return false;
  }
  return Math.abs(getCellMidAngleDeg(cellIndex, totalCells) - 180) < 1e-6;
};
const hasBottomCenterCell = (totalCells) => totalCells >= 3 && totalCells % 2 === 1;
const getCircleCellStyle = (cellIndex, totalCells) => {
  if (isBottomCenterCell(cellIndex, totalCells)) {
    const row2 = (totalCells + 1) / 2;
    return {
      style: { "--ricos-internal-sb-row": `${row2}` },
      side: "bottom",
      row: row2
    };
  }
  const midAngleDeg = getCellMidAngleDeg(cellIndex, totalCells);
  const side = Math.sin(midAngleDeg * Math.PI / 180) >= 0 ? "right" : "left";
  const row = side === "right" ? cellIndex : (totalCells - cellIndex) % totalCells + 1;
  return {
    style: { "--ricos-internal-sb-row": `${row}` },
    side,
    row
  };
};
export {
  getCellMidAngleDeg,
  getCellPositionDataAttrs,
  getCircleCellStyle,
  getColumnsPerRow,
  getResponsiveColumnsPerRow,
  hasBottomCenterCell
};
//# sourceMappingURL=cell-position.js.map
