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