import { jsx as e } from "react/jsx-runtime";
import s from "copy-text-to-clipboard";
import { useState as a, useRef as u, useEffect as l } from "react";
import { ContentCopyW700 as m } from "@material-symbols-svg/react-rounded/icons/content-copy";
import { CheckFillW700 as p } from "@material-symbols-svg/react-rounded/icons/check";
import { cn as f } from "../utils/cn.js";
const g = ({ value: n, className: c }) => {
  const [r, o] = a(!1), t = u(null);
  return l(
    () => () => {
      t.current && clearTimeout(t.current);
    },
    []
  ), /* @__PURE__ */ e(
    "button",
    {
      type: "button",
      onClick: (i) => {
        i.stopPropagation(), i.preventDefault(), s(n), o(!0), t.current && clearTimeout(t.current), t.current = setTimeout(() => o(!1), 3e3);
      },
      className: f(
        "cursor-pointer transition-all duration-300 [transition-timing-function:cubic-bezier(0.175,0.885,0.32,1.275)] active:-translate-y-1 active:scale-x-90 active:scale-y-110",
        r ? "text-sw-status-success" : "text-sw-gray-200 hover:text-sw-gray-50",
        c
      ),
      children: r ? /* @__PURE__ */ e(p, { size: 16 }) : /* @__PURE__ */ e(m, { size: 16 })
    }
  );
};
export {
  g as CopyButton
};
//# sourceMappingURL=CopyButton.js.map
