import { jsxs as d, Fragment as g, jsx as i } from "react/jsx-runtime";
import { useRef as x, cloneElement as k } from "react";
import { Button as C } from "@mui/material";
import { useMemoizedFn as O } from "ahooks";
import h from "./selector.js";
import j from "./locales.js";
import { translate as F } from "../Locale/util.js";
function T({
  org: e,
  onSuccess: f,
  resourceId: s,
  buttonProps: n,
  buttonText: l,
  locale: t = "en",
  dialogProps: c,
  children: o
}) {
  const a = O((u, p = {}) => F(j, u, t, "en", p)), r = x(null), m = () => {
    r.current && r.current.open({ selectedOrg: e });
  };
  return /* @__PURE__ */ d(g, { children: [
    o ? k(o, { ...n, onClick: m }) : /* @__PURE__ */ i(C, { ...n, onClick: m, children: l || a("transferOrg") }),
    /* @__PURE__ */ i(
      h,
      {
        locale: t,
        org: e,
        ref: r,
        resourceId: s,
        onSuccess: f,
        dialogProps: c
      }
    )
  ] });
}
export {
  T as default
};
