@pdf-viewer/react 1.8.0-beta.3 → 1.8.0-beta.5

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