import { d as I, r as p, U as Y, o as s, c as o, a as t, x as G, q as E, v as S, n as D, t as a, f as x, F as m, e as v, k as O, p as j, i as N, A as R, X as V, _ as $ } from "./main-b95154d2.mjs";
import { _ as z } from "./loadernew-ac153a51.mjs";
import { D as H } from "./Header-2e2da5f2.mjs";
import "./genome-Logo-white-ffcf2413.mjs";
import "./PopupComponent-8e09a61b.mjs";
import "./Close-button-48e5479d.mjs";
import "./index-4d573e85.mjs";
const J = { key: 0 }, L = { class: "flex" }, U = { class: "genpact-blue-box mt-14 flex flex-1 overflow-y-auto text-[15px]" }, F = { class: "mx-auto overflow-y-hidden md:w-11/12 lg:w-11/12" }, T = { class: "min-h-screen bg-gray-100 px-4 py-6 md:px-8 md:py-12 lg:px-8 lg:py-12" }, q = { class: "mt-4 w-full" }, X = { class: "shadow m-auto max-w-6xl p-4 text-background-secondary" }, K = { class: "mt-6 flex w-full" }, Q = { class: "mb-4 w-full pr-3" }, W = { class: "mb-4 w-full pr-3" }, Z = { class: "mb-4 w-full" }, tt = ["disabled"], et = ["disabled"], st = {
  key: 0,
  class: "ofConDetails mt-4 w-full"
}, ot = { class: "shadow m-auto max-w-6xl p-4 text-background-secondary flex flex-wrap" }, lt = { class: "mt-4 w-1/3" }, at = { class: "text-left text-background-secondary" }, dt = { class: "mt-4 w-1/3" }, nt = { class: "text-left text-background-secondary" }, rt = { class: "mt-4 w-1/3" }, it = { class: "text-left text-background-secondary" }, ct = { class: "mt-4 w-1/3" }, ut = { class: "text-left text-background-secondary" }, _t = { class: "mt-4 w-1/3" }, pt = { class: "text-left text-background-secondary" }, ft = { class: "mt-4 w-1/3" }, xt = { class: "text-left text-background-secondary" }, mt = { class: "mt-4 w-1/3" }, vt = { class: "text-left text-background-secondary" }, bt = { class: "mt-4 w-1/3" }, wt = { class: "text-left text-background-secondary" }, gt = { class: "accordion" }, ht = { class: "accordion-item-header flex w-full justify-between text-background-secondary" }, yt = ["onClick"], kt = { key: 0 }, Et = { key: 1 }, St = { class: "accordion-item-body" }, Dt = { class: "accordion-item-body-content" }, Ot = {
  key: 0,
  class: "w-full text-background-secondary"
}, Nt = { class: "flex w-full rounded border p-2 text-background-secondary" }, Rt = { class: "mx-1 w-1/2 rounded border p-2" }, Pt = { key: 0 }, Ct = {
  key: 1,
  class: "shadow fixed_headers checkBoxSize mb-4 mt-1 w-full rounded bg-white text-[15px] text-xs"
}, Mt = { class: "-text-blue-800 max-table-height flex w-full flex-col items-center overflow-y-auto opacity-80" }, At = { class: "w-10 p-2" }, Bt = { class: "w-1/2 p-2" }, It = { class: "w-1/2 p-2" }, Yt = { class: "mx-1 w-1/2 rounded border p-2" }, Gt = { key: 0 }, jt = {
  key: 1,
  class: "shadow fixed_headers checkBoxSize mb-4 mt-1 w-full rounded bg-white text-[15px] text-xs"
}, Vt = { class: "-text-blue-800 max-table-height flex w-full flex-col items-center overflow-y-auto opacity-80" }, $t = { class: "w-10 p-2" }, zt = { class: "w-1/2 p-2" }, Ht = { class: "w-1/2 p-2" }, Jt = {
  key: 1,
  class: "mt-1 w-full text-background-secondary"
}, Lt = { class: "flex w-full" }, Ut = { class: "w-1/3" }, Ft = { class: "w-1/3" }, Tt = { class: "w-1/3" }, qt = { class: "w-full" }, Xt = {
  key: 0,
  class: "shadow fixed_headers checkBoxSize mb-4 mt-1 w-full rounded bg-white text-[15px] text-xs"
}, Kt = { class: "-text-blue-800 flex w-full text-left" }, Qt = { class: "z-10 flex flex w-full justify-between border-b bg-background-secondary text-white" }, Wt = { class: "-text-blue-800 max-table-height flex w-full flex-col items-center overflow-y-auto opacity-80" }, Zt = { class: "w-10 p-2" }, te = {
  key: 1,
  class: "h-min-screen flex flex-col justify-center text-center"
}, ee = /* @__PURE__ */ I({
  __name: "Admin",
  setup(se) {
    const w = p(!1), P = p(!1), g = p(!1);
    p();
    const f = p(), y = p(), c = p(), u = p(), i = p(), C = async (d) => {
      for (let e = 0; e < u.value.length; e++)
        u.value[e] = e === d && !u.value[e];
      console.log(`all_prompt_toggle after toggle ${d}`, u);
    }, M = async () => {
      const { data: d } = await O(`/delphi/ofcon/${f.value}`);
      console.log("ofcon data", { data: d }), i.value = d.ofConDetails, console.log("ofCon_details", { data: i.value });
    }, A = async () => {
      try {
        w.value = !1, P.value = !0;
        const { data: d } = await j("/delphi/prompt/chain/details", { ohr_id: f.value, no_exections: y.value });
        if (c.value = d && d.response ? d.response : [], console.log(`all_prompts_executions.value.length ${c.value.length}`), u.value = [], c.value.length) {
          for (let e = 0; e < c.value.length; e++) {
            const l = c.value[e];
            for (let _ = 0; _ < l.per_exec_response.length; _++) {
              const n = l.per_exec_response[_], r = [], b = n.parsed_output ? JSON.parse(n.parsed_output)[0] : null;
              for (let k in b) {
                const h = k;
                h && r.push(h);
              }
              console.log("parsed_output_columns", r), c.value[e].per_exec_response[_].parsed_output_columns = r;
            }
          }
          for (let e = 0; e < c.value.length; e++)
            u.value.push(!1);
        }
        console.log("all_prompts_executions", c), console.log("all_prompt_toggle", u), w.value = !0;
      } catch (d) {
        console.log("Error in fetching all prompts", { message: d.message });
      }
    }, B = async () => {
      try {
        w.value = !1;
        const { data: d } = await O("/delphi/admin/access");
        g.value = d && d.is_access_allowed ? d.is_access_allowed : !1, console.log(`data.is_access_allowed ${d.is_access_allowed}`), console.log(`is_admin_access_allowed ${g.value}`), w.value = !0;
      } catch (d) {
        console.log("Error in fetching all prompts", { message: d.message }), g.value = !1;
      }
    };
    return Y(async () => {
      await B(), g.value;
    }), (d, e) => w.value ? (s(), o("div", J, [
      t("nav", L, [
        G(H)
      ]),
      t("section", U, [
        t("div", F, [
          t("div", T, [
            t("div", q, [
              t("div", X, [
                t("div", K, [
                  t("div", Q, [
                    e[4] || (e[4] = t("label", { class: "-text-blue-800 mb-2 block font-normal tracking-wide opacity-80" }, " OHR ", -1)),
                    E(t("input", {
                      "onUpdate:modelValue": e[0] || (e[0] = (l) => f.value = l),
                      type: "text",
                      class: "focus:shadow-outline w-full appearance-none rounded border px-3 py-2 leading-tight text-gray-500 focus:outline-none"
                    }, null, 512), [
                      [S, f.value]
                    ])
                  ]),
                  t("div", W, [
                    e[5] || (e[5] = t("label", { class: "-text-blue-800 mb-2 block font-normal tracking-wide opacity-80" }, " Number of Execution ", -1)),
                    E(t("input", {
                      "onUpdate:modelValue": e[1] || (e[1] = (l) => y.value = l),
                      type: "number",
                      class: "focus:shadow-outline w-full appearance-none rounded border px-3 py-2 leading-tight text-gray-500 focus:outline-none"
                    }, null, 512), [
                      [S, y.value]
                    ])
                  ]),
                  t("div", Z, [
                    t("button", {
                      disabled: !f.value,
                      class: D([f.value ? "cursor-pointer bg-background-secondary" : "cursor-not-allowed bg-gray-500", "shadow-md mt-8 inline-block rounded px-4 py-2 text-white"]),
                      onClick: e[2] || (e[2] = (l) => A())
                    }, " Past Executions ", 10, tt),
                    t("button", {
                      disabled: !f.value,
                      class: D([f.value ? "cursor-pointer bg-background-secondary" : "cursor-not-allowed bg-gray-500", "shadow-md ml-3 mt-8 inline-block rounded px-4 py-2 text-white"]),
                      onClick: e[3] || (e[3] = (l) => M())
                    }, " Get OHR Details ", 10, et)
                  ])
                ])
              ])
            ]),
            i.value ? (s(), o("div", st, [
              t("div", ot, [
                t("div", lt, [
                  e[6] || (e[6] = t("div", { class: "text-left font-bold text-background-secondary" }, "OHR", -1)),
                  t("div", at, a(i.value.OHR_ID), 1)
                ]),
                t("div", dt, [
                  e[7] || (e[7] = t("div", { class: "text-left font-bold text-background-secondary" }, "Name", -1)),
                  t("div", nt, a(i.value.EMPLOYEE_NAME), 1)
                ]),
                t("div", rt, [
                  e[8] || (e[8] = t("div", { class: "text-left font-bold text-background-secondary" }, "Designation", -1)),
                  t("div", it, a(i.value.EMPLOYEE_DESIGNATION), 1)
                ]),
                t("div", ct, [
                  e[9] || (e[9] = t("div", { class: "text-left font-bold text-background-secondary" }, "Band Grade", -1)),
                  t("div", ut, a(i.value.BAND_GRADE), 1)
                ]),
                t("div", _t, [
                  e[10] || (e[10] = t("div", { class: "text-left font-bold text-background-secondary" }, "Job Profile", -1)),
                  t("div", pt, a(i.value.JOB_PROFILE), 1)
                ]),
                t("div", ft, [
                  e[11] || (e[11] = t("div", { class: "text-left font-bold text-background-secondary" }, "Job Family Group", -1)),
                  t("div", xt, a(i.value.Job_Family_Group), 1)
                ]),
                t("div", mt, [
                  e[12] || (e[12] = t("div", { class: "text-left font-bold text-background-secondary" }, "Group", -1)),
                  t("div", vt, a(i.value.Groups), 1)
                ]),
                t("div", bt, [
                  e[13] || (e[13] = t("div", { class: "text-left font-bold text-background-secondary" }, "SUPERVISOR ID", -1)),
                  t("div", wt, a(i.value.SUPERVISOR_SUPERVISOR_ID), 1)
                ])
              ])
            ])) : x("", !0),
            t("div", gt, [
              (s(!0), o(m, null, v(c.value, (l, _) => (s(), o("div", {
                key: _,
                class: "accordion-item"
              }, [
                t("div", ht, [
                  t("div", null, a(N(R)(l.execution_timestamp).format("MMM Do YYYY, h:mm a")), 1),
                  t("button", {
                    class: "text-3xl",
                    onClick: (n) => C(_)
                  }, [
                    u.value[_] ? (s(), o("span", kt, "-")) : (s(), o("span", Et, "+"))
                  ], 8, yt)
                ]),
                E(t("div", St, [
                  t("div", Dt, [
                    l.processed_output ? (s(), o("div", Ot, [
                      e[18] || (e[18] = t("div", { class: "font-bold" }, "Processed Output:", -1)),
                      t("div", Nt, [
                        t("div", Rt, [
                          e[15] || (e[15] = t("div", null, "Matched Skills:", -1)),
                          !l.processed_output.matched_skills || l.processed_output.matched_skills && !l.processed_output.matched_skills.length ? (s(), o("div", Pt, "No matched skills")) : x("", !0),
                          l.processed_output.matched_skills && l.processed_output.matched_skills.length ? (s(), o("table", Ct, [
                            e[14] || (e[14] = t("thead", { class: "-text-blue-800 flex w-full text-left" }, [
                              t("tr", { class: "z-10 flex flex w-full justify-between border-b bg-background-secondary text-white" }, [
                                t("th", { class: "w-10 p-2" }, "S.No."),
                                t("th", { class: "w-1/2 p-2" }, "Skill"),
                                t("th", { class: "w-1/2 p-2" }, "Proficiency")
                              ])
                            ], -1)),
                            t("tbody", Mt, [
                              (s(!0), o(m, null, v(l.processed_output.matched_skills, (n, r) => (s(), o("tr", {
                                key: r,
                                class: "flex w-full justify-between border-b hover:bg-gray-300"
                              }, [
                                t("td", At, a(r + 1), 1),
                                t("td", Bt, a(n.skill), 1),
                                t("td", It, a(n.proficiency), 1)
                              ]))), 128))
                            ])
                          ])) : x("", !0)
                        ]),
                        t("div", Yt, [
                          e[17] || (e[17] = t("div", null, "Unmatched Skills:", -1)),
                          !l.processed_output.unmatched_skills || l.processed_output.unmatched_skills && !l.processed_output.unmatched_skills.length ? (s(), o("div", Gt, "No unmatched skills")) : x("", !0),
                          l.processed_output.unmatched_skills && l.processed_output.unmatched_skills.length ? (s(), o("table", jt, [
                            e[16] || (e[16] = t("thead", { class: "-text-blue-800 flex w-full text-left" }, [
                              t("tr", { class: "z-10 flex flex w-full justify-between border-b bg-background-secondary text-white" }, [
                                t("th", { class: "w-10 p-2" }, "S.No."),
                                t("th", { class: "w-1/2 p-2" }, "Skill"),
                                t("th", { class: "w-1/2 p-2" }, "Proficiency")
                              ])
                            ], -1)),
                            t("tbody", Vt, [
                              (s(!0), o(m, null, v(l.processed_output.unmatched_skills, (n, r) => (s(), o("tr", {
                                key: r,
                                class: "flex w-full justify-between border-b hover:bg-gray-300"
                              }, [
                                t("td", $t, a(r + 1), 1),
                                t("td", zt, a(n.skill), 1),
                                t("td", Ht, a(n.proficiency), 1)
                              ]))), 128))
                            ])
                          ])) : x("", !0)
                        ])
                      ])
                    ])) : x("", !0),
                    l.per_exec_response ? (s(), o("div", Jt, [
                      e[24] || (e[24] = t("div", { class: "font-bold" }, "Per Execution Response:", -1)),
                      t("div", null, [
                        (s(!0), o(m, null, v(l.per_exec_response, (n) => (s(), o("div", {
                          key: n.execution_id,
                          class: "my-2 rounded border p-2"
                        }, [
                          t("div", Lt, [
                            t("div", Ut, [
                              e[19] || (e[19] = t("div", { class: "font-bold" }, "Prompt Name:", -1)),
                              t("div", null, a(n.p_name), 1)
                            ]),
                            t("div", Ft, [
                              e[20] || (e[20] = t("div", { class: "font-bold" }, "Date Of Execution:", -1)),
                              t("div", null, a(N(R)(n.data_of_execution).format("MMM Do YYYY, h:mm a")), 1)
                            ]),
                            t("div", Tt, [
                              e[21] || (e[21] = t("div", { class: "font-bold" }, "Status:", -1)),
                              t("div", null, a(n.execution_status), 1)
                            ])
                          ]),
                          t("div", qt, [
                            e[23] || (e[23] = t("div", { class: "font-bold" }, "Output:", -1)),
                            t("div", null, [
                              n.parsed_output ? (s(), o("table", Xt, [
                                t("thead", Kt, [
                                  t("tr", Qt, [
                                    e[22] || (e[22] = t("th", { class: "w-10 p-2" }, "S.No.", -1)),
                                    (s(!0), o(m, null, v(n.parsed_output_columns, (r, b) => (s(), o("th", {
                                      key: b,
                                      class: "w-1/2 p-2"
                                    }, a(r), 1))), 128))
                                  ])
                                ]),
                                t("tbody", Wt, [
                                  (s(!0), o(m, null, v(JSON.parse(n.parsed_output), (r, b) => (s(), o("tr", {
                                    key: b,
                                    class: "flex w-full justify-between border-b hover:bg-gray-300"
                                  }, [
                                    t("td", Zt, a(b + 1), 1),
                                    (s(!0), o(m, null, v(n.parsed_output_columns, (k, h) => (s(), o("td", {
                                      key: h,
                                      class: "w-1/2 p-2"
                                    }, a(r[k]), 1))), 128))
                                  ]))), 128))
                                ])
                              ])) : x("", !0)
                            ])
                          ])
                        ]))), 128))
                      ])
                    ])) : x("", !0)
                  ])
                ], 512), [
                  [V, u.value[_]]
                ])
              ]))), 128))
            ])
          ])
        ])
      ])
    ])) : (s(), o("div", te, e[25] || (e[25] = [
      t("img", {
        class: "loadercss mx-auto mb-8 mt-3% block",
        src: z,
        alt: "Loader Gif"
      }, null, -1),
      t("p", { class: "loadertextcss ext-genpact-darkest-blue mx-auto mb-10 px-4 leading-normal" }, "Loading...", -1)
    ])));
  }
});
const ce = /* @__PURE__ */ $(ee, [["__scopeId", "data-v-da7c0790"]]);
export {
  ce as default
};
