"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.StyledBlock = void 0;

var _index = require("../styles/index");

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var StyledBlock = (0, _index.styled)('div', function (_ref) {
  var $theme = _ref.$theme,
      $color = _ref.$color,
      $font = _ref.$font,
      $alignContent = _ref.$alignContent,
      $alignItems = _ref.$alignItems,
      $alignSelf = _ref.$alignSelf,
      $flexDirection = _ref.$flexDirection,
      $display = _ref.$display,
      $flex = _ref.$flex,
      $justifyContent = _ref.$justifyContent,
      $justifySelf = _ref.$justifySelf,
      $position = _ref.$position,
      $width = _ref.$width,
      $minWidth = _ref.$minWidth,
      $maxWidth = _ref.$maxWidth,
      $height = _ref.$height,
      $minHeight = _ref.$minHeight,
      $maxHeight = _ref.$maxHeight,
      $overflow = _ref.$overflow,
      $margin = _ref.$margin,
      $marginTop = _ref.$marginTop,
      $marginRight = _ref.$marginRight,
      $marginBottom = _ref.$marginBottom,
      $marginLeft = _ref.$marginLeft,
      $padding = _ref.$padding,
      $paddingTop = _ref.$paddingTop,
      $paddingRight = _ref.$paddingRight,
      $paddingBottom = _ref.$paddingBottom,
      $paddingLeft = _ref.$paddingLeft,
      $flexWrap = _ref.$flexWrap,
      $left = _ref.$left,
      $top = _ref.$top,
      $right = _ref.$right,
      $bottom = _ref.$bottom,
      other = _objectWithoutProperties(_ref, ["$theme", "$color", "$font", "$alignContent", "$alignItems", "$alignSelf", "$flexDirection", "$display", "$flex", "$justifyContent", "$justifySelf", "$position", "$width", "$minWidth", "$maxWidth", "$height", "$minHeight", "$maxHeight", "$overflow", "$margin", "$marginTop", "$marginRight", "$marginBottom", "$marginLeft", "$padding", "$paddingTop", "$paddingRight", "$paddingBottom", "$paddingLeft", "$flexWrap", "$left", "$top", "$right", "$bottom"]);

  var colors = $theme.colors,
      typography = $theme.typography,
      sizing = $theme.sizing;
  var styles = {};

  if ($color !== undefined) {
    styles.color = colors[$color] || $color;
  }

  if ($font !== undefined) {
    var font = typography[$font];
    styles.fontFamily = font.fontFamily;
    styles.fontWeight = font.fontWeight;
    styles.fontSize = font.fontSize;
    styles.lineHeight = font.lineHeight;
  }

  if ($alignContent !== undefined) {
    styles.alignContent = $alignContent;
  }

  if ($alignItems !== undefined) {
    styles.alignItems = $alignItems;
  }

  if ($alignSelf !== undefined) {
    styles.alignSelf = $alignSelf;
  }

  if ($flexDirection !== undefined) {
    styles.flexDirection = $flexDirection;
  }

  if ($display !== undefined) {
    styles.display = $display;
  }

  if ($flex !== undefined) {
    styles.flex = $flex;
  }

  if ($justifyContent !== undefined) {
    styles.justifyContent = $justifyContent;
  }

  if ($justifySelf !== undefined) {
    styles.justifySelf = $justifySelf;
  }

  if ($position !== undefined) {
    styles.position = $position;
  }

  if ($width !== undefined) {
    styles.width = $width;
  }

  if ($minWidth !== undefined) {
    styles.minWidth = $minWidth;
  }

  if ($maxWidth !== undefined) {
    styles.maxWidth = $maxWidth;
  }

  if ($height !== undefined) {
    styles.height = $height;
  }

  if ($minHeight !== undefined) {
    styles.minHeight = $minHeight;
  }

  if ($maxHeight !== undefined) {
    styles.maxHeight = $maxHeight;
  }

  if ($overflow === 'scrollX') {
    styles.overflowX = 'scroll';
  } else if ($overflow === 'scrollY') {
    styles.overflowY = 'scroll';
  } else if ($overflow !== undefined) {
    styles.overflow = $overflow;
  }

  if ($margin !== undefined) {
    styles.margin = sizing[$margin] || $margin;
  }

  if ($marginTop !== undefined) {
    styles.marginTop = sizing[$marginTop] || $marginTop;
  }

  if ($marginRight !== undefined) {
    styles.marginRight = sizing[$marginRight] || $marginRight;
  }

  if ($marginBottom !== undefined) {
    styles.marginBottom = sizing[$marginBottom] || $marginBottom;
  }

  if ($marginLeft !== undefined) {
    styles.marginLeft = sizing[$marginLeft] || $marginLeft;
  }

  if ($padding !== undefined) {
    styles.padding = sizing[$padding] || $padding;
  }

  if ($paddingTop !== undefined) {
    styles.paddingTop = sizing[$paddingTop] || $paddingTop;
  }

  if ($paddingRight !== undefined) {
    styles.paddingRight = sizing[$paddingRight] || $paddingRight;
  }

  if ($paddingBottom !== undefined) {
    styles.paddingBottom = sizing[$paddingBottom] || $paddingBottom;
  }

  if ($paddingLeft !== undefined) {
    styles.paddingLeft = sizing[$paddingLeft] || $paddingLeft;
  }

  if ($flexWrap !== undefined) {
    styles.flexWrap = 'wrap';
  }

  if ($left !== undefined) {
    styles.left = $left;
  }

  if ($top !== undefined) {
    styles.top = $top;
  }

  if ($right !== undefined) {
    styles.right = $right;
  }

  if ($bottom !== undefined) {
    styles.bottom = $bottom;
  }

  return styles;
});
exports.StyledBlock = StyledBlock;