@pdf-viewer/react 0.4.0-beta.2 → 0.5.0-beta.1

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