const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UserForm-DsmHPAWo.js","assets/render-cqdoDfd9.js","assets/Box-pvlRBLzs.js","assets/Button-D-nJohaT.js","assets/MenuItem-CsbWpzKb.js","assets/Select-BbgK42y1.js","assets/formControlState-ClbFzec2.js","assets/Paper-DtiadJnq.js","assets/utils-8Bj6112o.js","assets/Grow-g9iGpiDr.js","assets/listItemTextClasses-vsX2DYjS.js","assets/TextField-CbQ6hH_9.js","assets/isMuiElement-BOXXIqCm.js","assets/isMuiElement-DqyCXM2X.js","assets/Typography-8v555lWC.js","assets/utils-C0ZHLGh_.js","assets/DeleteUserDialog-jfd2tiii.js","assets/Warning-CywfiYbG.js","assets/Alert-BpUkH7Nx.js","assets/IconButton-BkXELyri.js","assets/DialogActions-IskUXpPi.js","assets/DialogTitle-HCb6VQhm.js","assets/DialogContext-CWuRPZWu.js","assets/DialogContentText-EZ4FAf5e.js"])))=>i.map(i=>d[i]);
import{_t as s,lt as e,n as r,t as o,yt as i}from"./render-cqdoDfd9.js";import"./modulepreload-polyfill-DgzdhEGd.js";import{t as n}from"./Grid-BiwBFfYj.js";import{t as a}from"./Box-pvlRBLzs.js";import{t}from"./Base-CUv3vwU4.js";import{t as l}from"./Typography-8v555lWC.js";import{t as d}from"./Button-D-nJohaT.js";import{t as c}from"./IconButton-BkXELyri.js";import{t as h}from"./Dialog-BdfDhNhZ.js";import{t as j}from"./LinearProgress-jZTkf1Z2.js";import{t as m}from"./TableContainer-FwpzIaZ5.js";import{a as x,i as p,n as f,r as u,t as g}from"./TableCell-DrJgogcq.js";import{t as b}from"./utils-C0ZHLGh_.js";import{t as _}from"./Delete-BZeRDRIq.js";import{t as C}from"./Edit-Cm0FSuCS.js";import{t as z}from"./preload-helper-w1h2GTnA.js";var S=i(s(),1),k=e(),y=(0,S.lazy)(()=>z(()=>import("./UserForm-DsmHPAWo.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),T=(0,S.lazy)(()=>z(()=>import("./DeleteUserDialog-jfd2tiii.js"),__vite__mapDeps([16,1,17,7,18,19,2,3,20,21,22,14,23,15])));o({children:(0,k.jsx)(function(){const[s,e]=(0,S.useState)(null),[o,i]=(0,S.useState)([]),[z,E]=(0,S.useState)(!1),[B,D]=(0,S.useState)(null),{localeMessages:R,direction:v,userRole:I,apiBaseUrl:U,platformBaseUrl:$,organizationId:w}=r(),L=()=>{fetch(`${U}/organizations/${w}/users/`,{method:"GET",headers:{"Content-Type":"application/json","X-CSRFToken":b("csrftoken")}}).then(s=>s.json()).then(s=>{i(s.organization_users)}).catch(s=>{})};return(0,S.useEffect)(()=>{fetch(`${U}/organizations/${w}/`,{method:"GET",headers:{"Content-Type":"application/json","X-CSRFToken":b("csrftoken")}}).then(s=>s.json()).then(s=>{e(s)}).catch(s=>{}),L()},[]),(0,k.jsxs)(t,{breadCrumbList:[{label:R.organizations,href:`${$}/organizations`,index:0},{label:s?s.name:"",href:"#",index:1}],showOrganizationSwitcher:!1,children:[(0,k.jsx)(n,{size:12,py:2,px:4,children:(0,k.jsxs)(a,{sx:{p:2,border:"1px solid",borderColor:"border.main",backgroundColor:"background.box",borderRadius:2,minHeight:300},children:[(0,k.jsx)(d,{variant:"contained",color:"secondary",onClick:()=>{D((0,k.jsx)(S.Suspense,{fallback:(0,k.jsx)(a,{sx:{p:2},children:(0,k.jsx)(j,{})}),children:(0,k.jsx)(y,{organizationId:w,onClose:()=>E(!1),refreshUsers:L})})),E(!0)},children:R.add_user}),(0,k.jsx)(a,{sx:{mt:2,width:"100%"},children:o.length>0?(0,k.jsx)(m,{children:(0,k.jsxs)(x,{children:[(0,k.jsx)(p,{children:(0,k.jsxs)(u,{children:[(0,k.jsx)(g,{children:R.user}),(0,k.jsx)(g,{children:R.role}),"viewer"!==I&&(0,k.jsx)(g,{align:"rtl"===v?"left":"right",children:R.actions})]})}),(0,k.jsx)(f,{children:o.map(s=>(0,k.jsxs)(u,{children:[(0,k.jsx)(g,{children:s.email}),(0,k.jsx)(g,{children:s.role}),"viewer"!==I&&(0,k.jsxs)(g,{align:"rtl"===v?"left":"right",children:[(0,k.jsx)(c,{onClick:()=>{(s=>{D((0,k.jsx)(S.Suspense,{fallback:(0,k.jsx)(a,{sx:{p:2},children:(0,k.jsx)(j,{})}),children:(0,k.jsx)(y,{organizationId:w,onClose:()=>E(!1),refreshUsers:L,user:s})})),E(!0)})(s)},children:(0,k.jsx)(C,{fontSize:"small"})}),(0,k.jsx)(c,{"aria-label":`Delete ${s.email}`,onClick:()=>{D((0,k.jsx)(S.Suspense,{fallback:(0,k.jsx)(a,{sx:{p:2},children:(0,k.jsx)(j,{})}),children:(0,k.jsx)(T,{user:s,handleClose:()=>E(!1),handleSuccess:()=>{L(),E(!1)}})})),E(!0)},children:(0,k.jsx)(_,{fontSize:"small"})})]})]},s.user_id))})]})}):(0,k.jsx)(l,{variant:"body1",children:R.no_users_in_organization})})]})}),(0,k.jsx)(h,{open:z,onClose:()=>E(!1),fullWidth:!0,maxWidth:"sm",children:B})]})},{})});