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

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