@eternalheart/react-file-preview 1.0.1 → 1.0.3

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