const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_index = require("../../locales/index.js");
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_index$1 = require("../pisellRow/index.js");
const require_index$2 = require("../pisellTags/index.js");
const require_index$3 = require("../customSelect/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
require("./index.less");
//#region src/components/versionSelect/index.tsx
const _excluded = [
	"versions",
	"value",
	"onChange"
];
const getStatusColor = (status) => {
	if (status === "live") return "success";
	if (status === "draft") return "gray";
	if (status === "deprecated") return "error";
	return "gray";
};
const getStatusText = (status) => {
	if (status === "live") return require_index.getText("pisell-lowcode-app-version-control-live");
	if (status === "draft") return require_index.getText("pisell-lowcode-app-version-control-draft");
	if (status === "deprecated") return require_index.getText("pisell-lowcode-app-version-control-deprecated");
};
const VersionSelect = (props) => {
	const { versions, value, onChange } = props, rest = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const handleVersionChange = (value) => {
		const version = versions.find((v) => v.value === value);
		onChange === null || onChange === void 0 || onChange(value, version);
	};
	return /* @__PURE__ */ react.default.createElement(require_index$3.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, rest), {}, {
		options: versions,
		value,
		size: "large",
		onChange: handleVersionChange,
		style: { width: "100%" },
		renderItem: (option) => /* @__PURE__ */ react.default.createElement(require_index$1.default, {
			leftContent: option.label,
			rightContent: /* @__PURE__ */ react.default.createElement(require_index$2.default, {
				type: "pill_color",
				color: getStatusColor(option.status),
				className: "pisell-lowcode-version-select-tag"
			}, getStatusText(option.status))
		})
	}));
};
//#endregion
exports.default = VersionSelect;
