@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.
Files changed (65) hide show
  1. package/dist/cjs/components/bik-copilot/ControlledCopilot.js +1 -1
  2. package/dist/cjs/components/bik-copilot/ControlledCopilot.js.map +1 -1
  3. package/dist/cjs/components/bik-copilot/CopilotPanel.js +1 -1
  4. package/dist/cjs/components/bik-copilot/CopilotPanel.js.map +1 -1
  5. package/dist/cjs/components/bik-copilot/CopilotPanel.styled.js +53 -12
  6. package/dist/cjs/components/bik-copilot/CopilotPanel.styled.js.map +1 -1
  7. package/dist/cjs/components/bik-copilot/copilotSelectionPrompt.js +2 -0
  8. package/dist/cjs/components/bik-copilot/copilotSelectionPrompt.js.map +1 -0
  9. package/dist/cjs/components/text-selection-ask/SelectionAskPill.js +2 -0
  10. package/dist/cjs/components/text-selection-ask/SelectionAskPill.js.map +1 -0
  11. package/dist/cjs/components/text-selection-ask/SelectionAskPill.styled.js +32 -0
  12. package/dist/cjs/components/text-selection-ask/SelectionAskPill.styled.js.map +1 -0
  13. package/dist/cjs/components/text-selection-ask/TextSelectionAsk.js +2 -0
  14. package/dist/cjs/components/text-selection-ask/TextSelectionAsk.js.map +1 -0
  15. package/dist/cjs/components/text-selection-ask/model.js +2 -0
  16. package/dist/cjs/components/text-selection-ask/model.js.map +1 -0
  17. package/dist/cjs/components/text-selection-ask/selectionText.js +2 -0
  18. package/dist/cjs/components/text-selection-ask/selectionText.js.map +1 -0
  19. package/dist/cjs/components/text-selection-ask/useTextSelectionAsk.js +2 -0
  20. package/dist/cjs/components/text-selection-ask/useTextSelectionAsk.js.map +1 -0
  21. package/dist/cjs/icons/Informational/Common UI/SquaresFour.js +2 -0
  22. package/dist/cjs/icons/Informational/Common UI/SquaresFour.js.map +1 -0
  23. package/dist/cjs/icons/index.js +1 -1
  24. package/dist/cjs/index.js +1 -1
  25. package/dist/esm/components/bik-copilot/ControlledCopilot.js +34 -30
  26. package/dist/esm/components/bik-copilot/ControlledCopilot.js.map +1 -1
  27. package/dist/esm/components/bik-copilot/CopilotPanel.js +261 -237
  28. package/dist/esm/components/bik-copilot/CopilotPanel.js.map +1 -1
  29. package/dist/esm/components/bik-copilot/CopilotPanel.styled.d.ts +8 -0
  30. package/dist/esm/components/bik-copilot/CopilotPanel.styled.js +69 -25
  31. package/dist/esm/components/bik-copilot/CopilotPanel.styled.js.map +1 -1
  32. package/dist/esm/components/bik-copilot/copilotSelectionPrompt.d.ts +13 -0
  33. package/dist/esm/components/bik-copilot/copilotSelectionPrompt.js +8 -0
  34. package/dist/esm/components/bik-copilot/copilotSelectionPrompt.js.map +1 -0
  35. package/dist/esm/components/bik-copilot/model.d.ts +19 -0
  36. package/dist/esm/components/text-selection-ask/SelectionAskPill.d.ts +22 -0
  37. package/dist/esm/components/text-selection-ask/SelectionAskPill.js +44 -0
  38. package/dist/esm/components/text-selection-ask/SelectionAskPill.js.map +1 -0
  39. package/dist/esm/components/text-selection-ask/SelectionAskPill.styled.d.ts +5 -0
  40. package/dist/esm/components/text-selection-ask/SelectionAskPill.styled.js +37 -0
  41. package/dist/esm/components/text-selection-ask/SelectionAskPill.styled.js.map +1 -0
  42. package/dist/esm/components/text-selection-ask/TextSelectionAsk.d.ts +36 -0
  43. package/dist/esm/components/text-selection-ask/TextSelectionAsk.js +69 -0
  44. package/dist/esm/components/text-selection-ask/TextSelectionAsk.js.map +1 -0
  45. package/dist/esm/components/text-selection-ask/index.d.ts +7 -0
  46. package/dist/esm/components/text-selection-ask/model.d.ts +112 -0
  47. package/dist/esm/components/text-selection-ask/model.js +7 -0
  48. package/dist/esm/components/text-selection-ask/model.js.map +1 -0
  49. package/dist/esm/components/text-selection-ask/selectionText.d.ts +18 -0
  50. package/dist/esm/components/text-selection-ask/selectionText.js +7 -0
  51. package/dist/esm/components/text-selection-ask/selectionText.js.map +1 -0
  52. package/dist/esm/components/text-selection-ask/useTextSelectionAsk.d.ts +15 -0
  53. package/dist/esm/components/text-selection-ask/useTextSelectionAsk.js +53 -0
  54. package/dist/esm/components/text-selection-ask/useTextSelectionAsk.js.map +1 -0
  55. package/dist/esm/icons/Informational/Common UI/SquaresFour.d.ts +7 -0
  56. package/dist/esm/icons/Informational/Common UI/SquaresFour.js +33 -0
  57. package/dist/esm/icons/Informational/Common UI/SquaresFour.js.map +1 -0
  58. package/dist/esm/icons/Informational/Common UI/index.d.ts +1 -0
  59. package/dist/esm/icons/index.d.ts +25 -25
  60. package/dist/esm/icons/index.js +158 -156
  61. package/dist/esm/icons/index.js.map +1 -1
  62. package/dist/esm/index.d.ts +1 -0
  63. package/dist/esm/index.js +403 -388
  64. package/dist/esm/index.js.map +1 -1
  65. package/package.json +1 -1
@@ -1,18 +1,19 @@
1
- import { jsxs as o, jsx as t, Fragment as je } from "react/jsx-runtime";
2
- import Ne from "../../assets/icons/arrow_down.svg.js";
3
- import g from "../../assets/icons/bik_ai_stars_icon.svg.js";
4
- import $e from "../../assets/icons/cross.svg.js";
5
- import Oe from "../../assets/icons/refresh.svg.js";
6
- import Ue, { useState as h, useRef as u, useEffect as j } from "react";
7
- import { COLORS as k } from "../../constants/Theme.js";
8
- import { TitleSmall as Ve, BodyCaption as le, BodySecondary as De } from "../TypographyStyle.js";
9
- import { CopilotFeedbackModal as Ke } from "./CopilotFeedbackModal.js";
10
- import { PanelContainer as Xe, PanelHeader as Ge, HeaderAvatar as ze, HeaderText as Je, HeaderTitleRow as Ze, HeaderBadge as qe, HeaderActions as Qe, IconAction as ce, MessagesViewport as Ye, MessagesArea as et, EmptyState as tt, EmptyStateIcon as rt, SuggestionList as ot, SuggestionChip as nt, HistoryLoader as it, MessageBubble as lt, ToolCtaList as ct, ToolCtaLink as dt, MessageTimestamp as at, InterruptedNote as st, MessageActions as ht, MessageAction as T, FollowUpList as ut, FollowUpsLabel as pt, FollowUpChip as ft, ThinkingBubble as kt, ThinkingLabel as wt, ScrollFade as Ct, JumpToLatestButton as mt, ErrorBanner as yt, InputArea as bt, InputWrapper as vt, MessageInput as gt, SendButton as Tt, Disclaimer as St } from "./CopilotPanel.styled.js";
11
- import { isCopilotRegeneratePrompt as Mt } from "./copilotRegenerate.js";
12
- import { renderCopilotMarkdown as It } from "./utils/markdown.js";
13
- import { toolResultCtas as xt } from "./utils/toolCtas.js";
14
- import { DotPulse as de } from "../dot-pulse/DotPulse.js";
15
- const At = 96, Lt = 24, Bt = 1800, Ht = async (n) => {
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 S = document.execCommand("copy");
25
- return document.body.removeChild(i), S;
25
+ const A = document.execCommand("copy");
26
+ return document.body.removeChild(i), A;
26
27
  } catch {
27
28
  return !1;
28
29
  }
29
- }, Rt = 48, Ft = (n) => {
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
- }, Et = () => /* @__PURE__ */ o(
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
- ), _t = () => /* @__PURE__ */ o(
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
- ), ae = ({ size: n = 16 }) => /* @__PURE__ */ t(
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
- ), Pt = () => /* @__PURE__ */ o(
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
- ), Wt = () => /* @__PURE__ */ t(
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
- ), jt = () => /* @__PURE__ */ o(
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
- ), Nt = ({ filled: n = !1 }) => /* @__PURE__ */ o(
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
- ), $t = ({ filled: n = !1 }) => /* @__PURE__ */ o(
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
- ), tr = ({
164
+ ), dr = ({
164
165
  messages: n,
165
166
  onSend: i,
166
- onClose: S,
167
- title: w = "Copilot",
168
- badge: N,
169
- subtitle: $,
170
- avatar: se,
171
- placeholder: he = "Write your message...",
172
- disclaimer: O = "AI can make mistakes, Verify the responses.",
173
- emptyStateTitle: ue,
174
- emptyStateSubtitle: U = "Here are some things you can try",
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: pe,
177
- showRefresh: fe = !0,
178
- onRefresh: V,
179
- onRegenerate: D,
177
+ onSuggestionClick: we,
178
+ showRefresh: Ce = !0,
179
+ onRefresh: K,
180
+ onRegenerate: X,
180
181
  onFeedback: I,
181
- dislikeTitle: ke,
182
- dislikeSubtitle: we,
183
- dislikeReasons: Ce,
184
- dislikeNotePlaceholder: me,
185
- dislikeSubmitLabel: ye,
186
- isThinking: C = !1,
187
- thinkingLabel: K = "Thinking",
188
- isStreaming: be = !1,
189
- onStop: X,
190
- interruptedLabel: G = "This message was interrupted",
191
- followUpsLabel: z = "Follow ups",
192
- onToolCtaClick: ve,
193
- hasMoreHistory: ge = !1,
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: J,
196
- historyLoadingLabel: Te = "Loading earlier messages",
196
+ onLoadOlderMessages: q,
197
+ historyLoadingLabel: Ae = "Loading earlier messages",
197
198
  inputDisabled: d = !1,
198
- errorMessage: Z,
199
- width: Se,
200
- height: Me,
201
- className: Ie,
202
- style: xe
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 [x, q] = h(""), [Ae, Q] = h(!1), [A, L] = h(!0), [y, Y] = h(null), [s, Le] = h({}), [b, B] = h(null), ee = u(null), p = u(null), H = u(null), R = u(null), F = u(0), E = u(null), v = n.filter(
205
- (e) => (e.content.length > 0 || e.wasInterrupted) && !Mt(e.content)
206
- ), te = v.length === 0 && !C, a = C || be, re = !d && !a && x.trim().length > 0, f = a && !!X, _ = v[v.length - 1], P = !a && _?.role === "assistant" ? _.followUps : void 0, W = !te && !A;
207
- j(() => {
208
- A && H.current?.scrollIntoView({ behavior: "smooth" });
209
- }, [n, C, A]), j(() => {
210
- const e = R.current, r = E.current;
211
- !e || r === null || m || (E.current = null, e.scrollTop = e.scrollHeight - r, F.current = e.scrollTop);
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 Be = () => {
214
- const e = R.current;
216
+ const Fe = () => {
217
+ const e = _.current;
215
218
  if (!e)
216
219
  return;
217
- const r = e.scrollHeight - e.scrollTop - e.clientHeight;
218
- e.scrollTop <= Rt && ge && !m && J && (E.current = e.scrollHeight - e.scrollTop, J());
219
- const c = e.scrollTop < F.current - 1;
220
- if (F.current = e.scrollTop, r <= Lt) {
221
- L(!0);
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 && L(!1);
225
- }, He = () => {
226
- L(!0), H.current?.scrollIntoView({ behavior: "smooth" });
227
+ c && R(!1);
228
+ }, Ee = () => {
229
+ R(!0), E.current?.scrollIntoView({ behavior: "smooth" });
227
230
  };
228
- j(
231
+ S(
229
232
  () => () => {
230
- p.current && window.clearTimeout(p.current);
233
+ k.current && window.clearTimeout(k.current);
231
234
  },
232
235
  []
233
236
  );
234
- const Re = async (e) => {
235
- await Ht(e.content) && (p.current && window.clearTimeout(p.current), Y(e.id), p.current = window.setTimeout(
236
- () => Y(null),
237
- Bt
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
- }, oe = (e, r) => {
240
- const c = s[e] === r;
241
- if (Le((l) => ({
242
+ }, ie = (e, o) => {
243
+ const c = s[e] === o;
244
+ if (He((l) => ({
242
245
  ...l,
243
- [e]: l[e] === r ? void 0 : r
246
+ [e]: l[e] === o ? void 0 : o
244
247
  })), c) {
245
- r === "dislike" && B(
248
+ o === "dislike" && H(
246
249
  (l) => l === e ? null : l
247
250
  );
248
251
  return;
249
252
  }
250
- if (r === "like") {
253
+ if (o === "like") {
251
254
  I?.(e, "like");
252
255
  return;
253
256
  }
254
- b && b !== e && I?.(b, "dislike"), B(e);
255
- }, ne = (e, r) => {
256
- B((c) => c === e ? null : c), I?.(e, "dislike", r);
257
- }, Fe = () => {
258
- d || a || D?.();
259
- }, ie = () => {
260
- const e = x.trim();
261
- if (!e || d || a)
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(e), q("");
264
- const r = ee.current;
265
- r && (r.style.height = "auto");
266
- }, Ee = (e) => {
267
- q(e.target.value);
268
- const r = e.target;
269
- r.style.height = "auto", r.style.height = `${Math.min(
270
- r.scrollHeight,
271
- At
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
- }, _e = (e) => {
274
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), ie());
275
- }, Pe = (e) => {
276
- d || a || (pe?.(e), i(e.text));
277
- }, We = (e) => {
278
- d || a || i(e);
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__ */ o(
281
- Xe,
289
+ return /* @__PURE__ */ r(
290
+ ze,
282
291
  {
283
- className: Ie,
284
- style: { width: Se, height: Me, ...xe },
292
+ className: Le,
293
+ style: { width: Me, height: Ie, ...Be },
285
294
  role: "dialog",
286
- "aria-label": w,
295
+ "aria-label": b,
287
296
  children: [
288
- /* @__PURE__ */ o(Ge, { children: [
289
- /* @__PURE__ */ t(ze, { children: se ?? /* @__PURE__ */ t(g, { width: 18, height: 18 }) }),
290
- /* @__PURE__ */ o(Je, { children: [
291
- /* @__PURE__ */ o(Ze, { children: [
292
- /* @__PURE__ */ t(Ve, { children: w }),
293
- N && /* @__PURE__ */ t(qe, { children: N })
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
- $ && /* @__PURE__ */ t(le, { color: k.content.secondary, children: $ })
304
+ U && /* @__PURE__ */ t(ae, { color: f.content.secondary, children: U })
296
305
  ] }),
297
- /* @__PURE__ */ o(Qe, { children: [
298
- fe && V && /* @__PURE__ */ t(
299
- ce,
306
+ /* @__PURE__ */ r(et, { children: [
307
+ Ce && K && /* @__PURE__ */ t(
308
+ he,
300
309
  {
301
310
  type: "button",
302
- onClick: V,
311
+ onClick: K,
303
312
  "aria-label": "Start a new conversation",
304
- children: /* @__PURE__ */ t(Oe, { width: 16, height: 16 })
313
+ children: /* @__PURE__ */ t(Ve, { width: 16, height: 16 })
305
314
  }
306
315
  ),
307
316
  /* @__PURE__ */ t(
308
- ce,
317
+ he,
309
318
  {
310
319
  type: "button",
311
- onClick: S,
320
+ onClick: A,
312
321
  "aria-label": "Close copilot",
313
- children: /* @__PURE__ */ t($e, { width: 18, height: 18 })
322
+ children: /* @__PURE__ */ t(de, { width: 18, height: 18 })
314
323
  }
315
324
  )
316
325
  ] })
317
326
  ] }),
318
- /* @__PURE__ */ o(Ye, { children: [
327
+ /* @__PURE__ */ r(tt, { children: [
319
328
  /* @__PURE__ */ t(
320
- et,
329
+ rt,
321
330
  {
322
- ref: R,
323
- onScroll: Be,
331
+ ref: _,
332
+ onScroll: Fe,
324
333
  role: "region",
325
334
  "aria-label": "Conversation",
326
- children: te ? /* @__PURE__ */ o(tt, { children: [
327
- /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ t(g, { width: 28, height: 28 }) }),
328
- /* @__PURE__ */ t(De, { style: { fontWeight: 600 }, children: ue || w }),
329
- U && /* @__PURE__ */ t(le, { color: k.content.secondary, children: U }),
330
- M && M.length > 0 && /* @__PURE__ */ t(ot, { children: M.map((e) => /* @__PURE__ */ o(
331
- nt,
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 || a,
335
- onClick: () => Pe(e),
343
+ disabled: d || h,
344
+ onClick: () => Ne(e),
336
345
  children: [
337
- /* @__PURE__ */ t(g, { width: 14, height: 14 }),
346
+ /* @__PURE__ */ t(C, { width: 14, height: 14 }),
338
347
  e.text
339
348
  ]
340
349
  },
341
350
  e.id
342
351
  )) })
343
- ] }) : /* @__PURE__ */ o(je, { children: [
344
- m && /* @__PURE__ */ o(it, { role: "status", "aria-live": "polite", children: [
345
- /* @__PURE__ */ t(de, { color: k.content.placeholder, size: 4 }),
346
- Te
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
- v.map((e) => {
349
- const r = e.role === "user" ? Ft(e.timestamp) : "";
350
- return /* @__PURE__ */ o(Ue.Fragment, { children: [
351
- e.content.length > 0 && /* @__PURE__ */ t(lt, { $role: e.role, children: e.role === "assistant" ? /* @__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: It(e.content)
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 = xt(e.toolResults);
361
- return c.length === 0 ? null : /* @__PURE__ */ t(ct, { children: c.map((l) => /* @__PURE__ */ t(
362
- dt,
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: () => ve?.({
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
- r && /* @__PURE__ */ t(at, { children: r }),
377
- e.wasInterrupted && G && /* @__PURE__ */ o(st, { children: [
378
- /* @__PURE__ */ t(ae, { size: 12 }),
379
- G
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__ */ o(ht, { children: [
390
+ e.role === "assistant" && e.content.length > 0 && !e.isStreaming && /* @__PURE__ */ r(pt, { children: [
382
391
  /* @__PURE__ */ t(
383
- T,
392
+ x,
384
393
  {
385
394
  type: "button",
386
395
  onClick: () => {
387
- Re(e);
396
+ _e(e);
388
397
  },
389
- "data-copied": y === e.id,
390
- title: y === e.id ? "Copied" : "Copy",
391
- "aria-label": y === e.id ? "Response copied to clipboard" : "Copy response",
392
- children: y === e.id ? /* @__PURE__ */ t(Wt, {}) : /* @__PURE__ */ t(Pt, {})
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
- D && e.id === _?.id && /* @__PURE__ */ t(
396
- T,
404
+ X && e.id === j?.id && /* @__PURE__ */ t(
405
+ x,
397
406
  {
398
407
  type: "button",
399
- onClick: Fe,
400
- disabled: d || a,
408
+ onClick: Pe,
409
+ disabled: d || h,
401
410
  title: "Regenerate",
402
411
  "aria-label": "Regenerate response",
403
- children: /* @__PURE__ */ t(jt, {})
412
+ children: /* @__PURE__ */ t(Dt, {})
404
413
  }
405
414
  ),
406
415
  /* @__PURE__ */ t(
407
- T,
416
+ x,
408
417
  {
409
418
  type: "button",
410
- onClick: () => oe(e.id, "like"),
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
- Nt,
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
- T,
433
+ x,
425
434
  {
426
435
  type: "button",
427
- onClick: () => oe(e.id, "dislike"),
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
- $t,
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
- b === e.id && /* @__PURE__ */ t(
442
- Ke,
450
+ g === e.id && /* @__PURE__ */ t(
451
+ Ge,
443
452
  {
444
- title: ke,
445
- subtitle: we ?? `Help us improve ${w}`,
446
- reasons: Ce,
447
- notePlaceholder: me,
448
- submitLabel: ye,
449
- onSubmit: (c) => ne(e.id, c),
450
- onDismiss: () => ne(e.id)
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
- P && P.length > 0 && /* @__PURE__ */ o(ut, { children: [
456
- z && /* @__PURE__ */ t(pt, { children: z }),
457
- P.map((e) => /* @__PURE__ */ o(
458
- ft,
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: () => We(e),
471
+ onClick: () => $e(e),
463
472
  children: [
464
- /* @__PURE__ */ t(_t, {}),
473
+ /* @__PURE__ */ t(Ot, {}),
465
474
  e
466
475
  ]
467
476
  },
468
477
  e
469
478
  ))
470
479
  ] }),
471
- C && /* @__PURE__ */ o(kt, { role: "status", "aria-live": "polite", children: [
480
+ y && /* @__PURE__ */ r(Ct, { role: "status", "aria-live": "polite", children: [
472
481
  /* @__PURE__ */ t(
473
- g,
482
+ C,
474
483
  {
475
484
  width: 14,
476
485
  height: 14,
477
- color: k.content.brand
486
+ color: f.content.brand
478
487
  }
479
488
  ),
480
- K && /* @__PURE__ */ t(wt, { children: K }),
481
- /* @__PURE__ */ t(de, { color: k.background.brand, size: 5 })
489
+ G && /* @__PURE__ */ t(bt, { children: G }),
490
+ /* @__PURE__ */ t(se, { color: f.background.brand, size: 5 })
482
491
  ] }),
483
- /* @__PURE__ */ t("div", { ref: H })
492
+ /* @__PURE__ */ t("div", { ref: E })
484
493
  ] })
485
494
  }
486
495
  ),
487
- /* @__PURE__ */ t(Ct, { $visible: W, "aria-hidden": "true" }),
496
+ /* @__PURE__ */ t(yt, { $visible: $, "aria-hidden": "true" }),
488
497
  /* @__PURE__ */ t(
489
498
  mt,
490
499
  {
491
500
  type: "button",
492
- $visible: W,
493
- onClick: He,
494
- tabIndex: W ? 0 : -1,
501
+ $visible: $,
502
+ onClick: Ee,
503
+ tabIndex: $ ? 0 : -1,
495
504
  "aria-label": "Scroll to the latest message",
496
- children: /* @__PURE__ */ t(Ne, { width: 16, height: 16 })
505
+ children: /* @__PURE__ */ t(Ue, { width: 16, height: 16 })
497
506
  }
498
507
  )
499
508
  ] }),
500
- Z && /* @__PURE__ */ t(yt, { role: "alert", children: Z }),
501
- /* @__PURE__ */ t(bt, { children: /* @__PURE__ */ o(vt, { $focused: Ae, children: [
502
- /* @__PURE__ */ t(
503
- gt,
504
- {
505
- ref: ee,
506
- rows: 1,
507
- value: x,
508
- placeholder: he,
509
- disabled: d,
510
- onChange: Ee,
511
- onKeyDown: _e,
512
- onFocus: () => Q(!0),
513
- onBlur: () => Q(!1)
514
- }
515
- ),
516
- /* @__PURE__ */ t(
517
- Tt,
518
- {
519
- type: "button",
520
- $active: f || re,
521
- disabled: !f && !re,
522
- onClick: f ? X : ie,
523
- "aria-label": f ? "Stop generating" : "Send message",
524
- children: f ? /* @__PURE__ */ t(ae, {}) : /* @__PURE__ */ t(Et, {})
525
- }
526
- )
527
- ] }) }),
528
- O && /* @__PURE__ */ t(St, { children: O })
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
- tr as CopilotPanel
558
+ dr as CopilotPanel
535
559
  };
536
560
  //# sourceMappingURL=CopilotPanel.js.map