pdf-tsx 0.8.0 → 0.10.0

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 (103) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/components/PDFSidebar.cjs +1 -1
  3. package/dist/cjs/components/PDFSidebar.module.cjs +1 -1
  4. package/dist/cjs/components/PDFViewer.cjs +1 -1
  5. package/dist/cjs/components/PDFViewer.module.cjs +1 -1
  6. package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
  7. package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
  8. package/dist/cjs/components/features/PDFAttachments.cjs +1 -1
  9. package/dist/cjs/components/features/PDFAttachments.module.cjs +1 -1
  10. package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
  11. package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
  12. package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
  13. package/dist/cjs/components/features/PDFNavigation.module.cjs +1 -1
  14. package/dist/cjs/components/features/PDFOutline.cjs +1 -1
  15. package/dist/cjs/components/features/PDFOutline.module.cjs +1 -1
  16. package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
  17. package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
  18. package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
  19. package/dist/cjs/components/features/PDFSearch.cjs +1 -1
  20. package/dist/cjs/components/features/PDFSearch.module.cjs +1 -1
  21. package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -1
  22. package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
  23. package/dist/cjs/components/features/PDFSignatures.module.cjs +1 -1
  24. package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
  25. package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
  26. package/dist/cjs/components/features/PDFThumbnails.module.cjs +1 -1
  27. package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
  28. package/dist/cjs/components/features/PDFZoomControls.module.cjs +1 -1
  29. package/dist/cjs/components/ui/PDFToolbar.cjs +1 -1
  30. package/dist/cjs/components/ui/PDFToolbarDropdownContext.cjs +1 -0
  31. package/dist/cjs/components/ui/PDFToolbarItem.cjs +1 -1
  32. package/dist/cjs/components/ui/ToolbarButton.cjs +1 -1
  33. package/dist/cjs/components/ui/ToolbarButton.module.cjs +1 -1
  34. package/dist/cjs/components/ui/icons.cjs +1 -1
  35. package/dist/cjs/context/ThemeContext.cjs +1 -1
  36. package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
  37. package/dist/cjs/hooks/useKeyboardShortcuts.cjs +1 -1
  38. package/dist/cjs/hooks/useOutline.cjs +1 -1
  39. package/dist/cjs/hooks/useOverlayRects.cjs +1 -1
  40. package/dist/cjs/hooks/usePDFLoader.cjs +1 -1
  41. package/dist/cjs/hooks/useScrollTracking.cjs +1 -1
  42. package/dist/cjs/hooks/useTextLayer.cjs +1 -1
  43. package/dist/cjs/hooks/useTextSearch.cjs +1 -1
  44. package/dist/cjs/hooks/useThumbnails.cjs +1 -1
  45. package/dist/cjs/pdf-tsx.css +1 -1
  46. package/dist/components/features/PDFSearch.d.ts +1 -1
  47. package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
  48. package/dist/components/features/PDFZoomControls.d.ts +1 -1
  49. package/dist/components/ui/PDFToolbar.d.ts +2 -2
  50. package/dist/components/ui/PDFToolbarDropdownContext.d.ts +1 -0
  51. package/dist/context/ThemeContext.d.ts +1 -1
  52. package/dist/es/components/PDFSidebar.js +25 -39
  53. package/dist/es/components/PDFSidebar.module.js +9 -9
  54. package/dist/es/components/PDFViewer.js +210 -234
  55. package/dist/es/components/PDFViewer.module.js +15 -15
  56. package/dist/es/components/features/PDFAnnotations.js +54 -62
  57. package/dist/es/components/features/PDFAnnotations.module.js +12 -12
  58. package/dist/es/components/features/PDFAttachments.js +52 -70
  59. package/dist/es/components/features/PDFAttachments.module.js +8 -8
  60. package/dist/es/components/features/PDFChangeFile.js +13 -24
  61. package/dist/es/components/features/PDFDownloadButton.js +10 -13
  62. package/dist/es/components/features/PDFNavigation.js +38 -59
  63. package/dist/es/components/features/PDFNavigation.module.js +3 -3
  64. package/dist/es/components/features/PDFOutline.js +66 -83
  65. package/dist/es/components/features/PDFOutline.module.js +5 -5
  66. package/dist/es/components/features/PDFPageFit.js +18 -23
  67. package/dist/es/components/features/PDFPrintButton.js +14 -17
  68. package/dist/es/components/features/PDFRotationControl.js +7 -13
  69. package/dist/es/components/features/PDFSearch.js +60 -69
  70. package/dist/es/components/features/PDFSearch.module.js +5 -5
  71. package/dist/es/components/features/PDFSidebarToggle.js +8 -13
  72. package/dist/es/components/features/PDFSignatures.js +116 -139
  73. package/dist/es/components/features/PDFSignatures.module.js +16 -16
  74. package/dist/es/components/features/PDFThemeToggle.js +10 -11
  75. package/dist/es/components/features/PDFThumbnails.js +25 -34
  76. package/dist/es/components/features/PDFThumbnails.module.js +9 -9
  77. package/dist/es/components/features/PDFZoomControls.js +21 -36
  78. package/dist/es/components/features/PDFZoomControls.module.js +1 -1
  79. package/dist/es/components/ui/PDFToolbar.js +33 -32
  80. package/dist/es/components/ui/PDFToolbarDropdownContext.js +5 -0
  81. package/dist/es/components/ui/PDFToolbarItem.js +11 -20
  82. package/dist/es/components/ui/ToolbarButton.js +8 -11
  83. package/dist/es/components/ui/ToolbarButton.module.js +2 -2
  84. package/dist/es/components/ui/icons.js +5 -16
  85. package/dist/es/context/ThemeContext.js +28 -38
  86. package/dist/es/hooks/useAnnotationLayer.js +33 -42
  87. package/dist/es/hooks/useKeyboardShortcuts.js +25 -34
  88. package/dist/es/hooks/useOutline.js +18 -23
  89. package/dist/es/hooks/useOverlayRects.js +42 -51
  90. package/dist/es/hooks/usePDFLoader.js +13 -16
  91. package/dist/es/hooks/useScrollTracking.js +24 -25
  92. package/dist/es/hooks/useTextLayer.js +34 -29
  93. package/dist/es/hooks/useTextSearch.js +31 -38
  94. package/dist/es/hooks/useThumbnails.js +33 -44
  95. package/dist/es/pdf-tsx.css +1 -1
  96. package/dist/hooks/useAttachments.d.ts +1 -1
  97. package/dist/hooks/useOutline.d.ts +1 -1
  98. package/dist/hooks/useOverlayRects.d.ts +1 -1
  99. package/dist/hooks/usePDFRenderer.d.ts +1 -1
  100. package/dist/hooks/useSignatures.d.ts +1 -1
  101. package/dist/hooks/useThumbnails.d.ts +1 -1
  102. package/dist/index.d.ts +3 -3
  103. package/package.json +3 -3
@@ -5,7 +5,7 @@ interface PDFSearchProps {
5
5
  nextIcon: React.ReactNode;
6
6
  clearIcon: React.ReactNode;
7
7
  }
8
- export declare function PDFSearch({ searchIcon, prevIcon, nextIcon, clearIcon }: PDFSearchProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function PDFSearch({ searchIcon, prevIcon, nextIcon, clearIcon, }: PDFSearchProps): import("react/jsx-runtime").JSX.Element;
9
9
  export declare namespace PDFSearch {
10
10
  var toolbarLabel: string;
11
11
  }
@@ -3,7 +3,7 @@ interface PDFSidebarToggleProps {
3
3
  collapseIcon: ReactNode;
4
4
  expandIcon: ReactNode;
5
5
  }
6
- export declare function PDFSidebarToggle({ collapseIcon, expandIcon }: PDFSidebarToggleProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function PDFSidebarToggle({ collapseIcon, expandIcon, }: PDFSidebarToggleProps): import("react/jsx-runtime").JSX.Element;
7
7
  export declare namespace PDFSidebarToggle {
8
8
  var toolbarLabel: string;
9
9
  }
@@ -3,7 +3,7 @@ interface PDFZoomControlsProps {
3
3
  zoomOutIcon: React.ReactNode;
4
4
  zoomInIcon: React.ReactNode;
5
5
  }
6
- export declare function PDFZoomControls({ zoomOutIcon, zoomInIcon }: PDFZoomControlsProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function PDFZoomControls({ zoomOutIcon, zoomInIcon, }: PDFZoomControlsProps): import("react/jsx-runtime").JSX.Element;
7
7
  export declare namespace PDFZoomControls {
8
8
  var toolbarLabel: string;
9
9
  }
@@ -1,8 +1,8 @@
1
1
  import { default as React } from 'react';
2
- export declare const PDFToolbarDropdownContext: React.Context<boolean>;
2
+ import { PDFToolbarDropdownContext } from './PDFToolbarDropdownContext';
3
+ export { PDFToolbarDropdownContext };
3
4
  interface Props {
4
5
  children: React.ReactNode;
5
6
  overflowIcon?: React.ReactNode;
6
7
  }
7
8
  export declare function PDFToolbar({ children, overflowIcon }: Props): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -0,0 +1 @@
1
+ export declare const PDFToolbarDropdownContext: import('react').Context<boolean>;
@@ -8,5 +8,5 @@ interface ThemeProviderProps {
8
8
  };
9
9
  defaultTheme?: "light" | "dark";
10
10
  }
11
- export declare function ThemeProvider({ children, themeOverrides, defaultTheme }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ThemeProvider({ children, themeOverrides, defaultTheme, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
12
12
  export {};
@@ -1,45 +1,31 @@
1
1
  import { usePDFViewer as e } from "../context/PDFViewerContext.js";
2
2
  import t from "./PDFSidebar.module.js";
3
- import { c as n } from "react/compiler-runtime";
4
- import { useState as r } from "react";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
3
+ import { useState as n } from "react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
5
  //#region src/components/PDFSidebar.tsx
7
- function o(o) {
8
- let s = n(14), { panels: c } = o, { sidebarCollapsed: l } = e(), [u, d] = r(null), f;
9
- s[0] === Symbol.for("react.memo_cache_sentinel") ? (f = (e) => d((t) => t === e ? null : e), s[0] = f) : f = s[0];
10
- let p = f;
11
- if (l) return null;
12
- let m;
13
- if (s[1] !== u || s[2] !== c) {
14
- let e;
15
- s[4] === u ? e = s[5] : (e = (e, n) => /* @__PURE__ */ i("button", {
16
- className: `${t.panelButton} ${u === n ? t.panelButtonActive : ""}`,
17
- onClick: () => p(n),
18
- title: e.label,
19
- children: e.icon
20
- }, n), s[4] = u, s[5] = e), m = c.map(e), s[1] = u, s[2] = c, s[3] = m;
21
- } else m = s[3];
22
- let h;
23
- s[6] === m ? h = s[7] : (h = /* @__PURE__ */ i("div", {
24
- className: t.buttonBar,
25
- children: m
26
- }), s[6] = m, s[7] = h);
27
- let g;
28
- s[8] !== u || s[9] !== c ? (g = u !== null && /* @__PURE__ */ a("div", {
29
- className: t.contentPanel,
30
- children: [/* @__PURE__ */ i("div", {
31
- className: t.panelHeader,
32
- children: c[u].label
33
- }), /* @__PURE__ */ i("div", {
34
- className: t.panelBody,
35
- children: c[u].content
36
- })]
37
- }), s[8] = u, s[9] = c, s[10] = g) : g = s[10];
38
- let _;
39
- return s[11] !== h || s[12] !== g ? (_ = /* @__PURE__ */ a("div", {
6
+ function a({ panels: a }) {
7
+ let { sidebarCollapsed: o } = e(), [s, c] = n(null), l = (e) => c((t) => t === e ? null : e);
8
+ return o ? null : /* @__PURE__ */ i("div", {
40
9
  className: t.wrapper,
41
- children: [h, g]
42
- }), s[11] = h, s[12] = g, s[13] = _) : _ = s[13], _;
10
+ children: [/* @__PURE__ */ r("div", {
11
+ className: t.buttonBar,
12
+ children: a.map((e, n) => /* @__PURE__ */ r("button", {
13
+ className: `${t.panelButton} ${s === n ? t.panelButtonActive : ""}`,
14
+ onClick: () => l(n),
15
+ title: e.label,
16
+ children: e.icon
17
+ }, n))
18
+ }), s !== null && /* @__PURE__ */ i("div", {
19
+ className: t.contentPanel,
20
+ children: [/* @__PURE__ */ r("div", {
21
+ className: t.panelHeader,
22
+ children: a[s].label
23
+ }), /* @__PURE__ */ r("div", {
24
+ className: t.panelBody,
25
+ children: a[s].content
26
+ })]
27
+ })]
28
+ });
43
29
  }
44
30
  //#endregion
45
- export { o as PDFSidebar };
31
+ export { a as PDFSidebar };
@@ -1,13 +1,13 @@
1
1
  var e = {
2
- wrapper: "_wrapper_1xud4_1",
3
- wrapperCollapsed: "_wrapperCollapsed_1xud4_13",
4
- buttonBar: "_buttonBar_1xud4_31",
5
- toggleButton: "_toggleButton_1xud4_51",
6
- panelButton: "_panelButton_1xud4_69",
7
- panelButtonActive: "_panelButtonActive_1xud4_109",
8
- contentPanel: "_contentPanel_1xud4_127",
9
- panelHeader: "_panelHeader_1xud4_143",
10
- panelBody: "_panelBody_1xud4_167"
2
+ wrapper: "_wrapper_1kvg0_1",
3
+ wrapperCollapsed: "_wrapperCollapsed_1kvg0_7",
4
+ buttonBar: "_buttonBar_1kvg0_16",
5
+ toggleButton: "_toggleButton_1kvg0_26",
6
+ panelButton: "_panelButton_1kvg0_35",
7
+ panelButtonActive: "_panelButtonActive_1kvg0_57",
8
+ contentPanel: "_contentPanel_1kvg0_66",
9
+ panelHeader: "_panelHeader_1kvg0_74",
10
+ panelBody: "_panelBody_1kvg0_86"
11
11
  };
12
12
  //#endregion
13
13
  export { e as default };
@@ -3,243 +3,219 @@ import { useScrollTracking as t } from "../hooks/useScrollTracking.js";
3
3
  import { useKeyboardShortcuts as n } from "../hooks/useKeyboardShortcuts.js";
4
4
  import { useTextLayer as r } from "../hooks/useTextLayer.js";
5
5
  import { isSafeUrl as i } from "../utils/url.js";
6
- import { useAnnotationLayer as ee } from "../hooks/useAnnotationLayer.js";
7
- import { usePDFLoader as te } from "../hooks/usePDFLoader.js";
8
- import { usePDFRenderer as ne } from "../hooks/usePDFRenderer.js";
9
- import { useOverlayRects as re } from "../hooks/useOverlayRects.js";
10
- import { computeFit as ie } from "../utils/pdfFit.js";
11
- import { ThemeProvider as ae } from "../context/ThemeContext.js";
12
- import a from "./PDFViewer.module.js";
13
- import { c as oe } from "react/compiler-runtime";
14
- import { useEffect as o, useRef as s, useState as c } from "react";
15
- import * as se from "pdfjs-dist";
16
- import { Fragment as ce, jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ import { useAnnotationLayer as a } from "../hooks/useAnnotationLayer.js";
7
+ import { usePDFLoader as ee } from "../hooks/usePDFLoader.js";
8
+ import { usePDFRenderer as te } from "../hooks/usePDFRenderer.js";
9
+ import { useOverlayRects as o } from "../hooks/useOverlayRects.js";
10
+ import { computeFit as s } from "../utils/pdfFit.js";
11
+ import { ThemeProvider as c } from "../context/ThemeContext.js";
12
+ import l from "./PDFViewer.module.js";
13
+ import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
14
+ import * as h from "pdfjs-dist";
15
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
17
16
  //#region src/components/PDFViewer.tsx
18
- var le = 2, d = (i) => {
19
- let d = oe(75), { file: f, workerSrc: p, sidebar: me, toolbar: he, onChangeFile: ge, themeOverrides: _e, defaultTheme: ve, defaultFit: m, className: ye, style: be } = i, h, g;
20
- d[0] === p ? (h = d[1], g = d[2]) : (h = () => {
21
- se.GlobalWorkerOptions.workerSrc = p;
22
- }, g = [p], d[0] = p, d[1] = h, d[2] = g), o(h, g);
23
- let [_, v] = c(1), [y, xe] = c(0), [b, Se] = c(null), x;
24
- d[3] === Symbol.for("react.memo_cache_sentinel") ? (x = [], d[3] = x) : x = d[3];
25
- let [S, Ce] = c(x), [we, Te] = c(!1), [C, Ee] = c(m ?? null), w = s(null), T;
26
- d[4] === Symbol.for("react.memo_cache_sentinel") ? (T = [], d[4] = T) : T = d[4];
27
- let De = s(T), E;
28
- d[5] === Symbol.for("react.memo_cache_sentinel") ? (E = [], d[5] = E) : E = d[5];
29
- let D = s(E), Oe = s(y), O, k;
30
- d[6] === y ? (O = d[7], k = d[8]) : (O = () => {
31
- Oe.current = y;
32
- }, k = [y], d[6] = y, d[7] = O, d[8] = k), o(O, k);
33
- let [ke, Ae] = c(null);
34
- ke !== f && (Ae(f), Se(null));
35
- let { pdf: A, numPages: j } = te(f), M, N;
36
- d[9] === A ? (M = d[10], N = d[11]) : (M = () => {
37
- A && (De.current = Array(A.numPages).fill(null), D.current = Array(A.numPages).fill(null));
38
- }, N = [A], d[9] = A, d[10] = M, d[11] = N), o(M, N);
39
- let P, F;
40
- d[12] !== m || d[13] !== A ? (P = () => {
41
- !A || !m || !w.current || ie(m, A, w.current, Oe.current).then(v);
42
- }, F = [A, m], d[12] = m, d[13] = A, d[14] = P, d[15] = F) : (P = d[14], F = d[15]), o(P, F);
43
- let je = s(C), I, L;
44
- d[16] === C ? (I = d[17], L = d[18]) : (I = () => {
45
- je.current = C;
46
- }, L = [C], d[16] = C, d[17] = I, d[18] = L), o(I, L);
47
- let R, z;
48
- d[19] === A ? (R = d[20], z = d[21]) : (R = () => {
49
- if (!A || !w.current) return;
50
- let e = w.current, t = new ResizeObserver(() => {
51
- je.current && ie(je.current, A, e, Oe.current).then(v);
17
+ var y = 2, b = ({ file: b, workerSrc: x, sidebar: S, toolbar: C, onChangeFile: w, themeOverrides: ne, defaultTheme: re, defaultFit: T, className: E, style: ie }) => {
18
+ d(() => {
19
+ h.GlobalWorkerOptions.workerSrc = x;
20
+ }, [x]);
21
+ let [D, O] = m(1), [k, A] = m(0), [j, M] = m(null), [N, P] = m([]), [F, I] = m(!1), [L, R] = m(T ?? null), z = p(null), B = p([]), V = p([]), H = p(k);
22
+ d(() => {
23
+ H.current = k;
24
+ }, [k]);
25
+ let [U, W] = m(null);
26
+ U !== b && (W(b), M(null));
27
+ let { pdf: G, numPages: K } = ee(b);
28
+ d(() => {
29
+ G && (B.current = Array(G.numPages).fill(null), V.current = Array(G.numPages).fill(null));
30
+ }, [G]), d(() => {
31
+ !G || !T || !z.current || s(T, G, z.current, H.current).then(O);
32
+ }, [G, T]);
33
+ let q = p(L);
34
+ d(() => {
35
+ q.current = L;
36
+ }, [L]), d(() => {
37
+ if (!G || !z.current) return;
38
+ let e = z.current, t = new ResizeObserver(() => {
39
+ q.current && s(q.current, G, e, H.current).then(O);
52
40
  });
53
41
  return t.observe(e), () => t.disconnect();
54
- }, z = [A], d[19] = A, d[20] = R, d[21] = z), o(R, z);
55
- let B;
56
- d[22] === j ? B = d[23] : (B = {
57
- numPages: j,
58
- containerRef: w,
59
- pageRefs: De
60
- }, d[22] = j, d[23] = B);
61
- let { currentPage: V, goToPage: H } = t(B), U;
62
- d[24] !== V || d[25] !== b || d[26] !== j || d[27] !== S ? (U = () => {
63
- if (j === 0) return [];
64
- let e = /* @__PURE__ */ new Set(), t = Math.max(V - le, 1), n = Math.min(V + le, j);
42
+ }, [G]);
43
+ let { currentPage: J, goToPage: Y } = t({
44
+ numPages: K,
45
+ containerRef: z,
46
+ pageRefs: B
47
+ }), X = f(() => {
48
+ if (K === 0) return [];
49
+ let e = /* @__PURE__ */ new Set(), t = Math.max(J - y, 1), n = Math.min(J + y, K);
65
50
  for (let r = t; r <= n; r++) e.add(r);
66
- b && e.add(b.page);
67
- for (let t of S) e.add(t.page);
68
- return Array.from(e).sort(ue);
69
- }, d[24] = V, d[25] = b, d[26] = j, d[27] = S, d[28] = U) : U = d[28];
70
- let Me = U(), { pageSizes: Ne, renderedPages: Pe } = ne({
71
- pdf: A,
72
- zoom: _,
73
- rotation: y,
74
- visiblePages: Me,
75
- canvasRefs: D
76
- }), Fe = (() => {
77
- let e = new Set(Me);
78
- for (let t of Pe) e.add(t);
79
- return Array.from(e).sort(de);
80
- })(), W;
81
- d[29] !== V || d[30] !== H || d[31] !== A ? (W = {
82
- pdf: A,
83
- currentPage: V,
84
- goToPage: H,
85
- setZoom: v,
86
- setRotation: xe,
87
- setFitMode: Ee
88
- }, d[29] = V, d[30] = H, d[31] = A, d[32] = W) : W = d[32], n(W);
89
- let Ie = r({
90
- pdf: A,
91
- zoom: _,
92
- rotation: y,
93
- mountedPages: Fe,
94
- canvasRefs: D
95
- }), Le = ee({
96
- pdf: A,
97
- zoom: _,
98
- rotation: y,
99
- mountedPages: Fe,
100
- goToPage: H
101
- }), G;
102
- d[33] !== b || d[34] !== A || d[35] !== y || d[36] !== S || d[37] !== _ ? (G = {
103
- pdf: A,
104
- highlight: b,
105
- searchMatches: S,
106
- zoom: _,
107
- rotation: y
108
- }, d[33] = b, d[34] = A, d[35] = y, d[36] = S, d[37] = _, d[38] = G) : G = d[38];
109
- let { overlayRect: K, searchOverlays: Re } = re(G), ze = ae, Be = e, q;
110
- d[39] !== V || d[40] !== f || d[41] !== C || d[42] !== H || d[43] !== b || d[44] !== j || d[45] !== ge || d[46] !== A || d[47] !== y || d[48] !== S || d[49] !== we || d[50] !== _ ? (q = {
111
- pdf: A,
112
- numPages: j,
113
- zoom: _,
114
- setZoom: v,
115
- rotation: y,
116
- setRotation: xe,
117
- currentPage: V,
118
- goToPage: H,
119
- containerRef: w,
120
- canvasRefs: D,
121
- file: f,
122
- highlight: b,
123
- setHighlight: Se,
124
- searchMatches: S,
125
- setSearchMatches: Ce,
126
- onChangeFile: ge,
127
- sidebarCollapsed: we,
128
- setSidebarCollapsed: Te,
129
- fitMode: C,
130
- setFitMode: Ee
131
- }, d[39] = V, d[40] = f, d[41] = C, d[42] = H, d[43] = b, d[44] = j, d[45] = ge, d[46] = A, d[47] = y, d[48] = S, d[49] = we, d[50] = _, d[51] = q) : q = d[51];
132
- let Ve = `${a.appLayout}${ye ? ` ${ye}` : ""}`, J;
133
- d[52] === he ? J = d[53] : (J = he && /* @__PURE__ */ l("div", {
134
- className: a.toolbar,
135
- children: he
136
- }), d[52] = he, d[53] = J);
137
- let He = a, Ue = a, We = Array.from({ length: j }, (e, t) => {
138
- let n = Pe.has(t + 1), r = Ne[t], i = Fe.includes(t + 1);
139
- return /* @__PURE__ */ u("div", {
140
- className: a.pageWrapper,
141
- ref: (e) => {
142
- De.current[t] = e;
143
- },
144
- style: r ? {
145
- width: r.width,
146
- height: r.height
147
- } : void 0,
148
- children: [
149
- r && !n && /* @__PURE__ */ l("div", {
150
- className: a.pageSkeleton,
151
- style: {
152
- width: r.width,
153
- height: r.height
154
- }
155
- }),
156
- i && /* @__PURE__ */ u(ce, { children: [/* @__PURE__ */ l("canvas", {
157
- className: a.pageCanvas,
158
- ref: (e) => {
159
- D.current[t] = e;
160
- },
161
- style: { display: n ? "block" : "none" }
162
- }), /* @__PURE__ */ l("div", {
163
- className: `textLayer ${a.textLayer}`,
164
- ref: (e) => {
165
- Ie.current[t] = e;
166
- }
167
- })] }),
168
- Le.filter((e) => e.page === t + 1).map(fe),
169
- Re.filter((e) => e.page === t + 1).map(pe),
170
- b && K?.page === t + 1 && /* @__PURE__ */ l("div", {
171
- className: a.highlightOverlay,
172
- style: {
173
- left: K.x,
174
- top: K.y,
175
- width: K.width,
176
- height: K.height
177
- }
178
- })
179
- ]
180
- }, `${t}-${y}`);
181
- }), Y;
182
- d[54] !== Ue.scrollContainer || d[55] !== We ? (Y = /* @__PURE__ */ l("div", {
183
- className: Ue.scrollContainer,
184
- ref: w,
185
- children: We
186
- }), d[54] = Ue.scrollContainer, d[55] = We, d[56] = Y) : Y = d[56];
187
- let X;
188
- d[57] !== me || d[58] !== He.body || d[59] !== Y ? (X = /* @__PURE__ */ u("div", {
189
- className: He.body,
190
- children: [me, Y]
191
- }), d[57] = me, d[58] = He.body, d[59] = Y, d[60] = X) : X = d[60];
192
- let Z;
193
- d[61] !== be || d[62] !== Ve || d[63] !== J || d[64] !== X ? (Z = /* @__PURE__ */ u("div", {
194
- className: Ve,
195
- style: be,
196
- children: [J, X]
197
- }), d[61] = be, d[62] = Ve, d[63] = J, d[64] = X, d[65] = Z) : Z = d[65];
198
- let Q;
199
- d[66] !== Be.Provider || d[67] !== q || d[68] !== Z ? (Q = /* @__PURE__ */ l(Be.Provider, {
200
- value: q,
201
- children: Z
202
- }), d[66] = Be.Provider, d[67] = q, d[68] = Z, d[69] = Q) : Q = d[69];
203
- let $;
204
- return d[70] !== ze || d[71] !== ve || d[72] !== Q || d[73] !== _e ? ($ = /* @__PURE__ */ l(ze, {
205
- themeOverrides: _e,
206
- defaultTheme: ve,
207
- children: Q
208
- }), d[70] = ze, d[71] = ve, d[72] = Q, d[73] = _e, d[74] = $) : $ = d[74], $;
51
+ j && e.add(j.page);
52
+ for (let t of N) e.add(t.page);
53
+ return Array.from(e).sort((e, t) => e - t);
54
+ }, [
55
+ J,
56
+ K,
57
+ j,
58
+ N
59
+ ]), { pageSizes: ae, renderedPages: Z } = te({
60
+ pdf: G,
61
+ zoom: D,
62
+ rotation: k,
63
+ visiblePages: X,
64
+ canvasRefs: V
65
+ }), Q = f(() => {
66
+ let e = new Set(X);
67
+ for (let t of Z) e.add(t);
68
+ return Array.from(e).sort((e, t) => e - t);
69
+ }, [X, Z]);
70
+ n({
71
+ pdf: G,
72
+ currentPage: J,
73
+ goToPage: Y,
74
+ setZoom: O,
75
+ setRotation: A,
76
+ setFitMode: R
77
+ });
78
+ let oe = r({
79
+ pdf: G,
80
+ zoom: D,
81
+ rotation: k,
82
+ mountedPages: Q,
83
+ canvasRefs: V
84
+ }), se = a({
85
+ pdf: G,
86
+ zoom: D,
87
+ rotation: k,
88
+ mountedPages: Q,
89
+ goToPage: Y
90
+ }), { overlayRect: $, searchOverlays: ce } = o({
91
+ pdf: G,
92
+ highlight: j,
93
+ searchMatches: N,
94
+ zoom: D,
95
+ rotation: k
96
+ }), le = u((e, t) => {
97
+ (!e.url || !i(e.url)) && (t.preventDefault(), e.url || e._handleClick());
98
+ }, []), ue = f(() => ({
99
+ pdf: G,
100
+ numPages: K,
101
+ zoom: D,
102
+ setZoom: O,
103
+ rotation: k,
104
+ setRotation: A,
105
+ currentPage: J,
106
+ goToPage: Y,
107
+ containerRef: z,
108
+ canvasRefs: V,
109
+ file: b,
110
+ highlight: j,
111
+ setHighlight: M,
112
+ searchMatches: N,
113
+ setSearchMatches: P,
114
+ onChangeFile: w,
115
+ sidebarCollapsed: F,
116
+ setSidebarCollapsed: I,
117
+ fitMode: L,
118
+ setFitMode: R
119
+ }), [
120
+ G,
121
+ K,
122
+ D,
123
+ k,
124
+ J,
125
+ Y,
126
+ b,
127
+ j,
128
+ N,
129
+ w,
130
+ F,
131
+ L
132
+ ]);
133
+ return /* @__PURE__ */ _(c, {
134
+ themeOverrides: ne,
135
+ defaultTheme: re,
136
+ children: /* @__PURE__ */ _(e.Provider, {
137
+ value: ue,
138
+ children: /* @__PURE__ */ v("div", {
139
+ className: `${l.appLayout}${E ? ` ${E}` : ""}`,
140
+ style: ie,
141
+ children: [C && /* @__PURE__ */ _("div", {
142
+ className: l.toolbar,
143
+ children: C
144
+ }), /* @__PURE__ */ v("div", {
145
+ className: l.body,
146
+ children: [S, /* @__PURE__ */ _("div", {
147
+ className: l.scrollContainer,
148
+ ref: z,
149
+ children: Array.from({ length: K }, (e, t) => {
150
+ let n = Z.has(t + 1), r = ae[t], a = Q.includes(t + 1);
151
+ return /* @__PURE__ */ v("div", {
152
+ className: l.pageWrapper,
153
+ ref: (e) => {
154
+ B.current[t] = e;
155
+ },
156
+ style: r ? {
157
+ width: r.width,
158
+ height: r.height
159
+ } : void 0,
160
+ children: [
161
+ r && !n && /* @__PURE__ */ _("div", {
162
+ className: l.pageSkeleton,
163
+ style: {
164
+ width: r.width,
165
+ height: r.height
166
+ }
167
+ }),
168
+ a && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("canvas", {
169
+ className: l.pageCanvas,
170
+ ref: (e) => {
171
+ V.current[t] = e;
172
+ },
173
+ style: { display: n ? "block" : "none" }
174
+ }), /* @__PURE__ */ _("div", {
175
+ className: `textLayer ${l.textLayer}`,
176
+ ref: (e) => {
177
+ oe.current[t] = e;
178
+ }
179
+ })] }),
180
+ se.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ _("a", {
181
+ className: l.linkOverlay,
182
+ href: e.url && i(e.url) ? e.url : "#",
183
+ target: "_blank",
184
+ rel: "noopener noreferrer",
185
+ style: {
186
+ left: e.x,
187
+ top: e.y,
188
+ width: e.width,
189
+ height: e.height
190
+ },
191
+ onClick: (t) => le(e, t)
192
+ }, t)),
193
+ ce.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ _("div", {
194
+ className: l.searchMatchOverlay,
195
+ style: {
196
+ left: e.x,
197
+ top: e.y,
198
+ width: e.width,
199
+ height: e.height
200
+ }
201
+ }, t)),
202
+ j && $?.page === t + 1 && /* @__PURE__ */ _("div", {
203
+ className: l.highlightOverlay,
204
+ style: {
205
+ left: $.x,
206
+ top: $.y,
207
+ width: $.width,
208
+ height: $.height
209
+ }
210
+ })
211
+ ]
212
+ }, `${t}-${k}`);
213
+ })
214
+ })]
215
+ })]
216
+ })
217
+ })
218
+ });
209
219
  };
210
- function ue(e, t) {
211
- return e - t;
212
- }
213
- function de(e, t) {
214
- return e - t;
215
- }
216
- function fe(e, t) {
217
- return /* @__PURE__ */ l("a", {
218
- className: a.linkOverlay,
219
- href: e.url && i(e.url) ? e.url : "#",
220
- target: "_blank",
221
- rel: "noopener noreferrer",
222
- style: {
223
- left: e.x,
224
- top: e.y,
225
- width: e.width,
226
- height: e.height
227
- },
228
- onClick: (t) => {
229
- (!e.url || !i(e.url)) && (t.preventDefault(), e.url || e._handleClick());
230
- }
231
- }, t);
232
- }
233
- function pe(e, t) {
234
- return /* @__PURE__ */ l("div", {
235
- className: a.searchMatchOverlay,
236
- style: {
237
- left: e.x,
238
- top: e.y,
239
- width: e.width,
240
- height: e.height
241
- }
242
- }, t);
243
- }
244
220
  //#endregion
245
- export { d as default };
221
+ export { b as default };
@@ -1,19 +1,19 @@
1
1
  var e = {
2
- appLayout: "_appLayout_1t51x_1",
3
- body: "_body_1t51x_17",
4
- toolbar: "_toolbar_1t51x_33",
5
- scrollContainer: "_scrollContainer_1t51x_57",
6
- pageWrapper: "_pageWrapper_1t51x_77",
7
- pageCanvas: "_pageCanvas_1t51x_87",
8
- textLayer: "_textLayer_1t51x_105",
9
- markedContent: "_markedContent_1t51x_157",
10
- endOfContent: "_endOfContent_1t51x_187",
11
- selecting: "_selecting_1t51x_205",
12
- pageSkeleton: "_pageSkeleton_1t51x_245",
13
- spin: "_spin_1t51x_1",
14
- highlightOverlay: "_highlightOverlay_1t51x_299",
15
- linkOverlay: "_linkOverlay_1t51x_317",
16
- searchMatchOverlay: "_searchMatchOverlay_1t51x_331"
2
+ appLayout: "_appLayout_1nhg3_1",
3
+ body: "_body_1nhg3_9",
4
+ toolbar: "_toolbar_1nhg3_17",
5
+ scrollContainer: "_scrollContainer_1nhg3_29",
6
+ pageWrapper: "_pageWrapper_1nhg3_39",
7
+ pageCanvas: "_pageCanvas_1nhg3_44",
8
+ textLayer: "_textLayer_1nhg3_53",
9
+ markedContent: "_markedContent_1nhg3_79",
10
+ endOfContent: "_endOfContent_1nhg3_94",
11
+ selecting: "_selecting_1nhg3_103",
12
+ pageSkeleton: "_pageSkeleton_1nhg3_123",
13
+ spin: "_spin_1nhg3_1",
14
+ highlightOverlay: "_highlightOverlay_1nhg3_152",
15
+ linkOverlay: "_linkOverlay_1nhg3_161",
16
+ searchMatchOverlay: "_searchMatchOverlay_1nhg3_168"
17
17
  };
18
18
  //#endregion
19
19
  export { e as default };