import { d as T, r as i, o as v, c as _, a as s, x as B, n as R, b as t, t as r, f as h, q as D, v as U, i as p, p as y, _ as V } from "./main-e6123302.mjs";
import { _ as $ } from "./loadernew-ac153a51.mjs";
import { D as N } from "./Header-2fcbd18f.mjs";
import { u as P } from "./delphi_utils-fd314b4b.mjs";
import { u as I } from "./index-71114b0d.mjs";
import "./genome-Logo-white-ffcf2413.mjs";
import "./PopupComponent-457fc235.mjs";
import "./Close-button-48e5479d.mjs";
const E = { key: 0 }, K = { class: "flex" }, L = { class: "genpact-blue-box mt-14 flex flex-1 overflow-y-auto text-[15px]" }, M = { class: "mx-auto overflow-y-hidden md:w-11/12 lg:w-11/12" }, j = { 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" }, z = { class: "shadow max-w-6xl p-4 text-background-secondary" }, A = { class: "mt-6 flex w-full" }, G = { class: "mb-4 w-full pr-3" }, H = ["disabled"], O = { class: "mb-4 w-full" }, J = ["disabled"], Q = {
  key: 0,
  class: "mt-3 flex w-full"
}, W = { class: "font-bold" }, X = { class: "-text-blue mt-4 w-full border border-gray-400 p-2" }, Y = { class: "my-4" }, Z = { class: "" }, ee = {
  key: 0,
  class: ""
}, se = { class: "font-bold" }, oe = { class: "font-bold" }, te = { class: "font-bold" }, le = { class: "font-bold" }, ae = { class: "font-bold" }, ne = {
  key: 1,
  class: "h-min-screen flex flex-col justify-center text-center"
}, de = /* @__PURE__ */ T({
  __name: "Taleo",
  setup(ie) {
    const k = i(!0), f = i(), b = i(), l = I(), n = i();
    let d = i();
    const m = i(), S = (o) => {
      b.value = o.target.files[0], f.value = o.target.files[0].name, console.log("event", o.target.files[0]), console.log("uploadedFile.value", b.value), console.log("uploadFilename.value", f.value);
    }, C = async () => {
      const o = {
        batch_id: m.value
      }, { data: e } = await y("/delphi/taleo/postprocessor", o);
      d.value = e;
    }, F = async () => {
      if (!f.value)
        l.warning("Please Select valid file to upload");
      else
        try {
          const o = await y("/delphi/signed_url", {
            file_name: f.value
          });
          console.log("preSignedRes", o);
          const e = o.data.messsage.url, u = o.data.messsage.file_key;
          if (console.log("preSignedUrl", e), console.log("fileKey", u), (await P(e, b.value)).status === 200) {
            const g = {
              file_key: u
            }, { data: a } = await y("delphi/taleo/processFile", g);
            a && !a.error ? (n.value = a.batch_id, l.success("File uploaded successfully")) : l.error(`${a.message}`);
          } else
            console.log("error"), l.error("Unable to upload the file");
        } catch (o) {
          o.response ? l.error(`${o.response.data.message}`) : o.message ? l.error(`${o.message}`) : l.error("Failed to upload file");
        }
    };
    return (o, e) => {
      var u, x, g, a, w;
      return k.value ? (v(), _("div", E, [
        s("nav", K, [
          B(N)
        ]),
        s("section", L, [
          s("div", M, [
            s("div", j, [
              s("div", q, [
                s("div", z, [
                  s("div", A, [
                    s("div", G, [
                      e[4] || (e[4] = s("label", { class: "-text-blue-800 mb-2 block font-normal tracking-wide opacity-80" }, " Upload ", -1)),
                      s("input", {
                        disabled: n.value,
                        type: "file",
                        onChange: e[0] || (e[0] = (c) => S(c)),
                        class: "focus:shadow-outline w-full appearance-none rounded border px-3 py-2 leading-tight text-gray-500 focus:outline-none"
                      }, null, 40, H)
                    ]),
                    s("div", O, [
                      s("button", {
                        onClick: e[1] || (e[1] = (c) => F()),
                        disabled: n.value,
                        class: R([n.value ? "cursor-not-allowed bg-gray-500" : "cursor-pointer bg-background-secondary", "shadow-md mt-8 inline-block rounded px-4 py-2 text-white"])
                      }, "Upload", 10, J)
                    ])
                  ]),
                  n.value ? (v(), _("div", Q, [
                    e[5] || (e[5] = t("Batch id is ")),
                    s("span", W, r(n.value), 1)
                  ])) : h("", !0)
                ])
              ]),
              s("div", X, [
                e[13] || (e[13] = s("div", { class: "font-bold" }, "Execution Status", -1)),
                s("div", Y, [
                  s("div", Z, [
                    e[6] || (e[6] = s("div", null, [
                      s("label", null, "Batch Id")
                    ], -1)),
                    D(s("input", {
                      "onUpdate:modelValue": e[2] || (e[2] = (c) => m.value = c),
                      class: "focus:shadow-outline w-full appearance-none rounded border px-3 py-2 leading-tight text-gray-500 focus:outline-none",
                      type: "text"
                    }, null, 512), [
                      [U, m.value]
                    ])
                  ]),
                  e[7] || (e[7] = s("div", null, [
                    t('Please click on "'),
                    s("span", { class: "font-bold" }, 'Check Status"'),
                    t(" to get the expected output.")
                  ], -1)),
                  s("button", {
                    onClick: e[3] || (e[3] = (c) => C()),
                    class: "mr-4 mt-2 inline-block bg-background-secondary px-4 py-2 text-white"
                  }, "Check Status")
                ]),
                (u = p(d)) != null && u.status ? (v(), _("div", ee, [
                  s("div", null, [
                    e[8] || (e[8] = t("Batch id is ")),
                    s("span", se, r(m.value), 1)
                  ]),
                  s("div", null, [
                    e[9] || (e[9] = t("Status is ")),
                    s("span", oe, r((x = p(d)) == null ? void 0 : x.status), 1)
                  ]),
                  s("div", null, [
                    e[10] || (e[10] = t("Total Recors ")),
                    s("span", te, r((g = p(d)) == null ? void 0 : g.prompt_chain_execution), 1)
                  ]),
                  s("div", null, [
                    e[11] || (e[11] = t("Success count is ")),
                    s("span", le, r((a = p(d)) == null ? void 0 : a.prompt_chain_execution), 1)
                  ]),
                  s("div", null, [
                    e[12] || (e[12] = t("Message ")),
                    s("span", ae, r((w = p(d)) == null ? void 0 : w.response_message), 1)
                  ])
                ])) : h("", !0)
              ])
            ])
          ])
        ])
      ])) : (v(), _("div", ne, e[14] || (e[14] = [
        s("img", {
          class: "loadercss mx-auto mb-8 mt-3% block",
          src: $,
          alt: "Loader Gif"
        }, null, -1),
        s("p", { class: "loadertextcss ext-genpact-darkest-blue mx-auto mb-10 px-4 leading-normal" }, "Loading...", -1)
      ])));
    };
  }
});
const _e = /* @__PURE__ */ V(de, [["__scopeId", "data-v-3fd2535e"]]);
export {
  _e as default
};
