import{bx as m,bp as p,r as n,dt as j,du as C,j as e,L as f,cr as b,y as R,B as r,bG as h,b4 as y,q as v,s as L,b5 as w,C as N,d as E,by as A}from"./index-C1DmWO_C.js";import{N as F}from"./NoData-Y_e6mfNf.js";import{R as G}from"./RoleChainingTable-ftBd5kM_.js";import"./useProjectOptions-BhlzfZPS.js";const B=()=>{m(A.iamRole);const d=p(),[i,l]=n.useState(""),{data:a=[],isLoading:t}=j(),{data:o,isLoading:g}=C(),[u,c]=n.useState([]);n.useEffect(()=>{!t&&a.length>0&&c(i?a.filter(s=>s.projectName.toLowerCase().includes(i)||s.cloudRole.toLowerCase().includes(i)):a)},[t,a,i]);const x=n.useCallback(({target:s})=>{l(s.value)},[l]);return t||g?e.jsx(f,{}):o!=null&&o.enabled?e.jsxs(R,{title:"IAM Role Chaining",maxHeight:"calc(100vh - 215px)",contentProps:{pb:0,overflow:"auto"},children:[e.jsxs(r,{mb:"28px",children:[e.jsxs(r,{width:4/5,children:[e.jsx(h,{color:"primary",mr:"5px",children:a.length}),e.jsx(h,{children:"role chaining"})]}),e.jsx(y,{onClick:()=>{d(v(L.settings.iamRoleChaining.create))},intent:"primary",ml:"auto",mt:-10,children:"New role chaining"})]}),a&&a.length>0?e.jsxs(e.Fragment,{children:[e.jsx(r,{mt:"10px",children:e.jsx(w,{width:"294px",value:i,icon:N.glass,placeholder:"Find a chaining by project name, cloud role...",onChange:x})}),e.jsx(G,{roleChaining:u,isEditable:!0})]}):e.jsx(E,{my:"40px",children:e.jsx(F,{mainText:"No IAM Role Chaining found"})})]}):e.jsx(b,{})};export{B as default};
