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