@arbidocs/react 0.4.128 → 0.4.129
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/artifacts/index.cjs +20 -2
- package/dist/artifacts/index.cjs.map +1 -1
- package/dist/artifacts/index.d.cts +17 -1
- package/dist/artifacts/index.d.ts +17 -1
- package/dist/artifacts/index.js +17 -2
- package/dist/artifacts/index.js.map +1 -1
- package/dist/{chunk-GX75JCPR.cjs → chunk-65WT5PHA.cjs} +361 -189
- package/dist/chunk-65WT5PHA.cjs.map +1 -0
- package/dist/{chunk-ECOSGMTW.js → chunk-6AWF4HFU.js} +14 -6
- package/dist/chunk-6AWF4HFU.js.map +1 -0
- package/dist/chunk-6JSXDLIQ.js +101 -0
- package/dist/chunk-6JSXDLIQ.js.map +1 -0
- package/dist/{chunk-F7KQVVD2.cjs → chunk-BOJHNPNJ.cjs} +14 -6
- package/dist/chunk-BOJHNPNJ.cjs.map +1 -0
- package/dist/{chunk-EKRRORFO.js → chunk-C44GO33B.js} +105 -46
- package/dist/chunk-C44GO33B.js.map +1 -0
- package/dist/{chunk-5PQO46PE.js → chunk-J3BYHBKW.js} +358 -189
- package/dist/chunk-J3BYHBKW.js.map +1 -0
- package/dist/{chunk-TBELZWGV.cjs → chunk-OC7F5SNA.cjs} +108 -44
- package/dist/chunk-OC7F5SNA.cjs.map +1 -0
- package/dist/chunk-S7J5SCTZ.cjs +110 -0
- package/dist/chunk-S7J5SCTZ.cjs.map +1 -0
- package/dist/document-tools/index.cjs +69 -121
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.cts +16 -4
- package/dist/document-tools/index.d.ts +16 -4
- package/dist/document-tools/index.js +27 -103
- package/dist/document-tools/index.js.map +1 -1
- package/dist/{index-B1O2cqOo.d.cts → index-2Y2MVegs.d.cts} +85 -6
- package/dist/{index-B1O2cqOo.d.ts → index-2Y2MVegs.d.ts} +85 -6
- package/dist/index.cjs +233 -200
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -8
- package/dist/index.d.ts +26 -8
- package/dist/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/dist/shell/index.cjs +6 -6
- package/dist/shell/index.js +1 -1
- package/dist/ui/index.cjs +144 -120
- package/dist/ui/index.d.cts +2 -1
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +2 -2
- package/dist/viewers/index.cjs +91 -0
- package/dist/viewers/index.cjs.map +1 -1
- package/dist/viewers/index.d.cts +62 -1
- package/dist/viewers/index.d.ts +62 -1
- package/dist/viewers/index.js +90 -1
- package/dist/viewers/index.js.map +1 -1
- package/package.json +8 -3
- package/dist/chunk-5PQO46PE.js.map +0 -1
- package/dist/chunk-ECOSGMTW.js.map +0 -1
- package/dist/chunk-EKRRORFO.js.map +0 -1
- package/dist/chunk-F7KQVVD2.cjs.map +0 -1
- package/dist/chunk-GX75JCPR.cjs.map +0 -1
- package/dist/chunk-TBELZWGV.cjs.map +0 -1
package/dist/ui/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AgentBadge, a as AiMarkdown, b as ArbiIcon, c as Avatar, d as AvatarFallback, e as AvatarImage, B as BASE_COLORS, f as Badge, g as BadgeProps, h as Button, i as ButtonProps, C as Card, j as CardContent, k as CardDescription, l as CardFooter, m as CardHeader, n as CardProps, o as CardTitle, p as Checkbox, q as Collapsible, r as CollapsibleContent, s as CollapsibleTrigger, t as Command, u as CommandDialog, v as CommandEmpty, w as CommandGroup, x as CommandInput, y as CommandItem, z as CommandList, D as CommandSeparator, E as CommandShortcut, F as
|
|
1
|
+
export { A as AgentBadge, a as AiMarkdown, b as ArbiIcon, c as Avatar, d as AvatarFallback, e as AvatarImage, B as BASE_COLORS, f as Badge, g as BadgeProps, h as Button, i as ButtonProps, C as Card, j as CardContent, k as CardDescription, l as CardFooter, m as CardHeader, n as CardProps, o as CardTitle, p as Checkbox, q as Collapsible, r as CollapsibleContent, s as CollapsibleTrigger, t as Command, u as CommandDialog, v as CommandEmpty, w as CommandGroup, x as CommandInput, y as CommandItem, z as CommandList, D as CommandSeparator, E as CommandShortcut, F as DebouncedInput, G as DebouncedInputProps, H as Dialog, I as DialogClose, J as DialogContent, K as DialogDescription, L as DialogFooter, M as DialogHeader, N as DialogOverlay, O as DialogPortal, P as DialogPresentation, Q as DialogTitle, R as DialogTrigger, S as DictateContextValue, T as DictateProvider, U as DocumentCard, V as DocumentCardProps, W as DocumentEntity, X as DocumentEntityProps, Y as DocumentLike, Z as DropdownMenu, _ as DropdownMenuCheckboxItem, $ as DropdownMenuContent, a0 as DropdownMenuGroup, a1 as DropdownMenuItem, a2 as DropdownMenuLabel, a3 as DropdownMenuPortal, a4 as DropdownMenuRadioGroup, a5 as DropdownMenuRadioItem, a6 as DropdownMenuSeparator, a7 as DropdownMenuShortcut, a8 as DropdownMenuSub, a9 as DropdownMenuSubContent, aa as DropdownMenuSubTrigger, ab as DropdownMenuTrigger, ac as ENTITY_MAPPINGS, ad as EntityIcon, ae as EntityIconComponent, af as EntityPill, ag as EntityRegistryOverride, ah as EntityType, ai as HoverCard, aj as HoverCardContent, ak as HoverCardTrigger, al as IconToggle, am as IconToggleProps, an as IdentityBusy, ao as IdentityProblem, ap as IdentityPurchase, aq as IdentityState, ar as IdentityStatus, as as IdentityStep, at as IdentityVerificationFlow, au as Input, av as InputProps, aw as Label, ax as MarkMenu, ay as MarkMenuItem, az as MarkMenuProps, aA as MarkdownCode, aB as MarkdownLink, aC as MarkdownRenderer, aD as MarkdownRendererProps, aE as MarkdownStreamingContext, aF as NEUTRAL_GRAY, aG as PLACEHOLDER_COLOR, aH as PassageCard, aI as PassageCardProps, aJ as Popover, aK as PopoverAnchor, aL as PopoverClose, aM as PopoverContent, aN as PopoverTrigger, aO as PortalContainerProvider, aP as PresenceDisplayStatus, aQ as PresenceLabel, aR as Progress, aS as ProjectEntity, aT as ProjectEntityProps, aU as ProjectRelation, aV as RadioGroup, aW as RadioGroupItem, aX as Rag, aY as RagDot, aZ as RelevanceDot, a_ as ScrollArea, a$ as ScrollBar, b0 as Select, b1 as SelectContent, b2 as SelectGroup, b3 as SelectItem, b4 as SelectLabel, b5 as SelectScrollDownButton, b6 as SelectScrollUpButton, b7 as SelectSeparator, b8 as SelectTrigger, b9 as SelectValue, ba as Separator, bb as ShieldIcon, bc as ShieldIconProps, bd as Slider, be as StatusBadgeComponent, bf as StatusBadgeProps, bg as StatusPill, bh as StatusPillProps, bi as StatusVariant, bj as Switch, bk as TAG_TYPE_ICONS, bl as TAG_TYPE_LABELS, bm as Table, bn as TableBody, bo as TableCaption, bp as TableCell, bq as TableFooter, br as TableHead, bs as TableHeader, bt as TableRow, bu as Tabs, bv as TabsContent, bw as TabsList, bx as TabsTrigger, by as TagEntity, bz as TagEntityProps, bA as TagLike, bB as Textarea, bC as TextareaProps, bD as ThreadVisibilityIcon, bE as Toggle, bF as ToggleGroup, bG as ToggleGroupItem, bH as Tooltip, bI as TooltipContent, bJ as TooltipProvider, bK as TooltipTrigger, bL as UserEntity, bM as UserEntityProps, bN as UserMenu, bO as UserMenuItem, bP as UserMenuProps, bQ as UserMenuStatus, bR as VISIBILITY_ICONS, bS as VerifiedBadge, bT as VerifiedBadgeProps, bU as VisibilityIcon, bV as VisibilityToggle, bW as VisibilityToggleProps, bX as agentAvatarColors, bY as badgeVariants, bZ as buttonVariants, b_ as cardVariants, b$ as closeOpenEmphasis, c0 as cn, c1 as configureEntityRegistry, c2 as configureRagLabels, c3 as configureStatusRegistry, c4 as getDocIcon, c5 as getEntityColor, c6 as getEntityColorStyles, c7 as getEntityIcon, c8 as getEntityLabel, c9 as getStatusVariant, ca as getTagTypeIcon, cb as getTagTypeLabel, cc as getWorkspaceColor, cd as markdownBaseComponents, ce as markdownSanitizeSchema, cg as splitMarkdownBlocks, ch as toggleVariants, ci as trimOpenCitation, cj as usePortalContainer } from '../index-2Y2MVegs.cjs';
|
|
2
2
|
import 'clsx';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@radix-ui/react-avatar';
|
|
@@ -22,3 +22,4 @@ import '@radix-ui/react-tabs';
|
|
|
22
22
|
import '@radix-ui/react-toggle';
|
|
23
23
|
import '@radix-ui/react-toggle-group';
|
|
24
24
|
import 'react-markdown';
|
|
25
|
+
import 'rehype-sanitize';
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AgentBadge, a as AiMarkdown, b as ArbiIcon, c as Avatar, d as AvatarFallback, e as AvatarImage, B as BASE_COLORS, f as Badge, g as BadgeProps, h as Button, i as ButtonProps, C as Card, j as CardContent, k as CardDescription, l as CardFooter, m as CardHeader, n as CardProps, o as CardTitle, p as Checkbox, q as Collapsible, r as CollapsibleContent, s as CollapsibleTrigger, t as Command, u as CommandDialog, v as CommandEmpty, w as CommandGroup, x as CommandInput, y as CommandItem, z as CommandList, D as CommandSeparator, E as CommandShortcut, F as
|
|
1
|
+
export { A as AgentBadge, a as AiMarkdown, b as ArbiIcon, c as Avatar, d as AvatarFallback, e as AvatarImage, B as BASE_COLORS, f as Badge, g as BadgeProps, h as Button, i as ButtonProps, C as Card, j as CardContent, k as CardDescription, l as CardFooter, m as CardHeader, n as CardProps, o as CardTitle, p as Checkbox, q as Collapsible, r as CollapsibleContent, s as CollapsibleTrigger, t as Command, u as CommandDialog, v as CommandEmpty, w as CommandGroup, x as CommandInput, y as CommandItem, z as CommandList, D as CommandSeparator, E as CommandShortcut, F as DebouncedInput, G as DebouncedInputProps, H as Dialog, I as DialogClose, J as DialogContent, K as DialogDescription, L as DialogFooter, M as DialogHeader, N as DialogOverlay, O as DialogPortal, P as DialogPresentation, Q as DialogTitle, R as DialogTrigger, S as DictateContextValue, T as DictateProvider, U as DocumentCard, V as DocumentCardProps, W as DocumentEntity, X as DocumentEntityProps, Y as DocumentLike, Z as DropdownMenu, _ as DropdownMenuCheckboxItem, $ as DropdownMenuContent, a0 as DropdownMenuGroup, a1 as DropdownMenuItem, a2 as DropdownMenuLabel, a3 as DropdownMenuPortal, a4 as DropdownMenuRadioGroup, a5 as DropdownMenuRadioItem, a6 as DropdownMenuSeparator, a7 as DropdownMenuShortcut, a8 as DropdownMenuSub, a9 as DropdownMenuSubContent, aa as DropdownMenuSubTrigger, ab as DropdownMenuTrigger, ac as ENTITY_MAPPINGS, ad as EntityIcon, ae as EntityIconComponent, af as EntityPill, ag as EntityRegistryOverride, ah as EntityType, ai as HoverCard, aj as HoverCardContent, ak as HoverCardTrigger, al as IconToggle, am as IconToggleProps, an as IdentityBusy, ao as IdentityProblem, ap as IdentityPurchase, aq as IdentityState, ar as IdentityStatus, as as IdentityStep, at as IdentityVerificationFlow, au as Input, av as InputProps, aw as Label, ax as MarkMenu, ay as MarkMenuItem, az as MarkMenuProps, aA as MarkdownCode, aB as MarkdownLink, aC as MarkdownRenderer, aD as MarkdownRendererProps, aE as MarkdownStreamingContext, aF as NEUTRAL_GRAY, aG as PLACEHOLDER_COLOR, aH as PassageCard, aI as PassageCardProps, aJ as Popover, aK as PopoverAnchor, aL as PopoverClose, aM as PopoverContent, aN as PopoverTrigger, aO as PortalContainerProvider, aP as PresenceDisplayStatus, aQ as PresenceLabel, aR as Progress, aS as ProjectEntity, aT as ProjectEntityProps, aU as ProjectRelation, aV as RadioGroup, aW as RadioGroupItem, aX as Rag, aY as RagDot, aZ as RelevanceDot, a_ as ScrollArea, a$ as ScrollBar, b0 as Select, b1 as SelectContent, b2 as SelectGroup, b3 as SelectItem, b4 as SelectLabel, b5 as SelectScrollDownButton, b6 as SelectScrollUpButton, b7 as SelectSeparator, b8 as SelectTrigger, b9 as SelectValue, ba as Separator, bb as ShieldIcon, bc as ShieldIconProps, bd as Slider, be as StatusBadgeComponent, bf as StatusBadgeProps, bg as StatusPill, bh as StatusPillProps, bi as StatusVariant, bj as Switch, bk as TAG_TYPE_ICONS, bl as TAG_TYPE_LABELS, bm as Table, bn as TableBody, bo as TableCaption, bp as TableCell, bq as TableFooter, br as TableHead, bs as TableHeader, bt as TableRow, bu as Tabs, bv as TabsContent, bw as TabsList, bx as TabsTrigger, by as TagEntity, bz as TagEntityProps, bA as TagLike, bB as Textarea, bC as TextareaProps, bD as ThreadVisibilityIcon, bE as Toggle, bF as ToggleGroup, bG as ToggleGroupItem, bH as Tooltip, bI as TooltipContent, bJ as TooltipProvider, bK as TooltipTrigger, bL as UserEntity, bM as UserEntityProps, bN as UserMenu, bO as UserMenuItem, bP as UserMenuProps, bQ as UserMenuStatus, bR as VISIBILITY_ICONS, bS as VerifiedBadge, bT as VerifiedBadgeProps, bU as VisibilityIcon, bV as VisibilityToggle, bW as VisibilityToggleProps, bX as agentAvatarColors, bY as badgeVariants, bZ as buttonVariants, b_ as cardVariants, b$ as closeOpenEmphasis, c0 as cn, c1 as configureEntityRegistry, c2 as configureRagLabels, c3 as configureStatusRegistry, c4 as getDocIcon, c5 as getEntityColor, c6 as getEntityColorStyles, c7 as getEntityIcon, c8 as getEntityLabel, c9 as getStatusVariant, ca as getTagTypeIcon, cb as getTagTypeLabel, cc as getWorkspaceColor, cd as markdownBaseComponents, ce as markdownSanitizeSchema, cg as splitMarkdownBlocks, ch as toggleVariants, ci as trimOpenCitation, cj as usePortalContainer } from '../index-2Y2MVegs.js';
|
|
2
2
|
import 'clsx';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@radix-ui/react-avatar';
|
|
@@ -22,3 +22,4 @@ import '@radix-ui/react-tabs';
|
|
|
22
22
|
import '@radix-ui/react-toggle';
|
|
23
23
|
import '@radix-ui/react-toggle-group';
|
|
24
24
|
import 'react-markdown';
|
|
25
|
+
import 'rehype-sanitize';
|
package/dist/ui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AgentBadge, AiMarkdown, ArbiIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EntityIcon, EntityPill, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, Input, Label, MarkMenu, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, ThreadVisibilityIcon, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, UserMenu, VISIBILITY_ICONS, VerifiedBadge, VisibilityIcon, VisibilityToggle, badgeVariants, cardVariants, configureEntityRegistry, configureRagLabels, configureStatusRegistry, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, toggleVariants } from '../chunk-
|
|
2
|
-
export { MarkdownRenderer, MarkdownStreamingContext, markdownBaseComponents, splitMarkdownBlocks } from '../chunk-
|
|
1
|
+
export { AgentBadge, AiMarkdown, ArbiIcon, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DebouncedInput, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EntityIcon, EntityPill, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, Input, Label, MarkMenu, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ShieldIcon, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, ThreadVisibilityIcon, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, UserMenu, VISIBILITY_ICONS, VerifiedBadge, VisibilityIcon, VisibilityToggle, agentAvatarColors, badgeVariants, cardVariants, configureEntityRegistry, configureRagLabels, configureStatusRegistry, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, toggleVariants } from '../chunk-J3BYHBKW.js';
|
|
2
|
+
export { MarkdownCode, MarkdownLink, MarkdownRenderer, MarkdownStreamingContext, markdownBaseComponents, markdownSanitizeSchema, splitMarkdownBlocks } from '../chunk-C44GO33B.js';
|
|
3
3
|
export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, buttonVariants } from '../chunk-YNNAJJ5Z.js';
|
|
4
4
|
export { closeOpenEmphasis, trimOpenCitation } from '../chunk-QRCMKEE6.js';
|
|
5
5
|
export { ScrollArea, ScrollBar } from '../chunk-W4H6XAIU.js';
|
package/dist/viewers/index.cjs
CHANGED
|
@@ -895,6 +895,95 @@ function DocumentViewer({
|
|
|
895
895
|
})();
|
|
896
896
|
return className ? /* @__PURE__ */ jsxRuntime.jsx("div", { className, "data-testid": "document-viewer", children: body }) : body;
|
|
897
897
|
}
|
|
898
|
+
function inlineFootnotes(content, footnotes) {
|
|
899
|
+
if (!footnotes || Object.keys(footnotes).length === 0) return content;
|
|
900
|
+
let result = content;
|
|
901
|
+
result = result.replace(/^\[\^[^\]]+\]:[ \t]+.*(?:\n(?:[ \t]+.+)?)*/gm, "");
|
|
902
|
+
result = result.replace(/\[\^([^\]]+)\]/g, (_match, key) => {
|
|
903
|
+
const fnContent = footnotes[key];
|
|
904
|
+
if (!fnContent) return `<sup class="fn-ref">${key}</sup>`;
|
|
905
|
+
const escaped = fnContent.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
906
|
+
return `<sup class="fn-ref">${key}</sup><span class="fn-inline" title="${escaped}">[${escaped}]</span>`;
|
|
907
|
+
});
|
|
908
|
+
return result.trim();
|
|
909
|
+
}
|
|
910
|
+
function useProcessedChunks(chunks, footnotes) {
|
|
911
|
+
return react.useMemo(() => {
|
|
912
|
+
if (!chunks || chunks.length === 0) {
|
|
913
|
+
return { processedChunks: [], maxPageNumber: 0 };
|
|
914
|
+
}
|
|
915
|
+
const hasFootnotes = footnotes && Object.keys(footnotes).length > 0;
|
|
916
|
+
const chunksByPage = [];
|
|
917
|
+
let currentPageNumber = -1;
|
|
918
|
+
let currentPageChunks = [];
|
|
919
|
+
let maxPageNumber = 0;
|
|
920
|
+
chunks.forEach((chunk) => {
|
|
921
|
+
const pageNum = chunk.metadata?.page_number;
|
|
922
|
+
if (pageNum && pageNum > maxPageNumber) {
|
|
923
|
+
maxPageNumber = pageNum;
|
|
924
|
+
}
|
|
925
|
+
if (pageNum !== currentPageNumber) {
|
|
926
|
+
if (currentPageChunks.length > 0) {
|
|
927
|
+
chunksByPage.push({
|
|
928
|
+
pageNumber: currentPageNumber > 0 ? currentPageNumber : null,
|
|
929
|
+
chunks: currentPageChunks
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
currentPageNumber = pageNum ?? -1;
|
|
933
|
+
currentPageChunks = [];
|
|
934
|
+
}
|
|
935
|
+
currentPageChunks.push({
|
|
936
|
+
content: hasFootnotes ? inlineFootnotes(chunk.content, footnotes) : chunk.content,
|
|
937
|
+
chunkIndex: chunk.metadata?.chunk_doc_idx,
|
|
938
|
+
chunkExtId: chunk.metadata?.chunk_ext_id,
|
|
939
|
+
docTitle: chunk.metadata?.doc_title ?? void 0
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
if (currentPageChunks.length > 0) {
|
|
943
|
+
chunksByPage.push({
|
|
944
|
+
pageNumber: currentPageNumber > 0 ? currentPageNumber : null,
|
|
945
|
+
chunks: currentPageChunks
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
return { processedChunks: chunksByPage, maxPageNumber };
|
|
949
|
+
}, [chunks, footnotes]);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// src/viewers/selection-runs.ts
|
|
953
|
+
function computeSelectionRuns(pages, selectedChunks) {
|
|
954
|
+
const runs = /* @__PURE__ */ new Map();
|
|
955
|
+
if (selectedChunks.size === 0) return runs;
|
|
956
|
+
const flat = pages.flatMap(
|
|
957
|
+
(page) => page.chunks.map((c) => ({ ...c, pageNumber: page.pageNumber }))
|
|
958
|
+
);
|
|
959
|
+
let i = 0;
|
|
960
|
+
while (i < flat.length) {
|
|
961
|
+
const chunk = flat[i];
|
|
962
|
+
if (!chunk.chunkExtId || !selectedChunks.has(chunk.chunkExtId)) {
|
|
963
|
+
i += 1;
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
let end = i;
|
|
967
|
+
while (end + 1 < flat.length && flat[end + 1].chunkExtId && selectedChunks.has(flat[end + 1].chunkExtId)) {
|
|
968
|
+
end += 1;
|
|
969
|
+
}
|
|
970
|
+
const last = flat[end];
|
|
971
|
+
const endIndex = last.chunkIndex !== void 0 ? last.chunkIndex + 1 : void 0;
|
|
972
|
+
for (let k = i; k <= end; k += 1) {
|
|
973
|
+
const id = flat[k].chunkExtId;
|
|
974
|
+
if (!id) continue;
|
|
975
|
+
runs.set(id, {
|
|
976
|
+
isStart: k === i,
|
|
977
|
+
isEnd: k === end,
|
|
978
|
+
// Only the run's first member carries the label bounds.
|
|
979
|
+
endIndex: k === i ? endIndex : void 0,
|
|
980
|
+
endPage: k === i ? last.pageNumber : void 0
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
i = end + 1;
|
|
984
|
+
}
|
|
985
|
+
return runs;
|
|
986
|
+
}
|
|
898
987
|
|
|
899
988
|
Object.defineProperty(exports, "AudioViewer", {
|
|
900
989
|
enumerable: true,
|
|
@@ -921,6 +1010,7 @@ exports.XlsxViewer = XlsxViewer;
|
|
|
921
1010
|
exports.anchorDelta = anchorDelta;
|
|
922
1011
|
exports.anchoredScroll = anchoredScroll;
|
|
923
1012
|
exports.clampZoom = clampZoom;
|
|
1013
|
+
exports.computeSelectionRuns = computeSelectionRuns;
|
|
924
1014
|
exports.cycleZoom = cycleZoom;
|
|
925
1015
|
exports.doubleTapZoom = doubleTapZoom;
|
|
926
1016
|
exports.nativeViewerKind = nativeViewerKind;
|
|
@@ -928,6 +1018,7 @@ exports.pinchZoom = pinchZoom;
|
|
|
928
1018
|
exports.renderDpr = renderDpr;
|
|
929
1019
|
exports.usePageIntersectionObserver = usePageIntersectionObserver;
|
|
930
1020
|
exports.usePinchZoom = usePinchZoom;
|
|
1021
|
+
exports.useProcessedChunks = useProcessedChunks;
|
|
931
1022
|
exports.useScrollAnchor = useScrollAnchor;
|
|
932
1023
|
exports.zoomLabel = zoomLabel;
|
|
933
1024
|
//# sourceMappingURL=index.cjs.map
|