import{i as e,o as t,r as n}from"./button-DJ30HgDO.js";import{s as r}from"./chunk-EPOLDU6W-BGm2xlSj.js";import"./use-runtime-config-CkwqDzno.js";import{t as i}from"./use-api-CtLXpHJw.js";import"./user-service-Dl9A7L06.js";import"./toast-context-val-Z-lwvYkJ.js";import"./page-status-CNIWXN7q.js";import"./page-container-DN56Bi3o.js";import"./icon-button-DFhNpcsD.js";import"./use-toast-BWmLhWRD.js";import"./input-BbiN5lj4.js";import"./grant-permission-modal-CddXPWUg.js";import{t as a}from"./entity-permissions-page-layout-CmGpyxVz.js";import"./use-all-users-Bs-V-nql.js";import"./use-all-accounts-B8jcgmIk.js";import{a as o,o as s}from"./entity-service-KdPsD3WQ.js";import"./use-all-groups-DdRVyBae.js";import{t as c}from"./use-all-experiments-C6QGQbcz.js";var l=t(e(),1);function u({experimentId:e}){let{data:t,isLoading:n,error:r,refetch:a}=i((0,l.useCallback)(t=>e===null?Promise.resolve([]):s(e,t),[e]));return{experimentUserPermissions:t??[],isLoading:n,error:r,refresh:a}}function d({experimentId:e}){let{data:t,isLoading:n,error:r,refetch:a}=i((0,l.useCallback)(t=>e===null?Promise.resolve([]):o(e,t),[e]));return{experimentGroupPermissions:t??[],isLoading:n,error:r,refresh:a}}var f=t(n(),1);function p(){let{experimentId:e}=r(),t=e||null,{isLoading:n,error:i,refresh:o,experimentUserPermissions:s}=u({experimentId:t}),{isLoading:l,error:p,refresh:m,experimentGroupPermissions:h}=d({experimentId:t}),g=n||l,_=i||p,v=()=>{o(),m()},{allExperiments:y}=c();if(!t)return(0,f.jsx)(`div`,{children:`Experiment ID is required.`});let b=y?.find(e=>e.id===t)?.name||t;return(0,f.jsx)(a,{title:`Permissions for Experiment ${b}`,resourceId:t,resourceName:b,resourceType:`experiments`,userPermissions:s,groupPermissions:h,isLoading:g,error:_,refresh:v})}export{p as default};