import{r as u}from"./index-CzUo07dn.js";const g=d=>{const{defaultSort:s,defaultSortDirection:D="ascending",rows:e}=d,[r,S]=u.useState(s),[o,a]=u.useState(D);return r&&e.sort((t,n)=>{const c=t.sortData?t.sortData[r]:"",i=n.sortData?n.sortData[r]:"";return c>i?o==="ascending"?1:-1:c<i?o==="ascending"?-1:1:0}),{rows:e,updateSort:t=>{a(t===r?"descending":"ascending"),S(t||s)}}};export{g as u};
