File: //opt/netdata/usr/local/local/share/netdata/web/v3/9163.bbc12ecbebe37df6880f.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:"4feb900574abdd30667a599041aadc4fc9f8ac80"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="db8ae703-f951-443d-b46e-6adf838f69ba",e._sentryDebugIdIdentifier="sentry-dbid-db8ae703-f951-443d-b46e-6adf838f69ba")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[4401,9163],{7010(e,t,l){l.d(t,{A:()=>b});var o=l(96540),a=l(40961),n=l(38429),r=l(93331),i=l(22007),s=l(44862),u=l(74848);const c={right:"left",bottom:"top"},d={right:"left",top:"bottom"},g={left:"right",bottom:"top"},h={left:"right",top:"bottom"},b=e=>{let{open:t,children:l,containerRef:b,ref:p}=e;const m=(0,o.useRef)(),[f,x]=(0,o.useState)(),y=(0,o.useRef)(),k=(0,o.useRef)(),j=(0,o.useRef)(null),v=(0,o.useRef)(h),[C,L]=(0,o.useState)(h);y.current=f,k.current=(0,i.default)(f,m,C,"width");const M=(0,s.default)(),w=(0,o.useCallback)(e=>{let{x:t,y:l}=e;if(j.current={x:t,y:l},!y.current)return;if(y.current.style.left=`${t}px`,y.current.style.top=`${l}px`,!m.current||!b?.current)return void k.current?.();const o=b.current.getBoundingClientRect(),{width:a,height:n}=m.current.getBoundingClientRect(),r=o.left+t,i=o.top+l,s=(u=r+a>o.right,p=i+n>o.bottom,u&&p?c:u?d:p?g:h);var u,p;if(s!==v.current)return v.current=s,L(s),void requestAnimationFrame(()=>k.current?.());k.current?.()},[]);return(0,o.useImperativeHandle)(p,()=>({setPosition(e){e&&w(e)},clearPosition(){j.current=null}})),(0,o.useLayoutEffect)(()=>{t&&j.current&&w(j.current)},[t]),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(n.Flex,{ref:e=>x(e),position:"absolute"}),t&&l?a.createPortal((0,u.jsx)(r.default,{ref:m,column:!0,margin:[C.top?2:-2,C.right?-2:2],sx:{pointerEvents:"none"},zIndex:101,children:l}),M):null]})}},48367(e,t,l){l.d(t,{Cp:()=>n,LE:()=>o,Sf:()=>s,dO:()=>i,df:()=>r,x8:()=>a});const o=0,a={north:85.051129,south:-85.051129,east:179.999,west:-179.999},n=[[a.west,a.south],[a.east,a.north]],r=(e,t)=>{const l=Math.max(0,Math.min(e||0,t||0));return Math.max(56,Math.min(120,Math.round(.14*l)))},i=(e,t)=>{const l=Math.max(0,Number(e||0)),o=Math.max(0,Number(t||0));return l<=0||o<=0?0:l>=o?1:Math.max(0,Math.min(1,l/o))},s=(e,t)=>{const l=((e,t)=>1.2+4.3*i(e,t))(e,t),o=((e,t)=>.35+.63*i(e,t))(e,t);return{strokeWidth:l,strokeOpacity:o,hitWidth:Math.max(12,l+6)}}},39163(e,t,l){l.r(t),l.d(t,{default:()=>T});l(98992),l(81454);var o=l(96540),a=l(98907),n=l(51796),r=l(90098),i=l(38429),s=l(882),u=l(85660),c=l(57591),d=l(71103),g=l(7010),h=(l(54520),l(3949),l(48367));const b=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)(d.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)(d.tL,{label:"Total",value:(0,d.RU)(t.totalBytes)}),(0,p.jsx)(d.tL,{label:"Inbound",value:(0,d.RU)(t.inboundBytes)}),(0,p.jsx)(d.tL,{label:"Outbound",value:(0,d.RU)(t.outboundBytes)}),t.localBytes>0&&(0,p.jsx)(d.tL,{label:"Local",value:(0,d.RU)(t.localBytes)}),(0,p.jsx)(d.tL,{label:"Packets",value:(0,d.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)(d.PA,{children:"Combined bidirectional traffic"}),(0,p.jsxs)(i.Flex,{column:!0,width:"100%",children:[(0,p.jsx)(d.tL,{label:"Total bytes",value:(0,d.RU)(t.bytes)}),(0,p.jsx)(d.tL,{label:"Total packets",value:(0,d.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)(d.PA,{children:[e.sourceLabel," \u2192 ",e.targetLabel]}),(0,p.jsxs)(i.Flex,{column:!0,width:"100%",children:[(0,p.jsx)(d.tL,{label:"Bytes",value:(0,d.RU)(e.bytes)}),(0,p.jsx)(d.tL,{label:"Packets",value:(0,d.jw)(e.packets)})]})]},e.id))]})},j="//unpkg.com/three-globe/example/img",v=`${j}/earth-night.jpg`,C=`${j}/earth-blue-marble.jpg`,L=`${j}/earth-topology.png`,M="auto",w=[{id:M,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}],A=(0,n.A)(r,r.objects.countries).features,I=(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}),R=e=>{let{activeStyleId:t,onSelect:l}=e;return(0,p.jsx)(S,{active:t!==M,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))})},T=e=>{let{flows:t,columns:l,metric:n="bytes",height:r="100%"}=e;const d=(0,s.useTheme)(),f="Default"!==d.name,x=(0,o.useRef)(null),j=(0,o.useRef)(null),[S,{width:T,height:$}]=(0,u.A)(),[_,D]=(0,o.useState)(null),[B,N]=(0,o.useState)(null),[P,U]=(0,o.useState)(!0),[E,F]=(0,o.useState)(M),O=(0,o.useRef)(null),H=(0,o.useRef)(null),q=(0,o.useRef)(!1),W=(0,o.useMemo)(()=>E!==M?w.find(e=>e.id===E)||w[1]:{id:M,globeImageUrl:f?v:C,countries:!1},[E,f]),z=W.countries?A:[],G=(0,o.useMemo)(()=>(0,c.oT)(t,"city-map",l),[t,l]),Y=(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}})}(G.nodes,n),[G.nodes,n]),V=(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,h.dO)(r,a),s=Math.sqrt(i),u=.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:u,opacity:c,ratio:i,value:r,link:e}}).filter(Boolean)}(G.links,G.nodeById,n),[G.links,G.nodeById,n]),X=d.colors?.accent||d.colors?.primaryHighlight||d.colors?.primary||"#00ab44",J=X,K=(0,o.useCallback)(e=>I(X,e?.opacity??.5),[X]),Q=(0,o.useCallback)(()=>J,[J]),Z=(0,o.useCallback)(()=>{P&&U(!1)},[P]);(0,o.useEffect)(()=>{const e=x.current?.controls?.();e&&(e.autoRotate=P,e.autoRotateSpeed=.35)},[P]),(0,o.useEffect)(()=>{const e=x.current;if(!e||!Y.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:b(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:b((t+l)/2),lng:(o+a)/2,altitude:s}})(G.nodes);e.pointOfView(t,900),q.current=!0},[G.nodes,Y.length]);const ee=(0,o.useCallback)(e=>{D(e||null),e?(N(null),H.current&&O.current?.setPosition(H.current)):O.current?.clearPosition()},[]),te=(0,o.useCallback)(e=>{_||(N(e||null),e&&H.current?O.current?.setPosition(H.current):e||O.current?.clearPosition())},[_]),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(),D(null),N(null)},[]),ae=(0,o.useMemo)(()=>_?.node?{kind:"node",data:_.node}:B?.link?{kind:"link",data:B.link}:null,[B,_]),ne=(0,o.useCallback)(e=>{j.current=e,S(e)},[S]),re=(0,o.useMemo)(()=>I(X,f?.65:.75),[X,f]),ie=(0,o.useMemo)(()=>I(X,f?.08:.05),[X,f]),se=(0,o.useCallback)(()=>ie,[ie]),ue=(0,o.useCallback)(()=>re,[re]),ce=(0,o.useCallback)(()=>"rgba(0, 0, 0, 0)",[]);return G.nodes.length?(0,p.jsxs)(m,{ref:ne,height:r,onMouseMove:le,onMouseLeave:oe,onMouseDown:Z,onWheel:Z,children:[(0,p.jsx)(R,{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:T||void 0,height:$||void 0,backgroundColor:f?"#0b1318":"#e5f1f6",globeImageUrl:W.globeImageUrl,bumpImageUrl:L,atmosphereColor:f?"#5ec2ff":"#4ba3d1",atmosphereAltitude:.18,showAtmosphere:!0,animateIn:!0,pointsData:Y,pointLat:"lat",pointLng:"lng",pointAltitude:0,pointRadius:"radius",pointColor:Q,pointsMerge:!1,onPointHover:ee,arcsData:V,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:z,polygonAltitude:.006,polygonCapColor:se,polygonSideColor:ce,polygonStrokeColor:ue,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."})})})}}}]);