@pdf-viewer/react 1.3.0-beta.2 → 1.3.0-beta.4

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