/*
 Highcharts JS v10.2.1 (2022-08-29)

 (c) 2009-2021 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/series-label",["highcharts"],function(r){a(r);a.Highcharts=r;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function r(a,f,A,d){a.hasOwnProperty(f)||(a[f]=d.apply(null,A),"function"===typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:f,module:a[f]}})))}a=a?a._modules:{};
r(a,"Extensions/SeriesLabel/SeriesLabelDefaults.js",[],function(){return{enabled:!0,connectorAllowed:!1,connectorNeighbourDistance:24,format:void 0,formatter:void 0,minFontSize:null,maxFontSize:null,onArea:null,style:{fontWeight:"bold"},boxesToAvoid:[]}});r(a,"Extensions/SeriesLabel/SeriesLabelUtilities.js",[],function(){function a(a,d,f,v,p,t){a=(t-d)*(f-a)-(v-d)*(p-a);return 0<a?!0:!(0>a)}function f(A,d,f,v,p,t,y,z){return a(A,d,p,t,y,z)!==a(f,v,p,t,y,z)&&a(A,d,f,v,p,t)!==a(A,d,f,v,y,z)}return{boxIntersectLine:function(a,
d,r,v,p,t,y,z){return f(a,d,a+r,d,p,t,y,z)||f(a+r,d,a+r,d+v,p,t,y,z)||f(a,d+v,a+r,d+v,p,t,y,z)||f(a,d,a,d+v,p,t,y,z)},intersectRect:function(a,d){return!(d.left>a.right||d.right<a.left||d.top>a.bottom||d.bottom<a.top)}}});r(a,"Extensions/SeriesLabel/SeriesLabel.js",[a["Core/Animation/AnimationUtilities.js"],a["Core/Chart/Chart.js"],a["Core/FormatUtilities.js"],a["Core/DefaultOptions.js"],a["Extensions/SeriesLabel/SeriesLabelDefaults.js"],a["Extensions/SeriesLabel/SeriesLabelUtilities.js"],a["Core/Utilities.js"]],
function(a,f,r,d,M,v,p){function t(c,a,b,w,g){var e=c.chart,D=B(c.options.label.onArea,!!c.area),m=D||c.options.label.connectorAllowed,l=Number.MAX_VALUE,E=Number.MAX_VALUE,d,q,k;for(q=0;q<e.boxesToAvoid.length;q+=1)if(N(e.boxesToAvoid[q],{left:a,right:a+w.width,top:b,bottom:b+w.height}))return!1;for(q=0;q<e.series.length;q+=1){var f=e.series[q];var h=f.interpolatedPoints;if(f.visible&&h){for(k=1;k<h.length;k+=1){if(h[k].chartX>=a-16&&h[k-1].chartX<=a+w.width+16){if(I(a,b,w.width,w.height,h[k-1].chartX,
h[k-1].chartY,h[k].chartX,h[k].chartY))return!1;c===f&&!d&&g&&(d=I(a-16,b-16,w.width+32,w.height+32,h[k-1].chartX,h[k-1].chartY,h[k].chartX,h[k].chartY))}if((m||d)&&(c!==f||D)){var p=a+w.width/2-h[k].chartX;var t=b+w.height/2-h[k].chartY;l=Math.min(l,p*p+t*t)}}if(!D&&m&&c===f&&(g&&!d||l<Math.pow(c.options.label.connectorNeighbourDistance,2))){for(k=1;k<h.length;k+=1)if(f=Math.min(Math.pow(a+w.width/2-h[k].chartX,2)+Math.pow(b+w.height/2-h[k].chartY,2),Math.pow(a-h[k].chartX,2)+Math.pow(b-h[k].chartY,
2),Math.pow(a+w.width-h[k].chartX,2)+Math.pow(b-h[k].chartY,2),Math.pow(a+w.width-h[k].chartX,2)+Math.pow(b+w.height-h[k].chartY,2),Math.pow(a-h[k].chartX,2)+Math.pow(b+w.height-h[k].chartY,2)),f<E){E=f;var n=h[k]}d=!0}}}return!g||d?{x:a,y:b,weight:l-(n?E:0),connectorPoint:n}:!1}function y(c){var a=c.labelSeries;c.boxesToAvoid=[];a.forEach(function(b){b.interpolatedPoints=z(b);(b.options.label.boxesToAvoid||[]).forEach(function(b){c.boxesToAvoid.push(b)})});c.series.forEach(function(b){function a(b,
c,a){var e=Math.max(f,B(v,-Infinity)),g=Math.min(f+k,B(y,Infinity));return b>e&&b<=g-a.width&&c>=q&&c<=q+p-a.height}var g=b.options.label;if(g&&(b.xAxis||b.yAxis)){var e="highcharts-color-"+B(b.colorIndex,"none"),D=!b.labelBySeries,m=g.minFontSize,l=g.maxFontSize,d=c.inverted,f=d?b.yAxis.pos:b.xAxis.pos,q=d?b.xAxis.pos:b.yAxis.pos,k=c.inverted?b.yAxis.len:b.xAxis.len,p=c.inverted?b.xAxis.len:b.yAxis.len,h=b.interpolatedPoints,r=B(g.onArea,!!b.area),x=[],n,u=b.labelBySeries;if(r&&!d){d=[b.xAxis.toPixels(b.xData[0]),
b.xAxis.toPixels(b.xData[b.xData.length-1])];var v=Math.min.apply(Math,d);var y=Math.max.apply(Math,d)}if(b.visible&&!b.boosted&&h){u||(u=b.name,"string"===typeof g.format?u=O(g.format,b,c):g.formatter&&(u=g.formatter.call(b)),b.labelBySeries=u=c.renderer.label(u,0,0,"connector").addClass("highcharts-series-label highcharts-series-label-"+b.index+" "+(b.options.className||"")+" "+e),c.renderer.styledMode||(u.css(J({color:r?c.renderer.getContrast(b.color):b.color},g.style||{})),u.attr({opacity:c.renderer.forExport?
1:0,stroke:b.color,"stroke-width":1})),m&&l&&u.css({fontSize:m+b.sum/b.chart.labelSeriesMaxSum*(l-m)+"px"}),u.attr({padding:0,zIndex:3}).add());e=u.getBBox();e.width=Math.round(e.width);for(d=h.length-1;0<d;--d)r?(m=h[d].chartX-e.width/2,l=h[d].chartCenterY-e.height/2,a(m,l,e)&&(n=t(b,m,l,e))):(m=h[d].chartX+3,l=h[d].chartY-e.height-3,a(m,l,e)&&(n=t(b,m,l,e,!0)),n&&x.push(n),m=h[d].chartX+3,l=h[d].chartY+3,a(m,l,e)&&(n=t(b,m,l,e,!0)),n&&x.push(n),m=h[d].chartX-e.width-3,l=h[d].chartY+3,a(m,l,e)&&
(n=t(b,m,l,e,!0)),n&&x.push(n),m=h[d].chartX-e.width-3,l=h[d].chartY-e.height-3,a(m,l,e)&&(n=t(b,m,l,e,!0))),n&&x.push(n);if(g.connectorAllowed&&!x.length&&!r)for(m=f+k-e.width;m>=f;m-=16)for(l=q;l<q+p-e.height;l+=16)(n=t(b,m,l,e,!0))&&x.push(n);if(x.length){if(x.sort(function(b,c){return c.weight-b.weight}),n=x[0],c.boxesToAvoid.push({left:n.x,right:n.x+e.width,top:n.y,bottom:n.y+e.height}),(h=Math.sqrt(Math.pow(Math.abs(n.x-(u.x||0)),2)+Math.pow(Math.abs(n.y-(u.y||0)),2)))&&b.labelBySeries&&(x=
{opacity:c.renderer.forExport?1:0,x:n.x,y:n.y},g={opacity:1},10>=h&&(g={x:x.x,y:x.y},x={}),h=void 0,D&&(h=F(b.options.animation),h.duration*=.2),b.labelBySeries.attr(J(x,{anchorX:n.connectorPoint&&n.connectorPoint.plotX+f,anchorY:n.connectorPoint&&n.connectorPoint.plotY+q})).animate(g,h),b.options.kdNow=!0,b.buildKDTree(),b=b.searchPoint({chartX:n.x,chartY:n.y},!0)))u.closest=[b,n.x-(b.plotX||0),n.y-(b.plotY||0)]}else u&&(b.labelBySeries=u.destroy())}else u&&(b.labelBySeries=u.destroy())}});P(c,"afterDrawSeriesLabels")}
function z(c){function a(b){var a=Math.round(b.plotX/8)+","+Math.round(b.plotY/8);t[a]||(t[a]=1,d.push(b))}if(c.xAxis||c.yAxis){var b=c.points,d=[],g=c.graph||c.area,e=g.element,f=c.chart.inverted,m=c.xAxis,l=c.yAxis,p=f?l.pos:m.pos;f=f?m.pos:l.pos;m=B(c.options.label.onArea,!!c.area);l=l.getThreshold(c.options.threshold);var t={},q;if(c.getPointSpline&&e.getPointAtLength&&!m&&b.length<c.chart.plotSizeX/16){if(g.toD){var k=g.attr("d");g.attr({d:g.toD})}var r=e.getTotalLength();for(q=0;q<r;q+=16)c=
e.getPointAtLength(q),a({chartX:p+c.x,chartY:f+c.y,plotX:c.x,plotY:c.y});k&&g.attr({d:k});c=b[b.length-1];c.chartX=p+c.plotX;c.chartY=f+c.plotY;a(c)}else for(r=b.length,q=0;q<r;q+=1){c=b[q];g=b[q-1];c.chartX=p+c.plotX;c.chartY=f+c.plotY;m&&(c.chartCenterY=f+(c.plotY+B(c.yBottom,l))/2);if(0<q&&(e=Math.abs(c.chartX-g.chartX),k=Math.abs(c.chartY-g.chartY),e=Math.max(e,k),16<e))for(e=Math.ceil(e/16),k=1;k<e;k+=1)a({chartX:g.chartX+k/e*(c.chartX-g.chartX),chartY:g.chartY+k/e*(c.chartY-g.chartY),chartCenterY:g.chartCenterY+
k/e*(c.chartCenterY-g.chartCenterY),plotX:g.plotX+k/e*(c.plotX-g.plotX),plotY:g.plotY+k/e*(c.plotY-g.plotY)});G(c.plotY)&&a(c)}return d}}function A(a){if(this.renderer){var c=this,b=F(c.renderer.globalAnimation).duration;c.labelSeries=[];c.labelSeriesMaxSum=0;p.clearTimeout(c.seriesLabelTimer);c.series.forEach(function(d){var g=d.options.label,e=d.labelBySeries,f=e&&e.closest;g.enabled&&d.visible&&(d.graph||d.area)&&!d.boosted&&(c.labelSeries.push(d),g.minFontSize&&g.maxFontSize&&(d.sum=d.yData.reduce(function(b,
c){return(b||0)+(c||0)},0),c.labelSeriesMaxSum=Math.max(c.labelSeriesMaxSum,d.sum)),"load"===a.type&&(b=Math.max(b,F(d.options.animation).duration)),f&&("undefined"!==typeof f[0].plotX?e.animate({x:f[0].plotX+f[1],y:f[0].plotY+f[2]}):e.attr({opacity:0})))});c.seriesLabelTimer=Q(function(){c.series&&c.labelSeries&&y(c)},c.renderer.forExport||!b?0:b)}}function L(c,a,b,d,g){var e=g&&g.anchorX;g=g&&g.anchorY;var f=b/2;if(G(e)&&G(g)){var m=[["M",e,g]];var l=a-g;0>l&&(l=-d-l);l<b&&(f=e<c+b/2?l:b-l);g>a+
d?m.push(["L",c+f,a+d]):g<a?m.push(["L",c+f,a]):e<c?m.push(["L",c,a+d/2]):e>c+b&&m.push(["L",c+b,a+d/2])}return m||[]}var F=a.animObject,O=r.format,H=d.setOptions,I=v.boxIntersectLine,N=v.intersectRect,K=p.addEvent,J=p.extend,P=p.fireEvent,G=p.isNumber,B=p.pick,Q=p.syncTimeout,C=[];"";return{compose:function(a,d){-1===C.indexOf(a)&&(C.push(a),K(f,"load",A),K(f,"redraw",A));-1===C.indexOf(d)&&(C.push(d),d.prototype.symbols.connector=L);-1===C.indexOf(H)&&(C.push(H),H({plotOptions:{series:{label:M}}}))}}});
r(a,"masters/modules/series-label.src.js",[a["Core/Globals.js"],a["Extensions/SeriesLabel/SeriesLabel.js"]],function(a,f){f.compose(a.Chart,a.SVGRenderer)})});
//# sourceMappingURL=series-label.js.map