@pdf-viewer/react 1.8.0-beta.0 → 1.8.0-beta.1

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