const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_useEngineContext = require("../../../../hooks/useEngineContext.js");
const require_index = require("../authWrap/index.js");
const require_index$1 = require("../voucher/index.js");
const require_index$2 = require("../actionButtons/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/booking/components/tabPane/index.tsx
const TabPane = ({ children, header, footer, style, loading, bodyClassName, state, dispatch, source }) => {
	var _context$appHelper, _businessUtils$getApp, _businessUtils$getApp2, _state$service, _state$addons, _state$client;
	const { businessUtils } = ((_context$appHelper = require_useEngineContext.default().appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
	const hasGoodPassApp = !!(businessUtils === null || businessUtils === void 0 || (_businessUtils$getApp = businessUtils.getAppByModal) === null || _businessUtils$getApp === void 0 ? void 0 : _businessUtils$getApp.call(businessUtils, "goodpass"));
	const hasDiscountCardApp = !!(businessUtils === null || businessUtils === void 0 || (_businessUtils$getApp2 = businessUtils.getAppByModal) === null || _businessUtils$getApp2 === void 0 ? void 0 : _businessUtils$getApp2.call(businessUtils, "discountcard"));
	const paymentRefundedStatus = (0, react.useMemo)(() => {
		var _state$bookingDetail;
		return ["partially_refunded", "refunded"].includes(state === null || state === void 0 || (_state$bookingDetail = state.bookingDetail) === null || _state$bookingDetail === void 0 ? void 0 : _state$bookingDetail.payment_status);
	}, [state === null || state === void 0 ? void 0 : state.bookingDetail]);
	const voucherBaseCondition = (hasGoodPassApp || hasDiscountCardApp) && ["addons", "info"].includes(source) && !paymentRefundedStatus;
	voucherBaseCondition && (state === null || state === void 0 || state.isBookingTicket2);
	const shouldShowFooterVoucher = voucherBaseCondition && !(state === null || state === void 0 ? void 0 : state.isBookingTicket2);
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-lowcode__booking-tab-pane-wrap",
		style
	}, /* @__PURE__ */ react.default.createElement("div", { className: typeof header === "string" ? "pisell-lowcode__booking-tab-pane-title" : "" }, header), /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("pisell-lowcode__booking-tab-pane-body", bodyClassName) }, /* @__PURE__ */ react.default.createElement(antd.Skeleton, {
		loading,
		round: true,
		active: true,
		avatar: false,
		style: { padding: 20 }
	}, children)), state && dispatch && (state === null || state === void 0 ? void 0 : state.isBookingTicket2) && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode__booking-tab-pane-voucher-section" }, /* @__PURE__ */ react.default.createElement(require_index$2.default, {
		state,
		dispatch
	})), /* @__PURE__ */ react.default.createElement(require_index.default, {
		show: !!footer || shouldShowFooterVoucher,
		trueRender: /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode__booking-tab-pane-footer" }, shouldShowFooterVoucher && state && dispatch && /* @__PURE__ */ react.default.createElement(require_index$1.default, {
			state: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, state), {}, {
				service: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, state.service || {}), {}, { value: ((_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || [] }),
				addons: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, state.addons || {}), {}, { value: ((_state$addons = state.addons) === null || _state$addons === void 0 ? void 0 : _state$addons.value) || [] }),
				client: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, state.client || {}), {}, { value: ((_state$client = state.client) === null || _state$client === void 0 ? void 0 : _state$client.value) || {} })
			}),
			dispatch,
			source
		}), footer)
	})));
};
//#endregion
exports.default = TabPane;
