const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_model = require("../model.js");
const require_useQuotation = require("../../hooks/useQuotation.js");
const require_useClearCart = require("../../hooks/useClearCart.js");
const require_index = require("./addService/index.js");
const require_index$1 = require("./editService/index.js");
const require_index$2 = require("./serviceList/index.js");
const require_index$3 = require("./addTimeModal/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
require("./index.less");
//#region src/components/booking/info/service/index.tsx
const Service = () => {
	var _state$bookingConfig2;
	const { state, dispatch } = (0, react.useContext)(require_model.Context);
	const detailRef = (0, react.useRef)();
	(0, react.useEffect)(() => {
		document.body.id = "body";
	}, []);
	const appointment_card = (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.information_tab) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.appointment_card) || { quick_time: 1 };
	}, [state === null || state === void 0 || (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 || (_state$bookingConfig2 = _state$bookingConfig2.config) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.information_tab]);
	const showAddTimeModal = (0, react.useMemo)(() => {
		if ((state === null || state === void 0 ? void 0 : state.renderType) === "eventBooking") return false;
		if (state === null || state === void 0 ? void 0 : state.disabledEdit) return false;
		if (appointment_card.quick_time !== 1) return false;
		return true;
	}, [state, appointment_card.quick_time]);
	const handleEdit = (cacheItem, type) => {
		setTimeout(() => {
			var _detailRef$current, _detailRef$current$in;
			(_detailRef$current = detailRef.current) === null || _detailRef$current === void 0 || (_detailRef$current$in = _detailRef$current.init) === null || _detailRef$current$in === void 0 || _detailRef$current$in.call(_detailRef$current, cacheItem, false, type === "edit_product");
		}, 100);
	};
	const clearCart = require_useClearCart.default(state, dispatch);
	const { dom } = require_useQuotation.default(state, dispatch);
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode__booking-service-wrap" }, clearCart, /* @__PURE__ */ react.default.createElement(require_index$2.default, { onEdit: handleEdit }), !state.isBookingCreatePage ? /* @__PURE__ */ react.default.createElement(require_index.default, { onEdit: handleEdit }) : null), /* @__PURE__ */ react.default.createElement(require_index$1.default, { ref: detailRef }), showAddTimeModal && /* @__PURE__ */ react.default.createElement(require_index$3.default, null), dom);
};
var service_default = react.default.memo(Service);
//#endregion
exports.default = service_default;
