"use client"; import { IconCheck, IconClipboardCheck, IconCopy } from "@tabler/icons-react"; import copy from "copy-to-clipboard"; import * as React from "react"; import { toast } from "sonner"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; function CopyButton({ value, className, variant = "ghost", ...props }: React.ComponentProps & { value: string; }) { const [hasCopied, setHasCopied] = React.useState(false); const timeoutRef = React.useRef(undefined); React.useEffect( () => () => { if (timeoutRef.current) { clearTimeout(timeoutRef.current); } }, [], ); const handleCopy = () => { if (hasCopied) return; copy(value); setHasCopied(true); toast.success("Copied!", { icon: