import { defineComponent, computed, createElementBlock, createCommentVNode, openBlock, createElementVNode, createBlock, unref, Fragment, createTextVNode, toDisplayString } from "vue";
import { ScalarWrappingText } from "@scalar/components";
import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
import { isTypeObject } from "./helpers/is-type-object.js";
const _hoisted_1 = {
  key: 0,
  class: "schema-type"
};
const _hoisted_2 = ["title"];
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "SchemaHeading",
  props: {
    value: {},
    name: {}
  },
  setup(__props) {
    const failsafeType = computed(() => {
      if ("type" in __props.value) {
        return __props.value.type;
      }
      if (__props.value.enum) {
        return "enum";
      }
      if (isArraySchema(__props.value) && __props.value.items) {
        return "array";
      }
      if (isTypeObject(__props.value) && (__props.value.properties || __props.value.additionalProperties)) {
        return "object";
      }
      return "unknown";
    });
    return (_ctx, _cache) => {
      return typeof _ctx.value === "object" ? (openBlock(), createElementBlock("span", _hoisted_1, [
        createElementVNode("span", {
          class: "schema-type-icon",
          title: "type" in _ctx.value && typeof _ctx.value.type === "string" ? _ctx.value.type : "type" in _ctx.value && Array.isArray(_ctx.value.type) ? _ctx.value.type.join(" | ") : "unknown type"
        }, [
          unref(isTypeObject)(_ctx.value) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
            createTextVNode(" {} ")
          ], 64)) : createCommentVNode("", true),
          unref(isArraySchema)(_ctx.value) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
            createTextVNode(" [] ")
          ], 64)) : createCommentVNode("", true),
          _ctx.value.enum ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
            createTextVNode(" enum ")
          ], 64)) : createCommentVNode("", true)
        ], 8, _hoisted_2),
        _ctx.name ? (openBlock(), createBlock(unref(ScalarWrappingText), {
          key: 0,
          text: _ctx.name,
          preset: "property"
        }, null, 8, ["text"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
          createTextVNode(toDisplayString(failsafeType.value), 1)
        ], 64))
      ])) : createCommentVNode("", true);
    };
  }
});
export {
  _sfc_main as default
};
