@8wave/ai-elements 0.125.0-beta.25 → 0.125.0-beta.26
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-CyWTOCZC.js → PkFilePreview-BPsD2P7s.js} +406 -395
- package/dist/_chunks/PkFilePreview-BPsD2P7s.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-CUHwFDmH.js → PkFilePreviewDialog-BW-Rubk2.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-CUHwFDmH.js.map → PkFilePreviewDialog-BW-Rubk2.js.map} +1 -1
- package/dist/_chunks/PkSelectionActions-DkETXtSL.js +264 -0
- package/dist/_chunks/PkSelectionActions-DkETXtSL.js.map +1 -0
- package/dist/ai-elements.es.js +2 -2
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-DB41qdsn.js → PkChatbot-DyzEuNED.js} +2 -2
- package/dist-vue/_chunks/{PkChatbot-DB41qdsn.js.map → PkChatbot-DyzEuNED.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-DT9Km6Um.js → PkChatbotViewChat-CIfotKyM.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewChat-DT9Km6Um.js.map → PkChatbotViewChat-CIfotKyM.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-h5-LCGYo.js → PkFilePreview-DEKgCMkr.js} +432 -399
- package/dist-vue/_chunks/PkFilePreview-DEKgCMkr.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-BVOh-hA0.js → PkFilePreviewDialog-0qrzDWID.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-BVOh-hA0.js.map → PkFilePreviewDialog-0qrzDWID.js.map} +1 -1
- package/dist-vue/index.js +3 -3
- package/dist-vue/packages/components/src/chat/PkSelectionActions.d.ts +0 -10
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-CyWTOCZC.js.map +0 -1
- package/dist/_chunks/PkSelectionActions-DDyt_ksY.js +0 -241
- package/dist/_chunks/PkSelectionActions-DDyt_ksY.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-h5-LCGYo.js.map +0 -1
|
@@ -3,9 +3,9 @@ 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-RwaXl9-x.js";
|
|
6
|
-
import { r as ee } from "./PkChatbotViewChat-
|
|
6
|
+
import { r as ee } from "./PkChatbotViewChat-CIfotKyM.js";
|
|
7
7
|
import { VvIcon as g } from "@volverjs/ui-vue/components";
|
|
8
|
-
import { Fragment as _, computed as v, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createTextVNode as C, createVNode as w, defineComponent as T, inject as E, isMemoSame as
|
|
8
|
+
import { Fragment as _, computed as v, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createTextVNode as C, createVNode as w, defineComponent as T, inject as E, isMemoSame as D, mergeModels as O, nextTick as te, normalizeClass as k, normalizeStyle as A, onBeforeUnmount as j, onMounted as ne, onScopeDispose as M, openBlock as N, provide as re, ref as P, renderList as F, shallowRef as I, toDisplayString as L, unref as R, useModel as z, useTemplateRef as ie, vModelText as B, watch as V, withCtx as H, withDirectives as ae, withKeys as U, withModifiers as oe } from "vue";
|
|
9
9
|
import { useI18n as se } from "vue-i18n";
|
|
10
10
|
import { useElementSize as ce, useEventListener as le } from "@vueuse/core";
|
|
11
11
|
// ../../packages/composable/src/useSettledSelection.ts
|
|
@@ -31,7 +31,7 @@ function ue(e) {
|
|
|
31
31
|
return r && r.rangeCount > 0 ? r.getRangeAt(0).cloneRange() : void 0;
|
|
32
32
|
}
|
|
33
33
|
function de({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2 }) {
|
|
34
|
-
let i =
|
|
34
|
+
let i = I(), a, o = () => {
|
|
35
35
|
clearTimeout(a), i.value = void 0;
|
|
36
36
|
}, s = () => {
|
|
37
37
|
let n = e();
|
|
@@ -49,7 +49,7 @@ function de({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2 })
|
|
|
49
49
|
i.value = s();
|
|
50
50
|
}, n);
|
|
51
51
|
};
|
|
52
|
-
return typeof document < "u" && typeof matchMedia == "function" && matchMedia(W).matches && (document.addEventListener("selectionchange", c),
|
|
52
|
+
return typeof document < "u" && typeof matchMedia == "function" && matchMedia(W).matches && (document.addEventListener("selectionchange", c), M(() => {
|
|
53
53
|
clearTimeout(a), document.removeEventListener("selectionchange", c);
|
|
54
54
|
})), {
|
|
55
55
|
selection: i,
|
|
@@ -152,9 +152,9 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
152
152
|
}, Se = ["onKeydown"], Ce = ["placeholder", "aria-label"], we = ["disabled"], Te = ["aria-label"], Ee = { class: "pk-selection-actions__text" }, X = {
|
|
153
153
|
key: 0,
|
|
154
154
|
class: "pk-selection-actions__text"
|
|
155
|
-
}, Z = ["onClick"], Q = /* @__PURE__ */ T({
|
|
155
|
+
}, Z = ["onClick"], Q = "ri:sparkling-line", $ = /* @__PURE__ */ T({
|
|
156
156
|
__name: "PkSelectionActions",
|
|
157
|
-
props: /*@__PURE__*/
|
|
157
|
+
props: /*@__PURE__*/ O({
|
|
158
158
|
actions: {},
|
|
159
159
|
anchor: {},
|
|
160
160
|
strategy: {},
|
|
@@ -169,93 +169,115 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
169
169
|
},
|
|
170
170
|
askingModifiers: {}
|
|
171
171
|
}),
|
|
172
|
-
emits: /*@__PURE__*/
|
|
172
|
+
emits: /*@__PURE__*/ O([
|
|
173
173
|
"action",
|
|
174
174
|
"ask",
|
|
175
175
|
"note",
|
|
176
176
|
"close"
|
|
177
177
|
], ["update:asking"]),
|
|
178
178
|
setup(e, { emit: t }) {
|
|
179
|
-
let n =
|
|
180
|
-
|
|
179
|
+
let n = {
|
|
180
|
+
explain: "ri:question-line",
|
|
181
|
+
summarize: "ri:file-list-3-line",
|
|
182
|
+
rewrite: "ri:edit-line",
|
|
183
|
+
shorten: "ri:scissors-cut-line",
|
|
184
|
+
proofread: "ri:check-double-line",
|
|
185
|
+
translate: "ri:translate-2",
|
|
186
|
+
chart: "ri:bar-chart-2-line"
|
|
187
|
+
}, r = e, i = t, a = z(e, "asking"), { t: o } = se({ useScope: "global" }), s = ie("barEl"), c = ie("inputEl"), { width: l, height: d } = ce(s, void 0, { box: "border-box" }), f = v(() => u({
|
|
188
|
+
...r.anchor,
|
|
181
189
|
bar: {
|
|
182
|
-
width:
|
|
183
|
-
height:
|
|
190
|
+
width: l.value,
|
|
191
|
+
height: d.value
|
|
184
192
|
},
|
|
185
|
-
touch:
|
|
186
|
-
})),
|
|
187
|
-
|
|
193
|
+
touch: r.touch
|
|
194
|
+
})), p = P(), m = P(""), h = async (e, t) => {
|
|
195
|
+
p.value = {
|
|
188
196
|
id: e,
|
|
189
197
|
placeholder: t
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
e.asks ?
|
|
195
|
-
},
|
|
196
|
-
let e =
|
|
197
|
-
e &&
|
|
198
|
-
},
|
|
199
|
-
|
|
198
|
+
}, m.value = "", a.value = !0, await te(), c.value?.focus();
|
|
199
|
+
}, ee = () => {
|
|
200
|
+
p.value = void 0, a.value = !1;
|
|
201
|
+
}, y = (e) => n[e.id] ?? Q, T = (e) => {
|
|
202
|
+
e.asks ? h(e.id, e.asks) : i("action", e.id);
|
|
203
|
+
}, E = () => {
|
|
204
|
+
let e = m.value.trim();
|
|
205
|
+
e && p.value && (p.value.id ? i("action", p.value.id, e) : i("ask", e), ee());
|
|
206
|
+
}, D = () => {
|
|
207
|
+
p.value ? ee() : i("close");
|
|
200
208
|
};
|
|
201
|
-
return (t, n) =>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
"pk-selection-actions
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
onClick: n[2] ||= (e) => r("note")
|
|
243
|
-
}, I(e.noteAction), 33)) : b("", !0)], 64)) : (M(), x(_, { key: 1 }, [
|
|
244
|
-
e.hint ? (M(), x("span", X, I(e.hint), 1)) : b("", !0),
|
|
245
|
-
(M(!0), x(_, null, P(e.actions, (e) => (M(), x("button", {
|
|
246
|
-
key: e.id,
|
|
247
|
-
type: "button",
|
|
248
|
-
class: "pk-selection-actions__button",
|
|
249
|
-
onMousedown: n[3] ||= U(() => {}, ["prevent"]),
|
|
250
|
-
onClick: (t) => ee(e)
|
|
251
|
-
}, I(e.label), 41, Z))), 128)),
|
|
252
|
-
S("button", {
|
|
209
|
+
return (t, n) => {
|
|
210
|
+
let r = g;
|
|
211
|
+
return N(), x("div", {
|
|
212
|
+
class: k(["pk-selection-actions", {
|
|
213
|
+
"pk-selection-actions--fixed": e.strategy === "fixed",
|
|
214
|
+
"pk-selection-actions--asking": !!p.value
|
|
215
|
+
}]),
|
|
216
|
+
style: A({
|
|
217
|
+
top: `${f.value.top}px`,
|
|
218
|
+
left: `${f.value.left}px`
|
|
219
|
+
}),
|
|
220
|
+
onKeydown: U(oe(D, ["stop"]), ["esc"])
|
|
221
|
+
}, [p.value ? (N(), x("form", {
|
|
222
|
+
key: 0,
|
|
223
|
+
ref_key: "barEl",
|
|
224
|
+
ref: s,
|
|
225
|
+
class: "pk-selection-actions__menu pk-selection-actions__menu--field",
|
|
226
|
+
onSubmit: oe(E, ["prevent"])
|
|
227
|
+
}, [ae(S("input", {
|
|
228
|
+
ref_key: "inputEl",
|
|
229
|
+
ref: c,
|
|
230
|
+
"onUpdate:modelValue": n[0] ||= (e) => m.value = e,
|
|
231
|
+
class: "pk-selection-actions__input",
|
|
232
|
+
type: "text",
|
|
233
|
+
maxlength: "500",
|
|
234
|
+
placeholder: p.value.placeholder,
|
|
235
|
+
"aria-label": p.value.placeholder
|
|
236
|
+
}, null, 8, Ce), [[B, m.value]]), S("button", {
|
|
237
|
+
type: "submit",
|
|
238
|
+
class: "pk-selection-actions__button pk-selection-actions__button--send",
|
|
239
|
+
disabled: !m.value.trim()
|
|
240
|
+
}, L(R(o)("action.send")), 9, we)], 544)) : (N(), x("div", {
|
|
241
|
+
key: 1,
|
|
242
|
+
ref_key: "barEl",
|
|
243
|
+
ref: s,
|
|
244
|
+
class: "pk-selection-actions__menu",
|
|
245
|
+
role: "toolbar",
|
|
246
|
+
"aria-orientation": "vertical",
|
|
247
|
+
"aria-label": R(o)("selectionActions.label")
|
|
248
|
+
}, [e.note ? (N(), x(_, { key: 0 }, [S("p", Ee, L(e.note), 1), e.noteAction ? (N(), x("button", {
|
|
249
|
+
key: 0,
|
|
253
250
|
type: "button",
|
|
254
251
|
class: "pk-selection-actions__button",
|
|
255
|
-
onMousedown: n[
|
|
256
|
-
onClick: n[
|
|
257
|
-
},
|
|
258
|
-
|
|
252
|
+
onMousedown: n[1] ||= oe(() => {}, ["prevent"]),
|
|
253
|
+
onClick: n[2] ||= (e) => i("note")
|
|
254
|
+
}, [w(r, {
|
|
255
|
+
name: "ri:arrow-right-line",
|
|
256
|
+
class: "pk-selection-actions__icon"
|
|
257
|
+
}), C(" " + L(e.noteAction), 1)], 32)) : b("", !0)], 64)) : (N(), x(_, { key: 1 }, [
|
|
258
|
+
e.hint ? (N(), x("p", X, L(e.hint), 1)) : b("", !0),
|
|
259
|
+
(N(!0), x(_, null, F(e.actions, (e) => (N(), x("button", {
|
|
260
|
+
key: e.id,
|
|
261
|
+
type: "button",
|
|
262
|
+
class: "pk-selection-actions__button",
|
|
263
|
+
onMousedown: n[3] ||= oe(() => {}, ["prevent"]),
|
|
264
|
+
onClick: (t) => T(e)
|
|
265
|
+
}, [w(r, {
|
|
266
|
+
name: y(e),
|
|
267
|
+
class: "pk-selection-actions__icon"
|
|
268
|
+
}, null, 8, ["name"]), C(" " + L(e.label), 1)], 40, Z))), 128)),
|
|
269
|
+
n[6] ||= S("hr", { class: "pk-selection-actions__rule" }, null, -1),
|
|
270
|
+
S("button", {
|
|
271
|
+
type: "button",
|
|
272
|
+
class: "pk-selection-actions__button",
|
|
273
|
+
onMousedown: n[4] ||= oe(() => {}, ["prevent"]),
|
|
274
|
+
onClick: n[5] ||= (e) => h(void 0, R(o)("selectionActions.askPlaceholder"))
|
|
275
|
+
}, [w(r, {
|
|
276
|
+
name: "ri:chat-1-line",
|
|
277
|
+
class: "pk-selection-actions__icon"
|
|
278
|
+
}), C(" " + L(R(o)("selectionActions.ask")), 1)], 32)
|
|
279
|
+
], 64))], 8, Te))], 46, Se);
|
|
280
|
+
};
|
|
259
281
|
}
|
|
260
282
|
}), De = { class: "pk-spreadsheet-preview" }, Oe = { class: "pk-spreadsheet-preview__bar" }, ke = ["aria-label"], Ae = ["aria-label"], je = ["aria-label"], Me = [
|
|
261
283
|
"rowspan",
|
|
@@ -273,9 +295,9 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
273
295
|
}, Ve = {
|
|
274
296
|
key: 0,
|
|
275
297
|
class: "pk-spreadsheet-preview__average"
|
|
276
|
-
}, He = { key: 1 }, Ue = { class: "pk-spreadsheet-preview__zoom" }, We = { class: "pk-spreadsheet-preview__percent" }, Ge = 64, Ke = 20, qe = 28, Je = 44,
|
|
298
|
+
}, He = { key: 1 }, Ue = { class: "pk-spreadsheet-preview__zoom" }, We = { class: "pk-spreadsheet-preview__percent" }, Ge = 64, Ke = 20, qe = 28, Je = 44, Ye = /* @__PURE__ */ T({
|
|
277
299
|
__name: "PkSpreadsheetPreview",
|
|
278
|
-
props: /*@__PURE__*/
|
|
300
|
+
props: /*@__PURE__*/ O({
|
|
279
301
|
preview: {},
|
|
280
302
|
marked: {}
|
|
281
303
|
}, {
|
|
@@ -284,13 +306,13 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
284
306
|
zoom: { default: 1 },
|
|
285
307
|
zoomModifiers: {}
|
|
286
308
|
}),
|
|
287
|
-
emits: /*@__PURE__*/
|
|
309
|
+
emits: /*@__PURE__*/ O(["select"], ["update:sheet", "update:zoom"]),
|
|
288
310
|
setup(e, { emit: t }) {
|
|
289
|
-
let o = e, s = t, { t: c, locale: l } = se({ useScope: "global" }), u =
|
|
311
|
+
let o = e, s = t, { t: c, locale: l } = se({ useScope: "global" }), u = z(e, "sheet"), d = z(e, "zoom"), f = ie("scrollEl"), { width: p, height: m } = ce(f, {
|
|
290
312
|
width: 0,
|
|
291
313
|
height: 0
|
|
292
314
|
}, { box: "border-box" }), h = v(() => o.preview.sheets[u.value] ?? o.preview.sheets[0]);
|
|
293
|
-
|
|
315
|
+
V(() => o.preview, () => {
|
|
294
316
|
u.value = 0;
|
|
295
317
|
});
|
|
296
318
|
let g = v(() => o.marked?.get(h.value?.name ?? "")), y = v(() => {
|
|
@@ -301,18 +323,18 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
301
323
|
}
|
|
302
324
|
return e;
|
|
303
325
|
}), T = (e, t) => !!g.value?.has(`${e}:${t}`);
|
|
304
|
-
|
|
326
|
+
V(() => o.marked, (e) => {
|
|
305
327
|
if (!e || g.value) return;
|
|
306
328
|
let t = o.preview.sheets.findIndex((t) => e.has(t.name));
|
|
307
329
|
t >= 0 && (u.value = t);
|
|
308
330
|
}, { immediate: !0 });
|
|
309
331
|
let E = () => ee(f.value, ".pk-spreadsheet-preview__cell--marked");
|
|
310
|
-
|
|
311
|
-
let
|
|
332
|
+
V(g, E, { flush: "post" }), ne(E);
|
|
333
|
+
let O = (e) => {
|
|
312
334
|
let t = "";
|
|
313
335
|
for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
|
|
314
336
|
return t;
|
|
315
|
-
},
|
|
337
|
+
}, j = v(() => {
|
|
316
338
|
let e = h.value;
|
|
317
339
|
if (!e) return [];
|
|
318
340
|
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 = Je, a = p.value / d.value;
|
|
@@ -325,11 +347,11 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
325
347
|
}), i += e;
|
|
326
348
|
}
|
|
327
349
|
return r;
|
|
328
|
-
}),
|
|
350
|
+
}), M = v(() => j.value.reduce((e, t) => e + t.width, Je)), re = v(() => j.value.map((e) => `${e.col}:${e.width}`).join(",")), I = /* @__PURE__ */ new WeakMap(), B = v(() => {
|
|
329
351
|
let e = h.value;
|
|
330
352
|
if (!e) return [];
|
|
331
|
-
let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((m.value / d.value - qe) / Ke), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a =
|
|
332
|
-
a || (a = /* @__PURE__ */ new Map(),
|
|
353
|
+
let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((m.value / d.value - qe) / Ke), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a = I.get(e);
|
|
354
|
+
a || (a = /* @__PURE__ */ new Map(), I.set(e, a));
|
|
333
355
|
let o = a;
|
|
334
356
|
return Array.from({ length: i }, (e, t) => t + 1).filter((e) => !t.has(e)).map((e) => {
|
|
335
357
|
let t = o.get(e);
|
|
@@ -338,22 +360,22 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
338
360
|
height: n.get(e) ?? Ke
|
|
339
361
|
}, o.set(e, t)), t;
|
|
340
362
|
});
|
|
341
|
-
}),
|
|
363
|
+
}), H = v(() => {
|
|
342
364
|
let e = /* @__PURE__ */ new Map();
|
|
343
365
|
for (let t of h.value?.rows ?? []) for (let n of t.cells) e.set(`${t.row},${n.col}`, n);
|
|
344
366
|
return e;
|
|
345
|
-
}),
|
|
367
|
+
}), ae = v(() => {
|
|
346
368
|
let e = /* @__PURE__ */ new Map();
|
|
347
369
|
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}`, {
|
|
348
370
|
row: t.row,
|
|
349
371
|
col: n.col
|
|
350
372
|
});
|
|
351
373
|
return e;
|
|
352
|
-
}),
|
|
353
|
-
let n =
|
|
374
|
+
}), U = (e, t) => H.value.get(`${e},${t}`), le = (e, t) => {
|
|
375
|
+
let n = U(e, t)?.span;
|
|
354
376
|
if (n) return {
|
|
355
|
-
rows:
|
|
356
|
-
cols:
|
|
377
|
+
rows: B.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
|
|
378
|
+
cols: j.value.filter((e) => e.col >= t && e.col < t + n.cols).length
|
|
357
379
|
};
|
|
358
380
|
}, W = (e) => e?.style === void 0 ? void 0 : o.preview.styles[e.style], ue = (e) => {
|
|
359
381
|
let t = e.numFmt === void 0 ? void 0 : o.preview.numberFormats?.[e.numFmt], a = e.value;
|
|
@@ -412,7 +434,8 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
412
434
|
let e = `${4 + r.indent * 9}px`;
|
|
413
435
|
o.textAlign === "right" ? o.paddingRight = e : o.paddingLeft = e;
|
|
414
436
|
}
|
|
415
|
-
|
|
437
|
+
let l = Qe(t, n);
|
|
438
|
+
return me(t, n) ? (o.borderStyle = "hidden", o.boxShadow = [...l, Ce(e, t, n)].filter(Boolean).join(", ")) : (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 = [...l, ...ge(e, t, n)].join(", ")), Object.assign(o, X(t, n)), o;
|
|
416
439
|
}, me = (e, t) => {
|
|
417
440
|
let n = h.value?.frozen;
|
|
418
441
|
return !!n && (e <= n.rows || t <= n.cols);
|
|
@@ -423,8 +446,8 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
423
446
|
left: (e) => `inset ${e.width}px 0 0 ${e.color}`
|
|
424
447
|
}, he = (...e) => e.reduce((e, t) => t && (!e || t.width > e.width) ? t : e, void 0), ge = (e, t, n) => {
|
|
425
448
|
let r = W(e)?.borders;
|
|
426
|
-
return [t ===
|
|
427
|
-
}, _e = v(() =>
|
|
449
|
+
return [t === B.value[0]?.row && r?.top && J.top(r.top), n === j.value[0]?.col && r?.left && J.left(r.left)].filter((e) => !!e);
|
|
450
|
+
}, _e = v(() => B.value.map((e) => e.row)), Y = v(() => j.value.map((e) => e.col)), ve = v(() => new Map(_e.value.map((e, t) => [e, t]))), ye = v(() => new Map(Y.value.map((e, t) => [e, t]))), be = (e, t, n, r) => {
|
|
428
451
|
let i = [], a = t.get(n) ?? e.length;
|
|
429
452
|
for (; a < e.length && e[a] < n + r; a++) i.push(e[a]);
|
|
430
453
|
return {
|
|
@@ -440,8 +463,8 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
440
463
|
row: a,
|
|
441
464
|
col: e
|
|
442
465
|
}))).map((e) => {
|
|
443
|
-
let t =
|
|
444
|
-
return
|
|
466
|
+
let t = ae.value.get(`${e.row},${e.col}`) ?? e;
|
|
467
|
+
return U(t.row, t.col);
|
|
445
468
|
});
|
|
446
469
|
}, Ce = (e, t, n) => {
|
|
447
470
|
let r = W(e)?.borders, i = he(r?.right, ...Se(e, t, n, "right").map((e) => W(e)?.borders?.left)), a = he(r?.bottom, ...Se(e, t, n, "bottom").map((e) => W(e)?.borders?.top)), o = h.value?.gridlines;
|
|
@@ -450,7 +473,7 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
450
473
|
a ? J.bottom(a) : o && "inset 0 calc(var(--border) * -1) 0 var(--pk-spreadsheet-gridline)",
|
|
451
474
|
...ge(e, t, n)
|
|
452
475
|
].filter(Boolean).join(", ");
|
|
453
|
-
}, we = (e) => qe +
|
|
476
|
+
}, we = (e) => qe + B.value.filter((t) => t.row < e).reduce((e, t) => e + t.height, 0), Te = (e) => Je + j.value.filter((t) => t.col < e).reduce((e, t) => e + t.width, 0), Ee = v(() => {
|
|
454
477
|
let e = h.value?.frozen;
|
|
455
478
|
return {
|
|
456
479
|
top: we((e?.rows ?? 0) + 1),
|
|
@@ -461,14 +484,14 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
461
484
|
if (!n) return {};
|
|
462
485
|
let r = {};
|
|
463
486
|
return e <= n.rows && (r.position = "sticky", r.top = `${we(e)}px`, r.scrollMarginTop = r.top, r.zIndex = 0), t <= n.cols && (r.position = "sticky", r.left = `${Te(t)}px`, r.scrollMarginLeft = r.left, r.zIndex = +(e <= n.rows)), r;
|
|
464
|
-
}, Z =
|
|
487
|
+
}, Z = P({
|
|
465
488
|
row: 1,
|
|
466
489
|
col: 1
|
|
467
|
-
}), Q =
|
|
490
|
+
}), Q = P({
|
|
468
491
|
row: 1,
|
|
469
492
|
col: 1
|
|
470
493
|
});
|
|
471
|
-
|
|
494
|
+
V(h, () => {
|
|
472
495
|
Z.value = {
|
|
473
496
|
row: 1,
|
|
474
497
|
col: 1
|
|
@@ -482,20 +505,30 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
482
505
|
r2: Math.max(Z.value.row, Q.value.row),
|
|
483
506
|
c1: Math.min(Z.value.col, Q.value.col),
|
|
484
507
|
c2: Math.max(Z.value.col, Q.value.col)
|
|
485
|
-
})), Ye = (e, t) => e >= $.value.r1 && e <= $.value.r2 && t >= $.value.c1 && t <= $.value.c2, Xe = (e, t) => Q.value.row === e && Q.value.col === t, Ze = (e) => e >= $.value.r1 && e <= $.value.r2 ? `${$.value.c1}:${$.value.c2}:${Q.value.row === e ? Q.value.col : 0}
|
|
508
|
+
})), Ye = (e, t) => e >= $.value.r1 && e <= $.value.r2 && t >= $.value.c1 && t <= $.value.c2, Xe = (e, t) => Q.value.row === e && Q.value.col === t, Ze = (e) => e >= $.value.r1 && e <= $.value.r2 ? `${$.value.c1}:${$.value.c2}:${Q.value.row === e ? Q.value.col : 0}:${e === $.value.r1 ? "t" : ""}${e === $.value.r2 ? "b" : ""}` : "", Qe = (e, t) => {
|
|
509
|
+
let { r1: n, r2: r, c1: i, c2: a } = $.value;
|
|
510
|
+
if (n === r && i === a || !Ye(e, t)) return [];
|
|
511
|
+
let o = U(e, t)?.span, s = e + (o?.rows ?? 1) - 1, c = t + (o?.cols ?? 1) - 1, l = "var(--spacing-2)", u = "var(--pk-spreadsheet-green)";
|
|
512
|
+
return [
|
|
513
|
+
e === n && `inset 0 ${l} 0 ${u}`,
|
|
514
|
+
s >= r && `inset 0 calc(${l} * -1) 0 ${u}`,
|
|
515
|
+
t === i && `inset ${l} 0 0 ${u}`,
|
|
516
|
+
c >= a && `inset calc(${l} * -1) 0 0 ${u}`
|
|
517
|
+
].filter((e) => !!e);
|
|
518
|
+
}, $e = P(!1), et = (e, t, n) => {
|
|
486
519
|
f.value?.focus({ preventScroll: !0 }), Q.value = {
|
|
487
520
|
row: e,
|
|
488
521
|
col: t
|
|
489
522
|
}, n.shiftKey || (Z.value = {
|
|
490
523
|
row: e,
|
|
491
524
|
col: t
|
|
492
|
-
}),
|
|
493
|
-
},
|
|
494
|
-
|
|
525
|
+
}), $e.value = !0;
|
|
526
|
+
}, tt = (e, t) => {
|
|
527
|
+
$e.value && (Q.value = {
|
|
495
528
|
row: e,
|
|
496
529
|
col: t
|
|
497
530
|
});
|
|
498
|
-
},
|
|
531
|
+
}, nt, rt = () => {
|
|
499
532
|
let e = [...f.value?.querySelectorAll(".pk-spreadsheet-preview__cell--range, [data-focus]") ?? []].map((e) => e.getBoundingClientRect());
|
|
500
533
|
if (e.length) return {
|
|
501
534
|
start: {
|
|
@@ -504,19 +537,19 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
504
537
|
},
|
|
505
538
|
bottom: Math.max(...e.map((e) => e.bottom))
|
|
506
539
|
};
|
|
507
|
-
},
|
|
540
|
+
}, it = () => h.value ? {
|
|
508
541
|
...xe(h.value, $.value),
|
|
509
|
-
measure:
|
|
542
|
+
measure: rt
|
|
510
543
|
} : void 0;
|
|
511
|
-
|
|
512
|
-
clearTimeout(
|
|
544
|
+
V([$, $e], () => {
|
|
545
|
+
clearTimeout(nt), !$e.value && (nt = setTimeout(() => {
|
|
513
546
|
let e = $.value, t = e.r2 > e.r1 || e.c2 > e.c1;
|
|
514
|
-
s("select", t ?
|
|
547
|
+
s("select", t ? it() : void 0);
|
|
515
548
|
}, 150));
|
|
516
549
|
});
|
|
517
|
-
let
|
|
518
|
-
clearTimeout(
|
|
519
|
-
},
|
|
550
|
+
let at = () => {
|
|
551
|
+
clearTimeout(nt), s("select", it());
|
|
552
|
+
}, ot = (e) => {
|
|
520
553
|
let t = {
|
|
521
554
|
ArrowUp: [-1, 0],
|
|
522
555
|
ArrowDown: [1, 0],
|
|
@@ -527,7 +560,7 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
527
560
|
}[e.key];
|
|
528
561
|
if (!t) return;
|
|
529
562
|
e.preventDefault();
|
|
530
|
-
let n =
|
|
563
|
+
let n = B.value.map((e) => e.row), r = j.value.map((e) => e.col), i = (e) => ae.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;
|
|
531
564
|
for (;;) {
|
|
532
565
|
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]));
|
|
533
566
|
if (e === o && l === s || (o = e, s = l, c = i({
|
|
@@ -535,16 +568,16 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
535
568
|
col: r[s]
|
|
536
569
|
}), c.row !== a.row || c.col !== a.col)) break;
|
|
537
570
|
}
|
|
538
|
-
Q.value = c, e.shiftKey || (Z.value = c),
|
|
571
|
+
Q.value = c, e.shiftKey || (Z.value = c), te(() => f.value?.querySelector("[data-focus]")?.scrollIntoView({
|
|
539
572
|
block: "nearest",
|
|
540
573
|
inline: "nearest"
|
|
541
574
|
}));
|
|
542
|
-
},
|
|
575
|
+
}, st = v(() => U(Q.value.row, Q.value.col)), ct = v(() => {
|
|
543
576
|
let { r1: e, r2: t, c1: n, c2: r } = $.value;
|
|
544
577
|
if (e === t && n === r) return;
|
|
545
578
|
let i = 0, a = 0, o = 0, s;
|
|
546
579
|
for (let c = e; c <= t; c++) for (let e = n; e <= r; e++) {
|
|
547
|
-
let t =
|
|
580
|
+
let t = U(c, e);
|
|
548
581
|
t && (t.value !== void 0 || t.missing) && (i++, typeof t.value == "number" && (a += t.value, o++, s ??= t));
|
|
549
582
|
}
|
|
550
583
|
if (i) return {
|
|
@@ -552,25 +585,25 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
552
585
|
sum: s ? de(s, a) : void 0,
|
|
553
586
|
average: s ? de(s, a / o) : void 0
|
|
554
587
|
};
|
|
555
|
-
}),
|
|
588
|
+
}), lt = (e) => {
|
|
556
589
|
d.value = Math.min(2, Math.max(.5, Math.round((d.value + e) * 10) / 10));
|
|
557
590
|
};
|
|
558
591
|
return (t, n) => {
|
|
559
592
|
let r = a;
|
|
560
|
-
return
|
|
593
|
+
return N(), x("div", De, [
|
|
561
594
|
S("div", Oe, [
|
|
562
595
|
S("span", {
|
|
563
596
|
class: "pk-spreadsheet-preview__ref",
|
|
564
|
-
"aria-label":
|
|
565
|
-
},
|
|
597
|
+
"aria-label": R(c)("chatFilePreview.cell")
|
|
598
|
+
}, L(O(Q.value.col)) + L(Q.value.row), 9, ke),
|
|
566
599
|
n[6] ||= S("span", {
|
|
567
600
|
class: "pk-spreadsheet-preview__fx",
|
|
568
601
|
"aria-hidden": "true"
|
|
569
602
|
}, "fx", -1),
|
|
570
603
|
S("output", {
|
|
571
604
|
class: "pk-spreadsheet-preview__formula",
|
|
572
|
-
"aria-label":
|
|
573
|
-
},
|
|
605
|
+
"aria-label": R(c)("chatFilePreview.formulaBar")
|
|
606
|
+
}, L(pe(st.value)), 9, Ae)
|
|
574
607
|
]),
|
|
575
608
|
S("div", {
|
|
576
609
|
ref_key: "scrollEl",
|
|
@@ -579,119 +612,119 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
579
612
|
tabindex: "0",
|
|
580
613
|
role: "grid",
|
|
581
614
|
"aria-label": h.value?.name,
|
|
582
|
-
onKeydown:
|
|
583
|
-
onMouseup: n[2] ||= (e) =>
|
|
584
|
-
onMouseleave: n[3] ||= (e) =>
|
|
585
|
-
}, [h.value ? (
|
|
615
|
+
onKeydown: ot,
|
|
616
|
+
onMouseup: n[2] ||= (e) => $e.value = !1,
|
|
617
|
+
onMouseleave: n[3] ||= (e) => $e.value = !1
|
|
618
|
+
}, [h.value ? (N(), x("table", {
|
|
586
619
|
key: 0,
|
|
587
|
-
class:
|
|
588
|
-
style:
|
|
620
|
+
class: k(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": h.value.gridlines }]),
|
|
621
|
+
style: A({
|
|
589
622
|
zoom: d.value,
|
|
590
|
-
width: `${
|
|
623
|
+
width: `${M.value}px`,
|
|
591
624
|
"--pk-spreadsheet-stuck-top": `${Ee.value.top}px`,
|
|
592
625
|
"--pk-spreadsheet-stuck-left": `${Ee.value.left}px`
|
|
593
626
|
})
|
|
594
627
|
}, [
|
|
595
|
-
S("colgroup", null, [S("col", { style:
|
|
628
|
+
S("colgroup", null, [S("col", { style: A({ width: `${Je}px` }) }, null, 4), (N(!0), x(_, null, F(j.value, (e) => (N(), x("col", {
|
|
596
629
|
key: e.col,
|
|
597
|
-
style:
|
|
630
|
+
style: A({ width: `${e.width}px` })
|
|
598
631
|
}, null, 4))), 128))]),
|
|
599
|
-
S("thead", null, [S("tr", { style:
|
|
632
|
+
S("thead", null, [S("tr", { style: A({ height: `${qe}px` }) }, [n[7] ||= S("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (N(!0), x(_, null, F(j.value, (e) => (N(), x("th", {
|
|
600
633
|
key: e.col,
|
|
601
634
|
scope: "col",
|
|
602
|
-
class:
|
|
603
|
-
style:
|
|
635
|
+
class: k(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= $.value.c1 && e.col <= $.value.c2 }]),
|
|
636
|
+
style: A(h.value.frozen && e.col <= h.value.frozen.cols ? {
|
|
604
637
|
left: `${Te(e.col)}px`,
|
|
605
638
|
zIndex: 2
|
|
606
639
|
} : void 0)
|
|
607
|
-
},
|
|
608
|
-
S("tbody", null, [(
|
|
640
|
+
}, L(O(e.col)), 7))), 128))], 4)]),
|
|
641
|
+
S("tbody", null, [(N(!0), x(_, null, F(B.value, (e, t, n, r) => {
|
|
609
642
|
let i = [
|
|
610
643
|
e,
|
|
611
644
|
h.value,
|
|
612
|
-
|
|
613
|
-
|
|
645
|
+
re.value,
|
|
646
|
+
R(l),
|
|
614
647
|
Ze(e.row),
|
|
615
648
|
y.value.get(e.row)
|
|
616
649
|
];
|
|
617
|
-
if (r && r.el && r.key === e.row &&
|
|
618
|
-
let a = (
|
|
650
|
+
if (r && r.el && r.key === e.row && D(r, i)) return r;
|
|
651
|
+
let a = (N(), x("tr", {
|
|
619
652
|
key: e.row,
|
|
620
|
-
style:
|
|
653
|
+
style: A({ height: `${e.height}px` })
|
|
621
654
|
}, [S("th", {
|
|
622
655
|
scope: "row",
|
|
623
|
-
class:
|
|
624
|
-
style:
|
|
656
|
+
class: k(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= $.value.r1 && e.row <= $.value.r2 }]),
|
|
657
|
+
style: A(h.value.frozen && e.row <= h.value.frozen.rows ? {
|
|
625
658
|
...X(e.row, 0),
|
|
626
659
|
left: 0,
|
|
627
660
|
zIndex: 4
|
|
628
661
|
} : void 0)
|
|
629
|
-
},
|
|
662
|
+
}, L(e.row), 7), (N(!0), x(_, null, F(j.value, (t) => (N(), x(_, { key: t.col }, [ae.value.has(`${e.row},${t.col}`) ? b("", !0) : (N(), x("td", {
|
|
630
663
|
key: 0,
|
|
631
664
|
rowspan: le(e.row, t.col)?.rows,
|
|
632
665
|
colspan: le(e.row, t.col)?.cols,
|
|
633
|
-
class:
|
|
666
|
+
class: k(["pk-spreadsheet-preview__cell", {
|
|
634
667
|
"pk-spreadsheet-preview__cell--range": Ye(e.row, t.col) && !Xe(e.row, t.col),
|
|
635
|
-
"pk-spreadsheet-preview__cell--missing":
|
|
668
|
+
"pk-spreadsheet-preview__cell--missing": U(e.row, t.col)?.missing,
|
|
636
669
|
"pk-spreadsheet-preview__cell--marked": T(e.row, t.col)
|
|
637
670
|
}]),
|
|
638
|
-
style:
|
|
671
|
+
style: A(q(U(e.row, t.col), e.row, t.col)),
|
|
639
672
|
"data-focus": Xe(e.row, t.col) ? "" : void 0,
|
|
640
|
-
title:
|
|
641
|
-
onMousedown:
|
|
642
|
-
onMouseenter: (n) =>
|
|
643
|
-
onDblclick:
|
|
644
|
-
},
|
|
673
|
+
title: U(e.row, t.col)?.missing ? R(c)("chatFilePreview.missingValue") : void 0,
|
|
674
|
+
onMousedown: oe((n) => et(e.row, t.col, n), ["prevent"]),
|
|
675
|
+
onMouseenter: (n) => tt(e.row, t.col),
|
|
676
|
+
onDblclick: at
|
|
677
|
+
}, L(G(U(e.row, t.col))), 47, Me))], 64))), 128))], 4));
|
|
645
678
|
return a.memo = i, a;
|
|
646
679
|
}, n, 0), 128))])
|
|
647
|
-
], 6)) : b("", !0), h.value && (h.value.moreRows || h.value.moreColumns) ? (
|
|
680
|
+
], 6)) : b("", !0), h.value && (h.value.moreRows || h.value.moreColumns) ? (N(), x("p", Ne, [h.value.moreRows ? (N(), x(_, { key: 0 }, [C(L(R(c)("chatFilePreview.moreRows", h.value.moreRows)), 1)], 64)) : b("", !0), h.value.moreColumns ? (N(), x(_, { key: 1 }, [C(L(R(c)("chatFilePreview.moreColumns", h.value.moreColumns)), 1)], 64)) : b("", !0)])) : b("", !0)], 40, je),
|
|
648
681
|
S("nav", {
|
|
649
682
|
class: "pk-spreadsheet-preview__sheets",
|
|
650
|
-
"aria-label":
|
|
651
|
-
}, [(
|
|
683
|
+
"aria-label": R(c)("chatFilePreview.sheets")
|
|
684
|
+
}, [(N(!0), x(_, null, F(e.preview.sheets, (e, t) => (N(), x("button", {
|
|
652
685
|
key: e.name,
|
|
653
686
|
type: "button",
|
|
654
687
|
class: "pk-spreadsheet-preview__sheet",
|
|
655
688
|
"aria-current": t === u.value ? "page" : void 0,
|
|
656
689
|
onClick: (e) => u.value = t
|
|
657
|
-
},
|
|
658
|
-
S("div", Ie, [S("p", Le, [e.preview.staleFormulas ? (
|
|
690
|
+
}, L(e.name), 9, Fe))), 128))], 8, Pe),
|
|
691
|
+
S("div", Ie, [S("p", Le, [e.preview.staleFormulas ? (N(), x("span", {
|
|
659
692
|
key: 0,
|
|
660
693
|
class: "pk-spreadsheet-preview__note",
|
|
661
|
-
title:
|
|
662
|
-
},
|
|
694
|
+
title: R(c)("chatFilePreview.staleFormulas")
|
|
695
|
+
}, L(R(c)("chatFilePreview.staleFormulas")), 9, Re)) : e.preview.computedFormulas ? (N(), x("span", {
|
|
663
696
|
key: 1,
|
|
664
697
|
class: "pk-spreadsheet-preview__note",
|
|
665
|
-
title:
|
|
666
|
-
},
|
|
667
|
-
|
|
668
|
-
S("span", null,
|
|
669
|
-
|
|
698
|
+
title: R(c)("chatFilePreview.computedFormulas")
|
|
699
|
+
}, L(R(c)("chatFilePreview.computedFormulas")), 9, ze)) : b("", !0), ct.value ? (N(), x("span", Be, [
|
|
700
|
+
ct.value.average ? (N(), x("span", Ve, L(R(c)("chatFilePreview.average")) + " " + L(ct.value.average), 1)) : b("", !0),
|
|
701
|
+
S("span", null, L(R(c)("chatFilePreview.count")) + " " + L(ct.value.count), 1),
|
|
702
|
+
ct.value.sum ? (N(), x("span", He, L(R(c)("chatFilePreview.sum")) + " " + L(ct.value.sum), 1)) : b("", !0)
|
|
670
703
|
])) : b("", !0)]), S("div", Ue, [
|
|
671
704
|
w(r, {
|
|
672
705
|
modifiers: "action-quiet",
|
|
673
706
|
icon: "ri:subtract-line",
|
|
674
|
-
"aria-label":
|
|
707
|
+
"aria-label": R(c)("chatFilePreview.zoomOut"),
|
|
675
708
|
disabled: d.value <= .5,
|
|
676
|
-
onClick: n[4] ||= (e) =>
|
|
709
|
+
onClick: n[4] ||= (e) => lt(-.1)
|
|
677
710
|
}, null, 8, ["aria-label", "disabled"]),
|
|
678
|
-
S("span", We,
|
|
711
|
+
S("span", We, L(Math.round(d.value * 100)) + "% ", 1),
|
|
679
712
|
w(r, {
|
|
680
713
|
modifiers: "action-quiet",
|
|
681
714
|
icon: "ri:add-line",
|
|
682
|
-
"aria-label":
|
|
715
|
+
"aria-label": R(c)("chatFilePreview.zoomIn"),
|
|
683
716
|
disabled: d.value >= 2,
|
|
684
|
-
onClick: n[5] ||= (e) =>
|
|
717
|
+
onClick: n[5] ||= (e) => lt(.1)
|
|
685
718
|
}, null, 8, ["aria-label", "disabled"])
|
|
686
719
|
])])
|
|
687
720
|
]);
|
|
688
721
|
};
|
|
689
722
|
}
|
|
690
|
-
}),
|
|
723
|
+
}), Xe = ["src"], Ze = {
|
|
691
724
|
key: 1,
|
|
692
725
|
class: "pk-word-preview__image",
|
|
693
726
|
"data-quote-skip": ""
|
|
694
|
-
},
|
|
727
|
+
}, Qe = ["title"], $e = ["title"], et = ["data-quote-skip"], tt = /* @__PURE__ */ T({
|
|
695
728
|
__name: "PkWordPreviewRuns",
|
|
696
729
|
props: {
|
|
697
730
|
runs: {},
|
|
@@ -742,34 +775,34 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
742
775
|
textDecoration: [...n].join(" ")
|
|
743
776
|
};
|
|
744
777
|
}, g = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
|
|
745
|
-
return (e, t) => (
|
|
778
|
+
return (e, t) => (N(!0), x(_, null, F(u.value, (e, t) => (N(), x(_, { key: t }, [e.image ? (N(), x(_, { key: 0 }, [e.picture && i(e) ? (N(), x(_, { key: 0 }, [a(e.picture) === "page" ? b("", !0) : (N(), x("img", {
|
|
746
779
|
key: 0,
|
|
747
|
-
class:
|
|
748
|
-
style:
|
|
780
|
+
class: k(["pk-word-preview__picture", `pk-word-preview__picture--${a(e.picture)}`]),
|
|
781
|
+
style: A(o(e.picture)),
|
|
749
782
|
src: i(e),
|
|
750
783
|
alt: ""
|
|
751
|
-
}, null, 14,
|
|
784
|
+
}, null, 14, Xe))], 64)) : (N(), x("span", Ze, L(R(n)("chatFilePreview.image")), 1))], 64)) : f.value && e.change === "deleted" ? (N(), x("del", {
|
|
752
785
|
key: 1,
|
|
753
786
|
class: "pk-word-preview__removed",
|
|
754
787
|
"data-quote-skip": "",
|
|
755
|
-
style:
|
|
788
|
+
style: A(ee(e)),
|
|
756
789
|
title: g(e)
|
|
757
|
-
},
|
|
790
|
+
}, L(l(e)), 13, Qe)) : f.value && e.change === "inserted" ? (N(), x("ins", {
|
|
758
791
|
key: 2,
|
|
759
792
|
class: "pk-word-preview__added",
|
|
760
|
-
style:
|
|
793
|
+
style: A(ee(e)),
|
|
761
794
|
title: g(e)
|
|
762
|
-
},
|
|
795
|
+
}, L(l(e)), 13, $e)) : (N(), x("span", {
|
|
763
796
|
key: 3,
|
|
764
|
-
style:
|
|
797
|
+
style: A(p(e)),
|
|
765
798
|
"data-quote-skip": e.label ? "" : void 0
|
|
766
|
-
},
|
|
799
|
+
}, L(l(e)), 13, et))], 64))), 128));
|
|
767
800
|
}
|
|
768
|
-
}),
|
|
801
|
+
}), nt = { key: 0 }, rt = ["data-paragraph", "colspan"], it = [
|
|
769
802
|
"data-paragraph",
|
|
770
803
|
"role",
|
|
771
804
|
"aria-level"
|
|
772
|
-
],
|
|
805
|
+
], at = { key: 1 }, ot = /* @__PURE__ */ T({
|
|
773
806
|
__name: "PkWordPreviewBlock",
|
|
774
807
|
props: {
|
|
775
808
|
block: {},
|
|
@@ -803,27 +836,27 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
803
836
|
let e = t.block.widths ?? [], n = e.reduce((e, t) => e + t, 0);
|
|
804
837
|
return n ? e.map((e) => `${e / n * 100}%`) : [];
|
|
805
838
|
}), s = v(() => t.block.kind !== "table" && !!t.block.id && !!t.marked?.has(t.block.id)), c = (e) => !!e?.some((e) => t.marked?.has(e)), l = v(() => t.mode === "markup" && !!a.value?.some((e) => e.runs.some((e) => e.change)));
|
|
806
|
-
return (t, u) => e.block.kind === "table" && a.value ? (
|
|
839
|
+
return (t, u) => e.block.kind === "table" && a.value ? (N(), x("table", {
|
|
807
840
|
key: 0,
|
|
808
|
-
class:
|
|
841
|
+
class: k(["pk-word-preview__table", {
|
|
809
842
|
"pk-word-preview__table--lines": e.block.borders,
|
|
810
843
|
"pk-word-preview__table--next": e.row !== 0,
|
|
811
844
|
"pk-word-preview__changed": l.value
|
|
812
845
|
}])
|
|
813
|
-
}, [o.value.length ? (
|
|
846
|
+
}, [o.value.length ? (N(), x("colgroup", nt, [(N(!0), x(_, null, F(o.value, (e, t) => (N(), x("col", {
|
|
814
847
|
key: t,
|
|
815
|
-
style:
|
|
816
|
-
}, null, 4))), 128))])) : b("", !0), S("tbody", null, [S("tr", null, [(
|
|
848
|
+
style: A({ width: e })
|
|
849
|
+
}, null, 4))), 128))])) : b("", !0), S("tbody", null, [S("tr", null, [(N(!0), x(_, null, F(a.value, (t, n) => (N(), x("td", {
|
|
817
850
|
key: n,
|
|
818
851
|
"data-paragraph": t.ids?.join(" "),
|
|
819
|
-
class:
|
|
852
|
+
class: k({ "pk-word-preview__marked": c(t.ids) }),
|
|
820
853
|
colspan: t.span,
|
|
821
|
-
style:
|
|
854
|
+
style: A({
|
|
822
855
|
backgroundColor: t.fill,
|
|
823
856
|
textAlign: t.align,
|
|
824
857
|
fontSize: t.size ? `${t.size}pt` : void 0
|
|
825
858
|
})
|
|
826
|
-
}, [w(
|
|
859
|
+
}, [w(tt, {
|
|
827
860
|
runs: t.runs,
|
|
828
861
|
mode: e.mode,
|
|
829
862
|
numbers: e.numbers
|
|
@@ -831,24 +864,24 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
831
864
|
"runs",
|
|
832
865
|
"mode",
|
|
833
866
|
"numbers"
|
|
834
|
-
])], 14,
|
|
867
|
+
])], 14, rt))), 128))])])], 2)) : e.block.kind === "table" ? b("", !0) : (N(), x("div", {
|
|
835
868
|
key: 1,
|
|
836
|
-
class:
|
|
869
|
+
class: k(["pk-word-preview__block", {
|
|
837
870
|
"pk-word-preview__changed": i.value,
|
|
838
871
|
"pk-word-preview__marked": s.value
|
|
839
872
|
}]),
|
|
840
873
|
"data-paragraph": e.block.id,
|
|
841
874
|
role: e.block.kind === "heading" ? "heading" : void 0,
|
|
842
875
|
"aria-level": e.block.kind === "heading" ? Math.max(1, e.block.level) : void 0,
|
|
843
|
-
style:
|
|
876
|
+
style: A(n.value)
|
|
844
877
|
}, [
|
|
845
|
-
e.block.label ? (
|
|
878
|
+
e.block.label ? (N(), x("span", {
|
|
846
879
|
key: 0,
|
|
847
880
|
class: "pk-word-preview__label",
|
|
848
881
|
"data-quote-skip": "",
|
|
849
|
-
style:
|
|
850
|
-
},
|
|
851
|
-
w(
|
|
882
|
+
style: A(r.value)
|
|
883
|
+
}, L(e.block.label), 5)) : b("", !0),
|
|
884
|
+
w(tt, {
|
|
852
885
|
runs: e.block.runs,
|
|
853
886
|
mode: e.mode,
|
|
854
887
|
page: e.page,
|
|
@@ -859,10 +892,10 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
859
892
|
"page",
|
|
860
893
|
"numbers"
|
|
861
894
|
]),
|
|
862
|
-
!e.block.label && !e.block.runs.length ? (
|
|
863
|
-
], 14,
|
|
895
|
+
!e.block.label && !e.block.runs.length ? (N(), x("br", at)) : b("", !0)
|
|
896
|
+
], 14, it));
|
|
864
897
|
}
|
|
865
|
-
}),
|
|
898
|
+
}), st = { class: "pk-word-preview__part" }, ct = ["src"], lt = /* @__PURE__ */ T({
|
|
866
899
|
__name: "PkWordPreviewPart",
|
|
867
900
|
props: {
|
|
868
901
|
blocks: {},
|
|
@@ -886,10 +919,10 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
886
919
|
...t.where === "header" ? { top: `${t.section.headerDistance}pt` } : { bottom: `${t.section.footerDistance}pt` }
|
|
887
920
|
};
|
|
888
921
|
});
|
|
889
|
-
return (t, n) => (
|
|
922
|
+
return (t, n) => (N(), x("div", st, [S("div", {
|
|
890
923
|
class: "pk-word-preview__part-flow",
|
|
891
|
-
style:
|
|
892
|
-
}, [(
|
|
924
|
+
style: A(a.value)
|
|
925
|
+
}, [(N(!0), x(_, null, F(r.value, (t) => (N(), y(ot, {
|
|
893
926
|
key: t.key,
|
|
894
927
|
block: e.blocks[t.block],
|
|
895
928
|
row: t.row,
|
|
@@ -902,47 +935,47 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
902
935
|
"mode",
|
|
903
936
|
"page",
|
|
904
937
|
"numbers"
|
|
905
|
-
]))), 128))], 4), (
|
|
938
|
+
]))), 128))], 4), (N(!0), x(_, null, F(i.value, (e, t) => (N(), x("img", {
|
|
906
939
|
key: t,
|
|
907
940
|
class: "pk-word-preview__float",
|
|
908
|
-
style:
|
|
941
|
+
style: A(e.css),
|
|
909
942
|
src: e.src,
|
|
910
943
|
alt: ""
|
|
911
|
-
}, null, 12,
|
|
944
|
+
}, null, 12, ct))), 128))]));
|
|
912
945
|
}
|
|
913
|
-
}),
|
|
946
|
+
}), ut = ["aria-label"], dt = {
|
|
914
947
|
class: "pk-word-preview__tabs",
|
|
915
948
|
role: "tablist"
|
|
916
|
-
},
|
|
949
|
+
}, ft = ["aria-selected"], pt = ["aria-selected"], mt = {
|
|
917
950
|
key: 0,
|
|
918
951
|
class: "pk-word-preview__list"
|
|
919
|
-
},
|
|
952
|
+
}, ht = ["aria-current", "onClick"], gt = { class: "pk-word-preview__entry-text" }, _t = {
|
|
920
953
|
key: 0,
|
|
921
954
|
class: "u-dot"
|
|
922
|
-
},
|
|
955
|
+
}, vt = {
|
|
923
956
|
key: 0,
|
|
924
957
|
class: "pk-word-preview__none"
|
|
925
|
-
},
|
|
958
|
+
}, yt = {
|
|
926
959
|
key: 1,
|
|
927
960
|
class: "pk-word-preview__list"
|
|
928
|
-
},
|
|
961
|
+
}, bt = ["onClick"], xt = {
|
|
929
962
|
key: 0,
|
|
930
963
|
class: "pk-word-preview__removed"
|
|
931
|
-
},
|
|
964
|
+
}, St = {
|
|
932
965
|
key: 1,
|
|
933
966
|
class: "pk-word-preview__added"
|
|
934
|
-
},
|
|
967
|
+
}, Ct = { class: "pk-word-preview__main" }, wt = ["aria-label"], Tt = ["src"], Et = {
|
|
935
968
|
key: 2,
|
|
936
969
|
class: "pk-word-preview__truncated"
|
|
937
|
-
},
|
|
970
|
+
}, Dt = { class: "pk-word-preview__status" }, Ot = {
|
|
938
971
|
key: 0,
|
|
939
972
|
class: "pk-word-preview__count"
|
|
940
|
-
},
|
|
973
|
+
}, kt = { class: "pk-word-preview__count" }, At = {
|
|
941
974
|
key: 1,
|
|
942
975
|
class: "pk-word-preview__legend"
|
|
943
|
-
},
|
|
976
|
+
}, jt = ["title"], Mt = { class: "pk-word-preview__removed" }, Nt = { class: "pk-word-preview__added" }, Pt = { class: "pk-word-preview__percent" }, Ft = ["data-part"], It = 96 / 72, Lt = .5, Rt = /* @__PURE__ */ T({
|
|
944
977
|
__name: "PkWordPreview",
|
|
945
|
-
props: /*@__PURE__*/
|
|
978
|
+
props: /*@__PURE__*/ O({
|
|
946
979
|
preview: {},
|
|
947
980
|
mode: {},
|
|
948
981
|
marked: {}
|
|
@@ -955,26 +988,26 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
955
988
|
zoom: { default: 1 },
|
|
956
989
|
zoomModifiers: {}
|
|
957
990
|
}),
|
|
958
|
-
emits: /*@__PURE__*/
|
|
991
|
+
emits: /*@__PURE__*/ O(["select"], ["update:fit", "update:zoom"]),
|
|
959
992
|
setup(e, { emit: t }) {
|
|
960
993
|
let n = e, r = t, { t: i } = se({ useScope: "global" });
|
|
961
|
-
|
|
962
|
-
let u = (e) => d(e, n.mode), h = v(() => f(n.preview.blocks, n.mode)), g =
|
|
994
|
+
re(m, v(() => n.preview.images));
|
|
995
|
+
let u = (e) => d(e, n.mode), h = v(() => f(n.preview.blocks, n.mode)), g = ie("rootEl"), C = ie("scrollEl"), T = ie("measureEl"), { width: E } = ce(g), { width: D } = ce(C), O = v(() => E.value >= 1e3), M = v(() => n.preview.sections?.length ? n.preview.sections : [{
|
|
963
996
|
page: n.preview.page,
|
|
964
997
|
headerDistance: 0,
|
|
965
998
|
footerDistance: 0,
|
|
966
999
|
headers: {},
|
|
967
1000
|
footers: {}
|
|
968
|
-
}]),
|
|
1001
|
+
}]), I = v(() => M.value[0].page), B = v(() => (D.value - 48) / (I.value.width * It)), H = v(() => E.value === 0 || D.value === 0 || B.value >= Lt), ae = v(() => ({
|
|
969
1002
|
fontFamily: s(n.preview.defaults.font),
|
|
970
1003
|
fontSize: `${n.preview.defaults.size}pt`,
|
|
971
1004
|
color: n.preview.defaults.color ?? "#000000",
|
|
972
1005
|
"--pk-word-line": p(n.preview.defaults.font),
|
|
973
1006
|
"--pk-word-size": `${n.preview.defaults.size}pt`
|
|
974
|
-
})),
|
|
975
|
-
...
|
|
976
|
-
width: `${
|
|
977
|
-
})), le =
|
|
1007
|
+
})), U = v(() => I.value.width - I.value.margins.left - I.value.margins.right), oe = v(() => ({
|
|
1008
|
+
...ae.value,
|
|
1009
|
+
width: `${U.value}pt`
|
|
1010
|
+
})), le = ie("flowEl"), { width: W } = ce(le), ue = v(() => {
|
|
978
1011
|
let e = /* @__PURE__ */ new Map(), t = 0;
|
|
979
1012
|
for (let r of n.preview.blocks) {
|
|
980
1013
|
if (r.kind === "table") continue;
|
|
@@ -988,36 +1021,36 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
988
1021
|
for (let [n, i] of [...e].sort((e, t) => e[0] - t[0])) if (r += i, r > t / 10) return n;
|
|
989
1022
|
return 0;
|
|
990
1023
|
}), fe = v(() => ({
|
|
991
|
-
...
|
|
1024
|
+
...ae.value,
|
|
992
1025
|
"--pk-word-indent-shared": `${ue.value}pt`,
|
|
993
|
-
"--pk-word-indent-scale": W.value ? Math.min(1, W.value / (
|
|
994
|
-
})), G =
|
|
995
|
-
await
|
|
1026
|
+
"--pk-word-indent-scale": W.value ? Math.min(1, W.value / (U.value * It)) : 1
|
|
1027
|
+
})), G = P([]), pe = P({}), K = async () => {
|
|
1028
|
+
await te();
|
|
996
1029
|
let e = T.value?.querySelectorAll("[data-item]");
|
|
997
1030
|
G.value = [...e ?? []].map((e) => e.getBoundingClientRect().height);
|
|
998
1031
|
let t = T.value?.querySelectorAll("[data-part]");
|
|
999
1032
|
pe.value = Object.fromEntries([...t ?? []].map((e) => [e.dataset.part ?? "", e.getBoundingClientRect().height]));
|
|
1000
1033
|
};
|
|
1001
|
-
|
|
1034
|
+
V([
|
|
1002
1035
|
h,
|
|
1003
|
-
|
|
1036
|
+
H,
|
|
1004
1037
|
() => n.preview.parts
|
|
1005
|
-
], K, { flush: "post" }),
|
|
1038
|
+
], K, { flush: "post" }), ne(() => {
|
|
1006
1039
|
K(), document.fonts?.ready.then(K);
|
|
1007
1040
|
});
|
|
1008
1041
|
let q = v(() => {
|
|
1009
|
-
if (!
|
|
1042
|
+
if (!H.value || G.value.length !== h.value.length) return [{
|
|
1010
1043
|
items: h.value.map((e, t) => t),
|
|
1011
1044
|
section: 0,
|
|
1012
1045
|
number: 1,
|
|
1013
|
-
top:
|
|
1014
|
-
bottom:
|
|
1046
|
+
top: I.value.margins.top,
|
|
1047
|
+
bottom: I.value.margins.bottom
|
|
1015
1048
|
}];
|
|
1016
1049
|
let e = [], t = 0, r = !0, i = 0, a, o = () => {
|
|
1017
|
-
let n =
|
|
1050
|
+
let n = M.value[t];
|
|
1018
1051
|
return r && n.pageStart !== void 0 ? n.pageStart : (a ?? e[e.length - 1]?.number ?? 0) + 1;
|
|
1019
1052
|
}, s = (e) => {
|
|
1020
|
-
let i =
|
|
1053
|
+
let i = M.value[t], a = (t) => r && i.titlePage ? t.first : n.preview.evenAndOddHeaders && e % 2 == 0 ? t.even : t.default, o = a(i.headers), s = a(i.footers), c = (e) => e ? (pe.value[e] ?? 0) / It : 0;
|
|
1021
1054
|
return {
|
|
1022
1055
|
header: o,
|
|
1023
1056
|
footer: s,
|
|
@@ -1034,12 +1067,12 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1034
1067
|
}), r = !1, i = 0;
|
|
1035
1068
|
};
|
|
1036
1069
|
return h.value.forEach((n, l) => {
|
|
1037
|
-
n.section !== void 0 && n.section !== t &&
|
|
1038
|
-
let u = e[e.length - 1], d = u &&
|
|
1070
|
+
n.section !== void 0 && n.section !== t && M.value[n.section] && (t = n.section, r = n.breakBefore || !e.length, r || (a = M.value[t].pageStart));
|
|
1071
|
+
let u = e[e.length - 1], d = u && M.value[u.section].page, f = d ? (d.height - u.top - u.bottom) * It : 0, p = G.value[l];
|
|
1039
1072
|
for (let e = l; h.value[e]?.keepNext && e + 1 < h.value.length && !h.value[e + 1].breakBefore; e++) p += G.value[e + 1];
|
|
1040
1073
|
(!u || u.items.length && (n.breakBefore || i + G.value[l] > f || i + p > f && p <= (() => {
|
|
1041
1074
|
let e = s(o());
|
|
1042
|
-
return (
|
|
1075
|
+
return (M.value[t].page.height - e.top - e.bottom) * It;
|
|
1043
1076
|
})())) && c(), e[e.length - 1].items.push(l), i += G.value[l];
|
|
1044
1077
|
}), e.length || c(), e;
|
|
1045
1078
|
}), me = v(() => {
|
|
@@ -1051,9 +1084,9 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1051
1084
|
sectionPages: e.get(t.section) ?? 1
|
|
1052
1085
|
}));
|
|
1053
1086
|
}), J = (e) => {
|
|
1054
|
-
let t =
|
|
1087
|
+
let t = M.value[e.section].page;
|
|
1055
1088
|
return {
|
|
1056
|
-
...
|
|
1089
|
+
...ae.value,
|
|
1057
1090
|
width: `${t.width}pt`,
|
|
1058
1091
|
minHeight: `${t.height}pt`,
|
|
1059
1092
|
padding: `${e.top}pt ${t.margins.right}pt ${e.bottom}pt ${t.margins.left}pt`
|
|
@@ -1064,12 +1097,12 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1064
1097
|
let r = c(n.preview.images, t.ref);
|
|
1065
1098
|
return r ? [{
|
|
1066
1099
|
src: r,
|
|
1067
|
-
css: o(t,
|
|
1100
|
+
css: o(t, M.value[e.section].page)
|
|
1068
1101
|
}] : [];
|
|
1069
1102
|
});
|
|
1070
|
-
}, ge =
|
|
1103
|
+
}, ge = z(e, "fit"), _e = z(e, "zoom"), Y = v(() => ge.value ? Math.min(1.25, Math.max(.3, B.value)) : _e.value), ve = (e) => {
|
|
1071
1104
|
_e.value = Math.min(2, Math.max(.3, Math.round((Y.value + e) * 10) / 10)), ge.value = !1;
|
|
1072
|
-
}, be =
|
|
1105
|
+
}, be = P(0), xe = P(), Se = () => {
|
|
1073
1106
|
let e = C.value?.getBoundingClientRect();
|
|
1074
1107
|
if (!e) return;
|
|
1075
1108
|
let t = C.value?.querySelectorAll("[data-page]") ?? [], n = 0;
|
|
@@ -1092,9 +1125,9 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1092
1125
|
Ce = 0, Se();
|
|
1093
1126
|
});
|
|
1094
1127
|
};
|
|
1095
|
-
|
|
1128
|
+
j(() => cancelAnimationFrame(Ce)), V(q, () => te(we));
|
|
1096
1129
|
let { selection: Te } = de({ root: () => C.value?.getRootNode() });
|
|
1097
|
-
|
|
1130
|
+
V(Te, (e) => {
|
|
1098
1131
|
let t = C.value;
|
|
1099
1132
|
r("select", e && t ? ye(t, e.range, ".pk-word-preview__measure, .pk-word-preview__part") : void 0);
|
|
1100
1133
|
});
|
|
@@ -1112,79 +1145,79 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1112
1145
|
removed: Z(i),
|
|
1113
1146
|
added: Z(a)
|
|
1114
1147
|
}] : [];
|
|
1115
|
-
})),
|
|
1116
|
-
|
|
1117
|
-
!e || e ===
|
|
1148
|
+
})), $;
|
|
1149
|
+
V([() => n.marked, q], ([e]) => {
|
|
1150
|
+
!e || e === $ || H.value && G.value.length !== h.value.length || ee(C.value, ".pk-word-preview__marked") && ($ = e);
|
|
1118
1151
|
}, {
|
|
1119
1152
|
flush: "post",
|
|
1120
1153
|
immediate: !0
|
|
1121
1154
|
});
|
|
1122
|
-
let
|
|
1155
|
+
let De = P("outline"), Oe = P(!1), ke = (e) => {
|
|
1123
1156
|
C.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
|
|
1124
1157
|
block: "start",
|
|
1125
1158
|
behavior: "smooth"
|
|
1126
|
-
}),
|
|
1127
|
-
},
|
|
1159
|
+
}), O.value || (Oe.value = !1);
|
|
1160
|
+
}, Ae = v(() => n.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => Ee(e.runs)) : [Ee(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), je = v(() => n.preview.revisionAuthors.join(", "));
|
|
1128
1161
|
return (t, n) => {
|
|
1129
1162
|
let r = a;
|
|
1130
|
-
return
|
|
1163
|
+
return N(), x("div", {
|
|
1131
1164
|
ref_key: "rootEl",
|
|
1132
1165
|
ref: g,
|
|
1133
|
-
class:
|
|
1166
|
+
class: k(["pk-word-preview", { "pk-word-preview--paged": H.value }])
|
|
1134
1167
|
}, [
|
|
1135
|
-
(
|
|
1168
|
+
(O.value || Oe.value) && (X.value.length || Q.value.length) ? (N(), x("aside", {
|
|
1136
1169
|
key: 0,
|
|
1137
|
-
class:
|
|
1138
|
-
"aria-label":
|
|
1139
|
-
}, [S("div",
|
|
1170
|
+
class: k(["pk-word-preview__side", { "pk-word-preview__side--over": !O.value }]),
|
|
1171
|
+
"aria-label": R(i)("chatFilePreview.outline")
|
|
1172
|
+
}, [S("div", dt, [S("button", {
|
|
1140
1173
|
type: "button",
|
|
1141
1174
|
role: "tab",
|
|
1142
1175
|
class: "pk-word-preview__tab",
|
|
1143
|
-
"aria-selected":
|
|
1144
|
-
onClick: n[0] ||= (e) =>
|
|
1145
|
-
},
|
|
1176
|
+
"aria-selected": De.value === "outline",
|
|
1177
|
+
onClick: n[0] ||= (e) => De.value = "outline"
|
|
1178
|
+
}, L(R(i)("chatFilePreview.outline")), 9, ft), Q.value.length ? (N(), x("button", {
|
|
1146
1179
|
key: 0,
|
|
1147
1180
|
type: "button",
|
|
1148
1181
|
role: "tab",
|
|
1149
1182
|
class: "pk-word-preview__tab",
|
|
1150
|
-
"aria-selected":
|
|
1151
|
-
onClick: n[1] ||= (e) =>
|
|
1152
|
-
},
|
|
1183
|
+
"aria-selected": De.value === "changes",
|
|
1184
|
+
onClick: n[1] ||= (e) => De.value = "changes"
|
|
1185
|
+
}, L(R(i)("chatFilePreview.changes", { count: Q.value.length })), 9, pt)) : b("", !0)]), De.value === "outline" || !Q.value.length ? (N(), x("nav", mt, [(N(!0), x(_, null, F(X.value, (e) => (N(), x("button", {
|
|
1153
1186
|
key: e.key,
|
|
1154
1187
|
type: "button",
|
|
1155
|
-
class:
|
|
1188
|
+
class: k(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
|
|
1156
1189
|
"aria-current": xe.value === e.key ? "location" : void 0,
|
|
1157
|
-
onClick: (t) =>
|
|
1158
|
-
}, [S("span",
|
|
1190
|
+
onClick: (t) => ke(e.key)
|
|
1191
|
+
}, [S("span", gt, L(e.text), 1), Q.value.some((t) => t.key === e.key) ? (N(), x("span", _t)) : b("", !0)], 10, ht))), 128)), X.value.length ? b("", !0) : (N(), x("p", vt, L(R(i)("chatFilePreview.noHeadings")), 1))])) : (N(), x("nav", yt, [(N(!0), x(_, null, F(Q.value, (e) => (N(), x("button", {
|
|
1159
1192
|
key: e.key,
|
|
1160
1193
|
type: "button",
|
|
1161
1194
|
class: "pk-word-preview__entry pk-word-preview__entry--change",
|
|
1162
|
-
onClick: (t) =>
|
|
1163
|
-
}, [e.removed ? (
|
|
1164
|
-
S("div",
|
|
1195
|
+
onClick: (t) => ke(e.key)
|
|
1196
|
+
}, [e.removed ? (N(), x("del", xt, L(e.removed), 1)) : b("", !0), e.added ? (N(), x("ins", St, L(e.added), 1)) : b("", !0)], 8, bt))), 128))]))], 10, ut)) : b("", !0),
|
|
1197
|
+
S("div", Ct, [S("div", {
|
|
1165
1198
|
ref_key: "scrollEl",
|
|
1166
1199
|
ref: C,
|
|
1167
1200
|
class: "pk-word-preview__scroll",
|
|
1168
1201
|
onScroll: we
|
|
1169
|
-
}, [
|
|
1202
|
+
}, [H.value ? (N(), x("div", {
|
|
1170
1203
|
key: 0,
|
|
1171
1204
|
class: "pk-word-preview__pages",
|
|
1172
|
-
style:
|
|
1173
|
-
}, [(
|
|
1205
|
+
style: A({ zoom: Y.value })
|
|
1206
|
+
}, [(N(!0), x(_, null, F(q.value, (t, n) => (N(), x("article", {
|
|
1174
1207
|
key: n,
|
|
1175
1208
|
"data-page": "",
|
|
1176
1209
|
class: "pk-word-preview__page",
|
|
1177
|
-
"aria-label":
|
|
1210
|
+
"aria-label": R(i)("chatFilePreview.pageOf", {
|
|
1178
1211
|
page: n + 1,
|
|
1179
1212
|
count: q.value.length
|
|
1180
1213
|
}),
|
|
1181
|
-
style:
|
|
1214
|
+
style: A(J(t))
|
|
1182
1215
|
}, [
|
|
1183
|
-
t.header && e.preview.parts?.[t.header] ? (
|
|
1216
|
+
t.header && e.preview.parts?.[t.header] ? (N(), y(lt, {
|
|
1184
1217
|
key: 0,
|
|
1185
1218
|
blocks: e.preview.parts[t.header],
|
|
1186
1219
|
where: "header",
|
|
1187
|
-
section:
|
|
1220
|
+
section: M.value[t.section],
|
|
1188
1221
|
mode: e.mode,
|
|
1189
1222
|
numbers: me.value[n]
|
|
1190
1223
|
}, null, 8, [
|
|
@@ -1193,13 +1226,13 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1193
1226
|
"mode",
|
|
1194
1227
|
"numbers"
|
|
1195
1228
|
])) : b("", !0),
|
|
1196
|
-
(
|
|
1229
|
+
(N(!0), x(_, null, F(t.items, (r) => (N(), y(ot, {
|
|
1197
1230
|
key: h.value[r].key,
|
|
1198
1231
|
"data-key": h.value[r].key,
|
|
1199
1232
|
block: e.preview.blocks[h.value[r].block],
|
|
1200
1233
|
row: h.value[r].row,
|
|
1201
1234
|
mode: e.mode,
|
|
1202
|
-
page:
|
|
1235
|
+
page: M.value[t.section].page,
|
|
1203
1236
|
numbers: me.value[n],
|
|
1204
1237
|
marked: e.marked
|
|
1205
1238
|
}, null, 8, [
|
|
@@ -1211,18 +1244,18 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1211
1244
|
"numbers",
|
|
1212
1245
|
"marked"
|
|
1213
1246
|
]))), 128)),
|
|
1214
|
-
(
|
|
1247
|
+
(N(!0), x(_, null, F(he(t), (e, t) => (N(), x("img", {
|
|
1215
1248
|
key: `image-${t}`,
|
|
1216
1249
|
class: "pk-word-preview__float",
|
|
1217
|
-
style:
|
|
1250
|
+
style: A(e.css),
|
|
1218
1251
|
src: e.src,
|
|
1219
1252
|
alt: ""
|
|
1220
|
-
}, null, 12,
|
|
1221
|
-
t.footer && e.preview.parts?.[t.footer] ? (
|
|
1253
|
+
}, null, 12, Tt))), 128)),
|
|
1254
|
+
t.footer && e.preview.parts?.[t.footer] ? (N(), y(lt, {
|
|
1222
1255
|
key: 1,
|
|
1223
1256
|
blocks: e.preview.parts[t.footer],
|
|
1224
1257
|
where: "footer",
|
|
1225
|
-
section:
|
|
1258
|
+
section: M.value[t.section],
|
|
1226
1259
|
mode: e.mode,
|
|
1227
1260
|
numbers: me.value[n]
|
|
1228
1261
|
}, null, 8, [
|
|
@@ -1231,13 +1264,13 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1231
1264
|
"mode",
|
|
1232
1265
|
"numbers"
|
|
1233
1266
|
])) : b("", !0)
|
|
1234
|
-
], 12,
|
|
1267
|
+
], 12, wt))), 128))], 4)) : (N(), x("article", {
|
|
1235
1268
|
key: 1,
|
|
1236
1269
|
ref_key: "flowEl",
|
|
1237
1270
|
ref: le,
|
|
1238
1271
|
class: "pk-word-preview__page pk-word-preview__page--flow",
|
|
1239
|
-
style:
|
|
1240
|
-
}, [(
|
|
1272
|
+
style: A(fe.value)
|
|
1273
|
+
}, [(N(!0), x(_, null, F(h.value, (t) => (N(), y(ot, {
|
|
1241
1274
|
key: t.key,
|
|
1242
1275
|
"data-key": t.key,
|
|
1243
1276
|
block: e.preview.blocks[t.block],
|
|
@@ -1250,45 +1283,45 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1250
1283
|
"row",
|
|
1251
1284
|
"mode",
|
|
1252
1285
|
"marked"
|
|
1253
|
-
]))), 128))], 4)), e.preview.truncated ? (
|
|
1254
|
-
|
|
1286
|
+
]))), 128))], 4)), e.preview.truncated ? (N(), x("p", Et, L(R(i)("chatFilePreview.truncated")), 1)) : b("", !0)], 544), S("div", Dt, [
|
|
1287
|
+
H.value ? (N(), x("span", Ot, L(R(i)("chatFilePreview.pageOf", {
|
|
1255
1288
|
page: be.value + 1,
|
|
1256
1289
|
count: q.value.length
|
|
1257
1290
|
})), 1)) : b("", !0),
|
|
1258
|
-
S("span",
|
|
1259
|
-
e.mode === "markup" && e.preview.revisionAuthors.length ? (
|
|
1291
|
+
S("span", kt, L(R(i)("chatFilePreview.words", Ae.value)), 1),
|
|
1292
|
+
e.mode === "markup" && e.preview.revisionAuthors.length ? (N(), x("span", At, [
|
|
1260
1293
|
S("span", {
|
|
1261
1294
|
class: "pk-word-preview__legend-text",
|
|
1262
|
-
title:
|
|
1263
|
-
},
|
|
1264
|
-
S("del",
|
|
1265
|
-
S("ins",
|
|
1295
|
+
title: R(i)("chatFilePreview.revisionsOf", { authors: je.value })
|
|
1296
|
+
}, L(R(i)("chatFilePreview.revisionsOf", { authors: je.value })), 9, jt),
|
|
1297
|
+
S("del", Mt, L(R(i)("chatFilePreview.removed")), 1),
|
|
1298
|
+
S("ins", Nt, L(R(i)("chatFilePreview.added")), 1)
|
|
1266
1299
|
])) : b("", !0),
|
|
1267
1300
|
n[6] ||= S("span", { class: "pk-word-preview__spacer" }, null, -1),
|
|
1268
|
-
!
|
|
1301
|
+
!O.value && (X.value.length || Q.value.length) ? (N(), y(r, {
|
|
1269
1302
|
key: 2,
|
|
1270
1303
|
class: "pk-word-preview__outline-toggle",
|
|
1271
1304
|
modifiers: "action-quiet",
|
|
1272
1305
|
icon: "ri:list-unordered",
|
|
1273
|
-
label:
|
|
1274
|
-
title:
|
|
1275
|
-
"aria-label":
|
|
1276
|
-
"aria-expanded":
|
|
1277
|
-
onClick: n[2] ||= (e) =>
|
|
1306
|
+
label: R(i)("chatFilePreview.outline"),
|
|
1307
|
+
title: R(i)("chatFilePreview.outline"),
|
|
1308
|
+
"aria-label": R(i)("chatFilePreview.outline"),
|
|
1309
|
+
"aria-expanded": Oe.value,
|
|
1310
|
+
onClick: n[2] ||= (e) => Oe.value = !Oe.value
|
|
1278
1311
|
}, null, 8, [
|
|
1279
1312
|
"label",
|
|
1280
1313
|
"title",
|
|
1281
1314
|
"aria-label",
|
|
1282
1315
|
"aria-expanded"
|
|
1283
1316
|
])) : b("", !0),
|
|
1284
|
-
|
|
1317
|
+
H.value ? (N(), x(_, { key: 3 }, [
|
|
1285
1318
|
w(r, {
|
|
1286
1319
|
class: "pk-word-preview__fit",
|
|
1287
1320
|
modifiers: "action-quiet",
|
|
1288
1321
|
icon: "ri:expand-width-line",
|
|
1289
|
-
label:
|
|
1290
|
-
title:
|
|
1291
|
-
"aria-label":
|
|
1322
|
+
label: R(i)("chatFilePreview.fitWidth"),
|
|
1323
|
+
title: R(i)("chatFilePreview.fitWidth"),
|
|
1324
|
+
"aria-label": R(i)("chatFilePreview.fitWidth"),
|
|
1292
1325
|
disabled: ge.value,
|
|
1293
1326
|
onClick: n[3] ||= (e) => ge.value = !0
|
|
1294
1327
|
}, null, 8, [
|
|
@@ -1300,73 +1333,73 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1300
1333
|
w(r, {
|
|
1301
1334
|
modifiers: "action-quiet",
|
|
1302
1335
|
icon: "ri:subtract-line",
|
|
1303
|
-
"aria-label":
|
|
1336
|
+
"aria-label": R(i)("chatFilePreview.zoomOut"),
|
|
1304
1337
|
disabled: Y.value <= .3,
|
|
1305
1338
|
onClick: n[4] ||= (e) => ve(-.1)
|
|
1306
1339
|
}, null, 8, ["aria-label", "disabled"]),
|
|
1307
|
-
S("span",
|
|
1340
|
+
S("span", Pt, L(Math.round(Y.value * 100)) + "% ", 1),
|
|
1308
1341
|
w(r, {
|
|
1309
1342
|
modifiers: "action-quiet",
|
|
1310
1343
|
icon: "ri:add-line",
|
|
1311
|
-
"aria-label":
|
|
1344
|
+
"aria-label": R(i)("chatFilePreview.zoomIn"),
|
|
1312
1345
|
disabled: Y.value >= 2,
|
|
1313
1346
|
onClick: n[5] ||= (e) => ve(.1)
|
|
1314
1347
|
}, null, 8, ["aria-label", "disabled"])
|
|
1315
1348
|
], 64)) : b("", !0)
|
|
1316
1349
|
])]),
|
|
1317
|
-
|
|
1350
|
+
H.value ? (N(), x("div", {
|
|
1318
1351
|
key: 1,
|
|
1319
1352
|
ref_key: "measureEl",
|
|
1320
1353
|
ref: T,
|
|
1321
1354
|
class: "pk-word-preview__measure",
|
|
1322
1355
|
"aria-hidden": "true",
|
|
1323
|
-
style:
|
|
1324
|
-
}, [(
|
|
1356
|
+
style: A(oe.value)
|
|
1357
|
+
}, [(N(!0), x(_, null, F(h.value, (t) => (N(), x("div", {
|
|
1325
1358
|
key: t.key,
|
|
1326
1359
|
"data-item": ""
|
|
1327
|
-
}, [w(
|
|
1360
|
+
}, [w(ot, {
|
|
1328
1361
|
block: e.preview.blocks[t.block],
|
|
1329
1362
|
row: t.row,
|
|
1330
1363
|
mode: e.mode,
|
|
1331
|
-
page:
|
|
1364
|
+
page: I.value
|
|
1332
1365
|
}, null, 8, [
|
|
1333
1366
|
"block",
|
|
1334
1367
|
"row",
|
|
1335
1368
|
"mode",
|
|
1336
1369
|
"page"
|
|
1337
|
-
])]))), 128)), (
|
|
1370
|
+
])]))), 128)), (N(!0), x(_, null, F(e.preview.parts, (t, n) => (N(), x("div", {
|
|
1338
1371
|
key: n,
|
|
1339
1372
|
"data-part": n
|
|
1340
|
-
}, [(
|
|
1373
|
+
}, [(N(!0), x(_, null, F(R(f)(t, e.mode), (n) => (N(), y(ot, {
|
|
1341
1374
|
key: n.key,
|
|
1342
1375
|
block: t[n.block],
|
|
1343
1376
|
row: n.row,
|
|
1344
1377
|
mode: e.mode,
|
|
1345
|
-
page:
|
|
1378
|
+
page: I.value
|
|
1346
1379
|
}, null, 8, [
|
|
1347
1380
|
"block",
|
|
1348
1381
|
"row",
|
|
1349
1382
|
"mode",
|
|
1350
1383
|
"page"
|
|
1351
|
-
]))), 128))], 8,
|
|
1384
|
+
]))), 128))], 8, Ft))), 128))], 4)) : b("", !0)
|
|
1352
1385
|
], 2);
|
|
1353
1386
|
};
|
|
1354
1387
|
}
|
|
1355
|
-
}),
|
|
1388
|
+
}), zt = ["aria-label"], Bt = { class: "pk-file-preview__head" }, Vt = { class: "pk-file-preview__file" }, Ht = {
|
|
1356
1389
|
class: "pk-file-preview__tile",
|
|
1357
1390
|
"aria-hidden": "true"
|
|
1358
|
-
},
|
|
1391
|
+
}, Ut = { class: "pk-file-preview__name" }, Wt = { class: "pk-file-preview__title" }, Gt = { class: "pk-file-preview__note" }, Kt = {
|
|
1359
1392
|
key: 0,
|
|
1360
1393
|
class: "pk-file-preview__tools"
|
|
1361
|
-
},
|
|
1394
|
+
}, qt = ["aria-label"], Jt = { class: "pk-file-preview__version" }, Yt = { class: "pk-file-preview__mode-long" }, Xt = { class: "pk-file-preview__mode-short" }, Zt = { class: "pk-file-preview__actions" }, Qt = { class: "pk-file-preview__body" }, $t = {
|
|
1362
1395
|
key: 0,
|
|
1363
1396
|
class: "pk-file-preview__skeleton vv-skeleton"
|
|
1364
|
-
},
|
|
1397
|
+
}, en = {
|
|
1365
1398
|
key: 1,
|
|
1366
1399
|
class: "pk-file-preview__empty"
|
|
1367
|
-
},
|
|
1400
|
+
}, tn = /*@__PURE__*/ T({
|
|
1368
1401
|
__name: "PkFilePreview",
|
|
1369
|
-
props: /*@__PURE__*/
|
|
1402
|
+
props: /*@__PURE__*/ O({
|
|
1370
1403
|
kind: {},
|
|
1371
1404
|
filename: {},
|
|
1372
1405
|
version: {},
|
|
@@ -1394,7 +1427,7 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1394
1427
|
},
|
|
1395
1428
|
fitModifiers: {}
|
|
1396
1429
|
}),
|
|
1397
|
-
emits: /*@__PURE__*/
|
|
1430
|
+
emits: /*@__PURE__*/ O([
|
|
1398
1431
|
"close",
|
|
1399
1432
|
"version",
|
|
1400
1433
|
"restore",
|
|
@@ -1407,7 +1440,7 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1407
1440
|
"update:fit"
|
|
1408
1441
|
]),
|
|
1409
1442
|
setup(e, { emit: n }) {
|
|
1410
|
-
let r = e, i = n, { t: o, locale: s } = se({ useScope: "global" }), c = v(() => r.versions ?? []), l = v(() => r.version ? c.value.indexOf(r.version) : -1), u = v(() => l.value > 0 ? c.value[l.value - 1] : void 0), d = v(() => l.value >= 0 && l.value < c.value.length - 1 ? c.value[l.value + 1] : void 0), f =
|
|
1443
|
+
let r = e, i = n, { t: o, locale: s } = se({ useScope: "global" }), c = v(() => r.versions ?? []), l = v(() => r.version ? c.value.indexOf(r.version) : -1), u = v(() => l.value > 0 ? c.value[l.value - 1] : void 0), d = v(() => l.value >= 0 && l.value < c.value.length - 1 ? c.value[l.value + 1] : void 0), f = z(e, "mode"), p = z(e, "sheet"), m = z(e, "zoom"), h = z(e, "fit"), ee = v(() => [
|
|
1411
1444
|
{
|
|
1412
1445
|
value: "markup",
|
|
1413
1446
|
label: o("chatFilePreview.modeMarkup")
|
|
@@ -1421,44 +1454,44 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1421
1454
|
label: o("chatFilePreview.modeOriginal")
|
|
1422
1455
|
}
|
|
1423
1456
|
]), C = v(() => r.preview?.kind === "word" && r.preview.revisionAuthors.length > 0);
|
|
1424
|
-
|
|
1457
|
+
V(() => r.version, () => {
|
|
1425
1458
|
f.value = "markup";
|
|
1426
1459
|
});
|
|
1427
|
-
let T =
|
|
1428
|
-
E.value = void 0,
|
|
1460
|
+
let T = ie("rootEl"), E = I(), D = P(!1), O = () => {
|
|
1461
|
+
E.value = void 0, D.value = !1;
|
|
1429
1462
|
};
|
|
1430
|
-
|
|
1463
|
+
V(() => [
|
|
1431
1464
|
r.version,
|
|
1432
1465
|
r.preview,
|
|
1433
1466
|
f.value,
|
|
1434
1467
|
p.value
|
|
1435
|
-
],
|
|
1436
|
-
let
|
|
1437
|
-
|
|
1468
|
+
], O);
|
|
1469
|
+
let A = (e) => {
|
|
1470
|
+
D.value || (E.value = e);
|
|
1438
1471
|
};
|
|
1439
|
-
|
|
1472
|
+
V(D, async (e, t) => {
|
|
1440
1473
|
let n = E.value;
|
|
1441
|
-
t && !e && n?.format === "docx" && (await
|
|
1474
|
+
t && !e && n?.format === "docx" && (await te(), n.restore());
|
|
1442
1475
|
});
|
|
1443
|
-
let
|
|
1476
|
+
let j = v(() => !r.version || r.version === c.value[c.value.length - 1]), ne = () => {
|
|
1444
1477
|
let e = c.value[c.value.length - 1];
|
|
1445
1478
|
e && i("version", e);
|
|
1446
|
-
},
|
|
1479
|
+
}, M = v(() => {
|
|
1447
1480
|
let e = E.value;
|
|
1448
1481
|
return e?.format === "docx" ? e.paragraphCount > 200 : (e?.cells ?? 0) > fe;
|
|
1449
|
-
}),
|
|
1482
|
+
}), re = v(() => E.value?.format === "docx" && f.value === "original"), B = v(() => M.value || re.value), ae = v(() => re.value ? o("selectionActions.hintOriginal") : M.value ? o(E.value?.format === "docx" ? "selectionActions.hintParagraphs" : "selectionActions.hintCells", { count: E.value?.format === "docx" ? 200 : fe }) : void 0), U = (e) => e[s.value] ?? e[s.value.split("-")[0]] ?? Object.values(e)[0] ?? "", oe = ["explain", "summarize"], ce = v(() => {
|
|
1450
1483
|
let e = E.value, t = r.selectionActions;
|
|
1451
1484
|
if (!e || !t) return [];
|
|
1452
1485
|
let n = e.format;
|
|
1453
|
-
return [...(n === "docx" &&
|
|
1486
|
+
return [...(n === "docx" && B.value ? oe : t.builtIns).map((e) => ({
|
|
1454
1487
|
id: e,
|
|
1455
1488
|
label: o(`selectionActions.builtIn.${e}`),
|
|
1456
1489
|
...e === "translate" && { asks: o("selectionActions.translateAsks") },
|
|
1457
1490
|
prompt: (t) => o(`selectionActions.prompt.${n}.${e}`, { language: t ?? "" })
|
|
1458
|
-
})), ...(
|
|
1491
|
+
})), ...(B.value ? [] : t.actions).map((e) => ({
|
|
1459
1492
|
id: e.id,
|
|
1460
|
-
label:
|
|
1461
|
-
prompt: () =>
|
|
1493
|
+
label: U(e.label),
|
|
1494
|
+
prompt: () => U(e.prompt)
|
|
1462
1495
|
}))];
|
|
1463
1496
|
}), W = (e) => {
|
|
1464
1497
|
if (e.format === "docx") return o("selectionActions.labelParagraphs", {
|
|
@@ -1489,7 +1522,7 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1489
1522
|
return {
|
|
1490
1523
|
...t,
|
|
1491
1524
|
...r,
|
|
1492
|
-
...
|
|
1525
|
+
...re.value && { original: !0 }
|
|
1493
1526
|
};
|
|
1494
1527
|
}
|
|
1495
1528
|
let { measure: n, cells: i, ...a } = e;
|
|
@@ -1502,11 +1535,11 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1502
1535
|
r && (i("selectionSend", e, r, {
|
|
1503
1536
|
id: t,
|
|
1504
1537
|
size: n.format === "docx" ? n.paragraphCount : n.cells
|
|
1505
|
-
}),
|
|
1538
|
+
}), O(), document.getSelection()?.removeAllRanges());
|
|
1506
1539
|
}, G = (e, t) => {
|
|
1507
1540
|
let n = ce.value.find((t) => t.id === e);
|
|
1508
1541
|
n && de(n.prompt(t), e);
|
|
1509
|
-
}, pe =
|
|
1542
|
+
}, pe = P(0);
|
|
1510
1543
|
le(T, "scroll", () => pe.value++, {
|
|
1511
1544
|
capture: !0,
|
|
1512
1545
|
passive: !0
|
|
@@ -1530,7 +1563,7 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1530
1563
|
});
|
|
1531
1564
|
return (n, r) => {
|
|
1532
1565
|
let s = g, l = a;
|
|
1533
|
-
return
|
|
1566
|
+
return N(), x("section", {
|
|
1534
1567
|
ref_key: "rootEl",
|
|
1535
1568
|
ref: T,
|
|
1536
1569
|
class: "pk-file-preview",
|
|
@@ -1538,57 +1571,57 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1538
1571
|
tabindex: "-1",
|
|
1539
1572
|
autofocus: ""
|
|
1540
1573
|
}, [
|
|
1541
|
-
S("header",
|
|
1542
|
-
S("div",
|
|
1574
|
+
S("header", Bt, [
|
|
1575
|
+
S("div", Vt, [S("span", Ht, [w(s, {
|
|
1543
1576
|
name: e.kind === "word" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
|
|
1544
|
-
class:
|
|
1545
|
-
}, null, 8, ["name", "class"])]), S("div",
|
|
1546
|
-
e.version && c.value.length > 1 || C.value ? (
|
|
1577
|
+
class: k(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
|
|
1578
|
+
}, null, 8, ["name", "class"])]), S("div", Ut, [S("strong", Wt, L(e.filename), 1), S("span", Gt, L(R(o)("chatFilePreview.readOnly")), 1)])]),
|
|
1579
|
+
e.version && c.value.length > 1 || C.value ? (N(), x("div", Kt, [e.version && c.value.length > 1 ? (N(), x("nav", {
|
|
1547
1580
|
key: 0,
|
|
1548
1581
|
class: "pk-file-preview__versions",
|
|
1549
|
-
"aria-label":
|
|
1582
|
+
"aria-label": R(o)("chatFilePreview.versions")
|
|
1550
1583
|
}, [
|
|
1551
1584
|
w(l, {
|
|
1552
1585
|
modifiers: "action-quiet",
|
|
1553
1586
|
icon: "ri:arrow-left-s-line",
|
|
1554
|
-
"aria-label":
|
|
1587
|
+
"aria-label": R(o)("chatFilePreview.previousVersion"),
|
|
1555
1588
|
disabled: !u.value,
|
|
1556
1589
|
onClick: r[0] ||= (e) => u.value && i("version", u.value)
|
|
1557
1590
|
}, null, 8, ["aria-label", "disabled"]),
|
|
1558
|
-
S("span",
|
|
1591
|
+
S("span", Jt, L(R(o)("chatFilePreview.versionOf", {
|
|
1559
1592
|
version: e.version,
|
|
1560
1593
|
count: c.value.length
|
|
1561
1594
|
})), 1),
|
|
1562
1595
|
w(l, {
|
|
1563
1596
|
modifiers: "action-quiet",
|
|
1564
1597
|
icon: "ri:arrow-right-s-line",
|
|
1565
|
-
"aria-label":
|
|
1598
|
+
"aria-label": R(o)("chatFilePreview.nextVersion"),
|
|
1566
1599
|
disabled: !d.value,
|
|
1567
1600
|
onClick: r[1] ||= (e) => d.value && i("version", d.value)
|
|
1568
1601
|
}, null, 8, ["aria-label", "disabled"])
|
|
1569
|
-
], 8,
|
|
1602
|
+
], 8, qt)) : b("", !0), C.value ? (N(), y(t, {
|
|
1570
1603
|
key: 1,
|
|
1571
1604
|
modelValue: f.value,
|
|
1572
1605
|
"onUpdate:modelValue": r[2] ||= (e) => f.value = e,
|
|
1573
1606
|
name: "revisions",
|
|
1574
1607
|
segmented: "",
|
|
1575
1608
|
class: "pk-file-preview__modes u-segmented-fit mb-0",
|
|
1576
|
-
"aria-label":
|
|
1609
|
+
"aria-label": R(o)("chatFilePreview.modes"),
|
|
1577
1610
|
options: ee.value
|
|
1578
1611
|
}, {
|
|
1579
|
-
markup:
|
|
1612
|
+
markup: H(() => [S("span", Yt, L(R(o)("chatFilePreview.modeMarkup")), 1), S("span", Xt, L(R(o)("chatFilePreview.modeMarkupShort")), 1)]),
|
|
1580
1613
|
_: 1
|
|
1581
1614
|
}, 8, [
|
|
1582
1615
|
"modelValue",
|
|
1583
1616
|
"aria-label",
|
|
1584
1617
|
"options"
|
|
1585
1618
|
])) : b("", !0)])) : b("", !0),
|
|
1586
|
-
S("div",
|
|
1587
|
-
e.restorable ? (
|
|
1619
|
+
S("div", Zt, [
|
|
1620
|
+
e.restorable ? (N(), y(l, {
|
|
1588
1621
|
key: 0,
|
|
1589
1622
|
modifiers: "action-quiet",
|
|
1590
1623
|
icon: "ri:arrow-go-back-line",
|
|
1591
|
-
label:
|
|
1624
|
+
label: R(o)("chatFilePreview.restore"),
|
|
1592
1625
|
onClick: r[3] ||= (e) => i("restore")
|
|
1593
1626
|
}, null, 8, ["label"])) : b("", !0),
|
|
1594
1627
|
w(l, {
|
|
@@ -1596,41 +1629,41 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1596
1629
|
download: "",
|
|
1597
1630
|
modifiers: "action-quiet",
|
|
1598
1631
|
icon: "ri:download-line",
|
|
1599
|
-
title:
|
|
1600
|
-
"aria-label":
|
|
1632
|
+
title: R(o)("chatFilePreview.download"),
|
|
1633
|
+
"aria-label": R(o)("chatFilePreview.download")
|
|
1601
1634
|
}, null, 8, [
|
|
1602
1635
|
"href",
|
|
1603
1636
|
"title",
|
|
1604
1637
|
"aria-label"
|
|
1605
1638
|
]),
|
|
1606
|
-
e.resize === "expand" ? (
|
|
1639
|
+
e.resize === "expand" ? (N(), y(l, {
|
|
1607
1640
|
key: 1,
|
|
1608
1641
|
modifiers: "action-quiet",
|
|
1609
1642
|
icon: "ri:fullscreen-line",
|
|
1610
|
-
title:
|
|
1611
|
-
"aria-label":
|
|
1643
|
+
title: R(o)("chatFilePreview.expand"),
|
|
1644
|
+
"aria-label": R(o)("chatFilePreview.expand"),
|
|
1612
1645
|
onClick: r[4] ||= (e) => i("resize")
|
|
1613
|
-
}, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (
|
|
1646
|
+
}, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (N(), y(l, {
|
|
1614
1647
|
key: 2,
|
|
1615
1648
|
modifiers: "action-quiet",
|
|
1616
1649
|
icon: "ri:fullscreen-exit-line",
|
|
1617
|
-
title:
|
|
1618
|
-
"aria-label":
|
|
1650
|
+
title: R(o)("chatFilePreview.shrink"),
|
|
1651
|
+
"aria-label": R(o)("chatFilePreview.shrink"),
|
|
1619
1652
|
onClick: r[5] ||= (e) => i("resize")
|
|
1620
1653
|
}, null, 8, ["title", "aria-label"])) : b("", !0),
|
|
1621
1654
|
w(l, {
|
|
1622
1655
|
modifiers: "action-quiet",
|
|
1623
1656
|
icon: "ri:close-line",
|
|
1624
|
-
title:
|
|
1625
|
-
"aria-label":
|
|
1657
|
+
title: R(o)("chatFilePreview.close"),
|
|
1658
|
+
"aria-label": R(o)("chatFilePreview.close"),
|
|
1626
1659
|
onClick: r[6] ||= (e) => i("close")
|
|
1627
1660
|
}, null, 8, ["title", "aria-label"])
|
|
1628
1661
|
])
|
|
1629
1662
|
]),
|
|
1630
|
-
S("div",
|
|
1663
|
+
S("div", Qt, [e.loading ? (N(), x("div", $t, [(N(), x(_, null, F(8, (e) => S("div", {
|
|
1631
1664
|
key: e,
|
|
1632
|
-
class:
|
|
1633
|
-
}, null, 2)), 64))])) : e.error || !e.preview ? (
|
|
1665
|
+
class: k(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
|
|
1666
|
+
}, null, 2)), 64))])) : e.error || !e.preview ? (N(), x("p", en, L(R(o)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (N(), y(Rt, {
|
|
1634
1667
|
key: 2,
|
|
1635
1668
|
zoom: m.value,
|
|
1636
1669
|
"onUpdate:zoom": r[7] ||= (e) => m.value = e,
|
|
@@ -1639,14 +1672,14 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1639
1672
|
preview: e.preview,
|
|
1640
1673
|
mode: C.value ? f.value : "markup",
|
|
1641
1674
|
marked: e.changes?.kind === "word" ? e.changes.paragraphs : void 0,
|
|
1642
|
-
onSelect:
|
|
1675
|
+
onSelect: A
|
|
1643
1676
|
}, null, 8, [
|
|
1644
1677
|
"zoom",
|
|
1645
1678
|
"fit",
|
|
1646
1679
|
"preview",
|
|
1647
1680
|
"mode",
|
|
1648
1681
|
"marked"
|
|
1649
|
-
])) : (
|
|
1682
|
+
])) : (N(), y(Ye, {
|
|
1650
1683
|
key: 3,
|
|
1651
1684
|
sheet: p.value,
|
|
1652
1685
|
"onUpdate:sheet": r[9] ||= (e) => p.value = e,
|
|
@@ -1654,27 +1687,27 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1654
1687
|
"onUpdate:zoom": r[10] ||= (e) => m.value = e,
|
|
1655
1688
|
preview: e.preview,
|
|
1656
1689
|
marked: e.changes?.kind === "spreadsheet" ? e.changes.cells : void 0,
|
|
1657
|
-
onSelect:
|
|
1690
|
+
onSelect: A
|
|
1658
1691
|
}, null, 8, [
|
|
1659
1692
|
"sheet",
|
|
1660
1693
|
"zoom",
|
|
1661
1694
|
"preview",
|
|
1662
1695
|
"marked"
|
|
1663
1696
|
]))]),
|
|
1664
|
-
e.selectionActions && E.value && K.value ? (
|
|
1697
|
+
e.selectionActions && E.value && K.value ? (N(), y($, {
|
|
1665
1698
|
key: 0,
|
|
1666
|
-
asking:
|
|
1667
|
-
"onUpdate:asking": r[11] ||= (e) =>
|
|
1699
|
+
asking: D.value,
|
|
1700
|
+
"onUpdate:asking": r[11] ||= (e) => D.value = e,
|
|
1668
1701
|
strategy: "absolute",
|
|
1669
1702
|
anchor: K.value,
|
|
1670
1703
|
actions: ce.value,
|
|
1671
|
-
hint:
|
|
1672
|
-
note:
|
|
1673
|
-
"note-action":
|
|
1704
|
+
hint: ae.value,
|
|
1705
|
+
note: j.value ? void 0 : R(o)("selectionActions.notLatest", { version: e.version }),
|
|
1706
|
+
"note-action": R(o)("selectionActions.openLatest"),
|
|
1674
1707
|
onAction: G,
|
|
1675
1708
|
onAsk: r[12] ||= (e) => de(e, "ask"),
|
|
1676
|
-
onNote:
|
|
1677
|
-
onClose:
|
|
1709
|
+
onNote: ne,
|
|
1710
|
+
onClose: O
|
|
1678
1711
|
}, null, 8, [
|
|
1679
1712
|
"asking",
|
|
1680
1713
|
"anchor",
|
|
@@ -1683,10 +1716,10 @@ var fe = 2e3, G = 1e3, pe = 60, K = 1400, q = 20, me = 100, J = (e) => Number(e.
|
|
|
1683
1716
|
"note",
|
|
1684
1717
|
"note-action"
|
|
1685
1718
|
])) : b("", !0)
|
|
1686
|
-
], 8,
|
|
1719
|
+
], 8, zt);
|
|
1687
1720
|
};
|
|
1688
1721
|
}
|
|
1689
|
-
}),
|
|
1690
|
-
export {
|
|
1722
|
+
}), nn = /* @__PURE__ */ e({ default: () => rn }), rn = tn;
|
|
1723
|
+
export { nn as n, rn as t };
|
|
1691
1724
|
|
|
1692
|
-
//# sourceMappingURL=PkFilePreview-
|
|
1725
|
+
//# sourceMappingURL=PkFilePreview-DEKgCMkr.js.map
|