"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7110],{57110:function(v,p,t){t.r(p),t.d(p,{TechDocsCustomHome:function(){return A}});var e=t(2784),D=t(64279),T=t(79692),d=t(53479),O=t(21956),g=t(51016),E=t(1114),a=t(53492),f=t(36964);const M={DocsTable:O.DocsTable,DocsCardGrid:g.f},h=({config:n,entities:o,index:r})=>{const u=(0,T.Z)({panelContainer:{marginBottom:"2rem",...n.panelCSS?n.panelCSS:{}}})(),{loading:c,isOwnedEntity:m}=(0,d.useEntityOwnership)(),i=M[n.panelType],_=o.filter(s=>n.filterPredicate==="ownedByUser"?c?!1:m(s):typeof n.filterPredicate=="function"&&n.filterPredicate(s));return e.createElement(e.Fragment,null,e.createElement(a.ContentHeader,{title:n.title,description:n.description},r===0?e.createElement(a.SupportButton,null,"Discover documentation in your ecosystem."):null),e.createElement("div",{className:u.panelContainer},e.createElement(i,{"data-testid":"techdocs-custom-panel",entities:_})))},A=n=>{const{tabsConfig:o}=n,[r,C]=(0,e.useState)(0),u=(0,f.useApi)(d.catalogApiRef),{value:c,loading:m,error:i}=(0,D.default)(async()=>(await u.getEntities({filter:{"metadata.annotations.backstage.io/techdocs-ref":d.CATALOG_FILTER_EXISTS},fields:["apiVersion","kind","metadata","relations","spec.owner","spec.type"]})).items.filter(l=>{var P;return!!((P=l.metadata.annotations)!=null&&P["backstage.io/techdocs-ref"])})),_=o[r];return m?e.createElement(E.j,null,e.createElement(a.Content,null,e.createElement(a.Progress,null))):i?e.createElement(E.j,null,e.createElement(a.Content,null,e.createElement(a.WarningPanel,{severity:"error",title:"Could not load available documentation."},e.createElement(a.CodeSnippet,{language:"text",text:i.toString()})))):e.createElement(E.j,null,e.createElement(a.HeaderTabs,{selectedIndex:r,onChange:s=>C(s),tabs:o.map(({label:s},l)=>({id:l.toString(),label:s}))}),e.createElement(a.Content,{"data-testid":"techdocs-content"},_.panels.map((s,l)=>e.createElement(h,{key:l,config:s,entities:c||[],index:l}))))}}}]);})();

//# sourceMappingURL=7110.4f2d78ba.chunk.js.map