"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const React = require("react");
const emotionReactJsxRuntime_browser_esm = require("../node_modules/.pnpm/@emotion_react@11.10.4_q4mq7tnhdumujvomvw24zx33y4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
const modal = require("../node_modules/.pnpm/@arco-design_web-react@2.40.1_biqbaboplfbrettd7655fr4n2y/node_modules/@arco-design/web-react/es/Modal/modal.js");
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
const React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
const Modal = ({
  title,
  children,
  component = () => {
  },
  ...rest
}) => {
  const [visible, setVisible] = React.useState(false);
  const closeModal = () => setVisible(false);
  const showModal = () => setVisible(true);
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs(React.Fragment, {
    children: [component({
      onShowModal: showModal
    }), isModalVisible && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(modal, {
      title,
      visible,
      onOk: () => setVisible(false),
      onCancel: () => setVisible(false),
      autoFocus: false,
      focusLock: true,
      children: React__default.default.Children.map(children, (child) => {
        if (!React__default.default.isValidElement(child)) {
          return null;
        }
        const config = {
          ...child.props,
          onCloseModal: closeModal,
          onShowModal: showModal
        };
        return React__default.default.cloneElement(child, config);
      })
    })]
  });
};
exports.Modal = Modal;
//# sourceMappingURL=Modal.js.map
