@aleph-alpha/chat-kit 5.11.0 → 5.13.0

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 (69) hide show
  1. package/dist/{CkHistory.vue_vue_type_script_setup_true_lang-SL1vOAd9.js → CkHistory.vue_vue_type_script_setup_true_lang-BNcJURkq.js} +216 -87
  2. package/dist/chat-kit.css +13 -13
  3. package/dist/components/base/CkCitation/CkCitation.stories.d.ts +1 -4
  4. package/dist/components/base/CkCitation/CkCitation.stories.d.ts.map +1 -1
  5. package/dist/components/base/CkCitation/CkCitation.vue.d.ts.map +1 -1
  6. package/dist/components/base/CkCitation/types.d.ts +6 -1
  7. package/dist/components/base/CkCitation/types.d.ts.map +1 -1
  8. package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts +13 -2
  9. package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts.map +1 -1
  10. package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts +1 -0
  11. package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts.map +1 -1
  12. package/dist/components/base/CkCitationCard/types.d.ts +6 -1
  13. package/dist/components/base/CkCitationCard/types.d.ts.map +1 -1
  14. package/dist/components/base/CkCitationLabel/CkCitationLabel.stories.d.ts +39 -0
  15. package/dist/components/base/CkCitationLabel/CkCitationLabel.stories.d.ts.map +1 -0
  16. package/dist/components/base/CkCitationLabel/CkCitationLabel.vue.d.ts +9 -0
  17. package/dist/components/base/CkCitationLabel/CkCitationLabel.vue.d.ts.map +1 -0
  18. package/dist/components/base/CkCitationLabel/index.d.ts +3 -0
  19. package/dist/components/base/CkCitationLabel/index.d.ts.map +1 -0
  20. package/dist/components/base/CkCitationLabel/types.d.ts +44 -0
  21. package/dist/components/base/CkCitationLabel/types.d.ts.map +1 -0
  22. package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.stories.d.ts +7 -0
  23. package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.stories.d.ts.map +1 -1
  24. package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.vue.d.ts +2 -2
  25. package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.vue.d.ts.map +1 -1
  26. package/dist/components/base/CkFeedbackDialog/types.d.ts +19 -0
  27. package/dist/components/base/CkFeedbackDialog/types.d.ts.map +1 -1
  28. package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts +1 -1
  29. package/dist/components/base/CkUserMessage/CkUserMessage.vue.d.ts.map +1 -1
  30. package/dist/components/base/index.d.ts +2 -0
  31. package/dist/components/base/index.d.ts.map +1 -1
  32. package/dist/components/composed/CkConversation/CkConversation.stories.d.ts +12 -0
  33. package/dist/components/composed/CkConversation/CkConversation.stories.d.ts.map +1 -1
  34. package/dist/components/index.d.ts +2 -2
  35. package/dist/components/index.d.ts.map +1 -1
  36. package/dist/components/index.js +28 -27
  37. package/dist/composables/useIsTruncated.d.ts +22 -0
  38. package/dist/composables/useIsTruncated.d.ts.map +1 -0
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +29 -28
  42. package/dist/types.d.ts +33 -4
  43. package/dist/types.d.ts.map +1 -1
  44. package/package.json +5 -5
  45. package/src/components/base/CkCitation/CkCitation.spec.ts +14 -3
  46. package/src/components/base/CkCitation/CkCitation.stories.ts +85 -3
  47. package/src/components/base/CkCitation/CkCitation.vue +13 -36
  48. package/src/components/base/CkCitation/types.ts +6 -1
  49. package/src/components/base/CkCitationCard/CkCitationCard.spec.ts +37 -0
  50. package/src/components/base/CkCitationCard/CkCitationCard.stories.ts +30 -3
  51. package/src/components/base/CkCitationCard/CkCitationCard.vue +53 -11
  52. package/src/components/base/CkCitationCard/types.ts +6 -1
  53. package/src/components/base/CkCitationLabel/CkCitationLabel.spec.ts +73 -0
  54. package/src/components/base/CkCitationLabel/CkCitationLabel.stories.ts +86 -0
  55. package/src/components/base/CkCitationLabel/CkCitationLabel.vue +70 -0
  56. package/src/components/base/CkCitationLabel/index.ts +2 -0
  57. package/src/components/base/CkCitationLabel/types.ts +43 -0
  58. package/src/components/base/CkFeedbackDialog/CkFeedbackDialog.spec.ts +36 -0
  59. package/src/components/base/CkFeedbackDialog/CkFeedbackDialog.stories.ts +42 -0
  60. package/src/components/base/CkFeedbackDialog/CkFeedbackDialog.vue +11 -1
  61. package/src/components/base/CkFeedbackDialog/types.ts +20 -0
  62. package/src/components/base/CkUserMessage/CkUserMessage.vue +1 -1
  63. package/src/components/base/index.ts +2 -0
  64. package/src/components/composed/CkConversation/CkConversation.spec.ts +65 -2
  65. package/src/components/composed/CkConversation/CkConversation.stories.ts +136 -0
  66. package/src/components/index.ts +2 -0
  67. package/src/composables/useIsTruncated.ts +82 -0
  68. package/src/index.ts +2 -0
  69. package/src/types.ts +34 -4
@@ -1,5 +1,5 @@
1
- import { defineComponent, openBlock, createBlock, unref, createElementBlock, createElementVNode, normalizeClass, renderSlot, createCommentVNode, mergeProps, withCtx, computed, createVNode, toDisplayString, ref, onBeforeUnmount, useSlots, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, Transition, createStaticVNode, Teleport, withModifiers, toValue, h, toRefs, useId, createTextVNode, useAttrs, resolveDynamicComponent, useTemplateRef, onUpdated, createSlots, normalizeProps, guardReactiveProps, Comment, Text } from "vue";
2
- import { UiIcon, UiButton, UiFileType, UiPopover, UiPopoverTrigger, UiPopoverContent, UiTooltip, formatFileSize, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem, UiProgress, Primitive, UiFloatActions, UiFloatActionItems, UiCodeBlock, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
1
+ import { defineComponent, openBlock, createBlock, unref, createElementBlock, createElementVNode, normalizeClass, renderSlot, createCommentVNode, mergeProps, withCtx, ref, watch, onScopeDispose, computed, useTemplateRef, createVNode, toDisplayString, resolveDynamicComponent, onBeforeUnmount, useSlots, onMounted, nextTick, onUnmounted, Fragment, renderList, normalizeStyle, Transition, createStaticVNode, Teleport, withModifiers, toValue, h, toRefs, useId, createTextVNode, useAttrs, onUpdated, createSlots, normalizeProps, guardReactiveProps, Comment, Text } from "vue";
2
+ import { UiIcon, UiButton, UiFileType, UiTooltip, UiPopover, UiPopoverTrigger, UiPopoverContent, formatFileSize, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem, UiProgress, Primitive, UiFloatActions, UiFloatActionItems, UiCodeBlock, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
3
3
  import { u as useChatKitLabels, d as defaultChatKitLabels, r as remarkCitations, b as useMarkdownParser } from "./useChatKitLabels-CMOr3Kjq.js";
4
4
  const MINUTE = 60;
5
5
  const HOUR = 60 * MINUTE;
@@ -36,7 +36,7 @@ function formatRelativeTime(unixSeconds, nowSeconds = Math.floor(Date.now() / 1e
36
36
  const years = Math.floor(delta / YEAR);
37
37
  return years === 1 ? "1 year ago" : `${years} years ago`;
38
38
  }
39
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
39
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
40
40
  ...{ name: "CkSendIcon" },
41
41
  __name: "CkSendIcon",
42
42
  setup(__props) {
@@ -45,19 +45,19 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
45
45
  };
46
46
  }
47
47
  });
48
- const _hoisted_1$h = {
48
+ const _hoisted_1$g = {
49
49
  xmlns: "http://www.w3.org/2000/svg",
50
50
  width: "16",
51
51
  height: "16",
52
52
  viewBox: "0 0 16 16",
53
53
  fill: "none"
54
54
  };
55
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
55
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
56
56
  ...{ name: "CkStopIcon" },
57
57
  __name: "CkStopIcon",
58
58
  setup(__props) {
59
59
  return (_ctx, _cache) => {
60
- return openBlock(), createElementBlock("svg", _hoisted_1$h, [..._cache[0] || (_cache[0] = [
60
+ return openBlock(), createElementBlock("svg", _hoisted_1$g, [..._cache[0] || (_cache[0] = [
61
61
  createElementVNode("path", {
62
62
  d: "M13.3335 3.33301C13.3335 2.96482 13.035 2.66634 12.6668 2.66634H3.3335C2.96531 2.66634 2.66683 2.96482 2.66683 3.33301V12.6663C2.66683 13.0345 2.96531 13.333 3.3335 13.333H12.6668C13.035 13.333 13.3335 13.0345 13.3335 12.6663V3.33301ZM14.6668 12.6663C14.6668 13.7709 13.7714 14.6663 12.6668 14.6663H3.3335C2.22893 14.6663 1.3335 13.7709 1.3335 12.6663V3.33301C1.3335 2.22844 2.22893 1.33301 3.3335 1.33301H12.6668C13.7714 1.33301 14.6668 2.22844 14.6668 3.33301V12.6663Z",
63
63
  fill: "currentColor"
@@ -66,7 +66,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
66
66
  };
67
67
  }
68
68
  });
69
- const _hoisted_1$g = {
69
+ const _hoisted_1$f = {
70
70
  key: 0,
71
71
  "data-testid": "ck-agent-message-header",
72
72
  class: "w-full min-w-0"
@@ -76,7 +76,7 @@ const _hoisted_3$9 = {
76
76
  key: 1,
77
77
  class: "flex items-center gap-4"
78
78
  };
79
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
79
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
80
80
  ...{ name: "CkAgentMessage" },
81
81
  __name: "CkAgentMessage",
82
82
  props: {
@@ -90,7 +90,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
90
90
  __props.bottomSeparator && "border-border-surface-default border-b"
91
91
  ])
92
92
  }, [
93
- _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
93
+ _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
94
94
  renderSlot(_ctx.$slots, "header")
95
95
  ])) : createCommentVNode("", true),
96
96
  createElementVNode("div", _hoisted_2$a, [
@@ -103,7 +103,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
103
103
  };
104
104
  }
105
105
  });
106
- const _hoisted_1$f = {
106
+ const _hoisted_1$e = {
107
107
  key: 0,
108
108
  "data-testid": "ck-agent-message-header-icon",
109
109
  class: "flex flex-shrink-0 items-center justify-center"
@@ -114,7 +114,7 @@ const _hoisted_3$8 = {
114
114
  "data-testid": "ck-agent-message-header-activity",
115
115
  class: "flex flex-shrink-0 items-center"
116
116
  };
117
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
117
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
118
118
  ...{ name: "CkAgentMessageHeader" },
119
119
  __name: "CkAgentMessageHeader",
120
120
  setup(__props) {
@@ -126,7 +126,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
126
126
  _ctx.$slots.activity && "border-border-surface-default border-b py-4"
127
127
  ])
128
128
  }, [
129
- _ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
129
+ _ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_1$e, [
130
130
  renderSlot(_ctx.$slots, "icon")
131
131
  ])) : createCommentVNode("", true),
132
132
  createElementVNode("span", _hoisted_2$9, [
@@ -139,7 +139,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
139
139
  };
140
140
  }
141
141
  });
142
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
142
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
143
143
  ...{
144
144
  name: "CkHeaderActivityButton"
145
145
  },
@@ -181,15 +181,61 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
181
181
  };
182
182
  }
183
183
  });
184
- const _hoisted_1$e = { class: "ck-citation-card flex w-[22.5rem] max-w-[90vw] flex-col gap-2 rounded-md bg-background-surface-floating px-6 pb-6 pt-4 shadow-md" };
185
- const _hoisted_2$8 = { class: "flex items-center gap-2" };
186
- const _hoisted_3$7 = ["title"];
187
- const _hoisted_4$7 = { class: "line-clamp-6 break-words text-sm leading-5 text-content-on-surface-secondary" };
188
- const _hoisted_5$4 = {
184
+ const measurers = /* @__PURE__ */ new WeakMap();
185
+ let sharedObserver;
186
+ function getSharedObserver() {
187
+ if (typeof ResizeObserver === "undefined") return void 0;
188
+ sharedObserver ??= new ResizeObserver((entries) => {
189
+ for (const entry of entries) measurers.get(entry.target)?.();
190
+ });
191
+ return sharedObserver;
192
+ }
193
+ function watchElement(el, measure) {
194
+ measurers.set(el, measure);
195
+ getSharedObserver()?.observe(el);
196
+ }
197
+ function unwatchElement(el) {
198
+ measurers.delete(el);
199
+ getSharedObserver()?.unobserve(el);
200
+ }
201
+ function useIsTruncated(elementRef, watchSource) {
202
+ const isTruncated = ref(false);
203
+ function measure() {
204
+ const el = elementRef.value;
205
+ isTruncated.value = el ? el.scrollWidth - el.clientWidth >= 1 : false;
206
+ }
207
+ if (watchSource) watch(watchSource, measure, { flush: "post" });
208
+ watch(
209
+ elementRef,
210
+ (el, previous) => {
211
+ if (previous) unwatchElement(previous);
212
+ if (el) watchElement(el, measure);
213
+ measure();
214
+ },
215
+ { immediate: true, flush: "post" }
216
+ );
217
+ onScopeDispose(() => {
218
+ if (elementRef.value) unwatchElement(elementRef.value);
219
+ });
220
+ return isTruncated;
221
+ }
222
+ const _hoisted_1$d = { class: "ck-citation-card flex w-[22.5rem] max-w-[90vw] flex-col gap-2 rounded-md bg-background-surface-floating px-6 pb-6 pt-4 shadow-md" };
223
+ const _hoisted_2$8 = { class: "flex min-w-0 items-center gap-3 py-0.5" };
224
+ const _hoisted_3$7 = { class: "line-clamp-6 break-words text-sm leading-5 text-content-on-surface-secondary" };
225
+ const _hoisted_4$7 = {
189
226
  key: 0,
190
- class: "text-sm leading-5 text-content-on-surface-muted"
227
+ class: "flex items-center gap-1.5 text-sm leading-5 text-content-on-surface-muted"
191
228
  };
192
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
229
+ const _hoisted_5$4 = {
230
+ key: 1,
231
+ "aria-hidden": "true",
232
+ class: "shrink-0 text-border-input-strong"
233
+ };
234
+ const _hoisted_6$4 = {
235
+ key: 2,
236
+ class: "shrink-0"
237
+ };
238
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
193
239
  ...{
194
240
  name: "CkCitationCard"
195
241
  },
@@ -198,6 +244,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
198
244
  fileName: {},
199
245
  snippet: {},
200
246
  locationLabel: { default: void 0 },
247
+ collectionName: { default: void 0 },
201
248
  url: { default: void 0 },
202
249
  openSourceLabel: { default: void 0 }
203
250
  },
@@ -209,22 +256,39 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
209
256
  const openSourceAriaLabel = computed(
210
257
  () => props.openSourceLabel ?? labels.value.citationOpenSource ?? defaultChatKitLabels.citationOpenSource
211
258
  );
259
+ const fileNameRef = useTemplateRef("fileNameRef");
260
+ const collectionRef = useTemplateRef("collectionRef");
261
+ const isFileNameTruncated = useIsTruncated(fileNameRef, () => props.fileName);
262
+ const isCollectionTruncated = useIsTruncated(
263
+ collectionRef,
264
+ () => props.collectionName
265
+ );
212
266
  function handleOpen() {
213
267
  if (props.url) {
214
268
  emit("open-source", props.url);
215
269
  }
216
270
  }
217
271
  return (_ctx, _cache) => {
218
- return openBlock(), createElementBlock("div", _hoisted_1$e, [
272
+ return openBlock(), createElementBlock("div", _hoisted_1$d, [
219
273
  createElementVNode("div", _hoisted_2$8, [
220
274
  createVNode(unref(UiFileType), {
221
275
  filename: __props.fileName,
222
276
  class: "shrink-0"
223
277
  }, null, 8, ["filename"]),
224
- createElementVNode("p", {
225
- class: "min-w-0 truncate text-sm font-medium text-content-on-surface-primary",
226
- title: __props.fileName
227
- }, toDisplayString(__props.fileName), 9, _hoisted_3$7),
278
+ createVNode(unref(UiTooltip), {
279
+ content: __props.fileName,
280
+ disabled: !unref(isFileNameTruncated),
281
+ align: "start"
282
+ }, {
283
+ default: withCtx(() => [
284
+ createElementVNode("p", {
285
+ ref_key: "fileNameRef",
286
+ ref: fileNameRef,
287
+ class: "min-w-0 truncate text-sm font-medium leading-4 text-content-on-surface-primary"
288
+ }, toDisplayString(__props.fileName), 513)
289
+ ]),
290
+ _: 1
291
+ }, 8, ["content", "disabled"]),
228
292
  __props.url ? (openBlock(), createBlock(unref(UiButton), {
229
293
  key: 0,
230
294
  variant: "ghost",
@@ -243,13 +307,79 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
243
307
  _: 1
244
308
  }, 8, ["aria-label"])) : createCommentVNode("", true)
245
309
  ]),
246
- createElementVNode("p", _hoisted_4$7, toDisplayString(__props.snippet), 1),
247
- __props.locationLabel ? (openBlock(), createElementBlock("p", _hoisted_5$4, toDisplayString(__props.locationLabel), 1)) : createCommentVNode("", true)
310
+ createElementVNode("p", _hoisted_3$7, toDisplayString(__props.snippet), 1),
311
+ __props.collectionName || __props.locationLabel ? (openBlock(), createElementBlock("p", _hoisted_4$7, [
312
+ __props.collectionName ? (openBlock(), createBlock(unref(UiTooltip), {
313
+ key: 0,
314
+ content: __props.collectionName,
315
+ disabled: !unref(isCollectionTruncated),
316
+ align: "start"
317
+ }, {
318
+ default: withCtx(() => [
319
+ createElementVNode("span", {
320
+ ref_key: "collectionRef",
321
+ ref: collectionRef,
322
+ class: "min-w-0 truncate"
323
+ }, toDisplayString(__props.collectionName), 513)
324
+ ]),
325
+ _: 1
326
+ }, 8, ["content", "disabled"])) : createCommentVNode("", true),
327
+ __props.collectionName && __props.locationLabel ? (openBlock(), createElementBlock("span", _hoisted_5$4, " | ")) : createCommentVNode("", true),
328
+ __props.locationLabel ? (openBlock(), createElementBlock("span", _hoisted_6$4, toDisplayString(__props.locationLabel), 1)) : createCommentVNode("", true)
329
+ ])) : createCommentVNode("", true)
248
330
  ]);
249
331
  };
250
332
  }
251
333
  });
252
- const _hoisted_1$d = ["aria-label"];
334
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
335
+ ...{
336
+ name: "CkCitationLabel"
337
+ },
338
+ __name: "CkCitationLabel",
339
+ props: {
340
+ index: {},
341
+ selected: { type: Boolean, default: false },
342
+ as: { default: "span" },
343
+ ariaLabel: { default: void 0 }
344
+ },
345
+ setup(__props) {
346
+ const props = __props;
347
+ const labels = useChatKitLabels();
348
+ const isButton = computed(() => props.as === "button");
349
+ const resolvedAriaLabel = computed(
350
+ () => props.ariaLabel ?? `${labels.value.citationSourceLabel ?? defaultChatKitLabels.citationSourceLabel} ${props.index}`
351
+ );
352
+ return (_ctx, _cache) => {
353
+ return openBlock(), createBlock(resolveDynamicComponent(__props.as), {
354
+ type: isButton.value ? "button" : void 0,
355
+ role: isButton.value ? void 0 : "img",
356
+ "aria-label": resolvedAriaLabel.value,
357
+ class: normalizeClass([
358
+ "ck-citation ui-focus-ring mx-px inline-flex h-5 min-w-5 items-center justify-center rounded-sm border border-transparent px-1 align-middle text-sm leading-4 tabular-nums transition-colors",
359
+ // The static chip is part of the prose: it must stay selectable so the
360
+ // number survives a copy of the surrounding text. A control shouldn't
361
+ // start a text selection on click, so button mode keeps `select-none`.
362
+ // Only the control gets the hover layer; a static chip has no hover state.
363
+ isButton.value ? "select-none hover-layer hover-layer-default" : "",
364
+ __props.selected ? "bg-background-accent-soft text-content-on-accent-soft" : "bg-background-surface-citation text-content-on-surface-primary"
365
+ ])
366
+ }, {
367
+ default: withCtx(() => [
368
+ createElementVNode("span", null, toDisplayString(__props.index), 1)
369
+ ]),
370
+ _: 1
371
+ }, 8, ["type", "role", "aria-label", "class"]);
372
+ };
373
+ }
374
+ });
375
+ const _export_sfc = (sfc, props) => {
376
+ const target = sfc.__vccOpts || sfc;
377
+ for (const [key, val] of props) {
378
+ target[key] = val;
379
+ }
380
+ return target;
381
+ };
382
+ const CkCitationLabel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-554678fe"]]);
253
383
  const CLOSE_DELAY_MS = 80;
254
384
  const _sfc_main$n = /* @__PURE__ */ defineComponent({
255
385
  ...{
@@ -264,16 +394,12 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
264
394
  fileName: {},
265
395
  snippet: {},
266
396
  locationLabel: { default: void 0 },
397
+ collectionName: {},
267
398
  url: { default: void 0 }
268
399
  },
269
400
  emits: ["open-source"],
270
401
  setup(__props, { emit: __emit }) {
271
- const props = __props;
272
402
  const emit = __emit;
273
- const labels = useChatKitLabels();
274
- const triggerLabel = computed(
275
- () => props.ariaLabel ?? `${labels.value.citationSourceLabel ?? defaultChatKitLabels.citationSourceLabel} ${props.index}`
276
- );
277
403
  const open = ref(false);
278
404
  const openedByPointer = ref(false);
279
405
  let closeTimer;
@@ -327,17 +453,15 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
327
453
  default: withCtx(() => [
328
454
  createVNode(unref(UiPopoverTrigger), { "as-child": "" }, {
329
455
  default: withCtx(() => [
330
- createElementVNode("button", {
331
- type: "button",
332
- "aria-label": triggerLabel.value,
333
- class: normalizeClass([
334
- "ck-citation mx-px inline-flex h-5 min-w-5 select-none items-center justify-center rounded-sm px-1 align-middle text-sm leading-4 tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
335
- __props.selected ? "bg-background-accent-soft text-black" : "bg-background-accent-yellow text-background-status-warning"
336
- ]),
456
+ createVNode(unref(CkCitationLabel), {
457
+ as: "button",
458
+ index: __props.index,
459
+ selected: __props.selected || open.value,
460
+ "aria-label": __props.ariaLabel,
337
461
  onKeydown: onTriggerKeydown,
338
462
  onMouseenter: onPointerEnter,
339
463
  onMouseleave: onPointerLeave
340
- }, toDisplayString(__props.index), 43, _hoisted_1$d)
464
+ }, null, 8, ["index", "selected", "aria-label"])
341
465
  ]),
342
466
  _: 1
343
467
  }),
@@ -353,14 +477,15 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
353
477
  onFocusout: onContentFocusOut
354
478
  }, {
355
479
  default: withCtx(() => [
356
- createVNode(unref(_sfc_main$o), {
480
+ createVNode(unref(_sfc_main$p), {
357
481
  "file-name": __props.fileName,
358
482
  snippet: __props.snippet,
359
483
  "location-label": __props.locationLabel,
484
+ "collection-name": __props.collectionName,
360
485
  url: __props.url,
361
486
  "open-source-label": __props.openSourceLabel,
362
487
  onOpenSource: _cache[0] || (_cache[0] = (u) => emit("open-source", u))
363
- }, null, 8, ["file-name", "snippet", "location-label", "url", "open-source-label"])
488
+ }, null, 8, ["file-name", "snippet", "location-label", "collection-name", "url", "open-source-label"])
364
489
  ]),
365
490
  _: 1
366
491
  })
@@ -370,14 +495,6 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
370
495
  };
371
496
  }
372
497
  });
373
- const _export_sfc = (sfc, props) => {
374
- const target = sfc.__vccOpts || sfc;
375
- for (const [key, val] of props) {
376
- target[key] = val;
377
- }
378
- return target;
379
- };
380
- const CkCitation = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-73025da4"]]);
381
498
  const _hoisted_1$c = { class: "relative flex min-h-0 flex-col overflow-hidden" };
382
499
  const _hoisted_2$7 = ["data-message-row"];
383
500
  const _hoisted_3$6 = {
@@ -1061,7 +1178,7 @@ function useCitationRendering(citations, onOpenSource) {
1061
1178
  const source = sourcesByIndex.value.get(index);
1062
1179
  if (!source) return null;
1063
1180
  if (slot) return slot({ source, openSource: onOpenSource });
1064
- return h(CkCitation, { ...source, onOpenSource });
1181
+ return h(_sfc_main$n, { ...source, onOpenSource });
1065
1182
  }
1066
1183
  return { citationPlugins, renderCitationNode };
1067
1184
  }
@@ -1202,6 +1319,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
1202
1319
  open: { type: Boolean, default: false },
1203
1320
  sentiment: {},
1204
1321
  responseText: { default: "" },
1322
+ citations: {},
1205
1323
  reasons: {},
1206
1324
  maxFreeTextLength: { default: 250 },
1207
1325
  reasonRequired: { type: Boolean, default: true },
@@ -1358,7 +1476,17 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
1358
1476
  _: 1
1359
1477
  }),
1360
1478
  createElementVNode("div", _hoisted_2$5, [
1361
- createVNode(unref(_sfc_main$g), { content: __props.responseText }, null, 8, ["content"])
1479
+ createVNode(unref(_sfc_main$g), {
1480
+ content: __props.responseText,
1481
+ citations: __props.citations
1482
+ }, {
1483
+ citation: withCtx(({ source }) => [
1484
+ createVNode(unref(CkCitationLabel), {
1485
+ index: source.index
1486
+ }, null, 8, ["index"])
1487
+ ]),
1488
+ _: 1
1489
+ }, 8, ["content", "citations"])
1362
1490
  ])
1363
1491
  ])) : createCommentVNode("", true),
1364
1492
  createElementVNode("section", _hoisted_3$4, [
@@ -1424,7 +1552,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
1424
1552
  };
1425
1553
  }
1426
1554
  });
1427
- const CkFeedbackDialog = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-bdf7bf3d"]]);
1555
+ const CkFeedbackDialog = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-175a7cb9"]]);
1428
1556
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
1429
1557
  ...{
1430
1558
  name: "CkFileItemRow",
@@ -2488,7 +2616,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2488
2616
  createElementVNode("div", {
2489
2617
  ref_key: "contentRef",
2490
2618
  ref: contentRef,
2491
- class: normalizeClass(["ck-user-message__content text-content-on-surface-muted min-w-0 max-w-full self-stretch text-lg leading-7 font-medium break-words whitespace-pre-wrap [overflow-wrap:anywhere]", {
2619
+ class: normalizeClass(["ck-user-message__content select-text text-content-on-surface-muted min-w-0 max-w-full self-stretch text-lg leading-7 font-medium break-words whitespace-pre-wrap [overflow-wrap:anywhere]", {
2492
2620
  "ck-user-message__content--clamped": clampEnabled.value && !expanded.value,
2493
2621
  "ck-user-message__content--faded": clampEnabled.value && !expanded.value && isOverflowing.value
2494
2622
  }]),
@@ -2511,7 +2639,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2511
2639
  };
2512
2640
  }
2513
2641
  });
2514
- const CkUserMessage = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-4ca9ee1b"]]);
2642
+ const CkUserMessage = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-75aacd04"]]);
2515
2643
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2516
2644
  ...{ name: "CkEditableUserMessage" },
2517
2645
  __name: "CkEditableUserMessage",
@@ -2646,7 +2774,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2646
2774
  ]),
2647
2775
  "agent-message": withCtx(({ message }) => [
2648
2776
  renderSlot(_ctx.$slots, "agent-message", { message }, () => [
2649
- createVNode(_sfc_main$r, {
2777
+ createVNode(_sfc_main$s, {
2650
2778
  "bottom-separator": message.id !== lastAgentMessageId.value
2651
2779
  }, createSlots({
2652
2780
  footer: withCtx(() => [
@@ -2683,7 +2811,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2683
2811
  name: "header",
2684
2812
  fn: withCtx(() => [
2685
2813
  renderSlot(_ctx.$slots, "agent-message-header", { message }, () => [
2686
- createVNode(_sfc_main$q, null, createSlots({
2814
+ createVNode(_sfc_main$r, null, createSlots({
2687
2815
  default: withCtx(() => [
2688
2816
  renderSlot(_ctx.$slots, "agent-message-header-content", { message })
2689
2817
  ]),
@@ -2906,33 +3034,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2906
3034
  }
2907
3035
  });
2908
3036
  export {
2909
- formatRelativeTime as A,
2910
- CkCitation as C,
2911
- _sfc_main$r as _,
2912
- _sfc_main$q as a,
2913
- _sfc_main$o as b,
2914
- _sfc_main$1 as c,
2915
- _sfc_main$m as d,
2916
- CkCopyMessageButton as e,
2917
- CkDropZoneOverlay as f,
2918
- _sfc_main$2 as g,
2919
- CkFeedbackButton as h,
2920
- CkFeedbackDialog as i,
2921
- _sfc_main$d as j,
2922
- _sfc_main$p as k,
2923
- _sfc_main as l,
2924
- _sfc_main$c as m,
2925
- _sfc_main$b as n,
2926
- _sfc_main$g as o,
2927
- _sfc_main$l as p,
2928
- _sfc_main$a as q,
2929
- CkPromptInput as r,
2930
- _sfc_main$5 as s,
2931
- _sfc_main$8 as t,
2932
- _sfc_main$9 as u,
2933
- _sfc_main$7 as v,
2934
- _sfc_main$4 as w,
2935
- _sfc_main$t as x,
2936
- _sfc_main$s as y,
2937
- CkUserMessage as z
3037
+ CkUserMessage as A,
3038
+ formatRelativeTime as B,
3039
+ CkCitationLabel as C,
3040
+ _sfc_main$s as _,
3041
+ _sfc_main$r as a,
3042
+ _sfc_main$n as b,
3043
+ _sfc_main$p as c,
3044
+ _sfc_main$1 as d,
3045
+ _sfc_main$m as e,
3046
+ CkCopyMessageButton as f,
3047
+ CkDropZoneOverlay as g,
3048
+ _sfc_main$2 as h,
3049
+ CkFeedbackButton as i,
3050
+ CkFeedbackDialog as j,
3051
+ _sfc_main$d as k,
3052
+ _sfc_main$q as l,
3053
+ _sfc_main as m,
3054
+ _sfc_main$c as n,
3055
+ _sfc_main$b as o,
3056
+ _sfc_main$g as p,
3057
+ _sfc_main$l as q,
3058
+ _sfc_main$a as r,
3059
+ CkPromptInput as s,
3060
+ _sfc_main$5 as t,
3061
+ _sfc_main$8 as u,
3062
+ _sfc_main$9 as v,
3063
+ _sfc_main$7 as w,
3064
+ _sfc_main$4 as x,
3065
+ _sfc_main$u as y,
3066
+ _sfc_main$t as z
2938
3067
  };