@mxmweb/fviewer 1.5.3 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,65 +1,65 @@
1
- import n, { useRef as X, useState as R, useCallback as $, useEffect as te, forwardRef as Ce, createElement as he } from "react";
2
- import G from "styled-components";
3
- import { Markdownit as ve, DataType as we } from "@mxmweb/rtext";
1
+ import n, { useRef as O, useState as z, useCallback as $, useEffect as te, forwardRef as ve, createElement as Ee } from "react";
2
+ import J from "styled-components";
3
+ import { Markdownit as we, DataType as ye } from "@mxmweb/rtext";
4
4
  import * as re from "pdfjs-dist";
5
- const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, Be = ({
5
+ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ke = ({
6
6
  pageNumber: e,
7
7
  scale: t,
8
8
  isAnnotating: o,
9
9
  annotations: u = [],
10
10
  onAnnotationAdd: r,
11
- onAnnotationDelete: d,
12
- readOnly: p = !1
11
+ onAnnotationDelete: i,
12
+ readOnly: v = !1
13
13
  }) => {
14
- const f = X(null), [g, h] = R(!1), [v, b] = R({ x: 0, y: 0 }), [w, B] = R(null), [a, l] = R(null), D = $(
15
- (c) => {
14
+ const f = O(null), [s, h] = z(!1), [p, B] = z({ x: 0, y: 0 }), [w, x] = z(null), [C, l] = z(null), F = $(
15
+ (d) => {
16
16
  if (!o || !f.current) return;
17
- const x = f.current.getBoundingClientRect(), F = (c.clientX - x.left) / x.width, k = (c.clientY - x.top) / x.height;
18
- console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: c.clientX, clientY: c.clientY, rect: x, x: F, y: k, scale: t }), h(!0), b({ x: F, y: k });
17
+ const y = f.current.getBoundingClientRect(), g = (d.clientX - y.left) / y.width, I = (d.clientY - y.top) / y.height;
18
+ console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: d.clientX, clientY: d.clientY, rect: y, x: g, y: I, scale: t }), h(!0), B({ x: g, y: I });
19
19
  },
20
20
  [o, t]
21
- ), C = $(
22
- (c) => {
23
- if (!g || !f.current) return;
24
- const x = f.current.getBoundingClientRect(), F = (c.clientX - x.left) / x.width, k = (c.clientY - x.top) / x.height;
25
- B({
26
- x: Math.min(v.x, F),
27
- y: Math.min(v.y, k),
28
- width: Math.abs(F - v.x),
29
- height: Math.abs(k - v.y)
21
+ ), b = $(
22
+ (d) => {
23
+ if (!s || !f.current) return;
24
+ const y = f.current.getBoundingClientRect(), g = (d.clientX - y.left) / y.width, I = (d.clientY - y.top) / y.height;
25
+ x({
26
+ x: Math.min(p.x, g),
27
+ y: Math.min(p.y, I),
28
+ width: Math.abs(g - p.x),
29
+ height: Math.abs(I - p.y)
30
30
  });
31
31
  },
32
- [g, v, t]
33
- ), q = $(() => {
34
- if (!g || !w) return;
32
+ [s, p, t]
33
+ ), S = $(() => {
34
+ if (!s || !w) return;
35
35
  if (h(!1), w.width < 5 || w.height < 5) {
36
- B(null);
36
+ x(null);
37
37
  return;
38
38
  }
39
- const c = {
40
- id: De(),
39
+ const d = {
40
+ id: Be(),
41
41
  pageNumber: e,
42
42
  ...w,
43
43
  content: "",
44
- color: xe
44
+ color: De
45
45
  };
46
- r == null || r(c), B(null);
47
- }, [g, w, e, r]), N = $((c) => {
48
- l(a === c ? null : c);
49
- }, [a]);
50
- return $((c, x) => {
51
- const F = {
52
- ...c,
53
- content: x
46
+ r == null || r(d), x(null);
47
+ }, [s, w, e, r]), M = $((d) => {
48
+ l(C === d ? null : d);
49
+ }, [C]);
50
+ return $((d, y) => {
51
+ const g = {
52
+ ...d,
53
+ content: y
54
54
  };
55
- r == null || r(F);
56
- }, [r]), $((c) => {
57
- d == null || d(c), l(null);
58
- }, [d]), console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:", {
55
+ r == null || r(g);
56
+ }, [r]), $((d) => {
57
+ i == null || i(d), l(null);
58
+ }, [i]), console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:", {
59
59
  pageNumber: e,
60
60
  annotations: u.length,
61
- currentPageAnnotationsCount: u.filter((c) => c.pageNumber === e).length,
62
- currentPageAnnotations: u.filter((c) => c.pageNumber === e)
61
+ currentPageAnnotationsCount: u.filter((d) => d.pageNumber === e).length,
62
+ currentPageAnnotations: u.filter((d) => d.pageNumber === e)
63
63
  }), /* @__PURE__ */ n.createElement(
64
64
  "div",
65
65
  {
@@ -74,10 +74,10 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
74
74
  pointerEvents: "auto"
75
75
  // 确保可以接收鼠标事件
76
76
  },
77
- onMouseDown: D,
78
- onMouseMove: C,
79
- onMouseUp: q,
80
- onMouseLeave: q
77
+ onMouseDown: F,
78
+ onMouseMove: b,
79
+ onMouseUp: S,
80
+ onMouseLeave: S
81
81
  },
82
82
  w && /* @__PURE__ */ n.createElement(
83
83
  "div",
@@ -91,7 +91,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
91
91
  }
92
92
  }
93
93
  ),
94
- u.filter((c) => c.pageNumber === e).map((c) => (console.log("\u6E32\u67D3\u6807\u6CE8:", c.id, `\u4F4D\u7F6E: ${c.x * 100}%, ${c.y * 100}%`), /* @__PURE__ */ n.createElement("div", { key: c.id, style: {
94
+ u.filter((d) => d.pageNumber === e).map((d) => (console.log("\u6E32\u67D3\u6807\u6CE8:", d.id, `\u4F4D\u7F6E: ${d.x * 100}%, ${d.y * 100}%`), /* @__PURE__ */ n.createElement("div", { key: d.id, style: {
95
95
  width: "100%",
96
96
  height: "100%",
97
97
  position: "absolute",
@@ -103,21 +103,21 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
103
103
  className: "border border-solid",
104
104
  style: {
105
105
  position: "absolute",
106
- left: `${c.x * 100}%`,
107
- top: `${c.y * 100}%`,
108
- width: `${c.width * 100}%`,
109
- height: `${c.height * 100}%`,
106
+ left: `${d.x * 100}%`,
107
+ top: `${d.y * 100}%`,
108
+ width: `${d.width * 100}%`,
109
+ height: `${d.height * 100}%`,
110
110
  borderWidth: "2px",
111
- borderColor: `${c.color}`,
112
- backgroundColor: `${c.color}4D`,
111
+ borderColor: `${d.color}`,
112
+ backgroundColor: `${d.color}4D`,
113
113
  // 30%透明度 (4D = 77/255 ≈ 0.3)
114
114
  zIndex: 1e3
115
115
  },
116
- onClick: () => N(c.id)
116
+ onClick: () => M(d.id)
117
117
  }
118
118
  ))))
119
119
  );
120
- }, ke = {
120
+ }, Ae = {
121
121
  colors: {
122
122
  primary: "#007bff",
123
123
  secondary: "#6c757d",
@@ -141,14 +141,14 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
141
141
  shadow: "md",
142
142
  lineHeight: "md"
143
143
  }
144
- }, Ae = G.div`
144
+ }, $e = J.div`
145
145
  display: flex;
146
146
  align-items: center;
147
147
  justify-content: center;
148
148
  height: 200px;
149
149
  color: ${(e) => e.$theme.colors.disabledText};
150
150
  font-size: 14px;
151
- `, $e = G.div`
151
+ `, Pe = J.div`
152
152
  display: flex;
153
153
  align-items: center;
154
154
  justify-content: center;
@@ -156,75 +156,111 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
156
156
  color: ${(e) => e.$theme.colors.error};
157
157
  font-size: 14px;
158
158
  text-align: center;
159
- `, Pe = ({
159
+ `, Te = ({
160
160
  pdfDocument: e,
161
161
  currentPage: t,
162
162
  pdfStartPage: o = 1,
163
163
  // 默认从第1页开始
164
164
  scale: u,
165
165
  annotations: r,
166
- isAnnotating: d,
167
- isSlidesMode: p = !1,
168
- onPageChange: f,
169
- onScaleChange: g,
166
+ isAnnotating: i,
167
+ isSlidesMode: v = !1,
168
+ setScale: f,
169
+ onScaleChange: s,
170
170
  onAnnotationChange: h,
171
- onAnnotationDelete: v,
172
- styles: b
171
+ onAnnotationDelete: p,
172
+ styles: B
173
173
  }) => {
174
- const [w, B] = R(!1), [a, l] = R(null), [D, C] = R(0), [q, N] = R(0), [c, x] = R(!1), [F, k] = R(!0), O = (b == null ? void 0 : b.theme) || ke, L = X(null), A = X(null), P = X(!1), V = X(null), ee = $((s) => {
175
- if (!A.current || !F || !g) return null;
176
- const i = A.current, y = i.offsetWidth - 40, m = i.offsetHeight - 40, _ = y / s.width, T = m / s.height, I = Math.min(_, T, 1), Z = Math.max(0.3, Math.min(1, I));
177
- return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
178
- containerWidth: y,
179
- containerHeight: m,
180
- viewportWidth: s.width,
181
- viewportHeight: s.height,
182
- scaleX: _,
183
- scaleY: T,
184
- autoScale: I,
185
- finalScale: Z
186
- }), Z;
187
- }, [F, g]), J = $(async () => {
188
- if (!(!e || !L.current)) {
189
- if (P.current || V.current === t) {
174
+ const [w, x] = z(!1), [C, l] = z(null), [F, b] = z(null), [S, M] = z(!0), d = (B == null ? void 0 : B.theme) || Ae, y = O(null), g = O(null), I = O(!1), U = O(null), Q = $(
175
+ (A) => {
176
+ if (!g.current || !S || !s) return null;
177
+ const X = g.current, P = X.offsetWidth - 40, c = X.offsetHeight - 40, a = P / A.width, m = c / A.height, D = Math.min(a, m, 1), R = Math.max(0.3, Math.min(1, D));
178
+ return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
179
+ containerWidth: P,
180
+ containerHeight: c,
181
+ viewportWidth: A.width,
182
+ viewportHeight: A.height,
183
+ scaleX: a,
184
+ scaleY: m,
185
+ autoScale: D,
186
+ finalScale: R
187
+ }), R;
188
+ },
189
+ [S, s]
190
+ ), k = $(async () => {
191
+ if (!(!e || !y.current)) {
192
+ if (I.current || U.current === t) {
190
193
  console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");
191
194
  return;
192
195
  }
193
196
  try {
194
- V.current = t, P.current = !0;
195
- const s = t - o + 1;
196
- if (console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${o}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${t}, \u76F8\u5BF9\u9875\u7801=${s}`), s < 1 || s > e.numPages)
197
- throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${s}, PDF\u603B\u9875\u6570=${e.numPages}`), new Error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${t}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${e.numPages}\u9875`);
198
- const i = await e.getPage(s), y = L.current, m = y.getContext("2d");
197
+ U.current = t, I.current = !0;
198
+ const A = t - o + 1;
199
+ if (console.log(
200
+ `\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${o}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${t}, \u76F8\u5BF9\u9875\u7801=${A}`
201
+ ), A < 1 || A > e.numPages)
202
+ throw console.error(
203
+ `\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${A}, PDF\u603B\u9875\u6570=${e.numPages}`
204
+ ), new Error(
205
+ `\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${t}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${e.numPages}\u9875`
206
+ );
207
+ const X = await e.getPage(A), P = y.current, c = P.getContext("2d");
199
208
  console.log("\u5F53\u524Dscale\u503C:", u);
200
- const _ = i.getViewport({ scale: 1 });
201
- if (console.log("viewport\u5C3A\u5BF8:", _.width, "x", _.height), F && k(!1), y.width = _.width, y.height = _.height, await i.render({
202
- canvasContext: m,
203
- viewport: _
204
- }).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", y.width, "x", y.height), A.current) {
205
- const T = A.current;
206
- console.log("\u5BB9\u5668\u5C3A\u5BF8:", T.offsetWidth, "x", T.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", y.offsetWidth, "x", y.offsetHeight);
209
+ const a = X.getViewport({ scale: 1 });
210
+ if (console.log("viewport\u5C3A\u5BF8:", a.width, "x", a.height), S && M(!1), P.width = a.width, P.height = a.height, P.width && P.height && b({ width: P.width, height: P.height }), await X.render({
211
+ canvasContext: c,
212
+ viewport: a
213
+ }).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", P.width, "x", P.height), g.current) {
214
+ const m = g.current;
215
+ console.log("\u5BB9\u5668\u5C3A\u5BF8:", m.offsetWidth, "x", m.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", P.offsetWidth, "x", P.offsetHeight);
207
216
  }
208
- } catch (s) {
209
- console.error("PDF\u6E32\u67D3\u5931\u8D25:", s);
217
+ } catch (A) {
218
+ console.error("PDF\u6E32\u67D3\u5931\u8D25:", A);
210
219
  } finally {
211
- P.current = !1;
220
+ I.current = !1;
212
221
  }
213
222
  }
214
- }, [e, u, o, ee, g, t]);
215
- return te(() => {
216
- e && t && o && (console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:", "pdfStartPage:" + o, "currentPage:" + t, "pdfDocument:", e), J());
223
+ }, [e, u, o, Q, s, t]);
224
+ if (te(() => {
225
+ e && t && o && (console.log(
226
+ "\u8BA1\u7B97\u4E0B\uFF0CrenderPage:",
227
+ "pdfStartPage:" + o,
228
+ "currentPage:" + t,
229
+ "pdfDocument:",
230
+ e
231
+ ), k());
217
232
  }, [t, e, o]), te(() => {
218
- e && t && J();
219
- }, [u, e, t]), w ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(Ae, { $theme: O }, "\u52A0\u8F7D\u4E2D...")) : a ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement($e, { $theme: O }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, a)))) : /* @__PURE__ */ n.createElement(
233
+ e && t && k();
234
+ }, [u, e, t]), w)
235
+ return /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement($e, { $theme: d }, "\u52A0\u8F7D\u4E2D..."));
236
+ if (C)
237
+ return /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(Pe, { $theme: d }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, C))));
238
+ const _ = O(null), Y = () => {
239
+ const A = g.current ? g.current.offsetWidth - 40 : null;
240
+ if (!A || !(F != null && F.width)) return;
241
+ const X = F.width, c = +(A / X).toFixed(2);
242
+ typeof c == "number" ? f && f(c) : (clearInterval(_.current), _.current = null);
243
+ };
244
+ return te(() => {
245
+ if (!g.current || !(F != null && F.width) || !(F != null && F.height)) {
246
+ clearInterval(_.current), _.current = null, _.current = setInterval(() => {
247
+ Y();
248
+ }, 34);
249
+ return;
250
+ } else
251
+ Y();
252
+ return () => {
253
+ clearInterval(_.current), _.current = null;
254
+ };
255
+ }, [F]), /* @__PURE__ */ n.createElement(
220
256
  "div",
221
257
  {
222
- ref: A,
258
+ ref: g,
223
259
  className: "bg-gray-100",
224
260
  style: {
225
- display: p ? "block" : "flex",
226
- justifyContent: p ? "initial" : "center",
227
- alignItems: p ? "initial" : "flex-start",
261
+ display: v ? "block" : "flex",
262
+ justifyContent: v ? "initial" : "center",
263
+ alignItems: v ? "initial" : "flex-start",
228
264
  padding: "20px",
229
265
  minHeight: "100%",
230
266
  width: "100%",
@@ -232,7 +268,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
232
268
  overflow: "visible"
233
269
  }
234
270
  },
235
- w ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20" }, /* @__PURE__ */ n.createElement("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900" }), /* @__PURE__ */ n.createElement("div", { className: "text-xs text-gray-600" }, "PDF\u52A0\u8F7D\u4E2D...")) : a ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20 text-red-500" }, /* @__PURE__ */ n.createElement("div", null, "\u6E32\u67D3\u9519\u8BEF"), /* @__PURE__ */ n.createElement("div", { className: "text-xs" }, a)) : /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-start" }, /* @__PURE__ */ n.createElement(
271
+ w ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20" }, /* @__PURE__ */ n.createElement("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900" }), /* @__PURE__ */ n.createElement("div", { className: "text-xs text-gray-600" }, "PDF\u52A0\u8F7D\u4E2D...")) : C ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20 text-red-500" }, /* @__PURE__ */ n.createElement("div", null, "\u6E32\u67D3\u9519\u8BEF"), /* @__PURE__ */ n.createElement("div", { className: "text-xs" }, C)) : /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-start" }, /* @__PURE__ */ n.createElement(
236
272
  "div",
237
273
  {
238
274
  className: "relative",
@@ -246,7 +282,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
246
282
  /* @__PURE__ */ n.createElement(
247
283
  "canvas",
248
284
  {
249
- ref: L,
285
+ ref: y,
250
286
  className: "shadow-lg bg-white border border-gray-300",
251
287
  style: {
252
288
  display: "block"
@@ -254,20 +290,20 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
254
290
  }
255
291
  ),
256
292
  /* @__PURE__ */ n.createElement(
257
- Be,
293
+ ke,
258
294
  {
259
295
  pageNumber: t,
260
- scale: u,
261
- isAnnotating: d,
296
+ scale: u || 1,
297
+ isAnnotating: i,
262
298
  annotations: r,
263
299
  onAnnotationAdd: h,
264
- onAnnotationDelete: v,
265
- readOnly: !d
300
+ onAnnotationDelete: p,
301
+ readOnly: !i
266
302
  }
267
303
  )
268
304
  ))
269
305
  );
270
- }, _e = G.div`
306
+ }, _e = J.div`
271
307
  flex: 1;
272
308
  background: ${(e) => e.$theme.colors.background};
273
309
  position: relative;
@@ -280,13 +316,13 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
280
316
  /* 支持大尺寸内容的滚动 */
281
317
  overflow-x: auto;
282
318
  overflow-y: auto; /* 改为auto,允许垂直滚动 */
283
- `, Te = G.div`
319
+ `, Re = J.div`
284
320
  display: flex;
285
321
  align-items: center;
286
322
  justify-content: center;
287
323
  height: 100%;
288
324
  color: ${(e) => e.$theme.colors.disabledText};
289
- `, Re = G.div`
325
+ `, Ne = J.div`
290
326
  display: flex;
291
327
  flex-direction: column;
292
328
  align-items: center;
@@ -295,7 +331,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
295
331
  color: ${(e) => e.$theme.colors.error};
296
332
  text-align: center;
297
333
  padding: 20px;
298
- `, Ne = `
334
+ `, Le = `
299
335
  .md-annotation {
300
336
  position: relative;
301
337
  display: inline;
@@ -375,7 +411,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
375
411
  .markdown-scrollbar::-webkit-scrollbar-thumb:hover {
376
412
  background: #a9a9a;
377
413
  }
378
- `, Le = {
414
+ `, ze = {
379
415
  colors: {
380
416
  primary: "#007bff",
381
417
  secondary: "#6c757d",
@@ -399,466 +435,534 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
399
435
  shadow: "md",
400
436
  lineHeight: "md"
401
437
  }
402
- }, ze = (e) => {
438
+ }, Se = (e) => {
403
439
  if (console.log("=== detectFileType \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", e), !e)
404
440
  return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"), "unknown";
405
441
  const t = e.fileName || "", o = e.fileType || "", u = e.content;
406
442
  return console.log("\u68C0\u6D4B\u53C2\u6570:", { fileName: t, fileType: o, content: u }), o === "pdf" || o === "pdf_slides" ? (console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"), o) : o === "image" ? (console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"), "image") : o === "markdown_table" ? (console.log("\u68C0\u6D4B\u5230Markdown\u8868\u683C\u6587\u4EF6"), "markdown_table") : o === "markdown" ? (console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"), "markdown") : o === "html" ? (console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"), "html") : o === "text" ? (console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"), "text") : t.toLowerCase().endsWith(".pdf") || (u == null ? void 0 : u.type) === "pdf" ? (console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"), "pdf") : t.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/) || (u == null ? void 0 : u.type) === "image" ? (console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"), "image") : t.toLowerCase().endsWith(".md") || (u == null ? void 0 : u.type) === "markdown" ? (console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"), "markdown") : t.toLowerCase().match(/\.(html|htm)$/) || (u == null ? void 0 : u.type) === "html" ? (console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"), "html") : t.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/) || (u == null ? void 0 : u.type) === "text" ? (console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"), "text") : (console.log("\u672A\u8BC6\u522B\u7684\u6587\u4EF6\u7C7B\u578B\uFF0C\u8FD4\u56DE unknown"), "unknown");
407
- }, Se = (e, t, o = !1) => {
408
- var u, r, d, p, f, g, h;
409
- console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPdfContent:", "pdfStartPage:" + e.pdfStartPage, "currentPage:" + t.currentPage), console.log("=== renderPdfContent \u5F00\u59CB ==="), console.log("PDF\u6570\u636E:", e), console.log("PDF\u6587\u6863:", (u = e.content) == null ? void 0 : u.document), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof ((r = e.content) == null ? void 0 : r.document)), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Anull:", ((d = e.content) == null ? void 0 : d.document) === null), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:", ((p = e.content) == null ? void 0 : p.document) === void 0), console.log("PDF\u6587\u6863\u65B9\u6CD5:", (f = e.content) != null && f.document ? Object.getOwnPropertyNames(Object.getPrototypeOf(e.content.document)) : "\u65E0\u6587\u6863"), console.log("PDF\u6587\u6863\u5C5E\u6027:", (g = e.content) != null && g.document ? Object.keys(e.content.document) : "\u65E0\u6587\u6863");
410
- const v = e.pdfStartPage || 1;
411
- console.log("PDF\u8D77\u59CB\u9875:", v);
412
- const b = (t.annotationData || []).filter(
413
- (a) => "pageNumber" in a && "x" in a && "y" in a
443
+ }, Me = (e, t, o = !1, u = void 0) => {
444
+ var r, i, v, f, s, h, p;
445
+ console.log(
446
+ "\u8BA1\u7B97\u4E0B\uFF0CrenderPdfContent:",
447
+ "pdfStartPage:" + e.pdfStartPage,
448
+ "currentPage:" + t.currentPage
449
+ ), console.log("=== renderPdfContent \u5F00\u59CB ==="), console.log("PDF\u6570\u636E:", e), console.log("PDF\u6587\u6863:", (r = e.content) == null ? void 0 : r.document), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof ((i = e.content) == null ? void 0 : i.document)), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Anull:", ((v = e.content) == null ? void 0 : v.document) === null), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:", ((f = e.content) == null ? void 0 : f.document) === void 0), console.log(
450
+ "PDF\u6587\u6863\u65B9\u6CD5:",
451
+ (s = e.content) != null && s.document ? Object.getOwnPropertyNames(Object.getPrototypeOf(e.content.document)) : "\u65E0\u6587\u6863"
452
+ ), console.log(
453
+ "PDF\u6587\u6863\u5C5E\u6027:",
454
+ (h = e.content) != null && h.document ? Object.keys(e.content.document) : "\u65E0\u6587\u6863"
414
455
  );
415
- console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:", b);
416
- const w = o ? 0.82 : 1, B = t.initialZoom || t.scale || w;
456
+ const B = e.pdfStartPage || 1;
457
+ console.log("PDF\u8D77\u59CB\u9875:", B);
458
+ const w = (t.annotationData || []).filter(
459
+ (l) => "pageNumber" in l && "x" in l && "y" in l
460
+ );
461
+ console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:", w);
462
+ const x = o ? 0.82 : 1, C = t.initialZoom || t.scale || x;
417
463
  return /* @__PURE__ */ n.createElement(
418
- Pe,
464
+ Te,
419
465
  {
420
- pdfDocument: ((h = e.content) == null ? void 0 : h.document) || null,
466
+ pdfDocument: ((p = e.content) == null ? void 0 : p.document) || null,
421
467
  currentPage: t.currentPage || 1,
422
- pdfStartPage: v,
423
- scale: B,
424
- annotations: b,
468
+ pdfStartPage: B,
469
+ scale: C,
470
+ setScale: u,
471
+ annotations: w,
425
472
  isAnnotating: !1,
426
473
  isSlidesMode: o,
427
- onPageChange: t.eventsEmit ? (a) => {
428
- var l;
429
- return (l = t.eventsEmit) == null ? void 0 : l.call(t, "pageChange", { pageNumber: a });
474
+ onPageChange: t.eventsEmit ? (l) => {
475
+ var F;
476
+ return (F = t.eventsEmit) == null ? void 0 : F.call(t, "pageChange", { pageNumber: l });
430
477
  } : void 0,
431
- onScaleChange: t.eventsEmit ? (a) => {
432
- var l;
433
- return (l = t.eventsEmit) == null ? void 0 : l.call(t, "scaleChange", { scale: a });
478
+ onScaleChange: t.eventsEmit ? (l) => {
479
+ var F;
480
+ return (F = t.eventsEmit) == null ? void 0 : F.call(t, "scaleChange", { scale: l });
434
481
  } : void 0,
435
- onAnnotationChange: t.eventsEmit ? (a) => {
436
- var l;
437
- return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationChange", { annotation: a });
482
+ onAnnotationChange: t.eventsEmit ? (l) => {
483
+ var F;
484
+ return (F = t.eventsEmit) == null ? void 0 : F.call(t, "annotationChange", { annotation: l });
438
485
  } : void 0,
439
- onAnnotationDelete: t.eventsEmit ? (a) => {
440
- var l;
441
- return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationDelete", { annotationId: a });
486
+ onAnnotationDelete: t.eventsEmit ? (l) => {
487
+ var F;
488
+ return (F = t.eventsEmit) == null ? void 0 : F.call(t, "annotationDelete", { annotationId: l });
442
489
  } : void 0,
443
490
  styles: t.styles
444
491
  }
445
492
  );
446
- }, Me = (e, t) => {
447
- var o, u, r, d, p, f, g, h, v, b, w, B, a, l;
493
+ }, Ie = (e, t) => {
494
+ var o, u, r, i, v, f, s, h, p, B, w, x, C, l;
448
495
  console.log("=== Fviewer renderImageContent ==="), console.log("data:", e), console.log("data.content:", e.content), console.log("data.content?.url:", (o = e.content) == null ? void 0 : o.url), console.log("rotation:", t.rotation);
449
- const D = ((u = e.content) == null ? void 0 : u.url) || e.content, [C, q] = R(!0), [N, c] = R(!1), x = () => {
450
- console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:", D), q(!1), c(!1);
451
- }, F = () => {
452
- console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:", D), q(!1), c(!0);
496
+ const F = ((u = e.content) == null ? void 0 : u.url) || e.content, [b, S] = z(!0), [M, d] = z(!1), y = () => {
497
+ console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:", F), S(!1), d(!1);
498
+ }, g = () => {
499
+ console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:", F), S(!1), d(!0);
453
500
  };
454
- return /* @__PURE__ */ n.createElement("div", { style: {
455
- display: "flex",
456
- justifyContent: "center",
457
- alignItems: "center",
458
- height: "100%",
459
- padding: "20px",
460
- overflow: "auto",
461
- position: "relative",
462
- backgroundColor: "#272727"
463
- // 图片模式深色背景
464
- } }, C && /* @__PURE__ */ n.createElement("div", { style: {
465
- position: "absolute",
466
- top: "50%",
467
- left: "50%",
468
- transform: "translate(-50%, -50%)",
469
- display: "flex",
470
- flexDirection: "column",
471
- alignItems: "center",
472
- gap: "12px",
473
- zIndex: 1
474
- } }, /* @__PURE__ */ n.createElement("div", { style: {
475
- width: "32px",
476
- height: "32px",
477
- border: `3px solid ${((p = (d = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : d.colors) == null ? void 0 : p.border) || "#dee2e6"}`,
478
- borderTop: `3px solid ${((h = (g = (f = t.styles) == null ? void 0 : f.theme) == null ? void 0 : g.colors) == null ? void 0 : h.primary) || "#007bff"}`,
479
- borderRadius: "50%",
480
- animation: "spin 1s linear infinite"
481
- } }), /* @__PURE__ */ n.createElement("div", { style: {
482
- fontSize: "12px",
483
- color: ((w = (b = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : b.colors) == null ? void 0 : w.text) || "#343a40"
484
- } }, "\u56FE\u7247\u52A0\u8F7D\u4E2D...")), N && /* @__PURE__ */ n.createElement("div", { style: {
485
- position: "absolute",
486
- top: "50%",
487
- left: "50%",
488
- transform: "translate(-50%, -50%)",
489
- display: "flex",
490
- flexDirection: "column",
491
- alignItems: "center",
492
- gap: "8px",
493
- zIndex: 1
494
- } }, /* @__PURE__ */ n.createElement("div", { style: {
495
- fontSize: "14px",
496
- color: ((l = (a = (B = t.styles) == null ? void 0 : B.theme) == null ? void 0 : a.colors) == null ? void 0 : l.error) || "#dc3545"
497
- } }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), /* @__PURE__ */ n.createElement(
498
- "img",
501
+ return /* @__PURE__ */ n.createElement(
502
+ "div",
499
503
  {
500
- src: D,
501
- alt: e.fileName || "\u56FE\u7247",
502
- onLoad: x,
503
- onError: F,
504
504
  style: {
505
- maxWidth: "100%",
506
- maxHeight: "100%",
507
- objectFit: "contain",
508
- transform: `scale(${t.scale || 1}) rotate(${t.rotation || 0}deg)`,
509
- opacity: C ? 0 : 1,
510
- transition: "opacity 0.3s ease-in-out, transform 0.2s ease-in-out"
505
+ display: "flex",
506
+ justifyContent: "center",
507
+ alignItems: "center",
508
+ height: "100%",
509
+ padding: "20px",
510
+ overflow: "auto",
511
+ position: "relative",
512
+ backgroundColor: "#272727"
513
+ // 图片模式深色背景
511
514
  }
512
- }
513
- ), /* @__PURE__ */ n.createElement("style", null, `
515
+ },
516
+ b && /* @__PURE__ */ n.createElement(
517
+ "div",
518
+ {
519
+ style: {
520
+ position: "absolute",
521
+ top: "50%",
522
+ left: "50%",
523
+ transform: "translate(-50%, -50%)",
524
+ display: "flex",
525
+ flexDirection: "column",
526
+ alignItems: "center",
527
+ gap: "12px",
528
+ zIndex: 1
529
+ }
530
+ },
531
+ /* @__PURE__ */ n.createElement(
532
+ "div",
533
+ {
534
+ style: {
535
+ width: "32px",
536
+ height: "32px",
537
+ border: `3px solid ${((v = (i = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : i.colors) == null ? void 0 : v.border) || "#dee2e6"}`,
538
+ borderTop: `3px solid ${((h = (s = (f = t.styles) == null ? void 0 : f.theme) == null ? void 0 : s.colors) == null ? void 0 : h.primary) || "#007bff"}`,
539
+ borderRadius: "50%",
540
+ animation: "spin 1s linear infinite"
541
+ }
542
+ }
543
+ ),
544
+ /* @__PURE__ */ n.createElement(
545
+ "div",
546
+ {
547
+ style: {
548
+ fontSize: "12px",
549
+ color: ((w = (B = (p = t.styles) == null ? void 0 : p.theme) == null ? void 0 : B.colors) == null ? void 0 : w.text) || "#343a40"
550
+ }
551
+ },
552
+ "\u56FE\u7247\u52A0\u8F7D\u4E2D..."
553
+ )
554
+ ),
555
+ M && /* @__PURE__ */ n.createElement(
556
+ "div",
557
+ {
558
+ style: {
559
+ position: "absolute",
560
+ top: "50%",
561
+ left: "50%",
562
+ transform: "translate(-50%, -50%)",
563
+ display: "flex",
564
+ flexDirection: "column",
565
+ alignItems: "center",
566
+ gap: "8px",
567
+ zIndex: 1
568
+ }
569
+ },
570
+ /* @__PURE__ */ n.createElement(
571
+ "div",
572
+ {
573
+ style: {
574
+ fontSize: "14px",
575
+ color: ((l = (C = (x = t.styles) == null ? void 0 : x.theme) == null ? void 0 : C.colors) == null ? void 0 : l.error) || "#dc3545"
576
+ }
577
+ },
578
+ "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"
579
+ )
580
+ ),
581
+ /* @__PURE__ */ n.createElement(
582
+ "img",
583
+ {
584
+ src: F,
585
+ alt: e.fileName || "\u56FE\u7247",
586
+ onLoad: y,
587
+ onError: g,
588
+ style: {
589
+ maxWidth: "100%",
590
+ maxHeight: "100%",
591
+ objectFit: "contain",
592
+ transform: `scale(${t.scale || 1}) rotate(${t.rotation || 0}deg)`,
593
+ opacity: b ? 0 : 1,
594
+ transition: "opacity 0.3s ease-in-out, transform 0.2s ease-in-out"
595
+ }
596
+ }
597
+ ),
598
+ /* @__PURE__ */ n.createElement("style", null, `
514
599
  @keyframes spin {
515
600
  0% { transform: rotate(0deg); }
516
601
  100% { transform: rotate(360deg); }
517
602
  }
518
- `));
603
+ `)
604
+ );
519
605
  }, We = (e, t) => {
520
- var o, u, r, d, p;
606
+ var o, u, r, i, v;
521
607
  console.log("=== Fviewer renderTextContent ==="), console.log("data:", e), console.log("data.content:", e.content);
522
608
  let f = "";
523
609
  typeof e.content == "string" ? f = e.content : (o = e.content) != null && o.text ? f = e.content.text : (u = e.content) != null && u.content && (f = e.content.content), console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:", f);
524
- const g = X(null), h = X(null);
610
+ const s = O(null), h = O(null);
525
611
  return te(() => {
526
- if (g.current && h.current && f) {
527
- const v = setTimeout(() => {
528
- var b;
529
- const w = ((b = g.current) == null ? void 0 : b.scrollHeight) || 0, B = Math.max(w + 80, 200);
530
- h.current && (h.current.style.minHeight = `${B}px`, console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:", B));
612
+ if (s.current && h.current && f) {
613
+ const p = setTimeout(() => {
614
+ var B;
615
+ const w = ((B = s.current) == null ? void 0 : B.scrollHeight) || 0, x = Math.max(w + 80, 200);
616
+ h.current && (h.current.style.minHeight = `${x}px`, console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:", x));
531
617
  }, 100);
532
- return () => clearTimeout(v);
618
+ return () => clearTimeout(p);
533
619
  }
534
- }, [f]), /* @__PURE__ */ n.createElement("div", { style: {
535
- height: "100%",
536
- overflow: "auto",
537
- backgroundColor: "#f5f5f5",
538
- // 纸张背景色
539
- padding: "20px",
540
- display: "flex",
541
- justifyContent: "center",
542
- position: "relative"
543
- } }, /* @__PURE__ */ n.createElement(
620
+ }, [f]), /* @__PURE__ */ n.createElement(
544
621
  "div",
545
622
  {
546
- ref: h,
547
623
  style: {
548
- width: "100%",
549
- maxWidth: "800px",
550
- backgroundColor: "white",
551
- boxShadow: "0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",
552
- borderRadius: "8px",
553
- padding: "40px",
554
- margin: "20px 0",
555
- position: "relative",
556
- transform: `scale(${t.scale || 1})`,
557
- transition: "transform 0.2s ease-in-out",
558
- transformOrigin: "top center"
624
+ height: "100%",
625
+ overflow: "auto",
626
+ backgroundColor: "#f5f5f5",
627
+ // 纸张背景色
628
+ padding: "20px",
629
+ display: "flex",
630
+ justifyContent: "center",
631
+ position: "relative"
559
632
  }
560
633
  },
561
634
  /* @__PURE__ */ n.createElement(
562
635
  "div",
563
636
  {
564
- ref: g,
637
+ ref: h,
565
638
  style: {
566
639
  width: "100%",
567
- overflow: "visible"
640
+ maxWidth: "800px",
641
+ backgroundColor: "white",
642
+ boxShadow: "0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",
643
+ borderRadius: "8px",
644
+ padding: "40px",
645
+ margin: "20px 0",
646
+ position: "relative",
647
+ transform: `scale(${t.scale || 1})`,
648
+ transition: "transform 0.2s ease-in-out",
649
+ transformOrigin: "top center"
568
650
  }
569
651
  },
570
652
  /* @__PURE__ */ n.createElement(
571
- ve,
653
+ "div",
572
654
  {
573
- dataSource: {
574
- type: we.TEXT,
575
- content: f
576
- },
577
- size: "md",
578
- theme: {
579
- primaryColor: ((p = (d = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : d.colors) == null ? void 0 : p.primary) || "#007bff",
580
- backgroundColor: "transparent",
581
- textColor: "#333",
582
- borderColor: "transparent",
583
- borderRadius: "0",
584
- padding: "0"
585
- },
655
+ ref: s,
586
656
  style: {
587
- border: "none",
588
- background: "transparent",
589
657
  width: "100%",
590
- height: "auto",
591
658
  overflow: "visible"
592
659
  }
660
+ },
661
+ /* @__PURE__ */ n.createElement(
662
+ we,
663
+ {
664
+ dataSource: {
665
+ type: ye.TEXT,
666
+ content: f
667
+ },
668
+ size: "md",
669
+ theme: {
670
+ primaryColor: ((v = (i = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : i.colors) == null ? void 0 : v.primary) || "#007bff",
671
+ backgroundColor: "transparent",
672
+ textColor: "#333",
673
+ borderColor: "transparent",
674
+ borderRadius: "0",
675
+ padding: "0"
676
+ },
677
+ style: {
678
+ border: "none",
679
+ background: "transparent",
680
+ width: "100%",
681
+ height: "auto",
682
+ overflow: "visible"
683
+ }
684
+ }
685
+ )
686
+ ),
687
+ /* @__PURE__ */ n.createElement(
688
+ "div",
689
+ {
690
+ style: {
691
+ position: "absolute",
692
+ top: "0",
693
+ left: "0",
694
+ right: "0",
695
+ height: "2px",
696
+ background: "linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",
697
+ borderTopLeftRadius: "8px",
698
+ borderTopRightRadius: "8px"
699
+ }
593
700
  }
594
701
  )
595
- ),
596
- /* @__PURE__ */ n.createElement("div", { style: {
597
- position: "absolute",
598
- top: "0",
599
- left: "0",
600
- right: "0",
601
- height: "2px",
602
- background: "linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",
603
- borderTopLeftRadius: "8px",
604
- borderTopRightRadius: "8px"
605
- } })
606
- ));
607
- }, Ie = ({ data: e, parentProps: t, isTableMode: o = !1 }) => {
608
- var u, r, d, p, f, g, h, v, b, w, B, a;
609
- const l = X(null), D = X(null), C = X(null), q = X(!1);
610
- X(0), X(null);
611
- const [N] = R(!1), c = (s, i) => {
612
- console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: s, scrollHeight: i }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: s, scrollHeight: i });
613
- }, x = () => {
702
+ )
703
+ );
704
+ }, je = ({ data: e, parentProps: t, isTableMode: o = !1 }) => {
705
+ var u, r, i, v, f, s, h, p, B, w, x, C;
706
+ const l = O(null), F = O(null), b = O(null), S = O(!1);
707
+ O(0), O(null);
708
+ const [M] = z(!1), d = (c, a) => {
709
+ console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: c, scrollHeight: a }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: c, scrollHeight: a });
710
+ }, y = () => {
614
711
  console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_top");
615
- }, F = () => {
712
+ }, g = () => {
616
713
  console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_bottom");
617
- }, k = X();
618
- k.current = (s) => {
619
- var i, y;
714
+ }, I = O();
715
+ I.current = (c) => {
716
+ var a, m;
620
717
  try {
621
718
  if (!o) return;
622
- const m = typeof e.content == "string" ? e.content : ((i = e.content) == null ? void 0 : i.content) || "";
623
- if (!m || P.length === 0) return;
624
- const _ = JSON.stringify(P.map((Z) => ({ o: Z.offsets, c: Z.color }))), T = `${m.length}:${m.substring(0, 64)}:${m.substring(m.length - 64)}|${_}`;
625
- if (((y = s.dataset) == null ? void 0 : y.tableAnnoRuntimeSig) === T) return;
719
+ const D = typeof e.content == "string" ? e.content : ((a = e.content) == null ? void 0 : a.content) || "";
720
+ if (!D || _.length === 0) return;
721
+ const R = JSON.stringify(_.map((G) => ({ o: G.offsets, c: G.color }))), H = `${D.length}:${D.substring(0, 64)}:${D.substring(D.length - 64)}|${R}`;
722
+ if (((m = c.dataset) == null ? void 0 : m.tableAnnoRuntimeSig) === H) return;
626
723
  setTimeout(() => {
627
- ee(), s.dataset && (s.dataset.tableAnnoRuntimeSig = T);
724
+ X(), c.dataset && (c.dataset.tableAnnoRuntimeSig = H);
628
725
  }, 50);
629
- } catch (m) {
630
- console.warn("[MarkdownRendered] apply failed", m);
726
+ } catch (D) {
727
+ console.warn("[MarkdownRendered] apply failed", D);
631
728
  }
632
729
  };
633
- const O = n.useCallback((s) => {
634
- var i;
635
- return (i = k.current) == null ? void 0 : i.call(k, s);
636
- }, []), L = $(() => {
637
- var s;
638
- if (!N || !l.current) return;
639
- const i = window.getSelection();
640
- if (!i || i.isCollapsed) return;
641
- const y = i.getRangeAt(0), m = y.toString().trim();
642
- if (!m) return;
643
- const _ = l.current;
644
- let T = 0, I = 0;
645
- const Z = document.createTreeWalker(
646
- _,
647
- NodeFilter.SHOW_TEXT,
648
- {
649
- acceptNode: (j) => {
650
- var K;
651
- return (K = j.parentElement) != null && K.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
652
- }
730
+ const U = n.useCallback(
731
+ (c) => {
732
+ var a;
733
+ return (a = I.current) == null ? void 0 : a.call(I, c);
734
+ },
735
+ []
736
+ ), Q = $(() => {
737
+ var c;
738
+ if (!M || !l.current) return;
739
+ const a = window.getSelection();
740
+ if (!a || a.isCollapsed) return;
741
+ const m = a.getRangeAt(0), D = m.toString().trim();
742
+ if (!D) return;
743
+ const R = l.current;
744
+ let H = 0, q = 0;
745
+ const G = document.createTreeWalker(R, NodeFilter.SHOW_TEXT, {
746
+ acceptNode: (j) => {
747
+ var V;
748
+ return (V = j.parentElement) != null && V.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
653
749
  }
654
- );
655
- let U = Z.nextNode();
656
- for (; U; ) {
657
- if (U === y.startContainer) {
658
- I = T + y.startOffset;
750
+ });
751
+ let ee = G.nextNode();
752
+ for (; ee; ) {
753
+ if (ee === m.startContainer) {
754
+ q = H + m.startOffset;
659
755
  break;
660
756
  }
661
- T += ((s = U.textContent) == null ? void 0 : s.length) || 0, U = Z.nextNode();
757
+ H += ((c = ee.textContent) == null ? void 0 : c.length) || 0, ee = G.nextNode();
662
758
  }
663
759
  console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:", {
664
- text: m,
665
- startOffset: I,
666
- charCount: T,
667
- container: y.startContainer.textContent
760
+ text: D,
761
+ startOffset: q,
762
+ charCount: H,
763
+ container: m.startContainer.textContent
668
764
  });
669
- const M = {
765
+ const N = {
670
766
  id: `md-anno-${Date.now()}`,
671
- start: I,
672
- end: I + m.length,
767
+ start: q,
768
+ end: q + D.length,
673
769
  color: "#FFE599"
674
770
  };
675
- console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", M), t.eventsEmit && t.eventsEmit("md_annotation_add", M), i.removeAllRanges();
676
- }, [N, t.eventsEmit]), A = o ? [] : (t.annotationData || []).filter(
677
- (s) => "start" in s && "end" in s && !("pageNumber" in s)
678
- ), P = o ? (t.annotationData || []).filter(
679
- (s) => "offsets" in s && Array.isArray(s.offsets)
680
- ) : [], V = $(() => {
771
+ console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", N), t.eventsEmit && t.eventsEmit("md_annotation_add", N), a.removeAllRanges();
772
+ }, [M, t.eventsEmit]), k = o ? [] : (t.annotationData || []).filter(
773
+ (c) => "start" in c && "end" in c && !("pageNumber" in c)
774
+ ), _ = o ? (t.annotationData || []).filter(
775
+ (c) => "offsets" in c && Array.isArray(c.offsets)
776
+ ) : [], Y = $(() => {
681
777
  if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !l.current) {
682
778
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");
683
779
  return;
684
780
  }
685
- const s = l.current.querySelectorAll(".md-annotation");
686
- console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", s.length), s.length > 0 && s.forEach((i) => {
687
- const y = i.parentNode;
688
- y && y.replaceChild(document.createTextNode(i.textContent || ""), i);
781
+ const c = l.current.querySelectorAll(".md-annotation");
782
+ console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", c.length), c.length > 0 && c.forEach((a) => {
783
+ const m = a.parentNode;
784
+ m && m.replaceChild(document.createTextNode(a.textContent || ""), a);
689
785
  }), console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A");
690
- }, []), ee = $(() => {
691
- if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", P), !l.current || !P.length) {
692
- console.log("\u8868\u683C\u6807\u6CE8\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u9000\u51FA");
786
+ }, []), A = $(() => {
787
+ if (!l.current) return;
788
+ l.current.querySelectorAll("table").forEach((a) => {
789
+ Array.from(a.rows).forEach((D) => {
790
+ Array.from(D.cells).forEach((R) => {
791
+ R.getAttribute("data-table-annotated") === "1" && (R.style.removeProperty("background"), R.style.removeProperty("background-color"), R.removeAttribute("data-table-annotated"), R.removeAttribute("title"));
792
+ });
793
+ });
794
+ }), console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8");
795
+ }, []), X = $(() => {
796
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", _), !l.current) {
797
+ console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");
798
+ return;
799
+ }
800
+ if (A(), !_.length) {
801
+ console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");
693
802
  return;
694
803
  }
695
- const s = l.current.querySelectorAll("table");
696
- if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", s.length), s.length === 0) {
804
+ const c = l.current.querySelectorAll("table");
805
+ if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", c.length), c.length === 0) {
697
806
  console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
698
807
  return;
699
808
  }
700
- q.current = !0, P.forEach((i, y) => {
701
- const m = i.offsets;
702
- if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", i), !Array.isArray(m) || !m.length || !Array.isArray(m[0]) || m[0].length !== 2) {
703
- console.warn("[TableAnnotation] annotation.offsets is not valid", i);
809
+ S.current = !0, _.forEach((a, m) => {
810
+ const D = a.offsets;
811
+ if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", a), !Array.isArray(D) || !D.length || !Array.isArray(D[0]) || D[0].length !== 2) {
812
+ console.warn("[TableAnnotation] annotation.offsets is not valid", a);
704
813
  return;
705
814
  }
706
- m.forEach((_, T) => {
707
- const [I, Z] = _;
708
- if (typeof I != "number" || typeof Z != "number") {
709
- console.warn("[TableAnnotation] offset is not [number, number]", _);
815
+ D.forEach((R, H) => {
816
+ const [q, G] = R;
817
+ if (typeof q != "number" || typeof G != "number") {
818
+ console.warn("[TableAnnotation] offset is not [number, number]", R);
710
819
  return;
711
820
  }
712
- s.forEach((U, M) => {
713
- var j, K, oe;
714
- let Q;
715
- const H = U.tBodies && U.tBodies.length > 0 ? Array.from(U.tBodies[0].rows) : [];
716
- if (H.length > 0)
717
- Q = H[I];
718
- else {
719
- const S = ((K = (j = U.tHead) == null ? void 0 : j.rows) == null ? void 0 : K.length) || 0;
720
- Q = Array.from(U.rows)[I + S];
721
- }
722
- if (!Q) {
723
- console.warn("[TableAnnotation] row out of range", { row: I, tableIndex: M });
821
+ c.forEach((ee, N) => {
822
+ var j;
823
+ const V = Array.from(ee.rows), oe = V[q];
824
+ if (!oe) {
825
+ console.warn("[TableAnnotation] row out of range", {
826
+ row: q,
827
+ tableIndex: N,
828
+ totalRows: V.length
829
+ });
724
830
  return;
725
831
  }
726
- const W = (oe = Q.cells) == null ? void 0 : oe[Z];
727
- if (!W) {
728
- console.warn("[TableAnnotation] cell is undefined", { row: I, col: Z, tableIndex: M });
832
+ const Z = (j = oe.cells) == null ? void 0 : j[G];
833
+ if (!Z) {
834
+ console.warn("[TableAnnotation] cell is undefined", { row: q, col: G, tableIndex: N });
729
835
  return;
730
836
  }
731
- const E = i.color || "rgba(255, 229, 153, 0.5)", z = getComputedStyle(W).backgroundColor;
732
- W.getAttribute("data-table-annotated") === "1" && (z === E || W.style.backgroundColor === E) || (W.style.setProperty("background", E, "important"), W.style.setProperty("background-color", E, "important"), W.setAttribute("data-table-annotated", "1")), i.content && (W.title = i.content), T === 0 && y === 0 && setTimeout(() => {
733
- W.scrollIntoView({ behavior: "smooth", block: "start" });
837
+ const T = a.color || "rgba(255, 229, 153, 0.5)", E = getComputedStyle(Z).backgroundColor;
838
+ Z.getAttribute("data-table-annotated") === "1" && (E === T || Z.style.backgroundColor === T) || (Z.style.setProperty("background", T, "important"), Z.style.setProperty("background-color", T, "important"), Z.setAttribute("data-table-annotated", "1")), a.content && (Z.title = a.content), H === 0 && m === 0 && setTimeout(() => {
839
+ Z.scrollIntoView({ behavior: "smooth", block: "start" });
734
840
  }, 300);
735
841
  });
736
842
  });
737
843
  }), requestAnimationFrame(() => {
738
- q.current = !1;
844
+ S.current = !1;
739
845
  });
740
- }, [P]), J = $(() => {
741
- if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !l.current || !A.length) {
846
+ }, [_, A]), P = $(() => {
847
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !l.current || !k.length) {
742
848
  console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
743
849
  return;
744
850
  }
745
- D.current && clearTimeout(D.current);
746
- const s = () => {
747
- var i;
851
+ F.current && clearTimeout(F.current);
852
+ const c = () => {
853
+ var a;
748
854
  console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");
749
- const y = (i = l.current) == null ? void 0 : i.querySelectorAll(".md-annotation");
750
- console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (y == null ? void 0 : y.length) || 0), y == null || y.forEach((M) => {
751
- const j = M.parentNode;
752
- j && j.replaceChild(document.createTextNode(M.textContent || ""), M);
855
+ const m = (a = l.current) == null ? void 0 : a.querySelectorAll(".md-annotation");
856
+ console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (m == null ? void 0 : m.length) || 0), m == null || m.forEach((N) => {
857
+ const j = N.parentNode;
858
+ j && j.replaceChild(document.createTextNode(N.textContent || ""), N);
753
859
  });
754
- const m = document.createTreeWalker(
755
- l.current,
756
- NodeFilter.SHOW_TEXT,
757
- {
758
- acceptNode: (M) => {
759
- var j;
760
- return (j = M.parentElement) != null && j.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
761
- }
860
+ const D = document.createTreeWalker(l.current, NodeFilter.SHOW_TEXT, {
861
+ acceptNode: (N) => {
862
+ var j;
863
+ return (j = N.parentElement) != null && j.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
762
864
  }
763
- ), _ = [];
764
- let T;
765
- for (; T = m.nextNode(); )
766
- _.push(T);
767
- if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", _.length), _.length === 0) {
768
- console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), D.current = setTimeout(() => {
769
- s();
865
+ }), R = [];
866
+ let H;
867
+ for (; H = D.nextNode(); )
868
+ R.push(H);
869
+ if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", R.length), R.length === 0) {
870
+ console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), F.current = setTimeout(() => {
871
+ c();
770
872
  }, 200);
771
873
  return;
772
874
  }
773
- let I = 0;
774
- const Z = _.map((M) => {
875
+ let q = 0;
876
+ const G = R.map((N) => {
775
877
  var j;
776
- const K = I;
777
- return I += ((j = M.textContent) == null ? void 0 : j.length) || 0, {
778
- node: M,
779
- start: K,
780
- end: I,
781
- text: M.textContent
878
+ const V = q;
879
+ return q += ((j = N.textContent) == null ? void 0 : j.length) || 0, {
880
+ node: N,
881
+ start: V,
882
+ end: q,
883
+ text: N.textContent
782
884
  };
783
885
  });
784
- console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:", Z), console.log("\u603B\u6587\u672C\u957F\u5EA6:", I);
785
- const U = [...A].sort((M, j) => j.start - M.start);
786
- console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:", U), U.forEach((M) => {
787
- const { start: j, end: K, color: oe } = M;
788
- console.log("\u5904\u7406\u6807\u6CE8:", { annotation: M, nodePositions: Z });
789
- const Q = Z.filter(
790
- (H) => j < H.end && K > H.start
791
- );
792
- console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Q.length), Q.forEach(({ node: H, start: W }) => {
793
- var E, z, Y, S, me, Fe;
794
- const le = Math.max(0, j - W), se = Math.min(((E = H.textContent) == null ? void 0 : E.length) || 0, K - W);
795
- if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd: se, nodeTextLength: (z = H.textContent) == null ? void 0 : z.length }), le >= se) {
886
+ console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:", G), console.log("\u603B\u6587\u672C\u957F\u5EA6:", q);
887
+ const ee = [...k].sort((N, j) => j.start - N.start);
888
+ console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:", ee), ee.forEach((N) => {
889
+ const { start: j, end: V, color: oe } = N;
890
+ console.log("\u5904\u7406\u6807\u6CE8:", { annotation: N, nodePositions: G });
891
+ const Z = G.filter((T) => j < T.end && V > T.start);
892
+ console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Z.length), Z.forEach(({ node: T, start: E }) => {
893
+ var L, K, W, he, Fe, pe;
894
+ const le = Math.max(0, j - E), ae = Math.min(((L = T.textContent) == null ? void 0 : L.length) || 0, V - E);
895
+ if (console.log("\u672C\u5730\u4F4D\u7F6E:", {
896
+ localStart: le,
897
+ localEnd: ae,
898
+ nodeTextLength: (K = T.textContent) == null ? void 0 : K.length
899
+ }), le >= ae) {
796
900
  console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
797
901
  return;
798
902
  }
799
- const ge = ((Y = H.textContent) == null ? void 0 : Y.slice(0, le)) || "", fe = ((S = H.textContent) == null ? void 0 : S.slice(le, se)) || "", Ee = ((me = H.textContent) == null ? void 0 : me.slice(se)) || "";
800
- console.log("\u5206\u5272\u6587\u672C:", { before: ge, annotatedText: fe, after: Ee });
903
+ const me = ((W = T.textContent) == null ? void 0 : W.slice(0, le)) || "", ge = ((he = T.textContent) == null ? void 0 : he.slice(le, ae)) || "", fe = ((Fe = T.textContent) == null ? void 0 : Fe.slice(ae)) || "";
904
+ console.log("\u5206\u5272\u6587\u672C:", { before: me, annotatedText: ge, after: fe });
801
905
  const ie = document.createElement("span");
802
- ie.className = "md-annotation", ie.style.backgroundColor = oe || "#FFE599", ie.textContent = fe;
803
- const ae = document.createDocumentFragment();
804
- ge && ae.appendChild(document.createTextNode(ge)), ae.appendChild(ie), Ee && ae.appendChild(document.createTextNode(Ee)), (Fe = H.parentNode) == null || Fe.replaceChild(ae, H), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", fe);
906
+ ie.className = "md-annotation", ie.style.backgroundColor = oe || "#FFE599", ie.textContent = ge;
907
+ const se = document.createDocumentFragment();
908
+ me && se.appendChild(document.createTextNode(me)), se.appendChild(ie), fe && se.appendChild(document.createTextNode(fe)), (pe = T.parentNode) == null || pe.replaceChild(se, T), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", ge);
805
909
  });
806
910
  });
807
911
  };
808
- D.current = setTimeout(() => {
809
- s();
912
+ F.current = setTimeout(() => {
913
+ c();
810
914
  }, 100);
811
- }, [A]);
915
+ }, [k]);
812
916
  return te(() => {
813
- var s;
917
+ var c;
814
918
  if (o) {
815
919
  console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
816
920
  return;
817
921
  }
818
- const i = typeof e.content == "string" ? e.content : ((s = e.content) == null ? void 0 : s.content) || "";
819
- if (!i || typeof i != "string") {
922
+ const a = typeof e.content == "string" ? e.content : ((c = e.content) == null ? void 0 : c.content) || "";
923
+ if (!a || typeof a != "string") {
820
924
  console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
821
925
  return;
822
926
  }
823
- if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", l.current), console.log("isTableMode:", o), console.log("mdAnnotations:", A), console.log("tableAnnotations:", P), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:", i), !l.current) {
927
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", l.current), console.log("isTableMode:", o), console.log("mdAnnotations:", k), console.log("tableAnnotations:", _), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:", a), !l.current) {
824
928
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");
825
929
  return;
826
930
  }
827
- if (o || V(), !o && A.length > 0) {
828
- J();
931
+ if (o || Y(), !o && k.length > 0) {
932
+ P();
829
933
  return;
830
934
  }
831
935
  console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8");
832
- }, [o, P, A]), te(() => {
936
+ }, [o, _, k]), te(() => {
833
937
  if (!o)
834
- return document.addEventListener("mouseup", L), () => {
835
- document.removeEventListener("mouseup", L);
938
+ return document.addEventListener("mouseup", Q), () => {
939
+ document.removeEventListener("mouseup", Q);
836
940
  };
837
- }, [L, o]), te(() => {
838
- var s;
839
- const i = typeof e.content == "string" ? e.content : ((s = e.content) == null ? void 0 : s.content) || "";
840
- if (!i || typeof i != "string") {
941
+ }, [Q, o]), te(() => {
942
+ var c;
943
+ const a = typeof e.content == "string" ? e.content : ((c = e.content) == null ? void 0 : c.content) || "";
944
+ if (!a || typeof a != "string") {
841
945
  console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
842
946
  return;
843
947
  }
844
- console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", i.length || 0), typeof i == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", i.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", i.substring(i.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof i), console.log("\u5185\u5BB9\u503C:", i)), console.log("\u6807\u6CE8\u6570\u636E:", A), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", P);
845
- }, [A, P, o]), te(() => {
948
+ console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", a.length || 0), typeof a == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", a.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", a.substring(a.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof a), console.log("\u5185\u5BB9\u503C:", a)), console.log("\u6807\u6CE8\u6570\u636E:", k), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", _);
949
+ }, [k, _, o]), te(() => {
846
950
  if (o && l.current) {
847
- const s = setTimeout(() => {
848
- var i;
849
- const y = (i = l.current) == null ? void 0 : i.querySelectorAll("table");
850
- y && y.length > 0 && (console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:", y.length), y.forEach((m, _) => {
851
- if (m instanceof HTMLTableElement) {
852
- m.style.width = "100%", m.style.minWidth = "100%", m.style.tableLayout = "auto";
853
- const T = m.closest(".markdown-table-mode");
854
- T && T instanceof HTMLElement && (T.style.width = "100%", T.style.overflowX = "auto"), console.log(`\u8868\u683C ${_ + 1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`);
951
+ const c = setTimeout(() => {
952
+ var a;
953
+ const m = (a = l.current) == null ? void 0 : a.querySelectorAll("table");
954
+ m && m.length > 0 && (console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:", m.length), m.forEach((D, R) => {
955
+ if (D instanceof HTMLTableElement) {
956
+ D.style.width = "100%", D.style.minWidth = "100%", D.style.tableLayout = "auto";
957
+ const H = D.closest(".markdown-table-mode");
958
+ H && H instanceof HTMLElement && (H.style.width = "100%", H.style.overflowX = "auto"), console.log(`\u8868\u683C ${R + 1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`);
855
959
  }
856
960
  }));
857
961
  }, 500);
858
- return () => clearTimeout(s);
962
+ return () => clearTimeout(c);
859
963
  }
860
964
  }, [o, e.content]), te(() => () => {
861
- D.current && clearTimeout(D.current), C.current && (C.current.disconnect(), C.current = null);
965
+ F.current && clearTimeout(F.current), b.current && (b.current.disconnect(), b.current = null);
862
966
  }, []), /* @__PURE__ */ n.createElement(
863
967
  "div",
864
968
  {
@@ -870,27 +974,27 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
870
974
  },
871
975
  className: `markdown-container markdown-scrollbar ${o ? "markdown-table-mode" : ""}`
872
976
  },
873
- /* @__PURE__ */ n.createElement("style", null, Ne),
977
+ /* @__PURE__ */ n.createElement("style", null, Le),
874
978
  /* @__PURE__ */ n.createElement("div", { ref: l }, /* @__PURE__ */ n.createElement(
875
- ve,
979
+ we,
876
980
  {
877
981
  dataSource: {
878
- type: we.MARKDOWN,
982
+ type: ye.MARKDOWN,
879
983
  content: (() => {
880
- var s, i;
881
- return typeof e.content == "string" ? e.content : (s = e.content) != null && s.text ? e.content.text : (i = e.content) != null && i.content ? e.content.content : "";
984
+ var c, a;
985
+ return typeof e.content == "string" ? e.content : (c = e.content) != null && c.text ? e.content.text : (a = e.content) != null && a.content ? e.content.content : "";
882
986
  })()
883
987
  },
884
988
  size: "md",
885
- onScroll: o ? void 0 : c,
886
- onScrollToTop: o ? void 0 : x,
887
- onScrollToBottom: o ? void 0 : F,
888
- onRendered: O,
989
+ onScroll: o ? void 0 : d,
990
+ onScrollToTop: o ? void 0 : y,
991
+ onScrollToBottom: o ? void 0 : g,
992
+ onRendered: U,
889
993
  theme: {
890
- primaryColor: ((d = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : d.primary) || "#007bff",
891
- backgroundColor: ((g = (f = (p = t.styles) == null ? void 0 : p.theme) == null ? void 0 : f.colors) == null ? void 0 : g.background) || "#f8f9fa",
892
- textColor: ((b = (v = (h = t.styles) == null ? void 0 : h.theme) == null ? void 0 : v.colors) == null ? void 0 : b.text) || "#343a40",
893
- borderColor: ((a = (B = (w = t.styles) == null ? void 0 : w.theme) == null ? void 0 : B.colors) == null ? void 0 : a.border) || "#dee2e6",
994
+ primaryColor: ((i = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : i.primary) || "#007bff",
995
+ backgroundColor: ((s = (f = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : f.colors) == null ? void 0 : s.background) || "#f8f9fa",
996
+ textColor: ((B = (p = (h = t.styles) == null ? void 0 : h.theme) == null ? void 0 : p.colors) == null ? void 0 : B.text) || "#343a40",
997
+ borderColor: ((C = (x = (w = t.styles) == null ? void 0 : w.theme) == null ? void 0 : x.colors) == null ? void 0 : C.border) || "#dee2e6",
894
998
  borderRadius: o ? "0px" : "8px",
895
999
  padding: o ? "0px" : "20px"
896
1000
  },
@@ -903,66 +1007,67 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
903
1007
  }
904
1008
  ))
905
1009
  );
906
- }, je = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
907
- const u = X(null), r = (f) => {
908
- const g = f.split(/\r?\n/).filter((a) => a.trim().length > 0);
1010
+ }, Oe = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
1011
+ const u = O(null), r = (f) => {
1012
+ const s = f.split(/\r?\n/).filter((C) => C.trim().length > 0);
909
1013
  let h = -1;
910
- for (let a = 0; a < g.length - 1; a++) {
911
- const l = g[a].trim(), D = g[a + 1].trim();
912
- if (l.startsWith("|") && l.endsWith("|") && D.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
913
- h = a;
1014
+ for (let C = 0; C < s.length - 1; C++) {
1015
+ const l = s[C].trim(), F = s[C + 1].trim();
1016
+ if (l.startsWith("|") && l.endsWith("|") && F.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
1017
+ h = C;
914
1018
  break;
915
1019
  }
916
1020
  }
917
1021
  if (h === -1) return null;
918
- const b = g[h].split("|").slice(1, -1).map((a) => a.trim()), w = [];
919
- for (let a = h + 2; a < g.length; a++) {
920
- const l = g[a].trim();
1022
+ const B = s[h].split("|").slice(1, -1).map((C) => C.trim()), w = [];
1023
+ for (let C = h + 2; C < s.length; C++) {
1024
+ const l = s[C].trim();
921
1025
  if (!l.startsWith("|") || !l.endsWith("|")) break;
922
1026
  w.push(l);
923
1027
  }
924
- const B = w.map((a) => a.split("|").slice(1, -1).map((l) => l.trim()));
925
- return { headers: b, rows: B };
926
- }, d = n.useMemo(() => r(e), [e]);
1028
+ const x = w.map(
1029
+ (C) => C.split("|").slice(1, -1).map((l) => l.trim())
1030
+ );
1031
+ return { headers: B, rows: x };
1032
+ }, i = n.useMemo(() => r(e), [e]);
927
1033
  return te(() => {
928
1034
  const f = () => {
929
1035
  try {
930
- if (!u.current || !o.length) return;
1036
+ if (!u.current) return;
931
1037
  const h = u.current.querySelectorAll("table");
932
- if (!h || h.length === 0) return;
933
- o.forEach((v, b) => {
934
- (v.offsets || []).forEach((B, a) => {
935
- const [l, D] = B;
936
- h.forEach((C) => {
937
- var q, N, c;
938
- const x = C.tBodies && C.tBodies.length > 0 ? Array.from(C.tBodies[0].rows) : [];
939
- let F;
940
- if (x.length > 0)
941
- F = x[l];
942
- else {
943
- const A = ((N = (q = C.tHead) == null ? void 0 : q.rows) == null ? void 0 : N.length) || 0;
944
- F = Array.from(C.rows)[l + A];
945
- }
946
- if (!F) return;
947
- const k = (c = F.cells) == null ? void 0 : c[D];
948
- if (!k) return;
949
- const O = v.color || "rgba(255, 229, 153, 0.5)";
950
- k.getAttribute("data-table-annotated") === "1" || (k.style.setProperty("background", O, "important"), k.style.setProperty("background-color", O, "important"), k.setAttribute("data-table-annotated", "1"), v.content && (k.title = v.content)), b === 0 && a === 0 && setTimeout(() => k.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
1038
+ if (h.forEach((p) => {
1039
+ Array.from(p.rows).forEach((w) => {
1040
+ Array.from(w.cells).forEach((x) => {
1041
+ x.getAttribute("data-table-annotated") === "1" && (x.style.removeProperty("background"), x.style.removeProperty("background-color"), x.removeAttribute("data-table-annotated"), x.removeAttribute("title"));
1042
+ });
1043
+ });
1044
+ }), !o.length || !h || h.length === 0) return;
1045
+ o.forEach((p, B) => {
1046
+ (p.offsets || []).forEach((x, C) => {
1047
+ const [l, F] = x;
1048
+ h.forEach((b) => {
1049
+ var S;
1050
+ const d = Array.from(b.rows)[l];
1051
+ if (!d) return;
1052
+ const y = (S = d.cells) == null ? void 0 : S[F];
1053
+ if (!y) return;
1054
+ const g = p.color || "rgba(255, 229, 153, 0.5)";
1055
+ y.getAttribute("data-table-annotated") === "1" || (y.style.setProperty("background", g, "important"), y.style.setProperty("background-color", g, "important"), y.setAttribute("data-table-annotated", "1"), p.content && (y.title = p.content)), B === 0 && C === 0 && setTimeout(() => y.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
951
1056
  });
952
1057
  });
953
1058
  });
954
1059
  } catch (h) {
955
1060
  console.warn("[MinimalMarkdownTable] apply annotations failed", h);
956
1061
  }
957
- }, g = requestAnimationFrame(() => {
1062
+ }, s = requestAnimationFrame(() => {
958
1063
  f(), t && t();
959
1064
  });
960
- return () => cancelAnimationFrame(g);
961
- }, [e, o, t]), d ? /* @__PURE__ */ n.createElement("div", { ref: u, className: "markdown-table-mode z-mdtbl-wrapper" }, /* @__PURE__ */ n.createElement("style", null, `
1065
+ return () => cancelAnimationFrame(s);
1066
+ }, [e, o, t]), i ? /* @__PURE__ */ n.createElement("div", { ref: u, className: "markdown-table-mode z-mdtbl-wrapper" }, /* @__PURE__ */ n.createElement("style", null, `
962
1067
  .z-mdtbl-wrapper { overflow: auto; position: relative; }
963
1068
  .z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
964
1069
  .z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
965
- .z-mdtbl th { background: transparent; font-weight: 600; color: inherit; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
1070
+ .z-mdtbl th { background: transparent; font-weight: 600; color: inherit; }
966
1071
  .z-mdtbl tbody tr:nth-child(odd) { background: transparent; }
967
1072
  .z-mdtbl tbody tr:hover { background: transparent; }
968
1073
  .z-mdtbl td, .z-mdtbl th { white-space: nowrap; }
@@ -970,128 +1075,162 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
970
1075
  .z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
971
1076
  .z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
972
1077
  .z-mdtbl tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
973
- `), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null, d.headers.map((f, g) => /* @__PURE__ */ n.createElement("th", { key: g }, f)))), /* @__PURE__ */ n.createElement("tbody", null, d.rows.map((f, g) => /* @__PURE__ */ n.createElement("tr", { key: g }, f.map((h, v) => /* @__PURE__ */ n.createElement("td", { key: v }, h))))))) : /* @__PURE__ */ n.createElement("div", { ref: u, style: { padding: "8px" } }, "\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C");
974
- }, Oe = (e, t) => {
1078
+ `), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null, i.headers.map((f, s) => /* @__PURE__ */ n.createElement("th", { key: s }, f)))), /* @__PURE__ */ n.createElement("tbody", null, i.rows.map((f, s) => /* @__PURE__ */ n.createElement("tr", { key: s }, f.map((h, p) => /* @__PURE__ */ n.createElement("td", { key: p }, h))))))) : /* @__PURE__ */ n.createElement("div", { ref: u, style: { padding: "8px" } }, "\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C");
1079
+ }, He = (e, t) => {
975
1080
  var o, u;
976
1081
  console.log("=== Fviewer renderHtmlContent ==="), console.log("data:", e), console.log("data.content:", e.content);
977
1082
  let r = "";
978
- return typeof e.content == "string" ? r = e.content : (o = e.content) != null && o.text ? r = e.content.text : (u = e.content) != null && u.content && (r = e.content.content), console.log("\u6700\u7EC8\u4F20\u9012\u7ED9 iframe \u7684 content:", r), /* @__PURE__ */ n.createElement("div", { style: {
979
- height: "100%",
980
- overflow: "auto",
981
- position: "relative"
982
- } }, /* @__PURE__ */ n.createElement(
983
- "iframe",
1083
+ return typeof e.content == "string" ? r = e.content : (o = e.content) != null && o.text ? r = e.content.text : (u = e.content) != null && u.content && (r = e.content.content), console.log("\u6700\u7EC8\u4F20\u9012\u7ED9 iframe \u7684 content:", r), /* @__PURE__ */ n.createElement(
1084
+ "div",
984
1085
  {
985
- srcDoc: r,
986
1086
  style: {
987
- width: "100%",
988
1087
  height: "100%",
989
- border: "none",
990
- background: "white"
991
- },
992
- title: "HTML Preview",
993
- sandbox: "allow-same-origin allow-scripts"
1088
+ overflow: "auto",
1089
+ position: "relative"
1090
+ }
1091
+ },
1092
+ /* @__PURE__ */ n.createElement(
1093
+ "iframe",
1094
+ {
1095
+ srcDoc: r,
1096
+ style: {
1097
+ width: "100%",
1098
+ height: "100%",
1099
+ border: "none",
1100
+ background: "white"
1101
+ },
1102
+ title: "HTML Preview",
1103
+ sandbox: "allow-same-origin allow-scripts"
1104
+ }
1105
+ )
1106
+ );
1107
+ }, Ze = (e, t) => /* @__PURE__ */ n.createElement(
1108
+ "div",
1109
+ {
1110
+ style: {
1111
+ display: "flex",
1112
+ justifyContent: "center",
1113
+ alignItems: "center",
1114
+ height: "100%",
1115
+ color: "#666"
994
1116
  }
995
- ));
996
- }, He = (e, t) => /* @__PURE__ */ n.createElement("div", { style: {
997
- display: "flex",
998
- justifyContent: "center",
999
- alignItems: "center",
1000
- height: "100%",
1001
- color: "#666"
1002
- } }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, e.fileName || "\u672A\u77E5\u6587\u4EF6"))), Ze = ({
1117
+ },
1118
+ /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, e.fileName || "\u672A\u77E5\u6587\u4EF6"))
1119
+ ), Xe = ({
1003
1120
  data: e,
1004
1121
  annotationData: t = [],
1005
1122
  totalPage: o = 0,
1006
1123
  currentPage: u = 1,
1007
- scale: r,
1124
+ setScale: r,
1125
+ scale: i,
1008
1126
  // 重命名避免冲突
1009
- rotation: d = 0,
1127
+ rotation: v = 0,
1010
1128
  // 添加rotation参数
1011
- eventsEmit: p,
1012
- styles: f,
1013
- tools: g = {
1129
+ eventsEmit: f,
1130
+ styles: s,
1131
+ tools: h = {
1014
1132
  annotation: !0,
1015
1133
  download: !0,
1016
1134
  zoom: !0,
1017
1135
  close: !0,
1018
1136
  navigation: !0
1019
1137
  },
1020
- customComponents: h,
1021
- className: v,
1022
- contentClass: b
1138
+ customComponents: p,
1139
+ className: B,
1140
+ contentClass: w
1023
1141
  }) => {
1024
- var w, B, a, l;
1025
- const D = (f == null ? void 0 : f.theme) || Le, [C, q] = R(!1), [N] = R("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [c, x] = R(null);
1026
- console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="), console.log("Fviewer data:", e), console.log("Fviewer data.content:", e == null ? void 0 : e.content), console.log("Fviewer data.content.document:", (w = e == null ? void 0 : e.content) == null ? void 0 : w.document), console.log("Fviewer data.content.document\u7C7B\u578B:", typeof ((B = e == null ? void 0 : e.content) == null ? void 0 : B.document)), console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:", ((a = e == null ? void 0 : e.content) == null ? void 0 : a.document) === null), console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:", ((l = e == null ? void 0 : e.content) == null ? void 0 : l.document) === void 0), console.log("Fviewer currentPage:", u), console.log("Fviewer scale:", r);
1027
- const F = X(null), k = X(null), O = X(0);
1028
- O.current += 1, console.log("[Fviewer] render count:", O.current);
1029
- const L = ze(e);
1030
- console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", L), console.log("\u5B8C\u6574\u6570\u636E:", e);
1031
- const A = () => {
1032
- var P;
1033
- switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", L), L) {
1142
+ var x, C, l, F;
1143
+ const b = (s == null ? void 0 : s.theme) || ze, [S, M] = z(!1), [d] = z("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [y, g] = z(null);
1144
+ console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="), console.log("Fviewer data:", e), console.log("Fviewer data.content:", e == null ? void 0 : e.content), console.log("Fviewer data.content.document:", (x = e == null ? void 0 : e.content) == null ? void 0 : x.document), console.log("Fviewer data.content.document\u7C7B\u578B:", typeof ((C = e == null ? void 0 : e.content) == null ? void 0 : C.document)), console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:", ((l = e == null ? void 0 : e.content) == null ? void 0 : l.document) === null), console.log(
1145
+ "Fviewer data.content.document\u662F\u5426\u4E3Aundefined:",
1146
+ ((F = e == null ? void 0 : e.content) == null ? void 0 : F.document) === void 0
1147
+ ), console.log("Fviewer currentPage:", u), console.log("Fviewer scale:", i);
1148
+ const I = O(null), U = O(null), Q = O(0);
1149
+ Q.current += 1, console.log("[Fviewer] render count:", Q.current);
1150
+ const k = Se(e);
1151
+ console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", k), console.log("\u5B8C\u6574\u6570\u636E:", e);
1152
+ const _ = () => {
1153
+ var Y;
1154
+ switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", k), k) {
1034
1155
  case "pdf":
1035
1156
  case "pdf_slides":
1036
- return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:", L, "pdfStartPage:" + e.pdfStartPage, "currentPage:" + u), Se(e, { data: e, annotationData: t, totalPage: o, currentPage: u, scale: r, eventsEmit: p, styles: f, tools: g, className: v, contentClass: b }, L === "pdf_slides");
1157
+ return console.log(
1158
+ "\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:",
1159
+ k,
1160
+ "pdfStartPage:" + e.pdfStartPage,
1161
+ "currentPage:" + u
1162
+ ), Me(
1163
+ e,
1164
+ {
1165
+ data: e,
1166
+ annotationData: t,
1167
+ totalPage: o,
1168
+ currentPage: u,
1169
+ scale: i,
1170
+ eventsEmit: f,
1171
+ styles: s,
1172
+ tools: h,
1173
+ className: B,
1174
+ contentClass: w
1175
+ },
1176
+ k === "pdf_slides",
1177
+ r
1178
+ );
1037
1179
  case "image":
1038
- return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), Me(e, { scale: r, rotation: d, styles: f });
1180
+ return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), Ie(e, {
1181
+ scale: i,
1182
+ rotation: v,
1183
+ styles: s
1184
+ });
1039
1185
  case "text":
1040
- return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), We(e, { scale: r, styles: f });
1186
+ return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), We(e, {
1187
+ scale: i,
1188
+ styles: s
1189
+ });
1041
1190
  case "markdown":
1042
1191
  case "markdown_table":
1043
- if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", L), L === "markdown_table") {
1044
- const V = typeof e.content == "string" ? e.content : ((P = e.content) == null ? void 0 : P.content) || "", ee = (t || []).filter(
1045
- (J) => "offsets" in J && Array.isArray(J.offsets)
1046
- );
1047
- return /* @__PURE__ */ n.createElement(
1048
- je,
1049
- {
1050
- markdown: V,
1051
- tableAnnotations: ee
1052
- }
1192
+ if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", k), k === "markdown_table") {
1193
+ const A = typeof e.content == "string" ? e.content : ((Y = e.content) == null ? void 0 : Y.content) || "", X = (t || []).filter(
1194
+ (P) => "offsets" in P && Array.isArray(P.offsets)
1053
1195
  );
1196
+ return /* @__PURE__ */ n.createElement(Oe, { markdown: A, tableAnnotations: X });
1054
1197
  }
1055
1198
  return /* @__PURE__ */ n.createElement(
1056
- Ie,
1199
+ je,
1057
1200
  {
1058
1201
  data: e,
1059
- parentProps: { data: e, annotationData: t, eventsEmit: p, styles: f, tools: g, className: v, contentClass: b },
1202
+ parentProps: {
1203
+ data: e,
1204
+ annotationData: t,
1205
+ eventsEmit: f,
1206
+ styles: s,
1207
+ tools: h,
1208
+ className: B,
1209
+ contentClass: w
1210
+ },
1060
1211
  isTableMode: !1
1061
1212
  }
1062
1213
  );
1063
1214
  case "html":
1064
- return console.log("\u6E32\u67D3HTML\u5185\u5BB9"), Oe(e);
1215
+ return console.log("\u6E32\u67D3HTML\u5185\u5BB9"), He(e);
1065
1216
  default:
1066
- return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"), He(e);
1217
+ return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"), Ze(e);
1067
1218
  }
1068
1219
  };
1069
1220
  return n.useEffect(() => {
1070
- const P = F.current, V = k.current, ee = P !== e, J = V !== (e ? e.content : void 0);
1221
+ const Y = I.current, A = U.current, X = Y !== e, P = A !== (e ? e.content : void 0);
1071
1222
  console.log("[Fviewer useEffect:data] triggered", {
1072
- dataChanged: ee,
1073
- contentChanged: J,
1223
+ dataChanged: X,
1224
+ contentChanged: P,
1074
1225
  hasData: !!e,
1075
1226
  hasContent: !!(e != null && e.content),
1076
- isLoadingBefore: C
1077
- }), F.current = e, k.current = e ? e.content : void 0;
1227
+ isLoadingBefore: S
1228
+ }), I.current = e, U.current = e ? e.content : void 0;
1078
1229
  }, [e == null ? void 0 : e.content]), n.useEffect(() => {
1079
- c && q(!1);
1080
- }, [c]), n.useEffect(() => {
1081
- console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="), console.log("annotationData:", t), console.log("annotationData \u957F\u5EA6:", (t == null ? void 0 : t.length) || 0), console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:", L);
1082
- }, [t, L]), /* @__PURE__ */ n.createElement(_e, { $theme: D, className: b }, C ? h != null && h.LoadingComponent ? /* @__PURE__ */ n.createElement(
1083
- h.LoadingComponent,
1084
- {
1085
- status: N,
1086
- theme: D
1087
- }
1088
- ) : /* @__PURE__ */ n.createElement(Te, { $theme: D }, N) : c ? h != null && h.ErrorComponent ? /* @__PURE__ */ n.createElement(
1089
- h.ErrorComponent,
1090
- {
1091
- error: c,
1092
- theme: D
1093
- }
1094
- ) : /* @__PURE__ */ n.createElement(Re, { $theme: D }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, c)) : A());
1230
+ y && M(!1);
1231
+ }, [y]), n.useEffect(() => {
1232
+ console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="), console.log("annotationData:", t), console.log("annotationData \u957F\u5EA6:", (t == null ? void 0 : t.length) || 0), console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:", k);
1233
+ }, [t, k]), /* @__PURE__ */ n.createElement(_e, { $theme: b, className: w }, S ? p != null && p.LoadingComponent ? /* @__PURE__ */ n.createElement(p.LoadingComponent, { status: d, theme: b }) : /* @__PURE__ */ n.createElement(Re, { $theme: b }, d) : y ? p != null && p.ErrorComponent ? /* @__PURE__ */ n.createElement(p.ErrorComponent, { error: y, theme: b }) : /* @__PURE__ */ n.createElement(Ne, { $theme: b }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, y)) : _());
1095
1234
  };
1096
1235
  /**
1097
1236
  * @license lucide-react v0.456.0 - ISC
@@ -1099,14 +1238,14 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
1099
1238
  * This source code is licensed under the ISC license.
1100
1239
  * See the LICENSE file in the root directory of this source tree.
1101
1240
  */
1102
- const Xe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ye = (...e) => e.filter((t, o, u) => !!t && t.trim() !== "" && u.indexOf(t) === o).join(" ").trim();
1241
+ const qe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), be = (...e) => e.filter((t, o, u) => !!t && t.trim() !== "" && u.indexOf(t) === o).join(" ").trim();
1103
1242
  /**
1104
1243
  * @license lucide-react v0.456.0 - ISC
1105
1244
  *
1106
1245
  * This source code is licensed under the ISC license.
1107
1246
  * See the LICENSE file in the root directory of this source tree.
1108
1247
  */
1109
- var qe = {
1248
+ var Ue = {
1110
1249
  xmlns: "http://www.w3.org/2000/svg",
1111
1250
  width: 24,
1112
1251
  height: 24,
@@ -1123,31 +1262,31 @@ var qe = {
1123
1262
  * This source code is licensed under the ISC license.
1124
1263
  * See the LICENSE file in the root directory of this source tree.
1125
1264
  */
1126
- const Ue = Ce(
1265
+ const Ye = ve(
1127
1266
  ({
1128
1267
  color: e = "currentColor",
1129
1268
  size: t = 24,
1130
1269
  strokeWidth: o = 2,
1131
1270
  absoluteStrokeWidth: u,
1132
1271
  className: r = "",
1133
- children: d,
1134
- iconNode: p,
1272
+ children: i,
1273
+ iconNode: v,
1135
1274
  ...f
1136
- }, g) => he(
1275
+ }, s) => Ee(
1137
1276
  "svg",
1138
1277
  {
1139
- ref: g,
1140
- ...qe,
1278
+ ref: s,
1279
+ ...Ue,
1141
1280
  width: t,
1142
1281
  height: t,
1143
1282
  stroke: e,
1144
1283
  strokeWidth: u ? Number(o) * 24 / Number(t) : o,
1145
- className: ye("lucide", r),
1284
+ className: be("lucide", r),
1146
1285
  ...f
1147
1286
  },
1148
1287
  [
1149
- ...p.map(([h, v]) => he(h, v)),
1150
- ...Array.isArray(d) ? d : [d]
1288
+ ...v.map(([h, p]) => Ee(h, p)),
1289
+ ...Array.isArray(i) ? i : [i]
1151
1290
  ]
1152
1291
  )
1153
1292
  );
@@ -1158,11 +1297,11 @@ const Ue = Ce(
1158
1297
  * See the LICENSE file in the root directory of this source tree.
1159
1298
  */
1160
1299
  const ue = (e, t) => {
1161
- const o = Ce(
1162
- ({ className: u, ...r }, d) => he(Ue, {
1163
- ref: d,
1300
+ const o = ve(
1301
+ ({ className: u, ...r }, i) => Ee(Ye, {
1302
+ ref: i,
1164
1303
  iconNode: t,
1165
- className: ye(`lucide-${Xe(e)}`, u),
1304
+ className: be(`lucide-${qe(e)}`, u),
1166
1305
  ...r
1167
1306
  })
1168
1307
  );
@@ -1174,7 +1313,7 @@ const ue = (e, t) => {
1174
1313
  * This source code is licensed under the ISC license.
1175
1314
  * See the LICENSE file in the root directory of this source tree.
1176
1315
  */
1177
- const Ye = ue("ChevronLeft", [
1316
+ const Ge = ue("ChevronLeft", [
1178
1317
  ["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
1179
1318
  ]);
1180
1319
  /**
@@ -1183,7 +1322,7 @@ const Ye = ue("ChevronLeft", [
1183
1322
  * This source code is licensed under the ISC license.
1184
1323
  * See the LICENSE file in the root directory of this source tree.
1185
1324
  */
1186
- const Ge = ue("ChevronRight", [
1325
+ const Ve = ue("ChevronRight", [
1187
1326
  ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
1188
1327
  ]);
1189
1328
  /**
@@ -1192,7 +1331,7 @@ const Ge = ue("ChevronRight", [
1192
1331
  * This source code is licensed under the ISC license.
1193
1332
  * See the LICENSE file in the root directory of this source tree.
1194
1333
  */
1195
- const Ve = ue("Download", [
1334
+ const Je = ue("Download", [
1196
1335
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
1197
1336
  ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
1198
1337
  ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
@@ -1203,7 +1342,7 @@ const Ve = ue("Download", [
1203
1342
  * This source code is licensed under the ISC license.
1204
1343
  * See the LICENSE file in the root directory of this source tree.
1205
1344
  */
1206
- const Je = ue("Pencil", [
1345
+ const Ke = ue("Pencil", [
1207
1346
  [
1208
1347
  "path",
1209
1348
  {
@@ -1219,7 +1358,7 @@ const Je = ue("Pencil", [
1219
1358
  * This source code is licensed under the ISC license.
1220
1359
  * See the LICENSE file in the root directory of this source tree.
1221
1360
  */
1222
- const Ke = ue("RotateCcw", [
1361
+ const Qe = ue("RotateCcw", [
1223
1362
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
1224
1363
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
1225
1364
  ]);
@@ -1229,7 +1368,7 @@ const Ke = ue("RotateCcw", [
1229
1368
  * This source code is licensed under the ISC license.
1230
1369
  * See the LICENSE file in the root directory of this source tree.
1231
1370
  */
1232
- const Qe = ue("RotateCw", [
1371
+ const et = ue("RotateCw", [
1233
1372
  ["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
1234
1373
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }]
1235
1374
  ]);
@@ -1239,7 +1378,7 @@ const Qe = ue("RotateCw", [
1239
1378
  * This source code is licensed under the ISC license.
1240
1379
  * See the LICENSE file in the root directory of this source tree.
1241
1380
  */
1242
- const et = ue("X", [
1381
+ const tt = ue("X", [
1243
1382
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1244
1383
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1245
1384
  ]);
@@ -1249,7 +1388,7 @@ const et = ue("X", [
1249
1388
  * This source code is licensed under the ISC license.
1250
1389
  * See the LICENSE file in the root directory of this source tree.
1251
1390
  */
1252
- const tt = ue("ZoomIn", [
1391
+ const ot = ue("ZoomIn", [
1253
1392
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
1254
1393
  ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
1255
1394
  ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
@@ -1261,11 +1400,11 @@ const tt = ue("ZoomIn", [
1261
1400
  * This source code is licensed under the ISC license.
1262
1401
  * See the LICENSE file in the root directory of this source tree.
1263
1402
  */
1264
- const ot = ue("ZoomOut", [
1403
+ const nt = ue("ZoomOut", [
1265
1404
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
1266
1405
  ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
1267
1406
  ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
1268
- ]), nt = G.div`
1407
+ ]), ut = J.div`
1269
1408
  display: flex;
1270
1409
  align-items: center;
1271
1410
  padding: 0px 12px;
@@ -1274,28 +1413,28 @@ const ot = ue("ZoomOut", [
1274
1413
  border-bottom: 1px solid ${(e) => e.$theme.colors.border};
1275
1414
  background: ${(e) => e.$theme.colors.background};
1276
1415
  min-height: 52px;
1277
- `, ut = G.div`
1416
+ `, rt = J.div`
1278
1417
  display: flex;
1279
1418
  align-items: center;
1280
1419
  gap: 8px;
1281
1420
  flex: 1;
1282
1421
  min-width: 0;
1283
- `, rt = G.div`
1422
+ `, lt = J.div`
1284
1423
  font-size: 14px;
1285
1424
  font-weight: 500;
1286
1425
  color: ${(e) => e.$theme.colors.text};
1287
1426
  white-space: nowrap;
1288
1427
  overflow: hidden;
1289
1428
  text-overflow: ellipsis;
1290
- `, lt = G.div`
1429
+ `, at = J.div`
1291
1430
  font-size: 12px;
1292
1431
  color: ${(e) => e.$theme.colors.disabledText};
1293
1432
  white-space: nowrap;
1294
- `, st = G.div`
1433
+ `, it = J.div`
1295
1434
  display: flex;
1296
1435
  align-items: center;
1297
1436
  gap: 4px;
1298
- `, ne = G.button`
1437
+ `, ne = J.button`
1299
1438
  display: flex;
1300
1439
  align-items: center;
1301
1440
  justify-content: center;
@@ -1323,12 +1462,12 @@ const ot = ue("ZoomOut", [
1323
1462
  opacity: 0.5;
1324
1463
  cursor: not-allowed;
1325
1464
  }
1326
- `, it = G.div`
1465
+ `, st = J.div`
1327
1466
  font-size: 12px;
1328
1467
  color: ${(e) => e.$theme.colors.disabledText};
1329
1468
  min-width: 40px;
1330
1469
  text-align: center;
1331
- `, at = {
1470
+ `, ct = {
1332
1471
  colors: {
1333
1472
  primary: "#007bff",
1334
1473
  secondary: "#6c757d",
@@ -1365,100 +1504,100 @@ const ot = ue("ZoomOut", [
1365
1504
  rotate: !0
1366
1505
  },
1367
1506
  styles: r,
1368
- onPrevPage: d,
1369
- onNextPage: p,
1507
+ onPrevPage: i,
1508
+ onNextPage: v,
1370
1509
  onZoomIn: f,
1371
- onZoomOut: g,
1510
+ onZoomOut: s,
1372
1511
  onAnnotationToggle: h,
1373
- onDownload: v,
1374
- onRotateLeft: b,
1512
+ onDownload: p,
1513
+ onRotateLeft: B,
1375
1514
  onRotateRight: w,
1376
- onClose: B,
1377
- scale: a = 1,
1515
+ onClose: x,
1516
+ scale: C = 1,
1378
1517
  isAnnotating: l = !1,
1379
- className: D
1518
+ className: F
1380
1519
  }) => {
1381
- const C = (r == null ? void 0 : r.theme) || at;
1382
- return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(nt, { $theme: C, className: D }, /* @__PURE__ */ n.createElement(ut, { $theme: C }, /* @__PURE__ */ n.createElement(rt, { $theme: C }, e)), /* @__PURE__ */ n.createElement(st, { $theme: C }, u.navigation && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1520
+ const b = (r == null ? void 0 : r.theme) || ct;
1521
+ return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(ut, { $theme: b, className: F }, /* @__PURE__ */ n.createElement(rt, { $theme: b }, /* @__PURE__ */ n.createElement(lt, { $theme: b }, e)), /* @__PURE__ */ n.createElement(it, { $theme: b }, u.navigation && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1383
1522
  ne,
1384
1523
  {
1385
- $theme: C,
1386
- onClick: d,
1524
+ $theme: b,
1525
+ onClick: i,
1387
1526
  disabled: t <= 1,
1388
1527
  title: "\u4E0A\u4E00\u9875"
1389
1528
  },
1390
- /* @__PURE__ */ n.createElement(Ye, { size: 16 })
1391
- ), o > 0 && /* @__PURE__ */ n.createElement(lt, { $theme: C }, t, " / ", o), /* @__PURE__ */ n.createElement(
1529
+ /* @__PURE__ */ n.createElement(Ge, { size: 16 })
1530
+ ), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme: b }, t, " / ", o), /* @__PURE__ */ n.createElement(
1392
1531
  ne,
1393
1532
  {
1394
- $theme: C,
1395
- onClick: p,
1533
+ $theme: b,
1534
+ onClick: v,
1396
1535
  disabled: !o || t >= o,
1397
1536
  title: "\u4E0B\u4E00\u9875"
1398
1537
  },
1399
- /* @__PURE__ */ n.createElement(Ge, { size: 16 })
1538
+ /* @__PURE__ */ n.createElement(Ve, { size: 16 })
1400
1539
  )), u.zoom && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1401
1540
  ne,
1402
1541
  {
1403
- $theme: C,
1404
- onClick: g,
1405
- disabled: a <= 0.3,
1542
+ $theme: b,
1543
+ onClick: s,
1544
+ disabled: C <= 0.3,
1406
1545
  title: "\u7F29\u5C0F"
1407
1546
  },
1408
- /* @__PURE__ */ n.createElement(ot, { size: 16 })
1409
- ), /* @__PURE__ */ n.createElement(it, { $theme: C }, Math.round(a * 100), "%"), /* @__PURE__ */ n.createElement(
1547
+ /* @__PURE__ */ n.createElement(nt, { size: 16 })
1548
+ ), /* @__PURE__ */ n.createElement(st, { $theme: b }, Math.round(C * 100), "%"), /* @__PURE__ */ n.createElement(
1410
1549
  ne,
1411
1550
  {
1412
- $theme: C,
1551
+ $theme: b,
1413
1552
  onClick: f,
1414
- disabled: a >= 3,
1553
+ disabled: C >= 3,
1415
1554
  title: "\u653E\u5927"
1416
1555
  },
1417
- /* @__PURE__ */ n.createElement(tt, { size: 16 })
1556
+ /* @__PURE__ */ n.createElement(ot, { size: 16 })
1418
1557
  )), u.annotation && /* @__PURE__ */ n.createElement(
1419
1558
  ne,
1420
1559
  {
1421
- $theme: C,
1560
+ $theme: b,
1422
1561
  $active: l,
1423
1562
  onClick: h,
1424
1563
  title: l ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
1425
1564
  },
1426
- /* @__PURE__ */ n.createElement(Je, { size: 16 })
1565
+ /* @__PURE__ */ n.createElement(Ke, { size: 16 })
1427
1566
  ), u.download && /* @__PURE__ */ n.createElement(
1428
1567
  ne,
1429
1568
  {
1430
- $theme: C,
1431
- onClick: v,
1569
+ $theme: b,
1570
+ onClick: p,
1432
1571
  title: "\u4E0B\u8F7D"
1433
1572
  },
1434
- /* @__PURE__ */ n.createElement(Ve, { size: 16 })
1573
+ /* @__PURE__ */ n.createElement(Je, { size: 16 })
1435
1574
  ), u.rotate && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1436
1575
  ne,
1437
1576
  {
1438
- $theme: C,
1439
- onClick: b,
1577
+ $theme: b,
1578
+ onClick: B,
1440
1579
  title: "\u5411\u5DE6\u65CB\u8F6C"
1441
1580
  },
1442
- /* @__PURE__ */ n.createElement(Ke, { size: 16 })
1581
+ /* @__PURE__ */ n.createElement(Qe, { size: 16 })
1443
1582
  ), /* @__PURE__ */ n.createElement(
1444
1583
  ne,
1445
1584
  {
1446
- $theme: C,
1585
+ $theme: b,
1447
1586
  onClick: w,
1448
1587
  title: "\u5411\u53F3\u65CB\u8F6C"
1449
1588
  },
1450
- /* @__PURE__ */ n.createElement(Qe, { size: 16 })
1589
+ /* @__PURE__ */ n.createElement(et, { size: 16 })
1451
1590
  )), u.close && /* @__PURE__ */ n.createElement(
1452
1591
  ne,
1453
1592
  {
1454
- $theme: C,
1455
- onClick: B,
1593
+ $theme: b,
1594
+ onClick: x,
1456
1595
  title: "\u5173\u95ED"
1457
1596
  },
1458
- /* @__PURE__ */ n.createElement(et, { size: 16 })
1597
+ /* @__PURE__ */ n.createElement(tt, { size: 16 })
1459
1598
  )));
1460
- }), ct = () => {
1461
- if (Ct()) {
1599
+ }), dt = () => {
1600
+ if (vt()) {
1462
1601
  console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");
1463
1602
  return;
1464
1603
  }
@@ -1467,28 +1606,28 @@ const ot = ue("ZoomOut", [
1467
1606
  registerPDFWorker("/worker/pdf.worker.min.js");
1468
1607
  \u6CE8\u610F\uFF1AWorker \u6587\u4EF6\u8DEF\u5F84\u9700\u8981\u6839\u636E\u5B9E\u9645\u90E8\u7F72\u60C5\u51B5\u8C03\u6574\u3002`;
1469
1608
  throw console.error(e), new Error(e);
1470
- }, be = (e, t, o) => {
1609
+ }, xe = (e, t, o) => {
1471
1610
  if (!e && !t && !o) return "unknown";
1472
1611
  const u = e || "", r = t || "";
1473
1612
  return u.toLowerCase().endsWith(".pdf") || r === "pdf" || (o == null ? void 0 : o.type) === "pdf" ? "pdf" : u.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/) || r === "image" || (o == null ? void 0 : o.type) === "image" ? "image" : u.toLowerCase().endsWith(".md") || r === "markdown" || (o == null ? void 0 : o.type) === "markdown" ? r === "markdown_table" || (o == null ? void 0 : o.type) === "markdown_table" ? "markdown_table" : "markdown" : u.toLowerCase().match(/\.(html|htm)$/) || r === "html" || (o == null ? void 0 : o.type) === "html" ? "html" : u.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/) || r === "text" || (o == null ? void 0 : o.type) === "text" ? "text" : "unknown";
1474
- }, dt = async (e, t = {}) => {
1613
+ }, mt = async (e, t = {}) => {
1475
1614
  console.log("=== parsePdfFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
1476
1615
  try {
1477
- ct();
1616
+ dt();
1478
1617
  let o;
1479
1618
  if (typeof e == "string") {
1480
1619
  console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
1481
- const d = re.getDocument({
1620
+ const i = re.getDocument({
1482
1621
  url: e,
1483
1622
  httpHeaders: t.token ? { Authorization: t.token } : void 0
1484
1623
  });
1485
- console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", d), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof d), console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(d))), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:", Object.keys(d)), o = await d.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o), console.log("PDF\u6587\u6863\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(o))), console.log("PDF\u6587\u6863\u5C5E\u6027:", Object.keys(o));
1624
+ console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", i), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof i), console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(i))), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:", Object.keys(i)), o = await i.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o), console.log("PDF\u6587\u6863\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(o))), console.log("PDF\u6587\u6863\u5C5E\u6027:", Object.keys(o));
1486
1625
  } else {
1487
1626
  console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");
1488
- const d = re.getDocument({
1627
+ const i = re.getDocument({
1489
1628
  data: e
1490
1629
  });
1491
- console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", d), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof d), o = await d.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o);
1630
+ console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", i), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof i), o = await i.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o);
1492
1631
  }
1493
1632
  const u = o.numPages;
1494
1633
  console.log("PDF\u52A0\u8F7D\u6210\u529F\uFF0C\u603B\u9875\u6570:", u), console.log("PDF\u6307\u7EB9:", o.fingerprints), console.log("PDF\u4F20\u8F93\u5BF9\u8C61:", o._transport);
@@ -1521,7 +1660,7 @@ const ot = ue("ZoomOut", [
1521
1660
  error: u
1522
1661
  };
1523
1662
  }
1524
- }, mt = async (e, t = {}) => {
1663
+ }, gt = async (e, t = {}) => {
1525
1664
  console.log("=== parseImageFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
1526
1665
  try {
1527
1666
  let o;
@@ -1532,21 +1671,21 @@ const ot = ue("ZoomOut", [
1532
1671
  const r = new Blob([e]);
1533
1672
  o = URL.createObjectURL(r);
1534
1673
  }
1535
- console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r, d) => {
1536
- const p = new Image();
1537
- p.onload = () => {
1538
- console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", p.width, "x", p.height), r();
1539
- }, p.onerror = () => {
1540
- console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), d(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1674
+ console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r, i) => {
1675
+ const v = new Image();
1676
+ v.onload = () => {
1677
+ console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", v.width, "x", v.height), r();
1678
+ }, v.onerror = () => {
1679
+ console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), i(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1541
1680
  };
1542
1681
  const f = setTimeout(() => {
1543
- d(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
1682
+ i(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
1544
1683
  }, 1e4);
1545
- p.onload = () => {
1546
- clearTimeout(f), console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", p.width, "x", p.height), r();
1547
- }, p.onerror = () => {
1548
- clearTimeout(f), console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), d(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1549
- }, p.src = o;
1684
+ v.onload = () => {
1685
+ clearTimeout(f), console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", v.width, "x", v.height), r();
1686
+ }, v.onerror = () => {
1687
+ clearTimeout(f), console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), i(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1688
+ }, v.src = o;
1550
1689
  });
1551
1690
  const u = {
1552
1691
  type: "image",
@@ -1567,7 +1706,7 @@ const ot = ue("ZoomOut", [
1567
1706
  error: `\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
1568
1707
  };
1569
1708
  }
1570
- }, gt = async (e, t = {}) => {
1709
+ }, ft = async (e, t = {}) => {
1571
1710
  try {
1572
1711
  let o;
1573
1712
  if (typeof e == "string") {
@@ -1597,7 +1736,7 @@ const ot = ue("ZoomOut", [
1597
1736
  error: `\u6587\u672C\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
1598
1737
  };
1599
1738
  }
1600
- }, ft = async (e, t = {}) => {
1739
+ }, Et = async (e, t = {}) => {
1601
1740
  try {
1602
1741
  let o;
1603
1742
  if (typeof e == "string") {
@@ -1627,7 +1766,7 @@ const ot = ue("ZoomOut", [
1627
1766
  error: `Markdown\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
1628
1767
  };
1629
1768
  }
1630
- }, Et = async (e, t = {}) => {
1769
+ }, ht = async (e, t = {}) => {
1631
1770
  console.log("=== parseHtmlFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
1632
1771
  try {
1633
1772
  let o;
@@ -1660,19 +1799,19 @@ const ot = ue("ZoomOut", [
1660
1799
  error: `HTML\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
1661
1800
  };
1662
1801
  }
1663
- }, ht = async (e, t = {}) => {
1664
- switch (be(t.fileName, t.fileType)) {
1802
+ }, Ft = async (e, t = {}) => {
1803
+ switch (xe(t.fileName, t.fileType)) {
1665
1804
  case "pdf":
1666
- return await dt(e, t);
1667
- case "image":
1668
1805
  return await mt(e, t);
1669
- case "text":
1806
+ case "image":
1670
1807
  return await gt(e, t);
1808
+ case "text":
1809
+ return await ft(e, t);
1671
1810
  case "markdown":
1672
1811
  case "markdown_table":
1673
- return await ft(e, t);
1674
- case "html":
1675
1812
  return await Et(e, t);
1813
+ case "html":
1814
+ return await ht(e, t);
1676
1815
  default:
1677
1816
  return {
1678
1817
  type: "unknown",
@@ -1682,7 +1821,7 @@ const ot = ue("ZoomOut", [
1682
1821
  error: "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"
1683
1822
  };
1684
1823
  }
1685
- }, de = G.div`
1824
+ }, de = J.div`
1686
1825
  display: flex;
1687
1826
  flex-direction: column;
1688
1827
  height: 100%;
@@ -1692,65 +1831,113 @@ const ot = ue("ZoomOut", [
1692
1831
  border-radius: ${(e) => e.$theme.space.radius};
1693
1832
  overflow: hidden;
1694
1833
  min-height: 0; /* 确保flex子元素可以收缩 */
1695
- `, Ft = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement("div", { style: {
1696
- display: "flex",
1697
- flexDirection: "column",
1698
- alignItems: "center",
1699
- justifyContent: "center",
1700
- height: "100%",
1701
- padding: "40px",
1702
- background: t.colors.background
1703
- } }, /* @__PURE__ */ n.createElement("div", { style: {
1704
- position: "relative",
1705
- width: "80px",
1706
- height: "80px",
1707
- marginBottom: "24px"
1708
- } }, /* @__PURE__ */ n.createElement("div", { style: {
1709
- width: "60px",
1710
- height: "80px",
1711
- background: t.colors.primary,
1712
- borderRadius: "8px 8px 0 0",
1713
- position: "relative",
1714
- margin: "0 auto"
1715
- } }, /* @__PURE__ */ n.createElement("div", { style: {
1716
- position: "absolute",
1717
- top: "0",
1718
- right: "0",
1719
- width: "0",
1720
- height: "0",
1721
- borderStyle: "solid",
1722
- borderWidth: "0 20px 20px 0",
1723
- borderColor: `transparent ${t.colors.background} transparent transparent`
1724
- } })), /* @__PURE__ */ n.createElement("div", { style: {
1725
- position: "absolute",
1726
- top: "50%",
1727
- left: "50%",
1728
- transform: "translate(-50%, -50%)",
1729
- width: "20px",
1730
- height: "20px",
1731
- borderRadius: "50%",
1732
- background: t.colors.background,
1733
- animation: "pulse 1.5s ease-in-out infinite"
1734
- } })), /* @__PURE__ */ n.createElement("div", { style: {
1735
- fontSize: "16px",
1736
- fontWeight: "500",
1737
- color: t.colors.text,
1738
- marginBottom: "8px",
1739
- textAlign: "center"
1740
- } }, e), /* @__PURE__ */ n.createElement("div", { style: {
1741
- width: "200px",
1742
- height: "4px",
1743
- background: t.colors.border,
1744
- borderRadius: "2px",
1745
- overflow: "hidden",
1746
- position: "relative"
1747
- } }, /* @__PURE__ */ n.createElement("div", { style: {
1748
- width: "30%",
1749
- height: "100%",
1750
- background: t.colors.primary,
1751
- borderRadius: "2px",
1752
- animation: "loading-progress 2s ease-in-out infinite"
1753
- } })), /* @__PURE__ */ n.createElement("style", null, `
1834
+ `, pt = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement(
1835
+ "div",
1836
+ {
1837
+ style: {
1838
+ display: "flex",
1839
+ flexDirection: "column",
1840
+ alignItems: "center",
1841
+ justifyContent: "center",
1842
+ height: "100%",
1843
+ padding: "40px",
1844
+ background: t.colors.background
1845
+ }
1846
+ },
1847
+ /* @__PURE__ */ n.createElement(
1848
+ "div",
1849
+ {
1850
+ style: {
1851
+ position: "relative",
1852
+ width: "80px",
1853
+ height: "80px",
1854
+ marginBottom: "24px"
1855
+ }
1856
+ },
1857
+ /* @__PURE__ */ n.createElement(
1858
+ "div",
1859
+ {
1860
+ style: {
1861
+ width: "60px",
1862
+ height: "80px",
1863
+ background: t.colors.primary,
1864
+ borderRadius: "8px 8px 0 0",
1865
+ position: "relative",
1866
+ margin: "0 auto"
1867
+ }
1868
+ },
1869
+ /* @__PURE__ */ n.createElement(
1870
+ "div",
1871
+ {
1872
+ style: {
1873
+ position: "absolute",
1874
+ top: "0",
1875
+ right: "0",
1876
+ width: "0",
1877
+ height: "0",
1878
+ borderStyle: "solid",
1879
+ borderWidth: "0 20px 20px 0",
1880
+ borderColor: `transparent ${t.colors.background} transparent transparent`
1881
+ }
1882
+ }
1883
+ )
1884
+ ),
1885
+ /* @__PURE__ */ n.createElement(
1886
+ "div",
1887
+ {
1888
+ style: {
1889
+ position: "absolute",
1890
+ top: "50%",
1891
+ left: "50%",
1892
+ transform: "translate(-50%, -50%)",
1893
+ width: "20px",
1894
+ height: "20px",
1895
+ borderRadius: "50%",
1896
+ background: t.colors.background,
1897
+ animation: "pulse 1.5s ease-in-out infinite"
1898
+ }
1899
+ }
1900
+ )
1901
+ ),
1902
+ /* @__PURE__ */ n.createElement(
1903
+ "div",
1904
+ {
1905
+ style: {
1906
+ fontSize: "16px",
1907
+ fontWeight: "500",
1908
+ color: t.colors.text,
1909
+ marginBottom: "8px",
1910
+ textAlign: "center"
1911
+ }
1912
+ },
1913
+ e
1914
+ ),
1915
+ /* @__PURE__ */ n.createElement(
1916
+ "div",
1917
+ {
1918
+ style: {
1919
+ width: "200px",
1920
+ height: "4px",
1921
+ background: t.colors.border,
1922
+ borderRadius: "2px",
1923
+ overflow: "hidden",
1924
+ position: "relative"
1925
+ }
1926
+ },
1927
+ /* @__PURE__ */ n.createElement(
1928
+ "div",
1929
+ {
1930
+ style: {
1931
+ width: "30%",
1932
+ height: "100%",
1933
+ background: t.colors.primary,
1934
+ borderRadius: "2px",
1935
+ animation: "loading-progress 2s ease-in-out infinite"
1936
+ }
1937
+ }
1938
+ )
1939
+ ),
1940
+ /* @__PURE__ */ n.createElement("style", null, `
1754
1941
  @keyframes pulse {
1755
1942
  0%, 100% {
1756
1943
  opacity: 1;
@@ -1773,8 +1960,9 @@ const ot = ue("ZoomOut", [
1773
1960
  transform: translateX(100%);
1774
1961
  }
1775
1962
  }
1776
- `));
1777
- G.div`
1963
+ `)
1964
+ );
1965
+ J.div`
1778
1966
  display: flex;
1779
1967
  align-items: center;
1780
1968
  justify-content: center;
@@ -1782,7 +1970,7 @@ G.div`
1782
1970
  color: ${(e) => e.$theme.colors.disabledText};
1783
1971
  font-size: 14px;
1784
1972
  `;
1785
- const pe = G.div`
1973
+ const Ce = J.div`
1786
1974
  display: flex;
1787
1975
  flex-direction: column;
1788
1976
  align-items: center;
@@ -1791,7 +1979,7 @@ const pe = G.div`
1791
1979
  color: ${(e) => e.$theme.colors.error};
1792
1980
  text-align: center;
1793
1981
  padding: 20px;
1794
- `, pt = {
1982
+ `, Ct = {
1795
1983
  colors: {
1796
1984
  primary: "#007bff",
1797
1985
  secondary: "#6c757d",
@@ -1815,17 +2003,17 @@ const pe = G.div`
1815
2003
  shadow: "md",
1816
2004
  lineHeight: "md"
1817
2005
  }
1818
- }, bt = ({
2006
+ }, xt = ({
1819
2007
  fileUrl: e,
1820
2008
  fileType: t,
1821
2009
  annotations: o,
1822
2010
  fileName: u,
1823
2011
  token: r,
1824
- initialPage: d = 1,
1825
- data: p,
2012
+ initialPage: i = 1,
2013
+ data: v,
1826
2014
  eventsEmit: f = () => {
1827
2015
  },
1828
- styles: g,
2016
+ styles: s,
1829
2017
  tools: h = {
1830
2018
  annotation: !1,
1831
2019
  download: !1,
@@ -1833,121 +2021,124 @@ const pe = G.div`
1833
2021
  close: !0,
1834
2022
  navigation: !0
1835
2023
  },
1836
- customComponents: v,
1837
- className: b,
2024
+ customComponents: p,
2025
+ className: B,
1838
2026
  headerClass: w,
1839
- contentClass: B
2027
+ contentClass: x
1840
2028
  }) => {
1841
- var a;
1842
- const l = (g == null ? void 0 : g.theme) || pt, [D, C] = R(!0), [q, N] = R("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [c, x] = R(null), [F, k] = R(null), [O, L] = R(d), [A, P] = R(1), [V, ee] = R(0), [J, s] = R(!1), i = $(() => {
1843
- C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0), s(!1);
1844
- }, [d]), y = $(async () => {
1845
- var E, z;
1846
- if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }), i(), p) {
1847
- C(!1), x(null), k({
1848
- type: p.fileType || t || "text",
1849
- content: p.content,
1850
- fileName: p.fileName || u,
1851
- fileType: p.fileType || t,
1852
- totalPages: p.totalPages || 1
2029
+ var C;
2030
+ const l = (s == null ? void 0 : s.theme) || Ct, [F, b] = z(!0), [S, M] = z("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [d, y] = z(null), [g, I] = z(null), [U, Q] = z(i), [k, _] = z(1), [Y, A] = z(0), [X, P] = z(!1), c = $(() => {
2031
+ b(!0), M("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), y(null), I(null), Q(i), A(0), P(!1);
2032
+ }, [i]), a = $(async () => {
2033
+ var E, L;
2034
+ if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: v }), c(), v) {
2035
+ b(!1), y(null), I({
2036
+ type: v.fileType || t || "text",
2037
+ content: v.content,
2038
+ fileName: v.fileName || u,
2039
+ fileType: v.fileType || t,
2040
+ totalPages: v.totalPages || 1
1853
2041
  });
1854
2042
  return;
1855
2043
  }
1856
2044
  if (!e) {
1857
- x("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), C(!1);
2045
+ y("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), b(!1);
1858
2046
  return;
1859
2047
  }
1860
2048
  try {
1861
- C(!0), x(null);
1862
- const Y = be(u, t);
1863
- N(Y === "image" ? "\u56FE\u7247\u4E0B\u8F7D\u4E2D..." : Y === "pdf" ? "PDF\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : Y === "markdown" || Y === "markdown_table" ? "Markdown\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : "\u6587\u4EF6\u4E0B\u8F7D\u4E2D...");
1864
- const S = await ht(e, {
2049
+ b(!0), y(null);
2050
+ const K = xe(u, t);
2051
+ M(K === "image" ? "\u56FE\u7247\u4E0B\u8F7D\u4E2D..." : K === "pdf" ? "PDF\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : K === "markdown" || K === "markdown_table" ? "Markdown\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : "\u6587\u4EF6\u4E0B\u8F7D\u4E2D...");
2052
+ const W = await Ft(e, {
1865
2053
  fileName: u,
1866
2054
  fileType: t,
1867
2055
  token: r
1868
2056
  });
1869
- console.log("=== StaticFileReader parseFile \u7ED3\u679C ==="), console.log("result:", S), console.log("result.type:", S.type), console.log("result.content:", S.content), console.log("result.content?.text:", (E = S.content) == null ? void 0 : E.text), console.log("result.fileName:", S.fileName), console.log("result.fileType:", S.fileType), S.error ? x(S.error) : (S.type === "image" ? N("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210") : S.type === "pdf" ? N("PDF\u52A0\u8F7D\u5B8C\u6210") : S.type === "markdown" || S.type === "markdown_table" ? N("Markdown\u52A0\u8F7D\u5B8C\u6210") : N("\u6587\u4EF6\u52A0\u8F7D\u5B8C\u6210"), console.log("=== parseResult \u8BBE\u7F6E ==="), console.log("parseResult:", S), console.log("parseResult.content:", S.content), console.log("parseResult.content.document:", (z = S.content) == null ? void 0 : z.document), k(S));
1870
- } catch (Y) {
1871
- x(`\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25: ${Y instanceof Error ? Y.message : "\u672A\u77E5\u9519\u8BEF"}`);
2057
+ console.log("=== StaticFileReader parseFile \u7ED3\u679C ==="), console.log("result:", W), console.log("result.type:", W.type), console.log("result.content:", W.content), console.log("result.content?.text:", (E = W.content) == null ? void 0 : E.text), console.log("result.fileName:", W.fileName), console.log("result.fileType:", W.fileType), W.error ? y(W.error) : (W.type === "image" ? M("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210") : W.type === "pdf" ? M("PDF\u52A0\u8F7D\u5B8C\u6210") : W.type === "markdown" || W.type === "markdown_table" ? M("Markdown\u52A0\u8F7D\u5B8C\u6210") : M("\u6587\u4EF6\u52A0\u8F7D\u5B8C\u6210"), console.log("=== parseResult \u8BBE\u7F6E ==="), console.log("parseResult:", W), console.log("parseResult.content:", W.content), console.log("parseResult.content.document:", (L = W.content) == null ? void 0 : L.document), I(W));
2058
+ } catch (K) {
2059
+ y(`\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25: ${K instanceof Error ? K.message : "\u672A\u77E5\u9519\u8BEF"}`);
1872
2060
  } finally {
1873
- C(!1);
2061
+ b(!1);
1874
2062
  }
1875
- }, [e, u, t, r, p, i]);
2063
+ }, [e, u, t, r, v, c]);
1876
2064
  te(() => {
1877
- y();
1878
- }, [y]);
1879
- const m = $((E, z, Y) => {
1880
- switch (E) {
1881
- case "pageChange":
1882
- z != null && z.pageNumber && L(z.pageNumber);
1883
- break;
1884
- // if (data?.annotationId) {
1885
- // setAnnotations(prev => prev.filter(a => a.id !== data.annotationId));
1886
- // }
1887
- // break;
1888
- default:
1889
- f(E, z, Y);
1890
- break;
1891
- }
1892
- }, [f]), _ = $(() => {
1893
- const E = Math.min(3, A + 0.1);
1894
- P(E), m("zoom:change", { scale: E });
1895
- }, [A, m]), T = $(() => {
1896
- const E = Math.max(0.3, A - 0.1);
1897
- P(E), m("zoom:change", { scale: E });
1898
- }, [A, m]), I = $(() => {
1899
- if (O > 1) {
1900
- const E = O - 1;
1901
- L(E), m("page:change", { page: E });
2065
+ a();
2066
+ }, [a]);
2067
+ const m = $(
2068
+ (E, L, K) => {
2069
+ switch (E) {
2070
+ case "pageChange":
2071
+ L != null && L.pageNumber && Q(L.pageNumber);
2072
+ break;
2073
+ // if (data?.annotationId) {
2074
+ // setAnnotations(prev => prev.filter(a => a.id !== data.annotationId));
2075
+ // }
2076
+ // break;
2077
+ default:
2078
+ f(E, L, K);
2079
+ break;
2080
+ }
2081
+ },
2082
+ [f]
2083
+ ), D = $(() => {
2084
+ const E = Math.min(3, k + 0.1);
2085
+ _(E), m("zoom:change", { scale: E });
2086
+ }, [k, m]), R = $(() => {
2087
+ const E = Math.max(0.3, k - 0.1);
2088
+ _(E), m("zoom:change", { scale: E });
2089
+ }, [k, m]), H = $(() => {
2090
+ if (U > 1) {
2091
+ const E = U - 1;
2092
+ Q(E), m("page:change", { page: E });
1902
2093
  }
1903
- }, [O, m]), Z = $(() => {
1904
- const E = (F == null ? void 0 : F.totalPages) || 0;
1905
- if (E && O < E) {
1906
- const z = O + 1;
1907
- L(z), m("page:change", { page: z });
2094
+ }, [U, m]), q = $(() => {
2095
+ const E = (g == null ? void 0 : g.totalPages) || 0;
2096
+ if (E && U < E) {
2097
+ const L = U + 1;
2098
+ Q(L), m("page:change", { page: L });
1908
2099
  }
1909
- }, [O, F == null ? void 0 : F.totalPages, m]), U = $(() => {
1910
- const E = !J;
1911
- s(E), m("annotation:toggle", { isAnnotating: E });
1912
- }, [J, m]), M = $(() => {
2100
+ }, [U, g == null ? void 0 : g.totalPages, m]), G = $(() => {
2101
+ const E = !X;
2102
+ P(E), m("annotation:toggle", { isAnnotating: E });
2103
+ }, [X, m]), ee = $(() => {
1913
2104
  m("download:start", { fileUrl: e, fileName: u });
1914
- }, [m, e, u]), j = $(() => {
1915
- ee((E) => (E - 90) % 360), m("rotate:left", { rotation: (V - 90) % 360 });
1916
- }, [V, m]), K = $(() => {
1917
- ee((E) => (E + 90) % 360), m("rotate:right", { rotation: (V + 90) % 360 });
1918
- }, [V, m]), oe = $(() => {
2105
+ }, [m, e, u]), N = $(() => {
2106
+ A((E) => (E - 90) % 360), m("rotate:left", { rotation: (Y - 90) % 360 });
2107
+ }, [Y, m]), j = $(() => {
2108
+ A((E) => (E + 90) % 360), m("rotate:right", { rotation: (Y + 90) % 360 });
2109
+ }, [Y, m]), V = $(() => {
1919
2110
  m("viewer:close");
1920
- }, [m]), Q = $((E, z) => {
1921
- const Y = E === "pdf", S = E === "text" || E === "markdown" || E === "markdown_table" || E === "html";
2111
+ }, [m]), oe = $((E, L) => {
2112
+ const K = E === "pdf", W = E === "text" || E === "markdown" || E === "markdown_table" || E === "html";
1922
2113
  return {
1923
- ...z,
2114
+ ...L,
1924
2115
  // 缩放功能:只有 PDF 和图片支持
1925
- zoom: z.zoom && !S,
2116
+ zoom: L.zoom && !W,
1926
2117
  // 导航功能:只有多页文件支持(PDF)
1927
- navigation: z.navigation && Y,
2118
+ navigation: L.navigation && K,
1928
2119
  // 标注功能:PDF、Markdown、Markdown表格都支持
1929
- annotation: z.annotation && (E === "pdf" || E === "markdown" || E === "markdown_table"),
2120
+ annotation: L.annotation && (E === "pdf" || E === "markdown" || E === "markdown_table"),
1930
2121
  // 旋转功能:只有图片支持
1931
- rotate: z.rotate && E === "image",
2122
+ rotate: L.rotate && E === "image",
1932
2123
  // 下载功能:所有文件都支持
1933
- download: z.download,
2124
+ download: L.download,
1934
2125
  // 关闭功能:所有文件都支持
1935
- close: z.close
2126
+ close: L.close
1936
2127
  };
1937
2128
  }, []);
1938
- if (D) {
1939
- const E = Q(t || "unknown", {
2129
+ if (F) {
2130
+ const E = oe(t || "unknown", {
1940
2131
  ...h,
1941
2132
  navigation: !1
1942
2133
  });
1943
- return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
2134
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
1944
2135
  ce,
1945
2136
  {
1946
2137
  fileName: u || "\u52A0\u8F7D\u4E2D...",
1947
2138
  currentPage: 1,
1948
2139
  totalPage: 0,
1949
2140
  tools: E,
1950
- styles: g,
2141
+ styles: s,
1951
2142
  onPrevPage: () => {
1952
2143
  },
1953
2144
  onNextPage: () => {
@@ -1960,38 +2151,26 @@ const pe = G.div`
1960
2151
  },
1961
2152
  onDownload: () => {
1962
2153
  },
1963
- onClose: oe,
2154
+ onClose: V,
1964
2155
  scale: 1,
1965
2156
  isAnnotating: !1,
1966
2157
  className: w
1967
2158
  }
1968
- ), v != null && v.LoadingComponent ? /* @__PURE__ */ n.createElement(
1969
- v.LoadingComponent,
1970
- {
1971
- status: q,
1972
- theme: l
1973
- }
1974
- ) : /* @__PURE__ */ n.createElement(
1975
- Ft,
1976
- {
1977
- status: q,
1978
- theme: l
1979
- }
1980
- ));
2159
+ ), p != null && p.LoadingComponent ? /* @__PURE__ */ n.createElement(p.LoadingComponent, { status: S, theme: l }) : /* @__PURE__ */ n.createElement(pt, { status: S, theme: l }));
1981
2160
  }
1982
- if (c) {
1983
- const E = Q(t || "unknown", {
2161
+ if (d) {
2162
+ const E = oe(t || "unknown", {
1984
2163
  ...h,
1985
2164
  navigation: !1
1986
2165
  });
1987
- return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
2166
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
1988
2167
  ce,
1989
2168
  {
1990
2169
  fileName: u || "\u9519\u8BEF",
1991
2170
  currentPage: 1,
1992
2171
  totalPage: 0,
1993
2172
  tools: E,
1994
- styles: g,
2173
+ styles: s,
1995
2174
  onPrevPage: () => {
1996
2175
  },
1997
2176
  onNextPage: () => {
@@ -2004,26 +2183,26 @@ const pe = G.div`
2004
2183
  },
2005
2184
  onDownload: () => {
2006
2185
  },
2007
- onClose: oe,
2186
+ onClose: V,
2008
2187
  scale: 1,
2009
2188
  isAnnotating: !1,
2010
2189
  className: w
2011
2190
  }
2012
- ), /* @__PURE__ */ n.createElement(pe, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, c)));
2191
+ ), /* @__PURE__ */ n.createElement(Ce, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, d)));
2013
2192
  }
2014
- if (!F) {
2015
- const E = Q(t || "unknown", {
2193
+ if (!g) {
2194
+ const E = oe(t || "unknown", {
2016
2195
  ...h,
2017
2196
  navigation: !1
2018
2197
  });
2019
- return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
2198
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
2020
2199
  ce,
2021
2200
  {
2022
2201
  fileName: u || "\u672A\u77E5\u6587\u4EF6",
2023
2202
  currentPage: 1,
2024
2203
  totalPage: 0,
2025
2204
  tools: E,
2026
- styles: g,
2205
+ styles: s,
2027
2206
  onPrevPage: () => {
2028
2207
  },
2029
2208
  onNextPage: () => {
@@ -2036,64 +2215,65 @@ const pe = G.div`
2036
2215
  },
2037
2216
  onDownload: () => {
2038
2217
  },
2039
- onClose: oe,
2218
+ onClose: V,
2040
2219
  scale: 1,
2041
2220
  isAnnotating: !1,
2042
2221
  className: w
2043
2222
  }
2044
- ), /* @__PURE__ */ n.createElement(pe, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
2223
+ ), /* @__PURE__ */ n.createElement(Ce, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
2045
2224
  }
2046
- const H = {
2047
- content: F.content,
2048
- ...(F.fileName || u) && { fileName: F.fileName || u },
2049
- ...(F.fileType || t) && { fileType: F.fileType || t },
2050
- ...F.totalPages && { totalPages: F.totalPages }
2051
- }, W = Q(F.type, h);
2052
- return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", H), console.log("viewerData.content:", H.content), console.log("viewerData.content.document:", (a = H.content) == null ? void 0 : a.document), console.log("\u6587\u4EF6\u7C7B\u578B:", F.type), console.log("\u52A8\u6001\u5DE5\u5177\u914D\u7F6E:", W), console.log("=== \u6807\u6CE8\u6570\u636E\u4F20\u9012 ==="), console.log("annotations prop:", o), console.log("annotations \u957F\u5EA6:", (o == null ? void 0 : o.length) || 0), /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
2225
+ const Z = {
2226
+ content: g.content,
2227
+ ...(g.fileName || u) && { fileName: g.fileName || u },
2228
+ ...(g.fileType || t) && { fileType: g.fileType || t },
2229
+ ...g.totalPages && { totalPages: g.totalPages }
2230
+ }, T = oe(g.type, h);
2231
+ return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", Z), console.log("viewerData.content:", Z.content), console.log("viewerData.content.document:", (C = Z.content) == null ? void 0 : C.document), console.log("\u6587\u4EF6\u7C7B\u578B:", g.type), console.log("\u52A8\u6001\u5DE5\u5177\u914D\u7F6E:", T), console.log("=== \u6807\u6CE8\u6570\u636E\u4F20\u9012 ==="), console.log("annotations prop:", o), console.log("annotations \u957F\u5EA6:", (o == null ? void 0 : o.length) || 0), /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
2053
2232
  ce,
2054
2233
  {
2055
- fileName: H.fileName || F.fileName || u || "\u672A\u77E5\u6587\u4EF6",
2056
- currentPage: F.type === "pdf" ? O : 1,
2057
- totalPage: F.type === "pdf" && F.totalPages || 0,
2058
- tools: W,
2059
- styles: g,
2060
- onPrevPage: F.type === "pdf" ? I : () => {
2234
+ fileName: Z.fileName || g.fileName || u || "\u672A\u77E5\u6587\u4EF6",
2235
+ currentPage: g.type === "pdf" ? U : 1,
2236
+ totalPage: g.type === "pdf" && g.totalPages || 0,
2237
+ tools: T,
2238
+ styles: s,
2239
+ onPrevPage: g.type === "pdf" ? H : () => {
2061
2240
  },
2062
- onNextPage: F.type === "pdf" ? Z : () => {
2241
+ onNextPage: g.type === "pdf" ? q : () => {
2063
2242
  },
2064
- onZoomIn: W.zoom ? _ : () => {
2243
+ onZoomIn: T.zoom ? D : () => {
2065
2244
  },
2066
- onZoomOut: W.zoom ? T : () => {
2245
+ onZoomOut: T.zoom ? R : () => {
2067
2246
  },
2068
- onAnnotationToggle: W.annotation ? U : () => {
2247
+ onAnnotationToggle: T.annotation ? G : () => {
2069
2248
  },
2070
- onDownload: W.download ? M : () => {
2249
+ onDownload: T.download ? ee : () => {
2071
2250
  },
2072
- onRotateLeft: W.rotate ? j : () => {
2251
+ onRotateLeft: T.rotate ? N : () => {
2073
2252
  },
2074
- onRotateRight: W.rotate ? K : () => {
2253
+ onRotateRight: T.rotate ? j : () => {
2075
2254
  },
2076
- onClose: oe,
2077
- scale: A,
2078
- isAnnotating: J,
2255
+ onClose: V,
2256
+ scale: k,
2257
+ isAnnotating: X,
2079
2258
  className: w
2080
2259
  }
2081
2260
  ), /* @__PURE__ */ n.createElement(
2082
- Ze,
2261
+ Xe,
2083
2262
  {
2084
- data: H,
2263
+ data: Z,
2085
2264
  annotationData: o || [],
2086
- totalPage: F.type === "pdf" && F.totalPages || 0,
2087
- currentPage: F.type === "pdf" ? O : 1,
2088
- scale: A,
2089
- rotation: V,
2265
+ totalPage: g.type === "pdf" && g.totalPages || 0,
2266
+ currentPage: g.type === "pdf" ? U : 1,
2267
+ scale: k,
2268
+ rotation: Y,
2090
2269
  eventsEmit: m,
2091
- styles: g,
2092
- tools: W,
2093
- className: B
2270
+ styles: s,
2271
+ tools: T,
2272
+ className: x,
2273
+ setScale: _
2094
2274
  }
2095
2275
  ));
2096
- }, Ct = () => !!re.GlobalWorkerOptions.workerSrc, xt = () => re.GlobalWorkerOptions.workerSrc, Dt = (e = "/worker/pdf.worker.min.js") => {
2276
+ }, vt = () => !!re.GlobalWorkerOptions.workerSrc, Dt = () => re.GlobalWorkerOptions.workerSrc, Bt = (e = "/worker/pdf.worker.min.js") => {
2097
2277
  try {
2098
2278
  if (re.GlobalWorkerOptions.workerSrc) {
2099
2279
  console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:", re.GlobalWorkerOptions.workerSrc);
@@ -2105,16 +2285,16 @@ const pe = G.div`
2105
2285
  }
2106
2286
  };
2107
2287
  export {
2108
- Ze as Fviewer,
2109
- bt as StaticFileReader,
2110
- be as detectFileType,
2111
- xt as getPDFWorkerPath,
2112
- Ct as isPDFWorkerRegistered,
2113
- ht as parseFile,
2114
- mt as parseImageFile,
2115
- ft as parseMarkdownFile,
2116
- dt as parsePdfFile,
2117
- gt as parseTextFile,
2118
- Dt as registerPDFWorker
2288
+ Xe as Fviewer,
2289
+ xt as StaticFileReader,
2290
+ xe as detectFileType,
2291
+ Dt as getPDFWorkerPath,
2292
+ vt as isPDFWorkerRegistered,
2293
+ Ft as parseFile,
2294
+ gt as parseImageFile,
2295
+ Et as parseMarkdownFile,
2296
+ mt as parsePdfFile,
2297
+ ft as parseTextFile,
2298
+ Bt as registerPDFWorker
2119
2299
  };
2120
2300
  //# sourceMappingURL=index.js.map