@cannyminds/dms-file-viewers 0.3.0 → 0.5.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.
- package/dist/{chunk-FZYMVHF6.mjs → chunk-4DJJINTB.mjs} +54 -55
- package/dist/chunk-4DJJINTB.mjs.map +1 -0
- package/dist/chunk-677DWENS.mjs +133 -0
- package/dist/chunk-677DWENS.mjs.map +1 -0
- package/dist/{chunk-GNWU6XHH.js → chunk-6ZBHO5SP.js} +15 -9
- package/dist/{chunk-GNWU6XHH.js.map → chunk-6ZBHO5SP.js.map} +1 -1
- package/dist/chunk-77UARJVQ.js +133 -0
- package/dist/chunk-77UARJVQ.js.map +1 -0
- package/dist/{chunk-LKBM4O47.mjs → chunk-7BLEPGZ4.mjs} +67 -61
- package/dist/chunk-7BLEPGZ4.mjs.map +1 -0
- package/dist/{chunk-QRYIHDRT.mjs → chunk-BHMFZTZ7.mjs} +54 -55
- package/dist/chunk-BHMFZTZ7.mjs.map +1 -0
- package/dist/{chunk-EMP7RZM2.js → chunk-DOOYIHGW.js} +52 -53
- package/dist/chunk-DOOYIHGW.js.map +1 -0
- package/dist/{chunk-73ZIFR3P.mjs → chunk-K5SKH4SD.mjs} +798 -466
- package/dist/chunk-K5SKH4SD.mjs.map +1 -0
- package/dist/{chunk-3STHCDAC.js → chunk-QELOFQEB.js} +757 -425
- package/dist/chunk-QELOFQEB.js.map +1 -0
- package/dist/{chunk-BNHQYEZ7.js → chunk-SBEFC7HP.js} +203 -158
- package/dist/chunk-SBEFC7HP.js.map +1 -0
- package/dist/{chunk-4RL77HKO.js → chunk-SNEIVT4R.js} +52 -53
- package/dist/chunk-SNEIVT4R.js.map +1 -0
- package/dist/{chunk-XQBXRMB7.mjs → chunk-UX6U3H7J.mjs} +14 -8
- package/dist/chunk-UX6U3H7J.mjs.map +1 -0
- package/dist/{chunk-7JTIG6OU.js → chunk-WP55NYFS.js} +67 -61
- package/dist/chunk-WP55NYFS.js.map +1 -0
- package/dist/{chunk-NOLXOOIP.mjs → chunk-YHMHDPLQ.mjs} +200 -155
- package/dist/chunk-YHMHDPLQ.mjs.map +1 -0
- package/dist/components/viewers/AudioViewer.d.mts +1 -1
- package/dist/components/viewers/AudioViewer.d.ts +1 -1
- package/dist/components/viewers/AudioViewer.js +2 -2
- package/dist/components/viewers/AudioViewer.mjs +1 -1
- package/dist/components/viewers/DefaultViewer.d.mts +1 -1
- package/dist/components/viewers/DefaultViewer.d.ts +1 -1
- package/dist/components/viewers/DefaultViewer.js +3 -2
- package/dist/components/viewers/DefaultViewer.js.map +1 -1
- package/dist/components/viewers/DefaultViewer.mjs +2 -1
- package/dist/components/viewers/ImageViewer.d.mts +1 -1
- package/dist/components/viewers/ImageViewer.d.ts +1 -1
- package/dist/components/viewers/ImageViewer.js +3 -3
- package/dist/components/viewers/ImageViewer.mjs +2 -2
- package/dist/components/viewers/PDFViewer.d.mts +1 -1
- package/dist/components/viewers/PDFViewer.d.ts +1 -1
- package/dist/components/viewers/PDFViewer.js +2 -2
- package/dist/components/viewers/PDFViewer.mjs +1 -1
- package/dist/components/viewers/TIFFViewer.d.mts +1 -1
- package/dist/components/viewers/TIFFViewer.d.ts +1 -1
- package/dist/components/viewers/TIFFViewer.js +2 -2
- package/dist/components/viewers/TIFFViewer.mjs +1 -1
- package/dist/components/viewers/TextViewer.d.mts +1 -1
- package/dist/components/viewers/TextViewer.d.ts +1 -1
- package/dist/components/viewers/TextViewer.js +2 -2
- package/dist/components/viewers/TextViewer.mjs +1 -1
- package/dist/components/viewers/VideoViewer.d.mts +1 -1
- package/dist/components/viewers/VideoViewer.d.ts +1 -1
- package/dist/components/viewers/VideoViewer.js +2 -2
- package/dist/components/viewers/VideoViewer.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +30 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{types-CquKzJLE.d.mts → types-C6IEfcTM.d.mts} +13 -1
- package/dist/{types-CquKzJLE.d.ts → types-C6IEfcTM.d.ts} +13 -1
- package/package.json +1 -1
- package/dist/chunk-3STHCDAC.js.map +0 -1
- package/dist/chunk-4RL77HKO.js.map +0 -1
- package/dist/chunk-73ZIFR3P.mjs.map +0 -1
- package/dist/chunk-7JTIG6OU.js.map +0 -1
- package/dist/chunk-BNHQYEZ7.js.map +0 -1
- package/dist/chunk-EMP7RZM2.js.map +0 -1
- package/dist/chunk-FZYMVHF6.mjs.map +0 -1
- package/dist/chunk-LKBM4O47.mjs.map +0 -1
- package/dist/chunk-NOLXOOIP.mjs.map +0 -1
- package/dist/chunk-QLJKOQTP.mjs +0 -78
- package/dist/chunk-QLJKOQTP.mjs.map +0 -1
- package/dist/chunk-QRYIHDRT.mjs.map +0 -1
- package/dist/chunk-XQBXRMB7.mjs.map +0 -1
- package/dist/chunk-Z7FUO5RX.js +0 -78
- package/dist/chunk-Z7FUO5RX.js.map +0 -1
|
@@ -5,8 +5,31 @@ import {
|
|
|
5
5
|
} from "./chunk-QQDQJ7TS.mjs";
|
|
6
6
|
|
|
7
7
|
// src/components/viewers/PDFViewer.tsx
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import { useCallback, useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3, forwardRef, useImperativeHandle } from "react";
|
|
9
|
+
|
|
10
|
+
// src/components/viewers/pdf/StablePDFViewer.tsx
|
|
11
|
+
import React from "react";
|
|
12
|
+
import { PDFViewer as HeadlessPDFViewerImport } from "@cannyminds/pdf-viewer";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var HeadlessPDFViewer = HeadlessPDFViewerImport;
|
|
15
|
+
var StablePDFViewer = React.memo(({
|
|
16
|
+
pdfBuffer,
|
|
17
|
+
onPasswordRequest,
|
|
18
|
+
pdfViewerRef
|
|
19
|
+
}) => {
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
HeadlessPDFViewer,
|
|
22
|
+
{
|
|
23
|
+
ref: pdfViewerRef,
|
|
24
|
+
pdfBuffer,
|
|
25
|
+
onPasswordRequest
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
StablePDFViewer.displayName = "StablePDFViewer";
|
|
30
|
+
|
|
31
|
+
// src/components/viewers/pdf/PDFToolbar.tsx
|
|
32
|
+
import React2 from "react";
|
|
10
33
|
import FirstPageIcon from "@mui/icons-material/FirstPage";
|
|
11
34
|
import LastPageIcon from "@mui/icons-material/LastPage";
|
|
12
35
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
@@ -15,14 +38,222 @@ import ZoomInIcon from "@mui/icons-material/ZoomIn";
|
|
|
15
38
|
import ZoomOutIcon from "@mui/icons-material/ZoomOut";
|
|
16
39
|
import FitScreenIcon from "@mui/icons-material/FitScreen";
|
|
17
40
|
import AspectRatioIcon from "@mui/icons-material/AspectRatio";
|
|
18
|
-
import
|
|
41
|
+
import SearchIcon from "@mui/icons-material/Search";
|
|
19
42
|
import DownloadIcon from "@mui/icons-material/Download";
|
|
20
43
|
import PrintIcon from "@mui/icons-material/Print";
|
|
21
44
|
import InfoIcon from "@mui/icons-material/Info";
|
|
22
45
|
import DescriptionIcon from "@mui/icons-material/Description";
|
|
46
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
47
|
+
var PDFToolbar = React2.memo(({
|
|
48
|
+
currentPage,
|
|
49
|
+
totalPages,
|
|
50
|
+
zoom,
|
|
51
|
+
isSidebarOpen,
|
|
52
|
+
showPageNavigation,
|
|
53
|
+
showPageCount,
|
|
54
|
+
showZoomControls,
|
|
55
|
+
showSearch,
|
|
56
|
+
showMetadata,
|
|
57
|
+
showProperties,
|
|
58
|
+
showDownload,
|
|
59
|
+
showPrint,
|
|
60
|
+
onFirstPage,
|
|
61
|
+
onPreviousPage,
|
|
62
|
+
onNextPage,
|
|
63
|
+
onLastPage,
|
|
64
|
+
onPageInput,
|
|
65
|
+
onPageInputKeyPress,
|
|
66
|
+
onZoomIn,
|
|
67
|
+
onZoomOut,
|
|
68
|
+
onFitToWidth,
|
|
69
|
+
onFitToPage,
|
|
70
|
+
onToggleSidebar,
|
|
71
|
+
onDownloadClick,
|
|
72
|
+
onPrintClick,
|
|
73
|
+
onMetadataClick,
|
|
74
|
+
onPropertiesClick
|
|
75
|
+
}) => {
|
|
76
|
+
return /* @__PURE__ */ jsxs("div", { className: "pdf-viewer-toolbar", children: [
|
|
77
|
+
showPageNavigation && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
79
|
+
/* @__PURE__ */ jsxs("div", { className: "toolbar-section", children: [
|
|
80
|
+
/* @__PURE__ */ jsx2(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
className: "toolbar-button",
|
|
84
|
+
onClick: onFirstPage,
|
|
85
|
+
disabled: currentPage <= 1,
|
|
86
|
+
title: "First Page",
|
|
87
|
+
children: /* @__PURE__ */ jsx2(FirstPageIcon, { fontSize: "small" })
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsx2(
|
|
91
|
+
"button",
|
|
92
|
+
{
|
|
93
|
+
className: "toolbar-button",
|
|
94
|
+
onClick: onPreviousPage,
|
|
95
|
+
disabled: currentPage <= 1,
|
|
96
|
+
title: "Previous Page",
|
|
97
|
+
children: /* @__PURE__ */ jsx2(ChevronLeftIcon, { fontSize: "small" })
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ jsx2(
|
|
101
|
+
"input",
|
|
102
|
+
{
|
|
103
|
+
type: "number",
|
|
104
|
+
className: "page-input",
|
|
105
|
+
value: currentPage,
|
|
106
|
+
onChange: onPageInput,
|
|
107
|
+
onKeyPress: onPageInputKeyPress,
|
|
108
|
+
min: 1,
|
|
109
|
+
max: totalPages || void 0
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
showPageCount && /* @__PURE__ */ jsxs("span", { className: "page-info", children: [
|
|
113
|
+
"of ",
|
|
114
|
+
totalPages || "..."
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ jsx2(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
className: "toolbar-button",
|
|
120
|
+
onClick: onNextPage,
|
|
121
|
+
disabled: currentPage >= totalPages,
|
|
122
|
+
title: "Next Page",
|
|
123
|
+
children: /* @__PURE__ */ jsx2(ChevronRightIcon, { fontSize: "small" })
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx2(
|
|
127
|
+
"button",
|
|
128
|
+
{
|
|
129
|
+
className: "toolbar-button",
|
|
130
|
+
onClick: onLastPage,
|
|
131
|
+
disabled: currentPage >= totalPages,
|
|
132
|
+
title: "Last Page",
|
|
133
|
+
children: /* @__PURE__ */ jsx2(LastPageIcon, { fontSize: "small" })
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] })
|
|
137
|
+
] }),
|
|
138
|
+
showZoomControls && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
139
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
140
|
+
/* @__PURE__ */ jsxs("div", { className: "toolbar-section", children: [
|
|
141
|
+
/* @__PURE__ */ jsx2(
|
|
142
|
+
"button",
|
|
143
|
+
{
|
|
144
|
+
className: "toolbar-button",
|
|
145
|
+
onClick: onZoomOut,
|
|
146
|
+
title: "Zoom Out",
|
|
147
|
+
children: /* @__PURE__ */ jsx2(ZoomOutIcon, { fontSize: "small" })
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsxs("span", { className: "zoom-display", children: [
|
|
151
|
+
zoom,
|
|
152
|
+
"%"
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsx2(
|
|
155
|
+
"button",
|
|
156
|
+
{
|
|
157
|
+
className: "toolbar-button",
|
|
158
|
+
onClick: onZoomIn,
|
|
159
|
+
title: "Zoom In",
|
|
160
|
+
children: /* @__PURE__ */ jsx2(ZoomInIcon, { fontSize: "small" })
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ jsx2(
|
|
164
|
+
"button",
|
|
165
|
+
{
|
|
166
|
+
className: "toolbar-button",
|
|
167
|
+
onClick: onFitToWidth,
|
|
168
|
+
title: "Fit to Width",
|
|
169
|
+
children: /* @__PURE__ */ jsx2(AspectRatioIcon, { fontSize: "small" })
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ jsx2(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
className: "toolbar-button",
|
|
176
|
+
onClick: onFitToPage,
|
|
177
|
+
title: "Fit to Page",
|
|
178
|
+
children: /* @__PURE__ */ jsx2(FitScreenIcon, { fontSize: "small" })
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] })
|
|
182
|
+
] }),
|
|
183
|
+
showSearch && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
184
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
185
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-section", children: /* @__PURE__ */ jsx2(
|
|
186
|
+
"button",
|
|
187
|
+
{
|
|
188
|
+
className: "toolbar-button",
|
|
189
|
+
onClick: onToggleSidebar,
|
|
190
|
+
title: "Search in PDF",
|
|
191
|
+
style: {
|
|
192
|
+
backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
|
|
193
|
+
color: isSidebarOpen ? "#1976d2" : "inherit"
|
|
194
|
+
},
|
|
195
|
+
children: /* @__PURE__ */ jsx2(SearchIcon, { fontSize: "small" })
|
|
196
|
+
}
|
|
197
|
+
) })
|
|
198
|
+
] }),
|
|
199
|
+
(showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
200
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
201
|
+
/* @__PURE__ */ jsxs("div", { className: "toolbar-section", children: [
|
|
202
|
+
showDownload && /* @__PURE__ */ jsx2(
|
|
203
|
+
"button",
|
|
204
|
+
{
|
|
205
|
+
className: "toolbar-button",
|
|
206
|
+
onClick: onDownloadClick,
|
|
207
|
+
title: "Download PDF",
|
|
208
|
+
children: /* @__PURE__ */ jsx2(DownloadIcon, { fontSize: "small" })
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
showPrint && /* @__PURE__ */ jsx2(
|
|
212
|
+
"button",
|
|
213
|
+
{
|
|
214
|
+
className: "toolbar-button",
|
|
215
|
+
onClick: onPrintClick,
|
|
216
|
+
title: "Print PDF",
|
|
217
|
+
children: /* @__PURE__ */ jsx2(PrintIcon, { fontSize: "small" })
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
showMetadata && /* @__PURE__ */ jsx2(
|
|
221
|
+
"button",
|
|
222
|
+
{
|
|
223
|
+
className: "toolbar-button",
|
|
224
|
+
onClick: onMetadataClick,
|
|
225
|
+
title: "Document Metadata",
|
|
226
|
+
children: /* @__PURE__ */ jsx2(InfoIcon, { fontSize: "small" })
|
|
227
|
+
}
|
|
228
|
+
),
|
|
229
|
+
showProperties && /* @__PURE__ */ jsx2(
|
|
230
|
+
"button",
|
|
231
|
+
{
|
|
232
|
+
className: "toolbar-button",
|
|
233
|
+
onClick: onPropertiesClick,
|
|
234
|
+
title: "Document Properties",
|
|
235
|
+
children: /* @__PURE__ */ jsx2(DescriptionIcon, { fontSize: "small" })
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
] })
|
|
239
|
+
] })
|
|
240
|
+
] });
|
|
241
|
+
});
|
|
242
|
+
PDFToolbar.displayName = "PDFToolbar";
|
|
243
|
+
|
|
244
|
+
// src/components/viewers/pdf/PDFHeader.tsx
|
|
245
|
+
import React3 from "react";
|
|
246
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
247
|
+
var PDFHeader = React3.memo(({ fileName, fileExtension }) => {
|
|
248
|
+
return /* @__PURE__ */ jsxs2("div", { className: "pdf-viewer-header", children: [
|
|
249
|
+
/* @__PURE__ */ jsx3(FileIcon_default, { ext: fileExtension, size: 26 }),
|
|
250
|
+
/* @__PURE__ */ jsx3("div", { className: "header-file-name", title: fileName, children: fileName })
|
|
251
|
+
] });
|
|
252
|
+
});
|
|
253
|
+
PDFHeader.displayName = "PDFHeader";
|
|
23
254
|
|
|
24
255
|
// src/components/viewers/pdf/SearchSidebar.tsx
|
|
25
|
-
import { useState, useLayoutEffect, useRef } from "react";
|
|
256
|
+
import { useState, useLayoutEffect, useEffect, useRef } from "react";
|
|
26
257
|
import {
|
|
27
258
|
Box,
|
|
28
259
|
Typography,
|
|
@@ -31,13 +262,13 @@ import {
|
|
|
31
262
|
InputAdornment,
|
|
32
263
|
Divider
|
|
33
264
|
} from "@mui/material";
|
|
34
|
-
import
|
|
265
|
+
import SearchIcon2 from "@mui/icons-material/Search";
|
|
35
266
|
import CloseIcon from "@mui/icons-material/Close";
|
|
36
267
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
37
268
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
38
269
|
import ClearIcon from "@mui/icons-material/Clear";
|
|
39
270
|
import FindInPageIcon from "@mui/icons-material/FindInPage";
|
|
40
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
271
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
41
272
|
var SearchSidebar = ({
|
|
42
273
|
isOpen,
|
|
43
274
|
onClose,
|
|
@@ -49,11 +280,17 @@ var SearchSidebar = ({
|
|
|
49
280
|
totalResults,
|
|
50
281
|
searchKeyword,
|
|
51
282
|
searchResults = [],
|
|
52
|
-
isSearching = false
|
|
283
|
+
isSearching = false,
|
|
284
|
+
isSyntheticResults = false
|
|
53
285
|
}) => {
|
|
54
286
|
const [searchTerm, setSearchTerm] = useState(searchKeyword || "");
|
|
55
287
|
const [hasSearched, setHasSearched] = useState(false);
|
|
56
288
|
const contentRef = useRef(null);
|
|
289
|
+
useEffect(() => {
|
|
290
|
+
if (searchKeyword && searchKeyword !== searchTerm) {
|
|
291
|
+
setSearchTerm(searchKeyword);
|
|
292
|
+
}
|
|
293
|
+
}, [searchKeyword]);
|
|
57
294
|
useLayoutEffect(() => {
|
|
58
295
|
const element = contentRef.current;
|
|
59
296
|
if (!element) return;
|
|
@@ -89,20 +326,29 @@ var SearchSidebar = ({
|
|
|
89
326
|
background-color: transparent;
|
|
90
327
|
}
|
|
91
328
|
.search-sidebar-content::-webkit-scrollbar-thumb {
|
|
92
|
-
background-color: rgba(
|
|
329
|
+
background-color: rgba(128, 128, 128, 0.3);
|
|
93
330
|
border-radius: 8px;
|
|
94
331
|
border: 4px solid transparent;
|
|
95
332
|
background-clip: padding-box;
|
|
96
333
|
transition: all 0.15s ease;
|
|
97
334
|
}
|
|
98
335
|
.search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
|
|
99
|
-
background-color: rgba(
|
|
336
|
+
background-color: rgba(128, 128, 128, 0.5);
|
|
100
337
|
border: 2px solid transparent;
|
|
101
338
|
}
|
|
102
339
|
.search-sidebar-content::-webkit-scrollbar-thumb:active {
|
|
103
|
-
background-color: rgba(25, 118, 210, 0.
|
|
340
|
+
background-color: rgba(25, 118, 210, 0.8);
|
|
104
341
|
border: 1px solid transparent;
|
|
105
342
|
}
|
|
343
|
+
|
|
344
|
+
@media (prefers-color-scheme: dark) {
|
|
345
|
+
.search-sidebar-content::-webkit-scrollbar-thumb {
|
|
346
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
347
|
+
}
|
|
348
|
+
.search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
|
|
349
|
+
background-color: rgba(255, 255, 255, 0.35);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
106
352
|
|
|
107
353
|
/* Tamil font support for search results */
|
|
108
354
|
.search-result-text {
|
|
@@ -157,7 +403,7 @@ var SearchSidebar = ({
|
|
|
157
403
|
const regex = new RegExp(`(${escapedKeyword})`, "gi");
|
|
158
404
|
const parts = textString.split(regex);
|
|
159
405
|
return parts.map(
|
|
160
|
-
(part, index) => regex.test(part) ? /* @__PURE__ */
|
|
406
|
+
(part, index) => regex.test(part) ? /* @__PURE__ */ jsx4(
|
|
161
407
|
Box,
|
|
162
408
|
{
|
|
163
409
|
component: "span",
|
|
@@ -176,7 +422,7 @@ var SearchSidebar = ({
|
|
|
176
422
|
}
|
|
177
423
|
};
|
|
178
424
|
if (!isOpen) return null;
|
|
179
|
-
return /* @__PURE__ */
|
|
425
|
+
return /* @__PURE__ */ jsxs3(
|
|
180
426
|
Box,
|
|
181
427
|
{
|
|
182
428
|
sx: {
|
|
@@ -190,10 +436,10 @@ var SearchSidebar = ({
|
|
|
190
436
|
overflow: "hidden"
|
|
191
437
|
},
|
|
192
438
|
children: [
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ jsxs3(Box, { sx: { px: 3, py: 2.5, backgroundColor: "background.default" }, children: [
|
|
440
|
+
/* @__PURE__ */ jsxs3(Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
|
|
441
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "h6", sx: { fontSize: "1.125rem", fontWeight: 600, color: "text.primary" }, children: "Search" }),
|
|
442
|
+
/* @__PURE__ */ jsx4(
|
|
197
443
|
IconButton,
|
|
198
444
|
{
|
|
199
445
|
size: "small",
|
|
@@ -202,11 +448,11 @@ var SearchSidebar = ({
|
|
|
202
448
|
color: "text.secondary",
|
|
203
449
|
padding: "6px"
|
|
204
450
|
},
|
|
205
|
-
children: /* @__PURE__ */
|
|
451
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { fontSize: "small" })
|
|
206
452
|
}
|
|
207
453
|
)
|
|
208
454
|
] }),
|
|
209
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ jsx4("form", { onSubmit: handleSearchSubmit, children: /* @__PURE__ */ jsx4(
|
|
210
456
|
TextField,
|
|
211
457
|
{
|
|
212
458
|
fullWidth: true,
|
|
@@ -216,8 +462,8 @@ var SearchSidebar = ({
|
|
|
216
462
|
onChange: handleSearchChange,
|
|
217
463
|
autoComplete: "off",
|
|
218
464
|
InputProps: {
|
|
219
|
-
startAdornment: /* @__PURE__ */
|
|
220
|
-
endAdornment: searchTerm && /* @__PURE__ */
|
|
465
|
+
startAdornment: /* @__PURE__ */ jsx4(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx4(SearchIcon2, { sx: { color: "text.disabled", fontSize: 20 } }) }),
|
|
466
|
+
endAdornment: searchTerm && /* @__PURE__ */ jsx4(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx4(
|
|
221
467
|
IconButton,
|
|
222
468
|
{
|
|
223
469
|
size: "small",
|
|
@@ -229,7 +475,7 @@ var SearchSidebar = ({
|
|
|
229
475
|
backgroundColor: "action.hover"
|
|
230
476
|
}
|
|
231
477
|
},
|
|
232
|
-
children: /* @__PURE__ */
|
|
478
|
+
children: /* @__PURE__ */ jsx4(ClearIcon, { sx: { fontSize: 18 } })
|
|
233
479
|
}
|
|
234
480
|
) })
|
|
235
481
|
},
|
|
@@ -252,7 +498,7 @@ var SearchSidebar = ({
|
|
|
252
498
|
}
|
|
253
499
|
}
|
|
254
500
|
) }),
|
|
255
|
-
totalResults > 0 && /* @__PURE__ */
|
|
501
|
+
totalResults > 0 && /* @__PURE__ */ jsxs3(
|
|
256
502
|
Box,
|
|
257
503
|
{
|
|
258
504
|
sx: {
|
|
@@ -265,14 +511,14 @@ var SearchSidebar = ({
|
|
|
265
511
|
borderColor: "divider"
|
|
266
512
|
},
|
|
267
513
|
children: [
|
|
268
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ jsxs3(Typography, { variant: "body2", sx: { color: "text.secondary", fontSize: "0.875rem", fontWeight: 500 }, children: [
|
|
269
515
|
currentResultIndex + 1,
|
|
270
516
|
" of ",
|
|
271
517
|
totalResults,
|
|
272
518
|
" results"
|
|
273
519
|
] }),
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ jsxs3(Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
521
|
+
/* @__PURE__ */ jsx4(
|
|
276
522
|
IconButton,
|
|
277
523
|
{
|
|
278
524
|
size: "small",
|
|
@@ -285,10 +531,10 @@ var SearchSidebar = ({
|
|
|
285
531
|
border: "1px solid",
|
|
286
532
|
borderColor: currentResultIndex <= 0 ? "divider" : "primary.main"
|
|
287
533
|
},
|
|
288
|
-
children: /* @__PURE__ */
|
|
534
|
+
children: /* @__PURE__ */ jsx4(KeyboardArrowUpIcon, { sx: { fontSize: 20 } })
|
|
289
535
|
}
|
|
290
536
|
),
|
|
291
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ jsx4(
|
|
292
538
|
IconButton,
|
|
293
539
|
{
|
|
294
540
|
size: "small",
|
|
@@ -301,7 +547,7 @@ var SearchSidebar = ({
|
|
|
301
547
|
border: "1px solid",
|
|
302
548
|
borderColor: currentResultIndex >= totalResults - 1 ? "divider" : "primary.main"
|
|
303
549
|
},
|
|
304
|
-
children: /* @__PURE__ */
|
|
550
|
+
children: /* @__PURE__ */ jsx4(KeyboardArrowDownIcon, { sx: { fontSize: 20 } })
|
|
305
551
|
}
|
|
306
552
|
)
|
|
307
553
|
] })
|
|
@@ -309,14 +555,14 @@ var SearchSidebar = ({
|
|
|
309
555
|
}
|
|
310
556
|
)
|
|
311
557
|
] }),
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
/* @__PURE__ */
|
|
558
|
+
/* @__PURE__ */ jsx4(Divider, {}),
|
|
559
|
+
/* @__PURE__ */ jsxs3(Box, { ref: contentRef, className: "search-sidebar-content", sx: {
|
|
314
560
|
flex: 1,
|
|
315
561
|
overflow: "auto",
|
|
316
562
|
backgroundColor: "background.default"
|
|
317
563
|
}, children: [
|
|
318
|
-
!searchTerm && !hasSearched && /* @__PURE__ */
|
|
319
|
-
/* @__PURE__ */
|
|
564
|
+
!searchTerm && !hasSearched && /* @__PURE__ */ jsxs3(Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
565
|
+
/* @__PURE__ */ jsx4(
|
|
320
566
|
Box,
|
|
321
567
|
{
|
|
322
568
|
sx: {
|
|
@@ -330,43 +576,45 @@ var SearchSidebar = ({
|
|
|
330
576
|
margin: "0 auto",
|
|
331
577
|
mb: 3
|
|
332
578
|
},
|
|
333
|
-
children: /* @__PURE__ */
|
|
579
|
+
children: /* @__PURE__ */ jsx4(SearchIcon2, { sx: { fontSize: 40, color: "text.disabled" } })
|
|
334
580
|
}
|
|
335
581
|
),
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
582
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Search in Document" }),
|
|
583
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: "Enter keywords to find text within the PDF document" })
|
|
338
584
|
] }),
|
|
339
|
-
searchTerm && !hasSearched && /* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
585
|
+
searchTerm && !hasSearched && /* @__PURE__ */ jsxs3(Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
586
|
+
/* @__PURE__ */ jsx4(
|
|
341
587
|
Box,
|
|
342
588
|
{
|
|
343
589
|
sx: {
|
|
344
590
|
width: 80,
|
|
345
591
|
height: 80,
|
|
346
592
|
borderRadius: "50%",
|
|
347
|
-
backgroundColor: "
|
|
593
|
+
backgroundColor: "primary.light",
|
|
348
594
|
display: "flex",
|
|
349
595
|
alignItems: "center",
|
|
350
596
|
justifyContent: "center",
|
|
351
597
|
margin: "0 auto",
|
|
352
|
-
mb: 3
|
|
598
|
+
mb: 3,
|
|
599
|
+
opacity: 0.2
|
|
353
600
|
},
|
|
354
|
-
children: /* @__PURE__ */
|
|
601
|
+
children: /* @__PURE__ */ jsx4(FindInPageIcon, { sx: { fontSize: 40, color: "primary.main" } })
|
|
355
602
|
}
|
|
356
603
|
),
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Ready to Search" }),
|
|
605
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body2", sx: { color: "text.secondary", mb: 2, lineHeight: 1.6 }, children: "Press Enter to find" }),
|
|
606
|
+
/* @__PURE__ */ jsxs3(
|
|
360
607
|
Typography,
|
|
361
608
|
{
|
|
362
609
|
variant: "body2",
|
|
363
610
|
sx: {
|
|
364
|
-
color: "
|
|
611
|
+
color: "white",
|
|
365
612
|
fontWeight: 600,
|
|
366
|
-
backgroundColor: "
|
|
613
|
+
backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(144, 202, 249, 0.16)" : "primary.light",
|
|
367
614
|
padding: "6px 16px",
|
|
368
615
|
borderRadius: "16px",
|
|
369
|
-
display: "inline-block"
|
|
616
|
+
display: "inline-block",
|
|
617
|
+
opacity: 0.9
|
|
370
618
|
},
|
|
371
619
|
children: [
|
|
372
620
|
'"',
|
|
@@ -376,38 +624,40 @@ var SearchSidebar = ({
|
|
|
376
624
|
}
|
|
377
625
|
)
|
|
378
626
|
] }),
|
|
379
|
-
hasSearched && totalResults === 0 && !isSearching && /* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */
|
|
627
|
+
hasSearched && totalResults === 0 && !isSearching && /* @__PURE__ */ jsxs3(Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
628
|
+
/* @__PURE__ */ jsx4(
|
|
381
629
|
Box,
|
|
382
630
|
{
|
|
383
631
|
sx: {
|
|
384
632
|
width: 80,
|
|
385
633
|
height: 80,
|
|
386
634
|
borderRadius: "50%",
|
|
387
|
-
backgroundColor: "
|
|
635
|
+
backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(255, 152, 0, 0.12)" : "warning.light",
|
|
388
636
|
display: "flex",
|
|
389
637
|
alignItems: "center",
|
|
390
638
|
justifyContent: "center",
|
|
391
639
|
margin: "0 auto",
|
|
392
|
-
mb: 3
|
|
640
|
+
mb: 3,
|
|
641
|
+
opacity: 0.6
|
|
393
642
|
},
|
|
394
|
-
children: /* @__PURE__ */
|
|
643
|
+
children: /* @__PURE__ */ jsx4(SearchIcon2, { sx: { fontSize: 40, color: "warning.main" } })
|
|
395
644
|
}
|
|
396
645
|
),
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "No Results Found" }),
|
|
647
|
+
/* @__PURE__ */ jsxs3(Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
|
|
399
648
|
"No matches found for ",
|
|
400
|
-
/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ jsxs3("strong", { children: [
|
|
401
650
|
'"',
|
|
402
651
|
searchTerm,
|
|
403
652
|
'"'
|
|
404
653
|
] })
|
|
405
654
|
] })
|
|
406
655
|
] }),
|
|
407
|
-
totalResults > 0 && /* @__PURE__ */
|
|
656
|
+
totalResults > 0 && /* @__PURE__ */ jsx4(Box, { sx: { p: 2 }, children: Object.keys(resultsByPage).sort((a, b) => parseInt(a) - parseInt(b)).map((pageNum) => {
|
|
408
657
|
const pageNumber = parseInt(pageNum);
|
|
409
|
-
|
|
410
|
-
|
|
658
|
+
const pageResults = resultsByPage[pageNumber];
|
|
659
|
+
return /* @__PURE__ */ jsxs3(Box, { sx: { mb: 3 }, children: [
|
|
660
|
+
/* @__PURE__ */ jsxs3(
|
|
411
661
|
Typography,
|
|
412
662
|
{
|
|
413
663
|
variant: "subtitle2",
|
|
@@ -426,7 +676,7 @@ var SearchSidebar = ({
|
|
|
426
676
|
]
|
|
427
677
|
}
|
|
428
678
|
),
|
|
429
|
-
pageResults.map((result, index) => /* @__PURE__ */
|
|
679
|
+
pageResults.map((result, index) => /* @__PURE__ */ jsx4(
|
|
430
680
|
Box,
|
|
431
681
|
{
|
|
432
682
|
onClick: () => onSearchResultClick(result.pageNumber, result.index),
|
|
@@ -435,19 +685,19 @@ var SearchSidebar = ({
|
|
|
435
685
|
mx: 1,
|
|
436
686
|
mb: 1.5,
|
|
437
687
|
borderRadius: "8px",
|
|
438
|
-
border: "
|
|
688
|
+
border: "2px solid",
|
|
439
689
|
borderColor: result.index === currentResultIndex ? "primary.main" : "divider",
|
|
440
|
-
backgroundColor:
|
|
690
|
+
backgroundColor: "background.paper",
|
|
441
691
|
cursor: "pointer",
|
|
442
692
|
transition: "all 0.2s ease",
|
|
443
|
-
boxShadow:
|
|
693
|
+
boxShadow: (theme) => theme.palette.mode === "dark" ? "0 1px 3px rgba(0, 0, 0, 0.3)" : "0 1px 3px rgba(0, 0, 0, 0.05)",
|
|
444
694
|
"&:hover": {
|
|
445
695
|
borderColor: "primary.main",
|
|
446
|
-
boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
|
|
696
|
+
boxShadow: (theme) => theme.palette.mode === "dark" ? "0 2px 8px rgba(255, 255, 255, 0.15)" : "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
447
697
|
transform: "translateY(-1px)"
|
|
448
698
|
}
|
|
449
699
|
},
|
|
450
|
-
children: /* @__PURE__ */
|
|
700
|
+
children: /* @__PURE__ */ jsx4(
|
|
451
701
|
Typography,
|
|
452
702
|
{
|
|
453
703
|
variant: "body2",
|
|
@@ -471,18 +721,188 @@ var SearchSidebar = ({
|
|
|
471
721
|
);
|
|
472
722
|
};
|
|
473
723
|
|
|
474
|
-
// src/components/viewers/
|
|
475
|
-
import {
|
|
724
|
+
// src/components/viewers/pdf/PasswordDialog.tsx
|
|
725
|
+
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
726
|
+
import {
|
|
727
|
+
Dialog,
|
|
728
|
+
DialogTitle,
|
|
729
|
+
DialogContent,
|
|
730
|
+
DialogActions,
|
|
731
|
+
TextField as TextField2,
|
|
732
|
+
Button,
|
|
733
|
+
Typography as Typography2,
|
|
734
|
+
IconButton as IconButton2,
|
|
735
|
+
InputAdornment as InputAdornment2,
|
|
736
|
+
Box as Box2,
|
|
737
|
+
Alert
|
|
738
|
+
} from "@mui/material";
|
|
739
|
+
import CloseIcon2 from "@mui/icons-material/Close";
|
|
740
|
+
import LockIcon from "@mui/icons-material/Lock";
|
|
741
|
+
import VisibilityIcon from "@mui/icons-material/Visibility";
|
|
742
|
+
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
|
743
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
744
|
+
var PasswordDialog = ({
|
|
745
|
+
open,
|
|
746
|
+
fileName,
|
|
747
|
+
onSubmit,
|
|
748
|
+
onCancel,
|
|
749
|
+
error
|
|
750
|
+
}) => {
|
|
751
|
+
const [password, setPassword] = useState2("");
|
|
752
|
+
const [showPassword, setShowPassword] = useState2(false);
|
|
753
|
+
useEffect2(() => {
|
|
754
|
+
if (open) {
|
|
755
|
+
setPassword("");
|
|
756
|
+
setShowPassword(false);
|
|
757
|
+
}
|
|
758
|
+
}, [open]);
|
|
759
|
+
const handleSubmit = (e) => {
|
|
760
|
+
e.preventDefault();
|
|
761
|
+
if (password.trim()) {
|
|
762
|
+
onSubmit(password);
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
const handleTogglePasswordVisibility = () => {
|
|
766
|
+
setShowPassword(!showPassword);
|
|
767
|
+
};
|
|
768
|
+
const handleKeyPress = (e) => {
|
|
769
|
+
if (e.key === "Enter" && password.trim()) {
|
|
770
|
+
handleSubmit(e);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
return /* @__PURE__ */ jsxs4(
|
|
774
|
+
Dialog,
|
|
775
|
+
{
|
|
776
|
+
open,
|
|
777
|
+
onClose: onCancel,
|
|
778
|
+
maxWidth: "sm",
|
|
779
|
+
fullWidth: true,
|
|
780
|
+
PaperProps: {
|
|
781
|
+
sx: {
|
|
782
|
+
borderRadius: 2
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
children: [
|
|
786
|
+
/* @__PURE__ */ jsx5(DialogTitle, { sx: { pb: 1 }, children: /* @__PURE__ */ jsxs4(Box2, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
787
|
+
/* @__PURE__ */ jsxs4(Box2, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
|
|
788
|
+
/* @__PURE__ */ jsx5(
|
|
789
|
+
Box2,
|
|
790
|
+
{
|
|
791
|
+
sx: {
|
|
792
|
+
width: 40,
|
|
793
|
+
height: 40,
|
|
794
|
+
borderRadius: "50%",
|
|
795
|
+
backgroundColor: "primary.light",
|
|
796
|
+
display: "flex",
|
|
797
|
+
alignItems: "center",
|
|
798
|
+
justifyContent: "center",
|
|
799
|
+
opacity: 0.9
|
|
800
|
+
},
|
|
801
|
+
children: /* @__PURE__ */ jsx5(LockIcon, { sx: { color: "white", fontSize: 20 } })
|
|
802
|
+
}
|
|
803
|
+
),
|
|
804
|
+
/* @__PURE__ */ jsx5(Typography2, { variant: "h6", component: "div", sx: { fontWeight: 600 }, children: "Password Protected" })
|
|
805
|
+
] }),
|
|
806
|
+
/* @__PURE__ */ jsx5(
|
|
807
|
+
IconButton2,
|
|
808
|
+
{
|
|
809
|
+
size: "small",
|
|
810
|
+
onClick: onCancel,
|
|
811
|
+
sx: { color: "text.secondary" },
|
|
812
|
+
"aria-label": "Close dialog",
|
|
813
|
+
children: /* @__PURE__ */ jsx5(CloseIcon2, { fontSize: "small" })
|
|
814
|
+
}
|
|
815
|
+
)
|
|
816
|
+
] }) }),
|
|
817
|
+
/* @__PURE__ */ jsxs4(DialogContent, { sx: { pt: 2 }, children: [
|
|
818
|
+
/* @__PURE__ */ jsxs4(Typography2, { variant: "body2", sx: { color: "text.secondary", mb: 3 }, children: [
|
|
819
|
+
"This PDF is password protected. Please enter the password to view",
|
|
820
|
+
" ",
|
|
821
|
+
fileName && /* @__PURE__ */ jsxs4("strong", { children: [
|
|
822
|
+
'"',
|
|
823
|
+
fileName,
|
|
824
|
+
'"'
|
|
825
|
+
] })
|
|
826
|
+
] }),
|
|
827
|
+
error && /* @__PURE__ */ jsx5(Alert, { severity: "error", sx: { mb: 2 }, children: error }),
|
|
828
|
+
/* @__PURE__ */ jsx5("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsx5(
|
|
829
|
+
TextField2,
|
|
830
|
+
{
|
|
831
|
+
fullWidth: true,
|
|
832
|
+
autoFocus: true,
|
|
833
|
+
type: showPassword ? "text" : "password",
|
|
834
|
+
label: "Password",
|
|
835
|
+
placeholder: "Enter password",
|
|
836
|
+
value: password,
|
|
837
|
+
onChange: (e) => setPassword(e.target.value),
|
|
838
|
+
onKeyPress: handleKeyPress,
|
|
839
|
+
error: Boolean(error),
|
|
840
|
+
InputProps: {
|
|
841
|
+
endAdornment: /* @__PURE__ */ jsx5(InputAdornment2, { position: "end", children: /* @__PURE__ */ jsx5(
|
|
842
|
+
IconButton2,
|
|
843
|
+
{
|
|
844
|
+
onClick: handleTogglePasswordVisibility,
|
|
845
|
+
edge: "end",
|
|
846
|
+
size: "small",
|
|
847
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
848
|
+
children: showPassword ? /* @__PURE__ */ jsx5(VisibilityOffIcon, {}) : /* @__PURE__ */ jsx5(VisibilityIcon, {})
|
|
849
|
+
}
|
|
850
|
+
) })
|
|
851
|
+
},
|
|
852
|
+
sx: {
|
|
853
|
+
"& .MuiOutlinedInput-root": {
|
|
854
|
+
borderRadius: 2
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
) })
|
|
859
|
+
] }),
|
|
860
|
+
/* @__PURE__ */ jsxs4(DialogActions, { sx: { px: 3, pb: 3, pt: 2 }, children: [
|
|
861
|
+
/* @__PURE__ */ jsx5(
|
|
862
|
+
Button,
|
|
863
|
+
{
|
|
864
|
+
onClick: onCancel,
|
|
865
|
+
variant: "outlined",
|
|
866
|
+
sx: {
|
|
867
|
+
borderRadius: 2,
|
|
868
|
+
textTransform: "none",
|
|
869
|
+
px: 3
|
|
870
|
+
},
|
|
871
|
+
children: "Cancel"
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
/* @__PURE__ */ jsx5(
|
|
875
|
+
Button,
|
|
876
|
+
{
|
|
877
|
+
onClick: handleSubmit,
|
|
878
|
+
variant: "contained",
|
|
879
|
+
disabled: !password.trim(),
|
|
880
|
+
sx: {
|
|
881
|
+
borderRadius: 2,
|
|
882
|
+
textTransform: "none",
|
|
883
|
+
px: 3,
|
|
884
|
+
boxShadow: 2
|
|
885
|
+
},
|
|
886
|
+
children: "Unlock PDF"
|
|
887
|
+
}
|
|
888
|
+
)
|
|
889
|
+
] })
|
|
890
|
+
]
|
|
891
|
+
}
|
|
892
|
+
);
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
// src/components/viewers/pdf/PDFStyles.tsx
|
|
476
896
|
var toolbarStyles = `
|
|
477
897
|
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');
|
|
478
|
-
|
|
898
|
+
|
|
479
899
|
* {
|
|
480
900
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
481
901
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
482
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
902
|
+
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
483
903
|
'Arial Unicode MS', sans-serif !important;
|
|
484
904
|
}
|
|
485
|
-
|
|
905
|
+
|
|
486
906
|
/* Target PDF.js text layer */
|
|
487
907
|
.textLayer,
|
|
488
908
|
.textLayer span,
|
|
@@ -495,14 +915,14 @@ var toolbarStyles = `
|
|
|
495
915
|
[role="document"] * {
|
|
496
916
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
497
917
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
498
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
918
|
+
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
499
919
|
'Arial Unicode MS', sans-serif !important;
|
|
500
920
|
}
|
|
501
|
-
|
|
921
|
+
|
|
502
922
|
.pdf-viewer-header {
|
|
503
923
|
display: flex;
|
|
504
924
|
align-items: center;
|
|
505
|
-
justify-content:
|
|
925
|
+
justify-content: flex-start;
|
|
506
926
|
gap: 8px;
|
|
507
927
|
padding: 3px 16px 0 16px;
|
|
508
928
|
background: #fff;
|
|
@@ -624,6 +1044,9 @@ var toolbarStyles = `
|
|
|
624
1044
|
-ms-user-select: text !important;
|
|
625
1045
|
}
|
|
626
1046
|
`;
|
|
1047
|
+
|
|
1048
|
+
// src/components/viewers/PDFViewer.tsx
|
|
1049
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
627
1050
|
var PDFViewerContent = forwardRef((props, ref) => {
|
|
628
1051
|
const {
|
|
629
1052
|
file,
|
|
@@ -641,11 +1064,13 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
641
1064
|
onMetadataClick,
|
|
642
1065
|
onPropertiesClick,
|
|
643
1066
|
onDownloadClick,
|
|
644
|
-
onPrintClick
|
|
1067
|
+
onPrintClick,
|
|
1068
|
+
initialSearchText,
|
|
1069
|
+
initialSearchPages
|
|
645
1070
|
} = props;
|
|
646
|
-
const [pdfBuffer, setPdfBuffer] =
|
|
647
|
-
const [state, setState] =
|
|
648
|
-
const [error, setError] =
|
|
1071
|
+
const [pdfBuffer, setPdfBuffer] = useState3(null);
|
|
1072
|
+
const [state, setState] = useState3("idle");
|
|
1073
|
+
const [error, setError] = useState3(null);
|
|
649
1074
|
const pdfViewerRef = useRef2(null);
|
|
650
1075
|
const resolvedFileName = useMemo(() => {
|
|
651
1076
|
if (fileName) return fileName;
|
|
@@ -660,17 +1085,126 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
660
1085
|
() => getFileExtension(resolvedFileName),
|
|
661
1086
|
[resolvedFileName]
|
|
662
1087
|
);
|
|
663
|
-
const [currentPage, setCurrentPage] =
|
|
664
|
-
const [totalPages, setTotalPages] =
|
|
665
|
-
const [zoom, setZoom] =
|
|
666
|
-
const [searchQuery, setSearchQuery] =
|
|
667
|
-
const [isSearching, setIsSearching] =
|
|
668
|
-
const [pdfContainer, setPdfContainer] =
|
|
669
|
-
const [isSidebarOpen, setIsSidebarOpen] =
|
|
670
|
-
const [searchResults, setSearchResults] =
|
|
671
|
-
const [currentSearchResultIndex, setCurrentSearchResultIndex] =
|
|
672
|
-
const [totalSearchResults, setTotalSearchResults] =
|
|
673
|
-
|
|
1088
|
+
const [currentPage, setCurrentPage] = useState3(1);
|
|
1089
|
+
const [totalPages, setTotalPages] = useState3(0);
|
|
1090
|
+
const [zoom, setZoom] = useState3(100);
|
|
1091
|
+
const [searchQuery, setSearchQuery] = useState3("");
|
|
1092
|
+
const [isSearching, setIsSearching] = useState3(false);
|
|
1093
|
+
const [pdfContainer, setPdfContainer] = useState3(null);
|
|
1094
|
+
const [isSidebarOpen, setIsSidebarOpen] = useState3(false);
|
|
1095
|
+
const [searchResults, setSearchResults] = useState3([]);
|
|
1096
|
+
const [currentSearchResultIndex, setCurrentSearchResultIndex] = useState3(0);
|
|
1097
|
+
const [totalSearchResults, setTotalSearchResults] = useState3(0);
|
|
1098
|
+
const [autoExecuteSearch, setAutoExecuteSearch] = useState3(!!initialSearchText);
|
|
1099
|
+
const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState3(false);
|
|
1100
|
+
const [passwordError, setPasswordError] = useState3("");
|
|
1101
|
+
const [passwordResolve, setPasswordResolve] = useState3(null);
|
|
1102
|
+
const hasExecutedInitialSearch = useRef2(false);
|
|
1103
|
+
const toolbarHandlers = useMemo(() => ({
|
|
1104
|
+
handleZoomIn: () => {
|
|
1105
|
+
pdfViewerRef.current?.zoom.zoomIn();
|
|
1106
|
+
requestAnimationFrame(() => {
|
|
1107
|
+
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1108
|
+
if (typeof zoomValue === "number") {
|
|
1109
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
},
|
|
1113
|
+
handleZoomOut: () => {
|
|
1114
|
+
pdfViewerRef.current?.zoom.zoomOut();
|
|
1115
|
+
requestAnimationFrame(() => {
|
|
1116
|
+
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1117
|
+
if (typeof zoomValue === "number") {
|
|
1118
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
},
|
|
1122
|
+
handleFitToWidth: () => {
|
|
1123
|
+
pdfViewerRef.current?.zoom.fitToWidth();
|
|
1124
|
+
requestAnimationFrame(() => {
|
|
1125
|
+
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1126
|
+
if (typeof zoomValue === "number") {
|
|
1127
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
},
|
|
1131
|
+
handleFitToPage: () => {
|
|
1132
|
+
pdfViewerRef.current?.zoom.fitToPage();
|
|
1133
|
+
requestAnimationFrame(() => {
|
|
1134
|
+
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1135
|
+
if (typeof zoomValue === "number") {
|
|
1136
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
},
|
|
1140
|
+
handlePreviousPage: () => {
|
|
1141
|
+
pdfViewerRef.current?.navigation.previousPage();
|
|
1142
|
+
requestAnimationFrame(() => {
|
|
1143
|
+
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1144
|
+
setCurrentPage(current);
|
|
1145
|
+
});
|
|
1146
|
+
},
|
|
1147
|
+
handleNextPage: () => {
|
|
1148
|
+
pdfViewerRef.current?.navigation.nextPage();
|
|
1149
|
+
requestAnimationFrame(() => {
|
|
1150
|
+
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1151
|
+
setCurrentPage(current);
|
|
1152
|
+
});
|
|
1153
|
+
},
|
|
1154
|
+
handleFirstPage: () => {
|
|
1155
|
+
pdfViewerRef.current?.navigation.goToFirstPage();
|
|
1156
|
+
requestAnimationFrame(() => {
|
|
1157
|
+
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1158
|
+
setCurrentPage(current);
|
|
1159
|
+
});
|
|
1160
|
+
},
|
|
1161
|
+
handleLastPage: () => {
|
|
1162
|
+
pdfViewerRef.current?.navigation.goToLastPage();
|
|
1163
|
+
requestAnimationFrame(() => {
|
|
1164
|
+
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1165
|
+
setCurrentPage(current);
|
|
1166
|
+
});
|
|
1167
|
+
},
|
|
1168
|
+
toggleSidebar: () => setIsSidebarOpen(!isSidebarOpen),
|
|
1169
|
+
handlePageInput: (e) => {
|
|
1170
|
+
const value = e.target.value;
|
|
1171
|
+
if (/^\d*$/.test(value)) {
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
const page = parseInt(value, 10);
|
|
1175
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1176
|
+
pdfViewerRef.current?.navigation.goToPage(page);
|
|
1177
|
+
setCurrentPage(page);
|
|
1178
|
+
}
|
|
1179
|
+
},
|
|
1180
|
+
handlePageInputKeyPress: (e) => {
|
|
1181
|
+
if (e.key === "Enter") {
|
|
1182
|
+
const value = e.target.value;
|
|
1183
|
+
const page = parseInt(value, 10);
|
|
1184
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1185
|
+
pdfViewerRef.current?.navigation.goToPage(page);
|
|
1186
|
+
setCurrentPage(page);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}), [isSidebarOpen, totalPages]);
|
|
1191
|
+
useEffect3(() => {
|
|
1192
|
+
console.log("came", initialSearchText, pdfViewerRef.current, hasExecutedInitialSearch.current);
|
|
1193
|
+
if (pdfViewerRef.current && !hasExecutedInitialSearch.current && initialSearchText) {
|
|
1194
|
+
hasExecutedInitialSearch.current = true;
|
|
1195
|
+
setIsSidebarOpen(true);
|
|
1196
|
+
setSearchQuery(initialSearchText);
|
|
1197
|
+
handleSidebarSearch(initialSearchText, initialSearchPages);
|
|
1198
|
+
setAutoExecuteSearch(false);
|
|
1199
|
+
pdfViewerRef.current.search.searchText(initialSearchText).then((results) => {
|
|
1200
|
+
console.log("results", results);
|
|
1201
|
+
if (results?.results?.length > 0) {
|
|
1202
|
+
pdfViewerRef.current?.navigation.goToPage(results.results[0].pageIndex + 1);
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
}, [pdfViewerRef.current, initialSearchText]);
|
|
1207
|
+
useEffect3(() => {
|
|
674
1208
|
setSearchQuery("");
|
|
675
1209
|
setSearchResults([]);
|
|
676
1210
|
setCurrentSearchResultIndex(0);
|
|
@@ -684,74 +1218,80 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
684
1218
|
setError(null);
|
|
685
1219
|
setPdfBuffer(null);
|
|
686
1220
|
}, [file]);
|
|
687
|
-
|
|
688
|
-
if (state
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}
|
|
694
|
-
}, 500);
|
|
1221
|
+
useEffect3(() => {
|
|
1222
|
+
if (state !== "ready") return;
|
|
1223
|
+
const container = document.querySelector('[data-pdf-viewer], .embedpdf-viewport, [role="document"]');
|
|
1224
|
+
if (container) {
|
|
1225
|
+
setPdfContainer(container);
|
|
1226
|
+
return;
|
|
695
1227
|
}
|
|
1228
|
+
const observer = new MutationObserver(() => {
|
|
1229
|
+
const foundContainer = document.querySelector('[data-pdf-viewer], .embedpdf-viewport, [role="document"]');
|
|
1230
|
+
if (foundContainer) {
|
|
1231
|
+
setPdfContainer(foundContainer);
|
|
1232
|
+
observer.disconnect();
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1236
|
+
return () => observer.disconnect();
|
|
696
1237
|
}, [state]);
|
|
697
|
-
|
|
698
|
-
if (state
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
let
|
|
702
|
-
|
|
703
|
-
await new Promise((resolve) =>
|
|
704
|
-
|
|
705
|
-
|
|
1238
|
+
useEffect3(() => {
|
|
1239
|
+
if (state !== "ready" || totalPages > 0) return;
|
|
1240
|
+
const initializePageCount = async () => {
|
|
1241
|
+
const waitForViewer = async (maxAttempts = 10) => {
|
|
1242
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
1243
|
+
if (pdfViewerRef.current) return pdfViewerRef.current;
|
|
1244
|
+
await new Promise((resolve) => requestAnimationFrame(
|
|
1245
|
+
() => setTimeout(resolve, Math.min(100 * Math.pow(2, i), 1e3))
|
|
1246
|
+
));
|
|
706
1247
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
1248
|
+
return null;
|
|
1249
|
+
};
|
|
1250
|
+
const viewer = await waitForViewer();
|
|
1251
|
+
if (!viewer) return;
|
|
1252
|
+
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1253
|
+
try {
|
|
1254
|
+
const count = viewer.navigation?.getTotalPages?.();
|
|
1255
|
+
if (count && count > 1) {
|
|
1256
|
+
setTotalPages(count);
|
|
1257
|
+
return;
|
|
716
1258
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
1259
|
+
} catch (e) {
|
|
1260
|
+
}
|
|
1261
|
+
try {
|
|
1262
|
+
const results = await viewer.search?.searchText?.("e");
|
|
1263
|
+
if (results?.results && results.results.length > 0) {
|
|
1264
|
+
const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
|
|
1265
|
+
const count = Math.max(...pageIndices) + 1;
|
|
1266
|
+
viewer.search?.stopSearch?.();
|
|
1267
|
+
setTotalPages(count);
|
|
1268
|
+
return;
|
|
727
1269
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}
|
|
743
|
-
if (pages && pages.length > 0) {
|
|
1270
|
+
} catch (error2) {
|
|
1271
|
+
}
|
|
1272
|
+
try {
|
|
1273
|
+
const selectors = [
|
|
1274
|
+
"[data-page-index]",
|
|
1275
|
+
"[data-page-number]",
|
|
1276
|
+
".embedpdf-page",
|
|
1277
|
+
'[role="article"]',
|
|
1278
|
+
"canvas[data-page]",
|
|
1279
|
+
".react-pdf__Page"
|
|
1280
|
+
];
|
|
1281
|
+
for (const selector of selectors) {
|
|
1282
|
+
const pages = document.querySelectorAll(selector);
|
|
1283
|
+
if (pages.length > 0) {
|
|
744
1284
|
setTotalPages(pages.length);
|
|
745
1285
|
return;
|
|
746
1286
|
}
|
|
747
|
-
} catch (error2) {
|
|
748
1287
|
}
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
}
|
|
1288
|
+
} catch (error2) {
|
|
1289
|
+
}
|
|
1290
|
+
setTotalPages(1);
|
|
1291
|
+
};
|
|
1292
|
+
initializePageCount();
|
|
753
1293
|
}, [state, totalPages]);
|
|
754
|
-
|
|
1294
|
+
useEffect3(() => {
|
|
755
1295
|
if (state === "ready" && pdfViewerRef.current) {
|
|
756
1296
|
const updateInfo = () => {
|
|
757
1297
|
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
@@ -839,71 +1379,18 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
839
1379
|
clearSelection: () => pdfViewerRef.current?.selection.clearSelection()
|
|
840
1380
|
}), []);
|
|
841
1381
|
const updatePageDisplay = () => {
|
|
842
|
-
|
|
1382
|
+
requestAnimationFrame(() => {
|
|
843
1383
|
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
844
1384
|
setCurrentPage(current);
|
|
845
|
-
}
|
|
1385
|
+
});
|
|
846
1386
|
};
|
|
847
1387
|
const updateZoomDisplay = () => {
|
|
848
|
-
|
|
1388
|
+
requestAnimationFrame(() => {
|
|
849
1389
|
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
850
1390
|
if (typeof zoomValue === "number") {
|
|
851
1391
|
setZoom(Math.round(zoomValue * 100));
|
|
852
1392
|
}
|
|
853
|
-
}
|
|
854
|
-
};
|
|
855
|
-
const handleZoomIn = () => {
|
|
856
|
-
pdfViewerRef.current?.zoom.zoomIn();
|
|
857
|
-
updateZoomDisplay();
|
|
858
|
-
};
|
|
859
|
-
const handleZoomOut = () => {
|
|
860
|
-
pdfViewerRef.current?.zoom.zoomOut();
|
|
861
|
-
updateZoomDisplay();
|
|
862
|
-
};
|
|
863
|
-
const handleFitToWidth = () => {
|
|
864
|
-
pdfViewerRef.current?.zoom.fitToWidth();
|
|
865
|
-
updateZoomDisplay();
|
|
866
|
-
};
|
|
867
|
-
const handleFitToPage = () => {
|
|
868
|
-
pdfViewerRef.current?.zoom.fitToPage();
|
|
869
|
-
updateZoomDisplay();
|
|
870
|
-
};
|
|
871
|
-
const handlePreviousPage = () => {
|
|
872
|
-
pdfViewerRef.current?.navigation.previousPage();
|
|
873
|
-
updatePageDisplay();
|
|
874
|
-
};
|
|
875
|
-
const handleNextPage = () => {
|
|
876
|
-
pdfViewerRef.current?.navigation.nextPage();
|
|
877
|
-
updatePageDisplay();
|
|
878
|
-
};
|
|
879
|
-
const handleFirstPage = () => {
|
|
880
|
-
pdfViewerRef.current?.navigation.goToFirstPage();
|
|
881
|
-
updatePageDisplay();
|
|
882
|
-
};
|
|
883
|
-
const handleLastPage = () => {
|
|
884
|
-
pdfViewerRef.current?.navigation.goToLastPage();
|
|
885
|
-
updatePageDisplay();
|
|
886
|
-
};
|
|
887
|
-
const handlePageInput = (e) => {
|
|
888
|
-
const value = e.target.value;
|
|
889
|
-
const page = parseInt(value, 10);
|
|
890
|
-
if (/^\d*$/.test(value)) {
|
|
891
|
-
return;
|
|
892
|
-
}
|
|
893
|
-
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
894
|
-
pdfViewerRef.current?.navigation.goToPage(page);
|
|
895
|
-
setCurrentPage(page);
|
|
896
|
-
}
|
|
897
|
-
};
|
|
898
|
-
const handlePageInputKeyPress = (e) => {
|
|
899
|
-
if (e.key === "Enter") {
|
|
900
|
-
const value = e.target.value;
|
|
901
|
-
const page = parseInt(value, 10);
|
|
902
|
-
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
903
|
-
pdfViewerRef.current?.navigation.goToPage(page);
|
|
904
|
-
setCurrentPage(page);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
1393
|
+
});
|
|
907
1394
|
};
|
|
908
1395
|
const handleSearch = async () => {
|
|
909
1396
|
if (searchQuery.trim()) {
|
|
@@ -952,13 +1439,13 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
952
1439
|
handleSearch();
|
|
953
1440
|
}
|
|
954
1441
|
};
|
|
955
|
-
const handleSidebarSearch = async (keyword) => {
|
|
1442
|
+
const handleSidebarSearch = async (keyword, pageNumbers) => {
|
|
956
1443
|
setSearchQuery(keyword);
|
|
957
1444
|
if (keyword.trim()) {
|
|
958
1445
|
setIsSearching(true);
|
|
959
1446
|
const results = await pdfViewerRef.current?.search.searchText(keyword);
|
|
960
1447
|
setIsSearching(false);
|
|
961
|
-
if (results && results.results) {
|
|
1448
|
+
if (results && results.results && results.results.length > 0) {
|
|
962
1449
|
const formattedResults = results.results.map((result, index) => {
|
|
963
1450
|
let textContent = "";
|
|
964
1451
|
let contextContent = "";
|
|
@@ -990,6 +1477,18 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
990
1477
|
pdfViewerRef.current?.navigation.goToPage(firstPageNumber);
|
|
991
1478
|
setCurrentPage(firstPageNumber);
|
|
992
1479
|
}
|
|
1480
|
+
} else if (pageNumbers && pageNumbers.length > 0) {
|
|
1481
|
+
const fallbackResults = pageNumbers.map((pageNum, index) => ({
|
|
1482
|
+
pageNumber: pageNum,
|
|
1483
|
+
text: keyword,
|
|
1484
|
+
context: `"${keyword}" found on this page ${pageNum}`,
|
|
1485
|
+
index
|
|
1486
|
+
}));
|
|
1487
|
+
setSearchResults(fallbackResults);
|
|
1488
|
+
setTotalSearchResults(fallbackResults.length);
|
|
1489
|
+
setCurrentSearchResultIndex(0);
|
|
1490
|
+
pdfViewerRef.current?.navigation.goToPage(pageNumbers[0]);
|
|
1491
|
+
setCurrentPage(pageNumbers[0]);
|
|
993
1492
|
} else {
|
|
994
1493
|
setSearchResults([]);
|
|
995
1494
|
setTotalSearchResults(0);
|
|
@@ -1008,9 +1507,6 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1008
1507
|
setCurrentPage(pageNumber);
|
|
1009
1508
|
pdfViewerRef.current?.search.goToResult(resultIndex);
|
|
1010
1509
|
};
|
|
1011
|
-
const toggleSidebar = () => {
|
|
1012
|
-
setIsSidebarOpen(!isSidebarOpen);
|
|
1013
|
-
};
|
|
1014
1510
|
const handleNextSearchResult = () => {
|
|
1015
1511
|
if (currentSearchResultIndex < totalSearchResults - 1) {
|
|
1016
1512
|
const nextIndex = currentSearchResultIndex + 1;
|
|
@@ -1035,72 +1531,7 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1035
1531
|
}
|
|
1036
1532
|
}
|
|
1037
1533
|
};
|
|
1038
|
-
|
|
1039
|
-
if (onDownloadClick) {
|
|
1040
|
-
onDownloadClick();
|
|
1041
|
-
return;
|
|
1042
|
-
}
|
|
1043
|
-
if (!pdfBuffer) return;
|
|
1044
|
-
const blob = new Blob([pdfBuffer], { type: "application/pdf" });
|
|
1045
|
-
const url = URL.createObjectURL(blob);
|
|
1046
|
-
const link = document.createElement("a");
|
|
1047
|
-
link.href = url;
|
|
1048
|
-
link.download = resolvedFileName;
|
|
1049
|
-
document.body.appendChild(link);
|
|
1050
|
-
link.click();
|
|
1051
|
-
document.body.removeChild(link);
|
|
1052
|
-
URL.revokeObjectURL(url);
|
|
1053
|
-
};
|
|
1054
|
-
const handlePrint = () => {
|
|
1055
|
-
if (onPrintClick) {
|
|
1056
|
-
onPrintClick();
|
|
1057
|
-
return;
|
|
1058
|
-
}
|
|
1059
|
-
if (!pdfBuffer) return;
|
|
1060
|
-
const blob = new Blob([pdfBuffer], { type: "application/pdf" });
|
|
1061
|
-
const blobUrl = URL.createObjectURL(blob);
|
|
1062
|
-
const iframe = document.createElement("iframe");
|
|
1063
|
-
iframe.style.position = "fixed";
|
|
1064
|
-
iframe.style.right = "0";
|
|
1065
|
-
iframe.style.bottom = "0";
|
|
1066
|
-
iframe.style.width = "0";
|
|
1067
|
-
iframe.style.height = "0";
|
|
1068
|
-
iframe.style.border = "0";
|
|
1069
|
-
document.body.appendChild(iframe);
|
|
1070
|
-
iframe.onload = () => {
|
|
1071
|
-
try {
|
|
1072
|
-
setTimeout(() => {
|
|
1073
|
-
const iframeWindow = iframe.contentWindow;
|
|
1074
|
-
if (!iframeWindow) return;
|
|
1075
|
-
iframeWindow.focus();
|
|
1076
|
-
iframeWindow.print();
|
|
1077
|
-
const checkPrintComplete = () => {
|
|
1078
|
-
setTimeout(() => {
|
|
1079
|
-
try {
|
|
1080
|
-
document.body.removeChild(iframe);
|
|
1081
|
-
URL.revokeObjectURL(blobUrl);
|
|
1082
|
-
} catch (e) {
|
|
1083
|
-
}
|
|
1084
|
-
}, 500);
|
|
1085
|
-
};
|
|
1086
|
-
if ("onafterprint" in iframeWindow) {
|
|
1087
|
-
iframeWindow.onafterprint = checkPrintComplete;
|
|
1088
|
-
} else {
|
|
1089
|
-
setTimeout(checkPrintComplete, 3e3);
|
|
1090
|
-
}
|
|
1091
|
-
}, 500);
|
|
1092
|
-
} catch (error2) {
|
|
1093
|
-
document.body.removeChild(iframe);
|
|
1094
|
-
URL.revokeObjectURL(blobUrl);
|
|
1095
|
-
}
|
|
1096
|
-
};
|
|
1097
|
-
iframe.onerror = () => {
|
|
1098
|
-
document.body.removeChild(iframe);
|
|
1099
|
-
URL.revokeObjectURL(blobUrl);
|
|
1100
|
-
};
|
|
1101
|
-
iframe.src = blobUrl;
|
|
1102
|
-
};
|
|
1103
|
-
useEffect(() => {
|
|
1534
|
+
useEffect3(() => {
|
|
1104
1535
|
if (!file) {
|
|
1105
1536
|
setState("error");
|
|
1106
1537
|
setError("No file provided");
|
|
@@ -1137,12 +1568,30 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1137
1568
|
loadPDF();
|
|
1138
1569
|
}, [file, onLoad, onError]);
|
|
1139
1570
|
const handlePasswordRequest = useCallback(async (fileName2) => {
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1571
|
+
return new Promise((resolve) => {
|
|
1572
|
+
setPasswordResolve(() => resolve);
|
|
1573
|
+
setPasswordError("");
|
|
1574
|
+
setIsPasswordDialogOpen(true);
|
|
1575
|
+
});
|
|
1143
1576
|
}, []);
|
|
1577
|
+
const handlePasswordSubmit = useCallback((password) => {
|
|
1578
|
+
if (passwordResolve) {
|
|
1579
|
+
passwordResolve(password);
|
|
1580
|
+
setPasswordResolve(null);
|
|
1581
|
+
setIsPasswordDialogOpen(false);
|
|
1582
|
+
setPasswordError("");
|
|
1583
|
+
}
|
|
1584
|
+
}, [passwordResolve]);
|
|
1585
|
+
const handlePasswordCancel = useCallback(() => {
|
|
1586
|
+
if (passwordResolve) {
|
|
1587
|
+
passwordResolve(null);
|
|
1588
|
+
setPasswordResolve(null);
|
|
1589
|
+
setIsPasswordDialogOpen(false);
|
|
1590
|
+
setPasswordError("");
|
|
1591
|
+
}
|
|
1592
|
+
}, [passwordResolve]);
|
|
1144
1593
|
if (state === "loading") {
|
|
1145
|
-
return /* @__PURE__ */
|
|
1594
|
+
return /* @__PURE__ */ jsxs5("div", { style: {
|
|
1146
1595
|
display: "flex",
|
|
1147
1596
|
flexDirection: "column",
|
|
1148
1597
|
alignItems: "center",
|
|
@@ -1150,7 +1599,7 @@ Enter password for ${fileName2 || "document"}:`);
|
|
|
1150
1599
|
height: "100%",
|
|
1151
1600
|
gap: "16px"
|
|
1152
1601
|
}, children: [
|
|
1153
|
-
/* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ jsx6("div", { className: "spinner", style: {
|
|
1154
1603
|
width: "48px",
|
|
1155
1604
|
height: "48px",
|
|
1156
1605
|
border: "4px solid #f3f3f3",
|
|
@@ -1158,8 +1607,8 @@ Enter password for ${fileName2 || "document"}:`);
|
|
|
1158
1607
|
borderRadius: "50%",
|
|
1159
1608
|
animation: "spin 1s linear infinite"
|
|
1160
1609
|
} }),
|
|
1161
|
-
/* @__PURE__ */
|
|
1162
|
-
/* @__PURE__ */
|
|
1610
|
+
/* @__PURE__ */ jsx6("p", { children: "Loading PDF..." }),
|
|
1611
|
+
/* @__PURE__ */ jsx6("style", { children: `
|
|
1163
1612
|
@keyframes spin {
|
|
1164
1613
|
0% { transform: rotate(0deg); }
|
|
1165
1614
|
100% { transform: rotate(360deg); }
|
|
@@ -1168,210 +1617,83 @@ Enter password for ${fileName2 || "document"}:`);
|
|
|
1168
1617
|
] });
|
|
1169
1618
|
}
|
|
1170
1619
|
if (state === "error" || error) {
|
|
1171
|
-
return /* @__PURE__ */
|
|
1620
|
+
return /* @__PURE__ */ jsx6("div", { style: {
|
|
1172
1621
|
display: "flex",
|
|
1173
1622
|
flexDirection: "column",
|
|
1174
1623
|
alignItems: "center",
|
|
1175
1624
|
justifyContent: "center",
|
|
1176
1625
|
height: "100%",
|
|
1177
1626
|
padding: "24px"
|
|
1178
|
-
}, children: /* @__PURE__ */
|
|
1627
|
+
}, children: /* @__PURE__ */ jsxs5("div", { style: {
|
|
1179
1628
|
maxWidth: "400px",
|
|
1180
1629
|
padding: "16px",
|
|
1181
1630
|
backgroundColor: "#fee",
|
|
1182
1631
|
border: "1px solid #fcc",
|
|
1183
1632
|
borderRadius: "4px"
|
|
1184
1633
|
}, children: [
|
|
1185
|
-
/* @__PURE__ */
|
|
1186
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ jsx6("h3", { style: { marginTop: 0 }, children: "Failed to Load PDF" }),
|
|
1635
|
+
/* @__PURE__ */ jsx6("p", { children: error || "Unknown error occurred" })
|
|
1187
1636
|
] }) });
|
|
1188
1637
|
}
|
|
1189
1638
|
if (!pdfBuffer || state !== "ready") {
|
|
1190
|
-
return /* @__PURE__ */
|
|
1639
|
+
return /* @__PURE__ */ jsx6("div", { style: {
|
|
1191
1640
|
display: "flex",
|
|
1192
1641
|
alignItems: "center",
|
|
1193
1642
|
justifyContent: "center",
|
|
1194
1643
|
height: "100%"
|
|
1195
|
-
}, children: /* @__PURE__ */
|
|
1644
|
+
}, children: /* @__PURE__ */ jsx6("p", { children: "Preparing PDF..." }) });
|
|
1196
1645
|
}
|
|
1197
|
-
return /* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
-
/* @__PURE__ */
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
disabled: currentPage >= totalPages,
|
|
1249
|
-
title: "Next Page",
|
|
1250
|
-
children: /* @__PURE__ */ jsx2(ChevronRightIcon, { fontSize: "small" })
|
|
1251
|
-
}
|
|
1252
|
-
),
|
|
1253
|
-
/* @__PURE__ */ jsx2(
|
|
1254
|
-
"button",
|
|
1255
|
-
{
|
|
1256
|
-
className: "toolbar-button",
|
|
1257
|
-
onClick: handleLastPage,
|
|
1258
|
-
disabled: currentPage >= totalPages,
|
|
1259
|
-
title: "Last Page",
|
|
1260
|
-
children: /* @__PURE__ */ jsx2(LastPageIcon, { fontSize: "small" })
|
|
1261
|
-
}
|
|
1262
|
-
)
|
|
1263
|
-
] })
|
|
1264
|
-
] }),
|
|
1265
|
-
showZoomControls && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
1266
|
-
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
1267
|
-
/* @__PURE__ */ jsxs2("div", { className: "toolbar-section", children: [
|
|
1268
|
-
/* @__PURE__ */ jsx2(
|
|
1269
|
-
"button",
|
|
1270
|
-
{
|
|
1271
|
-
className: "toolbar-button",
|
|
1272
|
-
onClick: handleZoomOut,
|
|
1273
|
-
title: "Zoom Out",
|
|
1274
|
-
children: /* @__PURE__ */ jsx2(ZoomOutIcon, { fontSize: "small" })
|
|
1275
|
-
}
|
|
1276
|
-
),
|
|
1277
|
-
/* @__PURE__ */ jsxs2("span", { className: "zoom-display", children: [
|
|
1278
|
-
zoom,
|
|
1279
|
-
"%"
|
|
1280
|
-
] }),
|
|
1281
|
-
/* @__PURE__ */ jsx2(
|
|
1282
|
-
"button",
|
|
1283
|
-
{
|
|
1284
|
-
className: "toolbar-button",
|
|
1285
|
-
onClick: handleZoomIn,
|
|
1286
|
-
title: "Zoom In",
|
|
1287
|
-
children: /* @__PURE__ */ jsx2(ZoomInIcon, { fontSize: "small" })
|
|
1288
|
-
}
|
|
1289
|
-
),
|
|
1290
|
-
/* @__PURE__ */ jsx2(
|
|
1291
|
-
"button",
|
|
1292
|
-
{
|
|
1293
|
-
className: "toolbar-button",
|
|
1294
|
-
onClick: handleFitToWidth,
|
|
1295
|
-
title: "Fit to Width",
|
|
1296
|
-
children: /* @__PURE__ */ jsx2(AspectRatioIcon, { fontSize: "small" })
|
|
1297
|
-
}
|
|
1298
|
-
),
|
|
1299
|
-
/* @__PURE__ */ jsx2(
|
|
1300
|
-
"button",
|
|
1301
|
-
{
|
|
1302
|
-
className: "toolbar-button",
|
|
1303
|
-
onClick: handleFitToPage,
|
|
1304
|
-
title: "Fit to Page",
|
|
1305
|
-
children: /* @__PURE__ */ jsx2(FitScreenIcon, { fontSize: "small" })
|
|
1306
|
-
}
|
|
1307
|
-
)
|
|
1308
|
-
] })
|
|
1309
|
-
] }),
|
|
1310
|
-
showSearch && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
1311
|
-
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
1312
|
-
/* @__PURE__ */ jsx2("div", { className: "toolbar-section", children: /* @__PURE__ */ jsx2(
|
|
1313
|
-
"button",
|
|
1314
|
-
{
|
|
1315
|
-
className: "toolbar-button",
|
|
1316
|
-
onClick: toggleSidebar,
|
|
1317
|
-
title: "Search in PDF",
|
|
1318
|
-
style: {
|
|
1319
|
-
backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
|
|
1320
|
-
color: isSidebarOpen ? "#1976d2" : "inherit"
|
|
1321
|
-
},
|
|
1322
|
-
children: /* @__PURE__ */ jsx2(SearchIcon2, { fontSize: "small" })
|
|
1323
|
-
}
|
|
1324
|
-
) })
|
|
1325
|
-
] }),
|
|
1326
|
-
(showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
1327
|
-
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
1328
|
-
/* @__PURE__ */ jsxs2("div", { className: "toolbar-section", children: [
|
|
1329
|
-
showDownload && /* @__PURE__ */ jsx2(
|
|
1330
|
-
"button",
|
|
1331
|
-
{
|
|
1332
|
-
className: "toolbar-button",
|
|
1333
|
-
onClick: onDownloadClick,
|
|
1334
|
-
title: "Download PDF",
|
|
1335
|
-
children: /* @__PURE__ */ jsx2(DownloadIcon, { fontSize: "small" })
|
|
1336
|
-
}
|
|
1337
|
-
),
|
|
1338
|
-
showPrint && /* @__PURE__ */ jsx2(
|
|
1339
|
-
"button",
|
|
1340
|
-
{
|
|
1341
|
-
className: "toolbar-button",
|
|
1342
|
-
onClick: onPrintClick,
|
|
1343
|
-
title: "Print PDF",
|
|
1344
|
-
children: /* @__PURE__ */ jsx2(PrintIcon, { fontSize: "small" })
|
|
1345
|
-
}
|
|
1346
|
-
),
|
|
1347
|
-
showMetadata && /* @__PURE__ */ jsx2(
|
|
1348
|
-
"button",
|
|
1349
|
-
{
|
|
1350
|
-
className: "toolbar-button",
|
|
1351
|
-
onClick: onMetadataClick,
|
|
1352
|
-
title: "Document Metadata",
|
|
1353
|
-
children: /* @__PURE__ */ jsx2(InfoIcon, { fontSize: "small" })
|
|
1354
|
-
}
|
|
1355
|
-
),
|
|
1356
|
-
showProperties && /* @__PURE__ */ jsx2(
|
|
1357
|
-
"button",
|
|
1358
|
-
{
|
|
1359
|
-
className: "toolbar-button",
|
|
1360
|
-
onClick: onPropertiesClick,
|
|
1361
|
-
title: "Document Properties",
|
|
1362
|
-
children: /* @__PURE__ */ jsx2(DescriptionIcon, { fontSize: "small" })
|
|
1363
|
-
}
|
|
1364
|
-
)
|
|
1365
|
-
] })
|
|
1366
|
-
] })
|
|
1367
|
-
] }),
|
|
1368
|
-
/* @__PURE__ */ jsxs2("div", { className: "pdf-viewer-main", children: [
|
|
1369
|
-
/* @__PURE__ */ jsx2("div", { className: "pdf-viewer-viewer-area", children: React2.createElement(HeadlessPDFViewer, {
|
|
1370
|
-
ref: pdfViewerRef,
|
|
1371
|
-
pdfBuffer,
|
|
1372
|
-
onPasswordRequest: handlePasswordRequest
|
|
1373
|
-
}) }),
|
|
1374
|
-
/* @__PURE__ */ jsx2(
|
|
1646
|
+
return /* @__PURE__ */ jsxs5("div", { className: "pdf-viewer-container", children: [
|
|
1647
|
+
/* @__PURE__ */ jsx6("style", { children: toolbarStyles }),
|
|
1648
|
+
/* @__PURE__ */ jsx6(
|
|
1649
|
+
PDFHeader,
|
|
1650
|
+
{
|
|
1651
|
+
fileName: resolvedFileName,
|
|
1652
|
+
fileExtension
|
|
1653
|
+
}
|
|
1654
|
+
),
|
|
1655
|
+
/* @__PURE__ */ jsx6(
|
|
1656
|
+
PDFToolbar,
|
|
1657
|
+
{
|
|
1658
|
+
currentPage,
|
|
1659
|
+
totalPages,
|
|
1660
|
+
zoom,
|
|
1661
|
+
isSidebarOpen,
|
|
1662
|
+
showPageNavigation,
|
|
1663
|
+
showPageCount,
|
|
1664
|
+
showZoomControls,
|
|
1665
|
+
showSearch,
|
|
1666
|
+
showMetadata,
|
|
1667
|
+
showProperties,
|
|
1668
|
+
showDownload,
|
|
1669
|
+
showPrint,
|
|
1670
|
+
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
1671
|
+
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
1672
|
+
onNextPage: toolbarHandlers.handleNextPage,
|
|
1673
|
+
onLastPage: toolbarHandlers.handleLastPage,
|
|
1674
|
+
onPageInput: toolbarHandlers.handlePageInput,
|
|
1675
|
+
onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
|
|
1676
|
+
onZoomIn: toolbarHandlers.handleZoomIn,
|
|
1677
|
+
onZoomOut: toolbarHandlers.handleZoomOut,
|
|
1678
|
+
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
1679
|
+
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
1680
|
+
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
1681
|
+
onDownloadClick,
|
|
1682
|
+
onPrintClick,
|
|
1683
|
+
onMetadataClick,
|
|
1684
|
+
onPropertiesClick
|
|
1685
|
+
}
|
|
1686
|
+
),
|
|
1687
|
+
/* @__PURE__ */ jsxs5("div", { className: "pdf-viewer-main", children: [
|
|
1688
|
+
/* @__PURE__ */ jsx6("div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ jsx6(
|
|
1689
|
+
StablePDFViewer,
|
|
1690
|
+
{
|
|
1691
|
+
pdfBuffer,
|
|
1692
|
+
onPasswordRequest: handlePasswordRequest,
|
|
1693
|
+
pdfViewerRef
|
|
1694
|
+
}
|
|
1695
|
+
) }),
|
|
1696
|
+
/* @__PURE__ */ jsx6(
|
|
1375
1697
|
SearchSidebar,
|
|
1376
1698
|
{
|
|
1377
1699
|
isOpen: isSidebarOpen,
|
|
@@ -1387,16 +1709,26 @@ Enter password for ${fileName2 || "document"}:`);
|
|
|
1387
1709
|
isSearching
|
|
1388
1710
|
}
|
|
1389
1711
|
)
|
|
1390
|
-
] })
|
|
1712
|
+
] }),
|
|
1713
|
+
/* @__PURE__ */ jsx6(
|
|
1714
|
+
PasswordDialog,
|
|
1715
|
+
{
|
|
1716
|
+
open: isPasswordDialogOpen,
|
|
1717
|
+
fileName: resolvedFileName,
|
|
1718
|
+
onSubmit: handlePasswordSubmit,
|
|
1719
|
+
onCancel: handlePasswordCancel,
|
|
1720
|
+
error: passwordError
|
|
1721
|
+
}
|
|
1722
|
+
)
|
|
1391
1723
|
] });
|
|
1392
1724
|
});
|
|
1393
1725
|
PDFViewerContent.displayName = "PDFViewerContent";
|
|
1394
1726
|
var PDFViewer = forwardRef((props, ref) => {
|
|
1395
|
-
return /* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ jsx6(PDFViewerContent, { ...props, sourceDescription: "doc.pdf", ref });
|
|
1396
1728
|
});
|
|
1397
1729
|
PDFViewer.displayName = "PDFViewer";
|
|
1398
1730
|
|
|
1399
1731
|
export {
|
|
1400
1732
|
PDFViewer
|
|
1401
1733
|
};
|
|
1402
|
-
//# sourceMappingURL=chunk-
|
|
1734
|
+
//# sourceMappingURL=chunk-K5SKH4SD.mjs.map
|