/**
 * Highcharts JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/variwide
 * @requires highcharts
 *
 * Highcharts variwide 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={};e.n=t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},e.d=(t,i)=>{for(var s in i)e.o(i,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:i[s]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var s=e.n(i);let r=t.default.SeriesRegistry;var o=e.n(r);let{doc:n,win:a}=s();function l(t,e,i,r={}){let o="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(o,"hcEvents")||(o.hcEvents={});let n=o.hcEvents;s().Point&&t instanceof s().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let a=t.addEventListener;a&&a.call(t,e,i,!!s().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==e.indexOf("touch"):r.passive,capture:!1}),n[e]||(n[e]=[]);let c={fn:i,order:"number"==typeof r.order?r.order:1/0};return n[e].push(c),n[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 r(i){let r,o;t.nodeName&&(e?(r={})[e]=!0:r=i,u(r,function(t,e){if(i[e])for(o=i[e].length;o--;)s(e,i[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]||[];i?(t[e]=o.filter(function(t){return i!==t.fn}),s(e,i)):(r(t),t[e]=[])}else r(t),delete o.hcEvents}}(t,e,i)}}function c(t,e=0,i){let s=e%2/2,r=i?-1:1;return(Math.round(t*r-s)+s)*r}function h(t){return f(t)&&"number"==typeof t.nodeType}function p(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function f(t,e){let i;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(i=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==i)}function u(t,e,i){for(let s in t)Object.hasOwnProperty.call(t,s)&&e.call(i||t[s],t[s],s,t)}function d(){let t=arguments,e=t.length;for(let i=0;i<e;i++){let e=t[i];if(null!=e)return e}}Array.prototype.find;let{composed:y}=s();function x(t){this.variwide&&this.cross&&this.cross.attr("stroke-width",t.point?.crosshairWidth)}function v(){let t=this;this.chart.labelCollectors.push(function(){return t.variwide?t.tickPositions.filter(e=>!!t.ticks[e].label).map((e,i)=>{let s=t.ticks[e].label;return s.labelrank=t.zData?.[i],s}):[]})}function g(t){let e=this.axis,i=e.horiz?"x":"y";e.variwide&&(this[i+"Orig"]=t.pos[i],this.postTranslate(t.pos,i,this.pos))}function m(t,e,i){let s=this.axis,r=t[e]-s.pos;s.horiz||(r=s.len-r),r=s.series[0].postTranslate(i,r),s.horiz||(r=s.len-r),t[e]=s.pos+r}function b(t,e,i,s,r,o,n,a){let l=Array.prototype.slice.call(arguments,1),c=r?"x":"y";this.axis.variwide&&"number"==typeof this[c+"Orig"]&&(l[+!r]=this[c+"Orig"]);let h=t.apply(this,l);return this.axis.variwide&&this.axis.categories&&this.postTranslate(h,c,this.pos),h}let{column:{prototype:{pointClass:O}}}=o().seriesTypes,{column:A}=o().seriesTypes;class w extends A{processData(t){this.totalZ=0,this.relZ=[],o().seriesTypes.column.prototype.processData.call(this,t);let e=this.getColumn("z");(this.xAxis.reversed?e.slice().reverse():e).forEach(function(t,e){this.relZ[e]=this.totalZ,this.totalZ+=t},this),this.xAxis.categories&&(this.xAxis.variwide=!0,this.xAxis.zData=e)}postTranslate(t,e,i){let s=this.xAxis,r=this.relZ,o=s.reversed?r.length-t:t,n=s.reversed?-1:1,a=s.toPixels(s.reversed?(s.dataMax||0)+s.pointRange:s.dataMin||0),l=s.toPixels(s.reversed?s.dataMin||0:(s.dataMax||0)+s.pointRange),c=Math.abs(l-a),h=this.totalZ,p=this.chart.inverted?l-(this.chart.plotTop-n*s.minPixelPadding):a-this.chart.plotLeft-n*s.minPixelPadding,f=o/r.length*c,u=(o+n)/r.length*c,y=d(r[o],h)/h*c,x=d(r[o+n],h)/h*c;return i&&(i.crosshairWidth=x-y),p+y+(e-(p+f))*(x-y)/(u-f)}translate(){this.crispOption=this.options.crisp,this.options.crisp=!1,super.translate(),this.options.crisp=this.crispOption}correctStackLabels(){let t,e,i,s,r=this.options,o=this.yAxis;for(let n of this.points)s=n.x,e=n.shapeArgs.width,(i=o.stacking.stacks[(this.negStacks&&n.y<(r.startFromThreshold?0:r.threshold)?"-":"")+this.stackKey])&&(t=i[s])&&!n.isNull&&t.setOffset(-(e/2)||0,e||0,void 0,void 0,n.plotX,this.xAxis)}getXExtremes(t){let e=function(t){let e=t.length,i=t[0];for(;e--;)t[e]>i&&(i=t[e]);return i}(t),i=this.getColumn("z")[t.indexOf(e)];return{min:function(t){let e=t.length,i=t[0];for(;e--;)t[e]<i&&(i=t[e]);return i}(t),max:e+(this.xAxis.categories?0:i)}}}w.compose=({compose:function(t,e){var i,s;if(i="Variwide",0>y.indexOf(i)&&y.push(i)){let i,r=e.prototype;l(t,"afterDrawCrosshair",x),l(t,"afterRender",v),l(e,"afterGetPosition",g),r.postTranslate=m,i=r[s="getLabelPosition"],r[s]=function(){let t=arguments,e=this;return b.apply(this,[function(){return i.apply(e,arguments.length?arguments:t)}].concat([].slice.call(arguments)))}}}}).compose,w.defaultOptions=function(t,...e){let i,s=[t,...e],r={},o=function(t,e){return"object"!=typeof t&&(t={}),u(e,function(i,s){if("__proto__"!==s&&"constructor"!==s){let r;!f(i,!0)||(r=i?.constructor,f(i,!0)&&!h(i)&&r?.name&&"Object"!==r.name)||h(i)?t[s]=e[s]:t[s]=o(t[s]||{},i)}}),t};!0===t&&(r=s[1],s=Array.prototype.slice.call(s,2));let n=s.length;for(i=0;i<n;i++)r=o(r,s[i]);return r}(A.defaultOptions,{pointPadding:0,groupPadding:0}),l(w,"afterColumnTranslate",function(){let t=this.xAxis,e=this.chart.inverted,i=-1;for(let s of this.points){let r,o;++i;let n=s.shapeArgs||{},{x:a=0,width:l=0}=n,{plotX:h=0,tooltipPos:p,z:f=0}=s;t.variwide?(r=this.postTranslate(i,a,s),o=this.postTranslate(i,a+l)):(r=h,o=t.translate(s.x+f,!1,!1,!1,!0)),this.crispOption&&(r=c(r,this.borderWidth),o=c(o,this.borderWidth)),n.x=r,n.width=Math.max(o-r,1),s.plotX=(r+o)/2,p&&(e?p[1]=t.len-n.x-n.width/2:p[0]=n.x+n.width/2)}this.options.stacking&&this.correctStackLabels()},{order:2}),function(t,e){let i;for(i in t||(t={}),e)t[i]=e[i]}(w.prototype,{irregularWidths:!0,keysAffectYAxis:["y"],pointArrayMap:["y","z"],parallelArrays:["x","y","z"],pointClass:class extends O{isValid(){return p(this.y)&&p(this.z)}}}),o().registerSeriesType("variwide",w);let P=s();w.compose(P.Axis,P.Tick);let T=s();export{T as default};