hazo_pdf 1.6.6 → 1.7.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/README.md +88 -3
- package/dist/{chunk-LQTYLVBH.js → chunk-4JJOUQ62.js} +143 -35
- package/dist/chunk-4JJOUQ62.js.map +1 -0
- package/dist/chunk-KHB3VZJQ.js +157 -0
- package/dist/chunk-KHB3VZJQ.js.map +1 -0
- package/dist/index.d.ts +194 -1
- package/dist/index.js +1545 -3
- package/dist/index.js.map +1 -1
- package/dist/{pdf_viewer-QC7XPBCP.js → pdf_viewer-B6S5PJJB.js} +2 -2
- package/dist/server/index.d.ts +164 -1
- package/dist/server/index.js +439 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/text_search-2OZOVUIP.js +154 -0
- package/dist/server/text_search-2OZOVUIP.js.map +1 -0
- package/dist/styles/full.css +184 -0
- package/dist/styles/full.css.map +1 -1
- package/dist/styles/index.css +136 -0
- package/dist/styles/index.css.map +1 -1
- package/dist/text_search-I2KZ7DTW.js +11 -0
- package/package.json +7 -3
- package/dist/chunk-FXOJ3DPX.js +0 -71
- package/dist/chunk-FXOJ3DPX.js.map +0 -1
- package/dist/chunk-LQTYLVBH.js.map +0 -1
- package/dist/text_search-GW2VYMU6.js +0 -9
- /package/dist/{pdf_viewer-QC7XPBCP.js.map → pdf_viewer-B6S5PJJB.js.map} +0 -0
- /package/dist/{text_search-GW2VYMU6.js.map → text_search-I2KZ7DTW.js.map} +0 -0
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ A React component library for viewing and annotating PDF documents with support
|
|
|
21
21
|
- ☁️ **Remote Storage** - Load and save PDFs from Google Drive, Dropbox, or local storage (via hazo_files)
|
|
22
22
|
- 🖼️ **Dialog Component** - Ready-to-use modal dialog wrapper (`PdfViewerDialog`)
|
|
23
23
|
- 🔧 **Server Utilities** - Server-side extraction utilities via `hazo_pdf/server` entry point
|
|
24
|
+
- 🔎 **Text Snippet Extraction** - Server-side: find text in a PDF, highlight it, and return a cropped image snippet
|
|
24
25
|
|
|
25
26
|
## Installation
|
|
26
27
|
|
|
@@ -54,6 +55,14 @@ npm install hazo_llm_api
|
|
|
54
55
|
|
|
55
56
|
The `hazo_llm_api` package is an optional peer dependency. When installed, it enables server-side document data extraction via the `hazo_pdf/server` entry point. See [Server-Side Extraction](#server-side-extraction) for details.
|
|
56
57
|
|
|
58
|
+
**@napi-rs/canvas** (optional): For server-side text snippet extraction
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install @napi-rs/canvas
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Required only for the `extract_text_snippet()` server utility. Already installed as a transitive dependency of `pdfjs-dist` in most environments. See [Text Snippet Extraction](#text-snippet-extraction) for details.
|
|
65
|
+
|
|
57
66
|
## CSS Import Options
|
|
58
67
|
|
|
59
68
|
The library provides two CSS files to choose from:
|
|
@@ -924,7 +933,8 @@ You can override any or all of these on a per-highlight basis.
|
|
|
924
933
|
| `doc_data` | `Record<string, unknown>` | `undefined` | General document data to display in the File Info sidepanel. Shown in the "Document Data" section. Can contain any structured data from extraction (strings, numbers, arrays, objects). |
|
|
925
934
|
| `highlight_fields_info` | `HighlightFieldInfo[]` | `undefined` | Array of highlighted/extracted fields to display with special styling. Shown in the "Highlighted Fields" section with field count. Each item has `field_name` (converted to Title Case) and `value` (displayed string). |
|
|
926
935
|
| `file_metadata` | `FileMetadataInput` | `undefined` | Legacy format: Array of file metadata items with filename matching. Each item has `filename` (to match current file) and `file_data` (flexible JSON object with string fields or table arrays). See [File Info Sidepanel](#file-info-sidepanel) section for details. |
|
|
927
|
-
| `
|
|
936
|
+
| `extractions` | `ExtractionEntry[]` | `undefined` | Extraction entries from hazo_files `file_data.raw_data`. Each entry has `id?`, `extracted_at?` (ISO timestamp), `source?` (e.g., "autofill"), and `data` (key-value pairs). Shown in a collapsible "Extractions" section. |
|
|
937
|
+
| `show_file_info_button` | `boolean` | `true` | Show file info sidepanel button in toolbar. Button only appears when at least one of: `doc_data`, `highlight_fields_info`, `file_metadata`, or `extractions` is provided. |
|
|
928
938
|
|
|
929
939
|
##### Custom Stamps
|
|
930
940
|
|
|
@@ -1002,7 +1012,7 @@ Props for managing multiple PDF files. Mutually exclusive with `url` prop.
|
|
|
1002
1012
|
| `on_upload` | `(file: File, converted_pdf?: Uint8Array) => Promise<UploadResult>` | `undefined` | Callback for file upload. Receives original file and optional converted PDF (for non-PDF files). Must return `{ success: boolean, file_id?: string, url?: string, error?: string }`. |
|
|
1003
1013
|
| `on_files_change` | `(files: FileItem[]) => void` | `undefined` | Callback when files array changes (file added, deleted, or reordered). |
|
|
1004
1014
|
| `direct_upload` | `boolean` | `false` | When `true`, clicking "+ Add file" opens the native file picker directly (1-click). The button also accepts drag & drop. When `false` (default), clicking shows a dropzone modal first (2-click). Can also be set via `file_upload.direct_upload` in INI config. |
|
|
1005
|
-
| `enable_popout` | `boolean` | `false` | Enable popout to new tab feature. Shows
|
|
1015
|
+
| `enable_popout` | `boolean` | `false` | Enable popout to new tab feature. Shows "Open in new tab" and "Download" buttons in toolbar. In single-file mode, opens the PDF URL directly; in multi-file mode, uses sessionStorage-based popout. |
|
|
1006
1016
|
| `popout_route` | `string` | `'/pdf-viewer'` | Route path for popout viewer. Used to construct new tab URL. |
|
|
1007
1017
|
| `on_popout` | `(context: PopoutContext) => void` | `undefined` | Custom popout handler. Overrides default sessionStorage behavior. Receives context with file info and annotations. |
|
|
1008
1018
|
| `viewer_title` | `string` | `undefined` | Title for the viewer (shown in dialog mode or popout window). |
|
|
@@ -2199,7 +2209,8 @@ function CompleteSidepanelExample() {
|
|
|
2199
2209
|
1. **Extracted Data** (from `file_metadata`) - if provided
|
|
2200
2210
|
2. **Document Data** (from `doc_data`) - if provided
|
|
2201
2211
|
3. **Highlighted Fields** (from `highlight_fields_info`) - if provided
|
|
2202
|
-
4. **
|
|
2212
|
+
4. **Extractions** (from `extractions`) - if provided, collapsible entries with source/timestamp
|
|
2213
|
+
5. **File System Info** - filename and path
|
|
2203
2214
|
|
|
2204
2215
|
### Integration with Data Extraction
|
|
2205
2216
|
|
|
@@ -2459,6 +2470,80 @@ interface ExtractDocumentResult {
|
|
|
2459
2470
|
|
|
2460
2471
|
---
|
|
2461
2472
|
|
|
2473
|
+
## Text Snippet Extraction
|
|
2474
|
+
|
|
2475
|
+
Extract a cropped image snippet from a PDF with the search text highlighted. Useful for attaching contextual evidence from documents.
|
|
2476
|
+
|
|
2477
|
+
### Basic Usage
|
|
2478
|
+
|
|
2479
|
+
```typescript
|
|
2480
|
+
import { extract_text_snippet } from 'hazo_pdf/server';
|
|
2481
|
+
|
|
2482
|
+
const result = await extract_text_snippet(
|
|
2483
|
+
{ file_path: '/path/to/document.pdf' },
|
|
2484
|
+
{
|
|
2485
|
+
search_text: 'invoice total',
|
|
2486
|
+
snippet_size: 'half', // 'full' | 'half' | 'quarter'
|
|
2487
|
+
match_mode: 'first', // 'first' | 'all'
|
|
2488
|
+
}
|
|
2489
|
+
);
|
|
2490
|
+
|
|
2491
|
+
if (result.success) {
|
|
2492
|
+
for (const snippet of result.snippets) {
|
|
2493
|
+
// snippet.image_buffer - PNG Buffer (for saving to file or API response)
|
|
2494
|
+
// snippet.image_base64 - Base64 PNG (for embedding in HTML/JSON)
|
|
2495
|
+
// snippet.page_index - Which page (0-based)
|
|
2496
|
+
// snippet.matches - Array of match positions
|
|
2497
|
+
// snippet.highlight_approximate - true for image-based PDFs
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
```
|
|
2501
|
+
|
|
2502
|
+
### Snippet Sizes
|
|
2503
|
+
|
|
2504
|
+
All snippet sizes use the full page width. Only the height varies:
|
|
2505
|
+
|
|
2506
|
+
| Size | Dimensions |
|
|
2507
|
+
|------|-----------|
|
|
2508
|
+
| `full` | Full page (W x H) |
|
|
2509
|
+
| `half` | Full width, half height (W x H/2) |
|
|
2510
|
+
| `quarter` | Full width, quarter height (W x H/4) |
|
|
2511
|
+
|
|
2512
|
+
The snippet is centered on the matched text. If multiple matches are found on the same page, the snippet expands to cover all of them.
|
|
2513
|
+
|
|
2514
|
+
### Match Modes
|
|
2515
|
+
|
|
2516
|
+
| Mode | Behavior |
|
|
2517
|
+
|------|----------|
|
|
2518
|
+
| `first` | Returns a single snippet from the first page where text is found |
|
|
2519
|
+
| `all` | Returns one snippet per page that contains the text |
|
|
2520
|
+
|
|
2521
|
+
### Options
|
|
2522
|
+
|
|
2523
|
+
| Option | Type | Default | Description |
|
|
2524
|
+
|--------|------|---------|-------------|
|
|
2525
|
+
| `search_text` | `string` | Required | Text to search for |
|
|
2526
|
+
| `page_index` | `number` | `0` | Page to start searching (0-based) |
|
|
2527
|
+
| `snippet_size` | `SnippetSize` | `'half'` | Crop size relative to page |
|
|
2528
|
+
| `match_mode` | `SnippetMatchMode` | `'first'` | Return first match or all pages |
|
|
2529
|
+
| `render_scale` | `number` | `2.0` | Rendering quality (higher = sharper, larger file) |
|
|
2530
|
+
| `highlight_color` | `string` | `'rgba(255, 255, 0, 0.35)'` | Highlight color (CSS color string) |
|
|
2531
|
+
| `use_llm_for_image_pdf` | `boolean` | `false` | Use LLM vision for image-based PDFs |
|
|
2532
|
+
|
|
2533
|
+
### Image-Based PDFs
|
|
2534
|
+
|
|
2535
|
+
For scanned/image PDFs where text cannot be extracted from the text layer:
|
|
2536
|
+
|
|
2537
|
+
- **Without LLM** (default): Returns full page as the snippet, no highlighting
|
|
2538
|
+
- **With LLM** (`use_llm_for_image_pdf: true`): Uses `hazo_llm_api` vision to find approximate text location and draw a rough highlight
|
|
2539
|
+
|
|
2540
|
+
### Requirements
|
|
2541
|
+
|
|
2542
|
+
- **`@napi-rs/canvas`**: Required for server-side canvas rendering. Usually already installed as a transitive dependency of `pdfjs-dist`.
|
|
2543
|
+
- **Server-only**: This utility runs in Node.js only (not in the browser).
|
|
2544
|
+
|
|
2545
|
+
---
|
|
2546
|
+
|
|
2462
2547
|
## Development
|
|
2463
2548
|
|
|
2464
2549
|
### Setup
|
|
@@ -2047,7 +2047,8 @@ var FileInfoSidepanel = ({
|
|
|
2047
2047
|
file_metadata,
|
|
2048
2048
|
current_filename,
|
|
2049
2049
|
doc_data,
|
|
2050
|
-
highlight_fields_info
|
|
2050
|
+
highlight_fields_info,
|
|
2051
|
+
extractions
|
|
2051
2052
|
}) => {
|
|
2052
2053
|
const [expanded_tables, setExpandedTables] = useState7(/* @__PURE__ */ new Set());
|
|
2053
2054
|
const resize_ref = useRef8(null);
|
|
@@ -2116,6 +2117,7 @@ var FileInfoSidepanel = ({
|
|
|
2116
2117
|
const has_file_info = item !== null;
|
|
2117
2118
|
const has_doc_data = doc_data && Object.keys(doc_data).length > 0;
|
|
2118
2119
|
const has_highlight_info = highlight_fields_info && highlight_fields_info.length > 0;
|
|
2120
|
+
const has_extractions = extractions && extractions.length > 0;
|
|
2119
2121
|
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
2120
2122
|
!is_open && /* @__PURE__ */ jsx8(
|
|
2121
2123
|
"button",
|
|
@@ -2213,7 +2215,74 @@ var FileInfoSidepanel = ({
|
|
|
2213
2215
|
/* @__PURE__ */ jsx8("span", { className: "cls_file_metadata_field_value cls_highlight_value", children: field.value })
|
|
2214
2216
|
] }, idx)) })
|
|
2215
2217
|
] }),
|
|
2216
|
-
|
|
2218
|
+
has_extractions && /* @__PURE__ */ jsxs7("div", { className: "cls_file_info_extractions_section", children: [
|
|
2219
|
+
(has_extracted_data || has_doc_data || has_highlight_info) && /* @__PURE__ */ jsx8("div", { className: "cls_file_info_divider" }),
|
|
2220
|
+
/* @__PURE__ */ jsxs7("div", { className: "cls_file_info_section_header", children: [
|
|
2221
|
+
"Extractions (",
|
|
2222
|
+
extractions.length,
|
|
2223
|
+
")"
|
|
2224
|
+
] }),
|
|
2225
|
+
extractions.map((entry, idx) => {
|
|
2226
|
+
const entry_key = entry.id || `extraction_${idx}`;
|
|
2227
|
+
const is_expanded = expanded_tables.has(entry_key);
|
|
2228
|
+
const timestamp = entry.extracted_at ? new Date(entry.extracted_at).toLocaleString() : void 0;
|
|
2229
|
+
const data_entries = Object.entries(entry.data);
|
|
2230
|
+
return /* @__PURE__ */ jsxs7("div", { className: "cls_file_metadata_table_section", children: [
|
|
2231
|
+
/* @__PURE__ */ jsxs7(
|
|
2232
|
+
"button",
|
|
2233
|
+
{
|
|
2234
|
+
type: "button",
|
|
2235
|
+
onClick: () => toggle_table(entry_key),
|
|
2236
|
+
className: "cls_file_metadata_table_header",
|
|
2237
|
+
"aria-expanded": is_expanded,
|
|
2238
|
+
children: [
|
|
2239
|
+
/* @__PURE__ */ jsx8("span", { className: "cls_file_metadata_table_name", children: entry.source || `Extraction ${idx + 1}` }),
|
|
2240
|
+
timestamp && /* @__PURE__ */ jsx8("span", { className: "cls_file_metadata_table_count", children: timestamp }),
|
|
2241
|
+
is_expanded ? /* @__PURE__ */ jsx8(ChevronUp2, { className: "cls_file_metadata_table_icon", size: 16 }) : /* @__PURE__ */ jsx8(ChevronDown3, { className: "cls_file_metadata_table_icon", size: 16 })
|
|
2242
|
+
]
|
|
2243
|
+
}
|
|
2244
|
+
),
|
|
2245
|
+
is_expanded && /* @__PURE__ */ jsx8("div", { className: "cls_file_metadata_fields", children: data_entries.map(([key, value]) => {
|
|
2246
|
+
if (is_table(value)) {
|
|
2247
|
+
const table_key = `${entry_key}_${key}`;
|
|
2248
|
+
const table_expanded = expanded_tables.has(table_key);
|
|
2249
|
+
return /* @__PURE__ */ jsxs7("div", { className: "cls_file_metadata_table_section", children: [
|
|
2250
|
+
/* @__PURE__ */ jsxs7(
|
|
2251
|
+
"button",
|
|
2252
|
+
{
|
|
2253
|
+
type: "button",
|
|
2254
|
+
onClick: () => toggle_table(table_key),
|
|
2255
|
+
className: "cls_file_metadata_table_header",
|
|
2256
|
+
"aria-expanded": table_expanded,
|
|
2257
|
+
children: [
|
|
2258
|
+
/* @__PURE__ */ jsx8("span", { className: "cls_file_metadata_table_name", children: format_field_name(key) }),
|
|
2259
|
+
/* @__PURE__ */ jsxs7("span", { className: "cls_file_metadata_table_count", children: [
|
|
2260
|
+
"(",
|
|
2261
|
+
value.length,
|
|
2262
|
+
" ",
|
|
2263
|
+
value.length === 1 ? "item" : "items",
|
|
2264
|
+
")"
|
|
2265
|
+
] }),
|
|
2266
|
+
table_expanded ? /* @__PURE__ */ jsx8(ChevronUp2, { className: "cls_file_metadata_table_icon", size: 16 }) : /* @__PURE__ */ jsx8(ChevronDown3, { className: "cls_file_metadata_table_icon", size: 16 })
|
|
2267
|
+
]
|
|
2268
|
+
}
|
|
2269
|
+
),
|
|
2270
|
+
table_expanded && /* @__PURE__ */ jsx8("div", { className: "cls_file_metadata_table_content", children: value.map((row, row_index) => /* @__PURE__ */ jsx8("div", { className: "cls_file_metadata_table_row", children: /* @__PURE__ */ jsx8("table", { className: "cls_file_metadata_row_table", children: /* @__PURE__ */ jsx8("tbody", { children: Object.entries(row).map(([field_name, field_value]) => /* @__PURE__ */ jsxs7("tr", { className: "cls_file_metadata_row_tr", children: [
|
|
2271
|
+
/* @__PURE__ */ jsx8("td", { className: "cls_file_metadata_row_label", children: format_field_name(field_name) }),
|
|
2272
|
+
/* @__PURE__ */ jsx8("td", { className: "cls_file_metadata_row_value", children: field_value })
|
|
2273
|
+
] }, field_name)) }) }) }, row_index)) })
|
|
2274
|
+
] }, key);
|
|
2275
|
+
}
|
|
2276
|
+
const display_value = typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value ?? "");
|
|
2277
|
+
return /* @__PURE__ */ jsxs7("div", { className: "cls_file_metadata_field", children: [
|
|
2278
|
+
/* @__PURE__ */ jsx8("span", { className: "cls_file_metadata_field_label", children: format_field_name(key) }),
|
|
2279
|
+
/* @__PURE__ */ jsx8("span", { className: "cls_file_metadata_field_value", children: display_value })
|
|
2280
|
+
] }, key);
|
|
2281
|
+
}) })
|
|
2282
|
+
] }, entry_key);
|
|
2283
|
+
})
|
|
2284
|
+
] }),
|
|
2285
|
+
(has_extracted_data || has_doc_data || has_highlight_info || has_extractions) && has_file_info && /* @__PURE__ */ jsx8("div", { className: "cls_file_info_divider" }),
|
|
2217
2286
|
has_file_info && item && /* @__PURE__ */ jsxs7("div", { className: "cls_file_info_system_section", children: [
|
|
2218
2287
|
/* @__PURE__ */ jsx8("div", { className: "cls_file_info_section_header", children: "File" }),
|
|
2219
2288
|
/* @__PURE__ */ jsxs7("div", { className: "cls_file_info_properties", children: [
|
|
@@ -2227,7 +2296,7 @@ var FileInfoSidepanel = ({
|
|
|
2227
2296
|
] })
|
|
2228
2297
|
] })
|
|
2229
2298
|
] }),
|
|
2230
|
-
!has_extracted_data && !has_doc_data && !has_highlight_info && !has_file_info && /* @__PURE__ */ jsx8("div", { className: "cls_file_info_no_data", children: "No file information available" })
|
|
2299
|
+
!has_extracted_data && !has_doc_data && !has_highlight_info && !has_extractions && !has_file_info && /* @__PURE__ */ jsx8("div", { className: "cls_file_info_no_data", children: "No file information available" })
|
|
2231
2300
|
] })
|
|
2232
2301
|
] })
|
|
2233
2302
|
]
|
|
@@ -2321,8 +2390,8 @@ async function load_pdf_config_async(config_file) {
|
|
|
2321
2390
|
return load_config_browser(config_file);
|
|
2322
2391
|
}
|
|
2323
2392
|
try {
|
|
2324
|
-
const {
|
|
2325
|
-
const hazo_config = new
|
|
2393
|
+
const { AppConfig } = __require("hazo_config");
|
|
2394
|
+
const hazo_config = new AppConfig({ filePath: config_file });
|
|
2326
2395
|
logger.debug(`Using hazo_config to load: ${config_file}`);
|
|
2327
2396
|
const get_value = (section, key) => {
|
|
2328
2397
|
return hazo_config.get(section, key);
|
|
@@ -2931,8 +3000,8 @@ function load_pdf_config(config_file) {
|
|
|
2931
3000
|
return default_config;
|
|
2932
3001
|
}
|
|
2933
3002
|
try {
|
|
2934
|
-
const {
|
|
2935
|
-
const hazo_config = new
|
|
3003
|
+
const { AppConfig } = __require("hazo_config");
|
|
3004
|
+
const hazo_config = new AppConfig({ filePath: config_file });
|
|
2936
3005
|
const get_value = (section, key) => {
|
|
2937
3006
|
return hazo_config.get(section, key);
|
|
2938
3007
|
};
|
|
@@ -4531,6 +4600,7 @@ var PdfViewer = forwardRef(({
|
|
|
4531
4600
|
// File info sidepanel data props
|
|
4532
4601
|
doc_data,
|
|
4533
4602
|
highlight_fields_info,
|
|
4603
|
+
extractions,
|
|
4534
4604
|
// Auto-highlight props
|
|
4535
4605
|
auto_highlight_enabled,
|
|
4536
4606
|
auto_highlight_options,
|
|
@@ -5222,6 +5292,12 @@ ${suffix_line}`;
|
|
|
5222
5292
|
return { updatedRow, allData };
|
|
5223
5293
|
};
|
|
5224
5294
|
const handle_popout = useCallback5(() => {
|
|
5295
|
+
if (!is_multi_file_mode) {
|
|
5296
|
+
if (effective_url) {
|
|
5297
|
+
window.open(effective_url, "_blank");
|
|
5298
|
+
}
|
|
5299
|
+
return;
|
|
5300
|
+
}
|
|
5225
5301
|
if (!files || files.length === 0) {
|
|
5226
5302
|
pdf_logger.warn("No files to popout");
|
|
5227
5303
|
return;
|
|
@@ -5242,7 +5318,7 @@ ${suffix_line}`;
|
|
|
5242
5318
|
} catch (err) {
|
|
5243
5319
|
pdf_logger.error("Failed to popout", { error: err });
|
|
5244
5320
|
}
|
|
5245
|
-
}, [files, current_file, viewer_title, on_popout, popout_route]);
|
|
5321
|
+
}, [is_multi_file_mode, effective_url, files, current_file, viewer_title, on_popout, popout_route]);
|
|
5246
5322
|
useEffect10(() => {
|
|
5247
5323
|
const should_auto_highlight = auto_highlight_enabled !== false && // Default true
|
|
5248
5324
|
highlight_fields_info && highlight_fields_info.length > 0 && pdf_document;
|
|
@@ -5258,7 +5334,7 @@ ${suffix_line}`;
|
|
|
5258
5334
|
});
|
|
5259
5335
|
setAutoHighlightIds(/* @__PURE__ */ new Set());
|
|
5260
5336
|
const perform_auto_highlights = async () => {
|
|
5261
|
-
const { find_text_in_pdf } = await import("./text_search-
|
|
5337
|
+
const { find_text_in_pdf } = await import("./text_search-I2KZ7DTW.js");
|
|
5262
5338
|
const new_ids = /* @__PURE__ */ new Set();
|
|
5263
5339
|
const auto_config = config_ref.current?.auto_highlight || default_config.auto_highlight;
|
|
5264
5340
|
const search_opts = {
|
|
@@ -5888,7 +5964,7 @@ ${suffix_line}`;
|
|
|
5888
5964
|
children: /* @__PURE__ */ jsx15(PanelRight, { className: "cls_pdf_viewer_toolbar_icon", size: 16 })
|
|
5889
5965
|
}
|
|
5890
5966
|
) }),
|
|
5891
|
-
(file_metadata && file_metadata.length > 0 || hazo_files_available || doc_data || highlight_fields_info) && toolbar_config.toolbar_show_file_info_button && /* @__PURE__ */ jsx15("div", { className: "cls_pdf_viewer_toolbar_group", children: /* @__PURE__ */ jsx15(
|
|
5967
|
+
(file_metadata && file_metadata.length > 0 || hazo_files_available || doc_data || highlight_fields_info || extractions && extractions.length > 0) && toolbar_config.toolbar_show_file_info_button && /* @__PURE__ */ jsx15("div", { className: "cls_pdf_viewer_toolbar_group", children: /* @__PURE__ */ jsx15(
|
|
5892
5968
|
"button",
|
|
5893
5969
|
{
|
|
5894
5970
|
type: "button",
|
|
@@ -5914,27 +5990,57 @@ ${suffix_line}`;
|
|
|
5914
5990
|
children: /* @__PURE__ */ jsx15(Info, { className: "cls_pdf_viewer_toolbar_icon", size: 16 })
|
|
5915
5991
|
}
|
|
5916
5992
|
) }),
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
e
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
e
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5993
|
+
enable_popout && /* @__PURE__ */ jsxs14("div", { className: "cls_pdf_viewer_toolbar_group", children: [
|
|
5994
|
+
/* @__PURE__ */ jsx15(
|
|
5995
|
+
"button",
|
|
5996
|
+
{
|
|
5997
|
+
type: "button",
|
|
5998
|
+
onClick: handle_popout,
|
|
5999
|
+
className: "cls_pdf_viewer_toolbar_button",
|
|
6000
|
+
"aria-label": "Open in new tab",
|
|
6001
|
+
title: "Open in new tab",
|
|
6002
|
+
style: {
|
|
6003
|
+
backgroundColor: toolbar_config.toolbar_button_background_color,
|
|
6004
|
+
color: toolbar_config.toolbar_button_text_color
|
|
6005
|
+
},
|
|
6006
|
+
onMouseEnter: (e) => {
|
|
6007
|
+
e.currentTarget.style.backgroundColor = toolbar_config.toolbar_button_background_color_hover;
|
|
6008
|
+
},
|
|
6009
|
+
onMouseLeave: (e) => {
|
|
6010
|
+
e.currentTarget.style.backgroundColor = toolbar_config.toolbar_button_background_color;
|
|
6011
|
+
},
|
|
6012
|
+
children: /* @__PURE__ */ jsx15(ExternalLink, { className: "cls_pdf_viewer_toolbar_icon", size: 16 })
|
|
6013
|
+
}
|
|
6014
|
+
),
|
|
6015
|
+
/* @__PURE__ */ jsx15(
|
|
6016
|
+
"button",
|
|
6017
|
+
{
|
|
6018
|
+
type: "button",
|
|
6019
|
+
onClick: handle_download,
|
|
6020
|
+
disabled: downloading || !pdf_document,
|
|
6021
|
+
className: cn(
|
|
6022
|
+
"cls_pdf_viewer_toolbar_button",
|
|
6023
|
+
(downloading || !pdf_document) && "cls_pdf_viewer_toolbar_button_disabled"
|
|
6024
|
+
),
|
|
6025
|
+
"aria-label": "Download PDF",
|
|
6026
|
+
title: downloading ? "Downloading..." : "Download PDF",
|
|
6027
|
+
style: {
|
|
6028
|
+
backgroundColor: toolbar_config.toolbar_button_background_color,
|
|
6029
|
+
color: toolbar_config.toolbar_button_text_color,
|
|
6030
|
+
opacity: downloading || !pdf_document ? toolbar_config.toolbar_button_disabled_opacity : 1
|
|
6031
|
+
},
|
|
6032
|
+
onMouseEnter: (e) => {
|
|
6033
|
+
if (!(downloading || !pdf_document)) {
|
|
6034
|
+
e.currentTarget.style.backgroundColor = toolbar_config.toolbar_button_background_color_hover;
|
|
6035
|
+
}
|
|
6036
|
+
},
|
|
6037
|
+
onMouseLeave: (e) => {
|
|
6038
|
+
e.currentTarget.style.backgroundColor = toolbar_config.toolbar_button_background_color;
|
|
6039
|
+
},
|
|
6040
|
+
children: /* @__PURE__ */ jsx15(Download, { className: "cls_pdf_viewer_toolbar_icon", size: 16 })
|
|
6041
|
+
}
|
|
6042
|
+
)
|
|
6043
|
+
] }),
|
|
5938
6044
|
on_close && /* @__PURE__ */ jsx15("div", { className: "cls_pdf_viewer_toolbar_group", children: /* @__PURE__ */ jsx15(
|
|
5939
6045
|
"button",
|
|
5940
6046
|
{
|
|
@@ -5962,7 +6068,7 @@ ${suffix_line}`;
|
|
|
5962
6068
|
const any_sidepanel_open = sidepanel_open || file_info_sidepanel_open;
|
|
5963
6069
|
const total_sidepanel_width = (sidepanel_open ? sidepanel_width : 0) + (file_info_sidepanel_open ? file_info_sidepanel_width : 0);
|
|
5964
6070
|
const has_metadata_sidepanel = sidepanel_metadata_enabled && metadata_input;
|
|
5965
|
-
const has_file_info_sidepanel = (file_metadata && file_metadata.length > 0 || hazo_files_available || doc_data || highlight_fields_info) && toolbar_config.toolbar_show_file_info_button;
|
|
6071
|
+
const has_file_info_sidepanel = (file_metadata && file_metadata.length > 0 || hazo_files_available || doc_data || highlight_fields_info || extractions && extractions.length > 0) && toolbar_config.toolbar_show_file_info_button;
|
|
5966
6072
|
const any_sidepanel_available = has_metadata_sidepanel || has_file_info_sidepanel;
|
|
5967
6073
|
return /* @__PURE__ */ jsxs14("div", { className: cn("cls_pdf_viewer_content_wrapper", any_sidepanel_open && "cls_pdf_viewer_content_wrapper_with_sidepanel"), children: [
|
|
5968
6074
|
any_sidepanel_available && !any_sidepanel_open && /* @__PURE__ */ jsxs14(
|
|
@@ -6061,7 +6167,7 @@ ${suffix_line}`;
|
|
|
6061
6167
|
on_width_change: handle_sidepanel_width_change
|
|
6062
6168
|
}
|
|
6063
6169
|
),
|
|
6064
|
-
(file_metadata && file_metadata.length > 0 || hazo_files_available || doc_data || highlight_fields_info) && /* @__PURE__ */ jsx15(
|
|
6170
|
+
(file_metadata && file_metadata.length > 0 || hazo_files_available || doc_data || highlight_fields_info || extractions && extractions.length > 0) && /* @__PURE__ */ jsx15(
|
|
6065
6171
|
FileInfoSidepanel,
|
|
6066
6172
|
{
|
|
6067
6173
|
is_open: file_info_sidepanel_open,
|
|
@@ -6083,7 +6189,8 @@ ${suffix_line}`;
|
|
|
6083
6189
|
file_metadata,
|
|
6084
6190
|
current_filename: current_file?.name || display_filename || (url ? url.split("/").pop() || "" : ""),
|
|
6085
6191
|
doc_data,
|
|
6086
|
-
highlight_fields_info
|
|
6192
|
+
highlight_fields_info,
|
|
6193
|
+
extractions
|
|
6087
6194
|
}
|
|
6088
6195
|
)
|
|
6089
6196
|
] });
|
|
@@ -6258,6 +6365,7 @@ PdfViewer.displayName = "PdfViewer";
|
|
|
6258
6365
|
var pdf_viewer_default = PdfViewer;
|
|
6259
6366
|
|
|
6260
6367
|
export {
|
|
6368
|
+
cn,
|
|
6261
6369
|
load_pdf_document,
|
|
6262
6370
|
create_coordinate_mapper,
|
|
6263
6371
|
get_viewport_dimensions,
|
|
@@ -6293,4 +6401,4 @@ export {
|
|
|
6293
6401
|
PdfViewer,
|
|
6294
6402
|
pdf_viewer_default
|
|
6295
6403
|
};
|
|
6296
|
-
//# sourceMappingURL=chunk-
|
|
6404
|
+
//# sourceMappingURL=chunk-4JJOUQ62.js.map
|