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