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

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