import { defineComponent as f, openBlock as t, createElementBlock as o, Fragment as r, renderList as m, createElementVNode as l, toDisplayString as c, createCommentVNode as h } from "vue";
import { useServerStore as k } from "@scalar/api-client";
const y = { key: 0 }, I = ["for"], x = ["id", "value", "onInput"], S = ["value"], g = { class: "input-value" }, V = ["id", "value", "onInput"], C = /* @__PURE__ */ f({
  __name: "ServerVariables",
  props: {
    value: {}
  },
  setup($) {
    const { server: u, setServer: p } = k(), d = (s, a) => {
      const e = a.target.value, n = [...u.variables], _ = n.findIndex((v) => v.name === s);
      n[_].value = e, p({
        variables: n
      });
    }, i = (s) => {
      const a = u.variables.findIndex((e) => e.name === s);
      return u.variables[a].value ?? "";
    };
    return (s, a) => s.value ? (t(), o("div", y, [
      (t(!0), o(r, null, m(s.value, (e) => (t(), o("div", {
        key: e.name,
        class: "input"
      }, [
        l("label", {
          for: `variable-${e.name}`
        }, [
          l("code", null, c(e.name), 1)
        ], 8, I),
        e.enum ? (t(), o(r, { key: 0 }, [
          l("select", {
            id: `variable-${e.name}`,
            value: i(e.name),
            onInput: (n) => d(e.name, n)
          }, [
            (t(!0), o(r, null, m(e.enum, (n) => (t(), o("option", {
              key: n,
              value: n
            }, c(n), 9, S))), 128))
          ], 40, x),
          l("div", g, c(e.default), 1)
        ], 64)) : (t(), o("input", {
          key: 1,
          id: `variable-${e.name}`,
          autocomplete: "off",
          placeholder: "value",
          spellcheck: "false",
          type: "text",
          value: i(e.name),
          onInput: (n) => d(e.name, n)
        }, null, 40, V))
      ]))), 128))
    ])) : h("", !0);
  }
});
export {
  C as default
};
