import{G as n}from"./GraphinaApexChartBase.js";class c extends n{constructor(){super(),this.observer={}}setUpChartsHandler(){this.chartHandlers={pie:i=>this.observeChartElement(i,"pie")}}applyDataLabelFormatter(i,e,r=!1){let t=e.chart_datalabel_prefix??"",_=e.chart_datalabel_postfix??"";i.dataLabels||(i.dataLabels={}),e.chart_data_label_pointer?(i.plotOptions.pie.donut.labels.total.formatter=l=>{let a=l.globals.seriesTotals.reduce((o,m)=>o+m,0);return a=this.formatNumber(a,e.chart_datalabel_decimals_in_float),t+a+_},i.plotOptions.pie.donut.labels.value.formatter=l=>(l=this.formatNumber(l,e.chart_datalabel_decimals_in_float),t+l+_),i.tooltip.y={formatter:l=>t+this.formatNumber(l,e.chart_datalabel_decimals_in_float)+_}):(i.tooltip.y={formatter:l=>t+new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:e.chart_datalabel_decimals_in_float,maximumFractionDigits:e.chart_datalabel_decimals_in_float}).format(l)+_},i.plotOptions.pie.donut.labels.value.formatter=l=>(l=new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:e.chart_datalabel_decimals_in_float,maximumFractionDigits:e.chart_datalabel_decimals_in_float}).format(l),t+l+_),i.plotOptions.pie.donut.labels.total.formatter=l=>{let a=l.globals.seriesTotals.reduce((o,m)=>o+m,0);return a=new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:e.chart_datalabel_decimals_in_float,maximumFractionDigits:e.chart_datalabel_decimals_in_float}).format(a),t+a+_}),i.dataLabels&&(i.dataLabels.formatter=(l,a)=>(r&&(l=new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:e.chart_datalabel_decimals_in_float,maximumFractionDigits:e.chart_datalabel_decimals_in_float}).format(l)),e.chart_datalabels_format_showlabel?a.w.globals.labels[a.seriesIndex]+"-"+t+new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:e.chart_datalabel_decimals_in_float,maximumFractionDigits:e.chart_datalabel_decimals_in_float}).format(l)+_:t+new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:e.chart_datalabel_decimals_in_float,maximumFractionDigits:e.chart_datalabel_decimals_in_float}).format(l)+"%"+_),e.chart_datalabels_format_showValue&&(i.dataLabels.formatter=(l,a)=>(l=a.w.globals.series[a.seriesIndex],e.chart_number_format_commas&&!e.chart_data_label_pointer&&(l=new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:e.chart_datalabel_decimals_in_float,maximumFractionDigits:e.chart_datalabel_decimals_in_float}).format(l)),e.chart_data_label_pointer?t+this.formatNumber(l,e.chart_datalabel_decimals_in_float)+_:e.chart_datalabels_format_showlabel?a.w.globals.labels[a.seriesIndex]+"-"+t+l+_:t+l+_)))}applyLegendTooltip(i,e,r){if(e.legend_show_series_value){const t=e.chart_legend_show_series_prefix==="yes"?e.chart_datalabel_prefix??"":"",_=e.chart_legend_show_series_postfix==="yes"?e.chart_datalabel_postfix??"":"";i.legend.formatter=(l,a)=>{l=decodeURIComponent(l);let o=a.w.globals.series[a.seriesIndex];return o=new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:e.chart_datalabel_decimals_in_float,maximumFractionDigits:e.chart_datalabel_decimals_in_float}).format(o),`<div class="legend-info"><span>${l}</span>: ${t}${o}${_}</div>`}}}getChartOptions(i,e,r,t){return e==="pie"&&(i.labels=i.xaxis.categories,i.chart.events={mounted:(_,l)=>{const a=document.querySelector(`.graphina-elementor-chart[data-element_id="${t}"]`);a&&(a.style.height="")}}),i}}window.graphinaPieChart=new c;
//# sourceMappingURL=pie.js.map
