function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_with_holes(arr) {
    if (Array.isArray(arr)) return arr;
}
function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _iterable_to_array_limit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _s, _e;
    try {
        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
            _arr.push(_s.value);
            if (i && _arr.length === i) break;
        }
    } catch (err) {
        _d = true;
        _e = err;
    } finally{
        try {
            if (!_n && _i["return"] != null) _i["return"]();
        } finally{
            if (_d) throw _e;
        }
    }
    return _arr;
}
function _non_iterable_rest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
function _sliced_to_array(arr, i) {
    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
import { genStyleHooks } from "../../../Hooks/useStyle";
import { sharedButtonVariants } from "../sharedStyle";
var ICON_SIZE = 16;
var ICON_SIZE_SM = 14;
var ICON_SIZE_XS = 14;
var genStyle = function genStyle(token) {
    var antCls = token.antCls;
    var btn = "".concat(antCls, "-btn");
    var btnIcon = "".concat(antCls, "-btn-icon");
    var btnIconOnly = "".concat(antCls, "-btn-icon-only");
    var btnVariantOutlined = "".concat(antCls, "-btn-variant-outlined");
    var btnDisabled = "".concat(antCls, "-btn-disabled");
    var _obj;
    return _define_property({}, token.componentCls, _object_spread_props(_object_spread((_obj = {
        // 基础按钮样式
        display: 'inline-flex',
        height: 'var(--height-control-base)',
        alignItems: 'center',
        justifyContent: 'center',
        gap: 8,
        border: 'none',
        borderRadius: 'var(--radius-control-base, 6px)',
        cursor: 'pointer',
        fontFamily: 'var(--font-family-base, var(--font-family-text, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif))',
        fontSize: 'var(--font-size-base, 14px)',
        fontWeight: 'var(--font-weight-medium, 500)',
        lineHeight: 'var(--line-height-base, 1.5)',
        textAlign: 'center',
        textDecoration: 'none',
        transition: 'all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)',
        userSelect: 'none',
        outline: 'none',
        position: 'relative',
        overflow: 'hidden'
    }, // 统一 icon 尺寸（适配 antd Button 图标容器）- base
    _define_property(_obj, "&-button ".concat(btnIcon), {
        fontSize: ICON_SIZE,
        lineHeight: 1
    }), _define_property(_obj, "&-button ".concat(btnIcon, " > *"), {
        width: ICON_SIZE,
        height: ICON_SIZE
    }), // 尺寸变体
    _define_property(_obj, '&-button-sm', {
        width: 'var(--height-control-sm)',
        height: 'var(--height-control-sm)',
        lineHeight: 'var(--height-control-sm)',
        borderRadius: 'var(--radius-control-sm)'
    }), _define_property(_obj, "&-button-sm ".concat(btnIcon), {
        fontSize: ICON_SIZE_SM
    }), _define_property(_obj, "&-button-sm ".concat(btnIcon, " > *"), {
        width: ICON_SIZE_SM,
        height: ICON_SIZE_SM
    }), // 提升优先级以覆盖 antd 的 icon-only 尺寸（包括 outlined 变体）
    _define_property(_obj, "&-button&-button-sm".concat(btn).concat(btnIconOnly), {
        width: 'var(--height-control-sm)',
        height: 'var(--height-control-sm)',
        lineHeight: 'var(--height-control-sm)',
        borderRadius: 'var(--radius-control-sm)'
    }), _define_property(_obj, "&-button&-button-sm".concat(btn).concat(btnVariantOutlined).concat(btnIconOnly), {
        width: 'var(--height-control-sm)',
        height: 'var(--height-control-sm)',
        lineHeight: 'var(--height-control-sm)',
        borderRadius: 'var(--radius-control-sm)'
    }), _define_property(_obj, "&-button&-button-sm".concat(btn).concat(btnIconOnly, " ").concat(btnIcon), {
        fontSize: ICON_SIZE_SM
    }), _define_property(_obj, "&-button&-button-sm".concat(btn).concat(btnIconOnly, " ").concat(btnIcon, " > *"), {
        width: ICON_SIZE_SM,
        height: ICON_SIZE_SM
    }), _define_property(_obj, '&-button-xs', {
        width: 'var(--height-control-xs)',
        height: 'var(--height-control-xs)',
        lineHeight: 'var(--height-control-xs)',
        borderRadius: 'var(--radius-control-xs)'
    }), _define_property(_obj, "&-button-xs ".concat(btnIcon), {
        fontSize: ICON_SIZE_XS
    }), _define_property(_obj, "&-button-xs ".concat(btnIcon, " > *"), {
        width: ICON_SIZE_XS,
        height: ICON_SIZE_XS
    }), _define_property(_obj, "&-button&-button-xs".concat(btn).concat(btnIconOnly), {
        width: 'var(--height-control-xs)',
        height: 'var(--height-control-xs)',
        lineHeight: 'var(--height-control-xs)',
        borderRadius: 'var(--radius-control-xs)'
    }), _define_property(_obj, "&-button&-button-xs".concat(btn).concat(btnVariantOutlined).concat(btnIconOnly), {
        width: 'var(--height-control-xs)',
        height: 'var(--height-control-xs)',
        lineHeight: 'var(--height-control-xs)',
        borderRadius: 'var(--radius-control-xs)'
    }), _define_property(_obj, "&-button&-button-xs".concat(btn).concat(btnIconOnly, " ").concat(btnIcon), {
        fontSize: ICON_SIZE_XS
    }), _define_property(_obj, "&-button&-button-xs".concat(btn).concat(btnIconOnly, " ").concat(btnIcon, " > *"), {
        width: ICON_SIZE_XS,
        height: ICON_SIZE_XS
    }), // Elevated 悬浮版本 - 默认/hover/active
    _define_property(_obj, '&-button-elevated', {
        borderRadius: 'var(--radius-control-base)',
        background: 'var(--color-gray-bg-card-white)',
        boxShadow: 'var(--shadow-border-base)',
        color: 'var(--color-gray-text-secondary)',
        '&:hover:not(&-button-disabled):not(&-button-loading):not([disabled])': {
            background: 'var(--color-gray-bg-card-white)',
            boxShadow: 'var(--shadow-control-lg)'
        },
        '&:active:not(&-button-disabled):not(&-button-loading):not([disabled])': {
            background: 'var(--color-primary-control-fill-secondary)',
            boxShadow: 'var(--shadow-border-base)',
            color: 'var(--color-gray-text-secondary)'
        }
    }), // 提升 hover/active 选择器优先级以覆盖 antd 的 icon-only 悬浮样式
    _define_property(_obj, "&-button&-button-elevated".concat(btn).concat(btnIconOnly, ":not(").concat(btnDisabled, "):not([disabled]):hover"), {
        background: 'var(--color-gray-bg-card-white)',
        boxShadow: 'var(--shadow-control-lg)'
    }), _define_property(_obj, "&-button&-button-elevated".concat(btn).concat(btnIconOnly, ":not(").concat(btnDisabled, "):not([disabled]):active"), {
        background: 'var(--color-primary-control-fill-secondary)',
        boxShadow: 'var(--shadow-border-base)',
        color: 'var(--color-gray-text-secondary)'
    }), // Elevated 悬浮版本 - disabled
    _define_property(_obj, '&-button-elevated&-button-disabled, &-button-elevated[disabled]', {
        background: 'var(--color-gray-bg-card-white)',
        boxShadow: 'var(--shadow-control-base)',
        color: 'var(--color-gray-text-disabled)'
    }), // Elevated 悬浮版本 - loading
    _define_property(_obj, '&-button-elevated&-button-loading', {
        background: 'var(--color-gray-bg-card-white)',
        boxShadow: 'var(--shadow-control-base)',
        color: 'var(--color-gray-text-disabled)'
    }), _obj), sharedButtonVariants), {
        // 加载状态
        '&-loading': {
            cursor: 'not-allowed',
            pointerEvents: 'none',
            '&:hover': {
                transform: 'none !important'
            },
            '&:active': {
                transform: 'none !important'
            }
        },
        // 图标样式
        '&-icon': {
            display: 'inline-flex',
            alignItems: 'center',
            justifyContent: 'center',
            fontSize: 'inherit',
            lineHeight: 1
        },
        // 文字样式
        '&-text': {
            display: 'inline-block',
            whiteSpace: 'nowrap',
            overflow: 'hidden',
            textOverflow: 'ellipsis'
        }
    }));
};
var useGenStyle = genStyleHooks('IconButton', genStyle);
export function useStyle(prefixCls) {
    var _useGenStyle = _sliced_to_array(useGenStyle(prefixCls !== null && prefixCls !== void 0 ? prefixCls : 'icon-button'), 2), wrapSSR = _useGenStyle[0], hashId = _useGenStyle[1];
    return {
        wrapSSR: wrapSSR,
        hashId: hashId
    };
}
