import{slicedToArray as r}from"../../_virtual/_rollupPluginBabelHelpers.js";import{useState as t,useRef as e,useEffect as a,useMemo as n,useCallback as u}from"react";import{noop as i,debounce as l}from"lodash-es";function o(o){var c=o.delay,f=void 0===c?0:c,d=o.onChange,m=o.initialStateValue,p=void 0===m?"":m,v=o.trim,s=t(p),g=r(s,2),V=g[0],h=g[1],y=e(null);a((function(){y.current=p}));var C=n((function(){return f?d?l(d,f):i:d}),[d,f]),_=u((function(r){var t=r.target.value,e=v?t.trim():t;h(e),C(e)}),[C,h,v]),b=u((function(){h(""),d&&d("")}),[h,d]);return p!==y.current&&p!==V&&h(p),{inputValue:V,onEventChanged:_,clearValue:b,updateValue:h}}export{o as default};
