@cannyminds/dms-file-viewers 0.4.0 → 0.6.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-DOOYIHGW.js → chunk-56PP5GHZ.js} +70 -18
- package/dist/chunk-56PP5GHZ.js.map +1 -0
- package/dist/{chunk-7BLEPGZ4.mjs → chunk-7AUCINV2.mjs} +70 -18
- package/dist/chunk-7AUCINV2.mjs.map +1 -0
- package/dist/chunk-A2MSWOEM.js +159 -0
- package/dist/chunk-A2MSWOEM.js.map +1 -0
- package/dist/{chunk-SBEFC7HP.js → chunk-CQ3HSM5S.js} +70 -18
- package/dist/chunk-CQ3HSM5S.js.map +1 -0
- package/dist/{chunk-DDT3GC3C.js → chunk-D7LXG67Z.js} +482 -510
- package/dist/chunk-D7LXG67Z.js.map +1 -0
- package/dist/chunk-EAM7CURM.js +334 -0
- package/dist/chunk-EAM7CURM.js.map +1 -0
- package/dist/{chunk-SNEIVT4R.js → chunk-ETHSDRF5.js} +70 -18
- package/dist/chunk-ETHSDRF5.js.map +1 -0
- package/dist/{chunk-RE4XRGSV.js → chunk-FA5L62Y5.js} +52 -32
- package/dist/chunk-FA5L62Y5.js.map +1 -0
- package/dist/chunk-GMDRDOWP.mjs +159 -0
- package/dist/chunk-GMDRDOWP.mjs.map +1 -0
- package/dist/{chunk-4DJJINTB.mjs → chunk-KBST5Z5H.mjs} +69 -17
- package/dist/chunk-KBST5Z5H.mjs.map +1 -0
- package/dist/{chunk-WP55NYFS.js → chunk-LQVHD4FS.js} +71 -19
- package/dist/chunk-LQVHD4FS.js.map +1 -0
- package/dist/chunk-M57PSU4O.mjs +36 -0
- package/dist/chunk-M57PSU4O.mjs.map +1 -0
- package/dist/{chunk-YHMHDPLQ.mjs → chunk-PFJKVNUA.mjs} +69 -17
- package/dist/chunk-PFJKVNUA.mjs.map +1 -0
- package/dist/{chunk-677DWENS.mjs → chunk-THFHTTQX.mjs} +64 -17
- package/dist/chunk-THFHTTQX.mjs.map +1 -0
- package/dist/chunk-U4W524VZ.mjs +334 -0
- package/dist/chunk-U4W524VZ.mjs.map +1 -0
- package/dist/{chunk-77UARJVQ.js → chunk-UUM656JE.js} +66 -19
- package/dist/chunk-UUM656JE.js.map +1 -0
- package/dist/{chunk-QQDQJ7TS.mjs → chunk-VJFXCN5Z.mjs} +50 -30
- package/dist/chunk-VJFXCN5Z.mjs.map +1 -0
- package/dist/{chunk-BHMFZTZ7.mjs → chunk-WNZHGFNC.mjs} +69 -17
- package/dist/chunk-WNZHGFNC.mjs.map +1 -0
- package/dist/chunk-YEPEMLM3.js +36 -0
- package/dist/chunk-YEPEMLM3.js.map +1 -0
- package/dist/{chunk-J2YW5DHC.mjs → chunk-ZKGWS327.mjs} +517 -545
- package/dist/chunk-ZKGWS327.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 +4 -3
- package/dist/components/viewers/AudioViewer.js.map +1 -1
- package/dist/components/viewers/AudioViewer.mjs +3 -2
- package/dist/components/viewers/DefaultViewer.d.mts +1 -1
- package/dist/components/viewers/DefaultViewer.d.ts +1 -1
- package/dist/components/viewers/DefaultViewer.js +4 -3
- package/dist/components/viewers/DefaultViewer.js.map +1 -1
- package/dist/components/viewers/DefaultViewer.mjs +3 -2
- package/dist/components/viewers/ImageViewer.d.mts +1 -1
- package/dist/components/viewers/ImageViewer.d.ts +1 -1
- package/dist/components/viewers/ImageViewer.js +4 -4
- package/dist/components/viewers/ImageViewer.mjs +3 -3
- package/dist/components/viewers/PDFViewer.d.mts +1 -1
- package/dist/components/viewers/PDFViewer.d.ts +1 -1
- package/dist/components/viewers/PDFViewer.js +5 -3
- package/dist/components/viewers/PDFViewer.js.map +1 -1
- package/dist/components/viewers/PDFViewer.mjs +4 -2
- package/dist/components/viewers/TIFFViewer.d.mts +1 -1
- package/dist/components/viewers/TIFFViewer.d.ts +1 -1
- package/dist/components/viewers/TIFFViewer.js +4 -3
- package/dist/components/viewers/TIFFViewer.js.map +1 -1
- package/dist/components/viewers/TIFFViewer.mjs +3 -2
- package/dist/components/viewers/TextViewer.d.mts +1 -1
- package/dist/components/viewers/TextViewer.d.ts +1 -1
- package/dist/components/viewers/TextViewer.js +4 -3
- package/dist/components/viewers/TextViewer.js.map +1 -1
- package/dist/components/viewers/TextViewer.mjs +3 -2
- package/dist/components/viewers/VideoViewer.d.mts +1 -1
- package/dist/components/viewers/VideoViewer.d.ts +1 -1
- package/dist/components/viewers/VideoViewer.js +4 -3
- package/dist/components/viewers/VideoViewer.js.map +1 -1
- package/dist/components/viewers/VideoViewer.mjs +3 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{types-C6IEfcTM.d.mts → types-BmZB9kkJ.d.mts} +13 -1
- package/dist/{types-C6IEfcTM.d.ts → types-BmZB9kkJ.d.ts} +13 -1
- package/package.json +1 -1
- package/dist/chunk-4DJJINTB.mjs.map +0 -1
- package/dist/chunk-677DWENS.mjs.map +0 -1
- package/dist/chunk-77UARJVQ.js.map +0 -1
- package/dist/chunk-7BLEPGZ4.mjs.map +0 -1
- package/dist/chunk-BHMFZTZ7.mjs.map +0 -1
- package/dist/chunk-BONT4K3R.mjs +0 -294
- package/dist/chunk-BONT4K3R.mjs.map +0 -1
- package/dist/chunk-DDT3GC3C.js.map +0 -1
- package/dist/chunk-DOOYIHGW.js.map +0 -1
- package/dist/chunk-J2YW5DHC.mjs.map +0 -1
- package/dist/chunk-QQDQJ7TS.mjs.map +0 -1
- package/dist/chunk-RE4XRGSV.js.map +0 -1
- package/dist/chunk-SBEFC7HP.js.map +0 -1
- package/dist/chunk-SNEIVT4R.js.map +0 -1
- package/dist/chunk-WP55NYFS.js.map +0 -1
- package/dist/chunk-YHMHDPLQ.mjs.map +0 -1
- package/dist/chunk-Z3IUTTJQ.js +0 -294
- package/dist/chunk-Z3IUTTJQ.js.map +0 -1
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _chunkA2MSWOEMjs = require('./chunk-A2MSWOEM.js');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
var _chunkYEPEMLM3js = require('./chunk-YEPEMLM3.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkFA5L62Y5js = require('./chunk-FA5L62Y5.js');
|
|
6
12
|
|
|
7
13
|
// src/components/viewers/PDFViewer.tsx
|
|
8
|
-
var _react = require('react');
|
|
14
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
15
|
+
|
|
16
|
+
// src/components/viewers/pdf/StablePDFViewer.tsx
|
|
17
|
+
|
|
9
18
|
var _pdfviewer = require('@cannyminds/pdf-viewer');
|
|
19
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
20
|
+
var HeadlessPDFViewer = _pdfviewer.PDFViewer;
|
|
21
|
+
var StablePDFViewer = _react2.default.memo(({
|
|
22
|
+
pdfBuffer,
|
|
23
|
+
onPasswordRequest,
|
|
24
|
+
pdfViewerRef
|
|
25
|
+
}) => {
|
|
26
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
27
|
+
HeadlessPDFViewer,
|
|
28
|
+
{
|
|
29
|
+
ref: pdfViewerRef,
|
|
30
|
+
pdfBuffer,
|
|
31
|
+
onPasswordRequest
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
StablePDFViewer.displayName = "StablePDFViewer";
|
|
36
|
+
|
|
37
|
+
// src/components/viewers/pdf/PDFToolbar.tsx
|
|
38
|
+
|
|
10
39
|
var _FirstPage = require('@mui/icons-material/FirstPage'); var _FirstPage2 = _interopRequireDefault(_FirstPage);
|
|
11
40
|
var _LastPage = require('@mui/icons-material/LastPage'); var _LastPage2 = _interopRequireDefault(_LastPage);
|
|
12
41
|
var _ChevronLeft = require('@mui/icons-material/ChevronLeft'); var _ChevronLeft2 = _interopRequireDefault(_ChevronLeft);
|
|
@@ -16,11 +45,239 @@ var _ZoomOut = require('@mui/icons-material/ZoomOut'); var _ZoomOut2 = _interopR
|
|
|
16
45
|
var _FitScreen = require('@mui/icons-material/FitScreen'); var _FitScreen2 = _interopRequireDefault(_FitScreen);
|
|
17
46
|
var _AspectRatio = require('@mui/icons-material/AspectRatio'); var _AspectRatio2 = _interopRequireDefault(_AspectRatio);
|
|
18
47
|
var _Search = require('@mui/icons-material/Search'); var _Search2 = _interopRequireDefault(_Search);
|
|
48
|
+
var _Fullscreen = require('@mui/icons-material/Fullscreen'); var _Fullscreen2 = _interopRequireDefault(_Fullscreen);
|
|
19
49
|
var _Download = require('@mui/icons-material/Download'); var _Download2 = _interopRequireDefault(_Download);
|
|
20
50
|
var _Print = require('@mui/icons-material/Print'); var _Print2 = _interopRequireDefault(_Print);
|
|
21
51
|
var _Info = require('@mui/icons-material/Info'); var _Info2 = _interopRequireDefault(_Info);
|
|
22
52
|
var _Description = require('@mui/icons-material/Description'); var _Description2 = _interopRequireDefault(_Description);
|
|
23
53
|
|
|
54
|
+
var PDFToolbar = _react2.default.memo(({
|
|
55
|
+
currentPage,
|
|
56
|
+
totalPages,
|
|
57
|
+
zoom,
|
|
58
|
+
isSidebarOpen,
|
|
59
|
+
showPageNavigation,
|
|
60
|
+
showPageCount,
|
|
61
|
+
showZoomControls,
|
|
62
|
+
showSearch,
|
|
63
|
+
showMetadata,
|
|
64
|
+
showProperties,
|
|
65
|
+
showDownload,
|
|
66
|
+
showPrint,
|
|
67
|
+
disabledMetadata,
|
|
68
|
+
disabledProperties,
|
|
69
|
+
disabledDownload,
|
|
70
|
+
disabledPrint,
|
|
71
|
+
onFirstPage,
|
|
72
|
+
onPreviousPage,
|
|
73
|
+
onNextPage,
|
|
74
|
+
onLastPage,
|
|
75
|
+
onPageInput,
|
|
76
|
+
onPageInputKeyPress,
|
|
77
|
+
onZoomIn,
|
|
78
|
+
onZoomOut,
|
|
79
|
+
onFitToWidth,
|
|
80
|
+
onFitToPage,
|
|
81
|
+
onToggleSidebar,
|
|
82
|
+
onToggleFullScreen,
|
|
83
|
+
onDownloadClick,
|
|
84
|
+
onPrintClick,
|
|
85
|
+
onMetadataClick,
|
|
86
|
+
onPropertiesClick
|
|
87
|
+
}) => {
|
|
88
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar", children: [
|
|
89
|
+
showPageNavigation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
90
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
91
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
92
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
className: "toolbar-button",
|
|
96
|
+
onClick: onFirstPage,
|
|
97
|
+
disabled: currentPage <= 1,
|
|
98
|
+
title: "First Page",
|
|
99
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FirstPage2.default, { fontSize: "small" })
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
103
|
+
"button",
|
|
104
|
+
{
|
|
105
|
+
className: "toolbar-button",
|
|
106
|
+
onClick: onPreviousPage,
|
|
107
|
+
disabled: currentPage <= 1,
|
|
108
|
+
title: "Previous Page",
|
|
109
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronLeft2.default, { fontSize: "small" })
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
113
|
+
"input",
|
|
114
|
+
{
|
|
115
|
+
type: "number",
|
|
116
|
+
className: "page-input",
|
|
117
|
+
value: currentPage,
|
|
118
|
+
onChange: onPageInput,
|
|
119
|
+
onKeyPress: onPageInputKeyPress,
|
|
120
|
+
min: 1,
|
|
121
|
+
max: totalPages || void 0
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
showPageCount && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "page-info", children: [
|
|
125
|
+
"of ",
|
|
126
|
+
totalPages || "..."
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
className: "toolbar-button",
|
|
132
|
+
onClick: onNextPage,
|
|
133
|
+
disabled: currentPage >= totalPages,
|
|
134
|
+
title: "Next Page",
|
|
135
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronRight2.default, { fontSize: "small" })
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
className: "toolbar-button",
|
|
142
|
+
onClick: onLastPage,
|
|
143
|
+
disabled: currentPage >= totalPages,
|
|
144
|
+
title: "Last Page",
|
|
145
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LastPage2.default, { fontSize: "small" })
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] })
|
|
149
|
+
] }),
|
|
150
|
+
showZoomControls && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
151
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
152
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
154
|
+
"button",
|
|
155
|
+
{
|
|
156
|
+
className: "toolbar-button",
|
|
157
|
+
onClick: onZoomOut,
|
|
158
|
+
title: "Zoom Out",
|
|
159
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomOut2.default, { fontSize: "small" })
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "zoom-display", children: [
|
|
163
|
+
zoom,
|
|
164
|
+
"%"
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
167
|
+
"button",
|
|
168
|
+
{
|
|
169
|
+
className: "toolbar-button",
|
|
170
|
+
onClick: onZoomIn,
|
|
171
|
+
title: "Zoom In",
|
|
172
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomIn2.default, { fontSize: "small" })
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
176
|
+
"button",
|
|
177
|
+
{
|
|
178
|
+
className: "toolbar-button",
|
|
179
|
+
onClick: onFitToWidth,
|
|
180
|
+
title: "Fit to Width",
|
|
181
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AspectRatio2.default, { fontSize: "small" })
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
className: "toolbar-button",
|
|
188
|
+
onClick: onFitToPage,
|
|
189
|
+
title: "Fit to Page",
|
|
190
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FitScreen2.default, { fontSize: "small" })
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] })
|
|
194
|
+
] }),
|
|
195
|
+
showSearch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
196
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
197
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
198
|
+
"button",
|
|
199
|
+
{
|
|
200
|
+
className: "toolbar-button",
|
|
201
|
+
onClick: onToggleSidebar,
|
|
202
|
+
title: "Search in PDF",
|
|
203
|
+
style: {
|
|
204
|
+
backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
|
|
205
|
+
color: isSidebarOpen ? "#1976d2" : "inherit"
|
|
206
|
+
},
|
|
207
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { fontSize: "small" })
|
|
208
|
+
}
|
|
209
|
+
) })
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
213
|
+
"button",
|
|
214
|
+
{
|
|
215
|
+
className: "toolbar-button",
|
|
216
|
+
onClick: onToggleFullScreen,
|
|
217
|
+
title: "Fullscreen",
|
|
218
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Fullscreen2.default, { fontSize: "small" })
|
|
219
|
+
}
|
|
220
|
+
) }),
|
|
221
|
+
(showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
223
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
224
|
+
showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
225
|
+
"button",
|
|
226
|
+
{
|
|
227
|
+
className: "toolbar-button",
|
|
228
|
+
onClick: onDownloadClick,
|
|
229
|
+
disabled: disabledDownload,
|
|
230
|
+
title: "Download PDF",
|
|
231
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
showPrint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
235
|
+
"button",
|
|
236
|
+
{
|
|
237
|
+
className: "toolbar-button",
|
|
238
|
+
onClick: onPrintClick,
|
|
239
|
+
disabled: disabledPrint,
|
|
240
|
+
title: "Print PDF",
|
|
241
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
showMetadata && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
className: "toolbar-button",
|
|
248
|
+
onClick: onMetadataClick,
|
|
249
|
+
disabled: disabledMetadata,
|
|
250
|
+
title: "Document Metadata",
|
|
251
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
className: "toolbar-button",
|
|
258
|
+
onClick: onPropertiesClick,
|
|
259
|
+
disabled: disabledProperties,
|
|
260
|
+
title: "Document Properties",
|
|
261
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
] })
|
|
265
|
+
] })
|
|
266
|
+
] });
|
|
267
|
+
});
|
|
268
|
+
PDFToolbar.displayName = "PDFToolbar";
|
|
269
|
+
|
|
270
|
+
// src/components/viewers/pdf/PDFHeader.tsx
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
var PDFHeader = _react2.default.memo(({ fileName, fileExtension }) => {
|
|
274
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-header", children: [
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFA5L62Y5js.FileIcon_default, { ext: fileExtension, size: 26 }),
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "header-file-name", title: fileName, children: fileName })
|
|
277
|
+
] });
|
|
278
|
+
});
|
|
279
|
+
PDFHeader.displayName = "PDFHeader";
|
|
280
|
+
|
|
24
281
|
// src/components/viewers/pdf/SearchSidebar.tsx
|
|
25
282
|
|
|
26
283
|
|
|
@@ -37,7 +294,7 @@ var _KeyboardArrowUp = require('@mui/icons-material/KeyboardArrowUp'); var _Keyb
|
|
|
37
294
|
var _KeyboardArrowDown = require('@mui/icons-material/KeyboardArrowDown'); var _KeyboardArrowDown2 = _interopRequireDefault(_KeyboardArrowDown);
|
|
38
295
|
var _Clear = require('@mui/icons-material/Clear'); var _Clear2 = _interopRequireDefault(_Clear);
|
|
39
296
|
var _FindInPage = require('@mui/icons-material/FindInPage'); var _FindInPage2 = _interopRequireDefault(_FindInPage);
|
|
40
|
-
|
|
297
|
+
|
|
41
298
|
var SearchSidebar = ({
|
|
42
299
|
isOpen,
|
|
43
300
|
onClose,
|
|
@@ -663,158 +920,6 @@ var PasswordDialog = ({
|
|
|
663
920
|
|
|
664
921
|
// src/components/viewers/PDFViewer.tsx
|
|
665
922
|
|
|
666
|
-
var HeadlessPDFViewer = _pdfviewer.PDFViewer;
|
|
667
|
-
var toolbarStyles = `
|
|
668
|
-
@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');
|
|
669
|
-
|
|
670
|
-
* {
|
|
671
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
672
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
673
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
674
|
-
'Arial Unicode MS', sans-serif !important;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/* Target PDF.js text layer */
|
|
678
|
-
.textLayer,
|
|
679
|
-
.textLayer span,
|
|
680
|
-
.textLayer div,
|
|
681
|
-
[class*="pdf"],
|
|
682
|
-
[class*="page"],
|
|
683
|
-
canvas + div,
|
|
684
|
-
.embedpdf-viewport *,
|
|
685
|
-
[data-pdf-viewer] *,
|
|
686
|
-
[role="document"] * {
|
|
687
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
688
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
689
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
690
|
-
'Arial Unicode MS', sans-serif !important;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
.pdf-viewer-header {
|
|
694
|
-
display: flex;
|
|
695
|
-
align-items: center;
|
|
696
|
-
justify-content: flex-start;
|
|
697
|
-
gap: 8px;
|
|
698
|
-
padding: 3px 16px 0 16px;
|
|
699
|
-
background: #fff;
|
|
700
|
-
min-height: 36px;
|
|
701
|
-
}
|
|
702
|
-
.header-file-name {
|
|
703
|
-
font-size: 12px;
|
|
704
|
-
font-weight: 500;
|
|
705
|
-
color: #424242;
|
|
706
|
-
white-space: nowrap;
|
|
707
|
-
overflow: hidden;
|
|
708
|
-
text-overflow: ellipsis;
|
|
709
|
-
max-width: 400px;
|
|
710
|
-
}
|
|
711
|
-
.pdf-viewer-toolbar {
|
|
712
|
-
display: flex;
|
|
713
|
-
align-items: center;
|
|
714
|
-
justify-content: center;
|
|
715
|
-
padding: 0 16px 6px 16px;
|
|
716
|
-
background: #fff;
|
|
717
|
-
gap: 12px;
|
|
718
|
-
flex-wrap: wrap;
|
|
719
|
-
min-height: 44px;
|
|
720
|
-
}
|
|
721
|
-
.toolbar-section {
|
|
722
|
-
display: flex;
|
|
723
|
-
align-items: center;
|
|
724
|
-
gap: 8px;
|
|
725
|
-
}
|
|
726
|
-
.toolbar-separator {
|
|
727
|
-
width: 1px;
|
|
728
|
-
height: 24px;
|
|
729
|
-
background: #e0e0e0;
|
|
730
|
-
margin: 0 4px;
|
|
731
|
-
}
|
|
732
|
-
.toolbar-button {
|
|
733
|
-
padding: 8px;
|
|
734
|
-
border: none;
|
|
735
|
-
background: transparent;
|
|
736
|
-
cursor: pointer;
|
|
737
|
-
border-radius: 4px;
|
|
738
|
-
display: flex;
|
|
739
|
-
align-items: center;
|
|
740
|
-
justify-content: center;
|
|
741
|
-
transition: background 0.2s;
|
|
742
|
-
}
|
|
743
|
-
.toolbar-button:hover:not(:disabled) {
|
|
744
|
-
background: #f5f5f5;
|
|
745
|
-
}
|
|
746
|
-
.toolbar-button:disabled {
|
|
747
|
-
opacity: 0.4;
|
|
748
|
-
cursor: not-allowed;
|
|
749
|
-
}
|
|
750
|
-
.toolbar-button svg {
|
|
751
|
-
width: 20px;
|
|
752
|
-
height: 20px;
|
|
753
|
-
display: block;
|
|
754
|
-
}
|
|
755
|
-
.page-input {
|
|
756
|
-
width: 60px;
|
|
757
|
-
padding: 4px 8px;
|
|
758
|
-
border: 1px solid #e0e0e0;
|
|
759
|
-
border-radius: 4px;
|
|
760
|
-
text-align: center;
|
|
761
|
-
font-size: 14px;
|
|
762
|
-
}
|
|
763
|
-
.page-info {
|
|
764
|
-
font-size: 14px;
|
|
765
|
-
color: #666;
|
|
766
|
-
white-space: nowrap;
|
|
767
|
-
}
|
|
768
|
-
.zoom-display {
|
|
769
|
-
min-width: 60px;
|
|
770
|
-
text-align: center;
|
|
771
|
-
font-size: 14px;
|
|
772
|
-
color: #666;
|
|
773
|
-
}
|
|
774
|
-
.search-input {
|
|
775
|
-
padding: 4px 8px;
|
|
776
|
-
border: 1px solid #e0e0e0;
|
|
777
|
-
border-radius: 4px;
|
|
778
|
-
font-size: 14px;
|
|
779
|
-
min-width: 200px;
|
|
780
|
-
}
|
|
781
|
-
.pdf-viewer-content {
|
|
782
|
-
flex: 1;
|
|
783
|
-
overflow: hidden;
|
|
784
|
-
position: relative;
|
|
785
|
-
user-select: text;
|
|
786
|
-
-webkit-user-select: text;
|
|
787
|
-
-moz-user-select: text;
|
|
788
|
-
-ms-user-select: text;
|
|
789
|
-
}
|
|
790
|
-
.pdf-viewer-container {
|
|
791
|
-
display: flex;
|
|
792
|
-
flex-direction: column;
|
|
793
|
-
height: 100%;
|
|
794
|
-
width: 100%;
|
|
795
|
-
}
|
|
796
|
-
.pdf-viewer-main {
|
|
797
|
-
display: flex;
|
|
798
|
-
flex: 1;
|
|
799
|
-
overflow: hidden;
|
|
800
|
-
position: relative;
|
|
801
|
-
}
|
|
802
|
-
.pdf-viewer-viewer-area {
|
|
803
|
-
flex: 1;
|
|
804
|
-
overflow: hidden;
|
|
805
|
-
position: relative;
|
|
806
|
-
user-select: text;
|
|
807
|
-
-webkit-user-select: text;
|
|
808
|
-
-moz-user-select: text;
|
|
809
|
-
-ms-user-select: text;
|
|
810
|
-
}
|
|
811
|
-
.pdf-viewer-viewer-area * {
|
|
812
|
-
user-select: text !important;
|
|
813
|
-
-webkit-user-select: text !important;
|
|
814
|
-
-moz-user-select: text !important;
|
|
815
|
-
-ms-user-select: text !important;
|
|
816
|
-
}
|
|
817
|
-
`;
|
|
818
923
|
var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
819
924
|
const {
|
|
820
925
|
file,
|
|
@@ -850,7 +955,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
850
955
|
return "document.pdf";
|
|
851
956
|
}, [file, fileName]);
|
|
852
957
|
const fileExtension = _react.useMemo.call(void 0,
|
|
853
|
-
() =>
|
|
958
|
+
() => _chunkYEPEMLM3js.getFileExtension.call(void 0, resolvedFileName),
|
|
854
959
|
[resolvedFileName]
|
|
855
960
|
);
|
|
856
961
|
const [currentPage, setCurrentPage] = _react.useState.call(void 0, 1);
|
|
@@ -864,9 +969,137 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
864
969
|
const [currentSearchResultIndex, setCurrentSearchResultIndex] = _react.useState.call(void 0, 0);
|
|
865
970
|
const [totalSearchResults, setTotalSearchResults] = _react.useState.call(void 0, 0);
|
|
866
971
|
const [autoExecuteSearch, setAutoExecuteSearch] = _react.useState.call(void 0, !!initialSearchText);
|
|
972
|
+
const [isFullScreen, setIsFullScreen] = _react.useState.call(void 0, false);
|
|
973
|
+
const containerRef = _react.useRef.call(void 0, null);
|
|
867
974
|
const [isPasswordDialogOpen, setIsPasswordDialogOpen] = _react.useState.call(void 0, false);
|
|
868
975
|
const [passwordError, setPasswordError] = _react.useState.call(void 0, "");
|
|
869
976
|
const [passwordResolve, setPasswordResolve] = _react.useState.call(void 0, null);
|
|
977
|
+
const hasExecutedInitialSearch = _react.useRef.call(void 0, false);
|
|
978
|
+
const handleToggleFullScreen = _react.useCallback.call(void 0, () => {
|
|
979
|
+
if (!isFullScreen && _optionalChain([containerRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.requestFullscreen])) {
|
|
980
|
+
containerRef.current.requestFullscreen();
|
|
981
|
+
setIsFullScreen(true);
|
|
982
|
+
} else if (isFullScreen && document.exitFullscreen) {
|
|
983
|
+
document.exitFullscreen();
|
|
984
|
+
setIsFullScreen(false);
|
|
985
|
+
}
|
|
986
|
+
}, [isFullScreen]);
|
|
987
|
+
const toolbar = _chunkFA5L62Y5js.mergeToolbarConfig.call(void 0, {
|
|
988
|
+
showDownload,
|
|
989
|
+
showPrint,
|
|
990
|
+
showMetadata,
|
|
991
|
+
showProperties,
|
|
992
|
+
onDownloadClick,
|
|
993
|
+
onPrintClick,
|
|
994
|
+
onMetadataClick,
|
|
995
|
+
onPropertiesClick,
|
|
996
|
+
toolbarActions: props.toolbarActions
|
|
997
|
+
});
|
|
998
|
+
const toolbarHandlers = _react.useMemo.call(void 0, () => ({
|
|
999
|
+
handleZoomIn: () => {
|
|
1000
|
+
_optionalChain([pdfViewerRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.zoom, 'access', _5 => _5.zoomIn, 'call', _6 => _6()]);
|
|
1001
|
+
requestAnimationFrame(() => {
|
|
1002
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.zoom, 'access', _9 => _9.getZoom, 'call', _10 => _10()]);
|
|
1003
|
+
if (typeof zoomValue === "number") {
|
|
1004
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
},
|
|
1008
|
+
handleZoomOut: () => {
|
|
1009
|
+
_optionalChain([pdfViewerRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.zoom, 'access', _13 => _13.zoomOut, 'call', _14 => _14()]);
|
|
1010
|
+
requestAnimationFrame(() => {
|
|
1011
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.zoom, 'access', _17 => _17.getZoom, 'call', _18 => _18()]);
|
|
1012
|
+
if (typeof zoomValue === "number") {
|
|
1013
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
},
|
|
1017
|
+
handleFitToWidth: () => {
|
|
1018
|
+
_optionalChain([pdfViewerRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.zoom, 'access', _21 => _21.fitToWidth, 'call', _22 => _22()]);
|
|
1019
|
+
requestAnimationFrame(() => {
|
|
1020
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.zoom, 'access', _25 => _25.getZoom, 'call', _26 => _26()]);
|
|
1021
|
+
if (typeof zoomValue === "number") {
|
|
1022
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
},
|
|
1026
|
+
handleFitToPage: () => {
|
|
1027
|
+
_optionalChain([pdfViewerRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.zoom, 'access', _29 => _29.fitToPage, 'call', _30 => _30()]);
|
|
1028
|
+
requestAnimationFrame(() => {
|
|
1029
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.zoom, 'access', _33 => _33.getZoom, 'call', _34 => _34()]);
|
|
1030
|
+
if (typeof zoomValue === "number") {
|
|
1031
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
},
|
|
1035
|
+
handlePreviousPage: () => {
|
|
1036
|
+
_optionalChain([pdfViewerRef, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.navigation, 'access', _37 => _37.previousPage, 'call', _38 => _38()]);
|
|
1037
|
+
requestAnimationFrame(() => {
|
|
1038
|
+
const current = _optionalChain([pdfViewerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.navigation, 'access', _41 => _41.getCurrentPage, 'call', _42 => _42()]) || 1;
|
|
1039
|
+
setCurrentPage(current);
|
|
1040
|
+
});
|
|
1041
|
+
},
|
|
1042
|
+
handleNextPage: () => {
|
|
1043
|
+
_optionalChain([pdfViewerRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.navigation, 'access', _45 => _45.nextPage, 'call', _46 => _46()]);
|
|
1044
|
+
requestAnimationFrame(() => {
|
|
1045
|
+
const current = _optionalChain([pdfViewerRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.navigation, 'access', _49 => _49.getCurrentPage, 'call', _50 => _50()]) || 1;
|
|
1046
|
+
setCurrentPage(current);
|
|
1047
|
+
});
|
|
1048
|
+
},
|
|
1049
|
+
handleFirstPage: () => {
|
|
1050
|
+
_optionalChain([pdfViewerRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.navigation, 'access', _53 => _53.goToFirstPage, 'call', _54 => _54()]);
|
|
1051
|
+
requestAnimationFrame(() => {
|
|
1052
|
+
const current = _optionalChain([pdfViewerRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.navigation, 'access', _57 => _57.getCurrentPage, 'call', _58 => _58()]) || 1;
|
|
1053
|
+
setCurrentPage(current);
|
|
1054
|
+
});
|
|
1055
|
+
},
|
|
1056
|
+
handleLastPage: () => {
|
|
1057
|
+
_optionalChain([pdfViewerRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.navigation, 'access', _61 => _61.goToLastPage, 'call', _62 => _62()]);
|
|
1058
|
+
requestAnimationFrame(() => {
|
|
1059
|
+
const current = _optionalChain([pdfViewerRef, 'access', _63 => _63.current, 'optionalAccess', _64 => _64.navigation, 'access', _65 => _65.getCurrentPage, 'call', _66 => _66()]) || 1;
|
|
1060
|
+
setCurrentPage(current);
|
|
1061
|
+
});
|
|
1062
|
+
},
|
|
1063
|
+
toggleSidebar: () => setIsSidebarOpen(!isSidebarOpen),
|
|
1064
|
+
handlePageInput: (e) => {
|
|
1065
|
+
const value = e.target.value;
|
|
1066
|
+
if (/^\d*$/.test(value)) {
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
const page = parseInt(value, 10);
|
|
1070
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1071
|
+
_optionalChain([pdfViewerRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.navigation, 'access', _69 => _69.goToPage, 'call', _70 => _70(page)]);
|
|
1072
|
+
setCurrentPage(page);
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
handlePageInputKeyPress: (e) => {
|
|
1076
|
+
if (e.key === "Enter") {
|
|
1077
|
+
const value = e.target.value;
|
|
1078
|
+
const page = parseInt(value, 10);
|
|
1079
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1080
|
+
_optionalChain([pdfViewerRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.navigation, 'access', _73 => _73.goToPage, 'call', _74 => _74(page)]);
|
|
1081
|
+
setCurrentPage(page);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
handleToggleFullScreen
|
|
1086
|
+
}), [isSidebarOpen, totalPages, handleToggleFullScreen]);
|
|
1087
|
+
_react.useEffect.call(void 0, () => {
|
|
1088
|
+
console.log("came", initialSearchText, pdfViewerRef.current, hasExecutedInitialSearch.current);
|
|
1089
|
+
if (pdfViewerRef.current && !hasExecutedInitialSearch.current && initialSearchText) {
|
|
1090
|
+
hasExecutedInitialSearch.current = true;
|
|
1091
|
+
setIsSidebarOpen(true);
|
|
1092
|
+
setSearchQuery(initialSearchText);
|
|
1093
|
+
handleSidebarSearch(initialSearchText, initialSearchPages);
|
|
1094
|
+
setAutoExecuteSearch(false);
|
|
1095
|
+
pdfViewerRef.current.search.searchText(initialSearchText).then((results) => {
|
|
1096
|
+
console.log("results", results);
|
|
1097
|
+
if (_optionalChain([results, 'optionalAccess', _75 => _75.results, 'optionalAccess', _76 => _76.length]) > 0) {
|
|
1098
|
+
_optionalChain([pdfViewerRef, 'access', _77 => _77.current, 'optionalAccess', _78 => _78.navigation, 'access', _79 => _79.goToPage, 'call', _80 => _80(results.results[0].pageIndex + 1)]);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
}, [pdfViewerRef.current, initialSearchText]);
|
|
870
1103
|
_react.useEffect.call(void 0, () => {
|
|
871
1104
|
setSearchQuery("");
|
|
872
1105
|
setSearchResults([]);
|
|
@@ -914,7 +1147,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
914
1147
|
if (!viewer) return;
|
|
915
1148
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
916
1149
|
try {
|
|
917
|
-
const count = _optionalChain([viewer, 'access',
|
|
1150
|
+
const count = _optionalChain([viewer, 'access', _81 => _81.navigation, 'optionalAccess', _82 => _82.getTotalPages, 'optionalCall', _83 => _83()]);
|
|
918
1151
|
if (count && count > 1) {
|
|
919
1152
|
setTotalPages(count);
|
|
920
1153
|
return;
|
|
@@ -922,11 +1155,11 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
922
1155
|
} catch (e) {
|
|
923
1156
|
}
|
|
924
1157
|
try {
|
|
925
|
-
const results = await _optionalChain([viewer, 'access',
|
|
926
|
-
if (_optionalChain([results, 'optionalAccess',
|
|
1158
|
+
const results = await _optionalChain([viewer, 'access', _84 => _84.search, 'optionalAccess', _85 => _85.searchText, 'optionalCall', _86 => _86("e")]);
|
|
1159
|
+
if (_optionalChain([results, 'optionalAccess', _87 => _87.results]) && results.results.length > 0) {
|
|
927
1160
|
const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
|
|
928
1161
|
const count = Math.max(...pageIndices) + 1;
|
|
929
|
-
_optionalChain([viewer, 'access',
|
|
1162
|
+
_optionalChain([viewer, 'access', _88 => _88.search, 'optionalAccess', _89 => _89.stopSearch, 'optionalCall', _90 => _90()]);
|
|
930
1163
|
setTotalPages(count);
|
|
931
1164
|
return;
|
|
932
1165
|
}
|
|
@@ -954,30 +1187,13 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
954
1187
|
};
|
|
955
1188
|
initializePageCount();
|
|
956
1189
|
}, [state, totalPages]);
|
|
957
|
-
_react.useEffect.call(void 0, () => {
|
|
958
|
-
if (state !== "ready" || !autoExecuteSearch || !initialSearchText) return;
|
|
959
|
-
const scheduleSearch = (callback) => {
|
|
960
|
-
if ("requestIdleCallback" in window) {
|
|
961
|
-
requestIdleCallback(callback, { timeout: 2e3 });
|
|
962
|
-
} else {
|
|
963
|
-
requestAnimationFrame(() => setTimeout(callback, 0));
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
scheduleSearch(() => {
|
|
967
|
-
if (!pdfViewerRef.current) return;
|
|
968
|
-
setIsSidebarOpen(true);
|
|
969
|
-
setSearchQuery(initialSearchText);
|
|
970
|
-
handleSidebarSearch(initialSearchText, initialSearchPages);
|
|
971
|
-
setAutoExecuteSearch(false);
|
|
972
|
-
});
|
|
973
|
-
}, [state, autoExecuteSearch, initialSearchText, initialSearchPages]);
|
|
974
1190
|
_react.useEffect.call(void 0, () => {
|
|
975
1191
|
if (state === "ready" && pdfViewerRef.current) {
|
|
976
1192
|
const updateInfo = () => {
|
|
977
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
978
|
-
const total = _optionalChain([pdfViewerRef, 'access',
|
|
979
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
980
|
-
const currentSearchState = _optionalChain([pdfViewerRef, 'access',
|
|
1193
|
+
const current = _optionalChain([pdfViewerRef, 'access', _91 => _91.current, 'optionalAccess', _92 => _92.navigation, 'access', _93 => _93.getCurrentPage, 'call', _94 => _94()]) || 1;
|
|
1194
|
+
const total = _optionalChain([pdfViewerRef, 'access', _95 => _95.current, 'optionalAccess', _96 => _96.navigation, 'access', _97 => _97.getTotalPages, 'call', _98 => _98()]) || 0;
|
|
1195
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _99 => _99.current, 'optionalAccess', _100 => _100.zoom, 'access', _101 => _101.getZoom, 'call', _102 => _102()]);
|
|
1196
|
+
const currentSearchState = _optionalChain([pdfViewerRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.search, 'access', _105 => _105.getSearchState, 'call', _106 => _106()]);
|
|
981
1197
|
setCurrentPage(current);
|
|
982
1198
|
if (total > 0 && total !== totalPages) {
|
|
983
1199
|
setTotalPages(total);
|
|
@@ -993,142 +1209,89 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
993
1209
|
}, [state, totalPages]);
|
|
994
1210
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
995
1211
|
zoomIn: () => {
|
|
996
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1212
|
+
_optionalChain([pdfViewerRef, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.zoom, 'access', _109 => _109.zoomIn, 'call', _110 => _110()]);
|
|
997
1213
|
updateZoomDisplay();
|
|
998
1214
|
},
|
|
999
1215
|
zoomOut: () => {
|
|
1000
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1216
|
+
_optionalChain([pdfViewerRef, 'access', _111 => _111.current, 'optionalAccess', _112 => _112.zoom, 'access', _113 => _113.zoomOut, 'call', _114 => _114()]);
|
|
1001
1217
|
updateZoomDisplay();
|
|
1002
1218
|
},
|
|
1003
1219
|
setZoom: (level) => {
|
|
1004
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1220
|
+
_optionalChain([pdfViewerRef, 'access', _115 => _115.current, 'optionalAccess', _116 => _116.zoom, 'access', _117 => _117.setZoom, 'call', _118 => _118(level)]);
|
|
1005
1221
|
updateZoomDisplay();
|
|
1006
1222
|
},
|
|
1007
1223
|
resetZoom: () => {
|
|
1008
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1224
|
+
_optionalChain([pdfViewerRef, 'access', _119 => _119.current, 'optionalAccess', _120 => _120.zoom, 'access', _121 => _121.resetZoom, 'call', _122 => _122()]);
|
|
1009
1225
|
updateZoomDisplay();
|
|
1010
1226
|
},
|
|
1011
1227
|
getZoom: () => {
|
|
1012
|
-
const zoom2 = _optionalChain([pdfViewerRef, 'access',
|
|
1228
|
+
const zoom2 = _optionalChain([pdfViewerRef, 'access', _123 => _123.current, 'optionalAccess', _124 => _124.zoom, 'access', _125 => _125.getZoom, 'call', _126 => _126()]);
|
|
1013
1229
|
return typeof zoom2 === "number" ? zoom2 : 1;
|
|
1014
1230
|
},
|
|
1015
1231
|
goToPage: (page) => {
|
|
1016
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1232
|
+
_optionalChain([pdfViewerRef, 'access', _127 => _127.current, 'optionalAccess', _128 => _128.navigation, 'access', _129 => _129.goToPage, 'call', _130 => _130(page)]);
|
|
1017
1233
|
setCurrentPage(page);
|
|
1018
1234
|
},
|
|
1019
|
-
getCurrentPage: () => _optionalChain([pdfViewerRef, 'access',
|
|
1020
|
-
getTotalPages: () => _optionalChain([pdfViewerRef, 'access',
|
|
1235
|
+
getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _131 => _131.current, 'optionalAccess', _132 => _132.navigation, 'access', _133 => _133.getCurrentPage, 'call', _134 => _134()]) || 1,
|
|
1236
|
+
getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _135 => _135.current, 'optionalAccess', _136 => _136.navigation, 'access', _137 => _137.getTotalPages, 'call', _138 => _138()]) || 0,
|
|
1021
1237
|
nextPage: () => {
|
|
1022
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1238
|
+
_optionalChain([pdfViewerRef, 'access', _139 => _139.current, 'optionalAccess', _140 => _140.navigation, 'access', _141 => _141.nextPage, 'call', _142 => _142()]);
|
|
1023
1239
|
updatePageDisplay();
|
|
1024
1240
|
},
|
|
1025
1241
|
previousPage: () => {
|
|
1026
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1242
|
+
_optionalChain([pdfViewerRef, 'access', _143 => _143.current, 'optionalAccess', _144 => _144.navigation, 'access', _145 => _145.previousPage, 'call', _146 => _146()]);
|
|
1027
1243
|
updatePageDisplay();
|
|
1028
1244
|
},
|
|
1029
1245
|
goToFirstPage: () => {
|
|
1030
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1246
|
+
_optionalChain([pdfViewerRef, 'access', _147 => _147.current, 'optionalAccess', _148 => _148.navigation, 'access', _149 => _149.goToFirstPage, 'call', _150 => _150()]);
|
|
1031
1247
|
updatePageDisplay();
|
|
1032
1248
|
},
|
|
1033
1249
|
goToLastPage: () => {
|
|
1034
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1250
|
+
_optionalChain([pdfViewerRef, 'access', _151 => _151.current, 'optionalAccess', _152 => _152.navigation, 'access', _153 => _153.goToLastPage, 'call', _154 => _154()]);
|
|
1035
1251
|
updatePageDisplay();
|
|
1036
1252
|
},
|
|
1037
1253
|
searchText: async (keyword) => {
|
|
1038
1254
|
setIsSearching(true);
|
|
1039
|
-
const results = await _optionalChain([pdfViewerRef, 'access',
|
|
1255
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _155 => _155.current, 'optionalAccess', _156 => _156.search, 'access', _157 => _157.searchText, 'call', _158 => _158(keyword)]);
|
|
1040
1256
|
setIsSearching(false);
|
|
1041
1257
|
setSearchQuery(keyword);
|
|
1042
1258
|
return results;
|
|
1043
1259
|
},
|
|
1044
1260
|
nextResult: () => {
|
|
1045
|
-
const index = _optionalChain([pdfViewerRef, 'access',
|
|
1261
|
+
const index = _optionalChain([pdfViewerRef, 'access', _159 => _159.current, 'optionalAccess', _160 => _160.search, 'access', _161 => _161.nextResult, 'call', _162 => _162()]) || -1;
|
|
1046
1262
|
return index;
|
|
1047
1263
|
},
|
|
1048
1264
|
previousResult: () => {
|
|
1049
|
-
const index = _optionalChain([pdfViewerRef, 'access',
|
|
1265
|
+
const index = _optionalChain([pdfViewerRef, 'access', _163 => _163.current, 'optionalAccess', _164 => _164.search, 'access', _165 => _165.previousResult, 'call', _166 => _166()]) || -1;
|
|
1050
1266
|
return index;
|
|
1051
1267
|
},
|
|
1052
|
-
goToResult: (index) => _optionalChain([pdfViewerRef, 'access',
|
|
1268
|
+
goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _167 => _167.current, 'optionalAccess', _168 => _168.search, 'access', _169 => _169.goToResult, 'call', _170 => _170(index)]) || -1,
|
|
1053
1269
|
stopSearch: () => {
|
|
1054
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1270
|
+
_optionalChain([pdfViewerRef, 'access', _171 => _171.current, 'optionalAccess', _172 => _172.search, 'access', _173 => _173.stopSearch, 'call', _174 => _174()]);
|
|
1055
1271
|
setSearchQuery("");
|
|
1056
1272
|
},
|
|
1057
|
-
getSearchState: () => _optionalChain([pdfViewerRef, 'access',
|
|
1058
|
-
getSelectedText: () => _optionalChain([pdfViewerRef, 'access',
|
|
1059
|
-
clearSelection: () => _optionalChain([pdfViewerRef, 'access',
|
|
1273
|
+
getSearchState: () => _optionalChain([pdfViewerRef, 'access', _175 => _175.current, 'optionalAccess', _176 => _176.search, 'access', _177 => _177.getSearchState, 'call', _178 => _178()]) || null,
|
|
1274
|
+
getSelectedText: () => _optionalChain([pdfViewerRef, 'access', _179 => _179.current, 'optionalAccess', _180 => _180.selection, 'access', _181 => _181.getSelectedText, 'call', _182 => _182()]) || "",
|
|
1275
|
+
clearSelection: () => _optionalChain([pdfViewerRef, 'access', _183 => _183.current, 'optionalAccess', _184 => _184.selection, 'access', _185 => _185.clearSelection, 'call', _186 => _186()])
|
|
1060
1276
|
}), []);
|
|
1061
1277
|
const updatePageDisplay = () => {
|
|
1062
1278
|
requestAnimationFrame(() => {
|
|
1063
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1279
|
+
const current = _optionalChain([pdfViewerRef, 'access', _187 => _187.current, 'optionalAccess', _188 => _188.navigation, 'access', _189 => _189.getCurrentPage, 'call', _190 => _190()]) || 1;
|
|
1064
1280
|
setCurrentPage(current);
|
|
1065
1281
|
});
|
|
1066
1282
|
};
|
|
1067
1283
|
const updateZoomDisplay = () => {
|
|
1068
1284
|
requestAnimationFrame(() => {
|
|
1069
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1285
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _191 => _191.current, 'optionalAccess', _192 => _192.zoom, 'access', _193 => _193.getZoom, 'call', _194 => _194()]);
|
|
1070
1286
|
if (typeof zoomValue === "number") {
|
|
1071
1287
|
setZoom(Math.round(zoomValue * 100));
|
|
1072
1288
|
}
|
|
1073
1289
|
});
|
|
1074
1290
|
};
|
|
1075
|
-
const handleZoomIn = () => {
|
|
1076
|
-
_optionalChain([pdfViewerRef, 'access', _115 => _115.current, 'optionalAccess', _116 => _116.zoom, 'access', _117 => _117.zoomIn, 'call', _118 => _118()]);
|
|
1077
|
-
updateZoomDisplay();
|
|
1078
|
-
};
|
|
1079
|
-
const handleZoomOut = () => {
|
|
1080
|
-
_optionalChain([pdfViewerRef, 'access', _119 => _119.current, 'optionalAccess', _120 => _120.zoom, 'access', _121 => _121.zoomOut, 'call', _122 => _122()]);
|
|
1081
|
-
updateZoomDisplay();
|
|
1082
|
-
};
|
|
1083
|
-
const handleFitToWidth = () => {
|
|
1084
|
-
_optionalChain([pdfViewerRef, 'access', _123 => _123.current, 'optionalAccess', _124 => _124.zoom, 'access', _125 => _125.fitToWidth, 'call', _126 => _126()]);
|
|
1085
|
-
updateZoomDisplay();
|
|
1086
|
-
};
|
|
1087
|
-
const handleFitToPage = () => {
|
|
1088
|
-
_optionalChain([pdfViewerRef, 'access', _127 => _127.current, 'optionalAccess', _128 => _128.zoom, 'access', _129 => _129.fitToPage, 'call', _130 => _130()]);
|
|
1089
|
-
updateZoomDisplay();
|
|
1090
|
-
};
|
|
1091
|
-
const handlePreviousPage = () => {
|
|
1092
|
-
_optionalChain([pdfViewerRef, 'access', _131 => _131.current, 'optionalAccess', _132 => _132.navigation, 'access', _133 => _133.previousPage, 'call', _134 => _134()]);
|
|
1093
|
-
updatePageDisplay();
|
|
1094
|
-
};
|
|
1095
|
-
const handleNextPage = () => {
|
|
1096
|
-
_optionalChain([pdfViewerRef, 'access', _135 => _135.current, 'optionalAccess', _136 => _136.navigation, 'access', _137 => _137.nextPage, 'call', _138 => _138()]);
|
|
1097
|
-
updatePageDisplay();
|
|
1098
|
-
};
|
|
1099
|
-
const handleFirstPage = () => {
|
|
1100
|
-
_optionalChain([pdfViewerRef, 'access', _139 => _139.current, 'optionalAccess', _140 => _140.navigation, 'access', _141 => _141.goToFirstPage, 'call', _142 => _142()]);
|
|
1101
|
-
updatePageDisplay();
|
|
1102
|
-
};
|
|
1103
|
-
const handleLastPage = () => {
|
|
1104
|
-
_optionalChain([pdfViewerRef, 'access', _143 => _143.current, 'optionalAccess', _144 => _144.navigation, 'access', _145 => _145.goToLastPage, 'call', _146 => _146()]);
|
|
1105
|
-
updatePageDisplay();
|
|
1106
|
-
};
|
|
1107
|
-
const handlePageInput = (e) => {
|
|
1108
|
-
const value = e.target.value;
|
|
1109
|
-
const page = parseInt(value, 10);
|
|
1110
|
-
if (/^\d*$/.test(value)) {
|
|
1111
|
-
return;
|
|
1112
|
-
}
|
|
1113
|
-
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1114
|
-
_optionalChain([pdfViewerRef, 'access', _147 => _147.current, 'optionalAccess', _148 => _148.navigation, 'access', _149 => _149.goToPage, 'call', _150 => _150(page)]);
|
|
1115
|
-
setCurrentPage(page);
|
|
1116
|
-
}
|
|
1117
|
-
};
|
|
1118
|
-
const handlePageInputKeyPress = (e) => {
|
|
1119
|
-
if (e.key === "Enter") {
|
|
1120
|
-
const value = e.target.value;
|
|
1121
|
-
const page = parseInt(value, 10);
|
|
1122
|
-
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1123
|
-
_optionalChain([pdfViewerRef, 'access', _151 => _151.current, 'optionalAccess', _152 => _152.navigation, 'access', _153 => _153.goToPage, 'call', _154 => _154(page)]);
|
|
1124
|
-
setCurrentPage(page);
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
};
|
|
1128
1291
|
const handleSearch = async () => {
|
|
1129
1292
|
if (searchQuery.trim()) {
|
|
1130
1293
|
setIsSearching(true);
|
|
1131
|
-
const results = await _optionalChain([pdfViewerRef, 'access',
|
|
1294
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _195 => _195.current, 'optionalAccess', _196 => _196.search, 'access', _197 => _197.searchText, 'call', _198 => _198(searchQuery)]);
|
|
1132
1295
|
setIsSearching(false);
|
|
1133
1296
|
if (results && results.results) {
|
|
1134
1297
|
const formattedResults = results.results.map((result, index) => {
|
|
@@ -1176,7 +1339,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1176
1339
|
setSearchQuery(keyword);
|
|
1177
1340
|
if (keyword.trim()) {
|
|
1178
1341
|
setIsSearching(true);
|
|
1179
|
-
const results = await _optionalChain([pdfViewerRef, 'access',
|
|
1342
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _199 => _199.current, 'optionalAccess', _200 => _200.search, 'access', _201 => _201.searchText, 'call', _202 => _202(keyword)]);
|
|
1180
1343
|
setIsSearching(false);
|
|
1181
1344
|
if (results && results.results && results.results.length > 0) {
|
|
1182
1345
|
const formattedResults = results.results.map((result, index) => {
|
|
@@ -1207,7 +1370,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1207
1370
|
setCurrentSearchResultIndex(0);
|
|
1208
1371
|
if (formattedResults.length > 0) {
|
|
1209
1372
|
const firstPageNumber = formattedResults[0].pageNumber;
|
|
1210
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1373
|
+
_optionalChain([pdfViewerRef, 'access', _203 => _203.current, 'optionalAccess', _204 => _204.navigation, 'access', _205 => _205.goToPage, 'call', _206 => _206(firstPageNumber)]);
|
|
1211
1374
|
setCurrentPage(firstPageNumber);
|
|
1212
1375
|
}
|
|
1213
1376
|
} else if (pageNumbers && pageNumbers.length > 0) {
|
|
@@ -1220,7 +1383,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1220
1383
|
setSearchResults(fallbackResults);
|
|
1221
1384
|
setTotalSearchResults(fallbackResults.length);
|
|
1222
1385
|
setCurrentSearchResultIndex(0);
|
|
1223
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1386
|
+
_optionalChain([pdfViewerRef, 'access', _207 => _207.current, 'optionalAccess', _208 => _208.navigation, 'access', _209 => _209.goToPage, 'call', _210 => _210(pageNumbers[0])]);
|
|
1224
1387
|
setCurrentPage(pageNumbers[0]);
|
|
1225
1388
|
} else {
|
|
1226
1389
|
setSearchResults([]);
|
|
@@ -1229,28 +1392,25 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1229
1392
|
}
|
|
1230
1393
|
} else {
|
|
1231
1394
|
setSearchResults([]);
|
|
1232
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1395
|
+
_optionalChain([pdfViewerRef, 'access', _211 => _211.current, 'optionalAccess', _212 => _212.search, 'access', _213 => _213.stopSearch, 'call', _214 => _214()]);
|
|
1233
1396
|
setTotalSearchResults(0);
|
|
1234
1397
|
setCurrentSearchResultIndex(0);
|
|
1235
1398
|
}
|
|
1236
1399
|
};
|
|
1237
1400
|
const handleSearchResultClick = (pageNumber, resultIndex) => {
|
|
1238
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1401
|
+
_optionalChain([pdfViewerRef, 'access', _215 => _215.current, 'optionalAccess', _216 => _216.navigation, 'access', _217 => _217.goToPage, 'call', _218 => _218(pageNumber)]);
|
|
1239
1402
|
setCurrentSearchResultIndex(resultIndex);
|
|
1240
1403
|
setCurrentPage(pageNumber);
|
|
1241
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1242
|
-
};
|
|
1243
|
-
const toggleSidebar = () => {
|
|
1244
|
-
setIsSidebarOpen(!isSidebarOpen);
|
|
1404
|
+
_optionalChain([pdfViewerRef, 'access', _219 => _219.current, 'optionalAccess', _220 => _220.search, 'access', _221 => _221.goToResult, 'call', _222 => _222(resultIndex)]);
|
|
1245
1405
|
};
|
|
1246
1406
|
const handleNextSearchResult = () => {
|
|
1247
1407
|
if (currentSearchResultIndex < totalSearchResults - 1) {
|
|
1248
1408
|
const nextIndex = currentSearchResultIndex + 1;
|
|
1249
1409
|
setCurrentSearchResultIndex(nextIndex);
|
|
1250
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1410
|
+
_optionalChain([pdfViewerRef, 'access', _223 => _223.current, 'optionalAccess', _224 => _224.search, 'access', _225 => _225.nextResult, 'call', _226 => _226()]);
|
|
1251
1411
|
if (searchResults[nextIndex]) {
|
|
1252
1412
|
const pageNumber = searchResults[nextIndex].pageNumber;
|
|
1253
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1413
|
+
_optionalChain([pdfViewerRef, 'access', _227 => _227.current, 'optionalAccess', _228 => _228.navigation, 'access', _229 => _229.goToPage, 'call', _230 => _230(pageNumber)]);
|
|
1254
1414
|
setCurrentPage(pageNumber);
|
|
1255
1415
|
}
|
|
1256
1416
|
}
|
|
@@ -1259,77 +1419,14 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1259
1419
|
if (currentSearchResultIndex > 0) {
|
|
1260
1420
|
const prevIndex = currentSearchResultIndex - 1;
|
|
1261
1421
|
setCurrentSearchResultIndex(prevIndex);
|
|
1262
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1422
|
+
_optionalChain([pdfViewerRef, 'access', _231 => _231.current, 'optionalAccess', _232 => _232.search, 'access', _233 => _233.previousResult, 'call', _234 => _234()]);
|
|
1263
1423
|
if (searchResults[prevIndex]) {
|
|
1264
1424
|
const pageNumber = searchResults[prevIndex].pageNumber;
|
|
1265
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1425
|
+
_optionalChain([pdfViewerRef, 'access', _235 => _235.current, 'optionalAccess', _236 => _236.navigation, 'access', _237 => _237.goToPage, 'call', _238 => _238(pageNumber)]);
|
|
1266
1426
|
setCurrentPage(pageNumber);
|
|
1267
1427
|
}
|
|
1268
1428
|
}
|
|
1269
1429
|
};
|
|
1270
|
-
const handlePrint = () => {
|
|
1271
|
-
if (onPrintClick) {
|
|
1272
|
-
onPrintClick();
|
|
1273
|
-
return;
|
|
1274
|
-
}
|
|
1275
|
-
if (!pdfBuffer) return;
|
|
1276
|
-
const blob = new Blob([pdfBuffer], { type: "application/pdf" });
|
|
1277
|
-
const blobUrl = URL.createObjectURL(blob);
|
|
1278
|
-
const iframe = document.createElement("iframe");
|
|
1279
|
-
iframe.style.position = "fixed";
|
|
1280
|
-
iframe.style.right = "0";
|
|
1281
|
-
iframe.style.bottom = "0";
|
|
1282
|
-
iframe.style.width = "0";
|
|
1283
|
-
iframe.style.height = "0";
|
|
1284
|
-
iframe.style.border = "0";
|
|
1285
|
-
document.body.appendChild(iframe);
|
|
1286
|
-
iframe.onload = () => {
|
|
1287
|
-
try {
|
|
1288
|
-
requestAnimationFrame(() => {
|
|
1289
|
-
const iframeWindow = iframe.contentWindow;
|
|
1290
|
-
if (!iframeWindow) return;
|
|
1291
|
-
iframeWindow.focus();
|
|
1292
|
-
iframeWindow.print();
|
|
1293
|
-
const cleanup = () => {
|
|
1294
|
-
requestAnimationFrame(() => {
|
|
1295
|
-
try {
|
|
1296
|
-
if (document.body.contains(iframe)) {
|
|
1297
|
-
document.body.removeChild(iframe);
|
|
1298
|
-
}
|
|
1299
|
-
URL.revokeObjectURL(blobUrl);
|
|
1300
|
-
} catch (e) {
|
|
1301
|
-
}
|
|
1302
|
-
});
|
|
1303
|
-
};
|
|
1304
|
-
if ("onafterprint" in iframeWindow) {
|
|
1305
|
-
iframeWindow.onafterprint = cleanup;
|
|
1306
|
-
} else {
|
|
1307
|
-
const visibilityHandler = () => {
|
|
1308
|
-
if (!document.hidden) {
|
|
1309
|
-
cleanup();
|
|
1310
|
-
document.removeEventListener("visibilitychange", visibilityHandler);
|
|
1311
|
-
}
|
|
1312
|
-
};
|
|
1313
|
-
document.addEventListener("visibilitychange", visibilityHandler);
|
|
1314
|
-
setTimeout(() => {
|
|
1315
|
-
cleanup();
|
|
1316
|
-
document.removeEventListener("visibilitychange", visibilityHandler);
|
|
1317
|
-
}, 5e3);
|
|
1318
|
-
}
|
|
1319
|
-
});
|
|
1320
|
-
} catch (error2) {
|
|
1321
|
-
if (document.body.contains(iframe)) {
|
|
1322
|
-
document.body.removeChild(iframe);
|
|
1323
|
-
}
|
|
1324
|
-
URL.revokeObjectURL(blobUrl);
|
|
1325
|
-
}
|
|
1326
|
-
};
|
|
1327
|
-
iframe.onerror = () => {
|
|
1328
|
-
document.body.removeChild(iframe);
|
|
1329
|
-
URL.revokeObjectURL(blobUrl);
|
|
1330
|
-
};
|
|
1331
|
-
iframe.src = blobUrl;
|
|
1332
|
-
};
|
|
1333
1430
|
_react.useEffect.call(void 0, () => {
|
|
1334
1431
|
if (!file) {
|
|
1335
1432
|
setState("error");
|
|
@@ -1356,12 +1453,12 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1356
1453
|
}
|
|
1357
1454
|
setPdfBuffer(arrayBuffer);
|
|
1358
1455
|
setState("ready");
|
|
1359
|
-
_optionalChain([onLoad, 'optionalCall',
|
|
1456
|
+
_optionalChain([onLoad, 'optionalCall', _239 => _239()]);
|
|
1360
1457
|
} catch (err) {
|
|
1361
1458
|
const errorMessage = err.message || "Failed to load PDF";
|
|
1362
1459
|
setState("error");
|
|
1363
1460
|
setError(errorMessage);
|
|
1364
|
-
_optionalChain([onError, 'optionalCall',
|
|
1461
|
+
_optionalChain([onError, 'optionalCall', _240 => _240(err)]);
|
|
1365
1462
|
}
|
|
1366
1463
|
};
|
|
1367
1464
|
loadPDF();
|
|
@@ -1442,184 +1539,59 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1442
1539
|
height: "100%"
|
|
1443
1540
|
}, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Preparing PDF..." }) });
|
|
1444
1541
|
}
|
|
1445
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-container", children: [
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: toolbarStyles }),
|
|
1447
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1492
|
-
"button",
|
|
1493
|
-
{
|
|
1494
|
-
className: "toolbar-button",
|
|
1495
|
-
onClick: handleNextPage,
|
|
1496
|
-
disabled: currentPage >= totalPages,
|
|
1497
|
-
title: "Next Page",
|
|
1498
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronRight2.default, { fontSize: "small" })
|
|
1499
|
-
}
|
|
1500
|
-
),
|
|
1501
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1502
|
-
"button",
|
|
1503
|
-
{
|
|
1504
|
-
className: "toolbar-button",
|
|
1505
|
-
onClick: handleLastPage,
|
|
1506
|
-
disabled: currentPage >= totalPages,
|
|
1507
|
-
title: "Last Page",
|
|
1508
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LastPage2.default, { fontSize: "small" })
|
|
1509
|
-
}
|
|
1510
|
-
)
|
|
1511
|
-
] })
|
|
1512
|
-
] }),
|
|
1513
|
-
showZoomControls && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1514
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
1515
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
1516
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1517
|
-
"button",
|
|
1518
|
-
{
|
|
1519
|
-
className: "toolbar-button",
|
|
1520
|
-
onClick: handleZoomOut,
|
|
1521
|
-
title: "Zoom Out",
|
|
1522
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomOut2.default, { fontSize: "small" })
|
|
1523
|
-
}
|
|
1524
|
-
),
|
|
1525
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "zoom-display", children: [
|
|
1526
|
-
zoom,
|
|
1527
|
-
"%"
|
|
1528
|
-
] }),
|
|
1529
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1530
|
-
"button",
|
|
1531
|
-
{
|
|
1532
|
-
className: "toolbar-button",
|
|
1533
|
-
onClick: handleZoomIn,
|
|
1534
|
-
title: "Zoom In",
|
|
1535
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomIn2.default, { fontSize: "small" })
|
|
1536
|
-
}
|
|
1537
|
-
),
|
|
1538
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1539
|
-
"button",
|
|
1540
|
-
{
|
|
1541
|
-
className: "toolbar-button",
|
|
1542
|
-
onClick: handleFitToWidth,
|
|
1543
|
-
title: "Fit to Width",
|
|
1544
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AspectRatio2.default, { fontSize: "small" })
|
|
1545
|
-
}
|
|
1546
|
-
),
|
|
1547
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1548
|
-
"button",
|
|
1549
|
-
{
|
|
1550
|
-
className: "toolbar-button",
|
|
1551
|
-
onClick: handleFitToPage,
|
|
1552
|
-
title: "Fit to Page",
|
|
1553
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FitScreen2.default, { fontSize: "small" })
|
|
1554
|
-
}
|
|
1555
|
-
)
|
|
1556
|
-
] })
|
|
1557
|
-
] }),
|
|
1558
|
-
showSearch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1559
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
1560
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1561
|
-
"button",
|
|
1562
|
-
{
|
|
1563
|
-
className: "toolbar-button",
|
|
1564
|
-
onClick: toggleSidebar,
|
|
1565
|
-
title: "Search in PDF",
|
|
1566
|
-
style: {
|
|
1567
|
-
backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
|
|
1568
|
-
color: isSidebarOpen ? "#1976d2" : "inherit"
|
|
1569
|
-
},
|
|
1570
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { fontSize: "small" })
|
|
1571
|
-
}
|
|
1572
|
-
) })
|
|
1573
|
-
] }),
|
|
1574
|
-
(showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
1576
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
1577
|
-
showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1578
|
-
"button",
|
|
1579
|
-
{
|
|
1580
|
-
className: "toolbar-button",
|
|
1581
|
-
onClick: onDownloadClick,
|
|
1582
|
-
title: "Download PDF",
|
|
1583
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
|
|
1584
|
-
}
|
|
1585
|
-
),
|
|
1586
|
-
showPrint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1587
|
-
"button",
|
|
1588
|
-
{
|
|
1589
|
-
className: "toolbar-button",
|
|
1590
|
-
onClick: onPrintClick,
|
|
1591
|
-
title: "Print PDF",
|
|
1592
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
|
|
1593
|
-
}
|
|
1594
|
-
),
|
|
1595
|
-
showMetadata && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1596
|
-
"button",
|
|
1597
|
-
{
|
|
1598
|
-
className: "toolbar-button",
|
|
1599
|
-
onClick: onMetadataClick,
|
|
1600
|
-
title: "Document Metadata",
|
|
1601
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
|
|
1602
|
-
}
|
|
1603
|
-
),
|
|
1604
|
-
showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1605
|
-
"button",
|
|
1606
|
-
{
|
|
1607
|
-
className: "toolbar-button",
|
|
1608
|
-
onClick: onPropertiesClick,
|
|
1609
|
-
title: "Document Properties",
|
|
1610
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
|
|
1611
|
-
}
|
|
1612
|
-
)
|
|
1613
|
-
] })
|
|
1614
|
-
] })
|
|
1615
|
-
] }),
|
|
1542
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: "pdf-viewer-container", children: [
|
|
1543
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunkA2MSWOEMjs.toolbarStyles }),
|
|
1544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1545
|
+
PDFHeader,
|
|
1546
|
+
{
|
|
1547
|
+
fileName: resolvedFileName,
|
|
1548
|
+
fileExtension
|
|
1549
|
+
}
|
|
1550
|
+
),
|
|
1551
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1552
|
+
PDFToolbar,
|
|
1553
|
+
{
|
|
1554
|
+
currentPage,
|
|
1555
|
+
totalPages,
|
|
1556
|
+
zoom,
|
|
1557
|
+
isSidebarOpen,
|
|
1558
|
+
showPageNavigation,
|
|
1559
|
+
showPageCount,
|
|
1560
|
+
showZoomControls,
|
|
1561
|
+
showSearch,
|
|
1562
|
+
showMetadata: !toolbar.isHidden("metadata"),
|
|
1563
|
+
showProperties: !toolbar.isHidden("properties"),
|
|
1564
|
+
showDownload: !toolbar.isHidden("download"),
|
|
1565
|
+
showPrint: !toolbar.isHidden("print"),
|
|
1566
|
+
disabledMetadata: toolbar.isDisabled("metadata"),
|
|
1567
|
+
disabledProperties: toolbar.isDisabled("properties"),
|
|
1568
|
+
disabledDownload: toolbar.isDisabled("download"),
|
|
1569
|
+
disabledPrint: toolbar.isDisabled("print"),
|
|
1570
|
+
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
1571
|
+
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
1572
|
+
onNextPage: toolbarHandlers.handleNextPage,
|
|
1573
|
+
onLastPage: toolbarHandlers.handleLastPage,
|
|
1574
|
+
onPageInput: toolbarHandlers.handlePageInput,
|
|
1575
|
+
onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
|
|
1576
|
+
onZoomIn: toolbarHandlers.handleZoomIn,
|
|
1577
|
+
onZoomOut: toolbarHandlers.handleZoomOut,
|
|
1578
|
+
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
1579
|
+
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
1580
|
+
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
1581
|
+
onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
|
|
1582
|
+
onDownloadClick: toolbar.getHandler("download", onDownloadClick),
|
|
1583
|
+
onPrintClick: toolbar.getHandler("print", onPrintClick),
|
|
1584
|
+
onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
|
|
1585
|
+
onPropertiesClick: toolbar.getHandler("properties", onPropertiesClick)
|
|
1586
|
+
}
|
|
1587
|
+
),
|
|
1616
1588
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
|
|
1617
1589
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1618
|
-
|
|
1590
|
+
StablePDFViewer,
|
|
1619
1591
|
{
|
|
1620
|
-
ref: pdfViewerRef,
|
|
1621
1592
|
pdfBuffer,
|
|
1622
|
-
onPasswordRequest: handlePasswordRequest
|
|
1593
|
+
onPasswordRequest: handlePasswordRequest,
|
|
1594
|
+
pdfViewerRef
|
|
1623
1595
|
}
|
|
1624
1596
|
) }),
|
|
1625
1597
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1660,4 +1632,4 @@ PDFViewer.displayName = "PDFViewer";
|
|
|
1660
1632
|
|
|
1661
1633
|
|
|
1662
1634
|
exports.PDFViewer = PDFViewer;
|
|
1663
|
-
//# sourceMappingURL=chunk-
|
|
1635
|
+
//# sourceMappingURL=chunk-D7LXG67Z.js.map
|