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