/**
 * Highcharts JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/treemap
 * @requires highcharts
 *
 * (c) 2014-2026 Highsoft AS
 * Authors: Jon Arild Nygård / Øystein Moseng
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,i,s={};s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let o=t.default;var r=s.n(o);let l={mainBreadcrumb:"Main"},n=t.default.Templating;var a=s.n(n);let{doc:h,win:d}=r();function p(t,e,i,s={}){let o="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(o,"hcEvents")||(o.hcEvents={});let l=o.hcEvents;r().Point&&t instanceof r().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let n=t.addEventListener;n&&n.call(t,e,i,!!r().supportsPassiveEvents&&{passive:void 0===s.passive?-1!==e.indexOf("touch"):s.passive,capture:!1}),l[e]||(l[e]=[]);let a={fn:i,order:"number"==typeof s.order?s.order:1/0};return l[e].push(a),l[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,i){function s(e,i){let s=t.removeEventListener;s&&s.call(t,e,i,!1)}function o(i){let o,r;t.nodeName&&(e?(o={})[e]=!0:o=i,w(o,function(t,e){if(i[e])for(r=i[e].length;r--;)s(e,i[e][r].fn)}))}let r="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(r,"hcEvents")){let t=r.hcEvents;if(e){let r=t[e]||[];i?(t[e]=r.filter(function(t){return i!==t.fn}),s(e,i)):(o(t),t[e]=[])}else o(t),delete r.hcEvents}}(t,e,i)}}function u(t,e=0,i){let s=e%2/2,o=i?-1:1;return(Math.round(t*o-s)+s)*o}function c(t){return null!=t}function v(t,e){let i;for(i in t||(t={}),e)t[i]=e[i];return t}function g(t,e,i,s){if(i=i||{},h?.createEvent&&(t.dispatchEvent||t.fireEvent&&t!==r())){let s=h.createEvent("Events");s.initEvent(e,!0,!0),i=v(s,i),t.dispatchEvent?t.dispatchEvent(i):t.fireEvent(e,i)}else if(t.hcEvents){i.target||v(i,{preventDefault:function(){i.defaultPrevented=!0},target:t,type:e});let s=[],o=t,r=!1;for(;o.hcEvents;)Object.hasOwnProperty.call(o,"hcEvents")&&o.hcEvents[e]&&(s.length&&(r=!0),s.unshift.apply(s,o.hcEvents[e])),o=Object.getPrototypeOf(o);r&&s.sort((t,e)=>t.order-e.order),s.forEach(e=>{!1===e.fn.call(t,i,t)&&i.preventDefault()})}s&&!i.defaultPrevented&&s.call(t,i)}function f(t){return x(t)&&"number"==typeof t.nodeType}function b(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function m(t){return"string"==typeof t}function y(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function x(t,e){return!!t&&"object"==typeof t&&(!e||!y(t))}function T(t,...e){let i,s=[t,...e],o={},r=function(t,e){return"object"!=typeof t&&(t={}),w(e,function(i,s){if("__proto__"!==s&&"constructor"!==s){let o;!x(i,!0)||(o=i?.constructor,x(i,!0)&&!f(i)&&o?.name&&"Object"!==o.name)||f(i)?t[s]=e[s]:t[s]=r(t[s]||{},i)}}),t};!0===t&&(o=s[1],s=Array.prototype.slice.call(s,2));let l=s.length;for(i=0;i<l;i++)o=r(o,s[i]);return o}function w(t,e,i){for(let s in t)Object.hasOwnProperty.call(t,s)&&e.call(i||t[s],t[s],s,t)}function L(){let t=arguments,e=t.length;for(let i=0;i<e;i++){let e=t[i];if(null!=e)return e}}function P(t,e){return 0>t.indexOf(e)&&!!t.push(e)}function A(t){return y(t)?t:[t]}Array.prototype.find;let{format:B}=a(),{composed:O}=r();function C(){if(this.breadcrumbs){let t=this.resetZoomButton&&this.resetZoomButton.getBBox(),e=this.breadcrumbs.options;t&&"right"===e.position.align&&"plotBox"===e.relativeTo&&this.breadcrumbs.alignBreadcrumbsGroup(-t.width-e.buttonSpacing)}}function S(){this.breadcrumbs&&(this.breadcrumbs.destroy(),this.breadcrumbs=void 0)}function N(){let t=this.breadcrumbs;if(t&&!t.options.floating&&t.level){let e=t.options,i=e.buttonTheme,s=(i.height||0)+2*(i.padding||0)+e.buttonSpacing,o=e.position.verticalAlign;"bottom"===o?(this.marginBottom=(this.marginBottom||0)+s,t.yOffset=s):"middle"!==o?(this.plotTop+=s,t.yOffset=-s):t.yOffset=void 0}}function E(){this.breadcrumbs&&this.breadcrumbs.redraw()}function I(t){!0===t.resetSelection&&this.breadcrumbs&&this.breadcrumbs.alignBreadcrumbsGroup()}class M{static compose(t,e){P(O,"Breadcrumbs")&&(p(t,"destroy",S),p(t,"afterShowResetZoom",C),p(t,"getMargins",N),p(t,"redraw",E),p(t,"selection",I),v(e.lang,l))}constructor(t,e){this.elementList={},this.isDirty=!0,this.level=0,this.list=[];let i=T(t.options.drilldown&&t.options.drilldown.drillUpButton,M.defaultOptions,t.options.navigation&&t.options.navigation.breadcrumbs,e);this.chart=t,this.options=i||{}}updateProperties(t){this.setList(t),this.setLevel(),this.isDirty=!0}setList(t){this.list=t}setLevel(){this.level=this.list.length&&this.list.length-1}getLevel(){return this.level}getButtonText(t){let e=this.chart,i=this.options,s=e.options.lang,o=L(i.format,i.showFullPath?"{level.name}":"← {level.name}"),r=s&&L(s.drillUpText,s.mainBreadcrumb),l=i.formatter&&i.formatter(t)||B(o,{level:t.levelOptions},e)||"";return(m(l)&&!l.length||"← "===l)&&c(r)&&(l=i.showFullPath?r:"← "+r),l}redraw(){this.isDirty&&this.render(),this.group&&this.group.align(),this.isDirty=!1}render(){let t=this.chart,e=this.options;!this.group&&e&&(this.group=t.renderer.g("breadcrumbs-group").addClass("highcharts-no-tooltip highcharts-breadcrumbs").attr({zIndex:e.zIndex}).add()),e.showFullPath?this.renderFullPathButtons():this.renderSingleButton(),this.alignBreadcrumbsGroup()}renderFullPathButtons(){this.destroySingleButton(),this.resetElementListState(),this.updateListElements(),this.destroyListElements()}renderSingleButton(){let t=this.chart,e=this.list,i=this.options.buttonSpacing;this.destroyListElements();let s=this.group?this.group.getBBox().width:i,o=e[e.length-2];!t.drillUpButton&&this.level>0?t.drillUpButton=this.renderButton(o,s,i):t.drillUpButton&&(this.level>0?this.updateSingleButton():this.destroySingleButton())}alignBreadcrumbsGroup(t){if(this.group){let e=this.options,i=e.buttonTheme,s=e.position,o="chart"===e.relativeTo||"spacingBox"===e.relativeTo?void 0:"plotBox",r=this.group.getBBox(),l=2*(i.padding||0)+e.buttonSpacing;s.width=r.width+l,s.height=r.height+l;let n=T(s);t&&(n.x+=t),this.options.rtl&&(n.x+=s.width),n.y=L(n.y,this.yOffset,0),this.group.align(n,!0,o)}}renderButton(t,e,i){let s=this,o=this.chart,r=s.options,l=T(r.buttonTheme),n=o.renderer.button(s.getButtonText(t),e,i,function(e){let i,o=r.events&&r.events.click;o&&(i=o.call(s,e,t,s)),!1!==i&&(r.showFullPath?e.newLevel=t.level:e.newLevel=s.level-1,g(s,"up",e))},l).addClass("highcharts-breadcrumbs-button").add(s.group);return o.styledMode||n.attr(r.style),n}renderSeparator(t,e){let i=this.chart,s=this.options.separator,o=i.renderer.label(s.text,t,e,void 0,void 0,void 0,!1).addClass("highcharts-breadcrumbs-separator").add(this.group);return i.styledMode||o.css(s.style),o}update(t){T(!0,this.options,t),this.destroy(),this.isDirty=!0}updateSingleButton(){let t=this.chart,e=this.list[this.level-1];t.drillUpButton&&t.drillUpButton.attr({text:this.getButtonText(e)})}destroy(){this.destroySingleButton(),this.destroyListElements(!0),this.group&&this.group.destroy(),this.group=void 0}destroyListElements(t){let e=this.elementList;w(e,(i,s)=>{(t||!e[s].updated)&&((i=e[s]).button&&i.button.destroy(),i.separator&&i.separator.destroy(),delete i.button,delete i.separator,delete e[s])}),t&&(this.elementList={})}destroySingleButton(){this.chart.drillUpButton&&(this.chart.drillUpButton.destroy(),this.chart.drillUpButton=void 0)}resetElementListState(){w(this.elementList,t=>{t.updated=!1})}updateListElements(){let t=this.elementList,e=this.options.buttonSpacing,i=this.list,s=this.options.rtl,o=s?-1:1,r=function(t,e){return o*t.getBBox().width+o*e},l=function(t,e,i){t.translate(e-t.getBBox().width,i)},n=this.group?r(this.group,e):e,a,h;for(let d=0,p=i.length;d<p;++d){let u,c,v=d===p-1;t[(h=i[d]).level]?(u=(a=t[h.level]).button,a.separator||v?a.separator&&v&&(a.separator.destroy(),delete a.separator):(n+=o*e,a.separator=this.renderSeparator(n,e),s&&l(a.separator,n,e),n+=r(a.separator,e)),t[h.level].updated=!0):(u=this.renderButton(h,n,e),s&&l(u,n,e),n+=r(u,e),v||(c=this.renderSeparator(n,e),s&&l(c,n,e),n+=r(c,e)),t[h.level]={button:u,separator:c,updated:!0}),u&&u.setState(2*!!v)}}}M.defaultOptions={buttonSpacing:5,buttonTheme:{fill:"none",height:18,padding:2,"stroke-width":0,zIndex:7,states:{select:{fill:"none"}},style:{color:"#334eff"}},floating:!1,format:void 0,relativeTo:"plotBox",rtl:!1,position:{align:"left",verticalAlign:"top",x:0,y:void 0},separator:{text:"/",style:{color:"#666666",fontSize:"0.8em"}},showFullPath:!0,style:{},useHTML:!1,zIndex:7};let D=t.default.Color;var R=s.n(D);let G=t.default.SeriesRegistry;var k=s.n(G);let U=t.default.SVGElement;var V=s.n(U);let{column:{prototype:W}}=k().seriesTypes;var F=e||(e={});function H(t){let e=this.series,i=e.chart.renderer;this.moveToTopOnHover&&this.graphic&&(e.stateMarkerGraphic||(e.stateMarkerGraphic=new(V())(i,"use").css({pointerEvents:"none"}).add(this.graphic.parentGroup)),t?.state==="hover"?(this.graphic.attr({id:this.id}),e.stateMarkerGraphic.attr({href:`${i.url}#${this.id}`,visibility:"visible"})):e.stateMarkerGraphic.attr({href:""}))}F.pointMembers={dataLabelOnNull:!0,moveToTopOnHover:!0,isValid:function(){return null!==this.value&&this.value!==1/0&&this.value!==-1/0&&(void 0===this.value||!isNaN(this.value))}},F.seriesMembers={colorKey:"value",axisTypes:["xAxis","yAxis","colorAxis"],parallelArrays:["x","y","value"],pointArrayMap:["value"],trackerGroups:["group","markerGroup","dataLabelsGroup"],colorAttribs:function(t){let e={};return c(t.color)&&(!t.state||"normal"===t.state)&&(e[this.colorProp||"fill"]=t.color),e},pointAttribs:W.pointAttribs},F.compose=function(t){return p(t.prototype.pointClass,"afterSetState",H),t};let j=e,z=t.default.Series;var $=s.n(z);let _=class{constructor(t,e,i,s){this.height=t,this.width=e,this.plot=s,this.direction=i,this.startDirection=i,this.total=0,this.nW=0,this.lW=0,this.nH=0,this.lH=0,this.elArr=[],this.lP={total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(t,e){return Math.max(t/e,e/t)}}}addElement(t){this.lP.total=this.elArr[this.elArr.length-1],this.total=this.total+t,0===this.direction?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR=this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=this.nH,this.lP.lW=this.lP.total/this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW,this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH)),this.elArr.push(t)}reset(){this.nW=0,this.lW=0,this.elArr=[],this.total=0}},K=function(t,e){let{animatableAttribs:i,onComplete:s,css:o,renderer:r}=e,l=t.series&&t.series.chart.hasRendered?void 0:t.series&&t.series.options.animation,n=t.graphic;if(e.attribs={...e.attribs,class:t.getClassName()},t.shouldDraw())n||(t.graphic=n="text"===e.shapeType?r.text():"image"===e.shapeType?r.image(e.imageUrl||"").attr(e.shapeArgs||{}):r[e.shapeType](e.shapeArgs||{}),n.add(e.group)),o&&n.css(o),n.attr(e.attribs).animate(i,!e.isNew&&l,s);else if(n){let e=()=>{t.graphic=n=n&&n.destroy(),"function"==typeof s&&s()};Object.keys(i).length?n.animate(i,void 0,()=>e()):e()}},{pie:{prototype:{pointClass:Y}},scatter:{prototype:{pointClass:Z}}}=k().seriesTypes;class X extends Z{constructor(){super(...arguments),this.groupedPointsAmount=0,this.shapeType="rect"}draw(t){K(this,t)}getClassName(){let t=this.series,e=t.options,i=super.getClassName();return this.node.level<=t.nodeMap[t.rootNode].level&&this.node.children.length?i+=" highcharts-above-level":this.node.isGroup||this.node.isLeaf||t.nodeMap[t.rootNode].isGroup||L(e.interactByLeaf,!e.allowTraversingTree)?this.node.isGroup||this.node.isLeaf||t.nodeMap[t.rootNode].isGroup||(i+=" highcharts-internal-node"):i+=" highcharts-internal-node-interactive",i}isValid(){return!!(this.id||b(this.value))}setState(t){super.setState.apply(this,arguments),this.graphic&&this.graphic.attr({zIndex:+("hover"===t)})}shouldDraw(){return b(this.plotY)&&null!==this.y}}v(X.prototype,{setVisible:Y.prototype.setVisible});let q={allowTraversingTree:!1,animationLimit:250,borderRadius:0,showInLegend:!1,marker:void 0,colorByPoint:!1,dataLabels:{enabled:!0,formatter:function(){let t=this&&this.point?this.point:{};return m(t.name)?t.name:""},headers:!1,inside:!0,padding:2,verticalAlign:"middle",style:{textOverflow:"ellipsis"}},tooltip:{headerFormat:"",pointFormat:"<b>{point.name}</b>: {point.value}<br/>",clusterFormat:"+ {point.groupedPointsAmount} more...<br/>"},ignoreHiddenPoint:!0,layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,traverseUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,colorKey:"colorValue",opacity:.15,states:{hover:{borderColor:"#999999",brightness:.1*!k().seriesTypes.heatmap,halo:!1,opacity:.75,shadow:!1}},legendSymbol:"rectangle",traverseToLeaf:!1,cluster:{className:void 0,color:void 0,enabled:!1,pixelWidth:void 0,pixelHeight:void 0,name:void 0,reductionFactor:void 0,minimumClusterSize:5,layoutAlgorithm:{distance:0,gridSize:0,kmeansThreshold:0},marker:{lineWidth:0,radius:0}}};(i||(i={})).recursive=function t(e,i,s){let o=i.call(s||this,e);!1!==o&&t(o,i,s)};let J=i,{parse:Q}=R(),{composed:tt,noop:te}=r(),{column:ti,scatter:ts}=k().seriesTypes,{getColor:to,getLevelOptions:tr,updateRootId:tl}={getColor:function(t,e){let i,s,o,r,l,n,a=e.index,h=e.mapOptionsToLevel,d=e.parentColor,p=e.parentColorIndex,u=e.series,c=e.colors,v=e.siblings,g=u.points,f=u.chart.options.chart;if(t){let b;i=g[t.i],s=h[t.level]||{},i&&s.colorByPoint&&(r=i.index%(c?c.length:f.colorCount),o=c&&c[r]),u.chart.styledMode||(l=L(i&&i.options.color,s&&s.color,o,d&&((b=s&&s.colorVariation)&&"brightness"===b.key&&a&&v?R().parse(d).brighten(b.to*(a/v)).get():d),u.color)),n=L(i&&i.options.colorIndex,s&&s.colorIndex,r,p,e.colorIndex)}return{color:l,colorIndex:n}},getLevelOptions:function(t){let e,i,s,o,r,l,n={};if(x(t))for(o=b(t.from)?t.from:1,l=t.levels,i={},e=x(t.defaults)?t.defaults:{},y(l)&&(i=l.reduce((t,i)=>{let s,r,l;return x(i)&&b(i.level)&&(r=L((l=T({},i)).levelIsConstant,e.levelIsConstant),delete l.levelIsConstant,delete l.level,x(t[s=i.level+(r?0:o-1)])?T(!0,t[s],l):t[s]=l),t},{})),r=b(t.to)?t.to:1,s=0;s<=r;s++)n[s]=T({},e,x(i[s])?i[s]:{});return n},getNodeWidth:function(t,e){let{chart:i,options:s}=t,{nodeDistance:o=0,nodeWidth:r=0}=s,{plotSizeX:l=1}=i;if("auto"===r){if("string"==typeof o&&/%$/.test(o))return l/(e+parseFloat(o)/100*(e-1));let t=Number(o);return(l+t)/(e||1)-t}return/%$/.test(r)?l*parseFloat(r)/100+0:parseFloat(r)},setTreeValues:function t(e,i){let s=i.before,o=i.idRoot,r=i.mapIdToNode[o],l=!1!==i.levelIsConstant,n=i.points[e.i],a=n&&n.options||{},h=[],d=0;e.levelDynamic=e.level-(l?0:r.level),e.name=L(n&&n.name,""),e.visible=o===e.id||!0===i.visible,"function"==typeof s&&(e=s(e,i)),e.children.forEach((s,o)=>{let r=v({},i);v(r,{index:o,siblings:e.children.length,visible:e.visible}),s=t(s,r),h.push(s),s.visible&&(d+=s.val)});let p=L(a.value,d);return e.visible=p>=0&&(d>0||e.visible),e.children=h,e.childrenTotal=d,e.isLeaf=e.visible&&!d,e.val=p,e},updateRootId:function(t){let e,i;return x(t)&&(i=x(t.options)?t.options:{},e=L(t.rootNode,i.rootId,""),x(t.userOptions)&&(t.userOptions.rootId=e),t.rootNode=e),e}};$().keepProps.push("simulation","hadOutsideDataLabels");let tn=!1;function ta(){let t=this.xAxis,e=this.yAxis;if(t&&e)if(this.is("treemap")){let i={endOnTick:!1,startOnTick:!1,visible:!1};this.is("treegraph")||(i.min=0,i.max=100,i.tickPositions=[]),T(!0,t.options,i,t.userOptions),T(!0,e.options,i,e.userOptions),t.visible=t.options.visible,e.visible=e.options.visible,this.is("treegraph")&&(this.isCartesian=t.visible),tn=!0}else tn&&(e.setOptions(e.userOptions),t.setOptions(t.userOptions),tn=!1)}class th extends ts{constructor(){super(...arguments),this.simulation=0}static compose(t){P(tt,"TreemapSeries")&&p(t,"afterBindAxes",ta)}algorithmCalcPoints(t,e,i,s){let o=i.plot,r=i.elArr.length-1,l,n,a,h,d=i.lW,p=i.lH,u,c=0;for(let t of(e?(d=i.nW,p=i.nH):u=i.elArr[r],i.elArr)){if(e||c<r){var v;0===i.direction?(l=o.x,n=o.y,h=t/(a=d)):(l=o.x,n=o.y,a=t/(h=p)),s.push({x:l,y:n,width:a,height:(v=h)>1e14?v:parseFloat(v.toPrecision(14))}),0===i.direction?o.y=o.y+h:o.x=o.x+a}c+=1}i.reset(),0===i.direction?i.width=i.width-d:i.height=i.height-p,o.y=o.parent.y+(o.parent.height-i.height),o.x=o.parent.x+(o.parent.width-i.width),t&&(i.direction=1-i.direction),e||i.addElement(u)}algorithmFill(t,e,i){let s=[],o,r=e.direction,l=e.x,n=e.y,a=e.width,h=e.height,d,p,u,c;for(let v of i)o=e.width*e.height*(v.val/e.val),d=l,p=n,0===r?(a-=u=o/(c=h),l+=u):(h-=c=o/(u=a),n+=c),s.push({x:d,y:p,width:u,height:c,direction:0,val:0}),t&&(r=1-r);return s}algorithmLowAspectRatio(t,e,i){let s=[],o={x:e.x,y:e.y,parent:e},r=e.direction,l=i.length-1,n=new _(e.height,e.width,r,o),a,h=0;for(let r of i)a=e.width*e.height*(r.val/e.val),n.addElement(a),n.lP.nR>n.lP.lR&&this.algorithmCalcPoints(t,!1,n,s,o),h===l&&this.algorithmCalcPoints(t,!0,n,s,o),++h;return s}alignDataLabel(t,e,i){ti.prototype.alignDataLabel.apply(this,arguments),t.dataLabel&&t.dataLabel.attr({zIndex:(t.node.zIndex||0)+1})}applyTreeGrouping(){let t=this,e=t.parentList||{},{cluster:i}=t.options,s=i?.minimumClusterSize||5;if(i?.enabled){let o={},r=t=>{if(t?.point?.shapeArgs){let{width:e=0,height:s=0}=t.point.shapeArgs,{pixelWidth:r=0,pixelHeight:l=0}=i,n=c(l),a=l?r*l:r*r;(e<r||s<(n?l:r)||e*s<a)&&!t.isGroup&&c(t.parent)&&(o[t.parent]||(o[t.parent]=[]),o[t.parent].push(t))}t?.children.forEach(t=>{r(t)})};for(let l in r(t.tree),o)o[l]&&o[l].length>s&&o[l].forEach(s=>{let o=e[l].indexOf(s.i);if(-1!==o){e[l].splice(o,1);let r=`highcharts-grouped-treemap-points-${s.parent||"root"}`,n=t.points.find(t=>t.id===r);if(!n){let s=t.pointClass,o=t.points.length;v(n=new s(t,{className:i.className,color:i.color,id:r,index:o,isGroup:!0,value:0}),{formatPrefix:"cluster"}),t.points.push(n),e[l].push(o),e[r]=[]}let a=n.groupedPointsAmount+1,h=t.points[n.index].options.value||0,d=i.name||`+ ${a}`;t.points[n.index].groupedPointsAmount=a,t.points[n.index].options.value=h+(s.point.value||0),t.points[n.index].name=d,e[r].push(s.point.index)}});t.nodeMap={},t.nodeList=[],t.parentList=e;let l=t.buildTree("",-1,0,t.parentList);t.translate(l)}}calculateChildrenAreas(t,e){let i=this.options,s=this.mapOptionsToLevel[t.level+1],o=L(s?.layoutAlgorithm&&this[s?.layoutAlgorithm]&&s.layoutAlgorithm,i.layoutAlgorithm),r=i.alternateStartingDirection,l=t.children.filter(e=>t.isGroup||!e.ignore),n=s?.groupPadding??i.groupPadding??0,a=this.nodeMap[this.rootNode];if(!o)return;let h=[],d=a.pointValues?.width||0,p=a.pointValues?.height||0;s?.layoutStartingDirection&&(e.direction=+("vertical"!==s.layoutStartingDirection)),h=this[o](e,l);let u=-1;for(let t of l){let i=h[++u];t===a&&(d=d||i.width,p=i.height);let s=n/(this.xAxis.len/p),o=n/(this.yAxis.len/p);if(t.values=T(i,{val:t.childrenTotal,direction:r?1-e.direction:e.direction}),t.children.length&&t.point.dataLabels?.length){let e=function(t){let e=t.length,i=t[0];for(;e--;)t[e]>i&&(i=t[e]);return i}(t.point.dataLabels.map(t=>t.options?.headers&&t.height||0))/(this.yAxis.len/p);e<t.values.height/2&&(t.values.y+=e,t.values.height-=e)}if(n){let e=Math.min(s,t.values.width/4),i=Math.min(o,t.values.height/4);t.values.x+=e,t.values.width-=2*e,t.values.y+=i,t.values.height-=2*i}t.pointValues=T(i,{x:i.x/this.axisRatio,y:100-i.y-i.height,width:i.width/this.axisRatio}),t.children.length&&this.calculateChildrenAreas(t,t.values)}let c=(t,e=[],i=!0)=>(t.children.forEach(t=>{i&&t.isLeaf?e.push(t.point):i||t.isLeaf||e.push(t.point),t.children.length&&c(t,e,i)}),e);if("leaf"===i.nodeSizeBy&&t===a&&this.hasOutsideDataLabels&&!c(a,void 0,!1).some(t=>b(t.options.value))&&!b(a.point?.options.value)){let i=c(a),s=i.map(t=>t.options.value||0),o=i.map(({node:{pointValues:t}})=>t?t.width*t.height:0),r=s.reduce((t,e)=>t+e,0),l=o.reduce((t,e)=>t+e,0)/r,n=0,h=0;i.forEach((t,e)=>{var i;let r=(i=(s[e]?o[e]/s[e]:1)/l)>.8?i<1.4?i:1.4:.8,a=1-r;t.value&&(o[e]<20&&(a*=o[e]/20),a>h&&(h=a),a<n&&(n=a),t.simulatedValue=(t.simulatedValue||t.value)/r)}),(n<-.05||h>.05)&&this.simulation<10?(this.simulation++,this.setTreeValues(t),e.val=t.val,this.calculateChildrenAreas(t,e)):(i.forEach(t=>{delete t.simulatedValue}),this.setTreeValues(t),this.simulation=0)}}createList(t){let e=this.chart,i=e.breadcrumbs,s=[];if(i){let i=0;s.push({level:i,levelOptions:e.series[0]});let o=t.target.nodeMap[t.newRootId],r=[];for(;o.parent||""===o.parent;)r.push(o),o=t.target.nodeMap[o.parent];for(let t of r.reverse())s.push({level:++i,levelOptions:t});s.length<=1&&(s.length=0)}return s}drawDataLabels(){let t=this.mapOptionsToLevel,e=this.points.filter(function(t){return t.node.visible||c(t.dataLabel)}),i=A(this.options.dataLabels||{})[0]?.padding,s=e.some(t=>b(t.plotY));for(let o of e){let e={},r={style:e},l=t[o.node.level];if((!o.node.isLeaf&&!o.node.isGroup||o.node.isGroup&&o.node.level<=this.nodeMap[this.rootNode].level)&&(r.enabled=!1),l?.dataLabels&&(T(!0,r,A(l.dataLabels)[0]),this.hasDataLabels=()=>!0),o.node.isLeaf?r.inside=!0:r.headers&&(r.verticalAlign="top"),o.shapeArgs&&s){let{height:t=0,width:s=0}=o.shapeArgs;if(s>32&&t>16&&o.shouldDraw()){let l=s-2*(r.padding||i||0);e.width=`${l}px`,e.lineClamp??(e.lineClamp=Math.floor(t/16)),this.options.allowTraversingTree&&(e.visibility="inherit"),o.dataLabel?.attr({width:r.headers?l:void 0})}else e.width=`${s}px`,e.visibility="hidden"}o.dlOptions=T(r,o.options.dataLabels,{zIndex:void 0})}super.drawDataLabels(e)}drawPoints(t=this.points){let e=this.chart,i=e.renderer,s=e.styledMode,o=this.options,r=s?{}:o.shadow,l=o.borderRadius,n=e.pointCount<o.animationLimit,a=o.allowTraversingTree;for(let e of t){let t={},h={},d={},p="level-group-"+e.node.level,u=!!e.graphic,c=n&&u,g=e.shapeArgs;e.shouldDraw()&&(e.isInside=!0,l&&(h.r=l),T(!0,c?t:h,u?g:{},s?{}:this.pointAttribs(e,e.selected?"select":void 0)),this.colorAttribs&&s&&v(d,this.colorAttribs(e)),this[p]||(this[p]=i.g(p).attr({zIndex:-(e.node.level||0)}).add(this.group),this[p].survive=!0)),e.draw({animatableAttribs:t,attribs:h,css:d,group:this[p],imageUrl:e.imageUrl,renderer:i,shadow:r,shapeArgs:g,shapeType:e.shapeType}),a&&e.graphic&&(e.drillId=o.interactByLeaf?this.drillToByLeaf(e):this.drillToByGroup(e))}}drillToByGroup(t){return(!t.node.isLeaf||!!t.node.isGroup)&&t.id}drillToByLeaf(t){let{traverseToLeaf:e}=t.series.options,i=!1,s;if(t.node.parent!==this.rootNode&&t.node.isLeaf)if(e)i=t.id;else for(s=t.node;!i;)void 0!==s.parent&&(s=this.nodeMap[s.parent]),s.parent===this.rootNode&&(i=s.id);return i}drillToNode(t,e){(0,o.error)(32,!1,void 0,{"treemap.drillToNode":"use treemap.setRootNode"}),this.setRootNode(t,e)}drillUp(){let t=this.nodeMap[this.rootNode];t&&m(t.parent)&&this.setRootNode(t.parent,!0,{trigger:"traverseUpButton"})}getExtremes(){let{dataMin:t,dataMax:e}=super.getExtremes(this.colorValueData);return this.valueMin=t,this.valueMax=e,super.getExtremes()}getListOfParents(t,e){let i=y(t)?t:[],s=y(e)?e:[],o=i.reduce(function(t,e,i){let s=L(e.parent,"");return void 0===t[s]&&(t[s]=[]),t[s].push(i),t},{"":[]});for(let t of Object.keys(o)){let e=o[t];if(""!==t&&-1===s.indexOf(t)){for(let t of e)o[""].push(t);delete o[t]}}return o}getTree(){let t=this.data.map(function(t){return t.id});return this.parentList=this.getListOfParents(this.data,t),this.nodeMap={},this.nodeList=[],this.buildTree("",-1,0,this.parentList||{})}buildTree(t,e,i,s,o){let r=[],l=this.points[e],n=0,a;for(let e of s[t]||[])n=Math.max((a=this.buildTree(this.points[e].id,e,i+1,s,t)).height+1,n),r.push(a),this.is("treegraph")&&(a.visible=!0);let h=new this.NodeClass().init(t,e,r,n,i,this,o);for(let t of r)t.parentNode=h;return this.nodeMap[h.id]=h,this.nodeList.push(h),l&&(l.node=h,h.point=l,c(l.options.x)||(l.x=i)),h}hasData(){return!!this.dataTable.rowCount}init(t,e){let i=this,s=T(e.drillUpButton,e.breadcrumbs),o=p(i,"setOptions",t=>{let e=t.userOptions;c(e.allowDrillToNode)&&!c(e.allowTraversingTree)&&(e.allowTraversingTree=e.allowDrillToNode,delete e.allowDrillToNode),c(e.drillUpButton)&&!c(e.traverseUpButton)&&(e.traverseUpButton=e.drillUpButton,delete e.drillUpButton);let i=A(e.dataLabels||{});e.levels?.forEach(t=>{i.push.apply(i,A(t.dataLabels||{}))}),this.hasOutsideDataLabels=i.some(t=>t.headers)});super.init(t,e),delete i.opacity,i.eventsToUnbind.push(o),i.options.allowTraversingTree&&(i.eventsToUnbind.push(p(i,"click",i.onClickDrillToNode)),i.eventsToUnbind.push(p(i,"setRootNode",function(t){let e=i.chart;e.breadcrumbs&&e.breadcrumbs.updateProperties(i.createList(t))})),i.eventsToUnbind.push(p(i,"update",function(t,e){let i=this.chart.breadcrumbs;i&&t.options.breadcrumbs&&i.update(t.options.breadcrumbs),this.hadOutsideDataLabels=this.hasOutsideDataLabels})),i.eventsToUnbind.push(p(i,"destroy",function(t){let e=this.chart;e.breadcrumbs&&!t.keepEventsForUpdate&&(e.breadcrumbs.destroy(),e.breadcrumbs=void 0)}))),t.breadcrumbs||(t.breadcrumbs=new M(t,s)),i.eventsToUnbind.push(p(t.breadcrumbs,"up",function(t){let e=this.level-t.newLevel;for(let t=0;t<e;t++)i.drillUp()}))}onClickDrillToNode(t){let e=t.point,i=e?.drillId;m(i)&&(e.setState(""),this.setRootNode(i,!0,{trigger:"click"}))}pointAttribs(t,e){let i=x(this.mapOptionsToLevel)?this.mapOptionsToLevel:{},s=t&&i[t.node.level]||{},o=this.options,r=e&&o.states&&o.states[e]||{},l=t?.getClassName()||"",n={stroke:t&&t.borderColor||s.borderColor||r.borderColor||o.borderColor,"stroke-width":L(t&&t.borderWidth,s.borderWidth,r.borderWidth,o.borderWidth),dashstyle:t?.borderDashStyle||s.borderDashStyle||r.borderDashStyle||o.borderDashStyle,fill:t?.color||this.color};return -1!==l.indexOf("highcharts-above-level")?(n.fill="none",n["stroke-width"]=0):-1!==l.indexOf("highcharts-internal-node-interactive")?(n["fill-opacity"]=r.opacity??o.opacity??1,n.cursor="pointer"):-1!==l.indexOf("highcharts-internal-node")?n.fill="none":e&&r.brightness&&(n.fill=Q(n.fill).brighten(r.brightness).get()),n}setColorRecursive(t,e,i,s,o){let r=this?.chart,l=r?.options?.colors;if(t){let r=to(t,{colors:l,index:s,mapOptionsToLevel:this.mapOptionsToLevel,parentColor:e,parentColorIndex:i,series:this,siblings:o}),n=this.points[t.i];n&&(n.color=r.color,n.colorIndex=r.colorIndex);let a=-1;for(let e of t.children||[])this.setColorRecursive(e,r.color,r.colorIndex,++a,t.children.length)}}setPointValues(){let t=this,{points:e,xAxis:i,yAxis:s}=t,o=t.chart.styledMode,r=e=>o?0:t.pointAttribs(e)["stroke-width"]||0;for(let t of e){let{pointValues:e,visible:o}=t.node;if(e&&o){let{height:o,width:l,x:n,y:a}=e,h=r(t),d=i.toPixels(n,!0),p=i.toPixels(n+l,!0),c=s.toPixels(a,!0),v=s.toPixels(a+o,!0),g=0===d?h/2:u(i.toPixels(n,!0),h,!0),f=p===i.len?i.len-h/2:u(i.toPixels(n+l,!0),h,!0),b=c===s.len?s.len-h/2:u(s.toPixels(a,!0),h,!0),m=0===v?h/2:u(s.toPixels(a+o,!0),h,!0),y={x:Math.min(g,f),y:Math.min(b,m),width:Math.abs(f-g),height:Math.abs(m-b)};t.plotX=y.x+y.width/2,t.plotY=y.y+y.height/2,t.shapeArgs=y}else delete t.plotX,delete t.plotY}}setRootNode(t,e,i){g(this,"setRootNode",v({newRootId:t,previousRootId:this.rootNode,redraw:L(e,!0),series:this},i),function(t){let e=t.series;e.idPreviousRoot=t.previousRootId,e.rootNode=t.newRootId,e.isDirty=!0,t.redraw&&e.chart.redraw()})}setState(t){this.options.inactiveOtherPoints=!0,super.setState(t,!1),this.options.inactiveOtherPoints=!1}setTreeValues(t){let e=this.options,i=this.rootNode,s=this.nodeMap[i],o="boolean"!=typeof e.levelIsConstant||e.levelIsConstant,r=[],l=this.points[t.i],n=0;for(let e of t.children)e=this.setTreeValues(e),r.push(e),e.ignore||(n+=e.val);!function(t,e){let i,s,o=t.length;for(s=0;s<o;s++)t[s].safeI=s;for(t.sort(function(t,s){return 0===(i=e(t,s))?t.safeI-s.safeI:i}),s=0;s<o;s++)delete t[s].safeI}(r,(t,e)=>(t.sortIndex||0)-(e.sortIndex||0));let a=L(l?.simulatedValue,l?.options.value,n);return l&&(l.value=a),l?.isGroup&&e.cluster?.reductionFactor&&(a/=e.cluster.reductionFactor),t.parentNode?.point?.isGroup&&this.rootNode!==t.parent&&(t.visible=!1),v(t,{children:r,childrenTotal:n,ignore:!(L(l?.visible,!0)&&a>0),isLeaf:t.visible&&!("treegraph"===this.type?r.length>0:n),isGroup:l?.isGroup,levelDynamic:t.level-(o?0:s.level),name:L(l?.name,""),sortIndex:L(l?.sortIndex,-a),val:a}),t}sliceAndDice(t,e){return this.algorithmFill(!0,t,e)}squarified(t,e){return this.algorithmLowAspectRatio(!0,t,e)}strip(t,e){return this.algorithmLowAspectRatio(!1,t,e)}stripes(t,e){return this.algorithmFill(!1,t,e)}translate(t){let e=this,i=e.options,s=!t,o=tl(e),r,l,n,a;t||o.startsWith("highcharts-grouped-treemap-points-")||((this.points||[]).forEach(t=>{t.isGroup&&t.destroy()}),super.translate(),t=e.getTree()),e.tree=t=t||e.tree,r=e.nodeMap[o],""===o||r||(e.setRootNode("",!1),o=e.rootNode,r=e.nodeMap[o]),r.point?.isGroup||(e.mapOptionsToLevel=tr({from:r.level+1,levels:i.levels,to:t.height,defaults:{levelIsConstant:e.options.levelIsConstant,colorByPoint:i.colorByPoint}})),J.recursive(e.nodeMap[e.rootNode],t=>{let i=t.parent,s=!1;return t.visible=!0,(i||""===i)&&(s=e.nodeMap[i]),s}),J.recursive(e.nodeMap[e.rootNode].children,t=>{let e=!1;for(let i of t)i.visible=!0,i.children.length&&(e=(e||[]).concat(i.children));return e}),e.setTreeValues(t),e.axisRatio=e.xAxis.len/e.yAxis.len,e.nodeMap[""].pointValues=l={x:0,y:0,width:100,height:100},e.nodeMap[""].values=n=T(l,{width:l.width*e.axisRatio,direction:+("vertical"!==i.layoutStartingDirection),val:t.val}),(this.hasOutsideDataLabels||this.hadOutsideDataLabels)&&this.drawDataLabels(),e.calculateChildrenAreas(t,n),e.colorAxis||i.colorByPoint||e.setColorRecursive(e.tree),i.allowTraversingTree&&r.pointValues&&(a=r.pointValues,e.xAxis.setExtremes(a.x,a.x+a.width,!1),e.yAxis.setExtremes(a.y,a.y+a.height,!1),e.xAxis.setScale(),e.yAxis.setScale()),e.setPointValues(),s&&e.applyTreeGrouping()}}th.defaultOptions=T(ts.defaultOptions,q),v(th.prototype,{buildKDTree:te,colorAttribs:j.seriesMembers.colorAttribs,colorKey:"colorValue",directTouch:!0,getExtremesFromAll:!0,getSymbol:te,optionalAxis:"colorAxis",parallelArrays:["x","y","value","colorValue"],pointArrayMap:["value","colorValue"],pointClass:X,NodeClass:class{constructor(){this.childrenTotal=0,this.visible=!1}init(t,e,i,s,o,r,l){return this.id=t,this.i=e,this.children=i,this.height=s,this.level=o,this.series=r,this.parent=l,this}},trackerGroups:["group","dataLabelsGroup"],utils:J}),j.compose(th),k().registerSeriesType("treemap",th);let td=r();td.Breadcrumbs=td.Breadcrumbs||M,td.Breadcrumbs.compose(td.Chart,td.defaultOptions),th.compose(td.Series);let tp=r();export{tp as default};