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{g as o,h as s}from"./entity-service-D6-I4F0h.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 c}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 l=e(n(),1);function u({promptName:e}){let{data:t,isLoading:n,error:r,refetch:a}=i((0,l.useCallback)(t=>e===null?Promise.resolve([]):o(e,t),[e]));return{promptUserPermissions:t??[],isLoading:n,error:r,refresh:a}}function d({promptName:e}){let{data:t,isLoading:n,error:r,refetch:a}=i((0,l.useCallback)(t=>e===null?Promise.resolve([]):s(e,t),[e]));return{promptGroupPermissions:t??[],isLoading:n,error:r,refresh:a}}var f=e(t(),1);function p(){let{promptName:e}=r(),{isLoading:t,error:n,refresh:i,promptUserPermissions:o}=u({promptName:e||null}),{isLoading:s,error:l,refresh:p,promptGroupPermissions:m}=d({promptName:e||null}),h=t||s,g=n||l,_=()=>{i(),p()},v=[...o||[],...m||[]];return e?(0,f.jsx)(a,{title:`Permissions for Prompt ${e}`,children:(0,f.jsx)(c,{resourceId:e,resourceName:e,resourceType:`prompts`,permissions:v,isLoading:h,error:g,refresh:_})}):(0,f.jsx)(`div`,{children:`Prompt Name is required.`})}export{p as default};