import { defineComponent as f, computed as m, ref as h, watch as v, createElementBlock as i, openBlock as p, createElementVNode as o, createVNode as s, unref as x, mergeProps as y } from "vue";
import { isHttpMethod as _ } from "@scalar/helpers/http/is-http-method";
import { getResolvedRef as g } from "@scalar/workspace-store/helpers/get-resolved-ref";
import { RouterView as w } from "vue-router";
import k from "./components/LabelInput.vue.js";
import b from "./components/Tabs.vue.js";
const B = {
  key: 0,
  class: "custom-scroll h-full"
}, S = { class: "w-full px-3 md:mx-auto md:max-w-180" }, V = ["aria-label"], R = { class: "group relative ml-1.25" }, T = { class: "px-1.5 py-8" }, U = {
  key: 1,
  class: "flex w-full flex-1 items-center justify-center"
}, $ = {}, I = /* @__PURE__ */ f({
  ...$,
  __name: "OperationCollection",
  props: {
    documentSlug: {},
    document: {},
    eventBus: {},
    layout: {},
    path: {},
    method: {},
    exampleName: {},
    environment: {},
    securitySchemes: {},
    workspaceStore: {},
    activeWorkspace: {},
    plugins: {},
    customThemes: {},
    currentTheme: {},
    isDarkMode: { type: Boolean },
    fetchRegistryDocument: { type: Function }
  },
  setup(u) {
    const e = u, n = m(() => {
      if (!(!e.path || !e.method))
        return g(e.document?.paths?.[e.path]?.[e.method]);
    }), l = h(n.value?.summary ?? "");
    v(
      () => n.value?.summary,
      (r) => {
        l.value = r ?? "";
      }
    );
    const c = (r) => {
      const { path: t, method: a } = e;
      !t || !a || !_(a) || e.eventBus.emit("operation:update:meta", {
        meta: { path: t, method: a },
        payload: {
          summary: r.trim()
        }
      });
    }, d = m(() => !e.path || !e.method ? "Untitled Operation" : `${e.method.toUpperCase()} ${e.path}`);
    return (r, t) => n.value !== void 0 ? (p(), i("div", B, [
      o("div", S, [
        o("div", {
          "aria-label": `title: ${l.value}`,
          class: "mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-8"
        }, [
          o("div", R, [
            s(k, {
              modelValue: l.value,
              "onUpdate:modelValue": t[0] || (t[0] = (a) => l.value = a),
              class: "text-xl font-bold",
              inputId: "operationSummary",
              placeholder: d.value,
              onBlur: c
            }, null, 8, ["modelValue", "placeholder"])
          ])
        ], 8, V),
        s(b, { type: "operation" }),
        o("div", T, [
          s(x(w), y(e, { collectionType: "operation" }), null, 16)
        ])
      ])
    ])) : (p(), i("div", U, [...t[1] || (t[1] = [
      o("div", { class: "flex h-full flex-col items-center justify-center" }, [
        o("h1", { class: "text-2xl font-bold" }, "Operation not found"),
        o("p", { class: "text-gray-500" }, " The operation you are looking for does not exist. ")
      ], -1)
    ])]));
  }
});
export {
  I as default
};
