import{r as c}from"./vendor-react-wBh_31cN.js";import{u as E}from"./vendor-redux-CJZrIb6x.js";import{s as k}from"./alertUtil-MS8PGQKV.js";import{D as p}from"./alertManagerConfUtil-D4yp8Ca8.js";import{u as D}from"./useCurrentProject-C6qZaZgv.js";const M=()=>{var C,l,g,h;const{isLoading:d,project:o}=D(),e=E(k),n=!!((C=e==null?void 0:e.defaultChannels)!=null&&C.emailConfigured),s=!!((l=e==null?void 0:e.defaultChannels)!=null&&l.slackConfigured),r=!!((g=e==null?void 0:e.defaultChannels)!=null&&g.pagerdutyConfigured),i=!!((h=e==null?void 0:e.defaultChannels)!=null&&h.webhookConfigured),u=c.useMemo(()=>!!e&&!!e.receivers&&!!e.receivers.find(a=>a.name===p),[e]),f=c.useMemo(()=>!d&&!!(o!=null&&o.projectName)&&!!e&&!!e.receivers&&!!e.receivers.find(a=>a.name.startsWith(`${o==null?void 0:o.projectName}__`)),[e,d,o==null?void 0:o.projectName]),t=n||s||r||i,m=n||s||r||u||f;return c.useMemo(()=>({isDefaultEmailConfigured:n,isDefaultSlackConfigured:s,isDefaultPagerConfigured:r,isDefaultWebhookConfigured:i,isWenhookConfiguredForProject:f,isWebhookConfigured:u,alertChannelConfigured:t,canAddGlobalEvent:m}),[t,n,r,s,i,f,u,m])};export{M as u};
