@uzum-tech/ui 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/index.js +1548 -998
  2. package/dist/index.prod.js +3 -3
  3. package/es/chat/index.d.ts +4 -0
  4. package/es/chat/index.js +2 -0
  5. package/es/chat/src/Chat.d.ts +19 -6
  6. package/es/chat/src/Chat.js +53 -14
  7. package/es/chat/src/ChatListItems.d.ts +6027 -0
  8. package/es/chat/src/ChatListItems.js +187 -0
  9. package/es/chat/src/ChatMessages.d.ts +6049 -0
  10. package/es/chat/src/ChatMessages.js +308 -0
  11. package/es/chat/src/ChatParts/ChatAttachment.js +4 -3
  12. package/es/chat/src/ChatParts/MainArea.d.ts +0 -2
  13. package/es/chat/src/ChatParts/MainArea.js +108 -229
  14. package/es/chat/src/ChatParts/Sidebar.js +16 -80
  15. package/es/chat/src/interface.d.ts +6 -1
  16. package/es/chat/src/styles/index.cssr.js +3 -2
  17. package/es/locales/common/arDZ.js +2 -1
  18. package/es/locales/common/deDE.js +2 -1
  19. package/es/locales/common/enGB.js +2 -1
  20. package/es/locales/common/enUS.d.ts +1 -0
  21. package/es/locales/common/enUS.js +2 -1
  22. package/es/locales/common/eo.js +2 -1
  23. package/es/locales/common/esAR.js +2 -1
  24. package/es/locales/common/faIR.js +2 -1
  25. package/es/locales/common/frFR.js +2 -1
  26. package/es/locales/common/idID.js +2 -1
  27. package/es/locales/common/itIT.js +2 -1
  28. package/es/locales/common/jaJP.js +2 -1
  29. package/es/locales/common/koKR.js +2 -1
  30. package/es/locales/common/nbNO.js +2 -1
  31. package/es/locales/common/nlNL.js +2 -1
  32. package/es/locales/common/plPL.js +2 -1
  33. package/es/locales/common/ptBR.js +2 -1
  34. package/es/locales/common/ruRU.js +2 -1
  35. package/es/locales/common/skSK.js +2 -1
  36. package/es/locales/common/svSE.js +2 -1
  37. package/es/locales/common/thTH.js +2 -1
  38. package/es/locales/common/trTR.js +2 -1
  39. package/es/locales/common/ukUA.js +2 -1
  40. package/es/locales/common/viVN.js +2 -1
  41. package/es/locales/common/zhCN.js +2 -1
  42. package/es/locales/common/zhTW.js +2 -1
  43. package/es/version.d.ts +1 -1
  44. package/es/version.js +1 -1
  45. package/lib/chat/index.d.ts +4 -0
  46. package/lib/chat/index.js +5 -1
  47. package/lib/chat/src/Chat.d.ts +19 -6
  48. package/lib/chat/src/Chat.js +52 -13
  49. package/lib/chat/src/ChatListItems.d.ts +6027 -0
  50. package/lib/chat/src/ChatListItems.js +193 -0
  51. package/lib/chat/src/ChatMessages.d.ts +6049 -0
  52. package/lib/chat/src/ChatMessages.js +314 -0
  53. package/lib/chat/src/ChatParts/ChatAttachment.js +4 -3
  54. package/lib/chat/src/ChatParts/MainArea.d.ts +0 -2
  55. package/lib/chat/src/ChatParts/MainArea.js +107 -228
  56. package/lib/chat/src/ChatParts/Sidebar.js +17 -78
  57. package/lib/chat/src/interface.d.ts +6 -1
  58. package/lib/chat/src/styles/index.cssr.js +3 -2
  59. package/lib/locales/common/arDZ.js +2 -1
  60. package/lib/locales/common/deDE.js +2 -1
  61. package/lib/locales/common/enGB.js +2 -1
  62. package/lib/locales/common/enUS.d.ts +1 -0
  63. package/lib/locales/common/enUS.js +2 -1
  64. package/lib/locales/common/eo.js +2 -1
  65. package/lib/locales/common/esAR.js +2 -1
  66. package/lib/locales/common/faIR.js +2 -1
  67. package/lib/locales/common/frFR.js +2 -1
  68. package/lib/locales/common/idID.js +2 -1
  69. package/lib/locales/common/itIT.js +2 -1
  70. package/lib/locales/common/jaJP.js +2 -1
  71. package/lib/locales/common/koKR.js +2 -1
  72. package/lib/locales/common/nbNO.js +2 -1
  73. package/lib/locales/common/nlNL.js +2 -1
  74. package/lib/locales/common/plPL.js +2 -1
  75. package/lib/locales/common/ptBR.js +2 -1
  76. package/lib/locales/common/ruRU.js +2 -1
  77. package/lib/locales/common/skSK.js +2 -1
  78. package/lib/locales/common/svSE.js +2 -1
  79. package/lib/locales/common/thTH.js +2 -1
  80. package/lib/locales/common/trTR.js +2 -1
  81. package/lib/locales/common/ukUA.js +2 -1
  82. package/lib/locales/common/viVN.js +2 -1
  83. package/lib/locales/common/zhCN.js +2 -1
  84. package/lib/locales/common/zhTW.js +2 -1
  85. package/lib/version.d.ts +1 -1
  86. package/lib/version.js +1 -1
  87. package/package.json +1 -1
  88. package/volar.d.ts +2 -0
  89. package/web-types.json +149 -1
  90. package/es/chat/src/ChatGlobalState.d.ts +0 -13
  91. package/es/chat/src/ChatGlobalState.js +0 -32
  92. package/lib/chat/src/ChatGlobalState.d.ts +0 -13
  93. package/lib/chat/src/ChatGlobalState.js +0 -36
package/dist/index.js CHANGED
@@ -15201,7 +15201,8 @@
15201
15201
  inputPlaceholder: "Type a message...",
15202
15202
  typingText: "Typing...",
15203
15203
  retryText: "Resend",
15204
- closeButtonText: "Close chat"
15204
+ closeButtonText: "Close chat",
15205
+ unreadNotificationText: "new messages"
15205
15206
  }
15206
15207
  };
15207
15208
 
@@ -15335,7 +15336,8 @@
15335
15336
  inputPlaceholder: "Type a message...",
15336
15337
  typingText: "Typing...",
15337
15338
  retryText: "Resend",
15338
- closeButtonText: "Close chat"
15339
+ closeButtonText: "Close chat",
15340
+ unreadNotificationText: "new messages"
15339
15341
  }
15340
15342
  };
15341
15343
 
@@ -15470,7 +15472,8 @@
15470
15472
  inputPlaceholder: "Type a message...",
15471
15473
  typingText: "Typing...",
15472
15474
  retryText: "Resend",
15473
- closeButtonText: "Close chat"
15475
+ closeButtonText: "Close chat",
15476
+ unreadNotificationText: "new messages"
15474
15477
  }
15475
15478
  };
15476
15479
 
@@ -15609,7 +15612,8 @@
15609
15612
  inputPlaceholder: "\u041D\u0430\u043F\u0438\u0441\u0430\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435...",
15610
15613
  typingText: "\u041F\u0435\u0447\u0430\u0442\u0430\u0435\u0442...",
15611
15614
  retryText: "\u041F\u043E\u0432\u0442\u043E\u0440\u043D\u043E \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",
15612
- closeButtonText: "\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044C \u0447\u0430\u0442"
15615
+ closeButtonText: "\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044C \u0447\u0430\u0442",
15616
+ unreadNotificationText: "\u043D\u043E\u0432\u044B\u0445 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439"
15613
15617
  }
15614
15618
  };
15615
15619
 
@@ -15744,7 +15748,8 @@
15744
15748
  inputPlaceholder: "Type a message...",
15745
15749
  typingText: "Typing...",
15746
15750
  retryText: "Resend",
15747
- closeButtonText: "Close chat"
15751
+ closeButtonText: "Close chat",
15752
+ unreadNotificationText: "new messages"
15748
15753
  }
15749
15754
  };
15750
15755
 
@@ -15881,7 +15886,8 @@
15881
15886
  inputPlaceholder: "Type a message...",
15882
15887
  typingText: "Typing...",
15883
15888
  retryText: "Resend",
15884
- closeButtonText: "Close chat"
15889
+ closeButtonText: "Close chat",
15890
+ unreadNotificationText: "new messages"
15885
15891
  }
15886
15892
  };
15887
15893
 
@@ -16018,7 +16024,8 @@
16018
16024
  inputPlaceholder: "Type a message...",
16019
16025
  typingText: "Typing...",
16020
16026
  retryText: "Resend",
16021
- closeButtonText: "Close chat"
16027
+ closeButtonText: "Close chat",
16028
+ unreadNotificationText: "new messages"
16022
16029
  }
16023
16030
  };
16024
16031
 
@@ -16156,7 +16163,8 @@
16156
16163
  inputPlaceholder: "Type a message...",
16157
16164
  typingText: "Typing...",
16158
16165
  retryText: "Resend",
16159
- closeButtonText: "Close chat"
16166
+ closeButtonText: "Close chat",
16167
+ unreadNotificationText: "new messages"
16160
16168
  }
16161
16169
  };
16162
16170
 
@@ -16290,7 +16298,8 @@
16290
16298
  inputPlaceholder: "Type a message...",
16291
16299
  typingText: "Typing...",
16292
16300
  retryText: "Resend",
16293
- closeButtonText: "Close chat"
16301
+ closeButtonText: "Close chat",
16302
+ unreadNotificationText: "new messages"
16294
16303
  }
16295
16304
  };
16296
16305
 
@@ -16428,7 +16437,8 @@
16428
16437
  inputPlaceholder: "Type a message...",
16429
16438
  typingText: "Typing...",
16430
16439
  retryText: "Resend",
16431
- closeButtonText: "Close chat"
16440
+ closeButtonText: "Close chat",
16441
+ unreadNotificationText: "new messages"
16432
16442
  }
16433
16443
  };
16434
16444
 
@@ -16564,7 +16574,8 @@
16564
16574
  inputPlaceholder: "Type a message...",
16565
16575
  typingText: "Typing...",
16566
16576
  retryText: "Resend",
16567
- closeButtonText: "Close chat"
16577
+ closeButtonText: "Close chat",
16578
+ unreadNotificationText: "new messages"
16568
16579
  }
16569
16580
  };
16570
16581
 
@@ -16698,7 +16709,8 @@
16698
16709
  inputPlaceholder: "Type a message...",
16699
16710
  typingText: "Typing...",
16700
16711
  retryText: "Resend",
16701
- closeButtonText: "Close chat"
16712
+ closeButtonText: "Close chat",
16713
+ unreadNotificationText: "new messages"
16702
16714
  }
16703
16715
  };
16704
16716
 
@@ -16836,7 +16848,8 @@
16836
16848
  inputPlaceholder: "Type a message...",
16837
16849
  typingText: "Typing...",
16838
16850
  retryText: "Resend",
16839
- closeButtonText: "Close chat"
16851
+ closeButtonText: "Close chat",
16852
+ unreadNotificationText: "new messages"
16840
16853
  }
16841
16854
  };
16842
16855
 
@@ -16973,7 +16986,8 @@
16973
16986
  inputPlaceholder: "Type a message...",
16974
16987
  typingText: "Typing...",
16975
16988
  retryText: "Resend",
16976
- closeButtonText: "Close chat"
16989
+ closeButtonText: "Close chat",
16990
+ unreadNotificationText: "new messages"
16977
16991
  }
16978
16992
  };
16979
16993
 
@@ -17111,7 +17125,8 @@
17111
17125
  inputPlaceholder: "Type a message...",
17112
17126
  typingText: "Typing...",
17113
17127
  retryText: "Resend",
17114
- closeButtonText: "Close chat"
17128
+ closeButtonText: "Close chat",
17129
+ unreadNotificationText: "new messages"
17115
17130
  }
17116
17131
  };
17117
17132
 
@@ -17246,7 +17261,8 @@
17246
17261
  inputPlaceholder: "Type a message...",
17247
17262
  typingText: "Typing...",
17248
17263
  retryText: "Resend",
17249
- closeButtonText: "Close chat"
17264
+ closeButtonText: "Close chat",
17265
+ unreadNotificationText: "new messages"
17250
17266
  }
17251
17267
  };
17252
17268
 
@@ -17383,7 +17399,8 @@
17383
17399
  inputPlaceholder: "Type a message...",
17384
17400
  typingText: "Typing...",
17385
17401
  retryText: "Resend",
17386
- closeButtonText: "Close chat"
17402
+ closeButtonText: "Close chat",
17403
+ unreadNotificationText: "new messages"
17387
17404
  }
17388
17405
  };
17389
17406
 
@@ -17517,7 +17534,8 @@
17517
17534
  inputPlaceholder: "Type a message...",
17518
17535
  typingText: "Typing...",
17519
17536
  retryText: "Resend",
17520
- closeButtonText: "Close chat"
17537
+ closeButtonText: "Close chat",
17538
+ unreadNotificationText: "new messages"
17521
17539
  }
17522
17540
  };
17523
17541
 
@@ -17655,7 +17673,8 @@
17655
17673
  inputPlaceholder: "Type a message...",
17656
17674
  typingText: "Typing...",
17657
17675
  retryText: "Resend",
17658
- closeButtonText: "Close chat"
17676
+ closeButtonText: "Close chat",
17677
+ unreadNotificationText: "new messages"
17659
17678
  }
17660
17679
  };
17661
17680
 
@@ -17789,7 +17808,8 @@
17789
17808
  inputPlaceholder: "Type a message...",
17790
17809
  typingText: "Typing...",
17791
17810
  retryText: "Resend",
17792
- closeButtonText: "Close chat"
17811
+ closeButtonText: "Close chat",
17812
+ unreadNotificationText: "new messages"
17793
17813
  }
17794
17814
  };
17795
17815
 
@@ -17924,7 +17944,8 @@
17924
17944
  inputPlaceholder: "Type a message...",
17925
17945
  typingText: "Typing...",
17926
17946
  retryText: "Resend",
17927
- closeButtonText: "Close chat"
17947
+ closeButtonText: "Close chat",
17948
+ unreadNotificationText: "new messages"
17928
17949
  }
17929
17950
  };
17930
17951
 
@@ -18060,7 +18081,8 @@
18060
18081
  inputPlaceholder: "Type a message...",
18061
18082
  typingText: "Typing...",
18062
18083
  retryText: "Resend",
18063
- closeButtonText: "Close chat"
18084
+ closeButtonText: "Close chat",
18085
+ unreadNotificationText: "new messages"
18064
18086
  }
18065
18087
  };
18066
18088
 
@@ -18194,7 +18216,8 @@
18194
18216
  inputPlaceholder: "Type a message...",
18195
18217
  typingText: "Typing...",
18196
18218
  retryText: "Resend",
18197
- closeButtonText: "Close chat"
18219
+ closeButtonText: "Close chat",
18220
+ unreadNotificationText: "new messages"
18198
18221
  }
18199
18222
  };
18200
18223
 
@@ -18328,7 +18351,8 @@
18328
18351
  inputPlaceholder: "Type a message...",
18329
18352
  typingText: "Typing...",
18330
18353
  retryText: "Resend",
18331
- closeButtonText: "Close chat"
18354
+ closeButtonText: "Close chat",
18355
+ unreadNotificationText: "new messages"
18332
18356
  }
18333
18357
  };
18334
18358
 
@@ -18462,7 +18486,8 @@
18462
18486
  inputPlaceholder: "Type a message...",
18463
18487
  typingText: "Typing...",
18464
18488
  retryText: "Resend",
18465
- closeButtonText: "Close chat"
18489
+ closeButtonText: "Close chat",
18490
+ unreadNotificationText: "new messages"
18466
18491
  }
18467
18492
  };
18468
18493
 
@@ -58022,41 +58047,6 @@
58022
58047
  })(ChatMessageType || {});
58023
58048
  const chatInjectionKey = createInjectionKey("chat");
58024
58049
 
58025
- class ChatGlobalState {
58026
- static {
58027
- this.instance = null;
58028
- }
58029
- constructor() {
58030
- this.notificationsShown = /* @__PURE__ */new Set();
58031
- this.openedChats = /* @__PURE__ */new Set();
58032
- }
58033
- static getInstance() {
58034
- if (!ChatGlobalState.instance) {
58035
- ChatGlobalState.instance = new ChatGlobalState();
58036
- }
58037
- return ChatGlobalState.instance;
58038
- }
58039
- hasNotificationShown(chatId) {
58040
- return this.notificationsShown.has(chatId);
58041
- }
58042
- markNotificationShown(chatId) {
58043
- this.notificationsShown.add(chatId);
58044
- }
58045
- isChatOpened(chatId) {
58046
- return this.openedChats.has(chatId);
58047
- }
58048
- markChatOpened(chatId) {
58049
- this.openedChats.add(chatId);
58050
- }
58051
- markChatClosed(chatId) {
58052
- this.openedChats.delete(chatId);
58053
- }
58054
- reset() {
58055
- this.notificationsShown.clear();
58056
- this.openedChats.clear();
58057
- }
58058
- }
58059
-
58060
58050
  var commonVars = {
58061
58051
  gapSmall: "4px 8px",
58062
58052
  gapMedium: "8px 12px",
@@ -59745,83 +59735,609 @@
59745
59735
  }
59746
59736
  });
59747
59737
 
59738
+ var style$12 = cB("chat", `
59739
+ height: 100%;
59740
+ max-height: 100%;
59741
+ min-height: 0;
59742
+ display: flex;
59743
+ overflow: hidden;
59744
+ box-sizing: border-box;
59745
+ .u-list-item__text {
59746
+ grid-template-columns: 1fr !important;
59747
+ }
59748
+ .u-flex {
59749
+ height: 100%;
59750
+ max-height: 100%;
59751
+ min-height: 0;
59752
+ overflow: hidden;
59753
+ }
59754
+ `, [cB("chat-sidebar", `
59755
+ max-width: 388px;
59756
+ width: 100%;
59757
+ height: 100%;
59758
+ display: flex;
59759
+ flex-direction: column;
59760
+ background-color: var(--u-sidebar-background-color);
59761
+ border: 1px solid var(--u-sidebar-border-color);
59762
+ border-radius: 20px;
59763
+ overflow: hidden;
59764
+ `, [cE("header", `
59765
+ flex-shrink: 0;
59766
+ `), cE("header-container", `
59767
+ padding: 16px 16px 4px 16px;
59768
+ `), cE("header-main", `
59769
+ flex: 0 0 48%;
59770
+ min-width: 0;
59771
+ `), cE("header-actions", `
59772
+ flex: 0 0 48%;
59773
+ min-width: 0;
59774
+ display: flex;
59775
+ justify-content: flex-end;
59776
+ align-items: center;
59777
+ gap: 8px;
59778
+ `), cE("content", `
59779
+ flex: 1;
59780
+ overflow-y: auto;
59781
+ min-height: 0;
59782
+ padding: 16px;
59783
+ padding-top: 8px;
59784
+ `), cE("item", `
59785
+ padding: 12px 16px;
59786
+ width: 100%;
59787
+ cursor: pointer;
59788
+ border-radius: 8px;
59789
+ margin-bottom: 4px;
59790
+ transition: all 0.2s ease;
59791
+ position: relative;
59792
+ `, [c$1(".u-list-item", `
59793
+ min-width: 0;
59794
+ `), c$1(".u-list-item__main", `
59795
+ min-width: 0;
59796
+ flex: 1;
59797
+ `), c$1(".u-list-item__prefix", `
59798
+ flex-shrink: 0;
59799
+ `), c$1(".u-list-item__suffix", `
59800
+ flex-shrink: 0;
59801
+ margin-left: 12px;
59802
+ `), c$1(".u-list-item__text", `
59803
+ grid-template-columns: 1fr !important;
59804
+ min-width: 0 !important;
59805
+ max-width: 100%;
59806
+ `), c$1(".u-list-item__content", `
59807
+ min-width: 0;
59808
+ `), c$1(".u-list-item__title", `
59809
+ min-width: 0;
59810
+ `), c$1(".u-list-item__subtitle", `
59811
+ min-width: 0 !important;
59812
+ `), cM("selected", `
59813
+ background-color: var(--u-sidebar-item-background-color-selected);
59814
+ `, [c$1("&:hover", `
59815
+ background-color: var(--u-sidebar-item-background-color-selected);
59816
+ `)]), cM("typing", `
59817
+ .u-list-item__description {
59818
+ color: var(--u-color-primary) !important;
59819
+ font-style: italic;
59820
+ }
59821
+ `), c$1("&:hover", `
59822
+ background-color: var(--u-sidebar-item-background-color-hover);
59823
+ `, [cM("selected", `
59824
+ background-color: var(--u-sidebar-item-background-color-selected);
59825
+ `)])]), cE("item-title", `
59826
+ font-weight: 500;
59827
+ font-size: 14px;
59828
+ line-height: 20px;
59829
+ color: var(--u-sidebar-item-text-color);
59830
+ overflow: hidden;
59831
+ text-overflow: ellipsis;
59832
+ white-space: nowrap;
59833
+ `), cE("item-subtitle", `
59834
+ font-size: 12px;
59835
+ line-height: 16px;
59836
+ color: var(--u-sidebar-item-subtitle-color);
59837
+ overflow: hidden;
59838
+ text-overflow: ellipsis;
59839
+ white-space: nowrap;
59840
+ `, [cM("typing", `
59841
+ color: var(--u-color-primary);
59842
+ font-style: italic;
59843
+ `)]), cE("item-main", `
59844
+ flex: 1;
59845
+ min-width: 0;
59846
+ margin-right: 12px;
59847
+ `), cE("item-title", `
59848
+ font-weight: 500;
59849
+ font-size: 14px;
59850
+ line-height: 20px;
59851
+ color: var(--u-text-color-base);
59852
+ margin-bottom: 2px;
59853
+ overflow: hidden;
59854
+ text-overflow: ellipsis;
59855
+ white-space: nowrap;
59856
+ `), cE("item-subtitle", `
59857
+ font-size: 12px;
59858
+ line-height: 16px;
59859
+ color: var(--u-text-color-disabled);
59860
+ overflow: hidden;
59861
+ text-overflow: ellipsis;
59862
+ white-space: nowrap;
59863
+ `), cE("item-indicators", `
59864
+ display: flex;
59865
+ flex-direction: column;
59866
+ align-items: flex-end;
59867
+ gap: 4px;
59868
+ flex-shrink: 0;
59869
+ `), cE("item-time", `
59870
+ font-size: 11px;
59871
+ line-height: 21px;
59872
+ color: var(--u-sidebar-item-time-color);
59873
+ white-space: nowrap;
59874
+ `), cE("item-status sup", `
59875
+ padding: 2px 6px 2px 5px;
59876
+ height: 22px;
59877
+ --u-color: var(--u-unread-notification-background-color);
59878
+ `), cE("item-status-icon", `
59879
+ color: var(--u-sidebar-item-time-color);
59880
+ `, [cM("read", `
59881
+ color: var(--u-unread-notification-background-color);
59882
+ `)]), c$1("&:has(.u-chat-sidebar__item-badge)", `
59883
+ `, [cE("item-title", `
59884
+ font-weight: 600;
59885
+ `), cE("item-subtitle", `
59886
+ color: var(--u-text-color-base);
59887
+ font-weight: 500;
59888
+ `)])]), cB("chat-main", `
59889
+ background-color: var(--u-main-background-color);
59890
+ border: 1px solid var(--u-border-color);
59891
+ border-radius: 20px;
59892
+ width: 100%;
59893
+ flex: 1;
59894
+ display: flex;
59895
+ flex-direction: column;
59896
+ height: 100%;
59897
+ max-height: 100%;
59898
+ min-height: 0;
59899
+ overflow: hidden;
59900
+ `, [cE("header", `
59901
+ border-bottom: 1px solid var(--u-border-color);
59902
+ width: 100%;
59903
+ padding: 24px 20px 8px 24px;
59904
+ flex-shrink: 0;
59905
+ `), cE("header-title", `
59906
+ margin-top: 9px;
59907
+ color: var(--u-header-title-color);
59908
+ `), cE("header-actions", `
59909
+ padding: 4px;
59910
+ `), cE("unread-notification", `
59911
+ background-color: var(--u-unread-notification-background-color);
59912
+ color: var(--u-unread-notification-text-color);
59913
+ padding: 6px 12px;
59914
+ text-align: center;
59915
+ font-size: 12px;
59916
+ font-weight: 500;
59917
+ margin: 8px 0;
59918
+ display: flex;
59919
+ justify-content: center;
59920
+ width: 100%;
59921
+ `, [c$1("span", `
59922
+ display: inline-block;
59923
+ white-space: nowrap;
59924
+ `)]), cE("body", `
59925
+ flex: 1;
59926
+ min-height: 0;
59927
+ position: relative;
59928
+ `, [c$1(".u-scrollbar-content", `
59929
+ padding: 16px 24px;
59930
+ min-height: 100%;
59931
+ display: flex;
59932
+ flex-direction: column;
59933
+ justify-content: flex-end;
59934
+ `)]), cE("messages-container", `
59935
+ display: flex;
59936
+ flex-direction: column;
59937
+ gap: 16px;
59938
+ min-height: 100%;
59939
+ width: 100%;
59940
+ justify-content: flex-end;
59941
+ `), cE("date-separator", `
59942
+ display: flex;
59943
+ justify-content: center;
59944
+ margin: 16px 0;
59945
+ `, [c$1("span", `
59946
+ color: var(--u-date-separator-color);
59947
+ padding: 4px 12px;
59948
+ border-radius: 12px;
59949
+ font-size: 12px;
59950
+ font-weight: 500;
59951
+ `)]), cE("message", `
59952
+ display: flex;
59953
+ margin-bottom: 8px;
59954
+ flex-shrink: 0;
59955
+ width: 100%;
59956
+ `, [cM("own", `
59957
+ justify-content: flex-end;
59958
+ `), cM("other", `
59959
+ justify-content: flex-start;
59960
+ `)]), cE("message-wrapper", `
59961
+ max-width: 70%;
59962
+ display: flex;
59963
+ flex-direction: column;
59964
+ gap: 4px;
59965
+ flex-shrink: 0;
59966
+ `), cE("message-bubble", `
59967
+ border-radius: 18px;
59968
+ font-size: 14px;
59969
+ line-height: 20px;
59970
+ word-wrap: break-word;
59971
+ background-color: var(--u-message-bubble-background-color-other);
59972
+ color: var(--u-message-bubble-text-color-other);
59973
+ border-bottom-left-radius: 6px;
59974
+ width: fit-content;
59975
+ display: flex;
59976
+ flex-direction: column;
59977
+ `, [cM("own", `
59978
+ background-color: var(--u-message-bubble-background-color-own);
59979
+ color: var(--u-message-bubble-text-color-own);
59980
+ border-bottom-left-radius: 18px;
59981
+ border-bottom-right-radius: 6px;
59982
+ `), cM("typing", `
59983
+ min-width: 300px;
59984
+ height: 44px;
59985
+ padding: 12px 16px;
59986
+ `), cM("skeleton", `
59987
+ min-width: 376px;
59988
+ height: 44px;
59989
+ `)]), cE("message-text", `
59990
+ padding: 12px 16px;
59991
+ `), cE("message-attachment", `
59992
+ display: flex;
59993
+ align-items: center;
59994
+ gap: 12px;
59995
+ padding: 12px 16px;
59996
+ background-color: #f8f9fa;
59997
+ border-radius: 12px;
59998
+ border: 1px solid #e9ecef;
59999
+ margin-top: 4px;
60000
+ `), cE("attachment-icon", `
60001
+ color: #6c757d;
60002
+ flex-shrink: 0;
60003
+ `), cE("attachment-info", `
60004
+ flex: 1;
60005
+ min-width: 0;
60006
+ `), cE("attachment-name", `
60007
+ font-size: 14px;
60008
+ font-weight: 500;
60009
+ color: var(--u-text-color-base);
60010
+ margin-bottom: 2px;
60011
+ `), cE("attachment-size", `
60012
+ font-size: 12px;
60013
+ color: var(--u-text-color-disabled);
60014
+ `), cE("message-meta", `
60015
+ display: flex;
60016
+ align-items: center;
60017
+ gap: 4px;
60018
+ font-size: 11px;
60019
+ color: var(--u-text-color-disabled);
60020
+ margin-top: 2px;
60021
+ `, [cM("own", `
60022
+ justify-content: flex-end;
60023
+ `), cM("other", `
60024
+ justify-content: flex-start;
60025
+ `), cM("skeleton", `
60026
+ width: 36px;
60027
+ height: 20px;
60028
+ border-radius: 4px;
60029
+ `)]), cE("message-time", `
60030
+ font-size: 11px;
60031
+ color: var(--u-message-time-color);
60032
+ `), cE("message-status", `
60033
+ color: var(--u-color-success);
60034
+ display: flex;
60035
+ align-items: center;
60036
+ `), cE("message-status-icon", `
60037
+ color: var(--u-message-time-color);
60038
+ `, [cM("read", `
60039
+ color: var(--u-unread-notification-background-color);
60040
+ `), cM("retry", `
60041
+ color: var(--u-color-error);
60042
+ `)]), cE("message-retry", `
60043
+ display: flex;
60044
+ align-items: center;
60045
+ gap: 4px;
60046
+ `), cE("message-retry-icon", `
60047
+ color: var(--u-color-error);
60048
+ `), cE("message-retry-text", `
60049
+ color: var(--u-color-error);
60050
+ font-size: 11px;
60051
+ font-weight: 500;
60052
+ `), cE("typing-indicator", `
60053
+ display: flex;
60054
+ justify-content: flex-start;
60055
+ margin-bottom: 8px;
60056
+ `), cE("footer", `
60057
+ border-top: 1px solid var(--u-border-color);
60058
+ padding: 0px 20px;
60059
+ flex-shrink: 0;
60060
+ `), cE("input-container", `
60061
+ width: 100%;
60062
+ padding: 16px 0px;
60063
+ `), cE("input", `
60064
+ flex: 1;
60065
+ margin-right: 4px;
60066
+ --u-color: #F3F4F6 !important;
60067
+ --u-color-focus: #F3F4F6 !important;
60068
+ --u-border: none !important;
60069
+ --u-border-focus: none !important;
60070
+ --u-border-hover: none !important;
60071
+ --u-box-shadow: none !important;
60072
+ --u-box-shadow-focus: none !important;
60073
+ `), cE("attach-btn", `
60074
+ margin-left: 4px;
60075
+ flex-shrink: 0;
60076
+ padding: 0 12px;
60077
+ `)]), c$1("*", `
60078
+ box-sizing: border-box;
60079
+ `), c$1(".u-list-item .u-list-item__text", `
60080
+ grid-template-columns: 1fr !important;
60081
+ `), c$1(".u-upload-file-list .u-upload-file.u-upload-file--text-type", `
60082
+ margin-bottom: 0px;
60083
+ `), c$1(".u-chat-main__message-bubble--own .u-upload-file", `
60084
+ background-color: var(--u-attachment-background-color-own);
60085
+ `), c$1(".u-chat-main__message-bubble--other .u-upload-file", `
60086
+ background-color: var(--u-attachment-background-color-other);
60087
+ `)]);
60088
+
60089
+ const self$6 = vars => {
60090
+ const {
60091
+ borderRadiusLarge,
60092
+ elementsQuaternary,
60093
+ elementsTertiary,
60094
+ textTertiary,
60095
+ textPrimary,
60096
+ textSecondary,
60097
+ surfacePrimary,
60098
+ brandPrimary500,
60099
+ brandPrimary400,
60100
+ transparencySecondary,
60101
+ elementsSecondary,
60102
+ elementsDarkQuinary,
60103
+ staticRed,
60104
+ staticWhite
60105
+ } = vars;
60106
+ return {
60107
+ backgroundColor: surfacePrimary,
60108
+ borderColor: elementsQuaternary,
60109
+ sidebarBackgroundColor: surfacePrimary,
60110
+ sidebarBorderColor: elementsQuaternary,
60111
+ sidebarItemBackgroundColor: "transparent",
60112
+ sidebarItemBackgroundColorHover: elementsTertiary,
60113
+ sidebarItemBackgroundColorSelected: transparencySecondary,
60114
+ sidebarItemTextColor: textPrimary,
60115
+ sidebarItemTextColorSelected: brandPrimary500,
60116
+ sidebarItemSubtitleColor: textSecondary,
60117
+ sidebarItemTimeColor: elementsDarkQuinary,
60118
+ mainBackgroundColor: surfacePrimary,
60119
+ headerBackgroundColor: surfacePrimary,
60120
+ headerBorderColor: elementsQuaternary,
60121
+ headerTitleColor: textPrimary,
60122
+ messageBubbleBackgroundColorOwn: elementsTertiary,
60123
+ messageBubbleBackgroundColorOther: elementsTertiary,
60124
+ messageBubbleTextColorOwn: textPrimary,
60125
+ messageBubbleTextColorOther: textPrimary,
60126
+ messageTimeColor: textTertiary,
60127
+ messageStatusColor: textSecondary,
60128
+ attachmentBackgroundColorOwn: staticWhite,
60129
+ attachmentBackgroundColorOther: staticWhite,
60130
+ footerBackgroundColor: surfacePrimary,
60131
+ footerBorderColor: elementsQuaternary,
60132
+ inputBackgroundColor: surfacePrimary,
60133
+ inputBorderColor: elementsQuaternary,
60134
+ unreadNotificationBackgroundColor: brandPrimary400,
60135
+ unreadNotificationTextColor: elementsSecondary,
60136
+ typingIndicatorColor: textSecondary,
60137
+ dateSeparatorColor: textTertiary,
60138
+ dateSeparatorBackgroundColor: elementsTertiary,
60139
+ borderRadius: borderRadiusLarge,
60140
+ errorColor: staticRed
60141
+ };
60142
+ };
60143
+ const chatLight = createTheme$1({
60144
+ name: "Chat",
60145
+ common: derived,
60146
+ peers: {
60147
+ Input: inputLight,
60148
+ Empty: emptyLight,
60149
+ Select: selectLight,
60150
+ Avatar: avatarLight,
60151
+ Badge: badgeLight,
60152
+ Button: buttonLight,
60153
+ Icon: iconLight,
60154
+ List: listLight,
60155
+ Typography: typographyLight$1
60156
+ },
60157
+ self: self$6
60158
+ });
60159
+
60160
+ const chatDark = createTheme$1({
60161
+ name: "Chat",
60162
+ common: derived$1,
60163
+ peers: {
60164
+ Input: inputDark,
60165
+ Empty: emptyDark$1,
60166
+ Select: selectDark,
60167
+ Avatar: avatarDark,
60168
+ Badge: badgeDark,
60169
+ Button: buttonDark,
60170
+ Icon: iconDark$1,
60171
+ List: listDark$1,
60172
+ Typography: typographyDark
60173
+ },
60174
+ self: vars => {
60175
+ const lightVars = self$6(vars);
60176
+ return {
60177
+ ...lightVars
60178
+ };
60179
+ }
60180
+ });
60181
+
59748
60182
  const statusIconMapper$1 = {
59749
60183
  [MessageStatus.READ]: CheckmarkDoneSharp,
59750
60184
  [MessageStatus.PENDING]: MdTime,
59751
60185
  [MessageStatus.RETRY]: Refresh,
59752
60186
  [MessageStatus.UNREAD]: CheckmarkDoneSharp
59753
60187
  };
59754
- var ChatSidebar = vue.defineComponent({
59755
- name: "ChatSidebar",
59756
- setup(props, { slots }) {
59757
- return { slots };
60188
+ const chatListItemsProps = {
60189
+ ...useTheme.props,
60190
+ chatItems: {
60191
+ type: Array,
60192
+ default: () => []
59758
60193
  },
59759
- render() {
59760
- const { slots } = this;
59761
- const {
59762
- mergedClsPrefixRef,
59763
- chatItemsRef,
59764
- chatItemsLoadingRef,
59765
- chatItemsLoadingCountRef,
59766
- listEmptyPropsRef,
59767
- selectedChatIdRef,
59768
- typingChatIdsRef,
59769
- typingTextRef,
59770
- listItemAvatarPropsRef,
59771
- listItemBadgePropsRef,
59772
- handleChatSelect
59773
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
59774
- } = vue.inject(chatInjectionKey);
59775
- const renderListHeader = () => {
59776
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__header` }, /* @__PURE__ */ vue.h(
59777
- UFlex,
59778
- {
59779
- align: "center",
59780
- justify: "space-between",
59781
- style: { width: "100%" }
59782
- },
59783
- /* @__PURE__ */ vue.h(
59784
- "div",
59785
- {
59786
- class: `${mergedClsPrefixRef.value}-chat-sidebar__header-main`
59787
- },
59788
- slots.sidebarHeaderMain?.() || /* @__PURE__ */ vue.h(USelect, { round: true })
59789
- ),
59790
- /* @__PURE__ */ vue.h(
59791
- "div",
59792
- {
59793
- class: `${mergedClsPrefixRef.value}-chat-sidebar__header-actions`
59794
- },
59795
- slots.sidebarHeaderActions?.()
59796
- )
59797
- ));
59798
- };
59799
- const renderChatItem = (item) => {
59800
- const isSelected = selectedChatIdRef.value === item.id;
59801
- const isTyping = typingChatIdsRef.value?.includes(item.id) ?? false;
59802
- return /* @__PURE__ */ vue.h(
59803
- UListItem,
59804
- {
59805
- key: item.id,
59806
- showIcon: false,
59807
- onClick: () => {
59808
- handleChatSelect(item.id);
59809
- },
59810
- class: [
59811
- `${mergedClsPrefixRef.value}-chat-sidebar__item`,
59812
- isSelected && `${mergedClsPrefixRef.value}-chat-sidebar__item--selected`,
59813
- isTyping && `${mergedClsPrefixRef.value}-chat-sidebar__item--typing`
59814
- ]
59815
- },
59816
- {
60194
+ selectedChatId: {
60195
+ type: [String, Number, Symbol],
60196
+ default: void 0
60197
+ },
60198
+ typingChatIds: {
60199
+ type: Array,
60200
+ default: () => []
60201
+ },
60202
+ typingText: {
60203
+ type: String,
60204
+ default: void 0
60205
+ },
60206
+ loading: {
60207
+ type: Boolean,
60208
+ default: false
60209
+ },
60210
+ loadingCount: {
60211
+ type: Number,
60212
+ default: 10
60213
+ },
60214
+ emptyProps: {
60215
+ type: Object,
60216
+ default: void 0
60217
+ },
60218
+ avatarProps: {
60219
+ type: Object,
60220
+ default: void 0
60221
+ },
60222
+ badgeProps: {
60223
+ type: Object,
60224
+ default: void 0
60225
+ },
60226
+ onChatSelect: {
60227
+ type: Function,
60228
+ default: void 0
60229
+ },
60230
+ notificationsShown: {
60231
+ type: Object,
60232
+ default: () => /* @__PURE__ */ new Set()
60233
+ }
60234
+ };
60235
+ var UChatListItems = vue.defineComponent({
60236
+ name: "ChatListItems",
60237
+ props: chatListItemsProps,
60238
+ emits: ["chat-select"],
60239
+ setup(props, { slots, emit }) {
60240
+ const { mergedClsPrefixRef } = useConfig(props);
60241
+ const themeRef = useTheme(
60242
+ "Chat",
60243
+ "-chat",
60244
+ style$12,
60245
+ chatLight,
60246
+ props,
60247
+ mergedClsPrefixRef
60248
+ );
60249
+ const { localeRef } = useLocale("Chat");
60250
+ const cssVarsRef = vue.computed(() => {
60251
+ const {
60252
+ common: {
60253
+ cubicBezierEaseInOut,
60254
+ brandPrimary500,
60255
+ staticGreen,
60256
+ staticRed,
60257
+ textPrimary,
60258
+ textSecondary,
60259
+ textTertiary
60260
+ },
60261
+ self: {
60262
+ backgroundColor,
60263
+ borderColor,
60264
+ sidebarBackgroundColor,
60265
+ sidebarBorderColor,
60266
+ sidebarItemBackgroundColor,
60267
+ sidebarItemBackgroundColorHover,
60268
+ sidebarItemBackgroundColorSelected,
60269
+ sidebarItemTextColor,
60270
+ sidebarItemTextColorSelected,
60271
+ sidebarItemSubtitleColor,
60272
+ sidebarItemTimeColor,
60273
+ unreadNotificationBackgroundColor,
60274
+ borderRadius
60275
+ }
60276
+ } = themeRef.value;
60277
+ return {
60278
+ "--u-bezier": cubicBezierEaseInOut,
60279
+ "--u-color-primary": brandPrimary500,
60280
+ "--u-color-success": staticGreen,
60281
+ "--u-color-error": staticRed,
60282
+ "--u-text-color-base": textPrimary,
60283
+ "--u-text-color-secondary": textSecondary,
60284
+ "--u-text-color-disabled": textTertiary,
60285
+ "--u-background-color": backgroundColor,
60286
+ "--u-border-color": borderColor,
60287
+ "--u-sidebar-background-color": sidebarBackgroundColor,
60288
+ "--u-sidebar-border-color": sidebarBorderColor,
60289
+ "--u-sidebar-item-background-color": sidebarItemBackgroundColor,
60290
+ "--u-sidebar-item-background-color-hover": sidebarItemBackgroundColorHover,
60291
+ "--u-sidebar-item-background-color-selected": sidebarItemBackgroundColorSelected,
60292
+ "--u-sidebar-item-text-color": sidebarItemTextColor,
60293
+ "--u-sidebar-item-text-color-selected": sidebarItemTextColorSelected,
60294
+ "--u-sidebar-item-subtitle-color": sidebarItemSubtitleColor,
60295
+ "--u-sidebar-item-time-color": sidebarItemTimeColor,
60296
+ "--u-unread-notification-background-color": unreadNotificationBackgroundColor,
60297
+ "--u-border-radius": borderRadius
60298
+ };
60299
+ });
60300
+ const themeClassHandle = useThemeClass(
60301
+ "chat-list-items",
60302
+ vue.computed(() => ""),
60303
+ cssVarsRef,
60304
+ props
60305
+ );
60306
+ const mergedTypingTextRef = vue.computed(
60307
+ () => props.typingText ?? localeRef.value.typingText
60308
+ );
60309
+ const handleChatSelect = (chatId) => {
60310
+ emit("chat-select", chatId);
60311
+ props.onChatSelect?.(chatId);
60312
+ };
60313
+ const renderChatItem = (item) => {
60314
+ const isSelected = props.selectedChatId === item.id;
60315
+ const isTyping = props.typingChatIds?.includes(item.id) ?? false;
60316
+ return /* @__PURE__ */ vue.h(
60317
+ UListItem,
60318
+ {
60319
+ key: item.id,
60320
+ showIcon: false,
60321
+ onClick: () => {
60322
+ handleChatSelect(item.id);
60323
+ },
60324
+ class: [
60325
+ `${mergedClsPrefixRef.value}-chat-sidebar__item`,
60326
+ isSelected && `${mergedClsPrefixRef.value}-chat-sidebar__item--selected`,
60327
+ isTyping && `${mergedClsPrefixRef.value}-chat-sidebar__item--typing`
60328
+ ]
60329
+ },
60330
+ {
59817
60331
  prefix: () => /* @__PURE__ */ vue.h(
59818
60332
  UAvatar,
59819
60333
  {
59820
60334
  size: "medium",
59821
60335
  src: typeof item.avatar === "string" ? item.avatar : void 0,
59822
- ...listItemAvatarPropsRef.value
60336
+ ...props.avatarProps
59823
60337
  },
59824
- typeof item.avatar === "function" ? item.avatar() : typeof item.title === "string" ? item.title.charAt(0)?.toUpperCase() : "?"
60338
+ {
60339
+ default: () => typeof item.avatar === "function" ? item.avatar() : typeof item.title === "string" ? item.title.charAt(0)?.toUpperCase() : "?"
60340
+ }
59825
60341
  ),
59826
60342
  header: () => /* @__PURE__ */ vue.h(
59827
60343
  "span",
@@ -59846,13 +60362,10 @@
59846
60362
  maxWidth: "100%"
59847
60363
  }
59848
60364
  },
59849
- isTyping ? typingTextRef.value : typeof item.subtitle === "string" ? item.subtitle : typeof item.subtitle === "function" ? item.subtitle() : item.subtitle
60365
+ isTyping ? mergedTypingTextRef.value : typeof item.subtitle === "string" ? item.subtitle : typeof item.subtitle === "function" ? item.subtitle() : item.subtitle
59850
60366
  ),
59851
60367
  suffix: () => {
59852
- const getChatGlobalState = () => ChatGlobalState.getInstance();
59853
- const globalState = getChatGlobalState();
59854
- const wasOpened = globalState.isChatOpened(item.id);
59855
- const displayUnreadCount = wasOpened ? 0 : item.unreadCount || 0;
60368
+ const displayUnreadCount = item.unreadCount || 0;
59856
60369
  const hasUnreadIncoming = displayUnreadCount > 0;
59857
60370
  const lastMessageIsOwn = item.lastMessageIsOwn;
59858
60371
  return /* @__PURE__ */ vue.h(
@@ -59887,7 +60400,7 @@
59887
60400
  UBadge,
59888
60401
  {
59889
60402
  value: displayUnreadCount,
59890
- ...listItemBadgePropsRef.value
60403
+ ...props.badgeProps
59891
60404
  }
59892
60405
  )
59893
60406
  )
@@ -59896,17 +60409,170 @@
59896
60409
  }
59897
60410
  );
59898
60411
  };
59899
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar` }, renderListHeader(), /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__content` }, chatItemsLoadingRef.value ? /* @__PURE__ */ vue.h(UList, { loading: true }, Array.from({ length: chatItemsLoadingCountRef.value || 10 }).map(
59900
- (_, index) => /* @__PURE__ */ vue.h(
59901
- UListItem,
60412
+ return {
60413
+ mergedClsPrefixRef,
60414
+ renderChatItem,
60415
+ cssVars: cssVarsRef,
60416
+ themeClass: themeClassHandle?.themeClass,
60417
+ onRender: themeClassHandle?.onRender
60418
+ };
60419
+ },
60420
+ render() {
60421
+ this.onRender?.();
60422
+ const { mergedClsPrefixRef, renderChatItem } = this;
60423
+ const content = (() => {
60424
+ if (this.loading) {
60425
+ return /* @__PURE__ */ vue.h(UList, { loading: true }, {
60426
+ default: () => Array.from({ length: this.loadingCount || 10 }).map(
60427
+ (_, index) => /* @__PURE__ */ vue.h(
60428
+ UListItem,
60429
+ {
60430
+ key: index,
60431
+ avatar: { icon: PersonOutline },
60432
+ description: { text: "Loading..." },
60433
+ header: { text: "Loading..." }
60434
+ }
60435
+ )
60436
+ )
60437
+ });
60438
+ }
60439
+ if (this.chatItems?.length) {
60440
+ return /* @__PURE__ */ vue.h(UList, { showIcon: false }, {
60441
+ default: () => this.chatItems?.map((item) => renderChatItem(item))
60442
+ });
60443
+ }
60444
+ return /* @__PURE__ */ vue.h(UEmpty, { ...this.emptyProps });
60445
+ })();
60446
+ return /* @__PURE__ */ vue.h(
60447
+ "div",
60448
+ {
60449
+ class: [`${mergedClsPrefixRef}-chat`, this.themeClass],
60450
+ style: this.cssVars
60451
+ },
60452
+ /* @__PURE__ */ vue.h(
60453
+ "div",
59902
60454
  {
59903
- key: index,
59904
- avatar: { icon: PersonOutline },
59905
- description: { text: "Loading..." },
59906
- header: { text: "Loading..." }
59907
- }
60455
+ class: `${mergedClsPrefixRef}-chat-sidebar`,
60456
+ style: {
60457
+ border: "none",
60458
+ borderRadius: "0",
60459
+ padding: "0",
60460
+ maxWidth: "100%",
60461
+ background: "transparent"
60462
+ }
60463
+ },
60464
+ /* @__PURE__ */ vue.h(
60465
+ "div",
60466
+ {
60467
+ class: `${mergedClsPrefixRef}-chat-sidebar__content`,
60468
+ style: {
60469
+ padding: "0"
60470
+ }
60471
+ },
60472
+ content
60473
+ )
59908
60474
  )
59909
- )) : chatItemsRef.value?.length ? /* @__PURE__ */ vue.h(UList, { showIcon: false }, chatItemsRef.value?.map((item) => renderChatItem(item))) : /* @__PURE__ */ vue.h(UEmpty, { ...listEmptyPropsRef.value })));
60475
+ );
60476
+ }
60477
+ });
60478
+
60479
+ var ChatSidebar = vue.defineComponent({
60480
+ name: "ChatSidebar",
60481
+ setup(props, { slots }) {
60482
+ return { slots };
60483
+ },
60484
+ render() {
60485
+ const { slots } = this;
60486
+ const {
60487
+ mergedClsPrefixRef,
60488
+ chatItemsRef,
60489
+ chatItemsLoadingRef,
60490
+ chatItemsLoadingCountRef,
60491
+ listEmptyPropsRef,
60492
+ selectedChatIdRef,
60493
+ typingChatIdsRef,
60494
+ typingTextRef,
60495
+ listItemAvatarPropsRef,
60496
+ listItemBadgePropsRef,
60497
+ notificationsShownSetRef,
60498
+ handleChatSelect
60499
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
60500
+ } = vue.inject(chatInjectionKey);
60501
+ const renderListHeader = () => {
60502
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__header` }, /* @__PURE__ */ vue.h(
60503
+ UFlex,
60504
+ {
60505
+ align: "center",
60506
+ justify: "space-between",
60507
+ class: `${mergedClsPrefixRef.value}-chat-sidebar__header-container`,
60508
+ style: { width: "100%" }
60509
+ },
60510
+ {
60511
+ default: () => /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h(
60512
+ "div",
60513
+ {
60514
+ class: `${mergedClsPrefixRef.value}-chat-sidebar__header-main`
60515
+ },
60516
+ slots.sidebarHeaderMain?.() || /* @__PURE__ */ vue.h(USelect, { round: true, size: "small" })
60517
+ ), /* @__PURE__ */ vue.h(
60518
+ "div",
60519
+ {
60520
+ class: `${mergedClsPrefixRef.value}-chat-sidebar__header-actions`
60521
+ },
60522
+ slots.sidebarHeaderActions?.()
60523
+ ))
60524
+ }
60525
+ ));
60526
+ };
60527
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar` }, renderListHeader(), /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__content` }, /* @__PURE__ */ vue.h(
60528
+ UChatListItems,
60529
+ {
60530
+ chatItems: chatItemsRef.value,
60531
+ selectedChatId: selectedChatIdRef.value,
60532
+ typingChatIds: typingChatIdsRef.value,
60533
+ typingText: typingTextRef.value,
60534
+ loading: chatItemsLoadingRef.value,
60535
+ loadingCount: chatItemsLoadingCountRef.value,
60536
+ emptyProps: listEmptyPropsRef.value,
60537
+ avatarProps: listItemAvatarPropsRef.value,
60538
+ badgeProps: listItemBadgePropsRef.value,
60539
+ notificationsShown: notificationsShownSetRef.value,
60540
+ onChatSelect: handleChatSelect
60541
+ },
60542
+ {
60543
+ chatItemStatus: slots.chatItemStatus
60544
+ }
60545
+ )));
60546
+ }
60547
+ });
60548
+
60549
+ const scrollbarProps = {
60550
+ ...useTheme.props,
60551
+ trigger: String,
60552
+ xScrollable: Boolean,
60553
+ onScroll: Function,
60554
+ size: Number
60555
+ };
60556
+ const Scrollbar = vue.defineComponent({
60557
+ name: "Scrollbar",
60558
+ props: scrollbarProps,
60559
+ setup() {
60560
+ const scrollbarInstRef = vue.ref(null);
60561
+ const exposedMethods = {
60562
+ scrollTo: (...args) => {
60563
+ scrollbarInstRef.value?.scrollTo(args[0], args[1]);
60564
+ },
60565
+ scrollBy: (...args) => {
60566
+ scrollbarInstRef.value?.scrollBy(args[0], args[1]);
60567
+ }
60568
+ };
60569
+ return {
60570
+ ...exposedMethods,
60571
+ scrollbarInstRef
60572
+ };
60573
+ },
60574
+ render() {
60575
+ return /* @__PURE__ */ vue.h(Scrollbar$1, { ref: "scrollbarInstRef", ...this.$props }, this.$slots);
59910
60576
  }
59911
60577
  });
59912
60578
 
@@ -60216,7 +60882,7 @@
60216
60882
  }
60217
60883
  });
60218
60884
 
60219
- var style$12 = c$1([c$1("@keyframes spin-rotate", `
60885
+ var style$11 = c$1([c$1("@keyframes spin-rotate", `
60220
60886
  from {
60221
60887
  transform: rotate(0);
60222
60888
  }
@@ -60315,7 +60981,7 @@
60315
60981
  const themeRef = useTheme(
60316
60982
  "Spin",
60317
60983
  "-spin",
60318
- style$12,
60984
+ style$11,
60319
60985
  spinLight,
60320
60986
  props,
60321
60987
  mergedClsPrefixRef
@@ -60811,7 +61477,7 @@
60811
61477
  };
60812
61478
  const imageContextKey = createInjectionKey("u-image");
60813
61479
 
60814
- const self$6 = vars => {
61480
+ const self$5 = vars => {
60815
61481
  const {
60816
61482
  elementsSecondary,
60817
61483
  elementsSenary,
@@ -60831,7 +61497,7 @@
60831
61497
  peers: {
60832
61498
  Tooltip: tooltipLight
60833
61499
  },
60834
- self: self$6
61500
+ self: self$5
60835
61501
  });
60836
61502
 
60837
61503
  const imageDark = {
@@ -60840,7 +61506,7 @@
60840
61506
  peers: {
60841
61507
  Tooltip: tooltipDark
60842
61508
  },
60843
- self: self$6
61509
+ self: self$5
60844
61510
  };
60845
61511
 
60846
61512
  const prevIcon = /* @__PURE__ */ vue.h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ vue.h(
@@ -60881,7 +61547,7 @@
60881
61547
  )
60882
61548
  );
60883
61549
 
60884
- var style$11 = c$1([c$1("body >", [cB("image-container", "position: fixed;")]), cB("image-preview-container", `
61550
+ var style$10 = c$1([c$1("body >", [cB("image-container", "position: fixed;")]), cB("image-preview-container", `
60885
61551
  position: fixed;
60886
61552
  left: 0;
60887
61553
  right: 0;
@@ -60957,7 +61623,7 @@
60957
61623
  const themeRef = useTheme(
60958
61624
  "Image",
60959
61625
  "-image",
60960
- style$11,
61626
+ style$10,
60961
61627
  imageLight,
60962
61628
  props,
60963
61629
  vue.toRef(props, "clsPrefix")
@@ -61815,7 +62481,7 @@
61815
62481
  }
61816
62482
  });
61817
62483
 
61818
- var style$10 = c$1([cB("upload", "width: var(--u-upload-width)", [cM("dragger-inside", [cB("upload-trigger", `
62484
+ var style$$ = c$1([cB("upload", "width: var(--u-upload-width)", [cM("dragger-inside", [cB("upload-trigger", `
61819
62485
  display: block;
61820
62486
  `)]), cM("drag-over", [cB("upload-dragger", `
61821
62487
  border: var(--u-dragger-border-hover);
@@ -62585,7 +63251,7 @@
62585
63251
  const themeRef = useTheme(
62586
63252
  "Upload",
62587
63253
  "-upload",
62588
- style$10,
63254
+ style$$,
62589
63255
  uploadLight,
62590
63256
  props,
62591
63257
  mergedClsPrefixRef
@@ -62987,122 +63653,7 @@
62987
63653
  }
62988
63654
  });
62989
63655
 
62990
- var ChatAttachmentComponent = vue.defineComponent({
62991
- name: "ChatAttachment",
62992
- props: {
62993
- message: {
62994
- type: Object,
62995
- required: true
62996
- },
62997
- attachments: {
62998
- type: Array,
62999
- required: true
63000
- },
63001
- uploadProps: {
63002
- type: Object,
63003
- default: () => ({})
63004
- },
63005
- withPadding: {
63006
- type: Boolean,
63007
- default: false
63008
- }
63009
- },
63010
- setup(props, { slots }) {
63011
- const getThumbnailUrl = (att) => {
63012
- const url = [att.preview, att.thumbnail].find(
63013
- (value) => typeof value === "string"
63014
- );
63015
- return url ?? null;
63016
- };
63017
- const renderAttachment = () => {
63018
- const fileList = props.attachments.map(
63019
- (att, index) => ({
63020
- id: `${String(props.message.id)}-attachment-${index}`,
63021
- name: att.name,
63022
- status: att.status || "finished",
63023
- percentage: att.percentage ?? null,
63024
- url: att.url ?? null,
63025
- thumbnailUrl: getThumbnailUrl(att),
63026
- type: att.type ?? null,
63027
- file: null,
63028
- batchId: null
63029
- })
63030
- );
63031
- const uploadComponent = /* @__PURE__ */ vue.h(
63032
- UUpload,
63033
- {
63034
- abstract: true,
63035
- fileList,
63036
- fileListStyle: props.withPadding ? {
63037
- display: "flex",
63038
- flexDirection: "column",
63039
- gap: "2px",
63040
- marginTop: "0"
63041
- } : void 0,
63042
- showRemoveButton: false,
63043
- showDownloadButton: props.attachments.some(
63044
- (att) => att.status === "finished"
63045
- ),
63046
- showRetryButton: props.attachments.some(
63047
- (att) => att.status === "error"
63048
- ),
63049
- ...props.uploadProps
63050
- },
63051
- /* @__PURE__ */ vue.h(UUploadFileList, null, {
63052
- "upload-file-title": slots["upload-file-title"] ? ({ file }) => slots["upload-file-title"]?.(file) : void 0,
63053
- "upload-file-subtitle": slots["upload-file-subtitle"] ? ({ file }) => slots["upload-file-subtitle"]?.(file) : ({ file }) => {
63054
- const att = props.attachments.find(
63055
- (a) => a.name === file.name
63056
- );
63057
- return /* @__PURE__ */ vue.h("span", { style: { fontSize: "12px", color: "#999" } }, att?.size || file.file?.size);
63058
- }
63059
- })
63060
- );
63061
- if (props.withPadding) {
63062
- return /* @__PURE__ */ vue.h("div", { style: { padding: "2px" } }, uploadComponent);
63063
- }
63064
- return uploadComponent;
63065
- };
63066
- return () => {
63067
- if (slots.default) {
63068
- return slots.default(props.message);
63069
- }
63070
- return renderAttachment();
63071
- };
63072
- }
63073
- });
63074
-
63075
- const scrollbarProps = {
63076
- ...useTheme.props,
63077
- trigger: String,
63078
- xScrollable: Boolean,
63079
- onScroll: Function,
63080
- size: Number
63081
- };
63082
- const Scrollbar = vue.defineComponent({
63083
- name: "Scrollbar",
63084
- props: scrollbarProps,
63085
- setup() {
63086
- const scrollbarInstRef = vue.ref(null);
63087
- const exposedMethods = {
63088
- scrollTo: (...args) => {
63089
- scrollbarInstRef.value?.scrollTo(args[0], args[1]);
63090
- },
63091
- scrollBy: (...args) => {
63092
- scrollbarInstRef.value?.scrollBy(args[0], args[1]);
63093
- }
63094
- };
63095
- return {
63096
- ...exposedMethods,
63097
- scrollbarInstRef
63098
- };
63099
- },
63100
- render() {
63101
- return /* @__PURE__ */ vue.h(Scrollbar$1, { ref: "scrollbarInstRef", ...this.$props }, this.$slots);
63102
- }
63103
- });
63104
-
63105
- var style$$ = cB("h", `
63656
+ var style$_ = cB("h", `
63106
63657
  font-size: var(--u-font-size);
63107
63658
  font-weight: var(--u-font-weight);
63108
63659
  margin: var(--u-margin);
@@ -63150,7 +63701,7 @@
63150
63701
  mergedClsPrefixRef,
63151
63702
  inlineThemeDisabled
63152
63703
  } = useConfig(props);
63153
- const themeRef = useTheme("Typography", "-h", style$$, typographyLight$1, props, mergedClsPrefixRef);
63704
+ const themeRef = useTheme("Typography", "-h", style$_, typographyLight$1, props, mergedClsPrefixRef);
63154
63705
  const cssVarsRef = vue.computed(() => {
63155
63706
  const {
63156
63707
  type
@@ -63214,7 +63765,7 @@
63214
63765
  const UH5 = createHeader("5");
63215
63766
  const UH6 = createHeader("6");
63216
63767
 
63217
- var style$_ = cB("a", `
63768
+ var style$Z = cB("a", `
63218
63769
  cursor: pointer;
63219
63770
  transition:
63220
63771
  color .3s var(--u-bezier),
@@ -63237,7 +63788,7 @@
63237
63788
  const themeRef = useTheme(
63238
63789
  "Typography",
63239
63790
  "-a",
63240
- style$_,
63791
+ style$Z,
63241
63792
  typographyLight$1,
63242
63793
  props,
63243
63794
  mergedClsPrefixRef
@@ -63273,7 +63824,7 @@
63273
63824
  }
63274
63825
  });
63275
63826
 
63276
- var style$Z = cB("p", `
63827
+ var style$Y = cB("p", `
63277
63828
  box-sizing: border-box;
63278
63829
  transition: color .3s var(--u-bezier);
63279
63830
  margin: var(--u-margin);
@@ -63297,7 +63848,7 @@
63297
63848
  const themeRef = useTheme(
63298
63849
  "Typography",
63299
63850
  "-p",
63300
- style$Z,
63851
+ style$Y,
63301
63852
  typographyLight$1,
63302
63853
  props,
63303
63854
  mergedClsPrefixRef
@@ -63349,7 +63900,7 @@
63349
63900
  }
63350
63901
  });
63351
63902
 
63352
- var style$Y = cB("blockquote", `
63903
+ var style$X = cB("blockquote", `
63353
63904
  font-size: var(--u-font-size);
63354
63905
  line-height: var(--u-line-height);
63355
63906
  margin: 0;
@@ -63388,7 +63939,7 @@
63388
63939
  const themeRef = useTheme(
63389
63940
  "Typography",
63390
63941
  "-blockquote",
63391
- style$Y,
63942
+ style$X,
63392
63943
  typographyLight$1,
63393
63944
  props,
63394
63945
  mergedClsPrefixRef
@@ -63437,7 +63988,7 @@
63437
63988
  }
63438
63989
  });
63439
63990
 
63440
- var style$X = cB("hr", `
63991
+ var style$W = cB("hr", `
63441
63992
  margin: 12px 0;
63442
63993
  transition: border-color .3s var(--u-bezier);
63443
63994
  border-left: none;
@@ -63462,7 +64013,7 @@
63462
64013
  const themeRef = useTheme(
63463
64014
  "Typography",
63464
64015
  "-hr",
63465
- style$X,
64016
+ style$W,
63466
64017
  typographyLight$1,
63467
64018
  props,
63468
64019
  mergedClsPrefixRef
@@ -63509,7 +64060,7 @@
63509
64060
  `), c$1("&:last-child", `
63510
64061
  margin-bottom: 0;
63511
64062
  `)];
63512
- var style$W = c$1([cB("ol", {
64063
+ var style$V = c$1([cB("ol", {
63513
64064
  fontSize: "var(--u-font-size)",
63514
64065
  padding: "var(--u-ol-padding)"
63515
64066
  }, [cM("align-text", {
@@ -63539,7 +64090,7 @@
63539
64090
  const themeRef = useTheme(
63540
64091
  "Typography",
63541
64092
  "-xl",
63542
- style$W,
64093
+ style$V,
63543
64094
  typographyLight$1,
63544
64095
  props,
63545
64096
  mergedClsPrefixRef
@@ -63610,7 +64161,7 @@
63610
64161
  const themeRef = useTheme(
63611
64162
  "Typography",
63612
64163
  "-xl",
63613
- style$W,
64164
+ style$V,
63614
64165
  typographyLight$1,
63615
64166
  props,
63616
64167
  mergedClsPrefixRef
@@ -63752,194 +64303,268 @@
63752
64303
  }
63753
64304
  });
63754
64305
 
63755
- const SCROLL_DELAY = 50;
63756
- const SENDING_DELAY = 100;
63757
- const getChatGlobalState = () => ChatGlobalState.getInstance();
64306
+ var ChatAttachmentComponent = vue.defineComponent({
64307
+ name: "ChatAttachment",
64308
+ props: {
64309
+ message: {
64310
+ type: Object,
64311
+ required: true
64312
+ },
64313
+ attachments: {
64314
+ type: Array,
64315
+ required: true
64316
+ },
64317
+ uploadProps: {
64318
+ type: Object,
64319
+ default: () => ({})
64320
+ },
64321
+ withPadding: {
64322
+ type: Boolean,
64323
+ default: false
64324
+ }
64325
+ },
64326
+ setup(props, { slots }) {
64327
+ const getThumbnailUrl = (att) => {
64328
+ const url = [att.preview, att.thumbnail].find(
64329
+ (value) => typeof value === "string"
64330
+ );
64331
+ return url ?? null;
64332
+ };
64333
+ const renderAttachment = () => {
64334
+ const fileList = props.attachments.map(
64335
+ (att, index) => ({
64336
+ id: `${String(props.message.id)}-attachment-${index}`,
64337
+ name: att.name,
64338
+ status: att.status || "finished",
64339
+ percentage: att.percentage ?? null,
64340
+ url: att.url ?? null,
64341
+ thumbnailUrl: getThumbnailUrl(att),
64342
+ type: att.type ?? null,
64343
+ file: null,
64344
+ batchId: null
64345
+ })
64346
+ );
64347
+ const uploadComponent = /* @__PURE__ */ vue.h(
64348
+ UUpload,
64349
+ {
64350
+ abstract: true,
64351
+ fileList,
64352
+ fileListStyle: props.withPadding ? {
64353
+ display: "flex",
64354
+ flexDirection: "column",
64355
+ gap: "2px",
64356
+ marginTop: "0"
64357
+ } : void 0,
64358
+ showRemoveButton: false,
64359
+ showDownloadButton: props.attachments.some(
64360
+ (att) => att.status === "finished"
64361
+ ),
64362
+ showRetryButton: props.attachments.some(
64363
+ (att) => att.status === "error"
64364
+ ),
64365
+ ...props.uploadProps
64366
+ },
64367
+ {
64368
+ default: () => /* @__PURE__ */ vue.h(UUploadFileList, null, {
64369
+ "upload-file-title": slots["upload-file-title"] ? ({ file }) => slots["upload-file-title"]?.(file) : void 0,
64370
+ "upload-file-subtitle": slots["upload-file-subtitle"] ? ({ file }) => slots["upload-file-subtitle"]?.(file) : ({ file }) => {
64371
+ const att = props.attachments.find(
64372
+ (a) => a.name === file.name
64373
+ );
64374
+ return /* @__PURE__ */ vue.h("span", { style: { fontSize: "12px", color: "#999" } }, att?.size || file.file?.size);
64375
+ }
64376
+ })
64377
+ }
64378
+ );
64379
+ if (props.withPadding) {
64380
+ return /* @__PURE__ */ vue.h("div", { style: { padding: "2px" } }, uploadComponent);
64381
+ }
64382
+ return uploadComponent;
64383
+ };
64384
+ return () => {
64385
+ if (slots.default) {
64386
+ return slots.default(props.message);
64387
+ }
64388
+ return renderAttachment();
64389
+ };
64390
+ }
64391
+ });
64392
+
63758
64393
  const statusIconMapper = {
63759
64394
  [MessageStatus.READ]: CheckmarkDoneSharp,
63760
64395
  [MessageStatus.PENDING]: MdTime,
63761
64396
  [MessageStatus.RETRY]: Refresh,
63762
64397
  [MessageStatus.UNREAD]: CheckmarkDoneSharp
63763
64398
  };
63764
- var ChatMainArea = vue.defineComponent({
63765
- name: "ChatMainArea",
63766
- setup(_, { slots }) {
63767
- const {
63768
- mergedClsPrefixRef,
63769
- selectedChatRef,
63770
- messagesRef,
63771
- typingChatIdsRef,
63772
- messagesLoadingRef,
63773
- messagesLoadingCountRef,
63774
- headerButtonPropsRef,
63775
- headerIconPropsRef,
63776
- messageUploadPropsRef,
63777
- footerInputPropsRef,
63778
- footerButtonPropsRef,
63779
- footerUploadPropsRef,
63780
- footerIconPropsRef,
63781
- inputPlaceholderRef,
63782
- retryTextRef,
63783
- typingTextRef,
63784
- closeButtonTextRef,
63785
- handleMessageSend,
63786
- handleMessageRetry,
63787
- onChatClose,
63788
- onChatShare,
63789
- onUserProfile
63790
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
63791
- } = vue.inject(chatInjectionKey);
63792
- const messagesBodyRef = vue.ref();
63793
- const inputRef = vue.ref();
63794
- const inputValue = vue.ref("");
63795
- const attachmentFileList = vue.ref([]);
63796
- const unreadMessagesCount = vue.computed(() => {
63797
- if (!messagesRef.value) return 0;
63798
- return messagesRef.value.filter(
63799
- (msg) => !msg.isOwn && msg.status === MessageStatus.UNREAD
63800
- ).length;
63801
- });
63802
- const showNotificationManually = vue.ref(false);
63803
- const hasUnreadMessages = vue.ref(false);
63804
- const unreadCountOnOpen = vue.ref(0);
63805
- const chatInputs = vue.ref({});
63806
- vue.watch(
63807
- selectedChatRef,
63808
- (newChat, oldChat) => {
63809
- if (newChat && newChat.id !== oldChat?.id) {
63810
- inputValue.value = chatInputs.value[newChat.id] || "";
63811
- unreadCountOnOpen.value = unreadMessagesCount.value;
63812
- const globalState = getChatGlobalState();
63813
- globalState.markChatOpened(newChat.id);
63814
- if (unreadCountOnOpen.value > 0 && !globalState.hasNotificationShown(newChat.id)) {
63815
- hasUnreadMessages.value = true;
63816
- showNotificationManually.value = true;
63817
- globalState.markNotificationShown(newChat.id);
63818
- } else {
63819
- hasUnreadMessages.value = false;
63820
- showNotificationManually.value = false;
63821
- }
63822
- void vue.nextTick(() => {
63823
- scrollToBottom();
63824
- });
63825
- }
63826
- },
63827
- { immediate: true }
63828
- );
63829
- vue.watch(
63830
- messagesRef,
63831
- (newMessages, oldMessages) => {
63832
- if (newMessages && oldMessages && newMessages.length > oldMessages.length) {
63833
- if (selectedChatRef.value) {
63834
- const globalState = getChatGlobalState();
63835
- if (globalState.hasNotificationShown(selectedChatRef.value.id)) {
63836
- showNotificationManually.value = false;
63837
- }
63838
- }
63839
- void vue.nextTick(() => {
63840
- scrollToBottom();
63841
- });
63842
- }
63843
- },
63844
- { deep: true }
64399
+ const chatMessagesProps = {
64400
+ ...useTheme.props,
64401
+ messages: {
64402
+ type: Array,
64403
+ default: () => []
64404
+ },
64405
+ loading: {
64406
+ type: Boolean,
64407
+ default: false
64408
+ },
64409
+ loadingCount: {
64410
+ type: Number,
64411
+ default: 5
64412
+ },
64413
+ typingChatIds: {
64414
+ type: Array,
64415
+ default: () => []
64416
+ },
64417
+ selectedChatId: {
64418
+ type: [String, Number, Symbol],
64419
+ default: void 0
64420
+ },
64421
+ typingText: {
64422
+ type: String,
64423
+ default: void 0
64424
+ },
64425
+ retryText: {
64426
+ type: String,
64427
+ default: void 0
64428
+ },
64429
+ uploadProps: {
64430
+ type: Object,
64431
+ default: void 0
64432
+ },
64433
+ showUnreadNotification: {
64434
+ type: Boolean,
64435
+ default: false
64436
+ },
64437
+ unreadNotificationText: {
64438
+ type: String,
64439
+ default: void 0
64440
+ },
64441
+ unreadNotificationCount: {
64442
+ type: Number,
64443
+ default: void 0
64444
+ },
64445
+ onMessageRetry: {
64446
+ type: Function,
64447
+ default: void 0
64448
+ }
64449
+ };
64450
+ var UChatMessages = vue.defineComponent({
64451
+ name: "ChatMessages",
64452
+ props: chatMessagesProps,
64453
+ emits: ["message-retry"],
64454
+ setup(props, { slots, emit }) {
64455
+ const { mergedClsPrefixRef } = useConfig(props);
64456
+ const themeRef = useTheme(
64457
+ "Chat",
64458
+ "-chat",
64459
+ style$12,
64460
+ chatLight,
64461
+ props,
64462
+ mergedClsPrefixRef
63845
64463
  );
63846
- vue.watch(unreadMessagesCount, (newCount, oldCount) => {
63847
- if (selectedChatRef.value) {
63848
- if (newCount === 0 && oldCount > 0) {
63849
- showNotificationManually.value = false;
63850
- hasUnreadMessages.value = false;
64464
+ const { localeRef } = useLocale("Chat");
64465
+ const cssVarsRef = vue.computed(() => {
64466
+ const {
64467
+ common: {
64468
+ cubicBezierEaseInOut,
64469
+ brandPrimary500,
64470
+ staticGreen,
64471
+ staticRed,
64472
+ textPrimary,
64473
+ textSecondary,
64474
+ textTertiary
64475
+ },
64476
+ self: {
64477
+ backgroundColor,
64478
+ borderColor,
64479
+ mainBackgroundColor,
64480
+ headerBackgroundColor,
64481
+ headerBorderColor,
64482
+ headerTitleColor,
64483
+ messageBubbleBackgroundColorOwn,
64484
+ messageBubbleBackgroundColorOther,
64485
+ messageBubbleTextColorOwn,
64486
+ messageBubbleTextColorOther,
64487
+ messageTimeColor,
64488
+ messageStatusColor,
64489
+ attachmentBackgroundColorOwn,
64490
+ attachmentBackgroundColorOther,
64491
+ unreadNotificationBackgroundColor,
64492
+ unreadNotificationTextColor,
64493
+ typingIndicatorColor,
64494
+ dateSeparatorColor,
64495
+ dateSeparatorBackgroundColor,
64496
+ borderRadius,
64497
+ errorColor
63851
64498
  }
63852
- }
63853
- });
63854
- const showUnreadNotification = vue.computed(() => {
63855
- return hasUnreadMessages.value && showNotificationManually.value;
64499
+ } = themeRef.value;
64500
+ return {
64501
+ "--u-bezier": cubicBezierEaseInOut,
64502
+ "--u-color-primary": brandPrimary500,
64503
+ "--u-color-success": staticGreen,
64504
+ "--u-color-error": errorColor || staticRed,
64505
+ "--u-text-color-base": textPrimary,
64506
+ "--u-text-color-secondary": textSecondary,
64507
+ "--u-text-color-disabled": textTertiary,
64508
+ "--u-background-color": backgroundColor,
64509
+ "--u-border-color": borderColor,
64510
+ "--u-main-background-color": mainBackgroundColor,
64511
+ "--u-header-background-color": headerBackgroundColor,
64512
+ "--u-header-border-color": headerBorderColor,
64513
+ "--u-header-title-color": headerTitleColor,
64514
+ "--u-message-bubble-background-color-own": messageBubbleBackgroundColorOwn,
64515
+ "--u-message-bubble-background-color-other": messageBubbleBackgroundColorOther,
64516
+ "--u-message-bubble-text-color-own": messageBubbleTextColorOwn,
64517
+ "--u-message-bubble-text-color-other": messageBubbleTextColorOther,
64518
+ "--u-message-time-color": messageTimeColor,
64519
+ "--u-message-status-color": messageStatusColor,
64520
+ "--u-attachment-background-color-own": attachmentBackgroundColorOwn,
64521
+ "--u-attachment-background-color-other": attachmentBackgroundColorOther,
64522
+ "--u-unread-notification-background-color": unreadNotificationBackgroundColor,
64523
+ "--u-unread-notification-text-color": unreadNotificationTextColor,
64524
+ "--u-typing-indicator-color": typingIndicatorColor,
64525
+ "--u-date-separator-color": dateSeparatorColor,
64526
+ "--u-date-separator-background-color": dateSeparatorBackgroundColor,
64527
+ "--u-border-radius": borderRadius
64528
+ };
63856
64529
  });
63857
- vue.onMounted(() => {
63858
- void vue.nextTick(() => {
63859
- scrollToBottom();
63860
- });
64530
+ const themeClassHandle = useThemeClass(
64531
+ "chat-messages",
64532
+ vue.computed(() => ""),
64533
+ cssVarsRef,
64534
+ props
64535
+ );
64536
+ const mergedTypingTextRef = vue.computed(
64537
+ () => props.typingText ?? localeRef.value.typingText
64538
+ );
64539
+ const mergedRetryTextRef = vue.computed(
64540
+ () => props.retryText ?? localeRef.value.retryText
64541
+ );
64542
+ const mergedUnreadNotificationTextRef = vue.computed(
64543
+ () => props.unreadNotificationText ?? localeRef.value.unreadNotificationText
64544
+ );
64545
+ const unreadMessagesCount = vue.computed(() => {
64546
+ if (!props.messages) return 0;
64547
+ return props.messages.filter(
64548
+ (msg) => !msg.isOwn && msg.status === MessageStatus.UNREAD
64549
+ ).length;
63861
64550
  });
63862
- const scrollToBottom = () => {
63863
- const el = messagesBodyRef.value;
63864
- if (!el) return;
63865
- if ("scrollTo" in el && typeof el.scrollTo === "function") {
63866
- el.scrollTo({ top: 999999, behavior: "smooth" });
63867
- return;
63868
- }
63869
- if ("$el" in el && el.$el instanceof HTMLElement) {
63870
- const scrollContainer = el.$el.querySelector(".u-scrollbar-content") || el.$el;
63871
- scrollContainer.scrollTop = scrollContainer.scrollHeight;
63872
- return;
63873
- }
63874
- if ("scrollTop" in el && "scrollHeight" in el) {
63875
- el.scrollTop = el.scrollHeight;
63876
- }
64551
+ const handleMessageRetry = (message) => {
64552
+ emit("message-retry", message);
64553
+ props.onMessageRetry?.(message);
64554
+ };
64555
+ const renderDateSeparator = (date) => {
64556
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` }, /* @__PURE__ */ vue.h("span", null, date));
63877
64557
  };
63878
64558
  const renderUnreadNotification = () => {
63879
- if (!showUnreadNotification.value) return null;
64559
+ const count = props.unreadNotificationCount ?? unreadMessagesCount.value;
63880
64560
  return /* @__PURE__ */ vue.h(
63881
64561
  "div",
63882
64562
  {
63883
64563
  class: `${mergedClsPrefixRef.value}-chat-main__unread-notification`
63884
64564
  },
63885
- /* @__PURE__ */ vue.h("span", null, unreadCountOnOpen.value, " \u043D\u043E\u0432\u044B\u0445 \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F")
64565
+ /* @__PURE__ */ vue.h("span", null, count, " ", mergedUnreadNotificationTextRef.value)
63886
64566
  );
63887
64567
  };
63888
- const renderHeader = () => {
63889
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header` }, /* @__PURE__ */ vue.h(UFlex, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ vue.h(
63890
- UText,
63891
- {
63892
- variant: "heading-s-bold",
63893
- class: `${mergedClsPrefixRef.value}-chat-main__header-title`
63894
- },
63895
- selectedChatRef.value?.title || "Select a chat"
63896
- ), /* @__PURE__ */ vue.h(
63897
- UFlex,
63898
- {
63899
- align: "center",
63900
- size: "small",
63901
- class: `${mergedClsPrefixRef.value}-chat-main__header-actions`
63902
- },
63903
- resolveSlot(slots.headerActions, () => [
63904
- /* @__PURE__ */ vue.h(
63905
- Button,
63906
- {
63907
- secondary: true,
63908
- circle: true,
63909
- size: "large",
63910
- ...headerButtonPropsRef.value,
63911
- onClick: () => onChatShare?.value?.()
63912
- },
63913
- /* @__PURE__ */ vue.h(UIcon, { size: 20, ...headerIconPropsRef.value }, /* @__PURE__ */ vue.h(ArrowHookUpRight, null))
63914
- ),
63915
- /* @__PURE__ */ vue.h(
63916
- Button,
63917
- {
63918
- secondary: true,
63919
- circle: true,
63920
- size: "large",
63921
- ...headerButtonPropsRef.value,
63922
- onClick: () => onUserProfile?.value?.()
63923
- },
63924
- /* @__PURE__ */ vue.h(UIcon, { size: 20, ...headerIconPropsRef.value }, /* @__PURE__ */ vue.h(PersonNote, null))
63925
- ),
63926
- /* @__PURE__ */ vue.h(
63927
- Button,
63928
- {
63929
- type: "primary",
63930
- size: "large",
63931
- round: true,
63932
- ...headerButtonPropsRef.value,
63933
- onClick: () => onChatClose?.value?.()
63934
- },
63935
- closeButtonTextRef.value
63936
- )
63937
- ])
63938
- )));
63939
- };
63940
- const renderDateSeparator = (date) => {
63941
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` }, /* @__PURE__ */ vue.h("span", null, date));
63942
- };
63943
64568
  const renderMessage = (message) => {
63944
64569
  const isOwn = message.isOwn;
63945
64570
  const attachments = message.attachment ? Array.isArray(message.attachment) ? message.attachment : [message.attachment] : [];
@@ -63965,7 +64590,7 @@
63965
64590
  {
63966
64591
  message,
63967
64592
  attachments,
63968
- uploadProps: messageUploadPropsRef.value,
64593
+ uploadProps: props.uploadProps,
63969
64594
  withPadding: true
63970
64595
  },
63971
64596
  {
@@ -63986,7 +64611,7 @@
63986
64611
  {
63987
64612
  message,
63988
64613
  attachments,
63989
- uploadProps: messageUploadPropsRef.value
64614
+ uploadProps: props.uploadProps
63990
64615
  },
63991
64616
  {
63992
64617
  default: slots.messageAttachment,
@@ -64024,7 +64649,7 @@
64024
64649
  {
64025
64650
  class: `${mergedClsPrefixRef.value}-chat-main__message-retry-text`
64026
64651
  },
64027
- retryTextRef.value
64652
+ mergedRetryTextRef.value
64028
64653
  )
64029
64654
  ) : /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h(
64030
64655
  "span",
@@ -64085,7 +64710,7 @@
64085
64710
  {
64086
64711
  class: `${mergedClsPrefixRef.value}-chat-main__message-time`
64087
64712
  },
64088
- typingTextRef.value
64713
+ mergedTypingTextRef.value
64089
64714
  )
64090
64715
  ))
64091
64716
  );
@@ -64132,46 +64757,121 @@
64132
64757
  ))
64133
64758
  );
64134
64759
  };
64135
- const renderMessages = () => {
64136
- if (messagesLoadingRef.value) {
64137
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__messages` }, Array.from({ length: messagesLoadingCountRef.value || 5 }).map(
64138
- (_2, index) => {
64139
- const isOwn = index % 2 === 0;
64140
- return renderSkeletonMessage(isOwn, index);
64141
- }
64142
- ));
64760
+ return {
64761
+ mergedClsPrefixRef,
64762
+ renderMessage,
64763
+ renderTypingIndicator,
64764
+ renderSkeletonMessage,
64765
+ renderDateSeparator,
64766
+ renderUnreadNotification,
64767
+ cssVars: cssVarsRef,
64768
+ themeClass: themeClassHandle?.themeClass,
64769
+ onRender: themeClassHandle?.onRender
64770
+ };
64771
+ },
64772
+ render() {
64773
+ this.onRender?.();
64774
+ const {
64775
+ mergedClsPrefixRef,
64776
+ renderMessage,
64777
+ renderTypingIndicator,
64778
+ renderSkeletonMessage,
64779
+ renderDateSeparator,
64780
+ renderUnreadNotification
64781
+ } = this;
64782
+ if (this.loading) {
64783
+ return /* @__PURE__ */ vue.h(
64784
+ "div",
64785
+ {
64786
+ class: [`${mergedClsPrefixRef}-chat`, this.themeClass],
64787
+ style: this.cssVars
64788
+ },
64789
+ /* @__PURE__ */ vue.h(
64790
+ "div",
64791
+ {
64792
+ class: `${mergedClsPrefixRef}-chat-main`,
64793
+ style: {
64794
+ border: "none",
64795
+ borderRadius: "0",
64796
+ padding: "0",
64797
+ background: "transparent"
64798
+ }
64799
+ },
64800
+ /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef}-chat-main__messages` }, Array.from({ length: this.loadingCount || 5 }).map(
64801
+ (_, index) => {
64802
+ const isOwn = index % 2 === 0;
64803
+ return renderSkeletonMessage(isOwn, index);
64804
+ }
64805
+ ))
64806
+ )
64807
+ );
64808
+ }
64809
+ const messagesWithDates = [];
64810
+ let currentDate = "";
64811
+ let unreadNotificationInserted = false;
64812
+ this.messages?.forEach((message, index) => {
64813
+ const messageDate = message.date || "";
64814
+ if (messageDate !== currentDate) {
64815
+ messagesWithDates.push({
64816
+ type: "date-separator",
64817
+ date: messageDate,
64818
+ id: `date-${String(index)}`
64819
+ });
64820
+ currentDate = messageDate;
64143
64821
  }
64144
- const messagesWithDates = [];
64145
- let currentDate = "";
64146
- let unreadNotificationInserted = false;
64147
- messagesRef.value?.forEach((message, index) => {
64148
- const messageDate = message.date || "";
64149
- if (messageDate !== currentDate) {
64150
- messagesWithDates.push({
64151
- type: "date-separator",
64152
- date: messageDate,
64153
- id: `date-${String(index)}`
64154
- });
64155
- currentDate = messageDate;
64156
- }
64157
- if (!unreadNotificationInserted && !message.isOwn && message.status === MessageStatus.UNREAD && showUnreadNotification.value) {
64158
- messagesWithDates.push({
64159
- type: "unread-notification",
64160
- id: "unread-notification"
64161
- });
64162
- unreadNotificationInserted = true;
64163
- }
64822
+ if (!unreadNotificationInserted && !message.isOwn && message.status === MessageStatus.UNREAD && this.showUnreadNotification) {
64164
64823
  messagesWithDates.push({
64165
- type: "message",
64166
- ...message
64824
+ type: "unread-notification",
64825
+ id: "unread-notification"
64167
64826
  });
64827
+ unreadNotificationInserted = true;
64828
+ }
64829
+ messagesWithDates.push({
64830
+ type: "message",
64831
+ ...message
64168
64832
  });
64169
- return /* @__PURE__ */ vue.h(
64833
+ });
64834
+ if (!unreadNotificationInserted && this.showUnreadNotification) {
64835
+ const unreadCount = this.unreadNotificationCount || 0;
64836
+ let incomingMessagesFound = 0;
64837
+ let insertIndex = messagesWithDates.length;
64838
+ for (let i = messagesWithDates.length - 1; i >= 0; i--) {
64839
+ const item = messagesWithDates[i];
64840
+ if (item.type === "message") {
64841
+ const message = item;
64842
+ if (!message.isOwn) {
64843
+ incomingMessagesFound++;
64844
+ if (incomingMessagesFound === unreadCount) {
64845
+ insertIndex = i;
64846
+ break;
64847
+ }
64848
+ }
64849
+ }
64850
+ }
64851
+ messagesWithDates.splice(insertIndex, 0, {
64852
+ type: "unread-notification",
64853
+ id: "unread-notification"
64854
+ });
64855
+ }
64856
+ const isTyping = this.selectedChatId && this.typingChatIds?.includes(this.selectedChatId);
64857
+ return /* @__PURE__ */ vue.h(
64858
+ "div",
64859
+ {
64860
+ class: [`${mergedClsPrefixRef}-chat`, this.themeClass],
64861
+ style: this.cssVars
64862
+ },
64863
+ /* @__PURE__ */ vue.h(
64170
64864
  "div",
64171
64865
  {
64172
- class: `${mergedClsPrefixRef.value}-chat-main__messages-container`
64866
+ class: `${mergedClsPrefixRef}-chat-main`,
64867
+ style: {
64868
+ border: "none",
64869
+ borderRadius: "0",
64870
+ padding: "0",
64871
+ background: "transparent"
64872
+ }
64173
64873
  },
64174
- messagesWithDates.map(
64874
+ /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef}-chat-main__messages-container` }, messagesWithDates.map(
64175
64875
  (item) => {
64176
64876
  if (item.type === "date-separator") {
64177
64877
  return renderDateSeparator(item.date ?? "");
@@ -64181,8 +64881,240 @@
64181
64881
  }
64182
64882
  return renderMessage(item);
64183
64883
  }
64184
- ),
64185
- selectedChatRef.value && typingChatIdsRef.value?.includes(selectedChatRef.value.id) && renderTypingIndicator()
64884
+ ), isTyping && renderTypingIndicator())
64885
+ )
64886
+ );
64887
+ }
64888
+ });
64889
+
64890
+ const SCROLL_DELAY = 50;
64891
+ const SENDING_DELAY = 100;
64892
+ var ChatMainArea = vue.defineComponent({
64893
+ name: "ChatMainArea",
64894
+ setup(_, { slots }) {
64895
+ const {
64896
+ mergedClsPrefixRef,
64897
+ selectedChatRef,
64898
+ messagesRef,
64899
+ typingChatIdsRef,
64900
+ messagesLoadingRef,
64901
+ messagesLoadingCountRef,
64902
+ headerButtonPropsRef,
64903
+ headerIconPropsRef,
64904
+ messageUploadPropsRef,
64905
+ footerInputPropsRef,
64906
+ footerButtonPropsRef,
64907
+ footerUploadPropsRef,
64908
+ footerIconPropsRef,
64909
+ inputPlaceholderRef,
64910
+ retryTextRef,
64911
+ typingTextRef,
64912
+ closeButtonTextRef,
64913
+ unreadNotificationTextRef,
64914
+ notificationsShownSetRef,
64915
+ unreadCountsBeforeReadRef,
64916
+ markNotificationShown,
64917
+ handleMessageSend,
64918
+ handleMessageRetry,
64919
+ onChatClose,
64920
+ onChatShare,
64921
+ onUserProfile
64922
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
64923
+ } = vue.inject(chatInjectionKey);
64924
+ const messagesBodyRef = vue.ref();
64925
+ const inputRef = vue.ref();
64926
+ const inputValue = vue.ref("");
64927
+ const attachmentFileList = vue.ref([]);
64928
+ const unreadMessagesCount = vue.computed(() => {
64929
+ if (!messagesRef.value) return 0;
64930
+ return messagesRef.value.filter(
64931
+ (msg) => !msg.isOwn && msg.status === MessageStatus.UNREAD
64932
+ ).length;
64933
+ });
64934
+ const showNotificationManually = vue.ref(false);
64935
+ const hasUnreadMessages = vue.ref(false);
64936
+ const unreadCountOnOpen = vue.ref(0);
64937
+ const chatInputs = vue.ref({});
64938
+ const lastMessageId = vue.ref(null);
64939
+ vue.watch(
64940
+ selectedChatRef,
64941
+ (newChat, oldChat) => {
64942
+ if (newChat && newChat.id !== oldChat?.id) {
64943
+ inputValue.value = chatInputs.value[newChat.id] || "";
64944
+ const unreadBeforeRead = unreadCountsBeforeReadRef.value[newChat.id] || 0;
64945
+ unreadCountOnOpen.value = unreadBeforeRead;
64946
+ lastMessageId.value = null;
64947
+ if (unreadBeforeRead > 0 && !notificationsShownSetRef.value.has(newChat.id)) {
64948
+ hasUnreadMessages.value = true;
64949
+ showNotificationManually.value = true;
64950
+ markNotificationShown(newChat.id);
64951
+ } else {
64952
+ hasUnreadMessages.value = false;
64953
+ showNotificationManually.value = false;
64954
+ }
64955
+ void vue.nextTick(() => {
64956
+ scrollToBottom();
64957
+ });
64958
+ setTimeout(() => {
64959
+ scrollToBottom();
64960
+ }, SCROLL_DELAY);
64961
+ }
64962
+ },
64963
+ { immediate: true }
64964
+ );
64965
+ vue.watch(
64966
+ messagesRef,
64967
+ (newMessages) => {
64968
+ if (!newMessages || newMessages.length === 0) {
64969
+ lastMessageId.value = null;
64970
+ return;
64971
+ }
64972
+ const currentLastMessage = newMessages[newMessages.length - 1];
64973
+ const currentLastId = currentLastMessage?.id;
64974
+ if (currentLastId !== lastMessageId.value && lastMessageId.value !== null) {
64975
+ void vue.nextTick(() => {
64976
+ scrollToBottom();
64977
+ });
64978
+ setTimeout(() => {
64979
+ scrollToBottom();
64980
+ }, SCROLL_DELAY);
64981
+ if (currentLastMessage && !currentLastMessage.isOwn && currentLastMessage.status === MessageStatus.UNREAD) {
64982
+ unreadCountOnOpen.value = unreadMessagesCount.value;
64983
+ }
64984
+ }
64985
+ lastMessageId.value = currentLastId ?? null;
64986
+ },
64987
+ { deep: true, flush: "post" }
64988
+ );
64989
+ vue.watch(unreadMessagesCount, (newCount, oldCount) => {
64990
+ if (selectedChatRef.value && newCount === 0 && oldCount > 0) {
64991
+ showNotificationManually.value = false;
64992
+ hasUnreadMessages.value = false;
64993
+ const newSet = new Set(notificationsShownSetRef.value);
64994
+ newSet.delete(selectedChatRef.value.id);
64995
+ notificationsShownSetRef.value = newSet;
64996
+ }
64997
+ });
64998
+ const showUnreadNotification = vue.computed(() => {
64999
+ return hasUnreadMessages.value && showNotificationManually.value;
65000
+ });
65001
+ vue.onMounted(() => {
65002
+ void vue.nextTick(() => {
65003
+ scrollToBottom();
65004
+ });
65005
+ setTimeout(() => {
65006
+ scrollToBottom();
65007
+ }, SCROLL_DELAY);
65008
+ });
65009
+ const scrollToBottom = () => {
65010
+ const el = messagesBodyRef.value;
65011
+ if (!el) return;
65012
+ if ("$el" in el && el.$el instanceof HTMLElement) {
65013
+ const scrollContainer = el.$el.querySelector(".u-scrollbar-content");
65014
+ if (scrollContainer) {
65015
+ scrollContainer.scrollTop = scrollContainer.scrollHeight;
65016
+ return;
65017
+ }
65018
+ }
65019
+ if ("scrollTo" in el && typeof el.scrollTo === "function") {
65020
+ el.scrollTo({ top: 999999, behavior: "auto" });
65021
+ return;
65022
+ }
65023
+ if ("scrollTop" in el && "scrollHeight" in el) {
65024
+ el.scrollTop = el.scrollHeight;
65025
+ }
65026
+ };
65027
+ const renderHeader = () => {
65028
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header` }, /* @__PURE__ */ vue.h(UFlex, { justify: "space-between", align: "flex-start" }, {
65029
+ default: () => /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h(
65030
+ UText,
65031
+ {
65032
+ variant: "heading-s-bold",
65033
+ class: `${mergedClsPrefixRef.value}-chat-main__header-title`
65034
+ },
65035
+ {
65036
+ default: () => selectedChatRef.value?.title || "Select a chat"
65037
+ }
65038
+ ), /* @__PURE__ */ vue.h(
65039
+ UFlex,
65040
+ {
65041
+ align: "center",
65042
+ size: "small",
65043
+ class: `${mergedClsPrefixRef.value}-chat-main__header-actions`
65044
+ },
65045
+ {
65046
+ default: () => resolveSlot(slots.headerActions, () => [
65047
+ /* @__PURE__ */ vue.h(
65048
+ Button,
65049
+ {
65050
+ secondary: true,
65051
+ circle: true,
65052
+ size: "large",
65053
+ ...headerButtonPropsRef.value,
65054
+ onClick: () => onChatShare?.value?.()
65055
+ },
65056
+ {
65057
+ default: () => /* @__PURE__ */ vue.h(UIcon, { size: 20, ...headerIconPropsRef.value }, {
65058
+ default: () => /* @__PURE__ */ vue.h(ArrowHookUpRight, null)
65059
+ })
65060
+ }
65061
+ ),
65062
+ /* @__PURE__ */ vue.h(
65063
+ Button,
65064
+ {
65065
+ secondary: true,
65066
+ circle: true,
65067
+ size: "large",
65068
+ ...headerButtonPropsRef.value,
65069
+ onClick: () => onUserProfile?.value?.()
65070
+ },
65071
+ {
65072
+ default: () => /* @__PURE__ */ vue.h(UIcon, { size: 20, ...headerIconPropsRef.value }, {
65073
+ default: () => /* @__PURE__ */ vue.h(PersonNote, null)
65074
+ })
65075
+ }
65076
+ ),
65077
+ /* @__PURE__ */ vue.h(
65078
+ Button,
65079
+ {
65080
+ type: "primary",
65081
+ size: "large",
65082
+ round: true,
65083
+ ...headerButtonPropsRef.value,
65084
+ onClick: () => onChatClose?.value?.()
65085
+ },
65086
+ {
65087
+ default: () => closeButtonTextRef.value
65088
+ }
65089
+ )
65090
+ ])
65091
+ }
65092
+ ))
65093
+ }));
65094
+ };
65095
+ const renderMessages = () => {
65096
+ return /* @__PURE__ */ vue.h(
65097
+ UChatMessages,
65098
+ {
65099
+ messages: messagesRef.value,
65100
+ loading: messagesLoadingRef.value,
65101
+ loadingCount: messagesLoadingCountRef.value,
65102
+ typingChatIds: typingChatIdsRef.value,
65103
+ selectedChatId: selectedChatRef.value?.id,
65104
+ typingText: typingTextRef.value,
65105
+ retryText: retryTextRef.value,
65106
+ uploadProps: messageUploadPropsRef.value,
65107
+ showUnreadNotification: showUnreadNotification.value,
65108
+ unreadNotificationText: unreadNotificationTextRef.value,
65109
+ unreadNotificationCount: unreadCountOnOpen.value,
65110
+ onMessageRetry: handleMessageRetry
65111
+ },
65112
+ {
65113
+ messageAttachment: slots.messageAttachment,
65114
+ messageAttachmentTitle: slots.messageAttachmentTitle,
65115
+ messageAttachmentSubtitle: slots.messageAttachmentSubtitle,
65116
+ messageStatus: slots.messageStatus
65117
+ }
64186
65118
  );
64187
65119
  };
64188
65120
  const isSending = vue.ref(false);
@@ -64209,12 +65141,8 @@
64209
65141
  inputValue.value = "";
64210
65142
  attachmentFileList.value = [];
64211
65143
  chatInputs.value[selectedChatRef.value.id] = "";
64212
- const globalState = getChatGlobalState();
64213
- if (globalState.hasNotificationShown(selectedChatRef.value.id)) {
64214
- globalState.markNotificationShown(selectedChatRef.value.id);
64215
- showNotificationManually.value = false;
64216
- hasUnreadMessages.value = false;
64217
- }
65144
+ hasUnreadMessages.value = false;
65145
+ showNotificationManually.value = false;
64218
65146
  void vue.nextTick(() => {
64219
65147
  scrollToBottom();
64220
65148
  });
@@ -64285,58 +65213,72 @@
64285
65213
  onUpdateFileList: handleFileListUpdate,
64286
65214
  ...footerUploadPropsRef.value
64287
65215
  },
64288
- /* @__PURE__ */ vue.h(
64289
- UFlex,
64290
- {
64291
- align: "center",
64292
- size: "small",
64293
- class: `${mergedClsPrefixRef.value}-chat-main__input-container`
64294
- },
64295
- /* @__PURE__ */ vue.h(UUploadTrigger, { abstract: true }, {
64296
- default: ({ handleClick }) => /* @__PURE__ */ vue.h(
64297
- Button,
64298
- {
64299
- secondary: true,
64300
- size: "large",
64301
- class: `${mergedClsPrefixRef.value}-chat-main__attach-btn`,
64302
- ...footerButtonPropsRef.value,
64303
- onClick: handleClick
64304
- },
64305
- /* @__PURE__ */ vue.h(UIcon, { size: 24, ...footerIconPropsRef.value }, /* @__PURE__ */ vue.h(AttachIcon, null))
64306
- )
64307
- }),
64308
- /* @__PURE__ */ vue.h(
64309
- UInput,
65216
+ {
65217
+ default: () => /* @__PURE__ */ vue.h(
65218
+ UFlex,
64310
65219
  {
64311
- ref: "inputRef",
64312
- value: inputValue.value,
64313
- placeholder: inputPlaceholderRef.value,
64314
- class: `${mergedClsPrefixRef.value}-chat-main__input`,
64315
- ...footerInputPropsRef.value,
64316
- onUpdateValue: (value) => {
64317
- inputValue.value = value;
64318
- if (selectedChatRef.value) {
64319
- chatInputs.value[selectedChatRef.value.id] = value;
64320
- }
64321
- },
64322
- onKeydown: (e) => {
64323
- if (e.key === "Enter" && !e.shiftKey) {
64324
- e.preventDefault();
64325
- e.stopPropagation();
64326
- void handleSendMessage();
65220
+ align: "center",
65221
+ size: "small",
65222
+ class: `${mergedClsPrefixRef.value}-chat-main__input-container`
65223
+ },
65224
+ {
65225
+ default: () => /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h(UUploadTrigger, { abstract: true }, {
65226
+ default: ({
65227
+ handleClick
65228
+ }) => /* @__PURE__ */ vue.h(
65229
+ Button,
65230
+ {
65231
+ secondary: true,
65232
+ size: "large",
65233
+ class: `${mergedClsPrefixRef.value}-chat-main__attach-btn`,
65234
+ ...footerButtonPropsRef.value,
65235
+ onClick: handleClick
65236
+ },
65237
+ {
65238
+ default: () => /* @__PURE__ */ vue.h(
65239
+ UIcon,
65240
+ {
65241
+ size: 24,
65242
+ ...footerIconPropsRef.value
65243
+ },
65244
+ {
65245
+ default: () => /* @__PURE__ */ vue.h(AttachIcon, null)
65246
+ }
65247
+ )
65248
+ }
65249
+ )
65250
+ }), /* @__PURE__ */ vue.h(
65251
+ UInput,
65252
+ {
65253
+ ref: "inputRef",
65254
+ value: inputValue.value,
65255
+ placeholder: inputPlaceholderRef.value,
65256
+ class: `${mergedClsPrefixRef.value}-chat-main__input`,
65257
+ ...footerInputPropsRef.value,
65258
+ onUpdateValue: (value) => {
65259
+ inputValue.value = value;
65260
+ if (selectedChatRef.value) {
65261
+ chatInputs.value[selectedChatRef.value.id] = value;
65262
+ }
65263
+ },
65264
+ onKeydown: (e) => {
65265
+ if (e.key === "Enter" && !e.shiftKey) {
65266
+ e.preventDefault();
65267
+ e.stopPropagation();
65268
+ void handleSendMessage();
65269
+ }
65270
+ }
64327
65271
  }
64328
- }
65272
+ ))
64329
65273
  }
64330
65274
  )
64331
- )
65275
+ }
64332
65276
  ));
64333
65277
  };
64334
65278
  return {
64335
65279
  renderHeader,
64336
65280
  renderMessages,
64337
65281
  renderFooter,
64338
- renderUnreadNotification,
64339
- showUnreadNotification,
64340
65282
  messagesBodyRef,
64341
65283
  inputRef,
64342
65284
  inputValue,
@@ -64352,451 +65294,10 @@
64352
65294
  ref: "messagesBodyRef",
64353
65295
  class: `${mergedClsPrefixRef.value}-chat-main__body`
64354
65296
  },
64355
- this.renderMessages()
64356
- ), this.renderFooter());
64357
- }
64358
- });
64359
-
64360
- var style$V = cB("chat", `
64361
- height: 100%;
64362
- max-height: 100%;
64363
- min-height: 0;
64364
- display: flex;
64365
- overflow: hidden;
64366
- box-sizing: border-box;
64367
- .u-list-item__text {
64368
- grid-template-columns: 1fr !important;
64369
- }
64370
- .u-flex {
64371
- height: 100%;
64372
- max-height: 100%;
64373
- min-height: 0;
64374
- overflow: hidden;
64375
- }
64376
- `, [cB("chat-sidebar", `
64377
- max-width: 388px;
64378
- width: 100%;
64379
- height: 100%;
64380
- display: flex;
64381
- flex-direction: column;
64382
- background-color: var(--u-sidebar-background-color);
64383
- border: 1px solid var(--u-sidebar-border-color);
64384
- border-radius: 20px;
64385
- overflow: hidden;
64386
- `, [cE("header", `
64387
- padding: 16px 16px 0 16px;
64388
- flex-shrink: 0;
64389
- `), cE("header-main", `
64390
- flex: 0 0 48%;
64391
- min-width: 0;
64392
- `), cE("header-actions", `
64393
- flex: 0 0 48%;
64394
- min-width: 0;
64395
- display: flex;
64396
- justify-content: flex-end;
64397
- align-items: center;
64398
- gap: 8px;
64399
- `), cE("content", `
64400
- flex: 1;
64401
- overflow-y: auto;
64402
- min-height: 0;
64403
- padding: 16px;
64404
- padding-top: 12px;
64405
- `), cE("item", `
64406
- padding: 12px 16px;
64407
- width: 100%;
64408
- cursor: pointer;
64409
- border-radius: 8px;
64410
- margin-bottom: 4px;
64411
- transition: all 0.2s ease;
64412
- position: relative;
64413
- `, [c$1(".u-list-item", `
64414
- min-width: 0;
64415
- `), c$1(".u-list-item__main", `
64416
- min-width: 0;
64417
- flex: 1;
64418
- `), c$1(".u-list-item__prefix", `
64419
- flex-shrink: 0;
64420
- `), c$1(".u-list-item__suffix", `
64421
- flex-shrink: 0;
64422
- margin-left: 12px;
64423
- `), c$1(".u-list-item__text", `
64424
- grid-template-columns: 1fr !important;
64425
- min-width: 0 !important;
64426
- max-width: 100%;
64427
- `), c$1(".u-list-item__content", `
64428
- min-width: 0;
64429
- `), c$1(".u-list-item__title", `
64430
- min-width: 0;
64431
- `), c$1(".u-list-item__subtitle", `
64432
- min-width: 0 !important;
64433
- `), cM("selected", `
64434
- background-color: var(--u-sidebar-item-background-color-selected);
64435
- `, [c$1("&:hover", `
64436
- background-color: var(--u-sidebar-item-background-color-selected);
64437
- `)]), cM("typing", `
64438
- .u-list-item__description {
64439
- color: var(--u-color-primary) !important;
64440
- font-style: italic;
65297
+ {
65298
+ default: () => this.renderMessages()
64441
65299
  }
64442
- `), c$1("&:hover", `
64443
- background-color: var(--u-sidebar-item-background-color-hover);
64444
- `, [cM("selected", `
64445
- background-color: var(--u-sidebar-item-background-color-selected);
64446
- `)])]), cE("item-title", `
64447
- font-weight: 500;
64448
- font-size: 14px;
64449
- line-height: 20px;
64450
- color: var(--u-sidebar-item-text-color);
64451
- overflow: hidden;
64452
- text-overflow: ellipsis;
64453
- white-space: nowrap;
64454
- `), cE("item-subtitle", `
64455
- font-size: 12px;
64456
- line-height: 16px;
64457
- color: var(--u-sidebar-item-subtitle-color);
64458
- overflow: hidden;
64459
- text-overflow: ellipsis;
64460
- white-space: nowrap;
64461
- `, [cM("typing", `
64462
- color: var(--u-color-primary);
64463
- font-style: italic;
64464
- `)]), cE("item-main", `
64465
- flex: 1;
64466
- min-width: 0;
64467
- margin-right: 12px;
64468
- `), cE("item-title", `
64469
- font-weight: 500;
64470
- font-size: 14px;
64471
- line-height: 20px;
64472
- color: var(--u-text-color-base);
64473
- margin-bottom: 2px;
64474
- overflow: hidden;
64475
- text-overflow: ellipsis;
64476
- white-space: nowrap;
64477
- `), cE("item-subtitle", `
64478
- font-size: 12px;
64479
- line-height: 16px;
64480
- color: var(--u-text-color-disabled);
64481
- overflow: hidden;
64482
- text-overflow: ellipsis;
64483
- white-space: nowrap;
64484
- `), cE("item-indicators", `
64485
- display: flex;
64486
- flex-direction: column;
64487
- align-items: flex-end;
64488
- gap: 4px;
64489
- flex-shrink: 0;
64490
- `), cE("item-time", `
64491
- font-size: 11px;
64492
- line-height: 21px;
64493
- color: var(--u-sidebar-item-time-color);
64494
- white-space: nowrap;
64495
- `), cE("item-status sup", `
64496
- padding: 2px 6px 2px 5px;
64497
- height: 22px;
64498
- --u-color: var(--u-unread-notification-background-color);
64499
- `), cE("item-status-icon", `
64500
- color: var(--u-sidebar-item-time-color);
64501
- `, [cM("read", `
64502
- color: var(--u-unread-notification-background-color);
64503
- `)]), c$1("&:has(.u-chat-sidebar__item-badge)", `
64504
- `, [cE("item-title", `
64505
- font-weight: 600;
64506
- `), cE("item-subtitle", `
64507
- color: var(--u-text-color-base);
64508
- font-weight: 500;
64509
- `)])]), cB("chat-main", `
64510
- background-color: var(--u-main-background-color);
64511
- border: 1px solid var(--u-border-color);
64512
- border-radius: 20px;
64513
- width: 100%;
64514
- flex: 1;
64515
- display: flex;
64516
- flex-direction: column;
64517
- height: 100%;
64518
- max-height: 100%;
64519
- min-height: 0;
64520
- overflow: hidden;
64521
- `, [cE("header", `
64522
- border-bottom: 1px solid var(--u-border-color);
64523
- width: 100%;
64524
- padding: 24px 20px 8px 24px;
64525
- flex-shrink: 0;
64526
- `), cE("header-title", `
64527
- margin-top: 9px;
64528
- color: var(--u-header-title-color);
64529
- `), cE("header-actions", `
64530
- padding: 4px;
64531
- `), cE("unread-notification", `
64532
- background-color: var(--u-unread-notification-background-color);
64533
- color: var(--u-unread-notification-text-color);
64534
- padding: 6px 12px;
64535
- text-align: center;
64536
- font-size: 12px;
64537
- font-weight: 500;
64538
- margin: 8px 0;
64539
- display: flex;
64540
- justify-content: center;
64541
- width: 100%;
64542
- `, [c$1("span", `
64543
- display: inline-block;
64544
- white-space: nowrap;
64545
- `)]), cE("body", `
64546
- flex: 1;
64547
- min-height: 0;
64548
- position: relative;
64549
- `, [c$1(".u-scrollbar-content", `
64550
- padding: 16px 24px;
64551
- min-height: 100%;
64552
- display: flex;
64553
- flex-direction: column;
64554
- justify-content: flex-end;
64555
- `)]), cE("messages-container", `
64556
- display: flex;
64557
- flex-direction: column;
64558
- gap: 16px;
64559
- min-height: 100%;
64560
- width: 100%;
64561
- justify-content: flex-end;
64562
- `), cE("date-separator", `
64563
- display: flex;
64564
- justify-content: center;
64565
- margin: 16px 0;
64566
- `, [c$1("span", `
64567
- color: var(--u-date-separator-color);
64568
- padding: 4px 12px;
64569
- border-radius: 12px;
64570
- font-size: 12px;
64571
- font-weight: 500;
64572
- `)]), cE("message", `
64573
- display: flex;
64574
- margin-bottom: 8px;
64575
- flex-shrink: 0;
64576
- width: 100%;
64577
- `, [cM("own", `
64578
- justify-content: flex-end;
64579
- `), cM("other", `
64580
- justify-content: flex-start;
64581
- `)]), cE("message-wrapper", `
64582
- max-width: 70%;
64583
- display: flex;
64584
- flex-direction: column;
64585
- gap: 4px;
64586
- flex-shrink: 0;
64587
- `), cE("message-bubble", `
64588
- border-radius: 18px;
64589
- font-size: 14px;
64590
- line-height: 20px;
64591
- word-wrap: break-word;
64592
- background-color: var(--u-message-bubble-background-color-other);
64593
- color: var(--u-message-bubble-text-color-other);
64594
- border-bottom-left-radius: 6px;
64595
- width: fit-content;
64596
- display: flex;
64597
- flex-direction: column;
64598
- `, [cM("own", `
64599
- background-color: var(--u-message-bubble-background-color-own);
64600
- color: var(--u-message-bubble-text-color-own);
64601
- border-bottom-left-radius: 18px;
64602
- border-bottom-right-radius: 6px;
64603
- `), cM("typing", `
64604
- min-width: 300px;
64605
- height: 44px;
64606
- padding: 12px 16px;
64607
- `), cM("skeleton", `
64608
- min-width: 376px;
64609
- height: 44px;
64610
- `)]), cE("message-text", `
64611
- padding: 12px 16px;
64612
- `), cE("message-attachment", `
64613
- display: flex;
64614
- align-items: center;
64615
- gap: 12px;
64616
- padding: 12px 16px;
64617
- background-color: #f8f9fa;
64618
- border-radius: 12px;
64619
- border: 1px solid #e9ecef;
64620
- margin-top: 4px;
64621
- `), cE("attachment-icon", `
64622
- color: #6c757d;
64623
- flex-shrink: 0;
64624
- `), cE("attachment-info", `
64625
- flex: 1;
64626
- min-width: 0;
64627
- `), cE("attachment-name", `
64628
- font-size: 14px;
64629
- font-weight: 500;
64630
- color: var(--u-text-color-base);
64631
- margin-bottom: 2px;
64632
- `), cE("attachment-size", `
64633
- font-size: 12px;
64634
- color: var(--u-text-color-disabled);
64635
- `), cE("message-meta", `
64636
- display: flex;
64637
- align-items: center;
64638
- gap: 4px;
64639
- font-size: 11px;
64640
- color: var(--u-text-color-disabled);
64641
- margin-top: 2px;
64642
- `, [cM("own", `
64643
- justify-content: flex-end;
64644
- `), cM("other", `
64645
- justify-content: flex-start;
64646
- `), cM("skeleton", `
64647
- width: 36px;
64648
- height: 20px;
64649
- border-radius: 4px;
64650
- `)]), cE("message-time", `
64651
- font-size: 11px;
64652
- color: var(--u-message-time-color);
64653
- `), cE("message-status", `
64654
- color: var(--u-color-success);
64655
- display: flex;
64656
- align-items: center;
64657
- `), cE("message-status-icon", `
64658
- color: var(--u-message-time-color);
64659
- `, [cM("read", `
64660
- color: var(--u-unread-notification-background-color);
64661
- `), cM("retry", `
64662
- color: var(--u-color-error);
64663
- `)]), cE("message-retry", `
64664
- display: flex;
64665
- align-items: center;
64666
- gap: 4px;
64667
- `), cE("message-retry-icon", `
64668
- color: var(--u-color-error);
64669
- `), cE("message-retry-text", `
64670
- color: var(--u-color-error);
64671
- font-size: 11px;
64672
- font-weight: 500;
64673
- `), cE("typing-indicator", `
64674
- display: flex;
64675
- justify-content: flex-start;
64676
- margin-bottom: 8px;
64677
- `), cE("footer", `
64678
- border-top: 1px solid var(--u-border-color);
64679
- padding: 0px 20px;
64680
- flex-shrink: 0;
64681
- `), cE("input-container", `
64682
- width: 100%;
64683
- padding: 16px 0px;
64684
- `), cE("input", `
64685
- flex: 1;
64686
- margin-right: 4px;
64687
- --u-color: #F3F4F6 !important;
64688
- --u-color-focus: #F3F4F6 !important;
64689
- --u-border: none !important;
64690
- --u-border-focus: none !important;
64691
- --u-border-hover: none !important;
64692
- --u-box-shadow: none !important;
64693
- --u-box-shadow-focus: none !important;
64694
- `), cE("attach-btn", `
64695
- margin-left: 4px;
64696
- flex-shrink: 0;
64697
- padding: 0 12px;
64698
- `)]), c$1("*", `
64699
- box-sizing: border-box;
64700
- `), c$1(".u-list-item .u-list-item__text", `
64701
- grid-template-columns: 1fr !important;
64702
- `), c$1(".u-upload-file-list .u-upload-file.u-upload-file--text-type", `
64703
- margin-bottom: 0px;
64704
- `), c$1(".u-chat-main__message-bubble--own .u-upload-file", `
64705
- background-color: var(--u-attachment-background-color-own);
64706
- `), c$1(".u-chat-main__message-bubble--other .u-upload-file", `
64707
- background-color: var(--u-attachment-background-color-other);
64708
- `)]);
64709
-
64710
- const self$5 = vars => {
64711
- const {
64712
- borderRadiusLarge,
64713
- elementsQuaternary,
64714
- elementsTertiary,
64715
- textTertiary,
64716
- textPrimary,
64717
- textSecondary,
64718
- surfacePrimary,
64719
- brandPrimary500,
64720
- brandPrimary400,
64721
- transparencySecondary,
64722
- elementsSecondary,
64723
- elementsDarkQuinary,
64724
- staticRed,
64725
- staticWhite
64726
- } = vars;
64727
- return {
64728
- backgroundColor: surfacePrimary,
64729
- borderColor: elementsQuaternary,
64730
- sidebarBackgroundColor: surfacePrimary,
64731
- sidebarBorderColor: elementsQuaternary,
64732
- sidebarItemBackgroundColor: "transparent",
64733
- sidebarItemBackgroundColorHover: elementsTertiary,
64734
- sidebarItemBackgroundColorSelected: transparencySecondary,
64735
- sidebarItemTextColor: textPrimary,
64736
- sidebarItemTextColorSelected: brandPrimary500,
64737
- sidebarItemSubtitleColor: textSecondary,
64738
- sidebarItemTimeColor: elementsDarkQuinary,
64739
- mainBackgroundColor: surfacePrimary,
64740
- headerBackgroundColor: surfacePrimary,
64741
- headerBorderColor: elementsQuaternary,
64742
- headerTitleColor: textPrimary,
64743
- messageBubbleBackgroundColorOwn: elementsTertiary,
64744
- messageBubbleBackgroundColorOther: elementsTertiary,
64745
- messageBubbleTextColorOwn: textPrimary,
64746
- messageBubbleTextColorOther: textPrimary,
64747
- messageTimeColor: textTertiary,
64748
- messageStatusColor: textSecondary,
64749
- attachmentBackgroundColorOwn: staticWhite,
64750
- attachmentBackgroundColorOther: staticWhite,
64751
- footerBackgroundColor: surfacePrimary,
64752
- footerBorderColor: elementsQuaternary,
64753
- inputBackgroundColor: surfacePrimary,
64754
- inputBorderColor: elementsQuaternary,
64755
- unreadNotificationBackgroundColor: brandPrimary400,
64756
- unreadNotificationTextColor: elementsSecondary,
64757
- typingIndicatorColor: textSecondary,
64758
- dateSeparatorColor: textTertiary,
64759
- dateSeparatorBackgroundColor: elementsTertiary,
64760
- borderRadius: borderRadiusLarge,
64761
- errorColor: staticRed
64762
- };
64763
- };
64764
- const chatLight = createTheme$1({
64765
- name: "Chat",
64766
- common: derived,
64767
- peers: {
64768
- Input: inputLight,
64769
- Empty: emptyLight,
64770
- Select: selectLight,
64771
- Avatar: avatarLight,
64772
- Badge: badgeLight,
64773
- Button: buttonLight,
64774
- Icon: iconLight,
64775
- List: listLight,
64776
- Typography: typographyLight$1
64777
- },
64778
- self: self$5
64779
- });
64780
-
64781
- const chatDark = createTheme$1({
64782
- name: "Chat",
64783
- common: derived$1,
64784
- peers: {
64785
- Input: inputDark,
64786
- Empty: emptyDark$1,
64787
- Select: selectDark,
64788
- Avatar: avatarDark,
64789
- Badge: badgeDark,
64790
- Button: buttonDark,
64791
- Icon: iconDark$1,
64792
- List: listDark$1,
64793
- Typography: typographyDark
64794
- },
64795
- self: vars => {
64796
- const lightVars = self$5(vars);
64797
- return {
64798
- ...lightVars
64799
- };
65300
+ ), this.renderFooter());
64800
65301
  }
64801
65302
  });
64802
65303
 
@@ -64914,6 +65415,10 @@
64914
65415
  type: String,
64915
65416
  default: void 0
64916
65417
  },
65418
+ unreadNotificationText: {
65419
+ type: String,
65420
+ default: void 0
65421
+ },
64917
65422
  chatItemsLoading: {
64918
65423
  type: Boolean,
64919
65424
  default: false
@@ -64999,12 +65504,17 @@
64999
65504
  const themeRef = useTheme(
65000
65505
  "Chat",
65001
65506
  "-chat",
65002
- style$V,
65507
+ style$12,
65003
65508
  chatLight,
65004
65509
  props,
65005
65510
  mergedClsPrefixRef
65006
65511
  );
65007
65512
  const { localeRef } = useLocale("Chat");
65513
+ const notificationsShownSet = vue.ref(/* @__PURE__ */ new Set());
65514
+ const markNotificationShown = (chatId) => {
65515
+ notificationsShownSet.value.add(chatId);
65516
+ notificationsShownSet.value = new Set(notificationsShownSet.value);
65517
+ };
65008
65518
  const cssVarsRef = vue.computed(() => {
65009
65519
  const {
65010
65520
  common: { cubicBezierEaseInOut },
@@ -65112,10 +65622,37 @@
65112
65622
  }
65113
65623
  return [];
65114
65624
  });
65625
+ const lastUnreadCounts = vue.ref({});
65626
+ vue.watch(
65627
+ () => props.chatItems,
65628
+ (chatItems) => {
65629
+ if (!chatItems) return;
65630
+ chatItems.forEach((chatItem) => {
65631
+ const chatId = chatItem.id;
65632
+ const currentUnreadCount = chatItem.unreadCount || 0;
65633
+ const lastUnreadCount = lastUnreadCounts.value[chatId] || 0;
65634
+ if (currentUnreadCount > lastUnreadCount) {
65635
+ const newSet = new Set(notificationsShownSet.value);
65636
+ newSet.delete(chatId);
65637
+ notificationsShownSet.value = newSet;
65638
+ }
65639
+ lastUnreadCounts.value[chatId] = currentUnreadCount;
65640
+ });
65641
+ },
65642
+ { deep: true, immediate: true }
65643
+ );
65644
+ const unreadCountsBeforeRead = vue.ref({});
65115
65645
  const handleChatSelect = (chatId) => {
65646
+ const previousChatId = uncontrolledSelectedChatIdRef.value;
65647
+ if (previousChatId !== void 0 && previousChatId !== chatId) {
65648
+ emit("mark-messages-read", previousChatId);
65649
+ }
65650
+ const selectedItem = props.chatItems?.find((item) => item.id === chatId);
65651
+ const unreadCountBeforeRead = selectedItem?.unreadCount || 0;
65652
+ unreadCountsBeforeRead.value[chatId] = unreadCountBeforeRead;
65116
65653
  uncontrolledSelectedChatIdRef.value = chatId;
65117
65654
  emit("update:selectedChatId", chatId);
65118
- const selectedItem = props.chatItems?.find((item) => item.id === chatId);
65655
+ emit("mark-messages-read", chatId);
65119
65656
  if (selectedItem) {
65120
65657
  props.onChatSelect?.(chatId, selectedItem);
65121
65658
  }
@@ -65166,6 +65703,9 @@
65166
65703
  const mergedCloseButtonTextRef = vue.computed(
65167
65704
  () => props.closeButtonText ?? localeRef.value.closeButtonText
65168
65705
  );
65706
+ const mergedUnreadNotificationTextRef = vue.computed(
65707
+ () => props.unreadNotificationText ?? localeRef.value.unreadNotificationText
65708
+ );
65169
65709
  vue.provide(chatInjectionKey, {
65170
65710
  mergedClsPrefixRef,
65171
65711
  chatItemsRef: vue.toRef(props, "chatItems"),
@@ -65197,6 +65737,10 @@
65197
65737
  retryTextRef: mergedRetryTextRef,
65198
65738
  typingTextRef: mergedTypingTextRef,
65199
65739
  closeButtonTextRef: mergedCloseButtonTextRef,
65740
+ unreadNotificationTextRef: mergedUnreadNotificationTextRef,
65741
+ notificationsShownSetRef: notificationsShownSet,
65742
+ unreadCountsBeforeReadRef: unreadCountsBeforeRead,
65743
+ markNotificationShown,
65200
65744
  handleChatSelect,
65201
65745
  handleMessageSend,
65202
65746
  handleMessageRetry,
@@ -65233,16 +65777,18 @@
65233
65777
  ...this.cssVars
65234
65778
  }
65235
65779
  },
65236
- /* @__PURE__ */ vue.h(UFlex, { wrap: false, size: [20, 20], style: { width: "100%" } }, resolveSlot($slots.sidebar, () => [
65237
- /* @__PURE__ */ vue.h(ChatSidebar, null, {
65238
- sidebarHeaderMain: $slots.sidebarHeaderMain,
65239
- sidebarHeaderActions: $slots.sidebarHeaderActions
65240
- })
65241
- ]), resolveSlot($slots.default, () => [
65242
- /* @__PURE__ */ vue.h(ChatMainArea, null, {
65243
- headerActions: $slots.headerActions
65244
- })
65245
- ]))
65780
+ /* @__PURE__ */ vue.h(UFlex, { wrap: false, size: [20, 20], style: { width: "100%" } }, {
65781
+ default: () => /* @__PURE__ */ vue.h(vue.Fragment, null, resolveSlot($slots.sidebar, () => [
65782
+ /* @__PURE__ */ vue.h(ChatSidebar, null, {
65783
+ sidebarHeaderMain: $slots.sidebarHeaderMain,
65784
+ sidebarHeaderActions: $slots.sidebarHeaderActions
65785
+ })
65786
+ ]), resolveSlot($slots.default, () => [
65787
+ /* @__PURE__ */ vue.h(ChatMainArea, null, {
65788
+ headerActions: $slots.headerActions
65789
+ })
65790
+ ]))
65791
+ })
65246
65792
  );
65247
65793
  }
65248
65794
  });
@@ -74520,7 +75066,7 @@
74520
75066
  var root = freeGlobal || freeSelf || Function('return this')();
74521
75067
 
74522
75068
  /** Built-in value references. */
74523
- var Symbol = root.Symbol;
75069
+ var Symbol$1 = root.Symbol;
74524
75070
 
74525
75071
  /** Used for built-in method references. */
74526
75072
  var objectProto$s = Object.prototype;
@@ -74536,7 +75082,7 @@
74536
75082
  var nativeObjectToString$3 = objectProto$s.toString;
74537
75083
 
74538
75084
  /** Built-in value references. */
74539
- var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
75085
+ var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
74540
75086
 
74541
75087
  /**
74542
75088
  * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
@@ -74589,7 +75135,7 @@
74589
75135
  undefinedTag = '[object Undefined]';
74590
75136
 
74591
75137
  /** Built-in value references. */
74592
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
75138
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
74593
75139
 
74594
75140
  /**
74595
75141
  * The base implementation of `getTag` without fallbacks for buggy environments.
@@ -74726,7 +75272,7 @@
74726
75272
  var INFINITY$5 = 1 / 0;
74727
75273
 
74728
75274
  /** Used to convert symbols to primitives and strings. */
74729
- var symbolProto$2 = Symbol ? Symbol.prototype : undefined,
75275
+ var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : undefined,
74730
75276
  symbolToString = symbolProto$2 ? symbolProto$2.toString : undefined;
74731
75277
 
74732
75278
  /**
@@ -77986,7 +78532,7 @@
77986
78532
  }
77987
78533
 
77988
78534
  /** Built-in value references. */
77989
- var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
78535
+ var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : undefined;
77990
78536
 
77991
78537
  /**
77992
78538
  * Checks if `value` is a flattenable `arguments` object or array.
@@ -79678,7 +80224,7 @@
79678
80224
  }
79679
80225
 
79680
80226
  /** Used to convert symbols to primitives and strings. */
79681
- var symbolProto$1 = Symbol ? Symbol.prototype : undefined,
80227
+ var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined,
79682
80228
  symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined;
79683
80229
 
79684
80230
  /**
@@ -80411,7 +80957,7 @@
80411
80957
  dataViewTag = '[object DataView]';
80412
80958
 
80413
80959
  /** Used to convert symbols to primitives and strings. */
80414
- var symbolProto = Symbol ? Symbol.prototype : undefined,
80960
+ var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
80415
80961
  symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
80416
80962
 
80417
80963
  /**
@@ -86168,7 +86714,7 @@
86168
86714
  setTag$1 = '[object Set]';
86169
86715
 
86170
86716
  /** Built-in value references. */
86171
- var symIterator$1 = Symbol ? Symbol.iterator : undefined;
86717
+ var symIterator$1 = Symbol$1 ? Symbol$1.iterator : undefined;
86172
86718
 
86173
86719
  /**
86174
86720
  * Converts `value` to an array.
@@ -91773,7 +92319,7 @@
91773
92319
  var hasOwnProperty = objectProto.hasOwnProperty;
91774
92320
 
91775
92321
  /** Built-in value references. */
91776
- var symIterator = Symbol ? Symbol.iterator : undefined;
92322
+ var symIterator = Symbol$1 ? Symbol$1.iterator : undefined;
91777
92323
 
91778
92324
  /* Built-in method references for those with the same name as other `lodash` methods. */
91779
92325
  var nativeMax = Math.max,
@@ -128833,6 +129379,8 @@
128833
129379
  UCarouselItem: UCarouselItem,
128834
129380
  UCascader: Cascader,
128835
129381
  UChat: Chat,
129382
+ UChatListItems: UChatListItems,
129383
+ UChatMessages: UChatMessages,
128836
129384
  UCheckbox: UCheckbox,
128837
129385
  UCheckboxGroup: UCheckboxGroup,
128838
129386
  UCode: UCode,
@@ -129097,7 +129645,7 @@
129097
129645
  watermarkProps: watermarkProps
129098
129646
  });
129099
129647
 
129100
- var version = "1.7.2";
129648
+ var version = "1.8.0";
129101
129649
 
129102
129650
  function create({
129103
129651
  componentPrefix = "U",
@@ -129926,6 +130474,8 @@
129926
130474
  exports.UCarouselItem = UCarouselItem;
129927
130475
  exports.UCascader = Cascader;
129928
130476
  exports.UChat = Chat;
130477
+ exports.UChatListItems = UChatListItems;
130478
+ exports.UChatMessages = UChatMessages;
129929
130479
  exports.UCheckbox = UCheckbox;
129930
130480
  exports.UCheckboxGroup = UCheckboxGroup;
129931
130481
  exports.UCode = UCode;