@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.
- package/dist/_chunks/PkFilePreview-eKok4xdc.js +211 -0
- package/dist/_chunks/PkFilePreview-eKok4xdc.js.map +1 -0
- package/dist/_chunks/PkStreamingMarkdown-Dc0R0GHe.js.map +1 -1
- package/dist/_chunks/PkToolChatFile-3fYhbFSi.js +222 -0
- package/dist/_chunks/PkToolChatFile-3fYhbFSi.js.map +1 -0
- package/dist/ai-elements.es.js +99 -27
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-CxbPkjhQ.js → PkChatbot-D3KGDerg.js} +6 -6
- package/dist-vue/_chunks/{PkChatbot-CxbPkjhQ.js.map → PkChatbot-D3KGDerg.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-gcim5jsW.js → PkChatbotViewChat-BNaSv86u.js} +373 -329
- package/dist-vue/_chunks/PkChatbotViewChat-BNaSv86u.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-ZdDraX9c.js → PkChatbotViewConversations-C1vl8z4o.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-ZdDraX9c.js.map → PkChatbotViewConversations-C1vl8z4o.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-BqZ3CJm5.js → PkChatbotViewFiles-DiKHsdPE.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-BqZ3CJm5.js.map → PkChatbotViewFiles-DiKHsdPE.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-CANtq-SY.js → PkChatbotViewProfile-CuQ0MAX7.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-CANtq-SY.js.map → PkChatbotViewProfile-CuQ0MAX7.js.map} +1 -1
- package/dist-vue/_chunks/PkFilePreview-Cx6jmJCD.js +200 -0
- package/dist-vue/_chunks/PkFilePreview-Cx6jmJCD.js.map +1 -0
- package/dist-vue/_chunks/PkToolChatFile-BJsDSu1Q.js +220 -0
- package/dist-vue/_chunks/PkToolChatFile-BJsDSu1Q.js.map +1 -0
- package/dist-vue/_chunks/{createChatbotApiClient-Cu1nDV3E.js → createChatbotApiClient-DAh91HyT.js} +2 -2
- package/dist-vue/_chunks/{createChatbotApiClient-Cu1nDV3E.js.map → createChatbotApiClient-DAh91HyT.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-CPl6KHny.js → useChatbotStore-D1U24qc8.js} +2 -2
- package/dist-vue/_chunks/{useChatbotStore-CPl6KHny.js.map → useChatbotStore-D1U24qc8.js.map} +1 -1
- package/dist-vue/_chunks/utils-DaAIWTtt.js.map +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +30 -2
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +6 -6
- package/dist-vue/locales.js +32 -4
- package/dist-vue/packages/components/src/chat/PkFilePreview.d.ts +28 -0
- package/dist-vue/packages/components/src/chat/PkSpreadsheetPreview.d.ts +15 -0
- package/dist-vue/packages/components/src/chat/PkToolChatFile.d.ts +11 -1
- package/dist-vue/packages/components/src/chat/PkWordPreview.d.ts +5 -18
- package/dist-vue/packages/components/src/chat/utils.d.ts +2 -1
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +3 -3
- package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +137 -0
- package/dist-vue/packages/models/src/schema/WordPreview.d.ts +1 -0
- package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkToolChatFile-CScP_O0D.js +0 -193
- package/dist/_chunks/PkToolChatFile-CScP_O0D.js.map +0 -1
- package/dist/_chunks/PkWordPreview-COVeYzqX.js +0 -120
- package/dist/_chunks/PkWordPreview-COVeYzqX.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-gcim5jsW.js.map +0 -1
- package/dist-vue/_chunks/PkToolChatFile-iOyeQBp6.js +0 -191
- package/dist-vue/_chunks/PkToolChatFile-iOyeQBp6.js.map +0 -1
- package/dist-vue/_chunks/PkWordPreview-azW8wfJe.js +0 -115
- package/dist-vue/_chunks/PkWordPreview-azW8wfJe.js.map +0 -1
|
@@ -0,0 +1,200 @@
|
|
|
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, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, openBlock as d, ref as f, renderList as p, resolveDynamicComponent as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
|
|
3
|
+
import { useI18n as v } from "vue-i18n";
|
|
4
|
+
// ../../packages/components/src/chat/PkSpreadsheetPreview.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var y = { class: "pk-spreadsheet-preview" }, b = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "pk-spreadsheet-preview__sheets",
|
|
8
|
+
role: "tablist"
|
|
9
|
+
}, x = ["aria-selected", "onClick"], S = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "pk-spreadsheet-preview__note"
|
|
12
|
+
}, C = {
|
|
13
|
+
key: 2,
|
|
14
|
+
class: "pk-spreadsheet-preview__frame",
|
|
15
|
+
role: "tabpanel"
|
|
16
|
+
}, w = { class: "pk-spreadsheet-preview__table" }, T = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "pk-spreadsheet-preview__note"
|
|
19
|
+
}, E = {
|
|
20
|
+
key: 3,
|
|
21
|
+
class: "pk-spreadsheet-preview__note"
|
|
22
|
+
}, D = /* @__PURE__ */ l({
|
|
23
|
+
__name: "PkSpreadsheetPreview",
|
|
24
|
+
props: { preview: {} },
|
|
25
|
+
setup(e) {
|
|
26
|
+
let c = e, { t: l, locale: D } = v({ useScope: "global" }), O = f(0), k = n(() => c.preview.sheets[O.value] ?? c.preview.sheets[0]), A = n(() => Math.max(0, ...k.value?.rows.map((e) => e.length) ?? [0])), j = (e) => {
|
|
27
|
+
if (e.missing) return "—";
|
|
28
|
+
let t = e.value;
|
|
29
|
+
if (t === void 0) return "";
|
|
30
|
+
if (typeof t == "boolean") return l(t ? "chatFilePreview.true" : "chatFilePreview.false");
|
|
31
|
+
if (e.format === "date" && typeof t == "string") {
|
|
32
|
+
let e = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
|
|
33
|
+
return Number.isNaN(e.getTime()) ? t : new Intl.DateTimeFormat(D.value, {
|
|
34
|
+
dateStyle: "short",
|
|
35
|
+
timeZone: "UTC"
|
|
36
|
+
}).format(e);
|
|
37
|
+
}
|
|
38
|
+
if (typeof t == "number") {
|
|
39
|
+
let n = e.decimals === void 0 ? { maximumFractionDigits: 10 } : {
|
|
40
|
+
minimumFractionDigits: e.decimals,
|
|
41
|
+
maximumFractionDigits: e.maxDecimals ?? e.decimals
|
|
42
|
+
};
|
|
43
|
+
return new Intl.NumberFormat(D.value, {
|
|
44
|
+
...n,
|
|
45
|
+
...e.format === "percent" ? { style: "percent" } : {},
|
|
46
|
+
...e.format === "currency" && e.currency ? {
|
|
47
|
+
style: "currency",
|
|
48
|
+
currency: e.currency
|
|
49
|
+
} : {}
|
|
50
|
+
}).format(t);
|
|
51
|
+
}
|
|
52
|
+
return t;
|
|
53
|
+
}, M = (e) => typeof e.value == "number" || e.missing;
|
|
54
|
+
return (n, c) => (d(), a("div", y, [
|
|
55
|
+
e.preview.sheets.length > 1 ? (d(), a("div", b, [(d(!0), a(t, null, p(e.preview.sheets, (e, t) => (d(), a("button", {
|
|
56
|
+
key: e.name,
|
|
57
|
+
type: "button",
|
|
58
|
+
role: "tab",
|
|
59
|
+
class: "pk-spreadsheet-preview__sheet",
|
|
60
|
+
"aria-selected": t === O.value,
|
|
61
|
+
onClick: (e) => O.value = t
|
|
62
|
+
}, h(e.name), 9, x))), 128))])) : i("", !0),
|
|
63
|
+
e.preview.staleFormulas ? (d(), a("p", S, h(g(l)("chatFilePreview.staleFormulas")), 1)) : i("", !0),
|
|
64
|
+
k.value ? (d(), a("div", C, [o("table", w, [o("tbody", null, [(d(!0), a(t, null, p(k.value.rows, (e, n) => (d(), a("tr", { key: n }, [(d(!0), a(t, null, p(A.value, (t) => (d(), r(m(k.value.header && n === 0 ? "th" : "td"), {
|
|
65
|
+
key: t,
|
|
66
|
+
scope: k.value.header && n === 0 ? "col" : void 0,
|
|
67
|
+
class: u({
|
|
68
|
+
"pk-spreadsheet-preview__number": e[t - 1] && M(e[t - 1]),
|
|
69
|
+
"pk-spreadsheet-preview__error": e[t - 1]?.format === "error"
|
|
70
|
+
}),
|
|
71
|
+
title: e[t - 1]?.missing ? g(l)("chatFilePreview.missingValue") : void 0
|
|
72
|
+
}, {
|
|
73
|
+
default: _(() => [s(h(e[t - 1] ? j(e[t - 1]) : ""), 1)]),
|
|
74
|
+
_: 2
|
|
75
|
+
}, 1032, [
|
|
76
|
+
"scope",
|
|
77
|
+
"class",
|
|
78
|
+
"title"
|
|
79
|
+
]))), 128))]))), 128))])]), k.value.rows.length ? i("", !0) : (d(), a("p", T, h(g(l)("chatFilePreview.emptySheet")), 1))])) : i("", !0),
|
|
80
|
+
k.value && (k.value.moreRows || k.value.moreColumns) ? (d(), a("p", E, [k.value.moreRows ? (d(), a(t, { key: 0 }, [s(h(g(l)("chatFilePreview.moreRows", k.value.moreRows)), 1)], 64)) : i("", !0), k.value.moreColumns ? (d(), a(t, { key: 1 }, [s(h(g(l)("chatFilePreview.moreColumns", k.value.moreColumns)), 1)], 64)) : i("", !0)])) : i("", !0)
|
|
81
|
+
]));
|
|
82
|
+
}
|
|
83
|
+
}), O = {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: "pk-word-preview__image"
|
|
86
|
+
}, k = ["title"], A = ["title"], j = /* @__PURE__ */ l({
|
|
87
|
+
__name: "PkWordPreviewRuns",
|
|
88
|
+
props: { runs: {} },
|
|
89
|
+
setup(e) {
|
|
90
|
+
let { t: n } = v({ useScope: "global" }), r = (e) => ({
|
|
91
|
+
"font-semibold": e.bold,
|
|
92
|
+
italic: e.italic,
|
|
93
|
+
"pk-word-preview__underline": e.underline
|
|
94
|
+
}), i = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
|
|
95
|
+
return (o, s) => (d(!0), a(t, null, p(e.runs, (e, o) => (d(), a(t, { key: o }, [e.image ? (d(), a("span", O, h(g(n)("chatFilePreview.image")), 1)) : e.change === "deleted" ? (d(), a("del", {
|
|
96
|
+
key: 1,
|
|
97
|
+
class: u(["pk-word-preview__removed", r(e)]),
|
|
98
|
+
title: i(e)
|
|
99
|
+
}, h(e.text), 11, k)) : e.change === "inserted" ? (d(), a("ins", {
|
|
100
|
+
key: 2,
|
|
101
|
+
class: u(["pk-word-preview__added", r(e)]),
|
|
102
|
+
title: i(e)
|
|
103
|
+
}, h(e.text), 11, A)) : (d(), a("span", {
|
|
104
|
+
key: 3,
|
|
105
|
+
class: u(r(e))
|
|
106
|
+
}, h(e.text), 3))], 64))), 128));
|
|
107
|
+
}
|
|
108
|
+
}), M = { class: "pk-word-preview" }, N = {
|
|
109
|
+
key: 0,
|
|
110
|
+
class: "pk-word-preview__legend"
|
|
111
|
+
}, P = { class: "pk-word-preview__removed" }, F = { class: "pk-word-preview__added" }, I = { class: "pk-word-preview__page" }, L = {
|
|
112
|
+
key: 0,
|
|
113
|
+
class: "pk-word-preview__table"
|
|
114
|
+
}, R = ["colspan"], z = {
|
|
115
|
+
key: 0,
|
|
116
|
+
class: "pk-word-preview__label"
|
|
117
|
+
}, B = {
|
|
118
|
+
key: 0,
|
|
119
|
+
class: "pk-word-preview__truncated"
|
|
120
|
+
}, V = /* @__PURE__ */ l({
|
|
121
|
+
__name: "PkWordPreview",
|
|
122
|
+
props: { preview: {} },
|
|
123
|
+
setup(e) {
|
|
124
|
+
let s = e, l = n(() => s.preview.revisionAuthors.join(", "));
|
|
125
|
+
return (n, s) => (d(), a("div", M, [e.preview.revisionAuthors.length ? (d(), a("p", N, [
|
|
126
|
+
o("span", null, h(n.$t("chatFilePreview.revisionsOf", { authors: l.value })), 1),
|
|
127
|
+
o("del", P, h(n.$t("chatFilePreview.removed")), 1),
|
|
128
|
+
o("ins", F, h(n.$t("chatFilePreview.added")), 1)
|
|
129
|
+
])) : i("", !0), o("article", I, [(d(!0), a(t, null, p(e.preview.blocks, (e, n) => (d(), a(t, { key: n }, [e.kind === "table" ? (d(), a("table", L, [o("tbody", null, [(d(!0), a(t, null, p(e.rows, (e, n) => (d(), a("tr", { key: n }, [(d(!0), a(t, null, p(e, (e, t) => (d(), a("td", {
|
|
130
|
+
key: t,
|
|
131
|
+
colspan: e.span
|
|
132
|
+
}, [c(j, { runs: e.runs }, null, 8, ["runs"])], 8, R))), 128))]))), 128))])])) : (d(), r(m(e.kind === "heading" ? "h3" : "p"), {
|
|
133
|
+
key: 1,
|
|
134
|
+
class: u(["pk-word-preview__block", e.kind === "heading" ? `pk-word-preview__heading pk-word-preview__heading--${Math.min(e.level, 3)}` : void 0])
|
|
135
|
+
}, {
|
|
136
|
+
default: _(() => [e.label ? (d(), a("span", z, h(e.label), 1)) : i("", !0), c(j, { runs: e.runs }, null, 8, ["runs"])]),
|
|
137
|
+
_: 2
|
|
138
|
+
}, 1032, ["class"]))], 64))), 128)), e.preview.truncated ? (d(), a("p", B, h(n.$t("chatFilePreview.truncated")), 1)) : i("", !0)])]));
|
|
139
|
+
}
|
|
140
|
+
}), H = ["aria-label"], U = { class: "pk-file-preview__head" }, W = { class: "pk-file-preview__name" }, G = {
|
|
141
|
+
key: 0,
|
|
142
|
+
class: "pk-file-preview__title"
|
|
143
|
+
}, K = { class: "text-12 text-word-3" }, q = { class: "pk-file-preview__scroll" }, J = {
|
|
144
|
+
key: 0,
|
|
145
|
+
class: "pk-file-preview__skeleton vv-skeleton"
|
|
146
|
+
}, Y = {
|
|
147
|
+
key: 1,
|
|
148
|
+
class: "pk-file-preview__note"
|
|
149
|
+
}, X = /* @__PURE__ */ l({
|
|
150
|
+
__name: "PkFilePreview",
|
|
151
|
+
props: {
|
|
152
|
+
kind: {},
|
|
153
|
+
filename: {},
|
|
154
|
+
version: {},
|
|
155
|
+
downloadUrl: {},
|
|
156
|
+
preview: {},
|
|
157
|
+
loading: { type: Boolean },
|
|
158
|
+
error: { type: Boolean },
|
|
159
|
+
closable: { type: Boolean }
|
|
160
|
+
},
|
|
161
|
+
emits: ["close"],
|
|
162
|
+
setup(s, { emit: l }) {
|
|
163
|
+
let f = s, m = l, { t: _ } = v({ useScope: "global" }), y = n(() => f.kind === "spreadsheet" ? f.version ? _("chatFilePreview.versionFirstRows", { version: f.version }) : _("chatFilePreview.firstRows") : f.version ? _("chatFilePreview.versionUnpaged", { version: f.version }) : _("chatFilePreview.unpaged"));
|
|
164
|
+
return (n, l) => {
|
|
165
|
+
let f = e;
|
|
166
|
+
return d(), a("section", {
|
|
167
|
+
class: "pk-file-preview",
|
|
168
|
+
"aria-label": s.filename
|
|
169
|
+
}, [o("header", U, [
|
|
170
|
+
o("div", W, [s.closable ? (d(), a("strong", G, h(s.filename), 1)) : i("", !0), o("span", K, h(y.value), 1)]),
|
|
171
|
+
c(f, {
|
|
172
|
+
href: s.downloadUrl,
|
|
173
|
+
download: "",
|
|
174
|
+
modifiers: "secondary",
|
|
175
|
+
icon: "ri:download-line",
|
|
176
|
+
label: g(_)("chatFilePreview.download")
|
|
177
|
+
}, null, 8, ["href", "label"]),
|
|
178
|
+
s.closable ? (d(), r(f, {
|
|
179
|
+
key: 0,
|
|
180
|
+
modifiers: "action-quiet",
|
|
181
|
+
icon: "ri:close-line",
|
|
182
|
+
"aria-label": g(_)("chatFilePreview.close"),
|
|
183
|
+
onClick: l[0] ||= (e) => m("close")
|
|
184
|
+
}, null, 8, ["aria-label"])) : i("", !0)
|
|
185
|
+
]), o("div", q, [s.loading ? (d(), a("div", J, [(d(), a(t, null, p(8, (e) => o("div", {
|
|
186
|
+
key: e,
|
|
187
|
+
class: u(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
|
|
188
|
+
}, null, 2)), 64))])) : s.error || !s.preview ? (d(), a("p", Y, h(g(_)("chatFilePreview.unavailable")), 1)) : s.preview.kind === "word" ? (d(), r(V, {
|
|
189
|
+
key: 2,
|
|
190
|
+
preview: s.preview
|
|
191
|
+
}, null, 8, ["preview"])) : (d(), r(D, {
|
|
192
|
+
key: 3,
|
|
193
|
+
preview: s.preview
|
|
194
|
+
}, null, 8, ["preview"]))])], 8, H);
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
export { X as default };
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=PkFilePreview-Cx6jmJCD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkFilePreview-Cx6jmJCD.js","names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_openBlock","_createElementBlock","_Fragment","_renderList","_toDisplayString","_createCommentVNode","_unref","_createElementVNode","_createBlock","_resolveDynamicComponent","_normalizeClass","_withCtx","_createTextVNode","_sfc_main","_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createElementBlock","_Fragment","_renderList","_toDisplayString","_unref","_normalizeClass","_sfc_main","$t","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_createCommentVNode","_Fragment","_renderList","_createVNode","PkWordPreviewRuns","_createBlock","_resolveDynamicComponent","_normalizeClass","_withCtx","_sfc_main","__unplugin_components_0","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_createCommentVNode","_createVNode","_unref","_createBlock","_Fragment","_renderList","_normalizeClass","PkWordPreview","PkSpreadsheetPreview","_sfc_main","VvButtonLocalized","_hoisted_1$3","_hoisted_2$3","_hoisted_3$3","_hoisted_4$2","_hoisted_5$2","_hoisted_6$2","_hoisted_7$2","_hoisted_8$2","PkSpreadsheetPreview_default","defineComponent","props","__props","$t","useI18n","active","ref","sheet","computed","columns","r","textOf","cell","v","date","locale","digits","isNumber","openBlock","createElementBlock","Fragment","renderList","s","i","toDisplayString","createCommentVNode","unref","createElementVNode","createBlock","resolveDynamicComponent","c","normalizeClass","row","withCtx","createTextVNode","_hoisted_1$2","_hoisted_2$2","_hoisted_3$2","PkWordPreviewRuns_default","formatOf","run","titleOf","k","_hoisted_1$1","_hoisted_2$1","_hoisted_3$1","_hoisted_4$1","_hoisted_5$1","_hoisted_6$1","_hoisted_7$1","_hoisted_8$1","_hoisted_9","PkWordPreview_default","authors","_ctx","b","block","createVNode","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","PkFilePreview_default","__emit","emit","subtitle","_component_VvButton","_cache"],"sources":["../../../../packages/components/src/chat/PkSpreadsheetPreview.vue","../../../../packages/components/src/chat/PkSpreadsheetPreview.vue","../../../../packages/components/src/chat/PkWordPreviewRuns.vue","../../../../packages/components/src/chat/PkWordPreviewRuns.vue","../../../../packages/components/src/chat/PkWordPreview.vue","../../../../packages/components/src/chat/PkWordPreview.vue","../../../../packages/components/src/chat/PkFilePreview.vue","../../../../packages/components/src/chat/PkFilePreview.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import type { SpreadsheetPreview, SpreadsheetPreviewCell } from 'models'\n\n /**\n * The content of the preview of a spreadsheet (spec\n * `chat-office-files.md`, F6, item 4): the first rows of each sheet, one\n * sheet at a time, its cells formatted in the reader's language as the\n * file's number formats ask. A formula whose result the file does not\n * hold yet shows a dash. Framed by `PkFilePreview`.\n */\n const props = defineProps<{ preview: SpreadsheetPreview }>()\n\n const { t: $t, locale } = useI18n({ useScope: 'global' })\n\n const active = ref(0)\n const sheet = computed(\n () => props.preview.sheets[active.value] ?? props.preview.sheets[0],\n )\n const columns = computed(() =>\n Math.max(0, ...(sheet.value?.rows.map((r) => r.length) ?? [0])),\n )\n\n /** The cell's text: a number in the reader's language, a date, a word. */\n const textOf = (cell: SpreadsheetPreviewCell): string => {\n if (cell.missing) {\n return '—'\n }\n const v = cell.value\n if (v === undefined) {\n return ''\n }\n if (typeof v === 'boolean') {\n return v ? $t('chatFilePreview.true') : $t('chatFilePreview.false')\n }\n if (cell.format === 'date' && typeof v === 'string') {\n const date = new Date(`${v}T00:00:00Z`)\n return Number.isNaN(date.getTime())\n ? v\n : new Intl.DateTimeFormat(locale.value, {\n dateStyle: 'short',\n timeZone: 'UTC',\n }).format(date)\n }\n if (typeof v === 'number') {\n const digits =\n cell.decimals !== undefined\n ? {\n minimumFractionDigits: cell.decimals,\n maximumFractionDigits:\n cell.maxDecimals ?? cell.decimals,\n }\n : { maximumFractionDigits: 10 }\n return new Intl.NumberFormat(locale.value, {\n ...digits,\n ...(cell.format === 'percent' ? { style: 'percent' } : {}),\n ...(cell.format === 'currency' && cell.currency\n ? { style: 'currency', currency: cell.currency }\n : {}),\n }).format(v)\n }\n return v\n }\n\n const isNumber = (cell: SpreadsheetPreviewCell) =>\n typeof cell.value === 'number' || cell.missing\n</script>\n\n<template>\n <div class=\"pk-spreadsheet-preview\">\n <div\n v-if=\"preview.sheets.length > 1\"\n class=\"pk-spreadsheet-preview__sheets\"\n role=\"tablist\">\n <button\n v-for=\"(s, i) in preview.sheets\"\n :key=\"s.name\"\n type=\"button\"\n role=\"tab\"\n class=\"pk-spreadsheet-preview__sheet\"\n :aria-selected=\"i === active\"\n @click=\"active = i\">\n {{ s.name }}\n </button>\n </div>\n <p v-if=\"preview.staleFormulas\" class=\"pk-spreadsheet-preview__note\">\n {{ $t('chatFilePreview.staleFormulas') }}\n </p>\n <div v-if=\"sheet\" class=\"pk-spreadsheet-preview__frame\" role=\"tabpanel\">\n <table class=\"pk-spreadsheet-preview__table\">\n <tbody>\n <tr v-for=\"(row, r) in sheet.rows\" :key=\"r\">\n <component\n :is=\"sheet.header && r === 0 ? 'th' : 'td'\"\n v-for=\"c in columns\"\n :key=\"c\"\n :scope=\"sheet.header && r === 0 ? 'col' : undefined\"\n :class=\"{\n 'pk-spreadsheet-preview__number':\n row[c - 1] && isNumber(row[c - 1]),\n 'pk-spreadsheet-preview__error':\n row[c - 1]?.format === 'error',\n }\"\n :title=\"\n row[c - 1]?.missing\n ? $t('chatFilePreview.missingValue')\n : undefined\n \">\n {{ row[c - 1] ? textOf(row[c - 1]) : '' }}\n </component>\n </tr>\n </tbody>\n </table>\n <p v-if=\"!sheet.rows.length\" class=\"pk-spreadsheet-preview__note\">\n {{ $t('chatFilePreview.emptySheet') }}\n </p>\n </div>\n <p\n v-if=\"sheet && (sheet.moreRows || sheet.moreColumns)\"\n class=\"pk-spreadsheet-preview__note\">\n <template v-if=\"sheet.moreRows\">\n {{ $t('chatFilePreview.moreRows', sheet.moreRows) }}\n </template>\n <template v-if=\"sheet.moreColumns\">\n {{ $t('chatFilePreview.moreColumns', sheet.moreColumns) }}\n </template>\n </p>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-spreadsheet-preview {\n // The sheets as Excel draws its tabs: a row of names, the open one\n // carried by surface and weight (DESIGN.md, principle 3)\n &__sheets {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-4);\n margin-bottom: var(--spacing-8);\n }\n\n &__sheet {\n padding: var(--spacing-4) var(--spacing-12);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface);\n color: var(--color-word-2);\n font: inherit;\n font-size: var(--text-12);\n cursor: pointer;\n\n &[aria-selected='true'] {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n font-weight: var(--font-semibold);\n }\n }\n\n // One frame, scrolling sideways when the sheet is wider than it\n &__frame {\n overflow-x: auto;\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface);\n }\n\n &__table {\n border-collapse: collapse;\n font-size: var(--text-12);\n\n th,\n td {\n max-width: 20rem;\n padding: var(--spacing-4) var(--spacing-8);\n border-right: var(--border) solid var(--color-surface-2);\n border-bottom: var(--border) solid var(--color-surface-2);\n text-align: start;\n vertical-align: top;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n\n th {\n background-color: var(--color-surface-1);\n font-weight: var(--font-semibold);\n }\n\n // Numbers line up on their last digit, as in Excel\n .pk-spreadsheet-preview__number {\n text-align: end;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n\n .pk-spreadsheet-preview__error {\n color: var(--color-word-3);\n }\n }\n\n &__note {\n margin: var(--spacing-8) 0;\n color: var(--color-word-3);\n font-size: var(--text-12);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { useI18n } from 'vue-i18n'\n import type { SpreadsheetPreview, SpreadsheetPreviewCell } from 'models'\n\n /**\n * The content of the preview of a spreadsheet (spec\n * `chat-office-files.md`, F6, item 4): the first rows of each sheet, one\n * sheet at a time, its cells formatted in the reader's language as the\n * file's number formats ask. A formula whose result the file does not\n * hold yet shows a dash. Framed by `PkFilePreview`.\n */\n const props = defineProps<{ preview: SpreadsheetPreview }>()\n\n const { t: $t, locale } = useI18n({ useScope: 'global' })\n\n const active = ref(0)\n const sheet = computed(\n () => props.preview.sheets[active.value] ?? props.preview.sheets[0],\n )\n const columns = computed(() =>\n Math.max(0, ...(sheet.value?.rows.map((r) => r.length) ?? [0])),\n )\n\n /** The cell's text: a number in the reader's language, a date, a word. */\n const textOf = (cell: SpreadsheetPreviewCell): string => {\n if (cell.missing) {\n return '—'\n }\n const v = cell.value\n if (v === undefined) {\n return ''\n }\n if (typeof v === 'boolean') {\n return v ? $t('chatFilePreview.true') : $t('chatFilePreview.false')\n }\n if (cell.format === 'date' && typeof v === 'string') {\n const date = new Date(`${v}T00:00:00Z`)\n return Number.isNaN(date.getTime())\n ? v\n : new Intl.DateTimeFormat(locale.value, {\n dateStyle: 'short',\n timeZone: 'UTC',\n }).format(date)\n }\n if (typeof v === 'number') {\n const digits =\n cell.decimals !== undefined\n ? {\n minimumFractionDigits: cell.decimals,\n maximumFractionDigits:\n cell.maxDecimals ?? cell.decimals,\n }\n : { maximumFractionDigits: 10 }\n return new Intl.NumberFormat(locale.value, {\n ...digits,\n ...(cell.format === 'percent' ? { style: 'percent' } : {}),\n ...(cell.format === 'currency' && cell.currency\n ? { style: 'currency', currency: cell.currency }\n : {}),\n }).format(v)\n }\n return v\n }\n\n const isNumber = (cell: SpreadsheetPreviewCell) =>\n typeof cell.value === 'number' || cell.missing\n</script>\n\n<template>\n <div class=\"pk-spreadsheet-preview\">\n <div\n v-if=\"preview.sheets.length > 1\"\n class=\"pk-spreadsheet-preview__sheets\"\n role=\"tablist\">\n <button\n v-for=\"(s, i) in preview.sheets\"\n :key=\"s.name\"\n type=\"button\"\n role=\"tab\"\n class=\"pk-spreadsheet-preview__sheet\"\n :aria-selected=\"i === active\"\n @click=\"active = i\">\n {{ s.name }}\n </button>\n </div>\n <p v-if=\"preview.staleFormulas\" class=\"pk-spreadsheet-preview__note\">\n {{ $t('chatFilePreview.staleFormulas') }}\n </p>\n <div v-if=\"sheet\" class=\"pk-spreadsheet-preview__frame\" role=\"tabpanel\">\n <table class=\"pk-spreadsheet-preview__table\">\n <tbody>\n <tr v-for=\"(row, r) in sheet.rows\" :key=\"r\">\n <component\n :is=\"sheet.header && r === 0 ? 'th' : 'td'\"\n v-for=\"c in columns\"\n :key=\"c\"\n :scope=\"sheet.header && r === 0 ? 'col' : undefined\"\n :class=\"{\n 'pk-spreadsheet-preview__number':\n row[c - 1] && isNumber(row[c - 1]),\n 'pk-spreadsheet-preview__error':\n row[c - 1]?.format === 'error',\n }\"\n :title=\"\n row[c - 1]?.missing\n ? $t('chatFilePreview.missingValue')\n : undefined\n \">\n {{ row[c - 1] ? textOf(row[c - 1]) : '' }}\n </component>\n </tr>\n </tbody>\n </table>\n <p v-if=\"!sheet.rows.length\" class=\"pk-spreadsheet-preview__note\">\n {{ $t('chatFilePreview.emptySheet') }}\n </p>\n </div>\n <p\n v-if=\"sheet && (sheet.moreRows || sheet.moreColumns)\"\n class=\"pk-spreadsheet-preview__note\">\n <template v-if=\"sheet.moreRows\">\n {{ $t('chatFilePreview.moreRows', sheet.moreRows) }}\n </template>\n <template v-if=\"sheet.moreColumns\">\n {{ $t('chatFilePreview.moreColumns', sheet.moreColumns) }}\n </template>\n </p>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-spreadsheet-preview {\n // The sheets as Excel draws its tabs: a row of names, the open one\n // carried by surface and weight (DESIGN.md, principle 3)\n &__sheets {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-4);\n margin-bottom: var(--spacing-8);\n }\n\n &__sheet {\n padding: var(--spacing-4) var(--spacing-12);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface);\n color: var(--color-word-2);\n font: inherit;\n font-size: var(--text-12);\n cursor: pointer;\n\n &[aria-selected='true'] {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n font-weight: var(--font-semibold);\n }\n }\n\n // One frame, scrolling sideways when the sheet is wider than it\n &__frame {\n overflow-x: auto;\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n background-color: var(--color-surface);\n }\n\n &__table {\n border-collapse: collapse;\n font-size: var(--text-12);\n\n th,\n td {\n max-width: 20rem;\n padding: var(--spacing-4) var(--spacing-8);\n border-right: var(--border) solid var(--color-surface-2);\n border-bottom: var(--border) solid var(--color-surface-2);\n text-align: start;\n vertical-align: top;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n }\n\n th {\n background-color: var(--color-surface-1);\n font-weight: var(--font-semibold);\n }\n\n // Numbers line up on their last digit, as in Excel\n .pk-spreadsheet-preview__number {\n text-align: end;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n\n .pk-spreadsheet-preview__error {\n color: var(--color-word-3);\n }\n }\n\n &__note {\n margin: var(--spacing-8) 0;\n color: var(--color-word-3);\n font-size: var(--text-12);\n }\n }\n</style>\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 { 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 type { WordPreview } from 'models'\n import PkWordPreviewRuns from './PkWordPreviewRuns.vue'\n\n /**\n * The content of the preview of a Word document (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 as\n * placeholders. Framed by `PkFilePreview`.\n */\n const props = defineProps<{ preview: WordPreview }>()\n\n const authors = computed(() => props.preview.revisionAuthors.join(', '))\n</script>\n\n<template>\n <div class=\"pk-word-preview\">\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 <article 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 v-if=\"block.label\" class=\"pk-word-preview__label\">{{\n block.label\n }}</span>\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</template>\n\n<style lang=\"scss\">\n .pk-word-preview {\n &__legend {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-4) var(--spacing-12);\n margin: 0 0 var(--spacing-md);\n color: var(--color-word-2);\n font-size: var(--text-12);\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 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</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import type { WordPreview } from 'models'\n import PkWordPreviewRuns from './PkWordPreviewRuns.vue'\n\n /**\n * The content of the preview of a Word document (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 as\n * placeholders. Framed by `PkFilePreview`.\n */\n const props = defineProps<{ preview: WordPreview }>()\n\n const authors = computed(() => props.preview.revisionAuthors.join(', '))\n</script>\n\n<template>\n <div class=\"pk-word-preview\">\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 <article 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 v-if=\"block.label\" class=\"pk-word-preview__label\">{{\n block.label\n }}</span>\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</template>\n\n<style lang=\"scss\">\n .pk-word-preview {\n &__legend {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-4) var(--spacing-12);\n margin: 0 0 var(--spacing-md);\n color: var(--color-word-2);\n font-size: var(--text-12);\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 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</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import type { ChatFilePreview } from 'models'\n import PkSpreadsheetPreview from './PkSpreadsheetPreview.vue'\n import PkWordPreview from './PkWordPreview.vue'\n\n /**\n * The preview of a Word document or a spreadsheet stored in the chat\n * (spec `chat-office-files.md`, F6, items 3 and 4): its name, version and\n * download over the content, which scrolls. The same frame goes in a\n * dialog (its title and close are the dialog's) and in the panel beside\n * the chat (`closable`).\n */\n const props = defineProps<{\n kind: 'word' | 'spreadsheet'\n filename: string\n version?: number\n /** The authenticated download URL of the same version. */\n downloadUrl: string\n preview?: ChatFilePreview\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 // Each key written out in its own call: the widget ships only those.\n const subtitle = computed(() => {\n if (props.kind === 'spreadsheet') {\n return props.version\n ? $t('chatFilePreview.versionFirstRows', {\n version: props.version,\n })\n : $t('chatFilePreview.firstRows')\n }\n return props.version\n ? $t('chatFilePreview.versionUnpaged', { version: props.version })\n : $t('chatFilePreview.unpaged')\n })\n</script>\n\n<template>\n <section class=\"pk-file-preview\" :aria-label=\"filename\">\n <header class=\"pk-file-preview__head\">\n <div class=\"pk-file-preview__name\">\n <strong v-if=\"closable\" class=\"pk-file-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 <div class=\"pk-file-preview__scroll\">\n <div v-if=\"loading\" class=\"pk-file-preview__skeleton vv-skeleton\">\n <div\n v-for=\"i in 8\"\n :key=\"i\"\n class=\"vv-skeleton__item pk-file-preview__skeleton-line\"\n :class=\"i % 3 ? 'w-full' : 'w-128'\" />\n </div>\n <p v-else-if=\"error || !preview\" class=\"pk-file-preview__note\">\n {{ $t('chatFilePreview.unavailable') }}\n </p>\n <PkWordPreview v-else-if=\"preview.kind === 'word'\" :preview />\n <PkSpreadsheetPreview v-else :preview />\n </div>\n </section>\n</template>\n\n<style lang=\"scss\">\n .pk-file-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 // The content scrolls inside, so the head stays 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 &__skeleton {\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 }\n\n &__skeleton-line {\n height: var(--spacing-12);\n margin-bottom: var(--spacing-12);\n border-radius: var(--rounded);\n }\n\n &__note {\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</style>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useI18n } from 'vue-i18n'\n import type { ChatFilePreview } from 'models'\n import PkSpreadsheetPreview from './PkSpreadsheetPreview.vue'\n import PkWordPreview from './PkWordPreview.vue'\n\n /**\n * The preview of a Word document or a spreadsheet stored in the chat\n * (spec `chat-office-files.md`, F6, items 3 and 4): its name, version and\n * download over the content, which scrolls. The same frame goes in a\n * dialog (its title and close are the dialog's) and in the panel beside\n * the chat (`closable`).\n */\n const props = defineProps<{\n kind: 'word' | 'spreadsheet'\n filename: string\n version?: number\n /** The authenticated download URL of the same version. */\n downloadUrl: string\n preview?: ChatFilePreview\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 // Each key written out in its own call: the widget ships only those.\n const subtitle = computed(() => {\n if (props.kind === 'spreadsheet') {\n return props.version\n ? $t('chatFilePreview.versionFirstRows', {\n version: props.version,\n })\n : $t('chatFilePreview.firstRows')\n }\n return props.version\n ? $t('chatFilePreview.versionUnpaged', { version: props.version })\n : $t('chatFilePreview.unpaged')\n })\n</script>\n\n<template>\n <section class=\"pk-file-preview\" :aria-label=\"filename\">\n <header class=\"pk-file-preview__head\">\n <div class=\"pk-file-preview__name\">\n <strong v-if=\"closable\" class=\"pk-file-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 <div class=\"pk-file-preview__scroll\">\n <div v-if=\"loading\" class=\"pk-file-preview__skeleton vv-skeleton\">\n <div\n v-for=\"i in 8\"\n :key=\"i\"\n class=\"vv-skeleton__item pk-file-preview__skeleton-line\"\n :class=\"i % 3 ? 'w-full' : 'w-128'\" />\n </div>\n <p v-else-if=\"error || !preview\" class=\"pk-file-preview__note\">\n {{ $t('chatFilePreview.unavailable') }}\n </p>\n <PkWordPreview v-else-if=\"preview.kind === 'word'\" :preview />\n <PkSpreadsheetPreview v-else :preview />\n </div>\n </section>\n</template>\n\n<style lang=\"scss\">\n .pk-file-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 // The content scrolls inside, so the head stays 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 &__skeleton {\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 }\n\n &__skeleton-line {\n height: var(--spacing-12);\n margin-bottom: var(--spacing-12);\n border-radius: var(--rounded);\n }\n\n &__note {\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</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAYI,IAAMkF,IAAQC,GAER,EAAE,GAAGC,GAAI,cAAWC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAElDC,IAASC,EAAI,CAAC,GACdC,IAAQC,QACJP,EAAM,QAAQ,OAAOI,EAAO,UAAUJ,EAAM,QAAQ,OAAO,EACrE,GACMQ,IAAUD,QACZ,KAAK,IAAI,GAAG,GAAID,EAAM,OAAO,KAAK,KAAK,MAAMG,EAAE,MAAM,KAAK,CAAC,CAAC,CAAE,CAClE,GAGMC,KAAU,MAAyC;GACrD,IAAIC,EAAK,SACL,OAAO;GAEX,IAAMC,IAAID,EAAK;GACf,IAAIC,MAAM,KAAA,GACN,OAAO;GAEX,IAAI,OAAOA,KAAM,WACb,OAAWV,EAAJU,IAAO,yBAA6B,uBAAuB;GAEtE,IAAID,EAAK,WAAW,UAAU,OAAOC,KAAM,UAAU;IACjD,IAAMC,oBAAO,IAAI,KAAK,GAAGD,EAAE,WAAW;IACtC,OAAO,OAAO,MAAMC,EAAK,QAAQ,CAAC,IAC5BD,IACA,IAAI,KAAK,eAAeE,EAAO,OAAO;KAClC,WAAW;KACX,UAAU;IACd,CAAC,CAAC,CAAC,OAAOD,CAAI;GACxB;GACA,IAAI,OAAOD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EqC,IAAC,IAAA,WAAA,OAAA,CAAA;G,wBAEHrB,EAAA,SAAK,CAAKA,EAAA,WAAxB1B,EAAA,GAAAC,EAEI,KAFJwF,GAEItF,EADGG,EAAAqB,CAAA,CAAE,CAAA,6BAAA,CAAA,GAAA,CAAA,KAEiBD,EAAA,QAAQ,SAAI,UAAtC1B,EAAA,GAAAO,EAA8DI,GAAA;;IAAV,SAAAe,EAAA;G,6BACpD1B,EAAA,GAAAO,EAAwCK,GAAA;;IAAV,SAAAc,EAAA"}
|
|
@@ -0,0 +1,220 @@
|
|
|
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 = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "pk-tool-chat-file__scroll"
|
|
17
|
+
}, T = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "pk-tool-chat-file__table"
|
|
20
|
+
}, ee = { scope: "col" }, te = { scope: "col" }, ne = { scope: "col" }, re = {
|
|
21
|
+
colspan: "3",
|
|
22
|
+
scope: "rowgroup",
|
|
23
|
+
class: "pk-tool-chat-file__sheet"
|
|
24
|
+
}, E = {
|
|
25
|
+
key: 0,
|
|
26
|
+
colspan: "3",
|
|
27
|
+
class: "pk-tool-chat-file__after"
|
|
28
|
+
}, D = { class: "pk-tool-chat-file__cell" }, O = { class: "pk-tool-chat-file__before" }, k = { class: "pk-tool-chat-file__after" }, A = {
|
|
29
|
+
key: 1,
|
|
30
|
+
class: "pk-tool-chat-file__paragraphs"
|
|
31
|
+
}, j = { class: "pk-tool-chat-file__what" }, M = { class: "pk-tool-chat-file__text" }, N = {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: "pk-tool-chat-file__removed"
|
|
34
|
+
}, P = {
|
|
35
|
+
key: 1,
|
|
36
|
+
class: "pk-tool-chat-file__added"
|
|
37
|
+
}, F = { key: 2 }, I = {
|
|
38
|
+
key: 2,
|
|
39
|
+
class: "pk-tool-chat-file__note"
|
|
40
|
+
}, L = ["aria-expanded"], R = {
|
|
41
|
+
key: 1,
|
|
42
|
+
class: "text-12 text-word-3 mt-xs mb-0"
|
|
43
|
+
}, z = 3, B = /* @__PURE__ */ p({
|
|
44
|
+
__name: "PkToolChatFile",
|
|
45
|
+
props: {
|
|
46
|
+
part: {},
|
|
47
|
+
fileUrl: { type: Function },
|
|
48
|
+
preview: { type: Function },
|
|
49
|
+
latestVersions: {},
|
|
50
|
+
restore: { type: Function }
|
|
51
|
+
},
|
|
52
|
+
setup(p) {
|
|
53
|
+
let B = /* @__PURE__ */ new Set(["tool-editWordDocument", "tool-createWordDocument"]), V = p, { t: H } = y({ useScope: "global" }), U = h(!1), W = (e) => e?.replace(/… \(\d+ characters\)$/, "…"), G = (e, t, n) => {
|
|
54
|
+
let r = e.split(/(\s+)/).filter(Boolean);
|
|
55
|
+
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("")}…`;
|
|
56
|
+
}, K = (e, t) => {
|
|
57
|
+
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));
|
|
58
|
+
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]);
|
|
59
|
+
let a = [], o = (e, t) => {
|
|
60
|
+
let n = a[a.length - 1];
|
|
61
|
+
n?.kind === t ? n.text += e : a.push({
|
|
62
|
+
text: e,
|
|
63
|
+
kind: t
|
|
64
|
+
});
|
|
65
|
+
}, s = 0, c = 0;
|
|
66
|
+
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");
|
|
67
|
+
return a.map((e, t) => e.kind === "same" ? {
|
|
68
|
+
...e,
|
|
69
|
+
text: G(e.text, t > 0, t < a.length - 1)
|
|
70
|
+
} : e);
|
|
71
|
+
}, q = (e) => {
|
|
72
|
+
switch (e) {
|
|
73
|
+
case "insertParagraphs": return H("messagePart.chatFileParagraphAdded");
|
|
74
|
+
case "deleteParagraphs": return H("messagePart.chatFileParagraphDeleted");
|
|
75
|
+
case "insertTableRow": return H("messagePart.chatFileTableRowAdded");
|
|
76
|
+
case "deleteTableRow": return H("messagePart.chatFileTableRowDeleted");
|
|
77
|
+
case "acceptRevisions": return H("messagePart.chatFileRevisionAccepted");
|
|
78
|
+
case "rejectRevisions": return H("messagePart.chatFileRevisionRejected");
|
|
79
|
+
default: return H("messagePart.chatFileParagraphChanged");
|
|
80
|
+
}
|
|
81
|
+
}, J = (e) => {
|
|
82
|
+
let t = W(e.before), n = W(e.after);
|
|
83
|
+
return {
|
|
84
|
+
what: q(e.op),
|
|
85
|
+
segments: t && n ? K(t, n) : [t ? {
|
|
86
|
+
text: t,
|
|
87
|
+
kind: "removed"
|
|
88
|
+
} : {
|
|
89
|
+
text: n ?? "",
|
|
90
|
+
kind: "same"
|
|
91
|
+
}]
|
|
92
|
+
};
|
|
93
|
+
}, Y = (e) => {
|
|
94
|
+
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);
|
|
95
|
+
if (r !== void 0) return {
|
|
96
|
+
sheet: t,
|
|
97
|
+
newSheet: H("messagePart.chatFileNewSheet", r)
|
|
98
|
+
};
|
|
99
|
+
let i = t.lastIndexOf("!"), a = t.slice(i + 1), o = /^A(\d+):[A-Z]+(\d+)$/.exec(a);
|
|
100
|
+
return {
|
|
101
|
+
sheet: t.slice(0, Math.max(i, 0)),
|
|
102
|
+
cell: o && o[1] === o[2] ? H("messagePart.chatFileRow", { row: o[1] }) : a,
|
|
103
|
+
before: W(e.before) || void 0,
|
|
104
|
+
after: W(e.after) || void 0
|
|
105
|
+
};
|
|
106
|
+
}, X = o(() => {
|
|
107
|
+
let n = V.part;
|
|
108
|
+
if (n.state !== "output-available" || !n.output?.storedFileName) return;
|
|
109
|
+
let r = n.output, i = B.has(n.type ?? ""), a;
|
|
110
|
+
i && r.changedParagraphs !== void 0 ? a = r.tracked ? H("messagePart.editWordDocumentRevisions", r.changedParagraphs) : H("messagePart.editWordDocumentParagraphs", r.changedParagraphs) : !i && r.changedCells !== void 0 && (a = H("messagePart.editSpreadsheetCells", r.changedCells));
|
|
111
|
+
let o = a ? r.changes ?? [] : [], s = [];
|
|
112
|
+
r.stalePivots && s.push(H("messagePart.chatFileRefreshPivots")), r.staleTableOfContents && s.push(H("messagePart.chatFileUpdateTableOfContents"));
|
|
113
|
+
let c = a && r.version ? H("messagePart.chatFileVersionSummary", {
|
|
114
|
+
version: r.version,
|
|
115
|
+
changed: a
|
|
116
|
+
}) : a;
|
|
117
|
+
return r.restoredFrom && (c = H("messagePart.chatFileRestored", {
|
|
118
|
+
version: r.version,
|
|
119
|
+
restored: r.restoredFrom
|
|
120
|
+
})), {
|
|
121
|
+
output: r,
|
|
122
|
+
mediaType: i ? t : e,
|
|
123
|
+
summary: c,
|
|
124
|
+
cells: i ? [] : o.map(Y),
|
|
125
|
+
paragraphs: i ? o.map(J) : [],
|
|
126
|
+
count: o.length,
|
|
127
|
+
more: r.moreChanges ?? 0,
|
|
128
|
+
reminders: s
|
|
129
|
+
};
|
|
130
|
+
}), Z = (e) => U.value ? e ?? [] : (e ?? []).slice(0, z), ie = o(() => Z(X.value?.paragraphs)), ae = o(() => {
|
|
131
|
+
let e = /* @__PURE__ */ new Map();
|
|
132
|
+
for (let t of Z(X.value?.cells)) {
|
|
133
|
+
let n = e.get(t.sheet);
|
|
134
|
+
n ? n.rows.push(t) : e.set(t.sheet, {
|
|
135
|
+
sheet: t.sheet,
|
|
136
|
+
rows: [t]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return [...e.values()];
|
|
140
|
+
}), Q = o(() => (X.value?.count ?? 0) - z), $ = o(() => {
|
|
141
|
+
let e = X.value?.output, t = e?.fileId ? V.latestVersions?.get(e.fileId) : void 0;
|
|
142
|
+
return e?.version && t && e.version < t ? {
|
|
143
|
+
version: e.version,
|
|
144
|
+
filename: (e.filename ?? e.storedFileName).replace(RegExp(` \\(v${e.version}\\)(\\.\\w+)$`), "$1")
|
|
145
|
+
} : void 0;
|
|
146
|
+
});
|
|
147
|
+
return (e, t) => {
|
|
148
|
+
let o = n, h = i;
|
|
149
|
+
return X.value ? (m(), l("div", b, [u("div", x, [
|
|
150
|
+
f(r, {
|
|
151
|
+
"media-type": X.value.mediaType,
|
|
152
|
+
url: p.fileUrl(X.value.output.storedFileName),
|
|
153
|
+
filename: X.value.output.filename,
|
|
154
|
+
size: X.value.output.sizeBytes,
|
|
155
|
+
"show-download": ""
|
|
156
|
+
}, null, 8, [
|
|
157
|
+
"media-type",
|
|
158
|
+
"url",
|
|
159
|
+
"filename",
|
|
160
|
+
"size"
|
|
161
|
+
]),
|
|
162
|
+
p.preview ? (m(), s(o, {
|
|
163
|
+
key: 0,
|
|
164
|
+
modifiers: "secondary",
|
|
165
|
+
icon: "ri:eye-line",
|
|
166
|
+
label: v(H)("chatFilePreview.preview"),
|
|
167
|
+
onClick: t[0] ||= (e) => p.preview({
|
|
168
|
+
kind: X.value.mediaType === v("application/vnd.openxmlformats-officedocument.wordprocessingml.document") ? "word" : "spreadsheet",
|
|
169
|
+
storedFileName: X.value.output.storedFileName,
|
|
170
|
+
filename: X.value.output.filename ?? X.value.output.storedFileName,
|
|
171
|
+
version: X.value.output.version
|
|
172
|
+
})
|
|
173
|
+
}, null, 8, ["label"])) : c("", !0),
|
|
174
|
+
p.restore && $.value ? (m(), s(o, {
|
|
175
|
+
key: 1,
|
|
176
|
+
modifiers: "secondary",
|
|
177
|
+
icon: "ri:arrow-go-back-line",
|
|
178
|
+
label: v(H)("messagePart.chatFileRestore"),
|
|
179
|
+
onClick: t[1] ||= (e) => p.restore($.value)
|
|
180
|
+
}, null, 8, ["label"])) : c("", !0)
|
|
181
|
+
]), X.value.count || X.value.output.restoredFrom ? (m(), l("section", S, [
|
|
182
|
+
u("h4", C, _(X.value.summary), 1),
|
|
183
|
+
X.value.count ? (m(), l("div", w, [X.value.cells.length ? (m(), l("table", T, [u("thead", null, [u("tr", null, [
|
|
184
|
+
u("th", ee, _(v(H)("messagePart.chatFileCell")), 1),
|
|
185
|
+
u("th", te, _(v(H)("messagePart.chatFileBefore")), 1),
|
|
186
|
+
u("th", ne, _(v(H)("messagePart.chatFileAfter")), 1)
|
|
187
|
+
])]), (m(!0), l(a, null, g(ae.value, (e, t) => (m(), l("tbody", { key: t }, [u("tr", null, [u("th", re, _(v(H)("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", E, _(e.newSheet), 1)) : (m(), l(a, { key: 1 }, [
|
|
188
|
+
u("td", D, _(e.cell), 1),
|
|
189
|
+
u("td", O, _(e.before), 1),
|
|
190
|
+
u("td", k, _(e.after), 1)
|
|
191
|
+
], 64))]))), 128))]))), 128))])) : (m(), l("ul", A, [(m(!0), l(a, null, g(ie.value, (e, t) => (m(), l("li", {
|
|
192
|
+
key: t,
|
|
193
|
+
class: "pk-tool-chat-file__paragraph"
|
|
194
|
+
}, [u("span", j, _(e.what), 1), u("span", M, [(m(!0), l(a, null, g(e.segments, (e, t) => (m(), l(a, { key: t }, [e.kind === "removed" ? (m(), l("del", N, _(e.text), 1)) : e.kind === "added" ? (m(), l("ins", P, _(e.text), 1)) : (m(), l("span", F, _(e.text), 1))], 64))), 128))])]))), 128))])), U.value && X.value.more ? (m(), l("p", I, _(v(H)("messagePart.chatFileMoreChanges", X.value.more)), 1)) : c("", !0)])) : c("", !0),
|
|
195
|
+
Q.value > 0 ? (m(), l("button", {
|
|
196
|
+
key: 1,
|
|
197
|
+
type: "button",
|
|
198
|
+
class: "pk-tool-chat-file__more",
|
|
199
|
+
"aria-expanded": U.value,
|
|
200
|
+
onClick: t[2] ||= (e) => U.value = !U.value
|
|
201
|
+
}, [f(h, {
|
|
202
|
+
name: U.value ? "ri:arrow-up-s-line" : "ri:arrow-down-s-line",
|
|
203
|
+
class: "text-16",
|
|
204
|
+
"aria-hidden": "true"
|
|
205
|
+
}, null, 8, ["name"]), d(" " + _(U.value ? v(H)("action.showLess") : v(H)("action.showMore", { count: Q.value })), 1)], 8, L)) : c("", !0),
|
|
206
|
+
(m(!0), l(a, null, g(X.value.reminders, (e) => (m(), l("p", {
|
|
207
|
+
key: e,
|
|
208
|
+
class: "pk-tool-chat-file__reminder"
|
|
209
|
+
}, [f(h, {
|
|
210
|
+
name: "ri:information-line",
|
|
211
|
+
class: "pk-tool-chat-file__reminder-icon",
|
|
212
|
+
"aria-hidden": "true"
|
|
213
|
+
}), d(" " + _(e), 1)]))), 128))
|
|
214
|
+
])) : X.value.summary ? (m(), l("p", R, _(X.value.summary), 1)) : c("", !0)])) : c("", !0);
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
export { B as default };
|
|
219
|
+
|
|
220
|
+
//# sourceMappingURL=PkToolChatFile-BJsDSu1Q.js.map
|