@epam/ai-dial-conversation-stages 1.3.0-dev.358 → 1.3.0-dev.364

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 (2) hide show
  1. package/index.js +324 -318
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1,15 +1,15 @@
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
- import { Accordion as d, DIAL_ICON_SIZE as f, DIAL_KIT_ICON_STROKE as p, DialItemType as m, ElementSize as h, EllipsisTooltip as g, FileIcon as _, Highlight as v, LiveRegion as y, LiveRegionElement as b, Skeleton as x, SkeletonVariant as S, Spinner as C, StaticIconButton as w } from "@epam/ai-dial-ui-kit";
3
- import { IconAlertCircle as T, IconCheck as E, IconClipboard as D, IconDownload as O, IconExternalLink as k, IconFile as A, IconFileTypeBmp as j, IconFileTypeCss as M, IconFileTypeCsv as N, IconFileTypeDoc as P, IconFileTypeDocx as F, IconFileTypeHtml as I, IconFileTypeJpg as L, IconFileTypeJs as R, IconFileTypeJsx as z, IconFileTypePdf as B, IconFileTypePhp as V, IconFileTypePng as H, IconFileTypePpt as U, IconFileTypeRs as ee, IconFileTypeSql as te, IconFileTypeSvg as ne, IconFileTypeTs as re, IconFileTypeTsx as ie, IconFileTypeTxt as W, IconFileTypeVue as G, IconFileTypeXls as ae, IconFileTypeXml as oe, IconFileTypeZip as se, IconMusic as ce, IconPhoto as le, IconReload as ue, IconTerminal2 as de, IconVideo as fe, IconX as pe } from "@tabler/icons-react";
4
- import { memo as me, useCallback as K, useEffect as he, useId as ge, useMemo as q, useRef as _e, useState as ve } from "react";
5
- import { Fragment as ye, jsx as J, jsxs as Y } from "react/jsx-runtime";
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, useIsVerticallyClamped as d } from "@epam/ai-dial-chat-shared";
2
+ import { Accordion as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, DialItemType as h, ElementSize as g, EllipsisTooltip as ee, FileIcon as _, Highlight as v, LiveRegion as y, LiveRegionElement as b, Skeleton as x, SkeletonVariant as S, Spinner as te, StaticIconButton as C, Tooltip as w } from "@epam/ai-dial-ui-kit";
3
+ import { IconAlertCircle as T, IconCheck as E, IconClipboard as D, IconDownload as O, IconExternalLink as k, IconFile as A, IconFileTypeBmp as j, IconFileTypeCss as M, IconFileTypeCsv as N, IconFileTypeDoc as P, IconFileTypeDocx as ne, IconFileTypeHtml as F, IconFileTypeJpg as I, IconFileTypeJs as L, IconFileTypeJsx as R, IconFileTypePdf as z, IconFileTypePhp as B, IconFileTypePng as V, IconFileTypePpt as H, IconFileTypeRs as re, IconFileTypeSql as ie, IconFileTypeSvg as ae, IconFileTypeTs as oe, IconFileTypeTsx as se, IconFileTypeTxt as U, IconFileTypeVue as W, IconFileTypeXls as ce, IconFileTypeXml as le, IconFileTypeZip as ue, IconMusic as G, IconPhoto as de, IconReload as fe, IconTerminal2 as pe, IconVideo as me, IconX as he } from "@tabler/icons-react";
4
+ import { memo as ge, useCallback as K, useEffect as _e, useId as ve, useMemo as q, useRef as ye, useState as be } from "react";
5
+ import { Fragment as xe, jsx as J, jsxs as Y } from "react/jsx-runtime";
6
6
  //#region src/constants/public-class-names.ts
7
- var be = {
7
+ var Se = {
8
8
  panel: "dial-conversation-stages-panel",
9
9
  group: "dial-conversation-stages-group",
10
10
  groupToggle: "dial-conversation-stages-group-toggle"
11
- }, xe = () => {
12
- let [e, t] = ve(() => /* @__PURE__ */ new Set()), n = K((e, n) => {
11
+ }, Ce = () => {
12
+ let [e, t] = be(() => /* @__PURE__ */ new Set()), n = K((e, n) => {
13
13
  t((t) => {
14
14
  if (t.has(e) === n) return t;
15
15
  let r = new Set(t);
@@ -27,30 +27,30 @@ var be = {
27
27
  n,
28
28
  r
29
29
  ]);
30
- }, Se = /[([][^()[\]]*[)\]]/g, Ce = /(\d+(?:\.\d+)?)\s*s\b/, we = (e) => {
30
+ }, we = /[([][^()[\]]*[)\]]/g, Te = /(\d+(?:\.\d+)?)\s*s\b/, Ee = (e) => {
31
31
  let t = e.trimEnd();
32
32
  return t.endsWith(":") ? t.slice(0, -1) : t;
33
- }, Te = (e) => {
34
- Se.lastIndex = 0;
33
+ }, De = (e) => {
34
+ we.lastIndex = 0;
35
35
  let t;
36
- for (; t = Se.exec(e);) {
37
- let e = t[0].slice(1, -1), n = Ce.exec(e);
36
+ for (; t = we.exec(e);) {
37
+ let e = t[0].slice(1, -1), n = Te.exec(e);
38
38
  if (n) return {
39
39
  durationLabel: `${n[1]}s`,
40
40
  groupIndex: t.index,
41
41
  groupLength: t[0].length
42
42
  };
43
43
  }
44
- }, Ee = (e) => {
45
- let t = e ?? "", n = Te(t);
44
+ }, Oe = (e) => {
45
+ let t = e ?? "", n = De(t);
46
46
  return {
47
- name: we(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
47
+ name: Ee(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
48
48
  durationLabel: n?.durationLabel
49
49
  };
50
- }, De = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), Oe = (e) => [...e].reverse().find((e) => e.status == null), ke = (e, t) => {
50
+ }, ke = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), Ae = (e) => [...e].reverse().find((e) => e.status == null), je = (e, t) => {
51
51
  let n = e.parent_stage_index;
52
52
  if (!(n == null || !Number.isInteger(n) || n < 0 || n >= e.index)) return t.get(n);
53
- }, Ae = (e) => {
53
+ }, Me = (e) => {
54
54
  let t = e.map((e) => ({
55
55
  stage: e,
56
56
  children: []
@@ -58,15 +58,15 @@ var be = {
58
58
  for (let e of t) n.has(e.stage.index) || n.set(e.stage.index, e);
59
59
  let r = [];
60
60
  for (let e of t) {
61
- let t = ke(e.stage, n);
61
+ let t = je(e.stage, n);
62
62
  t ? t.children.push(e) : r.push(e);
63
63
  }
64
64
  return r;
65
- }, je = (e) => `stage:${e}`, Me = (e) => `group:${e}`, Ne = "min-w-0 overflow-visible py-0", Pe = "min-w-0 justify-start gap-2 rounded-lg px-2 py-1.5 text-start mobile:min-h-11", Fe = (e) => {
65
+ }, Ne = (e) => `stage:${e}`, Pe = (e) => `group:${e}`, Fe = "min-w-0 overflow-visible py-0", Ie = "min-w-0 justify-start gap-2 rounded-lg px-2 py-1.5 text-start mobile:min-h-11", Le = (e) => {
66
66
  let t = [], n = 0;
67
67
  for (; n < e.length;) {
68
- let r = e[n], i = Ee(r.stage.name).name, a = n + 1;
69
- for (; a < e.length && Ee(e[a].stage.name).name === i;) a += 1;
68
+ let r = e[n], i = Oe(r.stage.name).name, a = n + 1;
69
+ for (; a < e.length && Oe(e[a].stage.name).name === i;) a += 1;
70
70
  let o = e.slice(n, a);
71
71
  o.length > 1 ? t.push({
72
72
  key: r.stage.index,
@@ -97,102 +97,102 @@ var be = {
97
97
  codeInline: "_codeInline_msss2_76",
98
98
  blockquote: "_blockquote_msss2_82",
99
99
  tableCell: "_tableCell_msss2_87"
100
- }, Ie = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === o.Failed ? /* @__PURE__ */ Y(ye, { children: [/* @__PURE__ */ J(T, {
101
- size: f.MD,
100
+ }, Re = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === o.Failed ? /* @__PURE__ */ Y(xe, { children: [/* @__PURE__ */ J(T, {
101
+ size: p.MD,
102
102
  className: X.iconError,
103
103
  "aria-hidden": !0,
104
- stroke: p
104
+ stroke: m
105
105
  }), /* @__PURE__ */ J("span", {
106
106
  className: "sr-only",
107
107
  children: r
108
108
  })] }) : e === o.Completed ? /* @__PURE__ */ J(E, {
109
- size: f.SM,
109
+ size: p.SM,
110
110
  className: X.iconCompleted,
111
111
  "aria-hidden": !0,
112
- stroke: p
113
- }) : t ? /* @__PURE__ */ J(C, {
112
+ stroke: m
113
+ }) : t ? /* @__PURE__ */ J(te, {
114
114
  size: 16,
115
115
  ariaLabel: n
116
- }) : null, Le = (e) => {
116
+ }) : null, ze = (e) => {
117
117
  if (e == null) return "";
118
118
  let t = e.lastIndexOf(".");
119
119
  return t > 0 ? e.slice(0, t) : e;
120
- }, Re = (e) => {
120
+ }, Be = (e) => {
121
121
  if (!e) return A;
122
122
  let t = u(e);
123
123
  if (t.startsWith("image/")) switch (t) {
124
- case "image/jpeg": return L;
125
- case "image/png": return H;
126
- case "image/svg+xml": return ne;
124
+ case "image/jpeg": return I;
125
+ case "image/png": return V;
126
+ case "image/svg+xml": return ae;
127
127
  case "image/bmp": return j;
128
- default: return le;
128
+ default: return de;
129
129
  }
130
- if (t.startsWith("video/")) return fe;
131
- if (t.startsWith("audio/")) return ce;
130
+ if (t.startsWith("video/")) return me;
131
+ if (t.startsWith("audio/")) return G;
132
132
  switch (t) {
133
- case "application/pdf": return B;
133
+ case "application/pdf": return z;
134
134
  case "application/msword": return P;
135
- case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return F;
136
- case "application/vnd.ms-powerpoint": return U;
137
- case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return U;
138
- case "application/vnd.ms-excel": return ae;
139
- case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return ae;
135
+ case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return ne;
136
+ case "application/vnd.ms-powerpoint": return H;
137
+ case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return H;
138
+ case "application/vnd.ms-excel": return ce;
139
+ case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return ce;
140
140
  case "application/zip":
141
141
  case "application/vnd.rar":
142
142
  case "application/x-7z-compressed":
143
143
  case "application/gzip":
144
- case "application/x-tar": return se;
144
+ case "application/x-tar": return ue;
145
145
  case "text/csv": return N;
146
- case "text/plain": return W;
146
+ case "text/plain": return U;
147
147
  case "text/html":
148
- case "application/xhtml+xml": return I;
149
- case "application/xml": return oe;
150
- case "application/sql": return te;
151
- case "text/javascript": return R;
152
- case "text/jsx": return z;
153
- case "text/typescript": return re;
154
- case "text/tsx": return ie;
148
+ case "application/xhtml+xml": return F;
149
+ case "application/xml": return le;
150
+ case "application/sql": return ie;
151
+ case "text/javascript": return L;
152
+ case "text/jsx": return R;
153
+ case "text/typescript": return oe;
154
+ case "text/tsx": return se;
155
155
  case "text/css": return M;
156
- case "text/x-php": return V;
157
- case "text/x-rustsrc": return ee;
158
- case "text/x-vue": return G;
156
+ case "text/x-php": return B;
157
+ case "text/x-rustsrc": return re;
158
+ case "text/x-vue": return W;
159
159
  default: return A;
160
160
  }
161
- }, ze = (e) => {
161
+ }, Ve = (e) => {
162
162
  let { type: n, contentType: r } = e;
163
- return n === t.Prompt ? de : n === t.Pasted ? D : n === t.Image ? le : Re(r ?? "");
164
- }, Be = (e) => {
163
+ return n === t.Prompt ? pe : n === t.Pasted ? D : n === t.Image ? de : Be(r ?? "");
164
+ }, He = (e) => {
165
165
  let t = u(e), r = n[t];
166
166
  if (r) return r;
167
167
  let i = t.split("/")[1];
168
168
  if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
169
- }, Ve = (e) => {
169
+ }, Ue = (e) => {
170
170
  let { name: t, contentType: n } = e;
171
171
  if (n) {
172
- let e = Be(n);
172
+ let e = He(n);
173
173
  if (e) return e;
174
174
  }
175
175
  if (t == null) return;
176
176
  let r = t.lastIndexOf(".");
177
177
  if (r > 0 && r < t.length - 1) return t.slice(r + 1).toLowerCase();
178
- }, He = (e) => e.type !== t.Prompt && e.type !== t.Pasted, Ue = (e, n) => {
178
+ }, We = (e) => e.type !== t.Prompt && e.type !== t.Pasted, Ge = (e, n) => {
179
179
  let { type: r, name: i } = e;
180
180
  if (r === t.Prompt) return n.promptLabel ?? "Prompt";
181
181
  if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
182
182
  if (r === t.Image) return n.imageLabel ?? "Image";
183
- let a = Ve(e);
183
+ let a = Ue(e);
184
184
  return a ? `.${a}` : i ?? "";
185
- }, We = (e, n = {}) => {
185
+ }, Ke = (e, n = {}) => {
186
186
  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;
187
187
  return {
188
188
  isLoading: c,
189
189
  isError: l,
190
190
  isImage: u,
191
191
  isLink: d,
192
- BottomIcon: d ? null : ze(e),
193
- typeLabel: d ? null : Ue(e, n)
192
+ BottomIcon: d ? null : Ve(e),
193
+ typeLabel: d ? null : Ge(e, n)
194
194
  };
195
- }, Ge = "flex size-[100px] items-center justify-center rounded-xl border", Ke = "outline-offset-1 focus-visible:outline-1", Z = {
195
+ }, qe = "flex size-[100px] items-center justify-center rounded-xl border", Je = "outline-offset-1 focus-visible:outline-1", Z = {
196
196
  tray: "dial-ai-attachment-tray",
197
197
  trayItem: "dial-ai-attachment-tray-item",
198
198
  tile: "dial-ai-attachment-tile",
@@ -215,156 +215,162 @@ var be = {
215
215
  imageActionButton: "_imageActionButton_hb2mo_87",
216
216
  tileAction: "_tileAction_hb2mo_99",
217
217
  proxyFocus: "_proxyFocus_hb2mo_108"
218
- }, qe = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o, isAlwaysVisible: s }) => /* @__PURE__ */ J(w, {
218
+ }, Ye = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o, isAlwaysVisible: s }) => /* @__PURE__ */ J(C, {
219
219
  icon: a,
220
- size: h.Small,
220
+ size: g.Small,
221
221
  className: c(s ? "opacity-100" : "opacity-0 group-hover/attachment-tile:opacity-100 group-focus-visible/attachment-tile:opacity-100 group-has-focus-visible/attachment-tile:opacity-100", Q.actionButton, o, Z.tileAction),
222
222
  "aria-label": e,
223
223
  "aria-describedby": t ? n : void 0,
224
224
  onClick: (e) => {
225
225
  e.stopPropagation(), r(i);
226
226
  }
227
- }), Je = ({ ...e }) => /* @__PURE__ */ J(qe, {
228
- icon: /* @__PURE__ */ J(ue, {
229
- size: f.SM,
227
+ }), Xe = ({ ...e }) => /* @__PURE__ */ J(Ye, {
228
+ icon: /* @__PURE__ */ J(fe, {
229
+ size: p.SM,
230
230
  "aria-hidden": !0,
231
- stroke: p
231
+ stroke: m
232
232
  }),
233
233
  className: Q.retryIcon,
234
234
  ...e
235
- }), Ye = ({ ...e }) => /* @__PURE__ */ J(qe, {
235
+ }), Ze = ({ ...e }) => /* @__PURE__ */ J(Ye, {
236
236
  icon: /* @__PURE__ */ J(O, {
237
- size: f.SM,
237
+ size: p.SM,
238
238
  "aria-hidden": !0,
239
- stroke: p
239
+ stroke: m
240
240
  }),
241
241
  ...e
242
- }), Xe = ({ ...e }) => /* @__PURE__ */ J(qe, {
242
+ }), Qe = ({ ...e }) => /* @__PURE__ */ J(Ye, {
243
243
  icon: /* @__PURE__ */ J(k, {
244
- size: f.SM,
244
+ size: p.SM,
245
245
  "aria-hidden": !0,
246
- stroke: p
246
+ stroke: m
247
247
  }),
248
248
  ...e
249
- }), Ze = ({ className: e, ...t }) => /* @__PURE__ */ J(qe, {
250
- icon: /* @__PURE__ */ J(pe, {
251
- size: f.SM,
249
+ }), $e = ({ className: e, ...t }) => /* @__PURE__ */ J(Ye, {
250
+ icon: /* @__PURE__ */ J(he, {
251
+ size: p.SM,
252
252
  "aria-hidden": !0,
253
- stroke: p
253
+ stroke: m
254
254
  }),
255
255
  className: c("mobile:opacity-100", e),
256
256
  ...t
257
- }), Qe = {
257
+ }), et = {
258
258
  [e.Network]: "Upload failed · network error",
259
259
  [e.UnsupportedType]: "Upload failed · unsupported file type",
260
260
  [e.FileTooLarge]: "Upload failed · file too large"
261
- }, $e = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isLink: u, cssVars: d, onExpand: h, isExpandable: g, onRemove: x, isSelected: S }) => {
262
- let { clickLabel: w = "Download attachment", expandLabel: T = "Expand pasted text", downloadLabel: E = "Download attachment", retryLabel: D = "Retry upload", removeLabel: O = "Remove attachment", openInNewTabLabel: k = "Open in new tab", sizeLabel: A, uploadingLabel: j = "Uploading", errorReasonLabels: M, genericErrorLabel: N = "Upload failed" } = o ?? {}, { typography: P, className: F } = s ?? {}, { id: I, name: L, status: R, errorReason: z } = t, B = R === a.Loading, V = R === a.Error, H = ge(), U = V ? z && (M?.[z] ?? Qe[z]) || N : "", { BottomIcon: ee, typeLabel: te } = We(t), ne = He(t), re = !V && !B && l && !u, ie = V && !!i && z !== e.UnsupportedType && z !== e.FileTooLarge, W = !!g && h !== void 0, G = W || r !== void 0, ae = Number(!!re) + Number(!!ie) + Number(!!u) + Number(!!x), oe = !G && ae === 1, se = () => {
263
- W ? h(I) : r?.(I);
264
- }, ce = q(() => Le(L), [L]), le = K(() => {
261
+ }, tt = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isLink: u, cssVars: f, onExpand: g, isExpandable: ee, onRemove: x, isSelected: S }) => {
262
+ let { clickLabel: C = "Download attachment", expandLabel: T = "Expand pasted text", downloadLabel: E = "Download attachment", retryLabel: D = "Retry upload", removeLabel: O = "Remove attachment", openInNewTabLabel: k = "Open in new tab", sizeLabel: A, uploadingLabel: j = "Uploading", errorReasonLabels: M, genericErrorLabel: N = "Upload failed" } = o ?? {}, { typography: P, className: ne } = s ?? {}, { id: F, name: I, status: L, errorReason: R } = t, z = L === a.Loading, B = L === a.Error, V = ve(), H = B ? R && (M?.[R] ?? et[R]) || N : "", { BottomIcon: re, typeLabel: ie } = Ke(t), ae = We(t), oe = !B && !z && l && !u, se = B && !!i && R !== e.UnsupportedType && R !== e.FileTooLarge, U = !!ee && g !== void 0, W = U || r !== void 0, ce = Number(!!oe) + Number(!!se) + Number(!!u) + Number(!!x), le = !W && ce === 1, ue = () => {
263
+ U ? g(F) : r?.(F);
264
+ }, G = q(() => ze(I), [I]), { ref: de, isClamped: fe } = d(G), pe = K(() => {
265
265
  window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
266
- }, [t]), ue = c(Ge, "group/attachment-tile relative flex-col justify-between items-start gap-2 overflow-hidden p-3", Q.tile, G && !V && !B && Q.hovered, B && Q.loading, S && Q.selected, V && Q.tileError, oe && Q.proxyFocus, Z.tile, S && Z.tileSelected), de = /* @__PURE__ */ J("div", {
267
- title: ce,
266
+ }, [t]), me = c(qe, "group/attachment-tile relative flex-col justify-between items-start gap-2 overflow-hidden p-3", Q.tile, W && !B && !z && Q.hovered, z && Q.loading, S && Q.selected, B && Q.tileError, le && Q.proxyFocus, Z.tile, S && Z.tileSelected), he = /* @__PURE__ */ J("div", {
267
+ ref: de,
268
+ title: G,
268
269
  className: c(P?.nameClassName ?? "dial-tiny-text", "line-clamp-2 w-full min-w-0 wrap-break-word", Q.nameText, Z.tileName),
269
270
  children: n ? /* @__PURE__ */ J(v, {
270
- text: ce,
271
+ text: G,
271
272
  query: n,
272
273
  maxLines: 2
273
- }) : ce
274
- }), fe = ee && /* @__PURE__ */ Y("div", {
274
+ }) : G
275
+ }), ge = re && /* @__PURE__ */ Y("div", {
275
276
  className: c("flex w-full items-end gap-1", Z.tileType),
276
- children: [ne ? /* @__PURE__ */ J(_, {
277
- type: m.File,
278
- name: L ?? "",
279
- fileExtension: Ve(t),
280
- size: f.MD,
277
+ children: [ae ? /* @__PURE__ */ J(_, {
278
+ type: h.File,
279
+ name: I ?? "",
280
+ fileExtension: Ue(t),
281
+ size: p.MD,
281
282
  decorative: !0
282
- }) : /* @__PURE__ */ J(ee, {
283
- size: f.MD,
283
+ }) : /* @__PURE__ */ J(re, {
284
+ size: p.MD,
284
285
  className: Q.typeText,
285
- stroke: p,
286
+ stroke: m,
286
287
  "aria-hidden": !0
287
288
  }), /* @__PURE__ */ J("span", {
288
289
  className: c(P?.metaClassName ?? "dial-tiny-text", "min-w-0 flex-1 truncate", Q.typeText),
289
- children: A ? `${te} · ${A}` : te
290
+ children: A ? `${ie} · ${A}` : ie
290
291
  })]
291
- }), pe = /* @__PURE__ */ Y(ye, { children: [
292
- de,
293
- fe,
294
- G && /* @__PURE__ */ J("button", {
295
- type: "button",
296
- "aria-label": W ? T : w,
297
- "aria-pressed": !W && r !== void 0 ? S : void 0,
298
- onClick: se,
299
- className: c("absolute inset-0 cursor-pointer rounded-[11px]", Q.tileAction)
292
+ }), _e = /* @__PURE__ */ Y(xe, { children: [
293
+ he,
294
+ ge,
295
+ W && /* @__PURE__ */ J(w, {
296
+ tooltip: I,
297
+ hideTooltip: !fe,
298
+ triggerClassName: "absolute inset-0",
299
+ children: /* @__PURE__ */ J("button", {
300
+ type: "button",
301
+ "aria-label": U ? T : C,
302
+ "aria-pressed": !U && r !== void 0 ? S : void 0,
303
+ onClick: ue,
304
+ className: c("absolute inset-0 cursor-pointer rounded-[11px]", Q.tileAction)
305
+ })
300
306
  }),
301
- B && /* @__PURE__ */ J("div", {
307
+ z && /* @__PURE__ */ J("div", {
302
308
  role: "progressbar",
303
309
  "aria-label": j,
304
310
  className: c("absolute inset-0 flex items-center justify-center rounded-[11px]", Q.track),
305
311
  children: /* @__PURE__ */ J("span", {
306
312
  "aria-hidden": !0,
307
313
  className: "flex",
308
- children: /* @__PURE__ */ J(C, { size: 32 })
314
+ children: /* @__PURE__ */ J(te, { size: 32 })
309
315
  })
310
316
  }),
311
317
  /* @__PURE__ */ Y("div", {
312
318
  className: "absolute inset-e-1 top-1 flex",
313
319
  children: [
314
- re && /* @__PURE__ */ J(Ye, {
320
+ oe && /* @__PURE__ */ J(Ze, {
315
321
  ariaLabel: E,
316
- errorTitle: U,
317
- errorDescId: H,
322
+ errorTitle: H,
323
+ errorDescId: V,
318
324
  onClick: l,
319
- id: I
325
+ id: F
320
326
  }),
321
- ie && /* @__PURE__ */ J(Je, {
327
+ se && /* @__PURE__ */ J(Xe, {
322
328
  ariaLabel: D,
323
- errorTitle: U,
324
- errorDescId: H,
329
+ errorTitle: H,
330
+ errorDescId: V,
325
331
  onClick: i,
326
- id: I
332
+ id: F
327
333
  }),
328
- u && /* @__PURE__ */ J(Xe, {
334
+ u && /* @__PURE__ */ J(Qe, {
329
335
  ariaLabel: k,
330
- errorTitle: U,
331
- errorDescId: H,
332
- onClick: le
336
+ errorTitle: H,
337
+ errorDescId: V,
338
+ onClick: pe
333
339
  }),
334
- x && /* @__PURE__ */ J(Ze, {
340
+ x && /* @__PURE__ */ J($e, {
335
341
  ariaLabel: O,
336
- errorTitle: U,
337
- errorDescId: H,
342
+ errorTitle: H,
343
+ errorDescId: V,
338
344
  onClick: x,
339
- id: I,
340
- isAlwaysVisible: B
345
+ id: F,
346
+ isAlwaysVisible: z
341
347
  })
342
348
  ]
343
349
  }),
344
350
  /* @__PURE__ */ J(y, {
345
- id: H,
351
+ id: V,
346
352
  visuallyHidden: !0,
347
353
  as: b.Span,
348
- children: V ? U : ""
354
+ children: B ? H : ""
349
355
  })
350
356
  ] });
351
357
  return /* @__PURE__ */ J("div", {
352
- style: d,
353
- className: c("inline-flex", F),
358
+ style: f,
359
+ className: c("inline-flex", ne),
354
360
  children: /* @__PURE__ */ J("div", {
355
- "aria-busy": B,
356
- style: d,
357
- className: c(ue, G && "cursor-pointer", Ke),
358
- children: pe
361
+ "aria-busy": z,
362
+ style: f,
363
+ className: c(me, W && "cursor-pointer", Je),
364
+ children: _e
359
365
  })
360
366
  });
361
- }, et = /* @__PURE__ */ function(e) {
367
+ }, nt = /* @__PURE__ */ function(e) {
362
368
  return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
363
- }({}), tt = ({ enabled: e, src: t }) => {
364
- let n = _e(null), [r, i] = ve("idle");
365
- return he(() => {
369
+ }({}), rt = ({ enabled: e, src: t }) => {
370
+ let n = ye(null), [r, i] = be("idle");
371
+ return _e(() => {
366
372
  i(e && t ? "loading" : "idle");
367
- }, [e, t]), he(() => {
373
+ }, [e, t]), _e(() => {
368
374
  let r = n.current;
369
375
  if (!r || !e || !t) return;
370
376
  let a = () => i("loaded"), o = () => i("error");
@@ -375,77 +381,77 @@ var be = {
375
381
  imageRef: n,
376
382
  imageLoadStatus: r
377
383
  };
378
- }, nt = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
379
- let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment", uploadingLabel: _ = "Uploading" } = i ?? {}, { className: v } = l ?? {}, { id: y, name: b } = e, w = e.previewUrl ?? e.url, T = e.type === t.Pasted && n !== void 0, { isLoading: E, isError: D, isImage: O } = q(() => We(e), [e]), k = r !== void 0 && !T && !E && !D, A = T || k, j = !!s && !E, M = !A && Number(!!a) + Number(j) === 1, { imageRef: N, imageLoadStatus: P } = tt({
380
- enabled: O,
381
- src: w
382
- }), F = () => {
383
- T && n ? n(y) : k && r && r(y);
384
- }, I = c(Ge, "group/attachment-tile", A && "cursor-pointer", Q.tile, u && Q.selected, E && Q.loading, M && Q.proxyFocus, Ke, v, Z.tile, u && Z.tileSelected);
384
+ }, it = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
385
+ let { clickLabel: d = "Open attachment", expandLabel: f = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment", uploadingLabel: ee = "Uploading" } = i ?? {}, { className: _ } = l ?? {}, { id: v, name: y } = e, b = e.previewUrl ?? e.url, C = e.type === t.Pasted && n !== void 0, { isLoading: w, isError: T, isImage: E } = q(() => Ke(e), [e]), D = r !== void 0 && !C && !w && !T, O = C || D, k = !!s && !w, A = !O && Number(!!a) + Number(k) === 1, { imageRef: j, imageLoadStatus: M } = rt({
386
+ enabled: E,
387
+ src: b
388
+ }), N = () => {
389
+ C && n ? n(v) : D && r && r(v);
390
+ }, P = c(qe, "group/attachment-tile", O && "cursor-pointer", Q.tile, u && Q.selected, w && Q.loading, A && Q.proxyFocus, Je, _, Z.tile, u && Z.tileSelected);
385
391
  return /* @__PURE__ */ J("div", {
386
- className: I,
387
- "aria-busy": E,
392
+ className: P,
393
+ "aria-busy": w,
388
394
  style: o,
389
395
  children: /* @__PURE__ */ Y("div", {
390
396
  className: "relative h-full w-full overflow-hidden",
391
397
  children: [
392
398
  /* @__PURE__ */ Y("div", {
393
399
  className: "absolute inset-e-1 top-1 z-10 flex",
394
- children: [a && /* @__PURE__ */ J(Ze, {
400
+ children: [a && /* @__PURE__ */ J($e, {
395
401
  ariaLabel: h,
396
402
  onClick: a,
397
- id: y,
403
+ id: v,
398
404
  className: Q.imageActionButton,
399
- isAlwaysVisible: E
400
- }), j && /* @__PURE__ */ J(Ye, {
405
+ isAlwaysVisible: w
406
+ }), k && /* @__PURE__ */ J(Ze, {
401
407
  ariaLabel: g,
402
408
  onClick: s,
403
- id: y,
409
+ id: v,
404
410
  className: Q.imageActionButton
405
411
  })]
406
412
  }),
407
- P !== et.Loaded && /* @__PURE__ */ J(x, {
413
+ M !== nt.Loaded && /* @__PURE__ */ J(x, {
408
414
  variant: S.Rectangular,
409
415
  width: "100%",
410
416
  height: "100%",
411
- active: P === et.Loading,
412
- overlay: /* @__PURE__ */ J(le, {
413
- size: f.LG,
417
+ active: M === nt.Loading,
418
+ overlay: /* @__PURE__ */ J(de, {
419
+ size: p.LG,
414
420
  className: Q.placeholderIcon,
415
421
  "aria-hidden": !0,
416
- stroke: p
422
+ stroke: m
417
423
  }),
418
424
  className: "absolute inset-0 rounded-xl"
419
425
  }),
420
426
  /* @__PURE__ */ J("img", {
421
- ref: N,
422
- src: w,
423
- alt: b,
427
+ ref: j,
428
+ src: b,
429
+ alt: y,
424
430
  loading: "lazy",
425
431
  decoding: "async",
426
- className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", P === et.Loaded ? "opacity-100" : "opacity-0")
432
+ className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", M === nt.Loaded ? "opacity-100" : "opacity-0")
427
433
  }),
428
- A && /* @__PURE__ */ J("button", {
434
+ O && /* @__PURE__ */ J("button", {
429
435
  type: "button",
430
- "aria-label": T ? m : d,
431
- "aria-pressed": k ? u : void 0,
432
- onClick: F,
436
+ "aria-label": C ? f : d,
437
+ "aria-pressed": D ? u : void 0,
438
+ onClick: N,
433
439
  className: c("absolute inset-0 cursor-pointer rounded-xl", Q.tileAction)
434
440
  }),
435
- E && /* @__PURE__ */ J("div", {
441
+ w && /* @__PURE__ */ J("div", {
436
442
  role: "progressbar",
437
- "aria-label": _,
443
+ "aria-label": ee,
438
444
  className: c("absolute inset-0 flex items-center justify-center rounded-xl", Q.track),
439
445
  children: /* @__PURE__ */ J("span", {
440
446
  "aria-hidden": !0,
441
447
  className: "flex",
442
- children: /* @__PURE__ */ J(C, { size: 32 })
448
+ children: /* @__PURE__ */ J(te, { size: 32 })
443
449
  })
444
450
  })
445
451
  ]
446
452
  })
447
453
  });
448
- }, rt = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
454
+ }, at = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
449
455
  let { colors: f } = u ?? {}, p = e.type === t.Pasted && a !== void 0, m = s({
450
456
  "--ai-tile-bg": f?.background,
451
457
  "--ai-tile-border": f?.border,
@@ -463,8 +469,8 @@ var be = {
463
469
  "--ai-tile-hover-icon-bg": f?.hoverIconBackground,
464
470
  "--ai-tile-hover-icon-color": f?.hoverIconColor,
465
471
  "--ai-tile-progress-track": f?.trackBackground
466
- }), { isImage: h, isLink: g } = q(() => We(e), [e]);
467
- return h ? /* @__PURE__ */ J(nt, {
472
+ }), { isImage: h, isLink: g } = q(() => Ke(e), [e]);
473
+ return h ? /* @__PURE__ */ J(it, {
468
474
  attachment: e,
469
475
  labels: l,
470
476
  onClick: o,
@@ -474,7 +480,7 @@ var be = {
474
480
  cssVars: m,
475
481
  onDownload: c,
476
482
  isSelected: d
477
- }) : /* @__PURE__ */ J($e, {
483
+ }) : /* @__PURE__ */ J(tt, {
478
484
  attachment: e,
479
485
  searchQuery: n,
480
486
  onClick: o,
@@ -489,7 +495,7 @@ var be = {
489
495
  isExpandable: p,
490
496
  isSelected: d
491
497
  });
492
- }, it = (e, t) => {
498
+ }, ot = (e, t) => {
493
499
  let n = l(e, t);
494
500
  if (!e?.length) return n;
495
501
  let r = /* @__PURE__ */ new Map();
@@ -504,7 +510,7 @@ var be = {
504
510
  contentType: t
505
511
  } : e;
506
512
  });
507
- }, at = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i, copiedLabel: a }) => {
513
+ }, st = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i, copiedLabel: a }) => {
508
514
  let o = t?.replace(/^language-/, "") ?? "";
509
515
  return /* @__PURE__ */ J(r, {
510
516
  language: o,
@@ -515,9 +521,9 @@ var be = {
515
521
  copiedLabel: a,
516
522
  hideDownload: !0
517
523
  });
518
- }, ot = me(({ content: e, typography: t, copyAriaLabel: n = "Copy", copiedLabel: r, tableScrollRegionAriaLabel: a, mathScrollRegionAriaLabel: o, renderCitation: s }) => {
524
+ }, ct = ge(({ content: e, typography: t, copyAriaLabel: n = "Copy", copiedLabel: r, tableScrollRegionAriaLabel: a, mathScrollRegionAriaLabel: o, renderCitation: s }) => {
519
525
  let l = "mb-1.5 last:mb-0", u = c(t?.headingClassName ?? "dial-small-semi-text", X.stageContent, l), d = q(() => ({
520
- code: ({ children: e, className: i }) => i?.includes("language-") ? /* @__PURE__ */ J(at, {
526
+ code: ({ children: e, className: i }) => i?.includes("language-") ? /* @__PURE__ */ J(st, {
521
527
  codeClassName: i,
522
528
  blockClassName: t?.codeBlockClassName,
523
529
  copyAriaLabel: n,
@@ -557,7 +563,7 @@ var be = {
557
563
  },
558
564
  components: d
559
565
  });
560
- }), st = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
566
+ }), lt = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
561
567
  let r = K((t) => {
562
568
  let r = e.find((e) => e.id === t);
563
569
  r && n?.(r);
@@ -567,75 +573,75 @@ var be = {
567
573
  className: "flex flex-wrap gap-2",
568
574
  children: e.map((e) => /* @__PURE__ */ J("div", {
569
575
  role: "listitem",
570
- children: /* @__PURE__ */ J(rt, {
576
+ children: /* @__PURE__ */ J(at, {
571
577
  attachment: e,
572
578
  onClick: n && r,
573
579
  labels: { clickLabel: t }
574
580
  })
575
581
  }, e.id))
576
582
  });
577
- }, ct = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a, attachmentDisplayResolvers: s, renderCitation: l, childList: u, isExpanded: f, onToggle: p }) => {
578
- let [m, h] = ve(!1), _ = f ?? m, v = K((e) => {
579
- f === void 0 && h(e), p?.(e);
580
- }, [f, p]), { copyAriaLabel: y = "Copy stage content", codeBlockCopiedLabel: b, tableScrollRegionAriaLabel: x, mathScrollRegionAriaLabel: S, runningAriaLabel: C, failedAriaLabel: w, attachmentClickLabel: T = "Preview search result" } = r ?? {}, E = q(() => it(e.attachments, s), [e.attachments, s]), { name: D, durationLabel: O } = Ee(e.name), k = i ?? D, A = !i && De(D), j = e.status === o.Failed, M = !!e.content || !!e.attachments?.length, N = M || u != null, P = /* @__PURE__ */ Y(ye, { children: [
583
+ }, ut = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a, attachmentDisplayResolvers: s, renderCitation: l, childList: u, isExpanded: d, onToggle: p }) => {
584
+ let [m, h] = be(!1), g = d ?? m, _ = K((e) => {
585
+ d === void 0 && h(e), p?.(e);
586
+ }, [d, p]), { copyAriaLabel: v = "Copy stage content", codeBlockCopiedLabel: y, tableScrollRegionAriaLabel: b, mathScrollRegionAriaLabel: x, runningAriaLabel: S, failedAriaLabel: te, attachmentClickLabel: C = "Preview search result" } = r ?? {}, w = q(() => ot(e.attachments, s), [e.attachments, s]), { name: T, durationLabel: E } = Oe(e.name), D = i ?? T, O = !i && ke(T), k = e.status === o.Failed, A = !!e.content || !!e.attachments?.length, j = A || u != null, M = /* @__PURE__ */ Y(xe, { children: [
581
587
  /* @__PURE__ */ J("span", {
582
588
  className: "flex flex-none items-center",
583
- children: /* @__PURE__ */ J(Ie, {
589
+ children: /* @__PURE__ */ J(Re, {
584
590
  status: e.status,
585
591
  isLive: t,
586
- runningLabel: C,
587
- failedLabel: w
592
+ runningLabel: S,
593
+ failedLabel: te
588
594
  })
589
595
  }),
590
596
  /* @__PURE__ */ J("span", {
591
- className: c("max-w-88 min-w-0 truncate", A ? n?.monoFontClassName ?? "dial-code-text" : n?.fontClassName ?? "dial-small-text", X.stageName, j && X.stageNameFailed),
592
- children: /* @__PURE__ */ J(g, { text: k || e.status || "" })
597
+ className: c("max-w-88 min-w-0 truncate", O ? n?.monoFontClassName ?? "dial-code-text" : n?.fontClassName ?? "dial-small-text", X.stageName, k && X.stageNameFailed),
598
+ children: /* @__PURE__ */ J(ee, { text: D || e.status || "" })
593
599
  }),
594
600
  e.tag && /* @__PURE__ */ J("span", {
595
601
  className: c("flex-none", n?.tagClassName ?? "dial-tiny-lead-text", X.tag),
596
602
  children: e.tag
597
603
  }),
598
- O && /* @__PURE__ */ J("span", {
604
+ E && /* @__PURE__ */ J("span", {
599
605
  className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", X.duration),
600
- children: O
606
+ children: E
601
607
  })
602
608
  ] });
603
- return N ? /* @__PURE__ */ Y(d, {
604
- expanded: _,
605
- onToggle: v,
609
+ return j ? /* @__PURE__ */ Y(f, {
610
+ expanded: g,
611
+ onToggle: _,
606
612
  title: /* @__PURE__ */ J("span", {
607
613
  className: "flex min-w-0 items-center gap-2",
608
- children: P
614
+ children: M
609
615
  }),
610
- className: Ne,
611
- headerClassName: c(Pe, X.row, X.stageHeader),
616
+ className: Fe,
617
+ headerClassName: c(Ie, X.row, X.stageHeader),
612
618
  contentClassName: c("-mt-1 flex min-w-0 flex-col gap-3 px-0 py-1", X.stageRegion),
613
- children: [_ && M && /* @__PURE__ */ Y("div", {
619
+ children: [g && A && /* @__PURE__ */ Y("div", {
614
620
  className: "flex min-w-0 flex-col gap-3 ps-8",
615
621
  children: [e.content && /* @__PURE__ */ J("div", {
616
622
  className: "max-h-[300px] min-w-0 overflow-y-auto",
617
- children: /* @__PURE__ */ J(ot, {
623
+ children: /* @__PURE__ */ J(ct, {
618
624
  content: e.content,
619
625
  typography: n,
620
- copyAriaLabel: y,
621
- copiedLabel: b,
622
- tableScrollRegionAriaLabel: x,
623
- mathScrollRegionAriaLabel: S,
626
+ copyAriaLabel: v,
627
+ copiedLabel: y,
628
+ tableScrollRegionAriaLabel: b,
629
+ mathScrollRegionAriaLabel: x,
624
630
  renderCitation: l
625
631
  })
626
- }), E.length > 0 && /* @__PURE__ */ J(st, {
627
- attachments: E,
628
- clickLabel: T,
632
+ }), w.length > 0 && /* @__PURE__ */ J(lt, {
633
+ attachments: w,
634
+ clickLabel: C,
629
635
  onAttachmentClick: a
630
636
  })]
631
- }), _ && u]
637
+ }), g && u]
632
638
  }) : /* @__PURE__ */ J("div", {
633
639
  className: c("flex w-full items-center gap-2 px-2 py-1.5", X.row),
634
- children: P
640
+ children: M
635
641
  });
636
- }, 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, attachmentDisplayResolvers: c, renderCitation: l }) => {
637
- let u = je(e.stage.index), d = t + 1;
638
- return /* @__PURE__ */ J(ct, {
642
+ }, dt = (e) => e <= 3 ? "ps-4" : "ps-0", ft = (e) => e <= 3 ? "ps-6" : "ps-0", pt = ({ node: e, depth: t, nameOverride: n, isStreaming: r, expansion: i, typography: a, labels: o, onAttachmentClick: s, attachmentDisplayResolvers: c, renderCitation: l }) => {
643
+ let u = Ne(e.stage.index), d = t + 1;
644
+ return /* @__PURE__ */ J(ut, {
639
645
  stage: e.stage,
640
646
  nameOverride: n,
641
647
  isLive: r && e.stage.status == null,
@@ -646,10 +652,10 @@ var be = {
646
652
  renderCitation: l,
647
653
  isExpanded: i.isExpanded(u),
648
654
  onToggle: (e) => i.onToggle(u, e),
649
- childList: e.children.length > 0 ? /* @__PURE__ */ J(pt, {
655
+ childList: e.children.length > 0 ? /* @__PURE__ */ J(ht, {
650
656
  nodes: e.children,
651
657
  depth: d,
652
- className: lt(d),
658
+ className: dt(d),
653
659
  isStreaming: r,
654
660
  expansion: i,
655
661
  typography: a,
@@ -659,24 +665,24 @@ var be = {
659
665
  renderCitation: l
660
666
  }) : void 0
661
667
  });
662
- }, ft = ({ row: e, depth: t, isStreaming: n, expansion: r, typography: i, labels: a, onAttachmentClick: s, attachmentDisplayResolvers: l, renderCitation: u }) => {
663
- let { runningAriaLabel: f, failedAriaLabel: p, attemptLabel: m = (e) => `Attempt ${e}` } = a ?? {}, h = e.attempts ?? [], _ = h.some((e) => e.stage.status == null), v = h.some((e) => e.stage.status === o.Failed), y = o.Completed;
664
- _ ? y = null : v && (y = o.Failed);
665
- let b = Me(e.key), x = r.isExpanded(b), S = t + 1, C = /* @__PURE__ */ Y("span", {
668
+ }, mt = ({ row: e, depth: t, isStreaming: n, expansion: r, typography: i, labels: a, onAttachmentClick: s, attachmentDisplayResolvers: l, renderCitation: u }) => {
669
+ let { runningAriaLabel: d, failedAriaLabel: p, attemptLabel: m = (e) => `Attempt ${e}` } = a ?? {}, h = e.attempts ?? [], g = h.some((e) => e.stage.status == null), _ = h.some((e) => e.stage.status === o.Failed), v = o.Completed;
670
+ g ? v = null : _ && (v = o.Failed);
671
+ let y = Pe(e.key), b = r.isExpanded(y), x = t + 1, S = /* @__PURE__ */ Y("span", {
666
672
  className: "flex min-w-0 items-center gap-2",
667
673
  children: [
668
674
  /* @__PURE__ */ J("span", {
669
675
  className: "flex flex-none items-center",
670
- children: /* @__PURE__ */ J(Ie, {
671
- status: y,
672
- isLive: n && _,
673
- runningLabel: f,
676
+ children: /* @__PURE__ */ J(Re, {
677
+ status: v,
678
+ isLive: n && g,
679
+ runningLabel: d,
674
680
  failedLabel: p
675
681
  })
676
682
  }),
677
683
  /* @__PURE__ */ J("span", {
678
- className: c("max-w-88 min-w-0 truncate", i?.fontClassName ?? "dial-small-text", X.stageName, v && X.stageNameFailed),
679
- children: /* @__PURE__ */ J(g, { text: e.name })
684
+ className: c("max-w-88 min-w-0 truncate", i?.fontClassName ?? "dial-small-text", X.stageName, _ && X.stageNameFailed),
685
+ children: /* @__PURE__ */ J(ee, { text: e.name })
680
686
  }),
681
687
  /* @__PURE__ */ Y("span", {
682
688
  className: c("flex-none", i?.countFontClassName ?? "dial-tiny-text", X.count),
@@ -684,22 +690,22 @@ var be = {
684
690
  })
685
691
  ]
686
692
  });
687
- return /* @__PURE__ */ J(d, {
688
- title: C,
689
- expanded: x,
690
- onToggle: (e) => r.onToggle(b, e),
691
- className: Ne,
692
- headerClassName: c(Pe, X.collapseButton, X.row, X.stageHeader),
693
- contentClassName: c("-mt-2 min-w-0 px-0", ut(S), X.stageRegion),
693
+ return /* @__PURE__ */ J(f, {
694
+ title: S,
695
+ expanded: b,
696
+ onToggle: (e) => r.onToggle(y, e),
697
+ className: Fe,
698
+ headerClassName: c(Ie, X.collapseButton, X.row, X.stageHeader),
699
+ contentClassName: c("-mt-2 min-w-0 px-0", ft(x), X.stageRegion),
694
700
  children: /* @__PURE__ */ J("ul", {
695
701
  role: "list",
696
702
  className: "flex min-w-0 flex-col gap-0.5",
697
- children: x && h.map((e, t) => /* @__PURE__ */ J("li", {
703
+ children: b && h.map((e, t) => /* @__PURE__ */ J("li", {
698
704
  role: "listitem",
699
705
  className: "min-w-0",
700
- children: /* @__PURE__ */ J(dt, {
706
+ children: /* @__PURE__ */ J(pt, {
701
707
  node: e,
702
- depth: S,
708
+ depth: x,
703
709
  nameOverride: m(t + 1),
704
710
  isStreaming: n,
705
711
  expansion: r,
@@ -712,23 +718,23 @@ var be = {
712
718
  }, e.stage.index))
713
719
  })
714
720
  });
715
- }, pt = ({ nodes: e, depth: t, className: n, ...r }) => /* @__PURE__ */ J("ul", {
721
+ }, ht = ({ nodes: e, depth: t, className: n, ...r }) => /* @__PURE__ */ J("ul", {
716
722
  role: "list",
717
723
  className: c("flex min-w-0 flex-col gap-0.5", n),
718
- children: Fe(e).map((e) => /* @__PURE__ */ J("li", {
724
+ children: Le(e).map((e) => /* @__PURE__ */ J("li", {
719
725
  role: "listitem",
720
726
  className: "min-w-0",
721
- children: e.node ? /* @__PURE__ */ J(dt, {
727
+ children: e.node ? /* @__PURE__ */ J(pt, {
722
728
  node: e.node,
723
729
  depth: t,
724
730
  ...r
725
- }) : /* @__PURE__ */ J(ft, {
731
+ }) : /* @__PURE__ */ J(mt, {
726
732
  row: e,
727
733
  depth: t,
728
734
  ...r
729
735
  })
730
736
  }, e.key))
731
- }), mt = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a, attachmentDisplayResolvers: o, renderCitation: l, expansion: u }) => {
737
+ }), gt = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a, attachmentDisplayResolvers: o, renderCitation: l, expansion: u }) => {
732
738
  let { colors: d, typography: f } = r ?? {}, p = s({
733
739
  "--cs-text": d?.text,
734
740
  "--cs-row-hover": d?.rowHoverColor,
@@ -745,11 +751,11 @@ var be = {
745
751
  "--cs-code-border": d?.codeBorderColor,
746
752
  "--cs-code-text": d?.codeTextColor,
747
753
  "--cs-border": d?.borderColor
748
- }), m = q(() => Ae(e), [e]);
754
+ }), m = q(() => Me(e), [e]);
749
755
  return /* @__PURE__ */ J("div", {
750
756
  style: p,
751
- className: c("w-full min-w-0", X.panel, n, be.panel),
752
- children: /* @__PURE__ */ J(pt, {
757
+ className: c("w-full min-w-0", X.panel, n, Se.panel),
758
+ children: /* @__PURE__ */ J(ht, {
753
759
  nodes: m,
754
760
  depth: 0,
755
761
  className: "w-full ps-5",
@@ -762,9 +768,9 @@ var be = {
762
768
  renderCitation: l
763
769
  })
764
770
  });
765
- }, ht = (e) => {
766
- let t = xe();
767
- return /* @__PURE__ */ J(mt, {
771
+ }, _t = (e) => {
772
+ let t = Ce();
773
+ return /* @__PURE__ */ J(gt, {
768
774
  ...e,
769
775
  expansion: t
770
776
  });
@@ -775,112 +781,112 @@ var be = {
775
781
  doneIcon: "_doneIcon_16fae_36",
776
782
  failedText: "_failedText_16fae_40",
777
783
  liveName: "_liveName_16fae_44"
778
- }, gt = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a, attachmentDisplayResolvers: l, renderCitation: u }) => {
779
- let { executedLabel: m = "Executed", stepsLabel: h = () => "steps", failedCountLabel: _ = (e) => `${e} failed`, runningAriaLabel: v = "Running", copyAriaLabel: y, codeBlockCopiedLabel: b, tableScrollRegionAriaLabel: x, mathScrollRegionAriaLabel: S, failedAriaLabel: w, attemptLabel: T, attachmentClickLabel: D } = n ?? {}, [O, k] = ve(t), A = xe(), { reset: j } = A, M = e.length > 1;
780
- he(() => {
781
- M && !O && j();
784
+ }, vt = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a, attachmentDisplayResolvers: l, renderCitation: u }) => {
785
+ let { executedLabel: d = "Executed", stepsLabel: h = () => "steps", failedCountLabel: g = (e) => `${e} failed`, runningAriaLabel: _ = "Running", copyAriaLabel: v, codeBlockCopiedLabel: y, tableScrollRegionAriaLabel: b, mathScrollRegionAriaLabel: x, failedAriaLabel: S, attemptLabel: C, attachmentClickLabel: w } = n ?? {}, [T, D] = be(t), O = Ce(), { reset: k } = O, A = e.length > 1;
786
+ _e(() => {
787
+ A && !T && k();
782
788
  }, [
783
- M,
784
- O,
785
- j
789
+ A,
790
+ T,
791
+ k
786
792
  ]);
787
- let N = _e(t);
788
- he(() => {
789
- N.current && !t && k(!1), N.current = t;
793
+ let j = ye(t);
794
+ _e(() => {
795
+ j.current && !t && D(!1), j.current = t;
790
796
  }, [t]);
791
- let { colors: P, panel: F } = i ?? {}, I = i?.typography ?? { fontClassName: "dial-small-text" }, L = s({
792
- "--cs-cg-label": P?.labelColor,
793
- "--cs-cg-label-hover": P?.labelHoverColor,
794
- "--cs-cg-done": P?.doneColor,
795
- "--cs-cg-failed": P?.failedColor,
796
- "--cs-text": F?.text,
797
- "--cs-row-hover": F?.rowHoverColor,
798
- "--cs-button-bg": F?.collapsedButtonBg,
799
- "--cs-stage-text": F?.stageTextColor,
800
- "--cs-failed-text": F?.failedColor,
801
- "--cs-tag-text": F?.tagTextColor,
802
- "--cs-count-text": F?.countTextColor,
803
- "--cs-duration-text": F?.durationTextColor,
804
- "--cs-icon-secondary": F?.iconSecondaryColor,
805
- "--cs-icon-completed": F?.iconCompletedColor,
806
- "--cs-icon-error": F?.iconErrorColor,
807
- "--cs-code-bg": F?.codeBg,
808
- "--cs-code-border": F?.codeBorderColor,
809
- "--cs-code-text": F?.codeTextColor,
810
- "--cs-border": F?.borderColor
797
+ let { colors: M, panel: N } = i ?? {}, P = i?.typography ?? { fontClassName: "dial-small-text" }, ne = s({
798
+ "--cs-cg-label": M?.labelColor,
799
+ "--cs-cg-label-hover": M?.labelHoverColor,
800
+ "--cs-cg-done": M?.doneColor,
801
+ "--cs-cg-failed": M?.failedColor,
802
+ "--cs-text": N?.text,
803
+ "--cs-row-hover": N?.rowHoverColor,
804
+ "--cs-button-bg": N?.collapsedButtonBg,
805
+ "--cs-stage-text": N?.stageTextColor,
806
+ "--cs-failed-text": N?.failedColor,
807
+ "--cs-tag-text": N?.tagTextColor,
808
+ "--cs-count-text": N?.countTextColor,
809
+ "--cs-duration-text": N?.durationTextColor,
810
+ "--cs-icon-secondary": N?.iconSecondaryColor,
811
+ "--cs-icon-completed": N?.iconCompletedColor,
812
+ "--cs-icon-error": N?.iconErrorColor,
813
+ "--cs-code-bg": N?.codeBg,
814
+ "--cs-code-border": N?.codeBorderColor,
815
+ "--cs-code-text": N?.codeTextColor,
816
+ "--cs-border": N?.borderColor
811
817
  });
812
818
  if (e.length === 0) return null;
813
- let R = {
814
- copyAriaLabel: y,
815
- codeBlockCopiedLabel: b,
816
- tableScrollRegionAriaLabel: x,
817
- mathScrollRegionAriaLabel: S,
818
- runningAriaLabel: v,
819
- failedAriaLabel: w,
820
- attemptLabel: T,
821
- attachmentClickLabel: D
819
+ let F = {
820
+ copyAriaLabel: v,
821
+ codeBlockCopiedLabel: y,
822
+ tableScrollRegionAriaLabel: b,
823
+ mathScrollRegionAriaLabel: x,
824
+ runningAriaLabel: _,
825
+ failedAriaLabel: S,
826
+ attemptLabel: C,
827
+ attachmentClickLabel: w
822
828
  };
823
- if (e.length === 1) return /* @__PURE__ */ J(mt, {
829
+ if (e.length === 1) return /* @__PURE__ */ J(gt, {
824
830
  stages: e,
825
831
  isStreaming: t,
826
- expansion: A,
832
+ expansion: O,
827
833
  className: r,
828
834
  styles: {
829
- colors: F,
835
+ colors: N,
830
836
  typography: i?.typography
831
837
  },
832
- labels: R,
838
+ labels: F,
833
839
  onAttachmentClick: a,
834
840
  attachmentDisplayResolvers: l,
835
841
  renderCitation: u
836
842
  });
837
- let z = e.some((e) => e.status === o.Failed), B;
843
+ let I = e.some((e) => e.status === o.Failed), L;
838
844
  if (t) {
839
- let t = Ee((Oe(e) ?? e[e.length - 1]).name).name;
840
- B = /* @__PURE__ */ Y("span", {
845
+ let t = Oe((Ae(e) ?? e[e.length - 1]).name).name;
846
+ L = /* @__PURE__ */ Y("span", {
841
847
  role: "status",
842
848
  "aria-live": "polite",
843
849
  className: "flex min-w-0 items-center gap-2",
844
850
  children: [/* @__PURE__ */ J("span", {
845
851
  className: "flex flex-none items-center",
846
- children: /* @__PURE__ */ J(C, {
852
+ children: /* @__PURE__ */ J(te, {
847
853
  size: 14,
848
- ariaLabel: v
854
+ ariaLabel: _
849
855
  })
850
856
  }), t && /* @__PURE__ */ J("span", {
851
- className: c("max-w-88 min-w-0 truncate", I.fontClassName, $.liveName),
852
- children: /* @__PURE__ */ J(g, { text: t })
857
+ className: c("max-w-88 min-w-0 truncate", P.fontClassName, $.liveName),
858
+ children: /* @__PURE__ */ J(ee, { text: t })
853
859
  })]
854
860
  });
855
- } else if (z) {
861
+ } else if (I) {
856
862
  let t = e.filter((e) => e.status === o.Failed).length;
857
- B = /* @__PURE__ */ Y("span", {
863
+ L = /* @__PURE__ */ Y("span", {
858
864
  className: "inline-flex items-center gap-1",
859
865
  children: [/* @__PURE__ */ Y("span", {
860
- className: c(I.fontClassName, $.executedLabel),
866
+ className: c(P.fontClassName, $.executedLabel),
861
867
  children: [
862
- m,
868
+ d,
863
869
  " ",
864
870
  e.length,
865
871
  " ",
866
872
  h(e.length)
867
873
  ]
868
874
  }), /* @__PURE__ */ J("span", {
869
- className: c(I.fontClassName, $.failedText),
870
- children: _(t)
875
+ className: c(P.fontClassName, $.failedText),
876
+ children: g(t)
871
877
  })]
872
878
  });
873
- } else B = /* @__PURE__ */ Y("span", {
879
+ } else L = /* @__PURE__ */ Y("span", {
874
880
  className: "inline-flex items-center gap-1",
875
881
  children: [/* @__PURE__ */ J(E, {
876
- size: f.SM,
882
+ size: p.SM,
877
883
  className: $.doneIcon,
878
884
  "aria-hidden": !0,
879
- stroke: p
885
+ stroke: m
880
886
  }), /* @__PURE__ */ Y("span", {
881
- className: c(I.fontClassName, $.executedLabel),
887
+ className: c(P.fontClassName, $.executedLabel),
882
888
  children: [
883
- m,
889
+ d,
884
890
  " ",
885
891
  e.length,
886
892
  " ",
@@ -889,24 +895,24 @@ var be = {
889
895
  })]
890
896
  });
891
897
  return /* @__PURE__ */ J("div", {
892
- style: L,
893
- className: c("flex w-full flex-col gap-1", r, be.group),
894
- children: /* @__PURE__ */ J(d, {
895
- title: B,
896
- expanded: O,
897
- onToggle: k,
898
+ style: ne,
899
+ className: c("flex w-full flex-col gap-1", r, Se.group),
900
+ children: /* @__PURE__ */ J(f, {
901
+ title: L,
902
+ expanded: T,
903
+ onToggle: D,
898
904
  className: "overflow-visible py-0",
899
- headerClassName: c("justify-start gap-1 rounded-none px-0", $.toggleButton, be.groupToggle),
905
+ headerClassName: c("justify-start gap-1 rounded-none px-0", $.toggleButton, Se.groupToggle),
900
906
  contentClassName: c("-mt-2 px-0", $.groupRegion),
901
- children: O && /* @__PURE__ */ J(mt, {
907
+ children: T && /* @__PURE__ */ J(gt, {
902
908
  stages: e,
903
909
  isStreaming: t,
904
- expansion: A,
910
+ expansion: O,
905
911
  styles: {
906
- colors: F,
912
+ colors: N,
907
913
  typography: i?.typography
908
914
  },
909
- labels: R,
915
+ labels: F,
910
916
  className: "pt-1",
911
917
  onAttachmentClick: a,
912
918
  attachmentDisplayResolvers: l,
@@ -916,4 +922,4 @@ var be = {
916
922
  });
917
923
  };
918
924
  //#endregion
919
- export { be as CONVERSATION_STAGES_CLASS, gt as CollapsedGroup, ht as StagesPanel };
925
+ export { Se as CONVERSATION_STAGES_CLASS, vt as CollapsedGroup, _t as StagesPanel };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-conversation-stages",
3
3
  "description": "Panel for displaying agent processing stages during LLM response streaming",
4
- "version": "1.3.0-dev.358",
4
+ "version": "1.3.0-dev.364",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@tabler/icons-react": "^3.50.0",
21
- "@epam/ai-dial-attachment-input": "1.3.0-dev.358"
21
+ "@epam/ai-dial-attachment-input": "1.3.0-dev.364"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "^19.2.8",
25
- "@epam/ai-dial-chat-shared": "1.3.0-dev.358",
25
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.364",
26
26
  "@epam/ai-dial-ui-kit": "^0.16.0"
27
27
  },
28
28
  "repository": {