const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_materials = require("@pisell/materials");
//#region src/plus/saasDevice/appPeripheral/components/shared/ModelPickerGrid.tsx
const ModelPickerGrid = ({ groups, classNamePrefix, separator = "__", groupTitleClassName, translation, onSelect, getFallbackGroupTitle, renderMeta, useButton = true }) => /* @__PURE__ */ react.default.createElement("div", { className: `${classNamePrefix}${separator}model-groups` }, groups.map(([typeCode, items]) => {
	var _items$;
	const type = (_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.type;
	return /* @__PURE__ */ react.default.createElement("div", {
		key: typeCode || "default",
		className: `${classNamePrefix}${separator}model-group`
	}, /* @__PURE__ */ react.default.createElement("div", { className: groupTitleClassName || `${classNamePrefix}${separator}model-group-title` }, (type === null || type === void 0 ? void 0 : type.icon) ? /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, { type: type.icon }) : null, /* @__PURE__ */ react.default.createElement("span", null, translation(type === null || type === void 0 ? void 0 : type.name) || (getFallbackGroupTitle === null || getFallbackGroupTitle === void 0 ? void 0 : getFallbackGroupTitle(typeCode)) || typeCode)), /* @__PURE__ */ react.default.createElement("div", { className: `${classNamePrefix}${separator}model-grid` }, items.map((model) => {
		const content = /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: `${classNamePrefix}${separator}model-name` }, translation(model.name) || model.code), renderMeta === null || renderMeta === void 0 ? void 0 : renderMeta(model));
		return useButton ? /* @__PURE__ */ react.default.createElement(antd.Button, {
			key: model.code,
			className: `${classNamePrefix}${separator}model-card`,
			onClick: () => onSelect(model)
		}, content) : /* @__PURE__ */ react.default.createElement("div", {
			key: model.code,
			role: "button",
			tabIndex: 0,
			className: `${classNamePrefix}${separator}model-card`,
			onClick: () => onSelect(model)
		}, content);
	})));
}));
//#endregion
exports.default = ModelPickerGrid;
