import { defineComponent as b, useId as M, computed as u, createBlock as i, createCommentVNode as f, openBlock as r, unref as e, withCtx as o, createVNode as a, createElementVNode as g, createTextVNode as y, normalizeClass as k, createElementBlock as N, Fragment as I, renderList as C } from "vue";
import { ScalarErrorBoundary as O } from "@scalar/components";
import _ from "../../ShowMoreButton.vue.js";
import { useNavState as A } from "../../../hooks/useNavState.js";
import { useSidebar as B } from "../../../features/sidebar/hooks/useSidebar.js";
import H from "../../Section/SectionContainer.vue.js";
import L from "../../Section/Section.vue.js";
import w from "../../Section/SectionHeader.vue.js";
import p from "../../Section/SectionHeaderTag.vue.js";
import E from "../../Section/CompactSection.vue.js";
import V from "../Schema/Schema.vue.js";
import T from "../Schema/SchemaHeading.vue.js";
const h = 10, P = /* @__PURE__ */ b({
  __name: "ModernLayout",
  props: {
    config: {},
    schemas: {}
  },
  setup(s) {
    const m = M(), { collapsedSidebarItems: S } = B(), { getModelId: d } = A(), n = u(
      () => s.config.expandAllModelSections || Object.keys(s.schemas ?? {}).length <= h || S[d()]
    ), v = u(() => {
      const l = Object.keys(s.schemas ?? {});
      return n.value ? l : l.slice(0, h);
    });
    return (l, c) => l.schemas ? (r(), i(e(H), {
      key: 0,
      id: "models"
    }, {
      default: o(() => [
        a(e(L), { "aria-labelledby": e(m) }, {
          default: o(() => [
            a(e(w), null, {
              default: o(() => [
                a(e(p), {
                  id: e(m),
                  level: 2
                }, {
                  default: o(() => c[0] || (c[0] = [
                    y(" Models ")
                  ])),
                  _: 1,
                  __: [0]
                }, 8, ["id"])
              ]),
              _: 1
            }),
            g("div", {
              class: k(["models-list", { "models-list-truncated": !n.value }])
            }, [
              (r(!0), N(I, null, C(v.value, (t) => (r(), i(e(E), {
                key: t,
                id: e(d)({ name: t }),
                class: "models-list-item",
                label: t,
                defaultOpen: l.config.expandAllModelSections
              }, {
                heading: o(() => [
                  a(e(p), { level: 3 }, {
                    default: o(() => [
                      a(e(T), {
                        name: l.schemas[t].title ?? t,
                        value: l.schemas[t]
                      }, null, 8, ["name", "value"])
                    ]),
                    _: 2
                  }, 1024)
                ]),
                default: o(() => [
                  a(e(O), null, {
                    default: o(() => [
                      a(e(V), {
                        noncollapsible: "",
                        hideHeading: !0,
                        hideModelNames: !0,
                        schemas: l.schemas,
                        level: 1,
                        value: l.schemas[t]
                      }, null, 8, ["schemas", "value"])
                    ]),
                    _: 2
                  }, 1024)
                ]),
                _: 2
              }, 1032, ["id", "label", "defaultOpen"]))), 128))
            ], 2),
            n.value ? f("", !0) : (r(), i(_, {
              key: 0,
              id: e(d)(),
              class: "show-more-models"
            }, null, 8, ["id"]))
          ]),
          _: 1
        }, 8, ["aria-labelledby"])
      ]),
      _: 1
    })) : f("", !0);
  }
});
export {
  P as default
};
