@eternalheart/react-file-preview 1.0.1 → 1.0.2

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 (181) hide show
  1. package/README.md +69 -0
  2. package/README.zh-CN.md +69 -0
  3. package/lib/index.cjs +1 -1
  4. package/lib/index.cjs.map +1 -1
  5. package/lib/index.d.ts +3 -0
  6. package/lib/index.d.ts.map +1 -1
  7. package/lib/index.mjs +298 -287
  8. package/lib/index.mjs.map +1 -1
  9. package/lib/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  10. package/lib/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  11. package/lib/pdfjs/cmaps/78-H.bcmap +0 -0
  12. package/lib/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  13. package/lib/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  14. package/lib/pdfjs/cmaps/78-V.bcmap +0 -0
  15. package/lib/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  16. package/lib/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  17. package/lib/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  18. package/lib/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  19. package/lib/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  20. package/lib/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  21. package/lib/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  22. package/lib/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  23. package/lib/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  24. package/lib/pdfjs/cmaps/Add-H.bcmap +0 -0
  25. package/lib/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  26. package/lib/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  27. package/lib/pdfjs/cmaps/Add-V.bcmap +0 -0
  28. package/lib/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  29. package/lib/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  30. package/lib/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  31. package/lib/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  32. package/lib/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  33. package/lib/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  34. package/lib/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  35. package/lib/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  36. package/lib/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  37. package/lib/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  38. package/lib/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  39. package/lib/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  40. package/lib/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  41. package/lib/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  42. package/lib/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  43. package/lib/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  44. package/lib/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  45. package/lib/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  46. package/lib/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  47. package/lib/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  48. package/lib/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  49. package/lib/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  50. package/lib/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  51. package/lib/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  52. package/lib/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  53. package/lib/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  54. package/lib/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  55. package/lib/pdfjs/cmaps/B5-H.bcmap +0 -0
  56. package/lib/pdfjs/cmaps/B5-V.bcmap +0 -0
  57. package/lib/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  58. package/lib/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  59. package/lib/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  60. package/lib/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  61. package/lib/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  62. package/lib/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  63. package/lib/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  64. package/lib/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  65. package/lib/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  66. package/lib/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  67. package/lib/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  68. package/lib/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  69. package/lib/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  70. package/lib/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  71. package/lib/pdfjs/cmaps/EUC-H.bcmap +0 -0
  72. package/lib/pdfjs/cmaps/EUC-V.bcmap +0 -0
  73. package/lib/pdfjs/cmaps/Ext-H.bcmap +0 -0
  74. package/lib/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  75. package/lib/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  76. package/lib/pdfjs/cmaps/Ext-V.bcmap +0 -0
  77. package/lib/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  78. package/lib/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  79. package/lib/pdfjs/cmaps/GB-H.bcmap +4 -0
  80. package/lib/pdfjs/cmaps/GB-V.bcmap +0 -0
  81. package/lib/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  82. package/lib/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  83. package/lib/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  84. package/lib/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  85. package/lib/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  86. package/lib/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  87. package/lib/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  88. package/lib/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  89. package/lib/pdfjs/cmaps/GBT-H.bcmap +0 -0
  90. package/lib/pdfjs/cmaps/GBT-V.bcmap +0 -0
  91. package/lib/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  92. package/lib/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  93. package/lib/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  94. package/lib/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  95. package/lib/pdfjs/cmaps/H.bcmap +0 -0
  96. package/lib/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  97. package/lib/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  98. package/lib/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  99. package/lib/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  100. package/lib/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  101. package/lib/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  102. package/lib/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  103. package/lib/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  104. package/lib/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  105. package/lib/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  106. package/lib/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  107. package/lib/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  108. package/lib/pdfjs/cmaps/Hankaku.bcmap +0 -0
  109. package/lib/pdfjs/cmaps/Hiragana.bcmap +0 -0
  110. package/lib/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  111. package/lib/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  112. package/lib/pdfjs/cmaps/KSC-H.bcmap +0 -0
  113. package/lib/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  114. package/lib/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  115. package/lib/pdfjs/cmaps/KSC-V.bcmap +0 -0
  116. package/lib/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  117. package/lib/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  118. package/lib/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  119. package/lib/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  120. package/lib/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  121. package/lib/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  122. package/lib/pdfjs/cmaps/Katakana.bcmap +0 -0
  123. package/lib/pdfjs/cmaps/LICENSE +36 -0
  124. package/lib/pdfjs/cmaps/NWP-H.bcmap +0 -0
  125. package/lib/pdfjs/cmaps/NWP-V.bcmap +0 -0
  126. package/lib/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  127. package/lib/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  128. package/lib/pdfjs/cmaps/Roman.bcmap +0 -0
  129. package/lib/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  130. package/lib/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  131. package/lib/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  132. package/lib/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  133. package/lib/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  134. package/lib/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  135. package/lib/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  136. package/lib/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  137. package/lib/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  138. package/lib/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  139. package/lib/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  140. package/lib/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  141. package/lib/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  142. package/lib/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  143. package/lib/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  144. package/lib/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  145. package/lib/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  146. package/lib/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  147. package/lib/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  148. package/lib/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  149. package/lib/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  150. package/lib/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  151. package/lib/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  152. package/lib/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  153. package/lib/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  154. package/lib/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  155. package/lib/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  156. package/lib/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  157. package/lib/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  158. package/lib/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  159. package/lib/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  160. package/lib/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  161. package/lib/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  162. package/lib/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  163. package/lib/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  164. package/lib/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  165. package/lib/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  166. package/lib/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  167. package/lib/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  168. package/lib/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  169. package/lib/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  170. package/lib/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  171. package/lib/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  172. package/lib/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  173. package/lib/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  174. package/lib/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  175. package/lib/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  176. package/lib/pdfjs/cmaps/V.bcmap +0 -0
  177. package/lib/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  178. package/lib/pdfjs/pdf.worker.min.mjs +21 -0
  179. package/lib/utils/pdfConfig.d.ts +40 -0
  180. package/lib/utils/pdfConfig.d.ts.map +1 -1
  181. package/package.json +5 -2
package/lib/index.mjs CHANGED
@@ -1,28 +1,32 @@
1
- import { jsxs as f, jsx as e, Fragment as $ } from "react/jsx-runtime";
2
- import { useState as b, useRef as S, useEffect as M, useCallback as C, useMemo as U } from "react";
3
- import { createPortal as Y } from "react-dom";
4
- import { motion as B, AnimatePresence as K } from "framer-motion";
5
- import { Presentation as Q, Music as J, SkipBack as ee, Pause as te, Play as re, SkipForward as oe, VolumeX as ne, Volume2 as le, FileText as ae, FileQuestion as se, Download as Z, ZoomOut as ie, ZoomIn as ce, Minimize2 as de, Maximize2 as me, RotateCcw as ue, RotateCw as he, RefreshCw as pe, X as fe, ChevronLeft as xe, ChevronRight as we } from "lucide-react";
6
- import { pdfjs as H, Document as ge, Page as be } from "react-pdf";
7
- import ve from "mammoth";
1
+ import { jsxs as f, jsx as e, Fragment as W } from "react/jsx-runtime";
2
+ import { useState as b, useRef as P, useEffect as C, useCallback as M, useMemo as O } from "react";
3
+ import { createPortal as I } from "react-dom";
4
+ import { motion as H, AnimatePresence as Y } from "framer-motion";
5
+ import { Presentation as J, Music as K, SkipBack as Q, Pause as ee, Play as te, SkipForward as re, VolumeX as oe, Volume2 as ne, FileText as le, FileQuestion as ae, Download as q, ZoomOut as se, ZoomIn as ie, Minimize2 as ce, Maximize2 as de, RotateCcw as me, RotateCw as ue, RefreshCw as he, X as pe, ChevronLeft as fe, ChevronRight as xe } from "lucide-react";
6
+ import { pdfjs as B, Document as we, Page as ge } from "react-pdf";
7
+ import { pdfjs as nt } from "react-pdf";
8
+ import be from "mammoth";
8
9
  import * as V from "xlsx";
9
10
  import { init as X } from "pptx-preview";
10
- import ye from "video.js";
11
- import Ne from "react-markdown";
12
- import ke from "remark-gfm";
13
- import { Prism as _ } from "react-syntax-highlighter";
14
- function je(r) {
11
+ import ve from "video.js";
12
+ import ye from "react-markdown";
13
+ import Ne from "remark-gfm";
14
+ import { Prism as Z } from "react-syntax-highlighter";
15
+ const ke = "1.0.2", je = {
16
+ version: ke
17
+ };
18
+ function Me(t) {
15
19
  try {
16
- const i = new URL(r).pathname.split("/").pop() || "file";
17
- return decodeURIComponent(i);
20
+ const s = new URL(t).pathname.split("/").pop() || "file";
21
+ return decodeURIComponent(s);
18
22
  } catch {
19
- const t = r.split("/").pop() || "file";
20
- return decodeURIComponent(t);
23
+ const r = t.split("/").pop() || "file";
24
+ return decodeURIComponent(r);
21
25
  }
22
26
  }
23
- function A(r) {
24
- var i;
25
- const t = ((i = r.split(".").pop()) == null ? void 0 : i.toLowerCase()) || "";
27
+ function A(t) {
28
+ var s;
29
+ const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
26
30
  return {
27
31
  // 图片
28
32
  jpg: "image/jpeg",
@@ -79,75 +83,75 @@ function A(r) {
79
83
  rs: "text/x-rust",
80
84
  yaml: "text/yaml",
81
85
  yml: "text/yaml"
82
- }[t] || "application/octet-stream";
86
+ }[r] || "application/octet-stream";
83
87
  }
84
- function Ce(r, t = 0) {
85
- if (r instanceof File)
88
+ function Ce(t, r = 0) {
89
+ if (t instanceof File)
86
90
  return {
87
- id: `file-${Date.now()}-${t}`,
88
- name: r.name,
89
- url: URL.createObjectURL(r),
90
- type: r.type || A(r.name),
91
- size: r.size
91
+ id: `file-${Date.now()}-${r}`,
92
+ name: t.name,
93
+ url: URL.createObjectURL(t),
94
+ type: t.type || A(t.name),
95
+ size: t.size
92
96
  };
93
- if (typeof r == "string") {
94
- const n = je(r);
97
+ if (typeof t == "string") {
98
+ const n = Me(t);
95
99
  return {
96
- id: `url-${Date.now()}-${t}`,
100
+ id: `url-${Date.now()}-${r}`,
97
101
  name: n,
98
- url: r,
102
+ url: t,
99
103
  type: A(n)
100
104
  };
101
105
  }
102
106
  return {
103
- id: r.id || `link-${Date.now()}-${t}`,
104
- name: r.name,
105
- url: r.url,
106
- type: r.type || A(r.name),
107
- size: r.size
107
+ id: t.id || `link-${Date.now()}-${r}`,
108
+ name: t.name,
109
+ url: t.url,
110
+ type: t.type || A(t.name),
111
+ size: t.size
108
112
  };
109
113
  }
110
- function Me(r) {
111
- return r.map((t, n) => Ce(t, n));
114
+ function Te(t) {
115
+ return t.map((r, n) => Ce(r, n));
112
116
  }
113
- const Te = ({
114
- url: r,
115
- zoom: t,
117
+ const Le = ({
118
+ url: t,
119
+ zoom: r,
116
120
  rotation: n,
117
- onZoomChange: i
121
+ onZoomChange: s
118
122
  }) => {
119
- const [c, d] = b(!1), [s, o] = b(null), [a, w] = b({ x: 0, y: 0 }), [p, u] = b(!1), [v, h] = b({ x: 0, y: 0 }), [l, x] = b(1), m = S(null);
120
- M(() => {
123
+ const [c, d] = b(!1), [i, o] = b(null), [a, w] = b({ x: 0, y: 0 }), [p, u] = b(!1), [v, h] = b({ x: 0, y: 0 }), [l, x] = b(1), m = P(null);
124
+ C(() => {
121
125
  d(!1), o(null), w({ x: 0, y: 0 }), x(1);
122
- }, [r]), M(() => {
123
- x(t);
124
- }, [t]), M(() => {
126
+ }, [t]), C(() => {
127
+ x(r);
128
+ }, [r]), C(() => {
125
129
  w({ x: 0, y: 0 });
126
- }, [t, n]);
130
+ }, [r, n]);
127
131
  const k = () => {
128
132
  d(!0);
129
133
  }, T = () => {
130
134
  o("图片加载失败"), d(!0);
131
135
  }, L = () => {
132
136
  w({ x: 0, y: 0 });
133
- }, P = C((N) => {
137
+ }, R = M((N) => {
134
138
  N.preventDefault(), N.stopPropagation();
135
139
  const D = N.deltaY > 0 ? -0.1 : 0.1;
136
- x((R) => {
137
- const F = Math.max(0.5, Math.min(5, R + D));
138
- return i && i(F), F;
140
+ x((S) => {
141
+ const F = Math.max(0.5, Math.min(5, S + D));
142
+ return s && s(F), F;
139
143
  });
140
- }, [i]), z = C((N) => {
144
+ }, [s]), z = M((N) => {
141
145
  N.button === 0 && (u(!0), h({
142
146
  x: N.clientX - a.x,
143
147
  y: N.clientY - a.y
144
148
  }));
145
- }, [a]), g = C((N) => {
149
+ }, [a]), g = M((N) => {
146
150
  p && w({
147
151
  x: N.clientX - v.x,
148
152
  y: N.clientY - v.y
149
153
  });
150
- }, [p, v]), j = C(() => {
154
+ }, [p, v]), j = M(() => {
151
155
  u(!1);
152
156
  }, []);
153
157
  return /* @__PURE__ */ f(
@@ -155,19 +159,19 @@ const Te = ({
155
159
  {
156
160
  ref: m,
157
161
  className: "flex items-center justify-center w-full h-full overflow-hidden",
158
- onWheel: P,
162
+ onWheel: R,
159
163
  onMouseDown: z,
160
164
  onMouseMove: g,
161
165
  onMouseUp: j,
162
166
  onMouseLeave: j,
163
167
  style: { cursor: p ? "grabbing" : "grab" },
164
168
  children: [
165
- !c && !s && /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }),
166
- s && /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: s }) }),
169
+ !c && !i && /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }),
170
+ i && /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: i }) }),
167
171
  /* @__PURE__ */ e(
168
- B.img,
172
+ H.img,
169
173
  {
170
- src: r,
174
+ src: t,
171
175
  alt: "Preview",
172
176
  className: `max-w-none select-none ${c ? "" : "hidden"}`,
173
177
  style: {
@@ -187,43 +191,47 @@ const Te = ({
187
191
  ]
188
192
  }
189
193
  );
190
- }, Le = H.version, Se = "/pdf.worker.min.mjs";
191
- H.GlobalWorkerOptions.workerSrc = Se;
192
- const Pe = H.GlobalWorkerOptions.workerSrc, q = `https://unpkg.com/pdfjs-dist@${Le}/build/pdf.worker.min.mjs`;
193
- typeof window < "u" && window.addEventListener("error", (r) => {
194
- var t;
195
- (t = r.message) != null && t.includes("pdf.worker") && H.GlobalWorkerOptions.workerSrc === Pe && (console.warn("本地 PDF worker 加载失败,切换到 CDN:", q), H.GlobalWorkerOptions.workerSrc = q);
196
- });
194
+ };
195
+ function Pe(t) {
196
+ if (typeof window > "u") return;
197
+ const {
198
+ workerSrc: r = `https://unpkg.com/pdfjs-dist@${B.version}/build/pdf.worker.min.mjs`,
199
+ cMapUrl: n = `https://unpkg.com/pdfjs-dist@${B.version}/cmaps/`,
200
+ cMapPacked: s = !0
201
+ } = t || {};
202
+ B.GlobalWorkerOptions.workerSrc = r, B.GlobalWorkerOptions.cMapUrl = n, B.GlobalWorkerOptions.cMapPacked = s;
203
+ }
204
+ Pe();
197
205
  const Re = ({
198
- url: r,
199
- zoom: t,
206
+ url: t,
207
+ zoom: r,
200
208
  currentPage: n,
201
- onPageChange: i,
209
+ onPageChange: s,
202
210
  onTotalPagesChange: c
203
211
  }) => {
204
- const [d, s] = b(0), [o, a] = b(null), w = S(null), p = S(/* @__PURE__ */ new Map());
205
- M(() => {
212
+ const [d, i] = b(0), [o, a] = b(null), w = P(null), p = P(/* @__PURE__ */ new Map());
213
+ C(() => {
206
214
  a(null);
207
- }, [r]);
215
+ }, [t]);
208
216
  const u = ({ numPages: x }) => {
209
- s(x), c(x), i(1);
217
+ i(x), c(x), s(1);
210
218
  }, v = (x) => {
211
219
  console.error("PDF 加载错误:", x), a("PDF 文件加载失败");
212
- }, h = C(() => {
220
+ }, h = M(() => {
213
221
  if (!w.current) return;
214
222
  const x = w.current, m = x.scrollTop, k = x.clientHeight, T = m + k / 2;
215
- let L = 1, P = 1 / 0;
223
+ let L = 1, R = 1 / 0;
216
224
  p.current.forEach((z, g) => {
217
- const j = z.getBoundingClientRect(), N = x.getBoundingClientRect(), D = j.top - N.top + j.height / 2 + m, R = Math.abs(D - T);
218
- R < P && (P = R, L = g);
219
- }), L !== n && i(L);
220
- }, [n, i]);
221
- M(() => {
225
+ const j = z.getBoundingClientRect(), N = x.getBoundingClientRect(), D = j.top - N.top + j.height / 2 + m, S = Math.abs(D - T);
226
+ S < R && (R = S, L = g);
227
+ }), L !== n && s(L);
228
+ }, [n, s]);
229
+ C(() => {
222
230
  const x = w.current;
223
231
  if (x)
224
232
  return x.addEventListener("scroll", h), () => x.removeEventListener("scroll", h);
225
233
  }, [h]);
226
- const l = C((x, m) => {
234
+ const l = M((x, m) => {
227
235
  m ? p.current.set(x, m) : p.current.delete(x);
228
236
  }, []);
229
237
  return /* @__PURE__ */ f(
@@ -234,9 +242,9 @@ const Re = ({
234
242
  children: [
235
243
  o && /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: o }) }),
236
244
  !o && /* @__PURE__ */ e(
237
- ge,
245
+ we,
238
246
  {
239
- file: r,
247
+ file: t,
240
248
  onLoadSuccess: u,
241
249
  onLoadError: v,
242
250
  loading: /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }),
@@ -249,10 +257,10 @@ const Re = ({
249
257
  className: "relative",
250
258
  children: [
251
259
  /* @__PURE__ */ e(
252
- be,
260
+ ge,
253
261
  {
254
262
  pageNumber: k,
255
- scale: t,
263
+ scale: r,
256
264
  loading: /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-8 bg-white/5 rounded-lg min-h-[600px]", children: /* @__PURE__ */ e("div", { className: "w-8 h-8 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }),
257
265
  renderTextLayer: !0,
258
266
  renderAnnotationLayer: !0,
@@ -277,28 +285,28 @@ const Re = ({
277
285
  ]
278
286
  }
279
287
  );
280
- }, De = ({ url: r }) => {
281
- const [t, n] = b(""), [i, c] = b(!0), [d, s] = b(null);
282
- return M(() => {
288
+ }, Se = ({ url: t }) => {
289
+ const [r, n] = b(""), [s, c] = b(!0), [d, i] = b(null);
290
+ return C(() => {
283
291
  (async () => {
284
- c(!0), s(null), n("");
292
+ c(!0), i(null), n("");
285
293
  try {
286
- const a = await fetch(r);
294
+ const a = await fetch(t);
287
295
  if (!a.ok)
288
296
  throw new Error("文件加载失败");
289
- const w = await a.arrayBuffer(), p = await ve.convertToHtml({ arrayBuffer: w });
297
+ const w = await a.arrayBuffer(), p = await be.convertToHtml({ arrayBuffer: w });
290
298
  n(p.value);
291
299
  } catch (a) {
292
- console.error("Docx 解析错误:", a), s("Word 文档解析失败");
300
+ console.error("Docx 解析错误:", a), i("Word 文档解析失败");
293
301
  } finally {
294
302
  c(!1);
295
303
  }
296
304
  })();
297
- }, [r]), i ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: d }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ e(
305
+ }, [t]), s ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: d }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ e(
298
306
  "div",
299
307
  {
300
308
  className: "max-w-4xl mx-auto bg-white rounded-lg shadow-2xl p-12",
301
- dangerouslySetInnerHTML: { __html: t },
309
+ dangerouslySetInnerHTML: { __html: r },
302
310
  style: {
303
311
  fontFamily: "system-ui, -apple-system, sans-serif",
304
312
  lineHeight: "1.6",
@@ -306,13 +314,13 @@ const Re = ({
306
314
  }
307
315
  }
308
316
  ) });
309
- }, Ee = ({ url: r }) => {
310
- const [t, n] = b([]), [i, c] = b(0), [d, s] = b(!0), [o, a] = b(null);
311
- if (M(() => {
317
+ }, De = ({ url: t }) => {
318
+ const [r, n] = b([]), [s, c] = b(0), [d, i] = b(!0), [o, a] = b(null);
319
+ if (C(() => {
312
320
  (async () => {
313
- s(!0), a(null), n([]);
321
+ i(!0), a(null), n([]);
314
322
  try {
315
- const u = await fetch(r);
323
+ const u = await fetch(t);
316
324
  if (!u.ok)
317
325
  throw new Error("文件加载失败");
318
326
  const v = await u.arrayBuffer(), h = V.read(v, { type: "array" }), l = h.SheetNames.map((x) => {
@@ -323,20 +331,20 @@ const Re = ({
323
331
  } catch (u) {
324
332
  console.error("Excel 解析错误:", u), a("Excel 文件解析失败");
325
333
  } finally {
326
- s(!1);
334
+ i(!1);
327
335
  }
328
336
  })();
329
- }, [r]), d)
337
+ }, [t]), d)
330
338
  return /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) });
331
339
  if (o)
332
340
  return /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: o }) }) });
333
- const w = t[i];
341
+ const w = r[s];
334
342
  return /* @__PURE__ */ f("div", { className: "w-full h-full flex flex-col overflow-hidden", children: [
335
- t.length > 1 && /* @__PURE__ */ e("div", { className: "flex gap-2 p-4 bg-black/20 backdrop-blur-sm overflow-x-auto border-b border-white/10", children: t.map((p, u) => /* @__PURE__ */ e(
343
+ r.length > 1 && /* @__PURE__ */ e("div", { className: "flex gap-2 p-4 bg-black/20 backdrop-blur-sm overflow-x-auto border-b border-white/10", children: r.map((p, u) => /* @__PURE__ */ e(
336
344
  "button",
337
345
  {
338
346
  onClick: () => c(u),
339
- className: `px-4 py-2 rounded-lg text-sm font-medium transition-all ${i === u ? "bg-gradient-to-r from-purple-500 to-pink-500 text-white shadow-lg" : "bg-white/10 text-white hover:bg-white/20"}`,
347
+ className: `px-4 py-2 rounded-lg text-sm font-medium transition-all ${s === u ? "bg-gradient-to-r from-purple-500 to-pink-500 text-white shadow-lg" : "bg-white/10 text-white hover:bg-white/20"}`,
340
348
  children: p.name
341
349
  },
342
350
  u
@@ -357,18 +365,18 @@ const Re = ({
357
365
  u
358
366
  )) }) }) }) })
359
367
  ] });
360
- }, ze = ({ url: r }) => {
361
- const [t, n] = b(!0), [i, c] = b(null), d = S(null), s = S(null), o = S(null), a = S(null), w = S(null), p = S({ width: 0, height: 0 }), u = C(() => {
368
+ }, Ee = ({ url: t }) => {
369
+ const [r, n] = b(!0), [s, c] = b(null), d = P(null), i = P(null), o = P(null), a = P(null), w = P(null), p = P({ width: 0, height: 0 }), u = M(() => {
362
370
  if (!d.current) return { width: 960, height: 540 };
363
371
  const h = d.current.clientWidth, l = Math.floor(h * 9 / 16);
364
372
  return console.log("计算尺寸:", { width: h, height: l }), { width: h, height: l };
365
- }, []), v = C(async () => {
373
+ }, []), v = M(async () => {
366
374
  if (!(!d.current || !a.current)) {
367
375
  console.log("重新初始化预览器...");
368
376
  try {
369
- if (s.current)
377
+ if (i.current)
370
378
  try {
371
- s.current.destroy();
379
+ i.current.destroy();
372
380
  } catch (x) {
373
381
  console.error("销毁预览器失败:", x);
374
382
  }
@@ -379,13 +387,13 @@ const Re = ({
379
387
  width: h.width,
380
388
  height: h.height
381
389
  });
382
- s.current = l, await l.preview(a.current), console.log("重新初始化成功");
390
+ i.current = l, await l.preview(a.current), console.log("重新初始化成功");
383
391
  } catch (h) {
384
392
  console.error("重新初始化失败:", h);
385
393
  }
386
394
  }
387
395
  }, [u]);
388
- return M(() => {
396
+ return C(() => {
389
397
  if (!d.current) return;
390
398
  let h = !0;
391
399
  const l = () => {
@@ -405,7 +413,7 @@ const Re = ({
405
413
  new: x,
406
414
  diff: { width: k, height: T }
407
415
  }), p.current = x, w.current && clearTimeout(w.current), w.current = window.setTimeout(() => {
408
- s.current && a.current && (console.log("尺寸变化,准备重新初始化"), v());
416
+ i.current && a.current && (console.log("尺寸变化,准备重新初始化"), v());
409
417
  }, 800);
410
418
  };
411
419
  return o.current = new ResizeObserver(() => {
@@ -413,7 +421,7 @@ const Re = ({
413
421
  }), o.current.observe(d.current), () => {
414
422
  o.current && o.current.disconnect(), w.current && clearTimeout(w.current);
415
423
  };
416
- }, [u, v]), M(() => {
424
+ }, [u, v]), C(() => {
417
425
  let h = !0;
418
426
  const l = async () => {
419
427
  if (!d.current) {
@@ -422,8 +430,8 @@ const Re = ({
422
430
  }
423
431
  n(!0), c(null);
424
432
  try {
425
- console.log("开始加载 PPTX:", r);
426
- const m = await fetch(r);
433
+ console.log("开始加载 PPTX:", t);
434
+ const m = await fetch(t);
427
435
  if (!m.ok)
428
436
  throw new Error("文件加载失败");
429
437
  const k = await m.arrayBuffer();
@@ -435,10 +443,10 @@ const Re = ({
435
443
  width: T.width,
436
444
  height: T.height
437
445
  });
438
- s.current = L, console.log("开始预览..."), L.preview(k).then(() => {
446
+ i.current = L, console.log("开始预览..."), L.preview(k).then(() => {
439
447
  console.log("预览成功"), h && n(!1);
440
- }).catch((P) => {
441
- console.error("预览失败:", P), h && (c("PPT 文件预览失败"), n(!1));
448
+ }).catch((R) => {
449
+ console.error("预览失败:", R), h && (c("PPT 文件预览失败"), n(!1));
442
450
  });
443
451
  } catch (m) {
444
452
  console.error("PPTX 解析错误:", m), h && (c(m instanceof Error ? m.message : "PPT 文件解析失败"), n(!1));
@@ -447,27 +455,27 @@ const Re = ({
447
455
  l();
448
456
  }, 100);
449
457
  return () => {
450
- if (h = !1, clearTimeout(x), a.current = null, s.current)
458
+ if (h = !1, clearTimeout(x), a.current = null, i.current)
451
459
  try {
452
- s.current.destroy();
460
+ i.current.destroy();
453
461
  } catch (m) {
454
462
  console.error("销毁预览器失败:", m);
455
463
  }
456
- s.current = null;
464
+ i.current = null;
457
465
  };
458
- }, [r, u]), /* @__PURE__ */ f("div", { className: "relative flex flex-col items-center w-full h-full pt-[8px]", children: [
459
- t && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
466
+ }, [t, u]), /* @__PURE__ */ f("div", { className: "relative flex flex-col items-center w-full h-full pt-[8px]", children: [
467
+ r && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
460
468
  /* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-3 border-4 border-white/20 border-t-white rounded-full animate-spin" }),
461
469
  /* @__PURE__ */ e("p", { className: "text-sm text-white/70 font-medium", children: "加载 PPT 中..." })
462
470
  ] }) }),
463
- i && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl", children: /* @__PURE__ */ f("div", { className: "text-center max-w-md", children: [
464
- /* @__PURE__ */ e("div", { className: "w-32 h-32 mx-auto mb-6 rounded-3xl bg-gradient-to-br from-orange-500 via-red-500 to-pink-500 flex items-center justify-center shadow-2xl", children: /* @__PURE__ */ e(Q, { className: "w-16 h-16 text-white" }) }),
471
+ s && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl", children: /* @__PURE__ */ f("div", { className: "text-center max-w-md", children: [
472
+ /* @__PURE__ */ e("div", { className: "w-32 h-32 mx-auto mb-6 rounded-3xl bg-gradient-to-br from-orange-500 via-red-500 to-pink-500 flex items-center justify-center shadow-2xl", children: /* @__PURE__ */ e(J, { className: "w-16 h-16 text-white" }) }),
465
473
  /* @__PURE__ */ e("p", { className: "text-xl text-white/90 mb-3 font-medium", children: "PPT 预览" }),
466
- /* @__PURE__ */ e("p", { className: "text-sm text-white/60 mb-6", children: i || "浏览器暂不支持直接预览 PPT 文件" }),
474
+ /* @__PURE__ */ e("p", { className: "text-sm text-white/60 mb-6", children: s || "浏览器暂不支持直接预览 PPT 文件" }),
467
475
  /* @__PURE__ */ f(
468
476
  "a",
469
477
  {
470
- href: r,
478
+ href: t,
471
479
  download: !0,
472
480
  className: "inline-flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-purple-500 to-pink-500 text-white rounded-xl hover:scale-105 transition-all shadow-lg",
473
481
  children: [
@@ -486,9 +494,9 @@ const Re = ({
486
494
  }
487
495
  )
488
496
  ] });
489
- }, Fe = (r) => {
490
- var i;
491
- const t = ((i = r.split(".").pop()) == null ? void 0 : i.toLowerCase().split("?")[0]) || "";
497
+ }, ze = (t) => {
498
+ var s;
499
+ const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase().split("?")[0]) || "";
492
500
  return {
493
501
  mp4: "video/mp4",
494
502
  webm: "video/webm",
@@ -501,14 +509,14 @@ const Re = ({
501
509
  m4v: "video/mp4",
502
510
  "3gp": "video/3gpp",
503
511
  flv: "video/x-flv"
504
- }[t] || "video/mp4";
505
- }, We = ({ url: r }) => {
506
- const [t, n] = b(null), [i, c] = b(!0), d = S(null), s = S(null);
507
- return M(() => {
508
- if (!s.current && d.current) {
512
+ }[r] || "video/mp4";
513
+ }, Fe = ({ url: t }) => {
514
+ const [r, n] = b(null), [s, c] = b(!0), d = P(null), i = P(null);
515
+ return C(() => {
516
+ if (!i.current && d.current) {
509
517
  const o = document.createElement("video-js");
510
518
  o.classList.add("vjs-big-play-centered", "vjs-theme-apple"), d.current.appendChild(o);
511
- const a = Fe(r), p = ye(o, {
519
+ const a = ze(t), p = ve(o, {
512
520
  controls: !0,
513
521
  responsive: !0,
514
522
  fluid: !0,
@@ -537,29 +545,29 @@ const Re = ({
537
545
  nativeTextTracks: !1
538
546
  },
539
547
  sources: a === "video/quicktime" ? [
540
- { src: r, type: "video/quicktime" },
541
- { src: r, type: "video/mp4" }
548
+ { src: t, type: "video/quicktime" },
549
+ { src: t, type: "video/mp4" }
542
550
  // 备用方案
543
- ] : [{ src: r, type: a }]
551
+ ] : [{ src: t, type: a }]
544
552
  });
545
553
  p.on("loadeddata", () => {
546
554
  c(!1);
547
555
  }), p.on("error", () => {
548
556
  const u = p.error();
549
557
  console.error("Video.js error:", u), n(`视频加载失败: ${(u == null ? void 0 : u.message) || "未知错误"}`), c(!1);
550
- }), s.current = p;
558
+ }), i.current = p;
551
559
  }
552
- }, [r]), M(() => {
553
- const o = s.current;
560
+ }, [t]), C(() => {
561
+ const o = i.current;
554
562
  return () => {
555
- o && !o.isDisposed() && (o.dispose(), s.current = null);
563
+ o && !o.isDisposed() && (o.dispose(), i.current = null);
556
564
  };
557
- }, []), t ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
565
+ }, []), r ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
558
566
  /* @__PURE__ */ e("div", { className: "w-16 h-16 mx-auto mb-4 rounded-full bg-red-500/10 flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-8 h-8 text-red-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }) }),
559
567
  /* @__PURE__ */ e("p", { className: "text-lg font-medium text-white/90 mb-2", children: "视频加载失败" }),
560
- /* @__PURE__ */ e("p", { className: "text-sm text-white/60", children: t })
568
+ /* @__PURE__ */ e("p", { className: "text-sm text-white/60", children: r })
561
569
  ] }) }) : /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full p-8", children: /* @__PURE__ */ f("div", { className: "w-full max-w-5xl relative", children: [
562
- i && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/20 backdrop-blur-sm rounded-2xl z-10", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
570
+ s && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/20 backdrop-blur-sm rounded-2xl z-10", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
563
571
  /* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-3 border-3 border-white/20 border-t-white rounded-full animate-spin" }),
564
572
  /* @__PURE__ */ e("p", { className: "text-sm text-white/70 font-medium", children: "加载视频中..." })
565
573
  ] }) }),
@@ -574,18 +582,18 @@ const Re = ({
574
582
  }
575
583
  )
576
584
  ] }) });
577
- }, $e = ({ url: r, fileName: t }) => {
578
- const [n, i] = b(null), [c, d] = b(!1), [s, o] = b(0), [a, w] = b(0), [p, u] = b(1), [v, h] = b(!1), l = S(null);
579
- M(() => {
585
+ }, $e = ({ url: t, fileName: r }) => {
586
+ const [n, s] = b(null), [c, d] = b(!1), [i, o] = b(0), [a, w] = b(0), [p, u] = b(1), [v, h] = b(!1), l = P(null);
587
+ C(() => {
580
588
  const g = l.current;
581
589
  if (!g) return;
582
590
  const j = () => {
583
591
  isNaN(g.currentTime) || o(g.currentTime);
584
592
  }, N = () => {
585
593
  !isNaN(g.duration) && isFinite(g.duration) && w(g.duration);
586
- }, D = () => d(!1), R = () => N();
587
- return g.addEventListener("timeupdate", j), g.addEventListener("loadedmetadata", N), g.addEventListener("durationchange", N), g.addEventListener("canplay", R), g.addEventListener("ended", D), g.readyState >= 1 && N(), () => {
588
- g.removeEventListener("timeupdate", j), g.removeEventListener("loadedmetadata", N), g.removeEventListener("durationchange", N), g.removeEventListener("canplay", R), g.removeEventListener("ended", D);
594
+ }, D = () => d(!1), S = () => N();
595
+ return g.addEventListener("timeupdate", j), g.addEventListener("loadedmetadata", N), g.addEventListener("durationchange", N), g.addEventListener("canplay", S), g.addEventListener("ended", D), g.readyState >= 1 && N(), () => {
596
+ g.removeEventListener("timeupdate", j), g.removeEventListener("loadedmetadata", N), g.removeEventListener("durationchange", N), g.removeEventListener("canplay", S), g.removeEventListener("ended", D);
589
597
  };
590
598
  }, []);
591
599
  const x = () => {
@@ -600,17 +608,17 @@ const Re = ({
600
608
  l.current && (l.current.muted = !v, h(!v));
601
609
  }, L = (g) => {
602
610
  l.current && (l.current.currentTime += g);
603
- }, P = (g) => {
611
+ }, R = (g) => {
604
612
  if (!isFinite(g) || isNaN(g) || g < 0) return "0:00";
605
613
  const j = Math.floor(g / 60), N = Math.floor(g % 60);
606
614
  return `${j}:${N.toString().padStart(2, "0")}`;
607
615
  }, z = () => {
608
- i("音频加载失败");
616
+ s("音频加载失败");
609
617
  };
610
618
  return n ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: n }) }) }) : /* @__PURE__ */ f("div", { className: "flex flex-col items-center justify-center w-full h-full p-8 gap-8", children: [
611
- /* @__PURE__ */ e("div", { className: "w-64 h-64 rounded-3xl bg-gradient-to-br from-purple-500 via-pink-500 to-rose-500 flex items-center justify-center shadow-2xl backdrop-blur-xl", children: /* @__PURE__ */ e(J, { className: "w-32 h-32 text-white" }) }),
619
+ /* @__PURE__ */ e("div", { className: "w-64 h-64 rounded-3xl bg-gradient-to-br from-purple-500 via-pink-500 to-rose-500 flex items-center justify-center shadow-2xl backdrop-blur-xl", children: /* @__PURE__ */ e(K, { className: "w-32 h-32 text-white" }) }),
612
620
  /* @__PURE__ */ f("div", { className: "text-white text-center max-w-md", children: [
613
- /* @__PURE__ */ e("p", { className: "text-2xl font-medium mb-1", children: t }),
621
+ /* @__PURE__ */ e("p", { className: "text-2xl font-medium mb-1", children: r }),
614
622
  /* @__PURE__ */ e("p", { className: "text-sm text-white/60", children: "音频文件" })
615
623
  ] }),
616
624
  /* @__PURE__ */ f("div", { className: "w-full max-w-md bg-white/10 backdrop-blur-xl rounded-2xl p-6 border border-white/20", children: [
@@ -622,7 +630,7 @@ const Re = ({
622
630
  {
623
631
  className: "absolute h-[6px] bg-gradient-to-r from-purple-500 to-pink-500 rounded-full transition-all duration-100 ease-linear pointer-events-none",
624
632
  style: {
625
- width: `${a > 0 ? s / a * 100 : s > 100 ? 100 : s}%`
633
+ width: `${a > 0 ? i / a * 100 : i > 100 ? 100 : i}%`
626
634
  }
627
635
  }
628
636
  ),
@@ -631,16 +639,16 @@ const Re = ({
631
639
  {
632
640
  type: "range",
633
641
  min: "0",
634
- max: a > 0 ? a : 100 + (s > 100 ? s % 100 : 0),
635
- value: s,
642
+ max: a > 0 ? a : 100 + (i > 100 ? i % 100 : 0),
643
+ value: i,
636
644
  onChange: m,
637
645
  className: "audio-slider absolute w-full"
638
646
  }
639
647
  )
640
648
  ] }),
641
649
  /* @__PURE__ */ f("div", { className: "flex justify-between text-xs text-white/60 mt-3", children: [
642
- /* @__PURE__ */ e("span", { children: P(s) }),
643
- /* @__PURE__ */ e("span", { children: P(a) })
650
+ /* @__PURE__ */ e("span", { children: R(i) }),
651
+ /* @__PURE__ */ e("span", { children: R(a) })
644
652
  ] })
645
653
  ] }),
646
654
  /* @__PURE__ */ f("div", { className: "flex items-center justify-center gap-4 mb-4", children: [
@@ -649,7 +657,7 @@ const Re = ({
649
657
  {
650
658
  onClick: () => L(-10),
651
659
  className: "w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white transition-all",
652
- children: /* @__PURE__ */ e(ee, { className: "w-5 h-5" })
660
+ children: /* @__PURE__ */ e(Q, { className: "w-5 h-5" })
653
661
  }
654
662
  ),
655
663
  /* @__PURE__ */ e(
@@ -657,7 +665,7 @@ const Re = ({
657
665
  {
658
666
  onClick: x,
659
667
  className: "w-14 h-14 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 hover:scale-105 flex items-center justify-center text-white transition-all shadow-lg",
660
- children: c ? /* @__PURE__ */ e(te, { className: "w-6 h-6" }) : /* @__PURE__ */ e(re, { className: "w-6 h-6 ml-1" })
668
+ children: c ? /* @__PURE__ */ e(ee, { className: "w-6 h-6" }) : /* @__PURE__ */ e(te, { className: "w-6 h-6 ml-1" })
661
669
  }
662
670
  ),
663
671
  /* @__PURE__ */ e(
@@ -665,7 +673,7 @@ const Re = ({
665
673
  {
666
674
  onClick: () => L(10),
667
675
  className: "w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white transition-all",
668
- children: /* @__PURE__ */ e(oe, { className: "w-5 h-5" })
676
+ children: /* @__PURE__ */ e(re, { className: "w-5 h-5" })
669
677
  }
670
678
  )
671
679
  ] }),
@@ -675,7 +683,7 @@ const Re = ({
675
683
  {
676
684
  onClick: T,
677
685
  className: "text-white/80 hover:text-white transition-colors",
678
- children: v || p === 0 ? /* @__PURE__ */ e(ne, { className: "w-5 h-5" }) : /* @__PURE__ */ e(le, { className: "w-5 h-5" })
686
+ children: v || p === 0 ? /* @__PURE__ */ e(oe, { className: "w-5 h-5" }) : /* @__PURE__ */ e(ne, { className: "w-5 h-5" })
679
687
  }
680
688
  ),
681
689
  /* @__PURE__ */ f("div", { className: "flex-1 relative h-3 flex items-center", children: [
@@ -708,13 +716,13 @@ const Re = ({
708
716
  "audio",
709
717
  {
710
718
  ref: l,
711
- src: r,
719
+ src: t,
712
720
  onError: z,
713
721
  className: "hidden"
714
722
  }
715
723
  )
716
724
  ] });
717
- }, G = {
725
+ }, _ = {
718
726
  'pre[class*="language-"]': {
719
727
  color: "#d4d4d4",
720
728
  fontSize: "13px",
@@ -995,34 +1003,34 @@ const Re = ({
995
1003
  boxShadow: "inset 5px 0 0 #f7d87c",
996
1004
  zIndex: "0"
997
1005
  }
998
- }, Be = ({ url: r }) => {
999
- const [t, n] = b(""), [i, c] = b(!0), [d, s] = b(null);
1000
- return M(() => {
1006
+ }, We = ({ url: t }) => {
1007
+ const [r, n] = b(""), [s, c] = b(!0), [d, i] = b(null);
1008
+ return C(() => {
1001
1009
  (async () => {
1002
1010
  try {
1003
- c(!0), s(null);
1004
- const a = await fetch(r);
1011
+ c(!0), i(null);
1012
+ const a = await fetch(t);
1005
1013
  if (!a.ok)
1006
1014
  throw new Error("加载失败");
1007
1015
  const w = await a.text();
1008
1016
  n(w);
1009
1017
  } catch (a) {
1010
- s("Markdown 文件加载失败"), console.error(a);
1018
+ i("Markdown 文件加载失败"), console.error(a);
1011
1019
  } finally {
1012
1020
  c(!1);
1013
1021
  }
1014
1022
  })();
1015
- }, [r]), i ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: d }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ e("div", { className: "max-w-4xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl p-8 border border-white/10", children: /* @__PURE__ */ e("div", { className: "prose prose-invert prose-lg max-w-none", children: /* @__PURE__ */ e(
1016
- Ne,
1023
+ }, [t]), s ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: d }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ e("div", { className: "max-w-4xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl p-8 border border-white/10", children: /* @__PURE__ */ e("div", { className: "prose prose-invert prose-lg max-w-none", children: /* @__PURE__ */ e(
1024
+ ye,
1017
1025
  {
1018
- remarkPlugins: [ke],
1026
+ remarkPlugins: [Ne],
1019
1027
  components: {
1020
1028
  code({ node: o, inline: a, className: w, children: p, ...u }) {
1021
1029
  const v = /language-(\w+)/.exec(w || "");
1022
1030
  return !a && v ? /* @__PURE__ */ e(
1023
- _,
1031
+ Z,
1024
1032
  {
1025
- style: G,
1033
+ style: _,
1026
1034
  language: v[1],
1027
1035
  PreTag: "div",
1028
1036
  className: "rounded-lg",
@@ -1055,12 +1063,12 @@ const Re = ({
1055
1063
  hr: () => /* @__PURE__ */ e("hr", { className: "border-white/20 my-6" }),
1056
1064
  img: ({ src: o, alt: a }) => /* @__PURE__ */ e("img", { src: o, alt: a, className: "rounded-lg max-w-full h-auto my-4" })
1057
1065
  },
1058
- children: t
1066
+ children: r
1059
1067
  }
1060
1068
  ) }) }) });
1061
- }, He = (r) => {
1062
- var i;
1063
- const t = ((i = r.split(".").pop()) == null ? void 0 : i.toLowerCase()) || "";
1069
+ }, Be = (t) => {
1070
+ var s;
1071
+ const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
1064
1072
  return {
1065
1073
  js: "javascript",
1066
1074
  jsx: "jsx",
@@ -1096,35 +1104,35 @@ const Re = ({
1096
1104
  conf: "nginx",
1097
1105
  md: "markdown",
1098
1106
  txt: "text"
1099
- }[t] || "text";
1100
- }, Ae = ({ url: r, fileName: t }) => {
1101
- const [n, i] = b(""), [c, d] = b(!0), [s, o] = b(null), a = He(t);
1102
- return M(() => {
1107
+ }[r] || "text";
1108
+ }, He = ({ url: t, fileName: r }) => {
1109
+ const [n, s] = b(""), [c, d] = b(!0), [i, o] = b(null), a = Be(r);
1110
+ return C(() => {
1103
1111
  (async () => {
1104
1112
  try {
1105
1113
  d(!0), o(null);
1106
- const p = await fetch(r);
1114
+ const p = await fetch(t);
1107
1115
  if (!p.ok)
1108
1116
  throw new Error("加载失败");
1109
1117
  const u = await p.text();
1110
- i(u);
1118
+ s(u);
1111
1119
  } catch (p) {
1112
1120
  o("文本文件加载失败"), console.error(p);
1113
1121
  } finally {
1114
1122
  d(!1);
1115
1123
  }
1116
1124
  })();
1117
- }, [r]), c ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : s ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: s }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ f("div", { className: "max-w-6xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl border border-white/10 overflow-hidden", children: [
1125
+ }, [t]), c ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : i ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: i }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ f("div", { className: "max-w-6xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl border border-white/10 overflow-hidden", children: [
1118
1126
  /* @__PURE__ */ f("div", { className: "flex items-center gap-3 px-6 py-4 bg-white/5 border-b border-white/10", children: [
1119
- /* @__PURE__ */ e(ae, { className: "w-5 h-5 text-white/70" }),
1120
- /* @__PURE__ */ e("span", { className: "text-white font-medium", children: t }),
1127
+ /* @__PURE__ */ e(le, { className: "w-5 h-5 text-white/70" }),
1128
+ /* @__PURE__ */ e("span", { className: "text-white font-medium", children: r }),
1121
1129
  /* @__PURE__ */ e("span", { className: "ml-auto text-xs text-white/50 uppercase", children: a })
1122
1130
  ] }),
1123
1131
  /* @__PURE__ */ e("div", { className: "text-sm", children: a === "text" ? /* @__PURE__ */ e("pre", { className: "p-6 text-white/90 font-mono whitespace-pre-wrap break-words", children: n }) : /* @__PURE__ */ e(
1124
- _,
1132
+ Z,
1125
1133
  {
1126
1134
  language: a,
1127
- style: G,
1135
+ style: _,
1128
1136
  showLineNumbers: !0,
1129
1137
  customStyle: {
1130
1138
  margin: 0,
@@ -1142,17 +1150,17 @@ const Re = ({
1142
1150
  }
1143
1151
  ) })
1144
1152
  ] }) });
1145
- }, Oe = ({
1146
- fileName: r,
1147
- fileType: t,
1153
+ }, Ae = ({
1154
+ fileName: t,
1155
+ fileType: r,
1148
1156
  onDownload: n
1149
1157
  }) => /* @__PURE__ */ f("div", { className: "flex flex-col items-center justify-center w-full h-full p-8 gap-6", children: [
1150
- /* @__PURE__ */ e("div", { className: "w-32 h-32 rounded-full bg-white/10 flex items-center justify-center", children: /* @__PURE__ */ e(se, { className: "w-16 h-16 text-white/70" }) }),
1158
+ /* @__PURE__ */ e("div", { className: "w-32 h-32 rounded-full bg-white/10 flex items-center justify-center", children: /* @__PURE__ */ e(ae, { className: "w-16 h-16 text-white/70" }) }),
1151
1159
  /* @__PURE__ */ f("div", { className: "text-white text-center", children: [
1152
- /* @__PURE__ */ e("p", { className: "text-xl font-medium mb-2", children: r }),
1160
+ /* @__PURE__ */ e("p", { className: "text-xl font-medium mb-2", children: t }),
1153
1161
  /* @__PURE__ */ f("p", { className: "text-white/70", children: [
1154
1162
  "不支持预览此文件类型 (",
1155
- t,
1163
+ r,
1156
1164
  ")"
1157
1165
  ] })
1158
1166
  ] }),
@@ -1162,31 +1170,31 @@ const Re = ({
1162
1170
  onClick: n,
1163
1171
  className: "flex items-center gap-2 px-6 py-3 bg-white/10 hover:bg-white/20 backdrop-blur-sm rounded-lg text-white font-medium transition-all",
1164
1172
  children: [
1165
- /* @__PURE__ */ e(Z, { className: "w-5 h-5" }),
1173
+ /* @__PURE__ */ e(q, { className: "w-5 h-5" }),
1166
1174
  "下载文件查看"
1167
1175
  ]
1168
1176
  }
1169
1177
  )
1170
- ] }), Ue = (r) => {
1178
+ ] }), Ue = (t) => {
1171
1179
  var c;
1172
- const t = ((c = r.name.split(".").pop()) == null ? void 0 : c.toLowerCase()) || "", n = r.type.toLowerCase();
1173
- if (n.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(t))
1180
+ const r = ((c = t.name.split(".").pop()) == null ? void 0 : c.toLowerCase()) || "", n = t.type.toLowerCase();
1181
+ if (n.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(r))
1174
1182
  return "image";
1175
- if (n.includes("pdf") || t === "pdf")
1183
+ if (n.includes("pdf") || r === "pdf")
1176
1184
  return "pdf";
1177
- if (n.includes("wordprocessingml") || t === "docx")
1185
+ if (n.includes("wordprocessingml") || r === "docx")
1178
1186
  return "docx";
1179
- if (n.includes("spreadsheetml") || t === "xlsx")
1187
+ if (n.includes("spreadsheetml") || r === "xlsx")
1180
1188
  return "xlsx";
1181
- if (n.includes("presentationml") || t === "pptx" || t === "ppt")
1189
+ if (n.includes("presentationml") || r === "pptx" || r === "ppt")
1182
1190
  return "pptx";
1183
- if (n.startsWith("video/") || ["mp4", "webm", "ogg", "ogv", "mov", "avi", "mkv", "m4v", "3gp", "flv"].includes(t))
1191
+ if (n.startsWith("video/") || ["mp4", "webm", "ogg", "ogv", "mov", "avi", "mkv", "m4v", "3gp", "flv"].includes(r))
1184
1192
  return "video";
1185
- if (n.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac", "aac"].includes(t))
1193
+ if (n.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac", "aac"].includes(r))
1186
1194
  return "audio";
1187
- if (t === "md" || t === "markdown")
1195
+ if (r === "md" || r === "markdown")
1188
1196
  return "markdown";
1189
- const i = [
1197
+ const s = [
1190
1198
  "txt",
1191
1199
  "log",
1192
1200
  "csv",
@@ -1223,62 +1231,62 @@ const Re = ({
1223
1231
  "zsh",
1224
1232
  "sql"
1225
1233
  ];
1226
- return n.startsWith("text/") || i.includes(t) ? "text" : "unsupported";
1227
- }, tt = ({
1228
- files: r,
1229
- currentIndex: t,
1234
+ return n.startsWith("text/") || s.includes(r) ? "text" : "unsupported";
1235
+ }, et = ({
1236
+ files: t,
1237
+ currentIndex: r,
1230
1238
  isOpen: n,
1231
- onClose: i,
1239
+ onClose: s,
1232
1240
  onNavigate: c,
1233
1241
  customRenderers: d = []
1234
1242
  }) => {
1235
- const [s, o] = b(1), [a, w] = b(0), [p, u] = b(1), [, v] = b(1), h = U(() => Me(r), [r]), l = h[t], x = U(() => l ? d.find((y) => y.test(l)) : null, [l, d]), m = l ? Ue(l) : "unsupported";
1236
- M(() => {
1243
+ const [i, o] = b(1), [a, w] = b(0), [p, u] = b(1), [, v] = b(1), h = O(() => Te(t), [t]), l = h[r], x = O(() => l ? d.find((y) => y.test(l)) : null, [l, d]), m = l ? Ue(l) : "unsupported";
1244
+ C(() => {
1237
1245
  o(1), w(0), u(1), v(1);
1238
- }, [t]), M(() => {
1246
+ }, [r]), C(() => {
1239
1247
  if (n) {
1240
- const y = document.body.style.overflow, W = document.body.style.paddingRight, O = window.innerWidth - document.documentElement.clientWidth;
1241
- return document.body.style.overflow = "hidden", O > 0 && (document.body.style.paddingRight = `${O}px`), () => {
1242
- document.body.style.overflow = y, document.body.style.paddingRight = W;
1248
+ const y = document.body.style.overflow, $ = document.body.style.paddingRight, U = window.innerWidth - document.documentElement.clientWidth;
1249
+ return document.body.style.overflow = "hidden", U > 0 && (document.body.style.paddingRight = `${U}px`), () => {
1250
+ document.body.style.overflow = y, document.body.style.paddingRight = $;
1243
1251
  };
1244
1252
  }
1245
- }, [n]), M(() => {
1253
+ }, [n]), C(() => {
1246
1254
  if (!n) return;
1247
- const y = (W) => {
1248
- W.key === "Escape" ? i() : W.key === "ArrowLeft" && t > 0 ? c == null || c(t - 1) : W.key === "ArrowRight" && t < h.length - 1 && (c == null || c(t + 1));
1255
+ const y = ($) => {
1256
+ $.key === "Escape" ? s() : $.key === "ArrowLeft" && r > 0 ? c == null || c(r - 1) : $.key === "ArrowRight" && r < h.length - 1 && (c == null || c(r + 1));
1249
1257
  };
1250
1258
  return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
1251
- }, [n, t, h.length, i, c]);
1252
- const k = C(() => {
1259
+ }, [n, r, h.length, s, c]);
1260
+ const k = M(() => {
1253
1261
  o((y) => Math.min(y + 0.25, 5));
1254
- }, []), T = C(() => {
1262
+ }, []), T = M(() => {
1255
1263
  o((y) => Math.max(y - 0.25, 0.5));
1256
- }, []), L = C(() => {
1264
+ }, []), L = M(() => {
1257
1265
  w((y) => y + 90);
1258
- }, []), P = C(() => {
1266
+ }, []), R = M(() => {
1259
1267
  w((y) => y - 90);
1260
- }, []), z = C(() => {
1268
+ }, []), z = M(() => {
1261
1269
  o(1), w(0);
1262
- }, []), g = C(() => {
1270
+ }, []), g = M(() => {
1263
1271
  o(1);
1264
- }, []), j = C((y) => {
1272
+ }, []), j = M((y) => {
1265
1273
  o(y);
1266
- }, []), N = C(() => {
1274
+ }, []), N = M(() => {
1267
1275
  o(1), w(0);
1268
- }, []), D = C(() => {
1276
+ }, []), D = M(() => {
1269
1277
  if (!l) return;
1270
1278
  const y = document.createElement("a");
1271
1279
  y.href = l.url, y.download = l.name, y.click();
1272
1280
  }, [l]);
1273
1281
  if (!n || !l) return null;
1274
- const R = m === "image" || m === "pdf", F = m === "image", I = /* @__PURE__ */ e(K, { children: n && /* @__PURE__ */ e(
1275
- B.div,
1282
+ const S = m === "image" || m === "pdf", F = m === "image", G = /* @__PURE__ */ e(Y, { children: n && /* @__PURE__ */ e(
1283
+ H.div,
1276
1284
  {
1277
1285
  initial: { opacity: 0 },
1278
1286
  animate: { opacity: 1 },
1279
1287
  exit: { opacity: 0 },
1280
1288
  className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-md overflow-hidden",
1281
- onClick: i,
1289
+ onClick: s,
1282
1290
  onWheel: (y) => y.stopPropagation(),
1283
1291
  children: /* @__PURE__ */ f(
1284
1292
  "div",
@@ -1287,7 +1295,7 @@ const Re = ({
1287
1295
  onClick: (y) => y.stopPropagation(),
1288
1296
  children: [
1289
1297
  /* @__PURE__ */ e(
1290
- B.div,
1298
+ H.div,
1291
1299
  {
1292
1300
  initial: { y: -100 },
1293
1301
  animate: { y: 0 },
@@ -1297,40 +1305,40 @@ const Re = ({
1297
1305
  /* @__PURE__ */ f("div", { className: "flex-1 min-w-0", children: [
1298
1306
  /* @__PURE__ */ e("h2", { className: "text-white font-medium text-lg truncate", children: l.name }),
1299
1307
  /* @__PURE__ */ f("p", { className: "text-white/60 text-sm", children: [
1300
- t + 1,
1308
+ r + 1,
1301
1309
  " / ",
1302
1310
  h.length
1303
1311
  ] })
1304
1312
  ] }),
1305
1313
  /* @__PURE__ */ f("div", { className: "flex items-center gap-2 ml-4", children: [
1306
- R && /* @__PURE__ */ f($, { children: [
1314
+ S && /* @__PURE__ */ f(W, { children: [
1307
1315
  /* @__PURE__ */ e(
1308
1316
  E,
1309
1317
  {
1310
- icon: /* @__PURE__ */ e(ie, { className: "w-5 h-5" }),
1318
+ icon: /* @__PURE__ */ e(se, { className: "w-5 h-5" }),
1311
1319
  label: "缩小",
1312
1320
  onClick: T,
1313
- disabled: s <= 0.5
1321
+ disabled: i <= 0.5
1314
1322
  }
1315
1323
  ),
1316
1324
  /* @__PURE__ */ f("span", { className: "text-white/70 text-sm min-w-[4rem] text-center font-medium", children: [
1317
- Math.round(s * 100),
1325
+ Math.round(i * 100),
1318
1326
  "%"
1319
1327
  ] }),
1320
1328
  /* @__PURE__ */ e(
1321
1329
  E,
1322
1330
  {
1323
- icon: /* @__PURE__ */ e(ce, { className: "w-5 h-5" }),
1331
+ icon: /* @__PURE__ */ e(ie, { className: "w-5 h-5" }),
1324
1332
  label: "放大",
1325
1333
  onClick: k,
1326
- disabled: s >= 5
1334
+ disabled: i >= 5
1327
1335
  }
1328
1336
  ),
1329
1337
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/20 mx-2" }),
1330
1338
  /* @__PURE__ */ e(
1331
1339
  E,
1332
1340
  {
1333
- icon: /* @__PURE__ */ e(de, { className: "w-5 h-5" }),
1341
+ icon: /* @__PURE__ */ e(ce, { className: "w-5 h-5" }),
1334
1342
  label: "适应窗口",
1335
1343
  onClick: z
1336
1344
  }
@@ -1338,37 +1346,37 @@ const Re = ({
1338
1346
  /* @__PURE__ */ e(
1339
1347
  E,
1340
1348
  {
1341
- icon: /* @__PURE__ */ e(me, { className: "w-5 h-5" }),
1349
+ icon: /* @__PURE__ */ e(de, { className: "w-5 h-5" }),
1342
1350
  label: "原始尺寸",
1343
1351
  onClick: g
1344
1352
  }
1345
1353
  ),
1346
1354
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/20 mx-2" })
1347
1355
  ] }),
1348
- F && /* @__PURE__ */ f($, { children: [
1356
+ F && /* @__PURE__ */ f(W, { children: [
1349
1357
  /* @__PURE__ */ e(
1350
1358
  E,
1351
1359
  {
1352
- icon: /* @__PURE__ */ e(ue, { className: "w-5 h-5" }),
1360
+ icon: /* @__PURE__ */ e(me, { className: "w-5 h-5" }),
1353
1361
  label: "向左旋转",
1354
- onClick: P
1362
+ onClick: R
1355
1363
  }
1356
1364
  ),
1357
1365
  /* @__PURE__ */ e(
1358
1366
  E,
1359
1367
  {
1360
- icon: /* @__PURE__ */ e(he, { className: "w-5 h-5" }),
1368
+ icon: /* @__PURE__ */ e(ue, { className: "w-5 h-5" }),
1361
1369
  label: "向右旋转",
1362
1370
  onClick: L
1363
1371
  }
1364
1372
  ),
1365
1373
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/20 mx-2" })
1366
1374
  ] }),
1367
- (R || F) && /* @__PURE__ */ f($, { children: [
1375
+ (S || F) && /* @__PURE__ */ f(W, { children: [
1368
1376
  /* @__PURE__ */ e(
1369
1377
  E,
1370
1378
  {
1371
- icon: /* @__PURE__ */ e(pe, { className: "w-5 h-5" }),
1379
+ icon: /* @__PURE__ */ e(he, { className: "w-5 h-5" }),
1372
1380
  label: "复原",
1373
1381
  onClick: N
1374
1382
  }
@@ -1378,7 +1386,7 @@ const Re = ({
1378
1386
  /* @__PURE__ */ e(
1379
1387
  E,
1380
1388
  {
1381
- icon: /* @__PURE__ */ e(Z, { className: "w-5 h-5" }),
1389
+ icon: /* @__PURE__ */ e(q, { className: "w-5 h-5" }),
1382
1390
  label: "下载",
1383
1391
  onClick: D
1384
1392
  }
@@ -1387,9 +1395,9 @@ const Re = ({
1387
1395
  /* @__PURE__ */ e(
1388
1396
  E,
1389
1397
  {
1390
- icon: /* @__PURE__ */ e(fe, { className: "w-5 h-5" }),
1398
+ icon: /* @__PURE__ */ e(pe, { className: "w-5 h-5" }),
1391
1399
  label: "关闭",
1392
- onClick: i
1400
+ onClick: s
1393
1401
  }
1394
1402
  )
1395
1403
  ] })
@@ -1399,12 +1407,12 @@ const Re = ({
1399
1407
  /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center pt-24 pb-8 overflow-auto", children: x ? (
1400
1408
  // 使用自定义渲染器
1401
1409
  x.render(l)
1402
- ) : /* @__PURE__ */ f($, { children: [
1410
+ ) : /* @__PURE__ */ f(W, { children: [
1403
1411
  m === "image" && /* @__PURE__ */ e(
1404
- Te,
1412
+ Le,
1405
1413
  {
1406
1414
  url: l.url,
1407
- zoom: s,
1415
+ zoom: i,
1408
1416
  rotation: a,
1409
1417
  onZoomChange: j
1410
1418
  }
@@ -1413,21 +1421,21 @@ const Re = ({
1413
1421
  Re,
1414
1422
  {
1415
1423
  url: l.url,
1416
- zoom: s,
1424
+ zoom: i,
1417
1425
  currentPage: p,
1418
1426
  onPageChange: u,
1419
1427
  onTotalPagesChange: v
1420
1428
  }
1421
1429
  ),
1422
- m === "docx" && /* @__PURE__ */ e(De, { url: l.url }),
1423
- m === "xlsx" && /* @__PURE__ */ e(Ee, { url: l.url }),
1424
- m === "pptx" && /* @__PURE__ */ e(ze, { url: l.url }),
1425
- m === "video" && /* @__PURE__ */ e(We, { url: l.url }),
1430
+ m === "docx" && /* @__PURE__ */ e(Se, { url: l.url }),
1431
+ m === "xlsx" && /* @__PURE__ */ e(De, { url: l.url }),
1432
+ m === "pptx" && /* @__PURE__ */ e(Ee, { url: l.url }),
1433
+ m === "video" && /* @__PURE__ */ e(Fe, { url: l.url }),
1426
1434
  m === "audio" && /* @__PURE__ */ e($e, { url: l.url, fileName: l.name }),
1427
- m === "markdown" && /* @__PURE__ */ e(Be, { url: l.url }),
1428
- m === "text" && /* @__PURE__ */ e(Ae, { url: l.url, fileName: l.name }),
1435
+ m === "markdown" && /* @__PURE__ */ e(We, { url: l.url }),
1436
+ m === "text" && /* @__PURE__ */ e(He, { url: l.url, fileName: l.name }),
1429
1437
  m === "unsupported" && /* @__PURE__ */ e(
1430
- Oe,
1438
+ Ae,
1431
1439
  {
1432
1440
  fileName: l.name,
1433
1441
  fileType: l.type,
@@ -1435,27 +1443,27 @@ const Re = ({
1435
1443
  }
1436
1444
  )
1437
1445
  ] }) }),
1438
- h.length > 1 && /* @__PURE__ */ f($, { children: [
1439
- t > 0 && /* @__PURE__ */ e(
1440
- B.button,
1446
+ h.length > 1 && /* @__PURE__ */ f(W, { children: [
1447
+ r > 0 && /* @__PURE__ */ e(
1448
+ H.button,
1441
1449
  {
1442
1450
  initial: { x: -100, opacity: 0 },
1443
1451
  animate: { x: 0, opacity: 1 },
1444
1452
  exit: { x: -100, opacity: 0 },
1445
- onClick: () => c == null ? void 0 : c(t - 1),
1453
+ onClick: () => c == null ? void 0 : c(r - 1),
1446
1454
  className: "absolute left-4 top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-black/40 backdrop-blur-xl border border-white/10 flex items-center justify-center text-white hover:bg-black/60 transition-all shadow-2xl",
1447
- children: /* @__PURE__ */ e(xe, { className: "w-6 h-6" })
1455
+ children: /* @__PURE__ */ e(fe, { className: "w-6 h-6" })
1448
1456
  }
1449
1457
  ),
1450
- t < h.length - 1 && /* @__PURE__ */ e(
1451
- B.button,
1458
+ r < h.length - 1 && /* @__PURE__ */ e(
1459
+ H.button,
1452
1460
  {
1453
1461
  initial: { x: 100, opacity: 0 },
1454
1462
  animate: { x: 0, opacity: 1 },
1455
1463
  exit: { x: 100, opacity: 0 },
1456
- onClick: () => c == null ? void 0 : c(t + 1),
1464
+ onClick: () => c == null ? void 0 : c(r + 1),
1457
1465
  className: "absolute right-4 top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-black/40 backdrop-blur-xl border border-white/10 flex items-center justify-center text-white hover:bg-black/60 transition-all shadow-2xl",
1458
- children: /* @__PURE__ */ e(we, { className: "w-6 h-6" })
1466
+ children: /* @__PURE__ */ e(xe, { className: "w-6 h-6" })
1459
1467
  }
1460
1468
  )
1461
1469
  ] })
@@ -1464,20 +1472,23 @@ const Re = ({
1464
1472
  )
1465
1473
  }
1466
1474
  ) });
1467
- return Y(I, document.body);
1468
- }, E = ({ icon: r, label: t, onClick: n, disabled: i }) => /* @__PURE__ */ e(
1475
+ return I(G, document.body);
1476
+ }, E = ({ icon: t, label: r, onClick: n, disabled: s }) => /* @__PURE__ */ e(
1469
1477
  "button",
1470
1478
  {
1471
1479
  onClick: n,
1472
- disabled: i,
1473
- title: t,
1474
- className: `p-2 rounded-lg transition-all ${i ? "text-white/30 cursor-not-allowed" : "text-white hover:bg-white/10 active:bg-white/20"}`,
1475
- children: r
1480
+ disabled: s,
1481
+ title: r,
1482
+ className: `p-2 rounded-lg transition-all ${s ? "text-white/30 cursor-not-allowed" : "text-white hover:bg-white/10 active:bg-white/20"}`,
1483
+ children: t
1476
1484
  }
1477
- );
1485
+ ), tt = je.version;
1478
1486
  export {
1479
- tt as FilePreviewModal,
1487
+ et as FilePreviewModal,
1488
+ tt as VERSION,
1489
+ Pe as configurePdfjs,
1480
1490
  Ce as normalizeFile,
1481
- Me as normalizeFiles
1491
+ Te as normalizeFiles,
1492
+ nt as pdfjs
1482
1493
  };
1483
1494
  //# sourceMappingURL=index.mjs.map