@mxmweb/fviewer 1.5.3 → 1.5.4
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 +705 -700
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/stats.html +1 -1
package/index.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import n, { useRef as
|
|
1
|
+
import n, { useRef as H, useState as P, useCallback as A, useEffect as te, forwardRef as ve, createElement as Ee } from "react";
|
|
2
2
|
import G from "styled-components";
|
|
3
|
-
import { Markdownit as
|
|
3
|
+
import { Markdownit as we, DataType as ye } from "@mxmweb/rtext";
|
|
4
4
|
import * as re from "pdfjs-dist";
|
|
5
|
-
const
|
|
5
|
+
const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ke = ({
|
|
6
6
|
pageNumber: e,
|
|
7
7
|
scale: t,
|
|
8
8
|
isAnnotating: o,
|
|
9
9
|
annotations: u = [],
|
|
10
10
|
onAnnotationAdd: r,
|
|
11
|
-
onAnnotationDelete:
|
|
11
|
+
onAnnotationDelete: c,
|
|
12
12
|
readOnly: p = !1
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
(
|
|
16
|
-
if (!o || !
|
|
17
|
-
const
|
|
18
|
-
console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX:
|
|
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 });
|
|
19
19
|
},
|
|
20
20
|
[o, t]
|
|
21
|
-
),
|
|
22
|
-
(
|
|
23
|
-
if (!
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
x: Math.min(
|
|
27
|
-
y: Math.min(
|
|
28
|
-
width: Math.abs(
|
|
29
|
-
height: Math.abs(
|
|
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)
|
|
30
30
|
});
|
|
31
31
|
},
|
|
32
|
-
[
|
|
33
|
-
),
|
|
34
|
-
if (!
|
|
35
|
-
if (
|
|
36
|
-
|
|
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);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
id:
|
|
39
|
+
const i = {
|
|
40
|
+
id: Be(),
|
|
41
41
|
pageNumber: e,
|
|
42
|
-
...
|
|
42
|
+
...v,
|
|
43
43
|
content: "",
|
|
44
|
-
color:
|
|
44
|
+
color: De
|
|
45
45
|
};
|
|
46
|
-
r == null || r(
|
|
47
|
-
}, [
|
|
48
|
-
|
|
49
|
-
}, [
|
|
50
|
-
return
|
|
51
|
-
const
|
|
52
|
-
...
|
|
53
|
-
content:
|
|
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
|
|
54
54
|
};
|
|
55
|
-
r == null || r(
|
|
56
|
-
}, [r]),
|
|
57
|
-
|
|
58
|
-
}, [
|
|
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:", {
|
|
59
59
|
pageNumber: e,
|
|
60
60
|
annotations: u.length,
|
|
61
|
-
currentPageAnnotationsCount: u.filter((
|
|
62
|
-
currentPageAnnotations: u.filter((
|
|
61
|
+
currentPageAnnotationsCount: u.filter((i) => i.pageNumber === e).length,
|
|
62
|
+
currentPageAnnotations: u.filter((i) => i.pageNumber === e)
|
|
63
63
|
}), /* @__PURE__ */ n.createElement(
|
|
64
64
|
"div",
|
|
65
65
|
{
|
|
66
|
-
ref:
|
|
66
|
+
ref: g,
|
|
67
67
|
style: {
|
|
68
68
|
position: "absolute",
|
|
69
69
|
top: 0,
|
|
@@ -74,24 +74,24 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
74
74
|
pointerEvents: "auto"
|
|
75
75
|
// 确保可以接收鼠标事件
|
|
76
76
|
},
|
|
77
|
-
onMouseDown:
|
|
78
|
-
onMouseMove:
|
|
79
|
-
onMouseUp:
|
|
80
|
-
onMouseLeave:
|
|
77
|
+
onMouseDown: B,
|
|
78
|
+
onMouseMove: y,
|
|
79
|
+
onMouseUp: Z,
|
|
80
|
+
onMouseLeave: Z
|
|
81
81
|
},
|
|
82
|
-
|
|
82
|
+
v && /* @__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: `${
|
|
88
|
-
top: `${
|
|
89
|
-
width: `${
|
|
90
|
-
height: `${
|
|
87
|
+
left: `${v.x * 100}%`,
|
|
88
|
+
top: `${v.y * 100}%`,
|
|
89
|
+
width: `${v.width * 100}%`,
|
|
90
|
+
height: `${v.height * 100}%`
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
u.filter((
|
|
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: {
|
|
95
95
|
width: "100%",
|
|
96
96
|
height: "100%",
|
|
97
97
|
position: "absolute",
|
|
@@ -103,21 +103,21 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
103
103
|
className: "border border-solid",
|
|
104
104
|
style: {
|
|
105
105
|
position: "absolute",
|
|
106
|
-
left: `${
|
|
107
|
-
top: `${
|
|
108
|
-
width: `${
|
|
109
|
-
height: `${
|
|
106
|
+
left: `${i.x * 100}%`,
|
|
107
|
+
top: `${i.y * 100}%`,
|
|
108
|
+
width: `${i.width * 100}%`,
|
|
109
|
+
height: `${i.height * 100}%`,
|
|
110
110
|
borderWidth: "2px",
|
|
111
|
-
borderColor: `${
|
|
112
|
-
backgroundColor: `${
|
|
111
|
+
borderColor: `${i.color}`,
|
|
112
|
+
backgroundColor: `${i.color}4D`,
|
|
113
113
|
// 30%透明度 (4D = 77/255 ≈ 0.3)
|
|
114
114
|
zIndex: 1e3
|
|
115
115
|
},
|
|
116
|
-
onClick: () =>
|
|
116
|
+
onClick: () => z(i.id)
|
|
117
117
|
}
|
|
118
118
|
))))
|
|
119
119
|
);
|
|
120
|
-
},
|
|
120
|
+
}, Ae = {
|
|
121
121
|
colors: {
|
|
122
122
|
primary: "#007bff",
|
|
123
123
|
secondary: "#6c757d",
|
|
@@ -141,14 +141,14 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
141
141
|
shadow: "md",
|
|
142
142
|
lineHeight: "md"
|
|
143
143
|
}
|
|
144
|
-
},
|
|
144
|
+
}, $e = G.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
|
-
`,
|
|
151
|
+
`, Pe = G.div`
|
|
152
152
|
display: flex;
|
|
153
153
|
align-items: center;
|
|
154
154
|
justify-content: center;
|
|
@@ -156,70 +156,70 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
156
156
|
color: ${(e) => e.$theme.colors.error};
|
|
157
157
|
font-size: 14px;
|
|
158
158
|
text-align: center;
|
|
159
|
-
`,
|
|
159
|
+
`, Te = ({
|
|
160
160
|
pdfDocument: e,
|
|
161
161
|
currentPage: t,
|
|
162
162
|
pdfStartPage: o = 1,
|
|
163
163
|
// 默认从第1页开始
|
|
164
164
|
scale: u,
|
|
165
165
|
annotations: r,
|
|
166
|
-
isAnnotating:
|
|
166
|
+
isAnnotating: c,
|
|
167
167
|
isSlidesMode: p = !1,
|
|
168
|
-
onPageChange:
|
|
169
|
-
onScaleChange:
|
|
170
|
-
onAnnotationChange:
|
|
171
|
-
onAnnotationDelete:
|
|
172
|
-
styles:
|
|
168
|
+
onPageChange: g,
|
|
169
|
+
onScaleChange: m,
|
|
170
|
+
onAnnotationChange: f,
|
|
171
|
+
onAnnotationDelete: C,
|
|
172
|
+
styles: x
|
|
173
173
|
}) => {
|
|
174
|
-
const [
|
|
175
|
-
if (!
|
|
176
|
-
const
|
|
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
177
|
return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
|
|
178
|
-
containerWidth:
|
|
179
|
-
containerHeight:
|
|
180
|
-
viewportWidth:
|
|
181
|
-
viewportHeight:
|
|
182
|
-
scaleX:
|
|
183
|
-
scaleY:
|
|
184
|
-
autoScale:
|
|
185
|
-
finalScale:
|
|
186
|
-
}),
|
|
187
|
-
}, [
|
|
188
|
-
if (!(!e || !
|
|
189
|
-
if (
|
|
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) {
|
|
190
190
|
console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
try {
|
|
194
|
-
V.current = t,
|
|
195
|
-
const
|
|
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=${
|
|
197
|
-
throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${
|
|
198
|
-
const
|
|
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");
|
|
199
199
|
console.log("\u5F53\u524Dscale\u503C:", u);
|
|
200
|
-
const
|
|
201
|
-
if (console.log("viewport\u5C3A\u5BF8:",
|
|
202
|
-
canvasContext:
|
|
203
|
-
viewport:
|
|
204
|
-
}).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:",
|
|
205
|
-
const
|
|
206
|
-
console.log("\u5BB9\u5668\u5C3A\u5BF8:",
|
|
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);
|
|
207
207
|
}
|
|
208
|
-
} catch (
|
|
209
|
-
console.error("PDF\u6E32\u67D3\u5931\u8D25:",
|
|
208
|
+
} catch (X) {
|
|
209
|
+
console.error("PDF\u6E32\u67D3\u5931\u8D25:", X);
|
|
210
210
|
} finally {
|
|
211
|
-
|
|
211
|
+
_.current = !1;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
}, [e, u, o,
|
|
214
|
+
}, [e, u, o, Q, m, t]);
|
|
215
215
|
return te(() => {
|
|
216
|
-
e && t && o && (console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:", "pdfStartPage:" + o, "currentPage:" + t, "pdfDocument:", e),
|
|
216
|
+
e && t && o && (console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:", "pdfStartPage:" + o, "currentPage:" + t, "pdfDocument:", e), K());
|
|
217
217
|
}, [t, e, o]), te(() => {
|
|
218
|
-
e && t &&
|
|
219
|
-
}, [u, e, t]),
|
|
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(
|
|
220
220
|
"div",
|
|
221
221
|
{
|
|
222
|
-
ref:
|
|
222
|
+
ref: T,
|
|
223
223
|
className: "bg-gray-100",
|
|
224
224
|
style: {
|
|
225
225
|
display: p ? "block" : "flex",
|
|
@@ -232,7 +232,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
232
232
|
overflow: "visible"
|
|
233
233
|
}
|
|
234
234
|
},
|
|
235
|
-
|
|
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(
|
|
236
236
|
"div",
|
|
237
237
|
{
|
|
238
238
|
className: "relative",
|
|
@@ -246,7 +246,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
246
246
|
/* @__PURE__ */ n.createElement(
|
|
247
247
|
"canvas",
|
|
248
248
|
{
|
|
249
|
-
ref:
|
|
249
|
+
ref: R,
|
|
250
250
|
className: "shadow-lg bg-white border border-gray-300",
|
|
251
251
|
style: {
|
|
252
252
|
display: "block"
|
|
@@ -254,15 +254,15 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
254
254
|
}
|
|
255
255
|
),
|
|
256
256
|
/* @__PURE__ */ n.createElement(
|
|
257
|
-
|
|
257
|
+
ke,
|
|
258
258
|
{
|
|
259
259
|
pageNumber: t,
|
|
260
260
|
scale: u,
|
|
261
|
-
isAnnotating:
|
|
261
|
+
isAnnotating: c,
|
|
262
262
|
annotations: r,
|
|
263
|
-
onAnnotationAdd:
|
|
264
|
-
onAnnotationDelete:
|
|
265
|
-
readOnly: !
|
|
263
|
+
onAnnotationAdd: f,
|
|
264
|
+
onAnnotationDelete: C,
|
|
265
|
+
readOnly: !c
|
|
266
266
|
}
|
|
267
267
|
)
|
|
268
268
|
))
|
|
@@ -280,13 +280,13 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
280
280
|
/* 支持大尺寸内容的滚动 */
|
|
281
281
|
overflow-x: auto;
|
|
282
282
|
overflow-y: auto; /* 改为auto,允许垂直滚动 */
|
|
283
|
-
`,
|
|
283
|
+
`, Re = G.div`
|
|
284
284
|
display: flex;
|
|
285
285
|
align-items: center;
|
|
286
286
|
justify-content: center;
|
|
287
287
|
height: 100%;
|
|
288
288
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
289
|
-
`,
|
|
289
|
+
`, Ne = G.div`
|
|
290
290
|
display: flex;
|
|
291
291
|
flex-direction: column;
|
|
292
292
|
align-items: center;
|
|
@@ -295,7 +295,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
295
295
|
color: ${(e) => e.$theme.colors.error};
|
|
296
296
|
text-align: center;
|
|
297
297
|
padding: 20px;
|
|
298
|
-
`,
|
|
298
|
+
`, Le = `
|
|
299
299
|
.md-annotation {
|
|
300
300
|
position: relative;
|
|
301
301
|
display: inline;
|
|
@@ -375,7 +375,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
375
375
|
.markdown-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
376
376
|
background: #a9a9a;
|
|
377
377
|
}
|
|
378
|
-
`,
|
|
378
|
+
`, ze = {
|
|
379
379
|
colors: {
|
|
380
380
|
primary: "#007bff",
|
|
381
381
|
secondary: "#6c757d",
|
|
@@ -399,57 +399,57 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
399
399
|
shadow: "md",
|
|
400
400
|
lineHeight: "md"
|
|
401
401
|
}
|
|
402
|
-
},
|
|
402
|
+
}, Se = (e) => {
|
|
403
403
|
if (console.log("=== detectFileType \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", e), !e)
|
|
404
404
|
return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"), "unknown";
|
|
405
405
|
const t = e.fileName || "", o = e.fileType || "", u = e.content;
|
|
406
406
|
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
|
-
},
|
|
408
|
-
var u, r,
|
|
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:", ((
|
|
410
|
-
const
|
|
411
|
-
console.log("PDF\u8D77\u59CB\u9875:",
|
|
412
|
-
const
|
|
413
|
-
(
|
|
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
|
|
414
414
|
);
|
|
415
|
-
console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:",
|
|
416
|
-
const
|
|
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;
|
|
417
417
|
return /* @__PURE__ */ n.createElement(
|
|
418
|
-
|
|
418
|
+
Te,
|
|
419
419
|
{
|
|
420
|
-
pdfDocument: ((
|
|
420
|
+
pdfDocument: ((f = e.content) == null ? void 0 : f.document) || null,
|
|
421
421
|
currentPage: t.currentPage || 1,
|
|
422
|
-
pdfStartPage:
|
|
423
|
-
scale:
|
|
424
|
-
annotations:
|
|
422
|
+
pdfStartPage: C,
|
|
423
|
+
scale: D,
|
|
424
|
+
annotations: x,
|
|
425
425
|
isAnnotating: !1,
|
|
426
426
|
isSlidesMode: o,
|
|
427
|
-
onPageChange: t.eventsEmit ? (
|
|
428
|
-
var
|
|
429
|
-
return (
|
|
427
|
+
onPageChange: t.eventsEmit ? (s) => {
|
|
428
|
+
var a;
|
|
429
|
+
return (a = t.eventsEmit) == null ? void 0 : a.call(t, "pageChange", { pageNumber: s });
|
|
430
430
|
} : void 0,
|
|
431
|
-
onScaleChange: t.eventsEmit ? (
|
|
432
|
-
var
|
|
433
|
-
return (
|
|
431
|
+
onScaleChange: t.eventsEmit ? (s) => {
|
|
432
|
+
var a;
|
|
433
|
+
return (a = t.eventsEmit) == null ? void 0 : a.call(t, "scaleChange", { scale: s });
|
|
434
434
|
} : void 0,
|
|
435
|
-
onAnnotationChange: t.eventsEmit ? (
|
|
436
|
-
var
|
|
437
|
-
return (
|
|
435
|
+
onAnnotationChange: t.eventsEmit ? (s) => {
|
|
436
|
+
var a;
|
|
437
|
+
return (a = t.eventsEmit) == null ? void 0 : a.call(t, "annotationChange", { annotation: s });
|
|
438
438
|
} : void 0,
|
|
439
|
-
onAnnotationDelete: t.eventsEmit ? (
|
|
440
|
-
var
|
|
441
|
-
return (
|
|
439
|
+
onAnnotationDelete: t.eventsEmit ? (s) => {
|
|
440
|
+
var a;
|
|
441
|
+
return (a = t.eventsEmit) == null ? void 0 : a.call(t, "annotationDelete", { annotationId: s });
|
|
442
442
|
} : void 0,
|
|
443
443
|
styles: t.styles
|
|
444
444
|
}
|
|
445
445
|
);
|
|
446
|
-
},
|
|
447
|
-
var o, u, r,
|
|
446
|
+
}, We = (e, t) => {
|
|
447
|
+
var o, u, r, c, p, g, m, f, C, x, v, D, s, a;
|
|
448
448
|
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
|
|
450
|
-
console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:",
|
|
451
|
-
},
|
|
452
|
-
console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",
|
|
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);
|
|
453
453
|
};
|
|
454
454
|
return /* @__PURE__ */ n.createElement("div", { style: {
|
|
455
455
|
display: "flex",
|
|
@@ -461,7 +461,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
461
461
|
position: "relative",
|
|
462
462
|
backgroundColor: "#272727"
|
|
463
463
|
// 图片模式深色背景
|
|
464
|
-
} },
|
|
464
|
+
} }, y && /* @__PURE__ */ n.createElement("div", { style: {
|
|
465
465
|
position: "absolute",
|
|
466
466
|
top: "50%",
|
|
467
467
|
left: "50%",
|
|
@@ -474,14 +474,14 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
474
474
|
} }, /* @__PURE__ */ n.createElement("div", { style: {
|
|
475
475
|
width: "32px",
|
|
476
476
|
height: "32px",
|
|
477
|
-
border: `3px solid ${((p = (
|
|
478
|
-
borderTop: `3px solid ${((
|
|
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
479
|
borderRadius: "50%",
|
|
480
480
|
animation: "spin 1s linear infinite"
|
|
481
481
|
} }), /* @__PURE__ */ n.createElement("div", { style: {
|
|
482
482
|
fontSize: "12px",
|
|
483
|
-
color: ((
|
|
484
|
-
} }, "\u56FE\u7247\u52A0\u8F7D\u4E2D...")),
|
|
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
485
|
position: "absolute",
|
|
486
486
|
top: "50%",
|
|
487
487
|
left: "50%",
|
|
@@ -493,20 +493,20 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
493
493
|
zIndex: 1
|
|
494
494
|
} }, /* @__PURE__ */ n.createElement("div", { style: {
|
|
495
495
|
fontSize: "14px",
|
|
496
|
-
color: ((
|
|
496
|
+
color: ((a = (s = (D = t.styles) == null ? void 0 : D.theme) == null ? void 0 : s.colors) == null ? void 0 : a.error) || "#dc3545"
|
|
497
497
|
} }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), /* @__PURE__ */ n.createElement(
|
|
498
498
|
"img",
|
|
499
499
|
{
|
|
500
|
-
src:
|
|
500
|
+
src: B,
|
|
501
501
|
alt: e.fileName || "\u56FE\u7247",
|
|
502
|
-
onLoad:
|
|
503
|
-
onError:
|
|
502
|
+
onLoad: b,
|
|
503
|
+
onError: h,
|
|
504
504
|
style: {
|
|
505
505
|
maxWidth: "100%",
|
|
506
506
|
maxHeight: "100%",
|
|
507
507
|
objectFit: "contain",
|
|
508
508
|
transform: `scale(${t.scale || 1}) rotate(${t.rotation || 0}deg)`,
|
|
509
|
-
opacity:
|
|
509
|
+
opacity: y ? 0 : 1,
|
|
510
510
|
transition: "opacity 0.3s ease-in-out, transform 0.2s ease-in-out"
|
|
511
511
|
}
|
|
512
512
|
}
|
|
@@ -516,22 +516,22 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
516
516
|
100% { transform: rotate(360deg); }
|
|
517
517
|
}
|
|
518
518
|
`));
|
|
519
|
-
},
|
|
520
|
-
var o, u, r,
|
|
519
|
+
}, Ie = (e, t) => {
|
|
520
|
+
var o, u, r, c, p;
|
|
521
521
|
console.log("=== Fviewer renderTextContent ==="), console.log("data:", e), console.log("data.content:", e.content);
|
|
522
|
-
let
|
|
523
|
-
typeof e.content == "string" ?
|
|
524
|
-
const
|
|
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);
|
|
525
525
|
return te(() => {
|
|
526
|
-
if (
|
|
527
|
-
const
|
|
528
|
-
var
|
|
529
|
-
const
|
|
530
|
-
|
|
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));
|
|
531
531
|
}, 100);
|
|
532
|
-
return () => clearTimeout(
|
|
532
|
+
return () => clearTimeout(C);
|
|
533
533
|
}
|
|
534
|
-
}, [
|
|
534
|
+
}, [g]), /* @__PURE__ */ n.createElement("div", { style: {
|
|
535
535
|
height: "100%",
|
|
536
536
|
overflow: "auto",
|
|
537
537
|
backgroundColor: "#f5f5f5",
|
|
@@ -543,7 +543,7 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
543
543
|
} }, /* @__PURE__ */ n.createElement(
|
|
544
544
|
"div",
|
|
545
545
|
{
|
|
546
|
-
ref:
|
|
546
|
+
ref: f,
|
|
547
547
|
style: {
|
|
548
548
|
width: "100%",
|
|
549
549
|
maxWidth: "800px",
|
|
@@ -561,22 +561,22 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
561
561
|
/* @__PURE__ */ n.createElement(
|
|
562
562
|
"div",
|
|
563
563
|
{
|
|
564
|
-
ref:
|
|
564
|
+
ref: m,
|
|
565
565
|
style: {
|
|
566
566
|
width: "100%",
|
|
567
567
|
overflow: "visible"
|
|
568
568
|
}
|
|
569
569
|
},
|
|
570
570
|
/* @__PURE__ */ n.createElement(
|
|
571
|
-
|
|
571
|
+
we,
|
|
572
572
|
{
|
|
573
573
|
dataSource: {
|
|
574
|
-
type:
|
|
575
|
-
content:
|
|
574
|
+
type: ye.TEXT,
|
|
575
|
+
content: g
|
|
576
576
|
},
|
|
577
577
|
size: "md",
|
|
578
578
|
theme: {
|
|
579
|
-
primaryColor: ((p = (
|
|
579
|
+
primaryColor: ((p = (c = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : c.colors) == null ? void 0 : p.primary) || "#007bff",
|
|
580
580
|
backgroundColor: "transparent",
|
|
581
581
|
textColor: "#333",
|
|
582
582
|
borderColor: "transparent",
|
|
@@ -604,261 +604,267 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
604
604
|
borderTopRightRadius: "8px"
|
|
605
605
|
} })
|
|
606
606
|
));
|
|
607
|
-
},
|
|
608
|
-
var u, r,
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const [
|
|
612
|
-
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop:
|
|
613
|
-
},
|
|
607
|
+
}, 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 = () => {
|
|
614
614
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_top");
|
|
615
|
-
},
|
|
615
|
+
}, h = () => {
|
|
616
616
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_bottom");
|
|
617
|
-
},
|
|
618
|
-
|
|
619
|
-
var
|
|
617
|
+
}, j = H();
|
|
618
|
+
j.current = (d) => {
|
|
619
|
+
var l, E;
|
|
620
620
|
try {
|
|
621
621
|
if (!o) return;
|
|
622
|
-
const
|
|
623
|
-
if (!
|
|
624
|
-
const
|
|
625
|
-
if (((
|
|
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;
|
|
626
626
|
setTimeout(() => {
|
|
627
|
-
|
|
627
|
+
K(), d.dataset && (d.dataset.tableAnnoRuntimeSig = S);
|
|
628
628
|
}, 50);
|
|
629
|
-
} catch (
|
|
630
|
-
console.warn("[MarkdownRendered] apply failed",
|
|
629
|
+
} catch (w) {
|
|
630
|
+
console.warn("[MarkdownRendered] apply failed", w);
|
|
631
631
|
}
|
|
632
632
|
};
|
|
633
|
-
const
|
|
634
|
-
var
|
|
635
|
-
return (
|
|
636
|
-
}, []),
|
|
637
|
-
var
|
|
638
|
-
if (!
|
|
639
|
-
const
|
|
640
|
-
if (!
|
|
641
|
-
const
|
|
642
|
-
if (!
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
const
|
|
646
|
-
|
|
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
647
|
NodeFilter.SHOW_TEXT,
|
|
648
648
|
{
|
|
649
|
-
acceptNode: (
|
|
650
|
-
var
|
|
651
|
-
return (
|
|
649
|
+
acceptNode: (I) => {
|
|
650
|
+
var Y;
|
|
651
|
+
return (Y = I.parentElement) != null && Y.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
654
|
);
|
|
655
|
-
let
|
|
656
|
-
for (;
|
|
657
|
-
if (
|
|
658
|
-
|
|
655
|
+
let ee = U.nextNode();
|
|
656
|
+
for (; ee; ) {
|
|
657
|
+
if (ee === E.startContainer) {
|
|
658
|
+
W = S + E.startOffset;
|
|
659
659
|
break;
|
|
660
660
|
}
|
|
661
|
-
|
|
661
|
+
S += ((d = ee.textContent) == null ? void 0 : d.length) || 0, ee = U.nextNode();
|
|
662
662
|
}
|
|
663
663
|
console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:", {
|
|
664
|
-
text:
|
|
665
|
-
startOffset:
|
|
666
|
-
charCount:
|
|
667
|
-
container:
|
|
664
|
+
text: w,
|
|
665
|
+
startOffset: W,
|
|
666
|
+
charCount: S,
|
|
667
|
+
container: E.startContainer.textContent
|
|
668
668
|
});
|
|
669
|
-
const
|
|
669
|
+
const N = {
|
|
670
670
|
id: `md-anno-${Date.now()}`,
|
|
671
|
-
start:
|
|
672
|
-
end:
|
|
671
|
+
start: W,
|
|
672
|
+
end: W + w.length,
|
|
673
673
|
color: "#FFE599"
|
|
674
674
|
};
|
|
675
|
-
console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",
|
|
676
|
-
}, [
|
|
677
|
-
(
|
|
678
|
-
),
|
|
679
|
-
(
|
|
680
|
-
) : [], V =
|
|
681
|
-
if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !
|
|
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)
|
|
678
|
+
), _ = 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) {
|
|
682
682
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");
|
|
683
683
|
return;
|
|
684
684
|
}
|
|
685
|
-
const
|
|
686
|
-
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",
|
|
687
|
-
const
|
|
688
|
-
|
|
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);
|
|
689
689
|
}), console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A");
|
|
690
|
-
}, []),
|
|
691
|
-
if (
|
|
692
|
-
|
|
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"));
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
}), 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) {
|
|
701
|
+
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");
|
|
693
702
|
return;
|
|
694
703
|
}
|
|
695
|
-
|
|
696
|
-
|
|
704
|
+
if (Q(), !_.length) {
|
|
705
|
+
console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
const d = a.current.querySelectorAll("table");
|
|
709
|
+
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", d.length), d.length === 0) {
|
|
697
710
|
console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
|
|
698
711
|
return;
|
|
699
712
|
}
|
|
700
|
-
|
|
701
|
-
const
|
|
702
|
-
if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",
|
|
703
|
-
console.warn("[TableAnnotation] annotation.offsets is not valid",
|
|
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);
|
|
704
717
|
return;
|
|
705
718
|
}
|
|
706
|
-
|
|
707
|
-
const [
|
|
708
|
-
if (typeof
|
|
709
|
-
console.warn("[TableAnnotation] offset is not [number, number]",
|
|
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);
|
|
710
723
|
return;
|
|
711
724
|
}
|
|
712
|
-
|
|
713
|
-
var
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
Q = H[I];
|
|
718
|
-
else {
|
|
719
|
-
const S = ((K = (j = U.tHead) == null ? void 0 : j.rows) == null ? void 0 : K.length) || 0;
|
|
720
|
-
Q = Array.from(U.rows)[I + S];
|
|
721
|
-
}
|
|
722
|
-
if (!Q) {
|
|
723
|
-
console.warn("[TableAnnotation] row out of range", { row: I, tableIndex: M });
|
|
725
|
+
d.forEach((ee, N) => {
|
|
726
|
+
var I;
|
|
727
|
+
const Y = Array.from(ee.rows), oe = Y[W];
|
|
728
|
+
if (!oe) {
|
|
729
|
+
console.warn("[TableAnnotation] row out of range", { row: W, tableIndex: N, totalRows: Y.length });
|
|
724
730
|
return;
|
|
725
731
|
}
|
|
726
|
-
const
|
|
727
|
-
if (!
|
|
728
|
-
console.warn("[TableAnnotation] cell is undefined", { row:
|
|
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 });
|
|
729
735
|
return;
|
|
730
736
|
}
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
|
|
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" });
|
|
734
740
|
}, 300);
|
|
735
741
|
});
|
|
736
742
|
});
|
|
737
743
|
}), requestAnimationFrame(() => {
|
|
738
|
-
|
|
744
|
+
Z.current = !1;
|
|
739
745
|
});
|
|
740
|
-
}, [
|
|
741
|
-
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !
|
|
746
|
+
}, [_, Q]), X = A(() => {
|
|
747
|
+
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !a.current || !T.length) {
|
|
742
748
|
console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
|
|
743
749
|
return;
|
|
744
750
|
}
|
|
745
|
-
|
|
746
|
-
const
|
|
747
|
-
var
|
|
751
|
+
B.current && clearTimeout(B.current);
|
|
752
|
+
const d = () => {
|
|
753
|
+
var l;
|
|
748
754
|
console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");
|
|
749
|
-
const
|
|
750
|
-
console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (
|
|
751
|
-
const
|
|
752
|
-
|
|
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);
|
|
753
759
|
});
|
|
754
|
-
const
|
|
755
|
-
|
|
760
|
+
const w = document.createTreeWalker(
|
|
761
|
+
a.current,
|
|
756
762
|
NodeFilter.SHOW_TEXT,
|
|
757
763
|
{
|
|
758
|
-
acceptNode: (
|
|
759
|
-
var
|
|
760
|
-
return (
|
|
764
|
+
acceptNode: (N) => {
|
|
765
|
+
var I;
|
|
766
|
+
return (I = N.parentElement) != null && I.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
761
767
|
}
|
|
762
768
|
}
|
|
763
|
-
),
|
|
764
|
-
let
|
|
765
|
-
for (;
|
|
766
|
-
|
|
767
|
-
if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",
|
|
768
|
-
console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),
|
|
769
|
-
|
|
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();
|
|
770
776
|
}, 200);
|
|
771
777
|
return;
|
|
772
778
|
}
|
|
773
|
-
let
|
|
774
|
-
const
|
|
775
|
-
var
|
|
776
|
-
const
|
|
777
|
-
return
|
|
778
|
-
node:
|
|
779
|
-
start:
|
|
780
|
-
end:
|
|
781
|
-
text:
|
|
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, {
|
|
784
|
+
node: N,
|
|
785
|
+
start: Y,
|
|
786
|
+
end: W,
|
|
787
|
+
text: N.textContent
|
|
782
788
|
};
|
|
783
789
|
});
|
|
784
|
-
console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",
|
|
785
|
-
const
|
|
786
|
-
console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",
|
|
787
|
-
const { start:
|
|
788
|
-
console.log("\u5904\u7406\u6807\u6CE8:", { annotation:
|
|
789
|
-
const
|
|
790
|
-
(
|
|
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);
|
|
792
|
+
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
|
|
791
797
|
);
|
|
792
|
-
console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",
|
|
793
|
-
var
|
|
794
|
-
const le = Math.max(0,
|
|
795
|
-
if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd:
|
|
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) {
|
|
796
802
|
console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
|
|
797
803
|
return;
|
|
798
804
|
}
|
|
799
|
-
const
|
|
800
|
-
console.log("\u5206\u5272\u6587\u672C:", { before:
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
const
|
|
804
|
-
|
|
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)) || "";
|
|
806
|
+
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);
|
|
805
811
|
});
|
|
806
812
|
});
|
|
807
813
|
};
|
|
808
|
-
|
|
809
|
-
|
|
814
|
+
B.current = setTimeout(() => {
|
|
815
|
+
d();
|
|
810
816
|
}, 100);
|
|
811
|
-
}, [
|
|
817
|
+
}, [T]);
|
|
812
818
|
return te(() => {
|
|
813
|
-
var
|
|
819
|
+
var d;
|
|
814
820
|
if (o) {
|
|
815
821
|
console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
|
|
816
822
|
return;
|
|
817
823
|
}
|
|
818
|
-
const
|
|
819
|
-
if (!
|
|
824
|
+
const l = typeof e.content == "string" ? e.content : ((d = e.content) == null ? void 0 : d.content) || "";
|
|
825
|
+
if (!l || typeof l != "string") {
|
|
820
826
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
|
|
821
827
|
return;
|
|
822
828
|
}
|
|
823
|
-
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:",
|
|
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) {
|
|
824
830
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");
|
|
825
831
|
return;
|
|
826
832
|
}
|
|
827
|
-
if (o || V(), !o &&
|
|
828
|
-
|
|
833
|
+
if (o || V(), !o && T.length > 0) {
|
|
834
|
+
X();
|
|
829
835
|
return;
|
|
830
836
|
}
|
|
831
837
|
console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8");
|
|
832
|
-
}, [o,
|
|
838
|
+
}, [o, _, T]), te(() => {
|
|
833
839
|
if (!o)
|
|
834
|
-
return document.addEventListener("mouseup",
|
|
835
|
-
document.removeEventListener("mouseup",
|
|
840
|
+
return document.addEventListener("mouseup", R), () => {
|
|
841
|
+
document.removeEventListener("mouseup", R);
|
|
836
842
|
};
|
|
837
|
-
}, [
|
|
838
|
-
var
|
|
839
|
-
const
|
|
840
|
-
if (!
|
|
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") {
|
|
841
847
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
|
|
842
848
|
return;
|
|
843
849
|
}
|
|
844
|
-
console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:",
|
|
845
|
-
}, [
|
|
846
|
-
if (o &&
|
|
847
|
-
const
|
|
848
|
-
var
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
-
if (
|
|
852
|
-
|
|
853
|
-
const
|
|
854
|
-
|
|
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`);
|
|
855
861
|
}
|
|
856
862
|
}));
|
|
857
863
|
}, 500);
|
|
858
|
-
return () => clearTimeout(
|
|
864
|
+
return () => clearTimeout(d);
|
|
859
865
|
}
|
|
860
866
|
}, [o, e.content]), te(() => () => {
|
|
861
|
-
|
|
867
|
+
B.current && clearTimeout(B.current), y.current && (y.current.disconnect(), y.current = null);
|
|
862
868
|
}, []), /* @__PURE__ */ n.createElement(
|
|
863
869
|
"div",
|
|
864
870
|
{
|
|
@@ -870,27 +876,27 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
870
876
|
},
|
|
871
877
|
className: `markdown-container markdown-scrollbar ${o ? "markdown-table-mode" : ""}`
|
|
872
878
|
},
|
|
873
|
-
/* @__PURE__ */ n.createElement("style", null,
|
|
874
|
-
/* @__PURE__ */ n.createElement("div", { ref:
|
|
875
|
-
|
|
879
|
+
/* @__PURE__ */ n.createElement("style", null, Le),
|
|
880
|
+
/* @__PURE__ */ n.createElement("div", { ref: a }, /* @__PURE__ */ n.createElement(
|
|
881
|
+
we,
|
|
876
882
|
{
|
|
877
883
|
dataSource: {
|
|
878
|
-
type:
|
|
884
|
+
type: ye.MARKDOWN,
|
|
879
885
|
content: (() => {
|
|
880
|
-
var
|
|
881
|
-
return typeof e.content == "string" ? e.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 : "";
|
|
882
888
|
})()
|
|
883
889
|
},
|
|
884
890
|
size: "md",
|
|
885
|
-
onScroll: o ? void 0 :
|
|
886
|
-
onScrollToTop: o ? void 0 :
|
|
887
|
-
onScrollToBottom: o ? void 0 :
|
|
888
|
-
onRendered:
|
|
891
|
+
onScroll: o ? void 0 : i,
|
|
892
|
+
onScrollToTop: o ? void 0 : b,
|
|
893
|
+
onScrollToBottom: o ? void 0 : h,
|
|
894
|
+
onRendered: q,
|
|
889
895
|
theme: {
|
|
890
|
-
primaryColor: ((
|
|
891
|
-
backgroundColor: ((
|
|
892
|
-
textColor: ((
|
|
893
|
-
borderColor: ((
|
|
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",
|
|
894
900
|
borderRadius: o ? "0px" : "8px",
|
|
895
901
|
padding: o ? "0px" : "20px"
|
|
896
902
|
},
|
|
@@ -903,66 +909,65 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
903
909
|
}
|
|
904
910
|
))
|
|
905
911
|
);
|
|
906
|
-
},
|
|
907
|
-
const u =
|
|
908
|
-
const
|
|
909
|
-
let
|
|
910
|
-
for (let
|
|
911
|
-
const
|
|
912
|
-
if (
|
|
913
|
-
|
|
912
|
+
}, 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;
|
|
914
920
|
break;
|
|
915
921
|
}
|
|
916
922
|
}
|
|
917
|
-
if (
|
|
918
|
-
const
|
|
919
|
-
for (let
|
|
920
|
-
const
|
|
921
|
-
if (!
|
|
922
|
-
|
|
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);
|
|
923
929
|
}
|
|
924
|
-
const
|
|
925
|
-
return { headers:
|
|
926
|
-
},
|
|
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]);
|
|
927
933
|
return te(() => {
|
|
928
|
-
const
|
|
934
|
+
const g = () => {
|
|
929
935
|
try {
|
|
930
|
-
if (!u.current
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
k.getAttribute("data-table-annotated") === "1" || (k.style.setProperty("background", O, "important"), k.style.setProperty("background-color", O, "important"), k.setAttribute("data-table-annotated", "1"), v.content && (k.title = v.content)), b === 0 && a === 0 && setTimeout(() => k.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
|
|
936
|
+
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"));
|
|
942
|
+
});
|
|
943
|
+
});
|
|
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);
|
|
951
956
|
});
|
|
952
957
|
});
|
|
953
958
|
});
|
|
954
|
-
} catch (
|
|
955
|
-
console.warn("[MinimalMarkdownTable] apply annotations failed",
|
|
959
|
+
} catch (f) {
|
|
960
|
+
console.warn("[MinimalMarkdownTable] apply annotations failed", f);
|
|
956
961
|
}
|
|
957
|
-
},
|
|
958
|
-
|
|
962
|
+
}, m = requestAnimationFrame(() => {
|
|
963
|
+
g(), t && t();
|
|
959
964
|
});
|
|
960
|
-
return () => cancelAnimationFrame(
|
|
961
|
-
}, [e, o, t]),
|
|
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, `
|
|
962
967
|
.z-mdtbl-wrapper { overflow: auto; position: relative; }
|
|
963
968
|
.z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
|
|
964
969
|
.z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
|
|
965
|
-
.z-mdtbl th { background: transparent; font-weight: 600; color: inherit;
|
|
970
|
+
.z-mdtbl th { background: transparent; font-weight: 600; color: inherit; }
|
|
966
971
|
.z-mdtbl tbody tr:nth-child(odd) { background: transparent; }
|
|
967
972
|
.z-mdtbl tbody tr:hover { background: transparent; }
|
|
968
973
|
.z-mdtbl td, .z-mdtbl th { white-space: nowrap; }
|
|
@@ -970,8 +975,8 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
970
975
|
.z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
|
|
971
976
|
.z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
|
|
972
977
|
.z-mdtbl tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
|
|
973
|
-
`), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null,
|
|
974
|
-
},
|
|
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");
|
|
979
|
+
}, He = (e, t) => {
|
|
975
980
|
var o, u;
|
|
976
981
|
console.log("=== Fviewer renderHtmlContent ==="), console.log("data:", e), console.log("data.content:", e.content);
|
|
977
982
|
let r = "";
|
|
@@ -993,105 +998,105 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
993
998
|
sandbox: "allow-same-origin allow-scripts"
|
|
994
999
|
}
|
|
995
1000
|
));
|
|
996
|
-
},
|
|
1001
|
+
}, Ze = (e, t) => /* @__PURE__ */ n.createElement("div", { style: {
|
|
997
1002
|
display: "flex",
|
|
998
1003
|
justifyContent: "center",
|
|
999
1004
|
alignItems: "center",
|
|
1000
1005
|
height: "100%",
|
|
1001
1006
|
color: "#666"
|
|
1002
|
-
} }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, e.fileName || "\u672A\u77E5\u6587\u4EF6"))),
|
|
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 = ({
|
|
1003
1008
|
data: e,
|
|
1004
1009
|
annotationData: t = [],
|
|
1005
1010
|
totalPage: o = 0,
|
|
1006
1011
|
currentPage: u = 1,
|
|
1007
1012
|
scale: r,
|
|
1008
1013
|
// 重命名避免冲突
|
|
1009
|
-
rotation:
|
|
1014
|
+
rotation: c = 0,
|
|
1010
1015
|
// 添加rotation参数
|
|
1011
1016
|
eventsEmit: p,
|
|
1012
|
-
styles:
|
|
1013
|
-
tools:
|
|
1017
|
+
styles: g,
|
|
1018
|
+
tools: m = {
|
|
1014
1019
|
annotation: !0,
|
|
1015
1020
|
download: !0,
|
|
1016
1021
|
zoom: !0,
|
|
1017
1022
|
close: !0,
|
|
1018
1023
|
navigation: !0
|
|
1019
1024
|
},
|
|
1020
|
-
customComponents:
|
|
1021
|
-
className:
|
|
1022
|
-
contentClass:
|
|
1025
|
+
customComponents: f,
|
|
1026
|
+
className: C,
|
|
1027
|
+
contentClass: x
|
|
1023
1028
|
}) => {
|
|
1024
|
-
var
|
|
1025
|
-
const
|
|
1026
|
-
console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="), console.log("Fviewer data:", e), console.log("Fviewer data.content:", e == null ? void 0 : e.content), console.log("Fviewer data.content.document:", (
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1030
|
-
console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:",
|
|
1031
|
-
const
|
|
1032
|
-
var
|
|
1033
|
-
switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:",
|
|
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) {
|
|
1034
1039
|
case "pdf":
|
|
1035
1040
|
case "pdf_slides":
|
|
1036
|
-
return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:",
|
|
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");
|
|
1037
1042
|
case "image":
|
|
1038
|
-
return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"),
|
|
1043
|
+
return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), We(e, { scale: r, rotation: c, styles: g });
|
|
1039
1044
|
case "text":
|
|
1040
|
-
return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"),
|
|
1045
|
+
return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), Ie(e, { scale: r, styles: g });
|
|
1041
1046
|
case "markdown":
|
|
1042
1047
|
case "markdown_table":
|
|
1043
|
-
if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:",
|
|
1044
|
-
const V = typeof e.content == "string" ? e.content : ((
|
|
1045
|
-
(
|
|
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)
|
|
1046
1051
|
);
|
|
1047
1052
|
return /* @__PURE__ */ n.createElement(
|
|
1048
|
-
|
|
1053
|
+
Oe,
|
|
1049
1054
|
{
|
|
1050
1055
|
markdown: V,
|
|
1051
|
-
tableAnnotations:
|
|
1056
|
+
tableAnnotations: Q
|
|
1052
1057
|
}
|
|
1053
1058
|
);
|
|
1054
1059
|
}
|
|
1055
1060
|
return /* @__PURE__ */ n.createElement(
|
|
1056
|
-
|
|
1061
|
+
je,
|
|
1057
1062
|
{
|
|
1058
1063
|
data: e,
|
|
1059
|
-
parentProps: { data: e, annotationData: t, eventsEmit: p, styles:
|
|
1064
|
+
parentProps: { data: e, annotationData: t, eventsEmit: p, styles: g, tools: m, className: C, contentClass: x },
|
|
1060
1065
|
isTableMode: !1
|
|
1061
1066
|
}
|
|
1062
1067
|
);
|
|
1063
1068
|
case "html":
|
|
1064
|
-
return console.log("\u6E32\u67D3HTML\u5185\u5BB9"),
|
|
1069
|
+
return console.log("\u6E32\u67D3HTML\u5185\u5BB9"), He(e);
|
|
1065
1070
|
default:
|
|
1066
|
-
return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"),
|
|
1071
|
+
return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"), Ze(e);
|
|
1067
1072
|
}
|
|
1068
1073
|
};
|
|
1069
1074
|
return n.useEffect(() => {
|
|
1070
|
-
const
|
|
1075
|
+
const _ = h.current, V = j.current, Q = _ !== e, K = V !== (e ? e.content : void 0);
|
|
1071
1076
|
console.log("[Fviewer useEffect:data] triggered", {
|
|
1072
|
-
dataChanged:
|
|
1073
|
-
contentChanged:
|
|
1077
|
+
dataChanged: Q,
|
|
1078
|
+
contentChanged: K,
|
|
1074
1079
|
hasData: !!e,
|
|
1075
1080
|
hasContent: !!(e != null && e.content),
|
|
1076
|
-
isLoadingBefore:
|
|
1077
|
-
}),
|
|
1081
|
+
isLoadingBefore: y
|
|
1082
|
+
}), h.current = e, j.current = e ? e.content : void 0;
|
|
1078
1083
|
}, [e == null ? void 0 : e.content]), n.useEffect(() => {
|
|
1079
|
-
|
|
1080
|
-
}, [
|
|
1081
|
-
console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="), console.log("annotationData:", t), console.log("annotationData \u957F\u5EA6:", (t == null ? void 0 : t.length) || 0), console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:",
|
|
1082
|
-
}, [t,
|
|
1083
|
-
|
|
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,
|
|
1084
1089
|
{
|
|
1085
|
-
status:
|
|
1086
|
-
theme:
|
|
1090
|
+
status: z,
|
|
1091
|
+
theme: B
|
|
1087
1092
|
}
|
|
1088
|
-
) : /* @__PURE__ */ n.createElement(
|
|
1089
|
-
|
|
1093
|
+
) : /* @__PURE__ */ n.createElement(Re, { $theme: B }, z) : i ? f != null && f.ErrorComponent ? /* @__PURE__ */ n.createElement(
|
|
1094
|
+
f.ErrorComponent,
|
|
1090
1095
|
{
|
|
1091
|
-
error:
|
|
1092
|
-
theme:
|
|
1096
|
+
error: i,
|
|
1097
|
+
theme: B
|
|
1093
1098
|
}
|
|
1094
|
-
) : /* @__PURE__ */ n.createElement(
|
|
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());
|
|
1095
1100
|
};
|
|
1096
1101
|
/**
|
|
1097
1102
|
* @license lucide-react v0.456.0 - ISC
|
|
@@ -1099,14 +1104,14 @@ const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
1099
1104
|
* This source code is licensed under the ISC license.
|
|
1100
1105
|
* See the LICENSE file in the root directory of this source tree.
|
|
1101
1106
|
*/
|
|
1102
|
-
const
|
|
1107
|
+
const qe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), be = (...e) => e.filter((t, o, u) => !!t && t.trim() !== "" && u.indexOf(t) === o).join(" ").trim();
|
|
1103
1108
|
/**
|
|
1104
1109
|
* @license lucide-react v0.456.0 - ISC
|
|
1105
1110
|
*
|
|
1106
1111
|
* This source code is licensed under the ISC license.
|
|
1107
1112
|
* See the LICENSE file in the root directory of this source tree.
|
|
1108
1113
|
*/
|
|
1109
|
-
var
|
|
1114
|
+
var Ue = {
|
|
1110
1115
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1111
1116
|
width: 24,
|
|
1112
1117
|
height: 24,
|
|
@@ -1123,31 +1128,31 @@ var qe = {
|
|
|
1123
1128
|
* This source code is licensed under the ISC license.
|
|
1124
1129
|
* See the LICENSE file in the root directory of this source tree.
|
|
1125
1130
|
*/
|
|
1126
|
-
const
|
|
1131
|
+
const Ye = ve(
|
|
1127
1132
|
({
|
|
1128
1133
|
color: e = "currentColor",
|
|
1129
1134
|
size: t = 24,
|
|
1130
1135
|
strokeWidth: o = 2,
|
|
1131
1136
|
absoluteStrokeWidth: u,
|
|
1132
1137
|
className: r = "",
|
|
1133
|
-
children:
|
|
1138
|
+
children: c,
|
|
1134
1139
|
iconNode: p,
|
|
1135
|
-
...
|
|
1136
|
-
},
|
|
1140
|
+
...g
|
|
1141
|
+
}, m) => Ee(
|
|
1137
1142
|
"svg",
|
|
1138
1143
|
{
|
|
1139
|
-
ref:
|
|
1140
|
-
...
|
|
1144
|
+
ref: m,
|
|
1145
|
+
...Ue,
|
|
1141
1146
|
width: t,
|
|
1142
1147
|
height: t,
|
|
1143
1148
|
stroke: e,
|
|
1144
1149
|
strokeWidth: u ? Number(o) * 24 / Number(t) : o,
|
|
1145
|
-
className:
|
|
1146
|
-
...
|
|
1150
|
+
className: be("lucide", r),
|
|
1151
|
+
...g
|
|
1147
1152
|
},
|
|
1148
1153
|
[
|
|
1149
|
-
...p.map(([
|
|
1150
|
-
...Array.isArray(
|
|
1154
|
+
...p.map(([f, C]) => Ee(f, C)),
|
|
1155
|
+
...Array.isArray(c) ? c : [c]
|
|
1151
1156
|
]
|
|
1152
1157
|
)
|
|
1153
1158
|
);
|
|
@@ -1158,11 +1163,11 @@ const Ue = Ce(
|
|
|
1158
1163
|
* See the LICENSE file in the root directory of this source tree.
|
|
1159
1164
|
*/
|
|
1160
1165
|
const ue = (e, t) => {
|
|
1161
|
-
const o =
|
|
1162
|
-
({ className: u, ...r },
|
|
1163
|
-
ref:
|
|
1166
|
+
const o = ve(
|
|
1167
|
+
({ className: u, ...r }, c) => Ee(Ye, {
|
|
1168
|
+
ref: c,
|
|
1164
1169
|
iconNode: t,
|
|
1165
|
-
className:
|
|
1170
|
+
className: be(`lucide-${qe(e)}`, u),
|
|
1166
1171
|
...r
|
|
1167
1172
|
})
|
|
1168
1173
|
);
|
|
@@ -1174,7 +1179,7 @@ const ue = (e, t) => {
|
|
|
1174
1179
|
* This source code is licensed under the ISC license.
|
|
1175
1180
|
* See the LICENSE file in the root directory of this source tree.
|
|
1176
1181
|
*/
|
|
1177
|
-
const
|
|
1182
|
+
const Ge = ue("ChevronLeft", [
|
|
1178
1183
|
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
1179
1184
|
]);
|
|
1180
1185
|
/**
|
|
@@ -1183,7 +1188,7 @@ const Ye = ue("ChevronLeft", [
|
|
|
1183
1188
|
* This source code is licensed under the ISC license.
|
|
1184
1189
|
* See the LICENSE file in the root directory of this source tree.
|
|
1185
1190
|
*/
|
|
1186
|
-
const
|
|
1191
|
+
const Ve = ue("ChevronRight", [
|
|
1187
1192
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
1188
1193
|
]);
|
|
1189
1194
|
/**
|
|
@@ -1192,7 +1197,7 @@ const Ge = ue("ChevronRight", [
|
|
|
1192
1197
|
* This source code is licensed under the ISC license.
|
|
1193
1198
|
* See the LICENSE file in the root directory of this source tree.
|
|
1194
1199
|
*/
|
|
1195
|
-
const
|
|
1200
|
+
const Je = ue("Download", [
|
|
1196
1201
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
1197
1202
|
["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
|
|
1198
1203
|
["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
|
|
@@ -1203,7 +1208,7 @@ const Ve = ue("Download", [
|
|
|
1203
1208
|
* This source code is licensed under the ISC license.
|
|
1204
1209
|
* See the LICENSE file in the root directory of this source tree.
|
|
1205
1210
|
*/
|
|
1206
|
-
const
|
|
1211
|
+
const Ke = ue("Pencil", [
|
|
1207
1212
|
[
|
|
1208
1213
|
"path",
|
|
1209
1214
|
{
|
|
@@ -1219,7 +1224,7 @@ const Je = ue("Pencil", [
|
|
|
1219
1224
|
* This source code is licensed under the ISC license.
|
|
1220
1225
|
* See the LICENSE file in the root directory of this source tree.
|
|
1221
1226
|
*/
|
|
1222
|
-
const
|
|
1227
|
+
const Qe = ue("RotateCcw", [
|
|
1223
1228
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
1224
1229
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
1225
1230
|
]);
|
|
@@ -1229,7 +1234,7 @@ const Ke = ue("RotateCcw", [
|
|
|
1229
1234
|
* This source code is licensed under the ISC license.
|
|
1230
1235
|
* See the LICENSE file in the root directory of this source tree.
|
|
1231
1236
|
*/
|
|
1232
|
-
const
|
|
1237
|
+
const et = ue("RotateCw", [
|
|
1233
1238
|
["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
|
|
1234
1239
|
["path", { d: "M21 3v5h-5", key: "1q7to0" }]
|
|
1235
1240
|
]);
|
|
@@ -1239,7 +1244,7 @@ const Qe = ue("RotateCw", [
|
|
|
1239
1244
|
* This source code is licensed under the ISC license.
|
|
1240
1245
|
* See the LICENSE file in the root directory of this source tree.
|
|
1241
1246
|
*/
|
|
1242
|
-
const
|
|
1247
|
+
const tt = ue("X", [
|
|
1243
1248
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
1244
1249
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
1245
1250
|
]);
|
|
@@ -1249,7 +1254,7 @@ const et = ue("X", [
|
|
|
1249
1254
|
* This source code is licensed under the ISC license.
|
|
1250
1255
|
* See the LICENSE file in the root directory of this source tree.
|
|
1251
1256
|
*/
|
|
1252
|
-
const
|
|
1257
|
+
const ot = ue("ZoomIn", [
|
|
1253
1258
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
1254
1259
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
1255
1260
|
["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
|
|
@@ -1261,11 +1266,11 @@ const tt = ue("ZoomIn", [
|
|
|
1261
1266
|
* This source code is licensed under the ISC license.
|
|
1262
1267
|
* See the LICENSE file in the root directory of this source tree.
|
|
1263
1268
|
*/
|
|
1264
|
-
const
|
|
1269
|
+
const nt = ue("ZoomOut", [
|
|
1265
1270
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
1266
1271
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
1267
1272
|
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
1268
|
-
]),
|
|
1273
|
+
]), ut = G.div`
|
|
1269
1274
|
display: flex;
|
|
1270
1275
|
align-items: center;
|
|
1271
1276
|
padding: 0px 12px;
|
|
@@ -1274,20 +1279,20 @@ const ot = ue("ZoomOut", [
|
|
|
1274
1279
|
border-bottom: 1px solid ${(e) => e.$theme.colors.border};
|
|
1275
1280
|
background: ${(e) => e.$theme.colors.background};
|
|
1276
1281
|
min-height: 52px;
|
|
1277
|
-
`,
|
|
1282
|
+
`, rt = G.div`
|
|
1278
1283
|
display: flex;
|
|
1279
1284
|
align-items: center;
|
|
1280
1285
|
gap: 8px;
|
|
1281
1286
|
flex: 1;
|
|
1282
1287
|
min-width: 0;
|
|
1283
|
-
`,
|
|
1288
|
+
`, lt = G.div`
|
|
1284
1289
|
font-size: 14px;
|
|
1285
1290
|
font-weight: 500;
|
|
1286
1291
|
color: ${(e) => e.$theme.colors.text};
|
|
1287
1292
|
white-space: nowrap;
|
|
1288
1293
|
overflow: hidden;
|
|
1289
1294
|
text-overflow: ellipsis;
|
|
1290
|
-
`,
|
|
1295
|
+
`, at = G.div`
|
|
1291
1296
|
font-size: 12px;
|
|
1292
1297
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1293
1298
|
white-space: nowrap;
|
|
@@ -1328,7 +1333,7 @@ const ot = ue("ZoomOut", [
|
|
|
1328
1333
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1329
1334
|
min-width: 40px;
|
|
1330
1335
|
text-align: center;
|
|
1331
|
-
`,
|
|
1336
|
+
`, ct = {
|
|
1332
1337
|
colors: {
|
|
1333
1338
|
primary: "#007bff",
|
|
1334
1339
|
secondary: "#6c757d",
|
|
@@ -1365,100 +1370,100 @@ const ot = ue("ZoomOut", [
|
|
|
1365
1370
|
rotate: !0
|
|
1366
1371
|
},
|
|
1367
1372
|
styles: r,
|
|
1368
|
-
onPrevPage:
|
|
1373
|
+
onPrevPage: c,
|
|
1369
1374
|
onNextPage: p,
|
|
1370
|
-
onZoomIn:
|
|
1371
|
-
onZoomOut:
|
|
1372
|
-
onAnnotationToggle:
|
|
1373
|
-
onDownload:
|
|
1374
|
-
onRotateLeft:
|
|
1375
|
-
onRotateRight:
|
|
1376
|
-
onClose:
|
|
1377
|
-
scale:
|
|
1378
|
-
isAnnotating:
|
|
1379
|
-
className:
|
|
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
|
|
1380
1385
|
}) => {
|
|
1381
|
-
const
|
|
1382
|
-
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(
|
|
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(
|
|
1383
1388
|
ne,
|
|
1384
1389
|
{
|
|
1385
|
-
$theme:
|
|
1386
|
-
onClick:
|
|
1390
|
+
$theme: y,
|
|
1391
|
+
onClick: c,
|
|
1387
1392
|
disabled: t <= 1,
|
|
1388
1393
|
title: "\u4E0A\u4E00\u9875"
|
|
1389
1394
|
},
|
|
1390
|
-
/* @__PURE__ */ n.createElement(
|
|
1391
|
-
), o > 0 && /* @__PURE__ */ n.createElement(
|
|
1395
|
+
/* @__PURE__ */ n.createElement(Ge, { size: 16 })
|
|
1396
|
+
), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme: y }, t, " / ", o), /* @__PURE__ */ n.createElement(
|
|
1392
1397
|
ne,
|
|
1393
1398
|
{
|
|
1394
|
-
$theme:
|
|
1399
|
+
$theme: y,
|
|
1395
1400
|
onClick: p,
|
|
1396
1401
|
disabled: !o || t >= o,
|
|
1397
1402
|
title: "\u4E0B\u4E00\u9875"
|
|
1398
1403
|
},
|
|
1399
|
-
/* @__PURE__ */ n.createElement(
|
|
1404
|
+
/* @__PURE__ */ n.createElement(Ve, { size: 16 })
|
|
1400
1405
|
)), u.zoom && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1401
1406
|
ne,
|
|
1402
1407
|
{
|
|
1403
|
-
$theme:
|
|
1404
|
-
onClick:
|
|
1405
|
-
disabled:
|
|
1408
|
+
$theme: y,
|
|
1409
|
+
onClick: m,
|
|
1410
|
+
disabled: s <= 0.3,
|
|
1406
1411
|
title: "\u7F29\u5C0F"
|
|
1407
1412
|
},
|
|
1408
|
-
/* @__PURE__ */ n.createElement(
|
|
1409
|
-
), /* @__PURE__ */ n.createElement(it, { $theme:
|
|
1413
|
+
/* @__PURE__ */ n.createElement(nt, { size: 16 })
|
|
1414
|
+
), /* @__PURE__ */ n.createElement(it, { $theme: y }, Math.round(s * 100), "%"), /* @__PURE__ */ n.createElement(
|
|
1410
1415
|
ne,
|
|
1411
1416
|
{
|
|
1412
|
-
$theme:
|
|
1413
|
-
onClick:
|
|
1414
|
-
disabled:
|
|
1417
|
+
$theme: y,
|
|
1418
|
+
onClick: g,
|
|
1419
|
+
disabled: s >= 3,
|
|
1415
1420
|
title: "\u653E\u5927"
|
|
1416
1421
|
},
|
|
1417
|
-
/* @__PURE__ */ n.createElement(
|
|
1422
|
+
/* @__PURE__ */ n.createElement(ot, { size: 16 })
|
|
1418
1423
|
)), u.annotation && /* @__PURE__ */ n.createElement(
|
|
1419
1424
|
ne,
|
|
1420
1425
|
{
|
|
1421
|
-
$theme:
|
|
1422
|
-
$active:
|
|
1423
|
-
onClick:
|
|
1424
|
-
title:
|
|
1426
|
+
$theme: y,
|
|
1427
|
+
$active: a,
|
|
1428
|
+
onClick: f,
|
|
1429
|
+
title: a ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
|
|
1425
1430
|
},
|
|
1426
|
-
/* @__PURE__ */ n.createElement(
|
|
1431
|
+
/* @__PURE__ */ n.createElement(Ke, { size: 16 })
|
|
1427
1432
|
), u.download && /* @__PURE__ */ n.createElement(
|
|
1428
1433
|
ne,
|
|
1429
1434
|
{
|
|
1430
|
-
$theme:
|
|
1431
|
-
onClick:
|
|
1435
|
+
$theme: y,
|
|
1436
|
+
onClick: C,
|
|
1432
1437
|
title: "\u4E0B\u8F7D"
|
|
1433
1438
|
},
|
|
1434
|
-
/* @__PURE__ */ n.createElement(
|
|
1439
|
+
/* @__PURE__ */ n.createElement(Je, { size: 16 })
|
|
1435
1440
|
), u.rotate && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1436
1441
|
ne,
|
|
1437
1442
|
{
|
|
1438
|
-
$theme:
|
|
1439
|
-
onClick:
|
|
1443
|
+
$theme: y,
|
|
1444
|
+
onClick: x,
|
|
1440
1445
|
title: "\u5411\u5DE6\u65CB\u8F6C"
|
|
1441
1446
|
},
|
|
1442
|
-
/* @__PURE__ */ n.createElement(
|
|
1447
|
+
/* @__PURE__ */ n.createElement(Qe, { size: 16 })
|
|
1443
1448
|
), /* @__PURE__ */ n.createElement(
|
|
1444
1449
|
ne,
|
|
1445
1450
|
{
|
|
1446
|
-
$theme:
|
|
1447
|
-
onClick:
|
|
1451
|
+
$theme: y,
|
|
1452
|
+
onClick: v,
|
|
1448
1453
|
title: "\u5411\u53F3\u65CB\u8F6C"
|
|
1449
1454
|
},
|
|
1450
|
-
/* @__PURE__ */ n.createElement(
|
|
1455
|
+
/* @__PURE__ */ n.createElement(et, { size: 16 })
|
|
1451
1456
|
)), u.close && /* @__PURE__ */ n.createElement(
|
|
1452
1457
|
ne,
|
|
1453
1458
|
{
|
|
1454
|
-
$theme:
|
|
1455
|
-
onClick:
|
|
1459
|
+
$theme: y,
|
|
1460
|
+
onClick: D,
|
|
1456
1461
|
title: "\u5173\u95ED"
|
|
1457
1462
|
},
|
|
1458
|
-
/* @__PURE__ */ n.createElement(
|
|
1463
|
+
/* @__PURE__ */ n.createElement(tt, { size: 16 })
|
|
1459
1464
|
)));
|
|
1460
|
-
}),
|
|
1461
|
-
if (
|
|
1465
|
+
}), dt = () => {
|
|
1466
|
+
if (vt()) {
|
|
1462
1467
|
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");
|
|
1463
1468
|
return;
|
|
1464
1469
|
}
|
|
@@ -1467,28 +1472,28 @@ const ot = ue("ZoomOut", [
|
|
|
1467
1472
|
registerPDFWorker("/worker/pdf.worker.min.js");
|
|
1468
1473
|
\u6CE8\u610F\uFF1AWorker \u6587\u4EF6\u8DEF\u5F84\u9700\u8981\u6839\u636E\u5B9E\u9645\u90E8\u7F72\u60C5\u51B5\u8C03\u6574\u3002`;
|
|
1469
1474
|
throw console.error(e), new Error(e);
|
|
1470
|
-
},
|
|
1475
|
+
}, xe = (e, t, o) => {
|
|
1471
1476
|
if (!e && !t && !o) return "unknown";
|
|
1472
1477
|
const u = e || "", r = t || "";
|
|
1473
1478
|
return u.toLowerCase().endsWith(".pdf") || r === "pdf" || (o == null ? void 0 : o.type) === "pdf" ? "pdf" : u.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/) || r === "image" || (o == null ? void 0 : o.type) === "image" ? "image" : u.toLowerCase().endsWith(".md") || r === "markdown" || (o == null ? void 0 : o.type) === "markdown" ? r === "markdown_table" || (o == null ? void 0 : o.type) === "markdown_table" ? "markdown_table" : "markdown" : u.toLowerCase().match(/\.(html|htm)$/) || r === "html" || (o == null ? void 0 : o.type) === "html" ? "html" : u.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/) || r === "text" || (o == null ? void 0 : o.type) === "text" ? "text" : "unknown";
|
|
1474
|
-
},
|
|
1479
|
+
}, mt = async (e, t = {}) => {
|
|
1475
1480
|
console.log("=== parsePdfFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1476
1481
|
try {
|
|
1477
|
-
|
|
1482
|
+
dt();
|
|
1478
1483
|
let o;
|
|
1479
1484
|
if (typeof e == "string") {
|
|
1480
1485
|
console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
|
|
1481
|
-
const
|
|
1486
|
+
const c = re.getDocument({
|
|
1482
1487
|
url: e,
|
|
1483
1488
|
httpHeaders: t.token ? { Authorization: t.token } : void 0
|
|
1484
1489
|
});
|
|
1485
|
-
console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",
|
|
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));
|
|
1486
1491
|
} else {
|
|
1487
1492
|
console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");
|
|
1488
|
-
const
|
|
1493
|
+
const c = re.getDocument({
|
|
1489
1494
|
data: e
|
|
1490
1495
|
});
|
|
1491
|
-
console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",
|
|
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);
|
|
1492
1497
|
}
|
|
1493
1498
|
const u = o.numPages;
|
|
1494
1499
|
console.log("PDF\u52A0\u8F7D\u6210\u529F\uFF0C\u603B\u9875\u6570:", u), console.log("PDF\u6307\u7EB9:", o.fingerprints), console.log("PDF\u4F20\u8F93\u5BF9\u8C61:", o._transport);
|
|
@@ -1521,7 +1526,7 @@ const ot = ue("ZoomOut", [
|
|
|
1521
1526
|
error: u
|
|
1522
1527
|
};
|
|
1523
1528
|
}
|
|
1524
|
-
},
|
|
1529
|
+
}, gt = async (e, t = {}) => {
|
|
1525
1530
|
console.log("=== parseImageFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1526
1531
|
try {
|
|
1527
1532
|
let o;
|
|
@@ -1532,20 +1537,20 @@ const ot = ue("ZoomOut", [
|
|
|
1532
1537
|
const r = new Blob([e]);
|
|
1533
1538
|
o = URL.createObjectURL(r);
|
|
1534
1539
|
}
|
|
1535
|
-
console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r,
|
|
1540
|
+
console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r, c) => {
|
|
1536
1541
|
const p = new Image();
|
|
1537
1542
|
p.onload = () => {
|
|
1538
1543
|
console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", p.width, "x", p.height), r();
|
|
1539
1544
|
}, p.onerror = () => {
|
|
1540
|
-
console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o),
|
|
1545
|
+
console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), c(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
|
|
1541
1546
|
};
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1547
|
+
const g = setTimeout(() => {
|
|
1548
|
+
c(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
|
|
1544
1549
|
}, 1e4);
|
|
1545
1550
|
p.onload = () => {
|
|
1546
|
-
clearTimeout(
|
|
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();
|
|
1547
1552
|
}, p.onerror = () => {
|
|
1548
|
-
clearTimeout(
|
|
1553
|
+
clearTimeout(g), console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), c(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
|
|
1549
1554
|
}, p.src = o;
|
|
1550
1555
|
});
|
|
1551
1556
|
const u = {
|
|
@@ -1567,7 +1572,7 @@ const ot = ue("ZoomOut", [
|
|
|
1567
1572
|
error: `\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1568
1573
|
};
|
|
1569
1574
|
}
|
|
1570
|
-
},
|
|
1575
|
+
}, ft = async (e, t = {}) => {
|
|
1571
1576
|
try {
|
|
1572
1577
|
let o;
|
|
1573
1578
|
if (typeof e == "string") {
|
|
@@ -1597,7 +1602,7 @@ const ot = ue("ZoomOut", [
|
|
|
1597
1602
|
error: `\u6587\u672C\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1598
1603
|
};
|
|
1599
1604
|
}
|
|
1600
|
-
},
|
|
1605
|
+
}, Et = async (e, t = {}) => {
|
|
1601
1606
|
try {
|
|
1602
1607
|
let o;
|
|
1603
1608
|
if (typeof e == "string") {
|
|
@@ -1627,7 +1632,7 @@ const ot = ue("ZoomOut", [
|
|
|
1627
1632
|
error: `Markdown\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1628
1633
|
};
|
|
1629
1634
|
}
|
|
1630
|
-
},
|
|
1635
|
+
}, ht = async (e, t = {}) => {
|
|
1631
1636
|
console.log("=== parseHtmlFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1632
1637
|
try {
|
|
1633
1638
|
let o;
|
|
@@ -1660,19 +1665,19 @@ const ot = ue("ZoomOut", [
|
|
|
1660
1665
|
error: `HTML\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1661
1666
|
};
|
|
1662
1667
|
}
|
|
1663
|
-
},
|
|
1664
|
-
switch (
|
|
1668
|
+
}, Ft = async (e, t = {}) => {
|
|
1669
|
+
switch (xe(t.fileName, t.fileType)) {
|
|
1665
1670
|
case "pdf":
|
|
1666
|
-
return await dt(e, t);
|
|
1667
|
-
case "image":
|
|
1668
1671
|
return await mt(e, t);
|
|
1669
|
-
case "
|
|
1672
|
+
case "image":
|
|
1670
1673
|
return await gt(e, t);
|
|
1674
|
+
case "text":
|
|
1675
|
+
return await ft(e, t);
|
|
1671
1676
|
case "markdown":
|
|
1672
1677
|
case "markdown_table":
|
|
1673
|
-
return await ft(e, t);
|
|
1674
|
-
case "html":
|
|
1675
1678
|
return await Et(e, t);
|
|
1679
|
+
case "html":
|
|
1680
|
+
return await ht(e, t);
|
|
1676
1681
|
default:
|
|
1677
1682
|
return {
|
|
1678
1683
|
type: "unknown",
|
|
@@ -1692,7 +1697,7 @@ const ot = ue("ZoomOut", [
|
|
|
1692
1697
|
border-radius: ${(e) => e.$theme.space.radius};
|
|
1693
1698
|
overflow: hidden;
|
|
1694
1699
|
min-height: 0; /* 确保flex子元素可以收缩 */
|
|
1695
|
-
`,
|
|
1700
|
+
`, pt = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement("div", { style: {
|
|
1696
1701
|
display: "flex",
|
|
1697
1702
|
flexDirection: "column",
|
|
1698
1703
|
alignItems: "center",
|
|
@@ -1782,7 +1787,7 @@ G.div`
|
|
|
1782
1787
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1783
1788
|
font-size: 14px;
|
|
1784
1789
|
`;
|
|
1785
|
-
const
|
|
1790
|
+
const Ce = G.div`
|
|
1786
1791
|
display: flex;
|
|
1787
1792
|
flex-direction: column;
|
|
1788
1793
|
align-items: center;
|
|
@@ -1791,7 +1796,7 @@ const pe = G.div`
|
|
|
1791
1796
|
color: ${(e) => e.$theme.colors.error};
|
|
1792
1797
|
text-align: center;
|
|
1793
1798
|
padding: 20px;
|
|
1794
|
-
`,
|
|
1799
|
+
`, Ct = {
|
|
1795
1800
|
colors: {
|
|
1796
1801
|
primary: "#007bff",
|
|
1797
1802
|
secondary: "#6c757d",
|
|
@@ -1815,36 +1820,36 @@ const pe = G.div`
|
|
|
1815
1820
|
shadow: "md",
|
|
1816
1821
|
lineHeight: "md"
|
|
1817
1822
|
}
|
|
1818
|
-
},
|
|
1823
|
+
}, xt = ({
|
|
1819
1824
|
fileUrl: e,
|
|
1820
1825
|
fileType: t,
|
|
1821
1826
|
annotations: o,
|
|
1822
1827
|
fileName: u,
|
|
1823
1828
|
token: r,
|
|
1824
|
-
initialPage:
|
|
1829
|
+
initialPage: c = 1,
|
|
1825
1830
|
data: p,
|
|
1826
|
-
eventsEmit:
|
|
1831
|
+
eventsEmit: g = () => {
|
|
1827
1832
|
},
|
|
1828
|
-
styles:
|
|
1829
|
-
tools:
|
|
1833
|
+
styles: m,
|
|
1834
|
+
tools: f = {
|
|
1830
1835
|
annotation: !1,
|
|
1831
1836
|
download: !1,
|
|
1832
1837
|
zoom: !0,
|
|
1833
1838
|
close: !0,
|
|
1834
1839
|
navigation: !0
|
|
1835
1840
|
},
|
|
1836
|
-
customComponents:
|
|
1837
|
-
className:
|
|
1838
|
-
headerClass:
|
|
1839
|
-
contentClass:
|
|
1841
|
+
customComponents: C,
|
|
1842
|
+
className: x,
|
|
1843
|
+
headerClass: v,
|
|
1844
|
+
contentClass: D
|
|
1840
1845
|
}) => {
|
|
1841
|
-
var
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1844
|
-
}, [
|
|
1845
|
-
var
|
|
1846
|
-
if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }),
|
|
1847
|
-
|
|
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({
|
|
1848
1853
|
type: p.fileType || t || "text",
|
|
1849
1854
|
content: p.content,
|
|
1850
1855
|
fileName: p.fileName || u,
|
|
@@ -1854,100 +1859,100 @@ const pe = G.div`
|
|
|
1854
1859
|
return;
|
|
1855
1860
|
}
|
|
1856
1861
|
if (!e) {
|
|
1857
|
-
|
|
1862
|
+
b("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), y(!1);
|
|
1858
1863
|
return;
|
|
1859
1864
|
}
|
|
1860
1865
|
try {
|
|
1861
|
-
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1864
|
-
const
|
|
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, {
|
|
1865
1870
|
fileName: u,
|
|
1866
1871
|
fileType: t,
|
|
1867
1872
|
token: r
|
|
1868
1873
|
});
|
|
1869
|
-
console.log("=== StaticFileReader parseFile \u7ED3\u679C ==="), console.log("result:",
|
|
1870
|
-
} catch (
|
|
1871
|
-
|
|
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"}`);
|
|
1872
1877
|
} finally {
|
|
1873
|
-
|
|
1878
|
+
y(!1);
|
|
1874
1879
|
}
|
|
1875
|
-
}, [e, u, t, r, p,
|
|
1880
|
+
}, [e, u, t, r, p, d]);
|
|
1876
1881
|
te(() => {
|
|
1877
|
-
|
|
1878
|
-
}, [
|
|
1879
|
-
const
|
|
1880
|
-
switch (
|
|
1882
|
+
l();
|
|
1883
|
+
}, [l]);
|
|
1884
|
+
const E = A((F, L, J) => {
|
|
1885
|
+
switch (F) {
|
|
1881
1886
|
case "pageChange":
|
|
1882
|
-
|
|
1887
|
+
L != null && L.pageNumber && R(L.pageNumber);
|
|
1883
1888
|
break;
|
|
1884
1889
|
// if (data?.annotationId) {
|
|
1885
1890
|
// setAnnotations(prev => prev.filter(a => a.id !== data.annotationId));
|
|
1886
1891
|
// }
|
|
1887
1892
|
// break;
|
|
1888
1893
|
default:
|
|
1889
|
-
|
|
1894
|
+
g(F, L, J);
|
|
1890
1895
|
break;
|
|
1891
1896
|
}
|
|
1892
|
-
}, [
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
}, [
|
|
1896
|
-
const
|
|
1897
|
-
|
|
1898
|
-
}, [
|
|
1899
|
-
if (
|
|
1900
|
-
const
|
|
1901
|
-
|
|
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 });
|
|
1902
1907
|
}
|
|
1903
|
-
}, [
|
|
1904
|
-
const
|
|
1905
|
-
if (
|
|
1906
|
-
const
|
|
1907
|
-
L
|
|
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 });
|
|
1908
1913
|
}
|
|
1909
|
-
}, [
|
|
1910
|
-
const
|
|
1911
|
-
|
|
1912
|
-
}, [
|
|
1913
|
-
|
|
1914
|
-
}, [
|
|
1915
|
-
|
|
1916
|
-
}, [V,
|
|
1917
|
-
|
|
1918
|
-
}, [V,
|
|
1919
|
-
|
|
1920
|
-
}, [
|
|
1921
|
-
const
|
|
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";
|
|
1922
1927
|
return {
|
|
1923
|
-
...
|
|
1928
|
+
...L,
|
|
1924
1929
|
// 缩放功能:只有 PDF 和图片支持
|
|
1925
|
-
zoom:
|
|
1930
|
+
zoom: L.zoom && !M,
|
|
1926
1931
|
// 导航功能:只有多页文件支持(PDF)
|
|
1927
|
-
navigation:
|
|
1932
|
+
navigation: L.navigation && J,
|
|
1928
1933
|
// 标注功能:PDF、Markdown、Markdown表格都支持
|
|
1929
|
-
annotation:
|
|
1934
|
+
annotation: L.annotation && (F === "pdf" || F === "markdown" || F === "markdown_table"),
|
|
1930
1935
|
// 旋转功能:只有图片支持
|
|
1931
|
-
rotate:
|
|
1936
|
+
rotate: L.rotate && F === "image",
|
|
1932
1937
|
// 下载功能:所有文件都支持
|
|
1933
|
-
download:
|
|
1938
|
+
download: L.download,
|
|
1934
1939
|
// 关闭功能:所有文件都支持
|
|
1935
|
-
close:
|
|
1940
|
+
close: L.close
|
|
1936
1941
|
};
|
|
1937
1942
|
}, []);
|
|
1938
|
-
if (
|
|
1939
|
-
const
|
|
1940
|
-
...
|
|
1943
|
+
if (B) {
|
|
1944
|
+
const F = oe(t || "unknown", {
|
|
1945
|
+
...f,
|
|
1941
1946
|
navigation: !1
|
|
1942
1947
|
});
|
|
1943
|
-
return /* @__PURE__ */ n.createElement(de, { $theme:
|
|
1948
|
+
return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
|
|
1944
1949
|
ce,
|
|
1945
1950
|
{
|
|
1946
1951
|
fileName: u || "\u52A0\u8F7D\u4E2D...",
|
|
1947
1952
|
currentPage: 1,
|
|
1948
1953
|
totalPage: 0,
|
|
1949
|
-
tools:
|
|
1950
|
-
styles:
|
|
1954
|
+
tools: F,
|
|
1955
|
+
styles: m,
|
|
1951
1956
|
onPrevPage: () => {
|
|
1952
1957
|
},
|
|
1953
1958
|
onNextPage: () => {
|
|
@@ -1960,38 +1965,38 @@ const pe = G.div`
|
|
|
1960
1965
|
},
|
|
1961
1966
|
onDownload: () => {
|
|
1962
1967
|
},
|
|
1963
|
-
onClose:
|
|
1968
|
+
onClose: Y,
|
|
1964
1969
|
scale: 1,
|
|
1965
1970
|
isAnnotating: !1,
|
|
1966
|
-
className:
|
|
1971
|
+
className: v
|
|
1967
1972
|
}
|
|
1968
|
-
),
|
|
1969
|
-
|
|
1973
|
+
), C != null && C.LoadingComponent ? /* @__PURE__ */ n.createElement(
|
|
1974
|
+
C.LoadingComponent,
|
|
1970
1975
|
{
|
|
1971
|
-
status:
|
|
1972
|
-
theme:
|
|
1976
|
+
status: Z,
|
|
1977
|
+
theme: a
|
|
1973
1978
|
}
|
|
1974
1979
|
) : /* @__PURE__ */ n.createElement(
|
|
1975
|
-
|
|
1980
|
+
pt,
|
|
1976
1981
|
{
|
|
1977
|
-
status:
|
|
1978
|
-
theme:
|
|
1982
|
+
status: Z,
|
|
1983
|
+
theme: a
|
|
1979
1984
|
}
|
|
1980
1985
|
));
|
|
1981
1986
|
}
|
|
1982
|
-
if (
|
|
1983
|
-
const
|
|
1984
|
-
...
|
|
1987
|
+
if (i) {
|
|
1988
|
+
const F = oe(t || "unknown", {
|
|
1989
|
+
...f,
|
|
1985
1990
|
navigation: !1
|
|
1986
1991
|
});
|
|
1987
|
-
return /* @__PURE__ */ n.createElement(de, { $theme:
|
|
1992
|
+
return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
|
|
1988
1993
|
ce,
|
|
1989
1994
|
{
|
|
1990
1995
|
fileName: u || "\u9519\u8BEF",
|
|
1991
1996
|
currentPage: 1,
|
|
1992
1997
|
totalPage: 0,
|
|
1993
|
-
tools:
|
|
1994
|
-
styles:
|
|
1998
|
+
tools: F,
|
|
1999
|
+
styles: m,
|
|
1995
2000
|
onPrevPage: () => {
|
|
1996
2001
|
},
|
|
1997
2002
|
onNextPage: () => {
|
|
@@ -2004,26 +2009,26 @@ const pe = G.div`
|
|
|
2004
2009
|
},
|
|
2005
2010
|
onDownload: () => {
|
|
2006
2011
|
},
|
|
2007
|
-
onClose:
|
|
2012
|
+
onClose: Y,
|
|
2008
2013
|
scale: 1,
|
|
2009
2014
|
isAnnotating: !1,
|
|
2010
|
-
className:
|
|
2015
|
+
className: v
|
|
2011
2016
|
}
|
|
2012
|
-
), /* @__PURE__ */ n.createElement(
|
|
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)));
|
|
2013
2018
|
}
|
|
2014
|
-
if (!
|
|
2015
|
-
const
|
|
2016
|
-
...
|
|
2019
|
+
if (!h) {
|
|
2020
|
+
const F = oe(t || "unknown", {
|
|
2021
|
+
...f,
|
|
2017
2022
|
navigation: !1
|
|
2018
2023
|
});
|
|
2019
|
-
return /* @__PURE__ */ n.createElement(de, { $theme:
|
|
2024
|
+
return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
|
|
2020
2025
|
ce,
|
|
2021
2026
|
{
|
|
2022
2027
|
fileName: u || "\u672A\u77E5\u6587\u4EF6",
|
|
2023
2028
|
currentPage: 1,
|
|
2024
2029
|
totalPage: 0,
|
|
2025
|
-
tools:
|
|
2026
|
-
styles:
|
|
2030
|
+
tools: F,
|
|
2031
|
+
styles: m,
|
|
2027
2032
|
onPrevPage: () => {
|
|
2028
2033
|
},
|
|
2029
2034
|
onNextPage: () => {
|
|
@@ -2036,64 +2041,64 @@ const pe = G.div`
|
|
|
2036
2041
|
},
|
|
2037
2042
|
onDownload: () => {
|
|
2038
2043
|
},
|
|
2039
|
-
onClose:
|
|
2044
|
+
onClose: Y,
|
|
2040
2045
|
scale: 1,
|
|
2041
2046
|
isAnnotating: !1,
|
|
2042
|
-
className:
|
|
2047
|
+
className: v
|
|
2043
2048
|
}
|
|
2044
|
-
), /* @__PURE__ */ n.createElement(
|
|
2049
|
+
), /* @__PURE__ */ n.createElement(Ce, { $theme: a }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
|
|
2045
2050
|
}
|
|
2046
|
-
const
|
|
2047
|
-
content:
|
|
2048
|
-
...(
|
|
2049
|
-
...(
|
|
2050
|
-
...
|
|
2051
|
-
},
|
|
2052
|
-
return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:",
|
|
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(
|
|
2053
2058
|
ce,
|
|
2054
2059
|
{
|
|
2055
|
-
fileName:
|
|
2056
|
-
currentPage:
|
|
2057
|
-
totalPage:
|
|
2058
|
-
tools:
|
|
2059
|
-
styles:
|
|
2060
|
-
onPrevPage:
|
|
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 : () => {
|
|
2061
2066
|
},
|
|
2062
|
-
onNextPage:
|
|
2067
|
+
onNextPage: h.type === "pdf" ? W : () => {
|
|
2063
2068
|
},
|
|
2064
|
-
onZoomIn:
|
|
2069
|
+
onZoomIn: $.zoom ? w : () => {
|
|
2065
2070
|
},
|
|
2066
|
-
onZoomOut:
|
|
2071
|
+
onZoomOut: $.zoom ? k : () => {
|
|
2067
2072
|
},
|
|
2068
|
-
onAnnotationToggle:
|
|
2073
|
+
onAnnotationToggle: $.annotation ? U : () => {
|
|
2069
2074
|
},
|
|
2070
|
-
onDownload:
|
|
2075
|
+
onDownload: $.download ? ee : () => {
|
|
2071
2076
|
},
|
|
2072
|
-
onRotateLeft:
|
|
2077
|
+
onRotateLeft: $.rotate ? N : () => {
|
|
2073
2078
|
},
|
|
2074
|
-
onRotateRight:
|
|
2079
|
+
onRotateRight: $.rotate ? I : () => {
|
|
2075
2080
|
},
|
|
2076
|
-
onClose:
|
|
2077
|
-
scale:
|
|
2078
|
-
isAnnotating:
|
|
2079
|
-
className:
|
|
2081
|
+
onClose: Y,
|
|
2082
|
+
scale: T,
|
|
2083
|
+
isAnnotating: K,
|
|
2084
|
+
className: v
|
|
2080
2085
|
}
|
|
2081
2086
|
), /* @__PURE__ */ n.createElement(
|
|
2082
|
-
|
|
2087
|
+
Xe,
|
|
2083
2088
|
{
|
|
2084
|
-
data:
|
|
2089
|
+
data: O,
|
|
2085
2090
|
annotationData: o || [],
|
|
2086
|
-
totalPage:
|
|
2087
|
-
currentPage:
|
|
2088
|
-
scale:
|
|
2091
|
+
totalPage: h.type === "pdf" && h.totalPages || 0,
|
|
2092
|
+
currentPage: h.type === "pdf" ? q : 1,
|
|
2093
|
+
scale: T,
|
|
2089
2094
|
rotation: V,
|
|
2090
|
-
eventsEmit:
|
|
2091
|
-
styles:
|
|
2092
|
-
tools:
|
|
2093
|
-
className:
|
|
2095
|
+
eventsEmit: E,
|
|
2096
|
+
styles: m,
|
|
2097
|
+
tools: $,
|
|
2098
|
+
className: D
|
|
2094
2099
|
}
|
|
2095
2100
|
));
|
|
2096
|
-
},
|
|
2101
|
+
}, vt = () => !!re.GlobalWorkerOptions.workerSrc, Dt = () => re.GlobalWorkerOptions.workerSrc, Bt = (e = "/worker/pdf.worker.min.js") => {
|
|
2097
2102
|
try {
|
|
2098
2103
|
if (re.GlobalWorkerOptions.workerSrc) {
|
|
2099
2104
|
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:", re.GlobalWorkerOptions.workerSrc);
|
|
@@ -2105,16 +2110,16 @@ const pe = G.div`
|
|
|
2105
2110
|
}
|
|
2106
2111
|
};
|
|
2107
2112
|
export {
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2113
|
+
Xe as Fviewer,
|
|
2114
|
+
xt as StaticFileReader,
|
|
2115
|
+
xe as detectFileType,
|
|
2116
|
+
Dt as getPDFWorkerPath,
|
|
2117
|
+
vt as isPDFWorkerRegistered,
|
|
2118
|
+
Ft as parseFile,
|
|
2119
|
+
gt as parseImageFile,
|
|
2120
|
+
Et as parseMarkdownFile,
|
|
2121
|
+
mt as parsePdfFile,
|
|
2122
|
+
ft as parseTextFile,
|
|
2123
|
+
Bt as registerPDFWorker
|
|
2119
2124
|
};
|
|
2120
2125
|
//# sourceMappingURL=index.js.map
|