File: //opt/netdata/usr/local/share/netdata/web/v3/4401.0df690c16a9633154518.chunk.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"81e2ee4047c533a9c262178a6611e7b957d46030"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="539fce5b-e64d-4b8b-8e3f-1d951fc7fe2d",e._sentryDebugIdIdentifier="sentry-dbid-539fce5b-e64d-4b8b-8e3f-1d951fc7fe2d")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[4401],{39163(e,t,l){l.r(t),l.d(t,{default:()=>_});l(98992),l(81454);var o=l(96540),a=l(98907),n=l(51796),r=l(90098),i=l(38429),s=l(882),d=l(85660),c=l(57591),u=l(71103),g=l(7010),b=(l(54520),l(3949),l(48367));const h=e=>Math.max(-85,Math.min(85,e));var p=l(74848);const m=(0,s.default)(i.Flex).withConfig({displayName:"globeTab__GlobeContainer",componentId:"sc-xxp3vl-0"})(["position:relative;width:100%;height:100%;min-height:0;overflow:hidden;"]),f=(0,s.default)(i.Flex).attrs({column:!0,gap:1,padding:[2,3],round:2,background:"mainBackground",border:"borderSecondary"}).withConfig({displayName:"globeTab__OverlayCard",componentId:"sc-xxp3vl-1"})(["box-shadow:0 4px 12px rgba(0,0,0,0.2);"]),x=(0,s.default)(f).withConfig({displayName:"globeTab__DetailCard",componentId:"sc-xxp3vl-2"})(["width:min(320px,calc(100% - 20px));"]),y=e=>{let{node:t}=e;return(0,p.jsxs)(f,{width:{min:"220px",max:"320px"},children:[(0,p.jsx)(i.Text,{strong:!0,children:t.label||"-"}),!!t.subtitle&&(0,p.jsx)(u.PA,{children:t.subtitle}),!!t.code&&t.code!==t.label&&(0,p.jsx)(i.TextSmall,{color:"textDescription",children:t.code}),(0,p.jsxs)(i.Flex,{column:!0,width:"100%",children:[(0,p.jsx)(u.tL,{label:"Total",value:(0,u.RU)(t.totalBytes)}),(0,p.jsx)(u.tL,{label:"Inbound",value:(0,u.RU)(t.inboundBytes)}),(0,p.jsx)(u.tL,{label:"Outbound",value:(0,u.RU)(t.outboundBytes)}),t.localBytes>0&&(0,p.jsx)(u.tL,{label:"Local",value:(0,u.RU)(t.localBytes)}),(0,p.jsx)(u.tL,{label:"Packets",value:(0,u.jw)(t.totalPackets)})]})]})},k=e=>{let{link:t}=e;if(!t)return null;const l=Array.isArray(t.directions)?t.directions:[],o=l[0]||null,a=l.length>1,n=a?`${t.nodeALabel} \u2194 ${t.nodeBLabel}`:o?`${o.sourceLabel} \u2192 ${o.targetLabel}`:`${t.nodeALabel} \u2194 ${t.nodeBLabel}`;return(0,p.jsxs)(x,{children:[(0,p.jsx)(i.Text,{strong:!0,children:n}),a&&(0,p.jsx)(u.PA,{children:"Combined bidirectional traffic"}),(0,p.jsxs)(i.Flex,{column:!0,width:"100%",children:[(0,p.jsx)(u.tL,{label:"Total bytes",value:(0,u.RU)(t.bytes)}),(0,p.jsx)(u.tL,{label:"Total packets",value:(0,u.jw)(t.packets)})]}),a&&l.map(e=>(0,p.jsxs)(i.Flex,{column:!0,gap:1,padding:[2,0,0,0],border:{side:"top",color:"borderSecondary"},children:[(0,p.jsxs)(u.PA,{children:[e.sourceLabel," \u2192 ",e.targetLabel]}),(0,p.jsxs)(i.Flex,{column:!0,width:"100%",children:[(0,p.jsx)(u.tL,{label:"Bytes",value:(0,u.RU)(e.bytes)}),(0,p.jsx)(u.tL,{label:"Packets",value:(0,u.jw)(e.packets)})]})]},e.id))]})},j="//unpkg.com/three-globe/example/img",v=`${j}/earth-night.jpg`,L=`${j}/earth-blue-marble.jpg`,C=`${j}/earth-topology.png`,A="auto",w=[{id:A,label:"Auto",tooltip:"Auto (matches theme)"},{id:"night",label:"Night",tooltip:"Night lights (NASA)",globeImageUrl:`${j}/earth-night.jpg`},{id:"day",label:"Day",tooltip:"Daytime earth",globeImageUrl:`${j}/earth-day.jpg`},{id:"blue-marble",label:"Marble",tooltip:"Blue Marble satellite (NASA)",globeImageUrl:`${j}/earth-blue-marble.jpg`},{id:"topology",label:"Topo",tooltip:"Topology relief",globeImageUrl:`${j}/earth-topology.png`},{id:"dark",label:"Dark",tooltip:"Dark monochrome",globeImageUrl:`${j}/earth-dark.jpg`},{id:"countries",label:"Borders",tooltip:"Country borders",globeImageUrl:`${j}/earth-dark.jpg`,countries:!0}],I=(0,n.A)(r,r.objects.countries).features,M=(e,t)=>{if("string"!==typeof e)return`rgba(0, 171, 68, ${t})`;const l=e.replace("#","");if(6!==l.length&&3!==l.length)return`rgba(0, 171, 68, ${t})`;const o=3===l.length?l.split("").map(e=>e+e).join(""):l;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`},S=(0,s.default)(i.Flex).withConfig({shouldForwardProp:e=>"active"!==e}).withConfig({displayName:"globeTab__StyleToolbar",componentId:"sc-xxp3vl-3"})(["position:absolute;top:8px;right:8px;z-index:5;gap:3px;align-items:center;border-radius:6px;padding:3px;background:rgba(15,24,24,0.65);opacity:",";transition:opacity 0.18s;&:hover{opacity:1;}"],e=>{let{active:t}=e;return t?1:.55}),T=e=>{let{activeStyleId:t,onSelect:l}=e;return(0,p.jsx)(S,{active:t!==A,children:w.map(e=>(0,p.jsx)(i.Button,{flavour:t===e.id?"default":"hollow",small:!0,onClick:()=>l(e.id),tooltip:e.tooltip,"aria-label":`Select ${e.tooltip} globe style`,children:e.label},e.id))})},_=e=>{let{flows:t,columns:l,metric:n="bytes",height:r="100%"}=e;const u=(0,s.useTheme)(),f="Default"!==u.name,x=(0,o.useRef)(null),j=(0,o.useRef)(null),[S,{width:_,height:$}]=(0,d.A)(),[D,R]=(0,o.useState)(null),[B,N]=(0,o.useState)(null),[U,P]=(0,o.useState)(!0),[E,F]=(0,o.useState)(A),O=(0,o.useRef)(null),H=(0,o.useRef)(null),q=(0,o.useRef)(!1),G=(0,o.useMemo)(()=>E!==A?w.find(e=>e.id===E)||w[1]:{id:A,globeImageUrl:f?v:L,countries:!1},[E,f]),Y=G.countries?I:[],z=(0,o.useMemo)(()=>(0,c.oT)(t,"city-map",l),[t,l]),V=(0,o.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bytes";if(!Array.isArray(e)||!e.length)return[];const l=(e=>"packets"===e?"totalPackets":"totalBytes")(t),o=Math.max(0,...e.map(e=>Number(e?.[l]||0)));return e.map(e=>{const t=o>0?Number(e?.[l]||0)/o:0,a=.18+.72*Math.sqrt(Math.max(0,Math.min(1,t)));return{id:e.id,lat:e._geo.latitude,lng:e._geo.longitude,radius:a,node:e}})}(z.nodes,n),[z.nodes,n]),W=(0,o.useMemo)(()=>function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"bytes";if(!Array.isArray(e)||!e.length)return[];const o=(e=>"packets"===e?"packets":"bytes")(l),a=Math.max(0,...e.map(e=>Number(e?.[o]||0)));return e.map(e=>{const l=t?.[e.fromNodeId],n=t?.[e.toNodeId];if(!l||!n)return null;const r=Number(e?.[o]||0),i=(0,b.dO)(r,a),s=Math.sqrt(i),d=.22+s*(1.05-.22),c=.18+s*(1-.18);return{id:e.id,startLat:l._geo.latitude,startLng:l._geo.longitude,endLat:n._geo.latitude,endLng:n._geo.longitude,stroke:d,opacity:c,ratio:i,value:r,link:e}}).filter(Boolean)}(z.links,z.nodeById,n),[z.links,z.nodeById,n]),X=u.colors?.accent||u.colors?.primaryHighlight||u.colors?.primary||"#00ab44",J=X,K=(0,o.useCallback)(e=>M(X,e?.opacity??.5),[X]),Q=(0,o.useCallback)(()=>J,[J]),Z=(0,o.useCallback)(()=>{U&&P(!1)},[U]);(0,o.useEffect)(()=>{const e=x.current?.controls?.();e&&(e.autoRotate=U,e.autoRotateSpeed=.35)},[U]),(0,o.useEffect)(()=>{const e=x.current;if(!e||!V.length||q.current)return;const t=(e=>{if(!Array.isArray(e)||!e.length)return{lat:0,lng:0,altitude:2.4};if(1===e.length)return{lat:h(e[0]._geo.latitude),lng:e[0]._geo.longitude,altitude:1.8};let t=1/0,l=-1/0,o=1/0,a=-1/0;e.forEach(e=>{const{latitude:n,longitude:r}=e._geo;n<t&&(t=n),n>l&&(l=n),r<o&&(o=r),r>a&&(a=r)});const n=Math.max(0,l-t),r=Math.max(0,a-o),i=Math.max(n,r),s=Math.max(1.4,Math.min(3.2,.6+i/80));return{lat:h((t+l)/2),lng:(o+a)/2,altitude:s}})(z.nodes);e.pointOfView(t,900),q.current=!0},[z.nodes,V.length]);const ee=(0,o.useCallback)(e=>{R(e||null),e?(N(null),H.current&&O.current?.setPosition(H.current)):O.current?.clearPosition()},[]),te=(0,o.useCallback)(e=>{D||(N(e||null),e&&H.current?O.current?.setPosition(H.current):e||O.current?.clearPosition())},[D]),le=(0,o.useCallback)(e=>{const t=j.current?.getBoundingClientRect();if(!t)return;const l={x:e.clientX-t.left,y:e.clientY-t.top};H.current=l,O.current?.setPosition(l)},[]),oe=(0,o.useCallback)(()=>{H.current=null,O.current?.clearPosition(),R(null),N(null)},[]),ae=(0,o.useMemo)(()=>D?.node?{kind:"node",data:D.node}:B?.link?{kind:"link",data:B.link}:null,[B,D]),ne=(0,o.useCallback)(e=>{j.current=e,S(e)},[S]),re=(0,o.useMemo)(()=>M(X,f?.65:.75),[X,f]),ie=(0,o.useMemo)(()=>M(X,f?.08:.05),[X,f]),se=(0,o.useCallback)(()=>ie,[ie]),de=(0,o.useCallback)(()=>re,[re]),ce=(0,o.useCallback)(()=>"rgba(0, 0, 0, 0)",[]);return z.nodes.length?(0,p.jsxs)(m,{ref:ne,height:r,onMouseMove:le,onMouseLeave:oe,onMouseDown:Z,onWheel:Z,children:[(0,p.jsx)(T,{activeStyleId:E,onSelect:F}),(0,p.jsx)(g.A,{ref:O,open:!!ae,containerRef:j,children:"node"===ae?.kind?(0,p.jsx)(y,{node:ae.data}):(0,p.jsx)(k,{link:ae?.data})}),(0,p.jsx)(a.A,{ref:x,width:_||void 0,height:$||void 0,backgroundColor:f?"#0b1318":"#e5f1f6",globeImageUrl:G.globeImageUrl,bumpImageUrl:C,atmosphereColor:f?"#5ec2ff":"#4ba3d1",atmosphereAltitude:.18,showAtmosphere:!0,animateIn:!0,pointsData:V,pointLat:"lat",pointLng:"lng",pointAltitude:0,pointRadius:"radius",pointColor:Q,pointsMerge:!1,onPointHover:ee,arcsData:W,arcStartLat:"startLat",arcStartLng:"startLng",arcEndLat:"endLat",arcEndLng:"endLng",arcStroke:"stroke",arcAltitudeAutoScale:.4,arcColor:K,arcDashLength:1,arcDashGap:0,arcDashAnimateTime:0,arcsTransitionDuration:400,onArcHover:te,polygonsData:Y,polygonAltitude:.006,polygonCapColor:se,polygonSideColor:ce,polygonStrokeColor:de,polygonsTransitionDuration:300})]}):(0,p.jsx)(m,{ref:ne,height:r,children:(0,p.jsx)(i.Flex,{justifyContent:"center",alignItems:"center",height:"100%",padding:[5],children:(0,p.jsx)(i.Text,{color:"textLite",children:"No plottable geography available for the current selection."})})})}}}]);