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