@mxmweb/fviewer 1.5.4 → 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,5 +1,5 @@
1
- import n, { useRef as H, useState as P, useCallback as A, useEffect as te, forwardRef as ve, createElement as Ee } from "react";
2
- import G from "styled-components";
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
3
  import { Markdownit as we, DataType as ye } from "@mxmweb/rtext";
4
4
  import * as re from "pdfjs-dist";
5
5
  const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ke = ({
@@ -8,62 +8,62 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
8
8
  isAnnotating: o,
9
9
  annotations: u = [],
10
10
  onAnnotationAdd: r,
11
- onAnnotationDelete: c,
12
- readOnly: p = !1
11
+ onAnnotationDelete: i,
12
+ readOnly: v = !1
13
13
  }) => {
14
- const g = H(null), [m, f] = P(!1), [C, x] = P({ x: 0, y: 0 }), [v, D] = P(null), [s, a] = P(null), B = A(
15
- (i) => {
16
- if (!o || !g.current) return;
17
- const b = g.current.getBoundingClientRect(), h = (i.clientX - b.left) / b.width, j = (i.clientY - b.top) / b.height;
18
- console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: i.clientX, clientY: i.clientY, rect: b, x: h, y: j, scale: t }), f(!0), x({ x: h, y: j });
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
+ if (!o || !f.current) return;
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
- ), y = A(
22
- (i) => {
23
- if (!m || !g.current) return;
24
- const b = g.current.getBoundingClientRect(), h = (i.clientX - b.left) / b.width, j = (i.clientY - b.top) / b.height;
25
- D({
26
- x: Math.min(C.x, h),
27
- y: Math.min(C.y, j),
28
- width: Math.abs(h - C.x),
29
- height: Math.abs(j - C.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
- [m, C, t]
33
- ), Z = A(() => {
34
- if (!m || !v) return;
35
- if (f(!1), v.width < 5 || v.height < 5) {
36
- D(null);
32
+ [s, p, t]
33
+ ), S = $(() => {
34
+ if (!s || !w) return;
35
+ if (h(!1), w.width < 5 || w.height < 5) {
36
+ x(null);
37
37
  return;
38
38
  }
39
- const i = {
39
+ const d = {
40
40
  id: Be(),
41
41
  pageNumber: e,
42
- ...v,
42
+ ...w,
43
43
  content: "",
44
44
  color: De
45
45
  };
46
- r == null || r(i), D(null);
47
- }, [m, v, e, r]), z = A((i) => {
48
- a(s === i ? null : i);
49
- }, [s]);
50
- return A((i, b) => {
51
- const h = {
52
- ...i,
53
- content: b
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(h);
56
- }, [r]), A((i) => {
57
- c == null || c(i), a(null);
58
- }, [c]), 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((i) => i.pageNumber === e).length,
62
- currentPageAnnotations: u.filter((i) => i.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
  {
66
- ref: g,
66
+ ref: f,
67
67
  style: {
68
68
  position: "absolute",
69
69
  top: 0,
@@ -74,24 +74,24 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
74
74
  pointerEvents: "auto"
75
75
  // 确保可以接收鼠标事件
76
76
  },
77
- onMouseDown: B,
78
- onMouseMove: y,
79
- onMouseUp: Z,
80
- onMouseLeave: Z
77
+ onMouseDown: F,
78
+ onMouseMove: b,
79
+ onMouseUp: S,
80
+ onMouseLeave: S
81
81
  },
82
- v && /* @__PURE__ */ n.createElement(
82
+ w && /* @__PURE__ */ n.createElement(
83
83
  "div",
84
84
  {
85
85
  className: "absolute border-2 border-yellow-400 bg-yellow-100/30",
86
86
  style: {
87
- left: `${v.x * 100}%`,
88
- top: `${v.y * 100}%`,
89
- width: `${v.width * 100}%`,
90
- height: `${v.height * 100}%`
87
+ left: `${w.x * 100}%`,
88
+ top: `${w.y * 100}%`,
89
+ width: `${w.width * 100}%`,
90
+ height: `${w.height * 100}%`
91
91
  }
92
92
  }
93
93
  ),
94
- u.filter((i) => i.pageNumber === e).map((i) => (console.log("\u6E32\u67D3\u6807\u6CE8:", i.id, `\u4F4D\u7F6E: ${i.x * 100}%, ${i.y * 100}%`), /* @__PURE__ */ n.createElement("div", { key: i.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,17 +103,17 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
103
103
  className: "border border-solid",
104
104
  style: {
105
105
  position: "absolute",
106
- left: `${i.x * 100}%`,
107
- top: `${i.y * 100}%`,
108
- width: `${i.width * 100}%`,
109
- height: `${i.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: `${i.color}`,
112
- backgroundColor: `${i.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: () => z(i.id)
116
+ onClick: () => M(d.id)
117
117
  }
118
118
  ))))
119
119
  );
@@ -141,14 +141,14 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
141
141
  shadow: "md",
142
142
  lineHeight: "md"
143
143
  }
144
- }, $e = 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
- `, Pe = G.div`
151
+ `, Pe = J.div`
152
152
  display: flex;
153
153
  align-items: center;
154
154
  justify-content: center;
@@ -163,68 +163,104 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
163
163
  // 默认从第1页开始
164
164
  scale: u,
165
165
  annotations: r,
166
- isAnnotating: c,
167
- isSlidesMode: p = !1,
168
- onPageChange: g,
169
- onScaleChange: m,
170
- onAnnotationChange: f,
171
- onAnnotationDelete: C,
172
- styles: x
166
+ isAnnotating: i,
167
+ isSlidesMode: v = !1,
168
+ setScale: f,
169
+ onScaleChange: s,
170
+ onAnnotationChange: h,
171
+ onAnnotationDelete: p,
172
+ styles: B
173
173
  }) => {
174
- const [v, D] = P(!1), [s, a] = P(null), [B, y] = P(0), [Z, z] = P(0), [i, b] = P(!1), [h, j] = P(!0), q = (x == null ? void 0 : x.theme) || Ae, R = H(null), T = H(null), _ = H(!1), V = H(null), Q = A((X) => {
175
- if (!T.current || !h || !m) return null;
176
- const d = T.current, l = d.offsetWidth - 40, E = d.offsetHeight - 40, w = l / X.width, k = E / X.height, S = Math.min(w, k, 1), W = Math.max(0.3, Math.min(1, S));
177
- return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
178
- containerWidth: l,
179
- containerHeight: E,
180
- viewportWidth: X.width,
181
- viewportHeight: X.height,
182
- scaleX: w,
183
- scaleY: k,
184
- autoScale: S,
185
- finalScale: W
186
- }), W;
187
- }, [h, m]), K = A(async () => {
188
- if (!(!e || !R.current)) {
189
- if (_.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, _.current = !0;
195
- const X = 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=${X}`), X < 1 || X > e.numPages)
197
- throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${X}, 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 d = await e.getPage(X), l = R.current, E = l.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 w = d.getViewport({ scale: 1 });
201
- if (console.log("viewport\u5C3A\u5BF8:", w.width, "x", w.height), h && j(!1), l.width = w.width, l.height = w.height, await d.render({
202
- canvasContext: E,
203
- viewport: w
204
- }).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", l.width, "x", l.height), T.current) {
205
- const k = T.current;
206
- console.log("\u5BB9\u5668\u5C3A\u5BF8:", k.offsetWidth, "x", k.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", l.offsetWidth, "x", l.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 (X) {
209
- console.error("PDF\u6E32\u67D3\u5931\u8D25:", X);
217
+ } catch (A) {
218
+ console.error("PDF\u6E32\u67D3\u5931\u8D25:", A);
210
219
  } finally {
211
- _.current = !1;
220
+ I.current = !1;
212
221
  }
213
222
  }
214
- }, [e, u, o, Q, m, t]);
215
- return te(() => {
216
- e && t && o && (console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:", "pdfStartPage:" + o, "currentPage:" + t, "pdfDocument:", e), K());
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 && K();
219
- }, [u, e, t]), v ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement($e, { $theme: q }, "\u52A0\u8F7D\u4E2D...")) : s ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(Pe, { $theme: q }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, s)))) : /* @__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: T,
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 De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
232
268
  overflow: "visible"
233
269
  }
234
270
  },
235
- v ? /* @__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...")) : s ? /* @__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" }, s)) : /* @__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 De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
246
282
  /* @__PURE__ */ n.createElement(
247
283
  "canvas",
248
284
  {
249
- ref: R,
285
+ ref: y,
250
286
  className: "shadow-lg bg-white border border-gray-300",
251
287
  style: {
252
288
  display: "block"
@@ -257,17 +293,17 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
257
293
  ke,
258
294
  {
259
295
  pageNumber: t,
260
- scale: u,
261
- isAnnotating: c,
296
+ scale: u || 1,
297
+ isAnnotating: i,
262
298
  annotations: r,
263
- onAnnotationAdd: f,
264
- onAnnotationDelete: C,
265
- readOnly: !c
299
+ onAnnotationAdd: h,
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 De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
280
316
  /* 支持大尺寸内容的滚动 */
281
317
  overflow-x: auto;
282
318
  overflow-y: auto; /* 改为auto,允许垂直滚动 */
283
- `, Re = 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
- `, Ne = G.div`
325
+ `, Ne = J.div`
290
326
  display: flex;
291
327
  flex-direction: column;
292
328
  align-items: center;
@@ -404,467 +440,529 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
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
- }, Me = (e, t, o = !1) => {
408
- var u, r, c, p, g, m, f;
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:", ((c = e.content) == null ? void 0 : c.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:", (g = e.content) != null && g.document ? Object.getOwnPropertyNames(Object.getPrototypeOf(e.content.document)) : "\u65E0\u6587\u6863"), console.log("PDF\u6587\u6863\u5C5E\u6027:", (m = e.content) != null && m.document ? Object.keys(e.content.document) : "\u65E0\u6587\u6863");
410
- const C = e.pdfStartPage || 1;
411
- console.log("PDF\u8D77\u59CB\u9875:", C);
412
- const x = (t.annotationData || []).filter(
413
- (s) => "pageNumber" in s && "x" in s && "y" in s
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"
455
+ );
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
414
460
  );
415
- console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:", x);
416
- const v = o ? 0.82 : 1, D = t.initialZoom || t.scale || v;
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
464
  Te,
419
465
  {
420
- pdfDocument: ((f = e.content) == null ? void 0 : f.document) || null,
466
+ pdfDocument: ((p = e.content) == null ? void 0 : p.document) || null,
421
467
  currentPage: t.currentPage || 1,
422
- pdfStartPage: C,
423
- scale: D,
424
- annotations: x,
468
+ pdfStartPage: B,
469
+ scale: C,
470
+ setScale: u,
471
+ annotations: w,
425
472
  isAnnotating: !1,
426
473
  isSlidesMode: o,
427
- onPageChange: t.eventsEmit ? (s) => {
428
- var a;
429
- return (a = t.eventsEmit) == null ? void 0 : a.call(t, "pageChange", { pageNumber: s });
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 ? (s) => {
432
- var a;
433
- return (a = t.eventsEmit) == null ? void 0 : a.call(t, "scaleChange", { scale: s });
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 ? (s) => {
436
- var a;
437
- return (a = t.eventsEmit) == null ? void 0 : a.call(t, "annotationChange", { annotation: s });
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 ? (s) => {
440
- var a;
441
- return (a = t.eventsEmit) == null ? void 0 : a.call(t, "annotationDelete", { annotationId: s });
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
- }, We = (e, t) => {
447
- var o, u, r, c, p, g, m, f, C, x, v, D, s, a;
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 B = ((u = e.content) == null ? void 0 : u.url) || e.content, [y, Z] = P(!0), [z, i] = P(!1), b = () => {
450
- console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:", B), Z(!1), i(!1);
451
- }, h = () => {
452
- console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:", B), Z(!1), i(!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
- } }, y && /* @__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 = (c = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : c.colors) == null ? void 0 : p.border) || "#dee2e6"}`,
478
- borderTop: `3px solid ${((f = (m = (g = t.styles) == null ? void 0 : g.theme) == null ? void 0 : m.colors) == null ? void 0 : f.primary) || "#007bff"}`,
479
- borderRadius: "50%",
480
- animation: "spin 1s linear infinite"
481
- } }), /* @__PURE__ */ n.createElement("div", { style: {
482
- fontSize: "12px",
483
- color: ((v = (x = (C = t.styles) == null ? void 0 : C.theme) == null ? void 0 : x.colors) == null ? void 0 : v.text) || "#343a40"
484
- } }, "\u56FE\u7247\u52A0\u8F7D\u4E2D...")), z && /* @__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: ((a = (s = (D = t.styles) == null ? void 0 : D.theme) == null ? void 0 : s.colors) == null ? void 0 : a.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: B,
501
- alt: e.fileName || "\u56FE\u7247",
502
- onLoad: b,
503
- onError: h,
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: y ? 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
- `));
519
- }, Ie = (e, t) => {
520
- var o, u, r, c, p;
603
+ `)
604
+ );
605
+ }, We = (e, t) => {
606
+ var o, u, r, i, v;
521
607
  console.log("=== Fviewer renderTextContent ==="), console.log("data:", e), console.log("data.content:", e.content);
522
- let g = "";
523
- typeof e.content == "string" ? g = e.content : (o = e.content) != null && o.text ? g = e.content.text : (u = e.content) != null && u.content && (g = e.content.content), console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:", g);
524
- const m = H(null), f = H(null);
608
+ let f = "";
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);
610
+ const s = O(null), h = O(null);
525
611
  return te(() => {
526
- if (m.current && f.current && g) {
527
- const C = setTimeout(() => {
528
- var x;
529
- const v = ((x = m.current) == null ? void 0 : x.scrollHeight) || 0, D = Math.max(v + 80, 200);
530
- f.current && (f.current.style.minHeight = `${D}px`, console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:", D));
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(C);
618
+ return () => clearTimeout(p);
533
619
  }
534
- }, [g]), /* @__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: f,
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: m,
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
- we,
653
+ "div",
572
654
  {
573
- dataSource: {
574
- type: ye.TEXT,
575
- content: g
576
- },
577
- size: "md",
578
- theme: {
579
- primaryColor: ((p = (c = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : c.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
- ));
702
+ )
703
+ );
607
704
  }, je = ({ data: e, parentProps: t, isTableMode: o = !1 }) => {
608
- var u, r, c, p, g, m, f, C, x, v, D, s;
609
- const a = H(null), B = H(null), y = H(null), Z = H(!1);
610
- H(0), H(null);
611
- const [z] = P(!1), i = (d, l) => {
612
- console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: d, scrollHeight: l }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: d, scrollHeight: l });
613
- }, b = () => {
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
- }, h = () => {
712
+ }, g = () => {
616
713
  console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_bottom");
617
- }, j = H();
618
- j.current = (d) => {
619
- var l, E;
714
+ }, I = O();
715
+ I.current = (c) => {
716
+ var a, m;
620
717
  try {
621
718
  if (!o) return;
622
- const w = typeof e.content == "string" ? e.content : ((l = e.content) == null ? void 0 : l.content) || "";
623
- if (!w || _.length === 0) return;
624
- const k = JSON.stringify(_.map((U) => ({ o: U.offsets, c: U.color }))), S = `${w.length}:${w.substring(0, 64)}:${w.substring(w.length - 64)}|${k}`;
625
- if (((E = d.dataset) == null ? void 0 : E.tableAnnoRuntimeSig) === S) 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
- K(), d.dataset && (d.dataset.tableAnnoRuntimeSig = S);
724
+ X(), c.dataset && (c.dataset.tableAnnoRuntimeSig = H);
628
725
  }, 50);
629
- } catch (w) {
630
- console.warn("[MarkdownRendered] apply failed", w);
726
+ } catch (D) {
727
+ console.warn("[MarkdownRendered] apply failed", D);
631
728
  }
632
729
  };
633
- const q = n.useCallback((d) => {
634
- var l;
635
- return (l = j.current) == null ? void 0 : l.call(j, d);
636
- }, []), R = A(() => {
637
- var d;
638
- if (!z || !a.current) return;
639
- const l = window.getSelection();
640
- if (!l || l.isCollapsed) return;
641
- const E = l.getRangeAt(0), w = E.toString().trim();
642
- if (!w) return;
643
- const k = a.current;
644
- let S = 0, W = 0;
645
- const U = document.createTreeWalker(
646
- k,
647
- NodeFilter.SHOW_TEXT,
648
- {
649
- acceptNode: (I) => {
650
- var Y;
651
- return (Y = I.parentElement) != null && Y.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 ee = U.nextNode();
750
+ });
751
+ let ee = G.nextNode();
656
752
  for (; ee; ) {
657
- if (ee === E.startContainer) {
658
- W = S + E.startOffset;
753
+ if (ee === m.startContainer) {
754
+ q = H + m.startOffset;
659
755
  break;
660
756
  }
661
- S += ((d = ee.textContent) == null ? void 0 : d.length) || 0, ee = U.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: w,
665
- startOffset: W,
666
- charCount: S,
667
- container: E.startContainer.textContent
760
+ text: D,
761
+ startOffset: q,
762
+ charCount: H,
763
+ container: m.startContainer.textContent
668
764
  });
669
765
  const N = {
670
766
  id: `md-anno-${Date.now()}`,
671
- start: W,
672
- end: W + w.length,
767
+ start: q,
768
+ end: q + D.length,
673
769
  color: "#FFE599"
674
770
  };
675
- console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", N), t.eventsEmit && t.eventsEmit("md_annotation_add", N), l.removeAllRanges();
676
- }, [z, t.eventsEmit]), T = o ? [] : (t.annotationData || []).filter(
677
- (d) => "start" in d && "end" in d && !("pageNumber" in d)
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)
678
774
  ), _ = o ? (t.annotationData || []).filter(
679
- (d) => "offsets" in d && Array.isArray(d.offsets)
680
- ) : [], V = A(() => {
681
- if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !a.current) {
775
+ (c) => "offsets" in c && Array.isArray(c.offsets)
776
+ ) : [], Y = $(() => {
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 d = a.current.querySelectorAll(".md-annotation");
686
- console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", d.length), d.length > 0 && d.forEach((l) => {
687
- const E = l.parentNode;
688
- E && E.replaceChild(document.createTextNode(l.textContent || ""), l);
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
- }, []), Q = A(() => {
691
- if (!a.current) return;
692
- a.current.querySelectorAll("table").forEach((l) => {
693
- Array.from(l.rows).forEach((w) => {
694
- Array.from(w.cells).forEach((k) => {
695
- k.getAttribute("data-table-annotated") === "1" && (k.style.removeProperty("background"), k.style.removeProperty("background-color"), k.removeAttribute("data-table-annotated"), k.removeAttribute("title"));
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"));
696
792
  });
697
793
  });
698
794
  }), console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8");
699
- }, []), K = A(() => {
700
- if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", _), !a.current) {
795
+ }, []), X = $(() => {
796
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", _), !l.current) {
701
797
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");
702
798
  return;
703
799
  }
704
- if (Q(), !_.length) {
800
+ if (A(), !_.length) {
705
801
  console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");
706
802
  return;
707
803
  }
708
- const d = a.current.querySelectorAll("table");
709
- if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", d.length), d.length === 0) {
804
+ const c = l.current.querySelectorAll("table");
805
+ if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", c.length), c.length === 0) {
710
806
  console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
711
807
  return;
712
808
  }
713
- Z.current = !0, _.forEach((l, E) => {
714
- const w = l.offsets;
715
- if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", l), !Array.isArray(w) || !w.length || !Array.isArray(w[0]) || w[0].length !== 2) {
716
- console.warn("[TableAnnotation] annotation.offsets is not valid", l);
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);
717
813
  return;
718
814
  }
719
- w.forEach((k, S) => {
720
- const [W, U] = k;
721
- if (typeof W != "number" || typeof U != "number") {
722
- console.warn("[TableAnnotation] offset is not [number, number]", k);
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);
723
819
  return;
724
820
  }
725
- d.forEach((ee, N) => {
726
- var I;
727
- const Y = Array.from(ee.rows), oe = Y[W];
821
+ c.forEach((ee, N) => {
822
+ var j;
823
+ const V = Array.from(ee.rows), oe = V[q];
728
824
  if (!oe) {
729
- console.warn("[TableAnnotation] row out of range", { row: W, tableIndex: N, totalRows: Y.length });
825
+ console.warn("[TableAnnotation] row out of range", {
826
+ row: q,
827
+ tableIndex: N,
828
+ totalRows: V.length
829
+ });
730
830
  return;
731
831
  }
732
- const O = (I = oe.cells) == null ? void 0 : I[U];
733
- if (!O) {
734
- console.warn("[TableAnnotation] cell is undefined", { row: W, col: U, tableIndex: N });
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 });
735
835
  return;
736
836
  }
737
- const $ = l.color || "rgba(255, 229, 153, 0.5)", F = getComputedStyle(O).backgroundColor;
738
- O.getAttribute("data-table-annotated") === "1" && (F === $ || O.style.backgroundColor === $) || (O.style.setProperty("background", $, "important"), O.style.setProperty("background-color", $, "important"), O.setAttribute("data-table-annotated", "1")), l.content && (O.title = l.content), S === 0 && E === 0 && setTimeout(() => {
739
- O.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" });
740
840
  }, 300);
741
841
  });
742
842
  });
743
843
  }), requestAnimationFrame(() => {
744
- Z.current = !1;
844
+ S.current = !1;
745
845
  });
746
- }, [_, Q]), X = A(() => {
747
- if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !a.current || !T.length) {
846
+ }, [_, A]), P = $(() => {
847
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !l.current || !k.length) {
748
848
  console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
749
849
  return;
750
850
  }
751
- B.current && clearTimeout(B.current);
752
- const d = () => {
753
- var l;
851
+ F.current && clearTimeout(F.current);
852
+ const c = () => {
853
+ var a;
754
854
  console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");
755
- const E = (l = a.current) == null ? void 0 : l.querySelectorAll(".md-annotation");
756
- console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (E == null ? void 0 : E.length) || 0), E == null || E.forEach((N) => {
757
- const I = N.parentNode;
758
- I && I.replaceChild(document.createTextNode(N.textContent || ""), N);
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);
759
859
  });
760
- const w = document.createTreeWalker(
761
- a.current,
762
- NodeFilter.SHOW_TEXT,
763
- {
764
- acceptNode: (N) => {
765
- var I;
766
- return (I = N.parentElement) != null && I.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
767
- }
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;
768
864
  }
769
- ), k = [];
770
- let S;
771
- for (; S = w.nextNode(); )
772
- k.push(S);
773
- if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", k.length), k.length === 0) {
774
- console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), B.current = setTimeout(() => {
775
- d();
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();
776
872
  }, 200);
777
873
  return;
778
874
  }
779
- let W = 0;
780
- const U = k.map((N) => {
781
- var I;
782
- const Y = W;
783
- return W += ((I = N.textContent) == null ? void 0 : I.length) || 0, {
875
+ let q = 0;
876
+ const G = R.map((N) => {
877
+ var j;
878
+ const V = q;
879
+ return q += ((j = N.textContent) == null ? void 0 : j.length) || 0, {
784
880
  node: N,
785
- start: Y,
786
- end: W,
881
+ start: V,
882
+ end: q,
787
883
  text: N.textContent
788
884
  };
789
885
  });
790
- console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:", U), console.log("\u603B\u6587\u672C\u957F\u5EA6:", W);
791
- const ee = [...T].sort((N, I) => I.start - N.start);
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);
792
888
  console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:", ee), ee.forEach((N) => {
793
- const { start: I, end: Y, color: oe } = N;
794
- console.log("\u5904\u7406\u6807\u6CE8:", { annotation: N, nodePositions: U });
795
- const O = U.filter(
796
- ($) => I < $.end && Y > $.start
797
- );
798
- console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", O.length), O.forEach(({ node: $, start: F }) => {
799
- var L, J, M, he, Fe, pe;
800
- const le = Math.max(0, I - F), ae = Math.min(((L = $.textContent) == null ? void 0 : L.length) || 0, Y - F);
801
- if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd: ae, nodeTextLength: (J = $.textContent) == null ? void 0 : J.length }), le >= ae) {
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) {
802
900
  console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
803
901
  return;
804
902
  }
805
- const me = ((M = $.textContent) == null ? void 0 : M.slice(0, le)) || "", ge = ((he = $.textContent) == null ? void 0 : he.slice(le, ae)) || "", fe = ((Fe = $.textContent) == null ? void 0 : Fe.slice(ae)) || "";
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)) || "";
806
904
  console.log("\u5206\u5272\u6587\u672C:", { before: me, annotatedText: ge, after: fe });
807
- const se = document.createElement("span");
808
- se.className = "md-annotation", se.style.backgroundColor = oe || "#FFE599", se.textContent = ge;
809
- const ie = document.createDocumentFragment();
810
- me && ie.appendChild(document.createTextNode(me)), ie.appendChild(se), fe && ie.appendChild(document.createTextNode(fe)), (pe = $.parentNode) == null || pe.replaceChild(ie, $), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", ge);
905
+ const ie = document.createElement("span");
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);
811
909
  });
812
910
  });
813
911
  };
814
- B.current = setTimeout(() => {
815
- d();
912
+ F.current = setTimeout(() => {
913
+ c();
816
914
  }, 100);
817
- }, [T]);
915
+ }, [k]);
818
916
  return te(() => {
819
- var d;
917
+ var c;
820
918
  if (o) {
821
919
  console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
822
920
  return;
823
921
  }
824
- const l = typeof e.content == "string" ? e.content : ((d = e.content) == null ? void 0 : d.content) || "";
825
- if (!l || typeof l != "string") {
922
+ const a = typeof e.content == "string" ? e.content : ((c = e.content) == null ? void 0 : c.content) || "";
923
+ if (!a || typeof a != "string") {
826
924
  console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
827
925
  return;
828
926
  }
829
- if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", a.current), console.log("isTableMode:", o), console.log("mdAnnotations:", T), console.log("tableAnnotations:", _), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:", l), !a.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) {
830
928
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");
831
929
  return;
832
930
  }
833
- if (o || V(), !o && T.length > 0) {
834
- X();
931
+ if (o || Y(), !o && k.length > 0) {
932
+ P();
835
933
  return;
836
934
  }
837
935
  console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8");
838
- }, [o, _, T]), te(() => {
936
+ }, [o, _, k]), te(() => {
839
937
  if (!o)
840
- return document.addEventListener("mouseup", R), () => {
841
- document.removeEventListener("mouseup", R);
938
+ return document.addEventListener("mouseup", Q), () => {
939
+ document.removeEventListener("mouseup", Q);
842
940
  };
843
- }, [R, o]), te(() => {
844
- var d;
845
- const l = typeof e.content == "string" ? e.content : ((d = e.content) == null ? void 0 : d.content) || "";
846
- if (!l || typeof l != "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") {
847
945
  console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
848
946
  return;
849
947
  }
850
- console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", l.length || 0), typeof l == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", l.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", l.substring(l.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof l), console.log("\u5185\u5BB9\u503C:", l)), console.log("\u6807\u6CE8\u6570\u636E:", T), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", _);
851
- }, [T, _, o]), te(() => {
852
- if (o && a.current) {
853
- const d = setTimeout(() => {
854
- var l;
855
- const E = (l = a.current) == null ? void 0 : l.querySelectorAll("table");
856
- E && E.length > 0 && (console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:", E.length), E.forEach((w, k) => {
857
- if (w instanceof HTMLTableElement) {
858
- w.style.width = "100%", w.style.minWidth = "100%", w.style.tableLayout = "auto";
859
- const S = w.closest(".markdown-table-mode");
860
- S && S instanceof HTMLElement && (S.style.width = "100%", S.style.overflowX = "auto"), console.log(`\u8868\u683C ${k + 1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`);
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(() => {
950
+ if (o && l.current) {
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`);
861
959
  }
862
960
  }));
863
961
  }, 500);
864
- return () => clearTimeout(d);
962
+ return () => clearTimeout(c);
865
963
  }
866
964
  }, [o, e.content]), te(() => () => {
867
- B.current && clearTimeout(B.current), y.current && (y.current.disconnect(), y.current = null);
965
+ F.current && clearTimeout(F.current), b.current && (b.current.disconnect(), b.current = null);
868
966
  }, []), /* @__PURE__ */ n.createElement(
869
967
  "div",
870
968
  {
@@ -877,26 +975,26 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
877
975
  className: `markdown-container markdown-scrollbar ${o ? "markdown-table-mode" : ""}`
878
976
  },
879
977
  /* @__PURE__ */ n.createElement("style", null, Le),
880
- /* @__PURE__ */ n.createElement("div", { ref: a }, /* @__PURE__ */ n.createElement(
978
+ /* @__PURE__ */ n.createElement("div", { ref: l }, /* @__PURE__ */ n.createElement(
881
979
  we,
882
980
  {
883
981
  dataSource: {
884
982
  type: ye.MARKDOWN,
885
983
  content: (() => {
886
- var d, l;
887
- return typeof e.content == "string" ? e.content : (d = e.content) != null && d.text ? e.content.text : (l = e.content) != null && l.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 : "";
888
986
  })()
889
987
  },
890
988
  size: "md",
891
- onScroll: o ? void 0 : i,
892
- onScrollToTop: o ? void 0 : b,
893
- onScrollToBottom: o ? void 0 : h,
894
- onRendered: q,
989
+ onScroll: o ? void 0 : d,
990
+ onScrollToTop: o ? void 0 : y,
991
+ onScrollToBottom: o ? void 0 : g,
992
+ onRendered: U,
895
993
  theme: {
896
- primaryColor: ((c = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : c.primary) || "#007bff",
897
- backgroundColor: ((m = (g = (p = t.styles) == null ? void 0 : p.theme) == null ? void 0 : g.colors) == null ? void 0 : m.background) || "#f8f9fa",
898
- textColor: ((x = (C = (f = t.styles) == null ? void 0 : f.theme) == null ? void 0 : C.colors) == null ? void 0 : x.text) || "#343a40",
899
- borderColor: ((s = (D = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : D.colors) == null ? void 0 : s.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",
900
998
  borderRadius: o ? "0px" : "8px",
901
999
  padding: o ? "0px" : "20px"
902
1000
  },
@@ -910,60 +1008,62 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
910
1008
  ))
911
1009
  );
912
1010
  }, Oe = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
913
- const u = H(null), r = (g) => {
914
- const m = g.split(/\r?\n/).filter((s) => s.trim().length > 0);
915
- let f = -1;
916
- for (let s = 0; s < m.length - 1; s++) {
917
- const a = m[s].trim(), B = m[s + 1].trim();
918
- if (a.startsWith("|") && a.endsWith("|") && B.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
919
- f = s;
1011
+ const u = O(null), r = (f) => {
1012
+ const s = f.split(/\r?\n/).filter((C) => C.trim().length > 0);
1013
+ let h = -1;
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;
920
1018
  break;
921
1019
  }
922
1020
  }
923
- if (f === -1) return null;
924
- const x = m[f].split("|").slice(1, -1).map((s) => s.trim()), v = [];
925
- for (let s = f + 2; s < m.length; s++) {
926
- const a = m[s].trim();
927
- if (!a.startsWith("|") || !a.endsWith("|")) break;
928
- v.push(a);
1021
+ if (h === -1) return null;
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();
1025
+ if (!l.startsWith("|") || !l.endsWith("|")) break;
1026
+ w.push(l);
929
1027
  }
930
- const D = v.map((s) => s.split("|").slice(1, -1).map((a) => a.trim()));
931
- return { headers: x, rows: D };
932
- }, c = 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]);
933
1033
  return te(() => {
934
- const g = () => {
1034
+ const f = () => {
935
1035
  try {
936
1036
  if (!u.current) return;
937
- const f = u.current.querySelectorAll("table");
938
- if (f.forEach((C) => {
939
- Array.from(C.rows).forEach((v) => {
940
- Array.from(v.cells).forEach((D) => {
941
- D.getAttribute("data-table-annotated") === "1" && (D.style.removeProperty("background"), D.style.removeProperty("background-color"), D.removeAttribute("data-table-annotated"), D.removeAttribute("title"));
1037
+ const h = u.current.querySelectorAll("table");
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"));
942
1042
  });
943
1043
  });
944
- }), !o.length || !f || f.length === 0) return;
945
- o.forEach((C, x) => {
946
- (C.offsets || []).forEach((D, s) => {
947
- const [a, B] = D;
948
- f.forEach((y) => {
949
- var Z;
950
- const i = Array.from(y.rows)[a];
951
- if (!i) return;
952
- const b = (Z = i.cells) == null ? void 0 : Z[B];
953
- if (!b) return;
954
- const h = C.color || "rgba(255, 229, 153, 0.5)";
955
- b.getAttribute("data-table-annotated") === "1" || (b.style.setProperty("background", h, "important"), b.style.setProperty("background-color", h, "important"), b.setAttribute("data-table-annotated", "1"), C.content && (b.title = C.content)), x === 0 && s === 0 && setTimeout(() => b.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
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);
956
1056
  });
957
1057
  });
958
1058
  });
959
- } catch (f) {
960
- console.warn("[MinimalMarkdownTable] apply annotations failed", f);
1059
+ } catch (h) {
1060
+ console.warn("[MinimalMarkdownTable] apply annotations failed", h);
961
1061
  }
962
- }, m = requestAnimationFrame(() => {
963
- g(), t && t();
1062
+ }, s = requestAnimationFrame(() => {
1063
+ f(), t && t();
964
1064
  });
965
- return () => cancelAnimationFrame(m);
966
- }, [e, o, t]), c ? /* @__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, `
967
1067
  .z-mdtbl-wrapper { overflow: auto; position: relative; }
968
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; }
969
1069
  .z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
@@ -975,93 +1075,139 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
975
1075
  .z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
976
1076
  .z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
977
1077
  .z-mdtbl tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
978
- `), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null, c.headers.map((g, m) => /* @__PURE__ */ n.createElement("th", { key: m }, g)))), /* @__PURE__ */ n.createElement("tbody", null, c.rows.map((g, m) => /* @__PURE__ */ n.createElement("tr", { key: m }, g.map((f, C) => /* @__PURE__ */ n.createElement("td", { key: C }, f))))))) : /* @__PURE__ */ n.createElement("div", { ref: u, style: { padding: "8px" } }, "\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C");
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");
979
1079
  }, He = (e, t) => {
980
1080
  var o, u;
981
1081
  console.log("=== Fviewer renderHtmlContent ==="), console.log("data:", e), console.log("data.content:", e.content);
982
1082
  let r = "";
983
- 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: {
984
- height: "100%",
985
- overflow: "auto",
986
- position: "relative"
987
- } }, /* @__PURE__ */ n.createElement(
988
- "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",
989
1085
  {
990
- srcDoc: r,
991
1086
  style: {
992
- width: "100%",
993
1087
  height: "100%",
994
- border: "none",
995
- background: "white"
996
- },
997
- title: "HTML Preview",
998
- 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"
999
1116
  }
1000
- ));
1001
- }, Ze = (e, t) => /* @__PURE__ */ n.createElement("div", { style: {
1002
- display: "flex",
1003
- justifyContent: "center",
1004
- alignItems: "center",
1005
- height: "100%",
1006
- color: "#666"
1007
- } }, /* @__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"))), Xe = ({
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 = ({
1008
1120
  data: e,
1009
1121
  annotationData: t = [],
1010
1122
  totalPage: o = 0,
1011
1123
  currentPage: u = 1,
1012
- scale: r,
1124
+ setScale: r,
1125
+ scale: i,
1013
1126
  // 重命名避免冲突
1014
- rotation: c = 0,
1127
+ rotation: v = 0,
1015
1128
  // 添加rotation参数
1016
- eventsEmit: p,
1017
- styles: g,
1018
- tools: m = {
1129
+ eventsEmit: f,
1130
+ styles: s,
1131
+ tools: h = {
1019
1132
  annotation: !0,
1020
1133
  download: !0,
1021
1134
  zoom: !0,
1022
1135
  close: !0,
1023
1136
  navigation: !0
1024
1137
  },
1025
- customComponents: f,
1026
- className: C,
1027
- contentClass: x
1138
+ customComponents: p,
1139
+ className: B,
1140
+ contentClass: w
1028
1141
  }) => {
1029
- var v, D, s, a;
1030
- const B = (g == null ? void 0 : g.theme) || ze, [y, Z] = P(!1), [z] = P("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [i, b] = P(null);
1031
- 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:", (v = e == null ? void 0 : e.content) == null ? void 0 : v.document), console.log("Fviewer data.content.document\u7C7B\u578B:", typeof ((D = e == null ? void 0 : e.content) == null ? void 0 : D.document)), console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:", ((s = e == null ? void 0 : e.content) == null ? void 0 : s.document) === null), console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:", ((a = e == null ? void 0 : e.content) == null ? void 0 : a.document) === void 0), console.log("Fviewer currentPage:", u), console.log("Fviewer scale:", r);
1032
- const h = H(null), j = H(null), q = H(0);
1033
- q.current += 1, console.log("[Fviewer] render count:", q.current);
1034
- const R = Se(e);
1035
- console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", R), console.log("\u5B8C\u6574\u6570\u636E:", e);
1036
- const T = () => {
1037
- var _;
1038
- switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", R), R) {
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) {
1039
1155
  case "pdf":
1040
1156
  case "pdf_slides":
1041
- return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:", R, "pdfStartPage:" + e.pdfStartPage, "currentPage:" + u), Me(e, { data: e, annotationData: t, totalPage: o, currentPage: u, scale: r, eventsEmit: p, styles: g, tools: m, className: C, contentClass: x }, R === "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
+ );
1042
1179
  case "image":
1043
- return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), We(e, { scale: r, rotation: c, styles: g });
1180
+ return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), Ie(e, {
1181
+ scale: i,
1182
+ rotation: v,
1183
+ styles: s
1184
+ });
1044
1185
  case "text":
1045
- return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), Ie(e, { scale: r, styles: g });
1186
+ return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), We(e, {
1187
+ scale: i,
1188
+ styles: s
1189
+ });
1046
1190
  case "markdown":
1047
1191
  case "markdown_table":
1048
- if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", R), R === "markdown_table") {
1049
- const V = typeof e.content == "string" ? e.content : ((_ = e.content) == null ? void 0 : _.content) || "", Q = (t || []).filter(
1050
- (K) => "offsets" in K && Array.isArray(K.offsets)
1051
- );
1052
- return /* @__PURE__ */ n.createElement(
1053
- Oe,
1054
- {
1055
- markdown: V,
1056
- tableAnnotations: Q
1057
- }
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)
1058
1195
  );
1196
+ return /* @__PURE__ */ n.createElement(Oe, { markdown: A, tableAnnotations: X });
1059
1197
  }
1060
1198
  return /* @__PURE__ */ n.createElement(
1061
1199
  je,
1062
1200
  {
1063
1201
  data: e,
1064
- parentProps: { data: e, annotationData: t, eventsEmit: p, styles: g, tools: m, className: C, contentClass: x },
1202
+ parentProps: {
1203
+ data: e,
1204
+ annotationData: t,
1205
+ eventsEmit: f,
1206
+ styles: s,
1207
+ tools: h,
1208
+ className: B,
1209
+ contentClass: w
1210
+ },
1065
1211
  isTableMode: !1
1066
1212
  }
1067
1213
  );
@@ -1072,31 +1218,19 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
1072
1218
  }
1073
1219
  };
1074
1220
  return n.useEffect(() => {
1075
- const _ = h.current, V = j.current, Q = _ !== e, K = V !== (e ? e.content : void 0);
1221
+ const Y = I.current, A = U.current, X = Y !== e, P = A !== (e ? e.content : void 0);
1076
1222
  console.log("[Fviewer useEffect:data] triggered", {
1077
- dataChanged: Q,
1078
- contentChanged: K,
1223
+ dataChanged: X,
1224
+ contentChanged: P,
1079
1225
  hasData: !!e,
1080
1226
  hasContent: !!(e != null && e.content),
1081
- isLoadingBefore: y
1082
- }), h.current = e, j.current = e ? e.content : void 0;
1227
+ isLoadingBefore: S
1228
+ }), I.current = e, U.current = e ? e.content : void 0;
1083
1229
  }, [e == null ? void 0 : e.content]), n.useEffect(() => {
1084
- i && Z(!1);
1085
- }, [i]), n.useEffect(() => {
1086
- 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:", R);
1087
- }, [t, R]), /* @__PURE__ */ n.createElement(_e, { $theme: B, className: x }, y ? f != null && f.LoadingComponent ? /* @__PURE__ */ n.createElement(
1088
- f.LoadingComponent,
1089
- {
1090
- status: z,
1091
- theme: B
1092
- }
1093
- ) : /* @__PURE__ */ n.createElement(Re, { $theme: B }, z) : i ? f != null && f.ErrorComponent ? /* @__PURE__ */ n.createElement(
1094
- f.ErrorComponent,
1095
- {
1096
- error: i,
1097
- theme: B
1098
- }
1099
- ) : /* @__PURE__ */ n.createElement(Ne, { $theme: B }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, i)) : T());
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)) : _());
1100
1234
  };
1101
1235
  /**
1102
1236
  * @license lucide-react v0.456.0 - ISC
@@ -1135,24 +1269,24 @@ const Ye = ve(
1135
1269
  strokeWidth: o = 2,
1136
1270
  absoluteStrokeWidth: u,
1137
1271
  className: r = "",
1138
- children: c,
1139
- iconNode: p,
1140
- ...g
1141
- }, m) => Ee(
1272
+ children: i,
1273
+ iconNode: v,
1274
+ ...f
1275
+ }, s) => Ee(
1142
1276
  "svg",
1143
1277
  {
1144
- ref: m,
1278
+ ref: s,
1145
1279
  ...Ue,
1146
1280
  width: t,
1147
1281
  height: t,
1148
1282
  stroke: e,
1149
1283
  strokeWidth: u ? Number(o) * 24 / Number(t) : o,
1150
1284
  className: be("lucide", r),
1151
- ...g
1285
+ ...f
1152
1286
  },
1153
1287
  [
1154
- ...p.map(([f, C]) => Ee(f, C)),
1155
- ...Array.isArray(c) ? c : [c]
1288
+ ...v.map(([h, p]) => Ee(h, p)),
1289
+ ...Array.isArray(i) ? i : [i]
1156
1290
  ]
1157
1291
  )
1158
1292
  );
@@ -1164,8 +1298,8 @@ const Ye = ve(
1164
1298
  */
1165
1299
  const ue = (e, t) => {
1166
1300
  const o = ve(
1167
- ({ className: u, ...r }, c) => Ee(Ye, {
1168
- ref: c,
1301
+ ({ className: u, ...r }, i) => Ee(Ye, {
1302
+ ref: i,
1169
1303
  iconNode: t,
1170
1304
  className: be(`lucide-${qe(e)}`, u),
1171
1305
  ...r
@@ -1270,7 +1404,7 @@ const nt = ue("ZoomOut", [
1270
1404
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
1271
1405
  ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
1272
1406
  ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
1273
- ]), ut = G.div`
1407
+ ]), ut = J.div`
1274
1408
  display: flex;
1275
1409
  align-items: center;
1276
1410
  padding: 0px 12px;
@@ -1279,28 +1413,28 @@ const nt = ue("ZoomOut", [
1279
1413
  border-bottom: 1px solid ${(e) => e.$theme.colors.border};
1280
1414
  background: ${(e) => e.$theme.colors.background};
1281
1415
  min-height: 52px;
1282
- `, rt = G.div`
1416
+ `, rt = J.div`
1283
1417
  display: flex;
1284
1418
  align-items: center;
1285
1419
  gap: 8px;
1286
1420
  flex: 1;
1287
1421
  min-width: 0;
1288
- `, lt = G.div`
1422
+ `, lt = J.div`
1289
1423
  font-size: 14px;
1290
1424
  font-weight: 500;
1291
1425
  color: ${(e) => e.$theme.colors.text};
1292
1426
  white-space: nowrap;
1293
1427
  overflow: hidden;
1294
1428
  text-overflow: ellipsis;
1295
- `, at = G.div`
1429
+ `, at = J.div`
1296
1430
  font-size: 12px;
1297
1431
  color: ${(e) => e.$theme.colors.disabledText};
1298
1432
  white-space: nowrap;
1299
- `, st = G.div`
1433
+ `, it = J.div`
1300
1434
  display: flex;
1301
1435
  align-items: center;
1302
1436
  gap: 4px;
1303
- `, ne = G.button`
1437
+ `, ne = J.button`
1304
1438
  display: flex;
1305
1439
  align-items: center;
1306
1440
  justify-content: center;
@@ -1328,7 +1462,7 @@ const nt = ue("ZoomOut", [
1328
1462
  opacity: 0.5;
1329
1463
  cursor: not-allowed;
1330
1464
  }
1331
- `, it = G.div`
1465
+ `, st = J.div`
1332
1466
  font-size: 12px;
1333
1467
  color: ${(e) => e.$theme.colors.disabledText};
1334
1468
  min-width: 40px;
@@ -1370,34 +1504,34 @@ const nt = ue("ZoomOut", [
1370
1504
  rotate: !0
1371
1505
  },
1372
1506
  styles: r,
1373
- onPrevPage: c,
1374
- onNextPage: p,
1375
- onZoomIn: g,
1376
- onZoomOut: m,
1377
- onAnnotationToggle: f,
1378
- onDownload: C,
1379
- onRotateLeft: x,
1380
- onRotateRight: v,
1381
- onClose: D,
1382
- scale: s = 1,
1383
- isAnnotating: a = !1,
1384
- className: B
1507
+ onPrevPage: i,
1508
+ onNextPage: v,
1509
+ onZoomIn: f,
1510
+ onZoomOut: s,
1511
+ onAnnotationToggle: h,
1512
+ onDownload: p,
1513
+ onRotateLeft: B,
1514
+ onRotateRight: w,
1515
+ onClose: x,
1516
+ scale: C = 1,
1517
+ isAnnotating: l = !1,
1518
+ className: F
1385
1519
  }) => {
1386
- const y = (r == null ? void 0 : r.theme) || ct;
1387
- return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(ut, { $theme: y, className: B }, /* @__PURE__ */ n.createElement(rt, { $theme: y }, /* @__PURE__ */ n.createElement(lt, { $theme: y }, e)), /* @__PURE__ */ n.createElement(st, { $theme: y }, 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(
1388
1522
  ne,
1389
1523
  {
1390
- $theme: y,
1391
- onClick: c,
1524
+ $theme: b,
1525
+ onClick: i,
1392
1526
  disabled: t <= 1,
1393
1527
  title: "\u4E0A\u4E00\u9875"
1394
1528
  },
1395
1529
  /* @__PURE__ */ n.createElement(Ge, { size: 16 })
1396
- ), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme: y }, t, " / ", o), /* @__PURE__ */ n.createElement(
1530
+ ), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme: b }, t, " / ", o), /* @__PURE__ */ n.createElement(
1397
1531
  ne,
1398
1532
  {
1399
- $theme: y,
1400
- onClick: p,
1533
+ $theme: b,
1534
+ onClick: v,
1401
1535
  disabled: !o || t >= o,
1402
1536
  title: "\u4E0B\u4E00\u9875"
1403
1537
  },
@@ -1405,59 +1539,59 @@ const nt = ue("ZoomOut", [
1405
1539
  )), u.zoom && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1406
1540
  ne,
1407
1541
  {
1408
- $theme: y,
1409
- onClick: m,
1410
- disabled: s <= 0.3,
1542
+ $theme: b,
1543
+ onClick: s,
1544
+ disabled: C <= 0.3,
1411
1545
  title: "\u7F29\u5C0F"
1412
1546
  },
1413
1547
  /* @__PURE__ */ n.createElement(nt, { size: 16 })
1414
- ), /* @__PURE__ */ n.createElement(it, { $theme: y }, Math.round(s * 100), "%"), /* @__PURE__ */ n.createElement(
1548
+ ), /* @__PURE__ */ n.createElement(st, { $theme: b }, Math.round(C * 100), "%"), /* @__PURE__ */ n.createElement(
1415
1549
  ne,
1416
1550
  {
1417
- $theme: y,
1418
- onClick: g,
1419
- disabled: s >= 3,
1551
+ $theme: b,
1552
+ onClick: f,
1553
+ disabled: C >= 3,
1420
1554
  title: "\u653E\u5927"
1421
1555
  },
1422
1556
  /* @__PURE__ */ n.createElement(ot, { size: 16 })
1423
1557
  )), u.annotation && /* @__PURE__ */ n.createElement(
1424
1558
  ne,
1425
1559
  {
1426
- $theme: y,
1427
- $active: a,
1428
- onClick: f,
1429
- title: a ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
1560
+ $theme: b,
1561
+ $active: l,
1562
+ onClick: h,
1563
+ title: l ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
1430
1564
  },
1431
1565
  /* @__PURE__ */ n.createElement(Ke, { size: 16 })
1432
1566
  ), u.download && /* @__PURE__ */ n.createElement(
1433
1567
  ne,
1434
1568
  {
1435
- $theme: y,
1436
- onClick: C,
1569
+ $theme: b,
1570
+ onClick: p,
1437
1571
  title: "\u4E0B\u8F7D"
1438
1572
  },
1439
1573
  /* @__PURE__ */ n.createElement(Je, { size: 16 })
1440
1574
  ), u.rotate && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1441
1575
  ne,
1442
1576
  {
1443
- $theme: y,
1444
- onClick: x,
1577
+ $theme: b,
1578
+ onClick: B,
1445
1579
  title: "\u5411\u5DE6\u65CB\u8F6C"
1446
1580
  },
1447
1581
  /* @__PURE__ */ n.createElement(Qe, { size: 16 })
1448
1582
  ), /* @__PURE__ */ n.createElement(
1449
1583
  ne,
1450
1584
  {
1451
- $theme: y,
1452
- onClick: v,
1585
+ $theme: b,
1586
+ onClick: w,
1453
1587
  title: "\u5411\u53F3\u65CB\u8F6C"
1454
1588
  },
1455
1589
  /* @__PURE__ */ n.createElement(et, { size: 16 })
1456
1590
  )), u.close && /* @__PURE__ */ n.createElement(
1457
1591
  ne,
1458
1592
  {
1459
- $theme: y,
1460
- onClick: D,
1593
+ $theme: b,
1594
+ onClick: x,
1461
1595
  title: "\u5173\u95ED"
1462
1596
  },
1463
1597
  /* @__PURE__ */ n.createElement(tt, { size: 16 })
@@ -1483,17 +1617,17 @@ const nt = ue("ZoomOut", [
1483
1617
  let o;
1484
1618
  if (typeof e == "string") {
1485
1619
  console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
1486
- const c = re.getDocument({
1620
+ const i = re.getDocument({
1487
1621
  url: e,
1488
1622
  httpHeaders: t.token ? { Authorization: t.token } : void 0
1489
1623
  });
1490
- console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", c), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof c), console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(c))), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:", Object.keys(c)), o = await c.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));
1491
1625
  } else {
1492
1626
  console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");
1493
- const c = re.getDocument({
1627
+ const i = re.getDocument({
1494
1628
  data: e
1495
1629
  });
1496
- console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", c), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof c), o = await c.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);
1497
1631
  }
1498
1632
  const u = o.numPages;
1499
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);
@@ -1537,21 +1671,21 @@ const nt = ue("ZoomOut", [
1537
1671
  const r = new Blob([e]);
1538
1672
  o = URL.createObjectURL(r);
1539
1673
  }
1540
- console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r, c) => {
1541
- const p = new Image();
1542
- p.onload = () => {
1543
- console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", p.width, "x", p.height), r();
1544
- }, p.onerror = () => {
1545
- console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), c(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"));
1546
1680
  };
1547
- const g = setTimeout(() => {
1548
- c(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
1681
+ const f = setTimeout(() => {
1682
+ i(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
1549
1683
  }, 1e4);
1550
- p.onload = () => {
1551
- clearTimeout(g), console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", p.width, "x", p.height), r();
1552
- }, p.onerror = () => {
1553
- clearTimeout(g), console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), c(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1554
- }, 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;
1555
1689
  });
1556
1690
  const u = {
1557
1691
  type: "image",
@@ -1687,7 +1821,7 @@ const nt = ue("ZoomOut", [
1687
1821
  error: "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"
1688
1822
  };
1689
1823
  }
1690
- }, de = G.div`
1824
+ }, de = J.div`
1691
1825
  display: flex;
1692
1826
  flex-direction: column;
1693
1827
  height: 100%;
@@ -1697,65 +1831,113 @@ const nt = ue("ZoomOut", [
1697
1831
  border-radius: ${(e) => e.$theme.space.radius};
1698
1832
  overflow: hidden;
1699
1833
  min-height: 0; /* 确保flex子元素可以收缩 */
1700
- `, pt = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement("div", { style: {
1701
- display: "flex",
1702
- flexDirection: "column",
1703
- alignItems: "center",
1704
- justifyContent: "center",
1705
- height: "100%",
1706
- padding: "40px",
1707
- background: t.colors.background
1708
- } }, /* @__PURE__ */ n.createElement("div", { style: {
1709
- position: "relative",
1710
- width: "80px",
1711
- height: "80px",
1712
- marginBottom: "24px"
1713
- } }, /* @__PURE__ */ n.createElement("div", { style: {
1714
- width: "60px",
1715
- height: "80px",
1716
- background: t.colors.primary,
1717
- borderRadius: "8px 8px 0 0",
1718
- position: "relative",
1719
- margin: "0 auto"
1720
- } }, /* @__PURE__ */ n.createElement("div", { style: {
1721
- position: "absolute",
1722
- top: "0",
1723
- right: "0",
1724
- width: "0",
1725
- height: "0",
1726
- borderStyle: "solid",
1727
- borderWidth: "0 20px 20px 0",
1728
- borderColor: `transparent ${t.colors.background} transparent transparent`
1729
- } })), /* @__PURE__ */ n.createElement("div", { style: {
1730
- position: "absolute",
1731
- top: "50%",
1732
- left: "50%",
1733
- transform: "translate(-50%, -50%)",
1734
- width: "20px",
1735
- height: "20px",
1736
- borderRadius: "50%",
1737
- background: t.colors.background,
1738
- animation: "pulse 1.5s ease-in-out infinite"
1739
- } })), /* @__PURE__ */ n.createElement("div", { style: {
1740
- fontSize: "16px",
1741
- fontWeight: "500",
1742
- color: t.colors.text,
1743
- marginBottom: "8px",
1744
- textAlign: "center"
1745
- } }, e), /* @__PURE__ */ n.createElement("div", { style: {
1746
- width: "200px",
1747
- height: "4px",
1748
- background: t.colors.border,
1749
- borderRadius: "2px",
1750
- overflow: "hidden",
1751
- position: "relative"
1752
- } }, /* @__PURE__ */ n.createElement("div", { style: {
1753
- width: "30%",
1754
- height: "100%",
1755
- background: t.colors.primary,
1756
- borderRadius: "2px",
1757
- animation: "loading-progress 2s ease-in-out infinite"
1758
- } })), /* @__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, `
1759
1941
  @keyframes pulse {
1760
1942
  0%, 100% {
1761
1943
  opacity: 1;
@@ -1778,8 +1960,9 @@ const nt = ue("ZoomOut", [
1778
1960
  transform: translateX(100%);
1779
1961
  }
1780
1962
  }
1781
- `));
1782
- G.div`
1963
+ `)
1964
+ );
1965
+ J.div`
1783
1966
  display: flex;
1784
1967
  align-items: center;
1785
1968
  justify-content: center;
@@ -1787,7 +1970,7 @@ G.div`
1787
1970
  color: ${(e) => e.$theme.colors.disabledText};
1788
1971
  font-size: 14px;
1789
1972
  `;
1790
- const Ce = G.div`
1973
+ const Ce = J.div`
1791
1974
  display: flex;
1792
1975
  flex-direction: column;
1793
1976
  align-items: center;
@@ -1826,133 +2009,136 @@ const Ce = G.div`
1826
2009
  annotations: o,
1827
2010
  fileName: u,
1828
2011
  token: r,
1829
- initialPage: c = 1,
1830
- data: p,
1831
- eventsEmit: g = () => {
2012
+ initialPage: i = 1,
2013
+ data: v,
2014
+ eventsEmit: f = () => {
1832
2015
  },
1833
- styles: m,
1834
- tools: f = {
2016
+ styles: s,
2017
+ tools: h = {
1835
2018
  annotation: !1,
1836
2019
  download: !1,
1837
2020
  zoom: !0,
1838
2021
  close: !0,
1839
2022
  navigation: !0
1840
2023
  },
1841
- customComponents: C,
1842
- className: x,
1843
- headerClass: v,
1844
- contentClass: D
2024
+ customComponents: p,
2025
+ className: B,
2026
+ headerClass: w,
2027
+ contentClass: x
1845
2028
  }) => {
1846
- var s;
1847
- const a = (m == null ? void 0 : m.theme) || Ct, [B, y] = P(!0), [Z, z] = P("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [i, b] = P(null), [h, j] = P(null), [q, R] = P(c), [T, _] = P(1), [V, Q] = P(0), [K, X] = P(!1), d = A(() => {
1848
- y(!0), z("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), b(null), j(null), R(c), _(1), Q(0), X(!1);
1849
- }, [c]), l = A(async () => {
1850
- var F, L;
1851
- if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }), d(), p) {
1852
- y(!1), b(null), j({
1853
- type: p.fileType || t || "text",
1854
- content: p.content,
1855
- fileName: p.fileName || u,
1856
- fileType: p.fileType || t,
1857
- 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
1858
2041
  });
1859
2042
  return;
1860
2043
  }
1861
2044
  if (!e) {
1862
- b("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), y(!1);
2045
+ y("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), b(!1);
1863
2046
  return;
1864
2047
  }
1865
2048
  try {
1866
- y(!0), b(null);
1867
- const J = xe(u, t);
1868
- z(J === "image" ? "\u56FE\u7247\u4E0B\u8F7D\u4E2D..." : J === "pdf" ? "PDF\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : J === "markdown" || J === "markdown_table" ? "Markdown\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : "\u6587\u4EF6\u4E0B\u8F7D\u4E2D...");
1869
- const M = await Ft(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, {
1870
2053
  fileName: u,
1871
2054
  fileType: t,
1872
2055
  token: r
1873
2056
  });
1874
- console.log("=== StaticFileReader parseFile \u7ED3\u679C ==="), console.log("result:", M), console.log("result.type:", M.type), console.log("result.content:", M.content), console.log("result.content?.text:", (F = M.content) == null ? void 0 : F.text), console.log("result.fileName:", M.fileName), console.log("result.fileType:", M.fileType), M.error ? b(M.error) : (M.type === "image" ? z("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210") : M.type === "pdf" ? z("PDF\u52A0\u8F7D\u5B8C\u6210") : M.type === "markdown" || M.type === "markdown_table" ? z("Markdown\u52A0\u8F7D\u5B8C\u6210") : z("\u6587\u4EF6\u52A0\u8F7D\u5B8C\u6210"), console.log("=== parseResult \u8BBE\u7F6E ==="), console.log("parseResult:", M), console.log("parseResult.content:", M.content), console.log("parseResult.content.document:", (L = M.content) == null ? void 0 : L.document), j(M));
1875
- } catch (J) {
1876
- b(`\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25: ${J instanceof Error ? J.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"}`);
1877
2060
  } finally {
1878
- y(!1);
2061
+ b(!1);
1879
2062
  }
1880
- }, [e, u, t, r, p, d]);
2063
+ }, [e, u, t, r, v, c]);
1881
2064
  te(() => {
1882
- l();
1883
- }, [l]);
1884
- const E = A((F, L, J) => {
1885
- switch (F) {
1886
- case "pageChange":
1887
- L != null && L.pageNumber && R(L.pageNumber);
1888
- break;
1889
- // if (data?.annotationId) {
1890
- // setAnnotations(prev => prev.filter(a => a.id !== data.annotationId));
1891
- // }
1892
- // break;
1893
- default:
1894
- g(F, L, J);
1895
- break;
1896
- }
1897
- }, [g]), w = A(() => {
1898
- const F = Math.min(3, T + 0.1);
1899
- _(F), E("zoom:change", { scale: F });
1900
- }, [T, E]), k = A(() => {
1901
- const F = Math.max(0.3, T - 0.1);
1902
- _(F), E("zoom:change", { scale: F });
1903
- }, [T, E]), S = A(() => {
1904
- if (q > 1) {
1905
- const F = q - 1;
1906
- R(F), E("page:change", { page: F });
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 });
1907
2093
  }
1908
- }, [q, E]), W = A(() => {
1909
- const F = (h == null ? void 0 : h.totalPages) || 0;
1910
- if (F && q < F) {
1911
- const L = q + 1;
1912
- R(L), E("page:change", { page: L });
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 });
1913
2099
  }
1914
- }, [q, h == null ? void 0 : h.totalPages, E]), U = A(() => {
1915
- const F = !K;
1916
- X(F), E("annotation:toggle", { isAnnotating: F });
1917
- }, [K, E]), ee = A(() => {
1918
- E("download:start", { fileUrl: e, fileName: u });
1919
- }, [E, e, u]), N = A(() => {
1920
- Q((F) => (F - 90) % 360), E("rotate:left", { rotation: (V - 90) % 360 });
1921
- }, [V, E]), I = A(() => {
1922
- Q((F) => (F + 90) % 360), E("rotate:right", { rotation: (V + 90) % 360 });
1923
- }, [V, E]), Y = A(() => {
1924
- E("viewer:close");
1925
- }, [E]), oe = A((F, L) => {
1926
- const J = F === "pdf", M = F === "text" || F === "markdown" || F === "markdown_table" || F === "html";
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 = $(() => {
2104
+ m("download:start", { fileUrl: e, fileName: u });
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 = $(() => {
2110
+ m("viewer:close");
2111
+ }, [m]), oe = $((E, L) => {
2112
+ const K = E === "pdf", W = E === "text" || E === "markdown" || E === "markdown_table" || E === "html";
1927
2113
  return {
1928
2114
  ...L,
1929
2115
  // 缩放功能:只有 PDF 和图片支持
1930
- zoom: L.zoom && !M,
2116
+ zoom: L.zoom && !W,
1931
2117
  // 导航功能:只有多页文件支持(PDF)
1932
- navigation: L.navigation && J,
2118
+ navigation: L.navigation && K,
1933
2119
  // 标注功能:PDF、Markdown、Markdown表格都支持
1934
- annotation: L.annotation && (F === "pdf" || F === "markdown" || F === "markdown_table"),
2120
+ annotation: L.annotation && (E === "pdf" || E === "markdown" || E === "markdown_table"),
1935
2121
  // 旋转功能:只有图片支持
1936
- rotate: L.rotate && F === "image",
2122
+ rotate: L.rotate && E === "image",
1937
2123
  // 下载功能:所有文件都支持
1938
2124
  download: L.download,
1939
2125
  // 关闭功能:所有文件都支持
1940
2126
  close: L.close
1941
2127
  };
1942
2128
  }, []);
1943
- if (B) {
1944
- const F = oe(t || "unknown", {
1945
- ...f,
2129
+ if (F) {
2130
+ const E = oe(t || "unknown", {
2131
+ ...h,
1946
2132
  navigation: !1
1947
2133
  });
1948
- return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
2134
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
1949
2135
  ce,
1950
2136
  {
1951
2137
  fileName: u || "\u52A0\u8F7D\u4E2D...",
1952
2138
  currentPage: 1,
1953
2139
  totalPage: 0,
1954
- tools: F,
1955
- styles: m,
2140
+ tools: E,
2141
+ styles: s,
1956
2142
  onPrevPage: () => {
1957
2143
  },
1958
2144
  onNextPage: () => {
@@ -1965,38 +2151,26 @@ const Ce = G.div`
1965
2151
  },
1966
2152
  onDownload: () => {
1967
2153
  },
1968
- onClose: Y,
2154
+ onClose: V,
1969
2155
  scale: 1,
1970
2156
  isAnnotating: !1,
1971
- className: v
1972
- }
1973
- ), C != null && C.LoadingComponent ? /* @__PURE__ */ n.createElement(
1974
- C.LoadingComponent,
1975
- {
1976
- status: Z,
1977
- theme: a
1978
- }
1979
- ) : /* @__PURE__ */ n.createElement(
1980
- pt,
1981
- {
1982
- status: Z,
1983
- theme: a
2157
+ className: w
1984
2158
  }
1985
- ));
2159
+ ), p != null && p.LoadingComponent ? /* @__PURE__ */ n.createElement(p.LoadingComponent, { status: S, theme: l }) : /* @__PURE__ */ n.createElement(pt, { status: S, theme: l }));
1986
2160
  }
1987
- if (i) {
1988
- const F = oe(t || "unknown", {
1989
- ...f,
2161
+ if (d) {
2162
+ const E = oe(t || "unknown", {
2163
+ ...h,
1990
2164
  navigation: !1
1991
2165
  });
1992
- return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
2166
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
1993
2167
  ce,
1994
2168
  {
1995
2169
  fileName: u || "\u9519\u8BEF",
1996
2170
  currentPage: 1,
1997
2171
  totalPage: 0,
1998
- tools: F,
1999
- styles: m,
2172
+ tools: E,
2173
+ styles: s,
2000
2174
  onPrevPage: () => {
2001
2175
  },
2002
2176
  onNextPage: () => {
@@ -2009,26 +2183,26 @@ const Ce = G.div`
2009
2183
  },
2010
2184
  onDownload: () => {
2011
2185
  },
2012
- onClose: Y,
2186
+ onClose: V,
2013
2187
  scale: 1,
2014
2188
  isAnnotating: !1,
2015
- className: v
2189
+ className: w
2016
2190
  }
2017
- ), /* @__PURE__ */ n.createElement(Ce, { $theme: a }, /* @__PURE__ */ n.createElement("div", null, "\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, i)));
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)));
2018
2192
  }
2019
- if (!h) {
2020
- const F = oe(t || "unknown", {
2021
- ...f,
2193
+ if (!g) {
2194
+ const E = oe(t || "unknown", {
2195
+ ...h,
2022
2196
  navigation: !1
2023
2197
  });
2024
- return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
2198
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
2025
2199
  ce,
2026
2200
  {
2027
2201
  fileName: u || "\u672A\u77E5\u6587\u4EF6",
2028
2202
  currentPage: 1,
2029
2203
  totalPage: 0,
2030
- tools: F,
2031
- styles: m,
2204
+ tools: E,
2205
+ styles: s,
2032
2206
  onPrevPage: () => {
2033
2207
  },
2034
2208
  onNextPage: () => {
@@ -2041,61 +2215,62 @@ const Ce = G.div`
2041
2215
  },
2042
2216
  onDownload: () => {
2043
2217
  },
2044
- onClose: Y,
2218
+ onClose: V,
2045
2219
  scale: 1,
2046
2220
  isAnnotating: !1,
2047
- className: v
2221
+ className: w
2048
2222
  }
2049
- ), /* @__PURE__ */ n.createElement(Ce, { $theme: a }, /* @__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")));
2050
2224
  }
2051
- const O = {
2052
- content: h.content,
2053
- ...(h.fileName || u) && { fileName: h.fileName || u },
2054
- ...(h.fileType || t) && { fileType: h.fileType || t },
2055
- ...h.totalPages && { totalPages: h.totalPages }
2056
- }, $ = oe(h.type, f);
2057
- return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", O), console.log("viewerData.content:", O.content), console.log("viewerData.content.document:", (s = O.content) == null ? void 0 : s.document), console.log("\u6587\u4EF6\u7C7B\u578B:", h.type), console.log("\u52A8\u6001\u5DE5\u5177\u914D\u7F6E:", $), 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: a, className: x }, /* @__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(
2058
2232
  ce,
2059
2233
  {
2060
- fileName: O.fileName || h.fileName || u || "\u672A\u77E5\u6587\u4EF6",
2061
- currentPage: h.type === "pdf" ? q : 1,
2062
- totalPage: h.type === "pdf" && h.totalPages || 0,
2063
- tools: $,
2064
- styles: m,
2065
- onPrevPage: h.type === "pdf" ? S : () => {
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 : () => {
2066
2240
  },
2067
- onNextPage: h.type === "pdf" ? W : () => {
2241
+ onNextPage: g.type === "pdf" ? q : () => {
2068
2242
  },
2069
- onZoomIn: $.zoom ? w : () => {
2243
+ onZoomIn: T.zoom ? D : () => {
2070
2244
  },
2071
- onZoomOut: $.zoom ? k : () => {
2245
+ onZoomOut: T.zoom ? R : () => {
2072
2246
  },
2073
- onAnnotationToggle: $.annotation ? U : () => {
2247
+ onAnnotationToggle: T.annotation ? G : () => {
2074
2248
  },
2075
- onDownload: $.download ? ee : () => {
2249
+ onDownload: T.download ? ee : () => {
2076
2250
  },
2077
- onRotateLeft: $.rotate ? N : () => {
2251
+ onRotateLeft: T.rotate ? N : () => {
2078
2252
  },
2079
- onRotateRight: $.rotate ? I : () => {
2253
+ onRotateRight: T.rotate ? j : () => {
2080
2254
  },
2081
- onClose: Y,
2082
- scale: T,
2083
- isAnnotating: K,
2084
- className: v
2255
+ onClose: V,
2256
+ scale: k,
2257
+ isAnnotating: X,
2258
+ className: w
2085
2259
  }
2086
2260
  ), /* @__PURE__ */ n.createElement(
2087
2261
  Xe,
2088
2262
  {
2089
- data: O,
2263
+ data: Z,
2090
2264
  annotationData: o || [],
2091
- totalPage: h.type === "pdf" && h.totalPages || 0,
2092
- currentPage: h.type === "pdf" ? q : 1,
2093
- scale: T,
2094
- rotation: V,
2095
- eventsEmit: E,
2096
- styles: m,
2097
- tools: $,
2098
- className: D
2265
+ totalPage: g.type === "pdf" && g.totalPages || 0,
2266
+ currentPage: g.type === "pdf" ? U : 1,
2267
+ scale: k,
2268
+ rotation: Y,
2269
+ eventsEmit: m,
2270
+ styles: s,
2271
+ tools: T,
2272
+ className: x,
2273
+ setScale: _
2099
2274
  }
2100
2275
  ));
2101
2276
  }, vt = () => !!re.GlobalWorkerOptions.workerSrc, Dt = () => re.GlobalWorkerOptions.workerSrc, Bt = (e = "/worker/pdf.worker.min.js") => {