import{r as t,p as I,w as L,aK as j,hi as w,aL as y,j as n,u as C,g4 as E,hj as $,A as S,U as m,c as b,$ as c,b1 as _,o as k,q as o,b8 as h}from"./index-46ma1THH.js";import{F as q}from"./FeatureGroupTypeBadge-DK0B-B3q.js";import{D as H}from"./Deprecated-CcWZugSq.js";import{K as F}from"./useFeatureFilters-DTSd2vm9.js";const T=t.createContext({lazyKeyFilter:F.null,onToggleLazyKey:s=>{},setLazyKeyFilter:s=>{},registeredFeatures:{primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]},registerFeatures:s=>{}}),M=({children:s})=>{const[a,g]=t.useState({primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]}),d=t.useCallback(r=>{g(I(w(y,r),L({primaryFeatures:j,eventTimeFeatures:j,partitionFeatures:j})))},[]),[l,e]=t.useState(F.null),i=t.useCallback(r=>()=>{e(v=>v===r?F.null:r)},[]),x=t.useMemo(()=>({lazyKeyFilter:l,onToggleLazyKey:i,setLazyKeyFilter:e,registeredFeatures:a,registerFeatures:d}),[l,i,d,a]);return n.jsx(T.Provider,{value:x,children:s})},P=({featureGroup:s,name:a,labelFgId:g})=>{const{id:d}=C(),{currentData:l}=E({fsId:s==null?void 0:s.featurestoreId}),{currentData:e}=$({pId:+d,fsId:(s==null?void 0:s.featurestoreId)??-1,id:(s==null?void 0:s.id)??-1,fgName:(s==null?void 0:s.name)??""},{skip:!s||!l}),i=e==null?void 0:e.features.find(S("name",a)),{registerFeatures:x}=t.useContext(T);return t.useEffect(function(){const v=(e==null?void 0:e.features.filter(m("primary")).map(m("name")).map(y(`${s==null?void 0:s.id}`)))??[],K=e!=null&&e.eventTime?[e==null?void 0:e.eventTime].map(y(`${s==null?void 0:s.id}`)):[],z=(e==null?void 0:e.features.filter(m("partition")).map(m("name")).map(y(`${s==null?void 0:s.id}`)))??[];x({primaryFeatures:v,eventTimeFeatures:K,partitionFeatures:z})},[e==null?void 0:e.id,e==null?void 0:e.features,x,e==null?void 0:e.eventTime,s==null?void 0:s.id]),s?n.jsxs(c,{justifyContent:"space-between",children:[n.jsxs(c,{children:[e&&e.deprecated&&n.jsx(H,{sx:{fontSize:"12px"},short:!0}),n.jsx(_,{my:"-8px",px:"10px",intent:"inline",href:k(o.project.featureGroup.overview,o.project.value,{id:d,fsId:s.featurestoreId,fgId:s==null?void 0:s.id}),target:"_blank",children:n.jsxs(c,{alignItems:"center",sx:{gap:"15px"},children:[e&&n.jsx(q,{type:e.type,onlineEnabled:e.onlineEnabled,size:"xs"}),s.name," ↗"]})}),n.jsxs(b,{ml:"5px",color:"labels.orange",children:["v",s.version]})]}),n.jsxs(c,{ml:"12px",sx:{gap:"10px"},children:[(i==null?void 0:i.serving)&&n.jsx(h,{value:"serving",width:"max-content",variant:"success"}),(e==null?void 0:e.eventTime)===a&&s.id===g&&n.jsx(h,{value:"event time",width:"max-content",variant:"label"}),(i==null?void 0:i.onDemand)&&n.jsx(h,{value:"on-demand",width:"max-content",variant:"default"})]})]}):n.jsx(b,{bold:!0,gray:!0,children:"unavailable origin feature group"})},Q=t.memo(P);export{T as L,Q as T,M as a};
