UNPKG

highcharts

Version:
13 lines 22.4 kB
!/** * Highcharts JS v12.6.0 (2026-04-13) * @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 */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts):"function"==typeof define&&define.amd?define("highcharts/modules/marker-clusters",["highcharts/highcharts"],function(t){return e(t)}):"object"==typeof exports?exports["highcharts/modules/marker-clusters"]=e(t._Highcharts):t.Highcharts=e(t.Highcharts)}("u"<typeof window?this:window,t=>(()=>{"use strict";let e;var i={944:e=>{e.exports=t}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var s=r[t]={exports:{}};return i[t](s,s.exports,o),s.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var s={};o.d(s,{default:()=>td});var n=o(944),a=o.n(n);let l={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:"<span>Clustered points: {point.clusterPointsAmount}</span><br/>"}},{doc:u,win:p}=a();function h(t,e,i,r={}){let o="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(o,"hcEvents")||(o.hcEvents={});let s=o.hcEvents;a().Point&&t instanceof a().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let n=t.addEventListener;n&&n.call(t,e,i,!!a().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==e.indexOf("touch"):r.passive,capture:!1}),s[e]||(s[e]=[]);let l={fn:i,order:"number"==typeof r.order?r.order:1/0};return s[e].push(l),s[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,i){function r(e,i){let r=t.removeEventListener;r&&r.call(t,e,i,!1)}function o(i){let o,s;t.nodeName&&(e?(o={})[e]=!0:o=i,k(o,function(t,e){if(i[e])for(s=i[e].length;s--;)r(e,i[e][s].fn)}))}let s="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(s,"hcEvents")){let t=s.hcEvents;if(e){let s=t[e]||[];i?(t[e]=s.filter(function(t){return i!==t.fn}),r(e,i)):(o(t),t[e]=[])}else o(t),delete s.hcEvents}}(t,e,i)}}function d(t){return null!=t}function c(t,e){let i;for(i in t||(t={}),e)t[i]=e[i];return t}function f(t,e,i,r){if(i=i||{},u?.createEvent&&(t.dispatchEvent||t.fireEvent&&t!==a())){let r=u.createEvent("Events");r.initEvent(e,!0,!0),i=c(r,i),t.dispatchEvent?t.dispatchEvent(i):t.fireEvent(e,i)}else if(t.hcEvents){i.target||c(i,{preventDefault:function(){i.defaultPrevented=!0},target:t,type:e});let r=[],o=t,s=!1;for(;o.hcEvents;)Object.hasOwnProperty.call(o,"hcEvents")&&o.hcEvents[e]&&(r.length&&(s=!0),r.unshift.apply(r,o.hcEvents[e])),o=Object.getPrototypeOf(o);s&&r.sort((t,e)=>t.order-e.order),r.forEach(e=>{!1===e.fn.call(t,i,t)&&i.preventDefault()})}r&&!i.defaultPrevented&&r.call(t,i)}function m(t){return C(t)&&"number"==typeof t.nodeType}function g(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function y(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function x(t){return"function"==typeof t}function C(t,e){return!!t&&"object"==typeof t&&(!e||!y(t))}function b(t,...e){let i,r=[t,...e],o={},s=function(t,e){return"object"!=typeof t&&(t={}),k(e,function(i,r){if("__proto__"!==r&&"constructor"!==r){let o;!C(i,!0)||(o=i?.constructor,C(i,!0)&&!m(i)&&o?.name&&"Object"!==o.name)||m(i)?t[r]=e[r]:t[r]=s(t[r]||{},i)}}),t};!0===t&&(o=r[1],r=Array.prototype.slice.call(r,2));let n=r.length;for(i=0;i<n;i++)o=s(o,r[i]);return o}function k(t,e,i){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call(i||t[r],t[r],r,t)}function I(t,e,i){return/%$/.test(t)?e*parseFloat(t)/100+(i||0):parseFloat(t)}function M(t,e,i){return e>0?setTimeout(t,e,i):(t.call(0,i),-1)}Array.prototype.find;let{setLength:S,splice:v}={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,r,o=[]){if(Array.isArray(t))return Array.isArray(o)||(o=Array.from(o)),{removed:t.splice(e,i,...o),array:t};let s=Object.getPrototypeOf(t).constructor,n=t[r?"subarray":"slice"](e,e+i),a=new s(t.length-i+o.length);return a.set(t.subarray(0,e),0),a.set(o,e),a.set(t.subarray(e+i),e+o.length),{removed:n,array:a}}},w=class{constructor(t={}){this.autoId=!t.id,this.columns={},this.id=t.id||(0,n.uniqueKey)(),this.rowCount=0,this.versionTag=(0,n.uniqueKey)();let e=0;k(t.columns||{},(t,i)=>{this.columns[i]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,k(this.columns,(e,i)=>{e.length!==t&&(this.columns[i]=S(e,t))})}deleteRows(t,e=1){if(e>0&&t<this.rowCount){let i=0;k(this.columns,(r,o)=>{this.columns[o]=v(r,t,e).array,i=r.length}),this.rowCount=i}f(this,"afterDeleteRows",{rowIndex:t,rowCount:e}),this.versionTag=(0,n.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),{})}getRow(t,e){return(e||Object.keys(this.columns)).map(e=>this.columns[e]?.[t])}setColumn(t,e=[],i=0,r){this.setColumns({[t]:e},i,r)}setColumns(t,e,i){let r=this.rowCount;k(t,(t,e)=>{this.columns[e]=t.slice(),r=t.length}),this.applyRowCount(r),i?.silent||(f(this,"afterSetColumns"),this.versionTag=(0,n.uniqueKey)())}setRow(t,e=this.rowCount,i,r){let{columns:o}=this,s=i?this.rowCount+1:e+1,a=Object.keys(t);if(r?.addColumns!==!1)for(let t=0,e=a.length;t<e;t++){let e=a[t];o[e]||(o[e]=[])}k(o,(n,a)=>{n||r?.addColumns===!1||(n=Array(s)),n&&(i?n=v(n,e,0,!0,[t[a]??null]).array:n[e]=t[a]??null,o[a]=n)}),s>this.rowCount&&this.applyRowCount(s),r?.silent||(f(this,"afterSetRows"),this.versionTag=(0,n.uniqueKey)())}getModified(){return this.modified||this}},{animObject:A}=a(),{cluster:P}=l,O={grid:function(t,e,i,r){let o,s,n,a,l,u={},p=this.getGridOffset(),h=this.getScaledGridSize(r);for(l=0;l<t.length;l++){let r=tt(this,{x:t[l],y:e[l]});o=r.x-p.plotLeft,s=r.y-p.plotTop,n=Math.floor(o/h),u[a=Math.floor(s/h)+":"+n]??(u[a]=[]),u[a].push({dataIndex:i[l],x:t[l],y:e[l]})}return u},kmeans:function(t,e,i,r){let o=[],s=[],n={},a=Number(r.processedDistance??I(r.distance||P.layoutAlgorithm.distance,this.chart.plotWidth)),l=r.iterations,u=0,p=!0,h=0,d=0,c,f=[];r.processedGridSize=a;let m=this.markerClusterAlgorithms?this.markerClusterAlgorithms.grid.call(this,t,e,i,r):{};for(let t in m)m[t].length>1&&(c=T(m[t]),o.push({posX:c.x,posY:c.y,oldX:0,oldY:0,startPointsLen:m[t].length,points:[]}));for(;p;){for(let t of o)t.points.length=0;s.length=0;for(let r=0;r<t.length;r++)h=t[r],d=e[r],(f=this.getClusterDistancesFromPoint(o,h,d)).length&&f[0].distance<a?o[f[0].clusterIndex].points.push({x:h,y:d,dataIndex:i[r]}):s.push({x:h,y:d,dataIndex:i[r]});for(let t=0;t<o.length;t++)1===o[t].points.length&&(f=this.getClusterDistancesFromPoint(o,o[t].points[0].x,o[t].points[0].y))[1].distance<a&&(o[f[1].clusterIndex].points.push(o[t].points[0]),o[f[0].clusterIndex].points.length=0);p=!1;for(let t=0;t<o.length;t++)c=T(o[t].points),o[t].oldX=o[t].posX,o[t].oldY=o[t].posY,o[t].posX=c.x,o[t].posY=c.y,(o[t].posX>o[t].oldX+1||o[t].posX<o[t].oldX-1||o[t].posY>o[t].oldY+1||o[t].posY<o[t].oldY-1)&&(p=!0);l&&(p=u<l-1),u++}for(let t=0,e=o.length;t<e;++t)n["cluster"+t]=o[t].points;for(let t=0,e=s.length;t<e;++t)n["noise"+t]=[s[t]];return n},optimizedKmeans:function(t,e,i,r){let o=Number(r.processedDistance??I(r.distance||P.layoutAlgorithm.gridSize,this.chart.plotWidth)),s=this.getRealExtremes(),n=(this.options.cluster||{}).marker,a,l={};if(!this.markerClusterInfo||this.initMaxX&&this.initMaxX<s.maxX||this.initMinX&&this.initMinX>s.minX||this.initMaxY&&this.initMaxY<s.maxY||this.initMinY&&this.initMinY>s.minY)this.initMaxX=s.maxX,this.initMinX=s.minX,this.initMaxY=s.maxY,this.initMinY=s.minY,l=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=tt(this,e),r=tt(this,t);a=Math.sqrt(Math.pow(i.x-r.x,2)+Math.pow(i.y-r.y,2));let s=t.clusterZone?.marker?.radius??n?.radius??P.marker.radius??0,l=o-s>=0?o-s:s;a>s+l&&d(t.pointsOutside)?t.pointsOutside.push(e):d(t.pointsInside)&&t.pointsInside.push(e)}t.pointsInside.length&&(l[t.id]=t.pointsInside);let e=0;for(let i of t.pointsOutside)l[t.id+"_noise"+e++]=[i]}for(let t of this.baseClusters.noise)l[t.id]=t.data}return l}},X,Y=[],E=0;function L(t,e,i){t.attr({opacity:e}).animate({opacity:1},i)}function z(t,e,i,r){for(let o of(D(t,r,i,!0,!0),e))o.point?.destroy?.()}function D(t,e,i,r,o){t.point&&(r&&t.point.graphic&&(t.point.graphic.show(),L(t.point.graphic,e,i)),o&&t.point.dataLabel&&(t.point.dataLabel.show(),L(t.point.dataLabel,e,i)))}function T(t){let e=t.length,i=0,r=0;for(let o=0;o<e;o++)i+=t[o].x,r+=t[o].y;return{x:i/e,y:r/e}}function j(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 R(){return Math.random().toString(36).substring(2,7)+"-"+E++}function V(t,e,i){t.point&&(e&&t.point.graphic&&t.point.graphic.hide(),i&&t.point.dataLabel&&t.point.dataLabel.hide())}function G(t){(t.point||t.target).firePointEvent("drillToCluster",t,function(t){let e=t.point||t.target,i=e.series,{xAxis:r,yAxis:o,chart:s}=i,{inverted:n,mapView:a,pointer:l}=s;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],p=t[t.length-1],h=i[0],d=i[i.length-1],c=Math.abs((p-u)*.1),f=Math.abs((d-h)*.1),m=Math.min(u,p)-c,g=Math.max(u,p)+c,y=Math.min(h,d)-f,x=Math.max(h,d)+f;if(a)a.fitToBounds({x1:m,x2:g,y1:y,y2:x});else if(r&&o){let t=r.toPixels(m),e=r.toPixels(g),i=o.toPixels(y),a=o.toPixels(x);n&&([t,e,i,a]=[i,a,t,e]),t>e&&([t,e]=[e,t]),i>a&&([i,a]=[a,i]),l&&(l.zoomX=!0,l.zoomY=!0),s.transform({from:{x:t,y:i,width:e-t,height:a-i}})}}})}function N(t,e){let{chart:i,xAxis:r,yAxis:o}=t;return i.mapView?i.mapView.pixelsToProjectedUnits(e):{x:r?r.toValue(e.x):0,y:o?o.toValue(e.y):0}}function F(t){let e=this.chart,i=e.mapView,r=A(this.options.cluster?.animation),o=r.duration||500,s=this.markerClusterInfo?.pointsState,n=s?.newState,a=s?.oldState,l=[],u,p,h,d=0,c=0,f=0,m=!1,g=!1;if(a&&n){let s=tt(this,p=n[t.stateId]);c=s.x-(i?0:e.plotLeft),f=s.y-(i?0:e.plotTop),1===p.parentsId.length?(u=a[n?.[t.stateId].parentsId[0]],p.point?.graphic&&u.point?.plotX&&u.point.plotY&&(u.point.plotX!==p.point.plotX||u.point.plotY!==p.point.plotY)&&(h=p.point.graphic.getBBox(),d=p.point.graphic?.isImg?0:h.width/2,p.point.graphic.attr({x:u.point.plotX-d,y:u.point.plotY-d}),p.point.graphic.animate({x:c-(p.point.graphic.radius||0),y:f-(p.point.graphic.radius||0)},r,function(){g=!0,u.point?.destroy?.()}),p.point.dataLabel?.alignAttr&&u.point.dataLabel?.alignAttr&&(p.point.dataLabel.attr({x:u.point.dataLabel.alignAttr.x,y:u.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?(V(p,!0,!0),M(function(){D(p,.1,r,!0,!0)},o/2)):(V(p,!0,!0),p.parentsId.forEach(function(t){a?.[t]&&(u=a[t],l.push(u),u.point?.graphic&&(m=!0,u.point.graphic.show(),u.point.graphic.animate({x:c-(u.point.graphic.radius||0),y:f-(u.point.graphic.radius||0),opacity:.4},r,function(){g=!0,z(p,l,r,.7)}),u.point.dataLabel&&-9999!==u.point.dataLabel.y&&p.point?.dataLabel?.alignAttr&&(u.point.dataLabel.show(),u.point.dataLabel.animate({x:p.point.dataLabel.alignAttr.x,y:p.point.dataLabel.alignAttr.y,opacity:.4},r))))}),M(function(){g||z(p,l,r,.85)},o),m||M(function(){z(p,l,r,.1)},o/2))}}function _(){this.markerClusterSeriesData?.forEach(t=>{t?.destroy?.()}),this.markerClusterSeriesData=null}function W(){let t,e,i,r,o,s,n,a,l,u,p,c,f,m,y,C=this,{chart:b}=C,k=b.mapView,M=C.getColumn("x"),S=C.getColumn("y"),v=C.options.cluster,A=C.getRealExtremes(),O=[],Y=[],E=[];if(k&&C.is("mappoint")&&M&&S&&C.options.data?.forEach((t,e)=>{let i=C.projectPoint(t);i&&(M[e]=i.x,S[e]=i.y)}),v?.enabled&&M?.length&&S?.length&&!b.polar){p=v.layoutAlgorithm.type,(m=v.layoutAlgorithm).processedGridSize=I(m.gridSize||P.layoutAlgorithm.gridSize,b.plotWidth),m.processedDistance=I(m.distance||P.layoutAlgorithm.distance,b.plotWidth),r=m.kmeansThreshold||P.layoutAlgorithm.kmeansThreshold;let k=m.processedGridSize/2,z=N(C,{x:0,y:0}),D=N(C,{x:k,y:k});o=Math.abs(z.x-D.x),s=Math.abs(z.y-D.y);for(let t=0;t<M.length;t++)!C.dataMaxX&&(d(a)&&d(n)&&d(u)&&d(l)?g(S[t])&&g(u)&&g(l)&&(a=Math.max(M[t],a),n=Math.min(M[t],n),u=Math.max(S[t]||u,u),l=Math.min(S[t]||l,l)):(a=n=M[t],u=l=S[t])),M[t]>=A.minX-o&&M[t]<=A.maxX+o&&(S[t]||A.minY)>=A.minY-s&&(S[t]||A.maxY)<=A.maxY+s&&(O.push(M[t]),Y.push(S[t]),E.push(t));if(d(a)&&d(n)&&g(u)&&g(l)&&(C.dataMaxX=a,C.dataMinX=n,C.dataMaxY=u,C.dataMinY=l),c=(f=(x(p)?p:C.markerClusterAlgorithms?p&&C.markerClusterAlgorithms[p]?C.markerClusterAlgorithms[p]:O.length<r?C.markerClusterAlgorithms.kmeans:C.markerClusterAlgorithms.grid:()=>!1).call(this,O,Y,E,m))?C.getClusteredData(f,v):f,v.animation&&C.markerClusterInfo?.pointsState?.oldState){var L=C.markerClusterInfo.pointsState.oldState;for(let t of Object.keys(L))L[t].point?.destroy?.();t=C.markerClusterInfo.pointsState.newState}else t={};e=M.length,i=C.markerClusterInfo,c&&(C.dataTable.modified=new w({columns:{x:c.groupedXData,y:c.groupedYData}}),C.hasGroupedData=!0,C.markerClusterInfo=c,C.groupMap=c.groupMap),X.apply(this),c&&C.markerClusterInfo&&(C.markerClusterInfo.clusters?.forEach(t=>{(y=C.points[t.index]).isCluster=!0,y.clusteredData=t.data,y.clusterPointsAmount=t.data.length,t.point=y,h(y,"click",G)}),C.markerClusterInfo.noise?.forEach(t=>{t.point=C.points[t.index]}),v.animation&&C.markerClusterInfo&&(C.markerClusterInfo.pointsState={oldState:t,newState:C.getPointsState(c,i,e)}),v.animation?this.hideClusteredData():this.destroyClusteredData(),this.markerClusterSeriesData=this.hasGroupedData?this.points:null)}else X.apply(this)}function q(t,e,i){let r=[];for(let o=0;o<t.length;o++){let s=tt(this,{x:e,y:i}),n=tt(this,{x:t[o].posX,y:t[o].posY}),a=Math.sqrt(Math.pow(s.x-n.x,2)+Math.pow(s.y-n.y,2));r.push({clusterIndex:o,distance:a})}return r.sort((t,e)=>t.distance-e.distance)}function H(t,e){let i=this.options.data,r=[],o=[],s=[],a=[],l=[],u=Math.max(2,e.minimumClusterSize||2),p=0,h,d,c,f,m,g,k,I,M,S,v,w;if(x(e.layoutAlgorithm.type)&&!this.isValidGroupedDataObject(t))return(0,n.error)("Highcharts marker-clusters module: The custom algorithm result is not valid!",!1,this.chart),!1;for(let n in t)if(t[n].length>=u){if(c=t[n],h=R(),m=c.length,e.zones)for(let t=0;t<e.zones.length;t++)m>=e.zones[t].from&&m<=e.zones[t].to&&((v=e.zones[t]).zoneIndex=t,S=e.zones[t].marker,w=e.zones[t].className);M=T(c),"grid"!==e.layoutAlgorithm.type||e.allowOverlap?k={x:M.x,y:M.y}:(g=this.options.marker||{},k=this.preventClusterCollisions({x:M.x,y:M.y,key:n,groupedData:t,gridSize:this.getScaledGridSize(e.layoutAlgorithm),defaultRadius:g.radius||3+(g.lineWidth||0),clusterRadius:S?.radius??e.marker?.radius??P.marker.radius??0}));for(let t=0;t<m;t++)c[t].parentStateId=h;if(s.push({x:k.x,y:k.y,id:n,stateId:h,index:p,data:c,clusterZone:v,clusterZoneClassName:w}),r.push(k.x),o.push(k.y),l.push({options:{formatPrefix:"cluster",dataLabels:e.dataLabels,marker:b(e.marker,{states:e.states},S||{})}}),i?.length)for(let t=0;t<m;t++)C(i[c[t].dataIndex])&&(c[t].options=i[c[t].dataIndex]);p++,S=null}else for(let e=0;e<t[n].length;e++)d=t[n][e],h=R(),I=null,f=i?.[d.dataIndex],r.push(d.x),o.push(d.y),d.parentStateId=h,a.push({x:d.x,y:d.y,id:n,stateId:h,index:p,data:t[n]}),I=f&&"object"==typeof f&&!y(f)?b(f,{x:d.x,y:d.y}):{userOptions:f,x:d.x,y:d.y},l.push({options:I}),p++;return{clusters:s,noise:a,groupedXData:r,groupedYData:o,groupMap:l}}function K(){let{chart:t,xAxis:e,yAxis:i}=this,r=0;return{plotLeft:r=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 Z(t,e,i){let r,o,s=e?j(e,i):[],n=j(t,i),a={};Y=[],t.clusters.forEach(t=>{a[t.stateId]={x:t.x,y:t.y,id:t.stateId,point:t.point,parentsId:[]}}),t.noise.forEach(t=>{a[t.stateId]={x:t.x,y:t.y,id:t.stateId,point:t.point,parentsId:[]}});for(let t=0;t<n.length;t++)r=n[t],o=s[t],r?.parentStateId&&o?.parentStateId&&a[r.parentStateId]?.parentsId.indexOf(o.parentStateId)===-1&&(a[r.parentStateId].parentsId.push(o.parentStateId),-1===Y.indexOf(o.parentStateId)&&Y.push(o.parentStateId));return a}function B(){let t=this.chart,e=t.mapView?0:t.plotLeft,i=N(this,{x:e,y:t.mapView?0:t.plotTop}),r=N(this,{x:e+t.plotWidth,y:e+t.plotHeight}),o=i.x,s=r.x,n=i.y,a=r.y;return{minX:Math.min(o,s),maxX:Math.max(o,s),minY:Math.min(n,a),maxY:Math.max(n,a)}}function U(t){let e=this.xAxis,i=this.chart.mapView,r=Number(t.processedGridSize??I(t.gridSize||P.layoutAlgorithm.gridSize,this.chart.plotWidth)),o=!0,s=1,n=1;this.gridValueSize||(i?this.gridValueSize=r/i.getScale():this.gridValueSize=Math.abs(e.toValue(r)-e.toValue(0)));let a=+(r/(i?this.gridValueSize*i.getScale():e.toPixels(this.gridValueSize)-e.toPixels(0))).toFixed(14);for(;o&&1!==a;){let t=Math.pow(2,s);a>.75&&a<1.25?o=!1:a>=1/t&&a<1/t*2?(o=!1,n=t):a<=t&&a>t/2&&(o=!1,n=1/t),s++}return r/n/a}function $(){let t=this.markerClusterSeriesData,e=this.markerClusterInfo?.pointsState?.oldState,i=Y.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 J(t){let e=!1;return!!C(t)&&(k(t,t=>{if(e=!0,!y(t)||!t.length){e=!1;return}for(let i=0;i<t.length;i++)if(!C(t[i])||!t[i].x||!t[i].y){e=!1;return}}),e)}function Q(t){let[e,i]=t.key.split(":").map(parseFloat),r=t.gridSize,o=t.groupedData,s=t.defaultRadius,n=t.clusterRadius,a=i*r,l=e*r,u=tt(this,t),p=[],h=this.options.cluster?.marker,c=this.options.cluster?.zones,f=this.getGridOffset(),m=u.x,g=u.y,y=0,x=0,C,b,k,I,M,S,v,w,A,O,X,Y;m-=f.plotLeft,g-=f.plotTop;for(let o=1;o<5;o++)for(v=0,k=o%2?-1:1,I=o<3?-1:1,M=Math.floor((m+k*n)/r),Y=[(S=Math.floor((g+I*n)/r))+":"+M,S+":"+i,e+":"+M];v<Y.length;v++)-1===p.indexOf(Y[v])&&Y[v]!==t.key&&p.push(Y[v]);for(let t of p)if(o[t]){o[t].posX||(O=T(o[t]),o[t].posX=O.x,o[t].posY=O.y);let u=tt(this,{x:o[t].posX||0,y:o[t].posY||0});if(C=u.x-f.plotLeft,b=u.y-f.plotTop,[A,w]=t.split(":").map(parseFloat),c){y=o[t].length;for(let t=0;t<c.length;t++)y>=c[t].from&&y<=c[t].to&&(x=d(c[t].marker?.radius)?c[t].marker.radius||0:h?.radius?h.radius:P.marker.radius??0)}o[t].length>1&&0===x&&h?.radius?x=h.radius:1===o[t].length&&(x=s),X=n+x,x=0,w!==i&&Math.abs(m-C)<X&&(m=w-i<0?a+n:a+r-n),A!==e&&Math.abs(g-b)<X&&(g=A-e<0?l+n:l+r-n)}let E=N(this,{x:m+f.plotLeft,y:g+f.plotTop});return o[t.key].posX=E.x,o[t.key].posY=E.y,E}function tt(t,e){let{chart:i,xAxis:r,yAxis:o}=t;return i.mapView?i.mapView.projectedUnitsToPixels(e):{x:r?r.toPixels(e.x):0,y:o?o.toPixels(e.y):0}}let te=function(t,e){let i=e.prototype;!i.markerClusterAlgorithms&&(X=i.generatePoints,i.markerClusterAlgorithms=O,i.animateClusterPoint=F,i.destroyClusteredData=_,i.generatePoints=W,i.getClusterDistancesFromPoint=q,i.getClusteredData=H,i.getGridOffset=K,i.getPointsState=Z,i.getRealExtremes=B,i.getScaledGridSize=U,i.hideClusteredData=$,i.isValidGroupedDataObject=J,i.preventClusterCollisions=Q,h(e,"destroy",i.destroyClusteredData),t.plotOptions&&(t.plotOptions.series=b(t.plotOptions.series,l)))},{animObject:ti}=a(),{defaultOptions:tr}=a(),{composed:to}=a();function ts(){let t=this.chart,e=0;for(let i of t.series)i.markerClusterInfo&&(e=ti((i.options.cluster||{}).animation).duration||0);M(()=>{t.tooltip&&t.tooltip.destroy()},e)}function tn(){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 ta(t){let e=(((t.point||t.target).series.options.cluster||{}).events||{}).drillToCluster;x(e)&&e.call(this,t)}function tl(){if(this.dataGroup)return(0,n.error)("Highcharts marker-clusters module: Running `Point.update` when point belongs to clustered series is not supported.",!1,this.series.chart),!1}function tu(){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"})),d(e.clusterZone)&&e.point.graphic.addClass(e.clusterZoneClassName||"highcharts-cluster-zone-"+e.clusterZone.zoneIndex))}function tp(t,i,r,o){let s=r/2,n=o/2,a=e.arc(t+s,i+n,s-4,n-4,{start:.5*Math.PI,end:2.5*Math.PI,open:!1}),l=e.arc(t+s,i+n,s-3,n-3,{start:.5*Math.PI,end:2.5*Math.PI,innerR:s-2,open:!1});return e.arc(t+s,i+n,s-1,n-1,{start:.5*Math.PI,end:2.5*Math.PI,innerR:s,open:!1}).concat(l,a)}(tr.plotOptions||{}).series=b((tr.plotOptions||{}).series,l);let th=a();({compose:function(t,e,i,r){var o;if(o="MarkerClusters",0>to.indexOf(o)&&to.push(o)){let o=r.prototype.pointClass,{scatter:s}=r.types;h(t,"setExtremes",ts),h(e,"render",tn),h(o,"drillToCluster",ta),h(o,"update",tl),h(r,"afterRender",tu),s&&te(i,s)}}}).compose(th.Axis,th.Chart,th.defaultOptions,th.Series),({compose:function(t){(e=t.prototype.symbols).cluster=tp}}).compose(th.SVGRenderer);let td=a();return s.default})());