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

var genBorderedStyle = function genBorderedStyle(token) {
  var _table, _$concat2, _extends2, _$concat4, _$concat5;

  var componentCls = token.componentCls;
  var tableBorder = "".concat(token.controlLineWidth, "px ").concat(token.controlLineType, " ").concat(token.tableBorderColor);

  var getSizeBorderStyle = function getSizeBorderStyle(size, paddingVertical, paddingHorizontal) {
    return _defineProperty({}, "&".concat(componentCls, "-").concat(size), _defineProperty({}, "> ".concat(componentCls, "-container"), _defineProperty({}, "> ".concat(componentCls, "-content, > ").concat(componentCls, "-body"), {
      '> table > tbody > tr > td': _defineProperty({}, "> ".concat(componentCls, "-expanded-row-fixed"), {
        margin: "-".concat(paddingVertical, "px -").concat(paddingHorizontal + token.controlLineWidth, "px")
      })
    })));
  };

  return _defineProperty({}, "".concat(componentCls, "-wrapper"), (_$concat5 = {}, _defineProperty(_$concat5, "".concat(componentCls).concat(componentCls, "-bordered"), _extends(_extends(_extends((_extends2 = {}, _defineProperty(_extends2, "> ".concat(componentCls, "-title"), {
    border: tableBorder,
    borderBottom: 0
  }), _defineProperty(_extends2, "> ".concat(componentCls, "-container"), (_$concat2 = {
    borderInlineStart: tableBorder
  }, _defineProperty(_$concat2, "\n            > ".concat(componentCls, "-content,\n            > ").concat(componentCls, "-header,\n            > ").concat(componentCls, "-body,\n            > ").concat(componentCls, "-summary\n          "), {
    '> table': (_table = {}, _defineProperty(_table, "\n                > thead > tr > th,\n                > tbody > tr > td,\n                > tfoot > tr > th,\n                > tfoot > tr > td\n              ", {
      borderInlineEnd: tableBorder
    }), _defineProperty(_table, '> thead', {
      '> tr:not(:last-child) > th': {
        borderBottom: tableBorder
      },
      '> tr > th::before': {
        backgroundColor: 'transparent !important'
      }
    }), _defineProperty(_table, "\n                > thead > tr,\n                > tbody > tr,\n                > tfoot > tr\n              ", _defineProperty({}, "> ".concat(componentCls, "-cell-fix-right-first::after"), {
      borderInlineEnd: tableBorder
    })), _defineProperty(_table, '> table > tbody > tr > td', _defineProperty({}, "> ".concat(componentCls, "-expanded-row-fixed"), {
      margin: "-".concat(token.tablePaddingVertical, "px -").concat(token.tablePaddingHorizontal + token.controlLineWidth, "px"),
      '&::after': {
        position: 'absolute',
        top: 0,
        insetInlineEnd: token.controlLineWidth,
        bottom: 0,
        borderInlineEnd: tableBorder,
        content: '""'
      }
    })), _table)
  }), _defineProperty(_$concat2, "\n            > ".concat(componentCls, "-content,\n            > ").concat(componentCls, "-header\n          "), {
    '> table': {
      borderTop: tableBorder
    }
  }), _$concat2)), _defineProperty(_extends2, "&".concat(componentCls, "-scroll-horizontal"), _defineProperty({}, "> ".concat(componentCls, "-container > ").concat(componentCls, "-body"), {
    '> table > tbody': _defineProperty({}, "\n                > tr".concat(componentCls, "-expanded-row,\n                > tr").concat(componentCls, "-placeholder\n              "), {
      '> td': {
        borderInlineEnd: 0
      }
    })
  })), _extends2), getSizeBorderStyle('middle', token.tablePaddingVerticalMiddle, token.tablePaddingHorizontalMiddle)), getSizeBorderStyle('small', token.tablePaddingVerticalSmall, token.tablePaddingHorizontalSmall)), _defineProperty({}, "> ".concat(componentCls, "-footer"), {
    border: tableBorder,
    borderTop: 0
  }))), _defineProperty(_$concat5, "".concat(componentCls, "-cell"), (_$concat4 = {}, _defineProperty(_$concat4, "".concat(componentCls, "-container:first-child"), {
    // :first-child to avoid the case when bordered and title is set
    borderTop: 0
  }), _defineProperty(_$concat4, '&-scrollbar:not([rowspan])', {
    boxShadow: "0 ".concat(token.controlLineWidth, "px 0 ").concat(token.controlLineWidth, "px ").concat(token.tableHeaderBg)
  }), _$concat4)), _$concat5));
};

export default genBorderedStyle;