/* Highcharts JS v9.1.1 (2021-06-03) Force directed graph module (c) 2010-2021 Torstein Honsi License: www.highcharts.com/license */ 'use strict';(function(f){"object"===typeof module&&module.exports?(f["default"]=f,module.exports=f):"function"===typeof define&&define.amd?define("highcharts/modules/networkgraph",["highcharts"],function(h){f(h);f.Highcharts=h;return f}):f("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(f){function h(f,b,c,d){f.hasOwnProperty(b)||(f[b]=d.apply(null,c))}f=f?f._modules:{};h(f,"Mixins/Nodes.js",[f["Core/Globals.js"],f["Core/Series/Point.js"],f["Core/Series/Series.js"],f["Core/Utilities.js"]], function(f,b,c,d){var e=d.defined,g=d.extend,q=d.find,k=d.pick;return f.NodesMixin={createNode:function(e){function b(a,e){return q(a,function(a){return a.id===e})}var a=b(this.nodes,e),d=this.pointClass;if(!a){var c=this.options.nodes&&b(this.options.nodes,e);a=(new d).init(this,g({className:"highcharts-node",isNode:!0,id:e,y:1},c));a.linksTo=[];a.linksFrom=[];a.formatPrefix="node";a.name=a.name||a.options.id||"";a.mass=k(a.options.mass,a.options.marker&&a.options.marker.radius,this.options.marker&& this.options.marker.radius,4);a.getSum=function(){var e=0,b=0;a.linksTo.forEach(function(a){e+=a.weight});a.linksFrom.forEach(function(a){b+=a.weight});return Math.max(e,b)};a.offset=function(e,b){for(var d=0,c=0;cb?1:0)},barycenter:function(){var b=this.options.gravitationalConstant,c=this.barycenter.xFactor,d=this.barycenter.yFactor;c=(c-(this.box.left+ this.box.width)/2)*b;d=(d-(this.box.top+this.box.height)/2)*b;this.nodes.forEach(function(e){e.fixedPosition||(e.plotX-=c/e.mass/e.degree,e.plotY-=d/e.mass/e.degree)})},repulsive:function(b,c,d){c=c*this.diffTemperature/b.mass/b.degree;b.fixedPosition||(b.plotX+=d.x*c,b.plotY+=d.y*c)},attractive:function(b,c,d){var e=b.getMass(),g=-d.x*c*this.diffTemperature;c=-d.y*c*this.diffTemperature;b.fromNode.fixedPosition||(b.fromNode.plotX-=g*e.fromNode/b.fromNode.degree,b.fromNode.plotY-=c*e.fromNode/b.fromNode.degree); b.toNode.fixedPosition||(b.toNode.plotX+=g*e.toNode/b.toNode.degree,b.toNode.plotY+=c*e.toNode/b.toNode.degree)},integrate:function(b,c){var d=-b.options.friction,e=b.options.maxSpeed,g=(c.plotX+c.dispX-c.prevX)*d;d*=c.plotY+c.dispY-c.prevY;var f=Math.abs,k=f(g)/(g||1);f=f(d)/(d||1);g=k*Math.min(e,Math.abs(g));d=f*Math.min(e,Math.abs(d));c.prevX=c.plotX+c.dispX;c.prevY=c.plotY+c.dispY;c.plotX+=g;c.plotY+=d;c.temperature=b.vectorLength({x:g,y:d})},getK:function(b){return Math.pow(b.box.width*b.box.height/ b.nodes.length,.5)}},euler:{attractiveForceFunction:function(b,c){return b*b/c},repulsiveForceFunction:function(b,c){return c*c/b},barycenter:function(){var b=this.options.gravitationalConstant,c=this.barycenter.xFactor,d=this.barycenter.yFactor;this.nodes.forEach(function(e){if(!e.fixedPosition){var g=e.getDegree();g*=1+g/2;e.dispX+=(c-e.plotX)*b*g/e.degree;e.dispY+=(d-e.plotY)*b*g/e.degree}})},repulsive:function(b,c,d,e){b.dispX+=d.x/e*c/b.degree;b.dispY+=d.y/e*c/b.degree},attractive:function(b, c,d,e){var g=b.getMass(),f=d.x/e*c;c*=d.y/e;b.fromNode.fixedPosition||(b.fromNode.dispX-=f*g.fromNode/b.fromNode.degree,b.fromNode.dispY-=c*g.fromNode/b.fromNode.degree);b.toNode.fixedPosition||(b.toNode.dispX+=f*g.toNode/b.toNode.degree,b.toNode.dispY+=c*g.toNode/b.toNode.degree)},integrate:function(b,c){c.dispX+=c.dispX*b.options.friction;c.dispY+=c.dispY*b.options.friction;var d=c.temperature=b.vectorLength({x:c.dispX,y:c.dispY});0!==d&&(c.plotX+=c.dispX/d*Math.min(Math.abs(c.dispX),b.temperature), c.plotY+=c.dispY/d*Math.min(Math.abs(c.dispY),b.temperature))},getK:function(b){return Math.pow(b.box.width*b.box.height/b.nodes.length,.3)}}}});h(f,"Series/Networkgraph/QuadTree.js",[f["Core/Globals.js"],f["Core/Utilities.js"]],function(f,b){b=b.extend;var c=f.QuadTreeNode=function(d){this.box=d;this.boxSize=Math.min(d.width,d.height);this.nodes=[];this.body=this.isInternal=!1;this.isEmpty=!0};b(c.prototype,{insert:function(d,e){this.isInternal?this.nodes[this.getBoxPosition(d)].insert(d,e-1):(this.isEmpty= !1,this.body?e?(this.isInternal=!0,this.divideBox(),!0!==this.body&&(this.nodes[this.getBoxPosition(this.body)].insert(this.body,e-1),this.body=!0),this.nodes[this.getBoxPosition(d)].insert(d,e-1)):(e=new c({top:d.plotX,left:d.plotY,width:.1,height:.1}),e.body=d,e.isInternal=!1,this.nodes.push(e)):(this.isInternal=!1,this.body=d))},updateMassAndCenter:function(){var d=0,e=0,b=0;this.isInternal?(this.nodes.forEach(function(c){c.isEmpty||(d+=c.mass,e+=c.plotX*c.mass,b+=c.plotY*c.mass)}),e/=d,b/=d): this.body&&(d=this.body.mass,e=this.body.plotX,b=this.body.plotY);this.mass=d;this.plotX=e;this.plotY=b},divideBox:function(){var d=this.box.width/2,e=this.box.height/2;this.nodes[0]=new c({left:this.box.left,top:this.box.top,width:d,height:e});this.nodes[1]=new c({left:this.box.left+d,top:this.box.top,width:d,height:e});this.nodes[2]=new c({left:this.box.left+d,top:this.box.top+e,width:d,height:e});this.nodes[3]=new c({left:this.box.left,top:this.box.top+e,width:d,height:e})},getBoxPosition:function(d){var e= d.plotYMath.abs(this.systemTemperature- this.prevSystemTemperature)||0>=this.temperature},getSystemTemperature:function(){return this.nodes.reduce(function(a,b){return a+b.temperature},0)},vectorLength:function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},getDistR:function(a,b){a=this.getDistXY(a,b);return this.vectorLength(a)},getDistXY:function(a,b){var e=a.plotX-b.plotX;a=a.plotY-b.plotY;return{x:e,y:a,absX:Math.abs(e),absY:Math.abs(a)}}});b(f,"predraw",function(){this.graphLayoutsLookup&&this.graphLayoutsLookup.forEach(function(a){a.stop()})}); b(f,"render",function(){function a(a){a.maxIterations--&&isFinite(a.temperature)&&!a.isStable()&&!a.enableSimulation&&(a.beforeStep&&a.beforeStep(),a.step(),d=!1,b=!0)}var b=!1;if(this.graphLayoutsLookup){e(!1,this);for(this.graphLayoutsLookup.forEach(function(a){a.start()});!d;){var d=!0;this.graphLayoutsLookup.forEach(a)}b&&this.series.forEach(function(a){a&&a.layout&&a.render()})}});b(f,"beforePrint",function(){this.graphLayoutsLookup&&(this.graphLayoutsLookup.forEach(function(a){a.updateSimulation(!1)}), this.redraw())});b(f,"afterPrint",function(){this.graphLayoutsLookup&&this.graphLayoutsLookup.forEach(function(a){a.updateSimulation()});this.redraw()})});h(f,"Series/Networkgraph/DraggableNodes.js",[f["Core/Chart/Chart.js"],f["Core/Globals.js"],f["Core/Utilities.js"]],function(f,b,c){var d=c.addEvent;b.dragNodesMixin={onMouseDown:function(b,d){d=this.chart.pointer.normalize(d);b.fixedPosition={chartX:d.chartX,chartY:d.chartY,plotX:b.plotX,plotY:b.plotY};b.inDragMode=!0},onMouseMove:function(b,d){if(b.fixedPosition&& b.inDragMode){var e=this.chart,c=e.pointer.normalize(d);d=b.fixedPosition.chartX-c.chartX;c=b.fixedPosition.chartY-c.chartY;var f=void 0,g=void 0,a=e.graphLayoutsLookup;if(5"+this.point.toNode.name},linkTextPath:{enabled:!0},textPath:{enabled:!1},style:{transition:"opacity 2000ms"}},link:{color:"rgba(100, 100, 100, 0.5)",width:1},draggable:!0,layoutAlgorithm:{initialPositions:"circle",initialPositionRadius:1,enableSimulation:!1,theta:.5,maxSpeed:10, approximation:"none",type:"reingold-fruchterman",integration:"euler",maxIterations:1E3,gravitationalConstant:.0625,friction:-.981},showInLegend:!1});return b}(d);t(g.prototype,{forces:["barycenter","repulsive","attractive"],hasDraggableNodes:!0,drawGraph:void 0,isCartesian:!1,requireSorting:!1,directTouch:!0,noSharedTooltip:!0,pointArrayMap:["from","to"],trackerGroups:["group","markerGroup","dataLabelsGroup"],drawTracker:k.column.prototype.drawTracker,animate:void 0,buildKDTree:f.noop,createNode:b.createNode, destroy:function(){this.layout&&this.layout.removeElementFromCollection(this,this.layout.series);b.destroy.call(this)},init:function(){var a=this;d.prototype.init.apply(this,arguments);p(this,"updatedData",function(){a.layout&&a.layout.stop()});p(this,"afterUpdate",function(){a.nodes.forEach(function(a){a&&a.series&&a.resolveColor()})});return this},generatePoints:function(){var a;b.generatePoints.apply(this,arguments);this.options.nodes&&this.options.nodes.forEach(function(a){this.nodeLookup[a.id]|| (this.nodeLookup[a.id]=this.createNode(a.id))},this);for(a=this.nodes.length-1;0<=a;a--){var d=this.nodes[a];d.degree=d.getDegree();d.radius=r(d.marker&&d.marker.radius,this.options.marker&&this.options.marker.radius,0);this.nodeLookup[d.id]||d.remove()}this.data.forEach(function(a){a.formatPrefix="link"});this.indexateNodes()},getPointsCollection:function(){return this.nodes||[]},indexateNodes:function(){this.nodes.forEach(function(a,b){a.index=b})},markerAttribs:function(b,c){c=d.prototype.markerAttribs.call(this, b,c);a(b.plotY)||(c.y=0);c.x=(b.plotX||0)-(c.width||0)/2;return c},translate:function(){this.processedXData||this.processData();this.generatePoints();this.deferLayout();this.nodes.forEach(function(a){a.isInside=!0;a.linksFrom.forEach(function(a){a.shapeType="path";a.y=1})})},deferLayout:function(){var b=this.options.layoutAlgorithm,d=this.chart.graphLayoutsStorage,c=this.chart.graphLayoutsLookup,e=this.chart.options.chart;if(this.visible){d||(this.chart.graphLayoutsStorage=d={},this.chart.graphLayoutsLookup= c=[]);var g=d[b.type];g||(b.enableSimulation=a(e.forExport)?!e.forExport:b.enableSimulation,d[b.type]=g=new f.layouts[b.type],g.init(b),c.splice(g.index,0,g));this.layout=g;g.setArea(0,0,this.chart.plotWidth,this.chart.plotHeight);g.addElementsToCollection([this],g.series);g.addElementsToCollection(this.nodes,g.nodes);g.addElementsToCollection(this.points,g.links)}},render:function(){var a=this.points,b=this.chart.hoverPoint,d=[];this.points=this.nodes;k.line.prototype.render.call(this);this.points= a;a.forEach(function(a){a.fromNode&&a.toNode&&(a.renderLink(),a.redrawLink())});b&&b.series===this&&this.redrawHalo(b);this.chart.hasRendered&&!this.options.dataLabels.allowOverlap&&(this.nodes.concat(this.points).forEach(function(a){a.dataLabel&&d.push(a.dataLabel)}),this.chart.hideOverlappingLabels(d))},drawDataLabels:function(){var a=this.options.dataLabels.textPath;d.prototype.drawDataLabels.apply(this,arguments);this.points=this.data;this.options.dataLabels.textPath=this.options.dataLabels.linkTextPath; d.prototype.drawDataLabels.apply(this,arguments);this.points=this.nodes;this.options.dataLabels.textPath=a},pointAttribs:function(a,b){var c=b||a&&a.state||"normal";b=d.prototype.pointAttribs.call(this,a,c);c=this.options.states[c];a&&!a.isNode&&(b=a.getLinkAttributes(),c&&(b={stroke:c.linkColor||b.stroke,dashstyle:c.linkDashStyle||b.dashstyle,opacity:r(c.linkOpacity,b.opacity),"stroke-width":c.linkColor||b["stroke-width"]}));return b},redrawHalo:n.redrawHalo,onMouseDown:n.onMouseDown,onMouseMove:n.onMouseMove, onMouseUp:n.onMouseUp,setState:function(a,b){b?(this.points=this.nodes.concat(this.data),d.prototype.setState.apply(this,arguments),this.points=this.data):d.prototype.setState.apply(this,arguments);this.layout.simulation||a||this.render()}});n=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;b.degree=void 0;b.linksFrom=void 0;b.linksTo=void 0;b.options=void 0;b.radius=void 0;b.series=void 0;b.toNode=void 0;return b}h(b,a);return b}(d.prototype.pointClass);t(n.prototype,{setState:b.setNodeState, init:function(){c.prototype.init.apply(this,arguments);this.series.options.draggable&&!this.series.chart.styledMode&&(p(this,"mouseOver",function(){m(this.series.chart.container,{cursor:"move"})}),p(this,"mouseOut",function(){m(this.series.chart.container,{cursor:"default"})}));return this},getDegree:function(){var a=this.isNode?this.linksFrom.length+this.linksTo.length:0;return 0===a?1:a},getLinkAttributes:function(){var a=this.series.options.link,b=this.options;return{"stroke-width":r(b.width,a.width), stroke:b.color||a.color,dashstyle:b.dashStyle||a.dashStyle,opacity:r(b.opacity,a.opacity,1)}},renderLink:function(){if(!this.graphic&&(this.graphic=this.series.chart.renderer.path(this.getLinkPath()).addClass(this.getClassName(),!0).add(this.series.group),!this.series.chart.styledMode)){var a=this.series.pointAttribs(this);this.graphic.attr(a);(this.dataLabels||[]).forEach(function(b){b&&b.attr({opacity:a.opacity})})}},redrawLink:function(){var a=this.getLinkPath();if(this.graphic){this.shapeArgs= {d:a};if(!this.series.chart.styledMode){var b=this.series.pointAttribs(this);this.graphic.attr(b);(this.dataLabels||[]).forEach(function(a){a&&a.attr({opacity:b.opacity})})}this.graphic.animate(this.shapeArgs);var d=a[0];a=a[1];"M"===d[0]&&"L"===a[0]&&(this.plotX=(d[1]+a[1])/2,this.plotY=(d[2]+a[2])/2)}},getMass:function(){var a=this.fromNode.mass,b=this.toNode.mass,d=a+b;return{fromNode:1-a/d,toNode:1-b/d}},getLinkPath:function(){var a=this.fromNode,b=this.toNode;a.plotX>b.plotX&&(a=this.toNode, b=this.fromNode);return[["M",a.plotX||0,a.plotY||0],["L",b.plotX||0,b.plotY||0]]},isValid:function(){return!this.isNode||a(this.id)},remove:function(a,b){var c=this.series,e=c.options.nodes||[],f,g=e.length;if(this.isNode){c.points=[];[].concat(this.linksFrom).concat(this.linksTo).forEach(function(a){f=a.fromNode.linksFrom.indexOf(a);-1