@cannyminds/dms-file-viewers 0.2.0 → 0.4.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 (81) hide show
  1. package/dist/{chunk-FZYMVHF6.mjs → chunk-4DJJINTB.mjs} +54 -55
  2. package/dist/chunk-4DJJINTB.mjs.map +1 -0
  3. package/dist/chunk-677DWENS.mjs +133 -0
  4. package/dist/chunk-677DWENS.mjs.map +1 -0
  5. package/dist/chunk-77UARJVQ.js +133 -0
  6. package/dist/chunk-77UARJVQ.js.map +1 -0
  7. package/dist/{chunk-LKBM4O47.mjs → chunk-7BLEPGZ4.mjs} +67 -61
  8. package/dist/chunk-7BLEPGZ4.mjs.map +1 -0
  9. package/dist/{chunk-QRYIHDRT.mjs → chunk-BHMFZTZ7.mjs} +54 -55
  10. package/dist/chunk-BHMFZTZ7.mjs.map +1 -0
  11. package/dist/{chunk-XQBXRMB7.mjs → chunk-BONT4K3R.mjs} +14 -8
  12. package/dist/chunk-BONT4K3R.mjs.map +1 -0
  13. package/dist/{chunk-3STHCDAC.js → chunk-DDT3GC3C.js} +425 -164
  14. package/dist/chunk-DDT3GC3C.js.map +1 -0
  15. package/dist/{chunk-EMP7RZM2.js → chunk-DOOYIHGW.js} +52 -53
  16. package/dist/chunk-DOOYIHGW.js.map +1 -0
  17. package/dist/{chunk-73ZIFR3P.mjs → chunk-J2YW5DHC.mjs} +457 -196
  18. package/dist/chunk-J2YW5DHC.mjs.map +1 -0
  19. package/dist/{chunk-BNHQYEZ7.js → chunk-SBEFC7HP.js} +203 -158
  20. package/dist/chunk-SBEFC7HP.js.map +1 -0
  21. package/dist/{chunk-4RL77HKO.js → chunk-SNEIVT4R.js} +52 -53
  22. package/dist/chunk-SNEIVT4R.js.map +1 -0
  23. package/dist/{chunk-7JTIG6OU.js → chunk-WP55NYFS.js} +67 -61
  24. package/dist/chunk-WP55NYFS.js.map +1 -0
  25. package/dist/{chunk-NOLXOOIP.mjs → chunk-YHMHDPLQ.mjs} +200 -155
  26. package/dist/chunk-YHMHDPLQ.mjs.map +1 -0
  27. package/dist/{chunk-GNWU6XHH.js → chunk-Z3IUTTJQ.js} +15 -9
  28. package/dist/{chunk-GNWU6XHH.js.map → chunk-Z3IUTTJQ.js.map} +1 -1
  29. package/dist/components/viewers/AudioViewer.d.mts +1 -1
  30. package/dist/components/viewers/AudioViewer.d.ts +1 -1
  31. package/dist/components/viewers/AudioViewer.js +2 -2
  32. package/dist/components/viewers/AudioViewer.mjs +1 -1
  33. package/dist/components/viewers/DefaultViewer.d.mts +1 -1
  34. package/dist/components/viewers/DefaultViewer.d.ts +1 -1
  35. package/dist/components/viewers/DefaultViewer.js +3 -2
  36. package/dist/components/viewers/DefaultViewer.js.map +1 -1
  37. package/dist/components/viewers/DefaultViewer.mjs +2 -1
  38. package/dist/components/viewers/ImageViewer.d.mts +1 -1
  39. package/dist/components/viewers/ImageViewer.d.ts +1 -1
  40. package/dist/components/viewers/ImageViewer.js +3 -3
  41. package/dist/components/viewers/ImageViewer.mjs +2 -2
  42. package/dist/components/viewers/PDFViewer.d.mts +1 -1
  43. package/dist/components/viewers/PDFViewer.d.ts +1 -1
  44. package/dist/components/viewers/PDFViewer.js +2 -2
  45. package/dist/components/viewers/PDFViewer.mjs +1 -1
  46. package/dist/components/viewers/TIFFViewer.d.mts +1 -1
  47. package/dist/components/viewers/TIFFViewer.d.ts +1 -1
  48. package/dist/components/viewers/TIFFViewer.js +2 -2
  49. package/dist/components/viewers/TIFFViewer.mjs +1 -1
  50. package/dist/components/viewers/TextViewer.d.mts +1 -1
  51. package/dist/components/viewers/TextViewer.d.ts +1 -1
  52. package/dist/components/viewers/TextViewer.js +2 -2
  53. package/dist/components/viewers/TextViewer.mjs +1 -1
  54. package/dist/components/viewers/VideoViewer.d.mts +1 -1
  55. package/dist/components/viewers/VideoViewer.d.ts +1 -1
  56. package/dist/components/viewers/VideoViewer.js +2 -2
  57. package/dist/components/viewers/VideoViewer.mjs +1 -1
  58. package/dist/index.d.mts +2 -2
  59. package/dist/index.d.ts +2 -2
  60. package/dist/index.js +30 -19
  61. package/dist/index.js.map +1 -1
  62. package/dist/index.mjs +29 -18
  63. package/dist/index.mjs.map +1 -1
  64. package/dist/{types-CquKzJLE.d.mts → types-C6IEfcTM.d.mts} +13 -1
  65. package/dist/{types-CquKzJLE.d.ts → types-C6IEfcTM.d.ts} +13 -1
  66. package/package.json +1 -1
  67. package/dist/chunk-3STHCDAC.js.map +0 -1
  68. package/dist/chunk-4RL77HKO.js.map +0 -1
  69. package/dist/chunk-73ZIFR3P.mjs.map +0 -1
  70. package/dist/chunk-7JTIG6OU.js.map +0 -1
  71. package/dist/chunk-BNHQYEZ7.js.map +0 -1
  72. package/dist/chunk-EMP7RZM2.js.map +0 -1
  73. package/dist/chunk-FZYMVHF6.mjs.map +0 -1
  74. package/dist/chunk-LKBM4O47.mjs.map +0 -1
  75. package/dist/chunk-NOLXOOIP.mjs.map +0 -1
  76. package/dist/chunk-QLJKOQTP.mjs +0 -78
  77. package/dist/chunk-QLJKOQTP.mjs.map +0 -1
  78. package/dist/chunk-QRYIHDRT.mjs.map +0 -1
  79. package/dist/chunk-XQBXRMB7.mjs.map +0 -1
  80. package/dist/chunk-Z7FUO5RX.js +0 -78
  81. package/dist/chunk-Z7FUO5RX.js.map +0 -1
@@ -5,8 +5,8 @@ import {
5
5
  } from "./chunk-QQDQJ7TS.mjs";
6
6
 
7
7
  // src/components/viewers/PDFViewer.tsx
8
- import React2, { useCallback, useEffect, useMemo, useRef as useRef2, useState as useState2, forwardRef, useImperativeHandle } from "react";
9
- import { PDFViewer as HeadlessPDFViewer } from "@cannyminds/pdf-viewer";
8
+ import { useCallback, useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3, forwardRef, useImperativeHandle } from "react";
9
+ import { PDFViewer as HeadlessPDFViewerImport } from "@cannyminds/pdf-viewer";
10
10
  import FirstPageIcon from "@mui/icons-material/FirstPage";
11
11
  import LastPageIcon from "@mui/icons-material/LastPage";
12
12
  import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
@@ -22,7 +22,7 @@ import InfoIcon from "@mui/icons-material/Info";
22
22
  import DescriptionIcon from "@mui/icons-material/Description";
23
23
 
24
24
  // src/components/viewers/pdf/SearchSidebar.tsx
25
- import { useState, useLayoutEffect, useRef } from "react";
25
+ import { useState, useLayoutEffect, useEffect, useRef } from "react";
26
26
  import {
27
27
  Box,
28
28
  Typography,
@@ -49,11 +49,17 @@ var SearchSidebar = ({
49
49
  totalResults,
50
50
  searchKeyword,
51
51
  searchResults = [],
52
- isSearching = false
52
+ isSearching = false,
53
+ isSyntheticResults = false
53
54
  }) => {
54
55
  const [searchTerm, setSearchTerm] = useState(searchKeyword || "");
55
56
  const [hasSearched, setHasSearched] = useState(false);
56
57
  const contentRef = useRef(null);
58
+ useEffect(() => {
59
+ if (searchKeyword && searchKeyword !== searchTerm) {
60
+ setSearchTerm(searchKeyword);
61
+ }
62
+ }, [searchKeyword]);
57
63
  useLayoutEffect(() => {
58
64
  const element = contentRef.current;
59
65
  if (!element) return;
@@ -89,20 +95,29 @@ var SearchSidebar = ({
89
95
  background-color: transparent;
90
96
  }
91
97
  .search-sidebar-content::-webkit-scrollbar-thumb {
92
- background-color: rgba(0, 0, 0, 0.25);
98
+ background-color: rgba(128, 128, 128, 0.3);
93
99
  border-radius: 8px;
94
100
  border: 4px solid transparent;
95
101
  background-clip: padding-box;
96
102
  transition: all 0.15s ease;
97
103
  }
98
104
  .search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
99
- background-color: rgba(0, 0, 0, 0.4);
105
+ background-color: rgba(128, 128, 128, 0.5);
100
106
  border: 2px solid transparent;
101
107
  }
102
108
  .search-sidebar-content::-webkit-scrollbar-thumb:active {
103
- background-color: rgba(25, 118, 210, 0.85);
109
+ background-color: rgba(25, 118, 210, 0.8);
104
110
  border: 1px solid transparent;
105
111
  }
112
+
113
+ @media (prefers-color-scheme: dark) {
114
+ .search-sidebar-content::-webkit-scrollbar-thumb {
115
+ background-color: rgba(255, 255, 255, 0.2);
116
+ }
117
+ .search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
118
+ background-color: rgba(255, 255, 255, 0.35);
119
+ }
120
+ }
106
121
 
107
122
  /* Tamil font support for search results */
108
123
  .search-result-text {
@@ -344,12 +359,13 @@ var SearchSidebar = ({
344
359
  width: 80,
345
360
  height: 80,
346
361
  borderRadius: "50%",
347
- backgroundColor: "#e3f2fd",
362
+ backgroundColor: "primary.light",
348
363
  display: "flex",
349
364
  alignItems: "center",
350
365
  justifyContent: "center",
351
366
  margin: "0 auto",
352
- mb: 3
367
+ mb: 3,
368
+ opacity: 0.2
353
369
  },
354
370
  children: /* @__PURE__ */ jsx(FindInPageIcon, { sx: { fontSize: 40, color: "primary.main" } })
355
371
  }
@@ -361,12 +377,13 @@ var SearchSidebar = ({
361
377
  {
362
378
  variant: "body2",
363
379
  sx: {
364
- color: "primary.main",
380
+ color: "white",
365
381
  fontWeight: 600,
366
- backgroundColor: "#e3f2fd",
382
+ backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(144, 202, 249, 0.16)" : "primary.light",
367
383
  padding: "6px 16px",
368
384
  borderRadius: "16px",
369
- display: "inline-block"
385
+ display: "inline-block",
386
+ opacity: 0.9
370
387
  },
371
388
  children: [
372
389
  '"',
@@ -384,14 +401,15 @@ var SearchSidebar = ({
384
401
  width: 80,
385
402
  height: 80,
386
403
  borderRadius: "50%",
387
- backgroundColor: "#fff3e0",
404
+ backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(255, 152, 0, 0.12)" : "warning.light",
388
405
  display: "flex",
389
406
  alignItems: "center",
390
407
  justifyContent: "center",
391
408
  margin: "0 auto",
392
- mb: 3
409
+ mb: 3,
410
+ opacity: 0.6
393
411
  },
394
- children: /* @__PURE__ */ jsx(SearchIcon, { sx: { fontSize: 40, color: "#ff9800" } })
412
+ children: /* @__PURE__ */ jsx(SearchIcon, { sx: { fontSize: 40, color: "warning.main" } })
395
413
  }
396
414
  ),
397
415
  /* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "No Results Found" }),
@@ -404,8 +422,9 @@ var SearchSidebar = ({
404
422
  ] })
405
423
  ] })
406
424
  ] }),
407
- totalResults > 0 && /* @__PURE__ */ jsx(Box, { sx: { p: 2 }, children: Object.entries(resultsByPage).sort(([a, _], [b, __]) => parseInt(a) - parseInt(b)).map(([pageNum, pageResults]) => {
425
+ totalResults > 0 && /* @__PURE__ */ jsx(Box, { sx: { p: 2 }, children: Object.keys(resultsByPage).sort((a, b) => parseInt(a) - parseInt(b)).map((pageNum) => {
408
426
  const pageNumber = parseInt(pageNum);
427
+ const pageResults = resultsByPage[pageNumber];
409
428
  return /* @__PURE__ */ jsxs(Box, { sx: { mb: 3 }, children: [
410
429
  /* @__PURE__ */ jsxs(
411
430
  Typography,
@@ -435,15 +454,15 @@ var SearchSidebar = ({
435
454
  mx: 1,
436
455
  mb: 1.5,
437
456
  borderRadius: "8px",
438
- border: "1px solid",
457
+ border: "2px solid",
439
458
  borderColor: result.index === currentResultIndex ? "primary.main" : "divider",
440
- backgroundColor: result.index === currentResultIndex ? "#e3f2fd" : "background.paper",
459
+ backgroundColor: "background.paper",
441
460
  cursor: "pointer",
442
461
  transition: "all 0.2s ease",
443
- boxShadow: result.index === currentResultIndex ? "0 2px 8px rgba(25, 118, 210, 0.15)" : "0 1px 3px rgba(0, 0, 0, 0.05)",
462
+ boxShadow: (theme) => theme.palette.mode === "dark" ? "0 1px 3px rgba(0, 0, 0, 0.3)" : "0 1px 3px rgba(0, 0, 0, 0.05)",
444
463
  "&:hover": {
445
464
  borderColor: "primary.main",
446
- boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
465
+ boxShadow: (theme) => theme.palette.mode === "dark" ? "0 2px 8px rgba(255, 255, 255, 0.15)" : "0 2px 8px rgba(0, 0, 0, 0.1)",
447
466
  transform: "translateY(-1px)"
448
467
  }
449
468
  },
@@ -471,8 +490,180 @@ var SearchSidebar = ({
471
490
  );
472
491
  };
473
492
 
493
+ // src/components/viewers/pdf/PasswordDialog.tsx
494
+ import { useState as useState2, useEffect as useEffect2 } from "react";
495
+ import {
496
+ Dialog,
497
+ DialogTitle,
498
+ DialogContent,
499
+ DialogActions,
500
+ TextField as TextField2,
501
+ Button,
502
+ Typography as Typography2,
503
+ IconButton as IconButton2,
504
+ InputAdornment as InputAdornment2,
505
+ Box as Box2,
506
+ Alert
507
+ } from "@mui/material";
508
+ import CloseIcon2 from "@mui/icons-material/Close";
509
+ import LockIcon from "@mui/icons-material/Lock";
510
+ import VisibilityIcon from "@mui/icons-material/Visibility";
511
+ import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
512
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
513
+ var PasswordDialog = ({
514
+ open,
515
+ fileName,
516
+ onSubmit,
517
+ onCancel,
518
+ error
519
+ }) => {
520
+ const [password, setPassword] = useState2("");
521
+ const [showPassword, setShowPassword] = useState2(false);
522
+ useEffect2(() => {
523
+ if (open) {
524
+ setPassword("");
525
+ setShowPassword(false);
526
+ }
527
+ }, [open]);
528
+ const handleSubmit = (e) => {
529
+ e.preventDefault();
530
+ if (password.trim()) {
531
+ onSubmit(password);
532
+ }
533
+ };
534
+ const handleTogglePasswordVisibility = () => {
535
+ setShowPassword(!showPassword);
536
+ };
537
+ const handleKeyPress = (e) => {
538
+ if (e.key === "Enter" && password.trim()) {
539
+ handleSubmit(e);
540
+ }
541
+ };
542
+ return /* @__PURE__ */ jsxs2(
543
+ Dialog,
544
+ {
545
+ open,
546
+ onClose: onCancel,
547
+ maxWidth: "sm",
548
+ fullWidth: true,
549
+ PaperProps: {
550
+ sx: {
551
+ borderRadius: 2
552
+ }
553
+ },
554
+ children: [
555
+ /* @__PURE__ */ jsx2(DialogTitle, { sx: { pb: 1 }, children: /* @__PURE__ */ jsxs2(Box2, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
556
+ /* @__PURE__ */ jsxs2(Box2, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
557
+ /* @__PURE__ */ jsx2(
558
+ Box2,
559
+ {
560
+ sx: {
561
+ width: 40,
562
+ height: 40,
563
+ borderRadius: "50%",
564
+ backgroundColor: "primary.light",
565
+ display: "flex",
566
+ alignItems: "center",
567
+ justifyContent: "center",
568
+ opacity: 0.9
569
+ },
570
+ children: /* @__PURE__ */ jsx2(LockIcon, { sx: { color: "white", fontSize: 20 } })
571
+ }
572
+ ),
573
+ /* @__PURE__ */ jsx2(Typography2, { variant: "h6", component: "div", sx: { fontWeight: 600 }, children: "Password Protected" })
574
+ ] }),
575
+ /* @__PURE__ */ jsx2(
576
+ IconButton2,
577
+ {
578
+ size: "small",
579
+ onClick: onCancel,
580
+ sx: { color: "text.secondary" },
581
+ "aria-label": "Close dialog",
582
+ children: /* @__PURE__ */ jsx2(CloseIcon2, { fontSize: "small" })
583
+ }
584
+ )
585
+ ] }) }),
586
+ /* @__PURE__ */ jsxs2(DialogContent, { sx: { pt: 2 }, children: [
587
+ /* @__PURE__ */ jsxs2(Typography2, { variant: "body2", sx: { color: "text.secondary", mb: 3 }, children: [
588
+ "This PDF is password protected. Please enter the password to view",
589
+ " ",
590
+ fileName && /* @__PURE__ */ jsxs2("strong", { children: [
591
+ '"',
592
+ fileName,
593
+ '"'
594
+ ] })
595
+ ] }),
596
+ error && /* @__PURE__ */ jsx2(Alert, { severity: "error", sx: { mb: 2 }, children: error }),
597
+ /* @__PURE__ */ jsx2("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsx2(
598
+ TextField2,
599
+ {
600
+ fullWidth: true,
601
+ autoFocus: true,
602
+ type: showPassword ? "text" : "password",
603
+ label: "Password",
604
+ placeholder: "Enter password",
605
+ value: password,
606
+ onChange: (e) => setPassword(e.target.value),
607
+ onKeyPress: handleKeyPress,
608
+ error: Boolean(error),
609
+ InputProps: {
610
+ endAdornment: /* @__PURE__ */ jsx2(InputAdornment2, { position: "end", children: /* @__PURE__ */ jsx2(
611
+ IconButton2,
612
+ {
613
+ onClick: handleTogglePasswordVisibility,
614
+ edge: "end",
615
+ size: "small",
616
+ "aria-label": showPassword ? "Hide password" : "Show password",
617
+ children: showPassword ? /* @__PURE__ */ jsx2(VisibilityOffIcon, {}) : /* @__PURE__ */ jsx2(VisibilityIcon, {})
618
+ }
619
+ ) })
620
+ },
621
+ sx: {
622
+ "& .MuiOutlinedInput-root": {
623
+ borderRadius: 2
624
+ }
625
+ }
626
+ }
627
+ ) })
628
+ ] }),
629
+ /* @__PURE__ */ jsxs2(DialogActions, { sx: { px: 3, pb: 3, pt: 2 }, children: [
630
+ /* @__PURE__ */ jsx2(
631
+ Button,
632
+ {
633
+ onClick: onCancel,
634
+ variant: "outlined",
635
+ sx: {
636
+ borderRadius: 2,
637
+ textTransform: "none",
638
+ px: 3
639
+ },
640
+ children: "Cancel"
641
+ }
642
+ ),
643
+ /* @__PURE__ */ jsx2(
644
+ Button,
645
+ {
646
+ onClick: handleSubmit,
647
+ variant: "contained",
648
+ disabled: !password.trim(),
649
+ sx: {
650
+ borderRadius: 2,
651
+ textTransform: "none",
652
+ px: 3,
653
+ boxShadow: 2
654
+ },
655
+ children: "Unlock PDF"
656
+ }
657
+ )
658
+ ] })
659
+ ]
660
+ }
661
+ );
662
+ };
663
+
474
664
  // src/components/viewers/PDFViewer.tsx
475
- import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
665
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
666
+ var HeadlessPDFViewer = HeadlessPDFViewerImport;
476
667
  var toolbarStyles = `
477
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');
478
669
 
@@ -502,7 +693,7 @@ var toolbarStyles = `
502
693
  .pdf-viewer-header {
503
694
  display: flex;
504
695
  align-items: center;
505
- justify-content: center;
696
+ justify-content: flex-start;
506
697
  gap: 8px;
507
698
  padding: 3px 16px 0 16px;
508
699
  background: #fff;
@@ -641,11 +832,13 @@ var PDFViewerContent = forwardRef((props, ref) => {
641
832
  onMetadataClick,
642
833
  onPropertiesClick,
643
834
  onDownloadClick,
644
- onPrintClick
835
+ onPrintClick,
836
+ initialSearchText,
837
+ initialSearchPages
645
838
  } = props;
646
- const [pdfBuffer, setPdfBuffer] = useState2(null);
647
- const [state, setState] = useState2("idle");
648
- const [error, setError] = useState2(null);
839
+ const [pdfBuffer, setPdfBuffer] = useState3(null);
840
+ const [state, setState] = useState3("idle");
841
+ const [error, setError] = useState3(null);
649
842
  const pdfViewerRef = useRef2(null);
650
843
  const resolvedFileName = useMemo(() => {
651
844
  if (fileName) return fileName;
@@ -660,17 +853,21 @@ var PDFViewerContent = forwardRef((props, ref) => {
660
853
  () => getFileExtension(resolvedFileName),
661
854
  [resolvedFileName]
662
855
  );
663
- const [currentPage, setCurrentPage] = useState2(1);
664
- const [totalPages, setTotalPages] = useState2(0);
665
- const [zoom, setZoom] = useState2(100);
666
- const [searchQuery, setSearchQuery] = useState2("");
667
- const [isSearching, setIsSearching] = useState2(false);
668
- const [pdfContainer, setPdfContainer] = useState2(null);
669
- const [isSidebarOpen, setIsSidebarOpen] = useState2(false);
670
- const [searchResults, setSearchResults] = useState2([]);
671
- const [currentSearchResultIndex, setCurrentSearchResultIndex] = useState2(0);
672
- const [totalSearchResults, setTotalSearchResults] = useState2(0);
673
- useEffect(() => {
856
+ const [currentPage, setCurrentPage] = useState3(1);
857
+ const [totalPages, setTotalPages] = useState3(0);
858
+ const [zoom, setZoom] = useState3(100);
859
+ const [searchQuery, setSearchQuery] = useState3("");
860
+ const [isSearching, setIsSearching] = useState3(false);
861
+ const [pdfContainer, setPdfContainer] = useState3(null);
862
+ const [isSidebarOpen, setIsSidebarOpen] = useState3(false);
863
+ const [searchResults, setSearchResults] = useState3([]);
864
+ const [currentSearchResultIndex, setCurrentSearchResultIndex] = useState3(0);
865
+ const [totalSearchResults, setTotalSearchResults] = useState3(0);
866
+ const [autoExecuteSearch, setAutoExecuteSearch] = useState3(!!initialSearchText);
867
+ const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState3(false);
868
+ const [passwordError, setPasswordError] = useState3("");
869
+ const [passwordResolve, setPasswordResolve] = useState3(null);
870
+ useEffect3(() => {
674
871
  setSearchQuery("");
675
872
  setSearchResults([]);
676
873
  setCurrentSearchResultIndex(0);
@@ -684,74 +881,97 @@ var PDFViewerContent = forwardRef((props, ref) => {
684
881
  setError(null);
685
882
  setPdfBuffer(null);
686
883
  }, [file]);
687
- useEffect(() => {
688
- if (state === "ready") {
689
- setTimeout(() => {
690
- const container = document.querySelector('[data-pdf-viewer], .embedpdf-viewport, [role="document"]');
691
- if (container) {
692
- setPdfContainer(container);
693
- }
694
- }, 500);
884
+ useEffect3(() => {
885
+ if (state !== "ready") return;
886
+ const container = document.querySelector('[data-pdf-viewer], .embedpdf-viewport, [role="document"]');
887
+ if (container) {
888
+ setPdfContainer(container);
889
+ return;
695
890
  }
891
+ const observer = new MutationObserver(() => {
892
+ const foundContainer = document.querySelector('[data-pdf-viewer], .embedpdf-viewport, [role="document"]');
893
+ if (foundContainer) {
894
+ setPdfContainer(foundContainer);
895
+ observer.disconnect();
896
+ }
897
+ });
898
+ observer.observe(document.body, { childList: true, subtree: true });
899
+ return () => observer.disconnect();
696
900
  }, [state]);
697
- useEffect(() => {
698
- if (state === "ready" && totalPages === 0) {
699
- const initializePageCount = async () => {
700
- let viewer = pdfViewerRef.current;
701
- let retries = 0;
702
- while (!viewer && retries < 10) {
703
- await new Promise((resolve) => setTimeout(resolve, 500));
704
- viewer = pdfViewerRef.current;
705
- retries++;
901
+ useEffect3(() => {
902
+ if (state !== "ready" || totalPages > 0) return;
903
+ const initializePageCount = async () => {
904
+ const waitForViewer = async (maxAttempts = 10) => {
905
+ for (let i = 0; i < maxAttempts; i++) {
906
+ if (pdfViewerRef.current) return pdfViewerRef.current;
907
+ await new Promise((resolve) => requestAnimationFrame(
908
+ () => setTimeout(resolve, Math.min(100 * Math.pow(2, i), 1e3))
909
+ ));
706
910
  }
707
- if (!viewer) return;
708
- await new Promise((resolve) => setTimeout(resolve, 1500));
709
- try {
710
- let count = viewer.navigation?.getTotalPages?.();
711
- if (count && count > 1) {
712
- setTotalPages(count);
713
- return;
714
- }
715
- } catch (e) {
911
+ return null;
912
+ };
913
+ const viewer = await waitForViewer();
914
+ if (!viewer) return;
915
+ await new Promise((resolve) => requestAnimationFrame(resolve));
916
+ try {
917
+ const count = viewer.navigation?.getTotalPages?.();
918
+ if (count && count > 1) {
919
+ setTotalPages(count);
920
+ return;
716
921
  }
717
- try {
718
- const results = await viewer.search?.searchText?.("e");
719
- if (results?.results && results.results.length > 0) {
720
- const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
721
- const count = Math.max(...pageIndices) + 1;
722
- viewer.search?.stopSearch?.();
723
- setTotalPages(count);
724
- return;
725
- }
726
- } catch (error2) {
922
+ } catch (e) {
923
+ }
924
+ try {
925
+ const results = await viewer.search?.searchText?.("e");
926
+ if (results?.results && results.results.length > 0) {
927
+ const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
928
+ const count = Math.max(...pageIndices) + 1;
929
+ viewer.search?.stopSearch?.();
930
+ setTotalPages(count);
931
+ return;
727
932
  }
728
- try {
729
- await new Promise((resolve) => setTimeout(resolve, 1e3));
730
- const selectors = [
731
- "[data-page-index]",
732
- "[data-page-number]",
733
- ".embedpdf-page",
734
- '[role="article"]',
735
- "canvas[data-page]",
736
- ".react-pdf__Page"
737
- ];
738
- let pages = null;
739
- for (const selector of selectors) {
740
- pages = document.querySelectorAll(selector);
741
- if (pages.length > 0) break;
742
- }
743
- if (pages && pages.length > 0) {
933
+ } catch (error2) {
934
+ }
935
+ try {
936
+ const selectors = [
937
+ "[data-page-index]",
938
+ "[data-page-number]",
939
+ ".embedpdf-page",
940
+ '[role="article"]',
941
+ "canvas[data-page]",
942
+ ".react-pdf__Page"
943
+ ];
944
+ for (const selector of selectors) {
945
+ const pages = document.querySelectorAll(selector);
946
+ if (pages.length > 0) {
744
947
  setTotalPages(pages.length);
745
948
  return;
746
949
  }
747
- } catch (error2) {
748
950
  }
749
- setTotalPages(1);
750
- };
751
- initializePageCount();
752
- }
951
+ } catch (error2) {
952
+ }
953
+ setTotalPages(1);
954
+ };
955
+ initializePageCount();
753
956
  }, [state, totalPages]);
754
- useEffect(() => {
957
+ useEffect3(() => {
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
+ useEffect3(() => {
755
975
  if (state === "ready" && pdfViewerRef.current) {
756
976
  const updateInfo = () => {
757
977
  const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
@@ -839,18 +1059,18 @@ var PDFViewerContent = forwardRef((props, ref) => {
839
1059
  clearSelection: () => pdfViewerRef.current?.selection.clearSelection()
840
1060
  }), []);
841
1061
  const updatePageDisplay = () => {
842
- setTimeout(() => {
1062
+ requestAnimationFrame(() => {
843
1063
  const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
844
1064
  setCurrentPage(current);
845
- }, 100);
1065
+ });
846
1066
  };
847
1067
  const updateZoomDisplay = () => {
848
- setTimeout(() => {
1068
+ requestAnimationFrame(() => {
849
1069
  const zoomValue = pdfViewerRef.current?.zoom.getZoom();
850
1070
  if (typeof zoomValue === "number") {
851
1071
  setZoom(Math.round(zoomValue * 100));
852
1072
  }
853
- }, 100);
1073
+ });
854
1074
  };
855
1075
  const handleZoomIn = () => {
856
1076
  pdfViewerRef.current?.zoom.zoomIn();
@@ -952,13 +1172,13 @@ var PDFViewerContent = forwardRef((props, ref) => {
952
1172
  handleSearch();
953
1173
  }
954
1174
  };
955
- const handleSidebarSearch = async (keyword) => {
1175
+ const handleSidebarSearch = async (keyword, pageNumbers) => {
956
1176
  setSearchQuery(keyword);
957
1177
  if (keyword.trim()) {
958
1178
  setIsSearching(true);
959
1179
  const results = await pdfViewerRef.current?.search.searchText(keyword);
960
1180
  setIsSearching(false);
961
- if (results && results.results) {
1181
+ if (results && results.results && results.results.length > 0) {
962
1182
  const formattedResults = results.results.map((result, index) => {
963
1183
  let textContent = "";
964
1184
  let contextContent = "";
@@ -990,6 +1210,18 @@ var PDFViewerContent = forwardRef((props, ref) => {
990
1210
  pdfViewerRef.current?.navigation.goToPage(firstPageNumber);
991
1211
  setCurrentPage(firstPageNumber);
992
1212
  }
1213
+ } else if (pageNumbers && pageNumbers.length > 0) {
1214
+ const fallbackResults = pageNumbers.map((pageNum, index) => ({
1215
+ pageNumber: pageNum,
1216
+ text: keyword,
1217
+ context: `"${keyword}" found on this page ${pageNum}`,
1218
+ index
1219
+ }));
1220
+ setSearchResults(fallbackResults);
1221
+ setTotalSearchResults(fallbackResults.length);
1222
+ setCurrentSearchResultIndex(0);
1223
+ pdfViewerRef.current?.navigation.goToPage(pageNumbers[0]);
1224
+ setCurrentPage(pageNumbers[0]);
993
1225
  } else {
994
1226
  setSearchResults([]);
995
1227
  setTotalSearchResults(0);
@@ -1035,22 +1267,6 @@ var PDFViewerContent = forwardRef((props, ref) => {
1035
1267
  }
1036
1268
  }
1037
1269
  };
1038
- const handleDownload = () => {
1039
- if (onDownloadClick) {
1040
- onDownloadClick();
1041
- return;
1042
- }
1043
- if (!pdfBuffer) return;
1044
- const blob = new Blob([pdfBuffer], { type: "application/pdf" });
1045
- const url = URL.createObjectURL(blob);
1046
- const link = document.createElement("a");
1047
- link.href = url;
1048
- link.download = resolvedFileName;
1049
- document.body.appendChild(link);
1050
- link.click();
1051
- document.body.removeChild(link);
1052
- URL.revokeObjectURL(url);
1053
- };
1054
1270
  const handlePrint = () => {
1055
1271
  if (onPrintClick) {
1056
1272
  onPrintClick();
@@ -1069,28 +1285,42 @@ var PDFViewerContent = forwardRef((props, ref) => {
1069
1285
  document.body.appendChild(iframe);
1070
1286
  iframe.onload = () => {
1071
1287
  try {
1072
- setTimeout(() => {
1288
+ requestAnimationFrame(() => {
1073
1289
  const iframeWindow = iframe.contentWindow;
1074
1290
  if (!iframeWindow) return;
1075
1291
  iframeWindow.focus();
1076
1292
  iframeWindow.print();
1077
- const checkPrintComplete = () => {
1078
- setTimeout(() => {
1293
+ const cleanup = () => {
1294
+ requestAnimationFrame(() => {
1079
1295
  try {
1080
- document.body.removeChild(iframe);
1296
+ if (document.body.contains(iframe)) {
1297
+ document.body.removeChild(iframe);
1298
+ }
1081
1299
  URL.revokeObjectURL(blobUrl);
1082
1300
  } catch (e) {
1083
1301
  }
1084
- }, 500);
1302
+ });
1085
1303
  };
1086
1304
  if ("onafterprint" in iframeWindow) {
1087
- iframeWindow.onafterprint = checkPrintComplete;
1305
+ iframeWindow.onafterprint = cleanup;
1088
1306
  } else {
1089
- setTimeout(checkPrintComplete, 3e3);
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);
1090
1318
  }
1091
- }, 500);
1319
+ });
1092
1320
  } catch (error2) {
1093
- document.body.removeChild(iframe);
1321
+ if (document.body.contains(iframe)) {
1322
+ document.body.removeChild(iframe);
1323
+ }
1094
1324
  URL.revokeObjectURL(blobUrl);
1095
1325
  }
1096
1326
  };
@@ -1100,7 +1330,7 @@ var PDFViewerContent = forwardRef((props, ref) => {
1100
1330
  };
1101
1331
  iframe.src = blobUrl;
1102
1332
  };
1103
- useEffect(() => {
1333
+ useEffect3(() => {
1104
1334
  if (!file) {
1105
1335
  setState("error");
1106
1336
  setError("No file provided");
@@ -1137,12 +1367,30 @@ var PDFViewerContent = forwardRef((props, ref) => {
1137
1367
  loadPDF();
1138
1368
  }, [file, onLoad, onError]);
1139
1369
  const handlePasswordRequest = useCallback(async (fileName2) => {
1140
- const password = prompt(`This PDF is password protected.
1141
- Enter password for ${fileName2 || "document"}:`);
1142
- return password;
1370
+ return new Promise((resolve) => {
1371
+ setPasswordResolve(() => resolve);
1372
+ setPasswordError("");
1373
+ setIsPasswordDialogOpen(true);
1374
+ });
1143
1375
  }, []);
1376
+ const handlePasswordSubmit = useCallback((password) => {
1377
+ if (passwordResolve) {
1378
+ passwordResolve(password);
1379
+ setPasswordResolve(null);
1380
+ setIsPasswordDialogOpen(false);
1381
+ setPasswordError("");
1382
+ }
1383
+ }, [passwordResolve]);
1384
+ const handlePasswordCancel = useCallback(() => {
1385
+ if (passwordResolve) {
1386
+ passwordResolve(null);
1387
+ setPasswordResolve(null);
1388
+ setIsPasswordDialogOpen(false);
1389
+ setPasswordError("");
1390
+ }
1391
+ }, [passwordResolve]);
1144
1392
  if (state === "loading") {
1145
- return /* @__PURE__ */ jsxs2("div", { style: {
1393
+ return /* @__PURE__ */ jsxs3("div", { style: {
1146
1394
  display: "flex",
1147
1395
  flexDirection: "column",
1148
1396
  alignItems: "center",
@@ -1150,7 +1398,7 @@ Enter password for ${fileName2 || "document"}:`);
1150
1398
  height: "100%",
1151
1399
  gap: "16px"
1152
1400
  }, children: [
1153
- /* @__PURE__ */ jsx2("div", { className: "spinner", style: {
1401
+ /* @__PURE__ */ jsx3("div", { className: "spinner", style: {
1154
1402
  width: "48px",
1155
1403
  height: "48px",
1156
1404
  border: "4px solid #f3f3f3",
@@ -1158,8 +1406,8 @@ Enter password for ${fileName2 || "document"}:`);
1158
1406
  borderRadius: "50%",
1159
1407
  animation: "spin 1s linear infinite"
1160
1408
  } }),
1161
- /* @__PURE__ */ jsx2("p", { children: "Loading PDF..." }),
1162
- /* @__PURE__ */ jsx2("style", { children: `
1409
+ /* @__PURE__ */ jsx3("p", { children: "Loading PDF..." }),
1410
+ /* @__PURE__ */ jsx3("style", { children: `
1163
1411
  @keyframes spin {
1164
1412
  0% { transform: rotate(0deg); }
1165
1413
  100% { transform: rotate(360deg); }
@@ -1168,63 +1416,63 @@ Enter password for ${fileName2 || "document"}:`);
1168
1416
  ] });
1169
1417
  }
1170
1418
  if (state === "error" || error) {
1171
- return /* @__PURE__ */ jsx2("div", { style: {
1419
+ return /* @__PURE__ */ jsx3("div", { style: {
1172
1420
  display: "flex",
1173
1421
  flexDirection: "column",
1174
1422
  alignItems: "center",
1175
1423
  justifyContent: "center",
1176
1424
  height: "100%",
1177
1425
  padding: "24px"
1178
- }, children: /* @__PURE__ */ jsxs2("div", { style: {
1426
+ }, children: /* @__PURE__ */ jsxs3("div", { style: {
1179
1427
  maxWidth: "400px",
1180
1428
  padding: "16px",
1181
1429
  backgroundColor: "#fee",
1182
1430
  border: "1px solid #fcc",
1183
1431
  borderRadius: "4px"
1184
1432
  }, children: [
1185
- /* @__PURE__ */ jsx2("h3", { style: { marginTop: 0 }, children: "Failed to Load PDF" }),
1186
- /* @__PURE__ */ jsx2("p", { children: error || "Unknown error occurred" })
1433
+ /* @__PURE__ */ jsx3("h3", { style: { marginTop: 0 }, children: "Failed to Load PDF" }),
1434
+ /* @__PURE__ */ jsx3("p", { children: error || "Unknown error occurred" })
1187
1435
  ] }) });
1188
1436
  }
1189
1437
  if (!pdfBuffer || state !== "ready") {
1190
- return /* @__PURE__ */ jsx2("div", { style: {
1438
+ return /* @__PURE__ */ jsx3("div", { style: {
1191
1439
  display: "flex",
1192
1440
  alignItems: "center",
1193
1441
  justifyContent: "center",
1194
1442
  height: "100%"
1195
- }, children: /* @__PURE__ */ jsx2("p", { children: "Preparing PDF..." }) });
1443
+ }, children: /* @__PURE__ */ jsx3("p", { children: "Preparing PDF..." }) });
1196
1444
  }
1197
- return /* @__PURE__ */ jsxs2("div", { className: "pdf-viewer-container", children: [
1198
- /* @__PURE__ */ jsx2("style", { children: toolbarStyles }),
1199
- /* @__PURE__ */ jsxs2("div", { className: "pdf-viewer-header", children: [
1200
- /* @__PURE__ */ jsx2(FileIcon_default, { ext: fileExtension, size: 26 }),
1201
- /* @__PURE__ */ jsx2("div", { className: "header-file-name", title: resolvedFileName, children: resolvedFileName })
1445
+ return /* @__PURE__ */ jsxs3("div", { className: "pdf-viewer-container", children: [
1446
+ /* @__PURE__ */ jsx3("style", { children: toolbarStyles }),
1447
+ /* @__PURE__ */ jsxs3("div", { className: "pdf-viewer-header", children: [
1448
+ /* @__PURE__ */ jsx3(FileIcon_default, { ext: fileExtension, size: 26 }),
1449
+ /* @__PURE__ */ jsx3("div", { className: "header-file-name", title: resolvedFileName, children: resolvedFileName })
1202
1450
  ] }),
1203
- /* @__PURE__ */ jsxs2("div", { className: "pdf-viewer-toolbar", children: [
1204
- showPageNavigation && /* @__PURE__ */ jsxs2(Fragment, { children: [
1205
- /* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
1206
- /* @__PURE__ */ jsxs2("div", { className: "toolbar-section", children: [
1207
- /* @__PURE__ */ jsx2(
1451
+ /* @__PURE__ */ jsxs3("div", { className: "pdf-viewer-toolbar", children: [
1452
+ showPageNavigation && /* @__PURE__ */ jsxs3(Fragment, { children: [
1453
+ /* @__PURE__ */ jsx3("div", { className: "toolbar-separator" }),
1454
+ /* @__PURE__ */ jsxs3("div", { className: "toolbar-section", children: [
1455
+ /* @__PURE__ */ jsx3(
1208
1456
  "button",
1209
1457
  {
1210
1458
  className: "toolbar-button",
1211
1459
  onClick: handleFirstPage,
1212
1460
  disabled: currentPage <= 1,
1213
1461
  title: "First Page",
1214
- children: /* @__PURE__ */ jsx2(FirstPageIcon, { fontSize: "small" })
1462
+ children: /* @__PURE__ */ jsx3(FirstPageIcon, { fontSize: "small" })
1215
1463
  }
1216
1464
  ),
1217
- /* @__PURE__ */ jsx2(
1465
+ /* @__PURE__ */ jsx3(
1218
1466
  "button",
1219
1467
  {
1220
1468
  className: "toolbar-button",
1221
1469
  onClick: handlePreviousPage,
1222
1470
  disabled: currentPage <= 1,
1223
1471
  title: "Previous Page",
1224
- children: /* @__PURE__ */ jsx2(ChevronLeftIcon, { fontSize: "small" })
1472
+ children: /* @__PURE__ */ jsx3(ChevronLeftIcon, { fontSize: "small" })
1225
1473
  }
1226
1474
  ),
1227
- /* @__PURE__ */ jsx2(
1475
+ /* @__PURE__ */ jsx3(
1228
1476
  "input",
1229
1477
  {
1230
1478
  type: "number",
@@ -1236,80 +1484,80 @@ Enter password for ${fileName2 || "document"}:`);
1236
1484
  max: totalPages || void 0
1237
1485
  }
1238
1486
  ),
1239
- showPageCount && /* @__PURE__ */ jsxs2("span", { className: "page-info", children: [
1487
+ showPageCount && /* @__PURE__ */ jsxs3("span", { className: "page-info", children: [
1240
1488
  "of ",
1241
1489
  totalPages || "..."
1242
1490
  ] }),
1243
- /* @__PURE__ */ jsx2(
1491
+ /* @__PURE__ */ jsx3(
1244
1492
  "button",
1245
1493
  {
1246
1494
  className: "toolbar-button",
1247
1495
  onClick: handleNextPage,
1248
1496
  disabled: currentPage >= totalPages,
1249
1497
  title: "Next Page",
1250
- children: /* @__PURE__ */ jsx2(ChevronRightIcon, { fontSize: "small" })
1498
+ children: /* @__PURE__ */ jsx3(ChevronRightIcon, { fontSize: "small" })
1251
1499
  }
1252
1500
  ),
1253
- /* @__PURE__ */ jsx2(
1501
+ /* @__PURE__ */ jsx3(
1254
1502
  "button",
1255
1503
  {
1256
1504
  className: "toolbar-button",
1257
1505
  onClick: handleLastPage,
1258
1506
  disabled: currentPage >= totalPages,
1259
1507
  title: "Last Page",
1260
- children: /* @__PURE__ */ jsx2(LastPageIcon, { fontSize: "small" })
1508
+ children: /* @__PURE__ */ jsx3(LastPageIcon, { fontSize: "small" })
1261
1509
  }
1262
1510
  )
1263
1511
  ] })
1264
1512
  ] }),
1265
- showZoomControls && /* @__PURE__ */ jsxs2(Fragment, { children: [
1266
- /* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
1267
- /* @__PURE__ */ jsxs2("div", { className: "toolbar-section", children: [
1268
- /* @__PURE__ */ jsx2(
1513
+ showZoomControls && /* @__PURE__ */ jsxs3(Fragment, { children: [
1514
+ /* @__PURE__ */ jsx3("div", { className: "toolbar-separator" }),
1515
+ /* @__PURE__ */ jsxs3("div", { className: "toolbar-section", children: [
1516
+ /* @__PURE__ */ jsx3(
1269
1517
  "button",
1270
1518
  {
1271
1519
  className: "toolbar-button",
1272
1520
  onClick: handleZoomOut,
1273
1521
  title: "Zoom Out",
1274
- children: /* @__PURE__ */ jsx2(ZoomOutIcon, { fontSize: "small" })
1522
+ children: /* @__PURE__ */ jsx3(ZoomOutIcon, { fontSize: "small" })
1275
1523
  }
1276
1524
  ),
1277
- /* @__PURE__ */ jsxs2("span", { className: "zoom-display", children: [
1525
+ /* @__PURE__ */ jsxs3("span", { className: "zoom-display", children: [
1278
1526
  zoom,
1279
1527
  "%"
1280
1528
  ] }),
1281
- /* @__PURE__ */ jsx2(
1529
+ /* @__PURE__ */ jsx3(
1282
1530
  "button",
1283
1531
  {
1284
1532
  className: "toolbar-button",
1285
1533
  onClick: handleZoomIn,
1286
1534
  title: "Zoom In",
1287
- children: /* @__PURE__ */ jsx2(ZoomInIcon, { fontSize: "small" })
1535
+ children: /* @__PURE__ */ jsx3(ZoomInIcon, { fontSize: "small" })
1288
1536
  }
1289
1537
  ),
1290
- /* @__PURE__ */ jsx2(
1538
+ /* @__PURE__ */ jsx3(
1291
1539
  "button",
1292
1540
  {
1293
1541
  className: "toolbar-button",
1294
1542
  onClick: handleFitToWidth,
1295
1543
  title: "Fit to Width",
1296
- children: /* @__PURE__ */ jsx2(AspectRatioIcon, { fontSize: "small" })
1544
+ children: /* @__PURE__ */ jsx3(AspectRatioIcon, { fontSize: "small" })
1297
1545
  }
1298
1546
  ),
1299
- /* @__PURE__ */ jsx2(
1547
+ /* @__PURE__ */ jsx3(
1300
1548
  "button",
1301
1549
  {
1302
1550
  className: "toolbar-button",
1303
1551
  onClick: handleFitToPage,
1304
1552
  title: "Fit to Page",
1305
- children: /* @__PURE__ */ jsx2(FitScreenIcon, { fontSize: "small" })
1553
+ children: /* @__PURE__ */ jsx3(FitScreenIcon, { fontSize: "small" })
1306
1554
  }
1307
1555
  )
1308
1556
  ] })
1309
1557
  ] }),
1310
- showSearch && /* @__PURE__ */ jsxs2(Fragment, { children: [
1311
- /* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
1312
- /* @__PURE__ */ jsx2("div", { className: "toolbar-section", children: /* @__PURE__ */ jsx2(
1558
+ showSearch && /* @__PURE__ */ jsxs3(Fragment, { children: [
1559
+ /* @__PURE__ */ jsx3("div", { className: "toolbar-separator" }),
1560
+ /* @__PURE__ */ jsx3("div", { className: "toolbar-section", children: /* @__PURE__ */ jsx3(
1313
1561
  "button",
1314
1562
  {
1315
1563
  className: "toolbar-button",
@@ -1319,59 +1567,62 @@ Enter password for ${fileName2 || "document"}:`);
1319
1567
  backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
1320
1568
  color: isSidebarOpen ? "#1976d2" : "inherit"
1321
1569
  },
1322
- children: /* @__PURE__ */ jsx2(SearchIcon2, { fontSize: "small" })
1570
+ children: /* @__PURE__ */ jsx3(SearchIcon2, { fontSize: "small" })
1323
1571
  }
1324
1572
  ) })
1325
1573
  ] }),
1326
- (showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ jsxs2(Fragment, { children: [
1327
- /* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
1328
- /* @__PURE__ */ jsxs2("div", { className: "toolbar-section", children: [
1329
- showDownload && /* @__PURE__ */ jsx2(
1574
+ (showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ jsxs3(Fragment, { children: [
1575
+ /* @__PURE__ */ jsx3("div", { className: "toolbar-separator" }),
1576
+ /* @__PURE__ */ jsxs3("div", { className: "toolbar-section", children: [
1577
+ showDownload && /* @__PURE__ */ jsx3(
1330
1578
  "button",
1331
1579
  {
1332
1580
  className: "toolbar-button",
1333
1581
  onClick: onDownloadClick,
1334
1582
  title: "Download PDF",
1335
- children: /* @__PURE__ */ jsx2(DownloadIcon, { fontSize: "small" })
1583
+ children: /* @__PURE__ */ jsx3(DownloadIcon, { fontSize: "small" })
1336
1584
  }
1337
1585
  ),
1338
- showPrint && /* @__PURE__ */ jsx2(
1586
+ showPrint && /* @__PURE__ */ jsx3(
1339
1587
  "button",
1340
1588
  {
1341
1589
  className: "toolbar-button",
1342
1590
  onClick: onPrintClick,
1343
1591
  title: "Print PDF",
1344
- children: /* @__PURE__ */ jsx2(PrintIcon, { fontSize: "small" })
1592
+ children: /* @__PURE__ */ jsx3(PrintIcon, { fontSize: "small" })
1345
1593
  }
1346
1594
  ),
1347
- showMetadata && /* @__PURE__ */ jsx2(
1595
+ showMetadata && /* @__PURE__ */ jsx3(
1348
1596
  "button",
1349
1597
  {
1350
1598
  className: "toolbar-button",
1351
1599
  onClick: onMetadataClick,
1352
1600
  title: "Document Metadata",
1353
- children: /* @__PURE__ */ jsx2(InfoIcon, { fontSize: "small" })
1601
+ children: /* @__PURE__ */ jsx3(InfoIcon, { fontSize: "small" })
1354
1602
  }
1355
1603
  ),
1356
- showProperties && /* @__PURE__ */ jsx2(
1604
+ showProperties && /* @__PURE__ */ jsx3(
1357
1605
  "button",
1358
1606
  {
1359
1607
  className: "toolbar-button",
1360
1608
  onClick: onPropertiesClick,
1361
1609
  title: "Document Properties",
1362
- children: /* @__PURE__ */ jsx2(DescriptionIcon, { fontSize: "small" })
1610
+ children: /* @__PURE__ */ jsx3(DescriptionIcon, { fontSize: "small" })
1363
1611
  }
1364
1612
  )
1365
1613
  ] })
1366
1614
  ] })
1367
1615
  ] }),
1368
- /* @__PURE__ */ jsxs2("div", { className: "pdf-viewer-main", children: [
1369
- /* @__PURE__ */ jsx2("div", { className: "pdf-viewer-viewer-area", children: React2.createElement(HeadlessPDFViewer, {
1370
- ref: pdfViewerRef,
1371
- pdfBuffer,
1372
- onPasswordRequest: handlePasswordRequest
1373
- }) }),
1374
- /* @__PURE__ */ jsx2(
1616
+ /* @__PURE__ */ jsxs3("div", { className: "pdf-viewer-main", children: [
1617
+ /* @__PURE__ */ jsx3("div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ jsx3(
1618
+ HeadlessPDFViewer,
1619
+ {
1620
+ ref: pdfViewerRef,
1621
+ pdfBuffer,
1622
+ onPasswordRequest: handlePasswordRequest
1623
+ }
1624
+ ) }),
1625
+ /* @__PURE__ */ jsx3(
1375
1626
  SearchSidebar,
1376
1627
  {
1377
1628
  isOpen: isSidebarOpen,
@@ -1387,16 +1638,26 @@ Enter password for ${fileName2 || "document"}:`);
1387
1638
  isSearching
1388
1639
  }
1389
1640
  )
1390
- ] })
1641
+ ] }),
1642
+ /* @__PURE__ */ jsx3(
1643
+ PasswordDialog,
1644
+ {
1645
+ open: isPasswordDialogOpen,
1646
+ fileName: resolvedFileName,
1647
+ onSubmit: handlePasswordSubmit,
1648
+ onCancel: handlePasswordCancel,
1649
+ error: passwordError
1650
+ }
1651
+ )
1391
1652
  ] });
1392
1653
  });
1393
1654
  PDFViewerContent.displayName = "PDFViewerContent";
1394
1655
  var PDFViewer = forwardRef((props, ref) => {
1395
- return /* @__PURE__ */ jsx2(PDFViewerContent, { ...props, sourceDescription: "doc.pdf", ref });
1656
+ return /* @__PURE__ */ jsx3(PDFViewerContent, { ...props, sourceDescription: "doc.pdf", ref });
1396
1657
  });
1397
1658
  PDFViewer.displayName = "PDFViewer";
1398
1659
 
1399
1660
  export {
1400
1661
  PDFViewer
1401
1662
  };
1402
- //# sourceMappingURL=chunk-73ZIFR3P.mjs.map
1663
+ //# sourceMappingURL=chunk-J2YW5DHC.mjs.map