<template>
  <div style="display: none">
    <img v-for="(url, index) in imageUrls" :key="index" :src="url" alt="" @load="handleImageLoad(index)" @error="handleImageError(index)" />
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

// Internal array of images to preload
const imageUrls = ref<string[]>(['/assets/ui-elements/button-ui-box-textured.svg', '/assets/ui-elements/button-ui-frame-empty.svg', '/assets/ui-elements/button-ui-box-textured-small.svg'])

const loadedImages = ref<Set<number>>(new Set())

const handleImageLoad = (index: number) => {
  loadedImages.value.add(index)
  console.log(`Image ${index} loaded:`, imageUrls.value[index])
}

const handleImageError = (index: number) => {
  console.log(`Image ${index} failed to load:`, imageUrls.value[index])
}
</script>
