try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f9221e5c-2c39-49a5-8a26-a4c8aa24cd09",e._sentryDebugIdIdentifier="sentry-dbid-f9221e5c-2c39-49a5-8a26-a4c8aa24cd09")}catch(e){}("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:{}).SENTRY_RELEASE={id:"13fef0030d956eda25f81a49c02cdf9f738e0982"};(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[578],{70578:(e,t,n)=>{n.r(t),n.d(t,{default:()=>m});var o=n(96540),r=n(90328),a=(n(98992),n(54520),n(81454),n(37550),n(10302)),d=n(46587),l=n(47090),c=n(16015);const s=new URLSearchParams(window.location.search.substr(1)),i=()=>{location.assign(`https://registry.my-netdata.io/goto-host-from-alarm.html${location.search}`)},f=e=>fetch(e,{redirect:"follow"}).then((()=>e)),h=e=>{let t="top;nowelcome=1";for(let[o,r]of s.entries())o=decodeURIComponent(o),"agentID"!==o&&(t+=`;${encodeURIComponent(o)}`,r=decodeURIComponent(r),""!==r&&(t+=`=${encodeURIComponent(r)}`));const n=new URL(e);return"/"===n.pathname&&(n.pathname=""),n.hash=t,n.toString()},p=(e,t)=>{if(!s.has("agentID"))return void(document.body.innerHTML='<p>missing "agentID" query string parameter</p>');(async(e,t)=>{try{return(await(0,c.tz)(t,e)).data}catch(n){const{data:e}=n.response;document.body.innerHTML=`${(0,l.o)(e?.errorMsgKey)}</br></br>Getting you back to Netdata...`;const t=new Error((0,l.o)(e?.errorMsgKey)||"Redirect error");throw t.name=`${e?.errorMsgKey||"Server error"}`,t.stack=`${e?.errorCode||"Redirect error code"}`,t}})(decodeURIComponent(s.get("agentID")||"unknown_agent_id"),e).catch((e=>{if("ErrVisitedNodeNotFound"!==e?.name)throw document.body.innerHTML=`<p>${e?.message}</p>`,e;i()})).then((e=>{const n=e?.urls?.map(h),o="https:"===location.protocol&&n.some((e=>!e.startsWith("https:"))),r=o?n.filter((e=>e.startsWith("https:"))):n;if(0!==r.length)return Promise.any(r.map(f)).then((()=>{location.assign(`url${t}`)}),(()=>{o?location.protocol="http:":document.body.innerHTML=`\n                <ul>\n                    ${n.map((e=>`<li><a href="${encodeURIComponent(e)}" target="_blank" rel="noopener noreferrer">${e}</a></li>`)).join("\n")}\n                </ul>\n            `}));o?location.protocol="http:":i()}))},u=()=>{const e=(0,d.NJ)(),{search:t}=(0,r.zy)();return(0,o.useEffect)((()=>{e&&p(e,t||"")}),[e,t]),o.createElement(a.H4,null,"Redirecting...")},m=()=>o.createElement(r.BV,null,o.createElement(r.qh,{path:"/redirects/alerts",element:o.createElement(u,null)}),o.createElement(r.qh,{path:"/redirects/alarms",element:o.createElement(u,null)})," ")}}]);