import { jsx as e, jsxs as n } from "react/jsx-runtime";
import { useRef as k, useState as z, useEffect as U } from "react";
import S from "prop-types";
import { useForm as re, Controller as C } from "react-hook-form";
import { yupResolver as oe } from "@hookform/resolvers/yup";
import u from "@mui/material/Grid2";
import * as F from "yup";
import { Modal as le, Typography as O, IconButton as _, Box as c, FormControl as g, Select as de, MenuItem as J, Button as I, TableContainer as se, Paper as me, Table as ce, TableHead as fe, TableRow as R, TableCell as h, TableBody as ue, TextField as B, Stack as be } from "@mui/material";
import w from "@/views/custom-components/CustomTextField";
import { retrieveAllNotifications as he } from "@/common/services/GlobalApis";
import { showToast as pe } from "@/common/toaster/toaster";
import "./ManageEventConfiguration-BJxS2Su0.js";
import ye from "@/hooks/useTrackEvent";
import { useTranslateProvider as ge } from "@/common/languageTranslator/TranslationContext";
import { faXmark as ve, faTrash as De } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon as Y } from "@fortawesome/react-fontawesome";
const Fe = ({
  open: G,
  handleClose: H,
  handleClick: X,
  type: l
}) => {
  var j;
  const x = k(null), q = k(!1), K = ye(), [v, Q] = z([]), [r, L] = z(null), [p, A] = z(
    []
  ), [W, P] = z(0), { translate: i } = ge(), Z = (t) => {
    p && p.forEach((a, o) => {
      f(`notificationCode${o}`, ""), f(`numberOfDaysAddedForOnDate${o}`, 0), f(`numberOfDaysAddedForExpiryDate${o}`, 0), f(`numberOfDaysAddedForDueDate${o}`, 0);
    }), A((a) => {
      const o = a.filter((m, s) => s !== t);
      return o.forEach((m, s) => {
        f(`notificationCode${s}`, m.notificationCode), f(
          `numberOfDaysAddedForOnDate${s}`,
          m.numberOfDaysAddedForOnDate
        ), f(
          `numberOfDaysAddedForExpiryDate${s}`,
          m.numberOfDaysAddedForExpiryDate
        ), f(
          `numberOfDaysAddedForDueDate${s}`,
          m.numberOfDaysAddedForDueDate
        );
      }), o;
    });
  }, $ = (t, a, o) => {
    const m = [...p];
    m[t][a] = o, A(m);
  }, ee = F.object().shape({
    mobileNotificationType: F.string().required("Select notification type"),
    baseDateFieldName: F.string().required("Enter base date field"),
    familyFieldName: F.string().test(
      "is-required",
      "family name is required",
      function(t) {
        return (r == null ? void 0 : r.notificationFor) === "FAMILY" || (r == null ? void 0 : r.notificationFor) === "MEMBER" ? !!t : !0;
      }
    ),
    memberFieldName: F.string().test(
      "is-required",
      "member name is required",
      function(t) {
        return (r == null ? void 0 : r.notificationFor) === "MEMBER" ? !!t : !0;
      }
    ),
    userFieldName: F.string().test(
      "is-required",
      "user name is required",
      function(t) {
        return (r == null ? void 0 : r.notificationFor) === "USER" ? !!t : !0;
      }
    )
  }), {
    control: y,
    handleSubmit: ae,
    reset: E,
    setValue: f,
    setError: N,
    clearErrors: T,
    getValues: V,
    formState: { errors: d }
  } = re({
    defaultValues: {},
    resolver: oe(ee),
    mode: "onChange"
  });
  U(() => {
    var t;
    l && v.length > 0 && ((t = Object.keys(l)) == null || t.forEach((a) => {
      var o;
      if (a === "index" && f(a, l[a]), a === "mobileNotificationType") {
        const m = v.filter(
          (s) => s.id === parseInt(l[a])
        );
        L(...m);
      }
      a === "mobileNotificationConfigs" && l[a] ? (A(l[a] || []), P((o = l[a]) == null ? void 0 : o.length)) : l[a] && f(a, l[a]);
    }));
  }, [l, v]), U(() => {
    te();
  }, []);
  const M = () => {
    K("conversion_event", {
      form: x.current,
      form_name: "Add Mobile Type Configuration",
      submit: q.current
    }), H();
  }, te = async () => {
    try {
      const t = await he(!0);
      Q(t == null ? void 0 : t.data);
    } catch {
      pe({ message: "Error in retrieving notification", type: "error" });
    }
  }, ie = () => {
    let t = !0;
    p == null || p.forEach((a, o) => {
      if (a.notificationCode === "") {
        t = !1;
        const m = `notificationCode${o}`;
        N(m, {
          type: "manual",
          message: "Enter # of days to add"
        });
      }
    }), t && (P((a) => a + 1), A([
      ...p,
      {
        notificationCode: "",
        numberOfDaysAddedForOnDate: 0,
        numberOfDaysAddedForDueDate: 0,
        numberOfDaysAddedForExpiryDate: 0
      }
    ]));
  }, ne = (t) => {
    t = JSON.parse(JSON.stringify(t));
    for (let a = 0; a < W; a++)
      delete t[`notificationCode${a}`], delete t[`numberOfDaysAddedForOnDate${a}`], delete t[`numberOfDaysAddedForExpiryDate${a}`], delete t[`numberOfDaysAddedForDueDate${a}`];
    t.mobileNotificationConfigs = p, t.type = l == null ? void 0 : l.type, X(t), q.current = !0, M(), E();
  };
  return /* @__PURE__ */ e(
    le,
    {
      "data-testid": "mobiletypeeventconfigmodal-modal",
      open: G,
      className: "flex items-center justify-center",
      onClose: () => {
        M(), E();
      },
      sx: {
        "& .MuiBackdrop-root": {
          backgroundColor: "rgba(0, 0, 0, 0.1)"
        }
      },
      children: /* @__PURE__ */ n(
        u,
        {
          container: !0,
          className: "w-[90%] md:w-[80%]  shadow-md flex flex-col",
          sx: {
            // 1. Theme-aware background
            backgroundColor: (t) => t.palette.background.paper,
            // 2. Dynamic Border/Shadow for Dark Mode
            border: (t) => t.palette.mode === "dark" ? `1px solid ${t.palette.divider}` : "none",
            // 3. GitHub-style shadow (Soft in light, Deep in dark)
            boxShadow: (t) => t.palette.mode === "dark" ? "0 8px 24px rgba(0,0,0,0.4)" : t.shadows[2],
            // Standard MUI shadow for light mode
            borderRadius: "12px",
            // Matches your MuiCard configuration
            transition: "all 0.3s ease-in-out"
            // Keeps children inside the rounded corners
          },
          children: [
            /* @__PURE__ */ n(
              u,
              {
                className: "manageeventconfiguration-modal-header p-2.5 px-5 flex border-b",
                "data-testid": "mobiletypeeventconfigmodal-header",
                children: [
                  /* @__PURE__ */ n(O, { variant: "body1", className: "font-medium text-lg text-customBlue", children: [
                    i("Add"),
                    " ",
                    i(l == null ? void 0 : l.type),
                    " ",
                    i("Configuration")
                  ] }),
                  /* @__PURE__ */ e(
                    _,
                    {
                      size: "small",
                      onClick: () => {
                        M(), E();
                      },
                      "data-testid": "mobiletypeeventconfigmodal-close-button",
                      children: /* @__PURE__ */ e(Y, { icon: ve })
                    }
                  )
                ]
              }
            ),
            /* @__PURE__ */ n(
              "form",
              {
                onSubmit: ae(ne),
                className: "w-full",
                "data-testid": "mobiletypeeventconfigmodal-form",
                ref: x,
                children: [
                  /* @__PURE__ */ n(
                    u,
                    {
                      container: !0,
                      className: "px-[40px]  max-h-[60vh] overflow-y-auto  w-full",
                      children: [
                        /* @__PURE__ */ n(
                          u,
                          {
                            container: !0,
                            spacing: 2,
                            className: "w-full flex flex-col md:flex-row  items-start",
                            children: [
                              /* @__PURE__ */ e(
                                u,
                                {
                                  item: !0,
                                  className: "border-b border-gray-300 p-2.5 flex flex-col items-start w-full ",
                                  size: { sm: 12 },
                                  "data-testid": "mobiletypeeventconfigmodal-implicit-params",
                                  children: /* @__PURE__ */ n(c, { className: "whitespace-normal w-full break-words", children: [
                                    /* @__PURE__ */ e("strong", { children: i("Available Implicit Parameters") }),
                                    ":",
                                    " ",
                                    l == null ? void 0 : l.implicitParam
                                  ] })
                                }
                              ),
                              /* @__PURE__ */ e(u, { item: !0, className: "w-[90%] sm:w-1/4", children: /* @__PURE__ */ n(
                                g,
                                {
                                  variant: "outlined",
                                  className: "w-full",
                                  "data-testid": "mobiletypeeventconfigmodal-notification-type",
                                  children: [
                                    /* @__PURE__ */ n("div", { children: [
                                      i("Notification"),
                                      " ",
                                      i("Type")
                                    ] }),
                                    /* @__PURE__ */ n(c, { className: "w-full", children: [
                                      /* @__PURE__ */ e(
                                        C,
                                        {
                                          name: "mobileNotificationType",
                                          control: y,
                                          defaultValue: "",
                                          render: ({ field: t }) => /* @__PURE__ */ n(
                                            de,
                                            {
                                              ...t,
                                              size: "small",
                                              error: !!d.mobileNotificationType,
                                              onChange: (a) => {
                                                t.onChange(a.target.value);
                                                const o = v.filter(
                                                  (m) => m.id === a.target.value
                                                );
                                                L(...o);
                                              },
                                              className: "w-full",
                                              "data-testid": "mobiletypeeventconfigmodal-notification-select",
                                              children: [
                                                /* @__PURE__ */ e(J, { value: "", children: /* @__PURE__ */ e(O, { variant: "body2", children: i("None") }) }),
                                                v == null ? void 0 : v.map((a, o) => /* @__PURE__ */ e(J, { value: a.id, children: /* @__PURE__ */ e(O, { variant: "body2", children: a.notificationName }) }, o + 1))
                                              ]
                                            }
                                          )
                                        }
                                      ),
                                      (d == null ? void 0 : d.mobileNotificationType) && /* @__PURE__ */ e(
                                        "p",
                                        {
                                          className: "error-helper",
                                          "data-testid": "mobiletypeeventconfigmodal-notification-error",
                                          children: (j = d == null ? void 0 : d.mobileNotificationType) == null ? void 0 : j.message
                                        }
                                      )
                                    ] })
                                  ]
                                }
                              ) }),
                              /* @__PURE__ */ e(u, { item: !0, sm: 4, size: { sm: 4 }, children: /* @__PURE__ */ n(
                                g,
                                {
                                  variant: "outlined",
                                  className: " w-full",
                                  "data-testid": "mobiletypeeventconfigmodal-base-date-field",
                                  children: [
                                    /* @__PURE__ */ n("div", { children: [
                                      i("Base"),
                                      " ",
                                      i("Date"),
                                      " ",
                                      i("Field"),
                                      " ",
                                      i("Name"),
                                      /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                                    ] }),
                                    /* @__PURE__ */ e(c, { className: " w-full", children: /* @__PURE__ */ e(
                                      w,
                                      {
                                        control: y,
                                        id: "baseDateFieldName",
                                        name: "baseDateFieldName",
                                        errors: d,
                                        label: "",
                                        size: "small",
                                        dataTestId: "mobiletypeeventconfigmodal-base-date-input"
                                      }
                                    ) })
                                  ]
                                }
                              ) }),
                              /* @__PURE__ */ e(u, { item: !0, sm: 4, size: { sm: 4 }, children: /* @__PURE__ */ n(
                                g,
                                {
                                  variant: "outlined",
                                  className: " w-full",
                                  "data-testid": "mobiletypeeventconfigmodal-ref-code-field",
                                  children: [
                                    /* @__PURE__ */ n("div", { children: [
                                      i("Ref"),
                                      " ",
                                      i("Code"),
                                      " ",
                                      i("Field"),
                                      " ",
                                      i("Name")
                                    ] }),
                                    /* @__PURE__ */ e(c, { className: " w-full", children: /* @__PURE__ */ e(
                                      w,
                                      {
                                        control: y,
                                        id: "refCode",
                                        name: "refCode",
                                        errors: d,
                                        label: "",
                                        size: "small",
                                        dataTestId: "mobiletypeeventconfigmodal-ref-code-input"
                                      }
                                    ) })
                                  ]
                                }
                              ) }),
                              (r == null ? void 0 : r.notificationFor) === "USER" && /* @__PURE__ */ e(u, { item: !0, size: { xs: 4 }, children: /* @__PURE__ */ n(
                                g,
                                {
                                  variant: "outlined",
                                  className: " w-full",
                                  "data-testid": "mobiletypeeventconfigmodal-user-field",
                                  children: [
                                    /* @__PURE__ */ n("div", { children: [
                                      i("User"),
                                      " ",
                                      i("Field"),
                                      " ",
                                      i("Name"),
                                      /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                                    ] }),
                                    /* @__PURE__ */ e(c, { className: " w-full", children: /* @__PURE__ */ e(
                                      w,
                                      {
                                        control: y,
                                        id: "userFieldName",
                                        name: "userFieldName",
                                        errors: d,
                                        label: "",
                                        size: "small",
                                        dataTestId: "mobiletypeeventconfigmodal-user-input"
                                      }
                                    ) })
                                  ]
                                }
                              ) }),
                              (r == null ? void 0 : r.notificationFor) === "MEMBER" && /* @__PURE__ */ e(u, { item: !0, size: { sm: 4 }, children: /* @__PURE__ */ n(
                                g,
                                {
                                  variant: "outlined",
                                  className: " w-full",
                                  "data-testid": "mobiletypeeventconfigmodal-member-field",
                                  children: [
                                    /* @__PURE__ */ n("div", { children: [
                                      i("Member"),
                                      " ",
                                      i("Field"),
                                      " ",
                                      i("Name"),
                                      /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                                    ] }),
                                    /* @__PURE__ */ e(c, { className: " w-full", children: /* @__PURE__ */ e(
                                      w,
                                      {
                                        control: y,
                                        id: "memberFieldName",
                                        name: "memberFieldName",
                                        errors: d,
                                        label: "",
                                        size: "small",
                                        dataTestId: "mobiletypeeventconfigmodal-member-input"
                                      }
                                    ) })
                                  ]
                                }
                              ) }),
                              ((r == null ? void 0 : r.notificationFor) === "FAMILY" || (r == null ? void 0 : r.notificationFor) === "MEMBER") && /* @__PURE__ */ e(u, { item: !0, sm: 4, size: { sm: 4 }, children: /* @__PURE__ */ n(
                                g,
                                {
                                  variant: "outlined",
                                  className: " w-full",
                                  "data-testid": "mobiletypeeventconfigmodal-family-field",
                                  children: [
                                    /* @__PURE__ */ n("div", { children: [
                                      i("Family"),
                                      " ",
                                      i("Field"),
                                      " ",
                                      i("Name"),
                                      /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                                    ] }),
                                    /* @__PURE__ */ e(c, { className: " w-full", children: /* @__PURE__ */ e(
                                      w,
                                      {
                                        control: y,
                                        id: "familyFieldName",
                                        name: "familyFieldName",
                                        errors: d,
                                        label: "",
                                        size: "small",
                                        dataTestId: "mobiletypeeventconfigmodal-family-input"
                                      }
                                    ) })
                                  ]
                                }
                              ) })
                            ]
                          }
                        ),
                        /* @__PURE__ */ n(u, { container: !0, className: "mt-2.5 w-full", children: [
                          /* @__PURE__ */ e(u, { item: !0, size: { xs: 12 }, children: /* @__PURE__ */ n(
                            I,
                            {
                              variant: "contained",
                              onClick: ie,
                              "data-testid": "mobiletypeeventconfigmodal-add-configuration",
                              children: [
                                i("Add"),
                                " ",
                                i("Configuration")
                              ]
                            }
                          ) }),
                          /* @__PURE__ */ e(u, { size: { xs: 12 }, children: /* @__PURE__ */ e(
                            se,
                            {
                              component: me,
                              className: "m-2.5 w-full mobile-type-event-config-table-container",
                              "data-testid": "mobiletypeeventconfigmodal-table",
                              children: /* @__PURE__ */ n(
                                ce,
                                {
                                  size: "small",
                                  className: "mobile-type-event-config-table",
                                  "aria-label": "mobile notification configuration table",
                                  children: [
                                    /* @__PURE__ */ e(fe, { children: /* @__PURE__ */ n(R, { children: [
                                      /* @__PURE__ */ e(h, { children: i("Code") }),
                                      /* @__PURE__ */ n(h, { children: [
                                        i("Added"),
                                        " ",
                                        i("Days"),
                                        " ",
                                        i("For"),
                                        " ",
                                        i("Schedule")
                                      ] }),
                                      /* @__PURE__ */ n(h, { children: [
                                        i("Added"),
                                        " ",
                                        i("Days"),
                                        " ",
                                        i("For"),
                                        " ",
                                        i("Due")
                                      ] }),
                                      /* @__PURE__ */ n(h, { children: [
                                        i("Added"),
                                        " ",
                                        i("Days"),
                                        " ",
                                        i("For"),
                                        " ",
                                        i("Expiry")
                                      ] }),
                                      /* @__PURE__ */ e(h, { children: i("Actions") })
                                    ] }) }),
                                    /* @__PURE__ */ e(ue, { children: p.length > 0 ? p.map((t, a) => {
                                      var o, m;
                                      return /* @__PURE__ */ n(R, { children: [
                                        /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(
                                          g,
                                          {
                                            variant: "outlined",
                                            className: " w-full",
                                            children: /* @__PURE__ */ n(c, { className: " w-full", children: [
                                              /* @__PURE__ */ e(
                                                C,
                                                {
                                                  control: y,
                                                  name: `notificationCode${a}`,
                                                  defaultValue: t.notificationCode,
                                                  render: ({ field: s }) => /* @__PURE__ */ e(
                                                    B,
                                                    {
                                                      required: !0,
                                                      variant: "outlined",
                                                      size: "small",
                                                      ...s,
                                                      error: !!d[`notificationCode${a}`],
                                                      onChange: (b) => {
                                                        f(
                                                          `notificationCode${a}`,
                                                          b.target.value
                                                        ), $(
                                                          a,
                                                          "notificationCode",
                                                          b.target.value
                                                        );
                                                        const D = `notificationCode${a}`;
                                                        V(D) === "" ? N(D, {
                                                          type: "manual",
                                                          message: "Enter # of days to add"
                                                        }) : T(D);
                                                      },
                                                      placeholder: "Enter # of days to add",
                                                      onBlur: () => {
                                                        s.value === "" ? N(
                                                          `notificationCode${a}`,
                                                          {
                                                            type: "manual",
                                                            message: "Enter # of days to add"
                                                          }
                                                        ) : T(
                                                          `notificationCode${a}`
                                                        );
                                                      },
                                                      "data-testid": `mobiletypeeventconfigmodal-notification-code-input-${a}`
                                                    }
                                                  )
                                                }
                                              ),
                                              d[`notificationCode${a}`] && /* @__PURE__ */ e(
                                                "p",
                                                {
                                                  className: "error-helper-table",
                                                  "data-testid": `mobiletypeeventconfigmodal-notification-code-error-${a}`,
                                                  children: (o = d[`notificationCode${a}`]) == null ? void 0 : o.message
                                                }
                                              )
                                            ] })
                                          }
                                        ) }) }),
                                        /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(
                                          g,
                                          {
                                            variant: "outlined",
                                            className: " w-full",
                                            children: /* @__PURE__ */ n(c, { className: " w-full", children: [
                                              /* @__PURE__ */ e(
                                                C,
                                                {
                                                  control: y,
                                                  name: `numberOfDaysAddedForOnDate${a}`,
                                                  defaultValue: t.numberOfDaysAddedForOnDate,
                                                  render: ({ field: s }) => /* @__PURE__ */ e(
                                                    B,
                                                    {
                                                      required: !0,
                                                      type: "number",
                                                      variant: "outlined",
                                                      size: "small",
                                                      ...s,
                                                      error: !!d[`numberOfDaysAddedForOnDate${a}`],
                                                      onChange: (b) => {
                                                        f(
                                                          `numberOfDaysAddedForOnDate${a}`,
                                                          b.target.value
                                                        ), $(
                                                          a,
                                                          "numberOfDaysAddedForOnDate",
                                                          Number(b.target.value)
                                                        );
                                                        const D = `numberOfDaysAddedForOnDate${a}`;
                                                        V(D) === "" ? N(D, {
                                                          type: "manual",
                                                          message: "Enter # of days to add"
                                                        }) : T(D);
                                                      },
                                                      placeholder: "Enter # of days to add",
                                                      onBlur: () => {
                                                        s.value === "" ? N(
                                                          `numberOfDaysAddedForOnDate${a}`,
                                                          {
                                                            type: "manual",
                                                            message: "Enter # of days to add"
                                                          }
                                                        ) : T(
                                                          `numberOfDaysAddedForOnDate${a}`
                                                        );
                                                      },
                                                      "data-testid": `mobiletypeeventconfigmodal-on-date-input-${a}`
                                                    }
                                                  )
                                                }
                                              ),
                                              d[`numberOfDaysAddedForOnDate${a}`] && /* @__PURE__ */ e(
                                                "p",
                                                {
                                                  className: "error-helper-table",
                                                  "data-testid": `mobiletypeeventconfigmodal-on-date-error-${a}`,
                                                  children: (m = d[`numberOfDaysAddedForOnDate${a}`]) == null ? void 0 : m.message
                                                }
                                              )
                                            ] })
                                          }
                                        ) }) }),
                                        /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(
                                          g,
                                          {
                                            variant: "outlined",
                                            className: " w-full",
                                            children: /* @__PURE__ */ e(c, { className: " w-full", children: /* @__PURE__ */ e(
                                              C,
                                              {
                                                control: y,
                                                name: `numberOfDaysAddedForDueDate${a}`,
                                                defaultValue: t.numberOfDaysAddedForDueDate,
                                                render: ({ field: s }) => /* @__PURE__ */ e(
                                                  B,
                                                  {
                                                    variant: "outlined",
                                                    size: "small",
                                                    type: "number",
                                                    ...s,
                                                    onChange: (b) => {
                                                      f(
                                                        `numberOfDaysAddedForDueDate${a}`,
                                                        b.target.value
                                                      ), $(
                                                        a,
                                                        "numberOfDaysAddedForDueDate",
                                                        Number(b.target.value)
                                                      );
                                                    },
                                                    "data-testid": `mobiletypeeventconfigmodal-due-date-input-${a}`
                                                  }
                                                )
                                              }
                                            ) })
                                          }
                                        ) }) }),
                                        /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(
                                          g,
                                          {
                                            variant: "outlined",
                                            className: " w-full",
                                            children: /* @__PURE__ */ e(c, { className: " w-full", children: /* @__PURE__ */ e(
                                              C,
                                              {
                                                control: y,
                                                name: `numberOfDaysAddedForExpiryDate${a}`,
                                                defaultValue: t.numberOfDaysAddedForExpiryDate,
                                                render: ({ field: s }) => /* @__PURE__ */ e(
                                                  B,
                                                  {
                                                    variant: "outlined",
                                                    type: "number",
                                                    size: "small",
                                                    ...s,
                                                    onChange: (b) => {
                                                      f(
                                                        `numberOfDaysAddedForExpiryDate${a}`,
                                                        b.target.value
                                                      ), $(
                                                        a,
                                                        "numberOfDaysAddedForExpiryDate",
                                                        Number(b.target.value)
                                                      );
                                                    },
                                                    "data-testid": `mobiletypeeventconfigmodal-expiry-date-input-${a}`
                                                  }
                                                )
                                              }
                                            ) })
                                          }
                                        ) }) }),
                                        /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(
                                          _,
                                          {
                                            color: "error",
                                            onClick: () => Z(a),
                                            "data-testid": `mobiletypeeventconfigmodal-delete-button-${a}`,
                                            children: /* @__PURE__ */ e(Y, { icon: De })
                                          }
                                        ) })
                                      ] }, a + 1);
                                    }) : /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(h, { colSpan: 5, children: /* @__PURE__ */ e(
                                      O,
                                      {
                                        align: "center",
                                        "data-testid": "mobiletypeeventconfigmodal-no-config",
                                        children: "No Mobile Configuration added"
                                      }
                                    ) }) }) })
                                  ]
                                }
                              )
                            }
                          ) })
                        ] })
                      ]
                    }
                  ),
                  /* @__PURE__ */ n(
                    be,
                    {
                      direction: "row",
                      className: "mr-5",
                      spacing: 2,
                      justifyContent: "flex-end",
                      mt: 1,
                      mb: 1,
                      children: [
                        /* @__PURE__ */ e(
                          I,
                          {
                            variant: "contained",
                            color: "secondary",
                            onClick: () => {
                              M(), E();
                            },
                            "data-testid": "mobiletypeeventconfigmodal-close-button",
                            children: /* @__PURE__ */ e(O, { variant: "body2", children: i("Cancel") })
                          }
                        ),
                        /* @__PURE__ */ e(
                          I,
                          {
                            type: "submit",
                            variant: "contained",
                            color: "primary",
                            "data-testid": "mobiletypeeventconfigmodal-submit-button",
                            children: i("Submit")
                          }
                        )
                      ]
                    }
                  )
                ]
              }
            )
          ]
        }
      )
    }
  );
};
Fe.propTypes = {
  open: S.any,
  handleClose: S.any,
  handleClick: S.any,
  type: S.any
};
export {
  Fe as default
};
//# sourceMappingURL=MobileTypeEventConfigModal-ChhO_A4f.js.map
