import{u as useSelector,ag as selectIsFullscreenEnabled,j as jsxRuntimeExports,B as Box,q as mountPanel}from"./js-core.esm4.js";import{n as selectors$1,s as selectActiveResourceTab,b as selectActiveResourceSearchValues,h as actions,S as SHARED_TEXT$2}from"./js-core.esm40.js";import{E as EResourceTypeValue}from"./js-core.esm15.js";import{t as tableInfiniteScroll}from"./js-core.esm9.js";import{b1 as AutomateNode}from"./js-core.esm7.js";import{E as EmptySearch,R as ResourceCard}from"./js-core.esm104.js";import{u as useDispatch}from"./js-core.esm12.js";import"./js-core.esm30.js";import"./js-core.esm28.js";import"./js-core.esm33.js";import"./js-core.esm37.js";var selectItems=selectors$1.selectItems,selectHasMore=selectors$1.selectHasMore,selectReadStatus=selectors$1.selectReadStatus,selectOffset=selectors$1.selectOffset,TableInfiniteScroll=tableInfiniteScroll.jsx.TableInfiniteScroll,itemHeight=150,getAutomateNode=function(e){return e.details.automateNode},TableRow=function(e){var t=e.item,e=e.onClick,t=getAutomateNode(t),s="".concat(itemHeight-1,"px");return jsxRuntimeExports.jsx(Box,{sx:{width:"100%",height:s,borderBottom:"1px solid #D5DFE9","&:hover":{backgroundColor:"#f2f5f9",cursor:"pointer"}},children:jsxRuntimeExports.jsx(ResourceCard,{onClick:e,height:s,cardType:EResourceTypeValue.flow,name:(null==t?void 0:t.module)||"--",author:null==t?void 0:t.author,description:null==t?void 0:t.desc,majorVersion:null==t?void 0:t.version,fallbackIcon:jsxRuntimeExports.jsx(AutomateNode,{})})})},AutomateNodesTable=function(){var o=useDispatch(),e=useSelector(selectActiveResourceTab),t=useSelector(selectActiveResourceSearchValues),r=useSelector(selectIsFullscreenEnabled),t=!!t[e],e=useSelector(selectItems),s=useSelector(selectHasMore),a=useSelector(selectOffset),l=useSelector(selectReadStatus),c=SHARED_TEXT$2.automateNodes.emptyState,i=SHARED_TEXT$2.automateNodes.errorState;return jsxRuntimeExports.jsx(TableInfiniteScroll,{hasMore:s,fetchMore:function(){o(actions.automateNodes.readStart(null))},fetchOnMount:0===e.length,TableEmptyStateComponent:t?jsxRuntimeExports.jsx(EmptySearch,{}):void 0,offset:a,items:e,itemHeight:itemHeight,isLoading:"pending"===l,error:"failure"===l,TableRowComponent:function(e){var t,s=e.item;return jsxRuntimeExports.jsx(TableRow,{item:s,index:e.index,onClick:(t=getAutomateNode(s),function(){var e="NODE_DETAILS_PANEL";o(mountPanel({panelId:e,microFrontend:{name:e,config:{payload:t}},panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:r?0:55,marginStart:r?0:80,size:"large",parentPanelId:"RESOURCE_CENTER",dimmed:0,dimmedStatus:"dimParent",borderBottom:!0}}))})})},MessageEmptyState:jsxRuntimeExports.jsx(c,{}),MessageErrorState:jsxRuntimeExports.jsx(i,{})})};export{AutomateNodesTable as default};
