@pdf-viewer/react 1.7.0-beta.2 → 1.7.0-beta.4

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