import{j as y,B as w,gF as j,ec as k,as as A,Z as L,r as s,cH as D}from"./index-dP1W1_bd.js";const v={label:{"> div":{py:0,pl:"4px",pr:"8px",alignItems:"center"},"> div:hover":{div:{backgroundColor:"grayShade3",borderColor:"transparent"}}}},B={label:{div:{backgroundColor:"white"}}},P=({children:e,icon:n,white:c=!1,size:o="md",...i})=>y.jsx(w,{sx:c?j(B,v):v,alignItems:"center",children:y.jsxs(k,{...i,children:[y.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 E=(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))(E||{});const G=(e,n="",c=!1,o="")=>{const[i,f]=s.useState([]),[h,b]=s.useState([]),[a,d]=s.useState(7),[m,u]=D({search:n}),x=s.useCallback(({target:r})=>{const t=r.value;u(t?{search:t}:{})},[u]),T=s.useCallback(r=>()=>{d(t=>t===r?7:r)},[d]),C=s.useCallback(()=>{u({}),f([]),b([]),d(7)},[u]),g=s.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=s.useMemo(()=>{let r=e;return a===1&&(r=p(r,!0,"partition")),a===6&&(r=p(r,!0,"onDemand")),a===0&&(r=p(r,!0,"primary")),a===2&&(r=p(r,!0,"label")),r=p(r,i,"type"),r=p(r,h,"onlineType"),a===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,a,i,h,o]);return s.useMemo(()=>({dataFiltered:S,types:g.offlineTypes,onlineTypes:g.onlineTypes,search:m.get("search")||"",typeFilters:i,onlineTypeFilters:h,keyFilter:a,onTypeFiltersChange:f,onOnlineTypeFiltersChange:b,onSearchChange:x,onToggleKey:T,onReset:C}),[S,g,m,i,a,f,x,T,C])};export{P as F,E as K,p as f,G as u};
