@pdf-viewer/react 1.1.0-beta.2 → 1.1.0-beta.3

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