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