import { jsx as e, jsxs as s, Fragment as q } from "react/jsx-runtime";
import { execute as we } from "@/common/services/GlobalApis";
import { showToast as S } from "@/common/toaster/toaster";
import { Modal as De, Backdrop as J, Fade as Ue, Typography as M, IconButton as Q, CircularProgress as Ie, Tabs as X, Tab as R, Divider as W, Chip as U, FormControl as I, FormLabel as z, Autocomplete as K, TextField as A, Tooltip as ze, OutlinedInput as Ne, InputAdornment as Oe, FormHelperText as Le, Alert as Ae, Checkbox as Ee, Accordion as Fe, AccordionSummary as Te, AccordionDetails as ke, Button as Z } from "@mui/material";
import c from "@mui/material/Grid2";
import { Box as h } from "@mui/system";
import { D as b } from "./i18next-CTOWN_jH-BKKbdDel.js";
import N from "prop-types";
import qe, { useState as y, useEffect as Me } from "react";
import { useForm as Re, useFieldArray as We, Controller as O } from "react-hook-form";
import { api as ee } from "@/common/interceptors/AxiosInterceptor";
import { syncMenuConfigFormsWithServer as je, downloadFeature as $e } from "@/common/services/SyncWithServer";
import { FormConfiguratorService as Ye } from "@/common/services/FormConfiguratorService";
import { FontAwesomeIcon as x } from "@fortawesome/react-fontawesome";
import { faXmark as Ve, faCircleInfo as _e, faEyeSlash as Pe, faEye as Be, faChevronDown as He, faArrowsRotate as Ge, faDownload as Je } from "@fortawesome/free-solid-svg-icons";
import Qe from "@/common/services/util/GeneralUtil";
import Xe from "@/views/custom-components/InfoBadge";
import re from "@/views/custom-components/AlertPlaceholder";
import Ke from "@/views/custom-components/PostgresEditor";
function Ze({
  id: j,
  navigationState: $,
  selectedFeature: Y,
  openServerSyncModal: E,
  openModalFunc: V
}) {
  const [m, oe] = y(), [te, ie] = y([]), [F, ne] = y(), [T, le] = y(!1), [w, k] = y(-1), [ae, g] = y(!1), [L, _] = y({}), [f, P] = y([]), [u, se] = y("SYNC"), v = Re({
    defaultValues: {
      serverName: "",
      formCode: [],
      formDetails: [],
      userName: "",
      password: "",
      requestMessage: ""
    },
    mode: "onChange"
  }), { fields: C, remove: de, append: ce, replace: B } = We({
    control: v.control,
    name: "formDetails"
  }), ue = (o, t) => {
    _({});
    const r = [...C];
    r.forEach((i) => {
      const l = m.find(
        (n) => n.formCode === i.formCode
      );
      i.migrationList = l.migrationListAll, i.migrationListAll = l.migrationListAll;
    }), B(r), se(t);
  };
  Me(() => {
    (async () => {
      try {
        await me(), await pe();
      } catch (o) {
        S({
          message: o,
          type: "error"
        });
      }
    })();
  }, [E]);
  const me = async () => {
    try {
      const o = (await Ye.getAllLinkedFormsByMenuConfigId(j)).data;
      o && (ie(o), oe(() => {
        const t = o, r = /* @__PURE__ */ new Map();
        return t.forEach((i) => {
          r.has(i.formCode) || r.set(i.formCode, {
            sourceFormCode: i.sourceFormCode,
            formName: i.formName,
            formCode: i.formCode,
            versions: JSON.parse(i.versions).filter(
              (l) => l.version !== "DRAFT"
            ),
            formUUID: i.uuid,
            builderType: i.builderType,
            migrationList: i.migrationList,
            migrationListAll: i.migrationList
          });
        }), Array.from(r.values());
      }));
    } catch (o) {
      S({
        message: o,
        type: "error"
      });
    }
  }, fe = async (o) => {
    if (o && m) {
      const t = m.map((r) => r.formUUID);
      try {
        const r = await ee.get(
          "sync/migrationUUIDsByListOfFormMasterUUIDSource",
          {
            params: {
              formMasterUUIDs: t,
              serverCode: o.code
            },
            paramsSerializer: {
              serialize: (i) => Object.entries(i).map(
                ([l, n]) => Array.isArray(n) ? n.map((d) => `${l}=${encodeURIComponent(d)}`).join("&") : `${l}=${encodeURIComponent(n)}`
              ).join("&")
            }
          }
        );
        P([...r.data]);
      } catch (r) {
        console.error("Error fetching UUIDs:", r);
      }
    } else
      P([]);
  }, pe = async () => {
    try {
      const o = (await we({
        code: "fetch_server_details"
      })).data;
      o.result && ne(o.result);
    } catch (o) {
      S({
        message: o,
        type: "error"
      });
    }
  }, he = () => {
    let o = v.getValues("formCode") || [];
    if (o.length > 0) {
      k(o[0]);
      let t = o.map((n) => {
        var d;
        let a = m == null ? void 0 : m.find((p) => p.formCode === n);
        return a ? {
          formName: a.formName,
          formCode: a.formCode,
          formUUID: a.formUUID,
          migrationList: (d = a.migrationList) == null ? void 0 : d.filter(
            (p) => !f.includes(p.uuid)
          ),
          migrationListAll: a.migrationList
        } : null;
      }).filter(Boolean), r = C.map((n) => n.formCode), i = t.filter(
        (n) => !r.includes(n.formCode)
      ), l = r.filter(
        (n) => !o.includes(n)
      );
      i.forEach((n) => {
        const d = (m == null ? void 0 : m.find(
          (a) => a.formCode === n.formCode
        )).versions.reduce(
          (a, p) => parseInt(p.version) > parseInt(a.version) ? p : a
        );
        ce({
          formName: n.formName,
          formCode: n.formCode,
          migrationList: n.migrationList,
          migrationListAll: n.migrationList,
          version: d.version,
          formUUID: n.formUUID,
          builderType: n.builderType
        });
      }), l.forEach((n) => {
        let d = C.findIndex((a) => a.formCode === n);
        d !== -1 && de(d);
      });
    } else
      k(-1), B([]);
  }, ge = () => le((o) => !o), ve = () => {
    V(!1);
  }, H = async (o, t, r) => {
    try {
      return await Qe.getEncodedData(o, t, r);
    } catch (i) {
      return console.error(i), null;
    }
  }, ye = (o, t) => Object.entries(o).filter(([r]) => !t.includes(r)).sort(([, r], [, i]) => r.createdOn - i.createdOn).map(([r]) => r), Ce = async (o) => {
    try {
      g(!0);
      const t = await ee.get("/login/get-key-and-iv", {
        withCredentials: !0
      }), r = await H(
        t.data.key,
        t.data.initVector,
        o.userName
      ), i = await H(
        t.data.key,
        t.data.initVector,
        o.password
      ), l = o.formDetails.map((a) => {
        let p = ye(
          L[a.formCode] || {},
          f || []
        );
        return {
          formMasterUUID: a.formUUID,
          version: a.version,
          migrationUUIDList: p,
          builderType: a.builderType
        };
      }), n = [];
      te.forEach((a) => {
        a.sourceFormCode != a.formCode && n.push({ [a.sourceFormCode]: a.formCode });
      });
      const d = {
        menuConfigId: j,
        navigationState: $,
        formConfigsData: l,
        routeGraphMap: n,
        transactionRequestData: {
          serverCode: o.serverName,
          requestMessage: o.requestMessage,
          featureType: "FORM_CONFIGURATOR",
          featureReferenceType: "FEATURE",
          featureReferenceId: $
        },
        authRequestData: {
          userName: r,
          password: i,
          grantType: "password",
          clientId: "imtecho-ui"
        }
      };
      if (u === "SYNC")
        try {
          g(!0);
          const a = await je(d);
          g(!1), a.data.isSuccess ? (S({
            type: "success",
            message: "Synced to server successfully."
          }), V(!1)) : (S({
            type: "error",
            message: "Issue in syncing with server."
          }), console.error("error", a.data.error));
        } catch (a) {
          g(!1), S({
            type: "error",
            message: "Sync failed: Unauthorized access"
          }), console.error("error", a);
        }
      if (u === "DOWNLOAD")
        try {
          g(!0);
          const a = await $e(d), p = `V${Date.now()}__${d.navigationState}__feature.json`, xe = new Blob([a.data], { type: "application/json" }), G = window.URL.createObjectURL(xe), D = document.createElement("a");
          D.href = G, D.setAttribute("download", p), document.body.appendChild(D), D.click(), D.remove(), window.URL.revokeObjectURL(G), g(!1);
        } catch (a) {
          g(!1), S({
            type: "error",
            message: "Download failed"
          }), console.error("error", a);
        }
      g(!1);
    } catch (t) {
      g(!1), console.error("error", t);
    }
  }, Se = (o, t, r) => {
    let i = { ...L };
    o.target.checked ? (Object.prototype.hasOwnProperty.call(
      i,
      t
    ) || (i[t] = {}), i[t][r.uuid] = r) : delete i[t][r.uuid], _({ ...i });
  }, be = (o) => {
    const t = new Date(o), r = String(t.getDate()).padStart(2, "0"), i = String(t.getMonth() + 1).padStart(2, "0"), l = t.getFullYear();
    let n = t.getHours();
    const d = String(t.getMinutes()).padStart(2, "0");
    return n = String(n).padStart(2, "0"), `${r}/${i}/${l} ${n}:${d}`;
  };
  return /* @__PURE__ */ e(
    De,
    {
      open: E,
      slots: { backdrop: J },
      slotProps: {
        backdrop: {
          timeout: 500
        }
      },
      PaperProps: {
        style: {
          borderRadius: "8px"
        }
      },
      children: /* @__PURE__ */ e(Ue, { in: E, children: /* @__PURE__ */ s(
        h,
        {
          sx: {
            position: "absolute",
            top: "50%",
            left: "50%",
            padding: "10px 25px",
            transform: "translate(-50%, -50%)",
            width: "80%",
            maxHeight: "90%",
            scrollbarWidth: "none",
            overflowY: "scroll",
            bgcolor: "background.paper",
            borderRadius: "12px",
            boxShadow: 12,
            transition: "all 0.5s ease !important"
          },
          children: [
            /* @__PURE__ */ s(
              h,
              {
                sx: {
                  display: "flex",
                  justifyContent: "space-between",
                  alignItems: "center"
                },
                children: [
                  /* @__PURE__ */ s(M, { variant: "h6", className: "text-customBlue", children: [
                    b("Sync"),
                    " ",
                    Y == null ? void 0 : Y.name
                  ] }),
                  /* @__PURE__ */ e(Q, { onClick: ve, children: /* @__PURE__ */ e(x, { icon: Ve }) })
                ]
              }
            ),
            /* @__PURE__ */ s("form", { noValidate: !0, onSubmit: v.handleSubmit(Ce), children: [
              /* @__PURE__ */ s(h, { sx: { my: 2 }, children: [
                /* @__PURE__ */ e(
                  J,
                  {
                    sx: (o) => ({
                      color: "#fff",
                      zIndex: o.zIndex.drawer + 1
                    }),
                    open: ae,
                    children: /* @__PURE__ */ s(
                      h,
                      {
                        sx: {
                          backgroundColor: "white",
                          p: 3,
                          color: "black",
                          display: "flex",
                          justifyContent: "space-between",
                          alignItems: "center",
                          borderRadius: "10px"
                        },
                        children: [
                          /* @__PURE__ */ e(Ie, { color: "inherit" }),
                          /* @__PURE__ */ e(M, { sx: { ml: 2 }, children: "Syncing feature, it may take some time, please wait..." })
                        ]
                      }
                    )
                  }
                ),
                /* @__PURE__ */ s(c, { container: !0, spacing: 2, children: [
                  /* @__PURE__ */ s(c, { size: 5, container: !0, children: [
                    /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ s(
                      X,
                      {
                        value: u,
                        onChange: ue,
                        variant: "fullWidth",
                        children: [
                          /* @__PURE__ */ e(R, { label: "SYNC", value: "SYNC" }),
                          /* @__PURE__ */ e(R, { label: "DOWNLOAD", value: "DOWNLOAD" })
                        ]
                      }
                    ) }),
                    ["SYNC"].includes(u) && /* @__PURE__ */ s(q, { children: [
                      /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(U, { label: "Server and form details", size: "small" }) }) }),
                      /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ s(I, { fullWidth: !0, children: [
                        /* @__PURE__ */ e(z, { required: !0, children: "Select server" }),
                        /* @__PURE__ */ e(
                          O,
                          {
                            name: "serverName",
                            control: v.control,
                            rules: {
                              required: {
                                value: !0,
                                message: "Select server"
                              }
                            },
                            render: ({
                              field: { onChange: o, value: t },
                              fieldState: { error: r }
                            }) => {
                              const i = F == null ? void 0 : F.filter(
                                (l) => t == null ? void 0 : t.includes(l.code)
                              );
                              return /* @__PURE__ */ e(
                                K,
                                {
                                  fullWidth: !0,
                                  size: "small",
                                  options: F || [],
                                  getOptionLabel: (l) => l.serverDetails || "",
                                  value: i,
                                  getOptionDisabled: (l) => t == null ? void 0 : t.includes(l.code),
                                  onChange: (l, n) => {
                                    const d = n == null ? void 0 : n.code;
                                    o(d), fe(n);
                                  },
                                  renderInput: (l) => /* @__PURE__ */ e(
                                    A,
                                    {
                                      ...l,
                                      placeholder: "Select server",
                                      variant: "outlined",
                                      error: r,
                                      helperText: r == null ? void 0 : r.message
                                    }
                                  )
                                }
                              );
                            }
                          }
                        )
                      ] }) })
                    ] }),
                    ["DOWNLOAD", "SYNC"].includes(u) && /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ s(I, { fullWidth: !0, children: [
                      /* @__PURE__ */ s(z, { required: !0, children: [
                        b("Select"),
                        " ",
                        b("forms")
                      ] }),
                      /* @__PURE__ */ e(
                        O,
                        {
                          name: "formCode",
                          rules: {
                            required: {
                              value: !0,
                              message: "Select server"
                            }
                          },
                          control: v.control,
                          render: ({
                            field: { onChange: o, value: t },
                            fieldState: { error: r }
                          }) => {
                            const i = m == null ? void 0 : m.filter(
                              (l) => t == null ? void 0 : t.includes(l.formCode)
                            );
                            return /* @__PURE__ */ e(
                              K,
                              {
                                multiple: !0,
                                size: "small",
                                options: m || [],
                                disableCloseOnSelect: !0,
                                getOptionLabel: (l) => l.formName || "",
                                value: i,
                                getOptionDisabled: (l) => t == null ? void 0 : t.includes(l.formCode),
                                onChange: (l, n) => {
                                  const d = n.map(
                                    (a) => a.formCode
                                  );
                                  o(d), he();
                                },
                                renderInput: (l) => /* @__PURE__ */ e(
                                  A,
                                  {
                                    ...l,
                                    placeholder: "Select all forms to sync",
                                    variant: "outlined",
                                    error: r,
                                    helperText: r == null ? void 0 : r.message
                                  }
                                )
                              }
                            );
                          }
                        }
                      )
                    ] }) }) }),
                    ["SYNC"].includes(u) && /* @__PURE__ */ s(q, { children: [
                      /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(
                        U,
                        {
                          label: /* @__PURE__ */ s(h, { children: [
                            /* @__PURE__ */ e(h, { component: "span", sx: { mr: 0.5 }, children: "User authentication details" }),
                            /* @__PURE__ */ e(ze, { title: "Users with admin role can perform the sync operation", children: /* @__PURE__ */ e(x, { icon: _e }) })
                          ] }),
                          size: "small"
                        }
                      ) }) }),
                      /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ s(I, { variant: "outlined", fullWidth: !0, children: [
                        /* @__PURE__ */ e(z, { required: !0, children: b("Username") }),
                        /* @__PURE__ */ e(
                          O,
                          {
                            name: "userName",
                            rules: {
                              required: {
                                value: !0,
                                message: "Enter username"
                              }
                            },
                            control: v.control,
                            render: ({
                              field: o,
                              fieldState: { error: t }
                            }) => /* @__PURE__ */ e(
                              A,
                              {
                                ...o,
                                size: "small",
                                placeholder: "Enter username",
                                variant: "outlined",
                                autoComplete: "off",
                                error: !!t,
                                helperText: t == null ? void 0 : t.message
                              }
                            )
                          }
                        )
                      ] }) }),
                      /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ s(I, { fullWidth: !0, children: [
                        /* @__PURE__ */ e(
                          z,
                          {
                            required: !0,
                            color: "text.primary",
                            sx: { mb: 0.5 },
                            children: b("Password")
                          }
                        ),
                        /* @__PURE__ */ e(
                          O,
                          {
                            name: "password",
                            rules: {
                              required: {
                                value: !0,
                                message: "Enter password"
                              }
                            },
                            control: v.control,
                            errors: v.formState.errors,
                            defaultValue: "",
                            render: ({
                              field: { onChange: o, value: t },
                              fieldState: { error: r }
                            }) => /* @__PURE__ */ s(h, { sx: { mb: 1 }, children: [
                              /* @__PURE__ */ e(
                                Ne,
                                {
                                  fullWidth: !0,
                                  type: T ? "text" : "password",
                                  value: t,
                                  size: "small",
                                  placeholder: "Enter password",
                                  onChange: o,
                                  error: r,
                                  autoComplete: "off",
                                  endAdornment: /* @__PURE__ */ e(Oe, { position: "end", children: /* @__PURE__ */ e(
                                    Q,
                                    {
                                      "aria-label": T ? "hide the password" : "display the password",
                                      onClick: ge,
                                      onMouseDown: (i) => i.preventDefault(),
                                      onMouseUp: (i) => i.preventDefault(),
                                      edge: "end",
                                      children: T ? /* @__PURE__ */ e(
                                        x,
                                        {
                                          icon: Pe,
                                          size: "xs"
                                        }
                                      ) : /* @__PURE__ */ e(
                                        x,
                                        {
                                          icon: Be,
                                          size: "xs"
                                        }
                                      )
                                    }
                                  ) })
                                }
                              ),
                              r && /* @__PURE__ */ e(Le, { error: r, children: r == null ? void 0 : r.message })
                            ] })
                          }
                        )
                      ] }) }),
                      /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ s(I, { fullWidth: !0, children: [
                        /* @__PURE__ */ s(z, { required: !0, children: [
                          b("Request"),
                          " ",
                          b("message")
                        ] }),
                        /* @__PURE__ */ e(
                          O,
                          {
                            name: "requestMessage",
                            rules: {
                              required: {
                                value: !0,
                                message: "Enter request message"
                              }
                            },
                            control: v.control,
                            render: ({ field: o, fieldState: { error: t } }) => /* @__PURE__ */ e(
                              A,
                              {
                                multiline: !0,
                                rows: 4,
                                size: "small",
                                placeholder: "Enter request message",
                                ...o,
                                error: t,
                                helperText: t == null ? void 0 : t.message
                              }
                            )
                          }
                        )
                      ] }) })
                    ] })
                  ] }),
                  /* @__PURE__ */ e(c, { size: 7, children: /* @__PURE__ */ e(h, { children: C.length > 0 ? /* @__PURE__ */ s(qe.Fragment, { children: [
                    /* @__PURE__ */ e(Ae, { sx: { mt: 1 }, severity: "info", children: "Please select the migration corresponding to the respective form for synchronization" }),
                    /* @__PURE__ */ e(
                      X,
                      {
                        value: w,
                        onChange: (o, t) => {
                          k(t);
                        },
                        children: C == null ? void 0 : C.map((o) => /* @__PURE__ */ e(
                          R,
                          {
                            value: o.formCode,
                            label: /* @__PURE__ */ e(
                              Xe,
                              {
                                label: o.formCode,
                                value: `V${o.version}`,
                                color: "info.main",
                                tooltipValue: `Version ${o.version} of ${o.formName} will be synced`,
                                showTooltip: !0,
                                valueSize: 30,
                                fontSize: "0.8rem"
                              }
                            )
                          },
                          o.formUUID
                        ))
                      }
                    ),
                    /* @__PURE__ */ e(W, { sx: { mb: 1 } }),
                    w != -1 && (() => {
                      var o;
                      const t = C.find(
                        (r) => r.formCode === w
                      );
                      return /* @__PURE__ */ s(
                        c,
                        {
                          spacing: 2,
                          container: !0,
                          sx: { maxHeight: "50vh", overflowY: "scroll" },
                          children: [
                            (t == null ? void 0 : t.migrationList.length) === 0 && /* @__PURE__ */ e(c, { size: 12, children: /* @__PURE__ */ s(re, { height: "250px", children: [
                              "No migration queries present for (",
                              t.formName,
                              ")"
                            ] }) }),
                            (o = t == null ? void 0 : t.migrationList) == null ? void 0 : o.map(
                              (r) => {
                                var i, l;
                                return /* @__PURE__ */ s(
                                  c,
                                  {
                                    size: 12,
                                    container: !0,
                                    children: [
                                      /* @__PURE__ */ e(c, { size: 1, children: /* @__PURE__ */ e(
                                        Ee,
                                        {
                                          value: ((i = Object.keys(
                                            L[w] || {}
                                          )) == null ? void 0 : i.includes(r.uuid)) && (!(f != null && f.includes(
                                            r.uuid
                                          )) || u == "DOWNLOAD"),
                                          checked: ((l = Object.keys(
                                            L[w] || {}
                                          )) == null ? void 0 : l.includes(r.uuid)) && (!(f != null && f.includes(
                                            r.uuid
                                          )) || u == "DOWNLOAD"),
                                          disabled: (f == null ? void 0 : f.includes(
                                            r.uuid
                                          )) && u === "SYNC",
                                          sx: {
                                            "& .MuiSvgIcon-root": {
                                              fontSize: 32
                                            },
                                            mr: 1
                                          },
                                          onChange: (n) => {
                                            Se(
                                              n,
                                              w,
                                              r
                                            );
                                          }
                                        }
                                      ) }),
                                      /* @__PURE__ */ e(c, { size: 11, children: /* @__PURE__ */ s(
                                        Fe,
                                        {
                                          slotProps: {
                                            transition: { unmountOnExit: !0 }
                                          },
                                          children: [
                                            /* @__PURE__ */ e(
                                              Te,
                                              {
                                                expandIcon: /* @__PURE__ */ e(
                                                  x,
                                                  {
                                                    icon: He
                                                  }
                                                ),
                                                "aria-controls": "panel1-content",
                                                id: "panel1-header",
                                                sx: {
                                                  backgroundColor: "background.default"
                                                },
                                                children: /* @__PURE__ */ s(M, { component: "span", children: [
                                                  "Created on :",
                                                  " ",
                                                  be(r.createdOn),
                                                  /* @__PURE__ */ e(
                                                    U,
                                                    {
                                                      sx: { ml: 2 },
                                                      size: "small",
                                                      color: r.isExecuted ? "success" : "warning",
                                                      label: r.isExecuted ? "Executed" : "Not Executed"
                                                    }
                                                  ),
                                                  r.isExecuted && r.isError && /* @__PURE__ */ e(
                                                    U,
                                                    {
                                                      sx: { ml: 2 },
                                                      size: "small",
                                                      color: "error",
                                                      label: "Error"
                                                    }
                                                  ),
                                                  (f == null ? void 0 : f.includes(
                                                    r.uuid
                                                  )) && u === "SYNC" && /* @__PURE__ */ e(
                                                    U,
                                                    {
                                                      sx: { ml: 2 },
                                                      size: "small",
                                                      color: "info",
                                                      label: "Synced"
                                                    }
                                                  )
                                                ] })
                                              }
                                            ),
                                            /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ e(
                                              Ke,
                                              {
                                                mode: "READ_ONLY",
                                                defaultValue: r == null ? void 0 : r.query
                                              }
                                            ) })
                                          ]
                                        }
                                      ) })
                                    ]
                                  },
                                  r.uuid
                                );
                              }
                            )
                          ]
                        },
                        t.formCode
                      );
                    })()
                  ] }) : /* @__PURE__ */ e(h, { sx: { mt: 1 }, children: /* @__PURE__ */ e(re, { height: "250px", children: "Please select forms to sync" }) }) }) })
                ] })
              ] }),
              /* @__PURE__ */ s(
                h,
                {
                  sx: {
                    my: 1,
                    display: "flex",
                    justifyContent: "end",
                    alignItems: "center"
                  },
                  children: [
                    ["SYNC"].includes(u) && /* @__PURE__ */ e(
                      Z,
                      {
                        type: "submit",
                        startIcon: /* @__PURE__ */ e(x, { size: "lg", icon: Ge }),
                        color: "success",
                        size: "small",
                        variant: "contained",
                        sx: { mr: 1 },
                        children: "Start Syncing"
                      }
                    ),
                    ["DOWNLOAD"].includes(u) && /* @__PURE__ */ e(
                      Z,
                      {
                        type: "submit",
                        startIcon: /* @__PURE__ */ e(x, { size: "lg", icon: Je }),
                        color: "success",
                        size: "small",
                        variant: "contained",
                        sx: { mr: 1 },
                        children: "Download Config"
                      }
                    )
                  ]
                }
              )
            ] })
          ]
        }
      ) })
    }
  );
}
Ze.propTypes = {
  id: N.any,
  selectedFeature: N.any,
  navigationState: N.any,
  openServerSyncModal: N.any,
  openModalFunc: N.any
};
export {
  Ze as default
};
//# sourceMappingURL=ServerSyncModal-D_oFpv3C-C6c3_3lx.js.map
