import React__default, { useState, Fragment } from "react";
import { jsxs, jsx } from "../node_modules/.pnpm/@emotion_react@11.10.4_q4mq7tnhdumujvomvw24zx33y4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
import Modal$1 from "../node_modules/.pnpm/@arco-design_web-react@2.40.1_biqbaboplfbrettd7655fr4n2y/node_modules/@arco-design/web-react/es/Modal/modal.js";
const Modal = ({
  title,
  children,
  component = () => {
  },
  ...rest
}) => {
  const [visible, setVisible] = useState(false);
  const closeModal = () => setVisible(false);
  const showModal = () => setVisible(true);
  return /* @__PURE__ */ jsxs(Fragment, {
    children: [component({
      onShowModal: showModal
    }), isModalVisible && /* @__PURE__ */ jsx(Modal$1, {
      title,
      visible,
      onOk: () => setVisible(false),
      onCancel: () => setVisible(false),
      autoFocus: false,
      focusLock: true,
      children: React__default.Children.map(children, (child) => {
        if (!React__default.isValidElement(child)) {
          return null;
        }
        const config = {
          ...child.props,
          onCloseModal: closeModal,
          onShowModal: showModal
        };
        return React__default.cloneElement(child, config);
      })
    })]
  });
};
export {
  Modal
};
//# sourceMappingURL=Modal.js.map
