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

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

/**
 * Returns a shallow copy without the Vue `class` attr/prop.
 * @param source Object that may contain a `class` key.
 * @returns A shallow copy without `class`.
 */
export function omitClass<T extends object>(source: T): Omit<T, 'class'> {
  const rest = { ...source } as Omit<T, 'class'> &
    Partial<Record<'class', unknown>>;
  delete rest.class;
  return rest;
}
