@pdf-viewer/react 1.14.0-beta.0 → 1.14.0-beta.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/dist/ToolbarLayout.module-c133fcc0.js +3543 -0
- package/dist/components/RPController.js +3 -3
- package/dist/components/RPPages.js +3 -3
- package/dist/components/RPProvider.js +3 -3
- package/dist/components/layout/LayoutContainer.js +3 -3
- package/dist/components/layout/RPDefaultLayout.js +3 -3
- package/dist/components/layout/RPLayout.js +3 -3
- package/dist/components/layout/sidebar/RPSidebar.js +3 -3
- package/dist/components/layout/sidebar/Thumbnail.js +3 -3
- package/dist/components/layout/sidebar/Thumbnails.js +3 -3
- package/dist/components/layout/toolbar/DarkModeTool.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +3 -3
- package/dist/components/layout/toolbar/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/FileDownloadTool.js +3 -3
- package/dist/components/layout/toolbar/FileUploadTool.js +2 -2
- package/dist/components/layout/toolbar/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/MenuItem.js +2 -2
- package/dist/components/layout/toolbar/MenuSeparator.js +2 -2
- package/dist/components/layout/toolbar/MostPageTool.js +3 -3
- package/dist/components/layout/toolbar/OtherTool.js +3 -3
- package/dist/components/layout/toolbar/Paginate.js +3 -3
- package/dist/components/layout/toolbar/PrintTool.js +3 -3
- package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
- package/dist/components/layout/toolbar/RPMoreOptions.js +3 -3
- package/dist/components/layout/toolbar/RPToolbar.js +3 -3
- package/dist/components/layout/toolbar/RPToolbarEnd.js +3 -3
- package/dist/components/layout/toolbar/RotateTool.js +2 -2
- package/dist/components/layout/toolbar/ScrollModeTool.js +2 -2
- package/dist/components/layout/toolbar/SearchCloseButton.js +1 -1
- package/dist/components/layout/toolbar/SearchResultNavigator.js +3 -3
- package/dist/components/layout/toolbar/SearchTool.js +3 -3
- package/dist/components/layout/toolbar/SelectionModeTool.js +2 -2
- package/dist/components/layout/toolbar/ThumbnailTool.js +3 -3
- package/dist/components/layout/toolbar/ToolbarCustom.js +21 -21
- package/dist/components/layout/toolbar/ToolbarDefault.js +27 -27
- package/dist/components/layout/toolbar/ToolbarLayout.js +3 -3
- package/dist/components/layout/toolbar/ViewModeTool.js +2 -2
- package/dist/components/layout/toolbar/ZoomTool.js +3 -3
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +3 -3
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +3 -3
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +1 -1
- package/dist/components/layout/toolbar/tools/InputPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/NextPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/PrintTool.js +4 -4
- 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 +29 -0
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +3 -3
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +3 -3
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +3 -3
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +1 -1
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +3 -3
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +3 -3
- 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 +4 -4
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +2 -2
- 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 +3 -3
- package/dist/components/page/CanvasLayer.js +3 -3
- package/dist/components/page/DualPage.js +3 -3
- package/dist/components/page/RPPage.js +3 -3
- package/dist/components/page/SinglePage.js +3 -3
- package/dist/components/page/TextHighlightLayer.js +3 -3
- package/dist/components/page/TextLayer.js +3 -3
- package/dist/components/ui/DropDown.js +2 -2
- package/dist/components/ui/LoadingIndicator.js +3 -3
- package/dist/components/ui/RPTooltip.js +430 -200
- package/dist/contexts/PaginationContext.js +3 -3
- package/dist/contexts/PrintContext.js +3 -3
- package/dist/contexts/RenderQueueProvider.js +3 -3
- package/dist/contexts/SearchContext.js +3 -3
- package/dist/contexts/ThumbnailsContext.js +3 -3
- package/dist/floating-ui.react-dom-d22a10b4.js +1474 -0
- package/dist/index-3bf64864.js +1886 -0
- package/dist/main.js +22 -20
- package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
- package/dist/types/main.d.ts +2 -1
- package/dist/types/utils/hooks/usePrint.d.ts +3 -2
- package/dist/types/utils/hooks/useSearch.d.ts +1 -2
- package/dist/types/utils/types.d.ts +14 -3
- package/dist/utils/hooks/useFileDownload.js +3 -3
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePaginate.js +3 -3
- package/dist/utils/hooks/usePresentPage.js +3 -3
- package/dist/utils/hooks/usePrint.js +3 -3
- package/dist/utils/hooks/useScrollToPage.js +3 -3
- package/dist/utils/hooks/useSearch.js +3 -3
- package/dist/utils/hooks/useThumbnail.js +3 -3
- package/dist/utils/hooks/useVirtualReactWindow.js +3 -3
- package/package.json +1 -1
- package/dist/ToolbarLayout.module-37d1f575.js +0 -3539
- package/dist/index-808ea7bf.js +0 -1685
- package/dist/index-a48ec088.js +0 -1672
|
@@ -0,0 +1,3543 @@
|
|
|
1
|
+
import { jsx as i, Fragment as he, jsxs as W } from "react/jsx-runtime";
|
|
2
|
+
import * as Q from "react";
|
|
3
|
+
import { useRef as M, useEffect as z, useCallback as N, useState as $, useMemo as k, createContext as Ve, useContext as Be, useImperativeHandle as dn, createElement as Ke, PureComponent as ao, Component as co, memo as un, Fragment as lo, forwardRef as uo } from "react";
|
|
4
|
+
import { ChevronUpIcon as Ue } from "./components/icons/ChevronUpIcon.js";
|
|
5
|
+
import { UIButton as ce } from "./components/ui/Button.js";
|
|
6
|
+
import { UIInput as pn } from "./components/ui/Input.js";
|
|
7
|
+
import { ViewMode as Ne, ScrollMode as oe, AnnotationSubType as Wt, SelectionMode as po, ErrorType as ho, ZoomLevel as We } from "./utils/types.js";
|
|
8
|
+
import { useScrollModeContext as De } from "./contexts/ScrollModeContext.js";
|
|
9
|
+
import { useDocumentContext as re } from "./contexts/RPDocumentContext.js";
|
|
10
|
+
import { useDocumentPasswordContext as fo } from "./contexts/DocumentPasswordContext.js";
|
|
11
|
+
import { useDarkModeContext as mo } from "./contexts/DarkModeContext.js";
|
|
12
|
+
import "./contexts/RotationContext.js";
|
|
13
|
+
import { useLayerContext as go } from "./contexts/LayerContext.js";
|
|
14
|
+
import { useZoomContext as tt } from "./contexts/ZoomContext.js";
|
|
15
|
+
import { useViewModeContext as Me } from "./contexts/ViewModeContext.js";
|
|
16
|
+
import { useVirtualScrollContext as nt } from "./contexts/VirtualScrollContext.js";
|
|
17
|
+
import { useVirtualGridContext as hn } from "./contexts/VirtualGridContext.js";
|
|
18
|
+
import { useSelectionModeContext as vo } from "./contexts/SelectionModeContext.js";
|
|
19
|
+
import { useInitialStateContext as wo } from "./contexts/InitialStateContext.js";
|
|
20
|
+
import { useFullScreenContext as _o } from "./contexts/FullScreenContext.js";
|
|
21
|
+
import "./contexts/FileInputContext.js";
|
|
22
|
+
import "./contexts/DropFileZoneContext.js";
|
|
23
|
+
import { findMatches as bo, resetDivs as To, highlightMatches as Co, isMatchEntireWord as Po } from "./utils/highlight.js";
|
|
24
|
+
import { useLayoutContainer as Te } from "./contexts/LayoutContainerContext.js";
|
|
25
|
+
import { useDimensionPagesContext as Ze } from "./contexts/DimensionPagesContext.js";
|
|
26
|
+
import { useLocalizationContext as de } from "./contexts/LocalizationContext.js";
|
|
27
|
+
import { useHighlightContext as yo } from "./contexts/HighlightContext.js";
|
|
28
|
+
import "./contexts/LicenseContext.js";
|
|
29
|
+
import { useDownloadContext as Io } from "./contexts/DownloadContext.js";
|
|
30
|
+
import { useSmoothScrollContext as fn } from "./contexts/SmoothScrollContext.js";
|
|
31
|
+
import "./contexts/ElementPageContext.js";
|
|
32
|
+
import { usePagesRotateContext as ot } from "./contexts/PagesRotateContext.js";
|
|
33
|
+
import { Queue as So } from "./utils/Queue.js";
|
|
34
|
+
import { renderPage as xo } from "./utils/renderPage.js";
|
|
35
|
+
import { useGlobalCurrentPage as Ro } from "./contexts/GlobalCurrentPage.js";
|
|
36
|
+
import { useLoaderContext as Pt } from "./contexts/LoaderContext.js";
|
|
37
|
+
import { useToolComponentContext as Ie } from "./contexts/ToolComponentContext.js";
|
|
38
|
+
import { useIconToolContext as me } from "./contexts/IconToolContext.js";
|
|
39
|
+
import { useOtherToolContext as Lo } from "./contexts/OtherToolContext.js";
|
|
40
|
+
import { useEventCallbackContext as Eo } from "./contexts/EventCallbackContext.js";
|
|
41
|
+
import "./components/RPConfig.js";
|
|
42
|
+
import { ThumbnailIcon as No } from "./components/icons/Thumbnail.js";
|
|
43
|
+
import { c as se } from "./clsx-0c6e471a.js";
|
|
44
|
+
import { LoaderIcon as mn } from "./components/icons/LoaderIcon.js";
|
|
45
|
+
import { Container as Oo } from "./components/layout/Container.js";
|
|
46
|
+
import { useViewportContext as Se, ViewportProvider as Do } from "./contexts/ViewportContext.js";
|
|
47
|
+
import { useToolbarComponentContext as Ce, ToolbarComponentProvider as zo } from "./contexts/ToolbarComponentContext.js";
|
|
48
|
+
import { RPSplitter as Ao } from "./components/layout/sidebar/RPSplitter.js";
|
|
49
|
+
import { WrapperLayout as Fo } from "./components/layout/WrapperLayout.js";
|
|
50
|
+
import { c as Pe, L as ko } from "./LayoutWrapper-6224491f.js";
|
|
51
|
+
import { useThemeContext as Wo } from "./contexts/ThemeContext.js";
|
|
52
|
+
import { RPDropFileZone as Mo } from "./components/RPDropFileZone.js";
|
|
53
|
+
import { c as ne, S as Mt } from "./SearchCloseButton-08d57275.js";
|
|
54
|
+
import { UICheckbox as Ht } from "./components/ui/Checkbox.js";
|
|
55
|
+
import { useIconContext as ge, IconProvider as Ho } from "./contexts/IconContext.js";
|
|
56
|
+
import K from "./components/ui/RPTooltip.js";
|
|
57
|
+
import { UIDropDown as yt } from "./components/ui/DropDown.js";
|
|
58
|
+
import { MenuItem as ye } from "./components/layout/toolbar/MenuItem.js";
|
|
59
|
+
import { MenuSeparator as It } from "./components/layout/toolbar/MenuSeparator.js";
|
|
60
|
+
import { dateFormatter as $t } from "./utils/dateFormatter.js";
|
|
61
|
+
import { PropertyItem as $o } from "./components/layout/toolbar/PropertyItem.js";
|
|
62
|
+
import "./RotateTool.module-67946714.js";
|
|
63
|
+
import { withRef as rt } from "./utils/withRef.js";
|
|
64
|
+
import { useInfiniteScroll as Go } from "./utils/hooks/useInfiniteScroll.js";
|
|
65
|
+
import { MAX_ZOOM_SCALE as Gt, THUMBNAIL_MIN_WIDTH as qo } from "./utils/constants.js";
|
|
66
|
+
import * as Uo from "pdfjs-dist";
|
|
67
|
+
import { PixelsPerInch as Vo, AnnotationMode as Bo, RenderingCancelledException as Zo, AnnotationLayer as jo } from "pdfjs-dist";
|
|
68
|
+
import { SimpleLinkService as Ko } from "./utils/link_service.js";
|
|
69
|
+
import { annotationsEvents as Xo, annotationEventsHandler as Qo, handleClick as qt, handleAnnotationWidget as Yo, handleAnnotationLink as Jo, bindLayerEvents as er, unbindLayerEvents as Ut } from "./utils/annotations.js";
|
|
70
|
+
import { normalizeSingleKeyword as tr, sortHighlightPosition as nr, unwrap as or } from "./components/page/searchHighlight.js";
|
|
71
|
+
import { CustomElement as rr } from "./components/page/CustomElement.js";
|
|
72
|
+
import { getGridDimension as St, getPositionFromPage as ir, getPageFromPosition as sr } from "./utils/calculatePage.js";
|
|
73
|
+
import { useMousePressed as ar } from "./utils/hooks/useMousePressed.js";
|
|
74
|
+
import { useGrabScroll as cr } from "./utils/hooks/useGrabScroll.js";
|
|
75
|
+
import { usePinch as lr } from "./utils/hooks/usePinch.js";
|
|
76
|
+
import { useDebounce as xt } from "./utils/hooks/useDebounce.js";
|
|
77
|
+
import dr from "./components/ui/PasswordModal.js";
|
|
78
|
+
import { getScrollDistance as ke } from "./utils/getScrollDistance.js";
|
|
79
|
+
import { getWordPositionInPage as ur } from "./utils/getWordPositionInPage.js";
|
|
80
|
+
import { getThumbnailViewport as pr } from "./utils/getThumbnailViewport.js";
|
|
81
|
+
import { smoothScrollTo as dt } from "./utils/smoothScrollTo.js";
|
|
82
|
+
import { appConsole as hr } from "./utils/appConsole.js";
|
|
83
|
+
import { FileUploadTool as gn } from "./components/layout/toolbar/FileUploadTool.js";
|
|
84
|
+
import { DarkModeTool as fr } from "./components/layout/toolbar/DarkModeTool.js";
|
|
85
|
+
import { ThreeDotIcon as mr } from "./components/icons/ThreeDotIcon.js";
|
|
86
|
+
import { c as gr, u as Rt, P as je, a as qe, b as Lt, k as vr, e as wr, i as _r } from "./index-c9a2990a.js";
|
|
87
|
+
import { D as br, d as ut } from "./floating-ui.react-dom-d22a10b4.js";
|
|
88
|
+
import { a as Tr, h as Cr, u as Pr, F as yr, b as Ir, G as Je } from "./index-3bf64864.js";
|
|
89
|
+
import { CloseIcon as Sr } from "./components/icons/CloseIcon.js";
|
|
90
|
+
import { DocumentProperties as xr } from "./components/layout/toolbar/DocumentProperties.js";
|
|
91
|
+
import { RotateTool as Rr } from "./components/layout/toolbar/RotateTool.js";
|
|
92
|
+
import { ViewModeTool as Lr } from "./components/layout/toolbar/ViewModeTool.js";
|
|
93
|
+
import { ScrollModeTool as Er } from "./components/layout/toolbar/ScrollModeTool.js";
|
|
94
|
+
import { FileDownloadDefaultIcon as Nr } from "./components/icons/FileDownloadDefaultIcon.js";
|
|
95
|
+
import { PrintDefaultTool as Or } from "./components/icons/PrintDefaultIcon.js";
|
|
96
|
+
import { FullScreenTool as vn } from "./components/layout/toolbar/FullScreenTool.js";
|
|
97
|
+
import { GoToDownIcon as wn } from "./components/icons/GoToDownIcon.js";
|
|
98
|
+
import { SelectionModeTool as Dr } from "./components/layout/toolbar/SelectionModeTool.js";
|
|
99
|
+
import { ZoomInIcon as zr } from "./components/icons/ZoomInIcon.js";
|
|
100
|
+
import { ZoomOutIcon as Ar } from "./components/icons/ZoomOutIcon.js";
|
|
101
|
+
import { isZoomOutDisabled as Fr, isZoomInDisabled as kr } from "./utils/zoom.js";
|
|
102
|
+
import { SearchIcon as _n } from "./components/icons/SearchIcon.js";
|
|
103
|
+
import { ClearIcon as Wr } from "./components/icons/ClearIcon.js";
|
|
104
|
+
import { InfoIcon as Vt } from "./components/icons/InfoIcon.js";
|
|
105
|
+
const bn = () => {
|
|
106
|
+
const { viewMode: t } = Me(), { scrollMode: e } = De(), { virtualScrollRef: n, virtualScrollableElementRef: r, pageScrollElementRef: o } = nt(), { setFocusedPage: s } = ue(), c = M(), { columnCount: d } = hn(), { widths: a, heights: m } = Ze(), g = M(e), C = M(t), u = M(d), { targetScrollPage: b } = fn();
|
|
107
|
+
z(() => {
|
|
108
|
+
n != null && n.scrollToItem && (c.current = n);
|
|
109
|
+
}, [n]), z(() => {
|
|
110
|
+
g.current = e, C.current = t;
|
|
111
|
+
}, [e, t]);
|
|
112
|
+
const T = N(
|
|
113
|
+
(w, y) => {
|
|
114
|
+
if (!o)
|
|
115
|
+
return;
|
|
116
|
+
const p = Math.ceil(w / 2) * 2 - 1;
|
|
117
|
+
if (w === p + 1) {
|
|
118
|
+
const h = {
|
|
119
|
+
left: a[p],
|
|
120
|
+
top: 0
|
|
121
|
+
};
|
|
122
|
+
return new Promise(
|
|
123
|
+
(l) => dt(o, h, l)
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
const f = {
|
|
127
|
+
left: 0,
|
|
128
|
+
top: 0
|
|
129
|
+
};
|
|
130
|
+
return o == null ? void 0 : o.scrollTo({
|
|
131
|
+
...f,
|
|
132
|
+
behavior: y
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
[o, a, dt]
|
|
136
|
+
);
|
|
137
|
+
return z(() => {
|
|
138
|
+
g.current = e, C.current = t;
|
|
139
|
+
}, [e, t]), z(() => {
|
|
140
|
+
u.current = d;
|
|
141
|
+
}, [d]), { scrollToPage: N(
|
|
142
|
+
(w, y = "smooth") => {
|
|
143
|
+
s(w);
|
|
144
|
+
const p = w - 1;
|
|
145
|
+
let f = p, h = 0;
|
|
146
|
+
if (C.current === Ne.DUAL_PAGE && g.current === oe.PAGE_SCROLLING) {
|
|
147
|
+
T(w, y);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (g.current === oe.PAGE_SCROLLING) {
|
|
151
|
+
s(w);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (!c.current || !r)
|
|
155
|
+
return;
|
|
156
|
+
const l = r;
|
|
157
|
+
y === "smooth" && (b.current = w);
|
|
158
|
+
const { columnsWidth: v, rowsHeight: _ } = St(
|
|
159
|
+
{ widths: a, heights: m },
|
|
160
|
+
d
|
|
161
|
+
);
|
|
162
|
+
if (g.current === oe.HORIZONTAL_SCROLLING) {
|
|
163
|
+
h = p;
|
|
164
|
+
const S = ke(v, h), L = {
|
|
165
|
+
left: Math.floor(S),
|
|
166
|
+
top: 0
|
|
167
|
+
};
|
|
168
|
+
return l.scrollTo({
|
|
169
|
+
...L,
|
|
170
|
+
behavior: y
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (C.current === Ne.DUAL_PAGE) {
|
|
174
|
+
h = p % 2, f = Math.floor(p / 2);
|
|
175
|
+
const L = ke(v, h), O = ke(_, f), D = {
|
|
176
|
+
left: Math.floor(L),
|
|
177
|
+
top: Math.floor(O)
|
|
178
|
+
};
|
|
179
|
+
return l.scrollTo({
|
|
180
|
+
...D,
|
|
181
|
+
behavior: y
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const I = ke(_, f), x = {
|
|
185
|
+
left: 0,
|
|
186
|
+
top: Math.floor(I)
|
|
187
|
+
};
|
|
188
|
+
return l.scrollTo({
|
|
189
|
+
...x,
|
|
190
|
+
behavior: y
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
[
|
|
194
|
+
r,
|
|
195
|
+
d,
|
|
196
|
+
T,
|
|
197
|
+
s,
|
|
198
|
+
dt,
|
|
199
|
+
m,
|
|
200
|
+
a
|
|
201
|
+
]
|
|
202
|
+
) };
|
|
203
|
+
}, Mr = (t = 1) => {
|
|
204
|
+
const [e, n] = $(t), [r, o] = $(0), { scrollToPage: s } = bn(), c = M(1), { viewMode: d } = Me(), { scrollMode: a } = De(), { widths: m } = Ze(), { pagesRef: g } = Te(), C = xt(e, 100), u = N(
|
|
205
|
+
(f) => {
|
|
206
|
+
if (!/^[0-9]*$/g.test(f.toString()) || !f)
|
|
207
|
+
return { success: !1, currentPage: c.current };
|
|
208
|
+
const l = +f;
|
|
209
|
+
return l < 0 || l > r ? { success: !1, currentPage: c.current } : (n(l), c.current = l, { success: !0, currentPage: +f });
|
|
210
|
+
},
|
|
211
|
+
[r]
|
|
212
|
+
), b = N(u, [u]), T = N(
|
|
213
|
+
(f) => {
|
|
214
|
+
const h = u(f);
|
|
215
|
+
return h.success && s(h.currentPage), h;
|
|
216
|
+
},
|
|
217
|
+
[u, s]
|
|
218
|
+
), P = N((f) => {
|
|
219
|
+
const h = f % 2 === 1;
|
|
220
|
+
if (!g || h)
|
|
221
|
+
return !1;
|
|
222
|
+
const l = h ? m[f] : m[f - 1], v = h ? m[f + 1] : m[f];
|
|
223
|
+
return d === Ne.DUAL_PAGE && l + v < g.clientWidth;
|
|
224
|
+
}, [d, m, g, r]), w = N(() => {
|
|
225
|
+
let f = e - 1;
|
|
226
|
+
P(f) && (f = e - 2), T(f);
|
|
227
|
+
}, [T, e, d, a, P]), y = k(() => d === Ne.DUAL_PAGE && a === oe.PAGE_SCROLLING ? e === r - 1 : e === r, [e, r, d, a]), p = N(() => {
|
|
228
|
+
if (y)
|
|
229
|
+
return;
|
|
230
|
+
let f = e + 1;
|
|
231
|
+
P(f) && (f = e + 2), T(f);
|
|
232
|
+
}, [T, e, P, d, a, y]);
|
|
233
|
+
return {
|
|
234
|
+
focusedPage: C,
|
|
235
|
+
totalPages: r,
|
|
236
|
+
setFocusedPage: b,
|
|
237
|
+
setTotalPages: o,
|
|
238
|
+
nextPage: p,
|
|
239
|
+
prevPage: w,
|
|
240
|
+
goToPage: T
|
|
241
|
+
};
|
|
242
|
+
}, Tn = Ve({
|
|
243
|
+
focusedPage: 0,
|
|
244
|
+
setFocusedPage: (t) => {
|
|
245
|
+
},
|
|
246
|
+
goToPage: (t) => ({ success: !!t, currentPage: +t }),
|
|
247
|
+
totalPages: 0,
|
|
248
|
+
setTotalPages: (t) => {
|
|
249
|
+
},
|
|
250
|
+
prevPage: () => {
|
|
251
|
+
},
|
|
252
|
+
nextPage: () => {
|
|
253
|
+
}
|
|
254
|
+
}), ue = () => {
|
|
255
|
+
const t = Be(Tn);
|
|
256
|
+
return typeof (t == null ? void 0 : t.focusedPage) > "u" && hr.error("Please use this hooks inside children component of RPProvider"), t;
|
|
257
|
+
}, pc = ({ children: t }) => {
|
|
258
|
+
const { pdf: e } = re(), { setCurrentPage: n } = Ro(), { focusedPage: r, totalPages: o, setFocusedPage: s, setTotalPages: c, goToPage: d, nextPage: a, prevPage: m } = Mr();
|
|
259
|
+
return z(() => {
|
|
260
|
+
e != null && e.numPages && (c(e.numPages), s(1));
|
|
261
|
+
}, [e, c, s]), z(() => {
|
|
262
|
+
n(r);
|
|
263
|
+
}, [r, n]), /* @__PURE__ */ i(
|
|
264
|
+
Tn.Provider,
|
|
265
|
+
{
|
|
266
|
+
value: {
|
|
267
|
+
focusedPage: r,
|
|
268
|
+
totalPages: o,
|
|
269
|
+
setFocusedPage: s,
|
|
270
|
+
setTotalPages: c,
|
|
271
|
+
nextPage: a,
|
|
272
|
+
prevPage: m,
|
|
273
|
+
goToPage: d
|
|
274
|
+
},
|
|
275
|
+
children: t
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}, Hr = () => {
|
|
279
|
+
const { pdf: t, pages: e } = re(), [n, r] = $({
|
|
280
|
+
loadedPages: 0,
|
|
281
|
+
totalPages: 0,
|
|
282
|
+
percentage: 0
|
|
283
|
+
}), [o, s] = $(!1), [c, d] = $(!1), [a, m] = $(null), [g, C] = $(void 0), u = M(!1);
|
|
284
|
+
z(() => {
|
|
285
|
+
u.current;
|
|
286
|
+
}, [u]);
|
|
287
|
+
const b = N(() => {
|
|
288
|
+
document.documentElement.classList.remove("rp-print-html-printing"), document.body.classList.remove("rp-print-body-printing");
|
|
289
|
+
const l = document.querySelector(".rp-print-zone");
|
|
290
|
+
l && l.remove();
|
|
291
|
+
}, []), T = N(() => {
|
|
292
|
+
u.current = !1, s(!1), d(!1), m(null), C(void 0), r({
|
|
293
|
+
loadedPages: 0,
|
|
294
|
+
totalPages: 0,
|
|
295
|
+
percentage: 0
|
|
296
|
+
});
|
|
297
|
+
}, []), P = () => {
|
|
298
|
+
u.current = !0;
|
|
299
|
+
}, w = async ({
|
|
300
|
+
scratchCanvas: l,
|
|
301
|
+
pdfDocument: v,
|
|
302
|
+
pageNumber: _,
|
|
303
|
+
viewerPdfPage: I,
|
|
304
|
+
printResolution: x,
|
|
305
|
+
optionalContentConfigPromise: S,
|
|
306
|
+
printAnnotationStoragePromise: L
|
|
307
|
+
}) => {
|
|
308
|
+
if (u.current) {
|
|
309
|
+
T();
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const O = x / Vo.PDF;
|
|
313
|
+
l.width = Math.floor(I.width * O), l.height = Math.floor(I.height * O);
|
|
314
|
+
const D = l.getContext("2d");
|
|
315
|
+
D.save(), D.fillStyle = "rgb(255, 255, 255)", D.fillRect(0, 0, l.width, l.height), D.restore();
|
|
316
|
+
const [F, E] = await Promise.all([
|
|
317
|
+
v.getPage(_),
|
|
318
|
+
L
|
|
319
|
+
]);
|
|
320
|
+
if (u.current) {
|
|
321
|
+
T();
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const R = {
|
|
325
|
+
canvasContext: D,
|
|
326
|
+
transform: [O, 0, 0, O, 0, 0],
|
|
327
|
+
viewport: F.getViewport({ scale: 1, rotation: I.rotation }),
|
|
328
|
+
intent: "print",
|
|
329
|
+
annotationMode: Bo.ENABLE_STORAGE,
|
|
330
|
+
optionalContentConfigPromise: S,
|
|
331
|
+
printAnnotationStorage: E
|
|
332
|
+
};
|
|
333
|
+
try {
|
|
334
|
+
return F.render(R).promise;
|
|
335
|
+
} catch (A) {
|
|
336
|
+
throw A instanceof Zo || console.error(A), A;
|
|
337
|
+
}
|
|
338
|
+
}, y = N(() => {
|
|
339
|
+
const l = window.print;
|
|
340
|
+
return new Promise((v) => {
|
|
341
|
+
const _ = (S) => {
|
|
342
|
+
setTimeout(() => {
|
|
343
|
+
l.call(window), setTimeout(() => S(), 20);
|
|
344
|
+
}, 0);
|
|
345
|
+
};
|
|
346
|
+
if (document.querySelector(".rp-print-zone")) {
|
|
347
|
+
_(v);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const x = new MutationObserver(() => {
|
|
351
|
+
document.querySelector(".rp-print-zone") && (_(v), x.disconnect());
|
|
352
|
+
});
|
|
353
|
+
x.observe(document.body, { childList: !0, subtree: !0 });
|
|
354
|
+
});
|
|
355
|
+
}, []), p = async (l) => {
|
|
356
|
+
const v = document.createElement("img"), _ = document.createElement("div");
|
|
357
|
+
return _.classList.add("rp-print-page"), await new Promise((I, x) => {
|
|
358
|
+
l.toBlob((S) => {
|
|
359
|
+
S ? (v.src = URL.createObjectURL(S), v.onload = () => {
|
|
360
|
+
URL.revokeObjectURL(v.src), I();
|
|
361
|
+
}, v.onerror = x) : x(new Error("Failed to create blob"));
|
|
362
|
+
});
|
|
363
|
+
}).catch(() => {
|
|
364
|
+
}), _.appendChild(v), _;
|
|
365
|
+
}, f = (l, v) => {
|
|
366
|
+
const _ = document.createElement("div");
|
|
367
|
+
_.classList.add("rp-print-zone");
|
|
368
|
+
const I = document.createElement("style"), x = v.get(1);
|
|
369
|
+
if (x) {
|
|
370
|
+
const { width: S, height: L } = x == null ? void 0 : x.page.getViewport({ scale: 1 });
|
|
371
|
+
I.innerHTML = `@page { size: ${S}px ${L}px }`;
|
|
372
|
+
}
|
|
373
|
+
return _.appendChild(I), _.append(...l), _;
|
|
374
|
+
}, h = N(
|
|
375
|
+
async (l) => {
|
|
376
|
+
if (!t)
|
|
377
|
+
return;
|
|
378
|
+
T();
|
|
379
|
+
const v = l && "visibleDefaultProgress" in l ? l : void 0;
|
|
380
|
+
(v == null ? void 0 : v.visibleDefaultProgress) !== void 0 ? C(v.visibleDefaultProgress) : C(!0);
|
|
381
|
+
const _ = document.createElement("canvas"), I = [];
|
|
382
|
+
try {
|
|
383
|
+
t.isPureXfa && console.warn("[rp] XFA Form is not supported at the moment.");
|
|
384
|
+
const S = t.getOptionalContentConfig({ intent: "print" }), L = Promise.resolve(
|
|
385
|
+
t.annotationStorage.print ?? void 0
|
|
386
|
+
), O = e.size;
|
|
387
|
+
for (const [F, E] of e) {
|
|
388
|
+
if (u.current) {
|
|
389
|
+
T();
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const R = E.page.getViewport({ scale: 1 });
|
|
393
|
+
if (await w({
|
|
394
|
+
scratchCanvas: _,
|
|
395
|
+
pdfDocument: t,
|
|
396
|
+
pageNumber: F,
|
|
397
|
+
viewerPdfPage: R,
|
|
398
|
+
printResolution: 150,
|
|
399
|
+
optionalContentConfigPromise: S,
|
|
400
|
+
printAnnotationStoragePromise: L
|
|
401
|
+
}), u.current) {
|
|
402
|
+
T();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const A = await p(_);
|
|
406
|
+
I.push(A);
|
|
407
|
+
const G = parseFloat((I.length / O * 100).toFixed(2));
|
|
408
|
+
r({
|
|
409
|
+
loadedPages: F,
|
|
410
|
+
totalPages: O,
|
|
411
|
+
percentage: G
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (u.current) {
|
|
415
|
+
T();
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const D = f(I, e);
|
|
419
|
+
document.body.appendChild(D), document.documentElement.classList.add("rp-print-html-printing"), document.body.classList.add("rp-print-body-printing"), s(!0), await y();
|
|
420
|
+
} catch (x) {
|
|
421
|
+
d(!0), x instanceof Error && m(x);
|
|
422
|
+
} finally {
|
|
423
|
+
_.height = 0, _.width = 0;
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
[t, e, u, T, f, y]
|
|
427
|
+
);
|
|
428
|
+
return z(() => {
|
|
429
|
+
const l = () => {
|
|
430
|
+
T(), b();
|
|
431
|
+
};
|
|
432
|
+
return window.addEventListener("afterprint", l, !0), () => {
|
|
433
|
+
window.removeEventListener("afterprint", l, !0);
|
|
434
|
+
};
|
|
435
|
+
}, [b, T]), {
|
|
436
|
+
print: h,
|
|
437
|
+
cancel: P,
|
|
438
|
+
progress: n,
|
|
439
|
+
isComplete: o,
|
|
440
|
+
isError: c,
|
|
441
|
+
error: a,
|
|
442
|
+
showDefaultProgress: g
|
|
443
|
+
};
|
|
444
|
+
}, Cn = Ve({
|
|
445
|
+
print: async () => {
|
|
446
|
+
},
|
|
447
|
+
cancel: () => {
|
|
448
|
+
},
|
|
449
|
+
setOnProgress: (t) => {
|
|
450
|
+
},
|
|
451
|
+
progress: {},
|
|
452
|
+
setOnComplete: (t) => t(),
|
|
453
|
+
setOnError: (t) => {
|
|
454
|
+
try {
|
|
455
|
+
const e = new Error("Print error occurred");
|
|
456
|
+
t(e);
|
|
457
|
+
} catch (e) {
|
|
458
|
+
console.error("Error in setOnError callback:", e);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}), hc = ({ children: t }) => {
|
|
462
|
+
const [e, n] = $(null), [r, o] = $(null), { print: s, cancel: c, progress: d, isComplete: a, isError: m, error: g, showDefaultProgress: C } = Hr(), u = N((y) => {
|
|
463
|
+
y && typeof y == "function" && o(() => y);
|
|
464
|
+
}, []), b = (y) => {
|
|
465
|
+
g && y(g);
|
|
466
|
+
}, T = N(
|
|
467
|
+
(y) => {
|
|
468
|
+
n(() => y);
|
|
469
|
+
},
|
|
470
|
+
[d, e]
|
|
471
|
+
);
|
|
472
|
+
z(() => {
|
|
473
|
+
a && r && P();
|
|
474
|
+
}, [a, r]), z(() => {
|
|
475
|
+
m && b((y) => {
|
|
476
|
+
console.error(y);
|
|
477
|
+
});
|
|
478
|
+
}, [m]), z(() => {
|
|
479
|
+
d && e && e(d);
|
|
480
|
+
}, [d, e]);
|
|
481
|
+
const P = () => {
|
|
482
|
+
r && (r(), o(null));
|
|
483
|
+
}, w = {
|
|
484
|
+
print: s,
|
|
485
|
+
cancel: c,
|
|
486
|
+
setOnProgress: T,
|
|
487
|
+
setOnComplete: u,
|
|
488
|
+
setOnError: b,
|
|
489
|
+
progress: d,
|
|
490
|
+
showDefaultProgress: C
|
|
491
|
+
};
|
|
492
|
+
return /* @__PURE__ */ i(Cn.Provider, { value: w, children: t });
|
|
493
|
+
}, it = () => {
|
|
494
|
+
const t = Be(Cn);
|
|
495
|
+
if (!t)
|
|
496
|
+
throw new Error("usePrintContext must be used within a PrintProvider");
|
|
497
|
+
return t;
|
|
498
|
+
}, $r = () => {
|
|
499
|
+
const [t, e] = $({}), { pages: n } = re(), r = k(() => Object.keys(t).length, [t]), o = N(
|
|
500
|
+
(c) => {
|
|
501
|
+
if (!n.size)
|
|
502
|
+
return;
|
|
503
|
+
const d = c > n.size ? n.size : c, m = Array.from(n.values()).slice(0, d).map((g) => {
|
|
504
|
+
const { thumbnailViewport: C, scale: u } = pr(g.page, g.defaultRotation);
|
|
505
|
+
return {
|
|
506
|
+
scale: u,
|
|
507
|
+
page: g.page,
|
|
508
|
+
loading: !0,
|
|
509
|
+
viewport: C,
|
|
510
|
+
defaultRotation: g.defaultRotation
|
|
511
|
+
};
|
|
512
|
+
}).reduce((g, C) => (g[C.page.pageNumber] = C, g), {});
|
|
513
|
+
e(m);
|
|
514
|
+
},
|
|
515
|
+
[n]
|
|
516
|
+
);
|
|
517
|
+
z(() => {
|
|
518
|
+
o(10);
|
|
519
|
+
}, [o]);
|
|
520
|
+
const s = N(
|
|
521
|
+
(c) => {
|
|
522
|
+
if (!n)
|
|
523
|
+
return;
|
|
524
|
+
const d = n.get(c);
|
|
525
|
+
d && e((a) => ({
|
|
526
|
+
...a,
|
|
527
|
+
[c]: {
|
|
528
|
+
loading: !0,
|
|
529
|
+
page: d.page,
|
|
530
|
+
viewport: d.thumbnailViewport,
|
|
531
|
+
scale: d.thumbnailScale,
|
|
532
|
+
defaultRotation: d.defaultRotation
|
|
533
|
+
}
|
|
534
|
+
}));
|
|
535
|
+
},
|
|
536
|
+
[n]
|
|
537
|
+
);
|
|
538
|
+
return { thumbnailPages: t, addPage: s, addToPage: o, thumbnailLength: r };
|
|
539
|
+
}, Pn = Ve({
|
|
540
|
+
thumbnailPages: {},
|
|
541
|
+
addPage: (t) => {
|
|
542
|
+
},
|
|
543
|
+
addToPage: (t) => {
|
|
544
|
+
},
|
|
545
|
+
thumbnailLength: 0,
|
|
546
|
+
setActive: (t) => {
|
|
547
|
+
},
|
|
548
|
+
active: !1
|
|
549
|
+
}), yn = () => Be(Pn), fc = ({
|
|
550
|
+
children: t,
|
|
551
|
+
initialThumbnailsVisible: e
|
|
552
|
+
}) => {
|
|
553
|
+
const { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: s } = $r(), [c, d] = $(e);
|
|
554
|
+
return /* @__PURE__ */ i(
|
|
555
|
+
Pn.Provider,
|
|
556
|
+
{
|
|
557
|
+
value: { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: s, active: c, setActive: d },
|
|
558
|
+
children: t
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
}, Gr = (t = {}, e = "") => {
|
|
562
|
+
const [n, r] = $(e), [o, s] = $(!1), { pdf: c, pages: d } = re(), { widths: a, heights: m } = Ze(), g = M(!n), { currentZoom: C } = tt(), [u, b] = $([]), { setFocusedPage: T } = ue(), { columnCount: P } = Me(), { pageRotate: w } = ot(), [y, p] = $(0), { pageScrollElementRef: f, virtualScrollableElementRef: h } = nt(), { scrollMode: l } = De(), { pagesRef: v } = Te(), _ = M({}), I = M(0), x = k(() => y === 0 ? null : u[y - 1], [y, u]), S = k(() => u.length, [u]), L = N(
|
|
563
|
+
(E) => {
|
|
564
|
+
if (E === 0)
|
|
565
|
+
return;
|
|
566
|
+
const R = u[E - 1];
|
|
567
|
+
if (!R || !d)
|
|
568
|
+
return;
|
|
569
|
+
const A = h || f;
|
|
570
|
+
if (!A || !v)
|
|
571
|
+
return;
|
|
572
|
+
const G = d.get(R.page);
|
|
573
|
+
if (l === oe.PAGE_SCROLLING && T(R.page), !G)
|
|
574
|
+
return;
|
|
575
|
+
let H = 0, U = 0;
|
|
576
|
+
if (l === oe.VERTICAL_SCROLLING) {
|
|
577
|
+
const J = R.page - 1, ee = P, ve = J % ee, we = Math.floor(J / ee);
|
|
578
|
+
H = ke(m, we), U = ke(a, ve);
|
|
579
|
+
}
|
|
580
|
+
l === oe.HORIZONTAL_SCROLLING && (U = a.slice(0, R.page - 1).reduce((J, ee) => J + ee, 0));
|
|
581
|
+
const X = {
|
|
582
|
+
height: m[R.page - 1],
|
|
583
|
+
width: a[R.page - 1]
|
|
584
|
+
}, V = w[R.page], { leftInPage: ie, topInPage: q } = ur(
|
|
585
|
+
X,
|
|
586
|
+
v,
|
|
587
|
+
R.rect,
|
|
588
|
+
C,
|
|
589
|
+
V
|
|
590
|
+
), Z = U + ie, Y = H + q, te = {
|
|
591
|
+
left: Math.max(Z, 0),
|
|
592
|
+
top: Math.max(Y, 0)
|
|
593
|
+
};
|
|
594
|
+
A.scrollTo({
|
|
595
|
+
...te,
|
|
596
|
+
behavior: "smooth"
|
|
597
|
+
});
|
|
598
|
+
},
|
|
599
|
+
[
|
|
600
|
+
d,
|
|
601
|
+
T,
|
|
602
|
+
a,
|
|
603
|
+
m,
|
|
604
|
+
l,
|
|
605
|
+
h,
|
|
606
|
+
f,
|
|
607
|
+
v,
|
|
608
|
+
u
|
|
609
|
+
]
|
|
610
|
+
);
|
|
611
|
+
z(() => {
|
|
612
|
+
y && L(y);
|
|
613
|
+
}, [y]);
|
|
614
|
+
const O = N(() => {
|
|
615
|
+
p((E) => {
|
|
616
|
+
let R;
|
|
617
|
+
return S ? E + 1 > S ? R = 1 : R = E + 1 : R = 0, I.current = R, R;
|
|
618
|
+
}), I.current === 1 && L(I.current);
|
|
619
|
+
}, [S, L]), D = N(() => {
|
|
620
|
+
p((E) => {
|
|
621
|
+
let R;
|
|
622
|
+
return S ? E - 1 <= 0 ? R = S : R = E - 1 : R = 0, I.current = R, R;
|
|
623
|
+
}), I.current === 1 && L(I.current);
|
|
624
|
+
}, [S, L]), F = N(async (E) => {
|
|
625
|
+
if (!E)
|
|
626
|
+
return {};
|
|
627
|
+
const R = E.numPages, A = {};
|
|
628
|
+
for (let G = 1; G <= R; G++) {
|
|
629
|
+
if (g.current)
|
|
630
|
+
throw "close pop over";
|
|
631
|
+
const H = await E.getPage(G);
|
|
632
|
+
A[G.toString()] = await H.getTextContent();
|
|
633
|
+
}
|
|
634
|
+
return A;
|
|
635
|
+
}, []);
|
|
636
|
+
return z(() => {
|
|
637
|
+
if (!n) {
|
|
638
|
+
g.current = !0, b([]), p(0);
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
g.current = !1, s(!0), b([]), p(0), F(c).then((E) => {
|
|
642
|
+
_.current = E;
|
|
643
|
+
const A = Object.keys(E).reduce((G, H) => {
|
|
644
|
+
const U = bo(
|
|
645
|
+
[n],
|
|
646
|
+
E[H],
|
|
647
|
+
Number(H) - 1,
|
|
648
|
+
t
|
|
649
|
+
).map((X, V) => ({ ...X, page: Number(H), pageMatchIdx: V }));
|
|
650
|
+
return [...G, ...U];
|
|
651
|
+
}, []);
|
|
652
|
+
b(A), p(A.length ? 1 : 0);
|
|
653
|
+
}).catch(() => {
|
|
654
|
+
b([]), p(0);
|
|
655
|
+
}).finally(() => s(!1));
|
|
656
|
+
}, [n, F, c, t]), {
|
|
657
|
+
search: n,
|
|
658
|
+
setSearch: r,
|
|
659
|
+
loading: o,
|
|
660
|
+
matches: u,
|
|
661
|
+
totalMatches: S,
|
|
662
|
+
currentMatchPosition: y,
|
|
663
|
+
currentMatch: x,
|
|
664
|
+
nextMatch: O,
|
|
665
|
+
prevMatch: D,
|
|
666
|
+
setCurrentMatchPosition: p
|
|
667
|
+
};
|
|
668
|
+
}, In = Ve({
|
|
669
|
+
search: "",
|
|
670
|
+
setSearch: (t) => {
|
|
671
|
+
},
|
|
672
|
+
loading: !1,
|
|
673
|
+
matches: [],
|
|
674
|
+
totalMatches: 0,
|
|
675
|
+
currentMatchPosition: 0,
|
|
676
|
+
currentMatch: null,
|
|
677
|
+
nextMatch: () => {
|
|
678
|
+
},
|
|
679
|
+
prevMatch: () => {
|
|
680
|
+
},
|
|
681
|
+
searchOptions: {},
|
|
682
|
+
setSearchOptions: (t) => t,
|
|
683
|
+
setCurrentMatchPosition: (t) => t
|
|
684
|
+
}), mc = ({
|
|
685
|
+
children: t,
|
|
686
|
+
initialSearch: e
|
|
687
|
+
}) => {
|
|
688
|
+
const [n, r] = $({}), {
|
|
689
|
+
loading: o,
|
|
690
|
+
setSearch: s,
|
|
691
|
+
totalMatches: c,
|
|
692
|
+
currentMatchPosition: d,
|
|
693
|
+
currentMatch: a,
|
|
694
|
+
search: m,
|
|
695
|
+
matches: g,
|
|
696
|
+
nextMatch: C,
|
|
697
|
+
prevMatch: u,
|
|
698
|
+
setCurrentMatchPosition: b
|
|
699
|
+
} = Gr(n, e);
|
|
700
|
+
return /* @__PURE__ */ i(
|
|
701
|
+
In.Provider,
|
|
702
|
+
{
|
|
703
|
+
value: {
|
|
704
|
+
searchOptions: n,
|
|
705
|
+
setSearchOptions: r,
|
|
706
|
+
loading: o,
|
|
707
|
+
setSearch: s,
|
|
708
|
+
totalMatches: c,
|
|
709
|
+
currentMatchPosition: d,
|
|
710
|
+
currentMatch: a,
|
|
711
|
+
nextMatch: C,
|
|
712
|
+
prevMatch: u,
|
|
713
|
+
search: m,
|
|
714
|
+
matches: g,
|
|
715
|
+
setCurrentMatchPosition: b
|
|
716
|
+
},
|
|
717
|
+
children: t
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
}, Et = () => Be(In), Sn = Ve(null), gc = ({ children: t }) => {
|
|
721
|
+
const e = M(!1), [n, r] = $([]), o = N((a) => {
|
|
722
|
+
r((m) => [...m, { id: a.page.pageNumber.toString(), data: a, priority: 0 }]);
|
|
723
|
+
}, []), s = k(() => new So(o), [o]), { focusedPage: c } = ue(), d = N((a) => (e.current = !0, xo(
|
|
724
|
+
a.data.page,
|
|
725
|
+
a.data.canvasElem,
|
|
726
|
+
a.data.options
|
|
727
|
+
).promise.then(() => {
|
|
728
|
+
a.data.canvasElem.hidden = !1;
|
|
729
|
+
}).finally(() => {
|
|
730
|
+
a.data.onLoaded && a.data.onLoaded();
|
|
731
|
+
})), []);
|
|
732
|
+
return z(() => {
|
|
733
|
+
c && (s.changePagePriority(`^page-${c}`, 0), s.changePagePriority(`^thumbnail-${c}`, 1));
|
|
734
|
+
}, [c]), z(() => {
|
|
735
|
+
if (s.isEmpty() || e.current)
|
|
736
|
+
return;
|
|
737
|
+
const a = () => {
|
|
738
|
+
const m = s.dequeue();
|
|
739
|
+
m ? d(m).finally(() => {
|
|
740
|
+
a();
|
|
741
|
+
}) : (e.current = !1, r(s.peekAll()));
|
|
742
|
+
};
|
|
743
|
+
a();
|
|
744
|
+
}, [s, d, n]), /* @__PURE__ */ i(Sn.Provider, { value: s, children: t });
|
|
745
|
+
}, xn = () => {
|
|
746
|
+
const t = Be(Sn);
|
|
747
|
+
if (!t)
|
|
748
|
+
throw new Error("RenderQueue not found");
|
|
749
|
+
return t;
|
|
750
|
+
}, ae = {
|
|
751
|
+
"rp-pages": "_rp-pages_u7m2r_1",
|
|
752
|
+
"rp-page-scrolling-wrapper": "_rp-page-scrolling-wrapper_u7m2r_6",
|
|
753
|
+
"rp-pages-horizontal-scroll": "_rp-pages-horizontal-scroll_u7m2r_11",
|
|
754
|
+
"rp-pages-container": "_rp-pages-container_u7m2r_15",
|
|
755
|
+
"rp-viewer": "_rp-viewer_u7m2r_57",
|
|
756
|
+
"rp-cursor-grab": "_rp-cursor-grab_u7m2r_62",
|
|
757
|
+
"rp-cursor-grabbing": "_rp-cursor-grabbing_u7m2r_70",
|
|
758
|
+
"rp-loader": "_rp-loader_u7m2r_78",
|
|
759
|
+
"rp-not-supported": "_rp-not-supported_u7m2r_86",
|
|
760
|
+
"rp-not-supported-content": "_rp-not-supported-content_u7m2r_102"
|
|
761
|
+
}, pt = {
|
|
762
|
+
"rp-page-wrapper": "_rp-page-wrapper_ii91u_1",
|
|
763
|
+
"rp-page": "_rp-page_ii91u_1",
|
|
764
|
+
"rp-loader-wrapper": "_rp-loader-wrapper_ii91u_15"
|
|
765
|
+
}, qr = (t) => {
|
|
766
|
+
const { pageNumber: e, onLoaded: n, onLoading: r } = t, o = M(null), { pages: s } = re(), { pageRotate: c } = ot(), d = M(), { currentZoom: a } = tt(), m = xn(), g = M(`page-${e}`);
|
|
767
|
+
return z(() => {
|
|
768
|
+
if (!s || a === 0)
|
|
769
|
+
return;
|
|
770
|
+
const C = s.get(e);
|
|
771
|
+
if (o.current && C) {
|
|
772
|
+
const u = o.current;
|
|
773
|
+
u.hidden = !0;
|
|
774
|
+
const b = d.current;
|
|
775
|
+
b && b.cancel(), r && r(), m.enqueue(
|
|
776
|
+
g.current,
|
|
777
|
+
{
|
|
778
|
+
page: C.page,
|
|
779
|
+
canvasElem: u,
|
|
780
|
+
options: {
|
|
781
|
+
scale: a,
|
|
782
|
+
rotate: c[e],
|
|
783
|
+
renderForms: !0
|
|
784
|
+
},
|
|
785
|
+
onLoaded: n
|
|
786
|
+
},
|
|
787
|
+
3
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
return () => {
|
|
791
|
+
m.removeQueue(g.current);
|
|
792
|
+
};
|
|
793
|
+
}, [s, e, c, a, r, n, m]), /* @__PURE__ */ i("canvas", { "data-rp": `page-${e}-canvas`, ref: o });
|
|
794
|
+
}, Ur = "_selecting_ppr5g_10", Vr = "_markedContent_ppr5g_33", _e = {
|
|
795
|
+
"rp-text-layer": "_rp-text-layer_ppr5g_1",
|
|
796
|
+
selecting: Ur,
|
|
797
|
+
markedContent: Vr,
|
|
798
|
+
"rp-text-layer-text": "_rp-text-layer-text_ppr5g_52"
|
|
799
|
+
}, Br = (t) => {
|
|
800
|
+
const { pageNumber: e } = t, { pages: n } = re(), r = M(null), { matches: o, currentMatch: s } = Et(), [c, d] = $(
|
|
801
|
+
[]
|
|
802
|
+
), a = M(), m = M(), g = M([]), C = k(() => o.filter((p) => p.pageIndex === e - 1), [o, e]), u = N(
|
|
803
|
+
(p, f, h = !1) => {
|
|
804
|
+
if (h && To(p, f), !C.length) {
|
|
805
|
+
g.current = [], d([]);
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
const l = Co(C, p, f);
|
|
809
|
+
d(l);
|
|
810
|
+
},
|
|
811
|
+
[C]
|
|
812
|
+
), b = M(), T = M(!1), P = N(() => Array.from(document.querySelectorAll('[data-rp$="-textLayer"]')), []);
|
|
813
|
+
z(() => ((() => {
|
|
814
|
+
if (b.current)
|
|
815
|
+
return;
|
|
816
|
+
b.current = new AbortController();
|
|
817
|
+
const { signal: f } = b.current, h = () => {
|
|
818
|
+
P().forEach((v) => {
|
|
819
|
+
const _ = v.querySelector(".endOfContent");
|
|
820
|
+
_ && (v.appendChild(_), _.style.width = "", _.style.height = "", v.classList.remove(_e.selecting));
|
|
821
|
+
});
|
|
822
|
+
};
|
|
823
|
+
document.addEventListener(
|
|
824
|
+
"pointerdown",
|
|
825
|
+
() => {
|
|
826
|
+
T.current = !0;
|
|
827
|
+
},
|
|
828
|
+
{ signal: f }
|
|
829
|
+
), document.addEventListener(
|
|
830
|
+
"pointerup",
|
|
831
|
+
() => {
|
|
832
|
+
T.current = !1, h();
|
|
833
|
+
},
|
|
834
|
+
{ signal: f }
|
|
835
|
+
), window.addEventListener(
|
|
836
|
+
"blur",
|
|
837
|
+
() => {
|
|
838
|
+
T.current = !1, h();
|
|
839
|
+
},
|
|
840
|
+
{ signal: f }
|
|
841
|
+
), document.addEventListener(
|
|
842
|
+
"keyup",
|
|
843
|
+
() => {
|
|
844
|
+
T.current || h();
|
|
845
|
+
},
|
|
846
|
+
{ signal: f }
|
|
847
|
+
);
|
|
848
|
+
let l = null;
|
|
849
|
+
document.addEventListener(
|
|
850
|
+
"selectionchange",
|
|
851
|
+
() => {
|
|
852
|
+
var D, F;
|
|
853
|
+
const v = document.getSelection();
|
|
854
|
+
if (!v)
|
|
855
|
+
return;
|
|
856
|
+
if (v.rangeCount === 0) {
|
|
857
|
+
h();
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
const _ = /* @__PURE__ */ new Set();
|
|
861
|
+
for (let E = 0; E < v.rangeCount; E++) {
|
|
862
|
+
const R = v.getRangeAt(E);
|
|
863
|
+
P().forEach((A) => {
|
|
864
|
+
R.intersectsNode(A) && !_.has(A) && _.add(A);
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
P().forEach((E) => {
|
|
868
|
+
if (_.has(E))
|
|
869
|
+
E.classList.add(_e.selecting);
|
|
870
|
+
else {
|
|
871
|
+
const R = E.querySelector(".endOfContent");
|
|
872
|
+
R && (E.appendChild(R), R.style.width = "", R.style.height = "", E.classList.remove(_e.selecting));
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
const I = v.getRangeAt(0);
|
|
876
|
+
let S = l && (I.compareBoundaryPoints(Range.END_TO_END, l) === 0 || I.compareBoundaryPoints(Range.START_TO_END, l) === 0) ? I.startContainer : I.endContainer;
|
|
877
|
+
S.nodeType === Node.TEXT_NODE && (S = S.parentNode);
|
|
878
|
+
const L = (D = S.parentElement) == null ? void 0 : D.closest(
|
|
879
|
+
_e["rp-text-layer"]
|
|
880
|
+
), O = L == null ? void 0 : L.querySelector(".endOfContent");
|
|
881
|
+
O && L && (O.style.width = L.style.width, O.style.height = L.style.height, (F = S.parentElement) == null || F.insertBefore(O, S.nextSibling)), l = I.cloneRange();
|
|
882
|
+
},
|
|
883
|
+
{ signal: f }
|
|
884
|
+
);
|
|
885
|
+
})(), () => {
|
|
886
|
+
var f;
|
|
887
|
+
(f = b.current) == null || f.abort(), b.current = void 0;
|
|
888
|
+
}), [P]);
|
|
889
|
+
const w = N(() => {
|
|
890
|
+
r.current && r.current.classList.add(_e.selecting);
|
|
891
|
+
}, []), y = N(() => {
|
|
892
|
+
r.current && r.current.classList.remove(_e.selecting);
|
|
893
|
+
}, []);
|
|
894
|
+
return z(() => {
|
|
895
|
+
if (g.current.forEach((h) => {
|
|
896
|
+
h.classList.remove("selected");
|
|
897
|
+
}), !c.length || !s || s.pageIndex !== e - 1)
|
|
898
|
+
return;
|
|
899
|
+
const p = C.findIndex(
|
|
900
|
+
(h) => JSON.stringify(h) === JSON.stringify(s)
|
|
901
|
+
);
|
|
902
|
+
if (p === -1)
|
|
903
|
+
return;
|
|
904
|
+
const f = c.filter((h) => h.index === p);
|
|
905
|
+
f.length && (g.current = f.map((h) => h.element), f.forEach((h) => {
|
|
906
|
+
h.element.classList.add("selected");
|
|
907
|
+
}));
|
|
908
|
+
}, [s, c, C]), z(() => {
|
|
909
|
+
const p = n.get(e);
|
|
910
|
+
if (!p || !r.current)
|
|
911
|
+
return;
|
|
912
|
+
const f = r.current;
|
|
913
|
+
return a.current && a.current.cancel(), p.page.getTextContent().then((h) => {
|
|
914
|
+
const l = p.page.getViewport({ scale: 1 });
|
|
915
|
+
return a.current = new Uo.TextLayer({
|
|
916
|
+
viewport: l,
|
|
917
|
+
textContentSource: h,
|
|
918
|
+
container: f
|
|
919
|
+
}), m.current = h, f && (f.innerText = ""), a.current.render();
|
|
920
|
+
}).then(() => {
|
|
921
|
+
var _, I;
|
|
922
|
+
[].slice.call(f.children).forEach((x) => {
|
|
923
|
+
x.classList.add(_e["rp-text-layer-text"]), x.setAttribute("data-rp", "rp-text-layer-text");
|
|
924
|
+
});
|
|
925
|
+
const l = (_ = a.current) == null ? void 0 : _.textDivs;
|
|
926
|
+
l && m.current && u(m.current, l);
|
|
927
|
+
const v = document.createElement("div");
|
|
928
|
+
v.className = "endOfContent", (I = r.current) == null || I.appendChild(v);
|
|
929
|
+
}).catch(() => {
|
|
930
|
+
}), () => {
|
|
931
|
+
var h;
|
|
932
|
+
(h = a.current) == null || h.cancel();
|
|
933
|
+
};
|
|
934
|
+
}, [n, e]), z(() => {
|
|
935
|
+
var h;
|
|
936
|
+
[].slice.call(r.current.children).forEach((l) => {
|
|
937
|
+
l.classList.add(_e["rp-text-layer-text"]);
|
|
938
|
+
});
|
|
939
|
+
const f = (h = a.current) == null ? void 0 : h.textDivs;
|
|
940
|
+
f && m.current && u(m.current, f, !0);
|
|
941
|
+
}, [u]), /* @__PURE__ */ i(
|
|
942
|
+
"div",
|
|
943
|
+
{
|
|
944
|
+
"data-rp-text-layer": !0,
|
|
945
|
+
"data-rp": `page-${e}-textLayer`,
|
|
946
|
+
className: _e["rp-text-layer"],
|
|
947
|
+
ref: r,
|
|
948
|
+
onMouseDown: w,
|
|
949
|
+
onMouseUp: y
|
|
950
|
+
}
|
|
951
|
+
);
|
|
952
|
+
}, Zr = {
|
|
953
|
+
"rp-annotation-layer": "_rp-annotation-layer_1udza_1"
|
|
954
|
+
};
|
|
955
|
+
let jr = "https://unpkg.com/pdfjs-dist@4.4.168/web/images/";
|
|
956
|
+
const Kr = (t) => {
|
|
957
|
+
const { pageNumber: e } = t, n = M(null), { pages: r, pdf: o } = re(), s = M(), [c, d] = $(), { setFocusedPage: a, goToPage: m } = ue(), { scrollMode: g } = De(), { print: C } = it(), { download: u } = Bn(), b = k(() => r.get(e), [r, e]), T = k(() => b == null ? void 0 : b.page.getViewport(), [b]);
|
|
958
|
+
z(() => {
|
|
959
|
+
s.current && (s.current.div.replaceChildren(), s.current = void 0);
|
|
960
|
+
}, [o]), z(() => {
|
|
961
|
+
b && b.page.getAnnotations().then((w) => {
|
|
962
|
+
s.current = void 0, d(w), n.current && (n.current.innerText = "");
|
|
963
|
+
});
|
|
964
|
+
}, [b]);
|
|
965
|
+
const P = N(
|
|
966
|
+
(w) => {
|
|
967
|
+
!c || !o || (Xo(w), Qo(w, o, c).then((y) => {
|
|
968
|
+
var p, f;
|
|
969
|
+
((p = y == null ? void 0 : y.data) == null ? void 0 : p.action) === "Print" ? C() : ((f = y == null ? void 0 : y.data) == null ? void 0 : f.action) === "SaveAs" && u();
|
|
970
|
+
}), g === oe.PAGE_SCROLLING ? qt(w, c, o, (y) => a(y.pageIndex + 1)) : qt(w, c, o, (y) => m(y.pageIndex + 1)));
|
|
971
|
+
},
|
|
972
|
+
[o, c, m, a, g, C, u]
|
|
973
|
+
);
|
|
974
|
+
return z(() => {
|
|
975
|
+
if (!b || !c)
|
|
976
|
+
return;
|
|
977
|
+
const w = b.page.getViewport();
|
|
978
|
+
if (s.current) {
|
|
979
|
+
s.current.update({
|
|
980
|
+
viewport: w.clone({ dontFlip: !0 })
|
|
981
|
+
});
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
const y = /* @__PURE__ */ new Map([]);
|
|
985
|
+
for (const h of c) {
|
|
986
|
+
const { annotationType: l } = h;
|
|
987
|
+
switch (l) {
|
|
988
|
+
case Wt.Link:
|
|
989
|
+
Jo(h);
|
|
990
|
+
break;
|
|
991
|
+
case Wt.Widget:
|
|
992
|
+
Yo(h, w, y);
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
const p = new AbortController();
|
|
997
|
+
return (async () => {
|
|
998
|
+
var v;
|
|
999
|
+
s.current && (s.current.div.replaceChildren(), s.current = void 0), n.current && (n.current.innerText = ""), s.current = new jo({
|
|
1000
|
+
div: n.current,
|
|
1001
|
+
accessibilityManager: void 0,
|
|
1002
|
+
annotationCanvasMap: void 0,
|
|
1003
|
+
annotationEditorUIManager: void 0,
|
|
1004
|
+
structTreeLayer: null,
|
|
1005
|
+
page: b.page,
|
|
1006
|
+
viewport: w.clone({ dontFlip: !0 })
|
|
1007
|
+
}), n.current && Ut(n.current, P);
|
|
1008
|
+
const h = await (o == null ? void 0 : o.hasJSActions()), l = await (o == null ? void 0 : o.getFieldObjects());
|
|
1009
|
+
if (p.signal.aborted)
|
|
1010
|
+
throw "abort";
|
|
1011
|
+
return (v = s.current) == null ? void 0 : v.render({
|
|
1012
|
+
annotations: c,
|
|
1013
|
+
annotationStorage: o == null ? void 0 : o.annotationStorage,
|
|
1014
|
+
hasJSActions: h,
|
|
1015
|
+
fieldObjects: l,
|
|
1016
|
+
div: n.current,
|
|
1017
|
+
viewport: w.clone({ dontFlip: !0 }),
|
|
1018
|
+
page: b.page,
|
|
1019
|
+
imageResourcesPath: jr,
|
|
1020
|
+
renderForms: !0,
|
|
1021
|
+
linkService: new Ko(),
|
|
1022
|
+
downloadManager: null,
|
|
1023
|
+
enableScripting: !1
|
|
1024
|
+
});
|
|
1025
|
+
})().then(() => {
|
|
1026
|
+
n.current && er(n.current, P);
|
|
1027
|
+
}).catch((h) => {
|
|
1028
|
+
if (h !== "abort")
|
|
1029
|
+
throw h;
|
|
1030
|
+
}), () => {
|
|
1031
|
+
p.abort("clear"), n.current && Ut(n.current, P);
|
|
1032
|
+
};
|
|
1033
|
+
}, [o, c, P]), /* @__PURE__ */ i(
|
|
1034
|
+
"div",
|
|
1035
|
+
{
|
|
1036
|
+
"data-rp": `page-${e}-annotationLayer`,
|
|
1037
|
+
style: { width: `${T == null ? void 0 : T.width}px`, height: `${T == null ? void 0 : T.height}px` },
|
|
1038
|
+
className: Zr["rp-annotation-layer"],
|
|
1039
|
+
ref: n
|
|
1040
|
+
}
|
|
1041
|
+
);
|
|
1042
|
+
}, Xr = {
|
|
1043
|
+
"rp-text-highlight": "_rp-text-highlight_jdkf8_1"
|
|
1044
|
+
}, Qr = ({ pageNumber: t, viewport: e }) => {
|
|
1045
|
+
const [n, r] = $(), { pages: o } = re(), { highlightKeywords: s } = yo(), c = !0, d = M(null), [a, m] = $(null), [g, C] = $([]);
|
|
1046
|
+
z(() => {
|
|
1047
|
+
d.current && m(d.current.parentElement);
|
|
1048
|
+
}, [d]), z(() => {
|
|
1049
|
+
(async () => {
|
|
1050
|
+
const f = o.get(t);
|
|
1051
|
+
if (!f || !d.current)
|
|
1052
|
+
return;
|
|
1053
|
+
const h = await f.page.getTextContent();
|
|
1054
|
+
r(h);
|
|
1055
|
+
})();
|
|
1056
|
+
}, [o, t]);
|
|
1057
|
+
const u = k(() => s ? s.map((p) => {
|
|
1058
|
+
var f, h;
|
|
1059
|
+
return {
|
|
1060
|
+
...tr(p.keyword, (f = p.options) == null ? void 0 : f.matchCase, (h = p.options) == null ? void 0 : h.wholeWords),
|
|
1061
|
+
color: p.highlightColor
|
|
1062
|
+
};
|
|
1063
|
+
}) : [], [s]);
|
|
1064
|
+
function b(p, f) {
|
|
1065
|
+
if (!p)
|
|
1066
|
+
return;
|
|
1067
|
+
const h = `[data-rp="page-${f}-textLayer"]`;
|
|
1068
|
+
return new Promise((l) => {
|
|
1069
|
+
const v = p.querySelector(h);
|
|
1070
|
+
if (v) {
|
|
1071
|
+
l(v);
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
new MutationObserver((I, x) => {
|
|
1075
|
+
const S = p.querySelector(h);
|
|
1076
|
+
S && (l(S), x.disconnect());
|
|
1077
|
+
}).observe(p, { childList: !0, subtree: !0 });
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
function T(p) {
|
|
1081
|
+
return new Promise((f) => {
|
|
1082
|
+
const h = p.querySelectorAll(
|
|
1083
|
+
'[data-rp="rp-text-layer-text"]'
|
|
1084
|
+
);
|
|
1085
|
+
if (h.length) {
|
|
1086
|
+
f(Array.from(h));
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
new MutationObserver((v, _) => {
|
|
1090
|
+
const I = p.querySelectorAll(
|
|
1091
|
+
".rp-text-layer-text"
|
|
1092
|
+
);
|
|
1093
|
+
I.length && (f(Array.from(I)), _.disconnect());
|
|
1094
|
+
}).observe(p, { childList: !0, subtree: !0 });
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
const P = (p, f, h, l) => {
|
|
1098
|
+
var U;
|
|
1099
|
+
const v = document.createRange(), _ = h.firstChild;
|
|
1100
|
+
if (!_ || _.nodeType !== Node.TEXT_NODE)
|
|
1101
|
+
return null;
|
|
1102
|
+
const I = ((U = _.textContent) == null ? void 0 : U.length) ?? 0, x = l[0].charIdxInSpan, S = l.length === 1 ? x : l[l.length - 1].charIdxInSpan;
|
|
1103
|
+
if (x > I || S + 1 > I)
|
|
1104
|
+
return null;
|
|
1105
|
+
v.setStart(_, x), v.setEnd(_, S + 1);
|
|
1106
|
+
const L = document.createElement("span");
|
|
1107
|
+
L.style.width = "auto", v.surroundContents(L);
|
|
1108
|
+
const O = L.getBoundingClientRect(), D = p.getBoundingClientRect(), F = D.height, E = D.width, R = 100 * (O.left - D.left) / E, A = 100 * (O.top - D.top) / F, G = 100 * O.height / F, H = 100 * O.width / E;
|
|
1109
|
+
return or(L), {
|
|
1110
|
+
keywordStr: f,
|
|
1111
|
+
left: R,
|
|
1112
|
+
top: A,
|
|
1113
|
+
height: G,
|
|
1114
|
+
width: H,
|
|
1115
|
+
pageHeight: F,
|
|
1116
|
+
pageWidth: E
|
|
1117
|
+
};
|
|
1118
|
+
};
|
|
1119
|
+
async function w(p, f) {
|
|
1120
|
+
const h = await b(a, p);
|
|
1121
|
+
if (!h)
|
|
1122
|
+
return;
|
|
1123
|
+
const l = await T(h);
|
|
1124
|
+
if (l.length) {
|
|
1125
|
+
const v = l.map((I) => I.tagName === "BR" ? " " : I.textContent).reduce(
|
|
1126
|
+
(I, x, S) => I.concat(
|
|
1127
|
+
x.split("").map((L, O) => ({
|
|
1128
|
+
char: L,
|
|
1129
|
+
charIdxInSpan: O,
|
|
1130
|
+
spanIdx: S
|
|
1131
|
+
}))
|
|
1132
|
+
),
|
|
1133
|
+
[
|
|
1134
|
+
{
|
|
1135
|
+
char: "",
|
|
1136
|
+
charIdxInSpan: 0,
|
|
1137
|
+
spanIdx: 0
|
|
1138
|
+
}
|
|
1139
|
+
]
|
|
1140
|
+
).slice(1), _ = y(h, f, l, v);
|
|
1141
|
+
C(_);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
const y = (p, f, h, l) => {
|
|
1145
|
+
const v = f.length;
|
|
1146
|
+
if (!l.length || !v)
|
|
1147
|
+
return [];
|
|
1148
|
+
const _ = [], I = l.map((x) => x.char).join("");
|
|
1149
|
+
return u.forEach((x) => {
|
|
1150
|
+
const { keyword: S, regExp: L, wholeWords: O, color: D } = x, F = S;
|
|
1151
|
+
if (!F.trim())
|
|
1152
|
+
return;
|
|
1153
|
+
const E = L.flags.indexOf("g") === -1 ? new RegExp(L, `${L.flags}g`) : L;
|
|
1154
|
+
let R;
|
|
1155
|
+
const A = [];
|
|
1156
|
+
for (; (R = E.exec(I)) !== null; )
|
|
1157
|
+
O && !Po(I, R.index, R[0].length) || A.push({
|
|
1158
|
+
keyword: E,
|
|
1159
|
+
startIndex: R.index,
|
|
1160
|
+
endIndex: E.lastIndex
|
|
1161
|
+
});
|
|
1162
|
+
const G = A.map((H) => ({
|
|
1163
|
+
keyword: H.keyword,
|
|
1164
|
+
indexes: l.slice(H.startIndex, H.endIndex),
|
|
1165
|
+
color: D
|
|
1166
|
+
}));
|
|
1167
|
+
for (const H of G) {
|
|
1168
|
+
const U = H.indexes.reduce(
|
|
1169
|
+
(X, V) => (X[V.spanIdx] = (X[V.spanIdx] || []).concat([V]), X),
|
|
1170
|
+
{}
|
|
1171
|
+
);
|
|
1172
|
+
for (const X of Object.values(U))
|
|
1173
|
+
if (X.length !== 1 || X[0].char.trim() !== "") {
|
|
1174
|
+
const V = X, ie = h[V[0].spanIdx], q = P(
|
|
1175
|
+
p,
|
|
1176
|
+
F,
|
|
1177
|
+
ie,
|
|
1178
|
+
V
|
|
1179
|
+
);
|
|
1180
|
+
if (q) {
|
|
1181
|
+
const { left: Z, top: Y } = q;
|
|
1182
|
+
if (_.find((J) => J.left === Z && J.top === Y))
|
|
1183
|
+
continue;
|
|
1184
|
+
_.push({ ...q, highlightColor: H.color });
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}), _.sort(nr), _;
|
|
1189
|
+
};
|
|
1190
|
+
return z(() => {
|
|
1191
|
+
(async () => {
|
|
1192
|
+
if (!s || s.length === 0) {
|
|
1193
|
+
C([]);
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
try {
|
|
1197
|
+
await w(t, s);
|
|
1198
|
+
} catch (f) {
|
|
1199
|
+
console.error(f);
|
|
1200
|
+
}
|
|
1201
|
+
})();
|
|
1202
|
+
}, [c, s, t, n, e]), /* @__PURE__ */ i(he, { children: /* @__PURE__ */ i("div", { ref: d, "data-rp": `page-${t}-textHighlightLayer`, children: g.map((p, f) => /* @__PURE__ */ i(
|
|
1203
|
+
"div",
|
|
1204
|
+
{
|
|
1205
|
+
className: Xr["rp-text-highlight"],
|
|
1206
|
+
style: {
|
|
1207
|
+
top: `${p.top}%`,
|
|
1208
|
+
left: `${p.left}%`,
|
|
1209
|
+
width: `${p.width}%`,
|
|
1210
|
+
height: `${p.height}%`,
|
|
1211
|
+
backgroundColor: p.highlightColor
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
f
|
|
1215
|
+
)) }) });
|
|
1216
|
+
}, Nt = rt((t, e) => {
|
|
1217
|
+
const { pageNumber: n, style: r, ...o } = t, { pages: s } = re(), { pageRotate: c } = ot(), { textLayer: d } = go(), { currentZoom: a } = tt(), { LoaderImageComponent: m } = Pt(), g = M(s.get(n)), [C, u] = $(!1), b = M(null), [T, P] = $({
|
|
1218
|
+
width: 0,
|
|
1219
|
+
height: 0
|
|
1220
|
+
});
|
|
1221
|
+
dn(e, () => b.current);
|
|
1222
|
+
const w = k(() => g.current ? c[n] : 0, [n, c]);
|
|
1223
|
+
z(() => {
|
|
1224
|
+
if (s && (g.current = s.get(n), g.current)) {
|
|
1225
|
+
const h = g.current.page.getViewport({
|
|
1226
|
+
scale: a,
|
|
1227
|
+
rotation: w
|
|
1228
|
+
});
|
|
1229
|
+
P(h);
|
|
1230
|
+
}
|
|
1231
|
+
}, [s, n, w, a]);
|
|
1232
|
+
const y = k(() => {
|
|
1233
|
+
switch (w) {
|
|
1234
|
+
case 90:
|
|
1235
|
+
return `${T.width / 2}px ${T.width / 2}px`;
|
|
1236
|
+
case -90:
|
|
1237
|
+
case 270:
|
|
1238
|
+
return `${T.height / 2}px ${T.height / 2}px`;
|
|
1239
|
+
default:
|
|
1240
|
+
return "center";
|
|
1241
|
+
}
|
|
1242
|
+
}, [w, T]), p = N(() => {
|
|
1243
|
+
u(!0);
|
|
1244
|
+
}, []), f = N(() => {
|
|
1245
|
+
u(!1);
|
|
1246
|
+
}, []);
|
|
1247
|
+
return /* @__PURE__ */ i(
|
|
1248
|
+
"div",
|
|
1249
|
+
{
|
|
1250
|
+
ref: b,
|
|
1251
|
+
id: `page-${n}`,
|
|
1252
|
+
"data-rp": `page-${n}`,
|
|
1253
|
+
...o,
|
|
1254
|
+
style: {
|
|
1255
|
+
...r,
|
|
1256
|
+
"--rp-rotate": `${w}deg`,
|
|
1257
|
+
"--rp-page-rotate-translate": `${y}`,
|
|
1258
|
+
"--scale-factor": a
|
|
1259
|
+
},
|
|
1260
|
+
className: pt["rp-page-wrapper"],
|
|
1261
|
+
children: /* @__PURE__ */ W(
|
|
1262
|
+
"div",
|
|
1263
|
+
{
|
|
1264
|
+
style: {
|
|
1265
|
+
width: `${T.width}px`,
|
|
1266
|
+
height: `${T.height}px`
|
|
1267
|
+
},
|
|
1268
|
+
className: pt["rp-page"],
|
|
1269
|
+
children: [
|
|
1270
|
+
/* @__PURE__ */ i(qr, { onLoading: p, onLoaded: f, pageNumber: n }),
|
|
1271
|
+
C && m && /* @__PURE__ */ i("div", { className: pt["rp-loader-wrapper"], children: /* @__PURE__ */ i(m, {}) }),
|
|
1272
|
+
/* @__PURE__ */ i(rr, { pageNumber: n }),
|
|
1273
|
+
d && /* @__PURE__ */ i(Br, { pageNumber: n }),
|
|
1274
|
+
/* @__PURE__ */ i(Qr, { pageNumber: n, viewport: T }),
|
|
1275
|
+
/* @__PURE__ */ i(Kr, { pageNumber: n })
|
|
1276
|
+
]
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
}
|
|
1280
|
+
);
|
|
1281
|
+
});
|
|
1282
|
+
function _t() {
|
|
1283
|
+
return _t = Object.assign ? Object.assign.bind() : function(t) {
|
|
1284
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
1285
|
+
var n = arguments[e];
|
|
1286
|
+
for (var r in n)
|
|
1287
|
+
({}).hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
1288
|
+
}
|
|
1289
|
+
return t;
|
|
1290
|
+
}, _t.apply(null, arguments);
|
|
1291
|
+
}
|
|
1292
|
+
function Bt(t) {
|
|
1293
|
+
if (t === void 0)
|
|
1294
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1295
|
+
return t;
|
|
1296
|
+
}
|
|
1297
|
+
function bt(t, e) {
|
|
1298
|
+
return bt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
|
|
1299
|
+
return n.__proto__ = r, n;
|
|
1300
|
+
}, bt(t, e);
|
|
1301
|
+
}
|
|
1302
|
+
function Yr(t, e) {
|
|
1303
|
+
t.prototype = Object.create(e.prototype), t.prototype.constructor = t, bt(t, e);
|
|
1304
|
+
}
|
|
1305
|
+
var Zt = Number.isNaN || function(e) {
|
|
1306
|
+
return typeof e == "number" && e !== e;
|
|
1307
|
+
};
|
|
1308
|
+
function Jr(t, e) {
|
|
1309
|
+
return !!(t === e || Zt(t) && Zt(e));
|
|
1310
|
+
}
|
|
1311
|
+
function ei(t, e) {
|
|
1312
|
+
if (t.length !== e.length)
|
|
1313
|
+
return !1;
|
|
1314
|
+
for (var n = 0; n < t.length; n++)
|
|
1315
|
+
if (!Jr(t[n], e[n]))
|
|
1316
|
+
return !1;
|
|
1317
|
+
return !0;
|
|
1318
|
+
}
|
|
1319
|
+
function ht(t, e) {
|
|
1320
|
+
e === void 0 && (e = ei);
|
|
1321
|
+
var n, r = [], o, s = !1;
|
|
1322
|
+
function c() {
|
|
1323
|
+
for (var d = [], a = 0; a < arguments.length; a++)
|
|
1324
|
+
d[a] = arguments[a];
|
|
1325
|
+
return s && n === this && e(d, r) || (o = t.apply(this, d), s = !0, n = this, r = d), o;
|
|
1326
|
+
}
|
|
1327
|
+
return c;
|
|
1328
|
+
}
|
|
1329
|
+
function jt(t, e) {
|
|
1330
|
+
if (t == null)
|
|
1331
|
+
return {};
|
|
1332
|
+
var n = {};
|
|
1333
|
+
for (var r in t)
|
|
1334
|
+
if ({}.hasOwnProperty.call(t, r)) {
|
|
1335
|
+
if (e.indexOf(r) !== -1)
|
|
1336
|
+
continue;
|
|
1337
|
+
n[r] = t[r];
|
|
1338
|
+
}
|
|
1339
|
+
return n;
|
|
1340
|
+
}
|
|
1341
|
+
var ti = typeof performance == "object" && typeof performance.now == "function", Kt = ti ? function() {
|
|
1342
|
+
return performance.now();
|
|
1343
|
+
} : function() {
|
|
1344
|
+
return Date.now();
|
|
1345
|
+
};
|
|
1346
|
+
function Xt(t) {
|
|
1347
|
+
cancelAnimationFrame(t.id);
|
|
1348
|
+
}
|
|
1349
|
+
function ni(t, e) {
|
|
1350
|
+
var n = Kt();
|
|
1351
|
+
function r() {
|
|
1352
|
+
Kt() - n >= e ? t.call(null) : o.id = requestAnimationFrame(r);
|
|
1353
|
+
}
|
|
1354
|
+
var o = {
|
|
1355
|
+
id: requestAnimationFrame(r)
|
|
1356
|
+
};
|
|
1357
|
+
return o;
|
|
1358
|
+
}
|
|
1359
|
+
var ft = -1;
|
|
1360
|
+
function oi(t) {
|
|
1361
|
+
if (t === void 0 && (t = !1), ft === -1 || t) {
|
|
1362
|
+
var e = document.createElement("div"), n = e.style;
|
|
1363
|
+
n.width = "50px", n.height = "50px", n.overflow = "scroll", document.body.appendChild(e), ft = e.offsetWidth - e.clientWidth, document.body.removeChild(e);
|
|
1364
|
+
}
|
|
1365
|
+
return ft;
|
|
1366
|
+
}
|
|
1367
|
+
var ze = null;
|
|
1368
|
+
function Qt(t) {
|
|
1369
|
+
if (t === void 0 && (t = !1), ze === null || t) {
|
|
1370
|
+
var e = document.createElement("div"), n = e.style;
|
|
1371
|
+
n.width = "50px", n.height = "50px", n.overflow = "scroll", n.direction = "rtl";
|
|
1372
|
+
var r = document.createElement("div"), o = r.style;
|
|
1373
|
+
return o.width = "100px", o.height = "100px", e.appendChild(r), document.body.appendChild(e), e.scrollLeft > 0 ? ze = "positive-descending" : (e.scrollLeft = 1, e.scrollLeft === 0 ? ze = "negative" : ze = "positive-ascending"), document.body.removeChild(e), ze;
|
|
1374
|
+
}
|
|
1375
|
+
return ze;
|
|
1376
|
+
}
|
|
1377
|
+
var ri = 150, ii = function(e) {
|
|
1378
|
+
var n = e.columnIndex;
|
|
1379
|
+
e.data;
|
|
1380
|
+
var r = e.rowIndex;
|
|
1381
|
+
return r + ":" + n;
|
|
1382
|
+
}, Xe = null, Qe = null, Ye = null;
|
|
1383
|
+
process.env.NODE_ENV !== "production" && typeof window < "u" && typeof window.WeakSet < "u" && (Xe = /* @__PURE__ */ new WeakSet(), Qe = /* @__PURE__ */ new WeakSet(), Ye = /* @__PURE__ */ new WeakSet());
|
|
1384
|
+
function si(t) {
|
|
1385
|
+
var e, n = t.getColumnOffset, r = t.getColumnStartIndexForOffset, o = t.getColumnStopIndexForStartIndex, s = t.getColumnWidth, c = t.getEstimatedTotalHeight, d = t.getEstimatedTotalWidth, a = t.getOffsetForColumnAndAlignment, m = t.getOffsetForRowAndAlignment, g = t.getRowHeight, C = t.getRowOffset, u = t.getRowStartIndexForOffset, b = t.getRowStopIndexForStartIndex, T = t.initInstanceProps, P = t.shouldResetStyleCacheOnItemSizeChange, w = t.validateProps;
|
|
1386
|
+
return e = /* @__PURE__ */ function(y) {
|
|
1387
|
+
Yr(p, y);
|
|
1388
|
+
function p(h) {
|
|
1389
|
+
var l;
|
|
1390
|
+
return l = y.call(this, h) || this, l._instanceProps = T(l.props, Bt(l)), l._resetIsScrollingTimeoutId = null, l._outerRef = void 0, l.state = {
|
|
1391
|
+
instance: Bt(l),
|
|
1392
|
+
isScrolling: !1,
|
|
1393
|
+
horizontalScrollDirection: "forward",
|
|
1394
|
+
scrollLeft: typeof l.props.initialScrollLeft == "number" ? l.props.initialScrollLeft : 0,
|
|
1395
|
+
scrollTop: typeof l.props.initialScrollTop == "number" ? l.props.initialScrollTop : 0,
|
|
1396
|
+
scrollUpdateWasRequested: !1,
|
|
1397
|
+
verticalScrollDirection: "forward"
|
|
1398
|
+
}, l._callOnItemsRendered = void 0, l._callOnItemsRendered = ht(function(v, _, I, x, S, L, O, D) {
|
|
1399
|
+
return l.props.onItemsRendered({
|
|
1400
|
+
overscanColumnStartIndex: v,
|
|
1401
|
+
overscanColumnStopIndex: _,
|
|
1402
|
+
overscanRowStartIndex: I,
|
|
1403
|
+
overscanRowStopIndex: x,
|
|
1404
|
+
visibleColumnStartIndex: S,
|
|
1405
|
+
visibleColumnStopIndex: L,
|
|
1406
|
+
visibleRowStartIndex: O,
|
|
1407
|
+
visibleRowStopIndex: D
|
|
1408
|
+
});
|
|
1409
|
+
}), l._callOnScroll = void 0, l._callOnScroll = ht(function(v, _, I, x, S) {
|
|
1410
|
+
return l.props.onScroll({
|
|
1411
|
+
horizontalScrollDirection: I,
|
|
1412
|
+
scrollLeft: v,
|
|
1413
|
+
scrollTop: _,
|
|
1414
|
+
verticalScrollDirection: x,
|
|
1415
|
+
scrollUpdateWasRequested: S
|
|
1416
|
+
});
|
|
1417
|
+
}), l._getItemStyle = void 0, l._getItemStyle = function(v, _) {
|
|
1418
|
+
var I = l.props, x = I.columnWidth, S = I.direction, L = I.rowHeight, O = l._getItemStyleCache(P && x, P && S, P && L), D = v + ":" + _, F;
|
|
1419
|
+
if (O.hasOwnProperty(D))
|
|
1420
|
+
F = O[D];
|
|
1421
|
+
else {
|
|
1422
|
+
var E = n(l.props, _, l._instanceProps), R = S === "rtl";
|
|
1423
|
+
O[D] = F = {
|
|
1424
|
+
position: "absolute",
|
|
1425
|
+
left: R ? void 0 : E,
|
|
1426
|
+
right: R ? E : void 0,
|
|
1427
|
+
top: C(l.props, v, l._instanceProps),
|
|
1428
|
+
height: g(l.props, v, l._instanceProps),
|
|
1429
|
+
width: s(l.props, _, l._instanceProps)
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
return F;
|
|
1433
|
+
}, l._getItemStyleCache = void 0, l._getItemStyleCache = ht(function(v, _, I) {
|
|
1434
|
+
return {};
|
|
1435
|
+
}), l._onScroll = function(v) {
|
|
1436
|
+
var _ = v.currentTarget, I = _.clientHeight, x = _.clientWidth, S = _.scrollLeft, L = _.scrollTop, O = _.scrollHeight, D = _.scrollWidth;
|
|
1437
|
+
l.setState(function(F) {
|
|
1438
|
+
if (F.scrollLeft === S && F.scrollTop === L)
|
|
1439
|
+
return null;
|
|
1440
|
+
var E = l.props.direction, R = S;
|
|
1441
|
+
if (E === "rtl")
|
|
1442
|
+
switch (Qt()) {
|
|
1443
|
+
case "negative":
|
|
1444
|
+
R = -S;
|
|
1445
|
+
break;
|
|
1446
|
+
case "positive-descending":
|
|
1447
|
+
R = D - x - S;
|
|
1448
|
+
break;
|
|
1449
|
+
}
|
|
1450
|
+
R = Math.max(0, Math.min(R, D - x));
|
|
1451
|
+
var A = Math.max(0, Math.min(L, O - I));
|
|
1452
|
+
return {
|
|
1453
|
+
isScrolling: !0,
|
|
1454
|
+
horizontalScrollDirection: F.scrollLeft < S ? "forward" : "backward",
|
|
1455
|
+
scrollLeft: R,
|
|
1456
|
+
scrollTop: A,
|
|
1457
|
+
verticalScrollDirection: F.scrollTop < L ? "forward" : "backward",
|
|
1458
|
+
scrollUpdateWasRequested: !1
|
|
1459
|
+
};
|
|
1460
|
+
}, l._resetIsScrollingDebounced);
|
|
1461
|
+
}, l._outerRefSetter = function(v) {
|
|
1462
|
+
var _ = l.props.outerRef;
|
|
1463
|
+
l._outerRef = v, typeof _ == "function" ? _(v) : _ != null && typeof _ == "object" && _.hasOwnProperty("current") && (_.current = v);
|
|
1464
|
+
}, l._resetIsScrollingDebounced = function() {
|
|
1465
|
+
l._resetIsScrollingTimeoutId !== null && Xt(l._resetIsScrollingTimeoutId), l._resetIsScrollingTimeoutId = ni(l._resetIsScrolling, ri);
|
|
1466
|
+
}, l._resetIsScrolling = function() {
|
|
1467
|
+
l._resetIsScrollingTimeoutId = null, l.setState({
|
|
1468
|
+
isScrolling: !1
|
|
1469
|
+
}, function() {
|
|
1470
|
+
l._getItemStyleCache(-1);
|
|
1471
|
+
});
|
|
1472
|
+
}, l;
|
|
1473
|
+
}
|
|
1474
|
+
p.getDerivedStateFromProps = function(l, v) {
|
|
1475
|
+
return ai(l, v), w(l), null;
|
|
1476
|
+
};
|
|
1477
|
+
var f = p.prototype;
|
|
1478
|
+
return f.scrollTo = function(l) {
|
|
1479
|
+
var v = l.scrollLeft, _ = l.scrollTop;
|
|
1480
|
+
v !== void 0 && (v = Math.max(0, v)), _ !== void 0 && (_ = Math.max(0, _)), this.setState(function(I) {
|
|
1481
|
+
return v === void 0 && (v = I.scrollLeft), _ === void 0 && (_ = I.scrollTop), I.scrollLeft === v && I.scrollTop === _ ? null : {
|
|
1482
|
+
horizontalScrollDirection: I.scrollLeft < v ? "forward" : "backward",
|
|
1483
|
+
scrollLeft: v,
|
|
1484
|
+
scrollTop: _,
|
|
1485
|
+
scrollUpdateWasRequested: !0,
|
|
1486
|
+
verticalScrollDirection: I.scrollTop < _ ? "forward" : "backward"
|
|
1487
|
+
};
|
|
1488
|
+
}, this._resetIsScrollingDebounced);
|
|
1489
|
+
}, f.scrollToItem = function(l) {
|
|
1490
|
+
var v = l.align, _ = v === void 0 ? "auto" : v, I = l.columnIndex, x = l.rowIndex, S = this.props, L = S.columnCount, O = S.height, D = S.rowCount, F = S.width, E = this.state, R = E.scrollLeft, A = E.scrollTop, G = oi();
|
|
1491
|
+
I !== void 0 && (I = Math.max(0, Math.min(I, L - 1))), x !== void 0 && (x = Math.max(0, Math.min(x, D - 1)));
|
|
1492
|
+
var H = c(this.props, this._instanceProps), U = d(this.props, this._instanceProps), X = U > F ? G : 0, V = H > O ? G : 0;
|
|
1493
|
+
this.scrollTo({
|
|
1494
|
+
scrollLeft: I !== void 0 ? a(this.props, I, _, R, this._instanceProps, V) : R,
|
|
1495
|
+
scrollTop: x !== void 0 ? m(this.props, x, _, A, this._instanceProps, X) : A
|
|
1496
|
+
});
|
|
1497
|
+
}, f.componentDidMount = function() {
|
|
1498
|
+
var l = this.props, v = l.initialScrollLeft, _ = l.initialScrollTop;
|
|
1499
|
+
if (this._outerRef != null) {
|
|
1500
|
+
var I = this._outerRef;
|
|
1501
|
+
typeof v == "number" && (I.scrollLeft = v), typeof _ == "number" && (I.scrollTop = _);
|
|
1502
|
+
}
|
|
1503
|
+
this._callPropsCallbacks();
|
|
1504
|
+
}, f.componentDidUpdate = function() {
|
|
1505
|
+
var l = this.props.direction, v = this.state, _ = v.scrollLeft, I = v.scrollTop, x = v.scrollUpdateWasRequested;
|
|
1506
|
+
if (x && this._outerRef != null) {
|
|
1507
|
+
var S = this._outerRef;
|
|
1508
|
+
if (l === "rtl")
|
|
1509
|
+
switch (Qt()) {
|
|
1510
|
+
case "negative":
|
|
1511
|
+
S.scrollLeft = -_;
|
|
1512
|
+
break;
|
|
1513
|
+
case "positive-ascending":
|
|
1514
|
+
S.scrollLeft = _;
|
|
1515
|
+
break;
|
|
1516
|
+
default:
|
|
1517
|
+
var L = S.clientWidth, O = S.scrollWidth;
|
|
1518
|
+
S.scrollLeft = O - L - _;
|
|
1519
|
+
break;
|
|
1520
|
+
}
|
|
1521
|
+
else
|
|
1522
|
+
S.scrollLeft = Math.max(0, _);
|
|
1523
|
+
S.scrollTop = Math.max(0, I);
|
|
1524
|
+
}
|
|
1525
|
+
this._callPropsCallbacks();
|
|
1526
|
+
}, f.componentWillUnmount = function() {
|
|
1527
|
+
this._resetIsScrollingTimeoutId !== null && Xt(this._resetIsScrollingTimeoutId);
|
|
1528
|
+
}, f.render = function() {
|
|
1529
|
+
var l = this.props, v = l.children, _ = l.className, I = l.columnCount, x = l.direction, S = l.height, L = l.innerRef, O = l.innerElementType, D = l.innerTagName, F = l.itemData, E = l.itemKey, R = E === void 0 ? ii : E, A = l.outerElementType, G = l.outerTagName, H = l.rowCount, U = l.style, X = l.useIsScrolling, V = l.width, ie = this.state.isScrolling, q = this._getHorizontalRangeToRender(), Z = q[0], Y = q[1], te = this._getVerticalRangeToRender(), J = te[0], ee = te[1], ve = [];
|
|
1530
|
+
if (I > 0 && H)
|
|
1531
|
+
for (var we = J; we <= ee; we++)
|
|
1532
|
+
for (var pe = Z; pe <= Y; pe++)
|
|
1533
|
+
ve.push(Ke(v, {
|
|
1534
|
+
columnIndex: pe,
|
|
1535
|
+
data: F,
|
|
1536
|
+
isScrolling: X ? ie : void 0,
|
|
1537
|
+
key: R({
|
|
1538
|
+
columnIndex: pe,
|
|
1539
|
+
data: F,
|
|
1540
|
+
rowIndex: we
|
|
1541
|
+
}),
|
|
1542
|
+
rowIndex: we,
|
|
1543
|
+
style: this._getItemStyle(we, pe)
|
|
1544
|
+
}));
|
|
1545
|
+
var at = c(this.props, this._instanceProps), He = d(this.props, this._instanceProps);
|
|
1546
|
+
return Ke(A || G || "div", {
|
|
1547
|
+
className: _,
|
|
1548
|
+
onScroll: this._onScroll,
|
|
1549
|
+
ref: this._outerRefSetter,
|
|
1550
|
+
style: _t({
|
|
1551
|
+
position: "relative",
|
|
1552
|
+
height: S,
|
|
1553
|
+
width: V,
|
|
1554
|
+
overflow: "auto",
|
|
1555
|
+
WebkitOverflowScrolling: "touch",
|
|
1556
|
+
willChange: "transform",
|
|
1557
|
+
direction: x
|
|
1558
|
+
}, U)
|
|
1559
|
+
}, Ke(O || D || "div", {
|
|
1560
|
+
children: ve,
|
|
1561
|
+
ref: L,
|
|
1562
|
+
style: {
|
|
1563
|
+
height: at,
|
|
1564
|
+
pointerEvents: ie ? "none" : void 0,
|
|
1565
|
+
width: He
|
|
1566
|
+
}
|
|
1567
|
+
}));
|
|
1568
|
+
}, f._callPropsCallbacks = function() {
|
|
1569
|
+
var l = this.props, v = l.columnCount, _ = l.onItemsRendered, I = l.onScroll, x = l.rowCount;
|
|
1570
|
+
if (typeof _ == "function" && v > 0 && x > 0) {
|
|
1571
|
+
var S = this._getHorizontalRangeToRender(), L = S[0], O = S[1], D = S[2], F = S[3], E = this._getVerticalRangeToRender(), R = E[0], A = E[1], G = E[2], H = E[3];
|
|
1572
|
+
this._callOnItemsRendered(L, O, R, A, D, F, G, H);
|
|
1573
|
+
}
|
|
1574
|
+
if (typeof I == "function") {
|
|
1575
|
+
var U = this.state, X = U.horizontalScrollDirection, V = U.scrollLeft, ie = U.scrollTop, q = U.scrollUpdateWasRequested, Z = U.verticalScrollDirection;
|
|
1576
|
+
this._callOnScroll(V, ie, X, Z, q);
|
|
1577
|
+
}
|
|
1578
|
+
}, f._getHorizontalRangeToRender = function() {
|
|
1579
|
+
var l = this.props, v = l.columnCount, _ = l.overscanColumnCount, I = l.overscanColumnsCount, x = l.overscanCount, S = l.rowCount, L = this.state, O = L.horizontalScrollDirection, D = L.isScrolling, F = L.scrollLeft, E = _ || I || x || 1;
|
|
1580
|
+
if (v === 0 || S === 0)
|
|
1581
|
+
return [0, 0, 0, 0];
|
|
1582
|
+
var R = r(this.props, F, this._instanceProps), A = o(this.props, R, F, this._instanceProps), G = !D || O === "backward" ? Math.max(1, E) : 1, H = !D || O === "forward" ? Math.max(1, E) : 1;
|
|
1583
|
+
return [Math.max(0, R - G), Math.max(0, Math.min(v - 1, A + H)), R, A];
|
|
1584
|
+
}, f._getVerticalRangeToRender = function() {
|
|
1585
|
+
var l = this.props, v = l.columnCount, _ = l.overscanCount, I = l.overscanRowCount, x = l.overscanRowsCount, S = l.rowCount, L = this.state, O = L.isScrolling, D = L.verticalScrollDirection, F = L.scrollTop, E = I || x || _ || 1;
|
|
1586
|
+
if (v === 0 || S === 0)
|
|
1587
|
+
return [0, 0, 0, 0];
|
|
1588
|
+
var R = u(this.props, F, this._instanceProps), A = b(this.props, R, F, this._instanceProps), G = !O || D === "backward" ? Math.max(1, E) : 1, H = !O || D === "forward" ? Math.max(1, E) : 1;
|
|
1589
|
+
return [Math.max(0, R - G), Math.max(0, Math.min(S - 1, A + H)), R, A];
|
|
1590
|
+
}, p;
|
|
1591
|
+
}(ao), e.defaultProps = {
|
|
1592
|
+
direction: "ltr",
|
|
1593
|
+
itemData: void 0,
|
|
1594
|
+
useIsScrolling: !1
|
|
1595
|
+
}, e;
|
|
1596
|
+
}
|
|
1597
|
+
var ai = function(e, n) {
|
|
1598
|
+
var r = e.children, o = e.direction, s = e.height, c = e.innerTagName, d = e.outerTagName, a = e.overscanColumnsCount, m = e.overscanCount, g = e.overscanRowsCount, C = e.width, u = n.instance;
|
|
1599
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1600
|
+
if (typeof m == "number" && Xe && !Xe.has(u) && (Xe.add(u), console.warn("The overscanCount prop has been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (typeof a == "number" || typeof g == "number") && Qe && !Qe.has(u) && (Qe.add(u), console.warn("The overscanColumnsCount and overscanRowsCount props have been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (c != null || d != null) && Ye && !Ye.has(u) && (Ye.add(u), console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead.")), r == null)
|
|
1601
|
+
throw Error('An invalid "children" prop has been specified. Value should be a React component. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
|
|
1602
|
+
switch (o) {
|
|
1603
|
+
case "ltr":
|
|
1604
|
+
case "rtl":
|
|
1605
|
+
break;
|
|
1606
|
+
default:
|
|
1607
|
+
throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". ' + ('"' + o + '" was specified.'));
|
|
1608
|
+
}
|
|
1609
|
+
if (typeof C != "number")
|
|
1610
|
+
throw Error('An invalid "width" prop has been specified. Grids must specify a number for width. ' + ('"' + (C === null ? "null" : typeof C) + '" was specified.'));
|
|
1611
|
+
if (typeof s != "number")
|
|
1612
|
+
throw Error('An invalid "height" prop has been specified. Grids must specify a number for height. ' + ('"' + (s === null ? "null" : typeof s) + '" was specified.'));
|
|
1613
|
+
}
|
|
1614
|
+
}, Yt = 50, Rn = function(e, n) {
|
|
1615
|
+
var r = e.rowCount, o = n.rowMetadataMap, s = n.estimatedRowHeight, c = n.lastMeasuredRowIndex, d = 0;
|
|
1616
|
+
if (c >= r && (c = r - 1), c >= 0) {
|
|
1617
|
+
var a = o[c];
|
|
1618
|
+
d = a.offset + a.size;
|
|
1619
|
+
}
|
|
1620
|
+
var m = r - c - 1, g = m * s;
|
|
1621
|
+
return d + g;
|
|
1622
|
+
}, Ln = function(e, n) {
|
|
1623
|
+
var r = e.columnCount, o = n.columnMetadataMap, s = n.estimatedColumnWidth, c = n.lastMeasuredColumnIndex, d = 0;
|
|
1624
|
+
if (c >= r && (c = r - 1), c >= 0) {
|
|
1625
|
+
var a = o[c];
|
|
1626
|
+
d = a.offset + a.size;
|
|
1627
|
+
}
|
|
1628
|
+
var m = r - c - 1, g = m * s;
|
|
1629
|
+
return d + g;
|
|
1630
|
+
}, be = function(e, n, r, o) {
|
|
1631
|
+
var s, c, d;
|
|
1632
|
+
if (e === "column" ? (s = o.columnMetadataMap, c = n.columnWidth, d = o.lastMeasuredColumnIndex) : (s = o.rowMetadataMap, c = n.rowHeight, d = o.lastMeasuredRowIndex), r > d) {
|
|
1633
|
+
var a = 0;
|
|
1634
|
+
if (d >= 0) {
|
|
1635
|
+
var m = s[d];
|
|
1636
|
+
a = m.offset + m.size;
|
|
1637
|
+
}
|
|
1638
|
+
for (var g = d + 1; g <= r; g++) {
|
|
1639
|
+
var C = c(g);
|
|
1640
|
+
s[g] = {
|
|
1641
|
+
offset: a,
|
|
1642
|
+
size: C
|
|
1643
|
+
}, a += C;
|
|
1644
|
+
}
|
|
1645
|
+
e === "column" ? o.lastMeasuredColumnIndex = r : o.lastMeasuredRowIndex = r;
|
|
1646
|
+
}
|
|
1647
|
+
return s[r];
|
|
1648
|
+
}, Jt = function(e, n, r, o) {
|
|
1649
|
+
var s, c;
|
|
1650
|
+
e === "column" ? (s = r.columnMetadataMap, c = r.lastMeasuredColumnIndex) : (s = r.rowMetadataMap, c = r.lastMeasuredRowIndex);
|
|
1651
|
+
var d = c > 0 ? s[c].offset : 0;
|
|
1652
|
+
return d >= o ? En(e, n, r, c, 0, o) : ci(e, n, r, Math.max(0, c), o);
|
|
1653
|
+
}, En = function(e, n, r, o, s, c) {
|
|
1654
|
+
for (; s <= o; ) {
|
|
1655
|
+
var d = s + Math.floor((o - s) / 2), a = be(e, n, d, r).offset;
|
|
1656
|
+
if (a === c)
|
|
1657
|
+
return d;
|
|
1658
|
+
a < c ? s = d + 1 : a > c && (o = d - 1);
|
|
1659
|
+
}
|
|
1660
|
+
return s > 0 ? s - 1 : 0;
|
|
1661
|
+
}, ci = function(e, n, r, o, s) {
|
|
1662
|
+
for (var c = e === "column" ? n.columnCount : n.rowCount, d = 1; o < c && be(e, n, o, r).offset < s; )
|
|
1663
|
+
o += d, d *= 2;
|
|
1664
|
+
return En(e, n, r, Math.min(o, c - 1), Math.floor(o / 2), s);
|
|
1665
|
+
}, en = function(e, n, r, o, s, c, d) {
|
|
1666
|
+
var a = e === "column" ? n.width : n.height, m = be(e, n, r, c), g = e === "column" ? Ln(n, c) : Rn(n, c), C = Math.max(0, Math.min(g - a, m.offset)), u = Math.max(0, m.offset - a + d + m.size);
|
|
1667
|
+
switch (o === "smart" && (s >= u - a && s <= C + a ? o = "auto" : o = "center"), o) {
|
|
1668
|
+
case "start":
|
|
1669
|
+
return C;
|
|
1670
|
+
case "end":
|
|
1671
|
+
return u;
|
|
1672
|
+
case "center":
|
|
1673
|
+
return Math.round(u + (C - u) / 2);
|
|
1674
|
+
case "auto":
|
|
1675
|
+
default:
|
|
1676
|
+
return s >= u && s <= C ? s : u > C || s < u ? u : C;
|
|
1677
|
+
}
|
|
1678
|
+
}, li = /* @__PURE__ */ si({
|
|
1679
|
+
getColumnOffset: function(e, n, r) {
|
|
1680
|
+
return be("column", e, n, r).offset;
|
|
1681
|
+
},
|
|
1682
|
+
getColumnStartIndexForOffset: function(e, n, r) {
|
|
1683
|
+
return Jt("column", e, r, n);
|
|
1684
|
+
},
|
|
1685
|
+
getColumnStopIndexForStartIndex: function(e, n, r, o) {
|
|
1686
|
+
for (var s = e.columnCount, c = e.width, d = be("column", e, n, o), a = r + c, m = d.offset + d.size, g = n; g < s - 1 && m < a; )
|
|
1687
|
+
g++, m += be("column", e, g, o).size;
|
|
1688
|
+
return g;
|
|
1689
|
+
},
|
|
1690
|
+
getColumnWidth: function(e, n, r) {
|
|
1691
|
+
return r.columnMetadataMap[n].size;
|
|
1692
|
+
},
|
|
1693
|
+
getEstimatedTotalHeight: Rn,
|
|
1694
|
+
getEstimatedTotalWidth: Ln,
|
|
1695
|
+
getOffsetForColumnAndAlignment: function(e, n, r, o, s, c) {
|
|
1696
|
+
return en("column", e, n, r, o, s, c);
|
|
1697
|
+
},
|
|
1698
|
+
getOffsetForRowAndAlignment: function(e, n, r, o, s, c) {
|
|
1699
|
+
return en("row", e, n, r, o, s, c);
|
|
1700
|
+
},
|
|
1701
|
+
getRowOffset: function(e, n, r) {
|
|
1702
|
+
return be("row", e, n, r).offset;
|
|
1703
|
+
},
|
|
1704
|
+
getRowHeight: function(e, n, r) {
|
|
1705
|
+
return r.rowMetadataMap[n].size;
|
|
1706
|
+
},
|
|
1707
|
+
getRowStartIndexForOffset: function(e, n, r) {
|
|
1708
|
+
return Jt("row", e, r, n);
|
|
1709
|
+
},
|
|
1710
|
+
getRowStopIndexForStartIndex: function(e, n, r, o) {
|
|
1711
|
+
for (var s = e.rowCount, c = e.height, d = be("row", e, n, o), a = r + c, m = d.offset + d.size, g = n; g < s - 1 && m < a; )
|
|
1712
|
+
g++, m += be("row", e, g, o).size;
|
|
1713
|
+
return g;
|
|
1714
|
+
},
|
|
1715
|
+
initInstanceProps: function(e, n) {
|
|
1716
|
+
var r = e, o = r.estimatedColumnWidth, s = r.estimatedRowHeight, c = {
|
|
1717
|
+
columnMetadataMap: {},
|
|
1718
|
+
estimatedColumnWidth: o || Yt,
|
|
1719
|
+
estimatedRowHeight: s || Yt,
|
|
1720
|
+
lastMeasuredColumnIndex: -1,
|
|
1721
|
+
lastMeasuredRowIndex: -1,
|
|
1722
|
+
rowMetadataMap: {}
|
|
1723
|
+
};
|
|
1724
|
+
return n.resetAfterColumnIndex = function(d, a) {
|
|
1725
|
+
a === void 0 && (a = !0), n.resetAfterIndices({
|
|
1726
|
+
columnIndex: d,
|
|
1727
|
+
shouldForceUpdate: a
|
|
1728
|
+
});
|
|
1729
|
+
}, n.resetAfterRowIndex = function(d, a) {
|
|
1730
|
+
a === void 0 && (a = !0), n.resetAfterIndices({
|
|
1731
|
+
rowIndex: d,
|
|
1732
|
+
shouldForceUpdate: a
|
|
1733
|
+
});
|
|
1734
|
+
}, n.resetAfterIndices = function(d) {
|
|
1735
|
+
var a = d.columnIndex, m = d.rowIndex, g = d.shouldForceUpdate, C = g === void 0 ? !0 : g;
|
|
1736
|
+
typeof a == "number" && (c.lastMeasuredColumnIndex = Math.min(c.lastMeasuredColumnIndex, a - 1)), typeof m == "number" && (c.lastMeasuredRowIndex = Math.min(c.lastMeasuredRowIndex, m - 1)), n._getItemStyleCache(-1), C && n.forceUpdate();
|
|
1737
|
+
}, c;
|
|
1738
|
+
},
|
|
1739
|
+
shouldResetStyleCacheOnItemSizeChange: !1,
|
|
1740
|
+
validateProps: function(e) {
|
|
1741
|
+
var n = e.columnWidth, r = e.rowHeight;
|
|
1742
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1743
|
+
if (typeof n != "function")
|
|
1744
|
+
throw Error('An invalid "columnWidth" prop has been specified. Value should be a function. ' + ('"' + (n === null ? "null" : typeof n) + '" was specified.'));
|
|
1745
|
+
if (typeof r != "function")
|
|
1746
|
+
throw Error('An invalid "rowHeight" prop has been specified. Value should be a function. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
});
|
|
1750
|
+
process.env.NODE_ENV;
|
|
1751
|
+
function tn(t, e) {
|
|
1752
|
+
for (var n in t)
|
|
1753
|
+
if (!(n in e))
|
|
1754
|
+
return !0;
|
|
1755
|
+
for (var r in e)
|
|
1756
|
+
if (t[r] !== e[r])
|
|
1757
|
+
return !0;
|
|
1758
|
+
return !1;
|
|
1759
|
+
}
|
|
1760
|
+
var di = ["style"], ui = ["style"];
|
|
1761
|
+
function pi(t, e) {
|
|
1762
|
+
var n = t.style, r = jt(t, di), o = e.style, s = jt(e, ui);
|
|
1763
|
+
return !tn(n, o) && !tn(r, s);
|
|
1764
|
+
}
|
|
1765
|
+
const hi = () => {
|
|
1766
|
+
const { viewMode: t } = Me(), { scrollMode: e } = De(), { setColumnCount: n } = hn(), { virtualScrollableElementRef: r } = nt(), o = Ze(), s = k(() => o.heights.length, [o.heights]), c = k(() => e === oe.HORIZONTAL_SCROLLING ? s : t === Ne.DUAL_PAGE ? 2 : 1, [t, e, e, s, r]), d = k(() => o.widths.reduce((w, y, p) => {
|
|
1767
|
+
const f = p % c;
|
|
1768
|
+
return (!w[f] || y > w[f]) && (w[f] = y), w;
|
|
1769
|
+
}, []), [o.widths, c]), a = N(
|
|
1770
|
+
(P) => {
|
|
1771
|
+
const w = P % d.length;
|
|
1772
|
+
return d[w] || 0;
|
|
1773
|
+
},
|
|
1774
|
+
[d]
|
|
1775
|
+
), m = N(
|
|
1776
|
+
(P) => {
|
|
1777
|
+
const w = Array.from({ length: c }, (y, p) => {
|
|
1778
|
+
const f = P * c + p;
|
|
1779
|
+
return o.heights[f] || 0;
|
|
1780
|
+
});
|
|
1781
|
+
return Math.max(...w);
|
|
1782
|
+
},
|
|
1783
|
+
[o.heights, c]
|
|
1784
|
+
);
|
|
1785
|
+
z(() => {
|
|
1786
|
+
n(c);
|
|
1787
|
+
}, [c, n]);
|
|
1788
|
+
const g = k(() => e === oe.HORIZONTAL_SCROLLING || e === oe.PAGE_SCROLLING ? 1 : Math.round(s / c), [c, s, e]), C = k(() => o.heights.reduce((P, w) => P + w, 0) / o.heights.length || 0, [o]), u = k(() => o.widths.reduce((P, w) => P + w, 0) / o.widths.length || 0, [o]), b = k(() => {
|
|
1789
|
+
const { rowsHeight: P, columnsWidth: w } = St(o, c);
|
|
1790
|
+
return {
|
|
1791
|
+
rowsHeight: P,
|
|
1792
|
+
columnsWidth: w
|
|
1793
|
+
};
|
|
1794
|
+
}, [o, c]), T = k(() => ({
|
|
1795
|
+
width: b.columnsWidth.reduce((P, w) => P + w, 0),
|
|
1796
|
+
height: b.rowsHeight.reduce((P, w) => P + w, 0)
|
|
1797
|
+
}), [b]);
|
|
1798
|
+
return {
|
|
1799
|
+
rowCount: g,
|
|
1800
|
+
rowHeight: m,
|
|
1801
|
+
columnCount: c,
|
|
1802
|
+
columnWidth: a,
|
|
1803
|
+
pageDimension: o,
|
|
1804
|
+
estimatedRowHeight: C,
|
|
1805
|
+
estimatedColumnWidth: u,
|
|
1806
|
+
gridDimension: b,
|
|
1807
|
+
totalDimension: T
|
|
1808
|
+
};
|
|
1809
|
+
};
|
|
1810
|
+
let le;
|
|
1811
|
+
typeof window < "u" ? le = window : typeof self < "u" ? le = self : le = global;
|
|
1812
|
+
let Tt = null, Ct = null;
|
|
1813
|
+
const nn = 20, mt = le.clearTimeout, on = le.setTimeout, gt = le.cancelAnimationFrame || le.mozCancelAnimationFrame || le.webkitCancelAnimationFrame, rn = le.requestAnimationFrame || le.mozRequestAnimationFrame || le.webkitRequestAnimationFrame;
|
|
1814
|
+
gt == null || rn == null ? (Tt = mt, Ct = function(e) {
|
|
1815
|
+
return on(e, nn);
|
|
1816
|
+
}) : (Tt = function([e, n]) {
|
|
1817
|
+
gt(e), mt(n);
|
|
1818
|
+
}, Ct = function(e) {
|
|
1819
|
+
const n = rn(function() {
|
|
1820
|
+
mt(r), e();
|
|
1821
|
+
}), r = on(function() {
|
|
1822
|
+
gt(n), e();
|
|
1823
|
+
}, nn);
|
|
1824
|
+
return [n, r];
|
|
1825
|
+
});
|
|
1826
|
+
function fi(t) {
|
|
1827
|
+
let e, n, r, o, s, c, d;
|
|
1828
|
+
const a = typeof document < "u" && document.attachEvent;
|
|
1829
|
+
if (!a) {
|
|
1830
|
+
c = function(y) {
|
|
1831
|
+
const p = y.__resizeTriggers__, f = p.firstElementChild, h = p.lastElementChild, l = f.firstElementChild;
|
|
1832
|
+
h.scrollLeft = h.scrollWidth, h.scrollTop = h.scrollHeight, l.style.width = f.offsetWidth + 1 + "px", l.style.height = f.offsetHeight + 1 + "px", f.scrollLeft = f.scrollWidth, f.scrollTop = f.scrollHeight;
|
|
1833
|
+
}, s = function(y) {
|
|
1834
|
+
return y.offsetWidth !== y.__resizeLast__.width || y.offsetHeight !== y.__resizeLast__.height;
|
|
1835
|
+
}, d = function(y) {
|
|
1836
|
+
if (y.target.className && typeof y.target.className.indexOf == "function" && y.target.className.indexOf("contract-trigger") < 0 && y.target.className.indexOf("expand-trigger") < 0)
|
|
1837
|
+
return;
|
|
1838
|
+
const p = this;
|
|
1839
|
+
c(this), this.__resizeRAF__ && Tt(this.__resizeRAF__), this.__resizeRAF__ = Ct(function() {
|
|
1840
|
+
s(p) && (p.__resizeLast__.width = p.offsetWidth, p.__resizeLast__.height = p.offsetHeight, p.__resizeListeners__.forEach(function(l) {
|
|
1841
|
+
l.call(p, y);
|
|
1842
|
+
}));
|
|
1843
|
+
});
|
|
1844
|
+
};
|
|
1845
|
+
let u = !1, b = "";
|
|
1846
|
+
r = "animationstart";
|
|
1847
|
+
const T = "Webkit Moz O ms".split(" ");
|
|
1848
|
+
let P = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), w = "";
|
|
1849
|
+
{
|
|
1850
|
+
const y = document.createElement("fakeelement");
|
|
1851
|
+
if (y.style.animationName !== void 0 && (u = !0), u === !1) {
|
|
1852
|
+
for (let p = 0; p < T.length; p++)
|
|
1853
|
+
if (y.style[T[p] + "AnimationName"] !== void 0) {
|
|
1854
|
+
w = T[p], b = "-" + w.toLowerCase() + "-", r = P[p], u = !0;
|
|
1855
|
+
break;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
n = "resizeanim", e = "@" + b + "keyframes " + n + " { from { opacity: 0; } to { opacity: 0; } } ", o = b + "animation: 1ms " + n + "; ";
|
|
1860
|
+
}
|
|
1861
|
+
const m = function(u) {
|
|
1862
|
+
if (!u.getElementById("detectElementResize")) {
|
|
1863
|
+
const b = (e || "") + ".resize-triggers { " + (o || "") + '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%; }', T = u.head || u.getElementsByTagName("head")[0], P = u.createElement("style");
|
|
1864
|
+
P.id = "detectElementResize", P.type = "text/css", t != null && P.setAttribute("nonce", t), P.styleSheet ? P.styleSheet.cssText = b : P.appendChild(u.createTextNode(b)), T.appendChild(P);
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
return {
|
|
1868
|
+
addResizeListener: function(u, b) {
|
|
1869
|
+
if (a)
|
|
1870
|
+
u.attachEvent("onresize", b);
|
|
1871
|
+
else {
|
|
1872
|
+
if (!u.__resizeTriggers__) {
|
|
1873
|
+
const T = u.ownerDocument, P = le.getComputedStyle(u);
|
|
1874
|
+
P && P.position === "static" && (u.style.position = "relative"), m(T), u.__resizeLast__ = {}, u.__resizeListeners__ = [], (u.__resizeTriggers__ = T.createElement("div")).className = "resize-triggers";
|
|
1875
|
+
const w = T.createElement("div");
|
|
1876
|
+
w.className = "expand-trigger", w.appendChild(T.createElement("div"));
|
|
1877
|
+
const y = T.createElement("div");
|
|
1878
|
+
y.className = "contract-trigger", u.__resizeTriggers__.appendChild(w), u.__resizeTriggers__.appendChild(y), u.appendChild(u.__resizeTriggers__), c(u), u.addEventListener("scroll", d, !0), r && (u.__resizeTriggers__.__animationListener__ = function(f) {
|
|
1879
|
+
f.animationName === n && c(u);
|
|
1880
|
+
}, u.__resizeTriggers__.addEventListener(r, u.__resizeTriggers__.__animationListener__));
|
|
1881
|
+
}
|
|
1882
|
+
u.__resizeListeners__.push(b);
|
|
1883
|
+
}
|
|
1884
|
+
},
|
|
1885
|
+
removeResizeListener: function(u, b) {
|
|
1886
|
+
if (a)
|
|
1887
|
+
u.detachEvent("onresize", b);
|
|
1888
|
+
else if (u.__resizeListeners__.splice(u.__resizeListeners__.indexOf(b), 1), !u.__resizeListeners__.length) {
|
|
1889
|
+
u.removeEventListener("scroll", d, !0), u.__resizeTriggers__.__animationListener__ && (u.__resizeTriggers__.removeEventListener(r, u.__resizeTriggers__.__animationListener__), u.__resizeTriggers__.__animationListener__ = null);
|
|
1890
|
+
try {
|
|
1891
|
+
u.__resizeTriggers__ = !u.removeChild(u.__resizeTriggers__);
|
|
1892
|
+
} catch {
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
class mi extends co {
|
|
1899
|
+
constructor(...e) {
|
|
1900
|
+
super(...e), this.state = {
|
|
1901
|
+
height: this.props.defaultHeight || 0,
|
|
1902
|
+
width: this.props.defaultWidth || 0
|
|
1903
|
+
}, this._autoSizer = null, this._detectElementResize = null, this._didLogDeprecationWarning = !1, this._parentNode = null, this._resizeObserver = null, this._timeoutId = null, this._onResize = () => {
|
|
1904
|
+
this._timeoutId = null;
|
|
1905
|
+
const {
|
|
1906
|
+
disableHeight: n,
|
|
1907
|
+
disableWidth: r,
|
|
1908
|
+
onResize: o
|
|
1909
|
+
} = this.props;
|
|
1910
|
+
if (this._parentNode) {
|
|
1911
|
+
const s = window.getComputedStyle(this._parentNode) || {}, c = parseFloat(s.paddingLeft || "0"), d = parseFloat(s.paddingRight || "0"), a = parseFloat(s.paddingTop || "0"), m = parseFloat(s.paddingBottom || "0"), g = this._parentNode.getBoundingClientRect(), C = g.height - a - m, u = g.width - c - d;
|
|
1912
|
+
if (!n && this.state.height !== C || !r && this.state.width !== u) {
|
|
1913
|
+
this.setState({
|
|
1914
|
+
height: C,
|
|
1915
|
+
width: u
|
|
1916
|
+
});
|
|
1917
|
+
const b = () => {
|
|
1918
|
+
this._didLogDeprecationWarning || (this._didLogDeprecationWarning = !0, console.warn("scaledWidth and scaledHeight parameters have been deprecated; use width and height instead"));
|
|
1919
|
+
};
|
|
1920
|
+
typeof o == "function" && o({
|
|
1921
|
+
height: C,
|
|
1922
|
+
width: u,
|
|
1923
|
+
// TODO Remove these params in the next major release
|
|
1924
|
+
get scaledHeight() {
|
|
1925
|
+
return b(), C;
|
|
1926
|
+
},
|
|
1927
|
+
get scaledWidth() {
|
|
1928
|
+
return b(), u;
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
}, this._setRef = (n) => {
|
|
1934
|
+
this._autoSizer = n;
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
componentDidMount() {
|
|
1938
|
+
const {
|
|
1939
|
+
nonce: e
|
|
1940
|
+
} = this.props, n = this._autoSizer ? this._autoSizer.parentNode : null;
|
|
1941
|
+
if (n != null && n.ownerDocument && n.ownerDocument.defaultView && n instanceof n.ownerDocument.defaultView.HTMLElement) {
|
|
1942
|
+
this._parentNode = n;
|
|
1943
|
+
const r = n.ownerDocument.defaultView.ResizeObserver;
|
|
1944
|
+
r != null ? (this._resizeObserver = new r(() => {
|
|
1945
|
+
this._timeoutId = setTimeout(this._onResize, 0);
|
|
1946
|
+
}), this._resizeObserver.observe(n)) : (this._detectElementResize = fi(e), this._detectElementResize.addResizeListener(n, this._onResize)), this._onResize();
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
componentWillUnmount() {
|
|
1950
|
+
this._parentNode && (this._detectElementResize && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize), this._timeoutId !== null && clearTimeout(this._timeoutId), this._resizeObserver && this._resizeObserver.disconnect());
|
|
1951
|
+
}
|
|
1952
|
+
render() {
|
|
1953
|
+
const {
|
|
1954
|
+
children: e,
|
|
1955
|
+
defaultHeight: n,
|
|
1956
|
+
defaultWidth: r,
|
|
1957
|
+
disableHeight: o = !1,
|
|
1958
|
+
disableWidth: s = !1,
|
|
1959
|
+
doNotBailOutOnEmptyChildren: c = !1,
|
|
1960
|
+
nonce: d,
|
|
1961
|
+
onResize: a,
|
|
1962
|
+
style: m = {},
|
|
1963
|
+
tagName: g = "div",
|
|
1964
|
+
...C
|
|
1965
|
+
} = this.props, {
|
|
1966
|
+
height: u,
|
|
1967
|
+
width: b
|
|
1968
|
+
} = this.state, T = {
|
|
1969
|
+
overflow: "visible"
|
|
1970
|
+
}, P = {};
|
|
1971
|
+
let w = !1;
|
|
1972
|
+
return o || (u === 0 && (w = !0), T.height = 0, P.height = u, P.scaledHeight = u), s || (b === 0 && (w = !0), T.width = 0, P.width = b, P.scaledWidth = b), c && (w = !1), Ke(g, {
|
|
1973
|
+
ref: this._setRef,
|
|
1974
|
+
style: {
|
|
1975
|
+
...T,
|
|
1976
|
+
...m
|
|
1977
|
+
},
|
|
1978
|
+
...C
|
|
1979
|
+
}, !w && e(P));
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
const gi = un(({ widths: t, heights: e }) => {
|
|
1983
|
+
const { focusedPage: n, totalPages: r } = ue(), o = k(() => {
|
|
1984
|
+
const d = [], a = Math.ceil(n / 2) * 2 - 1;
|
|
1985
|
+
if (d.push(a), a + 1 <= r) {
|
|
1986
|
+
const m = a + 1;
|
|
1987
|
+
d.push(m);
|
|
1988
|
+
}
|
|
1989
|
+
return d;
|
|
1990
|
+
}, [n, r]), s = k(() => {
|
|
1991
|
+
const d = n % 2 === 1 ? n - 1 : n - 2, a = Math.floor(d / 2), m = e(a), g = t(d), C = t(d + 1);
|
|
1992
|
+
return [
|
|
1993
|
+
{
|
|
1994
|
+
position: "absolute",
|
|
1995
|
+
left: 0,
|
|
1996
|
+
width: g,
|
|
1997
|
+
height: m
|
|
1998
|
+
},
|
|
1999
|
+
{
|
|
2000
|
+
position: "absolute",
|
|
2001
|
+
left: g,
|
|
2002
|
+
width: C,
|
|
2003
|
+
height: m
|
|
2004
|
+
}
|
|
2005
|
+
];
|
|
2006
|
+
}, [t, e, o]), c = k(() => s.reduce((d, a) => d + Number(a.width || 0), 0), [s]);
|
|
2007
|
+
return /* @__PURE__ */ i("div", { style: { width: c, position: "relative" }, children: o.map((d, a) => /* @__PURE__ */ i(Nt, { style: s[a], pageNumber: d }, d)) });
|
|
2008
|
+
}), vi = ({ widths: t, heights: e }) => {
|
|
2009
|
+
const { focusedPage: n } = ue(), r = k(() => ({
|
|
2010
|
+
position: "absolute",
|
|
2011
|
+
width: t(n - 1),
|
|
2012
|
+
height: e(n - 1)
|
|
2013
|
+
}), [t, e, n]), o = k(() => t(n - 1), [t]);
|
|
2014
|
+
return /* @__PURE__ */ i(
|
|
2015
|
+
"div",
|
|
2016
|
+
{
|
|
2017
|
+
style: {
|
|
2018
|
+
width: o,
|
|
2019
|
+
position: "relative"
|
|
2020
|
+
},
|
|
2021
|
+
children: /* @__PURE__ */ i(Nt, { style: r, pageNumber: n }, n)
|
|
2022
|
+
}
|
|
2023
|
+
);
|
|
2024
|
+
}, wi = (t, e, n) => {
|
|
2025
|
+
const r = M(), { contentRef: o } = Te(), { heights: s, widths: c } = Ze(), { setFocusedPage: d } = ue(), [a, m] = $([]), { targetScrollPage: g } = fn(), C = xt(a, 0, 500), u = k(() => {
|
|
2026
|
+
const { rowsHeight: T, columnsWidth: P } = St({ heights: s, widths: c }, t);
|
|
2027
|
+
return s.map((w, y) => {
|
|
2028
|
+
const p = c[y], f = ir(y + 1, t), h = P.slice(0, f.columnIndex).reduce((I, x) => I + x, 0), l = T.slice(0, f.rowIndex).reduce((I, x) => I + x, 0), v = h + p, _ = l + w;
|
|
2029
|
+
return {
|
|
2030
|
+
pageNumber: y + 1,
|
|
2031
|
+
...f,
|
|
2032
|
+
width: p,
|
|
2033
|
+
height: w,
|
|
2034
|
+
startX: h,
|
|
2035
|
+
startY: l,
|
|
2036
|
+
endX: v,
|
|
2037
|
+
endY: _
|
|
2038
|
+
};
|
|
2039
|
+
});
|
|
2040
|
+
}, [s, c, t, e]);
|
|
2041
|
+
z(() => {
|
|
2042
|
+
var P;
|
|
2043
|
+
C.length > 0 && !g.current && d(C[0].pageNumber), ((P = C[0]) == null ? void 0 : P.ratio) && C.some((w) => w.pageNumber === g.current) && setTimeout(() => {
|
|
2044
|
+
g.current = void 0;
|
|
2045
|
+
}, 500);
|
|
2046
|
+
}, [C, d]);
|
|
2047
|
+
const b = N(
|
|
2048
|
+
(T) => {
|
|
2049
|
+
r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
|
|
2050
|
+
const P = T.target, w = {
|
|
2051
|
+
startTop: P.scrollTop,
|
|
2052
|
+
startLeft: P.scrollLeft,
|
|
2053
|
+
endTop: P.scrollTop + P.clientHeight,
|
|
2054
|
+
endLeft: P.scrollLeft + P.clientWidth
|
|
2055
|
+
}, y = u.filter((p) => {
|
|
2056
|
+
const f = p.endX >= w.startLeft && p.endY >= w.startTop, h = p.startX <= w.endLeft && p.startY <= w.endTop;
|
|
2057
|
+
return f && h;
|
|
2058
|
+
}).map((p) => {
|
|
2059
|
+
const f = w.startLeft > p.startX ? w.startLeft : p.startX, h = w.startTop > p.startY ? w.startTop : p.startY, l = w.endLeft < p.endX ? w.endLeft : p.endX, v = w.endTop < p.endY ? w.endTop : p.endY, _ = l - f, I = v - h, S = +(_ * I / (p.width * p.height) * 100).toFixed(2);
|
|
2060
|
+
return {
|
|
2061
|
+
pageNumber: p.pageNumber,
|
|
2062
|
+
ratio: S
|
|
2063
|
+
};
|
|
2064
|
+
}).sort((p, f) => f.ratio - p.ratio);
|
|
2065
|
+
m(y);
|
|
2066
|
+
});
|
|
2067
|
+
},
|
|
2068
|
+
[o, u]
|
|
2069
|
+
);
|
|
2070
|
+
z(() => {
|
|
2071
|
+
if (n)
|
|
2072
|
+
return n == null || n.addEventListener("scroll", b), () => {
|
|
2073
|
+
n == null || n.removeEventListener("scroll", b);
|
|
2074
|
+
};
|
|
2075
|
+
}, [n, b]);
|
|
2076
|
+
}, Nn = rt((t, e) => {
|
|
2077
|
+
const { children: n, toolbarRef: r, style: o, className: s, ...c } = t, { customVariables: d, customDarkVariables: a } = Wo(), { darkMode: m } = mo();
|
|
2078
|
+
return /* @__PURE__ */ i(
|
|
2079
|
+
"div",
|
|
2080
|
+
{
|
|
2081
|
+
ref: e,
|
|
2082
|
+
...c,
|
|
2083
|
+
className: se(
|
|
2084
|
+
Pe["rp-theme-variables"],
|
|
2085
|
+
Pe["rp-container"],
|
|
2086
|
+
m ? Pe["rp-dark-mode"] : "",
|
|
2087
|
+
s
|
|
2088
|
+
),
|
|
2089
|
+
style: {
|
|
2090
|
+
"--rp-toolbar-height": `${(r == null ? void 0 : r.clientHeight) || 48}px`,
|
|
2091
|
+
...d,
|
|
2092
|
+
...m ? a : {},
|
|
2093
|
+
...o
|
|
2094
|
+
},
|
|
2095
|
+
children: n
|
|
2096
|
+
}
|
|
2097
|
+
);
|
|
2098
|
+
}), _i = un(({ columnIndex: t, rowIndex: e, data: n, style: r }) => {
|
|
2099
|
+
const o = sr(e, t, n.columnCount);
|
|
2100
|
+
return /* @__PURE__ */ i(Nt, { style: r, pageNumber: o }, o);
|
|
2101
|
+
}, pi), vc = () => {
|
|
2102
|
+
const { initialPage: t = 1, initialScrollMode: e, instanceId: n } = wo(), { pagesRef: r, setPagesRef: o, setContentRef: s } = Te(), { scrollToPage: c } = bn(), {
|
|
2103
|
+
virtualScrollRef: d,
|
|
2104
|
+
getVirtualScrollRef: a,
|
|
2105
|
+
getPageScrollElementRef: m,
|
|
2106
|
+
getVirtualScrollableElementRef: g,
|
|
2107
|
+
setTotalInnerDimensions: C,
|
|
2108
|
+
virtualScrollableElementRef: u,
|
|
2109
|
+
totalInnerDimensions: b,
|
|
2110
|
+
pageScrollElementRef: T
|
|
2111
|
+
} = nt(), P = M(!0), { nextPage: w, prevPage: y, setFocusedPage: p, focusedPage: f } = ue(), { scrollMode: h } = De(), { viewMode: l } = Me(), v = M(null), { loading: _, error: I } = re(), { passwordRequired: x } = fo(), { LoaderImageComponent: S } = Pt(), L = M(
|
|
2112
|
+
b
|
|
2113
|
+
), O = M({
|
|
2114
|
+
viewMode: l,
|
|
2115
|
+
scrollMode: h
|
|
2116
|
+
}), D = M(!1), F = M(), { isFullScreen: E } = _o(), {
|
|
2117
|
+
pageDimension: R,
|
|
2118
|
+
rowCount: A,
|
|
2119
|
+
rowHeight: G,
|
|
2120
|
+
columnCount: H,
|
|
2121
|
+
columnWidth: U,
|
|
2122
|
+
estimatedColumnWidth: X,
|
|
2123
|
+
estimatedRowHeight: V,
|
|
2124
|
+
totalDimension: ie
|
|
2125
|
+
} = hi(), q = xt(b, 100), { onScroll: Z } = Eo(), Y = M();
|
|
2126
|
+
wi(H, A, u);
|
|
2127
|
+
const te = M({
|
|
2128
|
+
scrollTop: 0,
|
|
2129
|
+
scrollLeft: 0
|
|
2130
|
+
});
|
|
2131
|
+
lr(r);
|
|
2132
|
+
const { isPressed: J } = ar(), { selectionMode: ee } = vo(), { initializeGrabScroll: ve, resetGrabState: we } = cr({
|
|
2133
|
+
isPressed: J
|
|
2134
|
+
}), pe = k(() => ee === po.HAND, [ee]), at = k(() => ({
|
|
2135
|
+
columnCount: H
|
|
2136
|
+
}), [H]), He = N(
|
|
2137
|
+
(B) => {
|
|
2138
|
+
const j = document.activeElement !== r;
|
|
2139
|
+
!E && j || (["ArrowUp", "ArrowLeft"].includes(B.key) ? (B.preventDefault(), y()) : ["ArrowDown", "ArrowRight"].includes(B.key) && (B.preventDefault(), w()));
|
|
2140
|
+
},
|
|
2141
|
+
[w, y, E, h]
|
|
2142
|
+
);
|
|
2143
|
+
z(() => (window.addEventListener("keydown", He), () => {
|
|
2144
|
+
window.removeEventListener("keydown", He);
|
|
2145
|
+
}), [He]), z(() => {
|
|
2146
|
+
if (v.current && (v.current.style.position = "relative"), !!d)
|
|
2147
|
+
for (let B = 0; B < A; B++)
|
|
2148
|
+
for (let j = 0; j < H; j++)
|
|
2149
|
+
d.resetAfterIndices({
|
|
2150
|
+
columnIndex: j,
|
|
2151
|
+
rowIndex: B,
|
|
2152
|
+
shouldForceUpdate: !0
|
|
2153
|
+
});
|
|
2154
|
+
}, [A, H, R, d]);
|
|
2155
|
+
const Jn = N(
|
|
2156
|
+
(B, j) => {
|
|
2157
|
+
if (!u)
|
|
2158
|
+
return { scrollTop: 0, scrollLeft: 0 };
|
|
2159
|
+
const xe = te.current.scrollTop > j, Re = te.current.scrollLeft > B;
|
|
2160
|
+
return xe || Re ? te.current : {
|
|
2161
|
+
scrollTop: u.scrollTop,
|
|
2162
|
+
scrollLeft: u.scrollLeft
|
|
2163
|
+
};
|
|
2164
|
+
},
|
|
2165
|
+
[u]
|
|
2166
|
+
), At = N(
|
|
2167
|
+
(B, j) => {
|
|
2168
|
+
if (O.current.viewMode !== l || O.current.scrollMode !== h) {
|
|
2169
|
+
Y.current && clearTimeout(Y.current), D.current = !0, c(f, "auto"), Y.current = setTimeout(() => {
|
|
2170
|
+
requestAnimationFrame(() => {
|
|
2171
|
+
O.current = { viewMode: l, scrollMode: h };
|
|
2172
|
+
});
|
|
2173
|
+
}, 100);
|
|
2174
|
+
return;
|
|
2175
|
+
}
|
|
2176
|
+
const Re = B.scrollTop, ct = B.scrollLeft;
|
|
2177
|
+
if (!j.height || !j.width)
|
|
2178
|
+
return;
|
|
2179
|
+
D.current = !0;
|
|
2180
|
+
const { height: Le, width: lt } = j, { height: Ft, width: kt } = L.current;
|
|
2181
|
+
if (Ft === Le && kt === lt)
|
|
2182
|
+
return;
|
|
2183
|
+
const oo = Re / Ft * Le, ro = ct / kt * lt, io = Math.round(Math.min(oo, Le)) || 0, so = Math.round(Math.min(ro, lt)) || 0;
|
|
2184
|
+
F.current = setTimeout(() => {
|
|
2185
|
+
requestAnimationFrame(() => {
|
|
2186
|
+
u == null || u.scrollTo({
|
|
2187
|
+
top: io,
|
|
2188
|
+
left: so,
|
|
2189
|
+
behavior: "auto"
|
|
2190
|
+
});
|
|
2191
|
+
});
|
|
2192
|
+
}, 0), L.current = {
|
|
2193
|
+
height: j.height,
|
|
2194
|
+
width: j.width
|
|
2195
|
+
};
|
|
2196
|
+
},
|
|
2197
|
+
[u, l, h, c]
|
|
2198
|
+
);
|
|
2199
|
+
z(() => {
|
|
2200
|
+
clearTimeout(F.current);
|
|
2201
|
+
const B = Array.from({ length: A }).reduce(
|
|
2202
|
+
(Re, ct, Le) => Re + G(Le),
|
|
2203
|
+
0
|
|
2204
|
+
), j = Array.from({ length: H }).reduce(
|
|
2205
|
+
(Re, ct, Le) => Re + U(Le),
|
|
2206
|
+
0
|
|
2207
|
+
), xe = Jn(j, B);
|
|
2208
|
+
te.current = xe, At(xe, { height: B, width: j }), C({
|
|
2209
|
+
height: B,
|
|
2210
|
+
width: j
|
|
2211
|
+
});
|
|
2212
|
+
}, [R, A, H, At]);
|
|
2213
|
+
const eo = N(
|
|
2214
|
+
(B) => {
|
|
2215
|
+
te.current = {
|
|
2216
|
+
scrollTop: B.scrollTop,
|
|
2217
|
+
scrollLeft: B.scrollLeft
|
|
2218
|
+
};
|
|
2219
|
+
},
|
|
2220
|
+
[u]
|
|
2221
|
+
);
|
|
2222
|
+
z(() => {
|
|
2223
|
+
if (Z)
|
|
2224
|
+
return T && T.addEventListener("scroll", Z), u && u.addEventListener("scroll", Z), () => {
|
|
2225
|
+
T == null || T.removeEventListener("scroll", Z), u == null || u.removeEventListener("scroll", Z);
|
|
2226
|
+
};
|
|
2227
|
+
}, [u, T, Z]), z(() => () => {
|
|
2228
|
+
Y.current && clearTimeout(Y.current);
|
|
2229
|
+
}, []);
|
|
2230
|
+
const to = k(() => se(ae["rp-pages-container"], {
|
|
2231
|
+
[ae["rp-cursor-grab"]]: pe && !J,
|
|
2232
|
+
[ae["rp-cursor-grabbing"]]: pe && J
|
|
2233
|
+
}), [pe, J]), no = N(
|
|
2234
|
+
(B) => {
|
|
2235
|
+
if (pe && B) {
|
|
2236
|
+
const j = se(ae["rp-pages"]), xe = document.querySelector(`.${j}`);
|
|
2237
|
+
ve(xe);
|
|
2238
|
+
}
|
|
2239
|
+
},
|
|
2240
|
+
[pe, ve, ae]
|
|
2241
|
+
);
|
|
2242
|
+
return z(() => {
|
|
2243
|
+
_ && we();
|
|
2244
|
+
}, [_]), z(() => {
|
|
2245
|
+
if (!(q.height === 0 || !P.current)) {
|
|
2246
|
+
if (e === oe.PAGE_SCROLLING) {
|
|
2247
|
+
t !== f && T && p(t), P.current = !1;
|
|
2248
|
+
return;
|
|
2249
|
+
}
|
|
2250
|
+
c(t, "auto"), p(t), P.current = !1;
|
|
2251
|
+
}
|
|
2252
|
+
}, [
|
|
2253
|
+
c,
|
|
2254
|
+
e,
|
|
2255
|
+
T,
|
|
2256
|
+
p,
|
|
2257
|
+
q
|
|
2258
|
+
]), /* @__PURE__ */ W(he, { children: [
|
|
2259
|
+
/* @__PURE__ */ i(ko, { ref: s, children: /* @__PURE__ */ i(
|
|
2260
|
+
Nn,
|
|
2261
|
+
{
|
|
2262
|
+
id: n,
|
|
2263
|
+
ref: o,
|
|
2264
|
+
tabIndex: -1,
|
|
2265
|
+
className: to,
|
|
2266
|
+
children: /* @__PURE__ */ i(mi, { style: { minHeight: "50px" }, children: ({ width: B, height: j }) => /* @__PURE__ */ i("div", { "data-rp": "pages", ref: no, style: { width: B, height: j }, children: h === oe.PAGE_SCROLLING ? /* @__PURE__ */ i(
|
|
2267
|
+
"div",
|
|
2268
|
+
{
|
|
2269
|
+
ref: m,
|
|
2270
|
+
style: { width: B, height: j },
|
|
2271
|
+
className: se(ae["rp-pages"], ae["rp-page-scrolling-wrapper"]),
|
|
2272
|
+
children: l === Ne.DUAL_PAGE ? /* @__PURE__ */ i(gi, { widths: U, heights: G }) : /* @__PURE__ */ i(vi, { widths: U, heights: G })
|
|
2273
|
+
}
|
|
2274
|
+
) : V ? /* @__PURE__ */ i(
|
|
2275
|
+
li,
|
|
2276
|
+
{
|
|
2277
|
+
ref: a,
|
|
2278
|
+
itemData: at,
|
|
2279
|
+
outerRef: g,
|
|
2280
|
+
innerRef: v,
|
|
2281
|
+
onScroll: eo,
|
|
2282
|
+
columnCount: H,
|
|
2283
|
+
columnWidth: U,
|
|
2284
|
+
rowHeight: G,
|
|
2285
|
+
height: j,
|
|
2286
|
+
width: B,
|
|
2287
|
+
estimatedColumnWidth: X,
|
|
2288
|
+
estimatedRowHeight: V,
|
|
2289
|
+
rowCount: A,
|
|
2290
|
+
className: se(
|
|
2291
|
+
ae["rp-pages"],
|
|
2292
|
+
h === oe.HORIZONTAL_SCROLLING ? ae["rp-pages-horizontal-scroll"] : ""
|
|
2293
|
+
),
|
|
2294
|
+
style: {
|
|
2295
|
+
"--rp-pages-height": `${ie.height}px`,
|
|
2296
|
+
"--rp-pages-width": `${ie.width}px`,
|
|
2297
|
+
"--rp-row-count": `${A}`,
|
|
2298
|
+
"--rp-column-count": `${H}`
|
|
2299
|
+
},
|
|
2300
|
+
children: _i
|
|
2301
|
+
}
|
|
2302
|
+
) : !_ && !I ? /* @__PURE__ */ i(
|
|
2303
|
+
"div",
|
|
2304
|
+
{
|
|
2305
|
+
className: ae["rp-loader"],
|
|
2306
|
+
style: {
|
|
2307
|
+
display: "flex",
|
|
2308
|
+
justifyContent: "center",
|
|
2309
|
+
alignItems: "center",
|
|
2310
|
+
height: "100%",
|
|
2311
|
+
width: "100%"
|
|
2312
|
+
},
|
|
2313
|
+
children: S && /* @__PURE__ */ i(S, {})
|
|
2314
|
+
}
|
|
2315
|
+
) : I === ho.NOT_SUPPORTED ? /* @__PURE__ */ i("div", { className: ae["rp-not-supported"], children: /* @__PURE__ */ W("div", { className: ae["rp-not-supported-content"], children: [
|
|
2316
|
+
"React PDF is unable to render on this browser. Please use the supported browsers from the list below:",
|
|
2317
|
+
/* @__PURE__ */ i("div", { children: /* @__PURE__ */ W("ul", { children: [
|
|
2318
|
+
/* @__PURE__ */ i("li", { children: "Chrome 110+" }),
|
|
2319
|
+
/* @__PURE__ */ i("li", { children: "Edge 115+" }),
|
|
2320
|
+
/* @__PURE__ */ i("li", { children: "Firefox 115+" }),
|
|
2321
|
+
/* @__PURE__ */ i("li", { children: "Safari 16.5+" }),
|
|
2322
|
+
/* @__PURE__ */ i("li", { children: "Safari iOS 16.5+" }),
|
|
2323
|
+
/* @__PURE__ */ i("li", { children: "Chrome Android 126+" })
|
|
2324
|
+
] }) })
|
|
2325
|
+
] }) }) : null }) })
|
|
2326
|
+
}
|
|
2327
|
+
) }),
|
|
2328
|
+
x && /* @__PURE__ */ i(dr, {})
|
|
2329
|
+
] });
|
|
2330
|
+
}, $e = {
|
|
2331
|
+
"rp-toolbar-content": "_rp-toolbar-content_sz31z_1",
|
|
2332
|
+
"rp-toolbar-wrapper": "_rp-toolbar-wrapper_sz31z_10",
|
|
2333
|
+
"rp-toolbar-start": "_rp-toolbar-start_sz31z_33",
|
|
2334
|
+
"rp-toolbar-middle": "_rp-toolbar-middle_sz31z_39",
|
|
2335
|
+
"rp-toolbar-end": "_rp-toolbar-end_sz31z_46"
|
|
2336
|
+
}, vt = {
|
|
2337
|
+
"rp-paginate": "_rp-paginate_1gck0_1",
|
|
2338
|
+
"rp-page-input": "_rp-page-input_1gck0_6",
|
|
2339
|
+
"rp-total-page": "_rp-total-page_1gck0_18"
|
|
2340
|
+
}, bi = () => {
|
|
2341
|
+
const { prevIcon: t } = ge(), { prevIcon: e } = me();
|
|
2342
|
+
return t || e || /* @__PURE__ */ i(Ue, {});
|
|
2343
|
+
}, Ti = () => {
|
|
2344
|
+
const { nextIcon: t } = ge(), { nextIcon: e } = me();
|
|
2345
|
+
return t || e || /* @__PURE__ */ i(Ue, { style: { transform: "rotate(180deg" } });
|
|
2346
|
+
}, Ci = () => {
|
|
2347
|
+
const { focusedPage: t, totalPages: e, setFocusedPage: n, nextPage: r, prevPage: o, goToPage: s } = ue(), [c, d] = $(t.toString()), { pageNavigationTool: a = !0 } = Ce(), { pageNavigationTool: m = !0 } = Ie(), { isSmallScreen: g } = Se(), { viewMode: C } = Me(), { scrollMode: u } = De(), { localeMessages: b } = de();
|
|
2348
|
+
z(() => {
|
|
2349
|
+
d(t.toString());
|
|
2350
|
+
}, [t]);
|
|
2351
|
+
const T = N((f) => {
|
|
2352
|
+
const h = f.target.value;
|
|
2353
|
+
d(h);
|
|
2354
|
+
}, []), P = N(async () => {
|
|
2355
|
+
const f = s(c);
|
|
2356
|
+
f.success || d(f.currentPage.toString());
|
|
2357
|
+
}, [s, c, e]), w = N(() => {
|
|
2358
|
+
d(t.toString());
|
|
2359
|
+
}, [t]), y = N(
|
|
2360
|
+
(f) => {
|
|
2361
|
+
f.key === "Enter" && P();
|
|
2362
|
+
},
|
|
2363
|
+
[P]
|
|
2364
|
+
), p = k(() => C === Ne.DUAL_PAGE && u === oe.PAGE_SCROLLING && t === e - 1 || t === e, [t, e, C, u]);
|
|
2365
|
+
return !a || !m ? null : typeof a != "boolean" ? /* @__PURE__ */ i(
|
|
2366
|
+
a,
|
|
2367
|
+
{
|
|
2368
|
+
total: e,
|
|
2369
|
+
current: t,
|
|
2370
|
+
nextPage: r,
|
|
2371
|
+
prevPage: o,
|
|
2372
|
+
goToPage: s,
|
|
2373
|
+
changePage: n
|
|
2374
|
+
}
|
|
2375
|
+
) : typeof m != "boolean" ? /* @__PURE__ */ i(
|
|
2376
|
+
m,
|
|
2377
|
+
{
|
|
2378
|
+
total: e,
|
|
2379
|
+
current: t,
|
|
2380
|
+
nextPage: r,
|
|
2381
|
+
prevPage: o,
|
|
2382
|
+
goToPage: s,
|
|
2383
|
+
changePage: n
|
|
2384
|
+
}
|
|
2385
|
+
) : /* @__PURE__ */ W("div", { className: vt["rp-paginate"], children: [
|
|
2386
|
+
!g && /* @__PURE__ */ i(K, { content: b == null ? void 0 : b.previousPageTooltip, children: /* @__PURE__ */ i(
|
|
2387
|
+
ce,
|
|
2388
|
+
{
|
|
2389
|
+
onClick: o,
|
|
2390
|
+
"aria-label": b == null ? void 0 : b.previousPageTooltip,
|
|
2391
|
+
"aria-disabled": t === 1,
|
|
2392
|
+
children: /* @__PURE__ */ i(bi, {})
|
|
2393
|
+
}
|
|
2394
|
+
) }),
|
|
2395
|
+
/* @__PURE__ */ i(K, { content: b == null ? void 0 : b.currentPageTooltip, children: /* @__PURE__ */ i(
|
|
2396
|
+
pn,
|
|
2397
|
+
{
|
|
2398
|
+
onKeyDown: y,
|
|
2399
|
+
onBlur: w,
|
|
2400
|
+
onChange: T,
|
|
2401
|
+
value: c,
|
|
2402
|
+
className: vt["rp-page-input"],
|
|
2403
|
+
id: "page-input",
|
|
2404
|
+
name: "page-input"
|
|
2405
|
+
}
|
|
2406
|
+
) }),
|
|
2407
|
+
/* @__PURE__ */ W("span", { className: vt["rp-total-page"], children: [
|
|
2408
|
+
"/",
|
|
2409
|
+
e
|
|
2410
|
+
] }),
|
|
2411
|
+
!g && /* @__PURE__ */ i(K, { content: b == null ? void 0 : b.nextPageTooltip, children: /* @__PURE__ */ i(
|
|
2412
|
+
ce,
|
|
2413
|
+
{
|
|
2414
|
+
onClick: r,
|
|
2415
|
+
"aria-label": b == null ? void 0 : b.nextPageTooltip,
|
|
2416
|
+
"aria-disabled": p,
|
|
2417
|
+
children: /* @__PURE__ */ i(Ti, {})
|
|
2418
|
+
}
|
|
2419
|
+
) })
|
|
2420
|
+
] });
|
|
2421
|
+
};
|
|
2422
|
+
var st = "Dialog", [On, wc] = gr(st), [Pi, fe] = On(st), Dn = (t) => {
|
|
2423
|
+
const {
|
|
2424
|
+
__scopeDialog: e,
|
|
2425
|
+
children: n,
|
|
2426
|
+
open: r,
|
|
2427
|
+
defaultOpen: o,
|
|
2428
|
+
onOpenChange: s,
|
|
2429
|
+
modal: c = !0
|
|
2430
|
+
} = t, d = Q.useRef(null), a = Q.useRef(null), [m, g] = wr({
|
|
2431
|
+
prop: r,
|
|
2432
|
+
defaultProp: o ?? !1,
|
|
2433
|
+
onChange: s,
|
|
2434
|
+
caller: st
|
|
2435
|
+
});
|
|
2436
|
+
return /* @__PURE__ */ i(
|
|
2437
|
+
Pi,
|
|
2438
|
+
{
|
|
2439
|
+
scope: e,
|
|
2440
|
+
triggerRef: d,
|
|
2441
|
+
contentRef: a,
|
|
2442
|
+
contentId: ut(),
|
|
2443
|
+
titleId: ut(),
|
|
2444
|
+
descriptionId: ut(),
|
|
2445
|
+
open: m,
|
|
2446
|
+
onOpenChange: g,
|
|
2447
|
+
onOpenToggle: Q.useCallback(() => g((C) => !C), [g]),
|
|
2448
|
+
modal: c,
|
|
2449
|
+
children: n
|
|
2450
|
+
}
|
|
2451
|
+
);
|
|
2452
|
+
};
|
|
2453
|
+
Dn.displayName = st;
|
|
2454
|
+
var zn = "DialogTrigger", yi = Q.forwardRef(
|
|
2455
|
+
(t, e) => {
|
|
2456
|
+
const { __scopeDialog: n, ...r } = t, o = fe(zn, n), s = Rt(e, o.triggerRef);
|
|
2457
|
+
return /* @__PURE__ */ i(
|
|
2458
|
+
je.button,
|
|
2459
|
+
{
|
|
2460
|
+
type: "button",
|
|
2461
|
+
"aria-haspopup": "dialog",
|
|
2462
|
+
"aria-expanded": o.open,
|
|
2463
|
+
"aria-controls": o.contentId,
|
|
2464
|
+
"data-state": zt(o.open),
|
|
2465
|
+
...r,
|
|
2466
|
+
ref: s,
|
|
2467
|
+
onClick: qe(t.onClick, o.onOpenToggle)
|
|
2468
|
+
}
|
|
2469
|
+
);
|
|
2470
|
+
}
|
|
2471
|
+
);
|
|
2472
|
+
yi.displayName = zn;
|
|
2473
|
+
var Ot = "DialogPortal", [Ii, An] = On(Ot, {
|
|
2474
|
+
forceMount: void 0
|
|
2475
|
+
}), Fn = (t) => {
|
|
2476
|
+
const { __scopeDialog: e, forceMount: n, children: r, container: o } = t, s = fe(Ot, e);
|
|
2477
|
+
return /* @__PURE__ */ i(Ii, { scope: e, forceMount: n, children: Q.Children.map(r, (c) => /* @__PURE__ */ i(Lt, { present: n || s.open, children: /* @__PURE__ */ i(Ir, { asChild: !0, container: o, children: c }) })) });
|
|
2478
|
+
};
|
|
2479
|
+
Fn.displayName = Ot;
|
|
2480
|
+
var et = "DialogOverlay", kn = Q.forwardRef(
|
|
2481
|
+
(t, e) => {
|
|
2482
|
+
const n = An(et, t.__scopeDialog), { forceMount: r = n.forceMount, ...o } = t, s = fe(et, t.__scopeDialog);
|
|
2483
|
+
return s.modal ? /* @__PURE__ */ i(Lt, { present: r || s.open, children: /* @__PURE__ */ i(xi, { ...o, ref: e }) }) : null;
|
|
2484
|
+
}
|
|
2485
|
+
);
|
|
2486
|
+
kn.displayName = et;
|
|
2487
|
+
var Si = _r("DialogOverlay.RemoveScroll"), xi = Q.forwardRef(
|
|
2488
|
+
(t, e) => {
|
|
2489
|
+
const { __scopeDialog: n, ...r } = t, o = fe(et, n);
|
|
2490
|
+
return (
|
|
2491
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
2492
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
2493
|
+
/* @__PURE__ */ i(Tr, { as: Si, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ i(
|
|
2494
|
+
je.div,
|
|
2495
|
+
{
|
|
2496
|
+
"data-state": zt(o.open),
|
|
2497
|
+
...r,
|
|
2498
|
+
ref: e,
|
|
2499
|
+
style: { pointerEvents: "auto", ...r.style }
|
|
2500
|
+
}
|
|
2501
|
+
) })
|
|
2502
|
+
);
|
|
2503
|
+
}
|
|
2504
|
+
), Oe = "DialogContent", Wn = Q.forwardRef(
|
|
2505
|
+
(t, e) => {
|
|
2506
|
+
const n = An(Oe, t.__scopeDialog), { forceMount: r = n.forceMount, ...o } = t, s = fe(Oe, t.__scopeDialog);
|
|
2507
|
+
return /* @__PURE__ */ i(Lt, { present: r || s.open, children: s.modal ? /* @__PURE__ */ i(Ri, { ...o, ref: e }) : /* @__PURE__ */ i(Li, { ...o, ref: e }) });
|
|
2508
|
+
}
|
|
2509
|
+
);
|
|
2510
|
+
Wn.displayName = Oe;
|
|
2511
|
+
var Ri = Q.forwardRef(
|
|
2512
|
+
(t, e) => {
|
|
2513
|
+
const n = fe(Oe, t.__scopeDialog), r = Q.useRef(null), o = Rt(e, n.contentRef, r);
|
|
2514
|
+
return Q.useEffect(() => {
|
|
2515
|
+
const s = r.current;
|
|
2516
|
+
if (s)
|
|
2517
|
+
return Cr(s);
|
|
2518
|
+
}, []), /* @__PURE__ */ i(
|
|
2519
|
+
Mn,
|
|
2520
|
+
{
|
|
2521
|
+
...t,
|
|
2522
|
+
ref: o,
|
|
2523
|
+
trapFocus: n.open,
|
|
2524
|
+
disableOutsidePointerEvents: !0,
|
|
2525
|
+
onCloseAutoFocus: qe(t.onCloseAutoFocus, (s) => {
|
|
2526
|
+
var c;
|
|
2527
|
+
s.preventDefault(), (c = n.triggerRef.current) == null || c.focus();
|
|
2528
|
+
}),
|
|
2529
|
+
onPointerDownOutside: qe(t.onPointerDownOutside, (s) => {
|
|
2530
|
+
const c = s.detail.originalEvent, d = c.button === 0 && c.ctrlKey === !0;
|
|
2531
|
+
(c.button === 2 || d) && s.preventDefault();
|
|
2532
|
+
}),
|
|
2533
|
+
onFocusOutside: qe(
|
|
2534
|
+
t.onFocusOutside,
|
|
2535
|
+
(s) => s.preventDefault()
|
|
2536
|
+
)
|
|
2537
|
+
}
|
|
2538
|
+
);
|
|
2539
|
+
}
|
|
2540
|
+
), Li = Q.forwardRef(
|
|
2541
|
+
(t, e) => {
|
|
2542
|
+
const n = fe(Oe, t.__scopeDialog), r = Q.useRef(!1), o = Q.useRef(!1);
|
|
2543
|
+
return /* @__PURE__ */ i(
|
|
2544
|
+
Mn,
|
|
2545
|
+
{
|
|
2546
|
+
...t,
|
|
2547
|
+
ref: e,
|
|
2548
|
+
trapFocus: !1,
|
|
2549
|
+
disableOutsidePointerEvents: !1,
|
|
2550
|
+
onCloseAutoFocus: (s) => {
|
|
2551
|
+
var c, d;
|
|
2552
|
+
(c = t.onCloseAutoFocus) == null || c.call(t, s), s.defaultPrevented || (r.current || (d = n.triggerRef.current) == null || d.focus(), s.preventDefault()), r.current = !1, o.current = !1;
|
|
2553
|
+
},
|
|
2554
|
+
onInteractOutside: (s) => {
|
|
2555
|
+
var a, m;
|
|
2556
|
+
(a = t.onInteractOutside) == null || a.call(t, s), s.defaultPrevented || (r.current = !0, s.detail.originalEvent.type === "pointerdown" && (o.current = !0));
|
|
2557
|
+
const c = s.target;
|
|
2558
|
+
((m = n.triggerRef.current) == null ? void 0 : m.contains(c)) && s.preventDefault(), s.detail.originalEvent.type === "focusin" && o.current && s.preventDefault();
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
);
|
|
2562
|
+
}
|
|
2563
|
+
), Mn = Q.forwardRef(
|
|
2564
|
+
(t, e) => {
|
|
2565
|
+
const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...c } = t, d = fe(Oe, n), a = Q.useRef(null), m = Rt(e, a);
|
|
2566
|
+
return Pr(), /* @__PURE__ */ W(he, { children: [
|
|
2567
|
+
/* @__PURE__ */ i(
|
|
2568
|
+
yr,
|
|
2569
|
+
{
|
|
2570
|
+
asChild: !0,
|
|
2571
|
+
loop: !0,
|
|
2572
|
+
trapped: r,
|
|
2573
|
+
onMountAutoFocus: o,
|
|
2574
|
+
onUnmountAutoFocus: s,
|
|
2575
|
+
children: /* @__PURE__ */ i(
|
|
2576
|
+
br,
|
|
2577
|
+
{
|
|
2578
|
+
role: "dialog",
|
|
2579
|
+
id: d.contentId,
|
|
2580
|
+
"aria-describedby": d.descriptionId,
|
|
2581
|
+
"aria-labelledby": d.titleId,
|
|
2582
|
+
"data-state": zt(d.open),
|
|
2583
|
+
...c,
|
|
2584
|
+
ref: m,
|
|
2585
|
+
onDismiss: () => d.onOpenChange(!1)
|
|
2586
|
+
}
|
|
2587
|
+
)
|
|
2588
|
+
}
|
|
2589
|
+
),
|
|
2590
|
+
/* @__PURE__ */ W(he, { children: [
|
|
2591
|
+
/* @__PURE__ */ i(Ni, { titleId: d.titleId }),
|
|
2592
|
+
/* @__PURE__ */ i(Di, { contentRef: a, descriptionId: d.descriptionId })
|
|
2593
|
+
] })
|
|
2594
|
+
] });
|
|
2595
|
+
}
|
|
2596
|
+
), Dt = "DialogTitle", Hn = Q.forwardRef(
|
|
2597
|
+
(t, e) => {
|
|
2598
|
+
const { __scopeDialog: n, ...r } = t, o = fe(Dt, n);
|
|
2599
|
+
return /* @__PURE__ */ i(je.h2, { id: o.titleId, ...r, ref: e });
|
|
2600
|
+
}
|
|
2601
|
+
);
|
|
2602
|
+
Hn.displayName = Dt;
|
|
2603
|
+
var $n = "DialogDescription", Ei = Q.forwardRef(
|
|
2604
|
+
(t, e) => {
|
|
2605
|
+
const { __scopeDialog: n, ...r } = t, o = fe($n, n);
|
|
2606
|
+
return /* @__PURE__ */ i(je.p, { id: o.descriptionId, ...r, ref: e });
|
|
2607
|
+
}
|
|
2608
|
+
);
|
|
2609
|
+
Ei.displayName = $n;
|
|
2610
|
+
var Gn = "DialogClose", qn = Q.forwardRef(
|
|
2611
|
+
(t, e) => {
|
|
2612
|
+
const { __scopeDialog: n, ...r } = t, o = fe(Gn, n);
|
|
2613
|
+
return /* @__PURE__ */ i(
|
|
2614
|
+
je.button,
|
|
2615
|
+
{
|
|
2616
|
+
type: "button",
|
|
2617
|
+
...r,
|
|
2618
|
+
ref: e,
|
|
2619
|
+
onClick: qe(t.onClick, () => o.onOpenChange(!1))
|
|
2620
|
+
}
|
|
2621
|
+
);
|
|
2622
|
+
}
|
|
2623
|
+
);
|
|
2624
|
+
qn.displayName = Gn;
|
|
2625
|
+
function zt(t) {
|
|
2626
|
+
return t ? "open" : "closed";
|
|
2627
|
+
}
|
|
2628
|
+
var Un = "DialogTitleWarning", [_c, Vn] = vr(Un, {
|
|
2629
|
+
contentName: Oe,
|
|
2630
|
+
titleName: Dt,
|
|
2631
|
+
docsSlug: "dialog"
|
|
2632
|
+
}), Ni = ({ titleId: t }) => {
|
|
2633
|
+
const e = Vn(Un), n = `\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
2634
|
+
|
|
2635
|
+
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
2636
|
+
|
|
2637
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;
|
|
2638
|
+
return Q.useEffect(() => {
|
|
2639
|
+
t && (document.getElementById(t) || console.error(n));
|
|
2640
|
+
}, [n, t]), null;
|
|
2641
|
+
}, Oi = "DialogDescriptionWarning", Di = ({ contentRef: t, descriptionId: e }) => {
|
|
2642
|
+
const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vn(Oi).contentName}}.`;
|
|
2643
|
+
return Q.useEffect(() => {
|
|
2644
|
+
var s;
|
|
2645
|
+
const o = (s = t.current) == null ? void 0 : s.getAttribute("aria-describedby");
|
|
2646
|
+
e && o && (document.getElementById(e) || console.warn(r));
|
|
2647
|
+
}, [r, t, e]), null;
|
|
2648
|
+
}, zi = Dn, Ai = Fn, Fi = kn, ki = Wn, Wi = Hn, Mi = qn;
|
|
2649
|
+
const Ee = {
|
|
2650
|
+
"rp-dialog-wrapper": "_rp-dialog-wrapper_slqo7_1",
|
|
2651
|
+
"rp-dialog-overlay": "_rp-dialog-overlay_slqo7_7",
|
|
2652
|
+
"rp-document-dialog": "_rp-document-dialog_slqo7_13",
|
|
2653
|
+
"rp-document-properties": "_rp-document-properties_slqo7_35",
|
|
2654
|
+
"rp-dialog-title": "_rp-dialog-title_slqo7_39",
|
|
2655
|
+
"rp-dialog-close": "_rp-dialog-close_slqo7_47",
|
|
2656
|
+
"rp-properties-divider": "_rp-properties-divider_slqo7_55"
|
|
2657
|
+
}, Hi = () => {
|
|
2658
|
+
const { pdfProperties: t } = re(), { container: e } = Te(), { activeDocumentProperties: n, setActiveDocumentProperties: r } = Lo(), { localeMessages: o } = de(), s = k(() => {
|
|
2659
|
+
if (!t)
|
|
2660
|
+
return [];
|
|
2661
|
+
const {
|
|
2662
|
+
fileSize: c,
|
|
2663
|
+
filename: d,
|
|
2664
|
+
title: a,
|
|
2665
|
+
author: m,
|
|
2666
|
+
subject: g,
|
|
2667
|
+
createdOn: C,
|
|
2668
|
+
creator: u,
|
|
2669
|
+
keywords: b,
|
|
2670
|
+
modifiedOn: T,
|
|
2671
|
+
pdfProducer: P,
|
|
2672
|
+
pdfVersion: w,
|
|
2673
|
+
pageCount: y
|
|
2674
|
+
} = t;
|
|
2675
|
+
return [
|
|
2676
|
+
{ label: o == null ? void 0 : o.propertiesFilenameLabel, value: d },
|
|
2677
|
+
{ label: o == null ? void 0 : o.propertiesFileSizeLabel, value: c },
|
|
2678
|
+
{ separate: !0 },
|
|
2679
|
+
{ label: o == null ? void 0 : o.propertiesTitleLabel, value: a },
|
|
2680
|
+
{ label: o == null ? void 0 : o.propertiesAuthorLabel, value: m },
|
|
2681
|
+
{ label: o == null ? void 0 : o.propertiesSubjectLabel, value: g },
|
|
2682
|
+
{ label: o == null ? void 0 : o.propertiesKeywordLabel, value: b },
|
|
2683
|
+
{ label: o == null ? void 0 : o.propertiesCreatorLabel, value: u },
|
|
2684
|
+
{
|
|
2685
|
+
label: o == null ? void 0 : o.propertiesCreateOnLabel,
|
|
2686
|
+
value: C ? $t(C) : ""
|
|
2687
|
+
},
|
|
2688
|
+
{
|
|
2689
|
+
label: o == null ? void 0 : o.propertiesModifiedOnLabel,
|
|
2690
|
+
value: T ? $t(T) : ""
|
|
2691
|
+
},
|
|
2692
|
+
{ separate: !0 },
|
|
2693
|
+
{ label: o == null ? void 0 : o.propertiesPDFProducerLabel, value: P },
|
|
2694
|
+
{ label: o == null ? void 0 : o.propertiesPDFVersionLabel, value: w },
|
|
2695
|
+
{ label: o == null ? void 0 : o.propertiesPageCountLabel, value: y }
|
|
2696
|
+
];
|
|
2697
|
+
}, [t, o]);
|
|
2698
|
+
return /* @__PURE__ */ i(zi, { open: n, onOpenChange: r, children: /* @__PURE__ */ i(Ai, { container: e, children: /* @__PURE__ */ W("div", { className: Ee["rp-dialog-wrapper"], children: [
|
|
2699
|
+
/* @__PURE__ */ i(Fi, { className: Ee["rp-dialog-overlay"] }),
|
|
2700
|
+
/* @__PURE__ */ W(ki, { className: Ee["rp-document-dialog"], children: [
|
|
2701
|
+
/* @__PURE__ */ i(Wi, { className: Ee["rp-dialog-title"], children: o == null ? void 0 : o.documentPropertiesLabel }),
|
|
2702
|
+
/* @__PURE__ */ i("div", { className: Ee["rp-document-properties"], children: s.map((c, d) => /* @__PURE__ */ i("div", { children: c.separate ? /* @__PURE__ */ i("div", { className: Ee["rp-properties-divider"] }) : /* @__PURE__ */ i($o, { label: c.label, value: c.value }) }, d)) }),
|
|
2703
|
+
/* @__PURE__ */ i(Mi, { asChild: !0, className: Ee["rp-dialog-close"], children: /* @__PURE__ */ i(Sr, {}) })
|
|
2704
|
+
] })
|
|
2705
|
+
] }) }) });
|
|
2706
|
+
}, $i = {
|
|
2707
|
+
"rp-other-tool-content": "_rp-other-tool-content_su718_1"
|
|
2708
|
+
}, sn = ".pdf", Gi = (t) => URL.createObjectURL(t), qi = async (t) => {
|
|
2709
|
+
const n = await (await fetch(t)).blob();
|
|
2710
|
+
return Gi(n);
|
|
2711
|
+
}, Bn = () => {
|
|
2712
|
+
const { filename: t, pdfSrc: e } = re(), { downloadFilename: n } = Io(), r = (s) => {
|
|
2713
|
+
const c = n || s;
|
|
2714
|
+
return c.endsWith(sn) ? c : `${c}${sn}`;
|
|
2715
|
+
};
|
|
2716
|
+
return { download: N(async () => {
|
|
2717
|
+
if (!t || !e)
|
|
2718
|
+
throw new Error("There is no PDF source to download");
|
|
2719
|
+
const s = document.createElement("a");
|
|
2720
|
+
s.href = await qi(e), s.download = r(t), document.body.appendChild(s), s.click(), document.body.removeChild(s);
|
|
2721
|
+
}, [t, e]) };
|
|
2722
|
+
}, Zn = () => {
|
|
2723
|
+
const { downloadIcon: t } = ge(), { downloadIcon: e } = me();
|
|
2724
|
+
return t || e || /* @__PURE__ */ i(Nr, {});
|
|
2725
|
+
}, jn = ({ children: t, className: e, localeMessages: n }) => /* @__PURE__ */ i(K, { className: e, content: n == null ? void 0 : n.downloadFileTooltip, children: t }), Ui = ({ download: t, localeMessages: e }) => /* @__PURE__ */ i(jn, { localeMessages: e, children: /* @__PURE__ */ i(ce, { onClick: t, "aria-label": e == null ? void 0 : e.downloadFileTooltip, children: /* @__PURE__ */ i(Zn, {}) }) }), Vi = ({ download: t, localeMessages: e }) => /* @__PURE__ */ i(ye, { onClick: t, children: /* @__PURE__ */ W(jn, { className: "rp-menu-item", localeMessages: e, children: [
|
|
2726
|
+
/* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ i(Zn, {}) }),
|
|
2727
|
+
e == null ? void 0 : e.downloadFileLabel
|
|
2728
|
+
] }) }), Kn = () => {
|
|
2729
|
+
const { download: t } = Bn(), { downloadTool: e = !0 } = Ce(), { downloadTool: n = !0 } = Ie(), { isSmallScreen: r } = Se(), { localeMessages: o } = de(), s = o == null ? void 0 : o.downloadFileTooltip;
|
|
2730
|
+
return !e || !n ? null : r ? /* @__PURE__ */ i(Vi, { download: t, localeMessages: o }) : typeof e == "function" ? /* @__PURE__ */ i(K, { content: s, children: /* @__PURE__ */ i(e, { download: t }) }) : typeof n == "function" ? /* @__PURE__ */ i(K, { content: s, children: /* @__PURE__ */ i(n, { download: t }) }) : /* @__PURE__ */ i(Ui, { download: t, localeMessages: o });
|
|
2731
|
+
}, Xn = () => {
|
|
2732
|
+
const { printIcon: t } = ge(), { printIcon: e } = me();
|
|
2733
|
+
return t || e || /* @__PURE__ */ i(Or, {});
|
|
2734
|
+
}, Qn = ({ children: t, className: e, localeMessages: n }) => /* @__PURE__ */ i(K, { className: e, content: n == null ? void 0 : n.printTooltip, children: t }), Bi = ({ print: t, localeMessages: e }) => /* @__PURE__ */ i(Qn, { localeMessages: e, children: /* @__PURE__ */ i(ce, { onClick: t, "aria-label": e == null ? void 0 : e.printTooltip, children: /* @__PURE__ */ i(Xn, {}) }) }), Zi = ({ print: t, localeMessages: e }) => /* @__PURE__ */ i(ye, { onClick: t, children: /* @__PURE__ */ W(Qn, { className: "rp-menu-item", localeMessages: e, children: [
|
|
2735
|
+
/* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ i(Xn, {}) }),
|
|
2736
|
+
e == null ? void 0 : e.printLabel
|
|
2737
|
+
] }) }), Yn = () => {
|
|
2738
|
+
const { print: t, cancel: e, setOnProgress: n, setOnComplete: r, setOnError: o, progress: s, showDefaultProgress: c } = it(), { printTool: d = !0 } = Ce(), { printTool: a = !0 } = Ie(), { isSmallScreen: m } = Se(), { localeMessages: g } = de(), C = g == null ? void 0 : g.printTooltip;
|
|
2739
|
+
return !d || !a ? null : m ? /* @__PURE__ */ i(Zi, { print: t, localeMessages: g }) : typeof d == "function" ? /* @__PURE__ */ i(K, { content: C, children: /* @__PURE__ */ i(
|
|
2740
|
+
d,
|
|
2741
|
+
{
|
|
2742
|
+
print: t,
|
|
2743
|
+
cancel: e,
|
|
2744
|
+
setOnProgress: n,
|
|
2745
|
+
setOnError: o,
|
|
2746
|
+
setOnComplete: r,
|
|
2747
|
+
progress: s,
|
|
2748
|
+
showDefaultProgress: c
|
|
2749
|
+
}
|
|
2750
|
+
) }) : typeof a == "function" ? /* @__PURE__ */ i(K, { content: C, children: /* @__PURE__ */ i(
|
|
2751
|
+
a,
|
|
2752
|
+
{
|
|
2753
|
+
print: t,
|
|
2754
|
+
cancel: e,
|
|
2755
|
+
setOnProgress: n,
|
|
2756
|
+
setOnError: o,
|
|
2757
|
+
setOnComplete: r,
|
|
2758
|
+
progress: s,
|
|
2759
|
+
showDefaultProgress: c
|
|
2760
|
+
}
|
|
2761
|
+
) }) : /* @__PURE__ */ i(Bi, { print: t, localeMessages: g });
|
|
2762
|
+
}, ji = {
|
|
2763
|
+
"rp-go-to-Top": "_rp-go-to-Top_4e0yd_1"
|
|
2764
|
+
}, Ki = () => {
|
|
2765
|
+
const { goToFirstPageIcon: t } = ge(), { goToFirstPageIcon: e } = me();
|
|
2766
|
+
return t || e || /* @__PURE__ */ i(wn, { className: ji["rp-go-to-Top"] });
|
|
2767
|
+
}, Xi = () => {
|
|
2768
|
+
const { goToLastPageIcon: t } = ge(), { goToLastPageIcon: e } = me();
|
|
2769
|
+
return t || e || /* @__PURE__ */ i(wn, {});
|
|
2770
|
+
}, an = { width: "100%" }, Qi = () => {
|
|
2771
|
+
const { goToPage: t, totalPages: e, focusedPage: n } = ue(), { jumpNavigationTool: r = !0 } = Ce(), { jumpNavigationTool: o = !0 } = Ie(), { localeMessages: s } = de(), c = k(() => n === 1, [n]), d = k(() => n === e, [n, e]), a = N(() => {
|
|
2772
|
+
t(1);
|
|
2773
|
+
}, [t]), m = N(() => {
|
|
2774
|
+
t(e);
|
|
2775
|
+
}, [t, e]);
|
|
2776
|
+
return !r || !o ? null : /* @__PURE__ */ W(Je, { children: [
|
|
2777
|
+
/* @__PURE__ */ i(ye, { onClick: a, children: /* @__PURE__ */ i(K, { content: s == null ? void 0 : s.firstPageTooltip, style: an, children: /* @__PURE__ */ W("div", { className: "rp-menu-item", "aria-disabled": c, children: [
|
|
2778
|
+
/* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ i(Ki, {}) }),
|
|
2779
|
+
/* @__PURE__ */ i("span", { children: s == null ? void 0 : s.firstPageLabel })
|
|
2780
|
+
] }) }) }),
|
|
2781
|
+
/* @__PURE__ */ i(ye, { onClick: m, children: /* @__PURE__ */ i(K, { content: s == null ? void 0 : s.lastPageTooltip, style: an, children: /* @__PURE__ */ W("div", { className: "rp-menu-item", "aria-disabled": d, children: [
|
|
2782
|
+
/* @__PURE__ */ i("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ i(Xi, {}) }),
|
|
2783
|
+
/* @__PURE__ */ i("span", { children: s == null ? void 0 : s.lastPageLabel })
|
|
2784
|
+
] }) }) }),
|
|
2785
|
+
/* @__PURE__ */ i(It, {})
|
|
2786
|
+
] });
|
|
2787
|
+
}, Yi = () => {
|
|
2788
|
+
const [t, e] = $(!1), { container: n, pagesRef: r } = Te(), { isSmallScreen: o } = Se(), {
|
|
2789
|
+
openFileTool: s,
|
|
2790
|
+
downloadTool: c,
|
|
2791
|
+
documentProperties: d,
|
|
2792
|
+
scrollModeTool: a,
|
|
2793
|
+
rotateTool: m,
|
|
2794
|
+
selectionModeTool: g,
|
|
2795
|
+
jumpNavigationTool: C,
|
|
2796
|
+
printTool: u,
|
|
2797
|
+
fullscreenTool: b,
|
|
2798
|
+
viewModeTool: T
|
|
2799
|
+
} = Ce(), {
|
|
2800
|
+
openFileTool: P,
|
|
2801
|
+
downloadTool: w,
|
|
2802
|
+
documentProperties: y,
|
|
2803
|
+
scrollModeTool: p,
|
|
2804
|
+
rotateTool: f,
|
|
2805
|
+
selectionModeTool: h,
|
|
2806
|
+
jumpNavigationTool: l,
|
|
2807
|
+
printTool: v,
|
|
2808
|
+
fullscreenTool: _,
|
|
2809
|
+
viewModeTool: I
|
|
2810
|
+
} = Ie(), { localeMessages: x } = de(), [S, L] = $(0), O = M(
|
|
2811
|
+
new ResizeObserver((E) => {
|
|
2812
|
+
L(E[0].contentRect.height);
|
|
2813
|
+
})
|
|
2814
|
+
), D = k(() => C || m || g || a || d || T || o && (s || c || u || b), [
|
|
2815
|
+
s,
|
|
2816
|
+
c,
|
|
2817
|
+
u,
|
|
2818
|
+
b,
|
|
2819
|
+
d,
|
|
2820
|
+
a,
|
|
2821
|
+
m,
|
|
2822
|
+
g,
|
|
2823
|
+
C,
|
|
2824
|
+
o
|
|
2825
|
+
]), F = k(() => l || f || h || p || y || I || o && (P || w || v || _), [
|
|
2826
|
+
P,
|
|
2827
|
+
w,
|
|
2828
|
+
v,
|
|
2829
|
+
_,
|
|
2830
|
+
y,
|
|
2831
|
+
p,
|
|
2832
|
+
f,
|
|
2833
|
+
h,
|
|
2834
|
+
l,
|
|
2835
|
+
o
|
|
2836
|
+
]);
|
|
2837
|
+
return z(() => (r && O.current.observe(r), () => {
|
|
2838
|
+
O.current.disconnect();
|
|
2839
|
+
}), [r]), !D || !F ? null : /* @__PURE__ */ W(he, { children: [
|
|
2840
|
+
/* @__PURE__ */ i(
|
|
2841
|
+
yt,
|
|
2842
|
+
{
|
|
2843
|
+
container: n,
|
|
2844
|
+
onOpenChange: e,
|
|
2845
|
+
triggerComponent: /* @__PURE__ */ i("div", { role: "button", children: /* @__PURE__ */ i(K, { content: x == null ? void 0 : x.moreOptionTooltip, children: /* @__PURE__ */ i(ce, { active: t, "aria-label": x == null ? void 0 : x.moreOptionTooltip, children: /* @__PURE__ */ i(mr, {}) }) }) }),
|
|
2846
|
+
side: "bottom",
|
|
2847
|
+
avoidCollisions: !1,
|
|
2848
|
+
children: /* @__PURE__ */ W(
|
|
2849
|
+
"div",
|
|
2850
|
+
{
|
|
2851
|
+
style: { maxHeight: `${S}px`, overflow: "auto" },
|
|
2852
|
+
className: $i["rp-other-tool-content"],
|
|
2853
|
+
"data-rp": "moreOptionsDropdown",
|
|
2854
|
+
children: [
|
|
2855
|
+
o && /* @__PURE__ */ W(Je, { children: [
|
|
2856
|
+
/* @__PURE__ */ i(gn, {}),
|
|
2857
|
+
/* @__PURE__ */ i(Kn, {}),
|
|
2858
|
+
/* @__PURE__ */ i(Yn, {}),
|
|
2859
|
+
/* @__PURE__ */ i(vn, {}),
|
|
2860
|
+
/* @__PURE__ */ i(It, {})
|
|
2861
|
+
] }),
|
|
2862
|
+
/* @__PURE__ */ i(Qi, {}),
|
|
2863
|
+
/* @__PURE__ */ i(Rr, {}),
|
|
2864
|
+
/* @__PURE__ */ i(Dr, {}),
|
|
2865
|
+
/* @__PURE__ */ i(Lr, {}),
|
|
2866
|
+
/* @__PURE__ */ i(Er, {}),
|
|
2867
|
+
/* @__PURE__ */ i(xr, {})
|
|
2868
|
+
]
|
|
2869
|
+
}
|
|
2870
|
+
)
|
|
2871
|
+
}
|
|
2872
|
+
),
|
|
2873
|
+
/* @__PURE__ */ i(Hi, {})
|
|
2874
|
+
] });
|
|
2875
|
+
}, Ji = () => {
|
|
2876
|
+
const { isSmallScreen: t } = Se();
|
|
2877
|
+
return /* @__PURE__ */ W(he, { children: [
|
|
2878
|
+
/* @__PURE__ */ i(fr, {}),
|
|
2879
|
+
!t && /* @__PURE__ */ W(he, { children: [
|
|
2880
|
+
/* @__PURE__ */ i(gn, {}),
|
|
2881
|
+
/* @__PURE__ */ i(Kn, {}),
|
|
2882
|
+
/* @__PURE__ */ i(Yn, {}),
|
|
2883
|
+
/* @__PURE__ */ i(vn, {})
|
|
2884
|
+
] }),
|
|
2885
|
+
/* @__PURE__ */ i(Yi, {})
|
|
2886
|
+
] });
|
|
2887
|
+
}, es = "_active_1yldl_11", Ae = {
|
|
2888
|
+
"rp-zoom-wrapper": "_rp-zoom-wrapper_1yldl_1",
|
|
2889
|
+
"rp-current-zoom-wrapper": "_rp-current-zoom-wrapper_1yldl_6",
|
|
2890
|
+
active: es,
|
|
2891
|
+
"rp-current-zoom-icon": "_rp-current-zoom-icon_1yldl_15",
|
|
2892
|
+
"rp-zoom-level-icon": "_rp-zoom-level-icon_1yldl_20",
|
|
2893
|
+
"rp-current-zoom-text": "_rp-current-zoom-text_1yldl_24",
|
|
2894
|
+
"rp-zoom-dropdown-content": "_rp-zoom-dropdown-content_1yldl_28"
|
|
2895
|
+
}, ts = ({ zoomLevel: t, className: e }) => {
|
|
2896
|
+
const { localeMessages: n } = de(), r = k(() => {
|
|
2897
|
+
switch (t) {
|
|
2898
|
+
case We.ACTUAL:
|
|
2899
|
+
return n == null ? void 0 : n.zoomActualSize;
|
|
2900
|
+
case We.PAGE_FIT:
|
|
2901
|
+
return n == null ? void 0 : n.zoomPageFit;
|
|
2902
|
+
case We.PAGE_WIDTH:
|
|
2903
|
+
return n == null ? void 0 : n.zoomPageWidth;
|
|
2904
|
+
}
|
|
2905
|
+
return t.toString();
|
|
2906
|
+
}, [t, n]);
|
|
2907
|
+
return /* @__PURE__ */ i(he, { children: typeof t == "number" ? /* @__PURE__ */ W(lo, { children: [
|
|
2908
|
+
/* @__PURE__ */ i("span", { className: e, children: t }),
|
|
2909
|
+
/* @__PURE__ */ i("span", { className: e, children: "%" })
|
|
2910
|
+
] }) : /* @__PURE__ */ i("span", { className: e, children: r }) });
|
|
2911
|
+
}, ns = [50, 75, 100, 125, 150, 200, 300, 400], os = () => {
|
|
2912
|
+
const { zoomInIcon: t } = ge(), { zoomInIcon: e } = me();
|
|
2913
|
+
return t || e || /* @__PURE__ */ i(zr, {});
|
|
2914
|
+
}, rs = () => {
|
|
2915
|
+
const { zoomOutIcon: t } = ge(), { zoomOutIcon: e } = me();
|
|
2916
|
+
return t || e || /* @__PURE__ */ i(Ar, {});
|
|
2917
|
+
}, is = () => {
|
|
2918
|
+
const { zoomLevel: t, setZoomLevel: e, currentZoom: n } = tt(), { container: r, pagesRef: o } = Te(), { zoomTool: s = !0 } = Ce(), { zoomTool: c = !0 } = Ie(), { isSmallScreen: d } = Se(), { localeMessages: a } = de(), [m, g] = $(0), [C, u] = $(!1), b = M(
|
|
2919
|
+
new ResizeObserver((p) => {
|
|
2920
|
+
g(p[0].contentRect.height);
|
|
2921
|
+
})
|
|
2922
|
+
), T = N(() => {
|
|
2923
|
+
e(() => {
|
|
2924
|
+
const p = Math.floor(n * 100 / 25) * 25;
|
|
2925
|
+
return Math.min(p + 25, Gt);
|
|
2926
|
+
});
|
|
2927
|
+
}, [e, n]), P = N(() => {
|
|
2928
|
+
e(() => {
|
|
2929
|
+
const p = Math.ceil(n * 100 / 25) * 25;
|
|
2930
|
+
return Math.min(p - 25, Gt);
|
|
2931
|
+
});
|
|
2932
|
+
}, [e, n]), w = k(() => Fr(n), [n]), y = k(() => kr(n), [n]);
|
|
2933
|
+
return z(() => (o && b.current.observe(o), () => {
|
|
2934
|
+
b.current.disconnect();
|
|
2935
|
+
}), [o]), !s || !c ? null : typeof s == "function" ? /* @__PURE__ */ i(s, { zoomLevel: t, setZoomLevel: e }) : typeof c == "function" ? /* @__PURE__ */ i(c, { zoomLevel: t, setZoomLevel: e }) : /* @__PURE__ */ W("div", { className: Ae["rp-zoom-wrapper"], children: [
|
|
2936
|
+
/* @__PURE__ */ i(K, { content: a == null ? void 0 : a.zoomOutTooltip, children: /* @__PURE__ */ i(
|
|
2937
|
+
ce,
|
|
2938
|
+
{
|
|
2939
|
+
disabled: w,
|
|
2940
|
+
onClick: P,
|
|
2941
|
+
"aria-label": a == null ? void 0 : a.zoomOutTooltip,
|
|
2942
|
+
children: /* @__PURE__ */ i(rs, {})
|
|
2943
|
+
}
|
|
2944
|
+
) }),
|
|
2945
|
+
!d && /* @__PURE__ */ i(
|
|
2946
|
+
yt,
|
|
2947
|
+
{
|
|
2948
|
+
container: r,
|
|
2949
|
+
open: C,
|
|
2950
|
+
onOpenChange: u,
|
|
2951
|
+
triggerComponent: /* @__PURE__ */ i("div", { role: "button", children: /* @__PURE__ */ i(K, { content: a == null ? void 0 : a.zoomSelectTooltip, children: /* @__PURE__ */ W(
|
|
2952
|
+
ce,
|
|
2953
|
+
{
|
|
2954
|
+
className: se(
|
|
2955
|
+
Ae["rp-current-zoom-wrapper"],
|
|
2956
|
+
C && Ae.active
|
|
2957
|
+
),
|
|
2958
|
+
"aria-label": a == null ? void 0 : a.zoomSelectTooltip,
|
|
2959
|
+
children: [
|
|
2960
|
+
/* @__PURE__ */ i(
|
|
2961
|
+
ts,
|
|
2962
|
+
{
|
|
2963
|
+
zoomLevel: t,
|
|
2964
|
+
className: Ae["rp-current-zoom-text"]
|
|
2965
|
+
}
|
|
2966
|
+
),
|
|
2967
|
+
/* @__PURE__ */ i(Ue, { className: Ae["rp-current-zoom-icon"] })
|
|
2968
|
+
]
|
|
2969
|
+
}
|
|
2970
|
+
) }) }),
|
|
2971
|
+
style: { minWidth: "200px" },
|
|
2972
|
+
align: "center",
|
|
2973
|
+
side: "bottom",
|
|
2974
|
+
avoidCollisions: !1,
|
|
2975
|
+
children: /* @__PURE__ */ W(
|
|
2976
|
+
"div",
|
|
2977
|
+
{
|
|
2978
|
+
style: { maxHeight: `${m}px`, overflow: "auto" },
|
|
2979
|
+
className: Ae["rp-zoom-dropdown-content"],
|
|
2980
|
+
children: [
|
|
2981
|
+
/* @__PURE__ */ W(Je, { children: [
|
|
2982
|
+
/* @__PURE__ */ i(ye, { onClick: () => e(We.ACTUAL), children: a == null ? void 0 : a.zoomActualSize }),
|
|
2983
|
+
/* @__PURE__ */ i(ye, { onClick: () => e(We.PAGE_FIT), children: a == null ? void 0 : a.zoomPageFit }),
|
|
2984
|
+
/* @__PURE__ */ i(ye, { onClick: () => e(We.PAGE_WIDTH), children: a == null ? void 0 : a.zoomPageWidth })
|
|
2985
|
+
] }),
|
|
2986
|
+
/* @__PURE__ */ i(It, {}),
|
|
2987
|
+
/* @__PURE__ */ i(Je, { children: ns.map((p) => /* @__PURE__ */ W(ye, { onClick: () => e(p), children: [
|
|
2988
|
+
p,
|
|
2989
|
+
" %"
|
|
2990
|
+
] }, p)) })
|
|
2991
|
+
]
|
|
2992
|
+
}
|
|
2993
|
+
)
|
|
2994
|
+
}
|
|
2995
|
+
),
|
|
2996
|
+
/* @__PURE__ */ i(K, { content: a == null ? void 0 : a.zoomInTooltip, children: /* @__PURE__ */ i(
|
|
2997
|
+
ce,
|
|
2998
|
+
{
|
|
2999
|
+
disabled: y,
|
|
3000
|
+
onClick: T,
|
|
3001
|
+
"aria-label": a == null ? void 0 : a.zoomInTooltip,
|
|
3002
|
+
children: /* @__PURE__ */ i(os, {})
|
|
3003
|
+
}
|
|
3004
|
+
) })
|
|
3005
|
+
] });
|
|
3006
|
+
}, cn = () => {
|
|
3007
|
+
const { totalMatches: t, nextMatch: e, prevMatch: n } = Et(), { localeMessages: r } = de();
|
|
3008
|
+
return /* @__PURE__ */ W(he, { children: [
|
|
3009
|
+
/* @__PURE__ */ i(
|
|
3010
|
+
K,
|
|
3011
|
+
{
|
|
3012
|
+
content: r == null ? void 0 : r.searchPrevTooltip,
|
|
3013
|
+
className: ne["rp-search-tool-result-navigator"],
|
|
3014
|
+
children: /* @__PURE__ */ i(ce, { tabIndex: 0, onClick: n, "aria-label": r == null ? void 0 : r.searchPrevTooltip, children: /* @__PURE__ */ i(
|
|
3015
|
+
Ue,
|
|
3016
|
+
{
|
|
3017
|
+
className: ne["rp-search-tool-input-icon"],
|
|
3018
|
+
"aria-disabled": !t
|
|
3019
|
+
}
|
|
3020
|
+
) })
|
|
3021
|
+
}
|
|
3022
|
+
),
|
|
3023
|
+
/* @__PURE__ */ i(
|
|
3024
|
+
K,
|
|
3025
|
+
{
|
|
3026
|
+
content: r == null ? void 0 : r.searchNextTooltip,
|
|
3027
|
+
className: ne["rp-search-tool-result-navigator"],
|
|
3028
|
+
children: /* @__PURE__ */ i(ce, { tabIndex: 0, onClick: e, "aria-label": r == null ? void 0 : r.searchNextTooltip, children: /* @__PURE__ */ i(
|
|
3029
|
+
Ue,
|
|
3030
|
+
{
|
|
3031
|
+
style: { transform: "rotate(180deg" },
|
|
3032
|
+
className: ne["rp-search-tool-input-icon"],
|
|
3033
|
+
"aria-disabled": !t
|
|
3034
|
+
}
|
|
3035
|
+
) })
|
|
3036
|
+
}
|
|
3037
|
+
)
|
|
3038
|
+
] });
|
|
3039
|
+
}, ss = () => {
|
|
3040
|
+
const { searchIcon: t } = ge(), { searchIcon: e } = me();
|
|
3041
|
+
return t || e || /* @__PURE__ */ i(_n, {});
|
|
3042
|
+
}, as = ({ icon: t }) => {
|
|
3043
|
+
const { container: e } = Te(), [n, r] = $(!1), { pdf: o } = re(), [s, c] = $(null), {
|
|
3044
|
+
searchOptions: d,
|
|
3045
|
+
setSearchOptions: a,
|
|
3046
|
+
loading: m,
|
|
3047
|
+
setSearch: g,
|
|
3048
|
+
totalMatches: C,
|
|
3049
|
+
currentMatchPosition: u,
|
|
3050
|
+
nextMatch: b,
|
|
3051
|
+
prevMatch: T,
|
|
3052
|
+
search: P
|
|
3053
|
+
} = Et(), { searchTool: w = !0 } = Ce(), { searchTool: y = !0 } = Ie(), [p, f] = $(P), { localeMessages: h } = de(), { isSmallScreen: l } = Se(), [v, _] = $(null), [I, x] = $(!1), S = N(() => {
|
|
3054
|
+
r(!0);
|
|
3055
|
+
}, []), L = N(() => {
|
|
3056
|
+
g(""), f(""), r(!1);
|
|
3057
|
+
}, [g]), O = (q) => {
|
|
3058
|
+
const Z = q.key === "Enter", Y = q.key === " ";
|
|
3059
|
+
(Z || Y) && L();
|
|
3060
|
+
}, D = N(
|
|
3061
|
+
(q) => {
|
|
3062
|
+
q.key === "Escape" && n && L();
|
|
3063
|
+
},
|
|
3064
|
+
[n]
|
|
3065
|
+
), F = N(
|
|
3066
|
+
(q) => {
|
|
3067
|
+
q.shiftKey && q.key === "Enter" ? T() : q.key === "Enter" && P !== p ? g(p) : q.key === "Enter" && b();
|
|
3068
|
+
},
|
|
3069
|
+
[p, T, b, g, P]
|
|
3070
|
+
);
|
|
3071
|
+
z(() => {
|
|
3072
|
+
f(P);
|
|
3073
|
+
}, [P]), z(() => {
|
|
3074
|
+
P && o && x(!0);
|
|
3075
|
+
}, [P, o]), z(() => {
|
|
3076
|
+
P && P.trim() !== "" && (f(P), g(P));
|
|
3077
|
+
}, []), z(() => (window.addEventListener("keydown", D), () => {
|
|
3078
|
+
window.removeEventListener("keydown", D);
|
|
3079
|
+
}), [D]), z(() => {
|
|
3080
|
+
s && setTimeout(() => {
|
|
3081
|
+
s.focus();
|
|
3082
|
+
}, 0);
|
|
3083
|
+
}, [s]);
|
|
3084
|
+
const E = N((q) => {
|
|
3085
|
+
f(q.target.value);
|
|
3086
|
+
}, []), R = N(() => {
|
|
3087
|
+
f(""), g("");
|
|
3088
|
+
}, [g]), A = k(() => `${u} / ${C}`, [u, C]), { wholeWords: G, matchCase: H } = k(() => d, [d]), U = N(
|
|
3089
|
+
(q) => {
|
|
3090
|
+
a((Z) => ({ ...Z, matchCase: q }));
|
|
3091
|
+
},
|
|
3092
|
+
[a]
|
|
3093
|
+
), X = N(
|
|
3094
|
+
(q) => {
|
|
3095
|
+
a((Z) => ({ ...Z, wholeWords: q }));
|
|
3096
|
+
},
|
|
3097
|
+
[a]
|
|
3098
|
+
);
|
|
3099
|
+
z(() => {
|
|
3100
|
+
o && I && L();
|
|
3101
|
+
}, [o, L]);
|
|
3102
|
+
const V = k(() => (v == null ? void 0 : v.querySelectorAll('[tabindex]:not([tabindex="-1"])')) || [], [v]), ie = N(
|
|
3103
|
+
(q) => {
|
|
3104
|
+
if (q.key === "Tab") {
|
|
3105
|
+
const Z = document.activeElement;
|
|
3106
|
+
let Y = 0;
|
|
3107
|
+
V.forEach((ee, ve) => {
|
|
3108
|
+
ee === Z && (Y = ve);
|
|
3109
|
+
});
|
|
3110
|
+
let te = Y + 1;
|
|
3111
|
+
q.shiftKey && (te = Y - 1);
|
|
3112
|
+
const J = V[te];
|
|
3113
|
+
if (J)
|
|
3114
|
+
J.focus();
|
|
3115
|
+
else if (te > V.length - 1) {
|
|
3116
|
+
const ee = V[0];
|
|
3117
|
+
ee && ee.focus();
|
|
3118
|
+
} else {
|
|
3119
|
+
const ee = V[V.length - 1];
|
|
3120
|
+
ee && ee.focus();
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
},
|
|
3124
|
+
[V]
|
|
3125
|
+
);
|
|
3126
|
+
return !w || !y ? null : /* @__PURE__ */ i(he, { children: /* @__PURE__ */ i(
|
|
3127
|
+
yt,
|
|
3128
|
+
{
|
|
3129
|
+
open: n,
|
|
3130
|
+
container: e,
|
|
3131
|
+
side: "bottom",
|
|
3132
|
+
align: "start",
|
|
3133
|
+
tabIndex: 0,
|
|
3134
|
+
avoidCollisions: !1,
|
|
3135
|
+
triggerComponent: /* @__PURE__ */ i(K, { content: h == null ? void 0 : h.searchButtonTooltip, children: /* @__PURE__ */ i(
|
|
3136
|
+
ce,
|
|
3137
|
+
{
|
|
3138
|
+
active: n,
|
|
3139
|
+
onClick: S,
|
|
3140
|
+
"aria-label": h == null ? void 0 : h.searchButtonTooltip,
|
|
3141
|
+
children: t || /* @__PURE__ */ i(ss, {})
|
|
3142
|
+
}
|
|
3143
|
+
) }),
|
|
3144
|
+
children: /* @__PURE__ */ W(
|
|
3145
|
+
"div",
|
|
3146
|
+
{
|
|
3147
|
+
ref: _,
|
|
3148
|
+
className: ne["rp-search-tool-content"],
|
|
3149
|
+
tabIndex: 0,
|
|
3150
|
+
onKeyDown: ie,
|
|
3151
|
+
children: [
|
|
3152
|
+
/* @__PURE__ */ W("div", { className: ne["rp-search-tool-input-wrapper"], children: [
|
|
3153
|
+
/* @__PURE__ */ W("div", { className: ne["rp-search-tool-input"], children: [
|
|
3154
|
+
/* @__PURE__ */ i(K, { content: h == null ? void 0 : h.searchInputTooltip, children: /* @__PURE__ */ i(
|
|
3155
|
+
pn,
|
|
3156
|
+
{
|
|
3157
|
+
value: p,
|
|
3158
|
+
onKeyDown: F,
|
|
3159
|
+
onChange: E,
|
|
3160
|
+
icon: /* @__PURE__ */ i(_n, {}),
|
|
3161
|
+
placeholder: h == null ? void 0 : h.searchInputPlaceholder,
|
|
3162
|
+
className: ne["rp-search-input"],
|
|
3163
|
+
ref: c,
|
|
3164
|
+
id: "search-input",
|
|
3165
|
+
name: "search-input",
|
|
3166
|
+
tabIndex: 0,
|
|
3167
|
+
children: !!p && /* @__PURE__ */ i("span", { className: ne["rp-search-tool-input-clear"], onClick: R, children: /* @__PURE__ */ i(Wr, {}) })
|
|
3168
|
+
}
|
|
3169
|
+
) }),
|
|
3170
|
+
m ? /* @__PURE__ */ i("span", { children: /* @__PURE__ */ i(mn, { className: ne["rp-search-loader-icon"] }) }) : /* @__PURE__ */ i("span", { children: A }),
|
|
3171
|
+
l && /* @__PURE__ */ i("div", { className: ne["rp-search-tool-controls"], children: /* @__PURE__ */ i(Mt, { onKeyPress: O, handleClose: L }) })
|
|
3172
|
+
] }),
|
|
3173
|
+
/* @__PURE__ */ W("div", { className: ne["rp-search-tool-input-checkboxes"], children: [
|
|
3174
|
+
l && /* @__PURE__ */ i(cn, {}),
|
|
3175
|
+
/* @__PURE__ */ i(
|
|
3176
|
+
Ht,
|
|
3177
|
+
{
|
|
3178
|
+
tabIndex: 0,
|
|
3179
|
+
name: "matchCase",
|
|
3180
|
+
value: H,
|
|
3181
|
+
onChange: U,
|
|
3182
|
+
children: h == null ? void 0 : h.searchMatchCaseLabel
|
|
3183
|
+
}
|
|
3184
|
+
),
|
|
3185
|
+
!l && /* @__PURE__ */ i(K, { content: h == null ? void 0 : h.searchMatchCaseTooltip, children: /* @__PURE__ */ i("div", { className: ne["rp-search-icon-info"], tabIndex: 0, children: /* @__PURE__ */ i(Vt, {}) }) }),
|
|
3186
|
+
/* @__PURE__ */ i(
|
|
3187
|
+
Ht,
|
|
3188
|
+
{
|
|
3189
|
+
tabIndex: 0,
|
|
3190
|
+
name: "wholeWord",
|
|
3191
|
+
value: G,
|
|
3192
|
+
onChange: X,
|
|
3193
|
+
children: h == null ? void 0 : h.searchWholeWordsLabel
|
|
3194
|
+
}
|
|
3195
|
+
),
|
|
3196
|
+
!l && /* @__PURE__ */ i(K, { content: h == null ? void 0 : h.searchWholeWordsTooltip, children: /* @__PURE__ */ i("div", { tabIndex: 0, className: ne["rp-search-icon-info"], children: /* @__PURE__ */ i(Vt, {}) }) })
|
|
3197
|
+
] })
|
|
3198
|
+
] }),
|
|
3199
|
+
!l && /* @__PURE__ */ W("div", { className: ne["rp-search-tool-controls"], children: [
|
|
3200
|
+
/* @__PURE__ */ i(cn, {}),
|
|
3201
|
+
/* @__PURE__ */ i(Mt, { onKeyPress: O, handleClose: L })
|
|
3202
|
+
] })
|
|
3203
|
+
]
|
|
3204
|
+
}
|
|
3205
|
+
)
|
|
3206
|
+
}
|
|
3207
|
+
) });
|
|
3208
|
+
}, cs = "_loading_wazy2_1", Fe = {
|
|
3209
|
+
"rp-loading-overlay": "_rp-loading-overlay_wazy2_1",
|
|
3210
|
+
"rp-loading-modal": "_rp-loading-modal_wazy2_14",
|
|
3211
|
+
"rp-loading-title": "_rp-loading-title_wazy2_27",
|
|
3212
|
+
"rp-loading-progress-bar": "_rp-loading-progress-bar_wazy2_35",
|
|
3213
|
+
"rp-loading-progress": "_rp-loading-progress_wazy2_35",
|
|
3214
|
+
"rp-loading-cancel-button": "_rp-loading-cancel-button_wazy2_55",
|
|
3215
|
+
loading: cs
|
|
3216
|
+
}, ls = ({ percentage: t }) => {
|
|
3217
|
+
const { cancel: e } = it(), { localeMessages: n } = de();
|
|
3218
|
+
return t < 1 ? null : /* @__PURE__ */ i("div", { className: se(Fe["rp-loading-overlay"]), children: /* @__PURE__ */ W("div", { className: se(Fe["rp-loading-modal"]), children: [
|
|
3219
|
+
/* @__PURE__ */ W("div", { className: se(Fe["rp-loading-title"]), children: [
|
|
3220
|
+
n == null ? void 0 : n.printLoadingMessage,
|
|
3221
|
+
"..."
|
|
3222
|
+
] }),
|
|
3223
|
+
/* @__PURE__ */ i("div", { className: se(Fe["rp-loading-progress-bar"]), children: /* @__PURE__ */ i(
|
|
3224
|
+
"div",
|
|
3225
|
+
{
|
|
3226
|
+
className: se(Fe["rp-loading-progress"]),
|
|
3227
|
+
style: { width: `${t}%` }
|
|
3228
|
+
}
|
|
3229
|
+
) }),
|
|
3230
|
+
/* @__PURE__ */ i("button", { className: se(Fe["rp-loading-cancel-button"]), onClick: e, children: n == null ? void 0 : n.printCancelLabel })
|
|
3231
|
+
] }) });
|
|
3232
|
+
}, ds = rt((t, e) => {
|
|
3233
|
+
const { showPrintProgress: n = !0 } = Ce(), { showPrintProgress: r = !0 } = Ie(), { progress: o, showDefaultProgress: s } = it(), { isSmallScreen: c } = Se(), { percentage: d } = o || {}, a = () => c ? { gridTemplateColumns: "25% 60% 15%" } : void 0, m = () => {
|
|
3234
|
+
if (!(!(s ?? (n && r)) || !d))
|
|
3235
|
+
return /* @__PURE__ */ i(ls, { percentage: d });
|
|
3236
|
+
};
|
|
3237
|
+
return /* @__PURE__ */ W("div", { children: [
|
|
3238
|
+
/* @__PURE__ */ i("div", { "data-rp": "topBar", ref: e, className: $e["rp-toolbar-content"], children: /* @__PURE__ */ W("div", { className: $e["rp-toolbar-wrapper"], style: a(), children: [
|
|
3239
|
+
/* @__PURE__ */ W("div", { "data-rp": "topBarLeft", className: $e["rp-toolbar-start"], children: [
|
|
3240
|
+
/* @__PURE__ */ i(as, {}),
|
|
3241
|
+
/* @__PURE__ */ i(Ci, {})
|
|
3242
|
+
] }),
|
|
3243
|
+
/* @__PURE__ */ i("div", { "data-rp": "topBarCenter", className: $e["rp-toolbar-middle"], children: /* @__PURE__ */ i(is, {}) }),
|
|
3244
|
+
/* @__PURE__ */ i("div", { "data-rp": "topBarRight", className: $e["rp-toolbar-end"], children: /* @__PURE__ */ i(Ji, {}) })
|
|
3245
|
+
] }) }),
|
|
3246
|
+
/* @__PURE__ */ i(m, {})
|
|
3247
|
+
] });
|
|
3248
|
+
}), wt = {
|
|
3249
|
+
"rp-sidebar-content-wrapper": "_rp-sidebar-content-wrapper_1bqgz_1",
|
|
3250
|
+
"rp-sidebar-content": "_rp-sidebar-content_1bqgz_1",
|
|
3251
|
+
"rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_1bqgz_16"
|
|
3252
|
+
}, Ge = {
|
|
3253
|
+
"rp-thumbnail-wrapper": "_rp-thumbnail-wrapper_3fenb_1",
|
|
3254
|
+
"rp-thumbnail-text": "_rp-thumbnail-text_3fenb_10",
|
|
3255
|
+
"rp-thumbnail": "_rp-thumbnail_3fenb_1",
|
|
3256
|
+
"rp-thumbnail-active": "_rp-thumbnail-active_3fenb_22",
|
|
3257
|
+
"rp-thumbnail-loader": "_rp-thumbnail-loader_3fenb_31"
|
|
3258
|
+
}, us = (t) => {
|
|
3259
|
+
const { pageNumber: e, isFocused: n, viewport: r } = t, { goToPage: o } = ue(), { pageRotate: s } = ot(), c = M(null), d = xn(), { pages: a } = re(), [m, g] = $(null), C = M(!1), u = M(), b = k(() => n ? Ge["rp-thumbnail-active"] : "", [n]), T = k(() => ({
|
|
3260
|
+
width: Math.round(r.width),
|
|
3261
|
+
height: Math.round(r.height)
|
|
3262
|
+
}), [r]), P = N(() => {
|
|
3263
|
+
e && o(e);
|
|
3264
|
+
}, [o, e]);
|
|
3265
|
+
return z(() => {
|
|
3266
|
+
const w = a.get(e);
|
|
3267
|
+
u.current === w || (g(null), u.current = w);
|
|
3268
|
+
}, [a, e]), z(() => {
|
|
3269
|
+
const w = a.get(e);
|
|
3270
|
+
if (!c.current || !e || !w || m)
|
|
3271
|
+
return;
|
|
3272
|
+
const y = new IntersectionObserver((p) => {
|
|
3273
|
+
p.forEach((f) => {
|
|
3274
|
+
if (C.current) {
|
|
3275
|
+
C.current = !1, d.removeQueue(`thumbnail-${e}`);
|
|
3276
|
+
return;
|
|
3277
|
+
}
|
|
3278
|
+
if (f.isIntersecting) {
|
|
3279
|
+
const h = document.createElement("canvas");
|
|
3280
|
+
C.current = !0, d.enqueue(
|
|
3281
|
+
`thumbnail-${e}`,
|
|
3282
|
+
{
|
|
3283
|
+
page: w.page,
|
|
3284
|
+
canvasElem: h,
|
|
3285
|
+
options: {
|
|
3286
|
+
scale: 1
|
|
3287
|
+
},
|
|
3288
|
+
onLoaded: () => {
|
|
3289
|
+
h.toBlob((l) => {
|
|
3290
|
+
if (!l)
|
|
3291
|
+
return;
|
|
3292
|
+
const v = URL.createObjectURL(l);
|
|
3293
|
+
g(v);
|
|
3294
|
+
});
|
|
3295
|
+
}
|
|
3296
|
+
},
|
|
3297
|
+
2
|
|
3298
|
+
);
|
|
3299
|
+
}
|
|
3300
|
+
});
|
|
3301
|
+
});
|
|
3302
|
+
return c.current && y.observe(c.current), () => {
|
|
3303
|
+
y.disconnect(), d.removeQueue(`thumbnail-${e}`);
|
|
3304
|
+
};
|
|
3305
|
+
}, [d, e, a, m]), /* @__PURE__ */ W(
|
|
3306
|
+
"div",
|
|
3307
|
+
{
|
|
3308
|
+
onClick: P,
|
|
3309
|
+
id: `page-${e}`,
|
|
3310
|
+
className: Ge["rp-thumbnail-wrapper"],
|
|
3311
|
+
ref: c,
|
|
3312
|
+
children: [
|
|
3313
|
+
/* @__PURE__ */ i(
|
|
3314
|
+
"div",
|
|
3315
|
+
{
|
|
3316
|
+
style: {
|
|
3317
|
+
transform: `rotate(${s[e || 0]}deg)`
|
|
3318
|
+
},
|
|
3319
|
+
className: se(b, Ge["rp-thumbnail"]),
|
|
3320
|
+
children: m ? /* @__PURE__ */ i(
|
|
3321
|
+
"img",
|
|
3322
|
+
{
|
|
3323
|
+
src: m,
|
|
3324
|
+
width: T.width,
|
|
3325
|
+
height: T.height,
|
|
3326
|
+
alt: "thumbnail"
|
|
3327
|
+
}
|
|
3328
|
+
) : /* @__PURE__ */ i(
|
|
3329
|
+
"div",
|
|
3330
|
+
{
|
|
3331
|
+
className: Ge["rp-thumbnail-loader"],
|
|
3332
|
+
style: {
|
|
3333
|
+
width: `${T.width}px`,
|
|
3334
|
+
height: `${T.height}px`
|
|
3335
|
+
},
|
|
3336
|
+
children: /* @__PURE__ */ i(mn, {})
|
|
3337
|
+
}
|
|
3338
|
+
)
|
|
3339
|
+
}
|
|
3340
|
+
),
|
|
3341
|
+
/* @__PURE__ */ i("div", { className: Ge["rp-thumbnail-text"], children: e })
|
|
3342
|
+
]
|
|
3343
|
+
}
|
|
3344
|
+
);
|
|
3345
|
+
}, ln = {
|
|
3346
|
+
"rp-thumbnails-container": "_rp-thumbnails-container_16vqr_1",
|
|
3347
|
+
"rp-thumbnails": "_rp-thumbnails_16vqr_1"
|
|
3348
|
+
}, ps = 16, hs = (t, e) => {
|
|
3349
|
+
const n = t == null ? void 0 : t.querySelector(`#page-${e}`);
|
|
3350
|
+
t && (n != null && n.offsetTop) && (t.scrollTop = (n == null ? void 0 : n.offsetTop) - ps);
|
|
3351
|
+
}, fs = rt((t, e) => {
|
|
3352
|
+
const { show: n, width: r } = t, { focusedPage: o, totalPages: s } = ue(), { thumbnailPages: c, addPage: d, thumbnailLength: a, addToPage: m } = yn(), g = M(null), C = M(1);
|
|
3353
|
+
dn(e, () => g.current);
|
|
3354
|
+
const u = k(() => Object.values(c), [c]), b = N(() => {
|
|
3355
|
+
const T = a + 1;
|
|
3356
|
+
T <= s && d(T);
|
|
3357
|
+
}, [d, s, a]);
|
|
3358
|
+
return z(() => {
|
|
3359
|
+
o > a && s > a ? m(o) : n && C.current !== o && (hs(g.current, o), C.current = o);
|
|
3360
|
+
}, [o, a, m, n, u]), Go(g.current, b), /* @__PURE__ */ i("div", { ref: g, className: ln["rp-thumbnails-container"], style: { width: r }, children: /* @__PURE__ */ i("div", { className: ln["rp-thumbnails"], children: n ? u.map((T, P) => {
|
|
3361
|
+
var w, y;
|
|
3362
|
+
return /* @__PURE__ */ i(
|
|
3363
|
+
us,
|
|
3364
|
+
{
|
|
3365
|
+
isFocused: o === ((w = T.page) == null ? void 0 : w.pageNumber),
|
|
3366
|
+
pageNumber: (y = T.page) == null ? void 0 : y.pageNumber,
|
|
3367
|
+
loading: T.loading,
|
|
3368
|
+
viewport: T.viewport,
|
|
3369
|
+
defaultRotation: T.defaultRotation
|
|
3370
|
+
},
|
|
3371
|
+
P
|
|
3372
|
+
);
|
|
3373
|
+
}) : null }) });
|
|
3374
|
+
}), ms = () => {
|
|
3375
|
+
const { thumbnailIcon: t } = ge(), { thumbnailIcon: e } = me();
|
|
3376
|
+
return t || e || /* @__PURE__ */ i(No, {});
|
|
3377
|
+
}, gs = () => {
|
|
3378
|
+
const { active: t, setActive: e } = yn(), [n, r] = $(qo), o = M(null), s = M(null), { thumbnailTool: c, sidebarEnable: d } = Ce(), { localeMessages: a } = de(), m = N(() => {
|
|
3379
|
+
e((C) => !C);
|
|
3380
|
+
}, []), g = k(() => typeof c != "boolean" && c ? /* @__PURE__ */ i(c, { onClick: m, active: t }) : c ? /* @__PURE__ */ i(K, { content: a == null ? void 0 : a.thumbnailTooltip, children: /* @__PURE__ */ i(
|
|
3381
|
+
ce,
|
|
3382
|
+
{
|
|
3383
|
+
onClick: m,
|
|
3384
|
+
active: t,
|
|
3385
|
+
"aria-label": a == null ? void 0 : a.thumbnailTooltip,
|
|
3386
|
+
children: /* @__PURE__ */ i(ms, {})
|
|
3387
|
+
}
|
|
3388
|
+
) }) : null, [c, t, m, a]);
|
|
3389
|
+
return /* @__PURE__ */ i(he, { children: d && /* @__PURE__ */ W(
|
|
3390
|
+
"div",
|
|
3391
|
+
{
|
|
3392
|
+
style: { "--rp-thumbnail-width": `${n}px` },
|
|
3393
|
+
className: wt["rp-sidebar-content-wrapper"],
|
|
3394
|
+
"data-rp": "sidebar",
|
|
3395
|
+
children: [
|
|
3396
|
+
/* @__PURE__ */ i("div", { ref: s, className: wt["rp-sidebar-content"], children: g }),
|
|
3397
|
+
/* @__PURE__ */ W(
|
|
3398
|
+
"div",
|
|
3399
|
+
{
|
|
3400
|
+
"data-rp": "thumbnailSidebar",
|
|
3401
|
+
hidden: !t,
|
|
3402
|
+
className: wt["rp-thumbnails-wrapper"],
|
|
3403
|
+
children: [
|
|
3404
|
+
/* @__PURE__ */ i(fs, { show: t, ref: o }),
|
|
3405
|
+
/* @__PURE__ */ i(
|
|
3406
|
+
Ao,
|
|
3407
|
+
{
|
|
3408
|
+
onWidthChange: r,
|
|
3409
|
+
thumbnailRef: o,
|
|
3410
|
+
leftSidebarRef: s
|
|
3411
|
+
}
|
|
3412
|
+
)
|
|
3413
|
+
]
|
|
3414
|
+
}
|
|
3415
|
+
)
|
|
3416
|
+
]
|
|
3417
|
+
}
|
|
3418
|
+
) });
|
|
3419
|
+
}, bc = uo((t, e) => {
|
|
3420
|
+
const {
|
|
3421
|
+
children: n,
|
|
3422
|
+
slots: r,
|
|
3423
|
+
icons: o,
|
|
3424
|
+
style: s,
|
|
3425
|
+
className: c,
|
|
3426
|
+
mobileWidth: d,
|
|
3427
|
+
onLoaded: a,
|
|
3428
|
+
cleanupOnLoaded: m,
|
|
3429
|
+
onLayoutWidthChange: g
|
|
3430
|
+
} = t, [C, u] = $(null), { setContainer: b, setContentRef: T } = Te(), { loading: P } = re(), { LoaderImageComponent: w } = Pt();
|
|
3431
|
+
return z(() => (a && a(), () => {
|
|
3432
|
+
m && m();
|
|
3433
|
+
}), [a, m]), // TODO: deprecated in v2.0.0, remove later ~
|
|
3434
|
+
/* @__PURE__ */ i(Nn, { toolbarRef: C, ref: e, children: /* @__PURE__ */ i(Do, { mobileWidth: d, onLayoutWidthChange: g, children: /* @__PURE__ */ i(zo, { slots: r, children: /* @__PURE__ */ i(Ho, { icons: o, children: /* @__PURE__ */ W(Oo, { getContainerRef: b, style: s, className: c, children: [
|
|
3435
|
+
/* @__PURE__ */ W(Fo, { children: [
|
|
3436
|
+
/* @__PURE__ */ W("div", { className: Pe["rp-layout"], children: [
|
|
3437
|
+
/* @__PURE__ */ i(
|
|
3438
|
+
ds,
|
|
3439
|
+
{
|
|
3440
|
+
ref: u
|
|
3441
|
+
}
|
|
3442
|
+
),
|
|
3443
|
+
/* @__PURE__ */ W("div", { className: Pe["rp-content"], children: [
|
|
3444
|
+
/* @__PURE__ */ i("div", { className: Pe["rp-sidebar"], children: /* @__PURE__ */ i(gs, {}) }),
|
|
3445
|
+
/* @__PURE__ */ i("div", { ref: T, className: Pe["rp-pages"], children: n })
|
|
3446
|
+
] })
|
|
3447
|
+
] }),
|
|
3448
|
+
/* @__PURE__ */ i(Mo, {})
|
|
3449
|
+
] }),
|
|
3450
|
+
P ? /* @__PURE__ */ i(
|
|
3451
|
+
"div",
|
|
3452
|
+
{
|
|
3453
|
+
className: Pe["rp-loader"],
|
|
3454
|
+
style: {
|
|
3455
|
+
position: "absolute",
|
|
3456
|
+
top: 0,
|
|
3457
|
+
left: 0,
|
|
3458
|
+
right: 0,
|
|
3459
|
+
bottom: 0,
|
|
3460
|
+
width: "100%",
|
|
3461
|
+
height: "100%"
|
|
3462
|
+
},
|
|
3463
|
+
children: /* @__PURE__ */ i(
|
|
3464
|
+
"div",
|
|
3465
|
+
{
|
|
3466
|
+
style: {
|
|
3467
|
+
display: "flex",
|
|
3468
|
+
justifyContent: "center",
|
|
3469
|
+
alignItems: "center",
|
|
3470
|
+
height: "100%",
|
|
3471
|
+
width: "100%"
|
|
3472
|
+
},
|
|
3473
|
+
children: w && /* @__PURE__ */ i(w, {})
|
|
3474
|
+
}
|
|
3475
|
+
)
|
|
3476
|
+
}
|
|
3477
|
+
) : null
|
|
3478
|
+
] }) }) }) }) });
|
|
3479
|
+
}), Tc = {
|
|
3480
|
+
"rp-toolbar-layout": "_rp-toolbar-layout_vwobs_1",
|
|
3481
|
+
"rp-content": "_rp-content_vwobs_7",
|
|
3482
|
+
"rp-topbar-content": "_rp-topbar-content_vwobs_13",
|
|
3483
|
+
"rp-sidebar-content": "_rp-sidebar-content_vwobs_22",
|
|
3484
|
+
"rp-pages": "_rp-pages_vwobs_32",
|
|
3485
|
+
"rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_vwobs_37"
|
|
3486
|
+
};
|
|
3487
|
+
export {
|
|
3488
|
+
us as $,
|
|
3489
|
+
Pn as A,
|
|
3490
|
+
Gr as B,
|
|
3491
|
+
In as C,
|
|
3492
|
+
Hi as D,
|
|
3493
|
+
Sn as E,
|
|
3494
|
+
xn as F,
|
|
3495
|
+
qr as G,
|
|
3496
|
+
Br as H,
|
|
3497
|
+
Kr as I,
|
|
3498
|
+
Qr as J,
|
|
3499
|
+
Nt as K,
|
|
3500
|
+
Nn as L,
|
|
3501
|
+
hi as M,
|
|
3502
|
+
gi as N,
|
|
3503
|
+
vi as O,
|
|
3504
|
+
pc as P,
|
|
3505
|
+
wi as Q,
|
|
3506
|
+
vc as R,
|
|
3507
|
+
as as S,
|
|
3508
|
+
fc as T,
|
|
3509
|
+
Kn as U,
|
|
3510
|
+
Yn as V,
|
|
3511
|
+
Qi as W,
|
|
3512
|
+
Yi as X,
|
|
3513
|
+
cn as Y,
|
|
3514
|
+
ts as Z,
|
|
3515
|
+
ds as _,
|
|
3516
|
+
bc as a,
|
|
3517
|
+
gs as a0,
|
|
3518
|
+
Bn as b,
|
|
3519
|
+
it as c,
|
|
3520
|
+
Et as d,
|
|
3521
|
+
mc as e,
|
|
3522
|
+
gc as f,
|
|
3523
|
+
hc as g,
|
|
3524
|
+
yn as h,
|
|
3525
|
+
vt as i,
|
|
3526
|
+
Ae as j,
|
|
3527
|
+
$e as k,
|
|
3528
|
+
Ci as l,
|
|
3529
|
+
is as m,
|
|
3530
|
+
Ji as n,
|
|
3531
|
+
Tc as o,
|
|
3532
|
+
fs as p,
|
|
3533
|
+
ls as q,
|
|
3534
|
+
$i as r,
|
|
3535
|
+
ji as s,
|
|
3536
|
+
bn as t,
|
|
3537
|
+
ue as u,
|
|
3538
|
+
Mr as v,
|
|
3539
|
+
Tn as w,
|
|
3540
|
+
Hr as x,
|
|
3541
|
+
Cn as y,
|
|
3542
|
+
$r as z
|
|
3543
|
+
};
|