chordia-ui 3.5.0 → 3.5.2

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.
@@ -1,9 +1,9 @@
1
- import { jsxs as s, jsx as o, Fragment as ze } from "react/jsx-runtime";
2
- import { forwardRef as He, useRef as X, useState as u, useCallback as re, useEffect as Y, useImperativeHandle as Ae } from "react";
3
- import { FilePlay as Be, RotateCcw as Pe, Pause as $e, Play as je, RotateCw as Le, ChevronDown as _e, AudioLines as ie, PauseCircle as Xe, PlayCircle as Ye } from "lucide-react";
4
- function se(m) {
5
- const d = Math.floor(m / 60), v = Math.round(m % 60);
6
- return `${d}:${v.toString().padStart(2, "0")}`;
1
+ import { jsxs as a, jsx as o, Fragment as ze } from "react/jsx-runtime";
2
+ import { forwardRef as He, useRef as Y, useState as g, useCallback as re, useEffect as q, useImperativeHandle as Ae } from "react";
3
+ import { FilePlay as Be, RotateCcw as Pe, Pause as $e, Play as Le, RotateCw as je, ChevronDown as _e, AudioLines as ie, PauseCircle as Xe, PlayCircle as Ye } from "lucide-react";
4
+ function se(v) {
5
+ const u = Math.floor(v / 60), b = Math.round(v % 60);
6
+ return `${u}:${b.toString().padStart(2, "0")}`;
7
7
  }
8
8
  const qe = {
9
9
  Agent: [
@@ -22,125 +22,125 @@ const qe = {
22
22
  { start: 0.6, end: 0.66 },
23
23
  { start: 0.74, end: 0.8 }
24
24
  ]
25
- }, M = [
25
+ }, z = [
26
26
  { speaker: "Agent", type: "agent", time: "00:04", text: "Thanks for calling Miles Point S Pensau. This is Steve. How can I help you?" },
27
27
  { speaker: "Customer", type: "customer", time: "00:12", text: "Hi, Steve. This is Sandra with Botai Catering." },
28
28
  { speaker: "Agent", type: "agent", time: "00:18", text: "Hello. How are you?" },
29
29
  { speaker: "Customer", type: "customer", time: "00:20", text: "I'm doing really good. Hey. I brought my vans in last week, and I call it a beeping van, the one that beeps when you back up. Makes the crunchy noise. So I just took it on Saturday after, I think I had the, the Miles. I picked it up on Saturday morning, and I went to an event. So So I don't know if it's the tire or something, but makes it a little crunchy noise. Sometimes when I do the brake, but only if I turn the wheel too." },
30
30
  { speaker: "Agent", type: "agent", time: "00:21", text: "Oh, interesting. Okay. Can you swing by with it one of these days?" }
31
31
  ], Ke = [1, 1.25, 1.5, 2];
32
- function ae(m) {
33
- if (!m)
32
+ function ae(v) {
33
+ if (!v)
34
34
  return 0;
35
- const d = m.split(":").map(Number);
36
- return (d[0] || 0) * 60 + (d[1] || 0);
35
+ const u = v.split(":").map(Number);
36
+ return (u[0] || 0) * 60 + (u[1] || 0);
37
37
  }
38
38
  const Ne = He(function({
39
- audioUrl: d,
40
- timelineSegments: v = [],
41
- durationSeconds: z = 0,
39
+ audioUrl: u,
40
+ timelineSegments: b = [],
41
+ durationSeconds: H = 0,
42
42
  // Parent-managed audio props (optional — if not provided, component manages its own audio)
43
43
  currentTimeSeconds: le,
44
- timelinePlaying: q,
44
+ timelinePlaying: K,
45
45
  playbackRate: ce,
46
- onSeek: K,
47
- onTogglePlay: S,
48
- onSeekBack: V,
49
- onSeekForward: Z,
50
- onSetPlaybackRate: J,
51
- audioRef: N,
46
+ onSeek: V,
47
+ onTogglePlay: C,
48
+ onSeekBack: Z,
49
+ onSeekForward: J,
50
+ onSetPlaybackRate: N,
51
+ audioRef: Q,
52
52
  // Speaker names
53
- agentName: H = "Agent",
54
- customerName: A = "Customer",
53
+ agentName: A = "Agent",
54
+ customerName: B = "Customer",
55
55
  // Transcript props
56
56
  transcript: h,
57
57
  highlightedTurns: de = /* @__PURE__ */ new Set(),
58
- activeTurnIndex: C,
59
- activeDemoIndex: he = 1,
60
- turnObservations: ue = {},
61
- setExpandedSignals: B,
62
- onTurnPlayPause: Q
58
+ activeTurnIndex: w,
59
+ activeDemoIndex: ue = 1,
60
+ turnObservations: he = {},
61
+ setExpandedSignals: P,
62
+ onTurnPlayPause: O
63
63
  }, ge) {
64
- var ne;
65
- const w = X(null), g = X(null), T = X(null), [O, b] = u(!1), [P, U] = u(0), [fe, pe] = u(0), [ye, me] = u(1), [R, ve] = u(null), [be, ke] = u(1), [xe, I] = u(!1), [Te, ee] = u(!1), [D, E] = u(he), [Fe, Se] = u(null), l = !!N, F = !d, c = d && !l, y = F ? xe : l ? q ?? !1 : O, Ce = F ? R ?? 0 : l ? le ?? 0 : P, $ = F ? be : l ? ce ?? 1 : ye, j = F ? z || 156 : l ? z : fe || z || 0, L = re(() => {
64
+ var oe;
65
+ const R = Y(null), f = Y(null), F = Y(null), [U, k] = g(!1), [$, ee] = g(0), [fe, pe] = g(0), [ye, me] = g(1), [I, ve] = g(null), [be, ke] = g(1), [xe, D] = g(!1), [Te, te] = g(!1), [E, G] = g(ue), [Fe, Se] = g(null), c = !!Q, S = !u, d = u && !c, y = S ? xe : c ? K ?? !1 : U, Ce = S ? I ?? 0 : c ? le ?? 0 : $, L = S ? be : c ? ce ?? 1 : ye, j = S ? H || 156 : c ? H : fe || H || 0, _ = re(() => {
66
66
  const e = () => {
67
- const t = g.current;
68
- t && U(t.currentTime), T.current = requestAnimationFrame(e);
67
+ const t = f.current;
68
+ t && ee(t.currentTime), F.current = requestAnimationFrame(e);
69
69
  };
70
- T.current = requestAnimationFrame(e);
71
- }, []), k = re(() => {
72
- T.current && (cancelAnimationFrame(T.current), T.current = null);
70
+ F.current = requestAnimationFrame(e);
71
+ }, []), x = re(() => {
72
+ F.current && (cancelAnimationFrame(F.current), F.current = null);
73
73
  }, []);
74
- Y(() => () => k(), [k]), Y(() => {
75
- if (!c)
74
+ q(() => () => x(), [x]), q(() => {
75
+ if (!d)
76
76
  return;
77
- const e = g.current;
77
+ const e = f.current;
78
78
  if (!e)
79
79
  return;
80
80
  const t = () => pe(e.duration || 0), n = () => {
81
- b(!1), k();
81
+ k(!1), x();
82
82
  };
83
83
  return e.addEventListener("loadedmetadata", t), e.addEventListener("ended", n), () => {
84
84
  e.removeEventListener("loadedmetadata", t), e.removeEventListener("ended", n);
85
85
  };
86
- }, [c, k]);
87
- const _ = (e) => {
88
- for (let t = M.length - 1; t >= 0; t--) {
89
- const n = ae(M[t].time);
86
+ }, [d, x]);
87
+ const X = (e) => {
88
+ for (let t = z.length - 1; t >= 0; t--) {
89
+ const n = ae(z[t].time);
90
90
  if (e >= n)
91
91
  return t;
92
92
  }
93
93
  return 0;
94
- }, x = (e) => {
94
+ }, T = (e) => {
95
95
  const n = Math.max(0, Math.min(e, j || 156));
96
- if (c) {
97
- const r = g.current;
98
- r && (r.currentTime = n), U(n);
96
+ if (d) {
97
+ const r = f.current;
98
+ r && (r.currentTime = n), ee(n);
99
99
  } else
100
- l && K && K(n);
101
- ve(n), E(_(n));
100
+ c && V && V(n);
101
+ ve(n), G(X(n));
102
102
  }, we = () => {
103
- if (c) {
104
- const e = g.current;
103
+ if (d) {
104
+ const e = f.current;
105
105
  if (!e)
106
106
  return;
107
- O ? (e.pause(), k(), b(!1)) : e.play().then(() => {
108
- b(!0), L();
107
+ U ? (e.pause(), x(), k(!1)) : e.play().then(() => {
108
+ k(!0), _();
109
109
  }).catch(() => {
110
110
  });
111
111
  } else
112
- l && S ? S() : I((e) => !e);
112
+ c && C ? C() : D((e) => !e);
113
113
  }, Re = () => {
114
- l && V ? V() : x(Math.max(0, (c ? P : R ?? 0) - 10));
114
+ c && Z ? Z() : T(Math.max(0, (d ? $ : I ?? 0) - 10));
115
115
  }, Ie = () => {
116
- l && Z ? Z() : x(Math.min(j || 156, (c ? P : R ?? 0) + 10));
116
+ c && J ? J() : T(Math.min(j || 156, (d ? $ : I ?? 0) + 10));
117
117
  }, De = (e) => {
118
- if (c) {
119
- const t = g.current;
118
+ if (d) {
119
+ const t = f.current;
120
120
  t && (t.playbackRate = e), me(e);
121
121
  } else
122
- l && J && J(e);
123
- ke(e), ee(!1);
122
+ c && N && N(e);
123
+ ke(e), te(!1);
124
124
  };
125
125
  Ae(ge, () => ({
126
126
  seekTo: (e) => {
127
- if (x(e), l)
128
- !q && S && S();
129
- else if (c) {
130
- const n = g.current;
127
+ if (T(e), c)
128
+ !K && C && C();
129
+ else if (d) {
130
+ const n = f.current;
131
131
  n && n.play().then(() => {
132
- b(!0), L();
132
+ k(!0), _();
133
133
  }).catch(() => {
134
134
  });
135
135
  } else
136
- I(!0);
137
- const t = _(e);
138
- E(t), setTimeout(() => {
139
- var i;
140
- const n = w.current, r = (i = n == null ? void 0 : n.children) == null ? void 0 : i[t];
136
+ D(!0);
137
+ const t = X(e);
138
+ G(t), setTimeout(() => {
139
+ var s;
140
+ const n = R.current, r = (s = n == null ? void 0 : n.children) == null ? void 0 : s[t];
141
141
  if (n && r) {
142
- const a = n.getBoundingClientRect().top, oe = r.getBoundingClientRect().top - a + n.scrollTop;
143
- n.scrollTo({ top: oe - 20, behavior: "smooth" });
142
+ const i = n.getBoundingClientRect().top, m = r.getBoundingClientRect().top - i + n.scrollTop;
143
+ n.scrollTo({ top: m - 20, behavior: "smooth" });
144
144
  }
145
145
  }, 50);
146
146
  },
@@ -151,20 +151,20 @@ const Ne = He(function({
151
151
  if ((n = h == null ? void 0 : h.messages) != null && n.length) {
152
152
  const r = h.messages;
153
153
  t = 0;
154
- for (let i = r.length - 1; i >= 0; i--) {
155
- const a = (r[i].start ?? r[i].start_ms ?? 0) / 1e3;
156
- if (e >= a) {
157
- t = i;
154
+ for (let s = r.length - 1; s >= 0; s--) {
155
+ const i = (r[s].start ?? r[s].start_ms ?? 0) / 1e3;
156
+ if (e >= i) {
157
+ t = s;
158
158
  break;
159
159
  }
160
160
  }
161
161
  } else
162
- t = _(e);
163
- E(t), Se(t), setTimeout(() => {
164
- var a;
165
- const r = w.current, i = (a = r == null ? void 0 : r.children) == null ? void 0 : a[t];
166
- if (r && i) {
167
- const p = r.getBoundingClientRect().top, Me = i.getBoundingClientRect().top - p + r.scrollTop;
162
+ t = X(e);
163
+ G(t), Se(t), setTimeout(() => {
164
+ var i;
165
+ const r = R.current, s = (i = r == null ? void 0 : r.children) == null ? void 0 : i[t];
166
+ if (r && s) {
167
+ const l = r.getBoundingClientRect().top, Me = s.getBoundingClientRect().top - l + r.scrollTop;
168
168
  r.scrollTo({ top: Me - 20, behavior: "smooth" });
169
169
  }
170
170
  }, 50);
@@ -172,32 +172,32 @@ const Ne = He(function({
172
172
  }));
173
173
  const Ee = (e) => {
174
174
  var t;
175
- if (D === e && y) {
176
- if (c) {
177
- const n = g.current;
178
- n && n.pause(), k(), b(!1);
175
+ if (E === e && y) {
176
+ if (d) {
177
+ const n = f.current;
178
+ n && n.pause(), x(), k(!1);
179
179
  }
180
- I(!1);
180
+ D(!1);
181
181
  } else {
182
- const n = ae((t = M[e]) == null ? void 0 : t.time);
183
- if (E(e), x(n), c) {
184
- const r = g.current;
182
+ const n = ae((t = z[e]) == null ? void 0 : t.time);
183
+ if (G(e), T(n), d) {
184
+ const r = f.current;
185
185
  r && (r.currentTime = n, r.play().then(() => {
186
- b(!0), L();
186
+ k(!0), _();
187
187
  }).catch(() => {
188
188
  }));
189
189
  }
190
- I(!0);
190
+ D(!0);
191
191
  }
192
192
  }, Ge = (e, t) => {
193
193
  if (e == null)
194
194
  return;
195
195
  const n = (r) => {
196
- const i = Math.floor(r / 6e4), a = Math.floor(r % 6e4 / 1e3);
197
- return `${i.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}`;
196
+ const s = Math.floor(r / 6e4), i = Math.floor(r % 6e4 / 1e3);
197
+ return `${s.toString().padStart(2, "0")}:${i.toString().padStart(2, "0")}`;
198
198
  };
199
199
  return `${n(e)}–${t != null ? n(t) : n(e)}`;
200
- }, G = (ne = h == null ? void 0 : h.messages) != null && ne.length ? h.messages.map((e, t) => {
200
+ }, W = (oe = h == null ? void 0 : h.messages) != null && oe.length ? h.messages.map((e, t) => {
201
201
  var n, r;
202
202
  return {
203
203
  actor: e.actor === "agent" ? ((n = h.actor_map) == null ? void 0 : n.agent) || "Agent" : ((r = h.actor_map) == null ? void 0 : r.customer) || "Customer",
@@ -205,41 +205,41 @@ const Ne = He(function({
205
205
  text: e.text || "",
206
206
  timeRange: Ge(e.start ?? e.start_ms, e.end ?? e.end_ms),
207
207
  isHighlighted: de.has(t),
208
- highlightColor: y && C === t ? e.actor === "agent" ? "var(--rail-outcome)" : "var(--rail-discovery)" : void 0,
209
- observations: (ue[t] || []).map((i) => ({
210
- ...i,
208
+ highlightColor: y && w === t ? e.actor === "agent" ? "var(--rail-outcome)" : "var(--rail-discovery)" : void 0,
209
+ observations: (he[t] || []).map((s) => ({
210
+ ...s,
211
211
  onClick: () => {
212
- B == null || B((a) => /* @__PURE__ */ new Set([...a, i.signalKey])), setTimeout(() => {
213
- const a = document.getElementById(`signal-${i.signalKey}`);
214
- a && a.scrollIntoView({ behavior: "smooth", block: "nearest" });
212
+ P == null || P((i) => /* @__PURE__ */ new Set([...i, s.signalKey])), setTimeout(() => {
213
+ const i = document.getElementById(`signal-${s.signalKey}`);
214
+ i && i.scrollIntoView({ behavior: "smooth", block: "nearest" });
215
215
  }, 100);
216
216
  }
217
217
  }))
218
218
  };
219
219
  }) : null;
220
- Y(() => {
220
+ q(() => {
221
221
  var r;
222
222
  if (!y)
223
223
  return;
224
- const e = G ? C : D;
224
+ const e = W ? w : E;
225
225
  if (e == null || e < 0)
226
226
  return;
227
- const t = w.current;
227
+ const t = R.current;
228
228
  if (!t)
229
229
  return;
230
230
  const n = (r = t.children) == null ? void 0 : r[e];
231
231
  if (n) {
232
- const i = t.getBoundingClientRect().top, p = n.getBoundingClientRect().top - i + t.scrollTop;
233
- t.scrollTo({ top: p - 20, behavior: "smooth" });
232
+ const s = t.getBoundingClientRect().top, l = n.getBoundingClientRect().top - s + t.scrollTop;
233
+ t.scrollTo({ top: l - 20, behavior: "smooth" });
234
234
  }
235
- }, [C, D, y, G]);
236
- const te = F ? R ?? 0 : Ce, f = j || 156, W = f > 0 ? te / f * 100 : 0, We = Math.round(te);
237
- return /* @__PURE__ */ s("div", { style: {
235
+ }, [w, E, y, W]);
236
+ const ne = S ? I ?? 0 : Ce, p = j || 156, M = p > 0 ? ne / p * 100 : 0, We = Math.round(ne);
237
+ return /* @__PURE__ */ a("div", { style: {
238
238
  display: "flex",
239
239
  flexDirection: "column",
240
240
  gap: 16
241
241
  }, children: [
242
- /* @__PURE__ */ s("div", { style: {
242
+ /* @__PURE__ */ a("div", { style: {
243
243
  display: "flex",
244
244
  alignItems: "center",
245
245
  gap: 16,
@@ -261,7 +261,7 @@ const Ne = He(function({
261
261
  color: "var(--Grey-Strong, #2E3236)"
262
262
  }, children: "Recording" })
263
263
  ] }),
264
- /* @__PURE__ */ s("div", { style: {
264
+ /* @__PURE__ */ a("div", { style: {
265
265
  display: "flex",
266
266
  padding: 24,
267
267
  flexDirection: "column",
@@ -271,19 +271,19 @@ const Ne = He(function({
271
271
  border: "1px solid var(--Grey-absent, #D9D9D9)",
272
272
  background: "var(--Grey-White, #FFF)"
273
273
  }, children: [
274
- /* @__PURE__ */ s("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: 16 }, children: [
275
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 24 }, children: [
276
- /* @__PURE__ */ s("span", { style: {
274
+ /* @__PURE__ */ a("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: 16 }, children: [
275
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 24 }, children: [
276
+ /* @__PURE__ */ a("span", { style: {
277
277
  fontSize: 14,
278
278
  fontWeight: 500,
279
279
  color: "var(--Grey-Strong, #2E3236)",
280
280
  lineHeight: 1.2
281
281
  }, children: [
282
- H,
282
+ A,
283
283
  " / ",
284
- A
284
+ B
285
285
  ] }),
286
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
286
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
287
287
  /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 400, color: "var(--Grey-Muted, #808183)", lineHeight: 1.2 }, children: "10" }),
288
288
  /* @__PURE__ */ o("button", { onClick: Re, style: { background: "none", border: "none", cursor: "pointer", padding: 0, display: "flex", alignItems: "center" }, children: /* @__PURE__ */ o(Pe, { size: 20, color: "#808183", strokeWidth: 1.5 }) }),
289
289
  /* @__PURE__ */ o("button", { onClick: we, style: {
@@ -297,15 +297,15 @@ const Ne = He(function({
297
297
  display: "flex",
298
298
  alignItems: "center",
299
299
  justifyContent: "center"
300
- }, children: y ? /* @__PURE__ */ o($e, { size: 14, color: "#FFF", fill: "#FFF" }) : /* @__PURE__ */ o(je, { size: 14, color: "#FFF", fill: "#FFF", strokeWidth: 1.5, style: { marginLeft: 2 } }) }),
301
- /* @__PURE__ */ o("button", { onClick: Ie, style: { background: "none", border: "none", cursor: "pointer", padding: 0, display: "flex", alignItems: "center" }, children: /* @__PURE__ */ o(Le, { size: 20, color: "#808183", strokeWidth: 1.5 }) }),
300
+ }, children: y ? /* @__PURE__ */ o($e, { size: 14, color: "#FFF", fill: "#FFF" }) : /* @__PURE__ */ o(Le, { size: 14, color: "#FFF", fill: "#FFF", strokeWidth: 1.5, style: { marginLeft: 2 } }) }),
301
+ /* @__PURE__ */ o("button", { onClick: Ie, style: { background: "none", border: "none", cursor: "pointer", padding: 0, display: "flex", alignItems: "center" }, children: /* @__PURE__ */ o(je, { size: 20, color: "#808183", strokeWidth: 1.5 }) }),
302
302
  /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 400, color: "var(--Grey-Muted, #808183)", lineHeight: 1.2 }, children: "10" })
303
303
  ] }),
304
- /* @__PURE__ */ s("div", { style: { position: "relative" }, children: [
305
- /* @__PURE__ */ s(
304
+ /* @__PURE__ */ a("div", { style: { position: "relative" }, children: [
305
+ /* @__PURE__ */ a(
306
306
  "button",
307
307
  {
308
- onClick: () => ee((e) => !e),
308
+ onClick: () => te((e) => !e),
309
309
  style: {
310
310
  background: "var(--Grey-White, #FFF)",
311
311
  border: "1px solid var(--Grey-absent, #D9D9D9)",
@@ -325,7 +325,7 @@ const Ne = He(function({
325
325
  gap: 4
326
326
  },
327
327
  children: [
328
- $,
328
+ L,
329
329
  "x",
330
330
  /* @__PURE__ */ o(_e, { size: 12, color: "#808183" })
331
331
  ]
@@ -343,7 +343,7 @@ const Ne = He(function({
343
343
  zIndex: 10,
344
344
  overflow: "hidden",
345
345
  minWidth: 80
346
- }, children: Ke.map((e) => /* @__PURE__ */ s(
346
+ }, children: Ke.map((e) => /* @__PURE__ */ a(
347
347
  "button",
348
348
  {
349
349
  onClick: () => De(e),
@@ -352,10 +352,10 @@ const Ne = He(function({
352
352
  width: "100%",
353
353
  padding: "8px 12px",
354
354
  border: "none",
355
- background: $ === e ? "var(--surface-hover, #F3F7F7)" : "var(--Grey-White, #FFF)",
355
+ background: L === e ? "var(--surface-hover, #F3F7F7)" : "var(--Grey-White, #FFF)",
356
356
  cursor: "pointer",
357
357
  fontSize: 13,
358
- fontWeight: $ === e ? 600 : 400,
358
+ fontWeight: L === e ? 600 : 400,
359
359
  color: "var(--Grey-Strong, #2E3236)",
360
360
  fontFamily: "var(--font-sans)",
361
361
  textAlign: "left"
@@ -369,8 +369,8 @@ const Ne = He(function({
369
369
  )) })
370
370
  ] })
371
371
  ] }),
372
- /* @__PURE__ */ s("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
373
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
372
+ /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
373
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
374
374
  /* @__PURE__ */ o("span", { style: {
375
375
  fontSize: 13,
376
376
  fontWeight: 500,
@@ -378,13 +378,13 @@ const Ne = He(function({
378
378
  fontFamily: "var(--font-sans)",
379
379
  lineHeight: 1.2,
380
380
  minWidth: 60
381
- }, children: se(f) }),
382
- /* @__PURE__ */ s(
381
+ }, children: se(p) }),
382
+ /* @__PURE__ */ a(
383
383
  "div",
384
384
  {
385
385
  onClick: (e) => {
386
386
  const t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = Math.max(0, Math.min(1, n / t.width));
387
- x(r * f);
387
+ T(r * p);
388
388
  },
389
389
  style: {
390
390
  flex: 1,
@@ -409,7 +409,7 @@ const Ne = He(function({
409
409
  left: 0,
410
410
  top: "50%",
411
411
  transform: "translateY(-50%)",
412
- width: `${W}%`,
412
+ width: `${M}%`,
413
413
  height: 4,
414
414
  borderRadius: 2,
415
415
  background: "var(--Green-Primary, #00925F)",
@@ -425,7 +425,7 @@ const Ne = He(function({
425
425
  xmlns: "http://www.w3.org/2000/svg",
426
426
  style: {
427
427
  position: "absolute",
428
- left: `${W}%`,
428
+ left: `${M}%`,
429
429
  top: "50%",
430
430
  transform: "translate(-50%, -50%)",
431
431
  pointerEvents: "none"
@@ -445,13 +445,16 @@ const Ne = He(function({
445
445
  }
446
446
  )
447
447
  ] }),
448
- /* @__PURE__ */ s("div", { style: { position: "relative", paddingBottom: 30, cursor: "pointer" }, children: [
449
- [H, A].map((e, t) => {
450
- const n = t === 0, r = v != null && v.length ? v.filter((i) => n ? i.actor === H : i.actor === A).map((i) => ({
451
- start: f > 0 ? i.startTime / f : 0,
452
- end: f > 0 ? i.endTime / f : 0
448
+ /* @__PURE__ */ a("div", { style: { position: "relative", paddingBottom: 30, cursor: "pointer" }, children: [
449
+ [A, B].map((e, t) => {
450
+ const n = t === 0, r = (i) => {
451
+ const l = (i.actor || "").toLowerCase(), m = (i.actorRole || i.role || i.type || "").toLowerCase();
452
+ return n ? l === A.toLowerCase() || l === "agent" || m === "agent" : l === B.toLowerCase() || l === "customer" || m === "customer";
453
+ }, s = b != null && b.length ? b.filter(r).map((i) => ({
454
+ start: p > 0 ? i.startTime / p : 0,
455
+ end: p > 0 ? i.endTime / p : 0
453
456
  })) : qe[n ? "Agent" : "Customer"] || [];
454
- return /* @__PURE__ */ s("div", { style: {
457
+ return /* @__PURE__ */ a("div", { style: {
455
458
  display: "flex",
456
459
  alignItems: "center",
457
460
  gap: 8,
@@ -466,12 +469,12 @@ const Ne = He(function({
466
469
  lineHeight: 1.2,
467
470
  minWidth: 60
468
471
  }, children: e }),
469
- /* @__PURE__ */ s(
472
+ /* @__PURE__ */ a(
470
473
  "div",
471
474
  {
472
475
  onClick: (i) => {
473
- const a = i.currentTarget.getBoundingClientRect(), p = Math.max(0, Math.min(1, (i.clientX - a.left) / a.width));
474
- x(p * f);
476
+ const l = i.currentTarget.getBoundingClientRect(), m = Math.max(0, Math.min(1, (i.clientX - l.left) / l.width));
477
+ T(m * p);
475
478
  },
476
479
  style: {
477
480
  flex: 1,
@@ -491,7 +494,7 @@ const Ne = He(function({
491
494
  borderRadius: 2,
492
495
  background: "var(--rail-surface-2, #E3E1D7)"
493
496
  } }),
494
- r.map((i, a) => /* @__PURE__ */ o("div", { style: {
497
+ s.map((i, l) => /* @__PURE__ */ o("div", { style: {
495
498
  position: "absolute",
496
499
  left: `${i.start * 100}%`,
497
500
  width: `${(i.end - i.start) * 100}%`,
@@ -499,13 +502,13 @@ const Ne = He(function({
499
502
  bottom: 0,
500
503
  borderRadius: 3,
501
504
  background: n ? "var(--Grey-Strong, #2E3236)" : "var(--Grey-Muted, #808183)"
502
- } }, a))
505
+ } }, l))
503
506
  ]
504
507
  }
505
508
  )
506
509
  ] }, e);
507
510
  }),
508
- /* @__PURE__ */ s("div", { style: {
511
+ /* @__PURE__ */ a("div", { style: {
509
512
  position: "absolute",
510
513
  left: 68,
511
514
  /* 60 label + 8 gap */
@@ -516,7 +519,7 @@ const Ne = He(function({
516
519
  }, children: [
517
520
  /* @__PURE__ */ o("div", { style: {
518
521
  position: "absolute",
519
- left: `${W}%`,
522
+ left: `${M}%`,
520
523
  top: 0,
521
524
  height: 44,
522
525
  transform: "translateX(-50%)",
@@ -525,7 +528,7 @@ const Ne = He(function({
525
528
  } }),
526
529
  /* @__PURE__ */ o("div", { style: {
527
530
  position: "absolute",
528
- left: `${W}%`,
531
+ left: `${M}%`,
529
532
  bottom: 0,
530
533
  transform: "translateX(-50%)",
531
534
  background: "var(--Grey-Strong, #2E3236)",
@@ -539,11 +542,11 @@ const Ne = He(function({
539
542
  }, children: se(We) })
540
543
  ] })
541
544
  ] }),
542
- c && /* @__PURE__ */ o("audio", { ref: g, preload: "auto", style: { display: "none" }, children: /* @__PURE__ */ o("source", { src: d, type: "audio/mpeg" }) }),
543
- l && d && /* @__PURE__ */ o("audio", { ref: N, preload: "auto", style: { display: "none" }, children: /* @__PURE__ */ o("source", { src: d, type: "audio/mpeg" }) })
545
+ d && /* @__PURE__ */ o("audio", { ref: f, preload: "auto", style: { display: "none" }, children: /* @__PURE__ */ o("source", { src: u, type: "audio/mpeg" }) }),
546
+ c && u && /* @__PURE__ */ o("audio", { ref: Q, preload: "auto", style: { display: "none" }, children: /* @__PURE__ */ o("source", { src: u, type: "audio/mpeg" }) })
544
547
  ] })
545
548
  ] }),
546
- /* @__PURE__ */ s("div", { style: {
549
+ /* @__PURE__ */ a("div", { style: {
547
550
  width: "100%",
548
551
  display: "flex",
549
552
  flexDirection: "column",
@@ -558,19 +561,19 @@ const Ne = He(function({
558
561
  color: "var(--Grey-Strong, #2E3236)",
559
562
  lineHeight: 1.2
560
563
  }, children: "Transcript" }) }),
561
- /* @__PURE__ */ o("div", { id: "transcript-container", ref: w, style: {
564
+ /* @__PURE__ */ o("div", { id: "transcript-container", ref: R, style: {
562
565
  display: "flex",
563
566
  flexDirection: "column",
564
567
  maxHeight: 600,
565
568
  overflowY: "auto"
566
- }, children: (G || M.map((e) => ({
569
+ }, children: (W || z.map((e) => ({
567
570
  actor: e.speaker,
568
571
  actorType: e.type,
569
572
  text: e.text,
570
573
  timeRange: e.time
571
574
  }))).map((e, t) => {
572
- const n = !!G, r = Fe === t, i = n ? y && C === t : t === D && y, a = i || r, p = (e.actorType || e.type) === "customer";
573
- return /* @__PURE__ */ s("div", { style: {
575
+ const n = !!W, r = Fe === t, s = n ? y && w === t : t === E && y, i = s || r, l = (e.actorType || e.type) === "customer";
576
+ return /* @__PURE__ */ a("div", { style: {
574
577
  display: "flex",
575
578
  padding: 16,
576
579
  flexDirection: "column",
@@ -578,9 +581,9 @@ const Ne = He(function({
578
581
  gap: 16,
579
582
  alignSelf: "stretch",
580
583
  borderTop: t > 0 ? "1px solid var(--Grey-absent, #D9D9D9)" : "none",
581
- background: a ? "var(--surface-hover, #F3F7F7)" : "var(--Grey-White, #FFF)"
584
+ background: i ? "var(--surface-hover, #F3F7F7)" : "var(--Grey-White, #FFF)"
582
585
  }, children: [
583
- /* @__PURE__ */ s("div", { style: {
586
+ /* @__PURE__ */ a("div", { style: {
584
587
  display: "flex",
585
588
  alignItems: "center",
586
589
  justifyContent: "space-between",
@@ -591,10 +594,10 @@ const Ne = He(function({
591
594
  fontSize: 14,
592
595
  fontWeight: 600,
593
596
  lineHeight: 1.2,
594
- color: p ? "var(--Grey-Strong, #2E3236)" : "var(--Grey-Muted, #808183)"
597
+ color: l ? "var(--Grey-Strong, #2E3236)" : "var(--Grey-Muted, #808183)"
595
598
  }, children: e.actor }),
596
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
597
- i && /* @__PURE__ */ s(ze, { children: [
599
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
600
+ s && /* @__PURE__ */ a(ze, { children: [
598
601
  /* @__PURE__ */ o(ie, { size: 12, color: "#2E3236" }),
599
602
  /* @__PURE__ */ o(ie, { size: 12, color: "#2E3236" })
600
603
  ] }),
@@ -606,12 +609,12 @@ const Ne = He(function({
606
609
  }, children: e.timeRange })
607
610
  ] })
608
611
  ] }),
609
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "flex-start", gap: 8, width: "100%" }, children: [
612
+ /* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "flex-start", gap: 8, width: "100%" }, children: [
610
613
  /* @__PURE__ */ o(
611
614
  "button",
612
615
  {
613
616
  onClick: () => {
614
- n && Q ? Q(e, t) : Ee(t);
617
+ n && O ? O(e, t) : Ee(t);
615
618
  },
616
619
  style: {
617
620
  background: "none",
@@ -621,7 +624,7 @@ const Ne = He(function({
621
624
  flexShrink: 0,
622
625
  display: "flex"
623
626
  },
624
- children: i ? /* @__PURE__ */ o(Xe, { size: 17, color: "#2E3236", strokeWidth: 1.5 }) : /* @__PURE__ */ o(Ye, { size: 17, color: "#808183", strokeWidth: 1 })
627
+ children: s ? /* @__PURE__ */ o(Xe, { size: 17, color: "#2E3236", strokeWidth: 1.5 }) : /* @__PURE__ */ o(Ye, { size: 17, color: "#808183", strokeWidth: 1 })
625
628
  }
626
629
  ),
627
630
  /* @__PURE__ */ o("p", { style: {