const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../../iconfont/index.js");
const require_index$1 = require("../../index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
require("./index.less");
//#region src/components/productCard/cartSkuCard/components/holders/index.tsx
const holderIconMap = {
	"form": "pisell2-file-05",
	"minors": "pisell2-user-check-01",
	"waiver": "pisell2-file-lock-03"
};
const Holders = (props) => {
	const { dataSource = {} } = props;
	const { holders, holder_id } = dataSource;
	if (!holder_id || (holder_id === null || holder_id === void 0 ? void 0 : holder_id.length) === 0) {
		if (dataSource.isFormSubject) return /* @__PURE__ */ react.default.createElement("div", { className: "holder-item unassigned" }, dataSource.holderMaxCount > 1 ? /* @__PURE__ */ react.default.createElement("span", null, dataSource.holderMaxCount, "/", dataSource.holderMaxCount, " ") : null, /* @__PURE__ */ react.default.createElement("span", { className: "holder-label" }, _pisell_utils.locales.getText("pisell2.cart.sku-card.unassigned")));
		return null;
	}
	const renderHolder = (id) => {
		if (!id) return null;
		const holder = holders.find((item) => item.id === id);
		return /* @__PURE__ */ react.default.createElement("div", {
			className: "holder-item",
			key: id
		}, /* @__PURE__ */ react.default.createElement(require_index.default, {
			className: "holder-icon",
			type: holderIconMap[(dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderType) || "minors"]
		}), /* @__PURE__ */ react.default.createElement("span", { className: "holder-label" }, (holder === null || holder === void 0 ? void 0 : holder.label) || id));
	};
	return /* @__PURE__ */ react.default.createElement("div", { className: `${require_index$1.PREFIX}__holders` }, Array.isArray(holder_id) ? holder_id === null || holder_id === void 0 ? void 0 : holder_id.map((id) => {
		return renderHolder(id);
	}) : renderHolder(holder_id));
};
//#endregion
exports.default = Holders;
