/**
 * Highmaps JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/tilemap
 * @requires highcharts
 * @requires highcharts/modules/map
 *
 * Tilemap module
 *
 * (c) 2010-2026 Highsoft AS
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,a={};a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var s=a.n(i);let o=t.default.SeriesRegistry;var l=a.n(o);let n=t.default.Color,{parse:r}=a.n(n)();!function(t){let e;function a(){let{userOptions:t}=this;this.colorAxis=[],t.colorAxis&&(t.colorAxis=(0,i.splat)(t.colorAxis),t.colorAxis.map(t=>new e(this,t)))}function s(t){let e=this.chart.colorAxis||[],a=e=>{let a=t.allItems.indexOf(e);-1!==a&&(this.destroyItem(t.allItems[a]),t.allItems.splice(a,1))},i=[],s,o;for(e.forEach(function(t){s=t.options,s?.showInLegend&&(s.dataClasses&&s.visible?i=i.concat(t.getDataClassLegendSymbols()):s.visible&&i.push(t),t.series.forEach(function(t){(!t.options.showInLegend||s.dataClasses)&&("point"===t.options.legendType?t.points.forEach(function(t){a(t)}):a(t))}))}),o=i.length;o--;)t.allItems.unshift(i[o])}function o(t){t.visible&&t.item.legendColor&&t.item.legendItem.symbol.attr({fill:t.item.legendColor})}function l(t){this.chart.colorAxis?.forEach(e=>{e.update({},t.redraw)})}function n(){(this.chart.colorAxis?.length||this.colorAttribs)&&this.translateColors()}function p(){let t=this.axisTypes;t?-1===t.indexOf("colorAxis")&&t.push("colorAxis"):this.axisTypes=["colorAxis"]}function h(t){let e=this,a=t?"show":"hide";e.visible=e.options.visible=!!t,["graphic","dataLabel"].forEach(function(t){e[t]&&e[t][a]()}),this.series.buildKDTree()}function d(){let t=this,e=this.getPointsCollection(),a=this.options.nullColor,i=this.colorAxis,s=this.colorKey;e.forEach(e=>{let o=e.getNestedProperty(s),l=e.options.color||(e.isNull||null===e.value?a:i&&void 0!==o?i.toColor(o,e):e.color||t.color);l&&e.color!==l&&(e.color=l,"point"===t.options.legendType&&e.legendItem&&e.legendItem.label&&t.chart.legend.colorizeItem(e,e.visible))})}function c(){this.elem.attr("fill",r(this.start).tweenTo(r(this.end),this.pos),void 0,!0)}function u(){this.elem.attr("stroke",r(this.start).tweenTo(r(this.end),this.pos),void 0,!0)}t.compose=function(t,r,x,g,f){var y;let m,b=r.prototype,A=x.prototype,P=f.prototype;b.collectionsWithUpdate.includes("colorAxis")||(e=t,b.collectionsWithUpdate.push("colorAxis"),b.collectionsWithInit.colorAxis=[b.addColorAxis],(0,i.addEvent)(r,"afterCreateAxes",a),m=(y=r).prototype.createAxis,y.prototype.createAxis=function(t,a){if("colorAxis"!==t)return m.apply(this,arguments);let s=new e(this,(0,i.merge)(a.axis,{index:this[t].length,isX:!1}));return this.isDirtyLegend=!0,this.axes.forEach(t=>{t.series=[]}),this.series.forEach(t=>{t.bindAxes(),t.isDirtyData=!0}),(0,i.pick)(a.redraw,!0)&&this.redraw(a.animation),s},A.fillSetter=c,A.strokeSetter=u,(0,i.addEvent)(g,"afterGetAllItems",s),(0,i.addEvent)(g,"afterColorizeItem",o),(0,i.addEvent)(g,"afterUpdate",l),(0,i.extend)(P,{optionalAxis:"colorAxis",translateColors:d}),(0,i.extend)(P.pointClass.prototype,{setVisible:h}),(0,i.addEvent)(f,"afterTranslate",n,{order:1}),(0,i.addEvent)(f,"bindAxes",p))},t.pointSetVisible=h}(e||(e={}));let p=e,{series:{prototype:{pointClass:h}},seriesTypes:{heatmap:{prototype:{pointClass:d}}}}=l();class c extends d{haloPath(){return this.series.tileShape.haloPath.apply(this,arguments)}}(0,i.extend)(c.prototype,{setState:h.prototype.setState,setVisible:p.pointSetVisible});let{noop:u}=s(),{heatmap:x,scatter:g}=l().seriesTypes;function f(t,e,a){let i=t.options;return{xPad:-((i.colsize||1)/e),yPad:-((i.rowsize||1)/a)}}let y={hexagon:{alignDataLabel:g.prototype.alignDataLabel,getSeriesPadding:function(t){return f(t,3,2)},haloPath:function(t){if(!t)return[];let e=this.tileEdges;return[["M",e.x2-t,e.y1+t],["L",e.x3+t,e.y1+t],["L",e.x4+1.5*t,e.y2],["L",e.x3+t,e.y3-t],["L",e.x2-t,e.y3-t],["L",e.x1-1.5*t,e.y2],["Z"]]},translate:function(){let t,e=this.options,a=this.xAxis,s=this.yAxis,o=e.pointPadding||0,l=(e.colsize||1)/3,n=(e.rowsize||1)/2;for(let e of(this.generatePoints(),this.points)){let r=(0,i.clamp)(Math.floor(a.len-a.translate(e.x-2*l,0,1,0,1)),-a.len,2*a.len),p=(0,i.clamp)(Math.floor(a.len-a.translate(e.x-l,0,1,0,1)),-a.len,2*a.len),h=(0,i.clamp)(Math.floor(a.len-a.translate(e.x+l,0,1,0,1)),-a.len,2*a.len),d=(0,i.clamp)(Math.floor(a.len-a.translate(e.x+2*l,0,1,0,1)),-a.len,2*a.len),c=(0,i.clamp)(Math.floor(s.translate(e.y-n,0,1,0,1)),-s.len,2*s.len),u=(0,i.clamp)(Math.floor(s.translate(e.y,0,1,0,1)),-s.len,2*s.len),x=(0,i.clamp)(Math.floor(s.translate(e.y+n,0,1,0,1)),-s.len,2*s.len),g=e.pointPadding??o,f=g*Math.abs(p-r)/Math.abs(x-u),y=a.reversed?-f:f,m=a.reversed?-g:g,b=s.reversed?-g:g;e.x%2&&(t=t||Math.round(Math.abs(x-c)/2)*(s.reversed?-1:1),c+=t,u+=t,x+=t),e.plotX=e.clientX=(p+h)/2,e.plotY=u,e.tileEdges={x1:r+=y+m,x2:p+=m,x3:h-=m,x4:d-=y+m,y1:c-=b,y2:u,y3:x+=b},e.shapeType="path",e.shapeArgs={d:[["M",p,c],["L",h,c],["L",d,u],["L",h,x],["L",p,x],["L",r,u],["Z"]]}}this.translateColors()}},diamond:{alignDataLabel:g.prototype.alignDataLabel,getSeriesPadding:function(t){return f(t,2,2)},haloPath:function(t){if(!t)return[];let e=this.tileEdges;return[["M",e.x2,e.y1+t],["L",e.x3+t,e.y2],["L",e.x2,e.y3-t],["L",e.x1-t,e.y2],["Z"]]},translate:function(){let t,e=this.options,a=this.xAxis,s=this.yAxis,o=e.pointPadding||0,l=e.colsize||1,n=(e.rowsize||1)/2;for(let e of(this.generatePoints(),this.points)){let r=(0,i.clamp)(Math.round(a.len-a.translate(e.x-l,0,1,0,0)),-a.len,2*a.len),p=(0,i.clamp)(Math.round(a.len-a.translate(e.x+l,0,1,0,0)),-a.len,2*a.len),h=(0,i.clamp)(Math.round(s.translate(e.y-n,0,1,0,0)),-s.len,2*s.len),d=(0,i.clamp)(Math.round(s.translate(e.y,0,1,0,0)),-s.len,2*s.len),c=(0,i.clamp)(Math.round(s.translate(e.y+n,0,1,0,0)),-s.len,2*s.len),u=(0,i.clamp)(Math.round(a.len-a.translate(e.x,0,1,0,0)),-a.len,2*a.len),x=(0,i.pick)(e.pointPadding,o),g=x*Math.abs(u-r)/Math.abs(c-d),f=a.reversed?-g:g,y=s.reversed?-x:x;e.x%2&&(t=Math.abs(c-h)/2*(s.reversed?-1:1),h+=t,d+=t,c+=t),e.plotX=e.clientX=u,e.plotY=d,e.tileEdges={x1:r+=f,x2:u,x3:p-=f,y1:h-=y,y2:d,y3:c+=y},e.shapeType="path",e.shapeArgs={d:[["M",u,h],["L",p,d],["L",u,c],["L",r,d],["Z"]]}}this.translateColors()}},circle:{alignDataLabel:g.prototype.alignDataLabel,getSeriesPadding:function(t){return f(t,2,2)},haloPath:function(t){return g.prototype.pointClass.prototype.haloPath.call(this,t+(t&&this.radius))},translate:function(){let t=this.options,e=this.xAxis,a=this.yAxis,s=t.pointPadding||0,o=(t.rowsize||1)/2,l=t.colsize||1,n,r,p,h,d=!1;for(let t of(this.generatePoints(),this.points)){let c=(0,i.clamp)(Math.round(e.len-e.translate(t.x,0,1,0,0)),-e.len,2*e.len),u=s,x=!1,g=(0,i.clamp)(Math.round(a.translate(t.y,0,1,0,0)),-a.len,2*a.len);void 0!==t.pointPadding&&(u=t.pointPadding,x=!0,d=!0),(!h||d)&&(p=Math.floor(Math.sqrt((n=Math.abs((0,i.clamp)(Math.floor(e.len-e.translate(t.x+l,0,1,0,0)),-e.len,2*e.len)-c))*n+(r=Math.abs((0,i.clamp)(Math.floor(a.translate(t.y+o,0,1,0,0)),-a.len,2*a.len)-g))*r)/2),h=Math.min(n,p,r)-u,d&&!x&&(d=!1)),t.x%2&&(g+=r*(a.reversed?-1:1)),t.plotX=t.clientX=c,t.plotY=g,t.radius=h,t.shapeType="circle",t.shapeArgs={x:c,y:g,r:h}}this.translateColors()}},square:{alignDataLabel:x.prototype.alignDataLabel,translate:x.prototype.translate,getSeriesPadding:u,haloPath:x.prototype.pointClass.prototype.haloPath}},{composed:m,noop:b}=s(),{column:A,heatmap:P,scatter:M}=l().seriesTypes;function L(){if(this.recomputingForTilemap||"colorAxis"===this.coll)return;let t=this,e=t.series.map(function(e){return e.getSeriesPixelPadding&&e.getSeriesPixelPadding(t)}).reduce(function(t,e){return(t&&t.padding)>(e&&e.padding)?t:e},void 0)||{padding:0,axisLengthFactor:1},a=Math.round(e.padding*e.axisLengthFactor);e.padding&&(t.len-=a,t.recomputingForTilemap=!0,t.setAxisTranslation(),delete t.recomputingForTilemap,t.minPixelPadding+=e.padding,t.len+=a)}class v extends P{static compose(t){(0,i.pushUnique)(m,"TilemapSeries")&&(0,i.addEvent)(t,"afterSetAxisTranslation",L)}alignDataLabel(){return this.tileShape.alignDataLabel.apply(this,arguments)}drawPoints(){for(let t of(A.prototype.drawPoints.call(this),this.points))t.graphic&&t.graphic[this.chart.styledMode?"css":"animate"](this.colorAttribs(t))}getSeriesPixelPadding(t){let e=t.isXAxis,a=this.tileShape.getSeriesPadding(this);if(!a)return{padding:0,axisLengthFactor:1};let i=Math.round(t.translate(e?2*a.xPad:a.yPad,0,1,0,1)),s=Math.round(t.translate(e?a.xPad:0,0,1,0,1));return{padding:(t.single?Math.abs(i-s)/2:Math.abs(i-s))||0,axisLengthFactor:e?2:1.1}}setOptions(){let t=super.setOptions.apply(this,arguments);return this.tileShape=y[t.tileShape],t}translate(){return this.tileShape.translate.apply(this,arguments)}}v.defaultOptions=(0,i.merge)(P.defaultOptions,{marker:null,states:{hover:{halo:{enabled:!0,size:2,opacity:.5,attributes:{zIndex:3}}}},pointPadding:2,tileShape:"hexagon"}),(0,i.extend)(v.prototype,{getSymbol:b,markerAttribs:M.prototype.markerAttribs,pointAttribs:A.prototype.pointAttribs,pointClass:c}),l().registerSeriesType("tilemap",v);let S=s();v.compose(S.Axis);let C=s();export{C as default};