"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7560],{27560:function(g,D,e){e.r(D),e.d(D,{TechDocsCustomHome:function(){return v}});var t=e(52322),C=e(2784),p=e(64279),O=e(79692),d=e(43297),j=e(68435),x=e(85478),_=e(42081),n=e(93414),M=e(25248);const f={DocsTable:j.H,DocsCardGrid:x.f},T=({config:s,entities:i,index:r})=>{const E=(0,O.Z)({panelContainer:{marginBottom:"2rem",...s.panelCSS?s.panelCSS:{}}})(),{loading:c,isOwnedEntity:u}=(0,d.ZW)(),l=f[s.panelType],h=i.filter(a=>s.filterPredicate==="ownedByUser"?c?!1:u(a):typeof s.filterPredicate=="function"&&s.filterPredicate(a));return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.yW,{title:s.title,description:s.description,children:r===0?(0,t.jsx)(n.qt,{children:"Discover documentation in your ecosystem."}):null}),(0,t.jsx)("div",{className:E.panelContainer,children:(0,t.jsx)(l,{"data-testid":"techdocs-custom-panel",entities:h})})]})},v=s=>{const{tabsConfig:i}=s,[r,P]=(0,C.useState)(0),E=(0,M.h_)(d.Ah),{value:c,loading:u,error:l}=(0,p.default)(async()=>(await E.getEntities({filter:{"metadata.annotations.backstage.io/techdocs-ref":d.n3},fields:["apiVersion","kind","metadata","relations","spec.owner","spec.type"]})).items.filter(o=>{var m;return!!(!((m=o.metadata.annotations)===null||m===void 0)&&m["backstage.io/techdocs-ref"])})),h=i[r];return u?(0,t.jsx)(_.j,{children:(0,t.jsx)(n.VY,{children:(0,t.jsx)(n.Ex,{})})}):l?(0,t.jsx)(_.j,{children:(0,t.jsx)(n.VY,{children:(0,t.jsx)(n.GB,{severity:"error",title:"Could not load available documentation.",children:(0,t.jsx)(n.Oi,{language:"text",text:l.toString()})})})}):(0,t.jsxs)(_.j,{children:[(0,t.jsx)(n.aR,{selectedIndex:r,onChange:a=>P(a),tabs:i.map(({label:a},o)=>({id:o.toString(),label:a}))}),(0,t.jsx)(n.VY,{"data-testid":"techdocs-content",children:h.panels.map((a,o)=>(0,t.jsx)(T,{config:a,entities:c||[],index:o},o))})]})}}}]);})();

//# sourceMappingURL=7560.b3ed3a97.chunk.js.map