UNPKG

highcharts

Version:
13 lines 20.2 kB
let t;/** * Highcharts JS v13.0.1 (2026-08-17) * @module highcharts/modules/marker-clusters * @requires highcharts * * Marker clusters module for Highcharts * * (c) 2010-2026 Highsoft AS * Author: Wojciech Chmiel * * A commercial license may be required depending on use, * see www.highcharts.com/license */import*as e from"../highcharts.js";let i={};i.n=t=>{let e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{if(Array.isArray(e))for(var s=0;s<e.length;){var r=e[s++],a=e[s++];i.o(t,r)?0===a&&s++:0===a?Object.defineProperty(t,r,{enumerable:!0,value:e[s++]}):Object.defineProperty(t,r,{enumerable:!0,get:a})}else for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let s=e.default;var r=i.n(s);let a={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:"var(--highcharts-background-color)"},dataLabels:{enabled:!0,format:"{point.clusterPointsAmount}",verticalAlign:"middle",align:"center",style:{color:"contrast"},inside:!0}},tooltip:{clusterFormat:"<span>Clustered points: {point.clusterPointsAmount}</span><br/>"}},{setLength:o,splice:n}={convertToNumber:function(t,e){switch(typeof t){case"boolean":return+!!t;case"number":return isNaN(t)&&!e?null:t;default:return isNaN(t=parseFloat(`${t??""}`))&&!e?null:t}},setLength:function(t,e,i){return Array.isArray(t)?(t.length=e,t):t[i?"subarray":"slice"](0,e)},splice:function(t,e,i,s,r=[]){if(Array.isArray(t))return Array.isArray(r)||(r=Array.from(r)),{removed:t.splice(e,i,...r),array:t};let a=Object.getPrototypeOf(t).constructor,o=t[s?"subarray":"slice"](e,e+i),n=new a(t.length-i+r.length);return n.set(t.subarray(0,e),0),n.set(r,e),n.set(t.subarray(e+i),e+r.length),{removed:o,array:n}}},l=class{constructor(t={}){this.isDataTable=!0,this.autoId=!t.id,this.columns={},this.id=t.id||(0,s.uniqueKey)(),this.rowCount=0,this.versionTag=(0,s.uniqueKey)();let e=0;(0,s.objectEach)(t.columns||{},(t,i)=>{this.columns[i]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,(0,s.objectEach)(this.columns,(e,i)=>{e.length!==t&&(this.columns[i]=o(e,t))})}deleteRows(t,e=1){if(e>0&&t<this.rowCount){let i=0;(0,s.objectEach)(this.columns,(s,r)=>{this.columns[r]=n(s,t,e).array,i=s.length}),this.rowCount=i}(0,s.fireEvent)(this,"afterDeleteRows",{rowIndex:t,rowCount:e}),this.versionTag=(0,s.uniqueKey)()}getColumn(t,e){return this.columns[t]}getColumns(t,e){return(t||Object.keys(this.columns)).reduce((t,e)=>(t[e]=this.columns[e],t),{})}getRowObject(t,e){let i={},s=this.columns;for(let r of(e??(e=Object.keys(this.columns)),e))i[r]=s[r]?.[t];return i}setColumn(t,e=[],i=0,s){this.setColumns({[t]:e},i,s)}setColumns(t,e,i){let r=this.rowCount;(0,s.objectEach)(t,(t,e)=>{this.columns[e]=t.slice(),r=t.length}),this.applyRowCount(r),i?.silent||((0,s.fireEvent)(this,"afterSetColumns"),this.versionTag=(0,s.uniqueKey)())}setRow(t,e=this.rowCount,i,r){var a;let{columns:o}=this,l=i?this.rowCount+1:e+1,u=Object.keys(t);if(r?.addColumns!==!1)for(let t=0,e=u.length;t<e;t++)o[a=u[t]]||(o[a]=Array(this.rowCount));(0,s.objectEach)(o,(s,r)=>{s&&(i?s=n(s,e,0,!0,[t[r]]).array:s[e]=r in t?t[r]:s[e],o[r]=s)}),this.applyRowCount(Math.max(l,this.rowCount)),r?.silent||((0,s.fireEvent)(this,"afterSetRows",{rowIndex:e}),this.versionTag=(0,s.uniqueKey)())}getModified(){return this.modified||this}},{cluster:u}=a,h={grid:function(t,e,i,s){let r,a,o,n,l,u={},h=this.getGridOffset(),p=this.getScaledGridSize(s);for(l=0;l<t.length;l++){let s=E(this,{x:t[l],y:e[l]});r=s.x-h.plotLeft,a=s.y-h.plotTop,o=Math.floor(r/p),u[n=Math.floor(a/p)+":"+o]??(u[n]=[]),u[n].push({dataIndex:i[l],x:t[l],y:e[l]})}return u},kmeans:function(t,e,i,r){let a=[],o=[],n={},l=Number(r.processedDistance??(0,s.relativeLength)(r.distance||u.layoutAlgorithm.distance,this.chart.plotWidth)),h=r.iterations,p=0,d=!0,c=0,m=0,f,g=[];r.processedGridSize=l;let x=this.markerClusterAlgorithms?this.markerClusterAlgorithms.grid.call(this,t,e,i,r):{};for(let t in x)x[t].length>1&&(f=y(x[t]),a.push({posX:f.x,posY:f.y,oldX:0,oldY:0,startPointsLen:x[t].length,points:[]}));for(;d;){for(let t of a)t.points.length=0;o.length=0;for(let s=0;s<t.length;s++)c=t[s],m=e[s],(g=this.getClusterDistancesFromPoint(a,c,m)).length&&g[0].distance<l?a[g[0].clusterIndex].points.push({x:c,y:m,dataIndex:i[s]}):o.push({x:c,y:m,dataIndex:i[s]});for(let t=0;t<a.length;t++)1===a[t].points.length&&(g=this.getClusterDistancesFromPoint(a,a[t].points[0].x,a[t].points[0].y))[1].distance<l&&(a[g[1].clusterIndex].points.push(a[t].points[0]),a[g[0].clusterIndex].points.length=0);d=!1;for(let t=0;t<a.length;t++)f=y(a[t].points),a[t].oldX=a[t].posX,a[t].oldY=a[t].posY,a[t].posX=f.x,a[t].posY=f.y,(a[t].posX>a[t].oldX+1||a[t].posX<a[t].oldX-1||a[t].posY>a[t].oldY+1||a[t].posY<a[t].oldY-1)&&(d=!0);h&&(d=p<h-1),p++}for(let t=0,e=a.length;t<e;++t)n["cluster"+t]=a[t].points;for(let t=0,e=o.length;t<e;++t)n["noise"+t]=[o[t]];return n},optimizedKmeans:function(t,e,i,r){let a=Number(r.processedDistance??(0,s.relativeLength)(r.distance||u.layoutAlgorithm.gridSize,this.chart.plotWidth)),o=this.getRealExtremes(),n=(this.options.cluster||{}).marker,l,h={};if(!this.markerClusterInfo||this.initMaxX&&this.initMaxX<o.maxX||this.initMinX&&this.initMinX>o.minX||this.initMaxY&&this.initMaxY<o.maxY||this.initMinY&&this.initMinY>o.minY)this.initMaxX=o.maxX,this.initMinX=o.minX,this.initMaxY=o.maxY,this.initMinY=o.minY,h=this.markerClusterAlgorithms?this.markerClusterAlgorithms.kmeans.call(this,t,e,i,r):{},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=E(this,e),r=E(this,t);l=Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2));let o=t.clusterZone?.marker?.radius??n?.radius??u.marker.radius??0,h=a-o>=0?a-o:o;l>o+h&&(0,s.defined)(t.pointsOutside)?t.pointsOutside.push(e):(0,s.defined)(t.pointsInside)&&t.pointsInside.push(e)}t.pointsInside.length&&(h[t.id]=t.pointsInside);let e=0;for(let i of t.pointsOutside)h[t.id+"_noise"+e++]=[i]}for(let t of this.baseClusters.noise)h[t.id]=t.data}return h}},p,d=[],c=0;function m(t,e,i){t.attr({opacity:e}).animate({opacity:1},i)}function f(t,e,i,s){for(let r of(g(t,s,i,!0,!0),e))r.point?.destroy?.()}function g(t,e,i,s,r){t.point&&(s&&t.point.graphic&&(t.point.graphic.show(),m(t.point.graphic,e,i)),r&&t.point.dataLabel&&(t.point.dataLabel.show(),m(t.point.dataLabel,e,i)))}function y(t){let e=t.length,i=0,s=0;for(let r=0;r<e;r++)i+=t[r].x,s+=t[r].y;return{x:i/e,y:s/e}}function x(t,e){let i=[];return i.length=e,t.clusters.forEach(function(t){t.data.forEach(function(t){i[t.dataIndex]=t})}),t.noise.forEach(function(t){i[t.data[0].dataIndex]=t.data[0]}),i}function C(){return Math.random().toString(36).substring(2,7)+"-"+c++}function b(t,e,i){t.point&&(e&&t.point.graphic&&t.point.graphic.hide(),i&&t.point.dataLabel&&t.point.dataLabel.hide())}function k(t){(t.point||t.target).firePointEvent("drillToCluster",t,function(t){let e=t.point||t.target,i=e.series,{xAxis:s,yAxis:r,chart:a}=i,{inverted:o,mapView:n,pointer:l}=a;if(i.options.cluster?.drillToCluster&&e.clusteredData){let t=e.clusteredData.map(t=>t.x).sort((t,e)=>t-e),i=e.clusteredData.map(t=>t.y).sort((t,e)=>t-e),u=t[0],h=t[t.length-1],p=i[0],d=i[i.length-1],c=Math.abs((h-u)*.1),m=Math.abs((d-p)*.1),f=Math.min(u,h)-c,g=Math.max(u,h)+c,y=Math.min(p,d)-m,x=Math.max(p,d)+m;if(n)n.fitToBounds({x1:f,x2:g,y1:y,y2:x});else if(s&&r){let t=s.toPixels(f),e=s.toPixels(g),i=r.toPixels(y),n=r.toPixels(x);o&&([t,e,i,n]=[i,n,t,e]),t>e&&([t,e]=[e,t]),i>n&&([i,n]=[n,i]),l&&(l.zoomX=!0,l.zoomY=!0),a.transform({from:{x:t,y:i,width:e-t,height:n-i}})}}})}function I(t,e){let{chart:i,xAxis:s,yAxis:r}=t;return i.mapView?i.mapView.pixelsToProjectedUnits(e):{x:s?s.toValue(e.x):0,y:r?r.toValue(e.y):0}}function M(t){let e=this.chart,i=e.mapView,r=(0,s.animObject)(this.options.cluster?.animation),a=r.duration||500,o=this.markerClusterInfo?.pointsState,n=o?.newState,l=o?.oldState,u=[],h,p,d,c=0,m=0,y=0,x=!1,C=!1;if(l&&n){let o=E(this,p=n[t.stateId]);m=o.x-(i?0:e.plotLeft),y=o.y-(i?0:e.plotTop),1===p.parentsId.length?(h=l[n?.[t.stateId].parentsId[0]],p.point?.graphic&&h.point?.plotX&&h.point.plotY&&(h.point.plotX!==p.point.plotX||h.point.plotY!==p.point.plotY)&&(d=p.point.graphic.getBBox(),c=p.point.graphic?.isImg?0:d.width/2,p.point.graphic.attr({x:h.point.plotX-c,y:h.point.plotY-c}),p.point.graphic.animate({x:m-(p.point.graphic.radius||0),y:y-(p.point.graphic.radius||0)},r,function(){C=!0,h.point?.destroy?.()}),p.point.dataLabel?.alignAttr&&h.point.dataLabel?.alignAttr&&(p.point.dataLabel.attr({x:h.point.dataLabel.alignAttr.x,y:h.point.dataLabel.alignAttr.y}),p.point.dataLabel.animate({x:p.point.dataLabel.alignAttr.x,y:p.point.dataLabel.alignAttr.y},r)))):0===p.parentsId.length?(b(p,!0,!0),(0,s.syncTimeout)(function(){g(p,.1,r,!0,!0)},a/2)):(b(p,!0,!0),p.parentsId.forEach(function(t){l?.[t]&&(h=l[t],u.push(h),h.point?.graphic&&(x=!0,h.point.graphic.show(),h.point.graphic.animate({x:m-(h.point.graphic.radius||0),y:y-(h.point.graphic.radius||0),opacity:.4},r,function(){C=!0,f(p,u,r,.7)}),h.point.dataLabel&&-9999!==h.point.dataLabel.y&&p.point?.dataLabel?.alignAttr&&(h.point.dataLabel.show(),h.point.dataLabel.animate({x:p.point.dataLabel.alignAttr.x,y:p.point.dataLabel.alignAttr.y,opacity:.4},r))))}),(0,s.syncTimeout)(function(){C||f(p,u,r,.85)},a),x||(0,s.syncTimeout)(function(){f(p,u,r,.1)},a/2))}}function S(){this.markerClusterSeriesData?.forEach(t=>{t?.destroy?.()}),this.markerClusterSeriesData=null}function A(){let t,e,i,r,a,o,n,h,d,c,m,f,g,y,x,C=this,{chart:b}=C,M=b.mapView,S=C.getColumn("x"),A=C.getColumn("y"),w=C.options.cluster,L=C.getRealExtremes(),P=[],v=[],X=[];if(M&&C.is("mappoint")&&S&&A&&C.options.data?.forEach((t,e)=>{let i=C.projectPoint(t);i&&(S[e]=i.x,A[e]=i.y)}),w?.enabled&&S?.length&&A?.length&&!b.polar){m=w.layoutAlgorithm.type,(y=w.layoutAlgorithm).processedGridSize=(0,s.relativeLength)(y.gridSize||u.layoutAlgorithm.gridSize,b.plotWidth),y.processedDistance=(0,s.relativeLength)(y.distance||u.layoutAlgorithm.distance,b.plotWidth),r=y.kmeansThreshold||u.layoutAlgorithm.kmeansThreshold;let M=y.processedGridSize/2,O=I(C,{x:0,y:0}),z=I(C,{x:M,y:M});a=Math.abs(O.x-z.x),o=Math.abs(O.y-z.y);for(let t=0;t<S.length;t++)!C.dataMaxX&&((0,s.defined)(h)&&(0,s.defined)(n)&&(0,s.defined)(c)&&(0,s.defined)(d)?(0,s.isNumber)(A[t])&&(0,s.isNumber)(c)&&(0,s.isNumber)(d)&&(h=Math.max(S[t],h),n=Math.min(S[t],n),c=Math.max(A[t]||c,c),d=Math.min(A[t]||d,d)):(h=n=S[t],c=d=A[t])),S[t]>=L.minX-a&&S[t]<=L.maxX+a&&(A[t]||L.minY)>=L.minY-o&&(A[t]||L.maxY)<=L.maxY+o&&(P.push(S[t]),v.push(A[t]),X.push(t));if((0,s.defined)(h)&&(0,s.defined)(n)&&(0,s.isNumber)(c)&&(0,s.isNumber)(d)&&(C.dataMaxX=h,C.dataMinX=n,C.dataMaxY=c,C.dataMinY=d),f=(g=((0,s.isFunction)(m)?m:C.markerClusterAlgorithms?m&&C.markerClusterAlgorithms[m]?C.markerClusterAlgorithms[m]:P.length<r?C.markerClusterAlgorithms.kmeans:C.markerClusterAlgorithms.grid:()=>!1).call(this,P,v,X,y))?C.getClusteredData(g,w):g,w.animation&&C.markerClusterInfo?.pointsState?.oldState){var Y=C.markerClusterInfo.pointsState.oldState;for(let t of Object.keys(Y))Y[t].point?.destroy?.();t=C.markerClusterInfo.pointsState.newState}else t={};e=S.length,i=C.markerClusterInfo,f&&(C.dataTable.modified=new l({columns:{x:f.groupedXData,y:f.groupedYData}}),C.hasGroupedData=!0,C.markerClusterInfo=f,C.groupMap=f.groupMap),p.apply(this),f&&C.markerClusterInfo&&(C.markerClusterInfo.clusters?.forEach(t=>{(x=C.points[t.index]).isCluster=!0,x.clusteredData=t.data,x.clusterPointsAmount=t.data.length,t.point=x,(0,s.addEvent)(x,"click",k)}),C.markerClusterInfo.noise?.forEach(t=>{t.point=C.points[t.index]}),w.animation&&C.markerClusterInfo&&(C.markerClusterInfo.pointsState={oldState:t,newState:C.getPointsState(f,i,e)}),w.animation?this.hideClusteredData():this.destroyClusteredData(),this.markerClusterSeriesData=this.hasGroupedData?this.points:null)}else p.apply(this)}function w(t,e,i){let s=[];for(let r=0;r<t.length;r++){let a=E(this,{x:e,y:i}),o=E(this,{x:t[r].posX,y:t[r].posY}),n=Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2));s.push({clusterIndex:r,distance:n})}return s.sort((t,e)=>t.distance-e.distance)}function L(t,e){let i=this.options.data,r=[],a=[],o=[],n=[],l=[],h=Math.max(2,e.minimumClusterSize||2),p=0,d,c,m,f,g,x,b,k,I,M,S,A;if((0,s.isFunction)(e.layoutAlgorithm.type)&&!this.isValidGroupedDataObject(t))return(0,s.error)("Highcharts marker-clusters module: The custom algorithm result is not valid!",!1,this.chart),!1;for(let w in t)if(t[w].length>=h){if(m=t[w],d=C(),g=m.length,e.zones)for(let t=0;t<e.zones.length;t++)g>=e.zones[t].from&&g<=e.zones[t].to&&((S=e.zones[t]).zoneIndex=t,M=e.zones[t].marker,A=e.zones[t].className);I=y(m),"grid"!==e.layoutAlgorithm.type||e.allowOverlap?b={x:I.x,y:I.y}:(x=this.options.marker||{},b=this.preventClusterCollisions({x:I.x,y:I.y,key:w,groupedData:t,gridSize:this.getScaledGridSize(e.layoutAlgorithm),defaultRadius:x.radius||3+(x.lineWidth||0),clusterRadius:M?.radius??e.marker?.radius??u.marker.radius??0}));for(let t=0;t<g;t++)m[t].parentStateId=d;if(o.push({x:b.x,y:b.y,id:w,stateId:d,index:p,data:m,clusterZone:S,clusterZoneClassName:A}),r.push(b.x),a.push(b.y),l.push({options:{formatPrefix:"cluster",dataLabels:e.dataLabels,marker:(0,s.merge)(e.marker,{states:e.states},M||{})}}),i?.length)for(let t=0;t<g;t++)(0,s.isObject)(i[m[t].dataIndex])&&(m[t].options=i[m[t].dataIndex]);p++,M=null}else for(let e=0;e<t[w].length;e++)c=t[w][e],d=C(),k=null,f=i?.[c.dataIndex],r.push(c.x),a.push(c.y),c.parentStateId=d,n.push({x:c.x,y:c.y,id:w,stateId:d,index:p,data:t[w]}),k=f&&"object"==typeof f&&!(0,s.isArray)(f)?(0,s.merge)(f,{x:c.x,y:c.y}):{userOptions:f,x:c.x,y:c.y},l.push({options:k}),p++;return{clusters:o,noise:n,groupedXData:r,groupedYData:a,groupMap:l}}function P(){let{chart:t,xAxis:e,yAxis:i}=this,s=0;return{plotLeft:s=e&&this.dataMinX&&this.dataMaxX?e.reversed?e.toPixels(this.dataMaxX):e.toPixels(this.dataMinX):t.plotLeft,plotTop:i&&this.dataMinY&&this.dataMaxY?i.reversed?i.toPixels(this.dataMinY):i.toPixels(this.dataMaxY):t.plotTop}}function v(t,e,i){let s,r,a=e?x(e,i):[],o=x(t,i),n={};d=[],t.clusters.forEach(t=>{n[t.stateId]={x:t.x,y:t.y,id:t.stateId,point:t.point,parentsId:[]}}),t.noise.forEach(t=>{n[t.stateId]={x:t.x,y:t.y,id:t.stateId,point:t.point,parentsId:[]}});for(let t=0;t<o.length;t++)s=o[t],r=a[t],s?.parentStateId&&r?.parentStateId&&n[s.parentStateId]?.parentsId.indexOf(r.parentStateId)===-1&&(n[s.parentStateId].parentsId.push(r.parentStateId),-1===d.indexOf(r.parentStateId)&&d.push(r.parentStateId));return n}function X(){let t=this.chart,e=t.mapView?0:t.plotLeft,i=I(this,{x:e,y:t.mapView?0:t.plotTop}),s=I(this,{x:e+t.plotWidth,y:e+t.plotHeight}),r=i.x,a=s.x,o=i.y,n=s.y;return{minX:Math.min(r,a),maxX:Math.max(r,a),minY:Math.min(o,n),maxY:Math.max(o,n)}}function Y(t){let e=this.xAxis,i=this.chart.mapView,r=Number(t.processedGridSize??(0,s.relativeLength)(t.gridSize||u.layoutAlgorithm.gridSize,this.chart.plotWidth)),a=!0,o=1,n=1;this.gridValueSize||(i?this.gridValueSize=r/i.getScale():this.gridValueSize=Math.abs(e.toValue(r)-e.toValue(0)));let l=i?this.gridValueSize*i.getScale():e.toPixels(this.gridValueSize)-e.toPixels(0),h=0!==l?Math.abs(+(r/l).toFixed(14)):1;for(;a&&1!==h;){let t=Math.pow(2,o);h>.75&&h<1.25?a=!1:h>=1/t&&h<1/t*2?(a=!1,n=t):h<=t&&h>t/2&&(a=!1,n=1/t),o++}return r/n/h}function O(){let t=this.markerClusterSeriesData,e=this.markerClusterInfo?.pointsState?.oldState,i=d.map(t=>e?.[t].point?.id||"");t?.forEach(t=>{t&&-1!==i.indexOf(t.id)?(t.graphic&&t.graphic.hide(),t.dataLabel&&t.dataLabel.hide()):t?.destroy?.()})}function z(t){let e=!1;return!!(0,s.isObject)(t)&&((0,s.objectEach)(t,t=>{if(e=!0,!(0,s.isArray)(t)||!t.length){e=!1;return}for(let i=0;i<t.length;i++)if(!(0,s.isObject)(t[i])||!t[i].x||!t[i].y){e=!1;return}}),e)}function D(t){let[e,i]=t.key.split(":").map(parseFloat),r=t.gridSize,a=t.groupedData,o=t.defaultRadius,n=t.clusterRadius,l=i*r,h=e*r,p=E(this,t),d=[],c=this.options.cluster?.marker,m=this.options.cluster?.zones,f=this.getGridOffset(),g=p.x,x=p.y,C=0,b=0,k,M,S,A,w,L,P,v,X,Y,O,z;g-=f.plotLeft,x-=f.plotTop;for(let s=1;s<5;s++)for(P=0,S=s%2?-1:1,A=s<3?-1:1,w=Math.floor((g+S*n)/r),z=[(L=Math.floor((x+A*n)/r))+":"+w,L+":"+i,e+":"+w];P<z.length;P++)-1===d.indexOf(z[P])&&z[P]!==t.key&&d.push(z[P]);for(let t of d)if(a[t]){a[t].posX||(Y=y(a[t]),a[t].posX=Y.x,a[t].posY=Y.y);let p=E(this,{x:a[t].posX||0,y:a[t].posY||0});if(k=p.x-f.plotLeft,M=p.y-f.plotTop,[X,v]=t.split(":").map(parseFloat),m){C=a[t].length;for(let t=0;t<m.length;t++)C>=m[t].from&&C<=m[t].to&&(b=(0,s.defined)(m[t].marker?.radius)?m[t].marker.radius||0:c?.radius?c.radius:u.marker.radius??0)}a[t].length>1&&0===b&&c?.radius?b=c.radius:1===a[t].length&&(b=o),O=n+b,b=0,v!==i&&Math.abs(g-k)<O&&(g=v-i<0?l+n:l+r-n),X!==e&&Math.abs(x-M)<O&&(x=X-e<0?h+n:h+r-n)}let D=I(this,{x:g+f.plotLeft,y:x+f.plotTop});return a[t.key].posX=D.x,a[t.key].posY=D.y,D}function E(t,e){let{chart:i,xAxis:s,yAxis:r}=t;return i.mapView?i.mapView.projectedUnitsToPixels(e):{x:s?s.toPixels(e.x):0,y:r?r.toPixels(e.y):0}}let T=function(t,e){let i=e.prototype;!i.markerClusterAlgorithms&&(p=i.generatePoints,i.markerClusterAlgorithms=h,i.animateClusterPoint=M,i.destroyClusteredData=S,i.generatePoints=A,i.getClusterDistancesFromPoint=w,i.getClusteredData=L,i.getGridOffset=P,i.getPointsState=v,i.getRealExtremes=X,i.getScaledGridSize=Y,i.hideClusteredData=O,i.isValidGroupedDataObject=z,i.preventClusterCollisions=D,(0,s.addEvent)(e,"destroy",i.destroyClusteredData),t.plotOptions&&(t.plotOptions.series=(0,s.merge)(t.plotOptions.series,a)))},{defaultOptions:j}=r(),{composed:R}=r();function V(){let t=this.chart,e=0;for(let i of t.series)if(i.markerClusterInfo){let t=i.options.cluster;e=(0,s.animObject)((t||{}).animation).duration||0}(0,s.syncTimeout)(()=>{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||{}).oldState;if((e||{}).animation&&t.markerClusterInfo&&0===(t.chart.pointer?.pinchDown||[]).length&&"pan"!==((t.xAxis||{}).eventArgs||{}).trigger&&i&&Object.keys(i).length){for(let e of t.markerClusterInfo.clusters)t.animateClusterPoint(e);for(let e of t.markerClusterInfo.noise)t.animateClusterPoint(e)}}}function N(t){let e=(((t.point||t.target).series.options.cluster||{}).events||{}).drillToCluster;(0,s.isFunction)(e)&&e.call(this,t)}function F(){if(this.dataGroup)return(0,s.error)("Highcharts marker-clusters module: Running `Point.update` when point belongs to clustered series is not supported.",!1,this.series.chart),!1}function q(){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"})),(0,s.defined)(e.clusterZone)&&e.point.graphic.addClass(e.clusterZoneClassName||"highcharts-cluster-zone-"+e.clusterZone.zoneIndex))}function W(e,i,s,r){let a=s/2,o=r/2,n=t.arc(e+a,i+o,a-4,o-4,{start:.5*Math.PI,end:2.5*Math.PI,open:!1}),l=t.arc(e+a,i+o,a-3,o-3,{start:.5*Math.PI,end:2.5*Math.PI,innerR:a-2,open:!1});return t.arc(e+a,i+o,a-1,o-1,{start:.5*Math.PI,end:2.5*Math.PI,innerR:a,open:!1}).concat(l,n)}(j.plotOptions||{}).series=(0,s.merge)((j.plotOptions||{}).series,a);let K=r();({compose:function(t,e,i,r){if((0,s.pushUnique)(R,"MarkerClusters")){let a=r.prototype.pointClass,{scatter:o}=r.types;(0,s.addEvent)(t,"setExtremes",V),(0,s.addEvent)(e,"render",G),(0,s.addEvent)(a,"drillToCluster",N),(0,s.addEvent)(a,"update",F),(0,s.addEvent)(r,"afterRender",q),o&&T(i,o)}}}).compose(K.Axis,K.Chart,K.defaultOptions,K.Series),({compose:function(e){(t=e.prototype.symbols).cluster=W}}).compose(K.SVGRenderer);let _=r();export{_ as default};