import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{Ut as n}from"./utils.94RcZhG4.js";import{t as r}from"./inputUtils.CD44xxT-.js";var i=e(t(),1);function a({formId:e,maxChars:t,setDirty:r,setUiValue:a,setValueWithSource:o,additionalAction:s}){return(0,i.useCallback)(i=>{let{value:c}=i.target;t!==0&&c.length>t||(r(!0),a(c),n({formId:e})&&o({value:c,fromUi:!0}),s&&s())},[e,t,r,a,o,s])}function o(e,t,n,a,o,s=!1){return(0,i.useCallback)(i=>{let c=!s||i.metaKey||i.ctrlKey;!r(i)||!c||(i.preventDefault(),n&&t(),a.allowFormEnterToSubmit(e)&&a.submitForm(e,o))},[e,o,n,t,a,s])}function s(e,t,n,r){(0,i.useEffect)(()=>{r||e!==t&&n(e)},[e,t,r,n])}export{o as n,a as r,s as t};