@pdf-viewer/react 1.1.1 → 1.2.0-beta.0

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