@react-pdf-kit/viewer 2.0.0-beta.1 → 2.0.0-beta.3

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