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

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