import{bx as m,by as j,bo as p,r as n,dL as C,dM as f,j as e,D as b,cq as R,W as L,a as r,bG as h,aJ as v,s as y,t as w,aH as N,d as E,L as A,bT as I}from"./index-_eM6l4Nf.js";import{R as T}from"./RoleChainingTable-VZbwbdYl.js";import"./useProjectOptions-Drz85yrF.js";const H=()=>{m(j.iamRole);const d=p(),[i,l]=n.useState(""),{data:a=[],isLoading:t}=C(),{data:o,isLoading:g}=f(),[x,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 u=n.useCallback(({target:s})=>{l(s.value)},[l]);return t||g?e.jsx(b,{}):o!=null&&o.enabled?e.jsxs(L,{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(y(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:E.glass,placeholder:"Find a chaining by project name, cloud role...",onChange:u})}),e.jsx(T,{roleChaining:x,isEditable:!0})]}):e.jsx(A,{my:"40px",children:e.jsx(I,{mainText:"No IAM Role Chaining found"})})]}):e.jsx(R,{})};export{H as default};
