import { jsx as e, Fragment as j } from "react/jsx-runtime";
import { useSize as z } from "ahooks";
import { Tooltip as v } from "@mui/material";
import t from "lodash/isUndefined";
import { useSnackbar as F } from "notistack";
import S from "./hook.js";
import U, { ToastProvider as _ } from "../Toast/index.js";
import { mergeProps as B } from "../Util/index.js";
import { styled as s } from "../Theme/index.js";
import { default as X } from "./copy-button.js";
const L = s("span")`
  display: inline;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  align-items: center;
  justify-content: start;
  border-radius: 15px;
  padding: 1px 12px;
  background-color: rgba(0, 0, 0, 0.08);
  cursor: pointer;
`, O = s("span")`
  cursor: pointer;
`;
function R(c) {
  const o = Object.assign({}, c);
  t(o.content) && (o.content = ""), t(o.tip) && (o.tip = ""), t(o.copiedTip) && (o.copiedTip = ""), t(o.tipPlacement) && (o.tipPlacement = "right"), t(o.locale) && (o.locale = "en"), t(o.unstyled) && (o.unstyled = !1);
  const a = B(o, R, ["style"]), { children: d, content: n, tip: l, copiedTip: m, tipPlacement: f, locale: u, style: y, unstyled: C, ...w } = a, { containerRef: b, copied: h, copy: g, texts: i } = S({ content: n, locale: u }), x = l || i.copy, r = m || i.copied, T = F(), k = z(document.body)?.width || 0, p = /* @__PURE__ */ e(v, { title: h ? r : x, ...w, placement: f, disableFocusListener: !0, children: /* @__PURE__ */ e(C ? O : L, { ref: b, style: y, onClick: (P) => {
    g(P), k < 600 && U.success(r);
  }, children: d || n }) });
  return T ? /* @__PURE__ */ e(j, { children: p }) : /* @__PURE__ */ e(_, { children: p });
}
export {
  X as CopyButton,
  R as default
};
