"use strict";(self["webpackChunkaw_webui"]=self["webpackChunkaw_webui"]||[]).push([[9617],{99617:(t,n,r)=>{r.r(n),r.d(n,{default:()=>f});var e=function(){var t=this,n=t._self._c;return n("div",{attrs:{id:"forcegraph"}})},o=[],i=r(85785),a=(r(41539),r(21249),r(69600),r(64958));const u={name:"ForceGraph",props:{data:{type:Object,required:!0}},data:function(){return{cancelPromise:null}},watch:{data:function(){this.drawGraph(this.data)}},mounted:function(){this.drawGraph(this.data)},methods:{drawGraph:function(t){var n=this,r=t.nodes,e=t.links;console.log("rendering..."),this.cancelPromise&&this.cancelPromise();var o=new Promise((function(t){n.cancelPromise=t})),i=c({nodes:r,links:e},{invalidation:o}),u=a.select("#forcegraph");u.selectAll("*").remove(),u.node().appendChild(i),console.log("drawn!")}}};function c(t){var n=t.nodes,r=t.links,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=e.nodeId,u=void 0===o?function(t){return t.id}:o,c=e.nodeGroup,l=void 0===c?function(t){return t.group}:c,d=e.nodeGroups,s=void 0===d?void 0:d,f=e.nodeTitle,v=void 0===f?null:f,p=e.nodeFill,h=void 0===p?"currentColor":p,k=e.nodeStroke,g=void 0===k?"#fff":k,m=e.nodeStrokeWidth,y=void 0===m?1.5:m,x=e.nodeStrokeOpacity,w=void 0===x?1:x,b=e.nodeRadius,j=void 0===b?4:b,S=e.nodeStrength,C=void 0===S?void 0:S,G=e.linkSource,O=void 0===G?function(t){var n=t.source;return n}:G,P=e.linkTarget,T=void 0===P?function(t){var n=t.target;return n}:P,q=e.linkStroke,M=void 0===q?"#999":q,_=e.linkStrokeOpacity,A=void 0===_?.6:_,B=e.linkStrokeWidth,F=void 0===B?function(t){return 1.5*Math.sqrt(t.value)}:B,L=e.linkStrokeLinecap,W=void 0===L?"round":L,Z=e.linkStrength,I=void 0===Z?function(t){return t.value<10?.01:Math.sqrt(1/(2+t.value))}:Z,R=e.colors,z=void 0===R?a.schemeTableau10:R,D=e.width,E=void 0===D?640:D,H=e.height,J=void 0===H?400:H,K=e.invalidation,N=void 0===K?null:K,Q=a.map(n,u).map(ct),U=a.map(r,O).map(ct),V=a.map(r,T).map(ct);void 0===v&&(v=function(t,n){return Q[n]});var X=null==v?null:a.map(n,v),Y=null==l?null:a.map(n,l).map(ct),$="function"!==typeof F?null:a.map(r,F),tt="function"!==typeof M?null:a.map(r,M);n=a.map(n,(function(t,n){return{id:Q[n],color:t.color,value:t.value}})),r=a.map(r,(function(t,n){var r=t.value;return{source:U[n],target:V[n],value:r}})),n=n.map((function(t){return t.radius=j+5*Math.sqrt(t.value/60/60),t})),Y&&void 0===s&&(s=a.sort(Y));var nt=null==l?null:a.scaleOrdinal(s,z),rt=a.forceManyBody(),et=a.forceLink(r).id((function(t){var n=t.index;return Q[n]}));void 0!==C&&rt.strength(C),void 0!==I&&et.strength(I);var ot=a.forceSimulation(n).force("link",et).force("charge",rt).force("center",a.forceCenter()).force("collision",a.forceCollide((function(t){return t.radius}))).on("tick",lt),it=a.create("svg").attr("width",E).attr("height",J).attr("viewBox",[-E/2,-J/2,E,J]).attr("style","max-width: 100%; height: auto; height: intrinsic;"),at=it.append("g").attr("stroke","function"!==typeof M?M:null).attr("stroke-opacity",A).attr("stroke-width","function"!==typeof F?F:null).attr("stroke-linecap",W).selectAll("line").data(r).join("line"),ut=it.append("g").attr("fill",h).attr("stroke",g).attr("stroke-opacity",w).attr("stroke-width",y).selectAll("circle").data(n).join("circle").attr("r",(function(t){return t.radius})).call(dt(ot));function ct(t){return null!==t&&"object"===(0,i.Z)(t)?t.valueOf():t}function lt(){at.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),ut.attr("cx",(function(t){return t.x})).attr("cy",(function(t){return t.y}))}function dt(t){function n(n){n.active||t.alphaTarget(.3).restart(),n.subject.fx=n.subject.x,n.subject.fy=n.subject.y}function r(t){t.subject.fx=t.x,t.subject.fy=t.y}function e(n){n.active||t.alphaTarget(0),n.subject.fx=null,n.subject.fy=null}return a.drag().on("start",n).on("drag",r).on("end",e)}return $&&at.attr("stroke-width",(function(t){var n=t.index;return $[n]})),tt&&at.attr("stroke",(function(t){var n=t.index;return tt[n]})),ut.attr("fill",(function(t){var r=t.index;return n[r].color})),X&&ut.append("title").text((function(t){var n=t.index;return X[n]})),null!=N&&N.then((function(){return ot.stop()})),Object.assign(it.node(),{scales:{color:nt}})}const l=u;var d=r(1001),s=(0,d.Z)(l,e,o,!1,null,null,null);const f=s.exports}}]);
//# sourceMappingURL=9617.2af7bd72.js.map