@inkeep/agents-ui 0.16.1 → 0.16.3

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 (61) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +167 -161
  3. package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -1
  4. package/dist/primitives/atoms/icons/built-in-icons.d.ts +4 -1
  5. package/dist/primitives/atoms/icons/built-in-icons.js +94 -91
  6. package/dist/primitives/atoms/icons/collections/pi.cjs +1 -1
  7. package/dist/primitives/atoms/icons/collections/pi.d.ts +3 -0
  8. package/dist/primitives/atoms/icons/collections/pi.js +82 -37
  9. package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -1
  10. package/dist/primitives/atoms/icons/inkeep-default-icons.js +4 -1
  11. package/dist/primitives/components/embedded-chat/file-upload-input.cjs +1 -1
  12. package/dist/primitives/components/embedded-chat/file-upload-input.d.ts +0 -1
  13. package/dist/primitives/components/embedded-chat/file-upload-input.js +346 -207
  14. package/dist/primitives/components/embedded-chat/use-chat-action.cjs +1 -1
  15. package/dist/primitives/components/embedded-chat/use-chat-action.js +16 -14
  16. package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
  17. package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +257 -256
  18. package/dist/primitives/components/embedded-chat.cjs +3 -3
  19. package/dist/primitives/components/embedded-chat.d.ts +1 -1
  20. package/dist/primitives/components/embedded-chat.js +102 -94
  21. package/dist/primitives/components/tagline-logo-icon.js +50 -9
  22. package/dist/primitives/hooks/use-events-api.cjs +1 -0
  23. package/dist/primitives/hooks/use-events-api.d.ts +31 -0
  24. package/dist/primitives/hooks/use-events-api.js +44 -0
  25. package/dist/primitives/hooks/use-feedback-api.cjs +1 -1
  26. package/dist/primitives/hooks/use-feedback-api.d.ts +3 -1
  27. package/dist/primitives/hooks/use-feedback-api.js +22 -21
  28. package/dist/primitives/hooks/use-initial-conversation.js +4 -1
  29. package/dist/primitives/hooks/use-input-notification.js +9 -9
  30. package/dist/primitives/index.cjs +1 -1
  31. package/dist/primitives/index.js +150 -144
  32. package/dist/primitives/providers/base-events-provider.cjs +1 -1
  33. package/dist/primitives/providers/base-events-provider.d.ts +2 -0
  34. package/dist/primitives/providers/base-events-provider.js +6 -5
  35. package/dist/primitives/providers/chat-auth-provider.cjs +1 -0
  36. package/dist/primitives/providers/chat-auth-provider.d.ts +27 -0
  37. package/dist/primitives/providers/chat-auth-provider.js +46 -0
  38. package/dist/primitives/providers/chat-base-events-provider.cjs +1 -0
  39. package/dist/primitives/providers/chat-base-events-provider.d.ts +12 -0
  40. package/dist/primitives/providers/chat-base-events-provider.js +74 -0
  41. package/dist/primitives/providers/feedback-provider.cjs +1 -1
  42. package/dist/primitives/providers/feedback-provider.js +37 -30
  43. package/dist/primitives/providers/index.cjs +1 -1
  44. package/dist/primitives/providers/index.d.ts +2 -0
  45. package/dist/primitives/providers/index.js +57 -51
  46. package/dist/react/embedded-chat.cjs +1 -1
  47. package/dist/react/embedded-chat.js +101 -99
  48. package/dist/react/index.cjs +1 -1
  49. package/dist/react/index.js +167 -161
  50. package/dist/styled/components/embedded-chat/image-preview-modal.js +9 -2
  51. package/dist/styled/components/embedded-chat.js +14 -2
  52. package/dist/styled/components/embedded-search.js +7 -1
  53. package/dist/styled/components/message.cjs +1 -1
  54. package/dist/styled/components/message.js +74 -71
  55. package/dist/styled/index.cjs +1 -1
  56. package/dist/styled/index.js +155 -149
  57. package/dist/types/config/ai.d.ts +5 -0
  58. package/dist/types/events.d.ts +11 -0
  59. package/dist/types/icons/built-in.d.ts +1 -1
  60. package/dist/types/icons/custom.d.ts +3 -0
  61. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as a, jsxs as G, Fragment as ie } from "react/jsx-runtime";
3
- import j, { memo as I, useRef as D, useState as $, useMemo as oe, useEffect as W, useLayoutEffect as he, forwardRef as Q } from "react";
3
+ import j, { memo as E, useRef as D, useState as $, useMemo as oe, useEffect as W, useLayoutEffect as he, forwardRef as Q } from "react";
4
4
  import * as Ce from "react-dom/client";
5
5
  import ae from "react-textarea-autosize";
6
6
  import * as Y from "@radix-ui/react-avatar";
@@ -9,7 +9,7 @@ import * as B from "@radix-ui/react-popover";
9
9
  import * as K from "@radix-ui/react-tooltip";
10
10
  import * as U from "@radix-ui/react-scroll-area";
11
11
  import { ItemText as be, Content as pe, Icon as ge, Item as ve, ItemIndicator as Fe, Trigger as _e, Viewport as Pe, Root as fe, Value as Se } from "../atoms/select.js";
12
- import { ComboboxListItems as Ee, ComboboxRoot as Ie, ComboboxItemText as Me, ComboboxContent as Ae, ComboboxControl as ye, ComboboxInput as ke, ComboboxItem as xe, ComboboxItemIndicator as Te, ComboboxList as He, ComboboxListEmpty as Le, ComboboxPositioner as we, ComboboxSelectedTags as De, ComboboxTrigger as Be } from "../atoms/combobox.js";
12
+ import { ComboboxListItems as Ie, ComboboxRoot as Ee, ComboboxItemText as Me, ComboboxContent as Ae, ComboboxControl as ye, ComboboxInput as ke, ComboboxItem as xe, ComboboxItemIndicator as Te, ComboboxList as He, ComboboxListEmpty as Le, ComboboxPositioner as we, ComboboxSelectedTags as De, ComboboxTrigger as Be } from "../atoms/combobox.js";
13
13
  import { Close as Ne, Content as Re, Title as Oe, Overlay as Ve, Root as We } from "../atoms/dialog.js";
14
14
  import Qe from "../atoms/avatars/ai.js";
15
15
  import Ue from "../atoms/avatars/user.js";
@@ -20,7 +20,7 @@ import { Markdown as q } from "../atoms/markdown/index.js";
20
20
  import { SourceItemProvider as Ke, useSourceItem as R } from "../providers/source-item-provider.js";
21
21
  import { useInkeepConfig as p } from "../providers/config-provider.js";
22
22
  import { useMessageFeedback as Z } from "../providers/feedback-provider.js";
23
- import { useMessage as E, MessageProvider as qe } from "../providers/message-provider.js";
23
+ import { useMessage as P, MessageProvider as qe } from "../providers/message-provider.js";
24
24
  import { CheckboxIcon as je } from "../atoms/icons/checkbox-icon.js";
25
25
  import { useCopyToClipboard as z } from "../hooks/use-copy-to-clipboard.js";
26
26
  import { dataAttr as g, maybeRender as O, isCitationArtifact as ne, getInitials as ze, getMessageContent as se } from "../utils/misc.js";
@@ -31,7 +31,7 @@ import { useSettleAction as Ge } from "../hooks/use-settle-action.js";
31
31
  import { useContainerSize as Ye } from "../hooks/use-container-size.js";
32
32
  import { useChatAction as J } from "./embedded-chat/use-chat-action.js";
33
33
  import { useHelpMenuState as Ze, HelpMenuProvider as Je, useHelpMenu as Xe } from "../providers/help-menu-provider.js";
34
- import { useChatForm as P } from "../providers/chat-form-provider.js";
34
+ import { useChatForm as f } from "../providers/chat-form-provider.js";
35
35
  import { useFormField as k, FormFieldProvider as et } from "../providers/form-field-provider.js";
36
36
  import { Controller as tt } from "react-hook-form";
37
37
  import { highlightEmphasis as it } from "../utils/highlight-emphasis.js";
@@ -47,7 +47,7 @@ import { useBaseEvents as ee } from "../providers/base-events-provider.js";
47
47
  import { useShadow as ct } from "../atoms/shadow/context.js";
48
48
  import { getIcon as mt } from "../utils/get-source-icon.js";
49
49
  import { ChatHistoryProvider as lt } from "../providers/chat-history-provider.js";
50
- import { EmbeddedChatPrimitiveDropZone as nn, EmbeddedChatPrimitiveFileContent as sn, EmbeddedChatPrimitiveFileInput as dn, EmbeddedChatPrimitiveFileItem as cn, EmbeddedChatPrimitiveFileList as mn, EmbeddedChatPrimitiveFileName as ln, EmbeddedChatPrimitiveFilePreviewTrigger as un, EmbeddedChatPrimitiveFileRemove as hn, EmbeddedChatPrimitiveFileRemoveIcon as Cn, EmbeddedChatPrimitiveFileThumbnail as bn, EmbeddedChatPrimitiveFileTypeIcon as pn, EmbeddedChatPrimitiveFileUploadButton as gn, EmbeddedChatPrimitiveFileUploadButtonIcon as vn, EmbeddedChatPrimitiveInputFieldset as Fn, EmbeddedChatPrimitiveInputNotification as _n, EmbeddedChatPrimitiveInputNotificationClose as Pn, EmbeddedChatPrimitiveInputNotificationContent as fn, EmbeddedChatPrimitiveInputNotificationHeader as Sn, EmbeddedChatPrimitiveInputNotificationMessage as En, EmbeddedChatPrimitiveInputNotificationTitle as In, EmbeddedChatPrimitiveMessageFile as Mn, EmbeddedChatPrimitiveMessageFiles as An } from "./embedded-chat/file-upload-input.js";
50
+ import { EmbeddedChatPrimitiveDropZone as nn, EmbeddedChatPrimitiveFileContent as sn, EmbeddedChatPrimitiveFileInput as dn, EmbeddedChatPrimitiveFileItem as cn, EmbeddedChatPrimitiveFileList as mn, EmbeddedChatPrimitiveFileName as ln, EmbeddedChatPrimitiveFilePreviewTrigger as un, EmbeddedChatPrimitiveFileRemove as hn, EmbeddedChatPrimitiveFileRemoveIcon as Cn, EmbeddedChatPrimitiveFileThumbnail as bn, EmbeddedChatPrimitiveFileTypeIcon as pn, EmbeddedChatPrimitiveFileUploadButton as gn, EmbeddedChatPrimitiveFileUploadButtonIcon as vn, EmbeddedChatPrimitiveInputFieldset as Fn, EmbeddedChatPrimitiveInputNotification as _n, EmbeddedChatPrimitiveInputNotificationClose as Pn, EmbeddedChatPrimitiveInputNotificationContent as fn, EmbeddedChatPrimitiveInputNotificationHeader as Sn, EmbeddedChatPrimitiveInputNotificationMessage as In, EmbeddedChatPrimitiveInputNotificationTitle as En, EmbeddedChatPrimitiveMessageFile as Mn, EmbeddedChatPrimitiveMessageFiles as An } from "./embedded-chat/file-upload-input.js";
51
51
  import { EmbeddedChatPrimitiveImagePreviewModal as kn, EmbeddedChatPrimitiveImagePreviewModalClose as xn, EmbeddedChatPrimitiveImagePreviewModalContent as Tn, EmbeddedChatPrimitiveImagePreviewModalFileName as Hn, EmbeddedChatPrimitiveImagePreviewModalFooter as Ln, EmbeddedChatPrimitiveImagePreviewModalImage as wn, EmbeddedChatPrimitiveImagePreviewModalOverlay as Dn } from "./embedded-chat/image-preview-modal.js";
52
52
  const ut = "__intro__", ht = 767, Ct = i("div", {
53
53
  _id: "aiChatWrapper"
@@ -99,7 +99,7 @@ const Lo = Q((t, e) => {
99
99
  }), bt = i("div", {
100
100
  _id: "aiChatRoot"
101
101
  }), wo = (t) => {
102
- const { isHidden: e } = F(), { form: o } = P();
102
+ const { isHidden: e } = F(), { form: o } = f();
103
103
  return o ? null : /* @__PURE__ */ a(bt, { "data-hidden": g(e), ...t });
104
104
  }, Do = i("div", {
105
105
  _id: "aiChatHeader"
@@ -109,13 +109,13 @@ const Lo = Q((t, e) => {
109
109
  _id: "aiChatHeader__ToolbarHeaderWrapper"
110
110
  }), pt = i(A, {
111
111
  _id: "aiChatHeader__ChatHistoryButtonIcon"
112
- }), Ro = I(
112
+ }), Ro = E(
113
113
  (t) => /* @__PURE__ */ a(pt, { ...t })
114
114
  ), Oo = i("button", {
115
115
  _id: "aiChatHeader__ChatHistoryButton"
116
116
  }), gt = i("div", {
117
117
  _id: "aiChatHeader__ToolbarHeader"
118
- }), Vo = I(
118
+ }), Vo = E(
119
119
  (t) => {
120
120
  const { aiChatSettings: e } = p(), o = `Ask ${e.aiAssistantName || "AI"}`;
121
121
  return /* @__PURE__ */ a(gt, { ...t, children: o });
@@ -127,7 +127,12 @@ const Lo = Q((t, e) => {
127
127
  }), vt = i(U.Viewport, {
128
128
  _id: "aiChatContentScrollArea__Viewport"
129
129
  }), Uo = Q(({ children: t, ...e }, o) => {
130
- const { messages: r, isStreaming: n } = F(), { aiChatSettings: { shouldAutoScroll: s = !0 } } = p(), { containerRef: d, scrollToBottom: c, handleScroll: m, enableAutoScroll: l } = rt({ isStreaming: n, enabled: s }), u = X(o, d);
130
+ const { messages: r, isStreaming: n } = F(), {
131
+ aiChatSettings: { shouldAutoScroll: s = !0 }
132
+ } = p(), { containerRef: d, scrollToBottom: c, handleScroll: m, enableAutoScroll: l } = rt({
133
+ isStreaming: n,
134
+ enabled: s
135
+ }), u = X(o, d);
131
136
  return W(() => {
132
137
  r.length > 0 && (l(), c());
133
138
  }, [r.length, c, l]), /* @__PURE__ */ a(
@@ -163,14 +168,14 @@ const Lo = Q((t, e) => {
163
168
  return /* @__PURE__ */ a(Ft, { children: O(o, e), ...r });
164
169
  }, _t = i("div", {
165
170
  _id: "aiChatDisclaimer"
166
- }), zo = I(
171
+ }), zo = E(
167
172
  (t) => {
168
173
  const { aiChatSettings: e } = p(), [o, r] = $(!1), n = nt(o, 100);
169
174
  return e.disclaimerSettings?.isEnabled ? /* @__PURE__ */ a(st, { open: o, setOpen: r, children: /* @__PURE__ */ a(B.Root, { open: n, onOpenChange: r, children: /* @__PURE__ */ a(_t, { ...t }) }) }) : null;
170
175
  }
171
176
  ), Pt = i("span", {
172
177
  _id: "aiChatDisclaimerLabel"
173
- }), Go = I(
178
+ }), Go = E(
174
179
  (t) => {
175
180
  const { aiChatSettings: e } = p(), o = e.disclaimerSettings;
176
181
  return /* @__PURE__ */ a(Pt, { children: o?.label, ...t });
@@ -178,7 +183,7 @@ const Lo = Q((t, e) => {
178
183
  ), ft = i(B.Trigger, {
179
184
  _id: "aiChatDisclaimerTrigger",
180
185
  children: /* @__PURE__ */ a(A, { iconKey: "info" })
181
- }), Yo = I(
186
+ }), Yo = E(
182
187
  (t) => {
183
188
  const { setOpen: e } = de();
184
189
  return /* @__PURE__ */ a(
@@ -206,30 +211,30 @@ const Lo = Q((t, e) => {
206
211
  ...t
207
212
  }
208
213
  );
209
- }, Et = i(q, {
214
+ }, It = i(q, {
210
215
  _id: "aiChatDisclaimerText"
211
- }), Jo = I(
216
+ }), Jo = E(
212
217
  (t) => {
213
218
  const { aiChatSettings: e } = p(), o = e.aiAssistantName, n = e.disclaimerSettings?.tooltip || `Information provided by ${o || "this AI assistant"} is not guaranteed to be accurate or comprehensive.`;
214
- return /* @__PURE__ */ a(Et, { shouldOpenLinksInNewTab: !0, children: n, ...t });
219
+ return /* @__PURE__ */ a(It, { shouldOpenLinksInNewTab: !0, children: n, ...t });
215
220
  }
216
221
  ), Xo = i(B.Arrow, {
217
222
  _id: "aiChatDisclaimerArrow"
218
- }), It = i("div", {
223
+ }), Et = i("div", {
219
224
  _id: "aiChatExampleQuestions"
220
225
  }), ea = (t) => {
221
226
  const { aiChatSettings: e } = p(), { messages: o } = F();
222
- return !e.exampleQuestions?.length || o.length ? null : /* @__PURE__ */ a(It, { ...t });
227
+ return !e.exampleQuestions?.length || o.length ? null : /* @__PURE__ */ a(Et, { ...t });
223
228
  }, Mt = i("h3", {
224
229
  _id: "aiChatExampleQuestionsLabel"
225
- }), ta = I(
230
+ }), ta = E(
226
231
  (t) => {
227
232
  const { aiChatSettings: e } = p();
228
233
  return /* @__PURE__ */ a(Mt, { children: e.exampleQuestionsLabel, ...t });
229
234
  }
230
235
  ), At = i("div", {
231
236
  _id: "aiChatExampleQuestionsList"
232
- }), ia = I(
237
+ }), ia = E(
233
238
  (t) => {
234
239
  const { aiChatSettings: e } = p(), o = e.exampleQuestions, { children: r, ...n } = t;
235
240
  return /* @__PURE__ */ a(At, { children: O(r, o), ...n });
@@ -256,7 +261,7 @@ const Lo = Q((t, e) => {
256
261
  }), Tt = (t) => {
257
262
  const { message: e, ...o } = t;
258
263
  return e.role === "system" ? null : /* @__PURE__ */ a(qe, { message: e, children: /* @__PURE__ */ a(xt, { "data-role": e.role, ...o }) });
259
- }, ra = I(
264
+ }, ra = E(
260
265
  (t) => {
261
266
  const { message: e, ...o } = t, { aiChatSettings: r, baseSettings: n } = p(), s = r.aiAssistantName, d = s ? `Hi, I'm ${s}!` : "Hi!", c = r.chatSubjectName ?? n.organizationDisplayName, m = c ? `
262
267
 
@@ -273,7 +278,7 @@ const Lo = Q((t, e) => {
273
278
  ), Ht = i("div", {
274
279
  _id: "aiChatMessageHeader"
275
280
  }), na = (t) => {
276
- const { message: e } = E();
281
+ const { message: e } = P();
277
282
  return /* @__PURE__ */ a(Ht, { "data-role": e.role, ...t });
278
283
  }, Lt = i("div", {
279
284
  _id: "aiChatMessageLoading",
@@ -281,12 +286,12 @@ const Lo = Q((t, e) => {
281
286
  }), sa = (t) => /* @__PURE__ */ a(Lt, { ...t }), wt = i("div", {
282
287
  _id: "aiChatMessageAvatar"
283
288
  }), da = (t) => {
284
- const { message: e } = E();
289
+ const { message: e } = P();
285
290
  return /* @__PURE__ */ a(wt, { "data-role": e.role, ...t });
286
291
  }, Dt = i(Y.Root, {
287
292
  _id: "aiChatMessageAvatarContent"
288
293
  }), ca = (t) => {
289
- const { message: e } = E(), { baseSettings: o } = p();
294
+ const { message: e } = P(), { baseSettings: o } = p();
290
295
  return /* @__PURE__ */ a(
291
296
  Dt,
292
297
  {
@@ -297,9 +302,9 @@ const Lo = Q((t, e) => {
297
302
  );
298
303
  }, Bt = i(Y.Fallback, {
299
304
  _id: "aiChatMessageAvatarFallback"
300
- }), ma = I(
305
+ }), ma = E(
301
306
  (t) => {
302
- const { baseSettings: e } = p(), { message: o } = E();
307
+ const { baseSettings: e } = p(), { message: o } = P();
303
308
  return e.userProperties.name ? /* @__PURE__ */ a(
304
309
  Bt,
305
310
  {
@@ -311,12 +316,12 @@ const Lo = Q((t, e) => {
311
316
  }
312
317
  ), te = i(Y.Image, {
313
318
  _id: "aiChatMessageAvatarImage"
314
- }), la = I(
319
+ }), la = E(
315
320
  (t) => {
316
321
  const { onLoadingStatusChange: e, ...o } = t, {
317
322
  aiChatSettings: r,
318
323
  baseSettings: { userProperties: n }
319
- } = p(), { message: s } = E(), { aiAssistantAvatar: d } = r ?? {}, c = typeof d == "string" ? d : d?.light, m = (typeof d == "string" ? d : d?.dark) ?? c, l = at(c, m), [u, C] = $(l);
324
+ } = p(), { message: s } = P(), { aiAssistantAvatar: d } = r ?? {}, c = typeof d == "string" ? d : d?.light, m = (typeof d == "string" ? d : d?.dark) ?? c, l = at(c, m), [u, C] = $(l);
320
325
  W(() => {
321
326
  C(l);
322
327
  }, [l]);
@@ -364,7 +369,7 @@ const Lo = Q((t, e) => {
364
369
  ), Nt = i("span", {
365
370
  _id: "aiChatMessageName"
366
371
  }), ua = (t) => {
367
- const { message: e } = E(), { aiChatSettings: o } = p(), { aiAssistantName: r } = o;
372
+ const { message: e } = P(), { aiChatSettings: o } = p(), { aiAssistantName: r } = o;
368
373
  return /* @__PURE__ */ a(
369
374
  Nt,
370
375
  {
@@ -376,12 +381,12 @@ const Lo = Q((t, e) => {
376
381
  }, Rt = i("div", {
377
382
  _id: "aiChatMessageContentWrapper"
378
383
  }), ha = (t) => {
379
- const { message: e } = E();
384
+ const { message: e } = P();
380
385
  return /* @__PURE__ */ a(Rt, { "data-role": e.role, ...t });
381
386
  }, Ot = i("div", {
382
387
  _id: "aiChatMessageContent"
383
388
  }), Ca = (t) => {
384
- const { message: e } = E();
389
+ const { message: e } = P();
385
390
  return /* @__PURE__ */ a(Ot, { "data-role": e.role, ...t });
386
391
  }, ba = (t) => {
387
392
  const { text: e, componentStyles: o, ...r } = t, { aiChatSettings: n } = p(), { shouldOpenLinksInNewTab: s } = n;
@@ -405,39 +410,39 @@ const Lo = Q((t, e) => {
405
410
  }, [o]);
406
411
  const _ = v.current, M = D(e);
407
412
  M.current = e;
408
- const f = D(null), x = D(_);
409
- x.current !== _ && (f.current = null, x.current = _), W(() => {
413
+ const S = D(null), x = D(_);
414
+ x.current !== _ && (S.current = null, x.current = _), W(() => {
410
415
  s.current || (s.current = `dyn:${t}:${crypto.randomUUID()}`, u(!0));
411
416
  }, [t]), he(() => {
412
417
  if (!_ || !n || !l || !s.current)
413
418
  return;
414
- const T = s.current, S = document.createElement("div");
415
- return S.setAttribute("data-ikp-component", ""), S.setAttribute("data-component", t), S.setAttribute("slot", T), d.current = S, m.current = !1, n.appendChild(S), h(!0), () => {
419
+ const T = s.current, I = document.createElement("div");
420
+ return I.setAttribute("data-ikp-component", ""), I.setAttribute("data-component", t), I.setAttribute("slot", T), d.current = I, m.current = !1, n.appendChild(I), h(!0), () => {
416
421
  m.current = !0, h(!1), queueMicrotask(() => {
417
422
  try {
418
423
  c.current && (c.current.unmount(), c.current = null);
419
424
  } catch (H) {
420
425
  console.debug("Ignoring unmount error:", H);
421
426
  }
422
- S.parentNode === n && S.remove(), d.current = null;
427
+ I.parentNode === n && I.remove(), d.current = null;
423
428
  });
424
429
  };
425
430
  }, [_, n, l, t]);
426
431
  const V = (T) => {
427
- const S = d.current;
428
- if (!S || m.current) return;
432
+ const I = d.current;
433
+ if (!I || m.current) return;
429
434
  const H = (w) => {
430
- if (f.current !== null) return f.current;
435
+ if (S.current !== null) return S.current;
431
436
  if (typeof w != "function" || w.length > 1)
432
- return f.current = !1, !1;
437
+ return S.current = !1, !1;
433
438
  try {
434
439
  if (w.constructor === Function) {
435
440
  const ue = w({});
436
- return f.current = j.isValidElement(ue), f.current;
441
+ return S.current = j.isValidElement(ue), S.current;
437
442
  }
438
- return f.current = !1, !1;
443
+ return S.current = !1, !1;
439
444
  } catch {
440
- return f.current = !0, !0;
445
+ return S.current = !0, !0;
441
446
  }
442
447
  };
443
448
  let y;
@@ -453,14 +458,14 @@ const Lo = Q((t, e) => {
453
458
  return;
454
459
  }
455
460
  else if (typeof L == "function")
456
- y = L(T || {}, S, null);
461
+ y = L(T || {}, I, null);
457
462
  else {
458
463
  console.error("Invalid component definition");
459
464
  return;
460
465
  }
461
466
  if (j.isValidElement(y) || typeof y == "string") {
462
467
  if (m.current) return;
463
- c.current || (c.current = Ce.createRoot(S)), !m.current && c.current && c.current.render(y);
468
+ c.current || (c.current = Ce.createRoot(I)), !m.current && c.current && c.current.render(y);
464
469
  return;
465
470
  }
466
471
  c.current && !m.current && c.current.render(null);
@@ -475,24 +480,25 @@ const Lo = Q((t, e) => {
475
480
  }), Vt = i("div", {
476
481
  _id: "aiChatMessageToolbar"
477
482
  }), va = (t) => {
478
- const { isLoading: e, messages: o } = F(), { message: r } = E();
483
+ const { isLoading: e, messages: o } = F(), { message: r } = P();
479
484
  return o.at(-1)?.id === r?.id && e || r.role === "user" ? null : /* @__PURE__ */ a(Vt, { ...t });
480
485
  }, Wt = i("div", {
481
486
  _id: "aiChatMessageCustomActions"
482
487
  }), Fa = (t) => {
483
- const { children: e, ...o } = t, { aiChatSettings: r } = p(), { message: n } = E(), { isStreaming: s, messages: d } = F(), c = d.at(-1)?.id === n?.id, m = n.role === "assistant", l = r.messageActions || [];
488
+ const { children: e, ...o } = t, { aiChatSettings: r } = p(), { message: n } = P(), { isStreaming: s, messages: d } = F(), c = d.at(-1)?.id === n?.id, m = n.role === "assistant", l = r.messageActions || [];
484
489
  return c && s || !m ? null : /* @__PURE__ */ a(Wt, { children: O(e, l), ...o });
485
490
  }, Qt = i("a", {
486
491
  _id: "aiChatMessageCustomAction"
487
492
  }), Ut = i("button", {
488
493
  _id: "aiChatMessageCustomAction"
489
494
  }), _a = (t) => {
490
- const { onClick: e, action: o, ...r } = t, { message: n } = E(), { handleAction: s } = J(o, n.id), { logEvent: d } = ee(), { conversationId: c } = F(), m = () => {
495
+ const { onClick: e, action: o, ...r } = t, { message: n } = P(), { handleAction: s } = J(o, n.id), { logEvent: d } = ee(), { conversationId: c } = F(), m = () => {
491
496
  s(), d({
492
497
  eventName: "user_escalation_indicated",
493
498
  properties: {
494
499
  escalationType: "contact_us",
495
- conversationId: c
500
+ conversationId: c,
501
+ messageId: n.id
496
502
  }
497
503
  });
498
504
  }, l = o.label, u = /* @__PURE__ */ G(ie, { children: [
@@ -522,14 +528,15 @@ const Lo = Q((t, e) => {
522
528
  }, $t = i("button", {
523
529
  _id: "aiChatMessageAction"
524
530
  }), Pa = (t) => {
525
- const { action: e, onClick: o, className: r, ...n } = t, { conversationId: s } = F(), { message: d } = E(), { isStreaming: c, messages: m } = F(), [l, u] = z(), { feedback: C, submitPositiveFeedback: h, setCurrentFeedback: v, currentFeedback: _ } = Z(), { logEvent: M } = ee(), [f, x] = Ge(), V = m.at(-1)?.id === d?.id, T = d.role === "assistant";
531
+ const { action: e, onClick: o, className: r, ...n } = t, { conversationId: s } = F(), { message: d } = P(), { isStreaming: c, messages: m } = F(), [l, u] = z(), { feedback: C, submitPositiveFeedback: h, setCurrentFeedback: v, currentFeedback: _ } = Z(), { logEvent: M } = ee(), [S, x] = Ge(), V = m.at(-1)?.id === d?.id, T = d.role === "assistant";
526
532
  if (V && c || !T) return null;
527
533
  const H = {
528
534
  copy() {
529
535
  u(se(d)), M({
530
536
  eventName: "assistant_message_copied",
531
537
  properties: {
532
- conversationId: s
538
+ conversationId: s,
539
+ messageId: d.id
533
540
  }
534
541
  });
535
542
  },
@@ -547,7 +554,7 @@ const Lo = Q((t, e) => {
547
554
  downvote: "Downvote Message"
548
555
  }, L = {
549
556
  copy: /* @__PURE__ */ a(A, { iconKey: l ? "messageCopied" : "messageCopy" }),
550
- upvote: /* @__PURE__ */ a(A, { iconKey: f ? "messageCopied" : "thumbsUp" }),
557
+ upvote: /* @__PURE__ */ a(A, { iconKey: S ? "messageCopied" : "thumbsUp" }),
551
558
  downvote: /* @__PURE__ */ a(A, { iconKey: "thumbsDown" })
552
559
  }, w = {
553
560
  copy: { "data-copied": g(l) },
@@ -574,14 +581,14 @@ const Lo = Q((t, e) => {
574
581
  }, Kt = i("div", {
575
582
  _id: "aiChatMessageSources"
576
583
  }), fa = (t) => {
577
- const { message: e } = E();
584
+ const { message: e } = P();
578
585
  return e.role !== "assistant" || !e.parts.filter(ne).filter((r) => !!r.data?.artifactSummary?.url)?.length ? null : /* @__PURE__ */ a(Kt, { ...t });
579
586
  }, qt = i("div", {
580
587
  _id: "aiChatMessageSources__Header"
581
588
  }), Sa = (t) => /* @__PURE__ */ a(qt, { children: "Sources", ...t }), jt = i("div", {
582
589
  _id: "aiChatMessageSources__List"
583
- }), Ea = (t) => {
584
- const { message: e } = E(), { children: o, ...r } = t, {
590
+ }), Ia = (t) => {
591
+ const { message: e } = P(), { children: o, ...r } = t, {
585
592
  baseSettings: { transformSource: n, organizationDisplayName: s },
586
593
  aiChatSettings: { shouldOpenLinksInNewTab: d },
587
594
  searchSettings: { tabs: c }
@@ -609,18 +616,19 @@ const Lo = Q((t, e) => {
609
616
  })))(v, "chatSourceItem", {
610
617
  organizationDisplayName: s,
611
618
  tabs: c
612
- }), f = M.shouldOpenInNewTab !== void 0 ? M.shouldOpenInNewTab : d;
613
- return { ...M, isExternal: f };
619
+ }), S = M.shouldOpenInNewTab !== void 0 ? M.shouldOpenInNewTab : d;
620
+ return { ...M, isExternal: S };
614
621
  });
615
622
  return /* @__PURE__ */ a(jt, { children: O(o, u), ...r });
616
623
  }, zt = i($e, {
617
624
  _id: "aiChatMessageSourceItem"
618
- }), Ia = (t) => {
619
- const { source: e, onClick: o, ...r } = t, { logEvent: n } = ee(), { conversationId: s } = F(), d = () => {
625
+ }), Ea = (t) => {
626
+ const { source: e, onClick: o, ...r } = t, { logEvent: n } = ee(), { conversationId: s } = F(), { message: d } = P(), c = () => {
620
627
  n({
621
628
  eventName: "assistant_source_item_clicked",
622
629
  properties: {
623
630
  conversationId: s,
631
+ messageId: d.id,
624
632
  link: e
625
633
  }
626
634
  });
@@ -632,7 +640,7 @@ const Lo = Q((t, e) => {
632
640
  appendToUrl: e.appendToUrl,
633
641
  isExternal: e.isExternal,
634
642
  "data-breadcrumbs": !!e.breadcrumbs?.length,
635
- onClick: b(o, d),
643
+ onClick: b(o, c),
636
644
  ...r
637
645
  }
638
646
  ) });
@@ -771,7 +779,7 @@ const Lo = Q((t, e) => {
771
779
  help: () => {
772
780
  },
773
781
  copy: () => {
774
- const S = m.map((H) => {
782
+ const I = m.map((H) => {
775
783
  const y = `**${H.role === "assistant" ? "AI Assistant" : "User"}**`, L = se(H);
776
784
  return `${y}
777
785
 
@@ -781,7 +789,7 @@ ${L}`;
781
789
  ---
782
790
 
783
791
  `);
784
- h(S);
792
+ h(I);
785
793
  },
786
794
  share: async () => {
787
795
  },
@@ -867,7 +875,7 @@ ${L}`;
867
875
  return d === "open_link" ? /* @__PURE__ */ a(mi, { href: e.action.url, ...c }) : /* @__PURE__ */ a(ci, { ...c });
868
876
  }, li = i(B.Trigger, {
869
877
  _id: "aiChatHelpActions__Trigger"
870
- }), ja = I(
878
+ }), ja = E(
871
879
  (t) => {
872
880
  const { aiChatSettings: e } = p();
873
881
  return /* @__PURE__ */ a(me, { action: "help", ...t, asChild: !0, children: /* @__PURE__ */ a(li, { children: e.toolbarButtonLabels?.getHelp ?? "Get Help" }) });
@@ -962,12 +970,12 @@ ${L}`;
962
970
  }), pi = i("div", {
963
971
  _id: "aiChatForm__Wrapper"
964
972
  }), cr = (t) => {
965
- const { form: e } = P();
973
+ const { form: e } = f();
966
974
  return e ? /* @__PURE__ */ a(pi, { ...t }) : null;
967
975
  }, gi = i("form", {
968
976
  _id: "aiChatForm"
969
977
  }), mr = (t) => {
970
- const { onSubmit: e, ...o } = t, { conversationId: r, messages: n } = F(), { handleSubmit: s, isSuccess: d } = P();
978
+ const { onSubmit: e, ...o } = t, { conversationId: r, messages: n } = F(), { handleSubmit: s, isSuccess: d } = f();
971
979
  return d ? null : /* @__PURE__ */ a(
972
980
  gi,
973
981
  {
@@ -982,29 +990,29 @@ ${L}`;
982
990
  _id: "aiChatForm__Close",
983
991
  children: /* @__PURE__ */ a(A, { iconKey: "close" })
984
992
  }), lr = (t) => {
985
- const { onClick: e, ...o } = t, { closeForm: r } = P();
993
+ const { onClick: e, ...o } = t, { closeForm: r } = f();
986
994
  return /* @__PURE__ */ a(vi, { onClick: b(e, r), ...o });
987
995
  }, ur = i("div", {
988
996
  _id: "aiChatForm__Header"
989
997
  }), Fi = i("h2", {
990
998
  _id: "aiChatForm__Heading"
991
999
  }), hr = (t) => {
992
- const { form: e } = P();
1000
+ const { form: e } = f();
993
1001
  return e?.heading ? /* @__PURE__ */ a(Fi, { children: e.heading, ...t }) : null;
994
1002
  }, _i = i(q, {
995
1003
  _id: "aiChatForm__Description"
996
1004
  }), Cr = (t) => {
997
- const { form: e } = P();
1005
+ const { form: e } = f();
998
1006
  return e?.description ? /* @__PURE__ */ a(_i, { shouldOpenLinksInNewTab: !0, children: e.description, ...t }) : null;
999
1007
  }, Pi = i("div", {
1000
1008
  _id: "aiChatForm__Content"
1001
1009
  }), br = (t) => {
1002
- const { children: e, ...o } = t, { getFields: r } = P(), { conversationId: n } = F(), s = r(n) || [];
1010
+ const { children: e, ...o } = t, { getFields: r } = f(), { conversationId: n } = F(), s = r(n) || [];
1003
1011
  return /* @__PURE__ */ a(Pi, { children: O(e, s), ...o });
1004
1012
  }, fi = i("div", {
1005
1013
  _id: "aiChatForm__Field"
1006
1014
  }), pr = (t) => {
1007
- const { field: e, autoFocus: o, ...r } = t, { control: n, errors: s } = P();
1015
+ const { field: e, autoFocus: o, ...r } = t, { control: n, errors: s } = f();
1008
1016
  return /* @__PURE__ */ a(
1009
1017
  tt,
1010
1018
  {
@@ -1046,7 +1054,7 @@ ${L}`;
1046
1054
  ...t
1047
1055
  }
1048
1056
  );
1049
- }, Ei = i("input", {
1057
+ }, Ii = i("input", {
1050
1058
  _id: "aiChatForm__FieldText",
1051
1059
  type: "text"
1052
1060
  }), le = (t) => {
@@ -1057,7 +1065,7 @@ ${L}`;
1057
1065
  autoFocus: d
1058
1066
  } = k(), { onChange: c, onBlur: m, ...l } = t;
1059
1067
  return /* @__PURE__ */ a(
1060
- Ei,
1068
+ Ii,
1061
1069
  {
1062
1070
  id: e.name,
1063
1071
  autoFocus: d,
@@ -1072,7 +1080,7 @@ ${L}`;
1072
1080
  }, vr = i(le, {
1073
1081
  _id: "aiChatForm__FieldEmail",
1074
1082
  type: "email"
1075
- }), Ii = i("input", {
1083
+ }), Ei = i("input", {
1076
1084
  _id: "aiChatForm__FieldFile",
1077
1085
  type: "file",
1078
1086
  multiple: !0
@@ -1087,7 +1095,7 @@ ${L}`;
1087
1095
  n(v);
1088
1096
  };
1089
1097
  return /* @__PURE__ */ a(
1090
- Ii,
1098
+ Ei,
1091
1099
  {
1092
1100
  id: e.name,
1093
1101
  autoFocus: c,
@@ -1137,11 +1145,11 @@ ${L}`;
1137
1145
  ...s
1138
1146
  }
1139
1147
  );
1140
- }, Er = i(_e, {
1148
+ }, Ir = i(_e, {
1141
1149
  _id: "aiChatForm__FieldSelect__Trigger"
1142
1150
  }), yi = i(Se, {
1143
1151
  _id: "aiChatForm__FieldSelect__Value"
1144
- }), Ir = (t) => {
1152
+ }), Er = (t) => {
1145
1153
  const { field: e } = k();
1146
1154
  return /* @__PURE__ */ a(
1147
1155
  yi,
@@ -1187,7 +1195,7 @@ ${L}`;
1187
1195
  ...s
1188
1196
  };
1189
1197
  return /* @__PURE__ */ a(
1190
- Ie,
1198
+ Ee,
1191
1199
  {
1192
1200
  ...C
1193
1201
  }
@@ -1224,7 +1232,7 @@ ${L}`;
1224
1232
  ), Qr = i(
1225
1233
  Te,
1226
1234
  { _id: "aiChatForm__FieldCombobox__ItemIndicator" }
1227
- ), Ur = Ee, $r = i(
1235
+ ), Ur = Ie, $r = i(
1228
1236
  Le,
1229
1237
  { _id: "aiChatForm__FieldCombobox__ListEmpty" }
1230
1238
  ), Bi = i("p", {
@@ -1240,7 +1248,7 @@ ${L}`;
1240
1248
  }, Ri = i("span", {
1241
1249
  _id: "aiChatForm__Error"
1242
1250
  }), jr = (t) => {
1243
- const { formError: e } = P();
1251
+ const { formError: e } = f();
1244
1252
  return e ? /* @__PURE__ */ a(Ri, { children: e.message, ...t }) : null;
1245
1253
  }, zr = i("div", {
1246
1254
  _id: "aiChatForm__Footer"
@@ -1249,29 +1257,29 @@ ${L}`;
1249
1257
  children: "Cancel",
1250
1258
  type: "button"
1251
1259
  }), Gr = (t) => {
1252
- const { onClick: e, ...o } = t, { closeForm: r } = P();
1260
+ const { onClick: e, ...o } = t, { closeForm: r } = f();
1253
1261
  return /* @__PURE__ */ a(Oi, { onClick: b(e, r), ...o });
1254
1262
  }, Vi = i("button", {
1255
1263
  _id: "aiChatForm__Submit",
1256
1264
  children: "Submit",
1257
1265
  type: "submit"
1258
1266
  }), Yr = (t) => {
1259
- const { onClick: e, ...o } = t, { isSubmitting: r, form: n } = P(), s = n?.buttons.submit.label || "Submit";
1267
+ const { onClick: e, ...o } = t, { isSubmitting: r, form: n } = f(), s = n?.buttons.submit.label || "Submit";
1260
1268
  return /* @__PURE__ */ a(Vi, { disabled: r, ...o, children: s });
1261
1269
  }, Wi = i("div", {
1262
1270
  _id: "aiChatForm__Success"
1263
1271
  }), Zr = (t) => {
1264
- const { isSuccess: e } = P();
1272
+ const { isSuccess: e } = f();
1265
1273
  return e ? /* @__PURE__ */ a(Wi, { ...t }) : null;
1266
1274
  }, Qi = i("h2", {
1267
1275
  _id: "aiChatForm__SuccessHeading"
1268
1276
  }), Jr = (t) => {
1269
- const { form: e } = P();
1277
+ const { form: e } = f();
1270
1278
  return /* @__PURE__ */ a(Qi, { children: e?.successView?.heading, ...t });
1271
1279
  }, Ui = i(q, {
1272
1280
  _id: "aiChatForm__SuccessMessage"
1273
1281
  }), Xr = (t) => {
1274
- const { form: e } = P();
1282
+ const { form: e } = f();
1275
1283
  return /* @__PURE__ */ a(
1276
1284
  Ui,
1277
1285
  {
@@ -1283,7 +1291,7 @@ ${L}`;
1283
1291
  }, $i = i("button", {
1284
1292
  _id: "aiChatForm__SuccessButton"
1285
1293
  }), en = (t) => {
1286
- const { onClick: e, ...o } = t, { form: r, closeForm: n } = P(), s = r?.successView?.doneButton;
1294
+ const { onClick: e, ...o } = t, { form: r, closeForm: n } = f(), s = r?.successView?.doneButton;
1287
1295
  if (!s) return null;
1288
1296
  const d = s.icon && /* @__PURE__ */ a(N, { iconSettings: s.icon }), c = s.label;
1289
1297
  return /* @__PURE__ */ a(
@@ -1392,8 +1400,8 @@ export {
1392
1400
  kr as EmbeddedChatPrimitiveFormFieldSelectItem,
1393
1401
  Tr as EmbeddedChatPrimitiveFormFieldSelectItemIndicator,
1394
1402
  xr as EmbeddedChatPrimitiveFormFieldSelectItemText,
1395
- Er as EmbeddedChatPrimitiveFormFieldSelectTrigger,
1396
- Ir as EmbeddedChatPrimitiveFormFieldSelectValue,
1403
+ Ir as EmbeddedChatPrimitiveFormFieldSelectTrigger,
1404
+ Er as EmbeddedChatPrimitiveFormFieldSelectValue,
1397
1405
  yr as EmbeddedChatPrimitiveFormFieldSelectViewport,
1398
1406
  le as EmbeddedChatPrimitiveFormFieldText,
1399
1407
  _r as EmbeddedChatPrimitiveFormFieldTextArea,
@@ -1429,7 +1437,7 @@ export {
1429
1437
  na as EmbeddedChatPrimitiveMessageHeader,
1430
1438
  sa as EmbeddedChatPrimitiveMessageLoading,
1431
1439
  ua as EmbeddedChatPrimitiveMessageName,
1432
- Ia as EmbeddedChatPrimitiveMessageSourceItem,
1440
+ Ea as EmbeddedChatPrimitiveMessageSourceItem,
1433
1441
  Ma as EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs,
1434
1442
  Ta as EmbeddedChatPrimitiveMessageSourceItemDescription,
1435
1443
  Ha as EmbeddedChatPrimitiveMessageSourceItemDescriptionPart,
@@ -1439,7 +1447,7 @@ export {
1439
1447
  ka as EmbeddedChatPrimitiveMessageSourceItemTitle,
1440
1448
  fa as EmbeddedChatPrimitiveMessageSources,
1441
1449
  Sa as EmbeddedChatPrimitiveMessageSourcesHeader,
1442
- Ea as EmbeddedChatPrimitiveMessageSourcesList,
1450
+ Ia as EmbeddedChatPrimitiveMessageSourcesList,
1443
1451
  va as EmbeddedChatPrimitiveMessageToolbar,
1444
1452
  Tt as EmbeddedChatPrimitiveMessageWrapper,
1445
1453
  jo as EmbeddedChatPrimitiveMessages,
@@ -1514,8 +1522,8 @@ export {
1514
1522
  kr as FormFieldSelectItem,
1515
1523
  Tr as FormFieldSelectItemIndicator,
1516
1524
  xr as FormFieldSelectItemText,
1517
- Er as FormFieldSelectTrigger,
1518
- Ir as FormFieldSelectValue,
1525
+ Ir as FormFieldSelectTrigger,
1526
+ Er as FormFieldSelectValue,
1519
1527
  yr as FormFieldSelectViewport,
1520
1528
  le as FormFieldText,
1521
1529
  _r as FormFieldTextArea,
@@ -1551,8 +1559,8 @@ export {
1551
1559
  Pn as InputNotificationClose,
1552
1560
  fn as InputNotificationContent,
1553
1561
  Sn as InputNotificationHeader,
1554
- En as InputNotificationMessage,
1555
- In as InputNotificationTitle,
1562
+ In as InputNotificationMessage,
1563
+ En as InputNotificationTitle,
1556
1564
  ra as IntroMessageWrapper,
1557
1565
  ba as Markdown,
1558
1566
  Pa as MessageAction,
@@ -1569,7 +1577,7 @@ export {
1569
1577
  na as MessageHeader,
1570
1578
  sa as MessageLoading,
1571
1579
  ua as MessageName,
1572
- Ia as MessageSourceItem,
1580
+ Ea as MessageSourceItem,
1573
1581
  Aa as MessageSourceItemBreadcrumbIcon,
1574
1582
  Ma as MessageSourceItemBreadcrumbs,
1575
1583
  Ta as MessageSourceItemDescription,
@@ -1580,7 +1588,7 @@ export {
1580
1588
  ka as MessageSourceItemTitle,
1581
1589
  fa as MessageSources,
1582
1590
  Sa as MessageSourcesHeader,
1583
- Ea as MessageSourcesList,
1591
+ Ia as MessageSourcesList,
1584
1592
  va as MessageToolbar,
1585
1593
  Tt as MessageWrapper,
1586
1594
  jo as Messages,