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

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

export function initials(s: string): string {
  const initials = s
    .split(' ')
    .map((word) => word.charAt(0).toUpperCase()) as string[]

  if (initials.length == 0) {
    return ''
  }

  const first = initials[0]
  const last = initials[initials.length - 1]
  return first + last
}
