import{u as k,r as F,dq as c,j as e,Q as T,d as o,a as I,c as d,dy as w,aN as l,y as p,bd as D,gl as E,v as G,x as L,f as S,b8 as M,ff as A,g4 as B,bm as N,dI as R,dJ as V,gm as b,as as Q,B as _,g as C,b6 as q}from"./index-CK33qGU_.js";import{a as H,u as J}from"./index-C9fMz2Eh.js";import{b as P,S as K,a as O}from"./StatisticsTables-CBsa7eUJ.js";import{u as U}from"./Deprecated-D5xZ0QMJ.js";import{T as W}from"./TdFeatureGroupHandle-VL8F3InA.js";import{F as $}from"./FeaturesLayout-DRbyMXg_.js";const z=({data:a,parent:r,statistics:t,type:s})=>{var x;const{name:i,primary:u,partition:f}=a,{id:j,fgId:g,fsId:n}=k(),{isActiveFeature:m,handleBasket:h,isSwitch:v}=U(),y=F.useMemo(()=>s===c.fg?r.eventTime===i:!1,[i,r,s]);return e.jsxs(T,{children:[s===c.fg&&e.jsxs(o,{alignItems:"flex-end",children:[e.jsx(I,{children:i}),v&&s===c.fg&&e.jsx(d,{ml:"10px",children:e.jsx(w,{handleClick:h([a],r),inBasket:m(a,r),tooltipMainText:m(a,r)?"Remove this feature from basket":"Add this feature to basket"})}),e.jsx(l,{ml:"20px",value:(t==null?void 0:t.featureType)??""}),u&&e.jsx(l,{ml:"20px",value:"primary key",variant:"success"}),f&&e.jsx(l,{ml:"20px",value:"partition key",variant:"success"}),y&&e.jsx(l,{ml:"20px",value:"event time",variant:"label"})]}),s===c.td&&e.jsx(o,{alignItems:"flex-end",children:e.jsxs(o,{flexDirection:"column",children:[e.jsxs(o,{children:[e.jsx(I,{children:i}),e.jsx(l,{ml:"20px",value:(t==null?void 0:t.featureType)??""})]}),e.jsx(o,{mt:"5px",children:a.featuregroup?e.jsxs(o,{children:[e.jsx(p,{bold:!0,gray:!0,mr:"5px",children:"from"}),e.jsx(W,{featureGroup:a==null?void 0:a.featuregroup})]}):e.jsx(p,{bold:!0,gray:!0,children:"unavailable origin feature group"})})]})}),t&&e.jsxs(o,{justifyContent:"space-between",alignItems:"flex-start",mt:"20px",flexWrap:"wrap",children:[e.jsx(P,{data:t}),(x=t.extendedStatistics)!=null&&x.histogram?e.jsx(d,{width:"calc((100% - 60px) / 4)",children:e.jsx(K,{dataType:s,data:t.extendedStatistics.histogram,type:t.featureType})}):e.jsx(d,{width:"calc((100% - 60px) / 4)"}),s===c.fg?e.jsx(O,{projectId:+j,fgId:+g,featureStoreId:+n,featureName:i,featureGroup:r}):e.jsx(d,{width:"calc((100% - 60px) / 4)"})]})]})},re=({data:a,statistics:r,type:t=c.fg})=>e.jsx($,{data:a,type:t,"data-test":"stats-container",renderChild:({type:s,parent:i,data:u})=>e.jsx(z,{type:s,parent:i,data:u,statistics:r[u.name]??{}}),extraActions:e.jsx(X,{})}),X=()=>{const a=D(),{id:r,fgId:t,fsId:s,fvName:i,fvVersion:u,tdVersion:f}=k(),{currentData:{items:j}={}}=H({pId:r,fgId:t,fsId:s},{skip:!t}),{currentData:g}=E({pId:r,fsId:+s,fvName:i,fvVersion:+u,id:+f,params:{fields:"content"}},{skip:!!t,selectFromResult:G({currentData:L(S(M,A))})}),n=t?j:g,[m,{isLoading:h}]=J(),v=()=>{try{m({pId:r,fgId:t,fsId:s}).unwrap().then(x=>{a.success({title:"New computation started",content:`Job ${x.name} started`})})}catch{}},y=F.useMemo(()=>S(Q(S(_(0,"computationTime"),b)),R(V,b(0)),B(N.DATE_TIME.DATE_TIME_FULL))(n??[]),[n]);return e.jsxs(o,{alignItems:"center",sx:{gap:"10px"},children:[n!==void 0&&!C(n)&&e.jsxs(p,{gray:!0,children:["computed at ",y]}),(n===void 0||C(n))&&e.jsx(p,{gray:!0,children:"Statistics are not configured for this version"}),t&&e.jsx(q,{intent:"ghost",onClick:v,isLoading:h,children:"Recompute"})]})};export{X as C,re as S};
