/**
 * Highcharts JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/networkgraph
 * @requires highcharts
 *
 * Force directed graph module
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Torstein Hønsi
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,i,s={};s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let o=t.default;var r=s.n(o);let a=t.default.SVGElement;var n=s.n(a);let{composed:h}=r();function l(){let t,e,i,s,r=this;r.container&&(t=(0,o.addEvent)(r.container,"mousedown",t=>{e&&e(),i&&i(),(s=r.hoverPoint)&&s.series&&s.series.hasDraggableNodes&&s.series.options.draggable&&(s.series.onMouseDown(s,t),e=(0,o.addEvent)(r.container,"mousemove",t=>s&&s.series&&s.series.onMouseMove(s,t)),i=(0,o.addEvent)(r.container.ownerDocument,"mouseup",t=>(e(),i(),s&&s.series&&s.series.onMouseUp(s,t))))})),(0,o.addEvent)(r,"destroy",function(){t()})}let d={compose:function(t){(0,o.pushUnique)(h,"DragNodes")&&(0,o.addEvent)(t,"load",l)},onMouseDown:function(t,e){let{panKey:i}=this.chart.options.chart;if(i&&e[`${i}Key`])return;let s=this.chart.pointer?.normalize(e)||e;t.fixedPosition={chartX:s.chartX,chartY:s.chartY,plotX:t.plotX,plotY:t.plotY},t.inDragMode=!0},onMouseMove:function(t,e){if(t.fixedPosition&&t.inDragMode){let i,s,o=this.chart,r=o.pointer?.normalize(e)||e,a=t.fixedPosition.chartX-r.chartX,n=t.fixedPosition.chartY-r.chartY,h=o.graphLayoutsLookup;(Math.abs(a)>5||Math.abs(n)>5)&&(i=t.fixedPosition.plotX-a,s=t.fixedPosition.plotY-n,o.isInsidePlot(i,s)&&(t.plotX=i,t.plotY=s,t.hasDragged=!0,this.redrawHalo(t),h.forEach(t=>{t.restartSimulation()})))}},onMouseUp:function(t){t.fixedPosition&&(t.hasDragged&&(this.layout.enableSimulation?this.layout.start():this.chart.redraw()),t.inDragMode=t.hasDragged=!1,this.options.fixedDraggable||delete t.fixedPosition)},redrawHalo:function(t){t&&this.halo&&this.halo.attr({d:t.haloPath(this.options.states.hover.halo.size)})}},{setAnimation:p}=r(),{composed:c}=r();function u(){this.graphLayoutsLookup&&(this.graphLayoutsLookup.forEach(t=>{t.updateSimulation()}),this.redraw())}function f(){this.graphLayoutsLookup&&(this.graphLayoutsLookup.forEach(t=>{t.updateSimulation(!1)}),this.redraw())}function m(){this.graphLayoutsLookup&&this.graphLayoutsLookup.forEach(t=>{t.stop()})}function g(){let t,e=!1,i=i=>{i.maxIterations--&&isFinite(i.temperature)&&!i.isStable()&&!i.enableSimulation&&(i.beforeStep&&i.beforeStep(),i.step(),t=!1,e=!0)};if(this.graphLayoutsLookup&&!this.pointer?.hasDragged){for(p(!1,this),this.graphLayoutsLookup.forEach(t=>t.start());!t;)t=!0,this.graphLayoutsLookup.forEach(i);e&&this.series.forEach(t=>{t&&t.layout&&t.render()})}}let y=function(t){(0,o.pushUnique)(c,"GraphLayout")&&((0,o.addEvent)(t,"afterPrint",u),(0,o.addEvent)(t,"beforePrint",f),(0,o.addEvent)(t,"predraw",m),(0,o.addEvent)(t,"render",g))},b={},x={},k=t.default.SeriesRegistry;var v=s.n(k);let{series:{prototype:N,prototype:{pointClass:{prototype:L}}}}=v();!function(t){function e(){if(!this.hasDataLabels?.()&&this.nodes)for(let t of this.nodes)t.destroyElements({dataLabel:1})}function i(){return this.data=[].concat(this.points||[],this.nodes),N.destroy.apply(this,arguments)}function s(){this.nodes&&(this.nodes.forEach(t=>{t.destroy()}),this.nodes.length=0),N.setData.apply(this,arguments)}function r(t){let e=arguments,i=this.isNode?this.linksTo.concat(this.linksFrom):[this.fromNode,this.toNode];"select"!==t&&i.forEach(t=>{t&&t.series&&(L.setState.apply(t,e),!t.isNode&&(t.fromNode.graphic&&L.setState.apply(t.fromNode,e),t.toNode&&t.toNode.graphic&&L.setState.apply(t.toNode,e)))}),L.setState.apply(this,e)}function a(t,e,i,s){let r=this.series.options.nodes,a=this.series.options.data,n=a?.length||0,h=a?.[this.index];if(L.update.call(this,t,!this.isNode&&e,i,s),this.isNode){let t=(r||[]).reduce((t,e,i)=>this.id===e.id?i:t,-1),s=(0,o.merge)(r&&r[t]||{},a?.[this.index]||{});a&&(h?a[this.index]=h:a.length=n),r?t>=0?r[t]=s:r.push(s):this.series.options.nodes=[s],(0,o.pick)(e,!0)&&this.series.chart.redraw(i)}}t.compose=function(t,n){let h=t.prototype,l=n.prototype;return h.setNodeState=r,h.setState=r,h.update=a,l.destroy=i,l.setData=s,(0,o.addEvent)(n,"afterUpdate",e),n},t.createNode=function(t){let e=this.pointClass,i=(t,e)=>(0,o.find)(t,t=>t.id===e),s=i(this.nodes,t),r;if(!s){r=this.options.nodes&&i(this.options.nodes,t);let a=new e(this,(0,o.extend)({className:"highcharts-node",isNode:!0,id:t,y:1},r));a.linksTo=[],a.linksFrom=[],a.getSum=function(){let t=0,e=0;return a.linksTo.forEach(e=>{t+=e.weight||0}),a.linksFrom.forEach(t=>{e+=t.weight||0}),Math.max(t,e)},a.offset=function(t,e){let i=0;for(let s=0;s<a[e].length;s++){if(a[e][s]===t)return i;i+=a[e][s].weight}},a.hasShape=function(){let t=0;return a.linksTo.forEach(e=>{e.outgoing&&t++}),!a.linksTo.length||t!==a.linksTo.length},a.index=this.nodes.push(a)-1,s=a}return s.formatPrefix="node",s.name=s.name||s.options.id||"",s.mass=(0,o.pick)(s.options.mass,s.options.marker&&s.options.marker.radius,this.options.marker&&this.options.marker.radius,4),s},t.destroy=i,t.generatePoints=function(){let t=this.chart,e={};N.generatePoints.call(this),this.nodes||(this.nodes=[]),this.colorCounter=0,this.nodes.forEach(t=>{t.linksFrom.length=0,t.linksTo.length=0,t.level=t.options.level}),this.points.forEach(i=>{(0,o.defined)(i.from)&&(e[i.from]||(e[i.from]=this.createNode(i.from)),e[i.from].linksFrom.push(i),i.fromNode=e[i.from],t.styledMode?i.colorIndex=(0,o.pick)(i.options.colorIndex,e[i.from].colorIndex):i.color=i.options.color||e[i.from].color),(0,o.defined)(i.to)&&(e[i.to]||(e[i.to]=this.createNode(i.to)),e[i.to].linksTo.push(i),i.toNode=e[i.to]),i.name=i.name||i.id},this),this.nodeLookup=e},t.setNodeState=r,t.updateNode=a}(i||(i={}));let P=i,{series:{prototype:w,prototype:{pointClass:M}}}=v();class S extends M{destroy(){return this.isNode&&this.linksFrom.concat(this.linksTo).forEach(function(t){t.destroyElements&&t.destroyElements()}),this.series.layout.removeElementFromCollection(this,this.series.layout[this.isNode?"nodes":"links"]),M.prototype.destroy.apply(this,arguments)}getDegree(){let t=this.isNode?this.linksFrom.length+this.linksTo.length:0;return 0===t?1:t}getLinkAttributes(){let t=this.series.options.link,e=this.options;return{"stroke-width":(0,o.pick)(e.width,t.width),stroke:e.color||t.color,dashstyle:e.dashStyle||t.dashStyle,opacity:(0,o.pick)(e.opacity,t.opacity,1)}}getLinkPath(){let t=this.fromNode,e=this.toNode;return t.plotX>e.plotX&&(t=this.toNode,e=this.fromNode),[["M",t.plotX||0,t.plotY||0],["L",e.plotX||0,e.plotY||0]]}getMass(){let t=this.fromNode.mass,e=this.toNode.mass,i=t+e;return{fromNode:1-t/i,toNode:1-e/i}}constructor(t,e,i){super(t,e,i),this.series.options.draggable&&!this.series.chart.styledMode&&((0,o.addEvent)(this,"mouseOver",function(){(0,o.css)(this.series.chart.container,{cursor:"move"})}),(0,o.addEvent)(this,"mouseOut",function(){(0,o.css)(this.series.chart.container,{cursor:"default"})}))}isValid(){return!this.isNode||(0,o.defined)(this.id)}redrawLink(){let t,e=this.getLinkPath();if(this.graphic){this.shapeArgs={d:e},this.series.chart.styledMode||(t=this.series.pointAttribs(this),this.graphic.attr(t),(this.dataLabels||[]).forEach(function(e){e&&e.attr({opacity:t.opacity})})),this.graphic.animate(this.shapeArgs);let i=e[0],s=e[1];"M"===i[0]&&"L"===s[0]&&(this.plotX=(i[1]+s[1])/2,this.plotY=(i[2]+s[2])/2)}}remove(t,e){let i=this.series,s=i.options.nodes||[],o,r=s.length;if(this.isNode){for(i.points=[],[].concat(this.linksFrom).concat(this.linksTo).forEach(function(t){(o=t.fromNode.linksFrom.indexOf(t))>-1&&t.fromNode.linksFrom.splice(o,1),(o=t.toNode.linksTo.indexOf(t))>-1&&t.toNode.linksTo.splice(o,1),w.removePoint.call(i,i.data.indexOf(t),!1,!1)}),i.points=i.data.slice(),i.nodes.splice(i.nodes.indexOf(this),1);r--;)if(s[r].id===this.options.id){i.options.nodes.splice(r,1);break}this&&this.destroy(),i.isDirty=!0,i.isDirtyData=!0,t&&i.chart.redraw(t)}else i.removePoint(i.data.indexOf(this),t,e)}renderLink(){let t;!this.graphic&&(this.graphic=this.series.chart.renderer.path(this.getLinkPath()).addClass(this.getClassName(),!0).add(this.series.group),this.series.chart.styledMode||(t=this.series.pointAttribs(this),this.graphic.attr(t),(this.dataLabels||[]).forEach(function(e){e&&e.attr({opacity:t.opacity})})))}}(0,o.extend)(S.prototype,{setState:P.setNodeState});let E={attractive:function(t,e,i,s){let o=t.getMass(),r=i.x/s*e,a=i.y/s*e;t.fromNode.fixedPosition||(t.fromNode.dispX-=r*o.fromNode/t.fromNode.degree,t.fromNode.dispY-=a*o.fromNode/t.fromNode.degree),t.toNode.fixedPosition||(t.toNode.dispX+=r*o.toNode/t.toNode.degree,t.toNode.dispY+=a*o.toNode/t.toNode.degree)},attractiveForceFunction:function(t,e){return t*t/e},barycenter:function(){let t=this.options.gravitationalConstant,e=this.barycenter.xFactor,i=this.barycenter.yFactor;this.nodes.forEach(function(s){if(!s.fixedPosition){let o=s.getDegree(),r=o*(1+o/2);s.dispX+=(e-s.plotX)*t*r/s.degree,s.dispY+=(i-s.plotY)*t*r/s.degree}})},getK:function(t){return Math.pow(t.box.width*t.box.height/t.nodes.length,.3)},integrate:function(t,e){e.dispX+=e.dispX*t.options.friction,e.dispY+=e.dispY*t.options.friction;let i=e.temperature=t.vectorLength({x:e.dispX,y:e.dispY});0!==i&&(e.plotX+=e.dispX/i*Math.min(Math.abs(e.dispX),t.temperature),e.plotY+=e.dispY/i*Math.min(Math.abs(e.dispY),t.temperature))},repulsive:function(t,e,i,s){t.dispX+=i.x/s*e/t.degree,t.dispY+=i.y/s*e/t.degree},repulsiveForceFunction:function(t,e){return e*e/t}};class T{constructor(t){this.body=!1,this.isEmpty=!1,this.isInternal=!1,this.nodes=[],this.box=t,this.boxSize=Math.min(t.width,t.height)}divideBox(){let t=this.box.width/2,e=this.box.height/2;this.nodes[0]=new T({left:this.box.left,top:this.box.top,width:t,height:e}),this.nodes[1]=new T({left:this.box.left+t,top:this.box.top,width:t,height:e}),this.nodes[2]=new T({left:this.box.left+t,top:this.box.top+e,width:t,height:e}),this.nodes[3]=new T({left:this.box.left,top:this.box.top+e,width:t,height:e})}getBoxPosition(t){let e=t.plotX<this.box.left+this.box.width/2,i=t.plotY<this.box.top+this.box.height/2;return e?3*!i:i?1:2}insert(t,e){let i;this.isInternal?this.nodes[this.getBoxPosition(t)].insert(t,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(t)].insert(t,e-1)):((i=new T({top:t.plotX||NaN,left:t.plotY||NaN,width:.1,height:.1})).body=t,i.isInternal=!1,this.nodes.push(i)):(this.isInternal=!1,this.body=t))}updateMassAndCenter(){let t=0,e=0,i=0;if(this.isInternal){for(let s of this.nodes)s.isEmpty||(t+=s.mass,e+=s.plotX*s.mass,i+=s.plotY*s.mass);e/=t,i/=t}else this.body&&(t=this.body.mass,e=this.body.plotX,i=this.body.plotY);this.mass=t,this.plotX=e,this.plotY=i}}let X=class{constructor(t,e,i,s){this.box={left:t,top:e,width:i,height:s},this.maxDepth=25,this.root=new T(this.box),this.root.isInternal=!0,this.root.isRoot=!0,this.root.divideBox()}calculateMassAndCenter(){this.visitNodeRecursive(null,null,function(t){t.updateMassAndCenter()})}insertNodes(t){for(let e of t)this.root.insert(e,this.maxDepth)}visitNodeRecursive(t,e,i){let s;if(t||(t=this.root),t===this.root&&e&&(s=e(t)),!1!==s){for(let o of t.nodes){if(o.isInternal){if(e&&(s=e(o)),!1===s)continue;this.visitNodeRecursive(o,e,i)}else o.body&&e&&e(o.body);i&&i(o)}t===this.root&&i&&i(t)}}},Y={attractive:function(t,e,i){let s=t.getMass(),o=-i.x*e*this.diffTemperature,r=-i.y*e*this.diffTemperature;t.fromNode.fixedPosition||(t.fromNode.plotX-=o*s.fromNode/t.fromNode.degree,t.fromNode.plotY-=r*s.fromNode/t.fromNode.degree),t.toNode.fixedPosition||(t.toNode.plotX+=o*s.toNode/t.toNode.degree,t.toNode.plotY+=r*s.toNode/t.toNode.degree)},attractiveForceFunction:function(t,e){return(e-t)/t},barycenter:function(){let t=this.options.gravitationalConstant||0,e=(this.barycenter.xFactor-(this.box.left+this.box.width)/2)*t,i=(this.barycenter.yFactor-(this.box.top+this.box.height)/2)*t;this.nodes.forEach(function(t){t.fixedPosition||(t.plotX-=e/t.mass/t.degree,t.plotY-=i/t.mass/t.degree)})},getK:function(t){return Math.pow(t.box.width*t.box.height/t.nodes.length,.5)},integrate:function(t,e){let i=-t.options.friction,s=t.options.maxSpeed,o=e.prevX,r=e.prevY,a=(e.plotX+e.dispX-o)*i,n=(e.plotY+e.dispY-r)*i,h=Math.abs,l=h(a)/(a||1),d=h(n)/(n||1),p=l*Math.min(s,Math.abs(a)),c=d*Math.min(s,Math.abs(n));e.prevX=e.plotX+e.dispX,e.prevY=e.plotY+e.dispY,e.plotX+=p,e.plotY+=c,e.temperature=t.vectorLength({x:p,y:c})},repulsive:function(t,e,i){let s=e*this.diffTemperature/t.mass/t.degree;t.fixedPosition||(t.plotX+=i.x*s,t.plotY+=i.y*s)},repulsiveForceFunction:function(t,e){return(e-t)/t*(e>t)}},{win:D}=r();class F{constructor(){this.box={},this.currentStep=0,this.initialRendering=!0,this.links=[],this.nodes=[],this.series=[],this.simulation=!1}static compose(t){y(t),b.euler=E,b.verlet=Y,x["reingold-fruchterman"]=F}init(t){this.options=t,this.nodes=[],this.links=[],this.series=[],this.box={x:0,y:0,width:0,height:0},this.setInitialRendering(!0),this.integration=b[t.integration],this.enableSimulation=t.enableSimulation,this.attractiveForce=(0,o.pick)(t.attractiveForce,this.integration.attractiveForceFunction),this.repulsiveForce=(0,o.pick)(t.repulsiveForce,this.integration.repulsiveForceFunction),this.approximation=t.approximation}updateSimulation(t){this.enableSimulation=(0,o.pick)(t,this.options.enableSimulation)}start(){let t=this.series,e=this.options;this.currentStep=0,this.forces=t[0]&&t[0].forces||[],this.chart=t[0]&&t[0].chart,this.initialRendering&&(this.initPositions(),t.forEach(function(t){t.finishedAnimating=!0,t.render()})),this.setK(),this.resetSimulation(e),this.enableSimulation&&this.step()}step(){let t=this.series;for(let t of(this.currentStep++,"barnes-hut"===this.approximation&&(this.createQuadTree(),this.quadTree.calculateMassAndCenter()),this.forces||[]))this[t+"Forces"](this.temperature);if(this.applyLimits(),this.temperature=this.coolDown(this.startTemperature,this.diffTemperature,this.currentStep),this.prevSystemTemperature=this.systemTemperature,this.systemTemperature=this.getSystemTemperature(),this.enableSimulation){for(let e of t)e.chart&&e.render();this.maxIterations--&&isFinite(this.temperature)&&!this.isStable()?(this.simulation&&D.cancelAnimationFrame(this.simulation),this.simulation=D.requestAnimationFrame(()=>this.step())):(this.simulation=!1,this.series.forEach(t=>{(0,o.fireEvent)(t,"afterSimulation")}))}}stop(){this.simulation&&D.cancelAnimationFrame(this.simulation)}setArea(t,e,i,s){this.box={left:t,top:e,width:i,height:s}}setK(){this.k=this.options.linkLength||this.integration.getK(this)}addElementsToCollection(t,e){for(let i of t)-1===e.indexOf(i)&&e.push(i)}removeElementFromCollection(t,e){let i=e.indexOf(t);-1!==i&&e.splice(i,1)}clear(){this.nodes.length=0,this.links.length=0,this.series.length=0,this.resetSimulation()}resetSimulation(){this.forcedStop=!1,this.systemTemperature=0,this.setMaxIterations(),this.setTemperature(),this.setDiffTemperature()}restartSimulation(){this.simulation?this.resetSimulation():(this.setInitialRendering(!1),this.enableSimulation?this.start():this.setMaxIterations(1),this.chart&&this.chart.redraw(),this.setInitialRendering(!0))}setMaxIterations(t){this.maxIterations=(0,o.pick)(t,this.options.maxIterations)}setTemperature(){this.temperature=this.startTemperature=Math.sqrt(this.nodes.length)}setDiffTemperature(){this.diffTemperature=this.startTemperature/(this.options.maxIterations+1)}setInitialRendering(t){this.initialRendering=t}createQuadTree(){this.quadTree=new X(this.box.left,this.box.top,this.box.width,this.box.height),this.quadTree.insertNodes(this.nodes)}initPositions(){let t=this.options.initialPositions;if((0,o.isFunction)(t))for(let e of(t.call(this),this.nodes))(0,o.defined)(e.prevX)||(e.prevX=e.plotX),(0,o.defined)(e.prevY)||(e.prevY=e.plotY),e.dispX=0,e.dispY=0;else"circle"===t?this.setCircularPositions():this.setRandomPositions()}setCircularPositions(){let t,e=this.box,i=this.nodes,s=2*Math.PI/(i.length+1),r=i.filter(function(t){return 0===t.linksTo.length}),a={},n=this.options.initialPositionRadius,h=t=>{for(let e of t.linksFrom||[])a[e.toNode.id]||(a[e.toNode.id]=!0,l.push(e.toNode),h(e.toNode))},l=[];for(let t of r)l.push(t),h(t);if(l.length)for(let t of i)-1===l.indexOf(t)&&l.push(t);else l=i;for(let i=0,r=l.length;i<r;++i)(t=l[i]).plotX=t.prevX=(0,o.pick)(t.plotX,e.width/2+n*Math.cos(i*s)),t.plotY=t.prevY=(0,o.pick)(t.plotY,e.height/2+n*Math.sin(i*s)),t.dispX=0,t.dispY=0}setRandomPositions(){let t,e=this.box,i=this.nodes,s=i.length+1,r=t=>{let e=t*t/Math.PI;return e-Math.floor(e)};for(let a=0,n=i.length;a<n;++a)(t=i[a]).plotX=t.prevX=(0,o.pick)(t.plotX,e.width*r(a)),t.plotY=t.prevY=(0,o.pick)(t.plotY,e.height*r(s+a)),t.dispX=0,t.dispY=0}force(t,...e){this.integration[t].apply(this,e)}barycenterForces(){this.getBarycenter(),this.force("barycenter")}getBarycenter(){let t=0,e=0,i=0;for(let s of this.nodes)e+=s.plotX*s.mass,i+=s.plotY*s.mass,t+=s.mass;return this.barycenter={x:e,y:i,xFactor:e/t,yFactor:i/t},this.barycenter}barnesHutApproximation(t,e){let i,s,o=this.getDistXY(t,e),r=this.vectorLength(o);return t!==e&&0!==r&&(e.isInternal?e.boxSize/r<this.options.theta&&0!==r?(s=this.repulsiveForce(r,this.k),this.force("repulsive",t,s*e.mass,o,r),i=!1):i=!0:(s=this.repulsiveForce(r,this.k),this.force("repulsive",t,s*e.mass,o,r))),i}repulsiveForces(){if("barnes-hut"===this.approximation)for(let t of this.nodes)this.quadTree.visitNodeRecursive(null,e=>this.barnesHutApproximation(t,e));else{let t,e,i;for(let s of this.nodes)for(let o of this.nodes)s===o||s.fixedPosition||(i=this.getDistXY(s,o),0!==(e=this.vectorLength(i))&&(t=this.repulsiveForce(e,this.k),this.force("repulsive",s,t*o.mass,i,e)))}}attractiveForces(){let t,e,i;for(let s of this.links)s.fromNode&&s.toNode&&(t=this.getDistXY(s.fromNode,s.toNode),0!==(e=this.vectorLength(t))&&(i=this.attractiveForce(e,this.k),this.force("attractive",s,i,t,e)))}applyLimits(){for(let t of this.nodes)t.fixedPosition||(this.integration.integrate(this,t),this.applyLimitBox(t,this.box),t.dispX=0,t.dispY=0)}applyLimitBox(t,e){let i=t.radius;t.plotX=(0,o.clamp)(t.plotX,e.left+i,e.width-i),t.plotY=(0,o.clamp)(t.plotY,e.top+i,e.height-i)}coolDown(t,e,i){return t-e*i}isStable(){return 1e-5>Math.abs(this.systemTemperature-this.prevSystemTemperature)||this.temperature<=0}getSystemTemperature(){let t=0;for(let e of this.nodes)t+=e.temperature;return t}vectorLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}getDistR(t,e){let i=this.getDistXY(t,e);return this.vectorLength(i)}getDistXY(t,e){let i=t.plotX-e.plotX,s=t.plotY-e.plotY;return{x:i,y:s,absX:Math.abs(i),absY:Math.abs(s)}}}let{animObject:C}=r(),{composed:I,deg2rad:A}=r(),{noop:O}=r(),{series:R,seriesTypes:{column:{prototype:B},line:{prototype:q}}}=v(),{initDataLabels:G,initDataLabelsDefer:H}={initDataLabels:function(){let t=this.options.dataLabels;if(!this.dataLabelsGroup){let e=this.initDataLabelsGroup(0,t);return!this.chart.styledMode&&t?.style&&e.css(t.style),e.attr({opacity:0}),this.visible&&(this.options.animation&&t?.animation?e.animate({opacity:1},t.animation):e.attr({opacity:1}),e.show()),e}return this.dataLabelsGroup.attr({opacity:1,...this.getPlotBox("data-labels")}),this.dataLabelsGroup},initDataLabelsDefer:function(){let t=this.options.dataLabels;t?.defer&&this.options.layoutAlgorithm?.enableSimulation?(0,o.syncTimeout)(()=>{this.deferDataLabels=!1},t?C(t.animation).defer:0):this.deferDataLabels=!1}};e=n(),(0,o.pushUnique)(I,"TextPath")&&((0,o.addEvent)(e,"afterGetBBox",function(t){let e=t.bBox,i=this.element?.querySelector("textPath");if(i){let t=[],{b:s,h:o}=this.renderer.fontMetrics(this.element),r=o-s,a=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),n=i.innerHTML.replace(a,"").split(/<tspan class="highcharts-br"[^>]*>/),h=n.length,l=(t,e)=>{let{x:o,y:a}=e,n=(i.getRotationOfChar(t)-90)*A,h=Math.cos(n),l=Math.sin(n);return[[o-r*h,a-r*l],[o+s*h,a+s*l]]};for(let e=0,s=0;s<h;s++){let o=n[s].length;for(let r=0;r<o;r+=5)try{let o=e+r+s,[a,n]=l(o,i.getStartPositionOfChar(o));0===r?(t.push(n),t.push(a)):(0===s&&t.unshift(n),s===h-1&&t.push(a))}catch{break}e+=o-1;try{let o=e+s,r=i.getEndPositionOfChar(o),[a,n]=l(o,r);t.unshift(n),t.unshift(a)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}),(0,o.addEvent)(e,"beforeAddingDataLabel",function(t){let e=t.labelOptions,i=t.point,s=e[i.formatPrefix+"TextPath"]||e.textPath;s&&!e.useHTML&&(this.setTextPath(i.getDataLabelPath?.(this)||i.graphic,s),i.dataLabelPath&&!s.enabled&&(i.dataLabelPath=i.dataLabelPath.destroy()))}),e.prototype.setTextPath=e.prototype.setTextPath??function(t,e){let i=this.renderer.url,s=this.text||this,r=s.textPath,{attributes:a,enabled:n}=(0,o.merge)({enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);if(t=t||r&&r.path,r?.undo(),t&&n){let e=(0,o.addEvent)(s,"afterModifyTree",e=>{if(t&&n){let r=t.attr("id");r||t.attr("id",r=(0,o.uniqueKey)());let n={x:0,y:0};(0,o.defined)(a.dx)&&(n.dx=a.dx,delete a.dx),(0,o.defined)(a.dy)&&(n.dy=a.dy,delete a.dy),s.attr(n),this.attr({transform:""}),this.box&&(this.box=this.box.destroy());let h=e.nodes.slice(0);e.nodes.length=0,e.nodes[0]={tagName:"textPath",attributes:(0,o.extend)(a,{"text-anchor":a.textAnchor,href:`${i}#${r}`}),children:h}}});s.textPath={path:t,undo:e}}else s.attr({dx:0,dy:0}),delete s.textPath;return this.added&&(s.textCache="",this.renderer.buildText(s)),this});class U extends R{constructor(){super(...arguments),this.deferDataLabels=!0}static compose(t){d.compose(t),F.compose(t)}deferLayout(){let t=this.options.layoutAlgorithm,e=this.chart.options.chart,i,s=this.chart.graphLayoutsStorage,r=this.chart.graphLayoutsLookup;this.visible&&(s||(this.chart.graphLayoutsStorage=s={},this.chart.graphLayoutsLookup=r=[]),(i=s[t.type])||(t.enableSimulation=(0,o.defined)(e.forExport)?!e.forExport:t.enableSimulation,s[t.type]=i=new x[t.type],i.init(t),r.splice(i.index,0,i)),this.layout=i,i.setArea(0,0,this.chart.plotWidth,this.chart.plotHeight),i.addElementsToCollection([this],i.series),i.addElementsToCollection(this.nodes,i.nodes),i.addElementsToCollection(this.points,i.links))}destroy(){this.layout&&this.layout.removeElementFromCollection(this,this.layout.series),P.destroy.call(this)}drawDataLabels(){let t;if(this.deferDataLabels)return;let e=this.options.dataLabels;e?.textPath&&(t=e.textPath),R.prototype.drawDataLabels.call(this,this.nodes),e?.linkTextPath&&(e.textPath=e.linkTextPath),R.prototype.drawDataLabels.call(this,this.data),e?.textPath&&(e.textPath=t)}generatePoints(){let t,e;for(P.generatePoints.apply(this,arguments),this.options.nodes&&this.options.nodes.forEach(function(t){this.nodeLookup[t.id]||(this.nodeLookup[t.id]=this.createNode(t.id))},this),e=this.nodes.length-1;e>=0;e--)(t=this.nodes[e]).degree=t.getDegree(),t.radius=(0,o.pick)(t.marker&&t.marker.radius,this.options.marker&&this.options.marker.radius,0),t.key=t.name,this.nodeLookup[t.id]||t.remove();this.data.forEach(function(t){t.formatPrefix="link"}),this.indexateNodes()}getPointsCollection(){return this.nodes||[]}indexateNodes(){this.nodes.forEach(function(t,e){t.index=e})}init(t,e){return super.init(t,e),H.call(this),(0,o.addEvent)(this,"updatedData",()=>{this.layout&&this.layout.stop()}),(0,o.addEvent)(this,"afterUpdate",()=>{this.nodes.forEach(t=>{t&&t.series&&t.resolveColor()})}),(0,o.addEvent)(this,"afterSimulation",function(){this.deferDataLabels=!1,this.drawDataLabels()}),this}markerAttribs(t,e){let i=R.prototype.markerAttribs.call(this,t,e);return(0,o.defined)(t.plotY)||(i.y=0),i.x=(t.plotX||0)-(i.width||0)/2,i}pointAttribs(t,e){let i=e||t&&t.state||"normal",s=this.options.states[i],r=R.prototype.pointAttribs.call(this,t,i);return t&&!t.isNode&&(r=t.getLinkAttributes(),s&&(r={stroke:s.linkColor||r.stroke,dashstyle:s.linkDashStyle||r.dashstyle,opacity:(0,o.pick)(s.linkOpacity,r.opacity),"stroke-width":s.linkColor||r["stroke-width"]})),r}render(){let t=this.points,e=this.chart.hoverPoint,i=[];this.points=this.nodes,q.render.call(this),this.points=t,t.forEach(function(t){t.fromNode&&t.toNode&&(t.renderLink(),t.redrawLink())}),e&&e.series===this&&this.redrawHalo(e),this.chart.hasRendered&&!this.options.dataLabels.allowOverlap&&(this.nodes.concat(this.points).forEach(function(t){t.dataLabel&&i.push(t.dataLabel)}),this.chart.hideOverlappingLabels(i))}setState(t,e){e?(this.points=this.nodes.concat(this.data),R.prototype.setState.apply(this,arguments),this.points=this.data):R.prototype.setState.apply(this,arguments),this.layout.simulation||t||this.render()}translate(){this.generatePoints(),this.deferLayout(),this.nodes.forEach(function(t){t.isInside=!0,t.linksFrom.forEach(function(t){t.shapeType="path",t.y=1})})}}U.defaultOptions=(0,o.merge)(R.defaultOptions,{stickyTracking:!1,inactiveOtherPoints:!0,marker:{enabled:!0,states:{inactive:{opacity:.3,animation:{duration:50}}}},states:{inactive:{linkOpacity:.3,animation:{duration:50}}},dataLabels:{formatter:function(){return String(this.key??"")},linkFormatter:function(){return this.fromNode.name+"<br>"+this.toNode.name},linkTextPath:{enabled:!0},textPath:{enabled:!1},style:{transition:"opacity 2000ms"},defer:!0,animation:{defer:1e3}},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}),(0,o.extend)(U.prototype,{pointClass:S,animate:void 0,directTouch:!0,drawGraph:void 0,forces:["barycenter","repulsive","attractive"],hasDraggableNodes:!0,isCartesian:!1,noSharedTooltip:!0,pointArrayMap:["from","to"],requireSorting:!1,trackerGroups:["group","markerGroup","dataLabelsGroup"],initDataLabels:G,buildKDTree:O,createNode:P.createNode,drawTracker:B.drawTracker,onMouseDown:d.onMouseDown,onMouseMove:d.onMouseMove,onMouseUp:d.onMouseUp,redrawHalo:d.redrawHalo}),v().registerSeriesType("networkgraph",U);let K=r();U.compose(K.Chart);let z=r();export{z as default};