import{u as useSelector,ag as selectIsFullscreenEnabled,j as jsxRuntimeExports,B as Box,q as mountPanel}from"./js-core.esm4.js";import{m as selectors$5,s as selectActiveResourceTab,b as selectActiveResourceSearchValues,h as actions,S as SHARED_TEXT$2,P as PANEL_ID$5}from"./js-core.esm40.js";import{E as EResourceTypeValue}from"./js-core.esm15.js";import{t as tableInfiniteScroll}from"./js-core.esm9.js";import{W as FlowTemplate}from"./js-core.esm7.js";import{E as EmptySearch,R as ResourceCard}from"./js-core.esm105.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";import"./js-core.esm46.js";var selectItems=selectors$5.selectItems,selectHasMore=selectors$5.selectHasMore,selectReadStatus=selectors$5.selectReadStatus,selectOffset=selectors$5.selectOffset,TableInfiniteScroll=tableInfiniteScroll.jsx.TableInfiniteScroll,itemHeight=150,TableRow=function(e){var t=e.item,e=e.onClick,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.title,author:null==t?void 0:t.author,description:null==t?void 0:t.description,categories:null==t?void 0:t.categories,tags:null==t?void 0:t.tags,deploymentModel:null==t?void 0:t.deploymentModel,owner:null==t||null==(e=t.ownerOrganization)?void 0:e.name,isCertified:null==t||null==(s=t.testingDetails)?void 0:s.isCertified,avatarUrl:(null==t?void 0:t.signedLogoPath)||(null==t?void 0:t.signedIconPath),fallbackIcon:jsxRuntimeExports.jsx(FlowTemplate,{})})})},FlowTemplatesTable=function(){var o=useDispatch(),r=useSelector(selectIsFullscreenEnabled),e=useSelector(selectActiveResourceTab),e=!!useSelector(selectActiveResourceSearchValues)[e],t=useSelector(selectItems),s=useSelector(selectHasMore),l=useSelector(selectOffset),a=useSelector(selectReadStatus),i=SHARED_TEXT$2.flows.emptyState,n=SHARED_TEXT$2.flows.errorState;return jsxRuntimeExports.jsx(TableInfiniteScroll,{hasMore:s,fetchMore:function(){o(actions.flowTemplates.readStart(null))},fetchOnMount:0===t.length,TableEmptyStateComponent:e?jsxRuntimeExports.jsx(EmptySearch,{}):void 0,offset:l,items:t,itemHeight:itemHeight,isLoading:"pending"===a,error:"failure"===a,TableRowComponent:function(e){var t,s=e.item;return jsxRuntimeExports.jsx(TableRow,{item:s,index:e.index,onClick:(t=null==s?void 0:s.id,function(){o(mountPanel({panelId:PANEL_ID$5,microFrontend:{name:PANEL_ID$5,config:{templateId: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(i,{}),MessageErrorState:jsxRuntimeExports.jsx(n,{})})};export{FlowTemplatesTable as default};
