@pdf-viewer/react 1.6.0-beta.1 → 1.6.0-beta.3

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