import s from"@ahooksjs/use-url-state";function e(){const[e,r]=s({searchFormKeys:"",searchFormValues:"",paginationKeys:"",paginationValues:""},{navigateMode:"replace"});return{setUrlCriteriaQuery:function(s,e){const t=s=>{const e=[],r=[];return Object.entries(s).forEach(([s,t])=>{t&&(e.push(s),Array.isArray(t)?r.push(`[${t.join("|")}]`):r.push(t))}),{keys:e.join(","),values:r.join(",")}},i=t(s),a=t(e);r({searchFormKeys:i.keys||void 0,searchFormValues:i.values||void 0,paginationKeys:a.keys||void 0,paginationValues:a.values||void 0})},getUrlCriteriaQuery:function(s,r){const t=e[s]?e[s].split(","):[],i=e[r]?e[r].split(","):[],a={};return t.forEach((s,e)=>{if(i[e])if(i[e].startsWith("[")&&i[e].endsWith("]")){const r=i[e].substring(1,i[e].length-1);a[s]=r?r.split("|"):[]}else a[s]=i[e]}),a}}}export{e as default};
