import{o as e,r as t}from"./button-DJ30HgDO.js";import"./free-solid-svg-icons-zCYot7wU.js";import"./use-api-BQhcC0Jo.js";import{n,r,t as i}from"./entity-list-table-zGFxBB5g.js";import{t as a}from"./page-container-DN56Bi3o.js";import{t as o}from"./page-status-Dgf15-K2.js";import{t as s}from"./row-action-button-DLFdQos_.js";import"./entity-service-Cpn5Fxqr.js";import{t as c}from"./use-all-groups-CdEQrry9.js";var l=e(t(),1);function u(){let{searchTerm:e,submittedTerm:t,handleInputChange:u,handleSearchSubmit:d,handleClearSearch:f}=r(),{isLoading:p,error:m,refresh:h,allGroups:g}=c(),_=(g||[]).filter(e=>e.toLowerCase().includes(t.toLowerCase())).map(e=>({id:e,groupName:e})),v=e=>(0,l.jsx)(`div`,{className:`invisible group-hover:visible`,children:(0,l.jsx)(s,{entityId:e,suffix:`/experiments`,route:`/groups`,buttonText:`Manage permissions`})});return(0,l.jsxs)(a,{title:`Groups`,children:[(0,l.jsx)(o,{isLoading:p,loadingText:`Loading groups list...`,error:m,onRetry:h}),!p&&!m&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`mb-2`,children:(0,l.jsx)(n,{value:e,onInputChange:u,onSubmit:d,onClear:f,placeholder:`Search groups...`})}),(0,l.jsx)(i,{data:_,searchTerm:t,columns:[{header:`Group Name`,render:({groupName:e})=>(0,l.jsx)(`span`,{className:`truncate block`,title:e,children:e})},{header:`Permissions`,render:({groupName:e})=>v(e),className:`flex-shrink-0`}]})]})]})}export{u as default};