import{G as y}from"./GraphinaApexChartBase.js";class p extends y{constructor(){super(),this.observer={}}setUpChartsHandler(){this.chartHandlers={timeline:t=>this.observeChartElement(t,"timeline")}}dateFormat(t,r=!1,s=!1){const a=new Date(t),e=n=>n<10?"0"+n:n,l=e(a.getDate()),o=e(a.getMonth()+1),i=a.getFullYear(),c=e(a.getHours()),m=e(a.getMinutes());let d=s?`${l}-${o}-${i}`:"",u=r?`${c}:${m}`:"";return s&&r?`${d} ${u}`:d||u}TimelineChartXaxisFormat(t,r){const s=r.xaxis_show_time,a=r.xaxis_show_date;t.xaxis.labels=t.xaxis.labels||{},t.xaxis.labels.formatter=e=>this.dateFormat(e,s,a)}applyDataLabelFormatter(t,r){r.xaxis_show_time,r.xaxis_show_date;const s=r.chart_datalabel_prefix??"",a=r.chart_datalabel_postfix??"";t.dataLabels=t.dataLabels||{},t.dataLabels.formatter=e=>{if(Array.isArray(e)&&e.length===2){const[l,o]=e,i=o-l,c=Math.floor(i/(1e3*60*60*24)),m=Math.floor(i%(1e3*60*60*24)/(1e3*60*60)),d=Math.floor(i%(1e3*60*60)/(1e3*60));return`${s}${c} days ${m} hours ${d} minutes${a}`}return s+"N/A"+a}}applyTooltipFormatter(t,r){t.tooltip=t.tooltip||{},t.tooltip.custom=function({series:s,seriesIndex:a,dataPointIndex:e,w:l}){const o=l.config.series[a].data[e],i=o.x||"Task",c=u=>{const n=new Date(u),h=String(n.getDate()).padStart(2,"0"),x=n.toLocaleString("en-US",{month:"short"}),g=n.getFullYear(),$=String(n.getHours()).padStart(2,"0"),b=String(n.getMinutes()).padStart(2,"0");return`${h} ${x} ${g} ${$}:${b}`},[m,d]=o.y;return`
            <div style="padding: 8px;">
                <strong>${i}</strong><br/>
                ${c(m)} → ${c(d)}
            </div>
        `}}getChartOptions(t,r,s,a){return t.yaxis.labels.formatter=function(e){return e},r==="timeline"&&(t.chart=t.chart||{},t.xaxis=t.xaxis||{},t.plotOptions={bar:{horizontal:!0,rangeBarGroupRows:!0}},t.chart.events={mounted:(e,l)=>{const o=document.querySelector(`.graphina-elementor-chart[data-element_id="${a}"]`);o&&(o.style.height="")}},this.TimelineChartXaxisFormat(t,s),this.applyTooltipFormatter(t,s),this.applyDataLabelFormatter(t,s)),t}}window.graphinaTimelineChart=new p;
//# sourceMappingURL=timeline.js.map
