@8wave/ai-elements 0.125.0-beta.27 → 0.125.0-beta.29

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 +3196 -3114
  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-N5lgU3-k.js → PkChatbot-BjJzskl7.js} +8 -8
  42. package/dist-vue/_chunks/{PkChatbot-N5lgU3-k.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-B3Nr7-kY.js → PkChatbotViewChat-DawyiUjq.js} +322 -344
  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-D-BGFp9C.js → PkFilePreview-DfD48QQ_.js} +48 -48
  66. package/dist-vue/_chunks/{PkFilePreview-D-BGFp9C.js.map → PkFilePreview-DfD48QQ_.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkFilePreviewDialog-By2TQolA.js → PkFilePreviewDialog-DFCBpQf3.js} +2 -2
  68. package/dist-vue/_chunks/{PkFilePreviewDialog-By2TQolA.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-B3Nr7-kY.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,10 +1,10 @@
1
- import { Et as e, L as t, Ot as n, S as r, Tt as i, _ as a, d as o, f as s, g as c, gt as l, h as u, k as d, kt as f, l as p, nt as m, ot as h, r as g, v as _, w as v, wt as y, x as b, y as x, z as S } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
2
- import { t as C } from "./index.es-D-aOuzzp.js";
3
- import { t as w } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
4
- import { r as T } from "./useLightbox-D2Zi-Fpe.js";
1
+ import { Et as e, L as t, Ot as n, S as r, Tt as i, _ as a, d as o, f as s, g as c, gt as l, h as u, k as d, kt as f, l as p, nt as ee, ot as m, r as h, v as g, w as _, wt as te, x as v, y, z as b } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
2
+ import { t as x } from "./index.es-D-aOuzzp.js";
3
+ import { t as S } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
4
+ import { r as ne } from "./useLightbox-D2Zi-Fpe.js";
5
5
  // ../../packages/components/src/chat/PkChatbotFilePreview.vue?vue&type=script&setup=true&lang.ts
6
- d(), h(), g(), i();
7
- var E = [
6
+ d(), m(), h(), i();
7
+ var C = [
8
8
  "href",
9
9
  "data-pswp-src",
10
10
  "data-pswp-width",
@@ -12,20 +12,20 @@ var E = [
12
12
  "data-pswp-caption",
13
13
  "data-pswp-shared",
14
14
  "aria-label"
15
- ], D = ["src", "alt"], O = {
15
+ ], w = ["src", "alt"], T = {
16
16
  key: 0,
17
17
  class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay"
18
- }, ee = {
19
- key: 1,
18
+ }, E = ["title", "aria-label"], re = ["title", "aria-label"], ie = {
19
+ key: 3,
20
20
  class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--error"
21
- }, te = {
21
+ }, ae = {
22
22
  key: 0,
23
23
  class: "pk-chatbot-file-preview__caption"
24
- }, k = ["title"], A = { class: "pk-chatbot-file-preview__meta" }, j = ["title"], M = ["title", "aria-label"], N = { class: "pk-chatbot-file-preview__body" }, P = ["title"], F = { class: "pk-chatbot-file-preview__meta" }, I = ["title"], L = ["title", "aria-label"], R = ["title", "aria-label"], z = [
24
+ }, D = ["title"], O = { class: "pk-chatbot-file-preview__meta" }, k = ["title"], A = ["title", "aria-label"], j = ["title", "aria-label"], M = ["title", "aria-label"], N = { class: "pk-chatbot-file-preview__body" }, P = ["title"], F = { class: "pk-chatbot-file-preview__meta" }, I = ["title"], L = ["title", "aria-label"], R = ["title", "aria-label"], z = [
25
25
  "href",
26
26
  "title",
27
27
  "aria-label"
28
- ], B = ["title", "aria-label"], V = 300, H = /*#__PURE__*/ w(/* @__PURE__ */ v({
28
+ ], B = ["title", "aria-label"], V = 300, H = /*#__PURE__*/ S(/* @__PURE__ */ _({
29
29
  __name: "PkChatbotFilePreview",
30
30
  props: {
31
31
  mediaType: { type: String },
@@ -35,6 +35,8 @@ var E = [
35
35
  loading: { type: Boolean },
36
36
  error: { type: String },
37
37
  removable: { type: Boolean },
38
+ editable: { type: Boolean },
39
+ retryable: { type: Boolean },
38
40
  compact: { type: Boolean },
39
41
  showDownload: { type: Boolean },
40
42
  onDownload: { type: Function },
@@ -42,14 +44,18 @@ var E = [
42
44
  onPreview: { type: Function },
43
45
  onRestore: { type: Function }
44
46
  },
45
- emits: ["remove"],
47
+ emits: [
48
+ "remove",
49
+ "edit",
50
+ "retry"
51
+ ],
46
52
  setup(i) {
47
- let d = i, h = (e) => {
53
+ let d = i, m = (e) => {
48
54
  d.onDownload && (e.preventDefault(), d.onDownload());
49
- }, g = u(() => !d.asFile && d.mediaType.startsWith("image/")), v = u(() => {
55
+ }, h = u(() => !d.asFile && d.mediaType.startsWith("image/")), _ = u(() => {
50
56
  let e = d.filename ?? "", t = e.lastIndexOf(".");
51
57
  return t > 0 ? e.slice(t + 1).toLowerCase() : "";
52
- }), w = u(() => d.mediaType.split("/")[1]?.split(";")[0] ?? ""), H = [
58
+ }), S = u(() => d.mediaType.split("/")[1]?.split(";")[0] ?? ""), H = [
53
59
  {
54
60
  test: /pdf/,
55
61
  kind: {
@@ -131,14 +137,14 @@ var E = [
131
137
  }
132
138
  }
133
139
  ], U = u(() => {
134
- let e = `${d.mediaType} ${v.value}`;
140
+ let e = `${d.mediaType} ${_.value}`;
135
141
  for (let { test: t, kind: n } of H) if (t.test(e)) return n;
136
142
  return {
137
143
  icon: "ri:file-line",
138
144
  accent: "#64748b",
139
145
  label: "File"
140
146
  };
141
- }), W = u(() => (v.value || w.value || U.value.label).toUpperCase()), G = u(() => {
147
+ }), W = u(() => (_.value || S.value || U.value.label).toUpperCase()), G = u(() => {
142
148
  let e = d.size;
143
149
  if (e === void 0 || e < 0) return;
144
150
  if (e < 1024) return `${e} B`;
@@ -161,23 +167,26 @@ var E = [
161
167
  status: "loaded",
162
168
  dimensions: X.value
163
169
  });
164
- }, ne = () => {
170
+ }, oe = () => {
165
171
  Y.value = "error", q(d.url, { status: "error" });
166
- }, Q = u(() => X.value ?? ae), re = u(() => [X.value && `${X.value.width}×${X.value.height}`, G.value].filter(Boolean)), ie = u(() => [W.value, G.value].filter(Boolean)), ae = {
172
+ }, Q = u(() => X.value ?? le), se = u(() => [X.value && `${X.value.width}×${X.value.height}`, G.value].filter(Boolean)), ce = u(() => [W.value, G.value].filter(Boolean)), le = {
167
173
  width: 1200,
168
174
  height: 800
169
- }, $ = l(), { init: oe, shared: se } = T({
175
+ }, $ = l(), { init: ue, shared: de } = ne({
170
176
  gallery: $,
171
177
  loop: !1,
172
178
  shared: !0
173
179
  });
174
180
  return t(async () => {
175
- g.value && await oe();
181
+ h.value && await ue();
176
182
  }), (t, l) => {
177
- let u = C;
178
- return g.value ? (S(), x("figure", {
183
+ let u = x;
184
+ return h.value ? (b(), y("figure", {
179
185
  key: 0,
180
- class: e(["pk-chatbot-file-preview pk-chatbot-file-preview--image", { "pk-chatbot-file-preview--compact": i.compact }])
186
+ class: e(["pk-chatbot-file-preview pk-chatbot-file-preview--image", {
187
+ "pk-chatbot-file-preview--error": i.error,
188
+ "pk-chatbot-file-preview--compact": i.compact
189
+ }])
181
190
  }, [
182
191
  c("div", {
183
192
  ref_key: "galleryRef",
@@ -189,35 +198,56 @@ var E = [
189
198
  "data-pswp-width": Q.value.width,
190
199
  "data-pswp-height": Q.value.height,
191
200
  "data-pswp-caption": i.filename ?? "",
192
- "data-pswp-shared": y(se) || void 0,
201
+ "data-pswp-shared": te(de) || void 0,
193
202
  class: "pk-chatbot-file-preview__thumb-link",
194
203
  "aria-label": i.filename ?? t.$t("label.file")
195
- }, [m(c("img", {
204
+ }, [ee(c("img", {
196
205
  src: i.url,
197
206
  alt: i.filename,
198
207
  decoding: "async",
199
208
  class: "pk-chatbot-file-preview__thumb",
200
209
  onLoad: Z,
201
- onError: ne
202
- }, null, 40, D), [[p, Y.value === "loaded"]])], 8, E), i.loading || Y.value === "loading" ? (S(), x("span", O, [r(u, { name: "loading-loop" })])) : Y.value === "error" ? (S(), x("span", ee, [r(u, { name: "ri:image-2-line" })])) : _("", !0)], 512),
203
- i.compact ? _("", !0) : (S(), x("figcaption", te, [i.filename ? (S(), x("span", {
210
+ onError: oe
211
+ }, null, 40, w), [[p, Y.value === "loaded"]])], 8, C), i.loading || Y.value === "loading" ? (b(), y("span", T, [r(u, { name: "loading-loop" })])) : i.error && i.retryable ? (b(), y("button", {
212
+ key: 1,
213
+ type: "button",
214
+ class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--failed",
215
+ title: i.error,
216
+ "aria-label": t.$t("action.retry"),
217
+ onClick: l[0] ||= o((e) => t.$emit("retry"), ["prevent"])
218
+ }, [r(u, { name: "ri:refresh-line" })], 8, E)) : i.error ? (b(), y("span", {
219
+ key: 2,
220
+ class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--failed",
221
+ role: "img",
222
+ title: i.error,
223
+ "aria-label": i.error
224
+ }, [r(u, { name: "ri:error-warning-line" })], 8, re)) : Y.value === "error" ? (b(), y("span", ie, [r(u, { name: "ri:image-2-line" })])) : g("", !0)], 512),
225
+ i.compact ? g("", !0) : (b(), y("figcaption", ae, [i.filename ? (b(), y("span", {
204
226
  key: 0,
205
227
  class: "pk-chatbot-file-preview__name",
206
228
  title: i.filename
207
- }, f(i.filename), 9, k)) : _("", !0), c("span", A, [i.error ? (S(), x("span", {
229
+ }, f(i.filename), 9, D)) : g("", !0), c("span", O, [i.error ? (b(), y("span", {
208
230
  key: 0,
209
231
  class: "pk-chatbot-file-preview__error",
210
232
  title: i.error
211
- }, [r(u, { name: "ri:error-warning-line" }), b(" " + f(i.error), 1)], 8, j)) : (S(), x(s, { key: 1 }, [b(f(re.value.join(" · ")), 1)], 64))])])),
212
- i.removable && !i.loading ? (S(), x("button", {
233
+ }, [r(u, { name: "ri:error-warning-line" }), v(" " + f(i.error), 1)], 8, k)) : (b(), y(s, { key: 1 }, [v(f(se.value.join(" · ")), 1)], 64))])])),
234
+ i.editable && i.compact && !i.loading ? (b(), y("button", {
213
235
  key: 1,
214
236
  type: "button",
237
+ class: "pk-chatbot-file-preview__edit",
238
+ title: t.$t("imageEditor.edit"),
239
+ "aria-label": t.$t("imageEditor.edit"),
240
+ onClick: l[1] ||= o((e) => t.$emit("edit"), ["prevent"])
241
+ }, [r(u, { name: "ri:edit-line" })], 8, A)) : g("", !0),
242
+ i.removable && !i.loading ? (b(), y("button", {
243
+ key: 2,
244
+ type: "button",
215
245
  class: "pk-chatbot-file-preview__remove",
216
246
  title: t.$t("action.remove"),
217
247
  "aria-label": t.$t("action.remove"),
218
- onClick: l[0] ||= o((e) => t.$emit("remove"), ["prevent"])
219
- }, [r(u, { name: "ri:close-line" })], 8, M)) : _("", !0)
220
- ], 2)) : (S(), x("div", {
248
+ onClick: l[2] ||= o((e) => t.$emit("remove"), ["prevent"])
249
+ }, [r(u, { name: "ri:close-line" })], 8, j)) : g("", !0)
250
+ ], 2)) : (b(), y("div", {
221
251
  key: 1,
222
252
  class: e(["pk-chatbot-file-preview pk-chatbot-file-preview--doc", {
223
253
  "pk-chatbot-file-preview--error": i.error,
@@ -225,47 +255,58 @@ var E = [
225
255
  "pk-chatbot-file-preview--show-download": i.showDownload
226
256
  }])
227
257
  }, [
228
- c("span", {
258
+ i.error && i.retryable && !i.loading ? (b(), y("button", {
259
+ key: 0,
260
+ type: "button",
261
+ class: "pk-chatbot-file-preview__icon-tile pk-chatbot-file-preview__retry u-touch-target",
262
+ title: i.error,
263
+ "aria-label": t.$t("action.retry"),
264
+ onClick: l[3] ||= (e) => t.$emit("retry")
265
+ }, [r(u, {
266
+ name: "ri:refresh-line",
267
+ class: "pk-chatbot-file-preview__icon"
268
+ })], 8, M)) : (b(), y("span", {
269
+ key: 1,
229
270
  class: "pk-chatbot-file-preview__icon-tile",
230
271
  style: n({ "--file-accent": U.value.accent })
231
- }, [i.loading ? (S(), a(u, {
272
+ }, [i.loading ? (b(), a(u, {
232
273
  key: 0,
233
274
  name: "loading-loop",
234
275
  class: "pk-chatbot-file-preview__icon"
235
- })) : (S(), a(u, {
276
+ })) : (b(), a(u, {
236
277
  key: 1,
237
278
  name: U.value.icon,
238
279
  class: "pk-chatbot-file-preview__icon"
239
- }, null, 8, ["name"]))], 4),
240
- c("span", N, [i.filename ? (S(), x("span", {
280
+ }, null, 8, ["name"]))], 4)),
281
+ c("span", N, [i.filename ? (b(), y("span", {
241
282
  key: 0,
242
283
  class: "pk-chatbot-file-preview__name",
243
284
  title: i.filename
244
- }, f(i.filename), 9, P)) : _("", !0), c("span", F, [i.error ? (S(), x("span", {
285
+ }, f(i.filename), 9, P)) : g("", !0), c("span", F, [i.error ? (b(), y("span", {
245
286
  key: 0,
246
287
  class: "pk-chatbot-file-preview__error",
247
288
  title: i.error
248
- }, [r(u, { name: "ri:error-warning-line" }), b(" " + f(i.error), 1)], 8, I)) : (S(), x(s, { key: 1 }, [b(f(ie.value.join(" · ")), 1)], 64))])]),
249
- !i.loading && !i.error && !i.compact ? (S(), x("span", {
250
- key: 0,
289
+ }, [r(u, { name: "ri:error-warning-line" }), v(" " + f(i.error), 1)], 8, I)) : (b(), y(s, { key: 1 }, [v(f(ce.value.join(" · ")), 1)], 64))])]),
290
+ !i.loading && !i.error && !i.compact ? (b(), y("span", {
291
+ key: 2,
251
292
  class: e(["pk-chatbot-file-preview__actions", { "pk-chatbot-file-preview__actions--bar": i.onPreview || i.onRestore }])
252
293
  }, [
253
- i.onRestore ? (S(), x("button", {
294
+ i.onRestore ? (b(), y("button", {
254
295
  key: 0,
255
296
  type: "button",
256
297
  class: "pk-chatbot-file-preview__open u-touch-target",
257
298
  title: t.$t("chatFilePreview.restore"),
258
299
  "aria-label": `${t.$t("chatFilePreview.restore")}${i.filename ? ` — ${i.filename}` : ""}`,
259
- onClick: l[1] ||= (...e) => i.onRestore && i.onRestore(...e)
260
- }, [r(u, { name: "ri:arrow-go-back-line" })], 8, L)) : _("", !0),
261
- i.onPreview ? (S(), x("button", {
300
+ onClick: l[4] ||= (...e) => i.onRestore && i.onRestore(...e)
301
+ }, [r(u, { name: "ri:arrow-go-back-line" })], 8, L)) : g("", !0),
302
+ i.onPreview ? (b(), y("button", {
262
303
  key: 1,
263
304
  type: "button",
264
305
  class: "pk-chatbot-file-preview__open u-touch-target",
265
306
  title: t.$t("chatFilePreview.open"),
266
307
  "aria-label": `${t.$t("chatFilePreview.open")}${i.filename ? ` — ${i.filename}` : ""}`,
267
- onClick: l[2] ||= (...e) => i.onPreview && i.onPreview(...e)
268
- }, [r(u, { name: "ri:eye-line" })], 8, R)) : _("", !0),
308
+ onClick: l[5] ||= (...e) => i.onPreview && i.onPreview(...e)
309
+ }, [r(u, { name: "ri:eye-line" })], 8, R)) : g("", !0),
269
310
  c("a", {
270
311
  href: i.url,
271
312
  target: "_blank",
@@ -273,21 +314,21 @@ var E = [
273
314
  class: "pk-chatbot-file-preview__open u-touch-target",
274
315
  title: t.$t("action.download"),
275
316
  "aria-label": `${t.$t("action.download")}${i.filename ? ` — ${i.filename}` : ""}`,
276
- onClick: h
317
+ onClick: m
277
318
  }, [r(u, { name: "ri:download-2-line" })], 8, z)
278
- ], 2)) : _("", !0),
279
- i.removable && !i.loading ? (S(), x("button", {
280
- key: 1,
319
+ ], 2)) : g("", !0),
320
+ i.removable && !i.loading ? (b(), y("button", {
321
+ key: 3,
281
322
  type: "button",
282
323
  class: e(["pk-chatbot-file-preview__remove", { "pk-chatbot-file-preview__remove--inline": !i.compact }]),
283
324
  title: t.$t("action.remove"),
284
325
  "aria-label": t.$t("action.remove"),
285
- onClick: l[3] ||= (e) => t.$emit("remove")
286
- }, [r(u, { name: "ri:close-line" })], 10, B)) : _("", !0)
326
+ onClick: l[6] ||= (e) => t.$emit("remove")
327
+ }, [r(u, { name: "ri:close-line" })], 10, B)) : g("", !0)
287
328
  ], 2));
288
329
  };
289
330
  }
290
- }), [["styles", [".pk-chatbot-file-preview{--file-radius:var(--rounded-lg,12px);background-color:var(--color-surface-1);border:1px solid var(--color-surface-3);border-radius:var(--file-radius);max-width:280px;color:var(--color-word-2);font-size:var(--text-12);position:relative}.pk-chatbot-file-preview--error{border-color:var(--color-danger)}.pk-chatbot-file-preview--doc{align-items:center;gap:var(--spacing-8);padding:var(--spacing-8);min-width:0;transition:border-color .18s var(--ease-out), background-color .18s var(--ease-out), box-shadow .18s var(--ease-out);display:flex}.pk-chatbot-file-preview--doc:hover{border-color:var(--color-surface-4);background-color:var(--color-surface-2);box-shadow:var(--shadow-sm)}.pk-chatbot-file-preview__icon-tile{width:var(--spacing-36);height:var(--spacing-36);border-radius:var(--rounded-md,6px);background-color:color-mix(in srgb, var(--file-accent) 14%, transparent);color:var(--file-accent);flex-shrink:0;justify-content:center;align-items:center;display:flex}.pk-chatbot-file-preview__icon{width:var(--spacing-20);height:var(--spacing-20)}.pk-chatbot-file-preview__body{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.pk-chatbot-file-preview__actions{flex-shrink:0;align-items:center;margin-inline-start:var(--spacing-4);display:flex}.pk-chatbot-file-preview__actions--bar{padding:var(--spacing-2);border:var(--border) solid var(--color-surface-3);border-radius:var(--rounded);margin-inline-start:var(--spacing-8)}.pk-chatbot-file-preview__open{width:var(--spacing-28);height:var(--spacing-28);border-radius:var(--rounded);color:var(--color-word-3);cursor:pointer;opacity:0;transition:opacity .18s var(--ease-out), color .18s var(--ease-out), background-color .18s var(--ease-out);background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;padding:0;text-decoration:none;display:flex;position:relative}.pk-chatbot-file-preview__open:hover{background-color:var(--color-surface-3);color:var(--color-word-1)}.pk-chatbot-file-preview__open .vv-icon{width:var(--spacing-16);height:var(--spacing-16)}.pk-chatbot-file-preview__actions--bar .pk-chatbot-file-preview__open{width:var(--spacing-24);height:var(--spacing-24)}.pk-chatbot-file-preview--doc:hover .pk-chatbot-file-preview__open,.pk-chatbot-file-preview--doc:focus-within .pk-chatbot-file-preview__open,.pk-chatbot-file-preview--show-download .pk-chatbot-file-preview__open{opacity:1}@media (hover:none){.pk-chatbot-file-preview--doc .pk-chatbot-file-preview__open{opacity:1}}.pk-chatbot-file-preview--image{flex-direction:column;margin:0;display:inline-flex}.pk-chatbot-file-preview__thumb-wrap{background-color:var(--color-surface);border-radius:var(--file-radius);width:280px;max-width:100%;height:200px;display:flex;position:relative;overflow:hidden}.pk-chatbot-file-preview__thumb-link{cursor:pointer;width:100%;height:100%;display:flex}.pk-chatbot-file-preview__thumb{object-fit:cover;width:100%;height:100%;display:block}.pk-chatbot-file-preview__caption{padding:var(--spacing-8);flex-direction:column;gap:1px;min-width:0;display:flex}.pk-chatbot-file-preview__name{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-weight:var(--font-medium,500);color:var(--color-word-1);overflow:hidden}.pk-chatbot-file-preview__meta{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--text-10);line-height:var(--leading-normal);min-height:1.4em;color:var(--color-word-4);font-variant-numeric:tabular-nums;overflow:hidden}.pk-chatbot-file-preview__error{align-items:center;gap:var(--spacing-4);color:var(--u-danger-text,var(--color-danger));display:inline-flex}.pk-chatbot-file-preview__error .vv-icon{flex-shrink:0}.pk-chatbot-file-preview__status{justify-content:center;align-items:center;display:inline-flex}.pk-chatbot-file-preview__status .vv-icon{width:var(--spacing-32);height:var(--spacing-32)}.pk-chatbot-file-preview__status--overlay{background-color:color-mix(in srgb, var(--color-surface-1) 70%, transparent);color:var(--color-word-1);position:absolute;inset:0}.pk-chatbot-file-preview__status--error{color:var(--color-word-4)}.pk-chatbot-file-preview__remove{width:var(--spacing-28);height:var(--spacing-28);border-radius:var(--rounded-full,9999px);background-color:color-mix(in srgb, var(--color-surface-1) 85%, transparent);color:var(--color-word-2);cursor:pointer;box-shadow:var(--shadow-sm);transition:background-color .18s var(--ease-out), color .18s var(--ease-out), scale .12s var(--ease-out);border:none;justify-content:center;align-items:center;padding:0;line-height:1;display:flex;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.pk-chatbot-file-preview__remove:hover{background-color:var(--color-surface-2);color:var(--color-word-1)}.pk-chatbot-file-preview__remove:active{scale:.96}.pk-chatbot-file-preview__remove--inline{box-shadow:none;color:var(--color-word-4);background-color:#0000;flex-shrink:0;position:static}.pk-chatbot-file-preview__remove--inline:hover{background-color:var(--color-surface-3);color:var(--color-word-1)}.pk-chatbot-file-preview--compact{--chip-size:var(--spacing-56);max-width:240px}.pk-chatbot-file-preview--compact.pk-chatbot-file-preview--image{width:var(--chip-size);height:var(--chip-size);border-radius:var(--rounded-md,6px)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__thumb-wrap,.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__thumb-link{width:100%;height:100%}.pk-chatbot-file-preview--compact.pk-chatbot-file-preview--doc{height:var(--chip-size);gap:var(--spacing-8);padding:var(--spacing-8);padding-inline-end:var(--spacing-28)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__icon-tile{--chip-tile-size:calc(var(--chip-size) - 2 * var(--spacing-8) - 2px);width:var(--chip-tile-size);height:var(--chip-tile-size)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__icon{width:var(--spacing-20);height:var(--spacing-20)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove{top:var(--spacing-4);right:var(--spacing-4);width:var(--spacing-24);height:var(--spacing-24);border:1px solid var(--color-surface-4);background-color:var(--color-surface);color:var(--color-word-1);font-size:var(--text-16);box-shadow:var(--shadow-sm)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove:after{content:\"\";inset:calc(-1 * var(--spacing-4));position:absolute}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove:hover{background-color:var(--color-surface-2);color:var(--color-word-1)}@media (prefers-reduced-motion:reduce){.pk-chatbot-file-preview--doc,.pk-chatbot-file-preview__open,.pk-chatbot-file-preview__remove{transition:none}}"]]]);
331
+ }), [["styles", [".pk-chatbot-file-preview{--file-radius:var(--rounded-lg,12px);background-color:var(--color-surface-1);border:1px solid var(--color-surface-3);border-radius:var(--file-radius);max-width:280px;color:var(--color-word-2);font-size:var(--text-12);position:relative}.pk-chatbot-file-preview--error{border-color:var(--color-danger)}.pk-chatbot-file-preview--doc{align-items:center;gap:var(--spacing-8);padding:var(--spacing-8);min-width:0;transition:border-color .18s var(--ease-out), background-color .18s var(--ease-out), box-shadow .18s var(--ease-out);display:flex}.pk-chatbot-file-preview--doc:hover{border-color:var(--color-surface-4);background-color:var(--color-surface-2);box-shadow:var(--shadow-sm)}.pk-chatbot-file-preview__icon-tile{width:var(--spacing-36);height:var(--spacing-36);border-radius:var(--rounded-md,6px);background-color:color-mix(in srgb, var(--file-accent) 14%, transparent);color:var(--file-accent);flex-shrink:0;justify-content:center;align-items:center;display:flex}.pk-chatbot-file-preview__icon{width:var(--spacing-20);height:var(--spacing-20)}.pk-chatbot-file-preview__body{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.pk-chatbot-file-preview__actions{flex-shrink:0;align-items:center;margin-inline-start:var(--spacing-4);display:flex}.pk-chatbot-file-preview__actions--bar{padding:var(--spacing-2);border:var(--border) solid var(--color-surface-3);border-radius:var(--rounded);margin-inline-start:var(--spacing-8)}.pk-chatbot-file-preview__open{width:var(--spacing-28);height:var(--spacing-28);border-radius:var(--rounded);color:var(--color-word-3);cursor:pointer;opacity:0;transition:opacity .18s var(--ease-out), color .18s var(--ease-out), background-color .18s var(--ease-out);background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;padding:0;text-decoration:none;display:flex;position:relative}.pk-chatbot-file-preview__open:hover{background-color:var(--color-surface-3);color:var(--color-word-1)}.pk-chatbot-file-preview__open .vv-icon{width:var(--spacing-16);height:var(--spacing-16)}.pk-chatbot-file-preview__actions--bar .pk-chatbot-file-preview__open{width:var(--spacing-24);height:var(--spacing-24)}.pk-chatbot-file-preview--doc:hover .pk-chatbot-file-preview__open,.pk-chatbot-file-preview--doc:focus-within .pk-chatbot-file-preview__open,.pk-chatbot-file-preview--show-download .pk-chatbot-file-preview__open{opacity:1}@media (hover:none){.pk-chatbot-file-preview--doc .pk-chatbot-file-preview__open{opacity:1}}.pk-chatbot-file-preview--image{flex-direction:column;margin:0;display:inline-flex}.pk-chatbot-file-preview__thumb-wrap{background-color:var(--color-surface);border-radius:var(--file-radius);width:280px;max-width:100%;height:200px;display:flex;position:relative;overflow:hidden}.pk-chatbot-file-preview__thumb-link{cursor:pointer;width:100%;height:100%;display:flex}.pk-chatbot-file-preview__thumb{object-fit:cover;width:100%;height:100%;display:block}.pk-chatbot-file-preview__caption{padding:var(--spacing-8);flex-direction:column;gap:1px;min-width:0;display:flex}.pk-chatbot-file-preview__name{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-weight:var(--font-medium,500);color:var(--color-word-1);overflow:hidden}.pk-chatbot-file-preview__meta{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--text-10);line-height:var(--leading-normal);min-height:1.4em;color:var(--color-word-4);font-variant-numeric:tabular-nums;overflow:hidden}.pk-chatbot-file-preview__error{align-items:center;gap:var(--spacing-4);color:var(--u-danger-text,var(--color-danger));display:inline-flex}.pk-chatbot-file-preview__error .vv-icon{flex-shrink:0}.pk-chatbot-file-preview__status{justify-content:center;align-items:center;display:inline-flex}.pk-chatbot-file-preview__status .vv-icon{width:var(--spacing-32);height:var(--spacing-32)}.pk-chatbot-file-preview__status--overlay{background-color:color-mix(in srgb, var(--color-surface-1) 70%, transparent);color:var(--color-word-1);position:absolute;inset:0}.pk-chatbot-file-preview__status--error{color:var(--color-word-4)}.pk-chatbot-file-preview__status--failed{color:var(--u-danger-text,var(--color-danger));font:inherit;border:0;padding:0}.pk-chatbot-file-preview__status--failed .vv-icon{width:var(--spacing-24);height:var(--spacing-24)}.pk-chatbot-file-preview__status--failed:is(button){cursor:pointer}.pk-chatbot-file-preview__status--failed:is(button):hover{background-color:color-mix(in srgb, var(--color-surface-1) 85%, transparent)}.pk-chatbot-file-preview__retry{--file-accent:var(--u-danger-text,var(--color-danger));cursor:pointer;border:0;padding:0;position:relative}.pk-chatbot-file-preview__remove,.pk-chatbot-file-preview__edit{width:var(--spacing-28);height:var(--spacing-28);border-radius:var(--rounded-full,9999px);background-color:color-mix(in srgb, var(--color-surface-1) 85%, transparent);color:var(--color-word-2);cursor:pointer;box-shadow:var(--shadow-sm);transition:background-color .18s var(--ease-out), color .18s var(--ease-out), scale .12s var(--ease-out);border:none;justify-content:center;align-items:center;padding:0;line-height:1;display:flex;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.pk-chatbot-file-preview__remove:hover,.pk-chatbot-file-preview__edit:hover{background-color:var(--color-surface-2);color:var(--color-word-1)}.pk-chatbot-file-preview__remove:active,.pk-chatbot-file-preview__edit:active{scale:.96}.pk-chatbot-file-preview__remove--inline,.pk-chatbot-file-preview__edit--inline{box-shadow:none;color:var(--color-word-4);background-color:#0000;flex-shrink:0;position:static}.pk-chatbot-file-preview__remove--inline:hover,.pk-chatbot-file-preview__edit--inline:hover{background-color:var(--color-surface-3);color:var(--color-word-1)}.pk-chatbot-file-preview--compact{--chip-size:var(--spacing-56);max-width:240px}.pk-chatbot-file-preview--compact.pk-chatbot-file-preview--image{width:var(--chip-size);height:var(--chip-size);border-radius:var(--rounded-md,6px)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__thumb-wrap,.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__thumb-link{width:100%;height:100%}.pk-chatbot-file-preview--compact.pk-chatbot-file-preview--doc{height:var(--chip-size);gap:var(--spacing-8);padding:var(--spacing-8);padding-inline-end:var(--spacing-28)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__icon-tile{--chip-tile-size:calc(var(--chip-size) - 2 * var(--spacing-8) - 2px);width:var(--chip-tile-size);height:var(--chip-tile-size)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__icon{width:var(--spacing-20);height:var(--spacing-20)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove,.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__edit{top:var(--spacing-4);right:var(--spacing-4);width:var(--spacing-24);height:var(--spacing-24);border:1px solid var(--color-surface-4);background-color:var(--color-surface);color:var(--color-word-1);font-size:var(--text-16);box-shadow:var(--shadow-sm)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove:after,.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__edit:after{content:\"\";inset:calc(-1 * var(--spacing-4));position:absolute}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove:hover,.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__edit:hover{background-color:var(--color-surface-2);color:var(--color-word-1)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__edit{right:auto;left:var(--spacing-4);transform:translate(-50%,-50%)}@media (prefers-reduced-motion:reduce){.pk-chatbot-file-preview--doc,.pk-chatbot-file-preview__open,.pk-chatbot-file-preview__remove,.pk-chatbot-file-preview__edit{transition:none}}"]]]);
291
332
  export { H as t };
292
333
 
293
- //# sourceMappingURL=PkChatbotFilePreview-CFGqa-tX.js.map
334
+ //# sourceMappingURL=PkChatbotFilePreview-CqxtVySb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PkChatbotFilePreview-CqxtVySb.js","names":["$t","$emit","__unplugin_components_0","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_unref","_withDirectives","_vShow","_createVNode","_withModifiers","_createCommentVNode","_toDisplayString","_createTextVNode","_Fragment","_normalizeStyle","_createBlock","_sfc_main","_style_0","normalizeClass","onMounted","normalizeStyle","createVNode","init_shared_esm_bundler","createBlock","withModifiers","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","vShow","withDirectives","init_reactivity_esm_bundler","init_runtime_dom_esm_bundler","createCommentVNode","defineComponent","unref","createTextVNode","openBlock","Ce","_plugin_vue_export_helper_default","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","props","__props","onOpenClick","event","isImage","extension","name","dot","subtype","KINDS","fileKind","haystack","test","kind","typeTag","formattedSize","bytes","units","value","unitIndex","thumbCache","setThumbCache","url","entry","cached","thumbStatus","dimensions","onImageLoad","img","onImageError","pswpSize","DEFAULT_PSWP_SIZE","imageMeta","docMeta","galleryRef","init","_component_VvIcon","createElementBlock","shared","_ctx","_cache","args"],"sources":["../../../../packages/components/src/chat/PkChatbotFilePreview.vue","../../../../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","<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,gCA2PUkE,IAAkB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