chat4app-client-angular 0.0.35 → 0.0.36

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.
@@ -1,709 +1,2497 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('stompjs'), require('sockjs-client'), require('@angular/common/http')) :
3
- typeof define === 'function' && define.amd ? define('chat4app-client-angular', ['exports', '@angular/core', 'stompjs', 'sockjs-client', '@angular/common/http'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["chat4app-client-angular"] = {}, global.ng.core, global.Stomp, global.SockJS, global.ng.common.http));
5
- })(this, (function (exports, i0, Stomp, SockJS, i1) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http')) :
3
+ typeof define === 'function' && define.amd ? define('chat4app-client-angular', ['exports', '@angular/core', '@angular/common/http'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["chat4app-client-angular"] = {}, global.ng.core, global.ng.common.http));
5
+ })(this, (function (exports, i0, i1) { 'use strict';
6
6
 
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
20
18
  }
21
- n["default"] = e;
22
- return Object.freeze(n);
19
+ });
23
20
  }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
24
 
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
- var Stomp__namespace = /*#__PURE__*/_interopNamespace(Stomp);
27
- var SockJS__namespace = /*#__PURE__*/_interopNamespace(SockJS);
28
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
25
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
27
 
30
- var Chat4appClientAngularService = /** @class */ (function () {
31
- function Chat4appClientAngularService(http) {
32
- this.http = http;
33
- this.chatServer = "";
34
- this.chatUrl = "";
35
- this.debug = false;
36
- this.timeoutReconnect = 500;
37
- }
38
- Chat4appClientAngularService.prototype.ngOnInit = function () {
39
- };
40
- Chat4appClientAngularService.prototype.config = function (chat4AppConfig) {
41
- this.chatServer = chat4AppConfig.endpoint;
42
- this.chatUrl = chat4AppConfig.endpoint + "/api/v1/";
43
- this.debug = chat4AppConfig.debug;
44
- };
45
- Chat4appClientAngularService.prototype.init = function (securityChatToken, callback, chatCallback, connectionClientId) {
46
- if (!this.chatServer || this.chatServer.trim().length == 0) {
47
- throw new Error("Endpoint is empty");
48
- }
49
- if (!securityChatToken || securityChatToken.trim().length == 0) {
50
- throw new Error("SecurityChatToken is empty");
51
- }
52
- this.setTokenChat4app(securityChatToken);
53
- if (chatCallback && connectionClientId) {
54
- this.connectWebsocket(chatCallback, connectionClientId);
55
- }
56
- callback(securityChatToken);
57
- };
58
- Chat4appClientAngularService.prototype.getChatUrlDownload = function (messageFileId) {
59
- return this.chatUrl + "chatmessage/getFile?messageFileId=" + messageFileId + "&token=" + this.getBearerToken();
60
- };
61
- Chat4appClientAngularService.prototype.getMessageChat = function (chatId, fromId, toId) {
62
- var url = this.chatUrl + "chatmessage/" + chatId + "/" + fromId + "/" + toId;
63
- return this.http.get(url, {
64
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
65
- });
66
- };
67
- Chat4appClientAngularService.prototype.getMessageChatByGrop = function (chatId, groupId, fromId) {
68
- var url = this.chatUrl + "chatmessage/byGroup/" + chatId + "/" + groupId + "/" + fromId;
69
- return this.http.get(url, {
70
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
71
- });
72
- };
73
- Chat4appClientAngularService.prototype.addMessageChat = function (chatMessage4App) {
74
- var url = this.chatUrl + "chatmessage/" + chatMessage4App.chatId;
75
- return this.http.post(url, chatMessage4App, {
76
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
77
- });
78
- };
79
- Chat4appClientAngularService.prototype.props = function (chatFilterRequest4App) {
80
- var url = this.chatUrl + "chatmessage/props";
81
- return this.http.post(url, chatFilterRequest4App, {
82
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
83
- });
84
- };
85
- Chat4appClientAngularService.prototype.removeUsersChat = function (chatId, chatUsersId, chatUsersExternalId) {
86
- var params = new Array();
87
- if (chatUsersId && chatUsersId.length > 0) {
88
- chatUsersId.forEach(function (cui) {
89
- params.push("chatUserId=" + cui);
90
- });
91
- }
92
- else if (chatUsersExternalId && chatUsersExternalId.length > 0) {
93
- chatUsersExternalId.forEach(function (cuei) {
94
- params.push("chatUserExternalId=" + cuei);
95
- });
96
- }
97
- var url = this.chatUrl + "chatuser/" + chatId + "?" + params.join("&");
98
- return this.http.delete(url, {
99
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
100
- });
101
- };
102
- Chat4appClientAngularService.prototype.removeUserChat = function (chatId, chatUserId, chatUserExternalId) {
103
- var param = "";
104
- if (chatUserId) {
105
- param = "chatUserId=" + chatUserId;
106
- }
107
- else {
108
- param = "chatUserExternalId=" + chatUserExternalId;
109
- }
110
- var url = this.chatUrl + "chatuser/" + chatId + "?" + param;
111
- return this.http.delete(url, {
112
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
113
- });
114
- };
115
- Chat4appClientAngularService.prototype.updateUserChat = function (chatId, charUser4AppUpdate) {
116
- var url = this.chatUrl + "chatuser/" + chatId;
117
- return this.http.put(url, charUser4AppUpdate, {
118
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
119
- });
120
- };
121
- Chat4appClientAngularService.prototype.createUserChat = function (chatId, chatUser4App) {
122
- var url = this.chatUrl + "chatuser/" + chatId;
123
- return this.http.post(url, chatUser4App, {
124
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
125
- });
126
- };
127
- Chat4appClientAngularService.prototype.createUsersChat = function (chatId, chatUser4App) {
128
- var url = this.chatUrl + "chatuser/users/" + chatId;
129
- return this.http.post(url, chatUser4App, {
130
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
131
- });
132
- };
133
- Chat4appClientAngularService.prototype.createChat = function (chat4app) {
134
- var url = this.chatUrl + "chat";
135
- return this.http.post(url, chat4app, {
136
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
137
- });
138
- };
139
- Chat4appClientAngularService.prototype.createUpdateChat = function (chat4app) {
140
- var url = this.chatUrl + "chat";
141
- return this.http.put(url, chat4app, {
142
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
143
- });
144
- };
145
- Chat4appClientAngularService.prototype.getLastMessageGroup = function (chatExternalId, groupId) {
146
- var url = this.chatUrl + "chatmessage/lastMessageGroup?chatExternalId=" + chatExternalId + "&groupId=" + groupId;
147
- return this.http.get(url, {
148
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
149
- });
150
- };
151
- Chat4appClientAngularService.prototype.getLastMessage = function (chatExternalId, chatUserExternalId) {
152
- var url = this.chatUrl + "chatmessage/lastMessage?chatExternalId=" + chatExternalId + "&chatUserExternalId=" + chatUserExternalId;
153
- return this.http.get(url, {
154
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
155
- });
156
- };
157
- Chat4appClientAngularService.prototype.countNotReadMessages = function (chatUserExternalId, chatExternalId, groupId, fromId) {
158
- var url = this.chatUrl + "chatmessage/countNotReadMessages?chatUserExternalId=" + chatUserExternalId;
159
- if (chatExternalId && chatExternalId.length > 0) {
160
- url += "&chatExternalId=" + chatExternalId;
161
- }
162
- if (groupId && groupId.length > 0) {
163
- url += "&groupId=" + groupId;
164
- }
165
- if (fromId && fromId.length > 0) {
166
- url += "&fromId=" + groupId;
167
- }
168
- return this.http.get(url, {
169
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
170
- });
171
- };
172
- Chat4appClientAngularService.prototype.getChatByExternalId = function (externalId) {
173
- var url = this.chatUrl + "chat?externalId=" + externalId;
174
- return this.http.get(url, {
175
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
176
- });
177
- };
178
- Chat4appClientAngularService.prototype.getChatById = function (id) {
179
- var url = this.chatUrl + "chat?chatId=" + id;
180
- return this.http.get(url, {
181
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
182
- });
183
- };
184
- Chat4appClientAngularService.prototype.listChatByUser = function (externalUserId, userId, chatStatus) {
185
- var url = this.chatUrl + "chat/listChatByUser/?externalUserId=" + externalUserId
186
- + "&userId=" + userId
187
- + "&chatStatus=" + chatStatus;
188
- return this.http.get(url, {
189
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
190
- });
191
- };
192
- Chat4appClientAngularService.prototype.closeChat = function (chatId, chatExternalId) {
193
- var url = this.chatUrl;
194
- if (chatId && chatId.length > 0) {
195
- url += "chat?chatId=" + chatId;
196
- }
197
- if (chatExternalId && chatExternalId.length > 0) {
198
- url += "chat?externalId=" + chatExternalId;
199
- }
200
- return this.http.delete(url, {
201
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
202
- });
203
- };
204
- Chat4appClientAngularService.prototype.readMessage = function (chatMessageId, toId) {
205
- var url = this.chatUrl + "chatmessage/read/" + chatMessageId;
206
- if (toId && toId.length > 0) {
207
- url += "/" + toId;
208
- }
209
- return this.http.put(url, null, {
210
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
211
- });
212
- };
213
- Chat4appClientAngularService.prototype.online = function (chatId) {
214
- var url = this.chatUrl + "chatmessage/online/" + chatId;
215
- return this.http.get(url, {
216
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
217
- });
218
- };
219
- Chat4appClientAngularService.prototype.sendFile = function (chatId, fromId, toId, fileToUpload) {
220
- var endpoint = this.chatUrl + "chatmessage/sendFile/" + chatId + "/" + fromId + "/" + toId;
221
- var formData = new FormData();
222
- formData.append('file', fileToUpload);
223
- return this.http
224
- .post(endpoint, formData, {
225
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
226
- });
227
- };
228
- Chat4appClientAngularService.prototype.sendFileGroup = function (chatId, fromId, groupId, fileToUpload) {
229
- var endpoint = this.chatUrl + "chatmessage/sendFileGroup/" + chatId + "/" + fromId + "/" + groupId;
230
- var formData = new FormData();
231
- formData.append('file', fileToUpload);
232
- return this.http
233
- .post(endpoint, formData, {
234
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
235
- });
236
- };
237
- Chat4appClientAngularService.prototype.translateMessage = function (chatMessageId, languageTarget) {
238
- var url = this.chatUrl + "chatmessage/translate/" + chatMessageId + "/" + languageTarget;
239
- return this.http.get(url, {
240
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
241
- });
242
- };
243
- Chat4appClientAngularService.prototype.startTyping = function (chatId, fromId, toId) {
244
- var url = this.chatUrl + "chatmessage/startTyping/" + chatId + "/" + fromId + "/" + toId;
245
- return this.http.put(url, null, {
246
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
247
- });
248
- };
249
- Chat4appClientAngularService.prototype.startTypingGroup = function (chatId, fromId, groupId) {
250
- var url = this.chatUrl + "chatmessage/startTypingGroup/" + chatId + "/" + fromId + "/" + groupId;
251
- return this.http.put(url, null, {
252
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
253
- });
254
- };
255
- Chat4appClientAngularService.prototype.stopTyping = function (chatId, fromId, toId) {
256
- var url = this.chatUrl + "chatmessage/stopTyping/" + chatId + "/" + fromId + "/" + toId;
257
- return this.http.put(url, null, {
258
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
259
- });
260
- };
261
- Chat4appClientAngularService.prototype.stopTypingGroup = function (chatId, fromId, groupId) {
262
- var url = this.chatUrl + "chatmessage/stopTypingGroup/" + chatId + "/" + fromId + "/" + groupId;
263
- return this.http.put(url, null, {
264
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
265
- });
266
- };
267
- Chat4appClientAngularService.prototype.createGroup = function (group) {
268
- var url = this.chatUrl + "/group";
269
- return this.http.post(url, group, {
270
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
271
- });
272
- };
273
- Chat4appClientAngularService.prototype.getGroup = function (chatId, groupId) {
274
- var url = this.chatUrl + "/group/" + groupId + "/" + chatId;
275
- return this.http.get(url, {
276
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
277
- });
278
- };
279
- Chat4appClientAngularService.prototype.listGroups = function (chatId, externalId) {
280
- var url = this.chatUrl + "/group/";
281
- if (chatId && chatId.length > 0) {
282
- url += "&chatId=" + chatId;
283
- }
284
- if (externalId && externalId.length > 0) {
285
- url += "&externalId=" + externalId;
286
- }
287
- return this.http.get(url, {
288
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
289
- });
290
- };
291
- Chat4appClientAngularService.prototype.listFilesGroup = function (chatId, groupId) {
292
- var url = this.chatUrl + "/group/" + chatId;
293
- if (groupId && groupId.length > 0) {
294
- url += "&groupId=" + chatId;
295
- }
296
- return this.http.get(url, {
297
- headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
298
- });
299
- };
300
- /* Token */
301
- Chat4appClientAngularService.prototype.getBearerToken = function () {
302
- var ret = "Bearer " + window.sessionStorage.getItem("chat4AppSessionToken");
303
- return ret;
304
- };
305
- Chat4appClientAngularService.prototype.setTokenChat4app = function (chat4AppSessionToken) {
306
- window.sessionStorage.setItem("chat4AppSessionToken", chat4AppSessionToken);
307
- };
308
- /* Connection */
309
- Chat4appClientAngularService.prototype.onMessageFirebaseReceived = function (data, chatCallback) {
310
- //alert("onMessageReceived connectFirebase");
311
- if (data.type == "msg") {
312
- var chat4appMessage = new Chat4AppMessageReceive();
313
- chat4appMessage.data.chatId = data.chatId;
314
- chat4appMessage.data.chatMessageId = data.chatMessageId;
315
- chat4appMessage.data.externalId = data.externalId;
316
- chat4appMessage.data.fromId = data.fromId;
317
- chat4appMessage.data.toId = data.toId;
318
- chat4appMessage.data.groupId = data.groupId;
319
- chat4appMessage.data.dateHour = data.dateHour;
320
- chat4appMessage.data.type = data.type;
321
- chat4appMessage.notification.body = data.body;
322
- if (data.fileId && data.fileId.length > 0) {
323
- chat4appMessage.data.fileId = data.fileId;
324
- chat4appMessage.data.fileName = data.fileName;
325
- chat4appMessage.data.fileSize = data.fileSize;
326
- chat4appMessage.data.fileType = data.fileType;
327
- }
328
- var datTmp = new Map();
329
- for (var key in data) {
330
- datTmp.set(key, data[key]);
331
- }
332
- chat4appMessage.data.all = datTmp;
333
- chatCallback.onMessage(chat4appMessage);
334
- }
335
- else if ((data.type == "on" || data.type == "off")) {
336
- var chat4appMessage = new Chat4AppMessageReceive();
337
- chat4appMessage.data.chatId = data.chatId;
338
- chat4appMessage.data.chatMessageId = data.chatMessageId;
339
- chat4appMessage.data.externalId = data.externalId;
340
- chat4appMessage.data.fromId = data.fromId;
341
- chat4appMessage.data.toId = data.toId;
342
- chat4appMessage.data.groupId = data.groupId;
343
- chat4appMessage.data.dateHour = data.dateHour;
344
- chat4appMessage.data.type = data.type;
345
- var datTmp = new Map();
346
- for (var key in data) {
347
- datTmp.set(key, data[key]);
348
- }
349
- chat4appMessage.data.all = datTmp;
350
- chatCallback.onOffline(chat4appMessage);
351
- }
352
- else if (data.type == "read") {
353
- var chat4appMessage = new Chat4AppMessageReceive();
354
- chat4appMessage.data.chatId = data.chatId;
355
- chat4appMessage.data.chatMessageId = data.chatMessageId;
356
- chat4appMessage.data.externalId = data.externalId;
357
- chat4appMessage.data.fromId = data.fromId;
358
- chat4appMessage.data.toId = data.toId;
359
- chat4appMessage.data.groupId = data.groupId;
360
- chat4appMessage.data.dateHour = data.dateHour;
361
- chat4appMessage.data.type = data.type;
362
- var datTmp = new Map();
363
- for (var key in data) {
364
- datTmp.set(key, data[key]);
365
- }
366
- chat4appMessage.data.all = datTmp;
367
- chatCallback.onRead(chat4appMessage);
368
- }
369
- else if (data.type == "startTyping" || data.type == "stopTyping") {
370
- var chat4appMessage = new Chat4AppMessageReceive();
371
- chat4appMessage.data.chatId = data.chatId;
372
- chat4appMessage.data.chatMessageId = data.chatMessageId;
373
- chat4appMessage.data.externalId = data.externalId;
374
- chat4appMessage.data.fromId = data.fromId;
375
- chat4appMessage.data.toId = data.toId;
376
- chat4appMessage.data.groupId = data.groupId;
377
- chat4appMessage.data.dateHour = data.dateHour;
378
- chat4appMessage.data.type = data.type;
379
- var datTmp = new Map();
380
- for (var key in data) {
381
- datTmp.set(key, data[key]);
382
- }
383
- chat4appMessage.data.all = datTmp;
384
- chatCallback.onStartStopTyping(chat4appMessage);
385
- }
386
- else if (data.type == "new_user") {
387
- var chat4appMessage = new Chat4AppMessageReceive();
388
- chat4appMessage.data.chatId = data.chatId;
389
- chat4appMessage.data.chatMessageId = data.chatMessageId;
390
- chat4appMessage.data.externalId = data.externalId;
391
- chat4appMessage.data.fromId = data.fromId;
392
- chat4appMessage.data.toId = data.toId;
393
- chat4appMessage.data.groupId = data.groupId;
394
- chat4appMessage.data.dateHour = data.dateHour;
395
- chat4appMessage.data.type = data.type;
396
- var datTmp = new Map();
397
- for (var key in data) {
398
- datTmp.set(key, data[key]);
399
- }
400
- chat4appMessage.data.all = datTmp;
401
- chatCallback.onNewUser(chat4appMessage);
402
- }
403
- else if (data.type == "remove_user") {
404
- var chat4appMessage = new Chat4AppMessageReceive();
405
- chat4appMessage.data.chatId = data.chatId;
406
- chat4appMessage.data.chatMessageId = data.chatMessageId;
407
- chat4appMessage.data.externalId = data.externalId;
408
- chat4appMessage.data.fromId = data.fromId;
409
- chat4appMessage.data.toId = data.toId;
410
- chat4appMessage.data.groupId = data.groupId;
411
- chat4appMessage.data.dateHour = data.dateHour;
412
- chat4appMessage.data.type = data.type;
413
- var datTmp = new Map();
414
- for (var key in data) {
415
- datTmp.set(key, data[key]);
416
- }
417
- chat4appMessage.data.all = datTmp;
418
- chatCallback.onRemoveUser(chat4appMessage);
419
- }
420
- else if (data.type == "chat_closed") {
421
- var chat4appMessage = new Chat4AppMessageReceive();
422
- chat4appMessage.data.chatId = data.chatId;
423
- chat4appMessage.data.chatMessageId = data.chatMessageId;
424
- chat4appMessage.data.externalId = data.externalId;
425
- chat4appMessage.data.fromId = data.fromId;
426
- chat4appMessage.data.toId = data.toId;
427
- chat4appMessage.data.groupId = data.groupId;
428
- chat4appMessage.data.dateHour = data.dateHour;
429
- chat4appMessage.data.type = data.type;
430
- var datTmp = new Map();
431
- for (var key in data) {
432
- datTmp.set(key, data[key]);
433
- }
434
- chat4appMessage.data.all = datTmp;
435
- chatCallback.onChatClosed(chat4appMessage);
436
- }
437
- };
438
- Chat4appClientAngularService.prototype.connectWebsocket = function (chatCallback, token) {
439
- var _this = this;
440
- this.disconnect();
441
- var securityToken = this.getBearerToken();
442
- this.sock = new SockJS__namespace(this.chatServer + '/stomp/gkz-stomp-endpoint?token=' + securityToken);
443
- this.stompClient = Stomp__namespace.over(this.sock);
444
- var that = this;
445
- this.stompClient.debug = function (msg) {
446
- if (this.debug) {
447
- console.log(msg);
448
- }
449
- };
450
- var tokenAuth = "";
451
- if (securityToken && securityToken.startsWith("Bearer ")) {
452
- tokenAuth = securityToken;
453
- }
454
- else {
455
- tokenAuth = "Bearer " + securityToken;
456
- }
457
- this.stompClient.connect({ "X-Authorization": tokenAuth }, function (frame) {
458
- //console.log(frame);
459
- that.timeoutReconnect = 500;
460
- _this.stompClient.subscribe('/queue/' + token, function (msg) {
461
- //console.log('mensagem', msg);
462
- if (msg.command == "MESSAGE") {
463
- //console.log(msg)
464
- if (!chatCallback.isTokenFirebaseActive()) {
465
- var msgObj = JSON.parse(msg.body);
466
- var datTmp = new Map();
467
- for (var key in msgObj.data) {
468
- datTmp.set(key, msgObj.data[key]);
469
- }
470
- msgObj.data.all = datTmp;
471
- if (msgObj.data.type == "msg") {
472
- chatCallback.onMessage(msgObj);
473
- }
474
- else if ((msgObj.data.type == "on" || msgObj.data.type == "off")) {
475
- chatCallback.onOffline(msgObj);
476
- }
477
- else if (msgObj.data.type == "read") {
478
- chatCallback.onRead(msgObj);
479
- }
480
- else if (msgObj.data.type == "startTyping" || msgObj.data.type == "stopTyping") {
481
- chatCallback.onStartStopTyping(msgObj);
482
- }
483
- else if (msgObj.data.type == "new_user") {
484
- chatCallback.onNewUser(msgObj);
485
- }
486
- else if (msgObj.data.type == "remove_user") {
487
- chatCallback.onRemoveUser(msgObj);
488
- }
489
- else if (msgObj.data.type == "chat_closed") {
490
- chatCallback.onChatClosed(msgObj);
491
- }
492
- }
493
- //callback(msg.body);
494
- // ichatcallback.forEach((iChat)=>{
495
- // iChat.onMessage(JSON.parse(msg.body) );
496
- // });
497
- }
498
- });
499
- }, function (message) {
500
- // check message for disconnect
501
- //console.log("Disconnect");
502
- setTimeout(function () {
503
- that.timeoutReconnect *= 100;
504
- _this.connectWebsocket(chatCallback, token);
505
- }, that.timeoutReconnect);
506
- });
507
- };
508
- Chat4appClientAngularService.prototype.disconnect = function () {
509
- // console.log("disconnect")
510
- try {
511
- if (this.stompClient) {
512
- this.stompClient.disconnect();
513
- }
514
- }
515
- catch (e) {
516
- console.log(e);
517
- }
518
- };
519
- Chat4appClientAngularService.prototype.convertChat4AppMessageReceiveToChatMessage4App = function (msg) {
520
- var _a;
521
- var message = new ChatMessage4App();
522
- message.body = (_a = msg === null || msg === void 0 ? void 0 : msg.notification) === null || _a === void 0 ? void 0 : _a.body;
523
- message.chatId = msg.data.chatId;
524
- message.fromId = msg.data.fromId;
525
- message.toId = msg.data.toId;
526
- message.groupId = msg.data.groupId;
527
- message.replyFrom = msg.data.replyFrom;
528
- if (msg.data.dateHour && msg.data.dateHour.length > 0) {
529
- message.dateHourIncluded = msg.data.dateHour.substring(6, 10) + "-"
530
- + msg.data.dateHour.substring(3, 5) + "-"
531
- + msg.data.dateHour.substring(0, 2)
532
- + msg.data.dateHour.substring(10);
533
- }
534
- message.id = msg.data.chatMessageId;
535
- if (msg.data.fileId && msg.data.fileId.length > 0) {
536
- var messageFile = new ChatMessageFile4App();
537
- messageFile.id = msg.data.fileId;
538
- messageFile.name = msg.data.fileName;
539
- messageFile.size = msg.data.fileSize;
540
- messageFile.type = msg.data.fileType;
541
- message.chatMessageFile = messageFile;
542
- }
543
- if (msg.data.vFileId && msg.data.vFileId.length > 0) {
544
- var messageFile = new ChatMessageFile4App();
545
- messageFile.id = msg.data.vFileId;
546
- messageFile.name = msg.data.vFileName;
547
- messageFile.size = msg.data.vFileSize;
548
- messageFile.type = msg.data.vFileType;
549
- message.chatVoiceFile = messageFile;
550
- }
551
- return message;
552
- };
553
- return Chat4appClientAngularService;
554
- }());
555
- Chat4appClientAngularService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function Chat4appClientAngularService_Factory() { return new Chat4appClientAngularService(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); }, token: Chat4appClientAngularService, providedIn: "root" });
556
- Chat4appClientAngularService.decorators = [
557
- { type: i0.Injectable, args: [{
558
- providedIn: 'root'
559
- },] }
560
- ];
561
- Chat4appClientAngularService.ctorParameters = function () { return [
562
- { type: i1.HttpClient }
563
- ]; };
564
- var Chat4App = /** @class */ (function () {
565
- function Chat4App() {
566
- }
567
- return Chat4App;
568
- }());
569
- var ChatUser4App = /** @class */ (function () {
570
- function ChatUser4App() {
571
- }
572
- return ChatUser4App;
573
- }());
574
- var ChatMessage4App = /** @class */ (function () {
575
- function ChatMessage4App() {
576
- }
577
- return ChatMessage4App;
578
- }());
579
- var ChatMessageFile4App = /** @class */ (function () {
580
- function ChatMessageFile4App() {
581
- }
582
- return ChatMessageFile4App;
583
- }());
584
- var ChatMessageMeta4App = /** @class */ (function () {
585
- function ChatMessageMeta4App() {
586
- }
587
- return ChatMessageMeta4App;
588
- }());
589
- var Chat4AppMessageReceive = /** @class */ (function () {
590
- function Chat4AppMessageReceive() {
591
- this.data = new Chat4AppMessageReceiveData();
592
- this.notification = new Chat4AppMessageReceiveNotification();
593
- }
594
- return Chat4AppMessageReceive;
595
- }());
596
- var Chat4AppMessageReceiveData = /** @class */ (function () {
597
- function Chat4AppMessageReceiveData() {
598
- }
599
- return Chat4AppMessageReceiveData;
600
- }());
601
- var Chat4AppMessageReceiveNotification = /** @class */ (function () {
602
- function Chat4AppMessageReceiveNotification() {
603
- }
604
- return Chat4AppMessageReceiveNotification;
605
- }());
606
- var ChatUserResponse4App = /** @class */ (function () {
607
- function ChatUserResponse4App() {
608
- }
609
- return ChatUserResponse4App;
610
- }());
611
- var ChatFilterRequest4App = /** @class */ (function () {
612
- function ChatFilterRequest4App() {
613
- }
614
- return ChatFilterRequest4App;
615
- }());
616
- var Chat4AppConfig = /** @class */ (function () {
617
- function Chat4AppConfig(endpoint, debug) {
618
- this.endpoint = endpoint;
619
- this.debug = debug;
620
- }
621
- return Chat4AppConfig;
622
- }());
623
- var Chat4AppTranslate = /** @class */ (function () {
624
- function Chat4AppTranslate() {
625
- }
626
- return Chat4AppTranslate;
627
- }());
628
- var ChatGroupApp = /** @class */ (function () {
629
- function ChatGroupApp() {
630
- }
631
- return ChatGroupApp;
632
- }());
633
- exports.ChatStatus4App = void 0;
634
- (function (ChatStatus4App) {
635
- ChatStatus4App["CREATED"] = "CREATED";
636
- ChatStatus4App["CLOSED"] = "CLOSED";
637
- })(exports.ChatStatus4App || (exports.ChatStatus4App = {}));
638
- exports.ChatUserStatus4App = void 0;
639
- (function (ChatUserStatus4App) {
640
- ChatUserStatus4App["REMOVED"] = "REMOVED";
641
- })(exports.ChatUserStatus4App || (exports.ChatUserStatus4App = {}));
642
- exports.ChatFilterType = void 0;
643
- (function (ChatFilterType) {
644
- ChatFilterType[ChatFilterType["COUNT_NOT_READ"] = 1] = "COUNT_NOT_READ";
645
- ChatFilterType[ChatFilterType["LAST_MESSAGE"] = 2] = "LAST_MESSAGE";
646
- })(exports.ChatFilterType || (exports.ChatFilterType = {}));
647
- exports.GroupStatus4App = void 0;
648
- (function (GroupStatus4App) {
649
- GroupStatus4App["CREATED"] = "CREATED";
650
- GroupStatus4App["CLOSED"] = "REMOVED";
651
- })(exports.GroupStatus4App || (exports.GroupStatus4App = {}));
28
+ /******************************************************************************
29
+ Copyright (c) Microsoft Corporation.
30
+
31
+ Permission to use, copy, modify, and/or distribute this software for any
32
+ purpose with or without fee is hereby granted.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
35
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
37
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
38
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
39
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
40
+ PERFORMANCE OF THIS SOFTWARE.
41
+ ***************************************************************************** */
42
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
43
+ var extendStatics = function (d, b) {
44
+ extendStatics = Object.setPrototypeOf ||
45
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
46
+ function (d, b) { for (var p in b)
47
+ if (Object.prototype.hasOwnProperty.call(b, p))
48
+ d[p] = b[p]; };
49
+ return extendStatics(d, b);
50
+ };
51
+ function __extends(d, b) {
52
+ if (typeof b !== "function" && b !== null)
53
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
54
+ extendStatics(d, b);
55
+ function __() { this.constructor = d; }
56
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
57
+ }
58
+ var __assign = function () {
59
+ __assign = Object.assign || function __assign(t) {
60
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
61
+ s = arguments[i];
62
+ for (var p in s)
63
+ if (Object.prototype.hasOwnProperty.call(s, p))
64
+ t[p] = s[p];
65
+ }
66
+ return t;
67
+ };
68
+ return __assign.apply(this, arguments);
69
+ };
70
+ function __rest(s, e) {
71
+ var t = {};
72
+ for (var p in s)
73
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
74
+ t[p] = s[p];
75
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
76
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
77
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
78
+ t[p[i]] = s[p[i]];
79
+ }
80
+ return t;
81
+ }
82
+ function __decorate(decorators, target, key, desc) {
83
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
84
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
85
+ r = Reflect.decorate(decorators, target, key, desc);
86
+ else
87
+ for (var i = decorators.length - 1; i >= 0; i--)
88
+ if (d = decorators[i])
89
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
90
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
91
+ }
92
+ function __param(paramIndex, decorator) {
93
+ return function (target, key) { decorator(target, key, paramIndex); };
94
+ }
95
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
96
+ function accept(f) { if (f !== void 0 && typeof f !== "function")
97
+ throw new TypeError("Function expected"); return f; }
98
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
99
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
100
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
101
+ var _, done = false;
102
+ for (var i = decorators.length - 1; i >= 0; i--) {
103
+ var context = {};
104
+ for (var p in contextIn)
105
+ context[p] = p === "access" ? {} : contextIn[p];
106
+ for (var p in contextIn.access)
107
+ context.access[p] = contextIn.access[p];
108
+ context.addInitializer = function (f) { if (done)
109
+ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
110
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
111
+ if (kind === "accessor") {
112
+ if (result === void 0)
113
+ continue;
114
+ if (result === null || typeof result !== "object")
115
+ throw new TypeError("Object expected");
116
+ if (_ = accept(result.get))
117
+ descriptor.get = _;
118
+ if (_ = accept(result.set))
119
+ descriptor.set = _;
120
+ if (_ = accept(result.init))
121
+ initializers.unshift(_);
122
+ }
123
+ else if (_ = accept(result)) {
124
+ if (kind === "field")
125
+ initializers.unshift(_);
126
+ else
127
+ descriptor[key] = _;
128
+ }
129
+ }
130
+ if (target)
131
+ Object.defineProperty(target, contextIn.name, descriptor);
132
+ done = true;
133
+ }
134
+ ;
135
+ function __runInitializers(thisArg, initializers, value) {
136
+ var useValue = arguments.length > 2;
137
+ for (var i = 0; i < initializers.length; i++) {
138
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
139
+ }
140
+ return useValue ? value : void 0;
141
+ }
142
+ ;
143
+ function __propKey(x) {
144
+ return typeof x === "symbol" ? x : "".concat(x);
145
+ }
146
+ ;
147
+ function __setFunctionName(f, name, prefix) {
148
+ if (typeof name === "symbol")
149
+ name = name.description ? "[".concat(name.description, "]") : "";
150
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
151
+ }
152
+ ;
153
+ function __metadata(metadataKey, metadataValue) {
154
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
155
+ return Reflect.metadata(metadataKey, metadataValue);
156
+ }
157
+ function __awaiter(thisArg, _arguments, P, generator) {
158
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
159
+ return new (P || (P = Promise))(function (resolve, reject) {
160
+ function fulfilled(value) { try {
161
+ step(generator.next(value));
162
+ }
163
+ catch (e) {
164
+ reject(e);
165
+ } }
166
+ function rejected(value) { try {
167
+ step(generator["throw"](value));
168
+ }
169
+ catch (e) {
170
+ reject(e);
171
+ } }
172
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
173
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
174
+ });
175
+ }
176
+ function __generator(thisArg, body) {
177
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
178
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
179
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
180
+ function verb(n) { return function (v) { return step([n, v]); }; }
181
+ function step(op) {
182
+ if (f)
183
+ throw new TypeError("Generator is already executing.");
184
+ while (g && (g = 0, op[0] && (_ = 0)), _)
185
+ try {
186
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
187
+ return t;
188
+ if (y = 0, t)
189
+ op = [op[0] & 2, t.value];
190
+ switch (op[0]) {
191
+ case 0:
192
+ case 1:
193
+ t = op;
194
+ break;
195
+ case 4:
196
+ _.label++;
197
+ return { value: op[1], done: false };
198
+ case 5:
199
+ _.label++;
200
+ y = op[1];
201
+ op = [0];
202
+ continue;
203
+ case 7:
204
+ op = _.ops.pop();
205
+ _.trys.pop();
206
+ continue;
207
+ default:
208
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
209
+ _ = 0;
210
+ continue;
211
+ }
212
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
213
+ _.label = op[1];
214
+ break;
215
+ }
216
+ if (op[0] === 6 && _.label < t[1]) {
217
+ _.label = t[1];
218
+ t = op;
219
+ break;
220
+ }
221
+ if (t && _.label < t[2]) {
222
+ _.label = t[2];
223
+ _.ops.push(op);
224
+ break;
225
+ }
226
+ if (t[2])
227
+ _.ops.pop();
228
+ _.trys.pop();
229
+ continue;
230
+ }
231
+ op = body.call(thisArg, _);
232
+ }
233
+ catch (e) {
234
+ op = [6, e];
235
+ y = 0;
236
+ }
237
+ finally {
238
+ f = t = 0;
239
+ }
240
+ if (op[0] & 5)
241
+ throw op[1];
242
+ return { value: op[0] ? op[1] : void 0, done: true };
243
+ }
244
+ }
245
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
246
+ if (k2 === undefined)
247
+ k2 = k;
248
+ var desc = Object.getOwnPropertyDescriptor(m, k);
249
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
250
+ desc = { enumerable: true, get: function () { return m[k]; } };
251
+ }
252
+ Object.defineProperty(o, k2, desc);
253
+ }) : (function (o, m, k, k2) {
254
+ if (k2 === undefined)
255
+ k2 = k;
256
+ o[k2] = m[k];
257
+ });
258
+ function __exportStar(m, o) {
259
+ for (var p in m)
260
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
261
+ __createBinding(o, m, p);
262
+ }
263
+ function __values(o) {
264
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
265
+ if (m)
266
+ return m.call(o);
267
+ if (o && typeof o.length === "number")
268
+ return {
269
+ next: function () {
270
+ if (o && i >= o.length)
271
+ o = void 0;
272
+ return { value: o && o[i++], done: !o };
273
+ }
274
+ };
275
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
276
+ }
277
+ function __read(o, n) {
278
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
279
+ if (!m)
280
+ return o;
281
+ var i = m.call(o), r, ar = [], e;
282
+ try {
283
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
284
+ ar.push(r.value);
285
+ }
286
+ catch (error) {
287
+ e = { error: error };
288
+ }
289
+ finally {
290
+ try {
291
+ if (r && !r.done && (m = i["return"]))
292
+ m.call(i);
293
+ }
294
+ finally {
295
+ if (e)
296
+ throw e.error;
297
+ }
298
+ }
299
+ return ar;
300
+ }
301
+ /** @deprecated */
302
+ function __spread() {
303
+ for (var ar = [], i = 0; i < arguments.length; i++)
304
+ ar = ar.concat(__read(arguments[i]));
305
+ return ar;
306
+ }
307
+ /** @deprecated */
308
+ function __spreadArrays() {
309
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
310
+ s += arguments[i].length;
311
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
312
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
313
+ r[k] = a[j];
314
+ return r;
315
+ }
316
+ function __spreadArray(to, from, pack) {
317
+ if (pack || arguments.length === 2)
318
+ for (var i = 0, l = from.length, ar; i < l; i++) {
319
+ if (ar || !(i in from)) {
320
+ if (!ar)
321
+ ar = Array.prototype.slice.call(from, 0, i);
322
+ ar[i] = from[i];
323
+ }
324
+ }
325
+ return to.concat(ar || Array.prototype.slice.call(from));
326
+ }
327
+ function __await(v) {
328
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
329
+ }
330
+ function __asyncGenerator(thisArg, _arguments, generator) {
331
+ if (!Symbol.asyncIterator)
332
+ throw new TypeError("Symbol.asyncIterator is not defined.");
333
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
334
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
335
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
336
+ function verb(n, f) { if (g[n]) {
337
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
338
+ if (f)
339
+ i[n] = f(i[n]);
340
+ } }
341
+ function resume(n, v) { try {
342
+ step(g[n](v));
343
+ }
344
+ catch (e) {
345
+ settle(q[0][3], e);
346
+ } }
347
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
348
+ function fulfill(value) { resume("next", value); }
349
+ function reject(value) { resume("throw", value); }
350
+ function settle(f, v) { if (f(v), q.shift(), q.length)
351
+ resume(q[0][0], q[0][1]); }
352
+ }
353
+ function __asyncDelegator(o) {
354
+ var i, p;
355
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
356
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
357
+ }
358
+ function __asyncValues(o) {
359
+ if (!Symbol.asyncIterator)
360
+ throw new TypeError("Symbol.asyncIterator is not defined.");
361
+ var m = o[Symbol.asyncIterator], i;
362
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
363
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
364
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
365
+ }
366
+ function __makeTemplateObject(cooked, raw) {
367
+ if (Object.defineProperty) {
368
+ Object.defineProperty(cooked, "raw", { value: raw });
369
+ }
370
+ else {
371
+ cooked.raw = raw;
372
+ }
373
+ return cooked;
374
+ }
375
+ ;
376
+ var __setModuleDefault = Object.create ? (function (o, v) {
377
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
378
+ }) : function (o, v) {
379
+ o["default"] = v;
380
+ };
381
+ var ownKeys = function (o) {
382
+ ownKeys = Object.getOwnPropertyNames || function (o) {
383
+ var ar = [];
384
+ for (var k in o)
385
+ if (Object.prototype.hasOwnProperty.call(o, k))
386
+ ar[ar.length] = k;
387
+ return ar;
388
+ };
389
+ return ownKeys(o);
390
+ };
391
+ function __importStar(mod) {
392
+ if (mod && mod.__esModule)
393
+ return mod;
394
+ var result = {};
395
+ if (mod != null)
396
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
397
+ if (k[i] !== "default")
398
+ __createBinding(result, mod, k[i]);
399
+ __setModuleDefault(result, mod);
400
+ return result;
401
+ }
402
+ function __importDefault(mod) {
403
+ return (mod && mod.__esModule) ? mod : { default: mod };
404
+ }
405
+ function __classPrivateFieldGet(receiver, state, kind, f) {
406
+ if (kind === "a" && !f)
407
+ throw new TypeError("Private accessor was defined without a getter");
408
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
409
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
410
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
411
+ }
412
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
413
+ if (kind === "m")
414
+ throw new TypeError("Private method is not writable");
415
+ if (kind === "a" && !f)
416
+ throw new TypeError("Private accessor was defined without a setter");
417
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
418
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
419
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
420
+ }
421
+ function __classPrivateFieldIn(state, receiver) {
422
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
423
+ throw new TypeError("Cannot use 'in' operator on non-object");
424
+ return typeof state === "function" ? receiver === state : state.has(receiver);
425
+ }
426
+ function __addDisposableResource(env, value, async) {
427
+ if (value !== null && value !== void 0) {
428
+ if (typeof value !== "object" && typeof value !== "function")
429
+ throw new TypeError("Object expected.");
430
+ var dispose, inner;
431
+ if (async) {
432
+ if (!Symbol.asyncDispose)
433
+ throw new TypeError("Symbol.asyncDispose is not defined.");
434
+ dispose = value[Symbol.asyncDispose];
435
+ }
436
+ if (dispose === void 0) {
437
+ if (!Symbol.dispose)
438
+ throw new TypeError("Symbol.dispose is not defined.");
439
+ dispose = value[Symbol.dispose];
440
+ if (async)
441
+ inner = dispose;
442
+ }
443
+ if (typeof dispose !== "function")
444
+ throw new TypeError("Object not disposable.");
445
+ if (inner)
446
+ dispose = function () { try {
447
+ inner.call(this);
448
+ }
449
+ catch (e) {
450
+ return Promise.reject(e);
451
+ } };
452
+ env.stack.push({ value: value, dispose: dispose, async: async });
453
+ }
454
+ else if (async) {
455
+ env.stack.push({ async: true });
456
+ }
457
+ return value;
458
+ }
459
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
460
+ var e = new Error(message);
461
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
462
+ };
463
+ function __disposeResources(env) {
464
+ function fail(e) {
465
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
466
+ env.hasError = true;
467
+ }
468
+ var r, s = 0;
469
+ function next() {
470
+ while (r = env.stack.pop()) {
471
+ try {
472
+ if (!r.async && s === 1)
473
+ return s = 0, env.stack.push(r), Promise.resolve().then(next);
474
+ if (r.dispose) {
475
+ var result = r.dispose.call(r.value);
476
+ if (r.async)
477
+ return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
478
+ }
479
+ else
480
+ s |= 1;
481
+ }
482
+ catch (e) {
483
+ fail(e);
484
+ }
485
+ }
486
+ if (s === 1)
487
+ return env.hasError ? Promise.reject(env.error) : Promise.resolve();
488
+ if (env.hasError)
489
+ throw env.error;
490
+ }
491
+ return next();
492
+ }
493
+ function __rewriteRelativeImportExtension(path, preserveJsx) {
494
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
495
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
496
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
497
+ });
498
+ }
499
+ return path;
500
+ }
501
+ var tslib_es6 = {
502
+ __extends: __extends,
503
+ __assign: __assign,
504
+ __rest: __rest,
505
+ __decorate: __decorate,
506
+ __param: __param,
507
+ __esDecorate: __esDecorate,
508
+ __runInitializers: __runInitializers,
509
+ __propKey: __propKey,
510
+ __setFunctionName: __setFunctionName,
511
+ __metadata: __metadata,
512
+ __awaiter: __awaiter,
513
+ __generator: __generator,
514
+ __createBinding: __createBinding,
515
+ __exportStar: __exportStar,
516
+ __values: __values,
517
+ __read: __read,
518
+ __spread: __spread,
519
+ __spreadArrays: __spreadArrays,
520
+ __spreadArray: __spreadArray,
521
+ __await: __await,
522
+ __asyncGenerator: __asyncGenerator,
523
+ __asyncDelegator: __asyncDelegator,
524
+ __asyncValues: __asyncValues,
525
+ __makeTemplateObject: __makeTemplateObject,
526
+ __importStar: __importStar,
527
+ __importDefault: __importDefault,
528
+ __classPrivateFieldGet: __classPrivateFieldGet,
529
+ __classPrivateFieldSet: __classPrivateFieldSet,
530
+ __classPrivateFieldIn: __classPrivateFieldIn,
531
+ __addDisposableResource: __addDisposableResource,
532
+ __disposeResources: __disposeResources,
533
+ __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
534
+ };
652
535
 
653
- var Chat4appClientAngularComponent = /** @class */ (function () {
654
- function Chat4appClientAngularComponent() {
655
- }
656
- Chat4appClientAngularComponent.prototype.ngOnInit = function () {
657
- };
658
- return Chat4appClientAngularComponent;
659
- }());
660
- Chat4appClientAngularComponent.decorators = [
661
- { type: i0.Component, args: [{
662
- selector: 'lib-chat4app-client-angular',
663
- template: "\n <p>\n chat4app-client-angular works!\n </p>\n "
664
- },] }
665
- ];
666
- Chat4appClientAngularComponent.ctorParameters = function () { return []; };
536
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
537
+ function getDefaultExportFromCjs(x) {
538
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
539
+ }
540
+ function getDefaultExportFromNamespaceIfPresent(n) {
541
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
542
+ }
543
+ function getDefaultExportFromNamespaceIfNotNamed(n) {
544
+ return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
545
+ }
546
+ function getAugmentedNamespace(n) {
547
+ if (n.__esModule)
548
+ return n;
549
+ var a = Object.defineProperty({}, '__esModule', { value: true });
550
+ Object.keys(n).forEach(function (k) {
551
+ var d = Object.getOwnPropertyDescriptor(n, k);
552
+ Object.defineProperty(a, k, d.get ? d : {
553
+ enumerable: true,
554
+ get: function () {
555
+ return n[k];
556
+ }
557
+ });
558
+ });
559
+ return a;
560
+ }
561
+ function createCommonjsModule(fn) {
562
+ var module = { exports: {} };
563
+ return fn(module, module.exports), module.exports;
564
+ }
565
+ function commonjsRequire(target) {
566
+ throw new Error('Could not dynamically require "' + target + '". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.');
567
+ }
568
+
569
+ var nats_min = createCommonjsModule(function (module, exports) {
570
+ !function (t, e) { "object" == 'object' && "object" == 'object' ? module.exports = e() : "function" == typeof undefined && undefined.amd ? undefined([], e) : "object" == 'object' ? exports.nats = e() : t.nats = e(); }(commonjsGlobal, (function () {
571
+ return function (t) {
572
+ var e = {};
573
+ function r(n) {
574
+ if (e[n])
575
+ return e[n].exports;
576
+ var i = e[n] = { i: n, l: !1, exports: {} };
577
+ return t[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports;
578
+ }
579
+ return r.m = t, r.c = e, r.d = function (t, e, n) { r.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: n }); }, r.r = function (t) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "__esModule", { value: !0 }); }, r.t = function (t, e) {
580
+ if (1 & e && (t = r(t)), 8 & e)
581
+ return t;
582
+ if (4 & e && "object" == typeof t && t && t.__esModule)
583
+ return t;
584
+ var n = Object.create(null);
585
+ if (r.r(n), Object.defineProperty(n, "default", { enumerable: !0, value: t }), 2 & e && "string" != typeof t)
586
+ for (var i in t)
587
+ r.d(n, i, function (e) { return t[e]; }.bind(null, i));
588
+ return n;
589
+ }, r.n = function (t) { var e = t && t.__esModule ? function () { return t.default; } : function () { return t; }; return r.d(e, "a", e), e; }, r.o = function (t, e) { return Object.prototype.hasOwnProperty.call(t, e); }, r.p = "", r(r.s = 12);
590
+ }([function (t, e, r) {
591
+ "use strict";
592
+ var n;
593
+ r.d(e, "a", (function () { return n; })), r.d(e, "b", (function () { return i; })), r.d(e, "c", (function () { return s; })), function (t) { t.BAD_AUTHENTICATION = "BAD_AUTHENTICATION", t.BAD_SUBJECT = "BAD_SUBJECT", t.CONNECTION_CLOSED = "CONNECTION_CLOSED", t.CONNECTION_DRAINING = "CONNECTION_DRAINING", t.CONNECTION_REFUSED = "CONNECTION_REFUSED", t.CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT", t.INVALID_PAYLOAD_TYPE = "INVALID_PAYLOAD", t.UNKNOWN = "UNKNOWN_ERROR", t.WSS_REQUIRED = "WSS_REQUIRED", t.SUB_CLOSED = "SUB_CLOSED", t.SUB_DRAINING = "SUB_DRAINING", t.PERMISSIONS_VIOLATION = "PERMISSIONS_VIOLATION", t.AUTHORIZATION_VIOLATION = "AUTHORIZATION_VIOLATION", t.NATS_PROTOCOL_ERR = "NATS_PROTOCOL_ERR"; }(n || (n = {}));
594
+ var i = /** @class */ (function () {
595
+ function i() {
596
+ this.messages = {}, this.messages[n.BAD_AUTHENTICATION] = "User and Token can not both be provided", this.messages[n.BAD_SUBJECT] = "Subject must be supplied", this.messages[n.CONNECTION_CLOSED] = "Connection closed", this.messages[n.CONNECTION_CLOSED] = "Connection closed", this.messages[n.CONNECTION_REFUSED] = "Connection refused", this.messages[n.CONNECTION_TIMEOUT] = "Connection timeout", this.messages[n.CONNECTION_DRAINING] = "Connection draining", this.messages[n.INVALID_PAYLOAD_TYPE] = "Invalid payload type - payloads can be 'binary', 'string', or 'json'", this.messages[n.SUB_CLOSED] = "Subscription closed", this.messages[n.SUB_DRAINING] = "Subscription draining", this.messages[n.WSS_REQUIRED] = "TLS is required, therefore a secure websocket connection is also required";
597
+ }
598
+ i.getMessage = function (t) { return i.messages.getMessage(t); };
599
+ i.prototype.getMessage = function (t) { var e = this.messages[t]; return e || (e = t), e; };
600
+ return i;
601
+ }());
602
+ i.messages = new i;
603
+ var s = /** @class */ (function (_super) {
604
+ __extends(s, _super);
605
+ function s(t, e, r) {
606
+ var _this = this;
607
+ _this = _super.call(this, t) || this, _this.name = "NatsError", _this.message = t, _this.code = e, _this.chainedError = r;
608
+ return _this;
609
+ }
610
+ s.errorForCode = function (t, e) { var r = i.getMessage(t); return new s(r, t, e); };
611
+ return s;
612
+ }(Error));
613
+ }, function (t, e, r) {
614
+ "use strict";
615
+ r.d(e, "d", (function () { return u; })), r.d(e, "b", (function () { return a; })), r.d(e, "c", (function () { return h; })), r.d(e, "a", (function () { return c; })), r.d(e, "e", (function () { return f; })), r.d(e, "f", (function () { return l; }));
616
+ var n = r(2);
617
+ var i = n.a.fromAscii("\r\n"), s = new Uint8Array(i)[0], o = new Uint8Array(i)[1];
618
+ function u(t) { return t instanceof ArrayBuffer; }
619
+ function a(t) {
620
+ var e = [];
621
+ for (var _i = 1; _i < arguments.length; _i++) {
622
+ e[_i - 1] = arguments[_i];
623
+ }
624
+ var _loop_1 = function (r_1) {
625
+ var n_1 = e[r_1];
626
+ Object.keys(n_1).forEach((function (e) { t[e] = n_1[e]; }));
627
+ };
628
+ for (var r_1 = 0; r_1 < e.length; r_1++) {
629
+ _loop_1(r_1);
630
+ }
631
+ return t;
632
+ }
633
+ function h(t) {
634
+ var e = function (t) {
635
+ var e = new Uint8Array(t);
636
+ for (var t_1 = 0; t_1 < e.byteLength; t_1++) {
637
+ var r_2 = t_1 + 1;
638
+ if (e.byteLength > r_2 && e[t_1] === s && e[r_2] === o)
639
+ return r_2 + 1;
640
+ }
641
+ return -1;
642
+ }(t);
643
+ if (e) {
644
+ var r_3 = new Uint8Array(t).slice(0, e);
645
+ return String.fromCharCode.apply(null, r_3);
646
+ }
647
+ return "";
648
+ }
649
+ function c(t, e) { var r = n.a.fromAscii(t); return e && (r = n.a.concat(r, e, i)), r; }
650
+ function f(t) { return Array.isArray(t) ? Promise.resolve(t).then(d) : Promise.reject(new TypeError("argument requires an array of promises")); }
651
+ function l(t) {
652
+ var e = t.split(""), r = [];
653
+ for (var n = 0; n < e.length; n++)
654
+ r.push(e[n].charCodeAt(0));
655
+ return new Uint8Array(r);
656
+ }
657
+ function d(t) { return Promise.all(t.map(function (t) { return Promise.resolve(t).then(p, p); })); }
658
+ function p(t) { return t; }
659
+ }, function (t, e, r) {
660
+ "use strict";
661
+ r.d(e, "a", (function () { return n; }));
662
+ var n = /** @class */ (function () {
663
+ function n() {
664
+ this.buffers = [], this.byteLength = 0;
665
+ }
666
+ n.concat = function () {
667
+ var t = [];
668
+ for (var _i = 0; _i < arguments.length; _i++) {
669
+ t[_i] = arguments[_i];
670
+ }
671
+ var e = 0;
672
+ for (var r_4 = 0; r_4 < t.length; r_4++)
673
+ e += t[r_4].byteLength;
674
+ var r = new Uint8Array(e), n = 0;
675
+ for (var e_1 = 0; e_1 < t.length; e_1++)
676
+ r.set(new Uint8Array(t[e_1]), n), n += t[e_1].byteLength;
677
+ return r.buffer;
678
+ };
679
+ n.fromAscii = function (t) {
680
+ t || (t = "");
681
+ var e = new ArrayBuffer(t.length), r = new Uint8Array(e);
682
+ for (var e_2 = 0; e_2 < t.length; e_2++)
683
+ r[e_2] = t.charCodeAt(e_2);
684
+ return e;
685
+ };
686
+ n.toAscii = function (t) { return String.fromCharCode.apply(null, new Uint8Array(t)); };
687
+ n.prototype.pack = function () {
688
+ if (this.buffers.length > 1) {
689
+ var t_2 = this.buffers.splice(0, this.buffers.length);
690
+ this.buffers.push(n.concat.apply(n, __spread(t_2)));
691
+ }
692
+ };
693
+ n.prototype.drain = function (t) {
694
+ if (this.buffers.length) {
695
+ this.pack();
696
+ var e_3 = this.buffers.pop();
697
+ if (e_3) {
698
+ var r_5 = this.byteLength;
699
+ (void 0 === t || t > r_5) && (t = r_5);
700
+ var n_2 = e_3.slice(0, t);
701
+ return r_5 > t && this.buffers.push(e_3.slice(t)), this.byteLength = r_5 - t, n_2;
702
+ }
703
+ }
704
+ return new Uint8Array(0).buffer;
705
+ };
706
+ n.prototype.fill = function (t) { t && (this.buffers.push(t), this.byteLength += t.byteLength); };
707
+ n.prototype.peek = function () { return this.buffers.length ? (this.pack(), this.buffers[0]) : new Uint8Array(0).buffer; };
708
+ n.prototype.size = function () { return this.byteLength; };
709
+ n.prototype.length = function () { return this.buffers.length; };
710
+ return n;
711
+ }());
712
+ }, function (t, e, r) {
713
+ "use strict";
714
+ var n;
715
+ r.d(e, "a", (function () { return n; })), function (t) { t.STRING = "string", t.JSON = "json", t.BINARY = "binary"; }(n || (n = {}));
716
+ }, function (t, e, r) {
717
+ "use strict";
718
+ (function (t) {
719
+ r.d(e, "d", (function () { return c; })), r.d(e, "i", (function () { return m; })), r.d(e, "a", (function () { return w; })), r.d(e, "k", (function () { return A; })), r.d(e, "j", (function () { return E; })), r.d(e, "f", (function () { return O; })), r.d(e, "g", (function () { return N; })), r.d(e, "c", (function () { return C; })), r.d(e, "h", (function () { return T; })), r.d(e, "b", (function () { return S; })), r.d(e, "e", (function () { return I; }));
720
+ var n = r(3), i = r(5), s = r(0), o = r(1), u = r(6), a = r(2);
721
+ var h;
722
+ var c;
723
+ !function (t) { t[t.CLOSED = -1] = "CLOSED", t[t.AWAITING_CONTROL = 0] = "AWAITING_CONTROL", t[t.AWAITING_MSG_PAYLOAD = 1] = "AWAITING_MSG_PAYLOAD"; }(c || (c = {}));
724
+ var f = /^MSG\s+([^\s\r\n]+)\s+([^\s\r\n]+)\s+(([^\s\r\n]+)[^\S\r\n]+)?(\d+)\r\n/i, l = /^\+OK\s*\r\n/i, d = /^-ERR\s+('.+')?\r\n/i, p = /^PING\r\n/i, g = /^PONG\r\n/i, b = /^INFO\s+([^\r\n]+)\r\n/i, y = "\r\n".length;
725
+ function m() { return h || (h = new u.a), "_INBOX." + h.next(); }
726
+ var w = /** @class */ (function () {
727
+ function w(t) {
728
+ this.lang = "javascript", this.pedantic = !1, this.protocol = 1, this.verbose = !1, (t = t || {}).token && (this.auth_token = t.token), t.noEcho && (this.echo = !1), t.userJWT && ("function" == typeof t.userJWT ? this.jwt = t.userJWT() : this.jwt = t.userJWT), Object(o.b)(this, t);
729
+ }
730
+ return w;
731
+ }());
732
+ function A() { return { sid: 0, subject: "", received: 0 }; }
733
+ function E() { return { token: "", subject: "", received: 0, max: 1 }; }
734
+ var O = /** @class */ (function () {
735
+ function O(t, e) {
736
+ this.token = t.token, this.protocol = e;
737
+ }
738
+ O.prototype.cancel = function () { this.protocol.cancelRequest(this.token, 0); };
739
+ return O;
740
+ }());
741
+ var N = /** @class */ (function () {
742
+ function N(t, e) {
743
+ this.sid = t.sid, this.protocol = e;
744
+ }
745
+ N.prototype.unsubscribe = function (t) { this.protocol.unsubscribe(this.sid, t); };
746
+ N.prototype.hasTimeout = function () { var t = this.protocol.subscriptions.get(this.sid); return null !== t && null !== t.timeout; };
747
+ N.prototype.cancelTimeout = function () { var t = this.protocol.subscriptions.get(this.sid); null !== t && null !== t.timeout && (clearTimeout(t.timeout), t.timeout = null); };
748
+ N.prototype.setTimeout = function (t, e) { var r = this.protocol.subscriptions.get(this.sid); return null !== r && (r.timeout && (clearTimeout(r.timeout), r.timeout = null), r.timeout = setTimeout(e, t), !0); };
749
+ N.prototype.getReceived = function () { var t = this.protocol.subscriptions.get(this.sid); return t ? t.received : 0; };
750
+ N.prototype.drain = function () { return this.protocol.drainSubscription(this.sid); };
751
+ N.prototype.isDraining = function () { var t = this.protocol.subscriptions.get(this.sid); return !!t && t.draining; };
752
+ N.prototype.isCancelled = function () { return null === this.protocol.subscriptions.get(this.sid); };
753
+ return N;
754
+ }());
755
+ var C = /** @class */ (function () {
756
+ function C() {
757
+ this.reqs = {}, this.length = 0;
758
+ }
759
+ C.prototype.init = function () { return this.baseInbox = m() + ".", this.baseInbox; };
760
+ C.prototype.add = function (t) { isNaN(t.received) || (t.received = 0), this.length++, this.reqs[t.token] = t; };
761
+ C.prototype.get = function (t) { return t in this.reqs ? this.reqs[t] : null; };
762
+ C.prototype.cancel = function (t) { t && t.timeout && (clearTimeout(t.timeout), t.timeout = null), t.token in this.reqs && (delete this.reqs[t.token], this.length--); };
763
+ C.prototype.getToken = function (t) { var e = t.subject || ""; return 0 === e.indexOf(this.baseInbox) ? e.substring(this.baseInbox.length) : null; };
764
+ C.prototype.dispatcher = function () {
765
+ var t = this;
766
+ return function (e) {
767
+ var r = t.getToken(e);
768
+ if (r) {
769
+ var n_3 = t.get(r);
770
+ n_3 && (n_3.received++, n_3.callback(e), n_3.max && n_3.received >= n_3.max && t.cancel(n_3));
771
+ }
772
+ };
773
+ };
774
+ return C;
775
+ }());
776
+ var T = /** @class */ (function () {
777
+ function T() {
778
+ this.subs = {}, this.sidCounter = 0, this.length = 0;
779
+ }
780
+ T.prototype.add = function (t) { return this.sidCounter++, this.length++, t.sid = this.sidCounter, this.subs[t.sid] = t, t; };
781
+ T.prototype.setMux = function (t) { return this.mux = t, t; };
782
+ T.prototype.getMux = function () { return this.mux; };
783
+ T.prototype.get = function (t) { return t in this.subs ? this.subs[t] : null; };
784
+ T.prototype.all = function () {
785
+ var t = [];
786
+ for (var e_4 in this.subs) {
787
+ var r_6 = this.subs[e_4];
788
+ t.push(r_6);
789
+ }
790
+ return t;
791
+ };
792
+ T.prototype.cancel = function (t) { t && t.timeout && (clearTimeout(t.timeout), t.timeout = null), t.sid in this.subs && (delete this.subs[t.sid], this.length--); };
793
+ return T;
794
+ }());
795
+ var S = /** @class */ (function () {
796
+ function S(t, e) {
797
+ if (e === void 0) { e = "string"; }
798
+ this.msg = {}, this.msg.subject = t[1], this.msg.sid = parseInt(t[2], 10), this.msg.reply = t[4], this.msg.size = parseInt(t[5], 10), this.length = this.msg.size + y, this.payload = e;
799
+ }
800
+ S.prototype.fill = function (e) {
801
+ if (this.buf ? this.buf = a.a.concat(this.buf, e) : this.buf = e, this.length -= e.byteLength, 0 === this.length) {
802
+ switch (this.msg.data = this.buf.slice(0, this.buf.byteLength - 2), this.payload) {
803
+ case n.a.JSON:
804
+ this.msg.data = t.from(this.msg.data).toString("utf8"), this.msg.data = JSON.parse(this.msg.data);
805
+ break;
806
+ case n.a.STRING:
807
+ this.msg.data = t.from(this.msg.data).toString("utf8");
808
+ break;
809
+ case n.a.BINARY:
810
+ }
811
+ this.buf = null;
812
+ }
813
+ };
814
+ return S;
815
+ }());
816
+ var I = /** @class */ (function () {
817
+ function I(t, e) {
818
+ this.infoReceived = !1, this.payload = null, this.pongs = [], this.pout = 0, this.state = c.AWAITING_CONTROL, this.noMorePublishing = !1, this.options = t, this.clientHandlers = e, this.subscriptions = new T, this.muxSubscriptions = new C, this.inbound = new a.a, this.outbound = new a.a;
819
+ }
820
+ I.connect = function (t, e) { return new Promise(function (r, n) { var o = new I(t, e); o.connectError = n; var u = t.connectTimeout || 1e4, a = new Promise(function (t, e) { var r = setTimeout(function () { e(s.c.errorForCode(s.a.CONNECTION_TIMEOUT)); }, u); o.pongs.push(function () { clearTimeout(r), t(!0); }); }); i.a.connect(t, o, t.debug).then(function (t) { o.transport = t; }).catch(function (t) { o.connectError = null, n(t); }), a.then(function () { o.connectError = null, r(o); }).catch(function (t) { o.connectError = null, n(t); }); }); };
821
+ I.toError = function (t) { var e = t ? t.toLowerCase() : ""; return -1 !== e.indexOf("permissions violation") ? new s.c(t, s.a.PERMISSIONS_VIOLATION) : -1 !== e.indexOf("authorization violation") ? new s.c(t, s.a.AUTHORIZATION_VIOLATION) : new s.c(t, s.a.NATS_PROTOCOL_ERR); };
822
+ I.prototype.processInbound = function () {
823
+ var t = null;
824
+ for (; this.inbound.size();) {
825
+ switch (this.state) {
826
+ case c.CLOSED: return;
827
+ case c.AWAITING_CONTROL:
828
+ var e_5 = this.inbound.peek(), r_7 = Object(o.c)(e_5);
829
+ if (t = f.exec(r_7))
830
+ this.payload = new S(t, this.options.payload), this.state = c.AWAITING_MSG_PAYLOAD;
831
+ else if (t = l.exec(r_7))
832
+ ;
833
+ else {
834
+ if (t = d.exec(r_7))
835
+ return void this.processError(t[1]);
836
+ if (t = g.exec(r_7)) {
837
+ this.pout = 0;
838
+ var t_3 = this.pongs.shift();
839
+ t_3 && t_3();
840
+ }
841
+ else if (t = p.exec(r_7))
842
+ this.transport.write(Object(o.a)("PONG \r\n"));
843
+ else {
844
+ if (!(t = b.exec(r_7)))
845
+ return;
846
+ if (!this.infoReceived) {
847
+ if (JSON.parse(t[1]).tls_required && !this.transport.isSecure())
848
+ return void this.handleError(s.c.errorForCode(s.a.WSS_REQUIRED));
849
+ var e_6 = JSON.stringify(new w(this.options));
850
+ this.transport.write(Object(o.a)("CONNECT " + e_6 + "\r\n")), this.sendSubscriptions(), this.transport.write(Object(o.a)("PING \r\n")), this.infoReceived = !0, this.flushPending();
851
+ }
852
+ }
853
+ }
854
+ break;
855
+ case c.AWAITING_MSG_PAYLOAD:
856
+ if (!this.payload)
857
+ break;
858
+ if (this.inbound.size() < this.payload.length) {
859
+ var t_4 = this.inbound.drain();
860
+ return void this.payload.fill(t_4);
861
+ }
862
+ var n_4 = this.inbound.drain(this.payload.length);
863
+ this.payload.fill(n_4);
864
+ try {
865
+ this.processMsg();
866
+ }
867
+ catch (t) { }
868
+ this.state = c.AWAITING_CONTROL, this.payload = null;
869
+ }
870
+ if (t) {
871
+ var e_7 = t[0].length;
872
+ e_7 >= this.inbound.size() ? this.inbound.drain() : this.inbound.drain(e_7), t = null;
873
+ }
874
+ }
875
+ };
876
+ I.prototype.processMsg = function () {
877
+ if (!this.payload || !this.subscriptions.sidCounter)
878
+ return;
879
+ var t = this.payload, e = this.subscriptions.get(t.msg.sid);
880
+ e && (e.received += 1, e.timeout && void 0 === e.max && (clearTimeout(e.timeout), e.timeout = null), e.callback && e.callback(t.msg), void 0 !== e.max && e.received >= e.max && this.unsubscribe(e.sid));
881
+ };
882
+ I.prototype.sendCommand = function (t) {
883
+ var _this = this;
884
+ var e;
885
+ e = "string" == typeof t ? Object(o.f)(t) : t, t && this.outbound.fill(e), 1 === this.outbound.length() ? setTimeout(function () { _this.flushPending(); }) : this.outbound.size() > 8192 && this.flushPending();
886
+ };
887
+ I.prototype.publish = function (e, r, n) {
888
+ if (this.isClosed())
889
+ throw s.c.errorForCode(s.a.CONNECTION_CLOSED);
890
+ if (this.noMorePublishing)
891
+ throw s.c.errorForCode(s.a.CONNECTION_DRAINING);
892
+ var i, u = t.byteLength(r);
893
+ i = (n = n || "") ? "PUB " + e + " " + n + " " + u + "\r\n" : "PUB " + e + " " + u + "\r\n", this.sendCommand(Object(o.a)(i, r));
894
+ };
895
+ I.prototype.request = function (t) { return this.initMux(), this.muxSubscriptions.add(t), new O(t, this); };
896
+ I.prototype.subscribe = function (t) { var e = this.subscriptions.add(t); return e.queue ? this.sendCommand("SUB " + e.subject + " " + e.queue + " " + e.sid + "\r\n") : this.sendCommand("SUB " + e.subject + " " + e.sid + "\r\n"), new N(e, this); };
897
+ I.prototype.unsubscribe = function (t, e) {
898
+ if (!t || this.isClosed())
899
+ return;
900
+ var r = this.subscriptions.get(t);
901
+ r && (e ? this.sendCommand("UNSUB " + t + " " + e + "\r\n") : this.sendCommand("UNSUB " + t + "\r\n"), r.max = e, (void 0 === r.max || r.received >= r.max) && this.subscriptions.cancel(r));
902
+ };
903
+ I.prototype.cancelRequest = function (t, e) {
904
+ if (!t || this.isClosed())
905
+ return;
906
+ var r = this.muxSubscriptions.get(t);
907
+ r && (r.max = e, (void 0 === r.max || r.received >= r.max) && this.muxSubscriptions.cancel(r));
908
+ };
909
+ I.prototype.flush = function (t) { this.pongs.push(t), this.sendCommand("PING \r\n"); };
910
+ I.prototype.processError = function (t) { var e = { error: I.toError(t) }; this.errorHandler(e); };
911
+ I.prototype.sendSubscriptions = function () { var t = []; this.subscriptions.all().forEach(function (e) { e.queue ? t.push("SUB " + e.subject + " " + e.queue + " " + e.sid + " \r\n") : t.push("SUB " + e.subject + " " + e.sid + " \r\n"); }), t.length && this.transport.write(Object(o.a)(t.join(""))); };
912
+ I.prototype.openHandler = function (t) { };
913
+ I.prototype.closeHandler = function (t) { this.close(), this.clientHandlers.closeHandler(); };
914
+ I.prototype.errorHandler = function (t) { var e; t && (e = t.error), this.handleError(e); };
915
+ I.prototype.messageHandler = function (t) { this.inbound.fill(t.data), this.processInbound(); };
916
+ I.prototype.close = function () { this.transport.close(), this.state = c.CLOSED; };
917
+ I.prototype.isClosed = function () { return this.transport.isClosed(); };
918
+ I.prototype.drain = function () {
919
+ var _this = this;
920
+ var t = this.subscriptions.all(), e = [];
921
+ return t.forEach(function (t) { var r = _this.drainSubscription(t.sid); e.push(r); }), new Promise(function (t) { Object(o.e)(e).then(function (e) { _this.noMorePublishing = !0, setTimeout(function () { _this.close(), t(e); }); }).catch(function () { }); });
922
+ };
923
+ I.prototype.drainSubscription = function (t) {
924
+ var _this = this;
925
+ if (this.isClosed())
926
+ return Promise.reject(s.c.errorForCode(s.a.CONNECTION_CLOSED));
927
+ if (!t)
928
+ return Promise.reject(s.c.errorForCode(s.a.SUB_CLOSED));
929
+ var e = this.subscriptions.get(t);
930
+ if (!e)
931
+ return Promise.reject(s.c.errorForCode(s.a.SUB_CLOSED));
932
+ if (e.draining)
933
+ return Promise.reject(s.c.errorForCode(s.a.SUB_DRAINING));
934
+ var r = e;
935
+ return new Promise(function (t) { r.draining = !0, _this.sendCommand("UNSUB " + r.sid + "\r\n"), _this.flush(function () { _this.subscriptions.cancel(r), t(r); }); });
936
+ };
937
+ I.prototype.flushPending = function () {
938
+ if (this.infoReceived && this.outbound.size()) {
939
+ var t_5 = this.outbound.drain();
940
+ this.transport.write(t_5);
941
+ }
942
+ };
943
+ I.prototype.initMux = function () {
944
+ if (!this.subscriptions.getMux()) {
945
+ var t_6 = this.muxSubscriptions.init(), e_8 = { sid: 0, subject: "", received: 0 };
946
+ e_8.subject = t_6 + "*", e_8.callback = this.muxSubscriptions.dispatcher(), this.subscriptions.setMux(e_8), this.subscribe(e_8);
947
+ }
948
+ };
949
+ I.prototype.handleError = function (t) { this.connectError && (this.connectError(t), this.connectError = null), this.close(), this.clientHandlers.errorHandler(t); };
950
+ return I;
951
+ }());
952
+ }).call(this, r(7).Buffer);
953
+ }, function (t, e, r) {
954
+ "use strict";
955
+ r.d(e, "a", (function () { return i; }));
956
+ var n = r(0);
957
+ var i = /** @class */ (function () {
958
+ function i(t) {
959
+ this.stream = null, this.closed = !1, this.debug = !1, this.listeners = {}, this.handlers = t;
960
+ }
961
+ i.connect = function (t, e, r) {
962
+ if (r === void 0) { r = !1; }
963
+ return new Promise(function (s, o) {
964
+ var u, a = new i(e);
965
+ a.debug = r, a.stream = new WebSocket(t.url), a.stream.binaryType = "arraybuffer", a.listeners = {}, a.stream.onclose = function (t) { a.trace("ws closed", t), a.closed || (u ? (a.handlers.closeHandler(t), a.close()) : (clearTimeout(void 0), o(n.c.errorForCode(n.a.CONNECTION_CLOSED)))); }, a.stream.onerror = function (t) {
966
+ var e;
967
+ if (t && (e = t.error, !e)) {
968
+ var r_8 = t.message;
969
+ e = r_8 ? new n.c(r_8, n.a.UNKNOWN) : u ? n.c.errorForCode(n.a.UNKNOWN) : n.c.errorForCode(n.a.CONNECTION_REFUSED);
970
+ }
971
+ a.trace("ws error", e), a.closed || (a && a.close(), u ? a.handlers.errorHandler(t) : o(e));
972
+ }, a.stream.onopen = function () { a.trace("ws open"); }, a.stream.onmessage = function (t) { a.trace(">", [t.data]), u ? a.handlers.messageHandler(t) : (u = !0, s(a), setTimeout((function () { a.handlers.messageHandler(t); }), 100)); };
973
+ });
974
+ };
975
+ i.prototype.isClosed = function () { return this.closed; };
976
+ i.prototype.isConnected = function () { return null !== this.stream && this.stream.readyState === WebSocket.OPEN; };
977
+ i.prototype.write = function (t) { this.stream && this.isConnected() && (this.trace("<", [t]), this.stream.send(t)); };
978
+ i.prototype.destroy = function () { this.stream && (this.closed && (this.stream.onclose = null, this.stream.onerror = null, this.stream.onopen = null, this.stream.onmessage = null), this.stream.readyState !== WebSocket.CLOSED && this.stream.readyState !== WebSocket.CLOSING && this.stream.close(1e3), this.stream = null); };
979
+ i.prototype.close = function () { this.closed = !0, this.stream && this.stream.bufferedAmount > 0 ? setTimeout(this.close.bind(this), 100) : this.destroy(); };
980
+ i.prototype.trace = function () {
981
+ var t = [];
982
+ for (var _i = 0; _i < arguments.length; _i++) {
983
+ t[_i] = arguments[_i];
984
+ }
985
+ this.debug && console.log(t);
986
+ };
987
+ i.prototype.isSecure = function () {
988
+ if (this.stream) {
989
+ return "wss:" === new URL(this.stream.url).protocol.toLowerCase();
990
+ }
991
+ return !1;
992
+ };
993
+ return i;
994
+ }());
995
+ }, function (t, e, r) {
996
+ "use strict";
997
+ r.d(e, "a", (function () { return s; }));
998
+ var n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
999
+ var i;
1000
+ var s = /** @class */ (function () {
1001
+ function s() {
1002
+ this.buf = new Uint8Array(22), this.init();
1003
+ }
1004
+ s.prototype.init = function () {
1005
+ "crypto" in Object({}) && Object({}).crypto.getRandomValues ? i = Object({}).crypto : "msCrypto" in Object({}) && Object({}).msCrypto.getRandomValues && (i = Object({}).msCrypto), i || (i = { getRandomValues: function (t) {
1006
+ for (var e_9 = 0; e_9 < t.length; e_9++)
1007
+ t[e_9] = Math.floor(255 * Math.random());
1008
+ } }), this.setPre(), this.initSeqAndInc(), this.fillSeq();
1009
+ };
1010
+ s.prototype.initSeqAndInc = function () { this.seq = Math.floor(0xcfd41b9100000 * Math.random()), this.inc = Math.floor(300 * Math.random() + 33); };
1011
+ s.prototype.setPre = function () {
1012
+ var t = new Uint8Array(12);
1013
+ i.getRandomValues(t);
1014
+ for (var e_10 = 0; e_10 < 12; e_10++) {
1015
+ var r_9 = t[e_10] % 36;
1016
+ this.buf[e_10] = n.charCodeAt(r_9);
1017
+ }
1018
+ };
1019
+ s.prototype.fillSeq = function () {
1020
+ var t = this.seq;
1021
+ for (var e_11 = 21; e_11 >= 12; e_11--)
1022
+ this.buf[e_11] = n.charCodeAt(t % 36), t = Math.floor(t / 36);
1023
+ };
1024
+ s.prototype.next = function () { return this.seq += this.inc, this.seq > 0xcfd41b9100000 && (this.setPre(), this.initSeqAndInc()), this.fillSeq(), String.fromCharCode.apply(String, this.buf); };
1025
+ s.prototype.reset = function () { this.init(); };
1026
+ return s;
1027
+ }());
1028
+ }, function (t, e, r) {
1029
+ "use strict";
1030
+ (function (t) {
1031
+ /*!
1032
+ * The buffer module from node.js, for the browser.
1033
+ *
1034
+ * @author Feross Aboukhadijeh <http://feross.org>
1035
+ * @license MIT
1036
+ */
1037
+ var n = r(9), i = r(10), s = r(11);
1038
+ function o() { return a.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823; }
1039
+ function u(t, e) {
1040
+ if (o() < e)
1041
+ throw new RangeError("Invalid typed array length");
1042
+ return a.TYPED_ARRAY_SUPPORT ? (t = new Uint8Array(e)).__proto__ = a.prototype : (null === t && (t = new a(e)), t.length = e), t;
1043
+ }
1044
+ function a(t, e, r) {
1045
+ if (!(a.TYPED_ARRAY_SUPPORT || this instanceof a))
1046
+ return new a(t, e, r);
1047
+ if ("number" == typeof t) {
1048
+ if ("string" == typeof e)
1049
+ throw new Error("If encoding is specified then the first argument must be a string");
1050
+ return f(this, t);
1051
+ }
1052
+ return h(this, t, e, r);
1053
+ }
1054
+ function h(t, e, r, n) {
1055
+ if ("number" == typeof e)
1056
+ throw new TypeError('"value" argument must not be a number');
1057
+ return "undefined" != typeof ArrayBuffer && e instanceof ArrayBuffer ? function (t, e, r, n) {
1058
+ if (e.byteLength, r < 0 || e.byteLength < r)
1059
+ throw new RangeError("'offset' is out of bounds");
1060
+ if (e.byteLength < r + (n || 0))
1061
+ throw new RangeError("'length' is out of bounds");
1062
+ e = void 0 === r && void 0 === n ? new Uint8Array(e) : void 0 === n ? new Uint8Array(e, r) : new Uint8Array(e, r, n);
1063
+ a.TYPED_ARRAY_SUPPORT ? (t = e).__proto__ = a.prototype : t = l(t, e);
1064
+ return t;
1065
+ }(t, e, r, n) : "string" == typeof e ? function (t, e, r) {
1066
+ "string" == typeof r && "" !== r || (r = "utf8");
1067
+ if (!a.isEncoding(r))
1068
+ throw new TypeError('"encoding" must be a valid string encoding');
1069
+ var n = 0 | p(e, r), i = (t = u(t, n)).write(e, r);
1070
+ i !== n && (t = t.slice(0, i));
1071
+ return t;
1072
+ }(t, e, r) : function (t, e) {
1073
+ if (a.isBuffer(e)) {
1074
+ var r = 0 | d(e.length);
1075
+ return 0 === (t = u(t, r)).length ? t : (e.copy(t, 0, 0, r), t);
1076
+ }
1077
+ if (e) {
1078
+ if ("undefined" != typeof ArrayBuffer && e.buffer instanceof ArrayBuffer || "length" in e)
1079
+ return "number" != typeof e.length || (n = e.length) != n ? u(t, 0) : l(t, e);
1080
+ if ("Buffer" === e.type && s(e.data))
1081
+ return l(t, e.data);
1082
+ }
1083
+ var n;
1084
+ throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
1085
+ }(t, e);
1086
+ }
1087
+ function c(t) {
1088
+ if ("number" != typeof t)
1089
+ throw new TypeError('"size" argument must be a number');
1090
+ if (t < 0)
1091
+ throw new RangeError('"size" argument must not be negative');
1092
+ }
1093
+ function f(t, e) {
1094
+ if (c(e), t = u(t, e < 0 ? 0 : 0 | d(e)), !a.TYPED_ARRAY_SUPPORT)
1095
+ for (var r = 0; r < e; ++r)
1096
+ t[r] = 0;
1097
+ return t;
1098
+ }
1099
+ function l(t, e) {
1100
+ var r = e.length < 0 ? 0 : 0 | d(e.length);
1101
+ t = u(t, r);
1102
+ for (var n = 0; n < r; n += 1)
1103
+ t[n] = 255 & e[n];
1104
+ return t;
1105
+ }
1106
+ function d(t) {
1107
+ if (t >= o())
1108
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + o().toString(16) + " bytes");
1109
+ return 0 | t;
1110
+ }
1111
+ function p(t, e) {
1112
+ if (a.isBuffer(t))
1113
+ return t.length;
1114
+ if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(t) || t instanceof ArrayBuffer))
1115
+ return t.byteLength;
1116
+ "string" != typeof t && (t = "" + t);
1117
+ var r = t.length;
1118
+ if (0 === r)
1119
+ return 0;
1120
+ for (var n = !1;;)
1121
+ switch (e) {
1122
+ case "ascii":
1123
+ case "latin1":
1124
+ case "binary": return r;
1125
+ case "utf8":
1126
+ case "utf-8":
1127
+ case void 0: return k(t).length;
1128
+ case "ucs2":
1129
+ case "ucs-2":
1130
+ case "utf16le":
1131
+ case "utf-16le": return 2 * r;
1132
+ case "hex": return r >>> 1;
1133
+ case "base64": return F(t).length;
1134
+ default:
1135
+ if (n)
1136
+ return k(t).length;
1137
+ e = ("" + e).toLowerCase(), n = !0;
1138
+ }
1139
+ }
1140
+ function g(t, e, r) {
1141
+ var n = !1;
1142
+ if ((void 0 === e || e < 0) && (e = 0), e > this.length)
1143
+ return "";
1144
+ if ((void 0 === r || r > this.length) && (r = this.length), r <= 0)
1145
+ return "";
1146
+ if ((r >>>= 0) <= (e >>>= 0))
1147
+ return "";
1148
+ for (t || (t = "utf8");;)
1149
+ switch (t) {
1150
+ case "hex": return v(this, e, r);
1151
+ case "utf8":
1152
+ case "utf-8": return S(this, e, r);
1153
+ case "ascii": return I(this, e, r);
1154
+ case "latin1":
1155
+ case "binary": return _(this, e, r);
1156
+ case "base64": return T(this, e, r);
1157
+ case "ucs2":
1158
+ case "ucs-2":
1159
+ case "utf16le":
1160
+ case "utf-16le": return R(this, e, r);
1161
+ default:
1162
+ if (n)
1163
+ throw new TypeError("Unknown encoding: " + t);
1164
+ t = (t + "").toLowerCase(), n = !0;
1165
+ }
1166
+ }
1167
+ function b(t, e, r) { var n = t[e]; t[e] = t[r], t[r] = n; }
1168
+ function y(t, e, r, n, i) {
1169
+ if (0 === t.length)
1170
+ return -1;
1171
+ if ("string" == typeof r ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, isNaN(r) && (r = i ? 0 : t.length - 1), r < 0 && (r = t.length + r), r >= t.length) {
1172
+ if (i)
1173
+ return -1;
1174
+ r = t.length - 1;
1175
+ }
1176
+ else if (r < 0) {
1177
+ if (!i)
1178
+ return -1;
1179
+ r = 0;
1180
+ }
1181
+ if ("string" == typeof e && (e = a.from(e, n)), a.isBuffer(e))
1182
+ return 0 === e.length ? -1 : m(t, e, r, n, i);
1183
+ if ("number" == typeof e)
1184
+ return e &= 255, a.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? i ? Uint8Array.prototype.indexOf.call(t, e, r) : Uint8Array.prototype.lastIndexOf.call(t, e, r) : m(t, [e], r, n, i);
1185
+ throw new TypeError("val must be string, number or Buffer");
1186
+ }
1187
+ function m(t, e, r, n, i) {
1188
+ var s, o = 1, u = t.length, a = e.length;
1189
+ if (void 0 !== n && ("ucs2" === (n = String(n).toLowerCase()) || "ucs-2" === n || "utf16le" === n || "utf-16le" === n)) {
1190
+ if (t.length < 2 || e.length < 2)
1191
+ return -1;
1192
+ o = 2, u /= 2, a /= 2, r /= 2;
1193
+ }
1194
+ function h(t, e) { return 1 === o ? t[e] : t.readUInt16BE(e * o); }
1195
+ if (i) {
1196
+ var c = -1;
1197
+ for (s = r; s < u; s++)
1198
+ if (h(t, s) === h(e, -1 === c ? 0 : s - c)) {
1199
+ if (-1 === c && (c = s), s - c + 1 === a)
1200
+ return c * o;
1201
+ }
1202
+ else
1203
+ -1 !== c && (s -= s - c), c = -1;
1204
+ }
1205
+ else
1206
+ for (r + a > u && (r = u - a), s = r; s >= 0; s--) {
1207
+ for (var f = !0, l = 0; l < a; l++)
1208
+ if (h(t, s + l) !== h(e, l)) {
1209
+ f = !1;
1210
+ break;
1211
+ }
1212
+ if (f)
1213
+ return s;
1214
+ }
1215
+ return -1;
1216
+ }
1217
+ function w(t, e, r, n) {
1218
+ r = Number(r) || 0;
1219
+ var i = t.length - r;
1220
+ n ? (n = Number(n)) > i && (n = i) : n = i;
1221
+ var s = e.length;
1222
+ if (s % 2 != 0)
1223
+ throw new TypeError("Invalid hex string");
1224
+ n > s / 2 && (n = s / 2);
1225
+ for (var o = 0; o < n; ++o) {
1226
+ var u = parseInt(e.substr(2 * o, 2), 16);
1227
+ if (isNaN(u))
1228
+ return o;
1229
+ t[r + o] = u;
1230
+ }
1231
+ return o;
1232
+ }
1233
+ function A(t, e, r, n) { return G(k(e, t.length - r), t, r, n); }
1234
+ function E(t, e, r, n) {
1235
+ return G(function (t) {
1236
+ for (var e = [], r = 0; r < t.length; ++r)
1237
+ e.push(255 & t.charCodeAt(r));
1238
+ return e;
1239
+ }(e), t, r, n);
1240
+ }
1241
+ function O(t, e, r, n) { return E(t, e, r, n); }
1242
+ function N(t, e, r, n) { return G(F(e), t, r, n); }
1243
+ function C(t, e, r, n) {
1244
+ return G(function (t, e) {
1245
+ for (var r, n, i, s = [], o = 0; o < t.length && !((e -= 2) < 0); ++o)
1246
+ r = t.charCodeAt(o), n = r >> 8, i = r % 256, s.push(i), s.push(n);
1247
+ return s;
1248
+ }(e, t.length - r), t, r, n);
1249
+ }
1250
+ function T(t, e, r) { return 0 === e && r === t.length ? n.fromByteArray(t) : n.fromByteArray(t.slice(e, r)); }
1251
+ function S(t, e, r) {
1252
+ r = Math.min(t.length, r);
1253
+ for (var n = [], i = e; i < r;) {
1254
+ var s, o, u, a, h = t[i], c = null, f = h > 239 ? 4 : h > 223 ? 3 : h > 191 ? 2 : 1;
1255
+ if (i + f <= r)
1256
+ switch (f) {
1257
+ case 1:
1258
+ h < 128 && (c = h);
1259
+ break;
1260
+ case 2:
1261
+ 128 == (192 & (s = t[i + 1])) && (a = (31 & h) << 6 | 63 & s) > 127 && (c = a);
1262
+ break;
1263
+ case 3:
1264
+ s = t[i + 1], o = t[i + 2], 128 == (192 & s) && 128 == (192 & o) && (a = (15 & h) << 12 | (63 & s) << 6 | 63 & o) > 2047 && (a < 55296 || a > 57343) && (c = a);
1265
+ break;
1266
+ case 4: s = t[i + 1], o = t[i + 2], u = t[i + 3], 128 == (192 & s) && 128 == (192 & o) && 128 == (192 & u) && (a = (15 & h) << 18 | (63 & s) << 12 | (63 & o) << 6 | 63 & u) > 65535 && a < 1114112 && (c = a);
1267
+ }
1268
+ null === c ? (c = 65533, f = 1) : c > 65535 && (c -= 65536, n.push(c >>> 10 & 1023 | 55296), c = 56320 | 1023 & c), n.push(c), i += f;
1269
+ }
1270
+ return function (t) {
1271
+ var e = t.length;
1272
+ if (e <= 4096)
1273
+ return String.fromCharCode.apply(String, t);
1274
+ var r = "", n = 0;
1275
+ for (; n < e;)
1276
+ r += String.fromCharCode.apply(String, t.slice(n, n += 4096));
1277
+ return r;
1278
+ }(n);
1279
+ }
1280
+ e.Buffer = a, e.SlowBuffer = function (t) { +t != t && (t = 0); return a.alloc(+t); }, e.INSPECT_MAX_BYTES = 50, a.TYPED_ARRAY_SUPPORT = void 0 !== t.TYPED_ARRAY_SUPPORT ? t.TYPED_ARRAY_SUPPORT : function () {
1281
+ try {
1282
+ var t = new Uint8Array(1);
1283
+ return t.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42; } }, 42 === t.foo() && "function" == typeof t.subarray && 0 === t.subarray(1, 1).byteLength;
1284
+ }
1285
+ catch (t) {
1286
+ return !1;
1287
+ }
1288
+ }(), e.kMaxLength = o(), a.poolSize = 8192, a._augment = function (t) { return t.__proto__ = a.prototype, t; }, a.from = function (t, e, r) { return h(null, t, e, r); }, a.TYPED_ARRAY_SUPPORT && (a.prototype.__proto__ = Uint8Array.prototype, a.__proto__ = Uint8Array, "undefined" != typeof Symbol && Symbol.species && a[Symbol.species] === a && Object.defineProperty(a, Symbol.species, { value: null, configurable: !0 })), a.alloc = function (t, e, r) { return function (t, e, r, n) { return c(e), e <= 0 ? u(t, e) : void 0 !== r ? "string" == typeof n ? u(t, e).fill(r, n) : u(t, e).fill(r) : u(t, e); }(null, t, e, r); }, a.allocUnsafe = function (t) { return f(null, t); }, a.allocUnsafeSlow = function (t) { return f(null, t); }, a.isBuffer = function (t) { return !(null == t || !t._isBuffer); }, a.compare = function (t, e) {
1289
+ if (!a.isBuffer(t) || !a.isBuffer(e))
1290
+ throw new TypeError("Arguments must be Buffers");
1291
+ if (t === e)
1292
+ return 0;
1293
+ for (var r = t.length, n = e.length, i = 0, s = Math.min(r, n); i < s; ++i)
1294
+ if (t[i] !== e[i]) {
1295
+ r = t[i], n = e[i];
1296
+ break;
1297
+ }
1298
+ return r < n ? -1 : n < r ? 1 : 0;
1299
+ }, a.isEncoding = function (t) {
1300
+ switch (String(t).toLowerCase()) {
1301
+ case "hex":
1302
+ case "utf8":
1303
+ case "utf-8":
1304
+ case "ascii":
1305
+ case "latin1":
1306
+ case "binary":
1307
+ case "base64":
1308
+ case "ucs2":
1309
+ case "ucs-2":
1310
+ case "utf16le":
1311
+ case "utf-16le": return !0;
1312
+ default: return !1;
1313
+ }
1314
+ }, a.concat = function (t, e) {
1315
+ if (!s(t))
1316
+ throw new TypeError('"list" argument must be an Array of Buffers');
1317
+ if (0 === t.length)
1318
+ return a.alloc(0);
1319
+ var r;
1320
+ if (void 0 === e)
1321
+ for (e = 0, r = 0; r < t.length; ++r)
1322
+ e += t[r].length;
1323
+ var n = a.allocUnsafe(e), i = 0;
1324
+ for (r = 0; r < t.length; ++r) {
1325
+ var o = t[r];
1326
+ if (!a.isBuffer(o))
1327
+ throw new TypeError('"list" argument must be an Array of Buffers');
1328
+ o.copy(n, i), i += o.length;
1329
+ }
1330
+ return n;
1331
+ }, a.byteLength = p, a.prototype._isBuffer = !0, a.prototype.swap16 = function () {
1332
+ var t = this.length;
1333
+ if (t % 2 != 0)
1334
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
1335
+ for (var e = 0; e < t; e += 2)
1336
+ b(this, e, e + 1);
1337
+ return this;
1338
+ }, a.prototype.swap32 = function () {
1339
+ var t = this.length;
1340
+ if (t % 4 != 0)
1341
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
1342
+ for (var e = 0; e < t; e += 4)
1343
+ b(this, e, e + 3), b(this, e + 1, e + 2);
1344
+ return this;
1345
+ }, a.prototype.swap64 = function () {
1346
+ var t = this.length;
1347
+ if (t % 8 != 0)
1348
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
1349
+ for (var e = 0; e < t; e += 8)
1350
+ b(this, e, e + 7), b(this, e + 1, e + 6), b(this, e + 2, e + 5), b(this, e + 3, e + 4);
1351
+ return this;
1352
+ }, a.prototype.toString = function () { var t = 0 | this.length; return 0 === t ? "" : 0 === arguments.length ? S(this, 0, t) : g.apply(this, arguments); }, a.prototype.equals = function (t) {
1353
+ if (!a.isBuffer(t))
1354
+ throw new TypeError("Argument must be a Buffer");
1355
+ return this === t || 0 === a.compare(this, t);
1356
+ }, a.prototype.inspect = function () { var t = "", r = e.INSPECT_MAX_BYTES; return this.length > 0 && (t = this.toString("hex", 0, r).match(/.{2}/g).join(" "), this.length > r && (t += " ... ")), "<Buffer " + t + ">"; }, a.prototype.compare = function (t, e, r, n, i) {
1357
+ if (!a.isBuffer(t))
1358
+ throw new TypeError("Argument must be a Buffer");
1359
+ if (void 0 === e && (e = 0), void 0 === r && (r = t ? t.length : 0), void 0 === n && (n = 0), void 0 === i && (i = this.length), e < 0 || r > t.length || n < 0 || i > this.length)
1360
+ throw new RangeError("out of range index");
1361
+ if (n >= i && e >= r)
1362
+ return 0;
1363
+ if (n >= i)
1364
+ return -1;
1365
+ if (e >= r)
1366
+ return 1;
1367
+ if (this === t)
1368
+ return 0;
1369
+ for (var s = (i >>>= 0) - (n >>>= 0), o = (r >>>= 0) - (e >>>= 0), u = Math.min(s, o), h = this.slice(n, i), c = t.slice(e, r), f = 0; f < u; ++f)
1370
+ if (h[f] !== c[f]) {
1371
+ s = h[f], o = c[f];
1372
+ break;
1373
+ }
1374
+ return s < o ? -1 : o < s ? 1 : 0;
1375
+ }, a.prototype.includes = function (t, e, r) { return -1 !== this.indexOf(t, e, r); }, a.prototype.indexOf = function (t, e, r) { return y(this, t, e, r, !0); }, a.prototype.lastIndexOf = function (t, e, r) { return y(this, t, e, r, !1); }, a.prototype.write = function (t, e, r, n) {
1376
+ if (void 0 === e)
1377
+ n = "utf8", r = this.length, e = 0;
1378
+ else if (void 0 === r && "string" == typeof e)
1379
+ n = e, r = this.length, e = 0;
1380
+ else {
1381
+ if (!isFinite(e))
1382
+ throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
1383
+ e |= 0, isFinite(r) ? (r |= 0, void 0 === n && (n = "utf8")) : (n = r, r = void 0);
1384
+ }
1385
+ var i = this.length - e;
1386
+ if ((void 0 === r || r > i) && (r = i), t.length > 0 && (r < 0 || e < 0) || e > this.length)
1387
+ throw new RangeError("Attempt to write outside buffer bounds");
1388
+ n || (n = "utf8");
1389
+ for (var s = !1;;)
1390
+ switch (n) {
1391
+ case "hex": return w(this, t, e, r);
1392
+ case "utf8":
1393
+ case "utf-8": return A(this, t, e, r);
1394
+ case "ascii": return E(this, t, e, r);
1395
+ case "latin1":
1396
+ case "binary": return O(this, t, e, r);
1397
+ case "base64": return N(this, t, e, r);
1398
+ case "ucs2":
1399
+ case "ucs-2":
1400
+ case "utf16le":
1401
+ case "utf-16le": return C(this, t, e, r);
1402
+ default:
1403
+ if (s)
1404
+ throw new TypeError("Unknown encoding: " + n);
1405
+ n = ("" + n).toLowerCase(), s = !0;
1406
+ }
1407
+ }, a.prototype.toJSON = function () { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) }; };
1408
+ function I(t, e, r) {
1409
+ var n = "";
1410
+ r = Math.min(t.length, r);
1411
+ for (var i = e; i < r; ++i)
1412
+ n += String.fromCharCode(127 & t[i]);
1413
+ return n;
1414
+ }
1415
+ function _(t, e, r) {
1416
+ var n = "";
1417
+ r = Math.min(t.length, r);
1418
+ for (var i = e; i < r; ++i)
1419
+ n += String.fromCharCode(t[i]);
1420
+ return n;
1421
+ }
1422
+ function v(t, e, r) {
1423
+ var n = t.length;
1424
+ (!e || e < 0) && (e = 0), (!r || r < 0 || r > n) && (r = n);
1425
+ for (var i = "", s = e; s < r; ++s)
1426
+ i += Y(t[s]);
1427
+ return i;
1428
+ }
1429
+ function R(t, e, r) {
1430
+ for (var n = t.slice(e, r), i = "", s = 0; s < n.length; s += 2)
1431
+ i += String.fromCharCode(n[s] + 256 * n[s + 1]);
1432
+ return i;
1433
+ }
1434
+ function P(t, e, r) {
1435
+ if (t % 1 != 0 || t < 0)
1436
+ throw new RangeError("offset is not uint");
1437
+ if (t + e > r)
1438
+ throw new RangeError("Trying to access beyond buffer length");
1439
+ }
1440
+ function U(t, e, r, n, i, s) {
1441
+ if (!a.isBuffer(t))
1442
+ throw new TypeError('"buffer" argument must be a Buffer instance');
1443
+ if (e > i || e < s)
1444
+ throw new RangeError('"value" argument is out of bounds');
1445
+ if (r + n > t.length)
1446
+ throw new RangeError("Index out of range");
1447
+ }
1448
+ function B(t, e, r, n) {
1449
+ e < 0 && (e = 65535 + e + 1);
1450
+ for (var i = 0, s = Math.min(t.length - r, 2); i < s; ++i)
1451
+ t[r + i] = (e & 255 << 8 * (n ? i : 1 - i)) >>> 8 * (n ? i : 1 - i);
1452
+ }
1453
+ function L(t, e, r, n) {
1454
+ e < 0 && (e = 4294967295 + e + 1);
1455
+ for (var i = 0, s = Math.min(t.length - r, 4); i < s; ++i)
1456
+ t[r + i] = e >>> 8 * (n ? i : 3 - i) & 255;
1457
+ }
1458
+ function D(t, e, r, n, i, s) {
1459
+ if (r + n > t.length)
1460
+ throw new RangeError("Index out of range");
1461
+ if (r < 0)
1462
+ throw new RangeError("Index out of range");
1463
+ }
1464
+ function x(t, e, r, n, s) { return s || D(t, 0, r, 4), i.write(t, e, r, n, 23, 4), r + 4; }
1465
+ function M(t, e, r, n, s) { return s || D(t, 0, r, 8), i.write(t, e, r, n, 52, 8), r + 8; }
1466
+ a.prototype.slice = function (t, e) {
1467
+ var r, n = this.length;
1468
+ if ((t = ~~t) < 0 ? (t += n) < 0 && (t = 0) : t > n && (t = n), (e = void 0 === e ? n : ~~e) < 0 ? (e += n) < 0 && (e = 0) : e > n && (e = n), e < t && (e = t), a.TYPED_ARRAY_SUPPORT)
1469
+ (r = this.subarray(t, e)).__proto__ = a.prototype;
1470
+ else {
1471
+ var i = e - t;
1472
+ r = new a(i, void 0);
1473
+ for (var s = 0; s < i; ++s)
1474
+ r[s] = this[s + t];
1475
+ }
1476
+ return r;
1477
+ }, a.prototype.readUIntLE = function (t, e, r) {
1478
+ t |= 0, e |= 0, r || P(t, e, this.length);
1479
+ for (var n = this[t], i = 1, s = 0; ++s < e && (i *= 256);)
1480
+ n += this[t + s] * i;
1481
+ return n;
1482
+ }, a.prototype.readUIntBE = function (t, e, r) {
1483
+ t |= 0, e |= 0, r || P(t, e, this.length);
1484
+ for (var n = this[t + --e], i = 1; e > 0 && (i *= 256);)
1485
+ n += this[t + --e] * i;
1486
+ return n;
1487
+ }, a.prototype.readUInt8 = function (t, e) { return e || P(t, 1, this.length), this[t]; }, a.prototype.readUInt16LE = function (t, e) { return e || P(t, 2, this.length), this[t] | this[t + 1] << 8; }, a.prototype.readUInt16BE = function (t, e) { return e || P(t, 2, this.length), this[t] << 8 | this[t + 1]; }, a.prototype.readUInt32LE = function (t, e) { return e || P(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + 16777216 * this[t + 3]; }, a.prototype.readUInt32BE = function (t, e) { return e || P(t, 4, this.length), 16777216 * this[t] + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]); }, a.prototype.readIntLE = function (t, e, r) {
1488
+ t |= 0, e |= 0, r || P(t, e, this.length);
1489
+ for (var n = this[t], i = 1, s = 0; ++s < e && (i *= 256);)
1490
+ n += this[t + s] * i;
1491
+ return n >= (i *= 128) && (n -= Math.pow(2, 8 * e)), n;
1492
+ }, a.prototype.readIntBE = function (t, e, r) {
1493
+ t |= 0, e |= 0, r || P(t, e, this.length);
1494
+ for (var n = e, i = 1, s = this[t + --n]; n > 0 && (i *= 256);)
1495
+ s += this[t + --n] * i;
1496
+ return s >= (i *= 128) && (s -= Math.pow(2, 8 * e)), s;
1497
+ }, a.prototype.readInt8 = function (t, e) { return e || P(t, 1, this.length), 128 & this[t] ? -1 * (255 - this[t] + 1) : this[t]; }, a.prototype.readInt16LE = function (t, e) { e || P(t, 2, this.length); var r = this[t] | this[t + 1] << 8; return 32768 & r ? 4294901760 | r : r; }, a.prototype.readInt16BE = function (t, e) { e || P(t, 2, this.length); var r = this[t + 1] | this[t] << 8; return 32768 & r ? 4294901760 | r : r; }, a.prototype.readInt32LE = function (t, e) { return e || P(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24; }, a.prototype.readInt32BE = function (t, e) { return e || P(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]; }, a.prototype.readFloatLE = function (t, e) { return e || P(t, 4, this.length), i.read(this, t, !0, 23, 4); }, a.prototype.readFloatBE = function (t, e) { return e || P(t, 4, this.length), i.read(this, t, !1, 23, 4); }, a.prototype.readDoubleLE = function (t, e) { return e || P(t, 8, this.length), i.read(this, t, !0, 52, 8); }, a.prototype.readDoubleBE = function (t, e) { return e || P(t, 8, this.length), i.read(this, t, !1, 52, 8); }, a.prototype.writeUIntLE = function (t, e, r, n) {
1498
+ (t = +t, e |= 0, r |= 0, n) || U(this, t, e, r, Math.pow(2, 8 * r) - 1, 0);
1499
+ var i = 1, s = 0;
1500
+ for (this[e] = 255 & t; ++s < r && (i *= 256);)
1501
+ this[e + s] = t / i & 255;
1502
+ return e + r;
1503
+ }, a.prototype.writeUIntBE = function (t, e, r, n) {
1504
+ (t = +t, e |= 0, r |= 0, n) || U(this, t, e, r, Math.pow(2, 8 * r) - 1, 0);
1505
+ var i = r - 1, s = 1;
1506
+ for (this[e + i] = 255 & t; --i >= 0 && (s *= 256);)
1507
+ this[e + i] = t / s & 255;
1508
+ return e + r;
1509
+ }, a.prototype.writeUInt8 = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 1, 255, 0), a.TYPED_ARRAY_SUPPORT || (t = Math.floor(t)), this[e] = 255 & t, e + 1; }, a.prototype.writeUInt16LE = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 2, 65535, 0), a.TYPED_ARRAY_SUPPORT ? (this[e] = 255 & t, this[e + 1] = t >>> 8) : B(this, t, e, !0), e + 2; }, a.prototype.writeUInt16BE = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 2, 65535, 0), a.TYPED_ARRAY_SUPPORT ? (this[e] = t >>> 8, this[e + 1] = 255 & t) : B(this, t, e, !1), e + 2; }, a.prototype.writeUInt32LE = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 4, 4294967295, 0), a.TYPED_ARRAY_SUPPORT ? (this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = 255 & t) : L(this, t, e, !0), e + 4; }, a.prototype.writeUInt32BE = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 4, 4294967295, 0), a.TYPED_ARRAY_SUPPORT ? (this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = 255 & t) : L(this, t, e, !1), e + 4; }, a.prototype.writeIntLE = function (t, e, r, n) {
1510
+ if (t = +t, e |= 0, !n) {
1511
+ var i = Math.pow(2, 8 * r - 1);
1512
+ U(this, t, e, r, i - 1, -i);
1513
+ }
1514
+ var s = 0, o = 1, u = 0;
1515
+ for (this[e] = 255 & t; ++s < r && (o *= 256);)
1516
+ t < 0 && 0 === u && 0 !== this[e + s - 1] && (u = 1), this[e + s] = (t / o >> 0) - u & 255;
1517
+ return e + r;
1518
+ }, a.prototype.writeIntBE = function (t, e, r, n) {
1519
+ if (t = +t, e |= 0, !n) {
1520
+ var i = Math.pow(2, 8 * r - 1);
1521
+ U(this, t, e, r, i - 1, -i);
1522
+ }
1523
+ var s = r - 1, o = 1, u = 0;
1524
+ for (this[e + s] = 255 & t; --s >= 0 && (o *= 256);)
1525
+ t < 0 && 0 === u && 0 !== this[e + s + 1] && (u = 1), this[e + s] = (t / o >> 0) - u & 255;
1526
+ return e + r;
1527
+ }, a.prototype.writeInt8 = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 1, 127, -128), a.TYPED_ARRAY_SUPPORT || (t = Math.floor(t)), t < 0 && (t = 255 + t + 1), this[e] = 255 & t, e + 1; }, a.prototype.writeInt16LE = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 2, 32767, -32768), a.TYPED_ARRAY_SUPPORT ? (this[e] = 255 & t, this[e + 1] = t >>> 8) : B(this, t, e, !0), e + 2; }, a.prototype.writeInt16BE = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 2, 32767, -32768), a.TYPED_ARRAY_SUPPORT ? (this[e] = t >>> 8, this[e + 1] = 255 & t) : B(this, t, e, !1), e + 2; }, a.prototype.writeInt32LE = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 4, 2147483647, -2147483648), a.TYPED_ARRAY_SUPPORT ? (this[e] = 255 & t, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24) : L(this, t, e, !0), e + 4; }, a.prototype.writeInt32BE = function (t, e, r) { return t = +t, e |= 0, r || U(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), a.TYPED_ARRAY_SUPPORT ? (this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = 255 & t) : L(this, t, e, !1), e + 4; }, a.prototype.writeFloatLE = function (t, e, r) { return x(this, t, e, !0, r); }, a.prototype.writeFloatBE = function (t, e, r) { return x(this, t, e, !1, r); }, a.prototype.writeDoubleLE = function (t, e, r) { return M(this, t, e, !0, r); }, a.prototype.writeDoubleBE = function (t, e, r) { return M(this, t, e, !1, r); }, a.prototype.copy = function (t, e, r, n) {
1528
+ if (r || (r = 0), n || 0 === n || (n = this.length), e >= t.length && (e = t.length), e || (e = 0), n > 0 && n < r && (n = r), n === r)
1529
+ return 0;
1530
+ if (0 === t.length || 0 === this.length)
1531
+ return 0;
1532
+ if (e < 0)
1533
+ throw new RangeError("targetStart out of bounds");
1534
+ if (r < 0 || r >= this.length)
1535
+ throw new RangeError("sourceStart out of bounds");
1536
+ if (n < 0)
1537
+ throw new RangeError("sourceEnd out of bounds");
1538
+ n > this.length && (n = this.length), t.length - e < n - r && (n = t.length - e + r);
1539
+ var i, s = n - r;
1540
+ if (this === t && r < e && e < n)
1541
+ for (i = s - 1; i >= 0; --i)
1542
+ t[i + e] = this[i + r];
1543
+ else if (s < 1e3 || !a.TYPED_ARRAY_SUPPORT)
1544
+ for (i = 0; i < s; ++i)
1545
+ t[i + e] = this[i + r];
1546
+ else
1547
+ Uint8Array.prototype.set.call(t, this.subarray(r, r + s), e);
1548
+ return s;
1549
+ }, a.prototype.fill = function (t, e, r, n) {
1550
+ if ("string" == typeof t) {
1551
+ if ("string" == typeof e ? (n = e, e = 0, r = this.length) : "string" == typeof r && (n = r, r = this.length), 1 === t.length) {
1552
+ var i = t.charCodeAt(0);
1553
+ i < 256 && (t = i);
1554
+ }
1555
+ if (void 0 !== n && "string" != typeof n)
1556
+ throw new TypeError("encoding must be a string");
1557
+ if ("string" == typeof n && !a.isEncoding(n))
1558
+ throw new TypeError("Unknown encoding: " + n);
1559
+ }
1560
+ else
1561
+ "number" == typeof t && (t &= 255);
1562
+ if (e < 0 || this.length < e || this.length < r)
1563
+ throw new RangeError("Out of range index");
1564
+ if (r <= e)
1565
+ return this;
1566
+ var s;
1567
+ if (e >>>= 0, r = void 0 === r ? this.length : r >>> 0, t || (t = 0), "number" == typeof t)
1568
+ for (s = e; s < r; ++s)
1569
+ this[s] = t;
1570
+ else {
1571
+ var o = a.isBuffer(t) ? t : k(new a(t, n).toString()), u = o.length;
1572
+ for (s = 0; s < r - e; ++s)
1573
+ this[s + e] = o[s % u];
1574
+ }
1575
+ return this;
1576
+ };
1577
+ var j = /[^+\/0-9A-Za-z-_]/g;
1578
+ function Y(t) { return t < 16 ? "0" + t.toString(16) : t.toString(16); }
1579
+ function k(t, e) {
1580
+ var r;
1581
+ e = e || 1 / 0;
1582
+ for (var n = t.length, i = null, s = [], o = 0; o < n; ++o) {
1583
+ if ((r = t.charCodeAt(o)) > 55295 && r < 57344) {
1584
+ if (!i) {
1585
+ if (r > 56319) {
1586
+ (e -= 3) > -1 && s.push(239, 191, 189);
1587
+ continue;
1588
+ }
1589
+ if (o + 1 === n) {
1590
+ (e -= 3) > -1 && s.push(239, 191, 189);
1591
+ continue;
1592
+ }
1593
+ i = r;
1594
+ continue;
1595
+ }
1596
+ if (r < 56320) {
1597
+ (e -= 3) > -1 && s.push(239, 191, 189), i = r;
1598
+ continue;
1599
+ }
1600
+ r = 65536 + (i - 55296 << 10 | r - 56320);
1601
+ }
1602
+ else
1603
+ i && (e -= 3) > -1 && s.push(239, 191, 189);
1604
+ if (i = null, r < 128) {
1605
+ if ((e -= 1) < 0)
1606
+ break;
1607
+ s.push(r);
1608
+ }
1609
+ else if (r < 2048) {
1610
+ if ((e -= 2) < 0)
1611
+ break;
1612
+ s.push(r >> 6 | 192, 63 & r | 128);
1613
+ }
1614
+ else if (r < 65536) {
1615
+ if ((e -= 3) < 0)
1616
+ break;
1617
+ s.push(r >> 12 | 224, r >> 6 & 63 | 128, 63 & r | 128);
1618
+ }
1619
+ else {
1620
+ if (!(r < 1114112))
1621
+ throw new Error("Invalid code point");
1622
+ if ((e -= 4) < 0)
1623
+ break;
1624
+ s.push(r >> 18 | 240, r >> 12 & 63 | 128, r >> 6 & 63 | 128, 63 & r | 128);
1625
+ }
1626
+ }
1627
+ return s;
1628
+ }
1629
+ function F(t) {
1630
+ return n.toByteArray(function (t) {
1631
+ if ((t = function (t) { return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, ""); }(t).replace(j, "")).length < 2)
1632
+ return "";
1633
+ for (; t.length % 4 != 0;)
1634
+ t += "=";
1635
+ return t;
1636
+ }(t));
1637
+ }
1638
+ function G(t, e, r, n) {
1639
+ for (var i = 0; i < n && !(i + r >= e.length || i >= t.length); ++i)
1640
+ e[i + r] = t[i];
1641
+ return i;
1642
+ }
1643
+ }).call(this, r(8));
1644
+ }, function (t, e, r) {
1645
+ var n;
1646
+ n = function () { return this; }();
1647
+ try {
1648
+ n = n || new Function("return this")();
1649
+ }
1650
+ catch (t) {
1651
+ n = Object({});
1652
+ }
1653
+ t.exports = n;
1654
+ }, function (t, e, r) {
1655
+ "use strict";
1656
+ e.byteLength = function (t) { var e = h(t), r = e[0], n = e[1]; return 3 * (r + n) / 4 - n; }, e.toByteArray = function (t) {
1657
+ var e, r, n = h(t), o = n[0], u = n[1], a = new s(function (t, e, r) { return 3 * (e + r) / 4 - r; }(0, o, u)), c = 0, f = u > 0 ? o - 4 : o;
1658
+ for (r = 0; r < f; r += 4)
1659
+ e = i[t.charCodeAt(r)] << 18 | i[t.charCodeAt(r + 1)] << 12 | i[t.charCodeAt(r + 2)] << 6 | i[t.charCodeAt(r + 3)], a[c++] = e >> 16 & 255, a[c++] = e >> 8 & 255, a[c++] = 255 & e;
1660
+ 2 === u && (e = i[t.charCodeAt(r)] << 2 | i[t.charCodeAt(r + 1)] >> 4, a[c++] = 255 & e);
1661
+ 1 === u && (e = i[t.charCodeAt(r)] << 10 | i[t.charCodeAt(r + 1)] << 4 | i[t.charCodeAt(r + 2)] >> 2, a[c++] = e >> 8 & 255, a[c++] = 255 & e);
1662
+ return a;
1663
+ }, e.fromByteArray = function (t) {
1664
+ for (var e, r = t.length, i = r % 3, s = [], o = 0, u = r - i; o < u; o += 16383)
1665
+ s.push(c(t, o, o + 16383 > u ? u : o + 16383));
1666
+ 1 === i ? (e = t[r - 1], s.push(n[e >> 2] + n[e << 4 & 63] + "==")) : 2 === i && (e = (t[r - 2] << 8) + t[r - 1], s.push(n[e >> 10] + n[e >> 4 & 63] + n[e << 2 & 63] + "="));
1667
+ return s.join("");
1668
+ };
1669
+ for (var n = [], i = [], s = "undefined" != typeof Uint8Array ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = 0, a = o.length; u < a; ++u)
1670
+ n[u] = o[u], i[o.charCodeAt(u)] = u;
1671
+ function h(t) {
1672
+ var e = t.length;
1673
+ if (e % 4 > 0)
1674
+ throw new Error("Invalid string. Length must be a multiple of 4");
1675
+ var r = t.indexOf("=");
1676
+ return -1 === r && (r = e), [r, r === e ? 0 : 4 - r % 4];
1677
+ }
1678
+ function c(t, e, r) {
1679
+ for (var i, s, o = [], u = e; u < r; u += 3)
1680
+ i = (t[u] << 16 & 16711680) + (t[u + 1] << 8 & 65280) + (255 & t[u + 2]), o.push(n[(s = i) >> 18 & 63] + n[s >> 12 & 63] + n[s >> 6 & 63] + n[63 & s]);
1681
+ return o.join("");
1682
+ }
1683
+ i["-".charCodeAt(0)] = 62, i["_".charCodeAt(0)] = 63;
1684
+ }, function (t, e) {
1685
+ e.read = function (t, e, r, n, i) {
1686
+ var s, o, u = 8 * i - n - 1, a = (1 << u) - 1, h = a >> 1, c = -7, f = r ? i - 1 : 0, l = r ? -1 : 1, d = t[e + f];
1687
+ for (f += l, s = d & (1 << -c) - 1, d >>= -c, c += u; c > 0; s = 256 * s + t[e + f], f += l, c -= 8)
1688
+ ;
1689
+ for (o = s & (1 << -c) - 1, s >>= -c, c += n; c > 0; o = 256 * o + t[e + f], f += l, c -= 8)
1690
+ ;
1691
+ if (0 === s)
1692
+ s = 1 - h;
1693
+ else {
1694
+ if (s === a)
1695
+ return o ? NaN : 1 / 0 * (d ? -1 : 1);
1696
+ o += Math.pow(2, n), s -= h;
1697
+ }
1698
+ return (d ? -1 : 1) * o * Math.pow(2, s - n);
1699
+ }, e.write = function (t, e, r, n, i, s) {
1700
+ var o, u, a, h = 8 * s - i - 1, c = (1 << h) - 1, f = c >> 1, l = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = n ? 0 : s - 1, p = n ? 1 : -1, g = e < 0 || 0 === e && 1 / e < 0 ? 1 : 0;
1701
+ for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (u = isNaN(e) ? 1 : 0, o = c) : (o = Math.floor(Math.log(e) / Math.LN2), e * (a = Math.pow(2, -o)) < 1 && (o--, a *= 2), (e += o + f >= 1 ? l / a : l * Math.pow(2, 1 - f)) * a >= 2 && (o++, a /= 2), o + f >= c ? (u = 0, o = c) : o + f >= 1 ? (u = (e * a - 1) * Math.pow(2, i), o += f) : (u = e * Math.pow(2, f - 1) * Math.pow(2, i), o = 0)); i >= 8; t[r + d] = 255 & u, d += p, u /= 256, i -= 8)
1702
+ ;
1703
+ for (o = o << i | u, h += i; h > 0; t[r + d] = 255 & o, d += p, o /= 256, h -= 8)
1704
+ ;
1705
+ t[r + d - p] |= 128 * g;
1706
+ };
1707
+ }, function (t, e) { var r = {}.toString; t.exports = Array.isArray || function (t) { return "[object Array]" == r.call(t); }; }, function (t, e, r) {
1708
+ "use strict";
1709
+ r.r(e);
1710
+ var n = r(2), i = r(0), s = r(3), o = r(1), u = r(4), a = r(6);
1711
+ function h(t) { return c.connect(t); }
1712
+ var c = /** @class */ (function () {
1713
+ function c(t) {
1714
+ this.closeListeners = [], this.errorListeners = [], this.draining = !1, this.nuid = new a.a, this.options = { url: "ws://localhost:4222" }, void 0 === t.payload && (t.payload = s.a.STRING);
1715
+ if (!["json", "string", "binary"].includes(t.payload))
1716
+ throw i.c.errorForCode(i.a.INVALID_PAYLOAD_TYPE);
1717
+ if (t.user && t.token)
1718
+ throw i.c.errorForCode(i.a.BAD_AUTHENTICATION);
1719
+ Object(o.b)(this.options, t);
1720
+ }
1721
+ c.connect = function (t) { return new Promise(function (e, r) { var n = new c(t); u.e.connect(t, n).then(function (t) { n.protocol = t, e(n); }).catch(function (t) { r(t); }); }); };
1722
+ c.prototype.close = function () { this.protocol.close(); };
1723
+ c.prototype.publish = function (t, e, r) {
1724
+ if (r === void 0) { r = ""; }
1725
+ return 0 === (t = t || "").length ? (this.errorHandler(i.c.errorForCode(i.a.BAD_SUBJECT)), this) : (Object(o.d)(e) || (this.options.payload !== s.a.JSON ? e = e || "" : (e = void 0 === e ? null : e, e = JSON.stringify(e)), e = Object(o.f)(e)), this.protocol.publish(t, e, r), this);
1726
+ };
1727
+ c.prototype.subscribe = function (t, e, r) {
1728
+ var _this = this;
1729
+ if (r === void 0) { r = {}; }
1730
+ return new Promise(function (n, s) { _this.isClosed() && s(i.c.errorForCode(i.a.CONNECTION_CLOSED)), _this.isDraining() && s(i.c.errorForCode(i.a.CONNECTION_DRAINING)); var a = Object(u.k)(); Object(o.b)(a, r), a.subject = t, a.callback = e, n(_this.protocol.subscribe(a)); });
1731
+ };
1732
+ c.prototype.request = function (t, e, r) {
1733
+ var _this = this;
1734
+ if (e === void 0) { e = 1e3; }
1735
+ return new Promise(function (n, s) { _this.isClosed() && s(i.c.errorForCode(i.a.CONNECTION_CLOSED)), _this.isDraining() && s(i.c.errorForCode(i.a.CONNECTION_DRAINING)); var a = Object(u.j)(); Object(o.b)(a, { max: 1 }), a.token = _this.nuid.next(), a.timeout = setTimeout(function () { h.cancel(), s("timeout"); }, e), a.callback = function (t) { n(t); }; var h = _this.protocol.request(a); _this.publish(t, r, "" + _this.protocol.muxSubscriptions.baseInbox + a.token); });
1736
+ };
1737
+ c.prototype.flush = function (t) {
1738
+ var _this = this;
1739
+ if (void 0 === t)
1740
+ return new Promise(function (t) { _this.protocol.flush(function () { t(); }); });
1741
+ this.protocol.flush(t);
1742
+ };
1743
+ c.prototype.drain = function () { return this.isClosed() ? Promise.reject(i.c.errorForCode(i.a.CONNECTION_CLOSED)) : this.isDraining() ? Promise.reject(i.c.errorForCode(i.a.CONNECTION_DRAINING)) : (this.draining = !0, this.protocol.drain()); };
1744
+ c.prototype.errorHandler = function (t) {
1745
+ this.errorListeners.forEach(function (e) {
1746
+ try {
1747
+ e(t);
1748
+ }
1749
+ catch (t) { }
1750
+ });
1751
+ };
1752
+ c.prototype.closeHandler = function () {
1753
+ this.closeListeners.forEach(function (t) {
1754
+ try {
1755
+ t();
1756
+ }
1757
+ catch (t) { }
1758
+ });
1759
+ };
1760
+ c.prototype.addEventListener = function (t, e) { "close" === t ? this.closeListeners.push(e) : "error" === t && this.errorListeners.push(e); };
1761
+ c.prototype.isClosed = function () { return this.protocol.isClosed(); };
1762
+ c.prototype.isDraining = function () { return this.draining; };
1763
+ return c;
1764
+ }());
1765
+ var f = r(5);
1766
+ r.d(e, "DataBuffer", (function () { return n.a; })), r.d(e, "ErrorCode", (function () { return i.a; })), r.d(e, "Messages", (function () { return i.b; })), r.d(e, "NatsError", (function () { return i.c; })), r.d(e, "connect", (function () { return h; })), r.d(e, "Connection", (function () { return c; })), r.d(e, "ParserState", (function () { return u.d; })), r.d(e, "createInbox", (function () { return u.i; })), r.d(e, "Connect", (function () { return u.a; })), r.d(e, "defaultSub", (function () { return u.k; })), r.d(e, "defaultReq", (function () { return u.j; })), r.d(e, "Request", (function () { return u.f; })), r.d(e, "Subscription", (function () { return u.g; })), r.d(e, "MuxSubscription", (function () { return u.c; })), r.d(e, "Subscriptions", (function () { return u.h; })), r.d(e, "MsgBuffer", (function () { return u.b; })), r.d(e, "ProtocolHandler", (function () { return u.e; })), r.d(e, "WSTransport", (function () { return f.a; })), r.d(e, "isArrayBuffer", (function () { return o.d; })), r.d(e, "extend", (function () { return o.b; })), r.d(e, "extractProtocolMessage", (function () { return o.c; })), r.d(e, "buildWSMessage", (function () { return o.a; })), r.d(e, "settle", (function () { return o.e; })), r.d(e, "stringToUint8Array", (function () { return o.f; }));
1767
+ }]);
1768
+ }));
1769
+
1770
+ });
1771
+ var nats_min$1 = /*@__PURE__*/ getDefaultExportFromCjs(nats_min);
667
1772
 
668
- var Chat4appClientAngularModule = /** @class */ (function () {
669
- function Chat4appClientAngularModule() {
1773
+ //declare let nats_min: any;
1774
+ var Chat4appClientAngularService = /** @class */ (function () {
1775
+ function Chat4appClientAngularService(http) {
1776
+ this.http = http;
1777
+ this.chatServer = "";
1778
+ this.chatUrl = "";
1779
+ this.debug = false;
1780
+ this.timeoutReconnect = 500;
1781
+ }
1782
+ Chat4appClientAngularService.prototype.ngOnInit = function () {
1783
+ };
1784
+ Chat4appClientAngularService.prototype.config = function (chat4AppConfig) {
1785
+ this.chatServer = chat4AppConfig.endpoint;
1786
+ this.chatUrl = chat4AppConfig.endpoint + "/api/v1/";
1787
+ this.debug = chat4AppConfig.debug;
1788
+ };
1789
+ Chat4appClientAngularService.prototype.init = function (securityChatToken, callback, chatCallback, connectionClientId) {
1790
+ if (!this.chatServer || this.chatServer.trim().length == 0) {
1791
+ throw new Error("Endpoint is empty");
1792
+ }
1793
+ if (!securityChatToken || securityChatToken.trim().length == 0) {
1794
+ throw new Error("SecurityChatToken is empty");
1795
+ }
1796
+ this.setTokenChat4app(securityChatToken);
1797
+ if (chatCallback && connectionClientId) {
1798
+ this.connectWebsocket(chatCallback, connectionClientId);
1799
+ }
1800
+ callback(securityChatToken);
1801
+ };
1802
+ Chat4appClientAngularService.prototype.getChatUrlDownload = function (messageFileId) {
1803
+ return this.chatUrl + "chatmessage/getFile?messageFileId=" + messageFileId + "&token=" + this.getBearerToken();
1804
+ };
1805
+ Chat4appClientAngularService.prototype.getMessageChat = function (chatId, fromId, toId) {
1806
+ var url = this.chatUrl + "chatmessage/" + chatId + "/" + fromId + "/" + toId;
1807
+ return this.http.get(url, {
1808
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1809
+ });
1810
+ };
1811
+ Chat4appClientAngularService.prototype.getMessageChatByGrop = function (chatId, groupId, fromId) {
1812
+ var url = this.chatUrl + "chatmessage/byGroup/" + chatId + "/" + groupId + "/" + fromId;
1813
+ return this.http.get(url, {
1814
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1815
+ });
1816
+ };
1817
+ Chat4appClientAngularService.prototype.addMessageChat = function (chatMessage4App) {
1818
+ var url = this.chatUrl + "chatmessage/" + chatMessage4App.chatId;
1819
+ return this.http.post(url, chatMessage4App, {
1820
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1821
+ });
1822
+ };
1823
+ Chat4appClientAngularService.prototype.props = function (chatFilterRequest4App) {
1824
+ var url = this.chatUrl + "chatmessage/props";
1825
+ return this.http.post(url, chatFilterRequest4App, {
1826
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1827
+ });
1828
+ };
1829
+ Chat4appClientAngularService.prototype.removeUsersChat = function (chatId, chatUsersId, chatUsersExternalId) {
1830
+ var params = new Array();
1831
+ if (chatUsersId && chatUsersId.length > 0) {
1832
+ chatUsersId.forEach(function (cui) {
1833
+ params.push("chatUserId=" + cui);
1834
+ });
1835
+ }
1836
+ else if (chatUsersExternalId && chatUsersExternalId.length > 0) {
1837
+ chatUsersExternalId.forEach(function (cuei) {
1838
+ params.push("chatUserExternalId=" + cuei);
1839
+ });
1840
+ }
1841
+ var url = this.chatUrl + "chatuser/" + chatId + "?" + params.join("&");
1842
+ return this.http.delete(url, {
1843
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1844
+ });
1845
+ };
1846
+ Chat4appClientAngularService.prototype.removeUserChat = function (chatId, chatUserId, chatUserExternalId) {
1847
+ var param = "";
1848
+ if (chatUserId) {
1849
+ param = "chatUserId=" + chatUserId;
1850
+ }
1851
+ else {
1852
+ param = "chatUserExternalId=" + chatUserExternalId;
1853
+ }
1854
+ var url = this.chatUrl + "chatuser/" + chatId + "?" + param;
1855
+ return this.http.delete(url, {
1856
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1857
+ });
1858
+ };
1859
+ Chat4appClientAngularService.prototype.updateUserChat = function (chatId, charUser4AppUpdate) {
1860
+ var url = this.chatUrl + "chatuser/" + chatId;
1861
+ return this.http.put(url, charUser4AppUpdate, {
1862
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1863
+ });
1864
+ };
1865
+ Chat4appClientAngularService.prototype.createUserChat = function (chatId, chatUser4App) {
1866
+ var url = this.chatUrl + "chatuser/" + chatId;
1867
+ return this.http.post(url, chatUser4App, {
1868
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1869
+ });
1870
+ };
1871
+ Chat4appClientAngularService.prototype.createUsersChat = function (chatId, chatUser4App) {
1872
+ var url = this.chatUrl + "chatuser/users/" + chatId;
1873
+ return this.http.post(url, chatUser4App, {
1874
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1875
+ });
1876
+ };
1877
+ Chat4appClientAngularService.prototype.createChat = function (chat4app) {
1878
+ var url = this.chatUrl + "chat";
1879
+ return this.http.post(url, chat4app, {
1880
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1881
+ });
1882
+ };
1883
+ Chat4appClientAngularService.prototype.createUpdateChat = function (chat4app) {
1884
+ var url = this.chatUrl + "chat";
1885
+ return this.http.put(url, chat4app, {
1886
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1887
+ });
1888
+ };
1889
+ Chat4appClientAngularService.prototype.getLastMessageGroup = function (chatExternalId, groupId) {
1890
+ var url = this.chatUrl + "chatmessage/lastMessageGroup?chatExternalId=" + chatExternalId + "&groupId=" + groupId;
1891
+ return this.http.get(url, {
1892
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1893
+ });
1894
+ };
1895
+ Chat4appClientAngularService.prototype.getLastMessage = function (chatExternalId, chatUserExternalId) {
1896
+ var url = this.chatUrl + "chatmessage/lastMessage?chatExternalId=" + chatExternalId + "&chatUserExternalId=" + chatUserExternalId;
1897
+ return this.http.get(url, {
1898
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1899
+ });
1900
+ };
1901
+ Chat4appClientAngularService.prototype.countNotReadMessages = function (chatUserExternalId, chatExternalId, groupId, fromId) {
1902
+ var url = this.chatUrl + "chatmessage/countNotReadMessages?chatUserExternalId=" + chatUserExternalId;
1903
+ if (chatExternalId && chatExternalId.length > 0) {
1904
+ url += "&chatExternalId=" + chatExternalId;
1905
+ }
1906
+ if (groupId && groupId.length > 0) {
1907
+ url += "&groupId=" + groupId;
1908
+ }
1909
+ if (fromId && fromId.length > 0) {
1910
+ url += "&fromId=" + groupId;
1911
+ }
1912
+ return this.http.get(url, {
1913
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1914
+ });
1915
+ };
1916
+ Chat4appClientAngularService.prototype.getChatByExternalId = function (externalId) {
1917
+ var url = this.chatUrl + "chat?externalId=" + externalId;
1918
+ return this.http.get(url, {
1919
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1920
+ });
1921
+ };
1922
+ Chat4appClientAngularService.prototype.getChatById = function (id) {
1923
+ var url = this.chatUrl + "chat?chatId=" + id;
1924
+ return this.http.get(url, {
1925
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1926
+ });
1927
+ };
1928
+ Chat4appClientAngularService.prototype.listChatByUser = function (externalUserId, userId, chatStatus) {
1929
+ var url = this.chatUrl + "chat/listChatByUser/?externalUserId=" + externalUserId
1930
+ + "&userId=" + userId
1931
+ + "&chatStatus=" + chatStatus;
1932
+ return this.http.get(url, {
1933
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1934
+ });
1935
+ };
1936
+ Chat4appClientAngularService.prototype.closeChat = function (chatId, chatExternalId) {
1937
+ var url = this.chatUrl;
1938
+ if (chatId && chatId.length > 0) {
1939
+ url += "chat?chatId=" + chatId;
1940
+ }
1941
+ if (chatExternalId && chatExternalId.length > 0) {
1942
+ url += "chat?externalId=" + chatExternalId;
1943
+ }
1944
+ return this.http.delete(url, {
1945
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1946
+ });
1947
+ };
1948
+ Chat4appClientAngularService.prototype.readMessage = function (chatMessageId, toId) {
1949
+ var url = this.chatUrl + "chatmessage/read/" + chatMessageId;
1950
+ if (toId && toId.length > 0) {
1951
+ url += "/" + toId;
1952
+ }
1953
+ return this.http.put(url, null, {
1954
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1955
+ });
1956
+ };
1957
+ Chat4appClientAngularService.prototype.online = function (chatId) {
1958
+ var url = this.chatUrl + "chatmessage/online/" + chatId;
1959
+ return this.http.get(url, {
1960
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1961
+ });
1962
+ };
1963
+ Chat4appClientAngularService.prototype.sendFile = function (chatId, fromId, toId, fileToUpload) {
1964
+ var endpoint = this.chatUrl + "chatmessage/sendFile/" + chatId + "/" + fromId + "/" + toId;
1965
+ var formData = new FormData();
1966
+ formData.append('file', fileToUpload);
1967
+ return this.http
1968
+ .post(endpoint, formData, {
1969
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1970
+ });
1971
+ };
1972
+ Chat4appClientAngularService.prototype.sendFileGroup = function (chatId, fromId, groupId, fileToUpload) {
1973
+ var endpoint = this.chatUrl + "chatmessage/sendFileGroup/" + chatId + "/" + fromId + "/" + groupId;
1974
+ var formData = new FormData();
1975
+ formData.append('file', fileToUpload);
1976
+ return this.http
1977
+ .post(endpoint, formData, {
1978
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1979
+ });
1980
+ };
1981
+ Chat4appClientAngularService.prototype.translateMessage = function (chatMessageId, languageTarget) {
1982
+ var url = this.chatUrl + "chatmessage/translate/" + chatMessageId + "/" + languageTarget;
1983
+ return this.http.get(url, {
1984
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1985
+ });
1986
+ };
1987
+ Chat4appClientAngularService.prototype.startTyping = function (chatId, fromId, toId) {
1988
+ var url = this.chatUrl + "chatmessage/startTyping/" + chatId + "/" + fromId + "/" + toId;
1989
+ return this.http.put(url, null, {
1990
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1991
+ });
1992
+ };
1993
+ Chat4appClientAngularService.prototype.startTypingGroup = function (chatId, fromId, groupId) {
1994
+ var url = this.chatUrl + "chatmessage/startTypingGroup/" + chatId + "/" + fromId + "/" + groupId;
1995
+ return this.http.put(url, null, {
1996
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
1997
+ });
1998
+ };
1999
+ Chat4appClientAngularService.prototype.stopTyping = function (chatId, fromId, toId) {
2000
+ var url = this.chatUrl + "chatmessage/stopTyping/" + chatId + "/" + fromId + "/" + toId;
2001
+ return this.http.put(url, null, {
2002
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2003
+ });
2004
+ };
2005
+ Chat4appClientAngularService.prototype.stopTypingGroup = function (chatId, fromId, groupId) {
2006
+ var url = this.chatUrl + "chatmessage/stopTypingGroup/" + chatId + "/" + fromId + "/" + groupId;
2007
+ return this.http.put(url, null, {
2008
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2009
+ });
2010
+ };
2011
+ Chat4appClientAngularService.prototype.createGroup = function (group) {
2012
+ var url = this.chatUrl + "/group";
2013
+ return this.http.post(url, group, {
2014
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2015
+ });
2016
+ };
2017
+ Chat4appClientAngularService.prototype.getGroup = function (chatId, groupId) {
2018
+ var url = this.chatUrl + "/group/" + groupId + "/" + chatId;
2019
+ return this.http.get(url, {
2020
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2021
+ });
2022
+ };
2023
+ Chat4appClientAngularService.prototype.listGroups = function (chatId, externalId) {
2024
+ var url = this.chatUrl + "/group/";
2025
+ if (chatId && chatId.length > 0) {
2026
+ url += "&chatId=" + chatId;
2027
+ }
2028
+ if (externalId && externalId.length > 0) {
2029
+ url += "&externalId=" + externalId;
2030
+ }
2031
+ return this.http.get(url, {
2032
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2033
+ });
2034
+ };
2035
+ Chat4appClientAngularService.prototype.listFilesGroup = function (chatId, groupId) {
2036
+ var url = this.chatUrl + "/group/" + chatId;
2037
+ if (groupId && groupId.length > 0) {
2038
+ url += "&groupId=" + chatId;
2039
+ }
2040
+ return this.http.get(url, {
2041
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2042
+ });
2043
+ };
2044
+ /* Token */
2045
+ Chat4appClientAngularService.prototype.getBearerToken = function () {
2046
+ var ret = "Bearer " + window.sessionStorage.getItem("chat4AppSessionToken");
2047
+ return ret;
2048
+ };
2049
+ Chat4appClientAngularService.prototype.setTokenChat4app = function (chat4AppSessionToken) {
2050
+ window.sessionStorage.setItem("chat4AppSessionToken", chat4AppSessionToken);
2051
+ };
2052
+ /* Connection */
2053
+ Chat4appClientAngularService.prototype.onMessageFirebaseReceived = function (data, chatCallback) {
2054
+ //alert("onMessageReceived connectFirebase");
2055
+ if (data.type == "msg") {
2056
+ var chat4appMessage = new Chat4AppMessageReceive();
2057
+ chat4appMessage.data.chatId = data.chatId;
2058
+ chat4appMessage.data.chatMessageId = data.chatMessageId;
2059
+ chat4appMessage.data.externalId = data.externalId;
2060
+ chat4appMessage.data.fromId = data.fromId;
2061
+ chat4appMessage.data.toId = data.toId;
2062
+ chat4appMessage.data.groupId = data.groupId;
2063
+ chat4appMessage.data.dateHour = data.dateHour;
2064
+ chat4appMessage.data.type = data.type;
2065
+ chat4appMessage.notification.body = data.body;
2066
+ if (data.fileId && data.fileId.length > 0) {
2067
+ chat4appMessage.data.fileId = data.fileId;
2068
+ chat4appMessage.data.fileName = data.fileName;
2069
+ chat4appMessage.data.fileSize = data.fileSize;
2070
+ chat4appMessage.data.fileType = data.fileType;
2071
+ }
2072
+ var datTmp = new Map();
2073
+ for (var key in data) {
2074
+ datTmp.set(key, data[key]);
2075
+ }
2076
+ chat4appMessage.data.all = datTmp;
2077
+ chatCallback.onMessage(chat4appMessage);
2078
+ }
2079
+ else if ((data.type == "on" || data.type == "off")) {
2080
+ var chat4appMessage = new Chat4AppMessageReceive();
2081
+ chat4appMessage.data.chatId = data.chatId;
2082
+ chat4appMessage.data.chatMessageId = data.chatMessageId;
2083
+ chat4appMessage.data.externalId = data.externalId;
2084
+ chat4appMessage.data.fromId = data.fromId;
2085
+ chat4appMessage.data.toId = data.toId;
2086
+ chat4appMessage.data.groupId = data.groupId;
2087
+ chat4appMessage.data.dateHour = data.dateHour;
2088
+ chat4appMessage.data.type = data.type;
2089
+ var datTmp = new Map();
2090
+ for (var key in data) {
2091
+ datTmp.set(key, data[key]);
2092
+ }
2093
+ chat4appMessage.data.all = datTmp;
2094
+ chatCallback.onOffline(chat4appMessage);
2095
+ }
2096
+ else if (data.type == "read") {
2097
+ var chat4appMessage = new Chat4AppMessageReceive();
2098
+ chat4appMessage.data.chatId = data.chatId;
2099
+ chat4appMessage.data.chatMessageId = data.chatMessageId;
2100
+ chat4appMessage.data.externalId = data.externalId;
2101
+ chat4appMessage.data.fromId = data.fromId;
2102
+ chat4appMessage.data.toId = data.toId;
2103
+ chat4appMessage.data.groupId = data.groupId;
2104
+ chat4appMessage.data.dateHour = data.dateHour;
2105
+ chat4appMessage.data.type = data.type;
2106
+ var datTmp = new Map();
2107
+ for (var key in data) {
2108
+ datTmp.set(key, data[key]);
2109
+ }
2110
+ chat4appMessage.data.all = datTmp;
2111
+ chatCallback.onRead(chat4appMessage);
2112
+ }
2113
+ else if (data.type == "startTyping" || data.type == "stopTyping") {
2114
+ var chat4appMessage = new Chat4AppMessageReceive();
2115
+ chat4appMessage.data.chatId = data.chatId;
2116
+ chat4appMessage.data.chatMessageId = data.chatMessageId;
2117
+ chat4appMessage.data.externalId = data.externalId;
2118
+ chat4appMessage.data.fromId = data.fromId;
2119
+ chat4appMessage.data.toId = data.toId;
2120
+ chat4appMessage.data.groupId = data.groupId;
2121
+ chat4appMessage.data.dateHour = data.dateHour;
2122
+ chat4appMessage.data.type = data.type;
2123
+ var datTmp = new Map();
2124
+ for (var key in data) {
2125
+ datTmp.set(key, data[key]);
2126
+ }
2127
+ chat4appMessage.data.all = datTmp;
2128
+ chatCallback.onStartStopTyping(chat4appMessage);
2129
+ }
2130
+ else if (data.type == "new_user") {
2131
+ var chat4appMessage = new Chat4AppMessageReceive();
2132
+ chat4appMessage.data.chatId = data.chatId;
2133
+ chat4appMessage.data.chatMessageId = data.chatMessageId;
2134
+ chat4appMessage.data.externalId = data.externalId;
2135
+ chat4appMessage.data.fromId = data.fromId;
2136
+ chat4appMessage.data.toId = data.toId;
2137
+ chat4appMessage.data.groupId = data.groupId;
2138
+ chat4appMessage.data.dateHour = data.dateHour;
2139
+ chat4appMessage.data.type = data.type;
2140
+ var datTmp = new Map();
2141
+ for (var key in data) {
2142
+ datTmp.set(key, data[key]);
2143
+ }
2144
+ chat4appMessage.data.all = datTmp;
2145
+ chatCallback.onNewUser(chat4appMessage);
2146
+ }
2147
+ else if (data.type == "remove_user") {
2148
+ var chat4appMessage = new Chat4AppMessageReceive();
2149
+ chat4appMessage.data.chatId = data.chatId;
2150
+ chat4appMessage.data.chatMessageId = data.chatMessageId;
2151
+ chat4appMessage.data.externalId = data.externalId;
2152
+ chat4appMessage.data.fromId = data.fromId;
2153
+ chat4appMessage.data.toId = data.toId;
2154
+ chat4appMessage.data.groupId = data.groupId;
2155
+ chat4appMessage.data.dateHour = data.dateHour;
2156
+ chat4appMessage.data.type = data.type;
2157
+ var datTmp = new Map();
2158
+ for (var key in data) {
2159
+ datTmp.set(key, data[key]);
2160
+ }
2161
+ chat4appMessage.data.all = datTmp;
2162
+ chatCallback.onRemoveUser(chat4appMessage);
2163
+ }
2164
+ else if (data.type == "chat_closed") {
2165
+ var chat4appMessage = new Chat4AppMessageReceive();
2166
+ chat4appMessage.data.chatId = data.chatId;
2167
+ chat4appMessage.data.chatMessageId = data.chatMessageId;
2168
+ chat4appMessage.data.externalId = data.externalId;
2169
+ chat4appMessage.data.fromId = data.fromId;
2170
+ chat4appMessage.data.toId = data.toId;
2171
+ chat4appMessage.data.groupId = data.groupId;
2172
+ chat4appMessage.data.dateHour = data.dateHour;
2173
+ chat4appMessage.data.type = data.type;
2174
+ var datTmp = new Map();
2175
+ for (var key in data) {
2176
+ datTmp.set(key, data[key]);
2177
+ }
2178
+ chat4appMessage.data.all = datTmp;
2179
+ chatCallback.onChatClosed(chat4appMessage);
2180
+ }
2181
+ };
2182
+ Chat4appClientAngularService.prototype.ensureConn = function (chatServer, userId) {
2183
+ return __awaiter(this, void 0, void 0, function () {
2184
+ var that, server, _b;
2185
+ return __generator(this, function (_c) {
2186
+ switch (_c.label) {
2187
+ case 0:
2188
+ console.log("chatServer: " + this.chatServer);
2189
+ console.log("userId: " + userId);
2190
+ console.log("getBearerToken: " + this.getBearerToken());
2191
+ that = this;
2192
+ server = chatServer.replace("https://", "wss://ws");
2193
+ if (!!this.nc) return [3 /*break*/, 2];
2194
+ _b = that;
2195
+ return [4 /*yield*/, nats_min.connect({ url: server, user: userId, pass: this.getBearerToken(), reconnect: true })];
2196
+ case 1:
2197
+ _b.nc = _c.sent();
2198
+ _c.label = 2;
2199
+ case 2: return [2 /*return*/, that.nc];
2200
+ }
2201
+ });
2202
+ });
2203
+ };
2204
+ Chat4appClientAngularService.prototype.disconnect = function () {
2205
+ return __awaiter(this, void 0, void 0, function () {
2206
+ var e_1;
2207
+ return __generator(this, function (_b) {
2208
+ switch (_b.label) {
2209
+ case 0:
2210
+ if (!!this.nc) return [3 /*break*/, 4];
2211
+ _b.label = 1;
2212
+ case 1:
2213
+ _b.trys.push([1, 3, , 4]);
2214
+ return [4 /*yield*/, this.nc.close()];
2215
+ case 2:
2216
+ _b.sent();
2217
+ return [3 /*break*/, 4];
2218
+ case 3:
2219
+ e_1 = _b.sent();
2220
+ if (this.debug) {
2221
+ console.error(e_1);
2222
+ }
2223
+ return [3 /*break*/, 4];
2224
+ case 4:
2225
+ if (this.debug) {
2226
+ console.log("disconect");
2227
+ }
2228
+ return [2 /*return*/];
2229
+ }
2230
+ });
2231
+ });
2232
+ };
2233
+ Chat4appClientAngularService.prototype.processAndCallback = function (msgObj, chatCallback) {
2234
+ console.log("Msg Received: " + msgObj);
2235
+ if (!chatCallback.isTokenFirebaseActive()) {
2236
+ var datTmp = new Map();
2237
+ for (var key in msgObj.data) {
2238
+ datTmp.set(key, msgObj.data[key]);
2239
+ }
2240
+ msgObj.data.all = datTmp;
2241
+ if (msgObj.data.type == "msg") {
2242
+ chatCallback.onMessage(msgObj);
2243
+ }
2244
+ else if ((msgObj.data.type == "on" || msgObj.data.type == "off")) {
2245
+ chatCallback.onOffline(msgObj);
2246
+ }
2247
+ else if (msgObj.data.type == "read") {
2248
+ chatCallback.onRead(msgObj);
2249
+ }
2250
+ else if (msgObj.data.type == "startTyping" || msgObj.data.type == "stopTyping") {
2251
+ chatCallback.onStartStopTyping(msgObj);
2252
+ }
2253
+ else if (msgObj.data.type == "new_user") {
2254
+ chatCallback.onNewUser(msgObj);
2255
+ }
2256
+ else if (msgObj.data.type == "remove_user") {
2257
+ chatCallback.onRemoveUser(msgObj);
2258
+ }
2259
+ else if (msgObj.data.type == "chat_closed") {
2260
+ chatCallback.onChatClosed(msgObj);
2261
+ }
2262
+ }
2263
+ };
2264
+ Chat4appClientAngularService.prototype.connectWebsocket = function (chatCallback, userId) {
2265
+ return __awaiter(this, void 0, void 0, function () {
2266
+ var securityToken, tokenAuth, configId, nc, subject, sub;
2267
+ var _this = this;
2268
+ return __generator(this, function (_b) {
2269
+ switch (_b.label) {
2270
+ case 0:
2271
+ this.disconnect();
2272
+ securityToken = this.getBearerToken();
2273
+ tokenAuth = "";
2274
+ if (securityToken && securityToken.startsWith("Bearer ")) {
2275
+ tokenAuth = securityToken;
2276
+ }
2277
+ else {
2278
+ tokenAuth = "Bearer " + securityToken;
2279
+ }
2280
+ configId = this.chatServer.split("/")[3];
2281
+ return [4 /*yield*/, this.ensureConn("https://apihomol.chat4app.com", userId)];
2282
+ case 1:
2283
+ nc = _b.sent();
2284
+ subject = "chat4app.config." + configId + ".user." + userId;
2285
+ sub = nc.subscribe(subject, function (msg) {
2286
+ console.log(msg);
2287
+ _this.processAndCallback(JSON.parse(msg.data), chatCallback);
2288
+ });
2289
+ return [2 /*return*/];
2290
+ }
2291
+ });
2292
+ });
2293
+ };
2294
+ /*
2295
+ disconnect() {
2296
+ // console.log("disconnect")
2297
+ try {
2298
+ if (this.stompClient) {
2299
+ this.stompClient.disconnect();
2300
+ }
2301
+
2302
+ } catch (e) {
2303
+ console.log(e);
670
2304
  }
671
- return Chat4appClientAngularModule;
672
- }());
673
- Chat4appClientAngularModule.decorators = [
674
- { type: i0.NgModule, args: [{
675
- declarations: [Chat4appClientAngularComponent],
676
- imports: [],
677
- exports: [Chat4appClientAngularComponent]
678
- },] }
679
- ];
2305
+ }
2306
+ */
2307
+ Chat4appClientAngularService.prototype.convertChat4AppMessageReceiveToChatMessage4App = function (msg) {
2308
+ var _a;
2309
+ var message = new ChatMessage4App();
2310
+ message.body = (_a = msg === null || msg === void 0 ? void 0 : msg.notification) === null || _a === void 0 ? void 0 : _a.body;
2311
+ message.chatId = msg.data.chatId;
2312
+ message.fromId = msg.data.fromId;
2313
+ message.toId = msg.data.toId;
2314
+ message.groupId = msg.data.groupId;
2315
+ message.replyFrom = msg.data.replyFrom;
2316
+ if (msg.data.dateHour && msg.data.dateHour.length > 0) {
2317
+ message.dateHourIncluded = msg.data.dateHour.substring(6, 10) + "-"
2318
+ + msg.data.dateHour.substring(3, 5) + "-"
2319
+ + msg.data.dateHour.substring(0, 2)
2320
+ + msg.data.dateHour.substring(10);
2321
+ }
2322
+ message.id = msg.data.chatMessageId;
2323
+ if (msg.data.fileId && msg.data.fileId.length > 0) {
2324
+ var messageFile = new ChatMessageFile4App();
2325
+ messageFile.id = msg.data.fileId;
2326
+ messageFile.name = msg.data.fileName;
2327
+ messageFile.size = msg.data.fileSize;
2328
+ messageFile.type = msg.data.fileType;
2329
+ message.chatMessageFile = messageFile;
2330
+ }
2331
+ if (msg.data.vFileId && msg.data.vFileId.length > 0) {
2332
+ var messageFile = new ChatMessageFile4App();
2333
+ messageFile.id = msg.data.vFileId;
2334
+ messageFile.name = msg.data.vFileName;
2335
+ messageFile.size = msg.data.vFileSize;
2336
+ messageFile.type = msg.data.vFileType;
2337
+ message.chatVoiceFile = messageFile;
2338
+ }
2339
+ return message;
2340
+ };
2341
+ return Chat4appClientAngularService;
2342
+ }());
2343
+ Chat4appClientAngularService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function Chat4appClientAngularService_Factory() { return new Chat4appClientAngularService(i0__namespace.ɵɵinject(i1__namespace.HttpClient)); }, token: Chat4appClientAngularService, providedIn: "root" });
2344
+ Chat4appClientAngularService.decorators = [
2345
+ { type: i0.Injectable, args: [{
2346
+ providedIn: 'root'
2347
+ },] }
2348
+ ];
2349
+ Chat4appClientAngularService.ctorParameters = function () { return [
2350
+ { type: i1.HttpClient }
2351
+ ]; };
2352
+ var Chat4App = /** @class */ (function () {
2353
+ function Chat4App() {
2354
+ }
2355
+ return Chat4App;
2356
+ }());
2357
+ var ChatUser4App = /** @class */ (function () {
2358
+ function ChatUser4App() {
2359
+ }
2360
+ return ChatUser4App;
2361
+ }());
2362
+ var ChatMessage4App = /** @class */ (function () {
2363
+ function ChatMessage4App() {
2364
+ }
2365
+ return ChatMessage4App;
2366
+ }());
2367
+ var ChatMessageFile4App = /** @class */ (function () {
2368
+ function ChatMessageFile4App() {
2369
+ }
2370
+ return ChatMessageFile4App;
2371
+ }());
2372
+ var ChatMessageMeta4App = /** @class */ (function () {
2373
+ function ChatMessageMeta4App() {
2374
+ }
2375
+ return ChatMessageMeta4App;
2376
+ }());
2377
+ var Chat4AppMessageReceive = /** @class */ (function () {
2378
+ function Chat4AppMessageReceive() {
2379
+ this.data = new Chat4AppMessageReceiveData();
2380
+ this.notification = new Chat4AppMessageReceiveNotification();
2381
+ }
2382
+ return Chat4AppMessageReceive;
2383
+ }());
2384
+ var Chat4AppMessageReceiveData = /** @class */ (function () {
2385
+ function Chat4AppMessageReceiveData() {
2386
+ }
2387
+ return Chat4AppMessageReceiveData;
2388
+ }());
2389
+ var Chat4AppMessageReceiveNotification = /** @class */ (function () {
2390
+ function Chat4AppMessageReceiveNotification() {
2391
+ }
2392
+ return Chat4AppMessageReceiveNotification;
2393
+ }());
2394
+ var ChatUserResponse4App = /** @class */ (function () {
2395
+ function ChatUserResponse4App() {
2396
+ }
2397
+ return ChatUserResponse4App;
2398
+ }());
2399
+ var ChatFilterRequest4App = /** @class */ (function () {
2400
+ function ChatFilterRequest4App() {
2401
+ }
2402
+ return ChatFilterRequest4App;
2403
+ }());
2404
+ var Chat4AppConfig = /** @class */ (function () {
2405
+ function Chat4AppConfig(endpoint, debug) {
2406
+ this.endpoint = endpoint;
2407
+ this.debug = debug;
2408
+ }
2409
+ return Chat4AppConfig;
2410
+ }());
2411
+ var Chat4AppTranslate = /** @class */ (function () {
2412
+ function Chat4AppTranslate() {
2413
+ }
2414
+ return Chat4AppTranslate;
2415
+ }());
2416
+ var ChatGroupApp = /** @class */ (function () {
2417
+ function ChatGroupApp() {
2418
+ }
2419
+ return ChatGroupApp;
2420
+ }());
2421
+ exports.ChatStatus4App = void 0;
2422
+ (function (ChatStatus4App) {
2423
+ ChatStatus4App["CREATED"] = "CREATED";
2424
+ ChatStatus4App["CLOSED"] = "CLOSED";
2425
+ })(exports.ChatStatus4App || (exports.ChatStatus4App = {}));
2426
+ exports.ChatUserStatus4App = void 0;
2427
+ (function (ChatUserStatus4App) {
2428
+ ChatUserStatus4App["REMOVED"] = "REMOVED";
2429
+ })(exports.ChatUserStatus4App || (exports.ChatUserStatus4App = {}));
2430
+ exports.ChatFilterType = void 0;
2431
+ (function (ChatFilterType) {
2432
+ ChatFilterType[ChatFilterType["COUNT_NOT_READ"] = 1] = "COUNT_NOT_READ";
2433
+ ChatFilterType[ChatFilterType["LAST_MESSAGE"] = 2] = "LAST_MESSAGE";
2434
+ })(exports.ChatFilterType || (exports.ChatFilterType = {}));
2435
+ exports.GroupStatus4App = void 0;
2436
+ (function (GroupStatus4App) {
2437
+ GroupStatus4App["CREATED"] = "CREATED";
2438
+ GroupStatus4App["CLOSED"] = "REMOVED";
2439
+ })(exports.GroupStatus4App || (exports.GroupStatus4App = {}));
2440
+
2441
+ var Chat4appClientAngularComponent = /** @class */ (function () {
2442
+ function Chat4appClientAngularComponent() {
2443
+ }
2444
+ Chat4appClientAngularComponent.prototype.ngOnInit = function () {
2445
+ };
2446
+ return Chat4appClientAngularComponent;
2447
+ }());
2448
+ Chat4appClientAngularComponent.decorators = [
2449
+ { type: i0.Component, args: [{
2450
+ selector: 'lib-chat4app-client-angular',
2451
+ template: "\n <p>\n chat4app-client-angular works!\n </p>\n "
2452
+ },] }
2453
+ ];
2454
+ Chat4appClientAngularComponent.ctorParameters = function () { return []; };
2455
+
2456
+ var Chat4appClientAngularModule = /** @class */ (function () {
2457
+ function Chat4appClientAngularModule() {
2458
+ }
2459
+ return Chat4appClientAngularModule;
2460
+ }());
2461
+ Chat4appClientAngularModule.decorators = [
2462
+ { type: i0.NgModule, args: [{
2463
+ declarations: [Chat4appClientAngularComponent],
2464
+ imports: [],
2465
+ exports: [Chat4appClientAngularComponent]
2466
+ },] }
2467
+ ];
680
2468
 
681
- /*
682
- * Public API Surface of chat4app-client-angular
683
- */
2469
+ /*
2470
+ * Public API Surface of chat4app-client-angular
2471
+ */
684
2472
 
685
- /**
686
- * Generated bundle index. Do not edit.
687
- */
2473
+ /**
2474
+ * Generated bundle index. Do not edit.
2475
+ */
688
2476
 
689
- exports.Chat4App = Chat4App;
690
- exports.Chat4AppConfig = Chat4AppConfig;
691
- exports.Chat4AppMessageReceive = Chat4AppMessageReceive;
692
- exports.Chat4AppMessageReceiveData = Chat4AppMessageReceiveData;
693
- exports.Chat4AppMessageReceiveNotification = Chat4AppMessageReceiveNotification;
694
- exports.Chat4AppTranslate = Chat4AppTranslate;
695
- exports.Chat4appClientAngularComponent = Chat4appClientAngularComponent;
696
- exports.Chat4appClientAngularModule = Chat4appClientAngularModule;
697
- exports.Chat4appClientAngularService = Chat4appClientAngularService;
698
- exports.ChatFilterRequest4App = ChatFilterRequest4App;
699
- exports.ChatGroupApp = ChatGroupApp;
700
- exports.ChatMessage4App = ChatMessage4App;
701
- exports.ChatMessageFile4App = ChatMessageFile4App;
702
- exports.ChatMessageMeta4App = ChatMessageMeta4App;
703
- exports.ChatUser4App = ChatUser4App;
704
- exports.ChatUserResponse4App = ChatUserResponse4App;
2477
+ exports.Chat4App = Chat4App;
2478
+ exports.Chat4AppConfig = Chat4AppConfig;
2479
+ exports.Chat4AppMessageReceive = Chat4AppMessageReceive;
2480
+ exports.Chat4AppMessageReceiveData = Chat4AppMessageReceiveData;
2481
+ exports.Chat4AppMessageReceiveNotification = Chat4AppMessageReceiveNotification;
2482
+ exports.Chat4AppTranslate = Chat4AppTranslate;
2483
+ exports.Chat4appClientAngularComponent = Chat4appClientAngularComponent;
2484
+ exports.Chat4appClientAngularModule = Chat4appClientAngularModule;
2485
+ exports.Chat4appClientAngularService = Chat4appClientAngularService;
2486
+ exports.ChatFilterRequest4App = ChatFilterRequest4App;
2487
+ exports.ChatGroupApp = ChatGroupApp;
2488
+ exports.ChatMessage4App = ChatMessage4App;
2489
+ exports.ChatMessageFile4App = ChatMessageFile4App;
2490
+ exports.ChatMessageMeta4App = ChatMessageMeta4App;
2491
+ exports.ChatUser4App = ChatUser4App;
2492
+ exports.ChatUserResponse4App = ChatUserResponse4App;
705
2493
 
706
- Object.defineProperty(exports, '__esModule', { value: true });
2494
+ Object.defineProperty(exports, '__esModule', { value: true });
707
2495
 
708
2496
  }));
709
2497
  //# sourceMappingURL=chat4app-client-angular.umd.js.map