@8wave/ai-elements 0.122.0 → 0.123.0-beta.1

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 (56) hide show
  1. package/dist/_chunks/PkFilePreview-eKok4xdc.js +211 -0
  2. package/dist/_chunks/PkFilePreview-eKok4xdc.js.map +1 -0
  3. package/dist/_chunks/PkStreamingMarkdown-Dc0R0GHe.js.map +1 -1
  4. package/dist/_chunks/PkToolChatFile-3fYhbFSi.js +222 -0
  5. package/dist/_chunks/PkToolChatFile-3fYhbFSi.js.map +1 -0
  6. package/dist/ai-elements.es.js +99 -27
  7. package/dist/ai-elements.es.js.map +1 -1
  8. package/dist-vue/PkChatbot.js +1 -1
  9. package/dist-vue/PkChatbotViewChat.js +1 -1
  10. package/dist-vue/PkChatbotViewConversations.js +1 -1
  11. package/dist-vue/PkChatbotViewFiles.js +1 -1
  12. package/dist-vue/PkChatbotViewProfile.js +1 -1
  13. package/dist-vue/_chunks/{PkChatbot-CxbPkjhQ.js → PkChatbot-D3KGDerg.js} +6 -6
  14. package/dist-vue/_chunks/{PkChatbot-CxbPkjhQ.js.map → PkChatbot-D3KGDerg.js.map} +1 -1
  15. package/dist-vue/_chunks/{PkChatbotViewChat-gcim5jsW.js → PkChatbotViewChat-BNaSv86u.js} +373 -329
  16. package/dist-vue/_chunks/PkChatbotViewChat-BNaSv86u.js.map +1 -0
  17. package/dist-vue/_chunks/{PkChatbotViewConversations-ZdDraX9c.js → PkChatbotViewConversations-C1vl8z4o.js} +2 -2
  18. package/dist-vue/_chunks/{PkChatbotViewConversations-ZdDraX9c.js.map → PkChatbotViewConversations-C1vl8z4o.js.map} +1 -1
  19. package/dist-vue/_chunks/{PkChatbotViewFiles-BqZ3CJm5.js → PkChatbotViewFiles-DiKHsdPE.js} +2 -2
  20. package/dist-vue/_chunks/{PkChatbotViewFiles-BqZ3CJm5.js.map → PkChatbotViewFiles-DiKHsdPE.js.map} +1 -1
  21. package/dist-vue/_chunks/{PkChatbotViewProfile-CANtq-SY.js → PkChatbotViewProfile-CuQ0MAX7.js} +2 -2
  22. package/dist-vue/_chunks/{PkChatbotViewProfile-CANtq-SY.js.map → PkChatbotViewProfile-CuQ0MAX7.js.map} +1 -1
  23. package/dist-vue/_chunks/PkFilePreview-Cx6jmJCD.js +200 -0
  24. package/dist-vue/_chunks/PkFilePreview-Cx6jmJCD.js.map +1 -0
  25. package/dist-vue/_chunks/PkToolChatFile-BJsDSu1Q.js +220 -0
  26. package/dist-vue/_chunks/PkToolChatFile-BJsDSu1Q.js.map +1 -0
  27. package/dist-vue/_chunks/{createChatbotApiClient-Cu1nDV3E.js → createChatbotApiClient-DAh91HyT.js} +2 -2
  28. package/dist-vue/_chunks/{createChatbotApiClient-Cu1nDV3E.js.map → createChatbotApiClient-DAh91HyT.js.map} +1 -1
  29. package/dist-vue/_chunks/{useChatbotStore-CPl6KHny.js → useChatbotStore-D1U24qc8.js} +2 -2
  30. package/dist-vue/_chunks/{useChatbotStore-CPl6KHny.js.map → useChatbotStore-D1U24qc8.js.map} +1 -1
  31. package/dist-vue/_chunks/utils-DaAIWTtt.js.map +1 -1
  32. package/dist-vue/api.js +1 -1
  33. package/dist-vue/composables.js +30 -2
  34. package/dist-vue/composables.js.map +1 -1
  35. package/dist-vue/index.js +6 -6
  36. package/dist-vue/locales.js +32 -4
  37. package/dist-vue/packages/components/src/chat/PkFilePreview.d.ts +28 -0
  38. package/dist-vue/packages/components/src/chat/PkSpreadsheetPreview.d.ts +15 -0
  39. package/dist-vue/packages/components/src/chat/PkToolChatFile.d.ts +11 -1
  40. package/dist-vue/packages/components/src/chat/PkWordPreview.d.ts +5 -18
  41. package/dist-vue/packages/components/src/chat/utils.d.ts +2 -1
  42. package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +3 -3
  43. package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +137 -0
  44. package/dist-vue/packages/models/src/schema/WordPreview.d.ts +1 -0
  45. package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
  46. package/dist-vue/style.css +1 -1
  47. package/package.json +1 -1
  48. package/dist/_chunks/PkToolChatFile-CScP_O0D.js +0 -193
  49. package/dist/_chunks/PkToolChatFile-CScP_O0D.js.map +0 -1
  50. package/dist/_chunks/PkWordPreview-COVeYzqX.js +0 -120
  51. package/dist/_chunks/PkWordPreview-COVeYzqX.js.map +0 -1
  52. package/dist-vue/_chunks/PkChatbotViewChat-gcim5jsW.js.map +0 -1
  53. package/dist-vue/_chunks/PkToolChatFile-iOyeQBp6.js +0 -191
  54. package/dist-vue/_chunks/PkToolChatFile-iOyeQBp6.js.map +0 -1
  55. package/dist-vue/_chunks/PkWordPreview-azW8wfJe.js +0 -115
  56. package/dist-vue/_chunks/PkWordPreview-azW8wfJe.js.map +0 -1
@@ -1,191 +0,0 @@
1
- import { E as e, M as t } from "./Agent-BWwjGG2f.js";
2
- import { t as n } from "./VvButtonLocalized-C-vx25u4.js";
3
- import { t as r } from "./PkChatbotFilePreview-CzmGvKjI.js";
4
- import { VvIcon as i } from "@volverjs/ui-vue/components";
5
- import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v } from "vue";
6
- import { useI18n as y } from "vue-i18n";
7
- // ../../packages/components/src/chat/PkToolChatFile.vue?vue&type=script&setup=true&lang.ts
8
- var b = {
9
- key: 0,
10
- class: "pk-tool-chat-file"
11
- }, x = { class: "pk-tool-chat-file__file" }, S = {
12
- key: 0,
13
- class: "pk-tool-chat-file__changes mt-xs"
14
- }, C = { class: "pk-tool-chat-file__summary" }, w = { class: "pk-tool-chat-file__scroll" }, ee = {
15
- key: 0,
16
- class: "pk-tool-chat-file__table"
17
- }, te = { scope: "col" }, ne = { scope: "col" }, T = { scope: "col" }, E = {
18
- colspan: "3",
19
- scope: "rowgroup",
20
- class: "pk-tool-chat-file__sheet"
21
- }, D = {
22
- key: 0,
23
- colspan: "3",
24
- class: "pk-tool-chat-file__after"
25
- }, O = { class: "pk-tool-chat-file__cell" }, k = { class: "pk-tool-chat-file__before" }, A = { class: "pk-tool-chat-file__after" }, j = {
26
- key: 1,
27
- class: "pk-tool-chat-file__paragraphs"
28
- }, M = { class: "pk-tool-chat-file__what" }, N = { class: "pk-tool-chat-file__text" }, P = {
29
- key: 0,
30
- class: "pk-tool-chat-file__removed"
31
- }, F = {
32
- key: 1,
33
- class: "pk-tool-chat-file__added"
34
- }, I = { key: 2 }, L = {
35
- key: 2,
36
- class: "pk-tool-chat-file__note"
37
- }, R = ["aria-expanded"], z = {
38
- key: 1,
39
- class: "text-12 text-word-3 mt-xs mb-0"
40
- }, B = 3, V = /* @__PURE__ */ p({
41
- __name: "PkToolChatFile",
42
- props: {
43
- part: {},
44
- fileUrl: { type: Function },
45
- preview: { type: Function }
46
- },
47
- setup(p) {
48
- let V = /* @__PURE__ */ new Set(["tool-editWordDocument", "tool-createWordDocument"]), H = p, { t: U } = y({ useScope: "global" }), W = h(!1), G = (e) => e?.replace(/… \(\d+ characters\)$/, "…"), K = (e, t, n) => {
49
- let r = e.split(/(\s+)/).filter(Boolean);
50
- return r.length <= (t && n ? 24 : 12) ? e : t && n ? `${r.slice(0, 12).join("")}… ${r.slice(-12).join("")}` : n ? `…${r.slice(-12).join("")}` : `${r.slice(0, 12).join("")}…`;
51
- }, q = (e, t) => {
52
- let n = e.split(/(\s+)/).filter(Boolean), r = t.split(/(\s+)/).filter(Boolean), i = Array.from({ length: n.length + 1 }, () => Array(r.length + 1).fill(0));
53
- for (let e = n.length - 1; e >= 0; e--) for (let t = r.length - 1; t >= 0; t--) i[e][t] = n[e] === r[t] ? i[e + 1][t + 1] + 1 : Math.max(i[e + 1][t], i[e][t + 1]);
54
- let a = [], o = (e, t) => {
55
- let n = a[a.length - 1];
56
- n?.kind === t ? n.text += e : a.push({
57
- text: e,
58
- kind: t
59
- });
60
- }, s = 0, c = 0;
61
- for (; s < n.length || c < r.length;) s < n.length && c < r.length && n[s] === r[c] ? (o(n[s++], "same"), c++) : c >= r.length || s < n.length && i[s + 1][c] >= i[s][c + 1] ? o(n[s++], "removed") : o(r[c++], "added");
62
- return a.map((e, t) => e.kind === "same" ? {
63
- ...e,
64
- text: K(e.text, t > 0, t < a.length - 1)
65
- } : e);
66
- }, J = (e) => {
67
- switch (e) {
68
- case "insertParagraphs": return U("messagePart.chatFileParagraphAdded");
69
- case "deleteParagraphs": return U("messagePart.chatFileParagraphDeleted");
70
- case "insertTableRow": return U("messagePart.chatFileTableRowAdded");
71
- case "deleteTableRow": return U("messagePart.chatFileTableRowDeleted");
72
- default: return U("messagePart.chatFileParagraphChanged");
73
- }
74
- }, Y = (e) => {
75
- let t = G(e.before), n = G(e.after);
76
- return {
77
- what: J(e.op),
78
- segments: t && n ? q(t, n) : [t ? {
79
- text: t,
80
- kind: "removed"
81
- } : {
82
- text: n ?? "",
83
- kind: "same"
84
- }]
85
- };
86
- }, X = (e) => {
87
- let t = e.cell ?? "", n = e.before ? void 0 : /^new sheet, (\d+) row\(s\)$/.exec(e.after ?? "")?.[1], r = e.newSheetRows ?? (n ? Number(n) : void 0);
88
- if (r !== void 0) return {
89
- sheet: t,
90
- newSheet: U("messagePart.chatFileNewSheet", r)
91
- };
92
- let i = t.lastIndexOf("!"), a = t.slice(i + 1), o = /^A(\d+):[A-Z]+(\d+)$/.exec(a);
93
- return {
94
- sheet: t.slice(0, Math.max(i, 0)),
95
- cell: o && o[1] === o[2] ? U("messagePart.chatFileRow", { row: o[1] }) : a,
96
- before: G(e.before) || void 0,
97
- after: G(e.after) || void 0
98
- };
99
- }, Z = o(() => {
100
- let n = H.part;
101
- if (n.state !== "output-available" || !n.output?.storedFileName) return;
102
- let r = n.output, i = V.has(n.type ?? ""), a;
103
- i && r.changedParagraphs !== void 0 ? a = r.tracked ? U("messagePart.editWordDocumentRevisions", r.changedParagraphs) : U("messagePart.editWordDocumentParagraphs", r.changedParagraphs) : !i && r.changedCells !== void 0 && (a = U("messagePart.editSpreadsheetCells", r.changedCells));
104
- let o = a ? r.changes ?? [] : [], s = [];
105
- return r.stalePivots && s.push(U("messagePart.chatFileRefreshPivots")), r.staleTableOfContents && s.push(U("messagePart.chatFileUpdateTableOfContents")), {
106
- output: r,
107
- mediaType: i ? t : e,
108
- summary: a && r.version ? U("messagePart.chatFileVersionSummary", {
109
- version: r.version,
110
- changed: a
111
- }) : a,
112
- cells: i ? [] : o.map(X),
113
- paragraphs: i ? o.map(Y) : [],
114
- count: o.length,
115
- more: r.moreChanges ?? 0,
116
- reminders: s
117
- };
118
- }), Q = (e) => W.value ? e ?? [] : (e ?? []).slice(0, B), re = o(() => Q(Z.value?.paragraphs)), ie = o(() => {
119
- let e = /* @__PURE__ */ new Map();
120
- for (let t of Q(Z.value?.cells)) {
121
- let n = e.get(t.sheet);
122
- n ? n.rows.push(t) : e.set(t.sheet, {
123
- sheet: t.sheet,
124
- rows: [t]
125
- });
126
- }
127
- return [...e.values()];
128
- }), $ = o(() => (Z.value?.count ?? 0) - B);
129
- return (e, t) => {
130
- let o = n, h = i;
131
- return Z.value ? (m(), l("div", b, [u("div", x, [f(r, {
132
- "media-type": Z.value.mediaType,
133
- url: p.fileUrl(Z.value.output.storedFileName),
134
- filename: Z.value.output.filename,
135
- size: Z.value.output.sizeBytes,
136
- "show-download": ""
137
- }, null, 8, [
138
- "media-type",
139
- "url",
140
- "filename",
141
- "size"
142
- ]), p.preview && Z.value.mediaType === v("application/vnd.openxmlformats-officedocument.wordprocessingml.document") ? (m(), s(o, {
143
- key: 0,
144
- modifiers: "secondary",
145
- icon: "ri:eye-line",
146
- label: v(U)("chatFilePreview.preview"),
147
- onClick: t[0] ||= (e) => p.preview({
148
- storedFileName: Z.value.output.storedFileName,
149
- filename: Z.value.output.filename ?? Z.value.output.storedFileName,
150
- version: Z.value.output.version
151
- })
152
- }, null, 8, ["label"])) : c("", !0)]), Z.value.count ? (m(), l("section", S, [
153
- u("h4", C, _(Z.value.summary), 1),
154
- u("div", w, [Z.value.cells.length ? (m(), l("table", ee, [u("thead", null, [u("tr", null, [
155
- u("th", te, _(v(U)("messagePart.chatFileCell")), 1),
156
- u("th", ne, _(v(U)("messagePart.chatFileBefore")), 1),
157
- u("th", T, _(v(U)("messagePart.chatFileAfter")), 1)
158
- ])]), (m(!0), l(a, null, g(ie.value, (e, t) => (m(), l("tbody", { key: t }, [u("tr", null, [u("th", E, _(v(U)("messagePart.chatFileSheet", { name: e.sheet })), 1)]), (m(!0), l(a, null, g(e.rows, (e, t) => (m(), l("tr", { key: t }, [e.newSheet ? (m(), l("td", D, _(e.newSheet), 1)) : (m(), l(a, { key: 1 }, [
159
- u("td", O, _(e.cell), 1),
160
- u("td", k, _(e.before), 1),
161
- u("td", A, _(e.after), 1)
162
- ], 64))]))), 128))]))), 128))])) : (m(), l("ul", j, [(m(!0), l(a, null, g(re.value, (e, t) => (m(), l("li", {
163
- key: t,
164
- class: "pk-tool-chat-file__paragraph"
165
- }, [u("span", M, _(e.what), 1), u("span", N, [(m(!0), l(a, null, g(e.segments, (e, t) => (m(), l(a, { key: t }, [e.kind === "removed" ? (m(), l("del", P, _(e.text), 1)) : e.kind === "added" ? (m(), l("ins", F, _(e.text), 1)) : (m(), l("span", I, _(e.text), 1))], 64))), 128))])]))), 128))])), W.value && Z.value.more ? (m(), l("p", L, _(v(U)("messagePart.chatFileMoreChanges", Z.value.more)), 1)) : c("", !0)]),
166
- $.value > 0 ? (m(), l("button", {
167
- key: 0,
168
- type: "button",
169
- class: "pk-tool-chat-file__more",
170
- "aria-expanded": W.value,
171
- onClick: t[1] ||= (e) => W.value = !W.value
172
- }, [f(h, {
173
- name: W.value ? "ri:arrow-up-s-line" : "ri:arrow-down-s-line",
174
- class: "text-16",
175
- "aria-hidden": "true"
176
- }, null, 8, ["name"]), d(" " + _(W.value ? v(U)("action.showLess") : v(U)("action.showMore", { count: $.value })), 1)], 8, R)) : c("", !0),
177
- (m(!0), l(a, null, g(Z.value.reminders, (e) => (m(), l("p", {
178
- key: e,
179
- class: "pk-tool-chat-file__reminder"
180
- }, [f(h, {
181
- name: "ri:information-line",
182
- class: "pk-tool-chat-file__reminder-icon",
183
- "aria-hidden": "true"
184
- }), d(" " + _(e), 1)]))), 128))
185
- ])) : Z.value.summary ? (m(), l("p", z, _(Z.value.summary), 1)) : c("", !0)])) : c("", !0);
186
- };
187
- }
188
- });
189
- export { V as default };
190
-
191
- //# sourceMappingURL=PkToolChatFile-iOyeQBp6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkToolChatFile-iOyeQBp6.js","names":["__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_createElementVNode","_createVNode","PkChatbotFilePreview","_unref","_createBlock","_createCommentVNode","_toDisplayString","_Fragment","_renderList","_createTextVNode","_sfc_main","SPREADSHEET_MIME_TYPE","WORD_MIME_TYPE","VvButtonLocalized","PkChatbotFilePreview_default","_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","_hoisted_22","_hoisted_23","SHOWN_CHANGES","PkToolChatFile_default","defineComponent","WORD_TOOL_PARTS","props","__props","$t","useI18n","showAll","ref","withoutLength","text","contextOf","runs","before","after","excerptOf","a","b","common","i","j","push","last","kind","run","k","wordChangeLabel","op","paragraphRow","change","cellRow","legacy","rows","bang","cell","appended","file","computed","part","output","word","changed","changes","reminders","shown","shownParagraphs","shownSheets","groups","row","group","hiddenRows","_component_VvButton","_component_VvIcon","VvIcon","openBlock","createElementBlock","createElementVNode","createVNode","unref","createBlock","_cache","createCommentVNode","toDisplayString","Fragment","renderList","g","index","s","segment","createTextVNode","reminder"],"sources":["../../../../packages/components/src/chat/PkToolChatFile.vue","../../../../packages/components/src/chat/PkToolChatFile.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { SPREADSHEET_MIME_TYPE, WORD_MIME_TYPE } from 'models'\n import PkChatbotFilePreview from './PkChatbotFilePreview.vue'\n import type { ChatFilePreviewTarget } from './utils'\n\n /**\n * One entry of `changes`: a cell (or an appended row, or a new sheet) of\n * `editSpreadsheet`, a paragraph or a table row of `editWordDocument`.\n */\n type ChatFileChange = {\n cell?: string\n op?: string\n before?: string\n after?: string\n newSheetRows?: number\n }\n\n /** What the four file tools return that the card shows. */\n type ChatFileOutput = {\n storedFileName: string\n filename?: string\n sizeBytes?: number\n version?: number\n changedCells?: number\n changedParagraphs?: number\n changes?: ChatFileChange[]\n moreChanges?: number\n /** Of a Word edit: the changes are revisions. */\n tracked?: boolean\n stalePivots?: true\n staleTableOfContents?: true\n }\n\n /** A run of an excerpt: text kept, taken away or put in. */\n type Segment = { text: string; kind: 'same' | 'removed' | 'added' }\n\n /**\n * A changed cell as a row of the table: its value before and after, or\n * the line that stands for a new sheet.\n */\n type CellRow = {\n sheet: string\n cell?: string\n before?: string\n after?: string\n newSheet?: string\n }\n\n /** The rows of one sheet, under its name. */\n type SheetGroup = { sheet: string; rows: CellRow[] }\n\n /** A changed paragraph or table row: what happened, and its words. */\n type ParagraphRow = { what: string; segments: Segment[] }\n\n /** The tools whose output is a Word document; the others write a spreadsheet. */\n const WORD_TOOL_PARTS = new Set([\n 'tool-editWordDocument',\n 'tool-createWordDocument',\n ])\n\n /** Rows shown before \"View more\": most edits are one to three changes. */\n const SHOWN_CHANGES = 3\n /** Words of context kept on each side of a change in a paragraph. */\n const CONTEXT_WORDS = 6\n\n /**\n * The file a call of `editSpreadsheet`, `editWordDocument`,\n * `createSpreadsheet` or `createWordDocument` wrote, a new version or a\n * new file, to download. Drawn once the call has an output: while it runs,\n * the feed's activity indicator names it, and a refused call is explained\n * by the answer. Under an edit, a frame says what changed, its first\n * rows shown: a table of cells for a spreadsheet, the changed words of\n * each paragraph for a Word document, and what is left to do in Office.\n */\n const props = defineProps<{\n part: unknown\n /** The authenticated download URL of a file stored in this chat. */\n fileUrl: (storedFileName: string) => string\n /** Opens the preview of a Word document, where the chat has one. */\n preview?: (file: ChatFilePreviewTarget) => void\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const showAll = ref(false)\n\n /**\n * The services cut a long text for the model and give its length\n * (`… (523 characters)`, the marker of every tool result, written by\n * `wordDocument.service.ts` and `spreadsheet.service.ts`): the card keeps\n * the ellipsis only.\n */\n const withoutLength = (text: string | undefined) =>\n text?.replace(/… \\(\\d+ characters\\)$/, '…')\n\n /**\n * A run of unchanged words cut to a few words on the side of each change\n * it touches: the head of the text keeps its end, the tail its start, a\n * run between two changes both, with an ellipsis where words went.\n */\n const contextOf = (text: string, before: boolean, after: boolean) => {\n const runs = text.split(/(\\s+)/).filter(Boolean)\n // Every word is followed by its space: twice as many runs.\n const keep = CONTEXT_WORDS * 2\n if (runs.length <= (before && after ? keep * 2 : keep)) {\n return text\n }\n if (before && after) {\n return `${runs.slice(0, keep).join('')}… ${runs.slice(-keep).join('')}`\n }\n return after\n ? `…${runs.slice(-keep).join('')}`\n : `${runs.slice(0, keep).join('')}…`\n }\n\n /**\n * The words of `before` and `after` that differ, word by word, so the\n * words two changes share between them stay plain. An echoed paragraph\n * is at most a few hundred characters, a few dozen words for the table.\n */\n const excerptOf = (before: string, after: string): Segment[] => {\n const a = before.split(/(\\s+)/).filter(Boolean)\n const b = after.split(/(\\s+)/).filter(Boolean)\n // Longest common subsequence, from the end\n const common = Array.from({ length: a.length + 1 }, () =>\n new Array<number>(b.length + 1).fill(0),\n )\n for (let i = a.length - 1; i >= 0; i--) {\n for (let j = b.length - 1; j >= 0; j--) {\n common[i][j] =\n a[i] === b[j]\n ? common[i + 1][j + 1] + 1\n : Math.max(common[i + 1][j], common[i][j + 1])\n }\n }\n const runs: Segment[] = []\n const push = (text: string, kind: Segment['kind']) => {\n const last = runs[runs.length - 1]\n if (last?.kind === kind) {\n last.text += text\n } else {\n runs.push({ text, kind })\n }\n }\n let i = 0\n let j = 0\n while (i < a.length || j < b.length) {\n if (i < a.length && j < b.length && a[i] === b[j]) {\n push(a[i++], 'same')\n j++\n } else if (\n j >= b.length ||\n (i < a.length && common[i + 1][j] >= common[i][j + 1])\n ) {\n push(a[i++], 'removed')\n } else {\n push(b[j++], 'added')\n }\n }\n return runs.map((run, k) =>\n run.kind === 'same'\n ? {\n ...run,\n text: contextOf(run.text, k > 0, k < runs.length - 1),\n }\n : run,\n )\n }\n\n /** What a Word operation did, as the row says it. */\n const wordChangeLabel = (op: string | undefined) => {\n switch (op) {\n case 'insertParagraphs':\n return $t('messagePart.chatFileParagraphAdded')\n case 'deleteParagraphs':\n return $t('messagePart.chatFileParagraphDeleted')\n case 'insertTableRow':\n return $t('messagePart.chatFileTableRowAdded')\n case 'deleteTableRow':\n return $t('messagePart.chatFileTableRowDeleted')\n default:\n return $t('messagePart.chatFileParagraphChanged')\n }\n }\n\n /**\n * A paragraph marked as Word marks a revision, struck where words went\n * and underlined where they came. A paragraph only added or only removed\n * is said by its label: the text added stays plain, the text removed\n * stays struck.\n */\n const paragraphRow = (change: ChatFileChange): ParagraphRow => {\n const before = withoutLength(change.before)\n const after = withoutLength(change.after)\n return {\n what: wordChangeLabel(change.op),\n segments:\n before && after\n ? excerptOf(before, after)\n : [\n before\n ? { text: before, kind: 'removed' }\n : { text: after ?? '', kind: 'same' },\n ],\n }\n }\n\n /**\n * A cell as a person reads it: its sheet heads the group of its rows, so\n * the row says `C5` and not Excel's `Listino!C5`, and a row the edit\n * appended says \"Row 10\" and not `A10:F10`.\n */\n const cellRow = (change: ChatFileChange): CellRow => {\n const ref = change.cell ?? ''\n // A new sheet is named alone, with no cell. An edit made before the\n // card read `newSheetRows` said it only in the model's words.\n const legacy = change.before\n ? undefined\n : /^new sheet, (\\d+) row\\(s\\)$/.exec(change.after ?? '')?.[1]\n const rows =\n change.newSheetRows ?? (legacy ? Number(legacy) : undefined)\n if (rows !== undefined) {\n return {\n sheet: ref,\n newSheet: $t('messagePart.chatFileNewSheet', rows),\n }\n }\n\n const bang = ref.lastIndexOf('!')\n const cell = ref.slice(bang + 1)\n const appended = /^A(\\d+):[A-Z]+(\\d+)$/.exec(cell)\n return {\n sheet: ref.slice(0, Math.max(bang, 0)),\n cell:\n appended && appended[1] === appended[2]\n ? $t('messagePart.chatFileRow', { row: appended[1] })\n : cell,\n before: withoutLength(change.before) || undefined,\n after: withoutLength(change.after) || undefined,\n }\n }\n\n const file = computed(() => {\n const part = props.part as {\n type?: string\n state?: string\n output?: Partial<ChatFileOutput>\n }\n if (part.state !== 'output-available' || !part.output?.storedFileName) {\n return undefined\n }\n const output = part.output as ChatFileOutput\n const word = WORD_TOOL_PARTS.has(part.type ?? '')\n // A new file has no count of changes. Each key is written out in its\n // own call: the widget ships only the keys it finds that way.\n let changed: string | undefined\n if (word && output.changedParagraphs !== undefined) {\n changed = output.tracked\n ? $t(\n 'messagePart.editWordDocumentRevisions',\n output.changedParagraphs,\n )\n : $t(\n 'messagePart.editWordDocumentParagraphs',\n output.changedParagraphs,\n )\n } else if (!word && output.changedCells !== undefined) {\n changed = $t(\n 'messagePart.editSpreadsheetCells',\n output.changedCells,\n )\n }\n const changes = changed ? (output.changes ?? []) : []\n const reminders: string[] = []\n if (output.stalePivots) {\n reminders.push($t('messagePart.chatFileRefreshPivots'))\n }\n if (output.staleTableOfContents) {\n reminders.push($t('messagePart.chatFileUpdateTableOfContents'))\n }\n return {\n output,\n mediaType: word ? WORD_MIME_TYPE : SPREADSHEET_MIME_TYPE,\n summary:\n changed && output.version\n ? $t('messagePart.chatFileVersionSummary', {\n version: output.version,\n changed,\n })\n : changed,\n cells: word ? [] : changes.map(cellRow),\n paragraphs: word ? changes.map(paragraphRow) : [],\n count: changes.length,\n more: output.moreChanges ?? 0,\n reminders,\n }\n })\n\n const shown = <T,>(rows: T[] | undefined): T[] =>\n showAll.value ? (rows ?? []) : (rows ?? []).slice(0, SHOWN_CHANGES)\n const shownParagraphs = computed(() => shown(file.value?.paragraphs))\n /** The rows shown, a group per sheet in the order the edit reached it. */\n const shownSheets = computed(() => {\n const groups = new Map<string, SheetGroup>()\n for (const row of shown(file.value?.cells)) {\n const group = groups.get(row.sheet)\n if (group) {\n group.rows.push(row)\n } else {\n groups.set(row.sheet, { sheet: row.sheet, rows: [row] })\n }\n }\n return [...groups.values()]\n })\n const hiddenRows = computed(() => (file.value?.count ?? 0) - SHOWN_CHANGES)\n</script>\n\n<template>\n <div v-if=\"file\" class=\"pk-tool-chat-file\">\n <div class=\"pk-tool-chat-file__file\">\n <PkChatbotFilePreview\n :media-type=\"file.mediaType\"\n :url=\"fileUrl(file.output.storedFileName)\"\n :filename=\"file.output.filename\"\n :size=\"file.output.sizeBytes\"\n show-download />\n <VvButton\n v-if=\"preview && file.mediaType === WORD_MIME_TYPE\"\n modifiers=\"secondary\"\n icon=\"ri:eye-line\"\n :label=\"$t('chatFilePreview.preview')\"\n @click=\"\n preview({\n storedFileName: file.output.storedFileName,\n filename:\n file.output.filename ?? file.output.storedFileName,\n version: file.output.version,\n })\n \" />\n </div>\n <section v-if=\"file.count\" class=\"pk-tool-chat-file__changes mt-xs\">\n <h4 class=\"pk-tool-chat-file__summary\">\n {{ file.summary }}\n </h4>\n <div class=\"pk-tool-chat-file__scroll\">\n <table\n v-if=\"file.cells.length\"\n class=\"pk-tool-chat-file__table\">\n <thead>\n <tr>\n <th scope=\"col\">\n {{ $t('messagePart.chatFileCell') }}\n </th>\n <th scope=\"col\">\n {{ $t('messagePart.chatFileBefore') }}\n </th>\n <th scope=\"col\">\n {{ $t('messagePart.chatFileAfter') }}\n </th>\n </tr>\n </thead>\n <tbody v-for=\"(group, g) in shownSheets\" :key=\"g\">\n <tr>\n <th\n colspan=\"3\"\n scope=\"rowgroup\"\n class=\"pk-tool-chat-file__sheet\">\n {{\n $t('messagePart.chatFileSheet', {\n name: group.sheet,\n })\n }}\n </th>\n </tr>\n <tr v-for=\"(row, index) in group.rows\" :key=\"index\">\n <td\n v-if=\"row.newSheet\"\n colspan=\"3\"\n class=\"pk-tool-chat-file__after\">\n {{ row.newSheet }}\n </td>\n <template v-else>\n <td class=\"pk-tool-chat-file__cell\">\n {{ row.cell }}\n </td>\n <td class=\"pk-tool-chat-file__before\">\n {{ row.before }}\n </td>\n <td class=\"pk-tool-chat-file__after\">\n {{ row.after }}\n </td>\n </template>\n </tr>\n </tbody>\n </table>\n <ul v-else class=\"pk-tool-chat-file__paragraphs\">\n <li\n v-for=\"(row, index) in shownParagraphs\"\n :key=\"index\"\n class=\"pk-tool-chat-file__paragraph\">\n <span class=\"pk-tool-chat-file__what\">\n {{ row.what }}\n </span>\n <span class=\"pk-tool-chat-file__text\">\n <template\n v-for=\"(segment, s) in row.segments\"\n :key=\"s\">\n <del\n v-if=\"segment.kind === 'removed'\"\n class=\"pk-tool-chat-file__removed\">\n {{ segment.text }}\n </del>\n <ins\n v-else-if=\"segment.kind === 'added'\"\n class=\"pk-tool-chat-file__added\">\n {{ segment.text }}\n </ins>\n <span v-else>{{ segment.text }}</span>\n </template>\n </span>\n </li>\n </ul>\n <p v-if=\"showAll && file.more\" class=\"pk-tool-chat-file__note\">\n {{ $t('messagePart.chatFileMoreChanges', file.more) }}\n </p>\n </div>\n <button\n v-if=\"hiddenRows > 0\"\n type=\"button\"\n class=\"pk-tool-chat-file__more\"\n :aria-expanded=\"showAll\"\n @click=\"showAll = !showAll\">\n <VvIcon\n :name=\"\n showAll ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\"\n aria-hidden=\"true\" />\n {{\n showAll\n ? $t('action.showLess')\n : $t('action.showMore', { count: hiddenRows })\n }}\n </button>\n <p\n v-for=\"reminder in file.reminders\"\n :key=\"reminder\"\n class=\"pk-tool-chat-file__reminder\">\n <VvIcon\n name=\"ri:information-line\"\n class=\"pk-tool-chat-file__reminder-icon\"\n aria-hidden=\"true\" />\n {{ reminder }}\n </p>\n </section>\n <p v-else-if=\"file.summary\" class=\"text-12 text-word-3 mt-xs mb-0\">\n {{ file.summary }}\n </p>\n </div>\n</template>\n\n<style lang=\"scss\">\n // One frame (DESIGN.md, principle 4): a hairline at surface-3, rounded-lg,\n // a solid ground over the dots of the chat, as wide as a short paragraph\n // while the file above keeps its 280px. Inside it every divider is one\n // hairline at surface-2.\n // The file and, for a Word document, the button of its preview\n .pk-tool-chat-file__file {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-8);\n }\n\n .pk-tool-chat-file__changes {\n max-width: 36rem;\n overflow: hidden;\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded-lg);\n background-color: var(--color-surface);\n font-size: var(--text-12);\n }\n\n .pk-tool-chat-file__summary {\n margin: 0;\n padding: var(--spacing-8) var(--spacing-12);\n border-bottom: var(--border) solid var(--color-surface-3);\n color: var(--color-word-2);\n font-size: var(--text-12);\n font-weight: var(--font-medium);\n }\n\n // Bounded, so fifty changes scroll inside the frame\n .pk-tool-chat-file__scroll {\n max-height: 20rem;\n overflow-y: auto;\n }\n\n .pk-tool-chat-file__table {\n width: 100%;\n border-collapse: collapse;\n\n th,\n td {\n padding: var(--spacing-8) var(--spacing-12);\n border-bottom: var(--border) solid var(--color-surface-2);\n text-align: start;\n vertical-align: top;\n overflow-wrap: anywhere;\n }\n\n // Told apart by its weight and colour, no heavier rule\n th {\n color: var(--color-word-3);\n font-weight: var(--font-medium);\n }\n\n tbody:last-child tr:last-child td {\n border-bottom: 0;\n }\n }\n\n // The name of a sheet heads its rows, one step of surface under it\n .pk-tool-chat-file__table .pk-tool-chat-file__sheet {\n padding-block: var(--spacing-6);\n background-color: var(--color-surface-1);\n color: var(--color-word-2);\n }\n\n .pk-tool-chat-file__cell {\n width: 1%;\n color: var(--color-word-2);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n\n .pk-tool-chat-file__before {\n width: 50%;\n color: var(--color-word-3);\n }\n\n .pk-tool-chat-file__after {\n width: 50%;\n color: var(--color-word-1);\n }\n\n .pk-tool-chat-file__paragraphs {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n .pk-tool-chat-file__paragraph {\n display: grid;\n grid-template-columns: minmax(4rem, max-content) 1fr;\n gap: var(--spacing-4) var(--spacing-md);\n padding: var(--spacing-8) var(--spacing-12);\n border-bottom: var(--border) solid var(--color-surface-2);\n\n &:last-child {\n border-bottom: 0;\n }\n }\n\n .pk-tool-chat-file__what {\n color: var(--color-word-3);\n white-space: nowrap;\n }\n\n .pk-tool-chat-file__text {\n min-width: 0;\n color: var(--color-word-2);\n overflow-wrap: anywhere;\n }\n\n // Marked as Word marks a revision, struck where words went and\n // underlined where they came, in the red and green of a comparison: the\n // change is what the row exists to report, the verdict exception of\n // DESIGN.md (principle 2). The readable text tokens hold the contrast in\n // both themes. The base styles take the line off `del`.\n .pk-tool-chat-file__removed {\n color: var(--u-danger-text);\n text-decoration: line-through;\n }\n\n .pk-tool-chat-file__added {\n color: var(--u-success-text);\n font-weight: var(--font-medium);\n text-decoration: underline;\n text-underline-offset: 0.2em;\n }\n\n .pk-tool-chat-file__removed + .pk-tool-chat-file__added {\n margin-inline-start: var(--spacing-4);\n }\n\n .pk-tool-chat-file__note {\n margin: 0;\n padding: var(--spacing-8) var(--spacing-12);\n border-top: var(--border) solid var(--color-surface-2);\n color: var(--color-word-3);\n }\n\n .pk-tool-chat-file__more {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-4);\n width: 100%;\n padding: var(--spacing-8) var(--spacing-12);\n border: 0;\n border-top: var(--border) solid var(--color-surface-2);\n background: none;\n color: var(--color-word-2);\n font: inherit;\n cursor: pointer;\n transition: background-color var(--duration-150) var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-1);\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--input-focus-color);\n outline-offset: calc(var(--spacing-2) * -1);\n }\n }\n\n .pk-tool-chat-file__reminder {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-8);\n margin: 0;\n padding: var(--spacing-8) var(--spacing-12);\n border-top: var(--border) solid var(--color-surface-2);\n color: var(--color-word-2);\n }\n\n .pk-tool-chat-file__reminder-icon {\n flex-shrink: 0;\n margin-top: var(--spacing-2);\n color: var(--color-word-3);\n font-size: var(--text-14);\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { SPREADSHEET_MIME_TYPE, WORD_MIME_TYPE } from 'models'\n import PkChatbotFilePreview from './PkChatbotFilePreview.vue'\n import type { ChatFilePreviewTarget } from './utils'\n\n /**\n * One entry of `changes`: a cell (or an appended row, or a new sheet) of\n * `editSpreadsheet`, a paragraph or a table row of `editWordDocument`.\n */\n type ChatFileChange = {\n cell?: string\n op?: string\n before?: string\n after?: string\n newSheetRows?: number\n }\n\n /** What the four file tools return that the card shows. */\n type ChatFileOutput = {\n storedFileName: string\n filename?: string\n sizeBytes?: number\n version?: number\n changedCells?: number\n changedParagraphs?: number\n changes?: ChatFileChange[]\n moreChanges?: number\n /** Of a Word edit: the changes are revisions. */\n tracked?: boolean\n stalePivots?: true\n staleTableOfContents?: true\n }\n\n /** A run of an excerpt: text kept, taken away or put in. */\n type Segment = { text: string; kind: 'same' | 'removed' | 'added' }\n\n /**\n * A changed cell as a row of the table: its value before and after, or\n * the line that stands for a new sheet.\n */\n type CellRow = {\n sheet: string\n cell?: string\n before?: string\n after?: string\n newSheet?: string\n }\n\n /** The rows of one sheet, under its name. */\n type SheetGroup = { sheet: string; rows: CellRow[] }\n\n /** A changed paragraph or table row: what happened, and its words. */\n type ParagraphRow = { what: string; segments: Segment[] }\n\n /** The tools whose output is a Word document; the others write a spreadsheet. */\n const WORD_TOOL_PARTS = new Set([\n 'tool-editWordDocument',\n 'tool-createWordDocument',\n ])\n\n /** Rows shown before \"View more\": most edits are one to three changes. */\n const SHOWN_CHANGES = 3\n /** Words of context kept on each side of a change in a paragraph. */\n const CONTEXT_WORDS = 6\n\n /**\n * The file a call of `editSpreadsheet`, `editWordDocument`,\n * `createSpreadsheet` or `createWordDocument` wrote, a new version or a\n * new file, to download. Drawn once the call has an output: while it runs,\n * the feed's activity indicator names it, and a refused call is explained\n * by the answer. Under an edit, a frame says what changed, its first\n * rows shown: a table of cells for a spreadsheet, the changed words of\n * each paragraph for a Word document, and what is left to do in Office.\n */\n const props = defineProps<{\n part: unknown\n /** The authenticated download URL of a file stored in this chat. */\n fileUrl: (storedFileName: string) => string\n /** Opens the preview of a Word document, where the chat has one. */\n preview?: (file: ChatFilePreviewTarget) => void\n }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const showAll = ref(false)\n\n /**\n * The services cut a long text for the model and give its length\n * (`… (523 characters)`, the marker of every tool result, written by\n * `wordDocument.service.ts` and `spreadsheet.service.ts`): the card keeps\n * the ellipsis only.\n */\n const withoutLength = (text: string | undefined) =>\n text?.replace(/… \\(\\d+ characters\\)$/, '…')\n\n /**\n * A run of unchanged words cut to a few words on the side of each change\n * it touches: the head of the text keeps its end, the tail its start, a\n * run between two changes both, with an ellipsis where words went.\n */\n const contextOf = (text: string, before: boolean, after: boolean) => {\n const runs = text.split(/(\\s+)/).filter(Boolean)\n // Every word is followed by its space: twice as many runs.\n const keep = CONTEXT_WORDS * 2\n if (runs.length <= (before && after ? keep * 2 : keep)) {\n return text\n }\n if (before && after) {\n return `${runs.slice(0, keep).join('')}… ${runs.slice(-keep).join('')}`\n }\n return after\n ? `…${runs.slice(-keep).join('')}`\n : `${runs.slice(0, keep).join('')}…`\n }\n\n /**\n * The words of `before` and `after` that differ, word by word, so the\n * words two changes share between them stay plain. An echoed paragraph\n * is at most a few hundred characters, a few dozen words for the table.\n */\n const excerptOf = (before: string, after: string): Segment[] => {\n const a = before.split(/(\\s+)/).filter(Boolean)\n const b = after.split(/(\\s+)/).filter(Boolean)\n // Longest common subsequence, from the end\n const common = Array.from({ length: a.length + 1 }, () =>\n new Array<number>(b.length + 1).fill(0),\n )\n for (let i = a.length - 1; i >= 0; i--) {\n for (let j = b.length - 1; j >= 0; j--) {\n common[i][j] =\n a[i] === b[j]\n ? common[i + 1][j + 1] + 1\n : Math.max(common[i + 1][j], common[i][j + 1])\n }\n }\n const runs: Segment[] = []\n const push = (text: string, kind: Segment['kind']) => {\n const last = runs[runs.length - 1]\n if (last?.kind === kind) {\n last.text += text\n } else {\n runs.push({ text, kind })\n }\n }\n let i = 0\n let j = 0\n while (i < a.length || j < b.length) {\n if (i < a.length && j < b.length && a[i] === b[j]) {\n push(a[i++], 'same')\n j++\n } else if (\n j >= b.length ||\n (i < a.length && common[i + 1][j] >= common[i][j + 1])\n ) {\n push(a[i++], 'removed')\n } else {\n push(b[j++], 'added')\n }\n }\n return runs.map((run, k) =>\n run.kind === 'same'\n ? {\n ...run,\n text: contextOf(run.text, k > 0, k < runs.length - 1),\n }\n : run,\n )\n }\n\n /** What a Word operation did, as the row says it. */\n const wordChangeLabel = (op: string | undefined) => {\n switch (op) {\n case 'insertParagraphs':\n return $t('messagePart.chatFileParagraphAdded')\n case 'deleteParagraphs':\n return $t('messagePart.chatFileParagraphDeleted')\n case 'insertTableRow':\n return $t('messagePart.chatFileTableRowAdded')\n case 'deleteTableRow':\n return $t('messagePart.chatFileTableRowDeleted')\n default:\n return $t('messagePart.chatFileParagraphChanged')\n }\n }\n\n /**\n * A paragraph marked as Word marks a revision, struck where words went\n * and underlined where they came. A paragraph only added or only removed\n * is said by its label: the text added stays plain, the text removed\n * stays struck.\n */\n const paragraphRow = (change: ChatFileChange): ParagraphRow => {\n const before = withoutLength(change.before)\n const after = withoutLength(change.after)\n return {\n what: wordChangeLabel(change.op),\n segments:\n before && after\n ? excerptOf(before, after)\n : [\n before\n ? { text: before, kind: 'removed' }\n : { text: after ?? '', kind: 'same' },\n ],\n }\n }\n\n /**\n * A cell as a person reads it: its sheet heads the group of its rows, so\n * the row says `C5` and not Excel's `Listino!C5`, and a row the edit\n * appended says \"Row 10\" and not `A10:F10`.\n */\n const cellRow = (change: ChatFileChange): CellRow => {\n const ref = change.cell ?? ''\n // A new sheet is named alone, with no cell. An edit made before the\n // card read `newSheetRows` said it only in the model's words.\n const legacy = change.before\n ? undefined\n : /^new sheet, (\\d+) row\\(s\\)$/.exec(change.after ?? '')?.[1]\n const rows =\n change.newSheetRows ?? (legacy ? Number(legacy) : undefined)\n if (rows !== undefined) {\n return {\n sheet: ref,\n newSheet: $t('messagePart.chatFileNewSheet', rows),\n }\n }\n\n const bang = ref.lastIndexOf('!')\n const cell = ref.slice(bang + 1)\n const appended = /^A(\\d+):[A-Z]+(\\d+)$/.exec(cell)\n return {\n sheet: ref.slice(0, Math.max(bang, 0)),\n cell:\n appended && appended[1] === appended[2]\n ? $t('messagePart.chatFileRow', { row: appended[1] })\n : cell,\n before: withoutLength(change.before) || undefined,\n after: withoutLength(change.after) || undefined,\n }\n }\n\n const file = computed(() => {\n const part = props.part as {\n type?: string\n state?: string\n output?: Partial<ChatFileOutput>\n }\n if (part.state !== 'output-available' || !part.output?.storedFileName) {\n return undefined\n }\n const output = part.output as ChatFileOutput\n const word = WORD_TOOL_PARTS.has(part.type ?? '')\n // A new file has no count of changes. Each key is written out in its\n // own call: the widget ships only the keys it finds that way.\n let changed: string | undefined\n if (word && output.changedParagraphs !== undefined) {\n changed = output.tracked\n ? $t(\n 'messagePart.editWordDocumentRevisions',\n output.changedParagraphs,\n )\n : $t(\n 'messagePart.editWordDocumentParagraphs',\n output.changedParagraphs,\n )\n } else if (!word && output.changedCells !== undefined) {\n changed = $t(\n 'messagePart.editSpreadsheetCells',\n output.changedCells,\n )\n }\n const changes = changed ? (output.changes ?? []) : []\n const reminders: string[] = []\n if (output.stalePivots) {\n reminders.push($t('messagePart.chatFileRefreshPivots'))\n }\n if (output.staleTableOfContents) {\n reminders.push($t('messagePart.chatFileUpdateTableOfContents'))\n }\n return {\n output,\n mediaType: word ? WORD_MIME_TYPE : SPREADSHEET_MIME_TYPE,\n summary:\n changed && output.version\n ? $t('messagePart.chatFileVersionSummary', {\n version: output.version,\n changed,\n })\n : changed,\n cells: word ? [] : changes.map(cellRow),\n paragraphs: word ? changes.map(paragraphRow) : [],\n count: changes.length,\n more: output.moreChanges ?? 0,\n reminders,\n }\n })\n\n const shown = <T,>(rows: T[] | undefined): T[] =>\n showAll.value ? (rows ?? []) : (rows ?? []).slice(0, SHOWN_CHANGES)\n const shownParagraphs = computed(() => shown(file.value?.paragraphs))\n /** The rows shown, a group per sheet in the order the edit reached it. */\n const shownSheets = computed(() => {\n const groups = new Map<string, SheetGroup>()\n for (const row of shown(file.value?.cells)) {\n const group = groups.get(row.sheet)\n if (group) {\n group.rows.push(row)\n } else {\n groups.set(row.sheet, { sheet: row.sheet, rows: [row] })\n }\n }\n return [...groups.values()]\n })\n const hiddenRows = computed(() => (file.value?.count ?? 0) - SHOWN_CHANGES)\n</script>\n\n<template>\n <div v-if=\"file\" class=\"pk-tool-chat-file\">\n <div class=\"pk-tool-chat-file__file\">\n <PkChatbotFilePreview\n :media-type=\"file.mediaType\"\n :url=\"fileUrl(file.output.storedFileName)\"\n :filename=\"file.output.filename\"\n :size=\"file.output.sizeBytes\"\n show-download />\n <VvButton\n v-if=\"preview && file.mediaType === WORD_MIME_TYPE\"\n modifiers=\"secondary\"\n icon=\"ri:eye-line\"\n :label=\"$t('chatFilePreview.preview')\"\n @click=\"\n preview({\n storedFileName: file.output.storedFileName,\n filename:\n file.output.filename ?? file.output.storedFileName,\n version: file.output.version,\n })\n \" />\n </div>\n <section v-if=\"file.count\" class=\"pk-tool-chat-file__changes mt-xs\">\n <h4 class=\"pk-tool-chat-file__summary\">\n {{ file.summary }}\n </h4>\n <div class=\"pk-tool-chat-file__scroll\">\n <table\n v-if=\"file.cells.length\"\n class=\"pk-tool-chat-file__table\">\n <thead>\n <tr>\n <th scope=\"col\">\n {{ $t('messagePart.chatFileCell') }}\n </th>\n <th scope=\"col\">\n {{ $t('messagePart.chatFileBefore') }}\n </th>\n <th scope=\"col\">\n {{ $t('messagePart.chatFileAfter') }}\n </th>\n </tr>\n </thead>\n <tbody v-for=\"(group, g) in shownSheets\" :key=\"g\">\n <tr>\n <th\n colspan=\"3\"\n scope=\"rowgroup\"\n class=\"pk-tool-chat-file__sheet\">\n {{\n $t('messagePart.chatFileSheet', {\n name: group.sheet,\n })\n }}\n </th>\n </tr>\n <tr v-for=\"(row, index) in group.rows\" :key=\"index\">\n <td\n v-if=\"row.newSheet\"\n colspan=\"3\"\n class=\"pk-tool-chat-file__after\">\n {{ row.newSheet }}\n </td>\n <template v-else>\n <td class=\"pk-tool-chat-file__cell\">\n {{ row.cell }}\n </td>\n <td class=\"pk-tool-chat-file__before\">\n {{ row.before }}\n </td>\n <td class=\"pk-tool-chat-file__after\">\n {{ row.after }}\n </td>\n </template>\n </tr>\n </tbody>\n </table>\n <ul v-else class=\"pk-tool-chat-file__paragraphs\">\n <li\n v-for=\"(row, index) in shownParagraphs\"\n :key=\"index\"\n class=\"pk-tool-chat-file__paragraph\">\n <span class=\"pk-tool-chat-file__what\">\n {{ row.what }}\n </span>\n <span class=\"pk-tool-chat-file__text\">\n <template\n v-for=\"(segment, s) in row.segments\"\n :key=\"s\">\n <del\n v-if=\"segment.kind === 'removed'\"\n class=\"pk-tool-chat-file__removed\">\n {{ segment.text }}\n </del>\n <ins\n v-else-if=\"segment.kind === 'added'\"\n class=\"pk-tool-chat-file__added\">\n {{ segment.text }}\n </ins>\n <span v-else>{{ segment.text }}</span>\n </template>\n </span>\n </li>\n </ul>\n <p v-if=\"showAll && file.more\" class=\"pk-tool-chat-file__note\">\n {{ $t('messagePart.chatFileMoreChanges', file.more) }}\n </p>\n </div>\n <button\n v-if=\"hiddenRows > 0\"\n type=\"button\"\n class=\"pk-tool-chat-file__more\"\n :aria-expanded=\"showAll\"\n @click=\"showAll = !showAll\">\n <VvIcon\n :name=\"\n showAll ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\"\n aria-hidden=\"true\" />\n {{\n showAll\n ? $t('action.showLess')\n : $t('action.showMore', { count: hiddenRows })\n }}\n </button>\n <p\n v-for=\"reminder in file.reminders\"\n :key=\"reminder\"\n class=\"pk-tool-chat-file__reminder\">\n <VvIcon\n name=\"ri:information-line\"\n class=\"pk-tool-chat-file__reminder-icon\"\n aria-hidden=\"true\" />\n {{ reminder }}\n </p>\n </section>\n <p v-else-if=\"file.summary\" class=\"text-12 text-word-3 mt-xs mb-0\">\n {{ file.summary }}\n </p>\n </div>\n</template>\n\n<style lang=\"scss\">\n // One frame (DESIGN.md, principle 4): a hairline at surface-3, rounded-lg,\n // a solid ground over the dots of the chat, as wide as a short paragraph\n // while the file above keeps its 280px. Inside it every divider is one\n // hairline at surface-2.\n // The file and, for a Word document, the button of its preview\n .pk-tool-chat-file__file {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-8);\n }\n\n .pk-tool-chat-file__changes {\n max-width: 36rem;\n overflow: hidden;\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded-lg);\n background-color: var(--color-surface);\n font-size: var(--text-12);\n }\n\n .pk-tool-chat-file__summary {\n margin: 0;\n padding: var(--spacing-8) var(--spacing-12);\n border-bottom: var(--border) solid var(--color-surface-3);\n color: var(--color-word-2);\n font-size: var(--text-12);\n font-weight: var(--font-medium);\n }\n\n // Bounded, so fifty changes scroll inside the frame\n .pk-tool-chat-file__scroll {\n max-height: 20rem;\n overflow-y: auto;\n }\n\n .pk-tool-chat-file__table {\n width: 100%;\n border-collapse: collapse;\n\n th,\n td {\n padding: var(--spacing-8) var(--spacing-12);\n border-bottom: var(--border) solid var(--color-surface-2);\n text-align: start;\n vertical-align: top;\n overflow-wrap: anywhere;\n }\n\n // Told apart by its weight and colour, no heavier rule\n th {\n color: var(--color-word-3);\n font-weight: var(--font-medium);\n }\n\n tbody:last-child tr:last-child td {\n border-bottom: 0;\n }\n }\n\n // The name of a sheet heads its rows, one step of surface under it\n .pk-tool-chat-file__table .pk-tool-chat-file__sheet {\n padding-block: var(--spacing-6);\n background-color: var(--color-surface-1);\n color: var(--color-word-2);\n }\n\n .pk-tool-chat-file__cell {\n width: 1%;\n color: var(--color-word-2);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n\n .pk-tool-chat-file__before {\n width: 50%;\n color: var(--color-word-3);\n }\n\n .pk-tool-chat-file__after {\n width: 50%;\n color: var(--color-word-1);\n }\n\n .pk-tool-chat-file__paragraphs {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n .pk-tool-chat-file__paragraph {\n display: grid;\n grid-template-columns: minmax(4rem, max-content) 1fr;\n gap: var(--spacing-4) var(--spacing-md);\n padding: var(--spacing-8) var(--spacing-12);\n border-bottom: var(--border) solid var(--color-surface-2);\n\n &:last-child {\n border-bottom: 0;\n }\n }\n\n .pk-tool-chat-file__what {\n color: var(--color-word-3);\n white-space: nowrap;\n }\n\n .pk-tool-chat-file__text {\n min-width: 0;\n color: var(--color-word-2);\n overflow-wrap: anywhere;\n }\n\n // Marked as Word marks a revision, struck where words went and\n // underlined where they came, in the red and green of a comparison: the\n // change is what the row exists to report, the verdict exception of\n // DESIGN.md (principle 2). The readable text tokens hold the contrast in\n // both themes. The base styles take the line off `del`.\n .pk-tool-chat-file__removed {\n color: var(--u-danger-text);\n text-decoration: line-through;\n }\n\n .pk-tool-chat-file__added {\n color: var(--u-success-text);\n font-weight: var(--font-medium);\n text-decoration: underline;\n text-underline-offset: 0.2em;\n }\n\n .pk-tool-chat-file__removed + .pk-tool-chat-file__added {\n margin-inline-start: var(--spacing-4);\n }\n\n .pk-tool-chat-file__note {\n margin: 0;\n padding: var(--spacing-8) var(--spacing-12);\n border-top: var(--border) solid var(--color-surface-2);\n color: var(--color-word-3);\n }\n\n .pk-tool-chat-file__more {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-4);\n width: 100%;\n padding: var(--spacing-8) var(--spacing-12);\n border: 0;\n border-top: var(--border) solid var(--color-surface-2);\n background: none;\n color: var(--color-word-2);\n font: inherit;\n cursor: pointer;\n transition: background-color var(--duration-150) var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-1);\n }\n\n &:focus-visible {\n outline: var(--spacing-2) solid var(--input-focus-color);\n outline-offset: calc(var(--spacing-2) * -1);\n }\n }\n\n .pk-tool-chat-file__reminder {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-8);\n margin: 0;\n padding: var(--spacing-8) var(--spacing-12);\n border-top: var(--border) solid var(--color-surface-2);\n color: var(--color-word-2);\n }\n\n .pk-tool-chat-file__reminder-icon {\n flex-shrink: 0;\n margin-top: var(--spacing-2);\n color: var(--color-word-3);\n font-size: var(--text-14);\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A,GA+DU0C,IAAgB,G;;;;;;;;EANtB,IAAMG,oBAAkB,IAAI,IAAI,CAC5B,yBACA,yBACJ,CAAC,GAgBKC,IAAQC,GAQR,EAAE,GAAGC,MAAOC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1CC,IAAUC,EAAI,EAAK,GAQnBC,KAAiB,MACnBC,GAAM,QAAQ,yBAAyB,GAAG,GAOxCC,KAAa,GAAc,GAAiB,MAAmB;GACjE,IAAMC,IAAOF,EAAK,MAAM,OAAO,CAAC,CAAC,OAAO,OAAO;GAS/C,OANIE,EAAK,WAAWC,KAAUC,IAAQ,KAAW,MACtCJ,IAEPG,KAAUC,IACH,GAAGF,EAAK,MAAM,GAAG,EAAI,CAAC,CAAC,KAAK,EAAE,EAAE,IAAIA,EAAK,MAAM,GAAK,CAAC,CAAC,KAAK,EAAE,MAEjEE,IACD,IAAIF,EAAK,MAAM,GAAK,CAAC,CAAC,KAAK,EAAE,MAC7B,GAAGA,EAAK,MAAM,GAAG,EAAI,CAAC,CAAC,KAAK,EAAE,EAAE;EAC1C,GAOMG,KAAa,GAAgB,MAA6B;GAC5D,IAAMC,IAAIH,EAAO,MAAM,OAAO,CAAC,CAA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AAA,C;G,MAGLlC,EAAA,MAAK,WAAnB7E,EAAA,GAAAC,EAEI,KAFJsC,GAEI/B,EADGqE,EAAA,MAAK,OAAO,GAAA,CAAA,K"}
@@ -1,115 +0,0 @@
1
- import { t as e } from "./VvButtonLocalized-C-vx25u4.js";
2
- import { Fragment as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, openBlock as u, renderList as d, resolveDynamicComponent as f, toDisplayString as p, unref as m, withCtx as h } from "vue";
3
- import { useI18n as g } from "vue-i18n";
4
- // ../../packages/components/src/chat/PkWordPreviewRuns.vue?vue&type=script&setup=true&lang.ts
5
- var _ = {
6
- key: 0,
7
- class: "pk-word-preview__image"
8
- }, v = ["title"], y = ["title"], b = /* @__PURE__ */ c({
9
- __name: "PkWordPreviewRuns",
10
- props: { runs: {} },
11
- setup(e) {
12
- let { t: n } = g({ useScope: "global" }), r = (e) => ({
13
- "font-semibold": e.bold,
14
- italic: e.italic,
15
- "pk-word-preview__underline": e.underline
16
- }), i = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
17
- return (o, s) => (u(!0), a(t, null, d(e.runs, (e, o) => (u(), a(t, { key: o }, [e.image ? (u(), a("span", _, p(m(n)("chatFilePreview.image")), 1)) : e.change === "deleted" ? (u(), a("del", {
18
- key: 1,
19
- class: l(["pk-word-preview__removed", r(e)]),
20
- title: i(e)
21
- }, p(e.text), 11, v)) : e.change === "inserted" ? (u(), a("ins", {
22
- key: 2,
23
- class: l(["pk-word-preview__added", r(e)]),
24
- title: i(e)
25
- }, p(e.text), 11, y)) : (u(), a("span", {
26
- key: 3,
27
- class: l(r(e))
28
- }, p(e.text), 3))], 64))), 128));
29
- }
30
- }), x = ["aria-label"], S = { class: "pk-word-preview__head" }, C = { class: "pk-word-preview__name" }, w = {
31
- key: 0,
32
- class: "pk-word-preview__title"
33
- }, T = { class: "text-12 text-word-3" }, E = {
34
- key: 0,
35
- class: "pk-word-preview__legend"
36
- }, D = { class: "pk-word-preview__removed" }, O = { class: "pk-word-preview__added" }, k = { class: "pk-word-preview__scroll" }, A = {
37
- key: 0,
38
- class: "pk-word-preview__page vv-skeleton"
39
- }, j = {
40
- key: 1,
41
- class: "pk-word-preview__error"
42
- }, M = {
43
- key: 2,
44
- class: "pk-word-preview__page"
45
- }, N = {
46
- key: 0,
47
- class: "pk-word-preview__table"
48
- }, P = ["colspan"], F = {
49
- key: 0,
50
- class: "pk-word-preview__label"
51
- }, I = {
52
- key: 0,
53
- class: "pk-word-preview__truncated"
54
- }, L = /* @__PURE__ */ c({
55
- __name: "PkWordPreview",
56
- props: {
57
- filename: {},
58
- version: {},
59
- downloadUrl: {},
60
- preview: {},
61
- loading: { type: Boolean },
62
- error: { type: Boolean },
63
- closable: { type: Boolean }
64
- },
65
- emits: ["close"],
66
- setup(c, { emit: _ }) {
67
- let v = c, y = _, { t: L } = g({ useScope: "global" }), R = n(() => v.version ? L("chatFilePreview.versionUnpaged", { version: v.version }) : L("chatFilePreview.unpaged")), z = n(() => (v.preview?.revisionAuthors ?? []).join(", "));
68
- return (n, g) => {
69
- let _ = e;
70
- return u(), a("section", {
71
- class: "pk-word-preview",
72
- "aria-label": c.filename
73
- }, [
74
- o("header", S, [
75
- o("div", C, [c.closable ? (u(), a("strong", w, p(c.filename), 1)) : i("", !0), o("span", T, p(R.value), 1)]),
76
- s(_, {
77
- href: c.downloadUrl,
78
- download: "",
79
- modifiers: "secondary",
80
- icon: "ri:download-line",
81
- label: m(L)("chatFilePreview.download")
82
- }, null, 8, ["href", "label"]),
83
- c.closable ? (u(), r(_, {
84
- key: 0,
85
- modifiers: "action-quiet",
86
- icon: "ri:close-line",
87
- "aria-label": m(L)("chatFilePreview.close"),
88
- onClick: g[0] ||= (e) => y("close")
89
- }, null, 8, ["aria-label"])) : i("", !0)
90
- ]),
91
- c.preview?.revisionAuthors.length ? (u(), a("p", E, [
92
- o("span", null, p(m(L)("chatFilePreview.revisionsOf", { authors: z.value })), 1),
93
- o("del", D, p(m(L)("chatFilePreview.removed")), 1),
94
- o("ins", O, p(m(L)("chatFilePreview.added")), 1)
95
- ])) : i("", !0),
96
- o("div", k, [c.loading ? (u(), a("div", A, [(u(), a(t, null, d(8, (e) => o("div", {
97
- key: e,
98
- class: l(["vv-skeleton__item pk-word-preview__skeleton", e % 3 ? "w-full" : "w-128"])
99
- }, null, 2)), 64))])) : c.error || !c.preview ? (u(), a("p", j, p(m(L)("chatFilePreview.unavailable")), 1)) : (u(), a("article", M, [(u(!0), a(t, null, d(c.preview.blocks, (e, n) => (u(), a(t, { key: n }, [e.kind === "table" ? (u(), a("table", N, [o("tbody", null, [(u(!0), a(t, null, d(e.rows, (e, n) => (u(), a("tr", { key: n }, [(u(!0), a(t, null, d(e, (e, t) => (u(), a("td", {
100
- key: t,
101
- colspan: e.span
102
- }, [s(b, { runs: e.runs }, null, 8, ["runs"])], 8, P))), 128))]))), 128))])])) : (u(), r(f(e.kind === "heading" ? "h3" : "p"), {
103
- key: 1,
104
- class: l(["pk-word-preview__block", e.kind === "heading" ? `pk-word-preview__heading pk-word-preview__heading--${Math.min(e.level, 3)}` : void 0])
105
- }, {
106
- default: h(() => [e.label ? (u(), a("span", F, p(e.label), 1)) : i("", !0), s(b, { runs: e.runs }, null, 8, ["runs"])]),
107
- _: 2
108
- }, 1032, ["class"]))], 64))), 128)), c.preview.truncated ? (u(), a("p", I, p(m(L)("chatFilePreview.truncated")), 1)) : i("", !0)]))])
109
- ], 8, x);
110
- };
111
- }
112
- });
113
- export { L as default };
114
-
115
- //# sourceMappingURL=PkWordPreview-azW8wfJe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PkWordPreview-azW8wfJe.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createElementBlock","_Fragment","_renderList","_toDisplayString","_unref","_normalizeClass","_sfc_main","__unplugin_components_0","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_createCommentVNode","_createVNode","_unref","_createBlock","_Fragment","_renderList","_normalizeClass","PkWordPreviewRuns","_resolveDynamicComponent","_withCtx","_sfc_main","VvButtonLocalized","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","PkWordPreviewRuns_default","defineComponent","$t","useI18n","formatOf","run","titleOf","openBlock","createElementBlock","Fragment","renderList","__props","k","toDisplayString","unref","normalizeClass","_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","PkWordPreview_default","__emit","props","emit","subtitle","computed","authors","_component_VvButton","createElementVNode","createCommentVNode","createVNode","createBlock","_cache","i","b","block","r","row","c","cell","resolveDynamicComponent","withCtx"],"sources":["../../../../packages/components/src/chat/PkWordPreviewRuns.vue","../../../../packages/components/src/chat/PkWordPreviewRuns.vue","../../../../packages/components/src/chat/PkWordPreview.vue","../../../../packages/components/src/chat/PkWordPreview.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { useI18n } from 'vue-i18n'\n import type { WordPreviewRun } from 'models'\n\n /**\n * The runs of a paragraph or a cell of a Word preview, as text: a tracked\n * change struck where words went and underlined where they came, its\n * author said on hover, an image as a placeholder.\n */\n defineProps<{ runs: WordPreviewRun[] }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n /** The classes of a run's own formatting. */\n const formatOf = (run: WordPreviewRun) => ({\n 'font-semibold': run.bold,\n italic: run.italic,\n 'pk-word-preview__underline': run.underline,\n })\n\n const titleOf = (run: WordPreviewRun) =>\n run.author\n ? $t('chatFilePreview.revisionBy', { author: run.author })\n : undefined\n</script>\n\n<template>\n <!-- Each text sits against its tags: the block keeps whitespace\n (pre-wrap), so a line break inside a tag would draw a space in the\n middle of a word split across runs. -->\n <template v-for=\"(run, k) in runs\" :key=\"k\">\n <span v-if=\"run.image\" class=\"pk-word-preview__image\">{{\n $t('chatFilePreview.image')\n }}</span>\n <del\n v-else-if=\"run.change === 'deleted'\"\n class=\"pk-word-preview__removed\"\n :class=\"formatOf(run)\"\n :title=\"titleOf(run)\"\n >{{ run.text }}</del\n >\n <ins\n v-else-if=\"run.change === 'inserted'\"\n class=\"pk-word-preview__added\"\n :class=\"formatOf(run)\"\n :title=\"titleOf(run)\"\n >{{ run.text }}</ins\n >\n <span v-else :class=\"formatOf(run)\">{{ run.text }}</span>\n </template>\n</template>\n","<script setup lang=\"ts\">\n import { useI18n } from 'vue-i18n'\n import type { WordPreviewRun } from 'models'\n\n /**\n * The runs of a paragraph or a cell of a Word preview, as text: a tracked\n * change struck where words went and underlined where they came, its\n * author said on hover, an image as a placeholder.\n */\n defineProps<{ runs: WordPreviewRun[] }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n /** The classes of a run's own formatting. */\n const formatOf = (run: WordPreviewRun) => ({\n 'font-semibold': run.bold,\n italic: run.italic,\n 'pk-word-preview__underline': run.underline,\n })\n\n const titleOf = (run: WordPreviewRun) =>\n run.author\n ? $t('chatFilePreview.revisionBy', { author: run.author })\n : undefined\n</script>\n\n<template>\n <!-- Each text sits against its tags: the block keeps whitespace\n (pre-wrap), so a line break inside a tag would draw a space in the\n middle of a word split across runs. -->\n <template v-for=\"(run, k) in runs\" :key=\"k\">\n <span v-if=\"run.image\" class=\"pk-word-preview__image\">{{\n $t('chatFilePreview.image')\n }}</span>\n <del\n v-else-if=\"run.change === 'deleted'\"\n class=\"pk-word-preview__removed\"\n :class=\"formatOf(run)\"\n :title=\"titleOf(run)\"\n >{{ run.text }}</del\n >\n <ins\n v-else-if=\"run.change === 'inserted'\"\n class=\"pk-word-preview__added\"\n :class=\"formatOf(run)\"\n :title=\"titleOf(run)\"\n >{{ run.text }}</ins\n >\n <span v-else :class=\"formatOf(run)\">{{ run.text }}</span>\n </template>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import type { WordPreview } from 'models'\n import PkWordPreviewRuns from './PkWordPreviewRuns.vue'\n\n /**\n * The preview of a Word document stored in the chat (spec\n * `chat-office-files.md`, F6, item 3): the blocks the server read from\n * the document, drawn as text, never as HTML. Tracked changes not\n * accepted yet carry the marks of the card of an edit, struck where words\n * went and underlined where they came. Not paginated: no pages, images\n * as placeholders. The same content goes in a dialog (its title and close\n * are the dialog's) and in the panel beside the chat (`closable`).\n */\n const props = defineProps<{\n filename: string\n version?: number\n /** The authenticated download URL of the same version. */\n downloadUrl: string\n preview?: WordPreview\n loading?: boolean\n error?: boolean\n /** Draws its own title and close button, for the panel. */\n closable?: boolean\n }>()\n\n const emit = defineEmits<{ close: [] }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const subtitle = computed(() =>\n props.version\n ? $t('chatFilePreview.versionUnpaged', { version: props.version })\n : $t('chatFilePreview.unpaged'),\n )\n\n const authors = computed(() =>\n (props.preview?.revisionAuthors ?? []).join(', '),\n )\n</script>\n\n<template>\n <section class=\"pk-word-preview\" :aria-label=\"filename\">\n <header class=\"pk-word-preview__head\">\n <div class=\"pk-word-preview__name\">\n <strong v-if=\"closable\" class=\"pk-word-preview__title\">\n {{ filename }}\n </strong>\n <span class=\"text-12 text-word-3\">{{ subtitle }}</span>\n </div>\n <VvButton\n :href=\"downloadUrl\"\n download\n modifiers=\"secondary\"\n icon=\"ri:download-line\"\n :label=\"$t('chatFilePreview.download')\" />\n <VvButton\n v-if=\"closable\"\n modifiers=\"action-quiet\"\n icon=\"ri:close-line\"\n :aria-label=\"$t('chatFilePreview.close')\"\n @click=\"emit('close')\" />\n </header>\n <p\n v-if=\"preview?.revisionAuthors.length\"\n class=\"pk-word-preview__legend\">\n <span>\n {{ $t('chatFilePreview.revisionsOf', { authors }) }}\n </span>\n <del class=\"pk-word-preview__removed\">\n {{ $t('chatFilePreview.removed') }}\n </del>\n <ins class=\"pk-word-preview__added\">\n {{ $t('chatFilePreview.added') }}\n </ins>\n </p>\n <div class=\"pk-word-preview__scroll\">\n <div v-if=\"loading\" class=\"pk-word-preview__page vv-skeleton\">\n <div\n v-for=\"i in 8\"\n :key=\"i\"\n class=\"vv-skeleton__item pk-word-preview__skeleton\"\n :class=\"i % 3 ? 'w-full' : 'w-128'\" />\n </div>\n <p v-else-if=\"error || !preview\" class=\"pk-word-preview__error\">\n {{ $t('chatFilePreview.unavailable') }}\n </p>\n <article v-else class=\"pk-word-preview__page\">\n <template v-for=\"(block, b) in preview.blocks\" :key=\"b\">\n <table\n v-if=\"block.kind === 'table'\"\n class=\"pk-word-preview__table\">\n <tbody>\n <tr v-for=\"(row, r) in block.rows\" :key=\"r\">\n <td\n v-for=\"(cell, c) in row\"\n :key=\"c\"\n :colspan=\"cell.span\">\n <PkWordPreviewRuns :runs=\"cell.runs\" />\n </td>\n </tr>\n </tbody>\n </table>\n <component\n :is=\"block.kind === 'heading' ? 'h3' : 'p'\"\n v-else\n class=\"pk-word-preview__block\"\n :class=\"\n block.kind === 'heading'\n ? `pk-word-preview__heading pk-word-preview__heading--${Math.min(block.level, 3)}`\n : undefined\n \">\n <span\n v-if=\"block.label\"\n class=\"pk-word-preview__label\"\n >{{ block.label }}</span\n >\n <PkWordPreviewRuns :runs=\"block.runs\" />\n </component>\n </template>\n <p v-if=\"preview.truncated\" class=\"pk-word-preview__truncated\">\n {{ $t('chatFilePreview.truncated') }}\n </p>\n </article>\n </div>\n </section>\n</template>\n\n<style lang=\"scss\">\n .pk-word-preview {\n display: flex;\n flex-direction: column;\n min-height: 0;\n height: 100%;\n background-color: var(--color-surface);\n color: var(--color-word-1);\n\n &__head {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-12) var(--spacing-md);\n border-bottom: var(--border) solid var(--color-surface-3);\n }\n\n &__name {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n }\n\n &__title {\n overflow: hidden;\n font-size: var(--text-14);\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &__legend {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-4) var(--spacing-12);\n margin: 0;\n padding: var(--spacing-8) var(--spacing-md);\n border-bottom: var(--border) solid var(--color-surface-2);\n color: var(--color-word-2);\n font-size: var(--text-12);\n }\n\n // The page scrolls inside, so the head and the legend stay in view\n &__scroll {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: var(--spacing-md);\n background-color: var(--color-surface-1);\n }\n\n // A sheet of reading width, as Word shows a page, without the pages\n &__page {\n max-width: 42rem;\n margin-inline: auto;\n padding: var(--spacing-lg);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface);\n font-size: var(--text-14);\n line-height: 1.6;\n overflow-wrap: anywhere;\n }\n\n &__block {\n margin: 0 0 var(--spacing-8);\n\n // A tab or a line break of the document stays where Word put it\n white-space: pre-wrap;\n }\n\n &__heading {\n margin-top: var(--spacing-md);\n font-weight: var(--font-semibold);\n\n &--0 {\n font-size: var(--text-20);\n text-align: center;\n }\n\n &--1 {\n font-size: var(--text-18);\n }\n\n &--2 {\n font-size: var(--text-16);\n }\n\n &--3 {\n font-size: var(--text-14);\n }\n }\n\n &__label {\n margin-inline-end: var(--spacing-8);\n color: var(--color-word-3);\n }\n\n &__table {\n width: 100%;\n margin: var(--spacing-8) 0 var(--spacing-md);\n border-collapse: collapse;\n font-size: var(--text-12);\n\n td {\n padding: var(--spacing-6) var(--spacing-8);\n border: var(--border) solid var(--color-surface-3);\n vertical-align: top;\n white-space: pre-wrap;\n }\n }\n\n &__underline {\n text-decoration: underline;\n }\n\n // The marks of the card of an edit (PkToolChatFile.vue): the change is\n // the verdict the preview shows, the exception of DESIGN.md principle 2.\n // The base styles take the line off `del`.\n &__removed {\n color: var(--u-danger-text);\n text-decoration: line-through;\n }\n\n &__added {\n color: var(--u-success-text);\n font-weight: var(--font-medium);\n text-decoration: underline;\n text-underline-offset: 0.2em;\n }\n\n // A word replaced: what went and what came, not run together\n &__removed + &__added {\n margin-inline-start: var(--spacing-4);\n }\n\n &__image {\n display: inline-block;\n padding: var(--spacing-2) var(--spacing-8);\n border: var(--border) dashed var(--color-surface-4);\n border-radius: var(--rounded);\n color: var(--color-word-3);\n font-size: var(--text-12);\n }\n\n &__truncated,\n &__error {\n margin: var(--spacing-md) 0 0;\n color: var(--color-word-3);\n font-size: var(--text-12);\n text-align: center;\n }\n\n &__skeleton {\n height: var(--spacing-12);\n margin-bottom: var(--spacing-12);\n border-radius: var(--rounded);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import type { WordPreview } from 'models'\n import PkWordPreviewRuns from './PkWordPreviewRuns.vue'\n\n /**\n * The preview of a Word document stored in the chat (spec\n * `chat-office-files.md`, F6, item 3): the blocks the server read from\n * the document, drawn as text, never as HTML. Tracked changes not\n * accepted yet carry the marks of the card of an edit, struck where words\n * went and underlined where they came. Not paginated: no pages, images\n * as placeholders. The same content goes in a dialog (its title and close\n * are the dialog's) and in the panel beside the chat (`closable`).\n */\n const props = defineProps<{\n filename: string\n version?: number\n /** The authenticated download URL of the same version. */\n downloadUrl: string\n preview?: WordPreview\n loading?: boolean\n error?: boolean\n /** Draws its own title and close button, for the panel. */\n closable?: boolean\n }>()\n\n const emit = defineEmits<{ close: [] }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const subtitle = computed(() =>\n props.version\n ? $t('chatFilePreview.versionUnpaged', { version: props.version })\n : $t('chatFilePreview.unpaged'),\n )\n\n const authors = computed(() =>\n (props.preview?.revisionAuthors ?? []).join(', '),\n )\n</script>\n\n<template>\n <section class=\"pk-word-preview\" :aria-label=\"filename\">\n <header class=\"pk-word-preview__head\">\n <div class=\"pk-word-preview__name\">\n <strong v-if=\"closable\" class=\"pk-word-preview__title\">\n {{ filename }}\n </strong>\n <span class=\"text-12 text-word-3\">{{ subtitle }}</span>\n </div>\n <VvButton\n :href=\"downloadUrl\"\n download\n modifiers=\"secondary\"\n icon=\"ri:download-line\"\n :label=\"$t('chatFilePreview.download')\" />\n <VvButton\n v-if=\"closable\"\n modifiers=\"action-quiet\"\n icon=\"ri:close-line\"\n :aria-label=\"$t('chatFilePreview.close')\"\n @click=\"emit('close')\" />\n </header>\n <p\n v-if=\"preview?.revisionAuthors.length\"\n class=\"pk-word-preview__legend\">\n <span>\n {{ $t('chatFilePreview.revisionsOf', { authors }) }}\n </span>\n <del class=\"pk-word-preview__removed\">\n {{ $t('chatFilePreview.removed') }}\n </del>\n <ins class=\"pk-word-preview__added\">\n {{ $t('chatFilePreview.added') }}\n </ins>\n </p>\n <div class=\"pk-word-preview__scroll\">\n <div v-if=\"loading\" class=\"pk-word-preview__page vv-skeleton\">\n <div\n v-for=\"i in 8\"\n :key=\"i\"\n class=\"vv-skeleton__item pk-word-preview__skeleton\"\n :class=\"i % 3 ? 'w-full' : 'w-128'\" />\n </div>\n <p v-else-if=\"error || !preview\" class=\"pk-word-preview__error\">\n {{ $t('chatFilePreview.unavailable') }}\n </p>\n <article v-else class=\"pk-word-preview__page\">\n <template v-for=\"(block, b) in preview.blocks\" :key=\"b\">\n <table\n v-if=\"block.kind === 'table'\"\n class=\"pk-word-preview__table\">\n <tbody>\n <tr v-for=\"(row, r) in block.rows\" :key=\"r\">\n <td\n v-for=\"(cell, c) in row\"\n :key=\"c\"\n :colspan=\"cell.span\">\n <PkWordPreviewRuns :runs=\"cell.runs\" />\n </td>\n </tr>\n </tbody>\n </table>\n <component\n :is=\"block.kind === 'heading' ? 'h3' : 'p'\"\n v-else\n class=\"pk-word-preview__block\"\n :class=\"\n block.kind === 'heading'\n ? `pk-word-preview__heading pk-word-preview__heading--${Math.min(block.level, 3)}`\n : undefined\n \">\n <span\n v-if=\"block.label\"\n class=\"pk-word-preview__label\"\n >{{ block.label }}</span\n >\n <PkWordPreviewRuns :runs=\"block.runs\" />\n </component>\n </template>\n <p v-if=\"preview.truncated\" class=\"pk-word-preview__truncated\">\n {{ $t('chatFilePreview.truncated') }}\n </p>\n </article>\n </div>\n </section>\n</template>\n\n<style lang=\"scss\">\n .pk-word-preview {\n display: flex;\n flex-direction: column;\n min-height: 0;\n height: 100%;\n background-color: var(--color-surface);\n color: var(--color-word-1);\n\n &__head {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-12) var(--spacing-md);\n border-bottom: var(--border) solid var(--color-surface-3);\n }\n\n &__name {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-width: 0;\n }\n\n &__title {\n overflow: hidden;\n font-size: var(--text-14);\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &__legend {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-4) var(--spacing-12);\n margin: 0;\n padding: var(--spacing-8) var(--spacing-md);\n border-bottom: var(--border) solid var(--color-surface-2);\n color: var(--color-word-2);\n font-size: var(--text-12);\n }\n\n // The page scrolls inside, so the head and the legend stay in view\n &__scroll {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: var(--spacing-md);\n background-color: var(--color-surface-1);\n }\n\n // A sheet of reading width, as Word shows a page, without the pages\n &__page {\n max-width: 42rem;\n margin-inline: auto;\n padding: var(--spacing-lg);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface);\n font-size: var(--text-14);\n line-height: 1.6;\n overflow-wrap: anywhere;\n }\n\n &__block {\n margin: 0 0 var(--spacing-8);\n\n // A tab or a line break of the document stays where Word put it\n white-space: pre-wrap;\n }\n\n &__heading {\n margin-top: var(--spacing-md);\n font-weight: var(--font-semibold);\n\n &--0 {\n font-size: var(--text-20);\n text-align: center;\n }\n\n &--1 {\n font-size: var(--text-18);\n }\n\n &--2 {\n font-size: var(--text-16);\n }\n\n &--3 {\n font-size: var(--text-14);\n }\n }\n\n &__label {\n margin-inline-end: var(--spacing-8);\n color: var(--color-word-3);\n }\n\n &__table {\n width: 100%;\n margin: var(--spacing-8) 0 var(--spacing-md);\n border-collapse: collapse;\n font-size: var(--text-12);\n\n td {\n padding: var(--spacing-6) var(--spacing-8);\n border: var(--border) solid var(--color-surface-3);\n vertical-align: top;\n white-space: pre-wrap;\n }\n }\n\n &__underline {\n text-decoration: underline;\n }\n\n // The marks of the card of an edit (PkToolChatFile.vue): the change is\n // the verdict the preview shows, the exception of DESIGN.md principle 2.\n // The base styles take the line off `del`.\n &__removed {\n color: var(--u-danger-text);\n text-decoration: line-through;\n }\n\n &__added {\n color: var(--u-success-text);\n font-weight: var(--font-medium);\n text-decoration: underline;\n text-underline-offset: 0.2em;\n }\n\n // A word replaced: what went and what came, not run together\n &__removed + &__added {\n margin-inline-start: var(--spacing-4);\n }\n\n &__image {\n display: inline-block;\n padding: var(--spacing-2) var(--spacing-8);\n border: var(--border) dashed var(--color-surface-4);\n border-radius: var(--rounded);\n color: var(--color-word-3);\n font-size: var(--text-12);\n }\n\n &__truncated,\n &__error {\n margin: var(--spacing-md) 0 0;\n color: var(--color-word-3);\n font-size: var(--text-12);\n text-align: center;\n }\n\n &__skeleton {\n height: var(--spacing-12);\n margin-bottom: var(--spacing-12);\n border-radius: var(--rounded);\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;EAWI,IAAM,EAAE,GAAGiC,MAAOC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAG1CC,KAAY,OAAyB;GACvC,iBAAiBC,EAAI;GACrB,QAAQA,EAAI;GACZ,8BAA8BA,EAAI;EACtC,IAEMC,KAAW,MACbD,EAAI,SACEH,EAAG,8BAA8B,EAAE,QAAQG,EAAI,OAAO,CAAC,IACvD,KAAA;E,kBAOVjC,EAAA,EAAA,GAAAC,EAmBWC,GAAA,MAAAC,EAnBkBoC,EAAA,OAAX,GAAK,OAAkBvC,EAAA,GAAAC,EAAAC,GAAA,EAAA,KAAAsC,EAAC,GAAA,CAC1BP,EAAI,SAAhBjC,EAAA,GAAAC,EAES,QAFTJ,GAESO,EADLC,EAAAyB,CAAA,CAAE,CAAA,uBAAA,CAAA,GAAA,CAAA,KAGSG,EAAI,WAAM,aADzBjC,EAAA,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