import { jsx as e, jsxs as o, Fragment as Pe } from "react/jsx-runtime";
import R, { useRef as H, useState as K, useEffect as ae, memo as Oe, forwardRef as ce } from "react";
import Y from "prop-types";
import { useForm as Re, Controller as T } from "react-hook-form";
import { yupResolver as Ve } from "@hookform/resolvers/yup";
import c from "@mui/material/Grid2";
import * as S from "yup";
import { useTheme as Ae, Modal as Ue, Typography as h, IconButton as Le, Box as b, FormControl as v, Select as A, MenuItem as E, FormControlLabel as L, Checkbox as D, TextField as Z, Stack as De, Button as oe } from "@mui/material";
import ee from "@/views/custom-components/CustomTextArea";
import F from "@/views/custom-components/CustomTextField";
import { retrieveAllConfigured as We, execute as se, getNotificationTypeList as je } from "@/common/services/GlobalApis";
import { showToast as qe } from "@/common/toaster/toaster";
import Je from "@/hooks/useTrackEvent";
import "./ManageEventConfiguration-BJxS2Su0-CRATBMym.js";
import { useTranslateProvider as Ke } from "@/common/languageTranslator/TranslationContext";
import { faXmark as Ye } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon as He } from "@fortawesome/react-fontawesome";
import Be from "@/views/custom-components/CkEditor/CkEditor";
function Qe() {
  const l = {
    resolve: null,
    promise: null
  };
  return l.promise = new Promise((r) => {
    l.resolve = r;
  }), l;
}
function Xe(l) {
  let r = null;
  return (...n) => (r || (r = {
    current: l(...n)
  }), r.current);
}
const k = new Array(256).fill("").map((l, r) => ("0" + r.toString(16)).slice(-2));
function Ge() {
  const [l, r, n, a] = crypto.getRandomValues(new Uint32Array(4));
  return "e" + k[l >> 0 & 255] + k[l >> 8 & 255] + k[l >> 16 & 255] + k[l >> 24 & 255] + k[r >> 0 & 255] + k[r >> 8 & 255] + k[r >> 16 & 255] + k[r >> 24 & 255] + k[n >> 0 & 255] + k[n >> 8 & 255] + k[n >> 16 & 255] + k[n >> 24 & 255] + k[a >> 0 & 255] + k[a >> 8 & 255] + k[a >> 16 & 255] + k[a >> 24 & 255];
}
function ue(l) {
  return !!l && /^\d+\.\d+\.\d+/.test(l);
}
function Ze(l) {
  if (!ue(l))
    throw new Error(`Invalid semantic version: ${l || "<blank>"}.`);
  const [r, n, a] = l.split(".");
  return {
    major: Number.parseInt(r, 10),
    minor: Number.parseInt(n, 10),
    patch: Number.parseInt(a, 10)
  };
}
function me(l) {
  return l ? ["nightly", "alpha", "internal", "nightly-", "staging"].some((r) => l.includes(r)) : !1;
}
function et(l) {
  return ue(l) || me(l);
}
function tt(l, r) {
  const n = l.extraPlugins || [];
  return {
    ...l,
    extraPlugins: [
      ...n,
      ...r.filter((a) => !n.includes(a))
    ]
  };
}
function at(l) {
  if (me(l))
    return 3;
  const { major: r } = Ze(l);
  switch (!0) {
    case r >= 44:
      return 3;
    case r >= 38:
      return 2;
    default:
      return 1;
  }
}
function rt() {
  const { CKEDITOR_VERSION: l, CKEDITOR: r } = window;
  return et(l) ? {
    source: r ? "cdn" : "npm",
    version: l
  } : null;
}
function it() {
  const l = rt();
  return l ? at(l.version) : null;
}
function he(l, r) {
  switch (r || (r = it() || void 0), r) {
    case 1:
    case 2:
      return l === void 0;
    case 3:
      return l === "GPL";
    default:
      return !1;
  }
}
function lt(l, r) {
  return function(n) {
    he(n.config.get("licenseKey")) || n.on("collectUsageData", (a, { setUsageData: m }) => {
      m(`integration.${l}`, r);
    });
  };
}
var nt = Object.defineProperty, ot = (l, r, n) => r in l ? nt(l, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : l[r] = n, _ = (l, r, n) => ot(l, typeof r != "symbol" ? r + "" : r, n);
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const pe = class fe {
  constructor(r, n) {
    _(this, "_lifecycle"), _(this, "_element"), _(this, "_releaseLock", null), _(this, "_value", null), _(this, "_afterMountCallbacks", []), _(this, "_state", {
      destroyedBeforeInitialization: !1,
      mountingInProgress: null
    }), _(this, "release", Xe(() => {
      const { _releaseLock: a, _state: m, _element: x, _lifecycle: f } = this;
      m.mountingInProgress ? m.mountingInProgress.then(() => f.unmount({
        element: x,
        // Mount result might be overridden by watchdog during restart so use instance variable.
        mountResult: this.value
      })).catch((p) => {
        console.error("Semaphore unmounting error:", p);
      }).then(a.resolve).then(() => {
        this._value = null;
      }) : (m.destroyedBeforeInitialization = !0, a.resolve());
    })), this._element = r, this._lifecycle = n, this._lock();
  }
  /**
   * Getter for {@link #_value}.
   */
  get value() {
    return this._value;
  }
  /**
   * Occasionally, the Watchdog restarts the editor instance, resulting in a new instance being assigned to the semaphore.
   * In terms of race conditions, it's generally safer to simply override the semaphore value rather than recreating it
   * with a different one.
   */
  unsafeSetValue(r) {
    this._value = r, this._afterMountCallbacks.forEach((n) => n(r)), this._afterMountCallbacks = [];
  }
  /**
   * This registers a callback that will be triggered after the editor has been successfully mounted.
   *
   * 	* If the editor is already mounted, the callback will be executed immediately.
   *	* If the editor is in the process of mounting, the callback will be executed upon successful mounting.
  * 	* If the editor is never mounted, the passed callback will not be executed.
  * 	* If an exception is thrown within the callback, it will be re-thrown in the semaphore.
  */
  runAfterMount(r) {
    const { _value: n, _afterMountCallbacks: a } = this;
    n ? r(n) : a.push(r);
  }
  /**
   * This method is used to inform other components that the {@link #_element} will be used by the editor,
   * which is initialized by the {@link #_lifecycle} methods.
   *
   * 	* If an editor is already present on the provided element, the initialization of the current one
   * 	  will be postponed until the previous one is destroyed.
   *
   * 	* If the element is empty and does not have an editor attached to it, the currently locked editor will
   * 	  be mounted immediately.
   *
   * After the successful initialization of the editor and the assignment of the {@link #_value} member,
   * the `onReady` lifecycle method is called.
   *
   * *Important note:*
   *
   * It’s really important to keep this method *sync*. If we make this method *async*, it won’t work well because
   * it will cause problems when we’re trying to set up the {@link LifeCycleEditorElementSemaphore#_semaphores} map entries.
   */
  _lock() {
    const { _semaphores: r } = fe, { _state: n, _element: a, _lifecycle: m } = this, x = r.get(a) || Promise.resolve(null), f = Qe();
    this._releaseLock = f;
    const p = x.then(() => n.destroyedBeforeInitialization ? Promise.resolve(void 0) : (n.mountingInProgress = m.mount().then((C) => (C && this.unsafeSetValue(C), C)), n.mountingInProgress)).then(async (C) => {
      C && m.afterMount && await m.afterMount({
        element: a,
        mountResult: C
      });
    }).then(() => f.promise).catch((C) => {
      console.error("Semaphore mounting error:", C);
    }).then(() => {
      r.get(a) === p && r.delete(a);
    });
    r.set(a, p);
  }
};
_(pe, "_semaphores", /* @__PURE__ */ new Map());
let st = pe;
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const dt = "$__CKEditorReactContextMetadata";
function ct(l, r) {
  return {
    ...r,
    [dt]: l
  };
}
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const ut = R.createContext(null), mt = (l) => !!l && typeof l == "object" && "status" in l && ["initializing", "initialized", "error"].includes(l.status), ye = (l) => (r) => mt(r) && r.status === l, de = ye("initializing"), ht = (l) => ye("initialized")(l) && l.watchdog.state === "ready";
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const pt = lt(
  "react",
  {
    version: "9.5.0",
    frameworkVersion: R.version
  }
);
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
function ft(l) {
  return he(l.licenseKey) ? l : tt(l, [
    /**
     * This part of the code is not executed in open-source implementations using a GPL key.
     * It only runs when a specific license key is provided. If you are uncertain whether
     * this applies to your installation, please contact our support team.
     */
    pt
  ]);
}
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const te = "Lock from React integration (@ckeditor/ckeditor5-react)";
class ve extends R.Component {
  constructor(r) {
    super(r), _(this, "domContainer", R.createRef()), _(this, "editorSemaphore", null), this._checkVersion();
  }
  /**
   * Checks if the CKEditor version used in the application is compatible with the component.
   */
  _checkVersion() {
    const { CKEDITOR_VERSION: r } = window;
    if (!r)
      return console.warn('Cannot find the "CKEDITOR_VERSION" in the "window" scope.');
    const [n] = r.split(".").map(Number);
    n >= 42 || r.startsWith("0.0.0") || console.warn("The <CKEditor> component requires using CKEditor 5 in version 42+ or nightly build.");
  }
  get _semaphoreValue() {
    const { editorSemaphore: r } = this;
    return r ? r.value : null;
  }
  /**
   * An watchdog instance.
   */
  get watchdog() {
    const { _semaphoreValue: r } = this;
    return r ? r.watchdog : null;
  }
  /**
   * An editor instance.
   */
  get editor() {
    const { _semaphoreValue: r } = this;
    return r ? r.instance : null;
  }
  /**
   * The CKEditor component should not be updated by React itself.
   * However, if the component identifier changes, the whole structure should be created once again.
   */
  shouldComponentUpdate(r) {
    const { props: n, editorSemaphore: a } = this;
    return r.id !== n.id || r.disableWatchdog !== n.disableWatchdog ? !0 : (a && (a.runAfterMount(({ instance: m }) => {
      this._shouldUpdateEditorData(n, r, m) && m.data.set(r.data);
    }), "disabled" in r && a.runAfterMount(({ instance: m }) => {
      r.disabled ? m.enableReadOnlyMode(te) : m.disableReadOnlyMode(te);
    })), !1);
  }
  /**
   * Initialize the editor when the component is mounted.
   */
  componentDidMount() {
    de(this.context) || this._initLifeCycleSemaphore();
  }
  /**
   * Re-render the entire component once again. The old editor will be destroyed and the new one will be created.
   */
  componentDidUpdate() {
    de(this.context) || this._initLifeCycleSemaphore();
  }
  /**
   * Destroy the editor before unmounting the component.
   */
  componentWillUnmount() {
    this._unlockLifeCycleSemaphore();
  }
  /**
   * Async destroy attached editor and unlock element semaphore.
   */
  _unlockLifeCycleSemaphore() {
    this.editorSemaphore && (this.editorSemaphore.release(), this.editorSemaphore = null);
  }
  /**
   * Unlocks previous editor semaphore and creates new one..
   */
  _initLifeCycleSemaphore() {
    this._unlockLifeCycleSemaphore(), this.editorSemaphore = new st(this.domContainer.current, {
      mount: async () => this._initializeEditor(),
      afterMount: ({ mountResult: r }) => {
        const { onReady: n } = this.props;
        n && this.domContainer.current !== null && n(r.instance);
      },
      unmount: async ({ element: r, mountResult: n }) => {
        const { onAfterDestroy: a } = this.props;
        try {
          await this._destroyEditor(n), r.innerHTML = "";
        } finally {
          a && a(n.instance);
        }
      }
    });
  }
  /**
   * Render a <div> element which will be replaced by CKEditor.
   */
  render() {
    return /* @__PURE__ */ R.createElement("div", { ref: this.domContainer });
  }
  /**
   * Initializes the editor by creating a proper watchdog and initializing it with the editor's configuration.
   */
  async _initializeEditor() {
    if (this.props.disableWatchdog)
      return {
        instance: await this._createEditor(this.domContainer.current, this._getConfig()),
        watchdog: null
      };
    const r = ht(this.context) ? new yt(this.context.watchdog) : new this.props.editor.EditorWatchdog(this.props.editor, this.props.watchdogConfig), n = {
      current: 0
    };
    return r.setCreator(async (a, m) => {
      var x;
      const { editorSemaphore: f } = this, { onAfterDestroy: p } = this.props;
      n.current > 0 && p && (x = f == null ? void 0 : f.value) != null && x.instance && p(f.value.instance);
      const C = await this._createEditor(a, m);
      return f && n.current > 0 && (f.unsafeSetValue({
        instance: C,
        watchdog: r
      }), setTimeout(() => {
        this.props.onReady && this.props.onReady(r.editor);
      })), n.current++, C;
    }), r.on("error", (a, { error: m, causesRestart: x }) => {
      (this.props.onError || console.error)(m, { phase: "runtime", willEditorRestart: x });
    }), await r.create(this.domContainer.current, this._getConfig()).catch((a) => {
      (this.props.onError || console.error)(a, { phase: "initialization", willEditorRestart: !1 });
    }), {
      watchdog: r,
      instance: r.editor
    };
  }
  /**
   * Creates an editor from the element and configuration.
   *
   * @param element The source element.
   * @param config CKEditor 5 editor configuration.
   */
  _createEditor(r, n) {
    const { contextItemMetadata: a } = this.props;
    return a && (n = ct(a, n)), this.props.editor.create(
      r,
      ft(n)
    ).then((m) => {
      if ("disabled" in this.props) {
        /* istanbul ignore else -- @preserve */
        this.props.disabled && m.enableReadOnlyMode(te);
      }
      const x = m.model.document, f = m.editing.view.document;
      return x.on("change:data", (p) => {
        /* istanbul ignore else -- @preserve */
        this.props.onChange && this.props.onChange(p, m);
      }), f.on("focus", (p) => {
        /* istanbul ignore else -- @preserve */
        this.props.onFocus && this.props.onFocus(p, m);
      }), f.on("blur", (p) => {
        /* istanbul ignore else -- @preserve */
        this.props.onBlur && this.props.onBlur(p, m);
      }), m;
    });
  }
  /**
   * Destroys the editor by destroying the watchdog.
   */
  async _destroyEditor(r) {
    const { watchdog: n, instance: a } = r;
    return new Promise((m, x) => {
      /* istanbul ignore next -- @preserve */
      setTimeout(async () => {
        try {
          if (n)
            return await n.destroy(), m();
          if (a)
            return await a.destroy(), m();
          m();
        } catch (f) {
          console.error(f), x(f);
        }
      });
    });
  }
  /**
   * Returns true when the editor should be updated.
   *
   * @param prevProps Previous react's properties.
   * @param nextProps React's properties.
   * @param editor Current editor instance.
   */
  _shouldUpdateEditorData(r, n, a) {
    return !(r.data === n.data || a.data.get() === n.data);
  }
  /**
   * Returns the editor configuration.
   */
  _getConfig() {
    const r = this.props.config || {};
    return this.props.data && r.initialData && console.warn(
      "Editor data should be provided either using `config.initialData` or `content` property. The config value takes precedence over `content` property and will be used when both are specified."
    ), {
      ...r,
      initialData: r.initialData || this.props.data || ""
    };
  }
}
_(ve, "contextType", ut);
class yt {
  /**
   * @param contextWatchdog The context watchdog instance that will be wrapped into editor watchdog API.
   */
  constructor(r) {
    _(this, "_contextWatchdog"), _(this, "_id"), _(this, "_creator"), this._contextWatchdog = r, this._id = Ge();
  }
  /**
   *  @param creator A watchdog's editor creator function.
   */
  setCreator(r) {
    this._creator = r;
  }
  /**
   * Adds an editor configuration to the context watchdog registry. Creates an instance of it.
   *
   * @param sourceElementOrData A source element or data for the new editor.
   * @param config CKEditor 5 editor config.
   */
  create(r, n) {
    return this._contextWatchdog.add({
      sourceElementOrData: r,
      config: n,
      creator: this._creator,
      id: this._id,
      type: "editor"
    });
  }
  /**
   * Creates a listener that is attached to context watchdog's item and run when the context watchdog fires.
   * Currently works only for the `error` event.
   */
  on(r, n) {
    this._contextWatchdog.on("itemError", (a, { itemId: m, error: x }) => {
      m === this._id && n(null, { error: x, causesRestart: void 0 });
    });
  }
  destroy() {
    return this._contextWatchdog.state === "ready" ? this._contextWatchdog.remove(this._id) : Promise.resolve();
  }
  /**
   * An editor instance.
   */
  get editor() {
    return this._contextWatchdog.getItem(this._id);
  }
}
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
function ge(...l) {
  return (r) => {
    l.forEach((n) => {
      typeof n == "function" ? n(r) : n != null && (n.current = r);
    });
  };
}
const vt = Oe(ce(({ id: l, semaphore: r, rootName: n }, a) => {
  const m = H(null);
  return ae(() => {
    let x, f;
    return r.runAfterMount(({ instance: p }) => {
      if (!m.current)
        return;
      f = p;
      const { ui: C, model: W } = f, U = W.document.getRoot(n);
      U && f.ui.getEditableElement(n) && f.detachEditable(U), x = C.view.createEditable(n, m.current), C.addEditable(x), p.editing.view.forceRender();
    }), () => {
      if (f && f.state !== "destroyed" && m.current) {
        const p = f.model.document.getRoot(n);
        /* istanbul ignore else -- @preserve */
        p && f.detachEditable(p);
      }
    };
  }, [r.revision]), /* @__PURE__ */ R.createElement(
    "div",
    {
      key: r.revision,
      id: l,
      ref: ge(a, m)
    }
  );
}));
vt.displayName = "EditorEditable";
const gt = ce(({ editor: l }, r) => {
  const n = H(null);
  return ae(() => {
    const a = n.current;
    if (!l || !a)
      return;
    const m = l.ui.view.toolbar.element;
    return a.appendChild(m), () => {
      a.contains(m) && a.removeChild(m);
    };
  }, [l && l.id]), /* @__PURE__ */ R.createElement("div", { ref: ge(n, r) });
});
gt.displayName = "EditorToolbarWrapper";
const Nt = ({
  open: l,
  handleClose: r,
  handleClick: n,
  type: a
}) => {
  var m, x, f;
  const p = Ae(), C = p.palette.mode === "dark", W = H(null), U = H(!1), Ne = Je(), [j, be] = K([]), [B, we] = K([]), [Q, xe] = K([]), { translate: d } = Ke(), [X, Ce] = K([]), ke = S.object().shape({
    excetionTypes: S.string().test(
      "is-required",
      "Execution type is required",
      function(t) {
        return (a == null ? void 0 : a.type) === "EXCEPTION" ? !!t : !0;
      }
    ),
    mobileNumberFieldName: S.string().test(
      "is-required",
      "Enter Sms contact number field name",
      function(t) {
        return (a == null ? void 0 : a.type) === "SMS" ? !!t : !0;
      }
    ),
    smsTypeField: S.string().test(
      "is-required",
      "Enter Sms Type Field",
      function(t) {
        return (a == null ? void 0 : a.type) === "SMS" ? !!t : !0;
      }
    ),
    trigerWhen: S.string().test(
      "is-required",
      "trigerWhen is required",
      function(t) {
        return (a == null ? void 0 : a.type) != "EXCEPTION" && (a == null ? void 0 : a.type) != "SYSTEM_FUNCTION" ? !!t : !0;
      }
    ),
    baseDateFieldName: S.string().test(
      "is-required",
      "Enter Email Id field name",
      function(t) {
        return (a == null ? void 0 : a.type) === "EMAIL" ? !!t : !0;
      }
    ),
    emailSubject: S.string().test(
      "is-required",
      "Enter email subject",
      function(t) {
        return (a == null ? void 0 : a.type) === "EMAIL" ? !!t : !0;
      }
    ),
    notificationTypeId: S.string().test(
      "is-required",
      "Select type",
      function(t) {
        return (a == null ? void 0 : a.type) === "PUSH_NOTIFICATION" ? !!t : !0;
      }
    ),
    userFieldName: S.string().test(
      "is-required",
      "Enter User Id field name",
      function(t) {
        return (a == null ? void 0 : a.type) === "PUSH_NOTIFICATION" ? !!t : !0;
      }
    ),
    heading: S.string().test(
      "is-required",
      "Enter heading",
      function(t) {
        return (a == null ? void 0 : a.type) === "PUSH_NOTIFICATION" && G ? !!t : !0;
      }
    ),
    template: S.string().test(
      "is-required",
      "Enter Template",
      function(t) {
        return (a == null ? void 0 : a.type) === "PUSH_NOTIFICATION" && G ? !!t : !0;
      }
    )
  }), {
    control: g,
    handleSubmit: Ie,
    reset: q,
    setValue: N,
    unregister: re,
    getValues: ie,
    watch: $,
    formState: { errors: y }
  } = Re({
    defaultValues: {},
    resolver: Ve(ke),
    mode: "onChange"
  });
  ae(() => {
    var t;
    a && (ze(), (t = Object.keys(a)) == null || t.forEach((i) => {
      var s, u, w;
      if (i === "index" && N(i, a[i]), i === "smsConfigJson" && a[i]) {
        const I = a[i];
        (s = Object.keys(I)) == null || s.forEach((P) => {
          N(P, I[P]);
        });
      } else if (i === "pushNotificationConfigJson" && a[i]) {
        const I = a[i];
        (u = Object.keys(I)) == null || u.forEach((P) => {
          N(P, I[P]);
        });
      } else if (i === "kafkaConfigJson" && a[i]) {
        const I = a[i];
        (w = Object.keys(I)) == null || w.forEach((P) => {
          N(P, I[P]);
        });
      } else a[i] !== void 0 && a[i] !== null && N(i, a[i]);
    }));
  }, [a]);
  const z = $("queryMasterParamJson"), le = $("queryCode"), Ee = $("systemFunctionId"), M = $("functionParams"), Te = $("trigerWhen"), G = $("notificationTypeId"), O = $("kafkaParameterJson"), ne = $("formType"), _e = async (t) => {
    var i;
    z && z.forEach((w, I) => {
      N(`${w.parameterName}${I}`, ""), N(`${w.parameterName}${I}isFixed`, !1);
    });
    let s = [];
    const u = j == null ? void 0 : j.find((w) => (w == null ? void 0 : w.code) === t);
    if (u) {
      const w = (i = u == null ? void 0 : u.params) == null ? void 0 : i.split(",");
      Array.from(new Set(w)).forEach((I) => {
        s.push({ parameterName: I });
      });
    }
    N("queryMasterParamJson", s);
  }, Se = (t) => {
    M && M.forEach((u, w) => {
      N(`${u.parameterName}${w}`, ""), N(`${u.parameterName}${w}isFixed`, !1);
    });
    let i = [];
    const s = B.find((u) => u.id === t);
    s && Array.from(new Set(s.parameters)).forEach((u) => {
      i.push(u);
    }), N("functionParams", i);
  }, Fe = (t) => {
    const i = X.find(
      (s) => s.id === t
    );
    i && (N("notificationType", i), N("template", i.message), N("heading", i.heading));
  }, V = (t, i, s) => {
    if ((a == null ? void 0 : a.type) === "QUERY") {
      const u = [...z];
      u[t][i] = s, N("queryMasterParamJson", u);
    }
    if ((a == null ? void 0 : a.type) === "SYSTEM_FUNCTION") {
      const u = [...M];
      u[t][i] = s, N("functionParams", u);
    }
    if ((a == null ? void 0 : a.type) === "KAFKA_SYNC") {
      const u = [...O];
      u[t][i] = s, N("kafkaParameterJson", u);
    }
  }, $e = (t) => {
    const i = ie("kafkaParameterJson");
    i && Array.isArray(i) && (i.forEach((u, w) => {
      re(`${u.parameterName}${w}`), re(`${u.parameterName}${w}isFixed`);
    }), N("kafkaParameterJson", [], { shouldValidate: !0 }));
    const s = Q.find(
      (u) => u.form_type === t
    );
    if (s && s.param_types) {
      const u = JSON.parse(s.param_types), w = Object.keys(u).map((I) => ({
        parameterName: I,
        mappingValue: "",
        isFixed: !1
      }));
      N("kafkaParameterJson", w, { shouldValidate: !0 });
    } else
      N("kafkaParameterJson", [], { shouldValidate: !0 });
  }, ze = async () => {
    var t, i;
    try {
      if ((a == null ? void 0 : a.type) === "QUERY") {
        const s = await We(!0);
        be(s == null ? void 0 : s.data);
      }
      if ((a == null ? void 0 : a.type) === "SYSTEM_FUNCTION") {
        const s = await se({
          code: "system_function_retrieve_all",
          parameters: {}
        }), u = (t = s == null ? void 0 : s.data) == null ? void 0 : t.result.map((w) => (w.parameters = JSON.parse(w.parameters), w));
        we(u);
      }
      if ((a == null ? void 0 : a.type) === "PUSH_NOTIFICATION") {
        const s = await je();
        Ce(s == null ? void 0 : s.data);
      }
      if ((a == null ? void 0 : a.type) === "KAFKA_SYNC") {
        const s = await se({
          code: "retrieve_all_kafka_configs",
          parameters: {}
        });
        xe(((i = s == null ? void 0 : s.data) == null ? void 0 : i.result) || []);
      }
    } catch {
      qe({ message: "Error in loading", type: "error" });
    }
  }, J = () => {
    Ne("conversion_event", {
      form: W.current,
      form_name: "Add Other Type Configuration",
      submit: U.current
    }), r();
  }, Me = (t) => {
    t = JSON.parse(JSON.stringify(t)), t.minute = Number(t.minute || 0), t.type = a == null ? void 0 : a.type, a.type === "SMS" && (t.smsConfigJson = {
      mobileNumberFieldName: t.mobileNumberFieldName,
      isPriority: t.isPriority,
      isSmsTypeFixed: t.isSmsTypeFixed,
      smsTypeField: t.smsTypeField
    }, delete t.mobileNumberFieldName, delete t.isPriority, delete t.isSmsTypeFixed, delete t.smsTypeField), a.type === "PUSH_NOTIFICATION" && (t.pushNotificationConfigJson = {
      notificationTypeId: t.notificationTypeId,
      userFieldName: t.userFieldName,
      heading: t.heading,
      template: t.template
    }, delete t.notificationTypeId, delete t.userFieldName, delete t.heading, delete t.template), a.type === "KAFKA_SYNC" && (t.kafkaConfigJson = {
      formType: t.formType,
      kafkaParameterJson: t.kafkaParameterJson
    }), z == null || z.forEach((i, s) => {
      delete t[`${i == null ? void 0 : i.parameterName}${s}`], delete t[`${i == null ? void 0 : i.parameterName}${s}isFixed`];
    }), M == null || M.forEach((i, s) => {
      delete t[`${i == null ? void 0 : i.parameterName}${s}`], delete t[`${i == null ? void 0 : i.parameterName}${s}isFixed`];
    }), O == null || O.forEach((i, s) => {
      delete t[`${i == null ? void 0 : i.parameterName}${s}`], delete t[`${i == null ? void 0 : i.parameterName}${s}isFixed`];
    }), n(t), U.current = !0, J(), q();
  };
  return /* @__PURE__ */ e(
    Ue,
    {
      "data-testid": "othertypeeventconfigmodal-modal",
      open: l,
      className: "flex items-center justify-center",
      onClose: () => {
        J(), q();
      },
      sx: {
        "& .MuiBackdrop-root": {
          backgroundColor: "rgba(0, 0, 0, 0.1)"
        }
      },
      children: /* @__PURE__ */ o(
        c,
        {
          container: !0,
          className: "w-[90%] md:w-[80%] 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__ */ o(
              c,
              {
                className: "manageeventconfiguration-modal-header p-2.5 px-5 flex border-b",
                "data-testid": "othertypeeventconfigmodal-modal-header",
                children: [
                  /* @__PURE__ */ o(
                    h,
                    {
                      variant: "body1",
                      className: "font-medium text-lg text-customBlue",
                      children: [
                        d("Add"),
                        " ",
                        d(a == null ? void 0 : a.type),
                        " ",
                        d("Configuration")
                      ]
                    }
                  ),
                  /* @__PURE__ */ e(
                    Le,
                    {
                      size: "small",
                      onClick: () => {
                        J(), q();
                      },
                      "data-testid": "othertypeeventconfigmodal-close-button",
                      children: /* @__PURE__ */ e(He, { icon: Ye })
                    }
                  )
                ]
              }
            ),
            /* @__PURE__ */ o(
              "form",
              {
                onSubmit: Ie(Me),
                ref: W,
                "data-testid": "othertypeeventconfigmodal-form",
                children: [
                  /* @__PURE__ */ o(c, { container: !0, className: "  max-h-[60vh] overflow-y-auto w-full", children: [
                    /* @__PURE__ */ e(
                      c,
                      {
                        item: !0,
                        className: "border-b border-gray-300 p-2.5 flex flex-col items-start",
                        size: { xs: 12 },
                        children: /* @__PURE__ */ e(b, { className: "whitespace-normal w-full break-all  p-2.5 flex flex-col items-start", children: /* @__PURE__ */ o(h, { variant: "body2", className: "font-bold", children: [
                          d("Available Implicit Parameters"),
                          ":",
                          " ",
                          a == null ? void 0 : a.implicitParam,
                          " "
                        ] }) })
                      }
                    ),
                    /* @__PURE__ */ o(c, { item: !0, className: "p-2.5 w-full", children: [
                      (a == null ? void 0 : a.type) === "EXCEPTION" && /* @__PURE__ */ o(c, { container: !0, spacing: 2, children: [
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-exceptionType",
                            children: [
                              /* @__PURE__ */ o(h, { variant: "body2", children: [
                                d("Exception"),
                                " ",
                                d("Type"),
                                /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ o(b, { className: " w-full", children: [
                                /* @__PURE__ */ e(
                                  T,
                                  {
                                    name: "excetionTypes",
                                    control: g,
                                    defaultValue: "",
                                    className: " w-full",
                                    render: ({ field: t }) => /* @__PURE__ */ o(
                                      A,
                                      {
                                        className: " w-full",
                                        ...t,
                                        error: y.excetionTypes,
                                        size: "small",
                                        "data-testid": "othertypeeventconfigmodal-excetionTypes-select",
                                        children: [
                                          /* @__PURE__ */ e(E, { value: "", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("Select") }) }),
                                          /* @__PURE__ */ e(E, { value: "ImtechoUserException", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("Imtecho User Exception") }) }),
                                          /* @__PURE__ */ e(E, { value: "ImtechoSystemException", children: /* @__PURE__ */ o(h, { variant: "body2", children: [
                                            " ",
                                            d("Imtecho System Exception")
                                          ] }) }),
                                          /* @__PURE__ */ e(E, { value: "ImtechoMobileException", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("Imtecho Mobile Exception") }) })
                                        ]
                                      }
                                    )
                                  }
                                ),
                                (y == null ? void 0 : y.excetionTypes) && /* @__PURE__ */ e(
                                  "p",
                                  {
                                    className: "error-helper",
                                    "data-testid": "custom-error-message",
                                    children: (m = y == null ? void 0 : y.excetionTypes) == null ? void 0 : m.message
                                  }
                                )
                              ] })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ o(c, { item: !0, size: { xs: 12 }, className: " w-full", children: [
                          " ",
                          /* @__PURE__ */ o(
                            v,
                            {
                              variant: "outlined",
                              className: " w-full",
                              "data-testid": "othertypeeventconfigmodal-exceptionMessage",
                              children: [
                                /* @__PURE__ */ e(h, { variant: "body2", children: d("Message") }),
                                /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                  ee,
                                  {
                                    control: g,
                                    id: "exceptionMessage",
                                    name: "exceptionMessage",
                                    errors: y,
                                    label: "",
                                    minRows: 5,
                                    "data-testid": "othertypeeventconfigmodal-exceptionMessage-customtextarea"
                                  }
                                ) })
                              ]
                            }
                          )
                        ] })
                      ] }),
                      (a == null ? void 0 : a.type) === "SMS" && /* @__PURE__ */ o(c, { container: !0, spacing: 2, children: [
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-mobileNumberFieldName",
                            children: [
                              /* @__PURE__ */ o(h, { variant: "body2", children: [
                                d("SMS"),
                                " ",
                                d("Phone number"),
                                " ",
                                d("Field"),
                                " ",
                                d("Name"),
                                /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                F,
                                {
                                  control: g,
                                  id: "mobileNumberFieldName",
                                  name: "mobileNumberFieldName",
                                  errors: y,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-mobileNumberFieldName-textfield"
                                }
                              ) })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-smsTypeField",
                            children: [
                              /* @__PURE__ */ o(
                                c,
                                {
                                  container: !0,
                                  justifyContent: "space-between",
                                  alignItems: "center",
                                  children: [
                                    /* @__PURE__ */ e(c, { item: !0, xs: !0, children: /* @__PURE__ */ o(h, { variant: "body2", children: [
                                      d("SMS"),
                                      " ",
                                      d("Type"),
                                      " ",
                                      d("Field"),
                                      " ",
                                      d("Value"),
                                      /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                                    ] }) }),
                                    /* @__PURE__ */ o(c, { container: !0, children: [
                                      " ",
                                      /* @__PURE__ */ e(c, { item: !0, children: /* @__PURE__ */ e(v, { component: "fieldset", className: "mr-2", children: /* @__PURE__ */ e(
                                        T,
                                        {
                                          control: g,
                                          name: "isPriority",
                                          defaultValue: !1,
                                          render: ({ field: t }) => /* @__PURE__ */ e(
                                            L,
                                            {
                                              control: /* @__PURE__ */ e(
                                                D,
                                                {
                                                  checked: t.value,
                                                  onChange: (i) => t.onChange(i.target.checked),
                                                  "data-testid": "othertypeeventconfigmodal-isPriority-checkbox"
                                                }
                                              ),
                                              label: "Is Priority"
                                            }
                                          )
                                        }
                                      ) }) }),
                                      /* @__PURE__ */ e(c, { item: !0, children: /* @__PURE__ */ e(v, { component: "fieldset", className: "mr-2", children: /* @__PURE__ */ e(
                                        T,
                                        {
                                          control: g,
                                          name: "isSmsTypeFixed",
                                          defaultValue: !1,
                                          render: ({ field: t }) => /* @__PURE__ */ e(
                                            L,
                                            {
                                              control: /* @__PURE__ */ e(
                                                D,
                                                {
                                                  checked: t.value,
                                                  onChange: (i) => t.onChange(i.target.checked),
                                                  "data-testid": "othertypeeventconfigmodal-isSmsTypeFixed-checkbox"
                                                }
                                              ),
                                              label: d("Is Fixed Value")
                                            }
                                          )
                                        }
                                      ) }) })
                                    ] })
                                  ]
                                }
                              ),
                              /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                F,
                                {
                                  control: g,
                                  id: "smsTypeField",
                                  name: "smsTypeField",
                                  errors: y,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-smsTypeField-textfield"
                                }
                              ) })
                            ]
                          }
                        ) })
                      ] }),
                      (a == null ? void 0 : a.type) === "EMAIL" && /* @__PURE__ */ o(c, { container: !0, spacing: 2, className: " w-full", children: [
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-emailIdField",
                            children: [
                              /* @__PURE__ */ o(h, { variant: "body2", children: [
                                d("Email"),
                                " ",
                                d("Id"),
                                " ",
                                d("Field"),
                                " ",
                                d("Value"),
                                /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                F,
                                {
                                  control: g,
                                  id: "baseDateFieldName",
                                  name: "baseDateFieldName",
                                  errors: y,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-baseDateFieldName-textfield"
                                }
                              ) })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-emailSubjectField",
                            children: [
                              /* @__PURE__ */ o(h, { variant: "body2", children: [
                                d("Email"),
                                " ",
                                d("Subject"),
                                /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                F,
                                {
                                  control: g,
                                  id: "emailSubject",
                                  name: "emailSubject",
                                  errors: y,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-emailSubject-textfield"
                                }
                              ) })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-[95%] md:w-full overflow-auto",
                            "data-testid": "othertypeeventconfigmodal-template",
                            children: [
                              /* @__PURE__ */ e(h, { variant: "body2", children: d("Template") }),
                              /* @__PURE__ */ e(
                                b,
                                {
                                  className: " w-full",
                                  sx: {
                                    borderRadius: "8px",
                                    overflow: "hidden",
                                    border: `1px solid ${p.palette.divider}`,
                                    // This targets the actual writing area
                                    "& .ck-editor__main > .ck-editor__editable": {
                                      backgroundColor: `${p.palette.background.paper} !important`,
                                      color: `${p.palette.text.primary} !important`,
                                      minHeight: "200px",
                                      "&.ck-focused": {
                                        borderColor: `${p.palette.primary.main} !important`
                                      }
                                    },
                                    // This targets the toolbar
                                    "& .ck.ck-toolbar": {
                                      backgroundColor: C ? "#21262D !important" : "#f5f5f5 !important",
                                      borderColor: `${p.palette.divider} !important`
                                    },
                                    // This targets the buttons/icons inside the toolbar
                                    "& .ck.ck-toolbar .ck-button": {
                                      color: `${p.palette.text.primary} !important`,
                                      cursor: "pointer",
                                      "&:hover": {
                                        backgroundColor: C ? "#30363D !important" : "#e0e0e0 !important"
                                      },
                                      "&.ck-on": {
                                        backgroundColor: C ? "#11B66633 !important" : "#d1d1d1 !important",
                                        color: `${p.palette.primary.main} !important`
                                      }
                                    },
                                    // This targets dropdowns and labels
                                    "& .ck.ck-label": {
                                      color: `${p.palette.text.secondary} !important`
                                    }
                                  },
                                  children: /* @__PURE__ */ e(
                                    ve,
                                    {
                                      editor: Be,
                                      data: ie("template") || "",
                                      config: {
                                        toolbar: [
                                          "heading",
                                          "|",
                                          "bold",
                                          "italic",
                                          "underline",
                                          "|",
                                          "cut",
                                          "copy",
                                          "|",
                                          // Added cut and copy
                                          "bulletedList",
                                          "numberedList",
                                          "|",
                                          "blockQuote",
                                          "|",
                                          "undo",
                                          "redo"
                                        ]
                                      },
                                      onChange: (t, i) => {
                                        const s = i.getData();
                                        N("template", s);
                                      },
                                      "data-testid": "othertypeeventconfigmodal-template-ckeditor"
                                    }
                                  )
                                }
                              )
                            ]
                          }
                        ) })
                      ] }),
                      (a == null ? void 0 : a.type) === "QUERY" && /* @__PURE__ */ e(c, { container: !0, children: /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                        v,
                        {
                          variant: "outlined",
                          className: " w-full",
                          "data-testid": "othertypeeventconfigmodal-querySelect",
                          children: [
                            /* @__PURE__ */ e(h, { variant: "body2", children: d("Query") }),
                            /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                              T,
                              {
                                className: " w-full",
                                name: "queryCode",
                                control: g,
                                defaultValue: null,
                                render: ({ field: t }) => /* @__PURE__ */ o(
                                  A,
                                  {
                                    ...t,
                                    className: " w-full",
                                    size: "small",
                                    displayEmpty: !0,
                                    onChange: (i) => {
                                      t.onChange(i), _e(i.target.value);
                                    },
                                    "data-testid": "othertypeeventconfigmodal-queryCode-select",
                                    children: [
                                      /* @__PURE__ */ e(E, { value: null, children: /* @__PURE__ */ e(h, { variant: "body2", children: d("Select") }) }),
                                      j == null ? void 0 : j.map((i, s) => /* @__PURE__ */ e(E, { value: i == null ? void 0 : i.code, children: /* @__PURE__ */ o(h, { variant: "body2", children: [
                                        " ",
                                        i == null ? void 0 : i.code
                                      ] }) }, s + 1))
                                    ]
                                  }
                                )
                              }
                            ) })
                          ]
                        }
                      ) }) }),
                      z && (a == null ? void 0 : a.type) === "QUERY" && le && /* @__PURE__ */ e(c, { container: !0, className: " w-full", children: z == null ? void 0 : z.map((t, i) => /* @__PURE__ */ e(
                        c,
                        {
                          item: !0,
                          size: { xs: 12 },
                          className: " w-full",
                          children: /* @__PURE__ */ o(v, { variant: "outlined", className: " w-full", children: [
                            /* @__PURE__ */ o(
                              c,
                              {
                                container: !0,
                                justifyContent: "space-between",
                                alignItems: "center",
                                children: [
                                  /* @__PURE__ */ e(c, { item: !0, children: /* @__PURE__ */ o(h, { variant: "body1", children: [
                                    t == null ? void 0 : t.parameterName,
                                    " ",
                                    d("Mapping")
                                  ] }) }),
                                  /* @__PURE__ */ e(c, { item: !0, children: /* @__PURE__ */ e(v, { component: "fieldset", className: "mr-2", children: /* @__PURE__ */ e(
                                    T,
                                    {
                                      control: g,
                                      name: `${t == null ? void 0 : t.parameterName}${i}isFixed`,
                                      defaultValue: (t == null ? void 0 : t.isFixed) || !1,
                                      render: ({ field: s }) => /* @__PURE__ */ e(
                                        L,
                                        {
                                          control: /* @__PURE__ */ e(
                                            D,
                                            {
                                              checked: s.value,
                                              onChange: (u) => {
                                                s.onChange(u.target.checked), V(
                                                  i,
                                                  "isFixed",
                                                  u.target.checked
                                                );
                                              },
                                              "data-testid": "othertypeeventconfigmodal-isFixed-checkbox"
                                            }
                                          ),
                                          label: "Is Fixed Value"
                                        }
                                      )
                                    }
                                  ) }) })
                                ]
                              }
                            ),
                            /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                              T,
                              {
                                control: g,
                                className: " w-full",
                                name: `${t == null ? void 0 : t.parameterName}${i}`,
                                defaultValue: t == null ? void 0 : t.mappingValue,
                                render: ({ field: s }) => /* @__PURE__ */ e(
                                  Z,
                                  {
                                    variant: "outlined",
                                    size: "small",
                                    className: " w-full",
                                    ...s,
                                    fullWidth: !0,
                                    onChange: (u) => {
                                      N(
                                        `${t == null ? void 0 : t.parameterName}${i}`,
                                        u.target.value
                                      ), V(
                                        i,
                                        "mappingValue",
                                        u.target.value
                                      );
                                    },
                                    "data-testid": `othertypeeventconfigmodal-${t == null ? void 0 : t.parameterName}${i}-textfiled`
                                  }
                                )
                              }
                            ) })
                          ] })
                        },
                        i + 1
                      )) }),
                      (a == null ? void 0 : a.type) === "SYSTEM_FUNCTION" && /* @__PURE__ */ e(c, { container: !0, children: /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                        v,
                        {
                          variant: "outlined",
                          className: " w-full",
                          "data-testid": "othertypeeventconfigmodal-systemFunction",
                          children: [
                            /* @__PURE__ */ e(h, { variant: "body2", children: d("System Function") }),
                            /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                              T,
                              {
                                className: " w-full",
                                name: "systemFunctionId",
                                control: g,
                                defaultValue: "",
                                render: ({ field: t }) => /* @__PURE__ */ o(
                                  A,
                                  {
                                    ...t,
                                    className: " w-full",
                                    size: "small",
                                    onChange: (i) => {
                                      t.onChange(i), Se(i.target.value);
                                    },
                                    "data-testid": "othertypeeventconfigmodal-systemFunctionId-select",
                                    sx: {
                                      ".MuiSelect-select": {
                                        whiteSpace: "pre-wrap",
                                        // Allows line breaks
                                        wordBreak: "break-word",
                                        height: "auto",
                                        minHeight: "1.4375em"
                                      }
                                    },
                                    MenuProps: {
                                      PaperProps: {
                                        sx: {
                                          maxHeight: 300,
                                          overflow: "auto",
                                          maxWidth: 410
                                        }
                                      }
                                    },
                                    children: [
                                      /* @__PURE__ */ e(E, { value: "", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("None") }) }),
                                      B == null ? void 0 : B.map((i, s) => /* @__PURE__ */ e(E, { value: i == null ? void 0 : i.id, children: /* @__PURE__ */ o(h, { variant: "body2", children: [
                                        " ",
                                        i == null ? void 0 : i.name,
                                        " (",
                                        i == null ? void 0 : i.className,
                                        ")"
                                      ] }) }, s + 1))
                                    ]
                                  }
                                )
                              }
                            ) })
                          ]
                        }
                      ) }) }),
                      M && (a == null ? void 0 : a.type) === "SYSTEM_FUNCTION" && Ee && /* @__PURE__ */ e(c, { container: !0, children: M == null ? void 0 : M.map((t, i) => /* @__PURE__ */ e(
                        c,
                        {
                          item: !0,
                          size: { xs: 12 },
                          className: " w-full",
                          children: /* @__PURE__ */ o(v, { variant: "outlined", className: " w-full", children: [
                            /* @__PURE__ */ o(
                              c,
                              {
                                container: !0,
                                justifyContent: "space-between",
                                alignItems: "center",
                                children: [
                                  /* @__PURE__ */ e(c, { item: !0, xs: !0, children: /* @__PURE__ */ o(h, { variant: "body2", children: [
                                    t == null ? void 0 : t.parameterName,
                                    " ",
                                    d("Mapping")
                                  ] }) }),
                                  /* @__PURE__ */ e(c, { item: !0, children: /* @__PURE__ */ e(
                                    v,
                                    {
                                      component: "fieldset",
                                      className: "mr-2",
                                      children: /* @__PURE__ */ e(
                                        T,
                                        {
                                          control: g,
                                          name: `${t == null ? void 0 : t.parameterName}${i}isFixed`,
                                          defaultValue: (t == null ? void 0 : t.isFixed) || !1,
                                          render: ({ field: s }) => /* @__PURE__ */ e(
                                            L,
                                            {
                                              control: /* @__PURE__ */ e(
                                                D,
                                                {
                                                  checked: s.value,
                                                  onChange: (u) => {
                                                    s.onChange(u.target.checked), V(
                                                      i,
                                                      "isFixed",
                                                      u.target.checked
                                                    );
                                                  },
                                                  "data-testid": "othertypeeventconfigmodal-systemFunctionId-checkbox"
                                                }
                                              ),
                                              label: "Is Fixed Value"
                                            }
                                          )
                                        }
                                      )
                                    }
                                  ) })
                                ]
                              }
                            ),
                            /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                              T,
                              {
                                control: g,
                                className: " w-full",
                                name: `${t == null ? void 0 : t.parameterName}${i}`,
                                defaultValue: t == null ? void 0 : t.mappingValue,
                                render: ({ field: s }) => /* @__PURE__ */ e(
                                  Z,
                                  {
                                    variant: "outlined",
                                    size: "small",
                                    className: " w-full",
                                    ...s,
                                    fullWidth: !0,
                                    onChange: (u) => {
                                      N(
                                        `${t == null ? void 0 : t.parameterName}${i}`,
                                        u.target.value
                                      ), V(
                                        i,
                                        "mappingValue",
                                        u.target.value
                                      );
                                    },
                                    "data-testid": `othertypeeventconfigmodal-${t == null ? void 0 : t.parameterName}${i}-textfiled`
                                  }
                                )
                              }
                            ) })
                          ] })
                        },
                        i + 1
                      )) }),
                      (a == null ? void 0 : a.type) === "PUSH_NOTIFICATION" && /* @__PURE__ */ o(c, { container: !0, spacing: 2, children: [
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-userIdFieldName",
                            children: [
                              /* @__PURE__ */ o(h, { variant: "body2", children: [
                                d("User"),
                                " ",
                                d("Id"),
                                " ",
                                d("Field"),
                                " ",
                                d("Name"),
                                /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                F,
                                {
                                  control: g,
                                  id: "userFieldName",
                                  name: "userFieldName",
                                  errors: y,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-userFieldName-textfield"
                                }
                              ) })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-notificationType",
                            children: [
                              /* @__PURE__ */ o(h, { variant: "body2", children: [
                                d("Notification"),
                                " ",
                                d("Type"),
                                /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ o(b, { className: " w-full", children: [
                                /* @__PURE__ */ e(
                                  T,
                                  {
                                    className: " w-full",
                                    name: "notificationTypeId",
                                    control: g,
                                    defaultValue: "",
                                    render: ({ field: t }) => /* @__PURE__ */ o(
                                      A,
                                      {
                                        ...t,
                                        className: " w-full",
                                        size: "small",
                                        error: y == null ? void 0 : y.notificationTypeId,
                                        onChange: (i) => {
                                          t.onChange(i), Fe(i.target.value);
                                        },
                                        "data-testid": "othertypeeventconfigmodal-notificationtypeid-select",
                                        children: [
                                          /* @__PURE__ */ e(E, { value: "", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("None") }) }),
                                          X == null ? void 0 : X.map((i, s) => /* @__PURE__ */ e(E, { value: i == null ? void 0 : i.id, children: /* @__PURE__ */ e(h, { variant: "body2", children: i == null ? void 0 : i.type }) }, s + 1))
                                        ]
                                      }
                                    )
                                  }
                                ),
                                (y == null ? void 0 : y.notificationTypeId) && /* @__PURE__ */ e(
                                  "p",
                                  {
                                    className: "error-helper",
                                    "data-testid": "custom-error-message",
                                    children: (x = y == null ? void 0 : y.notificationTypeId) == null ? void 0 : x.message
                                  }
                                )
                              ] })
                            ]
                          }
                        ) })
                      ] }),
                      (a == null ? void 0 : a.type) === "PUSH_NOTIFICATION" && G && /* @__PURE__ */ o(c, { container: !0, spacing: 2, children: [
                        /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(v, { variant: "outlined", className: " w-full", children: [
                          /* @__PURE__ */ o(h, { variant: "body2", children: [
                            d("Notification"),
                            " ",
                            d("Heading"),
                            /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                          ] }),
                          /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                            F,
                            {
                              control: g,
                              id: "heading",
                              name: "heading",
                              errors: y,
                              label: "",
                              size: "small",
                              dataTestId: "othertypeeventconfigmodal-heading-textfield"
                            }
                          ) })
                        ] }) }),
                        /* @__PURE__ */ o(c, { item: !0, size: { xs: 12 }, className: " w-full", children: [
                          " ",
                          /* @__PURE__ */ o(v, { variant: "outlined", className: " w-full", children: [
                            /* @__PURE__ */ e(h, { variant: "body2", children: d("Template") }),
                            /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                              ee,
                              {
                                control: g,
                                id: "template",
                                name: "template",
                                errors: y,
                                label: "",
                                minRows: 5,
                                "data-testid": "othertypeeventconfigmodal-template-customtextarea"
                              }
                            ) })
                          ] })
                        ] })
                      ] }),
                      (a == null ? void 0 : a.type) === "KAFKA_SYNC" && /* @__PURE__ */ e(c, { container: !0, children: /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ o(
                        v,
                        {
                          variant: "outlined",
                          className: " w-full",
                          "data-testid": "othertypeeventconfigmodal-kafkaConfig",
                          children: [
                            /* @__PURE__ */ o(h, { variant: "body2", children: [
                              d("Kafka Config"),
                              /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                            ] }),
                            /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                              T,
                              {
                                className: " w-full",
                                name: "formType",
                                control: g,
                                defaultValue: "",
                                error: y,
                                render: ({ field: t }) => /* @__PURE__ */ o(
                                  A,
                                  {
                                    ...t,
                                    className: " w-full",
                                    size: "small",
                                    displayEmpty: !0,
                                    onChange: (i) => {
                                      t.onChange(i), $e(i.target.value);
                                    },
                                    "data-testid": "othertypeeventconfigmodal-kafkaConfig-select",
                                    children: [
                                      /* @__PURE__ */ e(E, { value: "", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("Select") }) }),
                                      Q == null ? void 0 : Q.map((i, s) => /* @__PURE__ */ e(E, { value: i.form_type, children: /* @__PURE__ */ e(h, { variant: "body2", children: i.form_type }) }, s))
                                    ]
                                  }
                                )
                              }
                            ) })
                          ]
                        }
                      ) }) }),
                      O && (a == null ? void 0 : a.type) === "KAFKA_SYNC" && ne && O.length > 0 && /* @__PURE__ */ e(c, { container: !0, className: " w-full", children: O == null ? void 0 : O.map((t, i) => /* @__PURE__ */ e(
                        c,
                        {
                          item: !0,
                          size: { xs: 12 },
                          className: " w-full",
                          children: /* @__PURE__ */ o(v, { variant: "outlined", className: " w-full", children: [
                            /* @__PURE__ */ o(
                              c,
                              {
                                container: !0,
                                justifyContent: "space-between",
                                alignItems: "center",
                                children: [
                                  /* @__PURE__ */ e(c, { item: !0, xs: !0, children: /* @__PURE__ */ o(h, { variant: "body2", children: [
                                    t == null ? void 0 : t.parameterName,
                                    " ",
                                    d("Mapping")
                                  ] }) }),
                                  /* @__PURE__ */ e(c, { item: !0, children: /* @__PURE__ */ e(
                                    v,
                                    {
                                      component: "fieldset",
                                      className: "mr-2",
                                      children: /* @__PURE__ */ e(
                                        T,
                                        {
                                          control: g,
                                          name: `${t == null ? void 0 : t.parameterName}${i}isFixed`,
                                          defaultValue: (t == null ? void 0 : t.isFixed) || !1,
                                          render: ({ field: s }) => /* @__PURE__ */ e(
                                            L,
                                            {
                                              control: /* @__PURE__ */ e(
                                                D,
                                                {
                                                  checked: s.value,
                                                  onChange: (u) => {
                                                    s.onChange(u.target.checked), V(
                                                      i,
                                                      "isFixed",
                                                      u.target.checked
                                                    );
                                                  },
                                                  "data-testid": "othertypeeventconfigmodal-kafka-isFixed-checkbox"
                                                }
                                              ),
                                              label: d("Is Fixed Value")
                                            }
                                          )
                                        }
                                      )
                                    }
                                  ) })
                                ]
                              }
                            ),
                            /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                              T,
                              {
                                control: g,
                                className: " w-full",
                                name: `${t == null ? void 0 : t.parameterName}${i}`,
                                defaultValue: (t == null ? void 0 : t.mappingValue) || "",
                                render: ({ field: s }) => /* @__PURE__ */ e(
                                  Z,
                                  {
                                    variant: "outlined",
                                    size: "small",
                                    className: " w-full",
                                    ...s,
                                    fullWidth: !0,
                                    onChange: (u) => {
                                      N(
                                        `${t == null ? void 0 : t.parameterName}${i}`,
                                        u.target.value
                                      ), V(
                                        i,
                                        "mappingValue",
                                        u.target.value
                                      );
                                    },
                                    "data-testid": `othertypeeventconfigmodal-kafka-${t == null ? void 0 : t.parameterName}${i}-textfield`
                                  }
                                )
                              }
                            ) })
                          ] })
                        },
                        `${ne}-${t == null ? void 0 : t.parameterName}-${i}`
                      )) }),
                      ((a == null ? void 0 : a.type) === "SMS" || (a == null ? void 0 : a.type) == "QUERY" && !le) && /* @__PURE__ */ e(c, { container: !0, spacing: 2, children: /* @__PURE__ */ o(c, { item: !0, size: { xs: 12 }, className: " w-full", children: [
                        " ",
                        /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": a.type === "QUERY" ? "othertypeeventconfigmodal-queryArea" : "othertypeeventconfigmodal-template",
                            children: [
                              /* @__PURE__ */ e(h, { variant: "body2", children: d(
                                a.type === "QUERY" ? "Query" : "Template"
                              ) }),
                              /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                ee,
                                {
                                  control: g,
                                  id: "template",
                                  name: "template",
                                  label: "",
                                  minRows: 5,
                                  "data-testid": "othertypeeventconfigmodal-template-customtextarea"
                                }
                              ) })
                            ]
                          }
                        )
                      ] }) }),
                      (a == null ? void 0 : a.type) != "EXCEPTION" && (a == null ? void 0 : a.type) != "SYSTEM_FUNCTION" && /* @__PURE__ */ e(c, { container: !0, spacing: 2, children: /* @__PURE__ */ o(c, { item: !0, size: { xs: 12 }, className: "mt-2 w-full", children: [
                        /* @__PURE__ */ o(
                          v,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-triggerWhen",
                            children: [
                              /* @__PURE__ */ o(h, { variant: "body2", children: [
                                d("Trigger"),
                                " ",
                                d("When"),
                                /* @__PURE__ */ e("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ o(b, { className: " w-full", children: [
                                /* @__PURE__ */ e(
                                  T,
                                  {
                                    name: "trigerWhen",
                                    control: g,
                                    defaultValue: "",
                                    className: " w-full",
                                    render: ({ field: t }) => /* @__PURE__ */ o(
                                      A,
                                      {
                                        className: " w-full",
                                        ...t,
                                        error: y.trigerWhen,
                                        size: "small",
                                        displayEmpty: !0,
                                        "data-testid": "othertypeeventconfigmodal-trigegrwhen-select",
                                        children: [
                                          /* @__PURE__ */ e(E, { value: "", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("Select") }) }),
                                          /* @__PURE__ */ e(E, { value: "IMMEDIATELY", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("Immediately") }) }),
                                          /* @__PURE__ */ e(E, { value: "AFTER", children: /* @__PURE__ */ e(h, { variant: "body2", children: d("After") }) })
                                        ]
                                      }
                                    )
                                  }
                                ),
                                (y == null ? void 0 : y.trigerWhen) && /* @__PURE__ */ e(
                                  "p",
                                  {
                                    className: "error-helper",
                                    "data-testid": "custom-error-message",
                                    children: (f = y == null ? void 0 : y.trigerWhen) == null ? void 0 : f.message
                                  }
                                )
                              ] })
                            ]
                          }
                        ),
                        Te === "AFTER" && /* @__PURE__ */ o(Pe, { children: [
                          /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, children: /* @__PURE__ */ o(
                            v,
                            {
                              variant: "outlined",
                              className: " w-full",
                              "data-testid": "othertypeeventconfigmodal-dayField",
                              children: [
                                /* @__PURE__ */ e(h, { variant: "body2", children: d("Day") }),
                                /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                  F,
                                  {
                                    control: g,
                                    id: "day",
                                    name: "day",
                                    errors: y,
                                    label: "",
                                    type: "number",
                                    size: "small",
                                    dataTestId: "othertypeeventconfigmodal-type-textfield"
                                  }
                                ) })
                              ]
                            }
                          ) }),
                          /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, children: /* @__PURE__ */ o(
                            v,
                            {
                              variant: "outlined",
                              className: " w-full",
                              "data-testid": "othertypeeventconfigmodal-hourField",
                              children: [
                                /* @__PURE__ */ e(h, { variant: "body2", children: d("Hour") }),
                                /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                  F,
                                  {
                                    control: g,
                                    id: "hour",
                                    name: "hour",
                                    errors: y,
                                    label: "",
                                    type: "number",
                                    size: "small",
                                    dataTestId: "othertypeeventconfigmodal-type-textfield"
                                  }
                                ) })
                              ]
                            }
                          ) }),
                          /* @__PURE__ */ e(c, { item: !0, size: { xs: 12 }, children: /* @__PURE__ */ o(
                            v,
                            {
                              variant: "outlined",
                              className: " w-full",
                              "data-testid": "othertypeeventconfigmodal-minuteField",
                              children: [
                                /* @__PURE__ */ e(h, { variant: "body2", children: d("Minute") }),
                                /* @__PURE__ */ e(b, { className: " w-full", children: /* @__PURE__ */ e(
                                  F,
                                  {
                                    control: g,
                                    id: "minute",
                                    name: "minute",
                                    type: "number",
                                    errors: y,
                                    label: "",
                                    size: "small",
                                    dataTestId: "othertypeeventconfigmodal-type-textfield"
                                  }
                                ) })
                              ]
                            }
                          ) })
                        ] })
                      ] }) })
                    ] })
                  ] }),
                  /* @__PURE__ */ o(
                    De,
                    {
                      direction: "row",
                      className: "mr-5",
                      spacing: 2,
                      justifyContent: "flex-end",
                      mt: 1,
                      mb: 1,
                      children: [
                        /* @__PURE__ */ e(
                          oe,
                          {
                            variant: "contained",
                            size: "small",
                            color: "secondary",
                            onClick: () => {
                              J(), q();
                            },
                            "data-testid": "othertypeeventconfigmodal-cancel-button",
                            children: /* @__PURE__ */ e(h, { variant: "body2", children: d("Cancel") })
                          }
                        ),
                        /* @__PURE__ */ e(
                          oe,
                          {
                            size: "small",
                            type: "submit",
                            variant: "contained",
                            color: "primary",
                            "data-testid": "othertypeeventconfigmodal-submit-button",
                            children: d("Submit")
                          }
                        )
                      ]
                    }
                  )
                ]
              }
            )
          ]
        }
      )
    }
  );
};
Nt.propTypes = {
  open: Y.any,
  handleClose: Y.any,
  handleClick: Y.any,
  type: Y.any
};
export {
  Nt as default
};
//# sourceMappingURL=OtherTypeEventConfigModal-ZnCGWm9v-D7x0QObl.js.map
