import { defineComponent as V, computed as S, createElementBlock as d, openBlock as a, Fragment as l, createCommentVNode as c, createBlock as p, renderList as g } from "vue";
import h from "./SchemaProperty.vue.js";
const B = /* @__PURE__ */ V({
  __name: "SchemaObjectProperties",
  props: {
    schema: { type: [Object, Boolean] },
    compact: { type: Boolean },
    hideHeading: { type: Boolean },
    level: {},
    hideModelNames: { type: Boolean },
    schemas: {},
    discriminator: {},
    discriminatorMapping: {},
    discriminatorPropertyName: {},
    orderSchemaPropertiesBy: { default: "alpha" },
    orderRequiredPropertiesFirst: { default: !0 },
    hasDiscriminator: { type: Boolean },
    breadcrumb: {}
  },
  emits: ["update:modelValue"],
  setup(i, { emit: v }) {
    const P = v, f = S(() => {
      if (!i.schema.properties)
        return [];
      const e = Object.keys(i.schema.properties), t = new Set(i.schema.required || []);
      return e.sort((r, m) => {
        const o = t.has(r), s = t.has(m);
        if (i.orderRequiredPropertiesFirst) {
          if (o && !s)
            return -1;
          if (!o && s)
            return 1;
        }
        return i.orderSchemaPropertiesBy === "alpha" ? r.localeCompare(m) : 0;
      });
    }), n = (e) => {
      P("update:modelValue", e);
    }, M = (e) => typeof e == "object" && typeof e["x-additionalPropertiesName"] == "string" && e["x-additionalPropertiesName"].trim().length > 0 ? `${e["x-additionalPropertiesName"].trim()}*` : "propertyName*", u = (e) => e === !0 || typeof e == "object" && Object.keys(e).length === 0 || typeof e != "object" || !("type" in e) ? {
      type: "anything",
      ...typeof e == "object" ? e : {}
    } : e;
    return (e, t) => (a(), d(l, null, [
      e.schema.properties ? (a(!0), d(l, { key: 0 }, g(f.value, (r) => {
        var m, o, s, N, b, y;
        return a(), p(h, {
          key: r,
          breadcrumb: e.breadcrumb,
          compact: e.compact,
          discriminatorMapping: ((m = e.schema.discriminator) == null ? void 0 : m.mapping) || e.discriminatorMapping,
          discriminatorPropertyName: ((o = e.schema.discriminator) == null ? void 0 : o.propertyName) || e.discriminatorPropertyName,
          hideHeading: e.hideHeading,
          hideModelNames: e.hideModelNames,
          isDiscriminator: r === (((s = e.schema.discriminator) == null ? void 0 : s.propertyName) || e.discriminatorPropertyName),
          level: e.level,
          modelValue: e.discriminator,
          name: r,
          required: ((N = e.schema.required) == null ? void 0 : N.includes(r)) || ((b = e.schema.properties[r]) == null ? void 0 : b.required) === !0,
          resolvedSchema: e.schema.properties[r],
          schemas: e.schemas,
          value: {
            ...e.schema.properties[r],
            parent: e.schema,
            isDiscriminator: r === e.discriminatorPropertyName || ((y = e.schema.discriminator) == null ? void 0 : y.propertyName) === r
          },
          "onUpdate:modelValue": n
        }, null, 8, ["breadcrumb", "compact", "discriminatorMapping", "discriminatorPropertyName", "hideHeading", "hideModelNames", "isDiscriminator", "level", "modelValue", "name", "required", "resolvedSchema", "schemas", "value"]);
      }), 128)) : c("", !0),
      e.schema.patternProperties ? (a(!0), d(l, { key: 1 }, g(Object.keys(e.schema.patternProperties), (r) => (a(), p(h, {
        key: r,
        breadcrumb: e.breadcrumb,
        compact: e.compact,
        discriminatorMapping: e.discriminatorMapping,
        discriminatorPropertyName: e.discriminatorPropertyName,
        hideHeading: e.hideHeading,
        hideModelNames: e.hideModelNames,
        isDiscriminator: !1,
        level: e.level,
        modelValue: e.discriminator,
        name: r,
        resolvedSchema: e.schema.patternProperties[r],
        schemas: e.schemas,
        value: {
          ...e.schema.patternProperties[r]
        },
        variant: "patternProperties",
        "onUpdate:modelValue": n
      }, null, 8, ["breadcrumb", "compact", "discriminatorMapping", "discriminatorPropertyName", "hideHeading", "hideModelNames", "level", "modelValue", "name", "resolvedSchema", "schemas", "value"]))), 128)) : c("", !0),
      e.schema.additionalProperties ? (a(), p(h, {
        key: 2,
        breadcrumb: e.breadcrumb,
        compact: e.compact,
        discriminatorMapping: e.discriminatorMapping,
        discriminatorPropertyName: e.discriminatorPropertyName,
        hideHeading: e.hideHeading,
        hideModelNames: e.hideModelNames,
        isDiscriminator: !1,
        level: e.level,
        modelValue: e.discriminator,
        name: M(e.schema.additionalProperties),
        noncollapsible: "",
        resolvedSchema: u(e.schema.additionalProperties),
        schemas: e.schemas,
        value: u(e.schema.additionalProperties),
        variant: "additionalProperties",
        "onUpdate:modelValue": n
      }, null, 8, ["breadcrumb", "compact", "discriminatorMapping", "discriminatorPropertyName", "hideHeading", "hideModelNames", "level", "modelValue", "name", "resolvedSchema", "schemas", "value"])) : c("", !0)
    ], 64));
  }
});
export {
  B as default
};
