import _extends from "@babel/runtime/helpers/esm/extends";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { genBasicInputStyle, genInputSmallStyle, initInputToken } from '../../input/style/css';
import { genComponentStyleHook, mergeToken } from '../../theme';
import { resetComponent } from '../../style/css';

var genPaginationDisabledStyle = function genPaginationDisabledStyle(token) {
  var _$concat2, _ref;

  var componentCls = token.componentCls;
  return _ref = {}, _defineProperty(_ref, "".concat(componentCls, "-disabled"), {
    '&, &:hover': _defineProperty({
      cursor: 'not-allowed'
    }, "".concat(componentCls, "-item-link"), {
      color: token.colorTextDisabled,
      borderColor: token.colorBorder,
      cursor: 'not-allowed'
    }),
    '&:focus-visible': _defineProperty({
      cursor: 'not-allowed'
    }, "".concat(componentCls, "-item-link"), {
      color: token.colorTextDisabled,
      borderColor: token.colorBorder,
      cursor: 'not-allowed'
    })
  }), _defineProperty(_ref, "&".concat(componentCls, "-disabled"), (_$concat2 = {
    cursor: 'not-allowed'
  }, _defineProperty(_$concat2, "".concat(componentCls, "-item"), {
    background: token.colorBgContainerDisabled,
    borderColor: token.colorBorder,
    cursor: 'not-allowed',
    a: {
      color: token.colorTextDisabled,
      background: 'transparent',
      border: 'none',
      cursor: 'not-allowed'
    },
    '&-active': {
      background: token.paginationItemDisabledBgActive,
      a: {
        color: token.paginationItemDisabledColorActive
      }
    }
  }), _defineProperty(_$concat2, "".concat(componentCls, "-item-link"), _defineProperty({
    color: token.colorTextDisabled,
    background: token.colorBgContainerDisabled,
    borderColor: token.colorBorder,
    cursor: 'not-allowed'
  }, "".concat(componentCls, "-simple&"), {
    background: 'transparent'
  })), _defineProperty(_$concat2, "".concat(componentCls, "-item-link-icon"), {
    opacity: 0
  }), _defineProperty(_$concat2, "".concat(componentCls, "-item-ellipsis"), {
    opacity: 1
  }), _defineProperty(_$concat2, "".concat(componentCls, "-simple-pager"), {
    color: token.colorTextDisabled
  }), _$concat2)), _ref;
};

var genPaginationMiniStyle = function genPaginationMiniStyle(token) {
  var _mini$concat, _ref2;

  var componentCls = token.componentCls;
  return _ref2 = {}, _defineProperty(_ref2, "&&-mini ".concat(componentCls, "-total-text, &&-mini ").concat(componentCls, "-simple-pager"), {
    height: token.paginationItemSizeSM,
    lineHeight: "".concat(token.paginationItemSizeSM, "px")
  }), _defineProperty(_ref2, "&&-mini ".concat(componentCls, "-item"), {
    minWidth: token.paginationItemSizeSM,
    height: token.paginationItemSizeSM,
    margin: 0,
    lineHeight: "".concat(token.paginationItemSizeSM - 2, "px")
  }), _defineProperty(_ref2, "&&-mini ".concat(componentCls, "-item:not(").concat(componentCls, "-item-active)"), {
    background: 'transparent',
    borderColor: 'transparent'
  }), _defineProperty(_ref2, "&&-mini ".concat(componentCls, "-prev, &&-mini ").concat(componentCls, "-next"), {
    minWidth: token.paginationItemSizeSM,
    height: token.paginationItemSizeSM,
    margin: 0,
    lineHeight: "".concat(token.paginationItemSizeSM, "px")
  }), _defineProperty(_ref2, "\n    &&-mini ".concat(componentCls, "-prev ").concat(componentCls, "-item-link,\n    &&-mini ").concat(componentCls, "-next ").concat(componentCls, "-item-link\n    "), {
    background: 'transparent',
    borderColor: 'transparent',
    '&::after': {
      height: token.paginationItemSizeSM,
      lineHeight: "".concat(token.paginationItemSizeSM, "px")
    }
  }), _defineProperty(_ref2, "&&-mini ".concat(componentCls, "-jump-prev, &&-mini ").concat(componentCls, "-jump-next"), {
    height: token.paginationItemSizeSM,
    marginInlineEnd: 0,
    lineHeight: "".concat(token.paginationItemSizeSM, "px")
  }), _defineProperty(_ref2, "&&-mini ".concat(componentCls, "-options"), (_mini$concat = {
    marginInlineStart: token.paginationMiniOptionsMarginInlineStart
  }, _defineProperty(_mini$concat, "&-size-changer", {
    top: token.paginationMiniOptionsSizeChangerTop
  }), _defineProperty(_mini$concat, "&-quick-jumper", {
    height: token.paginationItemSizeSM,
    lineHeight: "".concat(token.paginationItemSizeSM, "px"),
    input: _extends(_extends({}, genInputSmallStyle(token)), {
      width: token.paginationMiniQuickJumperInputWidth,
      height: token.controlHeightSM
    })
  }), _mini$concat)), _ref2;
};

var genPaginationSimpleStyle = function genPaginationSimpleStyle(token) {
  var _ref3;

  var componentCls = token.componentCls;
  return _ref3 = {}, _defineProperty(_ref3, "\n    &".concat(componentCls, "-simple ").concat(componentCls, "-prev,\n    &").concat(componentCls, "-simple ").concat(componentCls, "-next\n    "), _defineProperty({
    height: token.paginationItemSizeSM,
    lineHeight: "".concat(token.paginationItemSizeSM, "px"),
    verticalAlign: 'top'
  }, "".concat(componentCls, "-item-link"), {
    height: token.paginationItemSizeSM,
    backgroundColor: 'transparent',
    border: 0,
    '&::after': {
      height: token.paginationItemSizeSM,
      lineHeight: "".concat(token.paginationItemSizeSM, "px")
    }
  })), _defineProperty(_ref3, "&".concat(componentCls, "-simple ").concat(componentCls, "-simple-pager"), {
    display: 'inline-block',
    height: token.paginationItemSizeSM,
    marginInlineEnd: token.marginXS,
    input: {
      boxSizing: 'border-box',
      height: '100%',
      marginInlineEnd: token.marginXS,
      padding: "0 ".concat(token.paginationItemPaddingInline, "px"),
      textAlign: 'center',
      backgroundColor: token.paginationItemInputBg,
      border: "".concat(token.controlLineWidth, "px ").concat(token.controlLineType, " ").concat(token.colorBorder),
      borderRadius: token.radiusBase,
      outline: 'none',
      transition: "border-color ".concat(token.motionDurationSlow),
      '&:hover': {
        borderColor: token.colorPrimary
      },
      '&:focus': {
        borderColor: token.colorPrimaryHover,
        boxShadow: "".concat(token.inputOutlineOffset, " 0 ").concat(token.controlOutlineWidth, " ").concat(token.controlOutline)
      },
      '&[disabled]': {
        color: token.colorTextDisabled,
        background: token.colorBgContainerDisabled,
        borderColor: token.colorBorder,
        cursor: 'not-allowed'
      }
    }
  }), _ref3;
};

var genPaginationJumpStyle = function genPaginationJumpStyle(token) {
  var _$concat3, _hover2, _focusVisible2, _$concat$concat2, _$concat$concat3, _ref4;

  var componentCls = token.componentCls;
  return _ref4 = {}, _defineProperty(_ref4, "".concat(componentCls, "-jump-prev, ").concat(componentCls, "-jump-next"), (_$concat$concat2 = {
    outline: 0
  }, _defineProperty(_$concat$concat2, "".concat(componentCls, "-item-container"), (_$concat3 = {
    position: 'relative'
  }, _defineProperty(_$concat3, "".concat(componentCls, "-item-link-icon"), {
    color: token.colorPrimary,
    fontSize: token.fontSizeSM,
    opacity: 0,
    transition: "all ".concat(token.motionDurationMid),
    '&-svg': {
      top: 0,
      insetInlineEnd: 0,
      bottom: 0,
      insetInlineStart: 0,
      margin: 'auto'
    }
  }), _defineProperty(_$concat3, "".concat(componentCls, "-item-ellipsis"), {
    position: 'absolute',
    top: 0,
    insetInlineEnd: 0,
    bottom: 0,
    insetInlineStart: 0,
    display: 'block',
    margin: 'auto',
    color: token.colorTextDisabled,
    fontFamily: 'Arial, Helvetica, sans-serif',
    letterSpacing: token.paginationEllipsisLetterSpacing,
    textAlign: 'center',
    textIndent: token.paginationEllipsisTextIndent,
    opacity: 1,
    transition: "all ".concat(token.motionDurationMid)
  }), _$concat3)), _defineProperty(_$concat$concat2, '&:hover', (_hover2 = {}, _defineProperty(_hover2, "".concat(componentCls, "-item-link-icon"), {
    opacity: 1
  }), _defineProperty(_hover2, "".concat(componentCls, "-item-ellipsis"), {
    opacity: 0
  }), _hover2)), _defineProperty(_$concat$concat2, '&:focus-visible', (_focusVisible2 = {}, _defineProperty(_focusVisible2, "".concat(componentCls, "-item-link-icon"), {
    opacity: 1
  }), _defineProperty(_focusVisible2, "".concat(componentCls, "-item-ellipsis"), {
    opacity: 0
  }), _focusVisible2)), _$concat$concat2)), _defineProperty(_ref4, "\n    ".concat(componentCls, "-prev,\n    ").concat(componentCls, "-jump-prev,\n    ").concat(componentCls, "-jump-next\n    "), {
    marginInlineEnd: token.marginXS
  }), _defineProperty(_ref4, "\n    ".concat(componentCls, "-prev,\n    ").concat(componentCls, "-next,\n    ").concat(componentCls, "-jump-prev,\n    ").concat(componentCls, "-jump-next\n    "), {
    display: 'inline-block',
    minWidth: token.paginationItemSize,
    height: token.paginationItemSize,
    color: token.colorText,
    fontFamily: token.paginationFontFamily,
    lineHeight: "".concat(token.paginationItemSize, "px"),
    textAlign: 'center',
    verticalAlign: 'middle',
    listStyle: 'none',
    borderRadius: token.radiusBase,
    cursor: 'pointer',
    transition: "all ".concat(token.motionDurationSlow)
  }), _defineProperty(_ref4, "".concat(componentCls, "-prev, ").concat(componentCls, "-next"), (_$concat$concat3 = {
    fontFamily: 'Arial, Helvetica, sans-serif',
    outline: 0,
    button: {
      color: token.colorText,
      cursor: 'pointer',
      userSelect: 'none'
    },
    '&:hover button': {
      borderColor: token.colorPrimaryHover
    }
  }, _defineProperty(_$concat$concat3, "".concat(componentCls, "-item-link"), {
    display: 'block',
    width: '100%',
    height: '100%',
    padding: 0,
    fontSize: token.fontSizeSM,
    textAlign: 'center',
    backgroundColor: token.paginationItemLinkBg,
    border: "".concat(token.controlLineWidth, "px ").concat(token.controlLineType, " ").concat(token.colorBorder),
    borderRadius: token.radiusBase,
    outline: 'none',
    transition: "all ".concat(token.motionDurationSlow)
  }), _defineProperty(_$concat$concat3, "&:focus-visible ".concat(componentCls, "-item-link"), {
    color: token.colorPrimary,
    borderColor: token.colorPrimary
  }), _defineProperty(_$concat$concat3, "&:hover ".concat(componentCls, "-item-link"), {
    color: token.colorPrimary,
    borderColor: token.colorPrimary
  }), _$concat$concat3)), _defineProperty(_ref4, "".concat(componentCls, "-slash"), {
    marginInlineEnd: token.paginationSlashMarginInlineEnd,
    marginInlineStart: token.paginationSlashMarginInlineStart
  }), _defineProperty(_ref4, "".concat(componentCls, "-options"), {
    display: 'inline-block',
    marginInlineStart: token.margin,
    verticalAlign: 'middle',
    '&-size-changer.-select': {
      display: 'inline-block',
      width: 'auto'
    },
    '&-quick-jumper': {
      display: 'inline-block',
      height: token.controlHeight,
      marginInlineStart: token.marginXS,
      lineHeight: "".concat(token.controlHeight, "px"),
      verticalAlign: 'top',
      input: _extends(_extends({}, genBasicInputStyle(token)), {
        width: token.controlHeightLG * 1.25,
        height: token.controlHeight,
        margin: 0,
        marginInlineStart: token.marginXS,
        marginInlineEnd: token.marginXS
      })
    }
  }), _ref4;
};

var genPaginationItemStyle = function genPaginationItemStyle(token) {
  var componentCls = token.componentCls;
  return _defineProperty({}, "".concat(componentCls, "-item"), {
    display: 'inline-block',
    minWidth: token.paginationItemSize,
    height: token.paginationItemSize,
    marginInlineEnd: token.marginXS,
    fontFamily: token.paginationFontFamily,
    lineHeight: "".concat(token.paginationItemSize - 2, "px"),
    textAlign: 'center',
    verticalAlign: 'middle',
    listStyle: 'none',
    backgroundColor: token.paginationItemBg,
    border: "".concat(token.controlLineWidth, "px ").concat(token.controlLineType, " ").concat(token.colorBorder),
    borderRadius: token.radiusBase,
    outline: 0,
    cursor: 'pointer',
    userSelect: 'none',
    a: {
      display: 'block',
      padding: "0 ".concat(token.paginationItemPaddingInline, "px"),
      color: token.colorText,
      transition: 'none',
      '&:hover': {
        textDecoration: 'none'
      }
    },
    '&:hover': {
      borderColor: token.colorPrimary,
      transition: "all ".concat(token.motionDurationSlow),
      a: {
        color: token.colorPrimary
      }
    },
    // cannot merge with `&:hover`
    // see https://github.com/ant-design/ant-design/pull/34002
    '&:focus-visible': {
      borderColor: token.colorPrimary,
      transition: "all ".concat(token.motionDurationSlow),
      a: {
        color: token.colorPrimary
      }
    },
    '&-active': {
      fontWeight: token.paginationFontWeightActive,
      background: token.paginationItemBgActive,
      borderColor: token.colorPrimary,
      a: {
        color: token.colorPrimary
      },
      '&:hover': {
        borderColor: token.colorPrimaryHover
      },
      '&:focus-visible': {
        borderColor: token.colorPrimaryHover
      },
      '&:hover a': {
        color: token.colorPrimaryHover
      },
      '&:focus-visible a': {
        color: token.colorPrimaryHover
      }
    }
  });
};

var genPaginationStyle = function genPaginationStyle(token) {
  var _extends3, _ref6;

  var componentCls = token.componentCls;
  return _ref6 = {}, _defineProperty(_ref6, componentCls, _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, resetComponent(token)), _defineProperty({
    'ul, ol': {
      margin: 0,
      padding: 0,
      listStyle: 'none'
    },
    '&::after': {
      display: 'block',
      clear: 'both',
      height: 0,
      overflow: 'hidden',
      visibility: 'hidden',
      content: '""'
    }
  }, "".concat(componentCls, "-total-text"), {
    display: 'inline-block',
    height: token.paginationItemSize,
    marginInlineEnd: token.marginXS,
    lineHeight: "".concat(token.paginationItemSize - 2, "px"),
    verticalAlign: 'middle'
  })), genPaginationItemStyle(token)), genPaginationJumpStyle(token)), genPaginationSimpleStyle(token)), genPaginationMiniStyle(token)), genPaginationDisabledStyle(token)), (_extends3 = {}, _defineProperty(_extends3, "@media only screen and (max-width: ".concat(token.screenLG, "px)"), _defineProperty({}, "".concat(componentCls, "-item"), {
    '&-after-jump-prev, &-before-jump-next': {
      display: 'none'
    }
  })), _defineProperty(_extends3, "@media only screen and (max-width: ".concat(token.screenSM, "px)"), _defineProperty({}, "".concat(componentCls, "-options"), {
    display: 'none'
  })), _extends3))), _defineProperty(_ref6, "&".concat(token.componentCls, "-rtl"), {
    direction: 'rtl'
  }), _ref6;
}; // ============================== Export ==============================


export default genComponentStyleHook('Pagination', function (token) {
  var paginationToken = mergeToken(token, {
    paginationItemSize: token.controlHeight,
    paginationFontFamily: token.fontFamily,
    paginationItemBg: token.colorBgContainer,
    paginationItemBgActive: token.colorBgContainer,
    paginationFontWeightActive: token.fontWeightStrong,
    paginationItemSizeSM: token.controlHeightSM,
    paginationItemInputBg: token.colorBgContainer,
    paginationMiniOptionsSizeChangerTop: 0,
    paginationItemDisabledBgActive: token.controlItemBgActiveDisabled,
    paginationItemDisabledColorActive: token.colorTextDisabled,
    paginationItemLinkBg: token.colorBgContainer,
    inputOutlineOffset: '0 0',
    paginationMiniOptionsMarginInlineStart: token.marginXXS / 2,
    paginationMiniQuickJumperInputWidth: token.controlHeightLG * 1.1,
    paginationItemPaddingInline: token.marginXXS * 1.5,
    paginationEllipsisLetterSpacing: token.marginXXS / 2,
    paginationSlashMarginInlineStart: token.marginXXS,
    paginationSlashMarginInlineEnd: token.marginSM,
    paginationEllipsisTextIndent: '0.13em' // magic for ui experience

  }, initInputToken(token));
  return [genPaginationStyle(paginationToken)];
});