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-BP86tdWK.js";import"./toast-context-val-mhxutRO0.js";import{t as a}from"./page-container-Bc69w3xC.js";import{a as o,o as s}from"./entity-service-CaH-DzP7.js";import{t as c}from"./use-all-experiments-De3KYkS2.js";import"./search-input-NxGyN2TF.js";import"./icon-button-B94rCe__.js";import"./use-toast-ClFuYvU2.js";import"./input-CjHmXOIG.js";import"./grant-permission-modal-9wt78Azp.js";import{t as l}from"./entity-permissions-manager-ZitO1rzL.js";import"./use-all-users-xWwgC44i.js";import"./use-all-accounts-C0S7ZoyI.js";import"./use-all-groups-hBcU1U0V.js";var u=t(e(),1);function d({experimentId:e}){let{data:t,isLoading:n,error:r,refetch:a}=i((0,u.useCallback)(t=>e===null?Promise.resolve([]):s(e,t),[e]));return{experimentUserPermissions:t??[],isLoading:n,error:r,refresh:a}}function f({experimentId:e}){let{data:t,isLoading:n,error:r,refetch:a}=i((0,u.useCallback)(t=>e===null?Promise.resolve([]):o(e,t),[e]));return{experimentGroupPermissions:t??[],isLoading:n,error:r,refresh:a}}var p=t(n(),1);function m(){let{experimentId:e}=r(),t=e||null,{isLoading:n,error:i,refresh:o,experimentUserPermissions:s}=d({experimentId:t}),{isLoading:u,error:m,refresh:h,experimentGroupPermissions:g}=f({experimentId:t}),_=n||u,v=i||m,y=()=>{o(),h()},b=[...s||[],...g||[]],{allExperiments:x}=c();if(!t)return(0,p.jsx)(`div`,{children:`Experiment ID is required.`});let S=x?.find(e=>e.id===t)?.name||t;return(0,p.jsx)(a,{title:`Permissions for Experiment ${S}`,children:(0,p.jsx)(l,{resourceId:t,resourceName:S,resourceType:`experiments`,permissions:b,isLoading:_,error:v,refresh:y})})}export{m as default};