import { defineComponent, computed, createElementBlock, openBlock, Fragment, createVNode, createElementVNode, unref, renderSlot, createBlock, createCommentVNode, withCtx } from "vue";
import { generateClientOptions } from "@scalar/api-client/v2/blocks/operation-code-sample";
import { ScalarErrorBoundary } from "@scalar/components";
import _sfc_main$4 from "./Operations/TraversedEntry.vue.js";
import _sfc_main$1 from "../Lazy/Lazy.vue.js";
import { firstLazyLoadComplete } from "../../helpers/lazy-bus.js";
import { getXKeysFromObject } from "../../features/specification-extension/helpers.js";
import SectionFlare from "../SectionFlare/SectionFlare.vue.js";
import _sfc_main$2 from "../../blocks/scalar-info-block/components/InfoBlock.vue.js";
import IntroductionCardItem from "../../blocks/scalar-info-block/components/IntroductionCardItem.vue.js";
import _sfc_main$3 from "../../blocks/scalar-server-selector-block/components/ServerSelector.vue.js";
import AuthSelector from "../../blocks/scalar-auth-selector-block/components/AuthSelector.vue.js";
import ClientSelector from "../../blocks/scalar-client-selector-block/components/ClientSelector.vue.js";
import _sfc_main$5 from "../RenderPlugins/RenderPlugins.vue.js";
const _hoisted_1 = { class: "narrow-references-container" };
const _hoisted_2 = {
  key: 1,
  class: "h-dvh"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "Content",
  props: {
    activeServer: {},
    infoSectionId: {},
    document: {},
    xScalarDefaultClient: {},
    getSecuritySchemes: { type: Function },
    items: {},
    expandedItems: {},
    eventBus: {},
    options: {}
  },
  setup(__props) {
    const clientOptions = computed(() => generateClientOptions(__props.options.httpClients));
    const documentExtensions = computed(() => getXKeysFromObject(__props.document));
    const infoExtensions = computed(() => getXKeysFromObject(__props.document?.info));
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(Fragment, null, [
        createVNode(unref(SectionFlare)),
        createElementVNode("div", _hoisted_1, [
          renderSlot(_ctx.$slots, "start"),
          createVNode(_sfc_main$1, { id: _ctx.infoSectionId }, {
            "empty-state": withCtx(() => [
              renderSlot(_ctx.$slots, "empty-state")
            ]),
            default: withCtx(() => [
              createVNode(unref(_sfc_main$2), {
                id: _ctx.infoSectionId,
                documentExtensions: documentExtensions.value,
                eventBus: _ctx.eventBus,
                externalDocs: _ctx.document?.externalDocs,
                info: _ctx.document?.info,
                infoExtensions: infoExtensions.value,
                layout: _ctx.options.layout,
                oasVersion: _ctx.document?.["x-original-oas-version"],
                options: {
                  headingSlugGenerator: _ctx.options.headingSlugGenerator,
                  documentDownloadType: _ctx.options.documentDownloadType,
                  layout: _ctx.options.layout
                }
              }, {
                selectors: withCtx(() => [
                  createVNode(unref(ScalarErrorBoundary), null, {
                    default: withCtx(() => [
                      _ctx.document?.servers?.length ? (openBlock(), createBlock(unref(IntroductionCardItem), {
                        key: 0,
                        class: "scalar-reference-intro-server scalar-client introduction-card-item text-base leading-normal [--scalar-address-bar-height:0px]"
                      }, {
                        default: withCtx(() => [
                          createVNode(unref(_sfc_main$3), {
                            servers: _ctx.document?.servers ?? [],
                            xSelectedServer: _ctx.document?.["x-scalar-active-server"]
                          }, null, 8, ["servers", "xSelectedServer"])
                        ]),
                        _: 1
                      })) : createCommentVNode("", true)
                    ]),
                    _: 1
                  }),
                  createVNode(unref(ScalarErrorBoundary), null, {
                    default: withCtx(() => [
                      _ctx.document ? (openBlock(), createBlock(unref(IntroductionCardItem), {
                        key: 0,
                        class: "scalar-reference-intro-auth scalar-client introduction-card-item leading-normal"
                      }, {
                        default: withCtx(() => [
                          Object.keys(_ctx.document?.components?.securitySchemes ?? {}).length ? (openBlock(), createBlock(unref(AuthSelector), {
                            key: 0,
                            layout: "reference",
                            persistAuth: _ctx.options.persistAuth,
                            server: _ctx.activeServer,
                            title: "Authentication"
                          }, null, 8, ["persistAuth", "server"])) : createCommentVNode("", true)
                        ]),
                        _: 1
                      })) : createCommentVNode("", true)
                    ]),
                    _: 1
                  }),
                  createVNode(unref(ScalarErrorBoundary), null, {
                    default: withCtx(() => [
                      clientOptions.value.length ? (openBlock(), createBlock(unref(IntroductionCardItem), {
                        key: 0,
                        class: "introduction-card-item scalar-reference-intro-clients"
                      }, {
                        default: withCtx(() => [
                          createVNode(unref(ClientSelector), {
                            class: "introduction-card-item scalar-reference-intro-clients",
                            clientOptions: clientOptions.value,
                            xScalarSdkInstallation: _ctx.document?.info?.["x-scalar-sdk-installation"],
                            xSelectedClient: _ctx.xScalarDefaultClient
                          }, null, 8, ["clientOptions", "xScalarSdkInstallation", "xSelectedClient"])
                        ]),
                        _: 1
                      })) : createCommentVNode("", true)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["id", "documentExtensions", "eventBus", "externalDocs", "info", "infoExtensions", "layout", "oasVersion", "options"])
            ]),
            _: 3
          }, 8, ["id"]),
          _ctx.items.length ? (openBlock(), createBlock(_sfc_main$4, {
            key: 0,
            activeServer: _ctx.activeServer,
            entries: _ctx.items,
            eventBus: _ctx.eventBus,
            expandedItems: _ctx.expandedItems,
            getSecuritySchemes: _ctx.getSecuritySchemes,
            options: {
              layout: _ctx.options.layout ?? "modern",
              showOperationId: _ctx.options.showOperationId,
              hideTestRequestButton: _ctx.options.hideTestRequestButton,
              expandAllResponses: _ctx.options.expandAllResponses,
              clientOptions: clientOptions.value,
              orderRequiredPropertiesFirst: _ctx.options.orderRequiredPropertiesFirst,
              orderSchemaPropertiesBy: _ctx.options.orderSchemaPropertiesBy,
              expandAllModelSections: _ctx.options.expandAllModelSections
            },
            paths: _ctx.document?.paths ?? {},
            schemas: _ctx.document?.components?.schemas ?? {},
            security: _ctx.document?.security,
            webhooks: _ctx.document?.webhooks ?? {},
            xScalarDefaultClient: _ctx.xScalarDefaultClient
          }, null, 8, ["activeServer", "entries", "eventBus", "expandedItems", "getSecuritySchemes", "options", "paths", "schemas", "security", "webhooks", "xScalarDefaultClient"])) : createCommentVNode("", true),
          createVNode(unref(_sfc_main$5), {
            options: _ctx.options,
            viewName: "content.end"
          }, null, 8, ["options"]),
          renderSlot(_ctx.$slots, "end"),
          !unref(firstLazyLoadComplete) ? (openBlock(), createElementBlock("div", _hoisted_2)) : createCommentVNode("", true)
        ])
      ], 64);
    };
  }
});
export {
  _sfc_main as default
};
