function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { useMemo } from 'react';
import classNames from 'classnames';
/**
 * useGraphicTextCardStyle Hook
 * 处理组件样式和类名的合并逻辑
 * 
 * @param props - GraphicTextCard 组件的 Props
 * @returns 合并后的样式和类名
 * 
 * @example
 * ```tsx
 * const { mergedStyle, mergedClassName } = useGraphicTextCardStyle(props);
 * ```
 */
export var useGraphicTextCardStyle = function useGraphicTextCardStyle(props) {
  var _props$variant = props.variant,
    variant = _props$variant === void 0 ? 'vertical-image' : _props$variant,
    _props$size = props.size,
    size = _props$size === void 0 ? 'default' : _props$size,
    active = props.active,
    disabled = props.disabled,
    loading = props.loading,
    className = props.className,
    style = props.style,
    _props$widthMode = props.widthMode,
    widthMode = _props$widthMode === void 0 ? 'auto' : _props$widthMode,
    width = props.width,
    _props$maxWidth = props.maxWidth,
    maxWidth = _props$maxWidth === void 0 ? 400 : _props$maxWidth,
    _props$clickable = props.clickable,
    clickable = _props$clickable === void 0 ? true : _props$clickable;
  /**
   * 合并样式
   * 处理宽度模式和状态样式
   * 优先级：loading > disabled > active
   */
  var mergedStyle = useMemo(function () {
    var finalStyle = _objectSpread({
      height: '100%'
    }, style);

    // 宽度处理
    if (widthMode === 'auto') {
      finalStyle.width = 'auto';
      finalStyle.maxWidth = maxWidth;
    } else if (widthMode === 'fixed' && width) {
      finalStyle.width = width;
    } else if (widthMode === 'full') {
      finalStyle.width = '100%';
    }

    // 状态样式合并（优先级：loading > disabled > active）
    if (loading !== null && loading !== void 0 && loading.value && loading !== null && loading !== void 0 && loading.style) {
      finalStyle = _objectSpread(_objectSpread({}, finalStyle), loading.style);
    } else if (disabled !== null && disabled !== void 0 && disabled.value && disabled !== null && disabled !== void 0 && disabled.style) {
      finalStyle = _objectSpread(_objectSpread({}, finalStyle), disabled.style);
    } else if (active !== null && active !== void 0 && active.value && active !== null && active !== void 0 && active.style) {
      finalStyle = _objectSpread(_objectSpread({}, finalStyle), active.style);
    }
    return finalStyle;
  }, [style, active, disabled, loading, widthMode, width, maxWidth]);

  /**
   * 合并类名
   * 包含基础类名、变体类名、尺寸类名、状态类名
   */
  var mergedClassName = useMemo(function () {
    return classNames('graphic-text-card', "graphic-text-card--".concat(variant), "graphic-text-card--".concat(size), className, {
      'graphic-text-card--active': active === null || active === void 0 ? void 0 : active.value,
      'graphic-text-card--disabled': disabled === null || disabled === void 0 ? void 0 : disabled.value,
      'graphic-text-card--loading': loading === null || loading === void 0 ? void 0 : loading.value,
      'graphic-text-card--clickable': clickable && !(disabled !== null && disabled !== void 0 && disabled.value) && !(loading !== null && loading !== void 0 && loading.value)
    }, (active === null || active === void 0 ? void 0 : active.value) && (active === null || active === void 0 ? void 0 : active.className), (disabled === null || disabled === void 0 ? void 0 : disabled.value) && (disabled === null || disabled === void 0 ? void 0 : disabled.className), (loading === null || loading === void 0 ? void 0 : loading.value) && (loading === null || loading === void 0 ? void 0 : loading.className));
  }, [className, variant, size, active, disabled, loading, clickable]);
  return {
    mergedStyle: mergedStyle,
    mergedClassName: mergedClassName
  };
};