@react-pdf-kit/viewer 2.8.0-beta.6 → 2.8.0-beta.8
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 +44 -30
- package/dist/{AnnotationLayer-CAIvKf_O.js → AnnotationLayer-CyOYh0Tw.js} +2 -2
- package/dist/CanvasLayer-CJqCJ30J.js +111 -0
- package/dist/{LoadingIndicator-DiWoWs4Y.js → LoadingIndicator-B_Jsf8No.js} +7 -7
- package/dist/MenuItem-D-GflAAo.js +31 -0
- package/dist/PaginationContext-DIzsZhFd.js +194 -0
- package/dist/{PasswordModal-CB9Rd2zJ.js → PasswordModal-S0leMhEd.js} +11 -11
- package/dist/RPLayout.module-BH5r8dDc.js +14 -0
- package/dist/RPPages-BQw330_L.js +655 -0
- package/dist/{RPTooltip-ZZoFqP7C.js → RPTooltip-COLVx-C_.js} +123 -91
- package/dist/SearchTool.module-DY8Ucfb_.js +17 -0
- package/dist/{SkipLink-CdcjClGB.js → SkipLink-Dj83gZdk.js} +3 -3
- package/dist/{TextLayer-DWGFN9SF.js → TextLayer-D-V9kogG.js} +5 -5
- package/dist/{Thumbnail-CzclS3h_.js → Thumbnail-C6zkvwcs.js} +6 -6
- package/dist/{Thumbnails-DnAsrttK.js → Thumbnails-DKG6I7pb.js} +2 -2
- package/dist/assets/AnnotationLayer.css +1 -1
- package/dist/assets/CanvasLayer.css +1 -0
- package/dist/assets/LoadingIndicator.css +1 -1
- package/dist/assets/MenuItem.css +1 -1
- package/dist/assets/PasswordModal.css +1 -1
- package/dist/assets/RPLayout.css +1 -1
- package/dist/assets/RPPages.css +1 -1
- package/dist/assets/SearchTool.css +1 -1
- package/dist/assets/SkipLink.css +1 -1
- package/dist/assets/TextLayer.css +1 -1
- package/dist/assets/Thumbnail.css +1 -1
- package/dist/assets/style.js +1 -1
- package/dist/components/RPController.js +39 -39
- package/dist/components/RPPages.js +1 -1
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/layout/LayoutContainer.js +6 -6
- package/dist/components/layout/LayoutWrapper.js +5 -5
- package/dist/components/layout/RPDefaultLayout.js +2 -2
- package/dist/components/layout/RPLayout.js +2 -2
- package/dist/components/layout/SkipLink.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +2 -2
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DarkModeTool.js +1 -1
- package/dist/components/layout/toolbar/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +6 -6
- package/dist/components/layout/toolbar/FileUploadTool.js +6 -6
- package/dist/components/layout/toolbar/FullScreenTool.js +9 -8
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +23 -29
- package/dist/components/layout/toolbar/OtherTool.js +1 -1
- package/dist/components/layout/toolbar/Paginate.js +2 -2
- package/dist/components/layout/toolbar/PrintTool.js +6 -6
- package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
- package/dist/components/layout/toolbar/RPMoreOptions.js +1 -1
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +10 -10
- package/dist/components/layout/toolbar/ScrollModeTool.js +17 -17
- package/dist/components/layout/toolbar/SearchCloseButton.js +2 -2
- package/dist/components/layout/toolbar/SearchResultNavigator.js +2 -2
- package/dist/components/layout/toolbar/SearchTool.js +133 -121
- package/dist/components/layout/toolbar/SelectionModeTool.js +10 -10
- package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
- package/dist/components/layout/toolbar/ToolbarDefault.js +2 -2
- package/dist/components/layout/toolbar/ViewModeTool.js +16 -16
- package/dist/components/layout/toolbar/ZoomTool.js +82 -80
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
- package/dist/components/layout/toolbar/tools/DualPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +1 -1
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +3 -3
- package/dist/components/layout/toolbar/tools/InputPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/LastPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/NextPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +1 -1
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +1 -1
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +1 -1
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +1 -1
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +25 -23
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +25 -23
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +7 -7
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +2 -2
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +2 -48
- package/dist/components/page/DualPage.js +2 -2
- package/dist/components/page/DualPageWithCover.js +2 -2
- package/dist/components/page/RPPage.js +94 -2
- package/dist/components/page/SinglePage.js +2 -2
- package/dist/components/page/TextHighlightLayer.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/PasswordModal.js +1 -1
- package/dist/components/ui/RPTooltip.js +1 -1
- package/dist/contexts/DimensionPagesContext.js +38 -22
- package/dist/contexts/ElementPageContext.js +46 -39
- package/dist/contexts/ElementThumbnailContext.js +1 -1
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +24 -18
- package/dist/contexts/RenderedPagesCache.js +32 -13
- package/dist/contexts/VirtualScrollContext.js +10 -13
- package/dist/contexts/ZoomContext.js +119 -61
- package/dist/{de_DE-DwUvXUWH.js → de_DE-x4Z-jQrz.js} +30 -0
- package/dist/{main-CKr9unOk.js → main-7sMXtgRg.js} +2 -2
- package/dist/main.js +4 -4
- package/dist/style-CJtyyrJx.js +5 -0
- package/dist/types/components/page/CanvasLayer.d.ts +4 -1
- package/dist/types/components/ui/RPTooltip.d.ts +3 -2
- package/dist/types/contexts/RenderQueueProvider.d.ts +2 -0
- package/dist/types/contexts/RenderedPagesCache.d.ts +3 -0
- package/dist/types/contexts/VirtualScrollContext.d.ts +0 -3
- package/dist/types/locales/de_DE.json.d.ts +5 -0
- package/dist/types/locales/en_US.json.d.ts +5 -0
- package/dist/types/locales/it_IT.json.d.ts +5 -0
- package/dist/types/locales/pt_PT.json.d.ts +5 -0
- package/dist/types/locales/th_TH.json.d.ts +5 -0
- package/dist/types/locales/zh_CN.json.d.ts +5 -0
- package/dist/types/utils/Queue.d.ts +1 -0
- package/dist/types/utils/const.d.ts +3 -0
- package/dist/types/utils/constants.d.ts +9 -0
- package/dist/types/utils/documentLayout.d.ts +60 -0
- package/dist/types/utils/hooks/usePinch.d.ts +14 -1
- package/dist/types/utils/hooks/usePresentPage.d.ts +2 -2
- package/dist/types/utils/hooks/useZoomOrigin.d.ts +4 -0
- package/dist/types/utils/types.d.ts +21 -2
- package/dist/types/utils/zoom.d.ts +2 -0
- package/dist/utils/Queue.js +5 -0
- package/dist/utils/const.js +2 -2
- package/dist/utils/constants.js +2 -2
- package/dist/utils/documentLayout.js +141 -0
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +73 -63
- package/dist/utils/hooks/useLocalization.js +1 -1
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePinch.js +109 -56
- package/dist/utils/hooks/usePresentPage.js +33 -57
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +66 -67
- package/dist/utils/hooks/useZoomOrigin.js +37 -0
- package/dist/utils/renderPage.js +21 -14
- package/dist/utils/types.js +3 -3
- package/dist/utils/zoom.js +8 -2
- package/package.json +1 -1
- package/dist/MenuItem-BJDWfzAw.js +0 -15
- package/dist/PaginationContext-Cwf8sCpK.js +0 -242
- package/dist/RPLayout.module-Vc3h4xxS.js +0 -14
- package/dist/RPPage-C_r8aeTc.js +0 -91
- package/dist/RPPages-CmXHTAqF.js +0 -1007
- package/dist/SearchTool.module-DUkVXfOn.js +0 -16
- package/dist/assets/RPPage.css +0 -1
- package/dist/contexts/VirtualGridContext.js +0 -18
- package/dist/style-C8T5x1fE.js +0 -5
- package/dist/types/contexts/VirtualGridContext.d.ts +0 -9
- package/dist/types/utils/calculatePage.d.ts +0 -12
- package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +0 -17
- package/dist/utils/calculatePage.js +0 -30
- package/dist/utils/hooks/useVirtualReactWindow.js +0 -86
- /package/dist/{TextHighlightLayer-BSVgBxR3.js → TextHighlightLayer-3vIZbRyL.js} +0 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
import { ErrorType as e, ScrollMode as t, SelectionMode as n } from "./utils/types.js";
|
|
2
|
+
import { useDocumentPasswordContext as r } from "./contexts/DocumentPasswordContext.js";
|
|
3
|
+
import { BROWSER_NOT_SUPPORTED_MESSAGE as i, INVALID_OR_CORRUPTED_PDF_MESSAGE as a, WASM_URL_REQUIRED_MESSAGE as o } from "./utils/const.js";
|
|
4
|
+
import { useDocumentContext as s } from "./contexts/RPDocumentContext.js";
|
|
5
|
+
import { useInitialStateContext as c } from "./contexts/InitialStateContext.js";
|
|
6
|
+
import { useScrollModeContext as l } from "./contexts/ScrollModeContext.js";
|
|
7
|
+
import { useViewModeContext as u } from "./contexts/ViewModeContext.js";
|
|
8
|
+
import { useVirtualScrollContext as d } from "./contexts/VirtualScrollContext.js";
|
|
9
|
+
import "./utils/constants.js";
|
|
10
|
+
import { useLayoutContainer as f } from "./contexts/LayoutContainerContext.js";
|
|
11
|
+
import { useEventCallbackContext as p } from "./contexts/EventCallbackContext.js";
|
|
12
|
+
import { useDebounce as m } from "./utils/hooks/useDebounce.js";
|
|
13
|
+
import { useZoomContext as h } from "./contexts/ZoomContext.js";
|
|
14
|
+
import { usePagesRotateContext as ee } from "./contexts/PagesRotateContext.js";
|
|
15
|
+
import { useDimensionPagesContext as g } from "./contexts/DimensionPagesContext.js";
|
|
16
|
+
import { buildDocumentLayout as _, getPageContentOffset as v, getPageFromDocumentPoint as y, getPagePlacement as te, getRowsByIndexes as ne, getVisibleRows as re } from "./utils/documentLayout.js";
|
|
17
|
+
import { a as ie, r as ae } from "./PaginationContext-DIzsZhFd.js";
|
|
18
|
+
import { useSelectionModeContext as oe } from "./contexts/SelectionModeContext.js";
|
|
19
|
+
import { useFullScreenContext as se } from "./contexts/FullScreenContext.js";
|
|
20
|
+
import { useRenderQueue as ce } from "./contexts/RenderQueueProvider.js";
|
|
21
|
+
import { t as le } from "./clsx-B7LyVm5O.js";
|
|
22
|
+
import { useLoaderContext as ue } from "./contexts/LoaderContext.js";
|
|
23
|
+
import { LayoutContainer as de } from "./components/layout/LayoutContainer.js";
|
|
24
|
+
import { LayoutWrapper as b } from "./components/layout/LayoutWrapper.js";
|
|
25
|
+
import { RPPage as fe } from "./components/page/RPPage.js";
|
|
26
|
+
import { t as pe } from "./PasswordModal-S0leMhEd.js";
|
|
27
|
+
import { approximateFraction as me } from "./utils/approximateFragtion.js";
|
|
28
|
+
import { useCopyText as he } from "./utils/hooks/useCopyText.js";
|
|
29
|
+
import { useGrabScroll as ge } from "./utils/hooks/useGrabScroll.js";
|
|
30
|
+
import { useMousePressed as _e } from "./utils/hooks/useMousePressed.js";
|
|
31
|
+
import { usePinch as ve } from "./utils/hooks/usePinch.js";
|
|
32
|
+
import { usePresentPage as ye } from "./utils/hooks/usePresentPage.js";
|
|
33
|
+
import { useTextSelection as be } from "./utils/hooks/useTextSelection.js";
|
|
34
|
+
import { Component as xe, createElement as Se, useCallback as x, useEffect as S, useLayoutEffect as Ce, useMemo as C, useRef as w, useState as we } from "react";
|
|
35
|
+
import { OutputScale as Te } from "pdfjs-dist";
|
|
36
|
+
import { Fragment as Ee, jsx as T, jsxs as De } from "react/jsx-runtime";
|
|
37
|
+
import './assets/RPPages.css';//#region node_modules/.pnpm/react-virtualized-auto-sizer@1.0.26_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/react-virtualized-auto-sizer/dist/react-virtualized-auto-sizer.esm.js
|
|
38
|
+
var E = typeof window < "u" ? window : typeof self < "u" ? self : global, D = null, O = null, k = 20, A = E.clearTimeout, j = E.setTimeout, M = E.cancelAnimationFrame || E.mozCancelAnimationFrame || E.webkitCancelAnimationFrame, N = E.requestAnimationFrame || E.mozRequestAnimationFrame || E.webkitRequestAnimationFrame;
|
|
39
|
+
M == null || N == null ? (D = A, O = function(e) {
|
|
40
|
+
return j(e, k);
|
|
41
|
+
}) : (D = function([e, t]) {
|
|
42
|
+
M(e), A(t);
|
|
43
|
+
}, O = function(e) {
|
|
44
|
+
let t = N(function() {
|
|
45
|
+
A(n), e();
|
|
46
|
+
}), n = j(function() {
|
|
47
|
+
M(t), e();
|
|
48
|
+
}, k);
|
|
49
|
+
return [t, n];
|
|
50
|
+
});
|
|
51
|
+
function P(e) {
|
|
52
|
+
let t, n, r, i, a, o, s, c = typeof document < "u" && document.attachEvent;
|
|
53
|
+
if (!c) {
|
|
54
|
+
o = function(e) {
|
|
55
|
+
let t = e.__resizeTriggers__, n = t.firstElementChild, r = t.lastElementChild, i = n.firstElementChild;
|
|
56
|
+
r.scrollLeft = r.scrollWidth, r.scrollTop = r.scrollHeight, i.style.width = n.offsetWidth + 1 + "px", i.style.height = n.offsetHeight + 1 + "px", n.scrollLeft = n.scrollWidth, n.scrollTop = n.scrollHeight;
|
|
57
|
+
}, a = function(e) {
|
|
58
|
+
return e.offsetWidth !== e.__resizeLast__.width || e.offsetHeight !== e.__resizeLast__.height;
|
|
59
|
+
}, s = function(e) {
|
|
60
|
+
if (e.target.className && typeof e.target.className.indexOf == "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) return;
|
|
61
|
+
let t = this;
|
|
62
|
+
o(this), this.__resizeRAF__ && D(this.__resizeRAF__), this.__resizeRAF__ = O(function() {
|
|
63
|
+
a(t) && (t.__resizeLast__.width = t.offsetWidth, t.__resizeLast__.height = t.offsetHeight, t.__resizeListeners__.forEach(function(n) {
|
|
64
|
+
n.call(t, e);
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
let e = !1, c = "";
|
|
69
|
+
r = "animationstart";
|
|
70
|
+
let l = "Webkit Moz O ms".split(" "), u = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), d = "";
|
|
71
|
+
{
|
|
72
|
+
let t = document.createElement("fakeelement");
|
|
73
|
+
if (t.style.animationName !== void 0 && (e = !0), e === !1) {
|
|
74
|
+
for (let n = 0; n < l.length; n++) if (t.style[l[n] + "AnimationName"] !== void 0) {
|
|
75
|
+
d = l[n], c = "-" + d.toLowerCase() + "-", r = u[n], e = !0;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
n = "resizeanim", t = "@" + c + "keyframes " + n + " { from { opacity: 0; } to { opacity: 0; } } ", i = c + "animation: 1ms " + n + "; ";
|
|
81
|
+
}
|
|
82
|
+
let l = function(n) {
|
|
83
|
+
if (!n.getElementById("detectElementResize")) {
|
|
84
|
+
let r = (t || "") + ".resize-triggers { " + (i || "") + "visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", a = n.head || n.getElementsByTagName("head")[0], o = n.createElement("style");
|
|
85
|
+
o.id = "detectElementResize", o.type = "text/css", e != null && o.setAttribute("nonce", e), o.styleSheet ? o.styleSheet.cssText = r : o.appendChild(n.createTextNode(r)), a.appendChild(o);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
addResizeListener: function(e, t) {
|
|
90
|
+
if (c) e.attachEvent("onresize", t);
|
|
91
|
+
else {
|
|
92
|
+
if (!e.__resizeTriggers__) {
|
|
93
|
+
let t = e.ownerDocument, i = E.getComputedStyle(e);
|
|
94
|
+
i && i.position === "static" && (e.style.position = "relative"), l(t), e.__resizeLast__ = {}, e.__resizeListeners__ = [], (e.__resizeTriggers__ = t.createElement("div")).className = "resize-triggers";
|
|
95
|
+
let a = t.createElement("div");
|
|
96
|
+
a.className = "expand-trigger", a.appendChild(t.createElement("div"));
|
|
97
|
+
let c = t.createElement("div");
|
|
98
|
+
c.className = "contract-trigger", e.__resizeTriggers__.appendChild(a), e.__resizeTriggers__.appendChild(c), e.appendChild(e.__resizeTriggers__), o(e), e.addEventListener("scroll", s, !0), r && (e.__resizeTriggers__.__animationListener__ = function(t) {
|
|
99
|
+
t.animationName === n && o(e);
|
|
100
|
+
}, e.__resizeTriggers__.addEventListener(r, e.__resizeTriggers__.__animationListener__));
|
|
101
|
+
}
|
|
102
|
+
e.__resizeListeners__.push(t);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
removeResizeListener: function(e, t) {
|
|
106
|
+
if (c) e.detachEvent("onresize", t);
|
|
107
|
+
else if (e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t), 1), !e.__resizeListeners__.length) {
|
|
108
|
+
e.removeEventListener("scroll", s, !0), e.__resizeTriggers__.__animationListener__ && (e.__resizeTriggers__.removeEventListener(r, e.__resizeTriggers__.__animationListener__), e.__resizeTriggers__.__animationListener__ = null);
|
|
109
|
+
try {
|
|
110
|
+
e.__resizeTriggers__ = !e.removeChild(e.__resizeTriggers__);
|
|
111
|
+
} catch {}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
var F = class extends xe {
|
|
117
|
+
constructor(...e) {
|
|
118
|
+
super(...e), this.state = {
|
|
119
|
+
height: this.props.defaultHeight || 0,
|
|
120
|
+
width: this.props.defaultWidth || 0
|
|
121
|
+
}, this._autoSizer = null, this._detectElementResize = null, this._didLogDeprecationWarning = !1, this._parentNode = null, this._resizeObserver = null, this._timeoutId = null, this._onResize = () => {
|
|
122
|
+
this._timeoutId = null;
|
|
123
|
+
let { disableHeight: e, disableWidth: t, onResize: n } = this.props;
|
|
124
|
+
if (this._parentNode) {
|
|
125
|
+
let r = window.getComputedStyle(this._parentNode) || {}, i = parseFloat(r.paddingLeft || "0"), a = parseFloat(r.paddingRight || "0"), o = parseFloat(r.paddingTop || "0"), s = parseFloat(r.paddingBottom || "0"), c = this._parentNode.getBoundingClientRect(), l = c.height - o - s, u = c.width - i - a;
|
|
126
|
+
if (!e && this.state.height !== l || !t && this.state.width !== u) {
|
|
127
|
+
this.setState({
|
|
128
|
+
height: l,
|
|
129
|
+
width: u
|
|
130
|
+
});
|
|
131
|
+
let e = () => {
|
|
132
|
+
this._didLogDeprecationWarning || (this._didLogDeprecationWarning = !0, console.warn("scaledWidth and scaledHeight parameters have been deprecated; use width and height instead"));
|
|
133
|
+
};
|
|
134
|
+
typeof n == "function" && n({
|
|
135
|
+
height: l,
|
|
136
|
+
width: u,
|
|
137
|
+
get scaledHeight() {
|
|
138
|
+
return e(), l;
|
|
139
|
+
},
|
|
140
|
+
get scaledWidth() {
|
|
141
|
+
return e(), u;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}, this._setRef = (e) => {
|
|
147
|
+
this._autoSizer = e;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
componentDidMount() {
|
|
151
|
+
let { nonce: e } = this.props, t = this._autoSizer ? this._autoSizer.parentNode : null;
|
|
152
|
+
if (t != null && t.ownerDocument && t.ownerDocument.defaultView && t instanceof t.ownerDocument.defaultView.HTMLElement) {
|
|
153
|
+
this._parentNode = t;
|
|
154
|
+
let n = t.ownerDocument.defaultView.ResizeObserver;
|
|
155
|
+
n == null ? (this._detectElementResize = P(e), this._detectElementResize.addResizeListener(t, this._onResize)) : (this._resizeObserver = new n(() => {
|
|
156
|
+
this._timeoutId = setTimeout(this._onResize, 0);
|
|
157
|
+
}), this._resizeObserver.observe(t)), this._onResize();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
componentWillUnmount() {
|
|
161
|
+
this._parentNode && (this._detectElementResize && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize), this._timeoutId !== null && clearTimeout(this._timeoutId), this._resizeObserver && this._resizeObserver.disconnect());
|
|
162
|
+
}
|
|
163
|
+
render() {
|
|
164
|
+
let { children: e, defaultHeight: t, defaultWidth: n, disableHeight: r = !1, disableWidth: i = !1, doNotBailOutOnEmptyChildren: a = !1, nonce: o, onResize: s, style: c = {}, tagName: l = "div", ...u } = this.props, { height: d, width: f } = this.state, p = { overflow: "visible" }, m = {}, h = !1;
|
|
165
|
+
return r || (d === 0 && (h = !0), p.height = 0, m.height = d, m.scaledHeight = d), i || (f === 0 && (h = !0), p.width = 0, m.width = f, m.scaledWidth = f), a && (h = !1), Se(l, {
|
|
166
|
+
ref: this._setRef,
|
|
167
|
+
style: {
|
|
168
|
+
...p,
|
|
169
|
+
...c
|
|
170
|
+
},
|
|
171
|
+
...u
|
|
172
|
+
}, !h && e(m));
|
|
173
|
+
}
|
|
174
|
+
}, I = {
|
|
175
|
+
"rp-pages": "_rp-pages_ruuiz_1",
|
|
176
|
+
"rp-page-scrolling-wrapper": "_rp-page-scrolling-wrapper_ruuiz_6",
|
|
177
|
+
"rp-pages-flow": "_rp-pages-flow_ruuiz_6",
|
|
178
|
+
"rp-document-wrapper": "_rp-document-wrapper_ruuiz_17",
|
|
179
|
+
"rp-page-row": "_rp-page-row_ruuiz_22",
|
|
180
|
+
"rp-pages-horizontal-scroll": "_rp-pages-horizontal-scroll_ruuiz_26",
|
|
181
|
+
"rp-not-supported-list": "_rp-not-supported-list_ruuiz_30",
|
|
182
|
+
"rp-pages-container": "_rp-pages-container_ruuiz_38",
|
|
183
|
+
"rp-viewer": "_rp-viewer_ruuiz_80",
|
|
184
|
+
"rp-cursor-grab": "_rp-cursor-grab_ruuiz_85",
|
|
185
|
+
"rp-cursor-grabbing": "_rp-cursor-grabbing_ruuiz_93",
|
|
186
|
+
"rp-loader": "_rp-loader_ruuiz_101",
|
|
187
|
+
"rp-not-supported": "_rp-not-supported_ruuiz_30",
|
|
188
|
+
"rp-not-supported-content": "_rp-not-supported-content_ruuiz_120",
|
|
189
|
+
"rp-load-error": "_rp-load-error_ruuiz_126",
|
|
190
|
+
"rp-load-error-message": "_rp-load-error-message_ruuiz_134"
|
|
191
|
+
}, Oe = (e, t, n) => Math.max(t, Math.min(e, n)), ke = (e) => ({
|
|
192
|
+
width: e.scrollWidth,
|
|
193
|
+
height: e.scrollHeight
|
|
194
|
+
}), Ae = (e, t, n, r, i) => {
|
|
195
|
+
let a = n.scrollTop - t.offsetTop, o = a + i, s = n.scrollLeft - t.offsetLeft, c = s + r, l = /* @__PURE__ */ new Map();
|
|
196
|
+
return e.forEach((e) => {
|
|
197
|
+
e.pages.forEach((e) => {
|
|
198
|
+
let t = e.left + e.width, n = e.top + e.height, r = Math.max(0, s - e.left), i = Math.max(0, a - e.top), u = Math.min(e.width, c - e.left), d = Math.min(e.height, o - e.top);
|
|
199
|
+
if (t <= s || e.left >= c || n <= a || e.top >= o) return;
|
|
200
|
+
let f = Math.max(0, u - r), p = Math.max(0, d - i), m = e.width * e.height || 1, h = Math.floor(f * p * 100 / m);
|
|
201
|
+
f > 0 && p > 0 && l.set(e.pageNumber, {
|
|
202
|
+
minX: r,
|
|
203
|
+
minY: i,
|
|
204
|
+
maxX: u,
|
|
205
|
+
maxY: d,
|
|
206
|
+
percent: h
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
}), l;
|
|
210
|
+
}, je = ({ row: e }) => /* @__PURE__ */ T("div", {
|
|
211
|
+
className: I["rp-page-row"],
|
|
212
|
+
style: {
|
|
213
|
+
position: "absolute",
|
|
214
|
+
top: e.top,
|
|
215
|
+
left: 0,
|
|
216
|
+
width: e.width,
|
|
217
|
+
height: e.height
|
|
218
|
+
},
|
|
219
|
+
children: e.pages.map((t) => /* @__PURE__ */ T(fe, {
|
|
220
|
+
pageNumber: t.pageNumber,
|
|
221
|
+
style: {
|
|
222
|
+
position: "absolute",
|
|
223
|
+
left: t.left,
|
|
224
|
+
top: t.top - e.top,
|
|
225
|
+
width: t.width,
|
|
226
|
+
height: t.height
|
|
227
|
+
}
|
|
228
|
+
}, t.pageNumber))
|
|
229
|
+
}), Me = (t) => {
|
|
230
|
+
if (t === e.WASM_URL_REQUIRED) return o;
|
|
231
|
+
if (t === e.INVALID_OR_CORRUPTED_PDF) return a;
|
|
232
|
+
if (t === e.NOT_SUPPORTED) return i;
|
|
233
|
+
}, Ne = ({ width: r, height: i }) => {
|
|
234
|
+
let { initialPage: a = 1, initialScrollMode: o } = c(), { pagesRef: de } = f(), { scrollToPage: b } = ie(), { getPageScrollElementRef: fe, getVirtualScrollableElementRef: pe, setTotalInnerDimensions: me, totalInnerDimensions: he, virtualScrollableElementRef: be, pageScrollElementRef: xe } = d(), Se = w(a > 1), [Te, Ee] = we(a > 1), { nextPage: E, prevPage: D, setFocusedPage: O, focusedPage: k, totalPages: A } = ae(), { scrollMode: j } = l(), { viewMode: M } = u(), { loading: N, error: P, pages: F } = s(), { pageRotate: Ne } = ee(), { LoaderImageComponent: Pe } = ue(), { isFullScreen: Fe } = se(), { onScroll: Ie } = p(), { widths: Le, heights: Re } = g(), ze = ce(), { targetZoom: L, zoomOrigin: R, isZooming: z, previousTargetZoom: Be } = h(), Ve = m(he, 100), He = w(null), B = w(he), Ue = w({
|
|
235
|
+
viewMode: M,
|
|
236
|
+
scrollMode: j
|
|
237
|
+
}), V = w(null), H = w(null), U = w(null), W = w(null), G = w(!1), K = w(!1), q = w(L), We = Me(P), Ge = w(), J = w(), Ke = w(), qe = w([]), Je = w([]), Y = w({
|
|
238
|
+
scrollTop: 0,
|
|
239
|
+
scrollLeft: 0
|
|
240
|
+
}), [X, Ye] = we(Y.current), Z = j === t.PAGE_SCROLLING ? xe ?? be : be ?? xe, { isPressed: Xe } = _e(), { initializeGrabScroll: Ze, resetGrabState: Qe } = ge({ isPressed: Xe }), { selectionMode: $e } = oe(), et = $e === n.HAND, Q = C(() => _({
|
|
241
|
+
pageDimensions: {
|
|
242
|
+
widths: Le,
|
|
243
|
+
heights: Re
|
|
244
|
+
},
|
|
245
|
+
viewportWidth: r,
|
|
246
|
+
viewportHeight: i,
|
|
247
|
+
scrollMode: j,
|
|
248
|
+
viewMode: M,
|
|
249
|
+
focusedPage: k
|
|
250
|
+
}), [
|
|
251
|
+
k,
|
|
252
|
+
i,
|
|
253
|
+
Re,
|
|
254
|
+
j,
|
|
255
|
+
M,
|
|
256
|
+
r,
|
|
257
|
+
Le
|
|
258
|
+
]), tt = C(() => re(Q, X.scrollTop, X.scrollLeft, r, i, 2), [
|
|
259
|
+
i,
|
|
260
|
+
Q,
|
|
261
|
+
X.scrollLeft,
|
|
262
|
+
X.scrollTop,
|
|
263
|
+
r
|
|
264
|
+
]), nt = C(() => z && qe.current.length ? ne(Q, qe.current, Je.current) : tt, [
|
|
265
|
+
tt,
|
|
266
|
+
z,
|
|
267
|
+
Q
|
|
268
|
+
]), rt = C(() => Ae(nt, Q, X, r, i), [
|
|
269
|
+
i,
|
|
270
|
+
Q,
|
|
271
|
+
X,
|
|
272
|
+
nt,
|
|
273
|
+
r
|
|
274
|
+
]);
|
|
275
|
+
ye(Z, Q), S(() => {
|
|
276
|
+
z || (qe.current = tt.map((e) => e.index), Je.current = tt.flatMap((e) => e.pages.map((e) => e.pageNumber)));
|
|
277
|
+
}, [tt, z]), S(() => {
|
|
278
|
+
Array.from(rt.entries()).sort(([, e], [, t]) => t.percent - e.percent).forEach(([e], t) => {
|
|
279
|
+
ze.changePagePriority(`^page-${e}$`, t);
|
|
280
|
+
});
|
|
281
|
+
}, [rt, ze]), S(() => {
|
|
282
|
+
z && ze.removeQueues(/^page-/);
|
|
283
|
+
}, [z, ze]), S(() => {
|
|
284
|
+
N && Qe();
|
|
285
|
+
}, [N, Qe]), S(() => {
|
|
286
|
+
if (!We) return;
|
|
287
|
+
let e = requestAnimationFrame(() => {
|
|
288
|
+
He.current?.focus();
|
|
289
|
+
});
|
|
290
|
+
return () => {
|
|
291
|
+
cancelAnimationFrame(e);
|
|
292
|
+
};
|
|
293
|
+
}, [We]);
|
|
294
|
+
let $ = x((e) => {
|
|
295
|
+
let t = F.get(e);
|
|
296
|
+
return Ne[e] ?? t?.defaultRotation ?? 0;
|
|
297
|
+
}, [Ne, F]), it = x((e, t = k) => {
|
|
298
|
+
let n = [], a = [];
|
|
299
|
+
for (let t = 1; t <= A; t += 1) {
|
|
300
|
+
let r = F.get(t);
|
|
301
|
+
if (!r) continue;
|
|
302
|
+
let i = $(t), o = r.page.getViewport({
|
|
303
|
+
scale: 1,
|
|
304
|
+
rotation: i,
|
|
305
|
+
dontFlip: !0
|
|
306
|
+
});
|
|
307
|
+
n[t - 1] = o.width * e + 4, a[t - 1] = o.height * e + 4;
|
|
308
|
+
}
|
|
309
|
+
return _({
|
|
310
|
+
pageDimensions: {
|
|
311
|
+
widths: n,
|
|
312
|
+
heights: a
|
|
313
|
+
},
|
|
314
|
+
viewportWidth: r,
|
|
315
|
+
viewportHeight: i,
|
|
316
|
+
scrollMode: j,
|
|
317
|
+
viewMode: M,
|
|
318
|
+
focusedPage: t
|
|
319
|
+
});
|
|
320
|
+
}, [
|
|
321
|
+
k,
|
|
322
|
+
$,
|
|
323
|
+
i,
|
|
324
|
+
F,
|
|
325
|
+
j,
|
|
326
|
+
A,
|
|
327
|
+
M,
|
|
328
|
+
r
|
|
329
|
+
]), at = x((e, t, n) => {
|
|
330
|
+
let r = Z ? Math.max(0, n.scrollHeight - Z.clientHeight) : Math.max(0, n.scrollHeight), i = Z ? Math.max(0, n.scrollWidth - Z.clientWidth) : Math.max(0, n.scrollWidth);
|
|
331
|
+
return {
|
|
332
|
+
scrollTop: Math.round(Oe(e, 0, r)) || 0,
|
|
333
|
+
scrollLeft: Math.round(Oe(t, 0, i)) || 0
|
|
334
|
+
};
|
|
335
|
+
}, [Z]), ot = x((e, t) => {
|
|
336
|
+
if (!Z) return {
|
|
337
|
+
scrollTop: 0,
|
|
338
|
+
scrollLeft: 0
|
|
339
|
+
};
|
|
340
|
+
let n = Y.current.scrollTop > t, r = Y.current.scrollLeft > e;
|
|
341
|
+
return n || r ? Y.current : {
|
|
342
|
+
scrollTop: Z.scrollTop,
|
|
343
|
+
scrollLeft: Z.scrollLeft
|
|
344
|
+
};
|
|
345
|
+
}, [Z]), st = x((e, t, n, r, i) => {
|
|
346
|
+
if (!n || !r || !i || !F.size) return null;
|
|
347
|
+
let a = t + n[0] - i.offsetLeft, o = e + n[1] - i.offsetTop, s = y(i, a, o) ?? te(i, k);
|
|
348
|
+
if (!s) return null;
|
|
349
|
+
let c = F.get(s.pageNumber);
|
|
350
|
+
if (!c) return null;
|
|
351
|
+
let l = $(s.pageNumber), u = c.page.getViewport({
|
|
352
|
+
scale: r,
|
|
353
|
+
rotation: l
|
|
354
|
+
}), d = v(s.width, s.height, u.width, u.height), f = Oe(a - s.left - d.x, 0, u.width), p = Oe(o - s.top - d.y, 0, u.height), [m, h] = u.convertToPdfPoint(f, p);
|
|
355
|
+
return {
|
|
356
|
+
pageNumber: s.pageNumber,
|
|
357
|
+
pdfX: m,
|
|
358
|
+
pdfY: h,
|
|
359
|
+
origin: n
|
|
360
|
+
};
|
|
361
|
+
}, [
|
|
362
|
+
k,
|
|
363
|
+
$,
|
|
364
|
+
F
|
|
365
|
+
]), ct = x((e, t, n) => {
|
|
366
|
+
let r = F.get(t.pageNumber), i = te(n, t.pageNumber);
|
|
367
|
+
if (!r || !i || !e) return null;
|
|
368
|
+
let a = $(t.pageNumber), o = r.page.getViewport({
|
|
369
|
+
scale: e,
|
|
370
|
+
rotation: a
|
|
371
|
+
}), [s, c] = o.convertToViewportPoint(t.pdfX, t.pdfY), l = v(i.width, i.height, o.width, o.height);
|
|
372
|
+
return {
|
|
373
|
+
left: n.offsetLeft + i.left + l.x + s - t.origin[0],
|
|
374
|
+
top: n.offsetTop + i.top + l.y + c - t.origin[1]
|
|
375
|
+
};
|
|
376
|
+
}, [$, F]), lt = x((e, t) => {
|
|
377
|
+
(G.current || U.current || W.current) && (K.current = !0), Z?.scrollTo({
|
|
378
|
+
top: e,
|
|
379
|
+
left: t,
|
|
380
|
+
behavior: "auto"
|
|
381
|
+
}), Y.current = {
|
|
382
|
+
scrollTop: e,
|
|
383
|
+
scrollLeft: t
|
|
384
|
+
}, Ye(Y.current);
|
|
385
|
+
}, [Z]), ut = x(({ gesture: e, origin: t, previousScale: n, nextScale: r }) => {
|
|
386
|
+
if (e !== "touch" || !t || !n || !r) return;
|
|
387
|
+
G.current = !0;
|
|
388
|
+
let i = W.current, a = i?.scale || q.current || n, o = i?.layout ?? V.current ?? Q, s = i?.scrollTop ?? Y.current.scrollTop, c = i?.scrollLeft ?? Y.current.scrollLeft, l = it(r), u = st(s, c, t, a, o), d = u ? ct(r, u, l) : null, f = 0, p = 0;
|
|
389
|
+
if (d) p = d.left, f = d.top;
|
|
390
|
+
else {
|
|
391
|
+
let e = r / a;
|
|
392
|
+
p = (c + t[0]) * e - t[0], f = (s + t[1]) * e - t[1];
|
|
393
|
+
}
|
|
394
|
+
let m = at(f, p, l);
|
|
395
|
+
U.current = {
|
|
396
|
+
location: u,
|
|
397
|
+
origin: t,
|
|
398
|
+
previousScale: a,
|
|
399
|
+
nextScale: r,
|
|
400
|
+
scrollTop: s,
|
|
401
|
+
scrollLeft: c,
|
|
402
|
+
targetScrollTop: m.scrollTop,
|
|
403
|
+
targetScrollLeft: m.scrollLeft,
|
|
404
|
+
targetLayout: l
|
|
405
|
+
}, W.current = {
|
|
406
|
+
scale: r,
|
|
407
|
+
layout: l,
|
|
408
|
+
scrollTop: m.scrollTop,
|
|
409
|
+
scrollLeft: m.scrollLeft
|
|
410
|
+
}, H.current = u;
|
|
411
|
+
}, [
|
|
412
|
+
ct,
|
|
413
|
+
st,
|
|
414
|
+
at,
|
|
415
|
+
it,
|
|
416
|
+
Q
|
|
417
|
+
]), dt = x(() => {
|
|
418
|
+
G.current = !1, K.current = !1, U.current || (W.current = null, H.current = null);
|
|
419
|
+
}, []), ft = x(() => {
|
|
420
|
+
G.current = !1, K.current = !1, U.current = null, W.current = null, H.current = null;
|
|
421
|
+
}, []);
|
|
422
|
+
ve(Z || de, {
|
|
423
|
+
onBeforeZoom: ut,
|
|
424
|
+
onPinchEnd: dt
|
|
425
|
+
});
|
|
426
|
+
let pt = x((e, t) => {
|
|
427
|
+
if (Ue.current.viewMode !== M || Ue.current.scrollMode !== j) {
|
|
428
|
+
J.current && clearTimeout(J.current), H.current = null, ft(), b(k, "auto"), J.current = setTimeout(() => {
|
|
429
|
+
requestAnimationFrame(() => {
|
|
430
|
+
Ue.current = {
|
|
431
|
+
viewMode: M,
|
|
432
|
+
scrollMode: j
|
|
433
|
+
}, V.current = Q, q.current = L;
|
|
434
|
+
});
|
|
435
|
+
}, 100);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
let n = e.scrollTop, r = e.scrollLeft;
|
|
439
|
+
if (!t.height || !t.width) return;
|
|
440
|
+
let { height: i, width: o } = t, { height: s, width: c } = B.current, l = V.current, u = Math.abs(q.current - L) > 1e-10, d = u && !!R, f = q.current || Be || L, p = U.current, m = p?.nextScale ?? L;
|
|
441
|
+
if (s === i && c === o) {
|
|
442
|
+
if (p) {
|
|
443
|
+
lt(p.targetScrollTop, p.targetScrollLeft), H.current = null, U.current = null, G.current || (W.current = null, K.current = !1), V.current = p.targetLayout, q.current = p.nextScale;
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
if (d && l) {
|
|
447
|
+
H.current = st(n, r, R, f, l);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
V.current = Q, q.current = L;
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (Se.current && a > 1) {
|
|
454
|
+
H.current = null, ft(), B.current = {
|
|
455
|
+
height: t.height,
|
|
456
|
+
width: t.width
|
|
457
|
+
}, V.current = Q, q.current = L;
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (!s || !c) {
|
|
461
|
+
H.current = null, ft(), B.current = {
|
|
462
|
+
height: t.height,
|
|
463
|
+
width: t.width
|
|
464
|
+
}, V.current = Q, q.current = L;
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
let h = !!p, ee = !!H.current;
|
|
468
|
+
if (n === 0 && r === 0 && !(h || (u || ee) && (R || ee))) {
|
|
469
|
+
B.current = {
|
|
470
|
+
height: t.height,
|
|
471
|
+
width: t.width
|
|
472
|
+
}, V.current = Q, q.current = L;
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
let g = n / s * i, _ = r / c * o, v = !1;
|
|
476
|
+
if (p) _ = p.targetScrollLeft, g = p.targetScrollTop, v = !0;
|
|
477
|
+
else if ((u || ee) && l) {
|
|
478
|
+
let e = H.current ?? st(n, r, R, f, l), t = e ? ct(L, e, Q) : null;
|
|
479
|
+
if (t) _ = t.left, g = t.top, v = !0;
|
|
480
|
+
else {
|
|
481
|
+
let e = L / f, t = R ?? H.current?.origin;
|
|
482
|
+
t && (_ = (r + t[0]) * e - t[0], g = (n + t[1]) * e - t[1], v = !0);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
let y = at(g, _, Q);
|
|
486
|
+
v ? lt(y.scrollTop, y.scrollLeft) : Ge.current = setTimeout(() => {
|
|
487
|
+
requestAnimationFrame(() => {
|
|
488
|
+
lt(y.scrollTop, y.scrollLeft);
|
|
489
|
+
});
|
|
490
|
+
}, 0), H.current = null, U.current = null, G.current || (W.current = null, K.current = !1), B.current = {
|
|
491
|
+
height: t.height,
|
|
492
|
+
width: t.width
|
|
493
|
+
}, V.current = Q, q.current = m;
|
|
494
|
+
}, [
|
|
495
|
+
ct,
|
|
496
|
+
st,
|
|
497
|
+
at,
|
|
498
|
+
k,
|
|
499
|
+
a,
|
|
500
|
+
Q,
|
|
501
|
+
Be,
|
|
502
|
+
ft,
|
|
503
|
+
j,
|
|
504
|
+
b,
|
|
505
|
+
lt,
|
|
506
|
+
L,
|
|
507
|
+
M,
|
|
508
|
+
R
|
|
509
|
+
]);
|
|
510
|
+
Ce(() => {
|
|
511
|
+
clearTimeout(Ge.current);
|
|
512
|
+
let e = ke(Q), t = !!U.current, n = t ? Y.current : ot(e.width, e.height);
|
|
513
|
+
t || (Y.current = n, Ye(n)), pt(n, e), me(e);
|
|
514
|
+
}, [
|
|
515
|
+
ot,
|
|
516
|
+
Q,
|
|
517
|
+
me,
|
|
518
|
+
pt
|
|
519
|
+
]);
|
|
520
|
+
let mt = x((e) => {
|
|
521
|
+
let t = document.activeElement !== de;
|
|
522
|
+
!Fe && t || (["ArrowUp", "ArrowLeft"].includes(e.key) ? (e.preventDefault(), D()) : ["ArrowDown", "ArrowRight"].includes(e.key) && (e.preventDefault(), E()));
|
|
523
|
+
}, [
|
|
524
|
+
Fe,
|
|
525
|
+
E,
|
|
526
|
+
de,
|
|
527
|
+
D
|
|
528
|
+
]);
|
|
529
|
+
S(() => (window.addEventListener("keydown", mt), () => {
|
|
530
|
+
window.removeEventListener("keydown", mt);
|
|
531
|
+
}), [mt]), S(() => () => {
|
|
532
|
+
J.current && clearTimeout(J.current), Ke.current && cancelAnimationFrame(Ke.current);
|
|
533
|
+
}, []), S(() => {
|
|
534
|
+
Ve.height === 0 || !Se.current || Z && (b(a, "auto"), requestAnimationFrame(() => {
|
|
535
|
+
O(a), Se.current = !1, Ee(!1);
|
|
536
|
+
}));
|
|
537
|
+
}, [
|
|
538
|
+
Ve.height,
|
|
539
|
+
a,
|
|
540
|
+
o,
|
|
541
|
+
b,
|
|
542
|
+
Z,
|
|
543
|
+
O
|
|
544
|
+
]);
|
|
545
|
+
let ht = x((e) => {
|
|
546
|
+
e && (pe(e), fe(e), et && Ze(e));
|
|
547
|
+
}, [
|
|
548
|
+
fe,
|
|
549
|
+
pe,
|
|
550
|
+
Ze,
|
|
551
|
+
et
|
|
552
|
+
]), gt = x((e) => {
|
|
553
|
+
let t = e.currentTarget, n = {
|
|
554
|
+
scrollTop: t.scrollTop,
|
|
555
|
+
scrollLeft: t.scrollLeft
|
|
556
|
+
};
|
|
557
|
+
if (G.current || U.current || K.current) {
|
|
558
|
+
K.current = !1, Ie?.(e.nativeEvent);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
Y.current = n, Ke.current && cancelAnimationFrame(Ke.current), Ke.current = requestAnimationFrame(() => {
|
|
562
|
+
Ye(n);
|
|
563
|
+
}), Ie?.(e.nativeEvent);
|
|
564
|
+
}, [Ie]);
|
|
565
|
+
return P === e.INVALID_OR_CORRUPTED_PDF ? /* @__PURE__ */ T("div", {
|
|
566
|
+
ref: He,
|
|
567
|
+
className: I["rp-load-error"],
|
|
568
|
+
style: {
|
|
569
|
+
width: r,
|
|
570
|
+
height: i
|
|
571
|
+
},
|
|
572
|
+
tabIndex: -1,
|
|
573
|
+
role: "alert",
|
|
574
|
+
"aria-live": "assertive",
|
|
575
|
+
"aria-atomic": "true",
|
|
576
|
+
children: /* @__PURE__ */ T("div", {
|
|
577
|
+
className: I["rp-load-error-message"],
|
|
578
|
+
children: "Invalid or corrupted PDF file."
|
|
579
|
+
})
|
|
580
|
+
}) : P === e.NOT_SUPPORTED ? /* @__PURE__ */ T("div", {
|
|
581
|
+
className: I["rp-not-supported"],
|
|
582
|
+
children: /* @__PURE__ */ De("div", {
|
|
583
|
+
className: I["rp-not-supported-content"],
|
|
584
|
+
children: ["React PDF Kit is unable to render on this browser. Please use the supported browsers from the list below:", /* @__PURE__ */ T("div", { children: /* @__PURE__ */ De("ul", {
|
|
585
|
+
className: I["rp-not-supported-list"],
|
|
586
|
+
children: [
|
|
587
|
+
/* @__PURE__ */ T("li", { children: "Chrome 126+" }),
|
|
588
|
+
/* @__PURE__ */ T("li", { children: "Edge 126+" }),
|
|
589
|
+
/* @__PURE__ */ T("li", { children: "Firefox 126+" }),
|
|
590
|
+
/* @__PURE__ */ T("li", { children: "Safari 18.4+" }),
|
|
591
|
+
/* @__PURE__ */ T("li", { children: "Safari iOS 18.4+" }),
|
|
592
|
+
/* @__PURE__ */ T("li", { children: "Chrome Android 126+" })
|
|
593
|
+
]
|
|
594
|
+
}) })]
|
|
595
|
+
})
|
|
596
|
+
}) : !Q.pages.length && !N && !P ? /* @__PURE__ */ T("div", {
|
|
597
|
+
className: I["rp-loader"],
|
|
598
|
+
style: {
|
|
599
|
+
width: r,
|
|
600
|
+
height: i
|
|
601
|
+
},
|
|
602
|
+
children: Pe && /* @__PURE__ */ T(Pe, {})
|
|
603
|
+
}) : /* @__PURE__ */ T("div", {
|
|
604
|
+
"data-rp": "pages",
|
|
605
|
+
ref: ht,
|
|
606
|
+
className: le(I["rp-pages"], I["rp-pages-flow"], j === t.HORIZONTAL_SCROLLING && I["rp-pages-horizontal-scroll"], j === t.PAGE_SCROLLING && I["rp-page-scrolling-wrapper"]),
|
|
607
|
+
onScroll: gt,
|
|
608
|
+
style: {
|
|
609
|
+
width: r,
|
|
610
|
+
height: i,
|
|
611
|
+
...Te && { visibility: "hidden" }
|
|
612
|
+
},
|
|
613
|
+
children: /* @__PURE__ */ T("div", {
|
|
614
|
+
className: I["rp-document-wrapper"],
|
|
615
|
+
style: {
|
|
616
|
+
width: Q.documentWidth,
|
|
617
|
+
height: Q.documentHeight,
|
|
618
|
+
marginLeft: Q.offsetLeft,
|
|
619
|
+
marginTop: Q.offsetTop,
|
|
620
|
+
"--rp-pages-height": `${Q.documentHeight}px`,
|
|
621
|
+
"--rp-pages-width": `${Q.documentWidth}px`
|
|
622
|
+
},
|
|
623
|
+
children: nt.map((e) => /* @__PURE__ */ T(je, { row: e }, e.index))
|
|
624
|
+
})
|
|
625
|
+
});
|
|
626
|
+
}, Pe = () => {
|
|
627
|
+
let e = w(new Te()), { pagesRef: t, setPagesRef: i, setContentRef: a } = f(), { passwordRequired: o } = r(), { onTextSelect: s } = p(), { selectionMode: c } = oe(), { isPressed: l } = _e(), u = c === n.HAND, d = C(() => le(I["rp-pages-container"], {
|
|
628
|
+
[I["rp-cursor-grab"]]: u && !l,
|
|
629
|
+
[I["rp-cursor-grabbing"]]: u && l
|
|
630
|
+
}), [u, l]);
|
|
631
|
+
return he(t), be({
|
|
632
|
+
onTextSelect: s,
|
|
633
|
+
pagesRef: t
|
|
634
|
+
}), /* @__PURE__ */ De(Ee, { children: [/* @__PURE__ */ T(b, {
|
|
635
|
+
ref: a,
|
|
636
|
+
children: /* @__PURE__ */ T(de, {
|
|
637
|
+
ref: i,
|
|
638
|
+
tabIndex: -1,
|
|
639
|
+
className: d,
|
|
640
|
+
style: {
|
|
641
|
+
"--scale-round-x": `${me(e.current.sx)[1]}px`,
|
|
642
|
+
"--scale-round-y": `${me(e.current.sy)[1]}px`
|
|
643
|
+
},
|
|
644
|
+
children: /* @__PURE__ */ T(F, {
|
|
645
|
+
style: { minHeight: "50px" },
|
|
646
|
+
children: ({ width: e, height: t }) => /* @__PURE__ */ T(Ne, {
|
|
647
|
+
width: e,
|
|
648
|
+
height: t
|
|
649
|
+
})
|
|
650
|
+
})
|
|
651
|
+
})
|
|
652
|
+
}), o && /* @__PURE__ */ T(pe, {})] });
|
|
653
|
+
};
|
|
654
|
+
//#endregion
|
|
655
|
+
export { Pe as t };
|