<script setup>
import { NuxtLink } from "#components";
import { computed, useModalRouter } from "#imports";
const props = defineProps({
  custom: { type: null, required: false },
  to: { type: null, required: false },
  href: { type: null, required: false },
  external: { type: Boolean, required: false },
  target: { type: [String, Object, null], required: false },
  rel: { type: [String, Object, null], required: false },
  noRel: { type: Boolean, required: false, default: void 0 },
  prefetchedClass: { type: String, required: false },
  prefetch: { type: Boolean, required: false },
  prefetchOn: { type: [String, Object], required: false },
  noPrefetch: { type: Boolean, required: false, default: void 0 },
  trailingSlash: { type: String, required: false },
  activeClass: { type: String, required: false },
  exactActiveClass: { type: String, required: false },
  ariaCurrentValue: { type: String, required: false },
  viewTransition: { type: Boolean, required: false },
  replace: { type: Boolean, required: false },
  open: { type: Boolean, required: false }
});
const url = computed(() => props.to || props.href);
function onClick(e) {
  if (!url.value || e.ctrlKey || e.shiftKey || e.metaKey || e.altKey)
    return;
  e.preventDefault();
  const modalRouter = useModalRouter();
  if (props.replace) {
    modalRouter.replace(url.value);
  } else {
    modalRouter.push(url.value, props.open);
  }
}
</script>

<template>
  <NuxtLink v-bind="props" @click="onClick">
    <slot />
  </NuxtLink>
</template>
