import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{s as r}from"./chunk-EPOLDU6W-D0V-bUtX.js";import"./use-runtime-config-CdmJxJlV.js";import{t as i}from"./use-api-B9Oy6xVu.js";import"./free-solid-svg-icons-Benb70zF.js";import"./user-service-DVOkVYAi.js";import"./toast-context-val-CNu2yH-Y.js";import{t as a}from"./page-container-BMEhlNFx.js";import{a as o,o as s}from"./entity-service-DrMWiR-B.js";import{t as c}from"./use-all-experiments-DjS16n4u.js";import"./search-input-ByD-Dxko.js";import"./icon-button-D_-Mxxn_.js";import"./use-toast-D5-H_UKc.js";import"./input-ozSpE79v.js";import"./grant-permission-modal-BQxevcQu.js";import{t as l}from"./entity-permissions-manager-DMpryHlo.js";import"./use-all-users-DKhhocY0.js";import"./use-all-accounts-GehIj2D_.js";import"./use-all-groups-DV3TJNFs.js";var u=e(t(),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=e(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};