/**
 * Highcharts JS v12.5.0 (2026-01-12)
 * @module highcharts/modules/funnel3d
 * @requires highcharts
 * @requires highcharts/highcharts-3d
 * @requires highcharts/modules/cylinder
 *
 * Highcharts funnel module
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Kacper Madej
 *
 * 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 r in i)e.o(i,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:i[r]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var r=e.n(i);let o=t.default.Color;var n=e.n(o);let s=t.default.RendererRegistry;var d=e.n(s);let{parse:h}=n(),{charts:a}=r(),{Element3D:l}=d().getRendererType().prototype,{merge:p}=r(),g=class extends l{constructor(){super(...arguments),this.mainParts=["top","bottom"],this.parts=["top","bottom","frontUpper","backUpper","frontLower","backLower","rightUpper","rightLower"],this.sideGroups=["upperGroup","lowerGroup"],this.sideParts={upperGroup:["frontUpper","backUpper","rightUpper"],lowerGroup:["frontLower","backLower","rightLower"]},this.pathType="funnel3d"}opacitySetter(t){let e=parseFloat(t),i=this.parts,r=a[this.renderer.chartIndex],o="group-opacity-"+e+"-"+r.index;if(this.parts=this.mainParts,this.singleSetterForParts("opacity",e),this.parts=i,!r.renderer.filterId){for(let t of(r.renderer.definition({tagName:"filter",attributes:{id:o},children:[{tagName:"feComponentTransfer",children:[{tagName:"feFuncA",attributes:{type:"table",tableValues:"0 "+e}}]}]}),this.sideGroups))this[t].attr({filter:"url(#"+o+")"});if(this.renderer.styledMode)for(let t of(r.renderer.definition({tagName:"style",textContent:".highcharts-"+o+" {filter:url(#"+o+")}"}),this.sideGroups))this[t].addClass("highcharts-"+o)}return this}fillSetter(t){let e=h(t),i=e.rgba[3],r={top:h(t).brighten(.1).get(),bottom:h(t).brighten(-.2).get()};if(i<1?(e.rgba[3]=1,e=e.get("rgb"),this.attr({opacity:i})):e=t,e.linearGradient||e.radialGradient||!this.gradientForSides||(e={linearGradient:{x1:0,x2:1,y1:1,y2:1},stops:[[0,h(t).brighten(-.2).get()],[.5,t],[1,h(t).brighten(-.2).get()]]}),e.linearGradient)for(let t of this.sideGroups){let i=this[t].gradientBox,o=e.linearGradient,n=p(e,{linearGradient:{x1:i.x+o.x1*i.width,y1:i.y+o.y1*i.height,x2:i.x+o.x2*i.width,y2:i.y+o.y2*i.height}});for(let e of this.sideParts[t])r[e]=n}else if(p(!0,r,{frontUpper:e,backUpper:e,rightUpper:e,frontLower:e,backLower:e,rightLower:e}),e.radialGradient)for(let t of this.sideGroups){let e=this[t].gradientBox,i=e.x+e.width/2,r=e.y+e.height/2,o=Math.min(e.width,e.height);for(let e of this.sideParts[t])this[e].setRadialReference([i,r,o])}if(this.singleSetterForParts("fill",null,r),this.color=this.fill=t,e.linearGradient)for(let t of[this.frontLower,this.frontUpper]){let e=t.element,i=e&&this.renderer.gradients[e.gradient];i&&"userSpaceOnUse"!==i.attr("gradientUnits")&&i.attr({gradientUnits:"userSpaceOnUse"})}return this}adjustForGradient(){let t;for(let e of this.sideGroups){let i={x:Number.MAX_VALUE,y:Number.MAX_VALUE},r={x:-Number.MAX_VALUE,y:-Number.MAX_VALUE};for(let o of this.sideParts[e])t=this[o].getBBox(!0),i={x:Math.min(i.x,t.x),y:Math.min(i.y,t.y)},r={x:Math.max(r.x,t.x+t.width),y:Math.max(r.y,t.y+t.height)};this[e].gradientBox={x:i.x,width:r.x-i.x,y:i.y,height:r.y-i.y}}}zIndexSetter(){return this.finishedOnAdd&&this.adjustForGradient(),this.renderer.Element.prototype.zIndexSetter.apply(this,arguments)}onAdd(){this.adjustForGradient(),this.finishedOnAdd=!0}},{charts:c}=r(),{error:f,extend:y,merge:x}=r();function u(t){let e=this.element3d("funnel3d",t),i=this.styledMode,r={"stroke-width":1,stroke:"none"};for(let t of(e.upperGroup=this.g("funnel3d-upper-group").attr({zIndex:e.frontUpper.zIndex}).add(e),[e.frontUpper,e.backUpper,e.rightUpper]))i||t.attr(r),t.add(e.upperGroup);for(let t of(e.lowerGroup=this.g("funnel3d-lower-group").attr({zIndex:e.frontLower.zIndex}).add(e),[e.frontLower,e.backLower,e.rightLower]))i||t.attr(r),t.add(e.lowerGroup);return e.gradientForSides=t.gradientForSides,e}function w(t){this.getCylinderEnd||f("A required Highcharts module is missing: cylinder.js",!0,c[this.chartIndex]);let e=c[this.chartIndex],i=t.alphaCorrection=90-Math.abs(e.options.chart.options3d.alpha%180-90),r=this.cuboidPath.call(this,x(t,{depth:t.width,width:(t.width+t.bottom.width)/2})),o=r.isTop,n=!r.isFront,s=!!t.middle,d=this.getCylinderEnd(e,x(t,{x:t.x-t.width/2,z:t.z-t.width/2,alphaCorrection:i})),h=t.bottom.width,a=x(t,{width:h,x:t.x-h/2,z:t.z-h/2,alphaCorrection:i}),l=this.getCylinderEnd(e,a,!0),p=h,g=a,y=l,u=l,w;s&&(p=t.middle.width,g=x(t,{y:t.y+t.middle.fraction*t.height,width:p,x:t.x-p/2,z:t.z-p/2}),y=this.getCylinderEnd(e,g,!1),u=this.getCylinderEnd(e,g,!1));let m={top:d,bottom:l,frontUpper:this.getCylinderFront(d,y),zIndexes:{group:r.zIndexes.group,top:3*(0===o),bottom:3*(1===o),frontUpper:n?2:1,backUpper:n?1:2,rightUpper:n?2:1}};return m.backUpper=this.getCylinderBack(d,y),w=Math.min(p,t.width)/Math.max(p,t.width)!=1,m.rightUpper=this.getCylinderFront(this.getCylinderEnd(e,x(t,{x:t.x-t.width/2,z:t.z-t.width/2,alphaCorrection:w?-i:0}),!1),this.getCylinderEnd(e,x(g,{alphaCorrection:w?-i:0}),!s)),s&&(w=Math.min(p,h)/Math.max(p,h)!=1,x(!0,m,{frontLower:this.getCylinderFront(u,l),backLower:this.getCylinderBack(u,l),rightLower:this.getCylinderFront(this.getCylinderEnd(e,x(a,{alphaCorrection:w?-i:0}),!0),this.getCylinderEnd(e,x(g,{alphaCorrection:w?-i:0}),!1)),zIndexes:{frontLower:n?2:1,backLower:n?1:2,rightLower:n?1:2}})),m}let m=t.default.SeriesRegistry;var b=e.n(m);let{seriesTypes:{column:A}}=b(),{extend:z}=r();class L extends A.prototype.pointClass{}z(L.prototype,{shapeType:"funnel3d"});let{deg2rad:C}=r(),{pick:U}=r();function v(t,e,i,r){let o=e.options.chart.options3d,n=U(r,!!i&&e.inverted),s={x:e.plotWidth/2,y:e.plotHeight/2,z:o.depth/2,vd:U(o.depth,1)*U(o.viewDistance,0)},d=e.scale3d||1,h=C*o.beta*(n?-1:1),a=C*o.alpha*(n?-1:1),l={cosA:Math.cos(a),cosB:Math.cos(-h),sinA:Math.sin(a),sinB:Math.sin(-h)};return i||(s.x+=e.plotLeft,s.y+=e.plotTop),t.map(function(t){var e,i,r;let o=(e=(n?t.y:t.x)-s.x,i=(n?t.x:t.y)-s.y,r=(t.z||0)-s.z,{x:l.cosB*e-l.sinB*r,y:-l.sinA*l.sinB*e+l.cosA*i-l.cosB*l.sinA*r,z:l.cosA*l.sinB*e+l.sinA*i+l.cosA*l.cosB*r}),h=G(o,s,s.vd);return h.x=h.x*d+s.x,h.y=h.y*d+s.y,h.z=o.z*d+s.z,{x:n?h.y:h.x,y:n?h.x:h.y,z:h.z}})}function G(t,e,i){let r=i>0&&i<1/0?i/(t.z+e.z+i):1;return{x:t.x*r,y:t.y*r}}function M(t){let e=0,i,r;for(i=0;i<t.length;i++)r=(i+1)%t.length,e+=t[i].x*t[r].y-t[r].x*t[i].y;return e/2}let{noop:k}=r(),{perspective:B}={perspective:v,perspective3D:G,pointCameraDistance:function(t,e){let i=e.options.chart.options3d,r={x:e.plotWidth/2,y:e.plotHeight/2,z:U(i.depth,1)*U(i.viewDistance,0)+i.depth};return Math.sqrt(Math.pow(r.x-U(t.plotX,t.x),2)+Math.pow(r.y-U(t.plotY,t.y),2)+Math.pow(r.z-U(t.plotZ,t.z),2))},shapeArea:M,shapeArea3D:function(t,e,i){return M(v(t,e,i))}},{series:F,seriesTypes:{column:S}}=b(),{extend:E,merge:P,pick:I,relativeLength:W}=r();class T extends S{alignDataLabel(t,e,i){let r=t.dlBoxRaw,o=this.chart.inverted,n=t.plotY>I(this.translatedThreshold,this.yAxis.len),s=I(i.inside,!!this.options.stacking),d={x:r.x,y:r.y,height:0};i.align=I(i.align,!o||s?"center":n?"right":"left"),i.verticalAlign=I(i.verticalAlign,o||s?"middle":n?"top":"bottom"),"top"!==i.verticalAlign&&(d.y+=r.bottom/("bottom"===i.verticalAlign?1:2)),d.width=this.getWidthAt(d.y),this.options.reversed&&(d.width=r.fullWidth-d.width),s?d.x-=d.width/2:"left"===i.align?(i.align="right",d.x-=1.5*d.width):"right"===i.align?(i.align="left",d.x+=d.width/2):d.x-=d.width/2,t.dlBox=d,S.prototype.alignDataLabel.apply(this,arguments)}bindAxes(){F.prototype.bindAxes.apply(this,arguments),E(this.xAxis.options,{gridLineWidth:0,lineWidth:0,title:void 0,tickPositions:[]}),P(!0,this.yAxis.options,{gridLineWidth:0,title:void 0,labels:{enabled:!1}})}translate(){F.prototype.translate.apply(this,arguments);let t=this.chart,e=this.options,i=e.reversed,r=e.ignoreHiddenPoint,o=t.plotWidth,n=t.plotHeight,s=e.center,d=W(s[0],o),h=W(s[1],n),a=W(e.width,o),l=W(e.height,n),p=W(e.neckWidth,o),g=W(e.neckHeight,n),c=h-l/2+l-g,f=this.points,y=0,x=0,u,w,m,b,A,z,L,C,U;for(let t of(this.getWidthAt=w=function(t){return t>c||l===g?p:p+(a-p)*(1-(t-(h-l/2))/(l-g))},this.center=[d,h,l],this.centerX=d,f))r&&!1===t.visible||(y+=t.y);for(let o of f)L=null,m=y?o.y/y:0,z=(A=h-l/2+x*l)+m*l,u=w(A),C=z-A,(U={gradientForSides:I(o.options.gradientForSides,e.gradientForSides),x:d,y:A,height:C,width:u,z:1,top:{width:u}}).bottom={fraction:m,width:u=w(z)},A>=c?U.isCylinder=!0:z>c&&(L=z,u=w(c),z=c,U.bottom.width=u,U.middle={fraction:C?(c-A)/C:0,width:u}),i&&(U.y=A=h+l/2-(x+m)*l,U.middle&&(U.middle.fraction=1-(C?U.middle.fraction:0)),u=U.width,U.width=U.bottom.width,U.bottom.width=u),o.shapeArgs=E(o.shapeArgs,U),o.percentage=100*m,o.plotX=d,i?o.plotY=h+l/2-(x+m/2)*l:o.plotY=(A+(L||z))/2,b=B([{x:d,y:o.plotY,z:i?-(a-w(o.plotY))/2:-w(o.plotY)/2}],t,!0)[0],o.tooltipPos=[b.x,b.y],o.dlBoxRaw={x:d,width:w(o.plotY),y:A,bottom:U.height||0,fullWidth:a},r&&!1===o.visible||(x+=m)}}T.compose=function(t){let e=t.prototype;e.funnel3d||(e.Element3D.types.funnel3d=g,y(e,{funnel3d:u,funnel3dPath:w}))},T.defaultOptions=P(S.defaultOptions,{center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",reversed:!1,gradientForSides:!0,animation:!1,edgeWidth:0,colorByPoint:!0,showInLegend:!1,dataLabels:{align:"right",crop:!1,inside:!1,overflow:"allow"}}),E(T.prototype,{pointClass:L,translate3dShapes:k}),b().registerSeriesType("funnel3d",T),T.compose(d().getRendererType());let O=r();export{O as default};