import{ac as Q,j as e,B as r,fk as Z,d as y,n as ee,bi as te,r as c,f as se,fg as ne,U as A,aB as oe,bM as re,fJ as ae,ap as ie,fs as le,fK as xe,es as pe,p as ce,at as E,bU as me,b as de,dX as U,e4 as he,e5 as ue,be as z,bG as m,au as fe,C as i,d_ as d}from"./index-C1DmWO_C.js";import{u as be,D as je}from"./Deprecated-BQWZLUTP.js";const ge=({children:n})=>{const o=document.getElementById("panel-portal");return o?Q.createPortal(e.jsx(r,{sx:{position:"sticky",top:"0px",zIndex:10,width:"100%",flexDirection:"column"},children:n}),o):n},ye=Z`
  from { -moz-transform: rotate(0deg); }
  to { -moz-transform: rotate(360deg); }
`,Ie=({children:n,...o})=>e.jsx(y,{sx:{animation:`${ye} 1.5s ease infinite`},...o,children:n}),Te=n=>({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"},...n&&{bg:"grayShade2"}}),Be=({onClickEdit:n,onClickDelete:o,onClickRefresh:I,isEditDisabled:T,isVersionsLoading:F,title:a,id:v,idColor:h,versions:x=[],version:u,onVersionChange:k,hasCommits:W=!1,commits:f=[],commit:B,handleCommitChange:w,showDelete:H=!1,type:L=U.td,data:t,status:b,withoutPin:K=!1,pathnamePostFix:N="",editRightText:O,children:R})=>{var S,M,D;const j=t==null?void 0:t.deprecated,g=ee(N,te().pathname),{isActiveFeatures:C,handleBasket:X,isSwitch:Y}=be(),P=c.useMemo(()=>Math.max(...x.map(({version:s})=>s)||[]),[x]),$=c.useMemo(()=>se(re(ae(A("version"))),oe(({version:s,deployments:_=0})=>({value:`${s}`,label:`${s} ${s===P?"(latest)":""}`,deployments:_?`${_} dep.`:""})),ne(A("value")))(x),[x,P]),l=c.useMemo(()=>f.map(s=>({label:`${ie(+s)}${s===f[0]?" (latest)":""}`,value:`${s}`})),[f]),{pinnedIds:q,handlePin:G,handleUnPin:J}=c.useContext(le),p=q.includes(g),V=()=>p?J(g):G({id:g,name:t.name,entityVersion:t.version,entityId:t.id,color:h});return e.jsx(ge,{children:e.jsx(r,{alignItems:"center",minHeight:"50px",sx:Te(j),children:e.jsxs(r,{width:"100%",maxWidth:xe,alignItems:"flex-end",px:"10px",children:[e.jsxs(r,{alignItems:"center",children:[b&&e.jsx(pe,{mb:"5px",mr:"-5px",mainText:b.text,variant:b.variant}),j&&e.jsx(je,{}),e.jsxs(ce,{display:"inline-flex",m:"auto",ml:"10px",mr:"15px",fontSize:"22px",children:[e.jsx(E,{mainText:a,disabled:!a||(a==null?void 0:a.length)<55,children:e.jsx(y,{sx:{...me,maxWidth:"650px"},children:a})}),v&&e.jsxs(de,{mt:"auto",ml:"10px",mb:"1px",mr:"15px",sx:{color:h},as:"span",children:["#",v]})]}),Y&&!!t&&L===U.fg&&e.jsx(y,{onClick:s=>s.stopPropagation(),my:"auto",mr:"15px",children:e.jsx(he,{possible:t.features.length>0,handleClick:X(t.features,t),mode:ue.bulk,tooltipMainText:C(t.features,t)?"Remove all features from basket":"Add all features to basket",tooltipSecondaryText:`${t.features.length} features`,inBasket:C(t.features,t)})}),e.jsxs(r,{alignItems:"center",m:"auto 0",children:[(u||t.version)&&(k&&$.length>1?e.jsx(z,{width:"143px",value:`${u}`,options:$,placeholder:"version",onChange:k}):e.jsxs(e.Fragment,{children:[e.jsx(m,{color:"gray",children:"version"}),e.jsx(m,{mx:"5px",color:h,children:u??t.version})]})),F&&e.jsx(Ie,{children:e.jsx(fe,{icon:i.loading})})]}),W&&w&&(l.length>1?e.jsx(z,{ml:"20px",my:"5px",width:"280px",value:B||((S=l[0])==null?void 0:S.value),options:l,placeholder:"commit time",onChange:w,maxListHeight:"400px"}):e.jsxs(r,{my:"5px",ml:"20px",alignItems:"flex-end",children:[e.jsx(m,{color:"gray",children:"commit"}),e.jsx(m,{mx:"5px",children:((M=l.find(s=>s.value===B))==null?void 0:M.label)||((D=l[0])==null?void 0:D.label)||"latest"})]}))]}),R,e.jsxs(r,{ml:"auto",mr:"8px",alignItems:"center",sx:{gap:"10px"},children:[H&&e.jsx(E,{mainText:"Your role is not allowed to perform this action",disabled:!!o,children:e.jsx(d,{"data-test":"delete-button",icon:i.bin,onClick:o,tooltipText:"Delete",borderless:!0})}),n&&!j&&e.jsx(d,{"data-test":"edit-button",icon:i.edit,onClick:n,tooltipText:T?O??"You have no edit right on the feature store":"",disabled:T,borderless:!0}),I&&e.jsx(d,{icon:i.refresh,onClick:I,tooltipText:"Refresh",borderless:!0}),!K&&e.jsx(d,{"data-test":p?"unpin-item":"pin-item",icon:p?i.pin_filled:i.pin_empty,onClick:V,tooltipText:p?"Unpin from shortcuts":"Pin to shortcuts",borderless:!0})]})]})})})};export{Be as P};
