pdfjs-reader-core 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -250,8 +250,10 @@ interface StudentModeProps {
250
250
  interface PDFViewerProps {
251
251
  /** URL or ArrayBuffer of the PDF file */
252
252
  src: string | ArrayBuffer | Uint8Array;
253
- /** Initial page number (1-indexed) */
253
+ /** Initial page number (1-indexed) - used in uncontrolled mode */
254
254
  initialPage?: number;
255
+ /** Controlled page - viewer syncs to this value when provided */
256
+ page?: number;
255
257
  /** Initial scale/zoom level. Use 'auto' or 'page-width' to fit to container width. */
256
258
  initialScale?: number | 'page-fit' | 'page-width' | 'auto';
257
259
  /** Theme mode */
@@ -282,6 +284,22 @@ interface PDFViewerProps {
282
284
  onError?: (error: Error) => void;
283
285
  /** Worker source URL for pdf.js */
284
286
  workerSrc?: string;
287
+ /** Callback when a page starts rendering */
288
+ onPageRenderStart?: (pageNumber: number) => void;
289
+ /** Callback when a page finishes rendering */
290
+ onPageRenderComplete?: (pageNumber: number) => void;
291
+ /** Callback when a highlight is added */
292
+ onHighlightAdded?: (highlight: Highlight) => void;
293
+ /** Callback when a highlight is removed */
294
+ onHighlightRemoved?: (highlightId: string) => void;
295
+ /** Callback when an annotation is added */
296
+ onAnnotationAdded?: (annotation: Annotation) => void;
297
+ /** Callback when zoom/scale changes (alias for onScaleChange) */
298
+ onZoomChange?: (scale: number) => void;
299
+ /** Custom loading component */
300
+ loadingComponent?: React.ReactNode;
301
+ /** Custom error component - can be a node or a function receiving error and retry callback */
302
+ errorComponent?: React.ReactNode | ((error: Error, retry: () => void) => React.ReactNode);
285
303
  }
286
304
  interface PDFDocumentLoadedEvent {
287
305
  numPages: number;
@@ -312,6 +330,12 @@ type ViewMode = 'single' | 'dual' | 'continuous';
312
330
  type ScrollMode = 'single' | 'continuous';
313
331
  type SidebarPanel = 'thumbnails' | 'outline' | 'search' | 'annotations' | null;
314
332
  type Theme = 'light' | 'dark' | 'sepia';
333
+ /** Request to scroll to a specific page */
334
+ interface ScrollToPageRequest {
335
+ page: number;
336
+ requestId: string;
337
+ behavior: 'smooth' | 'instant';
338
+ }
315
339
  interface ViewerState {
316
340
  document: PDFDocumentProxy | null;
317
341
  numPages: number;
@@ -320,6 +344,7 @@ interface ViewerState {
320
344
  currentPage: number;
321
345
  scale: number;
322
346
  rotation: number;
347
+ scrollToPageRequest: ScrollToPageRequest | null;
323
348
  viewMode: ViewMode;
324
349
  scrollMode: ScrollMode;
325
350
  theme: Theme;
@@ -336,6 +361,8 @@ interface ViewerActions {
336
361
  goToPage: (page: number) => void;
337
362
  nextPage: () => void;
338
363
  previousPage: () => void;
364
+ requestScrollToPage: (page: number, behavior?: 'smooth' | 'instant') => Promise<void>;
365
+ completeScrollRequest: (requestId: string) => void;
339
366
  setScale: (scale: number) => void;
340
367
  zoomIn: () => void;
341
368
  zoomOut: () => void;
@@ -361,8 +388,8 @@ interface Highlight {
361
388
  comment?: string;
362
389
  createdAt: Date;
363
390
  updatedAt: Date;
364
- /** Source of the highlight: user-created or agent-created */
365
- source?: 'user' | 'agent';
391
+ /** Source of the highlight: user-created, agent-created, or search result */
392
+ source?: 'user' | 'agent' | 'search';
366
393
  }
367
394
  interface HighlightRect {
368
395
  x: number;
@@ -535,6 +562,83 @@ interface SearchOptions {
535
562
  /** Highlight all matches (default: true) */
536
563
  highlightAll?: boolean;
537
564
  }
565
+ interface GoToPageOptions {
566
+ /** Scroll behavior (default: 'smooth') */
567
+ behavior?: 'smooth' | 'instant';
568
+ }
569
+ interface SearchAndHighlightOptions {
570
+ /** Highlight color (default: 'yellow') */
571
+ color?: HighlightColor;
572
+ /** Page range to search - either { start, end } or array of page numbers */
573
+ pageRange?: {
574
+ start: number;
575
+ end: number;
576
+ } | number[];
577
+ /** Case sensitive search (default: false) */
578
+ caseSensitive?: boolean;
579
+ /** Match whole words only (default: false) */
580
+ wholeWord?: boolean;
581
+ /** Scroll to first match (default: true) */
582
+ scrollToFirst?: boolean;
583
+ /** Clear previous search highlights (default: true) */
584
+ clearPrevious?: boolean;
585
+ }
586
+ interface SearchAndHighlightResult {
587
+ /** Total number of matches found */
588
+ matchCount: number;
589
+ /** IDs of created highlights */
590
+ highlightIds: string[];
591
+ /** Detailed match information */
592
+ matches: Array<{
593
+ pageNumber: number;
594
+ text: string;
595
+ highlightId: string;
596
+ rects: HighlightRect[];
597
+ }>;
598
+ }
599
+ interface AgentToolResult<T = void> {
600
+ success: boolean;
601
+ data?: T;
602
+ error?: {
603
+ code: string;
604
+ message: string;
605
+ };
606
+ }
607
+ interface AgentTools {
608
+ /** Navigate to a specific page */
609
+ navigateToPage: (page: number) => Promise<AgentToolResult<{
610
+ previousPage: number;
611
+ currentPage: number;
612
+ }>>;
613
+ /** Highlight text with structured response */
614
+ highlightText: (text: string, options?: HighlightTextOptions) => Promise<AgentToolResult<{
615
+ matchCount: number;
616
+ highlightIds: string[];
617
+ }>>;
618
+ /** Get text content of a specific page */
619
+ getPageContent: (page: number) => Promise<AgentToolResult<{
620
+ text: string;
621
+ }>>;
622
+ /** Clear all visual elements (highlights and annotations) */
623
+ clearAllVisuals: () => Promise<AgentToolResult<void>>;
624
+ }
625
+ interface PageCoordinates {
626
+ x: number;
627
+ y: number;
628
+ }
629
+ interface PageDimensionsInfo {
630
+ width: number;
631
+ height: number;
632
+ rotation: number;
633
+ }
634
+ interface CoordinateHelpers {
635
+ /** Get dimensions of a specific page */
636
+ getPageDimensions: (page: number) => PageDimensionsInfo | null;
637
+ /** Convert percent coordinates (0-100) to pixels */
638
+ percentToPixels: (xPercent: number, yPercent: number, page: number) => PageCoordinates | null;
639
+ /** Convert pixel coordinates to percent (0-100) */
640
+ pixelsToPercent: (x: number, y: number, page: number) => PageCoordinates | null;
641
+ }
538
642
  /**
539
643
  * Imperative handle for PDFViewerClient.
540
644
  * Use this to programmatically control the PDF viewer.
@@ -596,10 +700,12 @@ interface PDFViewerHandle {
596
700
  */
597
701
  clearAnnotations: () => void;
598
702
  /**
599
- * Go to a specific page.
703
+ * Go to a specific page. Returns a Promise that resolves when scroll completes.
600
704
  * @param page - Page number (1-indexed)
705
+ * @param options - Navigation options
706
+ * @returns Promise that resolves when the page is visible
601
707
  */
602
- goToPage: (page: number) => void;
708
+ goToPage: (page: number, options?: GoToPageOptions) => Promise<void>;
603
709
  /**
604
710
  * Go to the next page.
605
711
  */
@@ -652,6 +758,22 @@ interface PDFViewerHandle {
652
758
  * Clear search results.
653
759
  */
654
760
  clearSearch: () => void;
761
+ /**
762
+ * Search for text and highlight all matches in one operation.
763
+ * @param query - Text to search for
764
+ * @param options - Search and highlight options
765
+ * @returns Structured result with match count and highlight IDs
766
+ */
767
+ searchAndHighlight: (query: string, options?: SearchAndHighlightOptions) => Promise<SearchAndHighlightResult>;
768
+ /**
769
+ * Agent-friendly tools with structured responses.
770
+ * Each method returns { success, data?, error? } for easy agent integration.
771
+ */
772
+ agentTools: AgentTools;
773
+ /**
774
+ * Coordinate conversion utilities for working with PDF page coordinates.
775
+ */
776
+ coordinates: CoordinateHelpers;
655
777
  /**
656
778
  * Get the underlying PDF document (pdfjs-dist PDFDocumentProxy).
657
779
  */
@@ -1247,6 +1369,34 @@ interface FloatingZoomControlsProps {
1247
1369
  */
1248
1370
  declare const FloatingZoomControls: react.NamedExoticComponent<FloatingZoomControlsProps>;
1249
1371
 
1372
+ interface PDFThumbnailNavProps {
1373
+ /** Scale for thumbnails (default: 0.15) */
1374
+ thumbnailScale?: number;
1375
+ /** Orientation of the thumbnail strip */
1376
+ orientation?: 'horizontal' | 'vertical';
1377
+ /** Maximum number of thumbnails visible at once */
1378
+ maxVisible?: number;
1379
+ /** Custom class name */
1380
+ className?: string;
1381
+ /** Callback when a thumbnail is clicked */
1382
+ onThumbnailClick?: (page: number) => void;
1383
+ /** Gap between thumbnails in pixels (default: 8) */
1384
+ gap?: number;
1385
+ /** Show page numbers below thumbnails (default: true) */
1386
+ showPageNumbers?: boolean;
1387
+ }
1388
+ /**
1389
+ * PDFThumbnailNav provides a navigable strip of PDF page thumbnails.
1390
+ * Syncs with the current PDF viewer via store subscription.
1391
+ *
1392
+ * Features:
1393
+ * - Virtualized rendering (only visible thumbnails are rendered)
1394
+ * - Auto-scrolls to keep current page visible
1395
+ * - Click to navigate to page
1396
+ * - Horizontal or vertical orientation
1397
+ */
1398
+ declare const PDFThumbnailNav: react.NamedExoticComponent<PDFThumbnailNavProps>;
1399
+
1250
1400
  interface PDFErrorBoundaryProps {
1251
1401
  /** Child components to render */
1252
1402
  children: ReactNode;
@@ -2261,4 +2411,256 @@ declare function createAgentAPI(stores: AgentAPIStores): AgentAPI;
2261
2411
  */
2262
2412
  type AgentAPIInstance = ReturnType<typeof createAgentAPI>;
2263
2413
 
2264
- export { type AddNoteOptions, type AgentAPI, type AgentAPIInstance, type AgentAPIStores, type AgentActions, type AgentContext, type AgentHighlightParams, type AgentState, type AgentStore, type AgentStoreApi, type Annotation, type AnnotationActions, AnnotationLayer, type AnnotationLayerProps, type AnnotationState, type AnnotationStore, type AnnotationStoreApi, type AnnotationTool, AnnotationToolbar, type AnnotationToolbarProps, type AnnotationType, type AskAboutContext, AskAboutOverlay, type AskAboutOverlayProps, AskAboutTrigger, type AskAboutTriggerProps, type Bookmark, BookmarksPanel, type BookmarksPanelProps, CanvasLayer, type CanvasLayerProps, type ContextMenuItem, ContinuousScrollContainer, type ContinuousScrollContainerProps, DocumentContainer, type DocumentContainerProps, type DrawCircleOptions, type DrawRectOptions, type DrawingAnnotation, DrawingCanvas, type DrawingCanvasProps, type DrawingPath, DualPageContainer, type DualPageContainerProps, type ExportData, FloatingZoomControls, type FloatingZoomControlsProps, FocusRegionLayer, type FocusRegionLayerProps, type FocusedRegion, type Highlight, type HighlightColor, HighlightLayer, type HighlightLayerProps, HighlightPopover, type HighlightPopoverProps, type HighlightRect, type HighlightTextOptions, HighlightsPanel, type HighlightsPanelProps, type LoadDocumentOptions, type LoadDocumentResult, Minimap, type MinimapProps, MobileSidebar, type MobileSidebarProps, MobileToolbar, type MobileToolbarProps, type NoteAnnotation, type OutlineItem, OutlinePanel, type OutlinePanelProps, type PDFDocumentLoadedEvent, PDFErrorBoundary, type PDFErrorBoundaryProps, PDFPage, type PDFPageProps, type PDFPageState, type PDFRegion, PDFViewer, PDFViewerClient, PDFViewerContext, type PDFViewerContextValue, type PDFViewerController, type PDFViewerControllerOptions, type PDFViewerEventMap, type PDFViewerHandle, type PDFViewerProps, PDFViewerProvider, type PDFViewerProviderProps, type PageDimensions, type Plugin, type PluginAPI, PluginManager, type PluginManagerOptions, type QuickNote, QuickNoteButton, type QuickNoteButtonProps, QuickNotePopover, type QuickNotePopoverProps, type ScrollMode, type SearchActions, type SearchOptions, SearchPanel, type SearchPanelProps, type SearchResult, type SearchState, type SearchStore, type SearchStoreApi, SelectionToolbar, type SelectionToolbarProps, type ShapeAnnotation, ShapePreview, type ShapePreviewProps, ShapeRenderer, type ShapeRendererProps, type ShapeType, Sidebar, type SidebarPanel, type SidebarPanelConfig, type SidebarProps, StickyNote, type StickyNoteProps, type StoredStudentData, type StudentActions, type StudentData, type StudentModeCallbacks, type StudentModeProps, type StudentState, type StudentStore, type StudentStoreApi, type Takeaway, TakeawaysPanel, type TakeawaysPanelProps, TextLayer, type TextLayerProps, type TextSelection, type Theme, ThumbnailPanel, type ThumbnailPanelProps, Toolbar, type ToolbarItem, type ToolbarProps, type UseAgentContextOptions, type UseAgentContextReturn, type UseAnnotationsOptions, type UseAnnotationsReturn, type UseAskAboutOptions, type UseAskAboutReturn, type UseBookmarksOptions, type UseBookmarksReturn, type UseHighlightsOptions, type UseHighlightsReturn, type UsePageNavigationOptions, type UsePluginsOptions, type UsePluginsReturn, type UseQuickNotesOptions, type UseQuickNotesReturn, type UseStudentProgressOptions, type UseStudentProgressReturn, type UseTextSelectionOptions, type UseTouchGesturesOptions, type UseZoomOptions, type ViewMode, type ViewerActions, type ViewerState, type ViewerStore, type ViewerStoreApi, VirtualizedDocumentContainer, type VirtualizedDocumentContainerProps, type WithErrorBoundaryProps, clearHighlights, clearStudentData, cn, createAgentAPI, createAgentStore, createAnnotationStore, createPDFViewer, createPluginManager, createSearchStore, createStudentStore, createViewerStore, downloadAnnotationsAsJSON, downloadAnnotationsAsMarkdown, downloadFile, exportAnnotationsAsJSON, exportAnnotationsAsMarkdown, exportHighlightsAsJSON, exportHighlightsAsMarkdown, generateDocumentId, getAllDocumentIds, getAllStudentDataDocumentIds, getMetadata, getOutline, getPage, getPageTextContent, getPluginManager, getStorageStats, importHighlightsFromJSON, initializePDFJS, isPDFJSInitialized, loadDocument, loadHighlights, loadStudentData, quickViewer, saveHighlights, saveStudentData, useAgentContext, useAgentStore, useAnnotationStore, useAnnotations, useAskAbout, useBookmarks, useHighlights, useIsMobile, useIsTouchDevice, usePDFViewer, usePDFViewerStores, usePageNavigation, usePlugins, useQuickNotes, useSearchStore, useStudentProgress, useStudentStore, useTextSelection, useTouchGestures, useViewerStore, useZoom, withErrorBoundary };
2414
+ interface TextMatch {
2415
+ /** The matched text */
2416
+ text: string;
2417
+ /** Position rects on the page */
2418
+ rects: HighlightRect[];
2419
+ /** Page number where the match was found */
2420
+ pageNumber: number;
2421
+ /** Character index where the match starts in the page text */
2422
+ startIndex: number;
2423
+ }
2424
+ interface FindTextOptions {
2425
+ /** Case sensitive search (default: false) */
2426
+ caseSensitive?: boolean;
2427
+ /** Match whole words only (default: false) */
2428
+ wholeWord?: boolean;
2429
+ }
2430
+ interface CharPosition {
2431
+ char: string;
2432
+ rect: HighlightRect;
2433
+ }
2434
+ /**
2435
+ * Extract text content with character positions from a PDF page.
2436
+ */
2437
+ declare function extractPageText(document: PDFDocumentProxy, pageNumber: number): Promise<{
2438
+ fullText: string;
2439
+ charPositions: CharPosition[];
2440
+ }>;
2441
+ /**
2442
+ * Find all occurrences of text on a specific page.
2443
+ */
2444
+ declare function findTextOnPage(document: PDFDocumentProxy, pageNumber: number, query: string, options?: FindTextOptions): Promise<TextMatch[]>;
2445
+ /**
2446
+ * Find all occurrences of text across multiple pages.
2447
+ */
2448
+ declare function findTextInDocument(document: PDFDocumentProxy, query: string, options?: FindTextOptions & {
2449
+ pageRange?: number[];
2450
+ }): Promise<TextMatch[]>;
2451
+ /**
2452
+ * Merge adjacent rects into larger rects.
2453
+ */
2454
+ declare function mergeAdjacentRects(rects: HighlightRect[]): HighlightRect[];
2455
+ /**
2456
+ * Get the full text content of a page as a string.
2457
+ */
2458
+ declare function getPageText(document: PDFDocumentProxy, pageNumber: number): Promise<string>;
2459
+ /**
2460
+ * Count occurrences of text on a page without extracting positions.
2461
+ */
2462
+ declare function countTextOnPage(document: PDFDocumentProxy, pageNumber: number, query: string, options?: FindTextOptions): Promise<number>;
2463
+
2464
+ /**
2465
+ * Convert PDF coordinates to viewport (screen) coordinates.
2466
+ * PDF coordinates have origin at bottom-left, viewport at top-left.
2467
+ *
2468
+ * @param x - X coordinate in PDF space
2469
+ * @param y - Y coordinate in PDF space
2470
+ * @param scale - Current zoom scale
2471
+ * @param pageHeight - Height of the page in PDF units
2472
+ * @returns Viewport coordinates { x, y }
2473
+ */
2474
+ declare function pdfToViewport(x: number, y: number, scale: number, pageHeight: number): {
2475
+ x: number;
2476
+ y: number;
2477
+ };
2478
+ /**
2479
+ * Convert viewport (screen) coordinates to PDF coordinates.
2480
+ * Viewport coordinates have origin at top-left, PDF at bottom-left.
2481
+ *
2482
+ * @param x - X coordinate in viewport space
2483
+ * @param y - Y coordinate in viewport space
2484
+ * @param scale - Current zoom scale
2485
+ * @param pageHeight - Height of the page in PDF units
2486
+ * @returns PDF coordinates { x, y }
2487
+ */
2488
+ declare function viewportToPDF(x: number, y: number, scale: number, pageHeight: number): {
2489
+ x: number;
2490
+ y: number;
2491
+ };
2492
+ /**
2493
+ * Convert percentage-based coordinates to PDF coordinates.
2494
+ * Useful for positioning elements based on relative position.
2495
+ *
2496
+ * @param xPercent - X coordinate as percentage (0-100)
2497
+ * @param yPercent - Y coordinate as percentage (0-100)
2498
+ * @param pageWidth - Width of the page in PDF units
2499
+ * @param pageHeight - Height of the page in PDF units
2500
+ * @returns PDF coordinates { x, y }
2501
+ */
2502
+ declare function percentToPDF(xPercent: number, yPercent: number, pageWidth: number, pageHeight: number): {
2503
+ x: number;
2504
+ y: number;
2505
+ };
2506
+ /**
2507
+ * Convert PDF coordinates to percentage-based coordinates.
2508
+ *
2509
+ * @param x - X coordinate in PDF space
2510
+ * @param y - Y coordinate in PDF space
2511
+ * @param pageWidth - Width of the page in PDF units
2512
+ * @param pageHeight - Height of the page in PDF units
2513
+ * @returns Percentage coordinates { x, y } (0-100)
2514
+ */
2515
+ declare function pdfToPercent(x: number, y: number, pageWidth: number, pageHeight: number): {
2516
+ x: number;
2517
+ y: number;
2518
+ };
2519
+ /**
2520
+ * Convert percentage coordinates to viewport (screen) pixels.
2521
+ *
2522
+ * @param xPercent - X coordinate as percentage (0-100)
2523
+ * @param yPercent - Y coordinate as percentage (0-100)
2524
+ * @param pageWidth - Width of the page in PDF units
2525
+ * @param pageHeight - Height of the page in PDF units
2526
+ * @param scale - Current zoom scale
2527
+ * @returns Viewport coordinates { x, y }
2528
+ */
2529
+ declare function percentToViewport(xPercent: number, yPercent: number, pageWidth: number, pageHeight: number, scale: number): {
2530
+ x: number;
2531
+ y: number;
2532
+ };
2533
+ /**
2534
+ * Convert viewport (screen) pixels to percentage coordinates.
2535
+ *
2536
+ * @param x - X coordinate in viewport space
2537
+ * @param y - Y coordinate in viewport space
2538
+ * @param pageWidth - Width of the page in PDF units
2539
+ * @param pageHeight - Height of the page in PDF units
2540
+ * @param scale - Current zoom scale
2541
+ * @returns Percentage coordinates { x, y } (0-100)
2542
+ */
2543
+ declare function viewportToPercent(x: number, y: number, pageWidth: number, pageHeight: number, scale: number): {
2544
+ x: number;
2545
+ y: number;
2546
+ };
2547
+ /**
2548
+ * Apply rotation to coordinates.
2549
+ * Rotates point around the center of the page.
2550
+ *
2551
+ * @param x - X coordinate
2552
+ * @param y - Y coordinate
2553
+ * @param rotation - Rotation in degrees (0, 90, 180, 270)
2554
+ * @param pageWidth - Width of the page
2555
+ * @param pageHeight - Height of the page
2556
+ * @returns Rotated coordinates { x, y }
2557
+ */
2558
+ declare function applyRotation(x: number, y: number, rotation: number, pageWidth: number, pageHeight: number): {
2559
+ x: number;
2560
+ y: number;
2561
+ };
2562
+ /**
2563
+ * Remove rotation from coordinates.
2564
+ * Inverse of applyRotation.
2565
+ *
2566
+ * @param x - X coordinate
2567
+ * @param y - Y coordinate
2568
+ * @param rotation - Rotation in degrees (0, 90, 180, 270)
2569
+ * @param pageWidth - Width of the page (original, before rotation)
2570
+ * @param pageHeight - Height of the page (original, before rotation)
2571
+ * @returns Unrotated coordinates { x, y }
2572
+ */
2573
+ declare function removeRotation(x: number, y: number, rotation: number, pageWidth: number, pageHeight: number): {
2574
+ x: number;
2575
+ y: number;
2576
+ };
2577
+ /**
2578
+ * Calculate the bounding box dimensions after rotation.
2579
+ *
2580
+ * @param width - Original width
2581
+ * @param height - Original height
2582
+ * @param rotation - Rotation in degrees
2583
+ * @returns Rotated dimensions { width, height }
2584
+ */
2585
+ declare function getRotatedDimensions(width: number, height: number, rotation: number): {
2586
+ width: number;
2587
+ height: number;
2588
+ };
2589
+ /**
2590
+ * Convert a rectangle from one coordinate space to another.
2591
+ *
2592
+ * @param rect - Rectangle with x, y, width, height
2593
+ * @param fromScale - Source scale
2594
+ * @param toScale - Target scale
2595
+ * @returns Scaled rectangle
2596
+ */
2597
+ declare function scaleRect(rect: {
2598
+ x: number;
2599
+ y: number;
2600
+ width: number;
2601
+ height: number;
2602
+ }, fromScale: number, toScale: number): {
2603
+ x: number;
2604
+ y: number;
2605
+ width: number;
2606
+ height: number;
2607
+ };
2608
+ /**
2609
+ * Check if a point is inside a rectangle.
2610
+ *
2611
+ * @param point - Point coordinates { x, y }
2612
+ * @param rect - Rectangle { x, y, width, height }
2613
+ * @returns True if point is inside rectangle
2614
+ */
2615
+ declare function isPointInRect(point: {
2616
+ x: number;
2617
+ y: number;
2618
+ }, rect: {
2619
+ x: number;
2620
+ y: number;
2621
+ width: number;
2622
+ height: number;
2623
+ }): boolean;
2624
+ /**
2625
+ * Check if two rectangles intersect.
2626
+ *
2627
+ * @param rectA - First rectangle
2628
+ * @param rectB - Second rectangle
2629
+ * @returns True if rectangles intersect
2630
+ */
2631
+ declare function doRectsIntersect(rectA: {
2632
+ x: number;
2633
+ y: number;
2634
+ width: number;
2635
+ height: number;
2636
+ }, rectB: {
2637
+ x: number;
2638
+ y: number;
2639
+ width: number;
2640
+ height: number;
2641
+ }): boolean;
2642
+ /**
2643
+ * Get the intersection of two rectangles.
2644
+ *
2645
+ * @param rectA - First rectangle
2646
+ * @param rectB - Second rectangle
2647
+ * @returns Intersection rectangle or null if no intersection
2648
+ */
2649
+ declare function getRectIntersection(rectA: {
2650
+ x: number;
2651
+ y: number;
2652
+ width: number;
2653
+ height: number;
2654
+ }, rectB: {
2655
+ x: number;
2656
+ y: number;
2657
+ width: number;
2658
+ height: number;
2659
+ }): {
2660
+ x: number;
2661
+ y: number;
2662
+ width: number;
2663
+ height: number;
2664
+ } | null;
2665
+
2666
+ export { type AddNoteOptions, type AgentAPI, type AgentAPIInstance, type AgentAPIStores, type AgentActions, type AgentContext, type AgentHighlightParams, type AgentState, type AgentStore, type AgentStoreApi, type AgentToolResult, type AgentTools, type Annotation, type AnnotationActions, AnnotationLayer, type AnnotationLayerProps, type AnnotationState, type AnnotationStore, type AnnotationStoreApi, type AnnotationTool, AnnotationToolbar, type AnnotationToolbarProps, type AnnotationType, type AskAboutContext, AskAboutOverlay, type AskAboutOverlayProps, AskAboutTrigger, type AskAboutTriggerProps, type Bookmark, BookmarksPanel, type BookmarksPanelProps, CanvasLayer, type CanvasLayerProps, type CharPosition, type ContextMenuItem, ContinuousScrollContainer, type ContinuousScrollContainerProps, type CoordinateHelpers, DocumentContainer, type DocumentContainerProps, type DrawCircleOptions, type DrawRectOptions, type DrawingAnnotation, DrawingCanvas, type DrawingCanvasProps, type DrawingPath, DualPageContainer, type DualPageContainerProps, type ExportData, type FindTextOptions, FloatingZoomControls, type FloatingZoomControlsProps, FocusRegionLayer, type FocusRegionLayerProps, type FocusedRegion, type GoToPageOptions, type Highlight, type HighlightColor, HighlightLayer, type HighlightLayerProps, HighlightPopover, type HighlightPopoverProps, type HighlightRect, type HighlightTextOptions, HighlightsPanel, type HighlightsPanelProps, type LoadDocumentOptions, type LoadDocumentResult, Minimap, type MinimapProps, MobileSidebar, type MobileSidebarProps, MobileToolbar, type MobileToolbarProps, type NoteAnnotation, type OutlineItem, OutlinePanel, type OutlinePanelProps, type PDFDocumentLoadedEvent, PDFErrorBoundary, type PDFErrorBoundaryProps, PDFPage, type PDFPageProps, type PDFPageState, type PDFRegion, PDFThumbnailNav, type PDFThumbnailNavProps, PDFViewer, PDFViewerClient, PDFViewerContext, type PDFViewerContextValue, type PDFViewerController, type PDFViewerControllerOptions, type PDFViewerEventMap, type PDFViewerHandle, type PDFViewerProps, PDFViewerProvider, type PDFViewerProviderProps, type PageCoordinates, type PageDimensions, type PageDimensionsInfo, type Plugin, type PluginAPI, PluginManager, type PluginManagerOptions, type QuickNote, QuickNoteButton, type QuickNoteButtonProps, QuickNotePopover, type QuickNotePopoverProps, type ScrollMode, type ScrollToPageRequest, type SearchActions, type SearchAndHighlightOptions, type SearchAndHighlightResult, type SearchOptions, SearchPanel, type SearchPanelProps, type SearchResult, type SearchState, type SearchStore, type SearchStoreApi, SelectionToolbar, type SelectionToolbarProps, type ShapeAnnotation, ShapePreview, type ShapePreviewProps, ShapeRenderer, type ShapeRendererProps, type ShapeType, Sidebar, type SidebarPanel, type SidebarPanelConfig, type SidebarProps, StickyNote, type StickyNoteProps, type StoredStudentData, type StudentActions, type StudentData, type StudentModeCallbacks, type StudentModeProps, type StudentState, type StudentStore, type StudentStoreApi, type Takeaway, TakeawaysPanel, type TakeawaysPanelProps, TextLayer, type TextLayerProps, type TextMatch, type TextSelection, type Theme, ThumbnailPanel, type ThumbnailPanelProps, Toolbar, type ToolbarItem, type ToolbarProps, type UseAgentContextOptions, type UseAgentContextReturn, type UseAnnotationsOptions, type UseAnnotationsReturn, type UseAskAboutOptions, type UseAskAboutReturn, type UseBookmarksOptions, type UseBookmarksReturn, type UseHighlightsOptions, type UseHighlightsReturn, type UsePageNavigationOptions, type UsePluginsOptions, type UsePluginsReturn, type UseQuickNotesOptions, type UseQuickNotesReturn, type UseStudentProgressOptions, type UseStudentProgressReturn, type UseTextSelectionOptions, type UseTouchGesturesOptions, type UseZoomOptions, type ViewMode, type ViewerActions, type ViewerState, type ViewerStore, type ViewerStoreApi, VirtualizedDocumentContainer, type VirtualizedDocumentContainerProps, type WithErrorBoundaryProps, applyRotation, clearHighlights, clearStudentData, cn, countTextOnPage, createAgentAPI, createAgentStore, createAnnotationStore, createPDFViewer, createPluginManager, createSearchStore, createStudentStore, createViewerStore, doRectsIntersect, downloadAnnotationsAsJSON, downloadAnnotationsAsMarkdown, downloadFile, exportAnnotationsAsJSON, exportAnnotationsAsMarkdown, exportHighlightsAsJSON, exportHighlightsAsMarkdown, extractPageText, findTextInDocument, findTextOnPage, generateDocumentId, getAllDocumentIds, getAllStudentDataDocumentIds, getMetadata, getOutline, getPage, getPageText, getPageTextContent, getPluginManager, getRectIntersection, getRotatedDimensions, getStorageStats, importHighlightsFromJSON, initializePDFJS, isPDFJSInitialized, isPointInRect, loadDocument, loadHighlights, loadStudentData, mergeAdjacentRects, pdfToPercent, pdfToViewport, percentToPDF, percentToViewport, quickViewer, removeRotation, saveHighlights, saveStudentData, scaleRect, useAgentContext, useAgentStore, useAnnotationStore, useAnnotations, useAskAbout, useBookmarks, useHighlights, useIsMobile, useIsTouchDevice, usePDFViewer, usePDFViewerStores, usePageNavigation, usePlugins, useQuickNotes, useSearchStore, useStudentProgress, useStudentStore, useTextSelection, useTouchGestures, useViewerStore, useZoom, viewportToPDF, viewportToPercent, withErrorBoundary };