@acorex/components 21.0.3-next.39 → 21.0.3-next.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/{conversation2 → conversation}/README.md +23 -23
  2. package/fesm2022/acorex-components-button.mjs +4 -4
  3. package/fesm2022/acorex-components-button.mjs.map +1 -1
  4. package/fesm2022/acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs +13711 -0
  5. package/fesm2022/acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs.map +1 -0
  6. package/fesm2022/acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs +119 -0
  7. package/fesm2022/acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs.map +1 -0
  8. package/fesm2022/acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs +59 -0
  9. package/fesm2022/acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs.map +1 -0
  10. package/fesm2022/acorex-components-conversation-audio-picker.component-BD_fN2Ip.mjs +432 -0
  11. package/fesm2022/acorex-components-conversation-audio-picker.component-BD_fN2Ip.mjs.map +1 -0
  12. package/fesm2022/acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs +177 -0
  13. package/fesm2022/acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs.map +1 -0
  14. package/fesm2022/acorex-components-conversation-audio.payload-Bag4aTut.mjs +54 -0
  15. package/fesm2022/acorex-components-conversation-audio.payload-Bag4aTut.mjs.map +1 -0
  16. package/fesm2022/acorex-components-conversation-composer-action-choice-dialog.component-C28hl7iD.mjs +101 -0
  17. package/fesm2022/acorex-components-conversation-composer-action-choice-dialog.component-C28hl7iD.mjs.map +1 -0
  18. package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs +100 -0
  19. package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs.map +1 -0
  20. package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs +121 -0
  21. package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs.map +1 -0
  22. package/fesm2022/acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs +84 -0
  23. package/fesm2022/acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs.map +1 -0
  24. package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs +238 -0
  25. package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs.map +1 -0
  26. package/fesm2022/acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs +1080 -0
  27. package/fesm2022/acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs.map +1 -0
  28. package/fesm2022/acorex-components-conversation-conversation-video.file-type-Pescv4Vu.mjs +102 -0
  29. package/fesm2022/acorex-components-conversation-conversation-video.file-type-Pescv4Vu.mjs.map +1 -0
  30. package/fesm2022/acorex-components-conversation-conversation-voice.file-type-DDd47o4r.mjs +90 -0
  31. package/fesm2022/acorex-components-conversation-conversation-voice.file-type-DDd47o4r.mjs.map +1 -0
  32. package/fesm2022/acorex-components-conversation-emoji-categories-C7Gm95V0.mjs +1840 -0
  33. package/fesm2022/acorex-components-conversation-emoji-categories-C7Gm95V0.mjs.map +1 -0
  34. package/fesm2022/acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs +44 -0
  35. package/fesm2022/acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs.map +1 -0
  36. package/fesm2022/acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs +64 -0
  37. package/fesm2022/acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs.map +1 -0
  38. package/fesm2022/acorex-components-conversation-file-picker.component-DCVgl33l.mjs +468 -0
  39. package/fesm2022/acorex-components-conversation-file-picker.component-DCVgl33l.mjs.map +1 -0
  40. package/fesm2022/acorex-components-conversation-file-renderer.component-DgCi06Mg.mjs +125 -0
  41. package/fesm2022/acorex-components-conversation-file-renderer.component-DgCi06Mg.mjs.map +1 -0
  42. package/fesm2022/acorex-components-conversation-file.payload-DyFxTQYn.mjs +50 -0
  43. package/fesm2022/acorex-components-conversation-file.payload-DyFxTQYn.mjs.map +1 -0
  44. package/fesm2022/acorex-components-conversation-format-media-DUD4vA6F.mjs +21 -0
  45. package/fesm2022/acorex-components-conversation-format-media-DUD4vA6F.mjs.map +1 -0
  46. package/fesm2022/acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs +77 -0
  47. package/fesm2022/acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs.map +1 -0
  48. package/fesm2022/acorex-components-conversation-image-picker.component-CS343UDa.mjs +407 -0
  49. package/fesm2022/acorex-components-conversation-image-picker.component-CS343UDa.mjs.map +1 -0
  50. package/fesm2022/acorex-components-conversation-image-renderer.component-Cy0TA6cL.mjs +83 -0
  51. package/fesm2022/acorex-components-conversation-image-renderer.component-Cy0TA6cL.mjs.map +1 -0
  52. package/fesm2022/acorex-components-conversation-index-3V2b14I0.mjs +184 -0
  53. package/fesm2022/acorex-components-conversation-index-3V2b14I0.mjs.map +1 -0
  54. package/fesm2022/acorex-components-conversation-index-MCvfr9Zd.mjs +266 -0
  55. package/fesm2022/acorex-components-conversation-index-MCvfr9Zd.mjs.map +1 -0
  56. package/fesm2022/acorex-components-conversation-location-picker.component-DcNQzuoU.mjs +149 -0
  57. package/fesm2022/acorex-components-conversation-location-picker.component-DcNQzuoU.mjs.map +1 -0
  58. package/fesm2022/acorex-components-conversation-location-renderer.component-Cw2PB0LM.mjs +118 -0
  59. package/fesm2022/acorex-components-conversation-location-renderer.component-Cw2PB0LM.mjs.map +1 -0
  60. package/fesm2022/acorex-components-conversation-media-formatters-DV3wEEno.mjs +17 -0
  61. package/fesm2022/acorex-components-conversation-media-formatters-DV3wEEno.mjs.map +1 -0
  62. package/fesm2022/acorex-components-conversation-media-playback-info-bar-banner.component-DbWUl6M2.mjs +140 -0
  63. package/fesm2022/acorex-components-conversation-media-playback-info-bar-banner.component-DbWUl6M2.mjs.map +1 -0
  64. package/fesm2022/acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs +33 -0
  65. package/fesm2022/acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs.map +1 -0
  66. package/fesm2022/acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs +172 -0
  67. package/fesm2022/acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs.map +1 -0
  68. package/fesm2022/acorex-components-conversation-open-composer-picker-for-files-Du8Lj9Sp.mjs +224 -0
  69. package/fesm2022/acorex-components-conversation-open-composer-picker-for-files-Du8Lj9Sp.mjs.map +1 -0
  70. package/fesm2022/acorex-components-conversation-pagination-demo-data-oIT_YJmN.mjs +81 -0
  71. package/fesm2022/acorex-components-conversation-pagination-demo-data-oIT_YJmN.mjs.map +1 -0
  72. package/fesm2022/acorex-components-conversation-picker-header.component-BneIFjXq.mjs +91 -0
  73. package/fesm2022/acorex-components-conversation-picker-header.component-BneIFjXq.mjs.map +1 -0
  74. package/fesm2022/acorex-components-conversation-picker-toolbar.component-BthRvEeE.mjs +537 -0
  75. package/fesm2022/acorex-components-conversation-picker-toolbar.component-BthRvEeE.mjs.map +1 -0
  76. package/fesm2022/acorex-components-conversation-picker-upload-C-PlKPaU.mjs +163 -0
  77. package/fesm2022/acorex-components-conversation-picker-upload-C-PlKPaU.mjs.map +1 -0
  78. package/fesm2022/acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs +68 -0
  79. package/fesm2022/acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs.map +1 -0
  80. package/fesm2022/acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs +95 -0
  81. package/fesm2022/acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs.map +1 -0
  82. package/fesm2022/acorex-components-conversation-search.component-B-nc6xiA.mjs +187 -0
  83. package/fesm2022/acorex-components-conversation-search.component-B-nc6xiA.mjs.map +1 -0
  84. package/fesm2022/acorex-components-conversation-send-message-media-BRklgfV7.mjs +170 -0
  85. package/fesm2022/acorex-components-conversation-send-message-media-BRklgfV7.mjs.map +1 -0
  86. package/fesm2022/acorex-components-conversation-shared-storage.seed-J9PA4l3c.mjs +750 -0
  87. package/fesm2022/acorex-components-conversation-shared-storage.seed-J9PA4l3c.mjs.map +1 -0
  88. package/fesm2022/acorex-components-conversation-sticker-renderer.component-BmBwy7Ig.mjs +103 -0
  89. package/fesm2022/acorex-components-conversation-sticker-renderer.component-BmBwy7Ig.mjs.map +1 -0
  90. package/fesm2022/acorex-components-conversation-system-renderer.component-uie3tm5N.mjs +55 -0
  91. package/fesm2022/acorex-components-conversation-system-renderer.component-uie3tm5N.mjs.map +1 -0
  92. package/fesm2022/acorex-components-conversation-text-renderer.component-DNAquHYK.mjs +109 -0
  93. package/fesm2022/acorex-components-conversation-text-renderer.component-DNAquHYK.mjs.map +1 -0
  94. package/fesm2022/acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs +105 -0
  95. package/fesm2022/acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs.map +1 -0
  96. package/fesm2022/acorex-components-conversation-video-composer.payload-DMqRkafr.mjs +62 -0
  97. package/fesm2022/acorex-components-conversation-video-composer.payload-DMqRkafr.mjs.map +1 -0
  98. package/fesm2022/acorex-components-conversation-video-picker.component-DPwSBnoH.mjs +446 -0
  99. package/fesm2022/acorex-components-conversation-video-picker.component-DPwSBnoH.mjs.map +1 -0
  100. package/fesm2022/acorex-components-conversation-video-renderer.component-DKa9mUe2.mjs +181 -0
  101. package/fesm2022/acorex-components-conversation-video-renderer.component-DKa9mUe2.mjs.map +1 -0
  102. package/fesm2022/acorex-components-conversation-video.payload-C8QaqxuX.mjs +54 -0
  103. package/fesm2022/acorex-components-conversation-video.payload-C8QaqxuX.mjs.map +1 -0
  104. package/fesm2022/acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs +17 -0
  105. package/fesm2022/acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs.map +1 -0
  106. package/fesm2022/acorex-components-conversation-voice-recorder.component-D_rdANZN.mjs +344 -0
  107. package/fesm2022/acorex-components-conversation-voice-recorder.component-D_rdANZN.mjs.map +1 -0
  108. package/fesm2022/acorex-components-conversation-voice-renderer.component-BY5FJcT8.mjs +270 -0
  109. package/fesm2022/acorex-components-conversation-voice-renderer.component-BY5FJcT8.mjs.map +1 -0
  110. package/fesm2022/acorex-components-conversation.mjs +2 -0
  111. package/fesm2022/acorex-components-conversation.mjs.map +1 -0
  112. package/fesm2022/acorex-components-kbd.mjs +2 -2
  113. package/fesm2022/acorex-components-kbd.mjs.map +1 -1
  114. package/fesm2022/acorex-components-scheduler-picker.mjs +22 -14
  115. package/fesm2022/acorex-components-scheduler-picker.mjs.map +1 -1
  116. package/fesm2022/acorex-components-side-menu.mjs +4 -13
  117. package/fesm2022/acorex-components-side-menu.mjs.map +1 -1
  118. package/fesm2022/acorex-components-tree-view.mjs +2 -2
  119. package/fesm2022/acorex-components-tree-view.mjs.map +1 -1
  120. package/package.json +6 -10
  121. package/types/{acorex-components-conversation2.d.ts → acorex-components-conversation.d.ts} +1127 -1928
  122. package/types/acorex-components-scheduler-picker.d.ts +2 -0
  123. package/types/acorex-components-side-menu.d.ts +1 -3
  124. package/fesm2022/acorex-components-conversation2.mjs +0 -22347
  125. package/fesm2022/acorex-components-conversation2.mjs.map +0 -1
  126. package/fesm2022/acorex-components-sidebar.mjs +0 -275
  127. package/fesm2022/acorex-components-sidebar.mjs.map +0 -1
  128. package/sidebar/README.md +0 -5
  129. package/types/acorex-components-sidebar.d.ts +0 -132
@@ -0,0 +1,170 @@
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
@@ -0,0 +1 @@
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;IAC3C,MAAM,GAAG,GAAG,0BAA0B,CAAC,MAAM,CAAC,GAAG,CAAC;AAClD,IAAA,MAAM,IAAI,GAAiC;AACzC,Q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