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