/**
* Highcharts JS v11.2.0 (2023-10-30)
*
* Marker clusters module for Highcharts
*
* (c) 2010-2021 Wojciech Chmiel
*
* License: www.highcharts.com/license
*/!function(t){"object"==typeof module&&module.exports?(t.default=t,module.exports=t):"function"==typeof define&&define.amd?define("highcharts/modules/marker-clusters",["highcharts"],function(e){return t(e),t.Highcharts=e,t}):t("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(t){"use strict";var e=t?t._modules:{};function i(t,e,i,s){t.hasOwnProperty(e)||(t[e]=s.apply(null,i),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})))}i(e,"Extensions/MarkerClusters/MarkerClusterDefaults.js",[],function(){return{cluster:{enabled:!1,allowOverlap:!0,animation:{duration:500},drillToCluster:!0,minimumClusterSize:2,layoutAlgorithm:{gridSize:50,distance:40,kmeansThreshold:100},marker:{symbol:"cluster",radius:15,lineWidth:0,lineColor:"#ffffff"},dataLabels:{enabled:!0,format:"{point.clusterPointsAmount}",verticalAlign:"middle",align:"center",style:{color:"contrast"},inside:!0}},tooltip:{clusterFormat:"Clustered points: {point.clusterPointsAmount}
"}}}),i(e,"Extensions/MarkerClusters/MarkerClusterScatter.js",[e["Core/Animation/AnimationUtilities.js"],e["Extensions/MarkerClusters/MarkerClusterDefaults.js"],e["Core/Utilities.js"]],function(t,e,i){let s;let{animObject:a}=t,{cluster:r}=e,{addEvent:o,defined:n,error:l,isArray:p,isFunction:u,isObject:d,isNumber:h,merge:c,objectEach:f,pushUnique:m,relativeLength:g,syncTimeout:x}=i,y=[],C={grid:function(t,e,i,s){let a,r,o,n,l;let p={},u=this.getGridOffset(),d=this.getScaledGridSize(s);for(l=0;l1&&(f=A(g[t]),a.push({posX:f.x,posY:f.y,oldX:0,oldY:0,startPointsLen:g[t].length,points:[]}));for(;d;){for(let t of a)t.points.length=0;o.length=0;for(let s=0;sa[t].oldX+1||a[t].posXa[t].oldY+1||a[t].posYo.minX||this.initMaxY&&this.initMaxYo.minY)this.initMaxX=o.maxX,this.initMinX=o.minX,this.initMaxY=o.maxY,this.initMinY=o.minY,u=this.markerClusterAlgorithms?this.markerClusterAlgorithms.kmeans.call(this,t,e,i,s):{},this.baseClusters=null;else{for(let t of(this.baseClusters||(this.baseClusters={clusters:this.markerClusterInfo.clusters,noise:this.markerClusterInfo.noise}),this.baseClusters.clusters)){for(let e of(t.pointsOutside=[],t.pointsInside=[],t.data)){let i=H(this,e),s=H(this,t);p=Math.sqrt(Math.pow(i.x-s.x,2)+Math.pow(i.y-s.y,2)),d=a-(h=t.clusterZone&&t.clusterZone.marker&&t.clusterZone.marker.radius?t.clusterZone.marker.radius:l&&l.radius?l.radius:r.marker.radius)>=0?a-h:h,p>h+d&&n(t.pointsOutside)?t.pointsOutside.push(e):n(t.pointsInside)&&t.pointsInside.push(e)}t.pointsInside.length&&(u[t.id]=t.pointsInside);let e=0;for(let i of t.pointsOutside)u[t.id+"_noise"+e++]=[i]}for(let t of this.baseClusters.noise)u[t.id]=t.data}return u}},k=[],M=0;function I(t,e,i){t.attr({opacity:e}).animate({opacity:1},i)}function S(t,e,i,s){for(let a of(b(t,s,i,!0,!0),e))a.point&&a.point.destroy&&a.point.destroy()}function b(t,e,i,s,a){t.point&&(s&&t.point.graphic&&(t.point.graphic.show(),I(t.point.graphic,e,i)),a&&t.point.dataLabel&&(t.point.dataLabel.show(),I(t.point.dataLabel,e,i)))}function A(t){let e=t.length,i=0,s=0;for(let a=0;at.x).sort((t,e)=>t-e),n=e.clusteredData.map(t=>t.y).sort((t,e)=>t-e),l=i[0],p=i[i.length-1],u=n[0],d=n[n.length-1],h=Math.abs((p-l)*.1),c=Math.abs((d-u)*.1),f=Math.min(l,p)-h,m=Math.max(l,p)+h,g=Math.min(u,d)-c,x=Math.max(u,d)+c;o?o.fitToBounds({x1:f,x2:m,y1:g,y2:x}):s&&a&&(r.pointer.zoomX=!0,r.pointer.zoomY=!0,r.zoom({originalEvent:t,xAxis:[{axis:s,min:f,max:m}],yAxis:[{axis:a,min:g,max:x}]}))}})}function z(t,e){let{chart:i,xAxis:s,yAxis:a}=t;return i.mapView?i.mapView.pixelsToProjectedUnits(e):{x:s?s.toValue(e.x):0,y:a?a.toValue(e.y):0}}function P(t){let e=this.chart,i=e.mapView,s=this.options.cluster,r=a((s||{}).animation),o=r.duration||500,n=(this.markerClusterInfo||{}).pointsState,l=(n||{}).newState,p=(n||{}).oldState,u=[],d,h,c,f=0,m=0,g=0,y=!1,C=!1;if(p&&l){h=l[t.stateId];let s=H(this,h);m=s.x-(i?0:e.plotLeft),g=s.y-(i?0:e.plotTop),1===h.parentsId.length?(d=p[(l||{})[t.stateId].parentsId[0]],h.point&&h.point.graphic&&d&&d.point&&d.point.plotX&&d.point.plotY&&d.point.plotX!==h.point.plotX&&d.point.plotY!==h.point.plotY&&(c=h.point.graphic.getBBox(),f=h.point.graphic&&h.point.graphic.isImg?0:c.width/2,h.point.graphic.attr({x:d.point.plotX-f,y:d.point.plotY-f}),h.point.graphic.animate({x:m-(h.point.graphic.radius||0),y:g-(h.point.graphic.radius||0)},r,function(){C=!0,d.point&&d.point.destroy&&d.point.destroy()}),h.point.dataLabel&&h.point.dataLabel.alignAttr&&d.point.dataLabel&&d.point.dataLabel.alignAttr&&(h.point.dataLabel.attr({x:d.point.dataLabel.alignAttr.x,y:d.point.dataLabel.alignAttr.y}),h.point.dataLabel.animate({x:h.point.dataLabel.alignAttr.x,y:h.point.dataLabel.alignAttr.y},r)))):0===h.parentsId.length?(D(h,!0,!0),x(function(){b(h,.1,r,!0,!0)},o/2)):(D(h,!0,!0),h.parentsId.forEach(function(t){p&&p[t]&&(d=p[t],u.push(d),d.point&&d.point.graphic&&(y=!0,d.point.graphic.show(),d.point.graphic.animate({x:m-(d.point.graphic.radius||0),y:g-(d.point.graphic.radius||0),opacity:.4},r,function(){C=!0,S(h,u,r,.7)}),d.point.dataLabel&&-9999!==d.point.dataLabel.y&&h.point&&h.point.dataLabel&&h.point.dataLabel.alignAttr&&(d.point.dataLabel.show(),d.point.dataLabel.animate({x:h.point.dataLabel.alignAttr.x,y:h.point.dataLabel.alignAttr.y,opacity:.4},r))))}),x(function(){C||S(h,u,r,.85)},o),y||x(function(){S(h,u,r,.1)},o/2))}}function w(){let t=this.markerClusterSeriesData;(t||[]).forEach(function(t){t&&t.destroy&&t.destroy()}),this.markerClusterSeriesData=null}function E(){let t,e,i,a,l,p,d,c,f,m,x,y,C,k,M,I;let S=this,b=S.chart,A=b.mapView,X=S.xData,Y=S.yData,D=S.options.cluster,P=S.getRealExtremes(),w=[],E=[],j=[];if(A&&S.is("mappoint")&&X&&Y&&(S.options.data||[]).forEach((t,e)=>{let i=S.projectPoint(t);i&&(X[e]=i.x,Y[e]=i.y)}),D&&D.enabled&&X&&X.length&&Y&&Y.length&&!b.polar){x=D.layoutAlgorithm.type,(k=D.layoutAlgorithm).processedGridSize=g(k.gridSize||r.layoutAlgorithm.gridSize,b.plotWidth),k.processedDistance=g(k.distance||r.layoutAlgorithm.distance,b.plotWidth),a=k.kmeansThreshold||r.layoutAlgorithm.kmeansThreshold;let A=k.processedGridSize/2,O=z(S,{x:0,y:0}),V=z(S,{x:A,y:A});for(I=0,l=Math.abs(O.x-V.x),p=Math.abs(O.y-V.y);I=P.minX-l&&X[I]<=P.maxX+l&&(Y[I]||P.minY)>=P.minY-p&&(Y[I]||P.maxY)<=P.maxY+p&&(w.push(X[I]),E.push(Y[I]),j.push(I));n(c)&&n(d)&&h(m)&&h(f)&&(S.dataMaxX=c,S.dataMinX=d,S.dataMaxY=m,S.dataMinY=f),y=(C=(u(x)?x:S.markerClusterAlgorithms?x&&S.markerClusterAlgorithms[x]?S.markerClusterAlgorithms[x]:w.lengtht.distance-e.distance)}function O(t,e){let i=[],s=[],a=[],o=[],n=[],h=Math.max(2,e.minimumClusterSize||2),f=0,m,g,x,y,C,k,M,I,S,b,X,D,L,z;if(u(e.layoutAlgorithm.type)&&!this.isValidGroupedDataObject(t))return l("Highcharts marker-clusters module: The custom algorithm result is not valid!",!1,this.chart),!1;for(z in t)if(t[z].length>=h){if(x=t[z],m=Y(),C=x.length,e.zones)for(L=0;L=e.zones[L].from&&C<=e.zones[L].to&&((X=e.zones[L]).zoneIndex=L,b=e.zones[L].marker,D=e.zones[L].className);for(S=A(x),"grid"!==e.layoutAlgorithm.type||e.allowOverlap?M={x:S.x,y:S.y}:(k=this.options.marker||{},M=this.preventClusterCollisions({x:S.x,y:S.y,key:z,groupedData:t,gridSize:this.getScaledGridSize(e.layoutAlgorithm),defaultRadius:k.radius||3+(k.lineWidth||0),clusterRadius:b&&b.radius?b.radius:(e.marker||{}).radius||r.marker.radius})),L=0;L.75&&p<1.25?a=!1:p>=1/t&&p<2*(1/t)?(a=!1,n=t):p<=t&&p>t/2&&(a=!1,n=1/t),o++}return s/n/p}function R(){let t=this.markerClusterSeriesData,e=((this.markerClusterInfo||{}).pointsState||{}).oldState||{},i=k.map(t=>(e[t].point||{}).id||"");(t||[]).forEach(function(t){t&&-1!==i.indexOf(t.id)?(t.graphic&&t.graphic.hide(),t.dataLabel&&t.dataLabel.hide()):t&&t.destroy&&t.destroy()})}function Z(t){let e=!1,i;return!!d(t)&&(f(t,function(t){if(e=!0,!p(t)||!t.length){e=!1;return}for(i=0;i=f[Y].from&&y<=f[Y].to&&(C=n((f[Y].marker||{}).radius)?f[Y].marker.radius||0:c&&c.radius?c.radius:r.marker.radius);a[t].length>1&&0===C&&c&&c.radius?C=c.radius:1===a[t].length&&(C=o),E=l+C,C=0,L!==i&&Math.abs(g-k){t.tooltip&&t.tooltip.destroy()},e)}function g(){for(let t of this.series||[])if(t.markerClusterInfo){let e=t.options.cluster,i=(t.markerClusterInfo||{}).pointsState,s=(i||{}).oldState;if((e||{}).animation&&t.markerClusterInfo&&0===t.chart.pointer.pinchDown.length&&"pan"!==((t.xAxis||{}).eventArgs||{}).trigger&&s&&Object.keys(s).length){for(let e of t.markerClusterInfo.clusters)t.animateClusterPoint(e);for(let e of t.markerClusterInfo.noise)t.animateClusterPoint(e)}}}function x(t){let e=t.point||t.target,i=e.series,s=i.options.cluster,a=((s||{}).events||{}).drillToCluster;u(a)&&a.call(this,t)}function y(){if(this.dataGroup)return p("Highcharts marker-clusters module: Running `Point.update` when point belongs to clustered series is not supported.",!1,this.series.chart),!1}function C(){let t=(this.options.cluster||{}).drillToCluster;if(this.markerClusterInfo&&this.markerClusterInfo.clusters)for(let e of this.markerClusterInfo.clusters)e.point&&e.point.graphic&&(e.point.graphic.addClass("highcharts-cluster-point"),t&&e.point&&(e.point.graphic.css({cursor:"pointer"}),e.point.dataLabel&&e.point.dataLabel.css({cursor:"pointer"})),l(e.clusterZone)&&e.point.graphic.addClass(e.clusterZoneClassName||"highcharts-cluster-zone-"+e.clusterZone.zoneIndex))}return(o.plotOptions||{}).series=d((o.plotOptions||{}).series,i),{compose:function(t,e,i,a){let r=a.prototype.pointClass;h(f,t)&&n(t,"setExtremes",m),h(f,e)&&n(e,"render",g),h(f,r)&&(n(r,"drillToCluster",x),n(r,"update",y)),h(f,a)&&n(a,"afterRender",C);let{scatter:o}=a.types;o&&s.compose(i,o)}}}),i(e,"Extensions/MarkerClusters/MarkerClusterSymbols.js",[e["Core/Utilities.js"]],function(t){let e;let{pushUnique:i}=t,s=[];function a(t,i,s,a){let r=s/2,o=a/2,n=e.arc(t+r,i+o,r-4,o-4,{start:.5*Math.PI,end:2.5*Math.PI,open:!1}),l=e.arc(t+r,i+o,r-3,o-3,{start:.5*Math.PI,end:2.5*Math.PI,innerR:r-2,open:!1}),p=e.arc(t+r,i+o,r-1,o-1,{start:.5*Math.PI,end:2.5*Math.PI,innerR:r,open:!1});return p.concat(l,n)}return{compose:function(t){i(s,t)&&((e=t.prototype.symbols).cluster=a)}}}),i(e,"masters/modules/marker-clusters.src.js",[e["Core/Globals.js"],e["Extensions/MarkerClusters/MarkerClusters.js"],e["Extensions/MarkerClusters/MarkerClusterSymbols.js"]],function(t,e,i){e.compose(t.Axis,t.Chart,t.defaultOptions,t.Series),i.compose(t.SVGRenderer)})});//# sourceMappingURL=marker-clusters.js.map