@automattic/agenttic-ui 0.1.12 → 0.1.14
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/dist/components/AgentUIContainer.d.ts +2 -1
- package/dist/components/AgentUIContainer.d.ts.map +1 -1
- package/dist/components/chat/ChatInput.d.ts +3 -1
- package/dist/components/chat/ChatInput.d.ts.map +1 -1
- package/dist/components/chat/ChatInput.stories.d.ts +4 -0
- package/dist/components/chat/ChatInput.stories.d.ts.map +1 -1
- package/dist/components/chat/Message.d.ts.map +1 -1
- package/dist/components/chat/Suggestions.d.ts +2 -0
- package/dist/components/chat/Suggestions.d.ts.map +1 -1
- package/dist/components/composable/AgentUISuggestions.d.ts +2 -1
- package/dist/components/composable/AgentUISuggestions.d.ts.map +1 -1
- package/dist/components/views/CompactView.d.ts +2 -1
- package/dist/components/views/CompactView.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1060 -976
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { motion as
|
|
5
|
-
import { __ as
|
|
6
|
-
import { Slot as
|
|
7
|
-
import
|
|
8
|
-
import './index.css';function
|
|
9
|
-
return e.flat().filter(Boolean).map((t) => typeof t == "string" ? t : typeof t == "object" && !Array.isArray(t) && t !== null ? Object.entries(t).filter(([a,
|
|
1
|
+
import { jsxs as I, jsx as n, Fragment as Ht } from "react/jsx-runtime";
|
|
2
|
+
import * as oe from "react";
|
|
3
|
+
import ae, { useState as k, useEffect as E, useCallback as d, useRef as L, createContext as De, useContext as Oe, useId as Ne, memo as Me, useMemo as Pe } from "react";
|
|
4
|
+
import { motion as P, AnimatePresence as At, useMotionValue as Mt, useDragControls as ie, animate as Pt } from "framer-motion";
|
|
5
|
+
import { __ as ut } from "@wordpress/i18n";
|
|
6
|
+
import { Slot as Ve } from "@radix-ui/react-slot";
|
|
7
|
+
import He from "react-markdown";
|
|
8
|
+
import './index.css';function U(...e) {
|
|
9
|
+
return e.flat().filter(Boolean).map((t) => typeof t == "string" ? t : typeof t == "object" && !Array.isArray(t) && t !== null ? Object.entries(t).filter(([a, r]) => r).map(([a]) => a).join(" ") : "").join(" ").trim();
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
const t = e || "collapsed", [a,
|
|
11
|
+
function re(e) {
|
|
12
|
+
const t = e || "collapsed", [a, r] = k(t);
|
|
13
13
|
E(() => {
|
|
14
|
-
e !== void 0 &&
|
|
14
|
+
e !== void 0 && r(e);
|
|
15
15
|
}, [e]);
|
|
16
|
-
const s = a !== "collapsed" && a !== "compact",
|
|
17
|
-
|
|
18
|
-
}, []),
|
|
19
|
-
|
|
20
|
-
}, [t]),
|
|
21
|
-
|
|
16
|
+
const s = a !== "collapsed" && a !== "compact", i = d(() => {
|
|
17
|
+
r("expanded");
|
|
18
|
+
}, []), c = d(() => {
|
|
19
|
+
r(t);
|
|
20
|
+
}, [t]), h = d(() => {
|
|
21
|
+
r(
|
|
22
22
|
(u) => u === "collapsed" ? "compact" : "collapsed"
|
|
23
23
|
);
|
|
24
24
|
}, []);
|
|
25
25
|
return {
|
|
26
26
|
state: a,
|
|
27
27
|
initialState: t,
|
|
28
|
-
setState:
|
|
28
|
+
setState: r,
|
|
29
29
|
isOpen: s,
|
|
30
|
-
open:
|
|
31
|
-
close:
|
|
32
|
-
toggle:
|
|
30
|
+
open: i,
|
|
31
|
+
close: c,
|
|
32
|
+
toggle: h
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function se({
|
|
36
36
|
value: e,
|
|
37
37
|
setValue: t,
|
|
38
38
|
onSubmit: a,
|
|
39
|
-
isProcessing:
|
|
39
|
+
isProcessing: r
|
|
40
40
|
}) {
|
|
41
|
-
const s =
|
|
41
|
+
const s = L(null), i = d(() => {
|
|
42
42
|
t(""), s.current && (s.current.style.height = "auto", setTimeout(() => {
|
|
43
43
|
var u;
|
|
44
44
|
(u = s.current) == null || u.focus();
|
|
45
45
|
}, 100));
|
|
46
|
-
}, [t]),
|
|
46
|
+
}, [t]), c = d(() => {
|
|
47
47
|
const u = s.current;
|
|
48
48
|
if (!u)
|
|
49
49
|
return;
|
|
50
50
|
u.style.height = "auto";
|
|
51
|
-
const m = u.scrollHeight,
|
|
51
|
+
const m = u.scrollHeight, p = 40, g = 200;
|
|
52
52
|
u.style.height = `${Math.min(
|
|
53
|
-
Math.max(m,
|
|
54
|
-
|
|
53
|
+
Math.max(m, p),
|
|
54
|
+
g
|
|
55
55
|
)}px`;
|
|
56
|
-
}, []),
|
|
56
|
+
}, []), h = d(
|
|
57
57
|
(u) => {
|
|
58
|
-
u.key === "Enter" && !u.shiftKey && !
|
|
58
|
+
u.key === "Enter" && !u.shiftKey && !r && e.trim() && (u.preventDefault(), a(e.trim()), i());
|
|
59
59
|
},
|
|
60
|
-
[e,
|
|
60
|
+
[e, r, a, i]
|
|
61
61
|
);
|
|
62
62
|
return E(() => {
|
|
63
|
-
|
|
64
|
-
}, [e,
|
|
63
|
+
c();
|
|
64
|
+
}, [e, c]), {
|
|
65
65
|
value: e,
|
|
66
66
|
setValue: t,
|
|
67
|
-
clear:
|
|
67
|
+
clear: i,
|
|
68
68
|
textareaRef: s,
|
|
69
|
-
handleKeyDown:
|
|
70
|
-
adjustHeight:
|
|
69
|
+
handleKeyDown: h,
|
|
70
|
+
adjustHeight: c
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const ce = ut("Ask anything", "a8c-agenttic"), Yt = {
|
|
74
74
|
type: "spring",
|
|
75
75
|
stiffness: 300,
|
|
76
76
|
damping: 30
|
|
77
|
-
},
|
|
77
|
+
}, dt = {
|
|
78
78
|
type: "spring",
|
|
79
79
|
damping: 40,
|
|
80
80
|
stiffness: 500,
|
|
81
81
|
mass: 0.8
|
|
82
82
|
}, Vt = {
|
|
83
|
-
...
|
|
83
|
+
...dt,
|
|
84
84
|
stiffness: 1e3,
|
|
85
85
|
damping: 90
|
|
86
86
|
}, $t = {
|
|
@@ -88,19 +88,19 @@ const ie = Ct("Ask anything", "a8c-agenttic"), Zt = {
|
|
|
88
88
|
damping: 40,
|
|
89
89
|
stiffness: 500,
|
|
90
90
|
mass: 0.8
|
|
91
|
-
},
|
|
91
|
+
}, le = {
|
|
92
92
|
hidden: {
|
|
93
93
|
opacity: 0
|
|
94
94
|
},
|
|
95
95
|
visible: {
|
|
96
96
|
opacity: 1,
|
|
97
|
-
transition:
|
|
97
|
+
transition: Yt
|
|
98
98
|
},
|
|
99
99
|
exit: {
|
|
100
100
|
opacity: 0,
|
|
101
|
-
transition: { ...
|
|
101
|
+
transition: { ...Yt, duration: 0.1 }
|
|
102
102
|
}
|
|
103
|
-
},
|
|
103
|
+
}, $e = () => {
|
|
104
104
|
if (typeof window > "u")
|
|
105
105
|
return { left: 0, right: 0, top: 0, bottom: 0 };
|
|
106
106
|
const e = 20;
|
|
@@ -112,67 +112,67 @@ const ie = Ct("Ask anything", "a8c-agenttic"), Zt = {
|
|
|
112
112
|
bottom: window.innerHeight - 60 - e
|
|
113
113
|
// Assuming collapsed height of 60px
|
|
114
114
|
};
|
|
115
|
-
},
|
|
115
|
+
}, Fe = {
|
|
116
116
|
"0%": { backgroundPosition: "-200% 0" },
|
|
117
117
|
"100%": { backgroundPosition: "200% 0" }
|
|
118
|
-
},
|
|
118
|
+
}, to = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
119
119
|
__proto__: null,
|
|
120
|
-
fadeVariants:
|
|
121
|
-
fastSpring:
|
|
120
|
+
fadeVariants: le,
|
|
121
|
+
fastSpring: dt,
|
|
122
122
|
fastSpringWithDelay: Vt,
|
|
123
|
-
getDragConstraints:
|
|
123
|
+
getDragConstraints: $e,
|
|
124
124
|
morphSpring: $t,
|
|
125
|
-
springConfig:
|
|
126
|
-
thinkingGradientKeyframes:
|
|
127
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
128
|
-
button:
|
|
129
|
-
pressed:
|
|
130
|
-
primary:
|
|
131
|
-
ghost:
|
|
132
|
-
outline:
|
|
133
|
-
transparent:
|
|
134
|
-
link:
|
|
135
|
-
icon:
|
|
136
|
-
sm:
|
|
137
|
-
lg:
|
|
138
|
-
withTextAndIcon:
|
|
139
|
-
},
|
|
125
|
+
springConfig: Yt,
|
|
126
|
+
thinkingGradientKeyframes: Fe
|
|
127
|
+
}, Symbol.toStringTag, { value: "Module" })), ke = "button-module_button", Ue = "button-module_pressed", We = "button-module_primary", Be = "button-module_ghost", Ge = "button-module_outline", Ze = "button-module_transparent", Ye = "button-module_link", Ke = "button-module_icon", Xe = "button-module_sm", je = "button-module_lg", ze = "button-module_withTextAndIcon", It = {
|
|
128
|
+
button: ke,
|
|
129
|
+
pressed: Ue,
|
|
130
|
+
primary: We,
|
|
131
|
+
ghost: Be,
|
|
132
|
+
outline: Ge,
|
|
133
|
+
transparent: Ze,
|
|
134
|
+
link: Ye,
|
|
135
|
+
icon: Ke,
|
|
136
|
+
sm: Xe,
|
|
137
|
+
lg: je,
|
|
138
|
+
withTextAndIcon: ze
|
|
139
|
+
}, X = oe.forwardRef(
|
|
140
140
|
function({
|
|
141
141
|
className: t,
|
|
142
142
|
variant: a = "primary",
|
|
143
|
-
size:
|
|
143
|
+
size: r,
|
|
144
144
|
icon: s,
|
|
145
|
-
children:
|
|
146
|
-
asChild:
|
|
147
|
-
pressed:
|
|
145
|
+
children: i,
|
|
146
|
+
asChild: c = !1,
|
|
147
|
+
pressed: h = !1,
|
|
148
148
|
...u
|
|
149
149
|
}, m) {
|
|
150
|
-
const
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
|
|
150
|
+
const p = c ? Ve : "button", g = !!s, w = r || (g && !i ? "icon" : void 0);
|
|
151
|
+
return /* @__PURE__ */ I(
|
|
152
|
+
p,
|
|
153
153
|
{
|
|
154
154
|
ref: m,
|
|
155
155
|
"data-slot": "button",
|
|
156
|
-
className:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
className: U(
|
|
157
|
+
It.button,
|
|
158
|
+
It[a],
|
|
159
|
+
w && It[w],
|
|
160
|
+
g && i ? It.withTextAndIcon : void 0,
|
|
161
|
+
h ? It.pressed : void 0,
|
|
162
162
|
t
|
|
163
163
|
),
|
|
164
|
-
"aria-pressed":
|
|
164
|
+
"aria-pressed": h,
|
|
165
165
|
...u,
|
|
166
166
|
children: [
|
|
167
167
|
s,
|
|
168
|
-
|
|
168
|
+
i
|
|
169
169
|
]
|
|
170
170
|
}
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
173
|
);
|
|
174
|
-
|
|
175
|
-
function
|
|
174
|
+
X.displayName = "Button";
|
|
175
|
+
function ue({ className: e, size: t = 24 }) {
|
|
176
176
|
return /* @__PURE__ */ n(
|
|
177
177
|
"svg",
|
|
178
178
|
{
|
|
@@ -192,20 +192,20 @@ function se({ className: e, size: t = 24 }) {
|
|
|
192
192
|
}
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
|
-
const
|
|
196
|
-
button:
|
|
195
|
+
const qe = "CollapsedView-module_button", Je = {
|
|
196
|
+
button: qe
|
|
197
197
|
};
|
|
198
|
-
function
|
|
199
|
-
icon: e = /* @__PURE__ */ n(
|
|
198
|
+
function de({
|
|
199
|
+
icon: e = /* @__PURE__ */ n(ue, { size: 36 }),
|
|
200
200
|
onClick: t,
|
|
201
201
|
onHover: a,
|
|
202
|
-
focusOnMount:
|
|
202
|
+
focusOnMount: r = !1
|
|
203
203
|
}) {
|
|
204
|
-
const s =
|
|
204
|
+
const s = L(null), i = L(r);
|
|
205
205
|
return E(() => {
|
|
206
|
-
|
|
207
|
-
}, [
|
|
208
|
-
|
|
206
|
+
i.current && s.current && s.current.focus(), i.current = !1;
|
|
207
|
+
}, [i, s]), /* @__PURE__ */ n(
|
|
208
|
+
P.div,
|
|
209
209
|
{
|
|
210
210
|
"data-slot": "collapsed-view",
|
|
211
211
|
layout: "preserve-aspect",
|
|
@@ -230,35 +230,35 @@ function ce({
|
|
|
230
230
|
}
|
|
231
231
|
},
|
|
232
232
|
children: /* @__PURE__ */ n(
|
|
233
|
-
|
|
233
|
+
X,
|
|
234
234
|
{
|
|
235
235
|
ref: s,
|
|
236
236
|
onClick: t,
|
|
237
237
|
onMouseEnter: a,
|
|
238
238
|
variant: "link",
|
|
239
|
-
className:
|
|
239
|
+
className: Je.button,
|
|
240
240
|
icon: e,
|
|
241
|
-
"aria-label":
|
|
241
|
+
"aria-label": ut("Open chat", "a8c-agenttic")
|
|
242
242
|
}
|
|
243
243
|
)
|
|
244
244
|
}
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
|
-
const
|
|
248
|
-
textarea:
|
|
249
|
-
},
|
|
247
|
+
const Qe = "Textarea-module_textarea", tn = {
|
|
248
|
+
textarea: Qe
|
|
249
|
+
}, me = oe.forwardRef(
|
|
250
250
|
({ className: e, ...t }, a) => /* @__PURE__ */ n(
|
|
251
251
|
"textarea",
|
|
252
252
|
{
|
|
253
253
|
"data-slot": "textarea",
|
|
254
|
-
className:
|
|
254
|
+
className: tn.textarea,
|
|
255
255
|
ref: a,
|
|
256
256
|
...t
|
|
257
257
|
}
|
|
258
258
|
)
|
|
259
259
|
);
|
|
260
|
-
|
|
261
|
-
function
|
|
260
|
+
me.displayName = "Textarea";
|
|
261
|
+
function en({ className: e, size: t = 24 }) {
|
|
262
262
|
return /* @__PURE__ */ n(
|
|
263
263
|
"svg",
|
|
264
264
|
{
|
|
@@ -278,7 +278,7 @@ function ze({ className: e, size: t = 24 }) {
|
|
|
278
278
|
}
|
|
279
279
|
);
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function nn({ className: e, size: t = 24 }) {
|
|
282
282
|
return /* @__PURE__ */ n(
|
|
283
283
|
"svg",
|
|
284
284
|
{
|
|
@@ -302,13 +302,13 @@ function qe({ className: e, size: t = 24 }) {
|
|
|
302
302
|
}
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
|
-
const
|
|
306
|
-
container:
|
|
307
|
-
textareaContainer:
|
|
308
|
-
actions:
|
|
309
|
-
button:
|
|
305
|
+
const on = "ChatInput-module_container", an = "ChatInput-module_textareaContainer", rn = "ChatInput-module_actions", sn = "ChatInput-module_button", vt = {
|
|
306
|
+
container: on,
|
|
307
|
+
textareaContainer: an,
|
|
308
|
+
actions: rn,
|
|
309
|
+
button: sn
|
|
310
310
|
};
|
|
311
|
-
function
|
|
311
|
+
function cn({ className: e, size: t = 24 }) {
|
|
312
312
|
return /* @__PURE__ */ n(
|
|
313
313
|
"svg",
|
|
314
314
|
{
|
|
@@ -330,27 +330,27 @@ function nn({ className: e, size: t = 24 }) {
|
|
|
330
330
|
}
|
|
331
331
|
);
|
|
332
332
|
}
|
|
333
|
-
const
|
|
334
|
-
container:
|
|
333
|
+
const ln = "AnimatedPlaceholder-module_container", un = {
|
|
334
|
+
container: ln
|
|
335
335
|
};
|
|
336
|
-
function
|
|
336
|
+
function dn({
|
|
337
337
|
texts: e,
|
|
338
338
|
interval: t = 3e3,
|
|
339
339
|
className: a = ""
|
|
340
340
|
}) {
|
|
341
|
-
const [
|
|
341
|
+
const [r, s] = k(0);
|
|
342
342
|
return E(() => {
|
|
343
|
-
const
|
|
343
|
+
const i = setInterval(() => {
|
|
344
344
|
s(
|
|
345
|
-
(
|
|
345
|
+
(c) => (c + 1) % e.length
|
|
346
346
|
);
|
|
347
347
|
}, t);
|
|
348
|
-
return () => clearInterval(
|
|
349
|
-
}, [e.length, t]), /* @__PURE__ */ n(
|
|
350
|
-
|
|
348
|
+
return () => clearInterval(i);
|
|
349
|
+
}, [e.length, t]), /* @__PURE__ */ n(At, { mode: "wait", children: /* @__PURE__ */ n(
|
|
350
|
+
P.span,
|
|
351
351
|
{
|
|
352
352
|
"data-slot": "animated-placeholder",
|
|
353
|
-
className:
|
|
353
|
+
className: U(un.container, a),
|
|
354
354
|
initial: { opacity: 0, y: 8 },
|
|
355
355
|
animate: { opacity: 1, y: 0 },
|
|
356
356
|
exit: { opacity: 0, y: -8 },
|
|
@@ -359,305 +359,323 @@ function rn({
|
|
|
359
359
|
ease: [0.4, 0, 0.2, 1]
|
|
360
360
|
// Matches --transition-colors cubic-bezier
|
|
361
361
|
},
|
|
362
|
-
children: e[
|
|
362
|
+
children: e[r]
|
|
363
363
|
},
|
|
364
|
-
|
|
364
|
+
r
|
|
365
365
|
) });
|
|
366
366
|
}
|
|
367
|
-
const
|
|
368
|
-
function
|
|
369
|
-
const e =
|
|
367
|
+
const fe = De(null);
|
|
368
|
+
function mt() {
|
|
369
|
+
const e = Oe(fe);
|
|
370
370
|
if (!e)
|
|
371
371
|
throw new Error(
|
|
372
372
|
"useAgentUIContext must be used within an AgentUIContainer"
|
|
373
373
|
);
|
|
374
374
|
return e;
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
return /* @__PURE__ */ n(
|
|
376
|
+
function Qt({ children: e, value: t }) {
|
|
377
|
+
return /* @__PURE__ */ n(fe.Provider, { value: t, children: e });
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Xt({
|
|
380
380
|
value: e,
|
|
381
381
|
onChange: t,
|
|
382
382
|
onSubmit: a,
|
|
383
|
-
onKeyDown:
|
|
383
|
+
onKeyDown: r,
|
|
384
384
|
textareaRef: s,
|
|
385
|
-
placeholder:
|
|
386
|
-
isProcessing:
|
|
387
|
-
onBlur:
|
|
385
|
+
placeholder: i = ce,
|
|
386
|
+
isProcessing: c,
|
|
387
|
+
onBlur: h,
|
|
388
388
|
fromCompact: u = !1,
|
|
389
389
|
onExpand: m,
|
|
390
|
-
showExpandButton:
|
|
391
|
-
focusOnMount:
|
|
392
|
-
customActions:
|
|
393
|
-
actionOrder:
|
|
394
|
-
onStop:
|
|
395
|
-
disabled:
|
|
396
|
-
className: O
|
|
390
|
+
showExpandButton: p = !0,
|
|
391
|
+
focusOnMount: g = !1,
|
|
392
|
+
customActions: w = [],
|
|
393
|
+
actionOrder: _ = "before-submit",
|
|
394
|
+
onStop: y,
|
|
395
|
+
disabled: S = !1,
|
|
396
|
+
className: O,
|
|
397
|
+
onMouseEnter: H,
|
|
398
|
+
onMouseLeave: A
|
|
397
399
|
}) {
|
|
398
|
-
const
|
|
399
|
-
let
|
|
400
|
-
|
|
401
|
-
const
|
|
400
|
+
const $ = Ne(), l = (e.trim() || c) && !S, { variant: N, floatingChatState: ft } = mt(), B = (T) => T.endsWith("…") ? T : `${T}…`, et = Array.isArray(i);
|
|
401
|
+
let G;
|
|
402
|
+
et ? G = i.map(B) : i ? G = B(i) : G = "";
|
|
403
|
+
const M = L(g);
|
|
402
404
|
E(() => {
|
|
403
|
-
|
|
404
|
-
}, [
|
|
405
|
-
const
|
|
406
|
-
|
|
405
|
+
M.current && s.current && s.current.focus(), M.current = !1;
|
|
406
|
+
}, [M, s]);
|
|
407
|
+
const nt = () => w.map((T) => /* @__PURE__ */ n(
|
|
408
|
+
X,
|
|
407
409
|
{
|
|
408
|
-
className:
|
|
409
|
-
onClick:
|
|
410
|
-
disabled:
|
|
411
|
-
variant:
|
|
412
|
-
icon:
|
|
413
|
-
"aria-label":
|
|
410
|
+
className: T.className || vt.button,
|
|
411
|
+
onClick: T.onClick,
|
|
412
|
+
disabled: T.disabled,
|
|
413
|
+
variant: T.variant || "ghost",
|
|
414
|
+
icon: T.icon,
|
|
415
|
+
"aria-label": T["aria-label"]
|
|
414
416
|
},
|
|
415
|
-
|
|
416
|
-
)),
|
|
417
|
-
|
|
417
|
+
T.id
|
|
418
|
+
)), o = () => N === "embedded" || ft === "expanded" ? null : p && m ? /* @__PURE__ */ n(
|
|
419
|
+
X,
|
|
418
420
|
{
|
|
419
|
-
className:
|
|
421
|
+
className: vt.button,
|
|
420
422
|
onClick: m,
|
|
421
423
|
variant: "ghost",
|
|
422
|
-
icon: /* @__PURE__ */ n(
|
|
423
|
-
"aria-label":
|
|
424
|
+
icon: /* @__PURE__ */ n(cn, {}),
|
|
425
|
+
"aria-label": ut("Expand conversation", "a8c-agenttic")
|
|
424
426
|
}
|
|
425
|
-
) : null,
|
|
426
|
-
|
|
427
|
-
|
|
427
|
+
) : null, ot = () => {
|
|
428
|
+
if (c && !y)
|
|
429
|
+
return null;
|
|
430
|
+
const T = () => {
|
|
431
|
+
c && y ? y() : a();
|
|
428
432
|
};
|
|
429
433
|
return /* @__PURE__ */ n(
|
|
430
|
-
|
|
434
|
+
X,
|
|
431
435
|
{
|
|
432
|
-
className:
|
|
433
|
-
onClick:
|
|
434
|
-
disabled: !
|
|
436
|
+
className: vt.button,
|
|
437
|
+
onClick: T,
|
|
438
|
+
disabled: !l,
|
|
435
439
|
variant: "primary",
|
|
436
|
-
icon:
|
|
437
|
-
"aria-label":
|
|
440
|
+
icon: c ? /* @__PURE__ */ n(nn, {}) : /* @__PURE__ */ n(en, {}),
|
|
441
|
+
"aria-label": c ? ut("Stop processing", "a8c-agenttic") : ut("Send message", "a8c-agenttic")
|
|
438
442
|
}
|
|
439
443
|
);
|
|
440
444
|
};
|
|
441
|
-
return /* @__PURE__ */
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
445
|
+
return /* @__PURE__ */ I(
|
|
446
|
+
"div",
|
|
447
|
+
{
|
|
448
|
+
"data-slot": "chat-input",
|
|
449
|
+
className: vt.container,
|
|
450
|
+
onMouseEnter: H,
|
|
451
|
+
onMouseLeave: A,
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ I(
|
|
454
|
+
P.div,
|
|
455
|
+
{
|
|
456
|
+
className: vt.textareaContainer,
|
|
457
|
+
initial: {
|
|
458
|
+
opacity: 0
|
|
459
|
+
},
|
|
460
|
+
animate: {
|
|
461
|
+
opacity: 1,
|
|
462
|
+
scale: 1,
|
|
463
|
+
transition: e.trim() ? { duration: 0 } : Vt
|
|
464
|
+
},
|
|
465
|
+
children: [
|
|
466
|
+
!e && et && /* @__PURE__ */ n(
|
|
467
|
+
dn,
|
|
468
|
+
{
|
|
469
|
+
texts: G
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ n(
|
|
473
|
+
me,
|
|
474
|
+
{
|
|
475
|
+
id: $,
|
|
476
|
+
ref: s,
|
|
477
|
+
value: e,
|
|
478
|
+
onChange: (T) => t(T.target.value),
|
|
479
|
+
onKeyDown: r,
|
|
480
|
+
onBlur: h,
|
|
481
|
+
placeholder: et ? "" : G,
|
|
482
|
+
rows: 1
|
|
483
|
+
}
|
|
484
|
+
)
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
),
|
|
488
|
+
/* @__PURE__ */ I(
|
|
489
|
+
P.div,
|
|
490
|
+
{
|
|
491
|
+
className: vt.actions,
|
|
492
|
+
initial: {
|
|
493
|
+
opacity: u ? 1 : 0,
|
|
494
|
+
scale: u ? 1 : 0.5
|
|
495
|
+
},
|
|
496
|
+
animate: {
|
|
497
|
+
opacity: 1,
|
|
498
|
+
scale: 1,
|
|
499
|
+
transition: e.trim() ? { duration: 0 } : dt
|
|
500
|
+
},
|
|
501
|
+
children: [
|
|
502
|
+
o(),
|
|
503
|
+
_ === "before-submit" && nt(),
|
|
504
|
+
ot(),
|
|
505
|
+
_ === "after-submit" && nt()
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
)
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
);
|
|
499
512
|
}
|
|
500
|
-
const
|
|
501
|
-
container:
|
|
502
|
-
vertical:
|
|
503
|
-
},
|
|
513
|
+
const mn = "Suggestions-module_container", fn = "Suggestions-module_vertical", Bt = {
|
|
514
|
+
container: mn,
|
|
515
|
+
vertical: fn
|
|
516
|
+
}, jt = ({
|
|
504
517
|
className: e,
|
|
505
518
|
suggestions: t,
|
|
506
519
|
onSubmit: a,
|
|
507
|
-
layout:
|
|
508
|
-
visible: s = !0
|
|
520
|
+
layout: r = "horizontal",
|
|
521
|
+
visible: s = !0,
|
|
522
|
+
onMouseEnter: i,
|
|
523
|
+
onMouseLeave: c
|
|
509
524
|
}) => {
|
|
510
|
-
const
|
|
511
|
-
a && a(
|
|
525
|
+
const h = (u) => {
|
|
526
|
+
a && a(u.prompt);
|
|
512
527
|
};
|
|
513
|
-
return !t || t.length === 0 ? null : /* @__PURE__ */ n(
|
|
514
|
-
|
|
528
|
+
return !t || t.length === 0 ? null : /* @__PURE__ */ n(At, { children: t && t.length > 0 && s && /* @__PURE__ */ n(
|
|
529
|
+
P.div,
|
|
515
530
|
{
|
|
516
|
-
className:
|
|
517
|
-
|
|
518
|
-
|
|
531
|
+
className: U(
|
|
532
|
+
Bt.container,
|
|
533
|
+
r === "vertical" ? Bt.vertical : "",
|
|
519
534
|
e
|
|
520
535
|
),
|
|
521
536
|
initial: { opacity: 0, y: "-80%" },
|
|
522
537
|
animate: { opacity: 1, y: "-100%" },
|
|
523
538
|
exit: { opacity: 0, y: "-80%" },
|
|
524
539
|
transition: Vt,
|
|
540
|
+
onMouseEnter: i,
|
|
541
|
+
onMouseLeave: c,
|
|
525
542
|
children: t.map(
|
|
526
|
-
(
|
|
527
|
-
|
|
543
|
+
(u, m) => /* @__PURE__ */ n(
|
|
544
|
+
P.div,
|
|
528
545
|
{
|
|
529
546
|
initial: { opacity: 0, y: 10 },
|
|
530
547
|
animate: { opacity: 1, y: 0 },
|
|
531
548
|
exit: { opacity: 0, y: 10 },
|
|
532
549
|
transition: {
|
|
533
550
|
...Vt,
|
|
534
|
-
delay:
|
|
551
|
+
delay: m * 0.05
|
|
535
552
|
},
|
|
536
553
|
children: /* @__PURE__ */ n(
|
|
537
|
-
|
|
554
|
+
X,
|
|
538
555
|
{
|
|
539
|
-
onClick: () =>
|
|
540
|
-
variant:
|
|
541
|
-
size:
|
|
542
|
-
className:
|
|
543
|
-
children:
|
|
556
|
+
onClick: () => h(u),
|
|
557
|
+
variant: r === "vertical" ? "transparent" : "outline",
|
|
558
|
+
size: r === "vertical" ? "lg" : void 0,
|
|
559
|
+
className: Bt.button,
|
|
560
|
+
children: u.label
|
|
544
561
|
}
|
|
545
562
|
)
|
|
546
563
|
},
|
|
547
|
-
|
|
564
|
+
u.id
|
|
548
565
|
)
|
|
549
566
|
)
|
|
550
567
|
}
|
|
551
568
|
) });
|
|
552
569
|
};
|
|
553
|
-
function
|
|
554
|
-
const e =
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
}, []), a =
|
|
558
|
-
(
|
|
559
|
-
t(
|
|
560
|
-
const u = setTimeout(
|
|
561
|
-
return e.current.set(
|
|
570
|
+
function hn() {
|
|
571
|
+
const e = L(/* @__PURE__ */ new Map()), t = d((i) => {
|
|
572
|
+
const c = e.current.get(i);
|
|
573
|
+
c && (clearTimeout(c), e.current.delete(i));
|
|
574
|
+
}, []), a = d(
|
|
575
|
+
(i, c, h) => {
|
|
576
|
+
t(i);
|
|
577
|
+
const u = setTimeout(c, h);
|
|
578
|
+
return e.current.set(i, u), u;
|
|
562
579
|
},
|
|
563
580
|
[t]
|
|
564
|
-
),
|
|
565
|
-
e.current.forEach((
|
|
566
|
-
clearTimeout(
|
|
581
|
+
), r = d(() => {
|
|
582
|
+
e.current.forEach((i) => {
|
|
583
|
+
clearTimeout(i);
|
|
567
584
|
}), e.current.clear();
|
|
568
|
-
}, []), s =
|
|
569
|
-
return E(() =>
|
|
585
|
+
}, []), s = d((i) => e.current.has(i), []);
|
|
586
|
+
return E(() => r, [r]), {
|
|
570
587
|
setNamedTimeout: a,
|
|
571
588
|
clearNamedTimeout: t,
|
|
572
|
-
clearAllTimeouts:
|
|
589
|
+
clearAllTimeouts: r,
|
|
573
590
|
hasTimeout: s
|
|
574
591
|
};
|
|
575
592
|
}
|
|
576
|
-
const
|
|
577
|
-
function
|
|
593
|
+
const pn = 4e3;
|
|
594
|
+
function he({
|
|
578
595
|
value: e,
|
|
579
596
|
onChange: t,
|
|
580
597
|
onSubmit: a,
|
|
581
|
-
onKeyDown:
|
|
598
|
+
onKeyDown: r,
|
|
582
599
|
textareaRef: s,
|
|
583
|
-
placeholder:
|
|
584
|
-
isProcessing:
|
|
585
|
-
onBlur:
|
|
600
|
+
placeholder: i,
|
|
601
|
+
isProcessing: c,
|
|
602
|
+
onBlur: h,
|
|
586
603
|
onExpand: u,
|
|
587
604
|
showExpandButton: m = !0,
|
|
588
|
-
focusOnMount:
|
|
589
|
-
customActions:
|
|
590
|
-
actionOrder:
|
|
591
|
-
onStop:
|
|
592
|
-
suggestions:
|
|
593
|
-
clearSuggestions:
|
|
605
|
+
focusOnMount: p = !1,
|
|
606
|
+
customActions: g,
|
|
607
|
+
actionOrder: w,
|
|
608
|
+
onStop: _,
|
|
609
|
+
suggestions: y,
|
|
610
|
+
clearSuggestions: S,
|
|
611
|
+
handleSuggestionSubmit: O
|
|
594
612
|
}) {
|
|
595
|
-
const [
|
|
596
|
-
(
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
613
|
+
const [H, A] = k(!1), { setNamedTimeout: $, clearAllTimeouts: l } = hn(), N = d(() => {
|
|
614
|
+
$(
|
|
615
|
+
"hide-suggestions",
|
|
616
|
+
() => {
|
|
617
|
+
A(!1);
|
|
618
|
+
},
|
|
619
|
+
pn
|
|
620
|
+
);
|
|
621
|
+
}, [$]);
|
|
601
622
|
return E(() => {
|
|
602
|
-
if (
|
|
603
|
-
|
|
623
|
+
if (l(), e) {
|
|
624
|
+
A(!1);
|
|
604
625
|
return;
|
|
605
626
|
}
|
|
606
|
-
if (!
|
|
607
|
-
|
|
627
|
+
if (!y || y.length === 0) {
|
|
628
|
+
A(!1);
|
|
608
629
|
return;
|
|
609
630
|
}
|
|
610
|
-
|
|
611
|
-
"hide-suggestions",
|
|
612
|
-
() => {
|
|
613
|
-
D(!1), N(
|
|
614
|
-
"clear-suggestions",
|
|
615
|
-
() => {
|
|
616
|
-
L == null || L();
|
|
617
|
-
},
|
|
618
|
-
dn
|
|
619
|
-
);
|
|
620
|
-
},
|
|
621
|
-
un
|
|
622
|
-
);
|
|
631
|
+
A(!0), N();
|
|
623
632
|
}, [
|
|
624
633
|
e,
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
634
|
+
y,
|
|
635
|
+
l,
|
|
636
|
+
$,
|
|
637
|
+
S,
|
|
638
|
+
N
|
|
639
|
+
]), /* @__PURE__ */ I(Ht, { children: [
|
|
630
640
|
/* @__PURE__ */ n(
|
|
631
|
-
|
|
641
|
+
Xt,
|
|
632
642
|
{
|
|
633
643
|
value: e,
|
|
634
644
|
onChange: t,
|
|
635
645
|
onSubmit: a,
|
|
636
|
-
onKeyDown:
|
|
646
|
+
onKeyDown: r,
|
|
637
647
|
textareaRef: s,
|
|
638
|
-
placeholder:
|
|
639
|
-
isProcessing:
|
|
640
|
-
onBlur:
|
|
648
|
+
placeholder: i,
|
|
649
|
+
isProcessing: c,
|
|
650
|
+
onBlur: h,
|
|
641
651
|
onExpand: u,
|
|
642
652
|
showExpandButton: m,
|
|
643
|
-
focusOnMount:
|
|
644
|
-
customActions:
|
|
645
|
-
actionOrder:
|
|
646
|
-
onStop:
|
|
653
|
+
focusOnMount: p,
|
|
654
|
+
customActions: g,
|
|
655
|
+
actionOrder: w,
|
|
656
|
+
onStop: _,
|
|
657
|
+
onMouseEnter: () => {
|
|
658
|
+
l(), A(!0);
|
|
659
|
+
},
|
|
660
|
+
onMouseLeave: () => N()
|
|
647
661
|
}
|
|
648
662
|
),
|
|
649
663
|
!e && /* @__PURE__ */ n(
|
|
650
|
-
|
|
664
|
+
jt,
|
|
651
665
|
{
|
|
652
|
-
suggestions:
|
|
653
|
-
onSubmit:
|
|
666
|
+
suggestions: y,
|
|
667
|
+
onSubmit: O,
|
|
654
668
|
layout: "vertical",
|
|
655
|
-
visible:
|
|
669
|
+
visible: H,
|
|
670
|
+
onMouseEnter: () => {
|
|
671
|
+
l(), A(!0);
|
|
672
|
+
},
|
|
673
|
+
onMouseLeave: () => N()
|
|
656
674
|
}
|
|
657
675
|
)
|
|
658
676
|
] });
|
|
659
677
|
}
|
|
660
|
-
function
|
|
678
|
+
function pe({ className: e, size: t = 24 }) {
|
|
661
679
|
return /* @__PURE__ */ n(
|
|
662
680
|
"svg",
|
|
663
681
|
{
|
|
@@ -677,77 +695,77 @@ function me({ className: e, size: t = 24 }) {
|
|
|
677
695
|
}
|
|
678
696
|
);
|
|
679
697
|
}
|
|
680
|
-
const
|
|
681
|
-
container:
|
|
698
|
+
const Cn = "ChatHeader-module_container", gn = {
|
|
699
|
+
container: Cn
|
|
682
700
|
};
|
|
683
|
-
function
|
|
701
|
+
function Ce({ onClose: e, className: t }) {
|
|
684
702
|
return /* @__PURE__ */ n(
|
|
685
|
-
|
|
703
|
+
P.div,
|
|
686
704
|
{
|
|
687
705
|
"data-slot": "chat-header",
|
|
688
706
|
"data-draggable": "true",
|
|
689
|
-
className:
|
|
707
|
+
className: gn.container,
|
|
690
708
|
initial: { opacity: 0 },
|
|
691
709
|
animate: { opacity: 1 },
|
|
692
|
-
transition: { ...
|
|
710
|
+
transition: { ...dt, delay: 0.1 },
|
|
693
711
|
children: e && /* @__PURE__ */ n(
|
|
694
|
-
|
|
712
|
+
X,
|
|
695
713
|
{
|
|
696
714
|
variant: "ghost",
|
|
697
|
-
icon: /* @__PURE__ */ n(
|
|
715
|
+
icon: /* @__PURE__ */ n(pe, {}),
|
|
698
716
|
onClick: e,
|
|
699
|
-
"aria-label":
|
|
717
|
+
"aria-label": ut("Close conversation", "a8c-agenttic")
|
|
700
718
|
}
|
|
701
719
|
)
|
|
702
720
|
}
|
|
703
721
|
);
|
|
704
722
|
}
|
|
705
|
-
const
|
|
706
|
-
container:
|
|
707
|
-
containerWithIcon:
|
|
708
|
-
content:
|
|
709
|
-
actions:
|
|
710
|
-
icon:
|
|
711
|
-
dismissible:
|
|
723
|
+
const vn = "Notice-module_container", wn = "Notice-module_containerWithIcon", Ln = "Notice-module_content", yn = "Notice-module_actions", bn = "Notice-module_icon", In = "Notice-module_dismissible", J = {
|
|
724
|
+
container: vn,
|
|
725
|
+
containerWithIcon: wn,
|
|
726
|
+
content: Ln,
|
|
727
|
+
actions: yn,
|
|
728
|
+
icon: bn,
|
|
729
|
+
dismissible: In
|
|
712
730
|
};
|
|
713
|
-
function
|
|
731
|
+
function ge({
|
|
714
732
|
icon: e,
|
|
715
733
|
message: t,
|
|
716
734
|
action: a,
|
|
717
|
-
dismissible:
|
|
735
|
+
dismissible: r = !0,
|
|
718
736
|
onDismiss: s,
|
|
719
|
-
className:
|
|
720
|
-
status:
|
|
737
|
+
className: i,
|
|
738
|
+
status: c
|
|
721
739
|
}) {
|
|
722
|
-
return /* @__PURE__ */
|
|
740
|
+
return /* @__PURE__ */ I(
|
|
723
741
|
"div",
|
|
724
742
|
{
|
|
725
743
|
"data-slot": "notice",
|
|
726
|
-
className:
|
|
744
|
+
className: U(
|
|
727
745
|
J.container,
|
|
728
746
|
{
|
|
729
747
|
[J.containerWithIcon]: !!e,
|
|
730
|
-
[J.isSuccess]:
|
|
731
|
-
[J.isWarning]:
|
|
732
|
-
[J.isError]:
|
|
748
|
+
[J.isSuccess]: c === "success",
|
|
749
|
+
[J.isWarning]: c === "warning",
|
|
750
|
+
[J.isError]: c === "error"
|
|
733
751
|
},
|
|
734
|
-
|
|
752
|
+
i
|
|
735
753
|
),
|
|
736
754
|
children: [
|
|
737
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ I("div", { className: J.content, children: [
|
|
738
756
|
e && /* @__PURE__ */ n("div", { className: J.icon, children: e }),
|
|
739
757
|
/* @__PURE__ */ n("span", { children: t })
|
|
740
758
|
] }),
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
a && /* @__PURE__ */ n(
|
|
743
|
-
|
|
744
|
-
|
|
759
|
+
/* @__PURE__ */ I("div", { className: J.actions, children: [
|
|
760
|
+
a && /* @__PURE__ */ n(X, { onClick: a.onClick, variant: "link", children: a.label }),
|
|
761
|
+
r && s && /* @__PURE__ */ n(
|
|
762
|
+
X,
|
|
745
763
|
{
|
|
746
764
|
className: J.dismissible,
|
|
747
765
|
onClick: s,
|
|
748
766
|
variant: "ghost",
|
|
749
767
|
size: "sm",
|
|
750
|
-
icon: /* @__PURE__ */ n(
|
|
768
|
+
icon: /* @__PURE__ */ n(pe, {})
|
|
751
769
|
}
|
|
752
770
|
)
|
|
753
771
|
] })
|
|
@@ -755,99 +773,99 @@ function he({
|
|
|
755
773
|
}
|
|
756
774
|
);
|
|
757
775
|
}
|
|
758
|
-
const
|
|
759
|
-
container:
|
|
776
|
+
const Tn = "ChatFooter-module_container", Kt = {
|
|
777
|
+
container: Tn
|
|
760
778
|
};
|
|
761
|
-
function
|
|
779
|
+
function _n({
|
|
762
780
|
inputValue: e,
|
|
763
781
|
onInputChange: t,
|
|
764
782
|
onSubmit: a,
|
|
765
|
-
onKeyDown:
|
|
783
|
+
onKeyDown: r,
|
|
766
784
|
textareaRef: s,
|
|
767
|
-
placeholder:
|
|
768
|
-
isProcessing:
|
|
769
|
-
onStop:
|
|
785
|
+
placeholder: i,
|
|
786
|
+
isProcessing: c,
|
|
787
|
+
onStop: h,
|
|
770
788
|
fromCompact: u = !1,
|
|
771
789
|
onExpand: m,
|
|
772
|
-
disabled:
|
|
773
|
-
notice:
|
|
774
|
-
suggestions:
|
|
775
|
-
clearSuggestions:
|
|
776
|
-
focusOnMount:
|
|
777
|
-
customActions:
|
|
790
|
+
disabled: p,
|
|
791
|
+
notice: g,
|
|
792
|
+
suggestions: w,
|
|
793
|
+
clearSuggestions: _,
|
|
794
|
+
focusOnMount: y,
|
|
795
|
+
customActions: S,
|
|
778
796
|
actionOrder: O
|
|
779
797
|
}) {
|
|
780
|
-
const
|
|
781
|
-
(
|
|
782
|
-
t(
|
|
798
|
+
const H = d(
|
|
799
|
+
(A) => {
|
|
800
|
+
t(A), _ == null || _();
|
|
783
801
|
},
|
|
784
|
-
[t,
|
|
802
|
+
[t, _]
|
|
785
803
|
);
|
|
786
|
-
return /* @__PURE__ */
|
|
787
|
-
|
|
804
|
+
return /* @__PURE__ */ I(
|
|
805
|
+
P.div,
|
|
788
806
|
{
|
|
789
807
|
"data-slot": "chat-footer",
|
|
790
|
-
className:
|
|
808
|
+
className: Kt.container,
|
|
791
809
|
initial: { opacity: 0, scale: 1 },
|
|
792
810
|
animate: { opacity: 1, scale: 1 },
|
|
793
|
-
transition: { ...
|
|
811
|
+
transition: { ...dt },
|
|
794
812
|
children: [
|
|
795
813
|
!e && /* @__PURE__ */ n(
|
|
796
|
-
|
|
814
|
+
jt,
|
|
797
815
|
{
|
|
798
|
-
suggestions:
|
|
799
|
-
onSubmit:
|
|
816
|
+
suggestions: w,
|
|
817
|
+
onSubmit: H
|
|
800
818
|
}
|
|
801
819
|
),
|
|
802
|
-
|
|
803
|
-
|
|
820
|
+
g && /* @__PURE__ */ n(
|
|
821
|
+
ge,
|
|
804
822
|
{
|
|
805
|
-
icon:
|
|
806
|
-
message:
|
|
807
|
-
action:
|
|
808
|
-
dismissible:
|
|
809
|
-
onDismiss:
|
|
823
|
+
icon: g.icon,
|
|
824
|
+
message: g.message,
|
|
825
|
+
action: g.action,
|
|
826
|
+
dismissible: g.dismissible,
|
|
827
|
+
onDismiss: g.onDismiss
|
|
810
828
|
}
|
|
811
829
|
),
|
|
812
830
|
/* @__PURE__ */ n(
|
|
813
|
-
|
|
831
|
+
Xt,
|
|
814
832
|
{
|
|
815
833
|
value: e,
|
|
816
834
|
onChange: t,
|
|
817
835
|
onSubmit: a,
|
|
818
|
-
onKeyDown:
|
|
836
|
+
onKeyDown: r,
|
|
819
837
|
textareaRef: s,
|
|
820
|
-
placeholder:
|
|
821
|
-
isProcessing:
|
|
822
|
-
onStop:
|
|
838
|
+
placeholder: i,
|
|
839
|
+
isProcessing: c,
|
|
840
|
+
onStop: h,
|
|
823
841
|
fromCompact: u,
|
|
824
842
|
onExpand: m,
|
|
825
843
|
showExpandButton: !1,
|
|
826
|
-
focusOnMount:
|
|
827
|
-
customActions:
|
|
844
|
+
focusOnMount: y,
|
|
845
|
+
customActions: S,
|
|
828
846
|
actionOrder: O,
|
|
829
|
-
disabled:
|
|
847
|
+
disabled: p
|
|
830
848
|
}
|
|
831
849
|
)
|
|
832
850
|
]
|
|
833
851
|
}
|
|
834
852
|
);
|
|
835
853
|
}
|
|
836
|
-
const
|
|
837
|
-
container:
|
|
854
|
+
const Sn = "MessageActions-module_container", te = {
|
|
855
|
+
container: Sn
|
|
838
856
|
};
|
|
839
|
-
function
|
|
857
|
+
function ee({ message: e }) {
|
|
840
858
|
return !e.actions || e.actions.length === 0 ? null : /* @__PURE__ */ n(
|
|
841
859
|
"div",
|
|
842
860
|
{
|
|
843
|
-
className:
|
|
861
|
+
className: te.container,
|
|
844
862
|
"data-visible": "true",
|
|
845
863
|
role: "toolbar",
|
|
846
864
|
"aria-label": "Message actions",
|
|
847
865
|
children: e.actions.map((t) => /* @__PURE__ */ n(
|
|
848
|
-
|
|
866
|
+
X,
|
|
849
867
|
{
|
|
850
|
-
className:
|
|
868
|
+
className: te.button,
|
|
851
869
|
icon: t.icon,
|
|
852
870
|
onClick: () => t.onClick(e),
|
|
853
871
|
variant: "ghost",
|
|
@@ -865,110 +883,125 @@ function Jt({ message: e }) {
|
|
|
865
883
|
}
|
|
866
884
|
);
|
|
867
885
|
}
|
|
868
|
-
const
|
|
869
|
-
message:
|
|
870
|
-
user:
|
|
871
|
-
bubble:
|
|
872
|
-
error:
|
|
873
|
-
content:
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
886
|
+
const En = "Message-module_message", An = "Message-module_user", xn = "Message-module_bubble", Rn = "Message-module_error", Dn = "Message-module_content", On = "Message-module_disabled", Tt = {
|
|
887
|
+
message: En,
|
|
888
|
+
user: An,
|
|
889
|
+
bubble: xn,
|
|
890
|
+
error: Rn,
|
|
891
|
+
content: Dn,
|
|
892
|
+
disabled: On
|
|
893
|
+
}, Nn = ae.forwardRef(
|
|
894
|
+
function({ message: t, messageRenderer: a = He }, r) {
|
|
895
|
+
const s = () => /* @__PURE__ */ n(Ht, { children: t.content.map((i, c) => {
|
|
896
|
+
if (i.type === "text" && i.text)
|
|
897
|
+
return /* @__PURE__ */ n(a, { children: i.text }, c);
|
|
898
|
+
if (i.type === "component" && i.component) {
|
|
899
|
+
const h = i.component;
|
|
881
900
|
return /* @__PURE__ */ n(
|
|
882
|
-
|
|
901
|
+
h,
|
|
883
902
|
{
|
|
884
|
-
...
|
|
903
|
+
...i.componentProps || {}
|
|
885
904
|
},
|
|
886
|
-
|
|
905
|
+
c
|
|
887
906
|
);
|
|
888
907
|
}
|
|
889
908
|
return null;
|
|
890
909
|
}) });
|
|
891
|
-
return /* @__PURE__ */
|
|
892
|
-
|
|
910
|
+
return /* @__PURE__ */ I(
|
|
911
|
+
P.div,
|
|
893
912
|
{
|
|
894
|
-
ref:
|
|
895
|
-
variants:
|
|
913
|
+
ref: r,
|
|
914
|
+
variants: le,
|
|
896
915
|
initial: "hidden",
|
|
897
916
|
animate: "visible",
|
|
898
917
|
"data-slot": "message",
|
|
899
918
|
"data-role": t.role,
|
|
900
|
-
className:
|
|
919
|
+
className: U(
|
|
920
|
+
Tt.message,
|
|
921
|
+
Tt[t.role],
|
|
922
|
+
t.disabled ? Tt.disabled : void 0
|
|
923
|
+
),
|
|
901
924
|
children: [
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
925
|
+
/* @__PURE__ */ I(
|
|
926
|
+
"div",
|
|
927
|
+
{
|
|
928
|
+
className: Tt.content,
|
|
929
|
+
title: t.disabled ? ut(
|
|
930
|
+
"This action is no longer available or cannot be performed",
|
|
931
|
+
"a8c-agenttic"
|
|
932
|
+
) : void 0,
|
|
933
|
+
children: [
|
|
934
|
+
/* @__PURE__ */ n("div", { className: Tt.bubble, children: s() }),
|
|
935
|
+
t.role !== "user" && /* @__PURE__ */ n(ee, { message: t })
|
|
936
|
+
]
|
|
937
|
+
}
|
|
938
|
+
),
|
|
939
|
+
t.role === "user" && /* @__PURE__ */ n(ee, { message: t })
|
|
907
940
|
]
|
|
908
941
|
}
|
|
909
942
|
);
|
|
910
943
|
}
|
|
911
|
-
),
|
|
912
|
-
container:
|
|
913
|
-
emptyState:
|
|
914
|
-
},
|
|
915
|
-
container:
|
|
916
|
-
icon:
|
|
917
|
-
content:
|
|
918
|
-
},
|
|
919
|
-
|
|
944
|
+
), Mn = "Messages-module_container", Pn = "Messages-module_emptyState", Gt = {
|
|
945
|
+
container: Mn,
|
|
946
|
+
emptyState: Pn
|
|
947
|
+
}, Vn = "Thinking-module_container", Hn = "Thinking-module_icon", $n = "Thinking-module_content", Zt = {
|
|
948
|
+
container: Vn,
|
|
949
|
+
icon: Hn,
|
|
950
|
+
content: $n
|
|
951
|
+
}, Fn = Me(
|
|
952
|
+
ae.forwardRef(
|
|
920
953
|
function({ content: t = "Thinking…" }, a) {
|
|
921
|
-
const
|
|
922
|
-
return /* @__PURE__ */
|
|
954
|
+
const r = Pe(() => /* @__PURE__ */ n(ue, {}), []);
|
|
955
|
+
return /* @__PURE__ */ I(
|
|
923
956
|
"div",
|
|
924
957
|
{
|
|
925
958
|
ref: a,
|
|
926
959
|
"data-slot": "thinking",
|
|
927
|
-
className:
|
|
960
|
+
className: Zt.container,
|
|
928
961
|
children: [
|
|
929
|
-
/* @__PURE__ */ n("div", { className:
|
|
930
|
-
/* @__PURE__ */ n("span", { className:
|
|
962
|
+
/* @__PURE__ */ n("div", { className: Zt.icon, children: r }),
|
|
963
|
+
/* @__PURE__ */ n("span", { className: Zt.content, children: t })
|
|
931
964
|
]
|
|
932
965
|
}
|
|
933
966
|
);
|
|
934
967
|
}
|
|
935
968
|
)
|
|
936
969
|
);
|
|
937
|
-
function
|
|
970
|
+
function ve({
|
|
938
971
|
messages: e,
|
|
939
972
|
isProcessing: t,
|
|
940
973
|
error: a,
|
|
941
|
-
emptyView:
|
|
974
|
+
emptyView: r,
|
|
942
975
|
messageRenderer: s,
|
|
943
|
-
className:
|
|
976
|
+
className: i
|
|
944
977
|
}) {
|
|
945
|
-
const
|
|
978
|
+
const c = L(null), h = L([]), u = L(!0), m = L(null);
|
|
946
979
|
return E(() => {
|
|
947
|
-
const
|
|
948
|
-
if (u.current && e.length > 0 &&
|
|
949
|
-
top:
|
|
980
|
+
const p = e.length > h.current.length;
|
|
981
|
+
if (u.current && e.length > 0 && c.current ? c.current.scrollTop = c.current.scrollHeight : p && !u.current && c.current && c.current.scrollTo({
|
|
982
|
+
top: c.current.scrollHeight,
|
|
950
983
|
behavior: "smooth"
|
|
951
|
-
}),
|
|
952
|
-
const
|
|
953
|
-
|
|
984
|
+
}), p && m.current) {
|
|
985
|
+
const w = e.slice(
|
|
986
|
+
h.current.length
|
|
954
987
|
).filter(
|
|
955
|
-
(
|
|
988
|
+
(_) => _.role === "agent"
|
|
956
989
|
);
|
|
957
|
-
if (
|
|
958
|
-
const
|
|
959
|
-
|
|
990
|
+
if (w.length > 0) {
|
|
991
|
+
const y = w[w.length - 1].content.filter((S) => S.type === "text").map((S) => S.text).join(" ");
|
|
992
|
+
y && (m.current.textContent = y);
|
|
960
993
|
}
|
|
961
994
|
}
|
|
962
|
-
u.current && (u.current = !1),
|
|
963
|
-
}, [e]), e.length === 0 ?
|
|
995
|
+
u.current && (u.current = !1), h.current = e;
|
|
996
|
+
}, [e]), e.length === 0 ? r ? /* @__PURE__ */ n(
|
|
964
997
|
"div",
|
|
965
998
|
{
|
|
966
999
|
"data-slot": "messages",
|
|
967
|
-
className: `${
|
|
968
|
-
ref:
|
|
969
|
-
children:
|
|
1000
|
+
className: `${Gt.container} ${Gt.emptyState}`,
|
|
1001
|
+
ref: c,
|
|
1002
|
+
children: r
|
|
970
1003
|
}
|
|
971
|
-
) : null : /* @__PURE__ */
|
|
1004
|
+
) : null : /* @__PURE__ */ I(Ht, { children: [
|
|
972
1005
|
/* @__PURE__ */ n(
|
|
973
1006
|
"div",
|
|
974
1007
|
{
|
|
@@ -988,18 +1021,18 @@ function pe({
|
|
|
988
1021
|
"div",
|
|
989
1022
|
{
|
|
990
1023
|
"data-slot": "messages",
|
|
991
|
-
className:
|
|
992
|
-
ref:
|
|
993
|
-
children: /* @__PURE__ */
|
|
994
|
-
e.map((
|
|
995
|
-
|
|
1024
|
+
className: Gt.container,
|
|
1025
|
+
ref: c,
|
|
1026
|
+
children: /* @__PURE__ */ I(At, { mode: "popLayout", children: [
|
|
1027
|
+
e.map((p) => /* @__PURE__ */ n(
|
|
1028
|
+
Nn,
|
|
996
1029
|
{
|
|
997
|
-
message:
|
|
1030
|
+
message: p,
|
|
998
1031
|
messageRenderer: s
|
|
999
1032
|
},
|
|
1000
|
-
|
|
1033
|
+
p.id
|
|
1001
1034
|
)),
|
|
1002
|
-
t && /* @__PURE__ */ n(
|
|
1035
|
+
t && /* @__PURE__ */ n(Fn, {}),
|
|
1003
1036
|
a && /* @__PURE__ */ n(
|
|
1004
1037
|
"div",
|
|
1005
1038
|
{
|
|
@@ -1017,83 +1050,83 @@ function pe({
|
|
|
1017
1050
|
)
|
|
1018
1051
|
] });
|
|
1019
1052
|
}
|
|
1020
|
-
const
|
|
1021
|
-
container:
|
|
1022
|
-
withHeader:
|
|
1053
|
+
const kn = "ConversationView-module_container", Un = "ConversationView-module_withHeader", Et = {
|
|
1054
|
+
container: kn,
|
|
1055
|
+
withHeader: Un
|
|
1023
1056
|
};
|
|
1024
|
-
function
|
|
1057
|
+
function ne({
|
|
1025
1058
|
messages: e,
|
|
1026
1059
|
error: t,
|
|
1027
1060
|
inputValue: a,
|
|
1028
|
-
onInputChange:
|
|
1061
|
+
onInputChange: r,
|
|
1029
1062
|
onSubmit: s,
|
|
1030
|
-
onKeyDown:
|
|
1031
|
-
textareaRef:
|
|
1032
|
-
placeholder:
|
|
1063
|
+
onKeyDown: i,
|
|
1064
|
+
textareaRef: c,
|
|
1065
|
+
placeholder: h,
|
|
1033
1066
|
isProcessing: u,
|
|
1034
1067
|
onStop: m,
|
|
1035
|
-
fromCompact:
|
|
1036
|
-
showHeader:
|
|
1037
|
-
onClose:
|
|
1038
|
-
onExpand:
|
|
1039
|
-
notice:
|
|
1040
|
-
emptyView:
|
|
1068
|
+
fromCompact: p = !1,
|
|
1069
|
+
showHeader: g = !1,
|
|
1070
|
+
onClose: w,
|
|
1071
|
+
onExpand: _,
|
|
1072
|
+
notice: y,
|
|
1073
|
+
emptyView: S,
|
|
1041
1074
|
suggestions: O,
|
|
1042
|
-
clearSuggestions:
|
|
1043
|
-
messageRenderer:
|
|
1044
|
-
focusOnMount:
|
|
1075
|
+
clearSuggestions: H,
|
|
1076
|
+
messageRenderer: A,
|
|
1077
|
+
focusOnMount: $ = !1
|
|
1045
1078
|
}) {
|
|
1046
1079
|
return E(() => {
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1080
|
+
const l = (N) => {
|
|
1081
|
+
N.key === "Escape" && w && w();
|
|
1049
1082
|
};
|
|
1050
|
-
return document.addEventListener("keydown",
|
|
1051
|
-
}, [
|
|
1083
|
+
return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
|
|
1084
|
+
}, [w]), /* @__PURE__ */ I(
|
|
1052
1085
|
"div",
|
|
1053
1086
|
{
|
|
1054
1087
|
"data-slot": "conversation-view",
|
|
1055
|
-
className: `${
|
|
1088
|
+
className: `${Et.container}${g ? ` ${Et.withHeader}` : ""}`,
|
|
1056
1089
|
children: [
|
|
1057
|
-
|
|
1090
|
+
g && /* @__PURE__ */ n(Ce, { onClose: w }),
|
|
1058
1091
|
/* @__PURE__ */ n(
|
|
1059
|
-
|
|
1092
|
+
ve,
|
|
1060
1093
|
{
|
|
1061
1094
|
messages: e,
|
|
1062
1095
|
isProcessing: u,
|
|
1063
1096
|
error: t,
|
|
1064
|
-
emptyView:
|
|
1065
|
-
messageRenderer:
|
|
1097
|
+
emptyView: S,
|
|
1098
|
+
messageRenderer: A
|
|
1066
1099
|
}
|
|
1067
1100
|
),
|
|
1068
1101
|
/* @__PURE__ */ n(
|
|
1069
|
-
|
|
1102
|
+
_n,
|
|
1070
1103
|
{
|
|
1071
1104
|
inputValue: a,
|
|
1072
|
-
onInputChange:
|
|
1105
|
+
onInputChange: r,
|
|
1073
1106
|
onSubmit: s,
|
|
1074
|
-
onKeyDown:
|
|
1075
|
-
textareaRef:
|
|
1076
|
-
placeholder:
|
|
1107
|
+
onKeyDown: i,
|
|
1108
|
+
textareaRef: c,
|
|
1109
|
+
placeholder: h,
|
|
1077
1110
|
isProcessing: u,
|
|
1078
1111
|
onStop: m,
|
|
1079
|
-
fromCompact:
|
|
1080
|
-
onExpand:
|
|
1081
|
-
notice:
|
|
1112
|
+
fromCompact: p,
|
|
1113
|
+
onExpand: _,
|
|
1114
|
+
notice: y,
|
|
1082
1115
|
suggestions: O,
|
|
1083
|
-
clearSuggestions:
|
|
1084
|
-
focusOnMount:
|
|
1116
|
+
clearSuggestions: H,
|
|
1117
|
+
focusOnMount: $
|
|
1085
1118
|
}
|
|
1086
1119
|
)
|
|
1087
1120
|
]
|
|
1088
1121
|
}
|
|
1089
1122
|
);
|
|
1090
1123
|
}
|
|
1091
|
-
const
|
|
1092
|
-
container:
|
|
1093
|
-
embedded:
|
|
1094
|
-
floating:
|
|
1095
|
-
content:
|
|
1096
|
-
},
|
|
1124
|
+
const Wn = "Chat-module_container", Bn = "Chat-module_embedded", Gn = "Chat-module_floating", Zn = "Chat-module_content", K = {
|
|
1125
|
+
container: Wn,
|
|
1126
|
+
embedded: Bn,
|
|
1127
|
+
floating: Gn,
|
|
1128
|
+
content: Zn
|
|
1129
|
+
}, x = {
|
|
1097
1130
|
COLLAPSED_SIZE: 56,
|
|
1098
1131
|
COMPACT_WIDTH: 372,
|
|
1099
1132
|
EXPANDED_HEIGHT: 520,
|
|
@@ -1101,7 +1134,7 @@ const Hn = "Chat-module_container", $n = "Chat-module_embedded", Fn = "Chat-modu
|
|
|
1101
1134
|
BORDER_RADIUS: 24,
|
|
1102
1135
|
PADDING: 16,
|
|
1103
1136
|
VIEWPORT_OFFSET: 16
|
|
1104
|
-
},
|
|
1137
|
+
}, _t = {
|
|
1105
1138
|
SPRING_CONFIG: {
|
|
1106
1139
|
type: "spring",
|
|
1107
1140
|
damping: 25,
|
|
@@ -1114,266 +1147,266 @@ const Hn = "Chat-module_container", $n = "Chat-module_embedded", Fn = "Chat-modu
|
|
|
1114
1147
|
'[data-slot="chat-footer"]'
|
|
1115
1148
|
].join(", ")
|
|
1116
1149
|
};
|
|
1117
|
-
function
|
|
1150
|
+
function eo({
|
|
1118
1151
|
messages: e,
|
|
1119
1152
|
isProcessing: t,
|
|
1120
1153
|
error: a,
|
|
1121
|
-
onSubmit:
|
|
1154
|
+
onSubmit: r,
|
|
1122
1155
|
variant: s = "floating",
|
|
1123
|
-
triggerIcon:
|
|
1124
|
-
placeholder:
|
|
1125
|
-
notice:
|
|
1156
|
+
triggerIcon: i,
|
|
1157
|
+
placeholder: c = ce,
|
|
1158
|
+
notice: h,
|
|
1126
1159
|
onOpen: u,
|
|
1127
1160
|
onExpand: m,
|
|
1128
|
-
onClose:
|
|
1129
|
-
onStop:
|
|
1130
|
-
emptyView:
|
|
1131
|
-
floatingChatState:
|
|
1132
|
-
suggestions:
|
|
1133
|
-
clearSuggestions:
|
|
1161
|
+
onClose: p,
|
|
1162
|
+
onStop: g,
|
|
1163
|
+
emptyView: w,
|
|
1164
|
+
floatingChatState: _,
|
|
1165
|
+
suggestions: y,
|
|
1166
|
+
clearSuggestions: S,
|
|
1134
1167
|
messageRenderer: O,
|
|
1135
|
-
className:
|
|
1168
|
+
className: H
|
|
1136
1169
|
}) {
|
|
1137
|
-
const [
|
|
1170
|
+
const [A, $] = k(""), l = re(_), N = L(!1), ft = L(!1), B = L(!1), [et, G] = k(!1);
|
|
1138
1171
|
E(() => {
|
|
1139
|
-
|
|
1140
|
-
}, [
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1172
|
+
N.current = !1, ft.current = !1, B.current = !1;
|
|
1173
|
+
}, [l.state]);
|
|
1174
|
+
const M = L(/* @__PURE__ */ new Set()), nt = d(() => {
|
|
1175
|
+
M.current.forEach((C) => {
|
|
1143
1176
|
clearTimeout(C);
|
|
1144
|
-
}),
|
|
1145
|
-
}, []),
|
|
1146
|
-
value:
|
|
1147
|
-
setValue:
|
|
1177
|
+
}), M.current.clear();
|
|
1178
|
+
}, []), o = se({
|
|
1179
|
+
value: A,
|
|
1180
|
+
setValue: $,
|
|
1148
1181
|
onSubmit: async (C) => {
|
|
1149
|
-
|
|
1182
|
+
l.state !== "expanded" && (m == null || m()), l.setState("expanded"), await r(C);
|
|
1150
1183
|
},
|
|
1151
1184
|
isProcessing: t
|
|
1152
|
-
}), [
|
|
1185
|
+
}), [ot, T] = k(56), [at, Ft] = k(
|
|
1153
1186
|
"left"
|
|
1154
|
-
),
|
|
1155
|
-
|
|
1156
|
-
}, [
|
|
1157
|
-
var
|
|
1158
|
-
const C = (
|
|
1159
|
-
return !(C && ((
|
|
1160
|
-
}, [
|
|
1161
|
-
if (
|
|
1187
|
+
), ht = L(null), pt = L(null), Z = L(null), V = Mt(0), Q = Mt(0), v = ie(), xt = d(() => {
|
|
1188
|
+
N.current = !0, l.open(), u == null || u();
|
|
1189
|
+
}, [l, u]), it = d(() => {
|
|
1190
|
+
var R, F, j;
|
|
1191
|
+
const C = (F = (R = Z.current) == null ? void 0 : R.ownerDocument) == null ? void 0 : F.activeElement;
|
|
1192
|
+
return !(C && ((j = Z.current) != null && j.contains(C)) || A.trim());
|
|
1193
|
+
}, [A, Z]), wt = (C) => C === "collapsed" ? x.COLLAPSED_SIZE : C === "compact" ? ot : x.EXPANDED_HEIGHT, kt = d(() => {
|
|
1194
|
+
if (l.state === "collapsed" && (l.setState("compact"), l.initialState === "collapsed")) {
|
|
1162
1195
|
const C = setTimeout(() => {
|
|
1163
|
-
|
|
1164
|
-
},
|
|
1165
|
-
|
|
1196
|
+
l.state === "compact" && it() && l.setState("collapsed"), M.current.delete(C);
|
|
1197
|
+
}, x.AUTO_COLLAPSE_DELAY);
|
|
1198
|
+
M.current.add(C);
|
|
1166
1199
|
}
|
|
1167
|
-
}, [
|
|
1168
|
-
if (
|
|
1200
|
+
}, [l, it]), Ct = d(() => {
|
|
1201
|
+
if (l.initialState === "collapsed" && l.state === "compact" && it()) {
|
|
1169
1202
|
const C = setTimeout(() => {
|
|
1170
|
-
|
|
1171
|
-
},
|
|
1172
|
-
|
|
1203
|
+
l.state === "compact" && it() && l.setState("collapsed"), M.current.delete(C);
|
|
1204
|
+
}, x.AUTO_COLLAPSE_DELAY);
|
|
1205
|
+
M.current.add(C);
|
|
1173
1206
|
}
|
|
1174
|
-
}, [
|
|
1175
|
-
if (
|
|
1176
|
-
const C =
|
|
1177
|
-
|
|
1207
|
+
}, [l, it]), tt = d(async () => {
|
|
1208
|
+
if (o.value.trim()) {
|
|
1209
|
+
const C = o.value.trim();
|
|
1210
|
+
o.clear(), l.state !== "expanded" && (m == null || m()), l.setState("expanded"), await r(C);
|
|
1178
1211
|
}
|
|
1179
|
-
}, [
|
|
1180
|
-
|
|
1181
|
-
}, [m,
|
|
1182
|
-
|
|
1183
|
-
}, [
|
|
1212
|
+
}, [o, r, l, m]), W = d(() => {
|
|
1213
|
+
B.current = !0, m == null || m(), l.setState("expanded");
|
|
1214
|
+
}, [m, l]), rt = d(() => {
|
|
1215
|
+
ft.current = !0, o.clear(), l.close(), p && p();
|
|
1216
|
+
}, [o, l, p]), Y = d(
|
|
1184
1217
|
(C) => {
|
|
1185
|
-
if (!
|
|
1218
|
+
if (!Z.current || !pt.current)
|
|
1186
1219
|
return null;
|
|
1187
|
-
const
|
|
1220
|
+
const R = Z.current.getBoundingClientRect(), F = pt.current.getBoundingClientRect(), j = window.getComputedStyle(Z.current), ct = new DOMMatrixReadOnly(j.transform), Dt = R.x - ct.e, z = R.y - ct.f, Ut = (C ?? at) === "left" ? F.left : F.right - x.COMPACT_WIDTH, Wt = F.bottom - x.EXPANDED_HEIGHT;
|
|
1188
1221
|
return {
|
|
1189
|
-
x:
|
|
1190
|
-
y:
|
|
1222
|
+
x: Ut - Dt,
|
|
1223
|
+
y: Wt - z
|
|
1191
1224
|
};
|
|
1192
1225
|
},
|
|
1193
|
-
[
|
|
1194
|
-
),
|
|
1226
|
+
[at]
|
|
1227
|
+
), Lt = d(
|
|
1195
1228
|
(C) => {
|
|
1196
1229
|
C.target.closest(
|
|
1197
|
-
|
|
1198
|
-
) ||
|
|
1230
|
+
_t.NON_DRAGGABLE_SELECTORS
|
|
1231
|
+
) || v.start(C.nativeEvent);
|
|
1199
1232
|
},
|
|
1200
|
-
[
|
|
1201
|
-
),
|
|
1202
|
-
(C,
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
...
|
|
1208
|
-
velocity:
|
|
1209
|
-
}), Pt(
|
|
1210
|
-
...
|
|
1211
|
-
velocity:
|
|
1233
|
+
[v]
|
|
1234
|
+
), Rt = d(
|
|
1235
|
+
(C, R) => {
|
|
1236
|
+
const F = R.point.x, j = x.COMPACT_WIDTH, ct = (window.innerWidth - j) / 2, z = F < ct ? "left" : "right";
|
|
1237
|
+
Ft(z);
|
|
1238
|
+
const gt = Y(z);
|
|
1239
|
+
gt && (Pt(V, gt.x, {
|
|
1240
|
+
..._t.SPRING_CONFIG,
|
|
1241
|
+
velocity: R.velocity.x * _t.VELOCITY_MULTIPLIER
|
|
1242
|
+
}), Pt(Q, gt.y, {
|
|
1243
|
+
..._t.SPRING_CONFIG,
|
|
1244
|
+
velocity: R.velocity.y * _t.VELOCITY_MULTIPLIER
|
|
1212
1245
|
}));
|
|
1213
1246
|
},
|
|
1214
|
-
[
|
|
1215
|
-
),
|
|
1247
|
+
[V, Q, Y]
|
|
1248
|
+
), yt = L(l.state), st = yt.current === "compact" && l.state === "expanded";
|
|
1216
1249
|
return E(() => {
|
|
1217
|
-
|
|
1218
|
-
}, [
|
|
1219
|
-
if (
|
|
1250
|
+
nt(), yt.current = l.state;
|
|
1251
|
+
}, [l.state, nt]), E(() => {
|
|
1252
|
+
if (l.state !== "expanded")
|
|
1220
1253
|
return;
|
|
1221
1254
|
const C = () => {
|
|
1222
|
-
const
|
|
1223
|
-
|
|
1255
|
+
const R = Y();
|
|
1256
|
+
R && (V.set(R.x), Q.set(R.y));
|
|
1224
1257
|
};
|
|
1225
1258
|
return window.addEventListener("resize", C), () => window.removeEventListener("resize", C);
|
|
1226
|
-
}, [
|
|
1227
|
-
const C =
|
|
1259
|
+
}, [l.state, V, Q, Y]), E(() => {
|
|
1260
|
+
const C = M.current;
|
|
1228
1261
|
return () => {
|
|
1229
|
-
C.forEach((
|
|
1230
|
-
clearTimeout(
|
|
1262
|
+
C.forEach((R) => {
|
|
1263
|
+
clearTimeout(R);
|
|
1231
1264
|
}), C.clear();
|
|
1232
1265
|
};
|
|
1233
1266
|
}, []), E(() => {
|
|
1234
|
-
if (
|
|
1235
|
-
const C =
|
|
1236
|
-
|
|
1267
|
+
if (l.state === "compact" && ht.current) {
|
|
1268
|
+
const C = ht.current.scrollHeight + x.PADDING;
|
|
1269
|
+
T(C);
|
|
1237
1270
|
}
|
|
1238
|
-
}, [
|
|
1271
|
+
}, [l.state, o.value]), s === "embedded" ? /* @__PURE__ */ n(
|
|
1239
1272
|
"div",
|
|
1240
1273
|
{
|
|
1241
1274
|
"data-slot": "chat-embedded",
|
|
1242
|
-
className:
|
|
1275
|
+
className: U(H, K.container, K.embedded),
|
|
1243
1276
|
children: /* @__PURE__ */ n(
|
|
1244
|
-
|
|
1277
|
+
ne,
|
|
1245
1278
|
{
|
|
1246
1279
|
messages: e,
|
|
1247
|
-
inputValue:
|
|
1248
|
-
onInputChange:
|
|
1249
|
-
onSubmit:
|
|
1250
|
-
onKeyDown:
|
|
1251
|
-
textareaRef:
|
|
1252
|
-
placeholder:
|
|
1280
|
+
inputValue: o.value,
|
|
1281
|
+
onInputChange: o.setValue,
|
|
1282
|
+
onSubmit: tt,
|
|
1283
|
+
onKeyDown: o.handleKeyDown,
|
|
1284
|
+
textareaRef: o.textareaRef,
|
|
1285
|
+
placeholder: c,
|
|
1253
1286
|
isProcessing: t,
|
|
1254
|
-
onStop:
|
|
1287
|
+
onStop: g,
|
|
1255
1288
|
showHeader: !1,
|
|
1256
|
-
notice:
|
|
1257
|
-
suggestions:
|
|
1258
|
-
clearSuggestions:
|
|
1289
|
+
notice: h,
|
|
1290
|
+
suggestions: y,
|
|
1291
|
+
clearSuggestions: S,
|
|
1259
1292
|
error: a,
|
|
1260
|
-
emptyView:
|
|
1293
|
+
emptyView: w,
|
|
1261
1294
|
messageRenderer: O,
|
|
1262
|
-
onExpand:
|
|
1263
|
-
focusOnMount:
|
|
1295
|
+
onExpand: W,
|
|
1296
|
+
focusOnMount: B.current
|
|
1264
1297
|
}
|
|
1265
1298
|
)
|
|
1266
1299
|
}
|
|
1267
|
-
) : /* @__PURE__ */
|
|
1300
|
+
) : /* @__PURE__ */ I(Ht, { children: [
|
|
1268
1301
|
/* @__PURE__ */ n(
|
|
1269
1302
|
"div",
|
|
1270
1303
|
{
|
|
1271
|
-
ref:
|
|
1304
|
+
ref: pt,
|
|
1272
1305
|
style: {
|
|
1273
1306
|
position: "fixed",
|
|
1274
|
-
top:
|
|
1275
|
-
left:
|
|
1276
|
-
right:
|
|
1277
|
-
bottom:
|
|
1307
|
+
top: x.VIEWPORT_OFFSET,
|
|
1308
|
+
left: x.VIEWPORT_OFFSET,
|
|
1309
|
+
right: x.VIEWPORT_OFFSET,
|
|
1310
|
+
bottom: x.VIEWPORT_OFFSET,
|
|
1278
1311
|
pointerEvents: "none"
|
|
1279
1312
|
}
|
|
1280
1313
|
}
|
|
1281
1314
|
),
|
|
1282
1315
|
/* @__PURE__ */ n(
|
|
1283
|
-
|
|
1316
|
+
P.div,
|
|
1284
1317
|
{
|
|
1285
|
-
ref:
|
|
1318
|
+
ref: Z,
|
|
1286
1319
|
"data-slot": "chat-floating",
|
|
1287
|
-
className:
|
|
1288
|
-
animating:
|
|
1320
|
+
className: U(H, K.container, K.floating, {
|
|
1321
|
+
animating: et
|
|
1289
1322
|
}),
|
|
1290
|
-
onMouseLeave:
|
|
1291
|
-
drag:
|
|
1292
|
-
dragControls:
|
|
1323
|
+
onMouseLeave: l.state === "compact" ? Ct : void 0,
|
|
1324
|
+
drag: l.state === "expanded",
|
|
1325
|
+
dragControls: v,
|
|
1293
1326
|
dragListener: !1,
|
|
1294
|
-
dragConstraints:
|
|
1327
|
+
dragConstraints: pt,
|
|
1295
1328
|
dragMomentum: !1,
|
|
1296
1329
|
dragElastic: 0.1,
|
|
1297
1330
|
dragTransition: { power: 0.1, timeConstant: 100 },
|
|
1298
|
-
onDragEnd:
|
|
1299
|
-
onPointerDown:
|
|
1331
|
+
onDragEnd: Rt,
|
|
1332
|
+
onPointerDown: Lt,
|
|
1300
1333
|
style: {
|
|
1301
|
-
x:
|
|
1302
|
-
y:
|
|
1303
|
-
bottom:
|
|
1304
|
-
left:
|
|
1334
|
+
x: V,
|
|
1335
|
+
y: Q,
|
|
1336
|
+
bottom: x.VIEWPORT_OFFSET,
|
|
1337
|
+
left: x.VIEWPORT_OFFSET
|
|
1305
1338
|
},
|
|
1306
1339
|
children: /* @__PURE__ */ n(
|
|
1307
|
-
|
|
1340
|
+
P.div,
|
|
1308
1341
|
{
|
|
1309
1342
|
layout: !0,
|
|
1310
|
-
className:
|
|
1343
|
+
className: K.content,
|
|
1311
1344
|
initial: !1,
|
|
1312
1345
|
animate: {
|
|
1313
|
-
width:
|
|
1314
|
-
height:
|
|
1315
|
-
x:
|
|
1316
|
-
transition:
|
|
1346
|
+
width: l.state === "collapsed" ? x.COLLAPSED_SIZE : x.COMPACT_WIDTH,
|
|
1347
|
+
height: wt(l.state),
|
|
1348
|
+
x: l.state === "collapsed" && at === "right" ? x.COMPACT_WIDTH - x.COLLAPSED_SIZE : 0,
|
|
1349
|
+
transition: o.value.trim() ? { duration: 0 } : $t
|
|
1317
1350
|
},
|
|
1318
|
-
onAnimationStart: () =>
|
|
1319
|
-
onAnimationComplete: () =>
|
|
1351
|
+
onAnimationStart: () => G(!0),
|
|
1352
|
+
onAnimationComplete: () => G(!1),
|
|
1320
1353
|
style: {
|
|
1321
|
-
borderRadius:
|
|
1354
|
+
borderRadius: x.BORDER_RADIUS
|
|
1322
1355
|
},
|
|
1323
|
-
children: /* @__PURE__ */
|
|
1324
|
-
|
|
1325
|
-
|
|
1356
|
+
children: /* @__PURE__ */ I(At, { mode: "wait", children: [
|
|
1357
|
+
l.state === "collapsed" && /* @__PURE__ */ n(
|
|
1358
|
+
de,
|
|
1326
1359
|
{
|
|
1327
|
-
icon:
|
|
1328
|
-
onClick:
|
|
1329
|
-
onHover:
|
|
1330
|
-
focusOnMount:
|
|
1360
|
+
icon: i,
|
|
1361
|
+
onClick: xt,
|
|
1362
|
+
onHover: kt,
|
|
1363
|
+
focusOnMount: ft.current
|
|
1331
1364
|
},
|
|
1332
1365
|
"collapsed"
|
|
1333
1366
|
),
|
|
1334
|
-
|
|
1335
|
-
|
|
1367
|
+
l.state === "compact" && /* @__PURE__ */ n("div", { ref: ht, children: /* @__PURE__ */ n(
|
|
1368
|
+
he,
|
|
1336
1369
|
{
|
|
1337
|
-
value:
|
|
1338
|
-
onChange:
|
|
1339
|
-
onSubmit:
|
|
1340
|
-
onKeyDown:
|
|
1341
|
-
textareaRef:
|
|
1342
|
-
placeholder:
|
|
1370
|
+
value: o.value,
|
|
1371
|
+
onChange: o.setValue,
|
|
1372
|
+
onSubmit: tt,
|
|
1373
|
+
onKeyDown: o.handleKeyDown,
|
|
1374
|
+
textareaRef: o.textareaRef,
|
|
1375
|
+
placeholder: c,
|
|
1343
1376
|
isProcessing: t,
|
|
1344
|
-
onBlur:
|
|
1345
|
-
onExpand:
|
|
1346
|
-
showExpandButton: !
|
|
1347
|
-
focusOnMount:
|
|
1348
|
-
onStop:
|
|
1349
|
-
suggestions:
|
|
1350
|
-
clearSuggestions:
|
|
1377
|
+
onBlur: Ct,
|
|
1378
|
+
onExpand: W,
|
|
1379
|
+
showExpandButton: !o.value.trim(),
|
|
1380
|
+
focusOnMount: N.current,
|
|
1381
|
+
onStop: g,
|
|
1382
|
+
suggestions: y,
|
|
1383
|
+
clearSuggestions: S
|
|
1351
1384
|
},
|
|
1352
1385
|
"compact"
|
|
1353
1386
|
) }),
|
|
1354
|
-
|
|
1355
|
-
|
|
1387
|
+
l.state === "expanded" && /* @__PURE__ */ n(
|
|
1388
|
+
ne,
|
|
1356
1389
|
{
|
|
1357
1390
|
messages: e,
|
|
1358
|
-
inputValue:
|
|
1359
|
-
onInputChange:
|
|
1360
|
-
onSubmit:
|
|
1361
|
-
onKeyDown:
|
|
1362
|
-
textareaRef:
|
|
1363
|
-
placeholder:
|
|
1391
|
+
inputValue: o.value,
|
|
1392
|
+
onInputChange: o.setValue,
|
|
1393
|
+
onSubmit: tt,
|
|
1394
|
+
onKeyDown: o.handleKeyDown,
|
|
1395
|
+
textareaRef: o.textareaRef,
|
|
1396
|
+
placeholder: c,
|
|
1364
1397
|
isProcessing: t,
|
|
1365
|
-
onStop:
|
|
1398
|
+
onStop: g,
|
|
1366
1399
|
showHeader: !0,
|
|
1367
|
-
onClose:
|
|
1368
|
-
fromCompact:
|
|
1369
|
-
notice:
|
|
1370
|
-
suggestions:
|
|
1371
|
-
clearSuggestions:
|
|
1400
|
+
onClose: rt,
|
|
1401
|
+
fromCompact: st,
|
|
1402
|
+
notice: h,
|
|
1403
|
+
suggestions: y,
|
|
1404
|
+
clearSuggestions: S,
|
|
1372
1405
|
error: a,
|
|
1373
|
-
emptyView:
|
|
1406
|
+
emptyView: w,
|
|
1374
1407
|
messageRenderer: O,
|
|
1375
|
-
onExpand:
|
|
1376
|
-
focusOnMount:
|
|
1408
|
+
onExpand: W,
|
|
1409
|
+
focusOnMount: B.current
|
|
1377
1410
|
},
|
|
1378
1411
|
"expanded"
|
|
1379
1412
|
)
|
|
@@ -1384,7 +1417,7 @@ function jn({
|
|
|
1384
1417
|
)
|
|
1385
1418
|
] });
|
|
1386
1419
|
}
|
|
1387
|
-
const
|
|
1420
|
+
const D = {
|
|
1388
1421
|
COLLAPSED_SIZE: 56,
|
|
1389
1422
|
COMPACT_WIDTH: 372,
|
|
1390
1423
|
EXPANDED_HEIGHT: 520,
|
|
@@ -1392,7 +1425,7 @@ const x = {
|
|
|
1392
1425
|
BORDER_RADIUS: 24,
|
|
1393
1426
|
PADDING: 16,
|
|
1394
1427
|
VIEWPORT_OFFSET: 16
|
|
1395
|
-
},
|
|
1428
|
+
}, St = {
|
|
1396
1429
|
SPRING_CONFIG: {
|
|
1397
1430
|
type: "spring",
|
|
1398
1431
|
damping: 25,
|
|
@@ -1405,273 +1438,313 @@ const x = {
|
|
|
1405
1438
|
'[data-slot="chat-footer"]'
|
|
1406
1439
|
].join(", ")
|
|
1407
1440
|
};
|
|
1408
|
-
function
|
|
1441
|
+
function Yn() {
|
|
1442
|
+
return /* @__PURE__ */ n(
|
|
1443
|
+
"div",
|
|
1444
|
+
{
|
|
1445
|
+
style: {
|
|
1446
|
+
position: "fixed",
|
|
1447
|
+
top: 0,
|
|
1448
|
+
left: 0,
|
|
1449
|
+
right: 0,
|
|
1450
|
+
bottom: 0,
|
|
1451
|
+
zIndex: 9999,
|
|
1452
|
+
cursor: "grabbing",
|
|
1453
|
+
pointerEvents: "auto",
|
|
1454
|
+
userSelect: "none",
|
|
1455
|
+
WebkitUserSelect: "none",
|
|
1456
|
+
MozUserSelect: "none",
|
|
1457
|
+
msUserSelect: "none"
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
function we({
|
|
1409
1463
|
children: e,
|
|
1410
1464
|
messages: t,
|
|
1411
1465
|
isProcessing: a,
|
|
1412
|
-
error:
|
|
1466
|
+
error: r,
|
|
1413
1467
|
onSubmit: s,
|
|
1414
|
-
variant:
|
|
1415
|
-
triggerIcon:
|
|
1416
|
-
placeholder:
|
|
1468
|
+
variant: i = "floating",
|
|
1469
|
+
triggerIcon: c,
|
|
1470
|
+
placeholder: h,
|
|
1417
1471
|
notice: u,
|
|
1418
1472
|
onOpen: m,
|
|
1419
|
-
onExpand:
|
|
1420
|
-
onClose:
|
|
1421
|
-
onStop:
|
|
1422
|
-
emptyView:
|
|
1423
|
-
floatingChatState:
|
|
1424
|
-
suggestions:
|
|
1473
|
+
onExpand: p,
|
|
1474
|
+
onClose: g,
|
|
1475
|
+
onStop: w,
|
|
1476
|
+
emptyView: _,
|
|
1477
|
+
floatingChatState: y,
|
|
1478
|
+
suggestions: S,
|
|
1425
1479
|
clearSuggestions: O,
|
|
1426
|
-
messageRenderer:
|
|
1427
|
-
className:
|
|
1428
|
-
inputValue:
|
|
1429
|
-
onInputChange:
|
|
1430
|
-
|
|
1480
|
+
messageRenderer: H,
|
|
1481
|
+
className: A,
|
|
1482
|
+
inputValue: $,
|
|
1483
|
+
onInputChange: l,
|
|
1484
|
+
draggableStates: N = ["expanded"],
|
|
1485
|
+
// Default to only expanded for backward compatibility
|
|
1486
|
+
...ft
|
|
1431
1487
|
}) {
|
|
1432
|
-
const B =
|
|
1488
|
+
const B = $ !== void 0, [et, G] = k(""), M = B ? $ : et, nt = B ? l : G, o = re(y), ot = L(!1), T = L(!1), at = L(!1), [Ft, ht] = k(!1), [pt, Z] = k(!1);
|
|
1433
1489
|
E(() => {
|
|
1434
|
-
|
|
1435
|
-
}, [
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
clearTimeout(
|
|
1439
|
-
}),
|
|
1440
|
-
}, []),
|
|
1441
|
-
value:
|
|
1442
|
-
setValue:
|
|
1443
|
-
onSubmit: async (
|
|
1444
|
-
|
|
1490
|
+
ot.current = !1, T.current = !1, at.current = !1;
|
|
1491
|
+
}, [o.state]);
|
|
1492
|
+
const V = L(/* @__PURE__ */ new Set()), Q = d(() => {
|
|
1493
|
+
V.current.forEach((f) => {
|
|
1494
|
+
clearTimeout(f);
|
|
1495
|
+
}), V.current.clear();
|
|
1496
|
+
}, []), v = se({
|
|
1497
|
+
value: M,
|
|
1498
|
+
setValue: nt,
|
|
1499
|
+
onSubmit: async (f) => {
|
|
1500
|
+
o.state !== "expanded" && (p == null || p()), o.setState("expanded"), await s(f);
|
|
1445
1501
|
},
|
|
1446
1502
|
isProcessing: a
|
|
1447
|
-
}), [
|
|
1503
|
+
}), [xt, it] = k(56), [wt, kt] = k(
|
|
1448
1504
|
"left"
|
|
1449
|
-
),
|
|
1450
|
-
(
|
|
1451
|
-
|
|
1505
|
+
), Ct = L(null), tt = L(null), W = L(null), rt = Mt(0), Y = Mt(0), Lt = ie(), Rt = d(
|
|
1506
|
+
(f) => {
|
|
1507
|
+
const b = f.endsWith(" ") ? f : `${f} `;
|
|
1508
|
+
v.setValue(b), O == null || O(), v.textareaRef.current && (v.textareaRef.current.focus(), v.textareaRef.current.setSelectionRange(
|
|
1509
|
+
b.length,
|
|
1510
|
+
b.length
|
|
1511
|
+
));
|
|
1452
1512
|
},
|
|
1453
|
-
[
|
|
1454
|
-
),
|
|
1455
|
-
|
|
1456
|
-
}, [
|
|
1457
|
-
var
|
|
1458
|
-
const
|
|
1459
|
-
return !(
|
|
1460
|
-
}, [
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1513
|
+
[v.setValue, O]
|
|
1514
|
+
), yt = d(() => {
|
|
1515
|
+
ot.current = !0, o.open(), m == null || m();
|
|
1516
|
+
}, [o, m]), st = d(() => {
|
|
1517
|
+
var b, q, lt;
|
|
1518
|
+
const f = (q = (b = W.current) == null ? void 0 : b.ownerDocument) == null ? void 0 : q.activeElement;
|
|
1519
|
+
return !(f && ((lt = W.current) != null && lt.contains(f)) || M.trim());
|
|
1520
|
+
}, [M, W]), C = d(
|
|
1521
|
+
(f) => f === "collapsed" ? D.COLLAPSED_SIZE : f === "compact" ? xt : D.EXPANDED_HEIGHT,
|
|
1522
|
+
[xt]
|
|
1523
|
+
), R = d(() => {
|
|
1524
|
+
if (o.state === "collapsed" && (o.setState("compact"), o.initialState === "collapsed")) {
|
|
1525
|
+
const f = setTimeout(() => {
|
|
1526
|
+
o.state === "compact" && st() && o.setState("collapsed"), V.current.delete(f);
|
|
1527
|
+
}, D.AUTO_COLLAPSE_DELAY);
|
|
1528
|
+
V.current.add(f);
|
|
1466
1529
|
}
|
|
1467
|
-
}, [
|
|
1468
|
-
if (
|
|
1469
|
-
const
|
|
1470
|
-
|
|
1471
|
-
},
|
|
1472
|
-
|
|
1530
|
+
}, [o, st]), F = d(() => {
|
|
1531
|
+
if (o.initialState === "collapsed" && o.state === "compact" && st()) {
|
|
1532
|
+
const f = setTimeout(() => {
|
|
1533
|
+
o.state === "compact" && st() && o.setState("collapsed"), V.current.delete(f);
|
|
1534
|
+
}, D.AUTO_COLLAPSE_DELAY);
|
|
1535
|
+
V.current.add(f);
|
|
1473
1536
|
}
|
|
1474
|
-
}, [
|
|
1475
|
-
if (
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1537
|
+
}, [o, st]), j = d(async () => {
|
|
1538
|
+
if (v.value.trim()) {
|
|
1539
|
+
const f = v.value.trim();
|
|
1540
|
+
v.clear(), o.state !== "expanded" && (p == null || p()), o.setState("expanded"), await s(f);
|
|
1478
1541
|
}
|
|
1479
|
-
}, [
|
|
1480
|
-
|
|
1481
|
-
}, [
|
|
1482
|
-
|
|
1483
|
-
}, [
|
|
1484
|
-
(
|
|
1485
|
-
if (!
|
|
1542
|
+
}, [v, s, o, p]), ct = d(() => {
|
|
1543
|
+
at.current = !0, p == null || p(), o.setState("expanded");
|
|
1544
|
+
}, [p, o]), Dt = d(() => {
|
|
1545
|
+
T.current = !0, v.clear(), o.close(), g && g();
|
|
1546
|
+
}, [v, o, g]), z = d(
|
|
1547
|
+
(f) => {
|
|
1548
|
+
if (!W.current || !tt.current)
|
|
1486
1549
|
return null;
|
|
1487
|
-
const
|
|
1550
|
+
const b = W.current.getBoundingClientRect(), q = tt.current.getBoundingClientRect(), lt = window.getComputedStyle(W.current), Ot = new DOMMatrixReadOnly(lt.transform), Jt = b.x - Ot.e, Nt = b.y - Ot.f, bt = f ?? wt, Ae = C(o.state), xe = bt === "left" ? q.left : q.right - D.COMPACT_WIDTH, Re = q.bottom - Ae;
|
|
1488
1551
|
return {
|
|
1489
|
-
x:
|
|
1490
|
-
y:
|
|
1552
|
+
x: xe - Jt,
|
|
1553
|
+
y: Re - Nt
|
|
1491
1554
|
};
|
|
1492
1555
|
},
|
|
1493
|
-
[
|
|
1494
|
-
),
|
|
1495
|
-
(
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1556
|
+
[wt, o.state, C]
|
|
1557
|
+
), gt = d(
|
|
1558
|
+
(f) => {
|
|
1559
|
+
const b = f.target;
|
|
1560
|
+
if (b.ownerDocument !== document)
|
|
1561
|
+
return;
|
|
1562
|
+
b.closest(
|
|
1563
|
+
St.NON_DRAGGABLE_SELECTORS
|
|
1564
|
+
) || (f.preventDefault(), Lt.start(f.nativeEvent));
|
|
1499
1565
|
},
|
|
1500
|
-
[
|
|
1501
|
-
),
|
|
1502
|
-
(
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
...
|
|
1511
|
-
velocity:
|
|
1566
|
+
[Lt]
|
|
1567
|
+
), Ut = d(() => {
|
|
1568
|
+
Z(!0);
|
|
1569
|
+
}, []), Wt = d(
|
|
1570
|
+
(f, b) => {
|
|
1571
|
+
Z(!1);
|
|
1572
|
+
const q = b.point.x, lt = D.COMPACT_WIDTH, Ot = (window.innerWidth - lt) / 2, Nt = q < Ot ? "left" : "right";
|
|
1573
|
+
kt(Nt);
|
|
1574
|
+
const bt = z(Nt);
|
|
1575
|
+
bt && (Pt(rt, bt.x, {
|
|
1576
|
+
...St.SPRING_CONFIG,
|
|
1577
|
+
velocity: b.velocity.x * St.VELOCITY_MULTIPLIER
|
|
1578
|
+
}), Pt(Y, bt.y, {
|
|
1579
|
+
...St.SPRING_CONFIG,
|
|
1580
|
+
velocity: b.velocity.y * St.VELOCITY_MULTIPLIER
|
|
1512
1581
|
}));
|
|
1513
1582
|
},
|
|
1514
|
-
[
|
|
1515
|
-
),
|
|
1583
|
+
[rt, Y, z]
|
|
1584
|
+
), zt = L(o.state), Ee = zt.current === "compact" && o.state === "expanded";
|
|
1516
1585
|
E(() => {
|
|
1517
|
-
|
|
1518
|
-
}, [
|
|
1519
|
-
if (
|
|
1586
|
+
Q(), zt.current = o.state;
|
|
1587
|
+
}, [o.state, Q]), E(() => {
|
|
1588
|
+
if (o.state !== "expanded")
|
|
1520
1589
|
return;
|
|
1521
|
-
const
|
|
1522
|
-
const
|
|
1523
|
-
|
|
1590
|
+
const f = () => {
|
|
1591
|
+
const b = z();
|
|
1592
|
+
b && (rt.set(b.x), Y.set(b.y));
|
|
1524
1593
|
};
|
|
1525
|
-
return window.addEventListener("resize",
|
|
1526
|
-
}, [
|
|
1527
|
-
const
|
|
1594
|
+
return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
|
|
1595
|
+
}, [o.state, rt, Y, z]), E(() => {
|
|
1596
|
+
const f = V.current;
|
|
1528
1597
|
return () => {
|
|
1529
|
-
|
|
1530
|
-
clearTimeout(
|
|
1531
|
-
}),
|
|
1598
|
+
f.forEach((b) => {
|
|
1599
|
+
clearTimeout(b);
|
|
1600
|
+
}), f.clear();
|
|
1532
1601
|
};
|
|
1533
1602
|
}, []), E(() => {
|
|
1534
|
-
if (
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1603
|
+
if (o.state === "compact" && Ct.current) {
|
|
1604
|
+
const f = Ct.current.scrollHeight + D.PADDING;
|
|
1605
|
+
it(f);
|
|
1537
1606
|
}
|
|
1538
|
-
}, [
|
|
1539
|
-
const
|
|
1607
|
+
}, [o.state, v.value]);
|
|
1608
|
+
const qt = {
|
|
1540
1609
|
// Core data
|
|
1541
1610
|
messages: t,
|
|
1542
1611
|
isProcessing: a,
|
|
1543
|
-
error:
|
|
1612
|
+
error: r,
|
|
1544
1613
|
// Input state
|
|
1545
|
-
inputValue:
|
|
1546
|
-
setInputValue:
|
|
1547
|
-
clearInput:
|
|
1548
|
-
textareaRef:
|
|
1549
|
-
handleKeyDown:
|
|
1614
|
+
inputValue: v.value,
|
|
1615
|
+
setInputValue: v.setValue,
|
|
1616
|
+
clearInput: v.clear,
|
|
1617
|
+
textareaRef: v.textareaRef,
|
|
1618
|
+
handleKeyDown: v.handleKeyDown,
|
|
1550
1619
|
// Actions
|
|
1551
1620
|
onSubmit: s,
|
|
1552
|
-
handleSubmit:
|
|
1553
|
-
onStop:
|
|
1621
|
+
handleSubmit: j,
|
|
1622
|
+
onStop: w,
|
|
1554
1623
|
// UI state
|
|
1555
|
-
variant:
|
|
1556
|
-
placeholder:
|
|
1557
|
-
emptyView:
|
|
1558
|
-
messageRenderer:
|
|
1624
|
+
variant: i,
|
|
1625
|
+
placeholder: h,
|
|
1626
|
+
emptyView: _,
|
|
1627
|
+
messageRenderer: H,
|
|
1559
1628
|
// Floating chat specific
|
|
1560
|
-
floatingChatState:
|
|
1561
|
-
triggerIcon:
|
|
1562
|
-
onOpen:
|
|
1563
|
-
onExpand:
|
|
1564
|
-
onClose:
|
|
1629
|
+
floatingChatState: o.state,
|
|
1630
|
+
triggerIcon: c,
|
|
1631
|
+
onOpen: yt,
|
|
1632
|
+
onExpand: ct,
|
|
1633
|
+
onClose: Dt,
|
|
1565
1634
|
// Suggestions
|
|
1566
|
-
suggestions:
|
|
1635
|
+
suggestions: S,
|
|
1567
1636
|
clearSuggestions: O,
|
|
1568
|
-
handleSuggestionSubmit:
|
|
1637
|
+
handleSuggestionSubmit: Rt,
|
|
1569
1638
|
// Notice
|
|
1570
1639
|
notice: u,
|
|
1571
1640
|
// Internal state for components
|
|
1572
|
-
focusOnMount:
|
|
1573
|
-
fromCompact:
|
|
1574
|
-
showExpandButton: !
|
|
1641
|
+
focusOnMount: at.current,
|
|
1642
|
+
fromCompact: Ee,
|
|
1643
|
+
showExpandButton: !v.value.trim()
|
|
1575
1644
|
};
|
|
1576
|
-
return
|
|
1645
|
+
return i === "embedded" ? /* @__PURE__ */ n(Qt, { value: qt, children: /* @__PURE__ */ n(
|
|
1577
1646
|
"div",
|
|
1578
1647
|
{
|
|
1579
1648
|
"data-slot": "chat-embedded",
|
|
1580
|
-
className:
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1649
|
+
className: U(
|
|
1650
|
+
A,
|
|
1651
|
+
K.container,
|
|
1652
|
+
K.embedded
|
|
1584
1653
|
),
|
|
1585
1654
|
children: e
|
|
1586
1655
|
}
|
|
1587
|
-
) }) : /* @__PURE__ */
|
|
1656
|
+
) }) : /* @__PURE__ */ I(Qt, { value: qt, children: [
|
|
1588
1657
|
/* @__PURE__ */ n(
|
|
1589
1658
|
"div",
|
|
1590
1659
|
{
|
|
1591
|
-
ref:
|
|
1660
|
+
ref: tt,
|
|
1592
1661
|
style: {
|
|
1593
1662
|
position: "fixed",
|
|
1594
|
-
top:
|
|
1595
|
-
left:
|
|
1596
|
-
right:
|
|
1597
|
-
bottom:
|
|
1663
|
+
top: D.VIEWPORT_OFFSET,
|
|
1664
|
+
left: D.VIEWPORT_OFFSET,
|
|
1665
|
+
right: D.VIEWPORT_OFFSET,
|
|
1666
|
+
bottom: D.VIEWPORT_OFFSET,
|
|
1598
1667
|
pointerEvents: "none"
|
|
1599
1668
|
}
|
|
1600
1669
|
}
|
|
1601
1670
|
),
|
|
1671
|
+
pt && /* @__PURE__ */ n(Yn, {}),
|
|
1602
1672
|
/* @__PURE__ */ n(
|
|
1603
|
-
|
|
1673
|
+
P.div,
|
|
1604
1674
|
{
|
|
1605
|
-
ref:
|
|
1675
|
+
ref: W,
|
|
1606
1676
|
"data-slot": "chat-floating",
|
|
1607
|
-
className:
|
|
1608
|
-
animating:
|
|
1677
|
+
className: U(A, K.container, K.floating, {
|
|
1678
|
+
animating: Ft
|
|
1609
1679
|
}),
|
|
1610
|
-
onMouseLeave:
|
|
1611
|
-
drag:
|
|
1612
|
-
dragControls:
|
|
1680
|
+
onMouseLeave: o.state === "compact" ? F : void 0,
|
|
1681
|
+
drag: N.includes(o.state),
|
|
1682
|
+
dragControls: Lt,
|
|
1613
1683
|
dragListener: !1,
|
|
1614
|
-
dragConstraints:
|
|
1684
|
+
dragConstraints: tt,
|
|
1615
1685
|
dragMomentum: !1,
|
|
1616
1686
|
dragElastic: 0.1,
|
|
1617
1687
|
dragTransition: { power: 0.1, timeConstant: 100 },
|
|
1618
|
-
|
|
1619
|
-
|
|
1688
|
+
onDragStart: Ut,
|
|
1689
|
+
onDragEnd: Wt,
|
|
1690
|
+
onPointerDown: gt,
|
|
1620
1691
|
style: {
|
|
1621
|
-
x:
|
|
1622
|
-
y:
|
|
1623
|
-
bottom:
|
|
1624
|
-
left:
|
|
1692
|
+
x: rt,
|
|
1693
|
+
y: Y,
|
|
1694
|
+
bottom: D.VIEWPORT_OFFSET,
|
|
1695
|
+
left: D.VIEWPORT_OFFSET,
|
|
1696
|
+
cursor: N.includes(o.state) ? "grab" : "default"
|
|
1625
1697
|
},
|
|
1626
1698
|
children: /* @__PURE__ */ n(
|
|
1627
|
-
|
|
1699
|
+
P.div,
|
|
1628
1700
|
{
|
|
1629
1701
|
layout: !0,
|
|
1630
|
-
className:
|
|
1702
|
+
className: K.content,
|
|
1631
1703
|
initial: !1,
|
|
1632
1704
|
animate: {
|
|
1633
|
-
width:
|
|
1634
|
-
height:
|
|
1635
|
-
x:
|
|
1636
|
-
transition:
|
|
1705
|
+
width: o.state === "collapsed" ? D.COLLAPSED_SIZE : D.COMPACT_WIDTH,
|
|
1706
|
+
height: C(o.state),
|
|
1707
|
+
x: o.state === "collapsed" && wt === "right" ? D.COMPACT_WIDTH - D.COLLAPSED_SIZE : 0,
|
|
1708
|
+
transition: v.value.trim() ? { duration: 0 } : $t
|
|
1637
1709
|
},
|
|
1638
|
-
onAnimationStart: () =>
|
|
1639
|
-
onAnimationComplete: () =>
|
|
1710
|
+
onAnimationStart: () => ht(!0),
|
|
1711
|
+
onAnimationComplete: () => ht(!1),
|
|
1640
1712
|
style: {
|
|
1641
|
-
borderRadius:
|
|
1713
|
+
borderRadius: D.BORDER_RADIUS
|
|
1642
1714
|
},
|
|
1643
|
-
children: /* @__PURE__ */
|
|
1644
|
-
|
|
1645
|
-
|
|
1715
|
+
children: /* @__PURE__ */ I(At, { mode: "wait", children: [
|
|
1716
|
+
o.state === "collapsed" && /* @__PURE__ */ n(
|
|
1717
|
+
de,
|
|
1646
1718
|
{
|
|
1647
|
-
icon:
|
|
1648
|
-
onClick:
|
|
1649
|
-
onHover:
|
|
1650
|
-
focusOnMount:
|
|
1719
|
+
icon: c,
|
|
1720
|
+
onClick: yt,
|
|
1721
|
+
onHover: R,
|
|
1722
|
+
focusOnMount: T.current
|
|
1651
1723
|
},
|
|
1652
1724
|
"collapsed"
|
|
1653
1725
|
),
|
|
1654
|
-
|
|
1655
|
-
|
|
1726
|
+
o.state === "compact" && /* @__PURE__ */ n("div", { ref: Ct, children: /* @__PURE__ */ n(
|
|
1727
|
+
he,
|
|
1656
1728
|
{
|
|
1657
|
-
value:
|
|
1658
|
-
onChange:
|
|
1659
|
-
onSubmit:
|
|
1660
|
-
onKeyDown:
|
|
1661
|
-
textareaRef:
|
|
1662
|
-
placeholder:
|
|
1729
|
+
value: v.value,
|
|
1730
|
+
onChange: v.setValue,
|
|
1731
|
+
onSubmit: j,
|
|
1732
|
+
onKeyDown: v.handleKeyDown,
|
|
1733
|
+
textareaRef: v.textareaRef,
|
|
1734
|
+
placeholder: h,
|
|
1663
1735
|
isProcessing: a,
|
|
1664
|
-
onBlur:
|
|
1665
|
-
onExpand:
|
|
1666
|
-
showExpandButton: !
|
|
1667
|
-
focusOnMount:
|
|
1668
|
-
onStop:
|
|
1669
|
-
suggestions:
|
|
1670
|
-
clearSuggestions: O
|
|
1736
|
+
onBlur: F,
|
|
1737
|
+
onExpand: ct,
|
|
1738
|
+
showExpandButton: !v.value.trim(),
|
|
1739
|
+
focusOnMount: ot.current,
|
|
1740
|
+
onStop: w,
|
|
1741
|
+
suggestions: S,
|
|
1742
|
+
clearSuggestions: O,
|
|
1743
|
+
handleSuggestionSubmit: Rt
|
|
1671
1744
|
},
|
|
1672
1745
|
"compact"
|
|
1673
1746
|
) }),
|
|
1674
|
-
|
|
1747
|
+
o.state === "expanded" && e
|
|
1675
1748
|
] })
|
|
1676
1749
|
}
|
|
1677
1750
|
)
|
|
@@ -1679,84 +1752,95 @@ function Ce({
|
|
|
1679
1752
|
)
|
|
1680
1753
|
] });
|
|
1681
1754
|
}
|
|
1682
|
-
function
|
|
1683
|
-
const { onClose: t } =
|
|
1684
|
-
return /* @__PURE__ */ n(
|
|
1755
|
+
function Le({ className: e } = {}) {
|
|
1756
|
+
const { onClose: t } = mt();
|
|
1757
|
+
return /* @__PURE__ */ n(Ce, { onClose: t, className: e });
|
|
1685
1758
|
}
|
|
1686
|
-
function
|
|
1687
|
-
const { messages: t, isProcessing: a, error:
|
|
1759
|
+
function ye({ className: e } = {}) {
|
|
1760
|
+
const { messages: t, isProcessing: a, error: r, emptyView: s, messageRenderer: i } = mt();
|
|
1688
1761
|
return /* @__PURE__ */ n(
|
|
1689
|
-
|
|
1762
|
+
ve,
|
|
1690
1763
|
{
|
|
1691
1764
|
messages: t,
|
|
1692
1765
|
isProcessing: a,
|
|
1693
|
-
error:
|
|
1766
|
+
error: r,
|
|
1694
1767
|
emptyView: s,
|
|
1695
|
-
messageRenderer:
|
|
1768
|
+
messageRenderer: i,
|
|
1696
1769
|
className: e
|
|
1697
1770
|
}
|
|
1698
1771
|
);
|
|
1699
1772
|
}
|
|
1700
|
-
function
|
|
1773
|
+
function be({
|
|
1701
1774
|
className: e,
|
|
1702
1775
|
disabled: t,
|
|
1703
1776
|
customActions: a,
|
|
1704
|
-
actionOrder:
|
|
1777
|
+
actionOrder: r
|
|
1705
1778
|
} = {}) {
|
|
1706
1779
|
const {
|
|
1707
1780
|
inputValue: s,
|
|
1708
|
-
setInputValue:
|
|
1709
|
-
handleSubmit:
|
|
1710
|
-
handleKeyDown:
|
|
1781
|
+
setInputValue: i,
|
|
1782
|
+
handleSubmit: c,
|
|
1783
|
+
handleKeyDown: h,
|
|
1711
1784
|
textareaRef: u,
|
|
1712
1785
|
placeholder: m,
|
|
1713
|
-
isProcessing:
|
|
1714
|
-
onStop:
|
|
1715
|
-
fromCompact:
|
|
1716
|
-
onExpand:
|
|
1717
|
-
showExpandButton:
|
|
1718
|
-
focusOnMount:
|
|
1719
|
-
} =
|
|
1786
|
+
isProcessing: p,
|
|
1787
|
+
onStop: g,
|
|
1788
|
+
fromCompact: w,
|
|
1789
|
+
onExpand: _,
|
|
1790
|
+
showExpandButton: y,
|
|
1791
|
+
focusOnMount: S
|
|
1792
|
+
} = mt();
|
|
1720
1793
|
return /* @__PURE__ */ n(
|
|
1721
|
-
|
|
1794
|
+
Xt,
|
|
1722
1795
|
{
|
|
1723
1796
|
value: s,
|
|
1724
|
-
onChange:
|
|
1725
|
-
onSubmit:
|
|
1726
|
-
onKeyDown:
|
|
1797
|
+
onChange: i,
|
|
1798
|
+
onSubmit: c,
|
|
1799
|
+
onKeyDown: h,
|
|
1727
1800
|
textareaRef: u,
|
|
1728
1801
|
placeholder: m,
|
|
1729
|
-
isProcessing:
|
|
1730
|
-
onStop:
|
|
1731
|
-
fromCompact:
|
|
1732
|
-
onExpand:
|
|
1733
|
-
showExpandButton:
|
|
1734
|
-
focusOnMount:
|
|
1802
|
+
isProcessing: p,
|
|
1803
|
+
onStop: g,
|
|
1804
|
+
fromCompact: w,
|
|
1805
|
+
onExpand: _,
|
|
1806
|
+
showExpandButton: y,
|
|
1807
|
+
focusOnMount: S,
|
|
1735
1808
|
disabled: t,
|
|
1736
1809
|
customActions: a,
|
|
1737
|
-
actionOrder:
|
|
1810
|
+
actionOrder: r,
|
|
1738
1811
|
className: e
|
|
1739
1812
|
}
|
|
1740
1813
|
);
|
|
1741
1814
|
}
|
|
1742
|
-
function
|
|
1815
|
+
function Ie({
|
|
1743
1816
|
className: e,
|
|
1744
|
-
showSuggestions: t
|
|
1817
|
+
showSuggestions: t,
|
|
1818
|
+
onSelect: a
|
|
1745
1819
|
} = {}) {
|
|
1746
|
-
const { suggestions:
|
|
1747
|
-
|
|
1748
|
-
|
|
1820
|
+
const { suggestions: r, handleSuggestionSubmit: s, inputValue: i } = mt(), c = d(
|
|
1821
|
+
(h) => {
|
|
1822
|
+
try {
|
|
1823
|
+
a == null || a(h);
|
|
1824
|
+
} catch (u) {
|
|
1825
|
+
console.warn("Suggestions onSelect callback failed:", u);
|
|
1826
|
+
}
|
|
1827
|
+
s(h);
|
|
1828
|
+
},
|
|
1829
|
+
[a, s]
|
|
1830
|
+
);
|
|
1831
|
+
return i && !t ? null : /* @__PURE__ */ n(
|
|
1832
|
+
jt,
|
|
1749
1833
|
{
|
|
1750
|
-
suggestions:
|
|
1751
|
-
onSubmit:
|
|
1834
|
+
suggestions: r,
|
|
1835
|
+
onSubmit: c,
|
|
1752
1836
|
className: e
|
|
1753
1837
|
}
|
|
1754
1838
|
);
|
|
1755
1839
|
}
|
|
1756
|
-
function
|
|
1757
|
-
const { notice: t } =
|
|
1840
|
+
function Te({ className: e } = {}) {
|
|
1841
|
+
const { notice: t } = mt();
|
|
1758
1842
|
return t ? /* @__PURE__ */ n(
|
|
1759
|
-
|
|
1843
|
+
ge,
|
|
1760
1844
|
{
|
|
1761
1845
|
icon: t.icon,
|
|
1762
1846
|
message: t.message,
|
|
@@ -1767,96 +1851,96 @@ function ye({ className: e } = {}) {
|
|
|
1767
1851
|
}
|
|
1768
1852
|
) : null;
|
|
1769
1853
|
}
|
|
1770
|
-
function
|
|
1854
|
+
function _e({
|
|
1771
1855
|
children: e,
|
|
1772
1856
|
className: t
|
|
1773
1857
|
} = {}) {
|
|
1774
1858
|
return e ? /* @__PURE__ */ n(
|
|
1775
|
-
|
|
1859
|
+
P.div,
|
|
1776
1860
|
{
|
|
1777
1861
|
"data-slot": "chat-footer",
|
|
1778
|
-
className:
|
|
1862
|
+
className: U(Kt.container, t),
|
|
1779
1863
|
initial: { opacity: 0, scale: 1 },
|
|
1780
1864
|
animate: { opacity: 1, scale: 1 },
|
|
1781
|
-
transition: { ...
|
|
1865
|
+
transition: { ...dt },
|
|
1782
1866
|
children: e
|
|
1783
1867
|
}
|
|
1784
|
-
) : /* @__PURE__ */
|
|
1785
|
-
|
|
1868
|
+
) : /* @__PURE__ */ I(
|
|
1869
|
+
P.div,
|
|
1786
1870
|
{
|
|
1787
1871
|
"data-slot": "chat-footer",
|
|
1788
|
-
className:
|
|
1872
|
+
className: U(Kt.container, t),
|
|
1789
1873
|
initial: { opacity: 0, scale: 1 },
|
|
1790
1874
|
animate: { opacity: 1, scale: 1 },
|
|
1791
|
-
transition: { ...
|
|
1875
|
+
transition: { ...dt },
|
|
1792
1876
|
children: [
|
|
1793
|
-
/* @__PURE__ */ n(
|
|
1794
|
-
/* @__PURE__ */ n(
|
|
1795
|
-
/* @__PURE__ */ n(
|
|
1877
|
+
/* @__PURE__ */ n(Ie, {}),
|
|
1878
|
+
/* @__PURE__ */ n(Te, {}),
|
|
1879
|
+
/* @__PURE__ */ n(be, {})
|
|
1796
1880
|
]
|
|
1797
1881
|
}
|
|
1798
1882
|
);
|
|
1799
1883
|
}
|
|
1800
|
-
function
|
|
1884
|
+
function Se({
|
|
1801
1885
|
showHeader: e = !0,
|
|
1802
1886
|
children: t,
|
|
1803
1887
|
className: a
|
|
1804
1888
|
} = {}) {
|
|
1805
|
-
const { onClose:
|
|
1889
|
+
const { onClose: r } = mt();
|
|
1806
1890
|
return E(() => {
|
|
1807
|
-
const s = (
|
|
1808
|
-
|
|
1891
|
+
const s = (i) => {
|
|
1892
|
+
i.key === "Escape" && r && r();
|
|
1809
1893
|
};
|
|
1810
1894
|
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
1811
|
-
}, [
|
|
1895
|
+
}, [r]), t ? /* @__PURE__ */ n(
|
|
1812
1896
|
"div",
|
|
1813
1897
|
{
|
|
1814
1898
|
"data-slot": "conversation-view",
|
|
1815
|
-
className: `${
|
|
1899
|
+
className: `${Et.container}${a ? ` ${a}` : ""}`,
|
|
1816
1900
|
children: t
|
|
1817
1901
|
}
|
|
1818
|
-
) : /* @__PURE__ */
|
|
1902
|
+
) : /* @__PURE__ */ I(
|
|
1819
1903
|
"div",
|
|
1820
1904
|
{
|
|
1821
1905
|
"data-slot": "conversation-view",
|
|
1822
|
-
className: `${
|
|
1906
|
+
className: `${Et.container}${e ? ` ${Et.withHeader}` : ""}${a ? ` ${a}` : ""}`,
|
|
1823
1907
|
children: [
|
|
1824
|
-
e && /* @__PURE__ */ n(
|
|
1825
|
-
/* @__PURE__ */ n(
|
|
1826
|
-
/* @__PURE__ */ n(
|
|
1908
|
+
e && /* @__PURE__ */ n(Le, {}),
|
|
1909
|
+
/* @__PURE__ */ n(ye, {}),
|
|
1910
|
+
/* @__PURE__ */ n(_e, {})
|
|
1827
1911
|
]
|
|
1828
1912
|
}
|
|
1829
1913
|
);
|
|
1830
1914
|
}
|
|
1831
|
-
const
|
|
1915
|
+
const Kn = {
|
|
1832
1916
|
// Core container with state management
|
|
1833
|
-
Container:
|
|
1917
|
+
Container: we,
|
|
1834
1918
|
// Individual composable components
|
|
1835
|
-
Header:
|
|
1836
|
-
Messages:
|
|
1837
|
-
Input:
|
|
1838
|
-
Suggestions:
|
|
1839
|
-
Notice:
|
|
1919
|
+
Header: Le,
|
|
1920
|
+
Messages: ye,
|
|
1921
|
+
Input: be,
|
|
1922
|
+
Suggestions: Ie,
|
|
1923
|
+
Notice: Te,
|
|
1840
1924
|
// Convenience wrappers
|
|
1841
|
-
Footer:
|
|
1842
|
-
ConversationView:
|
|
1843
|
-
},
|
|
1925
|
+
Footer: _e,
|
|
1926
|
+
ConversationView: Se
|
|
1927
|
+
}, no = Object.assign(
|
|
1844
1928
|
(e) => /* @__PURE__ */ n(
|
|
1845
|
-
|
|
1929
|
+
we,
|
|
1846
1930
|
{
|
|
1847
1931
|
...e,
|
|
1848
|
-
className:
|
|
1932
|
+
className: U("agenttic", e.className),
|
|
1849
1933
|
children: /* @__PURE__ */ n(
|
|
1850
|
-
|
|
1934
|
+
Se,
|
|
1851
1935
|
{
|
|
1852
1936
|
showHeader: e.variant === "floating"
|
|
1853
1937
|
}
|
|
1854
1938
|
)
|
|
1855
1939
|
}
|
|
1856
1940
|
),
|
|
1857
|
-
|
|
1941
|
+
Kn
|
|
1858
1942
|
);
|
|
1859
|
-
function
|
|
1943
|
+
function oo({ className: e, size: t = 24 }) {
|
|
1860
1944
|
return /* @__PURE__ */ n(
|
|
1861
1945
|
"svg",
|
|
1862
1946
|
{
|
|
@@ -1876,7 +1960,7 @@ function qn({ className: e, size: t = 24 }) {
|
|
|
1876
1960
|
}
|
|
1877
1961
|
);
|
|
1878
1962
|
}
|
|
1879
|
-
function
|
|
1963
|
+
function ao({ className: e, size: t = 24 }) {
|
|
1880
1964
|
return /* @__PURE__ */ n(
|
|
1881
1965
|
"svg",
|
|
1882
1966
|
{
|
|
@@ -1897,7 +1981,7 @@ function Jn({ className: e, size: t = 24 }) {
|
|
|
1897
1981
|
}
|
|
1898
1982
|
);
|
|
1899
1983
|
}
|
|
1900
|
-
function
|
|
1984
|
+
function io({ className: e, size: t = 24 }) {
|
|
1901
1985
|
return /* @__PURE__ */ n(
|
|
1902
1986
|
"svg",
|
|
1903
1987
|
{
|
|
@@ -1918,7 +2002,7 @@ function Qn({ className: e, size: t = 24 }) {
|
|
|
1918
2002
|
}
|
|
1919
2003
|
);
|
|
1920
2004
|
}
|
|
1921
|
-
function
|
|
2005
|
+
function ro({ className: e, size: t = 24 }) {
|
|
1922
2006
|
return /* @__PURE__ */ n(
|
|
1923
2007
|
"svg",
|
|
1924
2008
|
{
|
|
@@ -1941,7 +2025,7 @@ function to({ className: e, size: t = 24 }) {
|
|
|
1941
2025
|
}
|
|
1942
2026
|
);
|
|
1943
2027
|
}
|
|
1944
|
-
function
|
|
2028
|
+
function so({ className: e, size: t = 24 }) {
|
|
1945
2029
|
return /* @__PURE__ */ n(
|
|
1946
2030
|
"svg",
|
|
1947
2031
|
{
|
|
@@ -1963,8 +2047,8 @@ function eo({ className: e, size: t = 24 }) {
|
|
|
1963
2047
|
}
|
|
1964
2048
|
);
|
|
1965
2049
|
}
|
|
1966
|
-
function
|
|
1967
|
-
return /* @__PURE__ */
|
|
2050
|
+
function co({ className: e, size: t = 24 }) {
|
|
2051
|
+
return /* @__PURE__ */ I(
|
|
1968
2052
|
"svg",
|
|
1969
2053
|
{
|
|
1970
2054
|
width: t,
|
|
@@ -1995,45 +2079,45 @@ function no({ className: e, size: t = 24 }) {
|
|
|
1995
2079
|
);
|
|
1996
2080
|
}
|
|
1997
2081
|
export {
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2082
|
+
no as AgentUI,
|
|
2083
|
+
we as AgentUIContainer,
|
|
2084
|
+
Se as AgentUIConversationView,
|
|
2085
|
+
_e as AgentUIFooter,
|
|
2086
|
+
Le as AgentUIHeader,
|
|
2087
|
+
be as AgentUIInput,
|
|
2088
|
+
ye as AgentUIMessages,
|
|
2089
|
+
Te as AgentUINotice,
|
|
2090
|
+
Qt as AgentUIProvider,
|
|
2091
|
+
Ie as AgentUISuggestions,
|
|
2092
|
+
dn as AnimatedPlaceholder,
|
|
2093
|
+
en as ArrowUpIcon,
|
|
2094
|
+
ue as BigSkyIcon,
|
|
2095
|
+
eo as Chat,
|
|
2096
|
+
_n as ChatFooter,
|
|
2097
|
+
Ce as ChatHeader,
|
|
2098
|
+
Xt as ChatInput,
|
|
2099
|
+
cn as ChevronUpIcon,
|
|
2100
|
+
de as CollapsedView,
|
|
2101
|
+
he as CompactView,
|
|
2102
|
+
ne as ConversationView,
|
|
2103
|
+
io as CopyIcon,
|
|
2104
|
+
Nn as Message,
|
|
2105
|
+
ee as MessageActions,
|
|
2106
|
+
ve as Messages,
|
|
2107
|
+
ge as Notice,
|
|
2108
|
+
nn as StopIcon,
|
|
2109
|
+
ro as StylesIcon,
|
|
2110
|
+
jt as Suggestions,
|
|
2111
|
+
Fn as ThinkingMessage,
|
|
2112
|
+
ao as ThumbsDownIcon,
|
|
2113
|
+
oo as ThumbsUpIcon,
|
|
2114
|
+
pe as XIcon,
|
|
2115
|
+
so as ZoomIcon,
|
|
2116
|
+
co as ZoomIconFilled,
|
|
2117
|
+
to as animations,
|
|
2118
|
+
U as cn,
|
|
2119
|
+
no as default,
|
|
2120
|
+
mt as useAgentUIContext,
|
|
2121
|
+
re as useChat,
|
|
2122
|
+
se as useInput
|
|
2039
2123
|
};
|