@pdf-viewer/react 1.9.1-rc.1 → 1.9.1-rc.3

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