import{r as t,p as I,A as L,aV as j,ix as w,aW as y,j as n,u as C,ha as E,iy as S,D as k,Q as m,c as T,q as c,aJ as q,t as P,x as b,b9 as F}from"./index-Cox3ZWL0.js";import{F as R}from"./FeatureGroupTypeBadge-DwquN_YA.js";import{D as _}from"./Deprecated-g8R65bmH.js";import{K as h}from"./useFeatureFilters-DADAAGc1.js";const o=t.createContext({lazyKeyFilter:h.null,onToggleLazyKey:s=>{},setLazyKeyFilter:s=>{},registeredFeatures:{primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]},registerFeatures:s=>{}}),W=({children:s})=>{const[a,v]=t.useState({primaryFeatures:[],eventTimeFeatures:[],partitionFeatures:[]}),d=t.useCallback(r=>{v(I(w(y,r),L({primaryFeatures:j,eventTimeFeatures:j,partitionFeatures:j})))},[]),[l,e]=t.useState(h.null),i=t.useCallback(r=>()=>{e(g=>g===r?h.null:r)},[]),x=t.useMemo(()=>({lazyKeyFilter:l,onToggleLazyKey:i,setLazyKeyFilter:e,registeredFeatures:a,registerFeatures:d}),[l,i,d,a]);return n.jsx(o.Provider,{value:x,children:s})},$=({featureGroup:s,name:a,labelFgId:v})=>{const{id:d}=C(),{currentData:l}=E({fsId:s==null?void 0:s.featurestoreId}),{currentData:e}=S({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(k("name",a)),{registerFeatures:x}=t.useContext(o);return t.useEffect(function(){const g=(e==null?void 0:e.features.filter(m("primary")).map(m("name")).map(y(`${s==null?void 0:s.id}`)))??[],z=e!=null&&e.eventTime?[e==null?void 0:e.eventTime].map(y(`${s==null?void 0:s.id}`)):[],K=(e==null?void 0:e.features.filter(m("partition")).map(m("name")).map(y(`${s==null?void 0:s.id}`)))??[];x({primaryFeatures:g,eventTimeFeatures:z,partitionFeatures:K})},[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(_,{sx:{fontSize:"12px"},short:!0}),n.jsx(q,{my:"-8px",px:"10px",intent:"inline",href:P(b.project.featureGroup.overview,b.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(R,{type:e.type,onlineEnabled:e.onlineEnabled,size:"xs"}),s.name," ↗"]})}),n.jsxs(T,{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(F,{value:"serving",width:"max-content",variant:"success"}),(e==null?void 0:e.eventTime)===a&&s.id===v&&n.jsx(F,{value:"event time",width:"max-content",variant:"label"}),(i==null?void 0:i.onDemand)&&n.jsx(F,{value:"on-demand",width:"max-content",variant:"default"})]})]}):n.jsx(T,{bold:!0,gray:!0,children:"unavailable origin feature group"})},A=t.memo($);export{o as L,A as T,W as a};
