@epam/ai-dial-conversation-messages 1.1.0-dev.49 → 1.1.0-dev.491

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,915 +1,338 @@
1
- import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, Highlight as r, MDMessageViewer as i, MIME_TYPE_EXT_MAP as a, MessageRating as o, MessageRole as s, RequestStatus as c, ResponseFormat as l, buildCssVars as u, mergeClasses as d, useCollapsedText as f } from "@epam/ai-dial-chat-shared";
2
- import { DIAL_ICON_SIZE as p, DialGhostIconButton as m, DialInput as h, DialLinkButton as g, DialPopup as _, DialPrimaryButton as v, DialRadioGroup as y, DialRoundedButton as b, DialSkeleton as x, DialSkeletonVariant as S, DialSlider as C, DialTag as w, DialTooltip as T, ElementSize as E, InfoMessageNotification as D, PopupSize as O, RadioGroupOrientation as k } from "@epam/ai-dial-ui-kit";
3
- import { IconCheck as A, IconChevronDown as j, IconChevronUp as M, IconClipboard as N, IconCopy as P, IconDownload as F, IconExternalLink as I, IconFile as L, IconFileTypeBmp as R, IconFileTypeCss as z, IconFileTypeCsv as B, IconFileTypeDoc as V, IconFileTypeDocx as ee, IconFileTypeHtml as te, IconFileTypeJpg as ne, IconFileTypeJs as re, IconFileTypeJsx as ie, IconFileTypePdf as ae, IconFileTypePhp as oe, IconFileTypePng as se, IconFileTypePpt as ce, IconFileTypeRs as le, IconFileTypeSql as ue, IconFileTypeSvg as de, IconFileTypeTs as fe, IconFileTypeTsx as pe, IconFileTypeTxt as me, IconFileTypeVue as he, IconFileTypeXls as ge, IconFileTypeXml as _e, IconFileTypeZip as ve, IconMarkdown as ye, IconMusic as be, IconPaperclip as xe, IconPencilMinus as Se, IconPhoto as H, IconRefresh as Ce, IconReload as we, IconTerminal2 as Te, IconThumbDown as Ee, IconThumbUp as De, IconTrashX as Oe, IconVideo as ke, IconX as Ae } from "@tabler/icons-react";
4
- import "react-dom";
5
- import { memo as je, useCallback as U, useEffect as Me, useId as Ne, useMemo as W, useRef as Pe, useState as G } from "react";
6
- import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
7
- //#region ../attachment-input/dist/index.js
8
- var Fe = "flex size-[84px] items-center justify-center rounded-xl border", Y = /* @__PURE__ */ function(e) {
9
- return e.None = "none", e.AllVisible = "all-visible", e.Collapsed = "collapsed", e;
10
- }({}), Ie = (e) => {
11
- let t = e.lastIndexOf(".");
12
- return t > 0 ? e.slice(0, t) : e;
13
- }, Le = (e) => {
14
- if (!e) return L;
15
- if (e.startsWith("image/")) switch (e) {
16
- case "image/jpeg":
17
- case "image/jpg": return ne;
18
- case "image/png": return se;
19
- case "image/svg+xml": return de;
20
- case "image/bmp": return R;
21
- default: return H;
22
- }
23
- if (e.startsWith("video/")) return ke;
24
- if (e.startsWith("audio/")) return be;
25
- switch (e) {
26
- case "application/pdf": return ae;
27
- case "application/msword":
28
- case "application/vnd.ms-word": return V;
29
- case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return ee;
30
- case "application/vnd.ms-powerpoint": return ce;
31
- case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return ce;
32
- case "application/vnd.ms-excel": return ge;
33
- case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return ge;
34
- case "application/zip":
35
- case "application/x-zip-compressed":
36
- case "application/x-rar-compressed":
37
- case "application/x-7z-compressed":
38
- case "application/gzip":
39
- case "application/x-tar": return ve;
40
- case "text/csv": return B;
41
- case "text/plain": return me;
42
- case "text/html":
43
- case "application/xhtml+xml": return te;
44
- case "text/xml":
45
- case "application/xml": return _e;
46
- case "application/sql":
47
- case "text/x-sql": return ue;
48
- case "text/javascript":
49
- case "application/javascript": return re;
50
- case "text/jsx": return ie;
51
- case "application/typescript":
52
- case "text/typescript": return fe;
53
- case "text/tsx": return pe;
54
- case "text/css": return z;
55
- case "text/x-php":
56
- case "application/x-php": return oe;
57
- case "text/x-rustsrc":
58
- case "application/x-rust": return le;
59
- case "text/x-vue": return he;
60
- default: return L;
61
- }
62
- }, Re = (e) => {
63
- let { type: n, contentType: r } = e;
64
- return n === t.Prompt ? Te : n === t.Pasted ? N : n === t.Image ? H : Le(r ?? "");
65
- }, ze = (e) => {
66
- let t = e.toLowerCase().split(";")[0].trim(), n = a[t];
67
- if (n) return n;
68
- let r = t.split("/")[1];
69
- if (r && !r.startsWith("vnd.") && !r.includes("+")) return r;
70
- }, Be = (e, n) => {
71
- let { type: r, name: i, contentType: a } = e;
72
- if (r === t.Prompt) return n.promptLabel ?? "Prompt";
73
- if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
74
- if (r === t.Image) return n.imageLabel ?? "Image";
75
- if (a) {
76
- let e = ze(a);
77
- if (e) return `.${e}`;
78
- }
79
- let o = i.lastIndexOf(".");
80
- return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
81
- }, Ve = (e, n = {}) => {
82
- let { type: r, status: i, previewUrl: a, url: o } = e, s = i === c.Loading, l = i === c.Error, u = r === t.Image && !!(a ?? o) && !l, d = r === t.Audio && !l, f = r === t.Link && !l;
83
- return {
84
- isLoading: s,
85
- isError: l,
86
- isImage: u,
87
- isAudio: d,
88
- isLink: f,
89
- BottomIcon: f ? null : Re(e),
90
- typeLabel: f ? null : Be(e, n)
1
+ import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, buildCssVars as o, mergeClasses as s, useCollapsedText as c } from "@epam/ai-dial-chat-shared";
2
+ import { AttachmentGroup as l } from "@epam/ai-dial-attachment-input";
3
+ import { DIAL_ICON_SIZE as u, DIAL_KIT_ICON_STROKE as d, ElementSize as f, InfoMessageNotification as p, LinkButton as m, NeutralButton as h, ToggleIconButton as g } from "@epam/ai-dial-ui-kit";
4
+ import { useCallback as _, useEffect as v, useId as y, useRef as b, useState as x } from "react";
5
+ import { IconChevronDown as S, IconChevronUp as C, IconMarkdown as w, IconPencilMinus as T, IconRefresh as E, IconThumbDown as D, IconThumbDownFilled as O, IconThumbUp as k, IconThumbUpFilled as A, IconTrashX as j } from "@tabler/icons-react";
6
+ import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
7
+ //#region src/hooks/useInlineStartIndent/useInlineStartIndent.ts
8
+ var F = 4, I = (e) => {
9
+ let t = b(null), [n, r] = x(0);
10
+ return v(() => {
11
+ if (!e) return;
12
+ let n = t.current;
13
+ if (n == null) return;
14
+ let i = new ResizeObserver((e) => {
15
+ let t = e[0];
16
+ t != null && r(t.contentRect.width);
17
+ });
18
+ return i.observe(n), () => i.disconnect();
19
+ }, [e]), {
20
+ slotRef: t,
21
+ firstLineIndent: e ? `calc(${n}px + ${F}px)` : void 0
91
22
  };
92
- }, He = (e, t) => e <= 0 ? {
93
- layout: Y.None,
94
- visibleCount: 0,
95
- hiddenCount: 0
96
- } : e < 5 || t ? {
97
- layout: Y.AllVisible,
98
- visibleCount: e,
99
- hiddenCount: 0
100
- } : {
101
- layout: Y.Collapsed,
102
- visibleCount: 4,
103
- hiddenCount: e - 4
104
- }, X = {
105
- tile: "_tile_3x6ks_1",
106
- tileLight: "_tileLight_3x6ks_12",
107
- tileError: "_tileError_3x6ks_16",
108
- nameText: "_nameText_3x6ks_23",
109
- typeText: "_typeText_3x6ks_24",
110
- retryIcon: "_retryIcon_3x6ks_36",
111
- hoverIcon: "_hoverIcon_3x6ks_40",
112
- track: "_track_3x6ks_48",
113
- indeterminateFill: "_indeterminateFill_3x6ks_52",
114
- "attachment-tile-indeterminate": "_attachment-tile-indeterminate_3x6ks_1"
115
- }, Z = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o }) => /* @__PURE__ */ q(m, {
116
- icon: a,
117
- size: E.Small,
118
- className: d("absolute end-1 top-1 h-6 w-6 rounded-lg", o ?? X.hoverIcon),
119
- "aria-label": e,
120
- "aria-describedby": t ? n : void 0,
121
- onClick: (e) => {
122
- e.stopPropagation(), r(i);
123
- }
124
- }), Ue = ({ ...e }) => /* @__PURE__ */ q(Z, {
125
- icon: /* @__PURE__ */ q(we, {
126
- size: p.SM,
127
- "aria-hidden": !0
128
- }),
129
- className: X.retryIcon,
130
- ...e
131
- }), We = ({ ...e }) => /* @__PURE__ */ q(Z, {
132
- icon: /* @__PURE__ */ q(F, {
133
- size: p.SM,
134
- "aria-hidden": !0
135
- }),
136
- ...e
137
- }), Ge = ({ ...e }) => /* @__PURE__ */ q(Z, {
138
- icon: /* @__PURE__ */ q(I, {
139
- size: p.SM,
140
- "aria-hidden": !0
141
- }),
142
- ...e
143
- }), Ke = ({ ...e }) => /* @__PURE__ */ q(Z, {
144
- icon: /* @__PURE__ */ q(Ae, {
145
- size: p.SM,
146
- "aria-hidden": !0
147
- }),
148
- className: X.hoverIcon,
149
- ...e
150
- }), qe = ({ attachment: e, searchQuery: t = "", onClick: n, onDownload: i, onRemove: a, labels: o, styles: s, cssVars: c }) => {
151
- let { clickLabel: l = "Open attachment", downloadLabel: u = "Download attachment", removeLabel: f = "Remove attachment" } = o ?? {}, { typography: p, className: m } = s ?? {}, h = () => {
152
- n?.(e.id);
153
- };
154
- return /* @__PURE__ */ J("div", {
155
- style: c,
156
- ...n == null ? {} : {
157
- role: "button",
158
- tabIndex: 0,
159
- "aria-label": l,
160
- onClick: h,
161
- onKeyDown: (e) => {
162
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
163
- }
164
- },
165
- className: d("group relative flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 rounded-xl border p-3", n && "cursor-pointer", (i || a) && "pe-8", m),
166
- children: [
167
- /* @__PURE__ */ q("span", {
168
- title: e.name,
169
- className: d(p?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.nameText),
170
- children: t ? /* @__PURE__ */ q(r, {
171
- text: e.name,
172
- query: t,
173
- maxLines: 1
174
- }) : e.name
175
- }),
176
- e.playUrl && /* @__PURE__ */ q("audio", {
177
- controls: !0,
178
- src: e.playUrl,
179
- "aria-label": e.name,
180
- className: "w-full",
181
- preload: "metadata",
182
- onClick: (e) => e.stopPropagation()
183
- }),
184
- i && /* @__PURE__ */ q(We, {
185
- ariaLabel: u,
186
- onClick: i,
187
- id: e.id
188
- }),
189
- a && /* @__PURE__ */ q(Ke, {
190
- ariaLabel: f,
191
- onClick: a,
192
- id: e.id
193
- })
194
- ]
195
- });
196
- }, Je = {
197
- [e.Network]: "Upload failed · network error",
198
- [e.UnsupportedType]: "Upload failed · unsupported file type"
199
- }, Ye = ({ attachment: t, onClick: n, onRetry: r, labels: i, styles: a, onDownload: o, isPasted: s, isLink: l, cssVars: u, onExpand: f, isExpandable: p, onRemove: m }) => {
200
- let { clickLabel: h = "Download attachment", retryLabel: g = "Retry upload", sizeLabel: _, uploadingLabel: v = "Uploading", errorReasonLabels: y, genericErrorLabel: b = "Upload failed" } = i ?? {}, { typography: { nameClassName: x = "dial-caption-text", metaClassName: S = "dial-caption-text" } = {}, className: C } = a ?? {}, { id: w, name: T, status: E, errorReason: D } = t, O = E === c.Loading, k = E === c.Error, A = Ne(), j = k ? D && (y?.[D] ?? Je[D]) || b : "", { BottomIcon: M, typeLabel: N } = Ve(t), P = !k && !O && o && !l, F = k && !!r && D !== e.UnsupportedType, I = P || F ? "pe-5" : void 0, L = (e) => {
201
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n?.(t.id));
202
- }, R = W(() => s ? T : Ie(T), [s, T]), z = U(() => {
203
- window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
204
- }, [t]), B = d(Fe, "group relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !k && X.tileLight, k && X.tileError), V = /* @__PURE__ */ q("div", {
205
- title: R,
206
- className: d(x, "line-clamp-2 min-w-0 break-all", X.nameText, !k && I),
207
- children: R
208
- }), ee = M && /* @__PURE__ */ J("div", {
209
- className: d("flex w-full items-center gap-1", k && I),
210
- children: [/* @__PURE__ */ q(M, {
211
- size: 16,
212
- className: X.typeText,
213
- "aria-hidden": !0
214
- }), /* @__PURE__ */ q("span", {
215
- className: d(S, "min-w-0 flex-1 truncate", X.typeText),
216
- children: _ ? `${N} · ${_}` : N
217
- })]
218
- }), te = () => {
219
- p && f ? f(w) : n && n(w);
220
- }, ne = /* @__PURE__ */ J(K, { children: [
221
- k ? /* @__PURE__ */ J(K, { children: [ee, V] }) : /* @__PURE__ */ J(K, { children: [V, ee] }),
222
- O && /* @__PURE__ */ q("div", {
223
- role: "progressbar",
224
- "aria-label": v,
225
- className: d("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", X.track),
226
- children: /* @__PURE__ */ q("div", { className: d("h-full w-1/3 rounded-full", X.indeterminateFill) })
227
- }),
228
- P && /* @__PURE__ */ q(We, {
229
- ariaLabel: h,
230
- errorTitle: j,
231
- errorDescId: A,
232
- onClick: o,
233
- id: w
234
- }),
235
- F && /* @__PURE__ */ q(Ue, {
236
- ariaLabel: g,
237
- errorTitle: j,
238
- errorDescId: A,
239
- onClick: r,
240
- id: w
241
- }),
242
- l && /* @__PURE__ */ q(Ge, {
243
- ariaLabel: g,
244
- errorTitle: j,
245
- errorDescId: A,
246
- onClick: z
247
- }),
248
- m && /* @__PURE__ */ q(Ke, {
249
- ariaLabel: g,
250
- errorTitle: j,
251
- errorDescId: A,
252
- onClick: m,
253
- id: w
254
- }),
255
- k && /* @__PURE__ */ q("span", {
256
- id: A,
257
- role: "status",
258
- "aria-live": "polite",
259
- className: "sr-only",
260
- children: j
261
- })
262
- ] });
263
- return /* @__PURE__ */ q("div", {
264
- style: u,
265
- className: d("inline-flex", C),
266
- children: /* @__PURE__ */ q("div", {
267
- role: "button",
268
- tabIndex: 0,
269
- "aria-label": h,
270
- onClick: te,
271
- onKeyDown: L,
272
- style: u,
273
- className: d(B, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
274
- children: ne
275
- })
276
- });
277
- }, Xe = /* @__PURE__ */ function(e) {
278
- return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
279
- }({}), Ze = ({ enabled: e, src: t }) => {
280
- let n = Pe(null), [r, i] = G("idle");
281
- return Me(() => {
282
- i(e && t ? "loading" : "idle");
283
- }, [e, t]), Me(() => {
284
- let r = n.current;
285
- if (!r || !e || !t) return;
286
- let a = () => i("loaded"), o = () => i("error");
287
- return r.addEventListener("load", a), r.addEventListener("error", o), r.complete && i(r.naturalWidth > 0 ? "loaded" : "error"), () => {
288
- r.removeEventListener("load", a), r.removeEventListener("error", o);
289
- };
290
- }, [e, t]), {
291
- imageRef: n,
292
- imageLoadStatus: r
293
- };
294
- }, Qe = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: c }) => {
295
- let { clickLabel: l = "Open attachment", expandLabel: u = "Expand pasted text" } = i ?? {}, { typography: f, className: m } = c ?? {}, { id: h, name: g } = e, _ = e.previewUrl ?? e.url, v = e.type === t.Pasted && n !== void 0, { isLoading: y, isError: b, isImage: C } = W(() => Ve(e), [e]), w = r !== void 0 && !v && !y && !b, { imageRef: T, imageLoadStatus: E } = Ze({
296
- enabled: C,
297
- src: _
298
- }), D = () => {
299
- v && n ? n(h) : w && r && r(h);
300
- };
301
- return /* @__PURE__ */ q("div", {
302
- className: d(Fe, w && "cursor-pointer", X.tile, m),
303
- onClick: D,
304
- onKeyDown: (e) => {
305
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), D());
306
- },
307
- tabIndex: 0,
308
- role: "button",
309
- style: o,
310
- "aria-label": w ? l : v ? u : void 0,
311
- children: /* @__PURE__ */ J("div", {
312
- className: "relative h-full w-full overflow-hidden",
313
- children: [
314
- a && /* @__PURE__ */ q(Ke, {
315
- onClick: a,
316
- id: h
317
- }),
318
- s && /* @__PURE__ */ q(We, {
319
- onClick: s,
320
- id: h
321
- }),
322
- E !== Xe.Loaded && /* @__PURE__ */ q(x, {
323
- variant: S.Rectangular,
324
- width: "100%",
325
- height: "100%",
326
- active: E === Xe.Loading,
327
- overlay: /* @__PURE__ */ q(H, {
328
- size: p.LG,
329
- className: f?.placeholderIconClassName ?? "text-secondary",
330
- "aria-hidden": !0
331
- }),
332
- className: "absolute inset-0 rounded-xl"
333
- }),
334
- /* @__PURE__ */ q("img", {
335
- ref: T,
336
- src: _,
337
- alt: g,
338
- loading: "lazy",
339
- decoding: "async",
340
- className: d("h-full w-full rounded-xl object-cover transition-opacity duration-200", E === Xe.Loaded ? "opacity-100" : "opacity-0")
341
- })
342
- ]
343
- })
344
- });
345
- }, $e = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: s, labels: c, styles: l }) => {
346
- let { colors: d } = l ?? {}, f = e.type === t.Pasted, p = f && a !== void 0, m = u({
347
- "--ci-tile-bg": d?.background,
348
- "--ci-tile-border": d?.border,
349
- "--ci-tile-border-hover": d?.borderHover,
350
- "--ci-tile-focus-outline": d?.focusOutline,
351
- "--ci-tile-bg-error": d?.backgroundError,
352
- "--ci-tile-border-error": d?.borderError,
353
- "--ci-tile-error-text": d?.errorText,
354
- "--ci-tile-name-text": d?.nameText,
355
- "--ci-tile-type-text": d?.typeText,
356
- "--ci-tile-hover-icon-bg": d?.hoverIconBackground,
357
- "--ci-tile-hover-icon-color": d?.hoverIconColor,
358
- "--ci-tile-track-bg": d?.trackBackground,
359
- "--ci-tile-fill-bg": d?.fillBackground
360
- }), { isImage: h, isAudio: g, isLink: _ } = W(() => Ve(e), [e]);
361
- return g ? /* @__PURE__ */ q(qe, {
362
- attachment: e,
363
- labels: c,
364
- onClick: o,
365
- onDownload: s,
366
- onRemove: r,
367
- searchQuery: n,
368
- styles: l,
369
- cssVars: m
370
- }) : h ? /* @__PURE__ */ q(Qe, {
371
- attachment: e,
372
- labels: c,
373
- onClick: o,
374
- onExpand: a,
375
- styles: l,
376
- onRemove: r,
377
- cssVars: m,
378
- onDownload: s
379
- }) : /* @__PURE__ */ q(Ye, {
380
- attachment: e,
381
- onClick: o,
382
- onRetry: i,
383
- onRemove: r,
384
- onDownload: s,
385
- isLink: _,
386
- isPasted: f,
387
- styles: l,
388
- labels: c,
389
- onExpand: a,
390
- cssVars: m,
391
- isExpandable: p
392
- });
393
- }, et = { tile: "_tile_nzsrz_1" }, tt = ({ count: e, onClick: t, labels: n, children: r, styles: i }) => {
394
- let { ariaLabel: a } = n ?? {}, { typography: { fontClassName: o = "dial-small-semi-text" } = {}, className: s, colors: c } = i ?? {}, l = u({
395
- "--ci-more-tile-bg": c?.background,
396
- "--ci-more-tile-border": c?.border,
397
- "--ci-more-tile-color": c?.color,
398
- "--ci-more-tile-bg-hover": c?.backgroundHover,
399
- "--ci-more-tile-color-hover": c?.colorHover,
400
- "--ci-more-tile-border-hover": c?.borderHover,
401
- "--ci-more-tile-focus-outline": c?.focusOutline
402
- });
403
- return /* @__PURE__ */ q("button", {
404
- type: "button",
405
- onClick: t,
406
- "aria-label": a ?? `Show ${e} more attachments`,
407
- style: l,
408
- className: d(Fe, o, et.tile, s),
409
- children: r ?? /* @__PURE__ */ q("bdi", {
410
- dir: "ltr",
411
- children: `+${e}`
412
- })
413
- });
414
- }, Q = {
415
- container: "_container_7fktb_1",
416
- headerIcon: "_headerIcon_7fktb_6",
417
- headerLabel: "_headerLabel_7fktb_7",
418
- downloadAllButton: "_downloadAllButton_7fktb_8",
419
- imageTile: "_imageTile_7fktb_12"
420
- }, nt = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, rt = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: i, labels: a, styles: o }) => {
421
- let { ariaLabel: s = "Attachments", clickLabel: l = "Download attachment", retryLabel: f = "Retry upload", showLessLabel: h = "Show less", downloadAllLabel: g = "Download all", openInNewTabLabel: _, getHeaderLabel: v = (e) => nt(e, "attachment"), promptLabel: y, pastedLabel: b, imageLabel: x } = a ?? {}, { typography: { headerLabelClassName: S = "dial-tiny-semi-text" } = {}, colors: C, className: w } = o ?? {}, T = u({
422
- "--ci-group-bg": C?.background,
423
- "--ci-group-border": C?.border,
424
- "--ci-group-text": C?.text
425
- }), [E, D] = G(!1), O = W(() => He(e.length, E), [e.length, E]);
426
- if (e.length === 0) return null;
427
- let k = e.some((e) => e.type === t.Image), A = e.some((e) => e.type !== t.Image), j = k && A, N = e.length >= 5, P = j ? xe : k ? H : L, I = v(e.length), R = e.slice(0, O.visibleCount), z = () => {
428
- let t = e.filter((e) => e.status === c.Idle);
429
- r ? r(t) : t.forEach((e) => n?.(e.id));
430
- }, B = (t) => {
431
- let n = e.find((e) => e.id === t);
432
- n && r?.([n]);
433
- };
434
- return /* @__PURE__ */ J("div", {
435
- role: "group",
436
- "aria-label": s,
437
- style: T,
438
- className: d("rounded-2xl border p-3", N ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", Q.container, w),
439
- children: [/* @__PURE__ */ J("div", {
440
- className: "mb-3 flex min-h-6 items-center gap-2",
441
- children: [
442
- /* @__PURE__ */ q(P, {
443
- size: p.SM,
444
- className: d("shrink-0", Q.headerIcon),
445
- "aria-hidden": !0
446
- }),
447
- /* @__PURE__ */ q("span", {
448
- className: d(S, Q.headerLabel),
449
- children: I
450
- }),
451
- e.length >= 2 && (r || n) && /* @__PURE__ */ q(m, {
452
- icon: /* @__PURE__ */ q(F, {
453
- size: p.SM,
454
- "aria-hidden": !0
455
- }),
456
- className: d("ms-auto h-6 w-6 rounded-lg", Q.downloadAllButton),
457
- "aria-label": g,
458
- onClick: z
459
- })
460
- ]
461
- }), /* @__PURE__ */ J("div", {
462
- role: "list",
463
- "aria-label": I,
464
- className: d("gap-3", N ? "grid grid-cols-[repeat(5,83px)] overflow-x-auto" : "flex flex-wrap"),
465
- children: [
466
- R.map((e) => /* @__PURE__ */ q("div", {
467
- role: "listitem",
468
- children: /* @__PURE__ */ q($e, {
469
- attachment: e,
470
- onClick: n,
471
- onDownload: B,
472
- onRetry: i,
473
- labels: {
474
- clickLabel: l,
475
- retryLabel: f,
476
- promptLabel: y,
477
- pastedLabel: b,
478
- imageLabel: x,
479
- openInNewTabLabel: _
480
- }
481
- })
482
- }, e.id)),
483
- O.layout === Y.Collapsed && /* @__PURE__ */ q("div", {
484
- role: "listitem",
485
- children: /* @__PURE__ */ q(tt, {
486
- count: O.hiddenCount,
487
- onClick: () => D(!0)
488
- })
489
- }),
490
- N && E && /* @__PURE__ */ q("div", {
491
- role: "listitem",
492
- children: /* @__PURE__ */ q(tt, {
493
- count: 0,
494
- onClick: () => D(!1),
495
- labels: { ariaLabel: h },
496
- children: /* @__PURE__ */ q(M, {
497
- size: p.MD,
498
- "aria-hidden": !0
499
- })
500
- })
501
- })
502
- ]
503
- })]
504
- });
505
- }, it = {
506
- tabContainer: "_tabContainer_rzv03_1",
507
- tabActive: "_tabActive_rzv03_13"
508
- };
509
- je(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
510
- let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
511
- return /* @__PURE__ */ q("div", {
512
- className: "flex flex-nowrap gap-1",
513
- role: "tablist",
514
- children: e.map((e) => {
515
- let r = t === e.id;
516
- return /* @__PURE__ */ q("div", {
517
- role: "tab",
518
- "aria-selected": r,
519
- className: "contents",
520
- children: /* @__PURE__ */ q(w, {
521
- label: e.label,
522
- selected: r,
523
- onClick: () => n(e.id),
524
- className: d("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, it.tabContainer, r && it.tabActive)
525
- })
526
- }, e.id);
527
- })
528
- });
529
- });
530
- var at = (e) => /* @__PURE__ */ q(v, { ...e }), ot = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
531
- let [s, c] = G(t), [l, u] = G(n), [d, f] = G(r), p = Pe(o);
532
- Me(() => {
533
- o && !p.current && (c(t), u(n), f(r)), p.current = o;
534
- }, [
535
- o,
536
- t,
537
- n,
538
- r
539
- ]);
540
- let m = !e.responseFormat || s != null;
541
- return {
542
- responseFormat: s,
543
- systemPrompt: l,
544
- temperature: d,
545
- canSubmit: m,
546
- setResponseFormat: c,
547
- setSystemPrompt: u,
548
- setTemperature: f,
549
- handleSubmit: U(() => {
550
- if (!m) return;
551
- let t = {};
552
- e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
553
- }, [
554
- m,
555
- e,
556
- s,
557
- l,
558
- d,
559
- i,
560
- a
561
- ])
562
- };
563
- }, st = "!dial-small-semi-text !text-primary gap-1", ct = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: i, onSystemPromptChange: a, onTemperatureChange: o, responseFormatLabel: s = "Response format", responseFormatHint: c = "Applies to new and existing messages", responseFormatMarkdownLabel: u = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: g = [
564
- "Precise",
565
- "Neutral",
566
- "Creative"
567
- ], temperatureHint: _ }) => /* @__PURE__ */ J("div", {
568
- className: "flex flex-col gap-4 px-6 py-3",
569
- children: [
570
- e.responseFormat && /* @__PURE__ */ q(y, {
571
- fieldTitle: s,
572
- labelClassName: st,
573
- elementId: "response-format",
574
- orientation: k.Column,
575
- activeRadioButton: t ?? l.Markdown,
576
- labelDescription: c,
577
- radioButtons: [{
578
- id: l.Markdown,
579
- name: u
580
- }, {
581
- id: l.PlainText,
582
- name: d
583
- }],
584
- onChange: (e) => i(e)
585
- }),
586
- e.systemPrompt && /* @__PURE__ */ q(h, {
587
- value: n,
588
- placeholder: p,
589
- labelProps: {
590
- className: st,
591
- label: f
592
- },
593
- onChange: (e) => a(e ?? "")
594
- }),
595
- e.temperature && /* @__PURE__ */ q(C, {
596
- labelProps: {
597
- label: m,
598
- className: st,
599
- caption: _
600
- },
601
- value: r,
602
- min: 0,
603
- max: 1,
604
- step: .1,
605
- labels: g,
606
- onChange: o
607
- })
608
- ]
609
- });
610
- je(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: h, saveLabel: g = "Apply changes", saveDisabledTooltip: v }) => {
611
- let { responseFormat: y, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: E, handleSubmit: D } = ot({
612
- features: e,
613
- initialResponseFormat: t,
614
- initialSystemPrompt: n,
615
- initialTemperature: r,
616
- onSave: i,
617
- onClose: a
618
- });
619
- return /* @__PURE__ */ q(_, {
620
- open: !0,
621
- header: o,
622
- size: O.Sm,
623
- onClose: a,
624
- className: "!bg-layer-2",
625
- footer: /* @__PURE__ */ q("div", {
626
- className: "flex justify-end px-6 py-4",
627
- children: /* @__PURE__ */ q(T, {
628
- tooltip: v,
629
- hideTooltip: S || !v,
630
- children: /* @__PURE__ */ q(at, {
631
- label: g,
632
- onClick: D,
633
- disabled: !S
634
- })
635
- })
636
- }),
637
- children: /* @__PURE__ */ q(ct, {
638
- features: e,
639
- responseFormat: y,
640
- systemPrompt: b,
641
- temperature: x,
642
- onResponseFormatChange: C,
643
- onSystemPromptChange: w,
644
- onTemperatureChange: E,
645
- responseFormatLabel: s,
646
- responseFormatHint: c,
647
- responseFormatMarkdownLabel: l,
648
- responseFormatPlainTextLabel: u,
649
- systemPromptLabel: d,
650
- systemPromptTooltip: f,
651
- temperatureLabel: p,
652
- temperatureLabels: m,
653
- temperatureHint: h
654
- })
655
- });
656
- });
657
- //#endregion
658
- //#region src/components/MessageActions/MessageActions.tsx
659
- var lt = 2e3, ut = ({ role: e = s.User, onEdit: t, onEditHover: n, onDelete: r, onRegenerate: i, onCopy: a, onCopyMarkdown: c, onLike: l, onDislike: u, activeRating: f, isAlwaysVisible: h, className: g, labels: _ }) => {
660
- let { tooltips: v, ariaLabels: y } = _ ?? {}, [b, x] = G(null), [S, C] = G(""), w = U(() => {
661
- a?.(), x("copy"), C(y?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => x(null), lt);
662
- }, [a, y?.copiedStatus]), T = U(() => {
663
- c?.(), x("markdown"), C(y?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => x(null), lt);
664
- }, [c, y?.copiedMarkdownStatus]);
665
- return /* @__PURE__ */ J("div", {
23
+ }, L = { activeRating: "_activeRating_ygoee_1" }, R = 2e3, z = ({ role: e = a.User, onEdit: n, onEditHover: r, onDelete: c, onRegenerate: l, onCopy: p, onCopyMarkdown: m, onLike: h, onDislike: v, activeRating: y, isAlwaysVisible: b, isDisabled: S = !1, className: C, labels: F, colors: I }) => {
24
+ let { tooltips: z, ariaLabels: B } = F ?? {}, [V, H] = x(null), [U, W] = x(""), G = n != null || c != null || l != null || p != null || m != null || h != null || v != null, K = o({ "--ma-active-rating-text": I?.activeRatingText }), q = _(() => {
25
+ p?.(), H("copy"), W(B?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => H(null), R);
26
+ }, [p, B?.copiedStatus]), J = _(() => {
27
+ m?.(), H("markdown"), W(B?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => H(null), R);
28
+ }, [m, B?.copiedMarkdownStatus]);
29
+ return G ? /* @__PURE__ */ P("div", {
666
30
  role: "toolbar",
667
- "aria-label": y?.actionsGroup ?? "Message actions",
668
- className: d("flex gap-1", !h && "opacity-0 group-hover:opacity-100", g),
669
- children: [/* @__PURE__ */ q("span", {
31
+ "aria-label": B?.actionsGroup ?? "Message actions",
32
+ style: K,
33
+ className: s("flex gap-1", !b && "opacity-0 group-hover:opacity-100", C),
34
+ children: [/* @__PURE__ */ N("span", {
670
35
  role: "status",
671
36
  "aria-live": "polite",
672
37
  className: "sr-only",
673
- children: S
674
- }), e === s.User ? /* @__PURE__ */ J(K, { children: [t && /* @__PURE__ */ q(m, {
675
- icon: /* @__PURE__ */ q(Se, {
676
- size: p.SM,
677
- "aria-hidden": !0
38
+ children: U
39
+ }), e === a.User ? /* @__PURE__ */ P(M, { children: [n && /* @__PURE__ */ N(g, {
40
+ icon: /* @__PURE__ */ N(T, {
41
+ size: u.SM,
42
+ "aria-hidden": !0,
43
+ stroke: d
678
44
  }),
679
- size: E.Small,
680
- "aria-label": y?.editMessage ?? "Edit message",
681
- tooltipProps: { tooltip: v?.edit ?? "Edit" },
682
- onClick: t,
683
- onMouseEnter: n,
684
- onFocus: n
685
- }), r && /* @__PURE__ */ q(m, {
686
- icon: /* @__PURE__ */ q(Oe, {
687
- size: p.SM,
688
- "aria-hidden": !0
45
+ size: f.Small,
46
+ "aria-label": B?.editMessage ?? "Edit message",
47
+ tooltipProps: { tooltip: z?.edit ?? "Edit" },
48
+ onClick: n,
49
+ onMouseEnter: r,
50
+ onFocus: r,
51
+ disabled: S
52
+ }), c && /* @__PURE__ */ N(g, {
53
+ icon: /* @__PURE__ */ N(j, {
54
+ size: u.SM,
55
+ "aria-hidden": !0,
56
+ stroke: d
689
57
  }),
690
- size: E.Small,
691
- "aria-label": y?.deleteMessage ?? "Delete message",
692
- tooltipProps: { tooltip: v?.delete ?? "Delete" },
693
- onClick: r
694
- })] }) : /* @__PURE__ */ J(K, { children: [
695
- i && /* @__PURE__ */ q(m, {
696
- icon: /* @__PURE__ */ q(Ce, {
697
- size: p.SM,
698
- "aria-hidden": !0
58
+ size: f.Small,
59
+ "aria-label": B?.deleteMessage ?? "Delete message",
60
+ tooltipProps: { tooltip: z?.delete ?? "Delete" },
61
+ onClick: c,
62
+ disabled: S
63
+ })] }) : /* @__PURE__ */ P(M, { children: [
64
+ l && /* @__PURE__ */ N(g, {
65
+ icon: /* @__PURE__ */ N(E, {
66
+ size: u.SM,
67
+ "aria-hidden": !0,
68
+ stroke: d
699
69
  }),
700
- size: E.Small,
701
- "aria-label": y?.regenerateResponse ?? "Regenerate response",
702
- tooltipProps: { tooltip: v?.regenerate ?? "Regenerate" },
703
- onClick: i
70
+ size: f.Small,
71
+ "aria-label": B?.regenerateResponse ?? "Regenerate response",
72
+ tooltipProps: { tooltip: z?.regenerate ?? "Regenerate" },
73
+ onClick: l,
74
+ disabled: S
704
75
  }),
705
- a && /* @__PURE__ */ q(m, {
706
- icon: q(b === "copy" ? A : P, {
707
- size: p.SM,
708
- "aria-hidden": !0
709
- }),
710
- size: E.Small,
711
- "aria-label": y?.copyResponse ?? "Copy response",
712
- tooltipProps: { tooltip: b === "copy" ? v?.copied ?? "Copied!" : v?.copy ?? "Copy" },
713
- onClick: w
76
+ p && /* @__PURE__ */ N(t, {
77
+ iconSize: u.SM,
78
+ onClick: q,
79
+ size: f.Small,
80
+ isCopied: V === "copy",
81
+ copyLabel: z?.copy ?? "Copy",
82
+ copiedLabel: z?.copied ?? "Copied!",
83
+ ariaLabel: B?.copyResponse ?? "Copy response",
84
+ isDisabled: S
714
85
  }),
715
- c && /* @__PURE__ */ q(m, {
716
- icon: q(b === "markdown" ? A : ye, {
717
- size: p.SM,
718
- "aria-hidden": !0
86
+ m && /* @__PURE__ */ N(t, {
87
+ iconSize: u.SM,
88
+ onClick: J,
89
+ size: f.Small,
90
+ isCopied: V === "markdown",
91
+ iconCopy: /* @__PURE__ */ N(w, {
92
+ size: u.SM,
93
+ "aria-hidden": !0,
94
+ stroke: d
719
95
  }),
720
- size: E.Small,
721
- "aria-label": y?.copyAsMarkdown ?? "Copy as markdown",
722
- tooltipProps: { tooltip: b === "markdown" ? v?.copiedMarkdown ?? "Copied!" : v?.copyMarkdown ?? "Copy as Markdown" },
723
- onClick: T
96
+ copyLabel: z?.copyMarkdown ?? "Copy as Markdown",
97
+ copiedLabel: z?.copiedMarkdown ?? "Copied!",
98
+ ariaLabel: B?.copyAsMarkdown ?? "Copy as markdown",
99
+ isDisabled: S
724
100
  }),
725
- l && /* @__PURE__ */ q(m, {
726
- icon: /* @__PURE__ */ q(De, {
727
- size: p.SM,
101
+ h && /* @__PURE__ */ N(g, {
102
+ icon: y === i.Like ? /* @__PURE__ */ N(A, {
103
+ className: L.activeRating,
104
+ size: u.SM,
728
105
  "aria-hidden": !0
106
+ }) : /* @__PURE__ */ N(k, {
107
+ size: u.SM,
108
+ "aria-hidden": !0,
109
+ stroke: d
729
110
  }),
730
- size: E.Small,
731
- "aria-label": y?.likeResponse ?? "Like response",
732
- "aria-pressed": f === o.Like,
733
- className: f === o.Like ? "!text-accent-primary" : void 0,
734
- tooltipProps: { tooltip: v?.like ?? "Like" },
735
- onClick: l
111
+ size: f.Small,
112
+ "aria-label": B?.likeResponse ?? "Like response",
113
+ "aria-pressed": y === i.Like,
114
+ tooltipProps: { tooltip: z?.like ?? "Like" },
115
+ onClick: h,
116
+ disabled: S
736
117
  }),
737
- u && /* @__PURE__ */ q(m, {
738
- icon: /* @__PURE__ */ q(Ee, {
739
- size: p.SM,
118
+ v && /* @__PURE__ */ N(g, {
119
+ icon: y === i.Dislike ? /* @__PURE__ */ N(O, {
120
+ className: L.activeRating,
121
+ size: u.SM,
740
122
  "aria-hidden": !0
123
+ }) : /* @__PURE__ */ N(D, {
124
+ size: u.SM,
125
+ "aria-hidden": !0,
126
+ stroke: d
741
127
  }),
742
- size: E.Small,
743
- "aria-label": y?.dislikeResponse ?? "Dislike response",
744
- "aria-pressed": f === o.Dislike,
745
- className: f === o.Dislike ? "!text-accent-primary" : void 0,
746
- tooltipProps: { tooltip: v?.dislike ?? "Dislike" },
747
- onClick: u
128
+ size: f.Small,
129
+ "aria-label": B?.dislikeResponse ?? "Dislike response",
130
+ "aria-pressed": y === i.Dislike,
131
+ tooltipProps: { tooltip: z?.dislike ?? "Dislike" },
132
+ onClick: v,
133
+ disabled: S
748
134
  })
749
135
  ] })]
750
- });
751
- }, $ = {
752
- userBubble: "_userBubble_1exhl_1",
753
- collapsibleText: "_collapsibleText_1exhl_6",
754
- expandedText: "_expandedText_1exhl_11",
755
- collapsedText: "_collapsedText_1exhl_15",
756
- startersDivider: "_startersDivider_1exhl_26",
757
- text: "_text_1exhl_30"
758
- }, dt = ({ text: e, styles: r, actions: a, hasAlwaysVisibleActions: o, isStreaming: c, attachments: l, afterContent: f, starters: p, onSelectStarter: m, deploymentIconUrl: h, deploymentDisplayName: g, markdownComponents: _, onAttachmentClick: v, onDownloadAll: y, onAttachmentRetry: x, codeBlockTheme: S, labels: C }) => {
759
- let { colors: w, typography: T, className: E, bubbleClassName: D } = r ?? {}, { attachmentClickLabel: O, attachmentRetryLabel: k, attachmentOpenInNewTabLabel: A, startersAriaLabel: j = "Quick reply buttons", thinkingLabel: M, codeBlockCopyLabel: N, codeBlockCopiedLabel: P, assistantMessageAriaLabel: F = "Assistant message", deploymentIconFallbackLabel: I = "AI" } = C ?? {}, L = c ? (l ?? []).filter((e) => e.type !== t.Audio) : l ?? [], R = u({
760
- "--cm-bubble-text": w?.text,
761
- "--cm-starters-divider": w?.startersDivider
762
- }), z = d($.text, T?.fontClassName), B = !!(h || g);
763
- return /* @__PURE__ */ J("div", {
136
+ }) : null;
137
+ }, B = {
138
+ userBubble: "_userBubble_cq829_1",
139
+ collapsibleText: "_collapsibleText_cq829_6",
140
+ expandedText: "_expandedText_cq829_11",
141
+ collapsedText: "_collapsedText_cq829_15",
142
+ startersDivider: "_startersDivider_cq829_26",
143
+ text: "_text_cq829_30"
144
+ }, V = "[&>.cm-bubble-markdown>div>*:first-child]:indent-[var(--cm-bubble-first-line-indent,0px)]", H = ({ text: t, styles: i, actions: c, hasAlwaysVisibleActions: u, isStreaming: d, attachments: f, beforeContent: p, afterContent: m, starters: g, onSelectStarter: _, deploymentIconUrl: v, deploymentDisplayName: y, markdownComponents: b, markdownClassNames: x, markdownUrlTransform: S, onAttachmentClick: C, onDownloadAll: w, onAttachmentRetry: T, codeBlockTheme: E, tableOnOpenInCanvas: D, labels: O, selectedAttachmentId: k }) => {
145
+ let { colors: A, typography: j, className: M, bubbleClassName: F } = i ?? {}, { attachmentClickLabel: L, attachmentRetryLabel: R, attachmentOpenInNewTabLabel: H, startersAriaLabel: U = "Quick reply buttons", thinkingLabel: W, codeBlockCopyLabel: G, codeBlockCopiedLabel: K, tableCopyCsvLabel: q, tableCopyTxtLabel: J, tableCopyMarkdownLabel: Y, tableCopiedLabel: X, tableDownloadCsvLabel: Z, tableOpenInCanvasLabel: ee, tableDownloadFilename: te, tableScrollRegionAriaLabel: ne, assistantMessageAriaLabel: re = "Assistant message", deploymentIconFallbackLabel: Q = "AI" } = O ?? {}, ie = d ? (f ?? []).filter((t) => t.type !== e.Audio) : f ?? [], { slotRef: $, firstLineIndent: ae } = I(p != null && !!t), oe = o({
146
+ "--cm-bubble-text": A?.text,
147
+ "--cm-starters-divider": A?.startersDivider,
148
+ "--cm-bubble-first-line-indent": ae
149
+ }), se = s(B.text, j?.fontClassName), ce = !!(v || y);
150
+ return /* @__PURE__ */ P("div", {
764
151
  role: "group",
765
- "aria-label": F,
766
- style: R,
767
- className: d("flex w-full items-start gap-3", E),
768
- children: [B && /* @__PURE__ */ q(n, {
769
- src: h,
152
+ "aria-label": re,
153
+ style: oe,
154
+ className: s("flex w-full items-start gap-3", M),
155
+ children: [ce && /* @__PURE__ */ N(n, {
156
+ src: v,
770
157
  size: 28,
771
- initialsName: g || I,
772
- labels: { tooltip: g ?? I }
773
- }), /* @__PURE__ */ J("div", {
158
+ initialsName: y || Q,
159
+ labels: { tooltip: y ?? Q }
160
+ }), /* @__PURE__ */ P("div", {
774
161
  className: "flex w-full min-w-0 max-w-full flex-col items-start gap-5",
775
- children: [/* @__PURE__ */ J("div", {
776
- className: d("flex w-full min-w-0 max-w-full flex-col items-start gap-4", D),
162
+ children: [/* @__PURE__ */ P("div", {
163
+ className: s("flex w-full min-w-0 max-w-full flex-col items-start gap-4", F),
777
164
  children: [
778
- (e || c) && /* @__PURE__ */ q("div", {
165
+ p != null && !t && /* @__PURE__ */ N("div", {
166
+ className: "min-w-0",
167
+ children: p
168
+ }),
169
+ (t || d) && /* @__PURE__ */ P("div", {
779
170
  "aria-live": "polite",
780
171
  "aria-atomic": "false",
781
- className: d(z, "min-w-0 max-w-full text-start"),
782
- children: /* @__PURE__ */ q(i, {
783
- content: e,
784
- isStreaming: c,
785
- thinkingLabel: M,
786
- components: _,
787
- codeBlockCopyLabel: N,
788
- codeBlockCopiedLabel: P,
789
- codeBlockTheme: S
790
- })
172
+ className: s(se, "relative min-w-0 max-w-full text-start", p != null && t && V),
173
+ children: [p != null && t && /* @__PURE__ */ N("div", {
174
+ ref: $,
175
+ className: "absolute start-0 top-0",
176
+ children: p
177
+ }), /* @__PURE__ */ N("div", {
178
+ className: "cm-bubble-markdown min-w-0 max-w-full",
179
+ children: /* @__PURE__ */ N(r, {
180
+ content: t ?? "",
181
+ isStreaming: d,
182
+ thinkingLabel: W,
183
+ components: b,
184
+ classNames: x,
185
+ urlTransform: S,
186
+ codeBlockCopyLabel: G,
187
+ codeBlockCopiedLabel: K,
188
+ codeBlockTheme: E,
189
+ tableActionLabels: {
190
+ copyCsvLabel: q,
191
+ copyTxtLabel: J,
192
+ copyMarkdownLabel: Y,
193
+ copiedLabel: X,
194
+ downloadCsvLabel: Z,
195
+ openInCanvasLabel: ee
196
+ },
197
+ tableDownloadFilename: te,
198
+ tableOnOpenInCanvas: D,
199
+ tableScrollRegionAriaLabel: ne
200
+ })
201
+ })]
791
202
  }),
792
- /* @__PURE__ */ q(rt, {
793
- attachments: L,
794
- onAttachmentClick: (e) => v?.(l?.find((t) => t.id === e)),
795
- onDownloadAll: y,
796
- onRetry: x,
203
+ /* @__PURE__ */ N(l, {
204
+ attachments: ie,
205
+ onAttachmentClick: (e) => C?.(f?.find((t) => t.id === e)),
206
+ onDownloadAll: w,
207
+ onRetry: T,
797
208
  labels: {
798
- clickLabel: O,
799
- retryLabel: k,
800
- openInNewTabLabel: A
801
- }
209
+ clickLabel: L,
210
+ retryLabel: R,
211
+ openInNewTabLabel: H
212
+ },
213
+ selectedAttachmentId: k
802
214
  }),
803
- f,
804
- /* @__PURE__ */ q(ut, {
805
- ...a,
806
- isAlwaysVisible: o,
807
- role: s.Assistant
215
+ m,
216
+ /* @__PURE__ */ N(z, {
217
+ ...c,
218
+ isAlwaysVisible: u,
219
+ role: a.Assistant
808
220
  })
809
221
  ]
810
- }), p && p.length > 0 && m && /* @__PURE__ */ q("div", {
222
+ }), g && g.length > 0 && _ && /* @__PURE__ */ N("div", {
811
223
  role: "list",
812
- "aria-label": j,
813
- className: d("flex w-full flex-wrap gap-2 border-t pt-5", $.startersDivider),
814
- children: p.map((e, t) => /* @__PURE__ */ q("div", {
224
+ "aria-label": U,
225
+ className: s("flex w-full flex-wrap gap-2 border-t pt-5", B.startersDivider),
226
+ children: g.map((e, t) => /* @__PURE__ */ N("div", {
815
227
  role: "listitem",
816
228
  className: "min-w-[40px]",
817
- children: /* @__PURE__ */ q(b, {
229
+ children: /* @__PURE__ */ N(h, {
818
230
  label: e.title,
819
231
  className: "min-w-[40px]",
820
- onClick: () => m(e)
232
+ onClick: () => _(e)
821
233
  })
822
234
  }, t))
823
235
  })]
824
236
  })]
825
237
  });
826
- }, ft = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ q("div", {
238
+ }, U = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ N("div", {
827
239
  role: "status",
828
240
  "aria-live": "polite",
829
- children: /* @__PURE__ */ q(D, {
241
+ children: /* @__PURE__ */ N(p, {
830
242
  title: e,
831
243
  message: t,
832
244
  textClassName: "flex-row flex-wrap gap-1"
833
245
  })
834
- }), pt = /* @__PURE__ */ function(e) {
246
+ }), W = /* @__PURE__ */ function(e) {
835
247
  return e.Bottom = "Bottom", e.Top = "Top", e;
836
- }({}), mt = 10, ht = ({ text: e, position: t = pt.Bottom, styles: n, actions: r, hasAlwaysVisibleActions: i, attachments: a, collapsedLineCount: o = mt, labels: c, onAttachmentClick: l, onDownloadAll: m, onAttachmentRetry: h }) => {
837
- let { colors: _, typography: v, className: y, bubbleClassName: b } = n ?? {}, { showMoreLabel: x = "Show more", showLessLabel: S = "Show less", showMoreAriaLabel: C, showLessAriaLabel: w, attachmentClickLabel: T, attachmentRetryLabel: D, attachmentOpenInNewTabLabel: O, userMessageAriaLabel: k = "User message" } = c ?? {}, { textRef: A, isTextCollapsed: N, isOverflowing: P, collapsedMaxHeight: F, expandedMaxHeight: I, isCollapsed: L, toggleCollapsed: R } = f({
838
- text: e,
839
- collapsedLineCount: o
840
- }), z = u({
841
- "--cm-bubble-user-bg": _?.userBackground,
842
- "--cm-bubble-user-border": _?.userBorder,
843
- "--cm-bubble-fade-start": _?.fadeStart,
844
- "--cm-bubble-text": _?.text,
845
- "--cm-bubble-collapsed-height": P ? `${F}px` : void 0,
846
- "--cm-bubble-expanded-height": P ? `${I}px` : void 0
847
- }), B = t === pt.Top ? "rounded-ee-[6px] rounded-se-[16px]" : "rounded-se-[6px] rounded-ee-[16px]", V = d($.text, v?.fontClassName), ee = C ?? x, te = w ?? S, ne = L ? x : S, re = L ? ee : te, ie = L ? j : M, ae = Ne();
848
- return /* @__PURE__ */ q("div", {
248
+ }({}), G = 10, K = ({ text: e, position: t = W.Bottom, styles: n, actions: r, hasAlwaysVisibleActions: i, attachments: d, collapsedLineCount: p = G, labels: h, beforeContent: g, onAttachmentClick: _, onDownloadAll: v, onAttachmentRetry: b, selectedAttachmentId: x }) => {
249
+ let { colors: w, typography: T, className: E, bubbleClassName: D } = n ?? {}, { showMoreLabel: O = "Show more", showLessLabel: k = "Show less", showMoreAriaLabel: A, showLessAriaLabel: j, attachmentClickLabel: F, attachmentRetryLabel: I, attachmentOpenInNewTabLabel: L, userMessageAriaLabel: R = "User message" } = h ?? {}, { textRef: V, isTextCollapsed: H, isOverflowing: U, collapsedMaxHeight: K, expandedMaxHeight: q, isCollapsed: J, toggleCollapsed: Y } = c({
250
+ text: e ?? "",
251
+ collapsedLineCount: p
252
+ }), X = o({
253
+ "--cm-bubble-user-bg": w?.userBackground,
254
+ "--cm-bubble-user-border": w?.userBorder,
255
+ "--cm-bubble-fade-start": w?.fadeStart,
256
+ "--cm-bubble-text": w?.text,
257
+ "--cm-bubble-collapsed-height": U ? `${K}px` : void 0,
258
+ "--cm-bubble-expanded-height": U ? `${q}px` : void 0
259
+ }), Z = t === W.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", ee = s(B.text, T?.fontClassName), te = A ?? O, ne = j ?? k, re = J ? O : k, Q = J ? te : ne, ie = J ? S : C, $ = y();
260
+ return /* @__PURE__ */ N("div", {
849
261
  role: "group",
850
- "aria-label": k,
851
- style: z,
852
- className: d("flex w-full", y),
853
- children: /* @__PURE__ */ J("div", {
262
+ "aria-label": R,
263
+ style: X,
264
+ className: s("flex w-full", E),
265
+ children: /* @__PURE__ */ P("div", {
854
266
  className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
855
267
  children: [
856
- /* @__PURE__ */ q(rt, {
857
- attachments: a ?? [],
858
- onAttachmentClick: (e) => l?.(a?.find((t) => t.id === e)),
859
- onDownloadAll: m,
860
- onRetry: h,
268
+ /* @__PURE__ */ N(l, {
269
+ attachments: d ?? [],
270
+ onAttachmentClick: (e) => _?.(d?.find((t) => t.id === e)),
271
+ onDownloadAll: v,
272
+ onRetry: b,
861
273
  labels: {
862
- clickLabel: T,
863
- retryLabel: D,
864
- openInNewTabLabel: O
274
+ clickLabel: F,
275
+ retryLabel: I,
276
+ openInNewTabLabel: L
865
277
  },
866
- styles: { className: "max-w-[640px]" }
278
+ styles: { className: "max-w-[640px]" },
279
+ selectedAttachmentId: x
867
280
  }),
868
- e && /* @__PURE__ */ q("div", {
869
- className: d($.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", B, b),
870
- children: /* @__PURE__ */ J("div", {
281
+ (e || g != null) && /* @__PURE__ */ N("div", {
282
+ className: s(B.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", Z, D),
283
+ children: /* @__PURE__ */ P("div", {
871
284
  className: "flex min-w-0 flex-col items-start",
872
- children: [/* @__PURE__ */ q("div", {
873
- id: ae,
874
- className: d("relative overflow-hidden", P && $.collapsibleText, P && !L && $.expandedText, N && $.collapsedText),
875
- children: /* @__PURE__ */ q("p", {
876
- ref: A,
877
- className: d(V, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
878
- children: e
879
- })
880
- }), P && /* @__PURE__ */ q(g, {
881
- label: /* @__PURE__ */ q(K, { children: ne }),
882
- iconBefore: /* @__PURE__ */ q(ie, {
883
- size: p.SM,
884
- "aria-hidden": "true"
285
+ children: [
286
+ e && /* @__PURE__ */ N("div", {
287
+ id: $,
288
+ className: s("relative overflow-hidden", U && B.collapsibleText, U && !J && B.expandedText, H && B.collapsedText),
289
+ children: /* @__PURE__ */ P("p", {
290
+ ref: V,
291
+ className: s(ee, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
292
+ children: [g != null && /* @__PURE__ */ N("span", {
293
+ className: "me-1",
294
+ children: g
295
+ }), e]
296
+ })
885
297
  }),
886
- "aria-label": re,
887
- "aria-expanded": !L,
888
- "aria-controls": ae,
889
- className: "mt-3",
890
- onClick: R,
891
- size: E.Small
892
- })]
298
+ g != null && !e && /* @__PURE__ */ N("div", { children: g }),
299
+ U && /* @__PURE__ */ N(m, {
300
+ label: /* @__PURE__ */ N(M, { children: re }),
301
+ iconBefore: /* @__PURE__ */ N(ie, {
302
+ size: u.SM,
303
+ "aria-hidden": "true"
304
+ }),
305
+ "aria-label": Q,
306
+ "aria-expanded": !J,
307
+ "aria-controls": $,
308
+ className: "mt-3",
309
+ onClick: Y,
310
+ size: f.Small
311
+ })
312
+ ]
893
313
  })
894
314
  }),
895
- /* @__PURE__ */ q(ut, {
315
+ /* @__PURE__ */ N(z, {
896
316
  ...r,
897
317
  isAlwaysVisible: i,
898
- role: s.User
318
+ role: a.User
899
319
  })
900
320
  ]
901
321
  })
902
322
  });
903
- }, gt = ({ role: e, onAttachmentClick: t, markdownComponents: n, ...r }) => e === s.Status ? /* @__PURE__ */ q(ft, { labels: {
904
- titleText: r.labels?.statusTitleText,
905
- bodyText: r.labels?.statusBodyText ?? ""
906
- } }) : e === s.User ? /* @__PURE__ */ q(ht, {
907
- ...r,
908
- onAttachmentClick: t
909
- }) : /* @__PURE__ */ q(dt, {
910
- ...r,
911
- markdownComponents: n,
912
- onAttachmentClick: t
323
+ }, q = ({ role: e, beforeContent: t, onAttachmentClick: n, markdownComponents: r, markdownUrlTransform: i, ...o }) => e === a.Status ? /* @__PURE__ */ N(U, { labels: {
324
+ titleText: o.labels?.statusTitleText,
325
+ bodyText: o.labels?.statusBodyText ?? ""
326
+ } }) : e === a.User ? /* @__PURE__ */ N(K, {
327
+ ...o,
328
+ beforeContent: t,
329
+ onAttachmentClick: n
330
+ }) : /* @__PURE__ */ N(H, {
331
+ ...o,
332
+ beforeContent: t,
333
+ markdownComponents: r,
334
+ markdownUrlTransform: i,
335
+ onAttachmentClick: n
913
336
  });
914
337
  //#endregion
915
- export { dt as AssistantMessageBubble, pt as BubblePosition, ut as MessageActions, gt as MessageBubble, ft as StatusMessageBubble, ht as UserMessageBubble };
338
+ export { H as AssistantMessageBubble, W as BubblePosition, z as MessageActions, q as MessageBubble, U as StatusMessageBubble, K as UserMessageBubble };