const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_BadgeWrapper = require("../TextCard/components/BadgeWrapper.js");
const require_GraphicArea = require("./components/GraphicArea.js");
const require_TextContent = require("./components/TextContent.js");
const require_useGraphicTextCardStyle = require("./hooks/useGraphicTextCardStyle.js");
const require_useGraphicTextCardClick = require("./hooks/useGraphicTextCardClick.js");
const require_index = require("./utils/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
require("./GraphicTextCard.less");
//#region src/components/PisellCards/components/GraphicTextCard/GraphicTextCard.tsx
const _excluded = [
	"text",
	"variant",
	"size",
	"image",
	"icon",
	"graphicConfig",
	"graphicSlot",
	"badge",
	"prefixSlot",
	"suffixSlot",
	"textConfig",
	"active",
	"disabled",
	"loading",
	"children",
	"render",
	"dataSource"
];
/**
* GraphicTextCard 图文卡片组件
* 结合图标/图片、文本和状态标识，专为标签页、分类导航等场景设计
*
* @component
* @example
* ```tsx
* // 基础用法（样式一：垂直布局-图片）
* <GraphicTextCard
*   text="Tab title"
*   image="https://example.com/image.png"
*   variant="vertical-image"
* />
*
* // 使用图标（样式二：垂直布局-图标）
* <GraphicTextCard
*   text="Tabs"
*   icon={<SmileIcon />}
*   variant="vertical-icon"
* />
*
* // 横向布局（样式三）
* <GraphicTextCard
*   text="Tab title"
*   image="https://example.com/image.png"
*   variant="horizontal"
* />
*
* // 卡片式（样式四）
* <GraphicTextCard
*   text="Tab title"
*   image="https://example.com/image.png"
*   variant="card"
*   active={{ value: true }}
* />
*
* // 带角标
* <GraphicTextCard
*   text="Tab title"
*   icon={<SmileIcon />}
*   badge={{ type: 'number', content: 99 }}
* />
* ```
*/
const GraphicTextCard = (props) => {
	const { text, variant = "vertical-image", size = "default", image, icon, graphicConfig = {}, graphicSlot, badge, prefixSlot, suffixSlot, textConfig, active, disabled, loading, children, render, dataSource } = props, restProps = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const { mergedStyle, mergedClassName } = require_useGraphicTextCardStyle.useGraphicTextCardStyle(props);
	const handleClick = require_useGraphicTextCardClick.useGraphicTextCardClick(props);
	(0, react.useEffect)(() => {
		document.body.id = "body";
	}, []);
	/**
	* 计算图形区域尺寸
	* 优先使用 graphicConfig 中的配置，否则使用默认值
	*/
	const graphicSize = (0, react.useMemo)(() => {
		var _graphicConfig$width, _graphicConfig$height;
		const defaultSize = require_index.getDefaultGraphicSize(variant, size);
		return {
			width: (_graphicConfig$width = graphicConfig.width) !== null && _graphicConfig$width !== void 0 ? _graphicConfig$width : defaultSize.width,
			height: (_graphicConfig$height = graphicConfig.height) !== null && _graphicConfig$height !== void 0 ? _graphicConfig$height : defaultSize.height
		};
	}, [
		variant,
		size,
		graphicConfig.width,
		graphicConfig.height
	]);
	/**
	* 渲染状态的 extra 内容
	* 优先级：loading > disabled > active
	*/
	const renderExtra = (0, react.useCallback)(() => {
		if ((loading === null || loading === void 0 ? void 0 : loading.value) && (loading === null || loading === void 0 ? void 0 : loading.extra)) return /* @__PURE__ */ react.default.createElement("div", { className: "graphic-text-card__extra" }, loading.extra);
		if ((disabled === null || disabled === void 0 ? void 0 : disabled.value) && (disabled === null || disabled === void 0 ? void 0 : disabled.extra)) return /* @__PURE__ */ react.default.createElement("div", { className: "graphic-text-card__extra" }, disabled.extra);
		if ((active === null || active === void 0 ? void 0 : active.value) && (active === null || active === void 0 ? void 0 : active.extra)) return /* @__PURE__ */ react.default.createElement("div", { className: "graphic-text-card__extra" }, active.extra);
		return null;
	}, [
		active,
		disabled,
		loading
	]);
	/**
	* 渲染主内容
	*/
	const renderContent = (0, react.useCallback)(() => {
		if (render) return render(props);
		console.log("graphicSize.width", graphicSize.width);
		return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, prefixSlot, graphicSlot || /* @__PURE__ */ react.default.createElement(require_GraphicArea.default, {
			image,
			icon,
			config: require_objectSpread2._objectSpread2({
				width: graphicSize.width,
				height: graphicSize.height
			}, graphicConfig)
		}), /* @__PURE__ */ react.default.createElement(require_TextContent.default, {
			text,
			textConfig,
			active
		}), suffixSlot);
	}, [
		render,
		props,
		prefixSlot,
		graphicSlot,
		image,
		icon,
		graphicConfig,
		graphicSize,
		text,
		textConfig,
		suffixSlot,
		active
	]);
	return /* @__PURE__ */ react.default.createElement(require_BadgeWrapper.default, { badge }, /* @__PURE__ */ react.default.createElement("div", require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
		onClick: handleClick,
		"data-active": active === null || active === void 0 ? void 0 : active.value,
		"data-disabled": disabled === null || disabled === void 0 ? void 0 : disabled.value,
		"data-loading": loading === null || loading === void 0 ? void 0 : loading.value,
		role: "button",
		"aria-disabled": disabled === null || disabled === void 0 ? void 0 : disabled.value,
		tabIndex: (disabled === null || disabled === void 0 ? void 0 : disabled.value) ? -1 : 0
	}, restProps), {}, {
		className: mergedClassName,
		style: mergedStyle
	}), renderContent(), renderExtra(), children));
};
/**
* Provider 包装器
* 兼容 PisellCards 系统的 props 传递方式
*/
const Provider = (props) => /* @__PURE__ */ react.default.createElement(GraphicTextCard, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props === null || props === void 0 ? void 0 : props.props), props));
//#endregion
exports.default = Provider;
