'use client';
import{__rest as e}from"tslib";import t,{useState as a}from"react";import{twMerge as o}from"tailwind-merge";import{ResponsiveContainer as i,LineChart as r,CartesianGrid as n,XAxis as l,YAxis as s,Tooltip as m,Legend as c,Line as d}from"recharts";import{constructCategoryColors as h,getYAxisDomain as p}from"../common/utils.js";import u from"../common/ChartLegend.js";import y from"../common/ChartTooltip.js";import f from"../common/NoData.js";import{hexColors as w}from"../../../lib/hexColors.js";import{BaseColors as v}from"../../../lib/constants.js";import{themeColorRange as x}from"../../../lib/theme.js";import{defaultValueFormatter as g}from"../../../lib/utils.js";const E=t.forwardRef(((E,k)=>{const{data:A=[],categories:D=[],index:L,colors:b=x,valueFormatter:j=g,startEndOnly:T=!1,showXAxis:N=!0,showYAxis:C=!0,yAxisWidth:F=56,animationDuration:V=1500,showAnimation:G=!0,showTooltip:S=!0,showLegend:W=!0,showGridLines:z=!0,autoMinValue:O=!1,curveType:H="linear",minValue:I,maxValue:K,connectNulls:M=!1,allowDecimals:X=!0,className:Y,noDataText:R}=E,q=e(E,["data","categories","index","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","className","noDataText"]),[B,J]=a(60),P=h(D,b),Q=p(O,I,K);return t.createElement("div",Object.assign({ref:k,className:o("w-full h-80",Y)},q),t.createElement(i,{width:"100%",height:"100%"},(null==A?void 0:A.length)?t.createElement(r,{data:A},z?t.createElement(n,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}):null,t.createElement(l,{hide:!N,dataKey:L,interval:"preserveStartEnd",tick:{transform:"translate(0, 6)"},ticks:T?[A[0][L],A[A.length-1][L]]:void 0,style:{fontSize:"12px",fontFamily:"Inter; Helvetica"},tickLine:!1,axisLine:!1,padding:{left:10,right:10},minTickGap:5}),t.createElement(s,{width:F,hide:!C,axisLine:!1,tickLine:!1,type:"number",domain:Q,tick:{transform:"translate(-3, 0)"},style:{fontSize:"12px",fontFamily:"Inter; Helvetica"},tickFormatter:j,allowDecimals:X}),S?t.createElement(m,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:({active:e,payload:a,label:o})=>t.createElement(y,{active:e,payload:a,label:o,valueFormatter:j,categoryColors:P}),position:{y:0}}):null,W?t.createElement(c,{verticalAlign:"top",height:B,content:({payload:e})=>u({payload:e},P,J)}):null,D.map((e=>{var a;return t.createElement(d,{key:e,name:e,type:H,dataKey:e,stroke:w[null!==(a=P.get(e))&&void 0!==a?a:v.Gray],strokeWidth:2,dot:!1,isAnimationActive:G,animationDuration:V,connectNulls:M})}))):t.createElement(f,{noDataText:R})))}));E.displayName="LineChart";export{E as default};
