import { defineComponent as F, computed as B, createElementBlock as n, openBlock as u, createCommentVNode as i, createBlock as d, normalizeClass as j, renderSlot as A, Fragment as k, createTextVNode as l, withCtx as a, createVNode as g, toDisplayString as m, unref as v } from "vue";
import { isDefined as p } from "@scalar/helpers/array/is-defined";
import z from "./SchemaPropertyExamples.vue.js";
import S from "../../ScreenReader.vue.js";
import { getDiscriminatorSchemaName as H } from "../../../hooks/useDiscriminator.js";
import { getModelName as J } from "./helpers/schema-name.js";
import o from "./SchemaPropertyDetail.vue.js";
import C from "../../Badge/Badge.vue.js";
const R = { class: "property-heading" }, G = {
  key: 1,
  class: "property-discriminator"
}, K = {
  key: 3,
  class: "property-additional"
}, Q = {
  key: 4,
  class: "property-pattern"
}, U = {
  key: 5,
  class: "property-deprecated"
}, W = {
  key: 6,
  class: "property-const"
}, X = {
  key: 8,
  class: "property-write-only"
}, Y = {
  key: 9,
  class: "property-read-only"
}, Z = {
  key: 10,
  class: "property-required"
}, ae = /* @__PURE__ */ F({
  __name: "SchemaPropertyHeading",
  props: {
    value: {},
    enum: { type: Boolean },
    required: { type: Boolean, default: !1 },
    additional: { type: Boolean },
    pattern: { type: Boolean },
    withExamples: { type: Boolean, default: !0 },
    hideModelNames: { type: Boolean, default: !1 },
    schemas: {}
  },
  setup(r) {
    const L = (e) => (e == null ? void 0 : e.default) === null ? "null" : Array.isArray(e == null ? void 0 : e.default) && e.default.length === 1 ? e.default[0] : typeof (e == null ? void 0 : e.default) == "string" ? JSON.stringify(e.default) : e == null ? void 0 : e.default, D = B(() => {
      var e, t, s, f, y, N;
      if (p((e = r.value) == null ? void 0 : e.const))
        return (t = r.value) == null ? void 0 : t.const;
      if (((f = (s = r.value) == null ? void 0 : s.enum) == null ? void 0 : f.length) === 1)
        return r.value.enum[0];
      if ((y = r.value) != null && y.items) {
        if (p(r.value.items.const))
          return r.value.items.const;
        if (((N = r.value.items.enum) == null ? void 0 : N.length) === 1)
          return r.value.items.enum[0];
      }
      return null;
    }), T = B(() => {
      var e, t, s, f, y;
      return Array.isArray((e = r.value) == null ? void 0 : e.type) ? r.value.type.join(" | ") : (t = r.value) != null && t.title ? r.value.title : (s = r.value) != null && s.name ? r.value.name : (f = r.value) != null && f.type && r.value.contentEncoding ? `${r.value.type} • ${r.value.contentEncoding}` : ((y = r.value) == null ? void 0 : y.type) ?? "";
    }), M = B(() => r.value ? J(
      r.value,
      r.schemas,
      r.hideModelNames,
      H
    ) : null);
    return (e, t) => {
      var s, f, y, N, q, w, E, P, $, I, O, V;
      return u(), n("div", R, [
        e.$slots.name ? (u(), n("div", {
          key: 0,
          class: j(["property-name", { deprecated: (s = e.value) == null ? void 0 : s.deprecated }])
        }, [
          e.pattern ? (u(), n(k, { key: 1 }, [
            t[0] || (t[0] = l("/")),
            A(e.$slots, "name", {}, void 0, !0),
            t[1] || (t[1] = l("/"))
          ], 64)) : A(e.$slots, "name", { key: 0 }, void 0, !0)
        ], 2)) : i("", !0),
        (f = e.value) != null && f.isDiscriminator ? (u(), n("div", G, " Discriminator ")) : i("", !0),
        e.value ? (u(), n(k, { key: 2 }, [
          (y = e.value) != null && y.type ? (u(), d(o, { key: 0 }, {
            default: a(() => {
              var b;
              return [
                g(S, null, {
                  default: a(() => t[2] || (t[2] = [
                    l("Type:")
                  ])),
                  _: 1
                }),
                M.value ? (u(), n(k, { key: 0 }, [
                  l(m(M.value), 1)
                ], 64)) : (u(), n(k, { key: 1 }, [
                  l(m(T.value) + " " + m((b = e.value) != null && b.nullable ? " | nullable" : ""), 1)
                ], 64))
              ];
            }),
            _: 1
          })) : i("", !0),
          e.value.minItems || e.value.maxItems ? (u(), d(o, { key: 1 }, {
            default: a(() => [
              l(m(e.value.minItems) + "…" + m(e.value.maxItems), 1)
            ]),
            _: 1
          })) : i("", !0),
          e.value.minLength ? (u(), d(o, { key: 2 }, {
            prefix: a(() => t[3] || (t[3] = [
              l("min:")
            ])),
            default: a(() => [
              l(" " + m(e.value.minLength), 1)
            ]),
            _: 1
          })) : i("", !0),
          e.value.maxLength ? (u(), d(o, { key: 3 }, {
            prefix: a(() => t[4] || (t[4] = [
              l("max:")
            ])),
            default: a(() => [
              l(" " + m(e.value.maxLength), 1)
            ]),
            _: 1
          })) : i("", !0),
          e.value.uniqueItems ? (u(), d(o, { key: 4 }, {
            default: a(() => t[5] || (t[5] = [
              l(" unique! ")
            ])),
            _: 1
          })) : i("", !0),
          e.value.format ? (u(), d(o, { key: 5 }, {
            default: a(() => [
              g(S, null, {
                default: a(() => t[6] || (t[6] = [
                  l("Format:")
                ])),
                _: 1
              }),
              l(" " + m(e.value.format), 1)
            ]),
            _: 1
          })) : i("", !0),
          v(p)(e.value.minimum) && e.value.exclusiveMinimum ? (u(), d(o, { key: 6 }, {
            prefix: a(() => t[7] || (t[7] = [
              l("greater than:")
            ])),
            default: a(() => [
              l(" " + m(e.value.minimum), 1)
            ]),
            _: 1
          })) : i("", !0),
          v(p)(e.value.minimum) && !e.value.exclusiveMinimum ? (u(), d(o, { key: 7 }, {
            prefix: a(() => t[8] || (t[8] = [
              l("min:")
            ])),
            default: a(() => [
              l(" " + m(e.value.minimum), 1)
            ]),
            _: 1
          })) : i("", !0),
          v(p)(e.value.maximum) && e.value.exclusiveMaximum ? (u(), d(o, { key: 8 }, {
            prefix: a(() => t[9] || (t[9] = [
              l("less than:")
            ])),
            default: a(() => [
              l(" " + m(e.value.maximum), 1)
            ]),
            _: 1
          })) : i("", !0),
          v(p)(e.value.maximum) && !e.value.exclusiveMaximum ? (u(), d(o, { key: 9 }, {
            prefix: a(() => t[10] || (t[10] = [
              l("max:")
            ])),
            default: a(() => [
              l(" " + m(e.value.maximum), 1)
            ]),
            _: 1
          })) : i("", !0),
          v(p)(e.value.multipleOf) ? (u(), d(o, { key: 10 }, {
            prefix: a(() => t[11] || (t[11] = [
              l("multiple of:")
            ])),
            default: a(() => [
              l(" " + m(e.value.multipleOf), 1)
            ]),
            _: 1
          })) : i("", !0),
          e.value.pattern ? (u(), d(o, {
            key: 11,
            code: "",
            truncate: ""
          }, {
            default: a(() => [
              g(S, null, {
                default: a(() => t[12] || (t[12] = [
                  l("Pattern:")
                ])),
                _: 1
              }),
              l(" " + m(e.value.pattern), 1)
            ]),
            _: 1
          })) : i("", !0),
          e.$props.enum ? (u(), d(o, { key: 12 }, {
            default: a(() => t[13] || (t[13] = [
              l("enum")
            ])),
            _: 1
          })) : i("", !0),
          e.value.default !== void 0 ? (u(), d(o, {
            key: 13,
            truncate: ""
          }, {
            prefix: a(() => t[14] || (t[14] = [
              l("default:")
            ])),
            default: a(() => [
              l(" " + m(L(e.value)), 1)
            ]),
            _: 1
          })) : i("", !0)
        ], 64)) : i("", !0),
        e.additional ? (u(), n("div", K, [
          (N = e.value) != null && N["x-additionalPropertiesName"] ? (u(), n(k, { key: 0 }, [
            l(m(e.value["x-additionalPropertiesName"]), 1)
          ], 64)) : (u(), n(k, { key: 1 }, [
            l("additional properties")
          ], 64))
        ])) : i("", !0),
        e.pattern ? (u(), n("div", Q, [
          g(v(C), null, {
            default: a(() => t[15] || (t[15] = [
              l("pattern")
            ])),
            _: 1
          })
        ])) : i("", !0),
        (q = e.value) != null && q.deprecated ? (u(), n("div", U, [
          g(v(C), null, {
            default: a(() => t[16] || (t[16] = [
              l("deprecated")
            ])),
            _: 1
          })
        ])) : i("", !0),
        v(p)(D.value) ? (u(), n("div", W, [
          g(o, { truncate: "" }, {
            prefix: a(() => t[17] || (t[17] = [
              l("const:")
            ])),
            default: a(() => [
              l(" " + m(D.value), 1)
            ]),
            _: 1
          })
        ])) : (u(), n(k, { key: 7 }, [
          ((w = e.value) == null ? void 0 : w.nullable) === !0 ? (u(), d(o, { key: 0 }, {
            default: a(() => t[18] || (t[18] = [
              l(" nullable ")
            ])),
            _: 1
          })) : i("", !0)
        ], 64)),
        (E = e.value) != null && E.writeOnly ? (u(), n("div", X, " write-only ")) : (P = e.value) != null && P.readOnly ? (u(), n("div", Y, " read-only ")) : i("", !0),
        e.required ? (u(), n("div", Z, " required ")) : i("", !0),
        e.withExamples ? (u(), d(z, {
          key: 11,
          examples: ($ = e.value) == null ? void 0 : $.examples,
          example: ((I = e.value) == null ? void 0 : I.example) || ((V = (O = e.value) == null ? void 0 : O.items) == null ? void 0 : V.example)
        }, null, 8, ["examples", "example"])) : i("", !0)
      ]);
    };
  }
});
export {
  ae as default
};
