const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
require("./index.less");
//#region src/components/productCard/cartSkuCard/components/resources/index.tsx
const colors = [
	"magenta",
	"volcano",
	"orange",
	"gold",
	"green",
	"cyan",
	"blue",
	"geekblue",
	"purple"
];
function getColor(n) {
	return colors[n * 31 % colors.length];
}
const Resources = (props) => {
	const { dataSource = {} } = props;
	const { multiResources, isMultipleResource } = dataSource;
	const renderResourceItem = (item, index) => {
		const { id: ids, lists, _id } = item;
		return Array.isArray(ids) ? ids.map((id) => {
			const targetRes = lists.find((l) => l.id === id);
			if (targetRes === null || targetRes === void 0 ? void 0 : targetRes.label) return /* @__PURE__ */ react.default.createElement(antd.Tag, {
				color: getColor(_id),
				className: "resource-tag"
			}, targetRes.label);
			return null;
		}) : null;
	};
	if (isMultipleResource && (multiResources === null || multiResources === void 0 ? void 0 : multiResources.length) > 0) return /* @__PURE__ */ react.default.createElement("div", { className: `${require_index.PREFIX}__resources` }, multiResources.map(renderResourceItem));
	return null;
};
//#endregion
exports.default = Resources;
