import { defineComponent as u, computed as y, createElementBlock as k, openBlock as r, createBlock as i, createCommentVNode as a, createElementVNode as s, unref as o, withCtx as l, createTextVNode as C, toDisplayString as p, withModifiers as g, createVNode as S, normalizeStyle as V, normalizeClass as b } from "vue";
import { getHttpMethodInfo as v } from "@scalar/helpers/http/http-info";
import { ScalarIconWebhooksLogo as B } from "@scalar/icons";
import { isOperationDeprecated as H } from "@scalar/oas-utils/helpers";
import { useSidebar as N } from "../../features/sidebar/hooks/useSidebar.js";
import O from "../Section/SectionHeaderTag.vue.js";
import T from "../HttpMethod/HttpMethod.vue.js";
const w = ["href"], j = /* @__PURE__ */ u({
  __name: "OperationsListItem",
  props: {
    operation: {},
    isCollapsed: { type: Boolean }
  },
  setup(t) {
    const { scrollToOperation: d } = N(), m = async (e) => {
      d(e.id, !0);
    }, c = y(() => "path" in t.operation ? t.operation.path : t.operation.title), f = (e) => "operation" in e && H(
      e.operation
    ), h = (e) => "webhook" in e;
    return (e, n) => (r(), k("li", {
      key: e.operation.id,
      class: "contents"
    }, [
      e.isCollapsed ? (r(), i(o(O), {
        key: 0,
        class: "sr-only",
        level: 3
      }, {
        default: l(() => [
          C(p(e.operation.title) + " (Hidden) ", 1)
        ]),
        _: 1
      })) : a("", !0),
      s("a", {
        class: "endpoint",
        href: `#${e.operation.id}`,
        onClick: n[0] || (n[0] = g((z) => m(e.operation), ["prevent"]))
      }, [
        S(o(T), {
          class: "endpoint-method items-center justify-end gap-2",
          method: e.operation.method
        }, {
          default: l(() => [
            h(e.operation) ? (r(), i(o(B), {
              key: 0,
              style: V({
                color: o(v)(e.operation.method).colorVar
              }),
              class: "size-3.5"
            }, null, 8, ["style"])) : a("", !0)
          ]),
          _: 1
        }, 8, ["method"]),
        s("span", {
          class: b(["endpoint-path", { deprecated: f(e.operation) }])
        }, p(c.value), 3)
      ], 8, w)
    ]));
  }
});
export {
  j as default
};
