"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getMenuItemColor = exports.getContentMaxWidth = exports.MIN_WIDTH = exports.MAX_WIDTH = void 0;
var _color = _interopRequireDefault(require("color"));
var _tokens = require("../../styles/tokens");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const MIN_WIDTH = 112;
exports.MIN_WIDTH = MIN_WIDTH;
const MAX_WIDTH = 280;
exports.MAX_WIDTH = MAX_WIDTH;
const getDisabledColor = theme => {
  return (0, _color.default)(theme.dark ? _tokens.colors.white : _tokens.colors.black).alpha(0.32).rgb().string();
};
const getTitleColor = _ref => {
  let {
    theme,
    disabled
  } = _ref;
  if (disabled) {
    return getDisabledColor(theme);
  }
  return (0, _color.default)(theme.colors.text).alpha(0.87).rgb().string();
};
const getIconColor = _ref2 => {
  let {
    theme,
    disabled
  } = _ref2;
  if (disabled) {
    return getDisabledColor(theme);
  }
  return (0, _color.default)(theme.colors.text).alpha(0.54).rgb().string();
};
const getMenuItemColor = _ref3 => {
  let {
    theme,
    disabled
  } = _ref3;
  return {
    titleColor: getTitleColor({
      theme,
      disabled
    }),
    iconColor: getIconColor({
      theme,
      disabled
    }),
    underlayColor: undefined
  };
};
exports.getMenuItemColor = getMenuItemColor;
const getContentMaxWidth = _ref4 => {
  let {
    isV3,
    iconWidth,
    leadingIcon,
    trailingIcon
  } = _ref4;
  if (isV3) {
    if (leadingIcon && trailingIcon) {
      return MAX_WIDTH - (2 * iconWidth + 24);
    }
    if (leadingIcon || trailingIcon) {
      return MAX_WIDTH - (iconWidth + 24);
    }
    return MAX_WIDTH - 12;
  }
  if (leadingIcon) {
    return MAX_WIDTH - (iconWidth + 48);
  }
  return MAX_WIDTH - 16;
};
exports.getContentMaxWidth = getContentMaxWidth;
//# sourceMappingURL=utils.js.map