/**
 * Highcharts JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/dependency-wheel
 * @requires highcharts
 * @requires highcharts/modules/sankey
 *
 * Dependency wheel module
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Torstein Hønsi
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,r={};r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let n=t.default;var a=r.n(n);let o=t.default.SeriesRegistry;var s=r.n(o);let{doc:i,win:l}=a();function h(t,e,r,n={}){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 i=t.addEventListener;i&&i.call(t,e,r,!!a().supportsPassiveEvents&&{passive:void 0===n.passive?-1!==e.indexOf("touch"):n.passive,capture:!1}),s[e]||(s[e]=[]);let l={fn:r,order:"number"==typeof n.order?n.order:1/0};return s[e].push(l),s[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,r){function n(e,r){let n=t.removeEventListener;n&&n.call(t,e,r,!1)}function a(r){let a,o;t.nodeName&&(e?(a={})[e]=!0:a=r,f(a,function(t,e){if(r[e])for(o=r[e].length;o--;)n(e,r[e][o].fn)}))}let o="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(o,"hcEvents")){let t=o.hcEvents;if(e){let o=t[e]||[];r?(t[e]=o.filter(function(t){return r!==t.fn}),n(e,r)):(a(t),t[e]=[])}else a(t),delete o.hcEvents}}(t,e,r)}}function d(t,e){let r;for(r in t||(t={}),e)t[r]=e[r];return t}function c(t){return p(t)&&"number"==typeof t.nodeType}function p(t,e){let r;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(r=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==r)}function u(t,...e){let r,n=[t,...e],a={},o=function(t,e){return"object"!=typeof t&&(t={}),f(e,function(r,n){if("__proto__"!==n&&"constructor"!==n){let a;!p(r,!0)||(a=r?.constructor,p(r,!0)&&!c(r)&&a?.name&&"Object"!==a.name)||c(r)?t[n]=e[n]:t[n]=o(t[n]||{},r)}}),t};!0===t&&(a=n[1],n=Array.prototype.slice.call(n,2));let s=n.length;for(r=0;r<s;r++)a=o(a,n[r]);return a}function f(t,e,r){for(let n in t)Object.hasOwnProperty.call(t,n)&&e.call(r||t[n],t[n],n,t)}function g(t,e,r){return/%$/.test(t)?e*parseFloat(t)/100+(r||0):parseFloat(t)}Array.prototype.find;let{sankey:{prototype:{pointClass:y}}}=s().seriesTypes,m=class extends y{getDataLabelPath(t){var e;let r=this,n=r.series.chart.renderer,a=r.shapeArgs,o=r.angle<0||r.angle>Math.PI,s=a.start||0,i=a.end||0;if(r.dataLabelPath)r.dataLabelPath=r.dataLabelPath.destroy(),delete r.dataLabelPath;else{let n;e=function(t){return r.dataLabelPath&&(r.dataLabelPath=r.dataLabelPath.destroy()),t.call(this)},n=t.destroy,t.destroy=function(){let t=arguments,r=this;return e.apply(this,[function(){return n.apply(r,arguments.length?arguments:t)}].concat([].slice.call(arguments)))}}return r.dataLabelPath=n.arc({open:!0,longArc:Math.abs(Math.abs(s)-Math.abs(i))<Math.PI?0:1}).attr({x:a.x,y:a.y,r:(a.r||0)+parseInt(t.options?.distance||0,10),start:o?s:i,end:o?i:s,clockwise:+o}).add(n.defs),r.dataLabelPath}isValid(){return!0}};var b=e||(e={});b.compose=function(t,e){return t.sankeyColumn=new x(t,e),t};class x{constructor(t,e){this.points=t,this.series=e}getTranslationFactor(t){let e=this.points,r=e.slice(),n=t.chart,a=t.options.minLinkWidth||0,o,s=0,i,l=(n.plotSizeY||0)-(t.options.borderWidth||0)-(e.length-1)*t.nodePadding;for(;e.length;){for(s=l/e.sankeyColumn.sum(),o=!1,i=e.length;i--;)e[i].getSum()*s<a&&(e.splice(i,1),l=Math.max(0,l-a),o=!0);if(!o)break}for(let t of(e.length=0,r))e.push(t);return s}top(t){let e=this.series,r=e.nodePadding,n=this.points.reduce((n,a)=>(n>0&&(n+=r),n+=Math.max(a.getSum()*t,e.options.minLinkWidth||0)),0);return((t="")=>({center:.5,right:1,middle:.5,bottom:1})[t]||0)(e.options.nodeAlignment||"center")*((e.chart.plotSizeY||0)-n)}left(t){let e=this.series,r=e.chart,n=e.options.equalNodes,a=r.inverted?r.plotHeight:r.plotWidth,o=e.nodePadding,s=this.points.reduce((r,s)=>(r>0&&(r+=o),r+=n?a/s.series.nodes.length-o:Math.max(s.getSum()*t,e.options.minLinkWidth||0)),0);return((r.plotSizeX||0)-Math.round(s))/2}sum(){return this.points.reduce((t,e)=>t+e.getSum(),0)}offset(t,e){let r=this.points,n=this.series,a=n.nodePadding,o=0,s;if(n.is("organization")&&t.hangsFrom)return{absoluteTop:t.hangsFrom.nodeY};for(let i=0;i<r.length;i++){let l=r[i].getSum(),h=Math.max(l*e,n.options.minLinkWidth||0),d=t.options[n.chart.inverted?"offsetHorizontal":"offsetVertical"],c=t.options.offset||0;if(s=l?h+a:0,r[i]===t)return{relativeTop:o+(null!=d?g(d,h):g(c,s))};o+=s}}}b.SankeyColumnAdditions=x;let P=e,v=t.default.SVGElement;var M=r.n(v);let{deg2rad:k}=a();function L(t,e){e=u(!0,{enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);let r=this.renderer.url,a=this.text||this,o=a.textPath,{attributes:s,enabled:i}=e;if(t=t||o&&o.path,o&&o.undo(),t&&i){let e=h(a,"afterModifyTree",e=>{if(t&&i){let o=t.attr("id");o||t.attr("id",o=(0,n.uniqueKey)());let i={x:0,y:0};null!=s.dx&&(i.dx=s.dx,delete s.dx),null!=s.dy&&(i.dy=s.dy,delete s.dy),a.attr(i),this.attr({transform:""}),this.box&&(this.box=this.box.destroy());let l=e.nodes.slice(0);e.nodes.length=0,e.nodes[0]={tagName:"textPath",attributes:d(s,{"text-anchor":s.textAnchor,href:`${r}#${o}`}),children:l}}});a.textPath={path:t,undo:e}}else a.attr({dx:0,dy:0}),delete a.textPath;return this.added&&(a.textCache="",this.renderer.buildText(a)),this}function T(t){let e=t.bBox,r=this.element?.querySelector("textPath");if(r){let t=[],{b:n,h:a}=this.renderer.fontMetrics(this.element),o=a-n,s=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),i=r.innerHTML.replace(s,"").split(/<tspan class="highcharts-br"[^>]*>/),l=i.length,h=(t,e)=>{let{x:a,y:s}=e,i=(r.getRotationOfChar(t)-90)*k,l=Math.cos(i),h=Math.sin(i);return[[a-o*l,s-o*h],[a+n*l,s+n*h]]};for(let e=0,n=0;n<l;n++){let a=i[n].length;for(let o=0;o<a;o+=5)try{let a=e+o+n,[s,i]=h(a,r.getStartPositionOfChar(a));0===o?(t.push(i),t.push(s)):(0===n&&t.unshift(i),n===l-1&&t.push(s))}catch{break}e+=a-1;try{let a=e+n,o=r.getEndPositionOfChar(a),[s,i]=h(a,o);t.unshift(i),t.unshift(s)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}function O(t){let e=t.labelOptions,r=t.point,n=e[r.formatPrefix+"TextPath"]||e.textPath;n&&!e.useHTML&&(this.setTextPath(r.getDataLabelPath?.(this)||r.graphic,n),r.dataLabelPath&&!n.enabled&&(r.dataLabelPath=r.dataLabelPath.destroy()))}let{animObject:A}=a(),{deg2rad:C}=a(),{pie:S,sankey:j}=s().seriesTypes;({compose:function(t){h(t,"afterGetBBox",T),h(t,"beforeAddingDataLabel",O);let e=t.prototype;e.setTextPath||(e.setTextPath=L)}}).compose(M());class N extends j{animate(t){if(!t){let t=A(this.options.animation).duration/2/this.nodes.length,e=0;for(let r of this.nodes){let n=r.graphic;n&&(n.attr({opacity:0}),setTimeout(()=>{r.graphic&&r.graphic.animate({opacity:1},{duration:t})},t*e++))}for(let t of this.points){let e=t.graphic;!t.isNode&&e&&e.attr({opacity:0}).animate({opacity:1},this.options.animation)}}}createNode(t){let e=super.createNode(t);return e.getSum=()=>e.linksFrom.concat(e.linksTo).reduce((t,e)=>t+e.weight,0),e.offset=t=>{let r=t=>t.fromNode===e?t.toNode:t.fromNode,n=0,a=e.linksFrom.concat(e.linksTo),o;a.sort((t,e)=>r(t).index-r(e).index);for(let t=0;t<a.length;t++)if(r(a[t]).index>e.index){a=a.slice(0,t).reverse().concat(a.slice(t).reverse()),o=!0;break}o||a.reverse();for(let e=0;e<a.length;e++){if(a[e]===t)return n;n+=a[e].weight}},e}createNodeColumns(){let t=[P.compose([],this)];for(let e of this.nodes)e.column=0,t[0].push(e);return t}getNodePadding(){return this.options.nodePadding/Math.PI}translate(){let t=this.options,e=2*Math.PI/(this.chart.plotHeight+this.getNodePadding()),r=this.getCenter(),n=(t.startAngle-90)*C,a=t.borderRadius,o="object"==typeof a?a.radius:a;for(let a of(super.translate(),this.nodeColumns[0]))if(a.sum){let s=a.shapeArgs,i=r[0],l=r[1],h=r[2]/2,d=h-g(("auto"===t.nodeWidth?20:t.nodeWidth)||0,h),c=n+e*(s.y||0),p=n+e*((s.y||0)+(s.height||0));for(let r of(a.angle=c+(p-c)/2,a.shapeType="arc",a.shapeArgs={x:i,y:l,r:h,innerR:d,start:c,end:p,borderRadius:o},a.dlBox={x:i+Math.cos((c+p)/2)*(h+d)/2,y:l+Math.sin((c+p)/2)*(h+d)/2,width:1,height:1},a.linksFrom))if(r.linkBase){let a,o,s=r.linkBase.map((s,h)=>{let c=e*s,p=Math.cos(n+c)*(d+1),u=Math.sin(n+c)*(d+1);return a=t.curveFactor||0,(o=Math.abs(r.linkBase[3-h]*e-c))>Math.PI&&(o=2*Math.PI-o),(o*=d)<d&&(a*=o/d),{x:i+p,y:l+u,cpX:i+(1-a)*p,cpY:l+(1-a)*u}});r.shapeArgs={d:[["M",s[0].x,s[0].y],["A",d,d,0,0,1,s[1].x,s[1].y],["C",s[1].cpX,s[1].cpY,s[2].cpX,s[2].cpY,s[2].x,s[2].y],["A",d,d,0,0,1,s[3].x,s[3].y],["C",s[3].cpX,s[3].cpY,s[0].cpX,s[0].cpY,s[0].x,s[0].y]]}}}}}N.defaultOptions=u(j.defaultOptions,{center:[null,null],curveFactor:.6,startAngle:0,dataLabels:{textPath:{enabled:!1,attributes:{dy:5}}}}),d(N.prototype,{orderNodes:!1,getCenter:S.prototype.getCenter}),N.prototype.pointClass=m,s().registerSeriesType("dependencywheel",N);let E=a();export{E as default};