import{j as g,$ as w,h1 as j,ev as k,ap as A,C as L,r as a,d0 as D}from"./index-ljTaFLaB.js";const v={label:{"> div":{py:0,pl:"4px",pr:"8px",alignItems:"center"},"> div:hover":{div:{backgroundColor:"grayShade3",borderColor:"transparent"}}}},I={label:{div:{backgroundColor:"white"}}},E=({children:e,icon:n,white:c=!1,size:o="md",...i})=>g.jsx(w,{sx:c?j(I,v):v,alignItems:"center",children:g.jsxs(k,{...i,children:[g.jsx(A,{p:"4px !important",size:o,icon:n||L.cross,sx:!n&&{visibility:"hidden",width:"0px",mr:"-15px"}}),e]})}),p=(e,n,c)=>e.filter(({[c]:o})=>Array.isArray(n)?n.length?n.includes(o):e:n===o);var M=(e=>(e[e.primary=0]="primary",e[e.partition=1]="partition",e[e.label=2]="label",e[e.type=3]="type",e[e.onlineType=4]="onlineType",e[e.eventTime=5]="eventTime",e[e.onDemand=6]="onDemand",e[e.null=7]="null",e))(M||{});const G=(e,n="",c=!1,o="")=>{const[i,h]=a.useState([]),[f,y]=a.useState([]),[s,d]=a.useState(7),[m,u]=D({search:n}),x=a.useCallback(({target:r})=>{const t=r.value;u(t?{search:t}:{})},[u]),C=a.useCallback(r=>()=>{d(t=>t===r?7:r)},[d]),T=a.useCallback(()=>{u({}),h([]),y([]),d(7)},[u]),b=a.useMemo(()=>{const r=Array.from(new Set(e.filter(({name:l})=>l!=="Feature Group").map(({type:l})=>l)));let t=[];return c&&(t=Array.from(new Set(e.map(({onlineType:l})=>l)))),{offlineTypes:r,onlineTypes:t}},[e]),S=a.useMemo(()=>{let r=e;return s===1&&(r=p(r,!0,"partition")),s===6&&(r=p(r,!0,"onDemand")),s===0&&(r=p(r,!0,"primary")),s===2&&(r=p(r,!0,"label")),r=p(r,i,"type"),r=p(r,f,"onlineType"),s===5&&(r=r.filter(({name:t})=>t.toLowerCase()===o)),r.filter(({name:t})=>{const l=(m.get("search")||"").toLowerCase();return t.toLowerCase().includes(l)||t.includes("Feature Group")})},[e,m,s,i,f,o]);return a.useMemo(()=>({dataFiltered:S,types:b.offlineTypes,onlineTypes:b.onlineTypes,search:m.get("search")||"",typeFilters:i,onlineTypeFilters:f,keyFilter:s,onTypeFiltersChange:h,onOnlineTypeFiltersChange:y,onSearchChange:x,onToggleKey:C,onReset:T}),[S,b,m,i,s,h,x,C,T])};export{E as F,M as K,p as f,G as u};
