import{r as e,t}from"./jsx-runtime-DAs1UGHr.js";import"./react-DxF41JXl.js";import"./use-runtime-config-D_-Z8FUB.js";import"./use-api-BAbm8GVs.js";import"./user-service-Cq_o-JT5.js";import{t as n}from"./page-container-DV9_twon.js";import{i as r,n as i,r as a,t as o}from"./search-input-DVDKmJAY.js";import{t as s}from"./use-all-users-DZm-oESG.js";import{t as c}from"./row-action-button-CWxfWRow.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,allUsers:g}=s(),_=(g||[]).filter(e=>e.toLowerCase().includes(t.toLowerCase())).map(e=>({id:e,username:e})),v=e=>(0,l.jsx)(`div`,{className:`invisible group-hover:visible`,children:(0,l.jsx)(c,{entityId:`${e}/experiments`,route:`/users`,buttonText:`Manage permissions`})});return(0,l.jsxs)(n,{title:`Users`,children:[(0,l.jsx)(i,{isLoading:p,loadingText:`Loading users list...`,error:m,onRetry:h}),!p&&!m&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`mb-2`,children:(0,l.jsx)(o,{value:e,onInputChange:u,onSubmit:d,onClear:f,placeholder:`Search users...`})}),(0,l.jsx)(a,{mode:`object`,data:_,searchTerm:t,columns:[{header:`Username`,render:({username:e})=>e},{header:`Permissions`,render:({username:e})=>v(e),className:`flex-shrink-0`}]})]})]})}export{u as default};