import{r as p,j as e}from"./vendor-react-wBh_31cN.js";import{aE as Z,h as ee,p as B,m as se,P as te,d as L,S as ae,a1 as n,cg as re}from"./index-BKr2rJhV.js";import{M as ne}from"./MissingMandatoryTagsWarning-DpOcErx3.js";import{B as oe}from"./badge-nyizWwTN.js";import{C as k}from"./combobox-CcK1PxyF.js";import{L as le}from"./list-page-header-DZysveul.js";import{M as ie}from"./metadata-field-B_vcklh-.js";import{T as V}from"./tooltip-Da8-EbK8.js";import{V as me}from"./value-76ihWpF6.js";import{a as ce}from"./time-utils-tK1noPML.js";import{C as d}from"./CardActionButton-Ch696ne3.js";import{D as pe}from"./Deprecated-lKLzSfj7.js";import{a as de}from"./vendor-router-D1GqFWiT.js";import{u as xe}from"./uniqBy-qYjau2JN.js";import{s as ue}from"./sort-BIlPehKK.js";import{a as fe}from"./ascend-D9xyxTFQ.js";const ge="truncate",be=({text:o,variant:r})=>{const l={green:"bg-quartz-label-green",red:"bg-quartz-label-red",orange:"bg-quartz-label-orange",gray:"bg-quartz-gray",success:"bg-quartz-label-green",error:"bg-quartz-label-red",warning:"bg-quartz-label-orange"};return e.jsx(V,{content:o,children:e.jsx("span",{className:L("inline-block size-2.5 shrink-0 rounded-full",l[r]??"bg-quartz-gray")})})},Ve=({onClickEdit:o,onClickDelete:r,onClickRefresh:l,isEditDisabled:h,isVersionsLoading:D,title:i,id:j,idColor:v,versions:m=[],version:x,onVersionChange:N,hasCommits:F=!1,commits:u=[],commit:y,handleCommitChange:M,showDelete:S=!1,type:he=re.td,data:t,status:f,withoutPin:U=!1,pathnamePostFix:Y="",editRightText:_,actions:A,commitsRowExtras:T,filterToolbar:E,count:H,countContent:O,tools:W,isFetching:G,sharedFromProjectName:q,children:J})=>{var $,w,I;const g=t==null?void 0:t.deprecated,b=Z(Y,de().pathname),z=p.useMemo(()=>Math.max(...m.map(({version:s})=>s)||[]),[m]),P=p.useMemo(()=>ee(ue(fe(B("version"))),se(({version:s,deployments:C=0})=>({value:`${s}`,label:`${s} ${s===z?"(latest)":""}`,deployments:C?`${C} dep.`:""})),xe(B("value")))(m),[m,z]),a=p.useMemo(()=>u.map(s=>({label:`${ce(+s)}${s===u[0]?" (latest)":""}`,value:`${s}`})),[u]),{pinnedIds:K,handlePin:Q,handleUnPin:R}=p.useContext(te),c=K.includes(b),X=()=>c?R(b):Q({id:b,name:t.name,entityVersion:t.version,entityId:t.id,color:v});return e.jsx(le,{className:g?"bg-muted":void 0,secondaryToolbar:E,count:H,countContent:O,tools:W,isFetching:G,toolbar:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsxs("div",{className:"flex items-center",children:[f&&e.jsx(be,{text:f.text,variant:f.variant}),g&&e.jsx(pe,{}),e.jsxs("span",{className:"m-auto ml-2.5 mr-4 inline-flex items-center text-[22px] font-semibold",children:[e.jsx(V,{content:i&&i.length>=55?i:void 0,children:e.jsxs("span",{className:L(ge,"max-w-[650px]"),children:[q&&e.jsxs("span",{className:"text-muted-foreground font-normal",children:[q,"::"]}),i]})}),j&&e.jsxs("span",{className:"ml-2.5 mb-px mr-4 text-sm",style:{color:v},children:["#",j]})]}),e.jsxs("div",{className:"my-auto flex items-center",children:[(x||t.version)&&(N&&P.length>1?e.jsx(k,{className:"w-[143px]",value:`${x}`,options:P,placeholder:"version",onChange:s=>s&&N(s)}):e.jsxs(oe,{variant:"outline",className:"text-sm",children:["v",x??t.version]})),D&&e.jsx("span",{className:"ml-2",children:e.jsx(ae,{})})]}),e.jsx(ne,{className:"ml-2.5 max-w-[320px]",missingMandatoryTags:t==null?void 0:t.missingMandatoryTags}),F&&a[0]&&M&&(a.length>1?e.jsx(k,{className:"my-1.5 ml-5 w-[280px]",value:y||(($=a[0])==null?void 0:$.value),options:a,placeholder:"commit time",onChange:s=>s&&M(s)}):e.jsx(ie,{label:"commit",className:"ml-5",children:e.jsx(me,{children:((w=a.find(s=>s.value===y))==null?void 0:w.label)||((I=a[0])==null?void 0:I.label)||"latest"})})),T&&e.jsx("div",{className:"ml-2 flex items-center gap-2",children:T})]}),J,e.jsxs("div",{className:"ml-auto flex items-center gap-2.5",children:[A,S&&e.jsx(d,{"data-test":"delete-button",icon:n.bin,onClick:r,disabled:!r,tooltipText:r?"Delete":"Your role is not allowed to perform this action",borderless:!0}),o&&!g&&e.jsx(d,{"data-test":"edit-button",icon:n.edit,onClick:o,tooltipText:h?_??"You have no edit right on the feature store":"",disabled:h,borderless:!0}),l&&e.jsx(d,{icon:n.refresh,onClick:l,tooltipText:"Refresh",borderless:!0}),!U&&e.jsx(d,{"data-test":c?"unpin-item":"pin-item",icon:c?n.pin_empty:n.pin_filled,onClick:X,tooltipText:c?"Unpin from shortcuts":"Pin to shortcuts",borderless:!0})]})]})})};export{Ve as P};
