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 { mergeAuthConfig } from "@scalar/api-client/v2/blocks/scalar-auth-selector-block";
import { getSelectedServer } from "@scalar/api-client/v2/features/operation";
import { ScalarErrorBoundary } from "@scalar/components";
import _sfc_main$5 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 _sfc_main$4 from "./Auth/Auth.vue.js";
import ClientSelector from "../../blocks/scalar-client-selector-block/components/ClientSelector.vue.js";
import _sfc_main$6 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: {
    infoSectionId: {},
    options: {},
    document: {},
    httpClients: {},
    xScalarDefaultClient: {},
    items: {},
    expandedItems: {},
    eventBus: {},
    environment: {},
    headingSlugGenerator: { type: Function }
  },
  setup(__props) {
    const clientOptions = computed(() => generateClientOptions(__props.httpClients));
    const documentExtensions = computed(() => getXKeysFromObject(__props.document));
    const infoExtensions = computed(() => getXKeysFromObject(__props.document?.info));
    const selectedServer = computed(() => getSelectedServer(__props.document ?? null));
    const securitySchemes = computed(
      () => mergeAuthConfig(
        __props.document?.components?.securitySchemes,
        __props.options.authentication?.securitySchemes
      )
    );
    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,
                documentDownloadType: _ctx.options.documentDownloadType,
                documentExtensions: documentExtensions.value,
                eventBus: _ctx.eventBus,
                externalDocs: _ctx.document?.externalDocs,
                headingSlugGenerator: _ctx.headingSlugGenerator,
                info: _ctx.document?.info,
                infoExtensions: infoExtensions.value,
                layout: _ctx.options.layout,
                oasVersion: _ctx.document?.["x-original-oas-version"]
              }, {
                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), {
                            eventBus: _ctx.eventBus,
                            selectedServer: selectedServer.value,
                            servers: _ctx.document?.servers ?? []
                          }, null, 8, ["eventBus", "selectedServer", "servers"])
                        ]),
                        _: 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(() => [
                          createVNode(unref(_sfc_main$4), {
                            document: _ctx.document,
                            environment: _ctx.environment,
                            eventBus: _ctx.eventBus,
                            options: _ctx.options,
                            securitySchemes: securitySchemes.value,
                            selectedServer: selectedServer.value
                          }, null, 8, ["document", "environment", "eventBus", "options", "securitySchemes", "selectedServer"])
                        ]),
                        _: 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,
                            eventBus: _ctx.eventBus,
                            selectedClient: _ctx.xScalarDefaultClient,
                            xScalarSdkInstallation: _ctx.document?.info?.["x-scalar-sdk-installation"]
                          }, null, 8, ["clientOptions", "eventBus", "selectedClient", "xScalarSdkInstallation"])
                        ]),
                        _: 1
                      })) : createCommentVNode("", true)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["id", "documentDownloadType", "documentExtensions", "eventBus", "externalDocs", "headingSlugGenerator", "info", "infoExtensions", "layout", "oasVersion"])
            ]),
            _: 3
          }, 8, ["id"]),
          _ctx.items.length && _ctx.document ? (openBlock(), createBlock(_sfc_main$5, {
            key: 0,
            clientOptions: clientOptions.value,
            document: _ctx.document,
            entries: _ctx.items,
            eventBus: _ctx.eventBus,
            expandedItems: _ctx.expandedItems,
            options: _ctx.options,
            securitySchemes: securitySchemes.value,
            selectedClient: _ctx.xScalarDefaultClient,
            selectedServer: selectedServer.value
          }, null, 8, ["clientOptions", "document", "entries", "eventBus", "expandedItems", "options", "securitySchemes", "selectedClient", "selectedServer"])) : createCommentVNode("", true),
          createVNode(unref(_sfc_main$6), {
            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
};
