@pdf-viewer/react 1.0.1 → 1.1.0-beta.1

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