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