export function getImageUrl(imagePath: string): string {
  if (imagePath.startsWith('http://') || imagePath.startsWith('https://')) {
    return imagePath
  }

  if (imagePath.startsWith('@/assets/')) {
    const modules = import.meta.glob('@/assets/**/*.{jpg,jpeg,png,gif,svg,webp}', {
      eager: true,
      as: 'url'
    })

    const key = `./${imagePath.replace('@/', '')}`
    return modules[key] || imagePath
  }

  if (imagePath.startsWith('./') || imagePath.startsWith('../')) {
    return new URL(imagePath, import.meta.url).href
  }

  return imagePath
}
