@pdf-viewer/react 1.6.0-beta.8 → 1.6.0-rc.0

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