import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

/**
 * Merges conditional Tailwind classes using the same pattern as shadcn.
 *
 * `clsx` evaluates conditional input while `tailwind-merge` lets a caller's
 * class override a component default from the same Tailwind class group:
 *
 * ```ts
 * cn("h-10 px-4", compact && "h-8", props.class)
 * ```
 */
export function cn(...inputs: ClassValue[]): string {
  return twMerge(clsx(inputs));
}
