"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5511],{95511:(le,O,f)=>{f.d(O,{F:()=>et});var y=f(32196),T=f(46942),W=f.n(T),n=f(96540),ce=f(71473),w=f(40845),de=f(62930),U=f(14578);function V({id:t="triangle",fill:o=K,headHeight:e=10}){return n.createElement("defs",null,n.createElement("marker",{id:t,viewBox:"0 0 10 10",refX:"1",refY:"5",markerUnits:"userSpaceOnUse",markerWidth:e,markerHeight:e,orient:"auto"},n.createElement("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:o})))}var R=f(67004),N=f(48543);const ue="#a00",K="#999",ge=(0,n.memo)(function(o){const{edge:e,onClick:s,onMouseEnter:a,onMouseLeave:r,hovering:c,svgIdNamespace:l}=o,{source:d,target:g,sourceNodeRadius:i,targetNodeRadius:u}=e,m=10+e.thickness*2,h=(0,N.a0)({x1:d.x,y1:d.y,x2:g.x,y2:g.y},i+(0,R.Hj)(i)/2||R.h,u+(0,R.Hj)(u)/2||R.h,m),E=e.color||K,v=e.color||ue,p=`triangle-${l}-${e.id}`,M=`triangle-colored-${l}-${e.id}`;return n.createElement(n.Fragment,null,n.createElement(V,{id:p,fill:E,headHeight:m}),n.createElement(V,{id:M,fill:v,headHeight:m}),n.createElement("g",{onClick:C=>s(C,e),style:{cursor:"pointer"},"aria-label":`Edge from: ${d.id} to: ${g.id}`},n.createElement("line",{strokeWidth:(c?1:0)+(e.highlighted?1:0)+e.thickness,stroke:e.highlighted?v:E,x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,strokeDasharray:e.strokeDasharray,markerEnd:`url(#${e.highlighted?M:p})`}),n.createElement("line",{stroke:"transparent",x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,strokeWidth:20,onMouseEnter:()=>{a(e.id)},onMouseLeave:()=>{r(e.id)}})))}),me=t=>({mainGroup:(0,y.css)`
      pointer-events: none;
      font-size: 8px;
    `,background:(0,y.css)`
      fill: ${t.components.tooltip.background};
    `,text:(0,y.css)`
      fill: ${t.components.tooltip.text};
    `}),fe=(0,n.memo)(function(o){const{edge:e}=o,{source:s,target:a,sourceNodeRadius:r,targetNodeRadius:c}=e,l=(0,N.a0)({x1:s.x,y1:s.y,x2:a.x,y2:a.y},r||R.h,c||R.h),d={x:l.x1+(l.x2-l.x1)/2,y:l.y1+(l.y2-l.y1)/2},g=(0,w.of)(me),i=[e.mainStat,e.secondaryStat].filter(v=>v),u=i.length>1?"30":"15",m=i.length>1?15:7.5;let h=i.length>1?-5:2.5;const E=[];return i.forEach((v,p)=>{E.push(n.createElement("text",{key:p,className:g.text,x:d.x,y:d.y+h,textAnchor:"middle"},v)),h+=15}),n.createElement("g",{className:g.mainGroup},n.createElement("rect",{className:g.background,x:d.x-40,y:d.y-m,width:"80",height:u,rx:"5"}),E)});var X=f(24293),he=f(52622),ye=f(55726),ve=f(34375);function pe(){return{item:(0,y.css)`
      label: LegendItem;
      flex-grow: 0;
    `,legend:(0,y.css)`
      label: Legend;
      pointer-events: all;
    `}}const Ee=function(o){const{nodes:e,onSort:s,sort:a,sortable:r}=o,c=(0,w.$j)(),l=(0,w.of)(pe),d=xe(e,c),g=(0,n.useCallback)(i=>{s({field:i.data.field,ascending:i.data.field===a?.field?!a?.ascending:!1})},[a,s]);return n.createElement(ye.t,{className:l.legend,displayMode:he.lm.List,placement:"bottom",items:d,itemRenderer:i=>n.createElement(n.Fragment,null,n.createElement(ve.M,{item:i,className:l.item,onLabelClick:r?g:void 0}),r&&(a?.field===i.data.field?n.createElement(U.I,{name:a.ascending?"arrow-up":"arrow-down"}):""))})};function xe(t,o){if(!t.length)return[];const e=[t[0].mainStat,t[0].secondaryStat].filter(a=>!!a),s=t.find(a=>a.arcSections.length>0);return s&&s.arcSections[0].config?.color?.mode===X.Y.Fixed&&e.push(...new Set(t.map(a=>a.arcSections).flat())),t[0].color&&e.push(t[0].color),e.map(a=>{const r={label:a.config.displayName||a.name,yAxis:0,data:{field:a}};return a.config.color?.mode===X.Y.Fixed&&a.config.color?.fixedColor?r.color=o.visualization.getColorByName(a.config.color?.fixedColor||""):a.config.color?.mode&&(r.gradient=a.config.color?.mode),r.color||r.gradient||(r.color=o.visualization.getColorByName("")),r})}const Me=40,Ce=t=>({mainGroup:(0,y.css)`
    cursor: pointer;
    font-size: 10px;
  `,mainCircle:(0,y.css)`
    fill: ${t.components.panel.background};
    stroke: ${t.colors.border.strong};
  `,text:(0,y.css)`
    width: 50px;
    height: 50px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
  `}),Le=(0,n.memo)(function(o){const{marker:e,onClick:s}=o,{node:a}=e,r=(0,w.of)(Ce);return a.x!==void 0&&a.y!==void 0?n.createElement("g",{"data-node-id":a.id,className:r.mainGroup,onClick:c=>{s?.(c,e)},"aria-label":`Hidden nodes marker: ${a.id}`},n.createElement("circle",{className:r.mainCircle,r:Me,cx:a.x,cy:a.y}),n.createElement("g",null,n.createElement("foreignObject",{x:a.x-25,y:a.y-25,width:"50",height:"50"},n.createElement("div",{className:r.text},n.createElement("span",null,e.count>100?">100":e.count," nodes"))))):null});var A=f(66864),G=f(55852);function be(){return{wrapper:(0,y.css)`
      label: wrapper;
      pointer-events: all;
    `}}function Se(t){const{config:o,onConfigChange:e,onPlus:s,onMinus:a,disableZoomOut:r,disableZoomIn:c}=t,[l,d]=(0,n.useState)(!1),g=!1,i=(0,w.of)(be);return n.createElement("div",{className:i.wrapper},n.createElement(A.gW,{spacing:"sm"},n.createElement(A.Gy,{spacing:"xs"},n.createElement(G.$n,{icon:"plus-circle",onClick:s,size:"md",title:"Zoom in",variant:"secondary",disabled:c}),n.createElement(G.$n,{icon:"minus-circle",onClick:a,size:"md",title:"Zoom out",variant:"secondary",disabled:r})),n.createElement(A.Gy,{spacing:"xs"},n.createElement(G.$n,{icon:"code-branch",onClick:()=>e({...o,gridLayout:!1}),size:"md",title:"Default layout",variant:"secondary",disabled:!o.gridLayout}),n.createElement(G.$n,{icon:"apps",onClick:()=>e({...o,gridLayout:!0}),size:"md",title:"Grid layout",variant:"secondary",disabled:o.gridLayout}))),g&&n.createElement(G.$n,{size:"xs",fill:"text",onClick:()=>d(u=>!u)},l?"Hide config":"Show config"),g&&l&&Object.keys(o).filter(u=>u!=="show").map(u=>n.createElement("div",{key:u},u,n.createElement("input",{style:{width:50},type:"number",value:o[u],onChange:m=>{e({...o,[u]:parseFloat(m.target.value)})}}))))}var j=f(2543),ke=f(64305),Y=f(13876),Ie=f(32264),J=f(67278);const Ne=()=>new J.c(new URL(f.p+f.u(8896),f.b)),$e=()=>new J.c(new URL(f.p+f.u(3341),f.b));function He(t,o,e,s,a){const[r,c]=(0,n.useMemo)(()=>{if(!(t.length&&o.length))return[{},{}];const l=o.reduce((g,i)=>(g[i.source.id]=[...g[i.source.id]??[],i],g[i.target.id]=[...g[i.target.id]??[],i],g),{}),d=t.reduce((g,i)=>(g[i.id]=i,g),{});return[l,d]},[o,t]);return(0,n.useMemo)(()=>t.length<=e?{nodes:t,edges:o}:s.gridLayout?Re(t,e,a):we(t,o,c,r,e,a),[o,r,e,t,c,a,s.gridLayout])}function we(t,o,e,s,a,r){let c;r?c=[e[r]]:(c=t.filter(m=>m.incoming===0),c.length||(c=[t[0]]));const{visibleNodes:l,markers:d}=Pe(a,c,e,s),g=ze(d,l,e,s),i=(0,j.fromPairs)(g.map(m=>[m.node.id,m]));for(const m of g)m.count===1&&(delete i[m.node.id],l[m.node.id]=m.node);const u=o.filter(m=>(l[m.source.id]||i[m.source.id])&&(l[m.target.id]||i[m.target.id]));return{nodes:Object.values(l),edges:u,markers:Object.values(i)}}function Re(t,o,e){let s=0,a=o,r=[];if(e){const c=t.findIndex(g=>g.id===e),l=Math.floor(o/2);let d=l;s=c-l,s<0&&(d+=Math.abs(s),s=0),a=c+d+1,a>t.length&&(s>0&&(s=Math.max(0,s-(a-t.length))),a=t.length),s>1&&r.push({node:t[s-1],count:s}),t.length-a>1&&r.push({node:t[a],count:t.length-a})}else t.length-o>1&&(r=[{node:t[o],count:t.length-o}]);return{nodes:t.slice(s,a),edges:[],markers:r}}function Pe(t,o,e,s){const a={};let r=[...o];for(;Object.keys(a).length<t&&r.length>0;){let l=r.shift();if(a[l.id])continue;a[l.id]=l;const g=(s[l.id]||[]).map(i=>{const u=i.source.id===l.id?i.target.id:i.source.id;return e[u]});r=r.concat(g)}const c=(0,j.uniq)(r.filter(l=>!a[l.id]));return{visibleNodes:a,markers:c}}function ze(t,o,e,s){return t.map(a=>{const r={};let c=0,l=[a];for(;l.length>0&&c<=101;){let d=l.shift();if(o[d.id]||r[d.id])continue;r[d.id]||c++,r[d.id]=d;const i=(s[d.id]||[]).map(u=>{const m=u.source.id===d.id?u.target.id:u.source.id;return e[m]});l=l.concat(i)}return{node:a,count:c}})}const Z={linkDistance:150,linkStrength:.5,forceX:2e3,forceXStrength:.02,forceCollide:100,tick:300,gridLayout:!1};function Fe(t,o,e=Z,s,a,r){const[c,l]=(0,n.useState)([]),[d,g]=(0,n.useState)([]),[i,u]=(0,n.useState)(!1),m=(0,Y.default)(),h=(0,n.useRef)();(0,ke.A)(()=>{h.current&&h.current()}),(0,n.useEffect)(()=>{if(t.length===0){l([]),g([]),u(!1);return}const k=Ie.$.featureToggles.nodeGraphDotLayout&&t.length<=500?"layered":"default";u(!0);const L=Ge(t,o,k,({nodes:x,edges:b})=>{m()&&(l(x),g(b),u(!1))});return h.current=L,L},[t,o,m]);const[E,v]=(0,n.useMemo)(()=>{if(t.length===0)return[[],[]];const k=t.map(x=>({...x})),L=o.map(x=>({...x}));return De(k,a,e.sort),[k,L]},[e.sort,t,o,a]),{nodes:p,edges:M,markers:C}=He(e.gridLayout?E:c,e.gridLayout?v:d,s,e,r),$=(0,n.useMemo)(()=>(0,N._d)([...p,...(C||[]).map(k=>k.node)]),[p,C]);return{nodes:p,edges:M,markers:C,bounds:$,hiddenNodesCount:t.length-p.length,loading:i}}function Ge(t,o,e,s){const a=e==="default"?Ne():$e();return a.onmessage=r=>{const c=(0,j.fromPairs)(t.map(l=>[l.id,l]));r.data.nodes=r.data.nodes.map(l=>({...c[l.id],...l})),s(r.data)},a.postMessage({nodes:t.map(r=>({id:r.id,incoming:r.incoming})),edges:o,config:Z}),()=>{a.terminate()}}function De(t,o,e){const c=Math.min(Math.floor((o-120)/140),t.length),l=Math.floor((c-1)*120/2);e&&t.sort((d,g)=>{const i=e.field.values[d.dataFrameRowIndex],u=e.field.values[g.dataFrameRowIndex];return e.ascending?i-u:u-i});for(const[d,g]of t.entries()){const i=Math.floor(d/c),u=d%c;g.x=u*120-l,g.y=-60+i*140}}var Oe=f(94382),Te=f(28122),We=f(59093),Ae=f(64539);function je(t,o,e,s,a,r){const[c,l]=(0,n.useState)(void 0),d=(0,n.useCallback)((i,u)=>{const[m,h]=s.gridLayout?["Show in Graph layout",!1]:["Show in Grid layout",!0],E=[{label:m,onClick:M=>{r(M.id),a({...s,gridLayout:h}),l(void 0)}}],v=o?t(o,u.dataFrameRowIndex):[],p=q(v,u,E);l(Q(n.createElement(Ze,{node:u,nodes:o}),i,l,p))},[s,o,t,l,a,r]);return{onEdgeOpen:(0,n.useCallback)((i,u)=>{if(!e)return;const m=t(e,u.dataFrameRowIndex),h=q(m,u);l(Q(n.createElement(Be,{edge:u,edges:e}),i,l,h))},[e,t,l]),onNodeOpen:d,MenuComponent:c}}function Q(t,o,e,s){return n.createElement(Te.t,{renderHeader:()=>t,renderMenuItems:s,onClose:()=>e(void 0),x:o.pageX,y:o.pageY})}function q(t,o,e){if(!(t.length||e?.length))return;const s=Ye(t);return()=>{let a=s?.map((r,c)=>n.createElement(We.r,{key:`${r.label}${c}`,label:r.label},(r.items||[]).map(_(o))));return e&&(a=[...e.map(_(o)),...a]),a}}function _(t){return function(e){return n.createElement(Ae.D,{key:e.label,url:e.url,label:e.label,ariaLabel:e.ariaLabel,onClick:e.onClick?s=>{s?.ctrlKey||s?.metaKey||s?.shiftKey||(s?.preventDefault(),s?.stopPropagation(),e.onClick?.(t))}:void 0,target:"_self"})}}function Ye(t){const o="Open in Explore",e=t.reduce((s,a)=>{let r,c;return a.title.indexOf("/")!==-1?(r=a.title.split("/")[0],c=a.title.split("/")[1],s[r]=s[r]||[],s[r].push({l:a,newTitle:c})):(s[o]=s[o]||[],s[o].push({l:a})),s},{});return Object.keys(e).map(s=>({label:s,ariaLabel:s,items:e[s].map(a=>({label:a.newTitle||a.l.title,ariaLabel:a.newTitle||a.l.title,url:a.l.href,onClick:a.l.onClick}))}))}function ee({field:t,index:o}){return n.createElement(D,{label:t.config?.displayName||t.name,value:(0,N.Xq)(t.config,t.values[o]||"")})}function D({label:t,value:o}){const e=(0,w.of)(Ue);return n.createElement("tr",null,n.createElement("td",{className:e.label},t,": "),n.createElement("td",{className:e.value},o))}function Ze({node:t,nodes:o}){const e=[];if(o){const s=(0,N.AG)(o);for(const a of[s.title,s.subTitle,s.mainStat,s.secondaryStat,...s.details])a&&a.values[t.dataFrameRowIndex]&&e.push(n.createElement(ee,{key:a.name,field:a,index:t.dataFrameRowIndex}))}else t.title&&e.push(n.createElement(D,{key:"title",label:"Title",value:t.title})),t.subTitle&&e.push(n.createElement(D,{key:"subtitle",label:"Subtitle",value:t.subTitle}));return n.createElement("table",{style:{width:"100%"}},n.createElement("tbody",null,e))}function Be(t){const o=t.edge.dataFrameRowIndex,e=(0,N.tF)(t.edges),s=e.source?.values[o]||"",a=e.target?.values[o]||"",r=[];s&&a&&r.push(n.createElement(D,{key:"header-row",label:"Source \u2192 Target",value:`${s} \u2192 ${a}`}));for(const c of[e.mainStat,e.secondaryStat,...e.details])c&&c.values[o]&&r.push(n.createElement(ee,{key:`field-row-${o}`,field:c,index:o}));return n.createElement("table",{style:{width:"100%"}},n.createElement("tbody",null,r))}const Ue=t=>({label:(0,y.css)`
      label: Label;
      line-height: 1.25;
      color: ${t.colors.text.disabled};
      font-size: ${t.typography.size.sm};
      font-weight: ${t.typography.fontWeightMedium};
      padding-right: ${t.spacing(1)};
    `,value:(0,y.css)`
      label: Value;
      font-size: ${t.typography.size.sm};
      font-weight: ${t.typography.fontWeightMedium};
      color: ${t.colors.text.primary};
    `});var te=f(80292);function Ve(t,o,e){const s=(0,te.A)(t.gridLayout);let a;if(s===!0&&!t.gridLayout&&e){const r=o.find(c=>c.id===e);r&&(a={x:-r.x,y:-r.y})}return a}function Ke(t){const[o,e]=(0,n.useState)(),s=(0,Y.default)();return(0,n.useEffect)(()=>{t&&(e(t),setTimeout(()=>{s()&&e(void 0)},500))},[t,s]),o}function Xe({scale:t=1,bounds:o,focus:e}={}){const s=(0,Y.default)(),a=(0,n.useRef)(!1),r=(0,n.useRef)(0),c=(0,n.useRef)(null),l={x:0,y:0},d=(0,n.useMemo)(()=>({right:o?-o.left:1/0,left:o?-o.right:-1/0,bottom:o?-o.top:-1/0,top:o?-o.bottom:1/0}),[o]),g=(0,n.useRef)(l),i=(0,n.useRef)(l),u=(0,n.useRef)(l),[m,h]=(0,n.useState)({isPanning:!1,position:l});(0,n.useEffect)(()=>{const p=b=>{!a.current&&s()&&(a.current=!0,g.current=ne(b),i.current={...u.current},h(H=>({...H,isPanning:!0})),$())},M=()=>{a.current&&s()&&(a.current=!1,h(b=>({...b,isPanning:!1})),k())},C=b=>{p(b),L(b)},$=()=>{document.addEventListener("mousemove",L),document.addEventListener("mouseup",M),document.addEventListener("touchmove",L),document.addEventListener("touchend",M)},k=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",M),document.removeEventListener("touchmove",L),document.removeEventListener("touchend",M)},L=b=>{cancelAnimationFrame(r.current);const H=ne(b);r.current=requestAnimationFrame(()=>{if(s()&&c.current){let z=H.x-g.current.x,B=H.y-g.current.y;u.current={x:P(i.current.x+z/t,d.left,d.right),y:P(i.current.y+B/t,d.top,d.bottom)},h(F=>({...F,position:{...u.current}}))}})},x=c.current;return x&&(x.addEventListener("mousedown",C),x.addEventListener("touchstart",C)),()=>{x&&(x.removeEventListener("mousedown",C),x.removeEventListener("touchstart",C))}},[t,d,s]);const E=(0,te.A)(e);(0,n.useEffect)(()=>{if(e&&E?.x!==e.x&&E?.y!==e.y){const p={x:P(e.x,d.left,d.right),y:P(e.y,d.top,d.bottom)};h({position:p,isPanning:!1}),u.current=p,i.current=p}},[e,E,d,u,i]);let v=m.position;return e&&E?.x!==e.x&&E?.y!==e.y&&(v=e),{state:{...m,position:{x:P(v.x,d.left,d.right),y:P(v.y,d.top,d.bottom)}},ref:c}}function P(t,o,e){return Math.min(Math.max(t,o??-1/0),e??1/0)}function ne(t){return"changedTouches"in t&&t instanceof TouchEvent?{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}:t instanceof MouseEvent?{x:t.clientX,y:t.clientY}:{x:0,y:0}}const Je={stepDown:t=>t/1.5,stepUp:t=>t*1.5,min:.13,max:2.25};function Qe({stepUp:t,stepDown:o,min:e,max:s}=Je){const a=(0,n.useRef)(null),[r,c]=(0,n.useState)(1),l=(0,n.useCallback)(()=>{r<(s??1/0)&&c(t(r))},[r,t,s]),d=(0,n.useCallback)(()=>{r>(e??-1/0)&&c(o(r))},[r,o,e]),g=(0,n.useCallback)(function(i){if(i.ctrlKey||i.metaKey){if(i.preventDefault(),c(Math.min(Math.max(e??-1/0,r+Math.min(i.deltaY,2)*-.01),s??1/0)),i.deltaY<0){const u=r+Math.max(i.deltaY,-4)*-.015;c(Math.max(e??-1/0,u))}else if(i.deltaY>0){const u=r+Math.min(i.deltaY,4)*-.015;c(Math.min(s??1/0,u))}}},[e,s,r]);return(0,n.useEffect)(()=>{if(!a.current)return;const i=a.current;return i.addEventListener("wheel",g,{passive:!1}),()=>{i&&i.removeEventListener("wheel",g)}},[g]),{onStepUp:l,onStepDown:d,scale:Math.max(Math.min(r,s??1/0),e??-1/0),isMax:r>=(s??1/0),isMin:r<=(e??-1/0),ref:a}}const qe=t=>({wrapper:(0,y.css)`
    label: wrapper;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
  `,svg:(0,y.css)`
    label: svg;
    height: 100%;
    width: 100%;
    overflow: visible;
    font-size: 10px;
    cursor: move;
  `,svgPanning:(0,y.css)`
    label: svgPanning;
    user-select: none;
  `,noDataMsg:(0,y.css)`
    height: 100%;
    width: 100%;
    display: grid;
    place-items: center;
    font-size: ${t.typography.h4.fontSize};
    color: ${t.colors.text.secondary};
  `,mainGroup:(0,y.css)`
    label: mainGroup;
    will-change: transform;
  `,viewControls:(0,y.css)`
    label: viewControls;
    position: absolute;
    left: 2px;
    bottom: 3px;
    right: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    pointer-events: none;
  `,legend:(0,y.css)`
    label: legend;
    background: ${t.colors.background.secondary};
    box-shadow: ${t.shadows.z1};
    padding-bottom: 5px;
    margin-right: 10px;
  `,viewControlsWrapper:(0,y.css)`
    margin-left: auto;
  `,alert:(0,y.css)`
    label: alert;
    padding: 5px 8px;
    font-size: 10px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
    border-radius: ${t.shape.radius.default};
    align-items: center;
    position: absolute;
    top: 0;
    right: 0;
    background: ${t.colors.warning.main};
    color: ${t.colors.warning.contrastText};
  `,loadingWrapper:(0,y.css)`
    label: loadingWrapper;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  `}),_e=200;function et({getLinks:t,dataFrames:o,nodeLimit:e,panelId:s}){const a=e||_e,{edges:r,nodes:c}=(0,Oe.d)(o),[l,{width:d,height:g}]=(0,ce.A)(),[i,u]=(0,n.useState)(Z),m=c[0],h=r[0],E=s||"nodegraphpanel",v=(0,n.useMemo)(()=>(0,N.BJ)(m,h),[h,m]),{nodeHover:p,setNodeHover:M,clearNodeHover:C,edgeHover:$,setEdgeHover:k,clearEdgeHover:L}=rt(),[x,b]=(0,n.useState)([]);(0,n.useEffect)(()=>{let S=[];p?S=(0,N.Tl)(v.nodes,v.edges,p):$&&(S=(0,N.K0)(v.nodes,v.edges,$)),b(S)},[p,$,v]);const[H,z]=(0,n.useState)(),B=(0,n.useCallback)((S,Ct)=>z(Ct.node.id),[z]),{nodes:F,edges:oe,markers:it,bounds:lt,hiddenNodesCount:ae,loading:ct}=Fe(v.nodes,v.edges,i,a,d,H),dt=Ve(i,F,H),{panRef:ut,zoomRef:se,onStepUp:gt,onStepDown:mt,isPanning:ft,position:re,scale:ie,isMaxZoom:ht,isMinZoom:yt}=st(lt,dt),{onEdgeOpen:vt,onNodeOpen:pt,MenuComponent:Et}=je(t,m,h,i,u,z),I=(0,w.of)(qe),xt=(0,n.useCallback)(S=>{l(S),se.current=S},[l,se]),Mt=Ke(H);return n.createElement("div",{ref:xt,className:I.wrapper},ct?n.createElement("div",{className:I.loadingWrapper},"Computing layout\xA0",n.createElement(de.y,null)):null,o.length&&v.nodes.length?n.createElement("svg",{ref:ut,viewBox:`${-(d/2)} ${-(g/2)} ${d} ${g}`,className:W()(I.svg,ft&&I.svgPanning)},n.createElement("g",{className:I.mainGroup,style:{transform:`scale(${ie}) translate(${Math.floor(re.x)}px, ${Math.floor(re.y)}px)`}},!i.gridLayout&&n.createElement(ot,{edges:oe,nodeHoveringId:p,edgeHoveringId:$,onClick:vt,onMouseEnter:k,onMouseLeave:L,svgIdNamespace:E}),n.createElement(tt,{nodes:F,onMouseEnter:M,onMouseLeave:C,onClick:pt,hoveringIds:x||[Mt]}),n.createElement(nt,{markers:it||[],onClick:B}),!i.gridLayout&&n.createElement(at,{edges:oe,nodeHoveringId:p,edgeHoveringId:$}))):n.createElement("div",{className:I.noDataMsg},"No data"),n.createElement("div",{className:I.viewControls},F.length?n.createElement("div",{className:I.legend},n.createElement(Ee,{sortable:i.gridLayout,nodes:F,sort:i.sort,onSort:S=>{u({...i,sort:S})}})):null,n.createElement("div",{className:I.viewControlsWrapper},n.createElement(Se,{config:i,onConfigChange:S=>{S.gridLayout!==i.gridLayout&&z(void 0),u(S)},onMinus:mt,onPlus:gt,scale:ie,disableZoomIn:ht,disableZoomOut:yt}))),ae>0&&n.createElement("div",{className:I.alert,"aria-label":"Nodes hidden warning"},n.createElement(U.I,{size:"sm",name:"info-circle"})," ",ae," nodes are hidden for performance reasons."),Et)}const tt=(0,n.memo)(function(o){return n.createElement(n.Fragment,null,o.nodes.map(e=>n.createElement(R.bP,{key:e.id,node:e,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,onClick:o.onClick,hovering:!o.hoveringIds||o.hoveringIds.length===0?"default":o.hoveringIds?.includes(e.id)?"active":"inactive"})))}),nt=(0,n.memo)(function(o){return n.createElement(n.Fragment,null,o.markers.map(e=>n.createElement(Le,{key:"marker-"+e.node.id,marker:e,onClick:o.onClick})))}),ot=(0,n.memo)(function(o){return n.createElement(n.Fragment,null,o.edges.map(e=>n.createElement(ge,{key:e.id,edge:e,hovering:e.source.id===o.nodeHoveringId||e.target.id===o.nodeHoveringId||o.edgeHoveringId===e.id,onClick:o.onClick,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,svgIdNamespace:o.svgIdNamespace})))}),at=(0,n.memo)(function(o){return n.createElement(n.Fragment,null,o.edges.map((e,s)=>{const a=e.source.id===o.nodeHoveringId||e.target.id===o.nodeHoveringId||o.edgeHoveringId===e.id,r=e.mainStat||e.secondaryStat;return a&&r&&n.createElement(fe,{key:e.id,edge:e})}))});function st(t,o){const{scale:e,onStepDown:s,onStepUp:a,ref:r,isMax:c,isMin:l}=Qe(),{state:d,ref:g}=Xe({scale:e,bounds:t,focus:o}),{position:i,isPanning:u}=d;return{zoomRef:r,panRef:g,position:i,isPanning:u,scale:e,onStepDown:s,onStepUp:a,isMaxZoom:c,isMinZoom:l}}function rt(){const[t,o]=(0,n.useState)(void 0),e=(0,n.useCallback)(()=>o(void 0),[o]),[s,a]=(0,n.useState)(void 0),r=(0,n.useCallback)(()=>a(void 0),[a]);return{nodeHover:t,setNodeHover:o,clearNodeHover:e,edgeHover:s,setEdgeHover:a,clearEdgeHover:r}}},94382:(le,O,f)=>{f.d(O,{d:()=>W});var y=f(96540),T=f(48543);function W(n){return(0,y.useMemo)(()=>(0,T.CP)(n),[n])}}}]);

//# sourceMappingURL=5511.b4d4a057a431d7b5f660.js.map