@pdf-viewer/react 1.9.2-rc.6 → 1.10.0-beta.0

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