import { getPropertyByString as m } from "@m4l/core";
import { isRecord as f } from "../isRecord.js";
import { resolveFieldTypeComponentProps as l } from "../resolveFieldContractAliases.js";
function p(r) {
  const e = l(r.fieldType);
  return typeof e?.equalToValuePath == "string" && e.equalToValuePath.trim() !== "" ? e.equalToValuePath.trim() : "id";
}
function d(r, e) {
  const o = { ...r };
  for (const n of e) {
    if (n.fieldType?.componentId !== "RHFImageSelector")
      continue;
    const t = n.name;
    if (typeof t != "string" || !(t in o))
      continue;
    const a = o[t];
    if (!f(a))
      continue;
    const i = m(a, p(n));
    (typeof i == "string" || typeof i == "number") && (o[t] = i);
  }
  return o;
}
export {
  d as mapImageSelectorValuesForSubmit
};
