@epam/ai-dial-chat-hooks 1.1.0-dev.433 → 1.1.0-dev.438
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/catalog/map-entity-details-to-catalog.js +1 -1
- package/conversation/conversation-transfer/import-conversation.js +27 -26
- package/conversation/create-chat-stream-api.js +45 -37
- package/conversation/useConversationHandlers/message-utils.js +6 -2
- package/conversation/useConversationHandlers/useConversationHandlers.js +3 -3
- package/conversation/useConversationImport/useConversationImport.js +1 -1
- package/conversation/useConversationStream/useConversationStream.js +108 -104
- package/conversation.d.ts +39 -1
- package/conversation.js +30 -30
- package/file-manager.d.ts +90 -0
- package/file-manager.js +16 -16
- package/files/attachment-canvas.js +111 -61
- package/files/dial-file-manager.model.js +4 -1
- package/index.d.ts +129 -1
- package/index.js +89 -89
- package/package.json +15 -15
package/conversation.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { buildAnnouncementSignature as e, hasAnnouncementContent as t, hasStructuredAnnouncement as n, sanitizeAnnouncementHtml as r, sanitizeAnnouncementMessageHtml as i } from "./conversation/announcement-message.js";
|
|
2
|
-
import {
|
|
3
|
-
import { shouldWatchForDisplayNameUpdate as
|
|
4
|
-
import { formatAppVersion as
|
|
5
|
-
import { getModelIdFromConversationId as
|
|
6
|
-
import { getTimeOfDayGreeting as
|
|
7
|
-
import { createDeploymentChangedMessage as
|
|
8
|
-
import { getLastDeploymentId as
|
|
9
|
-
import { toOverlayMessages as
|
|
10
|
-
import { getQuickAppConversationStarters as
|
|
11
|
-
import { getStarterPopulateText as
|
|
12
|
-
import { deriveConversationRowActionState as
|
|
13
|
-
import { useActiveConversationSync as
|
|
14
|
-
import { useAsyncConfirmDialog as
|
|
15
|
-
import { useConversationLookupMaps as
|
|
16
|
-
import { getConversationSource as
|
|
17
|
-
import { useImportFilePicker as
|
|
18
|
-
import { useAttachmentUpload as
|
|
19
|
-
import { AudioTranscriptionError as
|
|
20
|
-
import { useTranscribeAudio as
|
|
21
|
-
import { attachmentToDto as
|
|
22
|
-
import { createMessagePair as
|
|
23
|
-
import { hasActiveToolConfig as
|
|
24
|
-
import { getStarterConversationText as
|
|
25
|
-
import { getConversationPath as
|
|
26
|
-
import { useConversationHandlers as
|
|
27
|
-
import { isAwaitingGenerationResume as
|
|
28
|
-
import { useConversationStream as
|
|
29
|
-
import { useChatSettingsFormConfig as
|
|
30
|
-
import { useToolsMenu as
|
|
31
|
-
export {
|
|
2
|
+
import { DEFAULT_GENERATION_CONFLICT_MESSAGE as a, GenerationConflictError as o, createChatStreamApi as s } from "./conversation/create-chat-stream-api.js";
|
|
3
|
+
import { shouldWatchForDisplayNameUpdate as c } from "./conversation/display-name-watch.js";
|
|
4
|
+
import { formatAppVersion as l, sanitizeFooterHtml as u } from "./conversation/footer-message.js";
|
|
5
|
+
import { getModelIdFromConversationId as d } from "./conversation/get-model-id-from-conversation-id.js";
|
|
6
|
+
import { getTimeOfDayGreeting as f } from "./conversation/greeting.js";
|
|
7
|
+
import { createDeploymentChangedMessage as p } from "./conversation/message-factory.js";
|
|
8
|
+
import { getLastDeploymentId as m, getLastUserMessageToolConfiguration as h, isMessageStreaming as g, messageHasStages as _, normalizeResponseFormat as v } from "./conversation/message-utils.js";
|
|
9
|
+
import { toOverlayMessages as y } from "./conversation/overlay-messages.js";
|
|
10
|
+
import { getQuickAppConversationStarters as b } from "./conversation/quick-app-conversation-starters.js";
|
|
11
|
+
import { getStarterPopulateText as x, getStartersFromSchema as S } from "./conversation/starter-option.js";
|
|
12
|
+
import { deriveConversationRowActionState as C } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
|
|
13
|
+
import { useActiveConversationSync as w } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
|
|
14
|
+
import { useAsyncConfirmDialog as T } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
|
|
15
|
+
import { useConversationLookupMaps as E } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
|
|
16
|
+
import { getConversationSource as D, useConversationPanelItems as O } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
|
|
17
|
+
import { useImportFilePicker as k } from "./conversation/useImportFilePicker/useImportFilePicker.js";
|
|
18
|
+
import { useAttachmentUpload as A } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
|
|
19
|
+
import { AudioTranscriptionError as j, AudioTranscriptionErrorReason as M } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
|
|
20
|
+
import { useTranscribeAudio as N } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
|
|
21
|
+
import { attachmentToDto as P, attachmentsToDtos as F } from "./conversation/useConversationHandlers/attachment-to-dto.js";
|
|
22
|
+
import { createMessagePair as I } from "./conversation/useConversationHandlers/message-factory.js";
|
|
23
|
+
import { hasActiveToolConfig as L, isAnswerIncomplete as R, isMessageChanged as z, shouldRerunGenerationOnEdit as B } from "./conversation/useConversationHandlers/message-utils.js";
|
|
24
|
+
import { getStarterConversationText as V, getStarterSubmitText as H } from "./conversation/useConversationHandlers/starter-option.js";
|
|
25
|
+
import { getConversationPath as U } from "./conversation/useConversationStream/conversation-path.js";
|
|
26
|
+
import { useConversationHandlers as W } from "./conversation/useConversationHandlers/useConversationHandlers.js";
|
|
27
|
+
import { isAwaitingGenerationResume as G } from "./conversation/useConversationStream/generation-resume.js";
|
|
28
|
+
import { useConversationStream as K } from "./conversation/useConversationStream/useConversationStream.js";
|
|
29
|
+
import { useChatSettingsFormConfig as q } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
|
|
30
|
+
import { useToolsMenu as J } from "./useToolsMenu/useToolsMenu.js";
|
|
31
|
+
export { j as AudioTranscriptionError, M as AudioTranscriptionErrorReason, a as DEFAULT_GENERATION_CONFLICT_MESSAGE, o as GenerationConflictError, P as attachmentToDto, F as attachmentsToDtos, e as buildAnnouncementSignature, s as createChatStreamApi, p as createDeploymentChangedMessage, I as createMessagePair, C as deriveConversationRowActionState, l as formatAppVersion, U as getConversationPath, D as getConversationSource, m as getLastDeploymentId, h as getLastUserMessageToolConfiguration, d as getModelIdFromConversationId, b as getQuickAppConversationStarters, V as getStarterConversationText, x as getStarterPopulateText, H as getStarterSubmitText, S as getStartersFromSchema, f as getTimeOfDayGreeting, L as hasActiveToolConfig, t as hasAnnouncementContent, n as hasStructuredAnnouncement, R as isAnswerIncomplete, G as isAwaitingGenerationResume, z as isMessageChanged, g as isMessageStreaming, _ as messageHasStages, v as normalizeResponseFormat, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml, u as sanitizeFooterHtml, B as shouldRerunGenerationOnEdit, c as shouldWatchForDisplayNameUpdate, y as toOverlayMessages, w as useActiveConversationSync, T as useAsyncConfirmDialog, A as useAttachmentUpload, q as useChatSettingsFormConfig, W as useConversationHandlers, E as useConversationLookupMaps, O as useConversationPanelItems, K as useConversationStream, k as useImportFilePicker, J as useToolsMenu, N as useTranscribeAudio };
|
package/file-manager.d.ts
CHANGED
|
@@ -58,6 +58,16 @@ import { UseGridEditingScrollResult } from '@epam/ai-dial-chat-shared';
|
|
|
58
58
|
/** Maps an annotation's source attachment to the display-only attachment model. */
|
|
59
59
|
export declare const annotationToDisplayAttachment: (annotation: Annotation) => DisplayAttachment | null;
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Builds an `OoxmlCanvasContent` for a DOCX/PPTX/XLSX citation annotation,
|
|
63
|
+
* including highlights for every annotation sharing the clicked one's source
|
|
64
|
+
* document. Returns `null` when the annotation has no source attachment,
|
|
65
|
+
* the source is not a format `@silurus/ooxml` renders as DOCX/XLSX/PPTX (a
|
|
66
|
+
* CSV source returns `null` — citation highlighting targets Office documents
|
|
67
|
+
* only), or no URL resolves.
|
|
68
|
+
*/
|
|
69
|
+
export declare const annotationToOoxmlCanvasContent: (annotation: Annotation, annotations: Annotation[], resolvers: AttachmentCanvasUrlResolvers) => OoxmlCanvasContent | null;
|
|
70
|
+
|
|
61
71
|
/**
|
|
62
72
|
* Builds a `PdfCanvasContent` for a PDF citation annotation, including highlights
|
|
63
73
|
* for the clicked annotation's document within its citation group.
|
|
@@ -657,6 +667,34 @@ declare interface OoxmlCanvasContent {
|
|
|
657
667
|
url: string;
|
|
658
668
|
/** The document format used to select and configure the format-specific renderer. */
|
|
659
669
|
format: OoxmlFileType;
|
|
670
|
+
/** Cited locations to draw over the document. Omitted, never `[]`, when there is nothing to highlight. */
|
|
671
|
+
highlights?: OoxmlHighlight[];
|
|
672
|
+
/** Id of the highlight to navigate to and emphasise. Omitted when the clicked citation resolved to no location. */
|
|
673
|
+
selectedHighlightId?: string;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/** A 1-based cell address, matching `@silurus/ooxml`'s own `CellAddress`. */
|
|
677
|
+
declare interface OoxmlCellAddress {
|
|
678
|
+
/** 1-based row number. */
|
|
679
|
+
row: number;
|
|
680
|
+
/** 1-based column number. */
|
|
681
|
+
col: number;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/** A cited character range inside a DOCX story, addressed by story name and source-tree path. */
|
|
685
|
+
declare interface OoxmlDocxHighlightLocation {
|
|
686
|
+
/** Discriminates this location within `OoxmlHighlightLocation`. */
|
|
687
|
+
kind: OoxmlHighlightKind.DocxTextRange;
|
|
688
|
+
/** Name of the DOCX story the range lives in, as an opaque string (only `'body'` is confirmed upstream). */
|
|
689
|
+
story: string;
|
|
690
|
+
/** Source-tree element indices identifying the paragraph, matched element-wise. */
|
|
691
|
+
path: number[];
|
|
692
|
+
/** Inclusive start character offset within the story's matched text. */
|
|
693
|
+
start: number;
|
|
694
|
+
/** Exclusive end character offset, already converted from the wire's inclusive `end`. */
|
|
695
|
+
endExclusive: number;
|
|
696
|
+
/** The cited text, compared against the text resolved over `[start, endExclusive)`. */
|
|
697
|
+
text: string;
|
|
660
698
|
}
|
|
661
699
|
|
|
662
700
|
/** Supported document formats rendered by the bundled `@silurus/ooxml` runtime. */
|
|
@@ -667,6 +705,58 @@ declare enum OoxmlFileType {
|
|
|
667
705
|
Csv = 'csv',
|
|
668
706
|
}
|
|
669
707
|
|
|
708
|
+
/** One citation's highlight: the locations it resolved to, under a stable id. */
|
|
709
|
+
declare interface OoxmlHighlight {
|
|
710
|
+
/** Stable id, used to mark exactly one highlight selected. */
|
|
711
|
+
id: string;
|
|
712
|
+
/** One or more locations — a single citation may carry several selectors. */
|
|
713
|
+
locations: OoxmlHighlightLocation[];
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/** Discriminates the Office highlight location descriptors an `OoxmlCanvasContent` can carry. */
|
|
717
|
+
declare enum OoxmlHighlightKind {
|
|
718
|
+
/** A character range inside a DOCX story, addressed by story name and source-tree path. */
|
|
719
|
+
DocxTextRange = 'docxTextRange',
|
|
720
|
+
/** A character range inside a single PPTX shape on one slide. */
|
|
721
|
+
PptxTextRange = 'pptxTextRange',
|
|
722
|
+
/** One cell, or a contiguous same-row cell range, on a named XLSX sheet. */
|
|
723
|
+
XlsxCellRange = 'xlsxCellRange',
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/** A cited location inside an Office document, in document coordinates. */
|
|
727
|
+
declare type OoxmlHighlightLocation =
|
|
728
|
+
| OoxmlDocxHighlightLocation
|
|
729
|
+
| OoxmlPptxHighlightLocation
|
|
730
|
+
| OoxmlXlsxHighlightLocation;
|
|
731
|
+
|
|
732
|
+
/** A cited character range inside a single shape on one PPTX slide. */
|
|
733
|
+
declare interface OoxmlPptxHighlightLocation {
|
|
734
|
+
/** Discriminates this location within `OoxmlHighlightLocation`. */
|
|
735
|
+
kind: OoxmlHighlightKind.PptxTextRange;
|
|
736
|
+
/** 1-based slide number. */
|
|
737
|
+
slide: number;
|
|
738
|
+
/** Shape identifier, compared as a string against the run's own `shapeId`. */
|
|
739
|
+
shapeId: string;
|
|
740
|
+
/** Inclusive start character offset within the shape's matched text. */
|
|
741
|
+
start: number;
|
|
742
|
+
/** Exclusive end character offset, already converted from the wire's inclusive `end`. */
|
|
743
|
+
endExclusive: number;
|
|
744
|
+
/** The cited text, compared against the text resolved over `[start, endExclusive)`. */
|
|
745
|
+
text: string;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** A cited cell, or contiguous same-row cell range, on a named XLSX sheet. */
|
|
749
|
+
declare interface OoxmlXlsxHighlightLocation {
|
|
750
|
+
/** Discriminates this location within `OoxmlHighlightLocation`. */
|
|
751
|
+
kind: OoxmlHighlightKind.XlsxCellRange;
|
|
752
|
+
/** Sheet name, matched exactly against the workbook's own sheet names. */
|
|
753
|
+
sheet: string;
|
|
754
|
+
/** First cell of the range. 1-based, passed to the viewer unconverted. */
|
|
755
|
+
start: OoxmlCellAddress;
|
|
756
|
+
/** Last cell of the range, on the same row as `start`. Omitted for a single cell. */
|
|
757
|
+
end?: OoxmlCellAddress;
|
|
758
|
+
}
|
|
759
|
+
|
|
670
760
|
/**
|
|
671
761
|
* Opens a cited/referenced attachment: triggers a browser download for
|
|
672
762
|
* DIAL-hosted files (`files/...` ids) via the injected `resolveDownloadUrl`,
|
package/file-manager.js
CHANGED
|
@@ -11,19 +11,19 @@ import { buildFromCache as z, fetchByTab as B, fetchForSearch as V, findFirstSuc
|
|
|
11
11
|
import { createFilesApiClient as J } from "./files/create-files-api.js";
|
|
12
12
|
import { createUploadFileWithProgress as Y } from "./files/create-upload-file-with-progress.js";
|
|
13
13
|
import { openAnnotationAttachment as X } from "./files/annotation.js";
|
|
14
|
-
import {
|
|
15
|
-
import { getUrlFileName as
|
|
16
|
-
import { annotationToDisplayAttachment as
|
|
17
|
-
import { dialFileToAttachment as
|
|
18
|
-
import { DownloadDestinationType as
|
|
19
|
-
import { prepareDownloadDestination as
|
|
20
|
-
import { sanitizeFileName as
|
|
21
|
-
import { useDialFileListing as
|
|
22
|
-
import { useDialFileMetadata as
|
|
23
|
-
import { useDialFileMutations as
|
|
24
|
-
import { useDialFileSharing as
|
|
25
|
-
import { useDialFileUploadBatch as
|
|
26
|
-
import { useDialFileManager as
|
|
27
|
-
import { useDialFileManagerTabConfig as
|
|
28
|
-
import { useGridEditingScroll as
|
|
29
|
-
export { d as COLUMNS_WITHOUT_AUTHOR, f as COLUMNS_WITH_AUTHOR, p as CORE_PERMISSION_MAP, m as DATE_OPTIONS, v as DialFileManagerActionProfile, y as DialFileManagerVariant, s as DialFilesApiUploadMode,
|
|
14
|
+
import { annotationToOoxmlCanvasContent as Z, annotationToPdfCanvasContent as Q, clearAttachmentCache as $, hasAttachmentTextSource as ee, referenceAttachmentToPdfCanvasContent as te, resolveCodeCanvasContent as ne, resolveHtmlCanvasContent as re, resolveImageCanvasContent as ie, resolveJsonCanvasContent as ae, resolveMarkdownCanvasContent as oe, resolveOoxmlCanvasContent as se, resolvePdfCanvasContent as ce, resolveTextCanvasContent as le, resolveVisualizerCanvasContent as ue } from "./files/attachment-canvas.js";
|
|
15
|
+
import { getUrlFileName as de, isExternalSourcePreviewable as fe, resolveExternalSourceContentType as pe } from "./files/source-content.js";
|
|
16
|
+
import { annotationToDisplayAttachment as me, attachmentDtoToDisplayAttachment as he, attachmentDtosToDisplayAttachments as ge } from "./files/attachment-dto-to-display.js";
|
|
17
|
+
import { dialFileToAttachment as _e, dialFilesToAttachments as ve, dialFolderPathToAttachment as ye } from "./files/dial-file-to-attachment.js";
|
|
18
|
+
import { DownloadDestinationType as be } from "./files/download-destination.js";
|
|
19
|
+
import { prepareDownloadDestination as xe } from "./files/prepare-download-destination.js";
|
|
20
|
+
import { sanitizeFileName as Se, splitFileNameExtension as Ce, trimFileNameToByteLimit as we } from "./files/file-name.js";
|
|
21
|
+
import { useDialFileListing as Te } from "./files/useDialFileListing/useDialFileListing.js";
|
|
22
|
+
import { useDialFileMetadata as Ee } from "./files/useDialFileMetadata/useDialFileMetadata.js";
|
|
23
|
+
import { useDialFileMutations as De } from "./files/useDialFileMutations/useDialFileMutations.js";
|
|
24
|
+
import { useDialFileSharing as Oe } from "./files/useDialFileSharing/useDialFileSharing.js";
|
|
25
|
+
import { useDialFileUploadBatch as ke } from "./files/useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
26
|
+
import { useDialFileManager as Ae } from "./files/useDialFileManager/useDialFileManager.js";
|
|
27
|
+
import { useDialFileManagerTabConfig as je } from "./files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js";
|
|
28
|
+
import { useGridEditingScroll as Me } from "@epam/ai-dial-chat-shared";
|
|
29
|
+
export { d as COLUMNS_WITHOUT_AUTHOR, f as COLUMNS_WITH_AUTHOR, p as CORE_PERMISSION_MAP, m as DATE_OPTIONS, v as DialFileManagerActionProfile, y as DialFileManagerVariant, s as DialFilesApiUploadMode, be as DownloadDestinationType, c as FileManagerNotificationReason, l as FileNameValidationErrorReason, u as FileOperationKind, h as PATH_SEPARATOR_REGEXP, g as RESERVED_MARKER_NAME, _ as UPLOAD_CONCURRENCY, me as annotationToDisplayAttachment, Z as annotationToOoxmlCanvasContent, Q as annotationToPdfCanvasContent, he as attachmentDtoToDisplayAttachment, ge as attachmentDtosToDisplayAttachments, z as buildFromCache, x as buildSharedItemVirtualPath, $ as clearAttachmentCache, J as createFilesApiClient, Y as createUploadFileWithProgress, b as deriveActionProfile, S as dialCorePathToRelative, _e as dialFileToAttachment, ve as dialFilesToAttachments, ye as dialFolderPathToAttachment, B as fetchByTab, V as fetchForSearch, C as findDialFileByPath, H as findFirstSuccessfulCopyMoveItem, w as findFolderByVirtualPath, T as formatOperationFolderName, P as getParentFolderPath, de as getUrlFileName, E as getVirtualPathName, ee as hasAttachmentTextSource, D as hasDialFileWritePermission, O as hasForbiddenNameSymbols, k as isCopyMoveDuplicateAllowed, r as isDialFileAcceptType, e as isDialFileId, fe as isExternalSourcePreviewable, A as isShareActionsAllowed, U as mapCorePermissions, W as mapFileMetadataToDialFile, G as mapSearchItem, K as mergeCreatedFolderIntoCache, i as mimeTypesToAttachmentExtensionLabels, a as mimeTypesToDialFileAcceptTypes, o as mimeTypesToFileAccept, j as normalizeVirtualPath, X as openAnnotationAttachment, M as parseNewFolderVirtualPath, L as prepareCopyItems, xe as prepareDownloadDestination, R as prepareMoveRenameItems, te as referenceAttachmentToPdfCanvasContent, ne as resolveCodeCanvasContent, F as resolveDialFileApiPath, t as resolveDialFileBucketAndPath, pe as resolveExternalSourceContentType, re as resolveHtmlCanvasContent, ie as resolveImageCanvasContent, ae as resolveJsonCanvasContent, oe as resolveMarkdownCanvasContent, se as resolveOoxmlCanvasContent, N as resolveOwnerCoords, ce as resolvePdfCanvasContent, n as resolveRelativeDialFilePath, le as resolveTextCanvasContent, ue as resolveVisualizerCanvasContent, Se as sanitizeFileName, Ce as splitFileNameExtension, we as trimFileNameToByteLimit, q as updateEntry, Te as useDialFileListing, Ae as useDialFileManager, je as useDialFileManagerTabConfig, Ee as useDialFileMetadata, De as useDialFileMutations, Oe as useDialFileSharing, ke as useDialFileUploadBatch, Me as useGridEditingScroll, I as virtualPathToApiPath };
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
import { isDialFileId as e } from "./dial-file.js";
|
|
2
|
-
import { AttachmentContentType as t, AttachmentErrorType as n } from "@epam/ai-dial-attachment-canvas";
|
|
3
|
-
import { MIMEType as
|
|
4
|
-
import { annotationHighlightId as
|
|
5
|
-
import { LRUCache as
|
|
2
|
+
import { AttachmentContentType as t, AttachmentErrorType as n, OoxmlFileType as r, OoxmlHighlightKind as i, getOoxmlFileType as a } from "@epam/ai-dial-attachment-canvas";
|
|
3
|
+
import { MIMEType as o, base64ToBlob as s, tryBase64ToBytes as c } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { annotationHighlightId as l, annotationToOfficeHighlightLocations as u, annotationsToPdfHighlights as d, gatherSameSourceAnnotations as f, getAnnotationPdfPage as p, parsePdfPageReference as m } from "@epam/ai-dial-quotations";
|
|
5
|
+
import { LRUCache as h } from "lru-cache";
|
|
6
6
|
//#region src/files/attachment-canvas.ts
|
|
7
|
-
var
|
|
8
|
-
let t =
|
|
7
|
+
var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
8
|
+
let t = c(e);
|
|
9
9
|
return t == null ? e : new TextDecoder().decode(t);
|
|
10
|
-
},
|
|
10
|
+
}, v = (e, r) => ({
|
|
11
11
|
type: t.Error,
|
|
12
12
|
errorType: e === 403 ? n.Forbidden : n.LoadFailed,
|
|
13
13
|
url: r
|
|
14
|
-
}),
|
|
14
|
+
}), y = (e) => ({
|
|
15
15
|
type: t.Error,
|
|
16
16
|
errorType: n.LoadFailed,
|
|
17
17
|
url: e
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
let t =
|
|
18
|
+
}), b = new h({ max: 10 }), x = new h({ max: 50 }), S = () => {
|
|
19
|
+
b.clear(), x.clear();
|
|
20
|
+
}, C = (e) => {
|
|
21
|
+
let t = b.get(e);
|
|
22
22
|
return t ?? (t = fetch(e).then((e) => {
|
|
23
23
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
24
24
|
return e.blob();
|
|
25
25
|
}).catch((t) => {
|
|
26
|
-
throw
|
|
27
|
-
}),
|
|
28
|
-
},
|
|
29
|
-
let t =
|
|
26
|
+
throw b.delete(e), t;
|
|
27
|
+
}), b.set(e, t)), t;
|
|
28
|
+
}, w = (e) => {
|
|
29
|
+
let t = x.get(e);
|
|
30
30
|
return t ?? (t = fetch(e).then((e) => {
|
|
31
31
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
32
32
|
return e.text();
|
|
33
33
|
}).catch((t) => {
|
|
34
|
-
throw
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
34
|
+
throw x.delete(e), t;
|
|
35
|
+
}), x.set(e, t)), t;
|
|
36
|
+
}, T = async (e, t) => {
|
|
37
37
|
if ("file" in e) return URL.createObjectURL(e.file);
|
|
38
38
|
let n = t.resolveDialUrl(e);
|
|
39
39
|
if (n != null) try {
|
|
40
|
-
let e = await
|
|
40
|
+
let e = await C(n);
|
|
41
41
|
return URL.createObjectURL(e);
|
|
42
42
|
} catch (e) {
|
|
43
43
|
let t = e.status;
|
|
44
|
-
return t == null ?
|
|
44
|
+
return t == null ? y(n) : v(t, n);
|
|
45
45
|
}
|
|
46
46
|
if (e.previewUrl != null) return e.previewUrl;
|
|
47
|
-
if (e.data != null) return
|
|
48
|
-
},
|
|
49
|
-
if (e.data != null) return
|
|
47
|
+
if (e.data != null) return g(e.data, e.contentType);
|
|
48
|
+
}, E = async (e, t) => {
|
|
49
|
+
if (e.data != null) return _(e.data);
|
|
50
50
|
let n = t.resolveDialUrl(e);
|
|
51
51
|
if (n != null) try {
|
|
52
|
-
return await
|
|
52
|
+
return await w(n);
|
|
53
53
|
} catch (e) {
|
|
54
54
|
let t = e.status;
|
|
55
|
-
return t == null ?
|
|
55
|
+
return t == null ? y(n) : v(t, n);
|
|
56
56
|
}
|
|
57
57
|
if ("file" in e) return e.file.text();
|
|
58
|
-
},
|
|
58
|
+
}, D = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, O = (e, n) => {
|
|
59
59
|
if ("file" in e) return {
|
|
60
60
|
type: t.Image,
|
|
61
61
|
url: URL.createObjectURL(e.file)
|
|
@@ -63,7 +63,7 @@ var d = (e, t) => URL.createObjectURL(i(e, t)), f = (e) => {
|
|
|
63
63
|
let r = n.resolveDialUrl(e);
|
|
64
64
|
return r == null ? e.previewUrl == null ? e.data == null ? null : {
|
|
65
65
|
type: t.Image,
|
|
66
|
-
url:
|
|
66
|
+
url: g(e.data, e.contentType)
|
|
67
67
|
} : {
|
|
68
68
|
type: t.Image,
|
|
69
69
|
url: e.previewUrl
|
|
@@ -71,51 +71,101 @@ var d = (e, t) => URL.createObjectURL(i(e, t)), f = (e) => {
|
|
|
71
71
|
type: t.Image,
|
|
72
72
|
url: r
|
|
73
73
|
};
|
|
74
|
-
},
|
|
75
|
-
let r = await
|
|
74
|
+
}, k = async (e, n) => {
|
|
75
|
+
let r = await E(e, n);
|
|
76
76
|
return r == null ? null : typeof r == "string" ? {
|
|
77
77
|
type: t.PlainText,
|
|
78
78
|
text: r
|
|
79
79
|
} : r;
|
|
80
|
-
},
|
|
81
|
-
let r = await
|
|
80
|
+
}, A = async (e, n) => {
|
|
81
|
+
let r = await E(e, n);
|
|
82
82
|
return r == null ? null : typeof r == "string" ? {
|
|
83
83
|
type: t.Markdown,
|
|
84
84
|
text: r
|
|
85
85
|
} : r;
|
|
86
|
-
},
|
|
87
|
-
let i = await
|
|
86
|
+
}, j = 1048576, M = async (e, n, r) => {
|
|
87
|
+
let i = await E(e, n);
|
|
88
88
|
return i == null ? null : typeof i == "string" ? {
|
|
89
89
|
type: t.Code,
|
|
90
90
|
text: i,
|
|
91
91
|
language: r
|
|
92
92
|
} : i;
|
|
93
|
-
},
|
|
94
|
-
let r = await
|
|
93
|
+
}, N = async (e, n) => {
|
|
94
|
+
let r = await E(e, n);
|
|
95
95
|
if (r == null) return null;
|
|
96
96
|
if (typeof r != "string") return r;
|
|
97
|
-
if (r.length >
|
|
97
|
+
if (r.length > j) return null;
|
|
98
98
|
let i = n.resolveDialUrl(e) ?? void 0;
|
|
99
99
|
return {
|
|
100
100
|
type: t.Html,
|
|
101
101
|
srcdoc: r,
|
|
102
102
|
url: i
|
|
103
103
|
};
|
|
104
|
-
},
|
|
105
|
-
let
|
|
106
|
-
if (
|
|
107
|
-
let
|
|
108
|
-
if (
|
|
109
|
-
let
|
|
104
|
+
}, P = (n, r, i) => {
|
|
105
|
+
let a = n.body?.source?.attachment;
|
|
106
|
+
if (a?.type !== o.PDF) return null;
|
|
107
|
+
let s = e(a.url) ? i.resolveDialFileDownloadUrl(a.url) : a.url;
|
|
108
|
+
if (s == null) return null;
|
|
109
|
+
let c = (r.find((e) => e.annotations.includes(n))?.annotations ?? [n]).filter((e) => e.body?.source?.attachment?.url === a.url), u = c.indexOf(n), f = d(c), m = l(n, u);
|
|
110
110
|
return {
|
|
111
111
|
type: t.Pdf,
|
|
112
|
-
url:
|
|
113
|
-
highlights:
|
|
114
|
-
selectedHighlightId:
|
|
115
|
-
page:
|
|
112
|
+
url: s,
|
|
113
|
+
highlights: f,
|
|
114
|
+
selectedHighlightId: f.some((e) => e.id === m) ? m : void 0,
|
|
115
|
+
page: p(n)
|
|
116
116
|
};
|
|
117
|
-
},
|
|
118
|
-
|
|
117
|
+
}, F = (e) => {
|
|
118
|
+
switch (e.type) {
|
|
119
|
+
case "docx_text_range": return {
|
|
120
|
+
kind: i.DocxTextRange,
|
|
121
|
+
story: e.story,
|
|
122
|
+
path: e.path,
|
|
123
|
+
start: e.start,
|
|
124
|
+
endExclusive: e.endExclusive,
|
|
125
|
+
text: e.text
|
|
126
|
+
};
|
|
127
|
+
case "pptx_text_range": return {
|
|
128
|
+
kind: i.PptxTextRange,
|
|
129
|
+
slide: e.slide,
|
|
130
|
+
shapeId: e.shapeId,
|
|
131
|
+
start: e.start,
|
|
132
|
+
endExclusive: e.endExclusive,
|
|
133
|
+
text: e.text
|
|
134
|
+
};
|
|
135
|
+
case "excel_rc_range": return {
|
|
136
|
+
kind: i.XlsxCellRange,
|
|
137
|
+
sheet: e.sheet,
|
|
138
|
+
start: e.start,
|
|
139
|
+
end: e.end
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}, I = (n, i, o) => {
|
|
143
|
+
let s = n.body?.source?.attachment;
|
|
144
|
+
if (s?.url == null) return null;
|
|
145
|
+
let c = a(s.title ?? s.url, s.type);
|
|
146
|
+
if (c !== r.Docx && c !== r.Xlsx && c !== r.Pptx) return null;
|
|
147
|
+
let d = e(s.url) ? o.resolveDialFileDownloadUrl(s.url) : s.url;
|
|
148
|
+
if (d == null) return null;
|
|
149
|
+
let p = f(n, i), m = [], h;
|
|
150
|
+
return p.forEach((e, t) => {
|
|
151
|
+
let r = u(e);
|
|
152
|
+
if (r.length === 0) return;
|
|
153
|
+
let i = l(e, t);
|
|
154
|
+
m.push({
|
|
155
|
+
id: i,
|
|
156
|
+
locations: r.map(F)
|
|
157
|
+
}), e === n && (h = i);
|
|
158
|
+
}), {
|
|
159
|
+
type: t.Ooxml,
|
|
160
|
+
url: d,
|
|
161
|
+
format: c,
|
|
162
|
+
...m.length > 0 ? {
|
|
163
|
+
highlights: m,
|
|
164
|
+
selectedHighlightId: h
|
|
165
|
+
} : {}
|
|
166
|
+
};
|
|
167
|
+
}, L = (n, r) => {
|
|
168
|
+
let i = m(n.url);
|
|
119
169
|
if (i == null) return null;
|
|
120
170
|
let a = e(i.baseUrl) ? r.resolveDialFileDownloadUrl(i.baseUrl) : i.baseUrl;
|
|
121
171
|
if (a == null) return null;
|
|
@@ -144,39 +194,39 @@ var d = (e, t) => URL.createObjectURL(i(e, t)), f = (e) => {
|
|
|
144
194
|
selectedHighlightId: o,
|
|
145
195
|
page: i.page
|
|
146
196
|
};
|
|
147
|
-
},
|
|
197
|
+
}, R = (e) => {
|
|
148
198
|
try {
|
|
149
199
|
let t = new URL(e).protocol;
|
|
150
200
|
return t === "http:" || t === "https:" || t === "blob:";
|
|
151
201
|
} catch {
|
|
152
202
|
return !1;
|
|
153
203
|
}
|
|
154
|
-
},
|
|
155
|
-
let r = await
|
|
204
|
+
}, z = (t) => t.url != null && !e(t.url) && R(t.url) ? t.url : void 0, B = async (e, n) => {
|
|
205
|
+
let r = await T(e, n);
|
|
156
206
|
if (r != null) return typeof r == "string" ? {
|
|
157
207
|
type: t.Pdf,
|
|
158
208
|
url: r
|
|
159
209
|
} : r;
|
|
160
|
-
let i =
|
|
210
|
+
let i = z(e);
|
|
161
211
|
return i == null ? null : {
|
|
162
212
|
type: t.Pdf,
|
|
163
213
|
url: i
|
|
164
214
|
};
|
|
165
|
-
},
|
|
166
|
-
let i = await
|
|
215
|
+
}, V = async (e, n, r) => {
|
|
216
|
+
let i = await T(e, n);
|
|
167
217
|
if (i != null) return typeof i == "string" ? {
|
|
168
218
|
type: t.Ooxml,
|
|
169
219
|
url: i,
|
|
170
220
|
format: r
|
|
171
221
|
} : i;
|
|
172
|
-
let a =
|
|
222
|
+
let a = z(e);
|
|
173
223
|
return a == null ? null : {
|
|
174
224
|
type: t.Ooxml,
|
|
175
225
|
url: a,
|
|
176
226
|
format: r
|
|
177
227
|
};
|
|
178
|
-
},
|
|
179
|
-
let r = await
|
|
228
|
+
}, H = async (e, n) => {
|
|
229
|
+
let r = await E(e, n);
|
|
180
230
|
if (r == null) return null;
|
|
181
231
|
if (typeof r != "string") return r;
|
|
182
232
|
try {
|
|
@@ -191,8 +241,8 @@ var d = (e, t) => URL.createObjectURL(i(e, t)), f = (e) => {
|
|
|
191
241
|
text: r
|
|
192
242
|
};
|
|
193
243
|
}
|
|
194
|
-
},
|
|
195
|
-
let a = await
|
|
244
|
+
}, U = async (e, n, r, i) => {
|
|
245
|
+
let a = await E(e, n);
|
|
196
246
|
if (a == null || typeof a != "string") return null;
|
|
197
247
|
let o = {};
|
|
198
248
|
try {
|
|
@@ -215,4 +265,4 @@ var d = (e, t) => URL.createObjectURL(i(e, t)), f = (e) => {
|
|
|
215
265
|
};
|
|
216
266
|
};
|
|
217
267
|
//#endregion
|
|
218
|
-
export {
|
|
268
|
+
export { I as annotationToOoxmlCanvasContent, P as annotationToPdfCanvasContent, S as clearAttachmentCache, D as hasAttachmentTextSource, L as referenceAttachmentToPdfCanvasContent, M as resolveCodeCanvasContent, N as resolveHtmlCanvasContent, O as resolveImageCanvasContent, H as resolveJsonCanvasContent, A as resolveMarkdownCanvasContent, V as resolveOoxmlCanvasContent, B as resolvePdfCanvasContent, k as resolveTextCanvasContent, U as resolveVisualizerCanvasContent };
|
|
@@ -4,7 +4,10 @@ import { DialFilePermission as t, FileManagerColumnKey as n } from "@epam/ai-dia
|
|
|
4
4
|
var r = 3, i = e, a = /[/\\]/, o = {
|
|
5
5
|
year: "numeric",
|
|
6
6
|
month: "short",
|
|
7
|
-
day: "2-digit"
|
|
7
|
+
day: "2-digit",
|
|
8
|
+
hour: "2-digit",
|
|
9
|
+
minute: "2-digit",
|
|
10
|
+
hour12: !1
|
|
8
11
|
}, s = [
|
|
9
12
|
n.Name,
|
|
10
13
|
n.UpdatedAt,
|