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