@mxmweb/fviewer 1.5.0 → 1.5.2
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/1.pdf +0 -0
- package/index.js +256 -257
- package/index.js.map +1 -1
- package/lib_enter.d.ts +1 -0
- package/package.json +1 -1
- package/stats.html +1 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import n, { useRef as X, useState as R, useCallback as $, useEffect as te, forwardRef as Ce, createElement as
|
|
1
|
+
import n, { useRef as X, useState as R, useCallback as $, useEffect as te, forwardRef as Ce, createElement as Fe } from "react";
|
|
2
2
|
import G from "styled-components";
|
|
3
3
|
import * as re from "pdfjs-dist";
|
|
4
4
|
import { Markdownit as we, DataType as ve } from "@mxmweb/rtext";
|
|
5
|
-
const
|
|
5
|
+
const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ke = ({
|
|
6
6
|
pageNumber: e,
|
|
7
7
|
scale: t,
|
|
8
8
|
isAnnotating: o,
|
|
@@ -11,48 +11,48 @@ const Be = "#FFEB3B", ke = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
11
11
|
onAnnotationDelete: d,
|
|
12
12
|
readOnly: p = !1
|
|
13
13
|
}) => {
|
|
14
|
-
const f = X(null), [g,
|
|
14
|
+
const f = X(null), [g, F] = R(!1), [w, b] = R({ x: 0, y: 0 }), [v, B] = R(null), [a, l] = R(null), D = $(
|
|
15
15
|
(c) => {
|
|
16
16
|
if (!o || !f.current) return;
|
|
17
|
-
const x = f.current.getBoundingClientRect(),
|
|
18
|
-
console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: c.clientX, clientY: c.clientY, rect: x, x:
|
|
17
|
+
const x = f.current.getBoundingClientRect(), h = (c.clientX - x.left) / x.width, k = (c.clientY - x.top) / x.height;
|
|
18
|
+
console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: c.clientX, clientY: c.clientY, rect: x, x: h, y: k, scale: t }), F(!0), b({ x: h, y: k });
|
|
19
19
|
},
|
|
20
20
|
[o, t]
|
|
21
21
|
), C = $(
|
|
22
22
|
(c) => {
|
|
23
23
|
if (!g || !f.current) return;
|
|
24
|
-
const x = f.current.getBoundingClientRect(),
|
|
24
|
+
const x = f.current.getBoundingClientRect(), h = (c.clientX - x.left) / x.width, k = (c.clientY - x.top) / x.height;
|
|
25
25
|
B({
|
|
26
|
-
x: Math.min(w.x,
|
|
26
|
+
x: Math.min(w.x, h),
|
|
27
27
|
y: Math.min(w.y, k),
|
|
28
|
-
width: Math.abs(
|
|
28
|
+
width: Math.abs(h - w.x),
|
|
29
29
|
height: Math.abs(k - w.y)
|
|
30
30
|
});
|
|
31
31
|
},
|
|
32
32
|
[g, w, t]
|
|
33
33
|
), q = $(() => {
|
|
34
34
|
if (!g || !v) return;
|
|
35
|
-
if (
|
|
35
|
+
if (F(!1), v.width < 5 || v.height < 5) {
|
|
36
36
|
B(null);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const c = {
|
|
40
|
-
id:
|
|
40
|
+
id: Be(),
|
|
41
41
|
pageNumber: e,
|
|
42
42
|
...v,
|
|
43
43
|
content: "",
|
|
44
|
-
color:
|
|
44
|
+
color: De
|
|
45
45
|
};
|
|
46
46
|
r == null || r(c), B(null);
|
|
47
47
|
}, [g, v, e, r]), N = $((c) => {
|
|
48
|
-
l(
|
|
49
|
-
}, [
|
|
48
|
+
l(a === c ? null : c);
|
|
49
|
+
}, [a]);
|
|
50
50
|
return $((c, x) => {
|
|
51
|
-
const
|
|
51
|
+
const h = {
|
|
52
52
|
...c,
|
|
53
53
|
content: x
|
|
54
54
|
};
|
|
55
|
-
r == null || r(
|
|
55
|
+
r == null || r(h);
|
|
56
56
|
}, [r]), $((c) => {
|
|
57
57
|
d == null || d(c), l(null);
|
|
58
58
|
}, [d]), console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:", {
|
|
@@ -117,20 +117,20 @@ const Be = "#FFEB3B", ke = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
117
117
|
}
|
|
118
118
|
))))
|
|
119
119
|
);
|
|
120
|
-
},
|
|
120
|
+
}, Ae = () => {
|
|
121
121
|
try {
|
|
122
122
|
if (xe())
|
|
123
|
-
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:",
|
|
123
|
+
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:", vt());
|
|
124
124
|
else {
|
|
125
125
|
const e = "/worker/pdf.worker.min.js";
|
|
126
|
-
console.log("\u6B63\u5728\u6CE8\u518CPDF Worker\uFF0C\u8DEF\u5F84:", e, "\u73AF\u5883:", "\u751F\u4EA7"),
|
|
126
|
+
console.log("\u6B63\u5728\u6CE8\u518CPDF Worker\uFF0C\u8DEF\u5F84:", e, "\u73AF\u5883:", "\u751F\u4EA7"), yt(e);
|
|
127
127
|
}
|
|
128
128
|
} catch (e) {
|
|
129
129
|
console.warn("PDF Worker \u81EA\u52A8\u6CE8\u518C\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6CE8\u518C:", e);
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
-
|
|
133
|
-
const
|
|
132
|
+
Ae();
|
|
133
|
+
const $e = {
|
|
134
134
|
colors: {
|
|
135
135
|
primary: "#007bff",
|
|
136
136
|
secondary: "#6c757d",
|
|
@@ -154,14 +154,14 @@ const Pe = {
|
|
|
154
154
|
shadow: "md",
|
|
155
155
|
lineHeight: "md"
|
|
156
156
|
}
|
|
157
|
-
},
|
|
157
|
+
}, Pe = G.div`
|
|
158
158
|
display: flex;
|
|
159
159
|
align-items: center;
|
|
160
160
|
justify-content: center;
|
|
161
161
|
height: 200px;
|
|
162
162
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
163
163
|
font-size: 14px;
|
|
164
|
-
`,
|
|
164
|
+
`, _e = G.div`
|
|
165
165
|
display: flex;
|
|
166
166
|
align-items: center;
|
|
167
167
|
justify-content: center;
|
|
@@ -169,7 +169,7 @@ const Pe = {
|
|
|
169
169
|
color: ${(e) => e.$theme.colors.error};
|
|
170
170
|
font-size: 14px;
|
|
171
171
|
text-align: center;
|
|
172
|
-
`,
|
|
172
|
+
`, Te = ({
|
|
173
173
|
pdfDocument: e,
|
|
174
174
|
currentPage: t,
|
|
175
175
|
pdfStartPage: o = 1,
|
|
@@ -180,24 +180,24 @@ const Pe = {
|
|
|
180
180
|
isSlidesMode: p = !1,
|
|
181
181
|
onPageChange: f,
|
|
182
182
|
onScaleChange: g,
|
|
183
|
-
onAnnotationChange:
|
|
183
|
+
onAnnotationChange: F,
|
|
184
184
|
onAnnotationDelete: w,
|
|
185
185
|
styles: b
|
|
186
186
|
}) => {
|
|
187
|
-
const [v, B] = R(!1), [
|
|
188
|
-
if (!A.current || !
|
|
189
|
-
const s = A.current, y = s.offsetWidth - 40, m = s.offsetHeight - 40, _ = y /
|
|
187
|
+
const [v, B] = R(!1), [a, l] = R(null), [D, C] = R(0), [q, N] = R(0), [c, x] = R(!1), [h, k] = R(!0), O = (b == null ? void 0 : b.theme) || $e, L = X(null), A = X(null), P = X(!1), V = X(null), ee = $((i) => {
|
|
188
|
+
if (!A.current || !h || !g) return null;
|
|
189
|
+
const s = A.current, y = s.offsetWidth - 40, m = s.offsetHeight - 40, _ = y / i.width, T = m / i.height, I = Math.min(_, T, 1), Z = Math.max(0.3, Math.min(1, I));
|
|
190
190
|
return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
|
|
191
191
|
containerWidth: y,
|
|
192
192
|
containerHeight: m,
|
|
193
|
-
viewportWidth:
|
|
194
|
-
viewportHeight:
|
|
193
|
+
viewportWidth: i.width,
|
|
194
|
+
viewportHeight: i.height,
|
|
195
195
|
scaleX: _,
|
|
196
196
|
scaleY: T,
|
|
197
197
|
autoScale: I,
|
|
198
198
|
finalScale: Z
|
|
199
199
|
}), Z;
|
|
200
|
-
}, [
|
|
200
|
+
}, [h, g]), J = $(async () => {
|
|
201
201
|
if (!(!e || !L.current)) {
|
|
202
202
|
if (P.current || V.current === t) {
|
|
203
203
|
console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");
|
|
@@ -205,21 +205,21 @@ const Pe = {
|
|
|
205
205
|
}
|
|
206
206
|
try {
|
|
207
207
|
V.current = t, P.current = !0;
|
|
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 s = await e.getPage(
|
|
208
|
+
const i = t - o + 1;
|
|
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=${i}`), i < 1 || i > e.numPages)
|
|
210
|
+
throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${i}, 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`);
|
|
211
|
+
const s = await e.getPage(i), y = L.current, m = y.getContext("2d");
|
|
212
212
|
console.log("\u5F53\u524Dscale\u503C:", u);
|
|
213
213
|
const _ = s.getViewport({ scale: 1 });
|
|
214
|
-
if (console.log("viewport\u5C3A\u5BF8:", _.width, "x", _.height),
|
|
214
|
+
if (console.log("viewport\u5C3A\u5BF8:", _.width, "x", _.height), h && k(!1), y.width = _.width, y.height = _.height, await s.render({
|
|
215
215
|
canvasContext: m,
|
|
216
216
|
viewport: _
|
|
217
217
|
}).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", y.width, "x", y.height), A.current) {
|
|
218
218
|
const T = A.current;
|
|
219
219
|
console.log("\u5BB9\u5668\u5C3A\u5BF8:", T.offsetWidth, "x", T.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", y.offsetWidth, "x", y.offsetHeight);
|
|
220
220
|
}
|
|
221
|
-
} catch (
|
|
222
|
-
console.error("PDF\u6E32\u67D3\u5931\u8D25:",
|
|
221
|
+
} catch (i) {
|
|
222
|
+
console.error("PDF\u6E32\u67D3\u5931\u8D25:", i);
|
|
223
223
|
} finally {
|
|
224
224
|
P.current = !1;
|
|
225
225
|
}
|
|
@@ -229,7 +229,7 @@ const Pe = {
|
|
|
229
229
|
e && t && o && (console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:", "pdfStartPage:" + o, "currentPage:" + t, "pdfDocument:", e), J());
|
|
230
230
|
}, [t, e, o]), te(() => {
|
|
231
231
|
e && t && J();
|
|
232
|
-
}, [u, e, t]), v ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(
|
|
232
|
+
}, [u, e, t]), v ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(Pe, { $theme: O }, "\u52A0\u8F7D\u4E2D...")) : a ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(_e, { $theme: O }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, a)))) : /* @__PURE__ */ n.createElement(
|
|
233
233
|
"div",
|
|
234
234
|
{
|
|
235
235
|
ref: A,
|
|
@@ -245,7 +245,7 @@ const Pe = {
|
|
|
245
245
|
overflow: "visible"
|
|
246
246
|
}
|
|
247
247
|
},
|
|
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...")) :
|
|
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...")) : a ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20 text-red-500" }, /* @__PURE__ */ n.createElement("div", null, "\u6E32\u67D3\u9519\u8BEF"), /* @__PURE__ */ n.createElement("div", { className: "text-xs" }, a)) : /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-start" }, /* @__PURE__ */ n.createElement(
|
|
249
249
|
"div",
|
|
250
250
|
{
|
|
251
251
|
className: "relative",
|
|
@@ -267,20 +267,20 @@ const Pe = {
|
|
|
267
267
|
}
|
|
268
268
|
),
|
|
269
269
|
/* @__PURE__ */ n.createElement(
|
|
270
|
-
|
|
270
|
+
ke,
|
|
271
271
|
{
|
|
272
272
|
pageNumber: t,
|
|
273
273
|
scale: u,
|
|
274
274
|
isAnnotating: d,
|
|
275
275
|
annotations: r,
|
|
276
|
-
onAnnotationAdd:
|
|
276
|
+
onAnnotationAdd: F,
|
|
277
277
|
onAnnotationDelete: w,
|
|
278
278
|
readOnly: !d
|
|
279
279
|
}
|
|
280
280
|
)
|
|
281
281
|
))
|
|
282
282
|
);
|
|
283
|
-
},
|
|
283
|
+
}, Re = G.div`
|
|
284
284
|
flex: 1;
|
|
285
285
|
background: ${(e) => e.$theme.colors.background};
|
|
286
286
|
position: relative;
|
|
@@ -293,13 +293,13 @@ const Pe = {
|
|
|
293
293
|
/* 支持大尺寸内容的滚动 */
|
|
294
294
|
overflow-x: auto;
|
|
295
295
|
overflow-y: auto; /* 改为auto,允许垂直滚动 */
|
|
296
|
-
`,
|
|
296
|
+
`, Ne = G.div`
|
|
297
297
|
display: flex;
|
|
298
298
|
align-items: center;
|
|
299
299
|
justify-content: center;
|
|
300
300
|
height: 100%;
|
|
301
301
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
302
|
-
`,
|
|
302
|
+
`, Le = G.div`
|
|
303
303
|
display: flex;
|
|
304
304
|
flex-direction: column;
|
|
305
305
|
align-items: center;
|
|
@@ -308,7 +308,7 @@ const Pe = {
|
|
|
308
308
|
color: ${(e) => e.$theme.colors.error};
|
|
309
309
|
text-align: center;
|
|
310
310
|
padding: 20px;
|
|
311
|
-
`,
|
|
311
|
+
`, ze = `
|
|
312
312
|
.md-annotation {
|
|
313
313
|
position: relative;
|
|
314
314
|
display: inline;
|
|
@@ -388,7 +388,7 @@ const Pe = {
|
|
|
388
388
|
.markdown-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
389
389
|
background: #a9a9a;
|
|
390
390
|
}
|
|
391
|
-
`,
|
|
391
|
+
`, Se = {
|
|
392
392
|
colors: {
|
|
393
393
|
primary: "#007bff",
|
|
394
394
|
secondary: "#6c757d",
|
|
@@ -412,56 +412,56 @@ const Pe = {
|
|
|
412
412
|
shadow: "md",
|
|
413
413
|
lineHeight: "md"
|
|
414
414
|
}
|
|
415
|
-
},
|
|
415
|
+
}, Me = (e) => {
|
|
416
416
|
if (console.log("=== detectFileType \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", e), !e)
|
|
417
417
|
return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"), "unknown";
|
|
418
418
|
const t = e.fileName || "", o = e.fileType || "", u = e.content;
|
|
419
419
|
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, d, p, f, g,
|
|
420
|
+
}, We = (e, t, o = !1) => {
|
|
421
|
+
var u, r, d, p, f, g, F;
|
|
422
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:", ((d = e.content) == null ? void 0 : d.document) === null), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:", ((p = e.content) == null ? void 0 : p.document) === void 0), console.log("PDF\u6587\u6863\u65B9\u6CD5:", (f = e.content) != null && f.document ? Object.getOwnPropertyNames(Object.getPrototypeOf(e.content.document)) : "\u65E0\u6587\u6863"), console.log("PDF\u6587\u6863\u5C5E\u6027:", (g = e.content) != null && g.document ? Object.keys(e.content.document) : "\u65E0\u6587\u6863");
|
|
423
423
|
const w = e.pdfStartPage || 1;
|
|
424
424
|
console.log("PDF\u8D77\u59CB\u9875:", w);
|
|
425
425
|
const b = (t.annotationData || []).filter(
|
|
426
|
-
(
|
|
426
|
+
(a) => "pageNumber" in a && "x" in a && "y" in a
|
|
427
427
|
);
|
|
428
428
|
console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:", b);
|
|
429
429
|
const v = o ? 0.82 : 1, B = t.initialZoom || t.scale || v;
|
|
430
430
|
return /* @__PURE__ */ n.createElement(
|
|
431
|
-
|
|
431
|
+
Te,
|
|
432
432
|
{
|
|
433
|
-
pdfDocument: ((
|
|
433
|
+
pdfDocument: ((F = e.content) == null ? void 0 : F.document) || null,
|
|
434
434
|
currentPage: t.currentPage || 1,
|
|
435
435
|
pdfStartPage: w,
|
|
436
436
|
scale: B,
|
|
437
437
|
annotations: b,
|
|
438
438
|
isAnnotating: !1,
|
|
439
439
|
isSlidesMode: o,
|
|
440
|
-
onPageChange: t.eventsEmit ? (
|
|
440
|
+
onPageChange: t.eventsEmit ? (a) => {
|
|
441
441
|
var l;
|
|
442
|
-
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "pageChange", { pageNumber:
|
|
442
|
+
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "pageChange", { pageNumber: a });
|
|
443
443
|
} : void 0,
|
|
444
|
-
onScaleChange: t.eventsEmit ? (
|
|
444
|
+
onScaleChange: t.eventsEmit ? (a) => {
|
|
445
445
|
var l;
|
|
446
|
-
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "scaleChange", { scale:
|
|
446
|
+
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "scaleChange", { scale: a });
|
|
447
447
|
} : void 0,
|
|
448
|
-
onAnnotationChange: t.eventsEmit ? (
|
|
448
|
+
onAnnotationChange: t.eventsEmit ? (a) => {
|
|
449
449
|
var l;
|
|
450
|
-
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationChange", { annotation:
|
|
450
|
+
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationChange", { annotation: a });
|
|
451
451
|
} : void 0,
|
|
452
|
-
onAnnotationDelete: t.eventsEmit ? (
|
|
452
|
+
onAnnotationDelete: t.eventsEmit ? (a) => {
|
|
453
453
|
var l;
|
|
454
|
-
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationDelete", { annotationId:
|
|
454
|
+
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationDelete", { annotationId: a });
|
|
455
455
|
} : void 0,
|
|
456
456
|
styles: t.styles
|
|
457
457
|
}
|
|
458
458
|
);
|
|
459
|
-
},
|
|
460
|
-
var o, u, r, d, p, f, g,
|
|
459
|
+
}, Ie = (e, t) => {
|
|
460
|
+
var o, u, r, d, p, f, g, F, w, b, v, B, a, l;
|
|
461
461
|
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
462
|
const D = ((u = e.content) == null ? void 0 : u.url) || e.content, [C, q] = R(!0), [N, c] = R(!1), x = () => {
|
|
463
463
|
console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:", D), q(!1), c(!1);
|
|
464
|
-
},
|
|
464
|
+
}, h = () => {
|
|
465
465
|
console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:", D), q(!1), c(!0);
|
|
466
466
|
};
|
|
467
467
|
return /* @__PURE__ */ n.createElement("div", { style: {
|
|
@@ -488,7 +488,7 @@ const Pe = {
|
|
|
488
488
|
width: "32px",
|
|
489
489
|
height: "32px",
|
|
490
490
|
border: `3px solid ${((p = (d = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : d.colors) == null ? void 0 : p.border) || "#dee2e6"}`,
|
|
491
|
-
borderTop: `3px solid ${((
|
|
491
|
+
borderTop: `3px solid ${((F = (g = (f = t.styles) == null ? void 0 : f.theme) == null ? void 0 : g.colors) == null ? void 0 : F.primary) || "#007bff"}`,
|
|
492
492
|
borderRadius: "50%",
|
|
493
493
|
animation: "spin 1s linear infinite"
|
|
494
494
|
} }), /* @__PURE__ */ n.createElement("div", { style: {
|
|
@@ -506,14 +506,14 @@ const Pe = {
|
|
|
506
506
|
zIndex: 1
|
|
507
507
|
} }, /* @__PURE__ */ n.createElement("div", { style: {
|
|
508
508
|
fontSize: "14px",
|
|
509
|
-
color: ((l = (
|
|
509
|
+
color: ((l = (a = (B = t.styles) == null ? void 0 : B.theme) == null ? void 0 : a.colors) == null ? void 0 : l.error) || "#dc3545"
|
|
510
510
|
} }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), /* @__PURE__ */ n.createElement(
|
|
511
511
|
"img",
|
|
512
512
|
{
|
|
513
513
|
src: D,
|
|
514
514
|
alt: e.fileName || "\u56FE\u7247",
|
|
515
515
|
onLoad: x,
|
|
516
|
-
onError:
|
|
516
|
+
onError: h,
|
|
517
517
|
style: {
|
|
518
518
|
maxWidth: "100%",
|
|
519
519
|
maxHeight: "100%",
|
|
@@ -529,18 +529,18 @@ const Pe = {
|
|
|
529
529
|
100% { transform: rotate(360deg); }
|
|
530
530
|
}
|
|
531
531
|
`));
|
|
532
|
-
},
|
|
532
|
+
}, je = (e, t) => {
|
|
533
533
|
var o, u, r, d, p;
|
|
534
534
|
console.log("=== Fviewer renderTextContent ==="), console.log("data:", e), console.log("data.content:", e.content);
|
|
535
535
|
let f = "";
|
|
536
536
|
typeof e.content == "string" ? f = e.content : (o = e.content) != null && o.text ? f = e.content.text : (u = e.content) != null && u.content && (f = e.content.content), console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:", f);
|
|
537
|
-
const g = X(null),
|
|
537
|
+
const g = X(null), F = X(null);
|
|
538
538
|
return te(() => {
|
|
539
|
-
if (g.current &&
|
|
539
|
+
if (g.current && F.current && f) {
|
|
540
540
|
const w = setTimeout(() => {
|
|
541
541
|
var b;
|
|
542
542
|
const v = ((b = g.current) == null ? void 0 : b.scrollHeight) || 0, B = Math.max(v + 80, 200);
|
|
543
|
-
|
|
543
|
+
F.current && (F.current.style.minHeight = `${B}px`, console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:", B));
|
|
544
544
|
}, 100);
|
|
545
545
|
return () => clearTimeout(w);
|
|
546
546
|
}
|
|
@@ -556,7 +556,7 @@ const Pe = {
|
|
|
556
556
|
} }, /* @__PURE__ */ n.createElement(
|
|
557
557
|
"div",
|
|
558
558
|
{
|
|
559
|
-
ref:
|
|
559
|
+
ref: F,
|
|
560
560
|
style: {
|
|
561
561
|
width: "100%",
|
|
562
562
|
maxWidth: "800px",
|
|
@@ -617,37 +617,37 @@ const Pe = {
|
|
|
617
617
|
borderTopRightRadius: "8px"
|
|
618
618
|
} })
|
|
619
619
|
));
|
|
620
|
-
},
|
|
621
|
-
var u, r, d, p, f, g,
|
|
620
|
+
}, Oe = ({ data: e, parentProps: t, isTableMode: o = !1 }) => {
|
|
621
|
+
var u, r, d, p, f, g, F, w, b, v, B, a;
|
|
622
622
|
const l = X(null), D = X(null), C = X(null), q = X(!1);
|
|
623
623
|
X(0), X(null);
|
|
624
|
-
const [N] = R(!1), c = (
|
|
625
|
-
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop:
|
|
624
|
+
const [N] = R(!1), c = (i, s) => {
|
|
625
|
+
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: i, scrollHeight: s }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: i, scrollHeight: s });
|
|
626
626
|
}, x = () => {
|
|
627
627
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_top");
|
|
628
|
-
},
|
|
628
|
+
}, h = () => {
|
|
629
629
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_bottom");
|
|
630
630
|
}, k = X();
|
|
631
|
-
k.current = (
|
|
631
|
+
k.current = (i) => {
|
|
632
632
|
var s, y;
|
|
633
633
|
try {
|
|
634
634
|
if (!o) return;
|
|
635
635
|
const m = typeof e.content == "string" ? e.content : ((s = e.content) == null ? void 0 : s.content) || "";
|
|
636
636
|
if (!m || P.length === 0) return;
|
|
637
637
|
const _ = JSON.stringify(P.map((Z) => ({ o: Z.offsets, c: Z.color }))), T = `${m.length}:${m.substring(0, 64)}:${m.substring(m.length - 64)}|${_}`;
|
|
638
|
-
if (((y =
|
|
638
|
+
if (((y = i.dataset) == null ? void 0 : y.tableAnnoRuntimeSig) === T) return;
|
|
639
639
|
setTimeout(() => {
|
|
640
|
-
ee(),
|
|
640
|
+
ee(), i.dataset && (i.dataset.tableAnnoRuntimeSig = T);
|
|
641
641
|
}, 50);
|
|
642
642
|
} catch (m) {
|
|
643
643
|
console.warn("[MarkdownRendered] apply failed", m);
|
|
644
644
|
}
|
|
645
645
|
};
|
|
646
|
-
const O = n.useCallback((
|
|
646
|
+
const O = n.useCallback((i) => {
|
|
647
647
|
var s;
|
|
648
|
-
return (s = k.current) == null ? void 0 : s.call(k,
|
|
648
|
+
return (s = k.current) == null ? void 0 : s.call(k, i);
|
|
649
649
|
}, []), L = $(() => {
|
|
650
|
-
var
|
|
650
|
+
var i;
|
|
651
651
|
if (!N || !l.current) return;
|
|
652
652
|
const s = window.getSelection();
|
|
653
653
|
if (!s || s.isCollapsed) return;
|
|
@@ -671,7 +671,7 @@ const Pe = {
|
|
|
671
671
|
I = T + y.startOffset;
|
|
672
672
|
break;
|
|
673
673
|
}
|
|
674
|
-
T += ((
|
|
674
|
+
T += ((i = U.textContent) == null ? void 0 : i.length) || 0, U = Z.nextNode();
|
|
675
675
|
}
|
|
676
676
|
console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:", {
|
|
677
677
|
text: m,
|
|
@@ -687,16 +687,16 @@ const Pe = {
|
|
|
687
687
|
};
|
|
688
688
|
console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", M), t.eventsEmit && t.eventsEmit("md_annotation_add", M), s.removeAllRanges();
|
|
689
689
|
}, [N, t.eventsEmit]), A = o ? [] : (t.annotationData || []).filter(
|
|
690
|
-
(
|
|
690
|
+
(i) => "start" in i && "end" in i && !("pageNumber" in i)
|
|
691
691
|
), P = o ? (t.annotationData || []).filter(
|
|
692
|
-
(
|
|
692
|
+
(i) => "offsets" in i && Array.isArray(i.offsets)
|
|
693
693
|
) : [], V = $(() => {
|
|
694
694
|
if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !l.current) {
|
|
695
695
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");
|
|
696
696
|
return;
|
|
697
697
|
}
|
|
698
|
-
const
|
|
699
|
-
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",
|
|
698
|
+
const i = l.current.querySelectorAll(".md-annotation");
|
|
699
|
+
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", i.length), i.length > 0 && i.forEach((s) => {
|
|
700
700
|
const y = s.parentNode;
|
|
701
701
|
y && y.replaceChild(document.createTextNode(s.textContent || ""), s);
|
|
702
702
|
}), console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A");
|
|
@@ -705,8 +705,8 @@ const Pe = {
|
|
|
705
705
|
console.log("\u8868\u683C\u6807\u6CE8\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u9000\u51FA");
|
|
706
706
|
return;
|
|
707
707
|
}
|
|
708
|
-
const
|
|
709
|
-
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",
|
|
708
|
+
const i = l.current.querySelectorAll("table");
|
|
709
|
+
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", i.length), i.length === 0) {
|
|
710
710
|
console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
|
|
711
711
|
return;
|
|
712
712
|
}
|
|
@@ -722,7 +722,7 @@ const Pe = {
|
|
|
722
722
|
console.warn("[TableAnnotation] offset is not [number, number]", _);
|
|
723
723
|
return;
|
|
724
724
|
}
|
|
725
|
-
|
|
725
|
+
i.forEach((U, M) => {
|
|
726
726
|
var j, K, oe;
|
|
727
727
|
let Q;
|
|
728
728
|
const H = U.tBodies && U.tBodies.length > 0 ? Array.from(U.tBodies[0].rows) : [];
|
|
@@ -756,7 +756,7 @@ const Pe = {
|
|
|
756
756
|
return;
|
|
757
757
|
}
|
|
758
758
|
D.current && clearTimeout(D.current);
|
|
759
|
-
const
|
|
759
|
+
const i = () => {
|
|
760
760
|
var s;
|
|
761
761
|
console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");
|
|
762
762
|
const y = (s = l.current) == null ? void 0 : s.querySelectorAll(".md-annotation");
|
|
@@ -779,7 +779,7 @@ const Pe = {
|
|
|
779
779
|
_.push(T);
|
|
780
780
|
if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", _.length), _.length === 0) {
|
|
781
781
|
console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), D.current = setTimeout(() => {
|
|
782
|
-
|
|
782
|
+
i();
|
|
783
783
|
}, 200);
|
|
784
784
|
return;
|
|
785
785
|
}
|
|
@@ -803,32 +803,32 @@ const Pe = {
|
|
|
803
803
|
(H) => j < H.end && K > H.start
|
|
804
804
|
);
|
|
805
805
|
console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Q.length), Q.forEach(({ node: H, start: W }) => {
|
|
806
|
-
var E, z, Y, S, me,
|
|
807
|
-
const le = Math.max(0, j - W),
|
|
808
|
-
if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd:
|
|
806
|
+
var E, z, Y, S, me, he;
|
|
807
|
+
const le = Math.max(0, j - W), ie = Math.min(((E = H.textContent) == null ? void 0 : E.length) || 0, K - W);
|
|
808
|
+
if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd: ie, nodeTextLength: (z = H.textContent) == null ? void 0 : z.length }), le >= ie) {
|
|
809
809
|
console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
|
|
810
810
|
return;
|
|
811
811
|
}
|
|
812
|
-
const ge = ((Y = H.textContent) == null ? void 0 : Y.slice(0, le)) || "", fe = ((S = H.textContent) == null ? void 0 : S.slice(le,
|
|
812
|
+
const ge = ((Y = H.textContent) == null ? void 0 : Y.slice(0, le)) || "", fe = ((S = H.textContent) == null ? void 0 : S.slice(le, ie)) || "", Ee = ((me = H.textContent) == null ? void 0 : me.slice(ie)) || "";
|
|
813
813
|
console.log("\u5206\u5272\u6587\u672C:", { before: ge, annotatedText: fe, after: Ee });
|
|
814
814
|
const se = document.createElement("span");
|
|
815
815
|
se.className = "md-annotation", se.style.backgroundColor = oe || "#FFE599", se.textContent = fe;
|
|
816
|
-
const
|
|
817
|
-
ge &&
|
|
816
|
+
const ae = document.createDocumentFragment();
|
|
817
|
+
ge && ae.appendChild(document.createTextNode(ge)), ae.appendChild(se), Ee && ae.appendChild(document.createTextNode(Ee)), (he = H.parentNode) == null || he.replaceChild(ae, H), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", fe);
|
|
818
818
|
});
|
|
819
819
|
});
|
|
820
820
|
};
|
|
821
821
|
D.current = setTimeout(() => {
|
|
822
|
-
|
|
822
|
+
i();
|
|
823
823
|
}, 100);
|
|
824
824
|
}, [A]);
|
|
825
825
|
return te(() => {
|
|
826
|
-
var
|
|
826
|
+
var i;
|
|
827
827
|
if (o) {
|
|
828
828
|
console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
|
-
const s = typeof e.content == "string" ? e.content : ((
|
|
831
|
+
const s = typeof e.content == "string" ? e.content : ((i = e.content) == null ? void 0 : i.content) || "";
|
|
832
832
|
if (!s || typeof s != "string") {
|
|
833
833
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
|
|
834
834
|
return;
|
|
@@ -848,8 +848,8 @@ const Pe = {
|
|
|
848
848
|
document.removeEventListener("mouseup", L);
|
|
849
849
|
};
|
|
850
850
|
}, [L, o]), te(() => {
|
|
851
|
-
var
|
|
852
|
-
const s = typeof e.content == "string" ? e.content : ((
|
|
851
|
+
var i;
|
|
852
|
+
const s = typeof e.content == "string" ? e.content : ((i = e.content) == null ? void 0 : i.content) || "";
|
|
853
853
|
if (!s || typeof s != "string") {
|
|
854
854
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
|
|
855
855
|
return;
|
|
@@ -857,7 +857,7 @@ const Pe = {
|
|
|
857
857
|
console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", s.length || 0), typeof s == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", s.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", s.substring(s.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof s), console.log("\u5185\u5BB9\u503C:", s)), console.log("\u6807\u6CE8\u6570\u636E:", A), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", P);
|
|
858
858
|
}, [A, P, o]), te(() => {
|
|
859
859
|
if (o && l.current) {
|
|
860
|
-
const
|
|
860
|
+
const i = setTimeout(() => {
|
|
861
861
|
var s;
|
|
862
862
|
const y = (s = l.current) == null ? void 0 : s.querySelectorAll("table");
|
|
863
863
|
y && y.length > 0 && (console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:", y.length), y.forEach((m, _) => {
|
|
@@ -868,7 +868,7 @@ const Pe = {
|
|
|
868
868
|
}
|
|
869
869
|
}));
|
|
870
870
|
}, 500);
|
|
871
|
-
return () => clearTimeout(
|
|
871
|
+
return () => clearTimeout(i);
|
|
872
872
|
}
|
|
873
873
|
}, [o, e.content]), te(() => () => {
|
|
874
874
|
D.current && clearTimeout(D.current), C.current && (C.current.disconnect(), C.current = null);
|
|
@@ -883,27 +883,27 @@ const Pe = {
|
|
|
883
883
|
},
|
|
884
884
|
className: `markdown-container markdown-scrollbar ${o ? "markdown-table-mode" : ""}`
|
|
885
885
|
},
|
|
886
|
-
/* @__PURE__ */ n.createElement("style", null,
|
|
886
|
+
/* @__PURE__ */ n.createElement("style", null, ze),
|
|
887
887
|
/* @__PURE__ */ n.createElement("div", { ref: l }, /* @__PURE__ */ n.createElement(
|
|
888
888
|
we,
|
|
889
889
|
{
|
|
890
890
|
dataSource: {
|
|
891
891
|
type: ve.MARKDOWN,
|
|
892
892
|
content: (() => {
|
|
893
|
-
var
|
|
894
|
-
return typeof e.content == "string" ? e.content : (
|
|
893
|
+
var i, s;
|
|
894
|
+
return typeof e.content == "string" ? e.content : (i = e.content) != null && i.text ? e.content.text : (s = e.content) != null && s.content ? e.content.content : "";
|
|
895
895
|
})()
|
|
896
896
|
},
|
|
897
897
|
size: "md",
|
|
898
898
|
onScroll: o ? void 0 : c,
|
|
899
899
|
onScrollToTop: o ? void 0 : x,
|
|
900
|
-
onScrollToBottom: o ? void 0 :
|
|
900
|
+
onScrollToBottom: o ? void 0 : h,
|
|
901
901
|
onRendered: O,
|
|
902
902
|
theme: {
|
|
903
903
|
primaryColor: ((d = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : d.primary) || "#007bff",
|
|
904
904
|
backgroundColor: ((g = (f = (p = t.styles) == null ? void 0 : p.theme) == null ? void 0 : f.colors) == null ? void 0 : g.background) || "#f8f9fa",
|
|
905
|
-
textColor: ((b = (w = (
|
|
906
|
-
borderColor: ((
|
|
905
|
+
textColor: ((b = (w = (F = t.styles) == null ? void 0 : F.theme) == null ? void 0 : w.colors) == null ? void 0 : b.text) || "#343a40",
|
|
906
|
+
borderColor: ((a = (B = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : B.colors) == null ? void 0 : a.border) || "#dee2e6",
|
|
907
907
|
borderRadius: o ? "0px" : "8px",
|
|
908
908
|
padding: o ? "0px" : "20px"
|
|
909
909
|
},
|
|
@@ -916,56 +916,56 @@ const Pe = {
|
|
|
916
916
|
}
|
|
917
917
|
))
|
|
918
918
|
);
|
|
919
|
-
},
|
|
919
|
+
}, He = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
|
|
920
920
|
const u = X(null), r = (f) => {
|
|
921
|
-
const g = f.split(/\r?\n/).filter((
|
|
922
|
-
let
|
|
923
|
-
for (let
|
|
924
|
-
const l = g[
|
|
921
|
+
const g = f.split(/\r?\n/).filter((a) => a.trim().length > 0);
|
|
922
|
+
let F = -1;
|
|
923
|
+
for (let a = 0; a < g.length - 1; a++) {
|
|
924
|
+
const l = g[a].trim(), D = g[a + 1].trim();
|
|
925
925
|
if (l.startsWith("|") && l.endsWith("|") && D.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
|
|
926
|
-
|
|
926
|
+
F = a;
|
|
927
927
|
break;
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
|
-
if (
|
|
931
|
-
const b = g[
|
|
932
|
-
for (let
|
|
933
|
-
const l = g[
|
|
930
|
+
if (F === -1) return null;
|
|
931
|
+
const b = g[F].split("|").slice(1, -1).map((a) => a.trim()), v = [];
|
|
932
|
+
for (let a = F + 2; a < g.length; a++) {
|
|
933
|
+
const l = g[a].trim();
|
|
934
934
|
if (!l.startsWith("|") || !l.endsWith("|")) break;
|
|
935
935
|
v.push(l);
|
|
936
936
|
}
|
|
937
|
-
const B = v.map((
|
|
937
|
+
const B = v.map((a) => a.split("|").slice(1, -1).map((l) => l.trim()));
|
|
938
938
|
return { headers: b, rows: B };
|
|
939
939
|
}, d = n.useMemo(() => r(e), [e]);
|
|
940
940
|
return te(() => {
|
|
941
941
|
const f = () => {
|
|
942
942
|
try {
|
|
943
943
|
if (!u.current || !o.length) return;
|
|
944
|
-
const
|
|
945
|
-
if (!
|
|
944
|
+
const F = u.current.querySelectorAll("table");
|
|
945
|
+
if (!F || F.length === 0) return;
|
|
946
946
|
o.forEach((w, b) => {
|
|
947
|
-
(w.offsets || []).forEach((B,
|
|
947
|
+
(w.offsets || []).forEach((B, a) => {
|
|
948
948
|
const [l, D] = B;
|
|
949
|
-
|
|
949
|
+
F.forEach((C) => {
|
|
950
950
|
var q, N, c;
|
|
951
951
|
const x = C.tBodies && C.tBodies.length > 0 ? Array.from(C.tBodies[0].rows) : [];
|
|
952
|
-
let
|
|
952
|
+
let h;
|
|
953
953
|
if (x.length > 0)
|
|
954
|
-
|
|
954
|
+
h = x[l];
|
|
955
955
|
else {
|
|
956
956
|
const A = ((N = (q = C.tHead) == null ? void 0 : q.rows) == null ? void 0 : N.length) || 0;
|
|
957
|
-
|
|
957
|
+
h = Array.from(C.rows)[l + A];
|
|
958
958
|
}
|
|
959
|
-
if (!
|
|
960
|
-
const k = (c =
|
|
959
|
+
if (!h) return;
|
|
960
|
+
const k = (c = h.cells) == null ? void 0 : c[D];
|
|
961
961
|
if (!k) return;
|
|
962
962
|
const O = w.color || "rgba(255, 229, 153, 0.5)";
|
|
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 &&
|
|
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);
|
|
964
964
|
});
|
|
965
965
|
});
|
|
966
966
|
});
|
|
967
|
-
} catch (
|
|
968
|
-
console.warn("[MinimalMarkdownTable] apply annotations failed",
|
|
967
|
+
} catch (F) {
|
|
968
|
+
console.warn("[MinimalMarkdownTable] apply annotations failed", F);
|
|
969
969
|
}
|
|
970
970
|
}, g = requestAnimationFrame(() => {
|
|
971
971
|
f(), t && t();
|
|
@@ -983,8 +983,8 @@ const Pe = {
|
|
|
983
983
|
.z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
|
|
984
984
|
.z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
|
|
985
985
|
.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, d.headers.map((f, g) => /* @__PURE__ */ n.createElement("th", { key: g }, f)))), /* @__PURE__ */ n.createElement("tbody", null, d.rows.map((f, g) => /* @__PURE__ */ n.createElement("tr", { key: g }, f.map((
|
|
987
|
-
},
|
|
986
|
+
`), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null, d.headers.map((f, g) => /* @__PURE__ */ n.createElement("th", { key: g }, f)))), /* @__PURE__ */ n.createElement("tbody", null, d.rows.map((f, g) => /* @__PURE__ */ n.createElement("tr", { key: g }, f.map((F, w) => /* @__PURE__ */ n.createElement("td", { key: w }, F))))))) : /* @__PURE__ */ n.createElement("div", { ref: u, style: { padding: "8px" } }, "\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C");
|
|
987
|
+
}, Ze = (e, t) => {
|
|
988
988
|
var o, u;
|
|
989
989
|
console.log("=== Fviewer renderHtmlContent ==="), console.log("data:", e), console.log("data.content:", e.content);
|
|
990
990
|
let r = "";
|
|
@@ -1006,13 +1006,13 @@ const Pe = {
|
|
|
1006
1006
|
sandbox: "allow-same-origin allow-scripts"
|
|
1007
1007
|
}
|
|
1008
1008
|
));
|
|
1009
|
-
},
|
|
1009
|
+
}, Xe = (e, t) => /* @__PURE__ */ n.createElement("div", { style: {
|
|
1010
1010
|
display: "flex",
|
|
1011
1011
|
justifyContent: "center",
|
|
1012
1012
|
alignItems: "center",
|
|
1013
1013
|
height: "100%",
|
|
1014
1014
|
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"))),
|
|
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"))), qe = ({
|
|
1016
1016
|
data: e,
|
|
1017
1017
|
annotationData: t = [],
|
|
1018
1018
|
totalPage: o = 0,
|
|
@@ -1030,27 +1030,27 @@ const Pe = {
|
|
|
1030
1030
|
close: !0,
|
|
1031
1031
|
navigation: !0
|
|
1032
1032
|
},
|
|
1033
|
-
customComponents:
|
|
1033
|
+
customComponents: F,
|
|
1034
1034
|
className: w,
|
|
1035
1035
|
contentClass: b
|
|
1036
1036
|
}) => {
|
|
1037
|
-
var v, B,
|
|
1038
|
-
const D = (f == null ? void 0 : f.theme) ||
|
|
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 ((B = e == null ? void 0 : e.content) == null ? void 0 : B.document)), console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:", ((
|
|
1040
|
-
const
|
|
1037
|
+
var v, B, a, l;
|
|
1038
|
+
const D = (f == null ? void 0 : f.theme) || Se, [C, q] = R(!1), [N] = R("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [c, x] = R(null);
|
|
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 ((B = e == null ? void 0 : e.content) == null ? void 0 : B.document)), console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:", ((a = e == null ? void 0 : e.content) == null ? void 0 : a.document) === null), console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:", ((l = e == null ? void 0 : e.content) == null ? void 0 : l.document) === void 0), console.log("Fviewer currentPage:", u), console.log("Fviewer scale:", r);
|
|
1040
|
+
const h = X(null), k = X(null), O = X(0);
|
|
1041
1041
|
O.current += 1, console.log("[Fviewer] render count:", O.current);
|
|
1042
|
-
const L =
|
|
1042
|
+
const L = Me(e);
|
|
1043
1043
|
console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", L), console.log("\u5B8C\u6574\u6570\u636E:", e);
|
|
1044
1044
|
const A = () => {
|
|
1045
1045
|
var P;
|
|
1046
1046
|
switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", L), L) {
|
|
1047
1047
|
case "pdf":
|
|
1048
1048
|
case "pdf_slides":
|
|
1049
|
-
return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:", L, "pdfStartPage:" + e.pdfStartPage, "currentPage:" + u),
|
|
1049
|
+
return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:", L, "pdfStartPage:" + e.pdfStartPage, "currentPage:" + u), We(e, { data: e, annotationData: t, totalPage: o, currentPage: u, scale: r, eventsEmit: p, styles: f, tools: g, className: w, contentClass: b }, L === "pdf_slides");
|
|
1050
1050
|
case "image":
|
|
1051
|
-
return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"),
|
|
1051
|
+
return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), Ie(e, { scale: r, rotation: d, styles: f });
|
|
1052
1052
|
case "text":
|
|
1053
|
-
return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"),
|
|
1053
|
+
return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), je(e, { scale: r, styles: f });
|
|
1054
1054
|
case "markdown":
|
|
1055
1055
|
case "markdown_table":
|
|
1056
1056
|
if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", L), L === "markdown_table") {
|
|
@@ -1058,7 +1058,7 @@ const Pe = {
|
|
|
1058
1058
|
(J) => "offsets" in J && Array.isArray(J.offsets)
|
|
1059
1059
|
);
|
|
1060
1060
|
return /* @__PURE__ */ n.createElement(
|
|
1061
|
-
|
|
1061
|
+
He,
|
|
1062
1062
|
{
|
|
1063
1063
|
markdown: V,
|
|
1064
1064
|
tableAnnotations: ee
|
|
@@ -1066,7 +1066,7 @@ const Pe = {
|
|
|
1066
1066
|
);
|
|
1067
1067
|
}
|
|
1068
1068
|
return /* @__PURE__ */ n.createElement(
|
|
1069
|
-
|
|
1069
|
+
Oe,
|
|
1070
1070
|
{
|
|
1071
1071
|
data: e,
|
|
1072
1072
|
parentProps: { data: e, annotationData: t, eventsEmit: p, styles: f, tools: g, className: w, contentClass: b },
|
|
@@ -1074,37 +1074,37 @@ const Pe = {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
);
|
|
1076
1076
|
case "html":
|
|
1077
|
-
return console.log("\u6E32\u67D3HTML\u5185\u5BB9"),
|
|
1077
|
+
return console.log("\u6E32\u67D3HTML\u5185\u5BB9"), Ze(e);
|
|
1078
1078
|
default:
|
|
1079
|
-
return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"),
|
|
1079
|
+
return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"), Xe(e);
|
|
1080
1080
|
}
|
|
1081
1081
|
};
|
|
1082
1082
|
return n.useEffect(() => {
|
|
1083
|
-
const P =
|
|
1083
|
+
const P = h.current, V = k.current, ee = P !== e, J = V !== (e ? e.content : void 0);
|
|
1084
1084
|
console.log("[Fviewer useEffect:data] triggered", {
|
|
1085
1085
|
dataChanged: ee,
|
|
1086
1086
|
contentChanged: J,
|
|
1087
1087
|
hasData: !!e,
|
|
1088
1088
|
hasContent: !!(e != null && e.content),
|
|
1089
1089
|
isLoadingBefore: C
|
|
1090
|
-
}),
|
|
1090
|
+
}), h.current = e, k.current = e ? e.content : void 0;
|
|
1091
1091
|
}, [e == null ? void 0 : e.content]), n.useEffect(() => {
|
|
1092
1092
|
c && q(!1);
|
|
1093
1093
|
}, [c]), n.useEffect(() => {
|
|
1094
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:", L);
|
|
1095
|
-
}, [t, L]), /* @__PURE__ */ n.createElement(
|
|
1096
|
-
|
|
1095
|
+
}, [t, L]), /* @__PURE__ */ n.createElement(Re, { $theme: D, className: b }, C ? F != null && F.LoadingComponent ? /* @__PURE__ */ n.createElement(
|
|
1096
|
+
F.LoadingComponent,
|
|
1097
1097
|
{
|
|
1098
1098
|
status: N,
|
|
1099
1099
|
theme: D
|
|
1100
1100
|
}
|
|
1101
|
-
) : /* @__PURE__ */ n.createElement(
|
|
1102
|
-
|
|
1101
|
+
) : /* @__PURE__ */ n.createElement(Ne, { $theme: D }, N) : c ? F != null && F.ErrorComponent ? /* @__PURE__ */ n.createElement(
|
|
1102
|
+
F.ErrorComponent,
|
|
1103
1103
|
{
|
|
1104
1104
|
error: c,
|
|
1105
1105
|
theme: D
|
|
1106
1106
|
}
|
|
1107
|
-
) : /* @__PURE__ */ n.createElement(
|
|
1107
|
+
) : /* @__PURE__ */ n.createElement(Le, { $theme: D }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, c)) : A());
|
|
1108
1108
|
};
|
|
1109
1109
|
/**
|
|
1110
1110
|
* @license lucide-react v0.456.0 - ISC
|
|
@@ -1112,14 +1112,14 @@ const Pe = {
|
|
|
1112
1112
|
* This source code is licensed under the ISC license.
|
|
1113
1113
|
* See the LICENSE file in the root directory of this source tree.
|
|
1114
1114
|
*/
|
|
1115
|
-
const
|
|
1115
|
+
const Ue = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ye = (...e) => e.filter((t, o, u) => !!t && t.trim() !== "" && u.indexOf(t) === o).join(" ").trim();
|
|
1116
1116
|
/**
|
|
1117
1117
|
* @license lucide-react v0.456.0 - ISC
|
|
1118
1118
|
*
|
|
1119
1119
|
* This source code is licensed under the ISC license.
|
|
1120
1120
|
* See the LICENSE file in the root directory of this source tree.
|
|
1121
1121
|
*/
|
|
1122
|
-
var
|
|
1122
|
+
var Ye = {
|
|
1123
1123
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1124
1124
|
width: 24,
|
|
1125
1125
|
height: 24,
|
|
@@ -1136,7 +1136,7 @@ var Ge = {
|
|
|
1136
1136
|
* This source code is licensed under the ISC license.
|
|
1137
1137
|
* See the LICENSE file in the root directory of this source tree.
|
|
1138
1138
|
*/
|
|
1139
|
-
const
|
|
1139
|
+
const Ge = Ce(
|
|
1140
1140
|
({
|
|
1141
1141
|
color: e = "currentColor",
|
|
1142
1142
|
size: t = 24,
|
|
@@ -1146,11 +1146,11 @@ const Ve = Ce(
|
|
|
1146
1146
|
children: d,
|
|
1147
1147
|
iconNode: p,
|
|
1148
1148
|
...f
|
|
1149
|
-
}, g) =>
|
|
1149
|
+
}, g) => Fe(
|
|
1150
1150
|
"svg",
|
|
1151
1151
|
{
|
|
1152
1152
|
ref: g,
|
|
1153
|
-
...
|
|
1153
|
+
...Ye,
|
|
1154
1154
|
width: t,
|
|
1155
1155
|
height: t,
|
|
1156
1156
|
stroke: e,
|
|
@@ -1159,7 +1159,7 @@ const Ve = Ce(
|
|
|
1159
1159
|
...f
|
|
1160
1160
|
},
|
|
1161
1161
|
[
|
|
1162
|
-
...p.map(([
|
|
1162
|
+
...p.map(([F, w]) => Fe(F, w)),
|
|
1163
1163
|
...Array.isArray(d) ? d : [d]
|
|
1164
1164
|
]
|
|
1165
1165
|
)
|
|
@@ -1172,10 +1172,10 @@ const Ve = Ce(
|
|
|
1172
1172
|
*/
|
|
1173
1173
|
const ue = (e, t) => {
|
|
1174
1174
|
const o = Ce(
|
|
1175
|
-
({ className: u, ...r }, d) =>
|
|
1175
|
+
({ className: u, ...r }, d) => Fe(Ge, {
|
|
1176
1176
|
ref: d,
|
|
1177
1177
|
iconNode: t,
|
|
1178
|
-
className: ye(`lucide-${
|
|
1178
|
+
className: ye(`lucide-${Ue(e)}`, u),
|
|
1179
1179
|
...r
|
|
1180
1180
|
})
|
|
1181
1181
|
);
|
|
@@ -1187,7 +1187,7 @@ const ue = (e, t) => {
|
|
|
1187
1187
|
* This source code is licensed under the ISC license.
|
|
1188
1188
|
* See the LICENSE file in the root directory of this source tree.
|
|
1189
1189
|
*/
|
|
1190
|
-
const
|
|
1190
|
+
const Ve = ue("ChevronLeft", [
|
|
1191
1191
|
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
1192
1192
|
]);
|
|
1193
1193
|
/**
|
|
@@ -1196,7 +1196,7 @@ const Je = ue("ChevronLeft", [
|
|
|
1196
1196
|
* This source code is licensed under the ISC license.
|
|
1197
1197
|
* See the LICENSE file in the root directory of this source tree.
|
|
1198
1198
|
*/
|
|
1199
|
-
const
|
|
1199
|
+
const Je = ue("ChevronRight", [
|
|
1200
1200
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
1201
1201
|
]);
|
|
1202
1202
|
/**
|
|
@@ -1205,7 +1205,7 @@ const Ke = ue("ChevronRight", [
|
|
|
1205
1205
|
* This source code is licensed under the ISC license.
|
|
1206
1206
|
* See the LICENSE file in the root directory of this source tree.
|
|
1207
1207
|
*/
|
|
1208
|
-
const
|
|
1208
|
+
const Ke = ue("Download", [
|
|
1209
1209
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
1210
1210
|
["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
|
|
1211
1211
|
["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
|
|
@@ -1216,7 +1216,7 @@ const Qe = ue("Download", [
|
|
|
1216
1216
|
* This source code is licensed under the ISC license.
|
|
1217
1217
|
* See the LICENSE file in the root directory of this source tree.
|
|
1218
1218
|
*/
|
|
1219
|
-
const
|
|
1219
|
+
const Qe = ue("Pencil", [
|
|
1220
1220
|
[
|
|
1221
1221
|
"path",
|
|
1222
1222
|
{
|
|
@@ -1232,7 +1232,7 @@ const et = ue("Pencil", [
|
|
|
1232
1232
|
* This source code is licensed under the ISC license.
|
|
1233
1233
|
* See the LICENSE file in the root directory of this source tree.
|
|
1234
1234
|
*/
|
|
1235
|
-
const
|
|
1235
|
+
const et = ue("RotateCcw", [
|
|
1236
1236
|
["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
1237
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
1238
1238
|
]);
|
|
@@ -1242,7 +1242,7 @@ const tt = ue("RotateCcw", [
|
|
|
1242
1242
|
* This source code is licensed under the ISC license.
|
|
1243
1243
|
* See the LICENSE file in the root directory of this source tree.
|
|
1244
1244
|
*/
|
|
1245
|
-
const
|
|
1245
|
+
const tt = ue("RotateCw", [
|
|
1246
1246
|
["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
|
|
1247
1247
|
["path", { d: "M21 3v5h-5", key: "1q7to0" }]
|
|
1248
1248
|
]);
|
|
@@ -1252,7 +1252,7 @@ const ot = ue("RotateCw", [
|
|
|
1252
1252
|
* This source code is licensed under the ISC license.
|
|
1253
1253
|
* See the LICENSE file in the root directory of this source tree.
|
|
1254
1254
|
*/
|
|
1255
|
-
const
|
|
1255
|
+
const ot = ue("X", [
|
|
1256
1256
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
1257
1257
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
1258
1258
|
]);
|
|
@@ -1262,7 +1262,7 @@ const nt = ue("X", [
|
|
|
1262
1262
|
* This source code is licensed under the ISC license.
|
|
1263
1263
|
* See the LICENSE file in the root directory of this source tree.
|
|
1264
1264
|
*/
|
|
1265
|
-
const
|
|
1265
|
+
const nt = ue("ZoomIn", [
|
|
1266
1266
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
1267
1267
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
1268
1268
|
["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
|
|
@@ -1274,11 +1274,11 @@ const ut = ue("ZoomIn", [
|
|
|
1274
1274
|
* This source code is licensed under the ISC license.
|
|
1275
1275
|
* See the LICENSE file in the root directory of this source tree.
|
|
1276
1276
|
*/
|
|
1277
|
-
const
|
|
1277
|
+
const ut = ue("ZoomOut", [
|
|
1278
1278
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
1279
1279
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
1280
1280
|
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
1281
|
-
]),
|
|
1281
|
+
]), rt = G.div`
|
|
1282
1282
|
display: flex;
|
|
1283
1283
|
align-items: center;
|
|
1284
1284
|
padding: 0px 12px;
|
|
@@ -1287,24 +1287,24 @@ const rt = ue("ZoomOut", [
|
|
|
1287
1287
|
border-bottom: 1px solid ${(e) => e.$theme.colors.border};
|
|
1288
1288
|
background: ${(e) => e.$theme.colors.background};
|
|
1289
1289
|
min-height: 52px;
|
|
1290
|
-
`,
|
|
1290
|
+
`, lt = G.div`
|
|
1291
1291
|
display: flex;
|
|
1292
1292
|
align-items: center;
|
|
1293
1293
|
gap: 8px;
|
|
1294
1294
|
flex: 1;
|
|
1295
1295
|
min-width: 0;
|
|
1296
|
-
`,
|
|
1296
|
+
`, it = G.div`
|
|
1297
1297
|
font-size: 14px;
|
|
1298
1298
|
font-weight: 500;
|
|
1299
1299
|
color: ${(e) => e.$theme.colors.text};
|
|
1300
1300
|
white-space: nowrap;
|
|
1301
1301
|
overflow: hidden;
|
|
1302
1302
|
text-overflow: ellipsis;
|
|
1303
|
-
`,
|
|
1303
|
+
`, st = G.div`
|
|
1304
1304
|
font-size: 12px;
|
|
1305
1305
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1306
1306
|
white-space: nowrap;
|
|
1307
|
-
`,
|
|
1307
|
+
`, at = G.div`
|
|
1308
1308
|
display: flex;
|
|
1309
1309
|
align-items: center;
|
|
1310
1310
|
gap: 4px;
|
|
@@ -1336,12 +1336,12 @@ const rt = ue("ZoomOut", [
|
|
|
1336
1336
|
opacity: 0.5;
|
|
1337
1337
|
cursor: not-allowed;
|
|
1338
1338
|
}
|
|
1339
|
-
`,
|
|
1339
|
+
`, ct = G.div`
|
|
1340
1340
|
font-size: 12px;
|
|
1341
1341
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1342
1342
|
min-width: 40px;
|
|
1343
1343
|
text-align: center;
|
|
1344
|
-
`,
|
|
1344
|
+
`, dt = {
|
|
1345
1345
|
colors: {
|
|
1346
1346
|
primary: "#007bff",
|
|
1347
1347
|
secondary: "#6c757d",
|
|
@@ -1382,17 +1382,17 @@ const rt = ue("ZoomOut", [
|
|
|
1382
1382
|
onNextPage: p,
|
|
1383
1383
|
onZoomIn: f,
|
|
1384
1384
|
onZoomOut: g,
|
|
1385
|
-
onAnnotationToggle:
|
|
1385
|
+
onAnnotationToggle: F,
|
|
1386
1386
|
onDownload: w,
|
|
1387
1387
|
onRotateLeft: b,
|
|
1388
1388
|
onRotateRight: v,
|
|
1389
1389
|
onClose: B,
|
|
1390
|
-
scale:
|
|
1390
|
+
scale: a = 1,
|
|
1391
1391
|
isAnnotating: l = !1,
|
|
1392
1392
|
className: D
|
|
1393
1393
|
}) => {
|
|
1394
|
-
const C = (r == null ? void 0 : r.theme) ||
|
|
1395
|
-
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(
|
|
1394
|
+
const C = (r == null ? void 0 : r.theme) || dt;
|
|
1395
|
+
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(rt, { $theme: C, className: D }, /* @__PURE__ */ n.createElement(lt, { $theme: C }, /* @__PURE__ */ n.createElement(it, { $theme: C }, e)), /* @__PURE__ */ n.createElement(at, { $theme: C }, u.navigation && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1396
1396
|
ne,
|
|
1397
1397
|
{
|
|
1398
1398
|
$theme: C,
|
|
@@ -1400,8 +1400,8 @@ const rt = ue("ZoomOut", [
|
|
|
1400
1400
|
disabled: t <= 1,
|
|
1401
1401
|
title: "\u4E0A\u4E00\u9875"
|
|
1402
1402
|
},
|
|
1403
|
-
/* @__PURE__ */ n.createElement(
|
|
1404
|
-
), o > 0 && /* @__PURE__ */ n.createElement(
|
|
1403
|
+
/* @__PURE__ */ n.createElement(Ve, { size: 16 })
|
|
1404
|
+
), o > 0 && /* @__PURE__ */ n.createElement(st, { $theme: C }, t, " / ", o), /* @__PURE__ */ n.createElement(
|
|
1405
1405
|
ne,
|
|
1406
1406
|
{
|
|
1407
1407
|
$theme: C,
|
|
@@ -1409,34 +1409,34 @@ const rt = ue("ZoomOut", [
|
|
|
1409
1409
|
disabled: !o || t >= o,
|
|
1410
1410
|
title: "\u4E0B\u4E00\u9875"
|
|
1411
1411
|
},
|
|
1412
|
-
/* @__PURE__ */ n.createElement(
|
|
1412
|
+
/* @__PURE__ */ n.createElement(Je, { size: 16 })
|
|
1413
1413
|
)), u.zoom && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1414
1414
|
ne,
|
|
1415
1415
|
{
|
|
1416
1416
|
$theme: C,
|
|
1417
1417
|
onClick: g,
|
|
1418
|
-
disabled:
|
|
1418
|
+
disabled: a <= 0.3,
|
|
1419
1419
|
title: "\u7F29\u5C0F"
|
|
1420
1420
|
},
|
|
1421
|
-
/* @__PURE__ */ n.createElement(
|
|
1422
|
-
), /* @__PURE__ */ n.createElement(
|
|
1421
|
+
/* @__PURE__ */ n.createElement(ut, { size: 16 })
|
|
1422
|
+
), /* @__PURE__ */ n.createElement(ct, { $theme: C }, Math.round(a * 100), "%"), /* @__PURE__ */ n.createElement(
|
|
1423
1423
|
ne,
|
|
1424
1424
|
{
|
|
1425
1425
|
$theme: C,
|
|
1426
1426
|
onClick: f,
|
|
1427
|
-
disabled:
|
|
1427
|
+
disabled: a >= 3,
|
|
1428
1428
|
title: "\u653E\u5927"
|
|
1429
1429
|
},
|
|
1430
|
-
/* @__PURE__ */ n.createElement(
|
|
1430
|
+
/* @__PURE__ */ n.createElement(nt, { size: 16 })
|
|
1431
1431
|
)), u.annotation && /* @__PURE__ */ n.createElement(
|
|
1432
1432
|
ne,
|
|
1433
1433
|
{
|
|
1434
1434
|
$theme: C,
|
|
1435
1435
|
$active: l,
|
|
1436
|
-
onClick:
|
|
1436
|
+
onClick: F,
|
|
1437
1437
|
title: l ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
|
|
1438
1438
|
},
|
|
1439
|
-
/* @__PURE__ */ n.createElement(
|
|
1439
|
+
/* @__PURE__ */ n.createElement(Qe, { size: 16 })
|
|
1440
1440
|
), u.download && /* @__PURE__ */ n.createElement(
|
|
1441
1441
|
ne,
|
|
1442
1442
|
{
|
|
@@ -1444,7 +1444,7 @@ const rt = ue("ZoomOut", [
|
|
|
1444
1444
|
onClick: w,
|
|
1445
1445
|
title: "\u4E0B\u8F7D"
|
|
1446
1446
|
},
|
|
1447
|
-
/* @__PURE__ */ n.createElement(
|
|
1447
|
+
/* @__PURE__ */ n.createElement(Ke, { size: 16 })
|
|
1448
1448
|
), u.rotate && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1449
1449
|
ne,
|
|
1450
1450
|
{
|
|
@@ -1452,7 +1452,7 @@ const rt = ue("ZoomOut", [
|
|
|
1452
1452
|
onClick: b,
|
|
1453
1453
|
title: "\u5411\u5DE6\u65CB\u8F6C"
|
|
1454
1454
|
},
|
|
1455
|
-
/* @__PURE__ */ n.createElement(
|
|
1455
|
+
/* @__PURE__ */ n.createElement(et, { size: 16 })
|
|
1456
1456
|
), /* @__PURE__ */ n.createElement(
|
|
1457
1457
|
ne,
|
|
1458
1458
|
{
|
|
@@ -1460,7 +1460,7 @@ const rt = ue("ZoomOut", [
|
|
|
1460
1460
|
onClick: v,
|
|
1461
1461
|
title: "\u5411\u53F3\u65CB\u8F6C"
|
|
1462
1462
|
},
|
|
1463
|
-
/* @__PURE__ */ n.createElement(
|
|
1463
|
+
/* @__PURE__ */ n.createElement(tt, { size: 16 })
|
|
1464
1464
|
)), u.close && /* @__PURE__ */ n.createElement(
|
|
1465
1465
|
ne,
|
|
1466
1466
|
{
|
|
@@ -1468,27 +1468,26 @@ const rt = ue("ZoomOut", [
|
|
|
1468
1468
|
onClick: B,
|
|
1469
1469
|
title: "\u5173\u95ED"
|
|
1470
1470
|
},
|
|
1471
|
-
/* @__PURE__ */ n.createElement(
|
|
1471
|
+
/* @__PURE__ */ n.createElement(ot, { size: 16 })
|
|
1472
1472
|
)));
|
|
1473
|
-
}),
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
return;
|
|
1478
|
-
}
|
|
1479
|
-
const e = "/worker/pdf.worker.min.js";
|
|
1480
|
-
De(e), console.log("PDF Worker \u5DF2\u901A\u8FC7\u7EDF\u4E00\u51FD\u6570\u6CE8\u518C:", e);
|
|
1481
|
-
} catch (e) {
|
|
1482
|
-
throw console.error("PDF Worker \u6CE8\u518C\u5931\u8D25:", e), e;
|
|
1473
|
+
}), mt = () => {
|
|
1474
|
+
if (xe()) {
|
|
1475
|
+
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");
|
|
1476
|
+
return;
|
|
1483
1477
|
}
|
|
1478
|
+
const e = `PDF Worker \u672A\u6CE8\u518C\u3002\u8BF7\u5728\u5E94\u7528\u5165\u53E3\u5904\u8C03\u7528 registerPDFWorker() \u6CE8\u518C Worker\u3002
|
|
1479
|
+
\u793A\u4F8B\uFF1Aimport { registerPDFWorker } from "@mxmweb/fviewer";
|
|
1480
|
+
registerPDFWorker("/worker/pdf.worker.min.js");
|
|
1481
|
+
\u6CE8\u610F\uFF1AWorker \u6587\u4EF6\u8DEF\u5F84\u9700\u8981\u6839\u636E\u5B9E\u9645\u90E8\u7F72\u60C5\u51B5\u8C03\u6574\u3002`;
|
|
1482
|
+
throw console.error(e), new Error(e);
|
|
1484
1483
|
}, be = (e, t, o) => {
|
|
1485
1484
|
if (!e && !t && !o) return "unknown";
|
|
1486
1485
|
const u = e || "", r = t || "";
|
|
1487
1486
|
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";
|
|
1488
|
-
},
|
|
1487
|
+
}, gt = async (e, t = {}) => {
|
|
1489
1488
|
console.log("=== parsePdfFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1490
1489
|
try {
|
|
1491
|
-
|
|
1490
|
+
mt();
|
|
1492
1491
|
let o;
|
|
1493
1492
|
if (typeof e == "string") {
|
|
1494
1493
|
console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
|
|
@@ -1535,7 +1534,7 @@ const rt = ue("ZoomOut", [
|
|
|
1535
1534
|
error: u
|
|
1536
1535
|
};
|
|
1537
1536
|
}
|
|
1538
|
-
},
|
|
1537
|
+
}, ft = async (e, t = {}) => {
|
|
1539
1538
|
console.log("=== parseImageFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1540
1539
|
try {
|
|
1541
1540
|
let o;
|
|
@@ -1581,7 +1580,7 @@ const rt = ue("ZoomOut", [
|
|
|
1581
1580
|
error: `\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1582
1581
|
};
|
|
1583
1582
|
}
|
|
1584
|
-
},
|
|
1583
|
+
}, Et = async (e, t = {}) => {
|
|
1585
1584
|
try {
|
|
1586
1585
|
let o;
|
|
1587
1586
|
if (typeof e == "string") {
|
|
@@ -1641,7 +1640,7 @@ const rt = ue("ZoomOut", [
|
|
|
1641
1640
|
error: `Markdown\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1642
1641
|
};
|
|
1643
1642
|
}
|
|
1644
|
-
},
|
|
1643
|
+
}, ht = async (e, t = {}) => {
|
|
1645
1644
|
console.log("=== parseHtmlFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1646
1645
|
try {
|
|
1647
1646
|
let o;
|
|
@@ -1674,19 +1673,19 @@ const rt = ue("ZoomOut", [
|
|
|
1674
1673
|
error: `HTML\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1675
1674
|
};
|
|
1676
1675
|
}
|
|
1677
|
-
},
|
|
1676
|
+
}, pt = async (e, t = {}) => {
|
|
1678
1677
|
switch (be(t.fileName, t.fileType)) {
|
|
1679
1678
|
case "pdf":
|
|
1680
|
-
return await
|
|
1679
|
+
return await gt(e, t);
|
|
1681
1680
|
case "image":
|
|
1682
|
-
return await
|
|
1681
|
+
return await ft(e, t);
|
|
1683
1682
|
case "text":
|
|
1684
|
-
return await
|
|
1683
|
+
return await Et(e, t);
|
|
1685
1684
|
case "markdown":
|
|
1686
1685
|
case "markdown_table":
|
|
1687
1686
|
return await Ft(e, t);
|
|
1688
1687
|
case "html":
|
|
1689
|
-
return await
|
|
1688
|
+
return await ht(e, t);
|
|
1690
1689
|
default:
|
|
1691
1690
|
return {
|
|
1692
1691
|
type: "unknown",
|
|
@@ -1706,7 +1705,7 @@ const rt = ue("ZoomOut", [
|
|
|
1706
1705
|
border-radius: ${(e) => e.$theme.space.radius};
|
|
1707
1706
|
overflow: hidden;
|
|
1708
1707
|
min-height: 0; /* 确保flex子元素可以收缩 */
|
|
1709
|
-
`,
|
|
1708
|
+
`, Ct = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement("div", { style: {
|
|
1710
1709
|
display: "flex",
|
|
1711
1710
|
flexDirection: "column",
|
|
1712
1711
|
alignItems: "center",
|
|
@@ -1805,7 +1804,7 @@ const pe = G.div`
|
|
|
1805
1804
|
color: ${(e) => e.$theme.colors.error};
|
|
1806
1805
|
text-align: center;
|
|
1807
1806
|
padding: 20px;
|
|
1808
|
-
`,
|
|
1807
|
+
`, wt = {
|
|
1809
1808
|
colors: {
|
|
1810
1809
|
primary: "#007bff",
|
|
1811
1810
|
secondary: "#6c757d",
|
|
@@ -1840,7 +1839,7 @@ const pe = G.div`
|
|
|
1840
1839
|
eventsEmit: f = () => {
|
|
1841
1840
|
},
|
|
1842
1841
|
styles: g,
|
|
1843
|
-
tools:
|
|
1842
|
+
tools: F = {
|
|
1844
1843
|
annotation: !1,
|
|
1845
1844
|
download: !1,
|
|
1846
1845
|
zoom: !0,
|
|
@@ -1852,9 +1851,9 @@ const pe = G.div`
|
|
|
1852
1851
|
headerClass: v,
|
|
1853
1852
|
contentClass: B
|
|
1854
1853
|
}) => {
|
|
1855
|
-
var
|
|
1856
|
-
const l = (g == null ? void 0 : g.theme) ||
|
|
1857
|
-
C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0),
|
|
1854
|
+
var a;
|
|
1855
|
+
const l = (g == null ? void 0 : g.theme) || wt, [D, C] = R(!0), [q, N] = R("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [c, x] = R(null), [h, k] = R(null), [O, L] = R(d), [A, P] = R(1), [V, ee] = R(0), [J, i] = R(!1), s = $(() => {
|
|
1856
|
+
C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0), i(!1);
|
|
1858
1857
|
}, [d]), y = $(async () => {
|
|
1859
1858
|
var E, z;
|
|
1860
1859
|
if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }), s(), p) {
|
|
@@ -1875,7 +1874,7 @@ const pe = G.div`
|
|
|
1875
1874
|
C(!0), x(null);
|
|
1876
1875
|
const Y = be(u, t);
|
|
1877
1876
|
N(Y === "image" ? "\u56FE\u7247\u4E0B\u8F7D\u4E2D..." : Y === "pdf" ? "PDF\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : Y === "markdown" || Y === "markdown_table" ? "Markdown\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : "\u6587\u4EF6\u4E0B\u8F7D\u4E2D...");
|
|
1878
|
-
const S = await
|
|
1877
|
+
const S = await pt(e, {
|
|
1879
1878
|
fileName: u,
|
|
1880
1879
|
fileType: t,
|
|
1881
1880
|
token: r
|
|
@@ -1915,14 +1914,14 @@ const pe = G.div`
|
|
|
1915
1914
|
L(E), m("page:change", { page: E });
|
|
1916
1915
|
}
|
|
1917
1916
|
}, [O, m]), Z = $(() => {
|
|
1918
|
-
const E = (
|
|
1917
|
+
const E = (h == null ? void 0 : h.totalPages) || 0;
|
|
1919
1918
|
if (E && O < E) {
|
|
1920
1919
|
const z = O + 1;
|
|
1921
1920
|
L(z), m("page:change", { page: z });
|
|
1922
1921
|
}
|
|
1923
|
-
}, [O,
|
|
1922
|
+
}, [O, h == null ? void 0 : h.totalPages, m]), U = $(() => {
|
|
1924
1923
|
const E = !J;
|
|
1925
|
-
|
|
1924
|
+
i(E), m("annotation:toggle", { isAnnotating: E });
|
|
1926
1925
|
}, [J, m]), M = $(() => {
|
|
1927
1926
|
m("download:start", { fileUrl: e, fileName: u });
|
|
1928
1927
|
}, [m, e, u]), j = $(() => {
|
|
@@ -1951,7 +1950,7 @@ const pe = G.div`
|
|
|
1951
1950
|
}, []);
|
|
1952
1951
|
if (D) {
|
|
1953
1952
|
const E = Q(t || "unknown", {
|
|
1954
|
-
...
|
|
1953
|
+
...F,
|
|
1955
1954
|
navigation: !1
|
|
1956
1955
|
});
|
|
1957
1956
|
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
|
|
@@ -1986,7 +1985,7 @@ const pe = G.div`
|
|
|
1986
1985
|
theme: l
|
|
1987
1986
|
}
|
|
1988
1987
|
) : /* @__PURE__ */ n.createElement(
|
|
1989
|
-
|
|
1988
|
+
Ct,
|
|
1990
1989
|
{
|
|
1991
1990
|
status: q,
|
|
1992
1991
|
theme: l
|
|
@@ -1995,7 +1994,7 @@ const pe = G.div`
|
|
|
1995
1994
|
}
|
|
1996
1995
|
if (c) {
|
|
1997
1996
|
const E = Q(t || "unknown", {
|
|
1998
|
-
...
|
|
1997
|
+
...F,
|
|
1999
1998
|
navigation: !1
|
|
2000
1999
|
});
|
|
2001
2000
|
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
|
|
@@ -2025,9 +2024,9 @@ const pe = G.div`
|
|
|
2025
2024
|
}
|
|
2026
2025
|
), /* @__PURE__ */ n.createElement(pe, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, c)));
|
|
2027
2026
|
}
|
|
2028
|
-
if (!
|
|
2027
|
+
if (!h) {
|
|
2029
2028
|
const E = Q(t || "unknown", {
|
|
2030
|
-
...
|
|
2029
|
+
...F,
|
|
2031
2030
|
navigation: !1
|
|
2032
2031
|
});
|
|
2033
2032
|
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
|
|
@@ -2058,22 +2057,22 @@ const pe = G.div`
|
|
|
2058
2057
|
), /* @__PURE__ */ n.createElement(pe, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
|
|
2059
2058
|
}
|
|
2060
2059
|
const H = {
|
|
2061
|
-
content:
|
|
2062
|
-
...(
|
|
2063
|
-
...(
|
|
2064
|
-
...
|
|
2065
|
-
}, W = Q(
|
|
2066
|
-
return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", H), console.log("viewerData.content:", H.content), console.log("viewerData.content.document:", (
|
|
2060
|
+
content: h.content,
|
|
2061
|
+
...(h.fileName || u) && { fileName: h.fileName || u },
|
|
2062
|
+
...(h.fileType || t) && { fileType: h.fileType || t },
|
|
2063
|
+
...h.totalPages && { totalPages: h.totalPages }
|
|
2064
|
+
}, W = Q(h.type, F);
|
|
2065
|
+
return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", H), console.log("viewerData.content:", H.content), console.log("viewerData.content.document:", (a = H.content) == null ? void 0 : a.document), console.log("\u6587\u4EF6\u7C7B\u578B:", h.type), console.log("\u52A8\u6001\u5DE5\u5177\u914D\u7F6E:", W), console.log("=== \u6807\u6CE8\u6570\u636E\u4F20\u9012 ==="), console.log("annotations prop:", o), console.log("annotations \u957F\u5EA6:", (o == null ? void 0 : o.length) || 0), /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
|
|
2067
2066
|
ce,
|
|
2068
2067
|
{
|
|
2069
|
-
fileName: H.fileName ||
|
|
2070
|
-
currentPage:
|
|
2071
|
-
totalPage:
|
|
2068
|
+
fileName: H.fileName || h.fileName || u || "\u672A\u77E5\u6587\u4EF6",
|
|
2069
|
+
currentPage: h.type === "pdf" ? O : 1,
|
|
2070
|
+
totalPage: h.type === "pdf" && h.totalPages || 0,
|
|
2072
2071
|
tools: W,
|
|
2073
2072
|
styles: g,
|
|
2074
|
-
onPrevPage:
|
|
2073
|
+
onPrevPage: h.type === "pdf" ? I : () => {
|
|
2075
2074
|
},
|
|
2076
|
-
onNextPage:
|
|
2075
|
+
onNextPage: h.type === "pdf" ? Z : () => {
|
|
2077
2076
|
},
|
|
2078
2077
|
onZoomIn: W.zoom ? _ : () => {
|
|
2079
2078
|
},
|
|
@@ -2093,12 +2092,12 @@ const pe = G.div`
|
|
|
2093
2092
|
className: v
|
|
2094
2093
|
}
|
|
2095
2094
|
), /* @__PURE__ */ n.createElement(
|
|
2096
|
-
|
|
2095
|
+
qe,
|
|
2097
2096
|
{
|
|
2098
2097
|
data: H,
|
|
2099
2098
|
annotationData: o || [],
|
|
2100
|
-
totalPage:
|
|
2101
|
-
currentPage:
|
|
2099
|
+
totalPage: h.type === "pdf" && h.totalPages || 0,
|
|
2100
|
+
currentPage: h.type === "pdf" ? O : 1,
|
|
2102
2101
|
scale: A,
|
|
2103
2102
|
rotation: V,
|
|
2104
2103
|
eventsEmit: m,
|
|
@@ -2107,7 +2106,7 @@ const pe = G.div`
|
|
|
2107
2106
|
className: B
|
|
2108
2107
|
}
|
|
2109
2108
|
));
|
|
2110
|
-
}, xe = () => !!re.GlobalWorkerOptions.workerSrc,
|
|
2109
|
+
}, xe = () => !!re.GlobalWorkerOptions.workerSrc, vt = () => re.GlobalWorkerOptions.workerSrc, yt = (e = "/worker/pdf.worker.min.js") => {
|
|
2111
2110
|
try {
|
|
2112
2111
|
if (re.GlobalWorkerOptions.workerSrc) {
|
|
2113
2112
|
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:", re.GlobalWorkerOptions.workerSrc);
|
|
@@ -2119,16 +2118,16 @@ const pe = G.div`
|
|
|
2119
2118
|
}
|
|
2120
2119
|
};
|
|
2121
2120
|
export {
|
|
2122
|
-
|
|
2121
|
+
qe as Fviewer,
|
|
2123
2122
|
Bt as StaticFileReader,
|
|
2124
2123
|
be as detectFileType,
|
|
2125
|
-
|
|
2124
|
+
vt as getPDFWorkerPath,
|
|
2126
2125
|
xe as isPDFWorkerRegistered,
|
|
2127
|
-
|
|
2128
|
-
|
|
2126
|
+
pt as parseFile,
|
|
2127
|
+
ft as parseImageFile,
|
|
2129
2128
|
Ft as parseMarkdownFile,
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2129
|
+
gt as parsePdfFile,
|
|
2130
|
+
Et as parseTextFile,
|
|
2131
|
+
yt as registerPDFWorker
|
|
2133
2132
|
};
|
|
2134
2133
|
//# sourceMappingURL=index.js.map
|