pdf-tsx 0.10.0 → 0.12.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 (86) hide show
  1. package/README.md +51 -4
  2. package/dist/cjs/components/PDFViewer.cjs +1 -1
  3. package/dist/cjs/components/PDFViewer.module.cjs +1 -1
  4. package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
  5. package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
  6. package/dist/cjs/components/features/PDFAttachments.cjs +1 -1
  7. package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
  8. package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
  9. package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
  10. package/dist/cjs/components/features/PDFNavigation.module.cjs +1 -1
  11. package/dist/cjs/components/features/PDFOutline.cjs +1 -1
  12. package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
  13. package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
  14. package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
  15. package/dist/cjs/components/features/PDFSearch.cjs +1 -1
  16. package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -1
  17. package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
  18. package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
  19. package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
  20. package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
  21. package/dist/cjs/components/ui/PDFToolbar.cjs +1 -1
  22. package/dist/cjs/components/ui/PDFToolbarSeparator.cjs +1 -0
  23. package/dist/cjs/components/ui/PDFToolbarSeparator.module.cjs +1 -0
  24. package/dist/cjs/context/LabelsContext.cjs +1 -0
  25. package/dist/cjs/context/labelsContextValue.cjs +1 -0
  26. package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
  27. package/dist/cjs/hooks/useAnnotations.cjs +1 -1
  28. package/dist/cjs/hooks/useLabels.cjs +1 -0
  29. package/dist/cjs/hooks/usePDFLoader.cjs +1 -1
  30. package/dist/cjs/index.cjs +1 -1
  31. package/dist/cjs/labels.cjs +1 -0
  32. package/dist/cjs/pdf-tsx.css +1 -1
  33. package/dist/cjs/theme.cjs +1 -1
  34. package/dist/components/PDFViewer.d.ts +1 -0
  35. package/dist/components/features/PDFChangeFile.d.ts +1 -1
  36. package/dist/components/features/PDFDownloadButton.d.ts +1 -1
  37. package/dist/components/features/PDFNavigation.d.ts +1 -1
  38. package/dist/components/features/PDFPageFit.d.ts +1 -1
  39. package/dist/components/features/PDFPrintButton.d.ts +1 -1
  40. package/dist/components/features/PDFRotationControl.d.ts +1 -1
  41. package/dist/components/features/PDFSearch.d.ts +3 -2
  42. package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
  43. package/dist/components/features/PDFThemeToggle.d.ts +1 -1
  44. package/dist/components/features/PDFZoomControls.d.ts +1 -1
  45. package/dist/components/ui/PDFToolbarSeparator.d.ts +1 -0
  46. package/dist/context/LabelsContext.d.ts +7 -0
  47. package/dist/context/labelsContextValue.d.ts +2 -0
  48. package/dist/es/components/PDFViewer.js +311 -193
  49. package/dist/es/components/PDFViewer.module.js +21 -15
  50. package/dist/es/components/features/PDFAnnotations.js +132 -62
  51. package/dist/es/components/features/PDFAnnotations.module.js +12 -12
  52. package/dist/es/components/features/PDFAttachments.js +42 -41
  53. package/dist/es/components/features/PDFChangeFile.js +17 -16
  54. package/dist/es/components/features/PDFDownloadButton.js +15 -14
  55. package/dist/es/components/features/PDFNavigation.js +39 -38
  56. package/dist/es/components/features/PDFNavigation.module.js +3 -3
  57. package/dist/es/components/features/PDFOutline.js +46 -45
  58. package/dist/es/components/features/PDFPageFit.js +19 -18
  59. package/dist/es/components/features/PDFPrintButton.js +14 -13
  60. package/dist/es/components/features/PDFRotationControl.js +12 -11
  61. package/dist/es/components/features/PDFSearch.js +71 -55
  62. package/dist/es/components/features/PDFSidebarToggle.js +13 -12
  63. package/dist/es/components/features/PDFSignatures.js +87 -84
  64. package/dist/es/components/features/PDFThemeToggle.js +12 -11
  65. package/dist/es/components/features/PDFThumbnails.js +33 -32
  66. package/dist/es/components/features/PDFZoomControls.js +23 -22
  67. package/dist/es/components/ui/PDFToolbar.js +56 -55
  68. package/dist/es/components/ui/PDFToolbarSeparator.js +13 -0
  69. package/dist/es/components/ui/PDFToolbarSeparator.module.js +3 -0
  70. package/dist/es/context/LabelsContext.js +14 -0
  71. package/dist/es/context/labelsContextValue.js +5 -0
  72. package/dist/es/hooks/useAnnotationLayer.js +37 -20
  73. package/dist/es/hooks/useAnnotations.js +5 -3
  74. package/dist/es/hooks/useLabels.js +9 -0
  75. package/dist/es/hooks/usePDFLoader.js +6 -2
  76. package/dist/es/index.js +22 -20
  77. package/dist/es/labels.js +124 -0
  78. package/dist/es/pdf-tsx.css +1 -1
  79. package/dist/es/theme.js +6 -3
  80. package/dist/hooks/useAnnotationLayer.d.ts +15 -1
  81. package/dist/hooks/useLabels.d.ts +2 -0
  82. package/dist/hooks/usePDFLoader.d.ts +1 -0
  83. package/dist/index.d.ts +3 -0
  84. package/dist/labels.d.ts +51 -0
  85. package/dist/theme.d.ts +1 -0
  86. package/package.json +2 -1
@@ -4,6 +4,6 @@ interface PDFDownloadButtonProps {
4
4
  }
5
5
  export declare function PDFDownloadButton({ icon }: PDFDownloadButtonProps): import("react/jsx-runtime").JSX.Element;
6
6
  export declare namespace PDFDownloadButton {
7
- var toolbarLabel: string;
7
+ var toolbarLabelKey: "downloadToolbarLabel";
8
8
  }
9
9
  export {};
@@ -5,6 +5,6 @@ interface PDFNavigationProps {
5
5
  }
6
6
  export declare function PDFNavigation({ prevIcon, nextIcon }: PDFNavigationProps): import("react/jsx-runtime").JSX.Element;
7
7
  export declare namespace PDFNavigation {
8
- var toolbarLabel: string;
8
+ var toolbarLabelKey: "navigationToolbarLabel";
9
9
  }
10
10
  export {};
@@ -5,6 +5,6 @@ interface PDFPageFitProps {
5
5
  }
6
6
  export declare function PDFPageFit({ fitWidthIcon, fitPageIcon }: PDFPageFitProps): import("react/jsx-runtime").JSX.Element;
7
7
  export declare namespace PDFPageFit {
8
- var toolbarLabel: string;
8
+ var toolbarLabelKey: "fitToolbarLabel";
9
9
  }
10
10
  export {};
@@ -4,6 +4,6 @@ interface PDFPrintButtonProps {
4
4
  }
5
5
  export declare function PDFPrintButton({ icon }: PDFPrintButtonProps): import("react/jsx-runtime").JSX.Element;
6
6
  export declare namespace PDFPrintButton {
7
- var toolbarLabel: string;
7
+ var toolbarLabelKey: "printToolbarLabel";
8
8
  }
9
9
  export {};
@@ -4,6 +4,6 @@ interface PDFRotationControlProps {
4
4
  }
5
5
  export declare function PDFRotationControl({ icon }: PDFRotationControlProps): import("react/jsx-runtime").JSX.Element;
6
6
  export declare namespace PDFRotationControl {
7
- var toolbarLabel: string;
7
+ var toolbarLabelKey: "rotateToolbarLabel";
8
8
  }
9
9
  export {};
@@ -4,9 +4,10 @@ interface PDFSearchProps {
4
4
  prevIcon: React.ReactNode;
5
5
  nextIcon: React.ReactNode;
6
6
  clearIcon: React.ReactNode;
7
+ initialSearch?: string;
7
8
  }
8
- export declare function PDFSearch({ searchIcon, prevIcon, nextIcon, clearIcon, }: PDFSearchProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function PDFSearch({ searchIcon, prevIcon, nextIcon, clearIcon, initialSearch, }: PDFSearchProps): import("react/jsx-runtime").JSX.Element;
9
10
  export declare namespace PDFSearch {
10
- var toolbarLabel: string;
11
+ var toolbarLabelKey: "searchToolbarLabel";
11
12
  }
12
13
  export {};
@@ -5,6 +5,6 @@ interface PDFSidebarToggleProps {
5
5
  }
6
6
  export declare function PDFSidebarToggle({ collapseIcon, expandIcon, }: PDFSidebarToggleProps): import("react/jsx-runtime").JSX.Element;
7
7
  export declare namespace PDFSidebarToggle {
8
- var toolbarLabel: string;
8
+ var toolbarLabelKey: "sidebarToolbarLabel";
9
9
  }
10
10
  export {};
@@ -5,6 +5,6 @@ interface PDFThemeToggleProps {
5
5
  }
6
6
  export declare function PDFThemeToggle({ lightIcon, darkIcon }: PDFThemeToggleProps): import("react/jsx-runtime").JSX.Element;
7
7
  export declare namespace PDFThemeToggle {
8
- var toolbarLabel: string;
8
+ var toolbarLabelKey: "themeToolbarLabel";
9
9
  }
10
10
  export {};
@@ -5,6 +5,6 @@ interface PDFZoomControlsProps {
5
5
  }
6
6
  export declare function PDFZoomControls({ zoomOutIcon, zoomInIcon, }: PDFZoomControlsProps): import("react/jsx-runtime").JSX.Element;
7
7
  export declare namespace PDFZoomControls {
8
- var toolbarLabel: string;
8
+ var toolbarLabelKey: "zoomToolbarLabel";
9
9
  }
10
10
  export {};
@@ -0,0 +1 @@
1
+ export declare function PDFToolbarSeparator(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ interface LabelsProviderProps {
3
+ children: ReactNode;
4
+ language?: "it" | "en";
5
+ }
6
+ export declare function LabelsProvider({ children, language }: LabelsProviderProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Labels } from '../labels';
2
+ export declare const LabelsContext: import('react').Context<Labels | null>;
@@ -6,211 +6,329 @@ import { isSafeUrl as i } from "../utils/url.js";
6
6
  import { useAnnotationLayer as a } from "../hooks/useAnnotationLayer.js";
7
7
  import { usePDFLoader as ee } from "../hooks/usePDFLoader.js";
8
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";
9
+ import { useOverlayRects as ne } from "../hooks/useOverlayRects.js";
10
+ import { computeFit as o } from "../utils/pdfFit.js";
11
+ import { ThemeProvider as re } from "../context/ThemeContext.js";
12
+ import { LabelsProvider as ie } from "../context/LabelsContext.js";
13
+ import s from "./PDFViewer.module.js";
14
+ import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
15
+ import * as ae from "pdfjs-dist";
16
+ import { Fragment as oe, jsx as p, jsxs as m } from "react/jsx-runtime";
16
17
  //#region src/components/PDFViewer.tsx
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);
18
+ var h = 2, g = ({ file: g, workerSrc: _, sidebar: se, toolbar: v, onChangeFile: y, themeOverrides: ce, defaultTheme: le, defaultFit: b, language: ue, className: x, style: de }) => {
19
+ l(() => {
20
+ ae.GlobalWorkerOptions.workerSrc = _;
21
+ }, [_]);
22
+ let [S, C] = f(1), [w, T] = f(0), [E, D] = f(null), [O, k] = f([]), [A, fe] = f(!1), [j, M] = f(b ?? null), [N, P] = f(null), F = d(null), I = d([]), L = d([]), R = d(w);
23
+ l(() => {
24
+ R.current = w;
25
+ }, [w]);
26
+ let [z, B] = f(null);
27
+ z !== g && (B(g), D(null));
28
+ let { pdf: V, numPages: H, loading: pe } = ee(g);
29
+ l(() => {
30
+ V && (I.current = Array(V.numPages).fill(null), L.current = Array(V.numPages).fill(null));
31
+ }, [V]), l(() => {
32
+ !V || !b || !F.current || o(b, V, F.current, R.current).then(C);
33
+ }, [V, b]);
34
+ let U = d(j);
35
+ l(() => {
36
+ U.current = j;
37
+ }, [j]), l(() => {
38
+ if (!V || !F.current) return;
39
+ let e = F.current, t = new ResizeObserver(() => {
40
+ U.current && o(U.current, V, e, R.current).then(C);
40
41
  });
41
42
  return t.observe(e), () => t.disconnect();
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);
43
+ }, [V]);
44
+ let { currentPage: W, goToPage: G } = t({
45
+ numPages: H,
46
+ containerRef: F,
47
+ pageRefs: I
48
+ }), K = u(() => {
49
+ if (H === 0) return [];
50
+ let e = /* @__PURE__ */ new Set(), t = Math.max(W - h, 1), n = Math.min(W + h, H);
50
51
  for (let r = t; r <= n; r++) e.add(r);
51
- j && e.add(j.page);
52
- for (let t of N) e.add(t.page);
52
+ E && e.add(E.page);
53
+ for (let t of O) e.add(t.page);
53
54
  return Array.from(e).sort((e, t) => e - t);
54
55
  }, [
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);
56
+ W,
57
+ H,
58
+ E,
59
+ O
60
+ ]), { pageSizes: me, renderedPages: q } = te({
61
+ pdf: V,
62
+ zoom: S,
63
+ rotation: w,
64
+ visiblePages: K,
65
+ canvasRefs: L
66
+ }), J = u(() => {
67
+ let e = new Set(K);
68
+ for (let t of q) e.add(t);
68
69
  return Array.from(e).sort((e, t) => e - t);
69
- }, [X, Z]);
70
+ }, [K, q]);
70
71
  n({
71
- pdf: G,
72
- currentPage: J,
73
- goToPage: Y,
74
- setZoom: O,
75
- setRotation: A,
76
- setFitMode: R
72
+ pdf: V,
73
+ currentPage: W,
74
+ goToPage: G,
75
+ setZoom: C,
76
+ setRotation: T,
77
+ setFitMode: M
77
78
  });
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) => {
79
+ let he = r({
80
+ pdf: V,
81
+ zoom: S,
82
+ rotation: w,
83
+ mountedPages: J,
84
+ canvasRefs: L
85
+ }), { linkOverlays: ge, noteOverlays: _e } = a({
86
+ pdf: V,
87
+ zoom: S,
88
+ rotation: w,
89
+ mountedPages: J,
90
+ goToPage: G
91
+ });
92
+ l(() => {
93
+ if (!N) return;
94
+ let e = () => P(null), t = (e) => {
95
+ e.key === "Escape" && P(null);
96
+ };
97
+ return document.addEventListener("click", e), document.addEventListener("keydown", t), () => {
98
+ document.removeEventListener("click", e), document.removeEventListener("keydown", t);
99
+ };
100
+ }, [N]);
101
+ let { overlayRect: Y, searchOverlays: ve } = ne({
102
+ pdf: V,
103
+ highlight: E,
104
+ searchMatches: O,
105
+ zoom: S,
106
+ rotation: w
107
+ }), ye = c((e, t) => {
97
108
  (!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
109
+ }, []), X = d(null), Z = c((e, t) => {
110
+ X.current && clearTimeout(X.current);
111
+ let n = t.clientY > window.innerHeight * .6;
112
+ P({
113
+ x: Math.min(t.clientX, window.innerWidth - 304),
114
+ y: n ? window.innerHeight - t.clientY + 8 : t.clientY + 12,
115
+ above: n,
116
+ contents: e.contents,
117
+ title: e.title
118
+ });
119
+ }, []), Q = c(() => {
120
+ X.current = setTimeout(() => P(null), 200);
121
+ }, []), $ = c((e) => {
122
+ D({
123
+ page: e.page,
124
+ pdfRect: e.pdfRect
125
+ }), G(e.page);
126
+ }, [D, G]), be = u(() => ({
127
+ pdf: V,
128
+ numPages: H,
129
+ zoom: S,
130
+ setZoom: C,
131
+ rotation: w,
132
+ setRotation: T,
133
+ currentPage: W,
134
+ goToPage: G,
135
+ containerRef: F,
136
+ canvasRefs: L,
137
+ file: g,
138
+ highlight: E,
139
+ setHighlight: D,
140
+ searchMatches: O,
141
+ setSearchMatches: k,
142
+ onChangeFile: y,
143
+ sidebarCollapsed: A,
144
+ setSidebarCollapsed: fe,
145
+ fitMode: j,
146
+ setFitMode: M
119
147
  }), [
120
- G,
121
- K,
122
- D,
123
- k,
124
- J,
125
- Y,
126
- b,
127
- j,
128
- N,
148
+ V,
149
+ H,
150
+ S,
129
151
  w,
130
- F,
131
- L
152
+ W,
153
+ G,
154
+ g,
155
+ E,
156
+ O,
157
+ y,
158
+ A,
159
+ j
132
160
  ]);
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
- })
161
+ return /* @__PURE__ */ p(re, {
162
+ themeOverrides: ce,
163
+ defaultTheme: le,
164
+ children: /* @__PURE__ */ p(ie, {
165
+ language: ue,
166
+ children: /* @__PURE__ */ m(e.Provider, {
167
+ value: be,
168
+ children: [/* @__PURE__ */ m("div", {
169
+ className: `${s.appLayout}${x ? ` ${x}` : ""}`,
170
+ style: de,
171
+ children: [v && /* @__PURE__ */ p("div", {
172
+ className: s.toolbar,
173
+ children: v
174
+ }), /* @__PURE__ */ m("div", {
175
+ className: s.body,
176
+ children: [se, /* @__PURE__ */ m("div", {
177
+ className: s.scrollContainer,
178
+ ref: F,
179
+ children: [pe && /* @__PURE__ */ p("div", { className: s.documentLoading }), Array.from({ length: H }, (e, t) => {
180
+ let n = q.has(t + 1), r = me[t], a = J.includes(t + 1);
181
+ return /* @__PURE__ */ m("div", {
182
+ className: s.pageWrapper,
183
+ ref: (e) => {
184
+ I.current[t] = e;
185
+ },
186
+ style: r ? {
187
+ width: r.width,
188
+ height: r.height
189
+ } : void 0,
190
+ children: [
191
+ r && !n && /* @__PURE__ */ p("div", {
192
+ className: s.pageSkeleton,
193
+ style: {
194
+ width: r.width,
195
+ height: r.height
196
+ }
197
+ }),
198
+ a && /* @__PURE__ */ m(oe, { children: [/* @__PURE__ */ p("canvas", {
199
+ className: s.pageCanvas,
200
+ ref: (e) => {
201
+ L.current[t] = e;
202
+ },
203
+ style: { display: n ? "block" : "none" }
204
+ }), /* @__PURE__ */ p("div", {
205
+ className: `textLayer ${s.textLayer}`,
206
+ ref: (e) => {
207
+ he.current[t] = e;
208
+ }
209
+ })] }),
210
+ ge.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ p("a", {
211
+ className: s.linkOverlay,
212
+ href: e.url && i(e.url) ? e.url : "#",
213
+ target: "_blank",
214
+ rel: "noopener noreferrer",
215
+ style: {
216
+ left: e.x,
217
+ top: e.y,
218
+ width: e.width,
219
+ height: e.height
220
+ },
221
+ onClick: (t) => ye(e, t)
222
+ }, t)),
223
+ _e.filter((e) => e.page === t + 1).map((e, t) => e.subtype === "Text" ? /* @__PURE__ */ p("div", {
224
+ className: s.noteIconOverlay,
225
+ style: {
226
+ left: e.x,
227
+ top: e.y,
228
+ width: Math.max(e.width, 26),
229
+ height: Math.max(e.height, 26)
230
+ },
231
+ onMouseEnter: (t) => Z(e, t),
232
+ onMouseLeave: Q,
233
+ onClick: () => $(e),
234
+ children: /* @__PURE__ */ m("svg", {
235
+ width: "22",
236
+ height: "22",
237
+ viewBox: "0 0 12 12",
238
+ fill: "none",
239
+ "aria-hidden": "true",
240
+ children: [
241
+ /* @__PURE__ */ p("rect", {
242
+ x: "0.5",
243
+ y: "0.5",
244
+ width: "9",
245
+ height: "8",
246
+ rx: "1",
247
+ fill: "rgba(255,210,0,0.9)",
248
+ stroke: "rgba(160,120,0,0.7)",
249
+ strokeWidth: "1"
250
+ }),
251
+ /* @__PURE__ */ p("path", {
252
+ d: "M9.5 5.5v3l2.5-3z",
253
+ fill: "rgba(255,210,0,0.9)",
254
+ stroke: "rgba(160,120,0,0.7)",
255
+ strokeWidth: "1"
256
+ }),
257
+ /* @__PURE__ */ p("line", {
258
+ x1: "2",
259
+ y1: "3",
260
+ x2: "8",
261
+ y2: "3",
262
+ stroke: "rgba(90,60,0,0.8)",
263
+ strokeWidth: "1",
264
+ strokeLinecap: "round"
265
+ }),
266
+ /* @__PURE__ */ p("line", {
267
+ x1: "2",
268
+ y1: "5.5",
269
+ x2: "7",
270
+ y2: "5.5",
271
+ stroke: "rgba(90,60,0,0.8)",
272
+ strokeWidth: "1",
273
+ strokeLinecap: "round"
274
+ })
275
+ ]
276
+ })
277
+ }, t) : /* @__PURE__ */ p("div", {
278
+ className: s.noteOverlay,
279
+ style: {
280
+ left: e.x,
281
+ top: e.y,
282
+ width: e.width,
283
+ height: e.height
284
+ },
285
+ onMouseEnter: (t) => Z(e, t),
286
+ onMouseLeave: Q,
287
+ onClick: () => $(e)
288
+ }, t)),
289
+ ve.filter((e) => e.page === t + 1).map((e, t) => /* @__PURE__ */ p("div", {
290
+ className: s.searchMatchOverlay,
291
+ style: {
292
+ left: e.x,
293
+ top: e.y,
294
+ width: e.width,
295
+ height: e.height
296
+ }
297
+ }, t)),
298
+ E && Y?.page === t + 1 && /* @__PURE__ */ p("div", {
299
+ className: s.highlightOverlay,
300
+ style: {
301
+ left: Y.x,
302
+ top: Y.y,
303
+ width: Y.width,
304
+ height: Y.height
305
+ }
306
+ })
307
+ ]
308
+ }, `${t}-${w}`);
309
+ })]
310
+ })]
311
+ })]
312
+ }), N && /* @__PURE__ */ m("div", {
313
+ className: s.notePopover,
314
+ style: N.above ? {
315
+ left: N.x,
316
+ bottom: N.y
317
+ } : {
318
+ left: N.x,
319
+ top: N.y
320
+ },
321
+ onMouseEnter: () => {
322
+ X.current && clearTimeout(X.current);
323
+ },
324
+ onMouseLeave: Q,
325
+ onClick: (e) => e.stopPropagation(),
326
+ children: [N.title && /* @__PURE__ */ p("div", {
327
+ className: s.notePopoverTitle,
328
+ children: N.title
329
+ }), /* @__PURE__ */ p("p", {
330
+ className: s.notePopoverContent,
331
+ children: N.contents
214
332
  })]
215
333
  })]
216
334
  })
@@ -218,4 +336,4 @@ var y = 2, b = ({ file: b, workerSrc: x, sidebar: S, toolbar: C, onChangeFile: w
218
336
  });
219
337
  };
220
338
  //#endregion
221
- export { b as default };
339
+ export { g as default };