@eternalheart/vue-file-preview 1.3.6 → 1.3.8
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/lib/FilePreviewContent.vue.d.ts.map +1 -1
- package/lib/FilePreviewEmbed.vue.d.ts.map +1 -1
- package/lib/FilePreviewModal.vue.d.ts.map +1 -1
- package/lib/chunks/index-5Smm2vx0.mjs +77 -0
- package/lib/chunks/index-5Smm2vx0.mjs.map +1 -0
- package/lib/chunks/index-BCkcZs4y.mjs +84 -0
- package/lib/chunks/index-BCkcZs4y.mjs.map +1 -0
- package/lib/chunks/index-BM9FaQUl.mjs +134 -0
- package/lib/chunks/index-BM9FaQUl.mjs.map +1 -0
- package/lib/chunks/index-BYzQg-jL.mjs +152 -0
- package/lib/chunks/index-BYzQg-jL.mjs.map +1 -0
- package/lib/chunks/index-BoL1b2w-.mjs +129 -0
- package/lib/chunks/index-BoL1b2w-.mjs.map +1 -0
- package/lib/chunks/index-Bri7VeRx.mjs +203 -0
- package/lib/chunks/index-Bri7VeRx.mjs.map +1 -0
- package/lib/chunks/index-C324a7kV.mjs +2017 -0
- package/lib/chunks/index-C324a7kV.mjs.map +1 -0
- package/lib/chunks/index-C7uOM7XL.mjs +139 -0
- package/lib/chunks/index-C7uOM7XL.mjs.map +1 -0
- package/lib/chunks/index-CTsscgqY.mjs +136 -0
- package/lib/chunks/index-CTsscgqY.mjs.map +1 -0
- package/lib/chunks/index-Ch7AEfnk.mjs +116 -0
- package/lib/chunks/index-Ch7AEfnk.mjs.map +1 -0
- package/lib/chunks/index-D9wf6m37.mjs +249 -0
- package/lib/chunks/index-D9wf6m37.mjs.map +1 -0
- package/lib/chunks/index-DAEQe-RI.mjs +111 -0
- package/lib/chunks/index-DAEQe-RI.mjs.map +1 -0
- package/lib/chunks/index-DAo-7spn.mjs +103 -0
- package/lib/chunks/index-DAo-7spn.mjs.map +1 -0
- package/lib/chunks/index-DXlcF1Dk.mjs +113 -0
- package/lib/chunks/index-DXlcF1Dk.mjs.map +1 -0
- package/lib/chunks/index-ELyTQZeF.mjs +281 -0
- package/lib/chunks/index-ELyTQZeF.mjs.map +1 -0
- package/lib/chunks/index-cZn4ih-x.mjs +111 -0
- package/lib/chunks/index-cZn4ih-x.mjs.map +1 -0
- package/lib/chunks/index-dzB4jd9b.mjs +353 -0
- package/lib/chunks/index-dzB4jd9b.mjs.map +1 -0
- package/lib/chunks/index-lHlugUBI.mjs +391 -0
- package/lib/chunks/index-lHlugUBI.mjs.map +1 -0
- package/lib/composables/useResolvedTheme.d.ts +15 -0
- package/lib/composables/useResolvedTheme.d.ts.map +1 -0
- package/lib/index.cjs +24 -499
- package/lib/index.cjs.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.mjs +12 -44597
- package/lib/index.mjs.map +1 -1
- package/lib/renderers/Audio/index.vue.d.ts.map +1 -1
- package/lib/renderers/Csv/index.vue.d.ts.map +1 -1
- package/lib/renderers/Json/index.vue.d.ts.map +1 -1
- package/lib/renderers/Markdown/index.vue.d.ts.map +1 -1
- package/lib/renderers/Pptx/index.vue.d.ts.map +1 -1
- package/lib/renderers/RendererLoading.vue.d.ts +3 -0
- package/lib/renderers/RendererLoading.vue.d.ts.map +1 -0
- package/lib/renderers/Text/index.vue.d.ts.map +1 -1
- package/lib/renderers/Video/index.vue.d.ts.map +1 -1
- package/lib/renderers/Xlsx/index.vue.d.ts.map +1 -1
- package/lib/renderers/Xml/index.vue.d.ts.map +1 -1
- package/lib/renderers/Zip/index.vue.d.ts.map +1 -1
- package/lib/renderers/lazy.d.ts +19 -0
- package/lib/renderers/lazy.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,2017 @@
|
|
|
1
|
+
import { inject as Le, computed as T, unref as C, provide as ue, h as O, defineComponent as X, openBlock as c, createElementBlock as g, createElementVNode as E, toDisplayString as D, defineAsyncComponent as ut, createVNode as G, createTextVNode as dt, toRef as Te, ref as z, watch as V, onBeforeUnmount as oe, onMounted as De, Fragment as R, renderList as I, createBlock as _, resolveDynamicComponent as U, createCommentVNode as L, normalizeStyle as ee, onUnmounted as pt, Teleport as ct, Transition as ft, withCtx as mt } from "vue";
|
|
2
|
+
import { ZoomOut as Ie, ZoomIn as Oe, Scan as vt, RotateCcw as ht, RotateCw as gt, RefreshCw as Ze, List as Ae, ChevronLeft as de, ChevronRight as pe, Minimize2 as Be, Maximize2 as Ve, WrapText as bt, Code as Ge, Eye as He, FileQuestion as wt, Download as Ue, X as xt } from "lucide-vue-next";
|
|
3
|
+
import yt from "jszip";
|
|
4
|
+
const kt = "1.3.8", Ft = {
|
|
5
|
+
version: kt
|
|
6
|
+
};
|
|
7
|
+
function Ct(e) {
|
|
8
|
+
try {
|
|
9
|
+
const t = new URL(e).pathname.split("/").pop() || "file";
|
|
10
|
+
return decodeURIComponent(t);
|
|
11
|
+
} catch {
|
|
12
|
+
const t = e.split("/").pop() || "file";
|
|
13
|
+
return decodeURIComponent(t);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function le(e) {
|
|
17
|
+
var t;
|
|
18
|
+
const o = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
|
|
19
|
+
return {
|
|
20
|
+
// 图片
|
|
21
|
+
jpg: "image/jpeg",
|
|
22
|
+
jpeg: "image/jpeg",
|
|
23
|
+
png: "image/png",
|
|
24
|
+
gif: "image/gif",
|
|
25
|
+
webp: "image/webp",
|
|
26
|
+
svg: "image/svg+xml",
|
|
27
|
+
bmp: "image/bmp",
|
|
28
|
+
ico: "image/x-icon",
|
|
29
|
+
// 视频
|
|
30
|
+
mp4: "video/mp4",
|
|
31
|
+
webm: "video/webm",
|
|
32
|
+
ogg: "video/ogg",
|
|
33
|
+
ogv: "video/ogg",
|
|
34
|
+
mov: "video/quicktime",
|
|
35
|
+
avi: "video/x-msvideo",
|
|
36
|
+
mkv: "video/x-matroska",
|
|
37
|
+
m4v: "video/x-m4v",
|
|
38
|
+
"3gp": "video/3gpp",
|
|
39
|
+
flv: "video/x-flv",
|
|
40
|
+
// 音频
|
|
41
|
+
mp3: "audio/mpeg",
|
|
42
|
+
wav: "audio/wav",
|
|
43
|
+
m4a: "audio/mp4",
|
|
44
|
+
aac: "audio/aac",
|
|
45
|
+
flac: "audio/flac",
|
|
46
|
+
// 文档
|
|
47
|
+
pdf: "application/pdf",
|
|
48
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
49
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
50
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
51
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
52
|
+
msg: "application/vnd.ms-outlook",
|
|
53
|
+
mobi: "application/x-mobipocket-ebook",
|
|
54
|
+
azw: "application/vnd.amazon.ebook",
|
|
55
|
+
azw3: "application/vnd.amazon.ebook",
|
|
56
|
+
kf8: "application/vnd.amazon.ebook",
|
|
57
|
+
// 文本
|
|
58
|
+
txt: "text/plain",
|
|
59
|
+
md: "text/markdown",
|
|
60
|
+
markdown: "text/markdown",
|
|
61
|
+
json: "application/json",
|
|
62
|
+
xml: "application/xml",
|
|
63
|
+
html: "text/html",
|
|
64
|
+
css: "text/css",
|
|
65
|
+
js: "text/javascript",
|
|
66
|
+
ts: "text/typescript",
|
|
67
|
+
jsx: "text/javascript",
|
|
68
|
+
tsx: "text/typescript",
|
|
69
|
+
py: "text/x-python",
|
|
70
|
+
java: "text/x-java",
|
|
71
|
+
cpp: "text/x-c++src",
|
|
72
|
+
c: "text/x-csrc",
|
|
73
|
+
cs: "text/x-csharp",
|
|
74
|
+
php: "text/x-php",
|
|
75
|
+
rb: "text/x-ruby",
|
|
76
|
+
go: "text/x-go",
|
|
77
|
+
rs: "text/x-rust",
|
|
78
|
+
yaml: "text/yaml",
|
|
79
|
+
yml: "text/yaml",
|
|
80
|
+
toml: "text/toml",
|
|
81
|
+
ini: "text/plain",
|
|
82
|
+
env: "text/plain",
|
|
83
|
+
diff: "text/x-diff",
|
|
84
|
+
patch: "text/x-diff",
|
|
85
|
+
log: "text/plain",
|
|
86
|
+
csv: "text/csv",
|
|
87
|
+
tsv: "text/tab-separated-values",
|
|
88
|
+
srt: "application/x-subrip",
|
|
89
|
+
vtt: "text/vtt",
|
|
90
|
+
zip: "application/zip"
|
|
91
|
+
}[o] || "application/octet-stream";
|
|
92
|
+
}
|
|
93
|
+
function _t(e, t = 0) {
|
|
94
|
+
if (e instanceof File)
|
|
95
|
+
return {
|
|
96
|
+
id: `file-${Date.now()}-${t}`,
|
|
97
|
+
name: e.name,
|
|
98
|
+
url: URL.createObjectURL(e),
|
|
99
|
+
type: e.type || le(e.name),
|
|
100
|
+
size: e.size
|
|
101
|
+
};
|
|
102
|
+
if (typeof e == "string") {
|
|
103
|
+
const o = Ct(e);
|
|
104
|
+
return {
|
|
105
|
+
id: `url-${Date.now()}-${t}`,
|
|
106
|
+
name: o,
|
|
107
|
+
url: e,
|
|
108
|
+
type: le(o)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
id: e.id || `link-${Date.now()}-${t}`,
|
|
113
|
+
name: e.name,
|
|
114
|
+
url: e.url,
|
|
115
|
+
type: e.type || le(e.name),
|
|
116
|
+
size: e.size
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function zt(e) {
|
|
120
|
+
return e.map((t, o) => _t(t, o));
|
|
121
|
+
}
|
|
122
|
+
function Mt(e) {
|
|
123
|
+
var t;
|
|
124
|
+
const o = ((t = e.name.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "", a = e.type.toLowerCase();
|
|
125
|
+
if (a.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(o))
|
|
126
|
+
return "image";
|
|
127
|
+
if (a.includes("pdf") || o === "pdf")
|
|
128
|
+
return "pdf";
|
|
129
|
+
if (a.includes("wordprocessingml") || o === "docx")
|
|
130
|
+
return "docx";
|
|
131
|
+
if (a.includes("spreadsheetml") || o === "xlsx")
|
|
132
|
+
return "xlsx";
|
|
133
|
+
if (a.includes("presentationml") || o === "pptx" || o === "ppt")
|
|
134
|
+
return "pptx";
|
|
135
|
+
if (a.includes("ms-outlook") || o === "msg")
|
|
136
|
+
return "msg";
|
|
137
|
+
if (a.includes("epub") || o === "epub")
|
|
138
|
+
return "epub";
|
|
139
|
+
if (["mobi", "azw", "azw3", "kf8"].includes(o) || a === "application/x-mobipocket-ebook" || a === "application/vnd.amazon.ebook")
|
|
140
|
+
return "mobi";
|
|
141
|
+
if (["csv", "tsv"].includes(o) || a === "text/csv" || a === "text/tab-separated-values")
|
|
142
|
+
return "csv";
|
|
143
|
+
if (o === "xml" || a === "application/xml" || a === "text/xml")
|
|
144
|
+
return "xml";
|
|
145
|
+
if (["srt", "vtt", "lrc", "elrc", "ass", "ssa", "ttml", "dfxp"].includes(o) || a === "text/vtt" || a === "application/x-subrip" || a === "application/ttml+xml")
|
|
146
|
+
return "subtitle";
|
|
147
|
+
if (o === "zip" || a === "application/zip" || a === "application/x-zip-compressed")
|
|
148
|
+
return "zip";
|
|
149
|
+
if (a.startsWith("video/") || ["mp4", "webm", "ogg", "ogv", "mov", "avi", "mkv", "m4v", "3gp", "flv"].includes(o))
|
|
150
|
+
return "video";
|
|
151
|
+
if (a.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac", "aac"].includes(o))
|
|
152
|
+
return "audio";
|
|
153
|
+
if (o === "md" || o === "markdown")
|
|
154
|
+
return "markdown";
|
|
155
|
+
if (a === "application/json" || o === "json")
|
|
156
|
+
return "json";
|
|
157
|
+
const l = [
|
|
158
|
+
"txt",
|
|
159
|
+
"log",
|
|
160
|
+
"lock",
|
|
161
|
+
"js",
|
|
162
|
+
"jsx",
|
|
163
|
+
"ts",
|
|
164
|
+
"tsx",
|
|
165
|
+
"py",
|
|
166
|
+
"java",
|
|
167
|
+
"cpp",
|
|
168
|
+
"c",
|
|
169
|
+
"h",
|
|
170
|
+
"cs",
|
|
171
|
+
"php",
|
|
172
|
+
"rb",
|
|
173
|
+
"go",
|
|
174
|
+
"mod",
|
|
175
|
+
"rs",
|
|
176
|
+
"swift",
|
|
177
|
+
"kt",
|
|
178
|
+
"lua",
|
|
179
|
+
"vim",
|
|
180
|
+
"html",
|
|
181
|
+
"css",
|
|
182
|
+
"scss",
|
|
183
|
+
"sass",
|
|
184
|
+
"less",
|
|
185
|
+
"yaml",
|
|
186
|
+
"yml",
|
|
187
|
+
"toml",
|
|
188
|
+
"ini",
|
|
189
|
+
"conf",
|
|
190
|
+
"env",
|
|
191
|
+
"diff",
|
|
192
|
+
"patch",
|
|
193
|
+
"sh",
|
|
194
|
+
"bash",
|
|
195
|
+
"zsh",
|
|
196
|
+
"sql"
|
|
197
|
+
];
|
|
198
|
+
return a.startsWith("text/") || l.includes(o) ? "text" : "unsupported";
|
|
199
|
+
}
|
|
200
|
+
function ln(e) {
|
|
201
|
+
var t;
|
|
202
|
+
const o = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
|
|
203
|
+
return {
|
|
204
|
+
js: "javascript",
|
|
205
|
+
jsx: "jsx",
|
|
206
|
+
ts: "typescript",
|
|
207
|
+
tsx: "tsx",
|
|
208
|
+
py: "python",
|
|
209
|
+
java: "java",
|
|
210
|
+
cpp: "cpp",
|
|
211
|
+
c: "c",
|
|
212
|
+
cs: "csharp",
|
|
213
|
+
php: "php",
|
|
214
|
+
rb: "ruby",
|
|
215
|
+
go: "go",
|
|
216
|
+
mod: "go",
|
|
217
|
+
rs: "rust",
|
|
218
|
+
swift: "swift",
|
|
219
|
+
kt: "kotlin",
|
|
220
|
+
lua: "lua",
|
|
221
|
+
vim: "vim",
|
|
222
|
+
scala: "scala",
|
|
223
|
+
sh: "bash",
|
|
224
|
+
bash: "bash",
|
|
225
|
+
zsh: "bash",
|
|
226
|
+
json: "json",
|
|
227
|
+
xml: "xml",
|
|
228
|
+
html: "html",
|
|
229
|
+
css: "css",
|
|
230
|
+
scss: "scss",
|
|
231
|
+
sass: "sass",
|
|
232
|
+
less: "less",
|
|
233
|
+
sql: "sql",
|
|
234
|
+
yaml: "yaml",
|
|
235
|
+
yml: "yaml",
|
|
236
|
+
toml: "toml",
|
|
237
|
+
ini: "ini",
|
|
238
|
+
env: "bash",
|
|
239
|
+
conf: "nginx",
|
|
240
|
+
diff: "diff",
|
|
241
|
+
patch: "diff",
|
|
242
|
+
log: "log",
|
|
243
|
+
md: "markdown",
|
|
244
|
+
txt: "text"
|
|
245
|
+
}[o] || "text";
|
|
246
|
+
}
|
|
247
|
+
function rn(e) {
|
|
248
|
+
var t;
|
|
249
|
+
const o = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase().split("?")[0]) || "";
|
|
250
|
+
return {
|
|
251
|
+
mp4: "video/mp4",
|
|
252
|
+
webm: "video/webm",
|
|
253
|
+
ogg: "video/ogg",
|
|
254
|
+
ogv: "video/ogg",
|
|
255
|
+
mov: "video/quicktime",
|
|
256
|
+
avi: "video/x-msvideo",
|
|
257
|
+
mkv: "video/x-matroska",
|
|
258
|
+
m4v: "video/mp4",
|
|
259
|
+
"3gp": "video/3gpp",
|
|
260
|
+
flv: "video/x-flv"
|
|
261
|
+
}[o] || "video/mp4";
|
|
262
|
+
}
|
|
263
|
+
function Rt(e) {
|
|
264
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
265
|
+
}
|
|
266
|
+
function sn(e) {
|
|
267
|
+
if (!isFinite(e) || isNaN(e) || e < 0) return "0:00";
|
|
268
|
+
const t = Math.floor(e / 60), o = Math.floor(e % 60);
|
|
269
|
+
return `${t}:${o.toString().padStart(2, "0")}`;
|
|
270
|
+
}
|
|
271
|
+
function un(e) {
|
|
272
|
+
var t;
|
|
273
|
+
return (((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "") === "tsv" ? " " : ",";
|
|
274
|
+
}
|
|
275
|
+
function dn(e, t = {}) {
|
|
276
|
+
const o = t.delimiter ?? ",", a = t.firstRowAsHeader ?? !0, l = [];
|
|
277
|
+
let n = [], i = "", s = !1, r = 0;
|
|
278
|
+
const u = e.length;
|
|
279
|
+
for (; r < u; ) {
|
|
280
|
+
const p = e[r];
|
|
281
|
+
if (s) {
|
|
282
|
+
if (p === '"') {
|
|
283
|
+
if (e[r + 1] === '"') {
|
|
284
|
+
i += '"', r += 2;
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
s = !1, r += 1;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
i += p, r += 1;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (p === '"') {
|
|
294
|
+
s = !0, r += 1;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (p === o) {
|
|
298
|
+
n.push(i), i = "", r += 1;
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (p === "\r") {
|
|
302
|
+
e[r + 1] === `
|
|
303
|
+
` && (r += 1), n.push(i), l.push(n), n = [], i = "", r += 1;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (p === `
|
|
307
|
+
`) {
|
|
308
|
+
n.push(i), l.push(n), n = [], i = "", r += 1;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
i += p, r += 1;
|
|
312
|
+
}
|
|
313
|
+
for ((i.length > 0 || n.length > 0) && (n.push(i), l.push(n)); l.length > 0; ) {
|
|
314
|
+
const p = l[l.length - 1];
|
|
315
|
+
if (p.length === 1 && p[0] === "")
|
|
316
|
+
l.pop();
|
|
317
|
+
else
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
let d = [], v = l;
|
|
321
|
+
a && l.length > 0 && (d = l[0], v = l.slice(1));
|
|
322
|
+
const m = Math.max(
|
|
323
|
+
d.length,
|
|
324
|
+
...v.map((p) => p.length),
|
|
325
|
+
0
|
|
326
|
+
);
|
|
327
|
+
for (const p of v)
|
|
328
|
+
for (; p.length < m; ) p.push("");
|
|
329
|
+
return {
|
|
330
|
+
header: d,
|
|
331
|
+
rows: v,
|
|
332
|
+
columnCount: m,
|
|
333
|
+
delimiter: o
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function Tt(e) {
|
|
337
|
+
const t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
338
|
+
if (t.length >= 3 && t[0] === 239 && t[1] === 187 && t[2] === 191)
|
|
339
|
+
return new TextDecoder("utf-8").decode(t);
|
|
340
|
+
if (t.length >= 2 && t[0] === 255 && t[1] === 254)
|
|
341
|
+
return new TextDecoder("utf-16le").decode(t);
|
|
342
|
+
if (t.length >= 2 && t[0] === 254 && t[1] === 255)
|
|
343
|
+
return new TextDecoder("utf-16be").decode(t);
|
|
344
|
+
try {
|
|
345
|
+
return new TextDecoder("utf-8", { fatal: !0 }).decode(t);
|
|
346
|
+
} catch {
|
|
347
|
+
}
|
|
348
|
+
try {
|
|
349
|
+
return new TextDecoder("gbk").decode(t);
|
|
350
|
+
} catch {
|
|
351
|
+
}
|
|
352
|
+
return new TextDecoder("utf-8", { fatal: !1 }).decode(t);
|
|
353
|
+
}
|
|
354
|
+
async function pn(e, t) {
|
|
355
|
+
const o = await fetch(e, t);
|
|
356
|
+
if (!o.ok) throw new Error(`请求失败: ${o.status}`);
|
|
357
|
+
const a = await o.arrayBuffer();
|
|
358
|
+
return Tt(a);
|
|
359
|
+
}
|
|
360
|
+
function Ee(e) {
|
|
361
|
+
const t = e.trim().replace(",", "."), o = t.split(":").map((a) => a.trim());
|
|
362
|
+
if (o.length === 3) {
|
|
363
|
+
const [a, l, n] = o;
|
|
364
|
+
return Number(a) * 3600 + Number(l) * 60 + Number(n);
|
|
365
|
+
}
|
|
366
|
+
if (o.length === 2) {
|
|
367
|
+
const [a, l] = o;
|
|
368
|
+
return Number(a) * 60 + Number(l);
|
|
369
|
+
}
|
|
370
|
+
return Number(t) || 0;
|
|
371
|
+
}
|
|
372
|
+
function cn(e) {
|
|
373
|
+
if (!isFinite(e) || e < 0) return "00:00:00.000";
|
|
374
|
+
const t = Math.floor(e * 1e3), o = t % 1e3, a = Math.floor(t / 1e3) % 60, l = Math.floor(t / 6e4) % 60, n = Math.floor(t / 36e5), i = (s, r = 2) => s.toString().padStart(r, "0");
|
|
375
|
+
return `${i(n)}:${i(l)}:${i(a)}.${i(o, 3)}`;
|
|
376
|
+
}
|
|
377
|
+
const Pe = /(\d{1,2}:)?\d{1,2}:\d{1,2}[.,]\d{1,3}\s*-->\s*(\d{1,2}:)?\d{1,2}:\d{1,2}[.,]\d{1,3}/, Et = /^\s*\[\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?\]/;
|
|
378
|
+
function Pt(e) {
|
|
379
|
+
const t = e.replace(/^\uFEFF/, "").trimStart();
|
|
380
|
+
return /^WEBVTT/.test(t) ? "vtt" : /^<\?xml/i.test(t) || /<tt\b[^>]*>/i.test(t) ? "ttml" : /^\[Script Info\]/im.test(t) || /^Dialogue:/m.test(t) ? /ScriptType:\s*v4\.00\s*$/im.test(t) ? "ssa" : "ass" : Et.test(t) || /^\[(ti|ar|al|au|by|length|offset|re|ve):/im.test(t) ? /<\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?>/.test(t) ? "elrc" : "lrc" : "srt";
|
|
381
|
+
}
|
|
382
|
+
function $e(e, t) {
|
|
383
|
+
const o = e.replace(/\r\n?/g, `
|
|
384
|
+
`).replace(/^\uFEFF/, "").split(`
|
|
385
|
+
`), a = [];
|
|
386
|
+
let l, n = 0;
|
|
387
|
+
if (t === "vtt") {
|
|
388
|
+
const i = [];
|
|
389
|
+
for (; n < o.length && o[n].trim() !== ""; )
|
|
390
|
+
i.push(o[n]), n++;
|
|
391
|
+
for (l = i.join(`
|
|
392
|
+
`); n < o.length && o[n].trim() === ""; ) n++;
|
|
393
|
+
}
|
|
394
|
+
for (; n < o.length; ) {
|
|
395
|
+
for (; n < o.length && o[n].trim() === ""; ) n++;
|
|
396
|
+
if (n >= o.length) break;
|
|
397
|
+
let i, s = null;
|
|
398
|
+
if (Pe.test(o[n]))
|
|
399
|
+
s = o[n], n++;
|
|
400
|
+
else if (i = o[n].trim() || void 0, n++, n < o.length && Pe.test(o[n]))
|
|
401
|
+
s = o[n], n++;
|
|
402
|
+
else
|
|
403
|
+
continue;
|
|
404
|
+
if (!s) continue;
|
|
405
|
+
const r = s.match(/([\d:.,]+)\s*-->\s*([\d:.,]+)/);
|
|
406
|
+
if (!r) continue;
|
|
407
|
+
const u = Ee(r[1]), d = Ee(r[2]), v = [];
|
|
408
|
+
for (; n < o.length && o[n].trim() !== ""; )
|
|
409
|
+
v.push(o[n]), n++;
|
|
410
|
+
a.push({ id: i, start: u, end: d, text: v.join(`
|
|
411
|
+
`) });
|
|
412
|
+
}
|
|
413
|
+
return { format: t, cues: a, header: l };
|
|
414
|
+
}
|
|
415
|
+
function se(e, t, o) {
|
|
416
|
+
const a = Number(e), l = Number(t);
|
|
417
|
+
let n = 0;
|
|
418
|
+
if (o) {
|
|
419
|
+
const i = (o + "000").slice(0, 3);
|
|
420
|
+
n = Number(i);
|
|
421
|
+
}
|
|
422
|
+
return a * 60 + l + n / 1e3;
|
|
423
|
+
}
|
|
424
|
+
function Xe(e, t) {
|
|
425
|
+
const o = /^\[(ti|ar|al|au|by|length|offset|re|ve):(.*)\]$/i.exec(e.trim());
|
|
426
|
+
if (!o) return !1;
|
|
427
|
+
const a = o[1].toLowerCase(), l = o[2].trim();
|
|
428
|
+
if (t.metadata[a] = l, a === "offset") {
|
|
429
|
+
const n = Number(l);
|
|
430
|
+
isNaN(n) || (t.offsetMs = n);
|
|
431
|
+
}
|
|
432
|
+
return !0;
|
|
433
|
+
}
|
|
434
|
+
function $t(e) {
|
|
435
|
+
const t = e.replace(/\r\n?/g, `
|
|
436
|
+
`).replace(/^\uFEFF/, "").split(`
|
|
437
|
+
`), o = { metadata: {}, offsetMs: 0 }, a = /\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g, l = [];
|
|
438
|
+
for (const i of t) {
|
|
439
|
+
const s = i.trim();
|
|
440
|
+
if (!s || Xe(s, o)) continue;
|
|
441
|
+
const r = [];
|
|
442
|
+
let u = 0;
|
|
443
|
+
a.lastIndex = 0;
|
|
444
|
+
let d;
|
|
445
|
+
for (; (d = a.exec(s)) !== null && d.index === u; )
|
|
446
|
+
r.push(se(d[1], d[2], d[3])), u = d.index + d[0].length;
|
|
447
|
+
if (r.length === 0) continue;
|
|
448
|
+
const v = s.slice(u).trim();
|
|
449
|
+
for (const m of r)
|
|
450
|
+
l.push({ start: m, text: v });
|
|
451
|
+
}
|
|
452
|
+
l.sort((i, s) => i.start - s.start);
|
|
453
|
+
const n = o.offsetMs / 1e3;
|
|
454
|
+
return { format: "lrc", cues: l.map((i, s) => {
|
|
455
|
+
const r = Math.max(0, i.start - n), u = l[s + 1], d = u ? Math.max(r, u.start - n) : r + 5;
|
|
456
|
+
return { start: r, end: d, text: i.text };
|
|
457
|
+
}), metadata: o.metadata };
|
|
458
|
+
}
|
|
459
|
+
function St(e) {
|
|
460
|
+
const t = e.replace(/\r\n?/g, `
|
|
461
|
+
`).replace(/^\uFEFF/, "").split(`
|
|
462
|
+
`), o = { metadata: {}, offsetMs: 0 }, a = /\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g, l = /<(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?>/g, n = [];
|
|
463
|
+
for (const s of t) {
|
|
464
|
+
const r = s.trim();
|
|
465
|
+
if (!r || Xe(r, o)) continue;
|
|
466
|
+
const u = [];
|
|
467
|
+
let d = 0;
|
|
468
|
+
a.lastIndex = 0;
|
|
469
|
+
let v;
|
|
470
|
+
for (; (v = a.exec(r)) !== null && v.index === d; )
|
|
471
|
+
u.push(se(v[1], v[2], v[3])), d = v.index + v[0].length;
|
|
472
|
+
if (u.length === 0) continue;
|
|
473
|
+
const m = r.slice(d);
|
|
474
|
+
for (const p of u)
|
|
475
|
+
n.push({ start: p, raw: m });
|
|
476
|
+
}
|
|
477
|
+
n.sort((s, r) => s.start - r.start);
|
|
478
|
+
const i = o.offsetMs / 1e3;
|
|
479
|
+
return { format: "elrc", cues: n.map((s, r) => {
|
|
480
|
+
const u = [];
|
|
481
|
+
let d = "", v = 0, m = null;
|
|
482
|
+
l.lastIndex = 0;
|
|
483
|
+
let p;
|
|
484
|
+
for (; (p = l.exec(s.raw)) !== null; ) {
|
|
485
|
+
const P = s.raw.slice(v, p.index);
|
|
486
|
+
m !== null && P && u.push({ start: Math.max(0, m - i), text: P }), d += P, m = se(p[1], p[2], p[3]), v = p.index + p[0].length;
|
|
487
|
+
}
|
|
488
|
+
const y = s.raw.slice(v);
|
|
489
|
+
m !== null && y && u.push({ start: Math.max(0, m - i), text: y }), d += y;
|
|
490
|
+
const M = Math.max(0, s.start - i), N = n[r + 1], k = N ? Math.max(M, N.start - i) : M + 5;
|
|
491
|
+
return {
|
|
492
|
+
start: M,
|
|
493
|
+
end: k,
|
|
494
|
+
text: d.trim(),
|
|
495
|
+
words: u.length ? u : void 0
|
|
496
|
+
};
|
|
497
|
+
}), metadata: o.metadata };
|
|
498
|
+
}
|
|
499
|
+
function Se(e) {
|
|
500
|
+
const t = e.trim().split(":");
|
|
501
|
+
return t.length !== 3 ? 0 : Number(t[0]) * 3600 + Number(t[1]) * 60 + Number(t[2].replace(",", "."));
|
|
502
|
+
}
|
|
503
|
+
function Ne(e, t) {
|
|
504
|
+
const o = e.replace(/\r\n?/g, `
|
|
505
|
+
`).replace(/^\uFEFF/, "").split(`
|
|
506
|
+
`);
|
|
507
|
+
let a = "", l = [];
|
|
508
|
+
const n = [], i = [];
|
|
509
|
+
for (const s of o) {
|
|
510
|
+
const r = s.replace(/\s+$/, ""), u = r.trim(), d = /^\[([^\]]+)\]\s*$/.exec(u);
|
|
511
|
+
if (d) {
|
|
512
|
+
a = d[1].toLowerCase(), i.push(r);
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
if (a !== "events") {
|
|
516
|
+
i.push(r);
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
const v = /^Format:\s*(.+)$/i.exec(u);
|
|
520
|
+
if (v) {
|
|
521
|
+
l = v[1].split(",").map((W) => W.trim());
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
const m = /^(Dialogue|Comment):\s*(.+)$/i.exec(u);
|
|
525
|
+
if (!m || m[1].toLowerCase() === "comment" || l.length === 0) continue;
|
|
526
|
+
const p = l.length, y = m[2].split(","), M = y.slice(0, p - 1), N = y.slice(p - 1).join(","), k = {};
|
|
527
|
+
l.forEach((W, f) => {
|
|
528
|
+
k[W] = f === p - 1 ? N : M[f] ?? "";
|
|
529
|
+
});
|
|
530
|
+
const P = Se(k.Start || ""), Z = Se(k.End || ""), H = (k.Text || "").replace(/\\N/g, `
|
|
531
|
+
`).replace(/\\n/g, `
|
|
532
|
+
`).replace(/\\h/g, " ").replace(/\{[^}]*\}/g, "");
|
|
533
|
+
n.push({ start: P, end: Z, text: H, style: k.Style });
|
|
534
|
+
}
|
|
535
|
+
return n.sort((s, r) => s.start - r.start), {
|
|
536
|
+
format: t,
|
|
537
|
+
cues: n,
|
|
538
|
+
header: i.join(`
|
|
539
|
+
`).trim() || void 0
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function re(e) {
|
|
543
|
+
const t = e.trim();
|
|
544
|
+
if (!t) return 0;
|
|
545
|
+
const o = /^(\d+(?:\.\d+)?)(h|m|s|ms|f|t)$/i.exec(t);
|
|
546
|
+
if (o) {
|
|
547
|
+
const l = Number(o[1]), n = o[2].toLowerCase();
|
|
548
|
+
return n === "h" ? l * 3600 : n === "m" ? l * 60 : n === "ms" ? l / 1e3 : l;
|
|
549
|
+
}
|
|
550
|
+
const a = t.split(":");
|
|
551
|
+
return a.length === 3 ? Number(a[0]) * 3600 + Number(a[1]) * 60 + Number(a[2]) : a.length === 2 ? Number(a[0]) * 60 + Number(a[1]) : Number(t) || 0;
|
|
552
|
+
}
|
|
553
|
+
function Nt(e) {
|
|
554
|
+
if (typeof DOMParser > "u")
|
|
555
|
+
throw new Error("TTML parsing requires a DOMParser environment");
|
|
556
|
+
const t = new DOMParser().parseFromString(e, "application/xml");
|
|
557
|
+
if (t.getElementsByTagName("parsererror").length > 0)
|
|
558
|
+
throw new Error("TTML XML parse error");
|
|
559
|
+
const o = t.getElementsByTagName("p"), a = [];
|
|
560
|
+
for (let l = 0; l < o.length; l++) {
|
|
561
|
+
const n = o[l], i = n.getAttribute("begin") || "", s = n.getAttribute("end") || "", r = n.getAttribute("dur") || "", u = re(i);
|
|
562
|
+
let d;
|
|
563
|
+
s ? d = re(s) : r ? d = u + re(r) : d = u + 5;
|
|
564
|
+
let v = "";
|
|
565
|
+
n.childNodes.forEach((p) => {
|
|
566
|
+
if (p.nodeType === 3)
|
|
567
|
+
v += p.nodeValue || "";
|
|
568
|
+
else if (p.nodeType === 1) {
|
|
569
|
+
const y = p;
|
|
570
|
+
y.tagName.toLowerCase() === "br" ? v += `
|
|
571
|
+
` : v += y.textContent || "";
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
const m = v.replace(/[ \t]+/g, " ").replace(/\n /g, `
|
|
575
|
+
`).trim();
|
|
576
|
+
(m || u || d) && a.push({ start: u, end: d, text: m });
|
|
577
|
+
}
|
|
578
|
+
return a.sort((l, n) => l.start - n.start), { format: "ttml", cues: a };
|
|
579
|
+
}
|
|
580
|
+
function fn(e, t) {
|
|
581
|
+
switch (t ?? Pt(e)) {
|
|
582
|
+
case "lrc":
|
|
583
|
+
return $t(e);
|
|
584
|
+
case "elrc":
|
|
585
|
+
return St(e);
|
|
586
|
+
case "ass":
|
|
587
|
+
return Ne(e, "ass");
|
|
588
|
+
case "ssa":
|
|
589
|
+
return Ne(e, "ssa");
|
|
590
|
+
case "ttml":
|
|
591
|
+
return Nt(e);
|
|
592
|
+
case "vtt":
|
|
593
|
+
return $e(e, "vtt");
|
|
594
|
+
case "srt":
|
|
595
|
+
default:
|
|
596
|
+
return $e(e, "srt");
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
async function mn(e) {
|
|
600
|
+
return yt.loadAsync(e);
|
|
601
|
+
}
|
|
602
|
+
function vn(e) {
|
|
603
|
+
const t = [];
|
|
604
|
+
return e.forEach((o, a) => {
|
|
605
|
+
var l;
|
|
606
|
+
const n = a.dir, i = n && !o.endsWith("/") ? o + "/" : o, s = n ? i.replace(/\/$/, "") : i, r = s.lastIndexOf("/"), u = r >= 0 ? s.slice(r + 1) : s, d = r >= 0 ? s.slice(0, r) : "", v = n ? 0 : ((l = a._data) == null ? void 0 : l.uncompressedSize) ?? 0;
|
|
607
|
+
t.push({
|
|
608
|
+
path: i,
|
|
609
|
+
name: u,
|
|
610
|
+
dir: d,
|
|
611
|
+
isDir: n,
|
|
612
|
+
size: v,
|
|
613
|
+
date: a.date
|
|
614
|
+
});
|
|
615
|
+
}), t;
|
|
616
|
+
}
|
|
617
|
+
function hn(e) {
|
|
618
|
+
const t = { name: "", path: "", isDir: !0, children: [], size: 0 }, o = /* @__PURE__ */ new Map();
|
|
619
|
+
o.set("", t);
|
|
620
|
+
const a = (n) => {
|
|
621
|
+
if (o.has(n)) return o.get(n);
|
|
622
|
+
const i = n.split("/").filter(Boolean);
|
|
623
|
+
let s = t, r = "";
|
|
624
|
+
for (const u of i) {
|
|
625
|
+
r = r ? `${r}/${u}` : u;
|
|
626
|
+
let d = o.get(r);
|
|
627
|
+
d || (d = { name: u, path: r + "/", isDir: !0, children: [], size: 0 }, s.children.push(d), o.set(r, d)), s = d;
|
|
628
|
+
}
|
|
629
|
+
return s;
|
|
630
|
+
};
|
|
631
|
+
for (const n of e) {
|
|
632
|
+
if (n.isDir) {
|
|
633
|
+
a(n.path.replace(/\/$/, ""));
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
a(n.dir).children.push({
|
|
637
|
+
name: n.name,
|
|
638
|
+
path: n.path,
|
|
639
|
+
isDir: !1,
|
|
640
|
+
size: n.size
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
const l = (n) => {
|
|
644
|
+
if (n.children) {
|
|
645
|
+
n.children.sort((i, s) => i.isDir !== s.isDir ? i.isDir ? -1 : 1 : i.name.localeCompare(s.name));
|
|
646
|
+
for (const i of n.children) l(i);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
return l(t), t;
|
|
650
|
+
}
|
|
651
|
+
async function gn(e, t, o) {
|
|
652
|
+
const a = e.file(t);
|
|
653
|
+
if (!a) throw new Error(`ZIP entry not found: ${t}`);
|
|
654
|
+
const l = await a.async("arraybuffer");
|
|
655
|
+
return new Blob([l], o ? { type: o } : void 0);
|
|
656
|
+
}
|
|
657
|
+
function jt(e) {
|
|
658
|
+
return e ? e.startsWith("#") ? e : e.length === 8 ? "#" + e.substring(2) : e.length === 6 ? "#" + e : "#000000" : "#000000";
|
|
659
|
+
}
|
|
660
|
+
const Wt = [
|
|
661
|
+
"FFFFFF",
|
|
662
|
+
"000000",
|
|
663
|
+
"E7E6E6",
|
|
664
|
+
"44546A",
|
|
665
|
+
"4472C4",
|
|
666
|
+
"ED7D31",
|
|
667
|
+
"A5A5A5",
|
|
668
|
+
"FFC000",
|
|
669
|
+
"5B9BD5",
|
|
670
|
+
"70AD47"
|
|
671
|
+
], Lt = [
|
|
672
|
+
"000000",
|
|
673
|
+
"FFFFFF",
|
|
674
|
+
"FF0000",
|
|
675
|
+
"00FF00",
|
|
676
|
+
"0000FF",
|
|
677
|
+
"FFFF00",
|
|
678
|
+
"FF00FF",
|
|
679
|
+
"00FFFF",
|
|
680
|
+
"000000",
|
|
681
|
+
"FFFFFF",
|
|
682
|
+
"FF0000",
|
|
683
|
+
"00FF00",
|
|
684
|
+
"0000FF",
|
|
685
|
+
"FFFF00",
|
|
686
|
+
"FF00FF",
|
|
687
|
+
"00FFFF",
|
|
688
|
+
"800000",
|
|
689
|
+
"008000",
|
|
690
|
+
"000080",
|
|
691
|
+
"808000",
|
|
692
|
+
"800080",
|
|
693
|
+
"008080",
|
|
694
|
+
"C0C0C0",
|
|
695
|
+
"808080",
|
|
696
|
+
"9999FF",
|
|
697
|
+
"993366",
|
|
698
|
+
"FFFFCC",
|
|
699
|
+
"CCFFFF",
|
|
700
|
+
"660066",
|
|
701
|
+
"FF8080",
|
|
702
|
+
"0066CC",
|
|
703
|
+
"CCCCFF",
|
|
704
|
+
"000080",
|
|
705
|
+
"FF00FF",
|
|
706
|
+
"FFFF00",
|
|
707
|
+
"00FFFF",
|
|
708
|
+
"800080",
|
|
709
|
+
"800000",
|
|
710
|
+
"008080",
|
|
711
|
+
"0000FF",
|
|
712
|
+
"00CCFF",
|
|
713
|
+
"CCFFFF",
|
|
714
|
+
"CCFFCC",
|
|
715
|
+
"FFFF99",
|
|
716
|
+
"99CCFF",
|
|
717
|
+
"FF99CC",
|
|
718
|
+
"CC99FF",
|
|
719
|
+
"FFCC99",
|
|
720
|
+
"3366FF",
|
|
721
|
+
"33CCCC",
|
|
722
|
+
"99CC00",
|
|
723
|
+
"FFCC00",
|
|
724
|
+
"FF9900",
|
|
725
|
+
"FF6600",
|
|
726
|
+
"666699",
|
|
727
|
+
"969696",
|
|
728
|
+
"003366",
|
|
729
|
+
"339966",
|
|
730
|
+
"003300",
|
|
731
|
+
"333300",
|
|
732
|
+
"993300",
|
|
733
|
+
"993366",
|
|
734
|
+
"333399",
|
|
735
|
+
"333333"
|
|
736
|
+
];
|
|
737
|
+
function Dt(e, t) {
|
|
738
|
+
const o = parseInt(e.substring(0, 2), 16), a = parseInt(e.substring(2, 4), 16), l = parseInt(e.substring(4, 6), 16), n = (u) => t < 0 ? Math.round(u * (1 + t)) : Math.round(u + (255 - u) * t), i = Math.min(255, Math.max(0, n(o))), s = Math.min(255, Math.max(0, n(a))), r = Math.min(255, Math.max(0, n(l)));
|
|
739
|
+
return i.toString(16).padStart(2, "0") + s.toString(16).padStart(2, "0") + r.toString(16).padStart(2, "0");
|
|
740
|
+
}
|
|
741
|
+
function It(e) {
|
|
742
|
+
if (e && e.type === "pattern" && e.pattern === "solid") {
|
|
743
|
+
const t = e.fgColor;
|
|
744
|
+
if (t)
|
|
745
|
+
return ce(t);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
function ce(e) {
|
|
749
|
+
if (e) {
|
|
750
|
+
if ("argb" in e && typeof e.argb == "string" && e.argb)
|
|
751
|
+
return jt(e.argb);
|
|
752
|
+
if ("theme" in e && typeof e.theme == "number") {
|
|
753
|
+
const t = Wt[e.theme] || "000000", o = "tint" in e && typeof e.tint == "number" ? e.tint : 0;
|
|
754
|
+
return "#" + (o !== 0 ? Dt(t, o) : t);
|
|
755
|
+
}
|
|
756
|
+
if ("indexed" in e && typeof e.indexed == "number") {
|
|
757
|
+
const t = Lt[e.indexed];
|
|
758
|
+
if (t) return "#" + t;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
function Ot(e) {
|
|
763
|
+
if (!e || !e.style) return;
|
|
764
|
+
const t = ce(e.color) || "#000000";
|
|
765
|
+
return [e.style, t];
|
|
766
|
+
}
|
|
767
|
+
function Zt(e) {
|
|
768
|
+
const t = {};
|
|
769
|
+
let o = !1;
|
|
770
|
+
if (e.font) {
|
|
771
|
+
const l = e.font;
|
|
772
|
+
if ((l.name || l.size || l.bold || l.italic) && (o = !0, t.font = {}, l.name && (t.font.name = l.name), l.size && (t.font.size = l.size), l.bold && (t.font.bold = !0), l.italic && (t.font.italic = !0)), l.color) {
|
|
773
|
+
const n = ce(l.color);
|
|
774
|
+
n && (o = !0, t.color = n);
|
|
775
|
+
}
|
|
776
|
+
l.underline && (o = !0, t.underline = !0), l.strike && (o = !0, t.strike = !0);
|
|
777
|
+
}
|
|
778
|
+
const a = It(e.fill);
|
|
779
|
+
if (a && (o = !0, t.bgcolor = a), e.alignment) {
|
|
780
|
+
const l = e.alignment;
|
|
781
|
+
l.horizontal && (o = !0, t.align = l.horizontal), l.vertical && (o = !0, t.valign = l.vertical), l.wrapText && (o = !0, t.textwrap = !0);
|
|
782
|
+
}
|
|
783
|
+
if (e.border) {
|
|
784
|
+
const l = {};
|
|
785
|
+
let n = !1;
|
|
786
|
+
const i = ["top", "bottom", "left", "right"];
|
|
787
|
+
for (const s of i) {
|
|
788
|
+
const r = Ot(e.border[s]);
|
|
789
|
+
r && (l[s] = r, n = !0);
|
|
790
|
+
}
|
|
791
|
+
n && (o = !0, t.border = l);
|
|
792
|
+
}
|
|
793
|
+
return o ? t : null;
|
|
794
|
+
}
|
|
795
|
+
function At(e) {
|
|
796
|
+
return JSON.stringify(e);
|
|
797
|
+
}
|
|
798
|
+
function Bt(e, t, o) {
|
|
799
|
+
const a = Zt(e);
|
|
800
|
+
if (!a) return -1;
|
|
801
|
+
const l = At(a), n = o.get(l);
|
|
802
|
+
if (n !== void 0) return n;
|
|
803
|
+
const i = t.length;
|
|
804
|
+
return t.push(a), o.set(l, i), i;
|
|
805
|
+
}
|
|
806
|
+
function Vt(e) {
|
|
807
|
+
const t = e.value;
|
|
808
|
+
if (t == null) return "";
|
|
809
|
+
if (typeof t == "string") return t;
|
|
810
|
+
if (typeof t == "number") return String(t);
|
|
811
|
+
if (typeof t == "boolean") return t ? "TRUE" : "FALSE";
|
|
812
|
+
if (t instanceof Date)
|
|
813
|
+
return t.toLocaleDateString();
|
|
814
|
+
if (typeof t == "object" && "formula" in t) {
|
|
815
|
+
const o = t.result;
|
|
816
|
+
return o != null ? String(o) : "";
|
|
817
|
+
}
|
|
818
|
+
return typeof t == "object" && "richText" in t ? t.richText.map((o) => o.text).join("") : typeof t == "object" && "hyperlink" in t ? t.text || "" : typeof t == "object" && "error" in t ? String(t.error) : String(t);
|
|
819
|
+
}
|
|
820
|
+
function Gt(e) {
|
|
821
|
+
const t = e.split(":"), o = je(t[0]), a = t[1] ? je(t[1]) : o;
|
|
822
|
+
return {
|
|
823
|
+
top: o.row,
|
|
824
|
+
left: o.col,
|
|
825
|
+
bottom: a.row,
|
|
826
|
+
right: a.col
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
function je(e) {
|
|
830
|
+
const t = e.match(/^([A-Z]+)(\d+)$/);
|
|
831
|
+
if (!t) return { row: 1, col: 1 };
|
|
832
|
+
const o = t[1], a = parseInt(t[2], 10);
|
|
833
|
+
let l = 0;
|
|
834
|
+
for (let n = 0; n < o.length; n++)
|
|
835
|
+
l = l * 26 + (o.charCodeAt(n) - 64);
|
|
836
|
+
return { row: a, col: l };
|
|
837
|
+
}
|
|
838
|
+
function bn(e) {
|
|
839
|
+
const t = [];
|
|
840
|
+
return e.eachSheet((o) => {
|
|
841
|
+
const a = [], l = /* @__PURE__ */ new Map(), n = [], i = {}, s = {}, r = o.columnCount;
|
|
842
|
+
for (let m = 1; m <= r; m++) {
|
|
843
|
+
const p = o.getColumn(m);
|
|
844
|
+
p.width && (s[String(m - 1)] = { width: Math.round(p.width * 7.5) });
|
|
845
|
+
}
|
|
846
|
+
s.len = Math.max(r, 26);
|
|
847
|
+
const u = /* @__PURE__ */ new Map(), d = o.model, v = (d == null ? void 0 : d.merges) || [];
|
|
848
|
+
for (const m of v) {
|
|
849
|
+
n.push(m);
|
|
850
|
+
const { top: p, left: y, bottom: M, right: N } = Gt(m), k = M - p, P = N - y;
|
|
851
|
+
u.set(`${p - 1},${y - 1}`, [k, P]);
|
|
852
|
+
}
|
|
853
|
+
o.eachRow({ includeEmpty: !0 }, (m, p) => {
|
|
854
|
+
const y = p - 1, M = {};
|
|
855
|
+
m.eachCell({ includeEmpty: !1 }, (k, P) => {
|
|
856
|
+
const Z = P - 1;
|
|
857
|
+
if (k.isMerged && k.master !== k) return;
|
|
858
|
+
const H = Vt(k), W = Bt(k, a, l), f = { text: H };
|
|
859
|
+
W !== -1 && (f.style = W);
|
|
860
|
+
const A = `${y},${Z}`;
|
|
861
|
+
u.has(A) && (f.merge = u.get(A)), M[String(Z)] = f;
|
|
862
|
+
});
|
|
863
|
+
const N = { cells: M };
|
|
864
|
+
m.height && (N.height = Math.round(m.height * 1.333)), i[String(y)] = N;
|
|
865
|
+
}), t.push({
|
|
866
|
+
name: o.name,
|
|
867
|
+
styles: a,
|
|
868
|
+
merges: n,
|
|
869
|
+
rows: i,
|
|
870
|
+
cols: s
|
|
871
|
+
});
|
|
872
|
+
}), t;
|
|
873
|
+
}
|
|
874
|
+
function wn(e, t, o = "Sheet1") {
|
|
875
|
+
const a = e.length > 0, l = a ? [{ font: { bold: !0 } }] : [], n = {};
|
|
876
|
+
if (a) {
|
|
877
|
+
const s = {};
|
|
878
|
+
e.forEach((r, u) => {
|
|
879
|
+
s[String(u)] = { text: r, style: 0 };
|
|
880
|
+
}), n[0] = { cells: s };
|
|
881
|
+
}
|
|
882
|
+
const i = a ? 1 : 0;
|
|
883
|
+
return t.forEach((s, r) => {
|
|
884
|
+
const u = {};
|
|
885
|
+
s.forEach((d, v) => {
|
|
886
|
+
d !== void 0 && d !== "" && (u[String(v)] = { text: d });
|
|
887
|
+
}), n[String(r + i)] = { cells: u };
|
|
888
|
+
}), [{ name: o, styles: l, rows: n }];
|
|
889
|
+
}
|
|
890
|
+
function xn(e, t) {
|
|
891
|
+
var o;
|
|
892
|
+
if (typeof window > "u") return;
|
|
893
|
+
const a = (e == null ? void 0 : e.version) || ((o = e == null ? void 0 : e.GlobalWorkerOptions) == null ? void 0 : o.version) || "", {
|
|
894
|
+
workerSrc: l = `https://unpkg.com/pdfjs-dist@${a}/build/pdf.worker.min.mjs`,
|
|
895
|
+
cMapUrl: n = `https://unpkg.com/pdfjs-dist@${a}/cmaps/`,
|
|
896
|
+
cMapPacked: i = !0
|
|
897
|
+
} = t || {};
|
|
898
|
+
e.GlobalWorkerOptions && (e.GlobalWorkerOptions.workerSrc = l, e.GlobalWorkerOptions.cMapUrl = n, e.GlobalWorkerOptions.cMapPacked = i);
|
|
899
|
+
}
|
|
900
|
+
const Ht = {
|
|
901
|
+
// ─────── common ───────
|
|
902
|
+
"common.download": "下载",
|
|
903
|
+
"common.close": "关闭",
|
|
904
|
+
"common.loading": "加载中",
|
|
905
|
+
"common.unknown_error": "未知错误",
|
|
906
|
+
"common.unsupported_preview": "不支持预览此文件类型 ({type})",
|
|
907
|
+
// ─────── toolbar ───────
|
|
908
|
+
"toolbar.zoom_in": "放大",
|
|
909
|
+
"toolbar.zoom_out": "缩小",
|
|
910
|
+
"toolbar.rotate_left": "向左旋转",
|
|
911
|
+
"toolbar.rotate_right": "向右旋转",
|
|
912
|
+
"toolbar.reset": "复原",
|
|
913
|
+
"toolbar.fit_to_window": "适应窗口",
|
|
914
|
+
"toolbar.original_size": "原始尺寸",
|
|
915
|
+
"toolbar.toc": "目录",
|
|
916
|
+
"toolbar.prev_page": "上一页",
|
|
917
|
+
"toolbar.next_page": "下一页",
|
|
918
|
+
"toolbar.full_width": "全屏宽度",
|
|
919
|
+
"toolbar.normal_width": "正常宽度",
|
|
920
|
+
"toolbar.wrap_on": "自动换行",
|
|
921
|
+
"toolbar.wrap_off": "不换行",
|
|
922
|
+
"toolbar.source": "源码",
|
|
923
|
+
"toolbar.preview": "预览",
|
|
924
|
+
// ─────── image ───────
|
|
925
|
+
"image.load_failed": "图片加载失败",
|
|
926
|
+
// ─────── pdf ───────
|
|
927
|
+
"pdf.load_failed": "PDF 文件加载失败",
|
|
928
|
+
// ─────── docx ───────
|
|
929
|
+
"docx.parse_failed": "Word 文档解析失败",
|
|
930
|
+
// ─────── xlsx ───────
|
|
931
|
+
"xlsx.loading": "加载 Excel 中...",
|
|
932
|
+
"xlsx.load_failed": "Excel 加载失败",
|
|
933
|
+
"xlsx.parse_failed": "Excel 文件解析失败",
|
|
934
|
+
"xlsx.not_found": "Excel 文件不存在",
|
|
935
|
+
// ─────── pptx ───────
|
|
936
|
+
"pptx.loading": "加载 PPT 中...",
|
|
937
|
+
"pptx.load_failed": "PPT 加载失败",
|
|
938
|
+
"pptx.parse_failed": "PPT 文件解析失败",
|
|
939
|
+
"pptx.not_found": "PPT 文件不存在",
|
|
940
|
+
"pptx.invalid_format": "PPT 文件格式错误或已损坏",
|
|
941
|
+
"pptx.no_pages": "PPT 文件无有效页面",
|
|
942
|
+
"pptx.timeout": "加载超时,请检查网络或稍后重试",
|
|
943
|
+
// ─────── msg ───────
|
|
944
|
+
"msg.parse_failed": "Outlook 邮件解析失败",
|
|
945
|
+
"msg.parse_failed_short": "邮件解析失败",
|
|
946
|
+
"msg.empty_body": "(无邮件正文)",
|
|
947
|
+
// ─────── epub ───────
|
|
948
|
+
"epub.load_failed": "EPUB 文件加载失败",
|
|
949
|
+
// ─────── mobi ───────
|
|
950
|
+
"mobi.load_failed": "电子书加载失败,文件可能已损坏或带有 DRM 保护",
|
|
951
|
+
// ─────── video ───────
|
|
952
|
+
"video.loading": "加载视频中...",
|
|
953
|
+
"video.load_failed": "视频加载失败",
|
|
954
|
+
"video.load_failed_with_error": "视频加载失败: {error}",
|
|
955
|
+
// ─────── audio (aria-label) ───────
|
|
956
|
+
"audio.aria.play": "播放",
|
|
957
|
+
"audio.aria.pause": "暂停",
|
|
958
|
+
"audio.aria.forward_10": "前进 10 秒",
|
|
959
|
+
"audio.aria.backward_10": "后退 10 秒",
|
|
960
|
+
"audio.aria.mute": "静音",
|
|
961
|
+
"audio.aria.unmute": "取消静音",
|
|
962
|
+
"audio.aria.loop_on": "开启循环",
|
|
963
|
+
"audio.aria.loop_off": "关闭循环",
|
|
964
|
+
"audio.aria.progress": "播放进度",
|
|
965
|
+
"audio.aria.volume": "音量",
|
|
966
|
+
// ─────── markdown ───────
|
|
967
|
+
"markdown.load_failed": "Markdown 文件加载失败",
|
|
968
|
+
"markdown.copy_code": "复制代码",
|
|
969
|
+
"markdown.copied": "已复制",
|
|
970
|
+
// ─────── json ───────
|
|
971
|
+
"json.load_failed": "JSON 文件加载失败",
|
|
972
|
+
"json.items": "items",
|
|
973
|
+
"json.keys": "keys",
|
|
974
|
+
// ─────── csv ───────
|
|
975
|
+
"csv.loading": "加载 CSV 中...",
|
|
976
|
+
"csv.load_failed": "CSV 文件加载失败",
|
|
977
|
+
"csv.parse_failed": "CSV 解析失败",
|
|
978
|
+
// ─────── xml ───────
|
|
979
|
+
"xml.load_failed": "XML 文件加载失败",
|
|
980
|
+
// ─────── subtitle / lyric ───────
|
|
981
|
+
"subtitle.load_failed": "字幕文件加载失败",
|
|
982
|
+
"subtitle.parse_failed": "字幕解析失败",
|
|
983
|
+
"subtitle.lines": "lines",
|
|
984
|
+
"subtitle.cues": "cues",
|
|
985
|
+
"subtitle.meta.title": "标题",
|
|
986
|
+
"subtitle.meta.artist": "艺术家",
|
|
987
|
+
"subtitle.meta.album": "专辑",
|
|
988
|
+
"subtitle.meta.author": "作者",
|
|
989
|
+
"subtitle.meta.by": "制作",
|
|
990
|
+
"subtitle.meta.length": "时长",
|
|
991
|
+
"subtitle.meta.offset": "偏移",
|
|
992
|
+
"subtitle.meta.editor": "编辑器",
|
|
993
|
+
"subtitle.meta.version": "版本",
|
|
994
|
+
// ─────── zip ───────
|
|
995
|
+
"zip.load_failed": "ZIP 文件加载失败",
|
|
996
|
+
"zip.parse_failed": "ZIP 解析失败",
|
|
997
|
+
// ─────── text ───────
|
|
998
|
+
"text.load_failed": "文本文件加载失败"
|
|
999
|
+
}, Ut = {
|
|
1000
|
+
// ─────── common ───────
|
|
1001
|
+
"common.download": "Download",
|
|
1002
|
+
"common.close": "Close",
|
|
1003
|
+
"common.loading": "Loading",
|
|
1004
|
+
"common.unknown_error": "Unknown error",
|
|
1005
|
+
"common.unsupported_preview": "Preview not supported for this file type ({type})",
|
|
1006
|
+
// ─────── toolbar ───────
|
|
1007
|
+
"toolbar.zoom_in": "Zoom in",
|
|
1008
|
+
"toolbar.zoom_out": "Zoom out",
|
|
1009
|
+
"toolbar.rotate_left": "Rotate left",
|
|
1010
|
+
"toolbar.rotate_right": "Rotate right",
|
|
1011
|
+
"toolbar.reset": "Reset",
|
|
1012
|
+
"toolbar.fit_to_window": "Fit to window",
|
|
1013
|
+
"toolbar.original_size": "Original size",
|
|
1014
|
+
"toolbar.toc": "Table of contents",
|
|
1015
|
+
"toolbar.prev_page": "Previous page",
|
|
1016
|
+
"toolbar.next_page": "Next page",
|
|
1017
|
+
"toolbar.full_width": "Full width",
|
|
1018
|
+
"toolbar.normal_width": "Normal width",
|
|
1019
|
+
"toolbar.wrap_on": "Word wrap",
|
|
1020
|
+
"toolbar.wrap_off": "No wrap",
|
|
1021
|
+
"toolbar.source": "Source",
|
|
1022
|
+
"toolbar.preview": "Preview",
|
|
1023
|
+
// ─────── image ───────
|
|
1024
|
+
"image.load_failed": "Failed to load image",
|
|
1025
|
+
// ─────── pdf ───────
|
|
1026
|
+
"pdf.load_failed": "Failed to load PDF",
|
|
1027
|
+
// ─────── docx ───────
|
|
1028
|
+
"docx.parse_failed": "Failed to parse Word document",
|
|
1029
|
+
// ─────── xlsx ───────
|
|
1030
|
+
"xlsx.loading": "Loading Excel...",
|
|
1031
|
+
"xlsx.load_failed": "Failed to load Excel",
|
|
1032
|
+
"xlsx.parse_failed": "Failed to parse Excel file",
|
|
1033
|
+
"xlsx.not_found": "Excel file not found",
|
|
1034
|
+
// ─────── pptx ───────
|
|
1035
|
+
"pptx.loading": "Loading PPT...",
|
|
1036
|
+
"pptx.load_failed": "Failed to load PPT",
|
|
1037
|
+
"pptx.parse_failed": "Failed to parse PPT file",
|
|
1038
|
+
"pptx.not_found": "PPT file not found",
|
|
1039
|
+
"pptx.invalid_format": "PPT file format is invalid or corrupted",
|
|
1040
|
+
"pptx.no_pages": "PPT file has no valid pages",
|
|
1041
|
+
"pptx.timeout": "Loading timed out, please check your network and retry",
|
|
1042
|
+
// ─────── msg ───────
|
|
1043
|
+
"msg.parse_failed": "Failed to parse Outlook message",
|
|
1044
|
+
"msg.parse_failed_short": "Failed to parse message",
|
|
1045
|
+
"msg.empty_body": "(No message body)",
|
|
1046
|
+
// ─────── epub ───────
|
|
1047
|
+
"epub.load_failed": "Failed to load EPUB",
|
|
1048
|
+
// ─────── mobi ───────
|
|
1049
|
+
"mobi.load_failed": "Failed to load ebook — file may be corrupted or DRM-protected",
|
|
1050
|
+
// ─────── video ───────
|
|
1051
|
+
"video.loading": "Loading video...",
|
|
1052
|
+
"video.load_failed": "Failed to load video",
|
|
1053
|
+
"video.load_failed_with_error": "Failed to load video: {error}",
|
|
1054
|
+
// ─────── audio (aria-label) ───────
|
|
1055
|
+
"audio.aria.play": "Play",
|
|
1056
|
+
"audio.aria.pause": "Pause",
|
|
1057
|
+
"audio.aria.forward_10": "Forward 10 seconds",
|
|
1058
|
+
"audio.aria.backward_10": "Back 10 seconds",
|
|
1059
|
+
"audio.aria.mute": "Mute",
|
|
1060
|
+
"audio.aria.unmute": "Unmute",
|
|
1061
|
+
"audio.aria.loop_on": "Enable loop",
|
|
1062
|
+
"audio.aria.loop_off": "Disable loop",
|
|
1063
|
+
"audio.aria.progress": "Playback progress",
|
|
1064
|
+
"audio.aria.volume": "Volume",
|
|
1065
|
+
// ─────── markdown ───────
|
|
1066
|
+
"markdown.load_failed": "Failed to load Markdown",
|
|
1067
|
+
"markdown.copy_code": "Copy code",
|
|
1068
|
+
"markdown.copied": "Copied",
|
|
1069
|
+
// ─────── json ───────
|
|
1070
|
+
"json.load_failed": "Failed to load JSON",
|
|
1071
|
+
"json.items": "items",
|
|
1072
|
+
"json.keys": "keys",
|
|
1073
|
+
// ─────── csv ───────
|
|
1074
|
+
"csv.loading": "Loading CSV...",
|
|
1075
|
+
"csv.load_failed": "Failed to load CSV",
|
|
1076
|
+
"csv.parse_failed": "Failed to parse CSV",
|
|
1077
|
+
// ─────── xml ───────
|
|
1078
|
+
"xml.load_failed": "Failed to load XML",
|
|
1079
|
+
// ─────── subtitle / lyric ───────
|
|
1080
|
+
"subtitle.load_failed": "Failed to load subtitle",
|
|
1081
|
+
"subtitle.parse_failed": "Failed to parse subtitle",
|
|
1082
|
+
"subtitle.lines": "lines",
|
|
1083
|
+
"subtitle.cues": "cues",
|
|
1084
|
+
"subtitle.meta.title": "Title",
|
|
1085
|
+
"subtitle.meta.artist": "Artist",
|
|
1086
|
+
"subtitle.meta.album": "Album",
|
|
1087
|
+
"subtitle.meta.author": "Author",
|
|
1088
|
+
"subtitle.meta.by": "By",
|
|
1089
|
+
"subtitle.meta.length": "Length",
|
|
1090
|
+
"subtitle.meta.offset": "Offset",
|
|
1091
|
+
"subtitle.meta.editor": "Editor",
|
|
1092
|
+
"subtitle.meta.version": "Version",
|
|
1093
|
+
// ─────── zip ───────
|
|
1094
|
+
"zip.load_failed": "Failed to load ZIP",
|
|
1095
|
+
"zip.parse_failed": "Failed to parse ZIP",
|
|
1096
|
+
// ─────── text ───────
|
|
1097
|
+
"text.load_failed": "Failed to load text file"
|
|
1098
|
+
}, te = {
|
|
1099
|
+
"zh-CN": Ht,
|
|
1100
|
+
"en-US": Ut
|
|
1101
|
+
}, Xt = /\{(\w+)\}/g;
|
|
1102
|
+
function qt(e, t) {
|
|
1103
|
+
return t ? e.replace(Xt, (o, a) => {
|
|
1104
|
+
const l = t[a];
|
|
1105
|
+
return l === void 0 ? `{${a}}` : String(l);
|
|
1106
|
+
}) : e;
|
|
1107
|
+
}
|
|
1108
|
+
function qe(e) {
|
|
1109
|
+
var t;
|
|
1110
|
+
const o = e.fallbackLocale ?? "zh-CN", a = te[e.locale] ?? te[o] ?? te["zh-CN"], l = (t = e.messages) == null ? void 0 : t[e.locale], n = l ? { ...a, ...l } : a, i = te["zh-CN"];
|
|
1111
|
+
return (s, r) => {
|
|
1112
|
+
const u = n[s] ?? i[s] ?? s;
|
|
1113
|
+
return qt(u, r);
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
const Ye = Symbol("file-preview-locale");
|
|
1117
|
+
function Yt(e, t) {
|
|
1118
|
+
const o = T(() => C(e) ?? "zh-CN"), a = T(
|
|
1119
|
+
() => qe({ locale: o.value, messages: C(t) })
|
|
1120
|
+
);
|
|
1121
|
+
ue(Ye, { locale: o, t: a });
|
|
1122
|
+
}
|
|
1123
|
+
let ie = null;
|
|
1124
|
+
function Jt() {
|
|
1125
|
+
return ie || (ie = qe({ locale: "zh-CN" })), ie;
|
|
1126
|
+
}
|
|
1127
|
+
function fe() {
|
|
1128
|
+
const e = Le(Ye, null);
|
|
1129
|
+
if (e) return e;
|
|
1130
|
+
const t = T(() => "zh-CN"), o = T(() => Jt());
|
|
1131
|
+
return { locale: t, t: o };
|
|
1132
|
+
}
|
|
1133
|
+
const Je = Symbol("vfp-resolved-theme");
|
|
1134
|
+
function Kt(e) {
|
|
1135
|
+
const t = T(() => C(e));
|
|
1136
|
+
ue(Je, t);
|
|
1137
|
+
}
|
|
1138
|
+
function yn() {
|
|
1139
|
+
const e = Le(Je, null);
|
|
1140
|
+
return e || T(() => "dark");
|
|
1141
|
+
}
|
|
1142
|
+
const Qt = (e, { attrs: t }) => O("svg", {
|
|
1143
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1144
|
+
viewBox: "0 0 24 24",
|
|
1145
|
+
fill: "none",
|
|
1146
|
+
stroke: "currentColor",
|
|
1147
|
+
"stroke-width": "2",
|
|
1148
|
+
"stroke-linecap": "round",
|
|
1149
|
+
"stroke-linejoin": "round",
|
|
1150
|
+
...t
|
|
1151
|
+
}, [
|
|
1152
|
+
O("text", {
|
|
1153
|
+
x: "12",
|
|
1154
|
+
y: "17.5",
|
|
1155
|
+
"text-anchor": "middle",
|
|
1156
|
+
"font-size": "20",
|
|
1157
|
+
"font-weight": "bold",
|
|
1158
|
+
fill: "currentColor",
|
|
1159
|
+
stroke: "none"
|
|
1160
|
+
}, "1:1")
|
|
1161
|
+
]);
|
|
1162
|
+
function eo(e) {
|
|
1163
|
+
return [
|
|
1164
|
+
{
|
|
1165
|
+
items: [
|
|
1166
|
+
{ type: "button", icon: Ie, tooltip: e.t("toolbar.zoom_out"), action: e.onZoomOut, disabled: e.zoom <= 0.01 },
|
|
1167
|
+
{ type: "text", content: `${Math.round(e.zoom * 100)}%`, minWidth: "3rem" },
|
|
1168
|
+
{ type: "button", icon: Oe, tooltip: e.t("toolbar.zoom_in"), action: e.onZoomIn, disabled: e.zoom >= 10 }
|
|
1169
|
+
]
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
items: [
|
|
1173
|
+
{ type: "button", icon: vt, tooltip: e.t("toolbar.fit_to_window"), action: e.onFitToWidth },
|
|
1174
|
+
{ type: "button", icon: Qt, tooltip: e.t("toolbar.original_size"), action: e.onOriginalSize }
|
|
1175
|
+
]
|
|
1176
|
+
},
|
|
1177
|
+
{
|
|
1178
|
+
items: [
|
|
1179
|
+
{ type: "button", icon: ht, tooltip: e.t("toolbar.rotate_left"), action: e.onRotateLeft },
|
|
1180
|
+
{ type: "button", icon: gt, tooltip: e.t("toolbar.rotate_right"), action: e.onRotateRight }
|
|
1181
|
+
]
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
items: [
|
|
1185
|
+
{ type: "button", icon: Ze, tooltip: e.t("toolbar.reset"), action: e.onReset }
|
|
1186
|
+
]
|
|
1187
|
+
}
|
|
1188
|
+
];
|
|
1189
|
+
}
|
|
1190
|
+
function to(e) {
|
|
1191
|
+
return [
|
|
1192
|
+
{
|
|
1193
|
+
items: [
|
|
1194
|
+
{ type: "button", icon: Ie, tooltip: e.t("toolbar.zoom_out"), action: e.onZoomOut, disabled: e.zoom <= 0.01 },
|
|
1195
|
+
{ type: "text", content: `${Math.round(e.zoom * 100)}%`, minWidth: "3rem" },
|
|
1196
|
+
{ type: "button", icon: Oe, tooltip: e.t("toolbar.zoom_in"), action: e.onZoomIn, disabled: e.zoom >= 10 }
|
|
1197
|
+
]
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
items: [
|
|
1201
|
+
{ type: "button", icon: Ze, tooltip: e.t("toolbar.reset"), action: e.onReset }
|
|
1202
|
+
]
|
|
1203
|
+
}
|
|
1204
|
+
];
|
|
1205
|
+
}
|
|
1206
|
+
function oo(e) {
|
|
1207
|
+
return [
|
|
1208
|
+
{
|
|
1209
|
+
items: [
|
|
1210
|
+
{ type: "button", icon: Ae, tooltip: e.t("toolbar.toc"), action: () => {
|
|
1211
|
+
var t;
|
|
1212
|
+
return (t = e.epubRef) == null ? void 0 : t.toggleToc();
|
|
1213
|
+
} }
|
|
1214
|
+
]
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
items: [
|
|
1218
|
+
{ type: "button", icon: de, tooltip: e.t("toolbar.prev_page"), action: () => {
|
|
1219
|
+
var t;
|
|
1220
|
+
return (t = e.epubRef) == null ? void 0 : t.prevPage();
|
|
1221
|
+
} },
|
|
1222
|
+
{ type: "text", content: `${e.current} / ${e.total}`, minWidth: "4rem" },
|
|
1223
|
+
{ type: "button", icon: pe, tooltip: e.t("toolbar.next_page"), action: () => {
|
|
1224
|
+
var t;
|
|
1225
|
+
return (t = e.epubRef) == null ? void 0 : t.nextPage();
|
|
1226
|
+
} }
|
|
1227
|
+
]
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
items: [
|
|
1231
|
+
{
|
|
1232
|
+
type: "button",
|
|
1233
|
+
icon: e.fullWidth ? Be : Ve,
|
|
1234
|
+
tooltip: e.fullWidth ? e.t("toolbar.normal_width") : e.t("toolbar.full_width"),
|
|
1235
|
+
action: () => {
|
|
1236
|
+
var t;
|
|
1237
|
+
return (t = e.epubRef) == null ? void 0 : t.toggleFullWidth();
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
]
|
|
1241
|
+
}
|
|
1242
|
+
];
|
|
1243
|
+
}
|
|
1244
|
+
function no(e) {
|
|
1245
|
+
return [
|
|
1246
|
+
{
|
|
1247
|
+
items: [
|
|
1248
|
+
{ type: "button", icon: Ae, tooltip: e.t("toolbar.toc"), action: () => {
|
|
1249
|
+
var t;
|
|
1250
|
+
return (t = e.mobiRef) == null ? void 0 : t.toggleToc();
|
|
1251
|
+
} }
|
|
1252
|
+
]
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
items: [
|
|
1256
|
+
{ type: "button", icon: de, tooltip: e.t("toolbar.prev_page"), action: () => {
|
|
1257
|
+
var t;
|
|
1258
|
+
return (t = e.mobiRef) == null ? void 0 : t.prevPage();
|
|
1259
|
+
} },
|
|
1260
|
+
{ type: "text", content: `${e.current} / ${e.total}`, minWidth: "4rem" },
|
|
1261
|
+
{ type: "button", icon: pe, tooltip: e.t("toolbar.next_page"), action: () => {
|
|
1262
|
+
var t;
|
|
1263
|
+
return (t = e.mobiRef) == null ? void 0 : t.nextPage();
|
|
1264
|
+
} }
|
|
1265
|
+
]
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
items: [
|
|
1269
|
+
{
|
|
1270
|
+
type: "button",
|
|
1271
|
+
icon: e.fullWidth ? Be : Ve,
|
|
1272
|
+
tooltip: e.fullWidth ? e.t("toolbar.normal_width") : e.t("toolbar.full_width"),
|
|
1273
|
+
action: () => {
|
|
1274
|
+
var t;
|
|
1275
|
+
return (t = e.mobiRef) == null ? void 0 : t.toggleFullWidth();
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
]
|
|
1279
|
+
}
|
|
1280
|
+
];
|
|
1281
|
+
}
|
|
1282
|
+
function ao({ stats: e }) {
|
|
1283
|
+
return e ? [
|
|
1284
|
+
{
|
|
1285
|
+
items: [
|
|
1286
|
+
{
|
|
1287
|
+
type: "text",
|
|
1288
|
+
content: `${e.files} files · ${e.dirs} dirs · ${Rt(e.size)}`,
|
|
1289
|
+
minWidth: "10rem"
|
|
1290
|
+
}
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
] : [];
|
|
1294
|
+
}
|
|
1295
|
+
function lo(e) {
|
|
1296
|
+
const t = [
|
|
1297
|
+
{
|
|
1298
|
+
items: [
|
|
1299
|
+
{
|
|
1300
|
+
type: "button",
|
|
1301
|
+
icon: O(bt, { class: "vfp-w-4 vfp-h-4" }),
|
|
1302
|
+
tooltip: e.wordWrap ? e.t("toolbar.wrap_off") : e.t("toolbar.wrap_on"),
|
|
1303
|
+
action: e.onToggleWrap
|
|
1304
|
+
}
|
|
1305
|
+
]
|
|
1306
|
+
}
|
|
1307
|
+
];
|
|
1308
|
+
return e.isHtml && t.push({
|
|
1309
|
+
items: [
|
|
1310
|
+
{
|
|
1311
|
+
type: "button",
|
|
1312
|
+
icon: e.htmlPreview ? O(Ge, { class: "vfp-w-4 vfp-h-4" }) : O(He, { class: "vfp-w-4 vfp-h-4" }),
|
|
1313
|
+
tooltip: e.htmlPreview ? e.t("toolbar.source") : e.t("toolbar.preview"),
|
|
1314
|
+
action: e.onToggleHtmlPreview
|
|
1315
|
+
}
|
|
1316
|
+
]
|
|
1317
|
+
}), t;
|
|
1318
|
+
}
|
|
1319
|
+
function ro(e) {
|
|
1320
|
+
return [
|
|
1321
|
+
{
|
|
1322
|
+
items: [
|
|
1323
|
+
{
|
|
1324
|
+
type: "button",
|
|
1325
|
+
icon: e.viewMode === "preview" ? O(Ge, { class: "vfp-w-4 vfp-h-4" }) : O(He, { class: "vfp-w-4 vfp-h-4" }),
|
|
1326
|
+
tooltip: e.viewMode === "preview" ? e.t("toolbar.source") : e.t("toolbar.preview"),
|
|
1327
|
+
action: e.onToggleViewMode
|
|
1328
|
+
}
|
|
1329
|
+
]
|
|
1330
|
+
}
|
|
1331
|
+
];
|
|
1332
|
+
}
|
|
1333
|
+
const io = { class: "rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-text-fg-muted" }, so = { class: "rfp-flex rfp-flex-col rfp-items-center rfp-gap-3" }, uo = { class: "rfp-text-sm" }, po = /* @__PURE__ */ X({
|
|
1334
|
+
__name: "RendererLoading",
|
|
1335
|
+
setup(e) {
|
|
1336
|
+
const { t } = fe();
|
|
1337
|
+
return (o, a) => (c(), g("div", io, [
|
|
1338
|
+
E("div", so, [
|
|
1339
|
+
a[0] || (a[0] = E("div", { class: "rfp-w-8 rfp-h-8 rfp-rounded-full rfp-border-2 rfp-border-fg-muted rfp-border-t-transparent rfp-animate-spin" }, null, -1)),
|
|
1340
|
+
E("span", uo, D(C(t)("common.loading") || "Loading..."), 1)
|
|
1341
|
+
])
|
|
1342
|
+
]));
|
|
1343
|
+
}
|
|
1344
|
+
}), $ = (e) => ut({
|
|
1345
|
+
loader: e,
|
|
1346
|
+
loadingComponent: { render: () => O(po) },
|
|
1347
|
+
delay: 0
|
|
1348
|
+
}), co = $(() => import("./index-BM9FaQUl.mjs")), fo = $(() => import("./index-cZn4ih-x.mjs")), mo = $(() => import("./index-DAo-7spn.mjs")), vo = $(() => import("./index-BoL1b2w-.mjs")), ho = $(() => import("./index-BYzQg-jL.mjs")), go = $(() => import("./index-dzB4jd9b.mjs")), bo = $(() => import("./index-D9wf6m37.mjs")), wo = $(() => import("./index-Bri7VeRx.mjs")), xo = $(() => import("./index-DXlcF1Dk.mjs")), yo = $(() => import("./index-lHlugUBI.mjs")), ko = $(() => import("./index-CTsscgqY.mjs")), Fo = $(() => import("./index-C7uOM7XL.mjs")), Co = $(() => import("./index-DAEQe-RI.mjs")), _o = $(() => import("./index-BCkcZs4y.mjs")), zo = $(() => import("./index-Ch7AEfnk.mjs")), Mo = $(() => import("./index-ELyTQZeF.mjs")), Ro = $(() => import("./index-5Smm2vx0.mjs")), To = { class: "vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-8 vfp-gap-6" }, Eo = { class: "vfp-w-32 vfp-h-32 vfp-rounded-full vfp-bg-surface-2 vfp-flex vfp-items-center vfp-justify-center" }, Po = { class: "vfp-text-fg-primary vfp-text-center" }, $o = { class: "vfp-text-xl vfp-font-medium vfp-mb-2" }, So = { class: "vfp-text-fg-secondary" }, We = /* @__PURE__ */ X({
|
|
1349
|
+
__name: "index",
|
|
1350
|
+
props: {
|
|
1351
|
+
fileName: {},
|
|
1352
|
+
fileType: {}
|
|
1353
|
+
},
|
|
1354
|
+
emits: ["download"],
|
|
1355
|
+
setup(e, { emit: t }) {
|
|
1356
|
+
const { t: o } = fe(), a = t;
|
|
1357
|
+
return (l, n) => (c(), g("div", To, [
|
|
1358
|
+
E("div", Eo, [
|
|
1359
|
+
G(C(wt), { class: "vfp-w-16 vfp-h-16 vfp-text-fg-secondary" })
|
|
1360
|
+
]),
|
|
1361
|
+
E("div", Po, [
|
|
1362
|
+
E("p", $o, D(e.fileName), 1),
|
|
1363
|
+
E("p", So, D(C(o)("common.unsupported_preview", { type: e.fileType })), 1)
|
|
1364
|
+
]),
|
|
1365
|
+
E("button", {
|
|
1366
|
+
class: "vfp-flex vfp-items-center vfp-gap-2 vfp-px-6 vfp-py-3 vfp-bg-surface-2 hover:vfp-bg-surface-3 vfp-backdrop-blur-sm vfp-rounded-lg vfp-text-fg-primary vfp-font-medium vfp-transition-all",
|
|
1367
|
+
onClick: n[0] || (n[0] = (i) => a("download"))
|
|
1368
|
+
}, [
|
|
1369
|
+
G(C(Ue), { class: "vfp-w-5 vfp-h-5" }),
|
|
1370
|
+
dt(" " + D(C(o)("common.download")), 1)
|
|
1371
|
+
])
|
|
1372
|
+
]));
|
|
1373
|
+
}
|
|
1374
|
+
}), No = ["tabindex", "data-theme"], jo = {
|
|
1375
|
+
key: 0,
|
|
1376
|
+
class: "vfp-flex-shrink-0 vfp-z-10 vfp-backdrop-blur-md vfp-border-b vfp-bg-surface-toolbar vfp-border-line",
|
|
1377
|
+
style: { "padding-top": "env(safe-area-inset-top, 0px)" }
|
|
1378
|
+
}, Wo = { class: "vfp-flex vfp-items-center vfp-justify-between vfp-px-3 md:vfp-px-5 vfp-py-1.5 md:vfp-py-2.5" }, Lo = { class: "vfp-flex vfp-items-center vfp-flex-1 vfp-min-w-0 vfp-mr-2 md:vfp-mr-3" }, Do = { class: "vfp-font-medium vfp-text-xs md:vfp-text-sm vfp-truncate vfp-text-fg-primary" }, Io = { class: "vfp-text-xs vfp-ml-2 vfp-flex-shrink-0 vfp-text-fg-muted" }, Oo = { class: "vfp-flex vfp-items-center vfp-gap-1 md:vfp-hidden vfp-flex-shrink-0" }, Zo = ["data-tooltip", "disabled", "onClick"], Ao = { class: "vfp-hidden md:vfp-flex vfp-items-center vfp-gap-1 vfp-flex-shrink-0" }, Bo = ["data-tooltip", "disabled", "onClick"], Vo = ["data-tooltip", "disabled", "onClick"], Go = {
|
|
1379
|
+
key: 0,
|
|
1380
|
+
class: "vfp-flex vfp-items-center vfp-gap-1 vfp-px-3 vfp-pb-1.5 vfp-overflow-x-auto scrollbar-hide md:vfp-hidden"
|
|
1381
|
+
}, Ho = {
|
|
1382
|
+
key: 0,
|
|
1383
|
+
class: "vfp-w-px vfp-h-4 vfp-mx-0.5 vfp-bg-divide"
|
|
1384
|
+
}, Uo = ["data-tooltip", "disabled", "onClick"], Xo = 3, qo = 2e3, Yo = /* @__PURE__ */ X({
|
|
1385
|
+
__name: "FilePreviewContent",
|
|
1386
|
+
props: {
|
|
1387
|
+
files: {},
|
|
1388
|
+
currentIndex: {},
|
|
1389
|
+
customRenderers: { default: () => [] },
|
|
1390
|
+
mode: { default: "modal" },
|
|
1391
|
+
zipNestingDepth: { default: 0 },
|
|
1392
|
+
locale: { default: void 0 },
|
|
1393
|
+
messages: { default: void 0 },
|
|
1394
|
+
headless: { type: Boolean, default: !1 },
|
|
1395
|
+
theme: { default: "dark" }
|
|
1396
|
+
},
|
|
1397
|
+
emits: ["navigate", "close", "custom-event"],
|
|
1398
|
+
setup(e, { emit: t }) {
|
|
1399
|
+
const o = e, a = t;
|
|
1400
|
+
Yt(Te(o, "locale"), Te(o, "messages"));
|
|
1401
|
+
const { t: l } = fe(), n = z(
|
|
1402
|
+
typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
|
|
1403
|
+
);
|
|
1404
|
+
let i = null;
|
|
1405
|
+
V(
|
|
1406
|
+
() => o.theme,
|
|
1407
|
+
(b) => {
|
|
1408
|
+
if (i && (i(), i = null), b === "auto") {
|
|
1409
|
+
const h = window.matchMedia("(prefers-color-scheme: dark)"), j = (w) => {
|
|
1410
|
+
n.value = w.matches;
|
|
1411
|
+
};
|
|
1412
|
+
h.addEventListener("change", j), i = () => h.removeEventListener("change", j);
|
|
1413
|
+
}
|
|
1414
|
+
},
|
|
1415
|
+
{ immediate: !0 }
|
|
1416
|
+
), oe(() => {
|
|
1417
|
+
i && i();
|
|
1418
|
+
});
|
|
1419
|
+
const s = T(
|
|
1420
|
+
() => o.theme === "auto" ? n.value ? "dark" : "light" : o.theme
|
|
1421
|
+
);
|
|
1422
|
+
Kt(s);
|
|
1423
|
+
const r = z(1), u = z(0), d = z(1), v = z(1), m = z(0), p = z(0), y = z(0), M = z(null), N = z(null), k = z(!0);
|
|
1424
|
+
let P = null;
|
|
1425
|
+
const Z = () => {
|
|
1426
|
+
k.value = !0, P !== null && clearTimeout(P), P = window.setTimeout(() => {
|
|
1427
|
+
k.value = !1;
|
|
1428
|
+
}, qo);
|
|
1429
|
+
}, H = () => Z(), W = T(() => zt(o.files)), f = T(() => W.value[o.currentIndex]), A = T(() => f.value && o.customRenderers.find((b) => b.test(f.value)) || null), ve = T(() => !A.value || !f.value ? null : A.value.render(f.value, q.value)), F = T(() => f.value ? Mt(f.value) : "unsupported"), Ke = (b, h) => {
|
|
1430
|
+
if (!f.value) return;
|
|
1431
|
+
const j = { name: b, payload: h, file: f.value };
|
|
1432
|
+
a("custom-event", j);
|
|
1433
|
+
}, q = T(() => ({
|
|
1434
|
+
emit: Ke,
|
|
1435
|
+
t: l.value,
|
|
1436
|
+
theme: s.value,
|
|
1437
|
+
locale: o.locale ?? "zh-CN"
|
|
1438
|
+
}));
|
|
1439
|
+
ue("file-preview:custom-ctx", q), V(
|
|
1440
|
+
() => o.currentIndex,
|
|
1441
|
+
() => {
|
|
1442
|
+
r.value = 1, u.value = 0, d.value = 1, v.value = 1, m.value = 0, p.value = 0, k.value = !0, P !== null && clearTimeout(P);
|
|
1443
|
+
}
|
|
1444
|
+
), V(
|
|
1445
|
+
[F, m, p],
|
|
1446
|
+
() => {
|
|
1447
|
+
if (F.value === "image" && m.value > 0 && p.value > 0 && M.value) {
|
|
1448
|
+
const b = M.value.clientWidth, h = M.value.clientHeight, j = b / m.value, w = h / p.value, S = Math.min(j, w);
|
|
1449
|
+
r.value = Math.max(0.01, Math.min(10, S));
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
), V(
|
|
1453
|
+
() => W.value.length,
|
|
1454
|
+
(b) => {
|
|
1455
|
+
b > 1 && Z();
|
|
1456
|
+
},
|
|
1457
|
+
{ immediate: !0 }
|
|
1458
|
+
);
|
|
1459
|
+
const Y = (b) => {
|
|
1460
|
+
b.key === "Escape" && o.mode === "modal" ? a("close") : b.key === "ArrowLeft" && o.currentIndex > 0 ? a("navigate", o.currentIndex - 1) : b.key === "ArrowRight" && o.currentIndex < W.value.length - 1 && a("navigate", o.currentIndex + 1);
|
|
1461
|
+
};
|
|
1462
|
+
De(() => {
|
|
1463
|
+
o.mode === "modal" ? window.addEventListener("keydown", Y) : N.value && N.value.addEventListener("keydown", Y);
|
|
1464
|
+
}), oe(() => {
|
|
1465
|
+
P !== null && clearTimeout(P), o.mode === "modal" ? window.removeEventListener("keydown", Y) : N.value && N.value.removeEventListener("keydown", Y);
|
|
1466
|
+
});
|
|
1467
|
+
const he = () => {
|
|
1468
|
+
r.value = Math.min(r.value + 0.1, 10);
|
|
1469
|
+
}, ge = () => {
|
|
1470
|
+
r.value = Math.max(r.value - 0.1, 0.01);
|
|
1471
|
+
}, Qe = () => {
|
|
1472
|
+
u.value = u.value + 90;
|
|
1473
|
+
}, et = () => {
|
|
1474
|
+
u.value = u.value - 90;
|
|
1475
|
+
}, tt = () => {
|
|
1476
|
+
if (M.value && m.value > 0 && p.value > 0) {
|
|
1477
|
+
const b = M.value.clientWidth, h = M.value.clientHeight, j = b / m.value, w = h / p.value, S = Math.min(j, w);
|
|
1478
|
+
r.value = Math.max(0.01, Math.min(10, S));
|
|
1479
|
+
} else
|
|
1480
|
+
r.value = 1;
|
|
1481
|
+
u.value = 0, y.value++;
|
|
1482
|
+
}, ot = () => {
|
|
1483
|
+
r.value = 1, u.value = 0, y.value++;
|
|
1484
|
+
}, nt = (b) => {
|
|
1485
|
+
r.value = b;
|
|
1486
|
+
}, be = () => {
|
|
1487
|
+
r.value = 1, u.value = 0, y.value++;
|
|
1488
|
+
}, ne = () => {
|
|
1489
|
+
if (!f.value) return;
|
|
1490
|
+
const b = document.createElement("a");
|
|
1491
|
+
b.href = f.value.url, b.download = f.value.name, b.click();
|
|
1492
|
+
}, at = T(() => o.mode === "modal"), we = z(null), xe = z(0), ye = z(0), ke = z(!1), Fe = z(null), Ce = z(0), _e = z(0), ze = z(!1), lt = (b, h) => {
|
|
1493
|
+
xe.value = b, ye.value = h;
|
|
1494
|
+
}, rt = (b, h) => {
|
|
1495
|
+
Ce.value = b, _e.value = h;
|
|
1496
|
+
}, Me = z(null), it = (b) => {
|
|
1497
|
+
Me.value = b;
|
|
1498
|
+
}, J = z(!0), K = z(!1), Q = z("preview"), ae = T(() => {
|
|
1499
|
+
var b, h, j;
|
|
1500
|
+
if (A.value)
|
|
1501
|
+
return ((h = (b = A.value).getToolbarGroups) == null ? void 0 : h.call(b, f.value, q.value)) ?? [];
|
|
1502
|
+
if (F.value === "image")
|
|
1503
|
+
return eo({
|
|
1504
|
+
zoom: r.value,
|
|
1505
|
+
onZoomIn: he,
|
|
1506
|
+
onZoomOut: ge,
|
|
1507
|
+
onFitToWidth: tt,
|
|
1508
|
+
onOriginalSize: ot,
|
|
1509
|
+
onRotateLeft: et,
|
|
1510
|
+
onRotateRight: Qe,
|
|
1511
|
+
onReset: be,
|
|
1512
|
+
t: l.value
|
|
1513
|
+
});
|
|
1514
|
+
if (F.value === "pdf")
|
|
1515
|
+
return to({
|
|
1516
|
+
zoom: r.value,
|
|
1517
|
+
onZoomIn: he,
|
|
1518
|
+
onZoomOut: ge,
|
|
1519
|
+
onReset: be,
|
|
1520
|
+
t: l.value
|
|
1521
|
+
});
|
|
1522
|
+
if (F.value === "epub")
|
|
1523
|
+
return oo({
|
|
1524
|
+
epubRef: we.value,
|
|
1525
|
+
current: xe.value,
|
|
1526
|
+
total: ye.value,
|
|
1527
|
+
fullWidth: ke.value,
|
|
1528
|
+
t: l.value
|
|
1529
|
+
});
|
|
1530
|
+
if (F.value === "mobi")
|
|
1531
|
+
return no({
|
|
1532
|
+
mobiRef: Fe.value,
|
|
1533
|
+
current: Ce.value,
|
|
1534
|
+
total: _e.value,
|
|
1535
|
+
fullWidth: ze.value,
|
|
1536
|
+
t: l.value
|
|
1537
|
+
});
|
|
1538
|
+
if (F.value === "zip")
|
|
1539
|
+
return ao({ stats: Me.value, t: l.value });
|
|
1540
|
+
if (F.value === "text") {
|
|
1541
|
+
const w = ((j = f.value.name.split(".").pop()) == null ? void 0 : j.toLowerCase()) || "";
|
|
1542
|
+
return lo({
|
|
1543
|
+
wordWrap: J.value,
|
|
1544
|
+
onToggleWrap: () => {
|
|
1545
|
+
J.value = !J.value;
|
|
1546
|
+
},
|
|
1547
|
+
isHtml: w === "html" || w === "htm",
|
|
1548
|
+
htmlPreview: K.value,
|
|
1549
|
+
onToggleHtmlPreview: () => {
|
|
1550
|
+
K.value = !K.value;
|
|
1551
|
+
},
|
|
1552
|
+
t: l.value
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
return F.value === "markdown" ? ro({
|
|
1556
|
+
viewMode: Q.value,
|
|
1557
|
+
onToggleViewMode: () => {
|
|
1558
|
+
Q.value = Q.value === "preview" ? "source" : "preview";
|
|
1559
|
+
},
|
|
1560
|
+
t: l.value
|
|
1561
|
+
}) : [];
|
|
1562
|
+
}), Re = T(() => {
|
|
1563
|
+
const b = [
|
|
1564
|
+
{
|
|
1565
|
+
items: [
|
|
1566
|
+
{ type: "button", icon: Ue, tooltip: l.value("common.download"), action: ne }
|
|
1567
|
+
]
|
|
1568
|
+
}
|
|
1569
|
+
];
|
|
1570
|
+
return at.value && b.push({
|
|
1571
|
+
items: [
|
|
1572
|
+
{ type: "button", icon: xt, tooltip: l.value("common.close"), action: () => a("close") }
|
|
1573
|
+
]
|
|
1574
|
+
}), b;
|
|
1575
|
+
}), st = T(() => ae.value.length > 0);
|
|
1576
|
+
return (b, h) => {
|
|
1577
|
+
var j;
|
|
1578
|
+
return c(), g("div", {
|
|
1579
|
+
ref_key: "rootRef",
|
|
1580
|
+
ref: N,
|
|
1581
|
+
tabindex: e.mode === "embed" ? 0 : -1,
|
|
1582
|
+
"data-theme": s.value,
|
|
1583
|
+
class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-flex-col vfp-overflow-hidden vfp-outline-none"
|
|
1584
|
+
}, [
|
|
1585
|
+
e.headless ? L("", !0) : (c(), g("div", jo, [
|
|
1586
|
+
E("div", Wo, [
|
|
1587
|
+
E("div", Lo, [
|
|
1588
|
+
E("h2", Do, D((j = f.value) == null ? void 0 : j.name), 1),
|
|
1589
|
+
E("span", Io, D(e.currentIndex + 1) + "/" + D(W.value.length), 1)
|
|
1590
|
+
]),
|
|
1591
|
+
E("div", Oo, [
|
|
1592
|
+
(c(!0), g(R, null, I(Re.value, (w, S) => (c(), g(R, {
|
|
1593
|
+
key: "m-action-" + S
|
|
1594
|
+
}, [
|
|
1595
|
+
(c(!0), g(R, null, I(w.items, (x, B) => (c(), g(R, {
|
|
1596
|
+
key: "m-action-" + S + "-" + B
|
|
1597
|
+
}, [
|
|
1598
|
+
x.type === "button" ? (c(), g("button", {
|
|
1599
|
+
key: 0,
|
|
1600
|
+
class: "toolbar-btn",
|
|
1601
|
+
"data-tooltip": x.tooltip,
|
|
1602
|
+
disabled: x.disabled,
|
|
1603
|
+
onClick: x.action
|
|
1604
|
+
}, [
|
|
1605
|
+
(c(), _(U(x.icon), { class: "vfp-w-4 vfp-h-4" }))
|
|
1606
|
+
], 8, Zo)) : L("", !0)
|
|
1607
|
+
], 64))), 128))
|
|
1608
|
+
], 64))), 128))
|
|
1609
|
+
]),
|
|
1610
|
+
E("div", Ao, [
|
|
1611
|
+
(c(!0), g(R, null, I(ae.value, (w, S) => (c(), g(R, {
|
|
1612
|
+
key: "d-tool-" + S
|
|
1613
|
+
}, [
|
|
1614
|
+
(c(!0), g(R, null, I(w.items, (x, B) => (c(), g(R, {
|
|
1615
|
+
key: "d-tool-" + S + "-" + B
|
|
1616
|
+
}, [
|
|
1617
|
+
x.type === "button" ? (c(), g("button", {
|
|
1618
|
+
key: 0,
|
|
1619
|
+
class: "toolbar-btn",
|
|
1620
|
+
"data-tooltip": x.tooltip,
|
|
1621
|
+
disabled: x.disabled,
|
|
1622
|
+
onClick: x.action
|
|
1623
|
+
}, [
|
|
1624
|
+
(c(), _(U(x.icon), { class: "vfp-w-4 vfp-h-4" }))
|
|
1625
|
+
], 8, Bo)) : x.type === "text" ? (c(), g("span", {
|
|
1626
|
+
key: 1,
|
|
1627
|
+
class: "vfp-text-xs vfp-text-center vfp-font-medium vfp-tabular-nums vfp-text-fg-tertiary",
|
|
1628
|
+
style: ee({ minWidth: x.minWidth || "auto" })
|
|
1629
|
+
}, D(x.content), 5)) : L("", !0)
|
|
1630
|
+
], 64))), 128)),
|
|
1631
|
+
h[11] || (h[11] = E("div", { class: "vfp-w-px vfp-h-4 vfp-mx-1 vfp-bg-divide" }, null, -1))
|
|
1632
|
+
], 64))), 128)),
|
|
1633
|
+
(c(!0), g(R, null, I(Re.value, (w, S) => (c(), g(R, {
|
|
1634
|
+
key: "d-action-" + S
|
|
1635
|
+
}, [
|
|
1636
|
+
(c(!0), g(R, null, I(w.items, (x, B) => (c(), g(R, {
|
|
1637
|
+
key: "d-action-" + S + "-" + B
|
|
1638
|
+
}, [
|
|
1639
|
+
x.type === "button" ? (c(), g("button", {
|
|
1640
|
+
key: 0,
|
|
1641
|
+
class: "toolbar-btn",
|
|
1642
|
+
"data-tooltip": x.tooltip,
|
|
1643
|
+
disabled: x.disabled,
|
|
1644
|
+
onClick: x.action
|
|
1645
|
+
}, [
|
|
1646
|
+
(c(), _(U(x.icon), { class: "vfp-w-4 vfp-h-4" }))
|
|
1647
|
+
], 8, Vo)) : L("", !0)
|
|
1648
|
+
], 64))), 128))
|
|
1649
|
+
], 64))), 128))
|
|
1650
|
+
])
|
|
1651
|
+
]),
|
|
1652
|
+
st.value ? (c(), g("div", Go, [
|
|
1653
|
+
(c(!0), g(R, null, I(ae.value, (w, S) => (c(), g(R, {
|
|
1654
|
+
key: "m-tool-" + S
|
|
1655
|
+
}, [
|
|
1656
|
+
S > 0 ? (c(), g("div", Ho)) : L("", !0),
|
|
1657
|
+
(c(!0), g(R, null, I(w.items, (x, B) => (c(), g(R, {
|
|
1658
|
+
key: "m-tool-" + S + "-" + B
|
|
1659
|
+
}, [
|
|
1660
|
+
x.type === "button" ? (c(), g("button", {
|
|
1661
|
+
key: 0,
|
|
1662
|
+
class: "toolbar-btn",
|
|
1663
|
+
"data-tooltip": x.tooltip,
|
|
1664
|
+
disabled: x.disabled,
|
|
1665
|
+
onClick: x.action
|
|
1666
|
+
}, [
|
|
1667
|
+
(c(), _(U(x.icon), { class: "vfp-w-4 vfp-h-4" }))
|
|
1668
|
+
], 8, Uo)) : x.type === "text" ? (c(), g("span", {
|
|
1669
|
+
key: 1,
|
|
1670
|
+
class: "vfp-text-xs vfp-text-center vfp-font-medium vfp-tabular-nums vfp-text-fg-tertiary",
|
|
1671
|
+
style: ee({ minWidth: x.minWidth || "auto" })
|
|
1672
|
+
}, D(x.content), 5)) : L("", !0)
|
|
1673
|
+
], 64))), 128))
|
|
1674
|
+
], 64))), 128))
|
|
1675
|
+
])) : L("", !0)
|
|
1676
|
+
])),
|
|
1677
|
+
E("div", {
|
|
1678
|
+
ref_key: "contentRef",
|
|
1679
|
+
ref: M,
|
|
1680
|
+
class: "vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-overflow-auto",
|
|
1681
|
+
onMousemove: H
|
|
1682
|
+
}, [
|
|
1683
|
+
f.value ? (c(), g(R, { key: 0 }, [
|
|
1684
|
+
ve.value ? (c(), _(U(ve.value), {
|
|
1685
|
+
key: 0,
|
|
1686
|
+
file: f.value,
|
|
1687
|
+
ctx: q.value
|
|
1688
|
+
}, null, 8, ["file", "ctx"])) : (c(), g(R, { key: 1 }, [
|
|
1689
|
+
F.value === "image" ? (c(), _(C(co), {
|
|
1690
|
+
key: 0,
|
|
1691
|
+
url: f.value.url,
|
|
1692
|
+
zoom: r.value,
|
|
1693
|
+
rotation: u.value,
|
|
1694
|
+
"reset-key": y.value,
|
|
1695
|
+
"file-size": f.value.size,
|
|
1696
|
+
onZoomChange: nt,
|
|
1697
|
+
onNaturalWidthChange: h[0] || (h[0] = (w) => m.value = w),
|
|
1698
|
+
onNaturalHeightChange: h[1] || (h[1] = (w) => p.value = w)
|
|
1699
|
+
}, null, 8, ["url", "zoom", "rotation", "reset-key", "file-size"])) : F.value === "pdf" ? (c(), _(C(fo), {
|
|
1700
|
+
key: 1,
|
|
1701
|
+
url: f.value.url,
|
|
1702
|
+
zoom: r.value,
|
|
1703
|
+
"current-page": d.value,
|
|
1704
|
+
onPageChange: h[2] || (h[2] = (w) => d.value = w),
|
|
1705
|
+
onTotalPagesChange: h[3] || (h[3] = (w) => v.value = w),
|
|
1706
|
+
onPageWidthChange: h[4] || (h[4] = (w) => m.value = w)
|
|
1707
|
+
}, null, 8, ["url", "zoom", "current-page"])) : F.value === "docx" ? (c(), _(C(mo), {
|
|
1708
|
+
key: 2,
|
|
1709
|
+
url: f.value.url
|
|
1710
|
+
}, null, 8, ["url"])) : F.value === "xlsx" ? (c(), _(C(vo), {
|
|
1711
|
+
key: 3,
|
|
1712
|
+
url: f.value.url
|
|
1713
|
+
}, null, 8, ["url"])) : F.value === "pptx" ? (c(), _(C(ho), {
|
|
1714
|
+
key: 4,
|
|
1715
|
+
url: f.value.url
|
|
1716
|
+
}, null, 8, ["url"])) : F.value === "msg" ? (c(), _(C(go), {
|
|
1717
|
+
key: 5,
|
|
1718
|
+
url: f.value.url
|
|
1719
|
+
}, null, 8, ["url"])) : F.value === "epub" ? (c(), _(C(bo), {
|
|
1720
|
+
key: 6,
|
|
1721
|
+
ref_key: "epubRef",
|
|
1722
|
+
ref: we,
|
|
1723
|
+
url: f.value.url,
|
|
1724
|
+
onChapterChange: lt,
|
|
1725
|
+
onFullWidthChange: h[5] || (h[5] = (w) => ke.value = w)
|
|
1726
|
+
}, null, 8, ["url"])) : F.value === "mobi" ? (c(), _(C(wo), {
|
|
1727
|
+
key: 7,
|
|
1728
|
+
ref_key: "mobiRef",
|
|
1729
|
+
ref: Fe,
|
|
1730
|
+
url: f.value.url,
|
|
1731
|
+
onChapterChange: rt,
|
|
1732
|
+
onFullWidthChange: h[6] || (h[6] = (w) => ze.value = w)
|
|
1733
|
+
}, null, 8, ["url"])) : F.value === "video" ? (c(), _(C(xo), {
|
|
1734
|
+
key: 8,
|
|
1735
|
+
url: f.value.url
|
|
1736
|
+
}, null, 8, ["url"])) : F.value === "audio" ? (c(), _(C(yo), {
|
|
1737
|
+
key: 9,
|
|
1738
|
+
url: f.value.url,
|
|
1739
|
+
"file-name": f.value.name
|
|
1740
|
+
}, null, 8, ["url", "file-name"])) : F.value === "markdown" ? (c(), _(C(ko), {
|
|
1741
|
+
key: 10,
|
|
1742
|
+
url: f.value.url,
|
|
1743
|
+
"view-mode": Q.value
|
|
1744
|
+
}, null, 8, ["url", "view-mode"])) : F.value === "json" ? (c(), _(C(Fo), {
|
|
1745
|
+
key: 11,
|
|
1746
|
+
url: f.value.url,
|
|
1747
|
+
"file-name": f.value.name
|
|
1748
|
+
}, null, 8, ["url", "file-name"])) : F.value === "csv" ? (c(), _(C(Co), {
|
|
1749
|
+
key: 12,
|
|
1750
|
+
url: f.value.url,
|
|
1751
|
+
"file-name": f.value.name
|
|
1752
|
+
}, null, 8, ["url", "file-name"])) : F.value === "xml" ? (c(), _(C(_o), {
|
|
1753
|
+
key: 13,
|
|
1754
|
+
url: f.value.url,
|
|
1755
|
+
"file-name": f.value.name
|
|
1756
|
+
}, null, 8, ["url", "file-name"])) : F.value === "subtitle" ? (c(), _(C(zo), {
|
|
1757
|
+
key: 14,
|
|
1758
|
+
url: f.value.url,
|
|
1759
|
+
"file-name": f.value.name
|
|
1760
|
+
}, null, 8, ["url", "file-name"])) : F.value === "zip" && o.zipNestingDepth >= Xo ? (c(), _(We, {
|
|
1761
|
+
key: 15,
|
|
1762
|
+
"file-name": f.value.name,
|
|
1763
|
+
"file-type": f.value.type,
|
|
1764
|
+
onDownload: ne
|
|
1765
|
+
}, null, 8, ["file-name", "file-type"])) : F.value === "zip" ? (c(), _(C(Mo), {
|
|
1766
|
+
key: 16,
|
|
1767
|
+
url: f.value.url,
|
|
1768
|
+
"nesting-depth": o.zipNestingDepth,
|
|
1769
|
+
onStatsChange: it
|
|
1770
|
+
}, null, 8, ["url", "nesting-depth"])) : F.value === "text" ? (c(), _(C(Ro), {
|
|
1771
|
+
key: 17,
|
|
1772
|
+
url: f.value.url,
|
|
1773
|
+
"file-name": f.value.name,
|
|
1774
|
+
"word-wrap": J.value,
|
|
1775
|
+
"html-preview": K.value
|
|
1776
|
+
}, null, 8, ["url", "file-name", "word-wrap", "html-preview"])) : (c(), _(We, {
|
|
1777
|
+
key: 18,
|
|
1778
|
+
"file-name": f.value.name,
|
|
1779
|
+
"file-type": f.value.type,
|
|
1780
|
+
onDownload: ne
|
|
1781
|
+
}, null, 8, ["file-name", "file-type"]))
|
|
1782
|
+
], 64))
|
|
1783
|
+
], 64)) : L("", !0)
|
|
1784
|
+
], 544),
|
|
1785
|
+
!e.headless && W.value.length > 1 ? (c(), g(R, { key: 1 }, [
|
|
1786
|
+
e.currentIndex > 0 ? (c(), g("button", {
|
|
1787
|
+
key: 0,
|
|
1788
|
+
style: ee({
|
|
1789
|
+
opacity: k.value ? 1 : 0,
|
|
1790
|
+
transform: k.value ? "translateY(-50%)" : "translateY(-50%) translateX(-20px)",
|
|
1791
|
+
pointerEvents: k.value ? "auto" : "none",
|
|
1792
|
+
transition: "opacity 0.2s, transform 0.2s"
|
|
1793
|
+
}),
|
|
1794
|
+
class: "vfp-absolute vfp-z-20 vfp-left-2 md:vfp-left-4 vfp-top-1/2 vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-rounded-full vfp-backdrop-blur-xl vfp-border vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors vfp-shadow-2xl vfp-bg-surface-nav vfp-border-line hover:vfp-bg-surface-nav-hover vfp-text-fg-primary",
|
|
1795
|
+
onClick: h[7] || (h[7] = (w) => a("navigate", e.currentIndex - 1)),
|
|
1796
|
+
onMouseenter: h[8] || (h[8] = (w) => k.value = !0)
|
|
1797
|
+
}, [
|
|
1798
|
+
G(C(de), { class: "vfp-w-5 vfp-h-5 md:vfp-w-6 md:vfp-h-6" })
|
|
1799
|
+
], 36)) : L("", !0),
|
|
1800
|
+
e.currentIndex < W.value.length - 1 ? (c(), g("button", {
|
|
1801
|
+
key: 1,
|
|
1802
|
+
style: ee({
|
|
1803
|
+
opacity: k.value ? 1 : 0,
|
|
1804
|
+
transform: k.value ? "translateY(-50%)" : "translateY(-50%) translateX(20px)",
|
|
1805
|
+
pointerEvents: k.value ? "auto" : "none",
|
|
1806
|
+
transition: "opacity 0.2s, transform 0.2s"
|
|
1807
|
+
}),
|
|
1808
|
+
class: "vfp-absolute vfp-z-20 vfp-right-2 md:vfp-right-4 vfp-top-1/2 vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-rounded-full vfp-backdrop-blur-xl vfp-border vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors vfp-shadow-2xl vfp-bg-surface-nav vfp-border-line hover:vfp-bg-surface-nav-hover vfp-text-fg-primary",
|
|
1809
|
+
onClick: h[9] || (h[9] = (w) => a("navigate", e.currentIndex + 1)),
|
|
1810
|
+
onMouseenter: h[10] || (h[10] = (w) => k.value = !0)
|
|
1811
|
+
}, [
|
|
1812
|
+
G(C(pe), { class: "vfp-w-5 vfp-h-5 md:vfp-w-6 md:vfp-h-6" })
|
|
1813
|
+
], 36)) : L("", !0)
|
|
1814
|
+
], 64)) : L("", !0)
|
|
1815
|
+
], 8, No);
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
}), Jo = (e, t) => {
|
|
1819
|
+
const o = e.__vccOpts || e;
|
|
1820
|
+
for (const [a, l] of t)
|
|
1821
|
+
o[a] = l;
|
|
1822
|
+
return o;
|
|
1823
|
+
}, me = /* @__PURE__ */ Jo(Yo, [["__scopeId", "data-v-45f93f85"]]), kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1824
|
+
__proto__: null,
|
|
1825
|
+
default: me
|
|
1826
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1827
|
+
function Ko(e) {
|
|
1828
|
+
let t = "", o = "", a = !1;
|
|
1829
|
+
const l = () => {
|
|
1830
|
+
if (a || typeof document > "u") return;
|
|
1831
|
+
t = document.body.style.overflow, o = document.body.style.paddingRight;
|
|
1832
|
+
const i = window.innerWidth - document.documentElement.clientWidth;
|
|
1833
|
+
document.body.style.overflow = "hidden", i > 0 && (document.body.style.paddingRight = `${i}px`), a = !0;
|
|
1834
|
+
}, n = () => {
|
|
1835
|
+
!a || typeof document > "u" || (document.body.style.overflow = t, document.body.style.paddingRight = o, a = !1);
|
|
1836
|
+
};
|
|
1837
|
+
return De(() => {
|
|
1838
|
+
e() && l();
|
|
1839
|
+
}), pt(() => {
|
|
1840
|
+
n();
|
|
1841
|
+
}), { lock: l, unlock: n };
|
|
1842
|
+
}
|
|
1843
|
+
const Qo = ["data-theme"], Fn = /* @__PURE__ */ X({
|
|
1844
|
+
__name: "FilePreviewModal",
|
|
1845
|
+
props: {
|
|
1846
|
+
files: {},
|
|
1847
|
+
currentIndex: {},
|
|
1848
|
+
isOpen: { type: Boolean },
|
|
1849
|
+
customRenderers: { default: () => [] },
|
|
1850
|
+
locale: { default: void 0 },
|
|
1851
|
+
messages: { default: void 0 },
|
|
1852
|
+
headless: { type: Boolean, default: !1 },
|
|
1853
|
+
theme: { default: "dark" }
|
|
1854
|
+
},
|
|
1855
|
+
emits: ["close", "navigate", "custom-event"],
|
|
1856
|
+
setup(e, { emit: t }) {
|
|
1857
|
+
const o = e, a = t, { lock: l, unlock: n } = Ko(() => o.isOpen);
|
|
1858
|
+
V(
|
|
1859
|
+
() => o.isOpen,
|
|
1860
|
+
(m) => {
|
|
1861
|
+
m ? l() : n();
|
|
1862
|
+
}
|
|
1863
|
+
);
|
|
1864
|
+
const i = z(
|
|
1865
|
+
typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
|
|
1866
|
+
);
|
|
1867
|
+
let s = null;
|
|
1868
|
+
V(
|
|
1869
|
+
() => o.theme,
|
|
1870
|
+
(m) => {
|
|
1871
|
+
if (s && (s(), s = null), m === "auto") {
|
|
1872
|
+
const p = window.matchMedia("(prefers-color-scheme: dark)"), y = (M) => {
|
|
1873
|
+
i.value = M.matches;
|
|
1874
|
+
};
|
|
1875
|
+
p.addEventListener("change", y), s = () => p.removeEventListener("change", y);
|
|
1876
|
+
}
|
|
1877
|
+
},
|
|
1878
|
+
{ immediate: !0 }
|
|
1879
|
+
), oe(() => {
|
|
1880
|
+
s && s();
|
|
1881
|
+
});
|
|
1882
|
+
const r = T(
|
|
1883
|
+
() => o.theme === "auto" ? i.value ? "dark" : "light" : o.theme
|
|
1884
|
+
), u = () => a("close"), d = (m) => m.stopPropagation(), v = (m) => m.stopPropagation();
|
|
1885
|
+
return (m, p) => (c(), _(ct, { to: "body" }, [
|
|
1886
|
+
G(ft, { name: "vfp-fade" }, {
|
|
1887
|
+
default: mt(() => [
|
|
1888
|
+
e.isOpen ? (c(), g("div", {
|
|
1889
|
+
key: 0,
|
|
1890
|
+
class: "vfp-root",
|
|
1891
|
+
"data-theme": r.value
|
|
1892
|
+
}, [
|
|
1893
|
+
E("div", {
|
|
1894
|
+
class: "vfp-fixed vfp-inset-0 vfp-z-[9999] vfp-flex vfp-items-center vfp-justify-center vfp-backdrop-blur-md vfp-overflow-hidden vfp-bg-surface-overlay",
|
|
1895
|
+
onClick: u,
|
|
1896
|
+
onWheel: v
|
|
1897
|
+
}, [
|
|
1898
|
+
E("div", {
|
|
1899
|
+
class: "vfp-relative vfp-w-full vfp-h-full",
|
|
1900
|
+
onClick: d
|
|
1901
|
+
}, [
|
|
1902
|
+
G(me, {
|
|
1903
|
+
mode: "modal",
|
|
1904
|
+
files: e.files,
|
|
1905
|
+
"current-index": e.currentIndex,
|
|
1906
|
+
"custom-renderers": e.customRenderers,
|
|
1907
|
+
locale: e.locale,
|
|
1908
|
+
messages: e.messages,
|
|
1909
|
+
headless: e.headless,
|
|
1910
|
+
theme: e.theme,
|
|
1911
|
+
onClose: p[0] || (p[0] = (y) => a("close")),
|
|
1912
|
+
onNavigate: p[1] || (p[1] = (y) => a("navigate", y)),
|
|
1913
|
+
onCustomEvent: p[2] || (p[2] = (y) => a("custom-event", y))
|
|
1914
|
+
}, null, 8, ["files", "current-index", "custom-renderers", "locale", "messages", "headless", "theme"])
|
|
1915
|
+
])
|
|
1916
|
+
], 32)
|
|
1917
|
+
], 8, Qo)) : L("", !0)
|
|
1918
|
+
]),
|
|
1919
|
+
_: 1
|
|
1920
|
+
})
|
|
1921
|
+
]));
|
|
1922
|
+
}
|
|
1923
|
+
}), en = ["data-theme"], tn = { class: "vfp-relative vfp-w-full vfp-h-full vfp-overflow-hidden vfp-bg-surface-overlay" }, Cn = /* @__PURE__ */ X({
|
|
1924
|
+
__name: "FilePreviewEmbed",
|
|
1925
|
+
props: {
|
|
1926
|
+
files: {},
|
|
1927
|
+
currentIndex: { default: 0 },
|
|
1928
|
+
customRenderers: { default: () => [] },
|
|
1929
|
+
width: { default: "100%" },
|
|
1930
|
+
height: { default: "100%" },
|
|
1931
|
+
locale: { default: void 0 },
|
|
1932
|
+
messages: { default: void 0 },
|
|
1933
|
+
headless: { type: Boolean, default: !1 },
|
|
1934
|
+
theme: { default: "dark" }
|
|
1935
|
+
},
|
|
1936
|
+
emits: ["navigate", "custom-event"],
|
|
1937
|
+
setup(e, { emit: t }) {
|
|
1938
|
+
const o = e, a = t, l = z(
|
|
1939
|
+
typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
|
|
1940
|
+
);
|
|
1941
|
+
let n = null;
|
|
1942
|
+
V(
|
|
1943
|
+
() => o.theme,
|
|
1944
|
+
(r) => {
|
|
1945
|
+
if (n && (n(), n = null), r === "auto") {
|
|
1946
|
+
const u = window.matchMedia("(prefers-color-scheme: dark)"), d = (v) => {
|
|
1947
|
+
l.value = v.matches;
|
|
1948
|
+
};
|
|
1949
|
+
u.addEventListener("change", d), n = () => u.removeEventListener("change", d);
|
|
1950
|
+
}
|
|
1951
|
+
},
|
|
1952
|
+
{ immediate: !0 }
|
|
1953
|
+
), oe(() => {
|
|
1954
|
+
n && n();
|
|
1955
|
+
});
|
|
1956
|
+
const i = T(
|
|
1957
|
+
() => o.theme === "auto" ? l.value ? "dark" : "light" : o.theme
|
|
1958
|
+
), s = {
|
|
1959
|
+
width: typeof o.width == "number" ? `${o.width}px` : o.width,
|
|
1960
|
+
height: typeof o.height == "number" ? `${o.height}px` : o.height
|
|
1961
|
+
};
|
|
1962
|
+
return (r, u) => (c(), g("div", {
|
|
1963
|
+
class: "vfp-root",
|
|
1964
|
+
style: s,
|
|
1965
|
+
"data-theme": i.value
|
|
1966
|
+
}, [
|
|
1967
|
+
E("div", tn, [
|
|
1968
|
+
G(me, {
|
|
1969
|
+
mode: "embed",
|
|
1970
|
+
files: e.files,
|
|
1971
|
+
"current-index": e.currentIndex,
|
|
1972
|
+
"custom-renderers": e.customRenderers,
|
|
1973
|
+
locale: e.locale,
|
|
1974
|
+
messages: e.messages,
|
|
1975
|
+
headless: e.headless,
|
|
1976
|
+
theme: e.theme,
|
|
1977
|
+
onNavigate: u[0] || (u[0] = (d) => a("navigate", d)),
|
|
1978
|
+
onCustomEvent: u[1] || (u[1] = (d) => a("custom-event", d))
|
|
1979
|
+
}, null, 8, ["files", "current-index", "custom-renderers", "locale", "messages", "headless", "theme"])
|
|
1980
|
+
])
|
|
1981
|
+
], 8, en));
|
|
1982
|
+
}
|
|
1983
|
+
}), _n = Ft.version;
|
|
1984
|
+
export {
|
|
1985
|
+
bn as C,
|
|
1986
|
+
mn as F,
|
|
1987
|
+
_t as I,
|
|
1988
|
+
Ye as L,
|
|
1989
|
+
qe as M,
|
|
1990
|
+
xn as S,
|
|
1991
|
+
_n as V,
|
|
1992
|
+
Jo as _,
|
|
1993
|
+
rn as a,
|
|
1994
|
+
yn as b,
|
|
1995
|
+
fn as c,
|
|
1996
|
+
Mt as d,
|
|
1997
|
+
le as e,
|
|
1998
|
+
sn as f,
|
|
1999
|
+
dn as g,
|
|
2000
|
+
pn as h,
|
|
2001
|
+
gn as i,
|
|
2002
|
+
ln as j,
|
|
2003
|
+
wn as k,
|
|
2004
|
+
me as l,
|
|
2005
|
+
un as m,
|
|
2006
|
+
Cn as n,
|
|
2007
|
+
Fn as o,
|
|
2008
|
+
Rt as p,
|
|
2009
|
+
zt as q,
|
|
2010
|
+
Yt as r,
|
|
2011
|
+
kn as s,
|
|
2012
|
+
fe as u,
|
|
2013
|
+
vn as v,
|
|
2014
|
+
hn as w,
|
|
2015
|
+
cn as x
|
|
2016
|
+
};
|
|
2017
|
+
//# sourceMappingURL=index-C324a7kV.mjs.map
|