@progress/kendo-react-conversational-ui 12.0.0-develop.4 → 12.0.0-develop.6
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.
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +96 -106
- package/chat/components/elements/FileBox.js +1 -1
- package/chat/components/elements/FileBox.mjs +15 -12
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -7
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("react"),g=require("@progress/kendo-react-common"),J=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons"),F=require("@progress/kendo-react-intl"),Q=require("@progress/kendo-react-layout"),c=require("../utils.js"),de=require("./ChatContext.js"),me=require("./elements/FileBox.js"),l=require("../../messages/index.js");function fe(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const m=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,m.get?m:{enumerable:!0,get:()=>r[s]})}}return i.default=r,Object.freeze(i)}const t=fe(ue),L=t.forwardRef((r,i)=>{const{item:s,template:m,onRequestSelection:T,tabIndex:Z=-1,dateFormat:O="g",selected:o,allowMessageCollapse:b,messageToolbarActions:k,messageContextMenuActions:C,isSender:y}=r,{setReplyToMessage:x,messages:P,user:p,internalScrollContainerRef:h,onToolbarAction:D,onContextMenuAction:N,onFileAction:V,onDownload:d,fileActions:B,setShowCopyNotification:I,statusTemplate:S}=de.useChatContext(),[j,A]=t.useState(!1),[$,z]=t.useState(!1),[E,ee]=t.useState(!0),[te,K]=t.useState(!1),u=F.useLocalization(),W=t.useRef({left:0,top:0}),w=t.useCallback(()=>{s!=null&&s.text&&c.copyToClipboard(s.text),I&&(I(!0),setTimeout(()=>{I(!1)},3e3))},[s,I]),R=t.useCallback(e=>{e.stopPropagation(),ee(a=>!a)},[]),se=t.useCallback(()=>{K(!1)},[]),ae=t.useCallback(e=>{(e.key==="Tab"||e.key==="Enter"||e.key===" "||e.key==="ArrowUp"||e.key==="ArrowDown")&&K(!0)},[]),q=t.useRef(null);t.useEffect(()=>{o&&q.current&&q.current.focus()},[o]);const _=t.useCallback(e=>{W.current={left:e.pageX,top:e.pageY},e.preventDefault(),z(!0),A(!0)},[]),U=t.useCallback(()=>{z(!1),A(!1)},[]),M=t.useCallback((e,a)=>!e.isDeleted&&e.text?e.text:c.getDeletedMessageText(a,u),[u]),X=t.useCallback(e=>{var a;(a=e.item)!=null&&a.text&&(e.item.data.id==="copy"&&!s.isDeleted?w():e.item.data.id==="reply"&&x(s),N&&N(e.item.data,e,s)),A(!1)},[s,N,x,w]),Y=t.useCallback(()=>{if(s.replyToId){const e=c.getMessageById(P,s.replyToId);if(e){const a=n=>{n.preventDefault(),n.stopPropagation();const v=h==null?void 0:h.current;c.scrollToMessageById(e.id,v)};return t.createElement("div",{className:g.classNames("k-message-reference",c.isAuthor(p,e)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:a},t.createElement("div",{className:"k-message-reference-content"},c.convertTextToLinkedContent(M(e,c.isAuthor(p,e)))))}}return null},[s.replyToId,P,p,M,h]),G=t.useCallback(()=>{const e=[{id:"reply",label:"Reply",svgIcon:f.undoIcon},{id:"copy",label:"Copy",svgIcon:f.copyIcon}],a=C?[...e.map(n=>C.find(ie=>ie.id===n.id)||n),...C.filter(n=>!e.some(v=>v.id===n.id))]:e;return t.createElement(Q.ContextMenu,{onSelect:X,onClose:U,vertical:!0,show:j,offset:W.current},a.map(n=>n.id==="delete"&&!y?null:t.createElement(Q.MenuItem,{key:n.id,text:n.label,icon:n.icon,svgIcon:n.svgIcon,data:n})))},[C,X,U,j,y]),H=t.useCallback(()=>s.files&&s.files.length>1?t.createElement("div",{className:"k-chat-download-button-wrapper"},t.createElement(J.Button,{className:"k-chat-download-button",fillMode:"flat",themeColor:"base",svgIcon:f.downloadIcon,onClick:e=>{e.stopPropagation(),d&&d(s.files,s)},"aria-label":u.toLanguageString(l.downloadAllFiles,l.messages[l.downloadAllFiles])},t.createElement("span",{className:"k-button-text"},u.toLanguageString(l.downloadAll,l.messages[l.downloadAll])))):null,[s,d,u]),ne=t.useCallback(()=>{if(s.typing)return t.createElement("div",{className:"k-chat-bubble"},t.createElement("div",{className:"k-typing-indicator"},t.createElement("span",null),t.createElement("span",null),t.createElement("span",null)));if(m){const e=m;return t.createElement(e,{item:s})}else if(s.text||s.files&&s.files.length>0)return t.createElement(t.Fragment,null,t.createElement("div",{className:g.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":b,"k-expanded":b&&E,"k-selected":o,"k-active":$}),onClick:()=>T(o?void 0:s.selectionIndex),onContextMenu:_},t.createElement("div",{className:"k-bubble-content"},t.createElement("span",{className:"k-chat-bubble-text"},!s.isDeleted&&Y(),c.convertTextToLinkedContent(M(s,c.isAuthor(p,s)))),s.files&&t.createElement(me,{files:s.files,message:s,onFileAction:V,onDownload:e=>d==null?void 0:d(e,s),renderInTextarea:!1,fileActions:B}),H()),b&&t.createElement("span",{className:"k-bubble-expandable-indicator",onClick:R,role:"button","aria-label":E?u.toLanguageString(l.collapseMessage,l.messages[l.collapseMessage]):u.toLanguageString(l.expandMessage,l.messages[l.expandMessage]),tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),R(e))}},t.createElement(g.IconWrap,{icon:E?f.chevronUpIcon:f.chevronDownIcon,size:"medium"}))),G());return null},[s,m,b,E,o,_,Y,M,p,V,B,H,R,u,G,d]),le=t.useCallback(()=>{let e=null;return s.timestamp&&(e=t.createElement("time",{className:"k-message-time","aria-hidden":!o},F.provideIntlService({props:r}).formatDate(s.timestamp,O))),e},[s.timestamp,o,O,r]),oe=t.useCallback(()=>{let e=null;return s.status&&o&&(S?e=t.createElement(S,{item:s}):e=t.createElement("span",{className:"k-message-status"},t.createElement(g.IconWrap,{icon:f.checkCircleIcon,size:"xsmall"}),s.status)),e},[s,o,S]),re=t.useCallback(()=>g.classNames({"k-focus":o,"k-message-removed":s.isDeleted},"k-message"),[o,s.isDeleted]),ce=t.useCallback(()=>k&&k.length>0&&t.createElement("div",{className:"k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat"},k.map(e=>e.id==="delete"&&!y?null:t.createElement(J.Button,{key:e.id,fillMode:"flat",className:"k-toolbar-button",themeColor:"base",icon:e.icon,svgIcon:e.svgIcon,onClick:a=>{a.stopPropagation(),e.id==="copy"&&!s.isDeleted?w():e.id==="reply"&&x(s),D&&D(e,a,s)},onMouseDown:a=>a.preventDefault()}))),[w,y,s,k,D,x]);return t.createElement("div",{"data-message-id":s.id,className:re(),tabIndex:Z,onMouseDown:se,onKeyDown:ae,onFocus:e=>{te&&T(s.selectionIndex)},ref:e=>{q.current=e,typeof i=="function"?i(e):i&&(i.current=e)}},le(),ne(),oe(),ce())});L.displayName="ChatMessage";class pe extends t.Component{render(){return t.createElement(L,{...this.props})}}F.registerForIntl(pe);exports.ChatMessage=L;
|
|
@@ -6,28 +6,28 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { classNames as A, IconWrap as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { downloadIcon as
|
|
12
|
-
import { useLocalization as
|
|
13
|
-
import { ContextMenu as
|
|
14
|
-
import { copyToClipboard as
|
|
15
|
-
import { useChatContext as
|
|
16
|
-
import
|
|
17
|
-
import { downloadAllFiles as
|
|
18
|
-
const
|
|
9
|
+
import { classNames as A, IconWrap as j } from "@progress/kendo-react-common";
|
|
10
|
+
import { Button as G } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { downloadIcon as fe, chevronUpIcon as pe, chevronDownIcon as ge, checkCircleIcon as be, undoIcon as ke, copyIcon as Ce } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { useLocalization as ye, provideIntlService as xe, registerForIntl as Ee } from "@progress/kendo-react-intl";
|
|
13
|
+
import { ContextMenu as he, MenuItem as Ie } from "@progress/kendo-react-layout";
|
|
14
|
+
import { copyToClipboard as we, getDeletedMessageText as Me, getMessageById as ve, isAuthor as R, convertTextToLinkedContent as H, scrollToMessageById as Te } from "../utils.mjs";
|
|
15
|
+
import { useChatContext as De } from "./ChatContext.mjs";
|
|
16
|
+
import Ne from "./elements/FileBox.mjs";
|
|
17
|
+
import { downloadAllFiles as J, messages as h, downloadAll as Q, collapseMessage as Z, expandMessage as _ } from "../../messages/index.mjs";
|
|
18
|
+
const ee = t.forwardRef(
|
|
19
19
|
(i, u) => {
|
|
20
20
|
const {
|
|
21
21
|
item: a,
|
|
22
22
|
template: I,
|
|
23
23
|
onRequestSelection: w,
|
|
24
|
-
tabIndex:
|
|
24
|
+
tabIndex: te = -1,
|
|
25
25
|
dateFormat: F = "g",
|
|
26
26
|
selected: l,
|
|
27
27
|
allowMessageCollapse: m,
|
|
28
28
|
messageToolbarActions: d,
|
|
29
|
-
messageContextMenuActions:
|
|
30
|
-
isSender:
|
|
29
|
+
messageContextMenuActions: f,
|
|
30
|
+
isSender: p
|
|
31
31
|
} = i, {
|
|
32
32
|
setReplyToMessage: g,
|
|
33
33
|
messages: L,
|
|
@@ -39,42 +39,42 @@ const _ = t.forwardRef(
|
|
|
39
39
|
onDownload: r,
|
|
40
40
|
fileActions: K,
|
|
41
41
|
setShowCopyNotification: k,
|
|
42
|
-
statusTemplate:
|
|
43
|
-
} =
|
|
44
|
-
a != null && a.text &&
|
|
42
|
+
statusTemplate: T
|
|
43
|
+
} = De(), [z, D] = t.useState(!1), [ae, B] = t.useState(!1), [C, se] = t.useState(!0), [ne, P] = t.useState(!1), o = ye(), W = t.useRef({ left: 0, top: 0 }), y = t.useCallback(() => {
|
|
44
|
+
a != null && a.text && we(a.text), k && (k(!0), setTimeout(() => {
|
|
45
45
|
k(!1);
|
|
46
46
|
}, 3e3));
|
|
47
47
|
}, [a, k]), N = t.useCallback((e) => {
|
|
48
|
-
e.stopPropagation(),
|
|
49
|
-
}, []),
|
|
50
|
-
|
|
51
|
-
}, []),
|
|
52
|
-
(e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") &&
|
|
48
|
+
e.stopPropagation(), se((s) => !s);
|
|
49
|
+
}, []), le = t.useCallback(() => {
|
|
50
|
+
P(!1);
|
|
51
|
+
}, []), oe = t.useCallback((e) => {
|
|
52
|
+
(e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") && P(!0);
|
|
53
53
|
}, []), S = t.useRef(null);
|
|
54
54
|
t.useEffect(() => {
|
|
55
55
|
l && S.current && S.current.focus();
|
|
56
56
|
}, [l]);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
}, []),
|
|
60
|
-
|
|
57
|
+
const O = t.useCallback((e) => {
|
|
58
|
+
W.current = { left: e.pageX, top: e.pageY }, e.preventDefault(), B(!0), D(!0);
|
|
59
|
+
}, []), U = t.useCallback(() => {
|
|
60
|
+
B(!1), D(!1);
|
|
61
61
|
}, []), x = t.useCallback(
|
|
62
|
-
(e, s) => !e.isDeleted && e.text ? e.text :
|
|
62
|
+
(e, s) => !e.isDeleted && e.text ? e.text : Me(s, o),
|
|
63
63
|
[o]
|
|
64
|
-
),
|
|
64
|
+
), q = t.useCallback(
|
|
65
65
|
(e) => {
|
|
66
66
|
var s;
|
|
67
|
-
(s = e.item) != null && s.text && (e.item.data.id === "copy" && !a.isDeleted ? y() : e.item.data.id === "reply" && g(a), v && v(e.item.data, e, a)),
|
|
67
|
+
(s = e.item) != null && s.text && (e.item.data.id === "copy" && !a.isDeleted ? y() : e.item.data.id === "reply" && g(a), v && v(e.item.data, e, a)), D(!1);
|
|
68
68
|
},
|
|
69
69
|
[a, v, g, y]
|
|
70
|
-
),
|
|
70
|
+
), X = t.useCallback(() => {
|
|
71
71
|
if (a.replyToId) {
|
|
72
|
-
const e =
|
|
72
|
+
const e = ve(L, a.replyToId);
|
|
73
73
|
if (e) {
|
|
74
74
|
const s = (n) => {
|
|
75
75
|
n.preventDefault(), n.stopPropagation();
|
|
76
76
|
const E = b == null ? void 0 : b.current;
|
|
77
|
-
|
|
77
|
+
Te(e.id, E);
|
|
78
78
|
};
|
|
79
79
|
return /* @__PURE__ */ t.createElement(
|
|
80
80
|
"div",
|
|
@@ -85,45 +85,45 @@ const _ = t.forwardRef(
|
|
|
85
85
|
),
|
|
86
86
|
onClick: s
|
|
87
87
|
},
|
|
88
|
-
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" },
|
|
88
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, H(
|
|
89
89
|
x(e, R(c, e))
|
|
90
90
|
))
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
return null;
|
|
95
|
-
}, [a.replyToId, L, c, x, b]),
|
|
95
|
+
}, [a.replyToId, L, c, x, b]), Y = t.useCallback(() => {
|
|
96
96
|
const e = [
|
|
97
97
|
{
|
|
98
98
|
id: "reply",
|
|
99
99
|
label: "Reply",
|
|
100
|
-
svgIcon:
|
|
100
|
+
svgIcon: ke
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
id: "copy",
|
|
104
104
|
label: "Copy",
|
|
105
|
-
svgIcon:
|
|
105
|
+
svgIcon: Ce
|
|
106
106
|
}
|
|
107
|
-
], s =
|
|
108
|
-
...e.map((n) =>
|
|
109
|
-
(
|
|
107
|
+
], s = f ? [
|
|
108
|
+
...e.map((n) => f.find(
|
|
109
|
+
(de) => de.id === n.id
|
|
110
110
|
) || n),
|
|
111
|
-
...
|
|
111
|
+
...f.filter(
|
|
112
112
|
(n) => !e.some((E) => E.id === n.id)
|
|
113
113
|
)
|
|
114
114
|
] : e;
|
|
115
115
|
return /* @__PURE__ */ t.createElement(
|
|
116
|
-
|
|
116
|
+
he,
|
|
117
117
|
{
|
|
118
|
-
onSelect:
|
|
119
|
-
onClose:
|
|
118
|
+
onSelect: q,
|
|
119
|
+
onClose: U,
|
|
120
120
|
vertical: !0,
|
|
121
|
-
show:
|
|
122
|
-
offset:
|
|
121
|
+
show: z,
|
|
122
|
+
offset: W.current
|
|
123
123
|
},
|
|
124
124
|
s.map(
|
|
125
|
-
(n) => n.id === "delete" && !
|
|
126
|
-
|
|
125
|
+
(n) => n.id === "delete" && !p ? null : /* @__PURE__ */ t.createElement(
|
|
126
|
+
Ie,
|
|
127
127
|
{
|
|
128
128
|
key: n.id,
|
|
129
129
|
text: n.label,
|
|
@@ -134,23 +134,23 @@ const _ = t.forwardRef(
|
|
|
134
134
|
)
|
|
135
135
|
)
|
|
136
136
|
);
|
|
137
|
-
}, [
|
|
138
|
-
|
|
137
|
+
}, [f, q, U, z, p]), $ = t.useCallback(() => a.files && a.files.length > 1 ? /* @__PURE__ */ t.createElement("div", { className: "k-chat-download-button-wrapper" }, /* @__PURE__ */ t.createElement(
|
|
138
|
+
G,
|
|
139
139
|
{
|
|
140
140
|
className: "k-chat-download-button",
|
|
141
141
|
fillMode: "flat",
|
|
142
142
|
themeColor: "base",
|
|
143
|
-
svgIcon:
|
|
143
|
+
svgIcon: fe,
|
|
144
144
|
onClick: (e) => {
|
|
145
145
|
e.stopPropagation(), r && r(a.files, a);
|
|
146
146
|
},
|
|
147
147
|
"aria-label": o.toLanguageString(
|
|
148
|
-
|
|
149
|
-
h[
|
|
148
|
+
J,
|
|
149
|
+
h[J]
|
|
150
150
|
)
|
|
151
151
|
},
|
|
152
|
-
/* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, o.toLanguageString(
|
|
153
|
-
)) : null, [a, r, o]),
|
|
152
|
+
/* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, o.toLanguageString(Q, h[Q]))
|
|
153
|
+
)) : null, [a, r, o]), re = t.useCallback(() => {
|
|
154
154
|
if (a.typing)
|
|
155
155
|
return /* @__PURE__ */ t.createElement("div", { className: "k-chat-bubble" }, /* @__PURE__ */ t.createElement("div", { className: "k-typing-indicator" }, /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null)));
|
|
156
156
|
if (I) {
|
|
@@ -163,32 +163,23 @@ const _ = t.forwardRef(
|
|
|
163
163
|
className: A("k-chat-bubble", "k-bubble", {
|
|
164
164
|
"k-bubble-expandable": m,
|
|
165
165
|
"k-expanded": m && C,
|
|
166
|
-
"k-selected": l
|
|
166
|
+
"k-selected": l,
|
|
167
|
+
"k-active": ae
|
|
167
168
|
}),
|
|
168
|
-
|
|
169
|
+
onClick: () => w(l ? void 0 : a.selectionIndex),
|
|
170
|
+
onContextMenu: O
|
|
169
171
|
},
|
|
170
|
-
/* @__PURE__ */ t.createElement(
|
|
171
|
-
|
|
172
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, /* @__PURE__ */ t.createElement("span", { className: "k-chat-bubble-text" }, !a.isDeleted && X(), H(x(a, R(c, a)))), a.files && /* @__PURE__ */ t.createElement(
|
|
173
|
+
Ne,
|
|
172
174
|
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
files: a.files,
|
|
183
|
-
message: a,
|
|
184
|
-
onFileAction: V,
|
|
185
|
-
onDownload: (e) => r == null ? void 0 : r(e, a),
|
|
186
|
-
renderInTextarea: !1,
|
|
187
|
-
fileActions: K
|
|
188
|
-
}
|
|
189
|
-
),
|
|
190
|
-
Y()
|
|
191
|
-
),
|
|
175
|
+
files: a.files,
|
|
176
|
+
message: a,
|
|
177
|
+
onFileAction: V,
|
|
178
|
+
onDownload: (e) => r == null ? void 0 : r(e, a),
|
|
179
|
+
renderInTextarea: !1,
|
|
180
|
+
fileActions: K
|
|
181
|
+
}
|
|
182
|
+
), $()),
|
|
192
183
|
m && /* @__PURE__ */ t.createElement(
|
|
193
184
|
"span",
|
|
194
185
|
{
|
|
@@ -196,20 +187,20 @@ const _ = t.forwardRef(
|
|
|
196
187
|
onClick: N,
|
|
197
188
|
role: "button",
|
|
198
189
|
"aria-label": C ? o.toLanguageString(
|
|
199
|
-
Q,
|
|
200
|
-
h[Q]
|
|
201
|
-
) : o.toLanguageString(
|
|
202
190
|
Z,
|
|
203
191
|
h[Z]
|
|
192
|
+
) : o.toLanguageString(
|
|
193
|
+
_,
|
|
194
|
+
h[_]
|
|
204
195
|
),
|
|
205
196
|
tabIndex: 0,
|
|
206
197
|
onKeyDown: (e) => {
|
|
207
198
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), N(e));
|
|
208
199
|
}
|
|
209
200
|
},
|
|
210
|
-
/* @__PURE__ */ t.createElement(
|
|
201
|
+
/* @__PURE__ */ t.createElement(j, { icon: C ? pe : ge, size: "medium" })
|
|
211
202
|
)
|
|
212
|
-
),
|
|
203
|
+
), Y());
|
|
213
204
|
return null;
|
|
214
205
|
}, [
|
|
215
206
|
a,
|
|
@@ -217,25 +208,25 @@ const _ = t.forwardRef(
|
|
|
217
208
|
m,
|
|
218
209
|
C,
|
|
219
210
|
l,
|
|
220
|
-
|
|
221
|
-
|
|
211
|
+
O,
|
|
212
|
+
X,
|
|
222
213
|
x,
|
|
223
214
|
c,
|
|
224
215
|
V,
|
|
225
216
|
K,
|
|
226
|
-
|
|
217
|
+
$,
|
|
227
218
|
N,
|
|
228
219
|
o,
|
|
229
|
-
|
|
220
|
+
Y,
|
|
230
221
|
r
|
|
231
|
-
]),
|
|
222
|
+
]), ce = t.useCallback(() => {
|
|
232
223
|
let e = null;
|
|
233
|
-
return a.timestamp && (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time", "aria-hidden": !l },
|
|
234
|
-
}, [a.timestamp, l, F, i]),
|
|
224
|
+
return a.timestamp && (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time", "aria-hidden": !l }, xe({ props: i }).formatDate(a.timestamp, F))), e;
|
|
225
|
+
}, [a.timestamp, l, F, i]), ie = t.useCallback(() => {
|
|
235
226
|
let e = null;
|
|
236
|
-
return a.status && l && (
|
|
237
|
-
}, [a, l,
|
|
238
|
-
|
|
227
|
+
return a.status && l && (T ? e = t.createElement(T, { item: a }) : e = /* @__PURE__ */ t.createElement("span", { className: "k-message-status" }, /* @__PURE__ */ t.createElement(j, { icon: be, size: "xsmall" }), a.status)), e;
|
|
228
|
+
}, [a, l, T]), ue = t.useCallback(() => A({ "k-focus": l, "k-message-removed": a.isDeleted }, "k-message"), [l, a.isDeleted]), me = t.useCallback(() => d && d.length > 0 && /* @__PURE__ */ t.createElement("div", { className: "k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat" }, d.map((e) => e.id === "delete" && !p ? null : /* @__PURE__ */ t.createElement(
|
|
229
|
+
G,
|
|
239
230
|
{
|
|
240
231
|
key: e.id,
|
|
241
232
|
fillMode: "flat",
|
|
@@ -248,37 +239,36 @@ const _ = t.forwardRef(
|
|
|
248
239
|
},
|
|
249
240
|
onMouseDown: (s) => s.preventDefault()
|
|
250
241
|
}
|
|
251
|
-
))), [y,
|
|
242
|
+
))), [y, p, a, d, M, g]);
|
|
252
243
|
return /* @__PURE__ */ t.createElement(
|
|
253
244
|
"div",
|
|
254
245
|
{
|
|
255
246
|
"data-message-id": a.id,
|
|
256
|
-
className:
|
|
257
|
-
tabIndex:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
onKeyDown: ne,
|
|
247
|
+
className: ue(),
|
|
248
|
+
tabIndex: te,
|
|
249
|
+
onMouseDown: le,
|
|
250
|
+
onKeyDown: oe,
|
|
261
251
|
onFocus: (e) => {
|
|
262
|
-
|
|
252
|
+
ne && w(a.selectionIndex);
|
|
263
253
|
},
|
|
264
254
|
ref: (e) => {
|
|
265
255
|
S.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
|
|
266
256
|
}
|
|
267
257
|
},
|
|
268
|
-
|
|
269
|
-
le(),
|
|
258
|
+
ce(),
|
|
270
259
|
re(),
|
|
271
|
-
ie()
|
|
260
|
+
ie(),
|
|
261
|
+
me()
|
|
272
262
|
);
|
|
273
263
|
}
|
|
274
264
|
);
|
|
275
|
-
|
|
276
|
-
class
|
|
265
|
+
ee.displayName = "ChatMessage";
|
|
266
|
+
class Se extends t.Component {
|
|
277
267
|
render() {
|
|
278
|
-
return /* @__PURE__ */ t.createElement(
|
|
268
|
+
return /* @__PURE__ */ t.createElement(ee, { ...this.props });
|
|
279
269
|
}
|
|
280
270
|
}
|
|
281
|
-
|
|
271
|
+
Ee(Se);
|
|
282
272
|
export {
|
|
283
|
-
|
|
273
|
+
ee as ChatMessage
|
|
284
274
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";const
|
|
8
|
+
"use strict";const C=require("react"),f=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-svg-icons"),b=require("@progress/kendo-react-intl"),o=require("../../../messages/index.js");function F(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(i,n,c.get?c:{enumerable:!0,get:()=>r[n]})}}return i.default=r,Object.freeze(i)}const a=F(C),M=r=>{const{files:i,onFileRemove:n,onFileAction:c,onDownload:m,fileActions:k,renderInTextarea:I=!1}=r,u=b.useLocalization(),h=[{id:"download",label:"Download",svgIcon:l.downloadIcon}],d=k||h,x=e=>{if(e==null)return"";if(e===0)return"0 B";const s=1024,t=["B","KB","MB","GB","TB"],p=Math.floor(Math.log(e)/Math.log(s));return`${parseFloat((e/Math.pow(s,p)).toFixed(2))} ${t[p]}`},B=e=>"."+e.split(".").pop()||"",E=(e,s)=>{e.item.id==="download"&&(m==null||m([s])),c==null||c(e.item,e,s)},v=e=>I?a.createElement(g.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:t=>{t.stopPropagation(),n==null||n(e.name)},"aria-label":`${u.toLanguageString(o.removeFile,o.messages[o.removeFile])} ${e.name}`}):"uid"in e||!("rawFile"in e)?d.length>0&&a.createElement(g.DropDownButton,{fillMode:"flat",themeColor:"base",svgIcon:l.moreVerticalIcon,onClick:t=>{t.syntheticEvent.stopPropagation()},onItemClick:t=>E(t,e),items:d.map(t=>({id:t.id,icon:t.icon,text:t.label,svgIcon:t.svgIcon})),"aria-label":`${u.toLanguageString(o.fileActions,o.messages[o.fileActions])} ${e.name}`}):a.createElement(g.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:t=>{t.stopPropagation(),n==null||n(e.name)},"aria-label":`${u.toLanguageString(o.removeFile,o.messages[o.removeFile])} ${e.name}`});return a.createElement("ul",{className:"k-chat-file-wrapper"},i.map(e=>a.createElement("li",{key:e.name,className:"k-chat-file"},a.createElement(f.IconWrap,{size:"xxlarge",...f.getFileExtensionIcon(B(e.name))}),a.createElement("div",{className:"k-chat-file-info"},a.createElement("span",{className:"k-chat-file-name"},e.name),a.createElement("span",{className:"k-chat-file-size"},x(e.size))),v(e))))};module.exports=M;
|
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as a from "react";
|
|
9
9
|
import { IconWrap as $, getFileExtensionIcon as F } from "@progress/kendo-react-common";
|
|
10
|
-
import { Button as
|
|
10
|
+
import { Button as g, DropDownButton as M } from "@progress/kendo-react-buttons";
|
|
11
11
|
import { xIcon as d, moreVerticalIcon as w, downloadIcon as z } from "@progress/kendo-svg-icons";
|
|
12
12
|
import { useLocalization as v } from "@progress/kendo-react-intl";
|
|
13
|
-
import { removeFile as
|
|
14
|
-
const
|
|
15
|
-
const { files: h, onFileRemove: o, onFileAction:
|
|
13
|
+
import { removeFile as i, messages as c, fileActions as f } from "../../../messages/index.mjs";
|
|
14
|
+
const T = (u) => {
|
|
15
|
+
const { files: h, onFileRemove: o, onFileAction: r, onDownload: l, fileActions: I, renderInTextarea: k = !1 } = u, s = v(), m = I || [{ id: "download", label: "Download", svgIcon: z }], E = (e) => {
|
|
16
16
|
if (e == null)
|
|
17
17
|
return "";
|
|
18
18
|
if (e === 0)
|
|
19
19
|
return "0 B";
|
|
20
|
-
const n = 1024, t = ["B", "KB", "MB", "GB", "TB"],
|
|
21
|
-
return `${parseFloat((e / Math.pow(n,
|
|
20
|
+
const n = 1024, t = ["B", "KB", "MB", "GB", "TB"], p = Math.floor(Math.log(e) / Math.log(n));
|
|
21
|
+
return `${parseFloat((e / Math.pow(n, p)).toFixed(2))} ${t[p]}`;
|
|
22
22
|
}, x = (e) => "." + e.split(".").pop() || "", B = (e, n) => {
|
|
23
|
-
e.item.id === "download" && (l == null || l([n])),
|
|
23
|
+
e.item.id === "download" && (l == null || l([n])), r == null || r(e.item, e, n);
|
|
24
24
|
}, C = (e) => k ? /* @__PURE__ */ a.createElement(
|
|
25
|
-
|
|
25
|
+
g,
|
|
26
26
|
{
|
|
27
27
|
fillMode: "flat",
|
|
28
28
|
themeColor: "base",
|
|
@@ -30,7 +30,7 @@ const D = (u) => {
|
|
|
30
30
|
onClick: (t) => {
|
|
31
31
|
t.stopPropagation(), o == null || o(e.name);
|
|
32
32
|
},
|
|
33
|
-
"aria-label": `${s.toLanguageString(
|
|
33
|
+
"aria-label": `${s.toLanguageString(i, c[i])} ${e.name}`
|
|
34
34
|
}
|
|
35
35
|
) : "uid" in e || !("rawFile" in e) ? m.length > 0 && /* @__PURE__ */ a.createElement(
|
|
36
36
|
M,
|
|
@@ -38,6 +38,9 @@ const D = (u) => {
|
|
|
38
38
|
fillMode: "flat",
|
|
39
39
|
themeColor: "base",
|
|
40
40
|
svgIcon: w,
|
|
41
|
+
onClick: (t) => {
|
|
42
|
+
t.syntheticEvent.stopPropagation();
|
|
43
|
+
},
|
|
41
44
|
onItemClick: (t) => B(t, e),
|
|
42
45
|
items: m.map((t) => ({
|
|
43
46
|
id: t.id,
|
|
@@ -51,7 +54,7 @@ const D = (u) => {
|
|
|
51
54
|
)} ${e.name}`
|
|
52
55
|
}
|
|
53
56
|
) : /* @__PURE__ */ a.createElement(
|
|
54
|
-
|
|
57
|
+
g,
|
|
55
58
|
{
|
|
56
59
|
fillMode: "flat",
|
|
57
60
|
themeColor: "base",
|
|
@@ -59,11 +62,11 @@ const D = (u) => {
|
|
|
59
62
|
onClick: (t) => {
|
|
60
63
|
t.stopPropagation(), o == null || o(e.name);
|
|
61
64
|
},
|
|
62
|
-
"aria-label": `${s.toLanguageString(
|
|
65
|
+
"aria-label": `${s.toLanguageString(i, c[i])} ${e.name}`
|
|
63
66
|
}
|
|
64
67
|
);
|
|
65
68
|
return /* @__PURE__ */ a.createElement("ul", { className: "k-chat-file-wrapper" }, h.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-chat-file" }, /* @__PURE__ */ a.createElement($, { size: "xxlarge", ...F(x(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-chat-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-chat-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-chat-file-size" }, E(e.size))), C(e))));
|
|
66
69
|
};
|
|
67
70
|
export {
|
|
68
|
-
|
|
71
|
+
T as default
|
|
69
72
|
};
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-intl"),require("@progress/kendo-react-layout"),require("prop-types"),require("@progress/kendo-react-upload"),require("@progress/kendo-react-inputs"),require("@progress/kendo-react-animation"),require("@progress/kendo-react-notification"),require("@progress/kendo-react-popup")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-intl","@progress/kendo-react-layout","prop-types","@progress/kendo-react-upload","@progress/kendo-react-inputs","@progress/kendo-react-animation","@progress/kendo-react-notification","@progress/kendo-react-popup"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactConversationalUi={},e.React,e.KendoReactCommon,e.KendoReactButtons,e.KendoSvgIcons,e.KendoReactIntl,e.KendoReactLayout,e.PropTypes,e.KendoReactUpload,e.KendoReactInputs,e.KendoReactAnimation,e.KendoReactNotification,e.KendoReactPopup)}(this,(function(e,t,a,n,l,o,s,r,i,c,u,m,d){"use strict";function p(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var g=p(t);const h="newMessage.sendButton",k="newMessage.messageInput",f="avatar.alt",v="messageList.ariaLabel",C="aIPrompt.noOutputs",y="aIPrompt.cancel",b="chat.senderDeletedMessage",E="chat.receiverDeletedMessage",I="chat.copyNotification",x="chat.downloadAllFiles",F="chat.closeReply",w="chat.collapseMessage",T="chat.expandMessage",N="chat.removeFile",A="chat.fileActions",S="chat.attachFile",M="chat.downloadAll",D={[h]:"Send","newMessage.optionsButton":"Options",[k]:"Message",[f]:"Avatar",[v]:"Message list",[y]:"Cancel",[C]:"No output from AI available",[b]:"You removed this message",[E]:"The message was removed by its sender",[I]:"Text copied to clipboard",[x]:"Download all files",[F]:"Close reply",[w]:"Collapse message",[T]:"Expand message",[N]:"Remove file",[A]:"File actions for",[S]:"Attach file",[M]:"Download all"},R=(e,t)=>e&&t.author&&e.id===t.author.id,P=(e,t)=>{const a=t.toLanguageString("chatSender.deletedMessage",D[b]),n=t.toLanguageString("chatReceiver.deletedMessage",D[E]);return e?a:n},B=(e,t)=>{const a=t?t.querySelector(`[data-message-id="${e}"]`):document.querySelector(`[data-message-id="${e}"]`);if(!a)return;const n=null==t?void 0:t.querySelector(".k-message-list");if(n){const e=n.getBoundingClientRect().top,t=a.getBoundingClientRect().top,l=n.scrollTop+(t-e);n.scrollTo({top:l,behavior:"smooth"})}else a.scrollIntoView({behavior:"smooth",block:"start"})},L=/(https?:\/\/[^\s]+)/g,K=e=>{if(!e)return[""];const a=e.split(L),n=[];return a.forEach((e=>{e&&L.test(e)?(L.lastIndex=0,n.push(t.createElement("a",{key:e,href:e,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"}},e))):e&&n.push(e)})),n},V=g.createContext(void 0),O=()=>{const e=t.useContext(V);if(void 0===e)throw new Error("useChatContext must be used within a ChatContext.Provider");return e},q=e=>{const{files:t,onFileRemove:s,onFileAction:r,onDownload:i,fileActions:c,renderInTextarea:u=!1}=e,m=o.useLocalization(),d=c||[{id:"download",label:"Download",svgIcon:l.downloadIcon}],p=e=>"."+e.split(".").pop()||"",h=e=>u?g.createElement(n.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:t=>{t.stopPropagation(),null==s||s(e.name)},"aria-label":`${m.toLanguageString(N,D[N])} ${e.name}`}):"uid"in e||!("rawFile"in e)?d.length>0&&g.createElement(n.DropDownButton,{fillMode:"flat",themeColor:"base",svgIcon:l.moreVerticalIcon,onItemClick:t=>((e,t)=>{"download"===e.item.id&&(null==i||i([t])),null==r||r(e.item,e,t)})(t,e),items:d.map((e=>({id:e.id,icon:e.icon,text:e.label,svgIcon:e.svgIcon}))),"aria-label":`${m.toLanguageString(A,D[A])} ${e.name}`}):g.createElement(n.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:t=>{t.stopPropagation(),null==s||s(e.name)},"aria-label":`${m.toLanguageString(N,D[N])} ${e.name}`});return g.createElement("ul",{className:"k-chat-file-wrapper"},t.map((e=>g.createElement("li",{key:e.name,className:"k-chat-file"},g.createElement(a.IconWrap,{size:"xxlarge",...a.getFileExtensionIcon(p(e.name))}),g.createElement("div",{className:"k-chat-file-info"},g.createElement("span",{className:"k-chat-file-name"},e.name),g.createElement("span",{className:"k-chat-file-size"},(e=>{if(null==e)return"";if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(2))} ${["B","KB","MB","GB","TB"][t]}`})(e.size))),h(e)))))},z=g.forwardRef(((e,t)=>{const{item:r,template:i,onRequestSelection:c,tabIndex:u=-1,dateFormat:m="g",selected:d,allowMessageCollapse:p,messageToolbarActions:h,messageContextMenuActions:k,isSender:f}=e,{setReplyToMessage:v,messages:C,user:y,internalScrollContainerRef:b,onToolbarAction:E,onContextMenuAction:I,onFileAction:F,onDownload:N,fileActions:A,setShowCopyNotification:S,statusTemplate:L}=O(),[V,z]=g.useState(!1),[U,j]=g.useState(!0),[$,W]=g.useState(!1),H=o.useLocalization(),G=g.useRef({left:0,top:0}),_=g.useCallback((()=>{null!=r&&r.text&&(e=>{navigator.clipboard.writeText(e)})(r.text),S&&(S(!0),setTimeout((()=>{S(!1)}),3e3))}),[r,S]),Y=g.useCallback((e=>{e.stopPropagation(),j((e=>!e))}),[]),X=g.useCallback((()=>{W(!1)}),[]),J=g.useCallback((e=>{("Tab"===e.key||"Enter"===e.key||" "===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key)&&W(!0)}),[]),Q=g.useRef(null);g.useEffect((()=>{d&&Q.current&&Q.current.focus()}),[d]);const Z=g.useCallback((e=>{G.current={left:e.pageX,top:e.pageY},e.preventDefault(),z(!0)}),[]),ee=g.useCallback((()=>{z(!1)}),[]),te=g.useCallback(((e,t)=>!e.isDeleted&&e.text?e.text:P(t,H)),[H]),ae=g.useCallback((e=>{var t;null!=(t=e.item)&&t.text&&("copy"!==e.item.data.id||r.isDeleted?"reply"===e.item.data.id&&v(r):_(),I&&I(e.item.data,e,r)),z(!1)}),[r,I,v,_]),ne=g.useCallback((()=>{if(r.replyToId){const e=((e,t)=>e.find((e=>e.id===t)))(C,r.replyToId);if(e){const t=t=>{t.preventDefault(),t.stopPropagation();const a=null==b?void 0:b.current;B(e.id,a)};return g.createElement("div",{className:a.classNames("k-message-reference",R(y,e)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:t},g.createElement("div",{className:"k-message-reference-content"},K(te(e,R(y,e)))))}}return null}),[r.replyToId,C,y,te,b]),le=g.useCallback((()=>{const e=[{id:"reply",label:"Reply",svgIcon:l.undoIcon},{id:"copy",label:"Copy",svgIcon:l.copyIcon}],t=k?[...e.map((e=>k.find((t=>t.id===e.id))||e)),...k.filter((t=>!e.some((e=>e.id===t.id))))]:e;return g.createElement(s.ContextMenu,{onSelect:ae,onClose:ee,vertical:!0,show:V,offset:G.current},t.map((e=>"delete"!==e.id||f?g.createElement(s.MenuItem,{key:e.id,text:e.label,icon:e.icon,svgIcon:e.svgIcon,data:e}):null)))}),[k,ae,ee,V,f]),oe=g.useCallback((()=>r.files&&r.files.length>1?g.createElement("div",{className:"k-chat-download-button-wrapper"},g.createElement(n.Button,{className:"k-chat-download-button",fillMode:"flat",themeColor:"base",svgIcon:l.downloadIcon,onClick:e=>{e.stopPropagation(),N&&N(r.files,r)},"aria-label":H.toLanguageString(x,D[x])},g.createElement("span",{className:"k-button-text"},H.toLanguageString(M,D[M])))):null),[r,N,H]),se=g.useCallback((()=>{if(r.typing)return g.createElement("div",{className:"k-chat-bubble"},g.createElement("div",{className:"k-typing-indicator"},g.createElement("span",null),g.createElement("span",null),g.createElement("span",null)));if(i){const e=i;return g.createElement(e,{item:r})}return r.text||r.files&&r.files.length>0?g.createElement(g.Fragment,null,g.createElement("div",{className:a.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":p,"k-expanded":p&&U,"k-selected":d}),onContextMenu:Z},g.createElement("div",{className:"k-bubble-content",onClick:e=>{e.stopPropagation(),e.preventDefault()}},g.createElement("span",{className:"k-chat-bubble-text"},!r.isDeleted&&ne(),K(te(r,R(y,r)))),r.files&&g.createElement(q,{files:r.files,message:r,onFileAction:F,onDownload:e=>null==N?void 0:N(e,r),renderInTextarea:!1,fileActions:A}),oe()),p&&g.createElement("span",{className:"k-bubble-expandable-indicator",onClick:Y,role:"button","aria-label":U?H.toLanguageString(w,D[w]):H.toLanguageString(T,D[T]),tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),Y(e))}},g.createElement(a.IconWrap,{icon:U?l.chevronUpIcon:l.chevronDownIcon,size:"medium"}))),le()):null}),[r,i,p,U,d,Z,ne,te,y,F,A,oe,Y,H,le,N]),re=g.useCallback((()=>{let t=null;return r.timestamp&&(t=g.createElement("time",{className:"k-message-time","aria-hidden":!d},o.provideIntlService({props:e}).formatDate(r.timestamp,m))),t}),[r.timestamp,d,m,e]),ie=g.useCallback((()=>{let e=null;return r.status&&d&&(e=L?g.createElement(L,{item:r}):g.createElement("span",{className:"k-message-status"},g.createElement(a.IconWrap,{icon:l.checkCircleIcon,size:"xsmall"}),r.status)),e}),[r,d,L]),ce=g.useCallback((()=>a.classNames({"k-focus":d,"k-message-removed":r.isDeleted},"k-message")),[d,r.isDeleted]),ue=g.useCallback((()=>h&&h.length>0&&g.createElement("div",{className:"k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat"},h.map((e=>"delete"!==e.id||f?g.createElement(n.Button,{key:e.id,fillMode:"flat",className:"k-toolbar-button",themeColor:"base",icon:e.icon,svgIcon:e.svgIcon,onClick:t=>{t.stopPropagation(),"copy"!==e.id||r.isDeleted?"reply"===e.id&&v(r):_(),E&&E(e,t,r)},onMouseDown:e=>e.preventDefault()}):null)))),[_,f,r,h,E,v]);return g.createElement("div",{"data-message-id":r.id,className:ce(),tabIndex:u,onClick:()=>c(d?void 0:r.selectionIndex),onMouseDown:X,onKeyDown:J,onFocus:e=>{$&&c(r.selectionIndex)},ref:e=>{Q.current=e,"function"==typeof t?t(e):t&&(t.current=e)}},re(),se(),ie(),ue())}));z.displayName="ChatMessage";class U extends g.Component{render(){return g.createElement(z,{...this.props})}}o.registerForIntl(U);const j=e=>e[e.length-1],$=e=>(t,a,n)=>{const l=n===e-1;return((e,t)=>{const a=t.timestamp,n=j(e);if(a&&(!n||((e,t)=>e&&t&&(t.getDate()!==e.getDate()||t.getMonth()!==e.getMonth()||t.getFullYear()!==e.getFullYear()))(a,n.timestamp))){const t={type:"date-marker",timestamp:a,trackBy:a.getTime()};e.push(t)}})(t,a),((e,t,a)=>{const n=j(e);let l;t.typing&&!a||(n&&"message-group"===n.type&&(l=n.messages),l&&R(t.author,j(l))?l.push(t):e.push({type:"message-group",messages:[t],author:t.author,timestamp:t.timestamp,trackBy:t}))})(t,a,l),a.attachments&&a.attachments.length>1&&t.push({type:"attachment-group",attachments:a.attachments,attachmentLayout:a.attachmentLayout,timestamp:a.timestamp,trackBy:a}),a.suggestedActions&&l&&t.push({type:"action-group",actions:a.suggestedActions,timestamp:a.timestamp,trackBy:a}),t};const W=e=>{const t=e.slice().reduce($(e.length),[]);return function(e){let t=0;e.forEach((e=>{"message-group"===e.type?e.messages.forEach((e=>{e.selectionIndex=t++})):("attachment-group"===e.type||"action-group"===e.type)&&(e.selectionIndex=t++)})),e.lastSelectionIndex=t-1}(t),t},H=e=>{const{item:t,onActionExecute:n,selected:l}=e,o=g.useRef(null);g.useEffect((()=>{l&&o.current&&o.current.focus()}),[l]);const s=g.useCallback((e=>{(e.keyCode===a.Keys.enter||" "===e.key)&&(e.preventDefault(),n(t,e))}),[n,t]),r=g.useCallback((()=>a.classNames("k-suggestion k-suggestion-primary",{"k-selected":l},{"k-focus":l})),[l]);return g.createElement("span",{role:"button",className:r(),onClick:e=>n(t,e),ref:o,onKeyDown:s,tabIndex:0,"aria-label":t.title||t.value},t.title||t.value)},G=e=>{var t;const{group:n,onActionExecute:l,selected:o,onRequestSelection:s}=e,[r,i]=g.useState(null);g.useEffect((()=>{o||null===r?o&&null===r&&i(0):i(null)}),[o,r]);const c=g.useCallback((()=>n.actions?n.actions.length-1:-1),[n.actions]),u=g.useCallback(((e,t=0)=>{let a=null;return e?null===r?a=t:r<c()&&(a=r+1):null===r?a=0:r>0&&(a=r-1),null!==a&&i(a),a}),[r,c]),m=g.useCallback((()=>{s(n.selectionIndex)}),[s,n.selectionIndex]),d=g.useCallback((e=>{let t=null;const n=a.Keys.left,l=a.Keys.right;e.keyCode===n?t=u(!1):e.keyCode===l&&(t=u(!0)),null!==t&&(e.preventDefault(),e.stopPropagation())}),[u]),p=g.useCallback((()=>a.classNames("k-suggestion-group")),[]);return g.createElement("div",{className:p(),onClick:m,onKeyDown:d,role:"toolbar",tabIndex:0,"aria-label":"Action group"},null==(t=n.actions)?void 0:t.map(((e,t)=>g.createElement(H,{item:e,onActionExecute:l,selected:t===r,key:e.value}))))},_=e=>{const{item:t,template:n,tabbable:l,onClick:o,selected:s}=e,r=g.useRef(null);g.useEffect((()=>{s&&r.current&&r.current.focus()}),[s]);const i=g.useCallback((()=>{if(void 0!==l)return l?0:-1}),[l]),c=g.useCallback((()=>a.classNames({"k-selected":s},{"k-focus":s})),[s]),u=g.useCallback((()=>t.title?g.createElement("h5",{className:"k-card-title"},t.title):null),[t.title]),m=g.useCallback((()=>t.subtitle?g.createElement("h6",{className:"k-card-subtitle"},t.subtitle):null),[t.subtitle]),d=g.useCallback((()=>0===t.contentType.indexOf("image/")?g.createElement("img",{src:t.content,alt:t.title||"Attachment"}):t.content),[t.contentType,t.content,t.title]),p=n;return g.createElement("div",{className:c(),tabIndex:i(),onClick:o,ref:r},n?g.createElement(p,{item:t}):g.createElement("div",{className:"k-card"},g.createElement("div",{className:"k-card-body"},u(),m(),d())))},Y=e=>{const{group:t,itemTemplate:o,selected:s,isLastGroup:r,onRequestSelection:i}=e,[c,u]=g.useState(null);g.useEffect((()=>{s||null===c?s&&null===c&&u(0):u(null)}),[s,c]);const m=g.useCallback((e=>"list"!==e.attachmentLayout),[]),d=g.useCallback((()=>t.attachments?t.attachments.length-1:-1),[t.attachments]),p=g.useCallback((()=>t.attachments.length-1),[t.attachments]),h=g.useCallback(((e,t=0)=>{let a=null;return e?null===c?a=t:c<d()&&(a=c+1):null===c?a=0:c>0&&(a=c-1),null!==a&&u(a),a}),[c,d]),k=g.useCallback((()=>{i(t.selectionIndex)}),[i,t.selectionIndex]),f=g.useCallback((e=>{let n,l,o=null;m(t)?(n=a.Keys.left,l=a.Keys.right):(n=a.Keys.up,l=a.Keys.down),e.keyCode===n?o=h(!1):e.keyCode===l&&(o=h(!0)),null!==o&&(e.preventDefault(),e.stopPropagation())}),[h,m,t]),v=g.useCallback((e=>{k(),u(e)}),[k]),C=g.useCallback((e=>{k(),h(e,1)}),[k,h]),y=g.useCallback((()=>{let e=null;return m(t)&&c&&(e=g.createElement(n.Button,{icon:"chevron-left",onClick:()=>C(!1),svgIcon:l.chevronLeftIcon})),e}),[m,t,c,C]),b=g.useCallback((()=>{let e=null;return m(t)&&c!==p()&&(e=g.createElement(n.Button,{icon:"chevron-right",onClick:()=>C(!0),svgIcon:l.chevronRightIcon})),e}),[m,t,c,p,C]),E=g.useCallback((()=>a.classNames({"k-card-list":t.attachmentLayout,"k-card-deck":m(t)})),[t.attachmentLayout,t,m]),I=m(t),x=g.createElement("div",{className:E(),onKeyDown:I?void 0:f},t.attachments.map(((e,t)=>g.createElement(_,{item:e,template:o,selected:t===c,tabbable:r&&t===c,onClick:()=>v(t),key:e.content}))));return I?g.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:f},y(),x,b()):x},X=({item:e,timestampTemplate:t})=>{const a=t;return g.createElement("div",{className:"k-timestamp"},a?g.createElement(a,{item:e}):o.provideIntlService({props:{item:e}}).formatDate(e.timestamp,"D"))};let J=class extends g.Component{render(){return g.createElement(X,{...this.props})}};o.registerForIntl(J);const Q=e=>{const{group:t,user:n,itemTemplate:l,attachmentTemplate:r,onRequestSelection:i,selectedItemIndex:c,isLastGroup:u,message:m,allowMessageCollapse:d,messageToolbarActions:p,messageContextMenuActions:h,messageWidthMode:k="standard"}=e,v=o.useLocalization(),C=t.messages.length>0&&R(n,t.messages[0]),y=!C,b=g.useMemo((()=>a.classNames("k-message-group",{"k-message-group-sender k-no-avatar":C,"k-message-group-receiver":y,"k-message-group-full-width":"full"===k})),[C,y,k]),E=g.useMemo((()=>{const e=t.messages.length-1;return t.messages.map(((t,a)=>{const o=[g.createElement(m,{item:t,template:l,selected:t.selectionIndex===c,onRequestSelection:i,tabIndex:a===e&&u?0:-1,key:t.id,allowMessageCollapse:d,messageToolbarActions:p,messageContextMenuActions:h,isSender:R(n,t)})];return t.attachments&&1===t.attachments.length&&o.push(g.createElement(_,{item:t.attachments[0],template:r,selected:!1,key:`att-${t.attachments[0].content}`})),o}))}),[t.messages,m,l,c,i,u,d,p,h,n,r]),{avatarUrl:I,avatarAltText:x,name:F}=t.author,w=void 0!==x?x:v.toLanguageString(f,D[f]);return g.createElement("div",{className:b},(()=>{if(y&&I)return g.createElement(s.Avatar,{type:"image"},g.createElement("img",{src:I,alt:w}))})(),g.createElement("div",{className:"k-message-group-content"},g.createElement("span",{className:"k-message-author"},F),E))},Z=e=>{const{suggestions:t,onSuggestionClick:n,suggestionsView:l,suggestionTemplate:o}=e,s=g.useCallback(((e,t)=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),null==n||n(t))}),[n]),r=g.useCallback((()=>t.map((e=>o?g.createElement(o,{key:e.id,suggestion:e,onClick:()=>{null==n||n(e)}}):g.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:()=>!e.disabled&&(null==n?void 0:n(e)),onKeyDown:t=>!e.disabled&&s(t,e),key:e.id,title:e.description,className:a.classNames("classic"===l?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},e.text)))),[t,o,n,l,s]);return t&&0!==t.length?"classic"===l?r():g.createElement("div",{role:"group",className:"k-suggestion-group"},r()):null},ee=g.forwardRef(((e,t)=>{const{onSendMessage:s,isDirectionRightToLeft:r,placeholder:u,MessageBox:m,suggestions:d,onSuggestionClick:p,inputValue:f,onInputValueChange:v,suggestionTemplate:C,sendButtonConfig:y}=e,{replyToMessage:b,setReplyToMessage:E,user:I,messageListScrollContainerRef:x,speechToTextConfig:w,uploadConfig:T}=O(),[N]=g.useState(!1),[A,M]=g.useState(void 0),[B,L]=g.useState([]),[K,V]=g.useState(!1),z=g.useRef(null),U=g.useRef(null),j=o.useLocalization(),$=g.useCallback((()=>{null!==z.current&&z.current.focus()}),[]);g.useEffect((()=>{void 0!==f&&f!==A&&(M(f),$())}),[f,A,$]),g.useEffect((()=>{b&&$()}),[b,$]),g.useLayoutEffect((()=>{K&&null!=x&&x.current&&(x.current.scrollTop=x.current.scrollHeight-x.current.clientHeight,V(!1))}),[K,x]);const W=g.useCallback((e=>{const t=e.value;M(t),v&&v(t)}),[v]),H=g.useMemo((()=>!!(null!=A&&A.trim()||B.length>0)),[A,B.length]),G=g.useCallback((e=>{if(e.preventDefault(),s){if(H){const t={id:"",author:I,text:A||"",timestamp:new Date,replyToId:b?b.id:void 0,files:B.map((e=>({name:e.name,size:e.size,type:e.extension,rawFile:e.getRawFile?e.getRawFile():e})))};E(null),s(t,e),L([]),M(""),v&&v(""),V(!0)}}}),[s,A,I,b,B,E,v,H]),_=g.useCallback((e=>{if("Enter"!==e.key||!e.shiftKey)switch(e.key){case"Enter":return e.preventDefault(),G(e);case"Escape":z.current&&z.current.blur();break;default:return}}),[G]);g.useImperativeHandle(t,(()=>({focusInput:$})),[$]);const Y=g.useCallback((e=>{L((t=>t.filter((t=>t.name!==e))))}),[]),X=g.useCallback((()=>g.createElement(q,{files:B,onFileRemove:Y,renderInTextarea:!0})),[B,Y]),J=g.useCallback(((e,t)=>e.isDeleted?P(t,j):e.text),[j]),Q=g.useCallback((()=>{if(b){const e=R(I,b);return g.createElement("div",{className:a.classNames("k-message-reference",e?"k-message-reference-sender":"k-message-reference-receiver")},g.createElement("div",{className:"k-message-reference-content"},J(b,e)),g.createElement("span",{className:"k-spacer"}),g.createElement(n.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:()=>E(null),"aria-label":j.toLanguageString(F,D[F])}))}return null}),[b,I,J,E,j]),ee=g.useCallback((e=>{try{const t=Array.from(e.newState);L((e=>[...e,...t])),$()}catch{}}),[$]),te=g.useCallback((()=>{U.current&&U.current.actionElement.click()}),[]),ae=g.useCallback((e=>{}),[]),ne=g.useCallback((e=>{const{isFinal:t,alternatives:a}=e;if(a.length>0){const e=a[0];t&&M((t=>(t?`${t} `:"")+e.transcript))}}),[]),le=g.useCallback((()=>g.createElement(g.Fragment,null,B.length>0&&X(),b&&g.createElement("span",{className:"k-input-prefix k-input-prefix-horizontal"},Q()))),[B.length,b,X,Q]),oe=g.useCallback((e=>{e.preventDefault()}),[]),se=g.useCallback((e=>{"Escape"===e.key&&e.currentTarget.blur()}),[]),re=g.useMemo((()=>g.createElement(n.Button,{rounded:"full",fillMode:"solid",themeColor:"primary",className:"k-chat-send",icon:"paper-plane",svgIcon:l.paperPlaneIcon,onClick:G,onMouseDown:oe,onKeyDown:se,"aria-label":j.toLanguageString(h,D[h]),dir:r?"rtl":void 0,disabled:!H,"aria-disabled":!H,...y})),[G,oe,se,j,r,H,y]),ie=g.useCallback((()=>{const e="object"==typeof w?w:void 0,t="object"==typeof T?T:{},{className:o,...s}=t,r=a.classNames("k-hidden",o);return g.createElement(c.InputSuffix,null,!1!==w&&g.createElement(n.SpeechToTextButton,{fillMode:"clear",themeColor:"base",onError:ae,onResult:ne,...e}),g.createElement(n.Button,{key:"attach-file",fillMode:"clear",themeColor:"base",svgIcon:l.paperclipIcon,onClick:te,"aria-label":j.toLanguageString(S,D[S])}),g.createElement(i.Upload,{ref:U,files:B,onAdd:ee,multiple:!0,autoUpload:!1,...s,className:r}),g.createElement("span",{className:"k-spacer"}),re)}),[w,T,B,ae,ne,te,ee,j,re]),ce=g.useMemo((()=>g.createElement(c.TextArea,{className:a.classNames("k-message-box","!k-flex-col",{"k-focus":N}),resizable:"none",rows:1,placeholder:u,value:A,onChange:W,onKeyDown:_,prefix:le,suffix:ie,ref:z,"aria-label":j.toLanguageString(k,D[k])})),[N,u,A,W,_,le,ie,j]);return g.createElement("div",{className:"k-message-box-wrapper"},d&&d.length>0&&g.createElement(Z,{onSuggestionClick:p,suggestions:d,suggestionTemplate:C}),m?g.createElement(m,{messageInput:ce,sendButton:re}):ce)}));ee.displayName="NewMessage";const te=e=>g.createElement(s.AppBar,{className:"k-chat-header",positionMode:"sticky",themeColor:"light"},e.children),ae=e=>{const{message:t,onUnpin:s,user:r}=e,i=o.useLocalization(),{internalScrollContainerRef:c}=O(),u=g.useCallback((e=>{e.preventDefault(),e.stopPropagation();const a=null==c?void 0:c.current;B(t.id,a)}),[t.id,c]);return g.createElement("div",{className:"k-message-reference k-message-reference-receiver k-message-pinned",onClick:u},g.createElement(a.IconWrap,{size:"xlarge",icon:l.pinIcon}),g.createElement("div",{className:"k-message-reference-content"},null!=t&&t.isDeleted?r&&P(R(r,t),i):null==t?void 0:t.text),g.createElement("span",{className:"k-spacer"}),g.createElement(n.Button,{svgIcon:l.xIcon,onClick:e=>{e.stopPropagation(),null==s||s(t)}}))},ne=e=>{const{show:t,text:a}=e;return g.createElement("div",{style:{position:"absolute",top:"90%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,pointerEvents:t?"auto":"none"}},g.createElement(u.Fade,null,t&&g.createElement(m.Notification,{type:{style:"dark"},closable:!1},g.createElement("span",null,a))))},le=Object.freeze({name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"12.0.0-develop.4",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"}),oe={textField:"text",statusField:"status",authorIdField:"authorId",authorNameField:"authorName",authorImageUrlField:"authorImageUrl",authorImageAltTextField:"authorImageAltText",idField:"id",timestampField:"timestamp",filesField:"files",attachmentsField:"attachments",replyToIdField:"replyToId",isDeletedField:"isDeleted",isPinnedField:"isPinned",typingField:"typing",suggestedActionsField:"suggestedActions"},se=(e,t={})=>{const a={...oe,...t};let n;n=e.author&&"object"==typeof e.author?{id:e.author.id||e.author[a.authorIdField]||"",name:e.author.name||e.author[a.authorNameField],avatarUrl:e.author.avatarUrl||e.author[a.authorImageUrlField],avatarAltText:e.author.avatarAltText||e.author[a.authorImageAltTextField]}:{id:e[a.authorIdField]||"",name:e[a.authorNameField],avatarUrl:e[a.authorImageUrlField],avatarAltText:e[a.authorImageAltTextField]};const l={id:e[a.idField],text:e[a.textField]||"",author:n,timestamp:e[a.timestampField]?new Date(e[a.timestampField]):new Date,status:e[a.statusField],attachments:e[a.attachmentsField],attachmentLayout:e.attachmentLayout||"list",suggestedActions:e[a.suggestedActionsField],isPinned:e[a.isPinnedField]||!1,typing:e[a.typingField],files:e[a.filesField]||[]};return e.pinnedAt&&(l.pinnedAt=new Date(e.pinnedAt)),e.pinnedBy&&(l.pinnedBy=e.pinnedBy),e[a.replyToIdField]&&(l.replyToId=e[a.replyToIdField]),e[a.isDeletedField]&&(l.isDeleted=e[a.isDeletedField]),l},re=(e,t={})=>Array.isArray(e)?e.map((e=>se(e,t))):[],ie=e=>e&&void 0!==e.id&&"string"==typeof e.text&&e.author&&"object"==typeof e.author&&void 0!==e.author.id&&(e.timestamp instanceof Date||"string"==typeof e.timestamp||"number"==typeof e.timestamp),ce=g.forwardRef(((e,t)=>{const{messages:n=[],messageTemplate:l,attachmentTemplate:s,width:r,height:i,onSendMessage:c,onSuggestionClick:u,onInputValueChange:m,onActionExecute:d,dir:p,messageBox:h,placeholder:k,className:f,message:C=z,authorId:y,suggestions:b,suggestionTemplate:E,inputValue:x,headerTemplate:F,timestampTemplate:w,statusTemplate:T,allowMessageCollapse:N,messageToolbarActions:A,messageContextMenuActions:S,fileActions:M,onUnpin:R,messageWidthMode:P,onToolbarAction:B,onContextMenuAction:L,onFileAction:K,onDownload:O,speechToTextConfig:q,uploadConfig:U,sendButtonConfig:j,textField:$,statusField:H,authorIdField:_,authorNameField:J,authorImageUrlField:Z,authorImageAltTextField:oe,idField:se,timestampField:ce,filesField:ue,attachmentsField:me,replyToIdField:de,isDeletedField:pe,isPinnedField:ge,typingField:he,suggestedActionsField:ke,...fe}=e,[ve,Ce]=g.useState(null),[ye,be]=g.useState(!1),[Ee,Ie]=g.useState(!1),[xe,Fe]=g.useState(null),[we,Te]=g.useState(null),Ne=g.useRef(null),Ae=g.useRef(null),Se=g.useRef(null),Me=g.useRef(null),De=g.useRef(void 0),Re=g.useRef(void 0),Pe=g.useRef(null),Be=g.useRef(""),Le=g.useMemo((()=>n&&0!==n.length?ie(n[0])?n.map((e=>({...e,timestamp:e.timestamp?new Date(e.timestamp):e.timestamp}))):re(n,{textField:$,statusField:H,authorIdField:_,authorNameField:J,authorImageUrlField:Z,authorImageAltTextField:oe,idField:se,timestampField:ce,filesField:ue,attachmentsField:me,replyToIdField:de,isDeletedField:pe,isPinnedField:ge,typingField:he,suggestedActionsField:ke}):[]),[n,$,H,_,J,Z,oe,se,ce,ue,me,de,pe,ge,he,ke]);g.useEffect((()=>{if(y===Be.current&&Pe.current)Te(Pe.current);else if(y&&Le.length>0){const e=Le.find((e=>e.author&&(e.author.id===y||e.author.id===String(y)))),t=(null==e?void 0:e.author)||{id:y};Pe.current=t,Be.current=y,Te(t)}}),[y,Le]);const Ke=g.useMemo((()=>Le.length>0?W(Le):[]),[Le]),Ve=g.useMemo((()=>!a.validatePackage(le,{component:"Chat"})),[]),Oe=g.useMemo((()=>Le.find((e=>e.isPinned))),[Le]),qe=o.useLocalization(),ze=g.useCallback((()=>{clearTimeout(De.current)}),[]),Ue=g.useCallback((()=>{De.current=window.setTimeout((()=>{Ce(null)}),0)}),[]),je=g.useCallback((e=>{Ce(e)}),[]),$e=g.useCallback((e=>{let t=null;const n=null!==ve?ve:Ke.lastSelectionIndex;e.keyCode===a.Keys.up?null===n?t=0:n>0&&(t=n-1):e.keyCode===a.Keys.down?null===n?t=0:n<Ke.lastSelectionIndex&&(t=n+1):e.keyCode===a.Keys.home?t=0:e.keyCode===a.Keys.end&&(t=Ke.lastSelectionIndex),null!==t&&(Ce(t),e.preventDefault())}),[ve,Ke]),We=g.useCallback((()=>{Se.current&&(Se.current.scrollTop=Se.current.scrollHeight-Se.current.clientHeight)}),[]),He=g.useCallback((()=>{if(!Se.current)return!0;const{scrollTop:e,scrollHeight:t,clientHeight:a}=Se.current;return t-e-a<50}),[]),Ge=g.useCallback((()=>{He()&&requestAnimationFrame((()=>{We()}))}),[He,We]),_e=g.useCallback((()=>{requestAnimationFrame((()=>{We()}))}),[We]),Ye=g.useCallback(((e,t,a)=>{var n;if(d&&d({action:{value:e.value,title:e.title,type:e.type},syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget}),!t.isDefaultPrevented()){switch(e.type){case"reply":c&&c({message:{id:"",author:we,text:e.value,timestamp:new Date},syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget});break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value)}null==(n=Me.current)||n.focusInput()}}),[d,c,we]),Xe=g.useCallback((()=>a.classNames("k-chat",f,{"k-rtl":ye})),[f,ye]),Je=g.useCallback((()=>{const e=Ke.length-1;return Ke.map(((t,a)=>"date-marker"===t.type?g.createElement(X,{item:t,key:t.trackBy,timestampTemplate:w}):"message-group"===t.type?g.createElement(Q,{group:t,itemTemplate:l,attachmentTemplate:s,user:we,selectedItemIndex:ve,onRequestSelection:je,isLastGroup:a===e,key:t.messages[0].selectionIndex,message:C,allowMessageCollapse:N,messageToolbarActions:A,messageContextMenuActions:S,messageWidthMode:P}):"attachment-group"===t.type?g.createElement(Y,{group:t,itemTemplate:s,onRequestSelection:je,selected:t.selectionIndex===ve,isLastGroup:a===e,key:t.selectionIndex}):"action-group"===t.type?g.createElement(G,{group:t,onActionExecute:Ye,onRequestSelection:je,selected:t.selectionIndex===ve,key:t.selectionIndex}):null))}),[Ke,w,l,s,we,ve,je,C,N,A,S,P,Ye]),Qe=g.useCallback((()=>F?"function"==typeof F?F():F:null),[F]);g.useEffect((()=>{const e=void 0!==p?"rtl"===p:Ne.current&&"rtl"===getComputedStyle(Ne.current).direction;be(!!e)}),[p]),g.useEffect((()=>(Re.current=window.setTimeout((()=>We()),250),()=>{clearTimeout(Re.current)})),[We]),g.useEffect((()=>()=>{clearTimeout(De.current),clearTimeout(Re.current)}),[]),g.useEffect((()=>{_e()}),[Le.length,_e]),g.useEffect((()=>{const e=window.setTimeout((()=>{Ge()}),50);return()=>{clearTimeout(e)}}),[Le,Ge]),g.useEffect((()=>{if(b&&b.length>0){const e=window.setTimeout((()=>{Ge()}),100);return()=>{clearTimeout(e)}}}),[b,Ge]);const Ze=g.useMemo((()=>({replyToMessage:xe,setReplyToMessage:Fe,messages:Le,user:we,internalScrollContainerRef:Ae,messageListScrollContainerRef:Se,onToolbarAction:B,onContextMenuAction:L,onFileAction:K,setShowCopyNotification:Ie,onDownload:O,fileActions:M,speechToTextConfig:q,uploadConfig:U,statusTemplate:T})),[xe,Fe,Le,we,B,L,K,Ie,O,M,q,U,T]);return g.createElement(V.Provider,{value:Ze},g.createElement("div",{style:{width:r,height:i,position:"relative",overflow:"hidden"},onKeyDown:$e,className:Xe(),ref:e=>{Ne.current=e,Ae.current=e,"function"==typeof t?t(e):t&&(t.current=e)},...fe},void 0!==F&&g.createElement(te,null,Qe()),Oe&&g.createElement(ae,{message:Oe,onUnpin:R,user:we}),g.createElement("div",{className:"k-message-list k-avatars",onBlur:Ue,onFocus:ze,role:"log","aria-label":qe.toLanguageString(v,D[v]),"aria-live":"polite",ref:Se},g.createElement("div",{className:"k-message-list-content"},Je())),g.createElement(ee,{onSendMessage:(e,t)=>{c&&c({message:e,syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget})},onSuggestionClick:e=>{u&&u(e)},isDirectionRightToLeft:ye,ref:Me,placeholder:k,MessageBox:h,suggestions:b,suggestionTemplate:E,inputValue:x,onInputValueChange:e=>{m&&m(e)},sendButtonConfig:j}),Ve&&g.createElement(a.WatermarkOverlay,null),g.createElement(ne,{show:Ee,text:qe.toLanguageString(I,D[I])})))}));ce.displayName="Chat",ce.propTypes={messages:r.arrayOf(r.object),user:r.object,messageTemplate:r.any,attachmentTemplate:r.any,width:r.oneOfType([r.string,r.number]),onSendMessage:r.func,onActionExecute:r.func,dir:r.string,messageBox:r.any};const ue=e=>{const{activeView:a,toolbarItems:l,activeViewChange:o}=e;return t.createElement("div",{className:"k-prompt-header"},t.createElement(n.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},l.map((e=>t.isValidElement(e)?e:t.createElement(n.Button,{key:e.name,className:a===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,onClick:()=>(e=>{null==o||o.call(null,e)})(e.name)},e.buttonText)))))},me={name:"Output view",buttonText:"Output",buttonIcon:l.commentIcon},de={name:"Commands view",buttonIcon:l.moreHorizontalIcon},pe={name:"Prompt view",buttonText:"Ask AI",buttonIcon:l.sparklesIcon},ge=t.createContext([{},()=>{}]),he=()=>t.useContext(ge),ke=e=>{const{children:a}=e;return t.createElement("div",{className:"k-prompt-footer"},t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},a))},fe=t.forwardRef(((e,a)=>{const{children:s,streaming:r,onCancel:i}=e,c=o.useLocalization().toLanguageString(y,D[y]),[u]=he(),m=u.activeView===me.name,d=r&&m,p=t.useCallback((e=>{"Escape"===e.key&&d&&i&&(e.preventDefault(),i())}),[d,i]);return t.createElement("div",{className:"k-prompt-content",ref:a,onKeyDown:p},d&&t.createElement(n.FloatingActionButton,{onClick:i,svgIcon:l.stopSmIcon,icon:"stop-sm",size:"medium",positionMode:"absolute",className:"k-prompt-stop-fab k-generating","aria-label":c,title:c}),t.createElement("div",{className:"k-prompt-view"},s))}));fe.displayName="KendoReactAIPromptContent";const ve=e=>{const[t]=he();return t.activeView===e.name?e.children:null},Ce=e=>{const[a,o]=t.useState(!0),{children:s,title:r}=e;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(n.Button,{"aria-controls":e.id,fillMode:"flat",svgIcon:a?l.chevronUpIcon:l.chevronDownIcon,title:r,onClick:()=>o(!a),"aria-expanded":a},r),a&&t.createElement("div",{id:e.id,className:"k-prompt-expander-content"},s))},ye=e=>null==e?void 0:e.map((e=>t.createElement(s.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&ye(e.children||[])))),be=({show:e=!1,anchor:a,onOpen:n,onClose:l,animate:o=!0,appendTo:s,popupOptions:r={},children:i,style:c})=>t.createElement(d.Popup,{show:e,anchor:a,style:c,animate:o,appendTo:s,onOpen:n,onClose:l,...r},i),Ee=({placeholder:e="Ask or generate content with AI...",promptValue:o,onMenuClick:s,promptInput:r=c.TextArea,generateButton:i,enableSpeechToText:u=!1,streaming:m=!1,commands:d,onPromptRequest:p,onPromptCancel:g})=>{const[h,k]=t.useState(o||""),[f,v]=a.useCustomComponent(i),[C,y]=a.useCustomComponent(r),b={svgIcon:m?l.stopSmIcon:l.paperPlaneIcon,active:(!!m).toString(),title:"Send Button","aria-label":"Send Button",disabled:!h.trim()&&!m,"aria-disabled":!h.trim()&&!m},E={placeholder:e,className:"!k-flex-row",autoSize:!0,rows:1},I=d&&d.length>0,x=Object.keys(v).length>0?v:b,F=Object.keys(y).length>0?y:E,w=e=>{const{isFinal:t,alternatives:a}=e;if(t&&a.length>0){const e=a[0].transcript,t=(()=>{const t=h,a=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(a?" ":"")+e})();k(t)}},T=()=>{h.trim()&&p&&p(h.trim())};return t.createElement(C,{value:h,onChange:e=>{const t=e.target.value;k(t)},onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),T())},prefix:I||u?t.createElement(t.Fragment,null,t.createElement(c.InputPrefix,{className:"!k-align-items-start"},I&&t.createElement(n.Button,{"aria-label":"Commands Button",title:"Commands Button",fillMode:"flat",svgIcon:l.menuIcon,onClick:s}),u&&t.createElement(n.SpeechToTextButton,{fillMode:"flat",..."object"==typeof u?{...u,onResult:u.onResult||w}:{onResult:w}})),t.createElement(c.InputSeparator,null)):void 0,suffix:t.createElement(c.InputSuffix,{className:"!k-align-items-start"},t.createElement(f,{className:a.classNames("k-prompt-send",{"k-generating":m,"k-active":m}),fillMode:"flat",onClick:m?g:T,...x})),...F})};e.AIPrompt=e=>{const n=!a.validatePackage(le,{component:"AIPrompt"}),l=a.getLicenseMessage(le),{activeView:o,toolbarItems:s,children:r,onActiveViewChange:i,onPromptRequest:c,onCommandExecute:u,style:m,dir:d,className:p,streaming:g,loading:h,onCancel:k,suggestionsView:f,...v}=e,C=s||[pe,me],[y,b]=t.useState({activeView:o}),E={...y,activeView:o,streaming:g,loading:h,suggestionsView:null!=f?f:"classic",onCancel:k,onActiveViewChange:i,onPromptRequest:c,onCommandExecute:u};return t.createElement(ge.Provider,{value:[E,e=>{b(e)}]},t.createElement("div",{className:a.classNames("k-prompt",p),style:m,dir:d,...v},t.createElement(ue,{activeView:E.activeView,toolbarItems:C,activeViewChange:i}),r,n&&t.createElement(a.WatermarkOverlay,{message:l})))},e.AIPromptCommandsView=e=>{const{commands:a}=e,[n]=he();return t.createElement(ve,{name:de.name},t.createElement(fe,{streaming:n.streaming,onCancel:n.onCancel},t.createElement("div",{className:"k-prompt-view"},t.createElement(s.PanelBar,{onSelect:e=>{var t,a,l;const o=null==(a=null==(t=e.target)?void 0:t.props)?void 0:a.data;null!=(l=o.children)&&l.length||n.onCommandExecute&&n.onCommandExecute.call(null,o)},selected:""},ye(null!=a?a:[])))))},e.AIPromptContent=fe,e.AIPromptFooter=ke,e.AIPromptOutputView=e=>{const[a,r]=t.useState(""),i=t.useRef(null),[c]=he(),{outputs:u,showOutputRating:m,outputCard:d}=e,{header:p,body:g,actions:h}=d||{},k=o.useLocalization(),f=(e,t)=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),v()},v=()=>{i&&i.current&&i.current.scrollTo({top:0,behavior:"smooth"})},y=t.createElement(s.Card,null,t.createElement(s.CardHeader,null,t.createElement(s.CardTitle,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}})),t.createElement(s.CardSubtitle,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),t.createElement(s.CardBody,null,t.createElement("span",{className:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}})),t.createElement(s.CardActions,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),b=null==u?void 0:u.map(((e,o)=>t.createElement(s.Card,{key:`${e.id}_${o}`},t.createElement(s.CardHeader,null,p?p(e):t.createElement(t.Fragment,null,e.title&&t.createElement(s.CardTitle,null,e.title),e.subTitle&&t.createElement(s.CardSubtitle,null,e.subTitle))),t.createElement(s.CardBody,null,g?g(e):e.responseContent),t.createElement(s.CardActions,null,h?h(e):t.createElement(t.Fragment,null,t.createElement(n.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:a===e.id?l.checkIcon:l.copyIcon,onClick:()=>(e=>{null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),r(e.id),setTimeout((()=>{r("")}),1e3)})(e)},"Copy"),t.createElement(n.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:l.arrowRotateCwIcon,onClick:()=>(e=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),v()})(e)},"Retry"),m&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-spacer"}),t.createElement(n.Button,{size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:l.thumbUpOutlineIcon,onClick:()=>f(e,"positive")}),t.createElement(n.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:l.thumbDownOutlineIcon,onClick:()=>f(e,"negative")}))))))),E=t.createElement(s.Card,null,t.createElement(s.CardBody,null,k.toLanguageString(C,D[C])));return t.createElement(ve,{name:me.name},t.createElement(fe,{ref:i,streaming:c.streaming,onCancel:c.onCancel},t.createElement("div",{className:"k-card-list"},c.loading&&y,b,(!b||0===b.length)&&!c.loading&&E)))},e.AIPromptView=e=>{const{promptInput:o=c.TextArea,generateButton:s=n.Button,enableSpeechToText:r=!1,promptValue:i,promptSuggestions:u}=e,[m,d]=t.useState(i||""),[p]=he(),[g,h]=a.useCustomComponent(s),[k,f]=a.useCustomComponent(o),v={title:"Generate",children:"Generate",svgIcon:l.sparklesIcon},C=Object.keys(h).length>0?h:v,y=Object.keys(f).length>0?f:{placeholder:"Ask or generate content with AI ...",rows:2},b=e=>{const{isFinal:t,alternatives:a}=e;if(t&&a.length>0){const e=a[0].transcript,t=(()=>{const t=m,a=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(a?" ":"")+e})();d(t)}};let E;return r&&(E="object"==typeof r?{...r,onResult:r.onResult||b}:{onResult:b}),t.createElement(ve,{name:pe.name},t.createElement(fe,{streaming:p.streaming,onCancel:p.onCancel},t.createElement(k,{value:m,className:"!k-flex-col",suffix:r?t.createElement(t.Fragment,null,t.createElement(c.InputSeparator,{orientation:"horizontal"}),t.createElement(c.InputSuffix,{orientation:"horizontal"},t.createElement(n.SpeechToTextButton,{fillMode:"flat",...E}))):void 0,onChange:e=>{d(e.target.value)},...y}),u&&u.length>0&&t.createElement(Ce,{title:"Prompt Suggestions"},t.createElement(Z,{suggestionsView:p.suggestionsView,suggestions:u.map(((e,t)=>({id:t,text:e,description:e}))),onSuggestionClick:e=>{(e=>{d(e)})(e.text)}}))),t.createElement(ke,null,t.createElement(g,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:()=>{p.onPromptRequest&&p.onPromptRequest.call(null,m),d("")},disabled:!m.trim(),...C},C.children)))},e.AIPromptViewRender=ve,e.Chat=ce,e.ChatMessage=z,e.DEFAULT_FIELD_MAPPING=oe,e.HeroCard=e=>{const{imageUrl:t,imageMaxWidth:a,title:l,subtitle:o,actions:s,onActionExecute:r,altText:i}=e,c=g.useCallback(((e,t)=>{null==r||r({action:e,syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget})}),[r]),u=i||l||"";return g.createElement("div",{className:"k-card"},g.createElement("img",{className:"k-card-image",src:t,style:{maxWidth:a},alt:u}),g.createElement("div",{className:"k-card-body"},l&&g.createElement("h5",{className:"k-card-title"},l),o&&g.createElement("h6",{className:"k-card-subtitle"},o)),g.createElement("div",{className:"k-card-actions k-card-actions-vertical"},s.map(((e,t)=>g.createElement("span",{className:"k-card-action",key:`action-${t}-${e.title||e.value||t}`},g.createElement(n.Button,{fillMode:"flat",onClick:t=>c(e,t)},e.title))))))},e.InlineAIPrompt=e=>{const o=!a.validatePackage(le,{component:"InlineAIPrompt"}),r=a.getLicenseMessage(le),{outputs:i=[],outputCard:u,promptInput:m=c.TextArea,generateButton:d=n.Button,promptPlaceholder:p="Ask or generate content with AI...",promptValue:g,onPromptRequest:h,onCopy:k,onDiscard:f,outputActions:v,onOutputAction:C,enableSpeechToText:y=!1,streaming:b,onPromptCancel:E,show:I=!1,anchor:x,width:F,height:w,onOpen:T,onClose:N,animate:A=!0,appendTo:S,commands:M,onCommandExecute:D,style:R,className:P,popupOptions:B={},...L}=e,[K,V]=t.useState(""),[O,q]=t.useState(!1),[z,U]=t.useState({left:0,top:0}),j=t.useRef(null),{body:$,actions:W}=u||{},H=v||[{id:"copy",text:"Copy",svgIcon:l.copyIcon,themeColor:"primary",title:"Copy"},{id:"discard",text:"Discard",svgIcon:l.cancelOutlineIcon,themeColor:"base",title:"Discard"}],G=(e,t)=>{switch(e.id){case"copy":(e=>{e.responseContent&&(navigator.clipboard.writeText(e.responseContent),V(e.id),setTimeout((()=>V("")),1e3)),null==k||k(e)})(t);break;case"discard":(e=>{null==f||f(e)})(t);break;default:null==C||C(e,t)}},_=t.useCallback((e=>{"Escape"===e.key&&(b&&E?E():!b&&N&&N({target:null}))}),[b,E,N]),Y={...R,...F&&{width:F},...w&&{height:w}},X={...F&&{width:F},...w&&{height:w}},J=t.createElement(t.Fragment,null,t.createElement("div",{className:a.classNames("k-prompt",P),style:Y,onKeyDown:_,...L},t.createElement(fe,{ref:j},i&&i.length>0&&t.createElement("div",{className:"k-card-list"},i.map(((e,a)=>t.createElement(s.Card,{key:`${e.id}_${a}`},t.createElement(s.CardBody,null,$?$(e):e.responseContent),t.createElement(s.CardActions,null,W?W(e):t.createElement(t.Fragment,null,H.map((a=>{var o;return a.spacer?t.createElement("span",{key:a.id,className:"k-spacer"}):t.createElement(n.Button,{key:a.id,size:"medium",themeColor:a.themeColor||"primary",fillMode:"flat",rounded:"medium",title:null!=(o=a.title)?o:a.text,svgIcon:"copy"===a.id&&K===e.id?l.checkIcon:a.svgIcon,onClick:()=>G(a,e)},a.text)})))))))),t.createElement(Ee,{promptValue:g,placeholder:p,onPromptRequest:h,onMenuClick:e=>{if(!j.current)return;const t=j.current.getBoundingClientRect();U({left:t.left,top:t.bottom}),q(!0)},onPromptCancel:E,promptInput:m,generateButton:d,enableSpeechToText:y,streaming:b,commands:M}))),o&&t.createElement(a.WatermarkOverlay,{message:r}));return t.createElement(t.Fragment,null,t.createElement(be,{show:I,anchor:x,onOpen:T,onClose:N,animate:A,appendTo:S,popupOptions:B,style:X},J),t.createElement(s.ContextMenu,{show:O,offset:z,onClose:()=>{q(!1)},items:(e=>null==e?void 0:e.map((e=>({text:e.text,svgIcon:e.svgIcon,data:e,items:e.children?e.children.map((e=>({text:e.text,data:e}))):void 0}))))(M),onSelect:e=>{var t,a;const n=null==(t=e.item)?void 0:t.data;n&&(null==(a=n.children)||!a.length)&&(e=>{q(!1),D&&D(e)})(n)}}))},e.PromptHeader=ue,e.SuggestionGroup=Z,e.commandsViewDefaults=de,e.extractFieldMappingFromProps=e=>({textField:e.textField,statusField:e.statusField,authorIdField:e.authorIdField,authorNameField:e.authorNameField,authorImageUrlField:e.authorImageUrlField,authorImageAltTextField:e.authorImageAltTextField,idField:e.idField,timestampField:e.timestampField,filesField:e.filesField,attachmentsField:e.attachmentsField,replyToIdField:e.replyToIdField,isDeletedField:e.isDeletedField,isPinnedField:e.isPinnedField,typingField:e.typingField,suggestedActionsField:e.suggestedActionsField}),e.isStandardMessageFormat=ie,e.mapDataArrayToMessages=re,e.mapDataToMessage=se,e.mapMessageToCustomFormat=(e,t={})=>{const a={...oe,...t},n={};return void 0!==e.id&&(n[a.idField]=e.id),void 0!==e.text&&(n[a.textField]=e.text),void 0!==e.status&&(n[a.statusField]=e.status),void 0!==e.timestamp&&(n[a.timestampField]=e.timestamp),void 0!==e.attachments&&(n[a.attachmentsField]=e.attachments),void 0!==e.files&&(n[a.filesField]=e.files),void 0!==e.suggestedActions&&(n[a.suggestedActionsField]=e.suggestedActions),void 0!==e.replyToId&&(n[a.replyToIdField]=e.replyToId),void 0!==e.isDeleted&&(n[a.isDeletedField]=e.isDeleted),void 0!==e.isPinned&&(n[a.isPinnedField]=e.isPinned),void 0!==e.typing&&(n[a.typingField]=e.typing),e.author&&(void 0!==e.author.id&&(n[a.authorIdField]=e.author.id),void 0!==e.author.name&&(n[a.authorNameField]=e.author.name),void 0!==e.author.avatarUrl&&(n[a.authorImageUrlField]=e.author.avatarUrl),void 0!==e.author.avatarAltText&&(n[a.authorImageAltTextField]=e.author.avatarAltText)),void 0!==e.pinnedAt&&(n.pinnedAt=e.pinnedAt),void 0!==e.pinnedBy&&(n.pinnedBy=e.pinnedBy),void 0!==e.attachmentLayout&&(n.attachmentLayout=e.attachmentLayout),n},e.outputViewDefaults=me,e.promptViewDefaults=pe}));
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-intl"),require("@progress/kendo-react-layout"),require("prop-types"),require("@progress/kendo-react-upload"),require("@progress/kendo-react-inputs"),require("@progress/kendo-react-animation"),require("@progress/kendo-react-notification"),require("@progress/kendo-react-popup")):"function"==typeof define&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-buttons","@progress/kendo-svg-icons","@progress/kendo-react-intl","@progress/kendo-react-layout","prop-types","@progress/kendo-react-upload","@progress/kendo-react-inputs","@progress/kendo-react-animation","@progress/kendo-react-notification","@progress/kendo-react-popup"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactConversationalUi={},e.React,e.KendoReactCommon,e.KendoReactButtons,e.KendoSvgIcons,e.KendoReactIntl,e.KendoReactLayout,e.PropTypes,e.KendoReactUpload,e.KendoReactInputs,e.KendoReactAnimation,e.KendoReactNotification,e.KendoReactPopup)}(this,(function(e,t,a,n,l,o,s,r,i,c,u,m,d){"use strict";function p(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var g=p(t);const h="newMessage.sendButton",k="newMessage.messageInput",f="avatar.alt",v="messageList.ariaLabel",C="aIPrompt.noOutputs",y="aIPrompt.cancel",b="chat.senderDeletedMessage",E="chat.receiverDeletedMessage",I="chat.copyNotification",x="chat.downloadAllFiles",F="chat.closeReply",w="chat.collapseMessage",T="chat.expandMessage",N="chat.removeFile",A="chat.fileActions",S="chat.attachFile",M="chat.downloadAll",D={[h]:"Send","newMessage.optionsButton":"Options",[k]:"Message",[f]:"Avatar",[v]:"Message list",[y]:"Cancel",[C]:"No output from AI available",[b]:"You removed this message",[E]:"The message was removed by its sender",[I]:"Text copied to clipboard",[x]:"Download all files",[F]:"Close reply",[w]:"Collapse message",[T]:"Expand message",[N]:"Remove file",[A]:"File actions for",[S]:"Attach file",[M]:"Download all"},R=(e,t)=>e&&t.author&&e.id===t.author.id,P=(e,t)=>{const a=t.toLanguageString("chatSender.deletedMessage",D[b]),n=t.toLanguageString("chatReceiver.deletedMessage",D[E]);return e?a:n},B=(e,t)=>{const a=t?t.querySelector(`[data-message-id="${e}"]`):document.querySelector(`[data-message-id="${e}"]`);if(!a)return;const n=null==t?void 0:t.querySelector(".k-message-list");if(n){const e=n.getBoundingClientRect().top,t=a.getBoundingClientRect().top,l=n.scrollTop+(t-e);n.scrollTo({top:l,behavior:"smooth"})}else a.scrollIntoView({behavior:"smooth",block:"start"})},L=/(https?:\/\/[^\s]+)/g,K=e=>{if(!e)return[""];const a=e.split(L),n=[];return a.forEach((e=>{e&&L.test(e)?(L.lastIndex=0,n.push(t.createElement("a",{key:e,href:e,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"}},e))):e&&n.push(e)})),n},V=g.createContext(void 0),O=()=>{const e=t.useContext(V);if(void 0===e)throw new Error("useChatContext must be used within a ChatContext.Provider");return e},q=e=>{const{files:t,onFileRemove:s,onFileAction:r,onDownload:i,fileActions:c,renderInTextarea:u=!1}=e,m=o.useLocalization(),d=c||[{id:"download",label:"Download",svgIcon:l.downloadIcon}],p=e=>"."+e.split(".").pop()||"",h=e=>u?g.createElement(n.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:t=>{t.stopPropagation(),null==s||s(e.name)},"aria-label":`${m.toLanguageString(N,D[N])} ${e.name}`}):"uid"in e||!("rawFile"in e)?d.length>0&&g.createElement(n.DropDownButton,{fillMode:"flat",themeColor:"base",svgIcon:l.moreVerticalIcon,onClick:e=>{e.syntheticEvent.stopPropagation()},onItemClick:t=>((e,t)=>{"download"===e.item.id&&(null==i||i([t])),null==r||r(e.item,e,t)})(t,e),items:d.map((e=>({id:e.id,icon:e.icon,text:e.label,svgIcon:e.svgIcon}))),"aria-label":`${m.toLanguageString(A,D[A])} ${e.name}`}):g.createElement(n.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:t=>{t.stopPropagation(),null==s||s(e.name)},"aria-label":`${m.toLanguageString(N,D[N])} ${e.name}`});return g.createElement("ul",{className:"k-chat-file-wrapper"},t.map((e=>g.createElement("li",{key:e.name,className:"k-chat-file"},g.createElement(a.IconWrap,{size:"xxlarge",...a.getFileExtensionIcon(p(e.name))}),g.createElement("div",{className:"k-chat-file-info"},g.createElement("span",{className:"k-chat-file-name"},e.name),g.createElement("span",{className:"k-chat-file-size"},(e=>{if(null==e)return"";if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,t)).toFixed(2))} ${["B","KB","MB","GB","TB"][t]}`})(e.size))),h(e)))))},z=g.forwardRef(((e,t)=>{const{item:r,template:i,onRequestSelection:c,tabIndex:u=-1,dateFormat:m="g",selected:d,allowMessageCollapse:p,messageToolbarActions:h,messageContextMenuActions:k,isSender:f}=e,{setReplyToMessage:v,messages:C,user:y,internalScrollContainerRef:b,onToolbarAction:E,onContextMenuAction:I,onFileAction:F,onDownload:N,fileActions:A,setShowCopyNotification:S,statusTemplate:L}=O(),[V,z]=g.useState(!1),[U,j]=g.useState(!1),[$,W]=g.useState(!0),[H,G]=g.useState(!1),_=o.useLocalization(),Y=g.useRef({left:0,top:0}),X=g.useCallback((()=>{null!=r&&r.text&&(e=>{navigator.clipboard.writeText(e)})(r.text),S&&(S(!0),setTimeout((()=>{S(!1)}),3e3))}),[r,S]),J=g.useCallback((e=>{e.stopPropagation(),W((e=>!e))}),[]),Q=g.useCallback((()=>{G(!1)}),[]),Z=g.useCallback((e=>{("Tab"===e.key||"Enter"===e.key||" "===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key)&&G(!0)}),[]),ee=g.useRef(null);g.useEffect((()=>{d&&ee.current&&ee.current.focus()}),[d]);const te=g.useCallback((e=>{Y.current={left:e.pageX,top:e.pageY},e.preventDefault(),j(!0),z(!0)}),[]),ae=g.useCallback((()=>{j(!1),z(!1)}),[]),ne=g.useCallback(((e,t)=>!e.isDeleted&&e.text?e.text:P(t,_)),[_]),le=g.useCallback((e=>{var t;null!=(t=e.item)&&t.text&&("copy"!==e.item.data.id||r.isDeleted?"reply"===e.item.data.id&&v(r):X(),I&&I(e.item.data,e,r)),z(!1)}),[r,I,v,X]),oe=g.useCallback((()=>{if(r.replyToId){const e=((e,t)=>e.find((e=>e.id===t)))(C,r.replyToId);if(e){const t=t=>{t.preventDefault(),t.stopPropagation();const a=null==b?void 0:b.current;B(e.id,a)};return g.createElement("div",{className:a.classNames("k-message-reference",R(y,e)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:t},g.createElement("div",{className:"k-message-reference-content"},K(ne(e,R(y,e)))))}}return null}),[r.replyToId,C,y,ne,b]),se=g.useCallback((()=>{const e=[{id:"reply",label:"Reply",svgIcon:l.undoIcon},{id:"copy",label:"Copy",svgIcon:l.copyIcon}],t=k?[...e.map((e=>k.find((t=>t.id===e.id))||e)),...k.filter((t=>!e.some((e=>e.id===t.id))))]:e;return g.createElement(s.ContextMenu,{onSelect:le,onClose:ae,vertical:!0,show:V,offset:Y.current},t.map((e=>"delete"!==e.id||f?g.createElement(s.MenuItem,{key:e.id,text:e.label,icon:e.icon,svgIcon:e.svgIcon,data:e}):null)))}),[k,le,ae,V,f]),re=g.useCallback((()=>r.files&&r.files.length>1?g.createElement("div",{className:"k-chat-download-button-wrapper"},g.createElement(n.Button,{className:"k-chat-download-button",fillMode:"flat",themeColor:"base",svgIcon:l.downloadIcon,onClick:e=>{e.stopPropagation(),N&&N(r.files,r)},"aria-label":_.toLanguageString(x,D[x])},g.createElement("span",{className:"k-button-text"},_.toLanguageString(M,D[M])))):null),[r,N,_]),ie=g.useCallback((()=>{if(r.typing)return g.createElement("div",{className:"k-chat-bubble"},g.createElement("div",{className:"k-typing-indicator"},g.createElement("span",null),g.createElement("span",null),g.createElement("span",null)));if(i){const e=i;return g.createElement(e,{item:r})}return r.text||r.files&&r.files.length>0?g.createElement(g.Fragment,null,g.createElement("div",{className:a.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":p,"k-expanded":p&&$,"k-selected":d,"k-active":U}),onClick:()=>c(d?void 0:r.selectionIndex),onContextMenu:te},g.createElement("div",{className:"k-bubble-content"},g.createElement("span",{className:"k-chat-bubble-text"},!r.isDeleted&&oe(),K(ne(r,R(y,r)))),r.files&&g.createElement(q,{files:r.files,message:r,onFileAction:F,onDownload:e=>null==N?void 0:N(e,r),renderInTextarea:!1,fileActions:A}),re()),p&&g.createElement("span",{className:"k-bubble-expandable-indicator",onClick:J,role:"button","aria-label":$?_.toLanguageString(w,D[w]):_.toLanguageString(T,D[T]),tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),J(e))}},g.createElement(a.IconWrap,{icon:$?l.chevronUpIcon:l.chevronDownIcon,size:"medium"}))),se()):null}),[r,i,p,$,d,te,oe,ne,y,F,A,re,J,_,se,N]),ce=g.useCallback((()=>{let t=null;return r.timestamp&&(t=g.createElement("time",{className:"k-message-time","aria-hidden":!d},o.provideIntlService({props:e}).formatDate(r.timestamp,m))),t}),[r.timestamp,d,m,e]),ue=g.useCallback((()=>{let e=null;return r.status&&d&&(e=L?g.createElement(L,{item:r}):g.createElement("span",{className:"k-message-status"},g.createElement(a.IconWrap,{icon:l.checkCircleIcon,size:"xsmall"}),r.status)),e}),[r,d,L]),me=g.useCallback((()=>a.classNames({"k-focus":d,"k-message-removed":r.isDeleted},"k-message")),[d,r.isDeleted]),de=g.useCallback((()=>h&&h.length>0&&g.createElement("div",{className:"k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat"},h.map((e=>"delete"!==e.id||f?g.createElement(n.Button,{key:e.id,fillMode:"flat",className:"k-toolbar-button",themeColor:"base",icon:e.icon,svgIcon:e.svgIcon,onClick:t=>{t.stopPropagation(),"copy"!==e.id||r.isDeleted?"reply"===e.id&&v(r):X(),E&&E(e,t,r)},onMouseDown:e=>e.preventDefault()}):null)))),[X,f,r,h,E,v]);return g.createElement("div",{"data-message-id":r.id,className:me(),tabIndex:u,onMouseDown:Q,onKeyDown:Z,onFocus:e=>{H&&c(r.selectionIndex)},ref:e=>{ee.current=e,"function"==typeof t?t(e):t&&(t.current=e)}},ce(),ie(),ue(),de())}));z.displayName="ChatMessage";class U extends g.Component{render(){return g.createElement(z,{...this.props})}}o.registerForIntl(U);const j=e=>e[e.length-1],$=e=>(t,a,n)=>{const l=n===e-1;return((e,t)=>{const a=t.timestamp,n=j(e);if(a&&(!n||((e,t)=>e&&t&&(t.getDate()!==e.getDate()||t.getMonth()!==e.getMonth()||t.getFullYear()!==e.getFullYear()))(a,n.timestamp))){const t={type:"date-marker",timestamp:a,trackBy:a.getTime()};e.push(t)}})(t,a),((e,t,a)=>{const n=j(e);let l;t.typing&&!a||(n&&"message-group"===n.type&&(l=n.messages),l&&R(t.author,j(l))?l.push(t):e.push({type:"message-group",messages:[t],author:t.author,timestamp:t.timestamp,trackBy:t}))})(t,a,l),a.attachments&&a.attachments.length>1&&t.push({type:"attachment-group",attachments:a.attachments,attachmentLayout:a.attachmentLayout,timestamp:a.timestamp,trackBy:a}),a.suggestedActions&&l&&t.push({type:"action-group",actions:a.suggestedActions,timestamp:a.timestamp,trackBy:a}),t};const W=e=>{const t=e.slice().reduce($(e.length),[]);return function(e){let t=0;e.forEach((e=>{"message-group"===e.type?e.messages.forEach((e=>{e.selectionIndex=t++})):("attachment-group"===e.type||"action-group"===e.type)&&(e.selectionIndex=t++)})),e.lastSelectionIndex=t-1}(t),t},H=e=>{const{item:t,onActionExecute:n,selected:l}=e,o=g.useRef(null);g.useEffect((()=>{l&&o.current&&o.current.focus()}),[l]);const s=g.useCallback((e=>{(e.keyCode===a.Keys.enter||" "===e.key)&&(e.preventDefault(),n(t,e))}),[n,t]),r=g.useCallback((()=>a.classNames("k-suggestion k-suggestion-primary",{"k-selected":l},{"k-focus":l})),[l]);return g.createElement("span",{role:"button",className:r(),onClick:e=>n(t,e),ref:o,onKeyDown:s,tabIndex:0,"aria-label":t.title||t.value},t.title||t.value)},G=e=>{var t;const{group:n,onActionExecute:l,selected:o,onRequestSelection:s}=e,[r,i]=g.useState(null);g.useEffect((()=>{o||null===r?o&&null===r&&i(0):i(null)}),[o,r]);const c=g.useCallback((()=>n.actions?n.actions.length-1:-1),[n.actions]),u=g.useCallback(((e,t=0)=>{let a=null;return e?null===r?a=t:r<c()&&(a=r+1):null===r?a=0:r>0&&(a=r-1),null!==a&&i(a),a}),[r,c]),m=g.useCallback((()=>{s(n.selectionIndex)}),[s,n.selectionIndex]),d=g.useCallback((e=>{let t=null;const n=a.Keys.left,l=a.Keys.right;e.keyCode===n?t=u(!1):e.keyCode===l&&(t=u(!0)),null!==t&&(e.preventDefault(),e.stopPropagation())}),[u]),p=g.useCallback((()=>a.classNames("k-suggestion-group")),[]);return g.createElement("div",{className:p(),onClick:m,onKeyDown:d,role:"toolbar",tabIndex:0,"aria-label":"Action group"},null==(t=n.actions)?void 0:t.map(((e,t)=>g.createElement(H,{item:e,onActionExecute:l,selected:t===r,key:e.value}))))},_=e=>{const{item:t,template:n,tabbable:l,onClick:o,selected:s}=e,r=g.useRef(null);g.useEffect((()=>{s&&r.current&&r.current.focus()}),[s]);const i=g.useCallback((()=>{if(void 0!==l)return l?0:-1}),[l]),c=g.useCallback((()=>a.classNames({"k-selected":s},{"k-focus":s})),[s]),u=g.useCallback((()=>t.title?g.createElement("h5",{className:"k-card-title"},t.title):null),[t.title]),m=g.useCallback((()=>t.subtitle?g.createElement("h6",{className:"k-card-subtitle"},t.subtitle):null),[t.subtitle]),d=g.useCallback((()=>0===t.contentType.indexOf("image/")?g.createElement("img",{src:t.content,alt:t.title||"Attachment"}):t.content),[t.contentType,t.content,t.title]),p=n;return g.createElement("div",{className:c(),tabIndex:i(),onClick:o,ref:r},n?g.createElement(p,{item:t}):g.createElement("div",{className:"k-card"},g.createElement("div",{className:"k-card-body"},u(),m(),d())))},Y=e=>{const{group:t,itemTemplate:o,selected:s,isLastGroup:r,onRequestSelection:i}=e,[c,u]=g.useState(null);g.useEffect((()=>{s||null===c?s&&null===c&&u(0):u(null)}),[s,c]);const m=g.useCallback((e=>"list"!==e.attachmentLayout),[]),d=g.useCallback((()=>t.attachments?t.attachments.length-1:-1),[t.attachments]),p=g.useCallback((()=>t.attachments.length-1),[t.attachments]),h=g.useCallback(((e,t=0)=>{let a=null;return e?null===c?a=t:c<d()&&(a=c+1):null===c?a=0:c>0&&(a=c-1),null!==a&&u(a),a}),[c,d]),k=g.useCallback((()=>{i(t.selectionIndex)}),[i,t.selectionIndex]),f=g.useCallback((e=>{let n,l,o=null;m(t)?(n=a.Keys.left,l=a.Keys.right):(n=a.Keys.up,l=a.Keys.down),e.keyCode===n?o=h(!1):e.keyCode===l&&(o=h(!0)),null!==o&&(e.preventDefault(),e.stopPropagation())}),[h,m,t]),v=g.useCallback((e=>{k(),u(e)}),[k]),C=g.useCallback((e=>{k(),h(e,1)}),[k,h]),y=g.useCallback((()=>{let e=null;return m(t)&&c&&(e=g.createElement(n.Button,{icon:"chevron-left",onClick:()=>C(!1),svgIcon:l.chevronLeftIcon})),e}),[m,t,c,C]),b=g.useCallback((()=>{let e=null;return m(t)&&c!==p()&&(e=g.createElement(n.Button,{icon:"chevron-right",onClick:()=>C(!0),svgIcon:l.chevronRightIcon})),e}),[m,t,c,p,C]),E=g.useCallback((()=>a.classNames({"k-card-list":t.attachmentLayout,"k-card-deck":m(t)})),[t.attachmentLayout,t,m]),I=m(t),x=g.createElement("div",{className:E(),onKeyDown:I?void 0:f},t.attachments.map(((e,t)=>g.createElement(_,{item:e,template:o,selected:t===c,tabbable:r&&t===c,onClick:()=>v(t),key:e.content}))));return I?g.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:f},y(),x,b()):x},X=({item:e,timestampTemplate:t})=>{const a=t;return g.createElement("div",{className:"k-timestamp"},a?g.createElement(a,{item:e}):o.provideIntlService({props:{item:e}}).formatDate(e.timestamp,"D"))};let J=class extends g.Component{render(){return g.createElement(X,{...this.props})}};o.registerForIntl(J);const Q=e=>{const{group:t,user:n,itemTemplate:l,attachmentTemplate:r,onRequestSelection:i,selectedItemIndex:c,isLastGroup:u,message:m,allowMessageCollapse:d,messageToolbarActions:p,messageContextMenuActions:h,messageWidthMode:k="standard"}=e,v=o.useLocalization(),C=t.messages.length>0&&R(n,t.messages[0]),y=!C,b=g.useMemo((()=>a.classNames("k-message-group",{"k-message-group-sender k-no-avatar":C,"k-message-group-receiver":y,"k-message-group-full-width":"full"===k})),[C,y,k]),E=g.useMemo((()=>{const e=t.messages.length-1;return t.messages.map(((t,a)=>{const o=[g.createElement(m,{item:t,template:l,selected:t.selectionIndex===c,onRequestSelection:i,tabIndex:a===e&&u?0:-1,key:t.id,allowMessageCollapse:d,messageToolbarActions:p,messageContextMenuActions:h,isSender:R(n,t)})];return t.attachments&&1===t.attachments.length&&o.push(g.createElement(_,{item:t.attachments[0],template:r,selected:!1,key:`att-${t.attachments[0].content}`})),o}))}),[t.messages,m,l,c,i,u,d,p,h,n,r]),{avatarUrl:I,avatarAltText:x,name:F}=t.author,w=void 0!==x?x:v.toLanguageString(f,D[f]);return g.createElement("div",{className:b},(()=>{if(y&&I)return g.createElement(s.Avatar,{type:"image"},g.createElement("img",{src:I,alt:w}))})(),g.createElement("div",{className:"k-message-group-content"},g.createElement("span",{className:"k-message-author"},F),E))},Z=e=>{const{suggestions:t,onSuggestionClick:n,suggestionsView:l,suggestionTemplate:o}=e,s=g.useCallback(((e,t)=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),null==n||n(t))}),[n]),r=g.useCallback((()=>t.map((e=>o?g.createElement(o,{key:e.id,suggestion:e,onClick:()=>{null==n||n(e)}}):g.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:()=>!e.disabled&&(null==n?void 0:n(e)),onKeyDown:t=>!e.disabled&&s(t,e),key:e.id,title:e.description,className:a.classNames("classic"===l?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},e.text)))),[t,o,n,l,s]);return t&&0!==t.length?"classic"===l?r():g.createElement("div",{role:"group",className:"k-suggestion-group"},r()):null},ee=g.forwardRef(((e,t)=>{const{onSendMessage:s,isDirectionRightToLeft:r,placeholder:u,MessageBox:m,suggestions:d,onSuggestionClick:p,inputValue:f,onInputValueChange:v,suggestionTemplate:C,sendButtonConfig:y}=e,{replyToMessage:b,setReplyToMessage:E,user:I,messageListScrollContainerRef:x,speechToTextConfig:w,uploadConfig:T}=O(),[N]=g.useState(!1),[A,M]=g.useState(void 0),[B,L]=g.useState([]),[K,V]=g.useState(!1),z=g.useRef(null),U=g.useRef(null),j=o.useLocalization(),$=g.useCallback((()=>{null!==z.current&&z.current.focus()}),[]);g.useEffect((()=>{void 0!==f&&f!==A&&(M(f),$())}),[f,A,$]),g.useEffect((()=>{b&&$()}),[b,$]),g.useLayoutEffect((()=>{K&&null!=x&&x.current&&(x.current.scrollTop=x.current.scrollHeight-x.current.clientHeight,V(!1))}),[K,x]);const W=g.useCallback((e=>{const t=e.value;M(t),v&&v(t)}),[v]),H=g.useMemo((()=>!!(null!=A&&A.trim()||B.length>0)),[A,B.length]),G=g.useCallback((e=>{if(e.preventDefault(),s){if(H){const t={id:"",author:I,text:A||"",timestamp:new Date,replyToId:b?b.id:void 0,files:B.map((e=>({name:e.name,size:e.size,type:e.extension,rawFile:e.getRawFile?e.getRawFile():e})))};E(null),s(t,e),L([]),M(""),v&&v(""),V(!0)}}}),[s,A,I,b,B,E,v,H]),_=g.useCallback((e=>{if("Enter"!==e.key||!e.shiftKey)switch(e.key){case"Enter":return e.preventDefault(),G(e);case"Escape":z.current&&z.current.blur();break;default:return}}),[G]);g.useImperativeHandle(t,(()=>({focusInput:$})),[$]);const Y=g.useCallback((e=>{L((t=>t.filter((t=>t.name!==e))))}),[]),X=g.useCallback((()=>g.createElement(q,{files:B,onFileRemove:Y,renderInTextarea:!0})),[B,Y]),J=g.useCallback(((e,t)=>e.isDeleted?P(t,j):e.text),[j]),Q=g.useCallback((()=>{if(b){const e=R(I,b);return g.createElement("div",{className:a.classNames("k-message-reference",e?"k-message-reference-sender":"k-message-reference-receiver")},g.createElement("div",{className:"k-message-reference-content"},J(b,e)),g.createElement("span",{className:"k-spacer"}),g.createElement(n.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:()=>E(null),"aria-label":j.toLanguageString(F,D[F])}))}return null}),[b,I,J,E,j]),ee=g.useCallback((e=>{try{const t=Array.from(e.newState);L((e=>[...e,...t])),$()}catch{}}),[$]),te=g.useCallback((()=>{U.current&&U.current.actionElement.click()}),[]),ae=g.useCallback((e=>{}),[]),ne=g.useCallback((e=>{const{isFinal:t,alternatives:a}=e;if(a.length>0){const e=a[0];t&&M((t=>(t?`${t} `:"")+e.transcript))}}),[]),le=g.useCallback((()=>g.createElement(g.Fragment,null,B.length>0&&X(),b&&g.createElement("span",{className:"k-input-prefix k-input-prefix-horizontal"},Q()))),[B.length,b,X,Q]),oe=g.useCallback((e=>{e.preventDefault()}),[]),se=g.useCallback((e=>{"Escape"===e.key&&e.currentTarget.blur()}),[]),re=g.useMemo((()=>g.createElement(n.Button,{rounded:"full",fillMode:"solid",themeColor:"primary",className:"k-chat-send",icon:"paper-plane",svgIcon:l.paperPlaneIcon,onClick:G,onMouseDown:oe,onKeyDown:se,"aria-label":j.toLanguageString(h,D[h]),dir:r?"rtl":void 0,disabled:!H,"aria-disabled":!H,...y})),[G,oe,se,j,r,H,y]),ie=g.useCallback((()=>{const e="object"==typeof w?w:void 0,t="object"==typeof T?T:{},{className:o,...s}=t,r=a.classNames("k-hidden",o);return g.createElement(c.InputSuffix,null,!1!==w&&g.createElement(n.SpeechToTextButton,{fillMode:"clear",themeColor:"base",onError:ae,onResult:ne,...e}),g.createElement(n.Button,{key:"attach-file",fillMode:"clear",themeColor:"base",svgIcon:l.paperclipIcon,onClick:te,"aria-label":j.toLanguageString(S,D[S])}),g.createElement(i.Upload,{ref:U,files:B,onAdd:ee,multiple:!0,autoUpload:!1,...s,className:r}),g.createElement("span",{className:"k-spacer"}),re)}),[w,T,B,ae,ne,te,ee,j,re]),ce=g.useMemo((()=>g.createElement(c.TextArea,{className:a.classNames("k-message-box","!k-flex-col",{"k-focus":N}),resizable:"none",rows:1,placeholder:u,value:A,onChange:W,onKeyDown:_,prefix:le,suffix:ie,ref:z,"aria-label":j.toLanguageString(k,D[k])})),[N,u,A,W,_,le,ie,j]);return g.createElement("div",{className:"k-message-box-wrapper"},d&&d.length>0&&g.createElement(Z,{onSuggestionClick:p,suggestions:d,suggestionTemplate:C}),m?g.createElement(m,{messageInput:ce,sendButton:re}):ce)}));ee.displayName="NewMessage";const te=e=>g.createElement(s.AppBar,{className:"k-chat-header",positionMode:"sticky",themeColor:"light"},e.children),ae=e=>{const{message:t,onUnpin:s,user:r}=e,i=o.useLocalization(),{internalScrollContainerRef:c}=O(),u=g.useCallback((e=>{e.preventDefault(),e.stopPropagation();const a=null==c?void 0:c.current;B(t.id,a)}),[t.id,c]);return g.createElement("div",{className:"k-message-reference k-message-reference-receiver k-message-pinned",onClick:u},g.createElement(a.IconWrap,{size:"xlarge",icon:l.pinIcon}),g.createElement("div",{className:"k-message-reference-content"},null!=t&&t.isDeleted?r&&P(R(r,t),i):null==t?void 0:t.text),g.createElement("span",{className:"k-spacer"}),g.createElement(n.Button,{svgIcon:l.xIcon,onClick:e=>{e.stopPropagation(),null==s||s(t)}}))},ne=e=>{const{show:t,text:a}=e;return g.createElement("div",{style:{position:"absolute",top:"90%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,pointerEvents:t?"auto":"none"}},g.createElement(u.Fade,null,t&&g.createElement(m.Notification,{type:{style:"dark"},closable:!1},g.createElement("span",null,a))))},le=Object.freeze({name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"12.0.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"}),oe={textField:"text",statusField:"status",authorIdField:"authorId",authorNameField:"authorName",authorImageUrlField:"authorImageUrl",authorImageAltTextField:"authorImageAltText",idField:"id",timestampField:"timestamp",filesField:"files",attachmentsField:"attachments",replyToIdField:"replyToId",isDeletedField:"isDeleted",isPinnedField:"isPinned",typingField:"typing",suggestedActionsField:"suggestedActions"},se=(e,t={})=>{const a={...oe,...t};let n;n=e.author&&"object"==typeof e.author?{id:e.author.id||e.author[a.authorIdField]||"",name:e.author.name||e.author[a.authorNameField],avatarUrl:e.author.avatarUrl||e.author[a.authorImageUrlField],avatarAltText:e.author.avatarAltText||e.author[a.authorImageAltTextField]}:{id:e[a.authorIdField]||"",name:e[a.authorNameField],avatarUrl:e[a.authorImageUrlField],avatarAltText:e[a.authorImageAltTextField]};const l={id:e[a.idField],text:e[a.textField]||"",author:n,timestamp:e[a.timestampField]?new Date(e[a.timestampField]):new Date,status:e[a.statusField],attachments:e[a.attachmentsField],attachmentLayout:e.attachmentLayout||"list",suggestedActions:e[a.suggestedActionsField],isPinned:e[a.isPinnedField]||!1,typing:e[a.typingField],files:e[a.filesField]||[]};return e.pinnedAt&&(l.pinnedAt=new Date(e.pinnedAt)),e.pinnedBy&&(l.pinnedBy=e.pinnedBy),e[a.replyToIdField]&&(l.replyToId=e[a.replyToIdField]),e[a.isDeletedField]&&(l.isDeleted=e[a.isDeletedField]),l},re=(e,t={})=>Array.isArray(e)?e.map((e=>se(e,t))):[],ie=e=>e&&void 0!==e.id&&"string"==typeof e.text&&e.author&&"object"==typeof e.author&&void 0!==e.author.id&&(e.timestamp instanceof Date||"string"==typeof e.timestamp||"number"==typeof e.timestamp),ce=g.forwardRef(((e,t)=>{const{messages:n=[],messageTemplate:l,attachmentTemplate:s,width:r,height:i,onSendMessage:c,onSuggestionClick:u,onInputValueChange:m,onActionExecute:d,dir:p,messageBox:h,placeholder:k,className:f,message:C=z,authorId:y,suggestions:b,suggestionTemplate:E,inputValue:x,headerTemplate:F,timestampTemplate:w,statusTemplate:T,allowMessageCollapse:N,messageToolbarActions:A,messageContextMenuActions:S,fileActions:M,onUnpin:R,messageWidthMode:P,onToolbarAction:B,onContextMenuAction:L,onFileAction:K,onDownload:O,speechToTextConfig:q,uploadConfig:U,sendButtonConfig:j,textField:$,statusField:H,authorIdField:_,authorNameField:J,authorImageUrlField:Z,authorImageAltTextField:oe,idField:se,timestampField:ce,filesField:ue,attachmentsField:me,replyToIdField:de,isDeletedField:pe,isPinnedField:ge,typingField:he,suggestedActionsField:ke,...fe}=e,[ve,Ce]=g.useState(null),[ye,be]=g.useState(!1),[Ee,Ie]=g.useState(!1),[xe,Fe]=g.useState(null),[we,Te]=g.useState(null),Ne=g.useRef(null),Ae=g.useRef(null),Se=g.useRef(null),Me=g.useRef(null),De=g.useRef(void 0),Re=g.useRef(void 0),Pe=g.useRef(null),Be=g.useRef(""),Le=g.useMemo((()=>n&&0!==n.length?ie(n[0])?n.map((e=>({...e,timestamp:e.timestamp?new Date(e.timestamp):e.timestamp}))):re(n,{textField:$,statusField:H,authorIdField:_,authorNameField:J,authorImageUrlField:Z,authorImageAltTextField:oe,idField:se,timestampField:ce,filesField:ue,attachmentsField:me,replyToIdField:de,isDeletedField:pe,isPinnedField:ge,typingField:he,suggestedActionsField:ke}):[]),[n,$,H,_,J,Z,oe,se,ce,ue,me,de,pe,ge,he,ke]);g.useEffect((()=>{if(y===Be.current&&Pe.current)Te(Pe.current);else if(y&&Le.length>0){const e=Le.find((e=>e.author&&(e.author.id===y||e.author.id===String(y)))),t=(null==e?void 0:e.author)||{id:y};Pe.current=t,Be.current=y,Te(t)}}),[y,Le]);const Ke=g.useMemo((()=>Le.length>0?W(Le):[]),[Le]),Ve=g.useMemo((()=>!a.validatePackage(le,{component:"Chat"})),[]),Oe=g.useMemo((()=>Le.find((e=>e.isPinned))),[Le]),qe=o.useLocalization(),ze=g.useCallback((()=>{clearTimeout(De.current)}),[]),Ue=g.useCallback((()=>{De.current=window.setTimeout((()=>{Ce(null)}),0)}),[]),je=g.useCallback((e=>{Ce(e)}),[]),$e=g.useCallback((e=>{let t=null;const n=null!==ve?ve:Ke.lastSelectionIndex;e.keyCode===a.Keys.up?null===n?t=0:n>0&&(t=n-1):e.keyCode===a.Keys.down?null===n?t=0:n<Ke.lastSelectionIndex&&(t=n+1):e.keyCode===a.Keys.home?t=0:e.keyCode===a.Keys.end&&(t=Ke.lastSelectionIndex),null!==t&&(Ce(t),e.preventDefault())}),[ve,Ke]),We=g.useCallback((()=>{Se.current&&(Se.current.scrollTop=Se.current.scrollHeight-Se.current.clientHeight)}),[]),He=g.useCallback((()=>{if(!Se.current)return!0;const{scrollTop:e,scrollHeight:t,clientHeight:a}=Se.current;return t-e-a<50}),[]),Ge=g.useCallback((()=>{He()&&requestAnimationFrame((()=>{We()}))}),[He,We]),_e=g.useCallback((()=>{requestAnimationFrame((()=>{We()}))}),[We]),Ye=g.useCallback(((e,t,a)=>{var n;if(d&&d({action:{value:e.value,title:e.title,type:e.type},syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget}),!t.isDefaultPrevented()){switch(e.type){case"reply":c&&c({message:{id:"",author:we,text:e.value,timestamp:new Date},syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget});break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value)}null==(n=Me.current)||n.focusInput()}}),[d,c,we]),Xe=g.useCallback((()=>a.classNames("k-chat",f,{"k-rtl":ye})),[f,ye]),Je=g.useCallback((()=>{const e=Ke.length-1;return Ke.map(((t,a)=>"date-marker"===t.type?g.createElement(X,{item:t,key:t.trackBy,timestampTemplate:w}):"message-group"===t.type?g.createElement(Q,{group:t,itemTemplate:l,attachmentTemplate:s,user:we,selectedItemIndex:ve,onRequestSelection:je,isLastGroup:a===e,key:t.messages[0].selectionIndex,message:C,allowMessageCollapse:N,messageToolbarActions:A,messageContextMenuActions:S,messageWidthMode:P}):"attachment-group"===t.type?g.createElement(Y,{group:t,itemTemplate:s,onRequestSelection:je,selected:t.selectionIndex===ve,isLastGroup:a===e,key:t.selectionIndex}):"action-group"===t.type?g.createElement(G,{group:t,onActionExecute:Ye,onRequestSelection:je,selected:t.selectionIndex===ve,key:t.selectionIndex}):null))}),[Ke,w,l,s,we,ve,je,C,N,A,S,P,Ye]),Qe=g.useCallback((()=>F?"function"==typeof F?F():F:null),[F]);g.useEffect((()=>{const e=void 0!==p?"rtl"===p:Ne.current&&"rtl"===getComputedStyle(Ne.current).direction;be(!!e)}),[p]),g.useEffect((()=>(Re.current=window.setTimeout((()=>We()),250),()=>{clearTimeout(Re.current)})),[We]),g.useEffect((()=>()=>{clearTimeout(De.current),clearTimeout(Re.current)}),[]),g.useEffect((()=>{_e()}),[Le.length,_e]),g.useEffect((()=>{const e=window.setTimeout((()=>{Ge()}),50);return()=>{clearTimeout(e)}}),[Le,Ge]),g.useEffect((()=>{if(b&&b.length>0){const e=window.setTimeout((()=>{Ge()}),100);return()=>{clearTimeout(e)}}}),[b,Ge]);const Ze=g.useMemo((()=>({replyToMessage:xe,setReplyToMessage:Fe,messages:Le,user:we,internalScrollContainerRef:Ae,messageListScrollContainerRef:Se,onToolbarAction:B,onContextMenuAction:L,onFileAction:K,setShowCopyNotification:Ie,onDownload:O,fileActions:M,speechToTextConfig:q,uploadConfig:U,statusTemplate:T})),[xe,Fe,Le,we,B,L,K,Ie,O,M,q,U,T]);return g.createElement(V.Provider,{value:Ze},g.createElement("div",{style:{width:r,height:i,position:"relative",overflow:"hidden"},onKeyDown:$e,className:Xe(),ref:e=>{Ne.current=e,Ae.current=e,"function"==typeof t?t(e):t&&(t.current=e)},...fe},void 0!==F&&g.createElement(te,null,Qe()),Oe&&g.createElement(ae,{message:Oe,onUnpin:R,user:we}),g.createElement("div",{className:"k-message-list k-avatars",onBlur:Ue,onFocus:ze,role:"log","aria-label":qe.toLanguageString(v,D[v]),"aria-live":"polite",ref:Se},g.createElement("div",{className:"k-message-list-content"},Je())),g.createElement(ee,{onSendMessage:(e,t)=>{c&&c({message:e,syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget})},onSuggestionClick:e=>{u&&u(e)},isDirectionRightToLeft:ye,ref:Me,placeholder:k,MessageBox:h,suggestions:b,suggestionTemplate:E,inputValue:x,onInputValueChange:e=>{m&&m(e)},sendButtonConfig:j}),Ve&&g.createElement(a.WatermarkOverlay,null),g.createElement(ne,{show:Ee,text:qe.toLanguageString(I,D[I])})))}));ce.displayName="Chat",ce.propTypes={messages:r.arrayOf(r.object),user:r.object,messageTemplate:r.any,attachmentTemplate:r.any,width:r.oneOfType([r.string,r.number]),onSendMessage:r.func,onActionExecute:r.func,dir:r.string,messageBox:r.any};const ue=e=>{const{activeView:a,toolbarItems:l,activeViewChange:o}=e;return t.createElement("div",{className:"k-prompt-header"},t.createElement(n.Toolbar,{keyboardNavigation:!1,role:"toolbar",className:"k-toolbar-flat"},l.map((e=>t.isValidElement(e)?e:t.createElement(n.Button,{key:e.name,className:a===e.name?"k-selected":"",size:"medium",themeColor:"primary",fillMode:"flat",rounded:"full",title:e.buttonText,svgIcon:e.buttonIcon,onClick:()=>(e=>{null==o||o.call(null,e)})(e.name)},e.buttonText)))))},me={name:"Output view",buttonText:"Output",buttonIcon:l.commentIcon},de={name:"Commands view",buttonIcon:l.moreHorizontalIcon},pe={name:"Prompt view",buttonText:"Ask AI",buttonIcon:l.sparklesIcon},ge=t.createContext([{},()=>{}]),he=()=>t.useContext(ge),ke=e=>{const{children:a}=e;return t.createElement("div",{className:"k-prompt-footer"},t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal k-prompt-actions"},a))},fe=t.forwardRef(((e,a)=>{const{children:s,streaming:r,onCancel:i}=e,c=o.useLocalization().toLanguageString(y,D[y]),[u]=he(),m=u.activeView===me.name,d=r&&m,p=t.useCallback((e=>{"Escape"===e.key&&d&&i&&(e.preventDefault(),i())}),[d,i]);return t.createElement("div",{className:"k-prompt-content",ref:a,onKeyDown:p},d&&t.createElement(n.FloatingActionButton,{onClick:i,svgIcon:l.stopSmIcon,icon:"stop-sm",size:"medium",positionMode:"absolute",className:"k-prompt-stop-fab k-generating","aria-label":c,title:c}),t.createElement("div",{className:"k-prompt-view"},s))}));fe.displayName="KendoReactAIPromptContent";const ve=e=>{const[t]=he();return t.activeView===e.name?e.children:null},Ce=e=>{const[a,o]=t.useState(!0),{children:s,title:r}=e;return t.createElement("div",{className:"k-prompt-expander"},t.createElement(n.Button,{"aria-controls":e.id,fillMode:"flat",svgIcon:a?l.chevronUpIcon:l.chevronDownIcon,title:r,onClick:()=>o(!a),"aria-expanded":a},r),a&&t.createElement("div",{id:e.id,className:"k-prompt-expander-content"},s))},ye=e=>null==e?void 0:e.map((e=>t.createElement(s.PanelBarItem,{title:e.text,key:e.id,svgIcon:e.svgIcon,data:e},e.children&&ye(e.children||[])))),be=({show:e=!1,anchor:a,onOpen:n,onClose:l,animate:o=!0,appendTo:s,popupOptions:r={},children:i,style:c})=>t.createElement(d.Popup,{show:e,anchor:a,style:c,animate:o,appendTo:s,onOpen:n,onClose:l,...r},i),Ee=({placeholder:e="Ask or generate content with AI...",promptValue:o,onMenuClick:s,promptInput:r=c.TextArea,generateButton:i,enableSpeechToText:u=!1,streaming:m=!1,commands:d,onPromptRequest:p,onPromptCancel:g})=>{const[h,k]=t.useState(o||""),[f,v]=a.useCustomComponent(i),[C,y]=a.useCustomComponent(r),b={svgIcon:m?l.stopSmIcon:l.paperPlaneIcon,active:(!!m).toString(),title:"Send Button","aria-label":"Send Button",disabled:!h.trim()&&!m,"aria-disabled":!h.trim()&&!m},E={placeholder:e,className:"!k-flex-row",autoSize:!0,rows:1},I=d&&d.length>0,x=Object.keys(v).length>0?v:b,F=Object.keys(y).length>0?y:E,w=e=>{const{isFinal:t,alternatives:a}=e;if(t&&a.length>0){const e=a[0].transcript,t=(()=>{const t=h,a=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(a?" ":"")+e})();k(t)}},T=()=>{h.trim()&&p&&p(h.trim())};return t.createElement(C,{value:h,onChange:e=>{const t=e.target.value;k(t)},onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),T())},prefix:I||u?t.createElement(t.Fragment,null,t.createElement(c.InputPrefix,{className:"!k-align-items-start"},I&&t.createElement(n.Button,{"aria-label":"Commands Button",title:"Commands Button",fillMode:"flat",svgIcon:l.menuIcon,onClick:s}),u&&t.createElement(n.SpeechToTextButton,{fillMode:"flat",..."object"==typeof u?{...u,onResult:u.onResult||w}:{onResult:w}})),t.createElement(c.InputSeparator,null)):void 0,suffix:t.createElement(c.InputSuffix,{className:"!k-align-items-start"},t.createElement(f,{className:a.classNames("k-prompt-send",{"k-generating":m,"k-active":m}),fillMode:"flat",onClick:m?g:T,...x})),...F})};e.AIPrompt=e=>{const n=!a.validatePackage(le,{component:"AIPrompt"}),l=a.getLicenseMessage(le),{activeView:o,toolbarItems:s,children:r,onActiveViewChange:i,onPromptRequest:c,onCommandExecute:u,style:m,dir:d,className:p,streaming:g,loading:h,onCancel:k,suggestionsView:f,...v}=e,C=s||[pe,me],[y,b]=t.useState({activeView:o}),E={...y,activeView:o,streaming:g,loading:h,suggestionsView:null!=f?f:"classic",onCancel:k,onActiveViewChange:i,onPromptRequest:c,onCommandExecute:u};return t.createElement(ge.Provider,{value:[E,e=>{b(e)}]},t.createElement("div",{className:a.classNames("k-prompt",p),style:m,dir:d,...v},t.createElement(ue,{activeView:E.activeView,toolbarItems:C,activeViewChange:i}),r,n&&t.createElement(a.WatermarkOverlay,{message:l})))},e.AIPromptCommandsView=e=>{const{commands:a}=e,[n]=he();return t.createElement(ve,{name:de.name},t.createElement(fe,{streaming:n.streaming,onCancel:n.onCancel},t.createElement("div",{className:"k-prompt-view"},t.createElement(s.PanelBar,{onSelect:e=>{var t,a,l;const o=null==(a=null==(t=e.target)?void 0:t.props)?void 0:a.data;null!=(l=o.children)&&l.length||n.onCommandExecute&&n.onCommandExecute.call(null,o)},selected:""},ye(null!=a?a:[])))))},e.AIPromptContent=fe,e.AIPromptFooter=ke,e.AIPromptOutputView=e=>{const[a,r]=t.useState(""),i=t.useRef(null),[c]=he(),{outputs:u,showOutputRating:m,outputCard:d}=e,{header:p,body:g,actions:h}=d||{},k=o.useLocalization(),f=(e,t)=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,ratingType:t,isRetry:!1}),v()},v=()=>{i&&i.current&&i.current.scrollTo({top:0,behavior:"smooth"})},y=t.createElement(s.Card,null,t.createElement(s.CardHeader,null,t.createElement(s.CardTitle,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"200px"}})),t.createElement(s.CardSubtitle,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),t.createElement(s.CardBody,null,t.createElement("span",{className:"k-skeleton k-skeleton-rect k-skeleton-pulse",style:{height:"80px"}})),t.createElement(s.CardActions,null,t.createElement("span",{className:"k-skeleton k-skeleton-text k-skeleton-pulse",style:{width:"100%"}}))),b=null==u?void 0:u.map(((e,o)=>t.createElement(s.Card,{key:`${e.id}_${o}`},t.createElement(s.CardHeader,null,p?p(e):t.createElement(t.Fragment,null,e.title&&t.createElement(s.CardTitle,null,e.title),e.subTitle&&t.createElement(s.CardSubtitle,null,e.subTitle))),t.createElement(s.CardBody,null,g?g(e):e.responseContent),t.createElement(s.CardActions,null,h?h(e):t.createElement(t.Fragment,null,t.createElement(n.Button,{size:"medium",themeColor:"primary",fillMode:"flat",rounded:"medium",title:"Copy",svgIcon:a===e.id?l.checkIcon:l.copyIcon,onClick:()=>(e=>{null!=e&&e.responseContent&&navigator.clipboard.writeText(e.responseContent),r(e.id),setTimeout((()=>{r("")}),1e3)})(e)},"Copy"),t.createElement(n.Button,{size:"medium",themeColor:"base",fillMode:"flat",rounded:"medium",title:"Retry",svgIcon:l.arrowRotateCwIcon,onClick:()=>(e=>{c.onPromptRequest&&c.onPromptRequest.call(null,e.prompt,{...e,isRetry:!0}),v()})(e)},"Retry"),m&&t.createElement(t.Fragment,null,t.createElement("span",{className:"k-spacer"}),t.createElement(n.Button,{size:"medium",themeColor:"positive"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate up",svgIcon:l.thumbUpOutlineIcon,onClick:()=>f(e,"positive")}),t.createElement(n.Button,{size:"medium",themeColor:"negative"===e.ratingType?"primary":"base",fillMode:"flat",rounded:"medium",title:"Rate down",svgIcon:l.thumbDownOutlineIcon,onClick:()=>f(e,"negative")}))))))),E=t.createElement(s.Card,null,t.createElement(s.CardBody,null,k.toLanguageString(C,D[C])));return t.createElement(ve,{name:me.name},t.createElement(fe,{ref:i,streaming:c.streaming,onCancel:c.onCancel},t.createElement("div",{className:"k-card-list"},c.loading&&y,b,(!b||0===b.length)&&!c.loading&&E)))},e.AIPromptView=e=>{const{promptInput:o=c.TextArea,generateButton:s=n.Button,enableSpeechToText:r=!1,promptValue:i,promptSuggestions:u}=e,[m,d]=t.useState(i||""),[p]=he(),[g,h]=a.useCustomComponent(s),[k,f]=a.useCustomComponent(o),v={title:"Generate",children:"Generate",svgIcon:l.sparklesIcon},C=Object.keys(h).length>0?h:v,y=Object.keys(f).length>0?f:{placeholder:"Ask or generate content with AI ...",rows:2},b=e=>{const{isFinal:t,alternatives:a}=e;if(t&&a.length>0){const e=a[0].transcript,t=(()=>{const t=m,a=t&&!t.endsWith(" ")&&!t.endsWith("\n");return t+(a?" ":"")+e})();d(t)}};let E;return r&&(E="object"==typeof r?{...r,onResult:r.onResult||b}:{onResult:b}),t.createElement(ve,{name:pe.name},t.createElement(fe,{streaming:p.streaming,onCancel:p.onCancel},t.createElement(k,{value:m,className:"!k-flex-col",suffix:r?t.createElement(t.Fragment,null,t.createElement(c.InputSeparator,{orientation:"horizontal"}),t.createElement(c.InputSuffix,{orientation:"horizontal"},t.createElement(n.SpeechToTextButton,{fillMode:"flat",...E}))):void 0,onChange:e=>{d(e.target.value)},...y}),u&&u.length>0&&t.createElement(Ce,{title:"Prompt Suggestions"},t.createElement(Z,{suggestionsView:p.suggestionsView,suggestions:u.map(((e,t)=>({id:t,text:e,description:e}))),onSuggestionClick:e=>{(e=>{d(e)})(e.text)}}))),t.createElement(ke,null,t.createElement(g,{themeColor:"primary",fillMode:"solid",rounded:"full",size:"medium",onClick:()=>{p.onPromptRequest&&p.onPromptRequest.call(null,m),d("")},disabled:!m.trim(),...C},C.children)))},e.AIPromptViewRender=ve,e.Chat=ce,e.ChatMessage=z,e.DEFAULT_FIELD_MAPPING=oe,e.HeroCard=e=>{const{imageUrl:t,imageMaxWidth:a,title:l,subtitle:o,actions:s,onActionExecute:r,altText:i}=e,c=g.useCallback(((e,t)=>{null==r||r({action:e,syntheticEvent:t,nativeEvent:t.nativeEvent,target:t.currentTarget})}),[r]),u=i||l||"";return g.createElement("div",{className:"k-card"},g.createElement("img",{className:"k-card-image",src:t,style:{maxWidth:a},alt:u}),g.createElement("div",{className:"k-card-body"},l&&g.createElement("h5",{className:"k-card-title"},l),o&&g.createElement("h6",{className:"k-card-subtitle"},o)),g.createElement("div",{className:"k-card-actions k-card-actions-vertical"},s.map(((e,t)=>g.createElement("span",{className:"k-card-action",key:`action-${t}-${e.title||e.value||t}`},g.createElement(n.Button,{fillMode:"flat",onClick:t=>c(e,t)},e.title))))))},e.InlineAIPrompt=e=>{const o=!a.validatePackage(le,{component:"InlineAIPrompt"}),r=a.getLicenseMessage(le),{outputs:i=[],outputCard:u,promptInput:m=c.TextArea,generateButton:d=n.Button,promptPlaceholder:p="Ask or generate content with AI...",promptValue:g,onPromptRequest:h,onCopy:k,onDiscard:f,outputActions:v,onOutputAction:C,enableSpeechToText:y=!1,streaming:b,onPromptCancel:E,show:I=!1,anchor:x,width:F,height:w,onOpen:T,onClose:N,animate:A=!0,appendTo:S,commands:M,onCommandExecute:D,style:R,className:P,popupOptions:B={},...L}=e,[K,V]=t.useState(""),[O,q]=t.useState(!1),[z,U]=t.useState({left:0,top:0}),j=t.useRef(null),{body:$,actions:W}=u||{},H=v||[{id:"copy",text:"Copy",svgIcon:l.copyIcon,themeColor:"primary",title:"Copy"},{id:"discard",text:"Discard",svgIcon:l.cancelOutlineIcon,themeColor:"base",title:"Discard"}],G=(e,t)=>{switch(e.id){case"copy":(e=>{e.responseContent&&(navigator.clipboard.writeText(e.responseContent),V(e.id),setTimeout((()=>V("")),1e3)),null==k||k(e)})(t);break;case"discard":(e=>{null==f||f(e)})(t);break;default:null==C||C(e,t)}},_=t.useCallback((e=>{"Escape"===e.key&&(b&&E?E():!b&&N&&N({target:null}))}),[b,E,N]),Y={...R,...F&&{width:F},...w&&{height:w}},X={...F&&{width:F},...w&&{height:w}},J=t.createElement(t.Fragment,null,t.createElement("div",{className:a.classNames("k-prompt",P),style:Y,onKeyDown:_,...L},t.createElement(fe,{ref:j},i&&i.length>0&&t.createElement("div",{className:"k-card-list"},i.map(((e,a)=>t.createElement(s.Card,{key:`${e.id}_${a}`},t.createElement(s.CardBody,null,$?$(e):e.responseContent),t.createElement(s.CardActions,null,W?W(e):t.createElement(t.Fragment,null,H.map((a=>{var o;return a.spacer?t.createElement("span",{key:a.id,className:"k-spacer"}):t.createElement(n.Button,{key:a.id,size:"medium",themeColor:a.themeColor||"primary",fillMode:"flat",rounded:"medium",title:null!=(o=a.title)?o:a.text,svgIcon:"copy"===a.id&&K===e.id?l.checkIcon:a.svgIcon,onClick:()=>G(a,e)},a.text)})))))))),t.createElement(Ee,{promptValue:g,placeholder:p,onPromptRequest:h,onMenuClick:e=>{if(!j.current)return;const t=j.current.getBoundingClientRect();U({left:t.left,top:t.bottom}),q(!0)},onPromptCancel:E,promptInput:m,generateButton:d,enableSpeechToText:y,streaming:b,commands:M}))),o&&t.createElement(a.WatermarkOverlay,{message:r}));return t.createElement(t.Fragment,null,t.createElement(be,{show:I,anchor:x,onOpen:T,onClose:N,animate:A,appendTo:S,popupOptions:B,style:X},J),t.createElement(s.ContextMenu,{show:O,offset:z,onClose:()=>{q(!1)},items:(e=>null==e?void 0:e.map((e=>({text:e.text,svgIcon:e.svgIcon,data:e,items:e.children?e.children.map((e=>({text:e.text,data:e}))):void 0}))))(M),onSelect:e=>{var t,a;const n=null==(t=e.item)?void 0:t.data;n&&(null==(a=n.children)||!a.length)&&(e=>{q(!1),D&&D(e)})(n)}}))},e.PromptHeader=ue,e.SuggestionGroup=Z,e.commandsViewDefaults=de,e.extractFieldMappingFromProps=e=>({textField:e.textField,statusField:e.statusField,authorIdField:e.authorIdField,authorNameField:e.authorNameField,authorImageUrlField:e.authorImageUrlField,authorImageAltTextField:e.authorImageAltTextField,idField:e.idField,timestampField:e.timestampField,filesField:e.filesField,attachmentsField:e.attachmentsField,replyToIdField:e.replyToIdField,isDeletedField:e.isDeletedField,isPinnedField:e.isPinnedField,typingField:e.typingField,suggestedActionsField:e.suggestedActionsField}),e.isStandardMessageFormat=ie,e.mapDataArrayToMessages=re,e.mapDataToMessage=se,e.mapMessageToCustomFormat=(e,t={})=>{const a={...oe,...t},n={};return void 0!==e.id&&(n[a.idField]=e.id),void 0!==e.text&&(n[a.textField]=e.text),void 0!==e.status&&(n[a.statusField]=e.status),void 0!==e.timestamp&&(n[a.timestampField]=e.timestamp),void 0!==e.attachments&&(n[a.attachmentsField]=e.attachments),void 0!==e.files&&(n[a.filesField]=e.files),void 0!==e.suggestedActions&&(n[a.suggestedActionsField]=e.suggestedActions),void 0!==e.replyToId&&(n[a.replyToIdField]=e.replyToId),void 0!==e.isDeleted&&(n[a.isDeletedField]=e.isDeleted),void 0!==e.isPinned&&(n[a.isPinnedField]=e.isPinned),void 0!==e.typing&&(n[a.typingField]=e.typing),e.author&&(void 0!==e.author.id&&(n[a.authorIdField]=e.author.id),void 0!==e.author.name&&(n[a.authorNameField]=e.author.name),void 0!==e.author.avatarUrl&&(n[a.authorImageUrlField]=e.author.avatarUrl),void 0!==e.author.avatarAltText&&(n[a.authorImageAltTextField]=e.author.avatarAltText)),void 0!==e.pinnedAt&&(n.pinnedAt=e.pinnedAt),void 0!==e.pinnedBy&&(n.pinnedBy=e.pinnedBy),void 0!==e.attachmentLayout&&(n.attachmentLayout=e.attachmentLayout),n},e.outputViewDefaults=me,e.promptViewDefaults=pe}));
|
package/package-metadata.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1755848645,version:"12.0.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"});exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = Object.freeze({
|
|
|
10
10
|
productName: "KendoReact",
|
|
11
11
|
productCode: "KENDOUIREACT",
|
|
12
12
|
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "12.0.0-develop.
|
|
13
|
+
publishDate: 1755848645,
|
|
14
|
+
version: "12.0.0-develop.6",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
});
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-conversational-ui",
|
|
3
|
-
"version": "12.0.0-develop.
|
|
3
|
+
"version": "12.0.0-develop.6",
|
|
4
4
|
"description": "React Chat component allows the user to participate in chat sessions with users or chat bots. KendoReact Conversational UI components",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -26,11 +26,15 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@progress/kendo-licensing": "^1.7.0",
|
|
29
|
-
"@progress/kendo-react-
|
|
30
|
-
"@progress/kendo-react-
|
|
31
|
-
"@progress/kendo-react-
|
|
32
|
-
"@progress/kendo-react-
|
|
33
|
-
"@progress/kendo-react-
|
|
29
|
+
"@progress/kendo-react-animation": "12.0.0-develop.6",
|
|
30
|
+
"@progress/kendo-react-buttons": "12.0.0-develop.6",
|
|
31
|
+
"@progress/kendo-react-common": "12.0.0-develop.6",
|
|
32
|
+
"@progress/kendo-react-intl": "12.0.0-develop.6",
|
|
33
|
+
"@progress/kendo-react-inputs": "12.0.0-develop.6",
|
|
34
|
+
"@progress/kendo-react-layout": "12.0.0-develop.6",
|
|
35
|
+
"@progress/kendo-react-notification": "12.0.0-develop.6",
|
|
36
|
+
"@progress/kendo-react-popup": "12.0.0-develop.6",
|
|
37
|
+
"@progress/kendo-react-upload": "12.0.0-develop.6",
|
|
34
38
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
35
39
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
36
40
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
"package": {
|
|
60
64
|
"productName": "KendoReact",
|
|
61
65
|
"productCode": "KENDOUIREACT",
|
|
62
|
-
"publishDate":
|
|
66
|
+
"publishDate": 1755848645,
|
|
63
67
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
64
68
|
}
|
|
65
69
|
},
|