@deepcitation/deepcitation-js 1.1.27 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +253 -253
  3. package/lib/chunk-2IZXUOQR.js +66 -0
  4. package/lib/chunk-4FGOHQFP.cjs +66 -0
  5. package/lib/chunk-CFXDRAJL.cjs +1 -0
  6. package/lib/chunk-DEUSSEFH.js +2 -0
  7. package/lib/chunk-F2MMVEVC.cjs +1 -0
  8. package/lib/chunk-J7U6YFOI.cjs +2 -0
  9. package/lib/chunk-O2XFH626.js +1 -0
  10. package/lib/chunk-RQPZSRID.js +1 -0
  11. package/lib/client/index.cjs +1 -0
  12. package/lib/client/{DeepCitation.d.ts → index.d.cts} +159 -3
  13. package/lib/client/index.d.ts +342 -2
  14. package/lib/client/index.js +1 -1
  15. package/lib/index.cjs +1 -0
  16. package/lib/index.d.cts +127 -0
  17. package/lib/index.d.ts +126 -22
  18. package/lib/index.js +1 -20
  19. package/lib/prompts/index.cjs +1 -0
  20. package/lib/prompts/index.d.cts +196 -0
  21. package/lib/prompts/index.d.ts +196 -3
  22. package/lib/prompts/index.js +1 -3
  23. package/lib/react/index.cjs +4 -0
  24. package/lib/react/index.js +4 -20
  25. package/lib/types/index.cjs +1 -0
  26. package/lib/types/index.d.cts +96 -0
  27. package/lib/types/index.d.ts +96 -11
  28. package/lib/types/index.js +1 -7
  29. package/package.json +46 -11
  30. package/lib/client/DeepCitation.js +0 -374
  31. package/lib/client/types.d.ts +0 -154
  32. package/lib/client/types.js +0 -1
  33. package/lib/parsing/normalizeCitation.d.ts +0 -5
  34. package/lib/parsing/normalizeCitation.js +0 -198
  35. package/lib/parsing/parseCitation.d.ts +0 -79
  36. package/lib/parsing/parseCitation.js +0 -431
  37. package/lib/parsing/parseWorkAround.d.ts +0 -2
  38. package/lib/parsing/parseWorkAround.js +0 -73
  39. package/lib/prompts/citationPrompts.d.ts +0 -138
  40. package/lib/prompts/citationPrompts.js +0 -168
  41. package/lib/prompts/promptCompression.d.ts +0 -14
  42. package/lib/prompts/promptCompression.js +0 -127
  43. package/lib/prompts/types.d.ts +0 -4
  44. package/lib/prompts/types.js +0 -1
  45. package/lib/react/CitationComponent.d.ts +0 -106
  46. package/lib/react/CitationComponent.js +0 -419
  47. package/lib/react/CitationVariants.d.ts +0 -132
  48. package/lib/react/CitationVariants.js +0 -277
  49. package/lib/react/DiffDisplay.d.ts +0 -10
  50. package/lib/react/DiffDisplay.js +0 -33
  51. package/lib/react/Popover.d.ts +0 -15
  52. package/lib/react/Popover.js +0 -20
  53. package/lib/react/UrlCitationComponent.d.ts +0 -83
  54. package/lib/react/UrlCitationComponent.js +0 -224
  55. package/lib/react/VerificationTabs.d.ts +0 -10
  56. package/lib/react/VerificationTabs.js +0 -36
  57. package/lib/react/icons.d.ts +0 -22
  58. package/lib/react/icons.js +0 -16
  59. package/lib/react/index.d.ts +0 -17
  60. package/lib/react/primitives.d.ts +0 -99
  61. package/lib/react/primitives.js +0 -187
  62. package/lib/react/types.d.ts +0 -315
  63. package/lib/react/types.js +0 -1
  64. package/lib/react/useSmartDiff.d.ts +0 -16
  65. package/lib/react/useSmartDiff.js +0 -64
  66. package/lib/react/utils.d.ts +0 -44
  67. package/lib/react/utils.js +0 -88
  68. package/lib/types/boxes.d.ts +0 -11
  69. package/lib/types/boxes.js +0 -1
  70. package/lib/types/citation.d.ts +0 -39
  71. package/lib/types/citation.js +0 -1
  72. package/lib/types/search.d.ts +0 -19
  73. package/lib/types/search.js +0 -1
  74. package/lib/types/verification.d.ts +0 -27
  75. package/lib/types/verification.js +0 -11
  76. package/lib/utils/diff.d.ts +0 -60
  77. package/lib/utils/diff.js +0 -414
  78. package/lib/utils/sha.d.ts +0 -10
  79. package/lib/utils/sha.js +0 -108
@@ -1,315 +0,0 @@
1
- import type { Citation, CitationStatus } from "../types/citation.js";
2
- import type { Verification } from "../types/verification.js";
3
- import type { SearchStatus } from "../types/search.js";
4
- /**
5
- * Visual style variants for citations.
6
- *
7
- * | Variant | Description |
8
- * |---------------|------------------------------------------------|
9
- * | `chip` | Pill/badge style with background color |
10
- * | `brackets` | [text✓] with square brackets (default) |
11
- * | `text` | Plain text, inherits parent styling |
12
- * | `superscript` | Small raised text like footnotes¹ |
13
- * | `minimal` | Compact text with indicator, truncated |
14
- */
15
- export type CitationVariant = "chip" | "brackets" | "text" | "superscript" | "minimal";
16
- /**
17
- * Content to display in the citation.
18
- *
19
- * | Content | Description |
20
- * |---------------|------------------------------------------------|
21
- * | `keySpan` | Descriptive text (e.g., "Revenue Growth") |
22
- * | `number` | Citation number (e.g., "1", "2", "3") |
23
- * | `indicator` | Only the status icon (✓/⚠), no text |
24
- *
25
- * Default content per variant:
26
- * - `chip` → `keySpan`
27
- * - `brackets` → `number`
28
- * - `text` → `keySpan`
29
- * - `superscript` → `number`
30
- * - `minimal` → `number`
31
- */
32
- export type CitationContent = "keySpan" | "number" | "indicator";
33
- /**
34
- * URL fetch status for URL citations.
35
- */
36
- export type UrlFetchStatus = "verified" | "partial" | "pending" | "blocked_antibot" | "blocked_login" | "blocked_paywall" | "blocked_geo" | "blocked_rate_limit" | "error_timeout" | "error_not_found" | "error_server" | "error_network" | "unknown";
37
- /**
38
- * URL citation metadata.
39
- */
40
- export interface UrlCitationMeta {
41
- /** The full URL */
42
- url: string;
43
- /** Display domain (e.g., "example.com") */
44
- domain?: string;
45
- /** Page title if fetched */
46
- title?: string;
47
- /** Fetch/verification status */
48
- fetchStatus: UrlFetchStatus;
49
- /** When the URL was last verified */
50
- verifiedAt?: Date | string;
51
- /** HTTP status code if available */
52
- httpStatus?: number;
53
- /** Error message if applicable */
54
- errorMessage?: string;
55
- /** Favicon URL if available */
56
- faviconUrl?: string;
57
- }
58
- /**
59
- * Style configuration for the citation component.
60
- * All properties are optional class name strings.
61
- */
62
- export interface CitationStyles {
63
- /** Container wrapper class */
64
- container?: string;
65
- /** Citation number bracket wrapper */
66
- bracketWrapper?: string;
67
- /** Inner bracket content */
68
- bracketContent?: string;
69
- /** Citation text/number itself */
70
- citationText?: string;
71
- /** Verified status indicator */
72
- verifiedIcon?: string;
73
- /** Partial match indicator */
74
- partialIcon?: string;
75
- /** Pending/loading state */
76
- pendingText?: string;
77
- }
78
- /**
79
- * State classes applied based on citation verification status
80
- */
81
- export interface CitationStateClasses {
82
- /** Applied when citation is verified (found in document) */
83
- verified?: string;
84
- /** Applied when citation is a miss (not found) */
85
- miss?: string;
86
- /** Applied when citation is a partial match */
87
- partial?: string;
88
- /** Applied when citation verification is pending */
89
- pending?: string;
90
- }
91
- /**
92
- * Cursor classes for different zoom states
93
- */
94
- export interface CitationCursorClasses {
95
- zoomIn?: string;
96
- zoomOut?: string;
97
- pointer?: string;
98
- }
99
- /**
100
- * Props for the base CitationComponent
101
- */
102
- export interface BaseCitationProps {
103
- /** The citation data to display */
104
- citation: Citation;
105
- /** Child content to render before the citation bracket */
106
- children?: React.ReactNode;
107
- /** Additional class name for the container */
108
- className?: string;
109
- /** Class name for controlling inner content width */
110
- innerWidthClassName?: string;
111
- /**
112
- * Visual style variant for the citation.
113
- * @default "brackets"
114
- */
115
- variant?: CitationVariant;
116
- /**
117
- * What content to display in the citation.
118
- * If not specified, defaults based on variant:
119
- * - `chip` → `keySpan`
120
- * - `brackets` → `number`
121
- * - `text` → `keySpan`
122
- * - `superscript` → `number`
123
- * - `minimal` → `number`
124
- */
125
- content?: CitationContent;
126
- /** Fallback display text when citation keySpan is empty */
127
- fallbackDisplay?: string | null;
128
- }
129
- /**
130
- * Visual style variants for URL citations.
131
- */
132
- export type UrlCitationVariant = "chip" | "inline" | "bracket";
133
- /**
134
- * Props for URL citation component
135
- */
136
- export interface UrlCitationProps extends Omit<BaseCitationProps, "citation" | "variant"> {
137
- /** Visual style variant for the URL citation */
138
- variant?: UrlCitationVariant;
139
- /** URL metadata including fetch status */
140
- urlMeta: UrlCitationMeta;
141
- /** The citation data (optional, will be derived from urlMeta if not provided) */
142
- citation?: Citation;
143
- /** Whether to show the full URL on hover */
144
- showFullUrlOnHover?: boolean;
145
- /** Whether to show favicon */
146
- showFavicon?: boolean;
147
- /** Whether to show the page title instead of domain */
148
- showTitle?: boolean;
149
- /** Maximum characters for truncated display */
150
- maxDisplayLength?: number;
151
- /** Custom render for the blocked status indicator */
152
- renderBlockedIndicator?: (status: UrlFetchStatus, errorMessage?: string) => React.ReactNode;
153
- /** Click handler for the URL */
154
- onUrlClick?: (url: string, event: React.MouseEvent) => void;
155
- /** Event handlers for citation interactions */
156
- eventHandlers?: CitationEventHandlers;
157
- /** Whether tooltips should be prevented */
158
- preventTooltips?: boolean;
159
- }
160
- /**
161
- * Extended props for the citation content renderer
162
- */
163
- export interface CitationContentProps extends BaseCitationProps {
164
- /** Unique key for this citation */
165
- citationKey: string;
166
- /** Unique instance ID for this citation render */
167
- citationInstanceId: string;
168
- /** Found citation highlight data */
169
- verification: Verification | null | undefined;
170
- /** Search status */
171
- searchStatus: SearchStatus | undefined | null;
172
- /** Actual page number where citation was found */
173
- actualPageNumber?: number | null;
174
- /** Page number from citation data */
175
- citationPageNumber?: number | null;
176
- /** Unique highlight ID */
177
- highlightId?: string;
178
- /** Citation verification status */
179
- status: CitationStatus;
180
- /** Whether tooltips should be suppressed */
181
- preventTooltips?: boolean;
182
- /** Whether on mobile device */
183
- isMobile?: boolean;
184
- /** Style configuration */
185
- styles?: CitationStyles;
186
- /** State-based classes */
187
- stateClasses?: CitationStateClasses;
188
- /** Cursor classes */
189
- cursorClasses?: CitationCursorClasses;
190
- }
191
- /**
192
- * Render props for custom citation rendering
193
- */
194
- export interface CitationRenderProps {
195
- /** The citation data */
196
- citation: Citation;
197
- /** Citation verification status */
198
- status: CitationStatus;
199
- /** The citation key */
200
- citationKey: string;
201
- /** Display text for the citation */
202
- displayText: string;
203
- /** Whether this is a merged keySpan display */
204
- isMergedDisplay: boolean;
205
- }
206
- /**
207
- * Event handlers for citation interactions
208
- */
209
- export interface CitationEventHandlers {
210
- /** Called when mouse enters citation */
211
- onMouseEnter?: (citation: Citation, citationKey: string) => void;
212
- /** Called when mouse leaves citation */
213
- onMouseLeave?: (citation: Citation, citationKey: string) => void;
214
- /** Called when citation is clicked */
215
- onClick?: (citation: Citation, citationKey: string, event: React.MouseEvent | React.TouchEvent) => void;
216
- /** Called on touch end (mobile) */
217
- onTouchEnd?: (citation: Citation, citationKey: string, event: React.TouchEvent) => void;
218
- }
219
- /**
220
- * Context provided to behavior handlers for making decisions.
221
- */
222
- export interface CitationBehaviorContext {
223
- /** The citation data */
224
- citation: Citation;
225
- /** Unique key for this citation */
226
- citationKey: string;
227
- /** Verification result if available */
228
- verification: Verification | null;
229
- /** Whether the popover is currently pinned open */
230
- isTooltipExpanded: boolean;
231
- /** Whether the full-size image overlay is currently open */
232
- isImageExpanded: boolean;
233
- /** Whether a verification image is available */
234
- hasImage: boolean;
235
- }
236
- /**
237
- * Actions that can be performed by the citation component.
238
- * These are returned by behavior handlers to control component state.
239
- */
240
- export interface CitationBehaviorActions {
241
- /** Pin or unpin the popover (keeps it visible without hover) */
242
- setTooltipExpanded?: boolean;
243
- /** Open or close the full-size image overlay */
244
- setImageExpanded?: boolean | string;
245
- /** Expand or collapse the search phrases list (for miss/partial states) */
246
- setPhrasesExpanded?: boolean;
247
- }
248
- /**
249
- * Configuration for click behavior.
250
- * Return actions to perform, or `false` to prevent default behavior.
251
- */
252
- export type CitationClickBehavior = (context: CitationBehaviorContext, event: React.MouseEvent | React.TouchEvent) => CitationBehaviorActions | false | void;
253
- /**
254
- * Configuration for hover behavior.
255
- */
256
- export interface CitationHoverBehavior {
257
- /** Called when mouse enters the citation */
258
- onEnter?: (context: CitationBehaviorContext) => void;
259
- /** Called when mouse leaves the citation */
260
- onLeave?: (context: CitationBehaviorContext) => void;
261
- }
262
- /**
263
- * Configuration for customizing default citation behaviors.
264
- *
265
- * When you provide `onClick` or `onHover`, they REPLACE the corresponding default behaviors.
266
- * Use `eventHandlers` for side effects that should run alongside defaults.
267
- *
268
- * @example Custom click behavior (replaces default)
269
- * ```tsx
270
- * <CitationComponent
271
- * citation={citation}
272
- * verification={verification}
273
- * behaviorConfig={{
274
- * onClick: (context, event) => {
275
- * if (context.hasImage) {
276
- * return { setImageExpanded: true };
277
- * }
278
- * }
279
- * }}
280
- * />
281
- * ```
282
- *
283
- * @example Disable click behavior entirely
284
- * ```tsx
285
- * <CitationComponent
286
- * citation={citation}
287
- * verification={verification}
288
- * behaviorConfig={{ onClick: () => false }}
289
- * />
290
- * ```
291
- */
292
- export interface CitationBehaviorConfig {
293
- /**
294
- * Custom click behavior handler. When provided, REPLACES the default click behavior.
295
- *
296
- * Return values:
297
- * - `CitationBehaviorActions`: Apply specific state changes
298
- * - `false`: Prevent any state changes
299
- * - `void`/`undefined`: No state changes
300
- */
301
- onClick?: CitationClickBehavior;
302
- /**
303
- * Custom hover behavior handlers. When provided, REPLACE the default hover behavior.
304
- */
305
- onHover?: CitationHoverBehavior;
306
- }
307
- /**
308
- * Props for the tooltip wrapper component
309
- */
310
- export interface CitationTooltipProps {
311
- children: React.ReactNode;
312
- citation: Citation;
313
- verification?: Verification | null;
314
- shouldShowTooltip: boolean;
315
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- export type DiffBlockType = "modified" | "added" | "removed" | "unchanged";
2
- export interface DiffPart {
3
- value: string;
4
- added?: boolean;
5
- removed?: boolean;
6
- }
7
- export interface DiffBlock {
8
- type: DiffBlockType;
9
- parts: DiffPart[];
10
- }
11
- export declare const useSmartDiff: (expected?: string, actual?: string) => {
12
- diffResult: DiffBlock[];
13
- hasDiff: boolean;
14
- similarity: number;
15
- isHighVariance: boolean;
16
- };
@@ -1,64 +0,0 @@
1
- import { diffLines, diffWordsWithSpace } from "../utils/diff.js";
2
- import { useMemo } from "react";
3
- export const useSmartDiff = (expected = "", actual = "") => {
4
- return useMemo(() => {
5
- // 1. Sanitize standard noise (CRLF, trailing spaces)
6
- const cleanExpected = (expected || "").trim().replace(/\r\n/g, "\n");
7
- const cleanActual = (actual || "").trim().replace(/\r\n/g, "\n");
8
- // 2. First Pass: Diff by LINES.
9
- // This isolates the "extra line" issue. The extra line becomes one "added" chunk,
10
- // and it prevents the tokenizer from getting confused on the rest of the text.
11
- const lineDiffs = diffLines(cleanExpected, cleanActual);
12
- // 3. Second Pass: Process the line results to find "Modifications"
13
- const processedDiffs = [];
14
- let hasDiff = false;
15
- let totalChange = 0;
16
- for (let i = 0; i < lineDiffs.length; i++) {
17
- const part = lineDiffs[i];
18
- const nextPart = lineDiffs[i + 1];
19
- // CHECK FOR MODIFICATION:
20
- // If we see a "Removed" block immediately followed by an "Added" block,
21
- // it means this specific line changed. We should DIFF WORDS inside this line.
22
- if (part.removed && nextPart && nextPart.added) {
23
- // Run word diff ONLY on this pair of lines
24
- const wordDiffs = diffWordsWithSpace(part.value, nextPart.value);
25
- processedDiffs.push({
26
- type: "modified",
27
- parts: wordDiffs,
28
- });
29
- hasDiff = true;
30
- // Calculate raw change amount for variance score
31
- totalChange += Math.abs(part.value.length - nextPart.value.length);
32
- i++; // Skip the next part since we merged it into this block
33
- }
34
- // CHECK FOR PURE ADDITION/DELETION (The "Extra Line" Scenario)
35
- else if (part.added || part.removed) {
36
- processedDiffs.push({
37
- type: part.added ? "added" : "removed",
38
- parts: [{ value: part.value, added: part.added, removed: part.removed }],
39
- });
40
- hasDiff = true;
41
- totalChange += part.value.length;
42
- }
43
- // UNCHANGED BLOCKS
44
- else {
45
- processedDiffs.push({
46
- type: "unchanged",
47
- parts: [{ value: part.value }],
48
- });
49
- }
50
- }
51
- // 4. Calculate a similarity score to decide UI defaults
52
- // 1.0 = Perfect match, 0.0 = Totally different
53
- const maxLength = Math.max(cleanExpected.length, cleanActual.length);
54
- const similarity = maxLength === 0 ? 1 : 1 - totalChange / maxLength;
55
- return {
56
- diffResult: processedDiffs,
57
- hasDiff,
58
- similarity,
59
- // If similarity is too low (< 60%), the Diff view is likely "Fruit Salad" (messy).
60
- // We can use this boolean to default the UI to the "Source" tab.
61
- isHighVariance: similarity < 0.6,
62
- };
63
- }, [expected, actual]);
64
- };
@@ -1,44 +0,0 @@
1
- import type { Citation } from "../types/citation.js";
2
- import type { Verification } from "../types/verification.js";
3
- export declare function cn(...classes: (string | undefined | null | false)[]): string;
4
- /**
5
- * Generates a unique, deterministic key for a citation based on its content.
6
- * @param citation - The citation to generate a key for
7
- * @returns A unique, deterministic key for the citation
8
- */
9
- export declare function generateCitationKey(citation: Citation): string;
10
- /**
11
- * Generates a unique, deterministic key for a verification based on its content.
12
- * @param verification - The verification to generate a key for
13
- * @returns
14
- */
15
- export declare function generateVerificationKey(verification: Verification): string;
16
- /**
17
- * Generates a unique instance ID for a citation component render.
18
- * Combines the citation key with a random suffix for uniqueness.
19
- */
20
- export declare function generateCitationInstanceId(citationKey: string): string;
21
- /**
22
- * Gets the display text for a citation (keySpan with fallback to number).
23
- */
24
- export declare function getCitationDisplayText(citation: Citation, options?: {
25
- fallbackDisplay?: string | null;
26
- }): string;
27
- /**
28
- * Gets the citation number as a string.
29
- */
30
- export declare function getCitationNumber(citation: Citation): string;
31
- /**
32
- * Gets the keySpan text from a citation.
33
- */
34
- export declare function getCitationKeySpanText(citation: Citation): string;
35
- /**
36
- * Joins class names, filtering out falsy values.
37
- * This is a minimal implementation for the base component.
38
- */
39
- export declare function classNames(...classes: (string | undefined | null | false)[]): string;
40
- /**
41
- * Default padding values for citation styling.
42
- */
43
- export declare const CITATION_X_PADDING = 4;
44
- export declare const CITATION_Y_PADDING = 1;
@@ -1,88 +0,0 @@
1
- import { sha1Hash } from "../utils/sha.js";
2
- import { getCitationPageNumber } from "../parsing/normalizeCitation.js";
3
- // =============================================================================
4
- // UTILITY FUNCTIONS
5
- // =============================================================================
6
- export function cn(...classes) {
7
- return classes.filter(Boolean).join(" ");
8
- }
9
- /**
10
- * Generates a unique, deterministic key for a citation based on its content.
11
- * @param citation - The citation to generate a key for
12
- * @returns A unique, deterministic key for the citation
13
- */
14
- export function generateCitationKey(citation) {
15
- const pageNumber = citation.pageNumber || getCitationPageNumber(citation.startPageKey);
16
- const keyParts = [
17
- citation.attachmentId || "",
18
- pageNumber?.toString() || "",
19
- citation.fullPhrase || "",
20
- citation.keySpan?.toString() || "",
21
- citation.lineIds?.join(",") || "",
22
- citation.timestamps?.startTime || "",
23
- citation.timestamps?.endTime || "",
24
- ];
25
- return sha1Hash(keyParts.join("|")).slice(0, 16);
26
- }
27
- /**
28
- * Generates a unique, deterministic key for a verification based on its content.
29
- * @param verification - The verification to generate a key for
30
- * @returns
31
- */
32
- export function generateVerificationKey(verification) {
33
- const keyParts = [
34
- verification.attachmentId || "",
35
- verification.label || "",
36
- verification.verifiedFullPhrase || "",
37
- verification.verifiedKeySpan || "",
38
- verification.verifiedLineIds?.join(",") || "",
39
- verification.verifiedPageNumber?.toString() || "",
40
- verification.verifiedTimestamps?.startTime || "",
41
- verification.verifiedTimestamps?.endTime || "",
42
- verification.verifiedMatchSnippet || "",
43
- verification.hitIndexWithinPage?.toString() || "",
44
- ];
45
- return sha1Hash(keyParts.join("|")).slice(0, 16);
46
- }
47
- /**
48
- * Generates a unique instance ID for a citation component render.
49
- * Combines the citation key with a random suffix for uniqueness.
50
- */
51
- export function generateCitationInstanceId(citationKey) {
52
- const randomSuffix = Math.random().toString(36).slice(2, 11);
53
- return `${citationKey}-${randomSuffix}`;
54
- }
55
- /**
56
- * Gets the display text for a citation (keySpan with fallback to number).
57
- */
58
- export function getCitationDisplayText(citation, options = {}) {
59
- const { fallbackDisplay } = options;
60
- return (citation.keySpan?.toString() ||
61
- citation.citationNumber?.toString() ||
62
- fallbackDisplay ||
63
- "1");
64
- }
65
- /**
66
- * Gets the citation number as a string.
67
- */
68
- export function getCitationNumber(citation) {
69
- return citation.citationNumber?.toString() || "1";
70
- }
71
- /**
72
- * Gets the keySpan text from a citation.
73
- */
74
- export function getCitationKeySpanText(citation) {
75
- return citation.keySpan?.toString() || "";
76
- }
77
- /**
78
- * Joins class names, filtering out falsy values.
79
- * This is a minimal implementation for the base component.
80
- */
81
- export function classNames(...classes) {
82
- return classes.filter(Boolean).join(" ");
83
- }
84
- /**
85
- * Default padding values for citation styling.
86
- */
87
- export const CITATION_X_PADDING = 4;
88
- export const CITATION_Y_PADDING = 1;
@@ -1,11 +0,0 @@
1
- export interface PdfSpaceItem extends ScreenBox {
2
- text?: string;
3
- }
4
- export type IVertex = {
5
- x: number;
6
- y: number;
7
- };
8
- export interface ScreenBox extends IVertex {
9
- width: number;
10
- height: number;
11
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,39 +0,0 @@
1
- import { type ScreenBox } from "./boxes.js";
2
- import { type Verification } from "./verification.js";
3
- export type OutputImageFormat = "jpeg" | "png" | "avif" | undefined | null;
4
- export declare const DEFAULT_OUTPUT_IMAGE_FORMAT: "avif";
5
- export interface VerifyCitationResponse {
6
- verifications: {
7
- [key: string]: Verification;
8
- };
9
- }
10
- export interface VerifyCitationRequest {
11
- attachmentId: string;
12
- citations: {
13
- [key: string]: Citation;
14
- };
15
- outputImageFormat?: OutputImageFormat;
16
- apiKey?: string;
17
- }
18
- export interface Citation {
19
- attachmentId?: string;
20
- fullPhrase?: string | null;
21
- keySpan?: string | null;
22
- startPageKey?: string | null;
23
- lineIds?: number[] | null;
24
- reasoning?: string | null;
25
- selection?: ScreenBox | null;
26
- citationNumber?: number;
27
- pageNumber?: number | null;
28
- timestamps?: {
29
- endTime?: string;
30
- startTime?: string;
31
- };
32
- beforeCite?: string;
33
- }
34
- export interface CitationStatus {
35
- isVerified: boolean;
36
- isMiss: boolean;
37
- isPartialMatch: boolean;
38
- isPending: boolean;
39
- }
@@ -1 +0,0 @@
1
- export const DEFAULT_OUTPUT_IMAGE_FORMAT = "avif";
@@ -1,19 +0,0 @@
1
- export type SearchStatus = "loading" | "pending" | "not_found" | "partial_text_found" | "found" | "found_key_span_only" | "found_phrase_missed_value" | "found_on_other_page" | "found_on_other_line" | "first_word_found" | "timestamp_wip";
2
- export type SearchMethod = "exact_line_match" | "line_with_buffer" | "current_page" | "keyspan_fallback" | "adjacent_pages" | "expanded_window" | "regex_search" | "bm25_search" | "fuzzy_regex" | "first_word_fallback";
3
- export interface SearchAttempt {
4
- method: SearchMethod;
5
- success: boolean;
6
- searchPhrases: string[];
7
- pageSearched?: number;
8
- matchedPhrases?: string[];
9
- matchedVariation?: string;
10
- phraseVariations?: string[];
11
- matchQuality?: string;
12
- isPartialMatch?: boolean;
13
- matchScore?: number;
14
- matchSnippet?: string;
15
- notes?: string;
16
- startTime?: number;
17
- endTime?: number;
18
- durationMs?: number;
19
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- import { type Citation } from "./citation.js";
2
- import { type SearchStatus, type SearchAttempt } from "./search.js";
3
- import { type PdfSpaceItem } from "./boxes.js";
4
- export declare const NOT_FOUND_VERIFICATION_INDEX = -1;
5
- export declare const PENDING_VERIFICATION_INDEX = -2;
6
- export declare const BLANK_VERIFICATION: Verification;
7
- export interface Verification {
8
- attachmentId?: string | null;
9
- label?: string | null;
10
- citation?: Citation;
11
- status?: SearchStatus | null;
12
- searchAttempts?: SearchAttempt[];
13
- highlightColor?: string | null;
14
- verifiedPageNumber?: number | null;
15
- verifiedLineIds?: number[] | null;
16
- verifiedTimestamps?: {
17
- startTime?: string;
18
- endTime?: string;
19
- } | null;
20
- verifiedFullPhrase?: string | null;
21
- verifiedKeySpan?: string | null;
22
- verifiedMatchSnippet?: string | null;
23
- hitIndexWithinPage?: number | null;
24
- pdfSpaceItem?: PdfSpaceItem;
25
- verificationImageBase64?: string | null;
26
- verifiedAt?: Date;
27
- }
@@ -1,11 +0,0 @@
1
- export const NOT_FOUND_VERIFICATION_INDEX = -1;
2
- export const PENDING_VERIFICATION_INDEX = -2;
3
- export const BLANK_VERIFICATION = {
4
- attachmentId: null,
5
- verifiedPageNumber: NOT_FOUND_VERIFICATION_INDEX,
6
- verifiedMatchSnippet: null,
7
- citation: {
8
- pageNumber: NOT_FOUND_VERIFICATION_INDEX,
9
- },
10
- status: "not_found",
11
- };