require("../../../../_virtual/_rolldown/runtime.js");
const require_utils = require("../../utils.js");
let react = require("react");
//#region src/components/booking/info/hooks/useHolderConfig.ts
const useHolderConfig = (state) => {
	var _state$bookingConfig2, _state$bookingConfig4, _state$bookingConfig6, _state$client2;
	const appointment_subject = (0, react.useMemo)(() => {
		var _state$bookingConfig;
		return (state === null || state === void 0 || (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.config) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.basic) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.appointment_subject) || {};
	}, [state === null || state === void 0 || (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.config) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.basic) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.appointment_subject]);
	const holder = (0, react.useMemo)(() => {
		var _state$bookingConfig3;
		return (state === null || state === void 0 || (_state$bookingConfig3 = state.bookingConfig) === null || _state$bookingConfig3 === void 0 ? void 0 : _state$bookingConfig3.holder) || {};
	}, [state === null || state === void 0 || (_state$bookingConfig4 = state.bookingConfig) === null || _state$bookingConfig4 === void 0 ? void 0 : _state$bookingConfig4.holder]);
	const isFormSubject = (0, react.useMemo)(() => {
		return appointment_subject.type === "form";
	}, [appointment_subject.type]);
	const holderType = (0, react.useMemo)(() => {
		var _state$bookingConfig5;
		return (state === null || state === void 0 || (_state$bookingConfig5 = state.bookingConfig) === null || _state$bookingConfig5 === void 0 || (_state$bookingConfig5 = _state$bookingConfig5.holder) === null || _state$bookingConfig5 === void 0 || (_state$bookingConfig5 = _state$bookingConfig5.form) === null || _state$bookingConfig5 === void 0 ? void 0 : _state$bookingConfig5.formType) || "minors";
	}, [state === null || state === void 0 || (_state$bookingConfig6 = state.bookingConfig) === null || _state$bookingConfig6 === void 0 ? void 0 : _state$bookingConfig6.holder]);
	const isWalkInBol = (0, react.useMemo)(() => {
		var _state$client;
		return require_utils.isWalkIn(state === null || state === void 0 || (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id);
	}, [state === null || state === void 0 || (_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id]);
	return {
		appointment_subject,
		holder,
		isFormSubject,
		isCustomerSubject: (0, react.useMemo)(() => {
			return appointment_subject.type === "customer";
		}, [appointment_subject.type]),
		isWalkInBol,
		isShowChangeHolder: (0, react.useMemo)(() => {
			return isFormSubject && !isWalkInBol;
		}, [isFormSubject, isWalkInBol]),
		holderType
	};
};
//#endregion
exports.default = useHolderConfig;
