sceyt-chat-react-uikit 1.8.8 → 1.8.9-beta.10

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/index.modern.js CHANGED
@@ -13,7 +13,7 @@ import Cropper from 'react-easy-crop';
13
13
  import { CircularProgressbar } from 'react-circular-progressbar';
14
14
  import { FFmpeg } from '@ffmpeg/ffmpeg';
15
15
  import { toBlobURL, fetchFile } from '@ffmpeg/util';
16
- import { $applyNodeReplacement, TextNode, $createTextNode, $getSelection, $isRangeSelection, $isTextNode, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, $getRoot, $createParagraphNode, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, PASTE_COMMAND, COMMAND_PRIORITY_NORMAL } from 'lexical';
16
+ import { $applyNodeReplacement, TextNode, $createTextNode, $getSelection, $isRangeSelection, $isTextNode, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, $getRoot, $createParagraphNode, PASTE_COMMAND, COMMAND_PRIORITY_NORMAL } from 'lexical';
17
17
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
18
18
  import { LexicalComposer } from '@lexical/react/LexicalComposer';
19
19
  import { ContentEditable } from '@lexical/react/LexicalContentEditable';
@@ -10470,7 +10470,7 @@ if (isBrowser) {
10470
10470
  } else {
10471
10471
  cacheAvailable = 'caches' in global;
10472
10472
  }
10473
- var ATTACHMENT_VERSION = "_1_0_1";
10473
+ var ATTACHMENT_VERSION = "_1_0_2";
10474
10474
  var setAttachmentToCache = function setAttachmentToCache(attachmentUrl, attachmentResponse) {
10475
10475
  try {
10476
10476
  var attachmentURLVersion = attachmentUrl + ATTACHMENT_VERSION;
@@ -11373,10 +11373,10 @@ function fetchOGMetadataForLinkAC(url) {
11373
11373
  };
11374
11374
  }
11375
11375
 
11376
- var _excluded = ["data"];
11377
11376
  var DB_NAME = 'sceyt-uikit-messages';
11378
- var DB_VERSION = 1;
11377
+ var DB_VERSION = 2;
11379
11378
  var CHANNELS_STORE = 'channels';
11379
+ var DRAFTS_STORE = 'drafts';
11380
11380
  var META_STORE = 'meta';
11381
11381
  var USER_META_KEY = 'userId';
11382
11382
  var IDB_MAX_STORED_CHANNELS = 200;
@@ -11400,6 +11400,11 @@ var openDb = function openDb() {
11400
11400
  });
11401
11401
  store.createIndex('savedAt', 'savedAt');
11402
11402
  }
11403
+ if (!db.objectStoreNames.contains(DRAFTS_STORE)) {
11404
+ db.createObjectStore(DRAFTS_STORE, {
11405
+ keyPath: 'channelId'
11406
+ });
11407
+ }
11403
11408
  if (!db.objectStoreNames.contains(META_STORE)) {
11404
11409
  db.createObjectStore(META_STORE);
11405
11410
  }
@@ -11438,8 +11443,8 @@ var sanitizeMessageForPersist = function sanitizeMessageForPersist(message) {
11438
11443
  }
11439
11444
  return _extends({}, message, {
11440
11445
  attachments: message.attachments.map(function (attachment) {
11441
- var _ref = attachment || {},
11442
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
11446
+ var rest = _extends({}, attachment || {});
11447
+ delete rest.data;
11443
11448
  if (rest.attachmentUrl && String(rest.attachmentUrl).startsWith('blob:')) {
11444
11449
  rest.attachmentUrl = undefined;
11445
11450
  }
@@ -11493,6 +11498,68 @@ var restoreChannelMessages = function restoreChannelMessages(channelId) {
11493
11498
  return Promise.reject(e);
11494
11499
  }
11495
11500
  };
11501
+ var persistDraft = function persistDraft(channelId, draft) {
11502
+ try {
11503
+ return Promise.resolve(openDb()).then(function (db) {
11504
+ if (!db || !channelId) return;
11505
+ try {
11506
+ var persistedDraft = _extends({}, draft || {});
11507
+ delete persistedDraft.editorState;
11508
+ db.transaction(DRAFTS_STORE, 'readwrite').objectStore(DRAFTS_STORE).put({
11509
+ channelId: channelId,
11510
+ draft: persistedDraft,
11511
+ savedAt: Date.now()
11512
+ });
11513
+ } catch (e) {
11514
+ log.info('messagesIdb: failed to persist draft', e);
11515
+ }
11516
+ });
11517
+ } catch (e) {
11518
+ return Promise.reject(e);
11519
+ }
11520
+ };
11521
+ var restoreDrafts = function restoreDrafts() {
11522
+ try {
11523
+ return Promise.resolve(openDb()).then(function (db) {
11524
+ return db ? _catch(function () {
11525
+ return Promise.resolve(requestToPromise(db.transaction(DRAFTS_STORE, 'readonly').objectStore(DRAFTS_STORE).getAll()));
11526
+ }, function (e) {
11527
+ log.info('messagesIdb: failed to restore drafts', e);
11528
+ return [];
11529
+ }) : [];
11530
+ });
11531
+ } catch (e) {
11532
+ return Promise.reject(e);
11533
+ }
11534
+ };
11535
+ var removePersistedDraft = function removePersistedDraft(channelId) {
11536
+ try {
11537
+ return Promise.resolve(openDb()).then(function (db) {
11538
+ if (!db || !channelId) return;
11539
+ try {
11540
+ db.transaction(DRAFTS_STORE, 'readwrite').objectStore(DRAFTS_STORE)["delete"](channelId);
11541
+ } catch (e) {
11542
+ log.info('messagesIdb: failed to remove draft', e);
11543
+ }
11544
+ });
11545
+ } catch (e) {
11546
+ return Promise.reject(e);
11547
+ }
11548
+ };
11549
+ var clearPersistedDrafts = function clearPersistedDrafts() {
11550
+ try {
11551
+ return Promise.resolve(openDb()).then(function (db) {
11552
+ if (!db) return;
11553
+ try {
11554
+ db.transaction(DRAFTS_STORE, 'readwrite').objectStore(DRAFTS_STORE).clear();
11555
+ } catch (e) {
11556
+ log.info('messagesIdb: failed to clear drafts', e);
11557
+ }
11558
+ });
11559
+ } catch (e) {
11560
+ return Promise.reject(e);
11561
+ }
11562
+ };
11496
11563
  var clearPersistedChannels = function clearPersistedChannels() {
11497
11564
  try {
11498
11565
  return Promise.resolve(openDb()).then(function (db) {
@@ -11550,8 +11617,10 @@ var initMessagesIdbForUser = function initMessagesIdbForUser(userId) {
11550
11617
  var _temp = function () {
11551
11618
  if (storedUserId !== userId) {
11552
11619
  return Promise.resolve(clearPersistedChannels()).then(function () {
11553
- db.transaction(META_STORE, 'readwrite').objectStore(META_STORE).put(userId, USER_META_KEY);
11554
- _exit = true;
11620
+ return Promise.resolve(clearPersistedDrafts()).then(function () {
11621
+ db.transaction(META_STORE, 'readwrite').objectStore(META_STORE).put(userId, USER_META_KEY);
11622
+ _exit = true;
11623
+ });
11555
11624
  });
11556
11625
  }
11557
11626
  }();
@@ -12478,6 +12547,22 @@ function getAllPendingFromMap() {
12478
12547
  return result;
12479
12548
  }
12480
12549
  var draftMessagesMap = {};
12550
+ var draftListeners = new Set();
12551
+ var draftMessagesHydrated = false;
12552
+ var notifyDraftListeners = function notifyDraftListeners() {
12553
+ return draftListeners.forEach(function (listener) {
12554
+ return listener();
12555
+ });
12556
+ };
12557
+ var subscribeToDraftMessages = function subscribeToDraftMessages(listener) {
12558
+ draftListeners.add(listener);
12559
+ return function () {
12560
+ draftListeners["delete"](listener);
12561
+ };
12562
+ };
12563
+ var areDraftMessagesHydrated = function areDraftMessagesHydrated() {
12564
+ return draftMessagesHydrated;
12565
+ };
12481
12566
  var audioRecordingMap = {};
12482
12567
  var getDraftMessageFromMap = function getDraftMessageFromMap(channelId) {
12483
12568
  return draftMessagesMap[channelId];
@@ -12493,12 +12578,63 @@ var setAudioRecordingToMap = function setAudioRecordingToMap(channelId, audioRec
12493
12578
  };
12494
12579
  var removeDraftMessageFromMap = function removeDraftMessageFromMap(channelId) {
12495
12580
  delete draftMessagesMap[channelId];
12581
+ Promise.resolve(removePersistedDraft(channelId))["catch"](function () {
12582
+ return undefined;
12583
+ });
12584
+ notifyDraftListeners();
12585
+ };
12586
+ var clearDraftMessagesMap = function clearDraftMessagesMap() {
12587
+ Object.keys(draftMessagesMap).forEach(function (channelId) {
12588
+ return delete draftMessagesMap[channelId];
12589
+ });
12590
+ notifyDraftListeners();
12496
12591
  };
12497
12592
  var removeAudioRecordingFromMap = function removeAudioRecordingFromMap(channelId) {
12498
12593
  delete audioRecordingMap[channelId];
12499
12594
  };
12500
- var setDraftMessageToMap = function setDraftMessageToMap(channelId, draftMessage) {
12595
+ var setDraftMessageToMap = function setDraftMessageToMap(channelId, draftMessage, options) {
12596
+ if (options === void 0) {
12597
+ options = {};
12598
+ }
12501
12599
  draftMessagesMap[channelId] = draftMessage;
12600
+ if (options.persist === false) {
12601
+ Promise.resolve(removePersistedDraft(channelId))["catch"](function () {
12602
+ return undefined;
12603
+ });
12604
+ } else {
12605
+ Promise.resolve(persistDraft(channelId, draftMessage))["catch"](function () {
12606
+ return undefined;
12607
+ });
12608
+ }
12609
+ notifyDraftListeners();
12610
+ };
12611
+ var hydrateDraftMessages = function hydrateDraftMessages() {
12612
+ try {
12613
+ return Promise.resolve(restoreDrafts()).then(function (persistedDrafts) {
12614
+ persistedDrafts.forEach(function (_ref) {
12615
+ var channelId = _ref.channelId,
12616
+ draft = _ref.draft;
12617
+ var attachments = (draft.attachments || []).map(function (attachment) {
12618
+ var data = attachment.data;
12619
+ var restoredData = data instanceof Blob && typeof File !== 'undefined' && !(data instanceof File) ? new File([data], attachment.name || 'attachment', {
12620
+ type: data.type || attachment.mimeType || 'application/octet-stream',
12621
+ lastModified: attachment.lastModified || Date.now()
12622
+ }) : data;
12623
+ return _extends({}, attachment, {
12624
+ data: restoredData,
12625
+ attachmentUrl: restoredData instanceof Blob && typeof URL !== 'undefined' ? URL.createObjectURL(restoredData) : attachment.attachmentUrl
12626
+ });
12627
+ });
12628
+ draftMessagesMap[channelId] = _extends({}, draft, {
12629
+ attachments: attachments
12630
+ });
12631
+ });
12632
+ draftMessagesHydrated = true;
12633
+ notifyDraftListeners();
12634
+ });
12635
+ } catch (e) {
12636
+ return Promise.reject(e);
12637
+ }
12502
12638
  };
12503
12639
  var checkPendingPollActionConflict = function checkPendingPollActionConflict(action) {
12504
12640
  var messageId = action.message.id || action.message.tid;
@@ -15159,7 +15295,7 @@ var resizeImageWithPica = function resizeImageWithPica(file, maxWidth, maxHeight
15159
15295
  maxHeight = 1600;
15160
15296
  }
15161
15297
  if (quality === void 0) {
15162
- quality = 0.82;
15298
+ quality = 1;
15163
15299
  }
15164
15300
  try {
15165
15301
  return Promise.resolve(_catch(function () {
@@ -15255,7 +15391,7 @@ var resizeImageWithPica = function resizeImageWithPica(file, maxWidth, maxHeight
15255
15391
  var MAX_WIDTH = 1280;
15256
15392
  var MAX_HEIGHT = 1080;
15257
15393
  var MIME_TYPE = 'image/jpeg';
15258
- var QUALITY = 0.9;
15394
+ var QUALITY = 1;
15259
15395
  var THUMBNAIL_MAX_WIDTH = 6;
15260
15396
  var THUMBNAIL_MAX_HEIGHT = 6;
15261
15397
  function resizeImage(file, maxWidth, maxHeight, quality) {
@@ -15682,11 +15818,11 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15682
15818
  var _exit4 = false;
15683
15819
  if (_exit3) return _result3;
15684
15820
  function _temp8(_result4) {
15685
- return _exit4 ? _result4 : Promise.resolve(extractFrameFromUrl(videoSrc, maxWidth, maxHeight, quality)).then(function (direct) {
15821
+ return _exit4 ? _result4 : Promise.resolve(extractFrameFromUrl(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (direct) {
15686
15822
  return direct ? direct : _catch(function () {
15687
15823
  return Promise.resolve(fetch(videoSrc)).then(function (response) {
15688
15824
  return Promise.resolve(response.blob()).then(function (blob) {
15689
- return Promise.resolve(_extractFrameFromBlob2(blob, maxWidth, maxHeight, quality));
15825
+ return Promise.resolve(_extractFrameFromBlob2(blob, scaledMaxWidth, scaledMaxHeight, quality));
15690
15826
  });
15691
15827
  });
15692
15828
  }, function (error) {
@@ -15700,7 +15836,7 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15700
15836
  return _catch(function () {
15701
15837
  return Promise.resolve(fetch(videoSrc)).then(function (_fetch) {
15702
15838
  return Promise.resolve(_fetch.blob()).then(function (blob) {
15703
- return Promise.resolve(_extractFrameFromBlob2(blob, maxWidth, maxHeight, quality)).then(function (_await$_extractFrameF2) {
15839
+ return Promise.resolve(_extractFrameFromBlob2(blob, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$_extractFrameF2) {
15704
15840
  _exit4 = true;
15705
15841
  return _await$_extractFrameF2;
15706
15842
  });
@@ -15708,7 +15844,7 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15708
15844
  });
15709
15845
  }, function (error) {
15710
15846
  log.warn('getVideoFirstFrame: failed to re-fetch blob url, trying directly', error);
15711
- return Promise.resolve(extractFrameFromUrl(videoSrc, maxWidth, maxHeight, quality)).then(function (_await$extractFrameFr) {
15847
+ return Promise.resolve(extractFrameFromUrl(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$extractFrameFr) {
15712
15848
  _exit4 = true;
15713
15849
  return _await$extractFrameFr;
15714
15850
  });
@@ -15717,9 +15853,11 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15717
15853
  }();
15718
15854
  return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
15719
15855
  }
15856
+ var scaledMaxWidth = scaleForDevicePixelRatio(maxWidth);
15857
+ var scaledMaxHeight = scaleForDevicePixelRatio(maxHeight);
15720
15858
  var _temp9 = function () {
15721
15859
  if (videoSrc instanceof Blob) {
15722
- return Promise.resolve(_extractFrameFromBlob2(videoSrc, maxWidth, maxHeight, quality)).then(function (_await$_extractFrameF) {
15860
+ return Promise.resolve(_extractFrameFromBlob2(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$_extractFrameF) {
15723
15861
  _exit3 = true;
15724
15862
  return _await$_extractFrameF;
15725
15863
  });
@@ -15734,6 +15872,16 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15734
15872
  return Promise.reject(e);
15735
15873
  }
15736
15874
  };
15875
+ var scaleForDevicePixelRatio = function scaleForDevicePixelRatio(value, cap) {
15876
+ if (cap === void 0) {
15877
+ cap = 2;
15878
+ }
15879
+ if (!value) {
15880
+ return value;
15881
+ }
15882
+ var dpr = Math.min(window.devicePixelRatio || 1, cap);
15883
+ return value * dpr;
15884
+ };
15737
15885
  var normalizeVideoBlob = function normalizeVideoBlob(blob) {
15738
15886
  try {
15739
15887
  return Promise.resolve(inspectVideoBlob(blob)).then(function (info) {
@@ -15964,7 +16112,7 @@ var compressAndCacheImage = function compressAndCacheImage(url, cacheKey, maxWid
15964
16112
  var file = new File([blob], 'image.jpeg', {
15965
16113
  type: blob.type
15966
16114
  });
15967
- return Promise.resolve(resizeImageWithPica(file, maxWidth || 1280, maxHeight || 1080, quality || 1)).then(function (_ref2) {
16115
+ return Promise.resolve(resizeImageWithPica(file, scaleForDevicePixelRatio(maxWidth || 1280), scaleForDevicePixelRatio(maxHeight || 1080), quality || 1)).then(function (_ref2) {
15968
16116
  var compressedBlob = _ref2.blob;
15969
16117
  var returningUrl = compressedBlob ? URL.createObjectURL(compressedBlob) : '';
15970
16118
  if (compressedBlob) {
@@ -16051,7 +16199,76 @@ var createAttachmentUnavailableError = function createAttachmentUnavailableError
16051
16199
  return error;
16052
16200
  };
16053
16201
 
16054
- var _excluded$1 = ["lastMessage"];
16202
+ var preparations = new Map();
16203
+ var beginVideoPreparation = function beginVideoPreparation(tid, file) {
16204
+ var resolvePreparation;
16205
+ var promise = new Promise(function (resolve) {
16206
+ resolvePreparation = resolve;
16207
+ });
16208
+ preparations.set(tid, {
16209
+ file: file,
16210
+ status: 'loading',
16211
+ promise: promise,
16212
+ resolve: resolvePreparation
16213
+ });
16214
+ };
16215
+ var completeVideoPreparation = function completeVideoPreparation(tid, preparation) {
16216
+ var entry = preparations.get(tid);
16217
+ if (!entry || entry.status !== 'loading') return;
16218
+ var completed = _extends({}, preparation, {
16219
+ status: 'ready'
16220
+ });
16221
+ preparations.set(tid, _extends({}, entry, completed));
16222
+ entry.resolve(completed);
16223
+ };
16224
+ var failVideoPreparation = function failVideoPreparation(tid) {
16225
+ var entry = preparations.get(tid);
16226
+ if (!entry || entry.status !== 'loading') return;
16227
+ var failed = {
16228
+ file: entry.file,
16229
+ status: 'failed'
16230
+ };
16231
+ preparations.set(tid, _extends({}, entry, failed));
16232
+ entry.resolve(failed);
16233
+ };
16234
+ var waitForVideoPreparation = function waitForVideoPreparation(tid, timeoutMs) {
16235
+ try {
16236
+ var _temp2 = function _temp2(_result) {
16237
+ return _exit ? _result : Promise.resolve(new Promise(function (resolve) {
16238
+ var timeout = setTimeout(function () {
16239
+ return resolve({
16240
+ file: entry.file,
16241
+ status: 'failed'
16242
+ });
16243
+ }, timeoutMs);
16244
+ entry.promise.then(function (prepared) {
16245
+ clearTimeout(timeout);
16246
+ resolve(prepared);
16247
+ });
16248
+ }));
16249
+ };
16250
+ var _exit = false;
16251
+ var entry = preparations.get(tid);
16252
+ if (!entry) return Promise.resolve(null);
16253
+ if (entry.status !== 'loading') return Promise.resolve(entry);
16254
+ var _temp = function () {
16255
+ if (timeoutMs === undefined) {
16256
+ return Promise.resolve(entry.promise).then(function (_await$entry$promise) {
16257
+ _exit = true;
16258
+ return _await$entry$promise;
16259
+ });
16260
+ }
16261
+ }();
16262
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
16263
+ } catch (e) {
16264
+ return Promise.reject(e);
16265
+ }
16266
+ };
16267
+ var clearVideoPreparation = function clearVideoPreparation(tid) {
16268
+ preparations["delete"](tid);
16269
+ };
16270
+
16271
+ var _excluded = ["lastMessage"];
16055
16272
  var _marked = /*#__PURE__*/_regenerator().m(setMessageListLoading),
16056
16273
  _marked2 = /*#__PURE__*/_regenerator().m(cancelChannelMessageProcesses),
16057
16274
  _marked3 = /*#__PURE__*/_regenerator().m(getChannelForMessageMutation),
@@ -16120,6 +16337,31 @@ var queuedPrefetchRequests = new Map();
16120
16337
  var prefetchCompletionWaiters = new Map();
16121
16338
  var prefetchCancelVersions = new Map();
16122
16339
  var ACTIVE_CHANNEL_RECONNECT_REFRESH_TIMEOUT_MS = 1500;
16340
+ var applyPreparedVideoAttachments = function applyPreparedVideoAttachments(attachments) {
16341
+ try {
16342
+ return Promise.resolve(Promise.all(attachments.map(function (attachment) {
16343
+ try {
16344
+ if (!attachment.tid) return Promise.resolve();
16345
+ return Promise.resolve(waitForVideoPreparation(attachment.tid)).then(function (prepared) {
16346
+ if ((prepared === null || prepared === void 0 ? void 0 : prepared.status) === 'ready' && prepared.metadata) {
16347
+ attachment.url = prepared.file;
16348
+ attachment.data = prepared.file;
16349
+ attachment.name = prepared.file.name;
16350
+ attachment.size = prepared.file.size;
16351
+ attachment.metadata = prepared.metadata;
16352
+ }
16353
+ clearVideoPreparation(attachment.tid);
16354
+ });
16355
+ } catch (e) {
16356
+ return Promise.reject(e);
16357
+ }
16358
+ }))).then(function () {
16359
+ return attachments;
16360
+ });
16361
+ } catch (e) {
16362
+ return Promise.reject(e);
16363
+ }
16364
+ };
16123
16365
  var activeDisplayedCacheKey = null;
16124
16366
  var updateTabAttachmentCache = function updateTabAttachmentCache(channelId, attachments, messageUser) {
16125
16367
  if (!(attachments !== null && attachments !== void 0 && attachments.length)) return;
@@ -16338,8 +16580,8 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16338
16580
  return Promise.resolve(Promise.all(attachments.map(function (attachment) {
16339
16581
  try {
16340
16582
  var _attachment$url, _attachment$url$type;
16341
- var _temp10 = function _temp10() {
16342
- function _temp0() {
16583
+ var _temp1 = function _temp1() {
16584
+ function _temp9() {
16343
16585
  store.dispatch(updateAttachmentUploadingStateAC(UPLOAD_STATE.SUCCESS, attachment.tid));
16344
16586
  var parsedAttachmentMeta = function () {
16345
16587
  if (!attachment.metadata) return {};
@@ -16358,68 +16600,55 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16358
16600
  }
16359
16601
  return attachmentToSend;
16360
16602
  }
16361
- var _temp9 = function () {
16603
+ var _temp8 = function () {
16362
16604
  if (!attachment.cachedUrl && fileType === 'image') {
16363
16605
  return _catch(function () {
16364
- var _temp2 = function () {
16606
+ var _temp = function () {
16365
16607
  if (blobLocal && blobLocal.type.startsWith('image/')) {
16366
- var _attachment, _attachment2;
16367
16608
  var file = attachment.url instanceof File ? attachment.url : new File([attachment.url], attachment.name || 'image', {
16368
16609
  type: attachment.url.type || blobLocal.type
16369
16610
  });
16370
- var _calculateRenderedIma = calculateRenderedImageWidth(((_attachment = attachment) === null || _attachment === void 0 ? void 0 : _attachment.metadata.szw) || 1280, ((_attachment2 = attachment) === null || _attachment2 === void 0 ? void 0 : _attachment2.metadata.szh) || 1080),
16371
- newWidth = _calculateRenderedIma[0],
16372
- newHeight = _calculateRenderedIma[1];
16373
- return Promise.resolve(resizeImageWithPica(file, newWidth, newHeight, 1)).then(function (_ref) {
16374
- var resizedBlob = _ref.blob;
16375
- var _temp = function () {
16376
- if (resizedBlob) {
16377
- var resizedResponse = new Response(resizedBlob, {
16378
- headers: {
16379
- 'Content-Type': resizedBlob.type || blobLocal.type
16380
- }
16381
- });
16382
- return Promise.resolve(setAttachmentToCache(uriLocal, resizedResponse)).then(function () {
16383
- filePath = URL.createObjectURL(resizedBlob);
16384
- store.dispatch(setUpdateMessageAttachmentAC(uriLocal, filePath));
16385
- message.attachments[0] = _extends({}, message.attachments[0], {
16386
- attachmentUrl: filePath
16387
- });
16388
- setAttachmentToCache(uriLocal + "_original_image_url", new Response(blobLocal, {
16389
- headers: {
16390
- 'Content-Type': blobLocal.type
16391
- }
16392
- }));
16393
- var originalImageUrl = URL.createObjectURL(blobLocal);
16394
- store.dispatch(setUpdateMessageAttachmentAC(uriLocal + "_original_image_url", originalImageUrl));
16395
- });
16611
+ return Promise.resolve(setAttachmentToCache(uriLocal, new Response(file, {
16612
+ headers: {
16613
+ 'Content-Type': file.type
16614
+ }
16615
+ }))).then(function () {
16616
+ filePath = URL.createObjectURL(file);
16617
+ store.dispatch(setUpdateMessageAttachmentAC(uriLocal, filePath));
16618
+ message.attachments[0] = _extends({}, message.attachments[0], {
16619
+ attachmentUrl: filePath
16620
+ });
16621
+ setAttachmentToCache(uriLocal + "_original_image_url", new Response(blobLocal, {
16622
+ headers: {
16623
+ 'Content-Type': blobLocal.type
16396
16624
  }
16397
- }();
16398
- if (_temp && _temp.then) return _temp.then(function () {});
16625
+ }));
16626
+ var originalImageUrl = URL.createObjectURL(blobLocal);
16627
+ store.dispatch(setUpdateMessageAttachmentAC(uriLocal + "_original_image_url", originalImageUrl));
16399
16628
  });
16400
16629
  }
16401
16630
  }();
16402
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
16631
+ if (_temp && _temp.then) return _temp.then(function () {});
16403
16632
  }, function (error) {
16404
16633
  log.error('Error resizing and caching image during upload:', error);
16405
16634
  });
16406
16635
  } else {
16407
- var _temp11 = function () {
16636
+ var _temp10 = function () {
16408
16637
  if (!attachment.cachedUrl && fileType === 'video') {
16409
- var _temp7 = function () {
16638
+ var _temp6 = function () {
16410
16639
  if (blobLocal) {
16411
- var _attachment3, _attachment4;
16412
- var _calculateRenderedIma2 = calculateRenderedImageWidth(((_attachment3 = attachment) === null || _attachment3 === void 0 ? void 0 : _attachment3.metadata.szw) || 1280, ((_attachment4 = attachment) === null || _attachment4 === void 0 ? void 0 : _attachment4.metadata.szh) || 1080),
16413
- newWidth = _calculateRenderedIma2[0],
16414
- newHeight = _calculateRenderedIma2[1];
16640
+ var _attachment, _attachment2;
16641
+ var _calculateRenderedIma = calculateRenderedImageWidth(((_attachment = attachment) === null || _attachment === void 0 ? void 0 : _attachment.metadata.szw) || 1280, ((_attachment2 = attachment) === null || _attachment2 === void 0 ? void 0 : _attachment2.metadata.szh) || 1080),
16642
+ newWidth = _calculateRenderedIma[0],
16643
+ newHeight = _calculateRenderedIma[1];
16415
16644
  return Promise.resolve(getVideoFirstFrame(blobLocal, newWidth, newHeight)).then(function (result) {
16416
- var _temp6 = function () {
16645
+ var _temp5 = function () {
16417
16646
  if (result) {
16418
16647
  var frameBlobUrl = result.frameBlobUrl,
16419
16648
  blob = result.blob;
16420
- var _temp5 = function () {
16649
+ var _temp4 = function () {
16421
16650
  if (frameBlobUrl && blob) {
16422
- var _temp4 = function _temp4() {
16651
+ var _temp3 = function _temp3() {
16423
16652
  return Promise.resolve(setAttachmentToCache(uriLocal, response)).then(function () {
16424
16653
  store.dispatch(setUpdateMessageAttachmentAC(uriLocal, frameBlobUrl));
16425
16654
  message.attachments[0] = _extends({}, message.attachments[0], {
@@ -16432,7 +16661,7 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16432
16661
  'Content-Type': blob.type
16433
16662
  }
16434
16663
  });
16435
- var _temp3 = function () {
16664
+ var _temp2 = function () {
16436
16665
  if (blobLocal) {
16437
16666
  return Promise.resolve(setAttachmentToCache(uriLocal + "_original_video_url", new Response(blobLocal, {
16438
16667
  headers: {
@@ -16444,27 +16673,27 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16444
16673
  });
16445
16674
  }
16446
16675
  }();
16447
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
16676
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
16448
16677
  }
16449
16678
  }();
16450
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
16679
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
16451
16680
  }
16452
16681
  }();
16453
- if (_temp6 && _temp6.then) return _temp6.then(function () {});
16682
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
16454
16683
  });
16455
16684
  }
16456
16685
  }();
16457
- if (_temp7 && _temp7.then) return _temp7.then(function () {});
16686
+ if (_temp6 && _temp6.then) return _temp6.then(function () {});
16458
16687
  }
16459
16688
  }();
16460
- if (_temp11 && _temp11.then) return _temp11.then(function () {});
16689
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
16461
16690
  }
16462
16691
  }();
16463
- return _temp9 && _temp9.then ? _temp9.then(_temp0) : _temp0(_temp9);
16692
+ return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
16464
16693
  };
16465
- var handleUploadProgress = function handleUploadProgress(_ref2) {
16466
- var loaded = _ref2.loaded,
16467
- total = _ref2.total;
16694
+ var handleUploadProgress = function handleUploadProgress(_ref) {
16695
+ var loaded = _ref.loaded,
16696
+ total = _ref.total;
16468
16697
  store.dispatch(updateAttachmentUploadingProgressAC(loaded, total, attachment.tid));
16469
16698
  };
16470
16699
  if (!attachment.cachedUrl && !(attachment.url instanceof Blob)) {
@@ -16489,16 +16718,16 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16489
16718
  }
16490
16719
  };
16491
16720
  var blobLocal = null;
16492
- var _temp1 = function () {
16721
+ var _temp0 = function () {
16493
16722
  if (attachment.cachedUrl) {
16494
16723
  var _attachment$data;
16495
16724
  uriLocal = attachment.cachedUrl;
16496
16725
  var dataSize = ((_attachment$data = attachment.data) === null || _attachment$data === void 0 ? void 0 : _attachment$data.size) || 0;
16497
16726
  store.dispatch(updateAttachmentUploadingProgressAC(dataSize, dataSize, attachment.tid));
16498
16727
  } else {
16499
- return Promise.resolve(customUpload(attachment, handleUploadProgress, message.type, handleUpdateLocalPath)).then(function (_ref3) {
16500
- var uri = _ref3.uri,
16501
- blob = _ref3.blob;
16728
+ return Promise.resolve(customUpload(attachment, handleUploadProgress, message.type, handleUpdateLocalPath)).then(function (_ref2) {
16729
+ var uri = _ref2.uri,
16730
+ blob = _ref2.blob;
16502
16731
  uriLocal = uri;
16503
16732
  blobLocal = blob;
16504
16733
  if (blobLocal) {
@@ -16509,7 +16738,7 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16509
16738
  });
16510
16739
  }
16511
16740
  }();
16512
- return Promise.resolve(_temp1 && _temp1.then ? _temp1.then(_temp10) : _temp10(_temp1));
16741
+ return Promise.resolve(_temp0 && _temp0.then ? _temp0.then(_temp1) : _temp1(_temp0));
16513
16742
  } catch (e) {
16514
16743
  return Promise.reject(e);
16515
16744
  }
@@ -16566,7 +16795,7 @@ var getResolvedChannelUpdateData = function getResolvedChannelUpdateData(channel
16566
16795
  return channelUpdateData;
16567
16796
  }
16568
16797
  var lastMessage = channelUpdateData.lastMessage,
16569
- restChannelUpdateData = _objectWithoutPropertiesLoose(channelUpdateData, _excluded$1);
16798
+ restChannelUpdateData = _objectWithoutPropertiesLoose(channelUpdateData, _excluded);
16570
16799
  var resolvedLastMessage = getResolvedChannelLastMessage(channelId, lastMessage, lastMessage);
16571
16800
  if (!lastMessageNeedsUpdate((_getStoredChannel4 = getStoredChannel(channelId)) === null || _getStoredChannel4 === void 0 ? void 0 : _getStoredChannel4.lastMessage, resolvedLastMessage)) {
16572
16801
  return restChannelUpdateData;
@@ -17020,19 +17249,19 @@ function sendMessage(action) {
17020
17249
  var fileType = (_attachment$data2 = attachment.data) === null || _attachment$data2 === void 0 ? void 0 : (_attachment$data2$typ = _attachment$data2.type) === null || _attachment$data2$typ === void 0 ? void 0 : _attachment$data2$typ.split('/')[0];
17021
17250
  var updateImage = function updateImage() {
17022
17251
  try {
17023
- var _temp18 = function () {
17252
+ var _temp17 = function () {
17024
17253
  if (!attachment.cachedUrl && fileType === 'image' && attachment.data) {
17025
- var _temp13 = _catch(function () {
17254
+ var _temp12 = _catch(function () {
17026
17255
  var parsedMetadata = isJSON(attachment.metadata) ? JSON.parse(attachment.metadata) : attachment.metadata;
17027
- var _calculateRenderedIma3 = calculateRenderedImageWidth((parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szw) || 1280, (parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szh) || 1080),
17028
- newWidth = _calculateRenderedIma3[0],
17029
- newHeight = _calculateRenderedIma3[1];
17256
+ var _calculateRenderedIma2 = calculateRenderedImageWidth((parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szw) || 1280, (parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szh) || 1080),
17257
+ newWidth = _calculateRenderedIma2[0],
17258
+ newHeight = _calculateRenderedIma2[1];
17030
17259
  var file = attachment.data instanceof File ? attachment.data : new File([attachment.data], attachment.name || 'image', {
17031
17260
  type: attachment.data.type
17032
17261
  });
17033
- return Promise.resolve(resizeImageWithPica(file, newWidth, newHeight, 1)).then(function (_ref4) {
17034
- var resizedBlob = _ref4.blob;
17035
- var _temp12 = function () {
17262
+ return Promise.resolve(resizeImageWithPica(file, newWidth, newHeight, 1)).then(function (_ref3) {
17263
+ var resizedBlob = _ref3.blob;
17264
+ var _temp11 = function () {
17036
17265
  if (resizedBlob) {
17037
17266
  return Promise.resolve(setAttachmentToCache(uriLocal, new Response(resizedBlob, {
17038
17267
  headers: {
@@ -17050,22 +17279,22 @@ function sendMessage(action) {
17050
17279
  });
17051
17280
  }
17052
17281
  }();
17053
- if (_temp12 && _temp12.then) return _temp12.then(function () {});
17282
+ if (_temp11 && _temp11.then) return _temp11.then(function () {});
17054
17283
  });
17055
17284
  }, function (err) {
17056
17285
  log.error('Error caching resized image on upload completion:', err);
17057
17286
  });
17058
- if (_temp13 && _temp13.then) return _temp13.then(function () {});
17287
+ if (_temp12 && _temp12.then) return _temp12.then(function () {});
17059
17288
  } else {
17060
- var _temp19 = function () {
17289
+ var _temp18 = function () {
17061
17290
  if (!attachment.cachedUrl && fileType === 'video' && attachment.data) {
17062
- var _temp16 = _catch(function () {
17291
+ var _temp15 = _catch(function () {
17063
17292
  var parsedMetadata = isJSON(attachment.metadata) ? JSON.parse(attachment.metadata) : attachment.metadata;
17064
- var _calculateRenderedIma4 = calculateRenderedImageWidth((parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szw) || 1280, (parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szh) || 1080),
17065
- newWidth = _calculateRenderedIma4[0],
17066
- newHeight = _calculateRenderedIma4[1];
17293
+ var _calculateRenderedIma3 = calculateRenderedImageWidth((parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szw) || 1280, (parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szh) || 1080),
17294
+ newWidth = _calculateRenderedIma3[0],
17295
+ newHeight = _calculateRenderedIma3[1];
17067
17296
  return Promise.resolve(getVideoFirstFrame(attachment.data, newWidth, newHeight)).then(function (result) {
17068
- var _temp15 = function () {
17297
+ var _temp14 = function () {
17069
17298
  if (result) {
17070
17299
  var frameBlobUrl = result.frameBlobUrl,
17071
17300
  blob = result.blob;
@@ -17075,7 +17304,7 @@ function sendMessage(action) {
17075
17304
  }
17076
17305
  }))).then(function () {
17077
17306
  store.dispatch(setUpdateMessageAttachmentAC(uriLocal, frameBlobUrl));
17078
- var _temp14 = function () {
17307
+ var _temp13 = function () {
17079
17308
  if (attachment.data) {
17080
17309
  return Promise.resolve(setAttachmentToCache(uriLocal + '_original_video_url', new Response(attachment.data, {
17081
17310
  headers: {
@@ -17086,22 +17315,22 @@ function sendMessage(action) {
17086
17315
  });
17087
17316
  }
17088
17317
  }();
17089
- if (_temp14 && _temp14.then) return _temp14.then(function () {});
17318
+ if (_temp13 && _temp13.then) return _temp13.then(function () {});
17090
17319
  });
17091
17320
  }
17092
17321
  }();
17093
- if (_temp15 && _temp15.then) return _temp15.then(function () {});
17322
+ if (_temp14 && _temp14.then) return _temp14.then(function () {});
17094
17323
  });
17095
17324
  }, function (err) {
17096
17325
  log.error('Error caching video frame on upload completion:', err);
17097
17326
  });
17098
- if (_temp16 && _temp16.then) return _temp16.then(function () {});
17327
+ if (_temp15 && _temp15.then) return _temp15.then(function () {});
17099
17328
  }
17100
17329
  }();
17101
- if (_temp19 && _temp19.then) return _temp19.then(function () {});
17330
+ if (_temp18 && _temp18.then) return _temp18.then(function () {});
17102
17331
  }
17103
17332
  }();
17104
- return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
17333
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
17105
17334
  } catch (e) {
17106
17335
  return Promise.reject(e);
17107
17336
  }
@@ -17239,7 +17468,7 @@ function sendMessage(action) {
17239
17468
  messagesToSend.push(messageToSend);
17240
17469
  case 12:
17241
17470
  _loop3 = /*#__PURE__*/_regenerator().m(function _callee4() {
17242
- var messageAttachment, messageToSend, pendingState, messageCopy, _getStoredChannel6, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel2, _messageToSend2, isErrorResendable, _messageToSend$attach, _iterator2, _step2, att, _t;
17471
+ var messageAttachment, messageToSend, pendingState, pendingAttachments, messageCopy, _getStoredChannel6, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel2, _messageToSend2, isErrorResendable, _messageToSend$attach, _iterator2, _step2, att, _t;
17243
17472
  return _regenerator().w(function (_context12) {
17244
17473
  while (1) switch (_context12.p = _context12.n) {
17245
17474
  case 0:
@@ -17262,21 +17491,40 @@ function sendMessage(action) {
17262
17491
  messageToSend = _extends({}, messageToSend, pendingState);
17263
17492
  case 2:
17264
17493
  _context12.p = 2;
17494
+ _context12.n = 3;
17495
+ return call(applyPreparedVideoAttachments, messageAttachment);
17496
+ case 3:
17497
+ pendingAttachments = messageAttachment.map(function (attachment) {
17498
+ return _extends({}, attachment, {
17499
+ data: attachment.data || attachment.url
17500
+ });
17501
+ });
17502
+ updateMessageOnMap(channel.id, {
17503
+ messageId: messageToSend.tid,
17504
+ params: {
17505
+ attachments: pendingAttachments
17506
+ }
17507
+ });
17508
+ _context12.n = 4;
17509
+ return put(updateMessageAC(messageToSend.tid, {
17510
+ attachments: pendingAttachments
17511
+ }));
17512
+ case 4:
17265
17513
  messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i2]));
17266
17514
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
17267
- _context12.n = 15;
17515
+ _context12.n = 17;
17268
17516
  break;
17269
17517
  }
17270
17518
  _attachmentsToSend = messageAttachment;
17271
17519
  if (!customUploader) {
17272
- _context12.n = 4;
17520
+ _context12.n = 6;
17273
17521
  break;
17274
17522
  }
17275
- _context12.n = 3;
17523
+ _context12.n = 5;
17276
17524
  return call(handleUploadAttachments, messageAttachment || [], messageCopy, channel);
17277
- case 3:
17525
+ case 5:
17278
17526
  _attachmentsToSend = _context12.v;
17279
- case 4:
17527
+ case 6:
17280
17528
  linkAttachmentToSend = null;
17281
17529
  if (_i2 === 0 && linkAttachment) {
17282
17530
  linkAttachmentBuilder = channel.createAttachmentBuilder(linkAttachment.data, linkAttachment.type);
@@ -17291,40 +17539,40 @@ function sendMessage(action) {
17291
17539
  attachments: [].concat(_attachmentsToSend)
17292
17540
  });
17293
17541
  }
17294
- _context12.n = 5;
17542
+ _context12.n = 7;
17295
17543
  return call(channel.sendMessage, messageToSend);
17296
- case 5:
17544
+ case 7:
17297
17545
  messageResponse = _context12.v;
17298
17546
  if (messageToSend.tid) {
17299
17547
  autoResendAttempts["delete"](messageToSend.tid);
17300
17548
  }
17301
17549
  if (!customUploader) {
17302
- _context12.n = 10;
17550
+ _context12.n = 12;
17303
17551
  break;
17304
17552
  }
17305
17553
  k = 0;
17306
- case 6:
17554
+ case 8:
17307
17555
  if (!(k < messageAttachment.length)) {
17308
- _context12.n = 10;
17556
+ _context12.n = 12;
17309
17557
  break;
17310
17558
  }
17311
17559
  messageResponse.attachments[k] = _extends({}, messageResponse.attachments[k], {
17312
17560
  user: JSON.parse(JSON.stringify(messageResponse.user)),
17313
17561
  tid: messageAttachment[k].tid
17314
17562
  });
17315
- _context12.n = 7;
17563
+ _context12.n = 9;
17316
17564
  return put(removeAttachmentProgressAC(messageAttachment[k].tid));
17317
- case 7:
17318
- _context12.n = 8;
17565
+ case 9:
17566
+ _context12.n = 10;
17319
17567
  return put(removeAttachmentUploadingStateAC(messageAttachment[k].tid));
17320
- case 8:
17568
+ case 10:
17321
17569
  deletePendingAttachment(messageAttachment[k].tid);
17322
17570
  releaseBlobUrls(["compose_" + messageAttachment[k].tid]);
17323
- case 9:
17571
+ case 11:
17324
17572
  k++;
17325
- _context12.n = 6;
17573
+ _context12.n = 8;
17326
17574
  break;
17327
- case 10:
17575
+ case 12:
17328
17576
  attachmentsToUpdate = [];
17329
17577
  if (messageResponse.attachments && messageResponse.attachments.length > 0) {
17330
17578
  currentAttachmentsMap = {};
@@ -17351,25 +17599,25 @@ function sendMessage(action) {
17351
17599
  });
17352
17600
  activeChannelId = getActiveChannelId();
17353
17601
  if (!(activeChannelId === channel.id)) {
17354
- _context12.n = 11;
17602
+ _context12.n = 13;
17355
17603
  break;
17356
17604
  }
17357
- _context12.n = 11;
17605
+ _context12.n = 13;
17358
17606
  return put(updateMessageAC(messageToSend.tid, messageUpdateData, true));
17359
- case 11:
17607
+ case 13:
17360
17608
  messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
17361
17609
  addConfirmedMessageToCache(channel.id, messageToUpdate);
17362
17610
  updateTabAttachmentCache(channel.id, attachmentsToUpdate, messageResponse.user);
17363
17611
  if (!channel.unread) {
17364
- _context12.n = 12;
17612
+ _context12.n = 14;
17365
17613
  break;
17366
17614
  }
17367
- _context12.n = 12;
17615
+ _context12.n = 14;
17368
17616
  return put(markChannelAsReadAC(channel.id));
17369
- case 12:
17617
+ case 14:
17370
17618
  resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
17371
17619
  if (!lastMessageNeedsUpdate((_getStoredChannel6 = getStoredChannel(channel.id)) === null || _getStoredChannel6 === void 0 ? void 0 : _getStoredChannel6.lastMessage, resolvedLastMessage)) {
17372
- _context12.n = 14;
17620
+ _context12.n = 16;
17373
17621
  break;
17374
17622
  }
17375
17623
  updateChannelLastMessageOnAllChannels(channel.id, resolvedLastMessage);
@@ -17377,54 +17625,54 @@ function sendMessage(action) {
17377
17625
  lastMessage: resolvedLastMessage,
17378
17626
  lastReactedMessage: null
17379
17627
  };
17380
- _context12.n = 13;
17628
+ _context12.n = 15;
17381
17629
  return put(updateChannelDataAC(channel.id, channelUpdateParam, true));
17382
- case 13:
17383
- updateChannelOnAllChannels(channel.id, channelUpdateParam);
17384
- case 14:
17385
- _context12.n = 16;
17386
- break;
17387
17630
  case 15:
17388
- throw new Error('Connection required to send message');
17631
+ updateChannelOnAllChannels(channel.id, channelUpdateParam);
17389
17632
  case 16:
17390
- _context12.n = 21;
17633
+ _context12.n = 18;
17391
17634
  break;
17392
17635
  case 17:
17393
- _context12.p = 17;
17636
+ throw new Error('Connection required to send message');
17637
+ case 18:
17638
+ _context12.n = 23;
17639
+ break;
17640
+ case 19:
17641
+ _context12.p = 19;
17394
17642
  _t = _context12.v;
17395
17643
  isErrorResendable = isResendableError(_t === null || _t === void 0 ? void 0 : _t.type);
17396
17644
  if (!((_channel2 = channel) !== null && _channel2 !== void 0 && _channel2.id && (_messageToSend2 = messageToSend) !== null && _messageToSend2 !== void 0 && _messageToSend2.tid)) {
17397
- _context12.n = 21;
17645
+ _context12.n = 23;
17398
17646
  break;
17399
17647
  }
17400
17648
  log.error('Error on uploading attachment', messageToSend.tid, _t);
17401
17649
  if (!((_messageToSend$attach = messageToSend.attachments) !== null && _messageToSend$attach !== void 0 && _messageToSend$attach.length)) {
17402
- _context12.n = 20;
17650
+ _context12.n = 22;
17403
17651
  break;
17404
17652
  }
17405
17653
  _iterator2 = _createForOfIteratorHelperLoose(messageToSend.attachments);
17406
- case 18:
17654
+ case 20:
17407
17655
  if ((_step2 = _iterator2()).done) {
17408
- _context12.n = 20;
17656
+ _context12.n = 22;
17409
17657
  break;
17410
17658
  }
17411
17659
  att = _step2.value;
17412
17660
  if (!att.tid) {
17413
- _context12.n = 19;
17661
+ _context12.n = 21;
17414
17662
  break;
17415
17663
  }
17416
- _context12.n = 19;
17664
+ _context12.n = 21;
17417
17665
  return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, att.tid));
17418
- case 19:
17419
- _context12.n = 18;
17666
+ case 21:
17667
+ _context12.n = 20;
17420
17668
  break;
17421
- case 20:
17422
- _context12.n = 21;
17669
+ case 22:
17670
+ _context12.n = 23;
17423
17671
  return call(syncFailedMessageState, channel, messageToSend.tid, pendingMessages[_i2] || messageToSend, isErrorResendable);
17424
- case 21:
17672
+ case 23:
17425
17673
  return _context12.a(2);
17426
17674
  }
17427
- }, _callee4, null, [[2, 17]]);
17675
+ }, _callee4, null, [[2, 19]]);
17428
17676
  });
17429
17677
  _i2 = 0;
17430
17678
  case 13:
@@ -18367,7 +18615,7 @@ function loadOGMetadataForLinkMessages(messages, getFromServer) {
18367
18615
  getFromServer = true;
18368
18616
  }
18369
18617
  return /*#__PURE__*/_regenerator().m(function _callee6() {
18370
- var i, _message$attachments2, message, isOnlyLinkAttachments, firstAttachment, j, _attachment5, _firstAttachment, _store$getState$Messa, _firstAttachment2, _firstAttachment3, _firstAttachment4, metadata, storedData;
18618
+ var i, _message$attachments2, message, isOnlyLinkAttachments, firstAttachment, j, _attachment3, _firstAttachment, _store$getState$Messa, _firstAttachment2, _firstAttachment3, _firstAttachment4, metadata, storedData;
18371
18619
  return _regenerator().w(function (_context22) {
18372
18620
  while (1) switch (_context22.n) {
18373
18621
  case 0:
@@ -18396,13 +18644,13 @@ function loadOGMetadataForLinkMessages(messages, getFromServer) {
18396
18644
  _context22.n = 6;
18397
18645
  break;
18398
18646
  }
18399
- _attachment5 = message.attachments[j];
18400
- if (!(_attachment5.type === attachmentTypes.link)) {
18647
+ _attachment3 = message.attachments[j];
18648
+ if (!(_attachment3.type === attachmentTypes.link)) {
18401
18649
  _context22.n = 4;
18402
18650
  break;
18403
18651
  }
18404
18652
  if (!firstAttachment) {
18405
- firstAttachment = _attachment5;
18653
+ firstAttachment = _attachment3;
18406
18654
  }
18407
18655
  _context22.n = 5;
18408
18656
  break;
@@ -22769,7 +23017,7 @@ var UploadAvatarButton = styled.button(_templateObject23 || (_templateObject23 =
22769
23017
  var UploadAvatarHandler = styled.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
22770
23018
  return props.color;
22771
23019
  });
22772
- var StyledText = styled.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
23020
+ var StyledText = styled.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n display: inline;\n user-select: text;\n -webkit-user-select: text;\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
22773
23021
  return props.fontWeight || props.isLastMessage && '500';
22774
23022
  }, function (props) {
22775
23023
  return props.fontFamily;
@@ -22958,6 +23206,10 @@ var PendingIconWrapper = styled(SvgPendingIcon)(_templateObject5$1 || (_template
22958
23206
  }, function (props) {
22959
23207
  return props.color;
22960
23208
  });
23209
+ var canActivateMention = function canActivateMention() {
23210
+ var selection = typeof window !== 'undefined' ? window.getSelection() : null;
23211
+ return !selection || selection.isCollapsed;
23212
+ };
22961
23213
  var MessageStatusIcon = function MessageStatusIcon(_ref) {
22962
23214
  var messageStatus = _ref.messageStatus,
22963
23215
  messageStatusDisplayingType = _ref.messageStatusDisplayingType,
@@ -23173,7 +23425,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23173
23425
  key: attributeOffset + index,
23174
23426
  "data-mention": attribute.metadata,
23175
23427
  onClick: function onClick() {
23176
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23428
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23177
23429
  onMentionNameClick(mentionDisplay);
23178
23430
  }
23179
23431
  }
@@ -23187,7 +23439,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23187
23439
  key: attributeOffset,
23188
23440
  "data-mention": attribute.metadata,
23189
23441
  onClick: function onClick() {
23190
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23442
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23191
23443
  onMentionNameClick(mentionDisplay);
23192
23444
  }
23193
23445
  },
@@ -25403,81 +25655,52 @@ function watchForEvents() {
25403
25655
  }, _marked0$1);
25404
25656
  }
25405
25657
 
25406
- var READ_MESSAGE_LOG_KEY_ALIASES = {
25407
- source: 's',
25408
- channelId: 'ch',
25409
- readAll: 'ra',
25410
- messageIds: 'mi',
25411
- messageId: 'm',
25412
- connectionStatus: 'cs',
25413
- attempts: 'at',
25414
- retryDelayMs: 'rd',
25415
- requestedMessageIds: 'rq',
25416
- confirmedMessageIds: 'cf',
25417
- isVisible: 'iv',
25418
- alreadyRead: 'ar',
25419
- disableAutoReadTracking: 'da',
25420
- isTabActive: 'ta',
25421
- newMessageCount: 'nm',
25422
- queued: 'q',
25423
- localRef: 'lr',
25424
- visibleCandidateIds: 'vc',
25425
- unreadScrollTo: 'us',
25426
- pendingFrameScheduled: 'pf'
25427
- };
25428
- var compactReadMessageLogData = function compactReadMessageLogData(data) {
25429
- return JSON.stringify(Object.fromEntries(Object.entries(data).map(function (_ref) {
25430
- var key = _ref[0],
25431
- value = _ref[1];
25432
- return [READ_MESSAGE_LOG_KEY_ALIASES[key] || key.slice(0, 2), value];
25433
- })));
25434
- };
25435
-
25436
25658
  var _marked$3 = /*#__PURE__*/_regenerator().m(applyChannelReadProgress),
25437
- _marked2$3 = /*#__PURE__*/_regenerator().m(createChannel),
25438
- _marked3$2 = /*#__PURE__*/_regenerator().m(getChannels),
25439
- _marked4$2 = /*#__PURE__*/_regenerator().m(searchChannels),
25440
- _marked5$2 = /*#__PURE__*/_regenerator().m(getChannelsForForward),
25441
- _marked6$2 = /*#__PURE__*/_regenerator().m(searchChannelsForForward),
25442
- _marked7$2 = /*#__PURE__*/_regenerator().m(channelsLoadMore),
25443
- _marked8$2 = /*#__PURE__*/_regenerator().m(getChannelMentions),
25444
- _marked9$2 = /*#__PURE__*/_regenerator().m(channelsForForwardLoadMore),
25445
- _marked0$2 = /*#__PURE__*/_regenerator().m(markMessagesRead),
25446
- _marked1$1 = /*#__PURE__*/_regenerator().m(markVoiceMessageAsPlayed),
25447
- _marked10$1 = /*#__PURE__*/_regenerator().m(updateMessageAsOpened),
25448
- _marked11$1 = /*#__PURE__*/_regenerator().m(markMessageAsOpened),
25449
- _marked12$1 = /*#__PURE__*/_regenerator().m(markMessagesDelivered),
25450
- _marked13$1 = /*#__PURE__*/_regenerator().m(switchChannel),
25451
- _marked14$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOff),
25452
- _marked15$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOn),
25453
- _marked16$1 = /*#__PURE__*/_regenerator().m(markChannelAsRead),
25454
- _marked17$1 = /*#__PURE__*/_regenerator().m(resendPendingChannelReads),
25455
- _marked18$1 = /*#__PURE__*/_regenerator().m(markChannelAsUnRead),
25456
- _marked19$1 = /*#__PURE__*/_regenerator().m(pinChannel),
25457
- _marked20$1 = /*#__PURE__*/_regenerator().m(unpinChannel),
25458
- _marked21$1 = /*#__PURE__*/_regenerator().m(removeChannelCaches),
25459
- _marked22$1 = /*#__PURE__*/_regenerator().m(leaveChannel),
25460
- _marked23$1 = /*#__PURE__*/_regenerator().m(deletePendingDeleteChannels),
25461
- _marked24$1 = /*#__PURE__*/_regenerator().m(deleteChannel),
25462
- _marked25$1 = /*#__PURE__*/_regenerator().m(blockChannel),
25463
- _marked26$1 = /*#__PURE__*/_regenerator().m(updateChannel),
25464
- _marked27$1 = /*#__PURE__*/_regenerator().m(checkUsersStatus),
25465
- _marked28$1 = /*#__PURE__*/_regenerator().m(sendTyping),
25466
- _marked29$1 = /*#__PURE__*/_regenerator().m(sendRecording),
25467
- _marked30$1 = /*#__PURE__*/_regenerator().m(clearHistory),
25468
- _marked31$1 = /*#__PURE__*/_regenerator().m(deleteAllMessages),
25469
- _marked32$1 = /*#__PURE__*/_regenerator().m(joinChannel),
25470
- _marked33$1 = /*#__PURE__*/_regenerator().m(watchForChannelEvents),
25471
- _marked34$1 = /*#__PURE__*/_regenerator().m(createChannelInviteKey),
25472
- _marked35$1 = /*#__PURE__*/_regenerator().m(getChannelInviteKeys),
25473
- _marked36$1 = /*#__PURE__*/_regenerator().m(regenerateChannelInviteKey),
25474
- _marked37$1 = /*#__PURE__*/_regenerator().m(updateChannelInviteKey),
25475
- _marked38$1 = /*#__PURE__*/_regenerator().m(getChannelByInviteKey),
25476
- _marked39$1 = /*#__PURE__*/_regenerator().m(joinChannelWithInviteKey),
25477
- _marked40$1 = /*#__PURE__*/_regenerator().m(setMessageRetentionPeriod),
25478
- _marked41$1 = /*#__PURE__*/_regenerator().m(getChannelsWithUser),
25479
- _marked42$1 = /*#__PURE__*/_regenerator().m(loadMoreMutualChannels),
25480
- _marked43$1 = /*#__PURE__*/_regenerator().m(ChannelsSaga);
25659
+ _marked2$3 = /*#__PURE__*/_regenerator().m(confirmDisplayedRead),
25660
+ _marked3$2 = /*#__PURE__*/_regenerator().m(createChannel),
25661
+ _marked4$2 = /*#__PURE__*/_regenerator().m(getChannels),
25662
+ _marked5$2 = /*#__PURE__*/_regenerator().m(searchChannels),
25663
+ _marked6$2 = /*#__PURE__*/_regenerator().m(getChannelsForForward),
25664
+ _marked7$2 = /*#__PURE__*/_regenerator().m(searchChannelsForForward),
25665
+ _marked8$2 = /*#__PURE__*/_regenerator().m(channelsLoadMore),
25666
+ _marked9$2 = /*#__PURE__*/_regenerator().m(getChannelMentions),
25667
+ _marked0$2 = /*#__PURE__*/_regenerator().m(channelsForForwardLoadMore),
25668
+ _marked1$1 = /*#__PURE__*/_regenerator().m(markMessagesRead),
25669
+ _marked10$1 = /*#__PURE__*/_regenerator().m(markVoiceMessageAsPlayed),
25670
+ _marked11$1 = /*#__PURE__*/_regenerator().m(updateMessageAsOpened),
25671
+ _marked12$1 = /*#__PURE__*/_regenerator().m(markMessageAsOpened),
25672
+ _marked13$1 = /*#__PURE__*/_regenerator().m(markMessagesDelivered),
25673
+ _marked14$1 = /*#__PURE__*/_regenerator().m(switchChannel),
25674
+ _marked15$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOff),
25675
+ _marked16$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOn),
25676
+ _marked17$1 = /*#__PURE__*/_regenerator().m(markChannelAsRead),
25677
+ _marked18$1 = /*#__PURE__*/_regenerator().m(resendPendingChannelReads),
25678
+ _marked19$1 = /*#__PURE__*/_regenerator().m(markChannelAsUnRead),
25679
+ _marked20$1 = /*#__PURE__*/_regenerator().m(pinChannel),
25680
+ _marked21$1 = /*#__PURE__*/_regenerator().m(unpinChannel),
25681
+ _marked22$1 = /*#__PURE__*/_regenerator().m(removeChannelCaches),
25682
+ _marked23$1 = /*#__PURE__*/_regenerator().m(leaveChannel),
25683
+ _marked24$1 = /*#__PURE__*/_regenerator().m(deletePendingDeleteChannels),
25684
+ _marked25$1 = /*#__PURE__*/_regenerator().m(deleteChannel),
25685
+ _marked26$1 = /*#__PURE__*/_regenerator().m(blockChannel),
25686
+ _marked27$1 = /*#__PURE__*/_regenerator().m(updateChannel),
25687
+ _marked28$1 = /*#__PURE__*/_regenerator().m(checkUsersStatus),
25688
+ _marked29$1 = /*#__PURE__*/_regenerator().m(sendTyping),
25689
+ _marked30$1 = /*#__PURE__*/_regenerator().m(sendRecording),
25690
+ _marked31$1 = /*#__PURE__*/_regenerator().m(clearHistory),
25691
+ _marked32$1 = /*#__PURE__*/_regenerator().m(deleteAllMessages),
25692
+ _marked33$1 = /*#__PURE__*/_regenerator().m(joinChannel),
25693
+ _marked34$1 = /*#__PURE__*/_regenerator().m(watchForChannelEvents),
25694
+ _marked35$1 = /*#__PURE__*/_regenerator().m(createChannelInviteKey),
25695
+ _marked36$1 = /*#__PURE__*/_regenerator().m(getChannelInviteKeys),
25696
+ _marked37$1 = /*#__PURE__*/_regenerator().m(regenerateChannelInviteKey),
25697
+ _marked38$1 = /*#__PURE__*/_regenerator().m(updateChannelInviteKey),
25698
+ _marked39$1 = /*#__PURE__*/_regenerator().m(getChannelByInviteKey),
25699
+ _marked40$1 = /*#__PURE__*/_regenerator().m(joinChannelWithInviteKey),
25700
+ _marked41$1 = /*#__PURE__*/_regenerator().m(setMessageRetentionPeriod),
25701
+ _marked42$1 = /*#__PURE__*/_regenerator().m(getChannelsWithUser),
25702
+ _marked43$1 = /*#__PURE__*/_regenerator().m(loadMoreMutualChannels),
25703
+ _marked44$1 = /*#__PURE__*/_regenerator().m(ChannelsSaga);
25481
25704
  var getUniqueMessageIds = function getUniqueMessageIds(messageIds) {
25482
25705
  if (messageIds === void 0) {
25483
25706
  messageIds = [];
@@ -25579,104 +25802,80 @@ function applyChannelReadProgress(channelId, updateData) {
25579
25802
  var shouldKeepQueuedPendingRead = function shouldKeepQueuedPendingRead(error) {
25580
25803
  return isResendableError(error === null || error === void 0 ? void 0 : error.type);
25581
25804
  };
25582
- var getReadMarkerLogContext = function getReadMarkerLogContext(pendingRead, source, messageIds) {
25583
- return {
25584
- source: source,
25585
- channelId: pendingRead.channelId,
25586
- readAll: pendingRead.readAll,
25587
- messageIds: messageIds
25588
- };
25589
- };
25590
- function confirmDisplayedRead(channel, pendingRead, source) {
25591
- if (source === void 0) {
25592
- source = 'initial';
25593
- }
25594
- return /*#__PURE__*/_regenerator().m(function _callee() {
25595
- var messageIds, logContext, attempt, connectionStatus, messageListMarker, _t;
25596
- return _regenerator().w(function (_context2) {
25597
- while (1) switch (_context2.p = _context2.n) {
25598
- case 0:
25599
- messageIds = getUniqueMessageIds(pendingRead.messageIds);
25600
- logContext = getReadMarkerLogContext(pendingRead, source, messageIds);
25601
- attempt = 0;
25602
- case 1:
25603
- if (!(attempt <= READ_MARKER_RETRY_DELAYS_MS.length)) {
25604
- _context2.n = 10;
25605
- break;
25606
- }
25607
- connectionStatus = store.getState().UserReducer.connectionStatus;
25608
- if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
25609
- _context2.n = 2;
25610
- break;
25611
- }
25612
- log.warn('[READ_MESSAGE] Queued read marker because connection is not ready', compactReadMessageLogData(_extends({}, logContext, {
25613
- connectionStatus: connectionStatus
25614
- })));
25615
- return _context2.a(2, {
25616
- status: 'queued'
25617
- });
25618
- case 2:
25619
- _context2.p = 2;
25620
- if (!pendingRead.readAll) {
25621
- _context2.n = 4;
25622
- break;
25623
- }
25624
- _context2.n = 3;
25625
- return call(channel.markAsRead);
25626
- case 3:
25627
- return _context2.a(2, {
25628
- status: 'success'
25629
- });
25630
- case 4:
25631
- _context2.n = 5;
25632
- return call(channel.markMessagesAsDisplayed, messageIds);
25633
- case 5:
25634
- messageListMarker = _context2.v;
25635
- return _context2.a(2, {
25636
- status: 'success',
25637
- messageListMarker: messageListMarker
25638
- });
25639
- case 6:
25640
- _context2.p = 6;
25641
- _t = _context2.v;
25642
- if (shouldKeepQueuedPendingRead(_t)) {
25643
- _context2.n = 7;
25644
- break;
25645
- }
25646
- log.error(_t, '[READ_MESSAGE] Dropping read marker after non-resendable error', compactReadMessageLogData(logContext));
25647
- return _context2.a(2, {
25648
- status: 'drop',
25649
- error: _t
25650
- });
25651
- case 7:
25652
- if (!(attempt === READ_MARKER_RETRY_DELAYS_MS.length)) {
25653
- _context2.n = 8;
25654
- break;
25655
- }
25656
- log.error(_t, '[READ_MESSAGE] Exhausted read marker retries; keeping queued for replay', compactReadMessageLogData(_extends({}, logContext, {
25657
- attempts: attempt + 1
25658
- })));
25659
- return _context2.a(2, {
25660
- status: 'queued',
25661
- error: _t
25662
- });
25663
- case 8:
25664
- log.warn(_t, "[READ_MESSAGE] Retrying read marker (" + (attempt + 1) + "/" + READ_MARKER_RETRY_DELAYS_MS.length + ")", compactReadMessageLogData(_extends({}, logContext, {
25665
- retryDelayMs: READ_MARKER_RETRY_DELAYS_MS[attempt]
25666
- })));
25667
- _context2.n = 9;
25668
- return call(waitForReadMarkerRetry, READ_MARKER_RETRY_DELAYS_MS[attempt]);
25669
- case 9:
25670
- attempt++;
25671
- _context2.n = 1;
25805
+ function confirmDisplayedRead(channel, pendingRead) {
25806
+ var messageIds, attempt, connectionStatus, messageListMarker, _t;
25807
+ return _regenerator().w(function (_context2) {
25808
+ while (1) switch (_context2.p = _context2.n) {
25809
+ case 0:
25810
+ messageIds = getUniqueMessageIds(pendingRead.messageIds);
25811
+ attempt = 0;
25812
+ case 1:
25813
+ if (!(attempt <= READ_MARKER_RETRY_DELAYS_MS.length)) {
25814
+ _context2.n = 10;
25672
25815
  break;
25673
- case 10:
25674
- return _context2.a(2, {
25675
- status: 'queued'
25676
- });
25677
- }
25678
- }, _callee, null, [[2, 6]]);
25679
- })();
25816
+ }
25817
+ connectionStatus = store.getState().UserReducer.connectionStatus;
25818
+ if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
25819
+ _context2.n = 2;
25820
+ break;
25821
+ }
25822
+ return _context2.a(2, {
25823
+ status: 'queued'
25824
+ });
25825
+ case 2:
25826
+ _context2.p = 2;
25827
+ if (!pendingRead.readAll) {
25828
+ _context2.n = 4;
25829
+ break;
25830
+ }
25831
+ _context2.n = 3;
25832
+ return call(channel.markAsRead);
25833
+ case 3:
25834
+ return _context2.a(2, {
25835
+ status: 'success'
25836
+ });
25837
+ case 4:
25838
+ _context2.n = 5;
25839
+ return call(channel.markMessagesAsDisplayed, messageIds);
25840
+ case 5:
25841
+ messageListMarker = _context2.v;
25842
+ return _context2.a(2, {
25843
+ status: 'success',
25844
+ messageListMarker: messageListMarker
25845
+ });
25846
+ case 6:
25847
+ _context2.p = 6;
25848
+ _t = _context2.v;
25849
+ if (shouldKeepQueuedPendingRead(_t)) {
25850
+ _context2.n = 7;
25851
+ break;
25852
+ }
25853
+ return _context2.a(2, {
25854
+ status: 'drop',
25855
+ error: _t
25856
+ });
25857
+ case 7:
25858
+ if (!(attempt === READ_MARKER_RETRY_DELAYS_MS.length)) {
25859
+ _context2.n = 8;
25860
+ break;
25861
+ }
25862
+ return _context2.a(2, {
25863
+ status: 'queued',
25864
+ error: _t
25865
+ });
25866
+ case 8:
25867
+ _context2.n = 9;
25868
+ return call(waitForReadMarkerRetry, READ_MARKER_RETRY_DELAYS_MS[attempt]);
25869
+ case 9:
25870
+ attempt++;
25871
+ _context2.n = 1;
25872
+ break;
25873
+ case 10:
25874
+ return _context2.a(2, {
25875
+ status: 'queued'
25876
+ });
25877
+ }
25878
+ }, _marked2$3, null, [[2, 6]]);
25680
25879
  }
25681
25880
  function createChannel(action) {
25682
25881
  var payload, channelData, dontCreateIfNotExists, callback, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, whoDoesNotAdded, checkChannelExist, messageToSend, _allChannels, _memberId, _t2;
@@ -25874,7 +26073,7 @@ function createChannel(action) {
25874
26073
  case 19:
25875
26074
  return _context3.a(2);
25876
26075
  }
25877
- }, _marked2$3, null, [[0, 18]]);
26076
+ }, _marked3$2, null, [[0, 18]]);
25878
26077
  }
25879
26078
  function getChannels(action) {
25880
26079
  var _params$filter, _types, _activeChannel, _mappedChannels, _mappedChannels3, _mappedChannels4, payload, params, SceytChatClient, connectionStatus, channelQueryBuilder, channelTypesFilter, types, limit, channelQuery, channelsData, channelList, channelId, activeChannel, pendingLastMessages, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, _loop, _i, _Object$keys, _Object$keys2, _Object$keys3, _mappedChannels2, channelMessageMap, _iterator, _step, _lastMsg$userMarkers, ch, lastMsg, _activeChannel2, _activeChannel3, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, totalAllChannelsAdded, i, _connectionStatus, allChannelsData, allChannelList, _t3, _t4, _t5;
@@ -25972,7 +26171,7 @@ function getChannels(action) {
25972
26171
  _yield$call = _context5.v;
25973
26172
  mappedChannels = _yield$call.channels;
25974
26173
  channelsForUpdateLastReactionMessage = _yield$call.channelsForUpdateLastReactionMessage;
25975
- _loop = /*#__PURE__*/_regenerator().m(function _callee2() {
26174
+ _loop = /*#__PURE__*/_regenerator().m(function _callee() {
25976
26175
  var _store$getState$Chann;
25977
26176
  var channelId, pendingLastMessage, currentReduxLastMessage, resolvedLastMessage, mappedChannel, mapEntry;
25978
26177
  return _regenerator().w(function (_context4) {
@@ -25999,7 +26198,7 @@ function getChannels(action) {
25999
26198
  case 1:
26000
26199
  return _context4.a(2);
26001
26200
  }
26002
- }, _callee2);
26201
+ }, _callee);
26003
26202
  });
26004
26203
  _i = 0, _Object$keys = Object.keys(pendingLastMessages);
26005
26204
  case 14:
@@ -26193,7 +26392,7 @@ function getChannels(action) {
26193
26392
  case 38:
26194
26393
  return _context5.a(2);
26195
26394
  }
26196
- }, _marked3$2, null, [[27, 30], [1, 37]]);
26395
+ }, _marked4$2, null, [[27, 30], [1, 37]]);
26197
26396
  }
26198
26397
  function searchChannels(action) {
26199
26398
  var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, handleChannels, channelsMap, _iterator2, _step2, channel, channelQuery, channelsData, _iterator3, _step3, _channel, channelsToAdd, _t6;
@@ -26326,7 +26525,7 @@ function searchChannels(action) {
26326
26525
  case 8:
26327
26526
  return _context6.a(2);
26328
26527
  }
26329
- }, _marked4$2, null, [[0, 7]]);
26528
+ }, _marked5$2, null, [[0, 7]]);
26330
26529
  }
26331
26530
  function getChannelsForForward() {
26332
26531
  var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t7;
@@ -26384,7 +26583,7 @@ function getChannelsForForward() {
26384
26583
  case 9:
26385
26584
  return _context7.a(2);
26386
26585
  }
26387
- }, _marked5$2, null, [[0, 8]]);
26586
+ }, _marked6$2, null, [[0, 8]]);
26388
26587
  }
26389
26588
  function searchChannelsForForward(action) {
26390
26589
  var payload, params, _contactsMap, _SceytChatClient2, _getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, _publicChannels, _chatsGroups, contactsList, _contactsWithChannelsMap, _lowerCaseSearchBy, handleChannels, channelsMap, _iterator4, _step4, channel, channelQuery, channelsData, _iterator5, _step5, _channel2, channelsToAdd, _t8;
@@ -26516,7 +26715,7 @@ function searchChannelsForForward(action) {
26516
26715
  case 8:
26517
26716
  return _context8.a(2);
26518
26717
  }
26519
- }, _marked6$2, null, [[0, 7]]);
26718
+ }, _marked7$2, null, [[0, 7]]);
26520
26719
  }
26521
26720
  function channelsLoadMore(action) {
26522
26721
  var _mappedChannels5, _mappedChannels7, _mappedChannels8, payload, limit, channelQuery, channelsData, channelList, _yield$call3, mappedChannels, channelsForUpdateLastReactionMessage, _Object$keys4, _mappedChannels6, channelMessageMap, _t9;
@@ -26637,7 +26836,7 @@ function channelsLoadMore(action) {
26637
26836
  case 13:
26638
26837
  return _context9.a(2);
26639
26838
  }
26640
- }, _marked7$2, null, [[1, 12]]);
26839
+ }, _marked8$2, null, [[1, 12]]);
26641
26840
  }
26642
26841
  function getChannelMentions(action) {
26643
26842
  var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t0;
@@ -26674,7 +26873,7 @@ function getChannelMentions(action) {
26674
26873
  case 5:
26675
26874
  return _context0.a(2);
26676
26875
  }
26677
- }, _marked8$2, null, [[0, 4]]);
26876
+ }, _marked9$2, null, [[0, 4]]);
26678
26877
  }
26679
26878
  function channelsForForwardLoadMore(action) {
26680
26879
  var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t1;
@@ -26725,10 +26924,10 @@ function channelsForForwardLoadMore(action) {
26725
26924
  case 8:
26726
26925
  return _context1.a(2);
26727
26926
  }
26728
- }, _marked9$2, null, [[0, 7]]);
26927
+ }, _marked0$2, null, [[0, 7]]);
26729
26928
  }
26730
26929
  function markMessagesRead(action) {
26731
- var payload, channelId, messageIds, requestedMessageIds, _confirmation$message, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead, readMessageIds, _iterator6, _step6, _confirmation$message2, _confirmation$message3, messageId, updateParams, _t10;
26930
+ var payload, channelId, messageIds, requestedMessageIds, _confirmation$message, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead, readMessageIds, _iterator6, _step6, _confirmation$message2, _confirmation$message3, messageId, updateParams;
26732
26931
  return _regenerator().w(function (_context10) {
26733
26932
  while (1) switch (_context10.p = _context10.n) {
26734
26933
  case 0:
@@ -26739,21 +26938,9 @@ function markMessagesRead(action) {
26739
26938
  _context10.n = 1;
26740
26939
  break;
26741
26940
  }
26742
- log.warn('[READ_MESSAGE] Skipping read marker because message id list is empty', compactReadMessageLogData({
26743
- source: 'initial',
26744
- channelId: channelId,
26745
- readAll: false,
26746
- messageIds: messageIds
26747
- }));
26748
26941
  return _context10.a(2);
26749
26942
  case 1:
26750
26943
  _context10.p = 1;
26751
- log.info('[READ_MESSAGE] Received markMessagesRead action', compactReadMessageLogData({
26752
- source: 'initial',
26753
- channelId: channelId,
26754
- readAll: false,
26755
- messageIds: requestedMessageIds
26756
- }));
26757
26944
  _context10.n = 2;
26758
26945
  return call(getStoredChannel$2, channelId);
26759
26946
  case 2:
@@ -26762,10 +26949,6 @@ function markMessagesRead(action) {
26762
26949
  _context10.n = 3;
26763
26950
  break;
26764
26951
  }
26765
- log.warn('[READ_MESSAGE] Cannot mark messages as read because channel was not found', compactReadMessageLogData({
26766
- channelId: channelId,
26767
- messageIds: requestedMessageIds
26768
- }));
26769
26952
  return _context10.a(2);
26770
26953
  case 3:
26771
26954
  optimisticUpdate = deriveChannelReadProgressUpdate({
@@ -26780,7 +26963,7 @@ function markMessagesRead(action) {
26780
26963
  messageIds: requestedMessageIds
26781
26964
  });
26782
26965
  _context10.n = 5;
26783
- return call(confirmDisplayedRead, channel, pendingRead, 'initial');
26966
+ return call(confirmDisplayedRead, channel, pendingRead);
26784
26967
  case 5:
26785
26968
  confirmation = _context10.v;
26786
26969
  if (!(confirmation.status === 'success')) {
@@ -26807,13 +26990,6 @@ function markMessagesRead(action) {
26807
26990
  return _context10.a(2);
26808
26991
  case 8:
26809
26992
  readMessageIds = getUniqueMessageIds(((_confirmation$message = confirmation.messageListMarker) === null || _confirmation$message === void 0 ? void 0 : _confirmation$message.messageIds) || requestedMessageIds);
26810
- log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
26811
- source: 'initial',
26812
- channelId: channel.id,
26813
- readAll: false,
26814
- requestedMessageIds: requestedMessageIds,
26815
- confirmedMessageIds: readMessageIds
26816
- }));
26817
26993
  _iterator6 = _createForOfIteratorHelperLoose(readMessageIds);
26818
26994
  case 9:
26819
26995
  if ((_step6 = _iterator6()).done) {
@@ -26845,12 +27021,10 @@ function markMessagesRead(action) {
26845
27021
  break;
26846
27022
  case 13:
26847
27023
  _context10.p = 13;
26848
- _t10 = _context10.v;
26849
- log.error(_t10, '[READ_MESSAGE] Error on mark messages read');
26850
27024
  case 14:
26851
27025
  return _context10.a(2);
26852
27026
  }
26853
- }, _marked0$2, null, [[1, 13]]);
27027
+ }, _marked1$1, null, [[1, 13]]);
26854
27028
  }
26855
27029
  function markVoiceMessageAsPlayed(action) {
26856
27030
  var payload, channelId, messageIds, connectionStatus, channel, messageListMarker, _iterator7, _step7, messageId, updateParams, _t11;
@@ -26921,7 +27095,7 @@ function markVoiceMessageAsPlayed(action) {
26921
27095
  case 9:
26922
27096
  return _context11.a(2);
26923
27097
  }
26924
- }, _marked1$1, null, [[1, 8]]);
27098
+ }, _marked10$1, null, [[1, 8]]);
26925
27099
  }
26926
27100
  function updateMessageAsOpened(action) {
26927
27101
  var payload, channelId, messageListMarker, connectionStatus, channel, _iterator8, _step8, messageId, updateParams;
@@ -26980,7 +27154,7 @@ function updateMessageAsOpened(action) {
26980
27154
  case 6:
26981
27155
  return _context12.a(2);
26982
27156
  }
26983
- }, _marked10$1);
27157
+ }, _marked11$1);
26984
27158
  }
26985
27159
  function markMessageAsOpened(action) {
26986
27160
  var payload, channelId, messageIds, shouldUpdateMessage, connectionStatus, channel, messageListMarker, _t12;
@@ -27031,7 +27205,7 @@ function markMessageAsOpened(action) {
27031
27205
  case 6:
27032
27206
  return _context13.a(2);
27033
27207
  }
27034
- }, _marked11$1, null, [[1, 5]]);
27208
+ }, _marked12$1, null, [[1, 5]]);
27035
27209
  }
27036
27210
  function markMessagesDelivered(action) {
27037
27211
  var payload, channelId, messageIds, connectionStatus, channel, messageListMarker, _iterator9, _step9, messageId, updateParams, _t13;
@@ -27102,7 +27276,7 @@ function markMessagesDelivered(action) {
27102
27276
  case 9:
27103
27277
  return _context14.a(2);
27104
27278
  }
27105
- }, _marked12$1, null, [[1, 8]]);
27279
+ }, _marked13$1, null, [[1, 8]]);
27106
27280
  }
27107
27281
  function switchChannel(action) {
27108
27282
  var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t14;
@@ -27198,7 +27372,7 @@ function switchChannel(action) {
27198
27372
  case 17:
27199
27373
  return _context15.a(2);
27200
27374
  }
27201
- }, _marked13$1, null, [[0, 16]]);
27375
+ }, _marked14$1, null, [[0, 16]]);
27202
27376
  }
27203
27377
  function notificationsTurnOff(action) {
27204
27378
  var expireTime, activeChannelId, channel, updatedChannel, _t15;
@@ -27238,7 +27412,7 @@ function notificationsTurnOff(action) {
27238
27412
  case 7:
27239
27413
  return _context16.a(2);
27240
27414
  }
27241
- }, _marked14$1, null, [[3, 6]]);
27415
+ }, _marked15$1, null, [[3, 6]]);
27242
27416
  }
27243
27417
  function notificationsTurnOn() {
27244
27418
  var activeChannelId, channel, updatedChannel, _t16;
@@ -27277,21 +27451,15 @@ function notificationsTurnOn() {
27277
27451
  case 7:
27278
27452
  return _context17.a(2);
27279
27453
  }
27280
- }, _marked15$1, null, [[3, 6]]);
27454
+ }, _marked16$1, null, [[3, 6]]);
27281
27455
  }
27282
27456
  function markChannelAsRead(action) {
27283
- var channelId, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead2, _t17;
27457
+ var channelId, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead2;
27284
27458
  return _regenerator().w(function (_context18) {
27285
27459
  while (1) switch (_context18.p = _context18.n) {
27286
27460
  case 0:
27287
27461
  _context18.p = 0;
27288
27462
  channelId = action.payload.channelId;
27289
- log.info('[READ_MESSAGE] Received markChannelAsRead action', compactReadMessageLogData({
27290
- source: 'initial',
27291
- channelId: channelId,
27292
- readAll: true,
27293
- messageIds: []
27294
- }));
27295
27463
  _context18.n = 1;
27296
27464
  return call(getStoredChannel$2, channelId);
27297
27465
  case 1:
@@ -27300,9 +27468,6 @@ function markChannelAsRead(action) {
27300
27468
  _context18.n = 2;
27301
27469
  break;
27302
27470
  }
27303
- log.warn('[READ_MESSAGE] Cannot mark channel as read because channel was not found', compactReadMessageLogData({
27304
- channelId: channelId
27305
- }));
27306
27471
  return _context18.a(2);
27307
27472
  case 2:
27308
27473
  optimisticUpdate = deriveChannelReadProgressUpdate({
@@ -27317,7 +27482,7 @@ function markChannelAsRead(action) {
27317
27482
  readAll: true
27318
27483
  });
27319
27484
  _context18.n = 4;
27320
- return call(confirmDisplayedRead, channel, pendingRead, 'initial');
27485
+ return call(confirmDisplayedRead, channel, pendingRead);
27321
27486
  case 4:
27322
27487
  confirmation = _context18.v;
27323
27488
  if (!(confirmation.status === 'success')) {
@@ -27328,13 +27493,6 @@ function markChannelAsRead(action) {
27328
27493
  if ((queuedPendingRead === null || queuedPendingRead === void 0 ? void 0 : queuedPendingRead.queuedAt) === (pendingRead === null || pendingRead === void 0 ? void 0 : pendingRead.queuedAt)) {
27329
27494
  removePendingChannelRead(channel.id);
27330
27495
  }
27331
- log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
27332
- source: 'initial',
27333
- channelId: channel.id,
27334
- readAll: true,
27335
- requestedMessageIds: [],
27336
- confirmedMessageIds: []
27337
- }));
27338
27496
  return _context18.a(2);
27339
27497
  case 5:
27340
27498
  if (confirmation.status === 'drop') {
@@ -27347,15 +27505,13 @@ function markChannelAsRead(action) {
27347
27505
  break;
27348
27506
  case 6:
27349
27507
  _context18.p = 6;
27350
- _t17 = _context18.v;
27351
- log.error(_t17, '[READ_MESSAGE] Error on mark channel as read');
27352
27508
  case 7:
27353
27509
  return _context18.a(2);
27354
27510
  }
27355
- }, _marked16$1, null, [[0, 6]]);
27511
+ }, _marked17$1, null, [[0, 6]]);
27356
27512
  }
27357
27513
  function resendPendingChannelReads(action) {
27358
- var connectionState, pendingReads, _iterator0, _step0, pendingRead, currentPendingRead, channel, confirmation, latestPendingRead, _confirmation$message4, readMessageIds, _iterator1, _step1, _confirmation$message5, _confirmation$message6, messageId, updateParams, _t18;
27514
+ var connectionState, pendingReads, _iterator0, _step0, pendingRead, currentPendingRead, channel, confirmation, latestPendingRead, _confirmation$message4, readMessageIds, _iterator1, _step1, _confirmation$message5, _confirmation$message6, messageId, updateParams;
27359
27515
  return _regenerator().w(function (_context19) {
27360
27516
  while (1) switch (_context19.p = _context19.n) {
27361
27517
  case 0:
@@ -27373,7 +27529,7 @@ function resendPendingChannelReads(action) {
27373
27529
  _iterator0 = _createForOfIteratorHelperLoose(pendingReads);
27374
27530
  case 2:
27375
27531
  if ((_step0 = _iterator0()).done) {
27376
- _context19.n = 16;
27532
+ _context19.n = 14;
27377
27533
  break;
27378
27534
  }
27379
27535
  pendingRead = _step0.value;
@@ -27388,20 +27544,14 @@ function resendPendingChannelReads(action) {
27388
27544
  _context19.n = 4;
27389
27545
  break;
27390
27546
  }
27391
- return _context19.a(3, 15);
27547
+ return _context19.a(3, 13);
27392
27548
  case 4:
27393
27549
  if (!(!pendingRead.readAll && !pendingRead.messageIds.length)) {
27394
27550
  _context19.n = 5;
27395
27551
  break;
27396
27552
  }
27397
- log.warn('[READ_MESSAGE] Dropping queued replay because it has no message ids', compactReadMessageLogData({
27398
- source: 'replay',
27399
- channelId: pendingRead.channelId,
27400
- readAll: pendingRead.readAll,
27401
- messageIds: pendingRead.messageIds
27402
- }));
27403
27553
  removePendingChannelRead(pendingRead.channelId);
27404
- return _context19.a(3, 15);
27554
+ return _context19.a(3, 13);
27405
27555
  case 5:
27406
27556
  _context19.n = 6;
27407
27557
  return call(getStoredChannel$2, pendingRead.channelId);
@@ -27411,18 +27561,11 @@ function resendPendingChannelReads(action) {
27411
27561
  _context19.n = 7;
27412
27562
  break;
27413
27563
  }
27414
- log.warn('[READ_MESSAGE] Dropping queued replay because channel was not found', compactReadMessageLogData({
27415
- source: 'replay',
27416
- channelId: pendingRead.channelId,
27417
- readAll: pendingRead.readAll,
27418
- messageIds: pendingRead.messageIds
27419
- }));
27420
27564
  removePendingChannelRead(pendingRead.channelId);
27421
- return _context19.a(3, 15);
27565
+ return _context19.a(3, 13);
27422
27566
  case 7:
27423
- log.info('[READ_MESSAGE] Replaying queued read marker', compactReadMessageLogData(getReadMarkerLogContext(pendingRead, 'replay', pendingRead.messageIds)));
27424
27567
  _context19.n = 8;
27425
- return call(confirmDisplayedRead, channel, pendingRead, 'replay');
27568
+ return call(confirmDisplayedRead, channel, pendingRead);
27426
27569
  case 8:
27427
27570
  confirmation = _context19.v;
27428
27571
  latestPendingRead = getPendingChannelRead(pendingRead.channelId);
@@ -27430,23 +27573,16 @@ function resendPendingChannelReads(action) {
27430
27573
  _context19.n = 9;
27431
27574
  break;
27432
27575
  }
27433
- return _context19.a(3, 15);
27576
+ return _context19.a(3, 13);
27434
27577
  case 9:
27435
27578
  if (confirmation.status === 'success' || confirmation.status === 'drop') {
27436
27579
  removePendingChannelRead(pendingRead.channelId);
27437
27580
  }
27438
27581
  if (!(confirmation.status === 'success' && !pendingRead.readAll)) {
27439
- _context19.n = 14;
27582
+ _context19.n = 13;
27440
27583
  break;
27441
27584
  }
27442
27585
  readMessageIds = getUniqueMessageIds(((_confirmation$message4 = confirmation.messageListMarker) === null || _confirmation$message4 === void 0 ? void 0 : _confirmation$message4.messageIds) || pendingRead.messageIds);
27443
- log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
27444
- source: 'replay',
27445
- channelId: channel.id,
27446
- readAll: false,
27447
- requestedMessageIds: pendingRead.messageIds,
27448
- confirmedMessageIds: readMessageIds
27449
- }));
27450
27586
  _iterator1 = _createForOfIteratorHelperLoose(readMessageIds);
27451
27587
  case 10:
27452
27588
  if ((_step1 = _iterator1()).done) {
@@ -27474,32 +27610,17 @@ function resendPendingChannelReads(action) {
27474
27610
  _context19.n = 10;
27475
27611
  break;
27476
27612
  case 13:
27477
- _context19.n = 15;
27613
+ _context19.n = 2;
27478
27614
  break;
27479
27615
  case 14:
27480
- if (confirmation.status === 'success' && pendingRead.readAll) {
27481
- log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
27482
- source: 'replay',
27483
- channelId: channel.id,
27484
- readAll: true,
27485
- requestedMessageIds: [],
27486
- confirmedMessageIds: []
27487
- }));
27488
- }
27489
- case 15:
27490
- _context19.n = 2;
27616
+ _context19.n = 16;
27491
27617
  break;
27618
+ case 15:
27619
+ _context19.p = 15;
27492
27620
  case 16:
27493
- _context19.n = 18;
27494
- break;
27495
- case 17:
27496
- _context19.p = 17;
27497
- _t18 = _context19.v;
27498
- log.error(_t18, '[READ_MESSAGE] Error on resend pending channel reads');
27499
- case 18:
27500
27621
  return _context19.a(2);
27501
27622
  }
27502
- }, _marked17$1, null, [[0, 17]]);
27623
+ }, _marked18$1, null, [[0, 15]]);
27503
27624
  }
27504
27625
  function markChannelAsUnRead(action) {
27505
27626
  var channelId, channel, _t19;
@@ -27535,7 +27656,7 @@ function markChannelAsUnRead(action) {
27535
27656
  case 5:
27536
27657
  return _context20.a(2);
27537
27658
  }
27538
- }, _marked18$1, null, [[0, 4]]);
27659
+ }, _marked19$1, null, [[0, 4]]);
27539
27660
  }
27540
27661
  function pinChannel(action) {
27541
27662
  var channelId, channel, updatedChannel, _t20;
@@ -27572,7 +27693,7 @@ function pinChannel(action) {
27572
27693
  case 5:
27573
27694
  return _context21.a(2);
27574
27695
  }
27575
- }, _marked19$1, null, [[0, 4]]);
27696
+ }, _marked20$1, null, [[0, 4]]);
27576
27697
  }
27577
27698
  function unpinChannel(action) {
27578
27699
  var channelId, channel, updatedChannel, _t21;
@@ -27609,7 +27730,7 @@ function unpinChannel(action) {
27609
27730
  case 5:
27610
27731
  return _context22.a(2);
27611
27732
  }
27612
- }, _marked20$1, null, [[0, 4]]);
27733
+ }, _marked21$1, null, [[0, 4]]);
27613
27734
  }
27614
27735
  function removeChannelCaches(action) {
27615
27736
  var payload, channelId, activeChannelId, activeChannel;
@@ -27644,7 +27765,7 @@ function removeChannelCaches(action) {
27644
27765
  case 4:
27645
27766
  return _context23.a(2);
27646
27767
  }
27647
- }, _marked21$1);
27768
+ }, _marked22$1);
27648
27769
  }
27649
27770
  function leaveChannel(action) {
27650
27771
  var payload, channelId, channel, messageBuilder, messageToSend, _t22;
@@ -27654,49 +27775,56 @@ function leaveChannel(action) {
27654
27775
  _context24.p = 0;
27655
27776
  payload = action.payload;
27656
27777
  channelId = payload.channelId;
27657
- _context24.n = 1;
27658
- return call(getChannelFromMap, channelId);
27778
+ if (!(store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
27779
+ _context24.n = 1;
27780
+ break;
27781
+ }
27782
+ log.warn('Cannot leave channel while offline');
27783
+ return _context24.a(2);
27659
27784
  case 1:
27785
+ _context24.n = 2;
27786
+ return call(getChannelFromMap, channelId);
27787
+ case 2:
27660
27788
  channel = _context24.v;
27661
27789
  if (!channel) {
27662
27790
  channel = getChannelFromAllChannels(channelId);
27663
27791
  }
27664
27792
  if (!channel) {
27665
- _context24.n = 5;
27793
+ _context24.n = 6;
27666
27794
  break;
27667
27795
  }
27668
27796
  if (!(channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE)) {
27669
- _context24.n = 2;
27797
+ _context24.n = 3;
27670
27798
  break;
27671
27799
  }
27672
27800
  messageBuilder = channel.createMessageBuilder();
27673
27801
  messageBuilder.setBody('LG').setType('system').setDisplayCount(0).setSilent(true);
27674
27802
  messageToSend = messageBuilder.create();
27675
27803
  log.info('send message for left');
27676
- _context24.n = 2;
27677
- return call(channel.sendMessage, messageToSend);
27678
- case 2:
27679
- log.info('leave');
27680
27804
  _context24.n = 3;
27681
- return call(channel.leave);
27805
+ return call(channel.sendMessage, messageToSend);
27682
27806
  case 3:
27807
+ log.info('leave');
27683
27808
  _context24.n = 4;
27684
- return put(removeChannelAC(channelId));
27809
+ return call(channel.leave);
27685
27810
  case 4:
27686
- deleteChannelFromAllChannels(channelId);
27687
27811
  _context24.n = 5;
27688
- return put(removeChannelCachesAC(channelId));
27812
+ return put(removeChannelAC(channelId));
27689
27813
  case 5:
27690
- _context24.n = 7;
27691
- break;
27814
+ deleteChannelFromAllChannels(channelId);
27815
+ _context24.n = 6;
27816
+ return put(removeChannelCachesAC(channelId));
27692
27817
  case 6:
27693
- _context24.p = 6;
27818
+ _context24.n = 8;
27819
+ break;
27820
+ case 7:
27821
+ _context24.p = 7;
27694
27822
  _t22 = _context24.v;
27695
27823
  log.error('ERROR in leave channel - ', _t22.message);
27696
- case 7:
27824
+ case 8:
27697
27825
  return _context24.a(2);
27698
27826
  }
27699
- }, _marked22$1, null, [[0, 6]]);
27827
+ }, _marked23$1, null, [[0, 7]]);
27700
27828
  }
27701
27829
  function deletePendingDeleteChannels() {
27702
27830
  var pendingDeleteChannels, _iterator10, _step10, channel, resendableError, _t23;
@@ -27740,7 +27868,7 @@ function deletePendingDeleteChannels() {
27740
27868
  case 9:
27741
27869
  return _context25.a(2);
27742
27870
  }
27743
- }, _marked23$1, null, [[2, 7]]);
27871
+ }, _marked24$1, null, [[2, 7]]);
27744
27872
  }
27745
27873
  function deleteChannel(action) {
27746
27874
  var payload, channelId, channel, activeChannelId, lastChannel, _t24;
@@ -27834,7 +27962,7 @@ function deleteChannel(action) {
27834
27962
  case 19:
27835
27963
  return _context26.a(2);
27836
27964
  }
27837
- }, _marked24$1, null, [[0, 18]]);
27965
+ }, _marked25$1, null, [[0, 18]]);
27838
27966
  }
27839
27967
  function blockChannel(action) {
27840
27968
  var payload, channelId, channel, _t25;
@@ -27873,7 +28001,7 @@ function blockChannel(action) {
27873
28001
  case 6:
27874
28002
  return _context27.a(2);
27875
28003
  }
27876
- }, _marked25$1, null, [[0, 5]]);
28004
+ }, _marked26$1, null, [[0, 5]]);
27877
28005
  }
27878
28006
  function updateChannel(action) {
27879
28007
  var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, onUpdateChannel, _channel3, _channel4, _channel5, fields, updatedChannel, _t26;
@@ -27970,7 +28098,7 @@ function updateChannel(action) {
27970
28098
  case 9:
27971
28099
  return _context28.a(2);
27972
28100
  }
27973
- }, _marked26$1, null, [[0, 8]]);
28101
+ }, _marked27$1, null, [[0, 8]]);
27974
28102
  }
27975
28103
  function checkUsersStatus() {
27976
28104
  var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t27;
@@ -28021,7 +28149,7 @@ function checkUsersStatus() {
28021
28149
  case 7:
28022
28150
  return _context29.a(2);
28023
28151
  }
28024
- }, _marked27$1, null, [[0, 6]]);
28152
+ }, _marked28$1, null, [[0, 6]]);
28025
28153
  }
28026
28154
  function sendTyping(action) {
28027
28155
  var state, activeChannelId, channel, _t28;
@@ -28064,7 +28192,7 @@ function sendTyping(action) {
28064
28192
  case 8:
28065
28193
  return _context30.a(2);
28066
28194
  }
28067
- }, _marked28$1, null, [[3, 7]]);
28195
+ }, _marked29$1, null, [[3, 7]]);
28068
28196
  }
28069
28197
  function sendRecording(action) {
28070
28198
  var _action$payload, state, channelId, channel, _t29;
@@ -28107,7 +28235,7 @@ function sendRecording(action) {
28107
28235
  case 7:
28108
28236
  return _context31.a(2);
28109
28237
  }
28110
- }, _marked29$1, null, [[2, 6]]);
28238
+ }, _marked30$1, null, [[2, 6]]);
28111
28239
  }
28112
28240
  function clearHistory(action) {
28113
28241
  var payload, channelId, channel, activeChannelId, groupName, _t30;
@@ -28177,7 +28305,7 @@ function clearHistory(action) {
28177
28305
  case 10:
28178
28306
  return _context32.a(2);
28179
28307
  }
28180
- }, _marked30$1, null, [[0, 9]]);
28308
+ }, _marked31$1, null, [[0, 9]]);
28181
28309
  }
28182
28310
  function deleteAllMessages(action) {
28183
28311
  var payload, channelId, channel, activeChannelId, groupName, _t31;
@@ -28250,7 +28378,7 @@ function deleteAllMessages(action) {
28250
28378
  case 11:
28251
28379
  return _context33.a(2);
28252
28380
  }
28253
- }, _marked31$1, null, [[0, 10]]);
28381
+ }, _marked32$1, null, [[0, 10]]);
28254
28382
  }
28255
28383
  function joinChannel(action) {
28256
28384
  var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t32;
@@ -28303,7 +28431,7 @@ function joinChannel(action) {
28303
28431
  case 10:
28304
28432
  return _context34.a(2);
28305
28433
  }
28306
- }, _marked32$1, null, [[0, 9]]);
28434
+ }, _marked33$1, null, [[0, 9]]);
28307
28435
  }
28308
28436
  function watchForChannelEvents() {
28309
28437
  return _regenerator().w(function (_context35) {
@@ -28314,7 +28442,7 @@ function watchForChannelEvents() {
28314
28442
  case 1:
28315
28443
  return _context35.a(2);
28316
28444
  }
28317
- }, _marked33$1);
28445
+ }, _marked34$1);
28318
28446
  }
28319
28447
  function createChannelInviteKey(action) {
28320
28448
  var payload, channelId, _SceytChatClient9, channel, inviteKey, _t33;
@@ -28356,7 +28484,7 @@ function createChannelInviteKey(action) {
28356
28484
  case 5:
28357
28485
  return _context36.a(2);
28358
28486
  }
28359
- }, _marked34$1, null, [[0, 4]]);
28487
+ }, _marked35$1, null, [[0, 4]]);
28360
28488
  }
28361
28489
  function getChannelInviteKeys(action) {
28362
28490
  var payload, channelId, channel, inviteKeys, _t34;
@@ -28393,7 +28521,7 @@ function getChannelInviteKeys(action) {
28393
28521
  case 5:
28394
28522
  return _context37.a(2);
28395
28523
  }
28396
- }, _marked35$1, null, [[0, 4]]);
28524
+ }, _marked36$1, null, [[0, 4]]);
28397
28525
  }
28398
28526
  function regenerateChannelInviteKey(action) {
28399
28527
  var payload, channelId, key, deletePermanently, channel, inviteKey, _t35;
@@ -28434,7 +28562,7 @@ function regenerateChannelInviteKey(action) {
28434
28562
  case 5:
28435
28563
  return _context38.a(2);
28436
28564
  }
28437
- }, _marked36$1, null, [[0, 4]]);
28565
+ }, _marked37$1, null, [[0, 4]]);
28438
28566
  }
28439
28567
  function updateChannelInviteKey(action) {
28440
28568
  var channelInviteKeys, channelId, payload, payloadChannelId, key, accessPriorHistory, expiresAt, maxUses, channel, copiedChannelInviteKeys, _t36;
@@ -28494,7 +28622,7 @@ function updateChannelInviteKey(action) {
28494
28622
  case 6:
28495
28623
  return _context39.a(2);
28496
28624
  }
28497
- }, _marked37$1, null, [[1, 5]]);
28625
+ }, _marked38$1, null, [[1, 5]]);
28498
28626
  }
28499
28627
  function getChannelByInviteKey(action) {
28500
28628
  var _channel$, _channel$2, payload, key, _SceytChatClient0, channel, _t37;
@@ -28545,7 +28673,7 @@ function getChannelByInviteKey(action) {
28545
28673
  case 8:
28546
28674
  return _context40.a(2);
28547
28675
  }
28548
- }, _marked38$1, null, [[0, 6]]);
28676
+ }, _marked39$1, null, [[0, 6]]);
28549
28677
  }
28550
28678
  function joinChannelWithInviteKey(action) {
28551
28679
  var payload, key, _SceytChatClient1, user, channel, messageToSend, _t38;
@@ -28589,7 +28717,7 @@ function joinChannelWithInviteKey(action) {
28589
28717
  case 7:
28590
28718
  return _context41.a(2);
28591
28719
  }
28592
- }, _marked39$1, null, [[0, 6]]);
28720
+ }, _marked40$1, null, [[0, 6]]);
28593
28721
  }
28594
28722
  function setMessageRetentionPeriod(action) {
28595
28723
  var payload, channelId, periodInMilliseconds, channel, messageToSend, _t39;
@@ -28642,7 +28770,7 @@ function setMessageRetentionPeriod(action) {
28642
28770
  case 6:
28643
28771
  return _context42.a(2);
28644
28772
  }
28645
- }, _marked40$1, null, [[0, 5]]);
28773
+ }, _marked41$1, null, [[0, 5]]);
28646
28774
  }
28647
28775
  function getChannelsWithUser(action) {
28648
28776
  var payload, userId, _SceytChatClient10, channelsQueryBuilder, channelsQuery, channelsData, channels, _t40;
@@ -28705,7 +28833,7 @@ function getChannelsWithUser(action) {
28705
28833
  case 12:
28706
28834
  return _context43.a(2);
28707
28835
  }
28708
- }, _marked41$1, null, [[2, 9, 10, 12]]);
28836
+ }, _marked42$1, null, [[2, 9, 10, 12]]);
28709
28837
  }
28710
28838
  function loadMoreMutualChannels(action) {
28711
28839
  var payload, limit, mutualChannelsQuery, channelsData, _t41;
@@ -28763,7 +28891,7 @@ function loadMoreMutualChannels(action) {
28763
28891
  case 11:
28764
28892
  return _context44.a(2);
28765
28893
  }
28766
- }, _marked42$1, null, [[1, 8, 9, 11]]);
28894
+ }, _marked43$1, null, [[1, 8, 9, 11]]);
28767
28895
  }
28768
28896
  function ChannelsSaga() {
28769
28897
  return _regenerator().w(function (_context45) {
@@ -28897,7 +29025,7 @@ function ChannelsSaga() {
28897
29025
  case 42:
28898
29026
  return _context45.a(2);
28899
29027
  }
28900
- }, _marked43$1);
29028
+ }, _marked44$1);
28901
29029
  }
28902
29030
 
28903
29031
  var _marked$4 = /*#__PURE__*/_regenerator().m(getMembers),
@@ -30894,7 +31022,9 @@ var SceytChat = function SceytChat(_ref) {
30894
31022
  if (client) {
30895
31023
  cleanupOldAttachmentCache();
30896
31024
  if (client.user && client.user.id) {
30897
- initMessagesIdbForUser(client.user.id);
31025
+ initMessagesIdbForUser(client.user.id).then(function () {
31026
+ return hydrateDraftMessages();
31027
+ });
30898
31028
  }
30899
31029
  setClient(client);
30900
31030
  setSceytChatClient(client);
@@ -30905,6 +31035,8 @@ var SceytChat = function SceytChat(_ref) {
30905
31035
  setActiveChannelId('');
30906
31036
  destroyChannelsMap();
30907
31037
  clearUsersMap();
31038
+ clearDraftMessagesMap();
31039
+ clearPersistedDrafts();
30908
31040
  releaseAllBlobUrls();
30909
31041
  dispatch(destroySession());
30910
31042
  }
@@ -31559,6 +31691,7 @@ var LastMessageAttachments = function LastMessageAttachments(_ref) {
31559
31691
  return !!(lastMessage.attachments && lastMessage.attachments.length || lastMessage !== null && lastMessage !== void 0 && lastMessage.pollDetails && (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === MESSAGE_TYPE.POLL) && (lastMessage !== null && lastMessage !== void 0 && lastMessage.pollDetails && (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === MESSAGE_TYPE.POLL ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SvgPoll, null), lastMessage.body ? '' : 'Poll')) : lastMessage.attachments[0].type === attachmentTypes.image ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, isViewOnce ? /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, null) : /*#__PURE__*/React__default.createElement(SvgPicture, null), lastMessage.body && !isViewOnce ? '' : 'Photo')) : lastMessage.attachments[0].type === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, isViewOnce ? /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, null) : /*#__PURE__*/React__default.createElement(SvgVideoCall, null), lastMessage.body && !isViewOnce ? '' : 'Video')) : lastMessage.attachments[0].type === attachmentTypes.file ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SvgChoseFile, null), lastMessage.body ? '' : 'File')) : lastMessage.attachments[0].type === attachmentTypes.voice ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, isViewOnce ? /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, null) : /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), lastMessage.body && !isViewOnce ? '' : 'Voice')) : null);
31560
31692
  };
31561
31693
  var ChannelMessageText = function ChannelMessageText(_ref2) {
31694
+ var _lastMessage$attachme, _lastMessage$attachme2, _lastMessage$attachme3;
31562
31695
  var isTypingOrRecording = _ref2.isTypingOrRecording,
31563
31696
  textPrimary = _ref2.textPrimary,
31564
31697
  textSecondary = _ref2.textSecondary,
@@ -31581,8 +31714,10 @@ var ChannelMessageText = function ChannelMessageText(_ref2) {
31581
31714
  color: textPrimary
31582
31715
  }, ":"), typingOrRecording.isTyping ? 'typing' : 'recording', "...")), !isTypingOrRecording && (draftMessageText ? (/*#__PURE__*/React__default.createElement(DraftMessageText, {
31583
31716
  color: textSecondary
31584
- }, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), MessageTextFormat({
31585
- text: draftMessageText,
31717
+ }, !lastMessage.body && (_lastMessage$attachme = lastMessage.attachments) !== null && _lastMessage$attachme !== void 0 && _lastMessage$attachme.length ? LastMessageAttachments({
31718
+ lastMessage: lastMessage
31719
+ }) : null, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), (!((_lastMessage$attachme2 = lastMessage.attachments) !== null && _lastMessage$attachme2 !== void 0 && _lastMessage$attachme2.length) || lastMessage.body) && MessageTextFormat({
31720
+ text: (_lastMessage$attachme3 = lastMessage.attachments) !== null && _lastMessage$attachme3 !== void 0 && _lastMessage$attachme3.length ? lastMessage.body : draftMessageText,
31586
31721
  message: lastMessage,
31587
31722
  contactsMap: contactsMap,
31588
31723
  getFromContacts: getFromContacts,
@@ -31671,13 +31806,23 @@ var Channel = function Channel(_ref3) {
31671
31806
  var _useState2 = useState(),
31672
31807
  draftMessage = _useState2[0],
31673
31808
  setDraftMessage = _useState2[1];
31809
+ var _useState3 = useState(0),
31810
+ draftRevision = _useState3[0],
31811
+ setDraftRevision = _useState3[1];
31812
+ useEffect(function () {
31813
+ return subscribeToDraftMessages(function () {
31814
+ return setDraftRevision(function (revision) {
31815
+ return revision + 1;
31816
+ });
31817
+ });
31818
+ }, []);
31674
31819
  var lastMessage = useMemo(function () {
31675
31820
  return channel.lastReactedMessage || channel.lastMessage;
31676
31821
  }, [channel.lastReactedMessage, channel.lastMessage]);
31677
31822
  var lastMessageMetas = lastMessage && lastMessage.type === MESSAGE_TYPE.SYSTEM && lastMessage.metadata && (isJSON(lastMessage.metadata) ? JSON.parse(lastMessage.metadata) : lastMessage.metadata);
31678
- var _useState3 = useState(0),
31679
- statusWidth = _useState3[0],
31680
- setStatusWidth = _useState3[1];
31823
+ var _useState4 = useState(0),
31824
+ statusWidth = _useState4[0],
31825
+ setStatusWidth = _useState4[1];
31681
31826
  var avatarName = channel.subject || (isDirectChannel && directChannelUser ? directChannelUser.firstName || directChannelUser.id : isSelfChannel ? showPhoneNumber ? "+" + user.id + " (You)" : 'Me' : '');
31682
31827
  var messageAuthorRef = useRef(null);
31683
31828
  var messageTimeAndStatusRef = useRef(null);
@@ -31693,12 +31838,27 @@ var Channel = function Channel(_ref3) {
31693
31838
  var draftAudioRecording = getAudioRecordingFromMap(channel.id);
31694
31839
  if (channelDraftMessage || draftAudioRecording) {
31695
31840
  if (channelDraftMessage) {
31696
- setDraftMessageText(channelDraftMessage.text);
31697
- setDraftMessage({
31698
- mentionedUsers: channelDraftMessage.mentionedUsers,
31699
- body: channelDraftMessage.text,
31700
- bodyAttributes: channelDraftMessage.bodyAttributes
31701
- });
31841
+ var _channelDraftMessage$, _ref4, _channelDraftMessage$2, _channelDraftMessage$3, _channelDraftMessage$4;
31842
+ var attachment = (_channelDraftMessage$ = channelDraftMessage.attachments) === null || _channelDraftMessage$ === void 0 ? void 0 : _channelDraftMessage$[0];
31843
+ var editText = (_ref4 = (_channelDraftMessage$2 = channelDraftMessage.editMessageText) != null ? _channelDraftMessage$2 : (_channelDraftMessage$3 = channelDraftMessage.messageToEdit) === null || _channelDraftMessage$3 === void 0 ? void 0 : _channelDraftMessage$3.body) != null ? _ref4 : '';
31844
+ var hasChangedEdit = !!channelDraftMessage.messageToEdit && !!editText.trim() && (editText !== channelDraftMessage.messageToEdit.body || JSON.stringify(channelDraftMessage.editBodyAttributes || []) !== JSON.stringify(channelDraftMessage.messageToEdit.bodyAttributes || []));
31845
+ var mediaLabel = (attachment === null || attachment === void 0 ? void 0 : attachment.type) === attachmentTypes.image ? 'Photo' : (attachment === null || attachment === void 0 ? void 0 : attachment.type) === attachmentTypes.video ? 'Video' : (attachment === null || attachment === void 0 ? void 0 : attachment.type) === attachmentTypes.voice ? 'Voice' : attachment ? 'File' : '';
31846
+ var draftText = ((_channelDraftMessage$4 = channelDraftMessage.text) === null || _channelDraftMessage$4 === void 0 ? void 0 : _channelDraftMessage$4.trim()) || mediaLabel;
31847
+ var isContextOnlyDraft = !!channelDraftMessage.messageForReply && !draftText || !!channelDraftMessage.messageToEdit && !hasChangedEdit;
31848
+ if (isContextOnlyDraft) {
31849
+ setDraftMessageText(undefined);
31850
+ setDraftMessage(undefined);
31851
+ } else {
31852
+ setDraftMessageText(draftText);
31853
+ setDraftMessage({
31854
+ mentionedUsers: channelDraftMessage.mentionedUsers,
31855
+ body: channelDraftMessage.text,
31856
+ bodyAttributes: channelDraftMessage.bodyAttributes,
31857
+ attachments: channelDraftMessage.attachments,
31858
+ viewOnce: channelDraftMessage.viewOnce,
31859
+ type: channelDraftMessage.viewOnce ? MESSAGE_TYPE.VIEW_ONCE : undefined
31860
+ });
31861
+ }
31702
31862
  } else if (draftAudioRecording) {
31703
31863
  setDraftMessageText('Voice');
31704
31864
  setDraftMessage(undefined);
@@ -31708,7 +31868,7 @@ var Channel = function Channel(_ref3) {
31708
31868
  setDraftMessage(undefined);
31709
31869
  }
31710
31870
  }
31711
- }, [activeChannel.id]);
31871
+ }, [activeChannel.id, draftRevision]);
31712
31872
  useEffect(function () {
31713
31873
  if (channelDraftIsRemoved && channelDraftIsRemoved === channel.id) {
31714
31874
  setDraftMessageText(undefined);
@@ -31749,6 +31909,8 @@ var Channel = function Channel(_ref3) {
31749
31909
  var unsupportedMessage = useMemo(function () {
31750
31910
  return isMessageUnsupported(lastMessage);
31751
31911
  }, [lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type]);
31912
+ var shouldShowDraft = !!draftMessageText && !(channel.newMessageCount > 0);
31913
+ var displayedLastMessage = shouldShowDraft ? draftMessage || lastMessage : lastMessage;
31752
31914
  var MessageText = useMemo(function () {
31753
31915
  return /*#__PURE__*/React__default.createElement(ChannelMessageText, {
31754
31916
  isTypingOrRecording: (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping) || (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording),
@@ -31761,29 +31923,29 @@ var Channel = function Channel(_ref3) {
31761
31923
  channel: channel,
31762
31924
  textPrimary: textPrimary,
31763
31925
  textSecondary: textSecondary,
31764
- draftMessageText: draftMessageText,
31765
- lastMessage: draftMessage || lastMessage,
31926
+ draftMessageText: shouldShowDraft ? draftMessageText : '',
31927
+ lastMessage: displayedLastMessage,
31766
31928
  isDirectChannel: isDirectChannel,
31767
31929
  unsupportedMessage: unsupportedMessage && !getCustomLatestMessage
31768
31930
  });
31769
- }, [typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping, typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording, draftMessageText, lastMessage, user, contactsMap, getFromContacts, lastMessageMetas, accentColor, typingOrRecording, channel, isDirectChannel, unsupportedMessage]);
31770
- var getCustomLatestMessageComponent = useCallback(function (_ref4) {
31771
- var lastMessage = _ref4.lastMessage,
31772
- typingOrRecording = _ref4.typingOrRecording,
31773
- draftMessageText = _ref4.draftMessageText,
31774
- textSecondary = _ref4.textSecondary,
31775
- channel = _ref4.channel,
31776
- channelLastMessageFontSize = _ref4.channelLastMessageFontSize,
31777
- channelLastMessageHeight = _ref4.channelLastMessageHeight,
31778
- isDirectChannel = _ref4.isDirectChannel,
31779
- textPrimary = _ref4.textPrimary,
31780
- messageAuthorRef = _ref4.messageAuthorRef,
31781
- contactsMap = _ref4.contactsMap,
31782
- getFromContacts = _ref4.getFromContacts,
31783
- warningColor = _ref4.warningColor,
31784
- user = _ref4.user,
31785
- MessageText = _ref4.MessageText,
31786
- unsupportedMessage = _ref4.unsupportedMessage;
31931
+ }, [typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping, typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording, draftMessageText, shouldShowDraft, displayedLastMessage, lastMessage, user, contactsMap, getFromContacts, lastMessageMetas, accentColor, typingOrRecording, channel, isDirectChannel, unsupportedMessage]);
31932
+ var getCustomLatestMessageComponent = useCallback(function (_ref5) {
31933
+ var lastMessage = _ref5.lastMessage,
31934
+ typingOrRecording = _ref5.typingOrRecording,
31935
+ draftMessageText = _ref5.draftMessageText,
31936
+ textSecondary = _ref5.textSecondary,
31937
+ channel = _ref5.channel,
31938
+ channelLastMessageFontSize = _ref5.channelLastMessageFontSize,
31939
+ channelLastMessageHeight = _ref5.channelLastMessageHeight,
31940
+ isDirectChannel = _ref5.isDirectChannel,
31941
+ textPrimary = _ref5.textPrimary,
31942
+ messageAuthorRef = _ref5.messageAuthorRef,
31943
+ contactsMap = _ref5.contactsMap,
31944
+ getFromContacts = _ref5.getFromContacts,
31945
+ warningColor = _ref5.warningColor,
31946
+ user = _ref5.user,
31947
+ MessageText = _ref5.MessageText,
31948
+ unsupportedMessage = _ref5.unsupportedMessage;
31787
31949
  return getCustomLatestMessage && getCustomLatestMessage({
31788
31950
  lastMessage: lastMessage,
31789
31951
  typingOrRecording: typingOrRecording,
@@ -31857,7 +32019,7 @@ var Channel = function Channel(_ref3) {
31857
32019
  }, notificationsIsMutedIcon || /*#__PURE__*/React__default.createElement(SvgUnmuteNotifications, null))), getCustomLatestMessage && !typingOrRecording.items.length ? getCustomLatestMessageComponent({
31858
32020
  lastMessage: lastMessage,
31859
32021
  typingOrRecording: typingOrRecording,
31860
- draftMessageText: draftMessageText,
32022
+ draftMessageText: shouldShowDraft ? draftMessageText : undefined,
31861
32023
  textSecondary: textSecondary,
31862
32024
  channel: channel,
31863
32025
  channelLastMessageFontSize: channelLastMessageFontSize || '14px',
@@ -31871,7 +32033,7 @@ var Channel = function Channel(_ref3) {
31871
32033
  user: user,
31872
32034
  MessageText: MessageText,
31873
32035
  unsupportedMessage: unsupportedMessage
31874
- }) : (lastMessage || typingOrRecording.items.length > 0 || draftMessageText) && (/*#__PURE__*/React__default.createElement(LastMessage, {
32036
+ }) : (lastMessage || typingOrRecording.items.length > 0 || shouldShowDraft) && (/*#__PURE__*/React__default.createElement(LastMessage, {
31875
32037
  color: textSecondary,
31876
32038
  markedAsUnread: !!(channel.unread || channel.newMessageCount && channel.newMessageCount > 0),
31877
32039
  unreadMentions: !!(channel.newMentionCount && channel.newMentionCount > 0),
@@ -31887,7 +32049,7 @@ var Channel = function Channel(_ref3) {
31887
32049
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
31888
32050
  key: item.from.id
31889
32051
  }, makeUsername(contactsMap && contactsMap[item.from.id], item.from, getFromContacts, true), index < typingOrRecording.items.length - 1 && ', ');
31890
- })))) : null : draftMessageText ? (/*#__PURE__*/React__default.createElement(DraftMessageTitle, {
32052
+ })))) : null : shouldShowDraft ? (/*#__PURE__*/React__default.createElement(DraftMessageTitle, {
31891
32053
  color: warningColor
31892
32054
  }, "Draft")) : channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.newReactions[0].user && channel.newReactions[0].user.id === user.id || !isDirectChannel) && lastMessage.type !== MESSAGE_TYPE.SYSTEM && (/*#__PURE__*/React__default.createElement(LastMessageAuthor, {
31893
32055
  color: textPrimary
@@ -31897,8 +32059,8 @@ var Channel = function Channel(_ref3) {
31897
32059
  color: textPrimary
31898
32060
  }, /*#__PURE__*/React__default.createElement("span", {
31899
32061
  ref: messageAuthorRef
31900
- }, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (draftMessageText || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id && lastMessage.type !== MESSAGE_TYPE.SYSTEM)) : draftMessageText || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== MESSAGE_TYPE.SYSTEM) && (/*#__PURE__*/React__default.createElement(Points, {
31901
- color: draftMessageText && warningColor || textPrimary
32062
+ }, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (shouldShowDraft || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id && lastMessage.type !== MESSAGE_TYPE.SYSTEM)) : shouldShowDraft || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== MESSAGE_TYPE.SYSTEM) && (/*#__PURE__*/React__default.createElement(Points, {
32063
+ color: shouldShowDraft && warningColor || textPrimary
31902
32064
  }, ": ")), /*#__PURE__*/React__default.createElement(LastMessageText, {
31903
32065
  color: textSecondary,
31904
32066
  withAttachments: !!(lastMessage && lastMessage.attachments && lastMessage.attachments.length && lastMessage.attachments[0].type !== attachmentTypes.link) && (!(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) || !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording)),
@@ -31907,7 +32069,7 @@ var Channel = function Channel(_ref3) {
31907
32069
  }, MessageText)))), /*#__PURE__*/React__default.createElement(ChannelStatus, {
31908
32070
  color: iconInactive,
31909
32071
  ref: messageTimeAndStatusRef
31910
- }, lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && !draftMessageText && (/*#__PURE__*/React__default.createElement(DeliveryIconCont, null, lastMessage && lastMessage.user && lastMessage.user.id === user.id && isTypeValid(lastMessage.type) && MessageStatusIcon({
32072
+ }, lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && !shouldShowDraft && (/*#__PURE__*/React__default.createElement(DeliveryIconCont, null, lastMessage && lastMessage.user && lastMessage.user.id === user.id && isTypeValid(lastMessage.type) && MessageStatusIcon({
31911
32073
  messageStatus: lastMessage.deliveryStatus,
31912
32074
  messageStatusDisplayingType: 'ticks',
31913
32075
  readIconColor: accentColor,
@@ -31918,7 +32080,7 @@ var Channel = function Channel(_ref3) {
31918
32080
  color: textSecondary,
31919
32081
  fontSize: channelLastMessageTimeFontSize
31920
32082
  }, lastMessage && lastMessage.createdAt && lastMessageDateFormat(lastMessage.createdAt))), /*#__PURE__*/React__default.createElement(UnreadInfo, {
31921
- bottom: !(lastMessage || typingOrRecording.items.length > 0 || draftMessageText) ? '5px' : ''
32083
+ bottom: !(lastMessage || typingOrRecording.items.length > 0 || shouldShowDraft) ? '5px' : ''
31922
32084
  }, channel.pinnedAt && (/*#__PURE__*/React__default.createElement(PinnedIconWrapper, {
31923
32085
  color: iconInactive,
31924
32086
  margin: channel.newMessageCount || channel.unread || channel.newMentionCount && channel.newMentionCount > 0 ? '0 4px 0 4px' : ''
@@ -31994,9 +32156,9 @@ var Container$3 = styled.div(_templateObject7$2 || (_templateObject7$2 = _tagged
31994
32156
  return props.selectedChannel ? props.selectedBackgroundColor : props.backgroundColor;
31995
32157
  }, function (props) {
31996
32158
  return props.selectedChannel ? props.selectedBackgroundColor : props.backgroundColor;
31997
- }, function (_ref5) {
31998
- var selectedChannel = _ref5.selectedChannel,
31999
- hoverBackground = _ref5.hoverBackground;
32159
+ }, function (_ref6) {
32160
+ var selectedChannel = _ref6.selectedChannel,
32161
+ hoverBackground = _ref6.hoverBackground;
32000
32162
  return !selectedChannel && "\n background-color: " + hoverBackground + ";\n ";
32001
32163
  }, UserStatus, function (props) {
32002
32164
  return props.selectedChannel ? props.selectedBackgroundColor : props.hoverBackground;
@@ -32015,9 +32177,9 @@ var DraftMessageText = styled.span(_templateObject9$1 || (_templateObject9$1 = _
32015
32177
  });
32016
32178
  var LastMessageAuthor = styled.div(_templateObject0$1 || (_templateObject0$1 = _taggedTemplateLiteralLoose(["\n max-width: 120px;\n font-weight: 500;\n color: ", ";\n\n ", "\n & > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 100%;\n }\n"])), function (props) {
32017
32179
  return props.color;
32018
- }, function (_ref6) {
32019
- var typing = _ref6.typing,
32020
- recording = _ref6.recording;
32180
+ }, function (_ref7) {
32181
+ var typing = _ref7.typing,
32182
+ recording = _ref7.recording;
32021
32183
  return (typing || recording) && "\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: calc(100% - " + (typing ? 62 : 76) + "px);\n ";
32022
32184
  });
32023
32185
  var Points = styled.span(_templateObject1$1 || (_templateObject1$1 = _taggedTemplateLiteralLoose(["\n margin-right: 4px;\n color: ", ";\n font-style: normal;\n"])), function (props) {
@@ -32050,9 +32212,9 @@ var UnreadMentionIconWrapper = styled.span(_templateObject15$1 || (_templateObje
32050
32212
  return props.rightMargin && '8px';
32051
32213
  }, function (props) {
32052
32214
  return props.iconColor;
32053
- }, function (_ref7) {
32054
- var onAvatar = _ref7.onAvatar,
32055
- mainBg = _ref7.mainBg;
32215
+ }, function (_ref8) {
32216
+ var onAvatar = _ref8.onAvatar,
32217
+ mainBg = _ref8.mainBg;
32056
32218
  return onAvatar ? "\n position: absolute;\n right: 6px;\n bottom: 6px;\n border: 2px solid " + mainBg + ";\n min-width: 20px;\n height: 20px;\n border-radius: 50%;\n margin-right: 0;\n " : '';
32057
32219
  });
32058
32220
  var TypingIndicator = styled.span(_templateObject16$1 || (_templateObject16$1 = _taggedTemplateLiteralLoose(["\n font-style: italic;\n"])));
@@ -32072,9 +32234,9 @@ var UnreadCount = styled.span(_templateObject19$1 || (_templateObject19$1 = _tag
32072
32234
  return props.textColor;
32073
32235
  }, function (props) {
32074
32236
  return props.isMuted && "background-color: " + props.mutedBackgroundColor + ";";
32075
- }, function (_ref8) {
32076
- var onAvatar = _ref8.onAvatar,
32077
- mainBg = _ref8.mainBg;
32237
+ }, function (_ref9) {
32238
+ var onAvatar = _ref9.onAvatar,
32239
+ mainBg = _ref9.mainBg;
32078
32240
  return onAvatar ? "\n position: absolute;\n right: 6px;\n bottom: 6px;\n border: 2px solid " + mainBg + ";\n min-width: 24px;\n height: 24px;\n max-width: 24px;\n border-radius: 50%;\n " : '';
32079
32241
  });
32080
32242
  var PinnedIconWrapper = styled.span(_templateObject20$1 || (_templateObject20$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n ", ";\n & > svg {\n color: ", ";\n }\n"])), function (props) {
@@ -39563,7 +39725,7 @@ var VideoIcon = styled.div(_templateObject8$a || (_templateObject8$a = _taggedTe
39563
39725
  return bg;
39564
39726
  });
39565
39727
 
39566
- var _templateObject$z, _templateObject2$v, _templateObject3$p, _templateObject4$l, _templateObject5$h, _templateObject6$e, _templateObject7$d, _templateObject8$b, _templateObject9$9, _templateObject0$8, _templateObject1$8, _templateObject10$6, _templateObject11$5;
39728
+ var _templateObject$z, _templateObject2$v, _templateObject3$p, _templateObject4$l, _templateObject5$h, _templateObject6$e, _templateObject7$d, _templateObject8$b, _templateObject9$9, _templateObject0$8, _templateObject1$8, _templateObject10$6, _templateObject11$5, _templateObject12$4, _templateObject13$4;
39567
39729
  var Attachment = function Attachment(_ref) {
39568
39730
  var attachment = _ref.attachment,
39569
39731
  _ref$isPreview = _ref.isPreview,
@@ -39625,6 +39787,10 @@ var Attachment = function Attachment(_ref) {
39625
39787
  var _useState3 = useState(attachmentUrlFromMap),
39626
39788
  attachmentUrl = _useState3[0],
39627
39789
  setAttachmentUrl = _useState3[1];
39790
+ var attachmentIdentity = attachment.id || attachment.tid || 'unknown-attachment';
39791
+ var attachmentKey = (channelId || 'unknown-channel') + ":" + attachmentIdentity + ":" + (attachment.url || '');
39792
+ var currentAttachmentKeyRef = useRef(attachmentKey);
39793
+ currentAttachmentKeyRef.current = attachmentKey;
39628
39794
  var _useState4 = useState(false),
39629
39795
  imageLoaded = _useState4[0],
39630
39796
  setImageLoaded = _useState4[1];
@@ -39684,6 +39850,18 @@ var Attachment = function Attachment(_ref) {
39684
39850
  log.error('error on get attachmentThumb', e);
39685
39851
  }
39686
39852
  }
39853
+ useEffect(function () {
39854
+ if (attachment.type !== attachmentTypes.image) return;
39855
+ log.info('[MEDIA_ISSUE] image thumbnail source', JSON.stringify({
39856
+ channelId: channelId || null,
39857
+ attachmentId: attachment.id || attachment.tid || null,
39858
+ attachmentUrl: attachment.url || null,
39859
+ mapUrl: attachmentUrlFromMap || null,
39860
+ propUrl: attachment.attachmentUrl || null,
39861
+ localUrl: attachmentUrl || null,
39862
+ renderedSource: attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl || attachmentThumb || null
39863
+ }));
39864
+ }, [attachment.id, attachment.tid, attachment.type, attachment.url, attachment.attachmentUrl, attachmentUrlFromMap, attachmentUrl, channelId]);
39687
39865
  useEffect(function () {
39688
39866
  var currentSrc = attachment.attachmentUrl || attachmentUrlFromMap || attachmentUrl || attachmentThumb;
39689
39867
  var wasThumbnail = previousImageSrcRef.current === attachmentThumb;
@@ -39973,12 +40151,23 @@ var Attachment = function Attachment(_ref) {
39973
40151
  }, [attachmentUrl]);
39974
40152
  useEffect(function () {
39975
40153
  if (!attachment.attachmentUrl && connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !attachmentUrlFromMap && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
40154
+ var requestAttachmentKey = attachmentKey;
40155
+ log.info('[MEDIA_ISSUE] image thumbnail load started', JSON.stringify({
40156
+ channelId: channelId || null,
40157
+ attachmentId: attachment.id || attachment.tid || null,
40158
+ url: attachment.url
40159
+ }));
39976
40160
  getAttachmentUrlFromCache(attachment.url).then(function (cachedUrl) {
39977
40161
  try {
39978
40162
  var _temp16 = function () {
39979
40163
  if (attachment.type === attachmentTypes.image && !isPreview) {
39980
40164
  var _temp15 = function () {
39981
40165
  if (cachedUrl) {
40166
+ log.info('[MEDIA_ISSUE] image thumbnail cache resolved', JSON.stringify({
40167
+ requestAttachmentKey: requestAttachmentKey,
40168
+ currentAttachmentKey: currentAttachmentKeyRef.current,
40169
+ cachedUrl: cachedUrl
40170
+ }));
39982
40171
  setAttachmentUrl(cachedUrl);
39983
40172
  dispatch(setUpdateMessageAttachmentAC(attachment.url, cachedUrl));
39984
40173
  setIsCached(true);
@@ -39999,6 +40188,12 @@ var Attachment = function Attachment(_ref) {
39999
40188
  try {
40000
40189
  return Promise.resolve(compressAndCacheImage(url, attachment.url, renderWidth, renderHeight)).then(function (compressedUrl) {
40001
40190
  if (compressedUrl) {
40191
+ log.info('[MEDIA_ISSUE] image thumbnail download resolved', JSON.stringify({
40192
+ requestAttachmentKey: requestAttachmentKey,
40193
+ currentAttachmentKey: currentAttachmentKeyRef.current,
40194
+ sourceUrl: url,
40195
+ cachedUrl: compressedUrl
40196
+ }));
40002
40197
  setAttachmentUrl(compressedUrl);
40003
40198
  }
40004
40199
  downloadImage(compressedUrl || url);
@@ -40191,7 +40386,7 @@ var Attachment = function Attachment(_ref) {
40191
40386
  isPreview: isPreview,
40192
40387
  isRepliedMessage: isRepliedMessage,
40193
40388
  withBorder: !isPreview && !isDetailsView,
40194
- src: attachmentUrlFromMap || attachmentUrl || (withPrefix && attachmentThumb ? "data:image/jpeg;base64," + attachmentThumb : attachmentThumb),
40389
+ src: attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl || (withPrefix && attachmentThumb ? "data:image/jpeg;base64," + attachmentThumb : attachmentThumb),
40195
40390
  fitTheContainer: true,
40196
40391
  imageMaxHeight: (renderHeight || 400) + "px",
40197
40392
  isDetailsView: isDetailsView,
@@ -40362,7 +40557,9 @@ var Attachment = function Attachment(_ref) {
40362
40557
  border: selectedFileAttachmentsBoxBorder || (theme === THEME.DARK ? 'none' : ''),
40363
40558
  width: fileAttachmentWidth,
40364
40559
  borderColor: borderColor
40365
- }, attachmentThumb ? (/*#__PURE__*/React__default.createElement(FileThumbnail, {
40560
+ }, attachment.thumbnailState === 'loading' ? (/*#__PURE__*/React__default.createElement(FileThumbnailSkeleton, {
40561
+ color: overlayBackground2
40562
+ })) : attachmentThumb ? (/*#__PURE__*/React__default.createElement(FileThumbnail, {
40366
40563
  src: withPrefix ? "data:image/jpeg;base64," + attachmentThumb : attachmentThumb,
40367
40564
  loading: 'lazy',
40368
40565
  decoding: 'async',
@@ -40472,18 +40669,26 @@ var AttachmentImgCont = styled.div(_templateObject2$v || (_templateObject2$v = _
40472
40669
  return props.isPreview && "\n width: 48px;\n min-width: 48px;\n height: 48px;\n ";
40473
40670
  });
40474
40671
  var FileThumbnail = styled.img(_templateObject3$p || (_templateObject3$p = _taggedTemplateLiteralLoose(["\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 8px;\n"])));
40475
- var DownloadFile$1 = styled.span(_templateObject4$l || (_templateObject4$l = _taggedTemplateLiteralLoose(["\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n background-color: ", ";\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n position: ", ";\n border-radius: ", ";\n\n & > svg {\n width: 20px;\n height: 20px;\n }\n"])), function (props) {
40672
+ var fileThumbnailShimmer = keyframes(_templateObject4$l || (_templateObject4$l = _taggedTemplateLiteralLoose(["\n 0% { background-position: -120px 0; }\n 100% { background-position: 120px 0; }\n"])));
40673
+ var FileThumbnailSkeleton = styled.div(_templateObject5$h || (_templateObject5$h = _taggedTemplateLiteralLoose(["\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n border-radius: 8px;\n background-color: ", ";\n background-image: linear-gradient(\n 90deg,\n ", ",\n rgba(255, 255, 255, 0.55),\n ", "\n );\n background-size: 240px 100%;\n animation: ", " 1.1s ease infinite;\n"])), function (props) {
40674
+ return props.color;
40675
+ }, function (props) {
40676
+ return props.color;
40677
+ }, function (props) {
40678
+ return props.color;
40679
+ }, fileThumbnailShimmer);
40680
+ var DownloadFile$1 = styled.span(_templateObject6$e || (_templateObject6$e = _taggedTemplateLiteralLoose(["\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n background-color: ", ";\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n position: ", ";\n border-radius: ", ";\n\n & > svg {\n width: 20px;\n height: 20px;\n }\n"])), function (props) {
40476
40681
  return props.backgroundColor;
40477
40682
  }, function (props) {
40478
40683
  return props.widthThumb && 'absolute';
40479
40684
  }, function (props) {
40480
40685
  return props.widthThumb ? '7.3px' : '50%';
40481
40686
  });
40482
- var ProgressWrapper$1 = styled.span(_templateObject5$h || (_templateObject5$h = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%;\n animation: preloader 1.5s linear infinite;\n\n @keyframes preloader {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])));
40483
- var SizeProgress = styled.span(_templateObject6$e || (_templateObject6$e = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: -26px;\n background-color: rgba(0, 0, 0, 0.4);\n color: ", ";\n font-size: 12px;\n border-radius: 12px;\n padding: 3px 6px;\n white-space: nowrap;\n"])), function (props) {
40687
+ var ProgressWrapper$1 = styled.span(_templateObject7$d || (_templateObject7$d = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%;\n animation: preloader 1.5s linear infinite;\n\n @keyframes preloader {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])));
40688
+ var SizeProgress = styled.span(_templateObject8$b || (_templateObject8$b = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: -26px;\n background-color: rgba(0, 0, 0, 0.4);\n color: ", ";\n font-size: 12px;\n border-radius: 12px;\n padding: 3px 6px;\n white-space: nowrap;\n"])), function (props) {
40484
40689
  return props.color;
40485
40690
  });
40486
- var AttachmentFile$1 = styled.div(_templateObject7$d || (_templateObject7$d = _taggedTemplateLiteralLoose(["\n display: flex;\n position: relative;\n align-items: center;\n padding: ", ";\n //width: ", ";\n min-width: ", ";\n //height: 70px;\n background: ", ";\n border: ", ";\n box-sizing: border-box;\n margin-right: ", ";\n border-radius: ", ";\n\n ", "\n\n & > ", " svg {\n width: 40px;\n height: 40px;\n }\n"])), function (props) {
40691
+ var AttachmentFile$1 = styled.div(_templateObject9$9 || (_templateObject9$9 = _taggedTemplateLiteralLoose(["\n display: flex;\n position: relative;\n align-items: center;\n padding: ", ";\n //width: ", ";\n min-width: ", ";\n //height: 70px;\n background: ", ";\n border: ", ";\n box-sizing: border-box;\n margin-right: ", ";\n border-radius: ", ";\n\n ", "\n\n & > ", " svg {\n width: 40px;\n height: 40px;\n }\n"])), function (props) {
40487
40692
  return !props.isRepliedMessage && '8px 12px;';
40488
40693
  }, function (props) {
40489
40694
  return !props.isRepliedMessage && (props.width ? props.width + "px" : '350px');
@@ -40500,25 +40705,25 @@ var AttachmentFile$1 = styled.div(_templateObject7$d || (_templateObject7$d = _t
40500
40705
  }, function (props) {
40501
40706
  return !props.isRepliedMessage && !props.isPreview && !props.isUploading && "\n &:hover " + DownloadFile$1 + " {\n display: flex;\n }\n\n &:hover " + UploadPercent + " {\n border-radius: 50%\n }\n\n &:hover " + FileThumbnail + " {\n }\n &:hover " + AttachmentIconCont + " {\n display: none;\n }\n ";
40502
40707
  }, AttachmentIconCont);
40503
- var RemoveChosenFile = styled(SvgDeleteUpload)(_templateObject8$b || (_templateObject8$b = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: 20px;\n height: 20px !important;\n top: -11px;\n right: -11px;\n padding: 2px;\n cursor: pointer;\n color: ", ";\n z-index: 5;\n circle {\n stroke: ", ";\n }\n path {\n stroke: ", ";\n }\n"])), function (props) {
40708
+ var RemoveChosenFile = styled(SvgDeleteUpload)(_templateObject0$8 || (_templateObject0$8 = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: 20px;\n height: 20px !important;\n top: -11px;\n right: -11px;\n padding: 2px;\n cursor: pointer;\n color: ", ";\n z-index: 5;\n circle {\n stroke: ", ";\n }\n path {\n stroke: ", ";\n }\n"])), function (props) {
40504
40709
  return props.color;
40505
40710
  }, function (props) {
40506
40711
  return props.$backgroundColor;
40507
40712
  }, function (props) {
40508
40713
  return props.$backgroundColor;
40509
40714
  });
40510
- var AttachmentName = styled.h3(_templateObject9$9 || (_templateObject9$9 = _taggedTemplateLiteralLoose(["\n font-size: 15px;\n font-weight: 500;\n line-height: 18px;\n color: ", ";\n max-width: 275px;\n white-space: nowrap;\n margin: 0;\n"])), function (props) {
40715
+ var AttachmentName = styled.h3(_templateObject1$8 || (_templateObject1$8 = _taggedTemplateLiteralLoose(["\n font-size: 15px;\n font-weight: 500;\n line-height: 18px;\n color: ", ";\n max-width: 275px;\n white-space: nowrap;\n margin: 0;\n"])), function (props) {
40511
40716
  return props.color;
40512
40717
  });
40513
- var AttachmentSize = styled.span(_templateObject0$8 || (_templateObject0$8 = _taggedTemplateLiteralLoose(["\n font-size: 13px;\n color: ", ";\n & > span {\n color: ", ";\n margin-left: 8px;\n }\n"])), function (props) {
40718
+ var AttachmentSize = styled.span(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose(["\n font-size: 13px;\n color: ", ";\n & > span {\n color: ", ";\n margin-left: 8px;\n }\n"])), function (props) {
40514
40719
  return props.color;
40515
40720
  }, function (props) {
40516
40721
  return props.errorColor;
40517
40722
  });
40518
- var AttachmentFileInfo = styled.div(_templateObject1$8 || (_templateObject1$8 = _taggedTemplateLiteralLoose(["\n margin-left: 12px;\n ", "\n"])), function (props) {
40723
+ var AttachmentFileInfo = styled.div(_templateObject11$5 || (_templateObject11$5 = _taggedTemplateLiteralLoose(["\n margin-left: 12px;\n ", "\n"])), function (props) {
40519
40724
  return props.isPreview && "line-height: 14px;\n max-width: calc(100% - 44px);\n ";
40520
40725
  });
40521
- var AttachmentImg = styled.img(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose(["\n position: ", ";\n border-radius: ", ";\n padding: ", ";\n box-sizing: border-box;\n width: ", ";\n height: ", ";\n object-fit: cover;\n visibility: ", ";\n z-index: 2;\n opacity: ", ";\n transition: opacity 0.3s ease-in-out;\n"])), function (props) {
40726
+ var AttachmentImg = styled.img(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n position: ", ";\n border-radius: ", ";\n padding: ", ";\n box-sizing: border-box;\n width: ", ";\n height: ", ";\n object-fit: cover;\n visibility: ", ";\n z-index: 2;\n opacity: ", ";\n transition: opacity 0.3s ease-in-out;\n"])), function (props) {
40522
40727
  return props.absolute && 'absolute';
40523
40728
  }, function (props) {
40524
40729
  return props.isRepliedMessage ? '4px' : props.borderRadius || '6px';
@@ -40533,7 +40738,7 @@ var AttachmentImg = styled.img(_templateObject10$6 || (_templateObject10$6 = _ta
40533
40738
  }, function (props) {
40534
40739
  return props.$shouldAnimate && !props.$isLoaded ? 0 : 1;
40535
40740
  });
40536
- var VideoCont = styled.div(_templateObject11$5 || (_templateObject11$5 = _taggedTemplateLiteralLoose(["\n position: relative;\n cursor: pointer;\n height: ", ";\n"])), function (props) {
40741
+ var VideoCont = styled.div(_templateObject13$4 || (_templateObject13$4 = _taggedTemplateLiteralLoose(["\n position: relative;\n cursor: pointer;\n height: ", ";\n"])), function (props) {
40537
40742
  return props.isDetailsView && '100%';
40538
40743
  });
40539
40744
 
@@ -41916,7 +42121,7 @@ function SvgFilledCheckbox(props) {
41916
42121
  })));
41917
42122
  }
41918
42123
 
41919
- var _templateObject$G, _templateObject2$B, _templateObject3$v, _templateObject4$q, _templateObject5$l, _templateObject6$i, _templateObject7$h, _templateObject8$f, _templateObject9$c, _templateObject0$b, _templateObject1$b, _templateObject10$9, _templateObject11$6, _templateObject12$4;
42124
+ var _templateObject$G, _templateObject2$B, _templateObject3$v, _templateObject4$q, _templateObject5$l, _templateObject6$i, _templateObject7$h, _templateObject8$f, _templateObject9$c, _templateObject0$b, _templateObject1$b, _templateObject10$9, _templateObject11$6, _templateObject12$5;
41920
42125
  var PollMessage = function PollMessage(_ref) {
41921
42126
  var _poll$voteDetails3, _poll$voteDetails4, _poll$voteDetails5, _poll$voteDetails6, _poll$voteDetails7;
41922
42127
  var message = _ref.message,
@@ -42107,7 +42312,7 @@ var Bar = styled.div(_templateObject10$9 || (_templateObject10$9 = _taggedTempla
42107
42312
  return p.track;
42108
42313
  });
42109
42314
  var Fill = styled.div(_templateObject11$6 || (_templateObject11$6 = _taggedTemplateLiteralLoose(["\n height: 100%;\n border-radius: 6px;\n transition: width 0.3s ease-in-out;\n"])));
42110
- var UsersContainer = styled.div(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-left: auto;\n padding-left: 16px;\n height: max-content;\n cursor: ", ";\n"])), function (p) {
42315
+ var UsersContainer = styled.div(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-left: auto;\n padding-left: 16px;\n height: max-content;\n cursor: ", ";\n"])), function (p) {
42111
42316
  return p.cursor;
42112
42317
  });
42113
42318
 
@@ -43682,7 +43887,7 @@ function SvgCircleDashed(props) {
43682
43887
  })));
43683
43888
  }
43684
43889
 
43685
- var _templateObject$L, _templateObject2$G, _templateObject3$A, _templateObject4$v, _templateObject5$q, _templateObject6$m, _templateObject7$l, _templateObject8$j, _templateObject9$g, _templateObject0$f, _templateObject1$d, _templateObject10$a, _templateObject11$7, _templateObject12$5, _templateObject13$4;
43890
+ var _templateObject$L, _templateObject2$G, _templateObject3$A, _templateObject4$v, _templateObject5$q, _templateObject6$m, _templateObject7$l, _templateObject8$j, _templateObject9$g, _templateObject0$f, _templateObject1$d, _templateObject10$a, _templateObject11$7, _templateObject12$6, _templateObject13$5;
43686
43891
  var defaultFormatDate = function defaultFormatDate(date) {
43687
43892
  var m = moment(date);
43688
43893
  if (m.isSame(moment(), 'day')) {
@@ -44305,10 +44510,10 @@ var Content = styled.div(_templateObject1$d || (_templateObject1$d = _taggedTemp
44305
44510
  });
44306
44511
  var P2PStatusList = styled.div(_templateObject10$a || (_templateObject10$a = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n"])));
44307
44512
  var P2PStatusRow = styled.div(_templateObject11$7 || (_templateObject11$7 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 4px;\n height: 48px;\n"])));
44308
- var P2PStatusLabel = styled.div(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-family: Inter;\n font-weight: 500;\n font-size: 15px;\n line-height: 18px;\n letter-spacing: -0.2px;\n"])), function (p) {
44513
+ var P2PStatusLabel = styled.div(_templateObject12$6 || (_templateObject12$6 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-family: Inter;\n font-weight: 500;\n font-size: 15px;\n line-height: 18px;\n letter-spacing: -0.2px;\n"])), function (p) {
44309
44514
  return p.color;
44310
44515
  });
44311
- var P2PStatusDate = styled.div(_templateObject13$4 || (_templateObject13$4 = _taggedTemplateLiteralLoose(["\n color: ", ";\n min-width: max-content;\n font-family: Inter;\n font-weight: 400;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (p) {
44516
+ var P2PStatusDate = styled.div(_templateObject13$5 || (_templateObject13$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n min-width: max-content;\n font-family: Inter;\n font-weight: 400;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (p) {
44312
44517
  return p.color;
44313
44518
  });
44314
44519
 
@@ -45055,48 +45260,10 @@ var Message$1 = function Message(_ref) {
45055
45260
  return marker.name === MESSAGE_DELIVERY_STATUS.READ;
45056
45261
  }));
45057
45262
  var shouldSendReadMarker = isVisible && message.incoming && !alreadyRead && !disableAutoReadTracking && isTabActive && !!channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED;
45058
- if (message.incoming && isVisible) {
45059
- if (shouldSendReadMarker) {
45060
- log.info('[READ_MESSAGE] Message auto-read gate passed', compactReadMessageLogData({
45061
- source: 'message',
45062
- channelId: channel.id,
45063
- messageId: message.id,
45064
- isVisible: isVisible,
45065
- alreadyRead: alreadyRead,
45066
- disableAutoReadTracking: disableAutoReadTracking,
45067
- isTabActive: isTabActive,
45068
- newMessageCount: channel.newMessageCount || 0,
45069
- connectionStatus: connectionStatus,
45070
- queued: !!queueReadMarker
45071
- }));
45072
- } else {
45073
- log.info('[READ_MESSAGE] Message auto-read gate blocked', compactReadMessageLogData({
45074
- source: 'message',
45075
- channelId: channel.id,
45076
- messageId: message.id,
45077
- isVisible: isVisible,
45078
- alreadyRead: alreadyRead,
45079
- disableAutoReadTracking: disableAutoReadTracking,
45080
- isTabActive: isTabActive,
45081
- newMessageCount: channel.newMessageCount || 0,
45082
- connectionStatus: connectionStatus
45083
- }));
45084
- }
45085
- }
45086
45263
  if (shouldSendReadMarker) {
45087
45264
  if (queueReadMarker) {
45088
- log.info('[READ_MESSAGE] Queueing read marker from Message component', compactReadMessageLogData({
45089
- source: 'message',
45090
- channelId: channel.id,
45091
- messageId: message.id
45092
- }));
45093
45265
  queueReadMarker(channel.id, message.id);
45094
45266
  } else {
45095
- log.info('[READ_MESSAGE] Dispatching read marker directly from Message component', compactReadMessageLogData({
45096
- source: 'message',
45097
- channelId: channel.id,
45098
- messageId: message.id
45099
- }));
45100
45267
  dispatch(markMessagesAsReadAC(channel.id, [message.id]));
45101
45268
  }
45102
45269
  }
@@ -45139,14 +45306,6 @@ var Message$1 = function Message(_ref) {
45139
45306
  }, [dispatch, selectionIsActive]);
45140
45307
  useEffect(function () {
45141
45308
  if (isVisible) {
45142
- if (message.incoming) {
45143
- log.info('[READ_MESSAGE] Message row became visible', compactReadMessageLogData({
45144
- source: 'message',
45145
- channelId: channel.id,
45146
- messageId: message.id,
45147
- localRef: message.tid || message.id || ''
45148
- }));
45149
- }
45150
45309
  if (setLastVisibleMessageId) {
45151
45310
  setLastVisibleMessageId(message);
45152
45311
  }
@@ -46157,14 +46316,6 @@ function useChatController(_ref5) {
46157
46316
  }, [clearJumpScrollingLock]);
46158
46317
  var queueVisibleUnreadCheck = useCallback(function () {
46159
46318
  if (pendingVisibleUnreadFrameRef.current !== null || unreadScrollTo || !tabIsActive) {
46160
- if (!tabIsActive) {
46161
- log.info('[READ_MESSAGE] Visible unread scan skipped because tab is inactive', compactReadMessageLogData({
46162
- source: 'controller',
46163
- channelId: channel.id,
46164
- unreadScrollTo: unreadScrollTo,
46165
- pendingFrameScheduled: pendingVisibleUnreadFrameRef.current !== null
46166
- }));
46167
- }
46168
46319
  return;
46169
46320
  }
46170
46321
  pendingVisibleUnreadFrameRef.current = requestAnimationFrame(function () {
@@ -46199,35 +46350,13 @@ function useChatController(_ref5) {
46199
46350
  var ids = visibleUnreadMessages.filter(isUnreadIncomingMessage).map(function (message) {
46200
46351
  return message.id;
46201
46352
  });
46202
- if (visibleUnreadMessages.length && !ids.length) {
46203
- log.info('[READ_MESSAGE] Visible unread scan found messages, but none were unread incoming', compactReadMessageLogData({
46204
- source: 'controller',
46205
- channelId: channel.id,
46206
- visibleCandidateIds: visibleUnreadMessages.map(function (message) {
46207
- return message.id;
46208
- })
46209
- }));
46210
- }
46211
46353
  if (!ids.length || !channel.id || !channel.newMessageCount) {
46212
- if (ids.length && (!channel.id || !channel.newMessageCount)) {
46213
- log.info('[READ_MESSAGE] Visible unread scan blocked before dispatch', compactReadMessageLogData({
46214
- source: 'controller',
46215
- channelId: channel.id,
46216
- messageIds: ids,
46217
- newMessageCount: channel.newMessageCount || 0
46218
- }));
46219
- }
46220
46354
  return;
46221
46355
  }
46222
46356
  ids.forEach(function (id) {
46223
46357
  visibleUnreadReportedRef.current.add(id);
46224
46358
  });
46225
46359
  registerLocallyReadUnreadMessages(ids.length);
46226
- log.info('[READ_MESSAGE] Dispatching read marker from visible unread scan', compactReadMessageLogData({
46227
- source: 'controller',
46228
- channelId: channel.id,
46229
- messageIds: ids
46230
- }));
46231
46360
  dispatch(markMessagesAsReadAC(channel.id, ids));
46232
46361
  });
46233
46362
  }, [channel.id, channel.lastDisplayedMessageId, channel.newMessageCount, dispatch, hasNext, messages, registerLocallyReadUnreadMessages, unreadScrollTo, tabIsActive]);
@@ -50102,24 +50231,26 @@ var Action$1 = styled.button(_templateObject2$M || (_templateObject2$M = _tagged
50102
50231
 
50103
50232
  function EditMessagePlugin(_ref) {
50104
50233
  var editMessage = _ref.editMessage,
50234
+ draftMessage = _ref.draftMessage,
50105
50235
  contactsMap = _ref.contactsMap,
50106
50236
  getFromContacts = _ref.getFromContacts,
50107
50237
  setMentionedMember = _ref.setMentionedMember;
50108
50238
  var _useLexicalComposerCo = useLexicalComposerContext(),
50109
50239
  editor = _useLexicalComposerCo[0];
50110
50240
  useDidUpdate(function () {
50111
- if (editMessage) {
50112
- if (editMessage.mentionedUsers && editMessage.mentionedUsers.length) {
50113
- setMentionedMember(editMessage.mentionedUsers);
50241
+ var editorMessage = draftMessage || editMessage;
50242
+ if (editorMessage) {
50243
+ if (editorMessage.mentionedUsers && editorMessage.mentionedUsers.length) {
50244
+ setMentionedMember(editorMessage.mentionedUsers);
50114
50245
  }
50115
50246
  editor.update(function () {
50116
50247
  var rootNode = $getRoot();
50117
50248
  $getRoot().clear();
50118
50249
  var paragraphNode = $createParagraphNode();
50119
- var textPart = editMessage.body;
50250
+ var textPart = editorMessage.body;
50120
50251
  var nextPartIndex;
50121
- if (editMessage.bodyAttributes && editMessage.bodyAttributes.length) {
50122
- var bodyAttributes = JSON.parse(JSON.stringify(editMessage.bodyAttributes));
50252
+ if (editorMessage.bodyAttributes && editorMessage.bodyAttributes.length) {
50253
+ var bodyAttributes = JSON.parse(JSON.stringify(editorMessage.bodyAttributes));
50123
50254
  var modifiedAttributes = [];
50124
50255
  bodyAttributes.sort(function (a, b) {
50125
50256
  return a.offset - b.offset;
@@ -50157,7 +50288,7 @@ function EditMessagePlugin(_ref) {
50157
50288
  var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
50158
50289
  nextPartIndex = attribute.offset + attribute.length;
50159
50290
  if (attribute.type.includes('mention')) {
50160
- var mentionUser = editMessage.mentionedUsers.find(function (mention) {
50291
+ var mentionUser = editorMessage.mentionedUsers.find(function (mention) {
50161
50292
  return mention.id === attribute.metadata;
50162
50293
  });
50163
50294
  if (mentionUser) {
@@ -50259,13 +50390,13 @@ function EditMessagePlugin(_ref) {
50259
50390
  rootNode.append(paragraphNode);
50260
50391
  rootNode.selectEnd();
50261
50392
  } else {
50262
- paragraphNode.append($createTextNode(editMessage.body));
50393
+ paragraphNode.append($createTextNode(editorMessage.body));
50263
50394
  rootNode.append(paragraphNode);
50264
50395
  rootNode.selectEnd();
50265
50396
  }
50266
50397
  });
50267
50398
  }
50268
- }, [editMessage]);
50399
+ }, [editMessage, draftMessage]);
50269
50400
  return null;
50270
50401
  }
50271
50402
 
@@ -50484,25 +50615,12 @@ function useFormatMessage(editor, editorState, setMessageBodyAttributes, setMess
50484
50615
  }
50485
50616
  return true;
50486
50617
  }, [editor, contactsMap, setMentionedMember, getFromContacts, activeChannelMembers, processMentionsInPastedText]);
50487
- var onDelete = useCallback(function (event) {
50488
- event.preventDefault();
50489
- editor.update(function () {
50490
- var selection = $getSelection();
50491
- if ($isRangeSelection(selection)) {
50492
- var node = getSelectedNode(selection);
50493
- if ($isMentionNode(node)) {
50494
- node.remove();
50495
- }
50496
- }
50497
- });
50498
- return false;
50499
- }, [editor]);
50500
50618
  useEffect(function () {
50501
50619
  return mergeRegister(editor.registerCommand(PASTE_COMMAND, function (e) {
50502
50620
  handlePast(e);
50503
50621
  return true;
50504
- }, COMMAND_PRIORITY_NORMAL), editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW));
50505
- }, [editor, handlePast, onDelete]);
50622
+ }, COMMAND_PRIORITY_NORMAL));
50623
+ }, [editor, handlePast]);
50506
50624
  useDidUpdate(function () {
50507
50625
  if (editorState) {
50508
50626
  editorState.read(function () {
@@ -50841,6 +50959,18 @@ var Emoji$1 = styled.li(_templateObject8$l || (_templateObject8$l = _taggedTempl
50841
50959
  return props.hoverBackgroundColor;
50842
50960
  });
50843
50961
 
50962
+ var getReplyLinkPreviewImage = function getReplyLinkPreviewImage(attachments) {
50963
+ var _attachments$;
50964
+ var attachment = attachments !== null && attachments !== void 0 && attachments.length && ((_attachments$ = attachments[0]) === null || _attachments$ === void 0 ? void 0 : _attachments$.type) === attachmentTypes.link ? attachments[0] : null;
50965
+ if (!(attachment !== null && attachment !== void 0 && attachment.metadata) || !isJSON(attachment.metadata)) return null;
50966
+ var compactMeta = JSON.parse(attachment.metadata);
50967
+ var imageUrl = compactMeta.iur || null;
50968
+ return !(compactMeta !== null && compactMeta !== void 0 && compactMeta.hld) ? imageUrl : null;
50969
+ };
50970
+ var shouldShowLinkPreviewErrorFallback = function shouldShowLinkPreviewErrorFallback(imageUrl, imageFailed) {
50971
+ return Boolean(imageUrl && imageFailed);
50972
+ };
50973
+
50844
50974
  var CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
50845
50975
 
50846
50976
  var _circle$6, _path$1j;
@@ -51150,8 +51280,10 @@ var AudioRecord = function AudioRecord(_ref) {
51150
51280
  warningColor = _useColor[THEME_COLORS.WARNING],
51151
51281
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
51152
51282
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
51283
+ textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
51153
51284
  iconInactive = _useColor[THEME_COLORS.ICON_INACTIVE],
51154
- textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
51285
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY],
51286
+ background = _useColor[THEME_COLORS.BACKGROUND];
51155
51287
  var _useState = useState(null),
51156
51288
  recording = _useState[0],
51157
51289
  setStartRecording = _useState[1];
@@ -51179,6 +51311,9 @@ var AudioRecord = function AudioRecord(_ref) {
51179
51311
  var _useState9 = useState(false),
51180
51312
  playAudio = _useState9[0],
51181
51313
  setPlayAudio = _useState9[1];
51314
+ var _useState0 = useState(false),
51315
+ microphonePermissionDenied = _useState0[0],
51316
+ setMicrophonePermissionDenied = _useState0[1];
51182
51317
  var recordButtonRef = useRef(null);
51183
51318
  var audioElements = useRef({});
51184
51319
  var intervalRef = useRef({});
@@ -51268,27 +51403,21 @@ var AudioRecord = function AudioRecord(_ref) {
51268
51403
  var startRecording = function startRecording(cId) {
51269
51404
  try {
51270
51405
  var id = cId || currentChannelId;
51271
- var _temp = _catch(function () {
51272
- return Promise.resolve(navigator.permissions.query({
51273
- name: 'microphone'
51274
- })).then(function (permissionStatus) {
51275
- if (permissionStatus.state === 'granted') {
51276
- setShowRecording(true);
51277
- } else {
51278
- recordButtonRef.current.style.pointerEvents = 'none';
51279
- }
51280
- if (recording) {
51281
- stopRecording(true, id, false, recorder);
51282
- } else if (currentRecordedFile) {
51283
- removeAudioRecordingFromMap(id);
51284
- setRecordedFile(null);
51285
- setPlayAudio(false);
51286
- cleanupAudioElement(id);
51287
- setStartRecording(false);
51288
- setShowRecording(false);
51289
- dispatch(setChannelDraftMessageIsRemovedAC(id));
51290
- sendRecordedFile(currentRecordedFile, id);
51291
- } else {
51406
+ try {
51407
+ if (recording) {
51408
+ stopRecording(true, id, false, recorder);
51409
+ } else if (currentRecordedFile) {
51410
+ removeAudioRecordingFromMap(id);
51411
+ setRecordedFile(null);
51412
+ setPlayAudio(false);
51413
+ cleanupAudioElement(id);
51414
+ setStartRecording(false);
51415
+ setShowRecording(false);
51416
+ dispatch(setChannelDraftMessageIsRemovedAC(id));
51417
+ sendRecordedFile(currentRecordedFile, id);
51418
+ } else {
51419
+ if (!recorder) return Promise.resolve();
51420
+ recorder.start().then(function () {
51292
51421
  handleStartRecording();
51293
51422
  setAudioRecordingToMap(id, {
51294
51423
  file: null,
@@ -51296,96 +51425,97 @@ var AudioRecord = function AudioRecord(_ref) {
51296
51425
  thumb: null,
51297
51426
  dur: 0
51298
51427
  });
51299
- recorder.start().then(function () {
51300
- recordButtonRef.current.style.pointerEvents = 'initial';
51301
- setShowRecording(true);
51302
- setStartRecording(true);
51303
- shouldDraw = true;
51304
- var stream = recorder.activeStream;
51305
- var obj = {};
51306
- var init = function init() {
51307
- obj.canvas = document.getElementById("waveform-" + id);
51308
- obj.ctx = obj.canvas.getContext('2d');
51309
- obj.width = 360;
51310
- obj.height = 28;
51311
- obj.canvas.width = obj.width;
51312
- obj.canvas.height = obj.height;
51313
- obj.canvas.style.width = obj.width + 'px';
51314
- obj.canvas.style.height = obj.height + 'px';
51315
- };
51316
- var timeOffset = 100;
51317
- var now = parseInt(performance.now()) / timeOffset;
51318
- var _loop = function loop() {
51319
- if (!shouldDraw) {
51320
- obj.x = 0;
51321
- obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51322
- if (obj.audioContext && obj.audioContext.state !== 'closed') {
51323
- obj.audioContext.close()["catch"](function () {
51324
- return undefined;
51325
- });
51326
- }
51327
- return;
51328
- }
51428
+ setShowRecording(true);
51429
+ setStartRecording(true);
51430
+ shouldDraw = true;
51431
+ var stream = recorder.activeStream;
51432
+ var obj = {};
51433
+ var init = function init() {
51434
+ obj.canvas = document.getElementById("waveform-" + id);
51435
+ obj.ctx = obj.canvas.getContext('2d');
51436
+ obj.width = 360;
51437
+ obj.height = 28;
51438
+ obj.canvas.width = obj.width;
51439
+ obj.canvas.height = obj.height;
51440
+ obj.canvas.style.width = obj.width + 'px';
51441
+ obj.canvas.style.height = obj.height + 'px';
51442
+ };
51443
+ var timeOffset = 100;
51444
+ var now = parseInt(performance.now()) / timeOffset;
51445
+ var _loop = function loop() {
51446
+ if (!shouldDraw) {
51447
+ obj.x = 0;
51329
51448
  obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51330
- var max = 0;
51331
- if (parseInt(performance.now() / timeOffset) > now) {
51332
- now = parseInt(performance.now() / timeOffset);
51333
- obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51334
- for (var i = 0; i < obj.frequencyArray.length; i++) {
51335
- if (obj.frequencyArray[i] > max) {
51336
- max = obj.frequencyArray[i];
51337
- }
51338
- }
51339
- var freq = Math.floor(max * 90);
51340
- if (freq === 0) {
51341
- freq = 1;
51342
- }
51343
- obj.bars.push({
51344
- x: obj.width,
51345
- y: obj.height / 2 - freq / 2,
51346
- height: freq,
51347
- width: 3
51449
+ if (obj.audioContext && obj.audioContext.state !== 'closed') {
51450
+ obj.audioContext.close()["catch"](function () {
51451
+ return undefined;
51348
51452
  });
51349
51453
  }
51350
- draw();
51351
- requestAnimationFrame(_loop);
51352
- };
51353
- obj.bars = [];
51354
- var draw = function draw() {
51355
- for (var i = 0; i < obj.bars.length; i++) {
51356
- var bar = obj.bars[i];
51357
- obj.ctx.fillStyle = textSecondary;
51358
- obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51359
- bar.x = bar.x - 1;
51360
- if (bar.x < 1) {
51361
- obj.bars.splice(i, 1);
51454
+ return;
51455
+ }
51456
+ obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51457
+ var max = 0;
51458
+ if (parseInt(performance.now() / timeOffset) > now) {
51459
+ now = parseInt(performance.now() / timeOffset);
51460
+ obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51461
+ for (var i = 0; i < obj.frequencyArray.length; i++) {
51462
+ if (obj.frequencyArray[i] > max) {
51463
+ max = obj.frequencyArray[i];
51362
51464
  }
51363
51465
  }
51364
- };
51365
- var soundAllowed = function soundAllowed(stream) {
51366
- var AudioContext = window.AudioContext || window.webkitAudioContext;
51367
- var audioContent = new AudioContext();
51368
- obj.audioContext = audioContent;
51369
- var streamSource = audioContent.createMediaStreamSource(stream);
51370
- obj.analyser = audioContent.createAnalyser();
51371
- streamSource.connect(obj.analyser);
51372
- obj.analyser.fftSize = 512;
51373
- obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51374
- init();
51375
- _loop();
51376
- };
51377
- soundAllowed(stream);
51378
- })["catch"](function (e) {
51379
- handleStopRecording();
51380
- log.error(e);
51381
- });
51382
- }
51383
- });
51384
- }, function (e) {
51385
- handleStopRecording();
51466
+ var freq = Math.floor(max * 90);
51467
+ if (freq === 0) {
51468
+ freq = 1;
51469
+ }
51470
+ obj.bars.push({
51471
+ x: obj.width,
51472
+ y: obj.height / 2 - freq / 2,
51473
+ height: freq,
51474
+ width: 3
51475
+ });
51476
+ }
51477
+ draw();
51478
+ requestAnimationFrame(_loop);
51479
+ };
51480
+ obj.bars = [];
51481
+ var draw = function draw() {
51482
+ for (var i = 0; i < obj.bars.length; i++) {
51483
+ var bar = obj.bars[i];
51484
+ obj.ctx.fillStyle = textSecondary;
51485
+ obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51486
+ bar.x = bar.x - 1;
51487
+ if (bar.x < 1) {
51488
+ obj.bars.splice(i, 1);
51489
+ }
51490
+ }
51491
+ };
51492
+ var soundAllowed = function soundAllowed(stream) {
51493
+ var AudioContext = window.AudioContext || window.webkitAudioContext;
51494
+ var audioContent = new AudioContext();
51495
+ obj.audioContext = audioContent;
51496
+ var streamSource = audioContent.createMediaStreamSource(stream);
51497
+ obj.analyser = audioContent.createAnalyser();
51498
+ streamSource.connect(obj.analyser);
51499
+ obj.analyser.fftSize = 512;
51500
+ obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51501
+ init();
51502
+ _loop();
51503
+ };
51504
+ soundAllowed(stream);
51505
+ })["catch"](function (e) {
51506
+ if ((e === null || e === void 0 ? void 0 : e.name) === 'NotAllowedError' || (e === null || e === void 0 ? void 0 : e.name) === 'PermissionDeniedError') {
51507
+ setMicrophonePermissionDenied(true);
51508
+ }
51509
+ log.error(e);
51510
+ });
51511
+ }
51512
+ } catch (e) {
51513
+ if ((e === null || e === void 0 ? void 0 : e.name) === 'NotAllowedError' || (e === null || e === void 0 ? void 0 : e.name) === 'PermissionDeniedError') {
51514
+ setMicrophonePermissionDenied(true);
51515
+ }
51386
51516
  log.error(e);
51387
- });
51388
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51517
+ }
51518
+ return Promise.resolve();
51389
51519
  } catch (e) {
51390
51520
  return Promise.reject(e);
51391
51521
  }
@@ -51710,7 +51840,36 @@ var AudioRecord = function AudioRecord(_ref) {
51710
51840
  return startRecording(currentChannelId);
51711
51841
  },
51712
51842
  iconColor: accentColor
51713
- }, showRecording || currentRecordedFile ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)));
51843
+ }, showRecording || currentRecordedFile ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)), microphonePermissionDenied && (/*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
51844
+ backgroundColor: background,
51845
+ maxWidth: '520px',
51846
+ minWidth: '520px',
51847
+ padding: '0'
51848
+ }, /*#__PURE__*/React__default.createElement(PopupBody, {
51849
+ paddingH: '24px',
51850
+ paddingV: '24px'
51851
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, {
51852
+ color: iconPrimary,
51853
+ onClick: function onClick() {
51854
+ return setMicrophonePermissionDenied(false);
51855
+ }
51856
+ }), /*#__PURE__*/React__default.createElement(PopupName, {
51857
+ color: textPrimary,
51858
+ marginBottom: '20px'
51859
+ }, "Microphone Permission Denied"), /*#__PURE__*/React__default.createElement(PopupDescription, {
51860
+ color: textPrimary,
51861
+ highlightColor: textSecondary
51862
+ }, "We can't access your microphone. Enable microphone permission in your browser settings and try again.")), /*#__PURE__*/React__default.createElement(PopupFooter, {
51863
+ backgroundColor: surface1
51864
+ }, /*#__PURE__*/React__default.createElement(Button, {
51865
+ type: 'button',
51866
+ backgroundColor: accentColor,
51867
+ color: textOnPrimary,
51868
+ borderRadius: '8px',
51869
+ onClick: function onClick() {
51870
+ return setMicrophonePermissionDenied(false);
51871
+ }
51872
+ }, "Close"))))));
51714
51873
  };
51715
51874
  var AudioRecord$1 = /*#__PURE__*/memo(AudioRecord, function (prevProps, nextProps) {
51716
51875
  return prevProps.channelId === nextProps.channelId && prevProps.showRecording === nextProps.showRecording && prevProps.maxRecordingDuration === nextProps.maxRecordingDuration && prevProps.showViewOnceToggle === nextProps.showViewOnceToggle && prevProps.viewOnce === nextProps.viewOnce && prevProps.ViewOnceSelectedSVGIcon === nextProps.ViewOnceSelectedSVGIcon && prevProps.ViewOnceNotSelectedSVGIcon === nextProps.ViewOnceNotSelectedSVGIcon;
@@ -52235,7 +52394,7 @@ var SettingItem = styled.div(_templateObject9$i || (_templateObject9$i = _tagged
52235
52394
  return props.color;
52236
52395
  });
52237
52396
 
52238
- var _templateObject$W, _templateObject2$R, _templateObject3$I, _templateObject4$C, _templateObject5$x, _templateObject6$t, _templateObject7$q, _templateObject8$n, _templateObject9$j, _templateObject0$h, _templateObject1$f, _templateObject10$c, _templateObject11$9, _templateObject12$6, _templateObject13$5, _templateObject14$4, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$2, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1, _templateObject35$1, _templateObject36$1, _templateObject37$1, _templateObject38$1, _templateObject39$1, _templateObject40$1, _templateObject41$1, _templateObject42, _templateObject43, _templateObject44, _templateObject45;
52397
+ var _templateObject$W, _templateObject2$R, _templateObject3$I, _templateObject4$C, _templateObject5$x, _templateObject6$t, _templateObject7$q, _templateObject8$n, _templateObject9$j, _templateObject0$h, _templateObject1$f, _templateObject10$c, _templateObject11$9, _templateObject12$7, _templateObject13$6, _templateObject14$4, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$2, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1, _templateObject35$1, _templateObject36$1, _templateObject37$1, _templateObject38$1, _templateObject39$1, _templateObject40$1, _templateObject41$1, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46;
52239
52398
  function AutoFocusPlugin(_ref) {
52240
52399
  var messageForReply = _ref.messageForReply;
52241
52400
  var _useLexicalComposerCo = useLexicalComposerContext(),
@@ -52253,12 +52412,16 @@ function ClearEditorPlugin(_ref2) {
52253
52412
  useDidUpdate(function () {
52254
52413
  if (shouldClearEditor.clear) {
52255
52414
  editor.update(function () {
52415
+ var _shouldClearEditor$dr;
52256
52416
  var rootNode = $getRoot();
52257
52417
  rootNode.clear();
52258
- if (shouldClearEditor.draftMessage) {
52418
+ if ((_shouldClearEditor$dr = shouldClearEditor.draftMessage) !== null && _shouldClearEditor$dr !== void 0 && _shouldClearEditor$dr.editorState) {
52419
+ editor.setEditorState(shouldClearEditor.draftMessage.editorState);
52420
+ } else if (shouldClearEditor.draftMessage) {
52259
52421
  var paragraphNode = $createParagraphNode();
52260
52422
  paragraphNode.append($createTextNode(shouldClearEditor.draftMessage.text));
52261
- editor.setEditorState(shouldClearEditor.draftMessage.editorState);
52423
+ rootNode.append(paragraphNode);
52424
+ rootNode.selectEnd();
52262
52425
  } else {
52263
52426
  var _paragraphNode = $createParagraphNode();
52264
52427
  rootNode.append(_paragraphNode);
@@ -52298,7 +52461,7 @@ function onError(error) {
52298
52461
  var prevActiveChannelId;
52299
52462
  var attachmentsUpdate = [];
52300
52463
  var SendMessageInput = function SendMessageInput(_ref3) {
52301
- var _linkPreview$metadata9, _linkPreview$metadata0, _linkPreview$metadata1, _linkPreview$metadata10, _linkPreview$metadata11, _linkPreview$metadata12, _linkPreview$metadata13, _linkPreview$metadata14, _linkPreview$metadata15, _linkPreview$metadata16, _linkPreview$metadata17, _linkPreview$metadata18, _pollOptions$choosePo, _getAudioRecordingFro2;
52464
+ var _linkPreview$metadata9, _linkPreview$metadata0, _linkPreview$metadata1, _linkPreview$metadata10, _linkPreview$metadata11, _linkPreview$metadata12, _linkPreview$metadata13, _linkPreview$metadata14, _linkPreview$metadata15, _linkPreview$metadata16, _linkPreview$metadata17, _linkPreview$metadata18, _linkPreview$metadata19, _linkPreview$metadata20, _linkPreview$metadata21, _pollOptions$choosePo, _getAudioRecordingFro2;
52302
52465
  var handleAttachmentSelected = _ref3.handleAttachmentSelected,
52303
52466
  handleSendMessage = _ref3.handleSendMessage,
52304
52467
  _ref3$disabled = _ref3.disabled,
@@ -52435,84 +52598,90 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52435
52598
  var _useState4 = useState(''),
52436
52599
  editMessageText = _useState4[0],
52437
52600
  setEditMessageText = _useState4[1];
52438
- var _useState5 = useState({}),
52439
- readyVideoAttachments = _useState5[0],
52440
- setReadyVideoAttachments = _useState5[1];
52441
- var _useState6 = useState(false),
52442
- showChooseAttachmentType = _useState6[0],
52443
- setShowChooseAttachmentType = _useState6[1];
52601
+ var _useState5 = useState(null),
52602
+ restoredEditMessage = _useState5[0],
52603
+ setRestoredEditMessage = _useState5[1];
52604
+ var _useState6 = useState({}),
52605
+ readyVideoAttachments = _useState6[0],
52606
+ setReadyVideoAttachments = _useState6[1];
52444
52607
  var _useState7 = useState(false),
52445
- isEmojisOpened = _useState7[0],
52446
- setIsEmojisOpened = _useState7[1];
52608
+ showChooseAttachmentType = _useState7[0],
52609
+ setShowChooseAttachmentType = _useState7[1];
52447
52610
  var _useState8 = useState(false),
52448
- emojisInRightSide = _useState8[0],
52449
- setEmojisInRightSide = _useState8[1];
52450
- var _useState9 = useState(0),
52451
- emojisPopupLeftPosition = _useState9[0],
52452
- setEmojisPopupLeftPosition = _useState9[1];
52611
+ isEmojisOpened = _useState8[0],
52612
+ setIsEmojisOpened = _useState8[1];
52613
+ var _useState9 = useState(false),
52614
+ emojisInRightSide = _useState9[0],
52615
+ setEmojisInRightSide = _useState9[1];
52453
52616
  var _useState0 = useState(0),
52454
- emojisPopupBottomPosition = _useState0[0],
52455
- setEmojisPopupBottomPosition = _useState0[1];
52456
- var _useState1 = useState(false),
52457
- addAttachmentsInRightSide = _useState1[0],
52458
- setAddAttachmentsInRightSide = _useState1[1];
52617
+ emojisPopupLeftPosition = _useState0[0],
52618
+ setEmojisPopupLeftPosition = _useState0[1];
52619
+ var _useState1 = useState(0),
52620
+ emojisPopupBottomPosition = _useState1[0],
52621
+ setEmojisPopupBottomPosition = _useState1[1];
52459
52622
  var _useState10 = useState(false),
52460
- showPoll = _useState10[0],
52461
- setShowPoll = _useState10[1];
52462
- var _useState11 = useState({
52623
+ addAttachmentsInRightSide = _useState10[0],
52624
+ setAddAttachmentsInRightSide = _useState10[1];
52625
+ var _useState11 = useState(false),
52626
+ showPoll = _useState11[0],
52627
+ setShowPoll = _useState11[1];
52628
+ var _useState12 = useState({
52463
52629
  clear: false
52464
52630
  }),
52465
- shouldClearEditor = _useState11[0],
52466
- setShouldClearEditor = _useState11[1];
52467
- var _useState12 = useState([]),
52468
- messageBodyAttributes = _useState12[0],
52469
- setMessageBodyAttributes = _useState12[1];
52631
+ shouldClearEditor = _useState12[0],
52632
+ setShouldClearEditor = _useState12[1];
52470
52633
  var _useState13 = useState([]),
52471
- mentionedUsers = _useState13[0],
52472
- setMentionedUsers = _useState13[1];
52473
- var _useState14 = useState(''),
52474
- browser = _useState14[0],
52475
- setBrowser = _useState14[1];
52476
- var _useState15 = useState(false),
52477
- mentionsIsOpen = _useState15[0],
52478
- setMentionsIsOpen = _useState15[1];
52479
- var _useState16 = useState(),
52480
- inputContainerHeight = _useState16[0],
52481
- setInputContainerHeight = _useState16[1];
52482
- var selectedText = useRef(null);
52634
+ messageBodyAttributes = _useState13[0],
52635
+ setMessageBodyAttributes = _useState13[1];
52636
+ var _useState14 = useState([]),
52637
+ mentionedUsers = _useState14[0],
52638
+ setMentionedUsers = _useState14[1];
52639
+ var _useState15 = useState(''),
52640
+ browser = _useState15[0],
52641
+ setBrowser = _useState15[1];
52642
+ var _useState16 = useState(false),
52643
+ mentionsIsOpen = _useState16[0],
52644
+ setMentionsIsOpen = _useState16[1];
52483
52645
  var _useState17 = useState(),
52484
- typingTimout = _useState17[0],
52485
- setTypingTimout = _useState17[1];
52646
+ inputContainerHeight = _useState17[0],
52647
+ setInputContainerHeight = _useState17[1];
52648
+ var selectedText = useRef(null);
52486
52649
  var _useState18 = useState(),
52487
- inTypingStateTimout = _useState18[0],
52488
- setInTypingStateTimout = _useState18[1];
52489
- var _useState19 = useState(false),
52490
- inTypingState = _useState19[0],
52491
- setInTypingState = _useState19[1];
52650
+ typingTimout = _useState18[0],
52651
+ setTypingTimout = _useState18[1];
52652
+ var _useState19 = useState(),
52653
+ inTypingStateTimout = _useState19[0],
52654
+ setInTypingStateTimout = _useState19[1];
52492
52655
  var _useState20 = useState(false),
52493
- sendMessageIsActive = _useState20[0],
52494
- setSendMessageIsActive = _useState20[1];
52495
- var _useState21 = useState([]),
52496
- attachments = _useState21[0],
52497
- setAttachments = _useState21[1];
52498
- var _useState22 = useState(false),
52499
- forwardPopupOpen = _useState22[0],
52500
- setForwardPopupOpen = _useState22[1];
52656
+ inTypingState = _useState20[0],
52657
+ setInTypingState = _useState20[1];
52658
+ var _useState21 = useState(false),
52659
+ sendMessageIsActive = _useState21[0],
52660
+ setSendMessageIsActive = _useState21[1];
52661
+ var _useState22 = useState([]),
52662
+ attachments = _useState22[0],
52663
+ setAttachments = _useState22[1];
52501
52664
  var _useState23 = useState(false),
52502
- deletePopupOpen = _useState23[0],
52503
- setDeletePopupOpen = _useState23[1];
52665
+ forwardPopupOpen = _useState23[0],
52666
+ setForwardPopupOpen = _useState23[1];
52504
52667
  var _useState24 = useState(false),
52505
- isIncomingMessage = _useState24[0],
52506
- setIsIncomingMessage = _useState24[1];
52507
- var _useState25 = useState('.jpg,.jpeg,.png,.gif,.mp4,.mov,.avi,.wmv,.flv,.webm,.jfif'),
52508
- mediaExtensions = _useState25[0],
52509
- setMediaExtensions = _useState25[1];
52510
- var _useState26 = useState(''),
52511
- uploadErrorMessage = _useState26[0],
52512
- setUploadErrorMessage = _useState26[1];
52513
- var _useState27 = useState(false),
52514
- viewOnce = _useState27[0],
52515
- setViewOnce = _useState27[1];
52668
+ deletePopupOpen = _useState24[0],
52669
+ setDeletePopupOpen = _useState24[1];
52670
+ var _useState25 = useState(false),
52671
+ isIncomingMessage = _useState25[0],
52672
+ setIsIncomingMessage = _useState25[1];
52673
+ var _useState26 = useState('.jpg,.jpeg,.png,.gif,.mp4,.mov,.avi,.wmv,.flv,.webm,.jfif'),
52674
+ mediaExtensions = _useState26[0],
52675
+ setMediaExtensions = _useState26[1];
52676
+ var _useState27 = useState(''),
52677
+ uploadErrorMessage = _useState27[0],
52678
+ setUploadErrorMessage = _useState27[1];
52679
+ var _useState28 = useState(false),
52680
+ viewOnce = _useState28[0],
52681
+ setViewOnce = _useState28[1];
52682
+ var _useState29 = useState(areDraftMessagesHydrated()),
52683
+ draftsHydrated = _useState29[0],
52684
+ setDraftsHydrated = _useState29[1];
52516
52685
  var typingOrRecordingIndicator = useSelector(typingOrRecordingIndicatorArraySelector(activeChannel.id));
52517
52686
  var contactsMap = useSelector(contactsMapSelector);
52518
52687
  var connectionStatus = useSelector(connectionStatusSelector, shallowEqual);
@@ -52524,35 +52693,91 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52524
52693
  var addAttachmentsBtnRef = useRef(null);
52525
52694
  var metadataDebounceRef = useRef(null);
52526
52695
  var sendMessageWrapperRef = useRef(null);
52527
- var _useState28 = useState(),
52528
- realEditorState = _useState28[0],
52529
- setRealEditorState = _useState28[1];
52530
- var _useState29 = useState(null),
52531
- floatingAnchorElem = _useState29[0],
52532
- setFloatingAnchorElem = _useState29[1];
52533
- var _useState30 = useState(false),
52534
- isSmallWidthViewport = _useState30[0],
52535
- setIsSmallWidthViewport = _useState30[1];
52536
- var _useState31 = useState(false),
52537
- isScrolling = _useState31[0],
52538
- setIsScrolling = _useState31[1];
52539
- var _useState32 = useState(null),
52540
- linkPreview = _useState32[0],
52541
- setLinkPreview = _useState32[1];
52542
- var _useState33 = useState(null),
52543
- detectedUrl = _useState33[0],
52544
- setDetectedUrl = _useState33[1];
52545
- var _useState34 = useState(new Set()),
52546
- dismissedUrls = _useState34[0],
52547
- setDismissedUrls = _useState34[1];
52548
- var _useState35 = useState(false),
52549
- isClosingPreview = _useState35[0],
52550
- setIsClosingPreview = _useState35[1];
52696
+ var restoringDraftRef = useRef(false);
52697
+ var restoredDraftChannelIdRef = useRef(null);
52698
+ var isNavigatingChannelRef = useRef(false);
52699
+ var _useState30 = useState(),
52700
+ realEditorState = _useState30[0],
52701
+ setRealEditorState = _useState30[1];
52702
+ var _useState31 = useState(null),
52703
+ floatingAnchorElem = _useState31[0],
52704
+ setFloatingAnchorElem = _useState31[1];
52705
+ var _useState32 = useState(false),
52706
+ isSmallWidthViewport = _useState32[0],
52707
+ setIsSmallWidthViewport = _useState32[1];
52708
+ var _useState33 = useState(false),
52709
+ isScrolling = _useState33[0],
52710
+ setIsScrolling = _useState33[1];
52711
+ var _useState34 = useState(null),
52712
+ linkPreview = _useState34[0],
52713
+ setLinkPreview = _useState34[1];
52714
+ var _useState35 = useState(null),
52715
+ detectedUrl = _useState35[0],
52716
+ setDetectedUrl = _useState35[1];
52717
+ var _useState36 = useState(new Set()),
52718
+ dismissedUrls = _useState36[0],
52719
+ setDismissedUrls = _useState36[1];
52720
+ var _useState37 = useState(false),
52721
+ isClosingPreview = _useState37[0],
52722
+ setIsClosingPreview = _useState37[1];
52723
+ var _useState38 = useState(false),
52724
+ replyLinkPreviewImageFailed = _useState38[0],
52725
+ setReplyLinkPreviewImageFailed = _useState38[1];
52726
+ var _useState39 = useState(false),
52727
+ linkPreviewImageFailed = _useState39[0],
52728
+ setLinkPreviewImageFailed = _useState39[1];
52551
52729
  var addAttachmentByMenu = showChooseFileAttachment && showChooseMediaAttachment;
52552
52730
  var linkify = new LinkifyIt();
52553
52731
  var oGMetadata = useSelector(function (state) {
52554
52732
  return state.MessageReducer.oGMetadata;
52555
52733
  });
52734
+ useEffect(function () {
52735
+ return subscribeToDraftMessages(function () {
52736
+ return setDraftsHydrated(areDraftMessagesHydrated());
52737
+ });
52738
+ }, []);
52739
+ useEffect(function () {
52740
+ if (!draftsHydrated || !activeChannel.id) {
52741
+ return;
52742
+ }
52743
+ var draftMessage = getDraftMessageFromMap(activeChannel.id);
52744
+ if (!draftMessage) {
52745
+ return;
52746
+ }
52747
+ restoringDraftRef.current = true;
52748
+ if (draftMessage.messageToEdit) {
52749
+ var _ref4, _draftMessage$editMes, _draftMessage$editBod, _draftMessage$mention;
52750
+ var restoredText = (_ref4 = (_draftMessage$editMes = draftMessage.editMessageText) != null ? _draftMessage$editMes : draftMessage.messageToEdit.body) != null ? _ref4 : '';
52751
+ var restoredEdit = _extends({}, draftMessage.messageToEdit, {
52752
+ body: restoredText,
52753
+ bodyAttributes: (_draftMessage$editBod = draftMessage.editBodyAttributes) != null ? _draftMessage$editBod : draftMessage.messageToEdit.bodyAttributes,
52754
+ mentionedUsers: (_draftMessage$mention = draftMessage.mentionedUsers) != null ? _draftMessage$mention : draftMessage.messageToEdit.mentionedUsers
52755
+ });
52756
+ setEditMessageText(restoredText);
52757
+ setMessageBodyAttributes(restoredEdit.bodyAttributes || []);
52758
+ setMentionedUsers(restoredEdit.mentionedUsers || []);
52759
+ setRestoredEditMessage(restoredEdit);
52760
+ dispatch(setMessageToEditAC(draftMessage.messageToEdit));
52761
+ restoredDraftChannelIdRef.current = activeChannel.id;
52762
+ return;
52763
+ }
52764
+ setMessageText(draftMessage.text || '');
52765
+ setMentionedUsers(draftMessage.mentionedUsers || []);
52766
+ setAttachments(draftMessage.attachments || []);
52767
+ setViewOnce(!!draftMessage.viewOnce);
52768
+ if (draftMessage.messageForReply) dispatch(setMessageForReplyAC(draftMessage.messageForReply));
52769
+ setShouldClearEditor({
52770
+ clear: true,
52771
+ draftMessage: draftMessage
52772
+ });
52773
+ restoredDraftChannelIdRef.current = activeChannel.id;
52774
+ }, [draftsHydrated, activeChannel.id]);
52775
+ useEffect(function () {
52776
+ setReplyLinkPreviewImageFailed(false);
52777
+ }, [messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.id, messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.tid]);
52778
+ useEffect(function () {
52779
+ setLinkPreviewImageFailed(false);
52780
+ }, [linkPreview === null || linkPreview === void 0 ? void 0 : linkPreview.url]);
52556
52781
  var closePreviewWithAnimation = function closePreviewWithAnimation(callback) {
52557
52782
  if (linkPreview) {
52558
52783
  setIsClosingPreview(true);
@@ -52665,7 +52890,15 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52665
52890
  dispatch(sendTypingAC(typingState));
52666
52891
  }
52667
52892
  };
52668
- var handleCloseReply = function handleCloseReply() {
52893
+ var handleCloseReply = function handleCloseReply(preserveDraft) {
52894
+ if (preserveDraft === void 0) {
52895
+ preserveDraft = false;
52896
+ }
52897
+ var shouldPreserveDraft = preserveDraft === true;
52898
+ if (!shouldPreserveDraft && !messageText.trim() && !attachments.length) {
52899
+ removeDraftMessageFromMap(activeChannel.id);
52900
+ dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
52901
+ }
52669
52902
  dispatch(setMessageForReplyAC(null));
52670
52903
  };
52671
52904
  var handleDoubleClick = function handleDoubleClick(e) {
@@ -52785,12 +53018,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52785
53018
  return {
52786
53019
  name: attachment.data.name,
52787
53020
  data: attachment.data,
53021
+ attachmentUrl: attachment.attachmentUrl,
52788
53022
  tid: attachment.tid,
52789
53023
  cachedUrl: attachment.cachedUrl,
52790
53024
  upload: attachment.upload,
52791
53025
  metadata: attachment.metadata,
52792
53026
  type: attachment.type,
52793
- size: attachment.size
53027
+ size: attachment.size,
53028
+ thumbnailState: attachment.thumbnailState
52794
53029
  };
52795
53030
  });
52796
53031
  if (viewOnce && canShowViewOnceToggle) {
@@ -52814,6 +53049,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52814
53049
  }
52815
53050
  setAttachments([]);
52816
53051
  attachmentsUpdate = [];
53052
+ removeDraftMessageFromMap(activeChannel.id);
53053
+ dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
52817
53054
  setViewOnce(false);
52818
53055
  handleCloseReply();
52819
53056
  setShouldClearEditor({
@@ -52924,8 +53161,16 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52924
53161
  }
52925
53162
  handleCloseEditMode();
52926
53163
  };
52927
- var handleCloseEditMode = function handleCloseEditMode() {
53164
+ var handleCloseEditMode = function handleCloseEditMode(preserveDraft) {
53165
+ if (preserveDraft === void 0) {
53166
+ preserveDraft = false;
53167
+ }
53168
+ if (!preserveDraft && messageToEdit) {
53169
+ removeDraftMessageFromMap(activeChannel.id);
53170
+ dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
53171
+ }
52928
53172
  setEditMessageText('');
53173
+ setRestoredEditMessage(null);
52929
53174
  setMentionedUsers([]);
52930
53175
  dispatch(setMessageToEditAC(null));
52931
53176
  };
@@ -52934,10 +53179,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52934
53179
  var updatedAttachments = attachmentsUpdate.filter(function (item) {
52935
53180
  return item.tid !== attachmentId;
52936
53181
  });
53182
+ clearVideoPreparation(attachmentId);
52937
53183
  releaseBlobUrls(["compose_" + attachmentId]);
52938
53184
  setAttachments(updatedAttachments);
52939
53185
  attachmentsUpdate = updatedAttachments;
52940
53186
  } else {
53187
+ attachmentsUpdate.forEach(function (attachment) {
53188
+ return clearVideoPreparation(attachment.tid);
53189
+ });
52941
53190
  releaseBlobUrls(attachmentsUpdate.map(function (item) {
52942
53191
  return "compose_" + item.tid;
52943
53192
  }));
@@ -53089,10 +53338,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53089
53338
  }
53090
53339
  }
53091
53340
  };
53092
- var handleCut = function handleCut() {
53093
- setMessageText('');
53094
- setMentionedUsers([]);
53095
- };
53096
53341
  var handleEmojiPopupToggle = function handleEmojiPopupToggle(bool) {
53097
53342
  setIsEmojisOpened(bool);
53098
53343
  };
@@ -53169,260 +53414,214 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53169
53414
  };
53170
53415
  var handleAddAttachment = function handleAddAttachment(file, isMediaAttachment) {
53171
53416
  try {
53172
- var _temp4 = function _temp4() {
53173
- var fileType = file.type.split('/')[0];
53174
- var tid = v4();
53175
- var reader = new FileReader();
53176
- var handleAttachmentImageForCache = function handleAttachmentImageForCache(attachment) {
53177
- try {
53178
- var _attachment$metadata;
53179
- var url = URL.createObjectURL(attachment.data);
53180
- dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata = attachment.metadata) === null || _attachment$metadata === void 0 ? void 0 : _attachment$metadata.tmb) || '', url));
53181
- return Promise.resolve();
53182
- } catch (e) {
53183
- return Promise.reject(e);
53184
- }
53185
- };
53186
- var handleAttachmentVideoForCache = function handleAttachmentVideoForCache(attachment) {
53187
- try {
53188
- var _calculateRenderedIma = calculateRenderedImageWidth(attachment.metadata.szh || 400, attachment.metadata.szh || 400),
53189
- newWidth = _calculateRenderedIma[0],
53190
- newHeight = _calculateRenderedIma[1];
53191
- return Promise.resolve(getVideoFirstFrame(attachment.data, newWidth, newHeight)).then(function (result) {
53192
- if (result) {
53193
- var _attachment$metadata2;
53194
- var frameBlobUrl = result.frameBlobUrl;
53195
- dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata2 = attachment.metadata) === null || _attachment$metadata2 === void 0 ? void 0 : _attachment$metadata2.tmb) || '', frameBlobUrl));
53196
- }
53197
- });
53198
- } catch (e) {
53199
- return Promise.reject(e);
53200
- }
53201
- };
53202
- reader.onload = function () {
53203
- try {
53204
- setPendingAttachment(tid, {
53205
- file: file
53206
- });
53207
- var _temp0 = function () {
53208
- if (customUploader) {
53209
- var _temp6 = function () {
53210
- if (fileType === 'image') {
53211
- resizeImage(file).then(function (resizedFile) {
53212
- try {
53213
- return Promise.resolve(createImageThumbnail(file)).then(function (_ref4) {
53214
- var _resizedFile$blob;
53215
- var thumbnail = _ref4.thumbnail,
53216
- imageWidth = _ref4.imageWidth,
53217
- imageHeight = _ref4.imageHeight;
53218
- var attachment = {
53219
- data: file,
53220
- upload: false,
53221
- type: isMediaAttachment ? fileType : 'file',
53222
- attachmentUrl: createComposePreviewUrl(tid, resizedFile.blob),
53223
- tid: tid,
53224
- size: isMediaAttachment ? resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile === null || resizedFile === void 0 ? void 0 : (_resizedFile$blob = resizedFile.blob) === null || _resizedFile$blob === void 0 ? void 0 : _resizedFile$blob.size : file.size : file.size,
53225
- metadata: {
53226
- szw: imageWidth,
53227
- szh: imageHeight,
53228
- tmb: thumbnail
53229
- }
53230
- };
53231
- handleAttachmentImageForCache(attachment);
53232
- setAttachments(function (prevState) {
53233
- return [].concat(prevState, [attachment]);
53234
- });
53235
- });
53236
- } catch (e) {
53237
- return Promise.reject(e);
53238
- }
53239
- });
53240
- } else {
53241
- var _temp1 = function () {
53242
- if (fileType === 'video') {
53243
- return Promise.resolve(getFrame(file, 0)).then(function (_ref5) {
53244
- var thumb = _ref5.thumb,
53245
- width = _ref5.width,
53246
- height = _ref5.height,
53247
- duration = _ref5.duration;
53248
- var attachment = {
53249
- data: file,
53250
- upload: false,
53251
- type: isMediaAttachment ? fileType : 'file',
53252
- attachmentUrl: createComposePreviewUrl(tid, file),
53253
- tid: tid,
53254
- size: file.size,
53255
- metadata: {
53256
- szw: width,
53257
- szh: height,
53258
- tmb: thumb,
53259
- dur: duration
53260
- }
53261
- };
53262
- handleAttachmentVideoForCache(attachment);
53263
- setAttachments(function (prevState) {
53264
- return [].concat(prevState, [attachment]);
53265
- });
53266
- });
53267
- } else {
53268
- setAttachments(function (prevState) {
53269
- return [].concat(prevState, [{
53270
- data: file,
53271
- upload: false,
53272
- type: 'file',
53273
- tid: tid,
53274
- size: file.size
53275
- }]);
53276
- });
53277
- }
53278
- }();
53279
- if (_temp1 && _temp1.then) return _temp1.then(function () {});
53280
- }
53281
- }();
53282
- if (_temp6 && _temp6.then) return _temp6.then(function () {});
53283
- } else {
53284
- var _temp9 = function () {
53285
- if (fileType === 'image') {
53286
- var _temp7 = function () {
53287
- if (isMediaAttachment) {
53288
- return Promise.resolve(createImageThumbnail(file)).then(function (_ref6) {
53289
- var thumbnail = _ref6.thumbnail,
53290
- imageWidth = _ref6.imageWidth,
53291
- imageHeight = _ref6.imageHeight;
53292
- var metas = {
53293
- thumbnail: thumbnail,
53294
- imageWidth: imageWidth,
53295
- imageHeight: imageHeight
53296
- };
53297
- if (file.type === 'image/gif') {
53298
- setAttachments(function (prevState) {
53299
- return [].concat(prevState, [{
53300
- data: file,
53301
- upload: true,
53302
- attachmentUrl: createComposePreviewUrl(tid, file),
53303
- tid: tid,
53304
- type: fileType,
53305
- size: file.size,
53306
- metadata: JSON.stringify({
53307
- tmb: metas.thumbnail,
53308
- szw: metas.imageWidth,
53309
- szh: metas.imageHeight
53310
- })
53311
- }]);
53312
- });
53313
- } else {
53314
- resizeImage(file).then(function (resizedFileData) {
53315
- try {
53316
- var resizedFile = new File([resizedFileData.blob], resizedFileData.file.name);
53317
- var attachment = {
53318
- data: resizedFile,
53319
- upload: true,
53320
- attachmentUrl: createComposePreviewUrl(tid, resizedFile),
53321
- tid: tid,
53322
- type: fileType,
53323
- size: resizedFile.size,
53324
- metadata: JSON.stringify({
53325
- tmb: metas.thumbnail,
53326
- szw: resizedFileData.newWidth,
53327
- szh: resizedFileData.newHeight
53328
- })
53329
- };
53330
- handleAttachmentImageForCache(attachment);
53331
- setAttachments(function (prevState) {
53332
- return [].concat(prevState, [attachment]);
53333
- });
53334
- return Promise.resolve();
53335
- } catch (e) {
53336
- return Promise.reject(e);
53337
- }
53338
- });
53417
+ var customUploader = getCustomUploader();
53418
+ var fileType = file.type.split('/')[0];
53419
+ var tid = v4();
53420
+ var handleAttachmentImageForCache = function handleAttachmentImageForCache(attachment) {
53421
+ try {
53422
+ var _attachment$metadata;
53423
+ var url = URL.createObjectURL(attachment.data);
53424
+ dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata = attachment.metadata) === null || _attachment$metadata === void 0 ? void 0 : _attachment$metadata.tmb) || '', url));
53425
+ return Promise.resolve();
53426
+ } catch (e) {
53427
+ return Promise.reject(e);
53428
+ }
53429
+ };
53430
+ var handleAttachmentVideoForCache = function handleAttachmentVideoForCache(attachment) {
53431
+ try {
53432
+ var _calculateRenderedIma = calculateRenderedImageWidth(attachment.metadata.szh || 400, attachment.metadata.szh || 400),
53433
+ newWidth = _calculateRenderedIma[0],
53434
+ newHeight = _calculateRenderedIma[1];
53435
+ return Promise.resolve(getVideoFirstFrame(attachment.data, newWidth, newHeight)).then(function (result) {
53436
+ if (result) {
53437
+ var _attachment$metadata2;
53438
+ var frameBlobUrl = result.frameBlobUrl;
53439
+ dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata2 = attachment.metadata) === null || _attachment$metadata2 === void 0 ? void 0 : _attachment$metadata2.tmb) || '', frameBlobUrl));
53440
+ }
53441
+ });
53442
+ } catch (e) {
53443
+ return Promise.reject(e);
53444
+ }
53445
+ };
53446
+ setPendingAttachment(tid, {
53447
+ file: file
53448
+ });
53449
+ if (fileType === 'video') {
53450
+ beginVideoPreparation(tid, file);
53451
+ }
53452
+ var type = fileType === 'video' && (!customUploader || isMediaAttachment) ? 'video' : isMediaAttachment && fileType === 'image' ? 'image' : 'file';
53453
+ var attachment = _extends({
53454
+ data: file,
53455
+ name: file.name,
53456
+ upload: !customUploader,
53457
+ type: type,
53458
+ tid: tid,
53459
+ size: file.size
53460
+ }, fileType === 'video' && !isMediaAttachment ? {
53461
+ thumbnailState: 'loading'
53462
+ } : {}, fileType === 'image' || fileType === 'video' ? {
53463
+ attachmentUrl: createComposePreviewUrl(tid, file),
53464
+ metadata: customUploader ? {} : '{}'
53465
+ } : {});
53466
+ setAttachments(function (prevState) {
53467
+ return [].concat(prevState, [attachment]);
53468
+ });
53469
+ var updateAttachment = function updateAttachment(patch) {
53470
+ setAttachments(function (prevState) {
53471
+ return prevState.map(function (current) {
53472
+ return current.tid === tid ? _extends({}, current, patch) : current;
53473
+ });
53474
+ });
53475
+ };
53476
+ setTimeout(function () {
53477
+ try {
53478
+ var _temp1 = function () {
53479
+ if (fileType === 'image') {
53480
+ var _temp5 = _catch(function () {
53481
+ return Promise.resolve(createImageThumbnail(file)).then(function (_ref5) {
53482
+ var thumbnail = _ref5.thumbnail,
53483
+ imageWidth = _ref5.imageWidth,
53484
+ imageHeight = _ref5.imageHeight;
53485
+ var _temp4 = function () {
53486
+ if (customUploader) {
53487
+ return Promise.resolve(resizeImage(file)).then(function (resizedFile) {
53488
+ var patch = {
53489
+ size: isMediaAttachment && resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile.blob.size : file.size,
53490
+ metadata: {
53491
+ szw: imageWidth,
53492
+ szh: imageHeight,
53493
+ tmb: thumbnail
53339
53494
  }
53340
- });
53341
- } else {
53342
- return Promise.resolve(createImageThumbnail(file, undefined, 50, 50)).then(function (_ref7) {
53343
- var thumbnail = _ref7.thumbnail;
53344
- setAttachments(function (prevState) {
53345
- return [].concat(prevState, [{
53346
- data: file,
53347
- type: 'file',
53348
- upload: true,
53349
- attachmentUrl: createComposePreviewUrl(tid, file),
53350
- tid: tid,
53351
- size: file.size,
53495
+ };
53496
+ updateAttachment(patch);
53497
+ handleAttachmentImageForCache(_extends({}, attachment, patch));
53498
+ });
53499
+ } else {
53500
+ var _temp10 = function () {
53501
+ if (isMediaAttachment && file.type !== 'image/gif') {
53502
+ return Promise.resolve(resizeImage(file)).then(function (resizedFileData) {
53503
+ var resizedFile = resizedFileData.blob ? new File([resizedFileData.blob], resizedFileData.file.name, {
53504
+ type: file.type
53505
+ }) : file;
53506
+ var patch = {
53507
+ data: resizedFile,
53508
+ size: resizedFile.size,
53352
53509
  metadata: JSON.stringify({
53353
- tmb: thumbnail
53510
+ tmb: thumbnail,
53511
+ szw: resizedFileData.newWidth,
53512
+ szh: resizedFileData.newHeight
53354
53513
  })
53355
- }]);
53514
+ };
53515
+ updateAttachment(patch);
53516
+ setPendingAttachment(tid, {
53517
+ file: resizedFile
53518
+ });
53519
+ handleAttachmentImageForCache(_extends({}, attachment, patch));
53520
+ });
53521
+ } else {
53522
+ updateAttachment({
53523
+ metadata: JSON.stringify({
53524
+ tmb: thumbnail,
53525
+ szw: imageWidth,
53526
+ szh: imageHeight
53527
+ })
53356
53528
  });
53529
+ }
53530
+ }();
53531
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
53532
+ }
53533
+ }();
53534
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
53535
+ });
53536
+ }, function (error) {
53537
+ log.warn('Unable to prepare image attachment preview:', error);
53538
+ });
53539
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
53540
+ } else {
53541
+ var _temp11 = function () {
53542
+ if (fileType === 'video') {
53543
+ var _temp9 = function _temp9() {
53544
+ return Promise.resolve(remuxPromise).then(function (uploadFile) {
53545
+ if (uploadFile !== file) {
53546
+ updateAttachment({
53547
+ data: uploadFile,
53548
+ size: uploadFile.size
53549
+ });
53550
+ setPendingAttachment(tid, {
53551
+ file: uploadFile
53357
53552
  });
53358
53553
  }
53359
- }();
53360
- if (_temp7 && _temp7.then) return _temp7.then(function () {});
53361
- } else {
53362
- var _temp10 = function () {
53363
- if (fileType === 'video') {
53364
- return Promise.resolve(getFrame(file, 0)).then(function (_ref8) {
53365
- var thumb = _ref8.thumb,
53366
- width = _ref8.width,
53367
- height = _ref8.height,
53368
- duration = _ref8.duration;
53369
- var metas = JSON.stringify({
53370
- tmb: thumb,
53371
- width: width,
53372
- height: height,
53373
- dur: duration
53374
- });
53375
- var attachment = {
53376
- data: file,
53377
- type: 'video',
53378
- upload: true,
53379
- size: file.size,
53380
- attachmentUrl: createComposePreviewUrl(tid, file),
53381
- tid: tid,
53382
- metadata: metas
53383
- };
53384
- handleAttachmentVideoForCache(attachment);
53385
- setAttachments(function (prevState) {
53386
- return [].concat(prevState, [attachment]);
53387
- });
53554
+ if (metadata) {
53555
+ completeVideoPreparation(tid, {
53556
+ file: uploadFile,
53557
+ metadata: metadata
53388
53558
  });
53389
53559
  } else {
53390
- setAttachments(function (prevState) {
53391
- return [].concat(prevState, [{
53392
- data: file,
53393
- upload: true,
53394
- type: 'file',
53395
- size: file.size,
53396
- tid: tid
53397
- }]);
53560
+ failVideoPreparation(tid);
53561
+ updateAttachment({
53562
+ thumbnailState: 'failed'
53398
53563
  });
53399
53564
  }
53400
- }();
53401
- if (_temp10 && _temp10.then) return _temp10.then(function () {});
53402
- }
53403
- }();
53404
- if (_temp9 && _temp9.then) return _temp9.then(function () {});
53405
- }
53406
- }();
53407
- return Promise.resolve(_temp0 && _temp0.then ? _temp0.then(function () {}) : void 0);
53408
- } catch (e) {
53409
- return Promise.reject(e);
53410
- }
53411
- };
53412
- reader.onerror = function (e) {
53413
- log.info(' error on read file onError', e);
53414
- };
53415
- reader.readAsBinaryString(file);
53416
- };
53417
- var customUploader = getCustomUploader();
53418
- var _temp3 = function () {
53419
- if (file.type.split('/')[0] === 'video') {
53420
- return Promise.resolve(remuxVideoFileForUpload(file)).then(function (_remuxVideoFileForUpl) {
53421
- file = _remuxVideoFileForUpl;
53422
- });
53565
+ });
53566
+ };
53567
+ var remuxPromise = remuxVideoFileForUpload(file);
53568
+ var thumbnailSource = file;
53569
+ var metadata;
53570
+ var _temp8 = _catch(function () {
53571
+ function _temp7() {
53572
+ var _frame = frame,
53573
+ thumb = _frame.thumb,
53574
+ width = _frame.width,
53575
+ height = _frame.height,
53576
+ duration = _frame.duration;
53577
+ metadata = customUploader ? {
53578
+ szw: width,
53579
+ szh: height,
53580
+ tmb: thumb,
53581
+ dur: duration
53582
+ } : JSON.stringify({
53583
+ tmb: thumb,
53584
+ szw: width,
53585
+ szh: height,
53586
+ dur: duration
53587
+ });
53588
+ updateAttachment({
53589
+ metadata: metadata,
53590
+ thumbnailState: 'ready'
53591
+ });
53592
+ handleAttachmentVideoForCache(_extends({}, attachment, {
53593
+ metadata: metadata
53594
+ }));
53595
+ }
53596
+ var frame;
53597
+ var _temp6 = _catch(function () {
53598
+ return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame) {
53599
+ frame = _getFrame;
53600
+ });
53601
+ }, function () {
53602
+ return Promise.resolve(remuxPromise).then(function (_remuxPromise) {
53603
+ thumbnailSource = _remuxPromise;
53604
+ return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame2) {
53605
+ frame = _getFrame2;
53606
+ });
53607
+ });
53608
+ });
53609
+ return _temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6);
53610
+ }, function (error) {
53611
+ log.warn('Unable to generate video thumbnail:', error);
53612
+ });
53613
+ return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
53614
+ }
53615
+ }();
53616
+ if (_temp11 && _temp11.then) return _temp11.then(function () {});
53617
+ }
53618
+ }();
53619
+ return Promise.resolve(_temp1 && _temp1.then ? _temp1.then(function () {}) : void 0);
53620
+ } catch (e) {
53621
+ return Promise.reject(e);
53423
53622
  }
53424
- }();
53425
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
53623
+ }, 0);
53624
+ return Promise.resolve();
53426
53625
  } catch (e) {
53427
53626
  return Promise.reject(e);
53428
53627
  }
@@ -53481,14 +53680,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53481
53680
  }
53482
53681
  }
53483
53682
  }
53484
- var _temp11 = function () {
53683
+ var _temp12 = function () {
53485
53684
  if (allowUpload) {
53486
53685
  return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
53487
53686
  } else {
53488
53687
  showFileUploadError(errorMessage);
53489
53688
  }
53490
53689
  }();
53491
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
53690
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
53492
53691
  } catch (e) {
53493
53692
  return Promise.reject(e);
53494
53693
  }
@@ -53562,23 +53761,53 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53562
53761
  useEffect(function () {
53563
53762
  if (prevActiveChannelId && activeChannel.id && prevActiveChannelId !== activeChannel.id) {
53564
53763
  setMessageText('');
53565
- handleCloseReply();
53764
+ if (messageForReply) {
53765
+ isNavigatingChannelRef.current = true;
53766
+ handleCloseReply(true);
53767
+ }
53566
53768
  setAttachments([]);
53567
53769
  attachmentsUpdate = [];
53568
- handleCloseEditMode();
53770
+ handleCloseEditMode(!!messageToEdit);
53569
53771
  clearTimeout(typingTimout);
53570
53772
  var draftMessage = getDraftMessageFromMap(activeChannel.id);
53571
53773
  if (draftMessage) {
53572
- if (draftMessage.messageForReply) {
53573
- dispatch(setMessageForReplyAC(draftMessage.messageForReply));
53774
+ restoringDraftRef.current = true;
53775
+ if (draftMessage.messageToEdit) {
53776
+ var _ref6, _draftMessage$editMes2, _draftMessage$editBod2, _draftMessage$mention2;
53777
+ var restoredText = (_ref6 = (_draftMessage$editMes2 = draftMessage.editMessageText) != null ? _draftMessage$editMes2 : draftMessage.messageToEdit.body) != null ? _ref6 : '';
53778
+ var restoredEdit = _extends({}, draftMessage.messageToEdit, {
53779
+ body: restoredText,
53780
+ bodyAttributes: (_draftMessage$editBod2 = draftMessage.editBodyAttributes) != null ? _draftMessage$editBod2 : draftMessage.messageToEdit.bodyAttributes,
53781
+ mentionedUsers: (_draftMessage$mention2 = draftMessage.mentionedUsers) != null ? _draftMessage$mention2 : draftMessage.messageToEdit.mentionedUsers
53782
+ });
53783
+ setEditMessageText(restoredText);
53784
+ setMessageBodyAttributes(restoredEdit.bodyAttributes || []);
53785
+ setMentionedUsers(restoredEdit.mentionedUsers || []);
53786
+ setRestoredEditMessage(restoredEdit);
53787
+ dispatch(setMessageToEditAC(draftMessage.messageToEdit));
53788
+ restoredDraftChannelIdRef.current = activeChannel.id;
53789
+ }
53790
+ if (!draftMessage.messageToEdit) {
53791
+ if (draftMessage.messageForReply) {
53792
+ dispatch(setMessageForReplyAC(draftMessage.messageForReply));
53793
+ }
53794
+ setMessageText(draftMessage.text);
53795
+ setMentionedUsers(draftMessage.mentionedUsers);
53796
+ setAttachments(draftMessage.attachments || []);
53797
+ setViewOnce(!!draftMessage.viewOnce);
53798
+ restoredDraftChannelIdRef.current = activeChannel.id;
53799
+ setShouldClearEditor({
53800
+ clear: true,
53801
+ draftMessage: draftMessage
53802
+ });
53574
53803
  }
53575
- setMessageText(draftMessage.text);
53576
- setMentionedUsers(draftMessage.mentionedUsers);
53804
+ } else {
53805
+ setMentionedUsers([]);
53806
+ setShouldClearEditor({
53807
+ clear: true,
53808
+ draftMessage: draftMessage
53809
+ });
53577
53810
  }
53578
- setShouldClearEditor({
53579
- clear: true,
53580
- draftMessage: draftMessage
53581
- });
53582
53811
  }
53583
53812
  if (activeChannel.id) {
53584
53813
  prevActiveChannelId = activeChannel.id;
@@ -53586,23 +53815,38 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53586
53815
  if (activeChannel.id && membersHasNext === undefined && !(activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT && activeChannel.memberCount === 2)) {
53587
53816
  dispatch(getMembersAC(activeChannel.id));
53588
53817
  }
53589
- setMentionedUsers([]);
53590
53818
  }, [activeChannel.id]);
53591
53819
  useEffect(function () {
53820
+ if (!draftsHydrated) {
53821
+ return;
53822
+ }
53823
+ if (restoringDraftRef.current) {
53824
+ restoringDraftRef.current = false;
53825
+ return;
53826
+ }
53827
+ if (messageToEdit) {
53828
+ var persistedEditText = editMessageText || messageToEdit.body || '';
53829
+ var normalizeAttrs = function normalizeAttrs(attrs) {
53830
+ return !attrs || attrs.length === 0 ? [] : attrs;
53831
+ };
53832
+ var hasTextChanged = editMessageText !== messageToEdit.body;
53833
+ var hasAttributesChanged = !compareMessageBodyAttributes(normalizeAttrs(messageBodyAttributes), normalizeAttrs(messageToEdit.bodyAttributes));
53834
+ var canSubmitEdit = !!editMessageText.trim() && (hasTextChanged || hasAttributesChanged);
53835
+ setSendMessageIsActive(canSubmitEdit);
53836
+ setDraftMessageToMap(activeChannel.id, {
53837
+ text: persistedEditText || 'Edit message',
53838
+ mentionedUsers: mentionedUsers,
53839
+ messageToEdit: messageToEdit,
53840
+ editMessageText: persistedEditText,
53841
+ editBodyAttributes: messageBodyAttributes
53842
+ }, {
53843
+ persist: canSubmitEdit
53844
+ });
53845
+ return;
53846
+ }
53592
53847
  if (messageText.trim() || editMessageText !== null && editMessageText !== void 0 && editMessageText.trim() && editMessageText && (editMessageText === null || editMessageText === void 0 ? void 0 : editMessageText.trim()) !== (messageToEdit === null || messageToEdit === void 0 ? void 0 : messageToEdit.body) || attachments.length) {
53593
53848
  if (attachments.length) {
53594
- var videoAttachment = false;
53595
- attachments.forEach(function (att) {
53596
- if ((att.type === 'video' || att.data.type.split('/')[0] === 'video') && att.type !== 'file') {
53597
- videoAttachment = true;
53598
- if (readyVideoAttachments[att.tid]) {
53599
- setSendMessageIsActive(true);
53600
- }
53601
- }
53602
- });
53603
- if (!videoAttachment) {
53604
- setSendMessageIsActive(true);
53605
- }
53849
+ setSendMessageIsActive(true);
53606
53850
  } else {
53607
53851
  setSendMessageIsActive(true);
53608
53852
  }
@@ -53613,15 +53857,17 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53613
53857
  setSendMessageIsActive(false);
53614
53858
  }
53615
53859
  }
53616
- if (messageText.trim()) {
53617
- var draftMessage = getDraftMessageFromMap(activeChannel.id);
53860
+ var draftMessage = getDraftMessageFromMap(activeChannel.id);
53861
+ if (messageText.trim() || attachments.length) {
53618
53862
  if (draftMessage && draftMessage.mentionedUsers && draftMessage.mentionedUsers.length) {
53619
53863
  setDraftMessageToMap(activeChannel.id, {
53620
53864
  text: messageText,
53621
53865
  mentionedUsers: draftMessage.mentionedUsers,
53622
53866
  messageForReply: messageForReply,
53623
53867
  editorState: realEditorState,
53624
- bodyAttributes: messageBodyAttributes
53868
+ bodyAttributes: messageBodyAttributes,
53869
+ attachments: attachments,
53870
+ viewOnce: viewOnce
53625
53871
  });
53626
53872
  } else {
53627
53873
  setDraftMessageToMap(activeChannel.id, {
@@ -53629,14 +53875,30 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53629
53875
  mentionedUsers: mentionedUsers,
53630
53876
  messageForReply: messageForReply,
53631
53877
  editorState: realEditorState,
53632
- bodyAttributes: messageBodyAttributes
53878
+ bodyAttributes: messageBodyAttributes,
53879
+ attachments: attachments,
53880
+ viewOnce: viewOnce
53633
53881
  });
53634
53882
  }
53635
53883
  if (!listenerIsAdded) {
53636
53884
  setListenerIsAdded(true);
53637
53885
  document.body.setAttribute('onbeforeunload', "return () => 'reload?'");
53638
53886
  }
53639
- } else if (getDraftMessageFromMap(activeChannel.id)) {
53887
+ } else if (messageForReply || draftMessage !== null && draftMessage !== void 0 && draftMessage.messageForReply) {
53888
+ setDraftMessageToMap(activeChannel.id, {
53889
+ text: '',
53890
+ mentionedUsers: (draftMessage === null || draftMessage === void 0 ? void 0 : draftMessage.mentionedUsers) || mentionedUsers,
53891
+ messageForReply: messageForReply || (draftMessage === null || draftMessage === void 0 ? void 0 : draftMessage.messageForReply),
53892
+ bodyAttributes: messageBodyAttributes,
53893
+ attachments: [],
53894
+ viewOnce: false
53895
+ }, {
53896
+ persist: false
53897
+ });
53898
+ } else if (draftMessage) {
53899
+ if (restoredDraftChannelIdRef.current && restoredDraftChannelIdRef.current !== activeChannel.id) {
53900
+ return;
53901
+ }
53640
53902
  removeDraftMessageFromMap(activeChannel.id);
53641
53903
  dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
53642
53904
  if (checkDraftMessagesIsEmpty() && listenerIsAdded) {
@@ -53644,14 +53906,18 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53644
53906
  document.body.removeAttribute('onbeforeunload');
53645
53907
  }
53646
53908
  }
53647
- }, [messageText, attachments, editMessageText, readyVideoAttachments, messageBodyAttributes, messageToEdit]);
53909
+ }, [messageText, attachments, editMessageText, readyVideoAttachments, messageBodyAttributes, messageToEdit, viewOnce, draftsHydrated]);
53648
53910
  useDidUpdate(function () {
53649
- if (mentionedUsers && mentionedUsers.length) {
53911
+ if (!messageToEdit && mentionedUsers && mentionedUsers.length) {
53650
53912
  setDraftMessageToMap(activeChannel.id, {
53651
53913
  text: messageText,
53652
53914
  mentionedUsers: mentionedUsers,
53653
53915
  messageForReply: messageForReply,
53654
- bodyAttributes: messageBodyAttributes
53916
+ bodyAttributes: messageBodyAttributes,
53917
+ attachments: attachments,
53918
+ viewOnce: viewOnce
53919
+ }, {
53920
+ persist: !!(messageText.trim() || attachments.length)
53655
53921
  });
53656
53922
  }
53657
53923
  }, [mentionedUsers]);
@@ -53700,13 +53966,27 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53700
53966
  }
53701
53967
  });
53702
53968
  useDidUpdate(function () {
53703
- if (draftMessagesMap[activeChannel.id]) {
53969
+ var _draftMessagesMap$act;
53970
+ var persistedReply = (_draftMessagesMap$act = draftMessagesMap[activeChannel.id]) === null || _draftMessagesMap$act === void 0 ? void 0 : _draftMessagesMap$act.messageForReply;
53971
+ if (isNavigatingChannelRef.current) {
53972
+ isNavigatingChannelRef.current = false;
53973
+ return;
53974
+ }
53975
+ var hasDraftContent = !!(messageText.trim() || attachments.length || messageForReply || persistedReply);
53976
+ if (hasDraftContent) {
53704
53977
  setDraftMessageToMap(activeChannel.id, {
53705
53978
  text: messageText,
53706
53979
  mentionedUsers: mentionedUsers,
53707
- messageForReply: messageForReply,
53708
- bodyAttributes: messageBodyAttributes
53980
+ messageForReply: messageForReply || persistedReply,
53981
+ bodyAttributes: messageBodyAttributes,
53982
+ attachments: attachments,
53983
+ viewOnce: viewOnce
53984
+ }, {
53985
+ persist: !!(messageText.trim() || attachments.length)
53709
53986
  });
53987
+ } else if (draftMessagesMap[activeChannel.id]) {
53988
+ removeDraftMessageFromMap(activeChannel.id);
53989
+ dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
53710
53990
  }
53711
53991
  if (messageForReply && messageToEdit) {
53712
53992
  handleCloseEditMode();
@@ -53742,7 +54022,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53742
54022
  }, 800);
53743
54023
  }
53744
54024
  messageContRef.current.addEventListener('paste', handlePastAttachments);
53745
- messageContRef.current.addEventListener('cut', handleCut);
53746
54025
  document.addEventListener('mousedown', handleClick);
53747
54026
  return function () {
53748
54027
  if (inputHeightTimeout) {
@@ -53752,7 +54031,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53752
54031
  document.removeEventListener('mousedown', handleClick);
53753
54032
  if (messageContRef && messageContRef.current) {
53754
54033
  messageContRef.current.removeEventListener('paste', handlePastAttachments);
53755
- messageContRef.current.removeEventListener('cut', handleCut);
53756
54034
  }
53757
54035
  };
53758
54036
  }, []);
@@ -53899,7 +54177,9 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53899
54177
  borderColor: borderColor
53900
54178
  }, /*#__PURE__*/React__default.createElement(CloseEditMode, {
53901
54179
  color: textSecondary,
53902
- onClick: handleCloseEditMode
54180
+ onClick: function onClick() {
54181
+ return handleCloseEditMode();
54182
+ }
53903
54183
  }, /*#__PURE__*/React__default.createElement(SvgClose, null)), /*#__PURE__*/React__default.createElement(EditReplyMessageHeader, {
53904
54184
  color: accentColor
53905
54185
  }, editMessageIcon || /*#__PURE__*/React__default.createElement(SvgEditIcon, null), "Edit Message"), /*#__PURE__*/React__default.createElement(EditMessageText, null, MessageTextFormat({
@@ -53922,7 +54202,9 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53922
54202
  borderColor: borderColor
53923
54203
  }, /*#__PURE__*/React__default.createElement(CloseEditMode, {
53924
54204
  color: textSecondary,
53925
- onClick: handleCloseReply
54205
+ onClick: function onClick() {
54206
+ return handleCloseReply();
54207
+ }
53926
54208
  }, /*#__PURE__*/React__default.createElement(SvgClose, null)), CustomReplyMessageContainer && customReplyMessageTypes !== null && customReplyMessageTypes !== void 0 && customReplyMessageTypes.includes(messageForReply.type) ? (/*#__PURE__*/React__default.createElement(CustomReplyMessageContainer, {
53927
54209
  messageForReply: messageForReply,
53928
54210
  onClose: handleCloseReply
@@ -53930,14 +54212,26 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53930
54212
  attachment: messageForReply.attachments[0],
53931
54213
  backgroundColor: selectedFileAttachmentsBoxBackground || '',
53932
54214
  isRepliedMessage: true
53933
- })) : messageForReply.attachments[0].type === attachmentTypes.file && (/*#__PURE__*/React__default.createElement(ReplyIconWrapper, {
54215
+ })) : messageForReply.attachments[0].type === attachmentTypes.file ? (/*#__PURE__*/React__default.createElement(ReplyIconWrapper, {
53934
54216
  backgroundColor: accentColor,
53935
54217
  iconColor: textOnPrimary
53936
- }, /*#__PURE__*/React__default.createElement(SvgChoseFile, null)))), /*#__PURE__*/React__default.createElement(ReplyMessageBody$1, {
54218
+ }, /*#__PURE__*/React__default.createElement(SvgChoseFile, null))) : getReplyLinkPreviewImage(messageForReply.attachments) && !shouldShowLinkPreviewErrorFallback(getReplyLinkPreviewImage(messageForReply.attachments), replyLinkPreviewImageFailed) ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54219
+ bg: background,
54220
+ src: getReplyLinkPreviewImage(messageForReply.attachments),
54221
+ alt: 'Link preview',
54222
+ onError: function onError() {
54223
+ return setReplyLinkPreviewImageFailed(true);
54224
+ }
54225
+ })) : messageForReply.attachments[0].type === attachmentTypes.link && (/*#__PURE__*/React__default.createElement(LinkPreviewIconWrapper, {
54226
+ bg: background
54227
+ }, /*#__PURE__*/React__default.createElement(LinkPreviewIcon, {
54228
+ color: accentColor,
54229
+ bg: background
54230
+ })))), /*#__PURE__*/React__default.createElement(ReplyMessageBody$1, {
53937
54231
  linkColor: accentColor
53938
54232
  }, /*#__PURE__*/React__default.createElement(EditReplyMessageHeader, {
53939
54233
  color: accentColor
53940
- }, replyMessageIcon || /*#__PURE__*/React__default.createElement(SvgReplyIcon, null), " Reply to", /*#__PURE__*/React__default.createElement(UserName$1, null, user.id === messageForReply.user.id ? user.firstName ? user.firstName + " " + user.lastName : user.id : makeUsername(contactsMap[messageForReply.user.id], messageForReply.user, getFromContacts))), messageForReply.attachments && messageForReply.attachments.length ? messageForReply.attachments[0].type === attachmentTypes.voice ? (/*#__PURE__*/React__default.createElement(TextInOneLine, null, (messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.viewOnce) && /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, {
54234
+ }, replyMessageIcon || /*#__PURE__*/React__default.createElement(SvgReplyIcon, null), user.id === messageForReply.user.id ? ' Reply You' : (/*#__PURE__*/React__default.createElement("span", null, ' Reply to', /*#__PURE__*/React__default.createElement(UserName$1, null, makeUsername(contactsMap[messageForReply.user.id], messageForReply.user, getFromContacts))))), messageForReply.attachments && messageForReply.attachments.length ? messageForReply.attachments[0].type === attachmentTypes.voice ? (/*#__PURE__*/React__default.createElement(TextInOneLine, null, (messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.viewOnce) && /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, {
53941
54235
  style: {
53942
54236
  margin: '0 4px -3px 0'
53943
54237
  }
@@ -53989,7 +54283,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53989
54283
  }, /*#__PURE__*/React__default.createElement(CloseEditMode, {
53990
54284
  color: textSecondary,
53991
54285
  onClick: handleRemoveLinkPreview
53992
- }, /*#__PURE__*/React__default.createElement(SvgClose, null)), /*#__PURE__*/React__default.createElement(LinkPreviewContent, null, (_linkPreview$metadata9 = linkPreview.metadata.og) !== null && _linkPreview$metadata9 !== void 0 && (_linkPreview$metadata0 = _linkPreview$metadata9.image) !== null && _linkPreview$metadata0 !== void 0 && (_linkPreview$metadata1 = _linkPreview$metadata0[0]) !== null && _linkPreview$metadata1 !== void 0 && _linkPreview$metadata1.url ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54286
+ }, /*#__PURE__*/React__default.createElement(SvgClose, null)), /*#__PURE__*/React__default.createElement(LinkPreviewContent, null, (_linkPreview$metadata9 = linkPreview.metadata.og) !== null && _linkPreview$metadata9 !== void 0 && (_linkPreview$metadata0 = _linkPreview$metadata9.image) !== null && _linkPreview$metadata0 !== void 0 && (_linkPreview$metadata1 = _linkPreview$metadata0[0]) !== null && _linkPreview$metadata1 !== void 0 && _linkPreview$metadata1.url && !shouldShowLinkPreviewErrorFallback(linkPreview.metadata.og.image[0].url, linkPreviewImageFailed) ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
53993
54287
  onLoad: function onLoad(e) {
53994
54288
  var _e$target, _e$target2;
53995
54289
  if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.naturalHeight && (_e$target2 = e.target) !== null && _e$target2 !== void 0 && _e$target2.naturalWidth) {
@@ -54000,18 +54294,24 @@ var SendMessageInput = function SendMessageInput(_ref3) {
54000
54294
  }
54001
54295
  },
54002
54296
  src: linkPreview.metadata.og.image[0].url,
54003
- alt: 'Link preview'
54004
- })) : (_linkPreview$metadata10 = linkPreview.metadata.og) !== null && _linkPreview$metadata10 !== void 0 && (_linkPreview$metadata11 = _linkPreview$metadata10.favicon) !== null && _linkPreview$metadata11 !== void 0 && _linkPreview$metadata11.url ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54297
+ alt: 'Link preview',
54298
+ onError: function onError() {
54299
+ return setLinkPreviewImageFailed(true);
54300
+ }
54301
+ })) : shouldShowLinkPreviewErrorFallback((_linkPreview$metadata10 = linkPreview.metadata.og) === null || _linkPreview$metadata10 === void 0 ? void 0 : (_linkPreview$metadata11 = _linkPreview$metadata10.image) === null || _linkPreview$metadata11 === void 0 ? void 0 : (_linkPreview$metadata12 = _linkPreview$metadata11[0]) === null || _linkPreview$metadata12 === void 0 ? void 0 : _linkPreview$metadata12.url, linkPreviewImageFailed) ? (/*#__PURE__*/React__default.createElement(LinkPreviewIcon, {
54302
+ color: accentColor,
54303
+ bg: background
54304
+ })) : (_linkPreview$metadata13 = linkPreview.metadata.og) !== null && _linkPreview$metadata13 !== void 0 && (_linkPreview$metadata14 = _linkPreview$metadata13.favicon) !== null && _linkPreview$metadata14 !== void 0 && _linkPreview$metadata14.url ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54005
54305
  src: linkPreview.metadata.og.favicon.url,
54006
54306
  alt: 'Favicon'
54007
54307
  })) : (/*#__PURE__*/React__default.createElement(LinkPreviewIcon, {
54008
54308
  color: accentColor,
54009
54309
  bg: background
54010
54310
  })), /*#__PURE__*/React__default.createElement(LinkPreviewTextContent, {
54011
- hasImage: !!((_linkPreview$metadata12 = linkPreview.metadata.og) !== null && _linkPreview$metadata12 !== void 0 && (_linkPreview$metadata13 = _linkPreview$metadata12.image) !== null && _linkPreview$metadata13 !== void 0 && (_linkPreview$metadata14 = _linkPreview$metadata13[0]) !== null && _linkPreview$metadata14 !== void 0 && _linkPreview$metadata14.url) || !!((_linkPreview$metadata15 = linkPreview.metadata.og) !== null && _linkPreview$metadata15 !== void 0 && (_linkPreview$metadata16 = _linkPreview$metadata15.favicon) !== null && _linkPreview$metadata16 !== void 0 && _linkPreview$metadata16.url)
54012
- }, ((_linkPreview$metadata17 = linkPreview.metadata.og) === null || _linkPreview$metadata17 === void 0 ? void 0 : _linkPreview$metadata17.title) && (/*#__PURE__*/React__default.createElement(LinkPreviewTitle, {
54311
+ hasImage: !!((_linkPreview$metadata15 = linkPreview.metadata.og) !== null && _linkPreview$metadata15 !== void 0 && (_linkPreview$metadata16 = _linkPreview$metadata15.image) !== null && _linkPreview$metadata16 !== void 0 && (_linkPreview$metadata17 = _linkPreview$metadata16[0]) !== null && _linkPreview$metadata17 !== void 0 && _linkPreview$metadata17.url) || !!((_linkPreview$metadata18 = linkPreview.metadata.og) !== null && _linkPreview$metadata18 !== void 0 && (_linkPreview$metadata19 = _linkPreview$metadata18.favicon) !== null && _linkPreview$metadata19 !== void 0 && _linkPreview$metadata19.url)
54312
+ }, ((_linkPreview$metadata20 = linkPreview.metadata.og) === null || _linkPreview$metadata20 === void 0 ? void 0 : _linkPreview$metadata20.title) && (/*#__PURE__*/React__default.createElement(LinkPreviewTitle, {
54013
54313
  color: accentColor
54014
- }, linkPreview.metadata.og.title)), ((_linkPreview$metadata18 = linkPreview.metadata.og) === null || _linkPreview$metadata18 === void 0 ? void 0 : _linkPreview$metadata18.description) && (/*#__PURE__*/React__default.createElement(LinkPreviewDescription, {
54314
+ }, linkPreview.metadata.og.title)), ((_linkPreview$metadata21 = linkPreview.metadata.og) === null || _linkPreview$metadata21 === void 0 ? void 0 : _linkPreview$metadata21.description) && (/*#__PURE__*/React__default.createElement(LinkPreviewDescription, {
54015
54315
  color: textPrimary
54016
54316
  }, linkPreview.metadata.og.description)))))), !!attachments.length && !sendAttachmentSeparately && (/*#__PURE__*/React__default.createElement(ChosenAttachments, null, [].concat(attachments).map(function (attachment) {
54017
54317
  return /*#__PURE__*/React__default.createElement("div", {
@@ -54137,6 +54437,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
54137
54437
  onChange: onChange
54138
54438
  }), /*#__PURE__*/React__default.createElement(EditMessagePlugin, {
54139
54439
  editMessage: messageToEdit,
54440
+ draftMessage: (restoredEditMessage === null || restoredEditMessage === void 0 ? void 0 : restoredEditMessage.id) === (messageToEdit === null || messageToEdit === void 0 ? void 0 : messageToEdit.id) ? restoredEditMessage : null,
54140
54441
  contactsMap: contactsMap,
54141
54442
  getFromContacts: getFromContacts,
54142
54443
  setMentionedMember: setMentionedUsers
@@ -54285,14 +54586,14 @@ var SendMessageInputContainer = styled.div(_templateObject11$9 || (_templateObje
54285
54586
  }, AddAttachmentIcon, function (props) {
54286
54587
  return props.iconColor;
54287
54588
  });
54288
- var MessageInputWrapper = styled.div(_templateObject12$6 || (_templateObject12$6 = _taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n max-width: calc(100% - 50px);\n //max-width: ", ";\n //max-width: calc(100% - 110px);\n background-color: ", ";\n border-radius: ", ";\n position: relative;\n"])), function (props) {
54589
+ var MessageInputWrapper = styled.div(_templateObject12$7 || (_templateObject12$7 = _taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n max-width: calc(100% - 50px);\n //max-width: ", ";\n //max-width: calc(100% - 110px);\n background-color: ", ";\n border-radius: ", ";\n position: relative;\n"])), function (props) {
54289
54590
  return props.channelDetailsIsOpen ? "calc(100% - " + (props.channelDetailsIsOpen ? 362 : 0) + "px)" : '';
54290
54591
  }, function (props) {
54291
54592
  return props.backgroundColor;
54292
54593
  }, function (props) {
54293
54594
  return props.borderRadius || '18px';
54294
54595
  });
54295
- var LexicalWrapper = styled.div(_templateObject13$5 || (_templateObject13$5 = _taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n\n & .rich_text_editor {\n width: 100%;\n max-height: 80px;\n min-height: 20px;\n display: block;\n border: none;\n box-sizing: border-box;\n outline: none !important;\n border-radius: ", ";\n background-color: ", ";\n padding: ", ";\n color: ", ";\n order: ", ";\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: none;\n scrollbar-color: transparent transparent;\n overscroll-behavior: none;\n\n @supports (overflow: overlay) {\n overflow-y: overlay;\n }\n\n &::-webkit-scrollbar {\n width: 8px;\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: transparent;\n }\n\n &.show-scrollbar::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 4px;\n }\n &.show-scrollbar::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &.show-scrollbar {\n scrollbar-width: thin;\n scrollbar-color: ", " transparent;\n }\n\n & p {\n font-size: 15px;\n line-height: 20px;\n color: ", ";\n }\n\n &::selection {\n background-color: ", ";\n }\n\n & *::selection {\n background-color: ", ";\n }\n\n & span::selection {\n background-color: ", ";\n }\n\n &:empty:before {\n content: attr(data-placeholder);\n }\n\n & .content_editable_input {\n border: none !important;\n outline: none !important;\n }\n\n & .mention {\n color: ", ";\n background-color: inherit !important;\n user-modify: read-only;\n }\n\n & span.bold {\n font-weight: bold;\n }\n\n & .editor_paragraph {\n margin: 0;\n }\n\n & .text_bold {\n font-weight: 600;\n }\n\n & .text_italic {\n font-style: italic;\n }\n\n & .text_underline {\n text-decoration: underline;\n }\n\n & .text_strikethrough {\n text-decoration: line-through;\n }\n\n & .text_underlineStrikethrough {\n text-decoration: underline line-through;\n }\n\n & code {\n font-family: inherit;\n letter-spacing: 4px;\n }\n }\n"])), function (props) {
54596
+ var LexicalWrapper = styled.div(_templateObject13$6 || (_templateObject13$6 = _taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n\n & .rich_text_editor {\n width: 100%;\n max-height: 80px;\n min-height: 20px;\n display: block;\n border: none;\n box-sizing: border-box;\n outline: none !important;\n border-radius: ", ";\n background-color: ", ";\n padding: ", ";\n color: ", ";\n order: ", ";\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: none;\n scrollbar-color: transparent transparent;\n overscroll-behavior: none;\n\n @supports (overflow: overlay) {\n overflow-y: overlay;\n }\n\n &::-webkit-scrollbar {\n width: 8px;\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: transparent;\n }\n\n &.show-scrollbar::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 4px;\n }\n &.show-scrollbar::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &.show-scrollbar {\n scrollbar-width: thin;\n scrollbar-color: ", " transparent;\n }\n\n & p {\n font-size: 15px;\n line-height: 20px;\n color: ", ";\n }\n\n &::selection {\n background-color: ", ";\n }\n\n & *::selection {\n background-color: ", ";\n }\n\n & span::selection {\n background-color: ", ";\n }\n\n &:empty:before {\n content: attr(data-placeholder);\n }\n\n & .content_editable_input {\n border: none !important;\n outline: none !important;\n }\n\n & .mention {\n color: ", ";\n background-color: inherit !important;\n user-select: text;\n -webkit-user-select: text;\n }\n\n & span.bold {\n font-weight: bold;\n }\n\n & .editor_paragraph {\n margin: 0;\n }\n\n & .text_bold {\n font-weight: 600;\n }\n\n & .text_italic {\n font-style: italic;\n }\n\n & .text_underline {\n text-decoration: underline;\n }\n\n & .text_strikethrough {\n text-decoration: line-through;\n }\n\n & .text_underlineStrikethrough {\n text-decoration: underline line-through;\n }\n\n & code {\n font-family: inherit;\n letter-spacing: 4px;\n }\n }\n"])), function (props) {
54296
54597
  return props.borderRadius;
54297
54598
  }, function (props) {
54298
54599
  return props.backgroundColor;
@@ -54335,7 +54636,7 @@ var SendMessageButton = styled.span(_templateObject16$2 || (_templateObject16$2
54335
54636
  return !props.isCustomButton && "\n display: flex;\n height: " + (props.height ? props.height + "px" : '36px') + ";\n align-items: center;\n // margin: 0 8px 0 auto;\n cursor: " + (props.isActive && 'pointer') + ";\n line-height: 13px;\n order: " + (props.order === 0 || props.order ? props.order : 4) + ";\n -webkit-tap-highlight-color: transparent;\n\n color: " + (props.isActive ? props.activeColor : props.color) + ";\n & > svg {\n color: " + props.iconColor + ";\n }\n ";
54336
54637
  });
54337
54638
  var AudioCont = styled.div(_templateObject17$2 || (_templateObject17$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n justify-content: flex-end;\n"])));
54338
- var ChosenAttachments = styled.div(_templateObject18$2 || (_templateObject18$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n padding: 16px 16px 14px;\n overflow-x: auto;\n\n & ", " {\n width: 100%;\n height: 100%;\n border-radius: 4px;\n object-fit: cover;\n }\n\n & ", " {\n width: 240px;\n padding: 5px 12px;\n border-radius: 8px;\n height: 50px;\n }\n"])), AttachmentImg, AttachmentFile$1);
54639
+ var ChosenAttachments = styled.div(_templateObject18$2 || (_templateObject18$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n padding: 16px 16px 14px;\n overflow-x: auto;\n\n & ", " {\n width: 100%;\n height: 100%;\n border-radius: 4px;\n object-fit: cover;\n }\n\n & ", " {\n width: 240px;\n padding: 5px;\n border-radius: 8px;\n height: 50px;\n }\n"])), AttachmentImg, AttachmentFile$1);
54339
54640
  var TypingIndicator$1 = styled.div(_templateObject19$2 || (_templateObject19$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: 100%;\n left: 16px;\n"])));
54340
54641
  var TypingIndicatorCont = styled.div(_templateObject20$2 || (_templateObject20$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-bottom: 12px;\n gap: 4px;\n"])));
54341
54642
  var TypingFrom = styled.h5(_templateObject21$2 || (_templateObject21$2 = _taggedTemplateLiteralLoose(["\n margin: 0 4px 0 0;\n font-weight: 400;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: -0.2px;\n color: ", ";\n"])), function (props) {
@@ -54400,19 +54701,24 @@ var LinkPreviewContainer = styled.div(_templateObject39$1 || (_templateObject39$
54400
54701
  return props.isClosing ? linkPreviewSlideOut : linkPreviewSlideIn;
54401
54702
  });
54402
54703
  var LinkPreviewContent = styled.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 12px;\n flex: 1;\n overflow: hidden;\n"])));
54403
- var LinkPreviewImage = styled.img(_templateObject41$1 || (_templateObject41$1 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 8px;\n flex-shrink: 0;\n"])));
54704
+ var LinkPreviewImage = styled.img(_templateObject41$1 || (_templateObject41$1 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 4px;\n flex-shrink: 0;\n margin-right: 8px;\n background: ", ";\n"])), function (props) {
54705
+ return props.bg;
54706
+ });
54404
54707
  var LinkPreviewIcon = styled(SvgLinkIcon)(_templateObject42 || (_templateObject42 = _taggedTemplateLiteralLoose(["\n color: ", ";\n rect {\n fill: ", ";\n fill-opacity: 1;\n }\n"])), function (props) {
54405
54708
  return props.color;
54406
54709
  }, function (props) {
54407
54710
  return props.bg;
54408
54711
  });
54409
- var LinkPreviewTextContent = styled.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 4px;\n overflow: hidden;\n flex: 1;\n justify-content: center;\n ", "\n"])), function (props) {
54712
+ var LinkPreviewIconWrapper = styled.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border-radius: 4px;\n margin-right: 8px;\n background: ", ";\n"])), function (props) {
54713
+ return props.bg;
54714
+ });
54715
+ var LinkPreviewTextContent = styled.div(_templateObject44 || (_templateObject44 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 4px;\n overflow: hidden;\n flex: 1;\n justify-content: center;\n ", "\n"])), function (props) {
54410
54716
  return props.hasImage ? '' : 'padding-left: 0;';
54411
54717
  });
54412
- var LinkPreviewTitle = styled.div(_templateObject44 || (_templateObject44 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: Inter;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (props) {
54718
+ var LinkPreviewTitle = styled.div(_templateObject45 || (_templateObject45 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: Inter;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (props) {
54413
54719
  return props.color;
54414
54720
  });
54415
- var LinkPreviewDescription = styled.div(_templateObject45 || (_templateObject45 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n font-weight: 400;\n font-size: 15px;\n line-height: 20px;\n letter-spacing: -0.2px;\n"])), function (props) {
54721
+ var LinkPreviewDescription = styled.div(_templateObject46 || (_templateObject46 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n font-weight: 400;\n font-size: 15px;\n line-height: 20px;\n letter-spacing: -0.2px;\n"])), function (props) {
54416
54722
  return props.color;
54417
54723
  });
54418
54724
 
@@ -55164,7 +55470,7 @@ var EmptyText = styled.div(_templateObject7$s || (_templateObject7$s = _taggedTe
55164
55470
  });
55165
55471
  var ChevronRightIconWrapper = styled.span(_templateObject8$p || (_templateObject8$p = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n\n & > svg {\n width: 16px;\n height: 16px;\n transform: rotate(-90deg);\n }\n"])));
55166
55472
 
55167
- var _templateObject$_, _templateObject2$V, _templateObject3$M, _templateObject4$F, _templateObject5$A, _templateObject6$w, _templateObject7$t, _templateObject8$q, _templateObject9$k, _templateObject0$i, _templateObject1$g, _templateObject10$d, _templateObject11$a, _templateObject12$7, _templateObject13$6, _templateObject14$5, _templateObject15$3, _templateObject16$3, _templateObject17$3, _templateObject18$3, _templateObject19$3, _templateObject20$3;
55473
+ var _templateObject$_, _templateObject2$V, _templateObject3$M, _templateObject4$F, _templateObject5$A, _templateObject6$w, _templateObject7$t, _templateObject8$q, _templateObject9$k, _templateObject0$i, _templateObject1$g, _templateObject10$d, _templateObject11$a, _templateObject12$8, _templateObject13$7, _templateObject14$5, _templateObject15$3, _templateObject16$3, _templateObject17$3, _templateObject18$3, _templateObject19$3, _templateObject20$3;
55168
55474
  var Actions = function Actions(_ref) {
55169
55475
  var _getDisappearingSetti;
55170
55476
  var setActionsHeight = _ref.setActionsHeight,
@@ -55245,12 +55551,14 @@ var Actions = function Actions(_ref) {
55245
55551
  commonGroupsTextColor = _ref.commonGroupsTextColor,
55246
55552
  showGroupsInCommon = _ref.showGroupsInCommon;
55247
55553
  var _useColor = useColors(),
55554
+ accentColor = _useColor[THEME_COLORS.ACCENT],
55248
55555
  textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
55249
55556
  textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
55250
55557
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
55251
55558
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
55252
55559
  warningColor = _useColor[THEME_COLORS.WARNING],
55253
- backgroundColor = _useColor[THEME_COLORS.BACKGROUND];
55560
+ backgroundColor = _useColor[THEME_COLORS.BACKGROUND],
55561
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
55254
55562
  var ChatClient = getClient();
55255
55563
  var user = ChatClient.user;
55256
55564
  var _useState = useState(false),
@@ -55263,35 +55571,39 @@ var Actions = function Actions(_ref) {
55263
55571
  leaveChannelPopupOpen = _useState3[0],
55264
55572
  setLeaveChannelPopupOpen = _useState3[1];
55265
55573
  var _useState4 = useState(false),
55266
- deleteChannelPopupOpen = _useState4[0],
55267
- setDeleteChannelPopupOpen = _useState4[1];
55574
+ leaveChannelOfflinePopupOpen = _useState4[0],
55575
+ setLeaveChannelOfflinePopupOpen = _useState4[1];
55268
55576
  var _useState5 = useState(false),
55269
- blockChannelPopupOpen = _useState5[0],
55270
- setBlockChannelPopupOpen = _useState5[1];
55577
+ deleteChannelPopupOpen = _useState5[0],
55578
+ setDeleteChannelPopupOpen = _useState5[1];
55271
55579
  var _useState6 = useState(false),
55272
- blockUserPopupOpen = _useState6[0],
55273
- setBlockUserPopupOpen = _useState6[1];
55580
+ blockChannelPopupOpen = _useState6[0],
55581
+ setBlockChannelPopupOpen = _useState6[1];
55274
55582
  var _useState7 = useState(false),
55275
- unblockUserPopupOpen = _useState7[0],
55276
- setUnblockUserPopupOpen = _useState7[1];
55583
+ blockUserPopupOpen = _useState7[0],
55584
+ setBlockUserPopupOpen = _useState7[1];
55277
55585
  var _useState8 = useState(false),
55278
- reportUserPopupOpen = _useState8[0],
55279
- setReportUserPopupOpen = _useState8[1];
55586
+ unblockUserPopupOpen = _useState8[0],
55587
+ setUnblockUserPopupOpen = _useState8[1];
55280
55588
  var _useState9 = useState(false),
55281
- disappearingMessagesPopupOpen = _useState9[0],
55282
- setDisappearingMessagesPopupOpen = _useState9[1];
55589
+ reportUserPopupOpen = _useState9[0],
55590
+ setReportUserPopupOpen = _useState9[1];
55283
55591
  var _useState0 = useState(false),
55284
- groupsInCommonPopupOpen = _useState0[0],
55285
- setGroupsInCommonPopupOpen = _useState0[1];
55592
+ disappearingMessagesPopupOpen = _useState0[0],
55593
+ setDisappearingMessagesPopupOpen = _useState0[1];
55594
+ var _useState1 = useState(false),
55595
+ groupsInCommonPopupOpen = _useState1[0],
55596
+ setGroupsInCommonPopupOpen = _useState1[1];
55286
55597
  var _usePermissions = usePermissions(channel.userRole),
55287
55598
  checkActionPermission = _usePermissions[0];
55288
- var _useState1 = useState(''),
55289
- popupButtonText = _useState1[0],
55290
- setPopupButtonText = _useState1[1];
55291
55599
  var _useState10 = useState(''),
55292
- popupTitle = _useState10[0],
55293
- setPopupTitle = _useState10[1];
55600
+ popupButtonText = _useState10[0],
55601
+ setPopupButtonText = _useState10[1];
55602
+ var _useState11 = useState(''),
55603
+ popupTitle = _useState11[0],
55604
+ setPopupTitle = _useState11[1];
55294
55605
  var dispatch = useDispatch();
55606
+ var connectionStatus = useSelector(connectionStatusSelector);
55295
55607
  var oneHour = 60 * 60 * 1000;
55296
55608
  var twoHours = oneHour * 2;
55297
55609
  var oneDay = oneHour * 24;
@@ -55336,6 +55648,10 @@ var Actions = function Actions(_ref) {
55336
55648
  }
55337
55649
  };
55338
55650
  var handleLeaveChannel = function handleLeaveChannel() {
55651
+ if (connectionStatus !== CONNECTION_STATUS.CONNECTED) {
55652
+ setLeaveChannelOfflinePopupOpen(true);
55653
+ return;
55654
+ }
55339
55655
  dispatch(leaveChannelAC(channel.id));
55340
55656
  };
55341
55657
  var handleDeleteChannel = function handleDeleteChannel() {
@@ -55637,7 +55953,37 @@ var Actions = function Actions(_ref) {
55637
55953
  buttonText: popupButtonText,
55638
55954
  description: channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE ? 'Once you leave this group it will be removed for you along with its entire history.' : 'Once you leave this channel it will be removed for you along with its entire history.',
55639
55955
  title: popupTitle
55640
- })), deleteChannelPopupOpen && (/*#__PURE__*/React__default.createElement(ConfirmPopup, {
55956
+ })), leaveChannelOfflinePopupOpen && (/*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
55957
+ backgroundColor: backgroundColor,
55958
+ maxWidth: '520px',
55959
+ minWidth: '520px',
55960
+ padding: '0'
55961
+ }, /*#__PURE__*/React__default.createElement(PopupBody, {
55962
+ paddingH: '24px',
55963
+ paddingV: '24px'
55964
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, {
55965
+ color: iconPrimary,
55966
+ onClick: function onClick() {
55967
+ return setLeaveChannelOfflinePopupOpen(false);
55968
+ }
55969
+ }), /*#__PURE__*/React__default.createElement(PopupName, {
55970
+ color: textPrimary,
55971
+ isDelete: true,
55972
+ marginBottom: '20px'
55973
+ }, "Failed to leave group"), /*#__PURE__*/React__default.createElement(PopupDescription, {
55974
+ color: textPrimary,
55975
+ highlightColor: textSecondary
55976
+ }, "You\u2019re offline. Reconnect and try again.")), /*#__PURE__*/React__default.createElement(PopupFooter, {
55977
+ backgroundColor: surface1
55978
+ }, /*#__PURE__*/React__default.createElement(Button, {
55979
+ type: 'button',
55980
+ backgroundColor: accentColor,
55981
+ color: textOnPrimary,
55982
+ borderRadius: '8px',
55983
+ onClick: function onClick() {
55984
+ return setLeaveChannelOfflinePopupOpen(false);
55985
+ }
55986
+ }, "Close"))))), deleteChannelPopupOpen && (/*#__PURE__*/React__default.createElement(ConfirmPopup, {
55641
55987
  handleFunction: handleDeleteChannel,
55642
55988
  togglePopup: handleToggleDeleteChannelPopupOpen,
55643
55989
  buttonText: popupButtonText,
@@ -55701,8 +56047,8 @@ var DefaultMarkAsRead = styled(SvgMarkAsRead)(_templateObject0$i || (_templateOb
55701
56047
  var DefaultMarkAsUnRead = styled(SvgMarkAsUnRead)(_templateObject1$g || (_templateObject1$g = _taggedTemplateLiteralLoose([""])));
55702
56048
  var DefaultBlockIcon = styled(SvgBlockChannel)(_templateObject10$d || (_templateObject10$d = _taggedTemplateLiteralLoose([""])));
55703
56049
  var DefaultReportIcon = styled(SvgReport)(_templateObject11$a || (_templateObject11$a = _taggedTemplateLiteralLoose([""])));
55704
- var DefaultClearIcon = styled(SvgClear)(_templateObject12$7 || (_templateObject12$7 = _taggedTemplateLiteralLoose([""])));
55705
- var DefaultDeleteChannelIcon = styled(SvgDeleteChannel)(_templateObject13$6 || (_templateObject13$6 = _taggedTemplateLiteralLoose([""])));
56050
+ var DefaultClearIcon = styled(SvgClear)(_templateObject12$8 || (_templateObject12$8 = _taggedTemplateLiteralLoose([""])));
56051
+ var DefaultDeleteChannelIcon = styled(SvgDeleteChannel)(_templateObject13$7 || (_templateObject13$7 = _taggedTemplateLiteralLoose([""])));
55706
56052
  var DefaultBottomIcon = styled(SvgBottom)(_templateObject14$5 || (_templateObject14$5 = _taggedTemplateLiteralLoose([""])));
55707
56053
  var DefaultMarkAsReadIcon = styled(SvgLeave)(_templateObject15$3 || (_templateObject15$3 = _taggedTemplateLiteralLoose([""])));
55708
56054
  var DefaultWatchIcon = styled(SvgWatch)(_templateObject16$3 || (_templateObject16$3 = _taggedTemplateLiteralLoose(["\n width: 24px;\n height: 24px;\n\n path.watch-ticks,\n path:nth-child(2) {\n fill: ", " !important;\n }\n"])), function (props) {
@@ -55891,7 +56237,7 @@ function SvgDownloadFile(props) {
55891
56237
  })));
55892
56238
  }
55893
56239
 
55894
- var _templateObject$10, _templateObject2$X, _templateObject3$O, _templateObject4$H, _templateObject5$C, _templateObject6$y, _templateObject7$v, _templateObject8$s, _templateObject9$m, _templateObject0$k, _templateObject1$h, _templateObject10$e, _templateObject11$b, _templateObject12$8, _templateObject13$7, _templateObject14$6, _templateObject15$4;
56240
+ var _templateObject$10, _templateObject2$X, _templateObject3$O, _templateObject4$H, _templateObject5$C, _templateObject6$y, _templateObject7$v, _templateObject8$s, _templateObject9$m, _templateObject0$k, _templateObject1$h, _templateObject10$e, _templateObject11$b, _templateObject12$9, _templateObject13$8, _templateObject14$6, _templateObject15$4;
55895
56241
  var Files = function Files(_ref) {
55896
56242
  var channelId = _ref.channelId,
55897
56243
  filePreviewIcon = _ref.filePreviewIcon,
@@ -56106,12 +56452,12 @@ var FileIconCont = styled.span(_templateObject11$b || (_templateObject11$b = _ta
56106
56452
  }, function (props) {
56107
56453
  return props.fillColor;
56108
56454
  });
56109
- var FileHoverIconCont = styled.span(_templateObject12$8 || (_templateObject12$8 = _taggedTemplateLiteralLoose(["\n display: none;\n & > svg {\n width: 40px;\n height: 40px;\n color: ", ";\n rect {\n fill: ", ";\n }\n }\n"])), function (props) {
56455
+ var FileHoverIconCont = styled.span(_templateObject12$9 || (_templateObject12$9 = _taggedTemplateLiteralLoose(["\n display: none;\n & > svg {\n width: 40px;\n height: 40px;\n color: ", ";\n rect {\n fill: ", ";\n }\n }\n"])), function (props) {
56110
56456
  return props.iconColor;
56111
56457
  }, function (props) {
56112
56458
  return props.fillColor;
56113
56459
  });
56114
- var FileThumb = styled.img(_templateObject13$7 || (_templateObject13$7 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n object-fit: cover;\n"])));
56460
+ var FileThumb = styled.img(_templateObject13$8 || (_templateObject13$8 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n object-fit: cover;\n"])));
56115
56461
  var FileItem = styled.div(_templateObject14$6 || (_templateObject14$6 = _taggedTemplateLiteralLoose(["\n position: relative;\n padding: 11px 16px;\n display: flex;\n align-items: center;\n font-size: 15px;\n transition: all 0.2s;\n div {\n margin-left: 7px;\n width: calc(100% - 48px);\n }\n &:hover {\n background-color: ", ";\n ", " {\n visibility: visible;\n }\n & ", " {\n display: none;\n }\n & ", " {\n display: inline-flex;\n }\n }\n"])), function (props) {
56116
56462
  return props.hoverBackgroundColor;
56117
56463
  }, DownloadWrapper, FileIconCont, FileHoverIconCont);
@@ -56800,7 +57146,7 @@ function ResetLinkConfirmModal(_ref) {
56800
57146
  });
56801
57147
  }
56802
57148
 
56803
- var _templateObject$16, _templateObject2$11, _templateObject3$U, _templateObject4$M, _templateObject5$H, _templateObject6$C, _templateObject7$z, _templateObject8$w, _templateObject9$p, _templateObject0$m, _templateObject1$i, _templateObject10$f, _templateObject11$c, _templateObject12$9, _templateObject13$8;
57149
+ var _templateObject$16, _templateObject2$11, _templateObject3$U, _templateObject4$M, _templateObject5$H, _templateObject6$C, _templateObject7$z, _templateObject8$w, _templateObject9$p, _templateObject0$m, _templateObject1$i, _templateObject10$f, _templateObject11$c, _templateObject12$a, _templateObject13$9;
56804
57150
  function loadImage$1(src) {
56805
57151
  return new Promise(function (resolve, reject) {
56806
57152
  var img = document.createElement('img');
@@ -57417,16 +57763,16 @@ var Switch = styled.div(_templateObject10$f || (_templateObject10$f = _taggedTem
57417
57763
  return p.active ? '22px' : '3px';
57418
57764
  });
57419
57765
  var ResetLink = styled.button(_templateObject11$c || (_templateObject11$c = _taggedTemplateLiteralLoose(["\n margin-top: 12px;\n border: none;\n background: transparent;\n color: #ff4d4f;\n cursor: pointer;\n"])));
57420
- var QRCodeBox = styled.div(_templateObject12$9 || (_templateObject12$9 = _taggedTemplateLiteralLoose(["\n border-radius: 8px;\n border: 1px solid ", ";\n background-color: ", ";\n display: flex;\n width: max-content;\n padding: 13.5px;\n margin: auto;\n position: relative;\n"])), function (p) {
57766
+ var QRCodeBox = styled.div(_templateObject12$a || (_templateObject12$a = _taggedTemplateLiteralLoose(["\n border-radius: 8px;\n border: 1px solid ", ";\n background-color: ", ";\n display: flex;\n width: max-content;\n padding: 13.5px;\n margin: auto;\n position: relative;\n"])), function (p) {
57421
57767
  return p.borderColor;
57422
57768
  }, function (p) {
57423
57769
  return p.backgroundColor;
57424
57770
  });
57425
- var QrHint = styled.p(_templateObject13$8 || (_templateObject13$8 = _taggedTemplateLiteralLoose(["\n text-align: center;\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n margin: 12px 0 0;\n"])), function (p) {
57771
+ var QrHint = styled.p(_templateObject13$9 || (_templateObject13$9 = _taggedTemplateLiteralLoose(["\n text-align: center;\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n margin: 12px 0 0;\n"])), function (p) {
57426
57772
  return p.color;
57427
57773
  });
57428
57774
 
57429
- var _templateObject$17, _templateObject2$12, _templateObject3$V, _templateObject4$N, _templateObject5$I, _templateObject6$D, _templateObject7$A, _templateObject8$x, _templateObject9$q, _templateObject0$n, _templateObject1$j, _templateObject10$g, _templateObject11$d, _templateObject12$a, _templateObject13$9;
57775
+ var _templateObject$17, _templateObject2$12, _templateObject3$V, _templateObject4$N, _templateObject5$I, _templateObject6$D, _templateObject7$A, _templateObject8$x, _templateObject9$q, _templateObject0$n, _templateObject1$j, _templateObject10$g, _templateObject11$d, _templateObject12$b, _templateObject13$a;
57430
57776
  var Members = function Members(_ref) {
57431
57777
  var _members$find;
57432
57778
  var channel = _ref.channel,
@@ -57784,12 +58130,12 @@ var SkeletonBlock$5 = styled.div(_templateObject0$n || (_templateObject0$n = _ta
57784
58130
  var SkeletonMemberRow = styled.div(_templateObject1$j || (_templateObject1$j = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n padding: 6px 16px;\n gap: 12px;\n height: 56px;\n"])));
57785
58131
  var SkeletonAvatar$1 = styled(SkeletonBlock$5)(_templateObject10$g || (_templateObject10$g = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border-radius: 50%;\n flex-shrink: 0;\n"])));
57786
58132
  var SkeletonTextGroup$2 = styled.div(_templateObject11$d || (_templateObject11$d = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n"])));
57787
- var SkeletonLine$4 = styled(SkeletonBlock$5)(_templateObject12$a || (_templateObject12$a = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: ", ";\n border-radius: 7px;\n"])), function (p) {
58133
+ var SkeletonLine$4 = styled(SkeletonBlock$5)(_templateObject12$b || (_templateObject12$b = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: ", ";\n border-radius: 7px;\n"])), function (p) {
57788
58134
  return p.width;
57789
58135
  }, function (p) {
57790
58136
  return p.height || '14px';
57791
58137
  });
57792
- var RoleBadge = styled.span(_templateObject13$9 || (_templateObject13$9 = _taggedTemplateLiteralLoose(["\n position: relative;\n padding: 2px 8px;\n border-radius: 12px;\n margin-left: 4px;\n font-weight: 500;\n font-size: 12px;\n line-height: 16px;\n color: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n border-radius: 12px;\n width: 100%;\n height: 100%;\n background-color: ", ";\n opacity: 0.1;\n }\n"])), function (props) {
58138
+ var RoleBadge = styled.span(_templateObject13$a || (_templateObject13$a = _taggedTemplateLiteralLoose(["\n position: relative;\n padding: 2px 8px;\n border-radius: 12px;\n margin-left: 4px;\n font-weight: 500;\n font-size: 12px;\n line-height: 16px;\n color: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n border-radius: 12px;\n width: 100%;\n height: 100%;\n background-color: ", ";\n opacity: 0.1;\n }\n"])), function (props) {
57793
58139
  return props.color;
57794
58140
  }, function (props) {
57795
58141
  return props.backgroundColor;
@@ -58769,7 +59115,7 @@ function SvgChevronDownSearch(props) {
58769
59115
  })));
58770
59116
  }
58771
59117
 
58772
- var _templateObject$1b, _templateObject2$16, _templateObject3$Y, _templateObject4$Q, _templateObject5$K, _templateObject6$F, _templateObject7$C, _templateObject8$z, _templateObject9$s, _templateObject0$p, _templateObject1$l, _templateObject10$i, _templateObject11$f, _templateObject12$b, _templateObject13$a, _templateObject14$7, _templateObject15$5, _templateObject16$4, _templateObject17$4, _templateObject18$4, _templateObject19$4, _templateObject20$4, _templateObject21$3, _templateObject22$2, _templateObject23$2, _templateObject24$2, _templateObject25$2;
59118
+ var _templateObject$1b, _templateObject2$16, _templateObject3$Y, _templateObject4$Q, _templateObject5$K, _templateObject6$F, _templateObject7$C, _templateObject8$z, _templateObject9$s, _templateObject0$p, _templateObject1$l, _templateObject10$i, _templateObject11$f, _templateObject12$c, _templateObject13$b, _templateObject14$7, _templateObject15$5, _templateObject16$4, _templateObject17$4, _templateObject18$4, _templateObject19$4, _templateObject20$4, _templateObject21$3, _templateObject22$2, _templateObject23$2, _templateObject24$2, _templateObject25$2;
58773
59119
  var SEARCH_DEBOUNCE_MS = 400;
58774
59120
  function formatMessageDate(date) {
58775
59121
  if (!date) return '';
@@ -59211,8 +59557,8 @@ var StatusText$1 = styled.p(_templateObject11$f || (_templateObject11$f = _tagge
59211
59557
  }, function (props) {
59212
59558
  return props.full ? 'height: 100%;' : '';
59213
59559
  });
59214
- var GroupSection = styled.div(_templateObject12$b || (_templateObject12$b = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
59215
- var GroupLabel = styled.div(_templateObject13$a || (_templateObject13$a = _taggedTemplateLiteralLoose(["\n position: sticky;\n top: 0;\n z-index: 1;\n background-color: ", ";\n text-transform: capitalize;\n letter-spacing: 0.5px;\n color: ", ";\n padding: 12px 16px 4px;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n user-select: none;\n"])), function (p) {
59560
+ var GroupSection = styled.div(_templateObject12$c || (_templateObject12$c = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
59561
+ var GroupLabel = styled.div(_templateObject13$b || (_templateObject13$b = _taggedTemplateLiteralLoose(["\n position: sticky;\n top: 0;\n z-index: 1;\n background-color: ", ";\n text-transform: capitalize;\n letter-spacing: 0.5px;\n color: ", ";\n padding: 12px 16px 4px;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n user-select: none;\n"])), function (p) {
59216
59562
  return p.backgroundColor;
59217
59563
  }, function (p) {
59218
59564
  return p.color;