const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../specs/index.js");
const require_index$1 = require("../holders/index.js");
const require_index$2 = require("../../index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/productCard/cartSkuCard/components/basicInfo/index.tsx
const BasicInfo = (props) => {
	const { isShowImage, dataSource = {}, style, isMainProduct, type } = props;
	const { image, bundle, options, product_option_string, name, price, symbol, total = 0, origin_total = 0, num = 1, holder_id, isFormSubject, totalDifference = 0 } = dataSource;
	const renderNumTag = () => {
		return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`num-tag`, { "is-main": isMainProduct }) }, num < 100 ? num : "99+");
	};
	const hasSpecs = (bundle === null || bundle === void 0 ? void 0 : bundle.length) || (options === null || options === void 0 ? void 0 : options.length) || product_option_string;
	const renderImage = () => {
		if (!isShowImage) return null;
		if (image) return /* @__PURE__ */ react.default.createElement("img", {
			src: _pisell_utils.image.ali(image, 64),
			className: `product-cover`
		});
		const displayText = name ? name.slice(0, 2) : "";
		return /* @__PURE__ */ react.default.createElement("div", { className: `product-cover-text` }, displayText);
	};
	if (type === "a5") return /* @__PURE__ */ react.default.createElement("div", {
		className: `${require_index$2.PREFIX}__basic-info`,
		style: style || {}
	}, renderNumTag(), renderImage(), !isShowImage || !image && !name ? /* @__PURE__ */ react.default.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ react.default.createElement("div", { className: `product-info` }, /* @__PURE__ */ react.default.createElement("div", { className: `product-name` }, name), (!holder_id || !(holder_id === null || holder_id === void 0 ? void 0 : holder_id.length)) && !isFormSubject ? /* @__PURE__ */ react.default.createElement("div", { className: `product-price` }, (0, _pisell_utils.formatAmount)(price, 2, symbol)) : /* @__PURE__ */ react.default.createElement(require_index$1.default, { dataSource })));
	return /* @__PURE__ */ react.default.createElement("div", {
		className: `${require_index$2.PREFIX}__basic-info`,
		style: style || {}
	}, renderNumTag(), renderImage(), !isShowImage || !image && !name ? /* @__PURE__ */ react.default.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ react.default.createElement("div", { className: `product-info` }, /* @__PURE__ */ react.default.createElement("div", { className: `product-name` }, name), hasSpecs ? /* @__PURE__ */ react.default.createElement(require_index.default, { dataSource }) : /* @__PURE__ */ react.default.createElement("div", { className: `product-price` }, (0, _pisell_utils.formatAmount)(price, 2, symbol))), /* @__PURE__ */ react.default.createElement("div", { className: `product-amount` }, /* @__PURE__ */ react.default.createElement("div", { className: `total-amont` }, (0, _pisell_utils.formatAmount)(total * num - (totalDifference !== null && totalDifference !== void 0 ? totalDifference : 0), 2, symbol)), origin_total && Number(total) !== Number(origin_total) ? /* @__PURE__ */ react.default.createElement("div", { className: `origin-amount` }, (0, _pisell_utils.formatAmount)(origin_total * num, 2, symbol)) : null));
};
//#endregion
exports.default = BasicInfo;
