@acorex/components 21.0.3-next.40 → 21.0.3-next.41
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/fesm2022/{acorex-components-conversation-open-composer-picker-for-files-Du8Lj9Sp.mjs → acorex-components-conversation-open-composer-picker-for-files-Duvap4M4.mjs} +2 -3
- package/fesm2022/{acorex-components-conversation-open-composer-picker-for-files-Du8Lj9Sp.mjs.map → acorex-components-conversation-open-composer-picker-for-files-Duvap4M4.mjs.map} +1 -1
- package/fesm2022/acorex-components-conversation.mjs +22456 -1
- package/fesm2022/acorex-components-conversation.mjs.map +1 -1
- package/package.json +3 -3
- package/types/acorex-components-conversation.d.ts +1228 -48
- package/fesm2022/acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs +0 -13711
- package/fesm2022/acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs +0 -119
- package/fesm2022/acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs +0 -59
- package/fesm2022/acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio-picker.component-BD_fN2Ip.mjs +0 -432
- package/fesm2022/acorex-components-conversation-audio-picker.component-BD_fN2Ip.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs +0 -177
- package/fesm2022/acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio.payload-Bag4aTut.mjs +0 -54
- package/fesm2022/acorex-components-conversation-audio.payload-Bag4aTut.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs +0 -100
- package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs +0 -121
- package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs +0 -84
- package/fesm2022/acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs +0 -238
- package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs +0 -1080
- package/fesm2022/acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-video.file-type-Pescv4Vu.mjs +0 -102
- package/fesm2022/acorex-components-conversation-conversation-video.file-type-Pescv4Vu.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-voice.file-type-DDd47o4r.mjs +0 -90
- package/fesm2022/acorex-components-conversation-conversation-voice.file-type-DDd47o4r.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs +0 -44
- package/fesm2022/acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs +0 -64
- package/fesm2022/acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-file-picker.component-DCVgl33l.mjs +0 -468
- package/fesm2022/acorex-components-conversation-file-picker.component-DCVgl33l.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-file-renderer.component-DgCi06Mg.mjs +0 -125
- package/fesm2022/acorex-components-conversation-file-renderer.component-DgCi06Mg.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-file.payload-DyFxTQYn.mjs +0 -50
- package/fesm2022/acorex-components-conversation-file.payload-DyFxTQYn.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-format-media-DUD4vA6F.mjs +0 -21
- package/fesm2022/acorex-components-conversation-format-media-DUD4vA6F.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs +0 -77
- package/fesm2022/acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-image-picker.component-CS343UDa.mjs +0 -407
- package/fesm2022/acorex-components-conversation-image-picker.component-CS343UDa.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-image-renderer.component-Cy0TA6cL.mjs +0 -83
- package/fesm2022/acorex-components-conversation-image-renderer.component-Cy0TA6cL.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-index-3V2b14I0.mjs +0 -184
- package/fesm2022/acorex-components-conversation-index-3V2b14I0.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-index-MCvfr9Zd.mjs +0 -266
- package/fesm2022/acorex-components-conversation-index-MCvfr9Zd.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-location-picker.component-DcNQzuoU.mjs +0 -149
- package/fesm2022/acorex-components-conversation-location-picker.component-DcNQzuoU.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-location-renderer.component-Cw2PB0LM.mjs +0 -118
- package/fesm2022/acorex-components-conversation-location-renderer.component-Cw2PB0LM.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-media-formatters-DV3wEEno.mjs +0 -17
- package/fesm2022/acorex-components-conversation-media-formatters-DV3wEEno.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-media-playback-info-bar-banner.component-DbWUl6M2.mjs +0 -140
- package/fesm2022/acorex-components-conversation-media-playback-info-bar-banner.component-DbWUl6M2.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs +0 -33
- package/fesm2022/acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs +0 -172
- package/fesm2022/acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-pagination-demo-data-oIT_YJmN.mjs +0 -81
- package/fesm2022/acorex-components-conversation-pagination-demo-data-oIT_YJmN.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-picker-header.component-BneIFjXq.mjs +0 -91
- package/fesm2022/acorex-components-conversation-picker-header.component-BneIFjXq.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-picker-toolbar.component-BthRvEeE.mjs +0 -537
- package/fesm2022/acorex-components-conversation-picker-toolbar.component-BthRvEeE.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-picker-upload-C-PlKPaU.mjs +0 -163
- package/fesm2022/acorex-components-conversation-picker-upload-C-PlKPaU.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs +0 -68
- package/fesm2022/acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs +0 -95
- package/fesm2022/acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-search.component-B-nc6xiA.mjs +0 -187
- package/fesm2022/acorex-components-conversation-search.component-B-nc6xiA.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-send-message-media-BRklgfV7.mjs +0 -170
- package/fesm2022/acorex-components-conversation-send-message-media-BRklgfV7.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-shared-storage.seed-J9PA4l3c.mjs +0 -750
- package/fesm2022/acorex-components-conversation-shared-storage.seed-J9PA4l3c.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-sticker-renderer.component-BmBwy7Ig.mjs +0 -103
- package/fesm2022/acorex-components-conversation-sticker-renderer.component-BmBwy7Ig.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-system-renderer.component-uie3tm5N.mjs +0 -55
- package/fesm2022/acorex-components-conversation-system-renderer.component-uie3tm5N.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-text-renderer.component-DNAquHYK.mjs +0 -109
- package/fesm2022/acorex-components-conversation-text-renderer.component-DNAquHYK.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs +0 -105
- package/fesm2022/acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video-composer.payload-DMqRkafr.mjs +0 -62
- package/fesm2022/acorex-components-conversation-video-composer.payload-DMqRkafr.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video-picker.component-DPwSBnoH.mjs +0 -446
- package/fesm2022/acorex-components-conversation-video-picker.component-DPwSBnoH.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video-renderer.component-DKa9mUe2.mjs +0 -181
- package/fesm2022/acorex-components-conversation-video-renderer.component-DKa9mUe2.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video.payload-C8QaqxuX.mjs +0 -54
- package/fesm2022/acorex-components-conversation-video.payload-C8QaqxuX.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs +0 -17
- package/fesm2022/acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-voice-recorder.component-D_rdANZN.mjs +0 -344
- package/fesm2022/acorex-components-conversation-voice-recorder.component-D_rdANZN.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-voice-renderer.component-BY5FJcT8.mjs +0 -270
- package/fesm2022/acorex-components-conversation-voice-renderer.component-BY5FJcT8.mjs.map +0 -1
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { resolveFileTypeExtension, runFileTypeUtility } from '@acorex/core/file';
|
|
2
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
3
|
-
import { B as AX_CONVERSATION_MESSAGE_TYPE_FILE_TYPE } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
4
|
-
export { C as resolveConversationMessageFileType } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
5
|
-
|
|
6
|
-
async function mergeImageUploadResult(payload, result) {
|
|
7
|
-
const [{ normalizeImagePayload }, { resolvePersistableMediaUrl, resolvePersistedThumbnailUrl }] = await Promise.all([
|
|
8
|
-
import('./acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs').then(function (n) { return n.b_; }),
|
|
9
|
-
import('./acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs').then(function (n) { return n.bZ; }),
|
|
10
|
-
]);
|
|
11
|
-
const base = normalizeImagePayload(payload);
|
|
12
|
-
const images = [...base.images];
|
|
13
|
-
const i = images.findIndex((x) => !x.mediaId && !resolvePersistableMediaUrl(x.url));
|
|
14
|
-
const slot = i >= 0 ? images[i] : undefined;
|
|
15
|
-
const url = resolvePersistableMediaUrl(result.url);
|
|
16
|
-
const next = {
|
|
17
|
-
...(slot ?? { width: 0, height: 0 }),
|
|
18
|
-
mediaId: result.mediaId,
|
|
19
|
-
mimeType: result.mimeType,
|
|
20
|
-
size: result.size,
|
|
21
|
-
thumbnailUrl: resolvePersistedThumbnailUrl(result.thumbnailUrl ?? slot?.thumbnailUrl, url),
|
|
22
|
-
metadata: result.metadata,
|
|
23
|
-
};
|
|
24
|
-
if (url) {
|
|
25
|
-
next.url = url;
|
|
26
|
-
}
|
|
27
|
-
if (i >= 0)
|
|
28
|
-
images[i] = next;
|
|
29
|
-
else
|
|
30
|
-
images.push(next);
|
|
31
|
-
return { ...base, type: 'image', images };
|
|
32
|
-
}
|
|
33
|
-
async function applyImageLocalPreview(payload, localUrl, mimeType = 'application/octet-stream') {
|
|
34
|
-
const [{ normalizeImagePayload }, { resolvePersistableMediaUrl }] = await Promise.all([
|
|
35
|
-
import('./acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs').then(function (n) { return n.b_; }),
|
|
36
|
-
import('./acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs').then(function (n) { return n.bZ; }),
|
|
37
|
-
]);
|
|
38
|
-
const base = normalizeImagePayload(payload);
|
|
39
|
-
const images = [...base.images];
|
|
40
|
-
const slot = images.findIndex((x) => !x.mediaId && !resolvePersistableMediaUrl(x.url));
|
|
41
|
-
const preview = { url: localUrl, width: 0, height: 0, mimeType };
|
|
42
|
-
if (slot >= 0) {
|
|
43
|
-
images[slot] = { ...images[slot], ...preview };
|
|
44
|
-
}
|
|
45
|
-
else if (images.length === 0) {
|
|
46
|
-
images.push(preview);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
images[0] = { ...images[0], ...preview };
|
|
50
|
-
}
|
|
51
|
-
return { ...base, type: 'image', images };
|
|
52
|
-
}
|
|
53
|
-
async function mergeUploadResult(type, payload, result) {
|
|
54
|
-
switch (type) {
|
|
55
|
-
case 'image':
|
|
56
|
-
return mergeImageUploadResult(payload, result);
|
|
57
|
-
case 'video': {
|
|
58
|
-
const { mergeVideoUploadResult } = await import('./acorex-components-conversation-video-composer.payload-DMqRkafr.mjs');
|
|
59
|
-
return mergeVideoUploadResult(payload, result);
|
|
60
|
-
}
|
|
61
|
-
case 'audio': {
|
|
62
|
-
const { mergeAudioUploadResult } = await import('./acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs');
|
|
63
|
-
return mergeAudioUploadResult(payload, result);
|
|
64
|
-
}
|
|
65
|
-
case 'file': {
|
|
66
|
-
const { mergeFileUploadResult } = await import('./acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs');
|
|
67
|
-
return mergeFileUploadResult(payload, result);
|
|
68
|
-
}
|
|
69
|
-
case 'voice': {
|
|
70
|
-
const { mergeVoiceUploadResult } = await import('./acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs');
|
|
71
|
-
return mergeVoiceUploadResult(payload, result);
|
|
72
|
-
}
|
|
73
|
-
case 'sticker':
|
|
74
|
-
return {
|
|
75
|
-
...payload,
|
|
76
|
-
type: 'sticker',
|
|
77
|
-
url: result.url,
|
|
78
|
-
mediaId: result.mediaId,
|
|
79
|
-
};
|
|
80
|
-
default:
|
|
81
|
-
return payload;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async function applyLocalPreview(type, payload, localUrl, mimeType = 'application/octet-stream') {
|
|
85
|
-
switch (type) {
|
|
86
|
-
case 'image':
|
|
87
|
-
return applyImageLocalPreview(payload, localUrl, mimeType);
|
|
88
|
-
case 'video': {
|
|
89
|
-
const { applyVideoLocalPreview } = await import('./acorex-components-conversation-video-composer.payload-DMqRkafr.mjs');
|
|
90
|
-
return applyVideoLocalPreview(payload, localUrl, mimeType);
|
|
91
|
-
}
|
|
92
|
-
case 'audio': {
|
|
93
|
-
const { applyAudioLocalPreview } = await import('./acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs');
|
|
94
|
-
return applyAudioLocalPreview(payload, localUrl, mimeType);
|
|
95
|
-
}
|
|
96
|
-
case 'file': {
|
|
97
|
-
const { applyFileLocalPreview } = await import('./acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs');
|
|
98
|
-
return applyFileLocalPreview(payload, localUrl, mimeType);
|
|
99
|
-
}
|
|
100
|
-
case 'voice': {
|
|
101
|
-
const { applyVoiceLocalPreview } = await import('./acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs');
|
|
102
|
-
return applyVoiceLocalPreview(payload, localUrl);
|
|
103
|
-
}
|
|
104
|
-
case 'sticker':
|
|
105
|
-
return { ...payload, type: 'sticker', url: localUrl };
|
|
106
|
-
default:
|
|
107
|
-
return payload;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function toUploaderReference(payload) {
|
|
111
|
-
switch (payload.type) {
|
|
112
|
-
case 'image': {
|
|
113
|
-
const first = payload.images[0];
|
|
114
|
-
return { url: first?.url, mediaId: first?.mediaId, mimeType: first?.mimeType, size: first?.size };
|
|
115
|
-
}
|
|
116
|
-
case 'video': {
|
|
117
|
-
const first = payload.videos[0];
|
|
118
|
-
return { url: first?.url, mediaId: first?.mediaId, mimeType: first?.mimeType, size: first?.size };
|
|
119
|
-
}
|
|
120
|
-
case 'audio': {
|
|
121
|
-
const first = payload.audios[0];
|
|
122
|
-
return { url: first?.url, mediaId: first?.mediaId, mimeType: first?.mimeType, size: first?.size };
|
|
123
|
-
}
|
|
124
|
-
case 'file': {
|
|
125
|
-
const first = payload.files[0];
|
|
126
|
-
return { url: first?.url, mediaId: first?.mediaId, mimeType: first?.mimeType, size: first?.size };
|
|
127
|
-
}
|
|
128
|
-
case 'voice':
|
|
129
|
-
case 'sticker':
|
|
130
|
-
return {
|
|
131
|
-
url: payload.url,
|
|
132
|
-
mediaId: payload.mediaId,
|
|
133
|
-
mimeType: payload.mimeType,
|
|
134
|
-
size: payload.size,
|
|
135
|
-
};
|
|
136
|
-
default:
|
|
137
|
-
return {};
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function createObjectUrl(platformId, blob) {
|
|
141
|
-
if (!isPlatformBrowser(platformId)) {
|
|
142
|
-
return '';
|
|
143
|
-
}
|
|
144
|
-
return URL.createObjectURL(blob);
|
|
145
|
-
}
|
|
146
|
-
function revokeObjectUrl(platformId, url) {
|
|
147
|
-
if (isPlatformBrowser(platformId) && url.startsWith('blob:')) {
|
|
148
|
-
URL.revokeObjectURL(url);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
async function createLocalPreviewUrl(fileService, platformId, source, messageType) {
|
|
152
|
-
const catalog = AX_CONVERSATION_MESSAGE_TYPE_FILE_TYPE[messageType];
|
|
153
|
-
if (!catalog) {
|
|
154
|
-
return undefined;
|
|
155
|
-
}
|
|
156
|
-
const fileType = await fileService.getFileType(catalog);
|
|
157
|
-
if (!fileType) {
|
|
158
|
-
return undefined;
|
|
159
|
-
}
|
|
160
|
-
const ctx = { readAsDataUrl: (f) => fileService.blobToBase64(f), platformId };
|
|
161
|
-
const extension = resolveFileTypeExtension(fileType, {
|
|
162
|
-
file: source instanceof File ? source : undefined,
|
|
163
|
-
mimeType: source.type,
|
|
164
|
-
});
|
|
165
|
-
const result = await runFileTypeUtility(fileType, ctx, extension, 'createLocalPreviewUrl', source);
|
|
166
|
-
return typeof result === 'string' ? result : undefined;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export { AX_CONVERSATION_MESSAGE_TYPE_FILE_TYPE, applyLocalPreview, createLocalPreviewUrl, createObjectUrl, mergeUploadResult, revokeObjectUrl, toUploaderReference };
|
|
170
|
-
//# sourceMappingURL=acorex-components-conversation-send-message-media-BRklgfV7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-components-conversation-send-message-media-BRklgfV7.mjs","sources":["../../../../packages/components/conversation/src/lib/plugins/composer/composer-actions/send-message-media.ts"],"sourcesContent":["import type { AXUploadResult } from '@acorex/cdk/uploader';\nimport type { AXFileService } from '@acorex/core/file';\nimport { resolveFileTypeExtension, runFileTypeUtility } from '@acorex/core/file';\nimport { isPlatformBrowser } from '@angular/common';\nimport type { AXConversationImageMediaItem, AXConversationImagePayload, AXConversationMessagePayload, AXConversationMessageType } from '../../../models';\nimport type { AXConversationUploaderReference } from '../../../models/conversation-upload.types';\nimport { AX_CONVERSATION_MESSAGE_TYPE_FILE_TYPE, resolveConversationMessageFileType } from '../../../models/message-file-type-catalog';\n\nexport { resolveConversationMessageFileType, AX_CONVERSATION_MESSAGE_TYPE_FILE_TYPE };\n\nasync function mergeImageUploadResult(\n payload: AXConversationMessagePayload,\n result: AXUploadResult,\n): Promise<AXConversationMessagePayload> {\n const [{ normalizeImagePayload }, { resolvePersistableMediaUrl, resolvePersistedThumbnailUrl }] = await Promise.all([\n import('../../message-list/components/image-renderer/image.payload'),\n import('../components/shared/persisted-media-url'),\n ]);\n const base = normalizeImagePayload(payload as AXConversationImagePayload);\n const images = [...base.images];\n const i = images.findIndex((x) => !x.mediaId && !resolvePersistableMediaUrl(x.url));\n const slot = i >= 0 ? images[i] : undefined;\n const url = resolvePersistableMediaUrl(result.url);\n const next: AXConversationImageMediaItem = {\n ...(slot ?? { width: 0, height: 0 }),\n mediaId: result.mediaId,\n mimeType: result.mimeType,\n size: result.size,\n thumbnailUrl: resolvePersistedThumbnailUrl(result.thumbnailUrl ?? slot?.thumbnailUrl, url),\n metadata: result.metadata,\n };\n if (url) {\n next.url = url;\n }\n if (i >= 0) images[i] = next;\n else images.push(next);\n return { ...base, type: 'image', images };\n}\n\nasync function applyImageLocalPreview(\n payload: AXConversationMessagePayload,\n localUrl: string,\n mimeType = 'application/octet-stream',\n): Promise<AXConversationMessagePayload> {\n const [{ normalizeImagePayload }, { resolvePersistableMediaUrl }] = await Promise.all([\n import('../../message-list/components/image-renderer/image.payload'),\n import('../components/shared/persisted-media-url'),\n ]);\n const base = normalizeImagePayload(payload as AXConversationImagePayload);\n const images = [...base.images];\n const slot = images.findIndex((x) => !x.mediaId && !resolvePersistableMediaUrl(x.url));\n const preview = { url: localUrl, width: 0, height: 0, mimeType };\n if (slot >= 0) {\n images[slot] = { ...images[slot], ...preview };\n } else if (images.length === 0) {\n images.push(preview);\n } else {\n images[0] = { ...images[0], ...preview };\n }\n return { ...base, type: 'image', images };\n}\n\nexport async function mergeUploadResult(\n type: AXConversationMessageType,\n payload: AXConversationMessagePayload,\n result: AXUploadResult,\n): Promise<AXConversationMessagePayload> {\n switch (type) {\n case 'image':\n return mergeImageUploadResult(payload, result);\n case 'video': {\n const { mergeVideoUploadResult } = await import('../components/video-picker/video-composer.payload');\n return mergeVideoUploadResult(payload, result);\n }\n case 'audio': {\n const { mergeAudioUploadResult } = await import('../components/audio-picker/audio-composer.payload');\n return mergeAudioUploadResult(payload, result);\n }\n case 'file': {\n const { mergeFileUploadResult } = await import('../components/file-picker/file-composer.payload');\n return mergeFileUploadResult(payload, result);\n }\n case 'voice': {\n const { mergeVoiceUploadResult } = await import('../components/voice-recorder/voice-composer.payload');\n return mergeVoiceUploadResult(payload, result);\n }\n case 'sticker':\n return {\n ...(payload as Extract<AXConversationMessagePayload, { type: 'sticker' }>),\n type: 'sticker',\n url: result.url,\n mediaId: result.mediaId,\n };\n default:\n return payload;\n }\n}\n\nexport async function applyLocalPreview(\n type: AXConversationMessageType,\n payload: AXConversationMessagePayload,\n localUrl: string,\n mimeType = 'application/octet-stream',\n): Promise<AXConversationMessagePayload> {\n switch (type) {\n case 'image':\n return applyImageLocalPreview(payload, localUrl, mimeType);\n case 'video': {\n const { applyVideoLocalPreview } = await import('../components/video-picker/video-composer.payload');\n return applyVideoLocalPreview(payload, localUrl, mimeType);\n }\n case 'audio': {\n const { applyAudioLocalPreview } = await import('../components/audio-picker/audio-composer.payload');\n return applyAudioLocalPreview(payload, localUrl, mimeType);\n }\n case 'file': {\n const { applyFileLocalPreview } = await import('../components/file-picker/file-composer.payload');\n return applyFileLocalPreview(payload, localUrl, mimeType);\n }\n case 'voice': {\n const { applyVoiceLocalPreview } = await import('../components/voice-recorder/voice-composer.payload');\n return applyVoiceLocalPreview(payload, localUrl);\n }\n case 'sticker':\n return { ...(payload as Extract<AXConversationMessagePayload, { type: 'sticker' }>), type: 'sticker', url: localUrl };\n default:\n return payload;\n }\n}\n\nexport function toUploaderReference(payload: AXConversationMessagePayload): AXConversationUploaderReference {\n switch (payload.type) {\n case 'image': {\n const first = payload.images[0];\n return { url: first?.url, mediaId: first?.mediaId, mimeType: first?.mimeType, size: first?.size };\n }\n case 'video': {\n const first = payload.videos[0];\n return { url: first?.url, mediaId: first?.mediaId, mimeType: first?.mimeType, size: first?.size };\n }\n case 'audio': {\n const first = payload.audios[0];\n return { url: first?.url, mediaId: first?.mediaId, mimeType: first?.mimeType, size: first?.size };\n }\n case 'file': {\n const first = payload.files[0];\n return { url: first?.url, mediaId: first?.mediaId, mimeType: first?.mimeType, size: first?.size };\n }\n case 'voice':\n case 'sticker':\n return {\n url: payload.url,\n mediaId: payload.mediaId,\n mimeType: payload.mimeType,\n size: payload.size,\n };\n default:\n return {};\n }\n}\n\nexport function createObjectUrl(platformId: object, blob: Blob): string {\n if (!isPlatformBrowser(platformId)) {\n return '';\n }\n return URL.createObjectURL(blob);\n}\n\nexport function revokeObjectUrl(platformId: object, url: string): void {\n if (isPlatformBrowser(platformId) && url.startsWith('blob:')) {\n URL.revokeObjectURL(url);\n }\n}\n\nexport async function createLocalPreviewUrl(\n fileService: AXFileService,\n platformId: object,\n source: File | Blob,\n messageType: AXConversationMessageType,\n): Promise<string | undefined> {\n const catalog = AX_CONVERSATION_MESSAGE_TYPE_FILE_TYPE[messageType];\n if (!catalog) {\n return undefined;\n }\n const fileType = await fileService.getFileType(catalog);\n if (!fileType) {\n return undefined;\n }\n const ctx = { readAsDataUrl: (f: File | Blob) => fileService.blobToBase64(f), platformId };\n const extension = resolveFileTypeExtension(fileType, {\n file: source instanceof File ? source : undefined,\n mimeType: source.type,\n });\n const result = await runFileTypeUtility(fileType, ctx, extension, 'createLocalPreviewUrl', source);\n return typeof result === 'string' ? result : undefined;\n}\n"],"names":[],"mappings":";;;;;AAUA,eAAe,sBAAsB,CACnC,OAAqC,EACrC,MAAsB,EAAA;AAEtB,IAAA,MAAM,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAClH,OAAO,8EAA4D,qCAAC;QACpE,OAAO,8EAA0C,qCAAC;AACnD,KAAA,CAAC;AACF,IAAA,MAAM,IAAI,GAAG,qBAAqB,CAAC,OAAqC,CAAC;IACzE,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IAC/B,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACnF,IAAA,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS;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