import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import { Context } from "../../info/model.js";
import useSelectPet from "../../info/service2/hooks/useSelectPet.js";
import React, { useCallback, useContext, useMemo } from "react";
import { Select } from "antd";
//#region src/components/booking/materiels/holder/index.tsx
const _excluded = ["selectProps"];
const Holder = (props) => {
	var _state$pet;
	const { selectProps } = props, resetProps = _objectWithoutProperties(props, _excluded);
	const { state } = useContext(Context);
	const { holderLists } = useSelectPet(state);
	/**
	* @title: holders数据
	* @description:
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2024-12-02 22:30
	*/
	const holders = useMemo(() => {
		const lists = holderLists === null || holderLists === void 0 ? void 0 : holderLists.filter((d) => ((d === null || d === void 0 ? void 0 : d.id) || (d === null || d === void 0 ? void 0 : d.form_record_id)) > 0);
		if (!(lists === null || lists === void 0 ? void 0 : lists.length)) return [];
		return lists.map((d) => {
			return {
				value: (d === null || d === void 0 ? void 0 : d.id) || (d === null || d === void 0 ? void 0 : d.form_record_id),
				label: d === null || d === void 0 ? void 0 : d.main_field
			};
		});
	}, [state === null || state === void 0 || (_state$pet = state.pet) === null || _state$pet === void 0 ? void 0 : _state$pet.value]);
	const renderOptions = useCallback((array, value = "value", label = "label") => {
		return array.map((d) => {
			return /* @__PURE__ */ React.createElement(Select.Option, {
				value: d[value],
				key: d[value],
				disabled: d.disabled
			}, d[label]);
		});
	}, []);
	return /* @__PURE__ */ React.createElement(Select, _objectSpread2(_objectSpread2({}, selectProps), resetProps), renderOptions(holders));
};
//#endregion
export { Holder as default };
