@epam/ai-dial-conversation-stages 1.3.0-dev.37 → 1.3.0-dev.372

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