import { defineComponent as F, openBlock as r, createElementBlock as i, normalizeClass as O, renderSlot as V, Fragment as d, createTextVNode as a, createCommentVNode as u, toDisplayString as n, createVNode as s, unref as y, withCtx as t, createBlock as m } from "vue";
import { discriminators as z } from "./helpers/optimizeValueForDisplay.js";
import H from "./SchemaPropertyExamples.vue.js";
import v from "../../ScreenReader.vue.js";
import o from "./SchemaPropertyDetail.vue.js";
import $ from "../../Badge/Badge.vue.js";
const R = { class: "property-heading" }, G = {
  key: 1,
  class: "property-additional"
}, J = {
  key: 2,
  class: "property-pattern"
}, K = {
  key: 3,
  class: "property-deprecated"
}, Q = {
  key: 4,
  class: "property-const"
}, U = {
  key: 7,
  class: "property-write-only"
}, W = {
  key: 8,
  class: "property-read-only"
}, X = {
  key: 9,
  class: "property-required"
}, ee = /* @__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 }
  },
  setup(j) {
    const p = j, D = z.find((e) => !p.value || typeof p.value != "object" ? !1 : e in p.value || p.value.items && typeof p.value.items == "object" && e in p.value.items), T = (e) => Array.isArray(e == null ? void 0 : e.default) && e.default.length === 1 ? e.default[0] : e == null ? void 0 : e.default;
    return (e, l) => {
      var f, k, g, B, b, q, w, P, S, I, N, A, C;
      return r(), i("div", R, [
        e.$slots.name ? (r(), i("div", {
          key: 0,
          class: O(["property-name", { deprecated: (f = e.value) == null ? void 0 : f.deprecated }])
        }, [
          e.pattern ? (r(), i(d, { key: 1 }, [
            l[0] || (l[0] = a("/")),
            V(e.$slots, "name", {}, void 0, !0),
            l[1] || (l[1] = a("/"))
          ], 64)) : V(e.$slots, "name", { key: 0 }, void 0, !0)
        ], 2)) : u("", !0),
        e.additional ? (r(), i("div", G, [
          (k = e.value) != null && k["x-additionalPropertiesName"] ? (r(), i(d, { key: 0 }, [
            a(n(e.value["x-additionalPropertiesName"]), 1)
          ], 64)) : (r(), i(d, { key: 1 }, [
            a("additional properties")
          ], 64))
        ])) : u("", !0),
        e.pattern ? (r(), i("div", J, [
          s(y($), null, {
            default: t(() => l[2] || (l[2] = [
              a("pattern")
            ])),
            _: 1
          })
        ])) : u("", !0),
        (g = e.value) != null && g.deprecated ? (r(), i("div", K, [
          s(y($), null, {
            default: t(() => l[3] || (l[3] = [
              a("deprecated")
            ])),
            _: 1
          })
        ])) : u("", !0),
        (B = e.value) != null && B.const || (b = e.value) != null && b.enum && e.value.enum.length === 1 ? (r(), i("div", Q, [
          s(o, { truncate: "" }, {
            prefix: t(() => l[4] || (l[4] = [
              a("const:")
            ])),
            default: t(() => [
              a(" " + n(e.value.const ?? e.value.enum[0]), 1)
            ]),
            _: 1
          })
        ])) : (q = e.value) != null && q.type ? (r(), i(d, { key: 5 }, [
          s(o, null, {
            default: t(() => {
              var E, L, M;
              return [
                s(v, null, {
                  default: t(() => l[5] || (l[5] = [
                    a("Type:")
                  ])),
                  _: 1
                }),
                (L = (E = e.value) == null ? void 0 : E.items) != null && L.type ? (r(), i(d, { key: 0 }, [
                  a(n(e.value.type) + " " + n(e.value.items.type) + "[] ", 1)
                ], 64)) : (r(), i(d, { key: 1 }, [
                  a(n(Array.isArray(e.value.type) ? e.value.type.join(" | ") : e.value.type) + " " + n((M = e.value) != null && M.nullable ? " | nullable" : ""), 1)
                ], 64)),
                e.value.minItems || e.value.maxItems ? (r(), i(d, { key: 2 }, [
                  a(n(e.value.minItems) + "…" + n(e.value.maxItems), 1)
                ], 64)) : u("", !0)
              ];
            }),
            _: 1
          }),
          e.value.minLength ? (r(), m(o, { key: 0 }, {
            prefix: t(() => l[6] || (l[6] = [
              a("min:")
            ])),
            default: t(() => [
              a(" " + n(e.value.minLength), 1)
            ]),
            _: 1
          })) : u("", !0),
          e.value.maxLength ? (r(), m(o, { key: 1 }, {
            prefix: t(() => l[7] || (l[7] = [
              a("max:")
            ])),
            default: t(() => [
              a(" " + n(e.value.maxLength), 1)
            ]),
            _: 1
          })) : u("", !0),
          e.value.uniqueItems ? (r(), m(o, { key: 2 }, {
            default: t(() => l[8] || (l[8] = [
              a(" unique! ")
            ])),
            _: 1
          })) : u("", !0),
          e.value.format ? (r(), m(o, { key: 3 }, {
            default: t(() => [
              s(v, null, {
                default: t(() => l[9] || (l[9] = [
                  a("Format:")
                ])),
                _: 1
              }),
              a(" " + n(e.value.format), 1)
            ]),
            _: 1
          })) : u("", !0),
          e.value.minimum !== void 0 && e.value.exclusiveMinimum ? (r(), m(o, { key: 4 }, {
            prefix: t(() => l[10] || (l[10] = [
              a("greater than:")
            ])),
            default: t(() => [
              a(" " + n(e.value.minimum), 1)
            ]),
            _: 1
          })) : u("", !0),
          e.value.minimum !== void 0 && !e.value.exclusiveMinimum ? (r(), m(o, { key: 5 }, {
            prefix: t(() => l[11] || (l[11] = [
              a("min:")
            ])),
            default: t(() => [
              a(" " + n(e.value.minimum), 1)
            ]),
            _: 1
          })) : u("", !0),
          e.value.maximum !== void 0 && e.value.exclusiveMaximum ? (r(), m(o, { key: 6 }, {
            prefix: t(() => l[12] || (l[12] = [
              a("less than:")
            ])),
            default: t(() => [
              a(" " + n(e.value.maximum), 1)
            ]),
            _: 1
          })) : u("", !0),
          e.value.maximum !== void 0 && !e.value.exclusiveMaximum ? (r(), m(o, { key: 7 }, {
            prefix: t(() => l[13] || (l[13] = [
              a("max:")
            ])),
            default: t(() => [
              a(" " + n(e.value.maximum), 1)
            ]),
            _: 1
          })) : u("", !0),
          e.value.pattern ? (r(), m(o, {
            key: 8,
            code: "",
            truncate: ""
          }, {
            default: t(() => [
              s(v, null, {
                default: t(() => l[14] || (l[14] = [
                  a("Pattern:")
                ])),
                _: 1
              }),
              a(" " + n(e.value.pattern), 1)
            ]),
            _: 1
          })) : u("", !0),
          e.$props.enum ? (r(), m(o, { key: 9 }, {
            default: t(() => l[15] || (l[15] = [
              a("enum")
            ])),
            _: 1
          })) : u("", !0),
          e.value.default !== void 0 ? (r(), m(o, {
            key: 10,
            truncate: ""
          }, {
            prefix: t(() => l[16] || (l[16] = [
              a("default:")
            ])),
            default: t(() => [
              a(" " + n(T(e.value)), 1)
            ]),
            _: 1
          })) : u("", !0)
        ], 64)) : (r(), i(d, { key: 6 }, [
          ((w = e.value) == null ? void 0 : w.nullable) === !0 ? (r(), m(o, { key: 0 }, {
            default: t(() => l[17] || (l[17] = [
              a(" nullable ")
            ])),
            _: 1
          })) : u("", !0)
        ], 64)),
        (P = e.value) != null && P.writeOnly ? (r(), i("div", U, " write-only ")) : (S = e.value) != null && S.readOnly ? (r(), i("div", W, " read-only ")) : u("", !0),
        e.required ? (r(), i("div", X, " required ")) : u("", !0),
        e.withExamples ? (r(), m(H, {
          key: 10,
          examples: (I = e.value) == null ? void 0 : I.examples,
          example: ((N = e.value) == null ? void 0 : N.example) || ((C = (A = e.value) == null ? void 0 : A.items) == null ? void 0 : C.example),
          "discriminator-type": y(D)
        }, null, 8, ["examples", "example", "discriminator-type"])) : u("", !0)
      ]);
    };
  }
});
export {
  ee as default
};
