import{bb as m,b4 as p,r as n,cW as j,cX as f,j as e,L as C,bW as b,Q as R,d as r,aV as h,b6 as v,o as L,q as w,aR as N,T as y,c as E,bc as T}from"./index-CK33qGU_.js";import{N as A}from"./NoData-CuLyR2Bg.js";import{R as Q}from"./RoleChainingTable-Bhm4Y5YG.js";import"./useProjectOptions-CUI0IhzU.js";const H=()=>{m(T.iamRole);const d=p(),[i,l]=n.useState(""),{data:a=[],isLoading:t}=j(),{data:o,isLoading:g}=f(),[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(C,{}):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(v,{onClick:()=>{d(L(w.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(N,{width:"294px",value:i,icon:y.glass,placeholder:"Find a chaining by project name, cloud role...",onChange:x})}),e.jsx(Q,{roleChaining:u,isEditable:!0})]}):e.jsx(E,{my:"40px",children:e.jsx(A,{mainText:"No IAM Role Chaining found"})})]}):e.jsx(b,{})};export{H as default};
