@tetrascience-npm/tetrascience-react-ui 0.6.0-beta.82.1 → 0.6.0-beta.84.1

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.
Files changed (87) hide show
  1. package/dist/components/charts/AreaGraph/AreaGraph.cjs +1 -1
  2. package/dist/components/charts/AreaGraph/AreaGraph.cjs.map +1 -1
  3. package/dist/components/charts/AreaGraph/AreaGraph.js +132 -98
  4. package/dist/components/charts/AreaGraph/AreaGraph.js.map +1 -1
  5. package/dist/components/charts/BarGraph/BarGraph.cjs +1 -1
  6. package/dist/components/charts/BarGraph/BarGraph.cjs.map +1 -1
  7. package/dist/components/charts/BarGraph/BarGraph.js +63 -57
  8. package/dist/components/charts/BarGraph/BarGraph.js.map +1 -1
  9. package/dist/components/charts/Boxplot/Boxplot.cjs +1 -1
  10. package/dist/components/charts/Boxplot/Boxplot.cjs.map +1 -1
  11. package/dist/components/charts/Boxplot/Boxplot.js +83 -74
  12. package/dist/components/charts/Boxplot/Boxplot.js.map +1 -1
  13. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs +2 -0
  14. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs.map +1 -0
  15. package/dist/components/charts/ChartTooltip/ChartTooltip.js +163 -0
  16. package/dist/components/charts/ChartTooltip/ChartTooltip.js.map +1 -0
  17. package/dist/components/charts/ChartTooltip/lines.cjs +2 -0
  18. package/dist/components/charts/ChartTooltip/lines.cjs.map +1 -0
  19. package/dist/components/charts/ChartTooltip/lines.js +29 -0
  20. package/dist/components/charts/ChartTooltip/lines.js.map +1 -0
  21. package/dist/components/charts/Chromatogram/Chromatogram.cjs +1 -1
  22. package/dist/components/charts/Chromatogram/Chromatogram.cjs.map +1 -1
  23. package/dist/components/charts/Chromatogram/Chromatogram.js +75 -61
  24. package/dist/components/charts/Chromatogram/Chromatogram.js.map +1 -1
  25. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs +1 -1
  26. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs.map +1 -1
  27. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js +116 -108
  28. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +1 -1
  29. package/dist/components/charts/ChromatogramChart/annotations.cjs +1 -1
  30. package/dist/components/charts/ChromatogramChart/annotations.cjs.map +1 -1
  31. package/dist/components/charts/ChromatogramChart/annotations.js +32 -32
  32. package/dist/components/charts/ChromatogramChart/annotations.js.map +1 -1
  33. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs +1 -1
  34. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs.map +1 -1
  35. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js +6 -6
  36. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js.map +1 -1
  37. package/dist/components/charts/ChromatogramChart/constants.cjs +1 -1
  38. package/dist/components/charts/ChromatogramChart/constants.cjs.map +1 -1
  39. package/dist/components/charts/ChromatogramChart/constants.js +11 -5
  40. package/dist/components/charts/ChromatogramChart/constants.js.map +1 -1
  41. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs +1 -1
  42. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs.map +1 -1
  43. package/dist/components/charts/ChromatogramChart/dataProcessing.js +38 -49
  44. package/dist/components/charts/ChromatogramChart/dataProcessing.js.map +1 -1
  45. package/dist/components/charts/DotPlot/DotPlot.cjs +1 -1
  46. package/dist/components/charts/DotPlot/DotPlot.cjs.map +1 -1
  47. package/dist/components/charts/DotPlot/DotPlot.js +57 -63
  48. package/dist/components/charts/DotPlot/DotPlot.js.map +1 -1
  49. package/dist/components/charts/Histogram/Histogram.cjs +1 -1
  50. package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
  51. package/dist/components/charts/Histogram/Histogram.js +98 -104
  52. package/dist/components/charts/Histogram/Histogram.js.map +1 -1
  53. package/dist/components/charts/LineGraph/LineGraph.cjs +1 -1
  54. package/dist/components/charts/LineGraph/LineGraph.cjs.map +1 -1
  55. package/dist/components/charts/LineGraph/LineGraph.js +97 -88
  56. package/dist/components/charts/LineGraph/LineGraph.js.map +1 -1
  57. package/dist/components/charts/PieChart/PieChart.cjs +1 -1
  58. package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
  59. package/dist/components/charts/PieChart/PieChart.js +65 -68
  60. package/dist/components/charts/PieChart/PieChart.js.map +1 -1
  61. package/dist/components/charts/PlateMap/PlateMap.cjs +1 -1
  62. package/dist/components/charts/PlateMap/PlateMap.cjs.map +1 -1
  63. package/dist/components/charts/PlateMap/PlateMap.js +271 -256
  64. package/dist/components/charts/PlateMap/PlateMap.js.map +1 -1
  65. package/dist/components/charts/PlateMap/constants.cjs +1 -1
  66. package/dist/components/charts/PlateMap/constants.cjs.map +1 -1
  67. package/dist/components/charts/PlateMap/constants.js +20 -29
  68. package/dist/components/charts/PlateMap/constants.js.map +1 -1
  69. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +1 -1
  70. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +1 -1
  71. package/dist/components/charts/ScatterGraph/ScatterGraph.js +113 -89
  72. package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +1 -1
  73. package/dist/hooks/use-plotly-theme.cjs +1 -1
  74. package/dist/hooks/use-plotly-theme.cjs.map +1 -1
  75. package/dist/hooks/use-plotly-theme.js +4 -2
  76. package/dist/hooks/use-plotly-theme.js.map +1 -1
  77. package/dist/index.cjs +1 -1
  78. package/dist/index.css +1 -1
  79. package/dist/index.d.ts +156 -76
  80. package/dist/index.js +587 -581
  81. package/dist/index.js.map +1 -1
  82. package/dist/index.tailwind.css +1 -1
  83. package/dist/utils/colors.cjs +1 -1
  84. package/dist/utils/colors.cjs.map +1 -1
  85. package/dist/utils/colors.js +38 -93
  86. package/dist/utils/colors.js.map +1 -1
  87. package/package.json +1 -1
@@ -1,157 +1,161 @@
1
- import { jsx as D } from "react/jsx-runtime";
1
+ import { jsxs as Y, jsx as q } from "react/jsx-runtime";
2
2
  import U from "plotly.js-dist";
3
- import { useRef as q, useMemo as A, useEffect as J } from "react";
4
- import { CHART_COLORS as W } from "../../../utils/colors.js";
5
- import { groupOverlappingPeaks as K, createGroupAnnotations as Q } from "./annotations.js";
6
- import { createBoundaryMarkerTraces as V } from "./boundaryMarkers.js";
7
- import { CHROMATOGRAM_LAYOUT as a } from "./constants.js";
8
- import { validateSeriesData as Y, applyBaselineCorrection as Z, processUserAnnotations as X, buildHoverExtraContent as w, collectPeaksWithBoundaryData as ee } from "./dataProcessing.js";
9
- import { detectPeaks as oe } from "./peakDetection.js";
10
- import { usePlotlyTheme as te } from "../../../hooks/use-plotly-theme.js";
11
- const de = ({
12
- series: s,
3
+ import { useRef as J, useMemo as v, useEffect as K } from "react";
4
+ import { seriesColor as Q } from "../../../utils/colors.js";
5
+ import { useChartTooltip as V } from "../ChartTooltip/ChartTooltip.js";
6
+ import { groupOverlappingPeaks as Z, createGroupAnnotations as $ } from "./annotations.js";
7
+ import { createBoundaryMarkerTraces as X } from "./boundaryMarkers.js";
8
+ import { CHROMATOGRAM_LAYOUT as s } from "./constants.js";
9
+ import { validateSeriesData as w, applyBaselineCorrection as oo, processUserAnnotations as eo, collectPeaksWithBoundaryData as ro } from "./dataProcessing.js";
10
+ import { detectPeaks as to } from "./peakDetection.js";
11
+ import { usePlotlyTheme as no } from "../../../hooks/use-plotly-theme.js";
12
+ const so = [], ko = ({
13
+ series: a,
13
14
  width: y = 900,
14
15
  height: h = 500,
15
16
  title: f,
16
17
  xAxisTitle: k = "Retention Time (min)",
17
- yAxisTitle: x = "Signal (mAU)",
18
- annotations: m = [],
19
- xRange: I,
20
- yRange: C,
21
- showLegend: P = !0,
22
- showGridX: M = !0,
23
- showGridY: z = !0,
24
- showMarkers: T = !1,
25
- markerSize: B = 4,
18
+ yAxisTitle: I = "Signal (mAU)",
19
+ annotations: m = so,
20
+ xRange: x,
21
+ yRange: T,
22
+ showLegend: M = !0,
23
+ showGridX: N = !0,
24
+ showGridY: R = !0,
25
+ showMarkers: _ = !1,
26
+ markerSize: z = 4,
26
27
  showCrosshairs: p = !1,
27
- baselineCorrection: N = "none",
28
+ baselineCorrection: B = "none",
28
29
  baselineWindowSize: E = 50,
29
30
  peakDetectionOptions: l,
30
31
  showPeakAreas: G = !1,
31
32
  boundaryMarkers: O = "none",
32
- annotationOverlapThreshold: H = 0.4,
33
- showExportButton: _ = !0
33
+ annotationOverlapThreshold: b = 0.4,
34
+ showExportButton: C = !0
34
35
  }) => {
35
- const d = l !== void 0, b = q(null), e = te(), n = A(() => s.map((t) => {
36
- const r = Y(t.x, t.y);
36
+ const d = l !== void 0, L = J(null), o = no(), { bindTooltip: S, tooltipElement: W } = V({
37
+ xLabel: k,
38
+ yLabel: I
39
+ }), n = v(() => a.map((e) => {
40
+ const t = w(e.x, e.y);
37
41
  return {
38
- ...t,
39
- x: r.x,
40
- y: Z(r.y, N, E)
42
+ ...e,
43
+ x: t.x,
44
+ y: oo(t.y, B, E)
41
45
  };
42
- }), [s, N, E]), R = A(() => {
46
+ }), [a, B, E]), A = v(() => {
43
47
  if (m.length === 0 || n.length === 0)
44
48
  return m;
45
- const { x: t, y: r } = n[0];
46
- return X(m, t, r);
47
- }, [m, n]), v = A(() => {
48
- const t = [];
49
- return d && l && n.forEach((r, i) => {
50
- const u = oe(r.x, r.y, l);
51
- u.length > 0 && t.push({ peaks: u, seriesIndex: i });
52
- }), t;
49
+ const { x: e, y: t } = n[0];
50
+ return eo(m, e, t);
51
+ }, [m, n]), P = v(() => {
52
+ const e = [];
53
+ return d && l && n.forEach((t, i) => {
54
+ const u = to(t.x, t.y, l);
55
+ u.length > 0 && e.push({ peaks: u, seriesIndex: i });
56
+ }), e;
53
57
  }, [n, d, l]);
54
- return J(() => {
55
- const t = b.current;
56
- if (!t || s.length === 0) return;
57
- const r = n.map((o, c) => {
58
- const g = o.color || W[c % W.length], F = w(o.name, o.metadata), S = {
59
- x: o.x,
60
- y: o.y,
58
+ return K(() => {
59
+ const e = L.current;
60
+ if (!e || a.length === 0) return;
61
+ const t = n.map((r, c) => {
62
+ const g = Q(c, r.color), H = {
63
+ x: r.x,
64
+ y: r.y,
61
65
  type: "scatter",
62
- mode: T ? "lines+markers" : "lines",
63
- name: o.name,
66
+ mode: _ ? "lines+markers" : "lines",
67
+ name: r.name,
64
68
  line: {
65
69
  color: g,
66
70
  width: 1.5
67
71
  },
68
- hovertemplate: `%{x:.2f} ${k}<br>%{y:.2f} ${x}<extra>${F}</extra>`
72
+ hoverinfo: "none"
69
73
  };
70
- return T && (S.marker = {
71
- size: B,
74
+ return _ && (H.marker = {
75
+ size: z,
72
76
  color: g
73
- }), S;
77
+ }), H;
74
78
  });
75
79
  if (O !== "none") {
76
- const o = ee(v, R, n);
77
- if (o.length > 0) {
78
- const c = V(o);
79
- r.push(...c);
80
+ const r = ro(P, A, n);
81
+ if (r.length > 0) {
82
+ const c = X(r);
83
+ t.push(...c);
80
84
  }
81
85
  }
82
86
  const i = [];
83
- R.forEach((o) => {
84
- i.push({ peak: o, seriesIndex: -1 });
85
- }), G && d && v.forEach(({ peaks: o, seriesIndex: c }) => {
86
- o.forEach((g) => {
87
+ A.forEach((r) => {
88
+ i.push({ peak: r, seriesIndex: -1 });
89
+ }), G && d && P.forEach(({ peaks: r, seriesIndex: c }) => {
90
+ r.forEach((g) => {
87
91
  i.push({ peak: g, seriesIndex: c });
88
92
  });
89
93
  });
90
- const u = K(i, H), L = [];
91
- for (const o of u)
92
- L.push(...Q(o));
93
- const $ = {
94
+ const u = Z(i, b), D = [];
95
+ for (const r of u)
96
+ D.push(...$(r));
97
+ const j = {
94
98
  title: f ? {
95
99
  text: f,
96
100
  font: {
97
101
  size: 20,
98
102
  family: "Inter, sans-serif",
99
- color: e.textColor
103
+ color: o.textColor
100
104
  }
101
105
  } : void 0,
102
106
  width: y,
103
107
  height: h,
104
108
  margin: {
105
- l: a.MARGIN_LEFT,
106
- r: a.MARGIN_RIGHT,
107
- b: a.MARGIN_BOTTOM,
108
- t: f ? a.MARGIN_TOP_WITH_TITLE : a.MARGIN_TOP_NO_TITLE,
109
- pad: a.MARGIN_PAD
109
+ l: s.MARGIN_LEFT,
110
+ r: s.MARGIN_RIGHT,
111
+ b: s.MARGIN_BOTTOM,
112
+ t: f ? s.MARGIN_TOP_WITH_TITLE : s.MARGIN_TOP_NO_TITLE,
113
+ pad: s.MARGIN_PAD
110
114
  },
111
- paper_bgcolor: e.paperBg,
112
- plot_bgcolor: e.plotBg,
115
+ paper_bgcolor: o.paperBg,
116
+ plot_bgcolor: o.plotBg,
113
117
  font: { family: "Inter, sans-serif" },
114
118
  hovermode: p ? "x" : "x unified",
115
119
  dragmode: "zoom",
116
120
  xaxis: {
117
121
  title: {
118
122
  text: k,
119
- font: { size: 14, color: e.textSecondary, family: "Inter, sans-serif" },
123
+ font: { size: 14, color: o.textSecondary, family: "Inter, sans-serif" },
120
124
  standoff: 15
121
125
  },
122
- showgrid: M,
123
- gridcolor: e.gridColor,
124
- linecolor: e.lineColor,
126
+ showgrid: N,
127
+ gridcolor: o.gridColor,
128
+ linecolor: o.lineColor,
125
129
  linewidth: 1,
126
- range: I,
127
- autorange: !I,
130
+ range: x,
131
+ autorange: !x,
128
132
  zeroline: !1,
129
- tickfont: { size: 12, color: e.textColor, family: "Inter, sans-serif" },
133
+ tickfont: { size: 12, color: o.textColor, family: "Inter, sans-serif" },
130
134
  showspikes: p,
131
135
  spikemode: "across",
132
136
  spikesnap: "cursor",
133
- spikecolor: e.spikeColor,
137
+ spikecolor: o.spikeColor,
134
138
  spikethickness: 1,
135
139
  spikedash: "dot"
136
140
  },
137
141
  yaxis: {
138
142
  title: {
139
- text: x,
140
- font: { size: 14, color: e.textSecondary, family: "Inter, sans-serif" },
143
+ text: I,
144
+ font: { size: 14, color: o.textSecondary, family: "Inter, sans-serif" },
141
145
  standoff: 10
142
146
  },
143
- showgrid: z,
144
- gridcolor: e.gridColor,
145
- linecolor: e.lineColor,
147
+ showgrid: R,
148
+ gridcolor: o.gridColor,
149
+ linecolor: o.lineColor,
146
150
  linewidth: 1,
147
- range: C,
148
- autorange: !C,
151
+ range: T,
152
+ autorange: !T,
149
153
  zeroline: !1,
150
- tickfont: { size: 12, color: e.textColor, family: "Inter, sans-serif" },
154
+ tickfont: { size: 12, color: o.textColor, family: "Inter, sans-serif" },
151
155
  showspikes: p,
152
156
  spikemode: "across",
153
157
  spikesnap: "cursor",
154
- spikecolor: e.spikeColor,
158
+ spikecolor: o.spikeColor,
155
159
  spikethickness: 1,
156
160
  spikedash: "dot"
157
161
  },
@@ -161,20 +165,20 @@ const de = ({
161
165
  xanchor: "center",
162
166
  yanchor: "top",
163
167
  orientation: "h",
164
- font: { size: 12, color: e.textColor, family: "Inter, sans-serif" }
168
+ font: { size: 12, color: o.textColor, family: "Inter, sans-serif" }
165
169
  },
166
- showlegend: P && s.length > 1,
167
- annotations: L
168
- }, j = {
170
+ showlegend: M && a.length > 1,
171
+ annotations: D
172
+ }, F = {
169
173
  responsive: !0,
170
174
  displayModeBar: !0,
171
175
  displaylogo: !1,
172
176
  modeBarButtonsToRemove: [
173
177
  "lasso2d",
174
178
  "select2d",
175
- ..._ ? [] : ["toImage"]
179
+ ...C ? [] : ["toImage"]
176
180
  ],
177
- ..._ && {
181
+ ...C && {
178
182
  toImageButtonOptions: {
179
183
  format: "png",
180
184
  filename: "chromatogram",
@@ -183,37 +187,41 @@ const de = ({
183
187
  }
184
188
  }
185
189
  };
186
- return U.newPlot(t, r, $, j), () => {
187
- t && U.purge(t);
190
+ return U.newPlot(e, t, j, F), S(e), () => {
191
+ e && U.purge(e);
188
192
  };
189
193
  }, [
190
194
  n,
191
- v,
192
- s.length,
195
+ P,
196
+ a.length,
193
197
  y,
194
198
  h,
195
199
  f,
196
200
  k,
197
- x,
198
- R,
199
201
  I,
200
- C,
201
- P,
202
+ A,
203
+ x,
204
+ T,
202
205
  M,
206
+ N,
207
+ R,
208
+ _,
203
209
  z,
204
- T,
205
- B,
206
210
  p,
207
211
  d,
208
212
  l,
209
213
  G,
210
214
  O,
211
- H,
212
- _,
213
- e
214
- ]), /* @__PURE__ */ D("div", { className: "chromatogram-chart-container", children: /* @__PURE__ */ D("div", { ref: b, style: { width: "100%", height: "100%" } }) });
215
+ b,
216
+ C,
217
+ o,
218
+ S
219
+ ]), /* @__PURE__ */ Y("div", { className: "chromatogram-chart-container relative", children: [
220
+ /* @__PURE__ */ q("div", { ref: L, style: { width: "100%", height: "100%" } }),
221
+ W
222
+ ] });
215
223
  };
216
224
  export {
217
- de as ChromatogramChart
225
+ ko as ChromatogramChart
218
226
  };
219
227
  //# sourceMappingURL=ChromatogramChart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChromatogramChart.js","sources":["../../../../src/components/charts/ChromatogramChart/ChromatogramChart.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\n\nimport { CHART_COLORS } from \"../../../utils/colors\";\n\n\nimport {\n groupOverlappingPeaks,\n createGroupAnnotations,\n} from \"./annotations\";\nimport { createBoundaryMarkerTraces } from \"./boundaryMarkers\";\nimport { CHROMATOGRAM_LAYOUT } from \"./constants\";\nimport {\n validateSeriesData,\n applyBaselineCorrection,\n buildHoverExtraContent,\n collectPeaksWithBoundaryData,\n processUserAnnotations,\n} from \"./dataProcessing\";\nimport { detectPeaks } from \"./peakDetection\";\n\nimport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n PeakWithMeta,\n} from \"./types\";\n\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\n\n// Re-export types for external use\nexport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n};\n\n\nconst ChromatogramChart: React.FC<ChromatogramChartProps> = ({\n series,\n width = 900,\n height = 500,\n title,\n xAxisTitle = \"Retention Time (min)\",\n yAxisTitle = \"Signal (mAU)\",\n annotations = [],\n xRange,\n yRange,\n showLegend = true,\n showGridX = true,\n showGridY = true,\n showMarkers = false,\n markerSize = 4,\n showCrosshairs = false,\n baselineCorrection = \"none\",\n baselineWindowSize = 50,\n peakDetectionOptions,\n showPeakAreas = false,\n boundaryMarkers = \"none\",\n annotationOverlapThreshold = 0.4,\n showExportButton = true,\n}) => {\n // Derive peak detection state from options\n const enablePeakDetection = peakDetectionOptions !== undefined;\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n\n // Memoize processed series with baseline correction\n const processedSeries = useMemo(() => {\n return series.map((s) => {\n const validated = validateSeriesData(s.x, s.y);\n return {\n ...s,\n x: validated.x,\n y: applyBaselineCorrection(validated.y, baselineCorrection, baselineWindowSize),\n };\n });\n }, [series, baselineCorrection, baselineWindowSize]);\n\n // Process user annotations to convert startX/endX to indices and compute areas\n const processedAnnotations = useMemo(() => {\n if (annotations.length === 0 || processedSeries.length === 0) {\n return annotations;\n }\n // Use first series data for index lookup (user annotations apply to first series)\n const { x, y } = processedSeries[0];\n return processUserAnnotations(annotations, x, y);\n }, [annotations, processedSeries]);\n\n // Memoize peak detection results\n const allDetectedPeaks = useMemo(() => {\n const peaks: { peaks: PeakAnnotation[]; seriesIndex: number }[] = [];\n if (enablePeakDetection && peakDetectionOptions) {\n processedSeries.forEach((s, index) => {\n const detected = detectPeaks(s.x, s.y, peakDetectionOptions);\n if (detected.length > 0) {\n peaks.push({ peaks: detected, seriesIndex: index });\n }\n });\n }\n return peaks;\n }, [processedSeries, enablePeakDetection, peakDetectionOptions]);\n\n useEffect(() => {\n const currentRef = plotRef.current;\n if (!currentRef || series.length === 0) return;\n\n // Build trace data with auto-assigned colors\n const plotData: Plotly.Data[] = processedSeries.map((s, index) => {\n const traceColor = s.color || CHART_COLORS[index % CHART_COLORS.length];\n const extraContent = buildHoverExtraContent(s.name, s.metadata);\n\n const trace: Plotly.Data = {\n x: s.x,\n y: s.y,\n type: \"scatter\" as const,\n mode: showMarkers ? \"lines+markers\" as const : \"lines\" as const,\n name: s.name,\n line: {\n color: traceColor,\n width: 1.5,\n },\n hovertemplate: `%{x:.2f} ${xAxisTitle}<br>%{y:.2f} ${yAxisTitle}<extra>${extraContent}</extra>`,\n };\n if (showMarkers) {\n trace.marker = {\n size: markerSize,\n color: traceColor,\n };\n }\n return trace;\n });\n\n // Add peak boundary markers if enabled\n if (boundaryMarkers !== \"none\") {\n const peaksWithData = collectPeaksWithBoundaryData(allDetectedPeaks, processedAnnotations, processedSeries);\n if (peaksWithData.length > 0) {\n const boundaryTraces = createBoundaryMarkerTraces(peaksWithData);\n plotData.push(...boundaryTraces);\n }\n }\n\n // Collect all peaks for unified staggering logic\n const allPeaksWithMeta: PeakWithMeta[] = [];\n\n // Add user-defined annotations (seriesIndex -1 indicates user-defined)\n processedAnnotations.forEach((ann) => {\n allPeaksWithMeta.push({ peak: ann, seriesIndex: -1 });\n });\n\n // Add auto-detected peaks if enabled\n if (showPeakAreas && enablePeakDetection) {\n allDetectedPeaks.forEach(({ peaks, seriesIndex }) => {\n peaks.forEach((peak) => {\n allPeaksWithMeta.push({ peak, seriesIndex });\n });\n });\n }\n\n // Group all overlapping peaks and create annotations with staggering\n const groups = groupOverlappingPeaks(allPeaksWithMeta, annotationOverlapThreshold);\n const plotlyAnnotations: Partial<Plotly.Annotations>[] = [];\n\n for (const group of groups) {\n plotlyAnnotations.push(...createGroupAnnotations(group));\n }\n\n const layout: Partial<Plotly.Layout> = {\n title: title\n ? {\n text: title,\n font: {\n size: 20,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n },\n }\n : undefined,\n width,\n height,\n margin: {\n l: CHROMATOGRAM_LAYOUT.MARGIN_LEFT,\n r: CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,\n b: CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,\n t: title ? CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE : CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,\n pad: CHROMATOGRAM_LAYOUT.MARGIN_PAD,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: { family: \"Inter, sans-serif\" },\n hovermode: showCrosshairs ? \"x\" as const : \"x unified\" as const,\n dragmode: \"zoom\" as const,\n xaxis: {\n title: {\n text: xAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 15,\n },\n showgrid: showGridX,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: xRange,\n autorange: !xRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n yaxis: {\n title: {\n text: yAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 10,\n },\n showgrid: showGridY,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: yRange,\n autorange: !yRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n legend: {\n x: 0.5,\n y: -0.15,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n orientation: \"h\" as const,\n font: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n },\n showlegend: showLegend && series.length > 1,\n annotations: plotlyAnnotations,\n };\n\n const config: Partial<Plotly.Config> = {\n responsive: true,\n displayModeBar: true,\n displaylogo: false,\n modeBarButtonsToRemove: [\n \"lasso2d\",\n \"select2d\",\n ...(showExportButton ? [] : [\"toImage\"] as Plotly.ModeBarDefaultButtons[]),\n ] as Plotly.ModeBarDefaultButtons[],\n ...(showExportButton && {\n toImageButtonOptions: {\n format: \"png\",\n filename: \"chromatogram\",\n width: width,\n height: height,\n },\n }),\n };\n\n Plotly.newPlot(currentRef, plotData, layout, config);\n\n return () => {\n if (currentRef) {\n Plotly.purge(currentRef);\n }\n };\n }, [\n processedSeries, allDetectedPeaks, series.length, width, height, title, xAxisTitle, yAxisTitle,\n processedAnnotations, xRange, yRange, showLegend, showGridX, showGridY, showMarkers, markerSize,\n showCrosshairs, enablePeakDetection, peakDetectionOptions, showPeakAreas, boundaryMarkers,\n annotationOverlapThreshold, showExportButton, theme,\n ]);\n\n return (\n <div className=\"chromatogram-chart-container\">\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n </div>\n );\n};\n\nexport { ChromatogramChart };\n\n"],"names":["ChromatogramChart","series","width","height","title","xAxisTitle","yAxisTitle","annotations","xRange","yRange","showLegend","showGridX","showGridY","showMarkers","markerSize","showCrosshairs","baselineCorrection","baselineWindowSize","peakDetectionOptions","showPeakAreas","boundaryMarkers","annotationOverlapThreshold","showExportButton","enablePeakDetection","plotRef","useRef","theme","usePlotlyTheme","processedSeries","useMemo","s","validated","validateSeriesData","applyBaselineCorrection","processedAnnotations","x","y","processUserAnnotations","allDetectedPeaks","peaks","index","detected","detectPeaks","useEffect","currentRef","plotData","traceColor","CHART_COLORS","extraContent","buildHoverExtraContent","trace","peaksWithData","collectPeaksWithBoundaryData","boundaryTraces","createBoundaryMarkerTraces","allPeaksWithMeta","ann","seriesIndex","peak","groups","groupOverlappingPeaks","plotlyAnnotations","group","createGroupAnnotations","layout","CHROMATOGRAM_LAYOUT","config","Plotly","jsx"],"mappings":";;;;;;;;;;AA8CA,MAAMA,KAAsD,CAAC;AAAA,EAC3D,QAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,OAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EAC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QvB,GAAYC,GAAUmB,GAAQE,CAAM,GAE5C,MAAM;AACX,MAAItB,KACFuB,EAAO,MAAMvB,CAAU;AAAA,IAE3B;AAAA,EACF,GAAG;AAAA,IACDhB;AAAA,IAAiBU;AAAA,IAAkBrC,EAAO;AAAA,IAAQC;AAAA,IAAOC;AAAA,IAAQC;AAAA,IAAOC;AAAA,IAAYC;AAAA,IACpF4B;AAAA,IAAsB1B;AAAA,IAAQC;AAAA,IAAQC;AAAA,IAAYC;AAAA,IAAWC;AAAA,IAAWC;AAAA,IAAaC;AAAA,IACrFC;AAAA,IAAgBQ;AAAA,IAAqBL;AAAA,IAAsBC;AAAA,IAAeC;AAAA,IAC1EC;AAAA,IAA4BC;AAAA,IAAkBI;AAAA,EAAA,CAC/C,GAGC,gBAAA0C,EAAC,OAAA,EAAI,WAAU,gCACb,4BAAC,OAAA,EAAI,KAAK5C,GAAS,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAA,GAAU,GAC/D;AAEJ;"}
1
+ {"version":3,"file":"ChromatogramChart.js","sources":["../../../../src/components/charts/ChromatogramChart/ChromatogramChart.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\n\nimport { seriesColor } from \"../../../utils/colors\";\nimport { useChartTooltip } from \"../ChartTooltip\";\n\nimport {\n groupOverlappingPeaks,\n createGroupAnnotations,\n} from \"./annotations\";\nimport { createBoundaryMarkerTraces } from \"./boundaryMarkers\";\nimport { CHROMATOGRAM_LAYOUT } from \"./constants\";\nimport {\n validateSeriesData,\n applyBaselineCorrection,\n collectPeaksWithBoundaryData,\n processUserAnnotations,\n} from \"./dataProcessing\";\nimport { detectPeaks } from \"./peakDetection\";\n\nimport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n PeakWithMeta,\n} from \"./types\";\n\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\n\n// Re-export types for external use\nexport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n};\n\n\n// Stable default so the no-annotations case keeps a constant identity; an\n// inline `[]` default would change every render, re-running the plot effect\n// (and tearing down the hover tooltip) on each re-render.\nconst EMPTY_ANNOTATIONS: PeakAnnotation[] = [];\n\nconst ChromatogramChart: React.FC<ChromatogramChartProps> = ({\n series,\n width = 900,\n height = 500,\n title,\n xAxisTitle = \"Retention Time (min)\",\n yAxisTitle = \"Signal (mAU)\",\n annotations = EMPTY_ANNOTATIONS,\n xRange,\n yRange,\n showLegend = true,\n showGridX = true,\n showGridY = true,\n showMarkers = false,\n markerSize = 4,\n showCrosshairs = false,\n baselineCorrection = \"none\",\n baselineWindowSize = 50,\n peakDetectionOptions,\n showPeakAreas = false,\n boundaryMarkers = \"none\",\n annotationOverlapThreshold = 0.4,\n showExportButton = true,\n}) => {\n // Derive peak detection state from options\n const enablePeakDetection = peakDetectionOptions !== undefined;\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const { bindTooltip, tooltipElement } = useChartTooltip({\n xLabel: xAxisTitle,\n yLabel: yAxisTitle,\n });\n\n // Memoize processed series with baseline correction\n const processedSeries = useMemo(() => {\n return series.map((s) => {\n const validated = validateSeriesData(s.x, s.y);\n return {\n ...s,\n x: validated.x,\n y: applyBaselineCorrection(validated.y, baselineCorrection, baselineWindowSize),\n };\n });\n }, [series, baselineCorrection, baselineWindowSize]);\n\n // Process user annotations to convert startX/endX to indices and compute areas\n const processedAnnotations = useMemo(() => {\n if (annotations.length === 0 || processedSeries.length === 0) {\n return annotations;\n }\n // Use first series data for index lookup (user annotations apply to first series)\n const { x, y } = processedSeries[0];\n return processUserAnnotations(annotations, x, y);\n }, [annotations, processedSeries]);\n\n // Memoize peak detection results\n const allDetectedPeaks = useMemo(() => {\n const peaks: { peaks: PeakAnnotation[]; seriesIndex: number }[] = [];\n if (enablePeakDetection && peakDetectionOptions) {\n processedSeries.forEach((s, index) => {\n const detected = detectPeaks(s.x, s.y, peakDetectionOptions);\n if (detected.length > 0) {\n peaks.push({ peaks: detected, seriesIndex: index });\n }\n });\n }\n return peaks;\n }, [processedSeries, enablePeakDetection, peakDetectionOptions]);\n\n useEffect(() => {\n const currentRef = plotRef.current;\n if (!currentRef || series.length === 0) return;\n\n // Build trace data with auto-assigned colors\n const plotData: Plotly.Data[] = processedSeries.map((s, index) => {\n const traceColor = seriesColor(index, s.color);\n\n const trace: Plotly.Data = {\n x: s.x,\n y: s.y,\n type: \"scatter\" as const,\n mode: showMarkers ? \"lines+markers\" as const : \"lines\" as const,\n name: s.name,\n line: {\n color: traceColor,\n width: 1.5,\n },\n hoverinfo: \"none\" as const,\n };\n if (showMarkers) {\n trace.marker = {\n size: markerSize,\n color: traceColor,\n };\n }\n return trace;\n });\n\n // Add peak boundary markers if enabled\n if (boundaryMarkers !== \"none\") {\n const peaksWithData = collectPeaksWithBoundaryData(allDetectedPeaks, processedAnnotations, processedSeries);\n if (peaksWithData.length > 0) {\n const boundaryTraces = createBoundaryMarkerTraces(peaksWithData);\n plotData.push(...boundaryTraces);\n }\n }\n\n // Collect all peaks for unified staggering logic\n const allPeaksWithMeta: PeakWithMeta[] = [];\n\n // Add user-defined annotations (seriesIndex -1 indicates user-defined)\n processedAnnotations.forEach((ann) => {\n allPeaksWithMeta.push({ peak: ann, seriesIndex: -1 });\n });\n\n // Add auto-detected peaks if enabled\n if (showPeakAreas && enablePeakDetection) {\n allDetectedPeaks.forEach(({ peaks, seriesIndex }) => {\n peaks.forEach((peak) => {\n allPeaksWithMeta.push({ peak, seriesIndex });\n });\n });\n }\n\n // Group all overlapping peaks and create annotations with staggering\n const groups = groupOverlappingPeaks(allPeaksWithMeta, annotationOverlapThreshold);\n const plotlyAnnotations: Partial<Plotly.Annotations>[] = [];\n\n for (const group of groups) {\n plotlyAnnotations.push(...createGroupAnnotations(group));\n }\n\n const layout: Partial<Plotly.Layout> = {\n title: title\n ? {\n text: title,\n font: {\n size: 20,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n },\n }\n : undefined,\n width,\n height,\n margin: {\n l: CHROMATOGRAM_LAYOUT.MARGIN_LEFT,\n r: CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,\n b: CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,\n t: title ? CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE : CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,\n pad: CHROMATOGRAM_LAYOUT.MARGIN_PAD,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: { family: \"Inter, sans-serif\" },\n hovermode: showCrosshairs ? \"x\" as const : \"x unified\" as const,\n dragmode: \"zoom\" as const,\n xaxis: {\n title: {\n text: xAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 15,\n },\n showgrid: showGridX,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: xRange,\n autorange: !xRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n yaxis: {\n title: {\n text: yAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 10,\n },\n showgrid: showGridY,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: yRange,\n autorange: !yRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n legend: {\n x: 0.5,\n y: -0.15,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n orientation: \"h\" as const,\n font: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n },\n showlegend: showLegend && series.length > 1,\n annotations: plotlyAnnotations,\n };\n\n const config: Partial<Plotly.Config> = {\n responsive: true,\n displayModeBar: true,\n displaylogo: false,\n modeBarButtonsToRemove: [\n \"lasso2d\",\n \"select2d\",\n ...(showExportButton ? [] : [\"toImage\"] as Plotly.ModeBarDefaultButtons[]),\n ] as Plotly.ModeBarDefaultButtons[],\n ...(showExportButton && {\n toImageButtonOptions: {\n format: \"png\",\n filename: \"chromatogram\",\n width: width,\n height: height,\n },\n }),\n };\n\n Plotly.newPlot(currentRef, plotData, layout, config);\n bindTooltip(currentRef);\n\n return () => {\n if (currentRef) {\n Plotly.purge(currentRef);\n }\n };\n }, [\n processedSeries, allDetectedPeaks, series.length, width, height, title, xAxisTitle, yAxisTitle,\n processedAnnotations, xRange, yRange, showLegend, showGridX, showGridY, showMarkers, markerSize,\n showCrosshairs, enablePeakDetection, peakDetectionOptions, showPeakAreas, boundaryMarkers,\n annotationOverlapThreshold, showExportButton, theme, bindTooltip,\n ]);\n\n return (\n <div className=\"chromatogram-chart-container relative\">\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n {tooltipElement}\n </div>\n );\n};\n\nexport { ChromatogramChart };\n\n"],"names":["EMPTY_ANNOTATIONS","ChromatogramChart","series","width","height","title","xAxisTitle","yAxisTitle","annotations","xRange","yRange","showLegend","showGridX","showGridY","showMarkers","markerSize","showCrosshairs","baselineCorrection","baselineWindowSize","peakDetectionOptions","showPeakAreas","boundaryMarkers","annotationOverlapThreshold","showExportButton","enablePeakDetection","plotRef","useRef","theme","usePlotlyTheme","bindTooltip","tooltipElement","useChartTooltip","processedSeries","useMemo","s","validated","validateSeriesData","applyBaselineCorrection","processedAnnotations","x","y","processUserAnnotations","allDetectedPeaks","peaks","index","detected","detectPeaks","useEffect","currentRef","plotData","traceColor","seriesColor","trace","peaksWithData","collectPeaksWithBoundaryData","boundaryTraces","createBoundaryMarkerTraces","allPeaksWithMeta","ann","seriesIndex","peak","groups","groupOverlappingPeaks","plotlyAnnotations","group","createGroupAnnotations","layout","CHROMATOGRAM_LAYOUT","config","Plotly","jsxs","jsx"],"mappings":";;;;;;;;;;;AAgDA,MAAMA,KAAsC,CAAA,GAEtCC,KAAsD,CAAC;AAAA,EAC3D,QAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,OAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,YAAAC,IAAa;AAAA,EACb,aAAAC,IAAcR;AAAA,EACd,QAAAS;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,gBAAAC,IAAiB;AAAA,EACjB,oBAAAC,IAAqB;AAAA,EACrB,oBAAAC,IAAqB;AAAA,EACrB,sBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,iBAAAC,IAAkB;AAAA,EAClB,4BAAAC,IAA6B;AAAA,EAC7B,kBAAAC,IAAmB;AACrB,MAAM;AAEJ,QAAMC,IAAsBL,MAAyB,QAC/CM,IAAUC,EAAuB,IAAI,GACrCC,IAAQC,GAAA,GACR,EAAE,aAAAC,GAAa,gBAAAC,EAAA,IAAmBC,EAAgB;AAAA,IACtD,QAAQzB;AAAA,IACR,QAAQC;AAAA,EAAA,CACT,GAGKyB,IAAkBC,EAAQ,MACvB/B,EAAO,IAAI,CAACgC,MAAM;AACvB,UAAMC,IAAYC,EAAmBF,EAAE,GAAGA,EAAE,CAAC;AAC7C,WAAO;AAAA,MACL,GAAGA;AAAA,MACH,GAAGC,EAAU;AAAA,MACb,GAAGE,GAAwBF,EAAU,G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E,YAAYhB,KAAcT,EAAO,SAAS;AAAA,MAC1C,aAAa6D;AAAA,IAAA,GAGTK,IAAiC;AAAA,MACrC,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,wBAAwB;AAAA,QACtB;AAAA,QACA;AAAA,QACA,GAAI7C,IAAmB,CAAA,IAAK,CAAC,SAAS;AAAA,MAAA;AAAA,MAExC,GAAIA,KAAoB;AAAA,QACtB,sBAAsB;AAAA,UACpB,QAAQ;AAAA,UACR,UAAU;AAAA,UACV,OAAApB;AAAA,UACA,QAAAC;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAGF,WAAAiE,EAAO,QAAQrB,GAAYC,GAAUiB,GAAQE,CAAM,GACnDvC,EAAYmB,CAAU,GAEf,MAAM;AACX,MAAIA,KACFqB,EAAO,MAAMrB,CAAU;AAAA,IAE3B;AAAA,EACF,GAAG;AAAA,IACDhB;AAAA,IAAiBU;AAAA,IAAkBxC,EAAO;AAAA,IAAQC;AAAA,IAAOC;AAAA,IAAQC;AAAA,IAAOC;AAAA,IAAYC;AAAA,IACpF+B;AAAA,IAAsB7B;AAAA,IAAQC;AAAA,IAAQC;AAAA,IAAYC;AAAA,IAAWC;AAAA,IAAWC;AAAA,IAAaC;AAAA,IACrFC;AAAA,IAAgBQ;AAAA,IAAqBL;AAAA,IAAsBC;AAAA,IAAeC;AAAA,IAC1EC;AAAA,IAA4BC;AAAA,IAAkBI;AAAA,IAAOE;AAAA,EAAA,CACtD,GAGC,gBAAAyC,EAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,KAAK9C,GAAS,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAA,EAAO,CAAG;AAAA,IAC5DK;AAAA,EAAA,GACH;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../utils/colors.cjs"),l=require("./constants.cjs"),i={default:{ax:0,ay:-35},overlap:[{ax:50,ay:-35},{ax:-60,ay:-35},{ax:70,ay:-55},{ax:-80,ay:-55},{ax:50,ay:-75},{ax:-60,ay:-75}]};function T(t,n){const e=[...t].sort((a,s)=>a.peak.x-s.peak.x),o=[];let r=[];for(const a of e){if(r.length===0){r.push(a);continue}const s=r[r.length-1];Math.abs(a.peak.x-s.peak.x)<n?r.push(a):(o.push(r),r=[a])}return r.length>0&&o.push(r),o}function O(t,n,e){const o=n===-1,r=o?c.COLORS.GREY_500:c.CHART_COLORS[n%c.CHART_COLORS.length],a=o?c.COLORS.BLACK_900:r,s=t.text??(t._computed?.area===void 0?"":`Area: ${t._computed.area.toFixed(2)}`),u=o&&t.ax!==void 0?t.ax:e.ax,A=o&&t.ay!==void 0?t.ay:e.ay;return{x:t.x,y:t.y,text:s,showarrow:!0,arrowhead:2,arrowsize:1,arrowwidth:1,arrowcolor:r,ax:u,ay:A,font:{size:o?l.CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE:l.CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,color:a,family:"Inter, sans-serif"},bgcolor:c.COLORS.WHITE,borderpad:2,bordercolor:o?void 0:r,borderwidth:o?0:1}}function d(t){if(t.length===1){const{peak:e,seriesIndex:o}=t[0];return[O(e,o,i.default)]}return[...t].sort((e,o)=>e.peak.y-o.peak.y).map(({peak:e,seriesIndex:o},r)=>{const a=i.overlap[r%i.overlap.length];return O(e,o,a)})}exports.ANNOTATION_SLOTS=i;exports.createGroupAnnotations=d;exports.createPeakAnnotation=O;exports.groupOverlappingPeaks=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../../utils/colors.cjs"),O=require("./constants.cjs"),A={default:{ax:0,ay:-35},overlap:[{ax:50,ay:-35},{ax:-60,ay:-35},{ax:70,ay:-55},{ax:-80,ay:-55},{ax:50,ay:-75},{ax:-60,ay:-75}]};function u(t,n){const e=[...t].sort((a,s)=>a.peak.x-s.peak.x),o=[];let r=[];for(const a of e){if(r.length===0){r.push(a);continue}const s=r[r.length-1];Math.abs(a.peak.x-s.peak.x)<n?r.push(a):(o.push(r),r=[a])}return r.length>0&&o.push(r),o}function c(t,n,e){const o=n===-1,r=o?O.CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_COLOR:T.seriesColor(n),a=o?O.CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_TEXT_COLOR:r,s=t.text??(t._computed?.area===void 0?"":`Area: ${t._computed.area.toFixed(2)}`),i=o&&t.ax!==void 0?t.ax:e.ax,N=o&&t.ay!==void 0?t.ay:e.ay;return{x:t.x,y:t.y,text:s,showarrow:!0,arrowhead:2,arrowsize:1,arrowwidth:1,arrowcolor:r,ax:i,ay:N,font:{size:o?O.CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE:O.CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,color:a,family:"Inter, sans-serif"},bgcolor:O.CHROMATOGRAM_ANNOTATION.BACKGROUND_COLOR,borderpad:2,bordercolor:o?void 0:r,borderwidth:o?0:1}}function l(t){if(t.length===1){const{peak:e,seriesIndex:o}=t[0];return[c(e,o,A.default)]}return[...t].sort((e,o)=>e.peak.y-o.peak.y).map(({peak:e,seriesIndex:o},r)=>{const a=A.overlap[r%A.overlap.length];return c(e,o,a)})}exports.ANNOTATION_SLOTS=A;exports.createGroupAnnotations=l;exports.createPeakAnnotation=c;exports.groupOverlappingPeaks=u;
2
2
  //# sourceMappingURL=annotations.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotations.cjs","sources":["../../../../src/components/charts/ChromatogramChart/annotations.ts"],"sourcesContent":["/**\n * Annotation utilities for ChromatogramChart\n */\n\nimport { COLORS, CHART_COLORS } from \"../../../utils/colors\";\n\nimport { CHROMATOGRAM_ANNOTATION } from \"./constants\";\n\nimport type { PeakAnnotation, PeakWithMeta } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/**\n * Annotation slot positions for peak labels\n */\nexport const ANNOTATION_SLOTS = {\n default: { ax: 0, ay: -35 },\n overlap: [\n { ax: 50, ay: -35 }, // Right, level 1\n { ax: -60, ay: -35 }, // Left, level 1\n { ax: 70, ay: -55 }, // Right, level 2\n { ax: -80, ay: -55 }, // Left, level 2\n { ax: 50, ay: -75 }, // Right, level 3\n { ax: -60, ay: -75 }, // Left, level 3\n ],\n};\n\n/**\n * Group overlapping peaks by retention time (x) proximity\n */\nexport function groupOverlappingPeaks(\n peaksWithMeta: PeakWithMeta[],\n overlapThreshold: number\n): PeakWithMeta[][] {\n const sorted = [...peaksWithMeta].sort((a, b) => a.peak.x - b.peak.x);\n\n const groups: PeakWithMeta[][] = [];\n let currentGroup: PeakWithMeta[] = [];\n\n for (const current of sorted) {\n if (currentGroup.length === 0) {\n currentGroup.push(current);\n continue;\n }\n\n const lastInGroup = currentGroup[currentGroup.length - 1];\n const timeDiff = Math.abs(current.peak.x - lastInGroup.peak.x);\n\n if (timeDiff < overlapThreshold) {\n currentGroup.push(current);\n } else {\n groups.push(currentGroup);\n currentGroup = [current];\n }\n }\n\n if (currentGroup.length > 0) {\n groups.push(currentGroup);\n }\n\n return groups;\n}\n\n/**\n * Create a Plotly annotation for a peak.\n * seriesIndex of -1 indicates a user-defined annotation (uses grey/black styling).\n */\nexport function createPeakAnnotation(\n peak: PeakAnnotation,\n seriesIndex: number,\n slot: { ax: number; ay: number }\n): Partial<Plotly.Annotations> {\n const isUserDefined = seriesIndex === -1;\n const color = isUserDefined\n ? COLORS.GREY_500\n : CHART_COLORS[seriesIndex % CHART_COLORS.length];\n const textColor = isUserDefined ? COLORS.BLACK_900 : color;\n\n // Use provided text or auto-generate from computed area\n const text = peak.text ?? (peak._computed?.area === undefined ? \"\" : `Area: ${peak._computed.area.toFixed(2)}`);\n\n // For user-defined annotations, respect their ax/ay if provided\n const ax = isUserDefined && peak.ax !== undefined ? peak.ax : slot.ax;\n const ay = isUserDefined && peak.ay !== undefined ? peak.ay : slot.ay;\n\n return {\n x: peak.x,\n y: peak.y,\n text,\n showarrow: true,\n arrowhead: 2,\n arrowsize: 1,\n arrowwidth: 1,\n arrowcolor: color,\n ax,\n ay,\n font: {\n size: isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE\n : CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,\n color: textColor,\n family: \"Inter, sans-serif\",\n },\n bgcolor: COLORS.WHITE,\n borderpad: 2,\n bordercolor: isUserDefined ? undefined : color,\n borderwidth: isUserDefined ? 0 : 1,\n };\n}\n\n/**\n * Create annotations for a group of peaks, handling overlap positioning\n */\nexport function createGroupAnnotations(\n group: PeakWithMeta[]\n): Partial<Plotly.Annotations>[] {\n if (group.length === 1) {\n const { peak, seriesIndex } = group[0];\n return [createPeakAnnotation(peak, seriesIndex, ANNOTATION_SLOTS.default)];\n }\n\n // Sort by intensity (y, lowest first) so lower peaks get closer annotations\n const sortedGroup = [...group].sort((a, b) => a.peak.y - b.peak.y);\n\n return sortedGroup.map(({ peak, seriesIndex }, slotIndex) => {\n const slot =\n ANNOTATION_SLOTS.overlap[slotIndex % ANNOTATION_SLOTS.overlap.length];\n return createPeakAnnotation(peak, seriesIndex, slot);\n });\n}\n\n"],"names":["ANNOTATION_SLOTS","groupOverlappingPeaks","peaksWithMeta","overlapThreshold","sorted","b","groups","currentGroup","current","lastInGroup","createPeakAnnotation","peak","seriesIndex","slot","isUserDefined","color","COLORS","CHART_COLORS","textColor","text","ax","ay","CHROMATOGRAM_ANNOTATION","createGroupAnnotations","group","a","slotIndex"],"mappings":"0JAcaA,EAAmB,CAC9B,QAAS,CAAE,GAAI,EAAG,GAAI,GAAA,EACtB,QAAS,CACP,CAAE,GAAI,GAAI,GAAI,GAAA,EACd,CAAE,GAAI,IAAK,GAAI,GAAA,EACf,CAAE,GAAI,GAAI,GAAI,GAAA,EACd,CAAE,GAAI,IAAK,GAAI,GAAA,EACf,CAAE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BA,EAAAA,wBAAwB,0BAC5B,MAAOJ,EACP,OAAQ,mBAAA,EAEV,QAASF,EAAAA,OAAO,MAChB,UAAW,EACX,YAAaF,EAAgB,OAAYC,EACzC,YAAaD,EAAgB,EAAI,CAAA,CAErC,CAKO,SAASS,EACdC,EAC+B,CAC/B,GAAIA,EAAM,SAAW,EAAG,CACtB,KAAM,CAAE,KAAAb,EAAM,YAAAC,GAAgBY,EAAM,CAAC,EACrC,MAAO,CAACd,EAAqBC,EAAMC,EAAaZ,EAAiB,OAAO,CAAC,CAC3E,CAKA,MAFoB,CAAC,GAAGwB,CAAK,EAAE,KAAK,CAACC,EAAGpB,IAAMoB,EAAE,KAAK,EAAIpB,EAAE,KAAK,CAAC,EAE9C,IAAI,CAAC,CAAE,KAAAM,EAAM,YAAAC,CAAA,EAAec,IAAc,CAC3D,MAAMb,EACJb,EAAiB,QAAQ0B,EAAY1B,EAAiB,QAAQ,MAAM,EACtE,OAAOU,EAAqBC,EAAMC,EAAaC,CAAI,CACrD,CAAC,CACH"}
1
+ {"version":3,"file":"annotations.cjs","sources":["../../../../src/components/charts/ChromatogramChart/annotations.ts"],"sourcesContent":["/**\n * Annotation utilities for ChromatogramChart\n */\n\nimport { seriesColor } from \"../../../utils/colors\";\n\nimport { CHROMATOGRAM_ANNOTATION } from \"./constants\";\n\nimport type { PeakAnnotation, PeakWithMeta } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/**\n * Annotation slot positions for peak labels\n */\nexport const ANNOTATION_SLOTS = {\n default: { ax: 0, ay: -35 },\n overlap: [\n { ax: 50, ay: -35 }, // Right, level 1\n { ax: -60, ay: -35 }, // Left, level 1\n { ax: 70, ay: -55 }, // Right, level 2\n { ax: -80, ay: -55 }, // Left, level 2\n { ax: 50, ay: -75 }, // Right, level 3\n { ax: -60, ay: -75 }, // Left, level 3\n ],\n};\n\n/**\n * Group overlapping peaks by retention time (x) proximity\n */\nexport function groupOverlappingPeaks(\n peaksWithMeta: PeakWithMeta[],\n overlapThreshold: number\n): PeakWithMeta[][] {\n const sorted = [...peaksWithMeta].sort((a, b) => a.peak.x - b.peak.x);\n\n const groups: PeakWithMeta[][] = [];\n let currentGroup: PeakWithMeta[] = [];\n\n for (const current of sorted) {\n if (currentGroup.length === 0) {\n currentGroup.push(current);\n continue;\n }\n\n const lastInGroup = currentGroup[currentGroup.length - 1];\n const timeDiff = Math.abs(current.peak.x - lastInGroup.peak.x);\n\n if (timeDiff < overlapThreshold) {\n currentGroup.push(current);\n } else {\n groups.push(currentGroup);\n currentGroup = [current];\n }\n }\n\n if (currentGroup.length > 0) {\n groups.push(currentGroup);\n }\n\n return groups;\n}\n\n/**\n * Create a Plotly annotation for a peak.\n * seriesIndex of -1 indicates a user-defined annotation (uses grey/black styling).\n */\nexport function createPeakAnnotation(\n peak: PeakAnnotation,\n seriesIndex: number,\n slot: { ax: number; ay: number }\n): Partial<Plotly.Annotations> {\n const isUserDefined = seriesIndex === -1;\n const color = isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_COLOR\n : seriesColor(seriesIndex);\n const textColor = isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_TEXT_COLOR\n : color;\n\n // Use provided text or auto-generate from computed area\n const text = peak.text ?? (peak._computed?.area === undefined ? \"\" : `Area: ${peak._computed.area.toFixed(2)}`);\n\n // For user-defined annotations, respect their ax/ay if provided\n const ax = isUserDefined && peak.ax !== undefined ? peak.ax : slot.ax;\n const ay = isUserDefined && peak.ay !== undefined ? peak.ay : slot.ay;\n\n return {\n x: peak.x,\n y: peak.y,\n text,\n showarrow: true,\n arrowhead: 2,\n arrowsize: 1,\n arrowwidth: 1,\n arrowcolor: color,\n ax,\n ay,\n font: {\n size: isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE\n : CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,\n color: textColor,\n family: \"Inter, sans-serif\",\n },\n bgcolor: CHROMATOGRAM_ANNOTATION.BACKGROUND_COLOR,\n borderpad: 2,\n bordercolor: isUserDefined ? undefined : color,\n borderwidth: isUserDefined ? 0 : 1,\n };\n}\n\n/**\n * Create annotations for a group of peaks, handling overlap positioning\n */\nexport function createGroupAnnotations(\n group: PeakWithMeta[]\n): Partial<Plotly.Annotations>[] {\n if (group.length === 1) {\n const { peak, seriesIndex } = group[0];\n return [createPeakAnnotation(peak, seriesIndex, ANNOTATION_SLOTS.default)];\n }\n\n // Sort by intensity (y, lowest first) so lower peaks get closer annotations\n const sortedGroup = [...group].sort((a, b) => a.peak.y - b.peak.y);\n\n return sortedGroup.map(({ peak, seriesIndex }, slotIndex) => {\n const slot =\n ANNOTATION_SLOTS.overlap[slotIndex % ANNOTATION_SLOTS.overlap.length];\n return createPeakAnnotation(peak, seriesIndex, slot);\n });\n}\n\n"],"names":["ANNOTATION_SLOTS","groupOverlappingPeaks","peaksWithMeta","overlapThreshold","sorted","b","groups","currentGroup","current","lastInGroup","createPeakAnnotation","peak","seriesIndex","slot","isUserDefined","color","CHROMATOGRAM_ANNOTATION","seriesColor","textColor","text","ax","ay","createGroupAnnotations","group","a","slotIndex"],"mappings":"0JAcaA,EAAmB,CAC9B,QAAS,CAAE,GAAI,EAAG,GAAI,GAAA,EACtB,QAAS,CACP,CAAE,GAAI,GAAI,GAAI,GAAA,EACd,CAAE,GAAI,IAAK,GAAI,GAAA,EACf,CAAE,GAAI,GAAI,GAAI,GAAA,EACd,CAAE,GAAI,IAAK,GAAI,GAAA,EACf,CAAE,GAAI,GAAI,GAAI,GAAA,EACd,CAAE,GAAI,IAAK,GAAI,GAAA,CAAI,CAEvB,EAKO,SAASC,EACdC,EACAC,EACkB,CAClB,MAAMC,EAAS,CAAC,GAAGF,CAAa,EAAE,KAAK,CAAC,EAAGG,IAAM,EAAE,KAAK,EAAIA,EAAE,KAAK,CAAC,EAE9DC,EAA2B,CAAA,EACjC,IAAIC,EAA+B,CAAA,EAEnC,UAAWC,KAAWJ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CAACb,EAAqBC,EAAMC,EAAaZ,EAAiB,OAAO,CAAC,CAC3E,CAKA,MAFoB,CAAC,GAAGuB,CAAK,EAAE,KAAK,CAACC,EAAGnB,IAAMmB,EAAE,KAAK,EAAInB,EAAE,KAAK,CAAC,EAE9C,IAAI,CAAC,CAAE,KAAAM,EAAM,YAAAC,CAAA,EAAea,IAAc,CAC3D,MAAMZ,EACJb,EAAiB,QAAQyB,EAAYzB,EAAiB,QAAQ,MAAM,EACtE,OAAOU,EAAqBC,EAAMC,EAAaC,CAAI,CACrD,CAAC,CACH"}
@@ -1,6 +1,6 @@
1
- import { COLORS as c, CHART_COLORS as l } from "../../../utils/colors.js";
2
- import { CHROMATOGRAM_ANNOTATION as x } from "./constants.js";
3
- const i = {
1
+ import { seriesColor as x } from "../../../utils/colors.js";
2
+ import { CHROMATOGRAM_ANNOTATION as i } from "./constants.js";
3
+ const c = {
4
4
  default: { ax: 0, ay: -35 },
5
5
  overlap: [
6
6
  { ax: 50, ay: -35 },
@@ -17,57 +17,57 @@ const i = {
17
17
  // Left, level 3
18
18
  ]
19
19
  };
20
- function y(t, n) {
21
- const e = [...t].sort((a, s) => a.peak.x - s.peak.x), o = [];
22
- let r = [];
20
+ function d(r, n) {
21
+ const e = [...r].sort((a, s) => a.peak.x - s.peak.x), o = [];
22
+ let t = [];
23
23
  for (const a of e) {
24
- if (r.length === 0) {
25
- r.push(a);
24
+ if (t.length === 0) {
25
+ t.push(a);
26
26
  continue;
27
27
  }
28
- const s = r[r.length - 1];
29
- Math.abs(a.peak.x - s.peak.x) < n ? r.push(a) : (o.push(r), r = [a]);
28
+ const s = t[t.length - 1];
29
+ Math.abs(a.peak.x - s.peak.x) < n ? t.push(a) : (o.push(t), t = [a]);
30
30
  }
31
- return r.length > 0 && o.push(r), o;
31
+ return t.length > 0 && o.push(t), o;
32
32
  }
33
- function f(t, n, e) {
34
- const o = n === -1, r = o ? c.GREY_500 : l[n % l.length], a = o ? c.BLACK_900 : r, s = t.text ?? (t._computed?.area === void 0 ? "" : `Area: ${t._computed.area.toFixed(2)}`), u = o && t.ax !== void 0 ? t.ax : e.ax, d = o && t.ay !== void 0 ? t.ay : e.ay;
33
+ function u(r, n, e) {
34
+ const o = n === -1, t = o ? i.USER_ANNOTATION_COLOR : x(n), a = o ? i.USER_ANNOTATION_TEXT_COLOR : t, s = r.text ?? (r._computed?.area === void 0 ? "" : `Area: ${r._computed.area.toFixed(2)}`), O = o && r.ax !== void 0 ? r.ax : e.ax, l = o && r.ay !== void 0 ? r.ay : e.ay;
35
35
  return {
36
- x: t.x,
37
- y: t.y,
36
+ x: r.x,
37
+ y: r.y,
38
38
  text: s,
39
39
  showarrow: !0,
40
40
  arrowhead: 2,
41
41
  arrowsize: 1,
42
42
  arrowwidth: 1,
43
- arrowcolor: r,
44
- ax: u,
45
- ay: d,
43
+ arrowcolor: t,
44
+ ax: O,
45
+ ay: l,
46
46
  font: {
47
- size: o ? x.USER_ANNOTATION_FONT_SIZE : x.AUTO_ANNOTATION_FONT_SIZE,
47
+ size: o ? i.USER_ANNOTATION_FONT_SIZE : i.AUTO_ANNOTATION_FONT_SIZE,
48
48
  color: a,
49
49
  family: "Inter, sans-serif"
50
50
  },
51
- bgcolor: c.WHITE,
51
+ bgcolor: i.BACKGROUND_COLOR,
52
52
  borderpad: 2,
53
- bordercolor: o ? void 0 : r,
53
+ bordercolor: o ? void 0 : t,
54
54
  borderwidth: o ? 0 : 1
55
55
  };
56
56
  }
57
- function A(t) {
58
- if (t.length === 1) {
59
- const { peak: e, seriesIndex: o } = t[0];
60
- return [f(e, o, i.default)];
57
+ function p(r) {
58
+ if (r.length === 1) {
59
+ const { peak: e, seriesIndex: o } = r[0];
60
+ return [u(e, o, c.default)];
61
61
  }
62
- return [...t].sort((e, o) => e.peak.y - o.peak.y).map(({ peak: e, seriesIndex: o }, r) => {
63
- const a = i.overlap[r % i.overlap.length];
64
- return f(e, o, a);
62
+ return [...r].sort((e, o) => e.peak.y - o.peak.y).map(({ peak: e, seriesIndex: o }, t) => {
63
+ const a = c.overlap[t % c.overlap.length];
64
+ return u(e, o, a);
65
65
  });
66
66
  }
67
67
  export {
68
- i as ANNOTATION_SLOTS,
69
- A as createGroupAnnotations,
70
- f as createPeakAnnotation,
71
- y as groupOverlappingPeaks
68
+ c as ANNOTATION_SLOTS,
69
+ p as createGroupAnnotations,
70
+ u as createPeakAnnotation,
71
+ d as groupOverlappingPeaks
72
72
  };
73
73
  //# sourceMappingURL=annotations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotations.js","sources":["../../../../src/components/charts/ChromatogramChart/annotations.ts"],"sourcesContent":["/**\n * Annotation utilities for ChromatogramChart\n */\n\nimport { COLORS, CHART_COLORS } from \"../../../utils/colors\";\n\nimport { CHROMATOGRAM_ANNOTATION } from \"./constants\";\n\nimport type { PeakAnnotation, PeakWithMeta } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/**\n * Annotation slot positions for peak labels\n */\nexport const ANNOTATION_SLOTS = {\n default: { ax: 0, ay: -35 },\n overlap: [\n { ax: 50, ay: -35 }, // Right, level 1\n { ax: -60, ay: -35 }, // Left, level 1\n { ax: 70, ay: -55 }, // Right, level 2\n { ax: -80, ay: -55 }, // Left, level 2\n { ax: 50, ay: -75 }, // Right, level 3\n { ax: -60, ay: -75 }, // Left, level 3\n ],\n};\n\n/**\n * Group overlapping peaks by retention time (x) proximity\n */\nexport function groupOverlappingPeaks(\n peaksWithMeta: PeakWithMeta[],\n overlapThreshold: number\n): PeakWithMeta[][] {\n const sorted = [...peaksWithMeta].sort((a, b) => a.peak.x - b.peak.x);\n\n const groups: PeakWithMeta[][] = [];\n let currentGroup: PeakWithMeta[] = [];\n\n for (const current of sorted) {\n if (currentGroup.length === 0) {\n currentGroup.push(current);\n continue;\n }\n\n const lastInGroup = currentGroup[currentGroup.length - 1];\n const timeDiff = Math.abs(current.peak.x - lastInGroup.peak.x);\n\n if (timeDiff < overlapThreshold) {\n currentGroup.push(current);\n } else {\n groups.push(currentGroup);\n currentGroup = [current];\n }\n }\n\n if (currentGroup.length > 0) {\n groups.push(currentGroup);\n }\n\n return groups;\n}\n\n/**\n * Create a Plotly annotation for a peak.\n * seriesIndex of -1 indicates a user-defined annotation (uses grey/black styling).\n */\nexport function createPeakAnnotation(\n peak: PeakAnnotation,\n seriesIndex: number,\n slot: { ax: number; ay: number }\n): Partial<Plotly.Annotations> {\n const isUserDefined = seriesIndex === -1;\n const color = isUserDefined\n ? COLORS.GREY_500\n : CHART_COLORS[seriesIndex % CHART_COLORS.length];\n const textColor = isUserDefined ? COLORS.BLACK_900 : color;\n\n // Use provided text or auto-generate from computed area\n const text = peak.text ?? (peak._computed?.area === undefined ? \"\" : `Area: ${peak._computed.area.toFixed(2)}`);\n\n // For user-defined annotations, respect their ax/ay if provided\n const ax = isUserDefined && peak.ax !== undefined ? peak.ax : slot.ax;\n const ay = isUserDefined && peak.ay !== undefined ? peak.ay : slot.ay;\n\n return {\n x: peak.x,\n y: peak.y,\n text,\n showarrow: true,\n arrowhead: 2,\n arrowsize: 1,\n arrowwidth: 1,\n arrowcolor: color,\n ax,\n ay,\n font: {\n size: isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE\n : CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,\n color: textColor,\n family: \"Inter, sans-serif\",\n },\n bgcolor: COLORS.WHITE,\n borderpad: 2,\n bordercolor: isUserDefined ? undefined : color,\n borderwidth: isUserDefined ? 0 : 1,\n };\n}\n\n/**\n * Create annotations for a group of peaks, handling overlap positioning\n */\nexport function createGroupAnnotations(\n group: PeakWithMeta[]\n): Partial<Plotly.Annotations>[] {\n if (group.length === 1) {\n const { peak, seriesIndex } = group[0];\n return [createPeakAnnotation(peak, seriesIndex, ANNOTATION_SLOTS.default)];\n }\n\n // Sort by intensity (y, lowest first) so lower peaks get closer annotations\n const sortedGroup = [...group].sort((a, b) => a.peak.y - b.peak.y);\n\n return sortedGroup.map(({ peak, seriesIndex }, slotIndex) => {\n const slot =\n ANNOTATION_SLOTS.overlap[slotIndex % ANNOTATION_SLOTS.overlap.length];\n return createPeakAnnotation(peak, seriesIndex, slot);\n });\n}\n\n"],"names":["ANNOTATION_SLOTS","groupOverlappingPeaks","peaksWithMeta","overlapThreshold","sorted","b","groups","currentGroup","current","lastInGroup","createPeakAnnotation","peak","seriesIndex","slot","isUserDefined","color","COLORS","CHART_COLORS","textColor","text","ax","ay","CHROMATOGRAM_ANNOTATION","createGroupAnnotations","group","a","slotIndex"],"mappings":";;AAcO,MAAMA,IAAmB;AAAA,EAC9B,SAAS,EAAE,IAAI,GAAG,IAAI,IAAA;AAAA,EACtB,SAAS;AAAA,IACP,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAAA,IACf,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAAA,IACf,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAAA,EAAI;AAEvB;AAKO,SAASC,EACdC,GACAC,GACkB;AAClB,QAAMC,IAAS,CAAC,GAAGF,CAAa,EAAE,KAAK,CAAC,GAAGG,MAAM,EAAE,KAAK,IAAIA,EAAE,KAAK,CAAC,GAE9DC,IAA2B,CAAA;AACjC,MAAIC,IAA+B,CAAA;AAEnC,aAAWC,KAAWJ,GAAQ;AAC5B,QAAIG,EAAa,WAAW,GAAG;AAC7B,MAAAA,EAAa,KAAKC,CAAO;AACzB;AAAA,IACF;AAEA,UAAMC,IAAcF,EAAaA,EAAa,SAAS,CAAC;AAGxD,IAFiB,KAAK,IAAIC,EAAQ,KAAK,IAAIC,EAAY,KAAK,CAAC,IAE9CN,IACbI,EAAa,KAAKC,CAAO,KAEzBF,EAAO,KAAKC,CAAY,GACxBA,IAAe,CAACC,CAAO;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AC,EAAE,MAAAM,GAAM,aAAAC,EAAA,GAAec,MAAc;AAC3D,UAAMb,IACJb,EAAiB,QAAQ0B,IAAY1B,EAAiB,QAAQ,MAAM;AACtE,WAAOU,EAAqBC,GAAMC,GAAaC,CAAI;AAAA,EACrD,CAAC;AACH;"}
1
+ {"version":3,"file":"annotations.js","sources":["../../../../src/components/charts/ChromatogramChart/annotations.ts"],"sourcesContent":["/**\n * Annotation utilities for ChromatogramChart\n */\n\nimport { seriesColor } from \"../../../utils/colors\";\n\nimport { CHROMATOGRAM_ANNOTATION } from \"./constants\";\n\nimport type { PeakAnnotation, PeakWithMeta } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/**\n * Annotation slot positions for peak labels\n */\nexport const ANNOTATION_SLOTS = {\n default: { ax: 0, ay: -35 },\n overlap: [\n { ax: 50, ay: -35 }, // Right, level 1\n { ax: -60, ay: -35 }, // Left, level 1\n { ax: 70, ay: -55 }, // Right, level 2\n { ax: -80, ay: -55 }, // Left, level 2\n { ax: 50, ay: -75 }, // Right, level 3\n { ax: -60, ay: -75 }, // Left, level 3\n ],\n};\n\n/**\n * Group overlapping peaks by retention time (x) proximity\n */\nexport function groupOverlappingPeaks(\n peaksWithMeta: PeakWithMeta[],\n overlapThreshold: number\n): PeakWithMeta[][] {\n const sorted = [...peaksWithMeta].sort((a, b) => a.peak.x - b.peak.x);\n\n const groups: PeakWithMeta[][] = [];\n let currentGroup: PeakWithMeta[] = [];\n\n for (const current of sorted) {\n if (currentGroup.length === 0) {\n currentGroup.push(current);\n continue;\n }\n\n const lastInGroup = currentGroup[currentGroup.length - 1];\n const timeDiff = Math.abs(current.peak.x - lastInGroup.peak.x);\n\n if (timeDiff < overlapThreshold) {\n currentGroup.push(current);\n } else {\n groups.push(currentGroup);\n currentGroup = [current];\n }\n }\n\n if (currentGroup.length > 0) {\n groups.push(currentGroup);\n }\n\n return groups;\n}\n\n/**\n * Create a Plotly annotation for a peak.\n * seriesIndex of -1 indicates a user-defined annotation (uses grey/black styling).\n */\nexport function createPeakAnnotation(\n peak: PeakAnnotation,\n seriesIndex: number,\n slot: { ax: number; ay: number }\n): Partial<Plotly.Annotations> {\n const isUserDefined = seriesIndex === -1;\n const color = isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_COLOR\n : seriesColor(seriesIndex);\n const textColor = isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_TEXT_COLOR\n : color;\n\n // Use provided text or auto-generate from computed area\n const text = peak.text ?? (peak._computed?.area === undefined ? \"\" : `Area: ${peak._computed.area.toFixed(2)}`);\n\n // For user-defined annotations, respect their ax/ay if provided\n const ax = isUserDefined && peak.ax !== undefined ? peak.ax : slot.ax;\n const ay = isUserDefined && peak.ay !== undefined ? peak.ay : slot.ay;\n\n return {\n x: peak.x,\n y: peak.y,\n text,\n showarrow: true,\n arrowhead: 2,\n arrowsize: 1,\n arrowwidth: 1,\n arrowcolor: color,\n ax,\n ay,\n font: {\n size: isUserDefined\n ? CHROMATOGRAM_ANNOTATION.USER_ANNOTATION_FONT_SIZE\n : CHROMATOGRAM_ANNOTATION.AUTO_ANNOTATION_FONT_SIZE,\n color: textColor,\n family: \"Inter, sans-serif\",\n },\n bgcolor: CHROMATOGRAM_ANNOTATION.BACKGROUND_COLOR,\n borderpad: 2,\n bordercolor: isUserDefined ? undefined : color,\n borderwidth: isUserDefined ? 0 : 1,\n };\n}\n\n/**\n * Create annotations for a group of peaks, handling overlap positioning\n */\nexport function createGroupAnnotations(\n group: PeakWithMeta[]\n): Partial<Plotly.Annotations>[] {\n if (group.length === 1) {\n const { peak, seriesIndex } = group[0];\n return [createPeakAnnotation(peak, seriesIndex, ANNOTATION_SLOTS.default)];\n }\n\n // Sort by intensity (y, lowest first) so lower peaks get closer annotations\n const sortedGroup = [...group].sort((a, b) => a.peak.y - b.peak.y);\n\n return sortedGroup.map(({ peak, seriesIndex }, slotIndex) => {\n const slot =\n ANNOTATION_SLOTS.overlap[slotIndex % ANNOTATION_SLOTS.overlap.length];\n return createPeakAnnotation(peak, seriesIndex, slot);\n });\n}\n\n"],"names":["ANNOTATION_SLOTS","groupOverlappingPeaks","peaksWithMeta","overlapThreshold","sorted","b","groups","currentGroup","current","lastInGroup","createPeakAnnotation","peak","seriesIndex","slot","isUserDefined","color","CHROMATOGRAM_ANNOTATION","seriesColor","textColor","text","ax","ay","createGroupAnnotations","group","a","slotIndex"],"mappings":";;AAcO,MAAMA,IAAmB;AAAA,EAC9B,SAAS,EAAE,IAAI,GAAG,IAAI,IAAA;AAAA,EACtB,SAAS;AAAA,IACP,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAAA,IACf,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAAA,IACf,EAAE,IAAI,IAAI,IAAI,IAAA;AAAA;AAAA,IACd,EAAE,IAAI,KAAK,IAAI,IAAA;AAAA;AAAA,EAAI;AAEvB;AAKO,SAASC,EACdC,GACAC,GACkB;AAClB,QAAMC,IAAS,CAAC,GAAGF,CAAa,EAAE,KAAK,CAAC,GAAGG,MAAM,EAAE,KAAK,IAAIA,EAAE,KAAK,CAAC,GAE9DC,IAA2B,CAAA;AACjC,MAAIC,IAA+B,CAAA;AAEnC,aAAWC,KAAWJ,GAAQ;AAC5B,QAAIG,EAAa,WAAW,GAAG;AAC7B,MAAAA,EAAa,KAAKC,CAAO;AACzB;AAAA,IACF;AAEA,UAAMC,IAAcF,EAAaA,EAAa,SAAS,CAAC;AAGxD,IAFiB,KAAK,IAAIC,EAAQ,KAAK,IAAIC,EAAY,KAAK,CAAC,IAE9CN,IACbI,EAAa,KAAKC,CAAO,KAEzBF,EAAO,KAAKC,CAAY,GACxBA,IAAe,CAACC,CAAO;AAAA,EAE3B;AAEA,SAAID,EAAa,SAAS,KACxBD,EAAO,KAAKC,CAAY,GAGnBD;AAC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AAYzB,EAAiB,QAAQ,MAAM;AACtE,WAAOU,EAAqBC,GAAMC,GAAaC,CAAI;AAAA,EACrD,CAAC;AACH;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../utils/colors.cjs"),T=-5,m=-12,d=-16;function i(o,e,t,r){return t==="none"?[]:[{x:[o],y:[e],type:"scatter",mode:"markers",marker:{symbol:t==="diamond"?"diamond":"triangle-up",size:8,color:r},showlegend:!1,hoverinfo:"skip"}]}function A(o){const e=[];for(const{peaks:t,seriesIndex:r,x:s}of o){const a=c.CHART_COLORS[r%c.CHART_COLORS.length],u=T+r*d,R=m+r*d;for(const n of t){const k=n._computed?.startIndex??0,M=n._computed?.endIndex??0,_=s[k],l=s[M],p=n.startMarker??"triangle",f=n.endMarker??"diamond";e.push(...i(_,u,p,a)),e.push(...i(l,R,f,a))}}return e}exports.createBoundaryMarkerTraces=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../utils/colors.cjs"),m=-5,y=-12,c=-16;function d(o,e,t,r){return t==="none"?[]:[{x:[o],y:[e],type:"scatter",mode:"markers",marker:{symbol:t==="diamond"?"diamond":"triangle-up",size:8,color:r},showlegend:!1,hoverinfo:"skip"}]}function T(o){const e=[];for(const{peaks:t,seriesIndex:r,x:s}of o){const a=f.seriesColor(r),i=m+r*c,u=y+r*c;for(const n of t){const k=n._computed?.startIndex??0,M=n._computed?.endIndex??0,l=s[k],p=s[M],R=n.startMarker??"triangle",_=n.endMarker??"diamond";e.push(...d(l,i,R,a)),e.push(...d(p,u,_,a))}}return e}exports.createBoundaryMarkerTraces=T;
2
2
  //# sourceMappingURL=boundaryMarkers.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"boundaryMarkers.cjs","sources":["../../../../src/components/charts/ChromatogramChart/boundaryMarkers.ts"],"sourcesContent":["/**\n * Boundary marker utilities for ChromatogramChart\n */\n\nimport { CHART_COLORS } from \"../../../utils/colors\";\n\nimport type { PeakAnnotation, BoundaryMarkerType } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/** Base Y position for start boundary markers (below the x-axis) */\nconst BOUNDARY_MARKER_START_Y = -5;\n/** Y position for end boundary markers (below start markers) */\nconst BOUNDARY_MARKER_END_Y = -12;\n/** Y offset between series to prevent overlap */\nconst BOUNDARY_MARKER_SERIES_OFFSET = -16;\n\n/**\n * Create a marker trace for a boundary point.\n * Markers are placed on the x-axis below 0, staggered by series index.\n */\nfunction createMarkerTrace(\n xPos: number,\n yPos: number,\n markerType: BoundaryMarkerType,\n color: string\n): Plotly.Data[] {\n if (markerType === \"none\") {\n return [];\n }\n\n return [\n {\n x: [xPos],\n y: [yPos],\n type: \"scatter\" as const,\n mode: \"markers\" as const,\n marker: {\n symbol: markerType === \"diamond\" ? (\"diamond\" as const) : (\"triangle-up\" as const),\n size: 8,\n color,\n },\n showlegend: false,\n hoverinfo: \"skip\" as const,\n },\n ];\n}\n\n/**\n * Create boundary marker traces for peaks.\n * Uses per-peak startMarker/endMarker settings with defaults:\n * - startMarker: \"triangle\" (default)\n * - endMarker: \"diamond\" (default)\n */\nexport function createBoundaryMarkerTraces(\n allPeaks: {\n peaks: PeakAnnotation[];\n seriesIndex: number;\n x: number[];\n y: number[];\n }[]\n): Plotly.Data[] {\n const traces: Plotly.Data[] = [];\n\n for (const { peaks, seriesIndex, x } of allPeaks) {\n const color = CHART_COLORS[seriesIndex % CHART_COLORS.length];\n // Separate y positions for start vs end markers to prevent overlap when peaks are adjacent\n // Also stagger by series index to prevent overlap between different traces\n const startMarkerY = BOUNDARY_MARKER_START_Y + seriesIndex * BOUNDARY_MARKER_SERIES_OFFSET;\n const endMarkerY = BOUNDARY_MARKER_END_Y + seriesIndex * BOUNDARY_MARKER_SERIES_OFFSET;\n\n for (const peak of peaks) {\n const startIdx = peak._computed?.startIndex ?? 0;\n const endIdx = peak._computed?.endIndex ?? 0;\n const startX = x[startIdx];\n const endX = x[endIdx];\n\n // Get marker types with defaults: triangle at start, diamond at end\n const startMarkerType = peak.startMarker ?? \"triangle\";\n const endMarkerType = peak.endMarker ?? \"diamond\";\n\n // Create start boundary marker (upper row, staggered by series)\n traces.push(...createMarkerTrace(startX, startMarkerY, startMarkerType, color));\n\n // Create end boundary marker (lower row, staggered by series)\n traces.push(...createMarkerTrace(endX, endMarkerY, endMarkerType, color));\n }\n }\n\n return traces;\n}\n\n"],"names":["BOUNDARY_MARKER_START_Y","BOUNDARY_MARKER_END_Y","BOUNDARY_MARKER_SERIES_OFFSET","createMarkerTrace","xPos","yPos","markerType","color","createBoundaryMarkerTraces","allPeaks","traces","peaks","seriesIndex","x","CHART_COLORS","startMarkerY","endMarkerY","peak","startIdx","endIdx","startX","endX","startMarkerType","endMarkerType"],"mappings":"6HAUMA,EAA0B,GAE1BC,EAAwB,IAExBC,EAAgC,IAMtC,SAASC,EACPC,EACAC,EACAC,EACAC,EACe,CACf,OAAID,IAAe,OACV,CAAA,EAGF,CACL,CACE,EAAG,CAACF,CAAI,EACR,EAAG,CAACC,CAAI,EACR,KAAM,UACN,KAAM,UACN,OAAQ,CACN,OAAQC,IAAe,UAAa,UAAuB,cAC3D,KAAM,EACN,MAAAC,CAAA,EAEF,WAAY,GACZ,UAAW,MAAA,CACb,CAEJ,CAQO,SAASC,EACdC,EAMe,CACf,MAAMC,EAAwB,CAAA,EAE9B,SAAW,CAAE,MAAAC,EAAO,YAAAC,EAAa,EAAAC,CAAA,IAAOJ,EAAU,CAChD,MAAMF,EAAQO,EAAAA,aAAaF,EAAcE,EAAAA,aAAa,MAAM,EAGtDC,EAAef,EAA0BY,EAAcV,EACvDc,EAAaf,EAAwBW,EAAcV,EAEzD,UAAWe,KAAQN,EAAO,CACxB,MAAMO,EAAWD,EAAK,WAAW,YAAc,EACzCE,EAASF,EAAK,WAAW,UAAY,EACrCG,EAASP,EAAEK,CAAQ,EACnBG,EAAOR,EAAEM,CAAM,EAGfG,EAAkBL,EAAK,aAAe,WACtCM,EAAgBN,EAAK,WAAa,UAGxCP,EAAO,KAAK,GAAGP,EAAkBiB,EAAQL,EAAcO,EAAiBf,CAAK,CAAC,EAG9EG,EAAO,KAAK,GAAGP,EAAkBkB,EAAML,EAAYO,EAAehB,CAAK,CAAC,CAC1E,CACF,CAEA,OAAOG,CACT"}
1
+ {"version":3,"file":"boundaryMarkers.cjs","sources":["../../../../src/components/charts/ChromatogramChart/boundaryMarkers.ts"],"sourcesContent":["/**\n * Boundary marker utilities for ChromatogramChart\n */\n\nimport { seriesColor } from \"../../../utils/colors\";\n\nimport type { PeakAnnotation, BoundaryMarkerType } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\n/** Base Y position for start boundary markers (below the x-axis) */\nconst BOUNDARY_MARKER_START_Y = -5;\n/** Y position for end boundary markers (below start markers) */\nconst BOUNDARY_MARKER_END_Y = -12;\n/** Y offset between series to prevent overlap */\nconst BOUNDARY_MARKER_SERIES_OFFSET = -16;\n\n/**\n * Create a marker trace for a boundary point.\n * Markers are placed on the x-axis below 0, staggered by series index.\n */\nfunction createMarkerTrace(\n xPos: number,\n yPos: number,\n markerType: BoundaryMarkerType,\n color: string\n): Plotly.Data[] {\n if (markerType === \"none\") {\n return [];\n }\n\n return [\n {\n x: [xPos],\n y: [yPos],\n type: \"scatter\" as const,\n mode: \"markers\" as const,\n marker: {\n symbol: markerType === \"diamond\" ? (\"diamond\" as const) : (\"triangle-up\" as const),\n size: 8,\n color,\n },\n showlegend: false,\n hoverinfo: \"skip\" as const,\n },\n ];\n}\n\n/**\n * Create boundary marker traces for peaks.\n * Uses per-peak startMarker/endMarker settings with defaults:\n * - startMarker: \"triangle\" (default)\n * - endMarker: \"diamond\" (default)\n */\nexport function createBoundaryMarkerTraces(\n allPeaks: {\n peaks: PeakAnnotation[];\n seriesIndex: number;\n x: number[];\n y: number[];\n }[]\n): Plotly.Data[] {\n const traces: Plotly.Data[] = [];\n\n for (const { peaks, seriesIndex, x } of allPeaks) {\n const color = seriesColor(seriesIndex);\n // Separate y positions for start vs end markers to prevent overlap when peaks are adjacent\n // Also stagger by series index to prevent overlap between different traces\n const startMarkerY = BOUNDARY_MARKER_START_Y + seriesIndex * BOUNDARY_MARKER_SERIES_OFFSET;\n const endMarkerY = BOUNDARY_MARKER_END_Y + seriesIndex * BOUNDARY_MARKER_SERIES_OFFSET;\n\n for (const peak of peaks) {\n const startIdx = peak._computed?.startIndex ?? 0;\n const endIdx = peak._computed?.endIndex ?? 0;\n const startX = x[startIdx];\n const endX = x[endIdx];\n\n // Get marker types with defaults: triangle at start, diamond at end\n const startMarkerType = peak.startMarker ?? \"triangle\";\n const endMarkerType = peak.endMarker ?? \"diamond\";\n\n // Create start boundary marker (upper row, staggered by series)\n traces.push(...createMarkerTrace(startX, startMarkerY, startMarkerType, color));\n\n // Create end boundary marker (lower row, staggered by series)\n traces.push(...createMarkerTrace(endX, endMarkerY, endMarkerType, color));\n }\n }\n\n return traces;\n}\n\n"],"names":["BOUNDARY_MARKER_START_Y","BOUNDARY_MARKER_END_Y","BOUNDARY_MARKER_SERIES_OFFSET","createMarkerTrace","xPos","yPos","markerType","color","createBoundaryMarkerTraces","allPeaks","traces","peaks","seriesIndex","x","seriesColor","startMarkerY","endMarkerY","peak","startIdx","endIdx","startX","endX","startMarkerType","endMarkerType"],"mappings":"6HAUMA,EAA0B,GAE1BC,EAAwB,IAExBC,EAAgC,IAMtC,SAASC,EACPC,EACAC,EACAC,EACAC,EACe,CACf,OAAID,IAAe,OACV,CAAA,EAGF,CACL,CACE,EAAG,CAACF,CAAI,EACR,EAAG,CAACC,CAAI,EACR,KAAM,UACN,KAAM,UACN,OAAQ,CACN,OAAQC,IAAe,UAAa,UAAuB,cAC3D,KAAM,EACN,MAAAC,CAAA,EAEF,WAAY,GACZ,UAAW,MAAA,CACb,CAEJ,CAQO,SAASC,EACdC,EAMe,CACf,MAAMC,EAAwB,CAAA,EAE9B,SAAW,CAAE,MAAAC,EAAO,YAAAC,EAAa,EAAAC,CAAA,IAAOJ,EAAU,CAChD,MAAMF,EAAQO,EAAAA,YAAYF,CAAW,EAG/BG,EAAef,EAA0BY,EAAcV,EACvDc,EAAaf,EAAwBW,EAAcV,EAEzD,UAAWe,KAAQN,EAAO,CACxB,MAAMO,EAAWD,EAAK,WAAW,YAAc,EACzCE,EAASF,EAAK,WAAW,UAAY,EACrCG,EAASP,EAAEK,CAAQ,EACnBG,EAAOR,EAAEM,CAAM,EAGfG,EAAkBL,EAAK,aAAe,WACtCM,EAAgBN,EAAK,WAAa,UAGxCP,EAAO,KAAK,GAAGP,EAAkBiB,EAAQL,EAAcO,EAAiBf,CAAK,CAAC,EAG9EG,EAAO,KAAK,GAAGP,EAAkBkB,EAAML,EAAYO,EAAehB,CAAK,CAAC,CAC1E,CACF,CAEA,OAAOG,CACT"}