import { getTag as u } from "./get-tag.js";
const h = (e, s = "Unkown", c, i, t) => {
  const o = i({ name: s }, t), r = "title" in e && typeof e.title == "string" ? e.title : s;
  return c.set(o, r), {
    id: o,
    title: r,
    name: s,
    schema: e
  };
}, p = (e, s, c, i) => {
  var r, g;
  const t = ((r = e.components) == null ? void 0 : r.schemas) ?? {}, o = [];
  for (const n in t)
    t[n]["x-internal"] || t[n]["x-scalar-ignore"] || !Object.hasOwn(t, n) || ((g = t[n]["x-tags"]) != null && g.length ? t[n]["x-tags"].forEach((a) => {
      var f;
      const { tag: l } = u(s, a);
      (f = s.get(a)) == null || f.entries.push(h(t[n], n, c, i, l));
    }) : o.push(h(t[n], n, c, i)));
  return o;
};
export {
  p as traverseSchemas
};
