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