@epam/ai-dial-conversation-messages 1.3.0-dev.16 → 1.3.0-dev.160
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/components/ConversationStartTimestamp/ConversationStartTimestamp.d.ts +5 -0
- package/components/ConversationStartTimestamp/ConversationStartTimestamp.d.ts.map +1 -0
- package/components/MessageActions/MessageActions.d.ts.map +1 -1
- package/components/MessageBubble/AssistantMessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/MessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/UserMessageBubble.d.ts.map +1 -1
- package/components/MessageTimestamp/MessageTimestamp.d.ts +5 -0
- package/components/MessageTimestamp/MessageTimestamp.d.ts.map +1 -0
- package/hooks/useNow/useNow.d.ts +3 -0
- package/hooks/useNow/useNow.d.ts.map +1 -0
- package/index.css +3 -2
- package/index.d.ts +3 -1
- package/index.d.ts.map +1 -1
- package/index.js +434 -313
- package/models/conversation-start.d.ts +36 -0
- package/models/conversation-start.d.ts.map +1 -0
- package/models/message-actions.d.ts +5 -0
- package/models/message-actions.d.ts.map +1 -1
- package/models/message-bubble.d.ts +40 -27
- package/models/message-bubble.d.ts.map +1 -1
- package/package.json +4 -4
- package/types/conversation-start-kind.d.ts +10 -0
- package/types/conversation-start-kind.d.ts.map +1 -0
- package/utils/date-time.d.ts +10 -0
- package/utils/date-time.d.ts.map +1 -0
package/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, ResponseFormat as o, buildCssVars as s,
|
|
2
|
-
import { AttachmentGroup as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { IconArrowBackUp as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { createPortal as
|
|
1
|
+
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, ResponseFormat as o, buildCssVars as s, buildInlineSegmentSource as c, createInlineSegmentComponents as l, createRehypeInlineSegments as u, mergeClasses as d, useCollapsedText as f } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { AttachmentGroup as p } from "@epam/ai-dial-attachment-input";
|
|
3
|
+
import { Button as m, ButtonVariant as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, ElementSize as v, GhostIconButton as y, InfoMessageNotification as b, LinkButton as x, NeutralButton as S, Tooltip as C } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { useCallback as w, useEffect as T, useId as ee, useLayoutEffect as E, useMemo as D, useRef as O, useState as k } from "react";
|
|
5
|
+
import { IconArrowBackUp as A, IconChevronDown as te, IconChevronUp as ne, IconMarkdown as re, IconPencilMinus as ie, IconRefresh as j, IconThumbDown as M, IconThumbDownFilled as ae, IconThumbUp as oe, IconThumbUpFilled as se, IconTrashX as N } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as L } from "react-dom";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var R = {
|
|
10
10
|
userBubble: "dial-cm-user-bubble",
|
|
11
11
|
assistantContent: "dial-cm-assistant-content"
|
|
12
|
-
},
|
|
13
|
-
let t =
|
|
14
|
-
return
|
|
12
|
+
}, z = 4, ce = (e) => {
|
|
13
|
+
let t = O(null), [n, r] = k(0);
|
|
14
|
+
return T(() => {
|
|
15
15
|
if (!e) return;
|
|
16
16
|
let n = t.current;
|
|
17
17
|
if (n == null) return;
|
|
@@ -22,416 +22,528 @@ var z = {
|
|
|
22
22
|
return i.observe(n), () => i.disconnect();
|
|
23
23
|
}, [e]), {
|
|
24
24
|
slotRef: t,
|
|
25
|
-
firstLineIndent: e ? `calc(${n}px + ${
|
|
25
|
+
firstLineIndent: e ? `calc(${n}px + ${z}px)` : void 0
|
|
26
26
|
};
|
|
27
|
-
},
|
|
27
|
+
}, le = [
|
|
28
28
|
"href",
|
|
29
29
|
"src",
|
|
30
30
|
"alt",
|
|
31
31
|
"colspan",
|
|
32
32
|
"rowspan",
|
|
33
33
|
"start"
|
|
34
|
-
],
|
|
34
|
+
], ue = /* @__PURE__ */ new Set([
|
|
35
35
|
"pre",
|
|
36
36
|
"pre-wrap",
|
|
37
37
|
"pre-line",
|
|
38
38
|
"break-spaces"
|
|
39
|
-
]),
|
|
39
|
+
]), B = (e) => {
|
|
40
40
|
let t = document.createElement(e.tagName.toLowerCase());
|
|
41
|
-
|
|
41
|
+
le.forEach((n) => {
|
|
42
42
|
let r = e.getAttribute(n);
|
|
43
43
|
r !== null && t.setAttribute(n, r);
|
|
44
44
|
});
|
|
45
45
|
let { whiteSpace: n } = window.getComputedStyle(e);
|
|
46
|
-
return
|
|
47
|
-
},
|
|
46
|
+
return ue.has(n) && (t.style.whiteSpace = "pre-wrap"), t;
|
|
47
|
+
}, de = (e) => e instanceof SVGElement || window.getComputedStyle(e).display === "none", V = (e, t) => {
|
|
48
48
|
if (!t.intersectsNode(e)) return null;
|
|
49
49
|
if (e.nodeType === Node.TEXT_NODE) {
|
|
50
50
|
let n = e.data, r = e === t.startContainer ? t.startOffset : 0, i = e === t.endContainer ? t.endOffset : n.length;
|
|
51
51
|
return document.createTextNode(n.slice(r, i));
|
|
52
52
|
}
|
|
53
|
-
if (!(e instanceof Element) ||
|
|
54
|
-
let n =
|
|
53
|
+
if (!(e instanceof Element) || de(e)) return null;
|
|
54
|
+
let n = B(e);
|
|
55
55
|
return e.childNodes.forEach((e) => {
|
|
56
|
-
let r =
|
|
56
|
+
let r = V(e, t);
|
|
57
57
|
r && n.appendChild(r);
|
|
58
58
|
}), n;
|
|
59
|
-
},
|
|
59
|
+
}, fe = (e, t, n) => {
|
|
60
60
|
let r = e, i = t;
|
|
61
61
|
for (; i && i !== n && n.contains(i);) {
|
|
62
|
-
let e =
|
|
62
|
+
let e = B(i);
|
|
63
63
|
e.appendChild(r), r = e, i = i.parentElement;
|
|
64
64
|
}
|
|
65
65
|
return r;
|
|
66
|
-
},
|
|
66
|
+
}, pe = (e, t) => {
|
|
67
67
|
let n = e.commonAncestorContainer, r = n instanceof Element ? n : n.parentElement;
|
|
68
68
|
if (!r) return null;
|
|
69
|
-
let i =
|
|
70
|
-
return i ?
|
|
71
|
-
},
|
|
69
|
+
let i = V(r, e);
|
|
70
|
+
return i ? fe(i, r.parentElement, t) : null;
|
|
71
|
+
}, me = (e) => {
|
|
72
72
|
let t = window.getSelection();
|
|
73
73
|
if (!t || t.isCollapsed || t.rangeCount === 0 || !e.clipboardData) return;
|
|
74
74
|
let n = t.toString();
|
|
75
75
|
if (!n) return;
|
|
76
76
|
let r = document.createElement("div");
|
|
77
77
|
for (let n = 0; n < t.rangeCount; n++) {
|
|
78
|
-
let i =
|
|
78
|
+
let i = pe(t.getRangeAt(n), e.currentTarget);
|
|
79
79
|
i && r.appendChild(i);
|
|
80
80
|
}
|
|
81
81
|
e.clipboardData.setData("text/html", r.innerHTML), e.clipboardData.setData("text/plain", n), e.preventDefault();
|
|
82
|
-
},
|
|
83
|
-
let { tooltips:
|
|
84
|
-
|
|
82
|
+
}, H = { activeRating: "_activeRating_ygoee_1" }, U = 2e3, he = ({ role: e = a.User, onEdit: n, onEditHover: r, onDelete: o, onRegenerate: c, onCopy: l, onCopyMarkdown: u, onLike: f, onDislike: p, activeRating: m, isAlwaysVisible: h, leadingContent: b, trailingContent: x, isDisabled: S = !1, className: C, labels: T, colors: ee }) => {
|
|
83
|
+
let { tooltips: E, ariaLabels: D } = T ?? {}, [O, A] = k(null), [te, ne] = k(""), L = n != null || o != null || c != null || l != null || u != null || f != null || p != null || b != null || x != null, R = s({ "--ma-active-rating-text": ee?.activeRatingText }), z = w(() => {
|
|
84
|
+
l?.(), A("copy"), ne(e === a.User ? D?.copiedMessageStatus ?? "Message copied to clipboard" : D?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => A(null), U);
|
|
85
85
|
}, [
|
|
86
|
-
|
|
86
|
+
l,
|
|
87
87
|
e,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
]),
|
|
91
|
-
|
|
92
|
-
}, [
|
|
93
|
-
return
|
|
88
|
+
D?.copiedStatus,
|
|
89
|
+
D?.copiedMessageStatus
|
|
90
|
+
]), ce = w(() => {
|
|
91
|
+
u?.(), A("markdown"), ne(D?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => A(null), U);
|
|
92
|
+
}, [u, D?.copiedMarkdownStatus]);
|
|
93
|
+
return L ? /* @__PURE__ */ I("div", {
|
|
94
94
|
role: "toolbar",
|
|
95
|
-
"aria-label":
|
|
96
|
-
style:
|
|
97
|
-
className:
|
|
98
|
-
children: [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
iconSize: p.SM,
|
|
106
|
-
onClick: H,
|
|
107
|
-
size: h.Small,
|
|
108
|
-
isCopied: D === "copy",
|
|
109
|
-
copyLabel: w?.copyMessage ?? "Copy message",
|
|
110
|
-
copiedLabel: w?.copied ?? "Copied!",
|
|
111
|
-
ariaLabel: E?.copyMessage ?? "Copy message",
|
|
112
|
-
isDisabled: x
|
|
95
|
+
"aria-label": D?.actionsGroup ?? "Message actions",
|
|
96
|
+
style: R,
|
|
97
|
+
className: d("flex items-center gap-1", !h && "opacity-0 group-hover:opacity-100", C),
|
|
98
|
+
children: [
|
|
99
|
+
b,
|
|
100
|
+
/* @__PURE__ */ F("span", {
|
|
101
|
+
role: "status",
|
|
102
|
+
"aria-live": "polite",
|
|
103
|
+
className: "sr-only",
|
|
104
|
+
children: te
|
|
113
105
|
}),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
106
|
+
e === a.User ? /* @__PURE__ */ I(P, { children: [
|
|
107
|
+
l && /* @__PURE__ */ F(t, {
|
|
108
|
+
iconSize: g.SM,
|
|
109
|
+
onClick: z,
|
|
110
|
+
size: v.Small,
|
|
111
|
+
isCopied: O === "copy",
|
|
112
|
+
copyLabel: E?.copyMessage ?? "Copy message",
|
|
113
|
+
copiedLabel: E?.copied ?? "Copied!",
|
|
114
|
+
ariaLabel: D?.copyMessage ?? "Copy message",
|
|
115
|
+
isDisabled: S
|
|
119
116
|
}),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
117
|
+
n && /* @__PURE__ */ F(y, {
|
|
118
|
+
icon: /* @__PURE__ */ F(ie, {
|
|
119
|
+
size: g.SM,
|
|
120
|
+
"aria-hidden": !0,
|
|
121
|
+
stroke: _
|
|
122
|
+
}),
|
|
123
|
+
size: v.Small,
|
|
124
|
+
"aria-label": D?.editMessage ?? "Edit message",
|
|
125
|
+
tooltipProps: { tooltip: E?.edit ?? "Edit" },
|
|
126
|
+
onClick: n,
|
|
127
|
+
onMouseEnter: r,
|
|
128
|
+
onFocus: r,
|
|
129
|
+
disabled: S
|
|
133
130
|
}),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
131
|
+
o && /* @__PURE__ */ F(y, {
|
|
132
|
+
icon: /* @__PURE__ */ F(N, {
|
|
133
|
+
size: g.SM,
|
|
134
|
+
"aria-hidden": !0,
|
|
135
|
+
stroke: _
|
|
136
|
+
}),
|
|
137
|
+
size: v.Small,
|
|
138
|
+
"aria-label": D?.deleteMessage ?? "Delete message",
|
|
139
|
+
tooltipProps: { tooltip: E?.delete ?? "Delete" },
|
|
140
|
+
onClick: o,
|
|
141
|
+
disabled: S
|
|
142
|
+
})
|
|
143
|
+
] }) : /* @__PURE__ */ I(P, { children: [
|
|
144
|
+
c && /* @__PURE__ */ F(y, {
|
|
145
|
+
icon: /* @__PURE__ */ F(j, {
|
|
146
|
+
size: g.SM,
|
|
147
|
+
"aria-hidden": !0,
|
|
148
|
+
stroke: _
|
|
149
|
+
}),
|
|
150
|
+
size: v.Small,
|
|
151
|
+
"aria-label": D?.regenerateResponse ?? "Regenerate response",
|
|
152
|
+
tooltipProps: { tooltip: E?.regenerate ?? "Regenerate" },
|
|
153
|
+
onClick: c,
|
|
154
|
+
disabled: S
|
|
146
155
|
}),
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
size: h.Small,
|
|
157
|
-
isCopied: D === "copy",
|
|
158
|
-
copyLabel: w?.copy ?? "Copy",
|
|
159
|
-
copiedLabel: w?.copied ?? "Copied!",
|
|
160
|
-
ariaLabel: E?.copyResponse ?? "Copy response",
|
|
161
|
-
isDisabled: x
|
|
162
|
-
}),
|
|
163
|
-
d && /* @__PURE__ */ I(t, {
|
|
164
|
-
iconSize: p.SM,
|
|
165
|
-
onClick: U,
|
|
166
|
-
size: h.Small,
|
|
167
|
-
isCopied: D === "markdown",
|
|
168
|
-
iconCopy: /* @__PURE__ */ I(k, {
|
|
169
|
-
size: p.SM,
|
|
170
|
-
"aria-hidden": !0,
|
|
171
|
-
stroke: m
|
|
156
|
+
l && /* @__PURE__ */ F(t, {
|
|
157
|
+
iconSize: g.SM,
|
|
158
|
+
onClick: z,
|
|
159
|
+
size: v.Small,
|
|
160
|
+
isCopied: O === "copy",
|
|
161
|
+
copyLabel: E?.copy ?? "Copy",
|
|
162
|
+
copiedLabel: E?.copied ?? "Copied!",
|
|
163
|
+
ariaLabel: D?.copyResponse ?? "Copy response",
|
|
164
|
+
isDisabled: S
|
|
172
165
|
}),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
"
|
|
186
|
-
|
|
166
|
+
u && /* @__PURE__ */ F(t, {
|
|
167
|
+
iconSize: g.SM,
|
|
168
|
+
onClick: ce,
|
|
169
|
+
size: v.Small,
|
|
170
|
+
isCopied: O === "markdown",
|
|
171
|
+
iconCopy: /* @__PURE__ */ F(re, {
|
|
172
|
+
size: g.SM,
|
|
173
|
+
"aria-hidden": !0,
|
|
174
|
+
stroke: _
|
|
175
|
+
}),
|
|
176
|
+
copyLabel: E?.copyMarkdown ?? "Copy as Markdown",
|
|
177
|
+
copiedLabel: E?.copiedMarkdown ?? "Copied!",
|
|
178
|
+
ariaLabel: D?.copyAsMarkdown ?? "Copy as markdown",
|
|
179
|
+
isDisabled: S
|
|
187
180
|
}),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
size:
|
|
199
|
-
"aria-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
181
|
+
f && /* @__PURE__ */ F(y, {
|
|
182
|
+
icon: m === i.Like ? /* @__PURE__ */ F(se, {
|
|
183
|
+
className: H.activeRating,
|
|
184
|
+
size: g.SM,
|
|
185
|
+
"aria-hidden": !0
|
|
186
|
+
}) : /* @__PURE__ */ F(oe, {
|
|
187
|
+
size: g.SM,
|
|
188
|
+
"aria-hidden": !0,
|
|
189
|
+
stroke: _
|
|
190
|
+
}),
|
|
191
|
+
size: v.Small,
|
|
192
|
+
"aria-label": D?.likeResponse ?? "Like response",
|
|
193
|
+
"aria-pressed": m === i.Like,
|
|
194
|
+
tooltipProps: { tooltip: E?.like ?? "Like" },
|
|
195
|
+
onClick: f,
|
|
196
|
+
disabled: S
|
|
204
197
|
}),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
198
|
+
p && /* @__PURE__ */ F(y, {
|
|
199
|
+
icon: m === i.Dislike ? /* @__PURE__ */ F(ae, {
|
|
200
|
+
className: H.activeRating,
|
|
201
|
+
size: g.SM,
|
|
202
|
+
"aria-hidden": !0
|
|
203
|
+
}) : /* @__PURE__ */ F(M, {
|
|
204
|
+
size: g.SM,
|
|
205
|
+
"aria-hidden": !0,
|
|
206
|
+
stroke: _
|
|
207
|
+
}),
|
|
208
|
+
size: v.Small,
|
|
209
|
+
"aria-label": D?.dislikeResponse ?? "Dislike response",
|
|
210
|
+
"aria-pressed": m === i.Dislike,
|
|
211
|
+
tooltipProps: { tooltip: E?.dislike ?? "Dislike" },
|
|
212
|
+
onClick: p,
|
|
213
|
+
disabled: S
|
|
214
|
+
})
|
|
215
|
+
] }),
|
|
216
|
+
x
|
|
217
|
+
]
|
|
213
218
|
}) : null;
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
219
|
+
}, W = (e) => {
|
|
220
|
+
let [t, n] = k(() => /* @__PURE__ */ new Date());
|
|
221
|
+
return T(() => {
|
|
222
|
+
let t = setInterval(() => n(/* @__PURE__ */ new Date()), e);
|
|
223
|
+
return () => clearInterval(t);
|
|
224
|
+
}, [e]), t;
|
|
225
|
+
}, G = /* @__PURE__ */ function(e) {
|
|
226
|
+
return e.Today = "today", e.Yesterday = "yesterday", e.Absolute = "absolute", e;
|
|
227
|
+
}({}), K = {
|
|
228
|
+
hour: "numeric",
|
|
229
|
+
minute: "2-digit"
|
|
230
|
+
}, q = {
|
|
231
|
+
year: "numeric",
|
|
232
|
+
month: "short",
|
|
233
|
+
day: "numeric",
|
|
234
|
+
...K
|
|
235
|
+
}, ge = 60, J = 3600, Y = 24 * J, _e = [
|
|
236
|
+
["year", 365 * Y],
|
|
237
|
+
["month", 30 * Y],
|
|
238
|
+
["week", 7 * Y],
|
|
239
|
+
["day", Y],
|
|
240
|
+
["hour", J],
|
|
241
|
+
["minute", ge]
|
|
242
|
+
], ve = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), ye = (e) => {
|
|
243
|
+
if (!e) return null;
|
|
244
|
+
let t = new Date(e);
|
|
245
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
246
|
+
}, X = (e, t) => new Intl.DateTimeFormat(t, q).format(e), be = (e, t, n) => {
|
|
247
|
+
let r = new Date(t.getFullYear(), t.getMonth(), t.getDate() - 1);
|
|
248
|
+
return ve(e, t) ? {
|
|
249
|
+
kind: G.Today,
|
|
250
|
+
text: new Intl.DateTimeFormat(n, K).format(e)
|
|
251
|
+
} : ve(e, r) ? {
|
|
252
|
+
kind: G.Yesterday,
|
|
253
|
+
text: new Intl.DateTimeFormat(n, K).format(e)
|
|
254
|
+
} : {
|
|
255
|
+
kind: G.Absolute,
|
|
256
|
+
text: X(e, n)
|
|
257
|
+
};
|
|
258
|
+
}, xe = (e, t, n) => {
|
|
259
|
+
let r = new Intl.RelativeTimeFormat(n, { numeric: "auto" }), i = (t.getTime() - e.getTime()) / 1e3;
|
|
260
|
+
for (let [e, t] of _e) {
|
|
261
|
+
let n = Math.floor(i / t);
|
|
262
|
+
if (n >= 1) return r.format(-n, e);
|
|
263
|
+
}
|
|
264
|
+
return r.format(0, "second");
|
|
265
|
+
}, Z = 6e4, Se = "opacity-0 transition-opacity group-hover/message:opacity-100 group-focus-within/message:opacity-100 [@media(hover:none)]:opacity-100", Ce = ({ timestamp: e, locale: t, className: n = "dial-small-text text-secondary" }) => {
|
|
266
|
+
let r = W(Z), i = ye(e);
|
|
267
|
+
return i == null ? null : /* @__PURE__ */ F(C, {
|
|
268
|
+
tooltip: X(i, t),
|
|
269
|
+
asChild: !0,
|
|
270
|
+
children: /* @__PURE__ */ F("time", {
|
|
271
|
+
dateTime: e,
|
|
272
|
+
tabIndex: 0,
|
|
273
|
+
className: d("px-1 whitespace-nowrap", n, Se),
|
|
274
|
+
children: xe(i, r, t)
|
|
275
|
+
})
|
|
276
|
+
});
|
|
277
|
+
}, Q = {
|
|
278
|
+
userBubble: "_userBubble_17fln_1",
|
|
279
|
+
collapsibleText: "_collapsibleText_17fln_6",
|
|
280
|
+
expandedText: "_expandedText_17fln_11",
|
|
281
|
+
collapsedText: "_collapsedText_17fln_15",
|
|
282
|
+
startersDivider: "_startersDivider_17fln_31",
|
|
283
|
+
text: "_text_17fln_35"
|
|
284
|
+
}, we = "[&>.cm-bubble-markdown>div>*:first-child]:indent-[var(--cm-bubble-first-line-indent,0px)]", $ = ({ text: t, contentRef: i, styles: c, actions: l, hasAlwaysVisibleActions: u, timestamp: f, locale: m, isStreaming: h, attachments: g, beforeContent: _, responseFormat: v, afterContent: y, hasThinkingPlaceholder: b = !0, starters: x, onSelectStarter: C, deploymentIconUrl: w, deploymentDisplayName: T, markdownComponents: ee, markdownClassNames: E, markdownUrlTransform: O, onAttachmentClick: k, onDownloadAll: A, onAttachmentRetry: te, codeBlockTheme: ne, tableOnOpenInCanvas: re, labels: ie, selectedAttachmentId: j }) => {
|
|
285
|
+
let { colors: M, typography: ae, className: oe, bubbleClassName: se, timestampClassName: N } = c ?? {}, L = f == null ? void 0 : /* @__PURE__ */ F(Ce, {
|
|
286
|
+
timestamp: f,
|
|
287
|
+
locale: m,
|
|
288
|
+
className: N
|
|
289
|
+
}), { attachmentClickLabel: z, attachmentDownloadLabel: le, attachmentRetryLabel: ue, attachmentOpenInNewTabLabel: B, startersAriaLabel: de = "Quick reply buttons", thinkingLabel: V, codeBlockCopyLabel: fe, codeBlockCopiedLabel: pe, codeBlockDownloadLabel: H, tableCopyLabel: U, tableCopiedLabel: W, tableDownloadCsvLabel: G, tableOpenInCanvasLabel: K, tableDownloadFilename: q, tableScrollRegionAriaLabel: ge, mathScrollRegionAriaLabel: J, assistantMessageAriaLabel: Y = "Assistant message", deploymentIconFallbackLabel: _e = "AI" } = ie ?? {}, ve = D(() => ({
|
|
290
|
+
copyLabel: U,
|
|
291
|
+
copiedLabel: W,
|
|
292
|
+
downloadCsvLabel: G,
|
|
293
|
+
openInCanvasLabel: K
|
|
227
294
|
}), [
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
]),
|
|
233
|
-
"--cm-bubble-text":
|
|
234
|
-
"--cm-starters-divider":
|
|
235
|
-
"--cm-bubble-first-line-indent":
|
|
236
|
-
}),
|
|
237
|
-
return /* @__PURE__ */
|
|
295
|
+
U,
|
|
296
|
+
W,
|
|
297
|
+
G,
|
|
298
|
+
K
|
|
299
|
+
]), ye = h ? (g ?? []).filter((t) => t.type !== e.Audio) : g ?? [], X = !!t?.trim(), { slotRef: be, firstLineIndent: xe } = ce(_ != null && X), Z = s({
|
|
300
|
+
"--cm-bubble-text": M?.text,
|
|
301
|
+
"--cm-starters-divider": M?.startersDivider,
|
|
302
|
+
"--cm-bubble-first-line-indent": xe
|
|
303
|
+
}), Se = d(Q.text, ae?.fontClassName), $ = !!(w || T);
|
|
304
|
+
return /* @__PURE__ */ I("div", {
|
|
238
305
|
role: "group",
|
|
239
|
-
"aria-label":
|
|
240
|
-
style:
|
|
241
|
-
onCopy:
|
|
242
|
-
className:
|
|
243
|
-
children: [
|
|
244
|
-
src:
|
|
306
|
+
"aria-label": Y,
|
|
307
|
+
style: Z,
|
|
308
|
+
onCopy: me,
|
|
309
|
+
className: d("group/message flex w-full items-start gap-3", oe),
|
|
310
|
+
children: [$ && /* @__PURE__ */ F(n, {
|
|
311
|
+
src: w,
|
|
245
312
|
size: 28,
|
|
246
|
-
initialsName:
|
|
247
|
-
labels: { tooltip:
|
|
248
|
-
}), /* @__PURE__ */
|
|
249
|
-
className: "flex w-full
|
|
250
|
-
children: [/* @__PURE__ */
|
|
251
|
-
className:
|
|
313
|
+
initialsName: T || _e,
|
|
314
|
+
labels: { tooltip: T ?? _e }
|
|
315
|
+
}), /* @__PURE__ */ I("div", {
|
|
316
|
+
className: "flex w-full max-w-full min-w-0 flex-col items-start gap-5",
|
|
317
|
+
children: [/* @__PURE__ */ I("div", {
|
|
318
|
+
className: d("flex w-full max-w-full min-w-0 flex-col items-start gap-4", se),
|
|
252
319
|
children: [
|
|
253
|
-
|
|
320
|
+
_ != null && !X && /* @__PURE__ */ F("div", {
|
|
254
321
|
className: "min-w-0",
|
|
255
|
-
children:
|
|
322
|
+
children: _
|
|
256
323
|
}),
|
|
257
|
-
(
|
|
324
|
+
(X || h && b) && /* @__PURE__ */ I("div", {
|
|
258
325
|
"aria-live": "polite",
|
|
259
326
|
"aria-atomic": "false",
|
|
260
|
-
className:
|
|
261
|
-
children: [
|
|
262
|
-
ref:
|
|
263
|
-
className: "absolute
|
|
264
|
-
children:
|
|
265
|
-
}), /* @__PURE__ */
|
|
327
|
+
className: d(Se, "relative max-w-full min-w-0 text-start", _ != null && X && we, R.assistantContent),
|
|
328
|
+
children: [_ != null && X && /* @__PURE__ */ F("div", {
|
|
329
|
+
ref: be,
|
|
330
|
+
className: "absolute inset-s-0 top-0",
|
|
331
|
+
children: _
|
|
332
|
+
}), /* @__PURE__ */ F("div", {
|
|
266
333
|
ref: i,
|
|
267
|
-
className: "cm-bubble-markdown
|
|
268
|
-
children: /* @__PURE__ */
|
|
334
|
+
className: "cm-bubble-markdown max-w-full min-w-0",
|
|
335
|
+
children: /* @__PURE__ */ F(r, {
|
|
269
336
|
content: t ?? "",
|
|
270
|
-
isPlainText:
|
|
271
|
-
isStreaming:
|
|
272
|
-
thinkingLabel:
|
|
273
|
-
components:
|
|
274
|
-
classNames:
|
|
275
|
-
urlTransform:
|
|
276
|
-
codeBlockCopyLabel:
|
|
277
|
-
codeBlockCopiedLabel:
|
|
278
|
-
codeBlockDownloadLabel:
|
|
279
|
-
codeBlockTheme:
|
|
280
|
-
tableActionLabels:
|
|
281
|
-
tableDownloadFilename:
|
|
282
|
-
tableOnOpenInCanvas:
|
|
283
|
-
tableScrollRegionAriaLabel:
|
|
284
|
-
mathScrollRegionAriaLabel:
|
|
337
|
+
isPlainText: v === o.PlainText,
|
|
338
|
+
isStreaming: h,
|
|
339
|
+
thinkingLabel: V,
|
|
340
|
+
components: ee,
|
|
341
|
+
classNames: E,
|
|
342
|
+
urlTransform: O,
|
|
343
|
+
codeBlockCopyLabel: fe,
|
|
344
|
+
codeBlockCopiedLabel: pe,
|
|
345
|
+
codeBlockDownloadLabel: H,
|
|
346
|
+
codeBlockTheme: ne,
|
|
347
|
+
tableActionLabels: ve,
|
|
348
|
+
tableDownloadFilename: q,
|
|
349
|
+
tableOnOpenInCanvas: re,
|
|
350
|
+
tableScrollRegionAriaLabel: ge,
|
|
351
|
+
mathScrollRegionAriaLabel: J
|
|
285
352
|
})
|
|
286
353
|
})]
|
|
287
354
|
}),
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
attachments:
|
|
290
|
-
onAttachmentClick:
|
|
291
|
-
let t =
|
|
292
|
-
t &&
|
|
355
|
+
/* @__PURE__ */ F(p, {
|
|
356
|
+
attachments: ye,
|
|
357
|
+
onAttachmentClick: k ? (e) => {
|
|
358
|
+
let t = g?.find((t) => t.id === e);
|
|
359
|
+
t && k(t);
|
|
293
360
|
} : void 0,
|
|
294
|
-
onDownloadAll:
|
|
295
|
-
onRetry:
|
|
361
|
+
onDownloadAll: A,
|
|
362
|
+
onRetry: te,
|
|
296
363
|
labels: {
|
|
297
|
-
clickLabel:
|
|
298
|
-
downloadLabel:
|
|
299
|
-
retryLabel:
|
|
300
|
-
openInNewTabLabel:
|
|
364
|
+
clickLabel: z,
|
|
365
|
+
downloadLabel: le,
|
|
366
|
+
retryLabel: ue,
|
|
367
|
+
openInNewTabLabel: B
|
|
301
368
|
},
|
|
302
|
-
selectedAttachmentId:
|
|
369
|
+
selectedAttachmentId: j
|
|
303
370
|
}),
|
|
304
|
-
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
...
|
|
307
|
-
isAlwaysVisible:
|
|
371
|
+
y,
|
|
372
|
+
/* @__PURE__ */ F(he, {
|
|
373
|
+
...l,
|
|
374
|
+
isAlwaysVisible: u,
|
|
375
|
+
trailingContent: L == null ? l?.trailingContent : /* @__PURE__ */ I(P, { children: [l?.trailingContent, L] }),
|
|
308
376
|
role: a.Assistant
|
|
309
377
|
})
|
|
310
378
|
]
|
|
311
|
-
}),
|
|
379
|
+
}), x && x.length > 0 && C && /* @__PURE__ */ F("div", {
|
|
312
380
|
role: "list",
|
|
313
|
-
"aria-label":
|
|
314
|
-
className:
|
|
315
|
-
children:
|
|
381
|
+
"aria-label": de,
|
|
382
|
+
className: d("flex w-full flex-wrap gap-2 border-t pt-5", Q.startersDivider),
|
|
383
|
+
children: x.map((e, t) => /* @__PURE__ */ F("div", {
|
|
316
384
|
role: "listitem",
|
|
317
385
|
className: "min-w-[40px]",
|
|
318
|
-
children: /* @__PURE__ */
|
|
386
|
+
children: /* @__PURE__ */ F(S, {
|
|
319
387
|
label: e.title,
|
|
320
388
|
className: "min-w-[40px]",
|
|
321
|
-
onClick: () =>
|
|
389
|
+
onClick: () => C(e)
|
|
322
390
|
})
|
|
323
391
|
}, t))
|
|
324
392
|
})]
|
|
325
393
|
})]
|
|
326
394
|
});
|
|
327
|
-
},
|
|
395
|
+
}, Te = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ F("div", {
|
|
328
396
|
role: "status",
|
|
329
397
|
"aria-live": "polite",
|
|
330
|
-
children: /* @__PURE__ */
|
|
398
|
+
children: /* @__PURE__ */ F(b, {
|
|
331
399
|
title: e,
|
|
332
400
|
message: t,
|
|
333
401
|
textClassName: "flex-row flex-wrap gap-1"
|
|
334
402
|
})
|
|
335
|
-
}),
|
|
403
|
+
}), Ee = /* @__PURE__ */ function(e) {
|
|
336
404
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
337
|
-
}({}),
|
|
338
|
-
let { colors:
|
|
405
|
+
}({}), De = 10, Oe = "[&>div>*:first-child]:mt-0 [&>div>*:last-child]:mb-0", ke = [], Ae = ({ text: e, contentRef: t, position: n = Ee.Bottom, styles: i, actions: o, hasAlwaysVisibleActions: m, timestamp: h, locale: _, attachments: y, collapsedLineCount: b = De, labels: S, textSegments: C, onAttachmentClick: w, onDownloadAll: T, onAttachmentRetry: E, selectedAttachmentId: O, markdownClassNames: k, markdownUrlTransform: A, codeBlockTheme: re, tableOnOpenInCanvas: ie }) => {
|
|
406
|
+
let { colors: j, typography: M, className: ae, bubbleClassName: oe, timestampClassName: se } = i ?? {}, N = h == null ? void 0 : /* @__PURE__ */ F(Ce, {
|
|
407
|
+
timestamp: h,
|
|
408
|
+
locale: _,
|
|
409
|
+
className: se
|
|
410
|
+
}), { showMoreLabel: L = "Show more", showLessLabel: z = "Show less", showMoreAriaLabel: ce, showLessAriaLabel: le, attachmentClickLabel: ue, attachmentDownloadLabel: B, attachmentRetryLabel: de, attachmentOpenInNewTabLabel: V, userMessageAriaLabel: fe = "User message", codeBlockCopyLabel: pe, codeBlockCopiedLabel: H, codeBlockDownloadLabel: U, tableCopyLabel: W, tableCopiedLabel: G, tableDownloadCsvLabel: K, tableOpenInCanvasLabel: q, tableDownloadFilename: ge, tableScrollRegionAriaLabel: J, mathScrollRegionAriaLabel: Y } = S ?? {}, _e = D(() => ({
|
|
411
|
+
copyLabel: W,
|
|
412
|
+
copiedLabel: G,
|
|
413
|
+
downloadCsvLabel: K,
|
|
414
|
+
openInCanvasLabel: q
|
|
415
|
+
}), [
|
|
416
|
+
W,
|
|
417
|
+
G,
|
|
418
|
+
K,
|
|
419
|
+
q
|
|
420
|
+
]), { textRef: ve, isTextCollapsed: ye, isOverflowing: X, collapsedMaxHeight: be, expandedMaxHeight: xe, isCollapsed: Z, toggleCollapsed: Se } = f({
|
|
339
421
|
text: e ?? "",
|
|
340
|
-
collapsedLineCount:
|
|
341
|
-
}),
|
|
342
|
-
"--cm-bubble-user-bg":
|
|
343
|
-
"--cm-bubble-user-border":
|
|
344
|
-
"--cm-bubble-fade-start":
|
|
345
|
-
"--cm-bubble-text":
|
|
346
|
-
"--cm-bubble-collapsed-height":
|
|
347
|
-
"--cm-bubble-expanded-height":
|
|
348
|
-
}),
|
|
349
|
-
|
|
422
|
+
collapsedLineCount: b
|
|
423
|
+
}), we = s({
|
|
424
|
+
"--cm-bubble-user-bg": j?.userBackground,
|
|
425
|
+
"--cm-bubble-user-border": j?.userBorder,
|
|
426
|
+
"--cm-bubble-fade-start": j?.fadeStart,
|
|
427
|
+
"--cm-bubble-text": j?.text,
|
|
428
|
+
"--cm-bubble-collapsed-height": X ? `${be}px` : void 0,
|
|
429
|
+
"--cm-bubble-expanded-height": X ? `${xe}px` : void 0
|
|
430
|
+
}), $ = n === Ee.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", Te = d(Q.text, M?.fontClassName), { markdownSource: Ae, segmentRehypePlugins: je, segmentComponents: Me } = D(() => {
|
|
431
|
+
if (C == null) return {
|
|
432
|
+
markdownSource: e ?? "",
|
|
433
|
+
segmentRehypePlugins: ke,
|
|
434
|
+
segmentComponents: void 0
|
|
435
|
+
};
|
|
436
|
+
let { source: t, inlineSegments: n } = c(C);
|
|
437
|
+
return {
|
|
438
|
+
markdownSource: t,
|
|
439
|
+
segmentRehypePlugins: [u(n)],
|
|
440
|
+
segmentComponents: l(n)
|
|
441
|
+
};
|
|
442
|
+
}, [e, C]), Ne = ce ?? L, Pe = le ?? z, Fe = Z ? L : z, Ie = Z ? Ne : Pe, Le = Z ? te : ne, Re = ee();
|
|
443
|
+
return /* @__PURE__ */ F("div", {
|
|
350
444
|
role: "group",
|
|
351
|
-
"aria-label":
|
|
352
|
-
style:
|
|
353
|
-
onCopy:
|
|
354
|
-
className:
|
|
355
|
-
children: /* @__PURE__ */
|
|
356
|
-
className: "ms-auto flex w-fit
|
|
445
|
+
"aria-label": fe,
|
|
446
|
+
style: we,
|
|
447
|
+
onCopy: me,
|
|
448
|
+
className: d("group/message flex w-full", ae),
|
|
449
|
+
children: /* @__PURE__ */ I("div", {
|
|
450
|
+
className: "ms-auto flex w-fit max-w-full min-w-0 flex-col items-end gap-4",
|
|
357
451
|
children: [
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
attachments:
|
|
360
|
-
onAttachmentClick:
|
|
361
|
-
let t =
|
|
362
|
-
t &&
|
|
452
|
+
/* @__PURE__ */ F(p, {
|
|
453
|
+
attachments: y ?? [],
|
|
454
|
+
onAttachmentClick: w ? (e) => {
|
|
455
|
+
let t = y?.find((t) => t.id === e);
|
|
456
|
+
t && w(t);
|
|
363
457
|
} : void 0,
|
|
364
|
-
onDownloadAll:
|
|
365
|
-
onRetry:
|
|
458
|
+
onDownloadAll: T,
|
|
459
|
+
onRetry: E,
|
|
366
460
|
labels: {
|
|
367
|
-
clickLabel:
|
|
368
|
-
downloadLabel:
|
|
369
|
-
retryLabel:
|
|
370
|
-
openInNewTabLabel:
|
|
461
|
+
clickLabel: ue,
|
|
462
|
+
downloadLabel: B,
|
|
463
|
+
retryLabel: de,
|
|
464
|
+
openInNewTabLabel: V
|
|
371
465
|
},
|
|
372
466
|
styles: { className: "max-w-[640px]" },
|
|
373
|
-
selectedAttachmentId:
|
|
467
|
+
selectedAttachmentId: O
|
|
374
468
|
}),
|
|
375
|
-
e && /* @__PURE__ */
|
|
376
|
-
className:
|
|
377
|
-
children: /* @__PURE__ */
|
|
469
|
+
e && /* @__PURE__ */ F("div", {
|
|
470
|
+
className: d(Q.userBubble, "flex w-fit max-w-full min-w-0 items-center justify-end rounded-ss-2xl rounded-es-2xl border px-6 py-4 wrap-anywhere", $, oe, R.userBubble),
|
|
471
|
+
children: /* @__PURE__ */ I("div", {
|
|
378
472
|
className: "flex min-w-0 flex-col items-start",
|
|
379
|
-
children: [/* @__PURE__ */
|
|
380
|
-
id:
|
|
473
|
+
children: [/* @__PURE__ */ F("div", {
|
|
474
|
+
id: Re,
|
|
381
475
|
ref: t,
|
|
382
|
-
className:
|
|
383
|
-
children: /* @__PURE__ */
|
|
384
|
-
ref:
|
|
385
|
-
className:
|
|
386
|
-
children:
|
|
476
|
+
className: d("relative -ms-1 -me-1 w-[calc(100%+8px)] overflow-hidden ps-1 pe-1", X && Q.collapsibleText, X && !Z && Q.expandedText, ye && Q.collapsedText),
|
|
477
|
+
children: /* @__PURE__ */ F("div", {
|
|
478
|
+
ref: ve,
|
|
479
|
+
className: d(Te, "max-w-full min-w-0 text-start", Oe),
|
|
480
|
+
children: /* @__PURE__ */ F(r, {
|
|
481
|
+
content: Ae,
|
|
482
|
+
isRawHtmlEnabled: !1,
|
|
483
|
+
rehypePlugins: je,
|
|
484
|
+
components: Me,
|
|
485
|
+
classNames: k,
|
|
486
|
+
urlTransform: A,
|
|
487
|
+
codeBlockCopyLabel: pe,
|
|
488
|
+
codeBlockCopiedLabel: H,
|
|
489
|
+
codeBlockDownloadLabel: U,
|
|
490
|
+
codeBlockTheme: re,
|
|
491
|
+
tableActionLabels: _e,
|
|
492
|
+
tableDownloadFilename: ge,
|
|
493
|
+
tableOnOpenInCanvas: ie,
|
|
494
|
+
tableScrollRegionAriaLabel: J,
|
|
495
|
+
mathScrollRegionAriaLabel: Y
|
|
496
|
+
})
|
|
387
497
|
})
|
|
388
|
-
}),
|
|
389
|
-
label: /* @__PURE__ */
|
|
390
|
-
iconBefore: /* @__PURE__ */
|
|
391
|
-
size:
|
|
498
|
+
}), X && /* @__PURE__ */ F(x, {
|
|
499
|
+
label: /* @__PURE__ */ F(P, { children: Fe }),
|
|
500
|
+
iconBefore: /* @__PURE__ */ F(Le, {
|
|
501
|
+
size: g.SM,
|
|
392
502
|
"aria-hidden": "true"
|
|
393
503
|
}),
|
|
394
|
-
"aria-label":
|
|
395
|
-
"aria-expanded": !
|
|
396
|
-
"aria-controls":
|
|
504
|
+
"aria-label": Ie,
|
|
505
|
+
"aria-expanded": !Z,
|
|
506
|
+
"aria-controls": Re,
|
|
397
507
|
className: "mt-3",
|
|
398
|
-
onClick:
|
|
399
|
-
size:
|
|
508
|
+
onClick: Se,
|
|
509
|
+
size: v.Small
|
|
400
510
|
})]
|
|
401
511
|
})
|
|
402
512
|
}),
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
...
|
|
405
|
-
isAlwaysVisible:
|
|
513
|
+
/* @__PURE__ */ F(he, {
|
|
514
|
+
...o,
|
|
515
|
+
isAlwaysVisible: m,
|
|
516
|
+
leadingContent: N == null ? o?.leadingContent : /* @__PURE__ */ I(P, { children: [N, o?.leadingContent] }),
|
|
406
517
|
role: a.User
|
|
407
518
|
})
|
|
408
519
|
]
|
|
409
520
|
})
|
|
410
521
|
});
|
|
411
|
-
},
|
|
522
|
+
}, je = ({ role: e, beforeContent: t, textSegments: n, onAttachmentClick: r, responseFormat: i, markdownComponents: o, markdownUrlTransform: s, ...c }) => e === a.Status ? /* @__PURE__ */ F(Te, { labels: {
|
|
412
523
|
titleText: c.labels?.statusTitleText,
|
|
413
524
|
bodyText: c.labels?.statusBodyText ?? ""
|
|
414
|
-
} }) : e === a.User ? /* @__PURE__ */
|
|
525
|
+
} }) : e === a.User ? /* @__PURE__ */ F(Ae, {
|
|
415
526
|
...c,
|
|
416
527
|
textSegments: n,
|
|
528
|
+
markdownUrlTransform: s,
|
|
417
529
|
onAttachmentClick: r
|
|
418
|
-
}) : /* @__PURE__ */
|
|
530
|
+
}) : /* @__PURE__ */ F($, {
|
|
419
531
|
...c,
|
|
420
532
|
beforeContent: t,
|
|
421
533
|
responseFormat: i,
|
|
422
534
|
markdownComponents: o,
|
|
423
535
|
markdownUrlTransform: s,
|
|
424
536
|
onAttachmentClick: r
|
|
425
|
-
}),
|
|
426
|
-
let { colors:
|
|
427
|
-
"--cm-reply-background":
|
|
428
|
-
"--cm-reply-hover-background":
|
|
429
|
-
"--cm-reply-text":
|
|
430
|
-
}), [b, x] =
|
|
537
|
+
}), Me = { button: "_button_tqo4d_3" }, Ne = ({ rect: e, actionRef: t, onReply: n, addedRevision: r, labels: i, styles: a, portalContainer: o }) => {
|
|
538
|
+
let { colors: c, typography: l, className: u, buttonClassName: f } = a ?? {}, p = l?.fontClassName ?? "dial-small-text", g = o === void 0 ? typeof document > "u" ? null : document.body : o, y = s({
|
|
539
|
+
"--cm-reply-background": c?.background,
|
|
540
|
+
"--cm-reply-hover-background": c?.hoverBackground,
|
|
541
|
+
"--cm-reply-text": c?.text
|
|
542
|
+
}), [b, x] = k({
|
|
431
543
|
x: 0,
|
|
432
544
|
y: 0
|
|
433
545
|
});
|
|
434
|
-
return
|
|
546
|
+
return E(() => {
|
|
435
547
|
if (!e || !t.current) return;
|
|
436
548
|
let n = t.current.getBoundingClientRect(), r = window.visualViewport, i = r?.offsetLeft ?? 0, a = r?.offsetTop ?? 0, o = r?.width ?? document.documentElement.clientWidth, s = r?.height ?? document.documentElement.clientHeight, c = e.top - n.height - 8 >= a + 8 ? e.top - n.height - 8 : e.bottom + 8;
|
|
437
549
|
x({
|
|
@@ -441,38 +553,47 @@ var z = {
|
|
|
441
553
|
}, [
|
|
442
554
|
e,
|
|
443
555
|
t,
|
|
444
|
-
v,
|
|
445
|
-
p,
|
|
446
556
|
g,
|
|
447
|
-
|
|
557
|
+
u,
|
|
558
|
+
f,
|
|
559
|
+
p,
|
|
448
560
|
i.reply
|
|
449
|
-
]),
|
|
561
|
+
]), g ? L(/* @__PURE__ */ I(P, { children: [e && /* @__PURE__ */ F("div", {
|
|
450
562
|
ref: t,
|
|
451
|
-
className:
|
|
563
|
+
className: d("fixed top-0 left-0 z-50 max-w-[calc(100vw-16px)]", u),
|
|
452
564
|
style: {
|
|
453
565
|
...y,
|
|
454
566
|
transform: `translate(${b.x}px, ${b.y}px)`
|
|
455
567
|
},
|
|
456
|
-
children: /* @__PURE__ */
|
|
457
|
-
variant:
|
|
458
|
-
size:
|
|
568
|
+
children: /* @__PURE__ */ F(m, {
|
|
569
|
+
variant: h.Neutral,
|
|
570
|
+
size: v.Small,
|
|
459
571
|
label: i.reply,
|
|
460
572
|
onClick: n,
|
|
461
|
-
textClassName:
|
|
462
|
-
className:
|
|
463
|
-
iconAfter: /* @__PURE__ */
|
|
573
|
+
textClassName: p,
|
|
574
|
+
className: d(Me.button, "h-8 min-h-8 min-w-11 px-2 shadow-lg mobile:h-11 mobile:min-h-11", f),
|
|
575
|
+
iconAfter: /* @__PURE__ */ F(A, {
|
|
464
576
|
size: 16,
|
|
465
|
-
stroke:
|
|
577
|
+
stroke: _,
|
|
466
578
|
"aria-hidden": "true",
|
|
467
579
|
className: "rtl:scale-x-[-1]"
|
|
468
580
|
})
|
|
469
581
|
})
|
|
470
|
-
}), /* @__PURE__ */
|
|
582
|
+
}), /* @__PURE__ */ F("div", {
|
|
471
583
|
role: "status",
|
|
472
584
|
"aria-live": "polite",
|
|
473
585
|
className: "sr-only",
|
|
474
|
-
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */
|
|
475
|
-
})] }),
|
|
586
|
+
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */ F("span", { children: i.attachmentAdded }, r) : null
|
|
587
|
+
})] }), g) : null;
|
|
588
|
+
}, Pe = (e) => `Today ${e}`, Fe = (e) => `Yesterday ${e}`, Ie = ({ timestamp: e, locale: t, labels: n, className: r = "dial-small-text text-secondary" }) => {
|
|
589
|
+
let i = ye(e);
|
|
590
|
+
if (i == null) return null;
|
|
591
|
+
let { kind: a, text: o } = be(i, /* @__PURE__ */ new Date(), t), s = o;
|
|
592
|
+
return a === G.Today ? s = (n?.today ?? Pe)(o) : a === G.Yesterday && (s = (n?.yesterday ?? Fe)(o)), /* @__PURE__ */ F("time", {
|
|
593
|
+
dateTime: e,
|
|
594
|
+
className: d("self-center text-center", r),
|
|
595
|
+
children: s
|
|
596
|
+
});
|
|
476
597
|
};
|
|
477
598
|
//#endregion
|
|
478
|
-
export {
|
|
599
|
+
export { $ as AssistantMessageBubble, Ee as BubblePosition, R as CONVERSATION_MESSAGES_CLASS, Ie as ConversationStartTimestamp, he as MessageActions, je as MessageBubble, Ne as MessageSelectionReply, Te as StatusMessageBubble, Ae as UserMessageBubble };
|