import { r as m, bV as c } from "./index-6wLGsgHc.js";
import { r as n } from "./inputUtils-DCYiajnz-B43QJ2xy.js";
function b({
  formId: t,
  maxChars: e,
  setDirty: r,
  setUiValue: o,
  setValueWithSource: i,
  additionalAction: a
}) {
  return m.useCallback((u) => {
    const {
      value: l
    } = u.target;
    e !== 0 && l.length > e || (r(!0), o(l), c({
      formId: t
    }) && i({
      value: l,
      fromUi: !0
    }), a && a());
  }, [t, e, r, o, i, a]);
}
function p(t, e, r, o, i, a = !1) {
  return m.useCallback((u) => {
    const l = a ? u.metaKey || u.ctrlKey : !0;
    !n(u) || !l || (u.preventDefault(), r && e(), o.allowFormEnterToSubmit(t) && o.submitForm(t, i));
  }, [t, i, r, e, o, a]);
}
function d(t, e, r, o) {
  m.useEffect(() => {
    o || t !== e && r(t);
  }, [t, e, o, r]);
}
export {
  b as a,
  p as c,
  d as v
};
//# sourceMappingURL=useUpdateUiValue-09I2_X1f-BBTjBVRq.js.map
