@pdf-viewer/react 1.1.0-beta.4 → 1.1.0-beta.6

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