@pdf-viewer/react 1.0.1 → 1.1.0-beta.1
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/RPDefaultLayout-62e0f668.js +2754 -0
- package/dist/assets/RPDefaultLayout.css +1 -1
- package/dist/components/RPConfig.js +340 -318
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPPages.js +3 -2
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +4 -2
- package/dist/components/layout/sidebar/RPSidebar.js +1 -1
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/OtherTool.js +2 -2
- package/dist/components/layout/toolbar/Paginate.js +1 -1
- package/dist/components/layout/toolbar/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +1 -1
- package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
- package/dist/components/layout/toolbar/SearchTool.js +1 -1
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +2 -2
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +1 -1
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +1 -1
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/Checkbox.js +92 -252
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/RPTooltip.js +224 -961
- package/dist/contexts/DarkModeContext.js +9 -9
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/RPDocumentContext.js +24 -37
- package/dist/contexts/RotationContext.js +8 -8
- package/dist/contexts/ScrollModeContext.js +5 -5
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/SelectionModeContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/contexts/ViewModeContext.js +9 -9
- package/dist/contexts/ZoomContext.js +11 -11
- package/dist/index-1db49c1a.js +1664 -0
- package/dist/index-3dff3fa8.js +307 -0
- package/dist/index-4f17fe4d.js +1657 -0
- package/dist/main.js +1 -1
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +37 -40
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePrint.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +1 -1
- package/dist/utils/hooks/useThumbnail.js +1 -1
- package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
- package/package.json +1 -1
- package/dist/RPDefaultLayout-adbb0836.js +0 -2707
- package/dist/floating-ui.react-dom-e6d5fe8f.js +0 -1327
- package/dist/index-316854c1.js +0 -2299
- package/dist/index-71898eb9.js +0 -139
|
@@ -0,0 +1,2754 @@
|
|
|
1
|
+
import { jsx as a, jsxs as O, Fragment as ze } from "react/jsx-runtime";
|
|
2
|
+
import * as V from "react";
|
|
3
|
+
import { useRef as W, useEffect as z, useCallback as x, useState as H, createContext as He, useContext as $e, useMemo as A, forwardRef as Ge, useImperativeHandle as Zt, createElement as Ee, PureComponent as Hn, Component as $n, memo as Gn } from "react";
|
|
4
|
+
import { ChevronUpIcon as Re } from "./components/icons/ChevronUpIcon.js";
|
|
5
|
+
import { UIButton as X } from "./components/ui/Button.js";
|
|
6
|
+
import { UIInput as jt } from "./components/ui/Input.js";
|
|
7
|
+
import { useScrollModeContext as Se } from "./contexts/ScrollModeContext.js";
|
|
8
|
+
import { useDocumentContext as Y } from "./contexts/RPDocumentContext.js";
|
|
9
|
+
import "./contexts/DarkModeContext.js";
|
|
10
|
+
import { ViewMode as Fe, ScrollMode as J, AnnotationSubType as st, SelectionMode as Vn, ZoomLevel as Ke } from "./utils/types.js";
|
|
11
|
+
import { useRotationContext as Ve } from "./contexts/RotationContext.js";
|
|
12
|
+
import { useLayerContext as Un } from "./contexts/LayerContext.js";
|
|
13
|
+
import { useZoomContext as Ue } from "./contexts/ZoomContext.js";
|
|
14
|
+
import { useViewModeContext as qe } from "./contexts/ViewModeContext.js";
|
|
15
|
+
import { useVirtualScrollContext as Ze } from "./contexts/VirtualScrollContext.js";
|
|
16
|
+
import { useVirtualGridContext as Bt } from "./contexts/VirtualGridContext.js";
|
|
17
|
+
import { useScrollStateContext as Kt } from "./contexts/ScrollStateContext.js";
|
|
18
|
+
import { useSelectionModeContext as qn } from "./contexts/SelectionModeContext.js";
|
|
19
|
+
import { useInitialStateContext as Zn } from "./contexts/InitialStateContext.js";
|
|
20
|
+
import { useFullScreenContext as jn } from "./contexts/FullScreenContext.js";
|
|
21
|
+
import "./contexts/FileInputContext.js";
|
|
22
|
+
import "./contexts/DropFileZoneContext.js";
|
|
23
|
+
import { renderPage as it } from "./utils/renderPage.js";
|
|
24
|
+
import { highlightMatches as Xt, findMatches as Bn, resetDivs as Kn } from "./utils/highlight.js";
|
|
25
|
+
import * as Jt from "pdfjs-dist";
|
|
26
|
+
import { PixelsPerInch as Xn, AnnotationMode as Jn, RenderingCancelledException as Yn, AnnotationLayer as Qn } from "pdfjs-dist";
|
|
27
|
+
import { usePageDimension as mt } from "./utils/hooks/usePageDimension.js";
|
|
28
|
+
import { useLayoutContainer as Ne } from "./contexts/LayoutContainerContext.js";
|
|
29
|
+
import "./components/RPConfig.js";
|
|
30
|
+
import { ThumbnailIcon as er } from "./components/icons/Thumbnail.js";
|
|
31
|
+
import { c as te } from "./clsx-0c6e471a.js";
|
|
32
|
+
import { LoaderIcon as Le } from "./components/icons/LoaderIcon.js";
|
|
33
|
+
import { useInfiniteScroll as tr } from "./utils/hooks/useInfiniteScroll.js";
|
|
34
|
+
import { RPSplitter as nr } from "./components/layout/sidebar/RPSplitter.js";
|
|
35
|
+
import { useToolbarComponentContext as de, ToolbarComponentProvider as rr } from "./contexts/ToolbarComponentContext.js";
|
|
36
|
+
import { useIconContext as ce, IconProvider as or } from "./contexts/IconContext.js";
|
|
37
|
+
import ne from "./components/ui/RPTooltip.js";
|
|
38
|
+
import { c as be, C as ar } from "./Container-fdb0a71f.js";
|
|
39
|
+
import { WrapperLayout as sr } from "./components/layout/WrapperLayout.js";
|
|
40
|
+
import { RPDropFileZone as ir } from "./components/RPDropFileZone.js";
|
|
41
|
+
import { useViewportContext as _e, ViewportProvider as cr } from "./contexts/ViewportContext.js";
|
|
42
|
+
import "./contexts/ThemeContext.js";
|
|
43
|
+
import { SimpleLinkService as lr } from "./utils/link_service.js";
|
|
44
|
+
import { dateFormatter as ct } from "./utils/dateFormatter.js";
|
|
45
|
+
import { sanitizeExternalUrl as ur } from "./utils/sanitizeExternalUrl.js";
|
|
46
|
+
import { useWatermark as dr } from "./utils/hooks/useWatermark.js";
|
|
47
|
+
import { useMousePressed as pr } from "./utils/hooks/useMousePressed.js";
|
|
48
|
+
import { useGrabScroll as hr } from "./utils/hooks/useGrabScroll.js";
|
|
49
|
+
import { usePinch as mr } from "./utils/hooks/usePinch.js";
|
|
50
|
+
import { getThumbnailViewport as yt } from "./utils/getThumbnailViewport.js";
|
|
51
|
+
import { useDebounce as fr } from "./utils/hooks/useDebounce.js";
|
|
52
|
+
import { appConsole as gr } from "./utils/appConsole.js";
|
|
53
|
+
import { FileUploadTool as Yt } from "./components/layout/toolbar/FileUploadTool.js";
|
|
54
|
+
import { DarkModeTool as vr } from "./components/layout/toolbar/DarkModeTool.js";
|
|
55
|
+
import { ThreeDotIcon as _r } from "./components/icons/ThreeDotIcon.js";
|
|
56
|
+
import { UIDropDown as ft } from "./components/ui/DropDown.js";
|
|
57
|
+
import { c as wr, a as gt, P as Me, b as xe, d as vt, i as br, k as Cr, u as Pr } from "./index-3dff3fa8.js";
|
|
58
|
+
import { D as Tr, u as Xe } from "./index-4f17fe4d.js";
|
|
59
|
+
import { a as Sr, h as yr, u as Ir, F as xr, b as Rr, G as ke } from "./index-1db49c1a.js";
|
|
60
|
+
import { CloseIcon as Qt } from "./components/icons/CloseIcon.js";
|
|
61
|
+
import { PropertyItem as Nr } from "./components/layout/toolbar/PropertyItem.js";
|
|
62
|
+
import { useOtherToolContext as Lr, OtherToolProvider as Mr } from "./contexts/OtherToolContext.js";
|
|
63
|
+
import { DocumentProperties as Er } from "./components/layout/toolbar/DocumentProperties.js";
|
|
64
|
+
import { RotateTool as Or } from "./components/layout/toolbar/RotateTool.js";
|
|
65
|
+
import { ScrollModeTool as Dr } from "./components/layout/toolbar/ScrollModeTool.js";
|
|
66
|
+
import { MenuSeparator as _t } from "./components/layout/toolbar/MenuSeparator.js";
|
|
67
|
+
import { FileDownloadDefaultIcon as Ar } from "./components/icons/FileDownloadDefaultIcon.js";
|
|
68
|
+
import { MenuItem as fe } from "./components/layout/toolbar/MenuItem.js";
|
|
69
|
+
import { PrintDefaultTool as zr } from "./components/icons/PrintDefaultIcon.js";
|
|
70
|
+
import { FullScreenTool as en } from "./components/layout/toolbar/FullScreenTool.js";
|
|
71
|
+
import { GoToDownIcon as tn } from "./components/icons/GoToDownIcon.js";
|
|
72
|
+
import { SelectionModeTool as Fr } from "./components/layout/toolbar/SelectionModeTool.js";
|
|
73
|
+
import { ZoomInIcon as kr } from "./components/icons/ZoomInIcon.js";
|
|
74
|
+
import { ZoomOutIcon as Wr } from "./components/icons/ZoomOutIcon.js";
|
|
75
|
+
import { PAGE_PADDING as It } from "./utils/constants.js";
|
|
76
|
+
import { getZoomLevel as Hr } from "./utils/getZoomLevel.js";
|
|
77
|
+
import { SearchIcon as $r } from "./components/icons/SearchIcon.js";
|
|
78
|
+
import { UICheckbox as xt } from "./components/ui/Checkbox.js";
|
|
79
|
+
import { ClearIcon as Gr } from "./components/icons/ClearIcon.js";
|
|
80
|
+
import './assets/RPDefaultLayout.css';const nn = () => {
|
|
81
|
+
const { viewMode: e } = qe(), { scrollMode: t } = Se(), { virtualScrollRef: n, pageScrollElementRef: r } = Ze(), { setFocusedPage: o } = oe(), s = W(), { columnCount: c } = Bt(), i = mt(), l = W(t), p = W(e), m = W(c);
|
|
82
|
+
z(() => {
|
|
83
|
+
n != null && n.scrollToItem && (s.current = n);
|
|
84
|
+
}, [n]);
|
|
85
|
+
const f = x(
|
|
86
|
+
(h) => {
|
|
87
|
+
if (!r)
|
|
88
|
+
return;
|
|
89
|
+
const g = Math.ceil(h / 2) * 2 - 1;
|
|
90
|
+
h === g + 1 ? r.scrollTo({ left: i.widths[g], top: 0 }) : r.scrollTo({ left: 0, top: 0 });
|
|
91
|
+
},
|
|
92
|
+
[r, i]
|
|
93
|
+
);
|
|
94
|
+
return z(() => {
|
|
95
|
+
l.current = t, p.current = e;
|
|
96
|
+
}, [t, e]), z(() => {
|
|
97
|
+
m.current = c;
|
|
98
|
+
}, [c]), { scrollToPage: x(
|
|
99
|
+
(h, g = "start") => {
|
|
100
|
+
const _ = h - 1;
|
|
101
|
+
let v = _, C = 0;
|
|
102
|
+
if (p.current === Fe.DUAL_PAGE && l.current === J.PAGE_SCROLLING) {
|
|
103
|
+
f(h);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (l.current === J.PAGE_SCROLLING) {
|
|
107
|
+
o(h);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
s.current && (l.current === J.HORIZONTAL_SCROLLING ? C = _ : p.current === Fe.DUAL_PAGE && (C = _ % 2, v = Math.floor(_ / 2)), s.current.scrollToItem({ rowIndex: v, columnIndex: C, align: g }));
|
|
111
|
+
},
|
|
112
|
+
[f, o]
|
|
113
|
+
) };
|
|
114
|
+
}, Vr = (e = 1) => {
|
|
115
|
+
const [t, n] = H(e), [r, o] = H(0), { scrollToPage: s } = nn(), c = W(1), { isScrolling: i } = Kt(), { viewMode: l } = qe(), { scrollMode: p } = Se(), m = fr(t, 100), f = x(
|
|
116
|
+
(v) => {
|
|
117
|
+
if (!/^[0-9]*$/g.test(v.toString()) || !v)
|
|
118
|
+
return { success: !1, currentPage: c.current };
|
|
119
|
+
const S = +v;
|
|
120
|
+
return S < 0 || S > r ? { success: !1, currentPage: c.current } : (n(S), c.current = S, { success: !0, currentPage: +v });
|
|
121
|
+
},
|
|
122
|
+
[r]
|
|
123
|
+
), u = x(f, [f]), h = x(
|
|
124
|
+
(v) => {
|
|
125
|
+
const C = f(v);
|
|
126
|
+
return C.success && (i.current = !0, s(C.currentPage)), C;
|
|
127
|
+
},
|
|
128
|
+
[f, s]
|
|
129
|
+
), g = x(() => {
|
|
130
|
+
let v = t - 1;
|
|
131
|
+
h(v);
|
|
132
|
+
}, [h, t, l, p]), _ = x(() => {
|
|
133
|
+
let v = t + 1;
|
|
134
|
+
h(v);
|
|
135
|
+
}, [h, t, l, p]);
|
|
136
|
+
return {
|
|
137
|
+
focusedPage: m,
|
|
138
|
+
totalPages: r,
|
|
139
|
+
setFocusedPage: u,
|
|
140
|
+
setTotalPages: o,
|
|
141
|
+
nextPage: _,
|
|
142
|
+
prevPage: g,
|
|
143
|
+
goToPage: h
|
|
144
|
+
};
|
|
145
|
+
}, rn = He({
|
|
146
|
+
focusedPage: 0,
|
|
147
|
+
setFocusedPage: (e) => {
|
|
148
|
+
},
|
|
149
|
+
goToPage: (e) => ({ success: !!e, currentPage: +e }),
|
|
150
|
+
totalPages: 0,
|
|
151
|
+
setTotalPages: (e) => {
|
|
152
|
+
},
|
|
153
|
+
prevPage: () => {
|
|
154
|
+
},
|
|
155
|
+
nextPage: () => {
|
|
156
|
+
}
|
|
157
|
+
}), oe = () => {
|
|
158
|
+
const e = $e(rn);
|
|
159
|
+
return typeof (e == null ? void 0 : e.focusedPage) > "u" && gr.error("Please use this hooks inside children component of RPProvider"), e;
|
|
160
|
+
}, Us = ({ children: e }) => {
|
|
161
|
+
const { initialPage: t = 1 } = Zn(), { pdf: n } = Y(), { focusedPage: r, totalPages: o, setFocusedPage: s, setTotalPages: c, goToPage: i, nextPage: l, prevPage: p } = Vr(t);
|
|
162
|
+
return z(() => {
|
|
163
|
+
n != null && n.numPages && c(n.numPages);
|
|
164
|
+
}, [n, c, o, t]), z(() => {
|
|
165
|
+
requestAnimationFrame(() => {
|
|
166
|
+
i(t);
|
|
167
|
+
});
|
|
168
|
+
}, [i, t]), /* @__PURE__ */ a(
|
|
169
|
+
rn.Provider,
|
|
170
|
+
{
|
|
171
|
+
value: {
|
|
172
|
+
focusedPage: r,
|
|
173
|
+
totalPages: o,
|
|
174
|
+
setFocusedPage: s,
|
|
175
|
+
setTotalPages: c,
|
|
176
|
+
nextPage: l,
|
|
177
|
+
prevPage: p,
|
|
178
|
+
goToPage: i
|
|
179
|
+
},
|
|
180
|
+
children: e
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
const Ur = () => {
|
|
185
|
+
const { pdf: e, pages: t } = Y(), [n, r] = H({
|
|
186
|
+
loadedPages: 0,
|
|
187
|
+
totalPages: 0,
|
|
188
|
+
percentage: 0
|
|
189
|
+
}), [o, s] = H(!1), [c, i] = H(!1), [l, p] = H(null), m = W(!1);
|
|
190
|
+
z(() => {
|
|
191
|
+
m.current;
|
|
192
|
+
}, [m]);
|
|
193
|
+
const f = x(() => {
|
|
194
|
+
document.documentElement.classList.remove("rp-print-html-printing"), document.body.classList.remove("rp-print-body-printing");
|
|
195
|
+
const P = document.querySelector(".rp-print-zone");
|
|
196
|
+
P && P.remove();
|
|
197
|
+
}, []), u = x(() => {
|
|
198
|
+
m.current = !1, s(!1), i(!1), p(null), r({
|
|
199
|
+
loadedPages: 0,
|
|
200
|
+
totalPages: 0,
|
|
201
|
+
percentage: 0
|
|
202
|
+
});
|
|
203
|
+
}, []), h = () => {
|
|
204
|
+
m.current = !0;
|
|
205
|
+
}, g = async ({
|
|
206
|
+
scratchCanvas: P,
|
|
207
|
+
pdfDocument: N,
|
|
208
|
+
pageNumber: d,
|
|
209
|
+
viewerPdfPage: b,
|
|
210
|
+
printResolution: w,
|
|
211
|
+
optionalContentConfigPromise: T,
|
|
212
|
+
printAnnotationStoragePromise: E
|
|
213
|
+
}) => {
|
|
214
|
+
if (m.current) {
|
|
215
|
+
u();
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const I = w / Xn.PDF;
|
|
219
|
+
P.width = Math.floor(b.width * I), P.height = Math.floor(b.height * I);
|
|
220
|
+
const y = P.getContext("2d");
|
|
221
|
+
y.save(), y.fillStyle = "rgb(255, 255, 255)", y.fillRect(0, 0, P.width, P.height), y.restore();
|
|
222
|
+
const [D, R] = await Promise.all([
|
|
223
|
+
N.getPage(d),
|
|
224
|
+
E
|
|
225
|
+
]);
|
|
226
|
+
if (m.current) {
|
|
227
|
+
u();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const L = {
|
|
231
|
+
canvasContext: y,
|
|
232
|
+
transform: [I, 0, 0, I, 0, 0],
|
|
233
|
+
viewport: D.getViewport({ scale: 1, rotation: b.rotation }),
|
|
234
|
+
intent: "print",
|
|
235
|
+
annotationMode: Jn.ENABLE_STORAGE,
|
|
236
|
+
optionalContentConfigPromise: T,
|
|
237
|
+
printAnnotationStorage: R
|
|
238
|
+
};
|
|
239
|
+
try {
|
|
240
|
+
return D.render(L).promise;
|
|
241
|
+
} catch (M) {
|
|
242
|
+
throw M instanceof Yn || console.error(M), M;
|
|
243
|
+
}
|
|
244
|
+
}, _ = x(() => {
|
|
245
|
+
const P = window.print;
|
|
246
|
+
return new Promise((N) => {
|
|
247
|
+
const d = (T) => {
|
|
248
|
+
setTimeout(() => {
|
|
249
|
+
P.call(window), setTimeout(() => T(), 20);
|
|
250
|
+
}, 0);
|
|
251
|
+
};
|
|
252
|
+
if (document.querySelector(".rp-print-zone")) {
|
|
253
|
+
d(N);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const w = new MutationObserver(() => {
|
|
257
|
+
document.querySelector(".rp-print-zone") && (d(N), w.disconnect());
|
|
258
|
+
});
|
|
259
|
+
w.observe(document.body, { childList: !0, subtree: !0 });
|
|
260
|
+
});
|
|
261
|
+
}, []), v = async (P) => {
|
|
262
|
+
const N = document.createElement("img"), d = document.createElement("div");
|
|
263
|
+
return d.classList.add("rp-print-page"), await new Promise((b, w) => {
|
|
264
|
+
P.toBlob((T) => {
|
|
265
|
+
T ? (N.src = URL.createObjectURL(T), N.onload = () => {
|
|
266
|
+
URL.revokeObjectURL(N.src), b();
|
|
267
|
+
}, N.onerror = w) : w(new Error("Failed to create blob"));
|
|
268
|
+
});
|
|
269
|
+
}).catch(() => {
|
|
270
|
+
}), d.appendChild(N), d;
|
|
271
|
+
}, C = (P, N) => {
|
|
272
|
+
const d = document.createElement("div");
|
|
273
|
+
d.classList.add("rp-print-zone");
|
|
274
|
+
const b = document.createElement("style"), w = N.get(1);
|
|
275
|
+
if (w) {
|
|
276
|
+
const { width: T, height: E } = w == null ? void 0 : w.page.getViewport({ scale: 1 });
|
|
277
|
+
b.innerHTML = `@page { size: ${T}px ${E}px }`;
|
|
278
|
+
}
|
|
279
|
+
return d.appendChild(b), d.append(...P), d;
|
|
280
|
+
}, S = x(async () => {
|
|
281
|
+
if (!e)
|
|
282
|
+
return;
|
|
283
|
+
u();
|
|
284
|
+
const P = document.createElement("canvas"), N = [];
|
|
285
|
+
try {
|
|
286
|
+
e.isPureXfa && console.warn("[rp] XFA Form is not supported at the moment.");
|
|
287
|
+
const b = e.getOptionalContentConfig({ intent: "print" }), w = Promise.resolve(
|
|
288
|
+
e.annotationStorage.print ?? void 0
|
|
289
|
+
), T = t.size;
|
|
290
|
+
for (const [I, y] of t) {
|
|
291
|
+
if (m.current) {
|
|
292
|
+
u();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const D = y.page.getViewport({ scale: 1 });
|
|
296
|
+
if (await g({
|
|
297
|
+
scratchCanvas: P,
|
|
298
|
+
pdfDocument: e,
|
|
299
|
+
pageNumber: I,
|
|
300
|
+
viewerPdfPage: D,
|
|
301
|
+
printResolution: 150,
|
|
302
|
+
optionalContentConfigPromise: b,
|
|
303
|
+
printAnnotationStoragePromise: w
|
|
304
|
+
}), m.current) {
|
|
305
|
+
u();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const R = await v(P);
|
|
309
|
+
N.push(R);
|
|
310
|
+
const L = parseFloat((N.length / T * 100).toFixed(2));
|
|
311
|
+
r({
|
|
312
|
+
loadedPages: I,
|
|
313
|
+
totalPages: T,
|
|
314
|
+
percentage: L
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
if (m.current) {
|
|
318
|
+
u();
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const E = C(N, t);
|
|
322
|
+
document.body.appendChild(E), document.documentElement.classList.add("rp-print-html-printing"), document.body.classList.add("rp-print-body-printing"), s(!0), await _();
|
|
323
|
+
} catch (d) {
|
|
324
|
+
i(!0), d instanceof Error && p(d);
|
|
325
|
+
} finally {
|
|
326
|
+
P.height = 0, P.width = 0;
|
|
327
|
+
}
|
|
328
|
+
}, [e, t, m]);
|
|
329
|
+
return z(() => {
|
|
330
|
+
const P = () => {
|
|
331
|
+
u(), f();
|
|
332
|
+
};
|
|
333
|
+
return window.addEventListener("afterprint", P, !0), () => {
|
|
334
|
+
window.removeEventListener("afterprint", P, !0);
|
|
335
|
+
};
|
|
336
|
+
}, [f, u]), {
|
|
337
|
+
print: S,
|
|
338
|
+
cancel: h,
|
|
339
|
+
progress: n,
|
|
340
|
+
isComplete: o,
|
|
341
|
+
isError: c,
|
|
342
|
+
error: l
|
|
343
|
+
};
|
|
344
|
+
}, on = He({
|
|
345
|
+
print: () => {
|
|
346
|
+
},
|
|
347
|
+
cancel: () => {
|
|
348
|
+
},
|
|
349
|
+
setOnProgress: (e) => {
|
|
350
|
+
},
|
|
351
|
+
progress: {},
|
|
352
|
+
setOnComplete: (e) => e(),
|
|
353
|
+
setOnError: (e) => {
|
|
354
|
+
try {
|
|
355
|
+
const t = new Error("Print error occurred");
|
|
356
|
+
e(t);
|
|
357
|
+
} catch (t) {
|
|
358
|
+
console.error("Error in setOnError callback:", t);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}), qs = ({ children: e }) => {
|
|
362
|
+
const [t, n] = H(null), [r, o] = H(null), { print: s, cancel: c, progress: i, isComplete: l, isError: p, error: m } = Ur(), f = x((v) => {
|
|
363
|
+
v && typeof v == "function" && o(() => v);
|
|
364
|
+
}, []), u = (v) => {
|
|
365
|
+
m && v(m);
|
|
366
|
+
}, h = x(
|
|
367
|
+
(v) => {
|
|
368
|
+
n(() => v);
|
|
369
|
+
},
|
|
370
|
+
[i, t]
|
|
371
|
+
);
|
|
372
|
+
z(() => {
|
|
373
|
+
l && r && g();
|
|
374
|
+
}, [l, r]), z(() => {
|
|
375
|
+
p && u((v) => {
|
|
376
|
+
console.error(v);
|
|
377
|
+
});
|
|
378
|
+
}, [p]), z(() => {
|
|
379
|
+
i && t && t(i);
|
|
380
|
+
}, [i, t]);
|
|
381
|
+
const g = () => {
|
|
382
|
+
r && (r(), o(null));
|
|
383
|
+
}, _ = {
|
|
384
|
+
print: s,
|
|
385
|
+
cancel: c,
|
|
386
|
+
setOnProgress: h,
|
|
387
|
+
setOnComplete: f,
|
|
388
|
+
setOnError: u,
|
|
389
|
+
progress: i
|
|
390
|
+
};
|
|
391
|
+
return /* @__PURE__ */ a(on.Provider, { value: _, children: e });
|
|
392
|
+
}, wt = () => {
|
|
393
|
+
const e = $e(on);
|
|
394
|
+
if (!e)
|
|
395
|
+
throw new Error("usePrintContext must be used within a PrintProvider");
|
|
396
|
+
return e;
|
|
397
|
+
}, qr = () => {
|
|
398
|
+
const [e, t] = H({}), { pages: n } = Y(), { rotate: r } = Ve(), o = A(() => Object.keys(e).length, [e]), s = x(
|
|
399
|
+
(i) => {
|
|
400
|
+
if (!n.size)
|
|
401
|
+
return;
|
|
402
|
+
const l = Array.from(n.values()).slice(0, i).map((f) => {
|
|
403
|
+
const { thumbnailViewport: u, scale: h } = yt(f.page, r);
|
|
404
|
+
return {
|
|
405
|
+
scale: h,
|
|
406
|
+
page: f.page,
|
|
407
|
+
loading: !0,
|
|
408
|
+
viewport: u
|
|
409
|
+
};
|
|
410
|
+
}), p = l.reduce((f, u) => (f[u.page.pageNumber] = u, f), {});
|
|
411
|
+
t(p);
|
|
412
|
+
const m = [];
|
|
413
|
+
for (const f of l) {
|
|
414
|
+
const u = document.createElement("canvas"), h = it(
|
|
415
|
+
f.page,
|
|
416
|
+
u,
|
|
417
|
+
f.scale,
|
|
418
|
+
r
|
|
419
|
+
).promise.then(() => {
|
|
420
|
+
const g = u.toDataURL();
|
|
421
|
+
return {
|
|
422
|
+
...f,
|
|
423
|
+
thumbnailSrc: g,
|
|
424
|
+
loading: !1
|
|
425
|
+
};
|
|
426
|
+
});
|
|
427
|
+
m.push(h);
|
|
428
|
+
}
|
|
429
|
+
Promise.all(m).then((f) => {
|
|
430
|
+
const u = f.reduce(
|
|
431
|
+
(h, g) => (h[g.page.pageNumber] = g, h),
|
|
432
|
+
{}
|
|
433
|
+
);
|
|
434
|
+
t((h) => ({ ...h, ...u }));
|
|
435
|
+
});
|
|
436
|
+
},
|
|
437
|
+
[n, r]
|
|
438
|
+
);
|
|
439
|
+
z(() => {
|
|
440
|
+
s(10);
|
|
441
|
+
}, [s]);
|
|
442
|
+
const c = x(
|
|
443
|
+
(i) => {
|
|
444
|
+
if (!n)
|
|
445
|
+
return;
|
|
446
|
+
const l = n.get(i);
|
|
447
|
+
if (!l)
|
|
448
|
+
return;
|
|
449
|
+
t((m) => ({
|
|
450
|
+
...m,
|
|
451
|
+
[i]: {
|
|
452
|
+
loading: !0,
|
|
453
|
+
page: l.page,
|
|
454
|
+
viewport: l.thumbnailViewport,
|
|
455
|
+
scale: l.thumbnailScale
|
|
456
|
+
}
|
|
457
|
+
}));
|
|
458
|
+
const p = document.createElement("canvas");
|
|
459
|
+
it(l.page, p, l.thumbnailScale, r).promise.then(() => {
|
|
460
|
+
const m = p.toDataURL(), { thumbnailViewport: f, scale: u } = yt(l.page, r);
|
|
461
|
+
return {
|
|
462
|
+
scale: u,
|
|
463
|
+
thumbnailSrc: m,
|
|
464
|
+
page: l.page,
|
|
465
|
+
loading: !1,
|
|
466
|
+
viewport: f
|
|
467
|
+
};
|
|
468
|
+
}).then((m) => {
|
|
469
|
+
t((f) => ({ ...f, [i]: m }));
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
[n, r]
|
|
473
|
+
);
|
|
474
|
+
return { thumbnailPages: e, addPage: c, addToPage: s, thumbnailLength: o };
|
|
475
|
+
}, an = He({
|
|
476
|
+
thumbnailPages: {},
|
|
477
|
+
addPage: (e) => {
|
|
478
|
+
},
|
|
479
|
+
addToPage: (e) => {
|
|
480
|
+
},
|
|
481
|
+
thumbnailLength: 0,
|
|
482
|
+
setActive: (e) => {
|
|
483
|
+
},
|
|
484
|
+
active: !1
|
|
485
|
+
}), sn = () => $e(an), Zs = ({
|
|
486
|
+
children: e,
|
|
487
|
+
initialThumbnailsVisible: t
|
|
488
|
+
}) => {
|
|
489
|
+
const { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: s } = qr(), [c, i] = H(t);
|
|
490
|
+
return /* @__PURE__ */ a(
|
|
491
|
+
an.Provider,
|
|
492
|
+
{
|
|
493
|
+
value: { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: s, active: c, setActive: i },
|
|
494
|
+
children: e
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
}, Zr = (e = {}, t = "") => {
|
|
498
|
+
const [n, r] = H(t), [o, s] = H(!1), { pdf: c, pages: i } = Y(), l = mt(), p = W(!n), { currentZoom: m } = Ue(), [f, u] = H([]), { setFocusedPage: h } = oe(), [g, _] = H(0), { pageScrollElementRef: v, virtualScrollableElementRef: C } = Ze(), { scrollMode: S } = Se(), [P, N] = H(null), d = W({}), b = A(() => g === 0 ? null : f[g - 1], [g, f]), w = A(() => f.length, [f]);
|
|
499
|
+
z(() => {
|
|
500
|
+
if (!b || !i)
|
|
501
|
+
return;
|
|
502
|
+
const y = C || v;
|
|
503
|
+
if (!y)
|
|
504
|
+
return;
|
|
505
|
+
const D = i.get(b.page), R = y.clientHeight / 2, L = y.clientWidth / 2;
|
|
506
|
+
let M = 0, F = 0;
|
|
507
|
+
S === J.PAGE_SCROLLING && h(b.page), S === J.VERTICAL_SCROLLING && (M = l.heights.slice(0, b.page - 1).reduce((U, Z) => U + Z, 0)), S === J.HORIZONTAL_SCROLLING && (F = l.widths.slice(0, b.page - 1).reduce((U, Z) => U + Z, 0));
|
|
508
|
+
let $;
|
|
509
|
+
if (!D)
|
|
510
|
+
return;
|
|
511
|
+
const q = d.current[b.page], K = D.page.getViewport({ scale: 1 });
|
|
512
|
+
$ = new Jt.TextLayer({
|
|
513
|
+
viewport: K,
|
|
514
|
+
textContentSource: q,
|
|
515
|
+
container: document.createElement("div")
|
|
516
|
+
}), $.render().then(() => {
|
|
517
|
+
const U = $.textDivs[b.start.idx], [Z] = Xt([b], q, $.textDivs), se = l.widths[b.page - 1], pe = l.heights[b.page - 1], j = document.createElement("div"), Q = document.createElement("div");
|
|
518
|
+
U.style.position = "absolute", U.style.color = "transparent", Q.style.position = "absolute", Q.style.top = "0", Q.style.setProperty("--scale-factor", `${m}`), j.style.position = "relative", j.style.width = `${se}px`, j.style.height = `${pe}px`, j.style.zIndex = "-1", j.appendChild(U), Q.appendChild(j), document.body.prepend(Q);
|
|
519
|
+
const he = Z.element.getBoundingClientRect(), we = M + +he.top - R + he.height / 2, G = {
|
|
520
|
+
left: F + +he.left - L + he.width / 2,
|
|
521
|
+
top: we
|
|
522
|
+
};
|
|
523
|
+
document.body.removeChild(Q), y.scrollTo({
|
|
524
|
+
...G
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
}, [
|
|
528
|
+
i,
|
|
529
|
+
h,
|
|
530
|
+
l,
|
|
531
|
+
b,
|
|
532
|
+
S,
|
|
533
|
+
C,
|
|
534
|
+
v
|
|
535
|
+
]);
|
|
536
|
+
const T = x(() => {
|
|
537
|
+
_((y) => w ? y + 1 > w ? 1 : y + 1 : 0);
|
|
538
|
+
}, [w]), E = x(() => {
|
|
539
|
+
_((y) => w ? y - 1 <= 0 ? w : y - 1 : 0);
|
|
540
|
+
}, [w]), I = x(async (y) => {
|
|
541
|
+
if (!y)
|
|
542
|
+
return {};
|
|
543
|
+
const D = y.numPages, R = {};
|
|
544
|
+
for (let L = 1; L <= D; L++) {
|
|
545
|
+
if (p.current)
|
|
546
|
+
throw "close pop over";
|
|
547
|
+
const M = await y.getPage(L);
|
|
548
|
+
R[L.toString()] = await M.getTextContent();
|
|
549
|
+
}
|
|
550
|
+
return R;
|
|
551
|
+
}, []);
|
|
552
|
+
return z(() => {
|
|
553
|
+
if (!n) {
|
|
554
|
+
p.current = !0, u([]), _(0);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
p.current = !1, s(!0), u([]), _(0), I(c).then((y) => {
|
|
558
|
+
d.current = y;
|
|
559
|
+
const R = Object.keys(y).reduce((L, M) => {
|
|
560
|
+
const F = Bn(
|
|
561
|
+
[n],
|
|
562
|
+
y[M],
|
|
563
|
+
Number(M) - 1,
|
|
564
|
+
e
|
|
565
|
+
).map(($, q) => ({ ...$, page: Number(M), pageMatchIdx: q }));
|
|
566
|
+
return [...L, ...F];
|
|
567
|
+
}, []);
|
|
568
|
+
u(R), _(R.length ? 1 : 0);
|
|
569
|
+
}).catch(() => {
|
|
570
|
+
u([]), _(0);
|
|
571
|
+
}).finally(() => s(!1));
|
|
572
|
+
}, [n, I, c, e]), {
|
|
573
|
+
search: n,
|
|
574
|
+
setSearch: r,
|
|
575
|
+
loading: o,
|
|
576
|
+
matches: f,
|
|
577
|
+
totalMatches: w,
|
|
578
|
+
currentMatchPosition: g,
|
|
579
|
+
currentMatch: b,
|
|
580
|
+
nextMatch: T,
|
|
581
|
+
prevMatch: E,
|
|
582
|
+
currentMatchElement: P,
|
|
583
|
+
setCurrentMatchElement: N
|
|
584
|
+
};
|
|
585
|
+
}, cn = He({
|
|
586
|
+
search: "",
|
|
587
|
+
setSearch: (e) => {
|
|
588
|
+
},
|
|
589
|
+
loading: !1,
|
|
590
|
+
matches: [],
|
|
591
|
+
totalMatches: 0,
|
|
592
|
+
currentMatchPosition: 0,
|
|
593
|
+
currentMatch: null,
|
|
594
|
+
nextMatch: () => {
|
|
595
|
+
},
|
|
596
|
+
prevMatch: () => {
|
|
597
|
+
},
|
|
598
|
+
searchOptions: {},
|
|
599
|
+
setSearchOptions: (e) => e,
|
|
600
|
+
currentMatchElement: null,
|
|
601
|
+
setCurrentMatchElement: (e) => {
|
|
602
|
+
}
|
|
603
|
+
}), js = ({
|
|
604
|
+
children: e,
|
|
605
|
+
initialSearch: t
|
|
606
|
+
}) => {
|
|
607
|
+
const [n, r] = H({}), {
|
|
608
|
+
loading: o,
|
|
609
|
+
setSearch: s,
|
|
610
|
+
totalMatches: c,
|
|
611
|
+
currentMatchPosition: i,
|
|
612
|
+
currentMatch: l,
|
|
613
|
+
search: p,
|
|
614
|
+
matches: m,
|
|
615
|
+
nextMatch: f,
|
|
616
|
+
prevMatch: u,
|
|
617
|
+
currentMatchElement: h,
|
|
618
|
+
setCurrentMatchElement: g
|
|
619
|
+
} = Zr(n, t);
|
|
620
|
+
return /* @__PURE__ */ a(
|
|
621
|
+
cn.Provider,
|
|
622
|
+
{
|
|
623
|
+
value: {
|
|
624
|
+
searchOptions: n,
|
|
625
|
+
setSearchOptions: r,
|
|
626
|
+
loading: o,
|
|
627
|
+
setSearch: s,
|
|
628
|
+
totalMatches: c,
|
|
629
|
+
currentMatchPosition: i,
|
|
630
|
+
currentMatch: l,
|
|
631
|
+
nextMatch: f,
|
|
632
|
+
prevMatch: u,
|
|
633
|
+
search: p,
|
|
634
|
+
matches: m,
|
|
635
|
+
currentMatchElement: h,
|
|
636
|
+
setCurrentMatchElement: g
|
|
637
|
+
},
|
|
638
|
+
children: e
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
}, ln = () => $e(cn), le = {
|
|
642
|
+
"rp-pages": "_rp-pages_34orh_1",
|
|
643
|
+
"rp-pages-horizontal-scroll": "_rp-pages-horizontal-scroll_34orh_7",
|
|
644
|
+
"rp-pages-container": "_rp-pages-container_34orh_11",
|
|
645
|
+
"rp-page-scrolling-wrapper": "_rp-page-scrolling-wrapper_34orh_17",
|
|
646
|
+
"rp-viewer": "_rp-viewer_34orh_22",
|
|
647
|
+
"rp-cursor-grab": "_rp-cursor-grab_34orh_27",
|
|
648
|
+
"rp-cursor-grabbing": "_rp-cursor-grabbing_34orh_35"
|
|
649
|
+
}, Je = {
|
|
650
|
+
"rp-page-wrapper": "_rp-page-wrapper_h7a2q_1",
|
|
651
|
+
"rp-page": "_rp-page_h7a2q_1",
|
|
652
|
+
"rp-loader-wrapper": "_rp-loader-wrapper_h7a2q_14"
|
|
653
|
+
}, jr = (e) => {
|
|
654
|
+
const { pageNumber: t, onLoaded: n, onLoading: r } = e, o = W(null), { pages: s } = Y(), { rotate: c } = Ve(), i = W(), { currentZoom: l } = Ue();
|
|
655
|
+
return z(() => {
|
|
656
|
+
if (!s || l === 0)
|
|
657
|
+
return;
|
|
658
|
+
const p = s.get(t);
|
|
659
|
+
if (o.current && p) {
|
|
660
|
+
const m = o.current;
|
|
661
|
+
m.hidden = !0;
|
|
662
|
+
const f = i.current;
|
|
663
|
+
f && f.cancel(), r && r(), i.current = it(p.page, m, l, c), i.current.promise.then(() => {
|
|
664
|
+
m.hidden = !1;
|
|
665
|
+
}).catch((u) => {
|
|
666
|
+
}).finally(() => {
|
|
667
|
+
n && n();
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
}, [s, t, c, l, r, n]), /* @__PURE__ */ a("canvas", { "data-rp": `page-${t}-canvas`, ref: o });
|
|
671
|
+
}, Ye = {
|
|
672
|
+
"rp-text-layer": "_rp-text-layer_1mgyz_1",
|
|
673
|
+
"rp-text-layer-text": "_rp-text-layer-text_1mgyz_9"
|
|
674
|
+
}, Br = (e) => {
|
|
675
|
+
const { pageNumber: t } = e, { pages: n } = Y(), r = W(null), { matches: o, currentMatch: s, setCurrentMatchElement: c } = ln(), [i, l] = H(
|
|
676
|
+
[]
|
|
677
|
+
), p = W(), m = W(), f = W(), u = A(() => o.filter((g) => g.pageIndex === t - 1), [o, t]), h = x(
|
|
678
|
+
(g, _, v = !1) => {
|
|
679
|
+
if (v && Kn(g, _), !u.length) {
|
|
680
|
+
f.current = void 0, l([]);
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const C = Xt(u, g, _);
|
|
684
|
+
l(C);
|
|
685
|
+
},
|
|
686
|
+
[u]
|
|
687
|
+
);
|
|
688
|
+
return z(() => {
|
|
689
|
+
var v;
|
|
690
|
+
if ((v = f.current) == null || v.classList.remove("selected"), !i.length || !s || s.pageIndex !== t - 1)
|
|
691
|
+
return;
|
|
692
|
+
const g = u.findIndex(
|
|
693
|
+
(C) => JSON.stringify(C) === JSON.stringify(s)
|
|
694
|
+
);
|
|
695
|
+
if (g === -1)
|
|
696
|
+
return;
|
|
697
|
+
const _ = i.find((C) => C.index === g);
|
|
698
|
+
_ && (f.current = _.element, c(_.element), _.element.classList.add("selected"));
|
|
699
|
+
}, [s, i, u]), z(() => {
|
|
700
|
+
const g = n.get(t);
|
|
701
|
+
if (!(!g || !r.current))
|
|
702
|
+
return p.current && p.current.cancel(), g.page.getTextContent().then((_) => {
|
|
703
|
+
const v = g.page.getViewport({ scale: 1 });
|
|
704
|
+
return p.current = new Jt.TextLayer({
|
|
705
|
+
viewport: v,
|
|
706
|
+
textContentSource: _,
|
|
707
|
+
container: r.current
|
|
708
|
+
}), m.current = _, r.current && (r.current.innerText = ""), p.current.render();
|
|
709
|
+
}).then(() => {
|
|
710
|
+
var C;
|
|
711
|
+
[].slice.call(r.current.children).forEach((S) => {
|
|
712
|
+
S.classList.add(Ye["rp-text-layer-text"]);
|
|
713
|
+
});
|
|
714
|
+
const v = (C = p.current) == null ? void 0 : C.textDivs;
|
|
715
|
+
v && m.current && h(m.current, v);
|
|
716
|
+
}).catch(() => {
|
|
717
|
+
}), () => {
|
|
718
|
+
var _;
|
|
719
|
+
(_ = p.current) == null || _.cancel();
|
|
720
|
+
};
|
|
721
|
+
}, [n, t]), z(() => {
|
|
722
|
+
var v;
|
|
723
|
+
[].slice.call(r.current.children).forEach((C) => {
|
|
724
|
+
C.classList.add(Ye["rp-text-layer-text"]);
|
|
725
|
+
});
|
|
726
|
+
const _ = (v = p.current) == null ? void 0 : v.textDivs;
|
|
727
|
+
_ && m.current && h(m.current, _, !0);
|
|
728
|
+
}, [h]), /* @__PURE__ */ a(
|
|
729
|
+
"div",
|
|
730
|
+
{
|
|
731
|
+
"data-rp": `page-${t}-textLayer`,
|
|
732
|
+
className: Ye["rp-text-layer"],
|
|
733
|
+
ref: r
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
}, Kr = {
|
|
737
|
+
"rp-annotation-layer": "_rp-annotation-layer_o0ksd_1"
|
|
738
|
+
}, un = ["click", "dblclick", "mouseover", "input", "change"];
|
|
739
|
+
let Xr = "https://unpkg.com/pdfjs-dist@4.4.168/web/images/";
|
|
740
|
+
const lt = /* @__PURE__ */ new Map(), dn = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
|
|
741
|
+
function Jr(e, t) {
|
|
742
|
+
const n = dn(e, t);
|
|
743
|
+
return lt.has(n) ? lt.get(n) ?? null : null;
|
|
744
|
+
}
|
|
745
|
+
const Yr = (e, t, n) => {
|
|
746
|
+
lt.set(dn(e, t), n);
|
|
747
|
+
}, Rt = (e, t) => {
|
|
748
|
+
switch (t[1].name) {
|
|
749
|
+
case "XYZ":
|
|
750
|
+
return {
|
|
751
|
+
bottomOffset: (n, r) => t[3] === null ? r : t[3],
|
|
752
|
+
leftOffset: (n, r) => t[2] === null ? 0 : t[2],
|
|
753
|
+
pageIndex: e,
|
|
754
|
+
scaleTo: t[4]
|
|
755
|
+
};
|
|
756
|
+
case "Fit":
|
|
757
|
+
case "FitB":
|
|
758
|
+
return {
|
|
759
|
+
bottomOffset: 0,
|
|
760
|
+
leftOffset: 0,
|
|
761
|
+
pageIndex: e,
|
|
762
|
+
scaleTo: 1
|
|
763
|
+
};
|
|
764
|
+
case "FitH":
|
|
765
|
+
case "FitBH":
|
|
766
|
+
return {
|
|
767
|
+
bottomOffset: t[2],
|
|
768
|
+
leftOffset: 0,
|
|
769
|
+
pageIndex: e,
|
|
770
|
+
scaleTo: 1
|
|
771
|
+
};
|
|
772
|
+
default:
|
|
773
|
+
return {
|
|
774
|
+
bottomOffset: 0,
|
|
775
|
+
leftOffset: 0,
|
|
776
|
+
pageIndex: e,
|
|
777
|
+
scaleTo: 1
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
async function pn(e, t) {
|
|
782
|
+
let n;
|
|
783
|
+
if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
|
|
784
|
+
const r = n[0], o = Jr(e, r);
|
|
785
|
+
if (o === null) {
|
|
786
|
+
const s = await e.getPageIndex(r);
|
|
787
|
+
return Yr(e, r, s), await pn(e, n);
|
|
788
|
+
} else
|
|
789
|
+
return Rt(o, n);
|
|
790
|
+
} else
|
|
791
|
+
return Rt(n[0], n);
|
|
792
|
+
}
|
|
793
|
+
function Qr(e) {
|
|
794
|
+
const { id: t, url: n, unsafeUrl: r } = e;
|
|
795
|
+
new MutationObserver((s, c) => {
|
|
796
|
+
const i = document.querySelector(`[data-annotation-id="${t}"]`);
|
|
797
|
+
if (i) {
|
|
798
|
+
const l = i.querySelector("a"), p = ur((n || r) ?? "", "");
|
|
799
|
+
l && (l.setAttribute("target", "_blank"), l.setAttribute("href", p), l.setAttribute("rel", "noopener noreferrer")), c.disconnect();
|
|
800
|
+
}
|
|
801
|
+
}).observe(document.body, { childList: !0, subtree: !0 });
|
|
802
|
+
}
|
|
803
|
+
const eo = (e) => {
|
|
804
|
+
const n = e.target.parentNode;
|
|
805
|
+
if (!n)
|
|
806
|
+
return;
|
|
807
|
+
const r = new MutationObserver((o) => {
|
|
808
|
+
o.forEach(() => {
|
|
809
|
+
n.querySelectorAll(
|
|
810
|
+
'[data-l10n-id="pdfjs-annotation-date-time-string"]'
|
|
811
|
+
).forEach((c) => {
|
|
812
|
+
const i = c.getAttribute("data-l10n-args");
|
|
813
|
+
if (i)
|
|
814
|
+
try {
|
|
815
|
+
const { dateObj: l } = JSON.parse(i);
|
|
816
|
+
c.textContent = ct(l);
|
|
817
|
+
} catch {
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
return r.observe(n, {
|
|
823
|
+
childList: !0,
|
|
824
|
+
// Watch for changes to child elements
|
|
825
|
+
subtree: !0,
|
|
826
|
+
// Watch all descendants, not just direct children
|
|
827
|
+
attributes: !0
|
|
828
|
+
// Watch for changes to attributes
|
|
829
|
+
}), () => r.disconnect();
|
|
830
|
+
}, Nt = (e, t, n, r) => {
|
|
831
|
+
if (e.type !== "click")
|
|
832
|
+
return;
|
|
833
|
+
const o = e.target, s = o.getAttribute("data-element-id"), c = o.getAttribute("href");
|
|
834
|
+
if (c && c !== "#")
|
|
835
|
+
return;
|
|
836
|
+
const i = t.find((l) => l.id === s);
|
|
837
|
+
!i || i.annotationType !== st.Link || i.dest && pn(n, i.dest).then((l) => {
|
|
838
|
+
r(l);
|
|
839
|
+
});
|
|
840
|
+
};
|
|
841
|
+
function to(e, t) {
|
|
842
|
+
for (const n of un)
|
|
843
|
+
e.addEventListener(n, t);
|
|
844
|
+
}
|
|
845
|
+
function Lt(e, t) {
|
|
846
|
+
for (const n of un)
|
|
847
|
+
e.removeEventListener(n, t);
|
|
848
|
+
}
|
|
849
|
+
const no = (e) => {
|
|
850
|
+
const { pageNumber: t } = e, n = W(null), { pages: r, pdf: o } = Y(), s = W(), [c, i] = H(), { setFocusedPage: l, goToPage: p } = oe(), { scrollMode: m } = Se(), f = A(() => r.get(t), [r, t]), u = A(() => f == null ? void 0 : f.page.getViewport(), [f]);
|
|
851
|
+
z(() => {
|
|
852
|
+
s.current && (s.current.div.replaceChildren(), s.current = void 0);
|
|
853
|
+
}, [o]);
|
|
854
|
+
const h = A(() => o == null ? void 0 : o.annotationStorage, [o]);
|
|
855
|
+
z(() => {
|
|
856
|
+
f && f.page.getAnnotations().then((_) => {
|
|
857
|
+
s.current = void 0, i(_), n.current && (n.current.innerText = "");
|
|
858
|
+
});
|
|
859
|
+
}, [f]);
|
|
860
|
+
const g = x(
|
|
861
|
+
(_) => {
|
|
862
|
+
eo(_), !(!c || !o) && (m === J.PAGE_SCROLLING ? Nt(_, c, o, (v) => l(v.pageIndex + 1)) : Nt(_, c, o, (v) => p(v.pageIndex + 1)));
|
|
863
|
+
},
|
|
864
|
+
[o, c, p, l, m]
|
|
865
|
+
);
|
|
866
|
+
return z(() => {
|
|
867
|
+
if (!f || !c)
|
|
868
|
+
return;
|
|
869
|
+
const _ = f.page.getViewport();
|
|
870
|
+
if (s.current) {
|
|
871
|
+
s.current.update({
|
|
872
|
+
viewport: _.clone({ dontFlip: !0 })
|
|
873
|
+
});
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
for (const C of c) {
|
|
877
|
+
const { annotationType: S } = C;
|
|
878
|
+
switch (S) {
|
|
879
|
+
case st.Link:
|
|
880
|
+
Qr(C);
|
|
881
|
+
break;
|
|
882
|
+
case st.Widget:
|
|
883
|
+
break;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return (async () => {
|
|
887
|
+
s.current = new Qn({
|
|
888
|
+
div: n.current,
|
|
889
|
+
accessibilityManager: void 0,
|
|
890
|
+
annotationCanvasMap: void 0,
|
|
891
|
+
annotationEditorUIManager: void 0,
|
|
892
|
+
structTreeLayer: void 0,
|
|
893
|
+
page: f.page,
|
|
894
|
+
viewport: _.clone({ dontFlip: !0 })
|
|
895
|
+
}), n.current && Lt(n.current, g);
|
|
896
|
+
const C = await (o == null ? void 0 : o.hasJSActions()), S = await (o == null ? void 0 : o.getFieldObjects());
|
|
897
|
+
return s.current.render({
|
|
898
|
+
annotations: c,
|
|
899
|
+
annotationStorage: h,
|
|
900
|
+
hasJSActions: C,
|
|
901
|
+
fieldObjects: S,
|
|
902
|
+
div: n.current,
|
|
903
|
+
viewport: _.clone({ dontFlip: !0 }),
|
|
904
|
+
page: f.page,
|
|
905
|
+
imageResourcesPath: Xr,
|
|
906
|
+
renderForms: !1,
|
|
907
|
+
linkService: new lr(),
|
|
908
|
+
downloadManager: null,
|
|
909
|
+
enableScripting: !1
|
|
910
|
+
});
|
|
911
|
+
})().then(() => {
|
|
912
|
+
n.current && to(n.current, g);
|
|
913
|
+
}), () => {
|
|
914
|
+
n.current && Lt(n.current, g);
|
|
915
|
+
};
|
|
916
|
+
}, [o, c, g]), /* @__PURE__ */ a(
|
|
917
|
+
"div",
|
|
918
|
+
{
|
|
919
|
+
"data-rp": `page-${t}-annotationLayer`,
|
|
920
|
+
style: { width: `${u == null ? void 0 : u.width}px`, height: `${u == null ? void 0 : u.height}px` },
|
|
921
|
+
className: Kr["rp-annotation-layer"],
|
|
922
|
+
ref: n
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
}, ro = Array.from({ length: 21 }, (e, t) => Number((t * 0.05).toFixed(2))), bt = Ge((e, t) => {
|
|
926
|
+
const { pageNumber: n, style: r, onIntersectRatioChange: o, ...s } = e, { pages: c } = Y(), { rotate: i } = Ve(), { textLayer: l } = Un(), { currentZoom: p } = Ue(), m = W(c.get(n)), [f, u] = H(!1), h = W(null), [g, _] = H({
|
|
927
|
+
width: 0,
|
|
928
|
+
height: 0
|
|
929
|
+
});
|
|
930
|
+
Zt(t, () => h.current), z(() => {
|
|
931
|
+
if (c && (m.current = c.get(n), m.current)) {
|
|
932
|
+
const P = m.current.page.getViewport({ scale: p, rotation: i });
|
|
933
|
+
_(P);
|
|
934
|
+
}
|
|
935
|
+
}, [c, n, i, p]);
|
|
936
|
+
const v = A(() => {
|
|
937
|
+
switch (i) {
|
|
938
|
+
case 90:
|
|
939
|
+
return `${g.width / 2}px ${g.width / 2}px`;
|
|
940
|
+
case -90:
|
|
941
|
+
case 270:
|
|
942
|
+
return `${g.height / 2}px ${g.height / 2}px`;
|
|
943
|
+
default:
|
|
944
|
+
return "center";
|
|
945
|
+
}
|
|
946
|
+
}, [i, g]), C = x(() => {
|
|
947
|
+
u(!0);
|
|
948
|
+
}, []), S = x(() => {
|
|
949
|
+
u(!1);
|
|
950
|
+
}, []);
|
|
951
|
+
return z(() => {
|
|
952
|
+
const P = new IntersectionObserver(
|
|
953
|
+
(N) => {
|
|
954
|
+
o && o(n, N[0].intersectionRatio);
|
|
955
|
+
},
|
|
956
|
+
{ threshold: ro }
|
|
957
|
+
);
|
|
958
|
+
return h.current && P.observe(h.current), () => {
|
|
959
|
+
P.disconnect(), o && o(n, -1);
|
|
960
|
+
};
|
|
961
|
+
}, [o, n, i]), /* @__PURE__ */ a(
|
|
962
|
+
"div",
|
|
963
|
+
{
|
|
964
|
+
ref: h,
|
|
965
|
+
id: `page-${n}`,
|
|
966
|
+
"data-rp": `page-${n}`,
|
|
967
|
+
...s,
|
|
968
|
+
style: {
|
|
969
|
+
...r,
|
|
970
|
+
"--rp-rotate": `${i}deg`,
|
|
971
|
+
"--rp-page-rotate-translate": `${v}`,
|
|
972
|
+
"--scale-factor": p
|
|
973
|
+
},
|
|
974
|
+
className: Je["rp-page-wrapper"],
|
|
975
|
+
children: /* @__PURE__ */ O(
|
|
976
|
+
"div",
|
|
977
|
+
{
|
|
978
|
+
style: {
|
|
979
|
+
width: `${g.width}px`,
|
|
980
|
+
height: `${g.height}px`
|
|
981
|
+
},
|
|
982
|
+
className: Je["rp-page"],
|
|
983
|
+
children: [
|
|
984
|
+
/* @__PURE__ */ a(jr, { onLoading: C, onLoaded: S, pageNumber: n }),
|
|
985
|
+
f && /* @__PURE__ */ a("div", { className: Je["rp-loader-wrapper"], children: /* @__PURE__ */ a(Le, {}) }),
|
|
986
|
+
l && /* @__PURE__ */ a(Br, { pageNumber: n }),
|
|
987
|
+
/* @__PURE__ */ a(no, { pageNumber: n })
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
)
|
|
991
|
+
}
|
|
992
|
+
);
|
|
993
|
+
});
|
|
994
|
+
function ut() {
|
|
995
|
+
return ut = Object.assign ? Object.assign.bind() : function(e) {
|
|
996
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
997
|
+
var n = arguments[t];
|
|
998
|
+
for (var r in n)
|
|
999
|
+
({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
1000
|
+
}
|
|
1001
|
+
return e;
|
|
1002
|
+
}, ut.apply(null, arguments);
|
|
1003
|
+
}
|
|
1004
|
+
function Mt(e) {
|
|
1005
|
+
if (e === void 0)
|
|
1006
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1007
|
+
return e;
|
|
1008
|
+
}
|
|
1009
|
+
function dt(e, t) {
|
|
1010
|
+
return dt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
|
|
1011
|
+
return n.__proto__ = r, n;
|
|
1012
|
+
}, dt(e, t);
|
|
1013
|
+
}
|
|
1014
|
+
function oo(e, t) {
|
|
1015
|
+
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, dt(e, t);
|
|
1016
|
+
}
|
|
1017
|
+
var Et = Number.isNaN || function(t) {
|
|
1018
|
+
return typeof t == "number" && t !== t;
|
|
1019
|
+
};
|
|
1020
|
+
function ao(e, t) {
|
|
1021
|
+
return !!(e === t || Et(e) && Et(t));
|
|
1022
|
+
}
|
|
1023
|
+
function so(e, t) {
|
|
1024
|
+
if (e.length !== t.length)
|
|
1025
|
+
return !1;
|
|
1026
|
+
for (var n = 0; n < e.length; n++)
|
|
1027
|
+
if (!ao(e[n], t[n]))
|
|
1028
|
+
return !1;
|
|
1029
|
+
return !0;
|
|
1030
|
+
}
|
|
1031
|
+
function Qe(e, t) {
|
|
1032
|
+
t === void 0 && (t = so);
|
|
1033
|
+
var n, r = [], o, s = !1;
|
|
1034
|
+
function c() {
|
|
1035
|
+
for (var i = [], l = 0; l < arguments.length; l++)
|
|
1036
|
+
i[l] = arguments[l];
|
|
1037
|
+
return s && n === this && t(i, r) || (o = e.apply(this, i), s = !0, n = this, r = i), o;
|
|
1038
|
+
}
|
|
1039
|
+
return c;
|
|
1040
|
+
}
|
|
1041
|
+
function Ot(e, t) {
|
|
1042
|
+
if (e == null)
|
|
1043
|
+
return {};
|
|
1044
|
+
var n = {};
|
|
1045
|
+
for (var r in e)
|
|
1046
|
+
if ({}.hasOwnProperty.call(e, r)) {
|
|
1047
|
+
if (t.indexOf(r) !== -1)
|
|
1048
|
+
continue;
|
|
1049
|
+
n[r] = e[r];
|
|
1050
|
+
}
|
|
1051
|
+
return n;
|
|
1052
|
+
}
|
|
1053
|
+
var io = typeof performance == "object" && typeof performance.now == "function", Dt = io ? function() {
|
|
1054
|
+
return performance.now();
|
|
1055
|
+
} : function() {
|
|
1056
|
+
return Date.now();
|
|
1057
|
+
};
|
|
1058
|
+
function At(e) {
|
|
1059
|
+
cancelAnimationFrame(e.id);
|
|
1060
|
+
}
|
|
1061
|
+
function co(e, t) {
|
|
1062
|
+
var n = Dt();
|
|
1063
|
+
function r() {
|
|
1064
|
+
Dt() - n >= t ? e.call(null) : o.id = requestAnimationFrame(r);
|
|
1065
|
+
}
|
|
1066
|
+
var o = {
|
|
1067
|
+
id: requestAnimationFrame(r)
|
|
1068
|
+
};
|
|
1069
|
+
return o;
|
|
1070
|
+
}
|
|
1071
|
+
var et = -1;
|
|
1072
|
+
function lo(e) {
|
|
1073
|
+
if (e === void 0 && (e = !1), et === -1 || e) {
|
|
1074
|
+
var t = document.createElement("div"), n = t.style;
|
|
1075
|
+
n.width = "50px", n.height = "50px", n.overflow = "scroll", document.body.appendChild(t), et = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
|
|
1076
|
+
}
|
|
1077
|
+
return et;
|
|
1078
|
+
}
|
|
1079
|
+
var Ce = null;
|
|
1080
|
+
function zt(e) {
|
|
1081
|
+
if (e === void 0 && (e = !1), Ce === null || e) {
|
|
1082
|
+
var t = document.createElement("div"), n = t.style;
|
|
1083
|
+
n.width = "50px", n.height = "50px", n.overflow = "scroll", n.direction = "rtl";
|
|
1084
|
+
var r = document.createElement("div"), o = r.style;
|
|
1085
|
+
return o.width = "100px", o.height = "100px", t.appendChild(r), document.body.appendChild(t), t.scrollLeft > 0 ? Ce = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? Ce = "negative" : Ce = "positive-ascending"), document.body.removeChild(t), Ce;
|
|
1086
|
+
}
|
|
1087
|
+
return Ce;
|
|
1088
|
+
}
|
|
1089
|
+
var uo = 150, po = function(t) {
|
|
1090
|
+
var n = t.columnIndex;
|
|
1091
|
+
t.data;
|
|
1092
|
+
var r = t.rowIndex;
|
|
1093
|
+
return r + ":" + n;
|
|
1094
|
+
}, Oe = null, De = null, Ae = null;
|
|
1095
|
+
process.env.NODE_ENV !== "production" && typeof window < "u" && typeof window.WeakSet < "u" && (Oe = /* @__PURE__ */ new WeakSet(), De = /* @__PURE__ */ new WeakSet(), Ae = /* @__PURE__ */ new WeakSet());
|
|
1096
|
+
function ho(e) {
|
|
1097
|
+
var t, n = e.getColumnOffset, r = e.getColumnStartIndexForOffset, o = e.getColumnStopIndexForStartIndex, s = e.getColumnWidth, c = e.getEstimatedTotalHeight, i = e.getEstimatedTotalWidth, l = e.getOffsetForColumnAndAlignment, p = e.getOffsetForRowAndAlignment, m = e.getRowHeight, f = e.getRowOffset, u = e.getRowStartIndexForOffset, h = e.getRowStopIndexForStartIndex, g = e.initInstanceProps, _ = e.shouldResetStyleCacheOnItemSizeChange, v = e.validateProps;
|
|
1098
|
+
return t = /* @__PURE__ */ function(C) {
|
|
1099
|
+
oo(S, C);
|
|
1100
|
+
function S(N) {
|
|
1101
|
+
var d;
|
|
1102
|
+
return d = C.call(this, N) || this, d._instanceProps = g(d.props, Mt(d)), d._resetIsScrollingTimeoutId = null, d._outerRef = void 0, d.state = {
|
|
1103
|
+
instance: Mt(d),
|
|
1104
|
+
isScrolling: !1,
|
|
1105
|
+
horizontalScrollDirection: "forward",
|
|
1106
|
+
scrollLeft: typeof d.props.initialScrollLeft == "number" ? d.props.initialScrollLeft : 0,
|
|
1107
|
+
scrollTop: typeof d.props.initialScrollTop == "number" ? d.props.initialScrollTop : 0,
|
|
1108
|
+
scrollUpdateWasRequested: !1,
|
|
1109
|
+
verticalScrollDirection: "forward"
|
|
1110
|
+
}, d._callOnItemsRendered = void 0, d._callOnItemsRendered = Qe(function(b, w, T, E, I, y, D, R) {
|
|
1111
|
+
return d.props.onItemsRendered({
|
|
1112
|
+
overscanColumnStartIndex: b,
|
|
1113
|
+
overscanColumnStopIndex: w,
|
|
1114
|
+
overscanRowStartIndex: T,
|
|
1115
|
+
overscanRowStopIndex: E,
|
|
1116
|
+
visibleColumnStartIndex: I,
|
|
1117
|
+
visibleColumnStopIndex: y,
|
|
1118
|
+
visibleRowStartIndex: D,
|
|
1119
|
+
visibleRowStopIndex: R
|
|
1120
|
+
});
|
|
1121
|
+
}), d._callOnScroll = void 0, d._callOnScroll = Qe(function(b, w, T, E, I) {
|
|
1122
|
+
return d.props.onScroll({
|
|
1123
|
+
horizontalScrollDirection: T,
|
|
1124
|
+
scrollLeft: b,
|
|
1125
|
+
scrollTop: w,
|
|
1126
|
+
verticalScrollDirection: E,
|
|
1127
|
+
scrollUpdateWasRequested: I
|
|
1128
|
+
});
|
|
1129
|
+
}), d._getItemStyle = void 0, d._getItemStyle = function(b, w) {
|
|
1130
|
+
var T = d.props, E = T.columnWidth, I = T.direction, y = T.rowHeight, D = d._getItemStyleCache(_ && E, _ && I, _ && y), R = b + ":" + w, L;
|
|
1131
|
+
if (D.hasOwnProperty(R))
|
|
1132
|
+
L = D[R];
|
|
1133
|
+
else {
|
|
1134
|
+
var M = n(d.props, w, d._instanceProps), F = I === "rtl";
|
|
1135
|
+
D[R] = L = {
|
|
1136
|
+
position: "absolute",
|
|
1137
|
+
left: F ? void 0 : M,
|
|
1138
|
+
right: F ? M : void 0,
|
|
1139
|
+
top: f(d.props, b, d._instanceProps),
|
|
1140
|
+
height: m(d.props, b, d._instanceProps),
|
|
1141
|
+
width: s(d.props, w, d._instanceProps)
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
return L;
|
|
1145
|
+
}, d._getItemStyleCache = void 0, d._getItemStyleCache = Qe(function(b, w, T) {
|
|
1146
|
+
return {};
|
|
1147
|
+
}), d._onScroll = function(b) {
|
|
1148
|
+
var w = b.currentTarget, T = w.clientHeight, E = w.clientWidth, I = w.scrollLeft, y = w.scrollTop, D = w.scrollHeight, R = w.scrollWidth;
|
|
1149
|
+
d.setState(function(L) {
|
|
1150
|
+
if (L.scrollLeft === I && L.scrollTop === y)
|
|
1151
|
+
return null;
|
|
1152
|
+
var M = d.props.direction, F = I;
|
|
1153
|
+
if (M === "rtl")
|
|
1154
|
+
switch (zt()) {
|
|
1155
|
+
case "negative":
|
|
1156
|
+
F = -I;
|
|
1157
|
+
break;
|
|
1158
|
+
case "positive-descending":
|
|
1159
|
+
F = R - E - I;
|
|
1160
|
+
break;
|
|
1161
|
+
}
|
|
1162
|
+
F = Math.max(0, Math.min(F, R - E));
|
|
1163
|
+
var $ = Math.max(0, Math.min(y, D - T));
|
|
1164
|
+
return {
|
|
1165
|
+
isScrolling: !0,
|
|
1166
|
+
horizontalScrollDirection: L.scrollLeft < I ? "forward" : "backward",
|
|
1167
|
+
scrollLeft: F,
|
|
1168
|
+
scrollTop: $,
|
|
1169
|
+
verticalScrollDirection: L.scrollTop < y ? "forward" : "backward",
|
|
1170
|
+
scrollUpdateWasRequested: !1
|
|
1171
|
+
};
|
|
1172
|
+
}, d._resetIsScrollingDebounced);
|
|
1173
|
+
}, d._outerRefSetter = function(b) {
|
|
1174
|
+
var w = d.props.outerRef;
|
|
1175
|
+
d._outerRef = b, typeof w == "function" ? w(b) : w != null && typeof w == "object" && w.hasOwnProperty("current") && (w.current = b);
|
|
1176
|
+
}, d._resetIsScrollingDebounced = function() {
|
|
1177
|
+
d._resetIsScrollingTimeoutId !== null && At(d._resetIsScrollingTimeoutId), d._resetIsScrollingTimeoutId = co(d._resetIsScrolling, uo);
|
|
1178
|
+
}, d._resetIsScrolling = function() {
|
|
1179
|
+
d._resetIsScrollingTimeoutId = null, d.setState({
|
|
1180
|
+
isScrolling: !1
|
|
1181
|
+
}, function() {
|
|
1182
|
+
d._getItemStyleCache(-1);
|
|
1183
|
+
});
|
|
1184
|
+
}, d;
|
|
1185
|
+
}
|
|
1186
|
+
S.getDerivedStateFromProps = function(d, b) {
|
|
1187
|
+
return mo(d, b), v(d), null;
|
|
1188
|
+
};
|
|
1189
|
+
var P = S.prototype;
|
|
1190
|
+
return P.scrollTo = function(d) {
|
|
1191
|
+
var b = d.scrollLeft, w = d.scrollTop;
|
|
1192
|
+
b !== void 0 && (b = Math.max(0, b)), w !== void 0 && (w = Math.max(0, w)), this.setState(function(T) {
|
|
1193
|
+
return b === void 0 && (b = T.scrollLeft), w === void 0 && (w = T.scrollTop), T.scrollLeft === b && T.scrollTop === w ? null : {
|
|
1194
|
+
horizontalScrollDirection: T.scrollLeft < b ? "forward" : "backward",
|
|
1195
|
+
scrollLeft: b,
|
|
1196
|
+
scrollTop: w,
|
|
1197
|
+
scrollUpdateWasRequested: !0,
|
|
1198
|
+
verticalScrollDirection: T.scrollTop < w ? "forward" : "backward"
|
|
1199
|
+
};
|
|
1200
|
+
}, this._resetIsScrollingDebounced);
|
|
1201
|
+
}, P.scrollToItem = function(d) {
|
|
1202
|
+
var b = d.align, w = b === void 0 ? "auto" : b, T = d.columnIndex, E = d.rowIndex, I = this.props, y = I.columnCount, D = I.height, R = I.rowCount, L = I.width, M = this.state, F = M.scrollLeft, $ = M.scrollTop, q = lo();
|
|
1203
|
+
T !== void 0 && (T = Math.max(0, Math.min(T, y - 1))), E !== void 0 && (E = Math.max(0, Math.min(E, R - 1)));
|
|
1204
|
+
var K = c(this.props, this._instanceProps), U = i(this.props, this._instanceProps), Z = U > L ? q : 0, se = K > D ? q : 0;
|
|
1205
|
+
this.scrollTo({
|
|
1206
|
+
scrollLeft: T !== void 0 ? l(this.props, T, w, F, this._instanceProps, se) : F,
|
|
1207
|
+
scrollTop: E !== void 0 ? p(this.props, E, w, $, this._instanceProps, Z) : $
|
|
1208
|
+
});
|
|
1209
|
+
}, P.componentDidMount = function() {
|
|
1210
|
+
var d = this.props, b = d.initialScrollLeft, w = d.initialScrollTop;
|
|
1211
|
+
if (this._outerRef != null) {
|
|
1212
|
+
var T = this._outerRef;
|
|
1213
|
+
typeof b == "number" && (T.scrollLeft = b), typeof w == "number" && (T.scrollTop = w);
|
|
1214
|
+
}
|
|
1215
|
+
this._callPropsCallbacks();
|
|
1216
|
+
}, P.componentDidUpdate = function() {
|
|
1217
|
+
var d = this.props.direction, b = this.state, w = b.scrollLeft, T = b.scrollTop, E = b.scrollUpdateWasRequested;
|
|
1218
|
+
if (E && this._outerRef != null) {
|
|
1219
|
+
var I = this._outerRef;
|
|
1220
|
+
if (d === "rtl")
|
|
1221
|
+
switch (zt()) {
|
|
1222
|
+
case "negative":
|
|
1223
|
+
I.scrollLeft = -w;
|
|
1224
|
+
break;
|
|
1225
|
+
case "positive-ascending":
|
|
1226
|
+
I.scrollLeft = w;
|
|
1227
|
+
break;
|
|
1228
|
+
default:
|
|
1229
|
+
var y = I.clientWidth, D = I.scrollWidth;
|
|
1230
|
+
I.scrollLeft = D - y - w;
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1233
|
+
else
|
|
1234
|
+
I.scrollLeft = Math.max(0, w);
|
|
1235
|
+
I.scrollTop = Math.max(0, T);
|
|
1236
|
+
}
|
|
1237
|
+
this._callPropsCallbacks();
|
|
1238
|
+
}, P.componentWillUnmount = function() {
|
|
1239
|
+
this._resetIsScrollingTimeoutId !== null && At(this._resetIsScrollingTimeoutId);
|
|
1240
|
+
}, P.render = function() {
|
|
1241
|
+
var d = this.props, b = d.children, w = d.className, T = d.columnCount, E = d.direction, I = d.height, y = d.innerRef, D = d.innerElementType, R = d.innerTagName, L = d.itemData, M = d.itemKey, F = M === void 0 ? po : M, $ = d.outerElementType, q = d.outerTagName, K = d.rowCount, U = d.style, Z = d.useIsScrolling, se = d.width, pe = this.state.isScrolling, j = this._getHorizontalRangeToRender(), Q = j[0], he = j[1], we = this._getVerticalRangeToRender(), k = we[0], G = we[1], B = [];
|
|
1242
|
+
if (T > 0 && K)
|
|
1243
|
+
for (var ee = k; ee <= G; ee++)
|
|
1244
|
+
for (var me = Q; me <= he; me++)
|
|
1245
|
+
B.push(Ee(b, {
|
|
1246
|
+
columnIndex: me,
|
|
1247
|
+
data: L,
|
|
1248
|
+
isScrolling: Z ? pe : void 0,
|
|
1249
|
+
key: F({
|
|
1250
|
+
columnIndex: me,
|
|
1251
|
+
data: L,
|
|
1252
|
+
rowIndex: ee
|
|
1253
|
+
}),
|
|
1254
|
+
rowIndex: ee,
|
|
1255
|
+
style: this._getItemStyle(ee, me)
|
|
1256
|
+
}));
|
|
1257
|
+
var je = c(this.props, this._instanceProps), Be = i(this.props, this._instanceProps);
|
|
1258
|
+
return Ee($ || q || "div", {
|
|
1259
|
+
className: w,
|
|
1260
|
+
onScroll: this._onScroll,
|
|
1261
|
+
ref: this._outerRefSetter,
|
|
1262
|
+
style: ut({
|
|
1263
|
+
position: "relative",
|
|
1264
|
+
height: I,
|
|
1265
|
+
width: se,
|
|
1266
|
+
overflow: "auto",
|
|
1267
|
+
WebkitOverflowScrolling: "touch",
|
|
1268
|
+
willChange: "transform",
|
|
1269
|
+
direction: E
|
|
1270
|
+
}, U)
|
|
1271
|
+
}, Ee(D || R || "div", {
|
|
1272
|
+
children: B,
|
|
1273
|
+
ref: y,
|
|
1274
|
+
style: {
|
|
1275
|
+
height: je,
|
|
1276
|
+
pointerEvents: pe ? "none" : void 0,
|
|
1277
|
+
width: Be
|
|
1278
|
+
}
|
|
1279
|
+
}));
|
|
1280
|
+
}, P._callPropsCallbacks = function() {
|
|
1281
|
+
var d = this.props, b = d.columnCount, w = d.onItemsRendered, T = d.onScroll, E = d.rowCount;
|
|
1282
|
+
if (typeof w == "function" && b > 0 && E > 0) {
|
|
1283
|
+
var I = this._getHorizontalRangeToRender(), y = I[0], D = I[1], R = I[2], L = I[3], M = this._getVerticalRangeToRender(), F = M[0], $ = M[1], q = M[2], K = M[3];
|
|
1284
|
+
this._callOnItemsRendered(y, D, F, $, R, L, q, K);
|
|
1285
|
+
}
|
|
1286
|
+
if (typeof T == "function") {
|
|
1287
|
+
var U = this.state, Z = U.horizontalScrollDirection, se = U.scrollLeft, pe = U.scrollTop, j = U.scrollUpdateWasRequested, Q = U.verticalScrollDirection;
|
|
1288
|
+
this._callOnScroll(se, pe, Z, Q, j);
|
|
1289
|
+
}
|
|
1290
|
+
}, P._getHorizontalRangeToRender = function() {
|
|
1291
|
+
var d = this.props, b = d.columnCount, w = d.overscanColumnCount, T = d.overscanColumnsCount, E = d.overscanCount, I = d.rowCount, y = this.state, D = y.horizontalScrollDirection, R = y.isScrolling, L = y.scrollLeft, M = w || T || E || 1;
|
|
1292
|
+
if (b === 0 || I === 0)
|
|
1293
|
+
return [0, 0, 0, 0];
|
|
1294
|
+
var F = r(this.props, L, this._instanceProps), $ = o(this.props, F, L, this._instanceProps), q = !R || D === "backward" ? Math.max(1, M) : 1, K = !R || D === "forward" ? Math.max(1, M) : 1;
|
|
1295
|
+
return [Math.max(0, F - q), Math.max(0, Math.min(b - 1, $ + K)), F, $];
|
|
1296
|
+
}, P._getVerticalRangeToRender = function() {
|
|
1297
|
+
var d = this.props, b = d.columnCount, w = d.overscanCount, T = d.overscanRowCount, E = d.overscanRowsCount, I = d.rowCount, y = this.state, D = y.isScrolling, R = y.verticalScrollDirection, L = y.scrollTop, M = T || E || w || 1;
|
|
1298
|
+
if (b === 0 || I === 0)
|
|
1299
|
+
return [0, 0, 0, 0];
|
|
1300
|
+
var F = u(this.props, L, this._instanceProps), $ = h(this.props, F, L, this._instanceProps), q = !D || R === "backward" ? Math.max(1, M) : 1, K = !D || R === "forward" ? Math.max(1, M) : 1;
|
|
1301
|
+
return [Math.max(0, F - q), Math.max(0, Math.min(I - 1, $ + K)), F, $];
|
|
1302
|
+
}, S;
|
|
1303
|
+
}(Hn), t.defaultProps = {
|
|
1304
|
+
direction: "ltr",
|
|
1305
|
+
itemData: void 0,
|
|
1306
|
+
useIsScrolling: !1
|
|
1307
|
+
}, t;
|
|
1308
|
+
}
|
|
1309
|
+
var mo = function(t, n) {
|
|
1310
|
+
var r = t.children, o = t.direction, s = t.height, c = t.innerTagName, i = t.outerTagName, l = t.overscanColumnsCount, p = t.overscanCount, m = t.overscanRowsCount, f = t.width, u = n.instance;
|
|
1311
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1312
|
+
if (typeof p == "number" && Oe && !Oe.has(u) && (Oe.add(u), console.warn("The overscanCount prop has been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (typeof l == "number" || typeof m == "number") && De && !De.has(u) && (De.add(u), console.warn("The overscanColumnsCount and overscanRowsCount props have been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (c != null || i != null) && Ae && !Ae.has(u) && (Ae.add(u), console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead.")), r == null)
|
|
1313
|
+
throw Error('An invalid "children" prop has been specified. Value should be a React component. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
|
|
1314
|
+
switch (o) {
|
|
1315
|
+
case "ltr":
|
|
1316
|
+
case "rtl":
|
|
1317
|
+
break;
|
|
1318
|
+
default:
|
|
1319
|
+
throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". ' + ('"' + o + '" was specified.'));
|
|
1320
|
+
}
|
|
1321
|
+
if (typeof f != "number")
|
|
1322
|
+
throw Error('An invalid "width" prop has been specified. Grids must specify a number for width. ' + ('"' + (f === null ? "null" : typeof f) + '" was specified.'));
|
|
1323
|
+
if (typeof s != "number")
|
|
1324
|
+
throw Error('An invalid "height" prop has been specified. Grids must specify a number for height. ' + ('"' + (s === null ? "null" : typeof s) + '" was specified.'));
|
|
1325
|
+
}
|
|
1326
|
+
}, Ft = 50, hn = function(t, n) {
|
|
1327
|
+
var r = t.rowCount, o = n.rowMetadataMap, s = n.estimatedRowHeight, c = n.lastMeasuredRowIndex, i = 0;
|
|
1328
|
+
if (c >= r && (c = r - 1), c >= 0) {
|
|
1329
|
+
var l = o[c];
|
|
1330
|
+
i = l.offset + l.size;
|
|
1331
|
+
}
|
|
1332
|
+
var p = r - c - 1, m = p * s;
|
|
1333
|
+
return i + m;
|
|
1334
|
+
}, mn = function(t, n) {
|
|
1335
|
+
var r = t.columnCount, o = n.columnMetadataMap, s = n.estimatedColumnWidth, c = n.lastMeasuredColumnIndex, i = 0;
|
|
1336
|
+
if (c >= r && (c = r - 1), c >= 0) {
|
|
1337
|
+
var l = o[c];
|
|
1338
|
+
i = l.offset + l.size;
|
|
1339
|
+
}
|
|
1340
|
+
var p = r - c - 1, m = p * s;
|
|
1341
|
+
return i + m;
|
|
1342
|
+
}, ue = function(t, n, r, o) {
|
|
1343
|
+
var s, c, i;
|
|
1344
|
+
if (t === "column" ? (s = o.columnMetadataMap, c = n.columnWidth, i = o.lastMeasuredColumnIndex) : (s = o.rowMetadataMap, c = n.rowHeight, i = o.lastMeasuredRowIndex), r > i) {
|
|
1345
|
+
var l = 0;
|
|
1346
|
+
if (i >= 0) {
|
|
1347
|
+
var p = s[i];
|
|
1348
|
+
l = p.offset + p.size;
|
|
1349
|
+
}
|
|
1350
|
+
for (var m = i + 1; m <= r; m++) {
|
|
1351
|
+
var f = c(m);
|
|
1352
|
+
s[m] = {
|
|
1353
|
+
offset: l,
|
|
1354
|
+
size: f
|
|
1355
|
+
}, l += f;
|
|
1356
|
+
}
|
|
1357
|
+
t === "column" ? o.lastMeasuredColumnIndex = r : o.lastMeasuredRowIndex = r;
|
|
1358
|
+
}
|
|
1359
|
+
return s[r];
|
|
1360
|
+
}, kt = function(t, n, r, o) {
|
|
1361
|
+
var s, c;
|
|
1362
|
+
t === "column" ? (s = r.columnMetadataMap, c = r.lastMeasuredColumnIndex) : (s = r.rowMetadataMap, c = r.lastMeasuredRowIndex);
|
|
1363
|
+
var i = c > 0 ? s[c].offset : 0;
|
|
1364
|
+
return i >= o ? fn(t, n, r, c, 0, o) : fo(t, n, r, Math.max(0, c), o);
|
|
1365
|
+
}, fn = function(t, n, r, o, s, c) {
|
|
1366
|
+
for (; s <= o; ) {
|
|
1367
|
+
var i = s + Math.floor((o - s) / 2), l = ue(t, n, i, r).offset;
|
|
1368
|
+
if (l === c)
|
|
1369
|
+
return i;
|
|
1370
|
+
l < c ? s = i + 1 : l > c && (o = i - 1);
|
|
1371
|
+
}
|
|
1372
|
+
return s > 0 ? s - 1 : 0;
|
|
1373
|
+
}, fo = function(t, n, r, o, s) {
|
|
1374
|
+
for (var c = t === "column" ? n.columnCount : n.rowCount, i = 1; o < c && ue(t, n, o, r).offset < s; )
|
|
1375
|
+
o += i, i *= 2;
|
|
1376
|
+
return fn(t, n, r, Math.min(o, c - 1), Math.floor(o / 2), s);
|
|
1377
|
+
}, Wt = function(t, n, r, o, s, c, i) {
|
|
1378
|
+
var l = t === "column" ? n.width : n.height, p = ue(t, n, r, c), m = t === "column" ? mn(n, c) : hn(n, c), f = Math.max(0, Math.min(m - l, p.offset)), u = Math.max(0, p.offset - l + i + p.size);
|
|
1379
|
+
switch (o === "smart" && (s >= u - l && s <= f + l ? o = "auto" : o = "center"), o) {
|
|
1380
|
+
case "start":
|
|
1381
|
+
return f;
|
|
1382
|
+
case "end":
|
|
1383
|
+
return u;
|
|
1384
|
+
case "center":
|
|
1385
|
+
return Math.round(u + (f - u) / 2);
|
|
1386
|
+
case "auto":
|
|
1387
|
+
default:
|
|
1388
|
+
return s >= u && s <= f ? s : u > f || s < u ? u : f;
|
|
1389
|
+
}
|
|
1390
|
+
}, go = /* @__PURE__ */ ho({
|
|
1391
|
+
getColumnOffset: function(t, n, r) {
|
|
1392
|
+
return ue("column", t, n, r).offset;
|
|
1393
|
+
},
|
|
1394
|
+
getColumnStartIndexForOffset: function(t, n, r) {
|
|
1395
|
+
return kt("column", t, r, n);
|
|
1396
|
+
},
|
|
1397
|
+
getColumnStopIndexForStartIndex: function(t, n, r, o) {
|
|
1398
|
+
for (var s = t.columnCount, c = t.width, i = ue("column", t, n, o), l = r + c, p = i.offset + i.size, m = n; m < s - 1 && p < l; )
|
|
1399
|
+
m++, p += ue("column", t, m, o).size;
|
|
1400
|
+
return m;
|
|
1401
|
+
},
|
|
1402
|
+
getColumnWidth: function(t, n, r) {
|
|
1403
|
+
return r.columnMetadataMap[n].size;
|
|
1404
|
+
},
|
|
1405
|
+
getEstimatedTotalHeight: hn,
|
|
1406
|
+
getEstimatedTotalWidth: mn,
|
|
1407
|
+
getOffsetForColumnAndAlignment: function(t, n, r, o, s, c) {
|
|
1408
|
+
return Wt("column", t, n, r, o, s, c);
|
|
1409
|
+
},
|
|
1410
|
+
getOffsetForRowAndAlignment: function(t, n, r, o, s, c) {
|
|
1411
|
+
return Wt("row", t, n, r, o, s, c);
|
|
1412
|
+
},
|
|
1413
|
+
getRowOffset: function(t, n, r) {
|
|
1414
|
+
return ue("row", t, n, r).offset;
|
|
1415
|
+
},
|
|
1416
|
+
getRowHeight: function(t, n, r) {
|
|
1417
|
+
return r.rowMetadataMap[n].size;
|
|
1418
|
+
},
|
|
1419
|
+
getRowStartIndexForOffset: function(t, n, r) {
|
|
1420
|
+
return kt("row", t, r, n);
|
|
1421
|
+
},
|
|
1422
|
+
getRowStopIndexForStartIndex: function(t, n, r, o) {
|
|
1423
|
+
for (var s = t.rowCount, c = t.height, i = ue("row", t, n, o), l = r + c, p = i.offset + i.size, m = n; m < s - 1 && p < l; )
|
|
1424
|
+
m++, p += ue("row", t, m, o).size;
|
|
1425
|
+
return m;
|
|
1426
|
+
},
|
|
1427
|
+
initInstanceProps: function(t, n) {
|
|
1428
|
+
var r = t, o = r.estimatedColumnWidth, s = r.estimatedRowHeight, c = {
|
|
1429
|
+
columnMetadataMap: {},
|
|
1430
|
+
estimatedColumnWidth: o || Ft,
|
|
1431
|
+
estimatedRowHeight: s || Ft,
|
|
1432
|
+
lastMeasuredColumnIndex: -1,
|
|
1433
|
+
lastMeasuredRowIndex: -1,
|
|
1434
|
+
rowMetadataMap: {}
|
|
1435
|
+
};
|
|
1436
|
+
return n.resetAfterColumnIndex = function(i, l) {
|
|
1437
|
+
l === void 0 && (l = !0), n.resetAfterIndices({
|
|
1438
|
+
columnIndex: i,
|
|
1439
|
+
shouldForceUpdate: l
|
|
1440
|
+
});
|
|
1441
|
+
}, n.resetAfterRowIndex = function(i, l) {
|
|
1442
|
+
l === void 0 && (l = !0), n.resetAfterIndices({
|
|
1443
|
+
rowIndex: i,
|
|
1444
|
+
shouldForceUpdate: l
|
|
1445
|
+
});
|
|
1446
|
+
}, n.resetAfterIndices = function(i) {
|
|
1447
|
+
var l = i.columnIndex, p = i.rowIndex, m = i.shouldForceUpdate, f = m === void 0 ? !0 : m;
|
|
1448
|
+
typeof l == "number" && (c.lastMeasuredColumnIndex = Math.min(c.lastMeasuredColumnIndex, l - 1)), typeof p == "number" && (c.lastMeasuredRowIndex = Math.min(c.lastMeasuredRowIndex, p - 1)), n._getItemStyleCache(-1), f && n.forceUpdate();
|
|
1449
|
+
}, c;
|
|
1450
|
+
},
|
|
1451
|
+
shouldResetStyleCacheOnItemSizeChange: !1,
|
|
1452
|
+
validateProps: function(t) {
|
|
1453
|
+
var n = t.columnWidth, r = t.rowHeight;
|
|
1454
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1455
|
+
if (typeof n != "function")
|
|
1456
|
+
throw Error('An invalid "columnWidth" prop has been specified. Value should be a function. ' + ('"' + (n === null ? "null" : typeof n) + '" was specified.'));
|
|
1457
|
+
if (typeof r != "function")
|
|
1458
|
+
throw Error('An invalid "rowHeight" prop has been specified. Value should be a function. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1462
|
+
process.env.NODE_ENV;
|
|
1463
|
+
function Ht(e, t) {
|
|
1464
|
+
for (var n in e)
|
|
1465
|
+
if (!(n in t))
|
|
1466
|
+
return !0;
|
|
1467
|
+
for (var r in t)
|
|
1468
|
+
if (e[r] !== t[r])
|
|
1469
|
+
return !0;
|
|
1470
|
+
return !1;
|
|
1471
|
+
}
|
|
1472
|
+
var vo = ["style"], _o = ["style"];
|
|
1473
|
+
function wo(e, t) {
|
|
1474
|
+
var n = e.style, r = Ot(e, vo), o = t.style, s = Ot(t, _o);
|
|
1475
|
+
return !Ht(n, o) && !Ht(r, s);
|
|
1476
|
+
}
|
|
1477
|
+
const bo = () => {
|
|
1478
|
+
const { viewMode: e } = qe(), { scrollMode: t } = Se(), { setColumnCount: n } = Bt(), { virtualScrollableElementRef: r } = Ze(), o = mt(), s = x(
|
|
1479
|
+
(h) => o.widths[h] || 0,
|
|
1480
|
+
[o]
|
|
1481
|
+
), c = x(
|
|
1482
|
+
(h) => o.heights[h] || 0,
|
|
1483
|
+
[o]
|
|
1484
|
+
), i = A(() => o.heights.length, [o]), l = A(() => Math.max(...o.widths), [o]), p = A(() => t === J.HORIZONTAL_SCROLLING ? i : e === Fe.DUAL_PAGE ? 2 : 1, [e, t, t, i, r, l]);
|
|
1485
|
+
z(() => {
|
|
1486
|
+
n(p);
|
|
1487
|
+
}, [p, n]);
|
|
1488
|
+
const m = A(() => t === J.HORIZONTAL_SCROLLING || t === J.PAGE_SCROLLING ? 1 : Math.round(i / p), [p, i, t]), f = A(() => o.heights.reduce((h, g) => h + g, 0) / o.heights.length || 0, [o]), u = A(() => o.widths.reduce((h, g) => h + g, 0) / o.heights.length || 0, [o]);
|
|
1489
|
+
return {
|
|
1490
|
+
rowCount: m,
|
|
1491
|
+
rowHeight: c,
|
|
1492
|
+
columnCount: p,
|
|
1493
|
+
columnWidth: s,
|
|
1494
|
+
pageDimension: o,
|
|
1495
|
+
estimatedRowHeight: f,
|
|
1496
|
+
estimatedColumnWidth: u
|
|
1497
|
+
};
|
|
1498
|
+
};
|
|
1499
|
+
let re;
|
|
1500
|
+
typeof window < "u" ? re = window : typeof self < "u" ? re = self : re = global;
|
|
1501
|
+
let pt = null, ht = null;
|
|
1502
|
+
const $t = 20, tt = re.clearTimeout, Gt = re.setTimeout, nt = re.cancelAnimationFrame || re.mozCancelAnimationFrame || re.webkitCancelAnimationFrame, Vt = re.requestAnimationFrame || re.mozRequestAnimationFrame || re.webkitRequestAnimationFrame;
|
|
1503
|
+
nt == null || Vt == null ? (pt = tt, ht = function(t) {
|
|
1504
|
+
return Gt(t, $t);
|
|
1505
|
+
}) : (pt = function([t, n]) {
|
|
1506
|
+
nt(t), tt(n);
|
|
1507
|
+
}, ht = function(t) {
|
|
1508
|
+
const n = Vt(function() {
|
|
1509
|
+
tt(r), t();
|
|
1510
|
+
}), r = Gt(function() {
|
|
1511
|
+
nt(n), t();
|
|
1512
|
+
}, $t);
|
|
1513
|
+
return [n, r];
|
|
1514
|
+
});
|
|
1515
|
+
function Co(e) {
|
|
1516
|
+
let t, n, r, o, s, c, i;
|
|
1517
|
+
const l = typeof document < "u" && document.attachEvent;
|
|
1518
|
+
if (!l) {
|
|
1519
|
+
c = function(C) {
|
|
1520
|
+
const S = C.__resizeTriggers__, P = S.firstElementChild, N = S.lastElementChild, d = P.firstElementChild;
|
|
1521
|
+
N.scrollLeft = N.scrollWidth, N.scrollTop = N.scrollHeight, d.style.width = P.offsetWidth + 1 + "px", d.style.height = P.offsetHeight + 1 + "px", P.scrollLeft = P.scrollWidth, P.scrollTop = P.scrollHeight;
|
|
1522
|
+
}, s = function(C) {
|
|
1523
|
+
return C.offsetWidth !== C.__resizeLast__.width || C.offsetHeight !== C.__resizeLast__.height;
|
|
1524
|
+
}, i = function(C) {
|
|
1525
|
+
if (C.target.className && typeof C.target.className.indexOf == "function" && C.target.className.indexOf("contract-trigger") < 0 && C.target.className.indexOf("expand-trigger") < 0)
|
|
1526
|
+
return;
|
|
1527
|
+
const S = this;
|
|
1528
|
+
c(this), this.__resizeRAF__ && pt(this.__resizeRAF__), this.__resizeRAF__ = ht(function() {
|
|
1529
|
+
s(S) && (S.__resizeLast__.width = S.offsetWidth, S.__resizeLast__.height = S.offsetHeight, S.__resizeListeners__.forEach(function(d) {
|
|
1530
|
+
d.call(S, C);
|
|
1531
|
+
}));
|
|
1532
|
+
});
|
|
1533
|
+
};
|
|
1534
|
+
let u = !1, h = "";
|
|
1535
|
+
r = "animationstart";
|
|
1536
|
+
const g = "Webkit Moz O ms".split(" ");
|
|
1537
|
+
let _ = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), v = "";
|
|
1538
|
+
{
|
|
1539
|
+
const C = document.createElement("fakeelement");
|
|
1540
|
+
if (C.style.animationName !== void 0 && (u = !0), u === !1) {
|
|
1541
|
+
for (let S = 0; S < g.length; S++)
|
|
1542
|
+
if (C.style[g[S] + "AnimationName"] !== void 0) {
|
|
1543
|
+
v = g[S], h = "-" + v.toLowerCase() + "-", r = _[S], u = !0;
|
|
1544
|
+
break;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
n = "resizeanim", t = "@" + h + "keyframes " + n + " { from { opacity: 0; } to { opacity: 0; } } ", o = h + "animation: 1ms " + n + "; ";
|
|
1549
|
+
}
|
|
1550
|
+
const p = function(u) {
|
|
1551
|
+
if (!u.getElementById("detectElementResize")) {
|
|
1552
|
+
const h = (t || "") + ".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%; }', g = u.head || u.getElementsByTagName("head")[0], _ = u.createElement("style");
|
|
1553
|
+
_.id = "detectElementResize", _.type = "text/css", e != null && _.setAttribute("nonce", e), _.styleSheet ? _.styleSheet.cssText = h : _.appendChild(u.createTextNode(h)), g.appendChild(_);
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
return {
|
|
1557
|
+
addResizeListener: function(u, h) {
|
|
1558
|
+
if (l)
|
|
1559
|
+
u.attachEvent("onresize", h);
|
|
1560
|
+
else {
|
|
1561
|
+
if (!u.__resizeTriggers__) {
|
|
1562
|
+
const g = u.ownerDocument, _ = re.getComputedStyle(u);
|
|
1563
|
+
_ && _.position === "static" && (u.style.position = "relative"), p(g), u.__resizeLast__ = {}, u.__resizeListeners__ = [], (u.__resizeTriggers__ = g.createElement("div")).className = "resize-triggers";
|
|
1564
|
+
const v = g.createElement("div");
|
|
1565
|
+
v.className = "expand-trigger", v.appendChild(g.createElement("div"));
|
|
1566
|
+
const C = g.createElement("div");
|
|
1567
|
+
C.className = "contract-trigger", u.__resizeTriggers__.appendChild(v), u.__resizeTriggers__.appendChild(C), u.appendChild(u.__resizeTriggers__), c(u), u.addEventListener("scroll", i, !0), r && (u.__resizeTriggers__.__animationListener__ = function(P) {
|
|
1568
|
+
P.animationName === n && c(u);
|
|
1569
|
+
}, u.__resizeTriggers__.addEventListener(r, u.__resizeTriggers__.__animationListener__));
|
|
1570
|
+
}
|
|
1571
|
+
u.__resizeListeners__.push(h);
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1574
|
+
removeResizeListener: function(u, h) {
|
|
1575
|
+
if (l)
|
|
1576
|
+
u.detachEvent("onresize", h);
|
|
1577
|
+
else if (u.__resizeListeners__.splice(u.__resizeListeners__.indexOf(h), 1), !u.__resizeListeners__.length) {
|
|
1578
|
+
u.removeEventListener("scroll", i, !0), u.__resizeTriggers__.__animationListener__ && (u.__resizeTriggers__.removeEventListener(r, u.__resizeTriggers__.__animationListener__), u.__resizeTriggers__.__animationListener__ = null);
|
|
1579
|
+
try {
|
|
1580
|
+
u.__resizeTriggers__ = !u.removeChild(u.__resizeTriggers__);
|
|
1581
|
+
} catch {
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
class Po extends $n {
|
|
1588
|
+
constructor(...t) {
|
|
1589
|
+
super(...t), this.state = {
|
|
1590
|
+
height: this.props.defaultHeight || 0,
|
|
1591
|
+
scaledHeight: this.props.defaultHeight || 0,
|
|
1592
|
+
scaledWidth: this.props.defaultWidth || 0,
|
|
1593
|
+
width: this.props.defaultWidth || 0
|
|
1594
|
+
}, this._autoSizer = null, this._detectElementResize = null, this._parentNode = null, this._resizeObserver = null, this._timeoutId = null, this._onResize = () => {
|
|
1595
|
+
this._timeoutId = null;
|
|
1596
|
+
const {
|
|
1597
|
+
disableHeight: n,
|
|
1598
|
+
disableWidth: r,
|
|
1599
|
+
onResize: o
|
|
1600
|
+
} = this.props;
|
|
1601
|
+
if (this._parentNode) {
|
|
1602
|
+
const s = window.getComputedStyle(this._parentNode) || {}, c = parseFloat(s.paddingLeft || "0"), i = parseFloat(s.paddingRight || "0"), l = parseFloat(s.paddingTop || "0"), p = parseFloat(s.paddingBottom || "0"), m = this._parentNode.getBoundingClientRect(), f = m.height - l - p, u = m.width - c - i, h = this._parentNode.offsetHeight - l - p, g = this._parentNode.offsetWidth - c - i;
|
|
1603
|
+
(!n && (this.state.height !== h || this.state.scaledHeight !== f) || !r && (this.state.width !== g || this.state.scaledWidth !== u)) && (this.setState({
|
|
1604
|
+
height: h,
|
|
1605
|
+
width: g,
|
|
1606
|
+
scaledHeight: f,
|
|
1607
|
+
scaledWidth: u
|
|
1608
|
+
}), typeof o == "function" && o({
|
|
1609
|
+
height: h,
|
|
1610
|
+
scaledHeight: f,
|
|
1611
|
+
scaledWidth: u,
|
|
1612
|
+
width: g
|
|
1613
|
+
}));
|
|
1614
|
+
}
|
|
1615
|
+
}, this._setRef = (n) => {
|
|
1616
|
+
this._autoSizer = n;
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
componentDidMount() {
|
|
1620
|
+
const {
|
|
1621
|
+
nonce: t
|
|
1622
|
+
} = this.props, n = this._autoSizer ? this._autoSizer.parentNode : null;
|
|
1623
|
+
if (n != null && n.ownerDocument && n.ownerDocument.defaultView && n instanceof n.ownerDocument.defaultView.HTMLElement) {
|
|
1624
|
+
this._parentNode = n;
|
|
1625
|
+
const r = n.ownerDocument.defaultView.ResizeObserver;
|
|
1626
|
+
r != null ? (this._resizeObserver = new r(() => {
|
|
1627
|
+
this._timeoutId = setTimeout(this._onResize, 0);
|
|
1628
|
+
}), this._resizeObserver.observe(n)) : (this._detectElementResize = Co(t), this._detectElementResize.addResizeListener(n, this._onResize)), this._onResize();
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
componentWillUnmount() {
|
|
1632
|
+
this._parentNode && (this._detectElementResize && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize), this._timeoutId !== null && clearTimeout(this._timeoutId), this._resizeObserver && this._resizeObserver.disconnect());
|
|
1633
|
+
}
|
|
1634
|
+
render() {
|
|
1635
|
+
const {
|
|
1636
|
+
children: t,
|
|
1637
|
+
defaultHeight: n,
|
|
1638
|
+
defaultWidth: r,
|
|
1639
|
+
disableHeight: o = !1,
|
|
1640
|
+
disableWidth: s = !1,
|
|
1641
|
+
doNotBailOutOnEmptyChildren: c = !1,
|
|
1642
|
+
nonce: i,
|
|
1643
|
+
onResize: l,
|
|
1644
|
+
style: p = {},
|
|
1645
|
+
tagName: m = "div",
|
|
1646
|
+
...f
|
|
1647
|
+
} = this.props, {
|
|
1648
|
+
height: u,
|
|
1649
|
+
scaledHeight: h,
|
|
1650
|
+
scaledWidth: g,
|
|
1651
|
+
width: _
|
|
1652
|
+
} = this.state, v = {
|
|
1653
|
+
overflow: "visible"
|
|
1654
|
+
}, C = {};
|
|
1655
|
+
let S = !1;
|
|
1656
|
+
return o || (u === 0 && (S = !0), v.height = 0, C.height = u, C.scaledHeight = h), s || (_ === 0 && (S = !0), v.width = 0, C.width = _, C.scaledWidth = g), c && (S = !1), Ee(m, {
|
|
1657
|
+
ref: this._setRef,
|
|
1658
|
+
style: {
|
|
1659
|
+
...v,
|
|
1660
|
+
...p
|
|
1661
|
+
},
|
|
1662
|
+
...f
|
|
1663
|
+
}, !S && t(C));
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
const To = ({ widths: e, heights: t }) => {
|
|
1667
|
+
const { focusedPage: n, totalPages: r } = oe(), o = A(() => {
|
|
1668
|
+
const i = [], l = Math.ceil(n / 2) * 2 - 1;
|
|
1669
|
+
if (i.push(l), l + 1 < r) {
|
|
1670
|
+
const p = l + 1;
|
|
1671
|
+
i.push(p);
|
|
1672
|
+
}
|
|
1673
|
+
return i;
|
|
1674
|
+
}, [n, r]), s = A(() => [
|
|
1675
|
+
{
|
|
1676
|
+
position: "absolute",
|
|
1677
|
+
left: 0,
|
|
1678
|
+
width: e(n - 1),
|
|
1679
|
+
height: t(n - 1)
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
position: "absolute",
|
|
1683
|
+
left: e(n),
|
|
1684
|
+
top: 0,
|
|
1685
|
+
width: e(n),
|
|
1686
|
+
height: t(n)
|
|
1687
|
+
}
|
|
1688
|
+
], [e, t, o]), c = A(() => s.reduce((i, l) => i + Number(l.width || 0), 0), [s]);
|
|
1689
|
+
return /* @__PURE__ */ a("div", { style: { width: c, position: "relative" }, children: o.map((i, l) => /* @__PURE__ */ a(bt, { style: s[l], pageNumber: i }, i)) });
|
|
1690
|
+
}, So = ({ widths: e, heights: t }) => {
|
|
1691
|
+
const { focusedPage: n } = oe(), r = A(() => ({
|
|
1692
|
+
position: "absolute",
|
|
1693
|
+
width: e(n - 1),
|
|
1694
|
+
height: t(n - 1)
|
|
1695
|
+
}), [e, t, n]), o = A(() => e(n - 1), [e]);
|
|
1696
|
+
return /* @__PURE__ */ a(
|
|
1697
|
+
"div",
|
|
1698
|
+
{
|
|
1699
|
+
style: {
|
|
1700
|
+
width: o,
|
|
1701
|
+
position: "relative"
|
|
1702
|
+
},
|
|
1703
|
+
children: /* @__PURE__ */ a(bt, { style: r, pageNumber: n }, n)
|
|
1704
|
+
}
|
|
1705
|
+
);
|
|
1706
|
+
}, yo = Gn(({ columnIndex: e, rowIndex: t, data: n, style: r }) => {
|
|
1707
|
+
const o = A(() => e + 1 + t * n.columnCount, [e, t, n]);
|
|
1708
|
+
return /* @__PURE__ */ a(
|
|
1709
|
+
bt,
|
|
1710
|
+
{
|
|
1711
|
+
style: r,
|
|
1712
|
+
onIntersectRatioChange: n.handleIntersectRatioChange,
|
|
1713
|
+
pageNumber: o
|
|
1714
|
+
},
|
|
1715
|
+
o
|
|
1716
|
+
);
|
|
1717
|
+
}, wo), Bs = () => {
|
|
1718
|
+
const { getContainer: e, container: t } = dr(), { scrollToPage: n } = nn(), {
|
|
1719
|
+
virtualScrollRef: r,
|
|
1720
|
+
getVirtualScrollRef: o,
|
|
1721
|
+
getPageScrollElementRef: s,
|
|
1722
|
+
getVirtualScrollableElementRef: c,
|
|
1723
|
+
setTotalInnerDimensions: i,
|
|
1724
|
+
totalInnerDimensions: l
|
|
1725
|
+
} = Ze(), { nextPage: p, prevPage: m, setFocusedPage: f, focusedPage: u } = oe(), { scrollMode: h } = Se(), { viewMode: g } = qe(), _ = W(null), v = W(
|
|
1726
|
+
l
|
|
1727
|
+
), C = W({
|
|
1728
|
+
viewMode: g,
|
|
1729
|
+
scrollMode: h
|
|
1730
|
+
}), S = W(!1), P = W(), { isFullScreen: N } = jn(), {
|
|
1731
|
+
pageDimension: d,
|
|
1732
|
+
rowCount: b,
|
|
1733
|
+
rowHeight: w,
|
|
1734
|
+
columnCount: T,
|
|
1735
|
+
columnWidth: E,
|
|
1736
|
+
estimatedColumnWidth: I,
|
|
1737
|
+
estimatedRowHeight: y
|
|
1738
|
+
} = bo(), [D, R] = H({}), { isScrolling: L } = Kt(), M = W(), F = W({
|
|
1739
|
+
scrollTop: 0,
|
|
1740
|
+
scrollLeft: 0
|
|
1741
|
+
});
|
|
1742
|
+
mr(t);
|
|
1743
|
+
const { isPressed: $ } = pr(), { selectionMode: q } = qn(), { initializeGrabScroll: K, scrollBehavior: U } = hr({
|
|
1744
|
+
isPressed: $
|
|
1745
|
+
}), Z = A(() => q === Vn.HAND, [q]), se = x((k, G) => {
|
|
1746
|
+
R((B) => ({ ...B, [k]: Math.round(G * 100) }));
|
|
1747
|
+
}, []), pe = A(() => ({
|
|
1748
|
+
columnCount: T,
|
|
1749
|
+
handleIntersectRatioChange: se
|
|
1750
|
+
}), [T, se]), j = x(
|
|
1751
|
+
(k) => {
|
|
1752
|
+
const G = document.activeElement !== t;
|
|
1753
|
+
!N && G || (["ArrowUp", "ArrowLeft"].includes(k.key) ? (k.preventDefault(), m()) : ["ArrowDown", "ArrowRight"].includes(k.key) && (k.preventDefault(), p()));
|
|
1754
|
+
},
|
|
1755
|
+
[p, m, N, h]
|
|
1756
|
+
), Q = x((k) => {
|
|
1757
|
+
F.current = {
|
|
1758
|
+
scrollTop: k.scrollTop,
|
|
1759
|
+
scrollLeft: k.scrollLeft
|
|
1760
|
+
};
|
|
1761
|
+
}, []);
|
|
1762
|
+
z(() => (window.addEventListener("keydown", j), () => {
|
|
1763
|
+
window.removeEventListener("keydown", j);
|
|
1764
|
+
}), [j]), z(() => {
|
|
1765
|
+
if (_.current && (_.current.style.position = "relative"), !!r) {
|
|
1766
|
+
v.current = {
|
|
1767
|
+
height: l.height,
|
|
1768
|
+
width: l.width
|
|
1769
|
+
}, i({
|
|
1770
|
+
height: Array.from({ length: b }).reduce(
|
|
1771
|
+
(k, G, B) => k + w(B),
|
|
1772
|
+
0
|
|
1773
|
+
),
|
|
1774
|
+
width: Array.from({ length: T }).reduce(
|
|
1775
|
+
(k, G, B) => k + E(B),
|
|
1776
|
+
0
|
|
1777
|
+
)
|
|
1778
|
+
});
|
|
1779
|
+
for (let k = 0; k < b; k++)
|
|
1780
|
+
for (let G = 0; G < T; G++)
|
|
1781
|
+
r.resetAfterIndices({
|
|
1782
|
+
columnIndex: G,
|
|
1783
|
+
rowIndex: k,
|
|
1784
|
+
shouldForceUpdate: !0
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
}, [b, T, d, r, n]), z(() => {
|
|
1788
|
+
if (L.current)
|
|
1789
|
+
return;
|
|
1790
|
+
if (C.current.viewMode !== g || C.current.scrollMode !== h) {
|
|
1791
|
+
M.current && clearTimeout(M.current), R({}), S.current = !0, n(u), h === J.HORIZONTAL_SCROLLING && (r == null || r.scrollTo({
|
|
1792
|
+
scrollTop: 0
|
|
1793
|
+
})), M.current = setTimeout(() => {
|
|
1794
|
+
requestAnimationFrame(() => {
|
|
1795
|
+
C.current = { viewMode: g, scrollMode: h };
|
|
1796
|
+
});
|
|
1797
|
+
}, 100);
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
const G = F.current.scrollTop, B = F.current.scrollLeft;
|
|
1801
|
+
if (l.height && l.width) {
|
|
1802
|
+
S.current = !0;
|
|
1803
|
+
const { height: ee, width: me } = l, { height: je, width: Be } = v.current, zn = G / je * ee, Fn = B / Be * me, kn = Math.min(zn, ee) || 0, Wn = Math.min(Fn, me) || 0;
|
|
1804
|
+
r == null || r.scrollTo({
|
|
1805
|
+
scrollTop: kn,
|
|
1806
|
+
scrollLeft: Wn
|
|
1807
|
+
}), P.current && clearTimeout(P.current), P.current = setTimeout(() => {
|
|
1808
|
+
S.current = !1;
|
|
1809
|
+
}, 100);
|
|
1810
|
+
}
|
|
1811
|
+
}, [l, g, h]), z(() => {
|
|
1812
|
+
const k = Object.entries(D);
|
|
1813
|
+
if (L.current || S.current) {
|
|
1814
|
+
L.current = !1;
|
|
1815
|
+
return;
|
|
1816
|
+
}
|
|
1817
|
+
let G = 0, B = -1;
|
|
1818
|
+
k.forEach((ee) => {
|
|
1819
|
+
B < ee[1] && (G = Number(ee[0]), B = ee[1]);
|
|
1820
|
+
}), G && f(G);
|
|
1821
|
+
}, [D, f]), z(() => () => {
|
|
1822
|
+
M.current && clearTimeout(M.current), P.current && clearTimeout(P.current);
|
|
1823
|
+
}, []);
|
|
1824
|
+
const he = A(() => te(le["rp-pages-container"], {
|
|
1825
|
+
[le["rp-cursor-grab"]]: Z && !$,
|
|
1826
|
+
[le["rp-cursor-grabbing"]]: Z && $
|
|
1827
|
+
}), [Z, $]), we = x(
|
|
1828
|
+
(k) => {
|
|
1829
|
+
if (Z && k) {
|
|
1830
|
+
const G = te(le["rp-pages"]), B = document.querySelector(`.${G}`);
|
|
1831
|
+
K(B);
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1834
|
+
[Z, K, le]
|
|
1835
|
+
);
|
|
1836
|
+
return /* @__PURE__ */ a("div", { ref: e, tabIndex: -1, className: he, children: /* @__PURE__ */ a(Po, { children: ({ width: k, height: G }) => /* @__PURE__ */ a("div", { "data-rp": "pages", ref: we, style: { width: k, height: G, scrollBehavior: U }, children: h === J.PAGE_SCROLLING ? /* @__PURE__ */ a(
|
|
1837
|
+
"div",
|
|
1838
|
+
{
|
|
1839
|
+
ref: s,
|
|
1840
|
+
style: { width: k, height: G },
|
|
1841
|
+
className: te(le["rp-pages"], le["rp-page-scrolling-wrapper"]),
|
|
1842
|
+
children: g === Fe.DUAL_PAGE ? /* @__PURE__ */ a(To, { widths: E, heights: w }) : /* @__PURE__ */ a(So, { widths: E, heights: w })
|
|
1843
|
+
}
|
|
1844
|
+
) : I ? /* @__PURE__ */ a(
|
|
1845
|
+
go,
|
|
1846
|
+
{
|
|
1847
|
+
ref: o,
|
|
1848
|
+
itemData: pe,
|
|
1849
|
+
outerRef: c,
|
|
1850
|
+
innerRef: _,
|
|
1851
|
+
onScroll: Q,
|
|
1852
|
+
columnCount: T,
|
|
1853
|
+
columnWidth: E,
|
|
1854
|
+
rowHeight: w,
|
|
1855
|
+
height: G,
|
|
1856
|
+
width: k,
|
|
1857
|
+
estimatedColumnWidth: I,
|
|
1858
|
+
estimatedRowHeight: y,
|
|
1859
|
+
rowCount: b,
|
|
1860
|
+
className: te(
|
|
1861
|
+
le["rp-pages"],
|
|
1862
|
+
h === J.HORIZONTAL_SCROLLING ? le["rp-pages-horizontal-scroll"] : ""
|
|
1863
|
+
),
|
|
1864
|
+
style: { scrollBehavior: U },
|
|
1865
|
+
children: yo
|
|
1866
|
+
}
|
|
1867
|
+
) : /* @__PURE__ */ a(
|
|
1868
|
+
"div",
|
|
1869
|
+
{
|
|
1870
|
+
style: {
|
|
1871
|
+
display: "flex",
|
|
1872
|
+
justifyContent: "center",
|
|
1873
|
+
alignItems: "center",
|
|
1874
|
+
height: "100%",
|
|
1875
|
+
width: "100%"
|
|
1876
|
+
},
|
|
1877
|
+
children: /* @__PURE__ */ a(Le, {})
|
|
1878
|
+
}
|
|
1879
|
+
) }) }) });
|
|
1880
|
+
}, ye = {
|
|
1881
|
+
"rp-toolbar-content": "_rp-toolbar-content_2cv36_1",
|
|
1882
|
+
"rp-toolbar-wrapper": "_rp-toolbar-wrapper_2cv36_10",
|
|
1883
|
+
"rp-toolbar-start": "_rp-toolbar-start_2cv36_32",
|
|
1884
|
+
"rp-toolbar-middle": "_rp-toolbar-middle_2cv36_38",
|
|
1885
|
+
"rp-toolbar-end": "_rp-toolbar-end_2cv36_45"
|
|
1886
|
+
}, rt = {
|
|
1887
|
+
"rp-paginate": "_rp-paginate_1vu6o_1",
|
|
1888
|
+
"rp-page-input": "_rp-page-input_1vu6o_6",
|
|
1889
|
+
"rp-total-page": "_rp-total-page_1vu6o_12"
|
|
1890
|
+
}, Io = () => {
|
|
1891
|
+
const { prevIcon: e } = ce();
|
|
1892
|
+
return e || /* @__PURE__ */ a(Re, {});
|
|
1893
|
+
}, xo = () => {
|
|
1894
|
+
const { nextIcon: e } = ce();
|
|
1895
|
+
return e || /* @__PURE__ */ a(Re, { style: { transform: "rotate(180deg" } });
|
|
1896
|
+
}, Ro = () => {
|
|
1897
|
+
const { focusedPage: e, totalPages: t, setFocusedPage: n, nextPage: r, prevPage: o, goToPage: s } = oe(), [c, i] = H(e.toString()), { pageNavigationTool: l = !0 } = de(), { isSmallScreen: p } = _e();
|
|
1898
|
+
z(() => {
|
|
1899
|
+
i(e.toString());
|
|
1900
|
+
}, [e]);
|
|
1901
|
+
const m = x((g) => {
|
|
1902
|
+
const _ = g.target.value;
|
|
1903
|
+
i(_);
|
|
1904
|
+
}, []), f = x(() => {
|
|
1905
|
+
const g = s(c);
|
|
1906
|
+
g.success || i(g.currentPage.toString());
|
|
1907
|
+
}, [s, c, t]), u = x(() => {
|
|
1908
|
+
i(e.toString());
|
|
1909
|
+
}, [e]), h = x(
|
|
1910
|
+
(g) => {
|
|
1911
|
+
g.key === "Enter" && f();
|
|
1912
|
+
},
|
|
1913
|
+
[f]
|
|
1914
|
+
);
|
|
1915
|
+
return typeof l != "boolean" ? /* @__PURE__ */ a(
|
|
1916
|
+
l,
|
|
1917
|
+
{
|
|
1918
|
+
total: t,
|
|
1919
|
+
current: e,
|
|
1920
|
+
nextPage: r,
|
|
1921
|
+
prevPage: o,
|
|
1922
|
+
goToPage: s,
|
|
1923
|
+
changePage: n
|
|
1924
|
+
}
|
|
1925
|
+
) : l ? /* @__PURE__ */ O("div", { className: rt["rp-paginate"], children: [
|
|
1926
|
+
!p && /* @__PURE__ */ a(ne, { content: "Previous page", children: /* @__PURE__ */ a(X, { onClick: o, disabled: e === 1, children: /* @__PURE__ */ a(Io, {}) }) }),
|
|
1927
|
+
/* @__PURE__ */ a(
|
|
1928
|
+
jt,
|
|
1929
|
+
{
|
|
1930
|
+
onKeyDown: h,
|
|
1931
|
+
onBlur: u,
|
|
1932
|
+
onChange: m,
|
|
1933
|
+
value: c,
|
|
1934
|
+
className: rt["rp-page-input"]
|
|
1935
|
+
}
|
|
1936
|
+
),
|
|
1937
|
+
/* @__PURE__ */ O("span", { className: rt["rp-total-page"], children: [
|
|
1938
|
+
"/",
|
|
1939
|
+
t
|
|
1940
|
+
] }),
|
|
1941
|
+
!p && /* @__PURE__ */ a(ne, { content: "Next page", children: /* @__PURE__ */ a(X, { onClick: r, disabled: e === t, children: /* @__PURE__ */ a(xo, {}) }) })
|
|
1942
|
+
] }) : null;
|
|
1943
|
+
};
|
|
1944
|
+
var Ct = "Dialog", [gn, Ks] = wr(Ct), [No, ae] = gn(Ct), vn = (e) => {
|
|
1945
|
+
const {
|
|
1946
|
+
__scopeDialog: t,
|
|
1947
|
+
children: n,
|
|
1948
|
+
open: r,
|
|
1949
|
+
defaultOpen: o,
|
|
1950
|
+
onOpenChange: s,
|
|
1951
|
+
modal: c = !0
|
|
1952
|
+
} = e, i = V.useRef(null), l = V.useRef(null), [p = !1, m] = Pr({
|
|
1953
|
+
prop: r,
|
|
1954
|
+
defaultProp: o,
|
|
1955
|
+
onChange: s
|
|
1956
|
+
});
|
|
1957
|
+
return /* @__PURE__ */ a(
|
|
1958
|
+
No,
|
|
1959
|
+
{
|
|
1960
|
+
scope: t,
|
|
1961
|
+
triggerRef: i,
|
|
1962
|
+
contentRef: l,
|
|
1963
|
+
contentId: Xe(),
|
|
1964
|
+
titleId: Xe(),
|
|
1965
|
+
descriptionId: Xe(),
|
|
1966
|
+
open: p,
|
|
1967
|
+
onOpenChange: m,
|
|
1968
|
+
onOpenToggle: V.useCallback(() => m((f) => !f), [m]),
|
|
1969
|
+
modal: c,
|
|
1970
|
+
children: n
|
|
1971
|
+
}
|
|
1972
|
+
);
|
|
1973
|
+
};
|
|
1974
|
+
vn.displayName = Ct;
|
|
1975
|
+
var _n = "DialogTrigger", Lo = V.forwardRef(
|
|
1976
|
+
(e, t) => {
|
|
1977
|
+
const { __scopeDialog: n, ...r } = e, o = ae(_n, n), s = gt(t, o.triggerRef);
|
|
1978
|
+
return /* @__PURE__ */ a(
|
|
1979
|
+
Me.button,
|
|
1980
|
+
{
|
|
1981
|
+
type: "button",
|
|
1982
|
+
"aria-haspopup": "dialog",
|
|
1983
|
+
"aria-expanded": o.open,
|
|
1984
|
+
"aria-controls": o.contentId,
|
|
1985
|
+
"data-state": St(o.open),
|
|
1986
|
+
...r,
|
|
1987
|
+
ref: s,
|
|
1988
|
+
onClick: xe(e.onClick, o.onOpenToggle)
|
|
1989
|
+
}
|
|
1990
|
+
);
|
|
1991
|
+
}
|
|
1992
|
+
);
|
|
1993
|
+
Lo.displayName = _n;
|
|
1994
|
+
var Pt = "DialogPortal", [Mo, wn] = gn(Pt, {
|
|
1995
|
+
forceMount: void 0
|
|
1996
|
+
}), bn = (e) => {
|
|
1997
|
+
const { __scopeDialog: t, forceMount: n, children: r, container: o } = e, s = ae(Pt, t);
|
|
1998
|
+
return /* @__PURE__ */ a(Mo, { scope: t, forceMount: n, children: V.Children.map(r, (c) => /* @__PURE__ */ a(vt, { present: n || s.open, children: /* @__PURE__ */ a(Rr, { asChild: !0, container: o, children: c }) })) });
|
|
1999
|
+
};
|
|
2000
|
+
bn.displayName = Pt;
|
|
2001
|
+
var We = "DialogOverlay", Cn = V.forwardRef(
|
|
2002
|
+
(e, t) => {
|
|
2003
|
+
const n = wn(We, e.__scopeDialog), { forceMount: r = n.forceMount, ...o } = e, s = ae(We, e.__scopeDialog);
|
|
2004
|
+
return s.modal ? /* @__PURE__ */ a(vt, { present: r || s.open, children: /* @__PURE__ */ a(Eo, { ...o, ref: t }) }) : null;
|
|
2005
|
+
}
|
|
2006
|
+
);
|
|
2007
|
+
Cn.displayName = We;
|
|
2008
|
+
var Eo = V.forwardRef(
|
|
2009
|
+
(e, t) => {
|
|
2010
|
+
const { __scopeDialog: n, ...r } = e, o = ae(We, n);
|
|
2011
|
+
return (
|
|
2012
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
2013
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
2014
|
+
/* @__PURE__ */ a(Sr, { as: br, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ a(
|
|
2015
|
+
Me.div,
|
|
2016
|
+
{
|
|
2017
|
+
"data-state": St(o.open),
|
|
2018
|
+
...r,
|
|
2019
|
+
ref: t,
|
|
2020
|
+
style: { pointerEvents: "auto", ...r.style }
|
|
2021
|
+
}
|
|
2022
|
+
) })
|
|
2023
|
+
);
|
|
2024
|
+
}
|
|
2025
|
+
), ve = "DialogContent", Pn = V.forwardRef(
|
|
2026
|
+
(e, t) => {
|
|
2027
|
+
const n = wn(ve, e.__scopeDialog), { forceMount: r = n.forceMount, ...o } = e, s = ae(ve, e.__scopeDialog);
|
|
2028
|
+
return /* @__PURE__ */ a(vt, { present: r || s.open, children: s.modal ? /* @__PURE__ */ a(Oo, { ...o, ref: t }) : /* @__PURE__ */ a(Do, { ...o, ref: t }) });
|
|
2029
|
+
}
|
|
2030
|
+
);
|
|
2031
|
+
Pn.displayName = ve;
|
|
2032
|
+
var Oo = V.forwardRef(
|
|
2033
|
+
(e, t) => {
|
|
2034
|
+
const n = ae(ve, e.__scopeDialog), r = V.useRef(null), o = gt(t, n.contentRef, r);
|
|
2035
|
+
return V.useEffect(() => {
|
|
2036
|
+
const s = r.current;
|
|
2037
|
+
if (s)
|
|
2038
|
+
return yr(s);
|
|
2039
|
+
}, []), /* @__PURE__ */ a(
|
|
2040
|
+
Tn,
|
|
2041
|
+
{
|
|
2042
|
+
...e,
|
|
2043
|
+
ref: o,
|
|
2044
|
+
trapFocus: n.open,
|
|
2045
|
+
disableOutsidePointerEvents: !0,
|
|
2046
|
+
onCloseAutoFocus: xe(e.onCloseAutoFocus, (s) => {
|
|
2047
|
+
var c;
|
|
2048
|
+
s.preventDefault(), (c = n.triggerRef.current) == null || c.focus();
|
|
2049
|
+
}),
|
|
2050
|
+
onPointerDownOutside: xe(e.onPointerDownOutside, (s) => {
|
|
2051
|
+
const c = s.detail.originalEvent, i = c.button === 0 && c.ctrlKey === !0;
|
|
2052
|
+
(c.button === 2 || i) && s.preventDefault();
|
|
2053
|
+
}),
|
|
2054
|
+
onFocusOutside: xe(
|
|
2055
|
+
e.onFocusOutside,
|
|
2056
|
+
(s) => s.preventDefault()
|
|
2057
|
+
)
|
|
2058
|
+
}
|
|
2059
|
+
);
|
|
2060
|
+
}
|
|
2061
|
+
), Do = V.forwardRef(
|
|
2062
|
+
(e, t) => {
|
|
2063
|
+
const n = ae(ve, e.__scopeDialog), r = V.useRef(!1), o = V.useRef(!1);
|
|
2064
|
+
return /* @__PURE__ */ a(
|
|
2065
|
+
Tn,
|
|
2066
|
+
{
|
|
2067
|
+
...e,
|
|
2068
|
+
ref: t,
|
|
2069
|
+
trapFocus: !1,
|
|
2070
|
+
disableOutsidePointerEvents: !1,
|
|
2071
|
+
onCloseAutoFocus: (s) => {
|
|
2072
|
+
var c, i;
|
|
2073
|
+
(c = e.onCloseAutoFocus) == null || c.call(e, s), s.defaultPrevented || (r.current || (i = n.triggerRef.current) == null || i.focus(), s.preventDefault()), r.current = !1, o.current = !1;
|
|
2074
|
+
},
|
|
2075
|
+
onInteractOutside: (s) => {
|
|
2076
|
+
var l, p;
|
|
2077
|
+
(l = e.onInteractOutside) == null || l.call(e, s), s.defaultPrevented || (r.current = !0, s.detail.originalEvent.type === "pointerdown" && (o.current = !0));
|
|
2078
|
+
const c = s.target;
|
|
2079
|
+
((p = n.triggerRef.current) == null ? void 0 : p.contains(c)) && s.preventDefault(), s.detail.originalEvent.type === "focusin" && o.current && s.preventDefault();
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
);
|
|
2083
|
+
}
|
|
2084
|
+
), Tn = V.forwardRef(
|
|
2085
|
+
(e, t) => {
|
|
2086
|
+
const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: s, ...c } = e, i = ae(ve, n), l = V.useRef(null), p = gt(t, l);
|
|
2087
|
+
return Ir(), /* @__PURE__ */ O(ze, { children: [
|
|
2088
|
+
/* @__PURE__ */ a(
|
|
2089
|
+
xr,
|
|
2090
|
+
{
|
|
2091
|
+
asChild: !0,
|
|
2092
|
+
loop: !0,
|
|
2093
|
+
trapped: r,
|
|
2094
|
+
onMountAutoFocus: o,
|
|
2095
|
+
onUnmountAutoFocus: s,
|
|
2096
|
+
children: /* @__PURE__ */ a(
|
|
2097
|
+
Tr,
|
|
2098
|
+
{
|
|
2099
|
+
role: "dialog",
|
|
2100
|
+
id: i.contentId,
|
|
2101
|
+
"aria-describedby": i.descriptionId,
|
|
2102
|
+
"aria-labelledby": i.titleId,
|
|
2103
|
+
"data-state": St(i.open),
|
|
2104
|
+
...c,
|
|
2105
|
+
ref: p,
|
|
2106
|
+
onDismiss: () => i.onOpenChange(!1)
|
|
2107
|
+
}
|
|
2108
|
+
)
|
|
2109
|
+
}
|
|
2110
|
+
),
|
|
2111
|
+
/* @__PURE__ */ O(ze, { children: [
|
|
2112
|
+
/* @__PURE__ */ a(zo, { titleId: i.titleId }),
|
|
2113
|
+
/* @__PURE__ */ a(ko, { contentRef: l, descriptionId: i.descriptionId })
|
|
2114
|
+
] })
|
|
2115
|
+
] });
|
|
2116
|
+
}
|
|
2117
|
+
), Tt = "DialogTitle", Sn = V.forwardRef(
|
|
2118
|
+
(e, t) => {
|
|
2119
|
+
const { __scopeDialog: n, ...r } = e, o = ae(Tt, n);
|
|
2120
|
+
return /* @__PURE__ */ a(Me.h2, { id: o.titleId, ...r, ref: t });
|
|
2121
|
+
}
|
|
2122
|
+
);
|
|
2123
|
+
Sn.displayName = Tt;
|
|
2124
|
+
var yn = "DialogDescription", Ao = V.forwardRef(
|
|
2125
|
+
(e, t) => {
|
|
2126
|
+
const { __scopeDialog: n, ...r } = e, o = ae(yn, n);
|
|
2127
|
+
return /* @__PURE__ */ a(Me.p, { id: o.descriptionId, ...r, ref: t });
|
|
2128
|
+
}
|
|
2129
|
+
);
|
|
2130
|
+
Ao.displayName = yn;
|
|
2131
|
+
var In = "DialogClose", xn = V.forwardRef(
|
|
2132
|
+
(e, t) => {
|
|
2133
|
+
const { __scopeDialog: n, ...r } = e, o = ae(In, n);
|
|
2134
|
+
return /* @__PURE__ */ a(
|
|
2135
|
+
Me.button,
|
|
2136
|
+
{
|
|
2137
|
+
type: "button",
|
|
2138
|
+
...r,
|
|
2139
|
+
ref: t,
|
|
2140
|
+
onClick: xe(e.onClick, () => o.onOpenChange(!1))
|
|
2141
|
+
}
|
|
2142
|
+
);
|
|
2143
|
+
}
|
|
2144
|
+
);
|
|
2145
|
+
xn.displayName = In;
|
|
2146
|
+
function St(e) {
|
|
2147
|
+
return e ? "open" : "closed";
|
|
2148
|
+
}
|
|
2149
|
+
var Rn = "DialogTitleWarning", [Xs, Nn] = Cr(Rn, {
|
|
2150
|
+
contentName: ve,
|
|
2151
|
+
titleName: Tt,
|
|
2152
|
+
docsSlug: "dialog"
|
|
2153
|
+
}), zo = ({ titleId: e }) => {
|
|
2154
|
+
const t = Nn(Rn), n = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2155
|
+
|
|
2156
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
2157
|
+
|
|
2158
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
|
|
2159
|
+
return V.useEffect(() => {
|
|
2160
|
+
e && (document.getElementById(e) || console.error(n));
|
|
2161
|
+
}, [n, e]), null;
|
|
2162
|
+
}, Fo = "DialogDescriptionWarning", ko = ({ contentRef: e, descriptionId: t }) => {
|
|
2163
|
+
const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Nn(Fo).contentName}}.`;
|
|
2164
|
+
return V.useEffect(() => {
|
|
2165
|
+
var s;
|
|
2166
|
+
const o = (s = e.current) == null ? void 0 : s.getAttribute("aria-describedby");
|
|
2167
|
+
t && o && (document.getElementById(t) || console.warn(r));
|
|
2168
|
+
}, [r, e, t]), null;
|
|
2169
|
+
}, Wo = vn, Ho = bn, $o = Cn, Go = Pn, Vo = Sn, Uo = xn;
|
|
2170
|
+
const ge = {
|
|
2171
|
+
"rp-dialog-wrapper": "_rp-dialog-wrapper_slqo7_1",
|
|
2172
|
+
"rp-dialog-overlay": "_rp-dialog-overlay_slqo7_7",
|
|
2173
|
+
"rp-document-dialog": "_rp-document-dialog_slqo7_13",
|
|
2174
|
+
"rp-document-properties": "_rp-document-properties_slqo7_35",
|
|
2175
|
+
"rp-dialog-title": "_rp-dialog-title_slqo7_39",
|
|
2176
|
+
"rp-dialog-close": "_rp-dialog-close_slqo7_47",
|
|
2177
|
+
"rp-properties-divider": "_rp-properties-divider_slqo7_55"
|
|
2178
|
+
}, qo = () => {
|
|
2179
|
+
const { pdfProperties: e } = Y(), { container: t } = Ne(), { activeDocumentProperties: n, setActiveDocumentProperties: r } = Lr(), o = A(() => {
|
|
2180
|
+
if (!e)
|
|
2181
|
+
return [];
|
|
2182
|
+
const {
|
|
2183
|
+
fileSize: s,
|
|
2184
|
+
filename: c,
|
|
2185
|
+
title: i,
|
|
2186
|
+
author: l,
|
|
2187
|
+
subject: p,
|
|
2188
|
+
createdOn: m,
|
|
2189
|
+
creator: f,
|
|
2190
|
+
keywords: u,
|
|
2191
|
+
modifiedOn: h,
|
|
2192
|
+
pdfProducer: g,
|
|
2193
|
+
pdfVersion: _,
|
|
2194
|
+
pageCount: v
|
|
2195
|
+
} = e;
|
|
2196
|
+
return [
|
|
2197
|
+
{ label: "File name", value: c },
|
|
2198
|
+
{ label: "File size", value: s },
|
|
2199
|
+
{ separate: !0 },
|
|
2200
|
+
{ label: "Title", value: i },
|
|
2201
|
+
{ label: "Author", value: l },
|
|
2202
|
+
{ label: "Subject", value: p },
|
|
2203
|
+
{ label: "Keywords", value: u },
|
|
2204
|
+
{ label: "Creator", value: f },
|
|
2205
|
+
{
|
|
2206
|
+
label: "Created on",
|
|
2207
|
+
value: m ? ct(m) : ""
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
label: "Modified on",
|
|
2211
|
+
value: h ? ct(h) : ""
|
|
2212
|
+
},
|
|
2213
|
+
{ separate: !0 },
|
|
2214
|
+
{ label: "PDF producer", value: g },
|
|
2215
|
+
{ label: "PDF version", value: _ },
|
|
2216
|
+
{ label: "Page count", value: v }
|
|
2217
|
+
];
|
|
2218
|
+
}, [e]);
|
|
2219
|
+
return /* @__PURE__ */ a(Wo, { open: n, onOpenChange: r, children: /* @__PURE__ */ a(Ho, { container: t, children: /* @__PURE__ */ O("div", { className: ge["rp-dialog-wrapper"], children: [
|
|
2220
|
+
/* @__PURE__ */ a($o, { className: ge["rp-dialog-overlay"] }),
|
|
2221
|
+
/* @__PURE__ */ O(Go, { className: ge["rp-document-dialog"], children: [
|
|
2222
|
+
/* @__PURE__ */ a(Vo, { className: ge["rp-dialog-title"], children: "Document Properties" }),
|
|
2223
|
+
/* @__PURE__ */ a("div", { className: ge["rp-document-properties"], children: o.map((s, c) => /* @__PURE__ */ a("div", { children: s.separate ? /* @__PURE__ */ a("div", { className: ge["rp-properties-divider"] }) : /* @__PURE__ */ a(Nr, { label: s.label, value: s.value }) }, c)) }),
|
|
2224
|
+
/* @__PURE__ */ a(Uo, { asChild: !0, className: ge["rp-dialog-close"], children: /* @__PURE__ */ a(Qt, {}) })
|
|
2225
|
+
] })
|
|
2226
|
+
] }) }) });
|
|
2227
|
+
}, Zo = {
|
|
2228
|
+
"rp-other-tool-content": "_rp-other-tool-content_su718_1"
|
|
2229
|
+
}, jo = (e) => URL.createObjectURL(e), Bo = async (e) => {
|
|
2230
|
+
const n = await (await fetch(e)).blob();
|
|
2231
|
+
return jo(n);
|
|
2232
|
+
}, Ko = () => {
|
|
2233
|
+
const { filename: e, pdfSrc: t } = Y();
|
|
2234
|
+
return { download: x(async () => {
|
|
2235
|
+
if (!e || !t)
|
|
2236
|
+
throw new Error("There is no PDF source to download");
|
|
2237
|
+
const r = document.createElement("a");
|
|
2238
|
+
r.href = await Bo(t), r.download = e, document.body.appendChild(r), r.click(), document.body.removeChild(r);
|
|
2239
|
+
}, []) };
|
|
2240
|
+
}, Ln = () => {
|
|
2241
|
+
const { downloadIcon: e } = ce();
|
|
2242
|
+
return e || /* @__PURE__ */ a(Ar, {});
|
|
2243
|
+
}, Mn = ({ children: e, className: t }) => /* @__PURE__ */ a(ne, { className: t, content: "Download file", children: e }), Xo = ({ download: e }) => /* @__PURE__ */ a(Mn, { children: /* @__PURE__ */ a(X, { onClick: e, children: /* @__PURE__ */ a(Ln, {}) }) }), Jo = ({ download: e }) => /* @__PURE__ */ a(fe, { onClick: e, children: /* @__PURE__ */ O(Mn, { className: "rp-menu-item", children: [
|
|
2244
|
+
/* @__PURE__ */ a("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ a(Ln, {}) }),
|
|
2245
|
+
"Download file"
|
|
2246
|
+
] }) }), En = () => {
|
|
2247
|
+
const { download: e } = Ko(), { downloadTool: t = !0 } = de(), { isSmallScreen: n } = _e();
|
|
2248
|
+
return t ? n ? /* @__PURE__ */ a(Jo, { download: e }) : typeof t == "function" ? /* @__PURE__ */ a(t, { download: e }) : t ? /* @__PURE__ */ a(Xo, { download: e }) : null : null;
|
|
2249
|
+
}, On = () => {
|
|
2250
|
+
const { printIcon: e } = ce();
|
|
2251
|
+
return e || /* @__PURE__ */ a(zr, {});
|
|
2252
|
+
}, Dn = ({ children: e, className: t }) => /* @__PURE__ */ a(ne, { className: t, content: "Print", children: e }), Yo = ({ print: e }) => /* @__PURE__ */ a(Dn, { children: /* @__PURE__ */ a(X, { onClick: e, children: /* @__PURE__ */ a(On, {}) }) }), Qo = ({ print: e }) => /* @__PURE__ */ a(fe, { onClick: e, children: /* @__PURE__ */ O(Dn, { className: "rp-menu-item", children: [
|
|
2253
|
+
/* @__PURE__ */ a("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ a(On, {}) }),
|
|
2254
|
+
"Print"
|
|
2255
|
+
] }) }), An = () => {
|
|
2256
|
+
const { print: e, cancel: t, setOnProgress: n, setOnComplete: r, setOnError: o, progress: s } = wt(), { printTool: c = !0 } = de(), { isSmallScreen: i } = _e();
|
|
2257
|
+
return c ? i ? /* @__PURE__ */ a(Qo, { print: e }) : typeof c == "function" ? /* @__PURE__ */ a(
|
|
2258
|
+
c,
|
|
2259
|
+
{
|
|
2260
|
+
print: e,
|
|
2261
|
+
cancel: t,
|
|
2262
|
+
setOnProgress: n,
|
|
2263
|
+
setOnError: o,
|
|
2264
|
+
setOnComplete: r,
|
|
2265
|
+
progress: s
|
|
2266
|
+
}
|
|
2267
|
+
) : c ? /* @__PURE__ */ a(Yo, { print: e }) : null : null;
|
|
2268
|
+
}, ea = {
|
|
2269
|
+
"rp-go-to-Top": "_rp-go-to-Top_4e0yd_1"
|
|
2270
|
+
}, ta = () => {
|
|
2271
|
+
const { goToFirstPageIcon: e } = ce();
|
|
2272
|
+
return e || /* @__PURE__ */ a(tn, { className: ea["rp-go-to-Top"] });
|
|
2273
|
+
}, na = () => {
|
|
2274
|
+
const { goToLastPageIcon: e } = ce();
|
|
2275
|
+
return e || /* @__PURE__ */ a(tn, {});
|
|
2276
|
+
}, ra = () => {
|
|
2277
|
+
const { goToPage: e, totalPages: t, focusedPage: n } = oe(), { jumpNavigationTool: r = !0 } = de(), o = A(() => n === 1, [n]), s = A(() => n === t, [n, t]), c = x(() => {
|
|
2278
|
+
e(1);
|
|
2279
|
+
}, [e]), i = x(() => {
|
|
2280
|
+
e(t);
|
|
2281
|
+
}, [e, t]);
|
|
2282
|
+
return r ? /* @__PURE__ */ O(ke, { children: [
|
|
2283
|
+
/* @__PURE__ */ a(fe, { disabled: o, onClick: c, children: /* @__PURE__ */ O(ne, { className: "rp-menu-item", content: "Go to first page", children: [
|
|
2284
|
+
/* @__PURE__ */ a("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ a(ta, {}) }),
|
|
2285
|
+
"First page"
|
|
2286
|
+
] }) }),
|
|
2287
|
+
/* @__PURE__ */ a(fe, { disabled: s, onClick: i, children: /* @__PURE__ */ O(ne, { className: "rp-menu-item", content: "Go to last page", children: [
|
|
2288
|
+
/* @__PURE__ */ a("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ a(na, {}) }),
|
|
2289
|
+
"Last page"
|
|
2290
|
+
] }) }),
|
|
2291
|
+
/* @__PURE__ */ a(_t, {})
|
|
2292
|
+
] }) : null;
|
|
2293
|
+
}, oa = () => {
|
|
2294
|
+
const { container: e } = Ne(), { isSmallScreen: t } = _e(), {
|
|
2295
|
+
openFileTool: n,
|
|
2296
|
+
downloadTool: r,
|
|
2297
|
+
documentProperties: o,
|
|
2298
|
+
scrollModeTool: s,
|
|
2299
|
+
rotateTool: c,
|
|
2300
|
+
selectionModeTool: i,
|
|
2301
|
+
jumpNavigationTool: l,
|
|
2302
|
+
printTool: p,
|
|
2303
|
+
fullscreenTool: m
|
|
2304
|
+
} = de();
|
|
2305
|
+
return A(() => {
|
|
2306
|
+
const u = l || c || i || s || o;
|
|
2307
|
+
let h = !1;
|
|
2308
|
+
return t && (h = !(!n && !r && !p && !m)), u || h;
|
|
2309
|
+
}, [
|
|
2310
|
+
n,
|
|
2311
|
+
r,
|
|
2312
|
+
o,
|
|
2313
|
+
s,
|
|
2314
|
+
c,
|
|
2315
|
+
i,
|
|
2316
|
+
l,
|
|
2317
|
+
t
|
|
2318
|
+
]) ? /* @__PURE__ */ O(Mr, { children: [
|
|
2319
|
+
/* @__PURE__ */ a(
|
|
2320
|
+
ft,
|
|
2321
|
+
{
|
|
2322
|
+
container: e,
|
|
2323
|
+
triggerComponent: /* @__PURE__ */ a("div", { role: "button", children: /* @__PURE__ */ a(ne, { content: "More options", children: /* @__PURE__ */ a(X, { children: /* @__PURE__ */ a(_r, {}) }) }) }),
|
|
2324
|
+
children: /* @__PURE__ */ O("div", { className: Zo["rp-other-tool-content"], "data-rp": "moreOptionsDropdown", children: [
|
|
2325
|
+
t && /* @__PURE__ */ O(ke, { children: [
|
|
2326
|
+
/* @__PURE__ */ a(Yt, {}),
|
|
2327
|
+
/* @__PURE__ */ a(En, {}),
|
|
2328
|
+
/* @__PURE__ */ a(An, {}),
|
|
2329
|
+
/* @__PURE__ */ a(en, {}),
|
|
2330
|
+
/* @__PURE__ */ a(_t, {})
|
|
2331
|
+
] }),
|
|
2332
|
+
/* @__PURE__ */ a(ra, {}),
|
|
2333
|
+
/* @__PURE__ */ a(Or, {}),
|
|
2334
|
+
/* @__PURE__ */ a(Fr, {}),
|
|
2335
|
+
/* @__PURE__ */ a(Dr, {}),
|
|
2336
|
+
/* @__PURE__ */ a(Er, {})
|
|
2337
|
+
] })
|
|
2338
|
+
}
|
|
2339
|
+
),
|
|
2340
|
+
/* @__PURE__ */ a(qo, {})
|
|
2341
|
+
] }) : null;
|
|
2342
|
+
}, aa = () => {
|
|
2343
|
+
const { isSmallScreen: e } = _e();
|
|
2344
|
+
return /* @__PURE__ */ O(ze, { children: [
|
|
2345
|
+
/* @__PURE__ */ a(vr, {}),
|
|
2346
|
+
!e && /* @__PURE__ */ O(ze, { children: [
|
|
2347
|
+
/* @__PURE__ */ a(Yt, {}),
|
|
2348
|
+
/* @__PURE__ */ a(En, {}),
|
|
2349
|
+
/* @__PURE__ */ a(An, {}),
|
|
2350
|
+
/* @__PURE__ */ a(en, {})
|
|
2351
|
+
] }),
|
|
2352
|
+
/* @__PURE__ */ a(oa, {})
|
|
2353
|
+
] });
|
|
2354
|
+
}, Pe = {
|
|
2355
|
+
"rp-zoom-wrapper": "_rp-zoom-wrapper_cocqs_1",
|
|
2356
|
+
"rp-current-zoom-wrapper": "_rp-current-zoom-wrapper_cocqs_6",
|
|
2357
|
+
"rp-current-zoom-icon": "_rp-current-zoom-icon_cocqs_11",
|
|
2358
|
+
"rp-current-zoom-text": "_rp-current-zoom-text_cocqs_16",
|
|
2359
|
+
"rp-zoom-dropdown-content": "_rp-zoom-dropdown-content_cocqs_20"
|
|
2360
|
+
}, sa = 25, ot = 1e3, ia = [50, 75, 100, 125, 150, 200, 300, 400], ca = () => {
|
|
2361
|
+
const { zoomInIcon: e } = ce();
|
|
2362
|
+
return e || /* @__PURE__ */ a(kr, {});
|
|
2363
|
+
}, la = () => {
|
|
2364
|
+
const { zoomOutIcon: e } = ce();
|
|
2365
|
+
return e || /* @__PURE__ */ a(Wr, {});
|
|
2366
|
+
}, ua = () => {
|
|
2367
|
+
const { zoomLevel: e, setZoomLevel: t } = Ue(), { container: n, contentRef: r } = Ne(), { zoomTool: o = !0 } = de(), { focusedPage: s } = oe(), { rotate: c } = Ve(), { pages: i } = Y(), { isSmallScreen: l } = _e(), p = x(() => {
|
|
2368
|
+
t((v) => {
|
|
2369
|
+
const C = Math.floor(v / 25) * 25;
|
|
2370
|
+
return Math.min(C + 25, ot);
|
|
2371
|
+
});
|
|
2372
|
+
}, [t]), m = x(() => {
|
|
2373
|
+
t((v) => {
|
|
2374
|
+
const C = Math.ceil(v / 25) * 25;
|
|
2375
|
+
return Math.min(C - 25, ot);
|
|
2376
|
+
});
|
|
2377
|
+
}, [t]), f = A(() => e === sa, [e]), u = A(() => e === ot, [e]), h = A(() => {
|
|
2378
|
+
var v;
|
|
2379
|
+
return (v = i.get(s)) == null ? void 0 : v.page.getViewport({ scale: 1, rotation: c });
|
|
2380
|
+
}, [i, s, c]), g = x(
|
|
2381
|
+
(v) => {
|
|
2382
|
+
const C = ((h == null ? void 0 : h.width) || 0) + 2 * It, S = ((h == null ? void 0 : h.height) || 0) + 2 * It, P = (r == null ? void 0 : r.clientWidth) || 0, N = (r == null ? void 0 : r.clientHeight) || 0, d = Hr(v, P, N, C, S);
|
|
2383
|
+
t(d);
|
|
2384
|
+
},
|
|
2385
|
+
[t, h]
|
|
2386
|
+
), _ = x(
|
|
2387
|
+
(v) => {
|
|
2388
|
+
typeof v == "number" ? t(v) : g(v);
|
|
2389
|
+
},
|
|
2390
|
+
[t, g]
|
|
2391
|
+
);
|
|
2392
|
+
return typeof o != "boolean" ? /* @__PURE__ */ a(o, { zoomLevel: e, setZoomLevel: t }) : o ? /* @__PURE__ */ O("div", { className: Pe["rp-zoom-wrapper"], children: [
|
|
2393
|
+
/* @__PURE__ */ a(ne, { content: "Zoom out", children: /* @__PURE__ */ a(X, { disabled: f, onClick: m, children: /* @__PURE__ */ a(la, {}) }) }),
|
|
2394
|
+
!l && /* @__PURE__ */ a(
|
|
2395
|
+
ft,
|
|
2396
|
+
{
|
|
2397
|
+
container: n,
|
|
2398
|
+
triggerComponent: /* @__PURE__ */ a("div", { role: "button", children: /* @__PURE__ */ a(ne, { content: "Select zoom level", children: /* @__PURE__ */ O(X, { className: Pe["rp-current-zoom-wrapper"], children: [
|
|
2399
|
+
/* @__PURE__ */ a("span", { className: Pe["rp-current-zoom-text"], children: e }),
|
|
2400
|
+
/* @__PURE__ */ a("span", { className: Pe["rp-current-zoom-text"], children: "%" }),
|
|
2401
|
+
/* @__PURE__ */ a(Re, { className: Pe["rp-current-zoom-icon"] })
|
|
2402
|
+
] }) }) }),
|
|
2403
|
+
style: { minWidth: "200px" },
|
|
2404
|
+
align: "center",
|
|
2405
|
+
children: /* @__PURE__ */ O("div", { className: Pe["rp-zoom-dropdown-content"], children: [
|
|
2406
|
+
/* @__PURE__ */ O(ke, { children: [
|
|
2407
|
+
/* @__PURE__ */ a(fe, { onClick: () => _(Ke.ACTUAL), children: "Actual size" }),
|
|
2408
|
+
/* @__PURE__ */ a(fe, { onClick: () => _(Ke.PAGE_FIT), children: "Page fit" }),
|
|
2409
|
+
/* @__PURE__ */ a(fe, { onClick: () => _(Ke.PAGE_WIDTH), children: "Page width" })
|
|
2410
|
+
] }),
|
|
2411
|
+
/* @__PURE__ */ a(_t, {}),
|
|
2412
|
+
/* @__PURE__ */ a(ke, { children: ia.map((v) => /* @__PURE__ */ O(fe, { onClick: () => _(v), children: [
|
|
2413
|
+
v,
|
|
2414
|
+
" %"
|
|
2415
|
+
] }, v)) })
|
|
2416
|
+
] })
|
|
2417
|
+
}
|
|
2418
|
+
),
|
|
2419
|
+
/* @__PURE__ */ a(ne, { content: "Zoom in", children: /* @__PURE__ */ a(X, { disabled: u, onClick: p, children: /* @__PURE__ */ a(ca, {}) }) })
|
|
2420
|
+
] }) : null;
|
|
2421
|
+
}, ie = {
|
|
2422
|
+
"rp-search-tool-content": "_rp-search-tool-content_1vxow_1",
|
|
2423
|
+
"rp-search-tool-input": "_rp-search-tool-input_1vxow_6",
|
|
2424
|
+
"rp-search-tool-input-icon": "_rp-search-tool-input-icon_1vxow_12",
|
|
2425
|
+
"rp-search-tool-controls": "_rp-search-tool-controls_1vxow_16",
|
|
2426
|
+
"rp-search-tool-input-wrapper": "_rp-search-tool-input-wrapper_1vxow_24",
|
|
2427
|
+
"rp-search-tool-input-checkboxes": "_rp-search-tool-input-checkboxes_1vxow_30",
|
|
2428
|
+
"rp-search-tool-input-clear": "_rp-search-tool-input-clear_1vxow_35",
|
|
2429
|
+
"rp-search-input": "_rp-search-input_1vxow_49"
|
|
2430
|
+
}, Ut = () => {
|
|
2431
|
+
const { searchIcon: e } = ce();
|
|
2432
|
+
return e || /* @__PURE__ */ a($r, {});
|
|
2433
|
+
}, da = () => {
|
|
2434
|
+
const { container: e } = Ne(), [t, n] = H(!1), { pdf: r } = Y(), [o, s] = H(null), {
|
|
2435
|
+
searchOptions: c,
|
|
2436
|
+
setSearchOptions: i,
|
|
2437
|
+
loading: l,
|
|
2438
|
+
setSearch: p,
|
|
2439
|
+
totalMatches: m,
|
|
2440
|
+
currentMatchPosition: f,
|
|
2441
|
+
nextMatch: u,
|
|
2442
|
+
prevMatch: h,
|
|
2443
|
+
search: g
|
|
2444
|
+
} = ln(), { searchTool: _ = !0 } = de(), [v, C] = H(g), S = x(() => {
|
|
2445
|
+
n(!0);
|
|
2446
|
+
}, []), P = x(() => {
|
|
2447
|
+
p(""), C(""), n(!1);
|
|
2448
|
+
}, [p]), N = x(
|
|
2449
|
+
(R) => {
|
|
2450
|
+
R.key === "Escape" && t && P();
|
|
2451
|
+
},
|
|
2452
|
+
[t]
|
|
2453
|
+
), d = x(
|
|
2454
|
+
(R) => {
|
|
2455
|
+
R.shiftKey && R.key === "Enter" ? h() : R.key === "Enter" && g !== v ? p(v) : R.key === "Enter" && u();
|
|
2456
|
+
},
|
|
2457
|
+
[v, h, u, p, g]
|
|
2458
|
+
);
|
|
2459
|
+
z(() => (window.addEventListener("keydown", N), () => {
|
|
2460
|
+
window.removeEventListener("keydown", N);
|
|
2461
|
+
}), [N]), z(() => {
|
|
2462
|
+
o && o.focus();
|
|
2463
|
+
}, [o]);
|
|
2464
|
+
const b = x((R) => {
|
|
2465
|
+
C(R.target.value);
|
|
2466
|
+
}, []), w = x(() => {
|
|
2467
|
+
C(""), p("");
|
|
2468
|
+
}, [p]), T = A(() => `${f} / ${m}`, [f, m]), { wholeWords: E, matchCase: I } = A(() => c, [c]), y = x(
|
|
2469
|
+
(R) => {
|
|
2470
|
+
i((L) => ({ ...L, matchCase: R }));
|
|
2471
|
+
},
|
|
2472
|
+
[i]
|
|
2473
|
+
), D = x(
|
|
2474
|
+
(R) => {
|
|
2475
|
+
i((L) => ({ ...L, wholeWords: R }));
|
|
2476
|
+
},
|
|
2477
|
+
[i]
|
|
2478
|
+
);
|
|
2479
|
+
return z(() => {
|
|
2480
|
+
P();
|
|
2481
|
+
}, [r, P]), _ ? /* @__PURE__ */ a(
|
|
2482
|
+
ft,
|
|
2483
|
+
{
|
|
2484
|
+
open: t,
|
|
2485
|
+
container: e,
|
|
2486
|
+
align: "start",
|
|
2487
|
+
triggerComponent: /* @__PURE__ */ a(ne, { content: "Search in document", children: /* @__PURE__ */ a(X, { onClick: S, children: /* @__PURE__ */ a(Ut, {}) }) }),
|
|
2488
|
+
children: /* @__PURE__ */ O("div", { className: ie["rp-search-tool-content"], children: [
|
|
2489
|
+
/* @__PURE__ */ O("div", { className: ie["rp-search-tool-input-wrapper"], children: [
|
|
2490
|
+
/* @__PURE__ */ O("div", { className: ie["rp-search-tool-input"], children: [
|
|
2491
|
+
/* @__PURE__ */ a(
|
|
2492
|
+
jt,
|
|
2493
|
+
{
|
|
2494
|
+
value: v,
|
|
2495
|
+
onKeyDown: d,
|
|
2496
|
+
onChange: b,
|
|
2497
|
+
icon: /* @__PURE__ */ a(Ut, {}),
|
|
2498
|
+
placeholder: "Enter to Search",
|
|
2499
|
+
className: ie["rp-search-input"],
|
|
2500
|
+
ref: s,
|
|
2501
|
+
children: !!v && /* @__PURE__ */ a("span", { className: ie["rp-search-tool-input-clear"], onClick: w, children: /* @__PURE__ */ a(Gr, {}) })
|
|
2502
|
+
}
|
|
2503
|
+
),
|
|
2504
|
+
l ? /* @__PURE__ */ a("span", { children: /* @__PURE__ */ a(Le, {}) }) : /* @__PURE__ */ a("span", { children: T })
|
|
2505
|
+
] }),
|
|
2506
|
+
/* @__PURE__ */ O("div", { className: ie["rp-search-tool-input-checkboxes"], children: [
|
|
2507
|
+
/* @__PURE__ */ a(xt, { name: "matchCase", value: I, onChange: y, children: "Match Case" }),
|
|
2508
|
+
/* @__PURE__ */ a(xt, { name: "wholeWord", value: E, onChange: D, children: "Whole Word" })
|
|
2509
|
+
] })
|
|
2510
|
+
] }),
|
|
2511
|
+
/* @__PURE__ */ O("div", { className: ie["rp-search-tool-controls"], children: [
|
|
2512
|
+
/* @__PURE__ */ a(X, { onClick: h, children: /* @__PURE__ */ a(Re, { className: ie["rp-search-tool-input-icon"] }) }),
|
|
2513
|
+
/* @__PURE__ */ a(X, { onClick: u, children: /* @__PURE__ */ a(
|
|
2514
|
+
Re,
|
|
2515
|
+
{
|
|
2516
|
+
style: { transform: "rotate(180deg" },
|
|
2517
|
+
className: ie["rp-search-tool-input-icon"]
|
|
2518
|
+
}
|
|
2519
|
+
) }),
|
|
2520
|
+
/* @__PURE__ */ a(X, { children: /* @__PURE__ */ a(Qt, { onClick: P, className: ie["rp-search-tool-input-icon"] }) })
|
|
2521
|
+
] })
|
|
2522
|
+
] })
|
|
2523
|
+
}
|
|
2524
|
+
) : null;
|
|
2525
|
+
}, pa = "_loading_1snj5_1", Te = {
|
|
2526
|
+
"rp-loading-overlay": "_rp-loading-overlay_1snj5_1",
|
|
2527
|
+
"rp-loading-modal": "_rp-loading-modal_1snj5_14",
|
|
2528
|
+
"rp-loading-title": "_rp-loading-title_1snj5_27",
|
|
2529
|
+
"rp-loading-progress-bar": "_rp-loading-progress-bar_1snj5_35",
|
|
2530
|
+
"rp-loading-progress": "_rp-loading-progress_1snj5_35",
|
|
2531
|
+
"rp-loading-cancel-button": "_rp-loading-cancel-button_1snj5_52",
|
|
2532
|
+
loading: pa
|
|
2533
|
+
}, ha = ({ percentage: e }) => {
|
|
2534
|
+
const { cancel: t } = wt();
|
|
2535
|
+
return e < 1 ? null : /* @__PURE__ */ a("div", { className: te(Te["rp-loading-overlay"]), children: /* @__PURE__ */ O("div", { className: te(Te["rp-loading-modal"]), children: [
|
|
2536
|
+
/* @__PURE__ */ a("div", { className: te(Te["rp-loading-title"]), children: "Preparing document..." }),
|
|
2537
|
+
/* @__PURE__ */ a("div", { className: te(Te["rp-loading-progress-bar"]), children: /* @__PURE__ */ a(
|
|
2538
|
+
"div",
|
|
2539
|
+
{
|
|
2540
|
+
className: te(Te["rp-loading-progress"]),
|
|
2541
|
+
style: { width: `${e}%` }
|
|
2542
|
+
}
|
|
2543
|
+
) }),
|
|
2544
|
+
/* @__PURE__ */ a("button", { className: te(Te["rp-loading-cancel-button"]), onClick: t, children: "Cancel" })
|
|
2545
|
+
] }) });
|
|
2546
|
+
}, ma = Ge((e, t) => {
|
|
2547
|
+
const { showPrintProgress: n } = de(), { progress: r } = wt(), { isSmallScreen: o } = _e(), { percentage: s } = r || {}, c = () => o ? { gridTemplateColumns: "25% 60% 15%" } : void 0;
|
|
2548
|
+
return /* @__PURE__ */ O("div", { children: [
|
|
2549
|
+
/* @__PURE__ */ a("div", { "data-rp": "topBar", ref: t, className: ye["rp-toolbar-content"], children: /* @__PURE__ */ O("div", { className: ye["rp-toolbar-wrapper"], style: c(), children: [
|
|
2550
|
+
/* @__PURE__ */ O("div", { "data-rp": "topBarLeft", className: ye["rp-toolbar-start"], children: [
|
|
2551
|
+
/* @__PURE__ */ a(da, {}),
|
|
2552
|
+
/* @__PURE__ */ a(Ro, {})
|
|
2553
|
+
] }),
|
|
2554
|
+
/* @__PURE__ */ a("div", { "data-rp": "topBarCenter", className: ye["rp-toolbar-middle"], children: /* @__PURE__ */ a(ua, {}) }),
|
|
2555
|
+
/* @__PURE__ */ a("div", { "data-rp": "topBarRight", className: ye["rp-toolbar-end"], children: /* @__PURE__ */ a(aa, {}) })
|
|
2556
|
+
] }) }),
|
|
2557
|
+
n && s ? /* @__PURE__ */ a(ha, { percentage: s }) : null
|
|
2558
|
+
] });
|
|
2559
|
+
}), at = {
|
|
2560
|
+
"rp-sidebar-content-wrapper": "_rp-sidebar-content-wrapper_4wlw3_1",
|
|
2561
|
+
"rp-sidebar-content": "_rp-sidebar-content_4wlw3_1",
|
|
2562
|
+
"rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_4wlw3_16",
|
|
2563
|
+
"rp-thumbnail-dragging": "_rp-thumbnail-dragging_4wlw3_21"
|
|
2564
|
+
}, Ie = {
|
|
2565
|
+
"rp-thumbnail-wrapper": "_rp-thumbnail-wrapper_3fenb_1",
|
|
2566
|
+
"rp-thumbnail-text": "_rp-thumbnail-text_3fenb_10",
|
|
2567
|
+
"rp-thumbnail": "_rp-thumbnail_3fenb_1",
|
|
2568
|
+
"rp-thumbnail-active": "_rp-thumbnail-active_3fenb_22",
|
|
2569
|
+
"rp-thumbnail-loader": "_rp-thumbnail-loader_3fenb_31"
|
|
2570
|
+
}, fa = (e) => {
|
|
2571
|
+
const { thumbnailSrc: t, pageNumber: n, isFocused: r, viewport: o } = e, { goToPage: s } = oe(), c = A(() => r ? Ie["rp-thumbnail-active"] : "", [r]), i = A(() => ({
|
|
2572
|
+
width: Math.round(o.width),
|
|
2573
|
+
height: Math.round(o.height)
|
|
2574
|
+
}), [o]), l = x(() => {
|
|
2575
|
+
n && s(n);
|
|
2576
|
+
}, [s, n]);
|
|
2577
|
+
return /* @__PURE__ */ O(
|
|
2578
|
+
"div",
|
|
2579
|
+
{
|
|
2580
|
+
onClick: l,
|
|
2581
|
+
id: `page-${n}`,
|
|
2582
|
+
className: Ie["rp-thumbnail-wrapper"],
|
|
2583
|
+
children: [
|
|
2584
|
+
/* @__PURE__ */ a("div", { className: te(c, Ie["rp-thumbnail"]), children: t ? /* @__PURE__ */ a(
|
|
2585
|
+
"img",
|
|
2586
|
+
{
|
|
2587
|
+
src: t,
|
|
2588
|
+
width: i.width,
|
|
2589
|
+
height: i.height,
|
|
2590
|
+
alt: "thumbnail"
|
|
2591
|
+
}
|
|
2592
|
+
) : /* @__PURE__ */ a(
|
|
2593
|
+
"div",
|
|
2594
|
+
{
|
|
2595
|
+
className: Ie["rp-thumbnail-loader"],
|
|
2596
|
+
style: {
|
|
2597
|
+
width: `${i.width}px`,
|
|
2598
|
+
height: `${i.height}px`
|
|
2599
|
+
},
|
|
2600
|
+
children: /* @__PURE__ */ a(Le, {})
|
|
2601
|
+
}
|
|
2602
|
+
) }),
|
|
2603
|
+
/* @__PURE__ */ a("div", { className: Ie["rp-thumbnail-text"], children: n })
|
|
2604
|
+
]
|
|
2605
|
+
}
|
|
2606
|
+
);
|
|
2607
|
+
}, qt = {
|
|
2608
|
+
"rp-thumbnails-container": "_rp-thumbnails-container_16vqr_1",
|
|
2609
|
+
"rp-thumbnails": "_rp-thumbnails_16vqr_1"
|
|
2610
|
+
}, ga = 16, va = (e, t) => {
|
|
2611
|
+
const n = e == null ? void 0 : e.querySelector(`#page-${t}`);
|
|
2612
|
+
e && (n != null && n.offsetTop) && (e.scrollTop = (n == null ? void 0 : n.offsetTop) - ga);
|
|
2613
|
+
}, _a = Ge((e, t) => {
|
|
2614
|
+
const { show: n } = e, { focusedPage: r, totalPages: o } = oe(), { thumbnailPages: s, addPage: c, thumbnailLength: i, addToPage: l } = sn(), p = W(null), m = W(1);
|
|
2615
|
+
Zt(t, () => p.current);
|
|
2616
|
+
const f = A(() => Object.values(s), [s]), u = x(() => {
|
|
2617
|
+
const h = i + 1;
|
|
2618
|
+
h <= o && c(h);
|
|
2619
|
+
}, [c, o, i]);
|
|
2620
|
+
return z(() => {
|
|
2621
|
+
r > i ? l(r) : n && m.current !== r && (va(p.current, r), m.current = r);
|
|
2622
|
+
}, [r, i, l, n, f]), tr(p.current, u), /* @__PURE__ */ a("div", { ref: p, className: qt["rp-thumbnails-container"], children: /* @__PURE__ */ a("div", { className: qt["rp-thumbnails"], children: n ? f.map((h, g) => {
|
|
2623
|
+
var _, v;
|
|
2624
|
+
return /* @__PURE__ */ a(
|
|
2625
|
+
fa,
|
|
2626
|
+
{
|
|
2627
|
+
isFocused: r === ((_ = h.page) == null ? void 0 : _.pageNumber),
|
|
2628
|
+
pageNumber: (v = h.page) == null ? void 0 : v.pageNumber,
|
|
2629
|
+
thumbnailSrc: h.thumbnailSrc,
|
|
2630
|
+
loading: h.loading,
|
|
2631
|
+
viewport: h.viewport
|
|
2632
|
+
},
|
|
2633
|
+
g
|
|
2634
|
+
);
|
|
2635
|
+
}) : null }) });
|
|
2636
|
+
}), wa = () => {
|
|
2637
|
+
const { thumbnailIcon: e } = ce();
|
|
2638
|
+
return e || /* @__PURE__ */ a(er, {});
|
|
2639
|
+
}, ba = () => {
|
|
2640
|
+
const { active: e, setActive: t } = sn(), [n, r] = H(200), o = W(null), { thumbnailTool: s } = de(), c = x(() => {
|
|
2641
|
+
t((l) => !l);
|
|
2642
|
+
}, []), i = A(() => typeof s != "boolean" && s ? /* @__PURE__ */ a(s, { onClick: c, active: e }) : s ? /* @__PURE__ */ a(ne, { content: "Thumbnail", children: /* @__PURE__ */ a(X, { onClick: c, active: e, children: /* @__PURE__ */ a(wa, {}) }) }) : null, [s, e, c]);
|
|
2643
|
+
return /* @__PURE__ */ O(
|
|
2644
|
+
"div",
|
|
2645
|
+
{
|
|
2646
|
+
style: { "--rp-thumbnail-width": `${n}px` },
|
|
2647
|
+
className: at["rp-sidebar-content-wrapper"],
|
|
2648
|
+
"data-rp": "sidebar",
|
|
2649
|
+
children: [
|
|
2650
|
+
/* @__PURE__ */ a("div", { className: at["rp-sidebar-content"], children: i }),
|
|
2651
|
+
/* @__PURE__ */ O("div", { "data-rp": "thumbnailSidebar", hidden: !e, className: at["rp-thumbnails-wrapper"], children: [
|
|
2652
|
+
/* @__PURE__ */ a(_a, { show: e, ref: o }),
|
|
2653
|
+
/* @__PURE__ */ a(nr, { onWidthChange: r, thumbnailRef: o })
|
|
2654
|
+
] })
|
|
2655
|
+
]
|
|
2656
|
+
}
|
|
2657
|
+
);
|
|
2658
|
+
}, Js = Ge((e, t) => {
|
|
2659
|
+
const { children: n, slots: r, icons: o, style: s, className: c, mobileWidth: i, onLoaded: l, cleanupOnLoaded: p } = e, [m, f] = H(null), { setContainer: u, setContentRef: h } = Ne(), { loading: g } = Y();
|
|
2660
|
+
return z(() => (l && l(), () => {
|
|
2661
|
+
p && p();
|
|
2662
|
+
}), [l, p]), /* @__PURE__ */ a("div", { ref: t, className: te(be["rp-theme-variables"], be["rp-container"]), children: /* @__PURE__ */ a(cr, { mobileWidth: i, children: /* @__PURE__ */ a(rr, { slots: r, children: /* @__PURE__ */ a(or, { icons: o, children: /* @__PURE__ */ O(
|
|
2663
|
+
ar,
|
|
2664
|
+
{
|
|
2665
|
+
getContainerRef: u,
|
|
2666
|
+
toolbarRef: m,
|
|
2667
|
+
style: s,
|
|
2668
|
+
className: c,
|
|
2669
|
+
children: [
|
|
2670
|
+
/* @__PURE__ */ O(sr, { children: [
|
|
2671
|
+
/* @__PURE__ */ O("div", { className: be["rp-layout"], children: [
|
|
2672
|
+
/* @__PURE__ */ a(ma, { ref: f }),
|
|
2673
|
+
/* @__PURE__ */ O("div", { className: be["rp-content"], children: [
|
|
2674
|
+
/* @__PURE__ */ a("div", { className: be["rp-sidebar"], children: /* @__PURE__ */ a(ba, {}) }),
|
|
2675
|
+
/* @__PURE__ */ a("div", { ref: h, className: be["rp-pages"], children: n })
|
|
2676
|
+
] })
|
|
2677
|
+
] }),
|
|
2678
|
+
/* @__PURE__ */ a(ir, {})
|
|
2679
|
+
] }),
|
|
2680
|
+
g ? /* @__PURE__ */ a(
|
|
2681
|
+
"div",
|
|
2682
|
+
{
|
|
2683
|
+
style: {
|
|
2684
|
+
position: "absolute",
|
|
2685
|
+
top: 0,
|
|
2686
|
+
left: 0,
|
|
2687
|
+
right: 0,
|
|
2688
|
+
bottom: 0,
|
|
2689
|
+
width: "100%",
|
|
2690
|
+
height: "100%",
|
|
2691
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
2692
|
+
},
|
|
2693
|
+
children: /* @__PURE__ */ a(
|
|
2694
|
+
"div",
|
|
2695
|
+
{
|
|
2696
|
+
style: {
|
|
2697
|
+
display: "flex",
|
|
2698
|
+
justifyContent: "center",
|
|
2699
|
+
alignItems: "center",
|
|
2700
|
+
height: "100%",
|
|
2701
|
+
width: "100%"
|
|
2702
|
+
},
|
|
2703
|
+
children: /* @__PURE__ */ a(Le, {})
|
|
2704
|
+
}
|
|
2705
|
+
)
|
|
2706
|
+
}
|
|
2707
|
+
) : null
|
|
2708
|
+
]
|
|
2709
|
+
}
|
|
2710
|
+
) }) }) }) });
|
|
2711
|
+
});
|
|
2712
|
+
export {
|
|
2713
|
+
no as A,
|
|
2714
|
+
fa as B,
|
|
2715
|
+
jr as C,
|
|
2716
|
+
To as D,
|
|
2717
|
+
_a as E,
|
|
2718
|
+
En as F,
|
|
2719
|
+
ba as G,
|
|
2720
|
+
ha as L,
|
|
2721
|
+
ra as M,
|
|
2722
|
+
oa as O,
|
|
2723
|
+
Us as P,
|
|
2724
|
+
Bs as R,
|
|
2725
|
+
js as S,
|
|
2726
|
+
Zs as T,
|
|
2727
|
+
ua as Z,
|
|
2728
|
+
qs as a,
|
|
2729
|
+
Js as b,
|
|
2730
|
+
Ko as c,
|
|
2731
|
+
wt as d,
|
|
2732
|
+
ln as e,
|
|
2733
|
+
nn as f,
|
|
2734
|
+
Vr as g,
|
|
2735
|
+
rn as h,
|
|
2736
|
+
Ur as i,
|
|
2737
|
+
on as j,
|
|
2738
|
+
qr as k,
|
|
2739
|
+
an as l,
|
|
2740
|
+
sn as m,
|
|
2741
|
+
Zr as n,
|
|
2742
|
+
cn as o,
|
|
2743
|
+
Br as p,
|
|
2744
|
+
bt as q,
|
|
2745
|
+
bo as r,
|
|
2746
|
+
So as s,
|
|
2747
|
+
Ro as t,
|
|
2748
|
+
oe as u,
|
|
2749
|
+
qo as v,
|
|
2750
|
+
An as w,
|
|
2751
|
+
aa as x,
|
|
2752
|
+
da as y,
|
|
2753
|
+
ma as z
|
|
2754
|
+
};
|