@cannyminds/dms-file-viewers 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/chunk-5VXNBCB7.mjs +268 -0
  2. package/dist/chunk-5VXNBCB7.mjs.map +1 -0
  3. package/dist/chunk-7S4B534E.js +742 -0
  4. package/dist/chunk-7S4B534E.js.map +1 -0
  5. package/dist/chunk-AUNFO5WZ.js +268 -0
  6. package/dist/chunk-AUNFO5WZ.js.map +1 -0
  7. package/dist/chunk-BL4HRFCJ.mjs +487 -0
  8. package/dist/chunk-BL4HRFCJ.mjs.map +1 -0
  9. package/dist/chunk-CIAMJ46F.js +309 -0
  10. package/dist/chunk-CIAMJ46F.js.map +1 -0
  11. package/dist/chunk-DLSRPPBM.mjs +1863 -0
  12. package/dist/chunk-DLSRPPBM.mjs.map +1 -0
  13. package/dist/{chunk-J3JKVSAM.js → chunk-EEIQAW55.js} +5 -2
  14. package/dist/chunk-EEIQAW55.js.map +1 -0
  15. package/dist/chunk-FUNU3LUV.js +487 -0
  16. package/dist/chunk-FUNU3LUV.js.map +1 -0
  17. package/dist/chunk-HX5KWJCV.mjs +742 -0
  18. package/dist/chunk-HX5KWJCV.mjs.map +1 -0
  19. package/dist/chunk-LOXGEZRZ.js +329 -0
  20. package/dist/chunk-LOXGEZRZ.js.map +1 -0
  21. package/dist/chunk-NZLZUCP2.mjs +329 -0
  22. package/dist/chunk-NZLZUCP2.mjs.map +1 -0
  23. package/dist/chunk-PFX2NN3C.js +1863 -0
  24. package/dist/chunk-PFX2NN3C.js.map +1 -0
  25. package/dist/{chunk-DFBVN4MO.mjs → chunk-Q4OU6YDO.mjs} +5 -2
  26. package/dist/chunk-Q4OU6YDO.mjs.map +1 -0
  27. package/dist/chunk-VM5I5IEA.mjs +309 -0
  28. package/dist/chunk-VM5I5IEA.mjs.map +1 -0
  29. package/dist/chunk-YGQ6UYNQ.js +299 -0
  30. package/dist/chunk-YGQ6UYNQ.js.map +1 -0
  31. package/dist/chunk-ZRASAXL6.mjs +299 -0
  32. package/dist/chunk-ZRASAXL6.mjs.map +1 -0
  33. package/dist/components/viewers/AudioViewer.d.mts +1 -1
  34. package/dist/components/viewers/AudioViewer.d.ts +1 -1
  35. package/dist/components/viewers/AudioViewer.js +3 -3
  36. package/dist/components/viewers/AudioViewer.mjs +2 -2
  37. package/dist/components/viewers/DefaultViewer.d.mts +1 -1
  38. package/dist/components/viewers/DefaultViewer.d.ts +1 -1
  39. package/dist/components/viewers/DefaultViewer.js +3 -3
  40. package/dist/components/viewers/DefaultViewer.mjs +2 -2
  41. package/dist/components/viewers/ImageViewer.d.mts +1 -1
  42. package/dist/components/viewers/ImageViewer.d.ts +1 -1
  43. package/dist/components/viewers/ImageViewer.js +3 -3
  44. package/dist/components/viewers/ImageViewer.mjs +2 -2
  45. package/dist/components/viewers/PDFViewer.d.mts +1 -1
  46. package/dist/components/viewers/PDFViewer.d.ts +1 -1
  47. package/dist/components/viewers/PDFViewer.js +3 -3
  48. package/dist/components/viewers/PDFViewer.mjs +2 -2
  49. package/dist/components/viewers/TIFFViewer.d.mts +1 -1
  50. package/dist/components/viewers/TIFFViewer.d.ts +1 -1
  51. package/dist/components/viewers/TIFFViewer.js +3 -3
  52. package/dist/components/viewers/TIFFViewer.mjs +2 -2
  53. package/dist/components/viewers/TextViewer.d.mts +1 -1
  54. package/dist/components/viewers/TextViewer.d.ts +1 -1
  55. package/dist/components/viewers/TextViewer.js +3 -3
  56. package/dist/components/viewers/TextViewer.mjs +2 -2
  57. package/dist/components/viewers/VideoViewer.d.mts +1 -1
  58. package/dist/components/viewers/VideoViewer.d.ts +1 -1
  59. package/dist/components/viewers/VideoViewer.js +3 -3
  60. package/dist/components/viewers/VideoViewer.mjs +2 -2
  61. package/dist/index.d.mts +2 -2
  62. package/dist/index.d.ts +2 -2
  63. package/dist/index.js +9 -9
  64. package/dist/index.mjs +8 -8
  65. package/dist/{types-DNrkDJdK.d.mts → types-DM0RG-Yu.d.mts} +6 -2
  66. package/dist/{types-DNrkDJdK.d.ts → types-DM0RG-Yu.d.ts} +6 -2
  67. package/package.json +1 -1
  68. package/dist/chunk-7QRYWFCO.js +0 -639
  69. package/dist/chunk-7QRYWFCO.js.map +0 -1
  70. package/dist/chunk-7R2KG3PE.mjs +0 -210
  71. package/dist/chunk-7R2KG3PE.mjs.map +0 -1
  72. package/dist/chunk-CFYOPDCG.mjs +0 -235
  73. package/dist/chunk-CFYOPDCG.mjs.map +0 -1
  74. package/dist/chunk-D74R4IKW.mjs +0 -341
  75. package/dist/chunk-D74R4IKW.mjs.map +0 -1
  76. package/dist/chunk-DFBVN4MO.mjs.map +0 -1
  77. package/dist/chunk-EXZCEYLI.js +0 -247
  78. package/dist/chunk-EXZCEYLI.js.map +0 -1
  79. package/dist/chunk-J3JKVSAM.js.map +0 -1
  80. package/dist/chunk-NXVIRFGL.mjs +0 -247
  81. package/dist/chunk-NXVIRFGL.mjs.map +0 -1
  82. package/dist/chunk-P2VNW6OE.mjs +0 -180
  83. package/dist/chunk-P2VNW6OE.mjs.map +0 -1
  84. package/dist/chunk-P5FH7LK7.mjs +0 -639
  85. package/dist/chunk-P5FH7LK7.mjs.map +0 -1
  86. package/dist/chunk-PZJSY6OF.mjs +0 -1736
  87. package/dist/chunk-PZJSY6OF.mjs.map +0 -1
  88. package/dist/chunk-RVHIXSUP.js +0 -235
  89. package/dist/chunk-RVHIXSUP.js.map +0 -1
  90. package/dist/chunk-TGVFAAIP.js +0 -341
  91. package/dist/chunk-TGVFAAIP.js.map +0 -1
  92. package/dist/chunk-VOLQW3NF.js +0 -1736
  93. package/dist/chunk-VOLQW3NF.js.map +0 -1
  94. package/dist/chunk-VSGX22FQ.js +0 -180
  95. package/dist/chunk-VSGX22FQ.js.map +0 -1
  96. package/dist/chunk-WCAXWJE7.js +0 -210
  97. package/dist/chunk-WCAXWJE7.js.map +0 -1
@@ -0,0 +1,1863 @@
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
+
3
+
4
+ var _chunkA2MSWOEMjs = require('./chunk-A2MSWOEM.js');
5
+
6
+
7
+ var _chunkYEPEMLM3js = require('./chunk-YEPEMLM3.js');
8
+
9
+
10
+
11
+ var _chunkEEIQAW55js = require('./chunk-EEIQAW55.js');
12
+
13
+ // src/components/viewers/PDFViewer.tsx
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
23
+
24
+ // src/components/viewers/pdf/StablePDFViewer.tsx
25
+
26
+ var _pdfviewer = require('@cannyminds/pdf-viewer');
27
+ var _jsxruntime = require('react/jsx-runtime');
28
+ var HeadlessPDFViewer = _pdfviewer.PDFViewer;
29
+ var StablePDFViewer = _react2.default.memo(({
30
+ pdfBuffer,
31
+ onPasswordRequest,
32
+ pdfViewerRef
33
+ }) => {
34
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
35
+ HeadlessPDFViewer,
36
+ {
37
+ ref: pdfViewerRef,
38
+ pdfBuffer,
39
+ onPasswordRequest
40
+ }
41
+ );
42
+ });
43
+ StablePDFViewer.displayName = "StablePDFViewer";
44
+
45
+ // src/components/viewers/pdf/PDFToolbar.tsx
46
+
47
+ var _FirstPage = require('@mui/icons-material/FirstPage'); var _FirstPage2 = _interopRequireDefault(_FirstPage);
48
+ var _LastPage = require('@mui/icons-material/LastPage'); var _LastPage2 = _interopRequireDefault(_LastPage);
49
+ var _ChevronLeft = require('@mui/icons-material/ChevronLeft'); var _ChevronLeft2 = _interopRequireDefault(_ChevronLeft);
50
+ var _ChevronRight = require('@mui/icons-material/ChevronRight'); var _ChevronRight2 = _interopRequireDefault(_ChevronRight);
51
+ var _ZoomIn = require('@mui/icons-material/ZoomIn'); var _ZoomIn2 = _interopRequireDefault(_ZoomIn);
52
+ var _ZoomOut = require('@mui/icons-material/ZoomOut'); var _ZoomOut2 = _interopRequireDefault(_ZoomOut);
53
+ var _FitScreen = require('@mui/icons-material/FitScreen'); var _FitScreen2 = _interopRequireDefault(_FitScreen);
54
+ var _AspectRatio = require('@mui/icons-material/AspectRatio'); var _AspectRatio2 = _interopRequireDefault(_AspectRatio);
55
+ var _Search = require('@mui/icons-material/Search'); var _Search2 = _interopRequireDefault(_Search);
56
+ var _Fullscreen = require('@mui/icons-material/Fullscreen'); var _Fullscreen2 = _interopRequireDefault(_Fullscreen);
57
+ var _Download = require('@mui/icons-material/Download'); var _Download2 = _interopRequireDefault(_Download);
58
+ var _Print = require('@mui/icons-material/Print'); var _Print2 = _interopRequireDefault(_Print);
59
+ var _Info = require('@mui/icons-material/Info'); var _Info2 = _interopRequireDefault(_Info);
60
+ var _Description = require('@mui/icons-material/Description'); var _Description2 = _interopRequireDefault(_Description);
61
+ var _RotateLeft = require('@mui/icons-material/RotateLeft'); var _RotateLeft2 = _interopRequireDefault(_RotateLeft);
62
+ var _RotateRight = require('@mui/icons-material/RotateRight'); var _RotateRight2 = _interopRequireDefault(_RotateRight);
63
+ var _History = require('@mui/icons-material/History'); var _History2 = _interopRequireDefault(_History);
64
+ var _iconsmaterial = require('@mui/icons-material');
65
+
66
+ var PDFToolbar = _react2.default.memo(
67
+ ({
68
+ currentPage,
69
+ totalPages,
70
+ zoom,
71
+ isSidebarOpen,
72
+ showPageNavigation,
73
+ showPageCount,
74
+ showZoomControls,
75
+ showSearch,
76
+ showMetadata,
77
+ showProperties,
78
+ showTags,
79
+ showHistory,
80
+ showDownload,
81
+ showPrint,
82
+ showRotation,
83
+ disabledRotateLeft,
84
+ disabledRotateRight,
85
+ disabledMetadata,
86
+ disabledProperties,
87
+ disabledTags,
88
+ disabledHistory,
89
+ disabledDownload,
90
+ disabledPrint,
91
+ onFirstPage,
92
+ onPreviousPage,
93
+ onNextPage,
94
+ onLastPage,
95
+ onPageInput,
96
+ onPageInputKeyPress,
97
+ onZoomIn,
98
+ onZoomOut,
99
+ onFitToWidth,
100
+ onFitToPage,
101
+ onToggleSidebar,
102
+ onToggleFullScreen,
103
+ onRotateLeft,
104
+ onRotateRight,
105
+ onDownloadClick,
106
+ onPrintClick,
107
+ onMetadataClick,
108
+ onPropertiesClick,
109
+ onTagsClick,
110
+ onHistoryClick
111
+ }) => {
112
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar", children: [
113
+ showPageNavigation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
114
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
115
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
116
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
117
+ "button",
118
+ {
119
+ className: "toolbar-button",
120
+ onClick: onFirstPage,
121
+ disabled: currentPage <= 1,
122
+ title: "First Page",
123
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FirstPage2.default, { fontSize: "small" })
124
+ }
125
+ ),
126
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
127
+ "button",
128
+ {
129
+ className: "toolbar-button",
130
+ onClick: onPreviousPage,
131
+ disabled: currentPage <= 1,
132
+ title: "Previous Page",
133
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronLeft2.default, { fontSize: "small" })
134
+ }
135
+ ),
136
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
137
+ "input",
138
+ {
139
+ type: "number",
140
+ className: "page-input",
141
+ value: currentPage,
142
+ onChange: onPageInput,
143
+ onKeyPress: onPageInputKeyPress,
144
+ min: 1,
145
+ max: totalPages || void 0
146
+ }
147
+ ),
148
+ showPageCount && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "page-info", children: [
149
+ "of ",
150
+ totalPages || "..."
151
+ ] }),
152
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
153
+ "button",
154
+ {
155
+ className: "toolbar-button",
156
+ onClick: onNextPage,
157
+ disabled: currentPage >= totalPages,
158
+ title: "Next Page",
159
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronRight2.default, { fontSize: "small" })
160
+ }
161
+ ),
162
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
163
+ "button",
164
+ {
165
+ className: "toolbar-button",
166
+ onClick: onLastPage,
167
+ disabled: currentPage >= totalPages,
168
+ title: "Last Page",
169
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LastPage2.default, { fontSize: "small" })
170
+ }
171
+ )
172
+ ] })
173
+ ] }),
174
+ showZoomControls && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
175
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
176
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
177
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
178
+ "button",
179
+ {
180
+ className: "toolbar-button",
181
+ onClick: onZoomOut,
182
+ title: "Zoom Out",
183
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomOut2.default, { fontSize: "small" })
184
+ }
185
+ ),
186
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "zoom-display", children: [
187
+ zoom,
188
+ "%"
189
+ ] }),
190
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
191
+ "button",
192
+ {
193
+ className: "toolbar-button",
194
+ onClick: onZoomIn,
195
+ title: "Zoom In",
196
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomIn2.default, { fontSize: "small" })
197
+ }
198
+ ),
199
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
200
+ "button",
201
+ {
202
+ className: "toolbar-button",
203
+ onClick: onFitToWidth,
204
+ title: "Fit to Width",
205
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AspectRatio2.default, { fontSize: "small" })
206
+ }
207
+ ),
208
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
209
+ "button",
210
+ {
211
+ className: "toolbar-button",
212
+ onClick: onFitToPage,
213
+ title: "Fit to Page",
214
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FitScreen2.default, { fontSize: "small" })
215
+ }
216
+ )
217
+ ] })
218
+ ] }),
219
+ showRotation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
220
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
221
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
222
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
223
+ "button",
224
+ {
225
+ className: "toolbar-button",
226
+ onClick: onRotateLeft,
227
+ disabled: disabledRotateLeft,
228
+ title: "Rotate Counterclockwise",
229
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateLeft2.default, { fontSize: "small" })
230
+ }
231
+ ),
232
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
233
+ "button",
234
+ {
235
+ className: "toolbar-button",
236
+ onClick: onRotateRight,
237
+ disabled: disabledRotateRight,
238
+ title: "Rotate Clockwise",
239
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateRight2.default, { fontSize: "small" })
240
+ }
241
+ )
242
+ ] })
243
+ ] }),
244
+ showSearch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
245
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
246
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
247
+ "button",
248
+ {
249
+ className: "toolbar-button",
250
+ onClick: onToggleSidebar,
251
+ title: "Search in PDF",
252
+ style: {
253
+ backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
254
+ color: isSidebarOpen ? "#1976d2" : "inherit"
255
+ },
256
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { fontSize: "small" })
257
+ }
258
+ ) })
259
+ ] }),
260
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
261
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
262
+ "button",
263
+ {
264
+ className: "toolbar-button",
265
+ onClick: onToggleFullScreen,
266
+ title: "Fullscreen",
267
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Fullscreen2.default, { fontSize: "small" })
268
+ }
269
+ ) }),
270
+ (showMetadata || showProperties || showDownload || showPrint || showTags || showHistory) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
271
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
272
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
273
+ showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
274
+ "button",
275
+ {
276
+ className: "toolbar-button",
277
+ onClick: onDownloadClick,
278
+ disabled: disabledDownload,
279
+ title: "Download PDF",
280
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
281
+ }
282
+ ),
283
+ showPrint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
284
+ "button",
285
+ {
286
+ className: "toolbar-button",
287
+ onClick: onPrintClick,
288
+ disabled: disabledPrint,
289
+ title: "Print PDF",
290
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
291
+ }
292
+ ),
293
+ showMetadata && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
294
+ "button",
295
+ {
296
+ className: "toolbar-button",
297
+ onClick: onMetadataClick,
298
+ disabled: disabledMetadata,
299
+ title: "Document Metadata",
300
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
301
+ }
302
+ ),
303
+ showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
304
+ "button",
305
+ {
306
+ className: "toolbar-button",
307
+ onClick: onPropertiesClick,
308
+ disabled: disabledProperties,
309
+ title: "Document Properties",
310
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
311
+ }
312
+ ),
313
+ showTags && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
314
+ "button",
315
+ {
316
+ className: "toolbar-button",
317
+ onClick: onTagsClick,
318
+ disabled: disabledTags,
319
+ title: "Document Tags",
320
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.LocalOffer, { fontSize: "small" })
321
+ }
322
+ ),
323
+ showHistory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
324
+ "button",
325
+ {
326
+ className: "toolbar-button",
327
+ onClick: onHistoryClick,
328
+ disabled: disabledHistory,
329
+ title: "Document History",
330
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _History2.default, { fontSize: "small" })
331
+ }
332
+ )
333
+ ] })
334
+ ] })
335
+ ] });
336
+ }
337
+ );
338
+ PDFToolbar.displayName = "PDFToolbar";
339
+
340
+ // src/components/viewers/pdf/PDFHeader.tsx
341
+
342
+
343
+ var PDFHeader = _react2.default.memo(({ fileName, fileExtension }) => {
344
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-header", children: [
345
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEEIQAW55js.FileIcon_default, { ext: fileExtension, size: 26 }),
346
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "header-file-name", title: fileName, children: fileName })
347
+ ] });
348
+ });
349
+ PDFHeader.displayName = "PDFHeader";
350
+
351
+ // src/components/viewers/pdf/SearchSidebar.tsx
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+ var _material = require('@mui/material');
362
+
363
+ var _Close = require('@mui/icons-material/Close'); var _Close2 = _interopRequireDefault(_Close);
364
+ var _KeyboardArrowUp = require('@mui/icons-material/KeyboardArrowUp'); var _KeyboardArrowUp2 = _interopRequireDefault(_KeyboardArrowUp);
365
+ var _KeyboardArrowDown = require('@mui/icons-material/KeyboardArrowDown'); var _KeyboardArrowDown2 = _interopRequireDefault(_KeyboardArrowDown);
366
+ var _Clear = require('@mui/icons-material/Clear'); var _Clear2 = _interopRequireDefault(_Clear);
367
+ var _FindInPage = require('@mui/icons-material/FindInPage'); var _FindInPage2 = _interopRequireDefault(_FindInPage);
368
+
369
+ var SearchSidebar = ({
370
+ isOpen,
371
+ onClose,
372
+ onSearch,
373
+ onSearchResultClick,
374
+ onNextResult,
375
+ onPreviousResult,
376
+ currentResultIndex,
377
+ totalResults,
378
+ searchKeyword,
379
+ searchResults = [],
380
+ isSearching = false,
381
+ isSyntheticResults = false
382
+ }) => {
383
+ const [searchTerm, setSearchTerm] = _react.useState.call(void 0, searchKeyword || "");
384
+ const [hasSearched, setHasSearched] = _react.useState.call(void 0, false);
385
+ const contentRef = _react.useRef.call(void 0, null);
386
+ _react.useEffect.call(void 0, () => {
387
+ if (searchKeyword && searchKeyword !== searchTerm) {
388
+ setSearchTerm(searchKeyword);
389
+ }
390
+ }, [searchKeyword]);
391
+ _react.useLayoutEffect.call(void 0, () => {
392
+ const element = contentRef.current;
393
+ if (!element) return;
394
+ const handleMouseMove = (e) => {
395
+ const rect = element.getBoundingClientRect();
396
+ const distanceFromRight = rect.right - e.clientX;
397
+ const distanceFromBottom = rect.bottom - e.clientY;
398
+ if (distanceFromRight <= 15 || distanceFromBottom <= 15) {
399
+ element.classList.add("scrollbar-hover");
400
+ } else {
401
+ element.classList.remove("scrollbar-hover");
402
+ }
403
+ };
404
+ const handleMouseLeave = () => element.classList.remove("scrollbar-hover");
405
+ element.addEventListener("mousemove", handleMouseMove);
406
+ element.addEventListener("mouseleave", handleMouseLeave);
407
+ return () => {
408
+ element.removeEventListener("mousemove", handleMouseMove);
409
+ element.removeEventListener("mouseleave", handleMouseLeave);
410
+ };
411
+ }, []);
412
+ _react.useLayoutEffect.call(void 0, () => {
413
+ const style = document.createElement("style");
414
+ style.id = "search-sidebar-scrollbar";
415
+ style.textContent = `
416
+ @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;600&family=Noto+Sans+Devanagari:wght@400;600&display=swap');
417
+
418
+ .search-sidebar-content::-webkit-scrollbar {
419
+ width: 12px;
420
+ height: 12px;
421
+ }
422
+ .search-sidebar-content::-webkit-scrollbar-track {
423
+ background-color: transparent;
424
+ }
425
+ .search-sidebar-content::-webkit-scrollbar-thumb {
426
+ background-color: rgba(128, 128, 128, 0.3);
427
+ border-radius: 8px;
428
+ border: 4px solid transparent;
429
+ background-clip: padding-box;
430
+ transition: all 0.15s ease;
431
+ }
432
+ .search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
433
+ background-color: rgba(128, 128, 128, 0.5);
434
+ border: 2px solid transparent;
435
+ }
436
+ .search-sidebar-content::-webkit-scrollbar-thumb:active {
437
+ background-color: rgba(25, 118, 210, 0.8);
438
+ border: 1px solid transparent;
439
+ }
440
+
441
+ @media (prefers-color-scheme: dark) {
442
+ .search-sidebar-content::-webkit-scrollbar-thumb {
443
+ background-color: rgba(255, 255, 255, 0.2);
444
+ }
445
+ .search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
446
+ background-color: rgba(255, 255, 255, 0.35);
447
+ }
448
+ }
449
+
450
+ /* Tamil font support for search results */
451
+ .search-result-text {
452
+ font-family: 'Noto Sans Tamil', 'Noto Sans Devanagari', Arial, sans-serif !important;
453
+ }
454
+ `;
455
+ document.head.appendChild(style);
456
+ return () => {
457
+ const el = document.getElementById("search-sidebar-scrollbar");
458
+ if (el) el.remove();
459
+ };
460
+ }, []);
461
+ _react.useLayoutEffect.call(void 0, () => {
462
+ setSearchTerm(searchKeyword || "");
463
+ if (searchKeyword || searchResults.length > 0) {
464
+ setHasSearched(true);
465
+ }
466
+ }, [searchKeyword, searchResults]);
467
+ const handleSearchSubmit = (e) => {
468
+ if (e) e.preventDefault();
469
+ if (searchTerm.trim()) {
470
+ setHasSearched(true);
471
+ onSearch(searchTerm.trim());
472
+ }
473
+ };
474
+ const handleSearchChange = (e) => {
475
+ const value = e.target.value;
476
+ setSearchTerm(value);
477
+ if (!value.trim()) {
478
+ setHasSearched(false);
479
+ onSearch("");
480
+ }
481
+ };
482
+ const handleClearSearch = () => {
483
+ setSearchTerm("");
484
+ setHasSearched(false);
485
+ onSearch("");
486
+ };
487
+ const resultsByPage = searchResults.reduce((acc, result) => {
488
+ if (!acc[result.pageNumber]) {
489
+ acc[result.pageNumber] = [];
490
+ }
491
+ acc[result.pageNumber].push(result);
492
+ return acc;
493
+ }, {});
494
+ const highlightText = (text, keyword) => {
495
+ if (!keyword) return text;
496
+ const textString = typeof text === "string" ? text : String(text || "");
497
+ if (!textString) return text;
498
+ try {
499
+ const escapedKeyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
500
+ const regex = new RegExp(`(${escapedKeyword})`, "gi");
501
+ const parts = textString.split(regex);
502
+ return parts.map(
503
+ (part, index) => regex.test(part) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
504
+ _material.Box,
505
+ {
506
+ component: "span",
507
+ sx: {
508
+ color: "primary.main",
509
+ fontWeight: 600,
510
+ fontSize: "inherit"
511
+ },
512
+ children: part
513
+ },
514
+ index
515
+ ) : part
516
+ );
517
+ } catch (error) {
518
+ return textString;
519
+ }
520
+ };
521
+ if (!isOpen) return null;
522
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
523
+ _material.Box,
524
+ {
525
+ sx: {
526
+ display: "flex",
527
+ flexDirection: "column",
528
+ height: "100%",
529
+ width: "320px",
530
+ backgroundColor: "background.paper",
531
+ borderLeft: "1px solid",
532
+ borderColor: "divider",
533
+ overflow: "hidden"
534
+ },
535
+ children: [
536
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { px: 3, py: 2.5, backgroundColor: "background.default" }, children: [
537
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
538
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h6", sx: { fontSize: "1.125rem", fontWeight: 600, color: "text.primary" }, children: "Search" }),
539
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
540
+ _material.IconButton,
541
+ {
542
+ size: "small",
543
+ onClick: onClose,
544
+ sx: {
545
+ color: "text.secondary",
546
+ padding: "6px"
547
+ },
548
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Close2.default, { fontSize: "small" })
549
+ }
550
+ )
551
+ ] }),
552
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleSearchSubmit, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
553
+ _material.TextField,
554
+ {
555
+ fullWidth: true,
556
+ size: "medium",
557
+ placeholder: "Search in document...",
558
+ value: searchTerm,
559
+ onChange: handleSearchChange,
560
+ autoComplete: "off",
561
+ InputProps: {
562
+ startAdornment: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "start", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { color: "text.disabled", fontSize: 20 } }) }),
563
+ endAdornment: searchTerm && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
564
+ _material.IconButton,
565
+ {
566
+ size: "small",
567
+ onClick: handleClearSearch,
568
+ sx: {
569
+ color: "text.secondary",
570
+ padding: "4px",
571
+ "&:hover": {
572
+ backgroundColor: "action.hover"
573
+ }
574
+ },
575
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Clear2.default, { sx: { fontSize: 18 } })
576
+ }
577
+ ) })
578
+ },
579
+ sx: {
580
+ "& .MuiOutlinedInput-root": {
581
+ fontSize: "0.9375rem",
582
+ backgroundColor: "background.paper",
583
+ borderRadius: "8px",
584
+ "& fieldset": {
585
+ borderColor: "divider"
586
+ },
587
+ "&.Mui-focused fieldset": {
588
+ borderColor: "primary.main",
589
+ borderWidth: "2px"
590
+ }
591
+ },
592
+ "& .MuiInputBase-input": {
593
+ padding: "10px 14px"
594
+ }
595
+ }
596
+ }
597
+ ) }),
598
+ totalResults > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
599
+ _material.Box,
600
+ {
601
+ sx: {
602
+ display: "flex",
603
+ alignItems: "center",
604
+ justifyContent: "space-between",
605
+ mt: 2,
606
+ pt: 2,
607
+ borderTop: "1px solid",
608
+ borderColor: "divider"
609
+ },
610
+ children: [
611
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", fontSize: "0.875rem", fontWeight: 500 }, children: [
612
+ currentResultIndex + 1,
613
+ " of ",
614
+ totalResults,
615
+ " results"
616
+ ] }),
617
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
618
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
619
+ _material.IconButton,
620
+ {
621
+ size: "small",
622
+ onClick: onPreviousResult,
623
+ disabled: currentResultIndex <= 0,
624
+ sx: {
625
+ color: currentResultIndex <= 0 ? "text.disabled" : "primary.main",
626
+ padding: "6px",
627
+ borderRadius: "6px",
628
+ border: "1px solid",
629
+ borderColor: currentResultIndex <= 0 ? "divider" : "primary.main"
630
+ },
631
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowUp2.default, { sx: { fontSize: 20 } })
632
+ }
633
+ ),
634
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
635
+ _material.IconButton,
636
+ {
637
+ size: "small",
638
+ onClick: onNextResult,
639
+ disabled: currentResultIndex >= totalResults - 1,
640
+ sx: {
641
+ color: currentResultIndex >= totalResults - 1 ? "text.disabled" : "primary.main",
642
+ padding: "6px",
643
+ borderRadius: "6px",
644
+ border: "1px solid",
645
+ borderColor: currentResultIndex >= totalResults - 1 ? "divider" : "primary.main"
646
+ },
647
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { sx: { fontSize: 20 } })
648
+ }
649
+ )
650
+ ] })
651
+ ]
652
+ }
653
+ )
654
+ ] }),
655
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, {}),
656
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { ref: contentRef, className: "search-sidebar-content", sx: {
657
+ flex: 1,
658
+ overflow: "auto",
659
+ backgroundColor: "background.default"
660
+ }, children: [
661
+ !searchTerm && !hasSearched && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
662
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
663
+ _material.Box,
664
+ {
665
+ sx: {
666
+ width: 80,
667
+ height: 80,
668
+ borderRadius: "50%",
669
+ backgroundColor: "action.hover",
670
+ display: "flex",
671
+ alignItems: "center",
672
+ justifyContent: "center",
673
+ margin: "0 auto",
674
+ mb: 3
675
+ },
676
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { fontSize: 40, color: "text.disabled" } })
677
+ }
678
+ ),
679
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Search in Document" }),
680
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: "Enter keywords to find text within the PDF document" })
681
+ ] }),
682
+ searchTerm && !hasSearched && !isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
683
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
684
+ _material.Box,
685
+ {
686
+ sx: {
687
+ width: 80,
688
+ height: 80,
689
+ borderRadius: "50%",
690
+ backgroundColor: "primary.light",
691
+ display: "flex",
692
+ alignItems: "center",
693
+ justifyContent: "center",
694
+ margin: "0 auto",
695
+ mb: 3,
696
+ opacity: 0.2
697
+ },
698
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FindInPage2.default, { sx: { fontSize: 40, color: "primary.main" } })
699
+ }
700
+ ),
701
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Ready to Search" }),
702
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", mb: 2, lineHeight: 1.6 }, children: "Press Enter to find" }),
703
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
704
+ _material.Typography,
705
+ {
706
+ variant: "body2",
707
+ sx: {
708
+ color: "white",
709
+ fontWeight: 600,
710
+ backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(144, 202, 249, 0.16)" : "primary.light",
711
+ padding: "6px 16px",
712
+ borderRadius: "16px",
713
+ display: "inline-block",
714
+ opacity: 0.9
715
+ },
716
+ children: [
717
+ '"',
718
+ searchTerm,
719
+ '"'
720
+ ]
721
+ }
722
+ )
723
+ ] }),
724
+ isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
725
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
726
+ _material.Box,
727
+ {
728
+ sx: {
729
+ display: "flex",
730
+ alignItems: "center",
731
+ justifyContent: "center",
732
+ margin: "0 auto",
733
+ mb: 3
734
+ },
735
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { size: 60, thickness: 4 })
736
+ }
737
+ ),
738
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Searching..." }),
739
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
740
+ 'Finding matches for "',
741
+ searchTerm,
742
+ '"'
743
+ ] })
744
+ ] }),
745
+ hasSearched && totalResults === 0 && !isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
746
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
747
+ _material.Box,
748
+ {
749
+ sx: {
750
+ width: 80,
751
+ height: 80,
752
+ borderRadius: "50%",
753
+ backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(255, 152, 0, 0.12)" : "warning.light",
754
+ display: "flex",
755
+ alignItems: "center",
756
+ justifyContent: "center",
757
+ margin: "0 auto",
758
+ mb: 3,
759
+ opacity: 0.6
760
+ },
761
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { fontSize: 40, color: "warning.main" } })
762
+ }
763
+ ),
764
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "No Results Found" }),
765
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
766
+ "No matches found for ",
767
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
768
+ '"',
769
+ searchTerm,
770
+ '"'
771
+ ] })
772
+ ] })
773
+ ] }),
774
+ totalResults > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, { sx: { p: 2 }, children: Object.keys(resultsByPage).sort((a, b) => parseInt(a) - parseInt(b)).map((pageNum) => {
775
+ const pageNumber = parseInt(pageNum);
776
+ const pageResults = resultsByPage[pageNumber];
777
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { mb: 3 }, children: [
778
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
779
+ _material.Typography,
780
+ {
781
+ variant: "subtitle2",
782
+ sx: {
783
+ color: "text.secondary",
784
+ mb: 1.5,
785
+ px: 1,
786
+ fontSize: "0.8125rem",
787
+ fontWeight: 600,
788
+ textTransform: "uppercase",
789
+ letterSpacing: "0.5px"
790
+ },
791
+ children: [
792
+ "Page ",
793
+ pageNumber
794
+ ]
795
+ }
796
+ ),
797
+ pageResults.map((result, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
798
+ _material.Box,
799
+ {
800
+ onClick: () => onSearchResultClick(result.pageNumber, result.index),
801
+ sx: {
802
+ p: 2,
803
+ mx: 1,
804
+ mb: 1.5,
805
+ borderRadius: "8px",
806
+ border: "2px solid",
807
+ borderColor: result.index === currentResultIndex ? "primary.main" : "divider",
808
+ backgroundColor: "background.paper",
809
+ cursor: "pointer",
810
+ transition: "all 0.2s ease",
811
+ boxShadow: (theme) => theme.palette.mode === "dark" ? "0 1px 3px rgba(0, 0, 0, 0.3)" : "0 1px 3px rgba(0, 0, 0, 0.05)",
812
+ "&:hover": {
813
+ borderColor: "primary.main",
814
+ boxShadow: (theme) => theme.palette.mode === "dark" ? "0 2px 8px rgba(255, 255, 255, 0.15)" : "0 2px 8px rgba(0, 0, 0, 0.1)",
815
+ transform: "translateY(-1px)"
816
+ }
817
+ },
818
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
819
+ _material.Typography,
820
+ {
821
+ variant: "body2",
822
+ className: "search-result-text",
823
+ sx: {
824
+ fontSize: "0.875rem",
825
+ lineHeight: 1.6,
826
+ color: result.index === currentResultIndex ? "text.primary" : "text.secondary"
827
+ },
828
+ children: highlightText(result.context, searchTerm)
829
+ }
830
+ )
831
+ },
832
+ index
833
+ ))
834
+ ] }, pageNumber);
835
+ }) })
836
+ ] })
837
+ ]
838
+ }
839
+ );
840
+ };
841
+
842
+ // src/components/viewers/pdf/PasswordDialog.tsx
843
+
844
+
845
+
846
+
847
+
848
+
849
+
850
+
851
+
852
+
853
+
854
+
855
+
856
+
857
+
858
+ var _Lock = require('@mui/icons-material/Lock'); var _Lock2 = _interopRequireDefault(_Lock);
859
+ var _Visibility = require('@mui/icons-material/Visibility'); var _Visibility2 = _interopRequireDefault(_Visibility);
860
+ var _VisibilityOff = require('@mui/icons-material/VisibilityOff'); var _VisibilityOff2 = _interopRequireDefault(_VisibilityOff);
861
+
862
+ var PasswordDialog = ({
863
+ open,
864
+ fileName,
865
+ onSubmit,
866
+ onCancel,
867
+ error
868
+ }) => {
869
+ const [password, setPassword] = _react.useState.call(void 0, "");
870
+ const [showPassword, setShowPassword] = _react.useState.call(void 0, false);
871
+ _react.useEffect.call(void 0, () => {
872
+ if (open) {
873
+ setPassword("");
874
+ setShowPassword(false);
875
+ }
876
+ }, [open]);
877
+ const handleSubmit = (e) => {
878
+ e.preventDefault();
879
+ if (password.trim()) {
880
+ onSubmit(password);
881
+ }
882
+ };
883
+ const handleTogglePasswordVisibility = () => {
884
+ setShowPassword(!showPassword);
885
+ };
886
+ const handleKeyPress = (e) => {
887
+ if (e.key === "Enter" && password.trim()) {
888
+ handleSubmit(e);
889
+ }
890
+ };
891
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
892
+ _material.Dialog,
893
+ {
894
+ open,
895
+ onClose: onCancel,
896
+ maxWidth: "sm",
897
+ fullWidth: true,
898
+ PaperProps: {
899
+ sx: {
900
+ borderRadius: 2
901
+ }
902
+ },
903
+ children: [
904
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.DialogTitle, { sx: { pb: 1 }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
905
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
906
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
907
+ _material.Box,
908
+ {
909
+ sx: {
910
+ width: 40,
911
+ height: 40,
912
+ borderRadius: "50%",
913
+ backgroundColor: "primary.light",
914
+ display: "flex",
915
+ alignItems: "center",
916
+ justifyContent: "center",
917
+ opacity: 0.9
918
+ },
919
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Lock2.default, { sx: { color: "white", fontSize: 20 } })
920
+ }
921
+ ),
922
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h6", component: "div", sx: { fontWeight: 600 }, children: "Password Protected" })
923
+ ] }),
924
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
925
+ _material.IconButton,
926
+ {
927
+ size: "small",
928
+ onClick: onCancel,
929
+ sx: { color: "text.secondary" },
930
+ "aria-label": "Close dialog",
931
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Close2.default, { fontSize: "small" })
932
+ }
933
+ )
934
+ ] }) }),
935
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.DialogContent, { sx: { pt: 2 }, children: [
936
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", mb: 3 }, children: [
937
+ "This PDF is password protected. Please enter the password to view",
938
+ " ",
939
+ fileName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
940
+ '"',
941
+ fileName,
942
+ '"'
943
+ ] })
944
+ ] }),
945
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", sx: { mb: 2 }, children: error }),
946
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleSubmit, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
947
+ _material.TextField,
948
+ {
949
+ fullWidth: true,
950
+ autoFocus: true,
951
+ type: showPassword ? "text" : "password",
952
+ label: "Password",
953
+ placeholder: "Enter password",
954
+ value: password,
955
+ onChange: (e) => setPassword(e.target.value),
956
+ onKeyPress: handleKeyPress,
957
+ error: Boolean(error),
958
+ InputProps: {
959
+ endAdornment: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
960
+ _material.IconButton,
961
+ {
962
+ onClick: handleTogglePasswordVisibility,
963
+ edge: "end",
964
+ size: "small",
965
+ "aria-label": showPassword ? "Hide password" : "Show password",
966
+ children: showPassword ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _VisibilityOff2.default, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Visibility2.default, {})
967
+ }
968
+ ) })
969
+ },
970
+ sx: {
971
+ "& .MuiOutlinedInput-root": {
972
+ borderRadius: 2
973
+ }
974
+ }
975
+ }
976
+ ) })
977
+ ] }),
978
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.DialogActions, { sx: { px: 3, pb: 3, pt: 2 }, children: [
979
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
980
+ _material.Button,
981
+ {
982
+ onClick: onCancel,
983
+ variant: "outlined",
984
+ sx: {
985
+ borderRadius: 2,
986
+ textTransform: "none",
987
+ px: 3
988
+ },
989
+ children: "Cancel"
990
+ }
991
+ ),
992
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
993
+ _material.Button,
994
+ {
995
+ onClick: handleSubmit,
996
+ variant: "contained",
997
+ disabled: !password.trim(),
998
+ sx: {
999
+ borderRadius: 2,
1000
+ textTransform: "none",
1001
+ px: 3,
1002
+ boxShadow: 2
1003
+ },
1004
+ children: "Unlock PDF"
1005
+ }
1006
+ )
1007
+ ] })
1008
+ ]
1009
+ }
1010
+ );
1011
+ };
1012
+
1013
+ // src/components/viewers/PDFViewer.tsx
1014
+
1015
+ var PDFViewerContent = _react.forwardRef.call(void 0,
1016
+ (props, ref) => {
1017
+ const {
1018
+ file,
1019
+ onLoad,
1020
+ onError,
1021
+ fileName,
1022
+ showPageCount = true,
1023
+ showPageNavigation = true,
1024
+ showZoomControls = true,
1025
+ showRotation = true,
1026
+ showDownload = true,
1027
+ showPrint = true,
1028
+ showSearch = true,
1029
+ showMetadata = true,
1030
+ showProperties = true,
1031
+ showTags = true,
1032
+ showHistory = true,
1033
+ onMetadataClick,
1034
+ onPropertiesClick,
1035
+ onTagsClick,
1036
+ onHistoryClick,
1037
+ onDownloadClick,
1038
+ onPrintClick,
1039
+ initialSearchText,
1040
+ initialSearchPages
1041
+ } = props;
1042
+ const [pdfBuffer, setPdfBuffer] = _react.useState.call(void 0, null);
1043
+ const [state, setState] = _react.useState.call(void 0, "idle");
1044
+ const [error, setError] = _react.useState.call(void 0, null);
1045
+ const pdfViewerRef = _react.useRef.call(void 0, null);
1046
+ const resolvedFileName = _react.useMemo.call(void 0, () => {
1047
+ if (fileName) return fileName;
1048
+ if (file instanceof File) return file.name;
1049
+ if (typeof file === "string") {
1050
+ const urlParts = file.split("/");
1051
+ return urlParts[urlParts.length - 1] || "document.pdf";
1052
+ }
1053
+ return "document.pdf";
1054
+ }, [file, fileName]);
1055
+ const fileExtension = _react.useMemo.call(void 0,
1056
+ () => _chunkYEPEMLM3js.getFileExtension.call(void 0, resolvedFileName),
1057
+ [resolvedFileName]
1058
+ );
1059
+ const [currentPage, setCurrentPage] = _react.useState.call(void 0, 1);
1060
+ const [totalPages, setTotalPages] = _react.useState.call(void 0, 0);
1061
+ const [zoom, setZoom] = _react.useState.call(void 0, 100);
1062
+ const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
1063
+ const [isSearching, setIsSearching] = _react.useState.call(void 0, false);
1064
+ const [pdfContainer, setPdfContainer] = _react.useState.call(void 0, null);
1065
+ const [isSidebarOpen, setIsSidebarOpen] = _react.useState.call(void 0, false);
1066
+ const [searchResults, setSearchResults] = _react.useState.call(void 0, []);
1067
+ const [currentSearchResultIndex, setCurrentSearchResultIndex] = _react.useState.call(void 0, 0);
1068
+ const [totalSearchResults, setTotalSearchResults] = _react.useState.call(void 0, 0);
1069
+ const [autoExecuteSearch, setAutoExecuteSearch] = _react.useState.call(void 0,
1070
+ !!initialSearchText
1071
+ );
1072
+ const [isFullScreen, setIsFullScreen] = _react.useState.call(void 0, false);
1073
+ const containerRef = _react.useRef.call(void 0, null);
1074
+ const [isPasswordDialogOpen, setIsPasswordDialogOpen] = _react.useState.call(void 0, false);
1075
+ const [passwordError, setPasswordError] = _react.useState.call(void 0, "");
1076
+ const [passwordResolve, setPasswordResolve] = _react.useState.call(void 0, null);
1077
+ const hasExecutedInitialSearch = _react.useRef.call(void 0, false);
1078
+ const handleToggleFullScreen = _react.useCallback.call(void 0, () => {
1079
+ if (!isFullScreen && _optionalChain([containerRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.requestFullscreen])) {
1080
+ containerRef.current.requestFullscreen();
1081
+ setIsFullScreen(true);
1082
+ } else if (isFullScreen && document.exitFullscreen) {
1083
+ document.exitFullscreen();
1084
+ setIsFullScreen(false);
1085
+ }
1086
+ }, [isFullScreen]);
1087
+ const handleSidebarClose = _react.useCallback.call(void 0, () => {
1088
+ setIsSidebarOpen(false);
1089
+ setSearchQuery("");
1090
+ setSearchResults([]);
1091
+ setTotalSearchResults(0);
1092
+ setCurrentSearchResultIndex(0);
1093
+ _optionalChain([pdfViewerRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.search, 'access', _5 => _5.stopSearch, 'call', _6 => _6()]);
1094
+ }, []);
1095
+ const toolbar = _chunkEEIQAW55js.mergeToolbarConfig.call(void 0, {
1096
+ showDownload,
1097
+ showPrint,
1098
+ showMetadata,
1099
+ showProperties,
1100
+ showTags,
1101
+ showHistory,
1102
+ showRotation,
1103
+ onDownloadClick,
1104
+ onPrintClick,
1105
+ onMetadataClick,
1106
+ onPropertiesClick,
1107
+ onTagsClick,
1108
+ onHistoryClick,
1109
+ toolbarActions: props.toolbarActions
1110
+ });
1111
+ const toolbarHandlers = _react.useMemo.call(void 0,
1112
+ () => ({
1113
+ handleZoomIn: () => {
1114
+ _optionalChain([pdfViewerRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.zoom, 'access', _9 => _9.zoomIn, 'call', _10 => _10()]);
1115
+ requestAnimationFrame(() => {
1116
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.zoom, 'access', _13 => _13.getZoom, 'call', _14 => _14()]);
1117
+ if (typeof zoomValue === "number") {
1118
+ setZoom(Math.round(zoomValue * 100));
1119
+ }
1120
+ });
1121
+ },
1122
+ handleZoomOut: () => {
1123
+ _optionalChain([pdfViewerRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.zoom, 'access', _17 => _17.zoomOut, 'call', _18 => _18()]);
1124
+ requestAnimationFrame(() => {
1125
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.zoom, 'access', _21 => _21.getZoom, 'call', _22 => _22()]);
1126
+ if (typeof zoomValue === "number") {
1127
+ setZoom(Math.round(zoomValue * 100));
1128
+ }
1129
+ });
1130
+ },
1131
+ handleFitToWidth: () => {
1132
+ _optionalChain([pdfViewerRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.zoom, 'access', _25 => _25.fitToWidth, 'call', _26 => _26()]);
1133
+ requestAnimationFrame(() => {
1134
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.zoom, 'access', _29 => _29.getZoom, 'call', _30 => _30()]);
1135
+ if (typeof zoomValue === "number") {
1136
+ setZoom(Math.round(zoomValue * 100));
1137
+ }
1138
+ });
1139
+ },
1140
+ handleFitToPage: () => {
1141
+ _optionalChain([pdfViewerRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.zoom, 'access', _33 => _33.fitToPage, 'call', _34 => _34()]);
1142
+ requestAnimationFrame(() => {
1143
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.zoom, 'access', _37 => _37.getZoom, 'call', _38 => _38()]);
1144
+ if (typeof zoomValue === "number") {
1145
+ setZoom(Math.round(zoomValue * 100));
1146
+ }
1147
+ });
1148
+ },
1149
+ handlePreviousPage: () => {
1150
+ _optionalChain([pdfViewerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.navigation, 'access', _41 => _41.previousPage, 'call', _42 => _42()]);
1151
+ requestAnimationFrame(() => {
1152
+ const current = _optionalChain([pdfViewerRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.navigation, 'access', _45 => _45.getCurrentPage, 'call', _46 => _46()]) || 1;
1153
+ setCurrentPage(current);
1154
+ });
1155
+ },
1156
+ handleNextPage: () => {
1157
+ _optionalChain([pdfViewerRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.navigation, 'access', _49 => _49.nextPage, 'call', _50 => _50()]);
1158
+ requestAnimationFrame(() => {
1159
+ const current = _optionalChain([pdfViewerRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.navigation, 'access', _53 => _53.getCurrentPage, 'call', _54 => _54()]) || 1;
1160
+ setCurrentPage(current);
1161
+ });
1162
+ },
1163
+ handleFirstPage: () => {
1164
+ _optionalChain([pdfViewerRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.navigation, 'access', _57 => _57.goToFirstPage, 'call', _58 => _58()]);
1165
+ requestAnimationFrame(() => {
1166
+ const current = _optionalChain([pdfViewerRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.navigation, 'access', _61 => _61.getCurrentPage, 'call', _62 => _62()]) || 1;
1167
+ setCurrentPage(current);
1168
+ });
1169
+ },
1170
+ handleLastPage: () => {
1171
+ _optionalChain([pdfViewerRef, 'access', _63 => _63.current, 'optionalAccess', _64 => _64.navigation, 'access', _65 => _65.goToLastPage, 'call', _66 => _66()]);
1172
+ requestAnimationFrame(() => {
1173
+ const current = _optionalChain([pdfViewerRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.navigation, 'access', _69 => _69.getCurrentPage, 'call', _70 => _70()]) || 1;
1174
+ setCurrentPage(current);
1175
+ });
1176
+ },
1177
+ toggleSidebar: () => {
1178
+ if (isSidebarOpen) {
1179
+ handleSidebarClose();
1180
+ } else {
1181
+ setIsSidebarOpen(true);
1182
+ }
1183
+ },
1184
+ handlePageInput: (e) => {
1185
+ const value = e.target.value;
1186
+ if (/^\d*$/.test(value)) {
1187
+ return;
1188
+ }
1189
+ const page = parseInt(value, 10);
1190
+ if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
1191
+ _optionalChain([pdfViewerRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.navigation, 'access', _73 => _73.goToPage, 'call', _74 => _74(page)]);
1192
+ setCurrentPage(page);
1193
+ }
1194
+ },
1195
+ handlePageInputKeyPress: (e) => {
1196
+ if (e.key === "Enter") {
1197
+ const value = e.target.value;
1198
+ const page = parseInt(value, 10);
1199
+ if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
1200
+ _optionalChain([pdfViewerRef, 'access', _75 => _75.current, 'optionalAccess', _76 => _76.navigation, 'access', _77 => _77.goToPage, 'call', _78 => _78(page)]);
1201
+ setCurrentPage(page);
1202
+ }
1203
+ }
1204
+ },
1205
+ handleRotateLeft: () => {
1206
+ _optionalChain([pdfViewerRef, 'access', _79 => _79.current, 'optionalAccess', _80 => _80.rotate, 'optionalAccess', _81 => _81.rotateBackward, 'call', _82 => _82()]);
1207
+ },
1208
+ handleRotateRight: () => {
1209
+ _optionalChain([pdfViewerRef, 'access', _83 => _83.current, 'optionalAccess', _84 => _84.rotate, 'optionalAccess', _85 => _85.rotateForward, 'call', _86 => _86()]);
1210
+ },
1211
+ handleToggleFullScreen
1212
+ }),
1213
+ [isSidebarOpen, totalPages, handleToggleFullScreen]
1214
+ );
1215
+ _react.useEffect.call(void 0, () => {
1216
+ console.log(
1217
+ "came",
1218
+ initialSearchText,
1219
+ pdfViewerRef.current,
1220
+ hasExecutedInitialSearch.current,
1221
+ "state:",
1222
+ state,
1223
+ "totalPages:",
1224
+ totalPages
1225
+ );
1226
+ if (!initialSearchText || hasExecutedInitialSearch.current) return;
1227
+ const isPDFReady = state === "ready";
1228
+ const isPagesInitialized = totalPages > 0;
1229
+ const isViewerAvailable = !!pdfViewerRef.current;
1230
+ const isSearchAPIReady = !!_optionalChain([pdfViewerRef, 'access', _87 => _87.current, 'optionalAccess', _88 => _88.search, 'optionalAccess', _89 => _89.searchText]);
1231
+ const canExecuteSearch = isPDFReady && isPagesInitialized && isViewerAvailable && isSearchAPIReady;
1232
+ if (!canExecuteSearch) return;
1233
+ hasExecutedInitialSearch.current = true;
1234
+ const SEARCH_INITIALIZATION_DELAY = 100;
1235
+ setTimeout(() => {
1236
+ if (!_optionalChain([pdfViewerRef, 'access', _90 => _90.current, 'optionalAccess', _91 => _91.search, 'optionalAccess', _92 => _92.searchText])) {
1237
+ console.warn(
1238
+ "Search API became unavailable, skipping initial search"
1239
+ );
1240
+ hasExecutedInitialSearch.current = false;
1241
+ return;
1242
+ }
1243
+ requestAnimationFrame(() => {
1244
+ requestAnimationFrame(() => {
1245
+ setIsSidebarOpen(true);
1246
+ handleSidebarSearch(initialSearchText, initialSearchPages);
1247
+ setAutoExecuteSearch(false);
1248
+ });
1249
+ });
1250
+ }, SEARCH_INITIALIZATION_DELAY);
1251
+ }, [
1252
+ state,
1253
+ totalPages,
1254
+ pdfViewerRef.current,
1255
+ initialSearchText,
1256
+ initialSearchPages
1257
+ ]);
1258
+ _react.useEffect.call(void 0, () => {
1259
+ setSearchQuery("");
1260
+ setSearchResults([]);
1261
+ setCurrentSearchResultIndex(0);
1262
+ setTotalSearchResults(0);
1263
+ setIsSearching(false);
1264
+ setIsSidebarOpen(false);
1265
+ hasExecutedInitialSearch.current = false;
1266
+ setCurrentPage(1);
1267
+ setTotalPages(0);
1268
+ setZoom(100);
1269
+ setState("idle");
1270
+ setError(null);
1271
+ setPdfBuffer(null);
1272
+ }, [file]);
1273
+ _react.useEffect.call(void 0, () => {
1274
+ if (state !== "ready") return;
1275
+ const container = document.querySelector(
1276
+ '[data-pdf-viewer], .embedpdf-viewport, [role="document"]'
1277
+ );
1278
+ if (container) {
1279
+ setPdfContainer(container);
1280
+ return;
1281
+ }
1282
+ const observer = new MutationObserver(() => {
1283
+ const foundContainer = document.querySelector(
1284
+ '[data-pdf-viewer], .embedpdf-viewport, [role="document"]'
1285
+ );
1286
+ if (foundContainer) {
1287
+ setPdfContainer(foundContainer);
1288
+ observer.disconnect();
1289
+ }
1290
+ });
1291
+ observer.observe(document.body, { childList: true, subtree: true });
1292
+ return () => observer.disconnect();
1293
+ }, [state]);
1294
+ _react.useEffect.call(void 0, () => {
1295
+ if (state !== "ready" || totalPages > 0) return;
1296
+ const initializePageCount = async () => {
1297
+ const waitForViewer = async (maxAttempts = 10) => {
1298
+ for (let i = 0; i < maxAttempts; i++) {
1299
+ if (pdfViewerRef.current) return pdfViewerRef.current;
1300
+ await new Promise(
1301
+ (resolve) => requestAnimationFrame(
1302
+ () => setTimeout(resolve, Math.min(100 * Math.pow(2, i), 1e3))
1303
+ )
1304
+ );
1305
+ }
1306
+ return null;
1307
+ };
1308
+ const viewer = await waitForViewer();
1309
+ if (!viewer) return;
1310
+ await new Promise((resolve) => requestAnimationFrame(resolve));
1311
+ try {
1312
+ const count = _optionalChain([viewer, 'access', _93 => _93.navigation, 'optionalAccess', _94 => _94.getTotalPages, 'optionalCall', _95 => _95()]);
1313
+ if (count && count > 1) {
1314
+ setTotalPages(count);
1315
+ return;
1316
+ }
1317
+ } catch (e) {
1318
+ }
1319
+ try {
1320
+ const results = await _optionalChain([viewer, 'access', _96 => _96.search, 'optionalAccess', _97 => _97.searchText, 'optionalCall', _98 => _98("e")]);
1321
+ if (_optionalChain([results, 'optionalAccess', _99 => _99.results]) && results.results.length > 0) {
1322
+ const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
1323
+ const count = Math.max(...pageIndices) + 1;
1324
+ _optionalChain([viewer, 'access', _100 => _100.search, 'optionalAccess', _101 => _101.stopSearch, 'optionalCall', _102 => _102()]);
1325
+ setTotalPages(count);
1326
+ return;
1327
+ }
1328
+ } catch (error2) {
1329
+ }
1330
+ await new Promise((resolve) => setTimeout(resolve, 200));
1331
+ try {
1332
+ const selectors = [
1333
+ "[data-page-index]",
1334
+ "[data-page-number]",
1335
+ ".embedpdf-page",
1336
+ '[role="article"]',
1337
+ "canvas[data-page]",
1338
+ ".react-pdf__Page"
1339
+ ];
1340
+ for (const selector of selectors) {
1341
+ const pages = document.querySelectorAll(selector);
1342
+ if (pages.length > 0) {
1343
+ setTotalPages(pages.length);
1344
+ return;
1345
+ }
1346
+ }
1347
+ } catch (error2) {
1348
+ }
1349
+ try {
1350
+ const count = _optionalChain([viewer, 'access', _103 => _103.navigation, 'optionalAccess', _104 => _104.getTotalPages, 'optionalCall', _105 => _105()]);
1351
+ if (count && count > 0) {
1352
+ setTotalPages(count);
1353
+ return;
1354
+ }
1355
+ } catch (e) {
1356
+ }
1357
+ console.warn(
1358
+ "Could not determine total pages, using fallback value of 1"
1359
+ );
1360
+ setTotalPages(1);
1361
+ };
1362
+ initializePageCount();
1363
+ }, [state, totalPages]);
1364
+ _react.useEffect.call(void 0, () => {
1365
+ if (state === "ready" && pdfViewerRef.current) {
1366
+ const updateInfo = () => {
1367
+ const current = _optionalChain([pdfViewerRef, 'access', _106 => _106.current, 'optionalAccess', _107 => _107.navigation, 'access', _108 => _108.getCurrentPage, 'call', _109 => _109()]) || 1;
1368
+ const total = _optionalChain([pdfViewerRef, 'access', _110 => _110.current, 'optionalAccess', _111 => _111.navigation, 'access', _112 => _112.getTotalPages, 'call', _113 => _113()]) || 0;
1369
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _114 => _114.current, 'optionalAccess', _115 => _115.zoom, 'access', _116 => _116.getZoom, 'call', _117 => _117()]);
1370
+ const currentSearchState = _optionalChain([pdfViewerRef, 'access', _118 => _118.current, 'optionalAccess', _119 => _119.search, 'access', _120 => _120.getSearchState, 'call', _121 => _121()]);
1371
+ setCurrentPage(current);
1372
+ if (total > 0 && total !== totalPages) {
1373
+ setTotalPages(total);
1374
+ }
1375
+ if (typeof zoomValue === "number") {
1376
+ setZoom(Math.round(zoomValue * 100));
1377
+ }
1378
+ };
1379
+ updateInfo();
1380
+ const interval = setInterval(updateInfo, 300);
1381
+ return () => clearInterval(interval);
1382
+ }
1383
+ }, [state, totalPages]);
1384
+ _react.useImperativeHandle.call(void 0,
1385
+ ref,
1386
+ () => ({
1387
+ zoomIn: () => {
1388
+ _optionalChain([pdfViewerRef, 'access', _122 => _122.current, 'optionalAccess', _123 => _123.zoom, 'access', _124 => _124.zoomIn, 'call', _125 => _125()]);
1389
+ updateZoomDisplay();
1390
+ },
1391
+ zoomOut: () => {
1392
+ _optionalChain([pdfViewerRef, 'access', _126 => _126.current, 'optionalAccess', _127 => _127.zoom, 'access', _128 => _128.zoomOut, 'call', _129 => _129()]);
1393
+ updateZoomDisplay();
1394
+ },
1395
+ setZoom: (level) => {
1396
+ _optionalChain([pdfViewerRef, 'access', _130 => _130.current, 'optionalAccess', _131 => _131.zoom, 'access', _132 => _132.setZoom, 'call', _133 => _133(level)]);
1397
+ updateZoomDisplay();
1398
+ },
1399
+ resetZoom: () => {
1400
+ _optionalChain([pdfViewerRef, 'access', _134 => _134.current, 'optionalAccess', _135 => _135.zoom, 'access', _136 => _136.resetZoom, 'call', _137 => _137()]);
1401
+ updateZoomDisplay();
1402
+ },
1403
+ getZoom: () => {
1404
+ const zoom2 = _optionalChain([pdfViewerRef, 'access', _138 => _138.current, 'optionalAccess', _139 => _139.zoom, 'access', _140 => _140.getZoom, 'call', _141 => _141()]);
1405
+ return typeof zoom2 === "number" ? zoom2 : 1;
1406
+ },
1407
+ goToPage: (page) => {
1408
+ _optionalChain([pdfViewerRef, 'access', _142 => _142.current, 'optionalAccess', _143 => _143.navigation, 'access', _144 => _144.goToPage, 'call', _145 => _145(page)]);
1409
+ setCurrentPage(page);
1410
+ },
1411
+ getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _146 => _146.current, 'optionalAccess', _147 => _147.navigation, 'access', _148 => _148.getCurrentPage, 'call', _149 => _149()]) || 1,
1412
+ getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _150 => _150.current, 'optionalAccess', _151 => _151.navigation, 'access', _152 => _152.getTotalPages, 'call', _153 => _153()]) || 0,
1413
+ nextPage: () => {
1414
+ _optionalChain([pdfViewerRef, 'access', _154 => _154.current, 'optionalAccess', _155 => _155.navigation, 'access', _156 => _156.nextPage, 'call', _157 => _157()]);
1415
+ updatePageDisplay();
1416
+ },
1417
+ previousPage: () => {
1418
+ _optionalChain([pdfViewerRef, 'access', _158 => _158.current, 'optionalAccess', _159 => _159.navigation, 'access', _160 => _160.previousPage, 'call', _161 => _161()]);
1419
+ updatePageDisplay();
1420
+ },
1421
+ goToFirstPage: () => {
1422
+ _optionalChain([pdfViewerRef, 'access', _162 => _162.current, 'optionalAccess', _163 => _163.navigation, 'access', _164 => _164.goToFirstPage, 'call', _165 => _165()]);
1423
+ updatePageDisplay();
1424
+ },
1425
+ goToLastPage: () => {
1426
+ _optionalChain([pdfViewerRef, 'access', _166 => _166.current, 'optionalAccess', _167 => _167.navigation, 'access', _168 => _168.goToLastPage, 'call', _169 => _169()]);
1427
+ updatePageDisplay();
1428
+ },
1429
+ searchText: async (keyword) => {
1430
+ setIsSearching(true);
1431
+ const results = await _optionalChain([pdfViewerRef, 'access', _170 => _170.current, 'optionalAccess', _171 => _171.search, 'access', _172 => _172.searchText, 'call', _173 => _173(
1432
+ keyword
1433
+ )]);
1434
+ setIsSearching(false);
1435
+ setSearchQuery(keyword);
1436
+ return results;
1437
+ },
1438
+ nextResult: () => {
1439
+ const index = _optionalChain([pdfViewerRef, 'access', _174 => _174.current, 'optionalAccess', _175 => _175.search, 'access', _176 => _176.nextResult, 'call', _177 => _177()]) || -1;
1440
+ return index;
1441
+ },
1442
+ previousResult: () => {
1443
+ const index = _optionalChain([pdfViewerRef, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.search, 'access', _180 => _180.previousResult, 'call', _181 => _181()]) || -1;
1444
+ return index;
1445
+ },
1446
+ goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _182 => _182.current, 'optionalAccess', _183 => _183.search, 'access', _184 => _184.goToResult, 'call', _185 => _185(index)]) || -1,
1447
+ stopSearch: () => {
1448
+ _optionalChain([pdfViewerRef, 'access', _186 => _186.current, 'optionalAccess', _187 => _187.search, 'access', _188 => _188.stopSearch, 'call', _189 => _189()]);
1449
+ setSearchQuery("");
1450
+ },
1451
+ getSearchState: () => _optionalChain([pdfViewerRef, 'access', _190 => _190.current, 'optionalAccess', _191 => _191.search, 'access', _192 => _192.getSearchState, 'call', _193 => _193()]) || null,
1452
+ getSelectedText: () => _optionalChain([pdfViewerRef, 'access', _194 => _194.current, 'optionalAccess', _195 => _195.selection, 'access', _196 => _196.getSelectedText, 'call', _197 => _197()]) || "",
1453
+ clearSelection: () => _optionalChain([pdfViewerRef, 'access', _198 => _198.current, 'optionalAccess', _199 => _199.selection, 'access', _200 => _200.clearSelection, 'call', _201 => _201()]),
1454
+ rotateForward: () => _optionalChain([pdfViewerRef, 'access', _202 => _202.current, 'optionalAccess', _203 => _203.rotate, 'optionalAccess', _204 => _204.rotateForward, 'call', _205 => _205()]),
1455
+ rotateBackward: () => _optionalChain([pdfViewerRef, 'access', _206 => _206.current, 'optionalAccess', _207 => _207.rotate, 'optionalAccess', _208 => _208.rotateBackward, 'call', _209 => _209()]),
1456
+ getRotation: () => _optionalChain([pdfViewerRef, 'access', _210 => _210.current, 'optionalAccess', _211 => _211.rotate, 'optionalAccess', _212 => _212.getRotation, 'call', _213 => _213()]) || 0
1457
+ }),
1458
+ []
1459
+ );
1460
+ const updatePageDisplay = () => {
1461
+ requestAnimationFrame(() => {
1462
+ const current = _optionalChain([pdfViewerRef, 'access', _214 => _214.current, 'optionalAccess', _215 => _215.navigation, 'access', _216 => _216.getCurrentPage, 'call', _217 => _217()]) || 1;
1463
+ setCurrentPage(current);
1464
+ });
1465
+ };
1466
+ const updateZoomDisplay = () => {
1467
+ requestAnimationFrame(() => {
1468
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _218 => _218.current, 'optionalAccess', _219 => _219.zoom, 'access', _220 => _220.getZoom, 'call', _221 => _221()]);
1469
+ if (typeof zoomValue === "number") {
1470
+ setZoom(Math.round(zoomValue * 100));
1471
+ }
1472
+ });
1473
+ };
1474
+ const handleSearch = async () => {
1475
+ if (!searchQuery.trim()) return;
1476
+ setIsSearching(true);
1477
+ const results = await _optionalChain([pdfViewerRef, 'access', _222 => _222.current, 'optionalAccess', _223 => _223.search, 'access', _224 => _224.searchText, 'call', _225 => _225(
1478
+ searchQuery
1479
+ )]);
1480
+ setIsSearching(false);
1481
+ if (_optionalChain([results, 'optionalAccess', _226 => _226.results]) && Array.isArray(results.results) && results.results.length > 0) {
1482
+ const formattedResults = formatSearchResults(results.results);
1483
+ updateSearchState(formattedResults);
1484
+ } else {
1485
+ clearSearchResults();
1486
+ }
1487
+ };
1488
+ const handleSearchKeyPress = (e) => {
1489
+ if (e.key === "Enter") {
1490
+ handleSearch();
1491
+ }
1492
+ };
1493
+ const handleSidebarSearch = async (keyword, pageNumbers) => {
1494
+ setSearchQuery(keyword);
1495
+ if (!keyword.trim()) {
1496
+ setSearchResults([]);
1497
+ setTotalSearchResults(0);
1498
+ setCurrentSearchResultIndex(0);
1499
+ _optionalChain([pdfViewerRef, 'access', _227 => _227.current, 'optionalAccess', _228 => _228.search, 'access', _229 => _229.stopSearch, 'call', _230 => _230()]);
1500
+ return;
1501
+ }
1502
+ if (!_optionalChain([pdfViewerRef, 'access', _231 => _231.current, 'optionalAccess', _232 => _232.search, 'optionalAccess', _233 => _233.searchText])) {
1503
+ console.warn("Search functionality not yet available");
1504
+ return;
1505
+ }
1506
+ setIsSearching(true);
1507
+ try {
1508
+ const results = await pdfViewerRef.current.search.searchText(keyword);
1509
+ console.log("Search completed:", results);
1510
+ setIsSearching(false);
1511
+ const hasValidResults = _optionalChain([results, 'optionalAccess', _234 => _234.results]) && Array.isArray(results.results) && results.results.length > 0;
1512
+ if (hasValidResults) {
1513
+ const formattedResults = formatSearchResults(results.results);
1514
+ updateSearchState(formattedResults);
1515
+ navigateToFirstResult(formattedResults);
1516
+ } else if (pageNumbers && pageNumbers.length > 0) {
1517
+ const fallbackResults = createFallbackResults(pageNumbers, keyword);
1518
+ updateSearchState(fallbackResults);
1519
+ navigateToPage(pageNumbers[0]);
1520
+ } else {
1521
+ clearSearchResults();
1522
+ }
1523
+ } catch (error2) {
1524
+ console.error("Search failed:", error2);
1525
+ setIsSearching(false);
1526
+ clearSearchResults();
1527
+ }
1528
+ };
1529
+ const formatSearchResults = (results) => {
1530
+ return results.map((result, index) => {
1531
+ let textContent = "";
1532
+ let contextContent = "";
1533
+ if (result.context && typeof result.context === "object") {
1534
+ const { before = "", match = "", after = "" } = result.context;
1535
+ textContent = match;
1536
+ contextContent = `${before}${match}${after}`;
1537
+ } else if (typeof result === "string") {
1538
+ textContent = result;
1539
+ contextContent = result;
1540
+ } else {
1541
+ textContent = String(result.match || result.text || "");
1542
+ contextContent = textContent;
1543
+ }
1544
+ return {
1545
+ pageNumber: (_nullishCoalesce(_nullishCoalesce(result.pageIndex, () => ( result.pageNumber)), () => ( 0))) + 1,
1546
+ text: textContent,
1547
+ context: contextContent,
1548
+ index
1549
+ };
1550
+ });
1551
+ };
1552
+ const createFallbackResults = (pageNumbers, keyword) => {
1553
+ return pageNumbers.map((pageNum, index) => ({
1554
+ pageNumber: pageNum,
1555
+ text: keyword,
1556
+ context: `"${keyword}" found on this page ${pageNum}`,
1557
+ index
1558
+ }));
1559
+ };
1560
+ const updateSearchState = (results) => {
1561
+ setSearchResults(results);
1562
+ setTotalSearchResults(results.length);
1563
+ setCurrentSearchResultIndex(0);
1564
+ };
1565
+ const clearSearchResults = () => {
1566
+ setSearchResults([]);
1567
+ setTotalSearchResults(0);
1568
+ setCurrentSearchResultIndex(0);
1569
+ };
1570
+ const navigateToFirstResult = (results) => {
1571
+ if (results.length > 0) {
1572
+ navigateToPage(results[0].pageNumber);
1573
+ }
1574
+ };
1575
+ const navigateToPage = (pageNumber) => {
1576
+ requestAnimationFrame(() => {
1577
+ _optionalChain([pdfViewerRef, 'access', _235 => _235.current, 'optionalAccess', _236 => _236.navigation, 'access', _237 => _237.goToPage, 'call', _238 => _238(pageNumber)]);
1578
+ setCurrentPage(pageNumber);
1579
+ });
1580
+ };
1581
+ const handleSearchResultClick = (pageNumber, resultIndex) => {
1582
+ _optionalChain([pdfViewerRef, 'access', _239 => _239.current, 'optionalAccess', _240 => _240.navigation, 'access', _241 => _241.goToPage, 'call', _242 => _242(pageNumber)]);
1583
+ setCurrentSearchResultIndex(resultIndex);
1584
+ setCurrentPage(pageNumber);
1585
+ _optionalChain([pdfViewerRef, 'access', _243 => _243.current, 'optionalAccess', _244 => _244.search, 'access', _245 => _245.goToResult, 'call', _246 => _246(resultIndex)]);
1586
+ };
1587
+ const handleNextSearchResult = () => {
1588
+ if (currentSearchResultIndex < totalSearchResults - 1) {
1589
+ const nextIndex = currentSearchResultIndex + 1;
1590
+ setCurrentSearchResultIndex(nextIndex);
1591
+ _optionalChain([pdfViewerRef, 'access', _247 => _247.current, 'optionalAccess', _248 => _248.search, 'access', _249 => _249.nextResult, 'call', _250 => _250()]);
1592
+ if (searchResults[nextIndex]) {
1593
+ const pageNumber = searchResults[nextIndex].pageNumber;
1594
+ _optionalChain([pdfViewerRef, 'access', _251 => _251.current, 'optionalAccess', _252 => _252.navigation, 'access', _253 => _253.goToPage, 'call', _254 => _254(pageNumber)]);
1595
+ setCurrentPage(pageNumber);
1596
+ }
1597
+ }
1598
+ };
1599
+ const handlePreviousSearchResult = () => {
1600
+ if (currentSearchResultIndex > 0) {
1601
+ const prevIndex = currentSearchResultIndex - 1;
1602
+ setCurrentSearchResultIndex(prevIndex);
1603
+ _optionalChain([pdfViewerRef, 'access', _255 => _255.current, 'optionalAccess', _256 => _256.search, 'access', _257 => _257.previousResult, 'call', _258 => _258()]);
1604
+ if (searchResults[prevIndex]) {
1605
+ const pageNumber = searchResults[prevIndex].pageNumber;
1606
+ _optionalChain([pdfViewerRef, 'access', _259 => _259.current, 'optionalAccess', _260 => _260.navigation, 'access', _261 => _261.goToPage, 'call', _262 => _262(pageNumber)]);
1607
+ setCurrentPage(pageNumber);
1608
+ }
1609
+ }
1610
+ };
1611
+ _react.useEffect.call(void 0, () => {
1612
+ if (!file) {
1613
+ setState("error");
1614
+ setError("No file provided");
1615
+ return;
1616
+ }
1617
+ const loadPDF = async () => {
1618
+ try {
1619
+ setState("loading");
1620
+ setError(null);
1621
+ let arrayBuffer;
1622
+ if (file instanceof File) {
1623
+ arrayBuffer = await file.arrayBuffer();
1624
+ } else if (typeof file === "string") {
1625
+ const response = await fetch(file);
1626
+ if (!response.ok) {
1627
+ throw new Error(`Failed to load PDF: ${response.statusText}`);
1628
+ }
1629
+ arrayBuffer = await response.arrayBuffer();
1630
+ } else if (file instanceof ArrayBuffer) {
1631
+ arrayBuffer = file;
1632
+ } else {
1633
+ throw new Error("Unsupported file type");
1634
+ }
1635
+ setPdfBuffer(arrayBuffer);
1636
+ setState("ready");
1637
+ _optionalChain([onLoad, 'optionalCall', _263 => _263()]);
1638
+ } catch (err) {
1639
+ const errorMessage = err.message || "Failed to load PDF";
1640
+ setState("error");
1641
+ setError(errorMessage);
1642
+ _optionalChain([onError, 'optionalCall', _264 => _264(err)]);
1643
+ }
1644
+ };
1645
+ loadPDF();
1646
+ }, [file, onLoad, onError]);
1647
+ const handlePasswordRequest = _react.useCallback.call(void 0,
1648
+ async (fileName2) => {
1649
+ return new Promise((resolve) => {
1650
+ setPasswordResolve(() => resolve);
1651
+ setPasswordError("");
1652
+ setIsPasswordDialogOpen(true);
1653
+ });
1654
+ },
1655
+ []
1656
+ );
1657
+ const handlePasswordSubmit = _react.useCallback.call(void 0,
1658
+ (password) => {
1659
+ if (passwordResolve) {
1660
+ passwordResolve(password);
1661
+ setPasswordResolve(null);
1662
+ setIsPasswordDialogOpen(false);
1663
+ setPasswordError("");
1664
+ }
1665
+ },
1666
+ [passwordResolve]
1667
+ );
1668
+ const handlePasswordCancel = _react.useCallback.call(void 0, () => {
1669
+ if (passwordResolve) {
1670
+ passwordResolve(null);
1671
+ setPasswordResolve(null);
1672
+ setIsPasswordDialogOpen(false);
1673
+ setPasswordError("");
1674
+ }
1675
+ }, [passwordResolve]);
1676
+ if (state === "loading") {
1677
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1678
+ "div",
1679
+ {
1680
+ style: {
1681
+ display: "flex",
1682
+ flexDirection: "column",
1683
+ alignItems: "center",
1684
+ justifyContent: "center",
1685
+ height: "100%",
1686
+ gap: "16px"
1687
+ },
1688
+ children: [
1689
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1690
+ "div",
1691
+ {
1692
+ className: "spinner",
1693
+ style: {
1694
+ width: "48px",
1695
+ height: "48px",
1696
+ border: "4px solid #f3f3f3",
1697
+ borderTop: "4px solid #3498db",
1698
+ borderRadius: "50%",
1699
+ animation: "spin 1s linear infinite"
1700
+ }
1701
+ }
1702
+ ),
1703
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Loading PDF..." }),
1704
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `
1705
+ @keyframes spin {
1706
+ 0% { transform: rotate(0deg); }
1707
+ 100% { transform: rotate(360deg); }
1708
+ }
1709
+ ` })
1710
+ ]
1711
+ }
1712
+ );
1713
+ }
1714
+ if (state === "error" || error) {
1715
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1716
+ "div",
1717
+ {
1718
+ style: {
1719
+ display: "flex",
1720
+ flexDirection: "column",
1721
+ alignItems: "center",
1722
+ justifyContent: "center",
1723
+ height: "100%",
1724
+ padding: "24px"
1725
+ },
1726
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1727
+ "div",
1728
+ {
1729
+ style: {
1730
+ maxWidth: "400px",
1731
+ padding: "16px",
1732
+ backgroundColor: "#fee",
1733
+ border: "1px solid #fcc",
1734
+ borderRadius: "4px"
1735
+ },
1736
+ children: [
1737
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { style: { marginTop: 0 }, children: "Failed to Load PDF" }),
1738
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: error || "Unknown error occurred" })
1739
+ ]
1740
+ }
1741
+ )
1742
+ }
1743
+ );
1744
+ }
1745
+ if (!pdfBuffer || state !== "ready") {
1746
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1747
+ "div",
1748
+ {
1749
+ style: {
1750
+ display: "flex",
1751
+ alignItems: "center",
1752
+ justifyContent: "center",
1753
+ height: "100%"
1754
+ },
1755
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Preparing PDF..." })
1756
+ }
1757
+ );
1758
+ }
1759
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: "pdf-viewer-container", children: [
1760
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunkA2MSWOEMjs.toolbarStyles }),
1761
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFHeader, { fileName: resolvedFileName, fileExtension }),
1762
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1763
+ PDFToolbar,
1764
+ {
1765
+ currentPage,
1766
+ totalPages,
1767
+ zoom,
1768
+ isSidebarOpen,
1769
+ showPageNavigation,
1770
+ showPageCount,
1771
+ showZoomControls,
1772
+ showSearch,
1773
+ showRotation: !toolbar.isHidden("rotation"),
1774
+ showMetadata: !toolbar.isHidden("metadata"),
1775
+ showProperties: !toolbar.isHidden("properties"),
1776
+ showDownload: !toolbar.isHidden("download"),
1777
+ showPrint: !toolbar.isHidden("print"),
1778
+ showTags: !toolbar.isHidden("tags"),
1779
+ showHistory: !toolbar.isHidden("history"),
1780
+ disabledRotateLeft: toolbar.isDisabled("rotateLeft"),
1781
+ disabledRotateRight: toolbar.isDisabled("rotateRight"),
1782
+ disabledMetadata: toolbar.isDisabled("metadata"),
1783
+ disabledTags: toolbar.isDisabled("tags"),
1784
+ disabledProperties: toolbar.isDisabled("properties"),
1785
+ disabledHistory: toolbar.isDisabled("history"),
1786
+ disabledDownload: toolbar.isDisabled("download"),
1787
+ disabledPrint: toolbar.isDisabled("print"),
1788
+ onFirstPage: toolbarHandlers.handleFirstPage,
1789
+ onPreviousPage: toolbarHandlers.handlePreviousPage,
1790
+ onNextPage: toolbarHandlers.handleNextPage,
1791
+ onLastPage: toolbarHandlers.handleLastPage,
1792
+ onPageInput: toolbarHandlers.handlePageInput,
1793
+ onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
1794
+ onZoomIn: toolbarHandlers.handleZoomIn,
1795
+ onZoomOut: toolbarHandlers.handleZoomOut,
1796
+ onFitToWidth: toolbarHandlers.handleFitToWidth,
1797
+ onFitToPage: toolbarHandlers.handleFitToPage,
1798
+ onToggleSidebar: toolbarHandlers.toggleSidebar,
1799
+ onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
1800
+ onRotateLeft: toolbarHandlers.handleRotateLeft,
1801
+ onRotateRight: toolbarHandlers.handleRotateRight,
1802
+ onDownloadClick: toolbar.getHandler("download", onDownloadClick),
1803
+ onPrintClick: toolbar.getHandler("print", onPrintClick),
1804
+ onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
1805
+ onPropertiesClick: toolbar.getHandler(
1806
+ "properties",
1807
+ onPropertiesClick
1808
+ ),
1809
+ onTagsClick: toolbar.getHandler("tags", onTagsClick),
1810
+ onHistoryClick: toolbar.getHandler("history", onHistoryClick)
1811
+ }
1812
+ ),
1813
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
1814
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1815
+ StablePDFViewer,
1816
+ {
1817
+ pdfBuffer,
1818
+ onPasswordRequest: handlePasswordRequest,
1819
+ pdfViewerRef
1820
+ }
1821
+ ) }),
1822
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1823
+ SearchSidebar,
1824
+ {
1825
+ isOpen: isSidebarOpen,
1826
+ onClose: handleSidebarClose,
1827
+ onSearch: handleSidebarSearch,
1828
+ onSearchResultClick: handleSearchResultClick,
1829
+ onNextResult: handleNextSearchResult,
1830
+ onPreviousResult: handlePreviousSearchResult,
1831
+ currentResultIndex: currentSearchResultIndex,
1832
+ totalResults: totalSearchResults,
1833
+ searchKeyword: searchQuery,
1834
+ searchResults,
1835
+ isSearching
1836
+ }
1837
+ )
1838
+ ] }),
1839
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1840
+ PasswordDialog,
1841
+ {
1842
+ open: isPasswordDialogOpen,
1843
+ fileName: resolvedFileName,
1844
+ onSubmit: handlePasswordSubmit,
1845
+ onCancel: handlePasswordCancel,
1846
+ error: passwordError
1847
+ }
1848
+ )
1849
+ ] });
1850
+ }
1851
+ );
1852
+ PDFViewerContent.displayName = "PDFViewerContent";
1853
+ var PDFViewer = _react.forwardRef.call(void 0,
1854
+ (props, ref) => {
1855
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFViewerContent, { ...props, sourceDescription: "doc.pdf", ref });
1856
+ }
1857
+ );
1858
+ PDFViewer.displayName = "PDFViewer";
1859
+
1860
+
1861
+
1862
+ exports.PDFViewer = PDFViewer;
1863
+ //# sourceMappingURL=chunk-PFX2NN3C.js.map