import { defineComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode } from "vue";
import { resolve } from "@scalar/workspace-store/resolve";
import SectionAccordion from "../../../Section/SectionAccordion.vue.js";
import SchemaProperty from "../../Schema/SchemaProperty.vue.js";
import _sfc_main$1 from "../../../Anchor/Anchor.vue.js";
import SectionHeaderTag from "../../../Section/SectionHeaderTag.vue.js";
import SchemaHeading from "../../Schema/SchemaHeading.vue.js";
const _hoisted_1 = {
  key: 0,
  class: "properties"
};
const _hoisted_2 = { key: 1 };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "ClassicLayout",
  props: {
    id: {},
    name: {},
    schema: {},
    isCollapsed: { type: Boolean },
    eventBus: {},
    options: {}
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(SectionAccordion), {
        "aria-label": __props.schema.title ?? __props.name,
        modelValue: !__props.isCollapsed,
        "onUpdate:modelValue": _cache[1] || (_cache[1] = (value) => __props.eventBus?.emit("toggle:nav-item", { id: __props.id, open: value }))
      }, {
        title: withCtx(() => [
          createVNode(unref(_sfc_main$1), {
            class: "reference-models-anchor",
            eventBus: __props.eventBus,
            onCopyAnchorUrl: _cache[0] || (_cache[0] = () => __props.eventBus?.emit("copy-url:nav-item", { id: __props.id }))
          }, {
            default: withCtx(() => [
              createVNode(unref(SectionHeaderTag), { level: 3 }, {
                default: withCtx(() => [
                  createVNode(unref(SchemaHeading), {
                    class: "reference-models-label",
                    name: __props.schema.title ?? __props.name,
                    value: __props.schema
                  }, null, 8, ["name", "value"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["eventBus"])
        ]),
        default: withCtx(() => [
          "properties" in __props.schema ? (openBlock(), createElementBlock("div", _hoisted_1, [
            (openBlock(true), createElementBlock(Fragment, null, renderList(Object.entries(__props.schema.properties ?? {}), ([property, value]) => {
              return openBlock(), createBlock(unref(SchemaProperty), {
                key: property,
                eventBus: __props.eventBus,
                name: property,
                options: __props.options,
                required: __props.schema.required?.includes(property),
                schema: unref(resolve).schema(value)
              }, null, 8, ["eventBus", "name", "options", "required", "schema"]);
            }), 128))
          ])) : (openBlock(), createElementBlock("div", _hoisted_2, [
            createVNode(unref(SchemaProperty), {
              eventBus: __props.eventBus,
              options: __props.options,
              schema: __props.schema
            }, null, 8, ["eventBus", "options", "schema"])
          ]))
        ]),
        _: 1
      }, 8, ["aria-label", "modelValue"]);
    };
  }
});
export {
  _sfc_main as default
};
