@8wave/ai-elements 0.125.0-beta.26 → 0.125.0-beta.28

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 (121) hide show
  1. package/dist/_chunks/{PkChatbotFilePreview-CFGqa-tX.js → PkChatbotFilePreview-CqxtVySb.js} +100 -59
  2. package/dist/_chunks/PkChatbotFilePreview-CqxtVySb.js.map +1 -0
  3. package/dist/_chunks/{PkFilePreview-BPsD2P7s.js → PkFilePreview-DiLMoL-6.js} +32 -32
  4. package/dist/_chunks/{PkFilePreview-BPsD2P7s.js.map → PkFilePreview-DiLMoL-6.js.map} +1 -1
  5. package/dist/_chunks/{PkFilePreviewDialog-BW-Rubk2.js → PkFilePreviewDialog-CHBtxpoB.js} +2 -2
  6. package/dist/_chunks/{PkFilePreviewDialog-BW-Rubk2.js.map → PkFilePreviewDialog-CHBtxpoB.js.map} +1 -1
  7. package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js +555 -0
  8. package/dist/_chunks/PkImageEditorDialog-Cq8y_PtC.js.map +1 -0
  9. package/dist/_chunks/{PkSelectionActions-DkETXtSL.js → PkSelectionActions-DFyvcEyl.js} +2 -2
  10. package/dist/_chunks/{PkSelectionActions-DkETXtSL.js.map → PkSelectionActions-DFyvcEyl.js.map} +1 -1
  11. package/dist/_chunks/{PkStreamingMarkdown-CqLpNWQv.js → PkStreamingMarkdown-0hE_Cx4W.js} +2 -2
  12. package/dist/_chunks/{PkStreamingMarkdown-CqLpNWQv.js.map → PkStreamingMarkdown-0hE_Cx4W.js.map} +1 -1
  13. package/dist/_chunks/{PkToolChatFile-iE4ZokYD.js → PkToolChatFile-DtQ9xY4w.js} +3 -3
  14. package/dist/_chunks/{PkToolChatFile-iE4ZokYD.js.map → PkToolChatFile-DtQ9xY4w.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShareDocument-lTHNZodf.js → PkToolShareDocument-BvHklbzb.js} +2 -2
  16. package/dist/_chunks/{PkToolShareDocument-lTHNZodf.js.map → PkToolShareDocument-BvHklbzb.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowArtifact-BNQrM5fY.js → PkToolShowArtifact-BdkKU6P1.js} +2 -2
  18. package/dist/_chunks/{PkToolShowArtifact-BNQrM5fY.js.map → PkToolShowArtifact-BdkKU6P1.js.map} +1 -1
  19. package/dist/_chunks/{PkToolShowContactForm-CvQoLumn.js → PkToolShowContactForm-BmM2MbOK.js} +2 -2
  20. package/dist/_chunks/{PkToolShowContactForm-CvQoLumn.js.map → PkToolShowContactForm-BmM2MbOK.js.map} +1 -1
  21. package/dist/_chunks/{PkToolShowForm-DcPccCEU.js → PkToolShowForm-CoFlgA-I.js} +3 -3
  22. package/dist/_chunks/{PkToolShowForm-DcPccCEU.js.map → PkToolShowForm-CoFlgA-I.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowSources-B3VpJBVE.js → PkToolShowSources-DDBlLBt6.js} +2 -2
  24. package/dist/_chunks/{PkToolShowSources-B3VpJBVE.js.map → PkToolShowSources-DDBlLBt6.js.map} +1 -1
  25. package/dist/_chunks/{utils-BZuri2jT.js → utils-ChmRkK0t.js} +12 -5
  26. package/dist/_chunks/utils-ChmRkK0t.js.map +1 -0
  27. package/dist/ai-elements.es.js +3197 -3115
  28. package/dist/ai-elements.es.js.map +1 -1
  29. package/dist-vue/PkChatbot.js +1 -1
  30. package/dist-vue/PkChatbotEmptyState.js +1 -1
  31. package/dist-vue/PkChatbotFilePreview.js +1 -1
  32. package/dist-vue/PkChatbotInput.js +1 -1
  33. package/dist-vue/PkChatbotMessages.js +1 -1
  34. package/dist-vue/PkChatbotStepPayload.js +1 -1
  35. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  36. package/dist-vue/PkChatbotSteps.js +1 -1
  37. package/dist-vue/PkChatbotViewChat.js +1 -1
  38. package/dist-vue/PkChatbotViewConversations.js +1 -1
  39. package/dist-vue/PkChatbotViewFiles.js +1 -1
  40. package/dist-vue/PkChatbotViewProfile.js +1 -1
  41. package/dist-vue/_chunks/{PkChatbot-DyzEuNED.js → PkChatbot-BjJzskl7.js} +8 -8
  42. package/dist-vue/_chunks/{PkChatbot-DyzEuNED.js.map → PkChatbot-BjJzskl7.js.map} +1 -1
  43. package/dist-vue/_chunks/{PkChatbotEmptyState-COya3H3C.js → PkChatbotEmptyState-CZC2gP3I.js} +2 -2
  44. package/dist-vue/_chunks/{PkChatbotEmptyState-COya3H3C.js.map → PkChatbotEmptyState-CZC2gP3I.js.map} +1 -1
  45. package/dist-vue/_chunks/{PkChatbotFilePreview-BsvT6orx.js → PkChatbotFilePreview-j_8sDZUE.js} +112 -71
  46. package/dist-vue/_chunks/PkChatbotFilePreview-j_8sDZUE.js.map +1 -0
  47. package/dist-vue/_chunks/PkChatbotInput-BmTdIJZ9.js +509 -0
  48. package/dist-vue/_chunks/PkChatbotInput-BmTdIJZ9.js.map +1 -0
  49. package/dist-vue/_chunks/PkChatbotMessages-b2lupEv9.js +1049 -0
  50. package/dist-vue/_chunks/{PkChatbotMessages-BISaZu4z.js.map → PkChatbotMessages-b2lupEv9.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkChatbotStepPayload-cuYclK_2.js → PkChatbotStepPayload-D4w1XlF2.js} +2 -2
  52. package/dist-vue/_chunks/{PkChatbotStepPayload-cuYclK_2.js.map → PkChatbotStepPayload-D4w1XlF2.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Yd8cUQJP.js → PkChatbotStepToolDetail-DFTcjzoX.js} +3 -3
  54. package/dist-vue/_chunks/{PkChatbotStepToolDetail-Yd8cUQJP.js.map → PkChatbotStepToolDetail-DFTcjzoX.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkChatbotSteps-_Aqft0em.js → PkChatbotSteps-D3zLulMo.js} +5 -5
  56. package/dist-vue/_chunks/{PkChatbotSteps-_Aqft0em.js.map → PkChatbotSteps-D3zLulMo.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkChatbotViewChat-CIfotKyM.js → PkChatbotViewChat-DawyiUjq.js} +323 -345
  58. package/dist-vue/_chunks/PkChatbotViewChat-DawyiUjq.js.map +1 -0
  59. package/dist-vue/_chunks/{PkChatbotViewConversations-DjhiHp8-.js → PkChatbotViewConversations-Bs246dtL.js} +3 -3
  60. package/dist-vue/_chunks/{PkChatbotViewConversations-DjhiHp8-.js.map → PkChatbotViewConversations-Bs246dtL.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkChatbotViewFiles-C4oGN4Xj.js → PkChatbotViewFiles-uzZ5H4Fd.js} +2 -2
  62. package/dist-vue/_chunks/{PkChatbotViewFiles-C4oGN4Xj.js.map → PkChatbotViewFiles-uzZ5H4Fd.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkChatbotViewProfile-NfTamy9j.js → PkChatbotViewProfile-BhIvfT_n.js} +2 -2
  64. package/dist-vue/_chunks/{PkChatbotViewProfile-NfTamy9j.js.map → PkChatbotViewProfile-BhIvfT_n.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkFilePreview-DEKgCMkr.js → PkFilePreview-DfD48QQ_.js} +48 -48
  66. package/dist-vue/_chunks/{PkFilePreview-DEKgCMkr.js.map → PkFilePreview-DfD48QQ_.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkFilePreviewDialog-0qrzDWID.js → PkFilePreviewDialog-DFCBpQf3.js} +2 -2
  68. package/dist-vue/_chunks/{PkFilePreviewDialog-0qrzDWID.js.map → PkFilePreviewDialog-DFCBpQf3.js.map} +1 -1
  69. package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js +550 -0
  70. package/dist-vue/_chunks/PkImageEditorDialog-BLUyILVi.js.map +1 -0
  71. package/dist-vue/_chunks/{PkStreamingMarkdown-2FN4WMQD.js → PkStreamingMarkdown-ChMbSviw.js} +2 -2
  72. package/dist-vue/_chunks/{PkStreamingMarkdown-2FN4WMQD.js.map → PkStreamingMarkdown-ChMbSviw.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkToolChatFile-DAT1tv52.js → PkToolChatFile-DQtABEaI.js} +3 -3
  74. package/dist-vue/_chunks/{PkToolChatFile-DAT1tv52.js.map → PkToolChatFile-DQtABEaI.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkToolShareDocument-Qb2Lu5vh.js → PkToolShareDocument-cMUqik6v.js} +2 -2
  76. package/dist-vue/_chunks/{PkToolShareDocument-Qb2Lu5vh.js.map → PkToolShareDocument-cMUqik6v.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolShowArtifact-Bskomw05.js → PkToolShowArtifact-w6SxjLPW.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolShowArtifact-Bskomw05.js.map → PkToolShowArtifact-w6SxjLPW.js.map} +1 -1
  79. package/dist-vue/_chunks/{PkToolShowContactForm-iQrlqv7j.js → PkToolShowContactForm-BQ7bBTQU.js} +2 -2
  80. package/dist-vue/_chunks/{PkToolShowContactForm-iQrlqv7j.js.map → PkToolShowContactForm-BQ7bBTQU.js.map} +1 -1
  81. package/dist-vue/_chunks/{PkToolShowDiagram-C-43uUoh.js → PkToolShowDiagram-D-yQgdOL.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolShowDiagram-C-43uUoh.js.map → PkToolShowDiagram-D-yQgdOL.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShowForm-CKXpqQxy.js → PkToolShowForm-CF00JLpa.js} +3 -3
  84. package/dist-vue/_chunks/{PkToolShowForm-CKXpqQxy.js.map → PkToolShowForm-CF00JLpa.js.map} +1 -1
  85. package/dist-vue/_chunks/{PkToolShowImageGallery-DLTn6JmU.js → PkToolShowImageGallery-ZJMWOWHq.js} +2 -2
  86. package/dist-vue/_chunks/{PkToolShowImageGallery-DLTn6JmU.js.map → PkToolShowImageGallery-ZJMWOWHq.js.map} +1 -1
  87. package/dist-vue/_chunks/{PkToolShowProductList-hhSBAQVC.js → PkToolShowProductList-CeKI9H36.js} +2 -2
  88. package/dist-vue/_chunks/{PkToolShowProductList-hhSBAQVC.js.map → PkToolShowProductList-CeKI9H36.js.map} +1 -1
  89. package/dist-vue/_chunks/{PkToolShowSources-BMo_i8sv.js → PkToolShowSources-CXZqanmw.js} +2 -2
  90. package/dist-vue/_chunks/{PkToolShowSources-BMo_i8sv.js.map → PkToolShowSources-CXZqanmw.js.map} +1 -1
  91. package/dist-vue/_chunks/{PkToolShowVideo-DJhsbDuX.js → PkToolShowVideo-BCs-i6xQ.js} +2 -2
  92. package/dist-vue/_chunks/{PkToolShowVideo-DJhsbDuX.js.map → PkToolShowVideo-BCs-i6xQ.js.map} +1 -1
  93. package/dist-vue/_chunks/{PkToolShowWebPages-BAv66f5H.js → PkToolShowWebPages-Bixa0CjQ.js} +2 -2
  94. package/dist-vue/_chunks/{PkToolShowWebPages-BAv66f5H.js.map → PkToolShowWebPages-Bixa0CjQ.js.map} +1 -1
  95. package/dist-vue/_chunks/{useChatbotStore-BZ1n3Hyx.js → useChatbotStore-BIjCGX0B.js} +858 -835
  96. package/dist-vue/_chunks/useChatbotStore-BIjCGX0B.js.map +1 -0
  97. package/dist-vue/_chunks/{utils-RwaXl9-x.js → utils-CaYEz-0A.js} +11 -4
  98. package/dist-vue/_chunks/utils-CaYEz-0A.js.map +1 -0
  99. package/dist-vue/composables.js +56 -4
  100. package/dist-vue/composables.js.map +1 -1
  101. package/dist-vue/index.js +49 -49
  102. package/dist-vue/index.js.map +1 -1
  103. package/dist-vue/locales.js +56 -0
  104. package/dist-vue/packages/components/src/chat/PkChatbotFilePreview.d.ts +14 -0
  105. package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +17 -3
  106. package/dist-vue/packages/components/src/chat/PkImageEditor.d.ts +37 -0
  107. package/dist-vue/packages/components/src/chat/PkImageEditorDialog.d.ts +19 -0
  108. package/dist-vue/packages/components/src/chat/imageEdits.d.ts +106 -0
  109. package/dist-vue/packages/components/src/chat/utils.d.ts +7 -0
  110. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +7 -1
  111. package/dist-vue/style.css +1 -1
  112. package/package.json +1 -1
  113. package/dist/_chunks/PkChatbotFilePreview-CFGqa-tX.js.map +0 -1
  114. package/dist/_chunks/utils-BZuri2jT.js.map +0 -1
  115. package/dist-vue/_chunks/PkChatbotFilePreview-BsvT6orx.js.map +0 -1
  116. package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js +0 -478
  117. package/dist-vue/_chunks/PkChatbotInput-D0KUEkAs.js.map +0 -1
  118. package/dist-vue/_chunks/PkChatbotMessages-BISaZu4z.js +0 -1049
  119. package/dist-vue/_chunks/PkChatbotViewChat-CIfotKyM.js.map +0 -1
  120. package/dist-vue/_chunks/useChatbotStore-BZ1n3Hyx.js.map +0 -1
  121. package/dist-vue/_chunks/utils-RwaXl9-x.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { r as e } from "./useLightbox-FDyQrPWe.js";
2
2
  import { VvIcon as t } from "@volverjs/ui-vue/components";
3
- import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, normalizeStyle as ee, onMounted as f, openBlock as p, ref as m, toDisplayString as h, unref as g, vShow as _, withDirectives as v, withModifiers as y } from "vue";
3
+ import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, normalizeStyle as f, onMounted as p, openBlock as m, ref as h, toDisplayString as g, unref as _, vShow as v, withDirectives as ee, withModifiers as y } from "vue";
4
4
  // ../../packages/components/src/chat/PkChatbotFilePreview.vue?vue&type=script&setup=true&lang.ts
5
5
  var te = [
6
6
  "href",
@@ -13,17 +13,17 @@ var te = [
13
13
  ], b = ["src", "alt"], x = {
14
14
  key: 0,
15
15
  class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay"
16
- }, S = {
17
- key: 1,
16
+ }, S = ["title", "aria-label"], ne = ["title", "aria-label"], C = {
17
+ key: 3,
18
18
  class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--error"
19
- }, C = {
19
+ }, w = {
20
20
  key: 0,
21
21
  class: "pk-chatbot-file-preview__caption"
22
- }, w = ["title"], T = { class: "pk-chatbot-file-preview__meta" }, ne = ["title"], re = ["title", "aria-label"], E = { class: "pk-chatbot-file-preview__body" }, D = ["title"], O = { class: "pk-chatbot-file-preview__meta" }, k = ["title"], A = ["title", "aria-label"], j = ["title", "aria-label"], M = [
22
+ }, T = ["title"], re = { class: "pk-chatbot-file-preview__meta" }, ie = ["title"], E = ["title", "aria-label"], D = ["title", "aria-label"], O = ["title", "aria-label"], k = { class: "pk-chatbot-file-preview__body" }, A = ["title"], j = { class: "pk-chatbot-file-preview__meta" }, M = ["title"], N = ["title", "aria-label"], P = ["title", "aria-label"], F = [
23
23
  "href",
24
24
  "title",
25
25
  "aria-label"
26
- ], N = ["title", "aria-label"], P = 300, F = /* @__PURE__ */ u({
26
+ ], I = ["title", "aria-label"], L = 300, R = /* @__PURE__ */ u({
27
27
  __name: "PkChatbotFilePreview",
28
28
  props: {
29
29
  mediaType: {},
@@ -33,6 +33,8 @@ var te = [
33
33
  loading: { type: Boolean },
34
34
  error: {},
35
35
  removable: { type: Boolean },
36
+ editable: { type: Boolean },
37
+ retryable: { type: Boolean },
36
38
  compact: { type: Boolean },
37
39
  showDownload: { type: Boolean },
38
40
  onDownload: { type: Function },
@@ -40,14 +42,18 @@ var te = [
40
42
  onPreview: { type: Function },
41
43
  onRestore: { type: Function }
42
44
  },
43
- emits: ["remove"],
45
+ emits: [
46
+ "remove",
47
+ "edit",
48
+ "retry"
49
+ ],
44
50
  setup(u) {
45
- let F = u, I = (e) => {
46
- F.onDownload && (e.preventDefault(), F.onDownload());
47
- }, L = r(() => !F.asFile && F.mediaType.startsWith("image/")), R = r(() => {
48
- let e = F.filename ?? "", t = e.lastIndexOf(".");
51
+ let R = u, z = (e) => {
52
+ R.onDownload && (e.preventDefault(), R.onDownload());
53
+ }, B = r(() => !R.asFile && R.mediaType.startsWith("image/")), V = r(() => {
54
+ let e = R.filename ?? "", t = e.lastIndexOf(".");
49
55
  return t > 0 ? e.slice(t + 1).toLowerCase() : "";
50
- }), z = r(() => F.mediaType.split("/")[1]?.split(";")[0] ?? ""), B = [
56
+ }), H = r(() => R.mediaType.split("/")[1]?.split(";")[0] ?? ""), U = [
51
57
  {
52
58
  test: /pdf/,
53
59
  kind: {
@@ -128,16 +134,16 @@ var te = [
128
134
  label: "Text"
129
135
  }
130
136
  }
131
- ], V = r(() => {
132
- let e = `${F.mediaType} ${R.value}`;
133
- for (let { test: t, kind: n } of B) if (t.test(e)) return n;
137
+ ], W = r(() => {
138
+ let e = `${R.mediaType} ${V.value}`;
139
+ for (let { test: t, kind: n } of U) if (t.test(e)) return n;
134
140
  return {
135
141
  icon: "ri:file-line",
136
142
  accent: "#64748b",
137
143
  label: "File"
138
144
  };
139
- }), H = r(() => (R.value || z.value || V.value.label).toUpperCase()), U = r(() => {
140
- let e = F.size;
145
+ }), G = r(() => (V.value || H.value || W.value.label).toUpperCase()), K = r(() => {
146
+ let e = R.size;
141
147
  if (e === void 0 || e < 0) return;
142
148
  if (e < 1024) return `${e} B`;
143
149
  let t = [
@@ -148,34 +154,37 @@ var te = [
148
154
  ], n = e / 1024, r = 0;
149
155
  for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
150
156
  return `${n < 10 ? n.toFixed(1) : Math.round(n)} ${t[r]}`;
151
- }), W = /* @__PURE__ */ new Map(), G = (e, t) => {
152
- W.delete(e), W.set(e, t), W.size > P && W.delete(W.keys().next().value);
153
- }, K = W.get(F.url), q = m(K?.status ?? "loading"), J = m(K?.dimensions), Y = (e) => {
157
+ }), q = /* @__PURE__ */ new Map(), J = (e, t) => {
158
+ q.delete(e), q.set(e, t), q.size > L && q.delete(q.keys().next().value);
159
+ }, Y = q.get(R.url), X = h(Y?.status ?? "loading"), Z = h(Y?.dimensions), ae = (e) => {
154
160
  let t = e.target;
155
- t.naturalWidth && t.naturalHeight && (J.value = {
161
+ t.naturalWidth && t.naturalHeight && (Z.value = {
156
162
  width: t.naturalWidth,
157
163
  height: t.naturalHeight
158
- }), q.value = "loaded", G(F.url, {
164
+ }), X.value = "loaded", J(R.url, {
159
165
  status: "loaded",
160
- dimensions: J.value
166
+ dimensions: Z.value
161
167
  });
162
- }, X = () => {
163
- q.value = "error", G(F.url, { status: "error" });
164
- }, Z = r(() => J.value ?? ae), Q = r(() => [J.value && `${J.value.width}×${J.value.height}`, U.value].filter(Boolean)), ie = r(() => [H.value, U.value].filter(Boolean)), ae = {
168
+ }, oe = () => {
169
+ X.value = "error", J(R.url, { status: "error" });
170
+ }, Q = r(() => Z.value ?? le), se = r(() => [Z.value && `${Z.value.width}×${Z.value.height}`, K.value].filter(Boolean)), ce = r(() => [G.value, K.value].filter(Boolean)), le = {
165
171
  width: 1200,
166
172
  height: 800
167
- }, $ = m(), { init: oe, shared: se } = e({
173
+ }, $ = h(), { init: ue, shared: de } = e({
168
174
  gallery: $,
169
175
  loop: !1,
170
176
  shared: !0
171
177
  });
172
- return f(async () => {
173
- L.value && await oe();
178
+ return p(async () => {
179
+ B.value && await ue();
174
180
  }), (e, r) => {
175
- let f = t;
176
- return L.value ? (p(), o("figure", {
181
+ let p = t;
182
+ return B.value ? (m(), o("figure", {
177
183
  key: 0,
178
- class: d(["pk-chatbot-file-preview pk-chatbot-file-preview--image", { "pk-chatbot-file-preview--compact": u.compact }])
184
+ class: d(["pk-chatbot-file-preview pk-chatbot-file-preview--image", {
185
+ "pk-chatbot-file-preview--error": u.error,
186
+ "pk-chatbot-file-preview--compact": u.compact
187
+ }])
179
188
  }, [
180
189
  s("div", {
181
190
  ref_key: "galleryRef",
@@ -184,38 +193,59 @@ var te = [
184
193
  }, [s("a", {
185
194
  href: u.url,
186
195
  "data-pswp-src": u.url,
187
- "data-pswp-width": Z.value.width,
188
- "data-pswp-height": Z.value.height,
196
+ "data-pswp-width": Q.value.width,
197
+ "data-pswp-height": Q.value.height,
189
198
  "data-pswp-caption": u.filename ?? "",
190
- "data-pswp-shared": g(se) || void 0,
199
+ "data-pswp-shared": _(de) || void 0,
191
200
  class: "pk-chatbot-file-preview__thumb-link",
192
201
  "aria-label": u.filename ?? e.$t("label.file")
193
- }, [v(s("img", {
202
+ }, [ee(s("img", {
194
203
  src: u.url,
195
204
  alt: u.filename,
196
205
  decoding: "async",
197
206
  class: "pk-chatbot-file-preview__thumb",
198
- onLoad: Y,
199
- onError: X
200
- }, null, 40, b), [[_, q.value === "loaded"]])], 8, te), u.loading || q.value === "loading" ? (p(), o("span", x, [l(f, { name: "loading-loop" })])) : q.value === "error" ? (p(), o("span", S, [l(f, { name: "ri:image-2-line" })])) : a("", !0)], 512),
201
- u.compact ? a("", !0) : (p(), o("figcaption", C, [u.filename ? (p(), o("span", {
207
+ onLoad: ae,
208
+ onError: oe
209
+ }, null, 40, b), [[v, X.value === "loaded"]])], 8, te), u.loading || X.value === "loading" ? (m(), o("span", x, [l(p, { name: "loading-loop" })])) : u.error && u.retryable ? (m(), o("button", {
210
+ key: 1,
211
+ type: "button",
212
+ class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--failed",
213
+ title: u.error,
214
+ "aria-label": e.$t("action.retry"),
215
+ onClick: r[0] ||= y((t) => e.$emit("retry"), ["prevent"])
216
+ }, [l(p, { name: "ri:refresh-line" })], 8, S)) : u.error ? (m(), o("span", {
217
+ key: 2,
218
+ class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--failed",
219
+ role: "img",
220
+ title: u.error,
221
+ "aria-label": u.error
222
+ }, [l(p, { name: "ri:error-warning-line" })], 8, ne)) : X.value === "error" ? (m(), o("span", C, [l(p, { name: "ri:image-2-line" })])) : a("", !0)], 512),
223
+ u.compact ? a("", !0) : (m(), o("figcaption", w, [u.filename ? (m(), o("span", {
202
224
  key: 0,
203
225
  class: "pk-chatbot-file-preview__name",
204
226
  title: u.filename
205
- }, h(u.filename), 9, w)) : a("", !0), s("span", T, [u.error ? (p(), o("span", {
227
+ }, g(u.filename), 9, T)) : a("", !0), s("span", re, [u.error ? (m(), o("span", {
206
228
  key: 0,
207
229
  class: "pk-chatbot-file-preview__error",
208
230
  title: u.error
209
- }, [l(f, { name: "ri:error-warning-line" }), c(" " + h(u.error), 1)], 8, ne)) : (p(), o(n, { key: 1 }, [c(h(Q.value.join(" · ")), 1)], 64))])])),
210
- u.removable && !u.loading ? (p(), o("button", {
231
+ }, [l(p, { name: "ri:error-warning-line" }), c(" " + g(u.error), 1)], 8, ie)) : (m(), o(n, { key: 1 }, [c(g(se.value.join(" · ")), 1)], 64))])])),
232
+ u.editable && u.compact && !u.loading ? (m(), o("button", {
211
233
  key: 1,
212
234
  type: "button",
235
+ class: "pk-chatbot-file-preview__edit",
236
+ title: e.$t("imageEditor.edit"),
237
+ "aria-label": e.$t("imageEditor.edit"),
238
+ onClick: r[1] ||= y((t) => e.$emit("edit"), ["prevent"])
239
+ }, [l(p, { name: "ri:edit-line" })], 8, E)) : a("", !0),
240
+ u.removable && !u.loading ? (m(), o("button", {
241
+ key: 2,
242
+ type: "button",
213
243
  class: "pk-chatbot-file-preview__remove",
214
244
  title: e.$t("action.remove"),
215
245
  "aria-label": e.$t("action.remove"),
216
- onClick: r[0] ||= y((t) => e.$emit("remove"), ["prevent"])
217
- }, [l(f, { name: "ri:close-line" })], 8, re)) : a("", !0)
218
- ], 2)) : (p(), o("div", {
246
+ onClick: r[2] ||= y((t) => e.$emit("remove"), ["prevent"])
247
+ }, [l(p, { name: "ri:close-line" })], 8, D)) : a("", !0)
248
+ ], 2)) : (m(), o("div", {
219
249
  key: 1,
220
250
  class: d(["pk-chatbot-file-preview pk-chatbot-file-preview--doc", {
221
251
  "pk-chatbot-file-preview--error": u.error,
@@ -223,47 +253,58 @@ var te = [
223
253
  "pk-chatbot-file-preview--show-download": u.showDownload
224
254
  }])
225
255
  }, [
226
- s("span", {
256
+ u.error && u.retryable && !u.loading ? (m(), o("button", {
257
+ key: 0,
258
+ type: "button",
259
+ class: "pk-chatbot-file-preview__icon-tile pk-chatbot-file-preview__retry u-touch-target",
260
+ title: u.error,
261
+ "aria-label": e.$t("action.retry"),
262
+ onClick: r[3] ||= (t) => e.$emit("retry")
263
+ }, [l(p, {
264
+ name: "ri:refresh-line",
265
+ class: "pk-chatbot-file-preview__icon"
266
+ })], 8, O)) : (m(), o("span", {
267
+ key: 1,
227
268
  class: "pk-chatbot-file-preview__icon-tile",
228
- style: ee({ "--file-accent": V.value.accent })
229
- }, [u.loading ? (p(), i(f, {
269
+ style: f({ "--file-accent": W.value.accent })
270
+ }, [u.loading ? (m(), i(p, {
230
271
  key: 0,
231
272
  name: "loading-loop",
232
273
  class: "pk-chatbot-file-preview__icon"
233
- })) : (p(), i(f, {
274
+ })) : (m(), i(p, {
234
275
  key: 1,
235
- name: V.value.icon,
276
+ name: W.value.icon,
236
277
  class: "pk-chatbot-file-preview__icon"
237
- }, null, 8, ["name"]))], 4),
238
- s("span", E, [u.filename ? (p(), o("span", {
278
+ }, null, 8, ["name"]))], 4)),
279
+ s("span", k, [u.filename ? (m(), o("span", {
239
280
  key: 0,
240
281
  class: "pk-chatbot-file-preview__name",
241
282
  title: u.filename
242
- }, h(u.filename), 9, D)) : a("", !0), s("span", O, [u.error ? (p(), o("span", {
283
+ }, g(u.filename), 9, A)) : a("", !0), s("span", j, [u.error ? (m(), o("span", {
243
284
  key: 0,
244
285
  class: "pk-chatbot-file-preview__error",
245
286
  title: u.error
246
- }, [l(f, { name: "ri:error-warning-line" }), c(" " + h(u.error), 1)], 8, k)) : (p(), o(n, { key: 1 }, [c(h(ie.value.join(" · ")), 1)], 64))])]),
247
- !u.loading && !u.error && !u.compact ? (p(), o("span", {
248
- key: 0,
287
+ }, [l(p, { name: "ri:error-warning-line" }), c(" " + g(u.error), 1)], 8, M)) : (m(), o(n, { key: 1 }, [c(g(ce.value.join(" · ")), 1)], 64))])]),
288
+ !u.loading && !u.error && !u.compact ? (m(), o("span", {
289
+ key: 2,
249
290
  class: d(["pk-chatbot-file-preview__actions", { "pk-chatbot-file-preview__actions--bar": u.onPreview || u.onRestore }])
250
291
  }, [
251
- u.onRestore ? (p(), o("button", {
292
+ u.onRestore ? (m(), o("button", {
252
293
  key: 0,
253
294
  type: "button",
254
295
  class: "pk-chatbot-file-preview__open u-touch-target",
255
296
  title: e.$t("chatFilePreview.restore"),
256
297
  "aria-label": `${e.$t("chatFilePreview.restore")}${u.filename ? ` — ${u.filename}` : ""}`,
257
- onClick: r[1] ||= (...e) => u.onRestore && u.onRestore(...e)
258
- }, [l(f, { name: "ri:arrow-go-back-line" })], 8, A)) : a("", !0),
259
- u.onPreview ? (p(), o("button", {
298
+ onClick: r[4] ||= (...e) => u.onRestore && u.onRestore(...e)
299
+ }, [l(p, { name: "ri:arrow-go-back-line" })], 8, N)) : a("", !0),
300
+ u.onPreview ? (m(), o("button", {
260
301
  key: 1,
261
302
  type: "button",
262
303
  class: "pk-chatbot-file-preview__open u-touch-target",
263
304
  title: e.$t("chatFilePreview.open"),
264
305
  "aria-label": `${e.$t("chatFilePreview.open")}${u.filename ? ` — ${u.filename}` : ""}`,
265
- onClick: r[2] ||= (...e) => u.onPreview && u.onPreview(...e)
266
- }, [l(f, { name: "ri:eye-line" })], 8, j)) : a("", !0),
306
+ onClick: r[5] ||= (...e) => u.onPreview && u.onPreview(...e)
307
+ }, [l(p, { name: "ri:eye-line" })], 8, P)) : a("", !0),
267
308
  s("a", {
268
309
  href: u.url,
269
310
  target: "_blank",
@@ -271,21 +312,21 @@ var te = [
271
312
  class: "pk-chatbot-file-preview__open u-touch-target",
272
313
  title: e.$t("action.download"),
273
314
  "aria-label": `${e.$t("action.download")}${u.filename ? ` — ${u.filename}` : ""}`,
274
- onClick: I
275
- }, [l(f, { name: "ri:download-2-line" })], 8, M)
315
+ onClick: z
316
+ }, [l(p, { name: "ri:download-2-line" })], 8, F)
276
317
  ], 2)) : a("", !0),
277
- u.removable && !u.loading ? (p(), o("button", {
278
- key: 1,
318
+ u.removable && !u.loading ? (m(), o("button", {
319
+ key: 3,
279
320
  type: "button",
280
321
  class: d(["pk-chatbot-file-preview__remove", { "pk-chatbot-file-preview__remove--inline": !u.compact }]),
281
322
  title: e.$t("action.remove"),
282
323
  "aria-label": e.$t("action.remove"),
283
- onClick: r[3] ||= (t) => e.$emit("remove")
284
- }, [l(f, { name: "ri:close-line" })], 10, N)) : a("", !0)
324
+ onClick: r[6] ||= (t) => e.$emit("remove")
325
+ }, [l(p, { name: "ri:close-line" })], 10, I)) : a("", !0)
285
326
  ], 2));
286
327
  };
287
328
  }
288
329
  });
289
- export { F as t };
330
+ export { R as t };
290
331
 
291
- //# sourceMappingURL=PkChatbotFilePreview-BsvT6orx.js.map
332
+ //# sourceMappingURL=PkChatbotFilePreview-j_8sDZUE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PkChatbotFilePreview-j_8sDZUE.js","names":["$t","$emit","__unplugin_components_0","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_unref","_withDirectives","_vShow","_createVNode","_withModifiers","_createCommentVNode","_toDisplayString","_createTextVNode","_Fragment","_normalizeStyle","_createBlock","_sfc_main","useLightbox","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","THUMB_CACHE_MAX","PkChatbotFilePreview_default","defineComponent","props","__props","onOpenClick","event","isImage","computed","extension","name","dot","subtype","KINDS","fileKind","haystack","test","kind","typeTag","formattedSize","bytes","units","value","unitIndex","thumbCache","setThumbCache","url","entry","cached","thumbStatus","ref","dimensions","onImageLoad","img","onImageError","pswpSize","DEFAULT_PSWP_SIZE","imageMeta","docMeta","galleryRef","onMounted","init","_component_VvIcon","VvIcon","openBlock","createElementBlock","normalizeClass","createElementVNode","unref","shared","_ctx","withDirectives","vShow","createVNode","_cache","withModifiers","createCommentVNode","toDisplayString","createTextVNode","Fragment","normalizeStyle","createBlock","args"],"sources":["../../../../packages/components/src/chat/PkChatbotFilePreview.vue","../../../../packages/components/src/chat/PkChatbotFilePreview.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, ref, onMounted } from 'vue'\n import { useLightbox } from '../composables/useLightbox'\n\n const props = defineProps<{\n mediaType: string\n url: string\n filename?: string\n /** Size in bytes, when known (e.g. local uploads). */\n size?: number\n loading?: boolean\n error?: string\n removable?: boolean\n /**\n * Shows the \"Edit\" button on an image of the composer (`compact`),\n * opposite the remove one: the host opens the image editor on `edit`.\n */\n editable?: boolean\n /**\n * The upload failed (`error`) and can be tried again: the failure\n * mark becomes a \"Retry\" button, and the host uploads again on `retry`.\n */\n retryable?: boolean\n /**\n * Dense layout for the composer: a small square thumbnail / slim row,\n * without the metadata caption. The full card is reserved for the\n * message log where the details matter.\n */\n compact?: boolean\n /**\n * Keeps the download button visible instead of revealing it on hover:\n * for a file the agent wrote, which the user is there to download.\n */\n showDownload?: boolean\n /**\n * Replaces the download link of a document with a call, for a file\n * whose download URL is minted on demand (a knowledge base document\n * shared in the chat). `url` stays the link's `href`.\n */\n onDownload?: () => void | Promise<void>\n /**\n * Draws an image as a file row, with its download button, instead of\n * a thumbnail: for an image whose `url` stops working while its\n * download keeps going (a shared document after its link expires).\n */\n asFile?: boolean\n /**\n * Opens the file in the chat's viewer: a Word document or a\n * spreadsheet the chat stores, with a button beside the download.\n */\n onPreview?: () => void\n /**\n * Asks for this earlier version of the file back as the newest one,\n * with a button before the others.\n */\n onRestore?: () => void\n }>()\n\n defineEmits<{\n remove: []\n edit: []\n retry: []\n }>()\n\n const onOpenClick = (event: MouseEvent) => {\n if (!props.onDownload) {\n return\n }\n event.preventDefault()\n void props.onDownload()\n }\n\n const isImage = computed(\n () => !props.asFile && props.mediaType.startsWith('image/'),\n )\n\n // --- File-type identity (icon + accent + human kind label) ---\n\n const extension = computed(() => {\n const name = props.filename ?? ''\n const dot = name.lastIndexOf('.')\n return dot > 0 ? name.slice(dot + 1).toLowerCase() : ''\n })\n\n // mediaType subtype, e.g. \"pdf\" from \"application/pdf\"\n const subtype = computed(\n () => props.mediaType.split('/')[1]?.split(';')[0] ?? '',\n )\n\n type FileKind = {\n icon: string\n // CSS color driving the icon glyph + tile tint\n accent: string\n label: string\n }\n\n const KINDS: Array<{ test: RegExp; kind: FileKind }> = [\n {\n test: /pdf/,\n kind: {\n icon: 'ri:file-pdf-2-line',\n accent: '#e2483d',\n label: 'PDF',\n },\n },\n {\n // Match Word specifically: the generic `document` substring also\n // appears in the XLSX/PPTX OOXML mime types (…officedocument…), so\n // matching it here would mis-label spreadsheets/decks as Word.\n test: /msword|wordprocessingml/,\n kind: {\n icon: 'ri:file-word-2-line',\n accent: '#2b7de9',\n label: 'Word',\n },\n },\n {\n test: /sheet|excel|csv/,\n kind: {\n icon: 'ri:file-excel-2-line',\n accent: '#1f9d57',\n label: 'Spreadsheet',\n },\n },\n {\n test: /presentation|powerpoint/,\n kind: {\n icon: 'ri:file-ppt-2-line',\n accent: '#d98324',\n label: 'Presentation',\n },\n },\n {\n test: /zip|compressed|x-7z|x-rar|x-tar|gzip/,\n kind: {\n icon: 'ri:file-zip-line',\n accent: '#c08a1e',\n label: 'Archive',\n },\n },\n {\n // Reached only by an image drawn as a file (`asFile`).\n test: /^image\\//,\n kind: {\n icon: 'ri:image-2-line',\n accent: '#0ea5e9',\n label: 'Image',\n },\n },\n {\n test: /^audio\\//,\n kind: {\n icon: 'ri:file-music-line',\n accent: '#8b5cf6',\n label: 'Audio',\n },\n },\n {\n test: /^video\\//,\n kind: {\n icon: 'ri:film-line',\n accent: '#6366f1',\n label: 'Video',\n },\n },\n {\n // The code an agent can take (`SUPPORTED_CODE_TYPES`).\n test: /json|javascript|typescript|xml|html|css|yaml|toml|sql|x-(?:sh|python|java|kotlin|c|csharp|go|rust|ruby|php|swift|vue)\\b/,\n kind: {\n icon: 'ri:file-code-line',\n accent: '#0d9488',\n label: 'Code',\n },\n },\n {\n test: /^text\\//,\n kind: {\n icon: 'ri:file-text-line',\n accent: '#64748b',\n label: 'Text',\n },\n },\n ]\n\n const fileKind = computed<FileKind>(() => {\n const haystack = `${props.mediaType} ${extension.value}`\n for (const { test, kind } of KINDS) {\n if (test.test(haystack)) {\n return kind\n }\n }\n return {\n icon: 'ri:file-line',\n accent: '#64748b',\n label: 'File',\n }\n })\n\n // Short type tag shown in the meta line: prefer the real extension, fall\n // back to the mime subtype, then the generic kind label.\n const typeTag = computed(() =>\n (\n extension.value ||\n subtype.value ||\n fileKind.value.label\n ).toUpperCase(),\n )\n\n // --- Size & dimensions ---\n\n const formattedSize = computed(() => {\n const bytes = props.size\n if (bytes === undefined || bytes < 0) {\n return undefined\n }\n if (bytes < 1024) {\n return `${bytes} B`\n }\n const units = ['KB', 'MB', 'GB', 'TB']\n let value = bytes / 1024\n let unitIndex = 0\n while (value >= 1024 && unitIndex < units.length - 1) {\n value /= 1024\n unitIndex += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[unitIndex]}`\n })\n\n // Thumbnail load lifecycle. Driving the spinner and the error fallback\n // off the real <img> events (not a second background fetch) means the\n // image is requested exactly once and reuses the browser cache on any\n // later re-render, instead of re-downloading every time the message list\n // repaints.\n // Not `useImageFallback`: this tile also needs `loading` vs `loaded` and the\n // decoded dimensions, cached across remounts, so the error flag is one field\n // of a richer per-url entry rather than a standalone broken-url set.\n type ThumbStatus = 'loading' | 'loaded' | 'error'\n\n // Module-level, keyed by URL: survives component recreation. In polled\n // views (e.g. admin chat-logs, refreshed every few seconds) the whole\n // message array is replaced on each poll, so this component can be torn\n // down and rebuilt. Seeding from the cache means a URL that already\n // decoded starts in `loaded` (no spinner flash, no re-decode) instead of\n // flickering back through `loading`. This is a client-side, per-session\n // cache (no server/Redis involved); bounded to a max size so a long-lived\n // session browsing many images can't grow it without limit — the oldest\n // entry is evicted first (Map preserves insertion order).\n type ThumbEntry = {\n status: ThumbStatus\n dimensions?: { width: number; height: number }\n }\n const THUMB_CACHE_MAX = 300\n const thumbCache = new Map<string, ThumbEntry>()\n const setThumbCache = (url: string, entry: ThumbEntry) => {\n // Re-insert to mark as most-recently used, then trim from the front.\n thumbCache.delete(url)\n thumbCache.set(url, entry)\n if (thumbCache.size > THUMB_CACHE_MAX) {\n thumbCache.delete(thumbCache.keys().next().value as string)\n }\n }\n\n const cached = thumbCache.get(props.url)\n const thumbStatus = ref<ThumbStatus>(cached?.status ?? 'loading')\n\n // Natural pixel dimensions, captured once the thumbnail decodes. Doubles\n // as the size hint PhotoSwipe needs for its slide (falls back until known).\n const dimensions = ref<{ width: number; height: number } | undefined>(\n cached?.dimensions,\n )\n const onImageLoad = (event: Event) => {\n const img = event.target as HTMLImageElement\n if (img.naturalWidth && img.naturalHeight) {\n dimensions.value = {\n width: img.naturalWidth,\n height: img.naturalHeight,\n }\n }\n thumbStatus.value = 'loaded'\n setThumbCache(props.url, {\n status: 'loaded',\n dimensions: dimensions.value,\n })\n }\n const onImageError = () => {\n thumbStatus.value = 'error'\n setThumbCache(props.url, { status: 'error' })\n }\n\n const pswpSize = computed(() => dimensions.value ?? DEFAULT_PSWP_SIZE)\n\n // Meta fragments joined with \" · \" for the caption / doc subtitle.\n const imageMeta = computed(() =>\n [\n dimensions.value &&\n `${dimensions.value.width}×${dimensions.value.height}`,\n formattedSize.value,\n ].filter(Boolean),\n )\n const docMeta = computed(() =>\n [typeTag.value, formattedSize.value].filter(Boolean),\n )\n\n // --- Lightbox ---\n\n // Slide size PhotoSwipe assumes before the real dimensions are known.\n const DEFAULT_PSWP_SIZE = { width: 1200, height: 800 }\n\n // In a conversation the image opens in its lightbox, with the others\n const galleryRef = ref<HTMLElement>()\n const { init, shared } = useLightbox({\n gallery: galleryRef,\n loop: false,\n shared: true,\n })\n\n onMounted(async () => {\n if (!isImage.value) {\n return\n }\n await init()\n })\n</script>\n\n<template>\n <!-- Image attachment: a thumbnail tile with a metadata caption -->\n <figure\n v-if=\"isImage\"\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--image\"\n :class=\"{\n 'pk-chatbot-file-preview--error': error,\n 'pk-chatbot-file-preview--compact': compact,\n }\">\n <div ref=\"galleryRef\" class=\"pk-chatbot-file-preview__thumb-wrap\">\n <a\n :href=\"url\"\n :data-pswp-src=\"url\"\n :data-pswp-width=\"pswpSize.width\"\n :data-pswp-height=\"pswpSize.height\"\n :data-pswp-caption=\"filename ?? ''\"\n :data-pswp-shared=\"shared || undefined\"\n class=\"pk-chatbot-file-preview__thumb-link\"\n :aria-label=\"filename ?? $t('label.file')\">\n <img\n v-show=\"thumbStatus === 'loaded'\"\n :src=\"url\"\n :alt=\"filename\"\n decoding=\"async\"\n class=\"pk-chatbot-file-preview__thumb\"\n @load=\"onImageLoad\"\n @error=\"onImageError\" />\n </a>\n <!-- Spinner until the thumbnail decodes (or while an upload is in\n flight); a fixed box keeps this from shifting the layout. -->\n <span\n v-if=\"loading || thumbStatus === 'loading'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay\">\n <VvIcon name=\"loading-loop\" />\n </span>\n <!-- The upload failed: the image would not be sent. The mark says\n so on the thumbnail, where the composer hides the caption, and\n is the retry when the host offers one. -->\n <button\n v-else-if=\"error && retryable\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--failed\"\n :title=\"error\"\n :aria-label=\"$t('action.retry')\"\n @click.prevent=\"$emit('retry')\">\n <VvIcon name=\"ri:refresh-line\" />\n </button>\n <span\n v-else-if=\"error\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--failed\"\n role=\"img\"\n :title=\"error\"\n :aria-label=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n </span>\n <!-- Failed to load: a quiet icon instead of the browser's broken\n image glyph. -->\n <span\n v-else-if=\"thumbStatus === 'error'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--error\">\n <VvIcon name=\"ri:image-2-line\" />\n </span>\n </div>\n <figcaption v-if=\"!compact\" class=\"pk-chatbot-file-preview__caption\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ imageMeta.join(' · ') }}</template>\n </span>\n </figcaption>\n <button\n v-if=\"editable && compact && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__edit\"\n :title=\"$t('imageEditor.edit')\"\n :aria-label=\"$t('imageEditor.edit')\"\n @click.prevent=\"$emit('edit')\">\n <VvIcon name=\"ri:edit-line\" />\n </button>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click.prevent=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </figure>\n\n <!-- Document attachment: an icon tile + name + type · size -->\n <div\n v-else\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--doc\"\n :class=\"{\n 'pk-chatbot-file-preview--error': error,\n 'pk-chatbot-file-preview--compact': compact,\n 'pk-chatbot-file-preview--show-download': showDownload,\n }\">\n <!-- A failed upload the host can try again: the tile is the retry -->\n <button\n v-if=\"error && retryable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__icon-tile pk-chatbot-file-preview__retry u-touch-target\"\n :title=\"error\"\n :aria-label=\"$t('action.retry')\"\n @click=\"$emit('retry')\">\n <VvIcon\n name=\"ri:refresh-line\"\n class=\"pk-chatbot-file-preview__icon\" />\n </button>\n <span\n v-else\n class=\"pk-chatbot-file-preview__icon-tile\"\n :style=\"{ '--file-accent': fileKind.accent }\">\n <VvIcon\n v-if=\"loading\"\n name=\"loading-loop\"\n class=\"pk-chatbot-file-preview__icon\" />\n <VvIcon\n v-else\n :name=\"fileKind.icon\"\n class=\"pk-chatbot-file-preview__icon\" />\n </span>\n <span class=\"pk-chatbot-file-preview__body\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ docMeta.join(' · ') }}</template>\n </span>\n </span>\n <!-- The actions of a file the chat's viewer opens: a small bar of\n their own, apart from the name and the size -->\n <span\n v-if=\"!loading && !error && !compact\"\n class=\"pk-chatbot-file-preview__actions\"\n :class=\"{\n 'pk-chatbot-file-preview__actions--bar': onPreview || onRestore,\n }\">\n <button\n v-if=\"onRestore\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.restore')\"\n :aria-label=\"`${$t('chatFilePreview.restore')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onRestore\">\n <VvIcon name=\"ri:arrow-go-back-line\" />\n </button>\n <button\n v-if=\"onPreview\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.open')\"\n :aria-label=\"`${$t('chatFilePreview.open')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onPreview\">\n <VvIcon name=\"ri:eye-line\" />\n </button>\n <a\n :href=\"url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('action.download')\"\n :aria-label=\"`${$t('action.download')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onOpenClick\">\n <VvIcon name=\"ri:download-2-line\" />\n </a>\n </span>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :class=\"{ 'pk-chatbot-file-preview__remove--inline': !compact }\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-file-preview {\n // Concentric radii: outer card and inner tiles share an 8px step.\n --file-radius: var(--rounded-lg, 12px);\n\n position: relative;\n max-width: 280px;\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--file-radius);\n color: var(--color-word-2);\n font-size: var(--text-12);\n\n &--error {\n border-color: var(--color-danger);\n }\n\n // --- Document card ---\n &--doc {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n min-width: 0;\n transition:\n border-color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out),\n box-shadow 0.18s var(--ease-out);\n\n &:hover {\n border-color: var(--color-surface-4);\n background-color: var(--color-surface-2);\n box-shadow: var(--shadow-sm);\n }\n }\n\n &__icon-tile {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-36);\n height: var(--spacing-36);\n\n // One step down from the card radius keeps the nested tile concentric.\n border-radius: var(--rounded-md, 6px);\n\n // Tint derived from the file-type accent; glyph sits at full accent.\n background-color: color-mix(\n in srgb,\n var(--file-accent) 14%,\n transparent\n );\n color: var(--file-accent);\n }\n\n &__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n\n &__body {\n display: flex;\n flex-direction: column;\n gap: 1px;\n min-width: 0;\n flex: 1;\n }\n\n &__actions {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n margin-inline-start: var(--spacing-4);\n }\n\n // Restore, open and download of a file the viewer opens: one small\n // bar, its hairline setting it apart from the name and the size, the\n // icons 8px apart so they read as a group\n &__actions--bar {\n margin-inline-start: var(--spacing-8);\n padding: var(--spacing-2);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n }\n\n // 28px to aim at with a mouse, 24 in the bar; 40px under a finger\n // (u-touch-target)\n &__open {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: 0;\n border-radius: var(--rounded);\n background: none;\n color: var(--color-word-3);\n text-decoration: none;\n cursor: pointer;\n opacity: 0;\n transition:\n opacity 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n\n .vv-icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &__actions--bar &__open {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n\n &--doc:hover &__open,\n &--doc:focus-within &__open,\n &--show-download &__open {\n opacity: 1;\n }\n\n // Touch devices have no hover: keep the open affordance visible.\n @media (hover: none) {\n &--doc &__open {\n opacity: 1;\n }\n }\n\n // --- Image card ---\n &--image {\n display: inline-flex;\n flex-direction: column;\n margin: 0;\n }\n\n &__thumb-wrap {\n position: relative;\n display: flex;\n\n // Fixed box: the card claims its final footprint before the\n // image decodes, so the message log never shifts on load.\n width: 280px;\n max-width: 100%;\n height: 200px;\n background-color: var(--color-surface);\n border-radius: var(--file-radius);\n overflow: hidden;\n }\n\n &__thumb-link {\n display: flex;\n width: 100%;\n height: 100%;\n cursor: pointer;\n }\n\n &__thumb {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__caption {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: var(--spacing-8);\n min-width: 0;\n }\n\n &__name {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: var(--font-medium, 500);\n color: var(--color-word-1);\n }\n\n &__meta {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--text-10);\n line-height: var(--leading-normal);\n\n // Reserve the line even while empty: image dimensions arrive\n // only after decode and must not grow the caption.\n min-height: 1.4em;\n color: var(--color-word-4);\n\n // Stable column for the dimensions/size figures.\n font-variant-numeric: tabular-nums;\n }\n\n &__error {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-4);\n color: var(--u-danger-text, var(--color-danger));\n\n .vv-icon {\n flex-shrink: 0;\n }\n }\n\n &__status {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n .vv-icon {\n width: var(--spacing-32);\n height: var(--spacing-32);\n }\n\n &--overlay {\n position: absolute;\n inset: 0;\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 70%,\n transparent\n );\n color: var(--color-word-1);\n }\n\n &--error {\n color: var(--color-word-4);\n }\n\n // An upload that failed, in the danger text of the caption's error\n &--failed {\n padding: 0;\n border: 0;\n color: var(--u-danger-text, var(--color-danger));\n font: inherit;\n\n .vv-icon {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n }\n\n &--failed:is(button) {\n cursor: pointer;\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 85%,\n transparent\n );\n }\n }\n }\n\n // The tile of a document whose upload failed, as a retry\n &__retry {\n --file-accent: var(--u-danger-text, var(--color-danger));\n\n position: relative;\n padding: 0;\n border: 0;\n cursor: pointer;\n }\n\n // --- Remove and edit buttons (input context) ---\n &__remove,\n &__edit {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: flex;\n align-items: center;\n justify-content: center;\n\n // Visible glyph is 18px but the hit area stays a comfortable 28px.\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: none;\n border-radius: var(--rounded-full, 9999px);\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 85%,\n transparent\n );\n color: var(--color-word-2);\n cursor: pointer;\n line-height: 1;\n box-shadow: var(--shadow-sm);\n transition:\n background-color 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n scale 0.12s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n\n &:active {\n scale: 0.96;\n }\n\n // Inside the document row the button rides inline, not overlaid\n // (size is inherited from the base).\n &--inline {\n position: static;\n flex-shrink: 0;\n box-shadow: none;\n background-color: transparent;\n color: var(--color-word-4);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n }\n }\n\n // --- Compact (composer) chips ---\n // ChatGPT/Gemini-style: every attachment is the SAME height and carries\n // an always-visible round remove control in the top-right corner — no\n // hover-revealed actions, no size mismatch between image and file chips.\n &--compact {\n // Shared chip height so image and file chips align in the row.\n --chip-size: var(--spacing-56);\n\n max-width: 240px;\n\n &.pk-chatbot-file-preview--image {\n width: var(--chip-size);\n height: var(--chip-size);\n border-radius: var(--rounded-md, 6px);\n }\n\n // Fill the square; the root's `overflow: hidden` rounds the corners.\n .pk-chatbot-file-preview__thumb-wrap,\n .pk-chatbot-file-preview__thumb-link {\n width: 100%;\n height: 100%;\n }\n\n &.pk-chatbot-file-preview--doc {\n height: var(--chip-size);\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n\n // Reserve room so the corner remove button never overlaps the\n // name/meta text.\n padding-inline-end: var(--spacing-28);\n }\n\n // Square icon tile that fills the chip height, so file chips read at\n // the same scale as image thumbnails: the chip less its padding and\n // its two 1px borders. Not `align-self: stretch` with `aspect-ratio`,\n // which Safari sizes from the chip's outer height, so the tile ran\n // past the chip's bottom edge.\n .pk-chatbot-file-preview__icon-tile {\n --chip-tile-size: calc(\n var(--chip-size) - 2 * var(--spacing-8) - 2px\n );\n\n width: var(--chip-tile-size);\n height: var(--chip-tile-size);\n }\n\n .pk-chatbot-file-preview__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n // Always-visible round remove control on the top-right corner: the\n // base transform centres it 4px inside the corner, so half of it rides\n // over the chip's edge (nothing clips it), with an extended hit area\n // for easy tapping. The edit control of an image mirrors it on the\n // top-left corner.\n &--compact &__remove,\n &--compact &__edit {\n top: var(--spacing-4);\n right: var(--spacing-4);\n width: var(--spacing-24);\n height: var(--spacing-24);\n border: 1px solid var(--color-surface-4);\n background-color: var(--color-surface);\n color: var(--color-word-1);\n font-size: var(--text-16);\n box-shadow: var(--shadow-sm);\n\n // Comfortable touch/click target beyond the small visible glyph.\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-4));\n }\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n }\n\n &--compact &__edit {\n right: auto;\n left: var(--spacing-4);\n transform: translate(-50%, -50%);\n }\n\n @media (prefers-reduced-motion: reduce) {\n &--doc,\n &__open,\n &__remove,\n &__edit {\n transition: none;\n }\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n import { computed, ref, onMounted } from 'vue'\n import { useLightbox } from '../composables/useLightbox'\n\n const props = defineProps<{\n mediaType: string\n url: string\n filename?: string\n /** Size in bytes, when known (e.g. local uploads). */\n size?: number\n loading?: boolean\n error?: string\n removable?: boolean\n /**\n * Shows the \"Edit\" button on an image of the composer (`compact`),\n * opposite the remove one: the host opens the image editor on `edit`.\n */\n editable?: boolean\n /**\n * The upload failed (`error`) and can be tried again: the failure\n * mark becomes a \"Retry\" button, and the host uploads again on `retry`.\n */\n retryable?: boolean\n /**\n * Dense layout for the composer: a small square thumbnail / slim row,\n * without the metadata caption. The full card is reserved for the\n * message log where the details matter.\n */\n compact?: boolean\n /**\n * Keeps the download button visible instead of revealing it on hover:\n * for a file the agent wrote, which the user is there to download.\n */\n showDownload?: boolean\n /**\n * Replaces the download link of a document with a call, for a file\n * whose download URL is minted on demand (a knowledge base document\n * shared in the chat). `url` stays the link's `href`.\n */\n onDownload?: () => void | Promise<void>\n /**\n * Draws an image as a file row, with its download button, instead of\n * a thumbnail: for an image whose `url` stops working while its\n * download keeps going (a shared document after its link expires).\n */\n asFile?: boolean\n /**\n * Opens the file in the chat's viewer: a Word document or a\n * spreadsheet the chat stores, with a button beside the download.\n */\n onPreview?: () => void\n /**\n * Asks for this earlier version of the file back as the newest one,\n * with a button before the others.\n */\n onRestore?: () => void\n }>()\n\n defineEmits<{\n remove: []\n edit: []\n retry: []\n }>()\n\n const onOpenClick = (event: MouseEvent) => {\n if (!props.onDownload) {\n return\n }\n event.preventDefault()\n void props.onDownload()\n }\n\n const isImage = computed(\n () => !props.asFile && props.mediaType.startsWith('image/'),\n )\n\n // --- File-type identity (icon + accent + human kind label) ---\n\n const extension = computed(() => {\n const name = props.filename ?? ''\n const dot = name.lastIndexOf('.')\n return dot > 0 ? name.slice(dot + 1).toLowerCase() : ''\n })\n\n // mediaType subtype, e.g. \"pdf\" from \"application/pdf\"\n const subtype = computed(\n () => props.mediaType.split('/')[1]?.split(';')[0] ?? '',\n )\n\n type FileKind = {\n icon: string\n // CSS color driving the icon glyph + tile tint\n accent: string\n label: string\n }\n\n const KINDS: Array<{ test: RegExp; kind: FileKind }> = [\n {\n test: /pdf/,\n kind: {\n icon: 'ri:file-pdf-2-line',\n accent: '#e2483d',\n label: 'PDF',\n },\n },\n {\n // Match Word specifically: the generic `document` substring also\n // appears in the XLSX/PPTX OOXML mime types (…officedocument…), so\n // matching it here would mis-label spreadsheets/decks as Word.\n test: /msword|wordprocessingml/,\n kind: {\n icon: 'ri:file-word-2-line',\n accent: '#2b7de9',\n label: 'Word',\n },\n },\n {\n test: /sheet|excel|csv/,\n kind: {\n icon: 'ri:file-excel-2-line',\n accent: '#1f9d57',\n label: 'Spreadsheet',\n },\n },\n {\n test: /presentation|powerpoint/,\n kind: {\n icon: 'ri:file-ppt-2-line',\n accent: '#d98324',\n label: 'Presentation',\n },\n },\n {\n test: /zip|compressed|x-7z|x-rar|x-tar|gzip/,\n kind: {\n icon: 'ri:file-zip-line',\n accent: '#c08a1e',\n label: 'Archive',\n },\n },\n {\n // Reached only by an image drawn as a file (`asFile`).\n test: /^image\\//,\n kind: {\n icon: 'ri:image-2-line',\n accent: '#0ea5e9',\n label: 'Image',\n },\n },\n {\n test: /^audio\\//,\n kind: {\n icon: 'ri:file-music-line',\n accent: '#8b5cf6',\n label: 'Audio',\n },\n },\n {\n test: /^video\\//,\n kind: {\n icon: 'ri:film-line',\n accent: '#6366f1',\n label: 'Video',\n },\n },\n {\n // The code an agent can take (`SUPPORTED_CODE_TYPES`).\n test: /json|javascript|typescript|xml|html|css|yaml|toml|sql|x-(?:sh|python|java|kotlin|c|csharp|go|rust|ruby|php|swift|vue)\\b/,\n kind: {\n icon: 'ri:file-code-line',\n accent: '#0d9488',\n label: 'Code',\n },\n },\n {\n test: /^text\\//,\n kind: {\n icon: 'ri:file-text-line',\n accent: '#64748b',\n label: 'Text',\n },\n },\n ]\n\n const fileKind = computed<FileKind>(() => {\n const haystack = `${props.mediaType} ${extension.value}`\n for (const { test, kind } of KINDS) {\n if (test.test(haystack)) {\n return kind\n }\n }\n return {\n icon: 'ri:file-line',\n accent: '#64748b',\n label: 'File',\n }\n })\n\n // Short type tag shown in the meta line: prefer the real extension, fall\n // back to the mime subtype, then the generic kind label.\n const typeTag = computed(() =>\n (\n extension.value ||\n subtype.value ||\n fileKind.value.label\n ).toUpperCase(),\n )\n\n // --- Size & dimensions ---\n\n const formattedSize = computed(() => {\n const bytes = props.size\n if (bytes === undefined || bytes < 0) {\n return undefined\n }\n if (bytes < 1024) {\n return `${bytes} B`\n }\n const units = ['KB', 'MB', 'GB', 'TB']\n let value = bytes / 1024\n let unitIndex = 0\n while (value >= 1024 && unitIndex < units.length - 1) {\n value /= 1024\n unitIndex += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[unitIndex]}`\n })\n\n // Thumbnail load lifecycle. Driving the spinner and the error fallback\n // off the real <img> events (not a second background fetch) means the\n // image is requested exactly once and reuses the browser cache on any\n // later re-render, instead of re-downloading every time the message list\n // repaints.\n // Not `useImageFallback`: this tile also needs `loading` vs `loaded` and the\n // decoded dimensions, cached across remounts, so the error flag is one field\n // of a richer per-url entry rather than a standalone broken-url set.\n type ThumbStatus = 'loading' | 'loaded' | 'error'\n\n // Module-level, keyed by URL: survives component recreation. In polled\n // views (e.g. admin chat-logs, refreshed every few seconds) the whole\n // message array is replaced on each poll, so this component can be torn\n // down and rebuilt. Seeding from the cache means a URL that already\n // decoded starts in `loaded` (no spinner flash, no re-decode) instead of\n // flickering back through `loading`. This is a client-side, per-session\n // cache (no server/Redis involved); bounded to a max size so a long-lived\n // session browsing many images can't grow it without limit — the oldest\n // entry is evicted first (Map preserves insertion order).\n type ThumbEntry = {\n status: ThumbStatus\n dimensions?: { width: number; height: number }\n }\n const THUMB_CACHE_MAX = 300\n const thumbCache = new Map<string, ThumbEntry>()\n const setThumbCache = (url: string, entry: ThumbEntry) => {\n // Re-insert to mark as most-recently used, then trim from the front.\n thumbCache.delete(url)\n thumbCache.set(url, entry)\n if (thumbCache.size > THUMB_CACHE_MAX) {\n thumbCache.delete(thumbCache.keys().next().value as string)\n }\n }\n\n const cached = thumbCache.get(props.url)\n const thumbStatus = ref<ThumbStatus>(cached?.status ?? 'loading')\n\n // Natural pixel dimensions, captured once the thumbnail decodes. Doubles\n // as the size hint PhotoSwipe needs for its slide (falls back until known).\n const dimensions = ref<{ width: number; height: number } | undefined>(\n cached?.dimensions,\n )\n const onImageLoad = (event: Event) => {\n const img = event.target as HTMLImageElement\n if (img.naturalWidth && img.naturalHeight) {\n dimensions.value = {\n width: img.naturalWidth,\n height: img.naturalHeight,\n }\n }\n thumbStatus.value = 'loaded'\n setThumbCache(props.url, {\n status: 'loaded',\n dimensions: dimensions.value,\n })\n }\n const onImageError = () => {\n thumbStatus.value = 'error'\n setThumbCache(props.url, { status: 'error' })\n }\n\n const pswpSize = computed(() => dimensions.value ?? DEFAULT_PSWP_SIZE)\n\n // Meta fragments joined with \" · \" for the caption / doc subtitle.\n const imageMeta = computed(() =>\n [\n dimensions.value &&\n `${dimensions.value.width}×${dimensions.value.height}`,\n formattedSize.value,\n ].filter(Boolean),\n )\n const docMeta = computed(() =>\n [typeTag.value, formattedSize.value].filter(Boolean),\n )\n\n // --- Lightbox ---\n\n // Slide size PhotoSwipe assumes before the real dimensions are known.\n const DEFAULT_PSWP_SIZE = { width: 1200, height: 800 }\n\n // In a conversation the image opens in its lightbox, with the others\n const galleryRef = ref<HTMLElement>()\n const { init, shared } = useLightbox({\n gallery: galleryRef,\n loop: false,\n shared: true,\n })\n\n onMounted(async () => {\n if (!isImage.value) {\n return\n }\n await init()\n })\n</script>\n\n<template>\n <!-- Image attachment: a thumbnail tile with a metadata caption -->\n <figure\n v-if=\"isImage\"\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--image\"\n :class=\"{\n 'pk-chatbot-file-preview--error': error,\n 'pk-chatbot-file-preview--compact': compact,\n }\">\n <div ref=\"galleryRef\" class=\"pk-chatbot-file-preview__thumb-wrap\">\n <a\n :href=\"url\"\n :data-pswp-src=\"url\"\n :data-pswp-width=\"pswpSize.width\"\n :data-pswp-height=\"pswpSize.height\"\n :data-pswp-caption=\"filename ?? ''\"\n :data-pswp-shared=\"shared || undefined\"\n class=\"pk-chatbot-file-preview__thumb-link\"\n :aria-label=\"filename ?? $t('label.file')\">\n <img\n v-show=\"thumbStatus === 'loaded'\"\n :src=\"url\"\n :alt=\"filename\"\n decoding=\"async\"\n class=\"pk-chatbot-file-preview__thumb\"\n @load=\"onImageLoad\"\n @error=\"onImageError\" />\n </a>\n <!-- Spinner until the thumbnail decodes (or while an upload is in\n flight); a fixed box keeps this from shifting the layout. -->\n <span\n v-if=\"loading || thumbStatus === 'loading'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay\">\n <VvIcon name=\"loading-loop\" />\n </span>\n <!-- The upload failed: the image would not be sent. The mark says\n so on the thumbnail, where the composer hides the caption, and\n is the retry when the host offers one. -->\n <button\n v-else-if=\"error && retryable\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--failed\"\n :title=\"error\"\n :aria-label=\"$t('action.retry')\"\n @click.prevent=\"$emit('retry')\">\n <VvIcon name=\"ri:refresh-line\" />\n </button>\n <span\n v-else-if=\"error\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--failed\"\n role=\"img\"\n :title=\"error\"\n :aria-label=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n </span>\n <!-- Failed to load: a quiet icon instead of the browser's broken\n image glyph. -->\n <span\n v-else-if=\"thumbStatus === 'error'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--error\">\n <VvIcon name=\"ri:image-2-line\" />\n </span>\n </div>\n <figcaption v-if=\"!compact\" class=\"pk-chatbot-file-preview__caption\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ imageMeta.join(' · ') }}</template>\n </span>\n </figcaption>\n <button\n v-if=\"editable && compact && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__edit\"\n :title=\"$t('imageEditor.edit')\"\n :aria-label=\"$t('imageEditor.edit')\"\n @click.prevent=\"$emit('edit')\">\n <VvIcon name=\"ri:edit-line\" />\n </button>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click.prevent=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </figure>\n\n <!-- Document attachment: an icon tile + name + type · size -->\n <div\n v-else\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--doc\"\n :class=\"{\n 'pk-chatbot-file-preview--error': error,\n 'pk-chatbot-file-preview--compact': compact,\n 'pk-chatbot-file-preview--show-download': showDownload,\n }\">\n <!-- A failed upload the host can try again: the tile is the retry -->\n <button\n v-if=\"error && retryable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__icon-tile pk-chatbot-file-preview__retry u-touch-target\"\n :title=\"error\"\n :aria-label=\"$t('action.retry')\"\n @click=\"$emit('retry')\">\n <VvIcon\n name=\"ri:refresh-line\"\n class=\"pk-chatbot-file-preview__icon\" />\n </button>\n <span\n v-else\n class=\"pk-chatbot-file-preview__icon-tile\"\n :style=\"{ '--file-accent': fileKind.accent }\">\n <VvIcon\n v-if=\"loading\"\n name=\"loading-loop\"\n class=\"pk-chatbot-file-preview__icon\" />\n <VvIcon\n v-else\n :name=\"fileKind.icon\"\n class=\"pk-chatbot-file-preview__icon\" />\n </span>\n <span class=\"pk-chatbot-file-preview__body\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ docMeta.join(' · ') }}</template>\n </span>\n </span>\n <!-- The actions of a file the chat's viewer opens: a small bar of\n their own, apart from the name and the size -->\n <span\n v-if=\"!loading && !error && !compact\"\n class=\"pk-chatbot-file-preview__actions\"\n :class=\"{\n 'pk-chatbot-file-preview__actions--bar': onPreview || onRestore,\n }\">\n <button\n v-if=\"onRestore\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.restore')\"\n :aria-label=\"`${$t('chatFilePreview.restore')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onRestore\">\n <VvIcon name=\"ri:arrow-go-back-line\" />\n </button>\n <button\n v-if=\"onPreview\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.open')\"\n :aria-label=\"`${$t('chatFilePreview.open')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onPreview\">\n <VvIcon name=\"ri:eye-line\" />\n </button>\n <a\n :href=\"url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('action.download')\"\n :aria-label=\"`${$t('action.download')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onOpenClick\">\n <VvIcon name=\"ri:download-2-line\" />\n </a>\n </span>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :class=\"{ 'pk-chatbot-file-preview__remove--inline': !compact }\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-file-preview {\n // Concentric radii: outer card and inner tiles share an 8px step.\n --file-radius: var(--rounded-lg, 12px);\n\n position: relative;\n max-width: 280px;\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--file-radius);\n color: var(--color-word-2);\n font-size: var(--text-12);\n\n &--error {\n border-color: var(--color-danger);\n }\n\n // --- Document card ---\n &--doc {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n min-width: 0;\n transition:\n border-color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out),\n box-shadow 0.18s var(--ease-out);\n\n &:hover {\n border-color: var(--color-surface-4);\n background-color: var(--color-surface-2);\n box-shadow: var(--shadow-sm);\n }\n }\n\n &__icon-tile {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-36);\n height: var(--spacing-36);\n\n // One step down from the card radius keeps the nested tile concentric.\n border-radius: var(--rounded-md, 6px);\n\n // Tint derived from the file-type accent; glyph sits at full accent.\n background-color: color-mix(\n in srgb,\n var(--file-accent) 14%,\n transparent\n );\n color: var(--file-accent);\n }\n\n &__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n\n &__body {\n display: flex;\n flex-direction: column;\n gap: 1px;\n min-width: 0;\n flex: 1;\n }\n\n &__actions {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n margin-inline-start: var(--spacing-4);\n }\n\n // Restore, open and download of a file the viewer opens: one small\n // bar, its hairline setting it apart from the name and the size, the\n // icons 8px apart so they read as a group\n &__actions--bar {\n margin-inline-start: var(--spacing-8);\n padding: var(--spacing-2);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n }\n\n // 28px to aim at with a mouse, 24 in the bar; 40px under a finger\n // (u-touch-target)\n &__open {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: 0;\n border-radius: var(--rounded);\n background: none;\n color: var(--color-word-3);\n text-decoration: none;\n cursor: pointer;\n opacity: 0;\n transition:\n opacity 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n\n .vv-icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &__actions--bar &__open {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n\n &--doc:hover &__open,\n &--doc:focus-within &__open,\n &--show-download &__open {\n opacity: 1;\n }\n\n // Touch devices have no hover: keep the open affordance visible.\n @media (hover: none) {\n &--doc &__open {\n opacity: 1;\n }\n }\n\n // --- Image card ---\n &--image {\n display: inline-flex;\n flex-direction: column;\n margin: 0;\n }\n\n &__thumb-wrap {\n position: relative;\n display: flex;\n\n // Fixed box: the card claims its final footprint before the\n // image decodes, so the message log never shifts on load.\n width: 280px;\n max-width: 100%;\n height: 200px;\n background-color: var(--color-surface);\n border-radius: var(--file-radius);\n overflow: hidden;\n }\n\n &__thumb-link {\n display: flex;\n width: 100%;\n height: 100%;\n cursor: pointer;\n }\n\n &__thumb {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__caption {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: var(--spacing-8);\n min-width: 0;\n }\n\n &__name {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: var(--font-medium, 500);\n color: var(--color-word-1);\n }\n\n &__meta {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--text-10);\n line-height: var(--leading-normal);\n\n // Reserve the line even while empty: image dimensions arrive\n // only after decode and must not grow the caption.\n min-height: 1.4em;\n color: var(--color-word-4);\n\n // Stable column for the dimensions/size figures.\n font-variant-numeric: tabular-nums;\n }\n\n &__error {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-4);\n color: var(--u-danger-text, var(--color-danger));\n\n .vv-icon {\n flex-shrink: 0;\n }\n }\n\n &__status {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n .vv-icon {\n width: var(--spacing-32);\n height: var(--spacing-32);\n }\n\n &--overlay {\n position: absolute;\n inset: 0;\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 70%,\n transparent\n );\n color: var(--color-word-1);\n }\n\n &--error {\n color: var(--color-word-4);\n }\n\n // An upload that failed, in the danger text of the caption's error\n &--failed {\n padding: 0;\n border: 0;\n color: var(--u-danger-text, var(--color-danger));\n font: inherit;\n\n .vv-icon {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n }\n\n &--failed:is(button) {\n cursor: pointer;\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 85%,\n transparent\n );\n }\n }\n }\n\n // The tile of a document whose upload failed, as a retry\n &__retry {\n --file-accent: var(--u-danger-text, var(--color-danger));\n\n position: relative;\n padding: 0;\n border: 0;\n cursor: pointer;\n }\n\n // --- Remove and edit buttons (input context) ---\n &__remove,\n &__edit {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: flex;\n align-items: center;\n justify-content: center;\n\n // Visible glyph is 18px but the hit area stays a comfortable 28px.\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: none;\n border-radius: var(--rounded-full, 9999px);\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 85%,\n transparent\n );\n color: var(--color-word-2);\n cursor: pointer;\n line-height: 1;\n box-shadow: var(--shadow-sm);\n transition:\n background-color 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n scale 0.12s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n\n &:active {\n scale: 0.96;\n }\n\n // Inside the document row the button rides inline, not overlaid\n // (size is inherited from the base).\n &--inline {\n position: static;\n flex-shrink: 0;\n box-shadow: none;\n background-color: transparent;\n color: var(--color-word-4);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n }\n }\n\n // --- Compact (composer) chips ---\n // ChatGPT/Gemini-style: every attachment is the SAME height and carries\n // an always-visible round remove control in the top-right corner — no\n // hover-revealed actions, no size mismatch between image and file chips.\n &--compact {\n // Shared chip height so image and file chips align in the row.\n --chip-size: var(--spacing-56);\n\n max-width: 240px;\n\n &.pk-chatbot-file-preview--image {\n width: var(--chip-size);\n height: var(--chip-size);\n border-radius: var(--rounded-md, 6px);\n }\n\n // Fill the square; the root's `overflow: hidden` rounds the corners.\n .pk-chatbot-file-preview__thumb-wrap,\n .pk-chatbot-file-preview__thumb-link {\n width: 100%;\n height: 100%;\n }\n\n &.pk-chatbot-file-preview--doc {\n height: var(--chip-size);\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n\n // Reserve room so the corner remove button never overlaps the\n // name/meta text.\n padding-inline-end: var(--spacing-28);\n }\n\n // Square icon tile that fills the chip height, so file chips read at\n // the same scale as image thumbnails: the chip less its padding and\n // its two 1px borders. Not `align-self: stretch` with `aspect-ratio`,\n // which Safari sizes from the chip's outer height, so the tile ran\n // past the chip's bottom edge.\n .pk-chatbot-file-preview__icon-tile {\n --chip-tile-size: calc(\n var(--chip-size) - 2 * var(--spacing-8) - 2px\n );\n\n width: var(--chip-tile-size);\n height: var(--chip-tile-size);\n }\n\n .pk-chatbot-file-preview__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n // Always-visible round remove control on the top-right corner: the\n // base transform centres it 4px inside the corner, so half of it rides\n // over the chip's edge (nothing clips it), with an extended hit area\n // for easy tapping. The edit control of an image mirrors it on the\n // top-left corner.\n &--compact &__remove,\n &--compact &__edit {\n top: var(--spacing-4);\n right: var(--spacing-4);\n width: var(--spacing-24);\n height: var(--spacing-24);\n border: 1px solid var(--color-surface-4);\n background-color: var(--color-surface);\n color: var(--color-word-1);\n font-size: var(--text-16);\n box-shadow: var(--shadow-sm);\n\n // Comfortable touch/click target beyond the small visible glyph.\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-4));\n }\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n }\n\n &--compact &__edit {\n right: auto;\n left: var(--spacing-4);\n transform: translate(-50%, -50%);\n }\n\n @media (prefers-reduced-motion: reduce) {\n &--doc,\n &__open,\n &__remove,\n &__edit {\n transition: none;\n }\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;A,gCA2PUyC,IAAkB,K;;;;;;;;;;;;;;;;;;;;;;;;;EAvPxB,IAAMG,IAAQC,GA4DRC,KAAe,MAAsB;GACvC,AAAKF,EAAM,eAGXG,EAAM,eAAe,GACrBH,EAAW,WAAW;EAC1B,GAEMI,IAAUC,QACN,CAACL,EAAM,UAAUA,EAAM,UAAU,WAAW,QAAQ,CAC9D,GAIMM,IAAYD,QAAe;GAC7B,IAAME,IAAOP,EAAM,YAAY,IACzBQ,IAAMD,EAAK,YAAY,GAAG;GAChC,OAAOC,IAAM,IAAID,EAAK,MAAMC,IAAM,CAAC,CAAC,CA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