import { _objectSpread2 } from "../../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { forwardRef, useImperativeHandle } from "react";
import { Select } from "antd";
//#region src/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.tsx
const MaxLengthSelect = (props, ref) => {
	useImperativeHandle(ref, () => {
		return { onChange: handleChange };
	});
	const handleChange = (e, _option) => {
		if (props.onChange) {
			if ((props.mode === "multiple" || props.mode === "tags") && props.maxLength) {
				if (props.value && props.value.length >= props.maxLength && e.length > props.value.length) return;
			}
			props.onChange(e, _option);
		}
	};
	return /* @__PURE__ */ React.createElement(Select, _objectSpread2(_objectSpread2({}, props), {}, {
		onChange: handleChange,
		popupMatchSelectWidth: false
	}), props.children);
};
var MaxLengthSelect_default = forwardRef(MaxLengthSelect);
//#endregion
export { MaxLengthSelect_default as default };
