@epam/ai-dial-conversation-stages 1.2.0-dev.219 → 1.2.0-dev.229

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.
package/index.js CHANGED
@@ -1,46 +1,65 @@
1
1
  import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, MarkdownCodeBlock as r, MarkdownRenderer as i, RequestStatus as a, StageStatus as o, buildCssVars as s, mergeClasses as c, messageAttachmentsToDisplayAttachments as l, normalizeMimeType as u } from "@epam/ai-dial-chat-shared";
2
2
  import { Accordion as d, DIAL_ICON_SIZE as f, DIAL_KIT_ICON_STROKE as p, ElementSize as m, EllipsisTooltip as h, Highlight as g, Skeleton as _, SkeletonVariant as v, Spinner as y, StaticIconButton as b } from "@epam/ai-dial-ui-kit";
3
- import { IconAlertCircle as x, IconCheck as S, IconClipboard as C, IconDownload as w, IconExternalLink as T, IconFile as E, IconFileTypeBmp as D, IconFileTypeCss as O, IconFileTypeCsv as k, IconFileTypeDoc as A, IconFileTypeDocx as j, IconFileTypeHtml as M, IconFileTypeJpg as N, IconFileTypeJs as P, IconFileTypeJsx as F, IconFileTypePdf as I, IconFileTypePhp as L, IconFileTypePng as ee, IconFileTypePpt as R, IconFileTypeRs as z, IconFileTypeSql as te, IconFileTypeSvg as ne, IconFileTypeTs as re, IconFileTypeTsx as B, IconFileTypeTxt as ie, IconFileTypeVue as ae, IconFileTypeXls as oe, IconFileTypeXml as se, IconFileTypeZip as ce, IconMusic as le, IconPhoto as V, IconReload as ue, IconTerminal2 as de, IconVideo as fe, IconX as pe } from "@tabler/icons-react";
4
- import { memo as me, useCallback as he, useEffect as H, useId as ge, useMemo as U, useRef as _e, useState as ve } from "react";
5
- import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
3
+ import { IconAlertCircle as x, IconCheck as S, IconClipboard as C, IconDownload as w, IconExternalLink as T, IconFile as E, IconFileTypeBmp as D, IconFileTypeCss as O, IconFileTypeCsv as k, IconFileTypeDoc as A, IconFileTypeDocx as j, IconFileTypeHtml as M, IconFileTypeJpg as N, IconFileTypeJs as P, IconFileTypeJsx as F, IconFileTypePdf as I, IconFileTypePhp as L, IconFileTypePng as ee, IconFileTypePpt as R, IconFileTypeRs as te, IconFileTypeSql as z, IconFileTypeSvg as ne, IconFileTypeTs as re, IconFileTypeTsx as B, IconFileTypeTxt as ie, IconFileTypeVue as ae, IconFileTypeXls as oe, IconFileTypeXml as se, IconFileTypeZip as ce, IconMusic as le, IconPhoto as ue, IconReload as de, IconTerminal2 as fe, IconVideo as pe, IconX as me } from "@tabler/icons-react";
4
+ import { memo as he, useCallback as V, useEffect as H, useId as ge, useMemo as U, useRef as _e, useState as W } from "react";
5
+ import { Fragment as ve, jsx as G, jsxs as K } from "react/jsx-runtime";
6
6
  //#region src/constants/public-class-names.ts
7
7
  var q = {
8
8
  panel: "dial-conversation-stages-panel",
9
9
  group: "dial-conversation-stages-group",
10
10
  groupToggle: "dial-conversation-stages-group-toggle"
11
- }, ye = /[([][^()[\]]*[)\]]/g, be = /(\d+(?:\.\d+)?)\s*s\b/, xe = /\bStart:\s*(\d{1,2}):([0-5]\d):([0-5]\d(?:\.\d+)?)\b/i, Se = (e) => {
11
+ }, ye = () => {
12
+ let [e, t] = W(() => /* @__PURE__ */ new Set()), n = V((e, n) => {
13
+ t((t) => {
14
+ if (t.has(e) === n) return t;
15
+ let r = new Set(t);
16
+ return n ? r.add(e) : r.delete(e), r;
17
+ });
18
+ }, []), r = V(() => {
19
+ t((e) => e.size ? /* @__PURE__ */ new Set() : e);
20
+ }, []);
21
+ return U(() => ({
22
+ isExpanded: (t) => e.has(t),
23
+ onToggle: n,
24
+ reset: r
25
+ }), [
26
+ e,
27
+ n,
28
+ r
29
+ ]);
30
+ }, be = /[([][^()[\]]*[)\]]/g, xe = /(\d+(?:\.\d+)?)\s*s\b/, Se = /\bStart:\s*(\d{1,2}):([0-5]\d):([0-5]\d(?:\.\d+)?)\b/i, Ce = (e) => {
12
31
  let t = e.trimEnd();
13
32
  return t.endsWith(":") ? t.slice(0, -1) : t;
14
- }, Ce = 1440 * 60, we = Ce / 2, Te = (e) => {
15
- let t = xe.exec(e);
33
+ }, we = 1440 * 60, Te = we / 2, Ee = (e) => {
34
+ let t = Se.exec(e);
16
35
  if (!t) return;
17
36
  let n = Number(t[1]);
18
37
  if (!(n > 23)) return n * 60 * 60 + Number(t[2]) * 60 + Number(t[3]);
19
- }, Ee = (e) => {
20
- ye.lastIndex = 0;
38
+ }, De = (e) => {
39
+ be.lastIndex = 0;
21
40
  let t;
22
- for (; t = ye.exec(e);) {
23
- let e = t[0].slice(1, -1), n = be.exec(e);
41
+ for (; t = be.exec(e);) {
42
+ let e = t[0].slice(1, -1), n = xe.exec(e);
24
43
  if (n) return {
25
44
  durationLabel: `${n[1]}s`,
26
45
  groupIndex: t.index,
27
46
  groupLength: t[0].length,
28
- startTimeSeconds: Te(e)
47
+ startTimeSeconds: Ee(e)
29
48
  };
30
49
  }
31
50
  }, J = (e) => {
32
- let t = e ?? "", n = Ee(t);
51
+ let t = e ?? "", n = De(t);
33
52
  return {
34
- name: Se(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
53
+ name: Ce(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
35
54
  durationLabel: n?.durationLabel
36
55
  };
37
- }, De = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), Oe = (e) => e >= 60 ? `${Math.floor(e / 60)}m ${Math.round(e % 60)}s` : `${e.toFixed(1)}s`, ke = (e) => {
56
+ }, Oe = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), ke = (e) => e >= 60 ? `${Math.floor(e / 60)}m ${Math.round(e % 60)}s` : `${e.toFixed(1)}s`, Ae = (e) => {
38
57
  if (!e) return;
39
58
  let t = /^(\d+(?:\.\d+)?)s$/.exec(e);
40
59
  return t ? parseFloat(t[1]) : void 0;
41
- }, Ae = (e) => {
60
+ }, je = (e) => {
42
61
  let t = e.flatMap((e) => {
43
- let t = Ee(e ?? ""), n = ke(t?.durationLabel);
62
+ let t = De(e ?? ""), n = Ae(t?.durationLabel);
44
63
  return n == null ? [] : [{
45
64
  durationSeconds: n,
46
65
  startTimeSeconds: t?.startTimeSeconds
@@ -51,50 +70,65 @@ var q = {
51
70
  let n = 0, r, i = t.flatMap(({ durationSeconds: e, startTimeSeconds: t }) => {
52
71
  if (t == null) return [];
53
72
  let i = t + n;
54
- return r != null && r - i > we && (n += Ce, i += Ce), r = i, {
73
+ return r != null && r - i > Te && (n += we, i += we), r = i, {
55
74
  start: i,
56
75
  end: i + e
57
76
  };
58
77
  }).sort((e, t) => e.start - t.start), a = 0, o = i[0].start, s = i[0].end;
59
78
  for (let e of i.slice(1)) e.start <= s ? s = Math.max(s, e.end) : (a += s - o, o = e.start, s = e.end);
60
79
  return a + s - o;
61
- }, je = (e) => [...e].reverse().find((e) => e.status == null), Me = "overflow-visible py-0", Ne = "justify-start gap-2 rounded-lg px-2 py-1.5 text-start", Pe = (e) => {
80
+ }, Me = (e) => [...e].reverse().find((e) => e.status == null), Ne = (e, t) => {
81
+ let n = e.parent_stage_index;
82
+ if (!(n == null || !Number.isInteger(n) || n < 0 || n >= e.index)) return t.get(n);
83
+ }, Pe = (e) => {
84
+ let t = e.map((e) => ({
85
+ stage: e,
86
+ children: []
87
+ })), n = /* @__PURE__ */ new Map();
88
+ for (let e of t) n.has(e.stage.index) || n.set(e.stage.index, e);
89
+ let r = [];
90
+ for (let e of t) {
91
+ let t = Ne(e.stage, n);
92
+ t ? t.children.push(e) : r.push(e);
93
+ }
94
+ return r;
95
+ }, Fe = (e) => `stage:${e}`, Ie = (e) => `group:${e}`, Le = "min-w-0 overflow-visible py-0", Re = "min-w-0 justify-start gap-2 rounded-lg px-2 py-1.5 text-start mobile:min-h-11", ze = (e) => {
62
96
  let t = [], n = 0;
63
97
  for (; n < e.length;) {
64
- let r = e[n], i = J(r.name).name, a = n + 1;
65
- for (; a < e.length && J(e[a].name).name === i;) a += 1;
98
+ let r = e[n], i = J(r.stage.name).name, a = n + 1;
99
+ for (; a < e.length && J(e[a].stage.name).name === i;) a += 1;
66
100
  let o = e.slice(n, a);
67
101
  o.length > 1 ? t.push({
68
- key: r.index,
102
+ key: r.stage.index,
69
103
  name: i,
70
104
  attempts: o
71
105
  }) : t.push({
72
- key: r.index,
73
- stage: r
106
+ key: r.stage.index,
107
+ node: r
74
108
  }), n = a;
75
109
  }
76
110
  return t;
77
111
  }, Y = {
78
- panel: "_panel_8he9e_1",
79
- row: "_row_8he9e_5",
80
- collapseButton: "_collapseButton_8he9e_9",
81
- stageHeader: "_stageHeader_8he9e_18",
82
- stageRegion: "_stageRegion_8he9e_27",
83
- stageName: "_stageName_8he9e_31",
84
- stageNameFailed: "_stageNameFailed_8he9e_35",
85
- monoName: "_monoName_8he9e_39",
86
- tag: "_tag_8he9e_43",
87
- count: "_count_8he9e_47",
88
- duration: "_duration_8he9e_52",
89
- iconSecondary: "_iconSecondary_8he9e_57",
90
- iconCompleted: "_iconCompleted_8he9e_62",
91
- iconError: "_iconError_8he9e_66",
92
- stageContent: "_stageContent_8he9e_70",
93
- codeBlock: "_codeBlock_8he9e_74",
94
- codeInline: "_codeInline_8he9e_80",
95
- blockquote: "_blockquote_8he9e_86",
96
- tableCell: "_tableCell_8he9e_91"
97
- }, Fe = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === o.Failed ? /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(x, {
112
+ panel: "_panel_10qci_1",
113
+ row: "_row_10qci_5",
114
+ collapseButton: "_collapseButton_10qci_9",
115
+ stageHeader: "_stageHeader_10qci_18",
116
+ stageRegion: "_stageRegion_10qci_27",
117
+ stageName: "_stageName_10qci_31",
118
+ stageNameFailed: "_stageNameFailed_10qci_35",
119
+ monoName: "_monoName_10qci_39",
120
+ tag: "_tag_10qci_43",
121
+ count: "_count_10qci_47",
122
+ duration: "_duration_10qci_52",
123
+ iconSecondary: "_iconSecondary_10qci_57",
124
+ iconCompleted: "_iconCompleted_10qci_62",
125
+ iconError: "_iconError_10qci_66",
126
+ stageContent: "_stageContent_10qci_70",
127
+ codeBlock: "_codeBlock_10qci_74",
128
+ codeInline: "_codeInline_10qci_80",
129
+ blockquote: "_blockquote_10qci_86",
130
+ tableCell: "_tableCell_10qci_91"
131
+ }, Be = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === o.Failed ? /* @__PURE__ */ K(ve, { children: [/* @__PURE__ */ G(x, {
98
132
  size: f.MD,
99
133
  className: Y.iconError,
100
134
  "aria-hidden": !0,
@@ -110,11 +144,11 @@ var q = {
110
144
  }) : t ? /* @__PURE__ */ G(y, {
111
145
  size: 16,
112
146
  ariaLabel: n
113
- }) : null, Ie = (e) => {
147
+ }) : null, Ve = (e) => {
114
148
  if (e == null) return "";
115
149
  let t = e.lastIndexOf(".");
116
150
  return t > 0 ? e.slice(0, t) : e;
117
- }, Le = (e) => {
151
+ }, He = (e) => {
118
152
  if (!e) return E;
119
153
  let t = u(e);
120
154
  if (t.startsWith("image/")) switch (t) {
@@ -122,9 +156,9 @@ var q = {
122
156
  case "image/png": return ee;
123
157
  case "image/svg+xml": return ne;
124
158
  case "image/bmp": return D;
125
- default: return V;
159
+ default: return ue;
126
160
  }
127
- if (t.startsWith("video/")) return fe;
161
+ if (t.startsWith("video/")) return pe;
128
162
  if (t.startsWith("audio/")) return le;
129
163
  switch (t) {
130
164
  case "application/pdf": return I;
@@ -144,48 +178,48 @@ var q = {
144
178
  case "text/html":
145
179
  case "application/xhtml+xml": return M;
146
180
  case "application/xml": return se;
147
- case "application/sql": return te;
181
+ case "application/sql": return z;
148
182
  case "text/javascript": return P;
149
183
  case "text/jsx": return F;
150
184
  case "text/typescript": return re;
151
185
  case "text/tsx": return B;
152
186
  case "text/css": return O;
153
187
  case "text/x-php": return L;
154
- case "text/x-rustsrc": return z;
188
+ case "text/x-rustsrc": return te;
155
189
  case "text/x-vue": return ae;
156
190
  default: return E;
157
191
  }
158
- }, Re = (e) => {
192
+ }, Ue = (e) => {
159
193
  let { type: n, contentType: r } = e;
160
- return n === t.Prompt ? de : n === t.Pasted ? C : n === t.Image ? V : Le(r ?? "");
161
- }, ze = (e) => {
194
+ return n === t.Prompt ? fe : n === t.Pasted ? C : n === t.Image ? ue : He(r ?? "");
195
+ }, We = (e) => {
162
196
  let t = u(e), r = n[t];
163
197
  if (r) return r;
164
198
  let i = t.split("/")[1];
165
199
  if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
166
- }, Be = (e, n) => {
200
+ }, Ge = (e, n) => {
167
201
  let { type: r, name: i, contentType: a } = e;
168
202
  if (r === t.Prompt) return n.promptLabel ?? "Prompt";
169
203
  if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
170
204
  if (r === t.Image) return n.imageLabel ?? "Image";
171
205
  if (a) {
172
- let e = ze(a);
206
+ let e = We(a);
173
207
  if (e) return `.${e}`;
174
208
  }
175
209
  if (i == null) return "";
176
210
  let o = i.lastIndexOf(".");
177
211
  return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
178
- }, Ve = (e, n = {}) => {
212
+ }, Ke = (e, n = {}) => {
179
213
  let { type: r, status: i, previewUrl: o, url: s } = e, c = i === a.Loading, l = i === a.Error, u = r === t.Image && !!(o ?? s) && !l, d = r === t.Link && !l;
180
214
  return {
181
215
  isLoading: c,
182
216
  isError: l,
183
217
  isImage: u,
184
218
  isLink: d,
185
- BottomIcon: d ? null : Re(e),
186
- typeLabel: d ? null : Be(e, n)
219
+ BottomIcon: d ? null : Ue(e),
220
+ typeLabel: d ? null : Ge(e, n)
187
221
  };
188
- }, He = "flex size-[84px] items-center justify-center rounded-xl border", X = {
222
+ }, qe = "flex size-[84px] items-center justify-center rounded-xl border", X = {
189
223
  tray: "dial-ai-attachment-tray",
190
224
  trayItem: "dial-ai-attachment-tray-item",
191
225
  tile: "dial-ai-attachment-tile",
@@ -213,45 +247,45 @@ var q = {
213
247
  onClick: (e) => {
214
248
  e.stopPropagation(), r(i);
215
249
  }
216
- }), Ue = ({ ...e }) => /* @__PURE__ */ G(Q, {
217
- icon: /* @__PURE__ */ G(ue, {
250
+ }), Je = ({ ...e }) => /* @__PURE__ */ G(Q, {
251
+ icon: /* @__PURE__ */ G(de, {
218
252
  size: f.SM,
219
253
  "aria-hidden": !0,
220
254
  stroke: p
221
255
  }),
222
256
  className: Z.retryIcon,
223
257
  ...e
224
- }), We = ({ ...e }) => /* @__PURE__ */ G(Q, {
258
+ }), Ye = ({ ...e }) => /* @__PURE__ */ G(Q, {
225
259
  icon: /* @__PURE__ */ G(w, {
226
260
  size: f.SM,
227
261
  "aria-hidden": !0,
228
262
  stroke: p
229
263
  }),
230
264
  ...e
231
- }), Ge = ({ ...e }) => /* @__PURE__ */ G(Q, {
265
+ }), Xe = ({ ...e }) => /* @__PURE__ */ G(Q, {
232
266
  icon: /* @__PURE__ */ G(T, {
233
267
  size: f.SM,
234
268
  "aria-hidden": !0,
235
269
  stroke: p
236
270
  }),
237
271
  ...e
238
- }), Ke = ({ ...e }) => /* @__PURE__ */ G(Q, {
239
- icon: /* @__PURE__ */ G(pe, {
272
+ }), Ze = ({ ...e }) => /* @__PURE__ */ G(Q, {
273
+ icon: /* @__PURE__ */ G(me, {
240
274
  size: f.SM,
241
275
  "aria-hidden": !0,
242
276
  stroke: p
243
277
  }),
244
278
  ...e
245
- }), qe = {
279
+ }), Qe = {
246
280
  [e.Network]: "Upload failed · network error",
247
281
  [e.UnsupportedType]: "Upload failed · unsupported file type",
248
282
  [e.FileTooLarge]: "Upload failed · file too large"
249
- }, Je = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isPasted: u, isLink: d, cssVars: f, onExpand: p, isExpandable: m, onRemove: h, isSelected: _ }) => {
250
- let { clickLabel: v = "Download attachment", retryLabel: b = "Retry upload", removeLabel: x = "Remove attachment", openInNewTabLabel: S = "Open in new tab", sizeLabel: C, uploadingLabel: w = "Uploading", errorReasonLabels: T, genericErrorLabel: E = "Upload failed" } = o ?? {}, { typography: D, className: O } = s ?? {}, { id: k, name: A, status: j, errorReason: M } = t, N = j === a.Loading, P = j === a.Error, F = ge(), I = P ? M && (T?.[M] ?? qe[M]) || E : "", { BottomIcon: L, typeLabel: ee } = Ve(t), R = !P && !N && l && !d, z = P && !!i && M !== e.UnsupportedType && M !== e.FileTooLarge, te = Number(!!R) + Number(!!z) + Number(!!d) + Number(!!h), ne = te > 1 ? "pe-11" : te === 1 ? "pe-5" : void 0, re = (e) => {
283
+ }, $e = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isPasted: u, isLink: d, cssVars: f, onExpand: p, isExpandable: m, onRemove: h, isSelected: _ }) => {
284
+ let { clickLabel: v = "Download attachment", retryLabel: b = "Retry upload", removeLabel: x = "Remove attachment", openInNewTabLabel: S = "Open in new tab", sizeLabel: C, uploadingLabel: w = "Uploading", errorReasonLabels: T, genericErrorLabel: E = "Upload failed" } = o ?? {}, { typography: D, className: O } = s ?? {}, { id: k, name: A, status: j, errorReason: M } = t, N = j === a.Loading, P = j === a.Error, F = ge(), I = P ? M && (T?.[M] ?? Qe[M]) || E : "", { BottomIcon: L, typeLabel: ee } = Ke(t), R = !P && !N && l && !d, te = P && !!i && M !== e.UnsupportedType && M !== e.FileTooLarge, z = Number(!!R) + Number(!!te) + Number(!!d) + Number(!!h), ne = z > 1 ? "pe-11" : z === 1 ? "pe-5" : void 0, re = (e) => {
251
285
  e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r?.(t.id));
252
- }, B = U(() => u ? A : Ie(A), [u, A]), ie = he(() => {
286
+ }, B = U(() => u ? A : Ve(A), [u, A]), ie = V(() => {
253
287
  window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
254
- }, [t]), ae = c(He, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", Z.tile, !P && Z.hovered, _ && Z.selected, P && Z.tileError, X.tile, _ && X.tileSelected), oe = /* @__PURE__ */ G("div", {
288
+ }, [t]), ae = c(qe, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", Z.tile, !P && Z.hovered, _ && Z.selected, P && Z.tileError, X.tile, _ && X.tileSelected), oe = /* @__PURE__ */ G("div", {
255
289
  title: B,
256
290
  className: c(D?.nameClassName ?? "dial-caption-text", "line-clamp-2 w-full min-w-0 break-words", Z.nameText, !P && ne, X.tileName),
257
291
  children: n ? /* @__PURE__ */ G(g, {
@@ -271,7 +305,7 @@ var q = {
271
305
  })]
272
306
  }), ce = () => {
273
307
  m && p ? p(k) : r && r(k);
274
- }, le = /* @__PURE__ */ K(W, { children: [
308
+ }, le = /* @__PURE__ */ K(ve, { children: [
275
309
  oe,
276
310
  se,
277
311
  N && /* @__PURE__ */ G("div", {
@@ -283,27 +317,27 @@ var q = {
283
317
  /* @__PURE__ */ K("div", {
284
318
  className: "absolute end-1 top-1 flex gap-1",
285
319
  children: [
286
- R && /* @__PURE__ */ G(We, {
320
+ R && /* @__PURE__ */ G(Ye, {
287
321
  ariaLabel: v,
288
322
  errorTitle: I,
289
323
  errorDescId: F,
290
324
  onClick: l,
291
325
  id: k
292
326
  }),
293
- z && /* @__PURE__ */ G(Ue, {
327
+ te && /* @__PURE__ */ G(Je, {
294
328
  ariaLabel: b,
295
329
  errorTitle: I,
296
330
  errorDescId: F,
297
331
  onClick: i,
298
332
  id: k
299
333
  }),
300
- d && /* @__PURE__ */ G(Ge, {
334
+ d && /* @__PURE__ */ G(Xe, {
301
335
  ariaLabel: S,
302
336
  errorTitle: I,
303
337
  errorDescId: F,
304
338
  onClick: ie
305
339
  }),
306
- h && /* @__PURE__ */ G(Ke, {
340
+ h && /* @__PURE__ */ G(Ze, {
307
341
  ariaLabel: x,
308
342
  errorTitle: I,
309
343
  errorDescId: F,
@@ -335,10 +369,10 @@ var q = {
335
369
  children: le
336
370
  })
337
371
  });
338
- }, Ye = /* @__PURE__ */ function(e) {
372
+ }, et = /* @__PURE__ */ function(e) {
339
373
  return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
340
- }({}), Xe = ({ enabled: e, src: t }) => {
341
- let n = _e(null), [r, i] = ve("idle");
374
+ }({}), tt = ({ enabled: e, src: t }) => {
375
+ let n = _e(null), [r, i] = W("idle");
342
376
  return H(() => {
343
377
  i(e && t ? "loading" : "idle");
344
378
  }, [e, t]), H(() => {
@@ -352,15 +386,15 @@ var q = {
352
386
  imageRef: n,
353
387
  imageLoadStatus: r
354
388
  };
355
- }, Ze = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
356
- let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment" } = i ?? {}, { className: y } = l ?? {}, { id: b, name: x } = e, S = e.previewUrl ?? e.url, C = e.type === t.Pasted && n !== void 0, { isLoading: w, isError: T, isImage: E } = U(() => Ve(e), [e]), D = r !== void 0 && !C && !w && !T, { imageRef: O, imageLoadStatus: k } = Xe({
389
+ }, nt = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
390
+ let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment" } = i ?? {}, { className: y } = l ?? {}, { id: b, name: x } = e, S = e.previewUrl ?? e.url, C = e.type === t.Pasted && n !== void 0, { isLoading: w, isError: T, isImage: E } = U(() => Ke(e), [e]), D = r !== void 0 && !C && !w && !T, { imageRef: O, imageLoadStatus: k } = tt({
357
391
  enabled: E,
358
392
  src: S
359
393
  }), A = () => {
360
394
  C && n ? n(b) : D && r && r(b);
361
395
  };
362
396
  return /* @__PURE__ */ G("div", {
363
- className: c(He, "group/attachment-tile", D && "cursor-pointer", Z.tile, u && Z.selected, y, X.tile, u && X.tileSelected),
397
+ className: c(qe, "group/attachment-tile", D && "cursor-pointer", Z.tile, u && Z.selected, y, X.tile, u && X.tileSelected),
364
398
  onClick: A,
365
399
  onKeyDown: (e) => {
366
400
  e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), A());
@@ -374,24 +408,24 @@ var q = {
374
408
  children: [
375
409
  /* @__PURE__ */ K("div", {
376
410
  className: "absolute end-1 top-1 z-10 flex gap-1",
377
- children: [a && /* @__PURE__ */ G(Ke, {
411
+ children: [a && /* @__PURE__ */ G(Ze, {
378
412
  ariaLabel: h,
379
413
  onClick: a,
380
414
  id: b,
381
415
  className: Z.imageActionButton
382
- }), s && /* @__PURE__ */ G(We, {
416
+ }), s && /* @__PURE__ */ G(Ye, {
383
417
  ariaLabel: g,
384
418
  onClick: s,
385
419
  id: b,
386
420
  className: Z.imageActionButton
387
421
  })]
388
422
  }),
389
- k !== Ye.Loaded && /* @__PURE__ */ G(_, {
423
+ k !== et.Loaded && /* @__PURE__ */ G(_, {
390
424
  variant: v.Rectangular,
391
425
  width: "100%",
392
426
  height: "100%",
393
- active: k === Ye.Loading,
394
- overlay: /* @__PURE__ */ G(V, {
427
+ active: k === et.Loading,
428
+ overlay: /* @__PURE__ */ G(ue, {
395
429
  size: f.LG,
396
430
  className: Z.typeText,
397
431
  "aria-hidden": !0,
@@ -405,12 +439,12 @@ var q = {
405
439
  alt: x,
406
440
  loading: "lazy",
407
441
  decoding: "async",
408
- className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", k === Ye.Loaded ? "opacity-100" : "opacity-0")
442
+ className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", k === et.Loaded ? "opacity-100" : "opacity-0")
409
443
  })
410
444
  ]
411
445
  })
412
446
  });
413
- }, Qe = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
447
+ }, rt = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
414
448
  let { colors: f } = u ?? {}, p = e.type === t.Pasted, m = p && a !== void 0, h = s({
415
449
  "--ai-tile-bg": f?.background,
416
450
  "--ai-tile-border": f?.border,
@@ -427,8 +461,8 @@ var q = {
427
461
  "--ai-tile-hover-icon-bg": f?.hoverIconBackground,
428
462
  "--ai-tile-hover-icon-color": f?.hoverIconColor,
429
463
  "--ai-tile-progress-track": f?.trackBackground
430
- }), { isImage: g, isLink: _ } = U(() => Ve(e), [e]);
431
- return g ? /* @__PURE__ */ G(Ze, {
464
+ }), { isImage: g, isLink: _ } = U(() => Ke(e), [e]);
465
+ return g ? /* @__PURE__ */ G(nt, {
432
466
  attachment: e,
433
467
  labels: l,
434
468
  onClick: o,
@@ -438,7 +472,7 @@ var q = {
438
472
  cssVars: h,
439
473
  onDownload: c,
440
474
  isSelected: d
441
- }) : /* @__PURE__ */ G(Je, {
475
+ }) : /* @__PURE__ */ G($e, {
442
476
  attachment: e,
443
477
  searchQuery: n,
444
478
  onClick: o,
@@ -454,7 +488,7 @@ var q = {
454
488
  isExpandable: m,
455
489
  isSelected: d
456
490
  });
457
- }, $e = (e) => {
491
+ }, it = (e) => {
458
492
  let t = l(e);
459
493
  if (!e?.length) return t;
460
494
  let n = /* @__PURE__ */ new Map();
@@ -469,14 +503,14 @@ var q = {
469
503
  contentType: t
470
504
  } : e;
471
505
  });
472
- }, et = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i }) => /* @__PURE__ */ G(r, {
506
+ }, at = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i }) => /* @__PURE__ */ G(r, {
473
507
  language: t?.replace(/^language-/, "") ?? "",
474
508
  value: typeof e == "string" ? e : String(e ?? ""),
475
509
  codeClassName: n,
476
510
  containerClassName: c(Y.codeBlock, n),
477
511
  copyLabel: i,
478
512
  hideDownload: !0
479
- }), tt = me(({ content: e, typography: t, copyAriaLabel: n = "Copy" }) => {
513
+ }), ot = he(({ content: e, typography: t, copyAriaLabel: n = "Copy" }) => {
480
514
  let r = "mb-1.5 last:mb-0", a = c(t?.headingClassName ?? "dial-small-semi-text", Y.stageContent, r);
481
515
  return /* @__PURE__ */ G(i, {
482
516
  content: e,
@@ -496,7 +530,7 @@ var q = {
496
530
  link: c(t?.contentClassName ?? "dial-tiny-text", Y.stageContent),
497
531
  tableCell: c(t?.contentClassName ?? "dial-tiny-text", Y.tableCell)
498
532
  },
499
- components: { code: ({ children: e, className: r }) => r?.includes("language-") ? /* @__PURE__ */ G(et, {
533
+ components: { code: ({ children: e, className: r }) => r?.includes("language-") ? /* @__PURE__ */ G(at, {
500
534
  codeClassName: r,
501
535
  blockClassName: t?.codeBlockClassName,
502
536
  copyAriaLabel: n,
@@ -506,8 +540,8 @@ var q = {
506
540
  children: e
507
541
  }) }
508
542
  });
509
- }), nt = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
510
- let r = he((t) => {
543
+ }), st = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
544
+ let r = V((t) => {
511
545
  let r = e.find((e) => e.id === t);
512
546
  r && n?.(r);
513
547
  }, [e, n]);
@@ -516,154 +550,199 @@ var q = {
516
550
  className: "flex flex-wrap gap-3",
517
551
  children: e.map((e) => /* @__PURE__ */ G("div", {
518
552
  role: "listitem",
519
- children: /* @__PURE__ */ G(Qe, {
553
+ children: /* @__PURE__ */ G(rt, {
520
554
  attachment: e,
521
555
  onClick: n && r,
522
556
  labels: { clickLabel: t }
523
557
  })
524
558
  }, e.id))
525
559
  });
526
- }, rt = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a }) => {
527
- let { copyAriaLabel: s = "Copy stage content", runningAriaLabel: l, failedAriaLabel: u, attachmentClickLabel: f = "Preview search result" } = r ?? {}, p = U(() => $e(e.attachments), [e.attachments]), { name: m, durationLabel: g } = J(e.name), _ = i ?? m, v = !i && De(m), y = e.status === o.Failed, b = !!e.content || !!e.attachments?.length, x = /* @__PURE__ */ K(W, { children: [
560
+ }, ct = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a, childList: s, isExpanded: l, onToggle: u }) => {
561
+ let [f, p] = W(!1), m = l ?? f, g = V((e) => {
562
+ l === void 0 && p(e), u?.(e);
563
+ }, [l, u]), { copyAriaLabel: _ = "Copy stage content", runningAriaLabel: v, failedAriaLabel: y, attachmentClickLabel: b = "Preview search result" } = r ?? {}, x = U(() => it(e.attachments), [e.attachments]), { name: S, durationLabel: C } = J(e.name), w = i ?? S, T = !i && Oe(S), E = e.status === o.Failed, D = !!e.content || !!e.attachments?.length, O = D || s != null, k = /* @__PURE__ */ K(ve, { children: [
528
564
  /* @__PURE__ */ G("span", {
529
565
  className: "flex flex-none items-center",
530
- children: /* @__PURE__ */ G(Fe, {
566
+ children: /* @__PURE__ */ G(Be, {
531
567
  status: e.status,
532
568
  isLive: t,
533
- runningLabel: l,
534
- failedLabel: u
569
+ runningLabel: v,
570
+ failedLabel: y
535
571
  })
536
572
  }),
537
573
  /* @__PURE__ */ G("span", {
538
- className: c("min-w-0 max-w-[22rem] truncate", n?.fontClassName ?? "dial-small-text", Y.stageName, y && Y.stageNameFailed, v && Y.monoName),
539
- children: /* @__PURE__ */ G(h, { text: _ || e.status || "" })
574
+ className: c("min-w-0 max-w-[22rem] truncate", n?.fontClassName ?? "dial-small-text", Y.stageName, E && Y.stageNameFailed, T && Y.monoName),
575
+ children: /* @__PURE__ */ G(h, { text: w || e.status || "" })
540
576
  }),
541
577
  e.tag && /* @__PURE__ */ G("span", {
542
578
  className: c("flex-none", n?.tagClassName ?? "dial-tiny-lead-text", Y.tag),
543
579
  children: e.tag
544
580
  }),
545
- g && /* @__PURE__ */ G("span", {
581
+ C && /* @__PURE__ */ G("span", {
546
582
  className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", Y.duration),
547
- children: g
583
+ children: C
548
584
  })
549
585
  ] });
550
- return b ? /* @__PURE__ */ K(d, {
586
+ return O ? /* @__PURE__ */ K(d, {
587
+ expanded: m,
588
+ onToggle: g,
551
589
  title: /* @__PURE__ */ G("span", {
552
590
  className: "flex min-w-0 items-center gap-2",
553
- children: x
591
+ children: k
554
592
  }),
555
- className: Me,
556
- headerClassName: c(Ne, Y.row, Y.stageHeader),
557
- contentClassName: c("-mt-1 flex flex-col gap-3 px-0 py-1 ps-8", Y.stageRegion),
558
- children: [e.content && /* @__PURE__ */ G("div", {
559
- className: "max-h-[300px] overflow-y-auto",
560
- children: /* @__PURE__ */ G(tt, {
561
- content: e.content,
562
- typography: n,
563
- copyAriaLabel: s
564
- })
565
- }), p.length > 0 && /* @__PURE__ */ G(nt, {
566
- attachments: p,
567
- clickLabel: f,
568
- onAttachmentClick: a
569
- })]
593
+ className: Le,
594
+ headerClassName: c(Re, Y.row, Y.stageHeader),
595
+ contentClassName: c("-mt-1 flex min-w-0 flex-col gap-3 px-0 py-1", Y.stageRegion),
596
+ children: [m && D && /* @__PURE__ */ K("div", {
597
+ className: "flex min-w-0 flex-col gap-3 ps-8",
598
+ children: [e.content && /* @__PURE__ */ G("div", {
599
+ className: "max-h-[300px] min-w-0 overflow-y-auto",
600
+ children: /* @__PURE__ */ G(ot, {
601
+ content: e.content,
602
+ typography: n,
603
+ copyAriaLabel: _
604
+ })
605
+ }), x.length > 0 && /* @__PURE__ */ G(st, {
606
+ attachments: x,
607
+ clickLabel: b,
608
+ onAttachmentClick: a
609
+ })]
610
+ }), m && s]
570
611
  }) : /* @__PURE__ */ G("div", {
571
612
  className: c("flex w-full items-center gap-2 px-2 py-1.5", Y.row),
572
- children: x
613
+ children: k
573
614
  });
574
- }, it = ({ row: e, isLive: t, typography: n, labels: r, onAttachmentClick: i }) => {
575
- let { runningAriaLabel: a, failedAriaLabel: s, attemptLabel: l = (e) => `Attempt ${e}` } = r ?? {}, u = e.attempts?.some((e) => e.status == null) ?? !1, f = e.attempts?.some((e) => e.status === o.Failed), p = u ? null : f ? o.Failed : o.Completed, m = Ae((e.attempts || []).map((e) => e.name)), g = m > 0 ? Oe(m) : void 0;
615
+ }, lt = (e) => e <= 3 ? "ps-4" : "ps-0", ut = (e) => e <= 3 ? "ps-6" : "ps-0", dt = ({ node: e, depth: t, nameOverride: n, isStreaming: r, expansion: i, typography: a, labels: o, onAttachmentClick: s }) => {
616
+ let c = Fe(e.stage.index), l = t + 1;
617
+ return /* @__PURE__ */ G(ct, {
618
+ stage: e.stage,
619
+ nameOverride: n,
620
+ isLive: r && e.stage.status == null,
621
+ typography: a,
622
+ labels: o,
623
+ onAttachmentClick: s,
624
+ isExpanded: i.isExpanded(c),
625
+ onToggle: (e) => i.onToggle(c, e),
626
+ childList: e.children.length > 0 ? /* @__PURE__ */ G(pt, {
627
+ nodes: e.children,
628
+ depth: l,
629
+ className: lt(l),
630
+ isStreaming: r,
631
+ expansion: i,
632
+ typography: a,
633
+ labels: o,
634
+ onAttachmentClick: s
635
+ }) : void 0
636
+ });
637
+ }, ft = ({ row: e, depth: t, isStreaming: n, expansion: r, typography: i, labels: a, onAttachmentClick: s }) => {
638
+ let { runningAriaLabel: l, failedAriaLabel: u, attemptLabel: f = (e) => `Attempt ${e}` } = a ?? {}, p = e.attempts ?? [], m = p.some((e) => e.stage.status == null), g = p.some((e) => e.stage.status === o.Failed), _ = o.Completed;
639
+ m ? _ = null : g && (_ = o.Failed);
640
+ let v = je(p.map((e) => e.stage.name)), y = v > 0 ? ke(v) : void 0, b = Ie(e.key), x = r.isExpanded(b), S = t + 1;
576
641
  return /* @__PURE__ */ G(d, {
577
642
  title: /* @__PURE__ */ K("span", {
578
643
  className: "flex min-w-0 items-center gap-2",
579
644
  children: [
580
645
  /* @__PURE__ */ G("span", {
581
646
  className: "flex flex-none items-center",
582
- children: /* @__PURE__ */ G(Fe, {
583
- status: p,
584
- isLive: t,
585
- runningLabel: a,
586
- failedLabel: s
647
+ children: /* @__PURE__ */ G(Be, {
648
+ status: _,
649
+ isLive: n && m,
650
+ runningLabel: l,
651
+ failedLabel: u
587
652
  })
588
653
  }),
589
654
  /* @__PURE__ */ G("span", {
590
- className: c("min-w-0 max-w-[22rem] truncate", n?.fontClassName ?? "dial-small-text", Y.stageName, f && Y.stageNameFailed),
655
+ className: c("min-w-0 max-w-[22rem] truncate", i?.fontClassName ?? "dial-small-text", Y.stageName, g && Y.stageNameFailed),
591
656
  children: /* @__PURE__ */ G(h, { text: e.name })
592
657
  }),
593
658
  /* @__PURE__ */ K("span", {
594
- className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", Y.count),
595
- children: ["×", e.attempts?.length ?? 0]
659
+ className: c("flex-none", i?.countFontClassName ?? "dial-tiny-text", Y.count),
660
+ children: ["×", p.length]
596
661
  }),
597
- g && /* @__PURE__ */ G("span", {
598
- className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", Y.duration),
599
- children: g
662
+ y && /* @__PURE__ */ G("span", {
663
+ className: c("flex-none", i?.countFontClassName ?? "dial-tiny-text", Y.duration),
664
+ children: y
600
665
  })
601
666
  ]
602
667
  }),
603
- className: Me,
604
- headerClassName: c(Ne, Y.collapseButton, Y.row, Y.stageHeader),
605
- contentClassName: c("-mt-2 px-0 ps-6", Y.stageRegion),
668
+ expanded: x,
669
+ onToggle: (e) => r.onToggle(b, e),
670
+ className: Le,
671
+ headerClassName: c(Re, Y.collapseButton, Y.row, Y.stageHeader),
672
+ contentClassName: c("-mt-2 min-w-0 px-0", ut(S), Y.stageRegion),
606
673
  children: /* @__PURE__ */ G("ul", {
607
674
  role: "list",
608
- className: "flex flex-col gap-0.5",
609
- children: e.attempts?.map((e, a) => /* @__PURE__ */ G("li", {
675
+ className: "flex min-w-0 flex-col gap-0.5",
676
+ children: x && p.map((e, t) => /* @__PURE__ */ G("li", {
610
677
  role: "listitem",
611
- children: /* @__PURE__ */ G(rt, {
612
- stage: e,
613
- nameOverride: l(a + 1),
614
- isLive: t && e.status == null,
615
- typography: n,
616
- labels: r,
617
- onAttachmentClick: i
678
+ className: "min-w-0",
679
+ children: /* @__PURE__ */ G(dt, {
680
+ node: e,
681
+ depth: S,
682
+ nameOverride: f(t + 1),
683
+ isStreaming: n,
684
+ expansion: r,
685
+ typography: i,
686
+ labels: a,
687
+ onAttachmentClick: s
618
688
  })
619
- }, e.index))
689
+ }, e.stage.index))
620
690
  })
621
691
  });
622
- }, at = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a }) => {
623
- let { colors: o, typography: l } = r ?? {}, u = s({
624
- "--cs-text": o?.text,
625
- "--cs-row-hover": o?.rowHoverColor,
626
- "--cs-button-bg": o?.collapsedButtonBg,
627
- "--cs-stage-text": o?.stageTextColor,
628
- "--cs-failed-text": o?.failedColor,
629
- "--cs-tag-text": o?.tagTextColor,
630
- "--cs-count-text": o?.countTextColor,
631
- "--cs-duration-text": o?.durationTextColor,
632
- "--cs-icon-secondary": o?.iconSecondaryColor,
633
- "--cs-icon-completed": o?.iconCompletedColor,
634
- "--cs-icon-error": o?.iconErrorColor,
635
- "--cs-code-bg": o?.codeBg,
636
- "--cs-code-border": o?.codeBorderColor,
637
- "--cs-code-text": o?.codeTextColor,
638
- "--cs-border": o?.borderColor
639
- }), d = Pe(e);
692
+ }, pt = ({ nodes: e, depth: t, className: n, ...r }) => /* @__PURE__ */ G("ul", {
693
+ role: "list",
694
+ className: c("flex min-w-0 flex-col gap-0.5", n),
695
+ children: ze(e).map((e) => /* @__PURE__ */ G("li", {
696
+ role: "listitem",
697
+ className: "min-w-0",
698
+ children: e.node ? /* @__PURE__ */ G(dt, {
699
+ node: e.node,
700
+ depth: t,
701
+ ...r
702
+ }) : /* @__PURE__ */ G(ft, {
703
+ row: e,
704
+ depth: t,
705
+ ...r
706
+ })
707
+ }, e.key))
708
+ }), mt = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a, expansion: o }) => {
709
+ let { colors: l, typography: u } = r ?? {}, d = s({
710
+ "--cs-text": l?.text,
711
+ "--cs-row-hover": l?.rowHoverColor,
712
+ "--cs-button-bg": l?.collapsedButtonBg,
713
+ "--cs-stage-text": l?.stageTextColor,
714
+ "--cs-failed-text": l?.failedColor,
715
+ "--cs-tag-text": l?.tagTextColor,
716
+ "--cs-count-text": l?.countTextColor,
717
+ "--cs-duration-text": l?.durationTextColor,
718
+ "--cs-icon-secondary": l?.iconSecondaryColor,
719
+ "--cs-icon-completed": l?.iconCompletedColor,
720
+ "--cs-icon-error": l?.iconErrorColor,
721
+ "--cs-code-bg": l?.codeBg,
722
+ "--cs-code-border": l?.codeBorderColor,
723
+ "--cs-code-text": l?.codeTextColor,
724
+ "--cs-border": l?.borderColor
725
+ }), f = U(() => Pe(e), [e]);
640
726
  return /* @__PURE__ */ G("div", {
641
- style: u,
642
- className: c("w-full", Y.panel, n, q.panel),
643
- children: /* @__PURE__ */ G("ul", {
644
- role: "list",
645
- className: "flex w-full flex-col gap-0.5 ps-5",
646
- children: d.map((e) => e.stage ? /* @__PURE__ */ G("li", {
647
- role: "listitem",
648
- children: /* @__PURE__ */ G(rt, {
649
- stage: e.stage,
650
- isLive: t && e.stage.status == null,
651
- typography: l,
652
- labels: i,
653
- onAttachmentClick: a
654
- })
655
- }, e.key) : /* @__PURE__ */ G("li", {
656
- role: "listitem",
657
- children: /* @__PURE__ */ G(it, {
658
- row: e,
659
- isLive: t && (e.attempts?.some((e) => e.status == null) ?? !1),
660
- typography: l,
661
- labels: i,
662
- onAttachmentClick: a
663
- })
664
- }, e.key))
727
+ style: d,
728
+ className: c("w-full min-w-0", Y.panel, n, q.panel),
729
+ children: /* @__PURE__ */ G(pt, {
730
+ nodes: f,
731
+ depth: 0,
732
+ className: "w-full ps-5",
733
+ isStreaming: t,
734
+ expansion: o,
735
+ typography: u,
736
+ labels: i,
737
+ onAttachmentClick: a
665
738
  })
666
739
  });
740
+ }, ht = (e) => {
741
+ let t = ye();
742
+ return /* @__PURE__ */ G(mt, {
743
+ ...e,
744
+ expansion: t
745
+ });
667
746
  }, $ = {
668
747
  toggleButton: "_toggleButton_1kyyc_7",
669
748
  groupRegion: "_groupRegion_1kyyc_28",
@@ -672,56 +751,65 @@ var q = {
672
751
  doneIcon: "_doneIcon_1kyyc_41",
673
752
  failedText: "_failedText_1kyyc_45",
674
753
  liveName: "_liveName_1kyyc_49"
675
- }, ot = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a }) => {
676
- let { executedLabel: l = "Executed", stepsLabel: u = () => "steps", failedCountLabel: m = (e) => `${e} failed`, runningAriaLabel: g = "Running", copyAriaLabel: _, failedAriaLabel: v, attemptLabel: b, attachmentClickLabel: x } = n ?? {}, [C, w] = ve(t), T = _e(t);
754
+ }, gt = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a }) => {
755
+ let { executedLabel: l = "Executed", stepsLabel: u = () => "steps", failedCountLabel: m = (e) => `${e} failed`, runningAriaLabel: g = "Running", copyAriaLabel: _, failedAriaLabel: v, attemptLabel: b, attachmentClickLabel: x } = n ?? {}, [C, w] = W(t), T = ye(), { reset: E } = T, D = e.length > 1;
756
+ H(() => {
757
+ D && !C && E();
758
+ }, [
759
+ D,
760
+ C,
761
+ E
762
+ ]);
763
+ let O = _e(t);
677
764
  H(() => {
678
- T.current && !t && w(!1), T.current = t;
765
+ O.current && !t && w(!1), O.current = t;
679
766
  }, [t]);
680
- let { colors: E, panel: D } = i ?? {}, O = i?.typography ?? { fontClassName: "dial-small-text" }, k = s({
681
- "--cs-cg-label": E?.labelColor,
682
- "--cs-cg-label-hover": E?.labelHoverColor,
683
- "--cs-cg-steps-count": E?.stepsCountColor,
684
- "--cs-cg-done": E?.doneColor,
685
- "--cs-cg-failed": E?.failedColor,
686
- "--cs-text": D?.text,
687
- "--cs-row-hover": D?.rowHoverColor,
688
- "--cs-button-bg": D?.collapsedButtonBg,
689
- "--cs-stage-text": D?.stageTextColor,
690
- "--cs-failed-text": D?.failedColor,
691
- "--cs-tag-text": D?.tagTextColor,
692
- "--cs-count-text": D?.countTextColor,
693
- "--cs-duration-text": D?.durationTextColor,
694
- "--cs-icon-secondary": D?.iconSecondaryColor,
695
- "--cs-icon-completed": D?.iconCompletedColor,
696
- "--cs-icon-error": D?.iconErrorColor,
697
- "--cs-code-bg": D?.codeBg,
698
- "--cs-code-border": D?.codeBorderColor,
699
- "--cs-code-text": D?.codeTextColor,
700
- "--cs-border": D?.borderColor
767
+ let { colors: k, panel: A } = i ?? {}, j = i?.typography ?? { fontClassName: "dial-small-text" }, M = s({
768
+ "--cs-cg-label": k?.labelColor,
769
+ "--cs-cg-label-hover": k?.labelHoverColor,
770
+ "--cs-cg-steps-count": k?.stepsCountColor,
771
+ "--cs-cg-done": k?.doneColor,
772
+ "--cs-cg-failed": k?.failedColor,
773
+ "--cs-text": A?.text,
774
+ "--cs-row-hover": A?.rowHoverColor,
775
+ "--cs-button-bg": A?.collapsedButtonBg,
776
+ "--cs-stage-text": A?.stageTextColor,
777
+ "--cs-failed-text": A?.failedColor,
778
+ "--cs-tag-text": A?.tagTextColor,
779
+ "--cs-count-text": A?.countTextColor,
780
+ "--cs-duration-text": A?.durationTextColor,
781
+ "--cs-icon-secondary": A?.iconSecondaryColor,
782
+ "--cs-icon-completed": A?.iconCompletedColor,
783
+ "--cs-icon-error": A?.iconErrorColor,
784
+ "--cs-code-bg": A?.codeBg,
785
+ "--cs-code-border": A?.codeBorderColor,
786
+ "--cs-code-text": A?.codeTextColor,
787
+ "--cs-border": A?.borderColor
701
788
  });
702
789
  if (e.length === 0) return null;
703
- let A = {
790
+ let N = {
704
791
  copyAriaLabel: _,
705
792
  runningAriaLabel: g,
706
793
  failedAriaLabel: v,
707
794
  attemptLabel: b,
708
795
  attachmentClickLabel: x
709
796
  };
710
- if (e.length === 1) return /* @__PURE__ */ G(at, {
797
+ if (e.length === 1) return /* @__PURE__ */ G(mt, {
711
798
  stages: e,
712
799
  isStreaming: t,
800
+ expansion: T,
713
801
  className: r,
714
802
  styles: {
715
- colors: D,
803
+ colors: A,
716
804
  typography: i?.typography
717
805
  },
718
- labels: A,
806
+ labels: N,
719
807
  onAttachmentClick: a
720
808
  });
721
- let j = e.some((e) => e.status === o.Failed), M = Ae(e.map((e) => e.name)), N = M > 0 ? Oe(M) : void 0, P;
809
+ let P = e.some((e) => e.status === o.Failed), F = je(e.map((e) => e.name)), I = F > 0 ? ke(F) : void 0, L;
722
810
  if (t) {
723
- let t = J((je(e) ?? e[e.length - 1]).name).name;
724
- P = /* @__PURE__ */ K("span", {
811
+ let t = J((Me(e) ?? e[e.length - 1]).name).name;
812
+ L = /* @__PURE__ */ K("span", {
725
813
  role: "status",
726
814
  "aria-live": "polite",
727
815
  className: "flex min-w-0 items-center gap-2",
@@ -732,17 +820,17 @@ var q = {
732
820
  ariaLabel: g
733
821
  })
734
822
  }), t && /* @__PURE__ */ G("span", {
735
- className: c("min-w-0 max-w-[22rem] truncate", O.fontClassName, $.liveName),
823
+ className: c("min-w-0 max-w-[22rem] truncate", j.fontClassName, $.liveName),
736
824
  children: /* @__PURE__ */ G(h, { text: t })
737
825
  })]
738
826
  });
739
- } else if (j) {
827
+ } else if (P) {
740
828
  let t = e.filter((e) => e.status === o.Failed).length;
741
- P = /* @__PURE__ */ K("span", {
829
+ L = /* @__PURE__ */ K("span", {
742
830
  className: "inline-flex items-center gap-1",
743
831
  children: [
744
832
  /* @__PURE__ */ K("span", {
745
- className: c(O.fontClassName, $.executedLabel),
833
+ className: c(j.fontClassName, $.executedLabel),
746
834
  children: [
747
835
  l,
748
836
  " ",
@@ -752,16 +840,16 @@ var q = {
752
840
  ]
753
841
  }),
754
842
  /* @__PURE__ */ G("span", {
755
- className: c(O.fontClassName, $.failedText),
843
+ className: c(j.fontClassName, $.failedText),
756
844
  children: m(t)
757
845
  }),
758
- N && /* @__PURE__ */ G("span", {
759
- className: c(O.fontClassName, $.stepsCount),
760
- children: N
846
+ I && /* @__PURE__ */ G("span", {
847
+ className: c(j.fontClassName, $.stepsCount),
848
+ children: I
761
849
  })
762
850
  ]
763
851
  });
764
- } else P = /* @__PURE__ */ K("span", {
852
+ } else L = /* @__PURE__ */ K("span", {
765
853
  className: "inline-flex items-center gap-1",
766
854
  children: [
767
855
  /* @__PURE__ */ G(S, {
@@ -771,7 +859,7 @@ var q = {
771
859
  stroke: p
772
860
  }),
773
861
  /* @__PURE__ */ K("span", {
774
- className: c(O.fontClassName, $.executedLabel),
862
+ className: c(j.fontClassName, $.executedLabel),
775
863
  children: [
776
864
  l,
777
865
  " ",
@@ -780,30 +868,31 @@ var q = {
780
868
  u(e.length)
781
869
  ]
782
870
  }),
783
- N && /* @__PURE__ */ G("span", {
784
- className: c(O.fontClassName, $.stepsCount),
785
- children: N
871
+ I && /* @__PURE__ */ G("span", {
872
+ className: c(j.fontClassName, $.stepsCount),
873
+ children: I
786
874
  })
787
875
  ]
788
876
  });
789
877
  return /* @__PURE__ */ G("div", {
790
- style: k,
878
+ style: M,
791
879
  className: c("flex w-full flex-col gap-1", r, q.group),
792
880
  children: /* @__PURE__ */ G(d, {
793
- title: P,
881
+ title: L,
794
882
  expanded: C,
795
883
  onToggle: w,
796
884
  className: "overflow-visible py-0",
797
885
  headerClassName: c("justify-start gap-1 rounded-none px-0", $.toggleButton, q.groupToggle),
798
886
  contentClassName: c("-mt-2 px-0", $.groupRegion),
799
- children: /* @__PURE__ */ G(at, {
887
+ children: C && /* @__PURE__ */ G(mt, {
800
888
  stages: e,
801
889
  isStreaming: t,
890
+ expansion: T,
802
891
  styles: {
803
- colors: D,
892
+ colors: A,
804
893
  typography: i?.typography
805
894
  },
806
- labels: A,
895
+ labels: N,
807
896
  className: "pt-1",
808
897
  onAttachmentClick: a
809
898
  })
@@ -811,4 +900,4 @@ var q = {
811
900
  });
812
901
  };
813
902
  //#endregion
814
- export { q as CONVERSATION_STAGES_CLASS, ot as CollapsedGroup, at as StagesPanel };
903
+ export { q as CONVERSATION_STAGES_CLASS, gt as CollapsedGroup, ht as StagesPanel };