@pdf-viewer/react 1.3.0 → 1.4.0-beta.1

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