@mxmweb/fviewer 1.5.4 → 1.5.6

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,530 @@ 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
+ whiteSpace: "pre-line"
684
+ }
685
+ }
686
+ )
687
+ ),
688
+ /* @__PURE__ */ n.createElement(
689
+ "div",
690
+ {
691
+ style: {
692
+ position: "absolute",
693
+ top: "0",
694
+ left: "0",
695
+ right: "0",
696
+ height: "2px",
697
+ background: "linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",
698
+ borderTopLeftRadius: "8px",
699
+ borderTopRightRadius: "8px"
700
+ }
593
701
  }
594
702
  )
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
- ));
703
+ )
704
+ );
607
705
  }, 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 = () => {
706
+ var u, r, i, v, f, s, h, p, B, w, x, C;
707
+ const l = O(null), F = O(null), b = O(null), S = O(!1);
708
+ O(0), O(null);
709
+ const [M] = z(!1), d = (c, a) => {
710
+ 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 });
711
+ }, y = () => {
614
712
  console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_top");
615
- }, h = () => {
713
+ }, g = () => {
616
714
  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;
715
+ }, I = O();
716
+ I.current = (c) => {
717
+ var a, m;
620
718
  try {
621
719
  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;
720
+ const D = typeof e.content == "string" ? e.content : ((a = e.content) == null ? void 0 : a.content) || "";
721
+ if (!D || _.length === 0) return;
722
+ 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}`;
723
+ if (((m = c.dataset) == null ? void 0 : m.tableAnnoRuntimeSig) === H) return;
626
724
  setTimeout(() => {
627
- K(), d.dataset && (d.dataset.tableAnnoRuntimeSig = S);
725
+ X(), c.dataset && (c.dataset.tableAnnoRuntimeSig = H);
628
726
  }, 50);
629
- } catch (w) {
630
- console.warn("[MarkdownRendered] apply failed", w);
727
+ } catch (D) {
728
+ console.warn("[MarkdownRendered] apply failed", D);
631
729
  }
632
730
  };
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
- }
731
+ const U = n.useCallback(
732
+ (c) => {
733
+ var a;
734
+ return (a = I.current) == null ? void 0 : a.call(I, c);
735
+ },
736
+ []
737
+ ), Q = $(() => {
738
+ var c;
739
+ if (!M || !l.current) return;
740
+ const a = window.getSelection();
741
+ if (!a || a.isCollapsed) return;
742
+ const m = a.getRangeAt(0), D = m.toString().trim();
743
+ if (!D) return;
744
+ const R = l.current;
745
+ let H = 0, q = 0;
746
+ const G = document.createTreeWalker(R, NodeFilter.SHOW_TEXT, {
747
+ acceptNode: (j) => {
748
+ var V;
749
+ return (V = j.parentElement) != null && V.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
653
750
  }
654
- );
655
- let ee = U.nextNode();
751
+ });
752
+ let ee = G.nextNode();
656
753
  for (; ee; ) {
657
- if (ee === E.startContainer) {
658
- W = S + E.startOffset;
754
+ if (ee === m.startContainer) {
755
+ q = H + m.startOffset;
659
756
  break;
660
757
  }
661
- S += ((d = ee.textContent) == null ? void 0 : d.length) || 0, ee = U.nextNode();
758
+ H += ((c = ee.textContent) == null ? void 0 : c.length) || 0, ee = G.nextNode();
662
759
  }
663
760
  console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:", {
664
- text: w,
665
- startOffset: W,
666
- charCount: S,
667
- container: E.startContainer.textContent
761
+ text: D,
762
+ startOffset: q,
763
+ charCount: H,
764
+ container: m.startContainer.textContent
668
765
  });
669
766
  const N = {
670
767
  id: `md-anno-${Date.now()}`,
671
- start: W,
672
- end: W + w.length,
768
+ start: q,
769
+ end: q + D.length,
673
770
  color: "#FFE599"
674
771
  };
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)
772
+ console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", N), t.eventsEmit && t.eventsEmit("md_annotation_add", N), a.removeAllRanges();
773
+ }, [M, t.eventsEmit]), k = o ? [] : (t.annotationData || []).filter(
774
+ (c) => "start" in c && "end" in c && !("pageNumber" in c)
678
775
  ), _ = 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) {
776
+ (c) => "offsets" in c && Array.isArray(c.offsets)
777
+ ) : [], Y = $(() => {
778
+ if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !l.current) {
682
779
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");
683
780
  return;
684
781
  }
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);
782
+ const c = l.current.querySelectorAll(".md-annotation");
783
+ console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", c.length), c.length > 0 && c.forEach((a) => {
784
+ const m = a.parentNode;
785
+ m && m.replaceChild(document.createTextNode(a.textContent || ""), a);
689
786
  }), 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"));
787
+ }, []), A = $(() => {
788
+ if (!l.current) return;
789
+ l.current.querySelectorAll("table").forEach((a) => {
790
+ Array.from(a.rows).forEach((D) => {
791
+ Array.from(D.cells).forEach((R) => {
792
+ R.getAttribute("data-table-annotated") === "1" && (R.style.removeProperty("background"), R.style.removeProperty("background-color"), R.removeAttribute("data-table-annotated"), R.removeAttribute("title"));
696
793
  });
697
794
  });
698
795
  }), 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) {
796
+ }, []), X = $(() => {
797
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", _), !l.current) {
701
798
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");
702
799
  return;
703
800
  }
704
- if (Q(), !_.length) {
801
+ if (A(), !_.length) {
705
802
  console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");
706
803
  return;
707
804
  }
708
- const d = a.current.querySelectorAll("table");
709
- if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", d.length), d.length === 0) {
805
+ const c = l.current.querySelectorAll("table");
806
+ if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", c.length), c.length === 0) {
710
807
  console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
711
808
  return;
712
809
  }
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);
810
+ S.current = !0, _.forEach((a, m) => {
811
+ const D = a.offsets;
812
+ if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", a), !Array.isArray(D) || !D.length || !Array.isArray(D[0]) || D[0].length !== 2) {
813
+ console.warn("[TableAnnotation] annotation.offsets is not valid", a);
717
814
  return;
718
815
  }
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);
816
+ D.forEach((R, H) => {
817
+ const [q, G] = R;
818
+ if (typeof q != "number" || typeof G != "number") {
819
+ console.warn("[TableAnnotation] offset is not [number, number]", R);
723
820
  return;
724
821
  }
725
- d.forEach((ee, N) => {
726
- var I;
727
- const Y = Array.from(ee.rows), oe = Y[W];
822
+ c.forEach((ee, N) => {
823
+ var j;
824
+ const V = Array.from(ee.rows), oe = V[q];
728
825
  if (!oe) {
729
- console.warn("[TableAnnotation] row out of range", { row: W, tableIndex: N, totalRows: Y.length });
826
+ console.warn("[TableAnnotation] row out of range", {
827
+ row: q,
828
+ tableIndex: N,
829
+ totalRows: V.length
830
+ });
730
831
  return;
731
832
  }
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 });
833
+ const Z = (j = oe.cells) == null ? void 0 : j[G];
834
+ if (!Z) {
835
+ console.warn("[TableAnnotation] cell is undefined", { row: q, col: G, tableIndex: N });
735
836
  return;
736
837
  }
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" });
838
+ const T = a.color || "rgba(255, 229, 153, 0.5)", E = getComputedStyle(Z).backgroundColor;
839
+ 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(() => {
840
+ Z.scrollIntoView({ behavior: "smooth", block: "start" });
740
841
  }, 300);
741
842
  });
742
843
  });
743
844
  }), requestAnimationFrame(() => {
744
- Z.current = !1;
845
+ S.current = !1;
745
846
  });
746
- }, [_, Q]), X = A(() => {
747
- if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !a.current || !T.length) {
847
+ }, [_, A]), P = $(() => {
848
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !l.current || !k.length) {
748
849
  console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
749
850
  return;
750
851
  }
751
- B.current && clearTimeout(B.current);
752
- const d = () => {
753
- var l;
852
+ F.current && clearTimeout(F.current);
853
+ const c = () => {
854
+ var a;
754
855
  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);
856
+ const m = (a = l.current) == null ? void 0 : a.querySelectorAll(".md-annotation");
857
+ console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (m == null ? void 0 : m.length) || 0), m == null || m.forEach((N) => {
858
+ const j = N.parentNode;
859
+ j && j.replaceChild(document.createTextNode(N.textContent || ""), N);
759
860
  });
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
- }
861
+ const D = document.createTreeWalker(l.current, NodeFilter.SHOW_TEXT, {
862
+ acceptNode: (N) => {
863
+ var j;
864
+ return (j = N.parentElement) != null && j.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
768
865
  }
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();
866
+ }), R = [];
867
+ let H;
868
+ for (; H = D.nextNode(); )
869
+ R.push(H);
870
+ if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", R.length), R.length === 0) {
871
+ console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), F.current = setTimeout(() => {
872
+ c();
776
873
  }, 200);
777
874
  return;
778
875
  }
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, {
876
+ let q = 0;
877
+ const G = R.map((N) => {
878
+ var j;
879
+ const V = q;
880
+ return q += ((j = N.textContent) == null ? void 0 : j.length) || 0, {
784
881
  node: N,
785
- start: Y,
786
- end: W,
882
+ start: V,
883
+ end: q,
787
884
  text: N.textContent
788
885
  };
789
886
  });
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);
887
+ console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:", G), console.log("\u603B\u6587\u672C\u957F\u5EA6:", q);
888
+ const ee = [...k].sort((N, j) => j.start - N.start);
792
889
  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) {
890
+ const { start: j, end: V, color: oe } = N;
891
+ console.log("\u5904\u7406\u6807\u6CE8:", { annotation: N, nodePositions: G });
892
+ const Z = G.filter((T) => j < T.end && V > T.start);
893
+ console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Z.length), Z.forEach(({ node: T, start: E }) => {
894
+ var L, K, W, he, Fe, pe;
895
+ const le = Math.max(0, j - E), ae = Math.min(((L = T.textContent) == null ? void 0 : L.length) || 0, V - E);
896
+ if (console.log("\u672C\u5730\u4F4D\u7F6E:", {
897
+ localStart: le,
898
+ localEnd: ae,
899
+ nodeTextLength: (K = T.textContent) == null ? void 0 : K.length
900
+ }), le >= ae) {
802
901
  console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
803
902
  return;
804
903
  }
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)) || "";
904
+ 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
905
  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);
906
+ const ie = document.createElement("span");
907
+ ie.className = "md-annotation", ie.style.backgroundColor = oe || "#FFE599", ie.textContent = ge;
908
+ const se = document.createDocumentFragment();
909
+ 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
910
  });
812
911
  });
813
912
  };
814
- B.current = setTimeout(() => {
815
- d();
913
+ F.current = setTimeout(() => {
914
+ c();
816
915
  }, 100);
817
- }, [T]);
916
+ }, [k]);
818
917
  return te(() => {
819
- var d;
918
+ var c;
820
919
  if (o) {
821
920
  console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
822
921
  return;
823
922
  }
824
- const l = typeof e.content == "string" ? e.content : ((d = e.content) == null ? void 0 : d.content) || "";
825
- if (!l || typeof l != "string") {
923
+ const a = typeof e.content == "string" ? e.content : ((c = e.content) == null ? void 0 : c.content) || "";
924
+ if (!a || typeof a != "string") {
826
925
  console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
827
926
  return;
828
927
  }
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) {
928
+ 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
929
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");
831
930
  return;
832
931
  }
833
- if (o || V(), !o && T.length > 0) {
834
- X();
932
+ if (o || Y(), !o && k.length > 0) {
933
+ P();
835
934
  return;
836
935
  }
837
936
  console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8");
838
- }, [o, _, T]), te(() => {
937
+ }, [o, _, k]), te(() => {
839
938
  if (!o)
840
- return document.addEventListener("mouseup", R), () => {
841
- document.removeEventListener("mouseup", R);
939
+ return document.addEventListener("mouseup", Q), () => {
940
+ document.removeEventListener("mouseup", Q);
842
941
  };
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") {
942
+ }, [Q, o]), te(() => {
943
+ var c;
944
+ const a = typeof e.content == "string" ? e.content : ((c = e.content) == null ? void 0 : c.content) || "";
945
+ if (!a || typeof a != "string") {
847
946
  console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
848
947
  return;
849
948
  }
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`);
949
+ 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:", _);
950
+ }, [k, _, o]), te(() => {
951
+ if (o && l.current) {
952
+ const c = setTimeout(() => {
953
+ var a;
954
+ const m = (a = l.current) == null ? void 0 : a.querySelectorAll("table");
955
+ 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) => {
956
+ if (D instanceof HTMLTableElement) {
957
+ D.style.width = "100%", D.style.minWidth = "100%", D.style.tableLayout = "auto";
958
+ const H = D.closest(".markdown-table-mode");
959
+ 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
960
  }
862
961
  }));
863
962
  }, 500);
864
- return () => clearTimeout(d);
963
+ return () => clearTimeout(c);
865
964
  }
866
965
  }, [o, e.content]), te(() => () => {
867
- B.current && clearTimeout(B.current), y.current && (y.current.disconnect(), y.current = null);
966
+ F.current && clearTimeout(F.current), b.current && (b.current.disconnect(), b.current = null);
868
967
  }, []), /* @__PURE__ */ n.createElement(
869
968
  "div",
870
969
  {
@@ -877,26 +976,26 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
877
976
  className: `markdown-container markdown-scrollbar ${o ? "markdown-table-mode" : ""}`
878
977
  },
879
978
  /* @__PURE__ */ n.createElement("style", null, Le),
880
- /* @__PURE__ */ n.createElement("div", { ref: a }, /* @__PURE__ */ n.createElement(
979
+ /* @__PURE__ */ n.createElement("div", { ref: l }, /* @__PURE__ */ n.createElement(
881
980
  we,
882
981
  {
883
982
  dataSource: {
884
983
  type: ye.MARKDOWN,
885
984
  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 : "";
985
+ var c, a;
986
+ 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
987
  })()
889
988
  },
890
989
  size: "md",
891
- onScroll: o ? void 0 : i,
892
- onScrollToTop: o ? void 0 : b,
893
- onScrollToBottom: o ? void 0 : h,
894
- onRendered: q,
990
+ onScroll: o ? void 0 : d,
991
+ onScrollToTop: o ? void 0 : y,
992
+ onScrollToBottom: o ? void 0 : g,
993
+ onRendered: U,
895
994
  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",
995
+ primaryColor: ((i = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : i.primary) || "#007bff",
996
+ backgroundColor: ((s = (f = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : f.colors) == null ? void 0 : s.background) || "#f8f9fa",
997
+ textColor: ((B = (p = (h = t.styles) == null ? void 0 : h.theme) == null ? void 0 : p.colors) == null ? void 0 : B.text) || "#343a40",
998
+ borderColor: ((C = (x = (w = t.styles) == null ? void 0 : w.theme) == null ? void 0 : x.colors) == null ? void 0 : C.border) || "#dee2e6",
900
999
  borderRadius: o ? "0px" : "8px",
901
1000
  padding: o ? "0px" : "20px"
902
1001
  },
@@ -910,60 +1009,62 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
910
1009
  ))
911
1010
  );
912
1011
  }, 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;
1012
+ const u = O(null), r = (f) => {
1013
+ const s = f.split(/\r?\n/).filter((C) => C.trim().length > 0);
1014
+ let h = -1;
1015
+ for (let C = 0; C < s.length - 1; C++) {
1016
+ const l = s[C].trim(), F = s[C + 1].trim();
1017
+ if (l.startsWith("|") && l.endsWith("|") && F.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
1018
+ h = C;
920
1019
  break;
921
1020
  }
922
1021
  }
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);
1022
+ if (h === -1) return null;
1023
+ const B = s[h].split("|").slice(1, -1).map((C) => C.trim()), w = [];
1024
+ for (let C = h + 2; C < s.length; C++) {
1025
+ const l = s[C].trim();
1026
+ if (!l.startsWith("|") || !l.endsWith("|")) break;
1027
+ w.push(l);
929
1028
  }
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]);
1029
+ const x = w.map(
1030
+ (C) => C.split("|").slice(1, -1).map((l) => l.trim())
1031
+ );
1032
+ return { headers: B, rows: x };
1033
+ }, i = n.useMemo(() => r(e), [e]);
933
1034
  return te(() => {
934
- const g = () => {
1035
+ const f = () => {
935
1036
  try {
936
1037
  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"));
1038
+ const h = u.current.querySelectorAll("table");
1039
+ if (h.forEach((p) => {
1040
+ Array.from(p.rows).forEach((w) => {
1041
+ Array.from(w.cells).forEach((x) => {
1042
+ x.getAttribute("data-table-annotated") === "1" && (x.style.removeProperty("background"), x.style.removeProperty("background-color"), x.removeAttribute("data-table-annotated"), x.removeAttribute("title"));
942
1043
  });
943
1044
  });
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);
1045
+ }), !o.length || !h || h.length === 0) return;
1046
+ o.forEach((p, B) => {
1047
+ (p.offsets || []).forEach((x, C) => {
1048
+ const [l, F] = x;
1049
+ h.forEach((b) => {
1050
+ var S;
1051
+ const d = Array.from(b.rows)[l];
1052
+ if (!d) return;
1053
+ const y = (S = d.cells) == null ? void 0 : S[F];
1054
+ if (!y) return;
1055
+ const g = p.color || "rgba(255, 229, 153, 0.5)";
1056
+ 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
1057
  });
957
1058
  });
958
1059
  });
959
- } catch (f) {
960
- console.warn("[MinimalMarkdownTable] apply annotations failed", f);
1060
+ } catch (h) {
1061
+ console.warn("[MinimalMarkdownTable] apply annotations failed", h);
961
1062
  }
962
- }, m = requestAnimationFrame(() => {
963
- g(), t && t();
1063
+ }, s = requestAnimationFrame(() => {
1064
+ f(), t && t();
964
1065
  });
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, `
1066
+ return () => cancelAnimationFrame(s);
1067
+ }, [e, o, t]), i ? /* @__PURE__ */ n.createElement("div", { ref: u, className: "markdown-table-mode z-mdtbl-wrapper" }, /* @__PURE__ */ n.createElement("style", null, `
967
1068
  .z-mdtbl-wrapper { overflow: auto; position: relative; }
968
1069
  .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
1070
  .z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
@@ -975,93 +1076,139 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
975
1076
  .z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
976
1077
  .z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
977
1078
  .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");
1079
+ `), /* @__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
1080
  }, He = (e, t) => {
980
1081
  var o, u;
981
1082
  console.log("=== Fviewer renderHtmlContent ==="), console.log("data:", e), console.log("data.content:", e.content);
982
1083
  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",
1084
+ 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(
1085
+ "div",
989
1086
  {
990
- srcDoc: r,
991
1087
  style: {
992
- width: "100%",
993
1088
  height: "100%",
994
- border: "none",
995
- background: "white"
996
- },
997
- title: "HTML Preview",
998
- sandbox: "allow-same-origin allow-scripts"
1089
+ overflow: "auto",
1090
+ position: "relative"
1091
+ }
1092
+ },
1093
+ /* @__PURE__ */ n.createElement(
1094
+ "iframe",
1095
+ {
1096
+ srcDoc: r,
1097
+ style: {
1098
+ width: "100%",
1099
+ height: "100%",
1100
+ border: "none",
1101
+ background: "white"
1102
+ },
1103
+ title: "HTML Preview",
1104
+ sandbox: "allow-same-origin allow-scripts"
1105
+ }
1106
+ )
1107
+ );
1108
+ }, Ze = (e, t) => /* @__PURE__ */ n.createElement(
1109
+ "div",
1110
+ {
1111
+ style: {
1112
+ display: "flex",
1113
+ justifyContent: "center",
1114
+ alignItems: "center",
1115
+ height: "100%",
1116
+ color: "#666"
999
1117
  }
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 = ({
1118
+ },
1119
+ /* @__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"))
1120
+ ), Xe = ({
1008
1121
  data: e,
1009
1122
  annotationData: t = [],
1010
1123
  totalPage: o = 0,
1011
1124
  currentPage: u = 1,
1012
- scale: r,
1125
+ setScale: r,
1126
+ scale: i,
1013
1127
  // 重命名避免冲突
1014
- rotation: c = 0,
1128
+ rotation: v = 0,
1015
1129
  // 添加rotation参数
1016
- eventsEmit: p,
1017
- styles: g,
1018
- tools: m = {
1130
+ eventsEmit: f,
1131
+ styles: s,
1132
+ tools: h = {
1019
1133
  annotation: !0,
1020
1134
  download: !0,
1021
1135
  zoom: !0,
1022
1136
  close: !0,
1023
1137
  navigation: !0
1024
1138
  },
1025
- customComponents: f,
1026
- className: C,
1027
- contentClass: x
1139
+ customComponents: p,
1140
+ className: B,
1141
+ contentClass: w
1028
1142
  }) => {
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) {
1143
+ var x, C, l, F;
1144
+ const b = (s == null ? void 0 : s.theme) || ze, [S, M] = z(!1), [d] = z("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [y, g] = z(null);
1145
+ 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(
1146
+ "Fviewer data.content.document\u662F\u5426\u4E3Aundefined:",
1147
+ ((F = e == null ? void 0 : e.content) == null ? void 0 : F.document) === void 0
1148
+ ), console.log("Fviewer currentPage:", u), console.log("Fviewer scale:", i);
1149
+ const I = O(null), U = O(null), Q = O(0);
1150
+ Q.current += 1, console.log("[Fviewer] render count:", Q.current);
1151
+ const k = Se(e);
1152
+ console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", k), console.log("\u5B8C\u6574\u6570\u636E:", e);
1153
+ const _ = () => {
1154
+ var Y;
1155
+ switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", k), k) {
1039
1156
  case "pdf":
1040
1157
  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");
1158
+ return console.log(
1159
+ "\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:",
1160
+ k,
1161
+ "pdfStartPage:" + e.pdfStartPage,
1162
+ "currentPage:" + u
1163
+ ), Me(
1164
+ e,
1165
+ {
1166
+ data: e,
1167
+ annotationData: t,
1168
+ totalPage: o,
1169
+ currentPage: u,
1170
+ scale: i,
1171
+ eventsEmit: f,
1172
+ styles: s,
1173
+ tools: h,
1174
+ className: B,
1175
+ contentClass: w
1176
+ },
1177
+ k === "pdf_slides",
1178
+ r
1179
+ );
1042
1180
  case "image":
1043
- return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), We(e, { scale: r, rotation: c, styles: g });
1181
+ return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), Ie(e, {
1182
+ scale: i,
1183
+ rotation: v,
1184
+ styles: s
1185
+ });
1044
1186
  case "text":
1045
- return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), Ie(e, { scale: r, styles: g });
1187
+ return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), We(e, {
1188
+ scale: i,
1189
+ styles: s
1190
+ });
1046
1191
  case "markdown":
1047
1192
  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
- }
1193
+ if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", k), k === "markdown_table") {
1194
+ const A = typeof e.content == "string" ? e.content : ((Y = e.content) == null ? void 0 : Y.content) || "", X = (t || []).filter(
1195
+ (P) => "offsets" in P && Array.isArray(P.offsets)
1058
1196
  );
1197
+ return /* @__PURE__ */ n.createElement(Oe, { markdown: A, tableAnnotations: X });
1059
1198
  }
1060
1199
  return /* @__PURE__ */ n.createElement(
1061
1200
  je,
1062
1201
  {
1063
1202
  data: e,
1064
- parentProps: { data: e, annotationData: t, eventsEmit: p, styles: g, tools: m, className: C, contentClass: x },
1203
+ parentProps: {
1204
+ data: e,
1205
+ annotationData: t,
1206
+ eventsEmit: f,
1207
+ styles: s,
1208
+ tools: h,
1209
+ className: B,
1210
+ contentClass: w
1211
+ },
1065
1212
  isTableMode: !1
1066
1213
  }
1067
1214
  );
@@ -1072,31 +1219,19 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
1072
1219
  }
1073
1220
  };
1074
1221
  return n.useEffect(() => {
1075
- const _ = h.current, V = j.current, Q = _ !== e, K = V !== (e ? e.content : void 0);
1222
+ const Y = I.current, A = U.current, X = Y !== e, P = A !== (e ? e.content : void 0);
1076
1223
  console.log("[Fviewer useEffect:data] triggered", {
1077
- dataChanged: Q,
1078
- contentChanged: K,
1224
+ dataChanged: X,
1225
+ contentChanged: P,
1079
1226
  hasData: !!e,
1080
1227
  hasContent: !!(e != null && e.content),
1081
- isLoadingBefore: y
1082
- }), h.current = e, j.current = e ? e.content : void 0;
1228
+ isLoadingBefore: S
1229
+ }), I.current = e, U.current = e ? e.content : void 0;
1083
1230
  }, [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());
1231
+ y && M(!1);
1232
+ }, [y]), n.useEffect(() => {
1233
+ 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);
1234
+ }, [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
1235
  };
1101
1236
  /**
1102
1237
  * @license lucide-react v0.456.0 - ISC
@@ -1135,24 +1270,24 @@ const Ye = ve(
1135
1270
  strokeWidth: o = 2,
1136
1271
  absoluteStrokeWidth: u,
1137
1272
  className: r = "",
1138
- children: c,
1139
- iconNode: p,
1140
- ...g
1141
- }, m) => Ee(
1273
+ children: i,
1274
+ iconNode: v,
1275
+ ...f
1276
+ }, s) => Ee(
1142
1277
  "svg",
1143
1278
  {
1144
- ref: m,
1279
+ ref: s,
1145
1280
  ...Ue,
1146
1281
  width: t,
1147
1282
  height: t,
1148
1283
  stroke: e,
1149
1284
  strokeWidth: u ? Number(o) * 24 / Number(t) : o,
1150
1285
  className: be("lucide", r),
1151
- ...g
1286
+ ...f
1152
1287
  },
1153
1288
  [
1154
- ...p.map(([f, C]) => Ee(f, C)),
1155
- ...Array.isArray(c) ? c : [c]
1289
+ ...v.map(([h, p]) => Ee(h, p)),
1290
+ ...Array.isArray(i) ? i : [i]
1156
1291
  ]
1157
1292
  )
1158
1293
  );
@@ -1164,8 +1299,8 @@ const Ye = ve(
1164
1299
  */
1165
1300
  const ue = (e, t) => {
1166
1301
  const o = ve(
1167
- ({ className: u, ...r }, c) => Ee(Ye, {
1168
- ref: c,
1302
+ ({ className: u, ...r }, i) => Ee(Ye, {
1303
+ ref: i,
1169
1304
  iconNode: t,
1170
1305
  className: be(`lucide-${qe(e)}`, u),
1171
1306
  ...r
@@ -1270,7 +1405,7 @@ const nt = ue("ZoomOut", [
1270
1405
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
1271
1406
  ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
1272
1407
  ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
1273
- ]), ut = G.div`
1408
+ ]), ut = J.div`
1274
1409
  display: flex;
1275
1410
  align-items: center;
1276
1411
  padding: 0px 12px;
@@ -1279,28 +1414,28 @@ const nt = ue("ZoomOut", [
1279
1414
  border-bottom: 1px solid ${(e) => e.$theme.colors.border};
1280
1415
  background: ${(e) => e.$theme.colors.background};
1281
1416
  min-height: 52px;
1282
- `, rt = G.div`
1417
+ `, rt = J.div`
1283
1418
  display: flex;
1284
1419
  align-items: center;
1285
1420
  gap: 8px;
1286
1421
  flex: 1;
1287
1422
  min-width: 0;
1288
- `, lt = G.div`
1423
+ `, lt = J.div`
1289
1424
  font-size: 14px;
1290
1425
  font-weight: 500;
1291
1426
  color: ${(e) => e.$theme.colors.text};
1292
1427
  white-space: nowrap;
1293
1428
  overflow: hidden;
1294
1429
  text-overflow: ellipsis;
1295
- `, at = G.div`
1430
+ `, at = J.div`
1296
1431
  font-size: 12px;
1297
1432
  color: ${(e) => e.$theme.colors.disabledText};
1298
1433
  white-space: nowrap;
1299
- `, st = G.div`
1434
+ `, it = J.div`
1300
1435
  display: flex;
1301
1436
  align-items: center;
1302
1437
  gap: 4px;
1303
- `, ne = G.button`
1438
+ `, ne = J.button`
1304
1439
  display: flex;
1305
1440
  align-items: center;
1306
1441
  justify-content: center;
@@ -1328,7 +1463,7 @@ const nt = ue("ZoomOut", [
1328
1463
  opacity: 0.5;
1329
1464
  cursor: not-allowed;
1330
1465
  }
1331
- `, it = G.div`
1466
+ `, st = J.div`
1332
1467
  font-size: 12px;
1333
1468
  color: ${(e) => e.$theme.colors.disabledText};
1334
1469
  min-width: 40px;
@@ -1370,34 +1505,34 @@ const nt = ue("ZoomOut", [
1370
1505
  rotate: !0
1371
1506
  },
1372
1507
  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
1508
+ onPrevPage: i,
1509
+ onNextPage: v,
1510
+ onZoomIn: f,
1511
+ onZoomOut: s,
1512
+ onAnnotationToggle: h,
1513
+ onDownload: p,
1514
+ onRotateLeft: B,
1515
+ onRotateRight: w,
1516
+ onClose: x,
1517
+ scale: C = 1,
1518
+ isAnnotating: l = !1,
1519
+ className: F
1385
1520
  }) => {
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(
1521
+ const b = (r == null ? void 0 : r.theme) || ct;
1522
+ 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
1523
  ne,
1389
1524
  {
1390
- $theme: y,
1391
- onClick: c,
1525
+ $theme: b,
1526
+ onClick: i,
1392
1527
  disabled: t <= 1,
1393
1528
  title: "\u4E0A\u4E00\u9875"
1394
1529
  },
1395
1530
  /* @__PURE__ */ n.createElement(Ge, { size: 16 })
1396
- ), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme: y }, t, " / ", o), /* @__PURE__ */ n.createElement(
1531
+ ), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme: b }, t, " / ", o), /* @__PURE__ */ n.createElement(
1397
1532
  ne,
1398
1533
  {
1399
- $theme: y,
1400
- onClick: p,
1534
+ $theme: b,
1535
+ onClick: v,
1401
1536
  disabled: !o || t >= o,
1402
1537
  title: "\u4E0B\u4E00\u9875"
1403
1538
  },
@@ -1405,59 +1540,59 @@ const nt = ue("ZoomOut", [
1405
1540
  )), u.zoom && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1406
1541
  ne,
1407
1542
  {
1408
- $theme: y,
1409
- onClick: m,
1410
- disabled: s <= 0.3,
1543
+ $theme: b,
1544
+ onClick: s,
1545
+ disabled: C <= 0.3,
1411
1546
  title: "\u7F29\u5C0F"
1412
1547
  },
1413
1548
  /* @__PURE__ */ n.createElement(nt, { size: 16 })
1414
- ), /* @__PURE__ */ n.createElement(it, { $theme: y }, Math.round(s * 100), "%"), /* @__PURE__ */ n.createElement(
1549
+ ), /* @__PURE__ */ n.createElement(st, { $theme: b }, Math.round(C * 100), "%"), /* @__PURE__ */ n.createElement(
1415
1550
  ne,
1416
1551
  {
1417
- $theme: y,
1418
- onClick: g,
1419
- disabled: s >= 3,
1552
+ $theme: b,
1553
+ onClick: f,
1554
+ disabled: C >= 3,
1420
1555
  title: "\u653E\u5927"
1421
1556
  },
1422
1557
  /* @__PURE__ */ n.createElement(ot, { size: 16 })
1423
1558
  )), u.annotation && /* @__PURE__ */ n.createElement(
1424
1559
  ne,
1425
1560
  {
1426
- $theme: y,
1427
- $active: a,
1428
- onClick: f,
1429
- title: a ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
1561
+ $theme: b,
1562
+ $active: l,
1563
+ onClick: h,
1564
+ title: l ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
1430
1565
  },
1431
1566
  /* @__PURE__ */ n.createElement(Ke, { size: 16 })
1432
1567
  ), u.download && /* @__PURE__ */ n.createElement(
1433
1568
  ne,
1434
1569
  {
1435
- $theme: y,
1436
- onClick: C,
1570
+ $theme: b,
1571
+ onClick: p,
1437
1572
  title: "\u4E0B\u8F7D"
1438
1573
  },
1439
1574
  /* @__PURE__ */ n.createElement(Je, { size: 16 })
1440
1575
  ), u.rotate && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1441
1576
  ne,
1442
1577
  {
1443
- $theme: y,
1444
- onClick: x,
1578
+ $theme: b,
1579
+ onClick: B,
1445
1580
  title: "\u5411\u5DE6\u65CB\u8F6C"
1446
1581
  },
1447
1582
  /* @__PURE__ */ n.createElement(Qe, { size: 16 })
1448
1583
  ), /* @__PURE__ */ n.createElement(
1449
1584
  ne,
1450
1585
  {
1451
- $theme: y,
1452
- onClick: v,
1586
+ $theme: b,
1587
+ onClick: w,
1453
1588
  title: "\u5411\u53F3\u65CB\u8F6C"
1454
1589
  },
1455
1590
  /* @__PURE__ */ n.createElement(et, { size: 16 })
1456
1591
  )), u.close && /* @__PURE__ */ n.createElement(
1457
1592
  ne,
1458
1593
  {
1459
- $theme: y,
1460
- onClick: D,
1594
+ $theme: b,
1595
+ onClick: x,
1461
1596
  title: "\u5173\u95ED"
1462
1597
  },
1463
1598
  /* @__PURE__ */ n.createElement(tt, { size: 16 })
@@ -1483,17 +1618,17 @@ const nt = ue("ZoomOut", [
1483
1618
  let o;
1484
1619
  if (typeof e == "string") {
1485
1620
  console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
1486
- const c = re.getDocument({
1621
+ const i = re.getDocument({
1487
1622
  url: e,
1488
1623
  httpHeaders: t.token ? { Authorization: t.token } : void 0
1489
1624
  });
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));
1625
+ 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
1626
  } else {
1492
1627
  console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");
1493
- const c = re.getDocument({
1628
+ const i = re.getDocument({
1494
1629
  data: e
1495
1630
  });
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);
1631
+ 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
1632
  }
1498
1633
  const u = o.numPages;
1499
1634
  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 +1672,21 @@ const nt = ue("ZoomOut", [
1537
1672
  const r = new Blob([e]);
1538
1673
  o = URL.createObjectURL(r);
1539
1674
  }
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"));
1675
+ console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r, i) => {
1676
+ const v = new Image();
1677
+ v.onload = () => {
1678
+ console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", v.width, "x", v.height), r();
1679
+ }, v.onerror = () => {
1680
+ console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), i(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1546
1681
  };
1547
- const g = setTimeout(() => {
1548
- c(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
1682
+ const f = setTimeout(() => {
1683
+ i(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
1549
1684
  }, 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;
1685
+ v.onload = () => {
1686
+ clearTimeout(f), console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", v.width, "x", v.height), r();
1687
+ }, v.onerror = () => {
1688
+ clearTimeout(f), console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), i(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1689
+ }, v.src = o;
1555
1690
  });
1556
1691
  const u = {
1557
1692
  type: "image",
@@ -1687,7 +1822,7 @@ const nt = ue("ZoomOut", [
1687
1822
  error: "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"
1688
1823
  };
1689
1824
  }
1690
- }, de = G.div`
1825
+ }, de = J.div`
1691
1826
  display: flex;
1692
1827
  flex-direction: column;
1693
1828
  height: 100%;
@@ -1697,65 +1832,113 @@ const nt = ue("ZoomOut", [
1697
1832
  border-radius: ${(e) => e.$theme.space.radius};
1698
1833
  overflow: hidden;
1699
1834
  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, `
1835
+ `, pt = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement(
1836
+ "div",
1837
+ {
1838
+ style: {
1839
+ display: "flex",
1840
+ flexDirection: "column",
1841
+ alignItems: "center",
1842
+ justifyContent: "center",
1843
+ height: "100%",
1844
+ padding: "40px",
1845
+ background: t.colors.background
1846
+ }
1847
+ },
1848
+ /* @__PURE__ */ n.createElement(
1849
+ "div",
1850
+ {
1851
+ style: {
1852
+ position: "relative",
1853
+ width: "80px",
1854
+ height: "80px",
1855
+ marginBottom: "24px"
1856
+ }
1857
+ },
1858
+ /* @__PURE__ */ n.createElement(
1859
+ "div",
1860
+ {
1861
+ style: {
1862
+ width: "60px",
1863
+ height: "80px",
1864
+ background: t.colors.primary,
1865
+ borderRadius: "8px 8px 0 0",
1866
+ position: "relative",
1867
+ margin: "0 auto"
1868
+ }
1869
+ },
1870
+ /* @__PURE__ */ n.createElement(
1871
+ "div",
1872
+ {
1873
+ style: {
1874
+ position: "absolute",
1875
+ top: "0",
1876
+ right: "0",
1877
+ width: "0",
1878
+ height: "0",
1879
+ borderStyle: "solid",
1880
+ borderWidth: "0 20px 20px 0",
1881
+ borderColor: `transparent ${t.colors.background} transparent transparent`
1882
+ }
1883
+ }
1884
+ )
1885
+ ),
1886
+ /* @__PURE__ */ n.createElement(
1887
+ "div",
1888
+ {
1889
+ style: {
1890
+ position: "absolute",
1891
+ top: "50%",
1892
+ left: "50%",
1893
+ transform: "translate(-50%, -50%)",
1894
+ width: "20px",
1895
+ height: "20px",
1896
+ borderRadius: "50%",
1897
+ background: t.colors.background,
1898
+ animation: "pulse 1.5s ease-in-out infinite"
1899
+ }
1900
+ }
1901
+ )
1902
+ ),
1903
+ /* @__PURE__ */ n.createElement(
1904
+ "div",
1905
+ {
1906
+ style: {
1907
+ fontSize: "16px",
1908
+ fontWeight: "500",
1909
+ color: t.colors.text,
1910
+ marginBottom: "8px",
1911
+ textAlign: "center"
1912
+ }
1913
+ },
1914
+ e
1915
+ ),
1916
+ /* @__PURE__ */ n.createElement(
1917
+ "div",
1918
+ {
1919
+ style: {
1920
+ width: "200px",
1921
+ height: "4px",
1922
+ background: t.colors.border,
1923
+ borderRadius: "2px",
1924
+ overflow: "hidden",
1925
+ position: "relative"
1926
+ }
1927
+ },
1928
+ /* @__PURE__ */ n.createElement(
1929
+ "div",
1930
+ {
1931
+ style: {
1932
+ width: "30%",
1933
+ height: "100%",
1934
+ background: t.colors.primary,
1935
+ borderRadius: "2px",
1936
+ animation: "loading-progress 2s ease-in-out infinite"
1937
+ }
1938
+ }
1939
+ )
1940
+ ),
1941
+ /* @__PURE__ */ n.createElement("style", null, `
1759
1942
  @keyframes pulse {
1760
1943
  0%, 100% {
1761
1944
  opacity: 1;
@@ -1778,8 +1961,9 @@ const nt = ue("ZoomOut", [
1778
1961
  transform: translateX(100%);
1779
1962
  }
1780
1963
  }
1781
- `));
1782
- G.div`
1964
+ `)
1965
+ );
1966
+ J.div`
1783
1967
  display: flex;
1784
1968
  align-items: center;
1785
1969
  justify-content: center;
@@ -1787,7 +1971,7 @@ G.div`
1787
1971
  color: ${(e) => e.$theme.colors.disabledText};
1788
1972
  font-size: 14px;
1789
1973
  `;
1790
- const Ce = G.div`
1974
+ const Ce = J.div`
1791
1975
  display: flex;
1792
1976
  flex-direction: column;
1793
1977
  align-items: center;
@@ -1826,133 +2010,136 @@ const Ce = G.div`
1826
2010
  annotations: o,
1827
2011
  fileName: u,
1828
2012
  token: r,
1829
- initialPage: c = 1,
1830
- data: p,
1831
- eventsEmit: g = () => {
2013
+ initialPage: i = 1,
2014
+ data: v,
2015
+ eventsEmit: f = () => {
1832
2016
  },
1833
- styles: m,
1834
- tools: f = {
2017
+ styles: s,
2018
+ tools: h = {
1835
2019
  annotation: !1,
1836
2020
  download: !1,
1837
2021
  zoom: !0,
1838
2022
  close: !0,
1839
2023
  navigation: !0
1840
2024
  },
1841
- customComponents: C,
1842
- className: x,
1843
- headerClass: v,
1844
- contentClass: D
2025
+ customComponents: p,
2026
+ className: B,
2027
+ headerClass: w,
2028
+ contentClass: x
1845
2029
  }) => {
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
2030
+ var C;
2031
+ 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 = $(() => {
2032
+ b(!0), M("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), y(null), I(null), Q(i), A(0), P(!1);
2033
+ }, [i]), a = $(async () => {
2034
+ var E, L;
2035
+ if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: v }), c(), v) {
2036
+ b(!1), y(null), I({
2037
+ type: v.fileType || t || "text",
2038
+ content: v.content,
2039
+ fileName: v.fileName || u,
2040
+ fileType: v.fileType || t,
2041
+ totalPages: v.totalPages || 1
1858
2042
  });
1859
2043
  return;
1860
2044
  }
1861
2045
  if (!e) {
1862
- b("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), y(!1);
2046
+ y("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), b(!1);
1863
2047
  return;
1864
2048
  }
1865
2049
  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, {
2050
+ b(!0), y(null);
2051
+ const K = xe(u, t);
2052
+ 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...");
2053
+ const W = await Ft(e, {
1870
2054
  fileName: u,
1871
2055
  fileType: t,
1872
2056
  token: r
1873
2057
  });
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"}`);
2058
+ 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));
2059
+ } catch (K) {
2060
+ y(`\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25: ${K instanceof Error ? K.message : "\u672A\u77E5\u9519\u8BEF"}`);
1877
2061
  } finally {
1878
- y(!1);
2062
+ b(!1);
1879
2063
  }
1880
- }, [e, u, t, r, p, d]);
2064
+ }, [e, u, t, r, v, c]);
1881
2065
  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 });
2066
+ a();
2067
+ }, [a]);
2068
+ const m = $(
2069
+ (E, L, K) => {
2070
+ switch (E) {
2071
+ case "pageChange":
2072
+ L != null && L.pageNumber && Q(L.pageNumber);
2073
+ break;
2074
+ // if (data?.annotationId) {
2075
+ // setAnnotations(prev => prev.filter(a => a.id !== data.annotationId));
2076
+ // }
2077
+ // break;
2078
+ default:
2079
+ f(E, L, K);
2080
+ break;
2081
+ }
2082
+ },
2083
+ [f]
2084
+ ), D = $(() => {
2085
+ const E = Math.min(3, k + 0.1);
2086
+ _(E), m("zoom:change", { scale: E });
2087
+ }, [k, m]), R = $(() => {
2088
+ const E = Math.max(0.3, k - 0.1);
2089
+ _(E), m("zoom:change", { scale: E });
2090
+ }, [k, m]), H = $(() => {
2091
+ if (U > 1) {
2092
+ const E = U - 1;
2093
+ Q(E), m("page:change", { page: E });
1907
2094
  }
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 });
2095
+ }, [U, m]), q = $(() => {
2096
+ const E = (g == null ? void 0 : g.totalPages) || 0;
2097
+ if (E && U < E) {
2098
+ const L = U + 1;
2099
+ Q(L), m("page:change", { page: L });
1913
2100
  }
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";
2101
+ }, [U, g == null ? void 0 : g.totalPages, m]), G = $(() => {
2102
+ const E = !X;
2103
+ P(E), m("annotation:toggle", { isAnnotating: E });
2104
+ }, [X, m]), ee = $(() => {
2105
+ m("download:start", { fileUrl: e, fileName: u });
2106
+ }, [m, e, u]), N = $(() => {
2107
+ A((E) => (E - 90) % 360), m("rotate:left", { rotation: (Y - 90) % 360 });
2108
+ }, [Y, m]), j = $(() => {
2109
+ A((E) => (E + 90) % 360), m("rotate:right", { rotation: (Y + 90) % 360 });
2110
+ }, [Y, m]), V = $(() => {
2111
+ m("viewer:close");
2112
+ }, [m]), oe = $((E, L) => {
2113
+ const K = E === "pdf", W = E === "text" || E === "markdown" || E === "markdown_table" || E === "html";
1927
2114
  return {
1928
2115
  ...L,
1929
2116
  // 缩放功能:只有 PDF 和图片支持
1930
- zoom: L.zoom && !M,
2117
+ zoom: L.zoom && !W,
1931
2118
  // 导航功能:只有多页文件支持(PDF)
1932
- navigation: L.navigation && J,
2119
+ navigation: L.navigation && K,
1933
2120
  // 标注功能:PDF、Markdown、Markdown表格都支持
1934
- annotation: L.annotation && (F === "pdf" || F === "markdown" || F === "markdown_table"),
2121
+ annotation: L.annotation && (E === "pdf" || E === "markdown" || E === "markdown_table"),
1935
2122
  // 旋转功能:只有图片支持
1936
- rotate: L.rotate && F === "image",
2123
+ rotate: L.rotate && E === "image",
1937
2124
  // 下载功能:所有文件都支持
1938
2125
  download: L.download,
1939
2126
  // 关闭功能:所有文件都支持
1940
2127
  close: L.close
1941
2128
  };
1942
2129
  }, []);
1943
- if (B) {
1944
- const F = oe(t || "unknown", {
1945
- ...f,
2130
+ if (F) {
2131
+ const E = oe(t || "unknown", {
2132
+ ...h,
1946
2133
  navigation: !1
1947
2134
  });
1948
- return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
2135
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
1949
2136
  ce,
1950
2137
  {
1951
2138
  fileName: u || "\u52A0\u8F7D\u4E2D...",
1952
2139
  currentPage: 1,
1953
2140
  totalPage: 0,
1954
- tools: F,
1955
- styles: m,
2141
+ tools: E,
2142
+ styles: s,
1956
2143
  onPrevPage: () => {
1957
2144
  },
1958
2145
  onNextPage: () => {
@@ -1965,38 +2152,26 @@ const Ce = G.div`
1965
2152
  },
1966
2153
  onDownload: () => {
1967
2154
  },
1968
- onClose: Y,
2155
+ onClose: V,
1969
2156
  scale: 1,
1970
2157
  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
2158
+ className: w
1984
2159
  }
1985
- ));
2160
+ ), p != null && p.LoadingComponent ? /* @__PURE__ */ n.createElement(p.LoadingComponent, { status: S, theme: l }) : /* @__PURE__ */ n.createElement(pt, { status: S, theme: l }));
1986
2161
  }
1987
- if (i) {
1988
- const F = oe(t || "unknown", {
1989
- ...f,
2162
+ if (d) {
2163
+ const E = oe(t || "unknown", {
2164
+ ...h,
1990
2165
  navigation: !1
1991
2166
  });
1992
- return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
2167
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
1993
2168
  ce,
1994
2169
  {
1995
2170
  fileName: u || "\u9519\u8BEF",
1996
2171
  currentPage: 1,
1997
2172
  totalPage: 0,
1998
- tools: F,
1999
- styles: m,
2173
+ tools: E,
2174
+ styles: s,
2000
2175
  onPrevPage: () => {
2001
2176
  },
2002
2177
  onNextPage: () => {
@@ -2009,26 +2184,26 @@ const Ce = G.div`
2009
2184
  },
2010
2185
  onDownload: () => {
2011
2186
  },
2012
- onClose: Y,
2187
+ onClose: V,
2013
2188
  scale: 1,
2014
2189
  isAnnotating: !1,
2015
- className: v
2190
+ className: w
2016
2191
  }
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)));
2192
+ ), /* @__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
2193
  }
2019
- if (!h) {
2020
- const F = oe(t || "unknown", {
2021
- ...f,
2194
+ if (!g) {
2195
+ const E = oe(t || "unknown", {
2196
+ ...h,
2022
2197
  navigation: !1
2023
2198
  });
2024
- return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
2199
+ return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
2025
2200
  ce,
2026
2201
  {
2027
2202
  fileName: u || "\u672A\u77E5\u6587\u4EF6",
2028
2203
  currentPage: 1,
2029
2204
  totalPage: 0,
2030
- tools: F,
2031
- styles: m,
2205
+ tools: E,
2206
+ styles: s,
2032
2207
  onPrevPage: () => {
2033
2208
  },
2034
2209
  onNextPage: () => {
@@ -2041,61 +2216,62 @@ const Ce = G.div`
2041
2216
  },
2042
2217
  onDownload: () => {
2043
2218
  },
2044
- onClose: Y,
2219
+ onClose: V,
2045
2220
  scale: 1,
2046
2221
  isAnnotating: !1,
2047
- className: v
2222
+ className: w
2048
2223
  }
2049
- ), /* @__PURE__ */ n.createElement(Ce, { $theme: a }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
2224
+ ), /* @__PURE__ */ n.createElement(Ce, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
2050
2225
  }
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(
2226
+ const Z = {
2227
+ content: g.content,
2228
+ ...(g.fileName || u) && { fileName: g.fileName || u },
2229
+ ...(g.fileType || t) && { fileType: g.fileType || t },
2230
+ ...g.totalPages && { totalPages: g.totalPages }
2231
+ }, T = oe(g.type, h);
2232
+ 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
2233
  ce,
2059
2234
  {
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 : () => {
2235
+ fileName: Z.fileName || g.fileName || u || "\u672A\u77E5\u6587\u4EF6",
2236
+ currentPage: g.type === "pdf" ? U : 1,
2237
+ totalPage: g.type === "pdf" && g.totalPages || 0,
2238
+ tools: T,
2239
+ styles: s,
2240
+ onPrevPage: g.type === "pdf" ? H : () => {
2066
2241
  },
2067
- onNextPage: h.type === "pdf" ? W : () => {
2242
+ onNextPage: g.type === "pdf" ? q : () => {
2068
2243
  },
2069
- onZoomIn: $.zoom ? w : () => {
2244
+ onZoomIn: T.zoom ? D : () => {
2070
2245
  },
2071
- onZoomOut: $.zoom ? k : () => {
2246
+ onZoomOut: T.zoom ? R : () => {
2072
2247
  },
2073
- onAnnotationToggle: $.annotation ? U : () => {
2248
+ onAnnotationToggle: T.annotation ? G : () => {
2074
2249
  },
2075
- onDownload: $.download ? ee : () => {
2250
+ onDownload: T.download ? ee : () => {
2076
2251
  },
2077
- onRotateLeft: $.rotate ? N : () => {
2252
+ onRotateLeft: T.rotate ? N : () => {
2078
2253
  },
2079
- onRotateRight: $.rotate ? I : () => {
2254
+ onRotateRight: T.rotate ? j : () => {
2080
2255
  },
2081
- onClose: Y,
2082
- scale: T,
2083
- isAnnotating: K,
2084
- className: v
2256
+ onClose: V,
2257
+ scale: k,
2258
+ isAnnotating: X,
2259
+ className: w
2085
2260
  }
2086
2261
  ), /* @__PURE__ */ n.createElement(
2087
2262
  Xe,
2088
2263
  {
2089
- data: O,
2264
+ data: Z,
2090
2265
  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
2266
+ totalPage: g.type === "pdf" && g.totalPages || 0,
2267
+ currentPage: g.type === "pdf" ? U : 1,
2268
+ scale: k,
2269
+ rotation: Y,
2270
+ eventsEmit: m,
2271
+ styles: s,
2272
+ tools: T,
2273
+ className: x,
2274
+ setScale: _
2099
2275
  }
2100
2276
  ));
2101
2277
  }, vt = () => !!re.GlobalWorkerOptions.workerSrc, Dt = () => re.GlobalWorkerOptions.workerSrc, Bt = (e = "/worker/pdf.worker.min.js") => {