"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isOddIndex = exports.getOddOffset = exports.getLeftConfig = exports.getEvenOffset = exports.getCenterMediumConfig = exports.getCenterLargeConfig = exports["default"] = exports.columnSize = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var columnSize = exports.columnSize = {
  wide: '4',
  desktop: '4',
  tablet: '5'
};
var isOddIndex = exports.isOddIndex = function isOddIndex(index) {
  return !((index + 1) % 2);
};
var getEvenOffset = exports.getEvenOffset = function getEvenOffset(index) {
  return isOddIndex(index) ? '1' : undefined;
};
var getOddOffset = exports.getOddOffset = function getOddOffset(index) {
  return isOddIndex(index) ? undefined : '1';
};
var getLeftConfig = exports.getLeftConfig = function getLeftConfig(count, index) {
  switch (count) {
    case 2:
    case 4:
      return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
        leftOffsetWide: getEvenOffset(index),
        leftOffsetDesktop: getEvenOffset(index),
        leftOffsetTablet: getEvenOffset(index)
      });
    default:
      return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
        leftOffsetTablet: getEvenOffset(index)
      });
  }
};
var getCenterMediumConfig = exports.getCenterMediumConfig = function getCenterMediumConfig(count, index) {
  switch (count) {
    case 3:
      return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
        leftOffsetTablet: getOddOffset(index)
      });
    case 4:
      return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
        rightOffsetWide: getOddOffset(index),
        leftOffsetWide: getEvenOffset(index),
        rightOffsetDesktop: getEvenOffset(index),
        leftOffsetDesktop: getOddOffset(index),
        rightOffsetTablet: getEvenOffset(index),
        leftOffsetTablet: getOddOffset(index)
      });
    default:
      return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
        rightOffsetWide: getOddOffset(index),
        leftOffsetWide: getEvenOffset(index)
      });
  }
};
var getCenterLargeConfig = exports.getCenterLargeConfig = function getCenterLargeConfig(count, index) {
  switch (count) {
    case 4:
      return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
        leftOffsetWide: getOddOffset(index),
        rightOffsetWide: getEvenOffset(index),
        leftOffsetDesktop: getOddOffset(index),
        rightOffsetDesktop: getEvenOffset(index),
        leftOffsetTablet: getOddOffset(index),
        rightOffsetTablet: getEvenOffset(index)
      });
    case 3:
      return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
        leftOffsetTablet: getOddOffset(index)
      });
    default:
      return (0, _extends2["default"])({}, columnSize);
  }
};
var getCenterConfig = function getCenterConfig(count, index, gutterSize) {
  switch (gutterSize) {
    case 'medium':
      {
        return getCenterMediumConfig(count, index);
      }
    default:
      {
        return getCenterLargeConfig(count, index);
      }
  }
};
var _default = exports["default"] = getCenterConfig;