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

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