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