import{r as e,t}from"./jsx-runtime-DAs1UGHr.js";import{t as n}from"./react-DxF41JXl.js";import{s as r}from"./chunk-EPOLDU6W-CNaCjKeI.js";import"./use-runtime-config-D_-Z8FUB.js";import{t as i}from"./use-api-BAbm8GVs.js";import"./user-service-Cq_o-JT5.js";import"./toast-context-val-CcPDsXTx.js";import{t as a}from"./page-container-DV9_twon.js";import{a as o,o as s}from"./entity-service-D6-I4F0h.js";import{t as c}from"./use-all-experiments-2M5Vv300.js";import"./search-input-DVDKmJAY.js";import"./icon-button-8v1zbWfj.js";import"./use-toast-CpnYXdO8.js";import"./grant-permission-modal-Du7KzdTv.js";import{t as l}from"./entity-permissions-manager-DWYHawvC.js";import"./use-all-users-DZm-oESG.js";import"./use-all-accounts-C7-hDCIu.js";import"./use-all-groups-B9CScfsT.js";var u=e(n(),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(t(),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};