pace-chart-lib 1.0.82 → 1.0.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6262,7 +6262,7 @@ const Wr = ({
6262
6262
  ), f.selectAll(".annotation-group").remove(), Ue();
6263
6263
  }, Fa = (Ue) => {
6264
6264
  let Ze = Ue.data.map((Qe) => Qe.legend);
6265
- S = v.stack().keys(Ze).offset(v.stackOffsetNone)(Ue.stackData), Ue.data.forEach(
6265
+ S = v.stack().keys(Ze).offset(v.stackOffsetDiverging)(Ue.stackData), Ue.data.forEach(
6266
6266
  (Qe, tt) => Qe.data.forEach((je, Ve) => {
6267
6267
  je[0] = S[tt][Ve][0], je[1] = S[tt][Ve][1];
6268
6268
  })
@@ -13318,7 +13318,7 @@ const qr = ({
13318
13318
  (Se) => Ne.includes(Se.dimension)
13319
13319
  )
13320
13320
  ));
13321
- const ie = v.stack().keys(E.legendList).offset(v.stackOffsetNone)(j);
13321
+ const ie = v.stack().keys(E.legendList).offset(v.stackOffsetDiverging)(j);
13322
13322
  P();
13323
13323
  let Fe = 1 / 0, ce = -1 / 0;
13324
13324
  for (const we of ie)
@@ -13633,7 +13633,7 @@ const qr = ({
13633
13633
  Re,
13634
13634
  R
13635
13635
  );
13636
- oe = v.stack().keys(E.legendList).offset(v.stackOffsetNone)(C), Re.forEach(
13636
+ oe = v.stack().keys(E.legendList).offset(v.stackOffsetDiverging)(C), Re.forEach(
13637
13637
  (j, ie) => j.data.forEach((Fe, ce) => {
13638
13638
  Fe[0] = oe[ie][ce][0], Fe[1] = oe[ie][ce][1];
13639
13639
  })
@@ -13853,7 +13853,7 @@ const qr = ({
13853
13853
  R.dimensionList,
13854
13854
  A,
13855
13855
  oe
13856
- ), j = v.stack().keys(R.legendList).offset(v.stackOffsetNone)(re);
13856
+ ), j = v.stack().keys(R.legendList).offset(v.stackOffsetDiverging)(re);
13857
13857
  V();
13858
13858
  let ie = 1 / 0;
13859
13859
  for (const ce of j)
@@ -14123,7 +14123,7 @@ const qr = ({
14123
14123
  Ne,
14124
14124
  oe
14125
14125
  );
14126
- Me = v.stack().keys(R.legendList).offset(v.stackOffsetNone)(P), Ne.forEach(
14126
+ Me = v.stack().keys(R.legendList).offset(v.stackOffsetDiverging)(P), Ne.forEach(
14127
14127
  (re, j) => re.data.forEach((ie, Fe) => {
14128
14128
  Me[j][Fe] && (ie[0] = Me[j][Fe][0], ie[1] = Me[j][Fe][1]);
14129
14129
  })
@@ -70,7 +70,7 @@ let E=t<200?200:S?e:t,b=e<200?200:S?t:e,U=E*.15*.8,Y=Ol(r,l),H=U<Y[0]+10?U:Y[0]+
70
70
  </div>
71
71
 
72
72
  </div>
73
- `,w},"");g.html(x?`<div class="tooltipInner" style="display:flex; flex-direction:column; font-size:${Kl}; color:${m}; line-height:${Ql};">${x}</div>`:`<div class="arrow-placeholder"></div><div class="tooltipInner" style="display:flex; flex-direction:column;">${b}</div>`);const U=g.node(),Y=U.offsetWidth,H=U.offsetHeight;let I=A+15,D=E+15;I+Y>window.innerWidth&&(I=A-Y-10),D+H>window.innerHeight&&(D=E-H-10),g.style("left",`${I}px`).style("top",`${D}px`).style("visibility",e.toolTip.toolTipVisibility?"visible":"hidden")}catch(l){console.error("Tooltip Error:",l)}}function ot(){try{v.select("#chartTooltipDiv").html("").style("visibility",Et.hidden)}catch(t){me(xt,"hideTooltipOnMouseOut",t)}}const Xt=(t,e,n,o)=>{try{let l=v.select(t.current).append("foreignObject").attr("visibility",o.chartTitle.chartTitleVisibility?Et.visible:Et.hidden).attr("transform","translate(2,2)").attr("class","chartTitle").attr("width",n).attr("height",e+"px");o.chartTitle.dynamicTitleText.length!==0?l.append("xhtml:div").style("color","rgba(119,119,119)").attr("title",o.chartTitle.chartTitleText).style("white-space","pre").style("text-overflow","ellipsis").style("overflow",Et.visible).style("line-height","1.3em").html(o.chartTitle.chartTitleHTML?o.chartTitle.chartTitleHTML:o.chartTitle.chartTitleText):l.append("xhtml:div").style("white-space","pre").style("user-select","none").style("text-overflow","ellipsis").style("overflow",Et.visible).style("line-height","1.3em").attr("class","chartTiltle").attr("id","chartTitleId").style("text-anchor","start").style("color","rgba(119,119,119)").style("font-size","16px").style("font-family",o.chartTitle.chartTitleFontFamily).attr("title",o.chartTitle.chartTitleText).html(o.chartTitle.chartTitleText)}catch(x){me(xt,"drawChartTitle",x)}},qi=(t,e)=>{try{return t.reduce((n,o)=>{const x=typeof o=="string"?o:e&&typeof o=="object"&&o[e]||"";return x.length>n.length?x:n},"")}catch(n){me(xt,"findStringWithLongestLength",n)}},xa=(t,e,n,o,x,l,r,c,p,m,L,u=!1,S)=>{try{if(m.legends.legendVisibility){let W="",A="";r==Je.left||r==Je.right?(A="column",W=c==Ea.top?"start":c==Ea.middle?"center":"end"):(A="row",W=c==Ra.start?"start":c==Ra.middle?"center":"end");var g=t.append("foreignObject").attr("x",n).attr("y",o).style("pointer-events","auto").attr("width",x+"px").attr("height",l+"px").style("user-select","none").append("xhtml:div").attr("id","legendObject"+L).attr("class","legendsBoxWrapper").style("width",x+"px").style("display","flex").style("height",l-1+"px").style("overflow","auto").style("pointer-events","auto").style("justify-content","safe "+W).style("flex-direction",A).style("outline-offset","-"+m.legends.legendBorderThickness+"px").style("outline",m.legends.legendBorder?`${m.legends.legendBorderThickness+"px solid"+m.legends.legendBorderColor}`:"none").append("div").attr("class","scrollbar").style("display","flex").style("flex-direction",A).style("flex-wrap","nowrap").style("padding-left","3px");(r==Je.top||r==Je.bottom)&&g.style("flex-direction","row"),e.forEach((b,U)=>{let Y=g.append("div").style("display","inline-flex").style("justify-content","flex-start").style("align-items","center").style("width","fit-content").style("margin","3px 0px").style("flex-wrap","nowrap").style("white-space","nowrap").on("dblclick",function(){S(b?.properties)}).on("mousemove",function(){if(m.legends.onHoverEffect){const w=this.textContent.replace(/\s+/g,"-");t.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!0),t.selectAll(`[hoverId="${w}"]`).classed("highlight",!0).classed("unhighlight",!1),t.selectAll(".cleveland-line-group").classed("highlight",!1).classed("unhighlight",!0)}}).on("mouseout",function(){if(m.legends.onHoverEffect){const w=this.textContent.replace(/\s+/g,"-");t.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!1),t.selectAll(`[hoverId="${w}"]`).classed("highlight",!1).classed("unhighlight",!1),t.selectAll(".cleveland-line-group").classed("highlight",!1).classed("unhighlight",!1)}});(r==Je.top||r==Je.bottom)&&Y.style("margin-right",u?"0px":"16px").style("white-space","nowrap");let H;if(!p){let w=b.properties.type;w==le.ColumnChart||w==le.StackColumnChart?H=ct.rectangle:w==le.LineChart||w==le.StackLineChart?H=ct.line:(w==le.AreaChart||w==le.StackAreaChart)&&(H=ct.areaWithLine)}(p||H)==ct.circle?ir(b,Y):(p||H)==ct.hollowCircle?lr(b,Y):(p||H)==ct.line?Ki(b,Y,m):(p||H)==ct.areaWithLine?Qi(b,Y,m):(p||H)==ct.rectangle&&rr(b,Y);let I=u&&(r==Je.bottom||r==Je.top)&&U!=e.length-1?" |":"",D=u?m.legends.legendSelectedUnicolor:m.legends.legendColorMode==Vl.multiColor?b.properties.color?b.properties.color:Ie.black:m.legends.legendSelectedUnicolor;Y.append("div").style("margin-left","5px").style("color",D).style("background",b.properties.axis==Qe.secondary&&m.secondaryYAxisLabel.secondaryYAxisBackgroundColor).style("font-size",(u?m.legends.legendFontSize:b.properties.fontSize)+"px").style("font-family",u?m.legends.legendFontFamily:b.properties.fontFamily).style("font-style",()=>(u?m.legends.legendFontStyle:b.properties.fontStyle).includes(ce.italic)?ce.italic:"").style("text-decoration",()=>(u?m.legends.legendFontStyle:b.properties.fontStyle).includes(ce.underline)?ce.underline:"").style("font-weight",()=>(u?m.legends.legendFontStyle:b.properties.fontStyle).includes(ce.bold)?ce.bold:"").style("white-space","nowrap").attr("title",u?b.legendDisplay+" : "+b.actualValue:b.properties.alias).html(u?b.legendDisplay+" : "+b.actualValue+I:b.properties.alias)})}}catch(W){me(xt,"legendsWithScroll",W)}};function ir(t,e){try{e.append("div").style("height","12px").style("width","12px").style("border-radius","50%").style("background",t.properties.color)}catch(n){me(xt,"getCircleShape",n)}}function lr(t,e){try{e.append("div").style("height","12px").style("width","12px").style("border-radius","50%").style("border",`3px solid ${t.properties.Color??t.properties.color}`)}catch(n){me(xt,"getHollowCircleShape",n)}}function Ki(t,e,n){try{const o=t.properties?.lineStyle?.toLowerCase()||"solid";let x=e.append("div").style("height","2px").style("width",o=="dashed"?"25px":"20px").style("background",Ie.transparent).style("position","relative").style("border-top",o=="none"?"unset":o=="dotted"?"2px dotted "+t.properties.color:o=="dashed"?"2px dashed "+t.properties.color:"2px solid "+t.properties.color);if(n.marker.markerVisibility)switch(t.properties.markerShape.toLowerCase()){case"circle":x.append("div").append("svg").style("position","absolute").style("left","50%").style("top","50%").attr("transform","translate(-5,-6)").attr("height","10px").attr("width","10px").append("circle").attr("cx","5").attr("cy","5").attr("r","4.5").style("fill",t.properties.markerColor);break;case"square":x.append("div").style("position","absolute").style("left","50%").style("top","50%").style("transform","translate(-2px, -7px)").style("height","8px").style("width","8px").style("top","2px").style("left","9px").style("background",t.properties.markerColor);break;case"triangle":x.append("div").style("position","absolute").style("transform","translate(5px, -6.5px)").style("border-left","6px solid transparent").style("border-right","6px solid transparent").style("border-bottom",`10px solid ${t.properties.markerColor}`);break;case"cross":x.append("div").style("position","absolute").style("left","50%").style("top","50%").style("transform","translate(-5px, -3px)").style("height","4px").style("width","10px").style("background",t.properties.markerColor).append("div").style("height","10px").style("width","4px").style("background",t.properties.markerColor).style("position","relative").style("top","-3px").style("left","3px");break;case"diamond":x.append("div").style("height","7px").style("width","7px").style("background",t.properties.markerColor).style("transform","rotate(45deg)").style("top","-4px").style("left","7px").style("position","absolute");break;case"star":x.append("div").style("border-left","4px solid transparent").style("border-right","4px solid transparent").style("border-bottom",`8px solid ${t.properties.markerColor}`).style("position","absolute").style("top","-6.5px").style("left","7px").style("transform","rotate(0deg)").append("div").style("border-left","4px solid transparent").style("border-right","4px solid transparent").style("border-top",`8px solid ${t.properties.markerColor}`).style("position","absolute").style("top","2px").style("left","-4px").style("transform","rotate(360deg)");break;case"wye":x.append("div").style("height","6.5px").style("width","3px").style("background",t.properties.markerColor).style("position","absolute").style("left","10px").style("top","-3.5px").append("div").style("height","5px").style("width","3px").style("background",t.properties.markerColor).style("transform","rotate(-55deg)").style("position","relative").style("top","-2px").style("left","-2px").append("div").style("height","5px").style("width","3px").style("background",t.properties.markerColor).style("transform","rotate(108deg)").style("position","relative").style("top","3px").style("left","2px");break;case"none":default:break}}catch(o){me(xt,"getLineShape",o)}}function Qi(t,e,n){try{let o=e.append("div").style("height","10px").style("width","15px").style("background",t.properties.color).style("display","flex").style("flex-direction","column").style("border-radius","1px");if(n.marker.markerVisibility)switch(t.properties.markerShape.toLowerCase()){case"circle":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.color).style("position","relative").append("svg").style("position","absolute").style("left","50%").style("top","50%").attr("transform","translate(-5,-5)").attr("height","10px").attr("width","10px").append("circle").attr("cx","5").attr("cy","5").attr("r","2.5").style("fill",t.properties.markerColor);break;case"square":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("position","absolute").style("left","50%").style("top","50%").style("transform","translate(-4px, -3.5px)").style("height","5px").style("width","5px").style("top","2px").style("left","9px").style("background",t.properties.markerColor).style("border-radius","1px");break;case"triangle":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("position","absolute").style("transform","translate(5px, -3.5px)").style("border-left","3px solid transparent").style("border-right","3px solid transparent").style("border-bottom",`7px solid ${t.properties.markerColor}`);break;case"cross":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("position","absolute").style("left","50%").style("top","50%").style("transform","translate(-3px, -2px)").style("height","4px").style("width","7px").style("background",t.properties.markerColor).append("div").style("height","6px").style("width","3px").style("background",t.properties.markerColor).style("position","relative").style("top","-1px").style("left","2px");break;case"diamond":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("height","4px").style("width","4px").style("background",t.properties.markerColor).style("transform","rotate(45deg)").style("top","-1px").style("left","5px").style("position","absolute");break;case"star":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("border-left","2.5px solid transparent").style("border-right","2.5px solid transparent").style("border-bottom",`6px solid ${t.properties.markerColor}`).style("position","absolute").style("top","-3px").style("left","6px").style("transform","rotate(0deg)").append("div").style("border-left","2.5px solid transparent").style("border-right","2.5px solid transparent").style("border-top",`6px solid ${t.properties.markerColor}`).style("position","absolute").style("top","0.5px").style("left","-2px").style("transform","rotate(360deg)");break;case"wye":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("height","4.5px").style("width","2px").style("background",t.properties.markerColor).style("position","absolute").style("left","6.5px").style("top","-0.5px").append("div").style("height","3px").style("width","2px").style("background",t.properties.markerColor).style("transform","rotate(-55deg)").style("position","relative").style("top","-2px").style("left","-2px").append("div").style("height","3px").style("width","2px").style("background",t.properties.markerColor).style("transform","rotate(108deg)").style("position","relative").style("top","3px").style("left","2px");break;case"none":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor);break;default:break}o.append("div").style("height","20%").style("width","100%").style("background","white"),o.append("div").style("height","60%").style("width","100%").style("background",t.properties.color).style("border-radius","1px")}catch(o){me(xt,"getAreaShape",o)}}function rr(t,e){try{e.append("div").style("height","10px").style("width","15px").style("border-style",t).style("border-width",t).style("border-color",t).style("background",t.properties.color).style("border-radius","1px")}catch(n){me(xt,"getReactShape",n)}}const qt=(t,e,n,o)=>{try{let x=t.current;x.setAttribute("viewBox",`0 0 ${e} ${n}`);const{chartAreaColor:l,chartAreaBorder:r}=o.chartArea;if(x.style.backgroundColor=l,r){let p=o.chartArea.chartAreaBorderColor,m=o.chartArea.chartAreaBorderThickness+"px",L=rt(o.chartArea.chartAreaBorderStyle),u=L==1?"solid":L==2?"dashed":"dotted";x.style.outline=`${m} ${u} ${p}`,x.style.outlineOffset=`-${m}`}else x.style.outline="unset"}catch(x){me(xt,"initSvg",x)}},oa=(t,e)=>{try{return t.append("g").attr("transform",`translate(${e.left},${e.top})`).attr("font-color","#ccc")}catch(n){me(xt,"initChartArea",n)}},Kt=(t,e)=>{try{let n=v.select(t.current);n.selectAll("*").remove();let o=Zi(Ri,e),x=t.current.getBoundingClientRect(),l=x.width,r=x.height;return{chartFormatOptions:o,svg:n,width:l,height:r}}catch(n){me(xt,"firstFunctionBeforeRender",n)}},Ua=(t,e,n,o,x,l=!1)=>{try{let r=t.legends.legendPosition;r=t.legends.legendVisibility?t.legends.legendPosition:Je.none;let c=e*.15*.8,p=l?o[0]:c<o[0]+15?c:o[0]+15,m=t.chartTitle.chartTitleVisibility?t.chartTitle.dynamicTitleText.length!==0?$t(t.chartTitle.chartTitleHTML,void 0,void 0).height:$t(t.chartTitle.chartTitleText,16,tt).height:5;switch(r){case Je.none:x.top=m+10,x.bottom=15,x.right=15,x.left=15;break;case Je.top:x.top=m+50,x.bottom=15,x.right=15,x.left=15;break;case Je.right:x.right=p+50,x.top=m+15,x.bottom=15,x.left=15;break;case Je.bottom:x.bottom=45,x.top=m+15,x.right=15,x.left=15;break;case Je.left:x.left=p+50,x.top=m+15,x.bottom=15,x.right=15}let L=n-x.top-x.bottom,u=e-x.left-x.right;return{margins:x,innerHeight:L,innerWidth:u,legendListWidth:p,chartTitleHeight:m}}catch(r){me(xt,"marginCalculationsForChartsWithoutAxis",r)}},Wa=(t,e,n,o,x,l,r,c,p,m,L=!0,u)=>{try{let S=t.legends.legendPosition,g=t.total.totalPosition,W=t.total.totalAlignment,A=t.total.totalVisibility&&L,E=t.legends.legendAlignmentTopBottom,b=t.legends.legendAlignment;switch(S){case Je.none:break;case Je.right:xa(e,n,o-l-25,r+5+(A&&g==Fa.top&&W==Wt.end?10:0),l+15,x-r-10-(A?g==Fa.top&&W==Wt.end?10:g==Fa.bottom&&W==Wt.start?25:0:0),S,b,m,t,c,!1,u);break;case Je.top:xa(e,n,5,r+5,o-10,30,S,E,m,t,c,!1,u);break;case Je.left:xa(e,n,5,p.top+(A&&g==Fa.top&&W==Wt.start?10:0),l+15,x-r-10-(A?g==Fa.top&&W==Wt.start?10:g==Fa.bottom&&W==Wt.start?25:0:0),S,b,m,t,c,!1,u);break;case Je.bottom:xa(e,n,5,x-35,o-10,30,S,E,m,t,c,!1,u);break}}catch(S){me(xt,"initLegendListWithTotalValueAllowance",S)}},Ha=(t,e,n="legend")=>{try{let o=$t(qi(e,n),rt(t.legends.legendFontSize),t.legends.legendFontFamily);return[o.width,o.height]}catch(o){me(xt,"calculateLegendsMaxPossibleWidth",o)}},ri=(t,e,n,o=!1)=>{try{let x=t.chartTitle.chartTitleVisibility?t.chartTitle.dynamicTitleText.length!==0?$t(t.chartTitle.chartTitleHTML,void 0,void 0).height:$t(t.chartTitle.chartTitleText,16,tt).height:5,l={top:t.chartTitle.chartTitleVisibility?x:20,bottom:o&&t.colorScale.showColor==Ta.colorTheme?40:20,left:20,right:20};return innerHeight=e-l.top-l.bottom,innerWidth=n-l.left-l.right,{margins:l,chartTitleHeight:x,innerHeight,innerWidth}}catch(x){me(xt,"marginCalculationsForChartsWithoutLegends",x)}},rt=t=>{try{if(typeof t!="string")return t;const e=t.trim();if(e==="")return t;const n=parseFloat(e);return isNaN(n)?t:n}catch(e){me(xt,"convertStringToNumber",e)}};function mt(t,e,n=!1){try{return t.map(o=>{let x;o.properties?x={...ji,...o.properties}:x={...ji,legend:o.legend,currentLegend:o.legend,alias:o.legend,name:o.legend};const l=e&&e.length!==0?e.map(r=>{const c=o.data.find(p=>p.dimension===r);return c?{...c}:{dimension:r,legend:o.legend,value:0}}):o.data.map(r=>({...r}));return{...o,properties:x,data:n?o.data:l}})}catch(o){me(xt,"generalizedChartData",o)}}const mi=(t="")=>{try{return t.replace(/(#|;|&|,|\.|\+|\*|~|'|:|"|!|\^|\$|\[|\]|\(|\)|=|<|>|\||\/)/g,"\\$1")}catch(e){me(xt,"getJQuerySelector",e)}},fi=(t,e,n,o,x,l,r)=>{try{let c=t-e,p=l-x,m=parseInt(r.connector.connectorKPI),L,u;switch(m){case 1:if(L=`.${n}f`,e==0&&t==0)return"0";if(e==0&&t!=0)return v.format(L)(t);c=Math.abs(c);break;case 3:return L=`.${n}%`,e==0&&t==0?"0%":e==0&&t!=0?v.format(L)(t):(c=Math.round(t/e*100-100)/100,u=v.format(L)(c),u);case 2:return x.toString().length!==4&&(p=NaN),L=`.${n}%`,e==0&&t==0?"0%":e==0&&t!=0?v.format(L)(t):(c=Math.pow(t/e,1/p)-1,u=v.format(L)(c),u)}if(e==0)return"N/A";{let S,g="",W=r.connector.connectorDisplayUnits;switch(W!="None"&&W!=null&&(W=="Thousands"&&(S=1e3,g="K"),W=="Millions"&&(S=1e6,g="M"),W=="Billions"&&(S=1e9,g="B"),c=c/S),isNaN(c)&&(c=0),o){case",.0%":return L=`.${n}%`,v.format(L)(c);case"":return L=`.${n}f`,v.format(L)(c)+g;case".2n":return L=`.${n}n`,v.format(L)(c)+g;case".2$":return L=`,.${n}f`,"$"+v.format(L)(c)+g;case".2c":return L=`,.${n}f`,"C$"+v.format(L)(c)+g;case".2ē":return L=`,.${n}f`,"€"+v.format(L)(c)+g;case".2ch":return L=`,.${n}f`,"CHF"+v.format(L)(c)+g;case",":return L=`,.${n}f`,v.format(L)(c)+g;case".2£":return L=`,.${n}f`,"£"+v.format(L)(c)+g;case".2₹":return L=`,.${n}f`,"₹"+v.format(L)(c)+g;default:return L=".2f",v.format(L)(c)+g}}}catch{}},Xa=t=>{try{return t.includes("~$~")?t.split("~$~")[1].replace(/ /g,"-"):t.replace(/\s+/g,"-")}catch{return t}};function nr(t,e,n){try{let o=function(l){const r=l.split(" - ");return r.length>1?r[0]:l};const x=new Map;return e?.LegendList?.forEach(l=>{x.set(n?o(l?.name):l.measureUniqueId,l)}),t.map(l=>({...l,properties:x.get(n?o(l.legend):l.properties.measureUniqueId)??l.properties})).filter(l=>l.data[0].value!==0)}catch{return t}}const sr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID();let L=0,u=!1;const S=le.ColumnChart,g=Ce.useRef(),W=Ce.useRef(r);W.current=r;const A=Ce.useRef(c);A.current=c;const E=Ce.useRef(p);E.current=p;const b=mt(n.ChartData,n.DimensionList),U=n.DimensionList,Y=!1;let H=!1;const I=!1;let D=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,w=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,z=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,K=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue=[],ve=0,Pe=0,Ye=[];const We=new Map;let be={dimensionList:U,chartType:S,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{ze()}catch(ee){me("Columnchart","createColumnChart",ee)}},[e]);const ze=()=>{({formatOptions:e,svg:f,width:i,height:y}=Ft(g,e)),{formatOptions:e,dataTableLegendsList:Ye}=ea(e,b,n.DataTableData??[]),ke(),{maxNumberForPrimaryAxis:h,maxNumberForSecondaryAxis:k,customYaxisMaxValue:w,secondaryCustomYaxisMaxValue:K}=Rt(e,be.yMinLeft,be.yMaxLeft,be.yMinRight,be.yMaxRight),{margin:ye,yLabel:se,xLabel:te,yTitle:xe,xTitle:ge,dimensionHeightWidthArray:pe,chartTitleHeight:he,secondaryAxisTitleWidth:O,legendMargin:X,secondaryYLabel:M,visibleBars:Pe,columnWidth:L,scrollbarVisible:u}=Mt(i,y,h,k,be.yMaxLeft,e,be.legendList,be.dimensionList,be.yMaxRight,H,I,t,!1,be,Ye),_(ye),{dataTable:T,dataTableHeight:a}=ia(e,se,xe,b,be.dimensionList,n),St(f,i,y,e),N=wt(f,ye),kt(N,e,a,s,d,S,m),Se(),$(),Zt(N,e,a,se,Me,d),H&&bi(N,e,a,M,Ee,d,s),Dt(e,Y,f,ye,te,y,ge,be.chartType,se,s,d),Vt(d,e,a,Y,f,ye,xe,se),Gt(f,H,ye,e,a,d,s,M,O),Nt(f,e,i,he),It(y,f,pe,he,i,X,e,b,m,a,ye,ct.rectangle,S,l),_t(b,y,i,f,ye,s,u,Pe,be,ve,!1,G)},ke=()=>{const ee=[],F=[];let q=[],ue=-1/0,B=1/0,V=-1/0,P=1/0,C=1/0,re=-1/0;b.forEach(j=>{F.push(j.properties.legendUniqueId),re=-1/0,C=1/0,j.data.forEach(ie=>{ee.push(ie),j.properties.axis==="Secondary"?(H=!0,V=Math.max(V,ie.value),P=Math.min(P,ie.value)):(ue=Math.max(ue,ie.value),B=Math.min(B,ie.value)),re=Math.max(re,ie.value),C=Math.min(C,ie.value)}),j.properties.setColorScale&&We.set(j.properties.legendUniqueId,v.scaleSequential().domain([C,re]).interpolator(yi.interpolateRgb(j.properties.startColor,j.properties.endColor)))}),be.chartData=ee,be.legendList=F,be.yMaxLeft=ue,be.yMinLeft=B>0?0:B,be.yMaxRight=V,be.yMinRight=P>0?0:P,q=t?Tt(e.xAxisLabel.xAxisNumberFormat,be.dimensionList).map(j=>j):be.dimensionList,be.dimensionList.forEach((j,ie)=>{be.formattedDimensionListMap.set(j,q[ie])}),Ue=JSON.parse(JSON.stringify(b)),Le=be.dimensionList,e.plotArea.hideZeroValues&&(be.hideZeroValues=!0)},Se=()=>{let ee=yt(w||be.yMaxLeft,be.yMinLeft,d,e,be,D,w).yAxisLabelArray;if(be.yMaxLeft=ee[ee.length-1],be.yMinLeft=ee[0],ne=v.scaleLinear().domain([be.yMinLeft>=0?D!==void 0&&!Number.isNaN(D)?D:0:be.yMinLeft<0?be.yMinLeft*1.1:be.yMinLeft*.9,be.yMaxLeft<=0?0:w!==void 0&&!Number.isNaN(w)?w:be.yMaxLeft*1.1]).range([a>0?d-a:d,0]),H){let F=yt(K||be.yMaxRight,be.yMinRight,d,e,be,z,K).yAxisLabelArray;be.yMaxRight=F[F.length-1],be.yMinRight=F[0],Z=v.scaleLinear().domain([be.yMinRight>=0?(z||z==0)&&!Number.isNaN(z)?z:0:(z||z==0)&&!Number.isNaN(z)?z:be.yMinRight*1.1,be.yMaxRight<=0?K||0:K||be.yMaxRight*1.1]).range([a>0?d-a:d,0])}Te=[0,s],oe()},oe=()=>{Re=v.scaleBand().domain(be.legendList).range([0,L]).paddingInner(be.legendList.length>1?.3*parseFloat(e.plotArea.plotAreaSeriesWidth)/100:0),fe=v.scalePoint().domain(Le).range(Te).padding(.5)},$=()=>{{let ee=yt(w||be.yMaxLeft,be.yMinLeft,d,e,be,D,w);Me=v.axisLeft(ne).tickFormat(F=>Xe(F,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,s)).tickValues(ee.autoLabelFlag?void 0:ee.yAxisLabelArray).ticks(ee.customTickValue??d/30).tickPadding(8).tickSizeOuter(0)}if(H){let ee=yt(K||be.yMaxRight,z||be.yMinRight,d,e,be,z,K);Ee=v.axisRight(Z).tickFormat(F=>Xe(F,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(ee.autoLabelFlag?void 0:ee.yAxisLabelArray).ticks(ee.customTickValue??d/30).tickSize(zt(e,s)).tickPadding(8).tickSizeOuter(0)}},R=()=>{J=(parseInt(e.xAxisLabel.xAxisPosition)==1?v.axisTop(fe):v.axisBottom(fe)).tickSize(sa(e,d,a)).tickSizeOuter(0).tickValues(gt(Le,s,e))},ae=ee=>{ee.forEach(F=>{F.data.forEach(q=>{q.hideZero=F.properties.hideZeroValues,q.axis=F.properties.axis,q.legendUniqueId=F.properties.legendUniqueId})}),Le.forEach(F=>{N.append("rect").attr("id",`dim-background-${F}`).attr("class","dimension-background").attr("x",fe(F)-fe.step()/2).attr("width",fe.step()).attr("y",0).attr("height",d).attr("fill","#f3f4f6").attr("visibility","hidden").lower()}),ee.forEach(F=>{let q=N.selectAll(".parentGroup").data([F],C=>C.properties.legendUniqueId);q=q.enter().append("g").attr("class","column parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(q);let ue=q.selectAll(".column-group").data(F.data,C=>C.legend+C.dimension),B=ue.enter().append("g").attr("class","column-group").attr("hoverId",(F.properties.alias||F.properties.name||"Legend").replace(/\s+/g,"-")).attr("transform",C=>`translate(${fe(C.dimension)-L/2}, 0)`);ue.attr("transform",C=>`translate(${fe(C.dimension)-L/2}, 0)`),B.merge(ue).attr("transform",C=>`translate(${fe(C.dimension)-L/2}, 0)`);const V=B.append("rect").attr("x",C=>Re(C.legendUniqueId)).attr("width",Re.bandwidth()).attr("y",C=>(F.properties.axis===Qe.primary?ne:Z)(0)).attr("height",0).attr("fill",C=>We.get(F.properties.legendUniqueId)?.(C.value)??F.properties.color).attr("stroke-dasharray",C=>F.properties.stackBorderStyle==2?"5,3":"0").attr("stroke-width",C=>`${F.properties.stackBorderWidth}px`).attr("stroke",C=>F.properties.stackBorderStyle==0?"none":e.column.stackBorderVisibility?F.properties.stackBorderColor:"none").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",C=>C.value===0&&e.xAxisLabel.hideZeroValues?"hidden":"visible").attr(lt.SeriesId,()=>F.properties.legendUniqueId).attr(lt.DimValue,C=>Array.isArray(C.dimension)?String(C.dimension[0]):String(C.dimension));(e.animation.animationEnabled?V.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):V).attr("y",C=>{const re=F.properties.axis===Qe.primary?ne:Z;return C.value>0?re(C.value):re(0)}).attr("height",C=>{const re=F.properties.axis===Qe.primary?ne:Z;return Math.abs(re(C.value)-re(0))}),B.merge(ue).on("mousemove",(C,re)=>{(F.properties.alias||F.properties.name||"Legend").replace(/ /g,"-");const j=Array.isArray(re.dimension)?re.dimension[0]:re.dimension,ie=String(be.formattedDimensionListMap.get(j)??j??""),we=At(W.current,String(j??""),{...F.properties,formattedDimensionValue:ie});ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:ie},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():re.properties?.currentMeasure?re.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||re.value,value:Xe([le.NormalizedStackLineChart,le.NormalizedStackAreaChart,""].includes(S)?re[1]-re[0]:re.value,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:F.properties.alias}],e,C,F.properties,we)}).on("mouseout",(C,re)=>{(F.properties.alias||F.properties.name||"Legend").replace(/ /g,"-"),ot()}),B.merge(ue).on("click",vt(E,A,(C,re)=>({seriesId:F.properties.legendUniqueId,dimValue:Array.isArray(re.dimension)?String(re.dimension[0]):String(re.dimension),legendUniqueId:F.properties.legendUniqueId,seriesDisplayName:F.properties.alias||F.properties.name||""}))),ue.exit().remove()}),N.selectAll(".parentGroup").raise()},_=ee=>{s=i-ee.left-ee.right,d=y-ee.bottom-ee.top},G=(ee,F,q)=>{Ue=F,Le=ee,Pe=q,Q()},Q=()=>{oe(),R(),ta(N,be,te,e,a,ne,J,pe,y,L,t,s,d,Le,fe),ae(Ue),$a(b,fe,ne,Z,ye,pt,[],[],e,S,y,i,s,Le,d,m,f,x,Re,L,o),ua(e.plotArea.fitChart,f,N,T,L,ne,fe,Re,void 0,void 0,a,S,e,se,xe,be.dimensionList,s,Te,be.formattedDimensionListMap,m,ye,d)};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:g,id:m,style:{width:"100%",height:"100%"}})})},or=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID();let L=0,u=!1,S=[];const g=le.CustomColumnChart,W=Ce.useRef(),A=Ce.useRef(r);A.current=r;const E=Ce.useRef(c);E.current=c;const b=mt(n.ChartData,n.DimensionList),U=n.DimensionList,Y=!!e.swapAxis?.swapAxisEnabled;let H=!1;const I=!1;let D=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,w=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,z=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,K=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me=[],J=[],Ee=[],Le=[],Ue=[],ve=[],Pe=[],Ye=[],We,be,ze,ke=new Map,Se,oe,$,R,ae,_,G,Q=[],ee=[],F=0,q,ue=[],B={dimensionList:U,chartType:g,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{V()}catch(Be){me("CustomColumnchart","createCustomColumnChart",Be)}},[e]);const V=()=>{({formatOptions:e,svg:f,width:i,height:y}=Ft(W,e)),P(),{formatOptions:e,dataTableLegendsList:ue}=ea(e,b,n.DataTableData??[]),vi(),{maxNumberForPrimaryAxis:h,maxNumberForSecondaryAxis:k,customYaxisMaxValue:w,secondaryCustomYaxisMaxValue:K}=Rt(e,B.yMinLeft,B.yMaxLeft,B.yMinRight,B.yMaxRight),{margin:ye,yLabel:se,xLabel:te,yTitle:xe,xTitle:ge,dimensionHeightWidthArray:pe,chartTitleHeight:he,secondaryAxisTitleWidth:O,legendMargin:X,secondaryYLabel:M,visibleBars:q,columnWidth:L,scrollbarVisible:u}=Mt(i,y,h,k,B.yMaxLeft,e,B.legendList,B.dimensionList,B.yMaxRight,H,I,t,Y,B,ue),it(ye),{dataTable:T,dataTableHeight:a}=ia(e,se,xe,b,B.dimensionList,n),Y&&(T=[],a=0),St(f,i,y,e),N=wt(f,ye),kt(N,e,a,s,d,g,m),re(),ie(),Y?(ra(e,N,se,d,s,R),H&&Ai(e,N,M,ae,s)):(Zt(N,e,a,se,We,d),H&&bi(N,e,a,M,ze,d,s)),Dt(e,Y,f,ye,te,y,ge,B.chartType,se,s,d),Vt(d,e,a,Y,f,ye,xe,se,s),Gt(f,H,ye,e,a,d,s,M,O,Y),Nt(f,e,i,he),It(y,f,pe,he,i,X,e,b,m,a,ye,null,g,l),_t(b,y,i,f,ye,s,u,q,B,F,!1,nt,Y)},P=()=>{const Be=[];let qe=[],dt=-1/0,Oe=1/0,at=-1/0,je=1/0,Ne=[];b.forEach((Ve,He)=>{[le.StackColumnChart,le.StackAreaChart].includes(Ve.properties.type)?le.StackColumnChart===Ve.properties.type&&(Be.includes(le.StackColumnChart)||Be.push(le.StackColumnChart)):(Ne.push(Ve),Ve.properties.type!==le.LineChart&&Ve.properties.type!==le.AreaChart&&Be.push(Ve.properties.legendUniqueId)),Ve.properties.axis==="Secondary"&&(J.push(Ve),Ve.properties.type==le.StackColumnChart&&ve.push(Ve),Ve.properties.type==le.StackAreaChart&&Ue.push(Ve)),Ve.properties.axis===Qe.primary&&(Me.push(Ve),Ve.properties.type==le.StackColumnChart&&Le.push(Ve),Ve.properties.type==le.StackAreaChart&&Ee.push(Ve)),Ve.data=Ve.data.map(ht=>{const st={...ht,type:Ve.properties.type,axis:Ve.properties.axis,labelPosition:e?.annotation?.annotationPosition.toString()==="4"?Ve.properties.annotationPosition.toString():e?.annotation?.annotationPosition.toString(),labelColor:Ve.properties.labelColor,legendUniqueId:Ve.properties.legendUniqueId};return st.axis==="Secondary"?(H=!0,at=Math.max(at,st.value),je=Math.min(je,st.value)):(dt=Math.max(dt,st.value),Oe=Math.min(Oe,st.value)),st})}),Q=JSON.parse(JSON.stringify(b)),B.chartData=Ne,B.legendList=Be,B.yMaxLeft=dt,B.yMinLeft=Oe>0?0:Oe,B.yMaxRight=at,B.yMinRight=je>0?0:je,qe=t?Tt(e.xAxisLabel.xAxisNumberFormat,B.dimensionList).map(Ve=>Ve):B.dimensionList,B.dimensionList.forEach((Ve,He)=>{B.formattedDimensionListMap.set(Ve,qe[He])}),e.plotArea.fitChart?G=B.dimensionList:G=B.dimensionList.slice(F,F+q),e.plotArea.hideZeroValues&&(B.hideZeroValues=!0),C(Ee,Le,Ue,ve,b)},C=(Be,qe,dt,Oe,at)=>{const je=Lt(G,Be,!1),Ne=Lt(G,dt,!1),Ve=Lt(G,qe,!1),He=Lt(G,Oe,!1);ee=[];const ht=[];if(Be.forEach(st=>{ht.push({properties:{axis:st.properties.axis,type:st.properties.type,legend:st.properties.legend,annotation:st.properties.annotation,alias:st.properties.alias},stackData:je,data:Be})}),dt.forEach(st=>{ht.push({properties:{axis:st.properties.axis,type:st.properties.type,legend:st.properties.legend,annotation:st.properties.annotation,alias:st.properties.alias},stackData:Ne,data:dt})}),qe.forEach(st=>{ht.push({properties:{axis:st.properties.axis,type:st.properties.type,legend:st.properties.legend,annotation:st.properties.annotation,alias:st.properties.alias},stackData:Ve,data:qe})}),Oe.forEach(st=>{ht.push({properties:{axis:st.properties.axis,type:st.properties.type,legend:st.properties.legend,annotation:st.properties.annotation,alias:st.properties.alias},stackData:He,data:Oe})}),ht.push(...B.chartData),at.length){const st=[];at.forEach(ki=>{st.push(...ht.filter(Al=>Al.properties?.type===ki.properties.type&&Al.properties.legend===ki.legend))}),ee.push(...st)}else ee.push(...ht)},re=()=>{const Be=Y?[0,a>0?s-a:s]:[a>0?d-a:d,0];{const qe=v.scaleLinear().domain([B.yMinLeft>=0?D!==void 0&&!Number.isNaN(D)?D:0:B.yMinLeft<0?B.yMinLeft*1.1:B.yMinLeft*.9,B.yMaxLeft<=0?0:w!==void 0&&!Number.isNaN(w)?w:B.yMaxLeft*1.1]).range(Be);Y?oe=qe:ne=qe}if(H){const qe=v.scaleLinear().domain([B.yMinRight>=0?(z||z==0)&&!Number.isNaN(z)?z:0:(z||z==0)&&!Number.isNaN(z)?z:B.yMinRight*1.1,B.yMaxRight<=0?(K||K==0)&&!Number.isNaN(K)?K:0:(K||K==0)&&!Number.isNaN(K)?K:B.yMaxRight*1.1]).range(Be);Y?$=qe:Z=qe}Te=Y?[d,0]:[0,s]},j=()=>{Re=v.scaleBand().domain(B.legendList).range([0,L]).paddingInner(B.legendList.length>1?.3*parseFloat(e.plotArea.plotAreaSeriesWidth)/100:0);const Be=v.scalePoint().domain(G).range(Te).padding(.5);Y?Se=Be:fe=Be},ie=()=>{{let Be=yt(w||B.yMaxLeft,B.yMinLeft,d,e,B,D,w,Y,s);Y?R=v.axisBottom(oe).tickFormat(qe=>Xe(qe,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-d:0).tickValues(Be.autoLabelFlag?void 0:Be.yAxisLabelArray).ticks(Be.customTickValue??s/50).tickPadding(8).tickSizeOuter(0):We=v.axisLeft(ne).tickFormat(qe=>Xe(qe,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,s)).tickValues(Be.autoLabelFlag?void 0:Be.yAxisLabelArray).ticks(Be.customTickValue??d/30).tickPadding(8).tickSizeOuter(0)}if(H){let Be=yt(w||B.yMaxRight,B.yMinRight,d,e,B,D,w);Y?ae=v.axisTop($).tickFormat(qe=>Xe(qe,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(Be.autoLabelFlag?void 0:Be.yAxisLabelArray).ticks(Be.customTickValue??s/30).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-d:0).tickPadding(8).tickSizeOuter(0):ze=v.axisRight(Z).tickFormat(qe=>Xe(qe,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(Be.autoLabelFlag?void 0:Be.yAxisLabelArray).ticks(Be.customTickValue??d/30).tickSize(zt(e,s)).tickPadding(8).tickSizeOuter(0)}},we=()=>{Y?_=v.axisLeft(Se).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*s*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(G,d,e)):be=v.axisBottom(fe).tickSize(sa(e,d,a,!0)).tickSizeOuter(0).tickValues(gt(G,s,e))},de=Be=>{Be.forEach(Oe=>{switch(Oe.properties.type){default:case le.ColumnChart:Ae(Oe);break;case le.LineChart:break;case le.AreaChart:break;case le.StackColumnChart:Pe=Ia(Oe),_e();break;case le.StackAreaChart:Ye=Ia(Oe),Fe(Oe);break}});const qe=Q.filter(Oe=>Oe.properties.type===le.LineChart);qe.length&&De(qe);const dt=Q.filter(Oe=>Oe.properties.type===le.AreaChart);dt.length&&$e(dt),N.selectAll(".parentGroup").raise()},Ae=Be=>{let qe=N.selectAll(".parentGroup").data([Be],Ne=>Ne.properties?.legendUniqueId);qe=qe.enter().append("g").attr("class","column parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(qe);let dt=qe.selectAll(".column-group").data(Be.data,Ne=>Ne.legendUniqueId),Oe=dt.enter().append("g").attr("class","column-group").attr("hoverId",Ne=>(Be.properties.alias||Be.properties.name).includes("-")?(Be.properties.alias||Be.properties.name).replace("-","`").split("`")[1].replace(/ /g,"-"):(Be.properties.alias||Be.properties.name).replace(/ /g,"-")).attr("transform",Ne=>Y?`translate(0, ${Se(Ne.dimension)})`:`translate(${fe(Ne.dimension)}, 0)`);Oe.merge(dt).attr("transform",Ne=>Y?`translate(0, ${Se(Ne.dimension)-L/2})`:`translate(${fe(Ne.dimension)-L/2}, 0)`);const at=(Y?Oe.append("rect").attr("y",Ne=>Re(Ne.legendUniqueId)).attr("height",Re.bandwidth()).attr("x",()=>(Be.properties.axis===Qe.primary?oe:$)(0)).attr("width",0):Oe.append("rect").attr("x",Ne=>Re(Ne.legendUniqueId)).attr("width",Re.bandwidth()).attr("y",()=>(Be.properties.axis===Qe.primary?ne:Z)(0)).attr("height",0)).attr("fill",Be.properties.color).attr("stroke-dasharray",Ne=>Be.properties.stackBorderStyle==2?"5,3":"0").attr("stroke-width",Ne=>`${Be.properties.stackBorderWidth}px`).attr("stroke",Ne=>Be.properties.stackBorderStyle==0?"none":e.column.stackBorderVisibility?Be.properties.stackBorderColor:"none").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",Ne=>Ne.value===0&&e.xAxisLabel.hideZeroValues?"hidden":"visible").attr(lt.SeriesId,()=>Be.properties.legendUniqueId).attr(lt.DimValue,Ne=>Array.isArray(Ne.dimension)?String(Ne.dimension[0]):String(Ne.dimension)).on("mousemove",(Ne,Ve)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:B.formattedDimensionListMap.get(Array.isArray(Ve.dimension)?Ve.dimension[0]:Ve.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():Ve.properties?.currentMeasure?Ve.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||Ve.value,value:Xe([le.NormalizedStackLineChart,le.NormalizedStackAreaChart,""].includes(g)?Ve[1]-Ve[0]:Ve.value,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:Ve.legend.includes("~$~")?Ve.legend.split("~$~")[1]:Ve.legend}],e,Ne,b.filter(He=>He.legend===Ve.legend)[0].properties,(()=>{const He=Array.isArray(Ve.dimension)?Ve.dimension[0]:Ve.dimension,ht=b.filter(st=>st.legend===Ve.legend)[0].properties;return At(p,String(He??""),{...ht,formattedDimensionValue:String(B.formattedDimensionListMap.get(He)??He??"")})})())}).on("mouseout",ot).on("click",vt(E,A,(Ne,Ve)=>({seriesId:Be.properties.legendUniqueId,dimValue:Array.isArray(Ve.dimension)?String(Ve.dimension[0]):String(Ve.dimension),legendUniqueId:Be.properties.legendUniqueId,seriesDisplayName:Be.properties.alias||Be.properties.name||""}))),je=e.animation.animationEnabled?at.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):at;Y?je.attr("x",Ne=>{const Ve=Be.properties.axis===Qe.primary?oe:$;return Ne.value>0?Ve(0):Ve(Ne.value)}).attr("width",Ne=>{const Ve=Be.properties.axis===Qe.primary?oe:$;return Math.abs(Ve(Ne.value)-Ve(0))}):je.attr("y",Ne=>{const Ve=Be.properties.axis===Qe.primary?ne:Z;return Ne.value>0?Ve(Ne.value):Ve(0)}).attr("height",Ne=>{const Ve=Be.properties.axis===Qe.primary?ne:Z;return Math.abs(Ve(Ne.value)-Ve(0))}),dt.exit().remove()},De=Be=>{Be.forEach(je=>{je.data.forEach(Ne=>{Ne.hideZero=je.properties.hideZeroValues,Ne.axis=je.properties.axis,Ne.legendUniqueId=je.properties.legendUniqueId})});const qe=Y?v.line().y(je=>{const Ne=Se(je.dimension);return Ne??0}).x(je=>je.axis==Qe.primary?oe(je.value):$(je.value)).defined(je=>e?.plotArea?.hideZeroValues?!!je.value:!0).curve(ft(e)):v.line().x(je=>fe(je.dimension)?fe(je.dimension):null).y(je=>je.axis==Qe.primary?ne(je.value):Z(je.value)).defined(je=>e?.plotArea?.hideZeroValues?!!je.value:!0).curve(ft(e));let dt=N.selectAll(".lines.parentGroup").data([1]);dt=dt.enter().append("g").attr("class","lines parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(dt);let Oe=dt.selectAll(".line-group").data(Be,je=>je.properties.legendUniqueId),at=Oe.enter().append("g").attr("class","line-group");at.attr("hoverId",je=>(je.properties.alias||je.properties.name||"Legend").replace(/\s+/g,"-")).append("path").attr("class","line").attr("fill","none"),at.merge(Oe).select("path").attr("d",je=>qe(je.data)).attr("stroke",je=>je.properties.color!==Ie.white?je.properties.color:"none").attr("stroke-dasharray",je=>{switch(je.properties.lineStyle){case bt.dotted:return"0,3";case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",je=>je.properties.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",je=>je.properties.lineStyle!=="None"?je.properties.lineWidth:"0"),e.animation.animationEnabled&&at.merge(Oe).select("path").each(function(){const je=v.select(this),Ne=this.getTotalLength();je.attr("stroke-dasharray",Ne+" "+Ne).attr("stroke-dashoffset",Ne),je.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("stroke-dashoffset",0)}),Oe.exit().remove(),Va(dt,Be,le.CombinationLine,Y?Se:fe,Y?oe:ne,Y?$:Z,null,e,B,K,z,D,w,!1,p,Y)},$e=Be=>{Be.forEach(He=>{He.data.forEach(ht=>{ht.hideZero=He.properties.hideZeroValues,ht.axis=He.properties.axis,ht.legendUniqueId=He.properties.legendUniqueId})});const qe=Y?v.area().y(He=>{const ht=Se(He.dimension);return ht??0}).x0(()=>oe(0)).x1(He=>oe(He.value)).defined(He=>He.hideZero?!!He.value:!0).curve(ft(e)):v.area().x(He=>fe(He.dimension)?fe(He.dimension):null).y0(()=>ne(0)).y1(He=>ne(He.value)).defined(He=>He.hideZero?!!He.value:!0).curve(ft(e)),dt=Y?v.area().y(He=>{const ht=Se(He.dimension);return ht??0}).x0(()=>oe(0)).x1(()=>oe(0)).defined(He=>He.hideZero?!!He.value:!0).curve(ft(e)):v.area().x(He=>fe(He.dimension)?fe(He.dimension):null).y0(()=>ne(0)).y1(()=>ne(0)).defined(He=>He.hideZero?!!He.value:!0).curve(ft(e)),Oe=e.animation.animationEnabled;let at=N.selectAll(".areas.parentGroup").data([1]),je=N.append("g").attr("class","focusClass");at=at.enter().append("g").attr("class","areas parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(at);let Ne=at.selectAll(".area-group").data(Be,He=>He.legend),Ve=Ne.enter().append("g").attr("class","area-group");Ve.append("path").attr("hoverId",He=>(He.properties.alias||He.properties.name||"Legend").replace(/\s+/g,"-")).attr("class","area parentGroup").attr("fill",He=>He.properties.color!==Ie.white?He.properties.color:"none").style("fill-opacity",e.plotArea.fillOpacity).attr("d",He=>Oe?dt(He.data):qe(He.data)).each(function(He){Oe&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",qe(He.data))}),Ne.select("path").attr("d",He=>qe(He.data)),Ve.merge(Ne).select("path").attr("stroke",He=>He.properties.areaBorderColor!==Ie.white?He.properties.areaBorderColor:"none").attr("stroke-dasharray",He=>{switch(He.properties.lineStyle){case"dotted":return"0,3";case"dashed":return fa;default:return""}}).attr("stroke-linecap",He=>He.properties.lineStyle==="dotted"?ya.round:"").attr("stroke-width",He=>He.properties.lineStyle!=="None"&&e.plotArea.plotAreaHideLineAndMarkers?He.properties.lineWidth:"0"),Li(e,at,je,G,Be,Y?Se:fe,Y?oe:ne,g,!1,Y),Ne.exit().remove(),Va(at,Be,le.CombinationArea,Y?Se:fe,Y?oe:ne,Y?$:Z,null,e,B,K,z,D,w,!1,void 0,Y)},Fe=Be=>{Be.data.forEach(Ve=>{Ve.data.forEach(He=>{He.hideZero=Ve.properties.hideZeroValues,He.axis=Ve.properties.axis,He.legendUniqueId=Ve.properties.legendUniqueId})});const qe=Y?v.area().y(Ve=>{const He=Se(Ve.data.dimension);return He??0}).x0(Ve=>Ve.data.axis===Qe.primary?oe(Ve[0]):$(Ve[0])).x1(Ve=>Ve.data.axis===Qe.primary?oe(Ve[1]):$(Ve[1])).defined(Ve=>Ve.hideZero?!!Ve.key:!0).curve(ft(e)):v.area().x(Ve=>fe(Ve.data.dimension)?fe(Ve.data.dimension):null).y0(Ve=>Ve.data.axis===Qe.primary?ne(Ve[0]):Z(Ve[0])).y1(Ve=>Ve.data.axis===Qe.primary?ne(Ve[1]):Z(Ve[1])).defined(Ve=>Ve.hideZero?!!Ve.key:!0).curve(ft(e)),dt=Y?v.area().y(Ve=>{const He=Se(Ve.data.dimension);return He??0}).x0(()=>oe(0)).x1(()=>oe(0)).defined(Ve=>Ve.hideZero?!!Ve.key:!0).curve(ft(e)):v.area().x(Ve=>fe(Ve.data.dimension)?fe(Ve.data.dimension):null).y0(()=>ne(0)).y1(()=>ne(0)).defined(Ve=>Ve.hideZero?!!Ve.key:!0).curve(ft(e)),Oe=e.animation.animationEnabled;let at=N.selectAll(".parentGroup").data([Ye]);N.append("g").attr("class","focusClass"),at=at.enter().append("g").attr("class","areas parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(at);let je=at.selectAll(".area-group").data(Ve=>Ve),Ne=je.enter().append("g").attr("class",Ve=>"area-group "+Ve.key.replace(/ /g,"-"));Ne.append("path").attr("hoverId",Ve=>(Be.data.filter(He=>He.legend===Ve.key)[0].properties.alias||Be.data.filter(He=>He.legend===Ve.key)[0].properties.name||"Legend").replace(/\s+/g,"-")).attr("class","area parentGroup").attr("fill",Ve=>Ve.color!==Ie.white?Ve.color:"none").attr("d",Ve=>Oe?dt(Ve):qe(Ve)).each(function(Ve){Oe&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",qe(Ve))}),je.select("path").attr("d",Ve=>qe(Ve)),Ne.merge(je).select("path").style("opacity",e.plotArea.fillOpacity).attr("stroke",Ve=>Ve.color!==Ie.white?Ve.color:"none").attr("stroke-dasharray",(Ve,He)=>b[He].properties.lineStyle==="dotted"?"0,3":b[He].properties.lineStyle==="dashed"?fa:"").attr("stroke-linecap",(Ve,He)=>b[He].properties.lineStyle==="dotted"?ya.round:"").attr("stroke-width",(Ve,He)=>b[He].properties.lineStyle!=="None"?b[He].properties.lineWidth:"0"),je.exit().remove(),Va(at,Be.data,le.CombinationStackArea,Y?Se:fe,Y?oe:ne,Y?$:Z,null,e,B,K,z,D,w,!1,void 0,Y)},_e=()=>{let Be=N.selectAll(".parentGroup").data([Pe]);Be=Be.enter().append("g").attr("class","stackcolumns parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(Be);let qe=Be.selectAll(".stackcolumns-group").data(Ne=>Ne);qe=qe.enter().append("g").attr("class",Ne=>"stackcolumns-group ").merge(qe);let Oe=qe.selectAll("rect").data(Ne=>Ne);Y?Oe.attr("x",Ne=>Ne.data.axis===Qe.primary?oe(Ne[0]):$(Ne[0])).attr("width",Ne=>Ne.data.axis===Qe.primary?w&&Ne[1]>w?oe(w)-oe(Ne[0]):oe(Ne[1])-oe(Ne[0]):K&&Ne[1]>K?$(K)-$(Ne[0]):$(Ne[1])-$(Ne[0])):Oe.attr("y",Ne=>Ne.data.axis===Qe.primary?ne(Ne[1]):Z(Ne[1])).attr("height",Ne=>Ne.data.axis===Qe.primary?w&&Ne[1]>w?ne(Ne[0])-ne(w):ne(Ne[0])-ne(Ne[1]):K&&Ne[1]>K?Z(Ne[0])-Z(K):Z(Ne[0])-Z(Ne[1]));const at=Y?Oe.enter().append("rect").attr("transform",Ne=>`translate(0, ${Se(Ne.data.dimension)-L/2})`).attr("x",Ne=>Ne.data.axis===Qe.primary?oe(0):$(0)).attr("width",0):Oe.enter().append("rect").attr("transform",Ne=>`translate(${fe(Ne.data.dimension)-L/2},0)`).attr("y",Ne=>Ne.data.axis===Qe.primary?ne(0):Z(0)).attr("height",0);at.merge(Oe).attr("hoverId",Ne=>Ne.alias.includes("~$~")?Ne.alias.split("~$~")[1].replace(/ /g,"-"):Ne.alias.replace(/ /g,"-")).attr(Y?"y":"x",Ne=>Re(le.StackColumnChart)).attr(Y?"height":"width",Re.bandwidth()).attr("fill",(Ne,Ve,He)=>{const ht=Array.from(b).findIndex(st=>st.legend===Ne.key);return b[ht]?.properties?.color||"gray"}).attr("stroke",(Ne,Ve,He)=>{const ht=Array.from(b).findIndex(ki=>ki.legend===Ne.key),st=b[ht]?.properties;return st?.stackBorderStyle==0?"none":e.column.stackBorderVisibility?st.stackBorderColor:"none"}).attr("stroke-dasharray",(Ne,Ve,He)=>{const ht=Array.from(b).findIndex(st=>st.legend===Ne.key);return b[ht]?.properties.stackBorderStyle==2?"5,3":"0"}).attr("stroke-width",(Ne,Ve,He)=>{const ht=Array.from(b).findIndex(st=>st.legend===Ne.key);return(b[ht]?.properties.stackBorderWidth||0)+"px"}).on("mousemove",(Ne,Ve)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:B.formattedDimensionListMap.get(Ve.data.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():Ve.properties?.currentMeasure?Ve.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||Ve.value,value:Xe(Ve.data[Ve.key],e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:Ve.key.includes("~$~")?Ve.key.split("~$~")[1]:Ve.key}],e,Ne,b.filter(He=>He.legend===Ve.key)[0].properties,(()=>{const He=b.filter(ht=>ht.legend===Ve.key)[0].properties;return At(p,String(Ve.data.dimension??""),{...He,formattedDimensionValue:String(B.formattedDimensionListMap.get(Ve.data.dimension)??Ve.data.dimension??"")})})())}).on("mouseout",ot).attr(lt.SeriesId,Ne=>Ne.key??"").attr(lt.DimValue,Ne=>Array.isArray(Ne.data.dimension)?String(Ne.data.dimension[0]):String(Ne.data.dimension)).on("click",vt(E,A,(Ne,Ve)=>({seriesId:Ve.key??"",dimValue:Array.isArray(Ve.data.dimension)?String(Ve.data.dimension[0]):String(Ve.data.dimension),legendUniqueId:Ve.key??"",seriesDisplayName:Ve.alias||Ve.key||""})));const je=e.animation.animationEnabled?at.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):at;Y?je.attr("x",Ne=>Ne.data.axis===Qe.primary?oe(Ne[0]):$(Ne[0])).attr("width",Ne=>Ne.data.axis===Qe.primary?w&&Ne[1]>w?oe(w)-oe(Ne[0]):oe(Ne[1])-oe(Ne[0]):K&&Ne[1]>K?$(K)-$(Ne[0]):$(Ne[1])-$(Ne[0])):je.attr("y",Ne=>Ne.data.axis===Qe.primary?ne(Ne[1]):Z(Ne[1])).attr("height",Ne=>Ne.data.axis===Qe.primary?w&&Ne[1]>w?ne(Ne[0])-ne(w):ne(Ne[0])-ne(Ne[1]):K&&Ne[1]>K?Z(Ne[0])-Z(K):Z(Ne[0])-Z(Ne[1])),qe.exit().remove()},it=Be=>{s=i-Be.left-Be.right,d=y-Be.bottom-Be.top},nt=(Be,qe,dt)=>{Q=qe,G=Be,q=dt,Ba(n,ke,G),C(Ee,Le,Ue,ve,qe),Q=JSON.parse(JSON.stringify(ee)),Q.forEach((Oe,at)=>{Oe.properties.type===le.StackColumnChart||Oe.properties.type===le.StackAreaChart?Oe.data.forEach((je,Ne)=>Q[at].data[Ne].data=je.data.filter(Ve=>G.includes(Ve.dimension))):Q[at].data=Oe.data.filter(je=>G.includes(je.dimension))}),di()};function Ba(Be,qe,dt){qe.clear(),dt&&dt.length>0&&dt.forEach(Oe=>{qe.set(Oe,0)}),Be.ChartData&&Be.ChartData.length>0&&Be.ChartData.forEach(Oe=>{Oe.properties.type.includes("Stack")&&Oe.data.forEach((at,je)=>{if(qe.has(at.dimension)){let Ne=qe.get(at.dimension)||0;Ne+=at.value||0,qe.set(at.dimension,Ne)}})})}const di=()=>{j(),we(),de(Q),Y?na(e,N,te,d,s,_,ae,oe,B.yMaxLeft,G,g,t,i,pe,L,Se):ta(N,B,te,e,a,ne,be,pe,y,L,t,s,d,G,fe);const Be=()=>{Y||jl(Q,fe,ne,Z,ye,pt,Pe,Ye,[],[],L,e,y,i,s,G,d,m,f,x,Re,o),ii(ke,Y?Se:fe,Y?oe:ne,ye,pt,[],e,g,y,i,f,o,Y)};Y||ua(e.plotArea.fitChart,f,N,T,L,ne,fe,Re,void 0,void 0,a,g,e,se,xe,B.dimensionList,s,Te,B.formattedDimensionListMap,m,ye,d),f.selectAll(".annotation-group").remove(),Be()},Ia=Be=>{let qe=Be.data.map(Oe=>Oe.legend);S=v.stack().keys(qe).offset(v.stackOffsetNone)(Be.stackData),Be.data.forEach((Oe,at)=>Oe.data.forEach((je,Ne)=>{je[0]=S[at][Ne][0],je[1]=S[at][Ne][1]}));let dt=e.annotation.annotationSetLabelColor;return S.forEach((Oe,at)=>{Oe.forEach(je=>{je.key=Oe.key,je.alias=Be.data[at].properties.alias,Oe.alias=Be.data[at].properties.alias,Oe.color=JSON.parse(JSON.stringify(Be.data[at].properties.color)),Oe.individualAnnotationVisibility=JSON.parse(JSON.stringify(Be.data[at].properties.annotation)),je.data.labelPosition=e?.annotation?.annotationPosition.toString()==="4"?Be.data[at].properties.annotationPosition.toString():e?.annotation?.annotationPosition.toString(),je.data.labelColor=dt=="2"?JSON.parse(JSON.stringify(Be.data[at].properties.color)):JSON.parse(JSON.stringify(Be.data[at].properties.labelColor)),je.hideZero=JSON.parse(JSON.stringify(Be.data[at].properties.hideZeroValues)),je.data.axis=JSON.parse(JSON.stringify(Be.data[at].properties.axis)),je.data.color=JSON.parse(JSON.stringify(Be.data[at].properties.color)),je.data.legend=Be.properties.type,je.data.type=JSON.parse(JSON.stringify(Be.data[at].properties.type))})}),S},vi=()=>{if(Me.length>0){const qe=(Le.length>0?Lt(G,Le,!1):Lt(G,Ee,!1)).map(dt=>dt.total);B.yMaxLeft=Math.max(B.yMaxLeft,...qe),B.yMinLeft=Math.min(B.yMinLeft,...qe)}if(J.length>0){const qe=(ve.length>0?Lt(G,ve,!1):Lt(G,Ue,!1)).map(dt=>dt.total);B.yMaxRight=Math.max(B.yMaxRight,...qe),B.yMinRight=Math.min(B.yMinRight,...qe)}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:W,id:m,style:{width:"100%",height:"100%"}})})},cr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID();let L=0;const u=le.LayeredColumnChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList),E=n.DimensionList,b=!1,U=!1,Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0;e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility&&parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText);let D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te=[];const Me=new Map;let J=0,Ee=2,Le=!1,Ue=[],ve={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Pe()}catch(ae){me("LayeredColumnchart","createLayeredColumnChart",ae)}},[e]);const Pe=()=>{({formatOptions:e,svg:y,width:k,height:s}=Ft(S,e)),Ye(),{formatOptions:e,dataTableLegendsList:Ue}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:O,maxNumberForSecondaryAxis:X,customYaxisMaxValue:I,secondaryCustomYaxisMaxValue:D}=Rt(e,ve.yMinLeft,ve.yMaxLeft,ve.yMinRight,ve.yMaxRight),{margin:w,yLabel:z,xLabel:K,yTitle:ye,xTitle:se,dimensionHeightWidthArray:te,chartTitleHeight:xe,secondaryAxisTitleWidth:ge,legendMargin:pe,secondaryYLabel:he,visibleBars:Ee,columnWidth:L,scrollbarVisible:Le}=Mt(k,s,O,X,ve.yMaxLeft,e,ve.legendList,ve.dimensionList,ve.yMaxRight,U,Y,t,!1,ve,Ue),oe(w),{dataTable:d,dataTableHeight:i}=ia(e,z,ye,A,ve.dimensionList,n),St(y,k,s,e),T=wt(y,w),kt(T,e,i,M,h,u,m),We(),ze(),Zt(T,e,i,z,Z,h),Dt(e,b,y,w,K,s,se,ve.chartType,z,M,h),Vt(h,e,i,b,y,w,ye,z),Gt(y,U,w,e,i,h,M,he,ge),Nt(y,e,k,xe),It(s,y,te,xe,k,pe,e,A,m,i,w,ct.rectangle,u,l),_t(A,s,k,y,w,M,Le,Ee,ve,J,!1,R)},Ye=()=>{const ae=[],_=[];let G=[],Q=-1/0,ee=1/0,F=-1/0,q=1/0,ue=-1/0,B=1/0;A.forEach(V=>{_.push(V.properties.legendUniqueId),ue=-1/0,B=1/0,V.data.forEach(P=>{ae.push(P),ue=Math.max(ue,P.value),B=Math.min(B,P.value),Q=Math.max(Q,P.value),ee=Math.min(ee,P.value)}),V.properties.setColorScale&&Me.set(V.properties.legendUniqueId,v.scaleSequential().domain([B,ue]).interpolator(v.interpolateRgb(V.properties.startColor,V.properties.endColor)))}),ve.chartData=ae,ve.legendList=_,ve.yMaxLeft=Q,ve.yMinLeft=ee>0?0:ee,ve.yMaxRight=F,ve.yMinRight=q>0?0:q,G=t?Tt(e.xAxisLabel.xAxisNumberFormat,ve.dimensionList).map(V=>V):ve.dimensionList,ve.dimensionList.forEach((V,P)=>{ve.formattedDimensionListMap.set(V,G[P])}),Te=JSON.parse(JSON.stringify(A)),e.plotArea.fitChart?Re=ve.dimensionList:Re=ve.dimensionList.slice(J,J+Ee),e.plotArea.hideZeroValues&&(ve.hideZeroValues=!0)},We=()=>{let ae=yt(I||ve.yMaxLeft,ve.yMinLeft,h,e,ve,H,I).yAxisLabelArray;ve.yMaxLeft=ae[ae.length-1],ve.yMinLeft=ae[0],a=v.scaleLinear().domain([ve.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:0:ve.yMinLeft<0?ve.yMinLeft*1.1:ve.yMinLeft*.9,ve.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:ve.yMaxLeft*1.1]).range([i>0?h-i:h,0]),ne=[0,M]},be=()=>{v.scaleBand().domain(["layeredLegend"]).range([0,L]).paddingInner(ve.legendList.length>1?.3*parseFloat(e.plotArea.plotAreaSeriesWidth)/100:0),N=v.scalePoint().domain(Re).range(ne).padding(.5)},ze=()=>{ke();{let ae=yt(I||ve.yMaxLeft,ve.yMinLeft,h,e,ve,H,I);Z=v.axisLeft(a).tickFormat(_=>Xe(_,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,M)).tickValues(ae.autoLabelFlag?void 0:ae.yAxisLabelArray).ticks(ae.customTickValue).tickPadding(8).tickSizeOuter(0)}},ke=()=>{fe=v.axisBottom(N).tickSize(sa(e,h,i)).tickSizeOuter(0).tickValues(gt(Re,M,e))},Se=ae=>{ae.forEach(_=>{_.data.forEach(G=>{G.hideZero=_.properties.hideZeroValues,G.properties=_.properties,G.axis=_.properties.axis})}),ae.forEach((_,G)=>{let Q=T.selectAll(".parentGroup").filter(B=>B?.properties?.legendUniqueId===_.properties.legendUniqueId).data([_],B=>B.properties.legendUniqueId);Q=Q.enter().append("g").attr("class","column parentGroup").attr("data-legend-id",_.properties.legendUniqueId).attr("clip-path",`url(#${m}-clip)`).merge(Q);let ee=Q.selectAll(".column-group").data(_.data,B=>B.dimension+"_"+_.properties.legendUniqueId),F=ee.enter().append("g").attr("class","column-group").attr("hoverId",(_.properties.alias||_.properties.name||"Legend").replace(/\s+/g,"-")).attr("transform",B=>G===0?`translate(${N(B.dimension)-L/2}, 0)`:`translate(${N(B.dimension)-L/(2+G*2)}, 0)`);ee.attr("transform",B=>G===0?`translate(${N(B.dimension)-L/2}, 0)`:`translate(${N(B.dimension)-L/(2+G*2)}, 0)`),F.merge(ee).attr("transform",B=>G===0?`translate(${N(B.dimension)-L/2}, 0)`:`translate(${N(B.dimension)-L/(2+G*2)}, 0)`);const q=F.append("rect").attr("x",()=>0).attr("width",G===0?L:L/2+G*2).attr("y",B=>(_.properties.axis===Qe.primary?a:f)(0)).attr("height",0).attr("fill",B=>Me.get(_.properties.legendUniqueId)?.(B.value)??_.properties.color).attr("stroke-dasharray",()=>_.properties.stackBorderStyle==2?"5,3":"0").attr("stroke-width",`${_.properties.stackBorderWidth}px`).attr("stroke",()=>_.properties.stackBorderStyle==0?"none":e.column.stackBorderVisibility?_.properties.stackBorderColor:"none").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("opacity",.7).attr("visibility",B=>B.value===0&&e.xAxisLabel.hideZeroValues?"hidden":"visible").attr(lt.SeriesId,()=>_.properties.legendUniqueId).attr(lt.DimValue,B=>Array.isArray(B.dimension)?String(B.dimension[0]):String(B.dimension));(e.animation.animationEnabled?q.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):q).attr("y",B=>{const V=_.properties.axis===Qe.primary?a:f;return B.value>0?V(B.value):V(0)}).attr("height",B=>{const V=_.properties.axis===Qe.primary?a:f;return Math.abs(V(B.value)-V(0))}),ee.select("rect").transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("y",B=>{const V=_.properties.axis===Qe.primary?a:f;return B.value>0?V(B.value):V(0)}).attr("height",B=>{const V=_.properties.axis===Qe.primary?a:f;return Math.abs(V(B.value)-V(0))}),F.merge(ee).on("mousemove",(B,V)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:ve.formattedDimensionListMap.get(Array.isArray(V.dimension)?V.dimension[0]:V.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():V.properties?.currentMeasure?V.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||V.value,value:Xe([le.NormalizedStackLineChart,le.NormalizedStackAreaChart,""].includes(u)?V[1]-V[0]:V.value,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:V.properties.alias}],e,B,V.properties,(()=>{const C=Array.isArray(V.dimension)?V.dimension[0]:V.dimension;return At(p,String(C??""),{...V.properties,formattedDimensionValue:String(ve.formattedDimensionListMap.get(C)??C??"")})})());let P=(_.properties.alias||_.properties.name||"Legend").replace(/ /g,"-");v.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!0),v.selectAll('[hoverId="'+P+'"]').classed("highlight",!0).classed("unhighlight",!1)}).on("mouseout",(B,V)=>{let P=(_.properties.alias||_.properties.name||"Legend").replace(/ /g,"-");v.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!1),v.selectAll('[hoverId="'+P+'"]').classed("highlight",!1).classed("unhighlight",!1),ot()}),F.merge(ee).on("click",vt(W,g,(B,V)=>({seriesId:_.properties.legendUniqueId,dimValue:Array.isArray(V.dimension)?String(V.dimension[0]):String(V.dimension),legendUniqueId:_.properties.legendUniqueId,seriesDisplayName:_.properties.alias||_.properties.name||""}))),ee.exit().remove()}),T.selectAll(".parentGroup").raise()},oe=ae=>{M=k-ae.left-ae.right,h=s-ae.bottom-ae.top},$=()=>{be(),ke(),ta(T,ve,K,e,i,a,fe,te,s,L,t,M,h,Re,N),Se(Te),$a(A,N,a,void 0,w,pt,[],[],e,u,s,k,M,Re,h,m,y,x,void 0,L,o),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,y,T,d,L,a,N,void 0,void 0,void 0,i,le.ColumnChart,e,z,ye,ve.dimensionList,M,ne,ve.formattedDimensionListMap,m,w,h))},R=(ae,_,G)=>{Te=_,Re=ae,Ee=G,$()};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},dr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID();let L=0,u=!1;const S=le.StackColumnChart,g=Ce.useRef(),W=Ce.useRef(c);W.current=c;const A=Ce.useRef(p);A.current=p;const E=n.DimensionList,b=(mt(n.ChartData,n.DimensionList)||[]).reverse(),U=!1,Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0;e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility&&parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText),e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility&&parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText);let D,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N;const ne=new Map;let Z,fe,Re,Te=[],Me=0,J,Ee=[],Le=[],Ue=new Map;const ve=!1;let Pe={dimensionList:E,chartType:S,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Ye()}catch(F){me("StackStackColumnchart","createStackColumnChart",F)}},[e]);const Ye=()=>{({formatOptions:e,svg:i,width:h,height:k}=Ft(g,e)),We(),{formatOptions:e,dataTableLegendsList:Ee}=ea(e,b,n.DataTableData??[]),{maxNumberForPrimaryAxis:he,maxNumberForSecondaryAxis:O}=Rt(e,Pe.yMinLeft,Pe.yMaxLeft,Pe.yMinRight,Pe.yMaxRight),{margin:D,yLabel:w,xLabel:z,yTitle:K,xTitle:ye,dimensionHeightWidthArray:se,chartTitleHeight:te,secondaryAxisTitleWidth:xe,legendMargin:ge,secondaryYLabel:pe,visibleBars:J,columnWidth:L,scrollbarVisible:u}=Mt(h,k,he,O,Pe.yMaxLeft,e,Pe.legendList,Pe.dimensionList,Pe.yMaxRight,Y,ve,t,!1,Pe,Ee),$(D),{dataTable:s,dataTableHeight:d}=ia(e,w,K,b,Pe.dimensionList,n),St(i,h,k,e),y=wt(i,D),kt(y,e,d,X,M,S,m),be(),ke(),Zt(y,e,d,w,Z,M),Dt(e,U,i,D,z,k,ye,Pe.chartType,w,X,M),Vt(M,e,d,U,i,D,K,w),Gt(i,Y,D,e,d,M,X,pe,xe),Nt(i,e,h,te),It(k,i,se,te,h,ge,e,[...b].reverse(),m,d,D,ct.rectangle,S,l),_t(b,k,h,i,D,X,u,J,Pe,Me,!1,R)},We=()=>{const F=[],q=[];let ue=-1/0,B=1/0;b.forEach((ie,we)=>{const de=`${we}~$~${ie.properties.legend}`;ie.properties.legend=de,q.push(de),ue=-1/0,B=1/0;for(const Ae of ie.data)ue=Math.max(ue,Ae.value),B=Math.min(B,Ae.value),F.push(Ae);ie.properties.setColorScale&&ne.set(ie.properties.legendUniqueId,v.scaleSequential().domain([B,ue]).interpolator(yi.interpolateRgb(ie.properties.startColor,ie.properties.endColor)))}),Pe.chartData=F,Pe.legendList=q,Te=JSON.parse(JSON.stringify(b));let V=Lt(Pe.dimensionList,b,ve);Re=Pe.dimensionList;const P=v.stack().keys(Pe.legendList).offset(v.stackOffsetDiverging)(V);_();let C=1/0,re=-1/0;for(const ie of P)for(const[we,de]of ie)C=Math.min(C,we),re=Math.max(re,de);Pe.yMinLeft=C>0?0:C,Pe.yMaxLeft=re;let j=t?Tt(e.xAxisLabel.xAxisNumberFormat,Pe.dimensionList).map(ie=>ie):Pe.dimensionList;Pe.dimensionList.forEach((ie,we)=>{Pe.formattedDimensionListMap.set(ie,j[we])}),e.plotArea.hideZeroValues&&(Pe.hideZeroValues=!0)},be=()=>{T=v.scaleLinear().domain([Pe.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:0:Pe.yMinLeft<0?Pe.yMinLeft*1.1:Pe.yMinLeft*.9,Pe.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:Pe.yMaxLeft*1.1]).range([d>0?M-d:M,0]),N=[0,X]},ze=()=>{f=v.scalePoint().domain(Re).range([0,X]).padding(.5)},ke=()=>{{const F=yt(I||Pe.yMaxLeft,Pe.yMinLeft,M,e,Pe,H,I);Z=v.axisLeft(T).tickFormat(q=>Xe(q,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,X)).tickValues(F.autoLabelFlag?void 0:F.yAxisLabelArray).ticks(F.customTickValue).tickPadding(8).tickSizeOuter(0)}},Se=()=>{fe=v.axisBottom(f).tickSize(sa(e,M,d,!0)).tickSizeOuter(0).tickValues(gt(Re,X,e))},oe=F=>{F.forEach(j=>{j.data.forEach(ie=>{ie.hideZero=j.properties.hideZeroValues,ie.axis=j.properties.axis})}),Re.forEach(j=>{y.append("rect").attr("id",`dim-background-${j}`).attr("class","dimension-background").attr("x",f(j)-f.step()/2).attr("width",f.step()).attr("y",0).attr("height",M).attr("fill","#E5E5E5").attr("visibility","hidden").lower()});let q=y.selectAll(".parentGroup").data([Le]);q=q.enter().append("g").attr("class","columns parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(q);let ue=q.selectAll(".column-group").data(j=>j);ue=ue.enter().append("g").attr("class",j=>"column-group "+j.key.replace(/ /g,"-")).attr("hoverId",j=>j[0]?.properties.alias?Xa(j[0]?.properties.alias):Xa(j.key)).merge(ue);let V=ue.selectAll("rect").data(j=>j);const P=(j,ie)=>{const we=Array.from(ue.nodes()).indexOf(j[ie].parentNode);return{props:b[we]?.properties,groupIndex:we}},C=V.enter().append("rect").merge(V).attr("x",j=>f(j.data.dimension)-L/2).attr("width",L).attr("y",j=>T(0)).attr("height",0).attr("fill",(j,ie,we)=>{const{props:de}=P(we,ie);return ne.get(de.legendUniqueId)?.(j.data[j.key])??de?.color??"gray"}).attr("stroke",(j,ie,we)=>{const{props:de}=P(we,ie);return de?.stackBorderStyle==0?"none":e.column.stackBorderVisibility?de.stackBorderColor:"none"}).attr("stroke-dasharray",(j,ie,we)=>{const{props:de}=P(we,ie);return de?.stackBorderStyle==2?"5,3":"0"}).attr("stroke-width",(j,ie,we)=>{const{props:de}=P(we,ie);return(de?.stackBorderWidth||0)+"px"}).style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",(j,ie,we)=>{const{props:de}=P(we,ie);return j.data[j.key]==0&&de?.hideZeroValues?"hidden":"visible"}).attr(lt.SeriesId,j=>j.key??"").attr(lt.DimValue,j=>Array.isArray(j.data.dimension)?String(j.data.dimension[0]):String(j.data.dimension)).on("mousemove",(j,ie)=>{const we=String(Pe.formattedDimensionListMap.get(ie.data.dimension)??ie.data.dimension??""),de=At(r,String(ie.data.dimension??""),{...ie.properties,formattedDimensionValue:we});ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:Pe.formattedDimensionListMap.get(ie.data.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():ie.properties?.currentMeasure?ie.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||ie.value,value:Xe(ie.data[ie.key],e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:ie.properties.alias}],e,j,ie.properties,de)}).on("mouseout",(j,ie)=>{ot()}).on("click",vt(A,W,(j,ie)=>({seriesId:ie.key??"",dimValue:Array.isArray(ie.data.dimension)?String(ie.data.dimension[0]):String(ie.data.dimension),legendUniqueId:ie.key??"",seriesDisplayName:ie.properties?.alias||ie.key||""})));(e.animation.animationEnabled?C.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):C).attr("y",j=>j[1]>=j[0]?T(j[1]):T(j[0])).attr("height",j=>Math.abs(T(j[0])-T(j[1]))),ue.exit().remove(),y.selectAll(".parentGroup").raise()},$=F=>{X=h-F.left-F.right,M=k-F.bottom-F.top},R=(F,q,ue)=>{Te=q,Re=F,J=ue,li(n,Ue,Re),ae()},ae=()=>{ze(),Se(),ta(y,Pe,z,e,d,T,fe,se,k,L,t,X,M,Re,f),_();const F=new Map;Re.forEach((q,ue)=>{let B=0;Le.forEach(V=>{const P=V[ue]?.[0]??0;P<B&&(B=P)}),F.set(q,B)}),oe(Te),Ya(Le,f,T,a,D,pt,[],[],e,S,k,h,X,Re,M,m,i,x,d,o),ii(Ue,f,T,D,pt,[],e,S,k,h,i,o,!1,F),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,i,y,s,L,T,f,void 0,void 0,void 0,d,S,e,w,K,Re,X,N,Pe.formattedDimensionListMap,m,D,M)),G()},_=()=>{let F=Lt(Re,Te,ve);Le=v.stack().keys(Pe.legendList).offset(v.stackOffsetDiverging)(F),Te.forEach((ue,B)=>ue.data.forEach((V,P)=>{V[0]=Le[B][P][0],V[1]=Le[B][P][1]}));let q=e.annotation.annotationSetLabelColor;Le.forEach((ue,B)=>ue.forEach(V=>{V.key=ue.key,ue.color=JSON.parse(JSON.stringify(b[B].properties.color)),V.data.labelPosition=b[B].properties.dataLabelPosition,V.data.labelColor=q=="2"?JSON.parse(JSON.stringify(b[B].properties.color)):b[B].properties.labelColor,V.hideZero=JSON.parse(JSON.stringify(b[B].properties.hideZeroValues)),V.properties=b[B].properties}))},G=()=>{try{const F=e?.connector,q=Number(F?.connectorVisibility);if(!F||q===2)return;let ue,B=[];q===1?ue=1:q===3&&(Number(F.connectorFollow)===1?ue=Number(F.connectorStepSize)||void 0:Number(F.connectorFollow)===2&&(B=F.connectorExclude??[],ue=1));const V=(B||[]).map(ie=>String(ie).split("-")[0]),P=(Le[0]??[]).map((ie,we)=>({Dimension:ie.data.dimension,Total:ie.data.total,CustomTotal:ie.data.total,Index:we})),C=[],re=[];let j=[];if(ue){if(ue===1)C.push(...P);else for(const ie of P)ie.Index%ue===0&&C.push(ie);for(let ie=ue;ie<P.length;ie+=ue){const we=Math.min(ie+ue,P.length);let de=P[ie]?.Total??Number.NEGATIVE_INFINITY;for(let Ae=ie;Ae<we;Ae++)P[Ae].Total>de&&(de=P[Ae].Total);Number.isFinite(de)&&re.push(de)}j=C.slice(1)}else{const ie=F.connectorCustomRange??[],we=new Map;P.forEach(de=>we.set(String(de.Dimension),de.Index));for(const de of ie){if(!de?.from||!de?.to)continue;const Ae=we.get(String(de.from)),De=we.get(String(de.to));if(Ae!=null&&De!=null){C.push(P[Ae]);const $e=Math.min(Ae,De),Fe=Math.max(Ae,De);let _e=P[$e]?.Total??Number.NEGATIVE_INFINITY;for(let it=$e;it<=Fe;it++)P[it].Total>_e&&(_e=P[it].Total);Number.isFinite(_e)&&re.push(_e)}}for(const de of ie){if(!de?.from||!de?.to)continue;const Ae=we.get(String(de.to));Ae!=null&&j.push(P[Ae])}}y.selectAll("defs > #arrow").remove(),y.append("defs").append("marker").attr("id","arrow").attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerWidth",10).attr("markerHeight",7).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("fill",F.connectorMarkerColor!==Ie.white?F.connectorMarkerColor:"none"),Q(C,re,j,ue,V),ee(C,re,j,ue,V)}catch{}},Q=(F,q,ue,B,V)=>{try{const P=F.filter((ie,we)=>B!=null?we<F.length-1:we<F.length);let C=y.selectAll("path.connector-path").data(P,ie=>String(ie.Dimension));C.exit().remove(),C.enter().append("path").attr("class","connector-path").style("shape-rendering","crispEdges").attr("fill","none").attr("marker-end","url(#arrow)").merge(C).attr("d",(ie,we)=>e.total.totalVisibility?`M ${f(ie.Dimension)+f.bandwidth()/2+5}, ${T(ie.Total)-25} V ${-35+Math.min(T(q[we]),T(ue[we].Total),T(ie.Total))} H ${f(ue[we].Dimension)+f.bandwidth()/2-10} V ${-27+T(ue[we].Total)}`:`M ${f(ie.Dimension)+f.bandwidth()/2+5}, ${T(ie.Total)-5} V ${-30+Math.min(T(ue[we].Total),T(ie.Total))} H ${f(ue[we].Dimension)+f.bandwidth()/2-10} V ${-10+T(ue[we].Total)}`).style("stroke",e.connector.connectorLineColor!==Ie.white?e.connector.connectorLineColor:"none").attr("stroke-width",e.connector.connectorLineThickness).style("visibility",ie=>V.includes(ie.Dimension)||ie.Total==0&&e.xAxisLabel.hideZeroValues?"hidden":"visible")}catch{}},ee=(F,q,ue,B,V)=>{try{let P,C=e.connector.connectorFontStyle,re=e.connector.connectorNumberFormat,j=X/30;(e.connector.connectorKPI=="2"||e.connector.connectorKPI=="3")&&(re=".2s");const ie=isNaN(parseFloat(e?.plotArea?.plotAreaGapWidth??"0"))?0:parseFloat(e.plotArea.plotAreaGapWidth)/100,we=Di(ie,L),de=we*(typeof f.padding=="function"?f.padding():0),Ae=F.map((_e,it)=>({d:_e,i:it})).filter(_e=>B!=null?_e.i<F.length-1:_e.i<F.length);let De=y.selectAll("text.connector-text").data(Ae,_e=>String(_e.d.Dimension));De.exit().remove(),De.enter().append("text").attr("class","connector-text").attr("text-anchor","middle").merge(De).attr("x",_e=>{const it=_e.d,nt=_e.i,Ba=ue[nt];return f(Ba.Dimension)-we*B/2}).attr("y",_e=>{const it=_e.d,nt=_e.i,Ba=q[nt],di=ue[nt],Ia=Math.min(T(di?.Total??0),T(it.Total));return e.total.totalVisibility?j<8?-40+Ia:-41+Ia:j<8?-35+Ia:-40+Ia}).style("text-anchor","middle").text(_e=>{const it=_e.d,nt=_e.i;return ue[nt]?(it.CustomTotal==0&&ue[nt].CustomTotal!=0&&(it.CustomTotal=1),fi(ue[nt].Total,it.Total,parseInt(e.connector.connectorDecimalPrecision),re,parseInt(it.Dimension),parseInt(ue[nt].Dimension),e)):""}).style("font-size",e.connector.connectorFontSize).style("font-family",e.connector.connectorFontFamily).style("font-style",e.connector.connectorFontStyle).style("fill",e.connector.connectorFontColor!==Ie.white?e.connector.connectorFontColor:"none").style("font-weight","lighter").style("font-style",C.includes("Italic")?"Italic":"").style("text-decoration",C.includes("Underline")?"Underline":"").style("font-weight",C.includes("Bold")?"Bold":"").style("visibility",_e=>{const it=_e.d;return V.includes(it.Dimension)||it.Total==0&&e.xAxisLabel.hideZeroValues?"hidden":"visible"}).raise()}catch{}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:g,id:m,style:{width:"100%",height:"100%"}})})},yr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID();let L=0;const u=le.NormalizedStackColumnChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList).reverse(),E=n.DimensionList,b=!1,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I,D,w,z,K,ye,se,te,xe,ge,pe,he,O=!1,X,M,h,k,s,d,i,y,T,a,f,N;const ne=new Map;let Z,fe,Re,Te=[],Me=0,J=0,Ee=[],Le=[];const Ue=!0;let ve={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Pe()}catch(_){me("StackNormalizedStackColumnChart","createNormalizedStackColumnChart",_)}},[e]);const Pe=()=>{({formatOptions:e,svg:i,width:h,height:k}=Ft(S,e)),Ye(),{formatOptions:e,dataTableLegendsList:Ee}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:pe,maxNumberForSecondaryAxis:he}=Rt(e,ve.yMinLeft,ve.yMaxLeft,ve.yMinRight,ve.yMaxRight),{margin:I,yLabel:D,xLabel:w,yTitle:z,xTitle:K,dimensionHeightWidthArray:ye,chartTitleHeight:se,secondaryAxisTitleWidth:te,legendMargin:xe,secondaryYLabel:ge,visibleBars:J,columnWidth:L,scrollbarVisible:O}=Mt(h,k,pe,he,ve.yMaxLeft,e,ve.legendList,ve.dimensionList,ve.yMaxRight,U,Ue,t,!1,ve,Ee),oe(I),{dataTable:s,dataTableHeight:d}=ia(e,D,z,A,ve.dimensionList,n),St(i,h,k,e),y=wt(i,I),kt(y,e,d,X,M,u),We(),ze(),Zt(y,e,d,D,Z,M),Dt(e,b,i,I,w,k,K,ve.chartType,D,X,M),Vt(M,e,d,b,i,I,z,D),Gt(i,U,I,e,d,M,X,ge,te),Nt(i,e,h,se),It(k,i,ye,se,h,xe,e,[...A].reverse(),m,d,I,ct.rectangle,u,l),_t(A,k,h,i,I,X,O,J,ve,Me,!1,$)},Ye=()=>{const _=[],G=[];let Q=-1/0,ee=1/0;A.forEach((V,P)=>{const C=`${P}~$~${V.properties.legend}`;V.properties.legend=C,G.push(C),Q=-1/0,ee=1/0;for(const re of V.data)Q=Math.max(Q,re.value),ee=Math.min(ee,re.value),_.push(re);V.properties.setColorScale&&ne.set(V.properties.legendUniqueId,v.scaleSequential().domain([ee,Q]).interpolator(v.interpolateRgb(V.properties.startColor,V.properties.endColor)))}),ve.chartData=_,ve.legendList=G,Te=JSON.parse(JSON.stringify(A));let F=Lt(ve.dimensionList,A,Ue);Re=ve.dimensionList;const q=v.stack().keys(ve.legendList).offset(v.stackOffsetDiverging)(F);ae();let ue=1/0;for(const V of q)for(const[P]of V)ue=Math.min(ue,P);ve.yMinLeft=ue>0?0:ue,ve.yMaxLeft=1;let B=t?Tt(e.xAxisLabel.xAxisNumberFormat,ve.dimensionList).map(V=>V):ve.dimensionList;ve.dimensionList.forEach((V,P)=>{ve.formattedDimensionListMap.set(V,B[P])}),e.plotArea.hideZeroValues&&(ve.hideZeroValues=!0)},We=()=>{let _=yt(H||ve.yMaxLeft,ve.yMinLeft,M,e,ve,Y,H).yAxisLabelArray;if(ve.yMaxLeft=_[_.length-1],ve.yMinLeft=_[0],T=v.scaleLinear().domain([ve.yMinLeft<0?-1:0,1]).range([d>0?M-d:M,0]),N=[0,X],e.seriesLabel.seriesLabelVisibility){let G=la(X,T,e,Te,void 0,U,M,!0);G.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&G.heightWidth[0],e.seriesLabel.seriesLabelPosition=="Right"?N=[0,X-G.heightWidth[0]]:N=[G.heightWidth[0],X]}},be=()=>{f=v.scalePoint().domain(Re).range(N).padding(.5)},ze=()=>{{const _=e.yAxisLabel.yAxisTicksMode===wa.custom,G=parseInt(e.yAxisLabel.yAxisLabelDecimalPrecision)||0;Z=v.axisLeft(T).tickFormat(v.format(`.${G}%`)).tickSize(zt(e,X)).tickValues(_?za(ve.yMinLeft<0?-1:0,1,e.yAxisLabel.yAxisTicksCount):null).ticks(d>0?(M-d)/80:M/80).tickPadding(8).tickSizeOuter(0)}},ke=()=>{fe=v.axisBottom(f).tickSize(sa(e,M,d,!0)).tickSizeOuter(0).tickValues(gt(Re,X,e))},Se=_=>{Le.forEach((P,C)=>P.forEach((re,j)=>{_[C].data[j]&&_[C].data[j][0]!==void 0&&_[C].data[j][1]!==void 0&&(_[C].data[j][0]=re[0]=re.data.total===0?0:re[0]/re.data.total,_[C].data[j][1]=re[1]=re.data.total===0?0:re[1]/re.data.total)})),_.forEach(P=>{P.data.forEach(C=>{C.hideZero=P.properties.hideZeroValues,C.axis=P.properties.axis})}),Re.forEach(P=>{y.append("rect").attr("id",`dim-background-${P}`).attr("class","dimension-background").attr("x",f(P)-f.step()/2).attr("width",f.step()).attr("y",0).attr("height",M).attr("fill","#E5E5E5").attr("visibility","hidden").lower()});let G=y.selectAll(".parentGroup").data([Le]);G=G.enter().append("g").attr("class","columns parentGroup").merge(G);let Q=G.selectAll(".column-group").data(P=>P);Q=Q.enter().append("g").attr("class",P=>"column-group "+P.key.replace(/ /g,"-")).attr("hoverId",P=>(_[P.index].properties.alias||_[P.index].properties.name||"Legend").replace(/\s+/g,"-")).merge(Q);let F=Q.selectAll("rect").data(P=>P);const q=(P,C)=>{const re=Array.from(Q.nodes()).indexOf(P[C].parentNode);return{props:A[re]?.properties,groupIndex:re}},ue=F.enter().append("rect").attr("x",P=>f(P.data.dimension)-L/2).attr("width",L).attr("y",T(0)).attr("height",0).attr("fill",(P,C,re)=>{const{props:j}=q(re,C);return ne.get(j.legendUniqueId)?.(P.data[P.key])??j?.color??"gray"}).attr("stroke",(P,C,re)=>{const{props:j}=q(re,C);return j?.stackBorderStyle===0?"none":e.column.stackBorderVisibility?j.stackBorderColor:"none"}).attr("stroke-dasharray",(P,C,re)=>{const{props:j}=q(re,C);return j?.stackBorderStyle===2?"5,3":"0"}).attr("stroke-width",(P,C,re)=>{const{props:j}=q(re,C);return(j?.stackBorderWidth||0)+"px"}).style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",(P,C,re)=>{const{props:j}=q(re,C);return P.data[P.key]===0&&j?.hideZeroValues?"hidden":"visible"}).attr(lt.SeriesId,P=>P.key??"").attr(lt.DimValue,P=>Array.isArray(P.data.dimension)?String(P.data.dimension[0]):String(P.data.dimension)),B=e.animation.animationEnabled;(P=>B?P.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):P)(ue).attr("y",P=>P[1]>=P[0]?T(P[1]):T(P[0])).attr("height",P=>Math.abs(T(P[0])-T(P[1]))),ue.merge(F).on("mousemove",(P,C)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:ve.formattedDimensionListMap.get(C.data.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():C.properties?.currentMeasure?C.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||C.value,value:Xe(C[1]-C[0],e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:C.properties.alias}],e,P,C.properties,At(p,String(C.data.dimension??""),{...C.properties,formattedDimensionValue:String(ve.formattedDimensionListMap.get(C.data.dimension)??C.data.dimension??"")}))}).on("mouseout",(P,C)=>{ot()}).on("click",vt(W,g,(P,C)=>({seriesId:C.key??"",dimValue:Array.isArray(C.data.dimension)?String(C.data.dimension[0]):String(C.data.dimension),legendUniqueId:C.key??"",seriesDisplayName:C.properties?.alias||C.key||""}))),Q.exit().remove(),y.selectAll(".parentGroup").raise()},oe=_=>{X=h-_.left-_.right,M=k-_.bottom-_.top},$=(_,G,Q)=>{Te=G,Re=_,J=Q,R()},R=()=>{be(),ke(),ae(),ta(y,ve,w,e,d,T,fe,ye,k,L,t,X,M,Re,f),Se(Te),Ya(Le,f,T,a,I,pt,[],[],e,u,k,h,X,Re,M,m,i,x,d,o),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,i,y,s,f.bandwidth(),T,f,void 0,void 0,void 0,d,u,e,D,z,ve.dimensionList,X,N,ve.formattedDimensionListMap,m,I,M))},ae=()=>{let _=Lt(Re,Te,Ue);Le=v.stack().keys(ve.legendList).offset(v.stackOffsetDiverging)(_),Te.forEach((Q,ee)=>Q.data.forEach((F,q)=>{F[0]=Le[ee][q][0],F[1]=Le[ee][q][1]}));let G=e.annotation.annotationSetLabelColor;Le.forEach((Q,ee)=>Q.forEach(F=>{F.key=Q.key,Q.color=JSON.parse(JSON.stringify(A[ee].properties.color)),Q.individualAnnotationVisibility=JSON.parse(JSON.stringify(A[ee].properties.individualAnnotationVisibility)),F.data.labelPosition=A[ee].properties.dataLabelPosition,F.data.labelColor=G=="2"?JSON.parse(JSON.stringify(A[ee].properties.color)):A[ee].properties.labelColor,F.hideZero=JSON.parse(JSON.stringify(A[ee].properties.hideZeroValues)),F.properties=A[ee].properties}))};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},Ca="ChartsWithoutAxisFunctions.ts";function Oi(t,e,n){if(!e?.plotArea?.plotAreaRangeFilter?.enabled)return t;const{condition:o,minVal:x,maxVal:l}=e.plotArea.plotAreaRangeFilter;return t.filter(r=>{const c=n(r);switch(o){case"lt":return c<=l;case"gt":return c>=x;case"in":return c>=x&&c<=l;case"not-in":return c<x||c>l;default:return!0}})}function el(t,e,n,o,x,l){try{o.xAxisLabel.xAxisDateFormat=o.xAxisLabel.xAxisDateFormat=="DD-MM-YYYY"?",":o.xAxisLabel.xAxisDateFormat;let r={top:0,left:0,right:0,bottom:0},c=t*.15*.8,p=l[0],m=c<p+10?c:p+10,L=o.plotArea.numberOfBubbles?20:0;const u=Ke(o.xAxisLabel.xAxisDisplayUnits,o.xAxisLabel.xAxisNumberFormat,o.xAxisLabel.xAxisLabelDecimalPrecision??"2")(x).toString();let g=Pt(u,o.xAxisLabel.xAxisLabelFontSize,o.xAxisLabel.xAxisLabelFontFamily,o.xAxisLabel.xAxisLabelRotation)[3]+10,W=o.xAxisTitle.xAxisTitleVisibility?o.xAxisTitle.xAxisDynamicTitleText.length!==0?$t(o.xAxisTitle.xAxisTitleHTML,void 0,void 0).height:$t(o.xAxisTitle.xAxisTitleText,13,tt).height:0;W=W>e*.1?e*.1:W;let A=o.xAxisLabel.xAxisLabelVisibility?g:0,E=o.yAxisTitle.yAxisTitleVisibility?o.yAxisTitle.yAxisDynamicTitleText.length!==0?$t(o.yAxisTitle.yAxisTitleHTML,void 0,void 0).height:$t(o.yAxisTitle.yAxisTitleText,13,tt).height:0;E=E>t*.1?t*.1:E;let b=o.yAxisLabel.yAxisLabelVisibility?$t(Ke(o.yAxisLabel.yAxisDisplayUnits,o.yAxisLabel.yAxisNumberFormat,o.yAxisLabel.yAxisLabelDecimalPrecision??"2")(n).toString(),rt(o.yAxisLabel.yAxisLabelFontSize),o.yAxisLabel.yAxisLabelFontFamily,o.yAxisLabel.yAxisLabelRotation).width+10:0,U=o.chartTitle.chartTitleVisibility?o.chartTitle.dynamicTitleText.length!==0?$t(o.chartTitle.chartTitleHTML,void 0,void 0).height:$t(o.chartTitle.chartTitleText,16,tt).height:0;U=U>e*.1?e*.1:U;let Y=o.legends.legendPosition,H=o.legends.legendVisibility,I=!1;switch(H||(Y="None"),Y){case Je.none:r.top=U+5,r.bottom=W+A+5+L,r.right=15,r.left=E+b+5;break;case Je.top:r.top=40+U,r.bottom=W+A+5+L,r.right=15,r.left=E+b+5;break;case Je.right:r.right=m+35,r.top=U+5,r.bottom=W+A+5+L,r.left=E+b+5;break;case Je.bottom:r.bottom=40+A+W+L,r.top=U+5,r.right=15,r.left=E+b+5;break;case Je.left:r.left=m+E+b+33,r.top=U+5,r.bottom=W+A+5+L,r.right=15}o.xAxisLabel.xAxisPosition&&o.xAxisLabel.xAxisPosition=="1"&&(r.bottom=r.bottom-A,r.top=r.top+A);let D=o.chartPadding.paddingArrayLTRB;D&&(r.top+=D[1],r.bottom+=D[3],r.right+=D[2],r.left+=D[0]);let w=e-r.top-r.bottom,z=t-r.left-r.right;return{margins:r,yLabel:b,xLabel:A,yTitle:E,xTitle:W,chartTitleHeight:U,legendMargin:m,innerHeight:w,innerWidth:z}}catch(r){Ma(Ca,"marginCalculationForBubbleScatter",r)}}function tl(t,e,n){try{let o=parseFloat(t.yAxisLabel.yAxisIntervalText),x=parseFloat(t.yAxisLabel.yAxisMaxText),l=parseFloat(t.yAxisLabel.yAxisMinText);if(t.yAxisLabel.yAxisIntervalsVisibility){l=t.yAxisLabel.yAxisMinText!==""?parseFloat(t.yAxisLabel.yAxisMinText):e;let u=t.yAxisLabel.yAxisMaxText;x=u.length>0?parseFloat(u):n,x&&(n=x)}else x=n,l=e,o=void 0;let r=e?Ke(t.yAxisLabel.yAxisDisplayUnits,t.yAxisLabel.yAxisNumberFormat,t.yAxisLabel.yAxisLabelDecimalPrecision??"2")(e).toString().length:0,c=n?Ke(t.yAxisLabel.yAxisDisplayUnits,t.yAxisLabel.yAxisNumberFormat,t.yAxisLabel.yAxisLabelDecimalPrecision??"2")(n).toString().length:0,p=x?Ke(t.yAxisLabel.yAxisDisplayUnits,t.yAxisLabel.yAxisNumberFormat,t.yAxisLabel.yAxisLabelDecimalPrecision??"2")(x).toString().length:0,m=l?Ke(t.yAxisLabel.yAxisDisplayUnits,t.yAxisLabel.yAxisNumberFormat,t.yAxisLabel.yAxisLabelDecimalPrecision??"2")(l).toString().length:0,L=r<c?n:e;if(l){let u=m<c?n:l;L=L<u?u:L}if(x){let u=p>r?x:e;L=L<u?u:L}return x&&l&&(L=p>m?x:l),{longestMeasure:L,customYaxisIntervalValue:o,customYaxisMaxValue:x,customYaxisMinValue:l}}catch(o){Ma(Ca,"customYscaleLabelFormatting",o)}}function al(t,e,n){try{let o=parseFloat(t.xAxisLabel.xAxisIntervalText),x=parseFloat(t.xAxisLabel.xAxisMaxText),l=parseFloat(t.xAxisLabel.xAxisMinText);if(t.xAxisLabel.xAxisIntervalsVisibility){l=t.xAxisLabel.xAxisMinText!==""?parseFloat(t.xAxisLabel.xAxisMinText):e;let u=t.xAxisLabel.xAxisMaxText.toString();x=u.length>0?parseFloat(u):n,x&&(n=x)}else x=n,l=e,o=void 0;let r=e?Ke(t.xAxisLabel.xAxisDisplayUnits,t.xAxisLabel.xAxisNumberFormat,t.xAxisLabel.xAxisLabelDecimalPrecision??"2")(e).toString().length:0,c=n?Ke(t.xAxisLabel.xAxisDisplayUnits,t.xAxisLabel.xAxisNumberFormat,t.xAxisLabel.xAxisLabelDecimalPrecision??"2")(n).toString().length:0,p=x?Ke(t.xAxisLabel.xAxisDisplayUnits,t.xAxisLabel.xAxisNumberFormat,t.xAxisLabel.xAxisLabelDecimalPrecision??"2")(x).toString().length:0,m=l?Ke(t.xAxisLabel.xAxisDisplayUnits,t.xAxisLabel.xAxisNumberFormat,t.xAxisLabel.xAxisLabelDecimalPrecision??"2")(l).toString().length:0,L=r<c?n:e;if(l){let u=m<c?n:l;L=L<u?u:L}if(x){let u=p>r?x:e;L=L<u?u:L}return x&&l&&(L=p>m?x:l),{longestDimension:L,customXaxisIntervalValue:o,customXaxisMaxValue:x,customXaxisMinValue:l}}catch(o){Ma(Ca,"customXscaleLabelFormatting",o)}}function il(t,e,n,o,x,l,r,c,p,m,L){try{let u=t.xAxisLabel.xAxisPosition,S=!0,W=n.append("foreignObject").attr("visibility",e?t.yAxisTitle.yAxisTitleVisibility?"visible":"hidden":t.xAxisTitle.xAxisTitleVisibility?"visible":"hidden").attr("transform",!t.plotArea.fitChart&&S?`translate(${o.left},${o.top+L+(t?.xAxisLabel?.xAxisPosition=="1"?0:x)})`:!t.plotArea.fitChart&&!1?`translate(${o.left},${l-r-5})`:`translate(${o.left},${o.top+L+(S?t?.xAxisLabel?.xAxisPosition=="1"?0:x:c=="tornado"?x+5:p+5)})`).attr("class","xAxisTitle").attr("width",m).attr("height",r+"px").style("z-index","9999");t.xAxisTitle.xAxisDynamicTitleText.length!==0?W.append("xhtml:div").style("color","rgba(119,119,119)").attr("title",t.xAxisTitle.xAxisTitleText).style("white-space","pre").style("text-overflow","ellipsis").html(t.xAxisTitle.xAxisTitleHTML?t.xAxisTitle.xAxisTitleHTML:t.xAxisTitle.xAxisTitleText):W.append("xhtml:h3").style("white-space","pre").style("text-overflow","ellipsis").style("user-select","none").style("margin",0).style("padding",0).style("text-align","center").style("overflow","hidden").attr("class","xAxisTitle").style("padding-top","5px").style("text-anchor","middle").style("color","rgba(119,119,119)").style("font-size","12px").style("font-size",t.xAxisTitle.xAxisTitleFontSize).style("font-family",t.xAxisTitle.xAxisTitleFontFamily).style("font-style",t.xAxisTitle.xAxisTitleFontStyle).attr("title",t.xAxisTitle.xAxisTitleText!=="~$~Dimension"?t.xAxisTitle.xAxisTitleText:"").html(t.xAxisTitle.xAxisTitleText!=="~$~Dimension"?t.xAxisTitle.xAxisTitleText:"")}catch(u){Ma(Ca,"setXaxistitle",u)}}function ll(t,e,n,o,x,l,r,c){try{let p=n>0?t-n:t,m=x.append("foreignObject").attr("visibility",o?e.xAxisTitle.xAxisTitleVisibility?"visible":"hidden":e.yAxisTitle.yAxisTitleVisibility?"visible":"hidden").attr("x",`-${l.top+p}`).attr("y",l.left-r-c+5).attr("class","yAxisTitle").attr("transform","rotate(-90)").attr("width",p).attr("height",r+"px");return e.yAxisTitle.yAxisDynamicTitleText.length!==0?m.append("xhtml:div").style("color","rgba(119,119,119)").attr("title",e.yAxisTitle.yAxisTitleText).style("white-space","pre").style("text-overflow","ellipsis").html(e.yAxisTitle.yAxisTitleHTML?e.yAxisTitle.yAxisTitleHTML:e.yAxisTitle.yAxisTitleText):m.append("xhtml:h3").style("white-space","pre").style("text-overflow","ellipsis").style("user-select","none").style("margin",0).style("padding",0).style("text-align","center").style("overflow","hidden").attr("class","xAxisTitle").style("text-anchor","middle").style("color","rgba(119,119,119)").style("font-size","12px").style("font-size",e.yAxisTitle.yAxisTitleFontSize).style("font-family",e.yAxisTitle.yAxisTitleFontFamily).style("font-style",e.yAxisTitle.yAxisTitleFontStyle).attr("title",e.yAxisTitle.yAxisTitleText).html(e.yAxisTitle.yAxisTitleText),x}catch(p){Ma(Ca,"yAxistitle",p)}}function rl(t,e,n,o,x,l){try{let r=parseFloat(o.yAxisLabel.yAxisIntervalText),c=[],p;if(r&&r!==0&&r!==void 0){let m=x||x==0?x:e,L=l||l==0?l:t;m<0?p=Math.floor((L-m)/r):p=Math.floor(L/r);let u=18;(l||l==0)&&(t=l);let S=x||x==0?x:e<0?Math.round(e):0;if(c.push(S),p>100){let g="Tick count cannot exceed more than 100.";m<0?r=(L-S)/100:r=L/100}if(p=p<100?p:100,p>u)for(let g=0;g<parseInt(p)&&(S+=r,parseFloat(S.toFixed(5))<=t);g++)c.push(S);else for(let g=0;g<u&&(S+=r,S<=t);g++)c.push(S)}else if(o.yAxisLabel.yAxisTicksMode===wa.custom){let m=x||x==0?x:e;c=za(m,t,o.yAxisLabel.yAxisTicksCount),p=c.length}else p=n/60;return{yAxisLabelArray:c,customTickValue:p}}catch(r){Ma(Ca,"responsiveYaxisLabel",r)}}function Ti(t,e,n,o,x,l,r,c){try{let p=!0,m=parseFloat(o.xAxisLabel.xAxisIntervalText),L=[],u;if(m&&m!==0&&m!==void 0){let S=x||x==0?x:e,g=l||l==0?l:t;S<0?u=Math.floor((g-S)/m):u=Math.floor(g/m);let W=18;(l||l==0)&&(t=l);let A=x||x==0?x:e<0?Math.round(e):0;if(L.push(A),p=!1,u>100){let E="Tick count cannot exceed more than 100.";S<0?m=(g-A)/100:m=g/100}if(u=u<100?u:100,u>W)for(let E=0;E<parseInt(u)&&(A+=m,parseFloat(A.toFixed(5))<=t);E++)L.push(A);else for(let E=0;E<W&&(A+=m,A<=t);E++)L.push(A)}else if(o.xAxisLabel.xAxisTicksMode===wa.custom){let S=x||x==0?x:e,g=l||l==0?l:t;L=za(S,g,o.xAxisLabel.xAxisTicksCount),p=!1,u=L.length}else{const S=Ke(o.xAxisLabel.xAxisDisplayUnits,o.xAxisLabel.xAxisDateFormat,o.xAxisLabel.xAxisLabelDecimalPrecision??"2")(l||t).toString();let g=Pt(S,o.xAxisLabel.xAxisLabelFontSize,o.xAxisLabel.xAxisLabelFontFamily,0);L=Bi(x||e,l||t,c?r:n,g[0]),u=n/30}return{xAxisLabelArray:L,customTickValue:u,autoLabelFlag:p}}catch(p){Ma(Ca,"responsiveXaxisLabel",p)}}function nl(t,e,n,o,x,l){try{let r=e.yAxisLabel.yAxisLabelFontStyle;t.append("rect").attr("transform",`translate(${-o},0)`).attr("height",n>0?l-n:l).attr("width",o).attr("fill",e.yAxisLabel.yAxisLabelVisibility&&e.yAxisLabel.yAxisBackgroundColor?e.yAxisLabel.yAxisBackgroundColor!==Ie.white?e.yAxisLabel.yAxisBackgroundColor:"none":e.chartArea.chartAreaColor);const c=t.append("g").call(x);c.selectAll("line").style("shape-rendering","crispEdges").attr("stroke",e.plotArea.gridLinesColor).attr("stroke-width","0.05em"),c.selectAll("text").style("fill",e.yAxisLabel.yAxisLabelColor!==Ie.white?e.yAxisLabel.yAxisLabelColor:"none").style("user-select","none").style("font-size",e.yAxisLabel.yAxisLabelFontSize).style("font-family",e.yAxisLabel.yAxisLabelFontFamily).style("font-style",e.yAxisLabel.yAxisLabelFontStyle).style("font-style",r.includes(ce.italic)?ce.italic:"").style("text-decoration",r.includes(ce.underline)?ce.underline:"").style("font-weight",r.includes(ce.bold)?ce.bold:"").attr("visibility",e.yAxisLabel.yAxisLabelVisibility?"visible":"hidden"),c.select(".domain").style("shape-rendering","crispEdges").style("stroke",e.yAxisLabel.yAxisColor).attr("stroke-width",e.yAxisLabel.yAxisWidth?e.yAxisLabel.yAxisWidth:e.plotArea.plotAreaBorderThickness)}catch(r){Ma(Ca,"initYaxis",r)}}function sl(t,e,n,o,x,l,r,c,p){try{let m=e.xAxisLabel.xAxisLabelFontStyle,L=e.xAxisLabel.xAxisPosition,u=e.xAxisLabel.xAxisLabelRotation;u=parseInt(u),t.append("rect").attr("transform",`translate(1,${L==="0"?n>0?l-n:l:L==="1"?-o:p(0)})`).attr("height",o).attr("width",r).attr("fill",e.xAxisLabel.xAxisLabelVisibility&&e.xAxisLabel.xAxisBackgroundColor?e.xAxisLabel.xAxisBackgroundColor!==Ie.white?e.xAxisLabel.xAxisBackgroundColor:"none":e.chartArea.chartAreaColor);const S=t.append("g").attr("transform",`translate(0,${L==="0"?l:L==="1"?0:p(0)})`).call(x);let g=L==="1"?"5":"0";S.selectAll("g").append("foreignObject").attr("class","testingoverflowing").style("width",Math.round(o)).style("height","20px").attr("transform",(A,E)=>`rotate(${L==="1"?-u:u!=0?180-u:0}) translate (${u!=0?g+", -5":-o/2+" , "+(L==="1"?"-15":"8")})`).append("xhtml:h3").style("transform",L==="1"?"":u!=0?"rotate(180deg)":"0").style("white-space","pre").style("text-overflow","ellipsis").style("text-align",u!=0?"start":"center").style("user-select","none").style("margin",0).style("padding",0).style("overflow","hidden").style("font-family",e.xAxisLabel.xAxisLabelFontFamily).style("color",e.xAxisLabel.xAxisLabelColor).style("font-size",e.xAxisLabel.xAxisLabelFontSize+"px").style("font-style",m.includes(ce.italic)?ce.italic:"").style("text-decoration",m.includes(ce.underline)?ce.underline:"").style("font-weight",m.includes(ce.bold)?ce.bold:"").style("visibility",e.xAxisLabel.xAxisLabelVisibility?"visible":"hidden").attr("title",(A,E)=>Ke(e.xAxisLabel.xAxisDisplayUnits,e.xAxisLabel.xAxisNumberFormat,e.xAxisLabel.xAxisLabelDecimalPrecision)(A)).html((A,E)=>Ke(e.xAxisLabel.xAxisDisplayUnits,e.xAxisLabel.xAxisNumberFormat,e.xAxisLabel.xAxisLabelDecimalPrecision)(A)),S.selectAll("text").style("visibility",(e.xAxisLabel.xAxisLabelVisibility,"hidden")),S.selectAll("line").style("stroke",e.plotArea.gridLinesColor).style("shape-rendering","crispEdges").attr("visibility",e.xAxisLabel.xAxisLabelVisibility||e.plotArea.gridLinesVertical?"visible":"hidden"),S.select(".domain").style("stroke",e.xAxisLabel.xAxisColor).attr("stroke-width",e.xAxisLabel.xAxisWidth?e.xAxisLabel.xAxisWidth:e.plotArea.plotAreaBorderThickness).style("shape-rendering","crispEdges")}catch(m){Ma(Ca,"initXaxis",m)}}function ol(t,e,n,o,x,l,r,c,p,m,L){try{if(!n.annotation.annotationVisibility)return;const u=n.plotArea.annotationType??"1",S=[u==="1"?"connector":""],g=n.plotArea.connectorType?.toLowerCase()??"none",W=u==="5",A=n.plotArea.rotation??0,E=x===le.PieChart?1.06:1.1,b={1:"",2:v.curveLinear,3:v.curveStep},U=(O,X)=>[[0,0],[O/2,X/2],[O,X]],Y={solid:"unset",dotted:"2,2",dashed:"6,4"};let H=t.annotation(),I=JSON.parse(JSON.stringify(n.plotArea.dataLabelsCoordinates||[]));I=I.map(O=>({dx:O.dx??0,dy:O.dy??0,ratioDistance:O.ratioDistance,ratioAngle:O.ratioAngle,connectorPoints:O.connectorPoints||O.connector?.points||[],radius:O.radius??p,data:O.data,width:l,height:r}));const D=e.reduce((O,X)=>O+(X?.data?.data?.[0]?.value??0),0),w=D===0?1:D,z=(O,X)=>{const M=O.data.data[0].value,h=(O.x0+O.x1)/2,k=O.x1-O.x0;return{note:{title:n.plotArea.dataLabelName?O.data.legend:"",label:n.plotArea.dataLabelValue&&M!==0?n.plotArea.dataLabelNumberFormat===",.0%"?(Math.abs(M/w)*100).toFixed(rt(n.plotArea.dataLabelDecimalPrecision))+"%":Ke(n.plotArea.plotAreaDisplayUnits,n.plotArea.dataLabelNumberFormat,n.plotArea.dataLabelDecimalPrecision)(M):"",align:"middle",wrap:1e3},data:{x:{legend:O.data.legend},y:{value:M},midAngle:h,isVisible:!0,hoverId:O?.data?.legend?.replace(/\s+/g,"-")??""},legendUniqueId:O.data.legend,dx:0,dy:0,connector:{end:g,curve:b[n.plotArea.connectorCurve],points:W?U(0,0):[[0,0],[0,0]]},disable:S,subject:{radius:3},type:ur(t,u),color:n.plotArea.connectorColor??"#ccc",width:l,height:r,index:X}};let K=e.filter(O=>O.x1-O.x0>1e-4).map(z);const ye=O=>(O.data.y?.value??0)!==0;K=K.filter(ye),K=Ut(K,n,O=>O.data.y.value);let se=new Map(I.map(O=>[O.data?.x?.legend,O])),te=[];K.forEach(O=>{const X=O.data.x.legend,M=se.get(X);if(M){if(M.ratioDistance!=null&&M.ratioAngle!=null){const h=M.ratioDistance*p;O.dx=Math.cos(M.ratioAngle)*h,O.dy=Math.sin(M.ratioAngle)*h}else{const h=p/(M.radius||p);O.dx=M.dx*h,O.dy=M.dy*h}O.data.isVisible=M.data?.isVisible??!0,M.connectorPoints?.length>=(W?3:2)?O.connector.points=M.connectorPoints:O.connector.points=W?U(O.dx,O.dy):[[0,0],[0,0]]}te.push(O)}),H.editMode(n.plotArea.annotationDraggable&&m).accessors({x(O){return Math.cos(O.midAngle-Math.PI/2)*(p-p*.35)},y(O){return Math.sin(O.midAngle-Math.PI/2)*(p-p*.35)}}).on("dragend",function(O){te.forEach(M=>{if(M.data.x.legend===O.data.x.legend){const h=O._dx,k=O._dy,s=Math.sqrt(h*h+k*k),d=Math.atan2(k,h);M.dx=h,M.dy=k,M.ratioDistance=s/p,M.ratioAngle=d,M.width=l,M.height=r,M.connectorPoints=O.connector?.points||[]}});const X=te.map(M=>({data:{x:M.data.x,isVisible:M.data.isVisible??!0},dx:M.dx,dy:M.dy,ratioDistance:M.ratioDistance,ratioAngle:M.ratioAngle,connectorPoints:M.connectorPoints||[],width:l,height:r,radius:p}));L&&L(X)}).annotations(te);const xe=c.append("g").attr("class","annotation-group parentGroup").attr("transform",o).call(H),ge=n.plotArea.dataLabelNameFontStyle??[];xe.selectAll(".annotation-note-title").style("font-family",n.plotArea.dataLabelNameFontFamily).style("font-size",`${n.plotArea.dataLabelNameFontSize}px`).style("font-style",ge.includes("Italic")?"italic":"").style("text-decoration",ge.includes("Underline")?"underline":"").style("font-weight",ge.includes("Bold")?"bold":"").style("fill",n.plotArea.dataLabelNameColor??"#000");const pe=n.plotArea.dataLabelValueFontStyle??[];if(xe.selectAll(".annotation-note-label").style("font-family",n.plotArea.dataLabelValueFontFamily).style("font-size",`${n.plotArea.dataLabelValueFontSize}px`).style("font-style",pe.includes("Italic")?"italic":"").style("text-decoration",pe.includes("Underline")?"underline":"").style("font-weight",pe.includes("Bold")?"bold":"").style("fill",n.plotArea.dataLabelValueColor??"#000"),n.plotArea.plotAreaAbsoluteValue&&xe.selectAll(".annotation-note-label").each(function(O){const X=v.select(this),M=v.format(".2s")(Math.abs(O.data.y.value));X.append("tspan").attr("x",X.attr("x")??"0").attr("dy","1.2em").attr("fill-opacity",.5).attr("font-weight","300").style("font-family",n.plotArea.dataLabelValueFontFamily).style("font-size",`${n.plotArea.dataLabelValueFontSize}px`).style("fill",n.plotArea.dataLabelValueColor??"#000").text(M)}),g==="diamond"){const O=n.plotArea.connectorColor??"#ccc",X=5;xe.selectAll(".annotation-connector").each(function(){v.select(this).select("path.connector").empty()||v.select(this).append("polygon").attr("class","connector-end connector-diamond").attr("points",`0,${-X} ${X},0 0,${X} ${-X},0`).style("fill",O).style("stroke",O)})}if(xe.selectAll("rect,.annotation-subject").remove(),n.animation?.animationEnabled){const O=n.animation.animationDuration,X=et[n.animation.animationEffect],M=xe.selectAll(".annotation-note-label");M.interrupt().style("opacity",0),setTimeout(()=>{M.transition().delay((h,k)=>k*30).duration(O).ease(X).style("opacity",1)},50)}const he=n.plotArea.connectorColor??"#ccc";xe.selectAll(".connector").style("stroke",he).attr("hoverId",O=>O.data.hoverId).attr("stroke-dasharray",Y[n.plotArea.connectorStyle?.toLowerCase()]),xe.selectAll(".connector-end").attr("hoverId",O=>O.data.hoverId).style("fill",he).style("stroke",he),xe.selectAll(".annotation-note-title").attr("hoverId",O=>O.data.hoverId),xe.selectAll(".annotation-note-label").attr("hoverId",O=>O.data.hoverId).filter(O=>!O.data.isVisible).style("display","none"),xe.selectAll(".annotation-note-label").filter(O=>n.plotArea.hideInsignificantValue&&O.data.x1-O.data.x0<.09).style("visibility","hidden")}catch(u){throw u}}const ur=(t,e)=>{try{return{1:t.annotationLabel,2:t.annotationLabel,3:t.annotationCallout,4:t.annotationCalloutElbow,5:t.annotationCalloutCurve}[e]}catch(n){throw n}},cl=(t,e,n,o,x,l,r,c,p,m)=>{try{if(n.plotArea.numberOfBubbles){let L=e=="Bottom"?o-55:o-25;t.append("foreignObject").attr("transform",`translate(${l.left},${L})`).attr("width",x).attr("height","20px").append("xhtml:div").style("white-space","pre").style("color",Ie.black).style("font-size","12px ").style("text-overflow","ellipsis").html((n.plotArea.totalAlias?n.plotArea.totalAliasText:"Total count : ")+m)}}catch(L){Ma(Ca,"setnumberOfBubbles",L)}};function Ma(t,e,n){console.error(`[${t}] [${e}]`,n)}const xr=({isDateType:t,formatOptions:e,data:n})=>{const o=crypto.randomUUID(),x=0,l=le.ColumnHistogramChart,r=Ce.useRef(),c=n.ChartData,p=n.DimensionList,m=!1,L=!1,u=!1;let S=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,g=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,W=e.xAxisLabel.xAxisIntervalsVisibility?parseFloat(e.xAxisLabel.xAxisMinText):void 0,A=e.xAxisLabel.xAxisIntervalsVisibility?parseFloat(e.xAxisLabel.xAxisMaxText):void 0,E,b,U,Y,H,I,D,w,z,K,ye,se,te,xe,ge,pe=[],he=[],O,X,M,h,k,s,d,i,y,T,a,f,N,ne=[],Z=0;const fe=2;let Re=[],Te={dimensionList:p,chartType:l,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Me()}catch(ke){me("Columnchart","createColumnChart",ke)}},[e]);const Me=()=>{({formatOptions:e,svg:k,width:O,height:X}=Ft(r,e)),{formatOptions:e,dataTableLegendsList:Re}=ea(e,c,n.DataTableData??[]),J(),{maxNumberForPrimaryAxis:ye,maxNumberForSecondaryAxis:se}=Rt(e,Te.yMinLeft,Te.yMaxLeft,Te.yMinRight,Te.yMaxRight),{margin:E,yLabel:b,xLabel:U,yTitle:Y,xTitle:H,dimensionHeightWidthArray:I,chartTitleHeight:D,secondaryAxisTitleWidth:w,legendMargin:z,secondaryYLabel:K}=Mt(O,X,ye,se,Te.yMaxLeft,e,Te.legendList,Te.dimensionList,Te.yMaxRight,L,u,t,m,Te,Re),We(E),{dataTable:M,dataTableHeight:h}=ia(e,b,Y,c,Te.dimensionList),St(k,O,X,e),s=wt(k,E),kt(s,e,h,te,xe,l),Ee(),Ue(),ve(),Zt(s,e,h,b,a,xe),be(c,X,k,E,te),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,k,s,M,x,d,i,y,void 0,void 0,h,l,e,b,Y,Te.dimensionList,te,T,Te.formattedDimensionListMap,o,E,xe)),Dt(e,m,k,E,U,X,H,Te.chartType,b,te,xe),Vt(xe,e,h,m,k,E,Y,b),Gt(k,L,E,e,h,xe,te,K,w),Nt(k,e,O,D),It(X,k,I,D,O,z,e,c,o,h,E,ct.rectangle)},J=()=>{const ke=[],Se=[];let oe=[],$=-1/0,R=1/0;c.forEach(G=>{Se.push(G.legend),G.data.forEach(Q=>{ke.push(Q),$=Math.max($,Q.value),R=Math.min(R,Q.value)})}),Te.chartData=ke,Te.legendList=Se,Te.yMaxLeft=$,Te.yMinLeft=R>0?0:R,ne=JSON.parse(JSON.stringify(c)),ne.forEach(G=>G.data.forEach(Q=>oe.push(Q.value)));let ae=S||S==0?S:0,_=g||g==0?g:ne[0]?.data?.length;if(Te.yMaxLeft=parseFloat((ae+"").length>(_+"").length?ae+"":_+""),Te.xMax=v.max(oe),Te.xMin=v.min(oe),Te.xMin===Te.xMax){const G=Te.xMax===0?1:Math.abs(Te.xMax*.1);Te.xMin-=G,Te.xMax+=G}},Ee=()=>{switch(e.bins.binsCalculation){case"Automatic":ge=te/50;break;case"Number of Bins":Le(!1);break;case"Bin Width":Le(!0)}},Le=ke=>{ne.forEach(R=>R.data.sort(function(ae,_){return ae.value-_.value}));let Se=Te.xMax-Te.xMin,oe;ke?(parseFloat(e.bins.binsCalculationValue)<=2&&(e.bins.binsCalculationValue="3"),oe=Se/parseFloat(e.bins.binsCalculationValue)):(parseFloat(e.bins.binsCalculationValue)<=1&&(e.bins.binsCalculationValue="1"),oe=Se/parseFloat(e.bins.binsCalculationValue));let $=Te.xMin;if(ke)for(pe=[$];$<Te.xMax;)$+=oe,pe.push($);else for(pe=[$];Math.round($)<Math.round(Te.xMax);)$+=oe,pe.push(Math.round($))},Ue=()=>{i=v.scaleLinear().domain([Te.xMin,Te.xMax]).range([0,te]);const ke=pe.length>0?pe:i.ticks(ge);let Se=v.bin().value($=>$).domain(i.domain()).thresholds(ke);ne.forEach($=>{let R=Se($.data.map(ae=>ae.value));he.push(R)}),ne.forEach(($,R)=>he[R].forEach(ae=>{ae.name=$.properties.legend,ae.color=$.properties.color,ae.opacity=$.properties.opacity}));let oe=[];he.forEach($=>$.forEach(R=>oe.push(R.length))),Te.yMaxLeft=v.max(oe),Te.yMinLeft=v.min(oe),d=v.scaleLinear().range([xe,0]).domain([S||S==0?S:0,g||g==0?g:Te.yMaxLeft+.2*Te.yMaxLeft])},ve=()=>{Pe();{let ke=yt(Te.yMaxLeft,Te.yMinLeft,xe,e,Te,S,g,!1,te);a=v.axisLeft(d).tickFormat(Se=>Xe(Se,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,te)).tickValues(ke.autoLabelFlag?void 0:ke.yAxisLabelArray).ticks(ke.customTickValue).tickPadding(8).tickSizeOuter(0)}},Pe=()=>{let ke=parseInt(e.xAxisLabel.xAxisPosition);Ti(Te.xMax,Te.xMin,te,e,W,A,xe,!1).xAxisLabelArray.shift(),f=(ke==1?v.axisTop(i):v.axisBottom(i)).tickFormat(oe=>Xe(oe,e.xAxisLabel.xAxisDisplayUnits,e.xAxisLabel.xAxisNumberFormat,e.xAxisLabel.xAxisLabelDecimalPrecision,!1)).tickSize(sa(e,xe,h)).tickSizeOuter(0),e.bins.binsCalculation==="Automatic"?f.ticks(ge):f.tickValues(pe).ticks(te/50)},Ye=ke=>{const Se=e.animation.animationEnabled,oe=s.append("g").attr("class","parentGroup").selectAll("#scaling-svg"+o+" .rect").data(he).enter().append("g").selectAll("rect").data(R=>R).enter().append("rect").attr("class","rect").attr("stroke",e.bins.binsBorderVisibility&&e.bins.binsBorderColor).attr("stroke-width",e.bins.binsBorderVisibility&&e.bins.binsBorderThickness).attr("stroke-opacity",e.bins.binsBorderVisibility&&e.bins.binsBorderOpacity).attr("x",1).attr("transform",function(R){return"translate("+i(R.x0)+","+xe+")"}).attr("width",function(R){return i(R.x1)-i(R.x0)-parseFloat(e.bins.binsGapWidth)<0?0:i(R.x1)-i(R.x0)-parseFloat(e.bins.binsGapWidth)}).attr("height",0).style("fill",R=>R.color!==Ie.white?R.color:"none").style("opacity",e.bins.binsFillOpacity).style("shape-rendering","crispEdges").on("mousemove",(R,ae)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:`${ae.x0}-${ae.x1}`},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():ae.properties?.currentMeasure?ae.properties.currentMeasure:e.yAxisTitle.yAxisTitleText,value:Xe(e.toolTip.toolTipNumberFormat==",.0%"?Math.abs(ae.length/ne[0].data.length):ae.length,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision,!1)}],e,R)}).on("mouseout",ot);(Se?oe.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):oe).attr("transform",function(R){return"translate("+i(R.x0)+","+(d(R.length)>0?d(R.length):0)+")"}).attr("height",function(R){return xe-d(R.length)}),s.selectAll(".parentGroup").raise()},We=ke=>{te=O-ke.left-ke.right,xe=X-ke.bottom-ke.top},be=(ke,Se,oe,$,R)=>{if(!e.plotArea.fitChart){const ae=ke[0].data.length-fe,_=Se-20;N=Te.dimensionList.slice(Z,Z+fe),ne=JSON.parse(JSON.stringify(ke)),ne.forEach((ee,F)=>ne[F].data=ee.data.filter(q=>N.includes(q.dimension))),oe.append("rect").attr("x",$.left).attr("y",_).attr("width",R).attr("height",8).attr("fill","#ddd").attr("rx",4);const G=R*fe/Te.dimensionList.length,Q=oe.append("rect").attr("x",$.left).attr("y",_).attr("width",G).attr("height",8).attr("fill","#999").attr("rx",4).style("cursor","ew-resize").call(v.drag().on("drag",ee=>{let F=Math.min(Math.max(ee.x,$.left),$.left+R-G);Q.attr("x",F),Z=Math.round((F-$.left)/(R-G)*ae),N=Te.dimensionList.slice(Z,Z+fe),ne=JSON.parse(JSON.stringify(ke)),ne.forEach((q,ue)=>ne[ue].data=q.data.filter(B=>N.includes(B.dimension))),Pe(),ze()}));oe.on("wheel",ee=>{ee.preventDefault();const F=Math.abs(ee.deltaX)>Math.abs(ee.deltaY)?ee.deltaX:ee.deltaY;Z+=F>0?1:-1,Z=Math.max(0,Math.min(Z,ae));const q=$.left+(R-G)*Z/ae;Q.attr("x",q),ne=JSON.parse(JSON.stringify(ke)),ne.forEach((ue,B)=>ne[B].data=ue.data.filter(V=>N.includes(V.dimension))),Pe(),ze()})}ze()},ze=()=>{ta(s,Te,U,e,h,d,f,I,X,x,t,te,xe,N,i),Ye()};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:r,id:o,style:{width:"100%",height:"100%"}})})},hr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID(),L=0,u=le.LineChart,S=Ce.useRef(),g=Ce.useRef(c);g.current=c;const W=Ce.useRef(p);W.current=p;const A=mt(n.ChartData,n.DimensionList),E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled;let U=!1;const Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,w=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h=!1,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe,Ye,We,be=[],ze=0,ke=0,Se=0,oe=[],$={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{R()}catch(V){me("Linechart","createLineChart",V)}},[e]);const R=()=>{({formatOptions:e,svg:a,width:d,height:i}=Ft(S,e)),ae(),{formatOptions:e,dataTableLegendsList:oe}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:X,maxNumberForSecondaryAxis:M,customYaxisMaxValue:I,secondaryCustomYaxisMaxValue:w}=Rt(e,$.yMinLeft,$.yMaxLeft,$.yMinRight,$.yMaxRight),{margin:z,yLabel:K,xLabel:ye,yTitle:se,xTitle:te,dimensionHeightWidthArray:xe,chartTitleHeight:ge,secondaryAxisTitleWidth:pe,legendMargin:he,secondaryYLabel:O,visibleBars:ke,columnWidth:Se,scrollbarVisible:h}=Mt(d,i,X,M,$.yMaxLeft,e,$.legendList,$.dimensionList,$.yMaxRight,U,Y,t,b,$,oe),ue(z),{dataTable:y,dataTableHeight:T}=ia(e,K,se,A,$.dimensionList,n),b&&(y=[],T=0),St(a,d,i,e),f=wt(a,z),kt(f,e,T,k,s,u,m),_(),ee(),b?(ra(e,f,K,s,k,ve),U&&Ai(e,f,O,Pe,k)):(Zt(f,e,T,K,Te,s),U&&bi(f,e,T,O,J,s,k)),Dt(e,b,a,z,ye,i,te,$.chartType,K,k,s),Vt(s,e,T,b,a,z,se,K,k),U&&Gt(a,U,z,e,T,s,k,O,pe,b),Nt(a,e,d,ge),It(i,a,xe,ge,d,he,e,A,m,T,z,ct.line,u,l),_t(A,i,d,a,z,k,h,ke,$,ze,!1,G,b)},ae=()=>{const V=[],P=[];let C=[],re=-1/0,j=1/0,ie=-1/0,we=1/0;e.plotArea.hideZeroValues&&($.hideZeroValues=!0),A.forEach(de=>{P.push(de.properties.alias?de.properties.alias:de.legend),de.data.forEach(Ae=>{V.push(Ae),de.properties.axis==="Secondary"?(U=!0,ie=Math.max(ie,Ae.value),we=Math.min(we,Ae.value)):(re=Math.max(re,Ae.value),j=Math.min(j,Ae.value))})}),$.chartData=V,$.legendList=P,$.yMaxLeft=re,$.yMinLeft=j,$.yMaxRight=ie,$.yMinRight=we,C=t?Tt(e.xAxisLabel.xAxisNumberFormat,$.dimensionList).map(de=>de):$.dimensionList,$.dimensionList.forEach((de,Ae)=>{$.formattedDimensionListMap.set(de,C[Ae])}),be=JSON.parse(JSON.stringify(A)),e.plotArea.fitChart?We=$.dimensionList:We=$.dimensionList.slice(ze,ze+ke)},_=()=>{let V=yt(I||$.yMaxLeft,$.yMinLeft,s,e,$,H,I,b,k).yAxisLabelArray;$.yMaxLeft=V[V.length-1],$.yMinLeft=V[0];const P=b?[0,T>0?k-T:k]:[T>0?s-T:s,0];{const C=v.scaleLinear().domain([$.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:$.yMinLeft*.9:$.yMinLeft<0?$.yMinLeft*1.1:$.yMinLeft*.9,$.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:$.yMaxLeft*1.1]).range(P);b?Le=C:N=C}if(U){const C=v.scaleLinear().domain([$.yMinRight>=0?(D||D==0)&&!Number.isNaN(D)?D:0:(D||D==0)&&!Number.isNaN(D)?D:$.yMinRight*1.1,$.yMaxRight<=0?w||0:w||$.yMaxRight*1.1]).range(P);b?Ue=C:ne=C}if(fe=b?[s,0]:[0,k],!b&&e.seriesLabel.seriesLabelVisibility){let C=la(k,N,e,be,ne,U,s,!1);C.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(Re=C.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?fe=[0,k-C.heightWidth[0]]:fe=[C.heightWidth[0],k]}},G=(V,P,C)=>{be=P,We=V,ke=C,B()},Q=()=>{const V=v.scalePoint().domain(We).range(fe).padding(.5);b?Ee=V:Z=V},ee=()=>{{let V=yt(I||$.yMaxLeft,$.yMinLeft,s,e,$,H,I,b,k);b?ve=v.axisBottom(Le).tickFormat(P=>Xe(P,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-s:0).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??k/50).tickPadding(8).tickSizeOuter(0):Te=v.axisLeft(N).tickFormat(P=>Xe(P,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,k,Re)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue).tickPadding(8).tickSizeOuter(0)}if(U){let V=yt(w||$.yMaxRight,D||$.yMinRight,s,e,$,D,w);b?Pe=v.axisTop(Ue).tickFormat(P=>Xe(P,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??k/50).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-s:0).tickPadding(8).tickSizeOuter(0):J=v.axisRight(ne).tickFormat(P=>Xe(P,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue).tickSize(zt(e,k,Re)).tickPadding(8).tickSizeOuter(0)}},F=()=>{b?Ye=v.axisLeft(Ee).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*k*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(We,s,e)):Me=v.axisBottom(Z).tickSize(sa(e,s,T,!0)).tickSizeOuter(0).tickValues(gt(We,k,e))},q=V=>{const P=[...V].reverse();P.forEach(Ae=>{Ae.data.forEach(De=>{De.hideZero=Ae.properties.hideZeroValues,De.axis=Ae.properties.axis})});const C=b?v.line().y(Ae=>{const De=Ee(Ae.dimension);return De??0}).x(Ae=>Ae.axis===Qe.primary?Le(Ae.value):Ue(Ae.value)).defined(Ae=>Ae.hideZero||$.hideZeroValues?!!Ae.value:!0).curve(ft(e)):v.line().x(Ae=>{const De=Z(Ae.dimension);return De??0}).y(Ae=>Ae.axis===Qe.primary?N(Ae.value):ne(Ae.value)).defined(Ae=>Ae.hideZero||$.hideZeroValues?!!Ae.value:!0).curve(ft(e)),re=e.animation.animationEnabled,j=Ae=>re?Ae.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):Ae;let ie=f.selectAll(".parentGroup").data([P]);ie=ie.enter().append("g").attr("class","lines parentGroup").merge(ie);let we=ie.selectAll(".line-group").data(Ae=>Ae),de=we.enter().append("g").attr("class","line-group");de.append("path").attr("class","visibleLine").attr("fill","none"),de.merge(we).each(function(Ae){const $e=v.select(this).selectAll("path.visibleLine").data([Ae]).join("path").attr("class","visibleLine").attr("d",Fe=>C(Fe.data)).attr("stroke",Fe=>Fe.properties.color!==Ie.white?Fe.properties.color:"none").attr("stroke-dasharray",Fe=>{const _e=parseInt(Fe.properties.lineWidth);switch(Fe.properties.lineStyle){case bt.dotted:return`0,${_e+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",Fe=>Fe.properties.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",Fe=>Fe.properties.lineStyle!=="None"?Fe.properties.lineWidth:0).attr("hoverId",(Ae.properties.alias||Ae.properties.name||"Legend").replace(/\s+/g,"-")).attr("clip-path",`url(#${m}-clip)`).attr("d",Fe=>C(Fe.data)).attr(lt.SeriesId,Fe=>Fe.properties.legendUniqueId).attr(lt.DimValue,Fe=>Fe.properties.alias||Fe.properties.name||"").on("click",vt(W,g,(Fe,_e)=>({seriesId:_e.properties.legendUniqueId,dimValue:_e.properties.alias||_e.properties.name||"",legendUniqueId:_e.properties.legendUniqueId,seriesDisplayName:_e.properties.alias||_e.properties.name||""})));re&&$e.each(function(){const Fe=v.select(this),_e=this.getTotalLength();Fe.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",_e),j(Fe).attr("stroke-dashoffset",0)})}),we.exit().remove(),Va(ie,P,"None",b?Ee:Z,b?Le:N,b?Ue:ne,null,e,$,w,D,H,I,!1,r,b),f.selectAll(".parentGroup").raise()},ue=V=>{k=d-V.left-V.right,s=i-V.bottom-V.top},B=()=>{if(Q(),F(),b?na(e,f,ye,s,k,Ye,Pe,Le,$.yMaxLeft,We,u,t,d,xe,Se,Ee):ta(f,$,ye,e,T,N,Me,xe,i,k/We.length,t,k,s,We,Z),q(be),$a(A,b?Ee:Z,b?Le:N,b?Ue:ne,z,pt,[],[],e,u,i,d,k,We,s,m,a,x,void 0,void 0,o,!1,b),!b){let V=la(k,N,e,be,ne,U,s,!1).labelArray;ja(e,f,V),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,a,f,y,L,N,Z,void 0,void 0,void 0,T,u,e,K,se,$.dimensionList,k,fe,$.formattedDimensionListMap,m,z,s))}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},pr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID(),L=0,u=le.StackLineChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=n.DimensionList,E=(mt(n.ChartData,n.DimensionList)||[]).reverse(),b=!!e.swapAxis?.swapAxisEnabled,U=new Map,Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,w=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe,Ye=[],We=0,be=2,ze=!1,ke=0,Se=[],oe=[];const $=!1;let R={dimensionList:A,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{ae()}catch(C){me("StackLinechart","createStackLineChart",C)}},[e]);const ae=()=>{({formatOptions:e,svg:T,width:s,height:d}=Ft(S,e)),_(),{formatOptions:e,dataTableLegendsList:Se}=ea(e,E,n.DataTableData??[]),{maxNumberForPrimaryAxis:X,maxNumberForSecondaryAxis:M}=Rt(e,R.yMinLeft,R.yMaxLeft,R.yMinRight,R.yMaxRight),{margin:z,yLabel:K,xLabel:ye,yTitle:se,xTitle:te,dimensionHeightWidthArray:xe,chartTitleHeight:ge,secondaryAxisTitleWidth:pe,legendMargin:he,secondaryYLabel:O,visibleBars:be,columnWidth:ke,scrollbarVisible:ze}=Mt(s,d,X,M,R.yMaxLeft,e,R.legendList,R.dimensionList,R.yMaxRight,Y,$,t,b,R,Se),ue(z),{dataTable:i,dataTableHeight:y}=ia(e,K,se,E,R.dimensionList,n),b&&(i=[],y=0),St(T,s,d,e),a=wt(T,z),kt(a,e,y,h,k,u,m),G(),ee(),b?ra(e,a,K,k,h,Le):Zt(a,e,y,K,Re,k),Dt(e,b,T,z,ye,d,te,R.chartType,K,h,k),Vt(k,e,y,b,T,z,se,K,h),Gt(T,Y,z,e,y,k,h,O,pe,b),Nt(T,e,s,ge),It(d,T,xe,ge,s,he,e,[...E].reverse(),m,y,z,ct.line,u,l),_t(E,d,s,T,z,h,ze,be,R,We,!1,P,b),ii(U,b?Me:ne,b?J:f,z,pt,[],e,u,d,s,T,o,b)},_=()=>{const C=[],re=[];e.plotArea.hideZeroValues&&(R.hideZeroValues=!0),E.forEach((De,$e)=>{const Fe=`${$e}~$~${De.properties.alias?De.properties.alias:De.legend}`;De.properties.legend=Fe,re.push(Fe);for(const _e of De.data)C.push(_e)}),R.chartData=C,R.legendList=re,Ye=JSON.parse(JSON.stringify(E));let j=Lt(R.dimensionList,E,$);e.plotArea.fitChart?Pe=R.dimensionList:(Pe=R.dimensionList.slice(We,We+be),Ye.forEach((De,$e)=>Ye[$e].data=De.data.filter(Fe=>Pe.includes(Fe.dimension))));const ie=v.stack().keys(R.legendList).offset(v.stackOffsetDiverging)(j);V();let we=1/0,de=-1/0;for(const De of ie)for(const[$e,Fe]of De)we=Math.min(we,$e),de=Math.max(de,Fe);R.yMinLeft=we>0?0:we,R.yMaxLeft=de;let Ae=t?Tt(e.xAxisLabel.xAxisNumberFormat,R.dimensionList).map(De=>De):R.dimensionList;R.dimensionList.forEach((De,$e)=>{R.formattedDimensionListMap.set(De,Ae[$e])})},G=()=>{let C=yt(I||R.yMaxLeft,R.yMinLeft,k,e,R,H,I,b,h).yAxisLabelArray;R.yMaxLeft=C[C.length-1],R.yMinLeft=C[0];const re=b?[0,y>0?h-y:h]:[y>0?k-y:k,0];{const j=v.scaleLinear().domain([R.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:0:R.yMinLeft<0?R.yMinLeft*1.1:R.yMinLeft*.9,R.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:R.yMaxLeft*1.1]).range(re);b?J=j:f=j}if(Z=b?[k,0]:[0,h],!b&&e.seriesLabel.seriesLabelVisibility){let j=la(h,f,e,Ye,void 0,Y,k,!0);j.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(fe=j.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?Z=[0,h-j.heightWidth[0]]:Z=[j.heightWidth[0],h]}Q()},Q=()=>{const C=v.scalePoint().domain(Pe).range(Z).padding(.5);b?Me=C:ne=C},ee=()=>{F();{let C=yt(I||R.yMaxLeft,R.yMinLeft,k,e,R,H,I,b,h);b?Le=v.axisBottom(J).tickFormat(re=>Xe(re,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-k:0).tickValues(C.autoLabelFlag?void 0:C.yAxisLabelArray).ticks(C.customTickValue??h/50).tickPadding(8).tickSizeOuter(0):Re=v.axisLeft(f).tickFormat(re=>Xe(re,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,h,fe)).tickValues(C.autoLabelFlag?void 0:C.yAxisLabelArray).ticks(C.customTickValue).tickPadding(8).tickSizeOuter(0)}},F=()=>{b?ve=v.axisLeft(Me).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*h*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(Pe,k,e)):Te=v.axisBottom(ne).tickSize(sa(e,k,y,!0)).tickSizeOuter(0).tickValues(gt(Pe,h,e))},q=C=>{C.forEach(de=>{de.data.forEach(Ae=>{Ae.hideZero=de.properties.hideZeroValues,Ae.axis=de.properties.axis})});const re=b?v.line().y(de=>{const Ae=Me(de.data.dimension);return Ae??0}).x(de=>de[1]>0?J(de[1]):J(de[0])).defined(de=>{const Ae=de;return Ae.hideZero||R.hideZeroValues?Ae.data[Ae.key]:!0}).curve(ft(e)):v.line().x(de=>{const Ae=ne(de.data.dimension);return Ae??0}).y(de=>de[1]>0?f(de[1]):f(de[0])).defined(de=>{const Ae=de;return Ae.hideZero||R.hideZeroValues?Ae.data[Ae.key]:!0}).curve(ft(e));let j=a.selectAll(".parentGroup").data([oe]);j=j.enter().append("g").attr("class","lines parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(j);let ie=j.selectAll(".line-group").data(de=>de);const we=ie.enter().append("g").attr("class",de=>"line-group "+de.key.replace(/ /g,"-"));we.append("path").attr("class","line").attr("fill","none"),we.merge(ie).each(function(de,Ae){const De=v.select(this),$e=De.selectAll("path.visibleLine").data([de]).join("path").attr("class","visibleLine").attr("hoverId",it=>(E[Ae]?.properties?.alias||E[Ae]?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("d",re(de)).attr("stroke",de.color!==Ie.white?de.color:"none").attr("stroke-dasharray",it=>{const nt=parseInt(E[Ae].properties.lineWidth.toString());switch(E[Ae].properties.lineStyle){case bt.dotted:return`0,${nt+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",E[Ae].properties.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",E[Ae].properties.lineStyle!==bt.none?E[Ae].properties.lineWidth:0).attr("fill","none").attr(lt.SeriesId,E[Ae].properties.legendUniqueId).attr(lt.DimValue,E[Ae].properties.alias||E[Ae].properties.name||"").on("click",vt(W,g,()=>({seriesId:E[Ae].properties.legendUniqueId,dimValue:E[Ae].properties.alias||E[Ae].properties.name||"",legendUniqueId:E[Ae].properties.legendUniqueId,seriesDisplayName:E[Ae].properties.alias||E[Ae].properties.name||""}))),Fe=e.animation.animationEnabled,_e=$e.node().getTotalLength();Fe?$e.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",_e).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("stroke-dashoffset",0):$e.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",0),De.selectAll("path.hoverLine").data([de]).join("path").attr("class","hoverLine").attr("d",re(de)).attr("stroke",Ie.transparent).attr("stroke-width",20).attr("fill","none").style("pointer-events","stroke").on("mouseenter",function(){T.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!0),T.selectAll('[hoverId="'+mi(E[Ae].properties.alias||E[Ae].properties.name||"Legend").replace(/\s+/g,"-")+'"]').classed("highlight",!0).classed("unhighlight",!1)}).on("mouseleave",function(){T.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!1)})}),ie.exit().remove(),Va(j,C,u,b?Me:ne,b?J:f,b?Ee:N,null,e,R,w,D,H,I,!1,p,b)},ue=C=>{h=s-C.left-C.right,k=d-C.bottom-C.top},B=()=>{if(Q(),F(),b?na(e,a,ye,k,h,ve,Ue,J,R.yMaxLeft,Pe,u,t,s,xe,ke,Me):ta(a,R,ye,e,y,f,Te,xe,d,L,t,h,k,Pe,ne),V(),q(Ye),Ya(oe,b?Me:ne,b?J:f,b?Ee:N,z,pt,[],[],e,u,d,s,h,Pe,k,m,T,x,y,o,b),!b){let C=la(h,f,e,Ye,void 0,Y,k,!0).labelArray;ja(e,a,C),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,T,a,i,L,f,ne,void 0,void 0,void 0,y,le.LineChart,e,K,se,R.dimensionList,h,Z,R.formattedDimensionListMap,m,z,k))}},V=()=>{let C=Lt(Pe,Ye,$);oe=v.stack().keys(R.legendList).offset(v.stackOffsetDiverging)(C),Ye.forEach((j,ie)=>j.data.forEach((we,de)=>{we[0]=oe[ie][de][0],we[1]=oe[ie][de][1]}));let re=e.annotation.annotationSetLabelColor;oe.forEach((j,ie)=>j.forEach(we=>{we.key=j.key,j.color=JSON.parse(JSON.stringify(E[ie].properties.color)),j.individualAnnotationVisibility=JSON.parse(JSON.stringify(E[ie].properties.individualAnnotationVisibility)),we.data.labelPosition=E[ie].properties.dataLabelPosition,we.data.labelColor=re=="2"?JSON.parse(JSON.stringify(E[ie].properties.color)):E[ie].properties.labelColor,we.hideZero=JSON.parse(JSON.stringify(E[ie].properties.hideZeroValues)),we.properties=E[ie].properties}))},P=(C,re,j)=>{Ye=re,Pe=C,be=j,li(n,U,Pe),B()};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},br=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID(),L=0,u=le.NormalizedStackLineChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList)?.reverse()||[],E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe=[],Ye=0,We,be=0,ze=!1,ke=[],Se=[];const oe=!0;let $={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{R()}catch(C){me("NormalizedLinechart","createNormalizedLinechart",C)}},[e]);const R=()=>{({formatOptions:e,svg:y,width:k,height:s}=Ft(S,e)),ae(),{formatOptions:e,dataTableLegendsList:ke}=ea(e,A,n.DataTableData??[]),{margin:w,yLabel:z,xLabel:K,yTitle:ye,xTitle:se,dimensionHeightWidthArray:te,chartTitleHeight:xe,secondaryAxisTitleWidth:ge,legendMargin:pe,secondaryYLabel:he,visibleBars:We,columnWidth:be,scrollbarVisible:ze}=Mt(k,s,O,X,$.yMaxLeft,e,$.legendList,$.dimensionList,$.yMaxRight,U,oe,t,b,$,ke),ue(w),{dataTable:d,dataTableHeight:i}=ia(e,z,ye,A,$.dimensionList,n),b&&(d=[],i=0),St(y,k,s,e),T=wt(y,w),kt(T,e,i,M,h,u,m),_(),ee(),b?ra(e,T,z,h,M,Ee):Zt(T,e,i,z,fe,h),Dt(e,b,y,w,K,s,se,$.chartType,z,M,h),Vt(h,e,i,b,y,w,ye,z,M),Gt(y,U,w,e,i,h,M,he,ge,b),Nt(y,e,k,xe),It(s,y,te,xe,k,pe,e,[...A].reverse(),m,i,w,ct.line,u,l),_t(A,s,k,y,w,M,ze,We,$,Ye,!1,B,b)},ae=()=>{const C=[],re=[];e.plotArea.hideZeroValues&&($.hideZeroValues=!0,A.forEach(Ae=>{Ae.data=Ae.data.filter(De=>De.value!==0)})),A.forEach((Ae,De)=>{const $e=`${De}~$~${Ae.properties.legend}`;Ae.properties.legend=$e,re.push($e);for(const Fe of Ae.data)C.push(Fe)}),$.chartData=C,$.legendList=re,Pe=JSON.parse(JSON.stringify(A)),ve=$.dimensionList;const j=Lt($.dimensionList,A,oe),ie=v.stack().keys($.legendList).offset(v.stackOffsetDiverging)(j);P();let we=1/0;for(const Ae of ie)for(const[De]of Ae)we=Math.min(we,De);$.yMinLeft=we>0?0:we,$.yMaxLeft=1;const de=t?Tt(e.xAxisLabel.xAxisNumberFormat,$.dimensionList).map(Ae=>Ae):$.dimensionList;$.formattedDimensionListMap=new Map($.dimensionList.map((Ae,De)=>[Ae,de[De]]))},_=()=>{const C=b?[0,i>0?M-i:M]:[i>0?h-i:h,0];{const re=v.scaleLinear().domain([$.yMinLeft<0?-1:0,1]).range(C);b?Me=re:a=re}if(ne=b?[h,0]:[0,M],!b&&e.seriesLabel.seriesLabelVisibility){Q(Se,Pe);let re=la(M,a,e,Pe,void 0,U,h,!0);re.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(Z=re.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?ne=[0,M-re.heightWidth[0]]:ne=[re.heightWidth[0],M]}},G=()=>{const C=v.scalePoint().domain(ve).range(ne).padding(.5);b?Te=C:N=C};function Q(C,re){C.forEach((j,ie)=>j.forEach((we,de)=>{re[ie]&&re[ie].data[de]&&(re[ie].data[de][0]=we[0]=we.data.total===0?0:we[0]/we.data.total,re[ie].data[de][1]=we[1]=we.data.total===0?0:we[1]/we.data.total)}))}const ee=()=>{{const C=e.yAxisLabel.yAxisTicksMode===wa.custom,re=parseInt(e.yAxisLabel.yAxisLabelDecimalPrecision)||0,j=C?za($.yMinLeft<0?-1:0,1,e.yAxisLabel.yAxisTicksCount):null;b?Ee=v.axisBottom(Me).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-h:0).tickValues(j).tickFormat(v.format(`.${re}%`)).ticks(i>0?(M-i)/80:M/80).tickPadding(8).tickSizeOuter(0):fe=v.axisLeft(a).tickSize(zt(e,M,Z)).tickValues(j).tickFormat(v.format(`.${re}%`)).ticks(i>0?(h-i)/80:h/80).tickPadding(8).tickSizeOuter(0)}},F=()=>{b?Ue=v.axisLeft(Te).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*M*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(ve,h,e)):Re=v.axisBottom(N).tickSize(sa(e,h,i,!0)).tickSizeOuter(0).tickValues(gt(ve,M,e))},q=C=>{Q(Se,Pe),C.forEach(de=>{de.data.forEach(Ae=>{Ae.hideZero=de.properties.hideZeroValues,Ae.axis=de.properties.axis})});const re=b?v.line().y(de=>{const Ae=Te(de.data.dimension);return Ae??0}).x(de=>de[1]>0?Me(de[1]):Me(de[0])).curve(ft(e)):v.line().x(de=>N(de.data.dimension)?N(de.data.dimension):null).y(de=>de[1]>0?a(de[1]):a(de[0])).curve(ft(e));let j=T.selectAll(".parentGroup").data([Se]);j=j.enter().append("g").attr("class","lines parentGroup").merge(j);let ie=j.selectAll(".line-group").data(de=>de),we=ie.enter().append("g").attr("class",de=>"line-group "+de.key.replace(/ /g,"-"));we.attr("hoverId",de=>(C[de.index]?.properties?.alias||C[de.index]?.properties?.name||"Legend").replace(/\s+/g,"-")).append("path").attr("class","line").attr("fill","none"),we.merge(ie).each(function(de,Ae){const De=v.select(this),$e=De.selectAll("path.visibleLine").data([de]).join("path").attr("class","visibleLine").attr("d",re(de)).attr("stroke",de.color!==Ie.white?de.color:"none").attr("stroke-dasharray",it=>{const nt=parseInt(A[Ae].properties.lineWidth.toString());switch(A[Ae].properties.lineStyle){case bt.dotted:return`0,${nt+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",A[Ae].properties.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",A[Ae].properties.lineStyle!==bt.none?A[Ae].properties.lineWidth:0).attr("fill","none").attr(lt.SeriesId,A[Ae].properties.legendUniqueId).attr(lt.DimValue,A[Ae].properties.alias||A[Ae].properties.name||"").on("click",vt(W,g,()=>({seriesId:A[Ae].properties.legendUniqueId,dimValue:A[Ae].properties.alias||A[Ae].properties.name||"",legendUniqueId:A[Ae].properties.legendUniqueId,seriesDisplayName:A[Ae].properties.alias||A[Ae].properties.name||""}))),Fe=e.animation.animationEnabled,_e=$e.node().getTotalLength();Fe?$e.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",_e).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("stroke-dashoffset",0):$e.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",0),De.selectAll("path.hoverLine").data([de]).join("path").attr("class","hoverLine").attr("d",re(de)).attr("stroke",Ie.transparent).attr("stroke-width",20).attr("fill","none").style("pointer-events","stroke").on("mouseenter",function(it,nt){y.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!0),y.selectAll('[hoverId="'+mi(C[nt.index]?.properties?.alias||C[nt.index]?.properties?.name||"Legend").replace(/\s+/g,"-")+'"]').classed("highlight",!0).classed("unhighlight",!1)}).on("mouseleave",function(it,nt){y.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!1),y.selectAll('[hoverId="'+mi(C[nt.index]?.properties?.alias||nt[nt.index]?.properties?.name||"Legend").replace(/\s+/g,"-")+'"]').classed("highlight",!1).classed("unhighlight",!1)})}),ie.exit().remove(),Va(j,C,u,b?Te:N,b?Me:a,b?J:f,null,e,$,D,I,Y,H,!0,p,b)},ue=C=>{M=k-C.left-C.right,h=s-C.bottom-C.top},B=(C,re,j)=>{Pe=re,ve=C,We=j,V()},V=()=>{if(G(),P(),F(),b?na(e,T,K,h,M,Ue,Le,Me,$.yMaxLeft,ve,u,t,k,te,be,Te):ta(T,$,K,e,i,a,Re,te,s,L,t,M,h,ve,N),q(Pe),Ya(Se,b?Te:N,b?Me:a,b?J:f,w,pt,[],[],e,u,s,k,M,ve,h,m,y,x,i,o,b),!b){let C=la(M,a,e,Pe,void 0,U,h,!0).labelArray;ja(e,T,C),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,y,T,d,L,a,N,void 0,void 0,void 0,i,le.LineChart,e,z,ye,$.dimensionList,M,ne,$.formattedDimensionListMap,m,w,h))}},P=()=>{let C=Lt(ve,Pe,oe);Se=v.stack().keys($.legendList).offset(v.stackOffsetDiverging)(C),Pe.forEach((j,ie)=>j.data.forEach((we,de)=>{we[0]=Se[ie][de][0],we[1]=Se[ie][de][1]}));let re=e.annotation.annotationSetLabelColor;Se.forEach((j,ie)=>j.forEach(we=>{we.key=j.key,j.color=JSON.parse(JSON.stringify(A[ie].properties.color)),we.data.labelPosition=A[ie].properties.dataLabelPosition,we.data.labelColor=re=="2"?JSON.parse(JSON.stringify(A[ie].properties.color)):A[ie].properties.labelColor,we.hideZero=JSON.parse(JSON.stringify(A[ie].properties.hideZeroValues)),we.properties=A[ie].properties}))};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},gr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID();let L=0;const u=le.HorizontalBarChart,S=Ce.useRef(),g=Ce.useRef(c);g.current=c;const W=Ce.useRef(p);W.current=p;const A=mt(n.ChartData,n.DimensionList),E=n.DimensionList,b=!0;let U=!1;const Y=!1,H=new Map;let I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,D=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,w=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,z=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k=new Map,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le=[],Ue=0,ve=2,Pe=!1,Ye={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{We()}catch(G){me("HorizontalBarchart","createHorizontalBarChart",G)}},[e]);const We=()=>{({formatOptions:e,svg:a,width:i,height:y}=Ft(S,e)),be(),{maxNumberForPrimaryAxis:M,maxNumberForSecondaryAxis:h,customYaxisMaxValue:D,secondaryCustomYaxisMaxValue:z}=Rt(e,Ye.yMinLeft,Ye.yMaxLeft,Ye.yMinRight,Ye.yMaxRight),{margin:K,yLabel:ye,xLabel:se,yTitle:te,xTitle:xe,dimensionHeightWidthArray:ge,chartTitleHeight:pe,secondaryAxisTitleWidth:he,legendMargin:O,secondaryYLabel:X,visibleBars:ve,columnWidth:L,scrollbarVisible:Pe}=Mt(i,y,M,h,Ye.yMaxLeft,e,Ye.legendList,Ye.dimensionList,Ye.yMaxRight,U,Y,t,b,Ye),R(K),St(a,i,y,e),f=wt(a,K),kt(f,e,T,s,d,u,m),ze(),Se(),ra(e,f,ye,d,s,Te),U&&Ai(e,f,X,Me,s),Dt(e,b,a,K,se,y,xe,Ye.chartType,ye,s,d),Vt(d,e,T,b,a,K,te,ye,s),Gt(a,U,K,e,T,d,s,X,he,b),Nt(a,e,i,pe),It(y,a,ge,pe,i,O,e,A,m,T,K,ct.rectangle,u,l),_t(A,y,i,a,K,s,Pe,ve,Ye,Ue,!1,ae,b)},be=()=>{const G=[],Q=[];let ee=[],F=-1/0,q=1/0,ue=-1/0,B=1/0,V=1/0,P=-1/0;A.forEach(C=>{Q.push(C.properties.legendUniqueId),P=-1/0,V=1/0,C.data.forEach(re=>{G.push(re),C.properties.axis==="Secondary"?(U=!0,ue=Math.max(ue,re.value),B=Math.min(B,re.value)):(F=Math.max(F,re.value),q=Math.min(q,re.value)),P=Math.max(P,re.value),V=Math.min(V,re.value)}),C.properties.setColorScale&&H.set(C.properties.legendUniqueId,v.scaleSequential().domain([V,P]).interpolator(yi.interpolateRgb(C.properties.startColor,C.properties.endColor)))}),Ye.chartData=G,Ye.legendList=Q,Ye.yMaxLeft=F,Ye.yMinLeft=q>0?0:q,Ye.yMaxRight=ue,Ye.yMinRight=B>0?0:B,ee=t?Tt(e.xAxisLabel.xAxisNumberFormat,Ye.dimensionList).map(C=>C):Ye.dimensionList,Ye.dimensionList.forEach((C,re)=>{Ye.formattedDimensionListMap.set(C,ee[re])}),Le=JSON.parse(JSON.stringify(A)),Ee=Ye.dimensionList,e.plotArea.hideZeroValues&&(Ye.hideZeroValues=!0)},ze=()=>{let G=yt(Ye.yMaxLeft,Ye.yMinLeft,d,e,Ye,I,D,b,s).yAxisLabelArray;Ye.yMaxLeft=G[G.length-1],Ye.yMinLeft=G[0],Z=v.scaleLinear().domain([Ye.yMinLeft>=0?I!==void 0&&!Number.isNaN(I)?I:0:Ye.yMinLeft<0?Ye.yMinLeft*1.1:Ye.yMinLeft*.9,Ye.yMaxLeft<=0?0:D!==void 0&&!Number.isNaN(D)?D:Ye.yMaxLeft*1.1]).range([0,s]),U&&(fe=v.scaleLinear().domain([Ye.yMinRight>=0?(w||w==0)&&!Number.isNaN(w)?w:0:(w||w==0)&&!Number.isNaN(w)?w:Ye.yMinRight*1.1,Ye.yMaxRight<=0?z||0:z||Ye.yMaxRight*1.1]).range([0,s])),Re=[d,0]},ke=()=>{ne=v.scaleBand().domain(Ye.legendList).range([0,L]).paddingInner(Ye.legendList.length>1?.3*parseFloat(e.plotArea.plotAreaSeriesWidth)/100:0),N=v.scalePoint().domain(Ee).range(Re).padding(.5)},Se=()=>{{let G=yt(D||Ye.yMaxLeft,Ye.yMinLeft,d,e,Ye,I,D,b,s);Te=v.axisBottom(Z).tickFormat(Q=>Xe(Q,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-d:0).tickValues(G.autoLabelFlag?void 0:G.yAxisLabelArray).ticks(G.customTickValue).tickPadding(8).tickSizeOuter(0)}if(U){let G=yt(z||Ye.yMaxRight,w||Ye.yMinRight,d,e,Ye,w,z);Me=v.axisTop(fe).tickFormat(Q=>Xe(Q,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(G.autoLabelFlag?void 0:G.yAxisLabelArray).ticks(G.customTickValue).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-d:0).tickPadding(8).tickSizeOuter(0)}},oe=()=>{J=v.axisLeft(N).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*s*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(Ee,d,e))},$=G=>{G.forEach(Q=>{Q.data.forEach(ee=>{ee.hideZero=Q.properties.hideZeroValues,ee.axis=Q.properties.axis,ee.legendUniqueId=Q.properties.legendUniqueId})}),Ee.forEach(Q=>{f.append("rect").attr("id",`dim-background-${Q}`).attr("class","dimension-background").attr("y",N(Q)-L/2).attr("height",L).attr("x",0).attr("width",s).attr("fill","#E5E5E5").attr("visibility","hidden").lower()}),G.forEach(Q=>{let ee=f.selectAll(".parentGroup").data([Q],V=>V.properties.legendUniqueId);ee=ee.enter().append("g").attr("class","column parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(ee);let F=ee.selectAll(".column-group").data(Q.data.map(V=>({...V,properties:Q.properties})),V=>V.legend+V.dimension),q=F.enter().append("g").attr("class","column-group").attr("hoverId",(Q.properties.alias||Q.properties.name||"Legend").replace(/\s+/g,"-")).attr("transform",V=>`translate(0, ${N(V.dimension)-L/2})`);F.attr("transform",V=>`translate(0, ${N(V.dimension)-L/2})`),q.merge(F).attr("transform",V=>`translate(0, ${N(V.dimension)-L/2})`);const ue=q.append("rect").attr("y",V=>ne(V.legendUniqueId)).attr("height",ne.bandwidth()).attr("x",V=>{const P=Q.properties.axis===Qe.primary?Z:fe;return V.value>=0,P(0)}).attr("width",0).attr("fill",V=>H.get(Q.properties.legendUniqueId)?.(V.value)??Q.properties.color).attr("stroke-dasharray",V=>V.properties.stackBorderStyle==2?"5,3":"0").attr("stroke-width",V=>`${V.properties.stackBorderWidth}px`).attr("stroke",V=>Q.properties.stackBorderStyle==0?"none":e.column.stackBorderVisibility?Q.properties.stackBorderColor:"none").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",V=>V.value===0&&e.xAxisLabel.hideZeroValues?"hidden":"visible").attr(lt.SeriesId,()=>Q.properties.legendUniqueId).attr(lt.DimValue,V=>Array.isArray(V.dimension)?String(V.dimension[0]):String(V.dimension));(e.animation.animationEnabled?ue.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):ue).attr("x",V=>{const P=Q.properties.axis===Qe.primary?Z:fe;return V.value>=0?P(0):P(V.value)}).attr("width",V=>{const P=Q.properties.axis===Qe.primary?Z:fe,C=Q.properties.axis===Qe.primary?D:z;return V.value>=0?C&&V.value>C?P(C)-P(0):P(V.value)-P(0):Math.abs(P(0)-P(V.value))}),q.merge(F).on("mousemove",(V,P)=>{(Q.properties.alias||Q.properties.name||"Legend").replace(/ /g,"-");const C=Array.isArray(P.dimension)?P.dimension[0]:P.dimension,re=String(Ye.formattedDimensionListMap.get(C)??C??""),j=At(r,String(C??""),{...Q.properties,formattedDimensionValue:re});ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:Ye.formattedDimensionListMap.get(Array.isArray(P.dimension)?P.dimension[0]:P.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():P.properties?.currentMeasure?P.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||P.value,value:Xe([le.NormalizedStackLineChart,le.NormalizedStackAreaChart,""].includes(u)?P[1]-P[0]:P.value,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:P.properties.alias}],e,V,Q.properties,j)}).on("mouseout",(V,P)=>{(Q.properties.alias||Q.properties.name||"Legend").replace(/ /g,"-"),ot()}).on("click",vt(W,g,(V,P)=>({seriesId:Q.properties.legendUniqueId,dimValue:Array.isArray(P.dimension)?String(P.dimension[0]):String(P.dimension),legendUniqueId:Q.properties.legendUniqueId,seriesDisplayName:Q.properties.alias||Q.properties.name||""}))),F.exit().remove()}),f.selectAll(".parentGroup").raise()},R=G=>{s=i-G.left-G.right,d=y-G.bottom-G.top},ae=(G,Q,ee)=>{Le=Q,Ee=G,ve=ee,li(n,k,Ee),e.xAxisLabel.hideZeroValues&&(Ee=Ee.filter(F=>k.get(F)!==0)),_()},_=()=>{ke(),oe(),na(e,f,se,d,s,J,Me,Z,Ye.yMaxLeft,Ee,u,t,i,ge,L,N),$(Le),$a(Le,N,Z,fe,K,pt,[],[],e,u,y,i,s,Ee,d,m,a,x,ne,L,o,!1,b)};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},Ar=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID();let L=0;const u=le.StackHorizontalBarChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList)?.reverse(),E=n.DimensionList,b=!0,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I,D,w,z,K,ye,se,te,xe,ge,pe,he;const O=new Map;let X,M,h,k,s,d,i,y,T,a,f,N,ne=[],Z=0,fe=2,Re=!1,Te=[];const Me=!1;let J=new Map,Ee={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Le()}catch(_){me("StackStackHorizontalBarchart","createStackHorizontalBarChart",_)}},[e]);const Le=()=>{({formatOptions:e,svg:s,width:h,height:k}=Ft(S,e)),Ue(),{maxNumberForPrimaryAxis:pe,maxNumberForSecondaryAxis:he}=Rt(e,Ee.yMinLeft,Ee.yMaxLeft,Ee.yMinRight,Ee.yMaxRight),{margin:I,yLabel:D,xLabel:w,yTitle:z,xTitle:K,dimensionHeightWidthArray:ye,chartTitleHeight:se,secondaryAxisTitleWidth:te,legendMargin:xe,secondaryYLabel:ge,visibleBars:fe,columnWidth:L,scrollbarVisible:Re}=Mt(h,k,pe,he,Ee.yMaxLeft,e,Ee.legendList,Ee.dimensionList,Ee.yMaxRight,U,Me,t,b,Ee),ze(I),St(s,h,k,e),d=wt(s,I),kt(d,e,0,X,M,u,m),ve(),Ye(),ra(e,d,D,M,X,a),Dt(e,b,s,I,w,k,K,Ee.chartType,D,X,M),Vt(M,e,0,b,s,I,z,D,h),Nt(s,e,h,se),It(k,s,ye,se,h,xe,e,[...A].reverse(),m,0,I,ct.rectangle,u,l),_t(A,k,h,s,I,X,Re,fe,Ee,Z,!1,ke,b)},Ue=()=>{const _=[],G=[];let Q=-1/0,ee=1/0;A.forEach((P,C)=>{const re=`${C}~$~${P.properties.legend}`;P.properties.legend=re,G.push(re),Q=-1/0,ee=1/0;for(const j of P.data)Q=Math.max(Q,j.value),ee=Math.min(ee,j.value),_.push(j);P.properties.setColorScale&&O.set(P.properties.legendUniqueId,v.scaleSequential().domain([ee,Q]).interpolator(v.interpolateRgb(P.properties.startColor,P.properties.endColor)))}),Ee.chartData=_,Ee.legendList=G,ne=JSON.parse(JSON.stringify(A));let F=Lt(Ee.dimensionList,A,Me);e.plotArea.fitChart?N=Ee.dimensionList:(N=Ee.dimensionList.slice(Z,Z+fe),ne.forEach((P,C)=>ne[C].data=P.data.filter(re=>N.includes(re.dimension))));const q=v.stack().keys(Ee.legendList).offset(v.stackOffsetDiverging)(F);oe();let ue=1/0,B=-1/0;for(const P of q)for(const[C,re]of P)ue=Math.min(ue,C),B=Math.max(B,re);Ee.yMinLeft=ue>0?0:ue,Ee.yMaxLeft=B;let V=t?Tt(e.xAxisLabel.xAxisNumberFormat,Ee.dimensionList).map(P=>P):Ee.dimensionList;Ee.dimensionList.forEach((P,C)=>{Ee.formattedDimensionListMap.set(P,V[C])}),e.plotArea.hideZeroValues&&(Ee.hideZeroValues=!0)},ve=()=>{let _=yt(Ee.yMaxLeft,Ee.yMinLeft,M,e,Ee,Y,H,b,X).yAxisLabelArray;Ee.yMaxLeft=_[_.length-1],Ee.yMinLeft=_[0],i=v.scaleLinear().domain([Ee.yMinLeft>=0?Y!==void 0&&!Number.isNaN(Y)?Y:0:Ee.yMinLeft<0?Ee.yMinLeft*1.1:Ee.yMinLeft*.9,Ee.yMaxLeft<=0?0:H!==void 0&&!Number.isNaN(H)?H:Ee.yMaxLeft*1.1]).range([0,X]),T=[M,0]},Pe=()=>{y=v.scalePoint().domain(N).range(T).padding(.5)},Ye=()=>{{let _=yt(H||Ee.yMaxLeft,Ee.yMinLeft,M,e,Ee,Y,H,b,X);a=v.axisBottom(i).tickFormat(G=>Xe(G,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-M:0).tickValues(_.autoLabelFlag?void 0:_.yAxisLabelArray).ticks(_.customTickValue).tickPadding(8).tickSizeOuter(0)}},We=()=>{f=v.axisLeft(y).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*X*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(N,M,e))},be=_=>{_.forEach(V=>{V.data.forEach(P=>{P.hideZero=V.properties.hideZeroValues,P.axis=V.properties.axis})}),N.forEach(V=>{d.append("rect").attr("id",`dim-background-${V}`).attr("class","dimension-background").attr("y",y(V)-L/2).attr("height",L).attr("x",0).attr("width",X).attr("fill","#E5E5E5").attr("visibility","hidden").lower()});let G=d.selectAll(".parentGroup").data([Te]);G=G.enter().append("g").attr("class","columns parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(G);let Q=G.selectAll(".column-group").data(V=>V);Q=Q.enter().append("g").attr("class",V=>"column-group "+V.key.replace(/ /g,"-")).attr("hoverId",V=>(_[V.index].properties.alias||_[V.index].properties.name||"Legend").replace(/\s+/g,"-")).merge(Q);let F=Q.selectAll("rect").data(V=>V);const q=(V,P)=>{const C=Array.from(Q.nodes()).indexOf(V[P].parentNode);return{props:A[C]?.properties,groupIndex:C}},ue=F.enter().append("rect").merge(F).attr("y",V=>y(V.data.dimension)-L/2).attr("height",L).attr("fill",(V,P,C)=>{const{props:re}=q(C,P);return O.get(re.legendUniqueId)?.(V.data[V.key])??re?.color??"gray"}).attr("stroke",(V,P,C)=>{const re=q(C,P).props;return re?.stackBorderStyle===0?"none":e.column.stackBorderVisibility?re.stackBorderColor:"none"}).attr("stroke-dasharray",(V,P,C)=>q(C,P).props?.stackBorderStyle===2?"5,3":"0").attr("stroke-width",(V,P,C)=>(q(C,P).props?.stackBorderWidth||0)+"px").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("x",V=>Math.min(i(V[0]),i(V[1]))).attr("width",0).attr("visibility",(V,P,C)=>{const re=q(C,P).props;return V.data[V.key]===0&&re?.hideZeroValues?"hidden":"visible"}).attr(lt.SeriesId,V=>V.key??"").attr(lt.DimValue,V=>Array.isArray(V.data.dimension)?String(V.data.dimension[0]):String(V.data.dimension)).on("mousemove",(V,P)=>{const C=P.data.dimension;ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:Ee.formattedDimensionListMap.get(C)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():P.properties?.currentMeasure?P.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||P.value,value:Xe(P.data[P.key],e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:P.properties.alias}],e,V,P.properties,At(p,String(C??""),{...P.properties,formattedDimensionValue:String(Ee.formattedDimensionListMap.get(C)??C??"")}))}).on("mouseout",(V,P)=>{P.data.dimension,ot()}).on("click",vt(W,g,(V,P)=>({seriesId:P.key,dimValue:Array.isArray(P.data.dimension)?String(P.data.dimension[0]):String(P.data.dimension),legendUniqueId:P.key,seriesDisplayName:P.properties?.alias||P.properties?.name||""})));ue.attr("x",V=>i(0)),(e.animation.animationEnabled?ue.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):ue).attr("x",V=>Math.min(i(V[0]),i(V[1]))).attr("width",V=>Math.abs(i(V[1])-i(V[0]))),Q.exit().remove(),d.selectAll(".parentGroup").raise()},ze=_=>{X=h-_.left-_.right,M=k-_.bottom-_.top},ke=(_,G,Q)=>{ne=G,N=_,fe=Q,li(n,J,N),oe(),Se()},Se=()=>{Pe(),We(),na(e,d,w,M,X,f,void 0,i,Ee.yMaxLeft,N,u,t,h,ye,L,y);const _=new Map;N.forEach((G,Q)=>{let ee=0;Te.forEach(F=>{const q=F[Q]?.[0]??0;q<ee&&(ee=q)}),_.set(G,ee)}),be(ne),Ya(Te,y,i,void 0,I,pt,[],[],e,u,k,h,X,N,M,m,s,x,0,o,b),ii(J,y,i,I,pt,[],e,u,k,h,s,o,b,_),$(),d.selectAll(".connectors").raise()},oe=()=>{let _=Lt(N,ne,Me);Te=v.stack().keys(Ee.legendList).offset(v.stackOffsetDiverging)(_),ne.forEach((Q,ee)=>Q.data.forEach((F,q)=>{F[0]=Te[ee][q][0],F[1]=Te[ee][q][1]}));let G=e.annotation.annotationSetLabelColor;Te.forEach((Q,ee)=>Q.forEach(F=>{F.key=Q.key,Q.color=JSON.parse(JSON.stringify(A[ee].properties.color)),F.data.labelPosition=A[ee].properties.dataLabelPosition,F.data.labelColor=G=="2"?JSON.parse(JSON.stringify(A[ee].properties.color)):A[ee].properties.labelColor,F.hideZero=JSON.parse(JSON.stringify(A[ee].properties.hideZeroValues)),F.properties=A[ee].properties}))},$=()=>{try{const _=Number(e.connector?.connectorVisibility);if(!e.connector||_===2)return;const G=[],Q=[],ee=[];let F;const q=[];if(_===1)F=1;else if(_===3){const j=Number(e.connector.connectorFollow);j===1?F=Number(e.connector.connectorStepSize):j===2&&((e.connector.connectorExclude||[]).forEach(ie=>ee.push(ie)),F=1)}const ue=[],B=[],V=[],P=e.connector?.connectorCustomRange||[];ee.forEach(j=>{const ie=j.split("-");ie.length&&ue.push(ie[0])});const re=(Te?.[0]||[]).map((j,ie)=>({Dimension:j.data.dimension,Total:j.data.total,CustomTotal:j.data.total-(V[ie]??0),Index:ie}));if(F!=null){for(let j=0;j<re.length;j++)(F===1||j%F===0&&F!==1)&&G.push(re[j]);for(let j=F;j<re.length;j+=F){const ie=Math.min(j+F,re.length);let we=-1/0;for(let de=j;de<ie;de++)re[de].Total>we&&(we=re[de].Total);we!==-1/0&&q.push(we)}for(let j=1;j<G.length;j++)Q.push(G[j])}else{const j=[];(P||[]).forEach(ie=>{if(ie?.from&&ie?.to){const we=re.some(Ae=>Ae.Dimension===ie.from),de=re.some(Ae=>Ae.Dimension===ie.to);we&&de&&j.push({from:ie.from,to:ie.to})}}),j.forEach(ie=>{const we=re.findIndex(Ae=>Ae.Dimension===ie.from),de=re.findIndex(Ae=>Ae.Dimension===ie.to);if(we>=0&&de>=0){const Ae=Math.min(we,de),De=Math.max(we,de);G.push(re[Ae]);let $e=re[Ae]?.Total??-1/0;for(let Fe=Ae;Fe<=De;Fe++)re[Fe].Total>$e&&($e=re[Fe].Total);$e!==-1/0&&q.push($e),Q.push(re[De])}})}d.append("defs").append("marker").attr("id","arrow").attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerWidth",10).attr("markerHeight",7).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("fill",e.connector.connectorMarkerColor!==Ie.white?e.connector.connectorMarkerColor:"none"),R(G,q,Q,F,ue),ae(G,q,Q,F,ue)}catch(_){console.error(_)}},R=(_,G,Q,ee,F)=>{try{const q=y.bandwidth()??0,ue=d.selectAll(".connector-paths").data([0]),B=ue.enter().append("g").attr("class","connector-paths connectors").merge(ue),V=_.filter((re,j)=>ee!=null?j<_.length-1:j<_.length),P=B.selectAll("path.connector-path").data(V,(re,j)=>re?.Dimension??j);P.exit().remove(),P.enter().append("path").attr("class","connector-path").attr("fill","none").attr("marker-end","url(#arrow)").merge(P).attr("d",(re,j)=>{const ie=Q?.[j]??{Total:0,Dimension:re.Dimension},we=re?.Total??0,de=typeof ie.Total=="number"?i(ie.Total):0,Ae=typeof we=="number"?i(we):0,De=Math.max(de,Ae);return e.total.totalVisibility?`M ${Ae+50},
73
+ `,w},"");g.html(x?`<div class="tooltipInner" style="display:flex; flex-direction:column; font-size:${Kl}; color:${m}; line-height:${Ql};">${x}</div>`:`<div class="arrow-placeholder"></div><div class="tooltipInner" style="display:flex; flex-direction:column;">${b}</div>`);const U=g.node(),Y=U.offsetWidth,H=U.offsetHeight;let I=A+15,D=E+15;I+Y>window.innerWidth&&(I=A-Y-10),D+H>window.innerHeight&&(D=E-H-10),g.style("left",`${I}px`).style("top",`${D}px`).style("visibility",e.toolTip.toolTipVisibility?"visible":"hidden")}catch(l){console.error("Tooltip Error:",l)}}function ot(){try{v.select("#chartTooltipDiv").html("").style("visibility",Et.hidden)}catch(t){me(xt,"hideTooltipOnMouseOut",t)}}const Xt=(t,e,n,o)=>{try{let l=v.select(t.current).append("foreignObject").attr("visibility",o.chartTitle.chartTitleVisibility?Et.visible:Et.hidden).attr("transform","translate(2,2)").attr("class","chartTitle").attr("width",n).attr("height",e+"px");o.chartTitle.dynamicTitleText.length!==0?l.append("xhtml:div").style("color","rgba(119,119,119)").attr("title",o.chartTitle.chartTitleText).style("white-space","pre").style("text-overflow","ellipsis").style("overflow",Et.visible).style("line-height","1.3em").html(o.chartTitle.chartTitleHTML?o.chartTitle.chartTitleHTML:o.chartTitle.chartTitleText):l.append("xhtml:div").style("white-space","pre").style("user-select","none").style("text-overflow","ellipsis").style("overflow",Et.visible).style("line-height","1.3em").attr("class","chartTiltle").attr("id","chartTitleId").style("text-anchor","start").style("color","rgba(119,119,119)").style("font-size","16px").style("font-family",o.chartTitle.chartTitleFontFamily).attr("title",o.chartTitle.chartTitleText).html(o.chartTitle.chartTitleText)}catch(x){me(xt,"drawChartTitle",x)}},qi=(t,e)=>{try{return t.reduce((n,o)=>{const x=typeof o=="string"?o:e&&typeof o=="object"&&o[e]||"";return x.length>n.length?x:n},"")}catch(n){me(xt,"findStringWithLongestLength",n)}},xa=(t,e,n,o,x,l,r,c,p,m,L,u=!1,S)=>{try{if(m.legends.legendVisibility){let W="",A="";r==Je.left||r==Je.right?(A="column",W=c==Ea.top?"start":c==Ea.middle?"center":"end"):(A="row",W=c==Ra.start?"start":c==Ra.middle?"center":"end");var g=t.append("foreignObject").attr("x",n).attr("y",o).style("pointer-events","auto").attr("width",x+"px").attr("height",l+"px").style("user-select","none").append("xhtml:div").attr("id","legendObject"+L).attr("class","legendsBoxWrapper").style("width",x+"px").style("display","flex").style("height",l-1+"px").style("overflow","auto").style("pointer-events","auto").style("justify-content","safe "+W).style("flex-direction",A).style("outline-offset","-"+m.legends.legendBorderThickness+"px").style("outline",m.legends.legendBorder?`${m.legends.legendBorderThickness+"px solid"+m.legends.legendBorderColor}`:"none").append("div").attr("class","scrollbar").style("display","flex").style("flex-direction",A).style("flex-wrap","nowrap").style("padding-left","3px");(r==Je.top||r==Je.bottom)&&g.style("flex-direction","row"),e.forEach((b,U)=>{let Y=g.append("div").style("display","inline-flex").style("justify-content","flex-start").style("align-items","center").style("width","fit-content").style("margin","3px 0px").style("flex-wrap","nowrap").style("white-space","nowrap").on("dblclick",function(){S(b?.properties)}).on("mousemove",function(){if(m.legends.onHoverEffect){const w=this.textContent.replace(/\s+/g,"-");t.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!0),t.selectAll(`[hoverId="${w}"]`).classed("highlight",!0).classed("unhighlight",!1),t.selectAll(".cleveland-line-group").classed("highlight",!1).classed("unhighlight",!0)}}).on("mouseout",function(){if(m.legends.onHoverEffect){const w=this.textContent.replace(/\s+/g,"-");t.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!1),t.selectAll(`[hoverId="${w}"]`).classed("highlight",!1).classed("unhighlight",!1),t.selectAll(".cleveland-line-group").classed("highlight",!1).classed("unhighlight",!1)}});(r==Je.top||r==Je.bottom)&&Y.style("margin-right",u?"0px":"16px").style("white-space","nowrap");let H;if(!p){let w=b.properties.type;w==le.ColumnChart||w==le.StackColumnChart?H=ct.rectangle:w==le.LineChart||w==le.StackLineChart?H=ct.line:(w==le.AreaChart||w==le.StackAreaChart)&&(H=ct.areaWithLine)}(p||H)==ct.circle?ir(b,Y):(p||H)==ct.hollowCircle?lr(b,Y):(p||H)==ct.line?Ki(b,Y,m):(p||H)==ct.areaWithLine?Qi(b,Y,m):(p||H)==ct.rectangle&&rr(b,Y);let I=u&&(r==Je.bottom||r==Je.top)&&U!=e.length-1?" |":"",D=u?m.legends.legendSelectedUnicolor:m.legends.legendColorMode==Vl.multiColor?b.properties.color?b.properties.color:Ie.black:m.legends.legendSelectedUnicolor;Y.append("div").style("margin-left","5px").style("color",D).style("background",b.properties.axis==Qe.secondary&&m.secondaryYAxisLabel.secondaryYAxisBackgroundColor).style("font-size",(u?m.legends.legendFontSize:b.properties.fontSize)+"px").style("font-family",u?m.legends.legendFontFamily:b.properties.fontFamily).style("font-style",()=>(u?m.legends.legendFontStyle:b.properties.fontStyle).includes(ce.italic)?ce.italic:"").style("text-decoration",()=>(u?m.legends.legendFontStyle:b.properties.fontStyle).includes(ce.underline)?ce.underline:"").style("font-weight",()=>(u?m.legends.legendFontStyle:b.properties.fontStyle).includes(ce.bold)?ce.bold:"").style("white-space","nowrap").attr("title",u?b.legendDisplay+" : "+b.actualValue:b.properties.alias).html(u?b.legendDisplay+" : "+b.actualValue+I:b.properties.alias)})}}catch(W){me(xt,"legendsWithScroll",W)}};function ir(t,e){try{e.append("div").style("height","12px").style("width","12px").style("border-radius","50%").style("background",t.properties.color)}catch(n){me(xt,"getCircleShape",n)}}function lr(t,e){try{e.append("div").style("height","12px").style("width","12px").style("border-radius","50%").style("border",`3px solid ${t.properties.Color??t.properties.color}`)}catch(n){me(xt,"getHollowCircleShape",n)}}function Ki(t,e,n){try{const o=t.properties?.lineStyle?.toLowerCase()||"solid";let x=e.append("div").style("height","2px").style("width",o=="dashed"?"25px":"20px").style("background",Ie.transparent).style("position","relative").style("border-top",o=="none"?"unset":o=="dotted"?"2px dotted "+t.properties.color:o=="dashed"?"2px dashed "+t.properties.color:"2px solid "+t.properties.color);if(n.marker.markerVisibility)switch(t.properties.markerShape.toLowerCase()){case"circle":x.append("div").append("svg").style("position","absolute").style("left","50%").style("top","50%").attr("transform","translate(-5,-6)").attr("height","10px").attr("width","10px").append("circle").attr("cx","5").attr("cy","5").attr("r","4.5").style("fill",t.properties.markerColor);break;case"square":x.append("div").style("position","absolute").style("left","50%").style("top","50%").style("transform","translate(-2px, -7px)").style("height","8px").style("width","8px").style("top","2px").style("left","9px").style("background",t.properties.markerColor);break;case"triangle":x.append("div").style("position","absolute").style("transform","translate(5px, -6.5px)").style("border-left","6px solid transparent").style("border-right","6px solid transparent").style("border-bottom",`10px solid ${t.properties.markerColor}`);break;case"cross":x.append("div").style("position","absolute").style("left","50%").style("top","50%").style("transform","translate(-5px, -3px)").style("height","4px").style("width","10px").style("background",t.properties.markerColor).append("div").style("height","10px").style("width","4px").style("background",t.properties.markerColor).style("position","relative").style("top","-3px").style("left","3px");break;case"diamond":x.append("div").style("height","7px").style("width","7px").style("background",t.properties.markerColor).style("transform","rotate(45deg)").style("top","-4px").style("left","7px").style("position","absolute");break;case"star":x.append("div").style("border-left","4px solid transparent").style("border-right","4px solid transparent").style("border-bottom",`8px solid ${t.properties.markerColor}`).style("position","absolute").style("top","-6.5px").style("left","7px").style("transform","rotate(0deg)").append("div").style("border-left","4px solid transparent").style("border-right","4px solid transparent").style("border-top",`8px solid ${t.properties.markerColor}`).style("position","absolute").style("top","2px").style("left","-4px").style("transform","rotate(360deg)");break;case"wye":x.append("div").style("height","6.5px").style("width","3px").style("background",t.properties.markerColor).style("position","absolute").style("left","10px").style("top","-3.5px").append("div").style("height","5px").style("width","3px").style("background",t.properties.markerColor).style("transform","rotate(-55deg)").style("position","relative").style("top","-2px").style("left","-2px").append("div").style("height","5px").style("width","3px").style("background",t.properties.markerColor).style("transform","rotate(108deg)").style("position","relative").style("top","3px").style("left","2px");break;case"none":default:break}}catch(o){me(xt,"getLineShape",o)}}function Qi(t,e,n){try{let o=e.append("div").style("height","10px").style("width","15px").style("background",t.properties.color).style("display","flex").style("flex-direction","column").style("border-radius","1px");if(n.marker.markerVisibility)switch(t.properties.markerShape.toLowerCase()){case"circle":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.color).style("position","relative").append("svg").style("position","absolute").style("left","50%").style("top","50%").attr("transform","translate(-5,-5)").attr("height","10px").attr("width","10px").append("circle").attr("cx","5").attr("cy","5").attr("r","2.5").style("fill",t.properties.markerColor);break;case"square":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("position","absolute").style("left","50%").style("top","50%").style("transform","translate(-4px, -3.5px)").style("height","5px").style("width","5px").style("top","2px").style("left","9px").style("background",t.properties.markerColor).style("border-radius","1px");break;case"triangle":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("position","absolute").style("transform","translate(5px, -3.5px)").style("border-left","3px solid transparent").style("border-right","3px solid transparent").style("border-bottom",`7px solid ${t.properties.markerColor}`);break;case"cross":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("position","absolute").style("left","50%").style("top","50%").style("transform","translate(-3px, -2px)").style("height","4px").style("width","7px").style("background",t.properties.markerColor).append("div").style("height","6px").style("width","3px").style("background",t.properties.markerColor).style("position","relative").style("top","-1px").style("left","2px");break;case"diamond":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("height","4px").style("width","4px").style("background",t.properties.markerColor).style("transform","rotate(45deg)").style("top","-1px").style("left","5px").style("position","absolute");break;case"star":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("border-left","2.5px solid transparent").style("border-right","2.5px solid transparent").style("border-bottom",`6px solid ${t.properties.markerColor}`).style("position","absolute").style("top","-3px").style("left","6px").style("transform","rotate(0deg)").append("div").style("border-left","2.5px solid transparent").style("border-right","2.5px solid transparent").style("border-top",`6px solid ${t.properties.markerColor}`).style("position","absolute").style("top","0.5px").style("left","-2px").style("transform","rotate(360deg)");break;case"wye":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor).style("position","relative").append("div").style("height","4.5px").style("width","2px").style("background",t.properties.markerColor).style("position","absolute").style("left","6.5px").style("top","-0.5px").append("div").style("height","3px").style("width","2px").style("background",t.properties.markerColor).style("transform","rotate(-55deg)").style("position","relative").style("top","-2px").style("left","-2px").append("div").style("height","3px").style("width","2px").style("background",t.properties.markerColor).style("transform","rotate(108deg)").style("position","relative").style("top","3px").style("left","2px");break;case"none":o.append("div").style("height","20%").style("width","100%").style("background",t.properties.markerColor);break;default:break}o.append("div").style("height","20%").style("width","100%").style("background","white"),o.append("div").style("height","60%").style("width","100%").style("background",t.properties.color).style("border-radius","1px")}catch(o){me(xt,"getAreaShape",o)}}function rr(t,e){try{e.append("div").style("height","10px").style("width","15px").style("border-style",t).style("border-width",t).style("border-color",t).style("background",t.properties.color).style("border-radius","1px")}catch(n){me(xt,"getReactShape",n)}}const qt=(t,e,n,o)=>{try{let x=t.current;x.setAttribute("viewBox",`0 0 ${e} ${n}`);const{chartAreaColor:l,chartAreaBorder:r}=o.chartArea;if(x.style.backgroundColor=l,r){let p=o.chartArea.chartAreaBorderColor,m=o.chartArea.chartAreaBorderThickness+"px",L=rt(o.chartArea.chartAreaBorderStyle),u=L==1?"solid":L==2?"dashed":"dotted";x.style.outline=`${m} ${u} ${p}`,x.style.outlineOffset=`-${m}`}else x.style.outline="unset"}catch(x){me(xt,"initSvg",x)}},oa=(t,e)=>{try{return t.append("g").attr("transform",`translate(${e.left},${e.top})`).attr("font-color","#ccc")}catch(n){me(xt,"initChartArea",n)}},Kt=(t,e)=>{try{let n=v.select(t.current);n.selectAll("*").remove();let o=Zi(Ri,e),x=t.current.getBoundingClientRect(),l=x.width,r=x.height;return{chartFormatOptions:o,svg:n,width:l,height:r}}catch(n){me(xt,"firstFunctionBeforeRender",n)}},Ua=(t,e,n,o,x,l=!1)=>{try{let r=t.legends.legendPosition;r=t.legends.legendVisibility?t.legends.legendPosition:Je.none;let c=e*.15*.8,p=l?o[0]:c<o[0]+15?c:o[0]+15,m=t.chartTitle.chartTitleVisibility?t.chartTitle.dynamicTitleText.length!==0?$t(t.chartTitle.chartTitleHTML,void 0,void 0).height:$t(t.chartTitle.chartTitleText,16,tt).height:5;switch(r){case Je.none:x.top=m+10,x.bottom=15,x.right=15,x.left=15;break;case Je.top:x.top=m+50,x.bottom=15,x.right=15,x.left=15;break;case Je.right:x.right=p+50,x.top=m+15,x.bottom=15,x.left=15;break;case Je.bottom:x.bottom=45,x.top=m+15,x.right=15,x.left=15;break;case Je.left:x.left=p+50,x.top=m+15,x.bottom=15,x.right=15}let L=n-x.top-x.bottom,u=e-x.left-x.right;return{margins:x,innerHeight:L,innerWidth:u,legendListWidth:p,chartTitleHeight:m}}catch(r){me(xt,"marginCalculationsForChartsWithoutAxis",r)}},Wa=(t,e,n,o,x,l,r,c,p,m,L=!0,u)=>{try{let S=t.legends.legendPosition,g=t.total.totalPosition,W=t.total.totalAlignment,A=t.total.totalVisibility&&L,E=t.legends.legendAlignmentTopBottom,b=t.legends.legendAlignment;switch(S){case Je.none:break;case Je.right:xa(e,n,o-l-25,r+5+(A&&g==Fa.top&&W==Wt.end?10:0),l+15,x-r-10-(A?g==Fa.top&&W==Wt.end?10:g==Fa.bottom&&W==Wt.start?25:0:0),S,b,m,t,c,!1,u);break;case Je.top:xa(e,n,5,r+5,o-10,30,S,E,m,t,c,!1,u);break;case Je.left:xa(e,n,5,p.top+(A&&g==Fa.top&&W==Wt.start?10:0),l+15,x-r-10-(A?g==Fa.top&&W==Wt.start?10:g==Fa.bottom&&W==Wt.start?25:0:0),S,b,m,t,c,!1,u);break;case Je.bottom:xa(e,n,5,x-35,o-10,30,S,E,m,t,c,!1,u);break}}catch(S){me(xt,"initLegendListWithTotalValueAllowance",S)}},Ha=(t,e,n="legend")=>{try{let o=$t(qi(e,n),rt(t.legends.legendFontSize),t.legends.legendFontFamily);return[o.width,o.height]}catch(o){me(xt,"calculateLegendsMaxPossibleWidth",o)}},ri=(t,e,n,o=!1)=>{try{let x=t.chartTitle.chartTitleVisibility?t.chartTitle.dynamicTitleText.length!==0?$t(t.chartTitle.chartTitleHTML,void 0,void 0).height:$t(t.chartTitle.chartTitleText,16,tt).height:5,l={top:t.chartTitle.chartTitleVisibility?x:20,bottom:o&&t.colorScale.showColor==Ta.colorTheme?40:20,left:20,right:20};return innerHeight=e-l.top-l.bottom,innerWidth=n-l.left-l.right,{margins:l,chartTitleHeight:x,innerHeight,innerWidth}}catch(x){me(xt,"marginCalculationsForChartsWithoutLegends",x)}},rt=t=>{try{if(typeof t!="string")return t;const e=t.trim();if(e==="")return t;const n=parseFloat(e);return isNaN(n)?t:n}catch(e){me(xt,"convertStringToNumber",e)}};function mt(t,e,n=!1){try{return t.map(o=>{let x;o.properties?x={...ji,...o.properties}:x={...ji,legend:o.legend,currentLegend:o.legend,alias:o.legend,name:o.legend};const l=e&&e.length!==0?e.map(r=>{const c=o.data.find(p=>p.dimension===r);return c?{...c}:{dimension:r,legend:o.legend,value:0}}):o.data.map(r=>({...r}));return{...o,properties:x,data:n?o.data:l}})}catch(o){me(xt,"generalizedChartData",o)}}const mi=(t="")=>{try{return t.replace(/(#|;|&|,|\.|\+|\*|~|'|:|"|!|\^|\$|\[|\]|\(|\)|=|<|>|\||\/)/g,"\\$1")}catch(e){me(xt,"getJQuerySelector",e)}},fi=(t,e,n,o,x,l,r)=>{try{let c=t-e,p=l-x,m=parseInt(r.connector.connectorKPI),L,u;switch(m){case 1:if(L=`.${n}f`,e==0&&t==0)return"0";if(e==0&&t!=0)return v.format(L)(t);c=Math.abs(c);break;case 3:return L=`.${n}%`,e==0&&t==0?"0%":e==0&&t!=0?v.format(L)(t):(c=Math.round(t/e*100-100)/100,u=v.format(L)(c),u);case 2:return x.toString().length!==4&&(p=NaN),L=`.${n}%`,e==0&&t==0?"0%":e==0&&t!=0?v.format(L)(t):(c=Math.pow(t/e,1/p)-1,u=v.format(L)(c),u)}if(e==0)return"N/A";{let S,g="",W=r.connector.connectorDisplayUnits;switch(W!="None"&&W!=null&&(W=="Thousands"&&(S=1e3,g="K"),W=="Millions"&&(S=1e6,g="M"),W=="Billions"&&(S=1e9,g="B"),c=c/S),isNaN(c)&&(c=0),o){case",.0%":return L=`.${n}%`,v.format(L)(c);case"":return L=`.${n}f`,v.format(L)(c)+g;case".2n":return L=`.${n}n`,v.format(L)(c)+g;case".2$":return L=`,.${n}f`,"$"+v.format(L)(c)+g;case".2c":return L=`,.${n}f`,"C$"+v.format(L)(c)+g;case".2ē":return L=`,.${n}f`,"€"+v.format(L)(c)+g;case".2ch":return L=`,.${n}f`,"CHF"+v.format(L)(c)+g;case",":return L=`,.${n}f`,v.format(L)(c)+g;case".2£":return L=`,.${n}f`,"£"+v.format(L)(c)+g;case".2₹":return L=`,.${n}f`,"₹"+v.format(L)(c)+g;default:return L=".2f",v.format(L)(c)+g}}}catch{}},Xa=t=>{try{return t.includes("~$~")?t.split("~$~")[1].replace(/ /g,"-"):t.replace(/\s+/g,"-")}catch{return t}};function nr(t,e,n){try{let o=function(l){const r=l.split(" - ");return r.length>1?r[0]:l};const x=new Map;return e?.LegendList?.forEach(l=>{x.set(n?o(l?.name):l.measureUniqueId,l)}),t.map(l=>({...l,properties:x.get(n?o(l.legend):l.properties.measureUniqueId)??l.properties})).filter(l=>l.data[0].value!==0)}catch{return t}}const sr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID();let L=0,u=!1;const S=le.ColumnChart,g=Ce.useRef(),W=Ce.useRef(r);W.current=r;const A=Ce.useRef(c);A.current=c;const E=Ce.useRef(p);E.current=p;const b=mt(n.ChartData,n.DimensionList),U=n.DimensionList,Y=!1;let H=!1;const I=!1;let D=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,w=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,z=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,K=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue=[],ve=0,Pe=0,Ye=[];const We=new Map;let be={dimensionList:U,chartType:S,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{ze()}catch(ee){me("Columnchart","createColumnChart",ee)}},[e]);const ze=()=>{({formatOptions:e,svg:f,width:i,height:y}=Ft(g,e)),{formatOptions:e,dataTableLegendsList:Ye}=ea(e,b,n.DataTableData??[]),ke(),{maxNumberForPrimaryAxis:h,maxNumberForSecondaryAxis:k,customYaxisMaxValue:w,secondaryCustomYaxisMaxValue:K}=Rt(e,be.yMinLeft,be.yMaxLeft,be.yMinRight,be.yMaxRight),{margin:ye,yLabel:se,xLabel:te,yTitle:xe,xTitle:ge,dimensionHeightWidthArray:pe,chartTitleHeight:he,secondaryAxisTitleWidth:O,legendMargin:X,secondaryYLabel:M,visibleBars:Pe,columnWidth:L,scrollbarVisible:u}=Mt(i,y,h,k,be.yMaxLeft,e,be.legendList,be.dimensionList,be.yMaxRight,H,I,t,!1,be,Ye),_(ye),{dataTable:T,dataTableHeight:a}=ia(e,se,xe,b,be.dimensionList,n),St(f,i,y,e),N=wt(f,ye),kt(N,e,a,s,d,S,m),Se(),$(),Zt(N,e,a,se,Me,d),H&&bi(N,e,a,M,Ee,d,s),Dt(e,Y,f,ye,te,y,ge,be.chartType,se,s,d),Vt(d,e,a,Y,f,ye,xe,se),Gt(f,H,ye,e,a,d,s,M,O),Nt(f,e,i,he),It(y,f,pe,he,i,X,e,b,m,a,ye,ct.rectangle,S,l),_t(b,y,i,f,ye,s,u,Pe,be,ve,!1,G)},ke=()=>{const ee=[],F=[];let q=[],ue=-1/0,B=1/0,V=-1/0,P=1/0,C=1/0,re=-1/0;b.forEach(j=>{F.push(j.properties.legendUniqueId),re=-1/0,C=1/0,j.data.forEach(ie=>{ee.push(ie),j.properties.axis==="Secondary"?(H=!0,V=Math.max(V,ie.value),P=Math.min(P,ie.value)):(ue=Math.max(ue,ie.value),B=Math.min(B,ie.value)),re=Math.max(re,ie.value),C=Math.min(C,ie.value)}),j.properties.setColorScale&&We.set(j.properties.legendUniqueId,v.scaleSequential().domain([C,re]).interpolator(yi.interpolateRgb(j.properties.startColor,j.properties.endColor)))}),be.chartData=ee,be.legendList=F,be.yMaxLeft=ue,be.yMinLeft=B>0?0:B,be.yMaxRight=V,be.yMinRight=P>0?0:P,q=t?Tt(e.xAxisLabel.xAxisNumberFormat,be.dimensionList).map(j=>j):be.dimensionList,be.dimensionList.forEach((j,ie)=>{be.formattedDimensionListMap.set(j,q[ie])}),Ue=JSON.parse(JSON.stringify(b)),Le=be.dimensionList,e.plotArea.hideZeroValues&&(be.hideZeroValues=!0)},Se=()=>{let ee=yt(w||be.yMaxLeft,be.yMinLeft,d,e,be,D,w).yAxisLabelArray;if(be.yMaxLeft=ee[ee.length-1],be.yMinLeft=ee[0],ne=v.scaleLinear().domain([be.yMinLeft>=0?D!==void 0&&!Number.isNaN(D)?D:0:be.yMinLeft<0?be.yMinLeft*1.1:be.yMinLeft*.9,be.yMaxLeft<=0?0:w!==void 0&&!Number.isNaN(w)?w:be.yMaxLeft*1.1]).range([a>0?d-a:d,0]),H){let F=yt(K||be.yMaxRight,be.yMinRight,d,e,be,z,K).yAxisLabelArray;be.yMaxRight=F[F.length-1],be.yMinRight=F[0],Z=v.scaleLinear().domain([be.yMinRight>=0?(z||z==0)&&!Number.isNaN(z)?z:0:(z||z==0)&&!Number.isNaN(z)?z:be.yMinRight*1.1,be.yMaxRight<=0?K||0:K||be.yMaxRight*1.1]).range([a>0?d-a:d,0])}Te=[0,s],oe()},oe=()=>{Re=v.scaleBand().domain(be.legendList).range([0,L]).paddingInner(be.legendList.length>1?.3*parseFloat(e.plotArea.plotAreaSeriesWidth)/100:0),fe=v.scalePoint().domain(Le).range(Te).padding(.5)},$=()=>{{let ee=yt(w||be.yMaxLeft,be.yMinLeft,d,e,be,D,w);Me=v.axisLeft(ne).tickFormat(F=>Xe(F,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,s)).tickValues(ee.autoLabelFlag?void 0:ee.yAxisLabelArray).ticks(ee.customTickValue??d/30).tickPadding(8).tickSizeOuter(0)}if(H){let ee=yt(K||be.yMaxRight,z||be.yMinRight,d,e,be,z,K);Ee=v.axisRight(Z).tickFormat(F=>Xe(F,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(ee.autoLabelFlag?void 0:ee.yAxisLabelArray).ticks(ee.customTickValue??d/30).tickSize(zt(e,s)).tickPadding(8).tickSizeOuter(0)}},R=()=>{J=(parseInt(e.xAxisLabel.xAxisPosition)==1?v.axisTop(fe):v.axisBottom(fe)).tickSize(sa(e,d,a)).tickSizeOuter(0).tickValues(gt(Le,s,e))},ae=ee=>{ee.forEach(F=>{F.data.forEach(q=>{q.hideZero=F.properties.hideZeroValues,q.axis=F.properties.axis,q.legendUniqueId=F.properties.legendUniqueId})}),Le.forEach(F=>{N.append("rect").attr("id",`dim-background-${F}`).attr("class","dimension-background").attr("x",fe(F)-fe.step()/2).attr("width",fe.step()).attr("y",0).attr("height",d).attr("fill","#f3f4f6").attr("visibility","hidden").lower()}),ee.forEach(F=>{let q=N.selectAll(".parentGroup").data([F],C=>C.properties.legendUniqueId);q=q.enter().append("g").attr("class","column parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(q);let ue=q.selectAll(".column-group").data(F.data,C=>C.legend+C.dimension),B=ue.enter().append("g").attr("class","column-group").attr("hoverId",(F.properties.alias||F.properties.name||"Legend").replace(/\s+/g,"-")).attr("transform",C=>`translate(${fe(C.dimension)-L/2}, 0)`);ue.attr("transform",C=>`translate(${fe(C.dimension)-L/2}, 0)`),B.merge(ue).attr("transform",C=>`translate(${fe(C.dimension)-L/2}, 0)`);const V=B.append("rect").attr("x",C=>Re(C.legendUniqueId)).attr("width",Re.bandwidth()).attr("y",C=>(F.properties.axis===Qe.primary?ne:Z)(0)).attr("height",0).attr("fill",C=>We.get(F.properties.legendUniqueId)?.(C.value)??F.properties.color).attr("stroke-dasharray",C=>F.properties.stackBorderStyle==2?"5,3":"0").attr("stroke-width",C=>`${F.properties.stackBorderWidth}px`).attr("stroke",C=>F.properties.stackBorderStyle==0?"none":e.column.stackBorderVisibility?F.properties.stackBorderColor:"none").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",C=>C.value===0&&e.xAxisLabel.hideZeroValues?"hidden":"visible").attr(lt.SeriesId,()=>F.properties.legendUniqueId).attr(lt.DimValue,C=>Array.isArray(C.dimension)?String(C.dimension[0]):String(C.dimension));(e.animation.animationEnabled?V.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):V).attr("y",C=>{const re=F.properties.axis===Qe.primary?ne:Z;return C.value>0?re(C.value):re(0)}).attr("height",C=>{const re=F.properties.axis===Qe.primary?ne:Z;return Math.abs(re(C.value)-re(0))}),B.merge(ue).on("mousemove",(C,re)=>{(F.properties.alias||F.properties.name||"Legend").replace(/ /g,"-");const j=Array.isArray(re.dimension)?re.dimension[0]:re.dimension,ie=String(be.formattedDimensionListMap.get(j)??j??""),we=At(W.current,String(j??""),{...F.properties,formattedDimensionValue:ie});ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:ie},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():re.properties?.currentMeasure?re.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||re.value,value:Xe([le.NormalizedStackLineChart,le.NormalizedStackAreaChart,""].includes(S)?re[1]-re[0]:re.value,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:F.properties.alias}],e,C,F.properties,we)}).on("mouseout",(C,re)=>{(F.properties.alias||F.properties.name||"Legend").replace(/ /g,"-"),ot()}),B.merge(ue).on("click",vt(E,A,(C,re)=>({seriesId:F.properties.legendUniqueId,dimValue:Array.isArray(re.dimension)?String(re.dimension[0]):String(re.dimension),legendUniqueId:F.properties.legendUniqueId,seriesDisplayName:F.properties.alias||F.properties.name||""}))),ue.exit().remove()}),N.selectAll(".parentGroup").raise()},_=ee=>{s=i-ee.left-ee.right,d=y-ee.bottom-ee.top},G=(ee,F,q)=>{Ue=F,Le=ee,Pe=q,Q()},Q=()=>{oe(),R(),ta(N,be,te,e,a,ne,J,pe,y,L,t,s,d,Le,fe),ae(Ue),$a(b,fe,ne,Z,ye,pt,[],[],e,S,y,i,s,Le,d,m,f,x,Re,L,o),ua(e.plotArea.fitChart,f,N,T,L,ne,fe,Re,void 0,void 0,a,S,e,se,xe,be.dimensionList,s,Te,be.formattedDimensionListMap,m,ye,d)};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:g,id:m,style:{width:"100%",height:"100%"}})})},or=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID();let L=0,u=!1,S=[];const g=le.CustomColumnChart,W=Ce.useRef(),A=Ce.useRef(r);A.current=r;const E=Ce.useRef(c);E.current=c;const b=mt(n.ChartData,n.DimensionList),U=n.DimensionList,Y=!!e.swapAxis?.swapAxisEnabled;let H=!1;const I=!1;let D=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,w=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,z=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,K=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me=[],J=[],Ee=[],Le=[],Ue=[],ve=[],Pe=[],Ye=[],We,be,ze,ke=new Map,Se,oe,$,R,ae,_,G,Q=[],ee=[],F=0,q,ue=[],B={dimensionList:U,chartType:g,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{V()}catch(Be){me("CustomColumnchart","createCustomColumnChart",Be)}},[e]);const V=()=>{({formatOptions:e,svg:f,width:i,height:y}=Ft(W,e)),P(),{formatOptions:e,dataTableLegendsList:ue}=ea(e,b,n.DataTableData??[]),vi(),{maxNumberForPrimaryAxis:h,maxNumberForSecondaryAxis:k,customYaxisMaxValue:w,secondaryCustomYaxisMaxValue:K}=Rt(e,B.yMinLeft,B.yMaxLeft,B.yMinRight,B.yMaxRight),{margin:ye,yLabel:se,xLabel:te,yTitle:xe,xTitle:ge,dimensionHeightWidthArray:pe,chartTitleHeight:he,secondaryAxisTitleWidth:O,legendMargin:X,secondaryYLabel:M,visibleBars:q,columnWidth:L,scrollbarVisible:u}=Mt(i,y,h,k,B.yMaxLeft,e,B.legendList,B.dimensionList,B.yMaxRight,H,I,t,Y,B,ue),it(ye),{dataTable:T,dataTableHeight:a}=ia(e,se,xe,b,B.dimensionList,n),Y&&(T=[],a=0),St(f,i,y,e),N=wt(f,ye),kt(N,e,a,s,d,g,m),re(),ie(),Y?(ra(e,N,se,d,s,R),H&&Ai(e,N,M,ae,s)):(Zt(N,e,a,se,We,d),H&&bi(N,e,a,M,ze,d,s)),Dt(e,Y,f,ye,te,y,ge,B.chartType,se,s,d),Vt(d,e,a,Y,f,ye,xe,se,s),Gt(f,H,ye,e,a,d,s,M,O,Y),Nt(f,e,i,he),It(y,f,pe,he,i,X,e,b,m,a,ye,null,g,l),_t(b,y,i,f,ye,s,u,q,B,F,!1,nt,Y)},P=()=>{const Be=[];let qe=[],dt=-1/0,Oe=1/0,at=-1/0,je=1/0,Ne=[];b.forEach((Ve,He)=>{[le.StackColumnChart,le.StackAreaChart].includes(Ve.properties.type)?le.StackColumnChart===Ve.properties.type&&(Be.includes(le.StackColumnChart)||Be.push(le.StackColumnChart)):(Ne.push(Ve),Ve.properties.type!==le.LineChart&&Ve.properties.type!==le.AreaChart&&Be.push(Ve.properties.legendUniqueId)),Ve.properties.axis==="Secondary"&&(J.push(Ve),Ve.properties.type==le.StackColumnChart&&ve.push(Ve),Ve.properties.type==le.StackAreaChart&&Ue.push(Ve)),Ve.properties.axis===Qe.primary&&(Me.push(Ve),Ve.properties.type==le.StackColumnChart&&Le.push(Ve),Ve.properties.type==le.StackAreaChart&&Ee.push(Ve)),Ve.data=Ve.data.map(ht=>{const st={...ht,type:Ve.properties.type,axis:Ve.properties.axis,labelPosition:e?.annotation?.annotationPosition.toString()==="4"?Ve.properties.annotationPosition.toString():e?.annotation?.annotationPosition.toString(),labelColor:Ve.properties.labelColor,legendUniqueId:Ve.properties.legendUniqueId};return st.axis==="Secondary"?(H=!0,at=Math.max(at,st.value),je=Math.min(je,st.value)):(dt=Math.max(dt,st.value),Oe=Math.min(Oe,st.value)),st})}),Q=JSON.parse(JSON.stringify(b)),B.chartData=Ne,B.legendList=Be,B.yMaxLeft=dt,B.yMinLeft=Oe>0?0:Oe,B.yMaxRight=at,B.yMinRight=je>0?0:je,qe=t?Tt(e.xAxisLabel.xAxisNumberFormat,B.dimensionList).map(Ve=>Ve):B.dimensionList,B.dimensionList.forEach((Ve,He)=>{B.formattedDimensionListMap.set(Ve,qe[He])}),e.plotArea.fitChart?G=B.dimensionList:G=B.dimensionList.slice(F,F+q),e.plotArea.hideZeroValues&&(B.hideZeroValues=!0),C(Ee,Le,Ue,ve,b)},C=(Be,qe,dt,Oe,at)=>{const je=Lt(G,Be,!1),Ne=Lt(G,dt,!1),Ve=Lt(G,qe,!1),He=Lt(G,Oe,!1);ee=[];const ht=[];if(Be.forEach(st=>{ht.push({properties:{axis:st.properties.axis,type:st.properties.type,legend:st.properties.legend,annotation:st.properties.annotation,alias:st.properties.alias},stackData:je,data:Be})}),dt.forEach(st=>{ht.push({properties:{axis:st.properties.axis,type:st.properties.type,legend:st.properties.legend,annotation:st.properties.annotation,alias:st.properties.alias},stackData:Ne,data:dt})}),qe.forEach(st=>{ht.push({properties:{axis:st.properties.axis,type:st.properties.type,legend:st.properties.legend,annotation:st.properties.annotation,alias:st.properties.alias},stackData:Ve,data:qe})}),Oe.forEach(st=>{ht.push({properties:{axis:st.properties.axis,type:st.properties.type,legend:st.properties.legend,annotation:st.properties.annotation,alias:st.properties.alias},stackData:He,data:Oe})}),ht.push(...B.chartData),at.length){const st=[];at.forEach(ki=>{st.push(...ht.filter(Al=>Al.properties?.type===ki.properties.type&&Al.properties.legend===ki.legend))}),ee.push(...st)}else ee.push(...ht)},re=()=>{const Be=Y?[0,a>0?s-a:s]:[a>0?d-a:d,0];{const qe=v.scaleLinear().domain([B.yMinLeft>=0?D!==void 0&&!Number.isNaN(D)?D:0:B.yMinLeft<0?B.yMinLeft*1.1:B.yMinLeft*.9,B.yMaxLeft<=0?0:w!==void 0&&!Number.isNaN(w)?w:B.yMaxLeft*1.1]).range(Be);Y?oe=qe:ne=qe}if(H){const qe=v.scaleLinear().domain([B.yMinRight>=0?(z||z==0)&&!Number.isNaN(z)?z:0:(z||z==0)&&!Number.isNaN(z)?z:B.yMinRight*1.1,B.yMaxRight<=0?(K||K==0)&&!Number.isNaN(K)?K:0:(K||K==0)&&!Number.isNaN(K)?K:B.yMaxRight*1.1]).range(Be);Y?$=qe:Z=qe}Te=Y?[d,0]:[0,s]},j=()=>{Re=v.scaleBand().domain(B.legendList).range([0,L]).paddingInner(B.legendList.length>1?.3*parseFloat(e.plotArea.plotAreaSeriesWidth)/100:0);const Be=v.scalePoint().domain(G).range(Te).padding(.5);Y?Se=Be:fe=Be},ie=()=>{{let Be=yt(w||B.yMaxLeft,B.yMinLeft,d,e,B,D,w,Y,s);Y?R=v.axisBottom(oe).tickFormat(qe=>Xe(qe,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-d:0).tickValues(Be.autoLabelFlag?void 0:Be.yAxisLabelArray).ticks(Be.customTickValue??s/50).tickPadding(8).tickSizeOuter(0):We=v.axisLeft(ne).tickFormat(qe=>Xe(qe,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,s)).tickValues(Be.autoLabelFlag?void 0:Be.yAxisLabelArray).ticks(Be.customTickValue??d/30).tickPadding(8).tickSizeOuter(0)}if(H){let Be=yt(w||B.yMaxRight,B.yMinRight,d,e,B,D,w);Y?ae=v.axisTop($).tickFormat(qe=>Xe(qe,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(Be.autoLabelFlag?void 0:Be.yAxisLabelArray).ticks(Be.customTickValue??s/30).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-d:0).tickPadding(8).tickSizeOuter(0):ze=v.axisRight(Z).tickFormat(qe=>Xe(qe,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(Be.autoLabelFlag?void 0:Be.yAxisLabelArray).ticks(Be.customTickValue??d/30).tickSize(zt(e,s)).tickPadding(8).tickSizeOuter(0)}},we=()=>{Y?_=v.axisLeft(Se).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*s*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(G,d,e)):be=v.axisBottom(fe).tickSize(sa(e,d,a,!0)).tickSizeOuter(0).tickValues(gt(G,s,e))},de=Be=>{Be.forEach(Oe=>{switch(Oe.properties.type){default:case le.ColumnChart:Ae(Oe);break;case le.LineChart:break;case le.AreaChart:break;case le.StackColumnChart:Pe=Ia(Oe),_e();break;case le.StackAreaChart:Ye=Ia(Oe),Fe(Oe);break}});const qe=Q.filter(Oe=>Oe.properties.type===le.LineChart);qe.length&&De(qe);const dt=Q.filter(Oe=>Oe.properties.type===le.AreaChart);dt.length&&$e(dt),N.selectAll(".parentGroup").raise()},Ae=Be=>{let qe=N.selectAll(".parentGroup").data([Be],Ne=>Ne.properties?.legendUniqueId);qe=qe.enter().append("g").attr("class","column parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(qe);let dt=qe.selectAll(".column-group").data(Be.data,Ne=>Ne.legendUniqueId),Oe=dt.enter().append("g").attr("class","column-group").attr("hoverId",Ne=>(Be.properties.alias||Be.properties.name).includes("-")?(Be.properties.alias||Be.properties.name).replace("-","`").split("`")[1].replace(/ /g,"-"):(Be.properties.alias||Be.properties.name).replace(/ /g,"-")).attr("transform",Ne=>Y?`translate(0, ${Se(Ne.dimension)})`:`translate(${fe(Ne.dimension)}, 0)`);Oe.merge(dt).attr("transform",Ne=>Y?`translate(0, ${Se(Ne.dimension)-L/2})`:`translate(${fe(Ne.dimension)-L/2}, 0)`);const at=(Y?Oe.append("rect").attr("y",Ne=>Re(Ne.legendUniqueId)).attr("height",Re.bandwidth()).attr("x",()=>(Be.properties.axis===Qe.primary?oe:$)(0)).attr("width",0):Oe.append("rect").attr("x",Ne=>Re(Ne.legendUniqueId)).attr("width",Re.bandwidth()).attr("y",()=>(Be.properties.axis===Qe.primary?ne:Z)(0)).attr("height",0)).attr("fill",Be.properties.color).attr("stroke-dasharray",Ne=>Be.properties.stackBorderStyle==2?"5,3":"0").attr("stroke-width",Ne=>`${Be.properties.stackBorderWidth}px`).attr("stroke",Ne=>Be.properties.stackBorderStyle==0?"none":e.column.stackBorderVisibility?Be.properties.stackBorderColor:"none").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",Ne=>Ne.value===0&&e.xAxisLabel.hideZeroValues?"hidden":"visible").attr(lt.SeriesId,()=>Be.properties.legendUniqueId).attr(lt.DimValue,Ne=>Array.isArray(Ne.dimension)?String(Ne.dimension[0]):String(Ne.dimension)).on("mousemove",(Ne,Ve)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:B.formattedDimensionListMap.get(Array.isArray(Ve.dimension)?Ve.dimension[0]:Ve.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():Ve.properties?.currentMeasure?Ve.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||Ve.value,value:Xe([le.NormalizedStackLineChart,le.NormalizedStackAreaChart,""].includes(g)?Ve[1]-Ve[0]:Ve.value,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:Ve.legend.includes("~$~")?Ve.legend.split("~$~")[1]:Ve.legend}],e,Ne,b.filter(He=>He.legend===Ve.legend)[0].properties,(()=>{const He=Array.isArray(Ve.dimension)?Ve.dimension[0]:Ve.dimension,ht=b.filter(st=>st.legend===Ve.legend)[0].properties;return At(p,String(He??""),{...ht,formattedDimensionValue:String(B.formattedDimensionListMap.get(He)??He??"")})})())}).on("mouseout",ot).on("click",vt(E,A,(Ne,Ve)=>({seriesId:Be.properties.legendUniqueId,dimValue:Array.isArray(Ve.dimension)?String(Ve.dimension[0]):String(Ve.dimension),legendUniqueId:Be.properties.legendUniqueId,seriesDisplayName:Be.properties.alias||Be.properties.name||""}))),je=e.animation.animationEnabled?at.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):at;Y?je.attr("x",Ne=>{const Ve=Be.properties.axis===Qe.primary?oe:$;return Ne.value>0?Ve(0):Ve(Ne.value)}).attr("width",Ne=>{const Ve=Be.properties.axis===Qe.primary?oe:$;return Math.abs(Ve(Ne.value)-Ve(0))}):je.attr("y",Ne=>{const Ve=Be.properties.axis===Qe.primary?ne:Z;return Ne.value>0?Ve(Ne.value):Ve(0)}).attr("height",Ne=>{const Ve=Be.properties.axis===Qe.primary?ne:Z;return Math.abs(Ve(Ne.value)-Ve(0))}),dt.exit().remove()},De=Be=>{Be.forEach(je=>{je.data.forEach(Ne=>{Ne.hideZero=je.properties.hideZeroValues,Ne.axis=je.properties.axis,Ne.legendUniqueId=je.properties.legendUniqueId})});const qe=Y?v.line().y(je=>{const Ne=Se(je.dimension);return Ne??0}).x(je=>je.axis==Qe.primary?oe(je.value):$(je.value)).defined(je=>e?.plotArea?.hideZeroValues?!!je.value:!0).curve(ft(e)):v.line().x(je=>fe(je.dimension)?fe(je.dimension):null).y(je=>je.axis==Qe.primary?ne(je.value):Z(je.value)).defined(je=>e?.plotArea?.hideZeroValues?!!je.value:!0).curve(ft(e));let dt=N.selectAll(".lines.parentGroup").data([1]);dt=dt.enter().append("g").attr("class","lines parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(dt);let Oe=dt.selectAll(".line-group").data(Be,je=>je.properties.legendUniqueId),at=Oe.enter().append("g").attr("class","line-group");at.attr("hoverId",je=>(je.properties.alias||je.properties.name||"Legend").replace(/\s+/g,"-")).append("path").attr("class","line").attr("fill","none"),at.merge(Oe).select("path").attr("d",je=>qe(je.data)).attr("stroke",je=>je.properties.color!==Ie.white?je.properties.color:"none").attr("stroke-dasharray",je=>{switch(je.properties.lineStyle){case bt.dotted:return"0,3";case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",je=>je.properties.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",je=>je.properties.lineStyle!=="None"?je.properties.lineWidth:"0"),e.animation.animationEnabled&&at.merge(Oe).select("path").each(function(){const je=v.select(this),Ne=this.getTotalLength();je.attr("stroke-dasharray",Ne+" "+Ne).attr("stroke-dashoffset",Ne),je.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("stroke-dashoffset",0)}),Oe.exit().remove(),Va(dt,Be,le.CombinationLine,Y?Se:fe,Y?oe:ne,Y?$:Z,null,e,B,K,z,D,w,!1,p,Y)},$e=Be=>{Be.forEach(He=>{He.data.forEach(ht=>{ht.hideZero=He.properties.hideZeroValues,ht.axis=He.properties.axis,ht.legendUniqueId=He.properties.legendUniqueId})});const qe=Y?v.area().y(He=>{const ht=Se(He.dimension);return ht??0}).x0(()=>oe(0)).x1(He=>oe(He.value)).defined(He=>He.hideZero?!!He.value:!0).curve(ft(e)):v.area().x(He=>fe(He.dimension)?fe(He.dimension):null).y0(()=>ne(0)).y1(He=>ne(He.value)).defined(He=>He.hideZero?!!He.value:!0).curve(ft(e)),dt=Y?v.area().y(He=>{const ht=Se(He.dimension);return ht??0}).x0(()=>oe(0)).x1(()=>oe(0)).defined(He=>He.hideZero?!!He.value:!0).curve(ft(e)):v.area().x(He=>fe(He.dimension)?fe(He.dimension):null).y0(()=>ne(0)).y1(()=>ne(0)).defined(He=>He.hideZero?!!He.value:!0).curve(ft(e)),Oe=e.animation.animationEnabled;let at=N.selectAll(".areas.parentGroup").data([1]),je=N.append("g").attr("class","focusClass");at=at.enter().append("g").attr("class","areas parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(at);let Ne=at.selectAll(".area-group").data(Be,He=>He.legend),Ve=Ne.enter().append("g").attr("class","area-group");Ve.append("path").attr("hoverId",He=>(He.properties.alias||He.properties.name||"Legend").replace(/\s+/g,"-")).attr("class","area parentGroup").attr("fill",He=>He.properties.color!==Ie.white?He.properties.color:"none").style("fill-opacity",e.plotArea.fillOpacity).attr("d",He=>Oe?dt(He.data):qe(He.data)).each(function(He){Oe&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",qe(He.data))}),Ne.select("path").attr("d",He=>qe(He.data)),Ve.merge(Ne).select("path").attr("stroke",He=>He.properties.areaBorderColor!==Ie.white?He.properties.areaBorderColor:"none").attr("stroke-dasharray",He=>{switch(He.properties.lineStyle){case"dotted":return"0,3";case"dashed":return fa;default:return""}}).attr("stroke-linecap",He=>He.properties.lineStyle==="dotted"?ya.round:"").attr("stroke-width",He=>He.properties.lineStyle!=="None"&&e.plotArea.plotAreaHideLineAndMarkers?He.properties.lineWidth:"0"),Li(e,at,je,G,Be,Y?Se:fe,Y?oe:ne,g,!1,Y),Ne.exit().remove(),Va(at,Be,le.CombinationArea,Y?Se:fe,Y?oe:ne,Y?$:Z,null,e,B,K,z,D,w,!1,void 0,Y)},Fe=Be=>{Be.data.forEach(Ve=>{Ve.data.forEach(He=>{He.hideZero=Ve.properties.hideZeroValues,He.axis=Ve.properties.axis,He.legendUniqueId=Ve.properties.legendUniqueId})});const qe=Y?v.area().y(Ve=>{const He=Se(Ve.data.dimension);return He??0}).x0(Ve=>Ve.data.axis===Qe.primary?oe(Ve[0]):$(Ve[0])).x1(Ve=>Ve.data.axis===Qe.primary?oe(Ve[1]):$(Ve[1])).defined(Ve=>Ve.hideZero?!!Ve.key:!0).curve(ft(e)):v.area().x(Ve=>fe(Ve.data.dimension)?fe(Ve.data.dimension):null).y0(Ve=>Ve.data.axis===Qe.primary?ne(Ve[0]):Z(Ve[0])).y1(Ve=>Ve.data.axis===Qe.primary?ne(Ve[1]):Z(Ve[1])).defined(Ve=>Ve.hideZero?!!Ve.key:!0).curve(ft(e)),dt=Y?v.area().y(Ve=>{const He=Se(Ve.data.dimension);return He??0}).x0(()=>oe(0)).x1(()=>oe(0)).defined(Ve=>Ve.hideZero?!!Ve.key:!0).curve(ft(e)):v.area().x(Ve=>fe(Ve.data.dimension)?fe(Ve.data.dimension):null).y0(()=>ne(0)).y1(()=>ne(0)).defined(Ve=>Ve.hideZero?!!Ve.key:!0).curve(ft(e)),Oe=e.animation.animationEnabled;let at=N.selectAll(".parentGroup").data([Ye]);N.append("g").attr("class","focusClass"),at=at.enter().append("g").attr("class","areas parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(at);let je=at.selectAll(".area-group").data(Ve=>Ve),Ne=je.enter().append("g").attr("class",Ve=>"area-group "+Ve.key.replace(/ /g,"-"));Ne.append("path").attr("hoverId",Ve=>(Be.data.filter(He=>He.legend===Ve.key)[0].properties.alias||Be.data.filter(He=>He.legend===Ve.key)[0].properties.name||"Legend").replace(/\s+/g,"-")).attr("class","area parentGroup").attr("fill",Ve=>Ve.color!==Ie.white?Ve.color:"none").attr("d",Ve=>Oe?dt(Ve):qe(Ve)).each(function(Ve){Oe&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",qe(Ve))}),je.select("path").attr("d",Ve=>qe(Ve)),Ne.merge(je).select("path").style("opacity",e.plotArea.fillOpacity).attr("stroke",Ve=>Ve.color!==Ie.white?Ve.color:"none").attr("stroke-dasharray",(Ve,He)=>b[He].properties.lineStyle==="dotted"?"0,3":b[He].properties.lineStyle==="dashed"?fa:"").attr("stroke-linecap",(Ve,He)=>b[He].properties.lineStyle==="dotted"?ya.round:"").attr("stroke-width",(Ve,He)=>b[He].properties.lineStyle!=="None"?b[He].properties.lineWidth:"0"),je.exit().remove(),Va(at,Be.data,le.CombinationStackArea,Y?Se:fe,Y?oe:ne,Y?$:Z,null,e,B,K,z,D,w,!1,void 0,Y)},_e=()=>{let Be=N.selectAll(".parentGroup").data([Pe]);Be=Be.enter().append("g").attr("class","stackcolumns parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(Be);let qe=Be.selectAll(".stackcolumns-group").data(Ne=>Ne);qe=qe.enter().append("g").attr("class",Ne=>"stackcolumns-group ").merge(qe);let Oe=qe.selectAll("rect").data(Ne=>Ne);Y?Oe.attr("x",Ne=>Ne.data.axis===Qe.primary?oe(Ne[0]):$(Ne[0])).attr("width",Ne=>Ne.data.axis===Qe.primary?w&&Ne[1]>w?oe(w)-oe(Ne[0]):oe(Ne[1])-oe(Ne[0]):K&&Ne[1]>K?$(K)-$(Ne[0]):$(Ne[1])-$(Ne[0])):Oe.attr("y",Ne=>Ne.data.axis===Qe.primary?ne(Ne[1]):Z(Ne[1])).attr("height",Ne=>Ne.data.axis===Qe.primary?w&&Ne[1]>w?ne(Ne[0])-ne(w):ne(Ne[0])-ne(Ne[1]):K&&Ne[1]>K?Z(Ne[0])-Z(K):Z(Ne[0])-Z(Ne[1]));const at=Y?Oe.enter().append("rect").attr("transform",Ne=>`translate(0, ${Se(Ne.data.dimension)-L/2})`).attr("x",Ne=>Ne.data.axis===Qe.primary?oe(0):$(0)).attr("width",0):Oe.enter().append("rect").attr("transform",Ne=>`translate(${fe(Ne.data.dimension)-L/2},0)`).attr("y",Ne=>Ne.data.axis===Qe.primary?ne(0):Z(0)).attr("height",0);at.merge(Oe).attr("hoverId",Ne=>Ne.alias.includes("~$~")?Ne.alias.split("~$~")[1].replace(/ /g,"-"):Ne.alias.replace(/ /g,"-")).attr(Y?"y":"x",Ne=>Re(le.StackColumnChart)).attr(Y?"height":"width",Re.bandwidth()).attr("fill",(Ne,Ve,He)=>{const ht=Array.from(b).findIndex(st=>st.legend===Ne.key);return b[ht]?.properties?.color||"gray"}).attr("stroke",(Ne,Ve,He)=>{const ht=Array.from(b).findIndex(ki=>ki.legend===Ne.key),st=b[ht]?.properties;return st?.stackBorderStyle==0?"none":e.column.stackBorderVisibility?st.stackBorderColor:"none"}).attr("stroke-dasharray",(Ne,Ve,He)=>{const ht=Array.from(b).findIndex(st=>st.legend===Ne.key);return b[ht]?.properties.stackBorderStyle==2?"5,3":"0"}).attr("stroke-width",(Ne,Ve,He)=>{const ht=Array.from(b).findIndex(st=>st.legend===Ne.key);return(b[ht]?.properties.stackBorderWidth||0)+"px"}).on("mousemove",(Ne,Ve)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:B.formattedDimensionListMap.get(Ve.data.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():Ve.properties?.currentMeasure?Ve.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||Ve.value,value:Xe(Ve.data[Ve.key],e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:Ve.key.includes("~$~")?Ve.key.split("~$~")[1]:Ve.key}],e,Ne,b.filter(He=>He.legend===Ve.key)[0].properties,(()=>{const He=b.filter(ht=>ht.legend===Ve.key)[0].properties;return At(p,String(Ve.data.dimension??""),{...He,formattedDimensionValue:String(B.formattedDimensionListMap.get(Ve.data.dimension)??Ve.data.dimension??"")})})())}).on("mouseout",ot).attr(lt.SeriesId,Ne=>Ne.key??"").attr(lt.DimValue,Ne=>Array.isArray(Ne.data.dimension)?String(Ne.data.dimension[0]):String(Ne.data.dimension)).on("click",vt(E,A,(Ne,Ve)=>({seriesId:Ve.key??"",dimValue:Array.isArray(Ve.data.dimension)?String(Ve.data.dimension[0]):String(Ve.data.dimension),legendUniqueId:Ve.key??"",seriesDisplayName:Ve.alias||Ve.key||""})));const je=e.animation.animationEnabled?at.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):at;Y?je.attr("x",Ne=>Ne.data.axis===Qe.primary?oe(Ne[0]):$(Ne[0])).attr("width",Ne=>Ne.data.axis===Qe.primary?w&&Ne[1]>w?oe(w)-oe(Ne[0]):oe(Ne[1])-oe(Ne[0]):K&&Ne[1]>K?$(K)-$(Ne[0]):$(Ne[1])-$(Ne[0])):je.attr("y",Ne=>Ne.data.axis===Qe.primary?ne(Ne[1]):Z(Ne[1])).attr("height",Ne=>Ne.data.axis===Qe.primary?w&&Ne[1]>w?ne(Ne[0])-ne(w):ne(Ne[0])-ne(Ne[1]):K&&Ne[1]>K?Z(Ne[0])-Z(K):Z(Ne[0])-Z(Ne[1])),qe.exit().remove()},it=Be=>{s=i-Be.left-Be.right,d=y-Be.bottom-Be.top},nt=(Be,qe,dt)=>{Q=qe,G=Be,q=dt,Ba(n,ke,G),C(Ee,Le,Ue,ve,qe),Q=JSON.parse(JSON.stringify(ee)),Q.forEach((Oe,at)=>{Oe.properties.type===le.StackColumnChart||Oe.properties.type===le.StackAreaChart?Oe.data.forEach((je,Ne)=>Q[at].data[Ne].data=je.data.filter(Ve=>G.includes(Ve.dimension))):Q[at].data=Oe.data.filter(je=>G.includes(je.dimension))}),di()};function Ba(Be,qe,dt){qe.clear(),dt&&dt.length>0&&dt.forEach(Oe=>{qe.set(Oe,0)}),Be.ChartData&&Be.ChartData.length>0&&Be.ChartData.forEach(Oe=>{Oe.properties.type.includes("Stack")&&Oe.data.forEach((at,je)=>{if(qe.has(at.dimension)){let Ne=qe.get(at.dimension)||0;Ne+=at.value||0,qe.set(at.dimension,Ne)}})})}const di=()=>{j(),we(),de(Q),Y?na(e,N,te,d,s,_,ae,oe,B.yMaxLeft,G,g,t,i,pe,L,Se):ta(N,B,te,e,a,ne,be,pe,y,L,t,s,d,G,fe);const Be=()=>{Y||jl(Q,fe,ne,Z,ye,pt,Pe,Ye,[],[],L,e,y,i,s,G,d,m,f,x,Re,o),ii(ke,Y?Se:fe,Y?oe:ne,ye,pt,[],e,g,y,i,f,o,Y)};Y||ua(e.plotArea.fitChart,f,N,T,L,ne,fe,Re,void 0,void 0,a,g,e,se,xe,B.dimensionList,s,Te,B.formattedDimensionListMap,m,ye,d),f.selectAll(".annotation-group").remove(),Be()},Ia=Be=>{let qe=Be.data.map(Oe=>Oe.legend);S=v.stack().keys(qe).offset(v.stackOffsetDiverging)(Be.stackData),Be.data.forEach((Oe,at)=>Oe.data.forEach((je,Ne)=>{je[0]=S[at][Ne][0],je[1]=S[at][Ne][1]}));let dt=e.annotation.annotationSetLabelColor;return S.forEach((Oe,at)=>{Oe.forEach(je=>{je.key=Oe.key,je.alias=Be.data[at].properties.alias,Oe.alias=Be.data[at].properties.alias,Oe.color=JSON.parse(JSON.stringify(Be.data[at].properties.color)),Oe.individualAnnotationVisibility=JSON.parse(JSON.stringify(Be.data[at].properties.annotation)),je.data.labelPosition=e?.annotation?.annotationPosition.toString()==="4"?Be.data[at].properties.annotationPosition.toString():e?.annotation?.annotationPosition.toString(),je.data.labelColor=dt=="2"?JSON.parse(JSON.stringify(Be.data[at].properties.color)):JSON.parse(JSON.stringify(Be.data[at].properties.labelColor)),je.hideZero=JSON.parse(JSON.stringify(Be.data[at].properties.hideZeroValues)),je.data.axis=JSON.parse(JSON.stringify(Be.data[at].properties.axis)),je.data.color=JSON.parse(JSON.stringify(Be.data[at].properties.color)),je.data.legend=Be.properties.type,je.data.type=JSON.parse(JSON.stringify(Be.data[at].properties.type))})}),S},vi=()=>{if(Me.length>0){const qe=(Le.length>0?Lt(G,Le,!1):Lt(G,Ee,!1)).map(dt=>dt.total);B.yMaxLeft=Math.max(B.yMaxLeft,...qe),B.yMinLeft=Math.min(B.yMinLeft,...qe)}if(J.length>0){const qe=(ve.length>0?Lt(G,ve,!1):Lt(G,Ue,!1)).map(dt=>dt.total);B.yMaxRight=Math.max(B.yMaxRight,...qe),B.yMinRight=Math.min(B.yMinRight,...qe)}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:W,id:m,style:{width:"100%",height:"100%"}})})},cr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID();let L=0;const u=le.LayeredColumnChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList),E=n.DimensionList,b=!1,U=!1,Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0;e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility&&parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText);let D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te=[];const Me=new Map;let J=0,Ee=2,Le=!1,Ue=[],ve={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Pe()}catch(ae){me("LayeredColumnchart","createLayeredColumnChart",ae)}},[e]);const Pe=()=>{({formatOptions:e,svg:y,width:k,height:s}=Ft(S,e)),Ye(),{formatOptions:e,dataTableLegendsList:Ue}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:O,maxNumberForSecondaryAxis:X,customYaxisMaxValue:I,secondaryCustomYaxisMaxValue:D}=Rt(e,ve.yMinLeft,ve.yMaxLeft,ve.yMinRight,ve.yMaxRight),{margin:w,yLabel:z,xLabel:K,yTitle:ye,xTitle:se,dimensionHeightWidthArray:te,chartTitleHeight:xe,secondaryAxisTitleWidth:ge,legendMargin:pe,secondaryYLabel:he,visibleBars:Ee,columnWidth:L,scrollbarVisible:Le}=Mt(k,s,O,X,ve.yMaxLeft,e,ve.legendList,ve.dimensionList,ve.yMaxRight,U,Y,t,!1,ve,Ue),oe(w),{dataTable:d,dataTableHeight:i}=ia(e,z,ye,A,ve.dimensionList,n),St(y,k,s,e),T=wt(y,w),kt(T,e,i,M,h,u,m),We(),ze(),Zt(T,e,i,z,Z,h),Dt(e,b,y,w,K,s,se,ve.chartType,z,M,h),Vt(h,e,i,b,y,w,ye,z),Gt(y,U,w,e,i,h,M,he,ge),Nt(y,e,k,xe),It(s,y,te,xe,k,pe,e,A,m,i,w,ct.rectangle,u,l),_t(A,s,k,y,w,M,Le,Ee,ve,J,!1,R)},Ye=()=>{const ae=[],_=[];let G=[],Q=-1/0,ee=1/0,F=-1/0,q=1/0,ue=-1/0,B=1/0;A.forEach(V=>{_.push(V.properties.legendUniqueId),ue=-1/0,B=1/0,V.data.forEach(P=>{ae.push(P),ue=Math.max(ue,P.value),B=Math.min(B,P.value),Q=Math.max(Q,P.value),ee=Math.min(ee,P.value)}),V.properties.setColorScale&&Me.set(V.properties.legendUniqueId,v.scaleSequential().domain([B,ue]).interpolator(v.interpolateRgb(V.properties.startColor,V.properties.endColor)))}),ve.chartData=ae,ve.legendList=_,ve.yMaxLeft=Q,ve.yMinLeft=ee>0?0:ee,ve.yMaxRight=F,ve.yMinRight=q>0?0:q,G=t?Tt(e.xAxisLabel.xAxisNumberFormat,ve.dimensionList).map(V=>V):ve.dimensionList,ve.dimensionList.forEach((V,P)=>{ve.formattedDimensionListMap.set(V,G[P])}),Te=JSON.parse(JSON.stringify(A)),e.plotArea.fitChart?Re=ve.dimensionList:Re=ve.dimensionList.slice(J,J+Ee),e.plotArea.hideZeroValues&&(ve.hideZeroValues=!0)},We=()=>{let ae=yt(I||ve.yMaxLeft,ve.yMinLeft,h,e,ve,H,I).yAxisLabelArray;ve.yMaxLeft=ae[ae.length-1],ve.yMinLeft=ae[0],a=v.scaleLinear().domain([ve.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:0:ve.yMinLeft<0?ve.yMinLeft*1.1:ve.yMinLeft*.9,ve.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:ve.yMaxLeft*1.1]).range([i>0?h-i:h,0]),ne=[0,M]},be=()=>{v.scaleBand().domain(["layeredLegend"]).range([0,L]).paddingInner(ve.legendList.length>1?.3*parseFloat(e.plotArea.plotAreaSeriesWidth)/100:0),N=v.scalePoint().domain(Re).range(ne).padding(.5)},ze=()=>{ke();{let ae=yt(I||ve.yMaxLeft,ve.yMinLeft,h,e,ve,H,I);Z=v.axisLeft(a).tickFormat(_=>Xe(_,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,M)).tickValues(ae.autoLabelFlag?void 0:ae.yAxisLabelArray).ticks(ae.customTickValue).tickPadding(8).tickSizeOuter(0)}},ke=()=>{fe=v.axisBottom(N).tickSize(sa(e,h,i)).tickSizeOuter(0).tickValues(gt(Re,M,e))},Se=ae=>{ae.forEach(_=>{_.data.forEach(G=>{G.hideZero=_.properties.hideZeroValues,G.properties=_.properties,G.axis=_.properties.axis})}),ae.forEach((_,G)=>{let Q=T.selectAll(".parentGroup").filter(B=>B?.properties?.legendUniqueId===_.properties.legendUniqueId).data([_],B=>B.properties.legendUniqueId);Q=Q.enter().append("g").attr("class","column parentGroup").attr("data-legend-id",_.properties.legendUniqueId).attr("clip-path",`url(#${m}-clip)`).merge(Q);let ee=Q.selectAll(".column-group").data(_.data,B=>B.dimension+"_"+_.properties.legendUniqueId),F=ee.enter().append("g").attr("class","column-group").attr("hoverId",(_.properties.alias||_.properties.name||"Legend").replace(/\s+/g,"-")).attr("transform",B=>G===0?`translate(${N(B.dimension)-L/2}, 0)`:`translate(${N(B.dimension)-L/(2+G*2)}, 0)`);ee.attr("transform",B=>G===0?`translate(${N(B.dimension)-L/2}, 0)`:`translate(${N(B.dimension)-L/(2+G*2)}, 0)`),F.merge(ee).attr("transform",B=>G===0?`translate(${N(B.dimension)-L/2}, 0)`:`translate(${N(B.dimension)-L/(2+G*2)}, 0)`);const q=F.append("rect").attr("x",()=>0).attr("width",G===0?L:L/2+G*2).attr("y",B=>(_.properties.axis===Qe.primary?a:f)(0)).attr("height",0).attr("fill",B=>Me.get(_.properties.legendUniqueId)?.(B.value)??_.properties.color).attr("stroke-dasharray",()=>_.properties.stackBorderStyle==2?"5,3":"0").attr("stroke-width",`${_.properties.stackBorderWidth}px`).attr("stroke",()=>_.properties.stackBorderStyle==0?"none":e.column.stackBorderVisibility?_.properties.stackBorderColor:"none").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("opacity",.7).attr("visibility",B=>B.value===0&&e.xAxisLabel.hideZeroValues?"hidden":"visible").attr(lt.SeriesId,()=>_.properties.legendUniqueId).attr(lt.DimValue,B=>Array.isArray(B.dimension)?String(B.dimension[0]):String(B.dimension));(e.animation.animationEnabled?q.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):q).attr("y",B=>{const V=_.properties.axis===Qe.primary?a:f;return B.value>0?V(B.value):V(0)}).attr("height",B=>{const V=_.properties.axis===Qe.primary?a:f;return Math.abs(V(B.value)-V(0))}),ee.select("rect").transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("y",B=>{const V=_.properties.axis===Qe.primary?a:f;return B.value>0?V(B.value):V(0)}).attr("height",B=>{const V=_.properties.axis===Qe.primary?a:f;return Math.abs(V(B.value)-V(0))}),F.merge(ee).on("mousemove",(B,V)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:ve.formattedDimensionListMap.get(Array.isArray(V.dimension)?V.dimension[0]:V.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():V.properties?.currentMeasure?V.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||V.value,value:Xe([le.NormalizedStackLineChart,le.NormalizedStackAreaChart,""].includes(u)?V[1]-V[0]:V.value,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:V.properties.alias}],e,B,V.properties,(()=>{const C=Array.isArray(V.dimension)?V.dimension[0]:V.dimension;return At(p,String(C??""),{...V.properties,formattedDimensionValue:String(ve.formattedDimensionListMap.get(C)??C??"")})})());let P=(_.properties.alias||_.properties.name||"Legend").replace(/ /g,"-");v.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!0),v.selectAll('[hoverId="'+P+'"]').classed("highlight",!0).classed("unhighlight",!1)}).on("mouseout",(B,V)=>{let P=(_.properties.alias||_.properties.name||"Legend").replace(/ /g,"-");v.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!1),v.selectAll('[hoverId="'+P+'"]').classed("highlight",!1).classed("unhighlight",!1),ot()}),F.merge(ee).on("click",vt(W,g,(B,V)=>({seriesId:_.properties.legendUniqueId,dimValue:Array.isArray(V.dimension)?String(V.dimension[0]):String(V.dimension),legendUniqueId:_.properties.legendUniqueId,seriesDisplayName:_.properties.alias||_.properties.name||""}))),ee.exit().remove()}),T.selectAll(".parentGroup").raise()},oe=ae=>{M=k-ae.left-ae.right,h=s-ae.bottom-ae.top},$=()=>{be(),ke(),ta(T,ve,K,e,i,a,fe,te,s,L,t,M,h,Re,N),Se(Te),$a(A,N,a,void 0,w,pt,[],[],e,u,s,k,M,Re,h,m,y,x,void 0,L,o),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,y,T,d,L,a,N,void 0,void 0,void 0,i,le.ColumnChart,e,z,ye,ve.dimensionList,M,ne,ve.formattedDimensionListMap,m,w,h))},R=(ae,_,G)=>{Te=_,Re=ae,Ee=G,$()};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},dr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID();let L=0,u=!1;const S=le.StackColumnChart,g=Ce.useRef(),W=Ce.useRef(c);W.current=c;const A=Ce.useRef(p);A.current=p;const E=n.DimensionList,b=(mt(n.ChartData,n.DimensionList)||[]).reverse(),U=!1,Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0;e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility&&parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText),e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility&&parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText);let D,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N;const ne=new Map;let Z,fe,Re,Te=[],Me=0,J,Ee=[],Le=[],Ue=new Map;const ve=!1;let Pe={dimensionList:E,chartType:S,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Ye()}catch(F){me("StackStackColumnchart","createStackColumnChart",F)}},[e]);const Ye=()=>{({formatOptions:e,svg:i,width:h,height:k}=Ft(g,e)),We(),{formatOptions:e,dataTableLegendsList:Ee}=ea(e,b,n.DataTableData??[]),{maxNumberForPrimaryAxis:he,maxNumberForSecondaryAxis:O}=Rt(e,Pe.yMinLeft,Pe.yMaxLeft,Pe.yMinRight,Pe.yMaxRight),{margin:D,yLabel:w,xLabel:z,yTitle:K,xTitle:ye,dimensionHeightWidthArray:se,chartTitleHeight:te,secondaryAxisTitleWidth:xe,legendMargin:ge,secondaryYLabel:pe,visibleBars:J,columnWidth:L,scrollbarVisible:u}=Mt(h,k,he,O,Pe.yMaxLeft,e,Pe.legendList,Pe.dimensionList,Pe.yMaxRight,Y,ve,t,!1,Pe,Ee),$(D),{dataTable:s,dataTableHeight:d}=ia(e,w,K,b,Pe.dimensionList,n),St(i,h,k,e),y=wt(i,D),kt(y,e,d,X,M,S,m),be(),ke(),Zt(y,e,d,w,Z,M),Dt(e,U,i,D,z,k,ye,Pe.chartType,w,X,M),Vt(M,e,d,U,i,D,K,w),Gt(i,Y,D,e,d,M,X,pe,xe),Nt(i,e,h,te),It(k,i,se,te,h,ge,e,[...b].reverse(),m,d,D,ct.rectangle,S,l),_t(b,k,h,i,D,X,u,J,Pe,Me,!1,R)},We=()=>{const F=[],q=[];let ue=-1/0,B=1/0;b.forEach((ie,we)=>{const de=`${we}~$~${ie.properties.legend}`;ie.properties.legend=de,q.push(de),ue=-1/0,B=1/0;for(const Ae of ie.data)ue=Math.max(ue,Ae.value),B=Math.min(B,Ae.value),F.push(Ae);ie.properties.setColorScale&&ne.set(ie.properties.legendUniqueId,v.scaleSequential().domain([B,ue]).interpolator(yi.interpolateRgb(ie.properties.startColor,ie.properties.endColor)))}),Pe.chartData=F,Pe.legendList=q,Te=JSON.parse(JSON.stringify(b));let V=Lt(Pe.dimensionList,b,ve);Re=Pe.dimensionList;const P=v.stack().keys(Pe.legendList).offset(v.stackOffsetDiverging)(V);_();let C=1/0,re=-1/0;for(const ie of P)for(const[we,de]of ie)C=Math.min(C,we),re=Math.max(re,de);Pe.yMinLeft=C>0?0:C,Pe.yMaxLeft=re;let j=t?Tt(e.xAxisLabel.xAxisNumberFormat,Pe.dimensionList).map(ie=>ie):Pe.dimensionList;Pe.dimensionList.forEach((ie,we)=>{Pe.formattedDimensionListMap.set(ie,j[we])}),e.plotArea.hideZeroValues&&(Pe.hideZeroValues=!0)},be=()=>{T=v.scaleLinear().domain([Pe.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:0:Pe.yMinLeft<0?Pe.yMinLeft*1.1:Pe.yMinLeft*.9,Pe.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:Pe.yMaxLeft*1.1]).range([d>0?M-d:M,0]),N=[0,X]},ze=()=>{f=v.scalePoint().domain(Re).range([0,X]).padding(.5)},ke=()=>{{const F=yt(I||Pe.yMaxLeft,Pe.yMinLeft,M,e,Pe,H,I);Z=v.axisLeft(T).tickFormat(q=>Xe(q,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,X)).tickValues(F.autoLabelFlag?void 0:F.yAxisLabelArray).ticks(F.customTickValue).tickPadding(8).tickSizeOuter(0)}},Se=()=>{fe=v.axisBottom(f).tickSize(sa(e,M,d,!0)).tickSizeOuter(0).tickValues(gt(Re,X,e))},oe=F=>{F.forEach(j=>{j.data.forEach(ie=>{ie.hideZero=j.properties.hideZeroValues,ie.axis=j.properties.axis})}),Re.forEach(j=>{y.append("rect").attr("id",`dim-background-${j}`).attr("class","dimension-background").attr("x",f(j)-f.step()/2).attr("width",f.step()).attr("y",0).attr("height",M).attr("fill","#E5E5E5").attr("visibility","hidden").lower()});let q=y.selectAll(".parentGroup").data([Le]);q=q.enter().append("g").attr("class","columns parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(q);let ue=q.selectAll(".column-group").data(j=>j);ue=ue.enter().append("g").attr("class",j=>"column-group "+j.key.replace(/ /g,"-")).attr("hoverId",j=>j[0]?.properties.alias?Xa(j[0]?.properties.alias):Xa(j.key)).merge(ue);let V=ue.selectAll("rect").data(j=>j);const P=(j,ie)=>{const we=Array.from(ue.nodes()).indexOf(j[ie].parentNode);return{props:b[we]?.properties,groupIndex:we}},C=V.enter().append("rect").merge(V).attr("x",j=>f(j.data.dimension)-L/2).attr("width",L).attr("y",j=>T(0)).attr("height",0).attr("fill",(j,ie,we)=>{const{props:de}=P(we,ie);return ne.get(de.legendUniqueId)?.(j.data[j.key])??de?.color??"gray"}).attr("stroke",(j,ie,we)=>{const{props:de}=P(we,ie);return de?.stackBorderStyle==0?"none":e.column.stackBorderVisibility?de.stackBorderColor:"none"}).attr("stroke-dasharray",(j,ie,we)=>{const{props:de}=P(we,ie);return de?.stackBorderStyle==2?"5,3":"0"}).attr("stroke-width",(j,ie,we)=>{const{props:de}=P(we,ie);return(de?.stackBorderWidth||0)+"px"}).style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",(j,ie,we)=>{const{props:de}=P(we,ie);return j.data[j.key]==0&&de?.hideZeroValues?"hidden":"visible"}).attr(lt.SeriesId,j=>j.key??"").attr(lt.DimValue,j=>Array.isArray(j.data.dimension)?String(j.data.dimension[0]):String(j.data.dimension)).on("mousemove",(j,ie)=>{const we=String(Pe.formattedDimensionListMap.get(ie.data.dimension)??ie.data.dimension??""),de=At(r,String(ie.data.dimension??""),{...ie.properties,formattedDimensionValue:we});ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:Pe.formattedDimensionListMap.get(ie.data.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():ie.properties?.currentMeasure?ie.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||ie.value,value:Xe(ie.data[ie.key],e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:ie.properties.alias}],e,j,ie.properties,de)}).on("mouseout",(j,ie)=>{ot()}).on("click",vt(A,W,(j,ie)=>({seriesId:ie.key??"",dimValue:Array.isArray(ie.data.dimension)?String(ie.data.dimension[0]):String(ie.data.dimension),legendUniqueId:ie.key??"",seriesDisplayName:ie.properties?.alias||ie.key||""})));(e.animation.animationEnabled?C.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):C).attr("y",j=>j[1]>=j[0]?T(j[1]):T(j[0])).attr("height",j=>Math.abs(T(j[0])-T(j[1]))),ue.exit().remove(),y.selectAll(".parentGroup").raise()},$=F=>{X=h-F.left-F.right,M=k-F.bottom-F.top},R=(F,q,ue)=>{Te=q,Re=F,J=ue,li(n,Ue,Re),ae()},ae=()=>{ze(),Se(),ta(y,Pe,z,e,d,T,fe,se,k,L,t,X,M,Re,f),_();const F=new Map;Re.forEach((q,ue)=>{let B=0;Le.forEach(V=>{const P=V[ue]?.[0]??0;P<B&&(B=P)}),F.set(q,B)}),oe(Te),Ya(Le,f,T,a,D,pt,[],[],e,S,k,h,X,Re,M,m,i,x,d,o),ii(Ue,f,T,D,pt,[],e,S,k,h,i,o,!1,F),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,i,y,s,L,T,f,void 0,void 0,void 0,d,S,e,w,K,Re,X,N,Pe.formattedDimensionListMap,m,D,M)),G()},_=()=>{let F=Lt(Re,Te,ve);Le=v.stack().keys(Pe.legendList).offset(v.stackOffsetDiverging)(F),Te.forEach((ue,B)=>ue.data.forEach((V,P)=>{V[0]=Le[B][P][0],V[1]=Le[B][P][1]}));let q=e.annotation.annotationSetLabelColor;Le.forEach((ue,B)=>ue.forEach(V=>{V.key=ue.key,ue.color=JSON.parse(JSON.stringify(b[B].properties.color)),V.data.labelPosition=b[B].properties.dataLabelPosition,V.data.labelColor=q=="2"?JSON.parse(JSON.stringify(b[B].properties.color)):b[B].properties.labelColor,V.hideZero=JSON.parse(JSON.stringify(b[B].properties.hideZeroValues)),V.properties=b[B].properties}))},G=()=>{try{const F=e?.connector,q=Number(F?.connectorVisibility);if(!F||q===2)return;let ue,B=[];q===1?ue=1:q===3&&(Number(F.connectorFollow)===1?ue=Number(F.connectorStepSize)||void 0:Number(F.connectorFollow)===2&&(B=F.connectorExclude??[],ue=1));const V=(B||[]).map(ie=>String(ie).split("-")[0]),P=(Le[0]??[]).map((ie,we)=>({Dimension:ie.data.dimension,Total:ie.data.total,CustomTotal:ie.data.total,Index:we})),C=[],re=[];let j=[];if(ue){if(ue===1)C.push(...P);else for(const ie of P)ie.Index%ue===0&&C.push(ie);for(let ie=ue;ie<P.length;ie+=ue){const we=Math.min(ie+ue,P.length);let de=P[ie]?.Total??Number.NEGATIVE_INFINITY;for(let Ae=ie;Ae<we;Ae++)P[Ae].Total>de&&(de=P[Ae].Total);Number.isFinite(de)&&re.push(de)}j=C.slice(1)}else{const ie=F.connectorCustomRange??[],we=new Map;P.forEach(de=>we.set(String(de.Dimension),de.Index));for(const de of ie){if(!de?.from||!de?.to)continue;const Ae=we.get(String(de.from)),De=we.get(String(de.to));if(Ae!=null&&De!=null){C.push(P[Ae]);const $e=Math.min(Ae,De),Fe=Math.max(Ae,De);let _e=P[$e]?.Total??Number.NEGATIVE_INFINITY;for(let it=$e;it<=Fe;it++)P[it].Total>_e&&(_e=P[it].Total);Number.isFinite(_e)&&re.push(_e)}}for(const de of ie){if(!de?.from||!de?.to)continue;const Ae=we.get(String(de.to));Ae!=null&&j.push(P[Ae])}}y.selectAll("defs > #arrow").remove(),y.append("defs").append("marker").attr("id","arrow").attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerWidth",10).attr("markerHeight",7).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("fill",F.connectorMarkerColor!==Ie.white?F.connectorMarkerColor:"none"),Q(C,re,j,ue,V),ee(C,re,j,ue,V)}catch{}},Q=(F,q,ue,B,V)=>{try{const P=F.filter((ie,we)=>B!=null?we<F.length-1:we<F.length);let C=y.selectAll("path.connector-path").data(P,ie=>String(ie.Dimension));C.exit().remove(),C.enter().append("path").attr("class","connector-path").style("shape-rendering","crispEdges").attr("fill","none").attr("marker-end","url(#arrow)").merge(C).attr("d",(ie,we)=>e.total.totalVisibility?`M ${f(ie.Dimension)+f.bandwidth()/2+5}, ${T(ie.Total)-25} V ${-35+Math.min(T(q[we]),T(ue[we].Total),T(ie.Total))} H ${f(ue[we].Dimension)+f.bandwidth()/2-10} V ${-27+T(ue[we].Total)}`:`M ${f(ie.Dimension)+f.bandwidth()/2+5}, ${T(ie.Total)-5} V ${-30+Math.min(T(ue[we].Total),T(ie.Total))} H ${f(ue[we].Dimension)+f.bandwidth()/2-10} V ${-10+T(ue[we].Total)}`).style("stroke",e.connector.connectorLineColor!==Ie.white?e.connector.connectorLineColor:"none").attr("stroke-width",e.connector.connectorLineThickness).style("visibility",ie=>V.includes(ie.Dimension)||ie.Total==0&&e.xAxisLabel.hideZeroValues?"hidden":"visible")}catch{}},ee=(F,q,ue,B,V)=>{try{let P,C=e.connector.connectorFontStyle,re=e.connector.connectorNumberFormat,j=X/30;(e.connector.connectorKPI=="2"||e.connector.connectorKPI=="3")&&(re=".2s");const ie=isNaN(parseFloat(e?.plotArea?.plotAreaGapWidth??"0"))?0:parseFloat(e.plotArea.plotAreaGapWidth)/100,we=Di(ie,L),de=we*(typeof f.padding=="function"?f.padding():0),Ae=F.map((_e,it)=>({d:_e,i:it})).filter(_e=>B!=null?_e.i<F.length-1:_e.i<F.length);let De=y.selectAll("text.connector-text").data(Ae,_e=>String(_e.d.Dimension));De.exit().remove(),De.enter().append("text").attr("class","connector-text").attr("text-anchor","middle").merge(De).attr("x",_e=>{const it=_e.d,nt=_e.i,Ba=ue[nt];return f(Ba.Dimension)-we*B/2}).attr("y",_e=>{const it=_e.d,nt=_e.i,Ba=q[nt],di=ue[nt],Ia=Math.min(T(di?.Total??0),T(it.Total));return e.total.totalVisibility?j<8?-40+Ia:-41+Ia:j<8?-35+Ia:-40+Ia}).style("text-anchor","middle").text(_e=>{const it=_e.d,nt=_e.i;return ue[nt]?(it.CustomTotal==0&&ue[nt].CustomTotal!=0&&(it.CustomTotal=1),fi(ue[nt].Total,it.Total,parseInt(e.connector.connectorDecimalPrecision),re,parseInt(it.Dimension),parseInt(ue[nt].Dimension),e)):""}).style("font-size",e.connector.connectorFontSize).style("font-family",e.connector.connectorFontFamily).style("font-style",e.connector.connectorFontStyle).style("fill",e.connector.connectorFontColor!==Ie.white?e.connector.connectorFontColor:"none").style("font-weight","lighter").style("font-style",C.includes("Italic")?"Italic":"").style("text-decoration",C.includes("Underline")?"Underline":"").style("font-weight",C.includes("Bold")?"Bold":"").style("visibility",_e=>{const it=_e.d;return V.includes(it.Dimension)||it.Total==0&&e.xAxisLabel.hideZeroValues?"hidden":"visible"}).raise()}catch{}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:g,id:m,style:{width:"100%",height:"100%"}})})},yr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID();let L=0;const u=le.NormalizedStackColumnChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList).reverse(),E=n.DimensionList,b=!1,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I,D,w,z,K,ye,se,te,xe,ge,pe,he,O=!1,X,M,h,k,s,d,i,y,T,a,f,N;const ne=new Map;let Z,fe,Re,Te=[],Me=0,J=0,Ee=[],Le=[];const Ue=!0;let ve={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Pe()}catch(_){me("StackNormalizedStackColumnChart","createNormalizedStackColumnChart",_)}},[e]);const Pe=()=>{({formatOptions:e,svg:i,width:h,height:k}=Ft(S,e)),Ye(),{formatOptions:e,dataTableLegendsList:Ee}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:pe,maxNumberForSecondaryAxis:he}=Rt(e,ve.yMinLeft,ve.yMaxLeft,ve.yMinRight,ve.yMaxRight),{margin:I,yLabel:D,xLabel:w,yTitle:z,xTitle:K,dimensionHeightWidthArray:ye,chartTitleHeight:se,secondaryAxisTitleWidth:te,legendMargin:xe,secondaryYLabel:ge,visibleBars:J,columnWidth:L,scrollbarVisible:O}=Mt(h,k,pe,he,ve.yMaxLeft,e,ve.legendList,ve.dimensionList,ve.yMaxRight,U,Ue,t,!1,ve,Ee),oe(I),{dataTable:s,dataTableHeight:d}=ia(e,D,z,A,ve.dimensionList,n),St(i,h,k,e),y=wt(i,I),kt(y,e,d,X,M,u),We(),ze(),Zt(y,e,d,D,Z,M),Dt(e,b,i,I,w,k,K,ve.chartType,D,X,M),Vt(M,e,d,b,i,I,z,D),Gt(i,U,I,e,d,M,X,ge,te),Nt(i,e,h,se),It(k,i,ye,se,h,xe,e,[...A].reverse(),m,d,I,ct.rectangle,u,l),_t(A,k,h,i,I,X,O,J,ve,Me,!1,$)},Ye=()=>{const _=[],G=[];let Q=-1/0,ee=1/0;A.forEach((V,P)=>{const C=`${P}~$~${V.properties.legend}`;V.properties.legend=C,G.push(C),Q=-1/0,ee=1/0;for(const re of V.data)Q=Math.max(Q,re.value),ee=Math.min(ee,re.value),_.push(re);V.properties.setColorScale&&ne.set(V.properties.legendUniqueId,v.scaleSequential().domain([ee,Q]).interpolator(v.interpolateRgb(V.properties.startColor,V.properties.endColor)))}),ve.chartData=_,ve.legendList=G,Te=JSON.parse(JSON.stringify(A));let F=Lt(ve.dimensionList,A,Ue);Re=ve.dimensionList;const q=v.stack().keys(ve.legendList).offset(v.stackOffsetDiverging)(F);ae();let ue=1/0;for(const V of q)for(const[P]of V)ue=Math.min(ue,P);ve.yMinLeft=ue>0?0:ue,ve.yMaxLeft=1;let B=t?Tt(e.xAxisLabel.xAxisNumberFormat,ve.dimensionList).map(V=>V):ve.dimensionList;ve.dimensionList.forEach((V,P)=>{ve.formattedDimensionListMap.set(V,B[P])}),e.plotArea.hideZeroValues&&(ve.hideZeroValues=!0)},We=()=>{let _=yt(H||ve.yMaxLeft,ve.yMinLeft,M,e,ve,Y,H).yAxisLabelArray;if(ve.yMaxLeft=_[_.length-1],ve.yMinLeft=_[0],T=v.scaleLinear().domain([ve.yMinLeft<0?-1:0,1]).range([d>0?M-d:M,0]),N=[0,X],e.seriesLabel.seriesLabelVisibility){let G=la(X,T,e,Te,void 0,U,M,!0);G.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&G.heightWidth[0],e.seriesLabel.seriesLabelPosition=="Right"?N=[0,X-G.heightWidth[0]]:N=[G.heightWidth[0],X]}},be=()=>{f=v.scalePoint().domain(Re).range(N).padding(.5)},ze=()=>{{const _=e.yAxisLabel.yAxisTicksMode===wa.custom,G=parseInt(e.yAxisLabel.yAxisLabelDecimalPrecision)||0;Z=v.axisLeft(T).tickFormat(v.format(`.${G}%`)).tickSize(zt(e,X)).tickValues(_?za(ve.yMinLeft<0?-1:0,1,e.yAxisLabel.yAxisTicksCount):null).ticks(d>0?(M-d)/80:M/80).tickPadding(8).tickSizeOuter(0)}},ke=()=>{fe=v.axisBottom(f).tickSize(sa(e,M,d,!0)).tickSizeOuter(0).tickValues(gt(Re,X,e))},Se=_=>{Le.forEach((P,C)=>P.forEach((re,j)=>{_[C].data[j]&&_[C].data[j][0]!==void 0&&_[C].data[j][1]!==void 0&&(_[C].data[j][0]=re[0]=re.data.total===0?0:re[0]/re.data.total,_[C].data[j][1]=re[1]=re.data.total===0?0:re[1]/re.data.total)})),_.forEach(P=>{P.data.forEach(C=>{C.hideZero=P.properties.hideZeroValues,C.axis=P.properties.axis})}),Re.forEach(P=>{y.append("rect").attr("id",`dim-background-${P}`).attr("class","dimension-background").attr("x",f(P)-f.step()/2).attr("width",f.step()).attr("y",0).attr("height",M).attr("fill","#E5E5E5").attr("visibility","hidden").lower()});let G=y.selectAll(".parentGroup").data([Le]);G=G.enter().append("g").attr("class","columns parentGroup").merge(G);let Q=G.selectAll(".column-group").data(P=>P);Q=Q.enter().append("g").attr("class",P=>"column-group "+P.key.replace(/ /g,"-")).attr("hoverId",P=>(_[P.index].properties.alias||_[P.index].properties.name||"Legend").replace(/\s+/g,"-")).merge(Q);let F=Q.selectAll("rect").data(P=>P);const q=(P,C)=>{const re=Array.from(Q.nodes()).indexOf(P[C].parentNode);return{props:A[re]?.properties,groupIndex:re}},ue=F.enter().append("rect").attr("x",P=>f(P.data.dimension)-L/2).attr("width",L).attr("y",T(0)).attr("height",0).attr("fill",(P,C,re)=>{const{props:j}=q(re,C);return ne.get(j.legendUniqueId)?.(P.data[P.key])??j?.color??"gray"}).attr("stroke",(P,C,re)=>{const{props:j}=q(re,C);return j?.stackBorderStyle===0?"none":e.column.stackBorderVisibility?j.stackBorderColor:"none"}).attr("stroke-dasharray",(P,C,re)=>{const{props:j}=q(re,C);return j?.stackBorderStyle===2?"5,3":"0"}).attr("stroke-width",(P,C,re)=>{const{props:j}=q(re,C);return(j?.stackBorderWidth||0)+"px"}).style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",(P,C,re)=>{const{props:j}=q(re,C);return P.data[P.key]===0&&j?.hideZeroValues?"hidden":"visible"}).attr(lt.SeriesId,P=>P.key??"").attr(lt.DimValue,P=>Array.isArray(P.data.dimension)?String(P.data.dimension[0]):String(P.data.dimension)),B=e.animation.animationEnabled;(P=>B?P.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):P)(ue).attr("y",P=>P[1]>=P[0]?T(P[1]):T(P[0])).attr("height",P=>Math.abs(T(P[0])-T(P[1]))),ue.merge(F).on("mousemove",(P,C)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:ve.formattedDimensionListMap.get(C.data.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():C.properties?.currentMeasure?C.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||C.value,value:Xe(C[1]-C[0],e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:C.properties.alias}],e,P,C.properties,At(p,String(C.data.dimension??""),{...C.properties,formattedDimensionValue:String(ve.formattedDimensionListMap.get(C.data.dimension)??C.data.dimension??"")}))}).on("mouseout",(P,C)=>{ot()}).on("click",vt(W,g,(P,C)=>({seriesId:C.key??"",dimValue:Array.isArray(C.data.dimension)?String(C.data.dimension[0]):String(C.data.dimension),legendUniqueId:C.key??"",seriesDisplayName:C.properties?.alias||C.key||""}))),Q.exit().remove(),y.selectAll(".parentGroup").raise()},oe=_=>{X=h-_.left-_.right,M=k-_.bottom-_.top},$=(_,G,Q)=>{Te=G,Re=_,J=Q,R()},R=()=>{be(),ke(),ae(),ta(y,ve,w,e,d,T,fe,ye,k,L,t,X,M,Re,f),Se(Te),Ya(Le,f,T,a,I,pt,[],[],e,u,k,h,X,Re,M,m,i,x,d,o),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,i,y,s,f.bandwidth(),T,f,void 0,void 0,void 0,d,u,e,D,z,ve.dimensionList,X,N,ve.formattedDimensionListMap,m,I,M))},ae=()=>{let _=Lt(Re,Te,Ue);Le=v.stack().keys(ve.legendList).offset(v.stackOffsetDiverging)(_),Te.forEach((Q,ee)=>Q.data.forEach((F,q)=>{F[0]=Le[ee][q][0],F[1]=Le[ee][q][1]}));let G=e.annotation.annotationSetLabelColor;Le.forEach((Q,ee)=>Q.forEach(F=>{F.key=Q.key,Q.color=JSON.parse(JSON.stringify(A[ee].properties.color)),Q.individualAnnotationVisibility=JSON.parse(JSON.stringify(A[ee].properties.individualAnnotationVisibility)),F.data.labelPosition=A[ee].properties.dataLabelPosition,F.data.labelColor=G=="2"?JSON.parse(JSON.stringify(A[ee].properties.color)):A[ee].properties.labelColor,F.hideZero=JSON.parse(JSON.stringify(A[ee].properties.hideZeroValues)),F.properties=A[ee].properties}))};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},Ca="ChartsWithoutAxisFunctions.ts";function Oi(t,e,n){if(!e?.plotArea?.plotAreaRangeFilter?.enabled)return t;const{condition:o,minVal:x,maxVal:l}=e.plotArea.plotAreaRangeFilter;return t.filter(r=>{const c=n(r);switch(o){case"lt":return c<=l;case"gt":return c>=x;case"in":return c>=x&&c<=l;case"not-in":return c<x||c>l;default:return!0}})}function el(t,e,n,o,x,l){try{o.xAxisLabel.xAxisDateFormat=o.xAxisLabel.xAxisDateFormat=="DD-MM-YYYY"?",":o.xAxisLabel.xAxisDateFormat;let r={top:0,left:0,right:0,bottom:0},c=t*.15*.8,p=l[0],m=c<p+10?c:p+10,L=o.plotArea.numberOfBubbles?20:0;const u=Ke(o.xAxisLabel.xAxisDisplayUnits,o.xAxisLabel.xAxisNumberFormat,o.xAxisLabel.xAxisLabelDecimalPrecision??"2")(x).toString();let g=Pt(u,o.xAxisLabel.xAxisLabelFontSize,o.xAxisLabel.xAxisLabelFontFamily,o.xAxisLabel.xAxisLabelRotation)[3]+10,W=o.xAxisTitle.xAxisTitleVisibility?o.xAxisTitle.xAxisDynamicTitleText.length!==0?$t(o.xAxisTitle.xAxisTitleHTML,void 0,void 0).height:$t(o.xAxisTitle.xAxisTitleText,13,tt).height:0;W=W>e*.1?e*.1:W;let A=o.xAxisLabel.xAxisLabelVisibility?g:0,E=o.yAxisTitle.yAxisTitleVisibility?o.yAxisTitle.yAxisDynamicTitleText.length!==0?$t(o.yAxisTitle.yAxisTitleHTML,void 0,void 0).height:$t(o.yAxisTitle.yAxisTitleText,13,tt).height:0;E=E>t*.1?t*.1:E;let b=o.yAxisLabel.yAxisLabelVisibility?$t(Ke(o.yAxisLabel.yAxisDisplayUnits,o.yAxisLabel.yAxisNumberFormat,o.yAxisLabel.yAxisLabelDecimalPrecision??"2")(n).toString(),rt(o.yAxisLabel.yAxisLabelFontSize),o.yAxisLabel.yAxisLabelFontFamily,o.yAxisLabel.yAxisLabelRotation).width+10:0,U=o.chartTitle.chartTitleVisibility?o.chartTitle.dynamicTitleText.length!==0?$t(o.chartTitle.chartTitleHTML,void 0,void 0).height:$t(o.chartTitle.chartTitleText,16,tt).height:0;U=U>e*.1?e*.1:U;let Y=o.legends.legendPosition,H=o.legends.legendVisibility,I=!1;switch(H||(Y="None"),Y){case Je.none:r.top=U+5,r.bottom=W+A+5+L,r.right=15,r.left=E+b+5;break;case Je.top:r.top=40+U,r.bottom=W+A+5+L,r.right=15,r.left=E+b+5;break;case Je.right:r.right=m+35,r.top=U+5,r.bottom=W+A+5+L,r.left=E+b+5;break;case Je.bottom:r.bottom=40+A+W+L,r.top=U+5,r.right=15,r.left=E+b+5;break;case Je.left:r.left=m+E+b+33,r.top=U+5,r.bottom=W+A+5+L,r.right=15}o.xAxisLabel.xAxisPosition&&o.xAxisLabel.xAxisPosition=="1"&&(r.bottom=r.bottom-A,r.top=r.top+A);let D=o.chartPadding.paddingArrayLTRB;D&&(r.top+=D[1],r.bottom+=D[3],r.right+=D[2],r.left+=D[0]);let w=e-r.top-r.bottom,z=t-r.left-r.right;return{margins:r,yLabel:b,xLabel:A,yTitle:E,xTitle:W,chartTitleHeight:U,legendMargin:m,innerHeight:w,innerWidth:z}}catch(r){Ma(Ca,"marginCalculationForBubbleScatter",r)}}function tl(t,e,n){try{let o=parseFloat(t.yAxisLabel.yAxisIntervalText),x=parseFloat(t.yAxisLabel.yAxisMaxText),l=parseFloat(t.yAxisLabel.yAxisMinText);if(t.yAxisLabel.yAxisIntervalsVisibility){l=t.yAxisLabel.yAxisMinText!==""?parseFloat(t.yAxisLabel.yAxisMinText):e;let u=t.yAxisLabel.yAxisMaxText;x=u.length>0?parseFloat(u):n,x&&(n=x)}else x=n,l=e,o=void 0;let r=e?Ke(t.yAxisLabel.yAxisDisplayUnits,t.yAxisLabel.yAxisNumberFormat,t.yAxisLabel.yAxisLabelDecimalPrecision??"2")(e).toString().length:0,c=n?Ke(t.yAxisLabel.yAxisDisplayUnits,t.yAxisLabel.yAxisNumberFormat,t.yAxisLabel.yAxisLabelDecimalPrecision??"2")(n).toString().length:0,p=x?Ke(t.yAxisLabel.yAxisDisplayUnits,t.yAxisLabel.yAxisNumberFormat,t.yAxisLabel.yAxisLabelDecimalPrecision??"2")(x).toString().length:0,m=l?Ke(t.yAxisLabel.yAxisDisplayUnits,t.yAxisLabel.yAxisNumberFormat,t.yAxisLabel.yAxisLabelDecimalPrecision??"2")(l).toString().length:0,L=r<c?n:e;if(l){let u=m<c?n:l;L=L<u?u:L}if(x){let u=p>r?x:e;L=L<u?u:L}return x&&l&&(L=p>m?x:l),{longestMeasure:L,customYaxisIntervalValue:o,customYaxisMaxValue:x,customYaxisMinValue:l}}catch(o){Ma(Ca,"customYscaleLabelFormatting",o)}}function al(t,e,n){try{let o=parseFloat(t.xAxisLabel.xAxisIntervalText),x=parseFloat(t.xAxisLabel.xAxisMaxText),l=parseFloat(t.xAxisLabel.xAxisMinText);if(t.xAxisLabel.xAxisIntervalsVisibility){l=t.xAxisLabel.xAxisMinText!==""?parseFloat(t.xAxisLabel.xAxisMinText):e;let u=t.xAxisLabel.xAxisMaxText.toString();x=u.length>0?parseFloat(u):n,x&&(n=x)}else x=n,l=e,o=void 0;let r=e?Ke(t.xAxisLabel.xAxisDisplayUnits,t.xAxisLabel.xAxisNumberFormat,t.xAxisLabel.xAxisLabelDecimalPrecision??"2")(e).toString().length:0,c=n?Ke(t.xAxisLabel.xAxisDisplayUnits,t.xAxisLabel.xAxisNumberFormat,t.xAxisLabel.xAxisLabelDecimalPrecision??"2")(n).toString().length:0,p=x?Ke(t.xAxisLabel.xAxisDisplayUnits,t.xAxisLabel.xAxisNumberFormat,t.xAxisLabel.xAxisLabelDecimalPrecision??"2")(x).toString().length:0,m=l?Ke(t.xAxisLabel.xAxisDisplayUnits,t.xAxisLabel.xAxisNumberFormat,t.xAxisLabel.xAxisLabelDecimalPrecision??"2")(l).toString().length:0,L=r<c?n:e;if(l){let u=m<c?n:l;L=L<u?u:L}if(x){let u=p>r?x:e;L=L<u?u:L}return x&&l&&(L=p>m?x:l),{longestDimension:L,customXaxisIntervalValue:o,customXaxisMaxValue:x,customXaxisMinValue:l}}catch(o){Ma(Ca,"customXscaleLabelFormatting",o)}}function il(t,e,n,o,x,l,r,c,p,m,L){try{let u=t.xAxisLabel.xAxisPosition,S=!0,W=n.append("foreignObject").attr("visibility",e?t.yAxisTitle.yAxisTitleVisibility?"visible":"hidden":t.xAxisTitle.xAxisTitleVisibility?"visible":"hidden").attr("transform",!t.plotArea.fitChart&&S?`translate(${o.left},${o.top+L+(t?.xAxisLabel?.xAxisPosition=="1"?0:x)})`:!t.plotArea.fitChart&&!1?`translate(${o.left},${l-r-5})`:`translate(${o.left},${o.top+L+(S?t?.xAxisLabel?.xAxisPosition=="1"?0:x:c=="tornado"?x+5:p+5)})`).attr("class","xAxisTitle").attr("width",m).attr("height",r+"px").style("z-index","9999");t.xAxisTitle.xAxisDynamicTitleText.length!==0?W.append("xhtml:div").style("color","rgba(119,119,119)").attr("title",t.xAxisTitle.xAxisTitleText).style("white-space","pre").style("text-overflow","ellipsis").html(t.xAxisTitle.xAxisTitleHTML?t.xAxisTitle.xAxisTitleHTML:t.xAxisTitle.xAxisTitleText):W.append("xhtml:h3").style("white-space","pre").style("text-overflow","ellipsis").style("user-select","none").style("margin",0).style("padding",0).style("text-align","center").style("overflow","hidden").attr("class","xAxisTitle").style("padding-top","5px").style("text-anchor","middle").style("color","rgba(119,119,119)").style("font-size","12px").style("font-size",t.xAxisTitle.xAxisTitleFontSize).style("font-family",t.xAxisTitle.xAxisTitleFontFamily).style("font-style",t.xAxisTitle.xAxisTitleFontStyle).attr("title",t.xAxisTitle.xAxisTitleText!=="~$~Dimension"?t.xAxisTitle.xAxisTitleText:"").html(t.xAxisTitle.xAxisTitleText!=="~$~Dimension"?t.xAxisTitle.xAxisTitleText:"")}catch(u){Ma(Ca,"setXaxistitle",u)}}function ll(t,e,n,o,x,l,r,c){try{let p=n>0?t-n:t,m=x.append("foreignObject").attr("visibility",o?e.xAxisTitle.xAxisTitleVisibility?"visible":"hidden":e.yAxisTitle.yAxisTitleVisibility?"visible":"hidden").attr("x",`-${l.top+p}`).attr("y",l.left-r-c+5).attr("class","yAxisTitle").attr("transform","rotate(-90)").attr("width",p).attr("height",r+"px");return e.yAxisTitle.yAxisDynamicTitleText.length!==0?m.append("xhtml:div").style("color","rgba(119,119,119)").attr("title",e.yAxisTitle.yAxisTitleText).style("white-space","pre").style("text-overflow","ellipsis").html(e.yAxisTitle.yAxisTitleHTML?e.yAxisTitle.yAxisTitleHTML:e.yAxisTitle.yAxisTitleText):m.append("xhtml:h3").style("white-space","pre").style("text-overflow","ellipsis").style("user-select","none").style("margin",0).style("padding",0).style("text-align","center").style("overflow","hidden").attr("class","xAxisTitle").style("text-anchor","middle").style("color","rgba(119,119,119)").style("font-size","12px").style("font-size",e.yAxisTitle.yAxisTitleFontSize).style("font-family",e.yAxisTitle.yAxisTitleFontFamily).style("font-style",e.yAxisTitle.yAxisTitleFontStyle).attr("title",e.yAxisTitle.yAxisTitleText).html(e.yAxisTitle.yAxisTitleText),x}catch(p){Ma(Ca,"yAxistitle",p)}}function rl(t,e,n,o,x,l){try{let r=parseFloat(o.yAxisLabel.yAxisIntervalText),c=[],p;if(r&&r!==0&&r!==void 0){let m=x||x==0?x:e,L=l||l==0?l:t;m<0?p=Math.floor((L-m)/r):p=Math.floor(L/r);let u=18;(l||l==0)&&(t=l);let S=x||x==0?x:e<0?Math.round(e):0;if(c.push(S),p>100){let g="Tick count cannot exceed more than 100.";m<0?r=(L-S)/100:r=L/100}if(p=p<100?p:100,p>u)for(let g=0;g<parseInt(p)&&(S+=r,parseFloat(S.toFixed(5))<=t);g++)c.push(S);else for(let g=0;g<u&&(S+=r,S<=t);g++)c.push(S)}else if(o.yAxisLabel.yAxisTicksMode===wa.custom){let m=x||x==0?x:e;c=za(m,t,o.yAxisLabel.yAxisTicksCount),p=c.length}else p=n/60;return{yAxisLabelArray:c,customTickValue:p}}catch(r){Ma(Ca,"responsiveYaxisLabel",r)}}function Ti(t,e,n,o,x,l,r,c){try{let p=!0,m=parseFloat(o.xAxisLabel.xAxisIntervalText),L=[],u;if(m&&m!==0&&m!==void 0){let S=x||x==0?x:e,g=l||l==0?l:t;S<0?u=Math.floor((g-S)/m):u=Math.floor(g/m);let W=18;(l||l==0)&&(t=l);let A=x||x==0?x:e<0?Math.round(e):0;if(L.push(A),p=!1,u>100){let E="Tick count cannot exceed more than 100.";S<0?m=(g-A)/100:m=g/100}if(u=u<100?u:100,u>W)for(let E=0;E<parseInt(u)&&(A+=m,parseFloat(A.toFixed(5))<=t);E++)L.push(A);else for(let E=0;E<W&&(A+=m,A<=t);E++)L.push(A)}else if(o.xAxisLabel.xAxisTicksMode===wa.custom){let S=x||x==0?x:e,g=l||l==0?l:t;L=za(S,g,o.xAxisLabel.xAxisTicksCount),p=!1,u=L.length}else{const S=Ke(o.xAxisLabel.xAxisDisplayUnits,o.xAxisLabel.xAxisDateFormat,o.xAxisLabel.xAxisLabelDecimalPrecision??"2")(l||t).toString();let g=Pt(S,o.xAxisLabel.xAxisLabelFontSize,o.xAxisLabel.xAxisLabelFontFamily,0);L=Bi(x||e,l||t,c?r:n,g[0]),u=n/30}return{xAxisLabelArray:L,customTickValue:u,autoLabelFlag:p}}catch(p){Ma(Ca,"responsiveXaxisLabel",p)}}function nl(t,e,n,o,x,l){try{let r=e.yAxisLabel.yAxisLabelFontStyle;t.append("rect").attr("transform",`translate(${-o},0)`).attr("height",n>0?l-n:l).attr("width",o).attr("fill",e.yAxisLabel.yAxisLabelVisibility&&e.yAxisLabel.yAxisBackgroundColor?e.yAxisLabel.yAxisBackgroundColor!==Ie.white?e.yAxisLabel.yAxisBackgroundColor:"none":e.chartArea.chartAreaColor);const c=t.append("g").call(x);c.selectAll("line").style("shape-rendering","crispEdges").attr("stroke",e.plotArea.gridLinesColor).attr("stroke-width","0.05em"),c.selectAll("text").style("fill",e.yAxisLabel.yAxisLabelColor!==Ie.white?e.yAxisLabel.yAxisLabelColor:"none").style("user-select","none").style("font-size",e.yAxisLabel.yAxisLabelFontSize).style("font-family",e.yAxisLabel.yAxisLabelFontFamily).style("font-style",e.yAxisLabel.yAxisLabelFontStyle).style("font-style",r.includes(ce.italic)?ce.italic:"").style("text-decoration",r.includes(ce.underline)?ce.underline:"").style("font-weight",r.includes(ce.bold)?ce.bold:"").attr("visibility",e.yAxisLabel.yAxisLabelVisibility?"visible":"hidden"),c.select(".domain").style("shape-rendering","crispEdges").style("stroke",e.yAxisLabel.yAxisColor).attr("stroke-width",e.yAxisLabel.yAxisWidth?e.yAxisLabel.yAxisWidth:e.plotArea.plotAreaBorderThickness)}catch(r){Ma(Ca,"initYaxis",r)}}function sl(t,e,n,o,x,l,r,c,p){try{let m=e.xAxisLabel.xAxisLabelFontStyle,L=e.xAxisLabel.xAxisPosition,u=e.xAxisLabel.xAxisLabelRotation;u=parseInt(u),t.append("rect").attr("transform",`translate(1,${L==="0"?n>0?l-n:l:L==="1"?-o:p(0)})`).attr("height",o).attr("width",r).attr("fill",e.xAxisLabel.xAxisLabelVisibility&&e.xAxisLabel.xAxisBackgroundColor?e.xAxisLabel.xAxisBackgroundColor!==Ie.white?e.xAxisLabel.xAxisBackgroundColor:"none":e.chartArea.chartAreaColor);const S=t.append("g").attr("transform",`translate(0,${L==="0"?l:L==="1"?0:p(0)})`).call(x);let g=L==="1"?"5":"0";S.selectAll("g").append("foreignObject").attr("class","testingoverflowing").style("width",Math.round(o)).style("height","20px").attr("transform",(A,E)=>`rotate(${L==="1"?-u:u!=0?180-u:0}) translate (${u!=0?g+", -5":-o/2+" , "+(L==="1"?"-15":"8")})`).append("xhtml:h3").style("transform",L==="1"?"":u!=0?"rotate(180deg)":"0").style("white-space","pre").style("text-overflow","ellipsis").style("text-align",u!=0?"start":"center").style("user-select","none").style("margin",0).style("padding",0).style("overflow","hidden").style("font-family",e.xAxisLabel.xAxisLabelFontFamily).style("color",e.xAxisLabel.xAxisLabelColor).style("font-size",e.xAxisLabel.xAxisLabelFontSize+"px").style("font-style",m.includes(ce.italic)?ce.italic:"").style("text-decoration",m.includes(ce.underline)?ce.underline:"").style("font-weight",m.includes(ce.bold)?ce.bold:"").style("visibility",e.xAxisLabel.xAxisLabelVisibility?"visible":"hidden").attr("title",(A,E)=>Ke(e.xAxisLabel.xAxisDisplayUnits,e.xAxisLabel.xAxisNumberFormat,e.xAxisLabel.xAxisLabelDecimalPrecision)(A)).html((A,E)=>Ke(e.xAxisLabel.xAxisDisplayUnits,e.xAxisLabel.xAxisNumberFormat,e.xAxisLabel.xAxisLabelDecimalPrecision)(A)),S.selectAll("text").style("visibility",(e.xAxisLabel.xAxisLabelVisibility,"hidden")),S.selectAll("line").style("stroke",e.plotArea.gridLinesColor).style("shape-rendering","crispEdges").attr("visibility",e.xAxisLabel.xAxisLabelVisibility||e.plotArea.gridLinesVertical?"visible":"hidden"),S.select(".domain").style("stroke",e.xAxisLabel.xAxisColor).attr("stroke-width",e.xAxisLabel.xAxisWidth?e.xAxisLabel.xAxisWidth:e.plotArea.plotAreaBorderThickness).style("shape-rendering","crispEdges")}catch(m){Ma(Ca,"initXaxis",m)}}function ol(t,e,n,o,x,l,r,c,p,m,L){try{if(!n.annotation.annotationVisibility)return;const u=n.plotArea.annotationType??"1",S=[u==="1"?"connector":""],g=n.plotArea.connectorType?.toLowerCase()??"none",W=u==="5",A=n.plotArea.rotation??0,E=x===le.PieChart?1.06:1.1,b={1:"",2:v.curveLinear,3:v.curveStep},U=(O,X)=>[[0,0],[O/2,X/2],[O,X]],Y={solid:"unset",dotted:"2,2",dashed:"6,4"};let H=t.annotation(),I=JSON.parse(JSON.stringify(n.plotArea.dataLabelsCoordinates||[]));I=I.map(O=>({dx:O.dx??0,dy:O.dy??0,ratioDistance:O.ratioDistance,ratioAngle:O.ratioAngle,connectorPoints:O.connectorPoints||O.connector?.points||[],radius:O.radius??p,data:O.data,width:l,height:r}));const D=e.reduce((O,X)=>O+(X?.data?.data?.[0]?.value??0),0),w=D===0?1:D,z=(O,X)=>{const M=O.data.data[0].value,h=(O.x0+O.x1)/2,k=O.x1-O.x0;return{note:{title:n.plotArea.dataLabelName?O.data.legend:"",label:n.plotArea.dataLabelValue&&M!==0?n.plotArea.dataLabelNumberFormat===",.0%"?(Math.abs(M/w)*100).toFixed(rt(n.plotArea.dataLabelDecimalPrecision))+"%":Ke(n.plotArea.plotAreaDisplayUnits,n.plotArea.dataLabelNumberFormat,n.plotArea.dataLabelDecimalPrecision)(M):"",align:"middle",wrap:1e3},data:{x:{legend:O.data.legend},y:{value:M},midAngle:h,isVisible:!0,hoverId:O?.data?.legend?.replace(/\s+/g,"-")??""},legendUniqueId:O.data.legend,dx:0,dy:0,connector:{end:g,curve:b[n.plotArea.connectorCurve],points:W?U(0,0):[[0,0],[0,0]]},disable:S,subject:{radius:3},type:ur(t,u),color:n.plotArea.connectorColor??"#ccc",width:l,height:r,index:X}};let K=e.filter(O=>O.x1-O.x0>1e-4).map(z);const ye=O=>(O.data.y?.value??0)!==0;K=K.filter(ye),K=Ut(K,n,O=>O.data.y.value);let se=new Map(I.map(O=>[O.data?.x?.legend,O])),te=[];K.forEach(O=>{const X=O.data.x.legend,M=se.get(X);if(M){if(M.ratioDistance!=null&&M.ratioAngle!=null){const h=M.ratioDistance*p;O.dx=Math.cos(M.ratioAngle)*h,O.dy=Math.sin(M.ratioAngle)*h}else{const h=p/(M.radius||p);O.dx=M.dx*h,O.dy=M.dy*h}O.data.isVisible=M.data?.isVisible??!0,M.connectorPoints?.length>=(W?3:2)?O.connector.points=M.connectorPoints:O.connector.points=W?U(O.dx,O.dy):[[0,0],[0,0]]}te.push(O)}),H.editMode(n.plotArea.annotationDraggable&&m).accessors({x(O){return Math.cos(O.midAngle-Math.PI/2)*(p-p*.35)},y(O){return Math.sin(O.midAngle-Math.PI/2)*(p-p*.35)}}).on("dragend",function(O){te.forEach(M=>{if(M.data.x.legend===O.data.x.legend){const h=O._dx,k=O._dy,s=Math.sqrt(h*h+k*k),d=Math.atan2(k,h);M.dx=h,M.dy=k,M.ratioDistance=s/p,M.ratioAngle=d,M.width=l,M.height=r,M.connectorPoints=O.connector?.points||[]}});const X=te.map(M=>({data:{x:M.data.x,isVisible:M.data.isVisible??!0},dx:M.dx,dy:M.dy,ratioDistance:M.ratioDistance,ratioAngle:M.ratioAngle,connectorPoints:M.connectorPoints||[],width:l,height:r,radius:p}));L&&L(X)}).annotations(te);const xe=c.append("g").attr("class","annotation-group parentGroup").attr("transform",o).call(H),ge=n.plotArea.dataLabelNameFontStyle??[];xe.selectAll(".annotation-note-title").style("font-family",n.plotArea.dataLabelNameFontFamily).style("font-size",`${n.plotArea.dataLabelNameFontSize}px`).style("font-style",ge.includes("Italic")?"italic":"").style("text-decoration",ge.includes("Underline")?"underline":"").style("font-weight",ge.includes("Bold")?"bold":"").style("fill",n.plotArea.dataLabelNameColor??"#000");const pe=n.plotArea.dataLabelValueFontStyle??[];if(xe.selectAll(".annotation-note-label").style("font-family",n.plotArea.dataLabelValueFontFamily).style("font-size",`${n.plotArea.dataLabelValueFontSize}px`).style("font-style",pe.includes("Italic")?"italic":"").style("text-decoration",pe.includes("Underline")?"underline":"").style("font-weight",pe.includes("Bold")?"bold":"").style("fill",n.plotArea.dataLabelValueColor??"#000"),n.plotArea.plotAreaAbsoluteValue&&xe.selectAll(".annotation-note-label").each(function(O){const X=v.select(this),M=v.format(".2s")(Math.abs(O.data.y.value));X.append("tspan").attr("x",X.attr("x")??"0").attr("dy","1.2em").attr("fill-opacity",.5).attr("font-weight","300").style("font-family",n.plotArea.dataLabelValueFontFamily).style("font-size",`${n.plotArea.dataLabelValueFontSize}px`).style("fill",n.plotArea.dataLabelValueColor??"#000").text(M)}),g==="diamond"){const O=n.plotArea.connectorColor??"#ccc",X=5;xe.selectAll(".annotation-connector").each(function(){v.select(this).select("path.connector").empty()||v.select(this).append("polygon").attr("class","connector-end connector-diamond").attr("points",`0,${-X} ${X},0 0,${X} ${-X},0`).style("fill",O).style("stroke",O)})}if(xe.selectAll("rect,.annotation-subject").remove(),n.animation?.animationEnabled){const O=n.animation.animationDuration,X=et[n.animation.animationEffect],M=xe.selectAll(".annotation-note-label");M.interrupt().style("opacity",0),setTimeout(()=>{M.transition().delay((h,k)=>k*30).duration(O).ease(X).style("opacity",1)},50)}const he=n.plotArea.connectorColor??"#ccc";xe.selectAll(".connector").style("stroke",he).attr("hoverId",O=>O.data.hoverId).attr("stroke-dasharray",Y[n.plotArea.connectorStyle?.toLowerCase()]),xe.selectAll(".connector-end").attr("hoverId",O=>O.data.hoverId).style("fill",he).style("stroke",he),xe.selectAll(".annotation-note-title").attr("hoverId",O=>O.data.hoverId),xe.selectAll(".annotation-note-label").attr("hoverId",O=>O.data.hoverId).filter(O=>!O.data.isVisible).style("display","none"),xe.selectAll(".annotation-note-label").filter(O=>n.plotArea.hideInsignificantValue&&O.data.x1-O.data.x0<.09).style("visibility","hidden")}catch(u){throw u}}const ur=(t,e)=>{try{return{1:t.annotationLabel,2:t.annotationLabel,3:t.annotationCallout,4:t.annotationCalloutElbow,5:t.annotationCalloutCurve}[e]}catch(n){throw n}},cl=(t,e,n,o,x,l,r,c,p,m)=>{try{if(n.plotArea.numberOfBubbles){let L=e=="Bottom"?o-55:o-25;t.append("foreignObject").attr("transform",`translate(${l.left},${L})`).attr("width",x).attr("height","20px").append("xhtml:div").style("white-space","pre").style("color",Ie.black).style("font-size","12px ").style("text-overflow","ellipsis").html((n.plotArea.totalAlias?n.plotArea.totalAliasText:"Total count : ")+m)}}catch(L){Ma(Ca,"setnumberOfBubbles",L)}};function Ma(t,e,n){console.error(`[${t}] [${e}]`,n)}const xr=({isDateType:t,formatOptions:e,data:n})=>{const o=crypto.randomUUID(),x=0,l=le.ColumnHistogramChart,r=Ce.useRef(),c=n.ChartData,p=n.DimensionList,m=!1,L=!1,u=!1;let S=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,g=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,W=e.xAxisLabel.xAxisIntervalsVisibility?parseFloat(e.xAxisLabel.xAxisMinText):void 0,A=e.xAxisLabel.xAxisIntervalsVisibility?parseFloat(e.xAxisLabel.xAxisMaxText):void 0,E,b,U,Y,H,I,D,w,z,K,ye,se,te,xe,ge,pe=[],he=[],O,X,M,h,k,s,d,i,y,T,a,f,N,ne=[],Z=0;const fe=2;let Re=[],Te={dimensionList:p,chartType:l,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Me()}catch(ke){me("Columnchart","createColumnChart",ke)}},[e]);const Me=()=>{({formatOptions:e,svg:k,width:O,height:X}=Ft(r,e)),{formatOptions:e,dataTableLegendsList:Re}=ea(e,c,n.DataTableData??[]),J(),{maxNumberForPrimaryAxis:ye,maxNumberForSecondaryAxis:se}=Rt(e,Te.yMinLeft,Te.yMaxLeft,Te.yMinRight,Te.yMaxRight),{margin:E,yLabel:b,xLabel:U,yTitle:Y,xTitle:H,dimensionHeightWidthArray:I,chartTitleHeight:D,secondaryAxisTitleWidth:w,legendMargin:z,secondaryYLabel:K}=Mt(O,X,ye,se,Te.yMaxLeft,e,Te.legendList,Te.dimensionList,Te.yMaxRight,L,u,t,m,Te,Re),We(E),{dataTable:M,dataTableHeight:h}=ia(e,b,Y,c,Te.dimensionList),St(k,O,X,e),s=wt(k,E),kt(s,e,h,te,xe,l),Ee(),Ue(),ve(),Zt(s,e,h,b,a,xe),be(c,X,k,E,te),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,k,s,M,x,d,i,y,void 0,void 0,h,l,e,b,Y,Te.dimensionList,te,T,Te.formattedDimensionListMap,o,E,xe)),Dt(e,m,k,E,U,X,H,Te.chartType,b,te,xe),Vt(xe,e,h,m,k,E,Y,b),Gt(k,L,E,e,h,xe,te,K,w),Nt(k,e,O,D),It(X,k,I,D,O,z,e,c,o,h,E,ct.rectangle)},J=()=>{const ke=[],Se=[];let oe=[],$=-1/0,R=1/0;c.forEach(G=>{Se.push(G.legend),G.data.forEach(Q=>{ke.push(Q),$=Math.max($,Q.value),R=Math.min(R,Q.value)})}),Te.chartData=ke,Te.legendList=Se,Te.yMaxLeft=$,Te.yMinLeft=R>0?0:R,ne=JSON.parse(JSON.stringify(c)),ne.forEach(G=>G.data.forEach(Q=>oe.push(Q.value)));let ae=S||S==0?S:0,_=g||g==0?g:ne[0]?.data?.length;if(Te.yMaxLeft=parseFloat((ae+"").length>(_+"").length?ae+"":_+""),Te.xMax=v.max(oe),Te.xMin=v.min(oe),Te.xMin===Te.xMax){const G=Te.xMax===0?1:Math.abs(Te.xMax*.1);Te.xMin-=G,Te.xMax+=G}},Ee=()=>{switch(e.bins.binsCalculation){case"Automatic":ge=te/50;break;case"Number of Bins":Le(!1);break;case"Bin Width":Le(!0)}},Le=ke=>{ne.forEach(R=>R.data.sort(function(ae,_){return ae.value-_.value}));let Se=Te.xMax-Te.xMin,oe;ke?(parseFloat(e.bins.binsCalculationValue)<=2&&(e.bins.binsCalculationValue="3"),oe=Se/parseFloat(e.bins.binsCalculationValue)):(parseFloat(e.bins.binsCalculationValue)<=1&&(e.bins.binsCalculationValue="1"),oe=Se/parseFloat(e.bins.binsCalculationValue));let $=Te.xMin;if(ke)for(pe=[$];$<Te.xMax;)$+=oe,pe.push($);else for(pe=[$];Math.round($)<Math.round(Te.xMax);)$+=oe,pe.push(Math.round($))},Ue=()=>{i=v.scaleLinear().domain([Te.xMin,Te.xMax]).range([0,te]);const ke=pe.length>0?pe:i.ticks(ge);let Se=v.bin().value($=>$).domain(i.domain()).thresholds(ke);ne.forEach($=>{let R=Se($.data.map(ae=>ae.value));he.push(R)}),ne.forEach(($,R)=>he[R].forEach(ae=>{ae.name=$.properties.legend,ae.color=$.properties.color,ae.opacity=$.properties.opacity}));let oe=[];he.forEach($=>$.forEach(R=>oe.push(R.length))),Te.yMaxLeft=v.max(oe),Te.yMinLeft=v.min(oe),d=v.scaleLinear().range([xe,0]).domain([S||S==0?S:0,g||g==0?g:Te.yMaxLeft+.2*Te.yMaxLeft])},ve=()=>{Pe();{let ke=yt(Te.yMaxLeft,Te.yMinLeft,xe,e,Te,S,g,!1,te);a=v.axisLeft(d).tickFormat(Se=>Xe(Se,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,te)).tickValues(ke.autoLabelFlag?void 0:ke.yAxisLabelArray).ticks(ke.customTickValue).tickPadding(8).tickSizeOuter(0)}},Pe=()=>{let ke=parseInt(e.xAxisLabel.xAxisPosition);Ti(Te.xMax,Te.xMin,te,e,W,A,xe,!1).xAxisLabelArray.shift(),f=(ke==1?v.axisTop(i):v.axisBottom(i)).tickFormat(oe=>Xe(oe,e.xAxisLabel.xAxisDisplayUnits,e.xAxisLabel.xAxisNumberFormat,e.xAxisLabel.xAxisLabelDecimalPrecision,!1)).tickSize(sa(e,xe,h)).tickSizeOuter(0),e.bins.binsCalculation==="Automatic"?f.ticks(ge):f.tickValues(pe).ticks(te/50)},Ye=ke=>{const Se=e.animation.animationEnabled,oe=s.append("g").attr("class","parentGroup").selectAll("#scaling-svg"+o+" .rect").data(he).enter().append("g").selectAll("rect").data(R=>R).enter().append("rect").attr("class","rect").attr("stroke",e.bins.binsBorderVisibility&&e.bins.binsBorderColor).attr("stroke-width",e.bins.binsBorderVisibility&&e.bins.binsBorderThickness).attr("stroke-opacity",e.bins.binsBorderVisibility&&e.bins.binsBorderOpacity).attr("x",1).attr("transform",function(R){return"translate("+i(R.x0)+","+xe+")"}).attr("width",function(R){return i(R.x1)-i(R.x0)-parseFloat(e.bins.binsGapWidth)<0?0:i(R.x1)-i(R.x0)-parseFloat(e.bins.binsGapWidth)}).attr("height",0).style("fill",R=>R.color!==Ie.white?R.color:"none").style("opacity",e.bins.binsFillOpacity).style("shape-rendering","crispEdges").on("mousemove",(R,ae)=>{ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:`${ae.x0}-${ae.x1}`},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():ae.properties?.currentMeasure?ae.properties.currentMeasure:e.yAxisTitle.yAxisTitleText,value:Xe(e.toolTip.toolTipNumberFormat==",.0%"?Math.abs(ae.length/ne[0].data.length):ae.length,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision,!1)}],e,R)}).on("mouseout",ot);(Se?oe.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):oe).attr("transform",function(R){return"translate("+i(R.x0)+","+(d(R.length)>0?d(R.length):0)+")"}).attr("height",function(R){return xe-d(R.length)}),s.selectAll(".parentGroup").raise()},We=ke=>{te=O-ke.left-ke.right,xe=X-ke.bottom-ke.top},be=(ke,Se,oe,$,R)=>{if(!e.plotArea.fitChart){const ae=ke[0].data.length-fe,_=Se-20;N=Te.dimensionList.slice(Z,Z+fe),ne=JSON.parse(JSON.stringify(ke)),ne.forEach((ee,F)=>ne[F].data=ee.data.filter(q=>N.includes(q.dimension))),oe.append("rect").attr("x",$.left).attr("y",_).attr("width",R).attr("height",8).attr("fill","#ddd").attr("rx",4);const G=R*fe/Te.dimensionList.length,Q=oe.append("rect").attr("x",$.left).attr("y",_).attr("width",G).attr("height",8).attr("fill","#999").attr("rx",4).style("cursor","ew-resize").call(v.drag().on("drag",ee=>{let F=Math.min(Math.max(ee.x,$.left),$.left+R-G);Q.attr("x",F),Z=Math.round((F-$.left)/(R-G)*ae),N=Te.dimensionList.slice(Z,Z+fe),ne=JSON.parse(JSON.stringify(ke)),ne.forEach((q,ue)=>ne[ue].data=q.data.filter(B=>N.includes(B.dimension))),Pe(),ze()}));oe.on("wheel",ee=>{ee.preventDefault();const F=Math.abs(ee.deltaX)>Math.abs(ee.deltaY)?ee.deltaX:ee.deltaY;Z+=F>0?1:-1,Z=Math.max(0,Math.min(Z,ae));const q=$.left+(R-G)*Z/ae;Q.attr("x",q),ne=JSON.parse(JSON.stringify(ke)),ne.forEach((ue,B)=>ne[B].data=ue.data.filter(V=>N.includes(V.dimension))),Pe(),ze()})}ze()},ze=()=>{ta(s,Te,U,e,h,d,f,I,X,x,t,te,xe,N,i),Ye()};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:r,id:o,style:{width:"100%",height:"100%"}})})},hr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID(),L=0,u=le.LineChart,S=Ce.useRef(),g=Ce.useRef(c);g.current=c;const W=Ce.useRef(p);W.current=p;const A=mt(n.ChartData,n.DimensionList),E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled;let U=!1;const Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,w=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h=!1,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe,Ye,We,be=[],ze=0,ke=0,Se=0,oe=[],$={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{R()}catch(V){me("Linechart","createLineChart",V)}},[e]);const R=()=>{({formatOptions:e,svg:a,width:d,height:i}=Ft(S,e)),ae(),{formatOptions:e,dataTableLegendsList:oe}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:X,maxNumberForSecondaryAxis:M,customYaxisMaxValue:I,secondaryCustomYaxisMaxValue:w}=Rt(e,$.yMinLeft,$.yMaxLeft,$.yMinRight,$.yMaxRight),{margin:z,yLabel:K,xLabel:ye,yTitle:se,xTitle:te,dimensionHeightWidthArray:xe,chartTitleHeight:ge,secondaryAxisTitleWidth:pe,legendMargin:he,secondaryYLabel:O,visibleBars:ke,columnWidth:Se,scrollbarVisible:h}=Mt(d,i,X,M,$.yMaxLeft,e,$.legendList,$.dimensionList,$.yMaxRight,U,Y,t,b,$,oe),ue(z),{dataTable:y,dataTableHeight:T}=ia(e,K,se,A,$.dimensionList,n),b&&(y=[],T=0),St(a,d,i,e),f=wt(a,z),kt(f,e,T,k,s,u,m),_(),ee(),b?(ra(e,f,K,s,k,ve),U&&Ai(e,f,O,Pe,k)):(Zt(f,e,T,K,Te,s),U&&bi(f,e,T,O,J,s,k)),Dt(e,b,a,z,ye,i,te,$.chartType,K,k,s),Vt(s,e,T,b,a,z,se,K,k),U&&Gt(a,U,z,e,T,s,k,O,pe,b),Nt(a,e,d,ge),It(i,a,xe,ge,d,he,e,A,m,T,z,ct.line,u,l),_t(A,i,d,a,z,k,h,ke,$,ze,!1,G,b)},ae=()=>{const V=[],P=[];let C=[],re=-1/0,j=1/0,ie=-1/0,we=1/0;e.plotArea.hideZeroValues&&($.hideZeroValues=!0),A.forEach(de=>{P.push(de.properties.alias?de.properties.alias:de.legend),de.data.forEach(Ae=>{V.push(Ae),de.properties.axis==="Secondary"?(U=!0,ie=Math.max(ie,Ae.value),we=Math.min(we,Ae.value)):(re=Math.max(re,Ae.value),j=Math.min(j,Ae.value))})}),$.chartData=V,$.legendList=P,$.yMaxLeft=re,$.yMinLeft=j,$.yMaxRight=ie,$.yMinRight=we,C=t?Tt(e.xAxisLabel.xAxisNumberFormat,$.dimensionList).map(de=>de):$.dimensionList,$.dimensionList.forEach((de,Ae)=>{$.formattedDimensionListMap.set(de,C[Ae])}),be=JSON.parse(JSON.stringify(A)),e.plotArea.fitChart?We=$.dimensionList:We=$.dimensionList.slice(ze,ze+ke)},_=()=>{let V=yt(I||$.yMaxLeft,$.yMinLeft,s,e,$,H,I,b,k).yAxisLabelArray;$.yMaxLeft=V[V.length-1],$.yMinLeft=V[0];const P=b?[0,T>0?k-T:k]:[T>0?s-T:s,0];{const C=v.scaleLinear().domain([$.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:$.yMinLeft*.9:$.yMinLeft<0?$.yMinLeft*1.1:$.yMinLeft*.9,$.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:$.yMaxLeft*1.1]).range(P);b?Le=C:N=C}if(U){const C=v.scaleLinear().domain([$.yMinRight>=0?(D||D==0)&&!Number.isNaN(D)?D:0:(D||D==0)&&!Number.isNaN(D)?D:$.yMinRight*1.1,$.yMaxRight<=0?w||0:w||$.yMaxRight*1.1]).range(P);b?Ue=C:ne=C}if(fe=b?[s,0]:[0,k],!b&&e.seriesLabel.seriesLabelVisibility){let C=la(k,N,e,be,ne,U,s,!1);C.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(Re=C.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?fe=[0,k-C.heightWidth[0]]:fe=[C.heightWidth[0],k]}},G=(V,P,C)=>{be=P,We=V,ke=C,B()},Q=()=>{const V=v.scalePoint().domain(We).range(fe).padding(.5);b?Ee=V:Z=V},ee=()=>{{let V=yt(I||$.yMaxLeft,$.yMinLeft,s,e,$,H,I,b,k);b?ve=v.axisBottom(Le).tickFormat(P=>Xe(P,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-s:0).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??k/50).tickPadding(8).tickSizeOuter(0):Te=v.axisLeft(N).tickFormat(P=>Xe(P,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,k,Re)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue).tickPadding(8).tickSizeOuter(0)}if(U){let V=yt(w||$.yMaxRight,D||$.yMinRight,s,e,$,D,w);b?Pe=v.axisTop(Ue).tickFormat(P=>Xe(P,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??k/50).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-s:0).tickPadding(8).tickSizeOuter(0):J=v.axisRight(ne).tickFormat(P=>Xe(P,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue).tickSize(zt(e,k,Re)).tickPadding(8).tickSizeOuter(0)}},F=()=>{b?Ye=v.axisLeft(Ee).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*k*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(We,s,e)):Me=v.axisBottom(Z).tickSize(sa(e,s,T,!0)).tickSizeOuter(0).tickValues(gt(We,k,e))},q=V=>{const P=[...V].reverse();P.forEach(Ae=>{Ae.data.forEach(De=>{De.hideZero=Ae.properties.hideZeroValues,De.axis=Ae.properties.axis})});const C=b?v.line().y(Ae=>{const De=Ee(Ae.dimension);return De??0}).x(Ae=>Ae.axis===Qe.primary?Le(Ae.value):Ue(Ae.value)).defined(Ae=>Ae.hideZero||$.hideZeroValues?!!Ae.value:!0).curve(ft(e)):v.line().x(Ae=>{const De=Z(Ae.dimension);return De??0}).y(Ae=>Ae.axis===Qe.primary?N(Ae.value):ne(Ae.value)).defined(Ae=>Ae.hideZero||$.hideZeroValues?!!Ae.value:!0).curve(ft(e)),re=e.animation.animationEnabled,j=Ae=>re?Ae.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):Ae;let ie=f.selectAll(".parentGroup").data([P]);ie=ie.enter().append("g").attr("class","lines parentGroup").merge(ie);let we=ie.selectAll(".line-group").data(Ae=>Ae),de=we.enter().append("g").attr("class","line-group");de.append("path").attr("class","visibleLine").attr("fill","none"),de.merge(we).each(function(Ae){const $e=v.select(this).selectAll("path.visibleLine").data([Ae]).join("path").attr("class","visibleLine").attr("d",Fe=>C(Fe.data)).attr("stroke",Fe=>Fe.properties.color!==Ie.white?Fe.properties.color:"none").attr("stroke-dasharray",Fe=>{const _e=parseInt(Fe.properties.lineWidth);switch(Fe.properties.lineStyle){case bt.dotted:return`0,${_e+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",Fe=>Fe.properties.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",Fe=>Fe.properties.lineStyle!=="None"?Fe.properties.lineWidth:0).attr("hoverId",(Ae.properties.alias||Ae.properties.name||"Legend").replace(/\s+/g,"-")).attr("clip-path",`url(#${m}-clip)`).attr("d",Fe=>C(Fe.data)).attr(lt.SeriesId,Fe=>Fe.properties.legendUniqueId).attr(lt.DimValue,Fe=>Fe.properties.alias||Fe.properties.name||"").on("click",vt(W,g,(Fe,_e)=>({seriesId:_e.properties.legendUniqueId,dimValue:_e.properties.alias||_e.properties.name||"",legendUniqueId:_e.properties.legendUniqueId,seriesDisplayName:_e.properties.alias||_e.properties.name||""})));re&&$e.each(function(){const Fe=v.select(this),_e=this.getTotalLength();Fe.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",_e),j(Fe).attr("stroke-dashoffset",0)})}),we.exit().remove(),Va(ie,P,"None",b?Ee:Z,b?Le:N,b?Ue:ne,null,e,$,w,D,H,I,!1,r,b),f.selectAll(".parentGroup").raise()},ue=V=>{k=d-V.left-V.right,s=i-V.bottom-V.top},B=()=>{if(Q(),F(),b?na(e,f,ye,s,k,Ye,Pe,Le,$.yMaxLeft,We,u,t,d,xe,Se,Ee):ta(f,$,ye,e,T,N,Me,xe,i,k/We.length,t,k,s,We,Z),q(be),$a(A,b?Ee:Z,b?Le:N,b?Ue:ne,z,pt,[],[],e,u,i,d,k,We,s,m,a,x,void 0,void 0,o,!1,b),!b){let V=la(k,N,e,be,ne,U,s,!1).labelArray;ja(e,f,V),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,a,f,y,L,N,Z,void 0,void 0,void 0,T,u,e,K,se,$.dimensionList,k,fe,$.formattedDimensionListMap,m,z,s))}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},pr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID(),L=0,u=le.StackLineChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=n.DimensionList,E=(mt(n.ChartData,n.DimensionList)||[]).reverse(),b=!!e.swapAxis?.swapAxisEnabled,U=new Map,Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,w=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe,Ye=[],We=0,be=2,ze=!1,ke=0,Se=[],oe=[];const $=!1;let R={dimensionList:A,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{ae()}catch(C){me("StackLinechart","createStackLineChart",C)}},[e]);const ae=()=>{({formatOptions:e,svg:T,width:s,height:d}=Ft(S,e)),_(),{formatOptions:e,dataTableLegendsList:Se}=ea(e,E,n.DataTableData??[]),{maxNumberForPrimaryAxis:X,maxNumberForSecondaryAxis:M}=Rt(e,R.yMinLeft,R.yMaxLeft,R.yMinRight,R.yMaxRight),{margin:z,yLabel:K,xLabel:ye,yTitle:se,xTitle:te,dimensionHeightWidthArray:xe,chartTitleHeight:ge,secondaryAxisTitleWidth:pe,legendMargin:he,secondaryYLabel:O,visibleBars:be,columnWidth:ke,scrollbarVisible:ze}=Mt(s,d,X,M,R.yMaxLeft,e,R.legendList,R.dimensionList,R.yMaxRight,Y,$,t,b,R,Se),ue(z),{dataTable:i,dataTableHeight:y}=ia(e,K,se,E,R.dimensionList,n),b&&(i=[],y=0),St(T,s,d,e),a=wt(T,z),kt(a,e,y,h,k,u,m),G(),ee(),b?ra(e,a,K,k,h,Le):Zt(a,e,y,K,Re,k),Dt(e,b,T,z,ye,d,te,R.chartType,K,h,k),Vt(k,e,y,b,T,z,se,K,h),Gt(T,Y,z,e,y,k,h,O,pe,b),Nt(T,e,s,ge),It(d,T,xe,ge,s,he,e,[...E].reverse(),m,y,z,ct.line,u,l),_t(E,d,s,T,z,h,ze,be,R,We,!1,P,b),ii(U,b?Me:ne,b?J:f,z,pt,[],e,u,d,s,T,o,b)},_=()=>{const C=[],re=[];e.plotArea.hideZeroValues&&(R.hideZeroValues=!0),E.forEach((De,$e)=>{const Fe=`${$e}~$~${De.properties.alias?De.properties.alias:De.legend}`;De.properties.legend=Fe,re.push(Fe);for(const _e of De.data)C.push(_e)}),R.chartData=C,R.legendList=re,Ye=JSON.parse(JSON.stringify(E));let j=Lt(R.dimensionList,E,$);e.plotArea.fitChart?Pe=R.dimensionList:(Pe=R.dimensionList.slice(We,We+be),Ye.forEach((De,$e)=>Ye[$e].data=De.data.filter(Fe=>Pe.includes(Fe.dimension))));const ie=v.stack().keys(R.legendList).offset(v.stackOffsetDiverging)(j);V();let we=1/0,de=-1/0;for(const De of ie)for(const[$e,Fe]of De)we=Math.min(we,$e),de=Math.max(de,Fe);R.yMinLeft=we>0?0:we,R.yMaxLeft=de;let Ae=t?Tt(e.xAxisLabel.xAxisNumberFormat,R.dimensionList).map(De=>De):R.dimensionList;R.dimensionList.forEach((De,$e)=>{R.formattedDimensionListMap.set(De,Ae[$e])})},G=()=>{let C=yt(I||R.yMaxLeft,R.yMinLeft,k,e,R,H,I,b,h).yAxisLabelArray;R.yMaxLeft=C[C.length-1],R.yMinLeft=C[0];const re=b?[0,y>0?h-y:h]:[y>0?k-y:k,0];{const j=v.scaleLinear().domain([R.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:0:R.yMinLeft<0?R.yMinLeft*1.1:R.yMinLeft*.9,R.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:R.yMaxLeft*1.1]).range(re);b?J=j:f=j}if(Z=b?[k,0]:[0,h],!b&&e.seriesLabel.seriesLabelVisibility){let j=la(h,f,e,Ye,void 0,Y,k,!0);j.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(fe=j.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?Z=[0,h-j.heightWidth[0]]:Z=[j.heightWidth[0],h]}Q()},Q=()=>{const C=v.scalePoint().domain(Pe).range(Z).padding(.5);b?Me=C:ne=C},ee=()=>{F();{let C=yt(I||R.yMaxLeft,R.yMinLeft,k,e,R,H,I,b,h);b?Le=v.axisBottom(J).tickFormat(re=>Xe(re,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-k:0).tickValues(C.autoLabelFlag?void 0:C.yAxisLabelArray).ticks(C.customTickValue??h/50).tickPadding(8).tickSizeOuter(0):Re=v.axisLeft(f).tickFormat(re=>Xe(re,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,h,fe)).tickValues(C.autoLabelFlag?void 0:C.yAxisLabelArray).ticks(C.customTickValue).tickPadding(8).tickSizeOuter(0)}},F=()=>{b?ve=v.axisLeft(Me).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*h*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(Pe,k,e)):Te=v.axisBottom(ne).tickSize(sa(e,k,y,!0)).tickSizeOuter(0).tickValues(gt(Pe,h,e))},q=C=>{C.forEach(de=>{de.data.forEach(Ae=>{Ae.hideZero=de.properties.hideZeroValues,Ae.axis=de.properties.axis})});const re=b?v.line().y(de=>{const Ae=Me(de.data.dimension);return Ae??0}).x(de=>de[1]>0?J(de[1]):J(de[0])).defined(de=>{const Ae=de;return Ae.hideZero||R.hideZeroValues?Ae.data[Ae.key]:!0}).curve(ft(e)):v.line().x(de=>{const Ae=ne(de.data.dimension);return Ae??0}).y(de=>de[1]>0?f(de[1]):f(de[0])).defined(de=>{const Ae=de;return Ae.hideZero||R.hideZeroValues?Ae.data[Ae.key]:!0}).curve(ft(e));let j=a.selectAll(".parentGroup").data([oe]);j=j.enter().append("g").attr("class","lines parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(j);let ie=j.selectAll(".line-group").data(de=>de);const we=ie.enter().append("g").attr("class",de=>"line-group "+de.key.replace(/ /g,"-"));we.append("path").attr("class","line").attr("fill","none"),we.merge(ie).each(function(de,Ae){const De=v.select(this),$e=De.selectAll("path.visibleLine").data([de]).join("path").attr("class","visibleLine").attr("hoverId",it=>(E[Ae]?.properties?.alias||E[Ae]?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("d",re(de)).attr("stroke",de.color!==Ie.white?de.color:"none").attr("stroke-dasharray",it=>{const nt=parseInt(E[Ae].properties.lineWidth.toString());switch(E[Ae].properties.lineStyle){case bt.dotted:return`0,${nt+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",E[Ae].properties.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",E[Ae].properties.lineStyle!==bt.none?E[Ae].properties.lineWidth:0).attr("fill","none").attr(lt.SeriesId,E[Ae].properties.legendUniqueId).attr(lt.DimValue,E[Ae].properties.alias||E[Ae].properties.name||"").on("click",vt(W,g,()=>({seriesId:E[Ae].properties.legendUniqueId,dimValue:E[Ae].properties.alias||E[Ae].properties.name||"",legendUniqueId:E[Ae].properties.legendUniqueId,seriesDisplayName:E[Ae].properties.alias||E[Ae].properties.name||""}))),Fe=e.animation.animationEnabled,_e=$e.node().getTotalLength();Fe?$e.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",_e).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("stroke-dashoffset",0):$e.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",0),De.selectAll("path.hoverLine").data([de]).join("path").attr("class","hoverLine").attr("d",re(de)).attr("stroke",Ie.transparent).attr("stroke-width",20).attr("fill","none").style("pointer-events","stroke").on("mouseenter",function(){T.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!0),T.selectAll('[hoverId="'+mi(E[Ae].properties.alias||E[Ae].properties.name||"Legend").replace(/\s+/g,"-")+'"]').classed("highlight",!0).classed("unhighlight",!1)}).on("mouseleave",function(){T.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!1)})}),ie.exit().remove(),Va(j,C,u,b?Me:ne,b?J:f,b?Ee:N,null,e,R,w,D,H,I,!1,p,b)},ue=C=>{h=s-C.left-C.right,k=d-C.bottom-C.top},B=()=>{if(Q(),F(),b?na(e,a,ye,k,h,ve,Ue,J,R.yMaxLeft,Pe,u,t,s,xe,ke,Me):ta(a,R,ye,e,y,f,Te,xe,d,L,t,h,k,Pe,ne),V(),q(Ye),Ya(oe,b?Me:ne,b?J:f,b?Ee:N,z,pt,[],[],e,u,d,s,h,Pe,k,m,T,x,y,o,b),!b){let C=la(h,f,e,Ye,void 0,Y,k,!0).labelArray;ja(e,a,C),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,T,a,i,L,f,ne,void 0,void 0,void 0,y,le.LineChart,e,K,se,R.dimensionList,h,Z,R.formattedDimensionListMap,m,z,k))}},V=()=>{let C=Lt(Pe,Ye,$);oe=v.stack().keys(R.legendList).offset(v.stackOffsetDiverging)(C),Ye.forEach((j,ie)=>j.data.forEach((we,de)=>{we[0]=oe[ie][de][0],we[1]=oe[ie][de][1]}));let re=e.annotation.annotationSetLabelColor;oe.forEach((j,ie)=>j.forEach(we=>{we.key=j.key,j.color=JSON.parse(JSON.stringify(E[ie].properties.color)),j.individualAnnotationVisibility=JSON.parse(JSON.stringify(E[ie].properties.individualAnnotationVisibility)),we.data.labelPosition=E[ie].properties.dataLabelPosition,we.data.labelColor=re=="2"?JSON.parse(JSON.stringify(E[ie].properties.color)):E[ie].properties.labelColor,we.hideZero=JSON.parse(JSON.stringify(E[ie].properties.hideZeroValues)),we.properties=E[ie].properties}))},P=(C,re,j)=>{Ye=re,Pe=C,be=j,li(n,U,Pe),B()};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},br=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID(),L=0,u=le.NormalizedStackLineChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList)?.reverse()||[],E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe=[],Ye=0,We,be=0,ze=!1,ke=[],Se=[];const oe=!0;let $={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{R()}catch(C){me("NormalizedLinechart","createNormalizedLinechart",C)}},[e]);const R=()=>{({formatOptions:e,svg:y,width:k,height:s}=Ft(S,e)),ae(),{formatOptions:e,dataTableLegendsList:ke}=ea(e,A,n.DataTableData??[]),{margin:w,yLabel:z,xLabel:K,yTitle:ye,xTitle:se,dimensionHeightWidthArray:te,chartTitleHeight:xe,secondaryAxisTitleWidth:ge,legendMargin:pe,secondaryYLabel:he,visibleBars:We,columnWidth:be,scrollbarVisible:ze}=Mt(k,s,O,X,$.yMaxLeft,e,$.legendList,$.dimensionList,$.yMaxRight,U,oe,t,b,$,ke),ue(w),{dataTable:d,dataTableHeight:i}=ia(e,z,ye,A,$.dimensionList,n),b&&(d=[],i=0),St(y,k,s,e),T=wt(y,w),kt(T,e,i,M,h,u,m),_(),ee(),b?ra(e,T,z,h,M,Ee):Zt(T,e,i,z,fe,h),Dt(e,b,y,w,K,s,se,$.chartType,z,M,h),Vt(h,e,i,b,y,w,ye,z,M),Gt(y,U,w,e,i,h,M,he,ge,b),Nt(y,e,k,xe),It(s,y,te,xe,k,pe,e,[...A].reverse(),m,i,w,ct.line,u,l),_t(A,s,k,y,w,M,ze,We,$,Ye,!1,B,b)},ae=()=>{const C=[],re=[];e.plotArea.hideZeroValues&&($.hideZeroValues=!0,A.forEach(Ae=>{Ae.data=Ae.data.filter(De=>De.value!==0)})),A.forEach((Ae,De)=>{const $e=`${De}~$~${Ae.properties.legend}`;Ae.properties.legend=$e,re.push($e);for(const Fe of Ae.data)C.push(Fe)}),$.chartData=C,$.legendList=re,Pe=JSON.parse(JSON.stringify(A)),ve=$.dimensionList;const j=Lt($.dimensionList,A,oe),ie=v.stack().keys($.legendList).offset(v.stackOffsetDiverging)(j);P();let we=1/0;for(const Ae of ie)for(const[De]of Ae)we=Math.min(we,De);$.yMinLeft=we>0?0:we,$.yMaxLeft=1;const de=t?Tt(e.xAxisLabel.xAxisNumberFormat,$.dimensionList).map(Ae=>Ae):$.dimensionList;$.formattedDimensionListMap=new Map($.dimensionList.map((Ae,De)=>[Ae,de[De]]))},_=()=>{const C=b?[0,i>0?M-i:M]:[i>0?h-i:h,0];{const re=v.scaleLinear().domain([$.yMinLeft<0?-1:0,1]).range(C);b?Me=re:a=re}if(ne=b?[h,0]:[0,M],!b&&e.seriesLabel.seriesLabelVisibility){Q(Se,Pe);let re=la(M,a,e,Pe,void 0,U,h,!0);re.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(Z=re.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?ne=[0,M-re.heightWidth[0]]:ne=[re.heightWidth[0],M]}},G=()=>{const C=v.scalePoint().domain(ve).range(ne).padding(.5);b?Te=C:N=C};function Q(C,re){C.forEach((j,ie)=>j.forEach((we,de)=>{re[ie]&&re[ie].data[de]&&(re[ie].data[de][0]=we[0]=we.data.total===0?0:we[0]/we.data.total,re[ie].data[de][1]=we[1]=we.data.total===0?0:we[1]/we.data.total)}))}const ee=()=>{{const C=e.yAxisLabel.yAxisTicksMode===wa.custom,re=parseInt(e.yAxisLabel.yAxisLabelDecimalPrecision)||0,j=C?za($.yMinLeft<0?-1:0,1,e.yAxisLabel.yAxisTicksCount):null;b?Ee=v.axisBottom(Me).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-h:0).tickValues(j).tickFormat(v.format(`.${re}%`)).ticks(i>0?(M-i)/80:M/80).tickPadding(8).tickSizeOuter(0):fe=v.axisLeft(a).tickSize(zt(e,M,Z)).tickValues(j).tickFormat(v.format(`.${re}%`)).ticks(i>0?(h-i)/80:h/80).tickPadding(8).tickSizeOuter(0)}},F=()=>{b?Ue=v.axisLeft(Te).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*M*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(ve,h,e)):Re=v.axisBottom(N).tickSize(sa(e,h,i,!0)).tickSizeOuter(0).tickValues(gt(ve,M,e))},q=C=>{Q(Se,Pe),C.forEach(de=>{de.data.forEach(Ae=>{Ae.hideZero=de.properties.hideZeroValues,Ae.axis=de.properties.axis})});const re=b?v.line().y(de=>{const Ae=Te(de.data.dimension);return Ae??0}).x(de=>de[1]>0?Me(de[1]):Me(de[0])).curve(ft(e)):v.line().x(de=>N(de.data.dimension)?N(de.data.dimension):null).y(de=>de[1]>0?a(de[1]):a(de[0])).curve(ft(e));let j=T.selectAll(".parentGroup").data([Se]);j=j.enter().append("g").attr("class","lines parentGroup").merge(j);let ie=j.selectAll(".line-group").data(de=>de),we=ie.enter().append("g").attr("class",de=>"line-group "+de.key.replace(/ /g,"-"));we.attr("hoverId",de=>(C[de.index]?.properties?.alias||C[de.index]?.properties?.name||"Legend").replace(/\s+/g,"-")).append("path").attr("class","line").attr("fill","none"),we.merge(ie).each(function(de,Ae){const De=v.select(this),$e=De.selectAll("path.visibleLine").data([de]).join("path").attr("class","visibleLine").attr("d",re(de)).attr("stroke",de.color!==Ie.white?de.color:"none").attr("stroke-dasharray",it=>{const nt=parseInt(A[Ae].properties.lineWidth.toString());switch(A[Ae].properties.lineStyle){case bt.dotted:return`0,${nt+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",A[Ae].properties.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",A[Ae].properties.lineStyle!==bt.none?A[Ae].properties.lineWidth:0).attr("fill","none").attr(lt.SeriesId,A[Ae].properties.legendUniqueId).attr(lt.DimValue,A[Ae].properties.alias||A[Ae].properties.name||"").on("click",vt(W,g,()=>({seriesId:A[Ae].properties.legendUniqueId,dimValue:A[Ae].properties.alias||A[Ae].properties.name||"",legendUniqueId:A[Ae].properties.legendUniqueId,seriesDisplayName:A[Ae].properties.alias||A[Ae].properties.name||""}))),Fe=e.animation.animationEnabled,_e=$e.node().getTotalLength();Fe?$e.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",_e).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("stroke-dashoffset",0):$e.attr("stroke-dasharray",_e+" "+_e).attr("stroke-dashoffset",0),De.selectAll("path.hoverLine").data([de]).join("path").attr("class","hoverLine").attr("d",re(de)).attr("stroke",Ie.transparent).attr("stroke-width",20).attr("fill","none").style("pointer-events","stroke").on("mouseenter",function(it,nt){y.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!0),y.selectAll('[hoverId="'+mi(C[nt.index]?.properties?.alias||C[nt.index]?.properties?.name||"Legend").replace(/\s+/g,"-")+'"]').classed("highlight",!0).classed("unhighlight",!1)}).on("mouseleave",function(it,nt){y.selectAll(".parentGroup").classed("highlight",!1).classed("unhighlight",!1),y.selectAll('[hoverId="'+mi(C[nt.index]?.properties?.alias||nt[nt.index]?.properties?.name||"Legend").replace(/\s+/g,"-")+'"]').classed("highlight",!1).classed("unhighlight",!1)})}),ie.exit().remove(),Va(j,C,u,b?Te:N,b?Me:a,b?J:f,null,e,$,D,I,Y,H,!0,p,b)},ue=C=>{M=k-C.left-C.right,h=s-C.bottom-C.top},B=(C,re,j)=>{Pe=re,ve=C,We=j,V()},V=()=>{if(G(),P(),F(),b?na(e,T,K,h,M,Ue,Le,Me,$.yMaxLeft,ve,u,t,k,te,be,Te):ta(T,$,K,e,i,a,Re,te,s,L,t,M,h,ve,N),q(Pe),Ya(Se,b?Te:N,b?Me:a,b?J:f,w,pt,[],[],e,u,s,k,M,ve,h,m,y,x,i,o,b),!b){let C=la(M,a,e,Pe,void 0,U,h,!0).labelArray;ja(e,T,C),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,y,T,d,L,a,N,void 0,void 0,void 0,i,le.LineChart,e,z,ye,$.dimensionList,M,ne,$.formattedDimensionListMap,m,w,h))}},P=()=>{let C=Lt(ve,Pe,oe);Se=v.stack().keys($.legendList).offset(v.stackOffsetDiverging)(C),Pe.forEach((j,ie)=>j.data.forEach((we,de)=>{we[0]=Se[ie][de][0],we[1]=Se[ie][de][1]}));let re=e.annotation.annotationSetLabelColor;Se.forEach((j,ie)=>j.forEach(we=>{we.key=j.key,j.color=JSON.parse(JSON.stringify(A[ie].properties.color)),we.data.labelPosition=A[ie].properties.dataLabelPosition,we.data.labelColor=re=="2"?JSON.parse(JSON.stringify(A[ie].properties.color)):A[ie].properties.labelColor,we.hideZero=JSON.parse(JSON.stringify(A[ie].properties.hideZeroValues)),we.properties=A[ie].properties}))};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},gr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID();let L=0;const u=le.HorizontalBarChart,S=Ce.useRef(),g=Ce.useRef(c);g.current=c;const W=Ce.useRef(p);W.current=p;const A=mt(n.ChartData,n.DimensionList),E=n.DimensionList,b=!0;let U=!1;const Y=!1,H=new Map;let I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,D=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,w=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,z=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k=new Map,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le=[],Ue=0,ve=2,Pe=!1,Ye={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{We()}catch(G){me("HorizontalBarchart","createHorizontalBarChart",G)}},[e]);const We=()=>{({formatOptions:e,svg:a,width:i,height:y}=Ft(S,e)),be(),{maxNumberForPrimaryAxis:M,maxNumberForSecondaryAxis:h,customYaxisMaxValue:D,secondaryCustomYaxisMaxValue:z}=Rt(e,Ye.yMinLeft,Ye.yMaxLeft,Ye.yMinRight,Ye.yMaxRight),{margin:K,yLabel:ye,xLabel:se,yTitle:te,xTitle:xe,dimensionHeightWidthArray:ge,chartTitleHeight:pe,secondaryAxisTitleWidth:he,legendMargin:O,secondaryYLabel:X,visibleBars:ve,columnWidth:L,scrollbarVisible:Pe}=Mt(i,y,M,h,Ye.yMaxLeft,e,Ye.legendList,Ye.dimensionList,Ye.yMaxRight,U,Y,t,b,Ye),R(K),St(a,i,y,e),f=wt(a,K),kt(f,e,T,s,d,u,m),ze(),Se(),ra(e,f,ye,d,s,Te),U&&Ai(e,f,X,Me,s),Dt(e,b,a,K,se,y,xe,Ye.chartType,ye,s,d),Vt(d,e,T,b,a,K,te,ye,s),Gt(a,U,K,e,T,d,s,X,he,b),Nt(a,e,i,pe),It(y,a,ge,pe,i,O,e,A,m,T,K,ct.rectangle,u,l),_t(A,y,i,a,K,s,Pe,ve,Ye,Ue,!1,ae,b)},be=()=>{const G=[],Q=[];let ee=[],F=-1/0,q=1/0,ue=-1/0,B=1/0,V=1/0,P=-1/0;A.forEach(C=>{Q.push(C.properties.legendUniqueId),P=-1/0,V=1/0,C.data.forEach(re=>{G.push(re),C.properties.axis==="Secondary"?(U=!0,ue=Math.max(ue,re.value),B=Math.min(B,re.value)):(F=Math.max(F,re.value),q=Math.min(q,re.value)),P=Math.max(P,re.value),V=Math.min(V,re.value)}),C.properties.setColorScale&&H.set(C.properties.legendUniqueId,v.scaleSequential().domain([V,P]).interpolator(yi.interpolateRgb(C.properties.startColor,C.properties.endColor)))}),Ye.chartData=G,Ye.legendList=Q,Ye.yMaxLeft=F,Ye.yMinLeft=q>0?0:q,Ye.yMaxRight=ue,Ye.yMinRight=B>0?0:B,ee=t?Tt(e.xAxisLabel.xAxisNumberFormat,Ye.dimensionList).map(C=>C):Ye.dimensionList,Ye.dimensionList.forEach((C,re)=>{Ye.formattedDimensionListMap.set(C,ee[re])}),Le=JSON.parse(JSON.stringify(A)),Ee=Ye.dimensionList,e.plotArea.hideZeroValues&&(Ye.hideZeroValues=!0)},ze=()=>{let G=yt(Ye.yMaxLeft,Ye.yMinLeft,d,e,Ye,I,D,b,s).yAxisLabelArray;Ye.yMaxLeft=G[G.length-1],Ye.yMinLeft=G[0],Z=v.scaleLinear().domain([Ye.yMinLeft>=0?I!==void 0&&!Number.isNaN(I)?I:0:Ye.yMinLeft<0?Ye.yMinLeft*1.1:Ye.yMinLeft*.9,Ye.yMaxLeft<=0?0:D!==void 0&&!Number.isNaN(D)?D:Ye.yMaxLeft*1.1]).range([0,s]),U&&(fe=v.scaleLinear().domain([Ye.yMinRight>=0?(w||w==0)&&!Number.isNaN(w)?w:0:(w||w==0)&&!Number.isNaN(w)?w:Ye.yMinRight*1.1,Ye.yMaxRight<=0?z||0:z||Ye.yMaxRight*1.1]).range([0,s])),Re=[d,0]},ke=()=>{ne=v.scaleBand().domain(Ye.legendList).range([0,L]).paddingInner(Ye.legendList.length>1?.3*parseFloat(e.plotArea.plotAreaSeriesWidth)/100:0),N=v.scalePoint().domain(Ee).range(Re).padding(.5)},Se=()=>{{let G=yt(D||Ye.yMaxLeft,Ye.yMinLeft,d,e,Ye,I,D,b,s);Te=v.axisBottom(Z).tickFormat(Q=>Xe(Q,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-d:0).tickValues(G.autoLabelFlag?void 0:G.yAxisLabelArray).ticks(G.customTickValue).tickPadding(8).tickSizeOuter(0)}if(U){let G=yt(z||Ye.yMaxRight,w||Ye.yMinRight,d,e,Ye,w,z);Me=v.axisTop(fe).tickFormat(Q=>Xe(Q,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(G.autoLabelFlag?void 0:G.yAxisLabelArray).ticks(G.customTickValue).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-d:0).tickPadding(8).tickSizeOuter(0)}},oe=()=>{J=v.axisLeft(N).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*s*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(Ee,d,e))},$=G=>{G.forEach(Q=>{Q.data.forEach(ee=>{ee.hideZero=Q.properties.hideZeroValues,ee.axis=Q.properties.axis,ee.legendUniqueId=Q.properties.legendUniqueId})}),Ee.forEach(Q=>{f.append("rect").attr("id",`dim-background-${Q}`).attr("class","dimension-background").attr("y",N(Q)-L/2).attr("height",L).attr("x",0).attr("width",s).attr("fill","#E5E5E5").attr("visibility","hidden").lower()}),G.forEach(Q=>{let ee=f.selectAll(".parentGroup").data([Q],V=>V.properties.legendUniqueId);ee=ee.enter().append("g").attr("class","column parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(ee);let F=ee.selectAll(".column-group").data(Q.data.map(V=>({...V,properties:Q.properties})),V=>V.legend+V.dimension),q=F.enter().append("g").attr("class","column-group").attr("hoverId",(Q.properties.alias||Q.properties.name||"Legend").replace(/\s+/g,"-")).attr("transform",V=>`translate(0, ${N(V.dimension)-L/2})`);F.attr("transform",V=>`translate(0, ${N(V.dimension)-L/2})`),q.merge(F).attr("transform",V=>`translate(0, ${N(V.dimension)-L/2})`);const ue=q.append("rect").attr("y",V=>ne(V.legendUniqueId)).attr("height",ne.bandwidth()).attr("x",V=>{const P=Q.properties.axis===Qe.primary?Z:fe;return V.value>=0,P(0)}).attr("width",0).attr("fill",V=>H.get(Q.properties.legendUniqueId)?.(V.value)??Q.properties.color).attr("stroke-dasharray",V=>V.properties.stackBorderStyle==2?"5,3":"0").attr("stroke-width",V=>`${V.properties.stackBorderWidth}px`).attr("stroke",V=>Q.properties.stackBorderStyle==0?"none":e.column.stackBorderVisibility?Q.properties.stackBorderColor:"none").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("visibility",V=>V.value===0&&e.xAxisLabel.hideZeroValues?"hidden":"visible").attr(lt.SeriesId,()=>Q.properties.legendUniqueId).attr(lt.DimValue,V=>Array.isArray(V.dimension)?String(V.dimension[0]):String(V.dimension));(e.animation.animationEnabled?ue.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):ue).attr("x",V=>{const P=Q.properties.axis===Qe.primary?Z:fe;return V.value>=0?P(0):P(V.value)}).attr("width",V=>{const P=Q.properties.axis===Qe.primary?Z:fe,C=Q.properties.axis===Qe.primary?D:z;return V.value>=0?C&&V.value>C?P(C)-P(0):P(V.value)-P(0):Math.abs(P(0)-P(V.value))}),q.merge(F).on("mousemove",(V,P)=>{(Q.properties.alias||Q.properties.name||"Legend").replace(/ /g,"-");const C=Array.isArray(P.dimension)?P.dimension[0]:P.dimension,re=String(Ye.formattedDimensionListMap.get(C)??C??""),j=At(r,String(C??""),{...Q.properties,formattedDimensionValue:re});ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:Ye.formattedDimensionListMap.get(Array.isArray(P.dimension)?P.dimension[0]:P.dimension)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():P.properties?.currentMeasure?P.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||P.value,value:Xe([le.NormalizedStackLineChart,le.NormalizedStackAreaChart,""].includes(u)?P[1]-P[0]:P.value,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:P.properties.alias}],e,V,Q.properties,j)}).on("mouseout",(V,P)=>{(Q.properties.alias||Q.properties.name||"Legend").replace(/ /g,"-"),ot()}).on("click",vt(W,g,(V,P)=>({seriesId:Q.properties.legendUniqueId,dimValue:Array.isArray(P.dimension)?String(P.dimension[0]):String(P.dimension),legendUniqueId:Q.properties.legendUniqueId,seriesDisplayName:Q.properties.alias||Q.properties.name||""}))),F.exit().remove()}),f.selectAll(".parentGroup").raise()},R=G=>{s=i-G.left-G.right,d=y-G.bottom-G.top},ae=(G,Q,ee)=>{Le=Q,Ee=G,ve=ee,li(n,k,Ee),e.xAxisLabel.hideZeroValues&&(Ee=Ee.filter(F=>k.get(F)!==0)),_()},_=()=>{ke(),oe(),na(e,f,se,d,s,J,Me,Z,Ye.yMaxLeft,Ee,u,t,i,ge,L,N),$(Le),$a(Le,N,Z,fe,K,pt,[],[],e,u,y,i,s,Ee,d,m,a,x,ne,L,o,!1,b)};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},Ar=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID();let L=0;const u=le.StackHorizontalBarChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList)?.reverse(),E=n.DimensionList,b=!0,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I,D,w,z,K,ye,se,te,xe,ge,pe,he;const O=new Map;let X,M,h,k,s,d,i,y,T,a,f,N,ne=[],Z=0,fe=2,Re=!1,Te=[];const Me=!1;let J=new Map,Ee={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{Le()}catch(_){me("StackStackHorizontalBarchart","createStackHorizontalBarChart",_)}},[e]);const Le=()=>{({formatOptions:e,svg:s,width:h,height:k}=Ft(S,e)),Ue(),{maxNumberForPrimaryAxis:pe,maxNumberForSecondaryAxis:he}=Rt(e,Ee.yMinLeft,Ee.yMaxLeft,Ee.yMinRight,Ee.yMaxRight),{margin:I,yLabel:D,xLabel:w,yTitle:z,xTitle:K,dimensionHeightWidthArray:ye,chartTitleHeight:se,secondaryAxisTitleWidth:te,legendMargin:xe,secondaryYLabel:ge,visibleBars:fe,columnWidth:L,scrollbarVisible:Re}=Mt(h,k,pe,he,Ee.yMaxLeft,e,Ee.legendList,Ee.dimensionList,Ee.yMaxRight,U,Me,t,b,Ee),ze(I),St(s,h,k,e),d=wt(s,I),kt(d,e,0,X,M,u,m),ve(),Ye(),ra(e,d,D,M,X,a),Dt(e,b,s,I,w,k,K,Ee.chartType,D,X,M),Vt(M,e,0,b,s,I,z,D,h),Nt(s,e,h,se),It(k,s,ye,se,h,xe,e,[...A].reverse(),m,0,I,ct.rectangle,u,l),_t(A,k,h,s,I,X,Re,fe,Ee,Z,!1,ke,b)},Ue=()=>{const _=[],G=[];let Q=-1/0,ee=1/0;A.forEach((P,C)=>{const re=`${C}~$~${P.properties.legend}`;P.properties.legend=re,G.push(re),Q=-1/0,ee=1/0;for(const j of P.data)Q=Math.max(Q,j.value),ee=Math.min(ee,j.value),_.push(j);P.properties.setColorScale&&O.set(P.properties.legendUniqueId,v.scaleSequential().domain([ee,Q]).interpolator(v.interpolateRgb(P.properties.startColor,P.properties.endColor)))}),Ee.chartData=_,Ee.legendList=G,ne=JSON.parse(JSON.stringify(A));let F=Lt(Ee.dimensionList,A,Me);e.plotArea.fitChart?N=Ee.dimensionList:(N=Ee.dimensionList.slice(Z,Z+fe),ne.forEach((P,C)=>ne[C].data=P.data.filter(re=>N.includes(re.dimension))));const q=v.stack().keys(Ee.legendList).offset(v.stackOffsetDiverging)(F);oe();let ue=1/0,B=-1/0;for(const P of q)for(const[C,re]of P)ue=Math.min(ue,C),B=Math.max(B,re);Ee.yMinLeft=ue>0?0:ue,Ee.yMaxLeft=B;let V=t?Tt(e.xAxisLabel.xAxisNumberFormat,Ee.dimensionList).map(P=>P):Ee.dimensionList;Ee.dimensionList.forEach((P,C)=>{Ee.formattedDimensionListMap.set(P,V[C])}),e.plotArea.hideZeroValues&&(Ee.hideZeroValues=!0)},ve=()=>{let _=yt(Ee.yMaxLeft,Ee.yMinLeft,M,e,Ee,Y,H,b,X).yAxisLabelArray;Ee.yMaxLeft=_[_.length-1],Ee.yMinLeft=_[0],i=v.scaleLinear().domain([Ee.yMinLeft>=0?Y!==void 0&&!Number.isNaN(Y)?Y:0:Ee.yMinLeft<0?Ee.yMinLeft*1.1:Ee.yMinLeft*.9,Ee.yMaxLeft<=0?0:H!==void 0&&!Number.isNaN(H)?H:Ee.yMaxLeft*1.1]).range([0,X]),T=[M,0]},Pe=()=>{y=v.scalePoint().domain(N).range(T).padding(.5)},Ye=()=>{{let _=yt(H||Ee.yMaxLeft,Ee.yMinLeft,M,e,Ee,Y,H,b,X);a=v.axisBottom(i).tickFormat(G=>Xe(G,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-M:0).tickValues(_.autoLabelFlag?void 0:_.yAxisLabelArray).ticks(_.customTickValue).tickPadding(8).tickSizeOuter(0)}},We=()=>{f=v.axisLeft(y).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*X*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(N,M,e))},be=_=>{_.forEach(V=>{V.data.forEach(P=>{P.hideZero=V.properties.hideZeroValues,P.axis=V.properties.axis})}),N.forEach(V=>{d.append("rect").attr("id",`dim-background-${V}`).attr("class","dimension-background").attr("y",y(V)-L/2).attr("height",L).attr("x",0).attr("width",X).attr("fill","#E5E5E5").attr("visibility","hidden").lower()});let G=d.selectAll(".parentGroup").data([Te]);G=G.enter().append("g").attr("class","columns parentGroup").attr("clip-path",`url(#${m}-clip)`).merge(G);let Q=G.selectAll(".column-group").data(V=>V);Q=Q.enter().append("g").attr("class",V=>"column-group "+V.key.replace(/ /g,"-")).attr("hoverId",V=>(_[V.index].properties.alias||_[V.index].properties.name||"Legend").replace(/\s+/g,"-")).merge(Q);let F=Q.selectAll("rect").data(V=>V);const q=(V,P)=>{const C=Array.from(Q.nodes()).indexOf(V[P].parentNode);return{props:A[C]?.properties,groupIndex:C}},ue=F.enter().append("rect").merge(F).attr("y",V=>y(V.data.dimension)-L/2).attr("height",L).attr("fill",(V,P,C)=>{const{props:re}=q(C,P);return O.get(re.legendUniqueId)?.(V.data[V.key])??re?.color??"gray"}).attr("stroke",(V,P,C)=>{const re=q(C,P).props;return re?.stackBorderStyle===0?"none":e.column.stackBorderVisibility?re.stackBorderColor:"none"}).attr("stroke-dasharray",(V,P,C)=>q(C,P).props?.stackBorderStyle===2?"5,3":"0").attr("stroke-width",(V,P,C)=>(q(C,P).props?.stackBorderWidth||0)+"px").style("clip-path","inset(0px) fill-box").style("shape-rendering","crispEdges").attr("x",V=>Math.min(i(V[0]),i(V[1]))).attr("width",0).attr("visibility",(V,P,C)=>{const re=q(C,P).props;return V.data[V.key]===0&&re?.hideZeroValues?"hidden":"visible"}).attr(lt.SeriesId,V=>V.key??"").attr(lt.DimValue,V=>Array.isArray(V.data.dimension)?String(V.data.dimension[0]):String(V.data.dimension)).on("mousemove",(V,P)=>{const C=P.data.dimension;ut([{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText.includes("~$~")?e.xAxisTitle.xAxisTitleText.split("~$~")[1]:e.xAxisTitle.xAxisTitleText,value:Ee.formattedDimensionListMap.get(C)},{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():P.properties?.currentMeasure?P.properties.currentMeasure:e.yAxisTitle.yAxisTitleText||P.value,value:Xe(P.data[P.key],e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision)},{key:"Legend",value:P.properties.alias}],e,V,P.properties,At(p,String(C??""),{...P.properties,formattedDimensionValue:String(Ee.formattedDimensionListMap.get(C)??C??"")}))}).on("mouseout",(V,P)=>{P.data.dimension,ot()}).on("click",vt(W,g,(V,P)=>({seriesId:P.key,dimValue:Array.isArray(P.data.dimension)?String(P.data.dimension[0]):String(P.data.dimension),legendUniqueId:P.key,seriesDisplayName:P.properties?.alias||P.properties?.name||""})));ue.attr("x",V=>i(0)),(e.animation.animationEnabled?ue.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):ue).attr("x",V=>Math.min(i(V[0]),i(V[1]))).attr("width",V=>Math.abs(i(V[1])-i(V[0]))),Q.exit().remove(),d.selectAll(".parentGroup").raise()},ze=_=>{X=h-_.left-_.right,M=k-_.bottom-_.top},ke=(_,G,Q)=>{ne=G,N=_,fe=Q,li(n,J,N),oe(),Se()},Se=()=>{Pe(),We(),na(e,d,w,M,X,f,void 0,i,Ee.yMaxLeft,N,u,t,h,ye,L,y);const _=new Map;N.forEach((G,Q)=>{let ee=0;Te.forEach(F=>{const q=F[Q]?.[0]??0;q<ee&&(ee=q)}),_.set(G,ee)}),be(ne),Ya(Te,y,i,void 0,I,pt,[],[],e,u,k,h,X,N,M,m,s,x,0,o,b),ii(J,y,i,I,pt,[],e,u,k,h,s,o,b,_),$(),d.selectAll(".connectors").raise()},oe=()=>{let _=Lt(N,ne,Me);Te=v.stack().keys(Ee.legendList).offset(v.stackOffsetDiverging)(_),ne.forEach((Q,ee)=>Q.data.forEach((F,q)=>{F[0]=Te[ee][q][0],F[1]=Te[ee][q][1]}));let G=e.annotation.annotationSetLabelColor;Te.forEach((Q,ee)=>Q.forEach(F=>{F.key=Q.key,Q.color=JSON.parse(JSON.stringify(A[ee].properties.color)),F.data.labelPosition=A[ee].properties.dataLabelPosition,F.data.labelColor=G=="2"?JSON.parse(JSON.stringify(A[ee].properties.color)):A[ee].properties.labelColor,F.hideZero=JSON.parse(JSON.stringify(A[ee].properties.hideZeroValues)),F.properties=A[ee].properties}))},$=()=>{try{const _=Number(e.connector?.connectorVisibility);if(!e.connector||_===2)return;const G=[],Q=[],ee=[];let F;const q=[];if(_===1)F=1;else if(_===3){const j=Number(e.connector.connectorFollow);j===1?F=Number(e.connector.connectorStepSize):j===2&&((e.connector.connectorExclude||[]).forEach(ie=>ee.push(ie)),F=1)}const ue=[],B=[],V=[],P=e.connector?.connectorCustomRange||[];ee.forEach(j=>{const ie=j.split("-");ie.length&&ue.push(ie[0])});const re=(Te?.[0]||[]).map((j,ie)=>({Dimension:j.data.dimension,Total:j.data.total,CustomTotal:j.data.total-(V[ie]??0),Index:ie}));if(F!=null){for(let j=0;j<re.length;j++)(F===1||j%F===0&&F!==1)&&G.push(re[j]);for(let j=F;j<re.length;j+=F){const ie=Math.min(j+F,re.length);let we=-1/0;for(let de=j;de<ie;de++)re[de].Total>we&&(we=re[de].Total);we!==-1/0&&q.push(we)}for(let j=1;j<G.length;j++)Q.push(G[j])}else{const j=[];(P||[]).forEach(ie=>{if(ie?.from&&ie?.to){const we=re.some(Ae=>Ae.Dimension===ie.from),de=re.some(Ae=>Ae.Dimension===ie.to);we&&de&&j.push({from:ie.from,to:ie.to})}}),j.forEach(ie=>{const we=re.findIndex(Ae=>Ae.Dimension===ie.from),de=re.findIndex(Ae=>Ae.Dimension===ie.to);if(we>=0&&de>=0){const Ae=Math.min(we,de),De=Math.max(we,de);G.push(re[Ae]);let $e=re[Ae]?.Total??-1/0;for(let Fe=Ae;Fe<=De;Fe++)re[Fe].Total>$e&&($e=re[Fe].Total);$e!==-1/0&&q.push($e),Q.push(re[De])}})}d.append("defs").append("marker").attr("id","arrow").attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerWidth",10).attr("markerHeight",7).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("fill",e.connector.connectorMarkerColor!==Ie.white?e.connector.connectorMarkerColor:"none"),R(G,q,Q,F,ue),ae(G,q,Q,F,ue)}catch(_){console.error(_)}},R=(_,G,Q,ee,F)=>{try{const q=y.bandwidth()??0,ue=d.selectAll(".connector-paths").data([0]),B=ue.enter().append("g").attr("class","connector-paths connectors").merge(ue),V=_.filter((re,j)=>ee!=null?j<_.length-1:j<_.length),P=B.selectAll("path.connector-path").data(V,(re,j)=>re?.Dimension??j);P.exit().remove(),P.enter().append("path").attr("class","connector-path").attr("fill","none").attr("marker-end","url(#arrow)").merge(P).attr("d",(re,j)=>{const ie=Q?.[j]??{Total:0,Dimension:re.Dimension},we=re?.Total??0,de=typeof ie.Total=="number"?i(ie.Total):0,Ae=typeof we=="number"?i(we):0,De=Math.max(de,Ae);return e.total.totalVisibility?`M ${Ae+50},
74
74
  ${y(re.Dimension)+q/2-5}
75
75
  H ${60+De}
76
76
  V ${y(ie.Dimension)+q/2+5}
@@ -87,7 +87,7 @@ let E=t<200?200:S?e:t,b=e<200?200:S?t:e,U=E*.15*.8,Y=Ol(r,l),H=U<Y[0]+10?U:Y[0]+
87
87
  H ${45+Math.max(i(_[q]),i(G[q].Total),i(F.Total))}
88
88
  V ${y(G[q].Dimension)+y.bandwidth()/2+5}
89
89
  H ${10+i(G[q].Total)}
90
- `).style("stroke",e.connector.connectorLineColor!==Ie.white?e.connector.connectorLineColor:"none").attr("fill","none").attr("stroke-width",e.connector.connectorLineThickness).attr("marker-end","url(#arrow)").style("visibility",F=>ee.includes(F.Dimension)||F.Total==0&&e.yAxisLabel.hideZeroValues?"hidden":"visible")}catch(F){console.error(F)}},R=(ae,_,G,Q,ee)=>{try{let F=e.connector.connectorFontStyle,q=e.connector.connectorNumberFormat,ue=M/30<N.length?Math.round(M/30):N.length;(e.connector.connectorKPI=="2"||e.connector.connectorKPI=="3")&&(q=".2s"),d.append("g").selectAll("text1").data(ae).enter().filter((B,V)=>Q!=null?V<ae.length-1:V<ae.length).append("text").attr("y",(B,V)=>Q==null?y(G[V].Dimension)/2+y(B.Dimension)/2+15:Q==1?ue<6&&y.bandwidth()>40?y(G[V].Dimension)+y.bandwidth()/2+y.bandwidth()/2+13:y(G[V].Dimension)+y.bandwidth()/2+y.bandwidth()/2+7:y(G[V].Dimension)+y.bandwidth()/2+y.bandwidth()/2*Q+12).attr("x",(B,V)=>e.total.totalVisibility?70+Math.max(i(_[V]),i(G[V].Total),i(B.Total)):50+Math.max(i(_[V]),i(G[V].Total),i(B.Total))).text((B,V)=>(B.CustomTotal==0&&G[V].CustomTotal!=0&&(B.CustomTotal=1),fi(G[V].Total,B.Total,parseInt(e.connector.connectorDecimalPrecision),q,parseInt(B.Dimension),parseInt(G[V].Dimension),e))).attr("text-anchor","start").style("font-size",e.connector.connectorFontSize).style("font-family",e.connector.connectorFontFamily).style("font-style",e.connector.connectorFontStyle).style("fill",e.connector.connectorFontColor!==Ie.white?e.connector.connectorFontColor:"none").style("font-weight","lighter").style("font-style",F.includes("Italic")?"Italic":"").style("text-decoration",F.includes("Underline")?"Underline":"").style("font-weight",F.includes("Bold")?"Bold":"").style("visibility",B=>ee.includes(B.Dimension)||B.Total==0&&e.yAxisLabel.hideZeroValues?"hidden":"visible")}catch(F){console.error(F)}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},fr=({isDateType:t,formatOptions:e,data:n})=>{const o=crypto.randomUUID(),x=0,l=le.ColumnHistogramChart,r=Ce.useRef(),c=n.ChartData,p=n.DimensionList,m=!1,L=!1,u=!1;let S=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,g=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,W=e.xAxisLabel.xAxisIntervalsVisibility?parseFloat(e.xAxisLabel.xAxisMinText):void 0,A=e.xAxisLabel.xAxisIntervalsVisibility?parseFloat(e.xAxisLabel.xAxisMaxText):void 0,E,b,U,Y,H,I,D,w,z,K,ye,se,te,xe,ge,pe=[],he=[],O,X,M,h,k,s,d,i,y,T,a,f=[],N=0;const ne=2;let Z={dimensionList:p,chartType:l,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{fe()}catch(We){me("HorizontalHistogramChart","createHorizontalChart",We)}},[e]);const fe=()=>{({formatOptions:e,svg:k,width:O,height:X}=Ft(r,e)),Re(),{formatOptions:e}=ea(e,c,n.DataTableData??[]),{maxNumberForPrimaryAxis:ye,maxNumberForSecondaryAxis:se}=Rt(e,Z.yMinLeft,Z.yMaxLeft,Z.yMinRight,Z.yMaxRight),{margin:E,yLabel:b,xLabel:U,yTitle:Y,xTitle:H,dimensionHeightWidthArray:I,chartTitleHeight:D,secondaryAxisTitleWidth:w,legendMargin:z,secondaryYLabel:K}=Mt(O,X,ye,se,Z.yMaxLeft,e,Z.legendList,Z.dimensionList,Z.yMaxRight,L,u,t),ve(E),{dataTable:M,dataTableHeight:h}=ia(e,b,Y,c,Z.dimensionList),St(k,O,X,e),s=wt(k,E),kt(s,e,h,te,xe,l),Te(),J(),Ee(),ta(s,Z,U,e,h,d,T,I,X,x,t,te,xe,a,d),Zt(s,e,h,b,y,xe),Pe(c,X,k,E,te),Dt(e,m,k,E,U,X,H,Z.chartType,b,te,xe),Vt(xe,e,h,m,k,E,Y,b),Gt(k,L,E,e,h,xe,te,K,w),Nt(k,e,O,D),It(X,k,I,D,O,z,e,c,o,h,E,ct.rectangle)},Re=()=>{const We=[],be=[];let ze=[],ke=-1/0,Se=1/0;c.forEach(R=>{be.push(R.legend),R.data.forEach(ae=>{We.push(ae),ke=Math.max(ke,ae.value),Se=Math.min(Se,ae.value)})}),Z.chartData=We,Z.legendList=be,Z.yMaxLeft=ke,Z.yMinLeft=Se>0?0:Se,f=JSON.parse(JSON.stringify(c)),f.forEach(R=>R.data.forEach(ae=>ze.push(ae.value)));let oe=S||S==0?S:0,$=g||g==0?g:f[0]?.data?.length;if(Z.yMaxLeft=parseFloat((oe+"").length>($+"").length?oe+"":$+""),Z.xMax=v.max(ze),Z.xMin=v.min(ze),Z.xMin===Z.xMax){const R=Z.xMax===0?1:Math.abs(Z.xMax*.1);Z.xMin-=R,Z.xMax+=R}},Te=()=>{switch(e.bins.binsCalculation){case"Automatic":ge=xe/50;break;case"Number of Bins":Me(!1);break;case"Bin Width":Me(!0)}},Me=We=>{f.forEach(Se=>Se.data.sort((oe,$)=>oe.value-$.value));let be=Z.xMax-Z.xMin,ze;We?(parseFloat(e.bins.binsCalculationValue)<=2&&(e.bins.binsCalculationValue="3"),ze=be/parseFloat(e.bins.binsCalculationValue)):(parseFloat(e.bins.binsCalculationValue)<=1&&(e.bins.binsCalculationValue="1"),ze=be/parseFloat(e.bins.binsCalculationValue));let ke=Z.xMin;if(We)for(pe=[ke];ke<Z.xMax;)ke+=ze,pe.push(ke);else for(pe=[ke];Math.round(ke)<Math.round(Z.xMax);)ke+=ze,pe.push(Math.round(ke))},J=()=>{d=v.scaleLinear().domain([Z.xMin,Z.xMax]).range([xe,0]);const We=pe.length>0?pe:d.ticks(ge);let be=v.bin().value(ke=>ke).domain(d.domain()).thresholds(We);f.forEach(ke=>{let Se=be(ke.data.map(oe=>oe.value));he.push(Se)}),f.forEach((ke,Se)=>he[Se].forEach(oe=>{oe.name=ke.properties.legend,oe.color=ke.properties.color,oe.opacity=ke.properties.opacity}));let ze=[];he.forEach(ke=>ke.forEach(Se=>ze.push(Se.length))),Z.yMaxLeft=v.max(ze),Z.yMinLeft=v.min(ze),i=v.scaleLinear().domain([W||W==0?W:0,A||A==0?A:Z.yMaxLeft+.2*Z.yMaxLeft]).range([0,te])},Ee=()=>{Le();{let We=yt(Z.yMaxLeft,Z.yMinLeft,te,e,Z,S,g,!1,xe);T=v.axisBottom(i).tickFormat(be=>Xe(be,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-xe+0:0).tickValues(We.autoLabelFlag?void 0:We.yAxisLabelArray).ticks(We.customTickValue).tickPadding(8).tickSizeOuter(0)}},Le=()=>{Ti(Z.xMax,Z.xMin,xe,e,W,A,te,!1).xAxisLabelArray.shift(),y=v.axisLeft(d).tickFormat(be=>Xe(be,e.xAxisLabel.xAxisDisplayUnits,e.xAxisLabel.xAxisNumberFormat,e.xAxisLabel.xAxisLabelDecimalPrecision,!1)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-te:0).tickSizeOuter(0),e.bins.binsCalculation==="Automatic"?y.ticks(ge):y.tickValues(pe).ticks(xe/50)},Ue=We=>{const be=e.animation.animationEnabled,ze=s.append("g").attr("class","parentGroup").selectAll("#scaling-svg"+o+" .rect").data(he).enter().append("g").selectAll("rect").data(Se=>Se).enter().append("rect").attr("class","rect").attr("stroke",e.bins.binsBorderVisibility&&e.bins.binsBorderColor).attr("stroke-width",e.bins.binsBorderVisibility&&e.bins.binsBorderThickness).attr("stroke-opacity",e.bins.binsBorderVisibility&&e.bins.binsBorderOpacity).attr("x",0).attr("y",Se=>{const oe=d(Se.x0),$=d(Se.x1);return Math.min(oe,$)}).attr("height",Se=>{const oe=d(Se.x0),$=d(Se.x1),R=parseFloat(e.bins.binsGapWidth)||0;return Math.max(1,Math.abs($-oe)-R)}).attr("width",0).style("fill",Se=>Se.color!==Ie.white?Se.color:"none").style("opacity",e.bins.binsFillOpacity).style("shape-rendering","crispEdges").on("mousemove",(Se,oe)=>{ut([{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():oe.properties?.currentMeasure?oe.properties.currentMeasure:e.yAxisTitle.yAxisTitleText,value:`${oe.x0}-${oe.x1}`},{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText,value:Xe(e.toolTip.toolTipNumberFormat==",.0%"?Math.abs(oe.length/f[0].data.length):oe.length,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision,!1)}],e,Se)}).on("mouseout",ot);(be?ze.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):ze).attr("width",Se=>i(Se.length)),s.selectAll(".parentGroup").raise()},ve=We=>{te=O-We.left-We.right,xe=X-We.bottom-We.top},Pe=(We,be,ze,ke,Se)=>{if(!e.plotArea.fitChart){const oe=We[0].data.length-ne,$=be-20;a=Z.dimensionList.slice(N,N+ne),f=JSON.parse(JSON.stringify(We)),f.forEach((_,G)=>f[G].data=_.data.filter(Q=>a.includes(Q.dimension))),ze.append("rect").attr("x",ke.left).attr("y",$).attr("width",Se).attr("height",8).attr("fill","#ddd").attr("rx",4);const R=Se*ne/Z.dimensionList.length,ae=ze.append("rect").attr("x",ke.left).attr("y",$).attr("width",R).attr("height",8).attr("fill","#999").attr("rx",4).style("cursor","ew-resize").call(v.drag().on("drag",_=>{let G=Math.min(Math.max(_.x,ke.left),ke.left+Se-R);ae.attr("x",G),N=Math.round((G-ke.left)/(Se-R)*oe),a=Z.dimensionList.slice(N,N+ne),f=JSON.parse(JSON.stringify(We)),f.forEach((Q,ee)=>f[ee].data=Q.data.filter(F=>a.includes(F.dimension))),Le(),Ye()}));ze.on("wheel",_=>{_.preventDefault();const G=Math.abs(_.deltaX)>Math.abs(_.deltaY)?_.deltaX:_.deltaY;N+=G>0?1:-1,N=Math.max(0,Math.min(N,oe));const Q=ke.left+(Se-R)*N/oe;ae.attr("x",Q),f=JSON.parse(JSON.stringify(We)),f.forEach((ee,F)=>f[F].data=ee.data.filter(q=>a.includes(q.dimension))),Le(),Ye()})}Ye()},Ye=()=>{Zt(s,e,h,b,y,xe),Ue()};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"className",ref:r,id:o,style:{width:"100%",height:"100%"}})})},Tr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID(),L=0,u=le.AreaChart,S=Ce.useRef(),g=Ce.useRef(c);g.current=c;const W=Ce.useRef(p);W.current=p;const A=mt(n.ChartData,n.DimensionList),E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled;let U=!1;const Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,w=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe,Ye,We=[],be=0,ze,ke,Se,oe=[],$={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{R()}catch(V){me("Linechart","createLineChart",V)}},[e]);const R=()=>{({formatOptions:e,svg:T,width:s,height:d}=Ft(S,e)),ae(),{formatOptions:e,dataTableLegendsList:oe}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:X,maxNumberForSecondaryAxis:M,customYaxisMaxValue:I,secondaryCustomYaxisMaxValue:w}=Rt(e,$.yMinLeft,$.yMaxLeft,$.yMinRight,$.yMaxRight),{margin:z,yLabel:K,xLabel:ye,yTitle:se,xTitle:te,dimensionHeightWidthArray:xe,chartTitleHeight:ge,secondaryAxisTitleWidth:pe,legendMargin:he,secondaryYLabel:O,visibleBars:ze,columnWidth:ke,scrollbarVisible:Se}=Mt(s,d,X,M,$.yMaxLeft,e,$.legendList,$.dimensionList,$.yMaxRight,U,Y,t,b,$,oe),q(z),{dataTable:i,dataTableHeight:y}=ia(e,K,se,A,$.dimensionList,n),b&&(i=[],y=0),St(T,s,d,e),a=wt(T,z),kt(a,e,y,h,k,u,m),_(),Q(),b?(ra(e,a,K,k,h,Ue),U&&Ai(e,a,O,ve,h)):(Zt(a,e,y,K,Re,k),U&&bi(a,e,y,O,Me,k,h)),Dt(e,b,T,z,ye,d,te,$.chartType,K,h,k),Vt(k,e,y,b,T,z,se,K,h),Gt(T,U,z,e,y,k,h,O,pe,b),Nt(T,e,s,ge),It(d,T,xe,ge,s,he,e,A,m,y,z,ct.areaWithLine,u,l),_t(A,d,s,T,z,h,Se,ze,$,be,!1,ue,b)},ae=()=>{const V=[],P=[];let C=[],re=-1/0,j=1/0,ie=-1/0,we=1/0;e.plotArea.hideZeroValues&&($.hideZeroValues=!0,A.forEach(de=>{de.data=de.data.filter(Ae=>Ae.value!==0)})),A.forEach(de=>{P.push(de.properties.alias?de.properties.alias:de.legend),de.data.forEach(Ae=>{V.push(Ae),de.properties.axis==="Secondary"?(U=!0,ie=Math.max(ie,Ae.value),we=Math.min(we,Ae.value)):(re=Math.max(re,Ae.value),j=Math.min(j,Ae.value))})}),$.chartData=V,$.legendList=P,$.yMaxLeft=re,$.yMinLeft=j>0?0:j,$.yMaxRight=ie,$.yMinRight=we>0?0:we,C=t?Tt(e.xAxisLabel.xAxisNumberFormat,$.dimensionList).map(de=>de):$.dimensionList,$.dimensionList.forEach((de,Ae)=>{$.formattedDimensionListMap.set(de,C[Ae])}),We=JSON.parse(JSON.stringify(A)),e.plotArea.fitChart?Ye=$.dimensionList:Ye=$.dimensionList.slice(be,be+ze)},_=()=>{let V=yt(I||$.yMaxLeft,$.yMinLeft,k,e,$,H,I,b,h).yAxisLabelArray;$.yMaxLeft=V[V.length-1],$.yMinLeft=V[0];const P=b?[0,y>0?h-y:h]:[y>0?k-y:k,0];{const C=v.scaleLinear().domain([$.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:0:$.yMinLeft<0?$.yMinLeft*1.1:$.yMinLeft*.9,$.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:$.yMaxLeft*1.1]).range(P);b?Ee=C:f=C}if(U){const C=v.scaleLinear().domain([$.yMinRight>=0?(D||D==0)&&!Number.isNaN(D)?D:0:(D||D==0)&&!Number.isNaN(D)?D:$.yMinRight*1.1,$.yMaxRight<=0?w||0:w||$.yMaxRight*1.1]).range(P);b?Le=C:N=C}if(Z=b?[k,0]:[0,h],!b&&e.seriesLabel.seriesLabelVisibility){let C=la(h,f,e,We,void 0,U,k);C.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(fe=C.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?Z=[0,h-C.heightWidth[0]]:Z=[C.heightWidth[0],h]}},G=()=>{const V=v.scalePoint().domain(Ye).range(Z).padding(e.dataTableProperties&&e.dataTableProperties.dataTable?.5:0);b?J=V:ne=V},Q=()=>{ee();{let V=yt(I||$.yMaxLeft,$.yMinLeft,k,e,$,H,I,b,h);b?Ue=v.axisBottom(Ee).tickFormat(P=>Xe(P,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-k:0).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??h/50).tickPadding(8).tickSizeOuter(0):Re=v.axisLeft(f).tickFormat(P=>Xe(P,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,h,fe)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??k/30).tickPadding(8).tickSizeOuter(0)}if(U){let V=yt(w||$.yMaxRight,D||$.yMinRight,k,e,$,D,w);b?ve=v.axisTop(Le).tickFormat(P=>Xe(P,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??h/30).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-k:0).tickSizeOuter(0):Me=v.axisRight(N).tickFormat(P=>Xe(P,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??k/30).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-h:0).tickSizeOuter(0)}},ee=()=>{b?Pe=v.axisLeft(J).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*h*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(Ye,k,e)):Te=v.axisBottom(ne).tickSize(sa(e,k,y,!0)).tickSizeOuter(0).tickValues(gt(Ye,h,e))},F=V=>{const P=e.plotArea.plotAreaHideLineAndMarkers;V.forEach(De=>{De.data.forEach($e=>{$e.hideZero=De.properties.hideZeroValues,$e.axis=De.properties.axis})});const C=b?v.area().y(De=>{const $e=J(De.dimension);return $e??0}).x0(De=>De.axis===Qe.primary?Ee(0):Le(0)).x1(De=>De.axis===Qe.primary?Ee(De.value):Le(De.value)).defined(De=>De.hideZero?!!De.value:!0).curve(ft(e)):v.area().x(De=>ne(De.dimension)?ne(De.dimension):null).y0(De=>De.axis===Qe.primary?f(0):N(0)).y1(De=>De.axis===Qe.primary?f(De.value):N(De.value)).defined(De=>De.hideZero?!!De.value:!0).curve(ft(e)),re=b?v.area().y(De=>{const $e=J(De.dimension);return $e??0}).x0(()=>Ee(0)).x1(()=>Ee(0)).defined(De=>De.hideZero?!!De.value:!0).curve(ft(e)):v.area().x(De=>ne(De.dimension)?ne(De.dimension):null).y0(()=>f(0)).y1(()=>f(0)).defined(De=>De.hideZero?!!De.value:!0).curve(ft(e)),j=e.animation.animationEnabled;let ie=a.selectAll(".parentGroup").data([V]),we=a.append("g").attr("class","focusClass");ie=ie.enter().append("g").attr("class","areas lineGroup").attr("clip-path",`url(#${m}-clip)`).merge(ie);let de=ie.selectAll(".area-group").data(De=>De),Ae=de.enter().append("g").attr("class","area-group");Ae.append("path").attr("class","area parentGroup").attr("fill",De=>De.properties.color!==Ie.white?De.properties.color:"none").style("fill-opacity",e.plotArea.fillOpacity).style("pointer-events","none").attr("hoverId",De=>(De.properties?.alias||De.properties?.name||"Legend").replace(/\s+/g,"-")).attr("d",De=>re(De.data)).attr(lt.SeriesId,De=>De.properties.legendUniqueId).attr(lt.DimValue,De=>De.properties.alias||De.properties.name||"").on("click",vt(W,g,(De,$e)=>({seriesId:$e.properties.legendUniqueId,dimValue:$e.properties.alias||$e.properties.name||"",legendUniqueId:$e.properties.legendUniqueId,seriesDisplayName:$e.properties.alias||$e.properties.name||""}))).each(function(De){j?v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",C(De.data)):v.select(this).attr("d",C(De.data))}),Ae.merge(de).each(function(De){const $e=v.select(this);$e.selectAll("path.visibleLine").data([De]).join("path").attr("class","visibleLine parentGroup").attr("d",Fe=>j?re(Fe.data):C(Fe.data)).attr("stroke",Fe=>Fe.properties.areaBorderColor!==Ie.white?Fe.properties.areaBorderColor:"none").attr("stroke-dasharray",Fe=>{const _e=parseInt(Fe.properties.lineWidth);switch(Fe.properties.lineStyle){case bt.dotted:return`0,${_e+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",Fe=>Fe.properties.lineStyle===bt.dotted?ya.round:ya.butt).attr("stroke-width",Fe=>P?Fe.properties.lineStyle!==bt.none&&e.plotArea.plotAreaHideLineAndMarkers?Fe.properties.lineWidth:"0":0).attr("fill","none").each(function(Fe){j&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",C(Fe.data))}),$e.selectAll("path.hoverLine").data([De]).join("path").attr("class","hoverLine").attr("d",Fe=>C(Fe.data)).attr("fill",Ie.transparent).attr("stroke","none").style("pointer-events","all").raise(),Li(e,ie,we,Ye,V,b?J:ne,b?Ee:f,u,!1,b)}),de.exit().remove(),Va(ie,V,u,b?J:ne,b?Ee:f,b?Le:N,null,e,$,w,D,H,I,!1,r,b),a.selectAll(".parentGroup").raise(),a.selectAll(".hoverLine").raise()},q=V=>{h=s-V.left-V.right,k=d-V.bottom-V.top},ue=(V,P,C)=>{We=P,Ye=V,ze=C,B()},B=()=>{if(G(),ee(),$a(A,b?J:ne,b?Ee:f,b?Le:N,z,pt,[],[],e,u,d,s,h,Ye,k,m,T,x,void 0,void 0,o,!1,b),b?na(e,a,ye,k,h,Pe,ve,Ee,$.yMaxLeft,Ye,u,t,s,xe,ke,J):ta(a,$,ye,e,y,f,Te,xe,d,L,t,h,k,Ye,ne),F(We),!b){let V=la(h,f,e,We,void 0,U,k).labelArray;ja(e,a,V),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,T,a,i,L,f,ne,void 0,void 0,void 0,y,u,e,K,se,Ye,h,Z,$.formattedDimensionListMap,m,z,k))}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},vr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID(),L=0,u=le.StackAreaChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList)?.reverse()||[],E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M=new Map,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe,Ye=[],We=0,be,ze,ke,Se=[],oe=[];const $=!1;let R={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{ae()}catch(C){me("StackAreaChart","createAreaChart",C)}},[e]);const ae=()=>{({formatOptions:e,svg:T,width:s,height:d}=Ft(S,e)),_(),{formatOptions:e,dataTableLegendsList:Se}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:O,maxNumberForSecondaryAxis:X}=Rt(e,R.yMinLeft,R.yMaxLeft,R.yMinRight,R.yMaxRight),{margin:w,yLabel:z,xLabel:K,yTitle:ye,xTitle:se,dimensionHeightWidthArray:te,chartTitleHeight:xe,secondaryAxisTitleWidth:ge,legendMargin:pe,secondaryYLabel:he,visibleBars:be,columnWidth:ze,scrollbarVisible:ke}=Mt(s,d,O,X,R.yMaxLeft,e,R.legendList,R.dimensionList,R.yMaxRight,U,$,t,b,R,Se),ue(w),{dataTable:i,dataTableHeight:y}=ia(e,z,ye,A,R.dimensionList,n),b&&(i=[],y=0),St(T,s,d,e),a=wt(T,w),kt(a,e,y,h,k,u,m),G(),ee(),b?ra(e,a,z,k,h,Le):Zt(a,e,y,z,Re,k),Dt(e,b,T,w,K,d,se,R.chartType,z,h,k),Vt(k,e,y,b,T,w,ye,z,h),Gt(T,U,w,e,y,k,h,he,ge,b),Nt(T,e,s,xe),It(d,T,te,xe,s,pe,e,[...A].reverse(),m,y,w,ct.areaWithLine,u,l),_t(A,d,s,T,w,h,ke,be,R,We,!1,B,b)},_=()=>{const C=[],re=[];e.plotArea.hideZeroValues&&(R.hideZeroValues=!0,A.forEach(De=>{De.data=De.data.filter($e=>$e.value!==0)})),A.forEach((De,$e)=>{const Fe=`${$e}~$~${De.properties.alias}`;De.properties.legend=Fe,re.push(Fe);for(const _e of De.data)C.push(_e)}),R.chartData=C,R.legendList=re,Ye=JSON.parse(JSON.stringify(A));let j=Lt(R.dimensionList,A,$);e.plotArea.fitChart?Pe=R.dimensionList:(Pe=R.dimensionList.slice(We,We+be),Ye.forEach((De,$e)=>Ye[$e].data=De.data.filter(Fe=>Pe.includes(Fe.dimension))));const ie=v.stack().keys(R.legendList).offset(v.stackOffsetNone)(j);P();let we=1/0,de=-1/0;for(const De of ie)for(const[$e,Fe]of De)we=Math.min(we,$e),de=Math.max(de,Fe);R.yMinLeft=we>0?0:we,R.yMaxLeft=de;let Ae=t?Tt(e.xAxisLabel.xAxisNumberFormat,R.dimensionList).map(De=>De):R.dimensionList;R.dimensionList.forEach((De,$e)=>{R.formattedDimensionListMap.set(De,Ae[$e])})},G=()=>{let C=yt(H||R.yMaxLeft,R.yMinLeft,k,e,R,Y,H,b,h).yAxisLabelArray;R.yMaxLeft=C[C.length-1],R.yMinLeft=C[0];const re=b?[0,y>0?h-y:h]:[y>0?k-y:k,0];{const j=v.scaleLinear().domain([R.yMinLeft>=0?Y!==void 0&&!Number.isNaN(Y)?Y:0:R.yMinLeft<0?R.yMinLeft*1.1:R.yMinLeft*.9,R.yMaxLeft<=0?0:H!==void 0&&!Number.isNaN(H)?H:R.yMaxLeft*1.1]).range(re);b?J=j:f=j}if(Z=b?[k,0]:[0,h],!b&&e.seriesLabel.seriesLabelVisibility){let j=la(h,f,e,A,void 0,U,k,!0);j.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(fe=j.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?Z=[0,h-j.heightWidth[0]]:Z=[j.heightWidth[0],h]}},Q=()=>{const C=v.scalePoint().domain(Pe).range(Z).padding(e.dataTableProperties&&e.dataTableProperties.dataTable?.5:0);b?Me=C:ne=C},ee=()=>{{let C=yt(H||R.yMaxLeft,R.yMinLeft,k,e,R,Y,H,b,h);b?Le=v.axisBottom(J).tickFormat(re=>Xe(re,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-k:0).tickValues(C.autoLabelFlag?void 0:C.yAxisLabelArray).ticks(C.customTickValue??h/50).tickPadding(8).tickSizeOuter(0):Re=v.axisLeft(f).tickFormat(re=>Xe(re,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,h,fe)).tickValues(C.autoLabelFlag?void 0:C.yAxisLabelArray).ticks(C.customTickValue).tickPadding(8).tickSizeOuter(0)}},F=()=>{b?ve=v.axisLeft(Me).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*h*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(Pe,k,e)):Te=v.axisBottom(ne).tickSize(sa(e,k,y,!0)).tickSizeOuter(0).tickValues(gt(Pe,h,e))},q=C=>{const re=e.animation.animationEnabled,j=e.plotArea.plotAreaHideLineAndMarkers;C.forEach(Fe=>{Fe.data.forEach(_e=>{_e.hideZero=Fe.properties.hideZeroValues,_e.axis=Fe.properties.axis})});const ie=b?v.area().y(Fe=>{const _e=Me(Fe.data.dimension);return _e??0}).x0(Fe=>J(Fe[0])).x1(Fe=>J(Fe[1])).defined(Fe=>Fe.data.hideZero?!!Fe.data.key:!0).curve(ft(e)):v.area().x(Fe=>ne(Fe.data.dimension)?ne(Fe.data.dimension):null).y0(Fe=>f(Fe[0])).y1(Fe=>f(Fe[1])).defined(Fe=>Fe.data.hideZero?!!Fe.data.key:!0).curve(ft(e)),we=b?v.area().y(Fe=>{const _e=Me(Fe.data.dimension);return _e??0}).x0(()=>J(0)).x1(()=>J(0)).defined(Fe=>Fe.data.hideZero?!!Fe.data.key:!0).curve(ft(e)):v.area().x(Fe=>ne(Fe.data.dimension)?ne(Fe.data.dimension):null).y0(()=>f(0)).y1(()=>f(0)).defined(Fe=>Fe.data.hideZero?!!Fe.data.key:!0).curve(ft(e));let de=a.selectAll(".lineGroup").data([oe]),Ae=a.append("g").attr("class","focusClass");de=de.enter().append("g").attr("class","areas lineGroup").attr("clip-path",`url(#${m}-clip)`).merge(de);let De=de.selectAll(".area-group").data(Fe=>Fe),$e=De.enter().append("g").attr("class",Fe=>"area-group "+Fe.key.replace(/ /g,"-"));$e.append("path").attr("hoverId",Fe=>(C[Fe.index].properties.alias||C[Fe.index].properties.name||"Legend").replace(/\s+/g,"-")).attr("class","area parentGroup").attr("fill",Fe=>Fe.color!==Ie.white?Fe.color:"none").style("fill-opacity",e.plotArea.fillOpacity).style("pointer-events","none").attr("d",Fe=>we(Fe)).attr(lt.SeriesId,Fe=>A[Fe.index]?.properties?.legendUniqueId??Fe.key).attr(lt.DimValue,Fe=>A[Fe.index]?.properties?.alias||A[Fe.index]?.properties?.name||"").on("click",vt(W,g,(Fe,_e)=>{const it=A[_e.index]?.properties?.legendUniqueId??_e.key,nt=A[_e.index]?.properties?.alias||A[_e.index]?.properties?.name||"";return{seriesId:it,dimValue:nt,legendUniqueId:it,seriesDisplayName:nt}})).each(function(Fe){re?v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",ie(Fe)):v.select(this).attr("d",ie(Fe))}),$e.merge(De).each(function(Fe,_e){const it=v.select(this);it.selectAll("path.visibleLine").data([Fe]).join("path").attr("class","visibleLine parentGroup").attr("d",nt=>re?we(nt):ie(nt)).attr("stroke",nt=>nt.color!==Ie.white?A[_e].properties.areaBorderColor:"none").attr("stroke-dasharray",nt=>{const Ba=parseInt(A[_e].properties.lineWidth.toString());switch(A[_e].properties.lineStyle){case bt.dotted:return`0,${Ba+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",()=>A[_e]?.properties?.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",()=>j?A[_e].properties.lineStyle!==bt.none?A[_e].properties.lineWidth:"0":0).attr("fill","none").style("pointer-events","none").each(function(nt){re&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",ie(nt))}),it.selectAll("path.hoverLine").data([Fe]).join("path").attr("class","hoverLine").attr("d",nt=>ie(nt)).attr("fill",Ie.transparent).attr("stroke","none").style("pointer-events","all").raise(),T.selectAll('[hoverId="'+(A[Fe.index].properties.alias||A[Fe.index].properties.name||"Legend").replace(/ /g,"-")+'"]').classed("highlight",!1).classed("unhighlight",!1)}),De.exit().remove(),Li(e,de,Ae,Pe,C,b?Me:ne,b?J:f,u,!0,b),Va(de,C,u,b?Me:ne,b?J:f,b?Ee:N,null,e,R,D,I,Y,H,!1,p,b),a.selectAll(".parentGroup").raise(),a.selectAll(".hoverLine").raise()},ue=C=>{h=s-C.left-C.right,k=d-C.bottom-C.top},B=(C,re,j)=>{Ye=re,Pe=C,be=j,li(n,M,Pe),P(),V()},V=()=>{if(Q(),F(),b?na(e,a,K,k,h,ve,Ue,J,R.yMaxLeft,Pe,u,t,s,te,ze,Me):ta(a,R,K,e,y,f,Te,te,d,L,t,h,k,Pe,ne),q(Ye),Ya(oe,b?Me:ne,b?J:f,b?Ee:N,w,pt,[],[],e,u,d,s,h,Pe,k,m,T,x,y,o,b),ii(M,b?Me:ne,b?J:f,w,pt,[],e,u,d,s,T,o,b),!b){let C=la(h,f,e,Ye,void 0,U,k,!0).labelArray;ja(e,a,C),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,T,a,i,L,f,ne,void 0,void 0,void 0,y,u,e,z,ye,R.dimensionList,h,Z,R.formattedDimensionListMap,m,w,k))}},P=()=>{let C=Lt(Pe,Ye,$);oe=v.stack().keys(R.legendList).offset(v.stackOffsetNone)(C),Ye.forEach((j,ie)=>j.data.forEach((we,de)=>{we[0]=oe[ie][de][0],we[1]=oe[ie][de][1]}));let re=e.annotation.annotationSetLabelColor;oe.forEach((j,ie)=>j.forEach(we=>{we.key=j.key,j.color=JSON.parse(JSON.stringify(A[ie].properties.color)),we.data.labelPosition=A[ie].properties.dataLabelPosition,we.data.labelColor=re=="2"?JSON.parse(JSON.stringify(A[ie].properties.color)):A[ie].properties.labelColor,we.hideZero=JSON.parse(JSON.stringify(A[ie].properties.hideZeroValues)),we.properties=A[ie].properties}))};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},kr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID(),L=0,u=le.NormalizedStackAreaChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList)?.reverse()||[],E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe=[],Ye=0,We,be,ze,ke=[],Se=[];const oe=!0;let $={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{R()}catch(P){me("NormalizedLinechart","createLineChart",P)}},[e]);const R=()=>{({formatOptions:e,svg:y,width:k,height:s}=Ft(S,e)),ae(),{formatOptions:e,dataTableLegendsList:ke}=ea(e,A,n.DataTableData??[]),{margin:w,yLabel:z,xLabel:K,yTitle:ye,xTitle:se,dimensionHeightWidthArray:te,chartTitleHeight:xe,secondaryAxisTitleWidth:ge,legendMargin:pe,secondaryYLabel:he,visibleBars:We,columnWidth:ze,scrollbarVisible:be}=Mt(k,s,O,X,$.yMaxLeft,e,$.legendList,$.dimensionList,$.yMaxRight,U,oe,t,b,$,ke),q(w),{dataTable:d,dataTableHeight:i}=ia(e,z,ye,A,$.dimensionList,n),b&&(d=[],i=0),St(y,k,s,e),T=wt(y,w),kt(T,e,i,M,h,u),_(),Q(),b?ra(e,T,z,h,M,Ee):Zt(T,e,i,z,fe,h),Dt(e,b,y,w,K,s,se,$.chartType,z,M,h),Vt(h,e,i,b,y,w,ye,z,M),Gt(y,U,w,e,i,h,M,he,ge,b),Nt(y,e,k,xe),It(s,y,te,xe,k,pe,e,[...A].reverse(),m,i,w,ct.areaWithLine,u,l),_t(A,s,k,y,w,M,be,We,$,Ye,!1,ue,b)},ae=()=>{const P=[],C=[];e.plotArea.hideZeroValues&&($.hideZeroValues=!0,A.forEach(de=>{de.data=de.data.filter(Ae=>Ae.value!==0)})),A.forEach((de,Ae)=>{const De=`${Ae}~$~${de.properties.alias}`;de.properties.legend=De,C.push(De);for(const $e of de.data)P.push($e)}),$.chartData=P,$.legendList=C,Pe=JSON.parse(JSON.stringify(A)),e.plotArea.fitChart?ve=$.dimensionList:(ve=$.dimensionList.slice(Ye,Ye+We),Pe.forEach(de=>{de.data=de.data.filter(Ae=>ve.includes(Ae.dimension))}));const re=Lt($.dimensionList,A,oe),j=v.stack().keys($.legendList).offset(v.stackOffsetNone)(re);V();let ie=1/0;for(const de of j)for(const[Ae]of de)ie=Math.min(ie,Ae);$.yMinLeft=ie>0?0:ie,$.yMaxLeft=1;const we=t?Tt(e.xAxisLabel.xAxisNumberFormat,$.dimensionList).map(de=>de):$.dimensionList;$.formattedDimensionListMap=new Map($.dimensionList.map((de,Ae)=>[de,we[Ae]]))},_=()=>{const P=b?[0,i>0?M-i:M]:[i>0?h-i:h,0];{const C=v.scaleLinear().domain([$.yMinLeft<0?-1:0,1]).range(P);b?Me=C:a=C}if(ne=b?[h,0]:[0,M],!b&&e.seriesLabel.seriesLabelVisibility){let C=la(M,a,e,A,void 0,U,h,!0);C.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(Z=C.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?ne=[0,M-C.heightWidth[0]]:ne=[C.heightWidth[0],M]}},G=()=>{const P=v.scalePoint().domain(ve).range(ne).padding(e.dataTableProperties&&e.dataTableProperties.dataTable?.5:0);b?Te=P:N=P},Q=()=>{{const P=e.yAxisLabel.yAxisTicksMode===wa.custom,C=parseInt(e.yAxisLabel.yAxisLabelDecimalPrecision)||0,re=P?za($.yMinLeft<0?-1:0,1,e.yAxisLabel.yAxisTicksCount):null;b?Ee=v.axisBottom(Me).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-h:0).tickValues(re).tickFormat(v.format(`.${C}%`)).ticks(i>0?(M-i)/80:M/80).tickPadding(8).tickSizeOuter(0):fe=v.axisLeft(a).tickSize(zt(e,M,Z)).tickValues(re).tickFormat(v.format(`.${C}%`)).ticks(i>0?(h-i)/80:h/80).tickPadding(8).tickSizeOuter(0)}},ee=()=>{b?Ue=v.axisLeft(Te).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*M*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(ve,h,e)):Re=v.axisBottom(N).tickSize(sa(e,h,i,!0)).tickSizeOuter(0).tickValues(gt(ve,M,e))},F=P=>{const C=e.animation.animationEnabled,re=e.plotArea.plotAreaHideLineAndMarkers;Se.forEach(($e,Fe)=>$e.forEach((_e,it)=>{const nt=_e.data.total;P[Fe].data[it]&&(P[Fe].data[it][0]=_e[0]=nt===0?0:_e[0]/nt,P[Fe].data[it][1]=_e[1]=nt===0?0:_e[1]/nt)})),P.forEach($e=>{$e.data.forEach(Fe=>{Fe.hideZero=$e.properties.hideZeroValues,Fe.axis=$e.properties.axis})});const j=b?v.area().y($e=>{const Fe=Te($e.data.dimension);return Fe??0}).x0($e=>Me($e[0])).x1($e=>Me($e[1])).defined($e=>$e.data.hideZero?!!$e[0]:!0).curve(v.curveLinear):v.area().x($e=>N($e.data.dimension)?N($e.data.dimension):null).y0($e=>a($e[0])).y1($e=>a($e[1])).defined($e=>$e.data.hideZero?!!$e[0]:!0).curve(v.curveLinear),ie=b?v.area().y($e=>{const Fe=Te($e.data.dimension);return Fe??0}).x0(()=>Me(0)).x1(()=>Me(0)).defined($e=>$e.data.hideZero?!!$e.data.key:!0).curve(ft(e)):v.area().x($e=>N($e.data.dimension)?N($e.data.dimension):null).y0(()=>a(0)).y1(()=>a(0)).defined($e=>$e.data.hideZero?!!$e.data.key:!0).curve(ft(e));let we=T.selectAll(".lineGroup").data([Se]),de=T.append("g").attr("class","focusClass");we=we.enter().append("g").attr("class","areas lineGroup").merge(we);let Ae=we.selectAll(".area-group").data($e=>$e),De=Ae.enter().append("g").attr("class",$e=>"area-group "+$e.key.replace(/ /g,"-"));De.append("path").attr("hoverId",$e=>(P[$e.index]?.properties?.alias||P[$e.index]?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("class","area parentGroup").attr("fill",$e=>$e.color!==Ie.white?$e.color:"none").style("fill-opacity",e.plotArea.fillOpacity).style("pointer-events","none").attr("d",$e=>ie($e)).attr(lt.SeriesId,$e=>A[$e.index]?.properties?.legendUniqueId??$e.key).attr(lt.DimValue,$e=>A[$e.index]?.properties?.alias||A[$e.index]?.properties?.name||"").on("click",vt(W,g,($e,Fe)=>{const _e=A[Fe.index]?.properties?.legendUniqueId??Fe.key,it=A[Fe.index]?.properties?.alias||A[Fe.index]?.properties?.name||"";return{seriesId:_e,dimValue:it,legendUniqueId:_e,seriesDisplayName:it}})).each(function($e){const Fe=v.select(this);C?Fe.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",j($e)):Fe.attr("d",j($e))}),De.merge(Ae).each(function($e,Fe){const _e=v.select(this);_e.selectAll("path.visibleLine").data([$e]).join("path").attr("class","visibleLine parentGroup").attr("d",it=>C?ie(it):j(it)).attr("stroke",it=>it.color!==Ie.white?A[Fe].properties.areaBorderColor:"none").attr("stroke-dasharray",it=>{const nt=parseInt(A[Fe].properties.lineWidth.toString());switch(A[Fe].properties.lineStyle){case bt.dotted:return`0,${nt+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",()=>A[Fe]?.properties?.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",()=>re?A[Fe].properties.lineStyle!==bt.none?A[Fe].properties.lineWidth:"0":0).attr("fill","none").style("pointer-events","none").each(function(it){C&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",j(it))}),_e.selectAll("path.hoverLine").data([$e]).join("path").attr("class","hoverLine").attr("d",it=>j(it)).attr("fill",Ie.transparent).style("pointer-events","all").raise(),y.selectAll('[hoverId="'+mi((P[$e.index]?.properties?.alias||P[$e.index]?.properties?.name||"Legend").replace(/ /g,"-"))+'"]').classed("highlight",!1).classed("unhighlight",!1)}),Ae.exit().remove(),Li(e,we,de,ve,P,b?Te:N,b?Me:a,u,!0,b),T.selectAll(".parentGroup").raise(),T.selectAll(".hoverLine").raise(),Va(we,P,u,b?Te:N,b?Me:a,b?J:f,null,e,$,D,I,Y,H,!0,p,b),!b&&e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,y,T,d,L,a,N,void 0,void 0,void 0,i,u,e,z,ye,$.dimensionList,M,ne,$.formattedDimensionListMap,m,w,h))},q=P=>{M=k-P.left-P.right,h=s-P.bottom-P.top},ue=(P,C,re)=>{Pe=C,ve=P,We=re,V(),B()},B=()=>{if(G(),ee(),b?na(e,T,K,h,M,Ue,Le,Me,$.yMaxLeft,ve,u,t,k,te,ze,Te):ta(T,$,K,e,i,a,Re,te,s,L,t,M,h,ve,N),F(Pe),Ya(Se,b?Te:N,b?Me:a,b?J:f,w,pt,[],[],e,u,s,k,M,ve,h,m,y,x,i,o,b),!b){let P=la(M,a,e,Pe,void 0,U,h,!0).labelArray;ja(e,T,P)}},V=()=>{let P=Lt(ve,Pe,oe);Se=v.stack().keys($.legendList).offset(v.stackOffsetNone)(P),Pe.forEach((re,j)=>re.data.forEach((ie,we)=>{Se[j][we]&&(ie[0]=Se[j][we][0],ie[1]=Se[j][we][1])}));let C=e.annotation.annotationSetLabelColor;Se.forEach((re,j)=>re.forEach(ie=>{ie.key=re.key,re.color=JSON.parse(JSON.stringify(A[j].properties.color)),ie.data.labelPosition=A[j].properties.dataLabelPosition,ie.data.labelColor=C=="2"?JSON.parse(JSON.stringify(A[j].properties.color)):A[j].properties.labelColor,ie.hideZero=JSON.parse(JSON.stringify(A[j].properties.hideZeroValues)),ie.properties=A[j].properties}))};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},ni={left:"Left",right:"Right",center:"Center"},Bt={left:"left",right:"right",top:"top",bottom:"bottom"},qa={solid:"solid",dashed:"Dashed",dotted:"Dotted"},si={rounded:"rounded",pill:"pill",extra_rounded:"extra_rounded",squircle:"squircle",rectangle:"rectangle"},ha={curve:"curve",elbow:"elbow",diagonal:"diagonal",s_curve:"s-curve",arc:"arc",reverse_elbow:"reverse-elbow",zigzag:"zigzag"},dl="PieFamilyCommonFunctions.ts",Cr=(t,e,n,o)=>{try{let x=t.total.totalPosition,l=t.total.totalAlignment,r=t.legends.legendPosition,c=0;switch(x){case Fa.top:switch(c=r=="Top"?35:0,l){case Wt.start:return{x:5,y:e+c+10};case Wt.middle:return{x:n/2,y:e+c+10};case Wt.end:return{x:n-20,y:e+c+10}}break;case Fa.bottom:switch(c=r=="Bottom"?30:0,l){case Wt.start:return{x:10,y:o-c-10};case Wt.middle:return{x:n/2,y:o-c-10};case Wt.end:return{x:n-20,y:o-c-10}}break}}catch(x){me(dl,"getTotalValueCords",x)}},Vi=(t,e,n,o,x,l)=>{try{if(t.total&&t.total.totalVisibility){let r=t.total.totalFontStyle,c=t.total.totalAlignment,p=t.total.totalNumberFormat===",.0%"||t.total.totalNumberFormat==="Percentage"?"100%":Ke(t.total.totalDisplayUnits,t.total.totalNumberFormat,t.total.totalDecimalPrecision)(e),m=Cr(t,n,x,l);const L=o.append("g").attr("transform",`translate(${m.x}, ${m.y})`).style("user-select","none");L.append("text").text(t.total.showTotalLabel!==!1?`${t.total.editTotalTextToggle?t.total.editTotalText:"Total"} : ${p}`:p).style("fill",t.total.totalColor!==Ie.white?t.total.totalColor:"none").style("font-family",t.total.totalFontFamily).style("font-size",t.total.totalFontSize).style("font-style",r.includes(ce.italic)?ce.italic:"").style("text-decoration",r.includes(ce.underline)?ce.underline:"").style("font-weight",r.includes(ce.bold)?ce.bold:"").attr("text-anchor",c===Wt.start?"start":c===Wt.middle?"middle":c===Wt.end?"end":""),t.animation?.animationEnabled&&L.attr("opacity",0).transition().duration(t.animation.animationDuration).ease(et[t.animation.animationEffect]).attr("opacity",1)}}catch(r){me(dl,"drawTotalValue",r)}},Ga="PieChart.tsx",Mr=({data:t,formatOptions:e,chartId:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=Ce.useRef(),L=Ce.useRef(r);L.current=r;const u=Ce.useRef(c);u.current=c;const S=mt(t.ChartData);let g,W,A,E=40,b=Jt,U=[0,0],Y,H,I,D,w,z,K,ye,se=!1;Ce.useEffect(()=>{te()},[e]);const te=()=>{({chartFormatOptions:g,svg:w,width:A,height:W}=Kt(m,e)),xe(),U=Ha(g,S),{margins:b,innerHeight:Y,innerWidth:H,legendListWidth:ye,chartTitleHeight:E}=Ua(g,A,W,U,b),ge(),qt(m,A,W,g),D=oa(w,b),Xt(m,E,A,g),Wa(g,w,S,A,W,ye,E,n,b,ct.circle,void 0,l),pe(),he(),g.plotArea.annotationDraggable&&g.plotArea.dataLabels?ol(pt,z,g,O(),le.PieChart,A,W,D,Math.min(Y*.5,H*.5),o,x):M(),Vi(g,K,E,w,A,W)},xe=()=>{try{K=0,t.ChartData.forEach(h=>{h.properties.dataLabelPosition=="2"&&(se=!0),K+=h.data[0].value})}catch(h){me(Ga,"loopOverSeriesData",h)}},ge=()=>{try{I=Math.min(Y*.5,H*.5),se&&(I=I*.9)}catch(h){me(Ga,"defineChartRadius",h)}},pe=()=>{try{let h=rt(g.plotArea.rotation);const k=t.ChartData?.length===1&&t.ChartData[0]?.data[0]?.value===0;z=v.pie().value(i=>Math.abs(k?100:i.data[0].value)).startAngle((h??0)*(Math.PI/180)%360).endAngle(((h??0)+360)*(Math.PI/180)%360)(t.ChartData).map((i,y)=>({...i,x0:i.startAngle,x1:i.endAngle,y0:0,y1:I,depth:2}))}catch(h){me(Ga,"initPieChartData",h)}},he=()=>{try{const h=v.arc().innerRadius(0).outerRadius(I),k=v.arc().innerRadius(0).outerRadius(I+10),s=D.append("g").attr("class","parentGroup").attr("fill-opacity",g.plotArea.opacity).attr("transform",`${O()}`).selectAll("path").data(z).enter().append("path").attr("class",d=>"path").attr("hoverId",d=>(d.data?.properties?.alias||d.data?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("fill",d=>d.data.properties.color!==Ie.white?d.data.properties.color:"none").attr(lt.SeriesId,d=>d.data.properties.legendUniqueId??d.data.properties.name??"").attr(lt.DimValue,d=>d.data.properties.alias||d.data.legend||"").on("click",vt(u,L,(d,i)=>({seriesId:i.data.properties.legendUniqueId??i.data.properties.name??"",dimValue:i.data.properties.alias||i.data.legend||"",legendUniqueId:i.data.properties.legendUniqueId??i.data.properties.name??"",seriesDisplayName:i.data.properties.alias||i.data.properties.name||""}))).on("mouseover.arc",function(d){v.select(this).transition().duration(100).attr("d",k)}).on("mousemove. ",d=>{ut([{key:g.yAxisTitle.yAxisTitleText,value:g.toolTip.toolTipNumberFormat==",.0%"?(Math.abs(d.currentTarget.__data__.data.data[0].value/K)*100).toFixed(rt(g.toolTip.toolTipDecimalPrecision))+"%":Ke(g.toolTip.toolTipDisplayUnits,g.toolTip.toolTipNumberFormat,g.toolTip.toolTipDecimalPrecision)(d.currentTarget.__data__.data.data[0].value)},{key:"Legend",value:d.currentTarget.__data__.data.properties.alias}],g,void 0,d.currentTarget.__data__.data.properties,At(p,String(d.currentTarget.__data__.data.legend??""),d.currentTarget.__data__.data.properties))}).on("mouseout.text",()=>{ot()}).on("mouseout.arc",function(d){v.select(this).transition().duration(100).attr("d",h),ot()});g.animation.animationEnabled?s.transition().duration(g.animation.animationDuration).ease(et[g.animation.animationEffect]).attrTween("d",function(d){const i=v.interpolate({startAngle:d.startAngle,endAngle:d.startAngle},d);return y=>h(i(y))}):s.attr("d",d=>h(d))}catch(h){me(Ga,"drawPieChart",h)}},O=()=>{try{return`translate(${H/2},${Y/2})`}catch(h){return me(Ga,"getPiePosition",h),""}},X=(h,k)=>{try{if(k)return"translate(0 0)";{const s=(h.startAngle+h.endAngle)/2,d=Math.cos(s-Math.PI/2)*(I*.65),i=Math.sin(s-Math.PI/2)*(I*.65);let y=s*180/Math.PI%360,T=0;return y>180&&y<360?T=90:T=-90,y+=T,`translate(${d},${i}) rotate(${y})`}}catch(s){return me(Ga,"getDataLabelTransformString",s),""}},M=()=>{try{if(g.plotArea.dataLabels){const h=z&&z.length===1;D.append("g").attr("class","parentGroup pie-label-group").attr("transform",`${O()}`).attr("pointer-events","none").attr("text-anchor","middle").selectAll("text").data(Ut(z.filter(d=>d.data.properties.dataLabelPosition=="1"),g,d=>d.data.data[0].value)).enter().append("text").attr("hoverId",d=>(d.data?.properties?.alias||d.data?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("font-size",d=>d.data.properties?.labelFontSize??11).attr("fill",d=>d.data.properties?.labelFontColor??Ie.black).attr("font-style",d=>d.data.properties?.labelFontStyle?.includes(ce.italic)?ce.italic:"").attr("text-decoration",d=>d.data.properties?.labelFontStyle?.includes(ce.underline)?ce.underline:"").attr("font-weight",d=>d.data.properties?.labelFontStyle?.includes(ce.bold)?ce.bold:"").attr("font-family",d=>d.data.properties?.labelFont??tt).attr("transform",d=>X(d,h)).attr("visibility",d=>d.endAngle-d.startAngle<.09&&e.plotArea.hideInsignificantValue?"hidden":"visible").attr("dy","-0.35em").attr("text-anchor","middle").attr("alignment-baseline","middle").text(d=>{const{plotArea:i}=g;return i.dataLabelName?d.data.properties?.alias||d.data.legend:""}),D.append("g").attr("class","parentGroup pie-label-group").attr("transform",`${O()}`).attr("pointer-events","none").attr("text-anchor","middle").selectAll("text").data(Ut(z.filter(d=>d.data.properties.dataLabelPosition=="1"),g,d=>d.data.data[0].value)).enter().append("text").attr("hoverId",d=>(d.data?.properties?.alias||d.data?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("font-size",d=>d.data.properties?.valueFontSize??11).attr("fill",d=>d.data.properties?.valueFontColor??Ie.black).attr("font-style",d=>d.data.properties?.valueFontStyle?.includes(ce.italic)?ce.italic:"").attr("text-decoration",d=>d.data.properties?.valueFontStyle?.includes(ce.underline)?ce.underline:"").attr("font-weight",d=>d.data.properties?.valueFontStyle?.includes(ce.bold)?ce.bold:"300").attr("font-family",d=>d.data.properties?.valueFont??tt).attr("transform",d=>X(d,h)).attr("visibility",d=>d.endAngle-d.startAngle<.17?"hidden":"visible").attr("text-anchor","middle").attr("alignment-baseline","middle").attr("dy",g.plotArea.dataLabelName?"1.00em":"0em").text(d=>{if(g.plotArea.dataLabelValue){const i=d.data.data[0].value;return g.plotArea.dataLabelValue&&i!==void 0?g.plotArea.dataLabelNumberFormat===",.0%"?(Math.abs(i/K)*100).toFixed(rt(g.plotArea.dataLabelDecimalPrecision)??0)+"%":Ke(g.plotArea.plotAreaDisplayUnits,g.plotArea.dataLabelNumberFormat,g.plotArea.dataLabelDecimalPrecision)(i):i}}).append("tspan").attr("x",0).attr("y",g.plotArea.dataLabelValue?g.plotArea.dataLabelName?"2.45em":"1.65em":null).attr("font-weight",d=>d.data.properties?.valueFontStyle?.includes(ce.bold)?ce.bold:"300").attr("fill-opacity",.5).text(d=>{const i=Math.abs(d.data.data[0].value);return g.plotArea.plotAreaAbsoluteValue&&i!==void 0?v.format(".2s")(i):""});let k=v.arc().startAngle(d=>d.x0).endAngle(d=>d.x1).innerRadius(d=>d.depth>1?d.y1-1+I/7:0).outerRadius(d=>d.depth>1?d.y1-1+I/7:0),s=v.arc().startAngle(d=>d.x0).endAngle(d=>d.x1).innerRadius(d=>d.depth>2?d.y0:0).outerRadius(d=>d.y1+I/1.5);D.selectAll("polyline.pie-label-connector").data(Ut(z.filter(d=>d.data.properties.dataLabelPosition=="2"),g,d=>d.data.data[0].value)).join("polyline").attr("class","pie-label-connector").attr("transform",O()).style("stroke",d=>g.connector.connectorColorOption=="Uniform"?g.connector.connectorUniformLineColor:d.data.properties.color).style("fill","none").style("stroke-dasharray",g.connector.connectorStyle===qa.solid?0:g.connector.connectorStyle===qa.dotted?1:4).style("stroke-width",g.connector.connectorLineThickness).attr("points",d=>{const i=s.centroid(d),y=k.centroid(d);let T=d.x0+(d.x1-d.x0)/2;T=T%(2*Math.PI);const a=I*1.1*(T<Math.PI?1:-1),f=y[1];return[i,y,[a,f]].map(N=>N.join(",")).join(" ")}),D.append("g").attr("class","pie-label-group").attr("transform",O()).selectAll("foreignObject").data(Ut(z.filter(d=>d.data.properties.dataLabelPosition=="2"),g,d=>d.data.data[0].value)).join("foreignObject").attr("width",80).attr("height",60).attr("x",d=>{let i=d.x0+(d.x1-d.x0)/2;i=i%(2*Math.PI);const T=i<Math.PI?0:-80;return I*1.1*(i<Math.PI?1:-1)+T}).attr("y",d=>k.centroid(d)[1]-30).append("xhtml:div").attr("hoverId",d=>(d.data.properties.alias||d.data.properties.name||"Legend").replace(/\s+/g,"-")).style("display","flex").style("flex-direction","column").style("justify-content","center").style("align-items","center").style("height","60px").html(d=>{let i=d.data.data[0].value.toString();d.data.data[0].value!==void 0&&(i=g.plotArea.dataLabelNumberFormat===",.0%"?(Math.abs(d.data[0].value/K)*100).toFixed(rt(g.plotArea.dataLabelDecimalPrecision))+"%":Ke(g.plotArea.plotAreaDisplayUnits,g.plotArea.dataLabelNumberFormat,g.plotArea.dataLabelDecimalPrecision)(d.data.data[0].value));let y="";return g.plotArea.dataLabelName&&(y+=`<span style="
90
+ `).style("stroke",e.connector.connectorLineColor!==Ie.white?e.connector.connectorLineColor:"none").attr("fill","none").attr("stroke-width",e.connector.connectorLineThickness).attr("marker-end","url(#arrow)").style("visibility",F=>ee.includes(F.Dimension)||F.Total==0&&e.yAxisLabel.hideZeroValues?"hidden":"visible")}catch(F){console.error(F)}},R=(ae,_,G,Q,ee)=>{try{let F=e.connector.connectorFontStyle,q=e.connector.connectorNumberFormat,ue=M/30<N.length?Math.round(M/30):N.length;(e.connector.connectorKPI=="2"||e.connector.connectorKPI=="3")&&(q=".2s"),d.append("g").selectAll("text1").data(ae).enter().filter((B,V)=>Q!=null?V<ae.length-1:V<ae.length).append("text").attr("y",(B,V)=>Q==null?y(G[V].Dimension)/2+y(B.Dimension)/2+15:Q==1?ue<6&&y.bandwidth()>40?y(G[V].Dimension)+y.bandwidth()/2+y.bandwidth()/2+13:y(G[V].Dimension)+y.bandwidth()/2+y.bandwidth()/2+7:y(G[V].Dimension)+y.bandwidth()/2+y.bandwidth()/2*Q+12).attr("x",(B,V)=>e.total.totalVisibility?70+Math.max(i(_[V]),i(G[V].Total),i(B.Total)):50+Math.max(i(_[V]),i(G[V].Total),i(B.Total))).text((B,V)=>(B.CustomTotal==0&&G[V].CustomTotal!=0&&(B.CustomTotal=1),fi(G[V].Total,B.Total,parseInt(e.connector.connectorDecimalPrecision),q,parseInt(B.Dimension),parseInt(G[V].Dimension),e))).attr("text-anchor","start").style("font-size",e.connector.connectorFontSize).style("font-family",e.connector.connectorFontFamily).style("font-style",e.connector.connectorFontStyle).style("fill",e.connector.connectorFontColor!==Ie.white?e.connector.connectorFontColor:"none").style("font-weight","lighter").style("font-style",F.includes("Italic")?"Italic":"").style("text-decoration",F.includes("Underline")?"Underline":"").style("font-weight",F.includes("Bold")?"Bold":"").style("visibility",B=>ee.includes(B.Dimension)||B.Total==0&&e.yAxisLabel.hideZeroValues?"hidden":"visible")}catch(F){console.error(F)}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},fr=({isDateType:t,formatOptions:e,data:n})=>{const o=crypto.randomUUID(),x=0,l=le.ColumnHistogramChart,r=Ce.useRef(),c=n.ChartData,p=n.DimensionList,m=!1,L=!1,u=!1;let S=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,g=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,W=e.xAxisLabel.xAxisIntervalsVisibility?parseFloat(e.xAxisLabel.xAxisMinText):void 0,A=e.xAxisLabel.xAxisIntervalsVisibility?parseFloat(e.xAxisLabel.xAxisMaxText):void 0,E,b,U,Y,H,I,D,w,z,K,ye,se,te,xe,ge,pe=[],he=[],O,X,M,h,k,s,d,i,y,T,a,f=[],N=0;const ne=2;let Z={dimensionList:p,chartType:l,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{fe()}catch(We){me("HorizontalHistogramChart","createHorizontalChart",We)}},[e]);const fe=()=>{({formatOptions:e,svg:k,width:O,height:X}=Ft(r,e)),Re(),{formatOptions:e}=ea(e,c,n.DataTableData??[]),{maxNumberForPrimaryAxis:ye,maxNumberForSecondaryAxis:se}=Rt(e,Z.yMinLeft,Z.yMaxLeft,Z.yMinRight,Z.yMaxRight),{margin:E,yLabel:b,xLabel:U,yTitle:Y,xTitle:H,dimensionHeightWidthArray:I,chartTitleHeight:D,secondaryAxisTitleWidth:w,legendMargin:z,secondaryYLabel:K}=Mt(O,X,ye,se,Z.yMaxLeft,e,Z.legendList,Z.dimensionList,Z.yMaxRight,L,u,t),ve(E),{dataTable:M,dataTableHeight:h}=ia(e,b,Y,c,Z.dimensionList),St(k,O,X,e),s=wt(k,E),kt(s,e,h,te,xe,l),Te(),J(),Ee(),ta(s,Z,U,e,h,d,T,I,X,x,t,te,xe,a,d),Zt(s,e,h,b,y,xe),Pe(c,X,k,E,te),Dt(e,m,k,E,U,X,H,Z.chartType,b,te,xe),Vt(xe,e,h,m,k,E,Y,b),Gt(k,L,E,e,h,xe,te,K,w),Nt(k,e,O,D),It(X,k,I,D,O,z,e,c,o,h,E,ct.rectangle)},Re=()=>{const We=[],be=[];let ze=[],ke=-1/0,Se=1/0;c.forEach(R=>{be.push(R.legend),R.data.forEach(ae=>{We.push(ae),ke=Math.max(ke,ae.value),Se=Math.min(Se,ae.value)})}),Z.chartData=We,Z.legendList=be,Z.yMaxLeft=ke,Z.yMinLeft=Se>0?0:Se,f=JSON.parse(JSON.stringify(c)),f.forEach(R=>R.data.forEach(ae=>ze.push(ae.value)));let oe=S||S==0?S:0,$=g||g==0?g:f[0]?.data?.length;if(Z.yMaxLeft=parseFloat((oe+"").length>($+"").length?oe+"":$+""),Z.xMax=v.max(ze),Z.xMin=v.min(ze),Z.xMin===Z.xMax){const R=Z.xMax===0?1:Math.abs(Z.xMax*.1);Z.xMin-=R,Z.xMax+=R}},Te=()=>{switch(e.bins.binsCalculation){case"Automatic":ge=xe/50;break;case"Number of Bins":Me(!1);break;case"Bin Width":Me(!0)}},Me=We=>{f.forEach(Se=>Se.data.sort((oe,$)=>oe.value-$.value));let be=Z.xMax-Z.xMin,ze;We?(parseFloat(e.bins.binsCalculationValue)<=2&&(e.bins.binsCalculationValue="3"),ze=be/parseFloat(e.bins.binsCalculationValue)):(parseFloat(e.bins.binsCalculationValue)<=1&&(e.bins.binsCalculationValue="1"),ze=be/parseFloat(e.bins.binsCalculationValue));let ke=Z.xMin;if(We)for(pe=[ke];ke<Z.xMax;)ke+=ze,pe.push(ke);else for(pe=[ke];Math.round(ke)<Math.round(Z.xMax);)ke+=ze,pe.push(Math.round(ke))},J=()=>{d=v.scaleLinear().domain([Z.xMin,Z.xMax]).range([xe,0]);const We=pe.length>0?pe:d.ticks(ge);let be=v.bin().value(ke=>ke).domain(d.domain()).thresholds(We);f.forEach(ke=>{let Se=be(ke.data.map(oe=>oe.value));he.push(Se)}),f.forEach((ke,Se)=>he[Se].forEach(oe=>{oe.name=ke.properties.legend,oe.color=ke.properties.color,oe.opacity=ke.properties.opacity}));let ze=[];he.forEach(ke=>ke.forEach(Se=>ze.push(Se.length))),Z.yMaxLeft=v.max(ze),Z.yMinLeft=v.min(ze),i=v.scaleLinear().domain([W||W==0?W:0,A||A==0?A:Z.yMaxLeft+.2*Z.yMaxLeft]).range([0,te])},Ee=()=>{Le();{let We=yt(Z.yMaxLeft,Z.yMinLeft,te,e,Z,S,g,!1,xe);T=v.axisBottom(i).tickFormat(be=>Xe(be,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-xe+0:0).tickValues(We.autoLabelFlag?void 0:We.yAxisLabelArray).ticks(We.customTickValue).tickPadding(8).tickSizeOuter(0)}},Le=()=>{Ti(Z.xMax,Z.xMin,xe,e,W,A,te,!1).xAxisLabelArray.shift(),y=v.axisLeft(d).tickFormat(be=>Xe(be,e.xAxisLabel.xAxisDisplayUnits,e.xAxisLabel.xAxisNumberFormat,e.xAxisLabel.xAxisLabelDecimalPrecision,!1)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-te:0).tickSizeOuter(0),e.bins.binsCalculation==="Automatic"?y.ticks(ge):y.tickValues(pe).ticks(xe/50)},Ue=We=>{const be=e.animation.animationEnabled,ze=s.append("g").attr("class","parentGroup").selectAll("#scaling-svg"+o+" .rect").data(he).enter().append("g").selectAll("rect").data(Se=>Se).enter().append("rect").attr("class","rect").attr("stroke",e.bins.binsBorderVisibility&&e.bins.binsBorderColor).attr("stroke-width",e.bins.binsBorderVisibility&&e.bins.binsBorderThickness).attr("stroke-opacity",e.bins.binsBorderVisibility&&e.bins.binsBorderOpacity).attr("x",0).attr("y",Se=>{const oe=d(Se.x0),$=d(Se.x1);return Math.min(oe,$)}).attr("height",Se=>{const oe=d(Se.x0),$=d(Se.x1),R=parseFloat(e.bins.binsGapWidth)||0;return Math.max(1,Math.abs($-oe)-R)}).attr("width",0).style("fill",Se=>Se.color!==Ie.white?Se.color:"none").style("opacity",e.bins.binsFillOpacity).style("shape-rendering","crispEdges").on("mousemove",(Se,oe)=>{ut([{key:e.yAxisTitle.yAxisTitleHTML!==""?new DOMParser().parseFromString(e.yAxisTitle.yAxisTitleHTML,"text/html").body.textContent?.trim():oe.properties?.currentMeasure?oe.properties.currentMeasure:e.yAxisTitle.yAxisTitleText,value:`${oe.x0}-${oe.x1}`},{key:e.xAxisTitle.xAxisTitleHTML!==""?new DOMParser().parseFromString(e.xAxisTitle.xAxisTitleHTML,"text/html").body.textContent?.trim():e.xAxisTitle.xAxisTitleText,value:Xe(e.toolTip.toolTipNumberFormat==",.0%"?Math.abs(oe.length/f[0].data.length):oe.length,e.toolTip.toolTipDisplayUnits,e.toolTip.toolTipNumberFormat,e.toolTip.toolTipDecimalPrecision,!1)}],e,Se)}).on("mouseout",ot);(be?ze.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]):ze).attr("width",Se=>i(Se.length)),s.selectAll(".parentGroup").raise()},ve=We=>{te=O-We.left-We.right,xe=X-We.bottom-We.top},Pe=(We,be,ze,ke,Se)=>{if(!e.plotArea.fitChart){const oe=We[0].data.length-ne,$=be-20;a=Z.dimensionList.slice(N,N+ne),f=JSON.parse(JSON.stringify(We)),f.forEach((_,G)=>f[G].data=_.data.filter(Q=>a.includes(Q.dimension))),ze.append("rect").attr("x",ke.left).attr("y",$).attr("width",Se).attr("height",8).attr("fill","#ddd").attr("rx",4);const R=Se*ne/Z.dimensionList.length,ae=ze.append("rect").attr("x",ke.left).attr("y",$).attr("width",R).attr("height",8).attr("fill","#999").attr("rx",4).style("cursor","ew-resize").call(v.drag().on("drag",_=>{let G=Math.min(Math.max(_.x,ke.left),ke.left+Se-R);ae.attr("x",G),N=Math.round((G-ke.left)/(Se-R)*oe),a=Z.dimensionList.slice(N,N+ne),f=JSON.parse(JSON.stringify(We)),f.forEach((Q,ee)=>f[ee].data=Q.data.filter(F=>a.includes(F.dimension))),Le(),Ye()}));ze.on("wheel",_=>{_.preventDefault();const G=Math.abs(_.deltaX)>Math.abs(_.deltaY)?_.deltaX:_.deltaY;N+=G>0?1:-1,N=Math.max(0,Math.min(N,oe));const Q=ke.left+(Se-R)*N/oe;ae.attr("x",Q),f=JSON.parse(JSON.stringify(We)),f.forEach((ee,F)=>f[F].data=ee.data.filter(q=>a.includes(q.dimension))),Le(),Ye()})}Ye()},Ye=()=>{Zt(s,e,h,b,y,xe),Ue()};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"className",ref:r,id:o,style:{width:"100%",height:"100%"}})})},Tr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,tooltipFormatter:r,onElementClick:c,vfxPickModeActive:p})=>{const m=crypto.randomUUID(),L=0,u=le.AreaChart,S=Ce.useRef(),g=Ce.useRef(c);g.current=c;const W=Ce.useRef(p);W.current=p;const A=mt(n.ChartData,n.DimensionList),E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled;let U=!1;const Y=!1;let H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,I=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,w=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe,Ye,We=[],be=0,ze,ke,Se,oe=[],$={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{R()}catch(V){me("Linechart","createLineChart",V)}},[e]);const R=()=>{({formatOptions:e,svg:T,width:s,height:d}=Ft(S,e)),ae(),{formatOptions:e,dataTableLegendsList:oe}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:X,maxNumberForSecondaryAxis:M,customYaxisMaxValue:I,secondaryCustomYaxisMaxValue:w}=Rt(e,$.yMinLeft,$.yMaxLeft,$.yMinRight,$.yMaxRight),{margin:z,yLabel:K,xLabel:ye,yTitle:se,xTitle:te,dimensionHeightWidthArray:xe,chartTitleHeight:ge,secondaryAxisTitleWidth:pe,legendMargin:he,secondaryYLabel:O,visibleBars:ze,columnWidth:ke,scrollbarVisible:Se}=Mt(s,d,X,M,$.yMaxLeft,e,$.legendList,$.dimensionList,$.yMaxRight,U,Y,t,b,$,oe),q(z),{dataTable:i,dataTableHeight:y}=ia(e,K,se,A,$.dimensionList,n),b&&(i=[],y=0),St(T,s,d,e),a=wt(T,z),kt(a,e,y,h,k,u,m),_(),Q(),b?(ra(e,a,K,k,h,Ue),U&&Ai(e,a,O,ve,h)):(Zt(a,e,y,K,Re,k),U&&bi(a,e,y,O,Me,k,h)),Dt(e,b,T,z,ye,d,te,$.chartType,K,h,k),Vt(k,e,y,b,T,z,se,K,h),Gt(T,U,z,e,y,k,h,O,pe,b),Nt(T,e,s,ge),It(d,T,xe,ge,s,he,e,A,m,y,z,ct.areaWithLine,u,l),_t(A,d,s,T,z,h,Se,ze,$,be,!1,ue,b)},ae=()=>{const V=[],P=[];let C=[],re=-1/0,j=1/0,ie=-1/0,we=1/0;e.plotArea.hideZeroValues&&($.hideZeroValues=!0,A.forEach(de=>{de.data=de.data.filter(Ae=>Ae.value!==0)})),A.forEach(de=>{P.push(de.properties.alias?de.properties.alias:de.legend),de.data.forEach(Ae=>{V.push(Ae),de.properties.axis==="Secondary"?(U=!0,ie=Math.max(ie,Ae.value),we=Math.min(we,Ae.value)):(re=Math.max(re,Ae.value),j=Math.min(j,Ae.value))})}),$.chartData=V,$.legendList=P,$.yMaxLeft=re,$.yMinLeft=j>0?0:j,$.yMaxRight=ie,$.yMinRight=we>0?0:we,C=t?Tt(e.xAxisLabel.xAxisNumberFormat,$.dimensionList).map(de=>de):$.dimensionList,$.dimensionList.forEach((de,Ae)=>{$.formattedDimensionListMap.set(de,C[Ae])}),We=JSON.parse(JSON.stringify(A)),e.plotArea.fitChart?Ye=$.dimensionList:Ye=$.dimensionList.slice(be,be+ze)},_=()=>{let V=yt(I||$.yMaxLeft,$.yMinLeft,k,e,$,H,I,b,h).yAxisLabelArray;$.yMaxLeft=V[V.length-1],$.yMinLeft=V[0];const P=b?[0,y>0?h-y:h]:[y>0?k-y:k,0];{const C=v.scaleLinear().domain([$.yMinLeft>=0?H!==void 0&&!Number.isNaN(H)?H:0:$.yMinLeft<0?$.yMinLeft*1.1:$.yMinLeft*.9,$.yMaxLeft<=0?0:I!==void 0&&!Number.isNaN(I)?I:$.yMaxLeft*1.1]).range(P);b?Ee=C:f=C}if(U){const C=v.scaleLinear().domain([$.yMinRight>=0?(D||D==0)&&!Number.isNaN(D)?D:0:(D||D==0)&&!Number.isNaN(D)?D:$.yMinRight*1.1,$.yMaxRight<=0?w||0:w||$.yMaxRight*1.1]).range(P);b?Le=C:N=C}if(Z=b?[k,0]:[0,h],!b&&e.seriesLabel.seriesLabelVisibility){let C=la(h,f,e,We,void 0,U,k);C.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(fe=C.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?Z=[0,h-C.heightWidth[0]]:Z=[C.heightWidth[0],h]}},G=()=>{const V=v.scalePoint().domain(Ye).range(Z).padding(e.dataTableProperties&&e.dataTableProperties.dataTable?.5:0);b?J=V:ne=V},Q=()=>{ee();{let V=yt(I||$.yMaxLeft,$.yMinLeft,k,e,$,H,I,b,h);b?Ue=v.axisBottom(Ee).tickFormat(P=>Xe(P,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-k:0).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??h/50).tickPadding(8).tickSizeOuter(0):Re=v.axisLeft(f).tickFormat(P=>Xe(P,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,h,fe)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??k/30).tickPadding(8).tickSizeOuter(0)}if(U){let V=yt(w||$.yMaxRight,D||$.yMinRight,k,e,$,D,w);b?ve=v.axisTop(Le).tickFormat(P=>Xe(P,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??h/30).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-k:0).tickSizeOuter(0):Me=v.axisRight(N).tickFormat(P=>Xe(P,e.secondaryYAxisLabel.secondaryYAxisDisplayUnits,e.secondaryYAxisLabel.secondaryYAxisNumberFormat,e.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision)).tickValues(V.autoLabelFlag?void 0:V.yAxisLabelArray).ticks(V.customTickValue??k/30).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?-h:0).tickSizeOuter(0)}},ee=()=>{b?Pe=v.axisLeft(J).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*h*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(Ye,k,e)):Te=v.axisBottom(ne).tickSize(sa(e,k,y,!0)).tickSizeOuter(0).tickValues(gt(Ye,h,e))},F=V=>{const P=e.plotArea.plotAreaHideLineAndMarkers;V.forEach(De=>{De.data.forEach($e=>{$e.hideZero=De.properties.hideZeroValues,$e.axis=De.properties.axis})});const C=b?v.area().y(De=>{const $e=J(De.dimension);return $e??0}).x0(De=>De.axis===Qe.primary?Ee(0):Le(0)).x1(De=>De.axis===Qe.primary?Ee(De.value):Le(De.value)).defined(De=>De.hideZero?!!De.value:!0).curve(ft(e)):v.area().x(De=>ne(De.dimension)?ne(De.dimension):null).y0(De=>De.axis===Qe.primary?f(0):N(0)).y1(De=>De.axis===Qe.primary?f(De.value):N(De.value)).defined(De=>De.hideZero?!!De.value:!0).curve(ft(e)),re=b?v.area().y(De=>{const $e=J(De.dimension);return $e??0}).x0(()=>Ee(0)).x1(()=>Ee(0)).defined(De=>De.hideZero?!!De.value:!0).curve(ft(e)):v.area().x(De=>ne(De.dimension)?ne(De.dimension):null).y0(()=>f(0)).y1(()=>f(0)).defined(De=>De.hideZero?!!De.value:!0).curve(ft(e)),j=e.animation.animationEnabled;let ie=a.selectAll(".parentGroup").data([V]),we=a.append("g").attr("class","focusClass");ie=ie.enter().append("g").attr("class","areas lineGroup").attr("clip-path",`url(#${m}-clip)`).merge(ie);let de=ie.selectAll(".area-group").data(De=>De),Ae=de.enter().append("g").attr("class","area-group");Ae.append("path").attr("class","area parentGroup").attr("fill",De=>De.properties.color!==Ie.white?De.properties.color:"none").style("fill-opacity",e.plotArea.fillOpacity).style("pointer-events","none").attr("hoverId",De=>(De.properties?.alias||De.properties?.name||"Legend").replace(/\s+/g,"-")).attr("d",De=>re(De.data)).attr(lt.SeriesId,De=>De.properties.legendUniqueId).attr(lt.DimValue,De=>De.properties.alias||De.properties.name||"").on("click",vt(W,g,(De,$e)=>({seriesId:$e.properties.legendUniqueId,dimValue:$e.properties.alias||$e.properties.name||"",legendUniqueId:$e.properties.legendUniqueId,seriesDisplayName:$e.properties.alias||$e.properties.name||""}))).each(function(De){j?v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",C(De.data)):v.select(this).attr("d",C(De.data))}),Ae.merge(de).each(function(De){const $e=v.select(this);$e.selectAll("path.visibleLine").data([De]).join("path").attr("class","visibleLine parentGroup").attr("d",Fe=>j?re(Fe.data):C(Fe.data)).attr("stroke",Fe=>Fe.properties.areaBorderColor!==Ie.white?Fe.properties.areaBorderColor:"none").attr("stroke-dasharray",Fe=>{const _e=parseInt(Fe.properties.lineWidth);switch(Fe.properties.lineStyle){case bt.dotted:return`0,${_e+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",Fe=>Fe.properties.lineStyle===bt.dotted?ya.round:ya.butt).attr("stroke-width",Fe=>P?Fe.properties.lineStyle!==bt.none&&e.plotArea.plotAreaHideLineAndMarkers?Fe.properties.lineWidth:"0":0).attr("fill","none").each(function(Fe){j&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",C(Fe.data))}),$e.selectAll("path.hoverLine").data([De]).join("path").attr("class","hoverLine").attr("d",Fe=>C(Fe.data)).attr("fill",Ie.transparent).attr("stroke","none").style("pointer-events","all").raise(),Li(e,ie,we,Ye,V,b?J:ne,b?Ee:f,u,!1,b)}),de.exit().remove(),Va(ie,V,u,b?J:ne,b?Ee:f,b?Le:N,null,e,$,w,D,H,I,!1,r,b),a.selectAll(".parentGroup").raise(),a.selectAll(".hoverLine").raise()},q=V=>{h=s-V.left-V.right,k=d-V.bottom-V.top},ue=(V,P,C)=>{We=P,Ye=V,ze=C,B()},B=()=>{if(G(),ee(),$a(A,b?J:ne,b?Ee:f,b?Le:N,z,pt,[],[],e,u,d,s,h,Ye,k,m,T,x,void 0,void 0,o,!1,b),b?na(e,a,ye,k,h,Pe,ve,Ee,$.yMaxLeft,Ye,u,t,s,xe,ke,J):ta(a,$,ye,e,y,f,Te,xe,d,L,t,h,k,Ye,ne),F(We),!b){let V=la(h,f,e,We,void 0,U,k).labelArray;ja(e,a,V),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,T,a,i,L,f,ne,void 0,void 0,void 0,y,u,e,K,se,Ye,h,Z,$.formattedDimensionListMap,m,z,k))}};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},vr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID(),L=0,u=le.StackAreaChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList)?.reverse()||[],E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M=new Map,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe,Ye=[],We=0,be,ze,ke,Se=[],oe=[];const $=!1;let R={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{ae()}catch(C){me("StackAreaChart","createAreaChart",C)}},[e]);const ae=()=>{({formatOptions:e,svg:T,width:s,height:d}=Ft(S,e)),_(),{formatOptions:e,dataTableLegendsList:Se}=ea(e,A,n.DataTableData??[]),{maxNumberForPrimaryAxis:O,maxNumberForSecondaryAxis:X}=Rt(e,R.yMinLeft,R.yMaxLeft,R.yMinRight,R.yMaxRight),{margin:w,yLabel:z,xLabel:K,yTitle:ye,xTitle:se,dimensionHeightWidthArray:te,chartTitleHeight:xe,secondaryAxisTitleWidth:ge,legendMargin:pe,secondaryYLabel:he,visibleBars:be,columnWidth:ze,scrollbarVisible:ke}=Mt(s,d,O,X,R.yMaxLeft,e,R.legendList,R.dimensionList,R.yMaxRight,U,$,t,b,R,Se),ue(w),{dataTable:i,dataTableHeight:y}=ia(e,z,ye,A,R.dimensionList,n),b&&(i=[],y=0),St(T,s,d,e),a=wt(T,w),kt(a,e,y,h,k,u,m),G(),ee(),b?ra(e,a,z,k,h,Le):Zt(a,e,y,z,Re,k),Dt(e,b,T,w,K,d,se,R.chartType,z,h,k),Vt(k,e,y,b,T,w,ye,z,h),Gt(T,U,w,e,y,k,h,he,ge,b),Nt(T,e,s,xe),It(d,T,te,xe,s,pe,e,[...A].reverse(),m,y,w,ct.areaWithLine,u,l),_t(A,d,s,T,w,h,ke,be,R,We,!1,B,b)},_=()=>{const C=[],re=[];e.plotArea.hideZeroValues&&(R.hideZeroValues=!0,A.forEach(De=>{De.data=De.data.filter($e=>$e.value!==0)})),A.forEach((De,$e)=>{const Fe=`${$e}~$~${De.properties.alias}`;De.properties.legend=Fe,re.push(Fe);for(const _e of De.data)C.push(_e)}),R.chartData=C,R.legendList=re,Ye=JSON.parse(JSON.stringify(A));let j=Lt(R.dimensionList,A,$);e.plotArea.fitChart?Pe=R.dimensionList:(Pe=R.dimensionList.slice(We,We+be),Ye.forEach((De,$e)=>Ye[$e].data=De.data.filter(Fe=>Pe.includes(Fe.dimension))));const ie=v.stack().keys(R.legendList).offset(v.stackOffsetDiverging)(j);P();let we=1/0,de=-1/0;for(const De of ie)for(const[$e,Fe]of De)we=Math.min(we,$e),de=Math.max(de,Fe);R.yMinLeft=we>0?0:we,R.yMaxLeft=de;let Ae=t?Tt(e.xAxisLabel.xAxisNumberFormat,R.dimensionList).map(De=>De):R.dimensionList;R.dimensionList.forEach((De,$e)=>{R.formattedDimensionListMap.set(De,Ae[$e])})},G=()=>{let C=yt(H||R.yMaxLeft,R.yMinLeft,k,e,R,Y,H,b,h).yAxisLabelArray;R.yMaxLeft=C[C.length-1],R.yMinLeft=C[0];const re=b?[0,y>0?h-y:h]:[y>0?k-y:k,0];{const j=v.scaleLinear().domain([R.yMinLeft>=0?Y!==void 0&&!Number.isNaN(Y)?Y:0:R.yMinLeft<0?R.yMinLeft*1.1:R.yMinLeft*.9,R.yMaxLeft<=0?0:H!==void 0&&!Number.isNaN(H)?H:R.yMaxLeft*1.1]).range(re);b?J=j:f=j}if(Z=b?[k,0]:[0,h],!b&&e.seriesLabel.seriesLabelVisibility){let j=la(h,f,e,A,void 0,U,k,!0);j.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(fe=j.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?Z=[0,h-j.heightWidth[0]]:Z=[j.heightWidth[0],h]}},Q=()=>{const C=v.scalePoint().domain(Pe).range(Z).padding(e.dataTableProperties&&e.dataTableProperties.dataTable?.5:0);b?Me=C:ne=C},ee=()=>{{let C=yt(H||R.yMaxLeft,R.yMinLeft,k,e,R,Y,H,b,h);b?Le=v.axisBottom(J).tickFormat(re=>Xe(re,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-k:0).tickValues(C.autoLabelFlag?void 0:C.yAxisLabelArray).ticks(C.customTickValue??h/50).tickPadding(8).tickSizeOuter(0):Re=v.axisLeft(f).tickFormat(re=>Xe(re,e.yAxisLabel.yAxisDisplayUnits,e.yAxisLabel.yAxisNumberFormat,e.yAxisLabel.yAxisLabelDecimalPrecision)).tickSize(zt(e,h,fe)).tickValues(C.autoLabelFlag?void 0:C.yAxisLabelArray).ticks(C.customTickValue).tickPadding(8).tickSizeOuter(0)}},F=()=>{b?ve=v.axisLeft(Me).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*h*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(Pe,k,e)):Te=v.axisBottom(ne).tickSize(sa(e,k,y,!0)).tickSizeOuter(0).tickValues(gt(Pe,h,e))},q=C=>{const re=e.animation.animationEnabled,j=e.plotArea.plotAreaHideLineAndMarkers;C.forEach(Fe=>{Fe.data.forEach(_e=>{_e.hideZero=Fe.properties.hideZeroValues,_e.axis=Fe.properties.axis})});const ie=b?v.area().y(Fe=>{const _e=Me(Fe.data.dimension);return _e??0}).x0(Fe=>J(Fe[0])).x1(Fe=>J(Fe[1])).defined(Fe=>Fe.data.hideZero?!!Fe.data.key:!0).curve(ft(e)):v.area().x(Fe=>ne(Fe.data.dimension)?ne(Fe.data.dimension):null).y0(Fe=>f(Fe[0])).y1(Fe=>f(Fe[1])).defined(Fe=>Fe.data.hideZero?!!Fe.data.key:!0).curve(ft(e)),we=b?v.area().y(Fe=>{const _e=Me(Fe.data.dimension);return _e??0}).x0(()=>J(0)).x1(()=>J(0)).defined(Fe=>Fe.data.hideZero?!!Fe.data.key:!0).curve(ft(e)):v.area().x(Fe=>ne(Fe.data.dimension)?ne(Fe.data.dimension):null).y0(()=>f(0)).y1(()=>f(0)).defined(Fe=>Fe.data.hideZero?!!Fe.data.key:!0).curve(ft(e));let de=a.selectAll(".lineGroup").data([oe]),Ae=a.append("g").attr("class","focusClass");de=de.enter().append("g").attr("class","areas lineGroup").attr("clip-path",`url(#${m}-clip)`).merge(de);let De=de.selectAll(".area-group").data(Fe=>Fe),$e=De.enter().append("g").attr("class",Fe=>"area-group "+Fe.key.replace(/ /g,"-"));$e.append("path").attr("hoverId",Fe=>(C[Fe.index].properties.alias||C[Fe.index].properties.name||"Legend").replace(/\s+/g,"-")).attr("class","area parentGroup").attr("fill",Fe=>Fe.color!==Ie.white?Fe.color:"none").style("fill-opacity",e.plotArea.fillOpacity).style("pointer-events","none").attr("d",Fe=>we(Fe)).attr(lt.SeriesId,Fe=>A[Fe.index]?.properties?.legendUniqueId??Fe.key).attr(lt.DimValue,Fe=>A[Fe.index]?.properties?.alias||A[Fe.index]?.properties?.name||"").on("click",vt(W,g,(Fe,_e)=>{const it=A[_e.index]?.properties?.legendUniqueId??_e.key,nt=A[_e.index]?.properties?.alias||A[_e.index]?.properties?.name||"";return{seriesId:it,dimValue:nt,legendUniqueId:it,seriesDisplayName:nt}})).each(function(Fe){re?v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",ie(Fe)):v.select(this).attr("d",ie(Fe))}),$e.merge(De).each(function(Fe,_e){const it=v.select(this);it.selectAll("path.visibleLine").data([Fe]).join("path").attr("class","visibleLine parentGroup").attr("d",nt=>re?we(nt):ie(nt)).attr("stroke",nt=>nt.color!==Ie.white?A[_e].properties.areaBorderColor:"none").attr("stroke-dasharray",nt=>{const Ba=parseInt(A[_e].properties.lineWidth.toString());switch(A[_e].properties.lineStyle){case bt.dotted:return`0,${Ba+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",()=>A[_e]?.properties?.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",()=>j?A[_e].properties.lineStyle!==bt.none?A[_e].properties.lineWidth:"0":0).attr("fill","none").style("pointer-events","none").each(function(nt){re&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",ie(nt))}),it.selectAll("path.hoverLine").data([Fe]).join("path").attr("class","hoverLine").attr("d",nt=>ie(nt)).attr("fill",Ie.transparent).attr("stroke","none").style("pointer-events","all").raise(),T.selectAll('[hoverId="'+(A[Fe.index].properties.alias||A[Fe.index].properties.name||"Legend").replace(/ /g,"-")+'"]').classed("highlight",!1).classed("unhighlight",!1)}),De.exit().remove(),Li(e,de,Ae,Pe,C,b?Me:ne,b?J:f,u,!0,b),Va(de,C,u,b?Me:ne,b?J:f,b?Ee:N,null,e,R,D,I,Y,H,!1,p,b),a.selectAll(".parentGroup").raise(),a.selectAll(".hoverLine").raise()},ue=C=>{h=s-C.left-C.right,k=d-C.bottom-C.top},B=(C,re,j)=>{Ye=re,Pe=C,be=j,li(n,M,Pe),P(),V()},V=()=>{if(Q(),F(),b?na(e,a,K,k,h,ve,Ue,J,R.yMaxLeft,Pe,u,t,s,te,ze,Me):ta(a,R,K,e,y,f,Te,te,d,L,t,h,k,Pe,ne),q(Ye),Ya(oe,b?Me:ne,b?J:f,b?Ee:N,w,pt,[],[],e,u,d,s,h,Pe,k,m,T,x,y,o,b),ii(M,b?Me:ne,b?J:f,w,pt,[],e,u,d,s,T,o,b),!b){let C=la(h,f,e,Ye,void 0,U,k,!0).labelArray;ja(e,a,C),e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,T,a,i,L,f,ne,void 0,void 0,void 0,y,u,e,z,ye,R.dimensionList,h,Z,R.formattedDimensionListMap,m,w,k))}},P=()=>{let C=Lt(Pe,Ye,$);oe=v.stack().keys(R.legendList).offset(v.stackOffsetDiverging)(C),Ye.forEach((j,ie)=>j.data.forEach((we,de)=>{we[0]=oe[ie][de][0],we[1]=oe[ie][de][1]}));let re=e.annotation.annotationSetLabelColor;oe.forEach((j,ie)=>j.forEach(we=>{we.key=j.key,j.color=JSON.parse(JSON.stringify(A[ie].properties.color)),we.data.labelPosition=A[ie].properties.dataLabelPosition,we.data.labelColor=re=="2"?JSON.parse(JSON.stringify(A[ie].properties.color)):A[ie].properties.labelColor,we.hideZero=JSON.parse(JSON.stringify(A[ie].properties.hideZeroValues)),we.properties=A[ie].properties}))};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},kr=({isDateType:t,formatOptions:e,data:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=crypto.randomUUID(),L=0,u=le.NormalizedStackAreaChart,S=Ce.useRef(),g=Ce.useRef(r);g.current=r;const W=Ce.useRef(c);W.current=c;const A=mt(n.ChartData,n.DimensionList)?.reverse()||[],E=n.DimensionList,b=!!e.swapAxis?.swapAxisEnabled,U=!1;let Y=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMinText):void 0,H=e.yAxisLabel.yAxisIntervalsVisibility?parseFloat(e.yAxisLabel.yAxisMaxText):void 0,I=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMinText):void 0,D=e.secondaryYAxisLabel.secondaryYAxisIntervalsVisibility?parseFloat(e.secondaryYAxisLabel.secondaryYAxisMaxText):void 0,w,z,K,ye,se,te,xe,ge,pe,he,O,X,M,h,k,s,d,i,y,T,a,f,N,ne,Z,fe,Re,Te,Me,J,Ee,Le,Ue,ve,Pe=[],Ye=0,We,be,ze,ke=[],Se=[];const oe=!0;let $={dimensionList:E,chartType:u,chartData:[],formatOptions:e,legendList:[],secondaryAxisDrawn:!1,yMaxLeft:0,yMaxRight:0,yMinLeft:0,yMinRight:0,hideZeroValues:!1,formattedDimensionListMap:new Map};Ce.useEffect(()=>{try{R()}catch(P){me("NormalizedLinechart","createLineChart",P)}},[e]);const R=()=>{({formatOptions:e,svg:y,width:k,height:s}=Ft(S,e)),ae(),{formatOptions:e,dataTableLegendsList:ke}=ea(e,A,n.DataTableData??[]),{margin:w,yLabel:z,xLabel:K,yTitle:ye,xTitle:se,dimensionHeightWidthArray:te,chartTitleHeight:xe,secondaryAxisTitleWidth:ge,legendMargin:pe,secondaryYLabel:he,visibleBars:We,columnWidth:ze,scrollbarVisible:be}=Mt(k,s,O,X,$.yMaxLeft,e,$.legendList,$.dimensionList,$.yMaxRight,U,oe,t,b,$,ke),q(w),{dataTable:d,dataTableHeight:i}=ia(e,z,ye,A,$.dimensionList,n),b&&(d=[],i=0),St(y,k,s,e),T=wt(y,w),kt(T,e,i,M,h,u),_(),Q(),b?ra(e,T,z,h,M,Ee):Zt(T,e,i,z,fe,h),Dt(e,b,y,w,K,s,se,$.chartType,z,M,h),Vt(h,e,i,b,y,w,ye,z,M),Gt(y,U,w,e,i,h,M,he,ge,b),Nt(y,e,k,xe),It(s,y,te,xe,k,pe,e,[...A].reverse(),m,i,w,ct.areaWithLine,u,l),_t(A,s,k,y,w,M,be,We,$,Ye,!1,ue,b)},ae=()=>{const P=[],C=[];e.plotArea.hideZeroValues&&($.hideZeroValues=!0,A.forEach(de=>{de.data=de.data.filter(Ae=>Ae.value!==0)})),A.forEach((de,Ae)=>{const De=`${Ae}~$~${de.properties.alias}`;de.properties.legend=De,C.push(De);for(const $e of de.data)P.push($e)}),$.chartData=P,$.legendList=C,Pe=JSON.parse(JSON.stringify(A)),e.plotArea.fitChart?ve=$.dimensionList:(ve=$.dimensionList.slice(Ye,Ye+We),Pe.forEach(de=>{de.data=de.data.filter(Ae=>ve.includes(Ae.dimension))}));const re=Lt($.dimensionList,A,oe),j=v.stack().keys($.legendList).offset(v.stackOffsetDiverging)(re);V();let ie=1/0;for(const de of j)for(const[Ae]of de)ie=Math.min(ie,Ae);$.yMinLeft=ie>0?0:ie,$.yMaxLeft=1;const we=t?Tt(e.xAxisLabel.xAxisNumberFormat,$.dimensionList).map(de=>de):$.dimensionList;$.formattedDimensionListMap=new Map($.dimensionList.map((de,Ae)=>[de,we[Ae]]))},_=()=>{const P=b?[0,i>0?M-i:M]:[i>0?h-i:h,0];{const C=v.scaleLinear().domain([$.yMinLeft<0?-1:0,1]).range(P);b?Me=C:a=C}if(ne=b?[h,0]:[0,M],!b&&e.seriesLabel.seriesLabelVisibility){let C=la(M,a,e,A,void 0,U,h,!0);C.labelArray,e.seriesLabel.seriesLabelPosition=="Right"&&(Z=C.heightWidth[0]),e.seriesLabel.seriesLabelPosition=="Right"?ne=[0,M-C.heightWidth[0]]:ne=[C.heightWidth[0],M]}},G=()=>{const P=v.scalePoint().domain(ve).range(ne).padding(e.dataTableProperties&&e.dataTableProperties.dataTable?.5:0);b?Te=P:N=P},Q=()=>{{const P=e.yAxisLabel.yAxisTicksMode===wa.custom,C=parseInt(e.yAxisLabel.yAxisLabelDecimalPrecision)||0,re=P?za($.yMinLeft<0?-1:0,1,e.yAxisLabel.yAxisTicksCount):null;b?Ee=v.axisBottom(Me).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesVertical?-h:0).tickValues(re).tickFormat(v.format(`.${C}%`)).ticks(i>0?(M-i)/80:M/80).tickPadding(8).tickSizeOuter(0):fe=v.axisLeft(a).tickSize(zt(e,M,Z)).tickValues(re).tickFormat(v.format(`.${C}%`)).ticks(i>0?(h-i)/80:h/80).tickPadding(8).tickSizeOuter(0)}},ee=()=>{b?Ue=v.axisLeft(Te).tickSize(e.plotArea.gridLinesVisibility&&e.plotArea.gridLinesHorizontal?parseFloat(e.plotArea.ticksHeight)*M*(e.xAxisLabel.xAxisPosition=="1"?1:-1)*.01:0).tickSizeOuter(0).tickValues(gt(ve,h,e)):Re=v.axisBottom(N).tickSize(sa(e,h,i,!0)).tickSizeOuter(0).tickValues(gt(ve,M,e))},F=P=>{const C=e.animation.animationEnabled,re=e.plotArea.plotAreaHideLineAndMarkers;Se.forEach(($e,Fe)=>$e.forEach((_e,it)=>{const nt=_e.data.total;P[Fe].data[it]&&(P[Fe].data[it][0]=_e[0]=nt===0?0:_e[0]/nt,P[Fe].data[it][1]=_e[1]=nt===0?0:_e[1]/nt)})),P.forEach($e=>{$e.data.forEach(Fe=>{Fe.hideZero=$e.properties.hideZeroValues,Fe.axis=$e.properties.axis})});const j=b?v.area().y($e=>{const Fe=Te($e.data.dimension);return Fe??0}).x0($e=>Me($e[0])).x1($e=>Me($e[1])).defined($e=>$e.data.hideZero?!!$e[0]:!0).curve(v.curveLinear):v.area().x($e=>N($e.data.dimension)?N($e.data.dimension):null).y0($e=>a($e[0])).y1($e=>a($e[1])).defined($e=>$e.data.hideZero?!!$e[0]:!0).curve(v.curveLinear),ie=b?v.area().y($e=>{const Fe=Te($e.data.dimension);return Fe??0}).x0(()=>Me(0)).x1(()=>Me(0)).defined($e=>$e.data.hideZero?!!$e.data.key:!0).curve(ft(e)):v.area().x($e=>N($e.data.dimension)?N($e.data.dimension):null).y0(()=>a(0)).y1(()=>a(0)).defined($e=>$e.data.hideZero?!!$e.data.key:!0).curve(ft(e));let we=T.selectAll(".lineGroup").data([Se]),de=T.append("g").attr("class","focusClass");we=we.enter().append("g").attr("class","areas lineGroup").merge(we);let Ae=we.selectAll(".area-group").data($e=>$e),De=Ae.enter().append("g").attr("class",$e=>"area-group "+$e.key.replace(/ /g,"-"));De.append("path").attr("hoverId",$e=>(P[$e.index]?.properties?.alias||P[$e.index]?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("class","area parentGroup").attr("fill",$e=>$e.color!==Ie.white?$e.color:"none").style("fill-opacity",e.plotArea.fillOpacity).style("pointer-events","none").attr("d",$e=>ie($e)).attr(lt.SeriesId,$e=>A[$e.index]?.properties?.legendUniqueId??$e.key).attr(lt.DimValue,$e=>A[$e.index]?.properties?.alias||A[$e.index]?.properties?.name||"").on("click",vt(W,g,($e,Fe)=>{const _e=A[Fe.index]?.properties?.legendUniqueId??Fe.key,it=A[Fe.index]?.properties?.alias||A[Fe.index]?.properties?.name||"";return{seriesId:_e,dimValue:it,legendUniqueId:_e,seriesDisplayName:it}})).each(function($e){const Fe=v.select(this);C?Fe.transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",j($e)):Fe.attr("d",j($e))}),De.merge(Ae).each(function($e,Fe){const _e=v.select(this);_e.selectAll("path.visibleLine").data([$e]).join("path").attr("class","visibleLine parentGroup").attr("d",it=>C?ie(it):j(it)).attr("stroke",it=>it.color!==Ie.white?A[Fe].properties.areaBorderColor:"none").attr("stroke-dasharray",it=>{const nt=parseInt(A[Fe].properties.lineWidth.toString());switch(A[Fe].properties.lineStyle){case bt.dotted:return`0,${nt+2}`;case bt.dashed:return fa;default:return""}}).attr("stroke-linecap",()=>A[Fe]?.properties?.lineStyle===bt.dotted?ya.round:"").attr("stroke-width",()=>re?A[Fe].properties.lineStyle!==bt.none?A[Fe].properties.lineWidth:"0":0).attr("fill","none").style("pointer-events","none").each(function(it){C&&v.select(this).transition().duration(e.animation.animationDuration).ease(et[e.animation.animationEffect]).attr("d",j(it))}),_e.selectAll("path.hoverLine").data([$e]).join("path").attr("class","hoverLine").attr("d",it=>j(it)).attr("fill",Ie.transparent).style("pointer-events","all").raise(),y.selectAll('[hoverId="'+mi((P[$e.index]?.properties?.alias||P[$e.index]?.properties?.name||"Legend").replace(/ /g,"-"))+'"]').classed("highlight",!1).classed("unhighlight",!1)}),Ae.exit().remove(),Li(e,we,de,ve,P,b?Te:N,b?Me:a,u,!0,b),T.selectAll(".parentGroup").raise(),T.selectAll(".hoverLine").raise(),Va(we,P,u,b?Te:N,b?Me:a,b?J:f,null,e,$,D,I,Y,H,!0,p,b),!b&&e.dataTableProperties&&e.dataTableProperties.dataTable&&(e.xAxisLabel.xAxisPosition!="1"&&(e.xAxisLabel.xAxisLabelVisibility=!1),ua(e.plotArea.fitChart,y,T,d,L,a,N,void 0,void 0,void 0,i,u,e,z,ye,$.dimensionList,M,ne,$.formattedDimensionListMap,m,w,h))},q=P=>{M=k-P.left-P.right,h=s-P.bottom-P.top},ue=(P,C,re)=>{Pe=C,ve=P,We=re,V(),B()},B=()=>{if(G(),ee(),b?na(e,T,K,h,M,Ue,Le,Me,$.yMaxLeft,ve,u,t,k,te,ze,Te):ta(T,$,K,e,i,a,Re,te,s,L,t,M,h,ve,N),F(Pe),Ya(Se,b?Te:N,b?Me:a,b?J:f,w,pt,[],[],e,u,s,k,M,ve,h,m,y,x,i,o,b),!b){let P=la(M,a,e,Pe,void 0,U,h,!0).labelArray;ja(e,T,P)}},V=()=>{let P=Lt(ve,Pe,oe);Se=v.stack().keys($.legendList).offset(v.stackOffsetDiverging)(P),Pe.forEach((re,j)=>re.data.forEach((ie,we)=>{Se[j][we]&&(ie[0]=Se[j][we][0],ie[1]=Se[j][we][1])}));let C=e.annotation.annotationSetLabelColor;Se.forEach((re,j)=>re.forEach(ie=>{ie.key=re.key,re.color=JSON.parse(JSON.stringify(A[j].properties.color)),ie.data.labelPosition=A[j].properties.dataLabelPosition,ie.data.labelColor=C=="2"?JSON.parse(JSON.stringify(A[j].properties.color)):A[j].properties.labelColor,ie.hideZero=JSON.parse(JSON.stringify(A[j].properties.hideZeroValues)),ie.properties=A[j].properties}))};return Ge.jsx("div",{style:{width:"100%",height:"100%"},children:Ge.jsx("svg",{className:"chartSVG",ref:S,id:m,style:{width:"100%",height:"100%"}})})},ni={left:"Left",right:"Right",center:"Center"},Bt={left:"left",right:"right",top:"top",bottom:"bottom"},qa={solid:"solid",dashed:"Dashed",dotted:"Dotted"},si={rounded:"rounded",pill:"pill",extra_rounded:"extra_rounded",squircle:"squircle",rectangle:"rectangle"},ha={curve:"curve",elbow:"elbow",diagonal:"diagonal",s_curve:"s-curve",arc:"arc",reverse_elbow:"reverse-elbow",zigzag:"zigzag"},dl="PieFamilyCommonFunctions.ts",Cr=(t,e,n,o)=>{try{let x=t.total.totalPosition,l=t.total.totalAlignment,r=t.legends.legendPosition,c=0;switch(x){case Fa.top:switch(c=r=="Top"?35:0,l){case Wt.start:return{x:5,y:e+c+10};case Wt.middle:return{x:n/2,y:e+c+10};case Wt.end:return{x:n-20,y:e+c+10}}break;case Fa.bottom:switch(c=r=="Bottom"?30:0,l){case Wt.start:return{x:10,y:o-c-10};case Wt.middle:return{x:n/2,y:o-c-10};case Wt.end:return{x:n-20,y:o-c-10}}break}}catch(x){me(dl,"getTotalValueCords",x)}},Vi=(t,e,n,o,x,l)=>{try{if(t.total&&t.total.totalVisibility){let r=t.total.totalFontStyle,c=t.total.totalAlignment,p=t.total.totalNumberFormat===",.0%"||t.total.totalNumberFormat==="Percentage"?"100%":Ke(t.total.totalDisplayUnits,t.total.totalNumberFormat,t.total.totalDecimalPrecision)(e),m=Cr(t,n,x,l);const L=o.append("g").attr("transform",`translate(${m.x}, ${m.y})`).style("user-select","none");L.append("text").text(t.total.showTotalLabel!==!1?`${t.total.editTotalTextToggle?t.total.editTotalText:"Total"} : ${p}`:p).style("fill",t.total.totalColor!==Ie.white?t.total.totalColor:"none").style("font-family",t.total.totalFontFamily).style("font-size",t.total.totalFontSize).style("font-style",r.includes(ce.italic)?ce.italic:"").style("text-decoration",r.includes(ce.underline)?ce.underline:"").style("font-weight",r.includes(ce.bold)?ce.bold:"").attr("text-anchor",c===Wt.start?"start":c===Wt.middle?"middle":c===Wt.end?"end":""),t.animation?.animationEnabled&&L.attr("opacity",0).transition().duration(t.animation.animationDuration).ease(et[t.animation.animationEffect]).attr("opacity",1)}}catch(r){me(dl,"drawTotalValue",r)}},Ga="PieChart.tsx",Mr=({data:t,formatOptions:e,chartId:n,isReportEditable:o,onDataLabelCoordinatesChange:x,addLocalFilterFromLib:l,onElementClick:r,vfxPickModeActive:c,tooltipFormatter:p})=>{const m=Ce.useRef(),L=Ce.useRef(r);L.current=r;const u=Ce.useRef(c);u.current=c;const S=mt(t.ChartData);let g,W,A,E=40,b=Jt,U=[0,0],Y,H,I,D,w,z,K,ye,se=!1;Ce.useEffect(()=>{te()},[e]);const te=()=>{({chartFormatOptions:g,svg:w,width:A,height:W}=Kt(m,e)),xe(),U=Ha(g,S),{margins:b,innerHeight:Y,innerWidth:H,legendListWidth:ye,chartTitleHeight:E}=Ua(g,A,W,U,b),ge(),qt(m,A,W,g),D=oa(w,b),Xt(m,E,A,g),Wa(g,w,S,A,W,ye,E,n,b,ct.circle,void 0,l),pe(),he(),g.plotArea.annotationDraggable&&g.plotArea.dataLabels?ol(pt,z,g,O(),le.PieChart,A,W,D,Math.min(Y*.5,H*.5),o,x):M(),Vi(g,K,E,w,A,W)},xe=()=>{try{K=0,t.ChartData.forEach(h=>{h.properties.dataLabelPosition=="2"&&(se=!0),K+=h.data[0].value})}catch(h){me(Ga,"loopOverSeriesData",h)}},ge=()=>{try{I=Math.min(Y*.5,H*.5),se&&(I=I*.9)}catch(h){me(Ga,"defineChartRadius",h)}},pe=()=>{try{let h=rt(g.plotArea.rotation);const k=t.ChartData?.length===1&&t.ChartData[0]?.data[0]?.value===0;z=v.pie().value(i=>Math.abs(k?100:i.data[0].value)).startAngle((h??0)*(Math.PI/180)%360).endAngle(((h??0)+360)*(Math.PI/180)%360)(t.ChartData).map((i,y)=>({...i,x0:i.startAngle,x1:i.endAngle,y0:0,y1:I,depth:2}))}catch(h){me(Ga,"initPieChartData",h)}},he=()=>{try{const h=v.arc().innerRadius(0).outerRadius(I),k=v.arc().innerRadius(0).outerRadius(I+10),s=D.append("g").attr("class","parentGroup").attr("fill-opacity",g.plotArea.opacity).attr("transform",`${O()}`).selectAll("path").data(z).enter().append("path").attr("class",d=>"path").attr("hoverId",d=>(d.data?.properties?.alias||d.data?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("fill",d=>d.data.properties.color!==Ie.white?d.data.properties.color:"none").attr(lt.SeriesId,d=>d.data.properties.legendUniqueId??d.data.properties.name??"").attr(lt.DimValue,d=>d.data.properties.alias||d.data.legend||"").on("click",vt(u,L,(d,i)=>({seriesId:i.data.properties.legendUniqueId??i.data.properties.name??"",dimValue:i.data.properties.alias||i.data.legend||"",legendUniqueId:i.data.properties.legendUniqueId??i.data.properties.name??"",seriesDisplayName:i.data.properties.alias||i.data.properties.name||""}))).on("mouseover.arc",function(d){v.select(this).transition().duration(100).attr("d",k)}).on("mousemove. ",d=>{ut([{key:g.yAxisTitle.yAxisTitleText,value:g.toolTip.toolTipNumberFormat==",.0%"?(Math.abs(d.currentTarget.__data__.data.data[0].value/K)*100).toFixed(rt(g.toolTip.toolTipDecimalPrecision))+"%":Ke(g.toolTip.toolTipDisplayUnits,g.toolTip.toolTipNumberFormat,g.toolTip.toolTipDecimalPrecision)(d.currentTarget.__data__.data.data[0].value)},{key:"Legend",value:d.currentTarget.__data__.data.properties.alias}],g,void 0,d.currentTarget.__data__.data.properties,At(p,String(d.currentTarget.__data__.data.legend??""),d.currentTarget.__data__.data.properties))}).on("mouseout.text",()=>{ot()}).on("mouseout.arc",function(d){v.select(this).transition().duration(100).attr("d",h),ot()});g.animation.animationEnabled?s.transition().duration(g.animation.animationDuration).ease(et[g.animation.animationEffect]).attrTween("d",function(d){const i=v.interpolate({startAngle:d.startAngle,endAngle:d.startAngle},d);return y=>h(i(y))}):s.attr("d",d=>h(d))}catch(h){me(Ga,"drawPieChart",h)}},O=()=>{try{return`translate(${H/2},${Y/2})`}catch(h){return me(Ga,"getPiePosition",h),""}},X=(h,k)=>{try{if(k)return"translate(0 0)";{const s=(h.startAngle+h.endAngle)/2,d=Math.cos(s-Math.PI/2)*(I*.65),i=Math.sin(s-Math.PI/2)*(I*.65);let y=s*180/Math.PI%360,T=0;return y>180&&y<360?T=90:T=-90,y+=T,`translate(${d},${i}) rotate(${y})`}}catch(s){return me(Ga,"getDataLabelTransformString",s),""}},M=()=>{try{if(g.plotArea.dataLabels){const h=z&&z.length===1;D.append("g").attr("class","parentGroup pie-label-group").attr("transform",`${O()}`).attr("pointer-events","none").attr("text-anchor","middle").selectAll("text").data(Ut(z.filter(d=>d.data.properties.dataLabelPosition=="1"),g,d=>d.data.data[0].value)).enter().append("text").attr("hoverId",d=>(d.data?.properties?.alias||d.data?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("font-size",d=>d.data.properties?.labelFontSize??11).attr("fill",d=>d.data.properties?.labelFontColor??Ie.black).attr("font-style",d=>d.data.properties?.labelFontStyle?.includes(ce.italic)?ce.italic:"").attr("text-decoration",d=>d.data.properties?.labelFontStyle?.includes(ce.underline)?ce.underline:"").attr("font-weight",d=>d.data.properties?.labelFontStyle?.includes(ce.bold)?ce.bold:"").attr("font-family",d=>d.data.properties?.labelFont??tt).attr("transform",d=>X(d,h)).attr("visibility",d=>d.endAngle-d.startAngle<.09&&e.plotArea.hideInsignificantValue?"hidden":"visible").attr("dy","-0.35em").attr("text-anchor","middle").attr("alignment-baseline","middle").text(d=>{const{plotArea:i}=g;return i.dataLabelName?d.data.properties?.alias||d.data.legend:""}),D.append("g").attr("class","parentGroup pie-label-group").attr("transform",`${O()}`).attr("pointer-events","none").attr("text-anchor","middle").selectAll("text").data(Ut(z.filter(d=>d.data.properties.dataLabelPosition=="1"),g,d=>d.data.data[0].value)).enter().append("text").attr("hoverId",d=>(d.data?.properties?.alias||d.data?.properties?.name||"Legend").replace(/\s+/g,"-")).attr("font-size",d=>d.data.properties?.valueFontSize??11).attr("fill",d=>d.data.properties?.valueFontColor??Ie.black).attr("font-style",d=>d.data.properties?.valueFontStyle?.includes(ce.italic)?ce.italic:"").attr("text-decoration",d=>d.data.properties?.valueFontStyle?.includes(ce.underline)?ce.underline:"").attr("font-weight",d=>d.data.properties?.valueFontStyle?.includes(ce.bold)?ce.bold:"300").attr("font-family",d=>d.data.properties?.valueFont??tt).attr("transform",d=>X(d,h)).attr("visibility",d=>d.endAngle-d.startAngle<.17?"hidden":"visible").attr("text-anchor","middle").attr("alignment-baseline","middle").attr("dy",g.plotArea.dataLabelName?"1.00em":"0em").text(d=>{if(g.plotArea.dataLabelValue){const i=d.data.data[0].value;return g.plotArea.dataLabelValue&&i!==void 0?g.plotArea.dataLabelNumberFormat===",.0%"?(Math.abs(i/K)*100).toFixed(rt(g.plotArea.dataLabelDecimalPrecision)??0)+"%":Ke(g.plotArea.plotAreaDisplayUnits,g.plotArea.dataLabelNumberFormat,g.plotArea.dataLabelDecimalPrecision)(i):i}}).append("tspan").attr("x",0).attr("y",g.plotArea.dataLabelValue?g.plotArea.dataLabelName?"2.45em":"1.65em":null).attr("font-weight",d=>d.data.properties?.valueFontStyle?.includes(ce.bold)?ce.bold:"300").attr("fill-opacity",.5).text(d=>{const i=Math.abs(d.data.data[0].value);return g.plotArea.plotAreaAbsoluteValue&&i!==void 0?v.format(".2s")(i):""});let k=v.arc().startAngle(d=>d.x0).endAngle(d=>d.x1).innerRadius(d=>d.depth>1?d.y1-1+I/7:0).outerRadius(d=>d.depth>1?d.y1-1+I/7:0),s=v.arc().startAngle(d=>d.x0).endAngle(d=>d.x1).innerRadius(d=>d.depth>2?d.y0:0).outerRadius(d=>d.y1+I/1.5);D.selectAll("polyline.pie-label-connector").data(Ut(z.filter(d=>d.data.properties.dataLabelPosition=="2"),g,d=>d.data.data[0].value)).join("polyline").attr("class","pie-label-connector").attr("transform",O()).style("stroke",d=>g.connector.connectorColorOption=="Uniform"?g.connector.connectorUniformLineColor:d.data.properties.color).style("fill","none").style("stroke-dasharray",g.connector.connectorStyle===qa.solid?0:g.connector.connectorStyle===qa.dotted?1:4).style("stroke-width",g.connector.connectorLineThickness).attr("points",d=>{const i=s.centroid(d),y=k.centroid(d);let T=d.x0+(d.x1-d.x0)/2;T=T%(2*Math.PI);const a=I*1.1*(T<Math.PI?1:-1),f=y[1];return[i,y,[a,f]].map(N=>N.join(",")).join(" ")}),D.append("g").attr("class","pie-label-group").attr("transform",O()).selectAll("foreignObject").data(Ut(z.filter(d=>d.data.properties.dataLabelPosition=="2"),g,d=>d.data.data[0].value)).join("foreignObject").attr("width",80).attr("height",60).attr("x",d=>{let i=d.x0+(d.x1-d.x0)/2;i=i%(2*Math.PI);const T=i<Math.PI?0:-80;return I*1.1*(i<Math.PI?1:-1)+T}).attr("y",d=>k.centroid(d)[1]-30).append("xhtml:div").attr("hoverId",d=>(d.data.properties.alias||d.data.properties.name||"Legend").replace(/\s+/g,"-")).style("display","flex").style("flex-direction","column").style("justify-content","center").style("align-items","center").style("height","60px").html(d=>{let i=d.data.data[0].value.toString();d.data.data[0].value!==void 0&&(i=g.plotArea.dataLabelNumberFormat===",.0%"?(Math.abs(d.data[0].value/K)*100).toFixed(rt(g.plotArea.dataLabelDecimalPrecision))+"%":Ke(g.plotArea.plotAreaDisplayUnits,g.plotArea.dataLabelNumberFormat,g.plotArea.dataLabelDecimalPrecision)(d.data.data[0].value));let y="";return g.plotArea.dataLabelName&&(y+=`<span style="
91
91
  font-size: ${d.data.properties.labelFontSize}px;
92
92
  color: ${d.data.properties.labelFontColor};
93
93
  font-style: ${d.data.properties.labelFontStyle.includes(ce.italic)?ce.italic:""};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pace-chart-lib",
3
- "version": "1.0.82",
3
+ "version": "1.0.83",
4
4
  "description": "A simple React + Vite + TS UI library with a Button using custom fonts via SCSS.",
5
5
  "license": "MIT",
6
6
  "type": "module",