import { defineComponent as C, computed as B, createBlock as r, openBlock as i, unref as o, createSlots as O, withCtx as s, createElementVNode as a, createCommentVNode as n, createElementBlock as w, createVNode as t, withModifiers as V, toDisplayString as h, normalizeClass as $, createTextVNode as u } from "vue";
import { ScalarErrorBoundary as q, ScalarIconButton as I, ScalarMarkdown as T } from "@scalar/components";
import { ScalarIconPlay as D, ScalarIconCopy as E, ScalarIconWebhooksLogo as L } from "@scalar/icons";
import { isOperationDeprecated as R, getOperationStability as f, getOperationStabilityColor as W } from "@scalar/oas-utils/helpers";
import { useClipboard as z } from "@scalar/use-hooks/useClipboard";
import N from "../../../components/OperationPath.vue.js";
import P from "../components/callbacks/Callbacks.vue.js";
import U from "../components/OperationParameters.vue.js";
import A from "../components/OperationResponses.vue.js";
import M from "../../../components/Section/SectionAccordion.vue.js";
import _ from "../../example-responses/ExampleResponses.vue.js";
import j from "../../../components/LinkList/LinkList.vue.js";
import F from "../../external-docs/ExternalDocs.vue.js";
import G from "../../../v2/blocks/scalar-request-example-block/components/RequestExample.vue.js";
import y from "../../x-badges/XBadges.vue.js";
import H from "../../test-request-button/TestRequestButton.vue.js";
import J from "../../../components/HttpMethod/HttpMethod.vue.js";
import K from "../../../components/Anchor/Anchor.vue.js";
import b from "../../../components/Badge/Badge.vue.js";
const Q = { class: "operation-title" }, X = { class: "operation-details" }, Y = { class: "endpoint-label" }, Z = { class: "endpoint-label-path" }, x = { class: "endpoint-label-name" }, ee = { class: "endpoint-content" }, oe = { class: "operation-details-card" }, te = { class: "operation-details-card-item" }, ae = { class: "operation-details-card-item" }, se = {
  key: 0,
  class: "operation-details-card-item"
}, we = /* @__PURE__ */ C({
  __name: "ClassicLayout",
  props: {
    id: {},
    path: {},
    clientOptions: {},
    method: {},
    config: {},
    operation: {},
    oldOperation: {},
    isWebhook: { type: Boolean },
    server: {},
    securitySchemes: {},
    schemas: {},
    store: {}
  },
  emits: ["update:modelValue"],
  setup(d, { emit: k }) {
    const v = B(() => d.operation.summary || d.path || ""), { copyToClipboard: g } = z(), S = k, m = (e) => {
      S("update:modelValue", e);
    };
    return (e, l) => (i(), r(o(M), {
      id: e.id,
      class: "reference-endpoint",
      transparent: ""
    }, O({
      title: s(() => [
        a("div", Q, [
          a("div", X, [
            t(o(J), {
              class: "endpoint-type",
              method: e.method,
              short: ""
            }, null, 8, ["method"]),
            t(o(K), {
              id: e.id,
              class: "endpoint-anchor"
            }, {
              default: s(() => [
                a("h3", Y, [
                  a("div", Z, [
                    t(N, {
                      deprecated: o(R)(e.operation),
                      path: e.path
                    }, null, 8, ["deprecated", "path"])
                  ]),
                  a("div", x, h(v.value), 1),
                  o(f)(e.operation) ? (i(), r(o(b), {
                    key: 0,
                    class: $(["capitalize", o(W)(e.operation)])
                  }, {
                    default: s(() => [
                      u(h(o(f)(e.operation)), 1)
                    ]),
                    _: 1
                  }, 8, ["class"])) : n("", !0),
                  e.isWebhook ? (i(), r(o(b), {
                    key: 1,
                    class: "font-code text-green flex w-fit items-center justify-center gap-1"
                  }, {
                    default: s(() => [
                      t(o(L), { weight: "bold" }),
                      l[1] || (l[1] = u("Webhook "))
                    ]),
                    _: 1,
                    __: [1]
                  })) : n("", !0),
                  t(o(y), {
                    badges: e.operation["x-badges"],
                    position: "before"
                  }, null, 8, ["badges"])
                ])
              ]),
              _: 1
            }, 8, ["id"])
          ])
        ])
      ]),
      actions: s(({ active: p }) => {
        var c;
        return [
          t(o(y), {
            badges: e.operation["x-badges"],
            position: "after"
          }, null, 8, ["badges"]),
          p && !e.isWebhook ? (i(), r(o(H), {
            key: 0,
            method: e.method,
            path: e.path
          }, null, 8, ["method", "path"])) : (c = e.config) != null && c.hideTestRequestButton ? n("", !0) : (i(), r(o(D), {
            key: 1,
            class: "endpoint-try-hint size-4.5"
          })),
          t(o(I), {
            class: "endpoint-copy p-0.5",
            icon: o(E),
            label: "Copy endpoint URL",
            size: "xs",
            variant: "ghost",
            onClick: l[0] || (l[0] = V((ie) => o(g)(e.path), ["stop"]))
          }, null, 8, ["icon"])
        ];
      }),
      default: s(() => {
        var p;
        return [
          a("div", ee, [
            a("div", oe, [
              a("div", te, [
                t(U, {
                  requestBody: e.oldOperation.requestBody,
                  parameters: e.operation.parameters,
                  schemas: e.schemas,
                  "onUpdate:modelValue": m
                }, null, 8, ["requestBody", "parameters", "schemas"])
              ]),
              a("div", ae, [
                t(A, {
                  collapsableItems: !1,
                  responses: e.oldOperation.responses,
                  schemas: e.schemas
                }, null, 8, ["responses", "schemas"])
              ]),
              (p = e.operation) != null && p.callbacks ? (i(), w("div", se, [
                t(P, {
                  method: e.method,
                  path: e.path,
                  callbacks: e.operation.callbacks,
                  schemas: e.schemas
                }, null, 8, ["method", "path", "callbacks", "schemas"])
              ])) : n("", !0)
            ]),
            e.operation.responses ? (i(), r(o(_), {
              key: 0,
              class: "operation-example-card",
              responses: e.operation.responses
            }, null, 8, ["responses"])) : n("", !0),
            a("div", null, [
              e.operation.externalDocs ? (i(), r(o(j), { key: 0 }, {
                default: s(() => [
                  t(o(F), {
                    value: e.operation.externalDocs
                  }, null, 8, ["value"])
                ]),
                _: 1
              })) : n("", !0),
              t(o(q), null, {
                default: s(() => [
                  t(o(G), {
                    class: "operation-example-card",
                    method: e.method,
                    selectedServer: e.server,
                    clientOptions: e.clientOptions,
                    selectedClient: e.store.workspace["x-scalar-default-client"],
                    securitySchemes: e.securitySchemes,
                    path: e.path,
                    fallback: "",
                    operation: e.operation,
                    "onUpdate:modelValue": m
                  }, null, 8, ["method", "selectedServer", "clientOptions", "selectedClient", "securitySchemes", "path", "operation"])
                ]),
                _: 1
              })
            ])
          ])
        ];
      }),
      _: 2
    }, [
      e.operation.description ? {
        name: "description",
        fn: s(() => [
          t(o(T), {
            value: e.operation.description,
            withImages: "",
            withAnchors: "",
            transformType: "heading",
            anchorPrefix: e.id
          }, null, 8, ["value", "anchorPrefix"])
        ]),
        key: "0"
      } : void 0
    ]), 1032, ["id"]));
  }
});
export {
  we as default
};
