"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[957],{50957(U,e,a){a.r(e),a.d(e,{default:()=>R});var t=a(74848),E=a(2543),K=a.n(E),l=a(92745),P=a(6975),g=a(34999),O=a(58684),u=a(31286),M=a(77256),s=a(38533),f=a(70907),D=a(35480),m=a(43825);const v="unknown";function C({alertManagerSource:_,instances:B}){const{treeMatchingResults:c,isLoading:A,error:d}=(0,m.U)(_.name,B);if(d){const n=(0,l.t)("alerting.notification-preview.error","Could not load routing preview for {{alertmanager}}",{alertmanager:_.name});return(0,t.jsx)(g.F,{title:n,severity:"error",children:(0,M.JZ)(d)})}if(A)return(0,t.jsx)(P._,{text:(0,l.t)("alerting.notification-preview-by-alert-manager.text-loading-routing-preview","Loading routing preview...")});const h=c.some(n=>n.matchedRoutes.length>0),I=c.flatMap(({labels:n,matchedRoutes:i})=>Array.from(i).map(({route:o,routeTree:r,matchDetails:T})=>({labels:n,receiver:o.receiver||v,routeTree:r,matchDetails:T}))),L=(0,E.groupBy)(I,"receiver");return h?(0,t.jsx)(u.a,{display:"flex",direction:"column",gap:1,width:"100%",children:(0,t.jsx)(s.B,{direction:"column",gap:0,children:Object.entries(L).map(([n,i])=>(0,t.jsx)(f.BN,{name:n,matchedInstancesCount:i.length,alertmanagerSourceName:_.name,children:(0,t.jsx)(s.B,{direction:"column",gap:0,children:i.map(({routeTree:o,matchDetails:r})=>(0,t.jsx)(D.t,{matchedInstance:r,policyTreeSpec:o.expandedSpec,policyTreeMetadata:o.metadata},r.labels.join(",")))})},n))})}):null}const R=(0,O.Xc)(C)}}]);

//# sourceMappingURL=957.5b2be19b7a8b6f080ebb.js.map