import{bC as x,bw as p,r as n,dl as j,dm as C,j as e,L as f,ck as R,m as b,B as r,bK as h,aG as v,q as w,s as L,aM as N,Z as y,e as E,bD as A}from"./index-dP1W1_bd.js";import{N as k}from"./NoData-DLZ_8GEo.js";import{R as F}from"./RoleChainingTable-BAflRnbR.js";import"./useProjectOptions-FXFkYH64.js";const B=()=>{x(A.iamRole);const d=p(),[i,l]=n.useState(""),{data:a=[],isLoading:t}=j(),{data:o,isLoading:m}=C(),[g,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||m?e.jsx(f,{}):o!=null&&o.enabled?e.jsxs(b,{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(w(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(N,{width:"294px",value:i,icon:y.glass,placeholder:"Find a chaining by project name, cloud role...",onChange:u})}),e.jsx(F,{roleChaining:g,isEditable:!0})]}):e.jsx(E,{my:"40px",children:e.jsx(k,{mainText:"No IAM Role Chaining found"})})]}):e.jsx(R,{})};export{B as default};
