import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import React, { useState } from "react";
import { Modal } from "antd";
import { locales } from "@pisell/utils";
import { WarningOutlined } from "@ant-design/icons";
import "./index.less";
//#region src/components/booking/components/reloadResourceModal/index.tsx
const ReloadResourceModal = ({ modal, onReload, onCancel }) => {
	var _modal$state$service;
	const [loading, setLoading] = useState(false);
	const handleReload = function() {
		var _ref = _asyncToGenerator(function* () {
			setLoading(true);
			try {
				yield onReload === null || onReload === void 0 ? void 0 : onReload();
			} catch (_unused) {}
			setLoading(false);
		});
		return function handleReload() {
			return _ref.apply(this, arguments);
		};
	}();
	return /* @__PURE__ */ React.createElement(Modal, {
		className: "pisell-resource-reload-modal",
		title: /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(WarningOutlined, { style: {
			color: "#d89614",
			marginRight: 8
		} }), locales.getText("pisell2.booking.info.resource.warning-title")),
		cancelText: null,
		okText: locales.getText("pisell2.booking.info.resource.retry"),
		confirmLoading: loading,
		open: (_modal$state$service = modal.state.service) === null || _modal$state$service === void 0 ? void 0 : _modal$state$service.reloadResourceModal,
		onOk: handleReload,
		cancelButtonProps: { style: { display: "none" } },
		onCancel
	}, /* @__PURE__ */ React.createElement("div", null, locales.getText("pisell2.booking.info.resource.warning-content")));
};
//#endregion
export { ReloadResourceModal as default };
