import{u as useSelector,ag as selectIsFullscreenEnabled,j as jsxRuntimeExports,B as Box,q as mountPanel}from"./js-core.esm4.js";import{o as selectors,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{b2 as Palette}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.selectItems,selectHasMore=selectors.selectHasMore,selectReadStatus=selectors.selectReadStatus,selectOffset=selectors.selectOffset,TableInfiniteScroll=tableInfiniteScroll.jsx.TableInfiniteScroll,itemHeight=150,getAutomatePalette=function(e){return e.details.nodeModules},TableRow=function(e){var t=e.item,e=e.onClick,s=getAutomatePalette(t),o="".concat(itemHeight-1,"px");return jsxRuntimeExports.jsx(Box,{sx:{width:"100%",height:o,borderBottom:"1px solid #D5DFE9","&:hover":{backgroundColor:"#f2f5f9",cursor:"pointer"}},children:jsxRuntimeExports.jsx(ResourceCard,{onClick:e,height:o,cardType:EResourceTypeValue.automatePalette,name:t.name||(null==(e=t.details)||null==(o=e.veritoneFile)?void 0:o.fileName)||"--",moduleRepo:null==s?void 0:s.moduleRepo,description:t.description,majorVersion:null==s?void 0:s.moduleVersion,owner:t.organization.name,fallbackIcon:jsxRuntimeExports.jsx(Palette,{})})})},AutomatePalettesTable=function(){var o=useDispatch(),r=useSelector(selectIsFullscreenEnabled),e=useSelector(selectActiveResourceTab),e=!!useSelector(selectActiveResourceSearchValues)[e],t=useSelector(selectItems),s=useSelector(selectHasMore),a=useSelector(selectOffset),l=useSelector(selectReadStatus),i=SHARED_TEXT$2.automatePalettes.emptyState,n=SHARED_TEXT$2.automatePalettes.errorState;return jsxRuntimeExports.jsx(TableInfiniteScroll,{hasMore:s,fetchMore:function(){o(actions.automatePalettes.readStart(null))},fetchOnMount:0===t.length,TableEmptyStateComponent:e?jsxRuntimeExports.jsx(EmptySearch,{}):void 0,offset:a,items:t,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=s,function(){var e="PALETTE_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(i,{}),MessageErrorState:jsxRuntimeExports.jsx(n,{})})};export{AutomatePalettesTable as default};
