/* Highcharts Gantt JS v9.1.1 (2021-06-03) Pathfinder (c) 2016-2021 ystein Moseng License: www.highcharts.com/license */ 'use strict';(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/pathfinder",["highcharts"],function(w){a(w);a.Highcharts=w;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function w(a,t,z,A){a.hasOwnProperty(t)||(a[t]=A.apply(null,z))}a=a?a._modules:{};w(a,"Extensions/ArrowSymbols.js",[a["Core/Renderer/SVG/SVGRenderer.js"]],function(a){function t(a,n,p,l){return[["M", a,n+l/2],["L",a+p,n],["L",a,n+l/2],["L",a+p,n+l]]}function z(a,n,p,l){return[["M",a+p,n],["L",a,n+l/2],["L",a+p,n+l],["Z"]]}function A(a,n,p,l){return z(a,n,p/2,l)}a=a.prototype.symbols;a.arrow=t;a["arrow-filled"]=z;a["arrow-filled-half"]=A;a["arrow-half"]=function(a,n,p,l){return t(a,n,p/2,l)};a["triangle-left"]=z;a["triangle-left-half"]=A;return a});w(a,"Gantt/Connection.js",[a["Core/Globals.js"],a["Core/DefaultOptions.js"],a["Core/Series/Point.js"],a["Core/Utilities.js"]],function(a,t,z,A){function J(b){var c= b.shapeArgs;return c?{xMin:c.x||0,xMax:(c.x||0)+(c.width||0),yMin:c.y||0,yMax:(c.y||0)+(c.height||0)}:(c=b.graphic&&b.graphic.getBBox())?{xMin:b.plotX-c.width/2,xMax:b.plotX+c.width/2,yMin:b.plotY-c.height/2,yMax:b.plotY+c.height/2}:null}"";var n=A.defined,p=A.error,l=A.extend,x=A.merge,w=A.objectEach,f=a.deg2rad,d=Math.max,h=Math.min;l(t.defaultOptions,{connectors:{type:"straight",lineWidth:1,marker:{enabled:!1,align:"center",verticalAlign:"middle",inside:!1,lineWidth:1},startMarker:{symbol:"diamond"}, endMarker:{symbol:"arrow-filled"}}});t=function(){function b(c,y,k){this.toPoint=this.pathfinder=this.graphics=this.fromPoint=this.chart=void 0;this.init(c,y,k)}b.prototype.init=function(c,y,k){this.fromPoint=c;this.toPoint=y;this.options=k;this.chart=c.series.chart;this.pathfinder=this.chart.pathfinder};b.prototype.renderPath=function(c,y,k){var b=this.chart,a=b.styledMode,f=b.pathfinder,e=!b.options.chart.forExport&&!1!==k,g=this.graphics&&this.graphics.path;f.group||(f.group=b.renderer.g().addClass("highcharts-pathfinder-group").attr({zIndex:-1}).add(b.seriesGroup)); f.group.translate(b.plotLeft,b.plotTop);g&&g.renderer||(g=b.renderer.path().add(f.group),a||g.attr({opacity:0}));g.attr(y);c={d:c};a||(c.opacity=1);g[e?"animate":"attr"](c,k);this.graphics=this.graphics||{};this.graphics.path=g};b.prototype.addMarker=function(c,b,k){var a=this.fromPoint.series.chart,d=a.pathfinder;a=a.renderer;var y="start"===c?this.fromPoint:this.toPoint,e=y.getPathfinderAnchorPoint(b);if(b.enabled&&((k="start"===c?k[1]:k[k.length-2])&&"M"===k[0]||"L"===k[0])){k={x:k[1],y:k[2]}; k=y.getRadiansToVector(k,e);e=y.getMarkerVector(k,b.radius,e);k=-k/f;if(b.width&&b.height){var g=b.width;var u=b.height}else g=u=2*b.radius;this.graphics=this.graphics||{};e={x:e.x-g/2,y:e.y-u/2,width:g,height:u,rotation:k,rotationOriginX:e.x,rotationOriginY:e.y};this.graphics[c]?this.graphics[c].animate(e):(this.graphics[c]=a.symbol(b.symbol).addClass("highcharts-point-connecting-path-"+c+"-marker").attr(e).add(d.group),a.styledMode||this.graphics[c].attr({fill:b.color||this.fromPoint.color,stroke:b.lineColor, "stroke-width":b.lineWidth,opacity:0}).animate({opacity:1},y.series.options.animation))}};b.prototype.getPath=function(b){var c=this.pathfinder,a=this.chart,f=c.algorithms[b.type],d=c.chartObstacles;if("function"!==typeof f)return p('"'+b.type+'" is not a Pathfinder algorithm.'),{path:[],obstacles:[]};f.requiresObstacles&&!d&&(d=c.chartObstacles=c.getChartObstacles(b),a.options.connectors.algorithmMargin=b.algorithmMargin,c.chartObstacleMetrics=c.getObstacleMetrics(d));return f(this.fromPoint.getPathfinderAnchorPoint(b.startMarker), this.toPoint.getPathfinderAnchorPoint(b.endMarker),x({chartObstacles:d,lineObstacles:c.lineObstacles||[],obstacleMetrics:c.chartObstacleMetrics,hardBounds:{xMin:0,xMax:a.plotWidth,yMin:0,yMax:a.plotHeight},obstacleOptions:{margin:b.algorithmMargin},startDirectionX:c.getAlgorithmStartDirection(b.startMarker)},b))};b.prototype.render=function(){var b=this.fromPoint,a=b.series,f=a.chart,D=f.pathfinder,q=x(f.options.connectors,a.options.connectors,b.options.connectors,this.options),l={};f.styledMode|| (l.stroke=q.lineColor||b.color,l["stroke-width"]=q.lineWidth,q.dashStyle&&(l.dashstyle=q.dashStyle));l["class"]="highcharts-point-connecting-path highcharts-color-"+b.colorIndex;q=x(l,q);n(q.marker.radius)||(q.marker.radius=h(d(Math.ceil((q.algorithmMargin||8)/2)-1,1),5));b=this.getPath(q);f=b.path;b.obstacles&&(D.lineObstacles=D.lineObstacles||[],D.lineObstacles=D.lineObstacles.concat(b.obstacles));this.renderPath(f,l,a.options.animation);this.addMarker("start",x(q.marker,q.startMarker),f);this.addMarker("end", x(q.marker,q.endMarker),f)};b.prototype.destroy=function(){this.graphics&&(w(this.graphics,function(b){b.destroy()}),delete this.graphics)};return b}();a.Connection=t;l(z.prototype,{getPathfinderAnchorPoint:function(b){var a=J(this);switch(b.align){case "right":var f="xMax";break;case "left":f="xMin"}switch(b.verticalAlign){case "top":var d="yMin";break;case "bottom":d="yMax"}return{x:f?a[f]:(a.xMin+a.xMax)/2,y:d?a[d]:(a.yMin+a.yMax)/2}},getRadiansToVector:function(b,a){var f;n(a)||(f=J(this))&&(a= {x:(f.xMin+f.xMax)/2,y:(f.yMin+f.yMax)/2});return Math.atan2(a.y-b.y,b.x-a.x)},getMarkerVector:function(b,a,f){var d=2*Math.PI,c=J(this),h=c.xMax-c.xMin,l=c.yMax-c.yMin,e=Math.atan2(l,h),g=!1;h/=2;var u=l/2,H=c.xMin+h;c=c.yMin+u;for(var F=H,G=c,m=1,v=1;b<-Math.PI;)b+=d;for(;b>Math.PI;)b-=d;d=Math.tan(b);b>-e&&b<=e?(v=-1,g=!0):b>e&&b<=Math.PI-e?v=-1:b>Math.PI-e||b<=-(Math.PI-e)?(m=-1,g=!0):m=-1;g?(F+=m*h,G+=v*h*d):(F+=l/(2*d)*m,G+=v*u);f.x!==H&&(F=f.x);f.y!==c&&(G=f.y);return{x:F+a*Math.cos(b),y:G- a*Math.sin(b)}}});return t});w(a,"Gantt/PathfinderAlgorithms.js",[a["Core/Utilities.js"]],function(a){function t(a,d,h){h=h||0;var b=a.length-1;d-=1e-7;for(var f,l;h<=b;)if(f=b+h>>1,l=d-a[f].xMin,0l)b=f-1;else return f;return 0=d.x)b=a[f],b=d.x<=b.xMax&&d.x>=b.xMin&&d.y<=b.yMax&&d.y>=b.yMin;if(b)return f}return-1}function A(a){var f=[];if(a.length){f.push(["M",a[0].start.x,a[0].start.y]);for(var h=0;hx(e[f]-a[f+"Max"]);return b(e,f,a,f+(g?"Max":"Min"),g?1:-1)}var l=[],k=n(h.startDirectionX,x(d.x-a.x)>x(d.y-a.y))?"x":"y",p=h.chartObstacles,q=z(p,a);h=z(p,d);if(-1=a[k]===h[k]>=e[k]&&(k="y"===k?"x":"y",d=a[k]f?p(t(m,u.x),m.length-1):0;m[e]&&(0f&&m[e].xMax>=d.x);){if(m[e].xMin<=u.x&&m[e].xMax>=d.x&&m[e].yMin<=r.y&&m[e].yMax>=C.y)return g?{y:a.y,x:a.x=u[c+"Max"];u=a[c+"Min"]<=u[c+"Min"];var r=a[c+"Max"]>=m[c+"Max"];m=a[c+ "Min"]<=m[c+"Min"];var l=x(a[c+"Min"]-e[c]),k=x(a[c+"Max"]-e[c]);g=10>x(l-k)?e[c]x(d.y-a.y)),q=D?"x":"y",E=[],e=!1,g=h.obstacleMetrics,u=p(a.x,d.x)-g.maxWidth-10,H=l(a.x,d.x)+g.maxWidth+10,F=p(a.y,d.y)-g.maxHeight-10,G=l(a.y,d.y)+ g.maxHeight+10,m=h.chartObstacles;var v=t(m,u);g=t(m,H);m=m.slice(v,g+1);if(-1<(g=z(m,d))){var B=k(m[g],d,a);E.push({end:d,start:B});d=B}for(;-1<(g=z(m,d));)v=0>d[q]-a[q],B={x:d.x,y:d.y},B[q]=m[g][v?q+"Max":q+"Min"]+(v?1:-1),E.push({end:d,start:B}),d=B;a=y(a,d,D);a=a.concat(E.reverse());return{path:A(a),obstacles:a}};I.requiresObstacles=!0;return{fastAvoid:I,straight:function(a,d){return{path:[["M",a.x,a.y],["L",d.x,d.y]],obstacles:[{start:a,end:d}]}},simpleConnect:a}});w(a,"Gantt/Pathfinder.js", [a["Gantt/Connection.js"],a["Core/Chart/Chart.js"],a["Core/Globals.js"],a["Core/DefaultOptions.js"],a["Core/Series/Point.js"],a["Core/Utilities.js"],a["Gantt/PathfinderAlgorithms.js"]],function(a,t,z,A,w,n,p){function l(a){var b=a.shapeArgs;return b?{xMin:b.x||0,xMax:(b.x||0)+(b.width||0),yMin:b.y||0,yMax:(b.y||0)+(b.height||0)}:(b=a.graphic&&a.graphic.getBBox())?{xMin:a.plotX-b.width/2,xMax:a.plotX+b.width/2,yMin:a.plotY-b.height/2,yMax:a.plotY+b.height/2}:null}function x(a){for(var b=a.length,e= 0,c,d,f=[],m=function(a,b,e){e=y(e,10);var c=a.yMax+e>b.yMin-e&&a.yMin-eb.xMin-e&&a.xMin-eb.xMax?a.xMin-b.xMax:b.xMin-a.xMax:Infinity,f=d?a.yMin>b.yMax?a.yMin-b.yMax:b.yMin-a.yMax:Infinity;return d&&c?e?m(a,b,Math.floor(e/2)):Infinity:q(g,f)};ed&&f.push(d);f.push(80);return D(Math.floor(f.sort(function(a,b){return a-b})[Math.floor(f.length/10)]/2-1),1)}function I(a){if(a.options.pathfinder||a.series.reduce(function(a, b){b.options&&c(!0,b.options.connectors=b.options.connectors||{},b.options.pathfinder);return a||b.options&&b.options.pathfinder},!1))c(!0,a.options.connectors=a.options.connectors||{},a.options.pathfinder),h('WARNING: Pathfinder options have been renamed. Use "chart.connectors" or "series.connectors" instead.')}"";var f=n.addEvent,d=n.defined,h=n.error,b=n.extend,c=n.merge,y=n.pick,k=n.splat,D=Math.max,q=Math.min;b(A.defaultOptions,{connectors:{type:"straight",lineWidth:1,marker:{enabled:!1,align:"center", verticalAlign:"middle",inside:!1,lineWidth:1},startMarker:{symbol:"diamond"},endMarker:{symbol:"arrow-filled"}}});var E=function(){function b(a){this.lineObstacles=this.group=this.connections=this.chartObstacleMetrics=this.chartObstacles=this.chart=void 0;this.init(a)}b.prototype.init=function(a){this.chart=a;this.connections=[];f(a,"redraw",function(){this.pathfinder.update()})};b.prototype.update=function(b){var e=this.chart,c=this,d=c.connections;c.connections=[];e.series.forEach(function(b){b.visible&& !b.options.isInternal&&b.points.forEach(function(b){var d=b.options;d&&d.dependency&&(d.connect=d.dependency);var g;d=b.options&&b.options.connect&&k(b.options.connect);b.visible&&!1!==b.isInside&&d&&d.forEach(function(d){g=e.get("string"===typeof d?d:d.to);g instanceof w&&g.series.visible&&g.visible&&!1!==g.isInside&&c.connections.push(new a(b,g,"string"===typeof d?{}:d))})})});for(var g=0,f=void 0,h=void 0,l=d.length,p=c.connections.length;gMath.PI;)a-=d;d=Math.tan(a);a>-h&&a<=h?(u=-1,k=!0):a>h&&a<=Math.PI-h?u=-1:a>Math.PI-h||a<=-(Math.PI-h)?(t=-1,k=!0):t=-1;k?(r+=t*f,q+=u*f*d):(r+=g/(2*d)*t,q+=u*n);c.x!==p&&(r=c.x);c.y!==e&&(q=c.y);return{x:r+b*Math.cos(a),y:q-b*Math.sin(a)}}});t.prototype.callbacks.push(function(a){!1!==a.options.connectors.enabled&&(I(a),this.pathfinder=new E(this),this.pathfinder.update(!0))}); return E});w(a,"masters/modules/pathfinder.src.js",[],function(){})}); //# sourceMappingURL=pathfinder.js.map