<template>
  <button v-hm:64="48" v-wm:393="48" v-xm:393="8" v-ym:64="8" @click="onClick()">
    <Spot />
  </button>
</template>

<script lang="ts" setup>
const router = useRouter()

function onClick() {
  const previousUrl = document.referrer
  const isSameSite = !previousUrl || new URL(previousUrl).hostname === window.location.hostname
  const canGoBack = window.history.length > 1

  if (isSameSite && canGoBack) {
    router.back()
  } else {
    navigateTo('/')
  }
}
</script>
