import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _extends from "@babel/runtime/helpers/esm/extends";

var accessibilityFocus = function accessibilityFocus(token) {
  var controlOutlineWidth = token.controlOutlineWidth,
      colorPrimaryHover = token.colorPrimaryHover;
  return {
    boxShadow: "0 0 0 ".concat(controlOutlineWidth, "px ").concat(colorPrimaryHover)
  };
};

var getThemeStyle = function getThemeStyle(token, themeSuffix) {
  var _$concat3, _$concat4, _$concat8, _$concat$concat3;

  var componentCls = token.componentCls,
      themeColorText = token.themeColorText,
      themeColorTextSelect = token.themeColorTextSelect,
      themeColorTextSecondary = token.themeColorTextSecondary,
      themeColorBg = token.themeColorBg,
      themeColorBgSecondary = token.themeColorBgSecondary,
      themeColorBgActive = token.themeColorBgActive,
      themeColorBgSelect = token.themeColorBgSelect,
      themeInkBarHeight = token.themeInkBarHeight,
      themeInkBarWidth = token.themeInkBarWidth,
      themeInkBorderSize = token.themeInkBorderSize,
      motionDurationSlow = token.motionDurationSlow,
      motionEaseInOut = token.motionEaseInOut,
      motionEaseOut = token.motionEaseOut,
      menuItemPaddingInline = token.menuItemPaddingInline,
      motionDurationFast = token.motionDurationFast,
      themeColorTextHover = token.themeColorTextHover,
      lineType = token.lineType,
      colorBorderSecondary = token.colorBorderSecondary,
      themeColorDisabledText = token.themeColorDisabledText,
      themeColorDangerText = token.themeColorDangerText,
      themeColorDangerTextHover = token.themeColorDangerTextHover,
      themeColorDangerTextSelect = token.themeColorDangerTextSelect,
      themeColorDangerBgActive = token.themeColorDangerBgActive,
      themeColorDangerBgSelect = token.themeColorDangerBgSelect;
  return _defineProperty({}, "".concat(componentCls, "-").concat(themeSuffix), (_$concat$concat3 = {
    color: themeColorText,
    background: themeColorBg
  }, _defineProperty(_$concat$concat3, "&".concat(componentCls, "-root:focus-visible"), _extends({}, accessibilityFocus(token))), _defineProperty(_$concat$concat3, "".concat(componentCls, "-item-group-title"), {
    color: themeColorTextSecondary
  }), _defineProperty(_$concat$concat3, "".concat(componentCls, "-submenu-selected"), _defineProperty({}, "> ".concat(componentCls, "-submenu-title"), {
    color: themeColorTextSelect
  })), _defineProperty(_$concat$concat3, "".concat(componentCls, "-item-disabled, ").concat(componentCls, "-submenu-disabled"), {
    color: "".concat(themeColorDisabledText, " !important")
  }), _defineProperty(_$concat$concat3, "".concat(componentCls, "-item:hover, ").concat(componentCls, "-submenu-title:hover"), _defineProperty({}, "&:not(".concat(componentCls, "-item-selected):not(").concat(componentCls, "-submenu-selected)"), {
    color: themeColorTextHover
  })), _defineProperty(_$concat$concat3, "".concat(componentCls, "-item:active, ").concat(componentCls, "-submenu-title:active"), {
    background: themeColorBgActive
  }), _defineProperty(_$concat$concat3, "".concat(componentCls, "-item-danger"), (_$concat3 = {
    color: themeColorDangerText
  }, _defineProperty(_$concat3, "&".concat(componentCls, "-item:hover"), _defineProperty({}, "&:not(".concat(componentCls, "-item-selected):not(").concat(componentCls, "-submenu-selected)"), {
    color: themeColorDangerTextHover
  })), _defineProperty(_$concat3, "&".concat(componentCls, "-item:active"), {
    background: themeColorDangerBgActive
  }), _$concat3)), _defineProperty(_$concat$concat3, "".concat(componentCls, "-item a"), {
    '&, &:hover': {
      color: 'inherit'
    }
  }), _defineProperty(_$concat$concat3, "".concat(componentCls, "-item-selected"), (_$concat4 = {
    color: themeColorTextSelect
  }, _defineProperty(_$concat4, "&".concat(componentCls, "-item-danger"), {
    color: themeColorDangerTextSelect
  }), _defineProperty(_$concat4, "a, a:hover", {
    color: 'inherit'
  }), _$concat4)), _defineProperty(_$concat$concat3, "&:not(".concat(componentCls, "-horizontal) ").concat(componentCls, "-item-selected"), _defineProperty({
    backgroundColor: themeColorBgSelect
  }, "&".concat(componentCls, "-item-danger"), {
    backgroundColor: themeColorDangerBgSelect
  })), _defineProperty(_$concat$concat3, "".concat(componentCls, "-item, ").concat(componentCls, "-submenu-title"), {
    '&:focus-visible': _extends({}, accessibilityFocus(token))
  }), _defineProperty(_$concat$concat3, "&".concat(componentCls, "-submenu > ").concat(componentCls), {
    backgroundColor: themeColorBg
  }), _defineProperty(_$concat$concat3, "&".concat(componentCls, "-popup > ").concat(componentCls), {
    backgroundColor: themeColorBg
  }), _defineProperty(_$concat$concat3, "&".concat(componentCls, "-horizontal"), _defineProperty({}, "> ".concat(componentCls, "-item, > ").concat(componentCls, "-submenu"), _defineProperty({
    top: themeInkBorderSize,
    marginTop: -themeInkBorderSize,
    marginBottom: 0,
    '&::after': {
      position: 'absolute',
      insetInline: menuItemPaddingInline,
      bottom: 0,
      borderBottom: "".concat(themeInkBarHeight, "px solid transparent"),
      transition: "border-color ".concat(motionDurationSlow, " ").concat(motionEaseInOut),
      content: '""'
    }
  }, "&:hover, &-active, &-open, &-selected", {
    color: themeColorTextSelect,
    '&::after': {
      borderBottomColor: themeColorTextSelect
    }
  }))), _defineProperty(_$concat$concat3, "&".concat(componentCls, "-root"), _defineProperty({}, "&".concat(componentCls, "-inline, &").concat(componentCls, "-vertical"), {
    borderInlineEnd: "".concat(themeInkBorderSize, "px ").concat(lineType, " ").concat(colorBorderSecondary)
  })), _defineProperty(_$concat$concat3, "&".concat(componentCls, "-inline"), (_$concat8 = {}, _defineProperty(_$concat8, "".concat(componentCls, "-sub").concat(componentCls, "-inline"), {
    background: themeColorBgSecondary
  }), _defineProperty(_$concat8, "".concat(componentCls, "-item, ").concat(componentCls, "-submenu-title"), themeInkBorderSize ? {
    width: "calc(100% + ".concat(themeInkBorderSize, "px)")
  } : {}), _defineProperty(_$concat8, "".concat(componentCls, "-item"), _defineProperty({
    position: 'relative',
    '&::after': {
      position: 'absolute',
      insetBlock: 0,
      insetInlineEnd: 0,
      borderInlineEnd: "".concat(themeInkBarWidth, "px solid ").concat(themeColorTextSelect),
      transform: 'scaleY(0.0001)',
      opacity: 0,
      transition: ["transform ".concat(motionDurationFast, " ").concat(motionEaseOut), "opacity ".concat(motionDurationFast, " ").concat(motionEaseOut)].join(','),
      content: '""'
    }
  }, "&".concat(componentCls, "-item-danger"), {
    '&::after': {
      borderInlineEndColor: themeColorDangerTextSelect
    }
  })), _defineProperty(_$concat8, "".concat(componentCls, "-selected, ").concat(componentCls, "-item-selected"), {
    '&::after': {
      transform: 'scaleY(1)',
      opacity: 1,
      transition: ["transform ".concat(motionDurationFast, " ").concat(motionEaseInOut), "opacity ".concat(motionDurationFast, " ").concat(motionEaseInOut)].join(',')
    }
  }), _$concat8)), _$concat$concat3));
};

export default getThemeStyle;