import { defineComponent as H, computed as I, createElementBlock as a, createCommentVNode as S, openBlock as n, Fragment as u, renderList as w, createBlock as s, unref as i, withCtx as C, createVNode as B } from "vue";
import { splitContent as N, getHeadings as b } from "@scalar/code-highlight/markdown";
import { ScalarMarkdown as c } from "@scalar/components";
import d from "github-slugger";
import x from "../../IntersectionObserver.vue.js";
import { useNavState as E } from "../../../hooks/useNavState.js";
const F = {
  key: 0,
  class: "introduction-description"
}, U = /* @__PURE__ */ H({
  __name: "Description",
  props: {
    value: {}
  },
  setup(m) {
    const o = m, p = I(() => {
      if (!o.value)
        return [];
      const e = new d();
      return N(o.value).map((t) => {
        const [r] = b(t);
        return {
          id: r ? l({
            ...r,
            slug: e.slug(r.value)
          }) : void 0,
          content: t
        };
      });
    }), { getHeadingId: l, getFullHash: g, isIntersectionEnabled: f, replaceUrlState: v } = E();
    function h(e = "") {
      f.value && v(e);
    }
    const _ = new d(), k = (e) => (e.data = {
      hProperties: {
        id: l({
          depth: e.depth,
          value: e.children[0].value,
          slug: _.slug(e.children[0].value)
        })
      }
    }, e);
    return (e, y) => e.value ? (n(), a("div", F, [
      (n(!0), a(u, null, w(p.value, (t) => (n(), a(u, {
        key: t.id
      }, [
        t.id ? (n(), s(x, {
          key: 0,
          id: i(g)(t.id),
          class: "introduction-description-heading",
          onIntersecting: () => h(t.id)
        }, {
          default: C(() => [
            B(i(c), {
              transform: k,
              transformType: "heading",
              value: t.content
            }, null, 8, ["value"])
          ]),
          _: 2
        }, 1032, ["id", "onIntersecting"])) : (n(), s(i(c), {
          key: 1,
          value: t.content,
          withImages: ""
        }, null, 8, ["value"]))
      ], 64))), 128))
    ])) : S("", !0);
  }
});
export {
  U as default
};
