"use strict";

exports.__esModule = true;
exports.StyledTabsWrapper = exports.StyledTabs = exports.StyledTabMenu = exports.StyledTab = void 0;
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _utils = require("../../theme/utils");
var _flex = _interopRequireDefault(require("../templates/flex"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
var StyledTabsWrapper = exports.StyledTabsWrapper = (0, _styledComponents["default"])(_flex["default"]).attrs(function (props) {
  return _extends({
    column: true,
    flexWrap: false
  }, props);
}).withConfig({
  displayName: "styled__StyledTabsWrapper",
  componentId: "sc-1n790ui-0"
})([""]);
var StyledTabs = exports.StyledTabs = (0, _styledComponents["default"])(_flex["default"]).attrs(function (props) {
  return _extends({
    as: "nav",
    row: true,
    flexWrap: false,
    justifyContent: "start",
    alignItems: "center",
    padding: [0, 0.5],
    flex: false,
    border: !props.noDefaultBorder && {
      side: "bottom",
      size: "1px",
      type: "solid",
      color: "border"
    }
  }, props);
}).withConfig({
  displayName: "styled__StyledTabs",
  componentId: "sc-1n790ui-1"
})([""]);
var colorsByFlavour = {
  success: {
    background: "menuItemSelected",
    borderColor: "accent",
    color: "menuItem"
  },
  warning: {
    background: "warningSemi",
    borderColor: "warning",
    color: "menuItem"
  },
  error: {
    background: "errorSemi",
    borderColor: "error",
    color: "menuItem"
  },
  "default": {
    background: "modalBackground",
    borderColor: "border",
    color: "menuItem"
  }
};
var activeColorsByFlavour = {
  success: _extends({}, colorsByFlavour.success, {
    color: "primary"
  }),
  warning: _extends({}, colorsByFlavour.warning, {
    color: "warning"
  }),
  error: _extends({}, colorsByFlavour.error, {
    color: "error"
  }),
  "default": {
    background: "menuItemSelected",
    borderColor: "accent",
    color: "primary"
  }
};
var hoverColorsByFlavour = _extends({}, colorsByFlavour, {
  "default": _extends({}, colorsByFlavour["default"], {
    borderColor: "primary"
  })
});
var colors = function colors(_ref) {
  var _ref3;
  var theme = _ref.theme,
    active = _ref.active,
    green = _ref.green,
    flavour = _ref.flavour;
  var dictionary = active ? activeColorsByFlavour : colorsByFlavour;
  var _ref2 = dictionary[flavour] || dictionary["default"],
    background = _ref2.background,
    borderColor = _ref2.borderColor,
    color = _ref2.color;
  var styles = ["border-bottom-color: " + (0, _utils.getColor)(borderColor)({
    theme: theme
  }) + ";", "background: " + (0, _utils.getColor)(background)({
    theme: theme
  }) + ";", "& > span { color: " + (0, _utils.getColor)(color)({
    theme: theme
  }) + "; }"];
  if (!active && green) {
    styles.push("border-bottom-color: " + (0, _utils.getColor)(["transparent", "full"])({
      theme: theme
    }) + ";");
  }
  var hoverStyles = ["&:hover {\n    border-bottom-color: " + (0, _utils.getColor)((_ref3 = hoverColorsByFlavour[flavour] || hoverColorsByFlavour["default"]) == null ? void 0 : _ref3.borderColor)({
    theme: theme
  }) + ";\n  }"];
  return [].concat(styles, hoverStyles).join("");
};
var StyledTab = exports.StyledTab = (0, _styledComponents["default"])(_flex["default"]).attrs(function (props) {
  return _extends({
    small: true,
    padding: [0, 6]
  }, props);
}).withConfig({
  displayName: "styled__StyledTab",
  componentId: "sc-1n790ui-2"
})(["white-space:nowrap;border-bottom-width:1px;border-bottom-style:solid;box-sizing:border-box;border-radius:2px 2px 0 0;max-width:", ";height:", ";cursor:pointer;opacity:", ";pointer-events:", ";margin-bottom:-1px;", ""], function (_ref4) {
  var maxWidth = _ref4.maxWidth;
  return maxWidth != null ? maxWidth : (0, _utils.getSizeBy)(26);
}, function (_ref5) {
  var small = _ref5.small,
    green = _ref5.green;
  return green ? small ? (0, _utils.getSizeBy)(3) : (0, _utils.getSizeBy)(4) : small ? (0, _utils.getSizeBy)(4) : (0, _utils.getSizeBy)(5);
}, function (_ref6) {
  var disabled = _ref6.disabled;
  return disabled ? 0.4 : 1;
}, function (_ref7) {
  var disabled = _ref7.disabled;
  return disabled ? "none" : "auto";
}, colors);
var StyledTabMenu = exports.StyledTabMenu = (0, _styledComponents["default"])(_flex["default"]).withConfig({
  displayName: "styled__StyledTabMenu",
  componentId: "sc-1n790ui-3"
})(["white-space:nowrap;color:", ";padding:4px 8px;background:", ";width:100%;border-radius:4px;cursor:pointer;justify-content:flex-start;&:hover{background:", ";}"], (0, _utils.getColor)("text"), function (_ref8) {
  var active = _ref8.active;
  return active ? (0, _utils.getColor)("menuItemSelected") : (0, _utils.getColor)(["transparent", "full"]);
}, (0, _utils.getColor)("menuItemHover"));