import { _ as w } from "./loadernew-ac153a51.mjs";
import { D as v } from "./Header-72db5d07.mjs";
import { d as k, r as n, U as P, V as A, o, c as a, a as e, x as i, W as m, b as _, F as b, e as B, k as h, t as x, _ as C } from "./main-b2186337.mjs";
import { c as D } from "./delphi_utils-11f1be37.mjs";
import "./genome-Logo-white-ffcf2413.mjs";
import "./PopupComponent-31cc3623.mjs";
import "./Close-button-48e5479d.mjs";
import "./index-169cd149.mjs";
const E = {
  key: 0,
  class: "flex h-screen flex-col"
}, L = { class: "flex" }, N = { class: "genpact-blue-box mt-14 flex flex-1 overflow-y-auto text-[15px]" }, S = { class: "mx-auto overflow-y-hidden md:w-11/12 lg:w-11/12" }, V = { class: "bg-gray-100 min-h-screen px-4 py-6 md:px-8 md:py-12 lg:px-8 lg:py-12" }, j = { class: "mt-2 flex w-full justify-center" }, M = { class: "w-full text-left" }, z = { class: "mt-6 flex w-full justify-center" }, F = { class: "text-[15px] shadow fixed_headers checkBoxSize mb-4 w-full rounded bg-white" }, q = { class: "-text-blue-800 text-[15px] max-table-height flex w-full flex-col items-center overflow-y-auto opacity-80" }, G = { class: "w-56 p-2" }, H = { class: "w-2/6 p-2" }, I = { class: "w-2/6 p-2" }, R = { class: "w-1/6 p-2" }, T = {
  key: 1,
  class: "flex h-screen flex-col"
}, U = {
  key: 1,
  class: "h-min-screen flex flex-col justify-center text-center"
}, W = /* @__PURE__ */ k({
  __name: "Prompt",
  setup(Y) {
    const d = n(), l = n(!1), p = n(!1), r = n(!1), f = n(), y = async () => {
      try {
        l.value = !1, p.value = !1;
        const { data: t } = await h("/delphi/prompt/user");
        if (t && t.is_access_not_allowed) {
          r.value = !1, f.value = t.message;
          return;
        }
        d.value = t && t.data ? t.data : [], l.value = !0;
      } catch (t) {
        console.log("Error in fetching all prompts", { message: t.message });
      }
    }, g = async () => {
      try {
        l.value = !1, p.value = !0;
        const { data: t } = await h("/delphi/prompt/public");
        if (t && t.is_access_not_allowed) {
          r.value = !1, f.value = t.message;
          return;
        }
        d.value = t && t.data ? t.data : [], l.value = !0;
      } catch (t) {
        console.log("Error in fetching all prompts", { message: t.message });
      }
    };
    return P(async () => {
      r.value = await D(), r.value && await y();
    }), (t, s) => {
      const u = A("router-link");
      return l.value ? (o(), a(b, { key: 0 }, [
        r.value ? (o(), a("div", E, [
          e("nav", L, [
            i(v)
          ]),
          e("section", N, [
            e("div", S, [
              e("div", V, [
                s[4] || (s[4] = e("div", { class: "w-full" }, [
                  e("div", { class: "text-center text-3xl text-background-secondary" }, "Prompt Lists")
                ], -1)),
                e("div", j, [
                  e("div", M, [
                    i(u, {
                      to: { name: "PromptAllExecutions" },
                      class: "mr-4 mt-4 inline-block bg-background-secondary px-4 py-2 text-white"
                    }, {
                      default: m(() => s[0] || (s[0] = [
                        _(" All Past Executions ")
                      ])),
                      _: 1,
                      __: [0]
                    }),
                    i(u, {
                      to: { name: "AddPrompt" },
                      class: "mr-4 mt-4 inline-block bg-background-secondary px-4 py-2 text-white"
                    }, {
                      default: m(() => s[1] || (s[1] = [
                        _(" Add Prompt ")
                      ])),
                      _: 1,
                      __: [1]
                    }),
                    p.value ? (o(), a("button", {
                      key: 1,
                      class: "mr-4 mt-4 inline-block bg-background-secondary px-4 py-2 text-white",
                      onClick: y
                    }, "Show My Prompts")) : (o(), a("button", {
                      key: 0,
                      class: "mr-4 mt-4 inline-block bg-background-secondary px-4 py-2 text-white",
                      onClick: g
                    }, "Show All Public Prompts"))
                  ])
                ]),
                e("div", z, [
                  e("table", F, [
                    s[3] || (s[3] = e("thead", { class: "-text-blue-800 flex w-full text-left" }, [
                      e("tr", { class: "z-10 flex w-full border-b bg-background-secondary text-white" }, [
                        e("th", { class: "w-56 p-2" }, "Prompt Name"),
                        e("th", { class: "w-2/6 p-2" }, "Description"),
                        e("th", { class: "w-2/6 p-2" }, "Persona"),
                        e("th", { class: "w-1/6 p-2" })
                      ])
                    ], -1)),
                    e("tbody", q, [
                      (o(!0), a(b, null, B(d.value, (c) => (o(), a("tr", {
                        key: c.prompt_id,
                        class: "w-full border-b hover:bg-gray-300"
                      }, [
                        e("td", G, x(c.prompt_display_name), 1),
                        e("td", H, x(c.desc), 1),
                        e("td", I, x(c.persona), 1),
                        e("td", R, [
                          i(u, {
                            to: { name: "AddPrompt", query: { prompt_id: c.prompt_id } },
                            class: "inline-block bg-background-secondary px-4 py-1 rounded text-white"
                          }, {
                            default: m(() => s[2] || (s[2] = [
                              _("Details")
                            ])),
                            _: 2,
                            __: [2]
                          }, 1032, ["to"])
                        ])
                      ]))), 128))
                    ])
                  ])
                ])
              ])
            ])
          ])
        ])) : (o(), a("div", T, "You don't have access"))
      ], 64)) : (o(), a("div", U, s[5] || (s[5] = [
        e("img", {
          class: "loadercss mx-auto mb-8 mt-3% block",
          src: w,
          alt: "Loader Gif"
        }, null, -1),
        e("p", { class: "loadertextcss ext-genpact-darkest-blue mx-auto mb-10 px-4 leading-normal" }, "Loading...", -1)
      ])));
    };
  }
});
const te = /* @__PURE__ */ C(W, [["__scopeId", "data-v-8cc3a0ae"]]);
export {
  te as default
};
