import { createElement as l } from "react";
import { isRecord as I } from "../../../isRecord.js";
import { isPositiveInteger as r } from "../../../isPositiveInteger.js";
import { resolveAssetSrcWithBase as c } from "../../helpers/resolveAssetSrcWithBase.js";
import { resolveFieldInputLabel as P } from "../../../resolveFieldInputLabel/resolveFieldInputLabel.js";
import { Icon as f } from "../../../../../Icon/Icon.js";
function b(i, p, m) {
  const s = P(i, p), t = i.fieldType.rhfComponentProps;
  if (!I(t))
    return { resolvedLabel: s };
  const o = {};
  typeof t.id == "string" && t.id.trim() !== "" && (o.id = t.id.trim()), typeof t.htmlFor == "string" && t.htmlFor.trim() !== "" && (o.htmlFor = t.htmlFor.trim()), typeof t.placeholder == "string" && t.placeholder.trim() !== "" && (o.placeholder = t.placeholder.trim()), r(t.maxLength) && (o.maxLength = t.maxLength), typeof t.multiline == "boolean" && (o.multiline = t.multiline), r(t.rows) && (o.rows = t.rows), r(t.minRows) && (o.minRows = t.minRows), r(t.maxRows) && (o.maxRows = t.maxRows);
  let e, n;
  typeof t.startAdormentPath == "string" && t.startAdormentPath.trim() !== "" && (e = t.startAdormentPath), typeof t.endAdormentPath == "string" && t.endAdormentPath.trim() !== "" && (n = t.endAdormentPath);
  const a = e ? l(f, { src: c(m, e) }) : void 0, d = n ? l(f, { src: c(m, n) }) : void 0, {
    startIcon: u,
    endIcon: g,
    ...h
  } = o;
  return {
    ...h,
    resolvedLabel: s,
    ...a !== void 0 ? { startIcon: a } : {},
    ...d !== void 0 ? { endIcon: d } : {}
  };
}
export {
  b as normalizeTextFieldPropsFromBackend
};
