pdfjs-reader-core 0.2.17 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1760,6 +1760,85 @@ var init_coordinates = __esm({
1760
1760
  }
1761
1761
  });
1762
1762
 
1763
+ // src/utils/page-turn-sound.ts
1764
+ function getAudioContext() {
1765
+ if (typeof window === "undefined") return null;
1766
+ if (!audioContext) {
1767
+ try {
1768
+ audioContext = new (window.AudioContext || window.webkitAudioContext)();
1769
+ } catch {
1770
+ return null;
1771
+ }
1772
+ }
1773
+ return audioContext;
1774
+ }
1775
+ function playPageTurnSound(volume = 0.3) {
1776
+ const ctx = getAudioContext();
1777
+ if (!ctx) return;
1778
+ if (ctx.state === "suspended") {
1779
+ ctx.resume();
1780
+ }
1781
+ const now = ctx.currentTime;
1782
+ const duration = 0.35;
1783
+ const bufferSize = Math.floor(ctx.sampleRate * duration);
1784
+ const noiseBuffer = ctx.createBuffer(1, bufferSize, ctx.sampleRate);
1785
+ const data = noiseBuffer.getChannelData(0);
1786
+ for (let i = 0; i < bufferSize; i++) {
1787
+ data[i] = Math.random() * 2 - 1;
1788
+ }
1789
+ const noiseSource = ctx.createBufferSource();
1790
+ noiseSource.buffer = noiseBuffer;
1791
+ const bandpass = ctx.createBiquadFilter();
1792
+ bandpass.type = "bandpass";
1793
+ bandpass.frequency.setValueAtTime(3e3, now);
1794
+ bandpass.frequency.exponentialRampToValueAtTime(800, now + duration * 0.6);
1795
+ bandpass.Q.setValueAtTime(0.8, now);
1796
+ const highpass = ctx.createBiquadFilter();
1797
+ highpass.type = "highpass";
1798
+ highpass.frequency.setValueAtTime(400, now);
1799
+ highpass.frequency.linearRampToValueAtTime(200, now + duration);
1800
+ const envelope = ctx.createGain();
1801
+ envelope.gain.setValueAtTime(0, now);
1802
+ envelope.gain.linearRampToValueAtTime(volume * 0.6, now + 0.02);
1803
+ envelope.gain.setValueAtTime(volume * 0.6, now + 0.05);
1804
+ envelope.gain.linearRampToValueAtTime(volume, now + duration * 0.3);
1805
+ envelope.gain.exponentialRampToValueAtTime(1e-3, now + duration);
1806
+ const snapBuffer = ctx.createBuffer(1, Math.floor(ctx.sampleRate * 0.08), ctx.sampleRate);
1807
+ const snapData = snapBuffer.getChannelData(0);
1808
+ for (let i = 0; i < snapData.length; i++) {
1809
+ snapData[i] = Math.random() * 2 - 1;
1810
+ }
1811
+ const snapSource = ctx.createBufferSource();
1812
+ snapSource.buffer = snapBuffer;
1813
+ const snapFilter = ctx.createBiquadFilter();
1814
+ snapFilter.type = "bandpass";
1815
+ snapFilter.frequency.setValueAtTime(2e3, now);
1816
+ snapFilter.Q.setValueAtTime(1.5, now);
1817
+ const snapEnvelope = ctx.createGain();
1818
+ snapEnvelope.gain.setValueAtTime(0, now);
1819
+ snapEnvelope.gain.setValueAtTime(0, now + duration * 0.7);
1820
+ snapEnvelope.gain.linearRampToValueAtTime(volume * 0.8, now + duration * 0.75);
1821
+ snapEnvelope.gain.exponentialRampToValueAtTime(1e-3, now + duration);
1822
+ noiseSource.connect(bandpass);
1823
+ bandpass.connect(highpass);
1824
+ highpass.connect(envelope);
1825
+ envelope.connect(ctx.destination);
1826
+ snapSource.connect(snapFilter);
1827
+ snapFilter.connect(snapEnvelope);
1828
+ snapEnvelope.connect(ctx.destination);
1829
+ noiseSource.start(now);
1830
+ noiseSource.stop(now + duration);
1831
+ snapSource.start(now);
1832
+ snapSource.stop(now + duration);
1833
+ }
1834
+ var audioContext;
1835
+ var init_page_turn_sound = __esm({
1836
+ "src/utils/page-turn-sound.ts"() {
1837
+ "use strict";
1838
+ audioContext = null;
1839
+ }
1840
+ });
1841
+
1763
1842
  // src/utils/index.ts
1764
1843
  var init_utils = __esm({
1765
1844
  "src/utils/index.ts"() {
@@ -1774,6 +1853,7 @@ var init_utils = __esm({
1774
1853
  init_agent_api();
1775
1854
  init_text_search();
1776
1855
  init_coordinates();
1856
+ init_page_turn_sound();
1777
1857
  }
1778
1858
  });
1779
1859
 
@@ -9802,16 +9882,211 @@ var init_DualPageContainer = __esm({
9802
9882
  }
9803
9883
  });
9804
9884
 
9805
- // src/components/FloatingZoomControls/FloatingZoomControls.tsx
9806
- import { memo as memo26, useCallback as useCallback32 } from "react";
9885
+ // src/components/PDFViewer/BookModeContainer.tsx
9886
+ import React, { memo as memo26, useEffect as useEffect22, useState as useState21, useRef as useRef19, useCallback as useCallback32 } from "react";
9887
+ import HTMLFlipBook from "react-pageflip";
9807
9888
  import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
9889
+ var BookPage, BookModeContainer;
9890
+ var init_BookModeContainer = __esm({
9891
+ "src/components/PDFViewer/BookModeContainer.tsx"() {
9892
+ "use strict";
9893
+ init_PDFPage2();
9894
+ init_PDFLoadingScreen2();
9895
+ init_hooks();
9896
+ init_utils();
9897
+ BookPage = React.forwardRef(function BookPage2({ pageNumber, page, scale, rotation, width, height }, ref) {
9898
+ return /* @__PURE__ */ jsx27("div", { ref, className: "book-page", "data-page-number": pageNumber, children: /* @__PURE__ */ jsx27("div", { style: { width, height, overflow: "hidden" }, children: /* @__PURE__ */ jsx27(
9899
+ PDFPage,
9900
+ {
9901
+ pageNumber,
9902
+ page,
9903
+ scale,
9904
+ rotation,
9905
+ showTextLayer: false,
9906
+ showAnnotationLayer: false,
9907
+ showHighlightLayer: false
9908
+ }
9909
+ ) }) });
9910
+ });
9911
+ BookModeContainer = memo26(function BookModeContainer2({
9912
+ className,
9913
+ flippingTime = 800,
9914
+ drawShadow = true,
9915
+ maxShadowOpacity = 0.7
9916
+ }) {
9917
+ const {
9918
+ document: document2,
9919
+ currentPage,
9920
+ numPages,
9921
+ scale,
9922
+ rotation,
9923
+ theme,
9924
+ isLoading,
9925
+ goToPage
9926
+ } = usePDFViewer();
9927
+ const scrollToPageRequest = useViewerStore((s) => s.scrollToPageRequest);
9928
+ const { viewerStore } = usePDFViewerStores();
9929
+ const [pages, setPages] = useState21([]);
9930
+ const [pageDims, setPageDims] = useState21({ width: 612, height: 792 });
9931
+ const [isLoadingPages, setIsLoadingPages] = useState21(false);
9932
+ const flipBookRef = useRef19(null);
9933
+ const isSyncingRef = useRef19(false);
9934
+ useEffect22(() => {
9935
+ if (!document2) {
9936
+ setPages([]);
9937
+ return;
9938
+ }
9939
+ let cancelled = false;
9940
+ const loadAllPages = async () => {
9941
+ setIsLoadingPages(true);
9942
+ try {
9943
+ const pagePromises = [];
9944
+ for (let i = 1; i <= numPages; i++) {
9945
+ pagePromises.push(document2.getPage(i));
9946
+ }
9947
+ const results = await Promise.allSettled(pagePromises);
9948
+ if (!cancelled) {
9949
+ const loaded = results.map((r) => r.status === "fulfilled" ? r.value : null);
9950
+ setPages(loaded);
9951
+ const firstPage = loaded[0];
9952
+ if (firstPage) {
9953
+ const vp = firstPage.getViewport({ scale, rotation });
9954
+ setPageDims({ width: Math.floor(vp.width), height: Math.floor(vp.height) });
9955
+ }
9956
+ }
9957
+ } catch {
9958
+ } finally {
9959
+ if (!cancelled) setIsLoadingPages(false);
9960
+ }
9961
+ };
9962
+ loadAllPages();
9963
+ return () => {
9964
+ cancelled = true;
9965
+ };
9966
+ }, [document2, numPages, scale, rotation]);
9967
+ useEffect22(() => {
9968
+ if (pages[0]) {
9969
+ const vp = pages[0].getViewport({ scale, rotation });
9970
+ setPageDims({ width: Math.floor(vp.width), height: Math.floor(vp.height) });
9971
+ }
9972
+ }, [pages, scale, rotation]);
9973
+ useEffect22(() => {
9974
+ const pageFlip = flipBookRef.current?.pageFlip();
9975
+ if (!pageFlip) return;
9976
+ const flipBookPage = pageFlip.getCurrentPageIndex();
9977
+ const targetIndex = currentPage - 1;
9978
+ if (flipBookPage !== targetIndex) {
9979
+ isSyncingRef.current = true;
9980
+ pageFlip.turnToPage(targetIndex);
9981
+ setTimeout(() => {
9982
+ isSyncingRef.current = false;
9983
+ }, 100);
9984
+ }
9985
+ }, [currentPage]);
9986
+ useEffect22(() => {
9987
+ if (scrollToPageRequest) {
9988
+ requestAnimationFrame(() => {
9989
+ viewerStore.getState().completeScrollRequest(scrollToPageRequest.requestId);
9990
+ });
9991
+ }
9992
+ }, [scrollToPageRequest, viewerStore]);
9993
+ const handleFlip = useCallback32((e) => {
9994
+ if (isSyncingRef.current) return;
9995
+ const newPage = e.data + 1;
9996
+ if (newPage !== currentPage && newPage >= 1 && newPage <= numPages) {
9997
+ goToPage(newPage);
9998
+ }
9999
+ }, [currentPage, numPages, goToPage]);
10000
+ const themeStyles = {
10001
+ light: "bg-gray-100",
10002
+ dark: "bg-gray-900",
10003
+ sepia: "bg-amber-50"
10004
+ };
10005
+ const themeClass = theme === "dark" ? "dark" : theme === "sepia" ? "sepia" : "";
10006
+ if (!document2) {
10007
+ return /* @__PURE__ */ jsx27("div", { className: cn("document-container", "flex-1", themeStyles[theme], className), children: /* @__PURE__ */ jsx27(PDFLoadingScreen, { phase: isLoading ? "fetching" : "initializing" }) });
10008
+ }
10009
+ if (isLoadingPages || pages.length === 0) {
10010
+ return /* @__PURE__ */ jsx27("div", { className: cn("document-container", "flex-1", themeStyles[theme], className), children: /* @__PURE__ */ jsx27(PDFLoadingScreen, { phase: "rendering" }) });
10011
+ }
10012
+ return /* @__PURE__ */ jsxs23(
10013
+ "div",
10014
+ {
10015
+ className: cn(
10016
+ "book-mode-container",
10017
+ "flex-1 overflow-hidden",
10018
+ "flex items-center justify-center",
10019
+ themeStyles[theme],
10020
+ themeClass,
10021
+ className
10022
+ ),
10023
+ style: { userSelect: "none", WebkitUserSelect: "none" },
10024
+ children: [
10025
+ /* @__PURE__ */ jsx27(
10026
+ HTMLFlipBook,
10027
+ {
10028
+ ref: flipBookRef,
10029
+ width: pageDims.width,
10030
+ height: pageDims.height,
10031
+ size: "stretch",
10032
+ minWidth: 300,
10033
+ maxWidth: pageDims.width,
10034
+ minHeight: 400,
10035
+ maxHeight: pageDims.height,
10036
+ drawShadow,
10037
+ maxShadowOpacity,
10038
+ flippingTime,
10039
+ usePortrait: true,
10040
+ startPage: currentPage - 1,
10041
+ showCover: false,
10042
+ mobileScrollSupport: false,
10043
+ swipeDistance: 30,
10044
+ showPageCorners: true,
10045
+ useMouseEvents: true,
10046
+ clickEventForward: false,
10047
+ onFlip: handleFlip,
10048
+ className: "book-flipbook",
10049
+ style: {},
10050
+ startZIndex: 0,
10051
+ autoSize: true,
10052
+ renderOnlyPageLengthChange: false,
10053
+ disableFlipByClick: false,
10054
+ children: pages.map((page, index) => /* @__PURE__ */ jsx27(
10055
+ BookPage,
10056
+ {
10057
+ pageNumber: index + 1,
10058
+ page,
10059
+ scale,
10060
+ rotation,
10061
+ width: pageDims.width,
10062
+ height: pageDims.height
10063
+ },
10064
+ index
10065
+ ))
10066
+ }
10067
+ ),
10068
+ /* @__PURE__ */ jsxs23("div", { className: "book-page-indicator", children: [
10069
+ currentPage,
10070
+ " / ",
10071
+ numPages
10072
+ ] })
10073
+ ]
10074
+ }
10075
+ );
10076
+ });
10077
+ }
10078
+ });
10079
+
10080
+ // src/components/FloatingZoomControls/FloatingZoomControls.tsx
10081
+ import { memo as memo27, useCallback as useCallback33 } from "react";
10082
+ import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
9808
10083
  var FloatingZoomControls;
9809
10084
  var init_FloatingZoomControls = __esm({
9810
10085
  "src/components/FloatingZoomControls/FloatingZoomControls.tsx"() {
9811
10086
  "use strict";
9812
10087
  init_hooks();
9813
10088
  init_utils();
9814
- FloatingZoomControls = memo26(function FloatingZoomControls2({
10089
+ FloatingZoomControls = memo27(function FloatingZoomControls2({
9815
10090
  position = "bottom-right",
9816
10091
  className,
9817
10092
  showFitToWidth = true,
@@ -9821,20 +10096,20 @@ var init_FloatingZoomControls = __esm({
9821
10096
  const { viewerStore } = usePDFViewerStores();
9822
10097
  const scale = useViewerStore((s) => s.scale);
9823
10098
  const document2 = useViewerStore((s) => s.document);
9824
- const handleZoomIn = useCallback32(() => {
10099
+ const handleZoomIn = useCallback33(() => {
9825
10100
  const currentScale = viewerStore.getState().scale;
9826
10101
  const newScale = Math.min(4, currentScale + 0.05);
9827
10102
  viewerStore.getState().setScale(newScale);
9828
10103
  }, [viewerStore]);
9829
- const handleZoomOut = useCallback32(() => {
10104
+ const handleZoomOut = useCallback33(() => {
9830
10105
  const currentScale = viewerStore.getState().scale;
9831
10106
  const newScale = Math.max(0.1, currentScale - 0.05);
9832
10107
  viewerStore.getState().setScale(newScale);
9833
10108
  }, [viewerStore]);
9834
- const handleFitToWidth = useCallback32(() => {
10109
+ const handleFitToWidth = useCallback33(() => {
9835
10110
  viewerStore.getState().setScale(1);
9836
10111
  }, [viewerStore]);
9837
- const handleFitToPage = useCallback32(() => {
10112
+ const handleFitToPage = useCallback33(() => {
9838
10113
  viewerStore.getState().setScale(0.75);
9839
10114
  }, [viewerStore]);
9840
10115
  if (!document2) return null;
@@ -9845,7 +10120,7 @@ var init_FloatingZoomControls = __esm({
9845
10120
  "top-left": "top-4 left-4"
9846
10121
  };
9847
10122
  const zoomPercentage = Math.round(scale * 100);
9848
- return /* @__PURE__ */ jsxs23(
10123
+ return /* @__PURE__ */ jsxs24(
9849
10124
  "div",
9850
10125
  {
9851
10126
  className: cn(
@@ -9857,7 +10132,7 @@ var init_FloatingZoomControls = __esm({
9857
10132
  className
9858
10133
  ),
9859
10134
  children: [
9860
- /* @__PURE__ */ jsx27(
10135
+ /* @__PURE__ */ jsx28(
9861
10136
  "button",
9862
10137
  {
9863
10138
  onClick: handleZoomOut,
@@ -9871,14 +10146,14 @@ var init_FloatingZoomControls = __esm({
9871
10146
  disabled: scale <= 0.25,
9872
10147
  title: "Zoom Out",
9873
10148
  "aria-label": "Zoom Out",
9874
- children: /* @__PURE__ */ jsx27("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx27("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 12H4" }) })
10149
+ children: /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 12H4" }) })
9875
10150
  }
9876
10151
  ),
9877
- showZoomLevel && /* @__PURE__ */ jsxs23("span", { className: "min-w-[48px] text-center text-sm font-medium text-gray-700 dark:text-gray-300", children: [
10152
+ showZoomLevel && /* @__PURE__ */ jsxs24("span", { className: "min-w-[48px] text-center text-sm font-medium text-gray-700 dark:text-gray-300", children: [
9878
10153
  zoomPercentage,
9879
10154
  "%"
9880
10155
  ] }),
9881
- /* @__PURE__ */ jsx27(
10156
+ /* @__PURE__ */ jsx28(
9882
10157
  "button",
9883
10158
  {
9884
10159
  onClick: handleZoomIn,
@@ -9892,11 +10167,11 @@ var init_FloatingZoomControls = __esm({
9892
10167
  disabled: scale >= 4,
9893
10168
  title: "Zoom In",
9894
10169
  "aria-label": "Zoom In",
9895
- children: /* @__PURE__ */ jsx27("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx27("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) })
10170
+ children: /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) })
9896
10171
  }
9897
10172
  ),
9898
- (showFitToWidth || showFitToPage) && /* @__PURE__ */ jsx27("div", { className: "w-px h-6 bg-gray-200 dark:bg-gray-700 mx-1" }),
9899
- showFitToWidth && /* @__PURE__ */ jsx27(
10173
+ (showFitToWidth || showFitToPage) && /* @__PURE__ */ jsx28("div", { className: "w-px h-6 bg-gray-200 dark:bg-gray-700 mx-1" }),
10174
+ showFitToWidth && /* @__PURE__ */ jsx28(
9900
10175
  "button",
9901
10176
  {
9902
10177
  onClick: handleFitToWidth,
@@ -9908,10 +10183,10 @@ var init_FloatingZoomControls = __esm({
9908
10183
  ),
9909
10184
  title: "Fit to Width",
9910
10185
  "aria-label": "Fit to Width",
9911
- children: /* @__PURE__ */ jsx27("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx27("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) })
10186
+ children: /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) })
9912
10187
  }
9913
10188
  ),
9914
- showFitToPage && /* @__PURE__ */ jsx27(
10189
+ showFitToPage && /* @__PURE__ */ jsx28(
9915
10190
  "button",
9916
10191
  {
9917
10192
  onClick: handleFitToPage,
@@ -9923,7 +10198,7 @@ var init_FloatingZoomControls = __esm({
9923
10198
  ),
9924
10199
  title: "Fit to Page",
9925
10200
  "aria-label": "Fit to Page",
9926
- children: /* @__PURE__ */ jsx27("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx27("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) })
10201
+ children: /* @__PURE__ */ jsx28("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) })
9927
10202
  }
9928
10203
  )
9929
10204
  ]
@@ -9947,14 +10222,14 @@ __export(PDFViewerClient_exports, {
9947
10222
  PDFViewerClient: () => PDFViewerClient
9948
10223
  });
9949
10224
  import {
9950
- useEffect as useEffect22,
9951
- useCallback as useCallback33,
9952
- memo as memo27,
9953
- useRef as useRef19,
9954
- useState as useState21,
10225
+ useEffect as useEffect23,
10226
+ useCallback as useCallback34,
10227
+ memo as memo28,
10228
+ useRef as useRef20,
10229
+ useState as useState22,
9955
10230
  forwardRef
9956
10231
  } from "react";
9957
- import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
10232
+ import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
9958
10233
  function getSrcIdentifier(src) {
9959
10234
  if (typeof src === "string") {
9960
10235
  return src;
@@ -10006,10 +10281,11 @@ var init_PDFViewerClient = __esm({
10006
10281
  init_DocumentContainer();
10007
10282
  init_ContinuousScrollContainer();
10008
10283
  init_DualPageContainer();
10284
+ init_BookModeContainer();
10009
10285
  init_FloatingZoomControls2();
10010
10286
  init_PDFLoadingScreen2();
10011
10287
  init_utils();
10012
- PDFViewerInner = memo27(function PDFViewerInner2({
10288
+ PDFViewerInner = memo28(function PDFViewerInner2({
10013
10289
  src,
10014
10290
  initialPage = 1,
10015
10291
  page: controlledPage,
@@ -10036,19 +10312,19 @@ var init_PDFViewerClient = __esm({
10036
10312
  onReady
10037
10313
  }) {
10038
10314
  const { viewerStore, annotationStore, searchStore } = usePDFViewerStores();
10039
- const mountedRef = useRef19(true);
10040
- const [, setLoadState] = useState21("idle");
10041
- const onDocumentLoadRef = useRef19(onDocumentLoad);
10042
- const onErrorRef = useRef19(onError);
10043
- const onPageChangeRef = useRef19(onPageChange);
10044
- const onScaleChangeRef = useRef19(onScaleChange);
10045
- const onZoomChangeRef = useRef19(onZoomChange);
10046
- const onPageRenderStartRef = useRef19(onPageRenderStart);
10047
- const onPageRenderCompleteRef = useRef19(onPageRenderComplete);
10048
- const onHighlightAddedRef = useRef19(onHighlightAdded);
10049
- const onHighlightRemovedRef = useRef19(onHighlightRemoved);
10050
- const onAnnotationAddedRef = useRef19(onAnnotationAdded);
10051
- const onReadyRef = useRef19(onReady);
10315
+ const mountedRef = useRef20(true);
10316
+ const [, setLoadState] = useState22("idle");
10317
+ const onDocumentLoadRef = useRef20(onDocumentLoad);
10318
+ const onErrorRef = useRef20(onError);
10319
+ const onPageChangeRef = useRef20(onPageChange);
10320
+ const onScaleChangeRef = useRef20(onScaleChange);
10321
+ const onZoomChangeRef = useRef20(onZoomChange);
10322
+ const onPageRenderStartRef = useRef20(onPageRenderStart);
10323
+ const onPageRenderCompleteRef = useRef20(onPageRenderComplete);
10324
+ const onHighlightAddedRef = useRef20(onHighlightAdded);
10325
+ const onHighlightRemovedRef = useRef20(onHighlightRemoved);
10326
+ const onAnnotationAddedRef = useRef20(onAnnotationAdded);
10327
+ const onReadyRef = useRef20(onReady);
10052
10328
  onDocumentLoadRef.current = onDocumentLoad;
10053
10329
  onErrorRef.current = onError;
10054
10330
  onPageChangeRef.current = onPageChange;
@@ -10061,8 +10337,8 @@ var init_PDFViewerClient = __esm({
10061
10337
  onAnnotationAddedRef.current = onAnnotationAdded;
10062
10338
  onReadyRef.current = onReady;
10063
10339
  const isControlled = controlledPage !== void 0;
10064
- const prevControlledPageRef = useRef19(controlledPage);
10065
- const srcIdRef = useRef19(null);
10340
+ const prevControlledPageRef = useRef20(controlledPage);
10341
+ const srcIdRef = useRef20(null);
10066
10342
  const currentPage = useViewerStore((s) => s.currentPage);
10067
10343
  const scale = useViewerStore((s) => s.scale);
10068
10344
  const theme = useViewerStore((s) => s.theme);
@@ -10072,8 +10348,8 @@ var init_PDFViewerClient = __esm({
10072
10348
  const sidebarOpen = useViewerStore((s) => s.sidebarOpen);
10073
10349
  const streamingProgress = useViewerStore((s) => s.streamingProgress);
10074
10350
  const srcId = getSrcIdentifier(src);
10075
- const handleRef = useRef19(null);
10076
- useEffect22(() => {
10351
+ const handleRef = useRef20(null);
10352
+ useEffect23(() => {
10077
10353
  const handle = {
10078
10354
  // ==================== Text Highlighting ====================
10079
10355
  highlightText: async (text, options) => {
@@ -10491,14 +10767,14 @@ var init_PDFViewerClient = __esm({
10491
10767
  handleRef.current = handle;
10492
10768
  onReadyRef.current?.(handle);
10493
10769
  }, [viewerStore, annotationStore, searchStore]);
10494
- const handleRetry = useCallback33(() => {
10770
+ const handleRetry = useCallback34(() => {
10495
10771
  srcIdRef.current = null;
10496
10772
  viewerStore.getState().setError(null);
10497
10773
  setLoadState("idle");
10498
10774
  }, [viewerStore]);
10499
- const abortControllerRef = useRef19(null);
10500
- const currentSrcRef = useRef19(null);
10501
- useEffect22(() => {
10775
+ const abortControllerRef = useRef20(null);
10776
+ const currentSrcRef = useRef20(null);
10777
+ useEffect23(() => {
10502
10778
  mountedRef.current = true;
10503
10779
  return () => {
10504
10780
  mountedRef.current = false;
@@ -10523,8 +10799,8 @@ var init_PDFViewerClient = __esm({
10523
10799
  viewerStore.getState().setError(null);
10524
10800
  };
10525
10801
  }, [viewerStore]);
10526
- const cancelLoaderRef = useRef19(null);
10527
- useEffect22(() => {
10802
+ const cancelLoaderRef = useRef20(null);
10803
+ useEffect23(() => {
10528
10804
  if (srcIdRef.current === srcId && viewerStore.getState().document) {
10529
10805
  return;
10530
10806
  }
@@ -10658,22 +10934,22 @@ var init_PDFViewerClient = __esm({
10658
10934
  }
10659
10935
  };
10660
10936
  }, [srcId, src, workerSrc, initialPage, initialScale, viewerStore]);
10661
- const prevPageRef = useRef19(currentPage);
10662
- useEffect22(() => {
10937
+ const prevPageRef = useRef20(currentPage);
10938
+ useEffect23(() => {
10663
10939
  if (prevPageRef.current !== currentPage) {
10664
10940
  prevPageRef.current = currentPage;
10665
10941
  onPageChangeRef.current?.(currentPage);
10666
10942
  }
10667
10943
  }, [currentPage]);
10668
- const prevScaleRef = useRef19(scale);
10669
- useEffect22(() => {
10944
+ const prevScaleRef = useRef20(scale);
10945
+ useEffect23(() => {
10670
10946
  if (prevScaleRef.current !== scale) {
10671
10947
  prevScaleRef.current = scale;
10672
10948
  onScaleChangeRef.current?.(scale);
10673
10949
  onZoomChangeRef.current?.(scale);
10674
10950
  }
10675
10951
  }, [scale]);
10676
- useEffect22(() => {
10952
+ useEffect23(() => {
10677
10953
  if (!isControlled || controlledPage === void 0) return;
10678
10954
  if (prevControlledPageRef.current === controlledPage) return;
10679
10955
  prevControlledPageRef.current = controlledPage;
@@ -10686,7 +10962,7 @@ var init_PDFViewerClient = __esm({
10686
10962
  if (error) {
10687
10963
  if (errorComponent) {
10688
10964
  const errorContent = typeof errorComponent === "function" ? errorComponent(error, handleRetry) : errorComponent;
10689
- return /* @__PURE__ */ jsx28(
10965
+ return /* @__PURE__ */ jsx29(
10690
10966
  "div",
10691
10967
  {
10692
10968
  className: cn(
@@ -10700,7 +10976,7 @@ var init_PDFViewerClient = __esm({
10700
10976
  }
10701
10977
  );
10702
10978
  }
10703
- return /* @__PURE__ */ jsx28(
10979
+ return /* @__PURE__ */ jsx29(
10704
10980
  "div",
10705
10981
  {
10706
10982
  className: cn(
@@ -10710,10 +10986,10 @@ var init_PDFViewerClient = __esm({
10710
10986
  themeClass,
10711
10987
  className
10712
10988
  ),
10713
- children: /* @__PURE__ */ jsx28("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxs24("div", { className: "text-center p-8", children: [
10714
- /* @__PURE__ */ jsx28("div", { className: "text-red-500 text-lg font-semibold mb-2", children: "Failed to load PDF" }),
10715
- /* @__PURE__ */ jsx28("div", { className: "text-gray-500 text-sm", children: error.message }),
10716
- /* @__PURE__ */ jsx28(
10989
+ children: /* @__PURE__ */ jsx29("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxs25("div", { className: "text-center p-8", children: [
10990
+ /* @__PURE__ */ jsx29("div", { className: "text-red-500 text-lg font-semibold mb-2", children: "Failed to load PDF" }),
10991
+ /* @__PURE__ */ jsx29("div", { className: "text-gray-500 text-sm", children: error.message }),
10992
+ /* @__PURE__ */ jsx29(
10717
10993
  "button",
10718
10994
  {
10719
10995
  onClick: handleRetry,
@@ -10728,15 +11004,17 @@ var init_PDFViewerClient = __esm({
10728
11004
  const renderContainer = () => {
10729
11005
  switch (viewMode) {
10730
11006
  case "continuous":
10731
- return /* @__PURE__ */ jsx28(ContinuousScrollContainer, {});
11007
+ return /* @__PURE__ */ jsx29(ContinuousScrollContainer, {});
10732
11008
  case "dual":
10733
- return /* @__PURE__ */ jsx28(DualPageContainer, {});
11009
+ return /* @__PURE__ */ jsx29(DualPageContainer, {});
11010
+ case "book":
11011
+ return /* @__PURE__ */ jsx29(BookModeContainer, {});
10734
11012
  case "single":
10735
11013
  default:
10736
- return /* @__PURE__ */ jsx28(DocumentContainer, {});
11014
+ return /* @__PURE__ */ jsx29(DocumentContainer, {});
10737
11015
  }
10738
11016
  };
10739
- return /* @__PURE__ */ jsxs24(
11017
+ return /* @__PURE__ */ jsxs25(
10740
11018
  "div",
10741
11019
  {
10742
11020
  className: cn(
@@ -10748,14 +11026,14 @@ var init_PDFViewerClient = __esm({
10748
11026
  className
10749
11027
  ),
10750
11028
  children: [
10751
- showToolbar && /* @__PURE__ */ jsx28(Toolbar, {}),
10752
- showAnnotationToolbar && /* @__PURE__ */ jsx28(AnnotationToolbar, {}),
10753
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-1 overflow-hidden", children: [
10754
- showSidebar && sidebarOpen && /* @__PURE__ */ jsx28(Sidebar, {}),
11029
+ showToolbar && /* @__PURE__ */ jsx29(Toolbar, {}),
11030
+ showAnnotationToolbar && /* @__PURE__ */ jsx29(AnnotationToolbar, {}),
11031
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-1 overflow-hidden", children: [
11032
+ showSidebar && sidebarOpen && /* @__PURE__ */ jsx29(Sidebar, {}),
10755
11033
  renderContainer()
10756
11034
  ] }),
10757
- showFloatingZoom && /* @__PURE__ */ jsx28(FloatingZoomControls, { position: "bottom-right" }),
10758
- isLoading && /* @__PURE__ */ jsx28("div", { className: "absolute inset-0 z-50", children: loadingComponent ?? /* @__PURE__ */ jsx28(
11035
+ showFloatingZoom && /* @__PURE__ */ jsx29(FloatingZoomControls, { position: "bottom-right" }),
11036
+ isLoading && /* @__PURE__ */ jsx29("div", { className: "absolute inset-0 z-50", children: loadingComponent ?? /* @__PURE__ */ jsx29(
10759
11037
  PDFLoadingScreen,
10760
11038
  {
10761
11039
  phase: loadingProgress?.phase ?? "fetching",
@@ -10764,10 +11042,10 @@ var init_PDFViewerClient = __esm({
10764
11042
  totalBytes: loadingProgress?.totalBytes
10765
11043
  }
10766
11044
  ) }),
10767
- !isLoading && streamingProgress && streamingProgress.total > 0 && streamingProgress.loaded < streamingProgress.total && /* @__PURE__ */ jsxs24("div", { className: "absolute bottom-20 right-4 z-40 px-3 py-2 bg-gray-900/80 text-white text-xs rounded-lg shadow-lg flex items-center gap-2", children: [
10768
- /* @__PURE__ */ jsx28("div", { className: "w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
10769
- /* @__PURE__ */ jsx28("span", { children: "Loading pages..." }),
10770
- /* @__PURE__ */ jsxs24("span", { className: "text-white/60", children: [
11045
+ !isLoading && streamingProgress && streamingProgress.total > 0 && streamingProgress.loaded < streamingProgress.total && /* @__PURE__ */ jsxs25("div", { className: "absolute bottom-20 right-4 z-40 px-3 py-2 bg-gray-900/80 text-white text-xs rounded-lg shadow-lg flex items-center gap-2", children: [
11046
+ /* @__PURE__ */ jsx29("div", { className: "w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
11047
+ /* @__PURE__ */ jsx29("span", { children: "Loading pages..." }),
11048
+ /* @__PURE__ */ jsxs25("span", { className: "text-white/60", children: [
10771
11049
  Math.round(streamingProgress.loaded / streamingProgress.total * 100),
10772
11050
  "%"
10773
11051
  ] })
@@ -10778,8 +11056,8 @@ var init_PDFViewerClient = __esm({
10778
11056
  });
10779
11057
  PDFViewerInnerWithRef = forwardRef(
10780
11058
  function PDFViewerInnerWithRef2(props, ref) {
10781
- const handleRef = useRef19(null);
10782
- const handleReady = useCallback33((handle) => {
11059
+ const handleRef = useRef20(null);
11060
+ const handleReady = useCallback34((handle) => {
10783
11061
  handleRef.current = handle;
10784
11062
  if (typeof ref === "function") {
10785
11063
  ref(handle);
@@ -10787,17 +11065,17 @@ var init_PDFViewerClient = __esm({
10787
11065
  ref.current = handle;
10788
11066
  }
10789
11067
  }, [ref]);
10790
- return /* @__PURE__ */ jsx28(PDFViewerInner, { ...props, onReady: handleReady });
11068
+ return /* @__PURE__ */ jsx29(PDFViewerInner, { ...props, onReady: handleReady });
10791
11069
  }
10792
11070
  );
10793
- PDFViewerClient = memo27(
11071
+ PDFViewerClient = memo28(
10794
11072
  forwardRef(function PDFViewerClient2(props, ref) {
10795
- return /* @__PURE__ */ jsx28(
11073
+ return /* @__PURE__ */ jsx29(
10796
11074
  PDFViewerProvider,
10797
11075
  {
10798
11076
  theme: props.theme,
10799
11077
  defaultSidebarPanel: props.defaultSidebarPanel,
10800
- children: /* @__PURE__ */ jsx28(PDFViewerInnerWithRef, { ref, ...props })
11078
+ children: /* @__PURE__ */ jsx29(PDFViewerInnerWithRef, { ref, ...props })
10801
11079
  }
10802
11080
  );
10803
11081
  })
@@ -10806,8 +11084,8 @@ var init_PDFViewerClient = __esm({
10806
11084
  });
10807
11085
 
10808
11086
  // src/components/PDFViewer/PDFViewer.tsx
10809
- import { lazy, Suspense, memo as memo28 } from "react";
10810
- import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
11087
+ import { lazy, Suspense, memo as memo29 } from "react";
11088
+ import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
10811
11089
  var PDFViewerClient3, PDFViewerLoading, PDFViewer;
10812
11090
  var init_PDFViewer = __esm({
10813
11091
  "src/components/PDFViewer/PDFViewer.tsx"() {
@@ -10816,10 +11094,10 @@ var init_PDFViewer = __esm({
10816
11094
  PDFViewerClient3 = lazy(
10817
11095
  () => Promise.resolve().then(() => (init_PDFViewerClient(), PDFViewerClient_exports)).then((mod) => ({ default: mod.PDFViewerClient }))
10818
11096
  );
10819
- PDFViewerLoading = memo28(function PDFViewerLoading2({
11097
+ PDFViewerLoading = memo29(function PDFViewerLoading2({
10820
11098
  className
10821
11099
  }) {
10822
- return /* @__PURE__ */ jsx29(
11100
+ return /* @__PURE__ */ jsx30(
10823
11101
  "div",
10824
11102
  {
10825
11103
  className: cn(
@@ -10828,18 +11106,18 @@ var init_PDFViewer = __esm({
10828
11106
  "bg-white dark:bg-gray-900",
10829
11107
  className
10830
11108
  ),
10831
- children: /* @__PURE__ */ jsx29("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxs25("div", { className: "flex flex-col items-center", children: [
10832
- /* @__PURE__ */ jsx29("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
10833
- /* @__PURE__ */ jsx29("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF viewer..." })
11109
+ children: /* @__PURE__ */ jsx30("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxs26("div", { className: "flex flex-col items-center", children: [
11110
+ /* @__PURE__ */ jsx30("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
11111
+ /* @__PURE__ */ jsx30("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF viewer..." })
10834
11112
  ] }) })
10835
11113
  }
10836
11114
  );
10837
11115
  });
10838
- PDFViewer = memo28(function PDFViewer2(props) {
11116
+ PDFViewer = memo29(function PDFViewer2(props) {
10839
11117
  if (typeof window === "undefined") {
10840
- return /* @__PURE__ */ jsx29(PDFViewerLoading, { className: props.className });
11118
+ return /* @__PURE__ */ jsx30(PDFViewerLoading, { className: props.className });
10841
11119
  }
10842
- return /* @__PURE__ */ jsx29(Suspense, { fallback: /* @__PURE__ */ jsx29(PDFViewerLoading, { className: props.className }), children: /* @__PURE__ */ jsx29(PDFViewerClient3, { ...props }) });
11120
+ return /* @__PURE__ */ jsx30(Suspense, { fallback: /* @__PURE__ */ jsx30(PDFViewerLoading, { className: props.className }), children: /* @__PURE__ */ jsx30(PDFViewerClient3, { ...props }) });
10843
11121
  });
10844
11122
  }
10845
11123
  });
@@ -10854,6 +11132,7 @@ var init_PDFViewer2 = __esm({
10854
11132
  init_VirtualizedDocumentContainer();
10855
11133
  init_ContinuousScrollContainer();
10856
11134
  init_DualPageContainer();
11135
+ init_BookModeContainer();
10857
11136
  }
10858
11137
  });
10859
11138
 
@@ -10868,8 +11147,8 @@ init_AnnotationToolbar2();
10868
11147
 
10869
11148
  // src/components/Annotations/StickyNote.tsx
10870
11149
  init_utils();
10871
- import { memo as memo29, useState as useState22, useRef as useRef20, useEffect as useEffect23, useCallback as useCallback34 } from "react";
10872
- import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
11150
+ import { memo as memo30, useState as useState23, useRef as useRef21, useEffect as useEffect24, useCallback as useCallback35 } from "react";
11151
+ import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
10873
11152
  var NOTE_COLORS = [
10874
11153
  "#fef08a",
10875
11154
  // yellow
@@ -10882,7 +11161,7 @@ var NOTE_COLORS = [
10882
11161
  "#fed7aa"
10883
11162
  // orange
10884
11163
  ];
10885
- var StickyNote = memo29(function StickyNote2({
11164
+ var StickyNote = memo30(function StickyNote2({
10886
11165
  note,
10887
11166
  scale,
10888
11167
  isSelected,
@@ -10895,37 +11174,37 @@ var StickyNote = memo29(function StickyNote2({
10895
11174
  onDragStart,
10896
11175
  className
10897
11176
  }) {
10898
- const [isExpanded, setIsExpanded] = useState22(false);
10899
- const [localContent, setLocalContent] = useState22(note.content);
10900
- const textareaRef = useRef20(null);
10901
- const noteRef = useRef20(null);
10902
- useEffect23(() => {
11177
+ const [isExpanded, setIsExpanded] = useState23(false);
11178
+ const [localContent, setLocalContent] = useState23(note.content);
11179
+ const textareaRef = useRef21(null);
11180
+ const noteRef = useRef21(null);
11181
+ useEffect24(() => {
10903
11182
  setLocalContent(note.content);
10904
11183
  }, [note.content]);
10905
- useEffect23(() => {
11184
+ useEffect24(() => {
10906
11185
  if (isEditing && textareaRef.current) {
10907
11186
  textareaRef.current.focus();
10908
11187
  textareaRef.current.select();
10909
11188
  }
10910
11189
  }, [isEditing]);
10911
- const handleClick = useCallback34((e) => {
11190
+ const handleClick = useCallback35((e) => {
10912
11191
  e.stopPropagation();
10913
11192
  onSelect?.();
10914
11193
  if (!isExpanded) {
10915
11194
  setIsExpanded(true);
10916
11195
  }
10917
11196
  }, [isExpanded, onSelect]);
10918
- const handleDoubleClick = useCallback34((e) => {
11197
+ const handleDoubleClick = useCallback35((e) => {
10919
11198
  e.stopPropagation();
10920
11199
  onStartEdit?.();
10921
11200
  }, [onStartEdit]);
10922
- const handleBlur = useCallback34(() => {
11201
+ const handleBlur = useCallback35(() => {
10923
11202
  if (isEditing && localContent !== note.content) {
10924
11203
  onUpdate?.({ content: localContent });
10925
11204
  }
10926
11205
  onEndEdit?.();
10927
11206
  }, [isEditing, localContent, note.content, onUpdate, onEndEdit]);
10928
- const handleKeyDown = useCallback34((e) => {
11207
+ const handleKeyDown = useCallback35((e) => {
10929
11208
  if (e.key === "Escape") {
10930
11209
  setLocalContent(note.content);
10931
11210
  onEndEdit?.();
@@ -10933,16 +11212,16 @@ var StickyNote = memo29(function StickyNote2({
10933
11212
  handleBlur();
10934
11213
  }
10935
11214
  }, [note.content, onEndEdit, handleBlur]);
10936
- const handleColorChange = useCallback34((color) => {
11215
+ const handleColorChange = useCallback35((color) => {
10937
11216
  onUpdate?.({ color });
10938
11217
  }, [onUpdate]);
10939
- const handleCollapse = useCallback34((e) => {
11218
+ const handleCollapse = useCallback35((e) => {
10940
11219
  e.stopPropagation();
10941
11220
  setIsExpanded(false);
10942
11221
  onEndEdit?.();
10943
11222
  }, [onEndEdit]);
10944
11223
  if (!isExpanded) {
10945
- return /* @__PURE__ */ jsx30(
11224
+ return /* @__PURE__ */ jsx31(
10946
11225
  "div",
10947
11226
  {
10948
11227
  ref: noteRef,
@@ -10963,14 +11242,14 @@ var StickyNote = memo29(function StickyNote2({
10963
11242
  onMouseDown: onDragStart,
10964
11243
  onTouchStart: onDragStart,
10965
11244
  title: note.content || "Empty note",
10966
- children: /* @__PURE__ */ jsx30(
11245
+ children: /* @__PURE__ */ jsx31(
10967
11246
  "svg",
10968
11247
  {
10969
11248
  className: "w-4 h-4 opacity-70",
10970
11249
  fill: "currentColor",
10971
11250
  viewBox: "0 0 20 20",
10972
11251
  style: { color: "#333" },
10973
- children: /* @__PURE__ */ jsx30(
11252
+ children: /* @__PURE__ */ jsx31(
10974
11253
  "path",
10975
11254
  {
10976
11255
  fillRule: "evenodd",
@@ -10983,7 +11262,7 @@ var StickyNote = memo29(function StickyNote2({
10983
11262
  }
10984
11263
  );
10985
11264
  }
10986
- return /* @__PURE__ */ jsxs26(
11265
+ return /* @__PURE__ */ jsxs27(
10987
11266
  "div",
10988
11267
  {
10989
11268
  ref: noteRef,
@@ -11001,14 +11280,14 @@ var StickyNote = memo29(function StickyNote2({
11001
11280
  },
11002
11281
  onClick: handleClick,
11003
11282
  children: [
11004
- /* @__PURE__ */ jsxs26(
11283
+ /* @__PURE__ */ jsxs27(
11005
11284
  "div",
11006
11285
  {
11007
11286
  className: "flex items-center justify-between px-2 py-1 border-b border-black/10 cursor-move",
11008
11287
  onMouseDown: onDragStart,
11009
11288
  onTouchStart: onDragStart,
11010
11289
  children: [
11011
- /* @__PURE__ */ jsx30("div", { className: "flex gap-1", children: NOTE_COLORS.map((color) => /* @__PURE__ */ jsx30(
11290
+ /* @__PURE__ */ jsx31("div", { className: "flex gap-1", children: NOTE_COLORS.map((color) => /* @__PURE__ */ jsx31(
11012
11291
  "button",
11013
11292
  {
11014
11293
  className: cn(
@@ -11025,8 +11304,8 @@ var StickyNote = memo29(function StickyNote2({
11025
11304
  },
11026
11305
  color
11027
11306
  )) }),
11028
- /* @__PURE__ */ jsxs26("div", { className: "flex gap-1", children: [
11029
- /* @__PURE__ */ jsx30(
11307
+ /* @__PURE__ */ jsxs27("div", { className: "flex gap-1", children: [
11308
+ /* @__PURE__ */ jsx31(
11030
11309
  "button",
11031
11310
  {
11032
11311
  className: "p-0.5 hover:bg-black/10 rounded",
@@ -11035,23 +11314,23 @@ var StickyNote = memo29(function StickyNote2({
11035
11314
  onDelete?.();
11036
11315
  },
11037
11316
  title: "Delete note",
11038
- children: /* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx30("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) })
11317
+ children: /* @__PURE__ */ jsx31("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx31("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) })
11039
11318
  }
11040
11319
  ),
11041
- /* @__PURE__ */ jsx30(
11320
+ /* @__PURE__ */ jsx31(
11042
11321
  "button",
11043
11322
  {
11044
11323
  className: "p-0.5 hover:bg-black/10 rounded",
11045
11324
  onClick: handleCollapse,
11046
11325
  title: "Collapse note",
11047
- children: /* @__PURE__ */ jsx30("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx30("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
11326
+ children: /* @__PURE__ */ jsx31("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx31("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
11048
11327
  }
11049
11328
  )
11050
11329
  ] })
11051
11330
  ]
11052
11331
  }
11053
11332
  ),
11054
- /* @__PURE__ */ jsx30("div", { className: "p-2", children: isEditing ? /* @__PURE__ */ jsx30(
11333
+ /* @__PURE__ */ jsx31("div", { className: "p-2", children: isEditing ? /* @__PURE__ */ jsx31(
11055
11334
  "textarea",
11056
11335
  {
11057
11336
  ref: textareaRef,
@@ -11066,7 +11345,7 @@ var StickyNote = memo29(function StickyNote2({
11066
11345
  onKeyDown: handleKeyDown,
11067
11346
  placeholder: "Enter note..."
11068
11347
  }
11069
- ) : /* @__PURE__ */ jsx30(
11348
+ ) : /* @__PURE__ */ jsx31(
11070
11349
  "div",
11071
11350
  {
11072
11351
  className: cn(
@@ -11077,7 +11356,7 @@ var StickyNote = memo29(function StickyNote2({
11077
11356
  children: note.content || "Double-click to edit..."
11078
11357
  }
11079
11358
  ) }),
11080
- /* @__PURE__ */ jsx30("div", { className: "px-2 pb-1 text-[10px] text-gray-500", children: new Date(note.updatedAt).toLocaleDateString() })
11359
+ /* @__PURE__ */ jsx31("div", { className: "px-2 pb-1 text-[10px] text-gray-500", children: new Date(note.updatedAt).toLocaleDateString() })
11081
11360
  ]
11082
11361
  }
11083
11362
  );
@@ -11085,8 +11364,8 @@ var StickyNote = memo29(function StickyNote2({
11085
11364
 
11086
11365
  // src/components/Annotations/DrawingCanvas.tsx
11087
11366
  init_utils();
11088
- import { memo as memo30, useRef as useRef21, useCallback as useCallback35, useState as useState23 } from "react";
11089
- import { jsx as jsx31 } from "react/jsx-runtime";
11367
+ import { memo as memo31, useRef as useRef22, useCallback as useCallback36, useState as useState24 } from "react";
11368
+ import { jsx as jsx32 } from "react/jsx-runtime";
11090
11369
  function pointsToSvgPath(points) {
11091
11370
  if (points.length === 0) return "";
11092
11371
  if (points.length === 1) {
@@ -11124,7 +11403,7 @@ function simplifyPath(points, tolerance = 1) {
11124
11403
  result.push(points[points.length - 1]);
11125
11404
  return result;
11126
11405
  }
11127
- var DrawingCanvas = memo30(function DrawingCanvas2({
11406
+ var DrawingCanvas = memo31(function DrawingCanvas2({
11128
11407
  width,
11129
11408
  height,
11130
11409
  scale,
@@ -11134,10 +11413,10 @@ var DrawingCanvas = memo30(function DrawingCanvas2({
11134
11413
  onDrawingComplete,
11135
11414
  className
11136
11415
  }) {
11137
- const svgRef = useRef21(null);
11138
- const [isDrawing, setIsDrawing] = useState23(false);
11139
- const [currentPath, setCurrentPath] = useState23([]);
11140
- const getPoint = useCallback35((e) => {
11416
+ const svgRef = useRef22(null);
11417
+ const [isDrawing, setIsDrawing] = useState24(false);
11418
+ const [currentPath, setCurrentPath] = useState24([]);
11419
+ const getPoint = useCallback36((e) => {
11141
11420
  if (!svgRef.current) return null;
11142
11421
  const svg = svgRef.current;
11143
11422
  const rect = svg.getBoundingClientRect();
@@ -11157,7 +11436,7 @@ var DrawingCanvas = memo30(function DrawingCanvas2({
11157
11436
  y: (clientY - rect.top) / scale
11158
11437
  };
11159
11438
  }, [scale]);
11160
- const handleStart = useCallback35((e) => {
11439
+ const handleStart = useCallback36((e) => {
11161
11440
  if (!isActive) return;
11162
11441
  const point = getPoint(e);
11163
11442
  if (point) {
@@ -11165,14 +11444,14 @@ var DrawingCanvas = memo30(function DrawingCanvas2({
11165
11444
  setCurrentPath([point]);
11166
11445
  }
11167
11446
  }, [isActive, getPoint]);
11168
- const handleMove = useCallback35((e) => {
11447
+ const handleMove = useCallback36((e) => {
11169
11448
  if (!isDrawing || !isActive) return;
11170
11449
  const point = getPoint(e);
11171
11450
  if (point) {
11172
11451
  setCurrentPath((prev) => [...prev, point]);
11173
11452
  }
11174
11453
  }, [isDrawing, isActive, getPoint]);
11175
- const handleEnd = useCallback35(() => {
11454
+ const handleEnd = useCallback36(() => {
11176
11455
  if (!isDrawing) return;
11177
11456
  setIsDrawing(false);
11178
11457
  if (currentPath.length >= 2) {
@@ -11181,7 +11460,7 @@ var DrawingCanvas = memo30(function DrawingCanvas2({
11181
11460
  }
11182
11461
  setCurrentPath([]);
11183
11462
  }, [isDrawing, currentPath, onDrawingComplete]);
11184
- return /* @__PURE__ */ jsx31(
11463
+ return /* @__PURE__ */ jsx32(
11185
11464
  "svg",
11186
11465
  {
11187
11466
  ref: svgRef,
@@ -11201,7 +11480,7 @@ var DrawingCanvas = memo30(function DrawingCanvas2({
11201
11480
  onTouchStart: handleStart,
11202
11481
  onTouchMove: handleMove,
11203
11482
  onTouchEnd: handleEnd,
11204
- children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ jsx31(
11483
+ children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ jsx32(
11205
11484
  "path",
11206
11485
  {
11207
11486
  d: pointsToSvgPath(currentPath),
@@ -11219,9 +11498,9 @@ var DrawingCanvas = memo30(function DrawingCanvas2({
11219
11498
 
11220
11499
  // src/components/Annotations/ShapeRenderer.tsx
11221
11500
  init_utils();
11222
- import { memo as memo31, useCallback as useCallback36, useState as useState24, useRef as useRef22 } from "react";
11223
- import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
11224
- var ShapeRenderer = memo31(function ShapeRenderer2({
11501
+ import { memo as memo32, useCallback as useCallback37, useState as useState25, useRef as useRef23 } from "react";
11502
+ import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
11503
+ var ShapeRenderer = memo32(function ShapeRenderer2({
11225
11504
  shape,
11226
11505
  scale,
11227
11506
  isSelected,
@@ -11231,18 +11510,18 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11231
11510
  onDelete: _onDelete,
11232
11511
  className
11233
11512
  }) {
11234
- const [_isDragging, setIsDragging] = useState24(false);
11235
- const [_isResizing, setIsResizing] = useState24(false);
11236
- const [activeHandle, setActiveHandle] = useState24(null);
11237
- const startPosRef = useRef22({ x: 0, y: 0 });
11238
- const startShapeRef = useRef22({ x: 0, y: 0, width: 0, height: 0 });
11513
+ const [_isDragging, setIsDragging] = useState25(false);
11514
+ const [_isResizing, setIsResizing] = useState25(false);
11515
+ const [activeHandle, setActiveHandle] = useState25(null);
11516
+ const startPosRef = useRef23({ x: 0, y: 0 });
11517
+ const startShapeRef = useRef23({ x: 0, y: 0, width: 0, height: 0 });
11239
11518
  const { shapeType, x, y, width, height, color, strokeWidth, id: _id } = shape;
11240
11519
  const scaledX = x * scale;
11241
11520
  const scaledY = y * scale;
11242
11521
  const scaledWidth = width * scale;
11243
11522
  const scaledHeight = height * scale;
11244
11523
  const scaledStroke = strokeWidth * scale;
11245
- const getResizeHandles = useCallback36(() => {
11524
+ const getResizeHandles = useCallback37(() => {
11246
11525
  const handleSize = 8;
11247
11526
  const half = handleSize / 2;
11248
11527
  return [
@@ -11256,7 +11535,7 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11256
11535
  { position: "w", cursor: "ew-resize", x: scaledX - half, y: scaledY + scaledHeight / 2 - half }
11257
11536
  ];
11258
11537
  }, [scaledX, scaledY, scaledWidth, scaledHeight]);
11259
- const handleMouseDown = useCallback36((e, handle) => {
11538
+ const handleMouseDown = useCallback37((e, handle) => {
11260
11539
  e.stopPropagation();
11261
11540
  onSelect?.();
11262
11541
  if (!isEditing) return;
@@ -11332,7 +11611,7 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11332
11611
  document.addEventListener("mousemove", handleMouseMove);
11333
11612
  document.addEventListener("mouseup", handleMouseUp);
11334
11613
  }, [isEditing, x, y, width, height, scale, onSelect, onUpdate]);
11335
- const renderShape2 = useCallback36(() => {
11614
+ const renderShape2 = useCallback37(() => {
11336
11615
  const commonProps = {
11337
11616
  stroke: color,
11338
11617
  strokeWidth: scaledStroke,
@@ -11344,7 +11623,7 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11344
11623
  };
11345
11624
  switch (shapeType) {
11346
11625
  case "rect":
11347
- return /* @__PURE__ */ jsx32(
11626
+ return /* @__PURE__ */ jsx33(
11348
11627
  "rect",
11349
11628
  {
11350
11629
  x: scaledX,
@@ -11355,7 +11634,7 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11355
11634
  }
11356
11635
  );
11357
11636
  case "circle":
11358
- return /* @__PURE__ */ jsx32(
11637
+ return /* @__PURE__ */ jsx33(
11359
11638
  "ellipse",
11360
11639
  {
11361
11640
  cx: scaledX + scaledWidth / 2,
@@ -11366,7 +11645,7 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11366
11645
  }
11367
11646
  );
11368
11647
  case "line":
11369
- return /* @__PURE__ */ jsx32(
11648
+ return /* @__PURE__ */ jsx33(
11370
11649
  "line",
11371
11650
  {
11372
11651
  x1: scaledX,
@@ -11386,22 +11665,22 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11386
11665
  const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
11387
11666
  const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
11388
11667
  const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
11389
- return /* @__PURE__ */ jsxs27("g", { children: [
11390
- /* @__PURE__ */ jsx32("line", { x1: scaledX, y1: scaledY, x2: endX, y2: endY, ...commonProps }),
11391
- /* @__PURE__ */ jsx32("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
11392
- /* @__PURE__ */ jsx32("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
11668
+ return /* @__PURE__ */ jsxs28("g", { children: [
11669
+ /* @__PURE__ */ jsx33("line", { x1: scaledX, y1: scaledY, x2: endX, y2: endY, ...commonProps }),
11670
+ /* @__PURE__ */ jsx33("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
11671
+ /* @__PURE__ */ jsx33("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
11393
11672
  ] });
11394
11673
  default:
11395
11674
  return null;
11396
11675
  }
11397
11676
  }, [shapeType, scaledX, scaledY, scaledWidth, scaledHeight, color, scaledStroke, isSelected]);
11398
- return /* @__PURE__ */ jsxs27(
11677
+ return /* @__PURE__ */ jsxs28(
11399
11678
  "g",
11400
11679
  {
11401
11680
  className: cn("shape-renderer", className),
11402
11681
  onMouseDown: (e) => handleMouseDown(e),
11403
11682
  children: [
11404
- /* @__PURE__ */ jsx32(
11683
+ /* @__PURE__ */ jsx33(
11405
11684
  "rect",
11406
11685
  {
11407
11686
  x: scaledX - 5,
@@ -11414,7 +11693,7 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11414
11693
  }
11415
11694
  ),
11416
11695
  renderShape2(),
11417
- isSelected && /* @__PURE__ */ jsx32(
11696
+ isSelected && /* @__PURE__ */ jsx33(
11418
11697
  "rect",
11419
11698
  {
11420
11699
  x: scaledX - 2,
@@ -11427,7 +11706,7 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11427
11706
  strokeDasharray: "4 2"
11428
11707
  }
11429
11708
  ),
11430
- isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ jsx32(
11709
+ isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ jsx33(
11431
11710
  "rect",
11432
11711
  {
11433
11712
  x: handle.x,
@@ -11447,7 +11726,7 @@ var ShapeRenderer = memo31(function ShapeRenderer2({
11447
11726
  }
11448
11727
  );
11449
11728
  });
11450
- var ShapePreview = memo31(function ShapePreview2({
11729
+ var ShapePreview = memo32(function ShapePreview2({
11451
11730
  shapeType,
11452
11731
  startPoint,
11453
11732
  endPoint,
@@ -11468,9 +11747,9 @@ var ShapePreview = memo31(function ShapePreview2({
11468
11747
  };
11469
11748
  switch (shapeType) {
11470
11749
  case "rect":
11471
- return /* @__PURE__ */ jsx32("rect", { x, y, width, height, ...commonProps });
11750
+ return /* @__PURE__ */ jsx33("rect", { x, y, width, height, ...commonProps });
11472
11751
  case "circle":
11473
- return /* @__PURE__ */ jsx32(
11752
+ return /* @__PURE__ */ jsx33(
11474
11753
  "ellipse",
11475
11754
  {
11476
11755
  cx: x + width / 2,
@@ -11481,7 +11760,7 @@ var ShapePreview = memo31(function ShapePreview2({
11481
11760
  }
11482
11761
  );
11483
11762
  case "line":
11484
- return /* @__PURE__ */ jsx32(
11763
+ return /* @__PURE__ */ jsx33(
11485
11764
  "line",
11486
11765
  {
11487
11766
  x1: startPoint.x * scale,
@@ -11503,8 +11782,8 @@ var ShapePreview = memo31(function ShapePreview2({
11503
11782
  const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
11504
11783
  const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
11505
11784
  const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
11506
- return /* @__PURE__ */ jsxs27("g", { children: [
11507
- /* @__PURE__ */ jsx32(
11785
+ return /* @__PURE__ */ jsxs28("g", { children: [
11786
+ /* @__PURE__ */ jsx33(
11508
11787
  "line",
11509
11788
  {
11510
11789
  x1: startPoint.x * scale,
@@ -11514,8 +11793,8 @@ var ShapePreview = memo31(function ShapePreview2({
11514
11793
  ...commonProps
11515
11794
  }
11516
11795
  ),
11517
- /* @__PURE__ */ jsx32("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
11518
- /* @__PURE__ */ jsx32("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
11796
+ /* @__PURE__ */ jsx33("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
11797
+ /* @__PURE__ */ jsx33("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
11519
11798
  ] });
11520
11799
  default:
11521
11800
  return null;
@@ -11524,9 +11803,9 @@ var ShapePreview = memo31(function ShapePreview2({
11524
11803
 
11525
11804
  // src/components/Annotations/QuickNoteButton.tsx
11526
11805
  init_utils();
11527
- import { memo as memo32, useCallback as useCallback37, useState as useState25 } from "react";
11528
- import { jsx as jsx33 } from "react/jsx-runtime";
11529
- var QuickNoteButton = memo32(function QuickNoteButton2({
11806
+ import { memo as memo33, useCallback as useCallback38, useState as useState26 } from "react";
11807
+ import { jsx as jsx34 } from "react/jsx-runtime";
11808
+ var QuickNoteButton = memo33(function QuickNoteButton2({
11530
11809
  pageNumber,
11531
11810
  scale,
11532
11811
  position = "top-right",
@@ -11534,8 +11813,8 @@ var QuickNoteButton = memo32(function QuickNoteButton2({
11534
11813
  className,
11535
11814
  visible = true
11536
11815
  }) {
11537
- const [isHovered, setIsHovered] = useState25(false);
11538
- const handleClick = useCallback37(
11816
+ const [isHovered, setIsHovered] = useState26(false);
11817
+ const handleClick = useCallback38(
11539
11818
  (e) => {
11540
11819
  e.stopPropagation();
11541
11820
  const x = position === "top-right" ? 80 : 80;
@@ -11547,7 +11826,7 @@ var QuickNoteButton = memo32(function QuickNoteButton2({
11547
11826
  if (!visible) {
11548
11827
  return null;
11549
11828
  }
11550
- return /* @__PURE__ */ jsx33(
11829
+ return /* @__PURE__ */ jsx34(
11551
11830
  "button",
11552
11831
  {
11553
11832
  onClick: handleClick,
@@ -11569,7 +11848,7 @@ var QuickNoteButton = memo32(function QuickNoteButton2({
11569
11848
  ),
11570
11849
  title: "Add quick note",
11571
11850
  "aria-label": "Add quick note",
11572
- children: /* @__PURE__ */ jsx33(
11851
+ children: /* @__PURE__ */ jsx34(
11573
11852
  "svg",
11574
11853
  {
11575
11854
  className: "w-4 h-4 text-yellow-900",
@@ -11577,7 +11856,7 @@ var QuickNoteButton = memo32(function QuickNoteButton2({
11577
11856
  viewBox: "0 0 24 24",
11578
11857
  stroke: "currentColor",
11579
11858
  strokeWidth: 2,
11580
- children: /* @__PURE__ */ jsx33("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4v16m8-8H4" })
11859
+ children: /* @__PURE__ */ jsx34("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4v16m8-8H4" })
11581
11860
  }
11582
11861
  )
11583
11862
  }
@@ -11586,9 +11865,9 @@ var QuickNoteButton = memo32(function QuickNoteButton2({
11586
11865
 
11587
11866
  // src/components/Annotations/QuickNotePopover.tsx
11588
11867
  init_utils();
11589
- import { memo as memo33, useCallback as useCallback38, useState as useState26, useRef as useRef23, useEffect as useEffect24 } from "react";
11590
- import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
11591
- var QuickNotePopover = memo33(function QuickNotePopover2({
11868
+ import { memo as memo34, useCallback as useCallback39, useState as useState27, useRef as useRef24, useEffect as useEffect25 } from "react";
11869
+ import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
11870
+ var QuickNotePopover = memo34(function QuickNotePopover2({
11592
11871
  visible,
11593
11872
  position,
11594
11873
  initialContent = "",
@@ -11597,21 +11876,21 @@ var QuickNotePopover = memo33(function QuickNotePopover2({
11597
11876
  onCancel,
11598
11877
  className
11599
11878
  }) {
11600
- const [content, setContent] = useState26(initialContent);
11601
- const textareaRef = useRef23(null);
11602
- const popoverRef = useRef23(null);
11603
- const [adjustedPosition, setAdjustedPosition] = useState26(position);
11604
- useEffect24(() => {
11879
+ const [content, setContent] = useState27(initialContent);
11880
+ const textareaRef = useRef24(null);
11881
+ const popoverRef = useRef24(null);
11882
+ const [adjustedPosition, setAdjustedPosition] = useState27(position);
11883
+ useEffect25(() => {
11605
11884
  if (visible && textareaRef.current) {
11606
11885
  textareaRef.current.focus();
11607
11886
  }
11608
11887
  }, [visible]);
11609
- useEffect24(() => {
11888
+ useEffect25(() => {
11610
11889
  if (visible) {
11611
11890
  setContent(initialContent);
11612
11891
  }
11613
11892
  }, [visible, initialContent]);
11614
- useEffect24(() => {
11893
+ useEffect25(() => {
11615
11894
  if (!visible || !popoverRef.current) return;
11616
11895
  const rect = popoverRef.current.getBoundingClientRect();
11617
11896
  const padding = 10;
@@ -11630,14 +11909,14 @@ var QuickNotePopover = memo33(function QuickNotePopover2({
11630
11909
  }
11631
11910
  setAdjustedPosition({ x, y });
11632
11911
  }, [position, visible]);
11633
- const handleSave = useCallback38(() => {
11912
+ const handleSave = useCallback39(() => {
11634
11913
  if (content.trim()) {
11635
11914
  onSave(content.trim());
11636
11915
  } else {
11637
11916
  onCancel();
11638
11917
  }
11639
11918
  }, [content, onSave, onCancel]);
11640
- const handleKeyDown = useCallback38(
11919
+ const handleKeyDown = useCallback39(
11641
11920
  (e) => {
11642
11921
  if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
11643
11922
  e.preventDefault();
@@ -11652,7 +11931,7 @@ var QuickNotePopover = memo33(function QuickNotePopover2({
11652
11931
  if (!visible) {
11653
11932
  return null;
11654
11933
  }
11655
- return /* @__PURE__ */ jsxs28(
11934
+ return /* @__PURE__ */ jsxs29(
11656
11935
  "div",
11657
11936
  {
11658
11937
  ref: popoverRef,
@@ -11671,15 +11950,15 @@ var QuickNotePopover = memo33(function QuickNotePopover2({
11671
11950
  top: adjustedPosition.y
11672
11951
  },
11673
11952
  children: [
11674
- agentLastStatement && /* @__PURE__ */ jsx34("div", { className: "mb-2 p-2 bg-blue-50 dark:bg-blue-900/50 rounded text-xs text-blue-600 dark:text-blue-300 border border-blue-100 dark:border-blue-800", children: /* @__PURE__ */ jsxs28("div", { className: "flex items-start gap-1", children: [
11675
- /* @__PURE__ */ jsx34("svg", { className: "w-3 h-3 mt-0.5 flex-shrink-0", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx34("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }),
11676
- /* @__PURE__ */ jsxs28("span", { className: "line-clamp-2", children: [
11953
+ agentLastStatement && /* @__PURE__ */ jsx35("div", { className: "mb-2 p-2 bg-blue-50 dark:bg-blue-900/50 rounded text-xs text-blue-600 dark:text-blue-300 border border-blue-100 dark:border-blue-800", children: /* @__PURE__ */ jsxs29("div", { className: "flex items-start gap-1", children: [
11954
+ /* @__PURE__ */ jsx35("svg", { className: "w-3 h-3 mt-0.5 flex-shrink-0", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx35("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }),
11955
+ /* @__PURE__ */ jsxs29("span", { className: "line-clamp-2", children: [
11677
11956
  "AI discussed: \u201C",
11678
11957
  agentLastStatement,
11679
11958
  "\u201D"
11680
11959
  ] })
11681
11960
  ] }) }),
11682
- /* @__PURE__ */ jsx34(
11961
+ /* @__PURE__ */ jsx35(
11683
11962
  "textarea",
11684
11963
  {
11685
11964
  ref: textareaRef,
@@ -11698,13 +11977,13 @@ var QuickNotePopover = memo33(function QuickNotePopover2({
11698
11977
  )
11699
11978
  }
11700
11979
  ),
11701
- /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between mt-2", children: [
11702
- /* @__PURE__ */ jsxs28("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
11980
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between mt-2", children: [
11981
+ /* @__PURE__ */ jsxs29("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
11703
11982
  navigator.platform.includes("Mac") ? "\u2318" : "Ctrl",
11704
11983
  "+Enter to save"
11705
11984
  ] }),
11706
- /* @__PURE__ */ jsxs28("div", { className: "flex gap-2", children: [
11707
- /* @__PURE__ */ jsx34(
11985
+ /* @__PURE__ */ jsxs29("div", { className: "flex gap-2", children: [
11986
+ /* @__PURE__ */ jsx35(
11708
11987
  "button",
11709
11988
  {
11710
11989
  onClick: onCancel,
@@ -11717,7 +11996,7 @@ var QuickNotePopover = memo33(function QuickNotePopover2({
11717
11996
  children: "Cancel"
11718
11997
  }
11719
11998
  ),
11720
- /* @__PURE__ */ jsx34(
11999
+ /* @__PURE__ */ jsx35(
11721
12000
  "button",
11722
12001
  {
11723
12002
  onClick: handleSave,
@@ -11741,9 +12020,9 @@ var QuickNotePopover = memo33(function QuickNotePopover2({
11741
12020
 
11742
12021
  // src/components/AskAbout/AskAboutOverlay.tsx
11743
12022
  init_utils();
11744
- import { memo as memo34 } from "react";
11745
- import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
11746
- var AskAboutOverlay = memo34(function AskAboutOverlay2({
12023
+ import { memo as memo35 } from "react";
12024
+ import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
12025
+ var AskAboutOverlay = memo35(function AskAboutOverlay2({
11747
12026
  visible,
11748
12027
  progress,
11749
12028
  position,
@@ -11757,7 +12036,7 @@ var AskAboutOverlay = memo34(function AskAboutOverlay2({
11757
12036
  const radius = (size - strokeWidth) / 2;
11758
12037
  const circumference = 2 * Math.PI * radius;
11759
12038
  const strokeDashoffset = circumference * (1 - progress);
11760
- return /* @__PURE__ */ jsxs29(
12039
+ return /* @__PURE__ */ jsxs30(
11761
12040
  "div",
11762
12041
  {
11763
12042
  className: cn(
@@ -11770,7 +12049,7 @@ var AskAboutOverlay = memo34(function AskAboutOverlay2({
11770
12049
  top: position.y - size / 2
11771
12050
  },
11772
12051
  children: [
11773
- /* @__PURE__ */ jsxs29(
12052
+ /* @__PURE__ */ jsxs30(
11774
12053
  "svg",
11775
12054
  {
11776
12055
  width: size,
@@ -11778,7 +12057,7 @@ var AskAboutOverlay = memo34(function AskAboutOverlay2({
11778
12057
  viewBox: `0 0 ${size} ${size}`,
11779
12058
  className: "transform -rotate-90",
11780
12059
  children: [
11781
- /* @__PURE__ */ jsx35(
12060
+ /* @__PURE__ */ jsx36(
11782
12061
  "circle",
11783
12062
  {
11784
12063
  cx: size / 2,
@@ -11789,7 +12068,7 @@ var AskAboutOverlay = memo34(function AskAboutOverlay2({
11789
12068
  strokeWidth
11790
12069
  }
11791
12070
  ),
11792
- /* @__PURE__ */ jsx35(
12071
+ /* @__PURE__ */ jsx36(
11793
12072
  "circle",
11794
12073
  {
11795
12074
  cx: size / 2,
@@ -11807,12 +12086,12 @@ var AskAboutOverlay = memo34(function AskAboutOverlay2({
11807
12086
  ]
11808
12087
  }
11809
12088
  ),
11810
- /* @__PURE__ */ jsx35(
12089
+ /* @__PURE__ */ jsx36(
11811
12090
  "div",
11812
12091
  {
11813
12092
  className: "absolute inset-0 flex items-center justify-center",
11814
12093
  style: { color: progress >= 1 ? "#22c55e" : "white" },
11815
- children: progress >= 1 ? /* @__PURE__ */ jsx35(
12094
+ children: progress >= 1 ? /* @__PURE__ */ jsx36(
11816
12095
  "svg",
11817
12096
  {
11818
12097
  width: "24",
@@ -11823,9 +12102,9 @@ var AskAboutOverlay = memo34(function AskAboutOverlay2({
11823
12102
  strokeWidth: "2",
11824
12103
  strokeLinecap: "round",
11825
12104
  strokeLinejoin: "round",
11826
- children: /* @__PURE__ */ jsx35("polyline", { points: "20 6 9 17 4 12" })
12105
+ children: /* @__PURE__ */ jsx36("polyline", { points: "20 6 9 17 4 12" })
11827
12106
  }
11828
- ) : /* @__PURE__ */ jsxs29(
12107
+ ) : /* @__PURE__ */ jsxs30(
11829
12108
  "svg",
11830
12109
  {
11831
12110
  width: "20",
@@ -11837,9 +12116,9 @@ var AskAboutOverlay = memo34(function AskAboutOverlay2({
11837
12116
  strokeLinecap: "round",
11838
12117
  strokeLinejoin: "round",
11839
12118
  children: [
11840
- /* @__PURE__ */ jsx35("circle", { cx: "12", cy: "12", r: "10" }),
11841
- /* @__PURE__ */ jsx35("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
11842
- /* @__PURE__ */ jsx35("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
12119
+ /* @__PURE__ */ jsx36("circle", { cx: "12", cy: "12", r: "10" }),
12120
+ /* @__PURE__ */ jsx36("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
12121
+ /* @__PURE__ */ jsx36("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
11843
12122
  ]
11844
12123
  }
11845
12124
  )
@@ -11852,9 +12131,9 @@ var AskAboutOverlay = memo34(function AskAboutOverlay2({
11852
12131
 
11853
12132
  // src/components/AskAbout/AskAboutTrigger.tsx
11854
12133
  init_utils();
11855
- import { memo as memo35, useCallback as useCallback39, useState as useState27, useRef as useRef24, useEffect as useEffect25 } from "react";
11856
- import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
11857
- var AskAboutTrigger = memo35(function AskAboutTrigger2({
12134
+ import { memo as memo36, useCallback as useCallback40, useState as useState28, useRef as useRef25, useEffect as useEffect26 } from "react";
12135
+ import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
12136
+ var AskAboutTrigger = memo36(function AskAboutTrigger2({
11858
12137
  position,
11859
12138
  onConfirm,
11860
12139
  onCancel,
@@ -11862,9 +12141,9 @@ var AskAboutTrigger = memo35(function AskAboutTrigger2({
11862
12141
  autoHideDelay = 5e3,
11863
12142
  className
11864
12143
  }) {
11865
- const [adjustedPosition, setAdjustedPosition] = useState27(position);
11866
- const triggerRef = useRef24(null);
11867
- useEffect25(() => {
12144
+ const [adjustedPosition, setAdjustedPosition] = useState28(position);
12145
+ const triggerRef = useRef25(null);
12146
+ useEffect26(() => {
11868
12147
  if (!visible || !triggerRef.current) return;
11869
12148
  const rect = triggerRef.current.getBoundingClientRect();
11870
12149
  const padding = 10;
@@ -11880,19 +12159,19 @@ var AskAboutTrigger = memo35(function AskAboutTrigger2({
11880
12159
  }
11881
12160
  setAdjustedPosition({ x, y });
11882
12161
  }, [position, visible]);
11883
- useEffect25(() => {
12162
+ useEffect26(() => {
11884
12163
  if (!visible || autoHideDelay === 0) return;
11885
12164
  const timer = setTimeout(onCancel, autoHideDelay);
11886
12165
  return () => clearTimeout(timer);
11887
12166
  }, [visible, autoHideDelay, onCancel]);
11888
- const handleConfirm = useCallback39(
12167
+ const handleConfirm = useCallback40(
11889
12168
  (e) => {
11890
12169
  e.stopPropagation();
11891
12170
  onConfirm();
11892
12171
  },
11893
12172
  [onConfirm]
11894
12173
  );
11895
- const handleCancel = useCallback39(
12174
+ const handleCancel = useCallback40(
11896
12175
  (e) => {
11897
12176
  e.stopPropagation();
11898
12177
  onCancel();
@@ -11902,7 +12181,7 @@ var AskAboutTrigger = memo35(function AskAboutTrigger2({
11902
12181
  if (!visible) {
11903
12182
  return null;
11904
12183
  }
11905
- return /* @__PURE__ */ jsxs30(
12184
+ return /* @__PURE__ */ jsxs31(
11906
12185
  "div",
11907
12186
  {
11908
12187
  ref: triggerRef,
@@ -11921,8 +12200,8 @@ var AskAboutTrigger = memo35(function AskAboutTrigger2({
11921
12200
  transform: "translate(-50%, 0)"
11922
12201
  },
11923
12202
  children: [
11924
- /* @__PURE__ */ jsx36("span", { className: "text-sm text-gray-600 dark:text-gray-300 px-2", children: "Ask about this?" }),
11925
- /* @__PURE__ */ jsx36(
12203
+ /* @__PURE__ */ jsx37("span", { className: "text-sm text-gray-600 dark:text-gray-300 px-2", children: "Ask about this?" }),
12204
+ /* @__PURE__ */ jsx37(
11926
12205
  "button",
11927
12206
  {
11928
12207
  onClick: handleConfirm,
@@ -11935,7 +12214,7 @@ var AskAboutTrigger = memo35(function AskAboutTrigger2({
11935
12214
  children: "Ask"
11936
12215
  }
11937
12216
  ),
11938
- /* @__PURE__ */ jsx36(
12217
+ /* @__PURE__ */ jsx37(
11939
12218
  "button",
11940
12219
  {
11941
12220
  onClick: handleCancel,
@@ -11957,9 +12236,9 @@ var AskAboutTrigger = memo35(function AskAboutTrigger2({
11957
12236
  // src/components/Minimap/Minimap.tsx
11958
12237
  init_hooks();
11959
12238
  init_utils();
11960
- import { memo as memo36, useMemo as useMemo14, useCallback as useCallback40 } from "react";
11961
- import { Fragment as Fragment3, jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
11962
- var PageIndicator = memo36(function PageIndicator2({
12239
+ import { memo as memo37, useMemo as useMemo14, useCallback as useCallback41 } from "react";
12240
+ import { Fragment as Fragment3, jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
12241
+ var PageIndicator = memo37(function PageIndicator2({
11963
12242
  pageNumber,
11964
12243
  status,
11965
12244
  isBookmarked,
@@ -11973,7 +12252,7 @@ var PageIndicator = memo36(function PageIndicator2({
11973
12252
  if (status === "visited") return "bg-green-400";
11974
12253
  return "bg-gray-200 dark:bg-gray-700";
11975
12254
  };
11976
- return /* @__PURE__ */ jsxs31(
12255
+ return /* @__PURE__ */ jsxs32(
11977
12256
  "button",
11978
12257
  {
11979
12258
  onClick,
@@ -11989,13 +12268,13 @@ var PageIndicator = memo36(function PageIndicator2({
11989
12268
  title: `Page ${pageNumber}${isBookmarked ? " (bookmarked)" : ""}`,
11990
12269
  "aria-label": `Go to page ${pageNumber}`,
11991
12270
  children: [
11992
- isBookmarked && !compact && /* @__PURE__ */ jsx37("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-yellow-500 rounded-full border border-white" }),
11993
- showNumber && !compact && /* @__PURE__ */ jsx37("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-medium text-white", children: pageNumber })
12271
+ isBookmarked && !compact && /* @__PURE__ */ jsx38("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-yellow-500 rounded-full border border-white" }),
12272
+ showNumber && !compact && /* @__PURE__ */ jsx38("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-medium text-white", children: pageNumber })
11994
12273
  ]
11995
12274
  }
11996
12275
  );
11997
12276
  });
11998
- var Minimap = memo36(function Minimap2({
12277
+ var Minimap = memo37(function Minimap2({
11999
12278
  variant = "sidebar",
12000
12279
  floatingPosition = "right",
12001
12280
  maxHeight = 300,
@@ -12012,14 +12291,14 @@ var Minimap = memo36(function Minimap2({
12012
12291
  return new Set(bookmarks.map((b) => b.pageNumber));
12013
12292
  }, [bookmarks]);
12014
12293
  const compact = numPages > 50;
12015
- const handlePageClick = useCallback40(
12294
+ const handlePageClick = useCallback41(
12016
12295
  (pageNumber) => {
12017
12296
  goToPage(pageNumber);
12018
12297
  onPageClick?.(pageNumber);
12019
12298
  },
12020
12299
  [goToPage, onPageClick]
12021
12300
  );
12022
- const getPageStatus = useCallback40(
12301
+ const getPageStatus = useCallback41(
12023
12302
  (pageNumber) => {
12024
12303
  if (pageNumber === currentPage) return "current";
12025
12304
  if (bookmarkedPages.has(pageNumber)) return "bookmarked";
@@ -12032,7 +12311,7 @@ var Minimap = memo36(function Minimap2({
12032
12311
  const pages = [];
12033
12312
  for (let i = 1; i <= numPages; i++) {
12034
12313
  pages.push(
12035
- /* @__PURE__ */ jsx37(
12314
+ /* @__PURE__ */ jsx38(
12036
12315
  PageIndicator,
12037
12316
  {
12038
12317
  pageNumber: i,
@@ -12053,16 +12332,16 @@ var Minimap = memo36(function Minimap2({
12053
12332
  if (numPages === 0) {
12054
12333
  return null;
12055
12334
  }
12056
- const content = /* @__PURE__ */ jsxs31(Fragment3, { children: [
12057
- /* @__PURE__ */ jsxs31("div", { className: "mb-3", children: [
12058
- /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mb-1", children: [
12059
- /* @__PURE__ */ jsx37("span", { children: "Progress" }),
12060
- /* @__PURE__ */ jsxs31("span", { children: [
12335
+ const content = /* @__PURE__ */ jsxs32(Fragment3, { children: [
12336
+ /* @__PURE__ */ jsxs32("div", { className: "mb-3", children: [
12337
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mb-1", children: [
12338
+ /* @__PURE__ */ jsx38("span", { children: "Progress" }),
12339
+ /* @__PURE__ */ jsxs32("span", { children: [
12061
12340
  progressPercentage,
12062
12341
  "%"
12063
12342
  ] })
12064
12343
  ] }),
12065
- /* @__PURE__ */ jsx37("div", { className: "h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx37(
12344
+ /* @__PURE__ */ jsx38("div", { className: "h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx38(
12066
12345
  "div",
12067
12346
  {
12068
12347
  className: "h-full bg-green-500 rounded-full transition-all duration-300",
@@ -12070,7 +12349,7 @@ var Minimap = memo36(function Minimap2({
12070
12349
  }
12071
12350
  ) })
12072
12351
  ] }),
12073
- /* @__PURE__ */ jsx37(
12352
+ /* @__PURE__ */ jsx38(
12074
12353
  "div",
12075
12354
  {
12076
12355
  className: cn(
@@ -12081,21 +12360,21 @@ var Minimap = memo36(function Minimap2({
12081
12360
  children: pageIndicators
12082
12361
  }
12083
12362
  ),
12084
- /* @__PURE__ */ jsx37("div", { className: "mt-3 pt-2 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsxs31("div", { className: "flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
12085
- /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-1", children: [
12086
- /* @__PURE__ */ jsx37("div", { className: "w-2 h-2 rounded-sm bg-blue-500" }),
12087
- /* @__PURE__ */ jsx37("span", { children: "Current" })
12363
+ /* @__PURE__ */ jsx38("div", { className: "mt-3 pt-2 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsxs32("div", { className: "flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
12364
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-1", children: [
12365
+ /* @__PURE__ */ jsx38("div", { className: "w-2 h-2 rounded-sm bg-blue-500" }),
12366
+ /* @__PURE__ */ jsx38("span", { children: "Current" })
12088
12367
  ] }),
12089
- /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-1", children: [
12090
- /* @__PURE__ */ jsx37("div", { className: "w-2 h-2 rounded-sm bg-green-400" }),
12091
- /* @__PURE__ */ jsx37("span", { children: "Visited" })
12368
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-1", children: [
12369
+ /* @__PURE__ */ jsx38("div", { className: "w-2 h-2 rounded-sm bg-green-400" }),
12370
+ /* @__PURE__ */ jsx38("span", { children: "Visited" })
12092
12371
  ] }),
12093
- /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-1", children: [
12094
- /* @__PURE__ */ jsx37("div", { className: "w-2 h-2 rounded-sm bg-yellow-400" }),
12095
- /* @__PURE__ */ jsx37("span", { children: "Bookmarked" })
12372
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-1", children: [
12373
+ /* @__PURE__ */ jsx38("div", { className: "w-2 h-2 rounded-sm bg-yellow-400" }),
12374
+ /* @__PURE__ */ jsx38("span", { children: "Bookmarked" })
12096
12375
  ] })
12097
12376
  ] }) }),
12098
- /* @__PURE__ */ jsxs31("div", { className: "mt-2 text-xs text-gray-500 dark:text-gray-400", children: [
12377
+ /* @__PURE__ */ jsxs32("div", { className: "mt-2 text-xs text-gray-500 dark:text-gray-400", children: [
12099
12378
  visitedCount,
12100
12379
  " of ",
12101
12380
  numPages,
@@ -12103,7 +12382,7 @@ var Minimap = memo36(function Minimap2({
12103
12382
  ] })
12104
12383
  ] });
12105
12384
  if (variant === "floating") {
12106
- return /* @__PURE__ */ jsxs31(
12385
+ return /* @__PURE__ */ jsxs32(
12107
12386
  "div",
12108
12387
  {
12109
12388
  className: cn(
@@ -12119,13 +12398,13 @@ var Minimap = memo36(function Minimap2({
12119
12398
  ),
12120
12399
  style: { maxHeight },
12121
12400
  children: [
12122
- /* @__PURE__ */ jsx37("h3", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2", children: "Reading Progress" }),
12401
+ /* @__PURE__ */ jsx38("h3", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2", children: "Reading Progress" }),
12123
12402
  content
12124
12403
  ]
12125
12404
  }
12126
12405
  );
12127
12406
  }
12128
- return /* @__PURE__ */ jsx37(
12407
+ return /* @__PURE__ */ jsx38(
12129
12408
  "div",
12130
12409
  {
12131
12410
  className: cn(
@@ -12145,11 +12424,11 @@ init_FloatingZoomControls2();
12145
12424
  // src/components/PDFThumbnailNav/PDFThumbnailNav.tsx
12146
12425
  init_hooks();
12147
12426
  init_utils();
12148
- import { memo as memo37, useEffect as useEffect26, useState as useState28, useRef as useRef25, useCallback as useCallback41 } from "react";
12149
- import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
12427
+ import { memo as memo38, useEffect as useEffect27, useState as useState29, useRef as useRef26, useCallback as useCallback42 } from "react";
12428
+ import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
12150
12429
  var DEFAULT_WIDTH = 612;
12151
12430
  var DEFAULT_HEIGHT = 792;
12152
- var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12431
+ var PDFThumbnailNav = memo38(function PDFThumbnailNav2({
12153
12432
  thumbnailScale = 0.15,
12154
12433
  orientation = "vertical",
12155
12434
  maxVisible = 10,
@@ -12160,14 +12439,14 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12160
12439
  }) {
12161
12440
  const { document: document2, numPages, currentPage } = usePDFViewer();
12162
12441
  const { viewerStore } = usePDFViewerStores();
12163
- const containerRef = useRef25(null);
12164
- const [thumbnails, setThumbnails] = useState28(/* @__PURE__ */ new Map());
12165
- const [visibleRange, setVisibleRange] = useState28({ start: 1, end: maxVisible });
12166
- const renderQueueRef = useRef25(/* @__PURE__ */ new Set());
12167
- const pageCache = useRef25(/* @__PURE__ */ new Map());
12442
+ const containerRef = useRef26(null);
12443
+ const [thumbnails, setThumbnails] = useState29(/* @__PURE__ */ new Map());
12444
+ const [visibleRange, setVisibleRange] = useState29({ start: 1, end: maxVisible });
12445
+ const renderQueueRef = useRef26(/* @__PURE__ */ new Set());
12446
+ const pageCache = useRef26(/* @__PURE__ */ new Map());
12168
12447
  const thumbnailWidth = Math.floor(DEFAULT_WIDTH * thumbnailScale);
12169
12448
  const thumbnailHeight = Math.floor(DEFAULT_HEIGHT * thumbnailScale);
12170
- const updateVisibleRange = useCallback41(() => {
12449
+ const updateVisibleRange = useCallback42(() => {
12171
12450
  if (!containerRef.current || numPages === 0) return;
12172
12451
  const container = containerRef.current;
12173
12452
  const isHorizontal2 = orientation === "horizontal";
@@ -12179,7 +12458,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12179
12458
  const lastVisible = Math.min(numPages, firstVisible + visibleCount);
12180
12459
  setVisibleRange({ start: firstVisible, end: lastVisible });
12181
12460
  }, [numPages, orientation, thumbnailWidth, thumbnailHeight, gap]);
12182
- useEffect26(() => {
12461
+ useEffect27(() => {
12183
12462
  const container = containerRef.current;
12184
12463
  if (!container) return;
12185
12464
  const handleScroll = () => {
@@ -12189,7 +12468,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12189
12468
  updateVisibleRange();
12190
12469
  return () => container.removeEventListener("scroll", handleScroll);
12191
12470
  }, [updateVisibleRange]);
12192
- useEffect26(() => {
12471
+ useEffect27(() => {
12193
12472
  if (!document2) {
12194
12473
  setThumbnails(/* @__PURE__ */ new Map());
12195
12474
  pageCache.current.clear();
@@ -12244,7 +12523,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12244
12523
  };
12245
12524
  renderThumbnails();
12246
12525
  }, [document2, visibleRange, thumbnailScale, thumbnails]);
12247
- useEffect26(() => {
12526
+ useEffect27(() => {
12248
12527
  if (!containerRef.current || numPages === 0) return;
12249
12528
  const container = containerRef.current;
12250
12529
  const isHorizontal2 = orientation === "horizontal";
@@ -12260,12 +12539,12 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12260
12539
  });
12261
12540
  }
12262
12541
  }, [currentPage, numPages, orientation, thumbnailWidth, thumbnailHeight, gap]);
12263
- const handleThumbnailClick = useCallback41((pageNum) => {
12542
+ const handleThumbnailClick = useCallback42((pageNum) => {
12264
12543
  onThumbnailClick?.(pageNum);
12265
12544
  viewerStore.getState().requestScrollToPage(pageNum, "smooth");
12266
12545
  }, [onThumbnailClick, viewerStore]);
12267
12546
  if (!document2 || numPages === 0) {
12268
- return /* @__PURE__ */ jsx38(
12547
+ return /* @__PURE__ */ jsx39(
12269
12548
  "div",
12270
12549
  {
12271
12550
  className: cn(
@@ -12286,7 +12565,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12286
12565
  }
12287
12566
  const isHorizontal = orientation === "horizontal";
12288
12567
  const totalSize = numPages * ((isHorizontal ? thumbnailWidth : thumbnailHeight) + gap) - gap;
12289
- return /* @__PURE__ */ jsx38(
12568
+ return /* @__PURE__ */ jsx39(
12290
12569
  "div",
12291
12570
  {
12292
12571
  ref: containerRef,
@@ -12300,7 +12579,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12300
12579
  style: {
12301
12580
  ...isHorizontal ? { overflowX: "auto", overflowY: "hidden" } : { overflowX: "hidden", overflowY: "auto" }
12302
12581
  },
12303
- children: /* @__PURE__ */ jsx38(
12582
+ children: /* @__PURE__ */ jsx39(
12304
12583
  "div",
12305
12584
  {
12306
12585
  className: cn(
@@ -12317,7 +12596,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12317
12596
  const thumbnail = thumbnails.get(pageNum);
12318
12597
  const isActive = pageNum === currentPage;
12319
12598
  const isVisible = pageNum >= visibleRange.start && pageNum <= visibleRange.end;
12320
- return /* @__PURE__ */ jsxs32(
12599
+ return /* @__PURE__ */ jsxs33(
12321
12600
  "div",
12322
12601
  {
12323
12602
  className: cn(
@@ -12342,7 +12621,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12342
12621
  }
12343
12622
  },
12344
12623
  children: [
12345
- /* @__PURE__ */ jsx38(
12624
+ /* @__PURE__ */ jsx39(
12346
12625
  "div",
12347
12626
  {
12348
12627
  className: "relative bg-white dark:bg-gray-700",
@@ -12350,7 +12629,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12350
12629
  width: thumbnailWidth,
12351
12630
  height: thumbnailHeight
12352
12631
  },
12353
- children: isVisible && thumbnail?.canvas ? /* @__PURE__ */ jsx38(
12632
+ children: isVisible && thumbnail?.canvas ? /* @__PURE__ */ jsx39(
12354
12633
  "img",
12355
12634
  {
12356
12635
  src: thumbnail.canvas.toDataURL(),
@@ -12358,10 +12637,10 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12358
12637
  className: "w-full h-full object-contain",
12359
12638
  loading: "lazy"
12360
12639
  }
12361
- ) : /* @__PURE__ */ jsx38("div", { className: "absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-xs", children: pageNum })
12640
+ ) : /* @__PURE__ */ jsx39("div", { className: "absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-xs", children: pageNum })
12362
12641
  }
12363
12642
  ),
12364
- showPageNumbers && /* @__PURE__ */ jsx38(
12643
+ showPageNumbers && /* @__PURE__ */ jsx39(
12365
12644
  "div",
12366
12645
  {
12367
12646
  className: cn(
@@ -12386,7 +12665,7 @@ var PDFThumbnailNav = memo37(function PDFThumbnailNav2({
12386
12665
  // src/components/ErrorBoundary/PDFErrorBoundary.tsx
12387
12666
  init_utils();
12388
12667
  import { Component } from "react";
12389
- import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
12668
+ import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
12390
12669
  var PDFErrorBoundary = class extends Component {
12391
12670
  constructor(props) {
12392
12671
  super(props);
@@ -12414,7 +12693,7 @@ var PDFErrorBoundary = class extends Component {
12414
12693
  return fallback;
12415
12694
  }
12416
12695
  if (showDefaultUI) {
12417
- return /* @__PURE__ */ jsx39(
12696
+ return /* @__PURE__ */ jsx40(
12418
12697
  DefaultErrorUI,
12419
12698
  {
12420
12699
  error,
@@ -12433,7 +12712,7 @@ function DefaultErrorUI({ error, onReset, className }) {
12433
12712
  const isNetworkError = error.message.includes("fetch") || error.message.includes("network") || error.message.includes("Failed to load");
12434
12713
  let title = "Something went wrong";
12435
12714
  let description = error.message;
12436
- let icon = /* @__PURE__ */ jsx39("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx39(
12715
+ let icon = /* @__PURE__ */ jsx40("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx40(
12437
12716
  "path",
12438
12717
  {
12439
12718
  strokeLinecap: "round",
@@ -12445,7 +12724,7 @@ function DefaultErrorUI({ error, onReset, className }) {
12445
12724
  if (isPDFError) {
12446
12725
  title = "Unable to load PDF";
12447
12726
  description = "The PDF file could not be loaded. It may be corrupted or in an unsupported format.";
12448
- icon = /* @__PURE__ */ jsx39("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx39(
12727
+ icon = /* @__PURE__ */ jsx40("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx40(
12449
12728
  "path",
12450
12729
  {
12451
12730
  strokeLinecap: "round",
@@ -12457,7 +12736,7 @@ function DefaultErrorUI({ error, onReset, className }) {
12457
12736
  } else if (isNetworkError) {
12458
12737
  title = "Network error";
12459
12738
  description = "Unable to fetch the PDF file. Please check your internet connection and try again.";
12460
- icon = /* @__PURE__ */ jsx39("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx39(
12739
+ icon = /* @__PURE__ */ jsx40("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx40(
12461
12740
  "path",
12462
12741
  {
12463
12742
  strokeLinecap: "round",
@@ -12467,7 +12746,7 @@ function DefaultErrorUI({ error, onReset, className }) {
12467
12746
  }
12468
12747
  ) });
12469
12748
  }
12470
- return /* @__PURE__ */ jsxs33(
12749
+ return /* @__PURE__ */ jsxs34(
12471
12750
  "div",
12472
12751
  {
12473
12752
  className: cn(
@@ -12480,14 +12759,14 @@ function DefaultErrorUI({ error, onReset, className }) {
12480
12759
  ),
12481
12760
  children: [
12482
12761
  icon,
12483
- /* @__PURE__ */ jsx39("h2", { className: "mt-4 text-xl font-semibold text-gray-900 dark:text-gray-100", children: title }),
12484
- /* @__PURE__ */ jsx39("p", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400 max-w-md", children: description }),
12485
- /* @__PURE__ */ jsxs33("details", { className: "mt-4 text-left max-w-md w-full", children: [
12486
- /* @__PURE__ */ jsx39("summary", { className: "cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: "Technical details" }),
12487
- /* @__PURE__ */ jsx39("pre", { className: "mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto", children: error.stack || error.message })
12762
+ /* @__PURE__ */ jsx40("h2", { className: "mt-4 text-xl font-semibold text-gray-900 dark:text-gray-100", children: title }),
12763
+ /* @__PURE__ */ jsx40("p", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400 max-w-md", children: description }),
12764
+ /* @__PURE__ */ jsxs34("details", { className: "mt-4 text-left max-w-md w-full", children: [
12765
+ /* @__PURE__ */ jsx40("summary", { className: "cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: "Technical details" }),
12766
+ /* @__PURE__ */ jsx40("pre", { className: "mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto", children: error.stack || error.message })
12488
12767
  ] }),
12489
- /* @__PURE__ */ jsxs33("div", { className: "mt-6 flex gap-3", children: [
12490
- /* @__PURE__ */ jsx39(
12768
+ /* @__PURE__ */ jsxs34("div", { className: "mt-6 flex gap-3", children: [
12769
+ /* @__PURE__ */ jsx40(
12491
12770
  "button",
12492
12771
  {
12493
12772
  onClick: onReset,
@@ -12501,7 +12780,7 @@ function DefaultErrorUI({ error, onReset, className }) {
12501
12780
  children: "Try again"
12502
12781
  }
12503
12782
  ),
12504
- /* @__PURE__ */ jsx39(
12783
+ /* @__PURE__ */ jsx40(
12505
12784
  "button",
12506
12785
  {
12507
12786
  onClick: () => window.location.reload(),
@@ -12521,7 +12800,7 @@ function DefaultErrorUI({ error, onReset, className }) {
12521
12800
  );
12522
12801
  }
12523
12802
  function withErrorBoundary({ component, ...props }) {
12524
- return /* @__PURE__ */ jsx39(PDFErrorBoundary, { ...props, children: component });
12803
+ return /* @__PURE__ */ jsx40(PDFErrorBoundary, { ...props, children: component });
12525
12804
  }
12526
12805
 
12527
12806
  // src/components/index.ts
@@ -12541,6 +12820,7 @@ export {
12541
12820
  AnnotationToolbar,
12542
12821
  AskAboutOverlay,
12543
12822
  AskAboutTrigger,
12823
+ BookModeContainer,
12544
12824
  BookmarksPanel,
12545
12825
  CanvasLayer,
12546
12826
  ContinuousScrollContainer,
@@ -12628,6 +12908,7 @@ export {
12628
12908
  pdfjsLib,
12629
12909
  percentToPDF,
12630
12910
  percentToViewport,
12911
+ playPageTurnSound,
12631
12912
  quickViewer,
12632
12913
  removeRotation,
12633
12914
  saveHighlights,