import { jsxs as l, jsx as r } from "react/jsx-runtime";
import { useToast as d, Modal as n, Alert as p, Button as c } from "@edifice.io/react";
import { createPortal as x } from "react-dom";
import { useTranslation as a } from "react-i18next";
import { t as h, r as u, c as m } from "./index2.js";
const f = (s) => {
  const t = h(), o = u(), i = d(), {
    t: e
  } = a();
  return {
    handleExportClick: () => {
      t.length ? (m({
        searchParams: o,
        assetId: t[0].assetId
      }), s()) : i.error(e("explorer.error.noResourceSelected"));
    }
  };
};
function C({
  isOpen: s,
  onSuccess: t,
  onCancel: o
}) {
  const {
    handleExportClick: i
  } = f(t), {
    t: e
  } = a();
  return /* @__PURE__ */ x(/* @__PURE__ */ l(n, { isOpen: s, onModalClose: o, id: "exportModal", children: [
    /* @__PURE__ */ r(n.Header, { onModalClose: o, children: e("explorer.export.title") }),
    /* @__PURE__ */ l(n.Body, { children: [
      /* @__PURE__ */ l("ul", { children: [
        /* @__PURE__ */ r("li", { children: e("explorer.export.body.info.1") }),
        /* @__PURE__ */ r("li", { children: e("explorer.export.body.info.2") }),
        /* @__PURE__ */ r("li", { children: e("explorer.export.body.info.3") })
      ] }),
      /* @__PURE__ */ r(p, { type: "warning", children: e("explorer.export.body.warning") })
    ] }),
    /* @__PURE__ */ l(n.Footer, { children: [
      /* @__PURE__ */ r(c, { color: "tertiary", onClick: o, type: "button", variant: "ghost", children: e("explorer.cancel") }),
      /* @__PURE__ */ r(c, { color: "primary", onClick: i, type: "button", variant: "filled", children: e("explorer.actions.export") })
    ] })
  ] }), document.getElementById("portal"));
}
export {
  C as default
};
