@bikdotai/bik-component-library 0.0.870 → 0.0.871

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