"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7317],{68403:(D,p,s)=>{s.r(p),s.d(p,{plugin:()=>z});var F=s(65158),y=s(41811),a=s(96540),v=s(96192),P=s(95511),E=s(48543);const N=({width:r,height:t,data:e,options:o})=>{const d=(0,v.JQ)(e.timeRange),l=(0,a.useId)();if(!e||!e.series.length)return a.createElement("div",{className:"panel-empty"},a.createElement("p",null,"No data found in response"));const c=(0,y.A)(E.BR);return a.createElement("div",{style:{width:r,height:t}},a.createElement(P.F,{dataFrames:c(e.series,o),getLinks:d,panelId:l}))};var U=s(32196),S=s(40845),C=s(83598),h=s(55852),G=s(76218);const A=({value:r,onChange:t,context:e})=>{const o=(0,S.of)(k),d=()=>{const i={field:"",color:""};t(r?[...r,i]:[i])},l=i=>{const n=r?.slice();n.splice(i,1),t(n)},c=(i,n,m)=>{let u=r?.slice()??[];u[i][n]=m,t(u)};return a.createElement(a.Fragment,null,r?.map((i,n)=>a.createElement("div",{className:o.section,key:n},a.createElement(G.O,{context:e,value:i.field??"",onChange:m=>{c(n,"field",m)},item:{settings:{filter:m=>m.name.includes("arc__")},id:`arc-field-${n}`,name:`arc-field-${n}`}}),a.createElement(C.sk,{color:i.color||"#808080",onChange:m=>{c(n,"color",m)}}),a.createElement(h.$n,{size:"sm",icon:"minus",variant:"secondary",onClick:()=>l(n),title:"Remove arc"}))),a.createElement(h.$n,{size:"sm",icon:"plus",onClick:d,variant:"secondary"},"Add arc"))},k=()=>({section:(0,U.css)`
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0 8px;
      margin-bottom: 8px;
    `});var g=s(11261),O=s(47070),f=s(38824);class x{getListWithDefaults(t){return t.getListAppender({name:f.m.NodeGraph,pluginId:"nodeGraph"})}hasCorrectFields(t){let e=!1,o=!1;const d=[["id",g.PU.string],["title",g.PU.string],["mainstat",g.PU.number]],l=[["id",g.PU.string],["source",g.PU.string],["target",g.PU.string]];for(const c of t)this.checkFields(d,c)&&(e=!0),this.checkFields(l,c)&&(o=!0);return e&&o}checkFields(t,e){let o=!0;for(const d of t){const[l,c]=d,i=e.fields.find(n=>n.name===l);if(!i||c!==i.type){o=!1;break}}return o}getSuggestionsForData(t){if(!t.data)return;const e=this.hasCorrectFields(t.data.series),o=t.data.series.filter(d=>d.meta&&d.meta.preferredVisualisationType==="nodeGraph");(e||o.length===2)&&this.getListWithDefaults(t).append({name:f.m.NodeGraph,score:O.nQ.Best})}}const z=new F.m(N).setPanelOptions((r,t)=>{r.addNestedOptions({category:["Nodes"],path:"nodes",build:e=>{e.addUnitPicker({name:"Main stat unit",path:"mainStatUnit"}),e.addUnitPicker({name:"Secondary stat unit",path:"secondaryStatUnit"}),e.addCustomEditor({name:"Arc sections",path:"arcs",id:"arcs",editor:A})}}),r.addNestedOptions({category:["Edges"],path:"edges",build:e=>{e.addUnitPicker({name:"Main stat unit",path:"mainStatUnit"}),e.addUnitPicker({name:"Secondary stat unit",path:"secondaryStatUnit"})}})}).setSuggestionsSupplier(new x)}}]);

//# sourceMappingURL=nodeGraphPanel.a649d1a2258953f59cff.js.map