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

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