"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _utils = require("../../../../mixins/utils");
var blank = {
  top: "0",
  right: "0",
  bottom: "0",
  left: "0"
};
var _default = exports["default"] = function _default(theme, margin) {
  if (!Array.isArray(margin) || margin.length < 1 || margin.length > 4) {
    return blank;
  }
  var dimensions = margin.map(function (size) {
    return (0, _utils.getDimension)(theme, size);
  });
  if (dimensions.length === 1) {
    return {
      top: dimensions[0],
      right: dimensions[0],
      bottom: dimensions[0],
      left: dimensions[0]
    };
  }
  if (dimensions.length === 2) {
    return {
      top: dimensions[0],
      right: dimensions[1],
      bottom: dimensions[0],
      left: dimensions[1]
    };
  }
  if (dimensions.length === 3) {
    return {
      top: dimensions[0],
      right: dimensions[1],
      bottom: dimensions[2],
      left: dimensions[1]
    };
  }
  return {
    top: dimensions[0],
    right: dimensions[1],
    bottom: dimensions[2],
    left: dimensions[3]
  };
};