const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
//#region src/components/PisellCards/components/GraphicTextCard/components/TextContent.tsx
/**
* TextContent 文本内容组件
* 负责渲染主文本内容，支持省略和多行显示
*
* @component
* @example
* ```tsx
* // 单行文本
* <TextContent text="Tab title" />
*
* // 自定义样式
* <TextContent
*   text="Tab title"
*   textConfig={{
*     fontSize: 16,
*     fontWeight: 600,
*     color: '#101828',
*     maxLines: 2,
*     textAlign: 'center'
*   }}
* />
* ```
*/
const TextContent = (props) => {
	var _active$style5;
	const { text, textConfig = {}, className, active } = props;
	const { maxLines = 1, ellipsis = true, fontSize, fontWeight, color, textAlign = "left" } = textConfig;
	/**
	* 计算文本样式
	* 处理单行省略和多行省略的样式差异
	*/
	const textStyle = (0, react.useMemo)(() => {
		var _active$style, _active$style3;
		let baseStyle = {
			fontSize,
			fontWeight,
			color,
			textAlign
		};
		if ((active === null || active === void 0 ? void 0 : active.value) && (active === null || active === void 0 || (_active$style = active.style) === null || _active$style === void 0 ? void 0 : _active$style.color)) {
			var _active$style2;
			baseStyle.color = active === null || active === void 0 || (_active$style2 = active.style) === null || _active$style2 === void 0 ? void 0 : _active$style2.color;
		}
		if ((active === null || active === void 0 ? void 0 : active.value) && (active === null || active === void 0 || (_active$style3 = active.style) === null || _active$style3 === void 0 ? void 0 : _active$style3.fontWeight)) {
			var _active$style4;
			style.fontWeight = active === null || active === void 0 || (_active$style4 = active.style) === null || _active$style4 === void 0 ? void 0 : _active$style4.fontWeight;
		}
		if (ellipsis && maxLines === 1) return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, baseStyle), {}, {
			overflow: "hidden",
			textOverflow: "ellipsis",
			whiteSpace: "nowrap"
		});
		if (ellipsis && maxLines > 1) return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, baseStyle), {}, {
			display: "-webkit-box",
			WebkitLineClamp: maxLines,
			WebkitBoxOrient: "vertical",
			overflow: "hidden",
			wordBreak: "break-word",
			whiteSpace: "normal"
		});
		return baseStyle;
	}, [
		fontSize,
		fontWeight,
		color,
		textAlign,
		ellipsis,
		maxLines,
		active === null || active === void 0 || (_active$style5 = active.style) === null || _active$style5 === void 0 ? void 0 : _active$style5.color,
		active === null || active === void 0 ? void 0 : active.value
	]);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)("graphic-text-card__text", className),
		style: textStyle
	}, text);
};
//#endregion
exports.default = TextContent;
