@react-pdf-kit/viewer 0.0.0-experimental.1 → 0.0.0-experimental.3
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/README.md +84 -49
- package/dist/{Combination-54a77a7a.js → Combination-479e39c6.js} +2 -2
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +8 -8
- package/dist/components/RPConfig.js +5 -7
- package/dist/components/RPController.js +76 -77
- package/dist/components/RPDropFileZone.js +4 -3
- package/dist/components/RPPages.js +577 -573
- package/dist/components/RPProvider.js +2 -2
- package/dist/components/layout/RPDefaultLayout.js +10 -9
- package/dist/components/layout/RPLayout.js +10 -9
- package/dist/components/layout/WrapperLayout.js +4 -3
- package/dist/components/layout/sidebar/RPSidebar.js +8 -7
- package/dist/components/layout/sidebar/Thumbnail.js +4 -3
- package/dist/components/layout/sidebar/Thumbnails.js +4 -3
- package/dist/components/layout/toolbar/DarkModeTool.js +4 -4
- package/dist/components/layout/toolbar/DocumentDialog.js +43 -34
- package/dist/components/layout/toolbar/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +10 -9
- package/dist/components/layout/toolbar/FileUploadTool.js +10 -9
- package/dist/components/layout/toolbar/FullScreenTool.js +6 -6
- package/dist/components/layout/toolbar/MenuItem.js +6 -6
- package/dist/components/layout/toolbar/MenuSeparator.js +6 -6
- package/dist/components/layout/toolbar/MostPageTool.js +10 -9
- package/dist/components/layout/toolbar/OtherTool.js +10 -9
- package/dist/components/layout/toolbar/Paginate.js +8 -7
- package/dist/components/layout/toolbar/PrintTool.js +10 -9
- package/dist/components/layout/toolbar/RPMenuItem.js +6 -6
- package/dist/components/layout/toolbar/RPMoreOptions.js +10 -9
- package/dist/components/layout/toolbar/RPToolbar.js +10 -9
- package/dist/components/layout/toolbar/RPToolbarEnd.js +10 -9
- package/dist/components/layout/toolbar/RotateTool.js +10 -9
- package/dist/components/layout/toolbar/ScrollModeTool.js +6 -6
- package/dist/components/layout/toolbar/SearchCloseButton.js +4 -4
- package/dist/components/layout/toolbar/SearchResultNavigator.js +23 -30
- package/dist/components/layout/toolbar/SearchTool.js +104 -100
- package/dist/components/layout/toolbar/SelectionModeTool.js +6 -6
- package/dist/components/layout/toolbar/ThumbnailTool.js +8 -7
- package/dist/components/layout/toolbar/ToolbarCustom.js +4 -3
- package/dist/components/layout/toolbar/ToolbarDefault.js +10 -9
- package/dist/components/layout/toolbar/ToolbarLayout.js +10 -9
- package/dist/components/layout/toolbar/ViewModeTool.js +6 -6
- package/dist/components/layout/toolbar/ZoomTool.js +10 -9
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +9 -8
- package/dist/components/layout/toolbar/tools/DualPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +10 -11
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +8 -7
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +8 -7
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +10 -11
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +4 -4
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/InputPageTool.js +8 -7
- package/dist/components/layout/toolbar/tools/LastPageTool.js +10 -11
- package/dist/components/layout/toolbar/tools/NextPageTool.js +8 -7
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +8 -7
- package/dist/components/layout/toolbar/tools/PrintTool.js +8 -7
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +8 -7
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +8 -7
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +4 -4
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +8 -7
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +8 -7
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +20 -19
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +8 -7
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +10 -9
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +8 -7
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +10 -9
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +10 -9
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +10 -9
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +10 -9
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +10 -9
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +6 -6
- package/dist/components/page/AnnotationLayer.js +25 -24
- package/dist/components/page/CanvasLayer.js +38 -54
- package/dist/components/page/CustomElement.js +4 -3
- package/dist/components/page/DualPage.js +2 -2
- package/dist/components/page/DualPageWithCover.js +2 -2
- package/dist/components/page/RPPage.js +35 -35
- package/dist/components/page/SinglePage.js +2 -2
- package/dist/components/page/TextHighlightLayer.js +16 -15
- package/dist/components/page/TextLayer.js +27 -28
- package/dist/components/ui/Checkbox.js +2 -2
- package/dist/components/ui/DropDown.js +6 -6
- package/dist/components/ui/Input.js +10 -10
- package/dist/components/ui/LoadingIndicator.js +8 -7
- package/dist/components/ui/RPTooltip.js +197 -411
- package/dist/contexts/DimensionPagesContext.js +28 -56
- package/dist/contexts/DropFileZoneContext.js +5 -4
- package/dist/contexts/ElementPageContext.js +6 -5
- package/dist/contexts/FileInputContext.js +6 -5
- package/dist/contexts/HighlightContext.js +6 -5
- package/dist/contexts/InitialStateContext.js +6 -8
- package/dist/contexts/PagesRotateContext.js +6 -5
- package/dist/contexts/PaginationContext.js +6 -5
- package/dist/contexts/PrintContext.js +17 -16
- package/dist/contexts/RPDocumentContext.js +14 -13
- package/dist/contexts/RenderQueueProvider.js +14 -13
- package/dist/contexts/RotationContext.js +9 -8
- package/dist/contexts/SearchContext.js +6 -5
- package/dist/contexts/ThumbnailsContext.js +5 -4
- package/dist/contexts/ZoomContext.js +6 -5
- package/dist/{index-c0faa594.js → index-113053cf.js} +2 -2
- package/dist/{index-e3ee9457.js → index-23911b43.js} +6 -6
- package/dist/index-535ad364.js +983 -0
- package/dist/{index-655864a7.js → index-ada501c4.js} +1 -1
- package/dist/index-d0f0aa9a.js +1542 -0
- package/dist/main.js +47 -47
- package/dist/types/components/layout/sidebar/Thumbnail.d.ts +2 -2
- package/dist/types/contexts/RPDocumentContext.d.ts +1 -1
- package/dist/types/contexts/RenderQueueProvider.d.ts +1 -2
- package/dist/types/contexts/RenderedPagesCache.d.ts +2 -2
- package/dist/types/main.d.ts +3 -1
- package/dist/types/utils/annotations.d.ts +2 -2
- package/dist/types/utils/getThumbnailViewport.d.ts +2 -2
- package/dist/types/utils/highlight.d.ts +5 -5
- package/dist/types/utils/hooks/useHighlight.d.ts +1 -1
- package/dist/types/utils/hooks/useLoadPdf.d.ts +2 -2
- package/dist/types/utils/hooks/useLoadWorker.d.ts +5 -1
- package/dist/types/utils/hooks/usePdfProperties.d.ts +1 -1
- package/dist/types/utils/hooks/useWatermark.d.ts +1 -1
- package/dist/types/utils/link_service.d.ts +2 -3
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/types.d.ts +7 -8
- package/dist/utils/highlight.js +36 -36
- package/dist/utils/hooks/useFileDownload.js +6 -5
- package/dist/utils/hooks/useHighlight.js +78 -40
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +96 -70
- package/dist/utils/hooks/useLoadWorker.js +4 -14
- package/dist/utils/hooks/usePageRotateContext.js +8 -7
- package/dist/utils/hooks/usePaginate.js +4 -3
- package/dist/utils/hooks/usePinch.js +44 -90
- package/dist/utils/hooks/usePresentPage.js +4 -3
- package/dist/utils/hooks/usePrint.js +71 -72
- package/dist/utils/hooks/useRotate.js +4 -3
- package/dist/utils/hooks/useScrollToPage.js +4 -3
- package/dist/utils/hooks/useSearch.js +16 -15
- package/dist/utils/hooks/useThumbnail.js +18 -17
- package/dist/utils/hooks/useVirtualReactWindow.js +4 -3
- package/dist/utils/hooks/useWatermark.js +43 -61
- package/dist/utils/injectPrintCSS.js +4 -3
- package/dist/utils/link_service.js +18 -19
- package/dist/utils/renderPage.js +14 -14
- package/package.json +2 -3
- package/dist/contexts/SmoothScaleContext.js +0 -67
- package/dist/floating-ui.react-dom-5ec29bd6.js +0 -1327
- package/dist/index-4baea9b5.js +0 -1198
- package/dist/types/contexts/SmoothScaleContext.d.ts +0 -16
- package/dist/types/utils/hooks/useAccumulateFactor.d.ts +0 -9
- package/dist/utils/hooks/useAccumulateFactor.js +0 -17
|
@@ -1,55 +1,93 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { getHighlightOptionsWithDefaults as
|
|
1
|
+
import { useState as f, useCallback as p, useEffect as w } from "react";
|
|
2
|
+
import { getHighlightOptionsWithDefaults as k, findMatches as P } from "../highlight.js";
|
|
3
3
|
import "../charators.js";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
4
|
+
const x = (n) => {
|
|
5
|
+
const e = Math.min(...n.map((s) => s.left)), c = Math.max(...n.map((s) => s.left + s.width)), o = Math.min(...n.map((s) => s.bottom)), t = Math.max(...n.map((s) => s.height));
|
|
6
|
+
return { left: e, bottom: o, width: c - e, height: t };
|
|
7
|
+
}, N = (n) => n.flatMap((e) => e.rects ?? (e.rect ? [e.rect] : [])), O = (n) => {
|
|
8
|
+
const e = n.reduce((o, t) => {
|
|
9
|
+
const s = Math.round(t.bottom);
|
|
10
|
+
return o[s] || (o[s] = []), o[s].push(t), o;
|
|
11
|
+
}, {});
|
|
12
|
+
return Object.entries(e).sort((o, t) => Number(t[0]) - Number(o[0])).map(([o, t]) => x(t));
|
|
13
|
+
}, L = (n) => {
|
|
14
|
+
const e = {};
|
|
15
|
+
for (const c of n) {
|
|
16
|
+
const o = c.keyword, t = e[o] ?? [];
|
|
17
|
+
t.push(c), e[o] = t;
|
|
18
|
+
}
|
|
19
|
+
return e;
|
|
20
|
+
}, j = (n, e) => {
|
|
21
|
+
const c = n[0], o = N(n), t = o.length > 0 ? O(o) : c.rect ? [c.rect] : [];
|
|
22
|
+
return {
|
|
23
|
+
...c,
|
|
24
|
+
pageMatchIdx: e,
|
|
25
|
+
rect: t[0] ?? c.rect,
|
|
26
|
+
rects: t
|
|
27
|
+
};
|
|
28
|
+
}, v = (n) => {
|
|
29
|
+
const e = {};
|
|
30
|
+
for (const t of n) {
|
|
31
|
+
const s = e[t.page] ?? [];
|
|
32
|
+
s.push(t), e[t.page] = s;
|
|
33
|
+
}
|
|
34
|
+
let c = 0;
|
|
35
|
+
const o = [];
|
|
36
|
+
for (const t of Object.values(e)) {
|
|
37
|
+
const s = L(t);
|
|
38
|
+
for (const g of Object.values(s))
|
|
39
|
+
o.push(j(g, c++));
|
|
40
|
+
}
|
|
41
|
+
return o;
|
|
42
|
+
}, K = (n) => {
|
|
43
|
+
const [e, c] = f(void 0), [o, t] = f([]), s = p(async (r) => {
|
|
44
|
+
if (!r)
|
|
7
45
|
return {};
|
|
8
|
-
const i =
|
|
9
|
-
for (let
|
|
10
|
-
const
|
|
11
|
-
|
|
46
|
+
const i = r.numPages, h = {};
|
|
47
|
+
for (let a = 1; a <= i; a++) {
|
|
48
|
+
const u = await r.getPage(a);
|
|
49
|
+
h[a.toString()] = await u.getTextContent();
|
|
12
50
|
}
|
|
13
|
-
return
|
|
14
|
-
}, []),
|
|
15
|
-
c(
|
|
16
|
-
}, []),
|
|
17
|
-
|
|
51
|
+
return h;
|
|
52
|
+
}, []), g = p(async (r) => {
|
|
53
|
+
c(r);
|
|
54
|
+
}, []), l = p(() => {
|
|
55
|
+
t([]), c(void 0);
|
|
18
56
|
}, []);
|
|
19
|
-
return
|
|
20
|
-
|
|
57
|
+
return w(() => {
|
|
58
|
+
n && s(n).then((r) => {
|
|
21
59
|
let i = [];
|
|
22
|
-
for (const { keyword:
|
|
23
|
-
if (!
|
|
60
|
+
for (const { keyword: h, highlightColor: a, options: u } of e) {
|
|
61
|
+
if (!h)
|
|
24
62
|
continue;
|
|
25
|
-
const
|
|
26
|
-
for (const
|
|
27
|
-
const
|
|
28
|
-
[
|
|
29
|
-
|
|
30
|
-
Number(
|
|
31
|
-
|
|
32
|
-
).map((
|
|
33
|
-
...
|
|
34
|
-
page: Number(
|
|
35
|
-
pageMatchIdx:
|
|
36
|
-
color:
|
|
37
|
-
keyword:
|
|
63
|
+
const b = k(u);
|
|
64
|
+
for (const m of Object.keys(r)) {
|
|
65
|
+
const d = P(
|
|
66
|
+
[h],
|
|
67
|
+
r[m],
|
|
68
|
+
Number(m) - 1,
|
|
69
|
+
b
|
|
70
|
+
).map((M, y) => ({
|
|
71
|
+
...M,
|
|
72
|
+
page: Number(m),
|
|
73
|
+
pageMatchIdx: y,
|
|
74
|
+
color: a,
|
|
75
|
+
keyword: h
|
|
38
76
|
}));
|
|
39
|
-
i = [...i, ...
|
|
77
|
+
i = [...i, ...d];
|
|
40
78
|
}
|
|
41
79
|
}
|
|
42
|
-
|
|
80
|
+
t(v(i));
|
|
43
81
|
}).catch(() => {
|
|
44
|
-
|
|
82
|
+
l();
|
|
45
83
|
});
|
|
46
|
-
}, [
|
|
47
|
-
highlight:
|
|
48
|
-
clear:
|
|
49
|
-
highlightMatches:
|
|
50
|
-
highlightKeywords:
|
|
84
|
+
}, [e, n, l, s]), {
|
|
85
|
+
highlight: g,
|
|
86
|
+
clear: l,
|
|
87
|
+
highlightMatches: o,
|
|
88
|
+
highlightKeywords: e
|
|
51
89
|
};
|
|
52
90
|
};
|
|
53
91
|
export {
|
|
54
|
-
|
|
92
|
+
K as useHighlight
|
|
55
93
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState as E, useCallback as h, useEffect as A } from "react";
|
|
2
2
|
import { appConsole as l } from "../appConsole.js";
|
|
3
|
-
const b = /* @__PURE__ */ new Date("2026-
|
|
3
|
+
const b = /* @__PURE__ */ new Date("2026-03-10T05:15:21.036Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
|
|
4
4
|
invalidLicense: `You are currently using without a valid license. ${d}`,
|
|
5
5
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
|
|
6
6
|
expired: `Your license key has expired. ${d}`,
|
|
@@ -1,85 +1,111 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { useState as h, useRef as I, useEffect as P } from "react";
|
|
2
|
+
import { init as F } from "@pdf-viewer/pdfium";
|
|
3
|
+
import { createDocumentProxy as N } from "@pdf-viewer/pdfium/compat";
|
|
4
|
+
import { ErrorType as O } from "../types.js";
|
|
5
|
+
import { getThumbnailViewport as q } from "../getThumbnailViewport.js";
|
|
6
|
+
import { useConfigContext as v } from "../../contexts/ConfigContext.js";
|
|
7
|
+
import { useDocumentPasswordContext as B } from "../../contexts/DocumentPasswordContext.js";
|
|
7
8
|
import "../../de_DE-a553b162.js";
|
|
8
9
|
import "react/jsx-runtime";
|
|
9
10
|
import "../appConsole.js";
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
async function W(t, c) {
|
|
12
|
+
const a = await fetch(typeof t == "string" ? t : t.href);
|
|
13
|
+
if (!a.ok)
|
|
14
|
+
throw new Error(`Failed to fetch PDF: ${a.status} ${a.statusText}`);
|
|
15
|
+
const o = a.headers.get("content-length"), l = o ? parseInt(o, 10) : 0;
|
|
16
|
+
if (!a.body || !l) {
|
|
17
|
+
const n = await a.arrayBuffer();
|
|
18
|
+
return c == null || c(100), n;
|
|
19
|
+
}
|
|
20
|
+
const y = a.body.getReader(), p = [];
|
|
21
|
+
let m = 0;
|
|
22
|
+
for (; ; ) {
|
|
23
|
+
const { done: n, value: i } = await y.read();
|
|
24
|
+
if (n)
|
|
25
|
+
break;
|
|
26
|
+
p.push(i), m += i.length, l && (c == null || c(Math.min(100, Math.round(m / l * 100))));
|
|
27
|
+
}
|
|
28
|
+
const w = new Uint8Array(m);
|
|
29
|
+
let s = 0;
|
|
30
|
+
for (const n of p)
|
|
31
|
+
w.set(n, s), s += n.length;
|
|
32
|
+
return w.buffer;
|
|
33
|
+
}
|
|
34
|
+
const re = (t, c, a = {}) => {
|
|
35
|
+
const [o, l] = h(), { workerUrlAdded: y, wasmUrl: p } = v(), [m, w] = h(/* @__PURE__ */ new Map()), s = I(), [n, i] = h(0), [D, _] = h(!1), [T, M] = h(), { password: x, passwordError: V, setPasswordError: b, passwordRequired: E, setPasswordRequired: R } = B(), { onLoadError: A, onLoaded: L, onLoadProgress: S, disableAutoFetch: $, disableStream: z, rangeChunkSize: Q } = a, u = I();
|
|
36
|
+
return P(() => {
|
|
37
|
+
S && S(n);
|
|
38
|
+
}, [n, S]), P(() => {
|
|
39
|
+
if (!y || !t)
|
|
16
40
|
return;
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
41
|
+
i(0), s.current = Date.now();
|
|
42
|
+
const f = s.current;
|
|
43
|
+
let d = !1;
|
|
44
|
+
return (async () => {
|
|
45
|
+
try {
|
|
46
|
+
_(!0);
|
|
47
|
+
let e;
|
|
48
|
+
if (t instanceof ArrayBuffer)
|
|
49
|
+
e = t, i(100);
|
|
50
|
+
else if (t instanceof Uint8Array)
|
|
51
|
+
e = t.buffer, i(100);
|
|
52
|
+
else if (typeof t == "string" || t instanceof URL)
|
|
53
|
+
e = await W(t, (U) => {
|
|
54
|
+
f === s.current && i(U);
|
|
55
|
+
});
|
|
56
|
+
else
|
|
57
|
+
throw new Error("Unsupported PDF source type");
|
|
58
|
+
if (d || f !== s.current || ((!u.current || u.current.isDestroyed) && (u.current = await F({ wasmUrl: p })), d || f !== s.current))
|
|
59
|
+
return;
|
|
60
|
+
const r = u.current.openDocument(e, x || void 0), g = N(r, e);
|
|
61
|
+
f === s.current && (l(g), i(100)), L && L(g), R(!1), b("");
|
|
62
|
+
} catch (e) {
|
|
63
|
+
if (d)
|
|
64
|
+
return;
|
|
65
|
+
const r = e;
|
|
66
|
+
r.code === "PASSWORD_REQUIRED" ? (R(!0), b(r.message || "Password required")) : r.code === "INVALID_PASSWORD" ? (R(!0), b("Incorrect password")) : (M(O.NOT_SUPPORTED), A && A(e));
|
|
67
|
+
} finally {
|
|
68
|
+
d || _(!1);
|
|
69
|
+
}
|
|
70
|
+
})(), () => {
|
|
71
|
+
d = !0;
|
|
27
72
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
e.onProgress = (o) => {
|
|
31
|
-
if (r === a.current) {
|
|
32
|
-
const { loaded: y, total: l } = o, L = l ? Math.min(100, Math.round(y / l * 100)) : 0;
|
|
33
|
-
g(L);
|
|
34
|
-
}
|
|
35
|
-
}, T(!0);
|
|
36
|
-
const t = e.promise.then((o) => (r === a.current && (q(o), g(100)), E && E(o), w(!1), c(""), o)).catch((o) => {
|
|
37
|
-
o instanceof Error && o.name === "PasswordException" ? (w(!0), c(o.message || "Password required")) : o instanceof Error && o.name === "InvalidPDFException" && u ? (w(!0), c("Incorrect password")) : i && i(o);
|
|
38
|
-
}).finally(() => {
|
|
39
|
-
T(!1);
|
|
40
|
-
});
|
|
41
|
-
return () => {
|
|
42
|
-
t.finally(() => {
|
|
43
|
-
e.destroy();
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
} catch (e) {
|
|
47
|
-
O(F.NOT_SUPPORTED), i && i(e);
|
|
48
|
-
}
|
|
49
|
-
}, [m, v, u, i, E]), k(() => {
|
|
50
|
-
if (p)
|
|
73
|
+
}, [t, y, p, x, A, L]), P(() => {
|
|
74
|
+
if (E)
|
|
51
75
|
return;
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
54
|
-
|
|
76
|
+
const f = /* @__PURE__ */ new Map();
|
|
77
|
+
if (!o || D) {
|
|
78
|
+
w(f);
|
|
55
79
|
return;
|
|
56
80
|
}
|
|
57
|
-
const
|
|
58
|
-
for (let
|
|
59
|
-
const
|
|
60
|
-
|
|
81
|
+
const d = o.numPages, k = [];
|
|
82
|
+
for (let e = 1; e <= d; e++) {
|
|
83
|
+
const r = o.getPage(e);
|
|
84
|
+
k.push(r);
|
|
61
85
|
}
|
|
62
|
-
Promise.all(
|
|
63
|
-
|
|
64
|
-
const { thumbnailViewport:
|
|
65
|
-
|
|
66
|
-
page:
|
|
67
|
-
thumbnailViewport:
|
|
68
|
-
thumbnailScale:
|
|
69
|
-
defaultRotation:
|
|
86
|
+
Promise.all(k).then((e) => {
|
|
87
|
+
e.map((r) => {
|
|
88
|
+
const { thumbnailViewport: g, scale: U } = q(r), C = r.getViewport();
|
|
89
|
+
f.set(r.pageNumber, {
|
|
90
|
+
page: r,
|
|
91
|
+
thumbnailViewport: g,
|
|
92
|
+
thumbnailScale: U,
|
|
93
|
+
defaultRotation: C.rotation
|
|
70
94
|
});
|
|
71
|
-
}),
|
|
95
|
+
}), w(f);
|
|
72
96
|
});
|
|
73
|
-
}, [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
97
|
+
}, [o, D, E]), P(() => () => {
|
|
98
|
+
o && o.destroy(), u.current && !u.current.isDestroyed && u.current.destroy();
|
|
99
|
+
}, []), {
|
|
100
|
+
pdf: o,
|
|
101
|
+
pages: m,
|
|
102
|
+
loading: D,
|
|
103
|
+
error: T,
|
|
104
|
+
loadingProgress: n,
|
|
105
|
+
passwordRequired: E,
|
|
106
|
+
passwordError: V
|
|
81
107
|
};
|
|
82
108
|
};
|
|
83
109
|
export {
|
|
84
|
-
|
|
110
|
+
re as useLoadPdf
|
|
85
111
|
};
|