<script>
import theme from "#build/b24ui/prose/h1";
</script>

<script setup>
import { computed } from "vue";
import { useAppConfig, useRuntimeConfig } from "#imports";
import { tv } from "../../utils/tv";
const props = defineProps({
  id: { type: String, required: false },
  accent: { type: null, required: false, default: "default" },
  class: { type: null, required: false },
  b24ui: { type: null, required: false }
});
defineSlots();
const appConfig = useAppConfig();
const { headings } = useRuntimeConfig().public?.mdc || {};
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.h1 || {} })({
  accent: props.accent
}));
const generate = computed(() => props.id && typeof headings?.anchorLinks === "object" && headings.anchorLinks.h1);
</script>

<template>
  <h1
    :id="id"
    data-slot="base"
    :class="b24ui.base({ class: [props.b24ui?.base, props.class] })"
  >
    <a v-if="id && generate" :href="`#${id}`" :class="b24ui.link({ class: props.b24ui?.link })">
      <slot />
    </a>
    <slot v-else />
  </h1>
</template>
