@progress/kendo-angular-conversational-ui 5.0.2 → 11.0.0-develop.79

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