@eternalheart/react-file-preview 1.3.10 → 1.3.11

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