import{b4 as k,bf as T,dn as E,v as R,x as q,k as A,o as y,q as d,r as O,bh as b,j as t,bo as o,L as U,p as $,d as m,dq as H,y as I}from"./index-CK33qGU_.js";import{S as Q,a as V,b as Y}from"./StatisticsTables-CBsa7eUJ.js";const K=({isOpen:l,handleToggle:f,projectId:n,featurestoreId:r,parentProjectId:G,featuregroup:F,fgName:h,version:D,name:e,feature:L,fgId:C})=>{var S,w,g;const u=k(),v=T(),{data:N}=E({pId:G,fsId:r,fgName:h,version:D},{skip:!h,selectFromResult:R({data:q(A)})}),a=F??N,B=L??(a==null?void 0:a.features.find(c=>c.name===e)),i=C??(a==null?void 0:a.id)??0,p=y(d.featureGroup.overview,d.project.value,{id:n,fsId:r,fgId:i}),P=`${y(d.featureGroup.preview,d.project.value,{id:n,fsId:r,fgId:i})}?search=${e}`;O.useEffect(()=>{i&&v.featureGroupStatistics.fetch({projectId:n,featureStoreId:r,featureGroupId:i})},[B,v,i,n,r]);const x=b(c=>{var j;return(j=c.featureGroupStatistics)==null?void 0:j.entities.statistics});if(b(c=>c.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:[((S=s.extendedStatistics)==null?void 0:S.histogram)&&s.featureType&&t.jsx(m,{width:"100%",justifyContent:"center",children:t.jsx(Q,{dataType:H.fg,data:(w=s.extendedStatistics)==null?void 0:w.histogram,type:s.featureType})}),(!((g=s.extendedStatistics)!=null&&g.histogram)||!s.featureType)&&t.jsx(I,{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(V,{projectId:n,featureStoreId:r,fgId:i,isDrawer:!0,featureName:e,featureGroup:a})}),s?t.jsx(o.Section,{title:"Statistics",children:t.jsx(Y,{isDrawer:!0,data:s})}):null]})};export{K as F};
