import{U as te,j as e,a as r,fx as oe,O as h,bl as re,c9 as ae,r as c,W as ie,g0 as le,z as A,m as xe,g1 as pe,fe as ce,ab as E,fY as de,g2 as me,dW as he,M as ue,ae as d,ba as fe,f as je,dF as F,dH as ge,dI as be,bf as _,b3 as i,af as D,Z as m,bp as ye,aT as L}from"./index-d6499a22.js";import{u as ke,D as Ie}from"./Deprecated-ec8916ed.js";import{C as Te}from"./CardActionButton-ccf1bc35.js";const Se=({children:t})=>{const o=document.getElementById("panel-portal");return o?te.createPortal(e.jsx(r,{sx:{position:"sticky",top:"0px",zIndex:10,width:"100%",flexDirection:"column"},children:t}),o):t},ve=oe`
  from { -moz-transform: rotate(0deg); }
  to { -moz-transform: rotate(360deg); }
`,we=({children:t,...o})=>e.jsx(h,{sx:{animation:`${ve} 1.5s ease infinite`},...o,children:t}),Pe=t=>({bg:"white",boxShadow:"0px 4px 163px -99px rgba(0, 0, 0, 0.25)",borderBottomColor:"grayShade2",borderBottomWidth:"1px",borderBottomStyle:"solid",justifyContent:"center",":after":{content:'""',width:"100%",height:"10px",position:"absolute",top:"-10px"},...t&&{bg:"grayShade2"}}),Ce=({onClickEdit:t,onClickDelete:o,onClickRefresh:I,isEditDisabled:T,isDeleting:H,isVersionsLoading:O,title:a,id:S,idColor:u,versions:x=[],version:f,versionHasSearch:R,onVersionChange:v,hasCommits:U=!1,commits:l=[],commit:j,handleCommitChange:w,hasSplits:Y=!1,splits:g=[],split:P,showDelete:N=!1,onSplitChange:B,type:X=F.td,data:s,status:b,withoutPin:Z=!1,pathnamePostFix:q="",editRightText:V,children:G})=>{const y=s==null?void 0:s.deprecated,k=re(q,ae().pathname),{isActiveFeatures:M,handleBasket:J,isSwitch:K}=ke(),$=c.useMemo(()=>Math.max(...x.map(({version:n})=>n)||[]),[x]),C=c.useMemo(()=>ie(pe(ce(A("version"))),xe(({version:n,deployments:z=0})=>({key:n,label:`${n} ${n===$?"(latest)":""}`,deployments:z?`${z} dep.`:""})),le(A("key")))(x),[x,$]),W=c.useMemo(()=>l.map(n=>`${E(+n)}${n===l[0]?" (latest)":""}`),[l]),{pinnedIds:Q,handlePin:ee,handleUnPin:se}=c.useContext(de),p=Q.includes(k),ne=()=>p?se(k):ee({id:k,name:s.name,entityVersion:s.version,entityId:s.id,color:u});return e.jsx(Se,{children:e.jsx(r,{alignItems:"center",minHeight:"50px",sx:Pe(y),children:e.jsxs(r,{width:"100%",maxWidth:me,alignItems:"flex-end",px:"10px",children:[e.jsxs(r,{alignItems:"center",children:[b&&e.jsx(he,{mb:"5px",mr:"-5px",mainText:b.text,variant:b.variant}),y&&e.jsx(Ie,{}),e.jsxs(ue,{display:"inline-flex",m:"auto",ml:"10px",mr:"15px",fontSize:"22px",children:[e.jsx(d,{mainText:a,disabled:!a||(a==null?void 0:a.length)<55,children:e.jsx(h,{sx:{...fe,maxWidth:"650px"},children:a})}),S&&e.jsxs(je,{mt:"auto",ml:"10px",mb:"1px",mr:"15px",sx:{color:u},as:"span",children:["#",S]})]}),K&&!!s&&X===F.fg&&e.jsx(h,{onClick:n=>n.stopPropagation(),my:"auto",mr:"15px",children:e.jsx(ge,{possible:s.features.length>0,handleClick:J(s.features,s),mode:be.bulk,tooltipMainText:M(s.features,s)?"Remove all features from basket":"Add all features to basket",tooltipSecondaryText:`${s.features.length} features`,inBasket:M(s.features,s)})}),e.jsxs(r,{alignItems:"center",m:"auto 0",children:[(f||s.version)&&(v&&C.length>1?e.jsx(_,{width:"143px",variant:"white",value:f,hasSearch:R,options:C,placeholder:"version",onChange:n=>v(n.key),isMulti:!1}):e.jsxs(e.Fragment,{children:[e.jsx(i,{color:"gray",children:"version"}),e.jsx(i,{mx:"5px",color:u,children:f??s.version})]})),O&&e.jsx(we,{children:e.jsx(D,{icon:m.loading})})]}),U&&w&&(W.length>1?e.jsx(ye,{ml:"20px",my:"5px",width:"280px",listWidth:"100%",value:[`${j||"-"} ${j===E(l?+l[0]:0)?"(latest)":""}`],options:W,placeholder:"commit time",onChange:w}):e.jsxs(r,{my:"5px",ml:"20px",alignItems:"flex-end",children:[e.jsx(i,{color:"gray",children:"commit"}),e.jsx(i,{mx:"5px",children:j})]})),Y&&B&&(g.length>1?e.jsx(_,{ml:"20px",mb:"-5px",width:"140px",value:[P||g[0]],options:g.map(n=>({key:n,label:n})),placeholder:"split",onChange:n=>B(n.key)}):e.jsxs(r,{alignItems:"flex-end",children:[e.jsx(i,{ml:"5px",color:"gray",children:"split"}),e.jsx(i,{mx:"5px",children:P})]}))]}),G,e.jsxs(r,{ml:"auto",mr:"8px",alignItems:"center",sx:{gap:"15px"},children:[N&&e.jsx(d,{mainText:"Your role is not allowed to perform this action",disabled:!!o,children:e.jsx(L,{color:"red",intent:"ghost",onClick:o,isLoading:H,disabled:!o,sx:{userSelect:"none"},children:"delete"})}),t&&!y&&e.jsx(d,{disabled:!T,mainText:V??"You have no edit right on the feature store",children:e.jsx(L,{intent:"ghost",disabled:T,onClick:t,children:"edit"})}),I&&e.jsx(h,{children:e.jsx(Te,{icon:m.refresh,onClick:I,tooltipText:"Refresh"})}),!Z&&e.jsx(d,{mainText:p?"Unpin from shortcuts":"Pin to shortcuts",children:e.jsx(D,{icon:p?m.pin_filled:m.pin_empty,onClick:ne,"data-test":p?"unpin-item":"pin-item",sx:{cursor:"pointer"},size:"md",ml:"8px"})})]})]})})})};export{Ce as P};
