import { defineComponent as $, ref as C, createBlock as B, openBlock as r, withCtx as s, createVNode as n, unref as o, normalizeClass as l, createElementVNode as u, createElementBlock as m, createCommentVNode as f, renderSlot as i } from "vue";
import { Disclosure as I, DisclosureButton as _, DisclosurePanel as y } from "@headlessui/vue";
import { ScalarIconCaretRight as E } from "@scalar/icons";
import { useElementHover as N } from "@vueuse/core";
import { useNavState as g } from "../../hooks/useNavState.js";
import w from "../IntersectionObserver.vue.js";
import { useSidebar as D } from "../../features/sidebar/hooks/useSidebar.js";
const V = { class: "section-accordion-button-content" }, z = {
  key: 0,
  class: "section-accordion-button-actions"
}, H = {
  key: 0,
  class: "section-accordion-description"
}, W = { class: "section-accordion-content-card" }, G = /* @__PURE__ */ $({
  __name: "SectionAccordion",
  props: {
    id: {},
    transparent: { type: Boolean }
  },
  setup(e) {
    const a = C(), p = N(a), { getSectionId: v, isIntersectionEnabled: h, replaceUrlState: b } = g(), { setCollapsedSidebarItem: S } = D(), k = () => {
      var t, c;
      !e.id || !h.value || (b(e.id), ((t = e.id) != null && t.startsWith("model") || (c = e.id) != null && c.startsWith("webhook")) && S(v(e.id), !0));
    };
    return (t, c) => (r(), B(w, {
      id: t.id,
      class: "section-wrapper",
      onIntersecting: k
    }, {
      default: s(() => [
        n(o(I), {
          as: "section",
          class: l(["section-accordion", { "section-accordion-transparent": t.transparent }])
        }, {
          default: s(({ open: d }) => [
            n(o(_), {
              ref_key: "button",
              ref: a,
              class: "section-accordion-button"
            }, {
              default: s(() => [
                u("div", V, [
                  i(t.$slots, "title", {}, void 0, !0)
                ]),
                t.$slots.actions ? (r(), m("div", z, [
                  i(t.$slots, "actions", {
                    active: o(p) || d
                  }, void 0, !0)
                ])) : f("", !0),
                n(o(E), {
                  class: l(["section-accordion-chevron size-4.5 transition-transform", { "rotate-90": d }])
                }, null, 8, ["class"])
              ]),
              _: 2
            }, 1536),
            n(o(y), { class: "section-accordion-content" }, {
              default: s(() => [
                t.$slots.description ? (r(), m("div", H, [
                  i(t.$slots, "description", {}, void 0, !0)
                ])) : f("", !0),
                u("div", W, [
                  i(t.$slots, "default", {}, void 0, !0)
                ])
              ]),
              _: 3
            })
          ]),
          _: 3
        }, 8, ["class"])
      ]),
      _: 3
    }, 8, ["id"]));
  }
});
export {
  G as default
};
