import{r as t}from"./vendor-ClLR6ncd.js";import{a as p}from"./lodash-ZyeDnt0e.js";function l({input:r,setInput:s,debounceTime:a=200}){const o=t.useRef(Date.now()),c=t.useRef(Date.now()),[n,f]=t.useState(r);t.useEffect(()=>{c.current>=o.current&&f(r)},[r]);const e=t.useMemo(()=>p(u=>{s(u),c.current=Date.now()},a),[s,a]);t.useEffect(()=>(e(n),()=>{e==null||e.cancel()}),[n]);const i=t.useCallback(u=>{f(u),o.current=Date.now()},[]);return[n,i]}export{l as u};
