import{aS as L,b1 as N,dz as P,dA as Q,v as T,dB as k,c as S,b as d,r as A,b3 as j,j as t,ba as o,a$ as E,g as R,Q as w,dJ as $,x as O}from"./index-ea7817a2.js";import{S as U,a as z,b as H}from"./StatisticsTables-d20123a2.js";const _=({isOpen:l,handleToggle:p,projectId:n,featurestoreId:r,parentProjectId:b,featuregroup:m,fgName:x,version:y,name:e,feature:G,fgId:F})=>{const u=L(),v=N(),{data:D}=P({pId:b,fsId:r,fgName:x,version:y},{skip:!x,selectFromResult:Q({data:T(k)})}),a=m??D,B=G??(a==null?void 0:a.features.find(c=>c.name===e)),i=F??(a==null?void 0:a.id)??0,f=S(d.featureGroup.overview,d.project.value,{id:n,fsId:r,fgId:i}),C=`${S(d.featureGroup.preview,d.project.value,{id:n,fsId:r,fgId:i})}?search=${e}`;A.useEffect(()=>{i&&v.featureGroupStatistics.fetch({projectId:n,featureStoreId:r,featureGroupId:i})},[B,v,i,n,r]);const h=j(c=>{var g;return(g=c.featureGroupStatistics)==null?void 0:g.entities.statistics});if(j(c=>c.loading.effects.featureGroupStatistics.fetch))return t.jsx(o,{headerLine:" ",closeOnBackdropClick:!1,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(f)],onClose:p,children:t.jsx(E,{})});if(e&&(!h||!h[e]))return t.jsx(o,{headerLine:e,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(f)],onClose:p,children:t.jsx(R,{textAlign:"center",mt:"30px",children:"No Feature Statistics"})});const s=e?h[e]:void 0;return t.jsxs(o,{headerLine:e,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(f)],onClose:p,children:[s?t.jsx(o.Section,{title:"Data overview",children:t.jsxs(w,{width:"100%",children:[s.histogram&&s.dataType&&t.jsx(w,{width:"100%",justifyContent:"center",children:t.jsx(U,{dataType:$.fg,data:s.histogram,type:s.dataType})}),(!s.histogram||!s.dataType)&&t.jsx(O,{bold:!0,gray:!0,textAlign:"center",children:"No data overview"})]})}):null,t.jsx(o.Section,{title:"Data preview",action:["view data preview table -->",()=>u(C)],children:i&&t.jsx(z,{projectId:n,featureStoreId:r,fgId:i,isDrawer:!0,featureName:e,featureGroup:a})}),s?t.jsx(o.Section,{title:"Statistics",children:t.jsx(H,{isDrawer:!0,data:s})}):null]})};export{_ as F};
