@progress/kendo-angular-conversational-ui 4.0.0 → 5.0.0-next.202202241517

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/{dist/es2015/api → api}/action.interface.d.ts +0 -0
  2. package/{dist/es2015/api → api}/attachment.interface.d.ts +0 -0
  3. package/{dist/es2015/api → api}/execute-action-event.d.ts +1 -1
  4. package/{dist/es/api/user.interface.js → api/index.d.ts} +6 -0
  5. package/{dist/es2015/api → api}/message.interface.d.ts +0 -0
  6. package/{dist/es2015/api → api}/post-message-event.d.ts +0 -0
  7. package/{dist/es2015/api → api}/preventable-event.d.ts +0 -0
  8. package/{dist/es2015/api → api}/user.interface.d.ts +0 -0
  9. package/bundles/kendo-angular-conversational-ui.umd.js +5 -0
  10. package/{dist/es2015/cards → cards}/hero-card.component.d.ts +3 -0
  11. package/{dist/es2015/chat → chat}/attachment-template.directive.d.ts +3 -0
  12. package/{dist/es2015/chat → chat}/attachment.component.d.ts +9 -5
  13. package/{dist/es2015/chat → chat}/builtin-actions.d.ts +0 -0
  14. package/{dist/es2015/chat → chat}/chat-item.d.ts +0 -0
  15. package/{dist/es2015/chat → chat}/chat-view.d.ts +1 -1
  16. package/{dist/es2015/chat → chat}/chat.component.d.ts +6 -6
  17. package/{dist/es2015/chat → chat}/chat.directives.d.ts +0 -0
  18. package/chat/chat.module.d.ts +47 -0
  19. package/{dist/es2015/chat → chat}/l10n/custom-messages.component.d.ts +4 -1
  20. package/{dist/es2015/chat → chat}/l10n/localized-messages.directive.d.ts +3 -0
  21. package/{dist/es2015/chat → chat}/l10n/messages.d.ts +3 -0
  22. package/{dist/es2015/chat → chat}/message-attachments.component.d.ts +5 -2
  23. package/{dist/es2015/chat → chat}/message-list.component.d.ts +8 -7
  24. package/{dist/es2015/chat → chat}/message-template.directive.d.ts +3 -0
  25. package/{dist/es2015/chat → chat}/message.component.d.ts +4 -1
  26. package/{dist/es2015/chat → chat}/suggested-actions.component.d.ts +4 -1
  27. package/common/focused-state.directive.d.ts +15 -0
  28. package/{dist/es2015/common → common}/keys.enum.d.ts +0 -0
  29. package/{dist/es2015/common → common}/scroll-anchor.directive.d.ts +3 -0
  30. package/{dist/es2015/common → common}/utils.d.ts +0 -0
  31. package/{dist/es2015 → esm2015}/api/action.interface.js +2 -1
  32. package/{dist/es2015 → esm2015}/api/attachment.interface.js +1 -0
  33. package/{dist/es2015 → esm2015}/api/execute-action-event.js +0 -0
  34. package/{dist/es/api/attachment.interface.js → esm2015/api/index.js} +6 -0
  35. package/{dist/es → esm2015}/api/message.interface.js +1 -0
  36. package/{dist/es2015 → esm2015}/api/post-message-event.js +0 -0
  37. package/{dist/es2015 → esm2015}/api/preventable-event.js +0 -0
  38. package/{dist/es2015 → esm2015}/api/user.interface.js +1 -0
  39. package/esm2015/cards/hero-card.component.js +88 -0
  40. package/{dist/es2015 → esm2015}/chat/attachment-template.directive.js +14 -12
  41. package/esm2015/chat/attachment.component.js +83 -0
  42. package/{dist/es2015 → esm2015}/chat/builtin-actions.js +13 -16
  43. package/{dist/es2015 → esm2015}/chat/chat-item.js +0 -0
  44. package/{dist/es2015 → esm2015}/chat/chat-view.js +0 -6
  45. package/esm2015/chat/chat.component.js +226 -0
  46. package/{dist/es → esm2015}/chat/chat.directives.js +0 -0
  47. package/{dist/es2015 → esm2015}/chat/chat.module.js +40 -15
  48. package/esm2015/chat/l10n/custom-messages.component.js +42 -0
  49. package/esm2015/chat/l10n/localized-messages.directive.js +37 -0
  50. package/esm2015/chat/l10n/messages.js +24 -0
  51. package/{dist/es2015 → esm2015}/chat/message-attachments.component.js +71 -48
  52. package/esm2015/chat/message-list.component.js +279 -0
  53. package/{dist/es2015 → esm2015}/chat/message-template.directive.js +14 -12
  54. package/esm2015/chat/message.component.js +140 -0
  55. package/esm2015/chat/suggested-actions.component.js +111 -0
  56. package/esm2015/common/focused-state.directive.js +37 -0
  57. package/{dist/es2015 → esm2015}/common/keys.enum.js +1 -0
  58. package/{dist/es2015 → esm2015}/common/scroll-anchor.directive.js +20 -26
  59. package/{dist/es2015 → esm2015}/common/utils.js +0 -0
  60. package/{dist/es/api/action.interface.js → esm2015/kendo-angular-conversational-ui.js} +4 -1
  61. package/{dist/npm/chat/chat-item.js → esm2015/main.js} +5 -11
  62. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  63. package/fesm2015/kendo-angular-conversational-ui.js +1576 -0
  64. package/{dist/es2015/common/focused-state.directive.d.ts → kendo-angular-conversational-ui.d.ts} +3 -6
  65. package/main.d.ts +9 -0
  66. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  67. package/package.json +34 -101
  68. package/schematics/ngAdd/index.js +5 -2
  69. package/schematics/ngAdd/index.js.map +1 -1
  70. package/dist/cdn/js/kendo-angular-conversational-ui.js +0 -20
  71. package/dist/cdn/main.js +0 -5
  72. package/dist/es/api/execute-action-event.js +0 -24
  73. package/dist/es/api/post-message-event.js +0 -18
  74. package/dist/es/api/preventable-event.js +0 -32
  75. package/dist/es/cards/hero-card.component.js +0 -54
  76. package/dist/es/chat/attachment-template.directive.js +0 -32
  77. package/dist/es/chat/attachment.component.js +0 -65
  78. package/dist/es/chat/builtin-actions.js +0 -28
  79. package/dist/es/chat/chat-item.js +0 -13
  80. package/dist/es/chat/chat-view.js +0 -92
  81. package/dist/es/chat/chat.component.js +0 -193
  82. package/dist/es/chat/chat.module.js +0 -76
  83. package/dist/es/chat/l10n/custom-messages.component.js +0 -45
  84. package/dist/es/chat/l10n/localized-messages.directive.js +0 -36
  85. package/dist/es/chat/l10n/messages.js +0 -26
  86. package/dist/es/chat/message-attachments.component.js +0 -148
  87. package/dist/es/chat/message-list.component.js +0 -165
  88. package/dist/es/chat/message-template.directive.js +0 -32
  89. package/dist/es/chat/message.component.js +0 -77
  90. package/dist/es/chat/suggested-actions.component.js +0 -91
  91. package/dist/es/common/focused-state.directive.js +0 -43
  92. package/dist/es/common/keys.enum.js +0 -4
  93. package/dist/es/common/scroll-anchor.directive.js +0 -87
  94. package/dist/es/common/utils.js +0 -13
  95. package/dist/es/index.js +0 -21
  96. package/dist/es/main.js +0 -8
  97. package/dist/es/package-metadata.js +0 -15
  98. package/dist/es2015/api/message.interface.js +0 -4
  99. package/dist/es2015/cards/hero-card.component.js +0 -78
  100. package/dist/es2015/chat/attachment.component.js +0 -66
  101. package/dist/es2015/chat/chat.component.js +0 -230
  102. package/dist/es2015/chat/chat.directives.js +0 -7
  103. package/dist/es2015/chat/chat.module.d.ts +0 -27
  104. package/dist/es2015/chat/l10n/custom-messages.component.js +0 -37
  105. package/dist/es2015/chat/l10n/localized-messages.directive.js +0 -32
  106. package/dist/es2015/chat/l10n/messages.js +0 -20
  107. package/dist/es2015/chat/message-list.component.js +0 -227
  108. package/dist/es2015/chat/message.component.js +0 -107
  109. package/dist/es2015/chat/suggested-actions.component.js +0 -104
  110. package/dist/es2015/common/focused-state.directive.js +0 -45
  111. package/dist/es2015/index.d.ts +0 -21
  112. package/dist/es2015/index.js +0 -21
  113. package/dist/es2015/index.metadata.json +0 -1
  114. package/dist/es2015/main.d.ts +0 -12
  115. package/dist/es2015/main.js +0 -8
  116. package/dist/fesm2015/index.js +0 -1403
  117. package/dist/fesm5/index.js +0 -1253
  118. package/dist/npm/api/action.interface.js +0 -7
  119. package/dist/npm/api/attachment.interface.js +0 -6
  120. package/dist/npm/api/execute-action-event.js +0 -26
  121. package/dist/npm/api/message.interface.js +0 -6
  122. package/dist/npm/api/post-message-event.js +0 -20
  123. package/dist/npm/api/preventable-event.js +0 -34
  124. package/dist/npm/api/user.interface.js +0 -6
  125. package/dist/npm/cards/hero-card.component.js +0 -56
  126. package/dist/npm/chat/attachment-template.directive.js +0 -34
  127. package/dist/npm/chat/attachment.component.js +0 -67
  128. package/dist/npm/chat/builtin-actions.js +0 -33
  129. package/dist/npm/chat/chat-view.js +0 -98
  130. package/dist/npm/chat/chat.component.js +0 -195
  131. package/dist/npm/chat/chat.directives.js +0 -12
  132. package/dist/npm/chat/chat.module.js +0 -78
  133. package/dist/npm/chat/l10n/custom-messages.component.js +0 -47
  134. package/dist/npm/chat/l10n/localized-messages.directive.js +0 -38
  135. package/dist/npm/chat/l10n/messages.js +0 -28
  136. package/dist/npm/chat/message-attachments.component.js +0 -150
  137. package/dist/npm/chat/message-list.component.js +0 -167
  138. package/dist/npm/chat/message-template.directive.js +0 -34
  139. package/dist/npm/chat/message.component.js +0 -79
  140. package/dist/npm/chat/suggested-actions.component.js +0 -93
  141. package/dist/npm/common/focused-state.directive.js +0 -45
  142. package/dist/npm/common/keys.enum.js +0 -6
  143. package/dist/npm/common/scroll-anchor.directive.js +0 -89
  144. package/dist/npm/common/utils.js +0 -15
  145. package/dist/npm/index.js +0 -37
  146. package/dist/npm/main.js +0 -11
  147. package/dist/npm/package-metadata.js +0 -17
  148. package/dist/systemjs/kendo-angular-conversational-ui.js +0 -5
@@ -0,0 +1,1576 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import * as i0 from '@angular/core';
6
+ import { Directive, Optional, isDevMode, forwardRef, Component, Input, HostBinding, ElementRef, ViewChild, ViewChildren, EventEmitter, Output, HostListener, ContentChild, NgModule } from '@angular/core';
7
+ import * as i1$2 from '@progress/kendo-angular-l10n';
8
+ import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
9
+ import { validatePackage } from '@progress/kendo-licensing';
10
+ import * as i1 from '@progress/kendo-angular-intl';
11
+ import * as i1$1 from '@angular/common';
12
+ import { CommonModule } from '@angular/common';
13
+ import { fromEvent } from 'rxjs';
14
+ import { debounceTime } from 'rxjs/operators';
15
+ import * as i6 from '@progress/kendo-angular-common';
16
+ import { ResizeSensorModule } from '@progress/kendo-angular-common';
17
+ import * as i6$1 from '@progress/kendo-angular-buttons';
18
+ import { ButtonModule } from '@progress/kendo-angular-buttons';
19
+
20
+ /**
21
+ * Defines a template that will be used for displaying message attachments. To define an attachment
22
+ * template, nest an `<ng-template>` tag with the `kendoChatAttachmentTemplate` attribute inside the
23
+ * `<kendo-chat>` component. The template context is set to the attachment instance. For more information,
24
+ * refer to the article on [message attachments]({% slug attachments_chat %}).
25
+ *
26
+ * {% meta height:700 %}
27
+ * {% embed_file attachments/templates/app.component.ts preview %}
28
+ * {% embed_file shared/app.module.ts preview %}
29
+ * {% embed_file shared/main.ts hidden %}
30
+ * {% endmeta %}
31
+ */
32
+ class AttachmentTemplateDirective {
33
+ constructor(templateRef) {
34
+ this.templateRef = templateRef;
35
+ }
36
+ }
37
+ AttachmentTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AttachmentTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
38
+ AttachmentTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: AttachmentTemplateDirective, selector: "[kendoChatAttachmentTemplate]", ngImport: i0 });
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AttachmentTemplateDirective, decorators: [{
40
+ type: Directive,
41
+ args: [{
42
+ selector: '[kendoChatAttachmentTemplate]'
43
+ }]
44
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
45
+ type: Optional
46
+ }] }]; } });
47
+
48
+ /**
49
+ * Arguments for the `SendMessage` event.
50
+ *
51
+ */
52
+ class SendMessageEvent {
53
+ /**
54
+ * @hidden
55
+ */
56
+ constructor(message) {
57
+ this.message = message;
58
+ }
59
+ }
60
+
61
+ const noop = () => { };
62
+ const handlers = {
63
+ 'reply': (action, sender) => {
64
+ sender.sendMessage.emit(new SendMessageEvent({
65
+ author: sender.user,
66
+ text: action.value,
67
+ timestamp: new Date()
68
+ }));
69
+ },
70
+ 'call': (action) => {
71
+ window.open('tel:' + action.value);
72
+ },
73
+ 'openUrl': (action) => {
74
+ window.open(action.value);
75
+ }
76
+ };
77
+ /**
78
+ * @hidden
79
+ */
80
+ const makeHandler = (action) => handlers[action.type] || noop;
81
+
82
+ /**
83
+ * Defines a template that will be used for displaying Chat messages. To define an attachment
84
+ * template, nest an `<ng-template>` tag with the `kendoChatMessageTemplate` attribute inside the
85
+ * `<kendo-chat>` component. The template context is set to the message instance. For more information,
86
+ * refer to the article on [message templates]({% slug message_templates_chat %}).
87
+ *
88
+ * {% meta height:700 %}
89
+ * {% embed_file messages/templates/app.component.ts preview %}
90
+ * {% embed_file shared/app.module.ts preview %}
91
+ * {% embed_file shared/main.ts hidden %}
92
+ * {% endmeta %}
93
+ */
94
+ class MessageTemplateDirective {
95
+ constructor(templateRef) {
96
+ this.templateRef = templateRef;
97
+ }
98
+ }
99
+ MessageTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
100
+ MessageTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: MessageTemplateDirective, selector: "[kendoChatMessageTemplate]", ngImport: i0 });
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageTemplateDirective, decorators: [{
102
+ type: Directive,
103
+ args: [{
104
+ selector: '[kendoChatMessageTemplate]'
105
+ }]
106
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
107
+ type: Optional
108
+ }] }]; } });
109
+
110
+ // eslint-disable max-line-length
111
+
112
+ /**
113
+ * @hidden
114
+ */
115
+ class PreventableEvent {
116
+ constructor() {
117
+ this.prevented = false;
118
+ }
119
+ /**
120
+ * Prevents the default action for a specified event.
121
+ * In this way, the source component suppresses
122
+ * the built-in behavior that follows the event.
123
+ */
124
+ preventDefault() {
125
+ this.prevented = true;
126
+ }
127
+ /**
128
+ * Returns `true` if the event was prevented
129
+ * by any of its subscribers.
130
+ *
131
+ * @returns `true` if the default action was prevented.
132
+ * Otherwise, returns `false`.
133
+ */
134
+ isDefaultPrevented() {
135
+ return this.prevented;
136
+ }
137
+ }
138
+
139
+ /**
140
+ * Arguments for the `executeAction` event. The `executeAction` event fires when the user clicks
141
+ * a quick action button. Calling `preventDefault()` suppresses the built-in action handler.
142
+ */
143
+ class ExecuteActionEvent extends PreventableEvent {
144
+ /**
145
+ * @hidden
146
+ */
147
+ constructor(action, message) {
148
+ super();
149
+ this.action = action;
150
+ this.message = message;
151
+ }
152
+ }
153
+
154
+ /**
155
+ * @hidden
156
+ */
157
+ const packageMetadata = {
158
+ name: '@progress/kendo-angular-conversational-ui',
159
+ productName: 'Kendo UI for Angular',
160
+ productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
161
+ publishDate: 1645715764,
162
+ version: '',
163
+ licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
164
+ };
165
+
166
+ /**
167
+ * @hidden
168
+ */
169
+ const closest = (node, predicate) => {
170
+ while (node && !predicate(node)) {
171
+ node = node.parentNode;
172
+ }
173
+ return node;
174
+ };
175
+
176
+ /**
177
+ * @hidden
178
+ */
179
+ class ChatItem {
180
+ }
181
+
182
+ /**
183
+ * @hidden
184
+ */
185
+ const isAuthor = (user, msg) => user && msg.author && user.id === msg.author.id;
186
+ const last = (arr) => arr[arr.length - 1];
187
+ const dateChanged = (curr, prev) => (curr && prev) && (prev.getDate() !== curr.getDate() ||
188
+ prev.getMonth() !== curr.getMonth() ||
189
+ prev.getFullYear() !== curr.getFullYear());
190
+ const addDateMarker = (acc, msg) => {
191
+ const timestamp = msg.timestamp;
192
+ const lastItem = last(acc);
193
+ if (!timestamp) {
194
+ return;
195
+ }
196
+ if (!lastItem || dateChanged(timestamp, lastItem.timestamp)) {
197
+ const dateMarker = {
198
+ type: 'date-marker',
199
+ timestamp: timestamp,
200
+ trackBy: timestamp.getTime()
201
+ };
202
+ acc.push(dateMarker);
203
+ }
204
+ };
205
+ const groupMessages = (acc, msg, isLastMessage) => {
206
+ const lastItem = last(acc);
207
+ let messages;
208
+ if (isDevMode() && !msg.author) {
209
+ throw new Error('Author must be set for message: ' + JSON.stringify(msg));
210
+ }
211
+ if (msg.typing && !isLastMessage) {
212
+ return;
213
+ }
214
+ if (lastItem && lastItem.type === 'message-group') {
215
+ messages = lastItem.messages;
216
+ }
217
+ if (messages && isAuthor(msg.author, last(messages))) {
218
+ messages.push(msg);
219
+ }
220
+ else {
221
+ acc.push({
222
+ type: 'message-group',
223
+ messages: [msg],
224
+ author: msg.author,
225
+ timestamp: msg.timestamp,
226
+ trackBy: msg
227
+ });
228
+ }
229
+ };
230
+ const groupItems = (total) => (acc, msg, index) => {
231
+ const isLastMessage = index === total - 1;
232
+ addDateMarker(acc, msg);
233
+ groupMessages(acc, msg, isLastMessage);
234
+ if (msg.attachments && msg.attachments.length > 1) {
235
+ acc.push({
236
+ type: 'attachment-group',
237
+ attachments: msg.attachments,
238
+ attachmentLayout: msg.attachmentLayout,
239
+ timestamp: msg.timestamp,
240
+ trackBy: msg
241
+ });
242
+ }
243
+ if (msg.suggestedActions && isLastMessage) {
244
+ acc.push({
245
+ type: 'action-group',
246
+ actions: msg.suggestedActions,
247
+ timestamp: msg.timestamp,
248
+ trackBy: msg
249
+ });
250
+ }
251
+ return acc;
252
+ };
253
+ /**
254
+ * @hidden
255
+ */
256
+ const chatView = (messages) => messages.reduce(groupItems(messages.length), []);
257
+
258
+ // eslint-disable no-forward-ref
259
+ /**
260
+ * @hidden
261
+ */
262
+ class MessageComponent extends ChatItem {
263
+ constructor(element, intl) {
264
+ super();
265
+ this.element = element;
266
+ this.intl = intl;
267
+ this.cssClass = true;
268
+ }
269
+ get tabIndex() {
270
+ return this.tabbable ? '0' : '-1';
271
+ }
272
+ formatTimeStamp(date) {
273
+ return this.intl.formatDate(date, { datetime: 'short' });
274
+ }
275
+ focus() {
276
+ this.element.nativeElement.focus();
277
+ }
278
+ }
279
+ MessageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }], target: i0.ɵɵFactoryTarget.Component });
280
+ MessageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MessageComponent, selector: "kendo-chat-message", inputs: { message: "message", tabbable: "tabbable", template: "template" }, host: { properties: { "class.k-message": "this.cssClass", "class.k-state-selected": "this.selected", "class.k-state-focused": "this.selected", "attr.tabIndex": "this.tabIndex" } }, providers: [{
281
+ provide: ChatItem,
282
+ useExisting: forwardRef(() => MessageComponent)
283
+ }], usesInheritance: true, ngImport: i0, template: `
284
+ <time
285
+ [attr.aria-hidden]="!selected"
286
+ class="k-message-time"
287
+ *ngIf="message.timestamp"
288
+ >
289
+ {{ formatTimeStamp(message.timestamp) }}
290
+ </time>
291
+
292
+ <ng-container *ngIf="!message.typing; else typing">
293
+ <div class="k-bubble" *ngIf="template">
294
+ <ng-container
295
+ *ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
296
+ >
297
+ </ng-container>
298
+ </div>
299
+
300
+ <div class="k-bubble" *ngIf="!template && message.text">
301
+ {{message.text}}
302
+ </div>
303
+ </ng-container>
304
+
305
+ <span
306
+ class="k-message-status"
307
+ *ngIf="message.status"
308
+ >
309
+ {{ message.status }}
310
+ </span>
311
+
312
+ <ng-template #typing>
313
+ <div class="k-bubble">
314
+ <div class="k-typing-indicator">
315
+ <span></span>
316
+ <span></span>
317
+ <span></span>
318
+ </div>
319
+ </div>
320
+ </ng-template>
321
+ `, isInline: true, directives: [{ type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageComponent, decorators: [{
323
+ type: Component,
324
+ args: [{
325
+ selector: 'kendo-chat-message',
326
+ providers: [{
327
+ provide: ChatItem,
328
+ useExisting: forwardRef(() => MessageComponent)
329
+ }],
330
+ template: `
331
+ <time
332
+ [attr.aria-hidden]="!selected"
333
+ class="k-message-time"
334
+ *ngIf="message.timestamp"
335
+ >
336
+ {{ formatTimeStamp(message.timestamp) }}
337
+ </time>
338
+
339
+ <ng-container *ngIf="!message.typing; else typing">
340
+ <div class="k-bubble" *ngIf="template">
341
+ <ng-container
342
+ *ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
343
+ >
344
+ </ng-container>
345
+ </div>
346
+
347
+ <div class="k-bubble" *ngIf="!template && message.text">
348
+ {{message.text}}
349
+ </div>
350
+ </ng-container>
351
+
352
+ <span
353
+ class="k-message-status"
354
+ *ngIf="message.status"
355
+ >
356
+ {{ message.status }}
357
+ </span>
358
+
359
+ <ng-template #typing>
360
+ <div class="k-bubble">
361
+ <div class="k-typing-indicator">
362
+ <span></span>
363
+ <span></span>
364
+ <span></span>
365
+ </div>
366
+ </div>
367
+ </ng-template>
368
+ `
369
+ }]
370
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }]; }, propDecorators: { message: [{
371
+ type: Input
372
+ }], tabbable: [{
373
+ type: Input
374
+ }], template: [{
375
+ type: Input
376
+ }], cssClass: [{
377
+ type: HostBinding,
378
+ args: ['class.k-message']
379
+ }], selected: [{
380
+ type: HostBinding,
381
+ args: ['class.k-state-selected']
382
+ }, {
383
+ type: HostBinding,
384
+ args: ['class.k-state-focused']
385
+ }], tabIndex: [{
386
+ type: HostBinding,
387
+ args: ['attr.tabIndex']
388
+ }] } });
389
+
390
+ /**
391
+ * @hidden
392
+ */
393
+ class AttachmentComponent {
394
+ set attachment(value) {
395
+ this._attachment = value;
396
+ this.context = {
397
+ $implicit: this.attachment
398
+ };
399
+ }
400
+ get attachment() {
401
+ return this._attachment;
402
+ }
403
+ get image() {
404
+ return this.contentType.indexOf('image/') === 0;
405
+ }
406
+ get unknown() {
407
+ return !this.image;
408
+ }
409
+ get contentType() {
410
+ return this.attachment.contentType || '';
411
+ }
412
+ }
413
+ AttachmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AttachmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
414
+ AttachmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: AttachmentComponent, selector: "kendo-chat-attachment", inputs: { attachment: "attachment", template: "template" }, ngImport: i0, template: `
415
+ <ng-container *ngIf="template">
416
+ <ng-container *ngTemplateOutlet="template.templateRef; context: context;">
417
+ </ng-container>
418
+ </ng-container>
419
+
420
+ <div *ngIf="!template" class="k-card">
421
+ <div class="k-card-body">
422
+ <h5 class="k-card-title" *ngIf="attachment.title">
423
+ {{ attachment.title }}
424
+ </h5>
425
+ <h6 class="k-card-subtitle" *ngIf="attachment.subtitle">
426
+ {{ attachment.subtitle }}
427
+ </h6>
428
+ <img *ngIf="image" [attr.src]="attachment.content" />
429
+ <ng-container *ngIf="unknown">
430
+ {{ attachment.content }}
431
+ </ng-container>
432
+ </div>
433
+ </div>
434
+ `, isInline: true, directives: [{ type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AttachmentComponent, decorators: [{
436
+ type: Component,
437
+ args: [{
438
+ selector: 'kendo-chat-attachment',
439
+ template: `
440
+ <ng-container *ngIf="template">
441
+ <ng-container *ngTemplateOutlet="template.templateRef; context: context;">
442
+ </ng-container>
443
+ </ng-container>
444
+
445
+ <div *ngIf="!template" class="k-card">
446
+ <div class="k-card-body">
447
+ <h5 class="k-card-title" *ngIf="attachment.title">
448
+ {{ attachment.title }}
449
+ </h5>
450
+ <h6 class="k-card-subtitle" *ngIf="attachment.subtitle">
451
+ {{ attachment.subtitle }}
452
+ </h6>
453
+ <img *ngIf="image" [attr.src]="attachment.content" />
454
+ <ng-container *ngIf="unknown">
455
+ {{ attachment.content }}
456
+ </ng-container>
457
+ </div>
458
+ </div>
459
+ `
460
+ }]
461
+ }], propDecorators: { attachment: [{
462
+ type: Input
463
+ }], template: [{
464
+ type: Input
465
+ }] } });
466
+
467
+ // eslint-disable no-forward-ref
468
+ /**
469
+ * @hidden
470
+ */
471
+ class MessageAttachmentsComponent extends ChatItem {
472
+ constructor(zone) {
473
+ super();
474
+ this.zone = zone;
475
+ this.scrollPosition = 0;
476
+ this.selectedIndex = 0;
477
+ this.carouselKeyHandlers = {
478
+ [37 /* left */]: (e) => this.navigateTo(e, -1),
479
+ [39 /* right */]: (e) => this.navigateTo(e, 1)
480
+ };
481
+ this.listKeyHandlers = {
482
+ [38 /* up */]: (e) => this.navigateTo(e, -1),
483
+ [40 /* down */]: (e) => this.navigateTo(e, 1)
484
+ };
485
+ }
486
+ get carousel() {
487
+ return this.layout !== 'list';
488
+ }
489
+ ngAfterViewInit() {
490
+ this.zone.runOutsideAngular(() => {
491
+ const scrollDebounceTime = 100;
492
+ this.scrollSubscription = fromEvent(this.deck.nativeElement, 'scroll')
493
+ .pipe(debounceTime(scrollDebounceTime))
494
+ .subscribe(() => this.onScroll());
495
+ });
496
+ }
497
+ ngOnDestroy() {
498
+ this.scrollSubscription.unsubscribe();
499
+ }
500
+ isSelected(index) {
501
+ return this.selectedIndex === index;
502
+ }
503
+ itemKeydown(e, attachment) {
504
+ const keyHandlers = this.layout === 'list' ?
505
+ this.listKeyHandlers : this.carouselKeyHandlers;
506
+ const handler = keyHandlers[e.keyCode];
507
+ if (handler) {
508
+ handler(e, attachment);
509
+ }
510
+ }
511
+ itemClick(index) {
512
+ this.select(index);
513
+ }
514
+ focus() {
515
+ this.select(this.selectedIndex);
516
+ }
517
+ scrollTo(dir) {
518
+ const el = this.deck.nativeElement;
519
+ const scrollStep = el.scrollWidth / this.items.length;
520
+ const max = el.scrollWidth - el.offsetWidth;
521
+ const pos = el.scrollLeft + scrollStep * dir;
522
+ el.scrollLeft = Math.max(0, Math.min(max, pos));
523
+ }
524
+ select(index) {
525
+ this.selectedIndex = index;
526
+ const item = this.items.toArray()[index];
527
+ if (item) {
528
+ item.nativeElement.focus();
529
+ }
530
+ }
531
+ navigateTo(e, offset) {
532
+ const prevIndex = this.selectedIndex;
533
+ const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
534
+ if (nextIndex !== prevIndex) {
535
+ this.select(nextIndex);
536
+ e.preventDefault();
537
+ }
538
+ }
539
+ onScroll() {
540
+ const el = this.deck.nativeElement;
541
+ if (el.scrollWidth === 0) {
542
+ return;
543
+ }
544
+ const pos = el.scrollLeft / (el.scrollWidth - el.offsetWidth);
545
+ if (pos !== this.scrollPosition) {
546
+ this.zone.run(() => {
547
+ this.scrollPosition = pos;
548
+ });
549
+ }
550
+ }
551
+ }
552
+ MessageAttachmentsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageAttachmentsComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
553
+ MessageAttachmentsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MessageAttachmentsComponent, selector: "kendo-chat-message-attachments", inputs: { attachments: "attachments", layout: "layout", tabbable: "tabbable", template: "template" }, host: { properties: { "class.k-card-deck-scrollwrap": "this.carousel" } }, providers: [{
554
+ provide: ChatItem,
555
+ useExisting: forwardRef(() => MessageAttachmentsComponent)
556
+ }], viewQueries: [{ propertyName: "deck", first: true, predicate: ["deck"], descendants: true, read: ElementRef, static: true }, { propertyName: "items", predicate: ["item"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: `
557
+ <button
558
+ *ngIf="carousel && scrollPosition > 0"
559
+ (click)="scrollTo(-1)"
560
+ class="k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
561
+ tabindex="-1">
562
+ <span class="k-icon k-button-icon k-i-arrow-chevron-left"></span>
563
+ </button>
564
+ <div #deck [class.k-card-deck]="carousel">
565
+ <kendo-chat-attachment #item
566
+ *ngFor="let att of attachments; index as index; first as first; last as last"
567
+ [attachment]="att"
568
+ [template]="template"
569
+ [class.k-state-selected]="isSelected(index)"
570
+ [class.k-state-focused]="isSelected(index)"
571
+ [class.k-card-wrap]="true"
572
+ [class.k-first]="first"
573
+ [class.k-last]="last"
574
+ [attr.tabindex]="tabbable && isSelected(index) ? '0' : '-1'"
575
+ (click)="itemClick(index)"
576
+ (keydown)="itemKeydown($event, att)"
577
+ >
578
+ </kendo-chat-attachment>
579
+ </div>
580
+ <button
581
+ *ngIf="carousel && scrollPosition < 1"
582
+ (click)="scrollTo(1)"
583
+ class="k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
584
+ tabindex="-1">
585
+ <span class="k-icon k-button-icon k-i-arrow-chevron-right"></span>
586
+ </button>
587
+ `, isInline: true, components: [{ type: AttachmentComponent, selector: "kendo-chat-attachment", inputs: ["attachment", "template"] }], directives: [{ type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
588
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageAttachmentsComponent, decorators: [{
589
+ type: Component,
590
+ args: [{
591
+ providers: [{
592
+ provide: ChatItem,
593
+ useExisting: forwardRef(() => MessageAttachmentsComponent)
594
+ }],
595
+ selector: 'kendo-chat-message-attachments',
596
+ template: `
597
+ <button
598
+ *ngIf="carousel && scrollPosition > 0"
599
+ (click)="scrollTo(-1)"
600
+ class="k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
601
+ tabindex="-1">
602
+ <span class="k-icon k-button-icon k-i-arrow-chevron-left"></span>
603
+ </button>
604
+ <div #deck [class.k-card-deck]="carousel">
605
+ <kendo-chat-attachment #item
606
+ *ngFor="let att of attachments; index as index; first as first; last as last"
607
+ [attachment]="att"
608
+ [template]="template"
609
+ [class.k-state-selected]="isSelected(index)"
610
+ [class.k-state-focused]="isSelected(index)"
611
+ [class.k-card-wrap]="true"
612
+ [class.k-first]="first"
613
+ [class.k-last]="last"
614
+ [attr.tabindex]="tabbable && isSelected(index) ? '0' : '-1'"
615
+ (click)="itemClick(index)"
616
+ (keydown)="itemKeydown($event, att)"
617
+ >
618
+ </kendo-chat-attachment>
619
+ </div>
620
+ <button
621
+ *ngIf="carousel && scrollPosition < 1"
622
+ (click)="scrollTo(1)"
623
+ class="k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
624
+ tabindex="-1">
625
+ <span class="k-icon k-button-icon k-i-arrow-chevron-right"></span>
626
+ </button>
627
+ `
628
+ }]
629
+ }], ctorParameters: function () { return [{ type: i0.NgZone }]; }, propDecorators: { attachments: [{
630
+ type: Input
631
+ }], layout: [{
632
+ type: Input
633
+ }], tabbable: [{
634
+ type: Input
635
+ }], template: [{
636
+ type: Input
637
+ }], carousel: [{
638
+ type: HostBinding,
639
+ args: ['class.k-card-deck-scrollwrap']
640
+ }], deck: [{
641
+ type: ViewChild,
642
+ args: ['deck', { read: ElementRef, static: true }]
643
+ }], items: [{
644
+ type: ViewChildren,
645
+ args: ['item', { read: ElementRef }]
646
+ }] } });
647
+
648
+ // eslint-disable no-forward-ref
649
+ /**
650
+ * @hidden
651
+ */
652
+ class SuggestedActionsComponent extends ChatItem {
653
+ constructor() {
654
+ super(...arguments);
655
+ this.dispatch = new EventEmitter();
656
+ this.defaultClass = true;
657
+ this.selectedIndex = 0;
658
+ this.keyHandlers = {
659
+ [37 /* left */]: (e) => this.navigateTo(e, -1),
660
+ [39 /* right */]: (e) => this.navigateTo(e, 1),
661
+ [13 /* enter */]: (_, action) => this.actionClick(action)
662
+ };
663
+ }
664
+ isSelected(index) {
665
+ return this.selected && this.selectedIndex === index;
666
+ }
667
+ actionClick(action) {
668
+ this.dispatch.next(action);
669
+ }
670
+ actionKeydown(e, action) {
671
+ const handler = this.keyHandlers[e.keyCode];
672
+ if (handler) {
673
+ handler(e, action);
674
+ }
675
+ }
676
+ focus() {
677
+ this.select(this.selectedIndex);
678
+ }
679
+ select(index) {
680
+ this.selectedIndex = index;
681
+ const item = this.items.toArray()[index];
682
+ if (item) {
683
+ item.nativeElement.focus();
684
+ }
685
+ }
686
+ navigateTo(e, offset) {
687
+ const prevIndex = this.selectedIndex;
688
+ const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
689
+ if (nextIndex !== prevIndex) {
690
+ this.select(nextIndex);
691
+ e.preventDefault();
692
+ }
693
+ }
694
+ }
695
+ SuggestedActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SuggestedActionsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
696
+ SuggestedActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SuggestedActionsComponent, selector: "kendo-chat-suggested-actions", inputs: { actions: "actions", tabbable: "tabbable" }, outputs: { dispatch: "dispatch" }, host: { properties: { "class.k-quick-replies": "this.defaultClass" } }, providers: [{
697
+ provide: ChatItem,
698
+ useExisting: forwardRef(() => SuggestedActionsComponent)
699
+ }], viewQueries: [{ propertyName: "items", predicate: ["item"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
700
+ <span #item
701
+ *ngFor="let action of actions; index as index; first as first; last as last"
702
+ class="k-quick-reply"
703
+ [class.k-state-selected]="isSelected(index)"
704
+ [class.k-state-focused]="isSelected(index)"
705
+ [class.k-first]="first"
706
+ [class.k-last]="last"
707
+ [attr.tabindex]="tabbable && selectedIndex === index ? '0' : '-1'"
708
+ (click)="actionClick(action)"
709
+ (keydown)="actionKeydown($event, action)"
710
+ >
711
+ {{ action.title || action.value }}
712
+ </span>
713
+ `, isInline: true, directives: [{ type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
714
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SuggestedActionsComponent, decorators: [{
715
+ type: Component,
716
+ args: [{
717
+ selector: 'kendo-chat-suggested-actions',
718
+ providers: [{
719
+ provide: ChatItem,
720
+ useExisting: forwardRef(() => SuggestedActionsComponent)
721
+ }],
722
+ template: `
723
+ <span #item
724
+ *ngFor="let action of actions; index as index; first as first; last as last"
725
+ class="k-quick-reply"
726
+ [class.k-state-selected]="isSelected(index)"
727
+ [class.k-state-focused]="isSelected(index)"
728
+ [class.k-first]="first"
729
+ [class.k-last]="last"
730
+ [attr.tabindex]="tabbable && selectedIndex === index ? '0' : '-1'"
731
+ (click)="actionClick(action)"
732
+ (keydown)="actionKeydown($event, action)"
733
+ >
734
+ {{ action.title || action.value }}
735
+ </span>
736
+ `
737
+ }]
738
+ }], propDecorators: { actions: [{
739
+ type: Input
740
+ }], tabbable: [{
741
+ type: Input
742
+ }], dispatch: [{
743
+ type: Output
744
+ }], defaultClass: [{
745
+ type: HostBinding,
746
+ args: ['class.k-quick-replies']
747
+ }], items: [{
748
+ type: ViewChildren,
749
+ args: ['item']
750
+ }] } });
751
+
752
+ /**
753
+ * @hidden
754
+ */
755
+ class MessageListComponent {
756
+ constructor(element, intl) {
757
+ this.element = element;
758
+ this.intl = intl;
759
+ this.executeAction = new EventEmitter();
760
+ this.navigate = new EventEmitter();
761
+ this.resize = new EventEmitter();
762
+ this.cssClass = true;
763
+ this.view = [];
764
+ this.keyActions = {
765
+ [38 /* up */]: (e) => this.navigateTo(e, -1),
766
+ [40 /* down */]: (e) => this.navigateTo(e, 1)
767
+ };
768
+ }
769
+ set messages(value) {
770
+ const data = value || [];
771
+ this.view = chatView(data);
772
+ this._messages = data;
773
+ }
774
+ get messages() {
775
+ return this._messages;
776
+ }
777
+ ngAfterViewInit() {
778
+ this.selectedItem = this.items.last;
779
+ }
780
+ onResize() {
781
+ this.resize.emit();
782
+ }
783
+ formatTimeStamp(date) {
784
+ return this.intl.formatDate(date, { date: 'full' });
785
+ }
786
+ onKeydown(e) {
787
+ const action = this.keyActions[e.keyCode];
788
+ if (action) {
789
+ action(e);
790
+ }
791
+ }
792
+ onBlur(args) {
793
+ const next = args.relatedTarget || document.activeElement;
794
+ const outside = !closest(next, (node) => node === this.element.nativeElement);
795
+ if (outside) {
796
+ this.select(null);
797
+ }
798
+ }
799
+ isOwnMessage(msg) {
800
+ return isAuthor(this.user, msg);
801
+ }
802
+ dispatchAction(action, message) {
803
+ const args = new ExecuteActionEvent(action, message);
804
+ this.executeAction.emit(args);
805
+ }
806
+ trackGroup(_index, item) {
807
+ return item.trackBy;
808
+ }
809
+ select(item) {
810
+ const prevItem = this.selectedItem;
811
+ if (prevItem) {
812
+ prevItem.selected = false;
813
+ }
814
+ if (item) {
815
+ item.selected = true;
816
+ this.selectedItem = item;
817
+ }
818
+ }
819
+ last(items) {
820
+ if (!items || items.length === 0) {
821
+ return;
822
+ }
823
+ return items[items.length - 1];
824
+ }
825
+ navigateTo(e, offset) {
826
+ const items = this.items.toArray();
827
+ const prevItem = this.selectedItem;
828
+ const prevIndex = items.indexOf(prevItem);
829
+ const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
830
+ const nextItem = items[nextIndex];
831
+ if (nextItem !== prevItem) {
832
+ this.select(nextItem);
833
+ nextItem.focus();
834
+ this.navigate.emit();
835
+ e.preventDefault();
836
+ }
837
+ }
838
+ }
839
+ MessageListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageListComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }], target: i0.ɵɵFactoryTarget.Component });
840
+ MessageListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MessageListComponent, selector: "kendo-chat-message-list", inputs: { messages: "messages", attachmentTemplate: "attachmentTemplate", messageTemplate: "messageTemplate", user: "user" }, outputs: { executeAction: "executeAction", navigate: "navigate", resize: "resize" }, host: { listeners: { "keydown": "onKeydown($event)", "focusout": "onBlur($event)" }, properties: { "class.k-message-list-content": "this.cssClass" } }, viewQueries: [{ propertyName: "items", predicate: ChatItem, descendants: true }], ngImport: i0, template: `
841
+ <ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
842
+ <ng-container [ngSwitch]="group.type">
843
+ <div
844
+ *ngSwitchCase="'date-marker'"
845
+ class="k-timestamp"
846
+ >
847
+ {{ formatTimeStamp(group.timestamp) }}
848
+ </div>
849
+ <div
850
+ *ngSwitchCase="'message-group'"
851
+ class="k-message-group"
852
+ [class.k-alt]="isOwnMessage(group.messages[0])"
853
+ [class.k-no-avatar]="!group.author.avatarUrl"
854
+ >
855
+ <img
856
+ *ngIf="group.author.avatarUrl"
857
+ [attr.src]="group.author.avatarUrl"
858
+ class="k-avatar"
859
+ />
860
+ <p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
861
+ <ng-container
862
+ *ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
863
+ >
864
+ <img *ngIf="msg.user?.avatarUrl" [src]="msg.user?.avatarUrl" class="k-avatar">
865
+ <kendo-chat-message #message
866
+ [message]="msg"
867
+ [tabbable]="lastGroup && lastMessage"
868
+ [template]="messageTemplate"
869
+ (click)="select(message)"
870
+ (focus)="select(message)"
871
+ [class.k-only]="group.messages.length === 1"
872
+ [class.k-first]="group.messages.length > 1 && firstMessage"
873
+ [class.k-last]="group.messages.length > 1 && lastMessage"
874
+ >
875
+ </kendo-chat-message>
876
+
877
+ <kendo-chat-attachment
878
+ *ngIf="msg.attachments && msg.attachments.length === 1"
879
+ [attachment]="msg.attachments[0]"
880
+ [template]="attachmentTemplate"
881
+ >
882
+ </kendo-chat-attachment>
883
+ </ng-container>
884
+ </div>
885
+
886
+ <kendo-chat-message-attachments #attachments
887
+ *ngSwitchCase="'attachment-group'"
888
+ [attachments]="group.attachments"
889
+ [layout]="group.attachmentLayout"
890
+ [tabbable]="lastGroup"
891
+ [template]="attachmentTemplate"
892
+ (click)="select(attachments)"
893
+ (focus)="select(attachments)"
894
+ >
895
+ </kendo-chat-message-attachments>
896
+
897
+ <kendo-chat-suggested-actions #actions
898
+ *ngSwitchCase="'action-group'"
899
+ [actions]="group.actions"
900
+ [tabbable]="lastGroup"
901
+ (dispatch)="dispatchAction($event, last(group.messages))"
902
+ (click)="select(actions)"
903
+ (focus)="select(actions)"
904
+ >
905
+ </kendo-chat-suggested-actions>
906
+ </ng-container>
907
+ </ng-container>
908
+ <kendo-resize-sensor (resize)="onResize()">
909
+ </kendo-resize-sensor>
910
+ `, isInline: true, components: [{ type: MessageComponent, selector: "kendo-chat-message", inputs: ["message", "tabbable", "template"] }, { type: AttachmentComponent, selector: "kendo-chat-attachment", inputs: ["attachment", "template"] }, { type: MessageAttachmentsComponent, selector: "kendo-chat-message-attachments", inputs: ["attachments", "layout", "tabbable", "template"] }, { type: SuggestedActionsComponent, selector: "kendo-chat-suggested-actions", inputs: ["actions", "tabbable"], outputs: ["dispatch"] }, { type: i6.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], directives: [{ type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
911
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageListComponent, decorators: [{
912
+ type: Component,
913
+ args: [{
914
+ selector: 'kendo-chat-message-list',
915
+ template: `
916
+ <ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
917
+ <ng-container [ngSwitch]="group.type">
918
+ <div
919
+ *ngSwitchCase="'date-marker'"
920
+ class="k-timestamp"
921
+ >
922
+ {{ formatTimeStamp(group.timestamp) }}
923
+ </div>
924
+ <div
925
+ *ngSwitchCase="'message-group'"
926
+ class="k-message-group"
927
+ [class.k-alt]="isOwnMessage(group.messages[0])"
928
+ [class.k-no-avatar]="!group.author.avatarUrl"
929
+ >
930
+ <img
931
+ *ngIf="group.author.avatarUrl"
932
+ [attr.src]="group.author.avatarUrl"
933
+ class="k-avatar"
934
+ />
935
+ <p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
936
+ <ng-container
937
+ *ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
938
+ >
939
+ <img *ngIf="msg.user?.avatarUrl" [src]="msg.user?.avatarUrl" class="k-avatar">
940
+ <kendo-chat-message #message
941
+ [message]="msg"
942
+ [tabbable]="lastGroup && lastMessage"
943
+ [template]="messageTemplate"
944
+ (click)="select(message)"
945
+ (focus)="select(message)"
946
+ [class.k-only]="group.messages.length === 1"
947
+ [class.k-first]="group.messages.length > 1 && firstMessage"
948
+ [class.k-last]="group.messages.length > 1 && lastMessage"
949
+ >
950
+ </kendo-chat-message>
951
+
952
+ <kendo-chat-attachment
953
+ *ngIf="msg.attachments && msg.attachments.length === 1"
954
+ [attachment]="msg.attachments[0]"
955
+ [template]="attachmentTemplate"
956
+ >
957
+ </kendo-chat-attachment>
958
+ </ng-container>
959
+ </div>
960
+
961
+ <kendo-chat-message-attachments #attachments
962
+ *ngSwitchCase="'attachment-group'"
963
+ [attachments]="group.attachments"
964
+ [layout]="group.attachmentLayout"
965
+ [tabbable]="lastGroup"
966
+ [template]="attachmentTemplate"
967
+ (click)="select(attachments)"
968
+ (focus)="select(attachments)"
969
+ >
970
+ </kendo-chat-message-attachments>
971
+
972
+ <kendo-chat-suggested-actions #actions
973
+ *ngSwitchCase="'action-group'"
974
+ [actions]="group.actions"
975
+ [tabbable]="lastGroup"
976
+ (dispatch)="dispatchAction($event, last(group.messages))"
977
+ (click)="select(actions)"
978
+ (focus)="select(actions)"
979
+ >
980
+ </kendo-chat-suggested-actions>
981
+ </ng-container>
982
+ </ng-container>
983
+ <kendo-resize-sensor (resize)="onResize()">
984
+ </kendo-resize-sensor>
985
+ `
986
+ }]
987
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }]; }, propDecorators: { messages: [{
988
+ type: Input
989
+ }], attachmentTemplate: [{
990
+ type: Input
991
+ }], messageTemplate: [{
992
+ type: Input
993
+ }], user: [{
994
+ type: Input
995
+ }], executeAction: [{
996
+ type: Output
997
+ }], navigate: [{
998
+ type: Output
999
+ }], resize: [{
1000
+ type: Output
1001
+ }], items: [{
1002
+ type: ViewChildren,
1003
+ args: [ChatItem]
1004
+ }], cssClass: [{
1005
+ type: HostBinding,
1006
+ args: ['class.k-message-list-content']
1007
+ }], onKeydown: [{
1008
+ type: HostListener,
1009
+ args: ['keydown', ['$event']]
1010
+ }], onBlur: [{
1011
+ type: HostListener,
1012
+ args: ['focusout', ['$event']]
1013
+ }] } });
1014
+
1015
+ /**
1016
+ * @hidden
1017
+ */
1018
+ class Messages extends ComponentMessages {
1019
+ }
1020
+ Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1021
+ Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: Messages, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send" }, usesInheritance: true, ngImport: i0 });
1022
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, decorators: [{
1023
+ type: Directive,
1024
+ args: [{
1025
+ selector: 'kendoConversationalUIMessages'
1026
+ }]
1027
+ }], propDecorators: { messagePlaceholder: [{
1028
+ type: Input
1029
+ }], send: [{
1030
+ type: Input
1031
+ }] } });
1032
+
1033
+ // eslint-disable no-forward-ref
1034
+ /**
1035
+ * @hidden
1036
+ */
1037
+ class LocalizedMessagesDirective extends Messages {
1038
+ constructor(service) {
1039
+ super();
1040
+ this.service = service;
1041
+ }
1042
+ }
1043
+ LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$2.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
1044
+ LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: LocalizedMessagesDirective, selector: "[kendoChatLocalizedMessages]", providers: [
1045
+ {
1046
+ provide: Messages,
1047
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
1048
+ }
1049
+ ], usesInheritance: true, ngImport: i0 });
1050
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
1051
+ type: Directive,
1052
+ args: [{
1053
+ providers: [
1054
+ {
1055
+ provide: Messages,
1056
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
1057
+ }
1058
+ ],
1059
+ selector: '[kendoChatLocalizedMessages]'
1060
+ }]
1061
+ }], ctorParameters: function () { return [{ type: i1$2.LocalizationService }]; } });
1062
+
1063
+ // Consider scroll to be at the bottom when within this number of pixels from the container height.
1064
+ const maxDelta = 2;
1065
+ /**
1066
+ * @hidden
1067
+ */
1068
+ class ScrollAnchorDirective {
1069
+ constructor(element, zone, renderer) {
1070
+ this.element = element;
1071
+ this.zone = zone;
1072
+ this.renderer = renderer;
1073
+ this.autoScroll = true;
1074
+ this.autoScrollChange = new EventEmitter();
1075
+ this.overflowAnchor = 'none';
1076
+ this.scrolling = false;
1077
+ }
1078
+ ngOnInit() {
1079
+ this.zone.runOutsideAngular(() => {
1080
+ this.unsubscribe = this.renderer.listen(this.element.nativeElement, 'scroll', () => this.onScroll());
1081
+ });
1082
+ }
1083
+ ngAfterViewInit() {
1084
+ this.scrollToBottom();
1085
+ }
1086
+ ngOnDestroy() {
1087
+ if (this.unsubscribe) {
1088
+ this.unsubscribe();
1089
+ }
1090
+ }
1091
+ onScroll() {
1092
+ if (this.scrolling) {
1093
+ return;
1094
+ }
1095
+ const el = this.element.nativeElement;
1096
+ const bottom = el.scrollTop + el.offsetHeight;
1097
+ const height = el.scrollHeight;
1098
+ const atBottom = height - bottom < maxDelta;
1099
+ if (this.autoScroll !== atBottom) {
1100
+ this.zone.run(() => {
1101
+ this.autoScroll = atBottom;
1102
+ this.autoScrollChange.emit(this.autoScroll);
1103
+ });
1104
+ }
1105
+ }
1106
+ scrollToBottom() {
1107
+ if (!this.autoScroll) {
1108
+ return;
1109
+ }
1110
+ const el = this.element.nativeElement;
1111
+ el.scrollTop = el.scrollHeight - el.clientHeight;
1112
+ this.scrolling = true;
1113
+ this.zone.runOutsideAngular(() => setTimeout(() => this.scrolling = false, 1000));
1114
+ }
1115
+ }
1116
+ ScrollAnchorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ScrollAnchorDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1117
+ ScrollAnchorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ScrollAnchorDirective, selector: "[kendoChatScrollAnchor]", inputs: { autoScroll: "autoScroll" }, outputs: { autoScrollChange: "autoScrollChange" }, host: { properties: { "style.overflow-anchor": "this.overflowAnchor" } }, exportAs: ["scrollAnchor"], ngImport: i0 });
1118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ScrollAnchorDirective, decorators: [{
1119
+ type: Directive,
1120
+ args: [{
1121
+ selector: '[kendoChatScrollAnchor]',
1122
+ exportAs: 'scrollAnchor'
1123
+ }]
1124
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { autoScroll: [{
1125
+ type: Input
1126
+ }], autoScrollChange: [{
1127
+ type: Output
1128
+ }], overflowAnchor: [{
1129
+ type: HostBinding,
1130
+ args: ['style.overflow-anchor']
1131
+ }] } });
1132
+
1133
+ /**
1134
+ * @hidden
1135
+ */
1136
+ class FocusedStateDirective {
1137
+ constructor() {
1138
+ this.focused = false;
1139
+ }
1140
+ onFocus() {
1141
+ this.focused = true;
1142
+ }
1143
+ onBlur() {
1144
+ this.focused = false;
1145
+ }
1146
+ }
1147
+ FocusedStateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusedStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1148
+ FocusedStateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FocusedStateDirective, selector: "[kendoChatFocusedState]", host: { listeners: { "focusin": "onFocus()", "focusout": "onBlur()" }, properties: { "class.k-state-focused": "this.focused" } }, ngImport: i0 });
1149
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusedStateDirective, decorators: [{
1150
+ type: Directive,
1151
+ args: [{
1152
+ selector: '[kendoChatFocusedState]'
1153
+ }]
1154
+ }], propDecorators: { focused: [{
1155
+ type: HostBinding,
1156
+ args: ['class.k-state-focused']
1157
+ }], onFocus: [{
1158
+ type: HostListener,
1159
+ args: ['focusin']
1160
+ }], onBlur: [{
1161
+ type: HostListener,
1162
+ args: ['focusout']
1163
+ }] } });
1164
+
1165
+ // eslint-disable-next-line max-line-length
1166
+ const sendIcon = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path d="M0,14.3c-0.1,0.6,0.3,0.8,0.8,0.6l14.8-6.5c0.5-0.2,0.5-0.6,0-0.8L0.8,1.1C0.3,0.9-0.1,1.1,0,1.7l0.7,4.2C0.8,6.5,1.4,7,1.9,7.1l8.8,0.8c0.6,0.1,0.6,0.1,0,0.2L1.9,8.9C1.4,9,0.8,9.5,0.7,10.1L0,14.3z"/></svg>';
1167
+ /**
1168
+ * Represents the Kendo UI Chat component for Angular.
1169
+ *
1170
+ * {% meta height:700 %}
1171
+ * {% embed_file echo/app.component.ts preview %}
1172
+ * {% embed_file shared/app.module.ts %}
1173
+ * {% embed_file shared/main.ts hidden %}
1174
+ * {% endmeta %}
1175
+ *
1176
+ */
1177
+ class ChatComponent {
1178
+ constructor(localization, zone) {
1179
+ this.localization = localization;
1180
+ this.zone = zone;
1181
+ /**
1182
+ * Fires when the user types a message and clicks the **Send** button or presses **Enter**.
1183
+ * Emits the [`SendMessageEvent`]({% slug api_conversational-ui_sendmessageevent %}).
1184
+ *
1185
+ * > The message is not automatically appended to the `messages` array.
1186
+ */
1187
+ this.sendMessage = new EventEmitter();
1188
+ /**
1189
+ * Fires when the user clicks a quick action button.
1190
+ * The Chat internally handles the `reply`, `openUrl`, and `call` [known actions]({% slug api_conversational-ui_actiontype %}).
1191
+ *
1192
+ * Emits the [`ExecuteActionEvent`]({% slug api_conversational-ui_executeactionevent %}).
1193
+ * The event is preventable. If `preventDefault` is called, the built-in action will be suppressed.
1194
+ */
1195
+ this.executeAction = new EventEmitter();
1196
+ /**
1197
+ * @hidden
1198
+ */
1199
+ this.autoScroll = true;
1200
+ validatePackage(packageMetadata);
1201
+ this.direction = localization.rtl ? 'rtl' : 'ltr';
1202
+ this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
1203
+ this.direction = rtl ? 'rtl' : 'ltr';
1204
+ });
1205
+ }
1206
+ get className() {
1207
+ return 'k-widget k-chat';
1208
+ }
1209
+ get dirAttr() {
1210
+ return this.direction;
1211
+ }
1212
+ ngOnChanges() {
1213
+ this.zone.runOutsideAngular(() => setTimeout(() => {
1214
+ this.messageList.nativeElement.style.flex = '1 1 auto';
1215
+ }));
1216
+ }
1217
+ ngAfterViewInit() {
1218
+ if (!isDevMode()) {
1219
+ return;
1220
+ }
1221
+ if (!this.user) {
1222
+ throw new Error('User must be set and have a valid id.');
1223
+ }
1224
+ }
1225
+ ngOnDestroy() {
1226
+ if (this.localizationChangeSubscription) {
1227
+ this.localizationChangeSubscription.unsubscribe();
1228
+ }
1229
+ }
1230
+ /**
1231
+ * @hidden
1232
+ */
1233
+ sendClick() {
1234
+ const input = this.messageInput.nativeElement;
1235
+ const value = input.value;
1236
+ if (!value) {
1237
+ return;
1238
+ }
1239
+ const message = {
1240
+ author: this.user,
1241
+ text: value,
1242
+ timestamp: new Date()
1243
+ };
1244
+ this.sendMessage.emit(new SendMessageEvent(message));
1245
+ input.value = null;
1246
+ input.focus();
1247
+ this.autoScroll = true;
1248
+ }
1249
+ /**
1250
+ * @hidden
1251
+ */
1252
+ inputKeydown(e) {
1253
+ if (e.keyCode === 13 /* enter */) {
1254
+ this.sendClick();
1255
+ }
1256
+ }
1257
+ /**
1258
+ * @hidden
1259
+ */
1260
+ dispatchAction(e) {
1261
+ this.executeAction.emit(e);
1262
+ if (!e.isDefaultPrevented()) {
1263
+ const handler = makeHandler(e.action);
1264
+ handler(e.action, this);
1265
+ this.messageInput.nativeElement.focus();
1266
+ }
1267
+ }
1268
+ /**
1269
+ * @hidden
1270
+ */
1271
+ textFor(key) {
1272
+ return this.localization.get(key);
1273
+ }
1274
+ }
1275
+ ChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatComponent, deps: [{ token: i1$2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1276
+ ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ChatComponent, selector: "kendo-chat", inputs: { messages: "messages", user: "user" }, outputs: { sendMessage: "sendMessage", executeAction: "executeAction" }, host: { properties: { "class": "this.className", "attr.dir": "this.dirAttr" } }, providers: [
1277
+ LocalizationService,
1278
+ {
1279
+ provide: L10N_PREFIX,
1280
+ useValue: 'kendo.chat'
1281
+ }
1282
+ ], queries: [{ propertyName: "attachmentTemplate", first: true, predicate: AttachmentTemplateDirective, descendants: true }, { propertyName: "messageTemplate", first: true, predicate: MessageTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "messageInput", first: true, predicate: ["messageInput"], descendants: true, static: true }, { propertyName: "messageList", first: true, predicate: ["messageList"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "\n <ng-container\n kendoChatLocalizedMessages\n i18n-messagePlaceholder=\"kendo.chat.messagePlaceholder|The placholder text of the message text input\"\n messagePlaceholder=\"Type a message...\"\n\n i18n-send=\"kendo.chat.send|The text for the Send button\"\n send=\"Send...\"\n >\n </ng-container>\n\n <div\n #messageList\n class=\"k-message-list k-avatars\"\n aria-live=\"polite\" role=\"log\"\n kendoChatScrollAnchor\n #anchor=\"scrollAnchor\"\n [(autoScroll)]=\"autoScroll\"\n >\n <kendo-chat-message-list\n [messages]=\"messages\"\n [messageTemplate]=\"messageTemplate\"\n [attachmentTemplate]=\"attachmentTemplate\"\n [user]=\"user\"\n (executeAction)=\"dispatchAction($event)\"\n (resize)=\"anchor.scrollToBottom()\"\n (navigate)=\"this.autoScroll = false\"\n >\n </kendo-chat-message-list>\n </div>\n\n <div class=\"k-message-box\">\n <input\n #messageInput\n kendoChatFocusedState\n type=\"text\"\n class=\"k-input\"\n [placeholder]=\"textFor('messagePlaceholder')\"\n (keydown)=\"inputKeydown($event)\"\n >\n <button\n kendoButton\n fillMode=\"flat\"\n class=\"k-button-send\"\n tabindex=\"-1\"\n [attr.title]=\"textFor('send')\"\n (click)=\"sendClick()\"\n ><svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"0 0 16 16\"><path d=\"M0,14.3c-0.1,0.6,0.3,0.8,0.8,0.6l14.8-6.5c0.5-0.2,0.5-0.6,0-0.8L0.8,1.1C0.3,0.9-0.1,1.1,0,1.7l0.7,4.2C0.8,6.5,1.4,7,1.9,7.1l8.8,0.8c0.6,0.1,0.6,0.1,0,0.2L1.9,8.9C1.4,9,0.8,9.5,0.7,10.1L0,14.3z\"/></svg></button>\n </div>\n ", isInline: true, components: [{ type: MessageListComponent, selector: "kendo-chat-message-list", inputs: ["messages", "attachmentTemplate", "messageTemplate", "user"], outputs: ["executeAction", "navigate", "resize"] }], directives: [{ type: LocalizedMessagesDirective, selector: "[kendoChatLocalizedMessages]" }, { type: ScrollAnchorDirective, selector: "[kendoChatScrollAnchor]", inputs: ["autoScroll"], outputs: ["autoScrollChange"], exportAs: ["scrollAnchor"] }, { type: FocusedStateDirective, selector: "[kendoChatFocusedState]" }, { type: i6$1.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "shape", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
1283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatComponent, decorators: [{
1284
+ type: Component,
1285
+ args: [{
1286
+ providers: [
1287
+ LocalizationService,
1288
+ {
1289
+ provide: L10N_PREFIX,
1290
+ useValue: 'kendo.chat'
1291
+ }
1292
+ ],
1293
+ selector: 'kendo-chat',
1294
+ template: `
1295
+ <ng-container
1296
+ kendoChatLocalizedMessages
1297
+ i18n-messagePlaceholder="kendo.chat.messagePlaceholder|The placholder text of the message text input"
1298
+ messagePlaceholder="Type a message..."
1299
+
1300
+ i18n-send="kendo.chat.send|The text for the Send button"
1301
+ send="Send..."
1302
+ >
1303
+ </ng-container>
1304
+
1305
+ <div
1306
+ #messageList
1307
+ class="k-message-list k-avatars"
1308
+ aria-live="polite" role="log"
1309
+ kendoChatScrollAnchor
1310
+ #anchor="scrollAnchor"
1311
+ [(autoScroll)]="autoScroll"
1312
+ >
1313
+ <kendo-chat-message-list
1314
+ [messages]="messages"
1315
+ [messageTemplate]="messageTemplate"
1316
+ [attachmentTemplate]="attachmentTemplate"
1317
+ [user]="user"
1318
+ (executeAction)="dispatchAction($event)"
1319
+ (resize)="anchor.scrollToBottom()"
1320
+ (navigate)="this.autoScroll = false"
1321
+ >
1322
+ </kendo-chat-message-list>
1323
+ </div>
1324
+
1325
+ <div class="k-message-box">
1326
+ <input
1327
+ #messageInput
1328
+ kendoChatFocusedState
1329
+ type="text"
1330
+ class="k-input"
1331
+ [placeholder]="textFor('messagePlaceholder')"
1332
+ (keydown)="inputKeydown($event)"
1333
+ >
1334
+ <button
1335
+ kendoButton
1336
+ fillMode="flat"
1337
+ class="k-button-send"
1338
+ tabindex="-1"
1339
+ [attr.title]="textFor('send')"
1340
+ (click)="sendClick()"
1341
+ >${sendIcon}</button>
1342
+ </div>
1343
+ `
1344
+ }]
1345
+ }], ctorParameters: function () { return [{ type: i1$2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { messages: [{
1346
+ type: Input
1347
+ }], user: [{
1348
+ type: Input
1349
+ }], sendMessage: [{
1350
+ type: Output
1351
+ }], executeAction: [{
1352
+ type: Output
1353
+ }], className: [{
1354
+ type: HostBinding,
1355
+ args: ['class']
1356
+ }], dirAttr: [{
1357
+ type: HostBinding,
1358
+ args: ['attr.dir']
1359
+ }], attachmentTemplate: [{
1360
+ type: ContentChild,
1361
+ args: [AttachmentTemplateDirective, { static: false }]
1362
+ }], messageTemplate: [{
1363
+ type: ContentChild,
1364
+ args: [MessageTemplateDirective, { static: false }]
1365
+ }], messageInput: [{
1366
+ type: ViewChild,
1367
+ args: ['messageInput', { static: true }]
1368
+ }], messageList: [{
1369
+ type: ViewChild,
1370
+ args: ['messageList', { static: true }]
1371
+ }] } });
1372
+
1373
+ // eslint-disable no-forward-ref
1374
+ /**
1375
+ * Custom component messages override default component messages
1376
+ * ([see example]({% slug globalization_chat %}#toc-custom-messages)).
1377
+ */
1378
+ class CustomMessagesComponent extends Messages {
1379
+ constructor(service) {
1380
+ super();
1381
+ this.service = service;
1382
+ }
1383
+ get override() {
1384
+ return true;
1385
+ }
1386
+ }
1387
+ CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1$2.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1388
+ CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CustomMessagesComponent, selector: "kendo-chat-messages", providers: [
1389
+ {
1390
+ provide: Messages,
1391
+ useExisting: forwardRef(() => CustomMessagesComponent)
1392
+ }
1393
+ ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
1394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, decorators: [{
1395
+ type: Component,
1396
+ args: [{
1397
+ providers: [
1398
+ {
1399
+ provide: Messages,
1400
+ useExisting: forwardRef(() => CustomMessagesComponent)
1401
+ }
1402
+ ],
1403
+ selector: 'kendo-chat-messages',
1404
+ template: ``
1405
+ }]
1406
+ }], ctorParameters: function () { return [{ type: i1$2.LocalizationService }]; } });
1407
+
1408
+ /**
1409
+ * Represents a Hero Card component ([see example]({% slug dialogflow_chat %})).
1410
+ * Hero cards host a single large image and action buttons with text content.
1411
+ */
1412
+ class HeroCardComponent {
1413
+ constructor() {
1414
+ this.cssClass = true;
1415
+ /**
1416
+ * Fires when the user clicks a button.
1417
+ */
1418
+ this.executeAction = new EventEmitter();
1419
+ }
1420
+ onClick(action) {
1421
+ this.executeAction.next(action);
1422
+ }
1423
+ }
1424
+ HeroCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: HeroCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1425
+ HeroCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: HeroCardComponent, selector: "kendo-chat-hero-card", inputs: { imageUrl: "imageUrl", title: "title", subtitle: "subtitle", actions: "actions" }, outputs: { executeAction: "executeAction" }, host: { properties: { "class.k-card": "this.cssClass" } }, ngImport: i0, template: `
1426
+ <img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
1427
+ <div class="k-card-body">
1428
+ <h5 class="k-card-title" *ngIf="title">
1429
+ {{ title }}
1430
+ </h5>
1431
+ <h6 class="k-card-subtitle" *ngIf="subtitle">
1432
+ {{ subtitle }}
1433
+ </h6>
1434
+ </div>
1435
+ <div class="k-card-actions k-card-actions-vertical">
1436
+ <span class="k-card-action"
1437
+ *ngFor="let act of actions"
1438
+ >
1439
+ <button
1440
+ kendoButton fillMode="flat"
1441
+ (click)="onClick(act)">
1442
+ {{ act.title }}
1443
+ </button>
1444
+ </span>
1445
+ </div>
1446
+ `, isInline: true, directives: [{ type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6$1.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "shape", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
1447
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: HeroCardComponent, decorators: [{
1448
+ type: Component,
1449
+ args: [{
1450
+ selector: 'kendo-chat-hero-card',
1451
+ template: `
1452
+ <img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
1453
+ <div class="k-card-body">
1454
+ <h5 class="k-card-title" *ngIf="title">
1455
+ {{ title }}
1456
+ </h5>
1457
+ <h6 class="k-card-subtitle" *ngIf="subtitle">
1458
+ {{ subtitle }}
1459
+ </h6>
1460
+ </div>
1461
+ <div class="k-card-actions k-card-actions-vertical">
1462
+ <span class="k-card-action"
1463
+ *ngFor="let act of actions"
1464
+ >
1465
+ <button
1466
+ kendoButton fillMode="flat"
1467
+ (click)="onClick(act)">
1468
+ {{ act.title }}
1469
+ </button>
1470
+ </span>
1471
+ </div>
1472
+ `
1473
+ }]
1474
+ }], propDecorators: { imageUrl: [{
1475
+ type: Input
1476
+ }], title: [{
1477
+ type: Input
1478
+ }], subtitle: [{
1479
+ type: Input
1480
+ }], actions: [{
1481
+ type: Input
1482
+ }], cssClass: [{
1483
+ type: HostBinding,
1484
+ args: ['class.k-card']
1485
+ }], executeAction: [{
1486
+ type: Output
1487
+ }] } });
1488
+
1489
+ const PUBLIC_DIRECTIVES = [
1490
+ ChatComponent,
1491
+ CustomMessagesComponent,
1492
+ AttachmentTemplateDirective,
1493
+ MessageTemplateDirective,
1494
+ HeroCardComponent
1495
+ ];
1496
+ const PRIVATE_DIRECTIVES = [
1497
+ AttachmentComponent,
1498
+ FocusedStateDirective,
1499
+ LocalizedMessagesDirective,
1500
+ MessageAttachmentsComponent,
1501
+ MessageComponent,
1502
+ MessageListComponent,
1503
+ MessageTemplateDirective,
1504
+ ScrollAnchorDirective,
1505
+ SuggestedActionsComponent
1506
+ ];
1507
+ /**
1508
+ * The [NgModule]({{ site.data.urls.angular['ngmodules'] }}) for the Chat component.
1509
+ *
1510
+ * @example
1511
+ * ```ts-no-run
1512
+ * import { NgModule } from '@angular/core';
1513
+ * import { Component } from '@angular/core';
1514
+ * import { BrowserModule } from '@angular/platform-browser';
1515
+ *
1516
+ * import { ChatModule } from '@progress/kendo-angular-conversational-ui';
1517
+ * import { AppComponent } from './app.component';
1518
+ *
1519
+ * _@NgModule({
1520
+ * imports: [ BrowserModule, ChatModule ],
1521
+ * declarations: [ AppComponent ],
1522
+ * bootstrap: [ AppComponent ]
1523
+ * })
1524
+ *
1525
+ * export class AppModule { }
1526
+ * ```
1527
+ */
1528
+ class ChatModule {
1529
+ }
1530
+ ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1531
+ ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatModule, declarations: [ChatComponent,
1532
+ CustomMessagesComponent,
1533
+ AttachmentTemplateDirective,
1534
+ MessageTemplateDirective,
1535
+ HeroCardComponent, AttachmentComponent,
1536
+ FocusedStateDirective,
1537
+ LocalizedMessagesDirective,
1538
+ MessageAttachmentsComponent,
1539
+ MessageComponent,
1540
+ MessageListComponent,
1541
+ MessageTemplateDirective,
1542
+ ScrollAnchorDirective,
1543
+ SuggestedActionsComponent], imports: [ButtonModule,
1544
+ CommonModule,
1545
+ ResizeSensorModule], exports: [ChatComponent,
1546
+ CustomMessagesComponent,
1547
+ AttachmentTemplateDirective,
1548
+ MessageTemplateDirective,
1549
+ HeroCardComponent] });
1550
+ ChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatModule, imports: [[
1551
+ ButtonModule,
1552
+ CommonModule,
1553
+ ResizeSensorModule
1554
+ ]] });
1555
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatModule, decorators: [{
1556
+ type: NgModule,
1557
+ args: [{
1558
+ declarations: [
1559
+ ...PUBLIC_DIRECTIVES,
1560
+ ...PRIVATE_DIRECTIVES
1561
+ ],
1562
+ exports: [PUBLIC_DIRECTIVES],
1563
+ imports: [
1564
+ ButtonModule,
1565
+ CommonModule,
1566
+ ResizeSensorModule
1567
+ ]
1568
+ }]
1569
+ }] });
1570
+
1571
+ /**
1572
+ * Generated bundle index. Do not edit.
1573
+ */
1574
+
1575
+ export { AttachmentTemplateDirective, ChatComponent, ChatModule, CustomMessagesComponent, ExecuteActionEvent, HeroCardComponent, MessageTemplateDirective, SendMessageEvent };
1576
+