import { defineComponent as D, openBlock as s, createElementBlock as t, createVNode as O, unref as o, createBlock as l, createCommentVNode as p, Fragment as c, renderList as E, createElementVNode as N, toDisplayString as J } from "vue";
import { ScalarCodeBlock as r } from "@scalar/components";
import { prettyPrintJson as C } from "@scalar/oas-utils/helpers";
import { getExampleFromSchema as m } from "@scalar/oas-utils/spec-getters";
const L = { key: 0 }, P = { key: 1 }, R = {
  key: 0,
  class: "rule"
}, q = { class: "rule-title" }, w = { class: "rule-items" }, z = {
  key: 2,
  class: "empty-state"
}, Q = /* @__PURE__ */ D({
  __name: "ExampleResponse",
  props: {
    response: {}
  },
  setup(G) {
    const V = ["oneOf", "anyOf", "not"], F = (e) => e.reduce((i, a) => ({
      ...i,
      ...a
    }), {});
    return (e, i) => {
      var a, d, h, y, u, g, k;
      return (a = e.response) != null && a.example ? (s(), t("div", L, [
        O(o(r), {
          content: o(C)((d = e.response) == null ? void 0 : d.example),
          lang: "json"
        }, null, 8, ["content"])
      ])) : (h = e.response) != null && h.schema ? (s(), t("div", P, [
        (y = e.response) != null && y.schema.type ? (s(), l(o(r), {
          key: 0,
          content: o(C)(
            o(m)((u = e.response) == null ? void 0 : u.schema, {
              emptyString: "…",
              mode: "read"
            })
          ),
          lang: "json"
        }, null, 8, ["content"])) : p("", !0),
        (s(), t(c, null, E(V, (n) => {
          var f, S, _, j, v, B;
          return s(), t(c, { key: n }, [
            (f = e.response) != null && f.schema[n] && (((S = e.response) == null ? void 0 : S.schema[n].length) > 1 || n === "not") ? (s(), t("div", R, [
              N("div", q, J(n), 1),
              N("ol", w, [
                (s(!0), t(c, null, E((_ = e.response) == null ? void 0 : _.schema[n], (b, A) => (s(), t("li", {
                  key: A,
                  class: "rule-item"
                }, [
                  O(o(r), {
                    content: o(m)(b, {
                      emptyString: "…",
                      mode: "read"
                    }),
                    lang: "json"
                  }, null, 8, ["content"])
                ]))), 128))
              ])
            ])) : (j = e.response) != null && j.schema[n] && ((v = e.response) == null ? void 0 : v.schema[n].length) === 1 ? (s(), l(o(r), {
              key: 1,
              content: o(m)((B = e.response) == null ? void 0 : B.schema[n][0], {
                emptyString: "…",
                mode: "read"
              }),
              lang: "json"
            }, null, 8, ["content"])) : p("", !0)
          ], 64);
        }), 64)),
        (g = e.response) != null && g.schema.allOf ? (s(), l(o(r), {
          key: 1,
          content: F(
            (k = e.response) == null ? void 0 : k.schema.allOf.map(
              (n) => o(m)(n, {
                emptyString: "…",
                mode: "read"
              })
            )
          ),
          lang: "json"
        }, null, 8, ["content"])) : p("", !0)
      ])) : (s(), t("div", z, " No Body "));
    };
  }
});
export {
  Q as default
};
