import { isRecord as p } from "../../../isRecord.js";
import { isPositiveInteger as a } from "../../../isPositiveInteger.js";
import { defaultGetOptionLabel as l } from "./helpers/defaultGetOptionLabel/defaultGetOptionLabel.js";
import { resolveFieldInputLabel as m } from "../../../resolveFieldInputLabel/resolveFieldInputLabel.js";
import { defaultGetOptionValue as u } from "./helpers/defaultGetOptionValue/defaultGetOptionValue.js";
import { buildGetOptionValue as s } from "./helpers/buildGetOptionValue/buildGetOptionValue.js";
import { buildGetOptionLabel as f } from "./helpers/buildGetOptionLabel/buildGetOptionLabel.js";
function d(i) {
  return Array.isArray(i) ? i : [];
}
function g(i, n) {
  const r = m(i, n), e = d(i.options), o = i.fieldType.rhfComponentProps;
  if (!p(o))
    return {
      resolvedLabel: r,
      resolvedOptions: e,
      getOptionLabel: l,
      getOptionValue: u
    };
  const t = {};
  return typeof o.optionLabelPath == "string" && o.optionLabelPath.trim() !== "" && (t.optionLabelPath = o.optionLabelPath.trim()), typeof o.optionValuePath == "string" && o.optionValuePath.trim() !== "" && (t.optionValuePath = o.optionValuePath.trim()), typeof o.id == "string" && o.id.trim() !== "" && (t.id = o.id.trim()), typeof o.row == "boolean" && (t.row = o.row), a(o.rowColumns) && (t.rowColumns = o.rowColumns), {
    ...t,
    resolvedLabel: r,
    resolvedOptions: e,
    getOptionLabel: f(t.optionLabelPath),
    getOptionValue: s(t.optionValuePath)
  };
}
export {
  g as normalizeRadioGroupPropsFromBackend
};
