import { defineComponent as c, computed as m, unref as n, openBlock as a, createElementBlock as d, Fragment as p, createBlock as l, createCommentVNode as u } from "vue";
import { useWorkspace as f } from "@scalar/api-client/store";
import { getPointer as v } from "../../blocks/helpers/getPointer.js";
import { useBlockProps as h } from "../../blocks/hooks/useBlockProps.js";
import O from "./layouts/ClassicLayout.vue.js";
import k from "./layouts/ModernLayout.vue.js";
const P = /* @__PURE__ */ c({
  __name: "Operation",
  props: {
    id: {},
    layout: { default: "modern" },
    transformedOperation: {},
    collection: {},
    server: {},
    schemas: {}
  },
  setup(o) {
    const i = f(), { operation: r } = h({
      store: i,
      collection: o.collection,
      location: v([
        "paths",
        o.transformedOperation.path,
        o.transformedOperation.httpVerb.toLowerCase()
      ])
    }), s = m(() => {
      var e;
      if (!r.value)
        return o.server;
      if ((e = r.value) != null && e.selectedServerUid) {
        const t = i.servers[r.value.selectedServerUid];
        if (t)
          return t;
      }
      return o.server;
    });
    return (e, t) => e.collection && n(r) ? (a(), d(p, { key: 0 }, [
      e.layout === "classic" ? (a(), l(O, {
        key: 0,
        id: e.id,
        collection: e.collection,
        operation: n(r),
        schemas: e.schemas,
        server: s.value,
        transformedOperation: e.transformedOperation
      }, null, 8, ["id", "collection", "operation", "schemas", "server", "transformedOperation"])) : (a(), l(k, {
        key: 1,
        id: e.id,
        collection: e.collection,
        operation: n(r),
        schemas: e.schemas,
        server: s.value,
        transformedOperation: e.transformedOperation
      }, null, 8, ["id", "collection", "operation", "schemas", "server", "transformedOperation"]))
    ], 64)) : u("", !0);
  }
});
export {
  P as default
};
