function p(e) {
  if (e.currentValue !== null && e.isVisible) {
    const r = e.currentValue, n = e.fieldType.componentId === "RHFCheckableList", l = e.fieldType.componentId === "RHFDaysOfWeekPicker", s = n || l, f = e.fieldType.componentId === "RHFAutoComplete", c = e.fieldType.componentId === "RHFSelect" && e.fieldType.rhfComponentProps?.isMultiple === !0;
    if (f)
      return;
    if (s || c) {
      if (Array.isArray(r))
        return r;
      if (typeof r == "string")
        try {
          const t = JSON.parse(r);
          if (Array.isArray(t))
            return t;
        } catch {
          const t = Number(r);
          return !isNaN(t) && r.trim() !== "" ? [t] : [r];
        }
      return [r];
    }
    if (typeof r == "number" || Array.isArray(r))
      return r;
    const a = e.fieldType.id;
    if (a === "fft_boolean" || a === "fft_checkbox") {
      const t = r.trim().toLowerCase();
      return t === "true" ? !0 : t === "false" ? !1 : !!r;
    }
    const i = Number(r);
    return !isNaN(i) && r.trim() !== "" ? i : r;
  }
  if (e.defaultValue !== null && e.defaultValue !== void 0) {
    if (e.fieldType.componentId === "RHFCheckableList" || e.fieldType.componentId === "RHFDaysOfWeekPicker")
      try {
        const n = JSON.parse(e.defaultValue);
        if (Array.isArray(n))
          return n;
      } catch {
        const n = Number(e.defaultValue);
        return !isNaN(n) && e.defaultValue.trim() !== "" ? [n] : [e.defaultValue];
      }
    const r = Number(e.defaultValue);
    return !isNaN(r) && e.defaultValue.trim() !== "" ? r : e.defaultValue;
  }
  const u = e.fieldType.id, o = e.fieldType.componentId;
  return o === "RHFCheckableList" || o === "RHFDaysOfWeekPicker" ? [] : o === "RHFAutoComplete" ? e.fieldType.rhfComponentProps?.isMultiple === !0 ? [] : null : o === "RHFRadioGroup" ? null : u === "fft_boolean" || u === "fft_checkbox" ? !1 : null;
}
export {
  p as resolveInitialValue
};
