@frontera-sdk/chat-ui 1.53.5 → 1.53.7
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/agent-picker.js +2 -2
- package/dist/chat.js +19 -67
- package/dist/{chunk-IOLSQ7XK.js → chunk-DJ2Q5U3E.js} +1 -1
- package/dist/{chunk-E3COYKGP.js → chunk-DPCAFZ2S.js} +1 -1
- package/dist/{chunk-YEVMFZRG.js → chunk-G4V3YKMK.js} +41 -19
- package/dist/{chunk-MGXLPADX.js → chunk-G6A5DWFP.js} +964 -0
- package/dist/{chunk-JR2FLI66.js → chunk-GRRSYZQZ.js} +1 -1
- package/dist/{chunk-G67XADLL.js → chunk-KKOK22CN.js} +84 -11
- package/dist/{chunk-VTJ7WSOY.js → chunk-NDU6ERVT.js} +1 -1
- package/dist/{chunk-NGIA5TNW.js → chunk-NOJWGKB4.js} +2 -2
- package/dist/{chunk-F433AP7Q.js → chunk-RCWVJD7G.js} +24 -8
- package/dist/{chunk-KI6SVNT2.js → chunk-RQPL7ZTX.js} +3 -0
- package/dist/{chunk-EKASJRLH.js → chunk-VB2YKQGZ.js} +58 -33
- package/dist/header.js +6 -6
- package/dist/message.js +6 -6
- package/dist/new-session.js +3 -3
- package/dist/parts.js +2 -2
- package/dist/{pdf-deck-view-inner-IWBUG4WN.js → pdf-deck-view-inner-UEMN324J.js} +8 -4
- package/dist/{pdf-document-view-inner-6RK4MYTM.js → pdf-document-view-inner-SH2HOPGD.js} +40 -7
- package/dist/pending-cards.js +2 -2
- package/dist/platform.css +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { getToolMeta } from './chunk-
|
|
2
|
+
import { getToolMeta } from './chunk-RQPL7ZTX.js';
|
|
3
3
|
import { Button } from './chunk-UWKO24VT.js';
|
|
4
4
|
import { ChevronDownMediumIcon, CrossMediumIcon } from './chunk-EZX3E3BB.js';
|
|
5
5
|
import { useChatClientOptional } from './chunk-6JLWE7M3.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { ChevronLeftIcon } from './chunk-CWAOLMFS.js';
|
|
3
3
|
import { MagnifyingGlassIcon, Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from './chunk-FZ3VSITY.js';
|
|
4
|
-
import { useIsMobile, useTranslation } from './chunk-
|
|
5
|
-
import { ToolCallItem, ProcessorIcon } from './chunk-
|
|
6
|
-
import { describeToolRow, toolKindLabel, getToolMeta, Shimmer, Collapse, ToolGroupReasoningItem, SkillToolItem, DeviceDesktopIcon, WorldSearchIcon, FileTextIcon, useStreamdownPlugins, CircleXIcon, STREAMDOWN_LINK_SAFETY, Folder1Icon, AppIconFrame, AppIcon, Collapsible, CollapsibleTrigger, CollapsibleContent, SquareArrowTopRightIcon, Icon } from './chunk-
|
|
4
|
+
import { useIsMobile, useTranslation } from './chunk-G6A5DWFP.js';
|
|
5
|
+
import { ToolCallItem, ProcessorIcon } from './chunk-DJ2Q5U3E.js';
|
|
6
|
+
import { describeToolRow, toolKindLabel, getToolMeta, Shimmer, Collapse, ToolGroupReasoningItem, SkillToolItem, DeviceDesktopIcon, WorldSearchIcon, FileTextIcon, useStreamdownPlugins, CircleXIcon, STREAMDOWN_LINK_SAFETY, Folder1Icon, AppIconFrame, AppIcon, Collapsible, CollapsibleTrigger, CollapsibleContent, SquareArrowTopRightIcon, Icon } from './chunk-RQPL7ZTX.js';
|
|
7
7
|
import { ChevronDownMediumIcon, Button, Skeleton, buttonVariants } from './chunk-UWKO24VT.js';
|
|
8
8
|
import { Dialog, DialogContent, DialogTitle, DialogDescription, DialogClose, CrossMediumIcon, DialogHeader, DialogFooter } from './chunk-2P4IEVOQ.js';
|
|
9
9
|
import { zipSync } from './chunk-CDTES65T.js';
|
|
10
10
|
import { ChevronRightIcon, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent } from './chunk-C3HW5S2Z.js';
|
|
11
|
-
import { FORMAT_EXT, AgentAvatar } from './chunk-
|
|
11
|
+
import { FORMAT_EXT, AgentAvatar, parseKnowledgeAppCitation } from './chunk-RCWVJD7G.js';
|
|
12
12
|
import { Images1Icon, SlidesWideIcon, FilePdfIcon, TableIcon, FileTextIcon as FileTextIcon$1, SquareArrowTopRightIcon as SquareArrowTopRightIcon$1, FileDownloadIcon } from './chunk-EZX3E3BB.js';
|
|
13
13
|
import { cn, Checkmark1Icon, usePortalContainer } from './chunk-LGVMMBL3.js';
|
|
14
14
|
import { useChatClientOptional } from './chunk-6JLWE7M3.js';
|
|
@@ -10448,6 +10448,58 @@ var useChatOverviewStore = create((set2) => ({
|
|
|
10448
10448
|
)
|
|
10449
10449
|
)
|
|
10450
10450
|
}));
|
|
10451
|
+
var noSurfaceCapture = {
|
|
10452
|
+
captureEligibleSurface: () => null,
|
|
10453
|
+
legacyPageHint: () => null,
|
|
10454
|
+
legacyPageAttachment: () => null,
|
|
10455
|
+
prepareCapturedSurface: async (context) => context,
|
|
10456
|
+
noteCapturedSurface: () => {
|
|
10457
|
+
},
|
|
10458
|
+
releaseCapturedSurface: () => {
|
|
10459
|
+
},
|
|
10460
|
+
confirmCapturedRunTerminal: () => {
|
|
10461
|
+
},
|
|
10462
|
+
settleCapturedRun: () => {
|
|
10463
|
+
},
|
|
10464
|
+
waitForReadySurface: async () => true
|
|
10465
|
+
};
|
|
10466
|
+
var NO_REMEMBERED_MODEL = { modelMode: null, reasoningEffort: null };
|
|
10467
|
+
function useNoSurfaceProvider() {
|
|
10468
|
+
}
|
|
10469
|
+
function useNoRememberedModel() {
|
|
10470
|
+
return NO_REMEMBERED_MODEL;
|
|
10471
|
+
}
|
|
10472
|
+
function useNotBeside() {
|
|
10473
|
+
return false;
|
|
10474
|
+
}
|
|
10475
|
+
function useNoPrepareToLeave() {
|
|
10476
|
+
return void 0;
|
|
10477
|
+
}
|
|
10478
|
+
function resolveChatHost(host) {
|
|
10479
|
+
return {
|
|
10480
|
+
surfaceCapture: host.surfaceCapture ?? noSurfaceCapture,
|
|
10481
|
+
useSurfaceProvider: host.useSurfaceProvider ?? useNoSurfaceProvider,
|
|
10482
|
+
useRememberedComposerModel: host.useRememberedComposerModel ?? useNoRememberedModel,
|
|
10483
|
+
rememberComposerModel: host.rememberComposerModel ?? null,
|
|
10484
|
+
useAssistantBeside: host.useAssistantBeside ?? useNotBeside,
|
|
10485
|
+
AssistantEmptyState: host.AssistantEmptyState ?? null,
|
|
10486
|
+
ApprovalsView: host.ApprovalsView ?? null,
|
|
10487
|
+
usePrepareToLeave: host.usePrepareToLeave ?? useNoPrepareToLeave,
|
|
10488
|
+
platformLinks: host.platformLinks ?? true,
|
|
10489
|
+
KnowledgeDocumentViewer: host.KnowledgeDocumentViewer ?? null
|
|
10490
|
+
};
|
|
10491
|
+
}
|
|
10492
|
+
var EMPTY_HOST = resolveChatHost({});
|
|
10493
|
+
var ChatHostContext = createContext(EMPTY_HOST);
|
|
10494
|
+
function ChatHostProvider({ host, children }) {
|
|
10495
|
+
return /* @__PURE__ */ jsx(ChatHostContext.Provider, { value: host, children });
|
|
10496
|
+
}
|
|
10497
|
+
function useChatHost() {
|
|
10498
|
+
return useContext(ChatHostContext);
|
|
10499
|
+
}
|
|
10500
|
+
function useChatSurfaceProvider(options) {
|
|
10501
|
+
return useChatHost().useSurfaceProvider(options);
|
|
10502
|
+
}
|
|
10451
10503
|
var enrichmentCache = /* @__PURE__ */ new Map();
|
|
10452
10504
|
var pendingEnrichments = /* @__PURE__ */ new Map();
|
|
10453
10505
|
var SOURCE_ENRICH_BATCH_SIZE = 20;
|
|
@@ -13529,10 +13581,11 @@ function connectVerb(opts) {
|
|
|
13529
13581
|
|
|
13530
13582
|
// ../platform-kit/src/lib/platform-scope-path.ts
|
|
13531
13583
|
var SLUG = /^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$/;
|
|
13532
|
-
var WORKSPACE_APPS = /* @__PURE__ */ new Set(["home", "chat", "omnichannel", "voice", "apps", "applications", "blueprint", "forge"]);
|
|
13584
|
+
var WORKSPACE_APPS = /* @__PURE__ */ new Set(["home", "chat", "omnichannel", "voice", "apps", "applications", "blueprint", "knowledge", "forge"]);
|
|
13585
|
+
var TWO_SCOPE_APPS = /* @__PURE__ */ new Set(["blueprint", "knowledge"]);
|
|
13533
13586
|
var CONSOLE_APPS = /* @__PURE__ */ new Set(["agents", "workflows", "functions"]);
|
|
13534
13587
|
var CONSOLE_UNSCOPED = /* @__PURE__ */ new Set(["workspaces", "connections"]);
|
|
13535
|
-
var ORG_APPS = /* @__PURE__ */ new Set(["blueprint", "settings", "admin"]);
|
|
13588
|
+
var ORG_APPS = /* @__PURE__ */ new Set(["blueprint", "settings", "admin", "knowledge"]);
|
|
13536
13589
|
var ORG_SETTINGS_PUBLIC_APP = "settings";
|
|
13537
13590
|
var ORG_SETTINGS_INTERNAL_APP = "admin";
|
|
13538
13591
|
var WORKSPACE_SETTINGS_PUBLIC_APP = "settings";
|
|
@@ -13599,8 +13652,8 @@ function scopePlatformHref(href, currentPathname) {
|
|
|
13599
13652
|
const tail = rest.length && CONSOLE_APPS.has(rest[0]) ? `/${rest.join("/")}` : `/console/${rest.join("/") || "metrics"}`;
|
|
13600
13653
|
return workspacePath(scope.orgSlug, slug) + tail + suffix2;
|
|
13601
13654
|
}
|
|
13602
|
-
if (
|
|
13603
|
-
if (!scope.workspaceSlug && app
|
|
13655
|
+
if (WORKSPACE_APPS.has(app) || CONSOLE_APPS.has(app) || app === "console") {
|
|
13656
|
+
if (!scope.workspaceSlug && !TWO_SCOPE_APPS.has(app)) return href;
|
|
13604
13657
|
return scope.basePath + path2 + suffix2;
|
|
13605
13658
|
}
|
|
13606
13659
|
return href;
|
|
@@ -18904,13 +18957,14 @@ function passagesByUrl(text3) {
|
|
|
18904
18957
|
}
|
|
18905
18958
|
return out;
|
|
18906
18959
|
}
|
|
18960
|
+
var KNOWLEDGE_SEARCH_TOOLS = /* @__PURE__ */ new Set(["searchKnowledge", "searchKnowledgeBases", "readKnowledgeBaseDocument"]);
|
|
18907
18961
|
function extractCitationsFromSteps(items) {
|
|
18908
18962
|
const toolItems = items.filter(
|
|
18909
18963
|
(i) => i.type === "tool"
|
|
18910
18964
|
);
|
|
18911
18965
|
return toolItems.reduce((acc, item) => {
|
|
18912
18966
|
const toolName = getToolName(item.part);
|
|
18913
|
-
if (toolName === "web_search" || toolName
|
|
18967
|
+
if (toolName === "web_search" || KNOWLEDGE_SEARCH_TOOLS.has(toolName)) {
|
|
18914
18968
|
const rawOutput = getToolOutput(item.part);
|
|
18915
18969
|
const output = rawOutput && typeof rawOutput === "object" && "value" in rawOutput ? rawOutput.value : rawOutput;
|
|
18916
18970
|
if (output && typeof output === "object" && !Array.isArray(output)) {
|
|
@@ -19199,7 +19253,7 @@ var MessageStepsGroup = memo(function MessageStepsGroup2({
|
|
|
19199
19253
|
`${messageId}-mem-${item.index}`
|
|
19200
19254
|
);
|
|
19201
19255
|
}
|
|
19202
|
-
if (getToolName(item.part)
|
|
19256
|
+
if (KNOWLEDGE_SEARCH_TOOLS.has(getToolName(item.part))) {
|
|
19203
19257
|
return /* @__PURE__ */ jsx(
|
|
19204
19258
|
SearchedKnowledgeToolItem,
|
|
19205
19259
|
{
|
|
@@ -52431,6 +52485,25 @@ function FileThumbnail({
|
|
|
52431
52485
|
return /* @__PURE__ */ jsx("div", { className: `${base} bg-blue-500/15`, children: /* @__PURE__ */ jsx(FileTextIcon, { className: `${iconClass} text-blue-400` }) });
|
|
52432
52486
|
}
|
|
52433
52487
|
}
|
|
52488
|
+
function useCitedDocument(url, title) {
|
|
52489
|
+
const { KnowledgeDocumentViewer: Viewer } = useChatHost();
|
|
52490
|
+
const [open, setOpen] = useState(false);
|
|
52491
|
+
const cited = url ? parseKnowledgeAppCitation(url) : null;
|
|
52492
|
+
if (!Viewer || !cited) return null;
|
|
52493
|
+
return {
|
|
52494
|
+
open: () => setOpen(true),
|
|
52495
|
+
opened: open,
|
|
52496
|
+
viewer: open ? /* @__PURE__ */ jsx(
|
|
52497
|
+
Viewer,
|
|
52498
|
+
{
|
|
52499
|
+
documentId: cited.documentId,
|
|
52500
|
+
page: cited.page,
|
|
52501
|
+
title,
|
|
52502
|
+
onClose: () => setOpen(false)
|
|
52503
|
+
}
|
|
52504
|
+
) : null
|
|
52505
|
+
};
|
|
52506
|
+
}
|
|
52434
52507
|
/*! Bundled license information:
|
|
52435
52508
|
|
|
52436
52509
|
decimal.js-light/decimal.js:
|
|
@@ -52447,4 +52520,4 @@ react-is/cjs/react-is.development.js:
|
|
|
52447
52520
|
*)
|
|
52448
52521
|
*/
|
|
52449
52522
|
|
|
52450
|
-
export { AGENT_AVATAR_SIZE, ActionMenu, AgentRoutineForm, AgentsProvider, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, ArrowRightIcon, ArrowUpIcon, ArrowsShowIcon, ArtifactActionsMenu, AudioIcon, BookIcon, ChatImageLightbox, CircleCheckIcon, CitationViewerContext, ConnectRunnerContext, DecisionCard, DotGrid1x3HorizontalTightIcon, DropdownMenu2 as DropdownMenu, DropdownMenuTrigger2 as DropdownMenuTrigger, ExclamationCircleIcon, EyeOpenIcon, EyeSlashIcon, FileDownloadIcon2 as FileDownloadIcon, FilePdfIcon2 as FilePdfIcon, FileThumbnail, GridSpinner, ImageResultsGallery, Images1Icon2 as Images1Icon, Input, Label, LayoutDashboardIcon, LayoutGrid1Icon, LoaderIcon, MarkdownRenderer, MessageDecisionCards, MessageStepsGroup, MobileScreenSheet, PanelEdgeRing, PluginProvider, ShieldCheckIcon, SlidesWideIcon2 as SlidesWideIcon, SourceFavicon, SpreadsheetIcon, StudioDisplayIcon, StyledDropdownMenuContent, StyledDropdownMenuItem, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VideoIcon, WorkspaceProvider, WorldIcon, ZoomableImage, agentRoutineKeys, appsKeys, artifactCategory, artifactFormatIcon, artifactFormatSubtitle, attachmentFileOf, authFetch, avatarMotionForStream, buildTenantUrlAbsolute, canvasId, dedup, dedupeImageResults, errorText, exportDocumentPdf, extractCitationsFromSteps, extractDomain, extractImagesFromSteps, formatDecisionTime, formatFileSize, formatRelativeTime, getBearerHeadersForApi, getDocumentStreamArtifacts, getFileCategory, getMessageCreatedAtMs, getMessageDisplayTimestampValue, getPersonConfirmation, getSdkDarkMode, getToolErrorText, getToolInput, getToolName, getToolOutput, getToolState, isApprovalRequested, isRequestHumanTool, isToolPart, processMessageParts, renderPluginBlock, requestPaneFocus, resolveArtifactIconFormat, resolveBearerHeaders, resolvePluginLanguage, resolveSourceDisplay, setSdkConversationPath, setSdkDarkMode, sourceKind, subscribeSdkDarkMode, tableToCsv, tableToMarkdown, tableToXlsx, treatyErrorMessage, unwrap, unwrapData, unwrapDataDeep, useAgentConnectionStatus, useAgentHistorySource, useAgentPanelStore, useAgentRoster, useArtifact, useArtifactFileBytes, useArtifactFileObjectUrl, useArtifactPreviewFileObjectUrl, useArtifactStore, useArtifactVersion, useArtifactVersionPreviewFileObjectUrl, useArtifactVersions, useArtifacts, useBasePath, useBrand, useCanvasStore, useCatalog, useChatCapabilities, useChatCapabilityEnabled, useChatOptInEnabled, useChatOverviewStore, useCitationViewer, useClient, useConnectRunner, useConversationDesktopStatus, useDownloadArtifact, useInstalls, useKeyboardInset, useOptionalAgentsContext, useOptionalWorkspaceContext, usePaneFocusStore, usePathname2 as usePathname, usePlugins, useRestoreArtifactVersion, useRevokeGrant, useRouter2 as useRouter, useSession, useSessionPendingApprovals, useSourcesEnrichment, useStartUserConnect, useUpdateArtifact, useUpsertGrant, useWorkspaceContext, useWorkspaceSlug };
|
|
52523
|
+
export { AGENT_AVATAR_SIZE, ActionMenu, AgentRoutineForm, AgentsProvider, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, ArrowRightIcon, ArrowUpIcon, ArrowsShowIcon, ArtifactActionsMenu, AudioIcon, BookIcon, ChatHostProvider, ChatImageLightbox, CircleCheckIcon, CitationViewerContext, ConnectRunnerContext, DecisionCard, DotGrid1x3HorizontalTightIcon, DropdownMenu2 as DropdownMenu, DropdownMenuTrigger2 as DropdownMenuTrigger, ExclamationCircleIcon, EyeOpenIcon, EyeSlashIcon, FileDownloadIcon2 as FileDownloadIcon, FilePdfIcon2 as FilePdfIcon, FileThumbnail, GridSpinner, ImageResultsGallery, Images1Icon2 as Images1Icon, Input, Label, LayoutDashboardIcon, LayoutGrid1Icon, LoaderIcon, MarkdownRenderer, MessageDecisionCards, MessageStepsGroup, MobileScreenSheet, PanelEdgeRing, PluginProvider, ShieldCheckIcon, SlidesWideIcon2 as SlidesWideIcon, SourceFavicon, SpreadsheetIcon, StudioDisplayIcon, StyledDropdownMenuContent, StyledDropdownMenuItem, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VideoIcon, WorkspaceProvider, WorldIcon, ZoomableImage, agentRoutineKeys, appsKeys, artifactCategory, artifactFormatIcon, artifactFormatSubtitle, attachmentFileOf, authFetch, avatarMotionForStream, buildTenantUrlAbsolute, canvasId, dedup, dedupeImageResults, errorText, exportDocumentPdf, extractCitationsFromSteps, extractDomain, extractImagesFromSteps, formatDecisionTime, formatFileSize, formatRelativeTime, getBearerHeadersForApi, getDocumentStreamArtifacts, getFileCategory, getMessageCreatedAtMs, getMessageDisplayTimestampValue, getPersonConfirmation, getSdkDarkMode, getToolErrorText, getToolInput, getToolName, getToolOutput, getToolState, isApprovalRequested, isRequestHumanTool, isToolPart, processMessageParts, renderPluginBlock, requestPaneFocus, resolveArtifactIconFormat, resolveBearerHeaders, resolveChatHost, resolvePluginLanguage, resolveSourceDisplay, setSdkConversationPath, setSdkDarkMode, sourceKind, subscribeSdkDarkMode, tableToCsv, tableToMarkdown, tableToXlsx, treatyErrorMessage, unwrap, unwrapData, unwrapDataDeep, useAgentConnectionStatus, useAgentHistorySource, useAgentPanelStore, useAgentRoster, useArtifact, useArtifactFileBytes, useArtifactFileObjectUrl, useArtifactPreviewFileObjectUrl, useArtifactStore, useArtifactVersion, useArtifactVersionPreviewFileObjectUrl, useArtifactVersions, useArtifacts, useBasePath, useBrand, useCanvasStore, useCatalog, useChatCapabilities, useChatCapabilityEnabled, useChatHost, useChatOptInEnabled, useChatOverviewStore, useChatSurfaceProvider, useCitationViewer, useCitedDocument, useClient, useConnectRunner, useConversationDesktopStatus, useDownloadArtifact, useInstalls, useKeyboardInset, useOptionalAgentsContext, useOptionalWorkspaceContext, usePaneFocusStore, usePathname2 as usePathname, usePlugins, useRestoreArtifactVersion, useRevokeGrant, useRouter2 as useRouter, useSession, useSessionPendingApprovals, useSourcesEnrichment, useStartUserConnect, useUpdateArtifact, useUpsertGrant, useWorkspaceContext, useWorkspaceSlug };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from './chunk-C3HW5S2Z.js';
|
|
3
|
-
import { AgentAvatar } from './chunk-
|
|
3
|
+
import { AgentAvatar } from './chunk-RCWVJD7G.js';
|
|
4
4
|
import { ChevronDownMediumIcon } from './chunk-EZX3E3BB.js';
|
|
5
5
|
import { useChatClientOptional } from './chunk-6JLWE7M3.js';
|
|
6
6
|
import { useState, useEffect } from 'react';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Sheet, SheetContent, SheetHeader, SheetTitle, Popover, PopoverTrigger, PopoverContent, MagnifyingGlassIcon } from './chunk-FZ3VSITY.js';
|
|
3
|
-
import { useIsMobile, useTranslation } from './chunk-
|
|
3
|
+
import { useIsMobile, useTranslation } from './chunk-G6A5DWFP.js';
|
|
4
4
|
import { CrossMediumIcon } from './chunk-2P4IEVOQ.js';
|
|
5
|
-
import { AgentAvatar } from './chunk-
|
|
5
|
+
import { AgentAvatar } from './chunk-RCWVJD7G.js';
|
|
6
6
|
import { cn, Checkmark1Icon } from './chunk-LGVMMBL3.js';
|
|
7
7
|
import * as t from 'react';
|
|
8
8
|
import { memo, useState } from 'react';
|
|
@@ -2143,19 +2143,35 @@ function decodedSegment(value) {
|
|
|
2143
2143
|
return value;
|
|
2144
2144
|
}
|
|
2145
2145
|
}
|
|
2146
|
-
function knowledgeCitationUrl(knowledgeName, sourceId) {
|
|
2147
|
-
return `${KNOWLEDGE_CITATION_PREFIX}${encodedSegment(knowledgeName)}/${encodedSegment(sourceId)}`;
|
|
2146
|
+
function knowledgeCitationUrl(knowledgeName, sourceId, page) {
|
|
2147
|
+
return `${KNOWLEDGE_CITATION_PREFIX}${encodedSegment(knowledgeName)}/${encodedSegment(sourceId)}${page ? `?page=${page}` : ""}`;
|
|
2148
2148
|
}
|
|
2149
|
-
var
|
|
2149
|
+
var KNOWLEDGE_APP_CITATION_PREFIX = "/cite/knowledge-app/";
|
|
2150
|
+
function knowledgeAppCitationUrl(baseName, documentId, page) {
|
|
2151
|
+
return `${KNOWLEDGE_APP_CITATION_PREFIX}${encodedSegment(baseName)}/${encodedSegment(documentId)}${page ? `?page=${page}` : ""}`;
|
|
2152
|
+
}
|
|
2153
|
+
var KNOWLEDGE_APP_CITATION = /^\/cite\/knowledge-app\/(.+)\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\?page=(\d+))?$/i;
|
|
2154
|
+
function parseKnowledgeAppCitation(url) {
|
|
2155
|
+
const match = KNOWLEDGE_APP_CITATION.exec(url);
|
|
2156
|
+
if (!match) return null;
|
|
2157
|
+
const page = match[3] ? Number(match[3]) : null;
|
|
2158
|
+
return { documentId: match[2].toLowerCase(), page: page && page > 0 ? page : null };
|
|
2159
|
+
}
|
|
2160
|
+
var KNOWLEDGE_CITATION = /^\/cite\/knowledge\/(.+)\/([A-Za-z0-9_-]+)(?:\?page=(\d+))?$/;
|
|
2150
2161
|
function canonicalCitationUrl(url) {
|
|
2162
|
+
const app = KNOWLEDGE_APP_CITATION.exec(url);
|
|
2163
|
+
if (app) return knowledgeAppCitationUrl(decodedSegment(app[1]), app[2].toLowerCase(), app[3] ? Number(app[3]) : void 0);
|
|
2151
2164
|
const match = KNOWLEDGE_CITATION.exec(url);
|
|
2152
2165
|
if (!match) return url;
|
|
2153
|
-
return knowledgeCitationUrl(decodedSegment(match[1]), match[2]);
|
|
2166
|
+
return knowledgeCitationUrl(decodedSegment(match[1]), match[2], match[3] ? Number(match[3]) : void 0);
|
|
2154
2167
|
}
|
|
2155
|
-
var KNOWLEDGE_CITATION_LINK = /\]\(\/cite\/knowledge\/([^\n]+?)\/([A-Za-z0-9_-]+)\)/g;
|
|
2168
|
+
var KNOWLEDGE_CITATION_LINK = /\]\(\/cite\/(knowledge|knowledge-app)\/([^\n]+?)\/([A-Za-z0-9_-]+)(?:\?page=(\d+))?\)/g;
|
|
2156
2169
|
function encodeKnowledgeCitationLinks(markdown) {
|
|
2157
|
-
if (!markdown.includes("](/cite/knowledge
|
|
2158
|
-
return markdown.replace(KNOWLEDGE_CITATION_LINK, (_m, name, id) =>
|
|
2170
|
+
if (!markdown.includes("](/cite/knowledge")) return markdown;
|
|
2171
|
+
return markdown.replace(KNOWLEDGE_CITATION_LINK, (_m, kind, name, id, page) => {
|
|
2172
|
+
const address = kind === "knowledge" ? knowledgeCitationUrl : knowledgeAppCitationUrl;
|
|
2173
|
+
return `](${address(decodedSegment(name), id, page ? Number(page) : void 0)})`;
|
|
2174
|
+
});
|
|
2159
2175
|
}
|
|
2160
2176
|
|
|
2161
2177
|
// src/adapters/service-types.ts
|
|
@@ -2242,4 +2258,4 @@ var AgentAvatarView = memo(function AgentAvatarView2({
|
|
|
2242
2258
|
});
|
|
2243
2259
|
var AgentAvatar = AgentAvatarView;
|
|
2244
2260
|
|
|
2245
|
-
export { AgentAvatar, FORMAT_EXT, HISTORY_CITATION_PREFIX, canonicalCitationUrl, encodeKnowledgeCitationLinks, historyCitationReference };
|
|
2261
|
+
export { AgentAvatar, FORMAT_EXT, HISTORY_CITATION_PREFIX, canonicalCitationUrl, encodeKnowledgeCitationLinks, historyCitationReference, parseKnowledgeAppCitation };
|
|
@@ -1187,6 +1187,9 @@ var TOOL_ROW_CONFIG = {
|
|
|
1187
1187
|
view_image: { done: "Viewed image", running: "Viewing image", fail: "View failed", targetKeys: ["path"], mono: true },
|
|
1188
1188
|
web_search: { done: "Searched the web", running: "Searching the web", fail: "Web search failed", targetKeys: ["query", "search"], quote: true },
|
|
1189
1189
|
searchKnowledge: { done: "Searched knowledge", running: "Searching knowledge", fail: "Knowledge search failed", targetKeys: ["query"], quote: true },
|
|
1190
|
+
listKnowledgeBases: { done: "Listed knowledge bases", running: "Listing knowledge bases", fail: "Listing knowledge bases failed" },
|
|
1191
|
+
searchKnowledgeBases: { done: "Searched knowledge bases", running: "Searching knowledge bases", fail: "Knowledge search failed", targetKeys: ["query"], quote: true },
|
|
1192
|
+
readKnowledgeBaseDocument: { done: "Read a document", running: "Reading a document", fail: "Read failed" },
|
|
1190
1193
|
findKnowledgeDocuments: { done: "Looked for documents", running: "Looking for documents", fail: "Document search failed", targetKeys: ["query"], quote: true },
|
|
1191
1194
|
readKnowledgeDocument: { done: "Read a document", running: "Reading a document", fail: "Read failed" },
|
|
1192
1195
|
lookupKnowledgeEntity: { done: "Looked up", running: "Looking up", fail: "Lookup failed", targetKeys: ["name"] },
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { requestPaneFocus, useArtifacts, usePlugins, useCanvasStore, useArtifactStore, useChatOverviewStore, useSourcesEnrichment, sourceKind, useCitationViewer, resolveSourceDisplay, extractDomain, canvasId, StudioDisplayIcon, LayoutDashboardIcon, useAgentPanelStore, SourceFavicon, dedup, useArtifactFileObjectUrl, resolveArtifactIconFormat, artifactFormatIcon, avatarMotionForStream, AGENT_AVATAR_SIZE, getFileCategory, FileThumbnail, formatFileSize, usePathname, artifactFormatSubtitle, artifactCategory, Input, MobileScreenSheet, TooltipTrigger, Tooltip, useChatCapabilities, TooltipContent, processMessageParts, GridSpinner, PanelEdgeRing, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, extractCitationsFromSteps, resolvePluginLanguage, getMessageDisplayTimestampValue } from './chunk-
|
|
2
|
+
import { requestPaneFocus, useArtifacts, usePlugins, useCanvasStore, useArtifactStore, useChatOverviewStore, useSourcesEnrichment, sourceKind, useCitationViewer, resolveSourceDisplay, extractDomain, useCitedDocument, canvasId, StudioDisplayIcon, LayoutDashboardIcon, useAgentPanelStore, SourceFavicon, dedup, useArtifactFileObjectUrl, resolveArtifactIconFormat, artifactFormatIcon, avatarMotionForStream, AGENT_AVATAR_SIZE, getFileCategory, FileThumbnail, formatFileSize, usePathname, artifactFormatSubtitle, artifactCategory, Input, MobileScreenSheet, TooltipTrigger, Tooltip, useChatCapabilities, TooltipContent, processMessageParts, GridSpinner, PanelEdgeRing, ArtifactActionsMenu, DotGrid1x3HorizontalTightIcon, extractCitationsFromSteps, resolvePluginLanguage, getMessageDisplayTimestampValue } from './chunk-KKOK22CN.js';
|
|
3
3
|
import { MagnifyingGlassIcon, Popover, PopoverTrigger, PopoverContent, Sheet, SheetContent, SheetHeader, SheetTitle } from './chunk-FZ3VSITY.js';
|
|
4
|
-
import { useTranslation, useIsMobile } from './chunk-
|
|
5
|
-
import { Collapsible, CollapsibleTrigger, CollapsibleContent, Shimmer, HoverCard, HoverCardTrigger, HoverCardContent } from './chunk-
|
|
4
|
+
import { useTranslation, useIsMobile } from './chunk-G6A5DWFP.js';
|
|
5
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent, Shimmer, HoverCard, HoverCardTrigger, HoverCardContent } from './chunk-RQPL7ZTX.js';
|
|
6
6
|
import { ChevronDownMediumIcon, ScrollArea, Skeleton, Button } from './chunk-UWKO24VT.js';
|
|
7
7
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, CrossMediumIcon } from './chunk-2P4IEVOQ.js';
|
|
8
8
|
import { ChevronRightIcon } from './chunk-C3HW5S2Z.js';
|
|
9
|
-
import { AgentAvatar } from './chunk-
|
|
9
|
+
import { AgentAvatar } from './chunk-RCWVJD7G.js';
|
|
10
10
|
import { BulletListIcon, FilesIcon } from './chunk-EZX3E3BB.js';
|
|
11
11
|
import { cn, Checkmark1Icon } from './chunk-LGVMMBL3.js';
|
|
12
12
|
import { __require } from './chunk-PR4QN5HX.js';
|
|
@@ -9138,35 +9138,44 @@ function OverviewSection({
|
|
|
9138
9138
|
function SourceFaviconHover({ citation, enriched }) {
|
|
9139
9139
|
const { domain, title, snippet, favicon, kind } = resolveSourceDisplay(citation, enriched);
|
|
9140
9140
|
const viewer = useCitationViewer();
|
|
9141
|
-
const
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9141
|
+
const document2 = useCitedDocument(citation.url, title);
|
|
9142
|
+
const [previewing, setPreviewing] = useState(false);
|
|
9143
|
+
const openDocument = document2 ? () => {
|
|
9144
|
+
setPreviewing(false);
|
|
9145
|
+
document2.open();
|
|
9146
|
+
} : null;
|
|
9147
|
+
const open = openDocument ?? (viewer !== null && kind === "knowledge" ? () => viewer.open(citation) : null);
|
|
9148
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9149
|
+
document2?.viewer,
|
|
9150
|
+
/* @__PURE__ */ jsxs(HoverCard, { open: previewing && !document2?.opened, onOpenChange: setPreviewing, openDelay: 200, closeDelay: 100, children: [
|
|
9151
|
+
/* @__PURE__ */ jsx(HoverCardTrigger, { asChild: true, children: open ? /* @__PURE__ */ jsx(
|
|
9152
|
+
"button",
|
|
9153
|
+
{
|
|
9154
|
+
type: "button",
|
|
9155
|
+
onClick: open,
|
|
9156
|
+
"aria-label": title,
|
|
9157
|
+
className: "inline-flex shrink-0 transition-shadow",
|
|
9158
|
+
children: /* @__PURE__ */ jsx(SourceFavicon, { favicon, domain, size: "sm", kind })
|
|
9159
|
+
}
|
|
9160
|
+
) : /* @__PURE__ */ jsx(
|
|
9161
|
+
"a",
|
|
9162
|
+
{
|
|
9163
|
+
href: citation.url,
|
|
9164
|
+
target: "_blank",
|
|
9165
|
+
rel: "noopener noreferrer",
|
|
9166
|
+
"aria-label": title,
|
|
9167
|
+
className: "inline-flex shrink-0 transition-shadow",
|
|
9168
|
+
children: /* @__PURE__ */ jsx(SourceFavicon, { favicon, domain, size: "sm", kind })
|
|
9169
|
+
}
|
|
9170
|
+
) }),
|
|
9171
|
+
/* @__PURE__ */ jsxs(HoverCardContent, { side: "top", className: "w-72 p-3", children: [
|
|
9172
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
9173
|
+
/* @__PURE__ */ jsx(SourceFavicon, { favicon, domain, size: "sm", kind }),
|
|
9174
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-xs text-muted-foreground", children: domain })
|
|
9175
|
+
] }),
|
|
9176
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm font-medium leading-snug line-clamp-2", children: title }),
|
|
9177
|
+
snippet ? /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-relaxed text-muted-foreground line-clamp-3", children: snippet }) : null
|
|
9178
|
+
] })
|
|
9170
9179
|
] })
|
|
9171
9180
|
] });
|
|
9172
9181
|
}
|
|
@@ -9626,6 +9635,7 @@ function SourceRow({
|
|
|
9626
9635
|
favicon: null
|
|
9627
9636
|
};
|
|
9628
9637
|
const label = extractDomain(citation.url) || citation.url;
|
|
9638
|
+
const document2 = useCitedDocument(citation.url, title);
|
|
9629
9639
|
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9630
9640
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
9631
9641
|
/* @__PURE__ */ jsx(SourceFavicon, { favicon, domain: label, size: "sm", kind }),
|
|
@@ -9639,6 +9649,21 @@ function SourceRow({
|
|
|
9639
9649
|
focused && "bg-surface-active",
|
|
9640
9650
|
className
|
|
9641
9651
|
);
|
|
9652
|
+
if (document2 && !onSelect) {
|
|
9653
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9654
|
+
/* @__PURE__ */ jsx(
|
|
9655
|
+
"button",
|
|
9656
|
+
{
|
|
9657
|
+
type: "button",
|
|
9658
|
+
"data-source-url": citation.url,
|
|
9659
|
+
onClick: document2.open,
|
|
9660
|
+
className: cn(shared, "hover:bg-surface-hover focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none"),
|
|
9661
|
+
children: body
|
|
9662
|
+
}
|
|
9663
|
+
),
|
|
9664
|
+
document2.viewer
|
|
9665
|
+
] });
|
|
9666
|
+
}
|
|
9642
9667
|
if (viewer && kind === "knowledge" && !onSelect) {
|
|
9643
9668
|
return /* @__PURE__ */ jsx(
|
|
9644
9669
|
"button",
|
package/dist/header.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { ChatHeader, ChatHeaderActions } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { ChatHeader, ChatHeaderActions } from './chunk-VB2YKQGZ.js';
|
|
3
|
+
import './chunk-KKOK22CN.js';
|
|
4
4
|
import './chunk-CWAOLMFS.js';
|
|
5
5
|
import './chunk-FZ3VSITY.js';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
6
|
+
import './chunk-G6A5DWFP.js';
|
|
7
|
+
import './chunk-DJ2Q5U3E.js';
|
|
8
|
+
import './chunk-RQPL7ZTX.js';
|
|
9
9
|
import './chunk-UWKO24VT.js';
|
|
10
10
|
import './chunk-2P4IEVOQ.js';
|
|
11
11
|
import './chunk-CDTES65T.js';
|
|
12
12
|
import './chunk-C3HW5S2Z.js';
|
|
13
|
-
import './chunk-
|
|
13
|
+
import './chunk-RCWVJD7G.js';
|
|
14
14
|
import './chunk-EZX3E3BB.js';
|
|
15
15
|
import './chunk-LGVMMBL3.js';
|
|
16
16
|
import './chunk-6JLWE7M3.js';
|
package/dist/message.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { Message, Thinking } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { Message, Thinking } from './chunk-G4V3YKMK.js';
|
|
3
|
+
import './chunk-KKOK22CN.js';
|
|
4
4
|
import './chunk-CWAOLMFS.js';
|
|
5
5
|
import './chunk-FZ3VSITY.js';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
6
|
+
import './chunk-G6A5DWFP.js';
|
|
7
|
+
import './chunk-DJ2Q5U3E.js';
|
|
8
|
+
import './chunk-RQPL7ZTX.js';
|
|
9
9
|
import './chunk-UWKO24VT.js';
|
|
10
10
|
import './chunk-2P4IEVOQ.js';
|
|
11
11
|
import './chunk-CDTES65T.js';
|
|
12
12
|
import './chunk-C3HW5S2Z.js';
|
|
13
|
-
import './chunk-
|
|
13
|
+
import './chunk-RCWVJD7G.js';
|
|
14
14
|
import './chunk-EZX3E3BB.js';
|
|
15
15
|
import './chunk-LGVMMBL3.js';
|
|
16
16
|
import './chunk-6JLWE7M3.js';
|
package/dist/new-session.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { DEFAULT_SHORTCUTS, NewSessionPrompt, buildDefaultShortcuts } from './chunk-
|
|
2
|
+
export { DEFAULT_SHORTCUTS, NewSessionPrompt, buildDefaultShortcuts } from './chunk-NOJWGKB4.js';
|
|
3
3
|
import './chunk-FZ3VSITY.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-G6A5DWFP.js';
|
|
5
5
|
import './chunk-2P4IEVOQ.js';
|
|
6
|
-
import './chunk-
|
|
6
|
+
import './chunk-RCWVJD7G.js';
|
|
7
7
|
import './chunk-LGVMMBL3.js';
|
|
8
8
|
import './chunk-PR4QN5HX.js';
|
package/dist/parts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { ToolCallItem } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
import { ToolCallItem } from './chunk-DJ2Q5U3E.js';
|
|
3
|
+
import './chunk-RQPL7ZTX.js';
|
|
4
4
|
import './chunk-UWKO24VT.js';
|
|
5
5
|
import './chunk-2P4IEVOQ.js';
|
|
6
6
|
import './chunk-EZX3E3BB.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { DeckNotesCard, deckOwnsArrowKeys } from './chunk-4FRTPVJT.js';
|
|
3
|
-
import { resolveStageWidth, zoomPercent, DECK_ZOOM_LEVELS, LazyThumb, ArtifactSkeleton } from './chunk-
|
|
3
|
+
import { resolveStageWidth, zoomPercent, DECK_ZOOM_LEVELS, LazyThumb, ArtifactSkeleton } from './chunk-DPCAFZ2S.js';
|
|
4
4
|
import { ChevronLeftIcon } from './chunk-CWAOLMFS.js';
|
|
5
|
-
import { useTranslation, useIsMobile } from './chunk-
|
|
5
|
+
import { useTranslation, useIsMobile } from './chunk-G6A5DWFP.js';
|
|
6
6
|
import { Button, ChevronDownMediumIcon, ScrollArea } from './chunk-UWKO24VT.js';
|
|
7
7
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, ChevronRightIcon } from './chunk-C3HW5S2Z.js';
|
|
8
8
|
import { cn } from './chunk-LGVMMBL3.js';
|
|
@@ -25,6 +25,7 @@ function PdfDeckViewInner({
|
|
|
25
25
|
fileUrl,
|
|
26
26
|
label,
|
|
27
27
|
notes,
|
|
28
|
+
page,
|
|
28
29
|
onError
|
|
29
30
|
}) {
|
|
30
31
|
const { t } = useTranslation();
|
|
@@ -59,6 +60,9 @@ function PdfDeckViewInner({
|
|
|
59
60
|
const visiblePages = loadedFileUrl === fileUrl ? pages : 0;
|
|
60
61
|
const last = visiblePages - 1;
|
|
61
62
|
useEffect(() => () => setLoadedFileUrl(null), []);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (page && visiblePages > 0) setSel(Math.min(page, visiblePages) - 1);
|
|
65
|
+
}, [page, visiblePages]);
|
|
62
66
|
const next = useCallback(
|
|
63
67
|
() => setSel(
|
|
64
68
|
(value) => Math.min(Math.max(0, visiblePages - 1), value + 1)
|
|
@@ -215,9 +219,9 @@ function PdfDeckViewInner({
|
|
|
215
219
|
setPages(doc.numPages);
|
|
216
220
|
setSel(0);
|
|
217
221
|
setPageDims(null);
|
|
218
|
-
void doc.getPage(1).then((
|
|
222
|
+
void doc.getPage(1).then((page2) => {
|
|
219
223
|
if (currentFileUrlRef.current !== loadedUrl) return;
|
|
220
|
-
const viewport =
|
|
224
|
+
const viewport = page2.getViewport({ scale: 1 });
|
|
221
225
|
setPageDims({ w: viewport.width, h: viewport.height });
|
|
222
226
|
}).catch(() => {
|
|
223
227
|
if (currentFileUrlRef.current === loadedUrl) onError();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { zoomPercent, DECK_ZOOM_LEVELS, ArtifactSkeleton, LazyThumb } from './chunk-
|
|
2
|
+
import { zoomPercent, DECK_ZOOM_LEVELS, ArtifactSkeleton, LazyThumb } from './chunk-DPCAFZ2S.js';
|
|
3
3
|
import { ChevronLeftIcon } from './chunk-CWAOLMFS.js';
|
|
4
|
-
import { useTranslation, useIsMobile } from './chunk-
|
|
4
|
+
import { useTranslation, useIsMobile } from './chunk-G6A5DWFP.js';
|
|
5
5
|
import { Button, ChevronDownMediumIcon, ScrollArea } from './chunk-UWKO24VT.js';
|
|
6
6
|
import { ChevronRightIcon, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem } from './chunk-C3HW5S2Z.js';
|
|
7
7
|
import { cn } from './chunk-LGVMMBL3.js';
|
|
@@ -93,7 +93,8 @@ function PdfDocumentViewInner({
|
|
|
93
93
|
title,
|
|
94
94
|
label,
|
|
95
95
|
onError,
|
|
96
|
-
versionSlot
|
|
96
|
+
versionSlot,
|
|
97
|
+
page
|
|
97
98
|
}) {
|
|
98
99
|
const { t } = useTranslation();
|
|
99
100
|
const isMobile = useIsMobile();
|
|
@@ -173,10 +174,16 @@ function PdfDocumentViewInner({
|
|
|
173
174
|
return () => observer.disconnect();
|
|
174
175
|
}, [hostElement]);
|
|
175
176
|
const goToPage = useCallback(
|
|
176
|
-
(pageIndex) => {
|
|
177
|
+
(pageIndex, behavior = "smooth") => {
|
|
177
178
|
const nextPage = Math.min(Math.max(0, pageIndex), Math.max(0, pages - 1));
|
|
178
179
|
setSelectedPage(nextPage);
|
|
179
|
-
hostElement?.querySelector(`[data-pdf-page-index="${nextPage}"]`)
|
|
180
|
+
const target = hostElement?.querySelector(`[data-pdf-page-index="${nextPage}"]`);
|
|
181
|
+
if (!hostElement || !target) return;
|
|
182
|
+
const margin = parseFloat(getComputedStyle(target).scrollMarginTop) || 0;
|
|
183
|
+
hostElement.scrollTo({
|
|
184
|
+
top: hostElement.scrollTop + target.getBoundingClientRect().top - hostElement.getBoundingClientRect().top - margin,
|
|
185
|
+
behavior
|
|
186
|
+
});
|
|
180
187
|
},
|
|
181
188
|
[hostElement, pages]
|
|
182
189
|
);
|
|
@@ -244,6 +251,32 @@ function PdfDocumentViewInner({
|
|
|
244
251
|
const activeTick = pages > 0 ? Math.min(tickCount - 1, Math.floor(selectedPage * tickCount / pages)) : 0;
|
|
245
252
|
const pageWidth = pageDimensions ? zoom === "fit" ? Math.max(1, Math.floor(hostWidth)) : Math.max(1, Math.round(pageDimensions.width * zoom)) : 0;
|
|
246
253
|
const pageRenderWidth = pageDimensions ? zoom === "fit" ? Math.max(1, Math.round(pageDimensions.width)) : pageWidth : 0;
|
|
254
|
+
const laidOut = !!activeDocument && !!pageDimensions && hostWidth > 0;
|
|
255
|
+
const shownPageRef = useRef(null);
|
|
256
|
+
const heldPageRef = useRef(null);
|
|
257
|
+
useEffect(() => {
|
|
258
|
+
if (!page || !laidOut) return;
|
|
259
|
+
const shown = shownPageRef.current;
|
|
260
|
+
if (shown?.fileUrl === fileUrl && shown.page === page) return;
|
|
261
|
+
shownPageRef.current = { fileUrl, page };
|
|
262
|
+
heldPageRef.current = page - 1;
|
|
263
|
+
goToPage(page - 1, shown?.fileUrl === fileUrl ? "smooth" : "auto");
|
|
264
|
+
}, [fileUrl, goToPage, laidOut, page]);
|
|
265
|
+
useLayoutEffect(() => {
|
|
266
|
+
if (heldPageRef.current !== null && laidOut) goToPage(heldPageRef.current, "auto");
|
|
267
|
+
}, [pageWidth]);
|
|
268
|
+
useEffect(() => {
|
|
269
|
+
const viewer = viewerRef.current;
|
|
270
|
+
if (!viewer) return;
|
|
271
|
+
const release = () => {
|
|
272
|
+
heldPageRef.current = null;
|
|
273
|
+
};
|
|
274
|
+
const events = ["wheel", "touchstart", "pointerdown", "keydown"];
|
|
275
|
+
for (const name of events) viewer.addEventListener(name, release, { passive: true });
|
|
276
|
+
return () => {
|
|
277
|
+
for (const name of events) viewer.removeEventListener(name, release);
|
|
278
|
+
};
|
|
279
|
+
}, []);
|
|
247
280
|
const thumbWidth = isMobile ? STRIP_THUMB_W : compact ? COMPACT_THUMB_W : THUMB_W;
|
|
248
281
|
const thumbHeight = pageDimensions ? Math.round(thumbWidth * pageDimensions.height / pageDimensions.width) : Math.round(thumbWidth * 1.4);
|
|
249
282
|
const zoomLabel = zoom === "fit" ? pageDimensions ? `${zoomPercent(pageWidth, pageDimensions.width) ?? 100}%` : t("deck.zoomFit") : `${Math.round(zoom * 100)}%`;
|
|
@@ -251,9 +284,9 @@ function PdfDocumentViewInner({
|
|
|
251
284
|
(document) => {
|
|
252
285
|
const source = fileUrl;
|
|
253
286
|
if (document.loadingTask.destroyed) return;
|
|
254
|
-
void document.getPage(1).then((
|
|
287
|
+
void document.getPage(1).then((page2) => {
|
|
255
288
|
if (!mountedRef.current || activeSourceRef.current !== source) return;
|
|
256
|
-
const viewport =
|
|
289
|
+
const viewport = page2.getViewport({ scale: 1 });
|
|
257
290
|
setLoadedDocument({
|
|
258
291
|
source,
|
|
259
292
|
proxy: document,
|
package/dist/pending-cards.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { PendingCards } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { PendingCards } from './chunk-GRRSYZQZ.js';
|
|
3
|
+
import './chunk-RQPL7ZTX.js';
|
|
4
4
|
import './chunk-UWKO24VT.js';
|
|
5
5
|
import './chunk-2P4IEVOQ.js';
|
|
6
6
|
import './chunk-EZX3E3BB.js';
|