import{useEffect as o,useMemo as h,useState as n}from"react";import{useSearchParams as m}from"react-router-dom";import{debounce as S}from"../../../../utils/time/debounce";function l(){const[a,s]=m(),c=a.get("search")||"",[r,t]=n(c);o(()=>{const e=new URLSearchParams(a);r?e.set("search",r):e.delete("search"),s(e,{replace:!0})},[r,a,s]);const u=h(()=>S(e=>{t(e)},500),[t]);return{searchQuery:r,setSearchQuery:u}}export{l as useCatalogSearch};
