@bikdotai/bik-component-library 0.0.868 → 0.0.869
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/dist/cjs/components/bik-copilot/ControlledCopilot.js +1 -1
- package/dist/cjs/components/bik-copilot/ControlledCopilot.js.map +1 -1
- package/dist/cjs/components/bik-copilot/CopilotPanel.js +1 -1
- package/dist/cjs/components/bik-copilot/CopilotPanel.js.map +1 -1
- package/dist/cjs/components/bik-copilot/CopilotPanel.styled.js +53 -12
- package/dist/cjs/components/bik-copilot/CopilotPanel.styled.js.map +1 -1
- package/dist/cjs/components/bik-copilot/copilotSelectionPrompt.js +2 -0
- package/dist/cjs/components/bik-copilot/copilotSelectionPrompt.js.map +1 -0
- package/dist/cjs/components/text-selection-ask/SelectionAskPill.js +2 -0
- package/dist/cjs/components/text-selection-ask/SelectionAskPill.js.map +1 -0
- package/dist/cjs/components/text-selection-ask/SelectionAskPill.styled.js +32 -0
- package/dist/cjs/components/text-selection-ask/SelectionAskPill.styled.js.map +1 -0
- package/dist/cjs/components/text-selection-ask/TextSelectionAsk.js +2 -0
- package/dist/cjs/components/text-selection-ask/TextSelectionAsk.js.map +1 -0
- package/dist/cjs/components/text-selection-ask/model.js +2 -0
- package/dist/cjs/components/text-selection-ask/model.js.map +1 -0
- package/dist/cjs/components/text-selection-ask/selectionText.js +2 -0
- package/dist/cjs/components/text-selection-ask/selectionText.js.map +1 -0
- package/dist/cjs/components/text-selection-ask/useTextSelectionAsk.js +2 -0
- package/dist/cjs/components/text-selection-ask/useTextSelectionAsk.js.map +1 -0
- package/dist/cjs/icons/Informational/Common UI/SquaresFour.js +2 -0
- package/dist/cjs/icons/Informational/Common UI/SquaresFour.js.map +1 -0
- package/dist/cjs/icons/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/bik-copilot/ControlledCopilot.js +34 -30
- package/dist/esm/components/bik-copilot/ControlledCopilot.js.map +1 -1
- package/dist/esm/components/bik-copilot/CopilotPanel.js +261 -237
- package/dist/esm/components/bik-copilot/CopilotPanel.js.map +1 -1
- package/dist/esm/components/bik-copilot/CopilotPanel.styled.d.ts +8 -0
- package/dist/esm/components/bik-copilot/CopilotPanel.styled.js +69 -25
- package/dist/esm/components/bik-copilot/CopilotPanel.styled.js.map +1 -1
- package/dist/esm/components/bik-copilot/copilotSelectionPrompt.d.ts +13 -0
- package/dist/esm/components/bik-copilot/copilotSelectionPrompt.js +8 -0
- package/dist/esm/components/bik-copilot/copilotSelectionPrompt.js.map +1 -0
- package/dist/esm/components/bik-copilot/model.d.ts +19 -0
- package/dist/esm/components/text-selection-ask/SelectionAskPill.d.ts +22 -0
- package/dist/esm/components/text-selection-ask/SelectionAskPill.js +44 -0
- package/dist/esm/components/text-selection-ask/SelectionAskPill.js.map +1 -0
- package/dist/esm/components/text-selection-ask/SelectionAskPill.styled.d.ts +5 -0
- package/dist/esm/components/text-selection-ask/SelectionAskPill.styled.js +37 -0
- package/dist/esm/components/text-selection-ask/SelectionAskPill.styled.js.map +1 -0
- package/dist/esm/components/text-selection-ask/TextSelectionAsk.d.ts +36 -0
- package/dist/esm/components/text-selection-ask/TextSelectionAsk.js +69 -0
- package/dist/esm/components/text-selection-ask/TextSelectionAsk.js.map +1 -0
- package/dist/esm/components/text-selection-ask/index.d.ts +7 -0
- package/dist/esm/components/text-selection-ask/model.d.ts +112 -0
- package/dist/esm/components/text-selection-ask/model.js +7 -0
- package/dist/esm/components/text-selection-ask/model.js.map +1 -0
- package/dist/esm/components/text-selection-ask/selectionText.d.ts +18 -0
- package/dist/esm/components/text-selection-ask/selectionText.js +7 -0
- package/dist/esm/components/text-selection-ask/selectionText.js.map +1 -0
- package/dist/esm/components/text-selection-ask/useTextSelectionAsk.d.ts +15 -0
- package/dist/esm/components/text-selection-ask/useTextSelectionAsk.js +53 -0
- package/dist/esm/components/text-selection-ask/useTextSelectionAsk.js.map +1 -0
- package/dist/esm/icons/Informational/Common UI/SquaresFour.d.ts +7 -0
- package/dist/esm/icons/Informational/Common UI/SquaresFour.js +33 -0
- package/dist/esm/icons/Informational/Common UI/SquaresFour.js.map +1 -0
- package/dist/esm/icons/Informational/Common UI/index.d.ts +1 -0
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/icons/index.js +158 -156
- package/dist/esm/icons/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +403 -388
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { COLORS as
|
|
8
|
-
import { TitleSmall as
|
|
9
|
-
import { CopilotFeedbackModal as
|
|
10
|
-
import { PanelContainer as
|
|
11
|
-
import { isCopilotRegeneratePrompt as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
1
|
+
import { jsxs as r, jsx as t, Fragment as Oe } from "react/jsx-runtime";
|
|
2
|
+
import Ue from "../../assets/icons/arrow_down.svg.js";
|
|
3
|
+
import C from "../../assets/icons/bik_ai_stars_icon.svg.js";
|
|
4
|
+
import de from "../../assets/icons/cross.svg.js";
|
|
5
|
+
import Ve from "../../assets/icons/refresh.svg.js";
|
|
6
|
+
import De, { useState as u, useRef as p, useEffect as S } from "react";
|
|
7
|
+
import { COLORS as f } from "../../constants/Theme.js";
|
|
8
|
+
import { TitleSmall as Ke, BodyCaption as ae, BodySecondary as Xe } from "../TypographyStyle.js";
|
|
9
|
+
import { CopilotFeedbackModal as Ge } from "./CopilotFeedbackModal.js";
|
|
10
|
+
import { PanelContainer as ze, PanelHeader as Je, HeaderAvatar as Ze, HeaderText as qe, HeaderTitleRow as Qe, HeaderBadge as Ye, HeaderActions as et, IconAction as he, MessagesViewport as tt, MessagesArea as rt, EmptyState as ot, EmptyStateIcon as nt, SuggestionList as it, SuggestionChip as lt, HistoryLoader as ct, MessageBubble as dt, ToolCtaList as at, ToolCtaLink as ht, MessageTimestamp as st, InterruptedNote as ut, MessageActions as pt, MessageAction as x, FollowUpList as ft, FollowUpsLabel as kt, FollowUpChip as wt, ThinkingBubble as Ct, ThinkingLabel as bt, ScrollFade as yt, JumpToLatestButton as mt, ErrorBanner as vt, InputArea as gt, AttachmentChip as Tt, AttachmentText as St, AttachmentRemove as xt, InputWrapper as At, MessageInput as Mt, SendButton as It, Disclaimer as Lt } from "./CopilotPanel.styled.js";
|
|
11
|
+
import { isCopilotRegeneratePrompt as Bt } from "./copilotRegenerate.js";
|
|
12
|
+
import { buildCopilotSelectionPrompt as Rt } from "./copilotSelectionPrompt.js";
|
|
13
|
+
import { renderCopilotMarkdown as Ht } from "./utils/markdown.js";
|
|
14
|
+
import { toolResultCtas as Ft } from "./utils/toolCtas.js";
|
|
15
|
+
import { DotPulse as se } from "../dot-pulse/DotPulse.js";
|
|
16
|
+
const Et = 96, _t = 24, Pt = 1800, Wt = async (n) => {
|
|
16
17
|
try {
|
|
17
18
|
if (navigator.clipboard?.writeText)
|
|
18
19
|
return await navigator.clipboard.writeText(n), !0;
|
|
@@ -21,12 +22,12 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
21
22
|
try {
|
|
22
23
|
const i = document.createElement("textarea");
|
|
23
24
|
i.value = n, i.setAttribute("readonly", ""), i.style.position = "fixed", i.style.top = "-1000px", i.style.opacity = "0", document.body.appendChild(i), i.select();
|
|
24
|
-
const
|
|
25
|
-
return document.body.removeChild(i),
|
|
25
|
+
const A = document.execCommand("copy");
|
|
26
|
+
return document.body.removeChild(i), A;
|
|
26
27
|
} catch {
|
|
27
28
|
return !1;
|
|
28
29
|
}
|
|
29
|
-
},
|
|
30
|
+
}, jt = 48, Nt = (n) => {
|
|
30
31
|
if (!n || !Number.isFinite(n))
|
|
31
32
|
return "";
|
|
32
33
|
const i = new Date(n);
|
|
@@ -34,7 +35,7 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
34
35
|
hour: "numeric",
|
|
35
36
|
minute: "2-digit"
|
|
36
37
|
});
|
|
37
|
-
},
|
|
38
|
+
}, $t = () => /* @__PURE__ */ r(
|
|
38
39
|
"svg",
|
|
39
40
|
{
|
|
40
41
|
viewBox: "0 0 24 24",
|
|
@@ -51,7 +52,7 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
51
52
|
/* @__PURE__ */ t("path", { d: "M6 11l6-6 6 6" })
|
|
52
53
|
]
|
|
53
54
|
}
|
|
54
|
-
),
|
|
55
|
+
), Ot = () => /* @__PURE__ */ r(
|
|
55
56
|
"svg",
|
|
56
57
|
{
|
|
57
58
|
viewBox: "0 0 24 24",
|
|
@@ -68,7 +69,7 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
68
69
|
/* @__PURE__ */ t("path", { d: "M13 6l6 6-6 6" })
|
|
69
70
|
]
|
|
70
71
|
}
|
|
71
|
-
),
|
|
72
|
+
), ue = ({ size: n = 16 }) => /* @__PURE__ */ t(
|
|
72
73
|
"svg",
|
|
73
74
|
{
|
|
74
75
|
viewBox: "0 0 24 24",
|
|
@@ -78,7 +79,7 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
78
79
|
"aria-hidden": "true",
|
|
79
80
|
children: /* @__PURE__ */ t("rect", { x: "7", y: "7", width: "10", height: "10", rx: "2" })
|
|
80
81
|
}
|
|
81
|
-
),
|
|
82
|
+
), Ut = () => /* @__PURE__ */ r(
|
|
82
83
|
"svg",
|
|
83
84
|
{
|
|
84
85
|
viewBox: "0 0 24 24",
|
|
@@ -95,7 +96,7 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
95
96
|
/* @__PURE__ */ t("path", { d: "M15 5.5A1.5 1.5 0 0 0 13.5 4H5.5A1.5 1.5 0 0 0 4 5.5v8A1.5 1.5 0 0 0 5.5 15" })
|
|
96
97
|
]
|
|
97
98
|
}
|
|
98
|
-
),
|
|
99
|
+
), Vt = () => /* @__PURE__ */ t(
|
|
99
100
|
"svg",
|
|
100
101
|
{
|
|
101
102
|
viewBox: "0 0 24 24",
|
|
@@ -109,7 +110,7 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
109
110
|
"aria-hidden": "true",
|
|
110
111
|
children: /* @__PURE__ */ t("path", { d: "M5 13l4 4L19 7" })
|
|
111
112
|
}
|
|
112
|
-
),
|
|
113
|
+
), Dt = () => /* @__PURE__ */ r(
|
|
113
114
|
"svg",
|
|
114
115
|
{
|
|
115
116
|
viewBox: "0 0 24 24",
|
|
@@ -126,7 +127,7 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
126
127
|
/* @__PURE__ */ t("path", { d: "M20 4v4h-4" })
|
|
127
128
|
]
|
|
128
129
|
}
|
|
129
|
-
),
|
|
130
|
+
), Kt = ({ filled: n = !1 }) => /* @__PURE__ */ r(
|
|
130
131
|
"svg",
|
|
131
132
|
{
|
|
132
133
|
viewBox: "0 0 24 24",
|
|
@@ -143,7 +144,7 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
143
144
|
/* @__PURE__ */ t("path", { d: "M7 10l4.5-7a2 2 0 0 1 3.7 1.3L14.5 9H19a2 2 0 0 1 2 2.3l-1.1 7A2 2 0 0 1 18 20H7" })
|
|
144
145
|
]
|
|
145
146
|
}
|
|
146
|
-
),
|
|
147
|
+
), Xt = ({ filled: n = !1 }) => /* @__PURE__ */ r(
|
|
147
148
|
"svg",
|
|
148
149
|
{
|
|
149
150
|
viewBox: "0 0 24 24",
|
|
@@ -160,211 +161,219 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
160
161
|
/* @__PURE__ */ t("path", { d: "M7 14l4.5 7a2 2 0 0 0 3.7-1.3L14.5 15H19a2 2 0 0 0 2-2.3l-1.1-7A2 2 0 0 0 18 4H7" })
|
|
161
162
|
]
|
|
162
163
|
}
|
|
163
|
-
),
|
|
164
|
+
), dr = ({
|
|
164
165
|
messages: n,
|
|
165
166
|
onSend: i,
|
|
166
|
-
onClose:
|
|
167
|
-
title:
|
|
168
|
-
badge:
|
|
169
|
-
subtitle:
|
|
170
|
-
avatar:
|
|
171
|
-
placeholder:
|
|
172
|
-
disclaimer:
|
|
173
|
-
emptyStateTitle:
|
|
174
|
-
emptyStateSubtitle:
|
|
167
|
+
onClose: A,
|
|
168
|
+
title: b = "Copilot",
|
|
169
|
+
badge: O,
|
|
170
|
+
subtitle: U,
|
|
171
|
+
avatar: pe,
|
|
172
|
+
placeholder: fe = "Write your message...",
|
|
173
|
+
disclaimer: V = "AI can make mistakes, Verify the responses.",
|
|
174
|
+
emptyStateTitle: ke,
|
|
175
|
+
emptyStateSubtitle: D = "Here are some things you can try",
|
|
175
176
|
suggestions: M,
|
|
176
|
-
onSuggestionClick:
|
|
177
|
-
showRefresh:
|
|
178
|
-
onRefresh:
|
|
179
|
-
onRegenerate:
|
|
177
|
+
onSuggestionClick: we,
|
|
178
|
+
showRefresh: Ce = !0,
|
|
179
|
+
onRefresh: K,
|
|
180
|
+
onRegenerate: X,
|
|
180
181
|
onFeedback: I,
|
|
181
|
-
dislikeTitle:
|
|
182
|
-
dislikeSubtitle:
|
|
183
|
-
dislikeReasons:
|
|
184
|
-
dislikeNotePlaceholder:
|
|
185
|
-
dislikeSubmitLabel:
|
|
186
|
-
isThinking:
|
|
187
|
-
thinkingLabel:
|
|
188
|
-
isStreaming:
|
|
189
|
-
onStop:
|
|
190
|
-
interruptedLabel:
|
|
191
|
-
followUpsLabel:
|
|
192
|
-
onToolCtaClick:
|
|
193
|
-
hasMoreHistory:
|
|
182
|
+
dislikeTitle: be,
|
|
183
|
+
dislikeSubtitle: ye,
|
|
184
|
+
dislikeReasons: me,
|
|
185
|
+
dislikeNotePlaceholder: ve,
|
|
186
|
+
dislikeSubmitLabel: ge,
|
|
187
|
+
isThinking: y = !1,
|
|
188
|
+
thinkingLabel: G = "Thinking",
|
|
189
|
+
isStreaming: Te = !1,
|
|
190
|
+
onStop: z,
|
|
191
|
+
interruptedLabel: J = "This message was interrupted",
|
|
192
|
+
followUpsLabel: Z = "Follow ups",
|
|
193
|
+
onToolCtaClick: Se,
|
|
194
|
+
hasMoreHistory: xe = !1,
|
|
194
195
|
isLoadingHistory: m = !1,
|
|
195
|
-
onLoadOlderMessages:
|
|
196
|
-
historyLoadingLabel:
|
|
196
|
+
onLoadOlderMessages: q,
|
|
197
|
+
historyLoadingLabel: Ae = "Loading earlier messages",
|
|
197
198
|
inputDisabled: d = !1,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
attachment: a,
|
|
200
|
+
onAttachmentRemove: Q,
|
|
201
|
+
errorMessage: Y,
|
|
202
|
+
width: Me,
|
|
203
|
+
height: Ie,
|
|
204
|
+
className: Le,
|
|
205
|
+
style: Be
|
|
203
206
|
}) => {
|
|
204
|
-
const [
|
|
205
|
-
(e) => (e.content.length > 0 || e.wasInterrupted) && !
|
|
206
|
-
),
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}, [n,
|
|
210
|
-
const e =
|
|
211
|
-
!e ||
|
|
207
|
+
const [L, ee] = u(""), [Re, te] = u(!1), [B, R] = u(!0), [v, re] = u(null), [s, He] = u({}), [g, H] = u(null), F = p(null), k = p(null), E = p(null), _ = p(null), P = p(0), W = p(null), T = n.filter(
|
|
208
|
+
(e) => (e.content.length > 0 || e.wasInterrupted) && !Bt(e.content)
|
|
209
|
+
), oe = T.length === 0 && !y, h = y || Te, ne = !d && !h && (L.trim().length > 0 || !!a), w = h && !!z, j = T[T.length - 1], N = !h && j?.role === "assistant" ? j.followUps : void 0, $ = !oe && !B;
|
|
210
|
+
S(() => {
|
|
211
|
+
B && E.current?.scrollIntoView({ behavior: "smooth" });
|
|
212
|
+
}, [n, y, B]), S(() => {
|
|
213
|
+
const e = _.current, o = W.current;
|
|
214
|
+
!e || o === null || m || (W.current = null, e.scrollTop = e.scrollHeight - o, P.current = e.scrollTop);
|
|
212
215
|
}, [n, m]);
|
|
213
|
-
const
|
|
214
|
-
const e =
|
|
216
|
+
const Fe = () => {
|
|
217
|
+
const e = _.current;
|
|
215
218
|
if (!e)
|
|
216
219
|
return;
|
|
217
|
-
const
|
|
218
|
-
e.scrollTop <=
|
|
219
|
-
const c = e.scrollTop <
|
|
220
|
-
if (
|
|
221
|
-
|
|
220
|
+
const o = e.scrollHeight - e.scrollTop - e.clientHeight;
|
|
221
|
+
e.scrollTop <= jt && xe && !m && q && (W.current = e.scrollHeight - e.scrollTop, q());
|
|
222
|
+
const c = e.scrollTop < P.current - 1;
|
|
223
|
+
if (P.current = e.scrollTop, o <= _t) {
|
|
224
|
+
R(!0);
|
|
222
225
|
return;
|
|
223
226
|
}
|
|
224
|
-
c &&
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
+
c && R(!1);
|
|
228
|
+
}, Ee = () => {
|
|
229
|
+
R(!0), E.current?.scrollIntoView({ behavior: "smooth" });
|
|
227
230
|
};
|
|
228
|
-
|
|
231
|
+
S(
|
|
229
232
|
() => () => {
|
|
230
|
-
|
|
233
|
+
k.current && window.clearTimeout(k.current);
|
|
231
234
|
},
|
|
232
235
|
[]
|
|
233
236
|
);
|
|
234
|
-
const
|
|
235
|
-
await
|
|
236
|
-
() =>
|
|
237
|
-
|
|
237
|
+
const _e = async (e) => {
|
|
238
|
+
await Wt(e.content) && (k.current && window.clearTimeout(k.current), re(e.id), k.current = window.setTimeout(
|
|
239
|
+
() => re(null),
|
|
240
|
+
Pt
|
|
238
241
|
));
|
|
239
|
-
},
|
|
240
|
-
const c = s[e] ===
|
|
241
|
-
if (
|
|
242
|
+
}, ie = (e, o) => {
|
|
243
|
+
const c = s[e] === o;
|
|
244
|
+
if (He((l) => ({
|
|
242
245
|
...l,
|
|
243
|
-
[e]: l[e] ===
|
|
246
|
+
[e]: l[e] === o ? void 0 : o
|
|
244
247
|
})), c) {
|
|
245
|
-
|
|
248
|
+
o === "dislike" && H(
|
|
246
249
|
(l) => l === e ? null : l
|
|
247
250
|
);
|
|
248
251
|
return;
|
|
249
252
|
}
|
|
250
|
-
if (
|
|
253
|
+
if (o === "like") {
|
|
251
254
|
I?.(e, "like");
|
|
252
255
|
return;
|
|
253
256
|
}
|
|
254
|
-
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
},
|
|
258
|
-
d ||
|
|
259
|
-
},
|
|
260
|
-
const e =
|
|
261
|
-
if (!e || d ||
|
|
257
|
+
g && g !== e && I?.(g, "dislike"), H(e);
|
|
258
|
+
}, le = (e, o) => {
|
|
259
|
+
H((c) => c === e ? null : c), I?.(e, "dislike", o);
|
|
260
|
+
}, Pe = () => {
|
|
261
|
+
d || h || X?.();
|
|
262
|
+
}, ce = () => {
|
|
263
|
+
const e = L.trim();
|
|
264
|
+
if (!e && !a || d || h)
|
|
262
265
|
return;
|
|
263
|
-
i(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
266
|
+
i(
|
|
267
|
+
a ? Rt(a, e) : e
|
|
268
|
+
), ee(""), Q?.();
|
|
269
|
+
const o = F.current;
|
|
270
|
+
o && (o.style.height = "auto");
|
|
271
|
+
};
|
|
272
|
+
S(() => {
|
|
273
|
+
a && F.current?.focus();
|
|
274
|
+
}, [a]);
|
|
275
|
+
const We = (e) => {
|
|
276
|
+
ee(e.target.value);
|
|
277
|
+
const o = e.target;
|
|
278
|
+
o.style.height = "auto", o.style.height = `${Math.min(
|
|
279
|
+
o.scrollHeight,
|
|
280
|
+
Et
|
|
272
281
|
)}px`;
|
|
273
|
-
},
|
|
274
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(),
|
|
275
|
-
},
|
|
276
|
-
d ||
|
|
277
|
-
},
|
|
278
|
-
d ||
|
|
282
|
+
}, je = (e) => {
|
|
283
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), ce());
|
|
284
|
+
}, Ne = (e) => {
|
|
285
|
+
d || h || (we?.(e), i(e.text));
|
|
286
|
+
}, $e = (e) => {
|
|
287
|
+
d || h || i(e);
|
|
279
288
|
};
|
|
280
|
-
return /* @__PURE__ */
|
|
281
|
-
|
|
289
|
+
return /* @__PURE__ */ r(
|
|
290
|
+
ze,
|
|
282
291
|
{
|
|
283
|
-
className:
|
|
284
|
-
style: { width:
|
|
292
|
+
className: Le,
|
|
293
|
+
style: { width: Me, height: Ie, ...Be },
|
|
285
294
|
role: "dialog",
|
|
286
|
-
"aria-label":
|
|
295
|
+
"aria-label": b,
|
|
287
296
|
children: [
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
/* @__PURE__ */ t(
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */ t(
|
|
293
|
-
|
|
297
|
+
/* @__PURE__ */ r(Je, { children: [
|
|
298
|
+
/* @__PURE__ */ t(Ze, { children: pe ?? /* @__PURE__ */ t(C, { width: 18, height: 18 }) }),
|
|
299
|
+
/* @__PURE__ */ r(qe, { children: [
|
|
300
|
+
/* @__PURE__ */ r(Qe, { children: [
|
|
301
|
+
/* @__PURE__ */ t(Ke, { children: b }),
|
|
302
|
+
O && /* @__PURE__ */ t(Ye, { children: O })
|
|
294
303
|
] }),
|
|
295
|
-
|
|
304
|
+
U && /* @__PURE__ */ t(ae, { color: f.content.secondary, children: U })
|
|
296
305
|
] }),
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
|
|
299
|
-
|
|
306
|
+
/* @__PURE__ */ r(et, { children: [
|
|
307
|
+
Ce && K && /* @__PURE__ */ t(
|
|
308
|
+
he,
|
|
300
309
|
{
|
|
301
310
|
type: "button",
|
|
302
|
-
onClick:
|
|
311
|
+
onClick: K,
|
|
303
312
|
"aria-label": "Start a new conversation",
|
|
304
|
-
children: /* @__PURE__ */ t(
|
|
313
|
+
children: /* @__PURE__ */ t(Ve, { width: 16, height: 16 })
|
|
305
314
|
}
|
|
306
315
|
),
|
|
307
316
|
/* @__PURE__ */ t(
|
|
308
|
-
|
|
317
|
+
he,
|
|
309
318
|
{
|
|
310
319
|
type: "button",
|
|
311
|
-
onClick:
|
|
320
|
+
onClick: A,
|
|
312
321
|
"aria-label": "Close copilot",
|
|
313
|
-
children: /* @__PURE__ */ t(
|
|
322
|
+
children: /* @__PURE__ */ t(de, { width: 18, height: 18 })
|
|
314
323
|
}
|
|
315
324
|
)
|
|
316
325
|
] })
|
|
317
326
|
] }),
|
|
318
|
-
/* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ r(tt, { children: [
|
|
319
328
|
/* @__PURE__ */ t(
|
|
320
|
-
|
|
329
|
+
rt,
|
|
321
330
|
{
|
|
322
|
-
ref:
|
|
323
|
-
onScroll:
|
|
331
|
+
ref: _,
|
|
332
|
+
onScroll: Fe,
|
|
324
333
|
role: "region",
|
|
325
334
|
"aria-label": "Conversation",
|
|
326
|
-
children:
|
|
327
|
-
/* @__PURE__ */ t(
|
|
328
|
-
/* @__PURE__ */ t(
|
|
329
|
-
|
|
330
|
-
M && M.length > 0 && /* @__PURE__ */ t(
|
|
331
|
-
|
|
335
|
+
children: oe ? /* @__PURE__ */ r(ot, { children: [
|
|
336
|
+
/* @__PURE__ */ t(nt, { children: /* @__PURE__ */ t(C, { width: 28, height: 28 }) }),
|
|
337
|
+
/* @__PURE__ */ t(Xe, { style: { fontWeight: 600 }, children: ke || b }),
|
|
338
|
+
D && /* @__PURE__ */ t(ae, { color: f.content.secondary, children: D }),
|
|
339
|
+
M && M.length > 0 && /* @__PURE__ */ t(it, { children: M.map((e) => /* @__PURE__ */ r(
|
|
340
|
+
lt,
|
|
332
341
|
{
|
|
333
342
|
type: "button",
|
|
334
|
-
disabled: d ||
|
|
335
|
-
onClick: () =>
|
|
343
|
+
disabled: d || h,
|
|
344
|
+
onClick: () => Ne(e),
|
|
336
345
|
children: [
|
|
337
|
-
/* @__PURE__ */ t(
|
|
346
|
+
/* @__PURE__ */ t(C, { width: 14, height: 14 }),
|
|
338
347
|
e.text
|
|
339
348
|
]
|
|
340
349
|
},
|
|
341
350
|
e.id
|
|
342
351
|
)) })
|
|
343
|
-
] }) : /* @__PURE__ */
|
|
344
|
-
m && /* @__PURE__ */
|
|
345
|
-
/* @__PURE__ */ t(
|
|
346
|
-
|
|
352
|
+
] }) : /* @__PURE__ */ r(Oe, { children: [
|
|
353
|
+
m && /* @__PURE__ */ r(ct, { role: "status", "aria-live": "polite", children: [
|
|
354
|
+
/* @__PURE__ */ t(se, { color: f.content.placeholder, size: 4 }),
|
|
355
|
+
Ae
|
|
347
356
|
] }),
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
return /* @__PURE__ */
|
|
351
|
-
e.content.length > 0 && /* @__PURE__ */ t(
|
|
357
|
+
T.map((e) => {
|
|
358
|
+
const o = e.role === "user" ? Nt(e.timestamp) : "";
|
|
359
|
+
return /* @__PURE__ */ r(De.Fragment, { children: [
|
|
360
|
+
e.content.length > 0 && /* @__PURE__ */ t(dt, { $role: e.role, children: e.role === "assistant" ? /* @__PURE__ */ t(
|
|
352
361
|
"div",
|
|
353
362
|
{
|
|
354
363
|
dangerouslySetInnerHTML: {
|
|
355
|
-
__html:
|
|
364
|
+
__html: Ht(e.content)
|
|
356
365
|
}
|
|
357
366
|
}
|
|
358
367
|
) : /* @__PURE__ */ t("div", { style: { whiteSpace: "pre-wrap" }, children: e.content }) }),
|
|
359
368
|
e.role === "assistant" && !e.isStreaming && (() => {
|
|
360
|
-
const c =
|
|
361
|
-
return c.length === 0 ? null : /* @__PURE__ */ t(
|
|
362
|
-
|
|
369
|
+
const c = Ft(e.toolResults);
|
|
370
|
+
return c.length === 0 ? null : /* @__PURE__ */ t(at, { children: c.map((l) => /* @__PURE__ */ t(
|
|
371
|
+
ht,
|
|
363
372
|
{
|
|
364
373
|
href: l.url,
|
|
365
374
|
target: "_blank",
|
|
366
375
|
rel: "noopener noreferrer",
|
|
367
|
-
onClick: () =>
|
|
376
|
+
onClick: () => Se?.({
|
|
368
377
|
tool: l.tool,
|
|
369
378
|
url: l.url
|
|
370
379
|
}),
|
|
@@ -373,47 +382,47 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
373
382
|
`${l.tool}-${l.url}`
|
|
374
383
|
)) });
|
|
375
384
|
})(),
|
|
376
|
-
|
|
377
|
-
e.wasInterrupted &&
|
|
378
|
-
/* @__PURE__ */ t(
|
|
379
|
-
|
|
385
|
+
o && /* @__PURE__ */ t(st, { children: o }),
|
|
386
|
+
e.wasInterrupted && J && /* @__PURE__ */ r(ut, { children: [
|
|
387
|
+
/* @__PURE__ */ t(ue, { size: 12 }),
|
|
388
|
+
J
|
|
380
389
|
] }),
|
|
381
|
-
e.role === "assistant" && e.content.length > 0 && !e.isStreaming && /* @__PURE__ */
|
|
390
|
+
e.role === "assistant" && e.content.length > 0 && !e.isStreaming && /* @__PURE__ */ r(pt, { children: [
|
|
382
391
|
/* @__PURE__ */ t(
|
|
383
|
-
|
|
392
|
+
x,
|
|
384
393
|
{
|
|
385
394
|
type: "button",
|
|
386
395
|
onClick: () => {
|
|
387
|
-
|
|
396
|
+
_e(e);
|
|
388
397
|
},
|
|
389
|
-
"data-copied":
|
|
390
|
-
title:
|
|
391
|
-
"aria-label":
|
|
392
|
-
children:
|
|
398
|
+
"data-copied": v === e.id,
|
|
399
|
+
title: v === e.id ? "Copied" : "Copy",
|
|
400
|
+
"aria-label": v === e.id ? "Response copied to clipboard" : "Copy response",
|
|
401
|
+
children: v === e.id ? /* @__PURE__ */ t(Vt, {}) : /* @__PURE__ */ t(Ut, {})
|
|
393
402
|
}
|
|
394
403
|
),
|
|
395
|
-
|
|
396
|
-
|
|
404
|
+
X && e.id === j?.id && /* @__PURE__ */ t(
|
|
405
|
+
x,
|
|
397
406
|
{
|
|
398
407
|
type: "button",
|
|
399
|
-
onClick:
|
|
400
|
-
disabled: d ||
|
|
408
|
+
onClick: Pe,
|
|
409
|
+
disabled: d || h,
|
|
401
410
|
title: "Regenerate",
|
|
402
411
|
"aria-label": "Regenerate response",
|
|
403
|
-
children: /* @__PURE__ */ t(
|
|
412
|
+
children: /* @__PURE__ */ t(Dt, {})
|
|
404
413
|
}
|
|
405
414
|
),
|
|
406
415
|
/* @__PURE__ */ t(
|
|
407
|
-
|
|
416
|
+
x,
|
|
408
417
|
{
|
|
409
418
|
type: "button",
|
|
410
|
-
onClick: () =>
|
|
419
|
+
onClick: () => ie(e.id, "like"),
|
|
411
420
|
"data-selected": s[e.id] === "like",
|
|
412
421
|
"aria-pressed": s[e.id] === "like",
|
|
413
422
|
title: "Good response",
|
|
414
423
|
"aria-label": "Good response",
|
|
415
424
|
children: /* @__PURE__ */ t(
|
|
416
|
-
|
|
425
|
+
Kt,
|
|
417
426
|
{
|
|
418
427
|
filled: s[e.id] === "like"
|
|
419
428
|
}
|
|
@@ -421,16 +430,16 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
421
430
|
}
|
|
422
431
|
),
|
|
423
432
|
/* @__PURE__ */ t(
|
|
424
|
-
|
|
433
|
+
x,
|
|
425
434
|
{
|
|
426
435
|
type: "button",
|
|
427
|
-
onClick: () =>
|
|
436
|
+
onClick: () => ie(e.id, "dislike"),
|
|
428
437
|
"data-selected": s[e.id] === "dislike",
|
|
429
438
|
"aria-pressed": s[e.id] === "dislike",
|
|
430
439
|
title: "Bad response",
|
|
431
440
|
"aria-label": "Bad response",
|
|
432
441
|
children: /* @__PURE__ */ t(
|
|
433
|
-
|
|
442
|
+
Xt,
|
|
434
443
|
{
|
|
435
444
|
filled: s[e.id] === "dislike"
|
|
436
445
|
}
|
|
@@ -438,99 +447,114 @@ const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
|
|
|
438
447
|
}
|
|
439
448
|
)
|
|
440
449
|
] }),
|
|
441
|
-
|
|
442
|
-
|
|
450
|
+
g === e.id && /* @__PURE__ */ t(
|
|
451
|
+
Ge,
|
|
443
452
|
{
|
|
444
|
-
title:
|
|
445
|
-
subtitle:
|
|
446
|
-
reasons:
|
|
447
|
-
notePlaceholder:
|
|
448
|
-
submitLabel:
|
|
449
|
-
onSubmit: (c) =>
|
|
450
|
-
onDismiss: () =>
|
|
453
|
+
title: be,
|
|
454
|
+
subtitle: ye ?? `Help us improve ${b}`,
|
|
455
|
+
reasons: me,
|
|
456
|
+
notePlaceholder: ve,
|
|
457
|
+
submitLabel: ge,
|
|
458
|
+
onSubmit: (c) => le(e.id, c),
|
|
459
|
+
onDismiss: () => le(e.id)
|
|
451
460
|
}
|
|
452
461
|
)
|
|
453
462
|
] }, e.id);
|
|
454
463
|
}),
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
464
|
+
N && N.length > 0 && /* @__PURE__ */ r(ft, { children: [
|
|
465
|
+
Z && /* @__PURE__ */ t(kt, { children: Z }),
|
|
466
|
+
N.map((e) => /* @__PURE__ */ r(
|
|
467
|
+
wt,
|
|
459
468
|
{
|
|
460
469
|
type: "button",
|
|
461
470
|
disabled: d,
|
|
462
|
-
onClick: () =>
|
|
471
|
+
onClick: () => $e(e),
|
|
463
472
|
children: [
|
|
464
|
-
/* @__PURE__ */ t(
|
|
473
|
+
/* @__PURE__ */ t(Ot, {}),
|
|
465
474
|
e
|
|
466
475
|
]
|
|
467
476
|
},
|
|
468
477
|
e
|
|
469
478
|
))
|
|
470
479
|
] }),
|
|
471
|
-
|
|
480
|
+
y && /* @__PURE__ */ r(Ct, { role: "status", "aria-live": "polite", children: [
|
|
472
481
|
/* @__PURE__ */ t(
|
|
473
|
-
|
|
482
|
+
C,
|
|
474
483
|
{
|
|
475
484
|
width: 14,
|
|
476
485
|
height: 14,
|
|
477
|
-
color:
|
|
486
|
+
color: f.content.brand
|
|
478
487
|
}
|
|
479
488
|
),
|
|
480
|
-
|
|
481
|
-
/* @__PURE__ */ t(
|
|
489
|
+
G && /* @__PURE__ */ t(bt, { children: G }),
|
|
490
|
+
/* @__PURE__ */ t(se, { color: f.background.brand, size: 5 })
|
|
482
491
|
] }),
|
|
483
|
-
/* @__PURE__ */ t("div", { ref:
|
|
492
|
+
/* @__PURE__ */ t("div", { ref: E })
|
|
484
493
|
] })
|
|
485
494
|
}
|
|
486
495
|
),
|
|
487
|
-
/* @__PURE__ */ t(
|
|
496
|
+
/* @__PURE__ */ t(yt, { $visible: $, "aria-hidden": "true" }),
|
|
488
497
|
/* @__PURE__ */ t(
|
|
489
498
|
mt,
|
|
490
499
|
{
|
|
491
500
|
type: "button",
|
|
492
|
-
$visible:
|
|
493
|
-
onClick:
|
|
494
|
-
tabIndex:
|
|
501
|
+
$visible: $,
|
|
502
|
+
onClick: Ee,
|
|
503
|
+
tabIndex: $ ? 0 : -1,
|
|
495
504
|
"aria-label": "Scroll to the latest message",
|
|
496
|
-
children: /* @__PURE__ */ t(
|
|
505
|
+
children: /* @__PURE__ */ t(Ue, { width: 16, height: 16 })
|
|
497
506
|
}
|
|
498
507
|
)
|
|
499
508
|
] }),
|
|
500
|
-
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
|
|
504
|
-
{
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
509
|
+
Y && /* @__PURE__ */ t(vt, { role: "alert", children: Y }),
|
|
510
|
+
/* @__PURE__ */ r(gt, { children: [
|
|
511
|
+
a && /* @__PURE__ */ r(Tt, { children: [
|
|
512
|
+
/* @__PURE__ */ t(C, { width: 14, height: 14, color: f.content.brand }),
|
|
513
|
+
/* @__PURE__ */ t(St, { title: a, children: a }),
|
|
514
|
+
/* @__PURE__ */ t(
|
|
515
|
+
xt,
|
|
516
|
+
{
|
|
517
|
+
type: "button",
|
|
518
|
+
onClick: Q,
|
|
519
|
+
"aria-label": "Remove the selected text",
|
|
520
|
+
children: /* @__PURE__ */ t(de, { width: 12, height: 12 })
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
] }),
|
|
524
|
+
/* @__PURE__ */ r(At, { $focused: Re, children: [
|
|
525
|
+
/* @__PURE__ */ t(
|
|
526
|
+
Mt,
|
|
527
|
+
{
|
|
528
|
+
ref: F,
|
|
529
|
+
rows: 1,
|
|
530
|
+
value: L,
|
|
531
|
+
placeholder: fe,
|
|
532
|
+
disabled: d,
|
|
533
|
+
onChange: We,
|
|
534
|
+
onKeyDown: je,
|
|
535
|
+
onFocus: () => te(!0),
|
|
536
|
+
onBlur: () => te(!1)
|
|
537
|
+
}
|
|
538
|
+
),
|
|
539
|
+
/* @__PURE__ */ t(
|
|
540
|
+
It,
|
|
541
|
+
{
|
|
542
|
+
type: "button",
|
|
543
|
+
$active: w || ne,
|
|
544
|
+
disabled: !w && !ne,
|
|
545
|
+
onClick: w ? z : ce,
|
|
546
|
+
"aria-label": w ? "Stop generating" : "Send message",
|
|
547
|
+
children: w ? /* @__PURE__ */ t(ue, {}) : /* @__PURE__ */ t($t, {})
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
] })
|
|
551
|
+
] }),
|
|
552
|
+
V && /* @__PURE__ */ t(Lt, { children: V })
|
|
529
553
|
]
|
|
530
554
|
}
|
|
531
555
|
);
|
|
532
556
|
};
|
|
533
557
|
export {
|
|
534
|
-
|
|
558
|
+
dr as CopilotPanel
|
|
535
559
|
};
|
|
536
560
|
//# sourceMappingURL=CopilotPanel.js.map
|