pdfjs-reader-core 0.2.4 → 0.2.6

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.cjs CHANGED
@@ -346,6 +346,7 @@ function createViewerStore(initialOverrides = {}) {
346
346
  document: document2,
347
347
  numPages: document2.numPages,
348
348
  isLoading: false,
349
+ loadingProgress: null,
349
350
  error: null,
350
351
  currentPage: 1
351
352
  });
@@ -353,15 +354,22 @@ function createViewerStore(initialOverrides = {}) {
353
354
  set({
354
355
  document: null,
355
356
  numPages: 0,
356
- isLoading: false
357
+ isLoading: false,
358
+ loadingProgress: null
357
359
  });
358
360
  }
359
361
  },
360
- setLoading: (isLoading) => {
361
- set({ isLoading });
362
+ setLoading: (isLoading, progress) => {
363
+ set({
364
+ isLoading,
365
+ loadingProgress: isLoading ? progress ?? { phase: "initializing" } : null
366
+ });
367
+ },
368
+ setLoadingProgress: (progress) => {
369
+ set({ loadingProgress: progress });
362
370
  },
363
371
  setError: (error) => {
364
- set({ error, isLoading: false });
372
+ set({ error, isLoading: false, loadingProgress: null });
365
373
  },
366
374
  // Navigation actions
367
375
  setCurrentPage: (page) => {
@@ -509,6 +517,7 @@ var init_viewer_store = __esm({
509
517
  document: null,
510
518
  numPages: 0,
511
519
  isLoading: false,
520
+ loadingProgress: null,
512
521
  error: null,
513
522
  // Navigation state
514
523
  currentPage: 1,
@@ -9295,6 +9304,138 @@ var init_FloatingZoomControls2 = __esm({
9295
9304
  }
9296
9305
  });
9297
9306
 
9307
+ // src/components/PDFLoadingScreen/PDFLoadingScreen.tsx
9308
+ function formatBytes(bytes) {
9309
+ if (bytes < 1024) return `${bytes} B`;
9310
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
9311
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
9312
+ }
9313
+ var import_react40, import_jsx_runtime26, phaseMessages, PDFLoadingScreen;
9314
+ var init_PDFLoadingScreen = __esm({
9315
+ "src/components/PDFLoadingScreen/PDFLoadingScreen.tsx"() {
9316
+ "use strict";
9317
+ import_react40 = require("react");
9318
+ init_utils();
9319
+ import_jsx_runtime26 = require("react/jsx-runtime");
9320
+ phaseMessages = {
9321
+ initializing: "Initializing...",
9322
+ fetching: "Loading document...",
9323
+ parsing: "Processing pages...",
9324
+ rendering: "Preparing view..."
9325
+ };
9326
+ PDFLoadingScreen = (0, import_react40.memo)(function PDFLoadingScreen2({
9327
+ progress,
9328
+ bytesLoaded,
9329
+ totalBytes,
9330
+ phase = "fetching",
9331
+ documentName,
9332
+ className
9333
+ }) {
9334
+ const hasProgress = progress !== void 0 && progress >= 0;
9335
+ const hasBytes = bytesLoaded !== void 0 && totalBytes !== void 0 && totalBytes > 0;
9336
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
9337
+ "div",
9338
+ {
9339
+ className: cn(
9340
+ "pdf-loading-screen",
9341
+ "flex flex-col items-center justify-center",
9342
+ "w-full h-full min-h-[400px]",
9343
+ "bg-slate-50 dark:bg-slate-800",
9344
+ className
9345
+ ),
9346
+ role: "status",
9347
+ "aria-live": "polite",
9348
+ "aria-label": phaseMessages[phase],
9349
+ children: [
9350
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-loading-skeleton", children: [
9351
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-loading-icon", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
9352
+ "svg",
9353
+ {
9354
+ width: "48",
9355
+ height: "56",
9356
+ viewBox: "0 0 48 56",
9357
+ fill: "none",
9358
+ xmlns: "http://www.w3.org/2000/svg",
9359
+ className: "pdf-document-icon",
9360
+ children: [
9361
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9362
+ "path",
9363
+ {
9364
+ d: "M4 4C4 1.79086 5.79086 0 8 0H30L44 14V52C44 54.2091 42.2091 56 40 56H8C5.79086 56 4 54.2091 4 52V4Z",
9365
+ className: "fill-white dark:fill-slate-700"
9366
+ }
9367
+ ),
9368
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9369
+ "path",
9370
+ {
9371
+ d: "M30 0L44 14H34C31.7909 14 30 12.2091 30 10V0Z",
9372
+ className: "fill-slate-200 dark:fill-slate-600"
9373
+ }
9374
+ ),
9375
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "10", y: "22", width: "24", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
9376
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "10", y: "28", width: "20", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
9377
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "10", y: "34", width: "22", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
9378
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "10", y: "40", width: "16", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
9379
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9380
+ "path",
9381
+ {
9382
+ d: "M4 4C4 1.79086 5.79086 0 8 0H30L44 14V52C44 54.2091 42.2091 56 40 56H8C5.79086 56 4 54.2091 4 52V4Z",
9383
+ className: "stroke-slate-300 dark:stroke-slate-500",
9384
+ strokeWidth: "1",
9385
+ fill: "none"
9386
+ }
9387
+ )
9388
+ ]
9389
+ }
9390
+ ) }),
9391
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-skeleton-lines", children: [
9392
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-1" }),
9393
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-2" }),
9394
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-3" })
9395
+ ] })
9396
+ ] }),
9397
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-loading-info", children: [
9398
+ documentName && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "pdf-loading-document-name", children: documentName }),
9399
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "pdf-loading-message", children: phaseMessages[phase] }),
9400
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-loading-progress-container", children: [
9401
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-loading-progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9402
+ "div",
9403
+ {
9404
+ className: cn(
9405
+ "pdf-loading-progress-fill",
9406
+ !hasProgress && "pdf-loading-progress-indeterminate"
9407
+ ),
9408
+ style: hasProgress ? { width: `${Math.min(100, progress)}%` } : void 0
9409
+ }
9410
+ ) }),
9411
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-loading-progress-details", children: [
9412
+ hasProgress && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "pdf-loading-progress-percent", children: [
9413
+ Math.round(progress),
9414
+ "%"
9415
+ ] }),
9416
+ hasBytes && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "pdf-loading-progress-bytes", children: [
9417
+ formatBytes(bytesLoaded),
9418
+ " / ",
9419
+ formatBytes(totalBytes)
9420
+ ] })
9421
+ ] })
9422
+ ] })
9423
+ ] })
9424
+ ]
9425
+ }
9426
+ );
9427
+ });
9428
+ }
9429
+ });
9430
+
9431
+ // src/components/PDFLoadingScreen/index.ts
9432
+ var init_PDFLoadingScreen2 = __esm({
9433
+ "src/components/PDFLoadingScreen/index.ts"() {
9434
+ "use strict";
9435
+ init_PDFLoadingScreen();
9436
+ }
9437
+ });
9438
+
9298
9439
  // src/components/PDFViewer/PDFViewerClient.tsx
9299
9440
  var PDFViewerClient_exports = {};
9300
9441
  __export(PDFViewerClient_exports, {
@@ -9339,11 +9480,11 @@ function calculateMatchRects3(textItems, startOffset, length, viewport) {
9339
9480
  }
9340
9481
  return rects;
9341
9482
  }
9342
- var import_react40, import_jsx_runtime26, PDFViewerInner, PDFViewerInnerWithRef, PDFViewerClient;
9483
+ var import_react41, import_jsx_runtime27, PDFViewerInner, PDFViewerInnerWithRef, PDFViewerClient;
9343
9484
  var init_PDFViewerClient = __esm({
9344
9485
  "src/components/PDFViewer/PDFViewerClient.tsx"() {
9345
9486
  "use strict";
9346
- import_react40 = require("react");
9487
+ import_react41 = require("react");
9347
9488
  init_hooks();
9348
9489
  init_utils();
9349
9490
  init_Toolbar2();
@@ -9353,9 +9494,10 @@ var init_PDFViewerClient = __esm({
9353
9494
  init_ContinuousScrollContainer();
9354
9495
  init_DualPageContainer();
9355
9496
  init_FloatingZoomControls2();
9497
+ init_PDFLoadingScreen2();
9356
9498
  init_utils();
9357
- import_jsx_runtime26 = require("react/jsx-runtime");
9358
- PDFViewerInner = (0, import_react40.memo)(function PDFViewerInner2({
9499
+ import_jsx_runtime27 = require("react/jsx-runtime");
9500
+ PDFViewerInner = (0, import_react41.memo)(function PDFViewerInner2({
9359
9501
  src,
9360
9502
  initialPage = 1,
9361
9503
  page: controlledPage,
@@ -9382,19 +9524,19 @@ var init_PDFViewerClient = __esm({
9382
9524
  onReady
9383
9525
  }) {
9384
9526
  const { viewerStore, annotationStore, searchStore } = usePDFViewerStores();
9385
- const mountedRef = (0, import_react40.useRef)(true);
9386
- const [, setLoadState] = (0, import_react40.useState)("idle");
9387
- const onDocumentLoadRef = (0, import_react40.useRef)(onDocumentLoad);
9388
- const onErrorRef = (0, import_react40.useRef)(onError);
9389
- const onPageChangeRef = (0, import_react40.useRef)(onPageChange);
9390
- const onScaleChangeRef = (0, import_react40.useRef)(onScaleChange);
9391
- const onZoomChangeRef = (0, import_react40.useRef)(onZoomChange);
9392
- const onPageRenderStartRef = (0, import_react40.useRef)(onPageRenderStart);
9393
- const onPageRenderCompleteRef = (0, import_react40.useRef)(onPageRenderComplete);
9394
- const onHighlightAddedRef = (0, import_react40.useRef)(onHighlightAdded);
9395
- const onHighlightRemovedRef = (0, import_react40.useRef)(onHighlightRemoved);
9396
- const onAnnotationAddedRef = (0, import_react40.useRef)(onAnnotationAdded);
9397
- const onReadyRef = (0, import_react40.useRef)(onReady);
9527
+ const mountedRef = (0, import_react41.useRef)(true);
9528
+ const [, setLoadState] = (0, import_react41.useState)("idle");
9529
+ const onDocumentLoadRef = (0, import_react41.useRef)(onDocumentLoad);
9530
+ const onErrorRef = (0, import_react41.useRef)(onError);
9531
+ const onPageChangeRef = (0, import_react41.useRef)(onPageChange);
9532
+ const onScaleChangeRef = (0, import_react41.useRef)(onScaleChange);
9533
+ const onZoomChangeRef = (0, import_react41.useRef)(onZoomChange);
9534
+ const onPageRenderStartRef = (0, import_react41.useRef)(onPageRenderStart);
9535
+ const onPageRenderCompleteRef = (0, import_react41.useRef)(onPageRenderComplete);
9536
+ const onHighlightAddedRef = (0, import_react41.useRef)(onHighlightAdded);
9537
+ const onHighlightRemovedRef = (0, import_react41.useRef)(onHighlightRemoved);
9538
+ const onAnnotationAddedRef = (0, import_react41.useRef)(onAnnotationAdded);
9539
+ const onReadyRef = (0, import_react41.useRef)(onReady);
9398
9540
  onDocumentLoadRef.current = onDocumentLoad;
9399
9541
  onErrorRef.current = onError;
9400
9542
  onPageChangeRef.current = onPageChange;
@@ -9407,17 +9549,18 @@ var init_PDFViewerClient = __esm({
9407
9549
  onAnnotationAddedRef.current = onAnnotationAdded;
9408
9550
  onReadyRef.current = onReady;
9409
9551
  const isControlled = controlledPage !== void 0;
9410
- const prevControlledPageRef = (0, import_react40.useRef)(controlledPage);
9411
- const srcIdRef = (0, import_react40.useRef)(null);
9552
+ const prevControlledPageRef = (0, import_react41.useRef)(controlledPage);
9553
+ const srcIdRef = (0, import_react41.useRef)(null);
9412
9554
  const currentPage = useViewerStore((s) => s.currentPage);
9413
9555
  const scale = useViewerStore((s) => s.scale);
9414
9556
  const theme = useViewerStore((s) => s.theme);
9415
9557
  const isLoading = useViewerStore((s) => s.isLoading);
9558
+ const loadingProgress = useViewerStore((s) => s.loadingProgress);
9416
9559
  const error = useViewerStore((s) => s.error);
9417
9560
  const sidebarOpen = useViewerStore((s) => s.sidebarOpen);
9418
9561
  const srcId = getSrcIdentifier(src);
9419
- const handleRef = (0, import_react40.useRef)(null);
9420
- (0, import_react40.useEffect)(() => {
9562
+ const handleRef = (0, import_react41.useRef)(null);
9563
+ (0, import_react41.useEffect)(() => {
9421
9564
  const handle = {
9422
9565
  // ==================== Text Highlighting ====================
9423
9566
  highlightText: async (text, options) => {
@@ -9835,18 +9978,18 @@ var init_PDFViewerClient = __esm({
9835
9978
  handleRef.current = handle;
9836
9979
  onReadyRef.current?.(handle);
9837
9980
  }, [viewerStore, annotationStore, searchStore]);
9838
- const handleRetry = (0, import_react40.useCallback)(() => {
9981
+ const handleRetry = (0, import_react41.useCallback)(() => {
9839
9982
  srcIdRef.current = null;
9840
9983
  viewerStore.getState().setError(null);
9841
9984
  setLoadState("idle");
9842
9985
  }, [viewerStore]);
9843
- (0, import_react40.useEffect)(() => {
9986
+ (0, import_react41.useEffect)(() => {
9844
9987
  mountedRef.current = true;
9845
9988
  return () => {
9846
9989
  mountedRef.current = false;
9847
9990
  };
9848
9991
  }, []);
9849
- (0, import_react40.useEffect)(() => {
9992
+ (0, import_react41.useEffect)(() => {
9850
9993
  if (srcIdRef.current === srcId && viewerStore.getState().document) {
9851
9994
  return;
9852
9995
  }
@@ -9860,13 +10003,27 @@ var init_PDFViewerClient = __esm({
9860
10003
  const loadDoc = async () => {
9861
10004
  if (!mountedRef.current) return;
9862
10005
  try {
9863
- viewerStore.getState().setLoading(true);
10006
+ viewerStore.getState().setLoading(true, { phase: "fetching" });
9864
10007
  viewerStore.getState().setError(null);
9865
10008
  setLoadState("loading");
9866
10009
  const { document: document2, numPages } = await loadDocument({
9867
10010
  src,
9868
- workerSrc
10011
+ workerSrc,
10012
+ onProgress: ({ loaded, total }) => {
10013
+ if (mountedRef.current && srcIdRef.current === loadId) {
10014
+ const percent = total > 0 ? Math.round(loaded / total * 100) : void 0;
10015
+ viewerStore.getState().setLoadingProgress({
10016
+ phase: "fetching",
10017
+ percent,
10018
+ bytesLoaded: loaded,
10019
+ totalBytes: total
10020
+ });
10021
+ }
10022
+ }
9869
10023
  });
10024
+ if (mountedRef.current && srcIdRef.current === loadId) {
10025
+ viewerStore.getState().setLoadingProgress({ phase: "parsing", percent: 100 });
10026
+ }
9870
10027
  if (mountedRef.current && srcIdRef.current === loadId) {
9871
10028
  viewerStore.getState().setDocument(document2);
9872
10029
  setLoadState("loaded");
@@ -9898,22 +10055,22 @@ var init_PDFViewerClient = __esm({
9898
10055
  return () => {
9899
10056
  };
9900
10057
  }, [srcId, src, workerSrc, initialPage, initialScale, viewerStore]);
9901
- const prevPageRef = (0, import_react40.useRef)(currentPage);
9902
- (0, import_react40.useEffect)(() => {
10058
+ const prevPageRef = (0, import_react41.useRef)(currentPage);
10059
+ (0, import_react41.useEffect)(() => {
9903
10060
  if (prevPageRef.current !== currentPage) {
9904
10061
  prevPageRef.current = currentPage;
9905
10062
  onPageChangeRef.current?.(currentPage);
9906
10063
  }
9907
10064
  }, [currentPage]);
9908
- const prevScaleRef = (0, import_react40.useRef)(scale);
9909
- (0, import_react40.useEffect)(() => {
10065
+ const prevScaleRef = (0, import_react41.useRef)(scale);
10066
+ (0, import_react41.useEffect)(() => {
9910
10067
  if (prevScaleRef.current !== scale) {
9911
10068
  prevScaleRef.current = scale;
9912
10069
  onScaleChangeRef.current?.(scale);
9913
10070
  onZoomChangeRef.current?.(scale);
9914
10071
  }
9915
10072
  }, [scale]);
9916
- (0, import_react40.useEffect)(() => {
10073
+ (0, import_react41.useEffect)(() => {
9917
10074
  if (!isControlled || controlledPage === void 0) return;
9918
10075
  if (prevControlledPageRef.current === controlledPage) return;
9919
10076
  prevControlledPageRef.current = controlledPage;
@@ -9926,7 +10083,7 @@ var init_PDFViewerClient = __esm({
9926
10083
  if (error) {
9927
10084
  if (errorComponent) {
9928
10085
  const errorContent = typeof errorComponent === "function" ? errorComponent(error, handleRetry) : errorComponent;
9929
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10086
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9930
10087
  "div",
9931
10088
  {
9932
10089
  className: cn(
@@ -9940,7 +10097,7 @@ var init_PDFViewerClient = __esm({
9940
10097
  }
9941
10098
  );
9942
10099
  }
9943
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10100
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9944
10101
  "div",
9945
10102
  {
9946
10103
  className: cn(
@@ -9950,10 +10107,10 @@ var init_PDFViewerClient = __esm({
9950
10107
  themeClass,
9951
10108
  className
9952
10109
  ),
9953
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "text-center p-8", children: [
9954
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-red-500 text-lg font-semibold mb-2", children: "Failed to load PDF" }),
9955
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-gray-500 text-sm", children: error.message }),
9956
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10110
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-center p-8", children: [
10111
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-red-500 text-lg font-semibold mb-2", children: "Failed to load PDF" }),
10112
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-gray-500 text-sm", children: error.message }),
10113
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9957
10114
  "button",
9958
10115
  {
9959
10116
  onClick: handleRetry,
@@ -9968,15 +10125,15 @@ var init_PDFViewerClient = __esm({
9968
10125
  const renderContainer = () => {
9969
10126
  switch (viewMode) {
9970
10127
  case "continuous":
9971
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ContinuousScrollContainer, {});
10128
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContinuousScrollContainer, {});
9972
10129
  case "dual":
9973
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DualPageContainer, {});
10130
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DualPageContainer, {});
9974
10131
  case "single":
9975
10132
  default:
9976
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DocumentContainer, {});
10133
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DocumentContainer, {});
9977
10134
  }
9978
10135
  };
9979
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
10136
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
9980
10137
  "div",
9981
10138
  {
9982
10139
  className: cn(
@@ -9988,25 +10145,30 @@ var init_PDFViewerClient = __esm({
9988
10145
  className
9989
10146
  ),
9990
10147
  children: [
9991
- showToolbar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Toolbar, {}),
9992
- showAnnotationToolbar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AnnotationToolbar, {}),
9993
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-1 overflow-hidden", children: [
9994
- showSidebar && sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Sidebar, {}),
10148
+ showToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Toolbar, {}),
10149
+ showAnnotationToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AnnotationToolbar, {}),
10150
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-1 overflow-hidden", children: [
10151
+ showSidebar && sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Sidebar, {}),
9995
10152
  renderContainer()
9996
10153
  ] }),
9997
- showFloatingZoom && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FloatingZoomControls, { position: "bottom-right" }),
9998
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-white/80 dark:bg-gray-900/80", children: loadingComponent ?? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col items-center", children: [
9999
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
10000
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF..." })
10001
- ] }) })
10154
+ showFloatingZoom && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FloatingZoomControls, { position: "bottom-right" }),
10155
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "absolute inset-0 z-50", children: loadingComponent ?? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10156
+ PDFLoadingScreen,
10157
+ {
10158
+ phase: loadingProgress?.phase ?? "fetching",
10159
+ progress: loadingProgress?.percent,
10160
+ bytesLoaded: loadingProgress?.bytesLoaded,
10161
+ totalBytes: loadingProgress?.totalBytes
10162
+ }
10163
+ ) })
10002
10164
  ]
10003
10165
  }
10004
10166
  );
10005
10167
  });
10006
- PDFViewerInnerWithRef = (0, import_react40.forwardRef)(
10168
+ PDFViewerInnerWithRef = (0, import_react41.forwardRef)(
10007
10169
  function PDFViewerInnerWithRef2(props, ref) {
10008
- const handleRef = (0, import_react40.useRef)(null);
10009
- const handleReady = (0, import_react40.useCallback)((handle) => {
10170
+ const handleRef = (0, import_react41.useRef)(null);
10171
+ const handleReady = (0, import_react41.useCallback)((handle) => {
10010
10172
  handleRef.current = handle;
10011
10173
  if (typeof ref === "function") {
10012
10174
  ref(handle);
@@ -10014,17 +10176,17 @@ var init_PDFViewerClient = __esm({
10014
10176
  ref.current = handle;
10015
10177
  }
10016
10178
  }, [ref]);
10017
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PDFViewerInner, { ...props, onReady: handleReady });
10179
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerInner, { ...props, onReady: handleReady });
10018
10180
  }
10019
10181
  );
10020
- PDFViewerClient = (0, import_react40.memo)(
10021
- (0, import_react40.forwardRef)(function PDFViewerClient2(props, ref) {
10022
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10182
+ PDFViewerClient = (0, import_react41.memo)(
10183
+ (0, import_react41.forwardRef)(function PDFViewerClient2(props, ref) {
10184
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10023
10185
  PDFViewerProvider,
10024
10186
  {
10025
10187
  theme: props.theme,
10026
10188
  defaultSidebarPanel: props.defaultSidebarPanel,
10027
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PDFViewerInnerWithRef, { ref, ...props })
10189
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerInnerWithRef, { ref, ...props })
10028
10190
  }
10029
10191
  );
10030
10192
  })
@@ -10033,20 +10195,20 @@ var init_PDFViewerClient = __esm({
10033
10195
  });
10034
10196
 
10035
10197
  // src/components/PDFViewer/PDFViewer.tsx
10036
- var import_react41, import_jsx_runtime27, PDFViewerClient3, PDFViewerLoading, PDFViewer;
10198
+ var import_react42, import_jsx_runtime28, PDFViewerClient3, PDFViewerLoading, PDFViewer;
10037
10199
  var init_PDFViewer = __esm({
10038
10200
  "src/components/PDFViewer/PDFViewer.tsx"() {
10039
10201
  "use strict";
10040
- import_react41 = require("react");
10202
+ import_react42 = require("react");
10041
10203
  init_utils();
10042
- import_jsx_runtime27 = require("react/jsx-runtime");
10043
- PDFViewerClient3 = (0, import_react41.lazy)(
10204
+ import_jsx_runtime28 = require("react/jsx-runtime");
10205
+ PDFViewerClient3 = (0, import_react42.lazy)(
10044
10206
  () => Promise.resolve().then(() => (init_PDFViewerClient(), PDFViewerClient_exports)).then((mod) => ({ default: mod.PDFViewerClient }))
10045
10207
  );
10046
- PDFViewerLoading = (0, import_react41.memo)(function PDFViewerLoading2({
10208
+ PDFViewerLoading = (0, import_react42.memo)(function PDFViewerLoading2({
10047
10209
  className
10048
10210
  }) {
10049
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10211
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10050
10212
  "div",
10051
10213
  {
10052
10214
  className: cn(
@@ -10055,18 +10217,18 @@ var init_PDFViewer = __esm({
10055
10217
  "bg-white dark:bg-gray-900",
10056
10218
  className
10057
10219
  ),
10058
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col items-center", children: [
10059
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
10060
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF viewer..." })
10220
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col items-center", children: [
10221
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
10222
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF viewer..." })
10061
10223
  ] }) })
10062
10224
  }
10063
10225
  );
10064
10226
  });
10065
- PDFViewer = (0, import_react41.memo)(function PDFViewer2(props) {
10227
+ PDFViewer = (0, import_react42.memo)(function PDFViewer2(props) {
10066
10228
  if (typeof window === "undefined") {
10067
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerLoading, { className: props.className });
10229
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PDFViewerLoading, { className: props.className });
10068
10230
  }
10069
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react41.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerLoading, { className: props.className }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerClient3, { ...props }) });
10231
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react42.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PDFViewerLoading, { className: props.className }), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PDFViewerClient3, { ...props }) });
10070
10232
  });
10071
10233
  }
10072
10234
  });
@@ -10107,6 +10269,7 @@ __export(index_exports, {
10107
10269
  MobileToolbar: () => MobileToolbar,
10108
10270
  OutlinePanel: () => OutlinePanel,
10109
10271
  PDFErrorBoundary: () => PDFErrorBoundary,
10272
+ PDFLoadingScreen: () => PDFLoadingScreen,
10110
10273
  PDFPage: () => PDFPage,
10111
10274
  PDFThumbnailNav: () => PDFThumbnailNav,
10112
10275
  PDFViewer: () => PDFViewer,
@@ -10218,9 +10381,9 @@ init_HighlightPopover2();
10218
10381
  init_AnnotationToolbar2();
10219
10382
 
10220
10383
  // src/components/Annotations/StickyNote.tsx
10221
- var import_react42 = require("react");
10384
+ var import_react43 = require("react");
10222
10385
  init_utils();
10223
- var import_jsx_runtime28 = require("react/jsx-runtime");
10386
+ var import_jsx_runtime29 = require("react/jsx-runtime");
10224
10387
  var NOTE_COLORS = [
10225
10388
  "#fef08a",
10226
10389
  // yellow
@@ -10233,7 +10396,7 @@ var NOTE_COLORS = [
10233
10396
  "#fed7aa"
10234
10397
  // orange
10235
10398
  ];
10236
- var StickyNote = (0, import_react42.memo)(function StickyNote2({
10399
+ var StickyNote = (0, import_react43.memo)(function StickyNote2({
10237
10400
  note,
10238
10401
  scale,
10239
10402
  isSelected,
@@ -10246,37 +10409,37 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10246
10409
  onDragStart,
10247
10410
  className
10248
10411
  }) {
10249
- const [isExpanded, setIsExpanded] = (0, import_react42.useState)(false);
10250
- const [localContent, setLocalContent] = (0, import_react42.useState)(note.content);
10251
- const textareaRef = (0, import_react42.useRef)(null);
10252
- const noteRef = (0, import_react42.useRef)(null);
10253
- (0, import_react42.useEffect)(() => {
10412
+ const [isExpanded, setIsExpanded] = (0, import_react43.useState)(false);
10413
+ const [localContent, setLocalContent] = (0, import_react43.useState)(note.content);
10414
+ const textareaRef = (0, import_react43.useRef)(null);
10415
+ const noteRef = (0, import_react43.useRef)(null);
10416
+ (0, import_react43.useEffect)(() => {
10254
10417
  setLocalContent(note.content);
10255
10418
  }, [note.content]);
10256
- (0, import_react42.useEffect)(() => {
10419
+ (0, import_react43.useEffect)(() => {
10257
10420
  if (isEditing && textareaRef.current) {
10258
10421
  textareaRef.current.focus();
10259
10422
  textareaRef.current.select();
10260
10423
  }
10261
10424
  }, [isEditing]);
10262
- const handleClick = (0, import_react42.useCallback)((e) => {
10425
+ const handleClick = (0, import_react43.useCallback)((e) => {
10263
10426
  e.stopPropagation();
10264
10427
  onSelect?.();
10265
10428
  if (!isExpanded) {
10266
10429
  setIsExpanded(true);
10267
10430
  }
10268
10431
  }, [isExpanded, onSelect]);
10269
- const handleDoubleClick = (0, import_react42.useCallback)((e) => {
10432
+ const handleDoubleClick = (0, import_react43.useCallback)((e) => {
10270
10433
  e.stopPropagation();
10271
10434
  onStartEdit?.();
10272
10435
  }, [onStartEdit]);
10273
- const handleBlur = (0, import_react42.useCallback)(() => {
10436
+ const handleBlur = (0, import_react43.useCallback)(() => {
10274
10437
  if (isEditing && localContent !== note.content) {
10275
10438
  onUpdate?.({ content: localContent });
10276
10439
  }
10277
10440
  onEndEdit?.();
10278
10441
  }, [isEditing, localContent, note.content, onUpdate, onEndEdit]);
10279
- const handleKeyDown = (0, import_react42.useCallback)((e) => {
10442
+ const handleKeyDown = (0, import_react43.useCallback)((e) => {
10280
10443
  if (e.key === "Escape") {
10281
10444
  setLocalContent(note.content);
10282
10445
  onEndEdit?.();
@@ -10284,16 +10447,16 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10284
10447
  handleBlur();
10285
10448
  }
10286
10449
  }, [note.content, onEndEdit, handleBlur]);
10287
- const handleColorChange = (0, import_react42.useCallback)((color) => {
10450
+ const handleColorChange = (0, import_react43.useCallback)((color) => {
10288
10451
  onUpdate?.({ color });
10289
10452
  }, [onUpdate]);
10290
- const handleCollapse = (0, import_react42.useCallback)((e) => {
10453
+ const handleCollapse = (0, import_react43.useCallback)((e) => {
10291
10454
  e.stopPropagation();
10292
10455
  setIsExpanded(false);
10293
10456
  onEndEdit?.();
10294
10457
  }, [onEndEdit]);
10295
10458
  if (!isExpanded) {
10296
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10459
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10297
10460
  "div",
10298
10461
  {
10299
10462
  ref: noteRef,
@@ -10314,14 +10477,14 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10314
10477
  onMouseDown: onDragStart,
10315
10478
  onTouchStart: onDragStart,
10316
10479
  title: note.content || "Empty note",
10317
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10480
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10318
10481
  "svg",
10319
10482
  {
10320
10483
  className: "w-4 h-4 opacity-70",
10321
10484
  fill: "currentColor",
10322
10485
  viewBox: "0 0 20 20",
10323
10486
  style: { color: "#333" },
10324
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10487
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10325
10488
  "path",
10326
10489
  {
10327
10490
  fillRule: "evenodd",
@@ -10334,7 +10497,7 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10334
10497
  }
10335
10498
  );
10336
10499
  }
10337
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
10500
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
10338
10501
  "div",
10339
10502
  {
10340
10503
  ref: noteRef,
@@ -10352,14 +10515,14 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10352
10515
  },
10353
10516
  onClick: handleClick,
10354
10517
  children: [
10355
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
10518
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
10356
10519
  "div",
10357
10520
  {
10358
10521
  className: "flex items-center justify-between px-2 py-1 border-b border-black/10 cursor-move",
10359
10522
  onMouseDown: onDragStart,
10360
10523
  onTouchStart: onDragStart,
10361
10524
  children: [
10362
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex gap-1", children: NOTE_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10525
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", children: NOTE_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10363
10526
  "button",
10364
10527
  {
10365
10528
  className: cn(
@@ -10376,8 +10539,8 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10376
10539
  },
10377
10540
  color
10378
10541
  )) }),
10379
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
10380
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10542
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1", children: [
10543
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10381
10544
  "button",
10382
10545
  {
10383
10546
  className: "p-0.5 hover:bg-black/10 rounded",
@@ -10386,23 +10549,23 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10386
10549
  onDelete?.();
10387
10550
  },
10388
10551
  title: "Delete note",
10389
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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" }) })
10552
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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" }) })
10390
10553
  }
10391
10554
  ),
10392
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10555
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10393
10556
  "button",
10394
10557
  {
10395
10558
  className: "p-0.5 hover:bg-black/10 rounded",
10396
10559
  onClick: handleCollapse,
10397
10560
  title: "Collapse note",
10398
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
10561
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
10399
10562
  }
10400
10563
  )
10401
10564
  ] })
10402
10565
  ]
10403
10566
  }
10404
10567
  ),
10405
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10568
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "p-2", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10406
10569
  "textarea",
10407
10570
  {
10408
10571
  ref: textareaRef,
@@ -10417,7 +10580,7 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10417
10580
  onKeyDown: handleKeyDown,
10418
10581
  placeholder: "Enter note..."
10419
10582
  }
10420
- ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10583
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10421
10584
  "div",
10422
10585
  {
10423
10586
  className: cn(
@@ -10428,16 +10591,16 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10428
10591
  children: note.content || "Double-click to edit..."
10429
10592
  }
10430
10593
  ) }),
10431
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "px-2 pb-1 text-[10px] text-gray-500", children: new Date(note.updatedAt).toLocaleDateString() })
10594
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "px-2 pb-1 text-[10px] text-gray-500", children: new Date(note.updatedAt).toLocaleDateString() })
10432
10595
  ]
10433
10596
  }
10434
10597
  );
10435
10598
  });
10436
10599
 
10437
10600
  // src/components/Annotations/DrawingCanvas.tsx
10438
- var import_react43 = require("react");
10601
+ var import_react44 = require("react");
10439
10602
  init_utils();
10440
- var import_jsx_runtime29 = require("react/jsx-runtime");
10603
+ var import_jsx_runtime30 = require("react/jsx-runtime");
10441
10604
  function pointsToSvgPath(points) {
10442
10605
  if (points.length === 0) return "";
10443
10606
  if (points.length === 1) {
@@ -10475,7 +10638,7 @@ function simplifyPath(points, tolerance = 1) {
10475
10638
  result.push(points[points.length - 1]);
10476
10639
  return result;
10477
10640
  }
10478
- var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10641
+ var DrawingCanvas = (0, import_react44.memo)(function DrawingCanvas2({
10479
10642
  width,
10480
10643
  height,
10481
10644
  scale,
@@ -10485,10 +10648,10 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10485
10648
  onDrawingComplete,
10486
10649
  className
10487
10650
  }) {
10488
- const svgRef = (0, import_react43.useRef)(null);
10489
- const [isDrawing, setIsDrawing] = (0, import_react43.useState)(false);
10490
- const [currentPath, setCurrentPath] = (0, import_react43.useState)([]);
10491
- const getPoint = (0, import_react43.useCallback)((e) => {
10651
+ const svgRef = (0, import_react44.useRef)(null);
10652
+ const [isDrawing, setIsDrawing] = (0, import_react44.useState)(false);
10653
+ const [currentPath, setCurrentPath] = (0, import_react44.useState)([]);
10654
+ const getPoint = (0, import_react44.useCallback)((e) => {
10492
10655
  if (!svgRef.current) return null;
10493
10656
  const svg = svgRef.current;
10494
10657
  const rect = svg.getBoundingClientRect();
@@ -10508,7 +10671,7 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10508
10671
  y: (clientY - rect.top) / scale
10509
10672
  };
10510
10673
  }, [scale]);
10511
- const handleStart = (0, import_react43.useCallback)((e) => {
10674
+ const handleStart = (0, import_react44.useCallback)((e) => {
10512
10675
  if (!isActive) return;
10513
10676
  const point = getPoint(e);
10514
10677
  if (point) {
@@ -10516,14 +10679,14 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10516
10679
  setCurrentPath([point]);
10517
10680
  }
10518
10681
  }, [isActive, getPoint]);
10519
- const handleMove = (0, import_react43.useCallback)((e) => {
10682
+ const handleMove = (0, import_react44.useCallback)((e) => {
10520
10683
  if (!isDrawing || !isActive) return;
10521
10684
  const point = getPoint(e);
10522
10685
  if (point) {
10523
10686
  setCurrentPath((prev) => [...prev, point]);
10524
10687
  }
10525
10688
  }, [isDrawing, isActive, getPoint]);
10526
- const handleEnd = (0, import_react43.useCallback)(() => {
10689
+ const handleEnd = (0, import_react44.useCallback)(() => {
10527
10690
  if (!isDrawing) return;
10528
10691
  setIsDrawing(false);
10529
10692
  if (currentPath.length >= 2) {
@@ -10532,7 +10695,7 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10532
10695
  }
10533
10696
  setCurrentPath([]);
10534
10697
  }, [isDrawing, currentPath, onDrawingComplete]);
10535
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10698
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10536
10699
  "svg",
10537
10700
  {
10538
10701
  ref: svgRef,
@@ -10552,7 +10715,7 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10552
10715
  onTouchStart: handleStart,
10553
10716
  onTouchMove: handleMove,
10554
10717
  onTouchEnd: handleEnd,
10555
- children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10718
+ children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10556
10719
  "path",
10557
10720
  {
10558
10721
  d: pointsToSvgPath(currentPath),
@@ -10569,10 +10732,10 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10569
10732
  });
10570
10733
 
10571
10734
  // src/components/Annotations/ShapeRenderer.tsx
10572
- var import_react44 = require("react");
10735
+ var import_react45 = require("react");
10573
10736
  init_utils();
10574
- var import_jsx_runtime30 = require("react/jsx-runtime");
10575
- var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10737
+ var import_jsx_runtime31 = require("react/jsx-runtime");
10738
+ var ShapeRenderer = (0, import_react45.memo)(function ShapeRenderer2({
10576
10739
  shape,
10577
10740
  scale,
10578
10741
  isSelected,
@@ -10582,18 +10745,18 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10582
10745
  onDelete: _onDelete,
10583
10746
  className
10584
10747
  }) {
10585
- const [_isDragging, setIsDragging] = (0, import_react44.useState)(false);
10586
- const [_isResizing, setIsResizing] = (0, import_react44.useState)(false);
10587
- const [activeHandle, setActiveHandle] = (0, import_react44.useState)(null);
10588
- const startPosRef = (0, import_react44.useRef)({ x: 0, y: 0 });
10589
- const startShapeRef = (0, import_react44.useRef)({ x: 0, y: 0, width: 0, height: 0 });
10748
+ const [_isDragging, setIsDragging] = (0, import_react45.useState)(false);
10749
+ const [_isResizing, setIsResizing] = (0, import_react45.useState)(false);
10750
+ const [activeHandle, setActiveHandle] = (0, import_react45.useState)(null);
10751
+ const startPosRef = (0, import_react45.useRef)({ x: 0, y: 0 });
10752
+ const startShapeRef = (0, import_react45.useRef)({ x: 0, y: 0, width: 0, height: 0 });
10590
10753
  const { shapeType, x, y, width, height, color, strokeWidth, id: _id } = shape;
10591
10754
  const scaledX = x * scale;
10592
10755
  const scaledY = y * scale;
10593
10756
  const scaledWidth = width * scale;
10594
10757
  const scaledHeight = height * scale;
10595
10758
  const scaledStroke = strokeWidth * scale;
10596
- const getResizeHandles = (0, import_react44.useCallback)(() => {
10759
+ const getResizeHandles = (0, import_react45.useCallback)(() => {
10597
10760
  const handleSize = 8;
10598
10761
  const half = handleSize / 2;
10599
10762
  return [
@@ -10607,7 +10770,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10607
10770
  { position: "w", cursor: "ew-resize", x: scaledX - half, y: scaledY + scaledHeight / 2 - half }
10608
10771
  ];
10609
10772
  }, [scaledX, scaledY, scaledWidth, scaledHeight]);
10610
- const handleMouseDown = (0, import_react44.useCallback)((e, handle) => {
10773
+ const handleMouseDown = (0, import_react45.useCallback)((e, handle) => {
10611
10774
  e.stopPropagation();
10612
10775
  onSelect?.();
10613
10776
  if (!isEditing) return;
@@ -10683,7 +10846,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10683
10846
  document.addEventListener("mousemove", handleMouseMove);
10684
10847
  document.addEventListener("mouseup", handleMouseUp);
10685
10848
  }, [isEditing, x, y, width, height, scale, onSelect, onUpdate]);
10686
- const renderShape2 = (0, import_react44.useCallback)(() => {
10849
+ const renderShape2 = (0, import_react45.useCallback)(() => {
10687
10850
  const commonProps = {
10688
10851
  stroke: color,
10689
10852
  strokeWidth: scaledStroke,
@@ -10695,7 +10858,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10695
10858
  };
10696
10859
  switch (shapeType) {
10697
10860
  case "rect":
10698
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10861
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10699
10862
  "rect",
10700
10863
  {
10701
10864
  x: scaledX,
@@ -10706,7 +10869,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10706
10869
  }
10707
10870
  );
10708
10871
  case "circle":
10709
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10872
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10710
10873
  "ellipse",
10711
10874
  {
10712
10875
  cx: scaledX + scaledWidth / 2,
@@ -10717,7 +10880,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10717
10880
  }
10718
10881
  );
10719
10882
  case "line":
10720
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10883
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10721
10884
  "line",
10722
10885
  {
10723
10886
  x1: scaledX,
@@ -10737,22 +10900,22 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10737
10900
  const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
10738
10901
  const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
10739
10902
  const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
10740
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("g", { children: [
10741
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: scaledX, y1: scaledY, x2: endX, y2: endY, ...commonProps }),
10742
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
10743
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
10903
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("g", { children: [
10904
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: scaledX, y1: scaledY, x2: endX, y2: endY, ...commonProps }),
10905
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
10906
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
10744
10907
  ] });
10745
10908
  default:
10746
10909
  return null;
10747
10910
  }
10748
10911
  }, [shapeType, scaledX, scaledY, scaledWidth, scaledHeight, color, scaledStroke, isSelected]);
10749
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
10912
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
10750
10913
  "g",
10751
10914
  {
10752
10915
  className: cn("shape-renderer", className),
10753
10916
  onMouseDown: (e) => handleMouseDown(e),
10754
10917
  children: [
10755
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10918
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10756
10919
  "rect",
10757
10920
  {
10758
10921
  x: scaledX - 5,
@@ -10765,7 +10928,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10765
10928
  }
10766
10929
  ),
10767
10930
  renderShape2(),
10768
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10931
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10769
10932
  "rect",
10770
10933
  {
10771
10934
  x: scaledX - 2,
@@ -10778,7 +10941,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10778
10941
  strokeDasharray: "4 2"
10779
10942
  }
10780
10943
  ),
10781
- isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10944
+ isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10782
10945
  "rect",
10783
10946
  {
10784
10947
  x: handle.x,
@@ -10798,7 +10961,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10798
10961
  }
10799
10962
  );
10800
10963
  });
10801
- var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10964
+ var ShapePreview = (0, import_react45.memo)(function ShapePreview2({
10802
10965
  shapeType,
10803
10966
  startPoint,
10804
10967
  endPoint,
@@ -10819,9 +10982,9 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10819
10982
  };
10820
10983
  switch (shapeType) {
10821
10984
  case "rect":
10822
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("rect", { x, y, width, height, ...commonProps });
10985
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("rect", { x, y, width, height, ...commonProps });
10823
10986
  case "circle":
10824
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10987
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10825
10988
  "ellipse",
10826
10989
  {
10827
10990
  cx: x + width / 2,
@@ -10832,7 +10995,7 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10832
10995
  }
10833
10996
  );
10834
10997
  case "line":
10835
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10998
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10836
10999
  "line",
10837
11000
  {
10838
11001
  x1: startPoint.x * scale,
@@ -10854,8 +11017,8 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10854
11017
  const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
10855
11018
  const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
10856
11019
  const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
10857
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("g", { children: [
10858
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
11020
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("g", { children: [
11021
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10859
11022
  "line",
10860
11023
  {
10861
11024
  x1: startPoint.x * scale,
@@ -10865,8 +11028,8 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10865
11028
  ...commonProps
10866
11029
  }
10867
11030
  ),
10868
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
10869
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
11031
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
11032
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
10870
11033
  ] });
10871
11034
  default:
10872
11035
  return null;
@@ -10874,10 +11037,10 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10874
11037
  });
10875
11038
 
10876
11039
  // src/components/Annotations/QuickNoteButton.tsx
10877
- var import_react45 = require("react");
11040
+ var import_react46 = require("react");
10878
11041
  init_utils();
10879
- var import_jsx_runtime31 = require("react/jsx-runtime");
10880
- var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
11042
+ var import_jsx_runtime32 = require("react/jsx-runtime");
11043
+ var QuickNoteButton = (0, import_react46.memo)(function QuickNoteButton2({
10881
11044
  pageNumber,
10882
11045
  scale,
10883
11046
  position = "top-right",
@@ -10885,8 +11048,8 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10885
11048
  className,
10886
11049
  visible = true
10887
11050
  }) {
10888
- const [isHovered, setIsHovered] = (0, import_react45.useState)(false);
10889
- const handleClick = (0, import_react45.useCallback)(
11051
+ const [isHovered, setIsHovered] = (0, import_react46.useState)(false);
11052
+ const handleClick = (0, import_react46.useCallback)(
10890
11053
  (e) => {
10891
11054
  e.stopPropagation();
10892
11055
  const x = position === "top-right" ? 80 : 80;
@@ -10898,7 +11061,7 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10898
11061
  if (!visible) {
10899
11062
  return null;
10900
11063
  }
10901
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
11064
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
10902
11065
  "button",
10903
11066
  {
10904
11067
  onClick: handleClick,
@@ -10920,7 +11083,7 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10920
11083
  ),
10921
11084
  title: "Add quick note",
10922
11085
  "aria-label": "Add quick note",
10923
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
11086
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
10924
11087
  "svg",
10925
11088
  {
10926
11089
  className: "w-4 h-4 text-yellow-900",
@@ -10928,7 +11091,7 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10928
11091
  viewBox: "0 0 24 24",
10929
11092
  stroke: "currentColor",
10930
11093
  strokeWidth: 2,
10931
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4v16m8-8H4" })
11094
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4v16m8-8H4" })
10932
11095
  }
10933
11096
  )
10934
11097
  }
@@ -10936,10 +11099,10 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10936
11099
  });
10937
11100
 
10938
11101
  // src/components/Annotations/QuickNotePopover.tsx
10939
- var import_react46 = require("react");
11102
+ var import_react47 = require("react");
10940
11103
  init_utils();
10941
- var import_jsx_runtime32 = require("react/jsx-runtime");
10942
- var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11104
+ var import_jsx_runtime33 = require("react/jsx-runtime");
11105
+ var QuickNotePopover = (0, import_react47.memo)(function QuickNotePopover2({
10943
11106
  visible,
10944
11107
  position,
10945
11108
  initialContent = "",
@@ -10948,21 +11111,21 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
10948
11111
  onCancel,
10949
11112
  className
10950
11113
  }) {
10951
- const [content, setContent] = (0, import_react46.useState)(initialContent);
10952
- const textareaRef = (0, import_react46.useRef)(null);
10953
- const popoverRef = (0, import_react46.useRef)(null);
10954
- const [adjustedPosition, setAdjustedPosition] = (0, import_react46.useState)(position);
10955
- (0, import_react46.useEffect)(() => {
11114
+ const [content, setContent] = (0, import_react47.useState)(initialContent);
11115
+ const textareaRef = (0, import_react47.useRef)(null);
11116
+ const popoverRef = (0, import_react47.useRef)(null);
11117
+ const [adjustedPosition, setAdjustedPosition] = (0, import_react47.useState)(position);
11118
+ (0, import_react47.useEffect)(() => {
10956
11119
  if (visible && textareaRef.current) {
10957
11120
  textareaRef.current.focus();
10958
11121
  }
10959
11122
  }, [visible]);
10960
- (0, import_react46.useEffect)(() => {
11123
+ (0, import_react47.useEffect)(() => {
10961
11124
  if (visible) {
10962
11125
  setContent(initialContent);
10963
11126
  }
10964
11127
  }, [visible, initialContent]);
10965
- (0, import_react46.useEffect)(() => {
11128
+ (0, import_react47.useEffect)(() => {
10966
11129
  if (!visible || !popoverRef.current) return;
10967
11130
  const rect = popoverRef.current.getBoundingClientRect();
10968
11131
  const padding = 10;
@@ -10981,14 +11144,14 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
10981
11144
  }
10982
11145
  setAdjustedPosition({ x, y });
10983
11146
  }, [position, visible]);
10984
- const handleSave = (0, import_react46.useCallback)(() => {
11147
+ const handleSave = (0, import_react47.useCallback)(() => {
10985
11148
  if (content.trim()) {
10986
11149
  onSave(content.trim());
10987
11150
  } else {
10988
11151
  onCancel();
10989
11152
  }
10990
11153
  }, [content, onSave, onCancel]);
10991
- const handleKeyDown = (0, import_react46.useCallback)(
11154
+ const handleKeyDown = (0, import_react47.useCallback)(
10992
11155
  (e) => {
10993
11156
  if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
10994
11157
  e.preventDefault();
@@ -11003,7 +11166,7 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11003
11166
  if (!visible) {
11004
11167
  return null;
11005
11168
  }
11006
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
11169
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
11007
11170
  "div",
11008
11171
  {
11009
11172
  ref: popoverRef,
@@ -11022,15 +11185,15 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11022
11185
  top: adjustedPosition.y
11023
11186
  },
11024
11187
  children: [
11025
- agentLastStatement && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-start gap-1", children: [
11026
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3 h-3 mt-0.5 flex-shrink-0", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }) }),
11027
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "line-clamp-2", children: [
11188
+ agentLastStatement && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-start gap-1", children: [
11189
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { className: "w-3 h-3 mt-0.5 flex-shrink-0", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("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" }) }),
11190
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "line-clamp-2", children: [
11028
11191
  "AI discussed: \u201C",
11029
11192
  agentLastStatement,
11030
11193
  "\u201D"
11031
11194
  ] })
11032
11195
  ] }) }),
11033
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11196
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11034
11197
  "textarea",
11035
11198
  {
11036
11199
  ref: textareaRef,
@@ -11049,13 +11212,13 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11049
11212
  )
11050
11213
  }
11051
11214
  ),
11052
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between mt-2", children: [
11053
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
11215
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between mt-2", children: [
11216
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
11054
11217
  navigator.platform.includes("Mac") ? "\u2318" : "Ctrl",
11055
11218
  "+Enter to save"
11056
11219
  ] }),
11057
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
11058
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11220
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-2", children: [
11221
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11059
11222
  "button",
11060
11223
  {
11061
11224
  onClick: onCancel,
@@ -11068,7 +11231,7 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11068
11231
  children: "Cancel"
11069
11232
  }
11070
11233
  ),
11071
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11234
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11072
11235
  "button",
11073
11236
  {
11074
11237
  onClick: handleSave,
@@ -11091,10 +11254,10 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11091
11254
  });
11092
11255
 
11093
11256
  // src/components/AskAbout/AskAboutOverlay.tsx
11094
- var import_react47 = require("react");
11257
+ var import_react48 = require("react");
11095
11258
  init_utils();
11096
- var import_jsx_runtime33 = require("react/jsx-runtime");
11097
- var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11259
+ var import_jsx_runtime34 = require("react/jsx-runtime");
11260
+ var AskAboutOverlay = (0, import_react48.memo)(function AskAboutOverlay2({
11098
11261
  visible,
11099
11262
  progress,
11100
11263
  position,
@@ -11108,7 +11271,7 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11108
11271
  const radius = (size - strokeWidth) / 2;
11109
11272
  const circumference = 2 * Math.PI * radius;
11110
11273
  const strokeDashoffset = circumference * (1 - progress);
11111
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
11274
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
11112
11275
  "div",
11113
11276
  {
11114
11277
  className: cn(
@@ -11121,7 +11284,7 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11121
11284
  top: position.y - size / 2
11122
11285
  },
11123
11286
  children: [
11124
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
11287
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
11125
11288
  "svg",
11126
11289
  {
11127
11290
  width: size,
@@ -11129,7 +11292,7 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11129
11292
  viewBox: `0 0 ${size} ${size}`,
11130
11293
  className: "transform -rotate-90",
11131
11294
  children: [
11132
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11295
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11133
11296
  "circle",
11134
11297
  {
11135
11298
  cx: size / 2,
@@ -11140,7 +11303,7 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11140
11303
  strokeWidth
11141
11304
  }
11142
11305
  ),
11143
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11306
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11144
11307
  "circle",
11145
11308
  {
11146
11309
  cx: size / 2,
@@ -11158,12 +11321,12 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11158
11321
  ]
11159
11322
  }
11160
11323
  ),
11161
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11324
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11162
11325
  "div",
11163
11326
  {
11164
11327
  className: "absolute inset-0 flex items-center justify-center",
11165
11328
  style: { color: progress >= 1 ? "#22c55e" : "white" },
11166
- children: progress >= 1 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11329
+ children: progress >= 1 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11167
11330
  "svg",
11168
11331
  {
11169
11332
  width: "24",
@@ -11174,9 +11337,9 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11174
11337
  strokeWidth: "2",
11175
11338
  strokeLinecap: "round",
11176
11339
  strokeLinejoin: "round",
11177
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polyline", { points: "20 6 9 17 4 12" })
11340
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("polyline", { points: "20 6 9 17 4 12" })
11178
11341
  }
11179
- ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
11342
+ ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
11180
11343
  "svg",
11181
11344
  {
11182
11345
  width: "20",
@@ -11188,9 +11351,9 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11188
11351
  strokeLinecap: "round",
11189
11352
  strokeLinejoin: "round",
11190
11353
  children: [
11191
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
11192
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
11193
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
11354
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
11355
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
11356
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
11194
11357
  ]
11195
11358
  }
11196
11359
  )
@@ -11202,10 +11365,10 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11202
11365
  });
11203
11366
 
11204
11367
  // src/components/AskAbout/AskAboutTrigger.tsx
11205
- var import_react48 = require("react");
11368
+ var import_react49 = require("react");
11206
11369
  init_utils();
11207
- var import_jsx_runtime34 = require("react/jsx-runtime");
11208
- var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11370
+ var import_jsx_runtime35 = require("react/jsx-runtime");
11371
+ var AskAboutTrigger = (0, import_react49.memo)(function AskAboutTrigger2({
11209
11372
  position,
11210
11373
  onConfirm,
11211
11374
  onCancel,
@@ -11213,9 +11376,9 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11213
11376
  autoHideDelay = 5e3,
11214
11377
  className
11215
11378
  }) {
11216
- const [adjustedPosition, setAdjustedPosition] = (0, import_react48.useState)(position);
11217
- const triggerRef = (0, import_react48.useRef)(null);
11218
- (0, import_react48.useEffect)(() => {
11379
+ const [adjustedPosition, setAdjustedPosition] = (0, import_react49.useState)(position);
11380
+ const triggerRef = (0, import_react49.useRef)(null);
11381
+ (0, import_react49.useEffect)(() => {
11219
11382
  if (!visible || !triggerRef.current) return;
11220
11383
  const rect = triggerRef.current.getBoundingClientRect();
11221
11384
  const padding = 10;
@@ -11231,19 +11394,19 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11231
11394
  }
11232
11395
  setAdjustedPosition({ x, y });
11233
11396
  }, [position, visible]);
11234
- (0, import_react48.useEffect)(() => {
11397
+ (0, import_react49.useEffect)(() => {
11235
11398
  if (!visible || autoHideDelay === 0) return;
11236
11399
  const timer = setTimeout(onCancel, autoHideDelay);
11237
11400
  return () => clearTimeout(timer);
11238
11401
  }, [visible, autoHideDelay, onCancel]);
11239
- const handleConfirm = (0, import_react48.useCallback)(
11402
+ const handleConfirm = (0, import_react49.useCallback)(
11240
11403
  (e) => {
11241
11404
  e.stopPropagation();
11242
11405
  onConfirm();
11243
11406
  },
11244
11407
  [onConfirm]
11245
11408
  );
11246
- const handleCancel = (0, import_react48.useCallback)(
11409
+ const handleCancel = (0, import_react49.useCallback)(
11247
11410
  (e) => {
11248
11411
  e.stopPropagation();
11249
11412
  onCancel();
@@ -11253,7 +11416,7 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11253
11416
  if (!visible) {
11254
11417
  return null;
11255
11418
  }
11256
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
11419
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
11257
11420
  "div",
11258
11421
  {
11259
11422
  ref: triggerRef,
@@ -11272,8 +11435,8 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11272
11435
  transform: "translate(-50%, 0)"
11273
11436
  },
11274
11437
  children: [
11275
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-sm text-gray-600 dark:text-gray-300 px-2", children: "Ask about this?" }),
11276
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11438
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-sm text-gray-600 dark:text-gray-300 px-2", children: "Ask about this?" }),
11439
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11277
11440
  "button",
11278
11441
  {
11279
11442
  onClick: handleConfirm,
@@ -11286,7 +11449,7 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11286
11449
  children: "Ask"
11287
11450
  }
11288
11451
  ),
11289
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11452
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11290
11453
  "button",
11291
11454
  {
11292
11455
  onClick: handleCancel,
@@ -11306,11 +11469,11 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11306
11469
  });
11307
11470
 
11308
11471
  // src/components/Minimap/Minimap.tsx
11309
- var import_react49 = require("react");
11472
+ var import_react50 = require("react");
11310
11473
  init_hooks();
11311
11474
  init_utils();
11312
- var import_jsx_runtime35 = require("react/jsx-runtime");
11313
- var PageIndicator = (0, import_react49.memo)(function PageIndicator2({
11475
+ var import_jsx_runtime36 = require("react/jsx-runtime");
11476
+ var PageIndicator = (0, import_react50.memo)(function PageIndicator2({
11314
11477
  pageNumber,
11315
11478
  status,
11316
11479
  isBookmarked,
@@ -11324,7 +11487,7 @@ var PageIndicator = (0, import_react49.memo)(function PageIndicator2({
11324
11487
  if (status === "visited") return "bg-green-400";
11325
11488
  return "bg-gray-200 dark:bg-gray-700";
11326
11489
  };
11327
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
11490
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
11328
11491
  "button",
11329
11492
  {
11330
11493
  onClick,
@@ -11340,13 +11503,13 @@ var PageIndicator = (0, import_react49.memo)(function PageIndicator2({
11340
11503
  title: `Page ${pageNumber}${isBookmarked ? " (bookmarked)" : ""}`,
11341
11504
  "aria-label": `Go to page ${pageNumber}`,
11342
11505
  children: [
11343
- isBookmarked && !compact && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-yellow-500 rounded-full border border-white" }),
11344
- showNumber && !compact && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-medium text-white", children: pageNumber })
11506
+ isBookmarked && !compact && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-yellow-500 rounded-full border border-white" }),
11507
+ showNumber && !compact && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-medium text-white", children: pageNumber })
11345
11508
  ]
11346
11509
  }
11347
11510
  );
11348
11511
  });
11349
- var Minimap = (0, import_react49.memo)(function Minimap2({
11512
+ var Minimap = (0, import_react50.memo)(function Minimap2({
11350
11513
  variant = "sidebar",
11351
11514
  floatingPosition = "right",
11352
11515
  maxHeight = 300,
@@ -11359,18 +11522,18 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11359
11522
  const currentPage = useViewerStore((s) => s.currentPage);
11360
11523
  const numPages = useViewerStore((s) => s.numPages);
11361
11524
  const goToPage = useViewerStore((s) => s.goToPage);
11362
- const bookmarkedPages = (0, import_react49.useMemo)(() => {
11525
+ const bookmarkedPages = (0, import_react50.useMemo)(() => {
11363
11526
  return new Set(bookmarks.map((b) => b.pageNumber));
11364
11527
  }, [bookmarks]);
11365
11528
  const compact = numPages > 50;
11366
- const handlePageClick = (0, import_react49.useCallback)(
11529
+ const handlePageClick = (0, import_react50.useCallback)(
11367
11530
  (pageNumber) => {
11368
11531
  goToPage(pageNumber);
11369
11532
  onPageClick?.(pageNumber);
11370
11533
  },
11371
11534
  [goToPage, onPageClick]
11372
11535
  );
11373
- const getPageStatus = (0, import_react49.useCallback)(
11536
+ const getPageStatus = (0, import_react50.useCallback)(
11374
11537
  (pageNumber) => {
11375
11538
  if (pageNumber === currentPage) return "current";
11376
11539
  if (bookmarkedPages.has(pageNumber)) return "bookmarked";
@@ -11379,11 +11542,11 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11379
11542
  },
11380
11543
  [currentPage, visitedPages, bookmarkedPages]
11381
11544
  );
11382
- const pageIndicators = (0, import_react49.useMemo)(() => {
11545
+ const pageIndicators = (0, import_react50.useMemo)(() => {
11383
11546
  const pages = [];
11384
11547
  for (let i = 1; i <= numPages; i++) {
11385
11548
  pages.push(
11386
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11549
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11387
11550
  PageIndicator,
11388
11551
  {
11389
11552
  pageNumber: i,
@@ -11404,16 +11567,16 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11404
11567
  if (numPages === 0) {
11405
11568
  return null;
11406
11569
  }
11407
- const content = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
11408
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mb-3", children: [
11409
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mb-1", children: [
11410
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Progress" }),
11411
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
11570
+ const content = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
11571
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mb-3", children: [
11572
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mb-1", children: [
11573
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Progress" }),
11574
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
11412
11575
  progressPercentage,
11413
11576
  "%"
11414
11577
  ] })
11415
11578
  ] }),
11416
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11579
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11417
11580
  "div",
11418
11581
  {
11419
11582
  className: "h-full bg-green-500 rounded-full transition-all duration-300",
@@ -11421,7 +11584,7 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11421
11584
  }
11422
11585
  ) })
11423
11586
  ] }),
11424
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11587
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11425
11588
  "div",
11426
11589
  {
11427
11590
  className: cn(
@@ -11432,21 +11595,21 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11432
11595
  children: pageIndicators
11433
11596
  }
11434
11597
  ),
11435
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
11436
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
11437
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-blue-500" }),
11438
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Current" })
11598
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
11599
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
11600
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-2 h-2 rounded-sm bg-blue-500" }),
11601
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Current" })
11439
11602
  ] }),
11440
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
11441
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-green-400" }),
11442
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Visited" })
11603
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
11604
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-2 h-2 rounded-sm bg-green-400" }),
11605
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Visited" })
11443
11606
  ] }),
11444
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
11445
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-yellow-400" }),
11446
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Bookmarked" })
11607
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
11608
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-2 h-2 rounded-sm bg-yellow-400" }),
11609
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Bookmarked" })
11447
11610
  ] })
11448
11611
  ] }) }),
11449
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mt-2 text-xs text-gray-500 dark:text-gray-400", children: [
11612
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mt-2 text-xs text-gray-500 dark:text-gray-400", children: [
11450
11613
  visitedCount,
11451
11614
  " of ",
11452
11615
  numPages,
@@ -11454,7 +11617,7 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11454
11617
  ] })
11455
11618
  ] });
11456
11619
  if (variant === "floating") {
11457
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
11620
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
11458
11621
  "div",
11459
11622
  {
11460
11623
  className: cn(
@@ -11470,13 +11633,13 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11470
11633
  ),
11471
11634
  style: { maxHeight },
11472
11635
  children: [
11473
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2", children: "Reading Progress" }),
11636
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2", children: "Reading Progress" }),
11474
11637
  content
11475
11638
  ]
11476
11639
  }
11477
11640
  );
11478
11641
  }
11479
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11642
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11480
11643
  "div",
11481
11644
  {
11482
11645
  className: cn(
@@ -11494,13 +11657,13 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11494
11657
  init_FloatingZoomControls2();
11495
11658
 
11496
11659
  // src/components/PDFThumbnailNav/PDFThumbnailNav.tsx
11497
- var import_react50 = require("react");
11660
+ var import_react51 = require("react");
11498
11661
  init_hooks();
11499
11662
  init_utils();
11500
- var import_jsx_runtime36 = require("react/jsx-runtime");
11663
+ var import_jsx_runtime37 = require("react/jsx-runtime");
11501
11664
  var DEFAULT_WIDTH = 612;
11502
11665
  var DEFAULT_HEIGHT = 792;
11503
- var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11666
+ var PDFThumbnailNav = (0, import_react51.memo)(function PDFThumbnailNav2({
11504
11667
  thumbnailScale = 0.15,
11505
11668
  orientation = "vertical",
11506
11669
  maxVisible = 10,
@@ -11511,14 +11674,14 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11511
11674
  }) {
11512
11675
  const { document: document2, numPages, currentPage } = usePDFViewer();
11513
11676
  const { viewerStore } = usePDFViewerStores();
11514
- const containerRef = (0, import_react50.useRef)(null);
11515
- const [thumbnails, setThumbnails] = (0, import_react50.useState)(/* @__PURE__ */ new Map());
11516
- const [visibleRange, setVisibleRange] = (0, import_react50.useState)({ start: 1, end: maxVisible });
11517
- const renderQueueRef = (0, import_react50.useRef)(/* @__PURE__ */ new Set());
11518
- const pageCache = (0, import_react50.useRef)(/* @__PURE__ */ new Map());
11677
+ const containerRef = (0, import_react51.useRef)(null);
11678
+ const [thumbnails, setThumbnails] = (0, import_react51.useState)(/* @__PURE__ */ new Map());
11679
+ const [visibleRange, setVisibleRange] = (0, import_react51.useState)({ start: 1, end: maxVisible });
11680
+ const renderQueueRef = (0, import_react51.useRef)(/* @__PURE__ */ new Set());
11681
+ const pageCache = (0, import_react51.useRef)(/* @__PURE__ */ new Map());
11519
11682
  const thumbnailWidth = Math.floor(DEFAULT_WIDTH * thumbnailScale);
11520
11683
  const thumbnailHeight = Math.floor(DEFAULT_HEIGHT * thumbnailScale);
11521
- const updateVisibleRange = (0, import_react50.useCallback)(() => {
11684
+ const updateVisibleRange = (0, import_react51.useCallback)(() => {
11522
11685
  if (!containerRef.current || numPages === 0) return;
11523
11686
  const container = containerRef.current;
11524
11687
  const isHorizontal2 = orientation === "horizontal";
@@ -11530,7 +11693,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11530
11693
  const lastVisible = Math.min(numPages, firstVisible + visibleCount);
11531
11694
  setVisibleRange({ start: firstVisible, end: lastVisible });
11532
11695
  }, [numPages, orientation, thumbnailWidth, thumbnailHeight, gap]);
11533
- (0, import_react50.useEffect)(() => {
11696
+ (0, import_react51.useEffect)(() => {
11534
11697
  const container = containerRef.current;
11535
11698
  if (!container) return;
11536
11699
  const handleScroll = () => {
@@ -11540,7 +11703,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11540
11703
  updateVisibleRange();
11541
11704
  return () => container.removeEventListener("scroll", handleScroll);
11542
11705
  }, [updateVisibleRange]);
11543
- (0, import_react50.useEffect)(() => {
11706
+ (0, import_react51.useEffect)(() => {
11544
11707
  if (!document2) {
11545
11708
  setThumbnails(/* @__PURE__ */ new Map());
11546
11709
  pageCache.current.clear();
@@ -11591,7 +11754,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11591
11754
  };
11592
11755
  renderThumbnails();
11593
11756
  }, [document2, visibleRange, thumbnailScale, thumbnails]);
11594
- (0, import_react50.useEffect)(() => {
11757
+ (0, import_react51.useEffect)(() => {
11595
11758
  if (!containerRef.current || numPages === 0) return;
11596
11759
  const container = containerRef.current;
11597
11760
  const isHorizontal2 = orientation === "horizontal";
@@ -11607,12 +11770,12 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11607
11770
  });
11608
11771
  }
11609
11772
  }, [currentPage, numPages, orientation, thumbnailWidth, thumbnailHeight, gap]);
11610
- const handleThumbnailClick = (0, import_react50.useCallback)((pageNum) => {
11773
+ const handleThumbnailClick = (0, import_react51.useCallback)((pageNum) => {
11611
11774
  onThumbnailClick?.(pageNum);
11612
11775
  viewerStore.getState().requestScrollToPage(pageNum, "smooth");
11613
11776
  }, [onThumbnailClick, viewerStore]);
11614
11777
  if (!document2 || numPages === 0) {
11615
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11778
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11616
11779
  "div",
11617
11780
  {
11618
11781
  className: cn(
@@ -11633,7 +11796,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11633
11796
  }
11634
11797
  const isHorizontal = orientation === "horizontal";
11635
11798
  const totalSize = numPages * ((isHorizontal ? thumbnailWidth : thumbnailHeight) + gap) - gap;
11636
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11799
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11637
11800
  "div",
11638
11801
  {
11639
11802
  ref: containerRef,
@@ -11647,7 +11810,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11647
11810
  style: {
11648
11811
  ...isHorizontal ? { overflowX: "auto", overflowY: "hidden" } : { overflowX: "hidden", overflowY: "auto" }
11649
11812
  },
11650
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11813
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11651
11814
  "div",
11652
11815
  {
11653
11816
  className: cn(
@@ -11664,7 +11827,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11664
11827
  const thumbnail = thumbnails.get(pageNum);
11665
11828
  const isActive = pageNum === currentPage;
11666
11829
  const isVisible = pageNum >= visibleRange.start && pageNum <= visibleRange.end;
11667
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
11830
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
11668
11831
  "div",
11669
11832
  {
11670
11833
  className: cn(
@@ -11689,7 +11852,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11689
11852
  }
11690
11853
  },
11691
11854
  children: [
11692
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11855
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11693
11856
  "div",
11694
11857
  {
11695
11858
  className: "relative bg-white dark:bg-gray-700",
@@ -11697,7 +11860,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11697
11860
  width: thumbnailWidth,
11698
11861
  height: thumbnailHeight
11699
11862
  },
11700
- children: isVisible && thumbnail?.canvas ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11863
+ children: isVisible && thumbnail?.canvas ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11701
11864
  "img",
11702
11865
  {
11703
11866
  src: thumbnail.canvas.toDataURL(),
@@ -11705,10 +11868,10 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11705
11868
  className: "w-full h-full object-contain",
11706
11869
  loading: "lazy"
11707
11870
  }
11708
- ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-xs", children: pageNum })
11871
+ ) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-xs", children: pageNum })
11709
11872
  }
11710
11873
  ),
11711
- showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11874
+ showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11712
11875
  "div",
11713
11876
  {
11714
11877
  className: cn(
@@ -11731,10 +11894,10 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11731
11894
  });
11732
11895
 
11733
11896
  // src/components/ErrorBoundary/PDFErrorBoundary.tsx
11734
- var import_react51 = require("react");
11897
+ var import_react52 = require("react");
11735
11898
  init_utils();
11736
- var import_jsx_runtime37 = require("react/jsx-runtime");
11737
- var PDFErrorBoundary = class extends import_react51.Component {
11899
+ var import_jsx_runtime38 = require("react/jsx-runtime");
11900
+ var PDFErrorBoundary = class extends import_react52.Component {
11738
11901
  constructor(props) {
11739
11902
  super(props);
11740
11903
  this.handleReset = () => {
@@ -11761,7 +11924,7 @@ var PDFErrorBoundary = class extends import_react51.Component {
11761
11924
  return fallback;
11762
11925
  }
11763
11926
  if (showDefaultUI) {
11764
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11927
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11765
11928
  DefaultErrorUI,
11766
11929
  {
11767
11930
  error,
@@ -11780,7 +11943,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11780
11943
  const isNetworkError = error.message.includes("fetch") || error.message.includes("network") || error.message.includes("Failed to load");
11781
11944
  let title = "Something went wrong";
11782
11945
  let description = error.message;
11783
- let icon = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11946
+ let icon = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11784
11947
  "path",
11785
11948
  {
11786
11949
  strokeLinecap: "round",
@@ -11792,7 +11955,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11792
11955
  if (isPDFError) {
11793
11956
  title = "Unable to load PDF";
11794
11957
  description = "The PDF file could not be loaded. It may be corrupted or in an unsupported format.";
11795
- icon = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11958
+ icon = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11796
11959
  "path",
11797
11960
  {
11798
11961
  strokeLinecap: "round",
@@ -11804,7 +11967,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11804
11967
  } else if (isNetworkError) {
11805
11968
  title = "Network error";
11806
11969
  description = "Unable to fetch the PDF file. Please check your internet connection and try again.";
11807
- icon = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11970
+ icon = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11808
11971
  "path",
11809
11972
  {
11810
11973
  strokeLinecap: "round",
@@ -11814,7 +11977,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11814
11977
  }
11815
11978
  ) });
11816
11979
  }
11817
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
11980
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
11818
11981
  "div",
11819
11982
  {
11820
11983
  className: cn(
@@ -11827,14 +11990,14 @@ function DefaultErrorUI({ error, onReset, className }) {
11827
11990
  ),
11828
11991
  children: [
11829
11992
  icon,
11830
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h2", { className: "mt-4 text-xl font-semibold text-gray-900 dark:text-gray-100", children: title }),
11831
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400 max-w-md", children: description }),
11832
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("details", { className: "mt-4 text-left max-w-md w-full", children: [
11833
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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" }),
11834
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto", children: error.stack || error.message })
11993
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { className: "mt-4 text-xl font-semibold text-gray-900 dark:text-gray-100", children: title }),
11994
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400 max-w-md", children: description }),
11995
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("details", { className: "mt-4 text-left max-w-md w-full", children: [
11996
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("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" }),
11997
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("pre", { className: "mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto", children: error.stack || error.message })
11835
11998
  ] }),
11836
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mt-6 flex gap-3", children: [
11837
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11999
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mt-6 flex gap-3", children: [
12000
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11838
12001
  "button",
11839
12002
  {
11840
12003
  onClick: onReset,
@@ -11848,7 +12011,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11848
12011
  children: "Try again"
11849
12012
  }
11850
12013
  ),
11851
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
12014
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11852
12015
  "button",
11853
12016
  {
11854
12017
  onClick: () => window.location.reload(),
@@ -11868,9 +12031,12 @@ function DefaultErrorUI({ error, onReset, className }) {
11868
12031
  );
11869
12032
  }
11870
12033
  function withErrorBoundary({ component, ...props }) {
11871
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PDFErrorBoundary, { ...props, children: component });
12034
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PDFErrorBoundary, { ...props, children: component });
11872
12035
  }
11873
12036
 
12037
+ // src/components/index.ts
12038
+ init_PDFLoadingScreen2();
12039
+
11874
12040
  // src/index.ts
11875
12041
  init_hooks();
11876
12042
  init_store();
@@ -11902,6 +12068,7 @@ init_utils();
11902
12068
  MobileToolbar,
11903
12069
  OutlinePanel,
11904
12070
  PDFErrorBoundary,
12071
+ PDFLoadingScreen,
11905
12072
  PDFPage,
11906
12073
  PDFThumbnailNav,
11907
12074
  PDFViewer,