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