@pdf-viewer/react 1.15.0-beta.0 → 1.15.0-beta.2

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