import{r as m,d3 as n}from"./index-DCNLpqIv.js";import{i as s}from"./inputUtils-CptNuJwn.js";function c({formId:t,maxChars:a,setDirty:e,setUiValue:o,setValueWithSource:l,additionalAction:r}){return m.useCallback(i=>{const{value:u}=i.target;a!==0&&u.length>a||(e(!0),o(u),n({formId:t})&&l({value:u,fromUi:!0}),r&&r())},[t,a,e,o,l,r])}function f(t,a,e,o,l,r=!1){return m.useCallback(i=>{const u=r?i.metaKey||i.ctrlKey:!0;!s(i)||!u||(i.preventDefault(),e&&a(),o.allowFormEnterToSubmit(t)&&o.submitForm(t,l))},[t,l,e,a,o,r])}function b(t,a,e,o){m.useEffect(()=>{o||t!==a&&e(t)},[t,a,o,e])}export{c as a,f as b,b as u};
