@8wave/ai-elements 0.125.0-beta.12 → 0.125.0-beta.14
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-COiD99Bn.js → PkFilePreview-rAHDDtGS.js} +318 -269
- package/dist/_chunks/PkFilePreview-rAHDDtGS.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-gHN4_C95.js → PkFilePreviewDialog-BBFrC_rn.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-gHN4_C95.js.map → PkFilePreviewDialog-BBFrC_rn.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-C4tqVGFZ.js → PkToolShowWeather-B9HWOU7p.js} +2 -2
- package/dist/_chunks/PkToolShowWeather-B9HWOU7p.js.map +1 -0
- package/dist/ai-elements.es.js +8 -8
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotAudioTranscript.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotSteps.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/_chunks/{PkChatbot-BrJxCUeC.js → PkChatbot-D48q-ulR.js} +4 -4
- package/dist-vue/_chunks/{PkChatbot-BrJxCUeC.js.map → PkChatbot-D48q-ulR.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotAudioTranscript-SSTh074Z.js → PkChatbotAudioTranscript-DgmuXalb.js} +2 -2
- package/dist-vue/_chunks/PkChatbotAudioTranscript-DgmuXalb.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotMessages-B0erk76c.js → PkChatbotMessages-DftNL5ZQ.js} +4 -4
- package/dist-vue/_chunks/{PkChatbotMessages-B0erk76c.js.map → PkChatbotMessages-DftNL5ZQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-s_Dv4qAx.js → PkChatbotSteps-CY7pN2Gl.js} +3 -3
- package/dist-vue/_chunks/PkChatbotSteps-CY7pN2Gl.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-CHnOvnMd.js → PkChatbotViewChat-lLX_msKI.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewChat-CHnOvnMd.js.map → PkChatbotViewChat-lLX_msKI.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-BUXSz7C7.js → PkChatbotViewConversations-C0KqM_Wq.js} +2 -2
- package/dist-vue/_chunks/PkChatbotViewConversations-C0KqM_Wq.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewFiles-D4yBDDdC.js → PkChatbotViewFiles-B9mYRoNK.js} +2 -2
- package/dist-vue/_chunks/PkChatbotViewFiles-B9mYRoNK.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreview-C_lSOSEW.js → PkFilePreview-Ac_8QIBX.js} +413 -364
- package/dist-vue/_chunks/{PkFilePreview-C_lSOSEW.js.map → PkFilePreview-Ac_8QIBX.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-6ChVRH3u.js → PkFilePreviewDialog-DGBaeZ8y.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-6ChVRH3u.js.map → PkFilePreviewDialog-DGBaeZ8y.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWeather-BC-Rx-sI.js → PkToolShowWeather-1NJwawC7.js} +2 -2
- package/dist-vue/_chunks/PkToolShowWeather-1NJwawC7.js.map +1 -0
- package/dist-vue/index.js +8 -8
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-COiD99Bn.js.map +0 -1
- package/dist/_chunks/PkToolShowWeather-C4tqVGFZ.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotAudioTranscript-SSTh074Z.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotSteps-s_Dv4qAx.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewConversations-BUXSz7C7.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewFiles-D4yBDDdC.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowWeather-BC-Rx-sI.js.map +0 -1
|
@@ -3,8 +3,8 @@ import { t } from "./PkEditorRadioButtons-Bw576DPQ.js";
|
|
|
3
3
|
import { i as n, n as r, r as i } from "./excelNumberFormat-C1sCQrOz.js";
|
|
4
4
|
import { t as a } from "./VvButtonLocalized-C-vx25u4.js";
|
|
5
5
|
import { G as o, H as s, J as c, K as l, R as u, U as d, V as f, W as p, o as m, q as h } from "./utils-8lO2Gj-m.js";
|
|
6
|
-
import { VvIcon as
|
|
7
|
-
import { Fragment as
|
|
6
|
+
import { VvIcon as ee } from "@volverjs/ui-vue/components";
|
|
7
|
+
import { Fragment as g, computed as _, createBlock as v, createCommentVNode as y, createElementBlock as b, createElementVNode as x, createTextVNode as S, createVNode as C, defineComponent as w, inject as T, isMemoSame as E, mergeModels as D, nextTick as te, normalizeClass as O, normalizeStyle as k, onBeforeUnmount as A, onMounted as ne, onScopeDispose as j, openBlock as M, provide as N, ref as P, renderList as F, renderSlot as I, shallowRef as L, toDisplayString as R, unref as z, useModel as B, useTemplateRef as re, vModelText as V, watch as H, withCtx as ie, withDirectives as U, withKeys as ae, withModifiers as W } from "vue";
|
|
8
8
|
import { useI18n as oe } from "vue-i18n";
|
|
9
9
|
import { useElementSize as se, useEventListener as G } from "@vueuse/core";
|
|
10
10
|
// ../../packages/composable/src/useSettledSelection.ts
|
|
@@ -56,26 +56,26 @@ function le({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2 })
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
// ../../packages/components/src/chat/fileSelection.ts
|
|
59
|
-
var
|
|
60
|
-
let t = [...new Set(e)].sort((e, t) =>
|
|
59
|
+
var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1)), pe = (e) => {
|
|
60
|
+
let t = [...new Set(e)].sort((e, t) => fe(e) - fe(t)), n = [];
|
|
61
61
|
for (let e of t) {
|
|
62
62
|
let t = n[n.length - 1];
|
|
63
|
-
t &&
|
|
63
|
+
t && fe(e) === fe(t.to) + 1 ? t.to = e : n.push({
|
|
64
64
|
from: e,
|
|
65
65
|
to: e
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
return n.slice(0, 100);
|
|
69
|
-
},
|
|
69
|
+
}, me = (e, t) => {
|
|
70
70
|
let n = [];
|
|
71
71
|
for (let r = e.indexOf(t); r >= 0;) n.push(r), r = e.indexOf(t, r + t.length);
|
|
72
72
|
return n;
|
|
73
|
-
},
|
|
74
|
-
let r =
|
|
73
|
+
}, he = (e, t, n) => {
|
|
74
|
+
let r = me(e, e.slice(t, t + n));
|
|
75
75
|
if (r.length < 2) return {};
|
|
76
76
|
let i = t, a = t + n;
|
|
77
|
-
for (let t = !0; a - i <=
|
|
78
|
-
if (
|
|
77
|
+
for (let t = !0; a - i <= Y; t = !t) {
|
|
78
|
+
if (me(e, e.slice(i, a)).length === 1) return { find: e.slice(i, a) };
|
|
79
79
|
if (t && i > 0) i = e.slice(0, i).replace(/\S*\s*$/, "").length;
|
|
80
80
|
else if (a < e.length) {
|
|
81
81
|
let t = e.slice(a).match(/^\s*\S*/)?.[0] ?? "";
|
|
@@ -86,17 +86,17 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
86
86
|
index: r.indexOf(t) + 1 || 1,
|
|
87
87
|
of: r.length
|
|
88
88
|
} };
|
|
89
|
-
},
|
|
89
|
+
}, ge = (e) => (e.querySelectorAll("[data-quote-skip]").forEach((e) => e.remove()), e.querySelectorAll("[data-paragraph]").forEach((e) => e.append("\n")), e.textContent ?? ""), _e = (e) => e.length > q ? `${e.slice(0, q / 2)} […] ${e.slice(-500)}` : e, ve = (e, t, n) => {
|
|
90
90
|
if (!e.contains(t.commonAncestorContainer)) return;
|
|
91
91
|
let r = [...e.querySelectorAll("[data-paragraph]")].filter((e) => !e.closest(n) && t.intersectsNode(e));
|
|
92
92
|
if (!r.length) return;
|
|
93
|
-
let i = r.flatMap((e) => e.dataset.paragraph.split(" ")), a =
|
|
93
|
+
let i = r.flatMap((e) => e.dataset.paragraph.split(" ")), a = ge(t.cloneContents()), o = a.trim();
|
|
94
94
|
if (o.length < 2) return;
|
|
95
95
|
let s = {
|
|
96
96
|
format: "docx",
|
|
97
|
-
runs:
|
|
97
|
+
runs: pe(i),
|
|
98
98
|
paragraphCount: new Set(i).size,
|
|
99
|
-
quote:
|
|
99
|
+
quote: _e(o),
|
|
100
100
|
measure: () => {
|
|
101
101
|
let e = t.getBoundingClientRect(), n = t.getClientRects()[0] ?? e;
|
|
102
102
|
return {
|
|
@@ -115,17 +115,17 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
115
115
|
if (r.length === 1) {
|
|
116
116
|
let e = r[0], n = document.createRange();
|
|
117
117
|
n.selectNodeContents(e);
|
|
118
|
-
let i =
|
|
118
|
+
let i = ge(n.cloneContents()).replace(/\n$/, ""), c = document.createRange();
|
|
119
119
|
c.setStart(e, 0), c.setEnd(t.startContainer, t.startOffset);
|
|
120
|
-
let l =
|
|
121
|
-
s.before = i.slice(Math.max(0, l -
|
|
120
|
+
let l = ge(c.cloneContents()).length + (a.length - a.trimStart().length);
|
|
121
|
+
s.before = i.slice(Math.max(0, l - J), l), s.after = i.slice(l + o.length, l + o.length + J), Object.assign(s, he(i, l, o.length));
|
|
122
122
|
}
|
|
123
123
|
return s;
|
|
124
|
-
},
|
|
124
|
+
}, X = (e) => {
|
|
125
125
|
let t = "";
|
|
126
126
|
for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
|
|
127
127
|
return t;
|
|
128
|
-
},
|
|
128
|
+
}, ye = (e, t) => {
|
|
129
129
|
let n = { ...t }, r = e.rows.flatMap((e) => e.cells.filter((e) => e.span).map((t) => ({
|
|
130
130
|
r1: e.row,
|
|
131
131
|
r2: e.row + t.span.rows - 1,
|
|
@@ -136,7 +136,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
136
136
|
e = !1;
|
|
137
137
|
for (let t of r) t.r1 <= n.r2 && t.r2 >= n.r1 && t.c1 <= n.c2 && t.c2 >= n.c1 && (t.r1 < n.r1 || t.r2 > n.r2 || t.c1 < n.c1 || t.c2 > n.c2) && (n.r1 = Math.min(n.r1, t.r1), n.r2 = Math.max(n.r2, t.r2), n.c1 = Math.min(n.c1, t.c1), n.c2 = Math.max(n.c2, t.c2), e = !0);
|
|
138
138
|
}
|
|
139
|
-
let i = `${
|
|
139
|
+
let i = `${X(n.c1)}${n.r1}`, a = `${X(n.c2)}${n.r2}`, o = (e.hiddenRows ?? []).filter((e) => e >= n.r1 && e <= n.r2), s = e.columns.filter((e) => e.hidden && e.col >= n.c1 && e.col <= n.c2).map((e) => X(e.col)), c = e.rows.filter((e) => e.row >= n.r1 && e.row <= n.r2).flatMap((e) => e.cells.filter((e) => e.col >= n.c1 && e.col <= n.c2 && e.value !== void 0 && e.value !== "")).slice(0, de).map((e) => String(e.value)).join("; ").slice(0, 500);
|
|
140
140
|
return {
|
|
141
141
|
format: "xlsx",
|
|
142
142
|
sheet: e.name,
|
|
@@ -146,12 +146,12 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
146
146
|
...s.length ? { hiddenColumns: s } : {},
|
|
147
147
|
...c ? { sample: c } : {}
|
|
148
148
|
};
|
|
149
|
-
},
|
|
149
|
+
}, be = ["onKeydown"], Z = ["placeholder", "aria-label"], Q = ["disabled"], $ = ["aria-label"], xe = { class: "pk-selection-actions__text" }, Se = {
|
|
150
150
|
key: 0,
|
|
151
151
|
class: "pk-selection-actions__text"
|
|
152
|
-
}, Ce = ["onClick"], we = /* @__PURE__ */
|
|
152
|
+
}, Ce = ["onClick"], we = /* @__PURE__ */ w({
|
|
153
153
|
__name: "PkSelectionActions",
|
|
154
|
-
props: /*@__PURE__*/
|
|
154
|
+
props: /*@__PURE__*/ D({
|
|
155
155
|
actions: {},
|
|
156
156
|
anchor: {},
|
|
157
157
|
strategy: {},
|
|
@@ -166,14 +166,14 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
166
166
|
},
|
|
167
167
|
askingModifiers: {}
|
|
168
168
|
}),
|
|
169
|
-
emits: /*@__PURE__*/
|
|
169
|
+
emits: /*@__PURE__*/ D([
|
|
170
170
|
"action",
|
|
171
171
|
"ask",
|
|
172
172
|
"note",
|
|
173
173
|
"close"
|
|
174
174
|
], ["update:asking"]),
|
|
175
175
|
setup(e, { emit: t }) {
|
|
176
|
-
let n = e, r = t, i = B(e, "asking"), { t: a } = oe({ useScope: "global" }), o = re("barEl"), s = re("inputEl"), { width: c, height: l } = se(o, void 0, { box: "border-box" }), d =
|
|
176
|
+
let n = e, r = t, i = B(e, "asking"), { t: a } = oe({ useScope: "global" }), o = re("barEl"), s = re("inputEl"), { width: c, height: l } = se(o, void 0, { box: "border-box" }), d = _(() => u({
|
|
177
177
|
...n.anchor,
|
|
178
178
|
bar: {
|
|
179
179
|
width: c.value,
|
|
@@ -184,34 +184,34 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
184
184
|
f.value = {
|
|
185
185
|
id: e,
|
|
186
186
|
placeholder: t
|
|
187
|
-
}, p.value = "", i.value = !0, await
|
|
187
|
+
}, p.value = "", i.value = !0, await te(), s.value?.focus();
|
|
188
188
|
}, h = () => {
|
|
189
189
|
f.value = void 0, i.value = !1;
|
|
190
|
-
},
|
|
190
|
+
}, ee = (e) => {
|
|
191
191
|
e.asks ? m(e.id, e.asks) : r("action", e.id);
|
|
192
|
-
},
|
|
192
|
+
}, v = () => {
|
|
193
193
|
let e = p.value.trim();
|
|
194
194
|
e && f.value && (f.value.id ? r("action", f.value.id, e) : r("ask", e), h());
|
|
195
|
-
},
|
|
195
|
+
}, S = () => {
|
|
196
196
|
f.value ? h() : r("close");
|
|
197
197
|
};
|
|
198
|
-
return (t, n) => (M(),
|
|
199
|
-
class:
|
|
198
|
+
return (t, n) => (M(), b("div", {
|
|
199
|
+
class: O(["pk-selection-actions", {
|
|
200
200
|
"pk-selection-actions--fixed": e.strategy === "fixed",
|
|
201
201
|
"pk-selection-actions--asking": !!f.value
|
|
202
202
|
}]),
|
|
203
|
-
style:
|
|
203
|
+
style: k({
|
|
204
204
|
top: `${d.value.top}px`,
|
|
205
205
|
left: `${d.value.left}px`
|
|
206
206
|
}),
|
|
207
|
-
onKeydown: ae(W(
|
|
208
|
-
}, [f.value ? (M(),
|
|
207
|
+
onKeydown: ae(W(S, ["stop"]), ["esc"])
|
|
208
|
+
}, [f.value ? (M(), b("form", {
|
|
209
209
|
key: 0,
|
|
210
210
|
ref_key: "barEl",
|
|
211
211
|
ref: o,
|
|
212
212
|
class: "pk-selection-actions__bar pk-selection-actions__bar--field",
|
|
213
|
-
onSubmit: W(
|
|
214
|
-
}, [U(
|
|
213
|
+
onSubmit: W(v, ["prevent"])
|
|
214
|
+
}, [U(x("input", {
|
|
215
215
|
ref_key: "inputEl",
|
|
216
216
|
ref: s,
|
|
217
217
|
"onUpdate:modelValue": n[0] ||= (e) => p.value = e,
|
|
@@ -220,39 +220,39 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
220
220
|
maxlength: "500",
|
|
221
221
|
placeholder: f.value.placeholder,
|
|
222
222
|
"aria-label": f.value.placeholder
|
|
223
|
-
}, null, 8,
|
|
223
|
+
}, null, 8, Z), [[V, p.value]]), x("button", {
|
|
224
224
|
type: "submit",
|
|
225
225
|
class: "pk-selection-actions__button pk-selection-actions__button--send",
|
|
226
226
|
disabled: !p.value.trim()
|
|
227
|
-
}, R(z(a)("action.send")), 9,
|
|
227
|
+
}, R(z(a)("action.send")), 9, Q)], 544)) : (M(), b("div", {
|
|
228
228
|
key: 1,
|
|
229
229
|
ref_key: "barEl",
|
|
230
230
|
ref: o,
|
|
231
231
|
class: "pk-selection-actions__bar",
|
|
232
232
|
role: "toolbar",
|
|
233
233
|
"aria-label": z(a)("selectionActions.label")
|
|
234
|
-
}, [e.note ? (M(),
|
|
234
|
+
}, [e.note ? (M(), b(g, { key: 0 }, [x("span", xe, R(e.note), 1), e.noteAction ? (M(), b("button", {
|
|
235
235
|
key: 0,
|
|
236
236
|
type: "button",
|
|
237
237
|
class: "pk-selection-actions__button",
|
|
238
238
|
onMousedown: n[1] ||= W(() => {}, ["prevent"]),
|
|
239
239
|
onClick: n[2] ||= (e) => r("note")
|
|
240
|
-
}, R(e.noteAction), 33)) :
|
|
241
|
-
e.hint ? (M(),
|
|
242
|
-
(M(!0),
|
|
240
|
+
}, R(e.noteAction), 33)) : y("", !0)], 64)) : (M(), b(g, { key: 1 }, [
|
|
241
|
+
e.hint ? (M(), b("span", Se, R(e.hint), 1)) : y("", !0),
|
|
242
|
+
(M(!0), b(g, null, F(e.actions, (e) => (M(), b("button", {
|
|
243
243
|
key: e.id,
|
|
244
244
|
type: "button",
|
|
245
245
|
class: "pk-selection-actions__button",
|
|
246
246
|
onMousedown: n[3] ||= W(() => {}, ["prevent"]),
|
|
247
|
-
onClick: (t) =>
|
|
247
|
+
onClick: (t) => ee(e)
|
|
248
248
|
}, R(e.label), 41, Ce))), 128)),
|
|
249
|
-
|
|
249
|
+
x("button", {
|
|
250
250
|
type: "button",
|
|
251
251
|
class: "pk-selection-actions__button",
|
|
252
252
|
onMousedown: n[4] ||= W(() => {}, ["prevent"]),
|
|
253
253
|
onClick: n[5] ||= (e) => m(void 0, z(a)("selectionActions.askPlaceholder"))
|
|
254
254
|
}, R(z(a)("selectionActions.ask")), 33)
|
|
255
|
-
], 64))], 8,
|
|
255
|
+
], 64))], 8, $)), I(t.$slots, "card")], 46, be));
|
|
256
256
|
}
|
|
257
257
|
}), Te = { class: "pk-spreadsheet-preview" }, Ee = { class: "pk-spreadsheet-preview__bar" }, De = ["aria-label"], Oe = ["aria-label"], ke = ["aria-label"], Ae = [
|
|
258
258
|
"rowspan",
|
|
@@ -270,28 +270,28 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
270
270
|
}, ze = {
|
|
271
271
|
key: 0,
|
|
272
272
|
class: "pk-spreadsheet-preview__average"
|
|
273
|
-
}, Be = { key: 1 }, Ve = { class: "pk-spreadsheet-preview__zoom" }, He = { class: "pk-spreadsheet-preview__percent" }, Ue = 64, We = 20, Ge = 28, Ke = 44, qe = /* @__PURE__ */
|
|
273
|
+
}, Be = { key: 1 }, Ve = { class: "pk-spreadsheet-preview__zoom" }, He = { class: "pk-spreadsheet-preview__percent" }, Ue = 64, We = 20, Ge = 28, Ke = 44, qe = /* @__PURE__ */ w({
|
|
274
274
|
__name: "PkSpreadsheetPreview",
|
|
275
|
-
props: /*@__PURE__*/
|
|
275
|
+
props: /*@__PURE__*/ D({ preview: {} }, {
|
|
276
276
|
sheet: { default: 0 },
|
|
277
277
|
sheetModifiers: {},
|
|
278
278
|
zoom: { default: 1 },
|
|
279
279
|
zoomModifiers: {}
|
|
280
280
|
}),
|
|
281
|
-
emits: /*@__PURE__*/
|
|
281
|
+
emits: /*@__PURE__*/ D(["select"], ["update:sheet", "update:zoom"]),
|
|
282
282
|
setup(e, { emit: t }) {
|
|
283
283
|
let o = e, s = t, { t: c, locale: l } = oe({ useScope: "global" }), u = B(e, "sheet"), d = B(e, "zoom"), f = re("scrollEl"), { width: p, height: m } = se(f, {
|
|
284
284
|
width: 0,
|
|
285
285
|
height: 0
|
|
286
|
-
}, { box: "border-box" }), h =
|
|
286
|
+
}, { box: "border-box" }), h = _(() => o.preview.sheets[u.value] ?? o.preview.sheets[0]);
|
|
287
287
|
H(() => o.preview, () => {
|
|
288
288
|
u.value = 0;
|
|
289
289
|
});
|
|
290
|
-
let
|
|
290
|
+
let ee = (e) => {
|
|
291
291
|
let t = "";
|
|
292
292
|
for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
|
|
293
293
|
return t;
|
|
294
|
-
},
|
|
294
|
+
}, v = _(() => {
|
|
295
295
|
let e = h.value;
|
|
296
296
|
if (!e) return [];
|
|
297
297
|
let t = new Set(e.columns.filter((e) => e.hidden).map((e) => e.col)), n = new Map(e.columns.map((e) => [e.col, e.width])), r = [], i = Ke, a = p.value / d.value;
|
|
@@ -304,11 +304,11 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
304
304
|
}), i += e;
|
|
305
305
|
}
|
|
306
306
|
return r;
|
|
307
|
-
}),
|
|
307
|
+
}), w = _(() => v.value.reduce((e, t) => e + t.width, Ke)), T = _(() => v.value.map((e) => `${e.col}:${e.width}`).join(",")), D = /* @__PURE__ */ new WeakMap(), A = _(() => {
|
|
308
308
|
let e = h.value;
|
|
309
309
|
if (!e) return [];
|
|
310
|
-
let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((m.value / d.value - Ge) / We), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a =
|
|
311
|
-
a || (a = /* @__PURE__ */ new Map(),
|
|
310
|
+
let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((m.value / d.value - Ge) / We), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a = D.get(e);
|
|
311
|
+
a || (a = /* @__PURE__ */ new Map(), D.set(e, a));
|
|
312
312
|
let o = a;
|
|
313
313
|
return Array.from({ length: i }, (e, t) => t + 1).filter((e) => !t.has(e)).map((e) => {
|
|
314
314
|
let t = o.get(e);
|
|
@@ -317,11 +317,11 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
317
317
|
height: n.get(e) ?? We
|
|
318
318
|
}, o.set(e, t)), t;
|
|
319
319
|
});
|
|
320
|
-
}), ne =
|
|
320
|
+
}), ne = _(() => {
|
|
321
321
|
let e = /* @__PURE__ */ new Map();
|
|
322
322
|
for (let t of h.value?.rows ?? []) for (let n of t.cells) e.set(`${t.row},${n.col}`, n);
|
|
323
323
|
return e;
|
|
324
|
-
}), j =
|
|
324
|
+
}), j = _(() => {
|
|
325
325
|
let e = /* @__PURE__ */ new Map();
|
|
326
326
|
for (let t of h.value?.rows ?? []) for (let n of t.cells) if (n.span) for (let r = 0; r < n.span.rows; r++) for (let i = 0; i < n.span.cols; i++) (r || i) && e.set(`${t.row + r},${n.col + i}`, {
|
|
327
327
|
row: t.row,
|
|
@@ -331,8 +331,8 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
331
331
|
}), N = (e, t) => ne.value.get(`${e},${t}`), I = (e, t) => {
|
|
332
332
|
let n = N(e, t)?.span;
|
|
333
333
|
if (n) return {
|
|
334
|
-
rows:
|
|
335
|
-
cols:
|
|
334
|
+
rows: A.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
|
|
335
|
+
cols: v.value.filter((e) => e.col >= t && e.col < t + n.cols).length
|
|
336
336
|
};
|
|
337
337
|
}, L = (e) => e?.style === void 0 ? void 0 : o.preview.styles[e.style], V = (e) => {
|
|
338
338
|
let t = e.numFmt === void 0 ? void 0 : o.preview.numberFormats?.[e.numFmt], a = e.value;
|
|
@@ -391,47 +391,90 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
391
391
|
let e = `${4 + r.indent * 9}px`;
|
|
392
392
|
o.textAlign === "right" ? o.paddingRight = e : o.paddingLeft = e;
|
|
393
393
|
}
|
|
394
|
-
return o.borderTop = K(r?.borders?.top), o.borderRight = K(r?.borders?.right), o.borderBottom = K(r?.borders?.bottom), o.borderLeft = K(r?.borders?.left), Object.assign(o,
|
|
394
|
+
return le(t, n) ? (o.borderStyle = "hidden", o.boxShadow = ge(e, t, n)) : (o.borderTop = K(r?.borders?.top), o.borderRight = K(r?.borders?.right), o.borderBottom = K(r?.borders?.bottom), o.borderLeft = K(r?.borders?.left), o.boxShadow = J(e, t, n).join(", ")), Object.assign(o, be(t, n)), o;
|
|
395
395
|
}, le = (e, t) => {
|
|
396
|
+
let n = h.value?.frozen;
|
|
397
|
+
return !!n && (e <= n.rows || t <= n.cols);
|
|
398
|
+
}, ue = {
|
|
399
|
+
top: (e) => `inset 0 ${e.width}px 0 ${e.color}`,
|
|
400
|
+
right: (e) => `inset -${e.width}px 0 0 ${e.color}`,
|
|
401
|
+
bottom: (e) => `inset 0 -${e.width}px 0 ${e.color}`,
|
|
402
|
+
left: (e) => `inset ${e.width}px 0 0 ${e.color}`
|
|
403
|
+
}, q = (...e) => e.reduce((e, t) => t && (!e || t.width > e.width) ? t : e, void 0), J = (e, t, n) => {
|
|
404
|
+
let r = L(e)?.borders;
|
|
405
|
+
return [t === A.value[0]?.row && r?.top && ue.top(r.top), n === v.value[0]?.col && r?.left && ue.left(r.left)].filter((e) => !!e);
|
|
406
|
+
}, Y = _(() => A.value.map((e) => e.row)), de = _(() => v.value.map((e) => e.col)), fe = _(() => new Map(Y.value.map((e, t) => [e, t]))), pe = _(() => new Map(de.value.map((e, t) => [e, t]))), me = (e, t, n, r) => {
|
|
407
|
+
let i = [], a = t.get(n) ?? e.length;
|
|
408
|
+
for (; a < e.length && e[a] < n + r; a++) i.push(e[a]);
|
|
409
|
+
return {
|
|
410
|
+
spanned: i,
|
|
411
|
+
next: e[a]
|
|
412
|
+
};
|
|
413
|
+
}, he = (e, t, n, r) => {
|
|
414
|
+
let { spanned: i, next: a } = me(Y.value, fe.value, t, e?.span?.rows ?? 1), { spanned: o, next: s } = me(de.value, pe.value, n, e?.span?.cols ?? 1);
|
|
415
|
+
return (r === "right" ? s === void 0 ? [] : i.map((e) => ({
|
|
416
|
+
row: e,
|
|
417
|
+
col: s
|
|
418
|
+
})) : a === void 0 ? [] : o.map((e) => ({
|
|
419
|
+
row: a,
|
|
420
|
+
col: e
|
|
421
|
+
}))).map((e) => {
|
|
422
|
+
let t = j.value.get(`${e.row},${e.col}`) ?? e;
|
|
423
|
+
return N(t.row, t.col);
|
|
424
|
+
});
|
|
425
|
+
}, ge = (e, t, n) => {
|
|
426
|
+
let r = L(e)?.borders, i = q(r?.right, ...he(e, t, n, "right").map((e) => L(e)?.borders?.left)), a = q(r?.bottom, ...he(e, t, n, "bottom").map((e) => L(e)?.borders?.top)), o = h.value?.gridlines;
|
|
427
|
+
return [
|
|
428
|
+
i ? ue.right(i) : o && "inset calc(var(--border) * -1) 0 0 var(--pk-spreadsheet-gridline)",
|
|
429
|
+
a ? ue.bottom(a) : o && "inset 0 calc(var(--border) * -1) 0 var(--pk-spreadsheet-gridline)",
|
|
430
|
+
...J(e, t, n)
|
|
431
|
+
].filter(Boolean).join(", ");
|
|
432
|
+
}, _e = (e) => Ge + A.value.filter((t) => t.row < e).reduce((e, t) => e + t.height, 0), ve = (e) => Ke + v.value.filter((t) => t.col < e).reduce((e, t) => e + t.width, 0), X = _(() => {
|
|
433
|
+
let e = h.value?.frozen;
|
|
434
|
+
return {
|
|
435
|
+
top: _e((e?.rows ?? 0) + 1),
|
|
436
|
+
left: ve((e?.cols ?? 0) + 1)
|
|
437
|
+
};
|
|
438
|
+
}), be = (e, t) => {
|
|
396
439
|
let n = h.value?.frozen;
|
|
397
440
|
if (!n) return {};
|
|
398
441
|
let r = {};
|
|
399
|
-
return e <= n.rows && (r.position = "sticky", r.top = `${
|
|
400
|
-
},
|
|
442
|
+
return e <= n.rows && (r.position = "sticky", r.top = `${_e(e)}px`, r.scrollMarginTop = r.top, r.zIndex = 0), t <= n.cols && (r.position = "sticky", r.left = `${ve(t)}px`, r.scrollMarginLeft = r.left, r.zIndex = +(e <= n.rows)), r;
|
|
443
|
+
}, Z = P({
|
|
401
444
|
row: 1,
|
|
402
445
|
col: 1
|
|
403
|
-
}),
|
|
446
|
+
}), Q = P({
|
|
404
447
|
row: 1,
|
|
405
448
|
col: 1
|
|
406
449
|
});
|
|
407
450
|
H(h, () => {
|
|
408
|
-
|
|
451
|
+
Z.value = {
|
|
409
452
|
row: 1,
|
|
410
453
|
col: 1
|
|
411
|
-
},
|
|
454
|
+
}, Q.value = {
|
|
412
455
|
row: 1,
|
|
413
456
|
col: 1
|
|
414
457
|
};
|
|
415
458
|
});
|
|
416
|
-
let
|
|
417
|
-
r1: Math.min(
|
|
418
|
-
r2: Math.max(
|
|
419
|
-
c1: Math.min(
|
|
420
|
-
c2: Math.max(
|
|
421
|
-
})),
|
|
422
|
-
f.value?.focus({ preventScroll: !0 }),
|
|
459
|
+
let $ = _(() => ({
|
|
460
|
+
r1: Math.min(Z.value.row, Q.value.row),
|
|
461
|
+
r2: Math.max(Z.value.row, Q.value.row),
|
|
462
|
+
c1: Math.min(Z.value.col, Q.value.col),
|
|
463
|
+
c2: Math.max(Z.value.col, Q.value.col)
|
|
464
|
+
})), xe = (e, t) => e >= $.value.r1 && e <= $.value.r2 && t >= $.value.c1 && t <= $.value.c2, Se = (e, t) => Q.value.row === e && Q.value.col === t, Ce = (e) => e >= $.value.r1 && e <= $.value.r2 ? `${$.value.c1}:${$.value.c2}:${Q.value.row === e ? Q.value.col : 0}` : "", we = P(!1), qe = (e, t, n) => {
|
|
465
|
+
f.value?.focus({ preventScroll: !0 }), Q.value = {
|
|
423
466
|
row: e,
|
|
424
467
|
col: t
|
|
425
|
-
}, n.shiftKey || (
|
|
468
|
+
}, n.shiftKey || (Z.value = {
|
|
426
469
|
row: e,
|
|
427
470
|
col: t
|
|
428
|
-
}),
|
|
429
|
-
},
|
|
430
|
-
|
|
471
|
+
}), we.value = !0;
|
|
472
|
+
}, Je = (e, t) => {
|
|
473
|
+
we.value && (Q.value = {
|
|
431
474
|
row: e,
|
|
432
475
|
col: t
|
|
433
476
|
});
|
|
434
|
-
},
|
|
477
|
+
}, Ye, Xe = () => {
|
|
435
478
|
let e = [...f.value?.querySelectorAll(".pk-spreadsheet-preview__cell--range, [data-focus]") ?? []].map((e) => e.getBoundingClientRect());
|
|
436
479
|
if (e.length) return {
|
|
437
480
|
start: {
|
|
@@ -440,19 +483,19 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
440
483
|
},
|
|
441
484
|
bottom: Math.max(...e.map((e) => e.bottom))
|
|
442
485
|
};
|
|
443
|
-
},
|
|
444
|
-
...
|
|
445
|
-
measure:
|
|
486
|
+
}, Ze = () => h.value ? {
|
|
487
|
+
...ye(h.value, $.value),
|
|
488
|
+
measure: Xe
|
|
446
489
|
} : void 0;
|
|
447
|
-
H([
|
|
448
|
-
clearTimeout(
|
|
449
|
-
let e =
|
|
450
|
-
s("select", t ?
|
|
490
|
+
H([$, we], () => {
|
|
491
|
+
clearTimeout(Ye), !we.value && (Ye = setTimeout(() => {
|
|
492
|
+
let e = $.value, t = e.r2 > e.r1 || e.c2 > e.c1;
|
|
493
|
+
s("select", t ? Ze() : void 0);
|
|
451
494
|
}, 150));
|
|
452
495
|
});
|
|
453
|
-
let
|
|
454
|
-
clearTimeout(
|
|
455
|
-
},
|
|
496
|
+
let Qe = () => {
|
|
497
|
+
clearTimeout(Ye), s("select", Ze());
|
|
498
|
+
}, $e = (e) => {
|
|
456
499
|
let t = {
|
|
457
500
|
ArrowUp: [-1, 0],
|
|
458
501
|
ArrowDown: [1, 0],
|
|
@@ -463,7 +506,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
463
506
|
}[e.key];
|
|
464
507
|
if (!t) return;
|
|
465
508
|
e.preventDefault();
|
|
466
|
-
let n =
|
|
509
|
+
let n = A.value.map((e) => e.row), r = v.value.map((e) => e.col), i = (e) => j.value.get(`${e.row},${e.col}`) ?? e, a = i(Q.value), o = n.indexOf(Q.value.row), s = r.indexOf(Q.value.col), c = a;
|
|
467
510
|
for (;;) {
|
|
468
511
|
let e = Math.min(n.length - 1, Math.max(0, o + t[0])), l = Math.min(r.length - 1, Math.max(0, s + t[1]));
|
|
469
512
|
if (e === o && l === s || (o = e, s = l, c = i({
|
|
@@ -471,12 +514,12 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
471
514
|
col: r[s]
|
|
472
515
|
}), c.row !== a.row || c.col !== a.col)) break;
|
|
473
516
|
}
|
|
474
|
-
|
|
517
|
+
Q.value = c, e.shiftKey || (Z.value = c), te(() => f.value?.querySelector("[data-focus]")?.scrollIntoView({
|
|
475
518
|
block: "nearest",
|
|
476
519
|
inline: "nearest"
|
|
477
520
|
}));
|
|
478
|
-
},
|
|
479
|
-
let { r1: e, r2: t, c1: n, c2: r } =
|
|
521
|
+
}, et = _(() => N(Q.value.row, Q.value.col)), tt = _(() => {
|
|
522
|
+
let { r1: e, r2: t, c1: n, c2: r } = $.value;
|
|
480
523
|
if (e === t && n === r) return;
|
|
481
524
|
let i = 0, a = 0, o = 0, s;
|
|
482
525
|
for (let c = e; c <= t; c++) for (let e = n; e <= r; e++) {
|
|
@@ -488,128 +531,134 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
488
531
|
sum: s ? ie(s, a) : void 0,
|
|
489
532
|
average: s ? ie(s, a / o) : void 0
|
|
490
533
|
};
|
|
491
|
-
}),
|
|
534
|
+
}), nt = (e) => {
|
|
492
535
|
d.value = Math.min(2, Math.max(.5, Math.round((d.value + e) * 10) / 10));
|
|
493
536
|
};
|
|
494
537
|
return (t, n) => {
|
|
495
538
|
let r = a;
|
|
496
|
-
return M(),
|
|
497
|
-
|
|
498
|
-
|
|
539
|
+
return M(), b("div", Te, [
|
|
540
|
+
x("div", Ee, [
|
|
541
|
+
x("span", {
|
|
499
542
|
class: "pk-spreadsheet-preview__ref",
|
|
500
543
|
"aria-label": z(c)("chatFilePreview.cell")
|
|
501
|
-
}, R(
|
|
502
|
-
n[6] ||=
|
|
544
|
+
}, R(ee(Q.value.col)) + R(Q.value.row), 9, De),
|
|
545
|
+
n[6] ||= x("span", {
|
|
503
546
|
class: "pk-spreadsheet-preview__fx",
|
|
504
547
|
"aria-hidden": "true"
|
|
505
548
|
}, "fx", -1),
|
|
506
|
-
|
|
549
|
+
x("output", {
|
|
507
550
|
class: "pk-spreadsheet-preview__formula",
|
|
508
551
|
"aria-label": z(c)("chatFilePreview.formulaBar")
|
|
509
|
-
}, R(G(
|
|
552
|
+
}, R(G(et.value)), 9, Oe)
|
|
510
553
|
]),
|
|
511
|
-
|
|
554
|
+
x("div", {
|
|
512
555
|
ref_key: "scrollEl",
|
|
513
556
|
ref: f,
|
|
514
557
|
class: "pk-spreadsheet-preview__scroll",
|
|
515
558
|
tabindex: "0",
|
|
516
559
|
role: "grid",
|
|
517
560
|
"aria-label": h.value?.name,
|
|
518
|
-
onKeydown:
|
|
519
|
-
onMouseup: n[2] ||= (e) =>
|
|
520
|
-
onMouseleave: n[3] ||= (e) =>
|
|
521
|
-
}, [h.value ? (M(),
|
|
561
|
+
onKeydown: $e,
|
|
562
|
+
onMouseup: n[2] ||= (e) => we.value = !1,
|
|
563
|
+
onMouseleave: n[3] ||= (e) => we.value = !1
|
|
564
|
+
}, [h.value ? (M(), b("table", {
|
|
522
565
|
key: 0,
|
|
523
|
-
class:
|
|
524
|
-
style:
|
|
566
|
+
class: O(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": h.value.gridlines }]),
|
|
567
|
+
style: k({
|
|
525
568
|
zoom: d.value,
|
|
526
|
-
width: `${
|
|
569
|
+
width: `${w.value}px`,
|
|
570
|
+
"--pk-spreadsheet-stuck-top": `${X.value.top}px`,
|
|
571
|
+
"--pk-spreadsheet-stuck-left": `${X.value.left}px`
|
|
527
572
|
})
|
|
528
573
|
}, [
|
|
529
|
-
|
|
574
|
+
x("colgroup", null, [x("col", { style: k({ width: `${Ke}px` }) }, null, 4), (M(!0), b(g, null, F(v.value, (e) => (M(), b("col", {
|
|
530
575
|
key: e.col,
|
|
531
|
-
style:
|
|
576
|
+
style: k({ width: `${e.width}px` })
|
|
532
577
|
}, null, 4))), 128))]),
|
|
533
|
-
|
|
578
|
+
x("thead", null, [x("tr", { style: k({ height: `${Ge}px` }) }, [n[7] ||= x("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (M(!0), b(g, null, F(v.value, (e) => (M(), b("th", {
|
|
534
579
|
key: e.col,
|
|
535
580
|
scope: "col",
|
|
536
|
-
class:
|
|
537
|
-
|
|
538
|
-
|
|
581
|
+
class: O(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= $.value.c1 && e.col <= $.value.c2 }]),
|
|
582
|
+
style: k(h.value.frozen && e.col <= h.value.frozen.cols ? {
|
|
583
|
+
left: `${ve(e.col)}px`,
|
|
584
|
+
zIndex: 2
|
|
585
|
+
} : void 0)
|
|
586
|
+
}, R(ee(e.col)), 7))), 128))], 4)]),
|
|
587
|
+
x("tbody", null, [(M(!0), b(g, null, F(A.value, (e, t, n, r) => {
|
|
539
588
|
let i = [
|
|
540
589
|
e,
|
|
541
590
|
h.value,
|
|
542
|
-
|
|
591
|
+
T.value,
|
|
543
592
|
z(l),
|
|
544
|
-
|
|
593
|
+
Ce(e.row)
|
|
545
594
|
];
|
|
546
|
-
if (r && r.el && r.key === e.row &&
|
|
547
|
-
let a = (M(),
|
|
595
|
+
if (r && r.el && r.key === e.row && E(r, i)) return r;
|
|
596
|
+
let a = (M(), b("tr", {
|
|
548
597
|
key: e.row,
|
|
549
|
-
style:
|
|
550
|
-
}, [
|
|
598
|
+
style: k({ height: `${e.height}px` })
|
|
599
|
+
}, [x("th", {
|
|
551
600
|
scope: "row",
|
|
552
|
-
class:
|
|
553
|
-
style:
|
|
554
|
-
...
|
|
601
|
+
class: O(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= $.value.r1 && e.row <= $.value.r2 }]),
|
|
602
|
+
style: k(h.value.frozen && e.row <= h.value.frozen.rows ? {
|
|
603
|
+
...be(e.row, 0),
|
|
555
604
|
left: 0,
|
|
556
605
|
zIndex: 4
|
|
557
606
|
} : void 0)
|
|
558
|
-
}, R(e.row), 7), (M(!0),
|
|
607
|
+
}, R(e.row), 7), (M(!0), b(g, null, F(v.value, (t) => (M(), b(g, { key: t.col }, [j.value.has(`${e.row},${t.col}`) ? y("", !0) : (M(), b("td", {
|
|
559
608
|
key: 0,
|
|
560
609
|
rowspan: I(e.row, t.col)?.rows,
|
|
561
610
|
colspan: I(e.row, t.col)?.cols,
|
|
562
|
-
class:
|
|
563
|
-
"pk-spreadsheet-preview__cell--range":
|
|
611
|
+
class: O(["pk-spreadsheet-preview__cell", {
|
|
612
|
+
"pk-spreadsheet-preview__cell--range": xe(e.row, t.col) && !Se(e.row, t.col),
|
|
564
613
|
"pk-spreadsheet-preview__cell--missing": N(e.row, t.col)?.missing
|
|
565
614
|
}]),
|
|
566
|
-
style:
|
|
567
|
-
"data-focus":
|
|
615
|
+
style: k(ce(N(e.row, t.col), e.row, t.col)),
|
|
616
|
+
"data-focus": Se(e.row, t.col) ? "" : void 0,
|
|
568
617
|
title: N(e.row, t.col)?.missing ? z(c)("chatFilePreview.missingValue") : void 0,
|
|
569
|
-
onMousedown: W((n) =>
|
|
570
|
-
onMouseenter: (n) =>
|
|
571
|
-
onDblclick:
|
|
618
|
+
onMousedown: W((n) => qe(e.row, t.col, n), ["prevent"]),
|
|
619
|
+
onMouseenter: (n) => Je(e.row, t.col),
|
|
620
|
+
onDblclick: Qe
|
|
572
621
|
}, R(ae(N(e.row, t.col))), 47, Ae))], 64))), 128))], 4));
|
|
573
622
|
return a.memo = i, a;
|
|
574
623
|
}, n, 0), 128))])
|
|
575
|
-
], 6)) :
|
|
576
|
-
|
|
624
|
+
], 6)) : y("", !0), h.value && (h.value.moreRows || h.value.moreColumns) ? (M(), b("p", je, [h.value.moreRows ? (M(), b(g, { key: 0 }, [S(R(z(c)("chatFilePreview.moreRows", h.value.moreRows)), 1)], 64)) : y("", !0), h.value.moreColumns ? (M(), b(g, { key: 1 }, [S(R(z(c)("chatFilePreview.moreColumns", h.value.moreColumns)), 1)], 64)) : y("", !0)])) : y("", !0)], 40, ke),
|
|
625
|
+
x("nav", {
|
|
577
626
|
class: "pk-spreadsheet-preview__sheets",
|
|
578
627
|
"aria-label": z(c)("chatFilePreview.sheets")
|
|
579
|
-
}, [(M(!0),
|
|
628
|
+
}, [(M(!0), b(g, null, F(e.preview.sheets, (e, t) => (M(), b("button", {
|
|
580
629
|
key: e.name,
|
|
581
630
|
type: "button",
|
|
582
631
|
class: "pk-spreadsheet-preview__sheet",
|
|
583
632
|
"aria-current": t === u.value ? "page" : void 0,
|
|
584
633
|
onClick: (e) => u.value = t
|
|
585
634
|
}, R(e.name), 9, Ne))), 128))], 8, Me),
|
|
586
|
-
|
|
635
|
+
x("div", Pe, [x("p", Fe, [e.preview.staleFormulas ? (M(), b("span", {
|
|
587
636
|
key: 0,
|
|
588
637
|
class: "pk-spreadsheet-preview__note",
|
|
589
638
|
title: z(c)("chatFilePreview.staleFormulas")
|
|
590
|
-
}, R(z(c)("chatFilePreview.staleFormulas")), 9, Ie)) : e.preview.computedFormulas ? (M(),
|
|
639
|
+
}, R(z(c)("chatFilePreview.staleFormulas")), 9, Ie)) : e.preview.computedFormulas ? (M(), b("span", {
|
|
591
640
|
key: 1,
|
|
592
641
|
class: "pk-spreadsheet-preview__note",
|
|
593
642
|
title: z(c)("chatFilePreview.computedFormulas")
|
|
594
|
-
}, R(z(c)("chatFilePreview.computedFormulas")), 9, Le)) :
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
])) :
|
|
599
|
-
|
|
643
|
+
}, R(z(c)("chatFilePreview.computedFormulas")), 9, Le)) : y("", !0), tt.value ? (M(), b("span", Re, [
|
|
644
|
+
tt.value.average ? (M(), b("span", ze, R(z(c)("chatFilePreview.average")) + " " + R(tt.value.average), 1)) : y("", !0),
|
|
645
|
+
x("span", null, R(z(c)("chatFilePreview.count")) + " " + R(tt.value.count), 1),
|
|
646
|
+
tt.value.sum ? (M(), b("span", Be, R(z(c)("chatFilePreview.sum")) + " " + R(tt.value.sum), 1)) : y("", !0)
|
|
647
|
+
])) : y("", !0)]), x("div", Ve, [
|
|
648
|
+
C(r, {
|
|
600
649
|
modifiers: "action-quiet",
|
|
601
650
|
icon: "ri:subtract-line",
|
|
602
651
|
"aria-label": z(c)("chatFilePreview.zoomOut"),
|
|
603
652
|
disabled: d.value <= .5,
|
|
604
|
-
onClick: n[4] ||= (e) =>
|
|
653
|
+
onClick: n[4] ||= (e) => nt(-.1)
|
|
605
654
|
}, null, 8, ["aria-label", "disabled"]),
|
|
606
|
-
|
|
607
|
-
|
|
655
|
+
x("span", He, R(Math.round(d.value * 100)) + "% ", 1),
|
|
656
|
+
C(r, {
|
|
608
657
|
modifiers: "action-quiet",
|
|
609
658
|
icon: "ri:add-line",
|
|
610
659
|
"aria-label": z(c)("chatFilePreview.zoomIn"),
|
|
611
660
|
disabled: d.value >= 2,
|
|
612
|
-
onClick: n[5] ||= (e) =>
|
|
661
|
+
onClick: n[5] ||= (e) => nt(.1)
|
|
613
662
|
}, null, 8, ["aria-label", "disabled"])
|
|
614
663
|
])])
|
|
615
664
|
]);
|
|
@@ -619,7 +668,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
619
668
|
key: 1,
|
|
620
669
|
class: "pk-word-preview__image",
|
|
621
670
|
"data-quote-skip": ""
|
|
622
|
-
}, Xe = ["title"], Ze = ["title"], Qe = ["data-quote-skip"], $e = /* @__PURE__ */
|
|
671
|
+
}, Xe = ["title"], Ze = ["title"], Qe = ["data-quote-skip"], $e = /* @__PURE__ */ w({
|
|
623
672
|
__name: "PkWordPreviewRuns",
|
|
624
673
|
props: {
|
|
625
674
|
runs: {},
|
|
@@ -628,7 +677,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
628
677
|
numbers: {}
|
|
629
678
|
},
|
|
630
679
|
setup(e) {
|
|
631
|
-
let t = e, { t: n } = oe({ useScope: "global" }), r =
|
|
680
|
+
let t = e, { t: n } = oe({ useScope: "global" }), r = T(m, void 0), i = (e) => e.picture ? c(r?.value, e.picture.ref) : void 0, a = (e) => t.page ? h(e) : "inline", o = (e) => {
|
|
632
681
|
let n = {
|
|
633
682
|
width: `${e.width}pt`,
|
|
634
683
|
aspectRatio: `${e.width} / ${e.height}`
|
|
@@ -655,41 +704,41 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
655
704
|
top: `${r.y}pt`,
|
|
656
705
|
zIndex: r.wrap === "behind" ? -1 : 1
|
|
657
706
|
};
|
|
658
|
-
}, l = (e) => e.field && t.numbers ? String(t.numbers[e.field]) : e.text, u =
|
|
707
|
+
}, l = (e) => e.field && t.numbers ? String(t.numbers[e.field]) : e.text, u = _(() => {
|
|
659
708
|
let e = d(t.runs, t.mode ?? "markup"), n = (e) => !!e.picture && !!t.page && ["around", "block"].includes(h(e.picture));
|
|
660
709
|
return [...e.filter(n), ...e.filter((e) => !n(e))];
|
|
661
|
-
}), f =
|
|
710
|
+
}), f = _(() => !t.mode || t.mode === "markup"), p = (e) => {
|
|
662
711
|
let t = {};
|
|
663
712
|
e.font && (t.fontFamily = s(e.font)), t.fontSize = e.size ? `${e.size}pt` : "var(--pk-word-size)", e.color && (t.color = e.color), e.highlight && (t.backgroundColor = e.highlight), e.bold && (t.fontWeight = 700), e.italic && (t.fontStyle = "italic");
|
|
664
713
|
let n = [e.underline ? "underline" : "", e.strike ? "line-through" : ""].filter(Boolean).join(" ");
|
|
665
714
|
return n && (t.textDecoration = n), e.caps && (t.textTransform = "uppercase"), e.vertAlign && (t.verticalAlign = e.vertAlign, t.fontSize = `${(e.size ?? 11) * .65}pt`), t;
|
|
666
|
-
},
|
|
715
|
+
}, ee = (e) => {
|
|
667
716
|
let t = p(e), n = new Set(String(t.textDecoration ?? "").split(" ").filter(Boolean));
|
|
668
717
|
return n.add(e.change === "deleted" ? "line-through" : "underline"), {
|
|
669
718
|
...t,
|
|
670
719
|
textDecoration: [...n].join(" ")
|
|
671
720
|
};
|
|
672
|
-
},
|
|
673
|
-
return (e, t) => (M(!0),
|
|
721
|
+
}, v = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
|
|
722
|
+
return (e, t) => (M(!0), b(g, null, F(u.value, (e, t) => (M(), b(g, { key: t }, [e.image ? (M(), b(g, { key: 0 }, [e.picture && i(e) ? (M(), b(g, { key: 0 }, [a(e.picture) === "page" ? y("", !0) : (M(), b("img", {
|
|
674
723
|
key: 0,
|
|
675
|
-
class:
|
|
676
|
-
style:
|
|
724
|
+
class: O(["pk-word-preview__picture", `pk-word-preview__picture--${a(e.picture)}`]),
|
|
725
|
+
style: k(o(e.picture)),
|
|
677
726
|
src: i(e),
|
|
678
727
|
alt: ""
|
|
679
|
-
}, null, 14, Je))], 64)) : (M(),
|
|
728
|
+
}, null, 14, Je))], 64)) : (M(), b("span", Ye, R(z(n)("chatFilePreview.image")), 1))], 64)) : f.value && e.change === "deleted" ? (M(), b("del", {
|
|
680
729
|
key: 1,
|
|
681
730
|
class: "pk-word-preview__removed",
|
|
682
731
|
"data-quote-skip": "",
|
|
683
|
-
style:
|
|
684
|
-
title:
|
|
685
|
-
}, R(l(e)), 13, Xe)) : f.value && e.change === "inserted" ? (M(),
|
|
732
|
+
style: k(ee(e)),
|
|
733
|
+
title: v(e)
|
|
734
|
+
}, R(l(e)), 13, Xe)) : f.value && e.change === "inserted" ? (M(), b("ins", {
|
|
686
735
|
key: 2,
|
|
687
736
|
class: "pk-word-preview__added",
|
|
688
|
-
style:
|
|
689
|
-
title:
|
|
690
|
-
}, R(l(e)), 13, Ze)) : (M(),
|
|
737
|
+
style: k(ee(e)),
|
|
738
|
+
title: v(e)
|
|
739
|
+
}, R(l(e)), 13, Ze)) : (M(), b("span", {
|
|
691
740
|
key: 3,
|
|
692
|
-
style:
|
|
741
|
+
style: k(p(e)),
|
|
693
742
|
"data-quote-skip": e.label ? "" : void 0
|
|
694
743
|
}, R(l(e)), 13, Qe))], 64))), 128));
|
|
695
744
|
}
|
|
@@ -697,7 +746,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
697
746
|
"data-paragraph",
|
|
698
747
|
"role",
|
|
699
748
|
"aria-level"
|
|
700
|
-
], rt = { key: 1 }, it = /* @__PURE__ */
|
|
749
|
+
], rt = { key: 1 }, it = /* @__PURE__ */ w({
|
|
701
750
|
__name: "PkWordPreviewBlock",
|
|
702
751
|
props: {
|
|
703
752
|
block: {},
|
|
@@ -707,7 +756,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
707
756
|
numbers: {}
|
|
708
757
|
},
|
|
709
758
|
setup(e) {
|
|
710
|
-
let t = e, n =
|
|
759
|
+
let t = e, n = _(() => {
|
|
711
760
|
if (t.block.kind === "table") return {};
|
|
712
761
|
let e = t.block.style ?? {};
|
|
713
762
|
return {
|
|
@@ -721,35 +770,35 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
721
770
|
backgroundColor: e.shading,
|
|
722
771
|
fontSize: e.size ? `${e.size}pt` : void 0
|
|
723
772
|
};
|
|
724
|
-
}), r =
|
|
773
|
+
}), r = _(() => {
|
|
725
774
|
if (t.block.kind === "table") return {};
|
|
726
775
|
let e = -(t.block.style?.firstLine ?? 0);
|
|
727
776
|
return e > 0 ? { minWidth: `${e}pt` } : { paddingRight: "6pt" };
|
|
728
|
-
}), i =
|
|
777
|
+
}), i = _(() => t.mode === "markup" && t.block.kind !== "table" && t.block.runs.some((e) => e.change)), a = _(() => t.block.kind === "table" && t.row !== void 0 ? t.block.rows[t.row] : void 0), o = _(() => {
|
|
729
778
|
if (t.block.kind !== "table") return [];
|
|
730
779
|
let e = t.block.widths ?? [], n = e.reduce((e, t) => e + t, 0);
|
|
731
780
|
return n ? e.map((e) => `${e / n * 100}%`) : [];
|
|
732
|
-
}), s =
|
|
733
|
-
return (t, c) => e.block.kind === "table" && a.value ? (M(),
|
|
781
|
+
}), s = _(() => t.mode === "markup" && !!a.value?.some((e) => e.runs.some((e) => e.change)));
|
|
782
|
+
return (t, c) => e.block.kind === "table" && a.value ? (M(), b("table", {
|
|
734
783
|
key: 0,
|
|
735
|
-
class:
|
|
784
|
+
class: O(["pk-word-preview__table", {
|
|
736
785
|
"pk-word-preview__table--lines": e.block.borders,
|
|
737
786
|
"pk-word-preview__table--next": e.row !== 0,
|
|
738
787
|
"pk-word-preview__changed": s.value
|
|
739
788
|
}])
|
|
740
|
-
}, [o.value.length ? (M(),
|
|
789
|
+
}, [o.value.length ? (M(), b("colgroup", et, [(M(!0), b(g, null, F(o.value, (e, t) => (M(), b("col", {
|
|
741
790
|
key: t,
|
|
742
|
-
style:
|
|
743
|
-
}, null, 4))), 128))])) :
|
|
791
|
+
style: k({ width: e })
|
|
792
|
+
}, null, 4))), 128))])) : y("", !0), x("tbody", null, [x("tr", null, [(M(!0), b(g, null, F(a.value, (t, n) => (M(), b("td", {
|
|
744
793
|
key: n,
|
|
745
794
|
"data-paragraph": t.ids?.join(" "),
|
|
746
795
|
colspan: t.span,
|
|
747
|
-
style:
|
|
796
|
+
style: k({
|
|
748
797
|
backgroundColor: t.fill,
|
|
749
798
|
textAlign: t.align,
|
|
750
799
|
fontSize: t.size ? `${t.size}pt` : void 0
|
|
751
800
|
})
|
|
752
|
-
}, [
|
|
801
|
+
}, [C($e, {
|
|
753
802
|
runs: t.runs,
|
|
754
803
|
mode: e.mode,
|
|
755
804
|
numbers: e.numbers
|
|
@@ -757,21 +806,21 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
757
806
|
"runs",
|
|
758
807
|
"mode",
|
|
759
808
|
"numbers"
|
|
760
|
-
])], 12, tt))), 128))])])], 2)) : e.block.kind === "table" ?
|
|
809
|
+
])], 12, tt))), 128))])])], 2)) : e.block.kind === "table" ? y("", !0) : (M(), b("div", {
|
|
761
810
|
key: 1,
|
|
762
|
-
class:
|
|
811
|
+
class: O(["pk-word-preview__block", { "pk-word-preview__changed": i.value }]),
|
|
763
812
|
"data-paragraph": e.block.id,
|
|
764
813
|
role: e.block.kind === "heading" ? "heading" : void 0,
|
|
765
814
|
"aria-level": e.block.kind === "heading" ? Math.max(1, e.block.level) : void 0,
|
|
766
|
-
style:
|
|
815
|
+
style: k(n.value)
|
|
767
816
|
}, [
|
|
768
|
-
e.block.label ? (M(),
|
|
817
|
+
e.block.label ? (M(), b("span", {
|
|
769
818
|
key: 0,
|
|
770
819
|
class: "pk-word-preview__label",
|
|
771
820
|
"data-quote-skip": "",
|
|
772
|
-
style:
|
|
773
|
-
}, R(e.block.label), 5)) :
|
|
774
|
-
|
|
821
|
+
style: k(r.value)
|
|
822
|
+
}, R(e.block.label), 5)) : y("", !0),
|
|
823
|
+
C($e, {
|
|
775
824
|
runs: e.block.runs,
|
|
776
825
|
mode: e.mode,
|
|
777
826
|
page: e.page,
|
|
@@ -782,10 +831,10 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
782
831
|
"page",
|
|
783
832
|
"numbers"
|
|
784
833
|
]),
|
|
785
|
-
!e.block.label && !e.block.runs.length ? (M(),
|
|
834
|
+
!e.block.label && !e.block.runs.length ? (M(), b("br", rt)) : y("", !0)
|
|
786
835
|
], 14, nt));
|
|
787
836
|
}
|
|
788
|
-
}), at = { class: "pk-word-preview__part" }, ot = ["src"], st = /* @__PURE__ */
|
|
837
|
+
}), at = { class: "pk-word-preview__part" }, ot = ["src"], st = /* @__PURE__ */ w({
|
|
789
838
|
__name: "PkWordPreviewPart",
|
|
790
839
|
props: {
|
|
791
840
|
blocks: {},
|
|
@@ -795,13 +844,13 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
795
844
|
numbers: {}
|
|
796
845
|
},
|
|
797
846
|
setup(e) {
|
|
798
|
-
let t = e, n =
|
|
847
|
+
let t = e, n = T(m, void 0), r = _(() => f(t.blocks, t.mode)), i = _(() => l(t.blocks, t.mode).flatMap((e) => {
|
|
799
848
|
let r = c(n?.value, e.ref);
|
|
800
849
|
return r ? [{
|
|
801
850
|
src: r,
|
|
802
851
|
css: o(e, t.section.page)
|
|
803
852
|
}] : [];
|
|
804
|
-
})), a =
|
|
853
|
+
})), a = _(() => {
|
|
805
854
|
let { margins: e } = t.section.page;
|
|
806
855
|
return {
|
|
807
856
|
left: `${e.left}pt`,
|
|
@@ -809,10 +858,10 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
809
858
|
...t.where === "header" ? { top: `${t.section.headerDistance}pt` } : { bottom: `${t.section.footerDistance}pt` }
|
|
810
859
|
};
|
|
811
860
|
});
|
|
812
|
-
return (t, n) => (M(),
|
|
861
|
+
return (t, n) => (M(), b("div", at, [x("div", {
|
|
813
862
|
class: "pk-word-preview__part-flow",
|
|
814
|
-
style:
|
|
815
|
-
}, [(M(!0),
|
|
863
|
+
style: k(a.value)
|
|
864
|
+
}, [(M(!0), b(g, null, F(r.value, (t) => (M(), v(it, {
|
|
816
865
|
key: t.key,
|
|
817
866
|
block: e.blocks[t.block],
|
|
818
867
|
row: t.row,
|
|
@@ -825,10 +874,10 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
825
874
|
"mode",
|
|
826
875
|
"page",
|
|
827
876
|
"numbers"
|
|
828
|
-
]))), 128))], 4), (M(!0),
|
|
877
|
+
]))), 128))], 4), (M(!0), b(g, null, F(i.value, (e, t) => (M(), b("img", {
|
|
829
878
|
key: t,
|
|
830
879
|
class: "pk-word-preview__float",
|
|
831
|
-
style:
|
|
880
|
+
style: k(e.css),
|
|
832
881
|
src: e.src,
|
|
833
882
|
alt: ""
|
|
834
883
|
}, null, 12, ot))), 128))]));
|
|
@@ -863,9 +912,9 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
863
912
|
}, Dt = { class: "pk-word-preview__count" }, Ot = {
|
|
864
913
|
key: 1,
|
|
865
914
|
class: "pk-word-preview__legend"
|
|
866
|
-
}, kt = ["title"], At = { class: "pk-word-preview__removed" }, jt = { class: "pk-word-preview__added" }, Mt = { class: "pk-word-preview__percent" }, Nt = ["data-part"], Pt = 96 / 72, Ft = /* @__PURE__ */
|
|
915
|
+
}, kt = ["title"], At = { class: "pk-word-preview__removed" }, jt = { class: "pk-word-preview__added" }, Mt = { class: "pk-word-preview__percent" }, Nt = ["data-part"], Pt = 96 / 72, Ft = /* @__PURE__ */ w({
|
|
867
916
|
__name: "PkWordPreview",
|
|
868
|
-
props: /*@__PURE__*/
|
|
917
|
+
props: /*@__PURE__*/ D({
|
|
869
918
|
preview: {},
|
|
870
919
|
mode: {}
|
|
871
920
|
}, {
|
|
@@ -877,41 +926,41 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
877
926
|
zoom: { default: 1 },
|
|
878
927
|
zoomModifiers: {}
|
|
879
928
|
}),
|
|
880
|
-
emits: /*@__PURE__*/
|
|
929
|
+
emits: /*@__PURE__*/ D(["select"], ["update:fit", "update:zoom"]),
|
|
881
930
|
setup(e, { emit: t }) {
|
|
882
931
|
let n = e, r = t, { t: i } = oe({ useScope: "global" });
|
|
883
|
-
N(m,
|
|
884
|
-
let u = (e) => d(e, n.mode), h =
|
|
932
|
+
N(m, _(() => n.preview.images));
|
|
933
|
+
let u = (e) => d(e, n.mode), h = _(() => f(n.preview.blocks, n.mode)), ee = re("rootEl"), S = re("scrollEl"), w = re("measureEl"), { width: T } = se(ee), { width: E } = se(S), D = _(() => T.value === 0 || T.value >= 640), j = _(() => T.value >= 1e3), I = _(() => n.preview.sections?.length ? n.preview.sections : [{
|
|
885
934
|
page: n.preview.page,
|
|
886
935
|
headerDistance: 0,
|
|
887
936
|
footerDistance: 0,
|
|
888
937
|
headers: {},
|
|
889
938
|
footers: {}
|
|
890
|
-
}]), L =
|
|
939
|
+
}]), L = _(() => I.value[0].page), V = _(() => ({
|
|
891
940
|
fontFamily: s(n.preview.defaults.font),
|
|
892
941
|
fontSize: `${n.preview.defaults.size}pt`,
|
|
893
942
|
color: n.preview.defaults.color ?? "#000000",
|
|
894
943
|
"--pk-word-line": p(n.preview.defaults.font),
|
|
895
944
|
"--pk-word-size": `${n.preview.defaults.size}pt`
|
|
896
|
-
})), ie =
|
|
945
|
+
})), ie = _(() => ({
|
|
897
946
|
...V.value,
|
|
898
947
|
width: `${L.value.width - L.value.margins.left - L.value.margins.right}pt`
|
|
899
948
|
})), U = P([]), ae = P({}), W = async () => {
|
|
900
|
-
await
|
|
901
|
-
let e =
|
|
949
|
+
await te();
|
|
950
|
+
let e = w.value?.querySelectorAll("[data-item]");
|
|
902
951
|
U.value = [...e ?? []].map((e) => e.getBoundingClientRect().height);
|
|
903
|
-
let t =
|
|
952
|
+
let t = w.value?.querySelectorAll("[data-part]");
|
|
904
953
|
ae.value = Object.fromEntries([...t ?? []].map((e) => [e.dataset.part ?? "", e.getBoundingClientRect().height]));
|
|
905
954
|
};
|
|
906
955
|
H([
|
|
907
956
|
h,
|
|
908
|
-
|
|
957
|
+
D,
|
|
909
958
|
() => n.preview.parts
|
|
910
959
|
], W, { flush: "post" }), ne(() => {
|
|
911
960
|
W(), document.fonts?.ready.then(W);
|
|
912
961
|
});
|
|
913
|
-
let G =
|
|
914
|
-
if (!
|
|
962
|
+
let G = _(() => {
|
|
963
|
+
if (!D.value || U.value.length !== h.value.length) return [{
|
|
915
964
|
items: h.value.map((e, t) => t),
|
|
916
965
|
section: 0,
|
|
917
966
|
number: 1,
|
|
@@ -947,7 +996,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
947
996
|
return (I.value[t].page.height - e.top - e.bottom) * Pt;
|
|
948
997
|
})())) && c(), e[e.length - 1].items.push(l), i += U.value[l];
|
|
949
998
|
}), e.length || c(), e;
|
|
950
|
-
}), K =
|
|
999
|
+
}), K = _(() => {
|
|
951
1000
|
let e = /* @__PURE__ */ new Map();
|
|
952
1001
|
for (let t of G.value) e.set(t.section, (e.get(t.section) ?? 0) + 1);
|
|
953
1002
|
return G.value.map((t) => ({
|
|
@@ -963,7 +1012,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
963
1012
|
minHeight: `${t.height}pt`,
|
|
964
1013
|
padding: `${e.top}pt ${t.margins.right}pt ${e.bottom}pt ${t.margins.left}pt`
|
|
965
1014
|
};
|
|
966
|
-
},
|
|
1015
|
+
}, ue = (e) => {
|
|
967
1016
|
let t = [...new Set(e.items.map((e) => h.value[e].block))];
|
|
968
1017
|
return l(t.map((e) => n.preview.blocks[e]), n.mode).flatMap((t) => {
|
|
969
1018
|
let r = c(n.preview.images, t.ref);
|
|
@@ -972,103 +1021,103 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
972
1021
|
css: o(t, I.value[e.section].page)
|
|
973
1022
|
}] : [];
|
|
974
1023
|
});
|
|
975
|
-
},
|
|
976
|
-
|
|
977
|
-
},
|
|
978
|
-
let e =
|
|
1024
|
+
}, q = B(e, "fit"), J = B(e, "zoom"), Y = _(() => q.value ? Math.min(1.25, Math.max(.3, (E.value - 48) / (L.value.width * Pt))) : J.value), de = (e) => {
|
|
1025
|
+
J.value = Math.min(2, Math.max(.3, Math.round((Y.value + e) * 10) / 10)), q.value = !1;
|
|
1026
|
+
}, fe = P(0), pe = P(), me = () => {
|
|
1027
|
+
let e = S.value?.getBoundingClientRect();
|
|
979
1028
|
if (!e) return;
|
|
980
|
-
let t =
|
|
1029
|
+
let t = S.value?.querySelectorAll("[data-page]") ?? [], n = 0;
|
|
981
1030
|
for (let [r, i] of [...t].entries()) {
|
|
982
1031
|
if (i.getBoundingClientRect().top - e.top > e.height / 3) break;
|
|
983
1032
|
n = r;
|
|
984
1033
|
}
|
|
985
|
-
|
|
1034
|
+
fe.value = n;
|
|
986
1035
|
let r;
|
|
987
|
-
for (let t of
|
|
988
|
-
let n =
|
|
1036
|
+
for (let t of ye.value) {
|
|
1037
|
+
let n = S.value?.querySelector(`[data-key="${t.key}"]`);
|
|
989
1038
|
if (n) {
|
|
990
1039
|
if (n.getBoundingClientRect().top - e.top > 48) break;
|
|
991
1040
|
r = t.key;
|
|
992
1041
|
}
|
|
993
1042
|
}
|
|
994
|
-
|
|
995
|
-
},
|
|
996
|
-
|
|
997
|
-
|
|
1043
|
+
pe.value = r ?? ye.value[0]?.key;
|
|
1044
|
+
}, he = 0, ge = () => {
|
|
1045
|
+
he ||= requestAnimationFrame(() => {
|
|
1046
|
+
he = 0, me();
|
|
998
1047
|
});
|
|
999
1048
|
};
|
|
1000
|
-
|
|
1001
|
-
let { selection:
|
|
1002
|
-
H(
|
|
1003
|
-
let t =
|
|
1004
|
-
r("select", e && t ?
|
|
1049
|
+
A(() => cancelAnimationFrame(he)), H(G, () => te(ge));
|
|
1050
|
+
let { selection: _e } = le({ root: () => S.value?.getRootNode() });
|
|
1051
|
+
H(_e, (e) => {
|
|
1052
|
+
let t = S.value;
|
|
1053
|
+
r("select", e && t ? ve(t, e.range, ".pk-word-preview__measure, .pk-word-preview__part") : void 0);
|
|
1005
1054
|
});
|
|
1006
|
-
let
|
|
1007
|
-
let t = n.preview.blocks[e.block], r = t.kind === "heading" ? [t.label,
|
|
1055
|
+
let X = (e) => u(e).map((e) => e.text).join("").replace(/\s+/g, " ").trim(), ye = _(() => h.value.flatMap((e) => {
|
|
1056
|
+
let t = n.preview.blocks[e.block], r = t.kind === "heading" ? [t.label, X(t.runs)].filter(Boolean).join(" ") : "";
|
|
1008
1057
|
return t.kind === "heading" && t.level <= 3 && r ? [{
|
|
1009
1058
|
key: e.key,
|
|
1010
1059
|
level: t.level,
|
|
1011
1060
|
text: r
|
|
1012
1061
|
}] : [];
|
|
1013
|
-
})),
|
|
1062
|
+
})), be = (e) => e.length > 60 ? `${e.slice(0, 60)}…` : e, Z = _(() => h.value.flatMap((e) => {
|
|
1014
1063
|
let t = n.preview.blocks[e.block], r = t.kind === "table" ? (t.rows[e.row ?? 0] ?? []).flatMap((e) => e.runs) : t.runs, i = r.filter((e) => e.change === "deleted").map((e) => e.text).join(" ").trim(), a = r.filter((e) => e.change === "inserted").map((e) => e.text).join(" ").trim();
|
|
1015
1064
|
return i || a ? [{
|
|
1016
1065
|
key: e.key,
|
|
1017
|
-
removed:
|
|
1018
|
-
added:
|
|
1066
|
+
removed: be(i),
|
|
1067
|
+
added: be(a)
|
|
1019
1068
|
}] : [];
|
|
1020
|
-
})),
|
|
1021
|
-
|
|
1069
|
+
})), Q = P("outline"), $ = P(!1), xe = (e) => {
|
|
1070
|
+
S.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
|
|
1022
1071
|
block: "start",
|
|
1023
1072
|
behavior: "smooth"
|
|
1024
|
-
}), j.value || (
|
|
1025
|
-
}, Se =
|
|
1073
|
+
}), j.value || ($.value = !1);
|
|
1074
|
+
}, Se = _(() => n.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => X(e.runs)) : [X(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), Ce = _(() => n.preview.revisionAuthors.join(", "));
|
|
1026
1075
|
return (t, n) => {
|
|
1027
1076
|
let r = a;
|
|
1028
|
-
return M(),
|
|
1077
|
+
return M(), b("div", {
|
|
1029
1078
|
ref_key: "rootEl",
|
|
1030
|
-
ref:
|
|
1031
|
-
class:
|
|
1079
|
+
ref: ee,
|
|
1080
|
+
class: O(["pk-word-preview", { "pk-word-preview--paged": D.value }])
|
|
1032
1081
|
}, [
|
|
1033
|
-
(j.value ||
|
|
1082
|
+
(j.value || $.value) && (ye.value.length || Z.value.length) ? (M(), b("aside", {
|
|
1034
1083
|
key: 0,
|
|
1035
|
-
class:
|
|
1084
|
+
class: O(["pk-word-preview__side", { "pk-word-preview__side--over": !j.value }]),
|
|
1036
1085
|
"aria-label": z(i)("chatFilePreview.outline")
|
|
1037
|
-
}, [
|
|
1086
|
+
}, [x("div", lt, [x("button", {
|
|
1038
1087
|
type: "button",
|
|
1039
1088
|
role: "tab",
|
|
1040
1089
|
class: "pk-word-preview__tab",
|
|
1041
|
-
"aria-selected":
|
|
1042
|
-
onClick: n[0] ||= (e) =>
|
|
1043
|
-
}, R(z(i)("chatFilePreview.outline")), 9, ut),
|
|
1090
|
+
"aria-selected": Q.value === "outline",
|
|
1091
|
+
onClick: n[0] ||= (e) => Q.value = "outline"
|
|
1092
|
+
}, R(z(i)("chatFilePreview.outline")), 9, ut), Z.value.length ? (M(), b("button", {
|
|
1044
1093
|
key: 0,
|
|
1045
1094
|
type: "button",
|
|
1046
1095
|
role: "tab",
|
|
1047
1096
|
class: "pk-word-preview__tab",
|
|
1048
|
-
"aria-selected":
|
|
1049
|
-
onClick: n[1] ||= (e) =>
|
|
1050
|
-
}, R(z(i)("chatFilePreview.changes", { count:
|
|
1097
|
+
"aria-selected": Q.value === "changes",
|
|
1098
|
+
onClick: n[1] ||= (e) => Q.value = "changes"
|
|
1099
|
+
}, R(z(i)("chatFilePreview.changes", { count: Z.value.length })), 9, dt)) : y("", !0)]), Q.value === "outline" || !Z.value.length ? (M(), b("nav", ft, [(M(!0), b(g, null, F(ye.value, (e) => (M(), b("button", {
|
|
1051
1100
|
key: e.key,
|
|
1052
1101
|
type: "button",
|
|
1053
|
-
class:
|
|
1054
|
-
"aria-current":
|
|
1102
|
+
class: O(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
|
|
1103
|
+
"aria-current": pe.value === e.key ? "location" : void 0,
|
|
1055
1104
|
onClick: (t) => xe(e.key)
|
|
1056
|
-
}, [
|
|
1105
|
+
}, [x("span", mt, R(e.text), 1), Z.value.some((t) => t.key === e.key) ? (M(), b("span", ht)) : y("", !0)], 10, pt))), 128)), ye.value.length ? y("", !0) : (M(), b("p", gt, R(z(i)("chatFilePreview.noHeadings")), 1))])) : (M(), b("nav", _t, [(M(!0), b(g, null, F(Z.value, (e) => (M(), b("button", {
|
|
1057
1106
|
key: e.key,
|
|
1058
1107
|
type: "button",
|
|
1059
1108
|
class: "pk-word-preview__entry pk-word-preview__entry--change",
|
|
1060
1109
|
onClick: (t) => xe(e.key)
|
|
1061
|
-
}, [e.removed ? (M(),
|
|
1062
|
-
|
|
1110
|
+
}, [e.removed ? (M(), b("del", yt, R(e.removed), 1)) : y("", !0), e.added ? (M(), b("ins", bt, R(e.added), 1)) : y("", !0)], 8, vt))), 128))]))], 10, ct)) : y("", !0),
|
|
1111
|
+
x("div", xt, [x("div", {
|
|
1063
1112
|
ref_key: "scrollEl",
|
|
1064
|
-
ref:
|
|
1113
|
+
ref: S,
|
|
1065
1114
|
class: "pk-word-preview__scroll",
|
|
1066
|
-
onScroll:
|
|
1067
|
-
}, [
|
|
1115
|
+
onScroll: ge
|
|
1116
|
+
}, [D.value ? (M(), b("div", {
|
|
1068
1117
|
key: 0,
|
|
1069
1118
|
class: "pk-word-preview__pages",
|
|
1070
|
-
style:
|
|
1071
|
-
}, [(M(!0),
|
|
1119
|
+
style: k({ zoom: Y.value })
|
|
1120
|
+
}, [(M(!0), b(g, null, F(G.value, (t, n) => (M(), b("article", {
|
|
1072
1121
|
key: n,
|
|
1073
1122
|
"data-page": "",
|
|
1074
1123
|
class: "pk-word-preview__page",
|
|
@@ -1076,9 +1125,9 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1076
1125
|
page: n + 1,
|
|
1077
1126
|
count: G.value.length
|
|
1078
1127
|
}),
|
|
1079
|
-
style:
|
|
1128
|
+
style: k(ce(t))
|
|
1080
1129
|
}, [
|
|
1081
|
-
t.header && e.preview.parts?.[t.header] ? (M(),
|
|
1130
|
+
t.header && e.preview.parts?.[t.header] ? (M(), v(st, {
|
|
1082
1131
|
key: 0,
|
|
1083
1132
|
blocks: e.preview.parts[t.header],
|
|
1084
1133
|
where: "header",
|
|
@@ -1090,8 +1139,8 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1090
1139
|
"section",
|
|
1091
1140
|
"mode",
|
|
1092
1141
|
"numbers"
|
|
1093
|
-
])) :
|
|
1094
|
-
(M(!0),
|
|
1142
|
+
])) : y("", !0),
|
|
1143
|
+
(M(!0), b(g, null, F(t.items, (r) => (M(), v(it, {
|
|
1095
1144
|
key: h.value[r].key,
|
|
1096
1145
|
"data-key": h.value[r].key,
|
|
1097
1146
|
block: e.preview.blocks[h.value[r].block],
|
|
@@ -1107,14 +1156,14 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1107
1156
|
"page",
|
|
1108
1157
|
"numbers"
|
|
1109
1158
|
]))), 128)),
|
|
1110
|
-
(M(!0),
|
|
1159
|
+
(M(!0), b(g, null, F(ue(t), (e, t) => (M(), b("img", {
|
|
1111
1160
|
key: `image-${t}`,
|
|
1112
1161
|
class: "pk-word-preview__float",
|
|
1113
|
-
style:
|
|
1162
|
+
style: k(e.css),
|
|
1114
1163
|
src: e.src,
|
|
1115
1164
|
alt: ""
|
|
1116
1165
|
}, null, 12, Ct))), 128)),
|
|
1117
|
-
t.footer && e.preview.parts?.[t.footer] ? (M(),
|
|
1166
|
+
t.footer && e.preview.parts?.[t.footer] ? (M(), v(st, {
|
|
1118
1167
|
key: 1,
|
|
1119
1168
|
blocks: e.preview.parts[t.footer],
|
|
1120
1169
|
where: "footer",
|
|
@@ -1126,12 +1175,12 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1126
1175
|
"section",
|
|
1127
1176
|
"mode",
|
|
1128
1177
|
"numbers"
|
|
1129
|
-
])) :
|
|
1130
|
-
], 12, St))), 128))], 4)) : (M(),
|
|
1178
|
+
])) : y("", !0)
|
|
1179
|
+
], 12, St))), 128))], 4)) : (M(), b("article", {
|
|
1131
1180
|
key: 1,
|
|
1132
1181
|
class: "pk-word-preview__page pk-word-preview__page--flow",
|
|
1133
|
-
style:
|
|
1134
|
-
}, [(M(!0),
|
|
1182
|
+
style: k(V.value)
|
|
1183
|
+
}, [(M(!0), b(g, null, F(h.value, (t) => (M(), v(it, {
|
|
1135
1184
|
key: t.key,
|
|
1136
1185
|
"data-key": t.key,
|
|
1137
1186
|
block: e.preview.blocks[t.block],
|
|
@@ -1142,22 +1191,22 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1142
1191
|
"block",
|
|
1143
1192
|
"row",
|
|
1144
1193
|
"mode"
|
|
1145
|
-
]))), 128))], 4)), e.preview.truncated ? (M(),
|
|
1146
|
-
|
|
1147
|
-
page:
|
|
1194
|
+
]))), 128))], 4)), e.preview.truncated ? (M(), b("p", wt, R(z(i)("chatFilePreview.truncated")), 1)) : y("", !0)], 544), x("div", Tt, [
|
|
1195
|
+
D.value ? (M(), b("span", Et, R(z(i)("chatFilePreview.pageOf", {
|
|
1196
|
+
page: fe.value + 1,
|
|
1148
1197
|
count: G.value.length
|
|
1149
|
-
})), 1)) :
|
|
1150
|
-
|
|
1151
|
-
e.mode === "markup" && e.preview.revisionAuthors.length ? (M(),
|
|
1152
|
-
|
|
1198
|
+
})), 1)) : y("", !0),
|
|
1199
|
+
x("span", Dt, R(z(i)("chatFilePreview.words", Se.value)), 1),
|
|
1200
|
+
e.mode === "markup" && e.preview.revisionAuthors.length ? (M(), b("span", Ot, [
|
|
1201
|
+
x("span", {
|
|
1153
1202
|
class: "pk-word-preview__legend-text",
|
|
1154
1203
|
title: z(i)("chatFilePreview.revisionsOf", { authors: Ce.value })
|
|
1155
1204
|
}, R(z(i)("chatFilePreview.revisionsOf", { authors: Ce.value })), 9, kt),
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
])) :
|
|
1159
|
-
n[6] ||=
|
|
1160
|
-
!j.value && (
|
|
1205
|
+
x("del", At, R(z(i)("chatFilePreview.removed")), 1),
|
|
1206
|
+
x("ins", jt, R(z(i)("chatFilePreview.added")), 1)
|
|
1207
|
+
])) : y("", !0),
|
|
1208
|
+
n[6] ||= x("span", { class: "pk-word-preview__spacer" }, null, -1),
|
|
1209
|
+
!j.value && (ye.value.length || Z.value.length) ? (M(), v(r, {
|
|
1161
1210
|
key: 2,
|
|
1162
1211
|
class: "pk-word-preview__outline-toggle",
|
|
1163
1212
|
modifiers: "action-quiet",
|
|
@@ -1165,49 +1214,49 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1165
1214
|
label: z(i)("chatFilePreview.outline"),
|
|
1166
1215
|
title: z(i)("chatFilePreview.outline"),
|
|
1167
1216
|
"aria-label": z(i)("chatFilePreview.outline"),
|
|
1168
|
-
"aria-expanded":
|
|
1169
|
-
onClick: n[2] ||= (e) =>
|
|
1217
|
+
"aria-expanded": $.value,
|
|
1218
|
+
onClick: n[2] ||= (e) => $.value = !$.value
|
|
1170
1219
|
}, null, 8, [
|
|
1171
1220
|
"label",
|
|
1172
1221
|
"title",
|
|
1173
1222
|
"aria-label",
|
|
1174
1223
|
"aria-expanded"
|
|
1175
|
-
])) :
|
|
1176
|
-
|
|
1177
|
-
|
|
1224
|
+
])) : y("", !0),
|
|
1225
|
+
D.value ? (M(), b(g, { key: 3 }, [
|
|
1226
|
+
C(r, {
|
|
1178
1227
|
modifiers: "action-quiet",
|
|
1179
1228
|
label: z(i)("chatFilePreview.fitWidth"),
|
|
1180
|
-
disabled:
|
|
1181
|
-
onClick: n[3] ||= (e) =>
|
|
1229
|
+
disabled: q.value,
|
|
1230
|
+
onClick: n[3] ||= (e) => q.value = !0
|
|
1182
1231
|
}, null, 8, ["label", "disabled"]),
|
|
1183
|
-
|
|
1232
|
+
C(r, {
|
|
1184
1233
|
modifiers: "action-quiet",
|
|
1185
1234
|
icon: "ri:subtract-line",
|
|
1186
1235
|
"aria-label": z(i)("chatFilePreview.zoomOut"),
|
|
1187
|
-
disabled:
|
|
1188
|
-
onClick: n[4] ||= (e) =>
|
|
1236
|
+
disabled: Y.value <= .3,
|
|
1237
|
+
onClick: n[4] ||= (e) => de(-.1)
|
|
1189
1238
|
}, null, 8, ["aria-label", "disabled"]),
|
|
1190
|
-
|
|
1191
|
-
|
|
1239
|
+
x("span", Mt, R(Math.round(Y.value * 100)) + "% ", 1),
|
|
1240
|
+
C(r, {
|
|
1192
1241
|
modifiers: "action-quiet",
|
|
1193
1242
|
icon: "ri:add-line",
|
|
1194
1243
|
"aria-label": z(i)("chatFilePreview.zoomIn"),
|
|
1195
|
-
disabled:
|
|
1196
|
-
onClick: n[5] ||= (e) =>
|
|
1244
|
+
disabled: Y.value >= 2,
|
|
1245
|
+
onClick: n[5] ||= (e) => de(.1)
|
|
1197
1246
|
}, null, 8, ["aria-label", "disabled"])
|
|
1198
|
-
], 64)) :
|
|
1247
|
+
], 64)) : y("", !0)
|
|
1199
1248
|
])]),
|
|
1200
|
-
|
|
1249
|
+
D.value ? (M(), b("div", {
|
|
1201
1250
|
key: 1,
|
|
1202
1251
|
ref_key: "measureEl",
|
|
1203
|
-
ref:
|
|
1252
|
+
ref: w,
|
|
1204
1253
|
class: "pk-word-preview__measure",
|
|
1205
1254
|
"aria-hidden": "true",
|
|
1206
|
-
style:
|
|
1207
|
-
}, [(M(!0),
|
|
1255
|
+
style: k(ie.value)
|
|
1256
|
+
}, [(M(!0), b(g, null, F(h.value, (t) => (M(), b("div", {
|
|
1208
1257
|
key: t.key,
|
|
1209
1258
|
"data-item": ""
|
|
1210
|
-
}, [
|
|
1259
|
+
}, [C(it, {
|
|
1211
1260
|
block: e.preview.blocks[t.block],
|
|
1212
1261
|
row: t.row,
|
|
1213
1262
|
mode: e.mode,
|
|
@@ -1217,10 +1266,10 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1217
1266
|
"row",
|
|
1218
1267
|
"mode",
|
|
1219
1268
|
"page"
|
|
1220
|
-
])]))), 128)), (M(!0),
|
|
1269
|
+
])]))), 128)), (M(!0), b(g, null, F(e.preview.parts, (t, n) => (M(), b("div", {
|
|
1221
1270
|
key: n,
|
|
1222
1271
|
"data-part": n
|
|
1223
|
-
}, [(M(!0),
|
|
1272
|
+
}, [(M(!0), b(g, null, F(z(f)(t, e.mode), (n) => (M(), v(it, {
|
|
1224
1273
|
key: n.key,
|
|
1225
1274
|
block: t[n.block],
|
|
1226
1275
|
row: n.row,
|
|
@@ -1231,7 +1280,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1231
1280
|
"row",
|
|
1232
1281
|
"mode",
|
|
1233
1282
|
"page"
|
|
1234
|
-
]))), 128))], 8, Nt))), 128))], 4)) :
|
|
1283
|
+
]))), 128))], 8, Nt))), 128))], 4)) : y("", !0)
|
|
1235
1284
|
], 2);
|
|
1236
1285
|
};
|
|
1237
1286
|
}
|
|
@@ -1247,9 +1296,9 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1247
1296
|
}, Zt = {
|
|
1248
1297
|
key: 1,
|
|
1249
1298
|
class: "pk-file-preview__empty"
|
|
1250
|
-
}, Qt = /*@__PURE__*/
|
|
1299
|
+
}, Qt = /*@__PURE__*/ w({
|
|
1251
1300
|
__name: "PkFilePreview",
|
|
1252
|
-
props: /*@__PURE__*/
|
|
1301
|
+
props: /*@__PURE__*/ D({
|
|
1253
1302
|
kind: {},
|
|
1254
1303
|
filename: {},
|
|
1255
1304
|
version: {},
|
|
@@ -1276,7 +1325,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1276
1325
|
},
|
|
1277
1326
|
fitModifiers: {}
|
|
1278
1327
|
}),
|
|
1279
|
-
emits: /*@__PURE__*/
|
|
1328
|
+
emits: /*@__PURE__*/ D([
|
|
1280
1329
|
"close",
|
|
1281
1330
|
"version",
|
|
1282
1331
|
"restore",
|
|
@@ -1289,7 +1338,7 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1289
1338
|
"update:fit"
|
|
1290
1339
|
]),
|
|
1291
1340
|
setup(e, { emit: n }) {
|
|
1292
|
-
let r = e, i = n, { t: o, locale: s } = oe({ useScope: "global" }), c =
|
|
1341
|
+
let r = e, i = n, { t: o, locale: s } = oe({ useScope: "global" }), c = _(() => r.versions ?? []), l = _(() => r.version ? c.value.indexOf(r.version) : -1), u = _(() => l.value > 0 ? c.value[l.value - 1] : void 0), d = _(() => l.value >= 0 && l.value < c.value.length - 1 ? c.value[l.value + 1] : void 0), f = B(e, "mode"), p = B(e, "sheet"), m = B(e, "zoom"), h = B(e, "fit"), S = _(() => [
|
|
1293
1342
|
{
|
|
1294
1343
|
value: "markup",
|
|
1295
1344
|
label: o("chatFilePreview.modeMarkup")
|
|
@@ -1302,33 +1351,33 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1302
1351
|
value: "original",
|
|
1303
1352
|
label: o("chatFilePreview.modeOriginal")
|
|
1304
1353
|
}
|
|
1305
|
-
]),
|
|
1354
|
+
]), w = _(() => r.preview?.kind === "word" && r.preview.revisionAuthors.length > 0);
|
|
1306
1355
|
H(() => r.version, () => {
|
|
1307
1356
|
f.value = "markup";
|
|
1308
1357
|
});
|
|
1309
|
-
let
|
|
1310
|
-
|
|
1358
|
+
let T = re("rootEl"), E = L(), D = P(!1), k = () => {
|
|
1359
|
+
E.value = void 0, D.value = !1;
|
|
1311
1360
|
};
|
|
1312
1361
|
H(() => [
|
|
1313
1362
|
r.version,
|
|
1314
1363
|
r.preview,
|
|
1315
1364
|
f.value
|
|
1316
|
-
],
|
|
1317
|
-
let
|
|
1318
|
-
|
|
1365
|
+
], k);
|
|
1366
|
+
let A = (e) => {
|
|
1367
|
+
D.value || (E.value = e);
|
|
1319
1368
|
};
|
|
1320
|
-
H(
|
|
1321
|
-
let n =
|
|
1322
|
-
t && !e && n?.format === "docx" && (await
|
|
1369
|
+
H(D, async (e, t) => {
|
|
1370
|
+
let n = E.value;
|
|
1371
|
+
t && !e && n?.format === "docx" && (await te(), n.restore());
|
|
1323
1372
|
});
|
|
1324
|
-
let ne =
|
|
1373
|
+
let ne = _(() => !r.version || r.version === c.value[c.value.length - 1]), j = () => {
|
|
1325
1374
|
let e = c.value[c.value.length - 1];
|
|
1326
1375
|
e && i("version", e);
|
|
1327
|
-
}, N =
|
|
1328
|
-
let e =
|
|
1329
|
-
return e?.format === "docx" ? e.paragraphCount > 200 : (e?.cells ?? 0) >
|
|
1330
|
-
}), I =
|
|
1331
|
-
let e =
|
|
1376
|
+
}, N = _(() => {
|
|
1377
|
+
let e = E.value;
|
|
1378
|
+
return e?.format === "docx" ? e.paragraphCount > 200 : (e?.cells ?? 0) > ue;
|
|
1379
|
+
}), I = _(() => E.value?.format === "docx" && f.value === "original"), V = _(() => N.value || I.value), U = _(() => I.value ? o("selectionActions.hintOriginal") : N.value ? o(E.value?.format === "docx" ? "selectionActions.hintParagraphs" : "selectionActions.hintCells", { count: E.value?.format === "docx" ? 200 : ue }) : void 0), ae = (e) => e[s.value] ?? e[s.value.split("-")[0]] ?? Object.values(e)[0] ?? "", W = ["explain", "summarize"], se = _(() => {
|
|
1380
|
+
let e = E.value, t = r.selectionActions;
|
|
1332
1381
|
if (!e || !t) return [];
|
|
1333
1382
|
let n = e.format;
|
|
1334
1383
|
return [...(n === "docx" && V.value ? W : t.builtIns).map((e) => ({
|
|
@@ -1379,22 +1428,22 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1379
1428
|
...a
|
|
1380
1429
|
};
|
|
1381
1430
|
}, le = (e, t) => {
|
|
1382
|
-
let n =
|
|
1431
|
+
let n = E.value, r = n && ce(n);
|
|
1383
1432
|
r && (i("selectionSend", e, r, {
|
|
1384
1433
|
id: t,
|
|
1385
1434
|
size: n.format === "docx" ? n.paragraphCount : n.cells
|
|
1386
|
-
}),
|
|
1387
|
-
},
|
|
1435
|
+
}), k(), document.getSelection()?.removeAllRanges());
|
|
1436
|
+
}, q = (e, t) => {
|
|
1388
1437
|
let n = se.value.find((t) => t.id === e);
|
|
1389
1438
|
n && le(n.prompt(t), e);
|
|
1390
|
-
},
|
|
1391
|
-
G(
|
|
1439
|
+
}, J = P(0);
|
|
1440
|
+
G(T, "scroll", () => J.value++, {
|
|
1392
1441
|
capture: !0,
|
|
1393
1442
|
passive: !0
|
|
1394
|
-
}), G(window, "resize", () =>
|
|
1395
|
-
let
|
|
1396
|
-
|
|
1397
|
-
let e =
|
|
1443
|
+
}), G(window, "resize", () => J.value++, { passive: !0 });
|
|
1444
|
+
let Y = _(() => {
|
|
1445
|
+
J.value;
|
|
1446
|
+
let e = E.value?.measure(), t = T.value?.getBoundingClientRect();
|
|
1398
1447
|
if (e && t) return {
|
|
1399
1448
|
start: {
|
|
1400
1449
|
top: e.start.top - t.top,
|
|
@@ -1410,44 +1459,44 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1410
1459
|
};
|
|
1411
1460
|
});
|
|
1412
1461
|
return (n, r) => {
|
|
1413
|
-
let s =
|
|
1414
|
-
return M(),
|
|
1462
|
+
let s = ee, l = a;
|
|
1463
|
+
return M(), b("section", {
|
|
1415
1464
|
ref_key: "rootEl",
|
|
1416
|
-
ref:
|
|
1465
|
+
ref: T,
|
|
1417
1466
|
class: "pk-file-preview",
|
|
1418
1467
|
"aria-label": e.filename,
|
|
1419
1468
|
tabindex: "-1",
|
|
1420
1469
|
autofocus: ""
|
|
1421
1470
|
}, [
|
|
1422
|
-
|
|
1423
|
-
|
|
1471
|
+
x("header", Lt, [
|
|
1472
|
+
x("div", Rt, [x("span", zt, [C(s, {
|
|
1424
1473
|
name: e.kind === "word" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
|
|
1425
|
-
class:
|
|
1426
|
-
}, null, 8, ["name", "class"])]),
|
|
1427
|
-
e.version && c.value.length > 1 ||
|
|
1474
|
+
class: O(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
|
|
1475
|
+
}, null, 8, ["name", "class"])]), x("div", Bt, [x("strong", Vt, R(e.filename), 1), x("span", Ht, R(z(o)("chatFilePreview.readOnly")), 1)])]),
|
|
1476
|
+
e.version && c.value.length > 1 || w.value ? (M(), b("div", Ut, [e.version && c.value.length > 1 ? (M(), b("nav", {
|
|
1428
1477
|
key: 0,
|
|
1429
1478
|
class: "pk-file-preview__versions",
|
|
1430
1479
|
"aria-label": z(o)("chatFilePreview.versions")
|
|
1431
1480
|
}, [
|
|
1432
|
-
|
|
1481
|
+
C(l, {
|
|
1433
1482
|
modifiers: "action-quiet",
|
|
1434
1483
|
icon: "ri:arrow-left-s-line",
|
|
1435
1484
|
"aria-label": z(o)("chatFilePreview.previousVersion"),
|
|
1436
1485
|
disabled: !u.value,
|
|
1437
1486
|
onClick: r[0] ||= (e) => u.value && i("version", u.value)
|
|
1438
1487
|
}, null, 8, ["aria-label", "disabled"]),
|
|
1439
|
-
|
|
1488
|
+
x("span", Gt, R(z(o)("chatFilePreview.versionOf", {
|
|
1440
1489
|
version: e.version,
|
|
1441
1490
|
count: c.value.length
|
|
1442
1491
|
})), 1),
|
|
1443
|
-
|
|
1492
|
+
C(l, {
|
|
1444
1493
|
modifiers: "action-quiet",
|
|
1445
1494
|
icon: "ri:arrow-right-s-line",
|
|
1446
1495
|
"aria-label": z(o)("chatFilePreview.nextVersion"),
|
|
1447
1496
|
disabled: !d.value,
|
|
1448
1497
|
onClick: r[1] ||= (e) => d.value && i("version", d.value)
|
|
1449
1498
|
}, null, 8, ["aria-label", "disabled"])
|
|
1450
|
-
], 8, Wt)) :
|
|
1499
|
+
], 8, Wt)) : y("", !0), w.value ? (M(), v(t, {
|
|
1451
1500
|
key: 1,
|
|
1452
1501
|
modelValue: f.value,
|
|
1453
1502
|
"onUpdate:modelValue": r[2] ||= (e) => f.value = e,
|
|
@@ -1455,24 +1504,24 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1455
1504
|
segmented: "",
|
|
1456
1505
|
class: "pk-file-preview__modes u-segmented-fit mb-0",
|
|
1457
1506
|
"aria-label": z(o)("chatFilePreview.modes"),
|
|
1458
|
-
options:
|
|
1507
|
+
options: S.value
|
|
1459
1508
|
}, {
|
|
1460
|
-
markup: ie(() => [
|
|
1509
|
+
markup: ie(() => [x("span", Kt, R(z(o)("chatFilePreview.modeMarkup")), 1), x("span", qt, R(z(o)("chatFilePreview.modeMarkupShort")), 1)]),
|
|
1461
1510
|
_: 1
|
|
1462
1511
|
}, 8, [
|
|
1463
1512
|
"modelValue",
|
|
1464
1513
|
"aria-label",
|
|
1465
1514
|
"options"
|
|
1466
|
-
])) :
|
|
1467
|
-
|
|
1468
|
-
e.restorable ? (M(),
|
|
1515
|
+
])) : y("", !0)])) : y("", !0),
|
|
1516
|
+
x("div", Jt, [
|
|
1517
|
+
e.restorable ? (M(), v(l, {
|
|
1469
1518
|
key: 0,
|
|
1470
1519
|
modifiers: "action-quiet",
|
|
1471
1520
|
icon: "ri:arrow-go-back-line",
|
|
1472
1521
|
label: z(o)("chatFilePreview.restore"),
|
|
1473
1522
|
onClick: r[3] ||= (e) => i("restore")
|
|
1474
|
-
}, null, 8, ["label"])) :
|
|
1475
|
-
|
|
1523
|
+
}, null, 8, ["label"])) : y("", !0),
|
|
1524
|
+
C(l, {
|
|
1476
1525
|
href: e.downloadUrl,
|
|
1477
1526
|
download: "",
|
|
1478
1527
|
modifiers: "action-quiet",
|
|
@@ -1484,22 +1533,22 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1484
1533
|
"title",
|
|
1485
1534
|
"aria-label"
|
|
1486
1535
|
]),
|
|
1487
|
-
e.resize === "expand" ? (M(),
|
|
1536
|
+
e.resize === "expand" ? (M(), v(l, {
|
|
1488
1537
|
key: 1,
|
|
1489
1538
|
modifiers: "action-quiet",
|
|
1490
1539
|
icon: "ri:fullscreen-line",
|
|
1491
1540
|
title: z(o)("chatFilePreview.expand"),
|
|
1492
1541
|
"aria-label": z(o)("chatFilePreview.expand"),
|
|
1493
1542
|
onClick: r[4] ||= (e) => i("resize")
|
|
1494
|
-
}, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (M(),
|
|
1543
|
+
}, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (M(), v(l, {
|
|
1495
1544
|
key: 2,
|
|
1496
1545
|
modifiers: "action-quiet",
|
|
1497
1546
|
icon: "ri:fullscreen-exit-line",
|
|
1498
1547
|
title: z(o)("chatFilePreview.shrink"),
|
|
1499
1548
|
"aria-label": z(o)("chatFilePreview.shrink"),
|
|
1500
1549
|
onClick: r[5] ||= (e) => i("resize")
|
|
1501
|
-
}, null, 8, ["title", "aria-label"])) :
|
|
1502
|
-
|
|
1550
|
+
}, null, 8, ["title", "aria-label"])) : y("", !0),
|
|
1551
|
+
C(l, {
|
|
1503
1552
|
modifiers: "action-quiet",
|
|
1504
1553
|
icon: "ri:close-line",
|
|
1505
1554
|
title: z(o)("chatFilePreview.close"),
|
|
@@ -1508,50 +1557,50 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1508
1557
|
}, null, 8, ["title", "aria-label"])
|
|
1509
1558
|
])
|
|
1510
1559
|
]),
|
|
1511
|
-
|
|
1560
|
+
x("div", Yt, [e.loading ? (M(), b("div", Xt, [(M(), b(g, null, F(8, (e) => x("div", {
|
|
1512
1561
|
key: e,
|
|
1513
|
-
class:
|
|
1514
|
-
}, null, 2)), 64))])) : e.error || !e.preview ? (M(),
|
|
1562
|
+
class: O(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
|
|
1563
|
+
}, null, 2)), 64))])) : e.error || !e.preview ? (M(), b("p", Zt, R(z(o)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (M(), v(Ft, {
|
|
1515
1564
|
key: 2,
|
|
1516
1565
|
zoom: m.value,
|
|
1517
1566
|
"onUpdate:zoom": r[7] ||= (e) => m.value = e,
|
|
1518
1567
|
fit: h.value,
|
|
1519
1568
|
"onUpdate:fit": r[8] ||= (e) => h.value = e,
|
|
1520
1569
|
preview: e.preview,
|
|
1521
|
-
mode:
|
|
1522
|
-
onSelect:
|
|
1570
|
+
mode: w.value ? f.value : "markup",
|
|
1571
|
+
onSelect: A
|
|
1523
1572
|
}, null, 8, [
|
|
1524
1573
|
"zoom",
|
|
1525
1574
|
"fit",
|
|
1526
1575
|
"preview",
|
|
1527
1576
|
"mode"
|
|
1528
|
-
])) : (M(),
|
|
1577
|
+
])) : (M(), v(qe, {
|
|
1529
1578
|
key: 3,
|
|
1530
1579
|
sheet: p.value,
|
|
1531
1580
|
"onUpdate:sheet": r[9] ||= (e) => p.value = e,
|
|
1532
1581
|
zoom: m.value,
|
|
1533
1582
|
"onUpdate:zoom": r[10] ||= (e) => m.value = e,
|
|
1534
1583
|
preview: e.preview,
|
|
1535
|
-
onSelect:
|
|
1584
|
+
onSelect: A
|
|
1536
1585
|
}, null, 8, [
|
|
1537
1586
|
"sheet",
|
|
1538
1587
|
"zoom",
|
|
1539
1588
|
"preview"
|
|
1540
1589
|
]))]),
|
|
1541
|
-
e.selectionActions &&
|
|
1590
|
+
e.selectionActions && E.value && Y.value ? (M(), v(we, {
|
|
1542
1591
|
key: 0,
|
|
1543
|
-
asking:
|
|
1544
|
-
"onUpdate:asking": r[11] ||= (e) =>
|
|
1592
|
+
asking: D.value,
|
|
1593
|
+
"onUpdate:asking": r[11] ||= (e) => D.value = e,
|
|
1545
1594
|
strategy: "absolute",
|
|
1546
|
-
anchor:
|
|
1595
|
+
anchor: Y.value,
|
|
1547
1596
|
actions: se.value,
|
|
1548
1597
|
hint: U.value,
|
|
1549
1598
|
note: ne.value ? void 0 : z(o)("selectionActions.notLatest", { version: e.version }),
|
|
1550
1599
|
"note-action": z(o)("selectionActions.openLatest"),
|
|
1551
|
-
onAction:
|
|
1600
|
+
onAction: q,
|
|
1552
1601
|
onAsk: r[12] ||= (e) => le(e, "ask"),
|
|
1553
1602
|
onNote: j,
|
|
1554
|
-
onClose:
|
|
1603
|
+
onClose: k
|
|
1555
1604
|
}, null, 8, [
|
|
1556
1605
|
"asking",
|
|
1557
1606
|
"anchor",
|
|
@@ -1559,11 +1608,11 @@ var q = 2e3, J = 1e3, Y = 60, X = 1400, ue = 20, de = (e) => Number(e.slice(1)),
|
|
|
1559
1608
|
"hint",
|
|
1560
1609
|
"note",
|
|
1561
1610
|
"note-action"
|
|
1562
|
-
])) :
|
|
1611
|
+
])) : y("", !0)
|
|
1563
1612
|
], 8, It);
|
|
1564
1613
|
};
|
|
1565
1614
|
}
|
|
1566
1615
|
}), $t = /* @__PURE__ */ e({ default: () => en }), en = Qt;
|
|
1567
1616
|
export { $t as n, en as t };
|
|
1568
1617
|
|
|
1569
|
-
//# sourceMappingURL=PkFilePreview-
|
|
1618
|
+
//# sourceMappingURL=PkFilePreview-Ac_8QIBX.js.map
|