@automattic/agenttic-ui 0.1.71 → 0.1.72
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/chat/Chat.d.ts +1 -1
- package/dist/components/chat/Chat.d.ts.map +1 -1
- package/dist/index.js +991 -991
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './global.css';import './index.css';/* empty css */
|
|
2
|
-
import { jsx as a, jsxs as
|
|
2
|
+
import { jsx as a, jsxs as C, Fragment as Ke } from "react/jsx-runtime";
|
|
3
3
|
import * as Yt from "react";
|
|
4
|
-
import
|
|
5
|
-
import { c as
|
|
4
|
+
import ne, { useState as Y, useEffect as L, useCallback as w, useRef as O, createContext as On, useContext as Ln, useId as Nn, useMemo as ot, memo as Kt, forwardRef as Jt, useImperativeHandle as xn, Component as Dn } from "react";
|
|
5
|
+
import { c as de } from "./QuestionCard-KolZKB58.js";
|
|
6
6
|
import { Q as Fc } from "./QuestionCard-KolZKB58.js";
|
|
7
7
|
import { motion as se, AnimatePresence as ct, useMotionValue as pt, useDragControls as qt, animate as ye } from "framer-motion";
|
|
8
8
|
import { setLocaleData as Ht, __ as E, sprintf as je } from "@wordpress/i18n";
|
|
@@ -12,7 +12,7 @@ import At from "react-markdown";
|
|
|
12
12
|
import { useDebounce as Rn } from "use-debounce";
|
|
13
13
|
import Pn from "remark-gfm";
|
|
14
14
|
import { defaultTheme as $n, ThemeProvider as Fn, BarChart as jn, LineChart as Un } from "@automattic/charts";
|
|
15
|
-
const
|
|
15
|
+
const b = {
|
|
16
16
|
COLLAPSED_SIZE: 56,
|
|
17
17
|
COMPACT_WIDTH: 372,
|
|
18
18
|
EXPANDED_HEIGHT: 520,
|
|
@@ -1670,14 +1670,14 @@ function Ci(t, e) {
|
|
|
1670
1670
|
if (c) {
|
|
1671
1671
|
const r = "", s = Object.fromEntries(
|
|
1672
1672
|
Object.entries(c).map(([l, g]) => {
|
|
1673
|
-
var
|
|
1673
|
+
var h;
|
|
1674
1674
|
if (l === "")
|
|
1675
1675
|
return [
|
|
1676
1676
|
"",
|
|
1677
1677
|
{
|
|
1678
1678
|
...c[""],
|
|
1679
1679
|
domain: i,
|
|
1680
|
-
lang: ((
|
|
1680
|
+
lang: ((h = c[""]) == null ? void 0 : h.lang) || t
|
|
1681
1681
|
}
|
|
1682
1682
|
];
|
|
1683
1683
|
const d = l.indexOf(r);
|
|
@@ -1710,15 +1710,15 @@ function _i(t = "en", e = {}) {
|
|
|
1710
1710
|
return !1;
|
|
1711
1711
|
}
|
|
1712
1712
|
function Za(t) {
|
|
1713
|
-
const e = t || "collapsed", [i, n] =
|
|
1714
|
-
|
|
1713
|
+
const e = t || "collapsed", [i, n] = Y(e);
|
|
1714
|
+
L(() => {
|
|
1715
1715
|
t !== void 0 && n(t);
|
|
1716
1716
|
}, [t]);
|
|
1717
|
-
const o = i === "expanded", c =
|
|
1717
|
+
const o = i === "expanded", c = w(() => {
|
|
1718
1718
|
n("expanded");
|
|
1719
|
-
}, []), r =
|
|
1719
|
+
}, []), r = w(() => {
|
|
1720
1720
|
n(e);
|
|
1721
|
-
}, [e]), s =
|
|
1721
|
+
}, [e]), s = w(() => {
|
|
1722
1722
|
n(
|
|
1723
1723
|
(l) => l === "collapsed" ? "compact" : "collapsed"
|
|
1724
1724
|
);
|
|
@@ -1742,28 +1742,28 @@ function Ya({
|
|
|
1742
1742
|
floatingChatState: c,
|
|
1743
1743
|
disabled: r = !1
|
|
1744
1744
|
}) {
|
|
1745
|
-
const s =
|
|
1745
|
+
const s = O(null), l = w(() => {
|
|
1746
1746
|
e(""), s.current && (s.current.style.height = "auto", setTimeout(() => {
|
|
1747
1747
|
var u;
|
|
1748
1748
|
(u = s.current) == null || u.focus();
|
|
1749
1749
|
}, 100));
|
|
1750
|
-
}, [e]), g =
|
|
1750
|
+
}, [e]), g = w(() => {
|
|
1751
1751
|
const u = s.current;
|
|
1752
1752
|
if (!u)
|
|
1753
1753
|
return;
|
|
1754
1754
|
u.style.height = "auto";
|
|
1755
|
-
const
|
|
1755
|
+
const h = u.scrollHeight, A = 40, x = 200;
|
|
1756
1756
|
u.style.height = `${Math.min(
|
|
1757
|
-
Math.max(
|
|
1757
|
+
Math.max(h, A),
|
|
1758
1758
|
x
|
|
1759
1759
|
)}px`;
|
|
1760
|
-
}, []), d =
|
|
1760
|
+
}, []), d = w(
|
|
1761
1761
|
(u) => {
|
|
1762
1762
|
u.key === "Enter" && !u.shiftKey && !n && !o && !r && (u.preventDefault(), i(t.trim()), l());
|
|
1763
1763
|
},
|
|
1764
1764
|
[t, n, o, i, l, r]
|
|
1765
1765
|
);
|
|
1766
|
-
return
|
|
1766
|
+
return L(() => {
|
|
1767
1767
|
g();
|
|
1768
1768
|
}, [t, c, g]), {
|
|
1769
1769
|
value: t,
|
|
@@ -1775,8 +1775,8 @@ function Ya({
|
|
|
1775
1775
|
};
|
|
1776
1776
|
}
|
|
1777
1777
|
function Ti() {
|
|
1778
|
-
const [t, e] =
|
|
1779
|
-
return
|
|
1778
|
+
const [t, e] = Y(!0);
|
|
1779
|
+
return L(() => {
|
|
1780
1780
|
const i = () => e(!0), n = () => e(!1);
|
|
1781
1781
|
return window.addEventListener("focus", i), window.addEventListener("blur", n), () => {
|
|
1782
1782
|
window.removeEventListener("focus", i), window.removeEventListener("blur", n);
|
|
@@ -1798,7 +1798,7 @@ function Ja(t = "left") {
|
|
|
1798
1798
|
return t;
|
|
1799
1799
|
}
|
|
1800
1800
|
function Ot({ x: t, y: e }, i, n) {
|
|
1801
|
-
const o = window.innerWidth - i -
|
|
1801
|
+
const o = window.innerWidth - i - b.VIEWPORT_OFFSET * 2, c = 2 * b.VIEWPORT_OFFSET + n - window.innerHeight;
|
|
1802
1802
|
return {
|
|
1803
1803
|
x: Math.max(0, Math.min(t, o)),
|
|
1804
1804
|
y: Math.max(c, Math.min(e, 0))
|
|
@@ -1809,11 +1809,11 @@ function qa({
|
|
|
1809
1809
|
initialFreeDragPosition: e,
|
|
1810
1810
|
side: i
|
|
1811
1811
|
}) {
|
|
1812
|
-
const n = i === "right" ? window.innerWidth -
|
|
1812
|
+
const n = i === "right" ? window.innerWidth - b.COMPACT_WIDTH - b.VIEWPORT_OFFSET * 2 : 0;
|
|
1813
1813
|
return !t || e === void 0 ? { x: n, y: 0 } : Ot(
|
|
1814
1814
|
e,
|
|
1815
|
-
|
|
1816
|
-
|
|
1815
|
+
b.COMPACT_WIDTH,
|
|
1816
|
+
b.EXPANDED_HEIGHT
|
|
1817
1817
|
);
|
|
1818
1818
|
}
|
|
1819
1819
|
function ht(t) {
|
|
@@ -1878,7 +1878,7 @@ const It = {
|
|
|
1878
1878
|
springConfig: It,
|
|
1879
1879
|
thinkingGradientKeyframes: Si
|
|
1880
1880
|
}, Symbol.toStringTag, { value: "Module" })), Qa = On(null);
|
|
1881
|
-
function
|
|
1881
|
+
function Ne() {
|
|
1882
1882
|
const t = Ln(Qa);
|
|
1883
1883
|
if (!t)
|
|
1884
1884
|
throw new Error(
|
|
@@ -1912,16 +1912,16 @@ const ki = "button-module_button", Mi = "button-module_pressed", Ai = "button-mo
|
|
|
1912
1912
|
pressed: s,
|
|
1913
1913
|
...l
|
|
1914
1914
|
}, g) {
|
|
1915
|
-
const d = r ? En : "button", u = !!o,
|
|
1916
|
-
return /* @__PURE__ */
|
|
1915
|
+
const d = r ? En : "button", u = !!o, h = n || (u && !c ? "icon" : void 0);
|
|
1916
|
+
return /* @__PURE__ */ C(
|
|
1917
1917
|
d,
|
|
1918
1918
|
{
|
|
1919
1919
|
ref: g,
|
|
1920
1920
|
"data-slot": "button",
|
|
1921
|
-
className:
|
|
1921
|
+
className: de(
|
|
1922
1922
|
et.button,
|
|
1923
1923
|
et[i],
|
|
1924
|
-
|
|
1924
|
+
h && et[h],
|
|
1925
1925
|
u && c ? et.withTextAndIcon : void 0,
|
|
1926
1926
|
s ? et.pressed : void 0,
|
|
1927
1927
|
e
|
|
@@ -1966,8 +1966,8 @@ function en({
|
|
|
1966
1966
|
onHover: i,
|
|
1967
1967
|
focusOnMount: n = !1
|
|
1968
1968
|
}) {
|
|
1969
|
-
const o =
|
|
1970
|
-
return
|
|
1969
|
+
const o = O(null), c = O(n);
|
|
1970
|
+
return L(() => {
|
|
1971
1971
|
c.current && o.current && o.current.focus(), c.current = !1;
|
|
1972
1972
|
}, [c, o]), /* @__PURE__ */ a(
|
|
1973
1973
|
se.div,
|
|
@@ -2104,8 +2104,8 @@ function Ji({
|
|
|
2104
2104
|
interval: e = 3e3,
|
|
2105
2105
|
className: i = ""
|
|
2106
2106
|
}) {
|
|
2107
|
-
const [n, o] =
|
|
2108
|
-
return
|
|
2107
|
+
const [n, o] = Y(0);
|
|
2108
|
+
return L(() => {
|
|
2109
2109
|
const c = setInterval(() => {
|
|
2110
2110
|
o(
|
|
2111
2111
|
(r) => (r + 1) % t.length
|
|
@@ -2116,7 +2116,7 @@ function Ji({
|
|
|
2116
2116
|
se.span,
|
|
2117
2117
|
{
|
|
2118
2118
|
"data-slot": "animated-placeholder",
|
|
2119
|
-
className:
|
|
2119
|
+
className: de(Ki.container, i),
|
|
2120
2120
|
initial: { opacity: 0, y: 8 },
|
|
2121
2121
|
animate: { opacity: 1, y: 0 },
|
|
2122
2122
|
exit: { opacity: 0, y: -8 },
|
|
@@ -2143,53 +2143,53 @@ function Nt({
|
|
|
2143
2143
|
onClick: g,
|
|
2144
2144
|
fromCompact: d = !1,
|
|
2145
2145
|
onExpand: u,
|
|
2146
|
-
showExpandButton:
|
|
2147
|
-
focusOnMount:
|
|
2146
|
+
showExpandButton: h = !0,
|
|
2147
|
+
focusOnMount: A = !1,
|
|
2148
2148
|
customActions: x = [],
|
|
2149
2149
|
actionOrder: N = "before-submit",
|
|
2150
|
-
onStop:
|
|
2151
|
-
disabled:
|
|
2152
|
-
onMouseEnter:
|
|
2153
|
-
onMouseLeave:
|
|
2150
|
+
onStop: $,
|
|
2151
|
+
disabled: f,
|
|
2152
|
+
onMouseEnter: T,
|
|
2153
|
+
onMouseLeave: M,
|
|
2154
2154
|
expandOnClick: D = !1,
|
|
2155
|
-
layout:
|
|
2155
|
+
layout: _ = "inline"
|
|
2156
2156
|
}) {
|
|
2157
|
-
const
|
|
2157
|
+
const j = Nn(), { variant: K, floatingChatState: H, isInputOverLimit: I } = Ne(), V = (
|
|
2158
2158
|
// If the consumer actively sets `disabled` to `false` (vs undefined), that takes precedence.
|
|
2159
|
-
|
|
2160
|
-
),
|
|
2161
|
-
(
|
|
2162
|
-
const
|
|
2163
|
-
if (
|
|
2164
|
-
|
|
2159
|
+
f !== void 0 ? !f : (t.trim() || r) && !I
|
|
2160
|
+
), m = w(
|
|
2161
|
+
(v) => {
|
|
2162
|
+
const _e = v.key.toLowerCase();
|
|
2163
|
+
if (_e === "enter" && !v.shiftKey && (v.nativeEvent.isComposing || v.keyCode === 229)) {
|
|
2164
|
+
v.preventDefault();
|
|
2165
2165
|
return;
|
|
2166
2166
|
}
|
|
2167
|
-
if (
|
|
2168
|
-
|
|
2167
|
+
if (_e === "enter" && !v.shiftKey && !V) {
|
|
2168
|
+
v.preventDefault();
|
|
2169
2169
|
return;
|
|
2170
2170
|
}
|
|
2171
|
-
((
|
|
2171
|
+
((v.metaKey || v.ctrlKey) && _e === "z" || v.ctrlKey && _e === "y") && v.stopPropagation(), n(v);
|
|
2172
2172
|
},
|
|
2173
|
-
[
|
|
2174
|
-
),
|
|
2175
|
-
let
|
|
2176
|
-
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
}, [
|
|
2181
|
-
const
|
|
2173
|
+
[V, n]
|
|
2174
|
+
), z = (v) => v.endsWith("…") ? v : `${v}…`, ie = Array.isArray(c);
|
|
2175
|
+
let W;
|
|
2176
|
+
ie ? W = c.map(z) : c ? W = z(c) : W = "";
|
|
2177
|
+
const Se = O(A);
|
|
2178
|
+
L(() => {
|
|
2179
|
+
Se.current && o.current && o.current.focus(), Se.current = !1;
|
|
2180
|
+
}, [Se, o]);
|
|
2181
|
+
const ge = () => x.map((v) => /* @__PURE__ */ a(
|
|
2182
2182
|
we,
|
|
2183
2183
|
{
|
|
2184
|
-
className:
|
|
2185
|
-
onClick:
|
|
2186
|
-
disabled:
|
|
2187
|
-
variant:
|
|
2188
|
-
icon:
|
|
2189
|
-
"aria-label":
|
|
2184
|
+
className: v.className || Fe.button,
|
|
2185
|
+
onClick: v.onClick,
|
|
2186
|
+
disabled: v.disabled,
|
|
2187
|
+
variant: v.variant || "ghost",
|
|
2188
|
+
icon: v.icon,
|
|
2189
|
+
"aria-label": v["aria-label"]
|
|
2190
2190
|
},
|
|
2191
|
-
|
|
2192
|
-
)),
|
|
2191
|
+
v.id
|
|
2192
|
+
)), J = () => K === "embedded" || H === "expanded" || D ? null : h && u ? /* @__PURE__ */ a(
|
|
2193
2193
|
we,
|
|
2194
2194
|
{
|
|
2195
2195
|
className: Fe.button,
|
|
@@ -2198,33 +2198,33 @@ function Nt({
|
|
|
2198
2198
|
icon: /* @__PURE__ */ a(an, {}),
|
|
2199
2199
|
"aria-label": E("Expand conversation", "a8c-agenttic")
|
|
2200
2200
|
}
|
|
2201
|
-
) : null,
|
|
2202
|
-
if (r &&
|
|
2201
|
+
) : null, Ce = () => {
|
|
2202
|
+
if (r && !$)
|
|
2203
2203
|
return null;
|
|
2204
|
-
const
|
|
2205
|
-
r &&
|
|
2204
|
+
const v = () => {
|
|
2205
|
+
r && $ ? $() : i();
|
|
2206
2206
|
};
|
|
2207
2207
|
return /* @__PURE__ */ a(
|
|
2208
2208
|
we,
|
|
2209
2209
|
{
|
|
2210
2210
|
className: Fe.button,
|
|
2211
|
-
onClick:
|
|
2212
|
-
disabled: !
|
|
2211
|
+
onClick: v,
|
|
2212
|
+
disabled: !V,
|
|
2213
2213
|
variant: "primary",
|
|
2214
2214
|
icon: r ? /* @__PURE__ */ a(Hi, {}) : /* @__PURE__ */ a(Bi, {}),
|
|
2215
2215
|
"aria-label": r ? E("Stop processing", "a8c-agenttic") : E("Send message", "a8c-agenttic")
|
|
2216
2216
|
}
|
|
2217
2217
|
);
|
|
2218
2218
|
};
|
|
2219
|
-
return /* @__PURE__ */
|
|
2219
|
+
return /* @__PURE__ */ C(
|
|
2220
2220
|
"div",
|
|
2221
2221
|
{
|
|
2222
2222
|
"data-slot": "chat-input",
|
|
2223
|
-
className: `${Fe.container}${
|
|
2224
|
-
onMouseEnter:
|
|
2225
|
-
onMouseLeave:
|
|
2223
|
+
className: `${Fe.container}${_ === "stacked" ? ` ${Fe.containerStacked}` : ""}`,
|
|
2224
|
+
onMouseEnter: T,
|
|
2225
|
+
onMouseLeave: M,
|
|
2226
2226
|
children: [
|
|
2227
|
-
/* @__PURE__ */
|
|
2227
|
+
/* @__PURE__ */ C(
|
|
2228
2228
|
se.div,
|
|
2229
2229
|
{
|
|
2230
2230
|
className: Fe.textareaContainer,
|
|
@@ -2237,24 +2237,24 @@ function Nt({
|
|
|
2237
2237
|
transition: t.trim() ? { duration: 0 } : ft
|
|
2238
2238
|
},
|
|
2239
2239
|
children: [
|
|
2240
|
-
!t &&
|
|
2240
|
+
!t && ie && /* @__PURE__ */ a(
|
|
2241
2241
|
Ji,
|
|
2242
2242
|
{
|
|
2243
|
-
texts:
|
|
2243
|
+
texts: W
|
|
2244
2244
|
}
|
|
2245
2245
|
),
|
|
2246
2246
|
/* @__PURE__ */ a(
|
|
2247
2247
|
tn,
|
|
2248
2248
|
{
|
|
2249
|
-
id:
|
|
2249
|
+
id: j,
|
|
2250
2250
|
ref: o,
|
|
2251
2251
|
value: t,
|
|
2252
|
-
onChange: (
|
|
2253
|
-
onKeyDown:
|
|
2252
|
+
onChange: (v) => e(v.target.value),
|
|
2253
|
+
onKeyDown: m,
|
|
2254
2254
|
onBlur: s,
|
|
2255
2255
|
onFocus: l,
|
|
2256
2256
|
onClick: g,
|
|
2257
|
-
placeholder:
|
|
2257
|
+
placeholder: ie ? "" : W,
|
|
2258
2258
|
rows: 1,
|
|
2259
2259
|
"aria-label": E("Chat input", "a8c-agenttic")
|
|
2260
2260
|
}
|
|
@@ -2262,7 +2262,7 @@ function Nt({
|
|
|
2262
2262
|
]
|
|
2263
2263
|
}
|
|
2264
2264
|
),
|
|
2265
|
-
/* @__PURE__ */
|
|
2265
|
+
/* @__PURE__ */ C(
|
|
2266
2266
|
se.div,
|
|
2267
2267
|
{
|
|
2268
2268
|
className: Fe.actions,
|
|
@@ -2276,10 +2276,10 @@ function Nt({
|
|
|
2276
2276
|
transition: t.trim() ? { duration: 0 } : Be
|
|
2277
2277
|
},
|
|
2278
2278
|
children: [
|
|
2279
|
-
|
|
2280
|
-
N === "before-submit" &&
|
|
2281
|
-
|
|
2282
|
-
N === "after-submit" &&
|
|
2279
|
+
J(),
|
|
2280
|
+
N === "before-submit" && ge(),
|
|
2281
|
+
Ce(),
|
|
2282
|
+
N === "after-submit" && ge()
|
|
2283
2283
|
]
|
|
2284
2284
|
}
|
|
2285
2285
|
)
|
|
@@ -2315,7 +2315,7 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2315
2315
|
chevronOpen: er,
|
|
2316
2316
|
dropdown: tr,
|
|
2317
2317
|
option: ar
|
|
2318
|
-
}, nr = "Suggestions-module_container", ir = "Suggestions-module_vertical", rr = "Suggestions-module_button", or = "Suggestions-module_label", cr = "Suggestions-module_description", sr = "Suggestions-module_floating",
|
|
2318
|
+
}, nr = "Suggestions-module_container", ir = "Suggestions-module_vertical", rr = "Suggestions-module_button", or = "Suggestions-module_label", cr = "Suggestions-module_description", sr = "Suggestions-module_floating", Le = {
|
|
2319
2319
|
container: nr,
|
|
2320
2320
|
vertical: ir,
|
|
2321
2321
|
button: rr,
|
|
@@ -2329,48 +2329,48 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2329
2329
|
availableSuggestions: i,
|
|
2330
2330
|
onOpenChange: n
|
|
2331
2331
|
}) => {
|
|
2332
|
-
var
|
|
2333
|
-
const [o, c] =
|
|
2334
|
-
(
|
|
2335
|
-
if (r.current =
|
|
2332
|
+
var $;
|
|
2333
|
+
const [o, c] = ne.useState(!1), r = ne.useRef(null), [s, l] = ne.useState(null), [g, d] = ne.useState(null), [u, h] = ne.useState(void 0), A = ne.useCallback(
|
|
2334
|
+
(f) => {
|
|
2335
|
+
if (r.current = f, !f) {
|
|
2336
2336
|
l(null), d(null);
|
|
2337
2337
|
return;
|
|
2338
2338
|
}
|
|
2339
2339
|
l(
|
|
2340
|
-
|
|
2340
|
+
f.closest(".agenttic") ?? f
|
|
2341
2341
|
), d(
|
|
2342
|
-
|
|
2342
|
+
f.closest(
|
|
2343
2343
|
'[data-slot="conversation-view"]'
|
|
2344
2344
|
) ?? null
|
|
2345
2345
|
);
|
|
2346
2346
|
},
|
|
2347
2347
|
[]
|
|
2348
|
-
), x =
|
|
2349
|
-
var
|
|
2350
|
-
if (
|
|
2351
|
-
const
|
|
2348
|
+
), x = ne.useCallback((f) => {
|
|
2349
|
+
var T;
|
|
2350
|
+
if (f) {
|
|
2351
|
+
const M = (T = r.current) == null ? void 0 : T.closest(
|
|
2352
2352
|
'[data-slot="suggestions"]'
|
|
2353
2353
|
);
|
|
2354
|
-
|
|
2354
|
+
M && h(M.clientWidth * 0.9);
|
|
2355
2355
|
}
|
|
2356
|
-
c(
|
|
2357
|
-
}, [n]), N = (
|
|
2358
|
-
const { options:
|
|
2359
|
-
...
|
|
2356
|
+
c(f), n == null || n(f);
|
|
2357
|
+
}, [n]), N = (f) => {
|
|
2358
|
+
const { options: T, ...M } = t, D = {
|
|
2359
|
+
...M,
|
|
2360
2360
|
prompt: lr(
|
|
2361
2361
|
t.prompt ?? t.label,
|
|
2362
|
-
|
|
2362
|
+
f.value
|
|
2363
2363
|
),
|
|
2364
|
-
label: `${t.label} ${
|
|
2364
|
+
label: `${t.label} ${f.label}`
|
|
2365
2365
|
};
|
|
2366
2366
|
e == null || e(D, i), x(!1);
|
|
2367
2367
|
};
|
|
2368
|
-
return /* @__PURE__ */ a("div", { ref:
|
|
2369
|
-
/* @__PURE__ */ a(Ue.Trigger, { asChild: !0, children: /* @__PURE__ */
|
|
2368
|
+
return /* @__PURE__ */ a("div", { ref: A, className: tt.container, children: /* @__PURE__ */ C(Ue.Root, { open: o, onOpenChange: x, children: [
|
|
2369
|
+
/* @__PURE__ */ a(Ue.Trigger, { asChild: !0, children: /* @__PURE__ */ C(
|
|
2370
2370
|
we,
|
|
2371
2371
|
{
|
|
2372
2372
|
variant: "outline",
|
|
2373
|
-
className:
|
|
2373
|
+
className: Le.button,
|
|
2374
2374
|
children: [
|
|
2375
2375
|
t.label,
|
|
2376
2376
|
/* @__PURE__ */ a(
|
|
@@ -2393,16 +2393,16 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2393
2393
|
collisionBoundary: g,
|
|
2394
2394
|
"aria-label": t.label,
|
|
2395
2395
|
style: u ? { width: u } : void 0,
|
|
2396
|
-
children: (
|
|
2396
|
+
children: ($ = t.options) == null ? void 0 : $.map((f) => /* @__PURE__ */ a(
|
|
2397
2397
|
"button",
|
|
2398
2398
|
{
|
|
2399
2399
|
type: "button",
|
|
2400
2400
|
"data-slot": "suggestion-option",
|
|
2401
2401
|
className: tt.option,
|
|
2402
|
-
onClick: () => N(
|
|
2403
|
-
children:
|
|
2402
|
+
onClick: () => N(f),
|
|
2403
|
+
children: f.label
|
|
2404
2404
|
},
|
|
2405
|
-
|
|
2405
|
+
f.id
|
|
2406
2406
|
))
|
|
2407
2407
|
}
|
|
2408
2408
|
) })
|
|
@@ -2418,20 +2418,20 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2418
2418
|
onDropdownOpenChange: s,
|
|
2419
2419
|
translateY: l = "-100%"
|
|
2420
2420
|
}) => {
|
|
2421
|
-
const { variant: g } =
|
|
2421
|
+
const { variant: g } = Ne(), d = ot(
|
|
2422
2422
|
() => g === "floating" ? e == null ? void 0 : e.slice(0, 3) : e,
|
|
2423
2423
|
[e, g]
|
|
2424
|
-
), u = async (
|
|
2424
|
+
), u = async (h, A) => {
|
|
2425
2425
|
let x = !0;
|
|
2426
|
-
|
|
2426
|
+
h.action && (x = await h.action()), x && i && h.prompt && i(h, A);
|
|
2427
2427
|
};
|
|
2428
2428
|
return !d || d.length === 0 ? null : /* @__PURE__ */ a(ct, { children: o && /* @__PURE__ */ a(
|
|
2429
2429
|
se.div,
|
|
2430
2430
|
{
|
|
2431
2431
|
"data-slot": "suggestions",
|
|
2432
|
-
className:
|
|
2433
|
-
|
|
2434
|
-
n === "vertical" ?
|
|
2432
|
+
className: de(
|
|
2433
|
+
Le.container,
|
|
2434
|
+
n === "vertical" ? Le.vertical : n === "floating" ? Le.floating : "",
|
|
2435
2435
|
t
|
|
2436
2436
|
),
|
|
2437
2437
|
initial: { opacity: 0, y: "-80%" },
|
|
@@ -2441,8 +2441,8 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2441
2441
|
onMouseEnter: c,
|
|
2442
2442
|
onMouseLeave: r,
|
|
2443
2443
|
children: d.map(
|
|
2444
|
-
(
|
|
2445
|
-
const x = !!
|
|
2444
|
+
(h, A) => {
|
|
2445
|
+
const x = !!h.description && n !== "horizontal";
|
|
2446
2446
|
return /* @__PURE__ */ a(
|
|
2447
2447
|
se.div,
|
|
2448
2448
|
{
|
|
@@ -2451,12 +2451,12 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2451
2451
|
exit: { opacity: 0, y: 10 },
|
|
2452
2452
|
transition: {
|
|
2453
2453
|
...ft,
|
|
2454
|
-
delay:
|
|
2454
|
+
delay: A * 0.05
|
|
2455
2455
|
},
|
|
2456
|
-
children:
|
|
2456
|
+
children: h.options && h.options.length > 0 ? /* @__PURE__ */ a(
|
|
2457
2457
|
dr,
|
|
2458
2458
|
{
|
|
2459
|
-
suggestion:
|
|
2459
|
+
suggestion: h,
|
|
2460
2460
|
onSelect: u,
|
|
2461
2461
|
availableSuggestions: d,
|
|
2462
2462
|
onOpenChange: s
|
|
@@ -2466,32 +2466,32 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2466
2466
|
{
|
|
2467
2467
|
onClick: (N) => {
|
|
2468
2468
|
N.stopPropagation(), u(
|
|
2469
|
-
|
|
2469
|
+
h,
|
|
2470
2470
|
d
|
|
2471
2471
|
);
|
|
2472
2472
|
},
|
|
2473
2473
|
variant: "outline",
|
|
2474
|
-
className:
|
|
2475
|
-
children: /* @__PURE__ */
|
|
2474
|
+
className: Le.button,
|
|
2475
|
+
children: /* @__PURE__ */ C(
|
|
2476
2476
|
"div",
|
|
2477
2477
|
{
|
|
2478
|
-
className:
|
|
2479
|
-
|
|
2480
|
-
x ?
|
|
2478
|
+
className: de(
|
|
2479
|
+
Le["suggestion-content"],
|
|
2480
|
+
x ? Le["suggestion-content--with-description"] : ""
|
|
2481
2481
|
),
|
|
2482
2482
|
children: [
|
|
2483
2483
|
/* @__PURE__ */ a(
|
|
2484
2484
|
"span",
|
|
2485
2485
|
{
|
|
2486
|
-
className:
|
|
2487
|
-
children:
|
|
2486
|
+
className: Le.label,
|
|
2487
|
+
children: h.label
|
|
2488
2488
|
}
|
|
2489
2489
|
),
|
|
2490
2490
|
x && /* @__PURE__ */ a(
|
|
2491
2491
|
"span",
|
|
2492
2492
|
{
|
|
2493
|
-
className:
|
|
2494
|
-
children:
|
|
2493
|
+
className: Le.description,
|
|
2494
|
+
children: h.description
|
|
2495
2495
|
}
|
|
2496
2496
|
)
|
|
2497
2497
|
]
|
|
@@ -2500,7 +2500,7 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2500
2500
|
}
|
|
2501
2501
|
)
|
|
2502
2502
|
},
|
|
2503
|
-
|
|
2503
|
+
h.id
|
|
2504
2504
|
);
|
|
2505
2505
|
}
|
|
2506
2506
|
)
|
|
@@ -2508,22 +2508,22 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2508
2508
|
) });
|
|
2509
2509
|
};
|
|
2510
2510
|
function ur() {
|
|
2511
|
-
const t =
|
|
2511
|
+
const t = O(/* @__PURE__ */ new Map()), e = w((c) => {
|
|
2512
2512
|
const r = t.current.get(c);
|
|
2513
2513
|
r && (clearTimeout(r), t.current.delete(c));
|
|
2514
|
-
}, []), i =
|
|
2514
|
+
}, []), i = w(
|
|
2515
2515
|
(c, r, s) => {
|
|
2516
2516
|
e(c);
|
|
2517
2517
|
const l = setTimeout(r, s);
|
|
2518
2518
|
return t.current.set(c, l), l;
|
|
2519
2519
|
},
|
|
2520
2520
|
[e]
|
|
2521
|
-
), n =
|
|
2521
|
+
), n = w(() => {
|
|
2522
2522
|
t.current.forEach((c) => {
|
|
2523
2523
|
clearTimeout(c);
|
|
2524
2524
|
}), t.current.clear();
|
|
2525
|
-
}, []), o =
|
|
2526
|
-
return
|
|
2525
|
+
}, []), o = w((c) => t.current.has(c), []);
|
|
2526
|
+
return L(() => n, [n]), {
|
|
2527
2527
|
setNamedTimeout: i,
|
|
2528
2528
|
clearNamedTimeout: e,
|
|
2529
2529
|
clearAllTimeouts: n,
|
|
@@ -2544,36 +2544,36 @@ function nn({
|
|
|
2544
2544
|
onExpand: g,
|
|
2545
2545
|
showExpandButton: d = !0,
|
|
2546
2546
|
focusOnMount: u = !1,
|
|
2547
|
-
customActions:
|
|
2548
|
-
actionOrder:
|
|
2547
|
+
customActions: h,
|
|
2548
|
+
actionOrder: A,
|
|
2549
2549
|
onStop: x,
|
|
2550
2550
|
suggestions: N,
|
|
2551
|
-
clearSuggestions:
|
|
2552
|
-
handleSuggestionSubmit:
|
|
2553
|
-
expandOnClick:
|
|
2551
|
+
clearSuggestions: $,
|
|
2552
|
+
handleSuggestionSubmit: f,
|
|
2553
|
+
expandOnClick: T = !1
|
|
2554
2554
|
}) {
|
|
2555
|
-
const [
|
|
2556
|
-
|
|
2555
|
+
const [M, D] = Y(!1), [_, j] = Y(!1), { setNamedTimeout: K, clearAllTimeouts: H } = ur(), I = w(() => {
|
|
2556
|
+
K(
|
|
2557
2557
|
"hide-suggestions",
|
|
2558
2558
|
() => {
|
|
2559
2559
|
D(!1);
|
|
2560
2560
|
},
|
|
2561
2561
|
gr
|
|
2562
2562
|
);
|
|
2563
|
-
}, [
|
|
2564
|
-
|
|
2565
|
-
}, [
|
|
2566
|
-
|
|
2567
|
-
}, [
|
|
2568
|
-
(
|
|
2569
|
-
|
|
2563
|
+
}, [K]), V = w(() => {
|
|
2564
|
+
_ || I();
|
|
2565
|
+
}, [_, I]), m = w(() => {
|
|
2566
|
+
H(), D(!0);
|
|
2567
|
+
}, [H]), z = w(
|
|
2568
|
+
(W) => {
|
|
2569
|
+
j(W), W ? m() : I();
|
|
2570
2570
|
},
|
|
2571
|
-
[
|
|
2572
|
-
),
|
|
2573
|
-
|
|
2574
|
-
}, [
|
|
2575
|
-
return
|
|
2576
|
-
if (
|
|
2571
|
+
[I, m]
|
|
2572
|
+
), ie = w(() => {
|
|
2573
|
+
T && g && !t && g();
|
|
2574
|
+
}, [T, g, t]);
|
|
2575
|
+
return L(() => {
|
|
2576
|
+
if (H(), t) {
|
|
2577
2577
|
D(!1);
|
|
2578
2578
|
return;
|
|
2579
2579
|
}
|
|
@@ -2581,18 +2581,18 @@ function nn({
|
|
|
2581
2581
|
D(!1);
|
|
2582
2582
|
return;
|
|
2583
2583
|
}
|
|
2584
|
-
if (
|
|
2584
|
+
if (_) {
|
|
2585
2585
|
D(!0);
|
|
2586
2586
|
return;
|
|
2587
2587
|
}
|
|
2588
|
-
D(!0),
|
|
2588
|
+
D(!0), I();
|
|
2589
2589
|
}, [
|
|
2590
2590
|
t,
|
|
2591
2591
|
N,
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
]), /* @__PURE__ */
|
|
2592
|
+
_,
|
|
2593
|
+
H,
|
|
2594
|
+
I
|
|
2595
|
+
]), /* @__PURE__ */ C(Ke, { children: [
|
|
2596
2596
|
/* @__PURE__ */ a(
|
|
2597
2597
|
Nt,
|
|
2598
2598
|
{
|
|
@@ -2605,28 +2605,28 @@ function nn({
|
|
|
2605
2605
|
isProcessing: r,
|
|
2606
2606
|
onBlur: s,
|
|
2607
2607
|
onFocus: l,
|
|
2608
|
-
onClick:
|
|
2608
|
+
onClick: ie,
|
|
2609
2609
|
onExpand: g,
|
|
2610
2610
|
showExpandButton: d,
|
|
2611
2611
|
focusOnMount: u,
|
|
2612
|
-
customActions:
|
|
2613
|
-
actionOrder:
|
|
2612
|
+
customActions: h,
|
|
2613
|
+
actionOrder: A,
|
|
2614
2614
|
onStop: x,
|
|
2615
|
-
expandOnClick:
|
|
2616
|
-
onMouseEnter:
|
|
2617
|
-
onMouseLeave: () =>
|
|
2615
|
+
expandOnClick: T,
|
|
2616
|
+
onMouseEnter: m,
|
|
2617
|
+
onMouseLeave: () => V()
|
|
2618
2618
|
}
|
|
2619
2619
|
),
|
|
2620
2620
|
!t && /* @__PURE__ */ a(
|
|
2621
2621
|
vt,
|
|
2622
2622
|
{
|
|
2623
2623
|
suggestions: N,
|
|
2624
|
-
onSubmit:
|
|
2624
|
+
onSubmit: f,
|
|
2625
2625
|
layout: "floating",
|
|
2626
|
-
visible:
|
|
2627
|
-
onMouseEnter:
|
|
2628
|
-
onMouseLeave: () =>
|
|
2629
|
-
onDropdownOpenChange:
|
|
2626
|
+
visible: M,
|
|
2627
|
+
onMouseEnter: m,
|
|
2628
|
+
onMouseLeave: () => V(),
|
|
2629
|
+
onDropdownOpenChange: z
|
|
2630
2630
|
}
|
|
2631
2631
|
)
|
|
2632
2632
|
] });
|
|
@@ -2642,8 +2642,8 @@ function rn({
|
|
|
2642
2642
|
onClick: i,
|
|
2643
2643
|
focusOnMount: n = !1
|
|
2644
2644
|
}) {
|
|
2645
|
-
const o =
|
|
2646
|
-
return
|
|
2645
|
+
const o = O(null), c = O(n);
|
|
2646
|
+
return L(() => {
|
|
2647
2647
|
c.current && o.current && o.current.focus(), c.current = !1;
|
|
2648
2648
|
}, [c, o]), /* @__PURE__ */ a(
|
|
2649
2649
|
se.div,
|
|
@@ -2670,7 +2670,7 @@ function rn({
|
|
|
2670
2670
|
duration: 0.15
|
|
2671
2671
|
}
|
|
2672
2672
|
},
|
|
2673
|
-
children: /* @__PURE__ */
|
|
2673
|
+
children: /* @__PURE__ */ C(
|
|
2674
2674
|
we,
|
|
2675
2675
|
{
|
|
2676
2676
|
ref: o,
|
|
@@ -2729,254 +2729,254 @@ function on({
|
|
|
2729
2729
|
notice: g,
|
|
2730
2730
|
onOpen: d,
|
|
2731
2731
|
onExpand: u,
|
|
2732
|
-
onClose:
|
|
2733
|
-
onStop:
|
|
2732
|
+
onClose: h,
|
|
2733
|
+
onStop: A,
|
|
2734
2734
|
emptyView: x,
|
|
2735
2735
|
floatingChatState: N,
|
|
2736
|
-
suggestions:
|
|
2737
|
-
clearSuggestions:
|
|
2738
|
-
onSuggestionClick:
|
|
2739
|
-
messageRenderer:
|
|
2736
|
+
suggestions: $,
|
|
2737
|
+
clearSuggestions: f,
|
|
2738
|
+
onSuggestionClick: T,
|
|
2739
|
+
messageRenderer: M,
|
|
2740
2740
|
messagesPosition: D,
|
|
2741
|
-
showAgentIcon:
|
|
2742
|
-
className:
|
|
2743
|
-
inputValue:
|
|
2744
|
-
onInputChange:
|
|
2745
|
-
draggableStates:
|
|
2741
|
+
showAgentIcon: _,
|
|
2742
|
+
className: j,
|
|
2743
|
+
inputValue: K,
|
|
2744
|
+
onInputChange: H,
|
|
2745
|
+
draggableStates: I = ["expanded"],
|
|
2746
2746
|
// Default to only expanded for backward compatibility
|
|
2747
|
-
locale:
|
|
2748
|
-
maxInputLength:
|
|
2747
|
+
locale: V = "en",
|
|
2748
|
+
maxInputLength: m = 600,
|
|
2749
2749
|
// Default to 600 characters
|
|
2750
|
-
onInputLimitExceeded:
|
|
2751
|
-
expandOnClick:
|
|
2752
|
-
expandOnHover:
|
|
2753
|
-
thinkingMessage:
|
|
2754
|
-
initialChatPosition:
|
|
2755
|
-
onChatPositionChange:
|
|
2756
|
-
onTypingStatusChange:
|
|
2757
|
-
freeDrag:
|
|
2758
|
-
initialFreeDragPosition:
|
|
2759
|
-
onFreeDragEnd:
|
|
2750
|
+
onInputLimitExceeded: z,
|
|
2751
|
+
expandOnClick: ie,
|
|
2752
|
+
expandOnHover: W = !0,
|
|
2753
|
+
thinkingMessage: Se,
|
|
2754
|
+
initialChatPosition: ge,
|
|
2755
|
+
onChatPositionChange: J,
|
|
2756
|
+
onTypingStatusChange: Ce,
|
|
2757
|
+
freeDrag: v = !1,
|
|
2758
|
+
initialFreeDragPosition: _e,
|
|
2759
|
+
onFreeDragEnd: ke
|
|
2760
2760
|
}) {
|
|
2761
|
-
const
|
|
2762
|
-
|
|
2763
|
-
_i(
|
|
2761
|
+
const me = K !== void 0, [Ve, xe] = Y(""), pe = me ? K : Ve, he = me ? H : xe, y = Za(N), De = O(!1), te = O(!1), X = O(!1), [Ee, Re] = Y(!1), [p, R] = Y(!1), [q, U] = Y(!1), ae = Ti(), [ue, Me] = Y(!1);
|
|
2762
|
+
L(() => {
|
|
2763
|
+
_i(V, {
|
|
2764
2764
|
domain: "a8c-agenttic"
|
|
2765
2765
|
}) || console.warn(
|
|
2766
|
-
`Translations could not be loaded for locale: ${
|
|
2766
|
+
`Translations could not be loaded for locale: ${V}, defaulting to English`
|
|
2767
2767
|
);
|
|
2768
|
-
}, [
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2768
|
+
}, [V]), L(() => {
|
|
2769
|
+
const k = pe.length > 0, P = q && ae && k;
|
|
2770
|
+
P !== ue && (Me(P), Ce == null || Ce(P));
|
|
2771
2771
|
}, [
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2772
|
+
q,
|
|
2773
|
+
ae,
|
|
2774
|
+
pe.length,
|
|
2775
|
+
ue,
|
|
2776
|
+
Ce
|
|
2777
2777
|
]);
|
|
2778
|
-
const
|
|
2778
|
+
const fe = w(() => {
|
|
2779
2779
|
U(!0);
|
|
2780
|
-
}, []), We =
|
|
2780
|
+
}, []), We = w(() => {
|
|
2781
2781
|
U(!1);
|
|
2782
|
-
}, []),
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
}, [
|
|
2786
|
-
|
|
2787
|
-
}, [
|
|
2788
|
-
const
|
|
2789
|
-
|
|
2790
|
-
clearTimeout(
|
|
2791
|
-
}),
|
|
2792
|
-
}, []),
|
|
2793
|
-
value:
|
|
2794
|
-
setValue:
|
|
2795
|
-
onSubmit: async (
|
|
2796
|
-
|
|
2782
|
+
}, []), Te = pe.length > m;
|
|
2783
|
+
L(() => {
|
|
2784
|
+
Te && (z == null || z());
|
|
2785
|
+
}, [Te, z]), L(() => {
|
|
2786
|
+
De.current = !1, te.current = !1, X.current = !1;
|
|
2787
|
+
}, [y.state]);
|
|
2788
|
+
const Ie = O(/* @__PURE__ */ new Set()), Pe = w(() => {
|
|
2789
|
+
Ie.current.forEach((k) => {
|
|
2790
|
+
clearTimeout(k);
|
|
2791
|
+
}), Ie.current.clear();
|
|
2792
|
+
}, []), F = Ya({
|
|
2793
|
+
value: pe,
|
|
2794
|
+
setValue: he,
|
|
2795
|
+
onSubmit: async (k) => {
|
|
2796
|
+
y.state !== "expanded" && (u == null || u()), y.setState("expanded"), await o(k);
|
|
2797
2797
|
},
|
|
2798
2798
|
isProcessing: i,
|
|
2799
|
-
isInputOverLimit:
|
|
2800
|
-
floatingChatState:
|
|
2801
|
-
}), [
|
|
2802
|
-
Ja(
|
|
2803
|
-
),
|
|
2804
|
-
freeDrag:
|
|
2805
|
-
initialFreeDragPosition:
|
|
2806
|
-
side:
|
|
2807
|
-
}),
|
|
2808
|
-
async (
|
|
2809
|
-
const
|
|
2810
|
-
if (
|
|
2811
|
-
|
|
2812
|
-
const Q =
|
|
2799
|
+
isInputOverLimit: Te,
|
|
2800
|
+
floatingChatState: y.state
|
|
2801
|
+
}), [Je, yt] = Y(56), [S, G] = Y(
|
|
2802
|
+
Ja(ge)
|
|
2803
|
+
), Z = O(null), oe = O(null), ve = O(null), { x: st, y: Ae } = qa({
|
|
2804
|
+
freeDrag: v,
|
|
2805
|
+
initialFreeDragPosition: _e,
|
|
2806
|
+
side: S
|
|
2807
|
+
}), ce = pt(st), le = pt(Ae), qe = qt(), bt = w(
|
|
2808
|
+
async (k, P) => {
|
|
2809
|
+
const B = k.prompt ?? k.label;
|
|
2810
|
+
if (k.autoSubmit) {
|
|
2811
|
+
f == null || f();
|
|
2812
|
+
const Q = B.trim();
|
|
2813
2813
|
Q && await o(Q);
|
|
2814
2814
|
} else {
|
|
2815
|
-
const Q =
|
|
2816
|
-
|
|
2815
|
+
const Q = B.endsWith(" ") ? B : `${B} `;
|
|
2816
|
+
F.setValue(Q), f == null || f(), F.textareaRef.current && (F.textareaRef.current.focus(), F.textareaRef.current.setSelectionRange(
|
|
2817
2817
|
Q.length,
|
|
2818
2818
|
Q.length
|
|
2819
2819
|
));
|
|
2820
2820
|
}
|
|
2821
|
-
|
|
2821
|
+
T == null || T(k, P);
|
|
2822
2822
|
},
|
|
2823
|
-
[
|
|
2824
|
-
), wt =
|
|
2825
|
-
|
|
2826
|
-
}, [
|
|
2827
|
-
var
|
|
2828
|
-
const
|
|
2829
|
-
return !(
|
|
2830
|
-
}, [
|
|
2831
|
-
(
|
|
2832
|
-
[
|
|
2833
|
-
), bn =
|
|
2834
|
-
if (
|
|
2835
|
-
const
|
|
2836
|
-
|
|
2837
|
-
},
|
|
2838
|
-
|
|
2823
|
+
[f, o, T, F]
|
|
2824
|
+
), wt = w(() => {
|
|
2825
|
+
De.current = !0, y.open(), d == null || d(), u == null || u();
|
|
2826
|
+
}, [y, d, u]), Xe = w(() => {
|
|
2827
|
+
var P, B, Q;
|
|
2828
|
+
const k = (B = (P = ve.current) == null ? void 0 : P.ownerDocument) == null ? void 0 : B.activeElement;
|
|
2829
|
+
return !(k && ((Q = ve.current) != null && Q.contains(k)) || pe.trim());
|
|
2830
|
+
}, [pe, ve]), Ct = w(
|
|
2831
|
+
(k) => k === "collapsed" || k === "minimized" ? b.COLLAPSED_SIZE : k === "compact" ? Je : b.EXPANDED_HEIGHT,
|
|
2832
|
+
[Je]
|
|
2833
|
+
), bn = w(() => {
|
|
2834
|
+
if (W && y.state === "collapsed" && (y.setState("compact"), y.initialState === "collapsed")) {
|
|
2835
|
+
const k = setTimeout(() => {
|
|
2836
|
+
y.state === "compact" && Xe() && y.setState("collapsed"), Ie.current.delete(k);
|
|
2837
|
+
}, b.AUTO_COLLAPSE_DELAY);
|
|
2838
|
+
Ie.current.add(k);
|
|
2839
2839
|
}
|
|
2840
|
-
}, [
|
|
2841
|
-
if (
|
|
2842
|
-
const
|
|
2843
|
-
|
|
2844
|
-
},
|
|
2845
|
-
|
|
2840
|
+
}, [y, Xe, W]), Dt = w(() => {
|
|
2841
|
+
if (y.initialState === "collapsed" && y.state === "compact" && Xe()) {
|
|
2842
|
+
const k = setTimeout(() => {
|
|
2843
|
+
y.state === "compact" && Xe() && y.setState("collapsed"), Ie.current.delete(k);
|
|
2844
|
+
}, b.AUTO_COLLAPSE_DELAY);
|
|
2845
|
+
Ie.current.add(k);
|
|
2846
2846
|
}
|
|
2847
|
-
}, [
|
|
2848
|
-
const
|
|
2849
|
-
|
|
2850
|
-
}, [
|
|
2851
|
-
|
|
2852
|
-
}, [u,
|
|
2853
|
-
|
|
2854
|
-
}, [
|
|
2855
|
-
(
|
|
2856
|
-
if (!
|
|
2847
|
+
}, [y, Xe]), Et = w(async () => {
|
|
2848
|
+
const k = F.value.trim();
|
|
2849
|
+
F.clear(), y.state !== "expanded" && (u == null || u()), y.setState("expanded"), await o(k);
|
|
2850
|
+
}, [F, o, y, u]), Rt = w(() => {
|
|
2851
|
+
X.current = !0, u == null || u(), y.setState("expanded");
|
|
2852
|
+
}, [u, y]), wn = w(() => {
|
|
2853
|
+
te.current = !0, F.clear(), y.close(), h && h();
|
|
2854
|
+
}, [F, y, h]), ze = w(
|
|
2855
|
+
(k) => {
|
|
2856
|
+
if (!ve.current || !oe.current)
|
|
2857
2857
|
return null;
|
|
2858
|
-
const
|
|
2858
|
+
const P = ve.current.getBoundingClientRect(), B = oe.current.getBoundingClientRect(), Q = window.getComputedStyle(ve.current), dt = new DOMMatrixReadOnly(Q.transform), Ut = P.x - dt.e, $e = P.y - dt.f, Qe = k ?? S, Bt = Ct(y.state), Mn = Qe === "left" ? B.left : B.right - b.COMPACT_WIDTH, An = y.state === "minimized" ? window.innerHeight - Bt : B.bottom - Bt;
|
|
2859
2859
|
return {
|
|
2860
2860
|
x: Mn - Ut,
|
|
2861
2861
|
y: An - $e
|
|
2862
2862
|
};
|
|
2863
2863
|
},
|
|
2864
|
-
[
|
|
2865
|
-
), Cn =
|
|
2866
|
-
(
|
|
2867
|
-
const
|
|
2868
|
-
if (
|
|
2864
|
+
[S, y.state, Ct]
|
|
2865
|
+
), Cn = w(
|
|
2866
|
+
(k) => {
|
|
2867
|
+
const P = k.target;
|
|
2868
|
+
if (P.ownerDocument !== document)
|
|
2869
2869
|
return;
|
|
2870
|
-
|
|
2870
|
+
P.closest(
|
|
2871
2871
|
re.NON_DRAGGABLE_SELECTORS
|
|
2872
|
-
) || (
|
|
2872
|
+
) || (k.preventDefault(), qe.start(k.nativeEvent));
|
|
2873
2873
|
},
|
|
2874
|
-
[
|
|
2875
|
-
), _n =
|
|
2874
|
+
[qe]
|
|
2875
|
+
), _n = w(() => {
|
|
2876
2876
|
R(!0);
|
|
2877
|
-
}, []), Tn =
|
|
2878
|
-
(
|
|
2879
|
-
|
|
2880
|
-
|
|
2877
|
+
}, []), Tn = w(
|
|
2878
|
+
(k, P) => {
|
|
2879
|
+
R(!1);
|
|
2880
|
+
const B = ce.get(), Q = b.COMPACT_WIDTH, dt = (window.innerWidth - Q) / 2, $e = B < dt ? "left" : "right";
|
|
2881
|
+
if (S !== $e && (G($e), ht($e), J == null || J($e)), v) {
|
|
2882
|
+
ke == null || ke({ x: ce.get(), y: le.get() });
|
|
2881
2883
|
return;
|
|
2882
2884
|
}
|
|
2883
|
-
const
|
|
2884
|
-
|
|
2885
|
-
const Qe = Ge($e);
|
|
2886
|
-
Qe && (ye(he, Qe.x, {
|
|
2885
|
+
const Qe = ze($e);
|
|
2886
|
+
Qe && (ye(ce, Qe.x, {
|
|
2887
2887
|
...re.SPRING_CONFIG,
|
|
2888
|
-
velocity:
|
|
2889
|
-
}), ye(
|
|
2888
|
+
velocity: P.velocity.x * re.VELOCITY_MULTIPLIER
|
|
2889
|
+
}), ye(le, Qe.y, {
|
|
2890
2890
|
...re.SPRING_CONFIG,
|
|
2891
|
-
velocity:
|
|
2891
|
+
velocity: P.velocity.y * re.VELOCITY_MULTIPLIER
|
|
2892
2892
|
}));
|
|
2893
2893
|
},
|
|
2894
2894
|
[
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2895
|
+
ce,
|
|
2896
|
+
le,
|
|
2897
|
+
ze,
|
|
2898
|
+
J,
|
|
2899
|
+
S,
|
|
2900
|
+
v,
|
|
2901
|
+
ke
|
|
2902
2902
|
]
|
|
2903
|
-
), Pt =
|
|
2904
|
-
|
|
2905
|
-
const
|
|
2906
|
-
if (Pt.current =
|
|
2903
|
+
), Pt = O(v);
|
|
2904
|
+
L(() => {
|
|
2905
|
+
const k = Pt.current;
|
|
2906
|
+
if (Pt.current = v, v || !k)
|
|
2907
2907
|
return;
|
|
2908
|
-
const
|
|
2909
|
-
|
|
2910
|
-
const Q =
|
|
2911
|
-
Q && (ye(
|
|
2908
|
+
const B = b.VIEWPORT_OFFSET + ce.get() + b.COMPACT_WIDTH / 2 < window.innerWidth / 2 ? "left" : "right";
|
|
2909
|
+
S !== B && (G(B), ht(B), J == null || J(B));
|
|
2910
|
+
const Q = ze(B);
|
|
2911
|
+
Q && (ye(ce, Q.x, re.SPRING_CONFIG), ye(le, Q.y, re.SPRING_CONFIG));
|
|
2912
2912
|
}, [
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2913
|
+
v,
|
|
2914
|
+
ce,
|
|
2915
|
+
le,
|
|
2916
|
+
ze,
|
|
2917
|
+
J,
|
|
2918
|
+
S
|
|
2919
2919
|
]);
|
|
2920
|
-
const lt =
|
|
2921
|
-
|
|
2922
|
-
const
|
|
2923
|
-
if ($t.current =
|
|
2920
|
+
const lt = O(null), $t = O(y.state === "minimized");
|
|
2921
|
+
L(() => {
|
|
2922
|
+
const k = $t.current, P = y.state === "minimized";
|
|
2923
|
+
if ($t.current = P, !v || P === k)
|
|
2924
2924
|
return;
|
|
2925
|
-
if (
|
|
2926
|
-
lt.current =
|
|
2927
|
-
const Q = ye(
|
|
2925
|
+
if (P) {
|
|
2926
|
+
lt.current = le.get();
|
|
2927
|
+
const Q = ye(le, 0, re.SPRING_CONFIG);
|
|
2928
2928
|
return () => Q.stop();
|
|
2929
2929
|
}
|
|
2930
2930
|
if (lt.current === null)
|
|
2931
2931
|
return;
|
|
2932
|
-
const
|
|
2933
|
-
|
|
2932
|
+
const B = ye(
|
|
2933
|
+
le,
|
|
2934
2934
|
lt.current,
|
|
2935
2935
|
re.SPRING_CONFIG
|
|
2936
2936
|
);
|
|
2937
|
-
return lt.current = null, () =>
|
|
2938
|
-
}, [
|
|
2939
|
-
const Ft =
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
}, [
|
|
2943
|
-
const
|
|
2944
|
-
if (
|
|
2945
|
-
const
|
|
2946
|
-
{ x:
|
|
2947
|
-
|
|
2948
|
-
|
|
2937
|
+
return lt.current = null, () => B.stop();
|
|
2938
|
+
}, [y.state, v, le]);
|
|
2939
|
+
const Ft = O(y.state), In = Ft.current === "compact" && y.state === "expanded";
|
|
2940
|
+
L(() => {
|
|
2941
|
+
Pe(), Ft.current = y.state;
|
|
2942
|
+
}, [y.state, Pe]), L(() => {
|
|
2943
|
+
const k = () => {
|
|
2944
|
+
if (v) {
|
|
2945
|
+
const B = Ot(
|
|
2946
|
+
{ x: ce.get(), y: le.get() },
|
|
2947
|
+
b.COMPACT_WIDTH,
|
|
2948
|
+
b.EXPANDED_HEIGHT
|
|
2949
2949
|
);
|
|
2950
|
-
|
|
2950
|
+
ce.set(B.x), le.set(B.y);
|
|
2951
2951
|
return;
|
|
2952
2952
|
}
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2953
|
+
const P = ze();
|
|
2954
|
+
P && (ce.set(P.x), y.state !== "minimized" && le.set(P.y));
|
|
2955
2955
|
};
|
|
2956
|
-
return window.addEventListener("resize",
|
|
2957
|
-
}, [
|
|
2958
|
-
const
|
|
2956
|
+
return window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
|
|
2957
|
+
}, [y.state, ce, le, ze, v]), L(() => {
|
|
2958
|
+
const k = Ie.current;
|
|
2959
2959
|
return () => {
|
|
2960
|
-
|
|
2961
|
-
clearTimeout(
|
|
2962
|
-
}),
|
|
2960
|
+
k.forEach((P) => {
|
|
2961
|
+
clearTimeout(P);
|
|
2962
|
+
}), k.clear();
|
|
2963
2963
|
};
|
|
2964
|
-
}, []),
|
|
2965
|
-
if (
|
|
2966
|
-
const
|
|
2967
|
-
|
|
2964
|
+
}, []), L(() => {
|
|
2965
|
+
if (y.state === "compact" && Z.current) {
|
|
2966
|
+
const k = Z.current.scrollHeight + b.PADDING;
|
|
2967
|
+
yt(k);
|
|
2968
2968
|
}
|
|
2969
|
-
}, [
|
|
2970
|
-
const Sn = x && ["floating", "embedded"].includes(c) && e.length === 0 &&
|
|
2969
|
+
}, [y.state, F.value]);
|
|
2970
|
+
const Sn = x && ["floating", "embedded"].includes(c) && e.length === 0 && ne.isValidElement(x) ? ne.cloneElement(x, {
|
|
2971
2971
|
onSuggestionClick: bt
|
|
2972
|
-
}) : void 0, kn =
|
|
2972
|
+
}) : void 0, kn = Te ? {
|
|
2973
2973
|
message: je(
|
|
2974
2974
|
/* translators: %d: maximum number of characters allowed */
|
|
2975
2975
|
E(
|
|
2976
2976
|
"Message is too long. Please keep it under %d characters.",
|
|
2977
2977
|
"a8c-agenttic"
|
|
2978
2978
|
),
|
|
2979
|
-
|
|
2979
|
+
m
|
|
2980
2980
|
),
|
|
2981
2981
|
dismissible: !1,
|
|
2982
2982
|
status: "error"
|
|
@@ -2986,103 +2986,103 @@ function on({
|
|
|
2986
2986
|
isProcessing: i,
|
|
2987
2987
|
error: n,
|
|
2988
2988
|
// Input state
|
|
2989
|
-
inputValue:
|
|
2990
|
-
setInputValue:
|
|
2991
|
-
clearInput:
|
|
2992
|
-
textareaRef:
|
|
2993
|
-
handleKeyDown:
|
|
2989
|
+
inputValue: F.value,
|
|
2990
|
+
setInputValue: F.setValue,
|
|
2991
|
+
clearInput: F.clear,
|
|
2992
|
+
textareaRef: F.textareaRef,
|
|
2993
|
+
handleKeyDown: F.handleKeyDown,
|
|
2994
2994
|
// Actions
|
|
2995
2995
|
onSubmit: o,
|
|
2996
2996
|
handleSubmit: Et,
|
|
2997
|
-
onStop:
|
|
2997
|
+
onStop: A,
|
|
2998
2998
|
// UI state
|
|
2999
2999
|
variant: c,
|
|
3000
3000
|
placeholder: l,
|
|
3001
3001
|
emptyView: Sn,
|
|
3002
|
-
messageRenderer:
|
|
3002
|
+
messageRenderer: M,
|
|
3003
3003
|
messagesPosition: D,
|
|
3004
|
-
showAgentIcon:
|
|
3004
|
+
showAgentIcon: _,
|
|
3005
3005
|
// Floating chat specific
|
|
3006
|
-
floatingChatState:
|
|
3006
|
+
floatingChatState: y.state,
|
|
3007
3007
|
triggerIcon: r,
|
|
3008
3008
|
onOpen: wt,
|
|
3009
3009
|
onExpand: Rt,
|
|
3010
3010
|
onClose: wn,
|
|
3011
3011
|
// Suggestions
|
|
3012
|
-
suggestions:
|
|
3013
|
-
clearSuggestions:
|
|
3012
|
+
suggestions: $,
|
|
3013
|
+
clearSuggestions: f,
|
|
3014
3014
|
handleSuggestionSubmit: bt,
|
|
3015
3015
|
// Notice
|
|
3016
3016
|
notice: kn,
|
|
3017
3017
|
// Thinking message
|
|
3018
|
-
thinkingMessage:
|
|
3018
|
+
thinkingMessage: Se,
|
|
3019
3019
|
// Internal state for components
|
|
3020
|
-
focusOnMount:
|
|
3020
|
+
focusOnMount: X.current,
|
|
3021
3021
|
fromCompact: In,
|
|
3022
|
-
showExpandButton: !
|
|
3022
|
+
showExpandButton: !F.value.trim(),
|
|
3023
3023
|
// Input validation
|
|
3024
|
-
isInputOverLimit:
|
|
3024
|
+
isInputOverLimit: Te,
|
|
3025
3025
|
// Focus handlers for typing status
|
|
3026
|
-
onInputFocus:
|
|
3026
|
+
onInputFocus: fe,
|
|
3027
3027
|
onInputBlur: We
|
|
3028
3028
|
};
|
|
3029
3029
|
return c === "embedded" ? /* @__PURE__ */ a(Vt, { value: jt, children: /* @__PURE__ */ a(
|
|
3030
3030
|
"div",
|
|
3031
3031
|
{
|
|
3032
3032
|
"data-slot": "chat-embedded",
|
|
3033
|
-
className:
|
|
3034
|
-
|
|
3033
|
+
className: de(
|
|
3034
|
+
j,
|
|
3035
3035
|
be.container,
|
|
3036
3036
|
be.embedded
|
|
3037
3037
|
),
|
|
3038
3038
|
children: t
|
|
3039
3039
|
}
|
|
3040
|
-
) }) : /* @__PURE__ */
|
|
3040
|
+
) }) : /* @__PURE__ */ C(Vt, { value: jt, children: [
|
|
3041
3041
|
/* @__PURE__ */ a(
|
|
3042
3042
|
"div",
|
|
3043
3043
|
{
|
|
3044
|
-
ref:
|
|
3044
|
+
ref: oe,
|
|
3045
3045
|
style: {
|
|
3046
3046
|
position: "fixed",
|
|
3047
|
-
top:
|
|
3048
|
-
left:
|
|
3049
|
-
right:
|
|
3050
|
-
bottom:
|
|
3047
|
+
top: b.VIEWPORT_OFFSET,
|
|
3048
|
+
left: b.VIEWPORT_OFFSET,
|
|
3049
|
+
right: b.VIEWPORT_OFFSET,
|
|
3050
|
+
bottom: b.VIEWPORT_OFFSET,
|
|
3051
3051
|
pointerEvents: "none"
|
|
3052
3052
|
}
|
|
3053
3053
|
}
|
|
3054
3054
|
),
|
|
3055
|
-
|
|
3055
|
+
p && /* @__PURE__ */ a(Cr, {}),
|
|
3056
3056
|
/* @__PURE__ */ a(
|
|
3057
3057
|
se.div,
|
|
3058
3058
|
{
|
|
3059
|
-
ref:
|
|
3059
|
+
ref: ve,
|
|
3060
3060
|
"data-slot": "chat-floating",
|
|
3061
|
-
className:
|
|
3062
|
-
[be.expanded]:
|
|
3063
|
-
animating:
|
|
3061
|
+
className: de(j, be.container, be.floating, {
|
|
3062
|
+
[be.expanded]: y.state === "expanded",
|
|
3063
|
+
animating: Ee
|
|
3064
3064
|
}),
|
|
3065
|
-
onMouseLeave:
|
|
3066
|
-
drag:
|
|
3067
|
-
dragControls:
|
|
3065
|
+
onMouseLeave: y.state === "compact" ? Dt : void 0,
|
|
3066
|
+
drag: I.includes(y.state),
|
|
3067
|
+
dragControls: qe,
|
|
3068
3068
|
dragListener: !1,
|
|
3069
|
-
dragConstraints:
|
|
3069
|
+
dragConstraints: p ? oe : !1,
|
|
3070
3070
|
dragMomentum: !1,
|
|
3071
|
-
dragElastic:
|
|
3071
|
+
dragElastic: v ? 0 : 0.1,
|
|
3072
3072
|
dragTransition: { power: 0.1, timeConstant: 100 },
|
|
3073
3073
|
onDragStart: _n,
|
|
3074
3074
|
onDragEnd: Tn,
|
|
3075
3075
|
onPointerDown: Cn,
|
|
3076
3076
|
initial: !1,
|
|
3077
3077
|
animate: {
|
|
3078
|
-
bottom:
|
|
3078
|
+
bottom: y.state === "minimized" ? 0 : b.VIEWPORT_OFFSET
|
|
3079
3079
|
},
|
|
3080
3080
|
transition: He,
|
|
3081
3081
|
style: {
|
|
3082
|
-
x:
|
|
3083
|
-
y:
|
|
3084
|
-
left:
|
|
3085
|
-
cursor:
|
|
3082
|
+
x: ce,
|
|
3083
|
+
y: le,
|
|
3084
|
+
left: b.VIEWPORT_OFFSET,
|
|
3085
|
+
cursor: I.includes(y.state) ? "grab" : "default"
|
|
3086
3086
|
},
|
|
3087
3087
|
children: /* @__PURE__ */ a(
|
|
3088
3088
|
se.div,
|
|
@@ -3091,64 +3091,64 @@ function on({
|
|
|
3091
3091
|
className: be.content,
|
|
3092
3092
|
initial: !1,
|
|
3093
3093
|
animate: {
|
|
3094
|
-
width:
|
|
3095
|
-
height: Ct(
|
|
3096
|
-
x:
|
|
3097
|
-
borderBottomLeftRadius:
|
|
3098
|
-
borderBottomRightRadius:
|
|
3099
|
-
transition:
|
|
3094
|
+
width: y.state === "collapsed" ? b.COLLAPSED_SIZE : b.COMPACT_WIDTH,
|
|
3095
|
+
height: Ct(y.state),
|
|
3096
|
+
x: y.state === "collapsed" && S === "right" ? b.COMPACT_WIDTH - b.COLLAPSED_SIZE : 0,
|
|
3097
|
+
borderBottomLeftRadius: y.state === "minimized" ? 0 : b.BORDER_RADIUS,
|
|
3098
|
+
borderBottomRightRadius: y.state === "minimized" ? 0 : b.BORDER_RADIUS,
|
|
3099
|
+
transition: F.value.trim() ? { duration: 0 } : He
|
|
3100
3100
|
},
|
|
3101
|
-
onAnimationStart: () =>
|
|
3102
|
-
onAnimationComplete: () =>
|
|
3101
|
+
onAnimationStart: () => Re(!0),
|
|
3102
|
+
onAnimationComplete: () => Re(!1),
|
|
3103
3103
|
style: {
|
|
3104
|
-
borderTopLeftRadius:
|
|
3105
|
-
borderTopRightRadius:
|
|
3104
|
+
borderTopLeftRadius: b.BORDER_RADIUS,
|
|
3105
|
+
borderTopRightRadius: b.BORDER_RADIUS
|
|
3106
3106
|
},
|
|
3107
|
-
children: /* @__PURE__ */
|
|
3108
|
-
|
|
3107
|
+
children: /* @__PURE__ */ C(ct, { mode: "wait", children: [
|
|
3108
|
+
y.state === "collapsed" && /* @__PURE__ */ a(
|
|
3109
3109
|
en,
|
|
3110
3110
|
{
|
|
3111
3111
|
icon: r,
|
|
3112
3112
|
onClick: wt,
|
|
3113
3113
|
onHover: bn,
|
|
3114
|
-
focusOnMount:
|
|
3114
|
+
focusOnMount: te.current
|
|
3115
3115
|
},
|
|
3116
3116
|
"collapsed"
|
|
3117
3117
|
),
|
|
3118
|
-
|
|
3118
|
+
y.state === "minimized" && /* @__PURE__ */ a(
|
|
3119
3119
|
rn,
|
|
3120
3120
|
{
|
|
3121
3121
|
icon: r,
|
|
3122
3122
|
title: s,
|
|
3123
3123
|
onClick: wt,
|
|
3124
|
-
focusOnMount:
|
|
3124
|
+
focusOnMount: te.current
|
|
3125
3125
|
},
|
|
3126
3126
|
"minimized"
|
|
3127
3127
|
),
|
|
3128
|
-
|
|
3128
|
+
y.state === "compact" && /* @__PURE__ */ a("div", { ref: Z, children: /* @__PURE__ */ a(
|
|
3129
3129
|
nn,
|
|
3130
3130
|
{
|
|
3131
|
-
value:
|
|
3132
|
-
onChange:
|
|
3131
|
+
value: F.value,
|
|
3132
|
+
onChange: F.setValue,
|
|
3133
3133
|
onSubmit: Et,
|
|
3134
|
-
onKeyDown:
|
|
3135
|
-
textareaRef:
|
|
3134
|
+
onKeyDown: F.handleKeyDown,
|
|
3135
|
+
textareaRef: F.textareaRef,
|
|
3136
3136
|
placeholder: l,
|
|
3137
3137
|
isProcessing: i,
|
|
3138
3138
|
onBlur: Dt,
|
|
3139
|
-
onFocus:
|
|
3139
|
+
onFocus: fe,
|
|
3140
3140
|
onExpand: Rt,
|
|
3141
|
-
showExpandButton: !
|
|
3142
|
-
focusOnMount:
|
|
3143
|
-
onStop:
|
|
3144
|
-
suggestions:
|
|
3145
|
-
clearSuggestions:
|
|
3141
|
+
showExpandButton: !F.value.trim(),
|
|
3142
|
+
focusOnMount: De.current,
|
|
3143
|
+
onStop: A,
|
|
3144
|
+
suggestions: $,
|
|
3145
|
+
clearSuggestions: f,
|
|
3146
3146
|
handleSuggestionSubmit: bt,
|
|
3147
|
-
expandOnClick:
|
|
3147
|
+
expandOnClick: ie
|
|
3148
3148
|
},
|
|
3149
3149
|
"compact"
|
|
3150
3150
|
) }),
|
|
3151
|
-
|
|
3151
|
+
y.state === "expanded" && t
|
|
3152
3152
|
] })
|
|
3153
3153
|
}
|
|
3154
3154
|
)
|
|
@@ -3202,7 +3202,7 @@ function sn({ onClose: t, className: e }) {
|
|
|
3202
3202
|
);
|
|
3203
3203
|
}
|
|
3204
3204
|
function St({ className: t } = {}) {
|
|
3205
|
-
const { onClose: e } =
|
|
3205
|
+
const { onClose: e } = Ne();
|
|
3206
3206
|
return /* @__PURE__ */ a(sn, { onClose: e, className: t });
|
|
3207
3207
|
}
|
|
3208
3208
|
const Ir = 0.12, Sr = 1;
|
|
@@ -3210,9 +3210,9 @@ function kr({
|
|
|
3210
3210
|
scrollAreaRef: t,
|
|
3211
3211
|
visibleMessages: e
|
|
3212
3212
|
}) {
|
|
3213
|
-
const i =
|
|
3213
|
+
const i = O(0), n = O(!0), o = O(!0), c = O(0), r = O(null), s = w(() => {
|
|
3214
3214
|
cancelAnimationFrame(c.current), c.current = 0, r.current = null;
|
|
3215
|
-
}, []), l =
|
|
3215
|
+
}, []), l = w(() => {
|
|
3216
3216
|
s();
|
|
3217
3217
|
const g = () => {
|
|
3218
3218
|
const d = t.current;
|
|
@@ -3229,16 +3229,16 @@ function kr({
|
|
|
3229
3229
|
s();
|
|
3230
3230
|
return;
|
|
3231
3231
|
}
|
|
3232
|
-
const
|
|
3233
|
-
if (
|
|
3232
|
+
const h = u - d.scrollTop;
|
|
3233
|
+
if (h <= Sr) {
|
|
3234
3234
|
d.scrollTop = u, s();
|
|
3235
3235
|
return;
|
|
3236
3236
|
}
|
|
3237
|
-
d.scrollTop += Math.ceil(
|
|
3237
|
+
d.scrollTop += Math.ceil(h * Ir), r.current = d.scrollTop, c.current = requestAnimationFrame(g);
|
|
3238
3238
|
};
|
|
3239
3239
|
c.current = requestAnimationFrame(g);
|
|
3240
3240
|
}, [t, s]);
|
|
3241
|
-
|
|
3241
|
+
L(() => {
|
|
3242
3242
|
const g = t.current;
|
|
3243
3243
|
if (!g)
|
|
3244
3244
|
return;
|
|
@@ -3252,7 +3252,7 @@ function kr({
|
|
|
3252
3252
|
}), () => {
|
|
3253
3253
|
g.removeEventListener("wheel", d), g.removeEventListener("touchmove", d);
|
|
3254
3254
|
};
|
|
3255
|
-
}, [t, s]),
|
|
3255
|
+
}, [t, s]), L(() => s, [s]), L(() => {
|
|
3256
3256
|
const g = t.current;
|
|
3257
3257
|
if (!g || e.length === 0) {
|
|
3258
3258
|
i.current = e.length;
|
|
@@ -3283,7 +3283,7 @@ function Mr(t) {
|
|
|
3283
3283
|
return (i == null ? void 0 : i.offsetTop) ?? null;
|
|
3284
3284
|
}
|
|
3285
3285
|
function Ar({ className: t, size: e = 28 }) {
|
|
3286
|
-
return /* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ C(
|
|
3287
3287
|
"svg",
|
|
3288
3288
|
{
|
|
3289
3289
|
className: t,
|
|
@@ -3368,7 +3368,7 @@ function zt({
|
|
|
3368
3368
|
}
|
|
3369
3369
|
);
|
|
3370
3370
|
}
|
|
3371
|
-
const Lr = "Message-module_message", Nr = "Message-module_user", xr = "Message-module_bubble", Dr = "Message-module_error", Er = "Message-module_icon", Rr = "Message-module_content", Pr = "Message-module_disabled",
|
|
3371
|
+
const Lr = "Message-module_message", Nr = "Message-module_user", xr = "Message-module_bubble", Dr = "Message-module_error", Er = "Message-module_icon", Rr = "Message-module_content", Pr = "Message-module_disabled", Ge = {
|
|
3372
3372
|
message: Lr,
|
|
3373
3373
|
user: Nr,
|
|
3374
3374
|
bubble: xr,
|
|
@@ -3376,7 +3376,7 @@ const Lr = "Message-module_message", Nr = "Message-module_user", xr = "Message-m
|
|
|
3376
3376
|
icon: Er,
|
|
3377
3377
|
content: Rr,
|
|
3378
3378
|
disabled: Pr
|
|
3379
|
-
}, $r =
|
|
3379
|
+
}, $r = ne.forwardRef(
|
|
3380
3380
|
function({
|
|
3381
3381
|
message: e,
|
|
3382
3382
|
messageRenderer: i = At,
|
|
@@ -3384,7 +3384,7 @@ const Lr = "Message-module_message", Nr = "Message-module_user", xr = "Message-m
|
|
|
3384
3384
|
}, o) {
|
|
3385
3385
|
const c = Array.isArray(e.content) ? e.content : [], r = n && e.role !== "user" && e.showIcon && c.some(
|
|
3386
3386
|
(l) => l.type === "text" && !!l.text
|
|
3387
|
-
), s = () => /* @__PURE__ */ a(
|
|
3387
|
+
), s = () => /* @__PURE__ */ a(Ke, { children: c.map((l, g) => {
|
|
3388
3388
|
if (l.type === "text" && l.text)
|
|
3389
3389
|
return /* @__PURE__ */ a(i, { children: l.text }, g);
|
|
3390
3390
|
if (l.type === "component" && l.component) {
|
|
@@ -3399,7 +3399,7 @@ const Lr = "Message-module_message", Nr = "Message-module_user", xr = "Message-m
|
|
|
3399
3399
|
}
|
|
3400
3400
|
return null;
|
|
3401
3401
|
}) });
|
|
3402
|
-
return /* @__PURE__ */
|
|
3402
|
+
return /* @__PURE__ */ C(
|
|
3403
3403
|
se.div,
|
|
3404
3404
|
{
|
|
3405
3405
|
ref: o,
|
|
@@ -3408,23 +3408,23 @@ const Lr = "Message-module_message", Nr = "Message-module_user", xr = "Message-m
|
|
|
3408
3408
|
animate: "visible",
|
|
3409
3409
|
"data-slot": "message",
|
|
3410
3410
|
"data-role": e.role,
|
|
3411
|
-
className:
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
e.disabled ?
|
|
3411
|
+
className: de(
|
|
3412
|
+
Ge.message,
|
|
3413
|
+
Ge[e.role],
|
|
3414
|
+
e.disabled ? Ge.disabled : void 0
|
|
3415
3415
|
),
|
|
3416
3416
|
children: [
|
|
3417
|
-
r && /* @__PURE__ */ a("div", { className:
|
|
3418
|
-
/* @__PURE__ */
|
|
3417
|
+
r && /* @__PURE__ */ a("div", { className: Ge.icon, "aria-hidden": "true", children: /* @__PURE__ */ a(Ar, { size: 28 }) }),
|
|
3418
|
+
/* @__PURE__ */ C(
|
|
3419
3419
|
"div",
|
|
3420
3420
|
{
|
|
3421
|
-
className:
|
|
3421
|
+
className: Ge.content,
|
|
3422
3422
|
title: e.disabled ? E(
|
|
3423
3423
|
"This action is no longer available or cannot be performed",
|
|
3424
3424
|
"a8c-agenttic"
|
|
3425
3425
|
) : void 0,
|
|
3426
3426
|
children: [
|
|
3427
|
-
/* @__PURE__ */ a("div", { className:
|
|
3427
|
+
/* @__PURE__ */ a("div", { className: Ge.bubble, children: s() }),
|
|
3428
3428
|
e.role !== "user" && /* @__PURE__ */ a(zt, { message: e })
|
|
3429
3429
|
]
|
|
3430
3430
|
}
|
|
@@ -3442,12 +3442,12 @@ const Lr = "Message-module_message", Nr = "Message-module_user", xr = "Message-m
|
|
|
3442
3442
|
icon: Br,
|
|
3443
3443
|
content: Hr
|
|
3444
3444
|
}, Vr = Kt(
|
|
3445
|
-
|
|
3445
|
+
ne.forwardRef(
|
|
3446
3446
|
function({
|
|
3447
3447
|
content: e = E("Thinking…", "a8c-agenttic")
|
|
3448
3448
|
}, i) {
|
|
3449
3449
|
const n = ot(() => /* @__PURE__ */ a(Lt, {}), []);
|
|
3450
|
-
return /* @__PURE__ */
|
|
3450
|
+
return /* @__PURE__ */ C(
|
|
3451
3451
|
"div",
|
|
3452
3452
|
{
|
|
3453
3453
|
ref: i,
|
|
@@ -3477,19 +3477,19 @@ function ln({
|
|
|
3477
3477
|
messagesPosition: r = "top",
|
|
3478
3478
|
showAgentIcon: s
|
|
3479
3479
|
}) {
|
|
3480
|
-
const l =
|
|
3480
|
+
const l = O(null), g = Wr(t);
|
|
3481
3481
|
kr({ scrollAreaRef: l, visibleMessages: g });
|
|
3482
3482
|
const d = ot(() => {
|
|
3483
|
-
const
|
|
3483
|
+
const A = g.filter(
|
|
3484
3484
|
(N) => N.role === "agent"
|
|
3485
3485
|
);
|
|
3486
|
-
return
|
|
3487
|
-
}, [g]), [u] = Rn(d, 1e3),
|
|
3486
|
+
return A.length ? A[A.length - 1].content.filter((N) => N.type === "text").map((N) => N.text).join(" ") : "";
|
|
3487
|
+
}, [g]), [u] = Rn(d, 1e3), h = d !== u;
|
|
3488
3488
|
return g.length === 0 && !e ? n ? /* @__PURE__ */ a(
|
|
3489
3489
|
"div",
|
|
3490
3490
|
{
|
|
3491
3491
|
"data-slot": "messages",
|
|
3492
|
-
className:
|
|
3492
|
+
className: de(
|
|
3493
3493
|
at.container,
|
|
3494
3494
|
at.emptyState,
|
|
3495
3495
|
r === "bottom" ? at.bottomMessages : ""
|
|
@@ -3497,7 +3497,7 @@ function ln({
|
|
|
3497
3497
|
ref: l,
|
|
3498
3498
|
children: n
|
|
3499
3499
|
}
|
|
3500
|
-
) : null : /* @__PURE__ */
|
|
3500
|
+
) : null : /* @__PURE__ */ C(Ke, { children: [
|
|
3501
3501
|
/* @__PURE__ */ a(
|
|
3502
3502
|
"div",
|
|
3503
3503
|
{
|
|
@@ -3517,22 +3517,22 @@ function ln({
|
|
|
3517
3517
|
"div",
|
|
3518
3518
|
{
|
|
3519
3519
|
"data-slot": "messages",
|
|
3520
|
-
className:
|
|
3520
|
+
className: de(
|
|
3521
3521
|
at.container,
|
|
3522
3522
|
r === "bottom" ? at.bottomMessages : ""
|
|
3523
3523
|
),
|
|
3524
3524
|
ref: l,
|
|
3525
|
-
children: /* @__PURE__ */
|
|
3526
|
-
g.map((
|
|
3525
|
+
children: /* @__PURE__ */ C(ct, { mode: "popLayout", children: [
|
|
3526
|
+
g.map((A) => /* @__PURE__ */ a(
|
|
3527
3527
|
$r,
|
|
3528
3528
|
{
|
|
3529
|
-
message:
|
|
3529
|
+
message: A,
|
|
3530
3530
|
messageRenderer: o,
|
|
3531
3531
|
showAgentIcon: s
|
|
3532
3532
|
},
|
|
3533
|
-
|
|
3533
|
+
A.reactKey || A.id
|
|
3534
3534
|
)),
|
|
3535
|
-
e && !
|
|
3535
|
+
e && !h && /* @__PURE__ */ a(Vr, { content: c }),
|
|
3536
3536
|
i && /* @__PURE__ */ a(
|
|
3537
3537
|
"div",
|
|
3538
3538
|
{
|
|
@@ -3560,7 +3560,7 @@ function dn({ className: t } = {}) {
|
|
|
3560
3560
|
messagesPosition: r,
|
|
3561
3561
|
showAgentIcon: s,
|
|
3562
3562
|
thinkingMessage: l
|
|
3563
|
-
} =
|
|
3563
|
+
} = Ne();
|
|
3564
3564
|
return /* @__PURE__ */ a(
|
|
3565
3565
|
ln,
|
|
3566
3566
|
{
|
|
@@ -3611,23 +3611,23 @@ function un({
|
|
|
3611
3611
|
handleSubmit: g,
|
|
3612
3612
|
handleKeyDown: d,
|
|
3613
3613
|
textareaRef: u,
|
|
3614
|
-
placeholder:
|
|
3615
|
-
isProcessing:
|
|
3614
|
+
placeholder: h,
|
|
3615
|
+
isProcessing: A,
|
|
3616
3616
|
onStop: x,
|
|
3617
3617
|
fromCompact: N,
|
|
3618
|
-
onExpand:
|
|
3619
|
-
showExpandButton:
|
|
3620
|
-
focusOnMount:
|
|
3621
|
-
onInputFocus:
|
|
3618
|
+
onExpand: $,
|
|
3619
|
+
showExpandButton: f,
|
|
3620
|
+
focusOnMount: T,
|
|
3621
|
+
onInputFocus: M,
|
|
3622
3622
|
onInputBlur: D
|
|
3623
|
-
} =
|
|
3624
|
-
o == null || o(
|
|
3625
|
-
},
|
|
3623
|
+
} = Ne(), _ = (H) => {
|
|
3624
|
+
o == null || o(H), !H.defaultPrevented && d(H);
|
|
3625
|
+
}, j = ot(() => r ? [{
|
|
3626
3626
|
id: "image-upload",
|
|
3627
3627
|
icon: /* @__PURE__ */ a(zr, {}),
|
|
3628
3628
|
onClick: () => {
|
|
3629
|
-
var
|
|
3630
|
-
return (
|
|
3629
|
+
var I;
|
|
3630
|
+
return (I = r.current) == null ? void 0 : I.openFileDialog();
|
|
3631
3631
|
},
|
|
3632
3632
|
variant: "ghost",
|
|
3633
3633
|
"aria-label": E("Upload image", "a8c-agenttic")
|
|
@@ -3638,19 +3638,19 @@ function un({
|
|
|
3638
3638
|
value: s,
|
|
3639
3639
|
onChange: l,
|
|
3640
3640
|
onSubmit: g,
|
|
3641
|
-
onKeyDown:
|
|
3642
|
-
onFocus:
|
|
3641
|
+
onKeyDown: _,
|
|
3642
|
+
onFocus: M,
|
|
3643
3643
|
onBlur: D,
|
|
3644
3644
|
textareaRef: u,
|
|
3645
|
-
placeholder:
|
|
3646
|
-
isProcessing:
|
|
3645
|
+
placeholder: h,
|
|
3646
|
+
isProcessing: A,
|
|
3647
3647
|
onStop: x,
|
|
3648
3648
|
fromCompact: N,
|
|
3649
|
-
onExpand:
|
|
3650
|
-
showExpandButton:
|
|
3651
|
-
focusOnMount:
|
|
3649
|
+
onExpand: $,
|
|
3650
|
+
showExpandButton: f,
|
|
3651
|
+
focusOnMount: T,
|
|
3652
3652
|
disabled: e,
|
|
3653
|
-
customActions:
|
|
3653
|
+
customActions: j,
|
|
3654
3654
|
actionOrder: n,
|
|
3655
3655
|
className: t,
|
|
3656
3656
|
layout: c ?? (r ? "stacked" : "inline")
|
|
@@ -3669,13 +3669,13 @@ function gn({
|
|
|
3669
3669
|
messages: r,
|
|
3670
3670
|
variant: s,
|
|
3671
3671
|
emptyView: l
|
|
3672
|
-
} =
|
|
3672
|
+
} = Ne(), g = w(
|
|
3673
3673
|
(d, u) => {
|
|
3674
3674
|
try {
|
|
3675
|
-
const
|
|
3676
|
-
i == null || i(
|
|
3677
|
-
} catch (
|
|
3678
|
-
console.warn("Suggestions onSelect callback failed:",
|
|
3675
|
+
const h = d.prompt ?? d.label;
|
|
3676
|
+
i == null || i(h);
|
|
3677
|
+
} catch (h) {
|
|
3678
|
+
console.warn("Suggestions onSelect callback failed:", h);
|
|
3679
3679
|
}
|
|
3680
3680
|
o(d, u);
|
|
3681
3681
|
},
|
|
@@ -3691,7 +3691,7 @@ function gn({
|
|
|
3691
3691
|
);
|
|
3692
3692
|
}
|
|
3693
3693
|
function Gr({ className: t, size: e = 18 }) {
|
|
3694
|
-
return /* @__PURE__ */
|
|
3694
|
+
return /* @__PURE__ */ C(
|
|
3695
3695
|
"svg",
|
|
3696
3696
|
{
|
|
3697
3697
|
width: e,
|
|
@@ -3725,7 +3725,7 @@ function Gr({ className: t, size: e = 18 }) {
|
|
|
3725
3725
|
);
|
|
3726
3726
|
}
|
|
3727
3727
|
function Zr({ className: t, size: e = 18 }) {
|
|
3728
|
-
return /* @__PURE__ */
|
|
3728
|
+
return /* @__PURE__ */ C(
|
|
3729
3729
|
"svg",
|
|
3730
3730
|
{
|
|
3731
3731
|
width: e,
|
|
@@ -3764,7 +3764,7 @@ function Zr({ className: t, size: e = 18 }) {
|
|
|
3764
3764
|
}
|
|
3765
3765
|
);
|
|
3766
3766
|
}
|
|
3767
|
-
const Yr = "Notice-module_container", Kr = "Notice-module_isSuccess", Jr = "Notice-module_icon", qr = "Notice-module_isWarning", Xr = "Notice-module_isError", Qr = "Notice-module_content", eo = "Notice-module_actions", to = "Notice-module_action", ao = "Notice-module_dismissible",
|
|
3767
|
+
const Yr = "Notice-module_container", Kr = "Notice-module_isSuccess", Jr = "Notice-module_icon", qr = "Notice-module_isWarning", Xr = "Notice-module_isError", Qr = "Notice-module_content", eo = "Notice-module_actions", to = "Notice-module_action", ao = "Notice-module_dismissible", Oe = {
|
|
3768
3768
|
container: Yr,
|
|
3769
3769
|
isSuccess: Kr,
|
|
3770
3770
|
icon: Jr,
|
|
@@ -3784,8 +3784,8 @@ function mn({
|
|
|
3784
3784
|
className: c,
|
|
3785
3785
|
status: r
|
|
3786
3786
|
}) {
|
|
3787
|
-
const l =
|
|
3788
|
-
if (
|
|
3787
|
+
const l = w(() => {
|
|
3788
|
+
if (ne.isValidElement(t))
|
|
3789
3789
|
return t;
|
|
3790
3790
|
if (t === !1 || t === null)
|
|
3791
3791
|
return null;
|
|
@@ -3798,22 +3798,22 @@ function mn({
|
|
|
3798
3798
|
return null;
|
|
3799
3799
|
}
|
|
3800
3800
|
}, [t, r])();
|
|
3801
|
-
return /* @__PURE__ */
|
|
3801
|
+
return /* @__PURE__ */ C(
|
|
3802
3802
|
"div",
|
|
3803
3803
|
{
|
|
3804
3804
|
"data-slot": "notice",
|
|
3805
|
-
className:
|
|
3806
|
-
|
|
3805
|
+
className: de(
|
|
3806
|
+
Oe.container,
|
|
3807
3807
|
{
|
|
3808
|
-
[
|
|
3809
|
-
[
|
|
3810
|
-
[
|
|
3808
|
+
[Oe.isSuccess]: r === "success",
|
|
3809
|
+
[Oe.isWarning]: r === "warning",
|
|
3810
|
+
[Oe.isError]: r === "error"
|
|
3811
3811
|
},
|
|
3812
3812
|
c
|
|
3813
3813
|
),
|
|
3814
3814
|
children: [
|
|
3815
|
-
/* @__PURE__ */
|
|
3816
|
-
l && /* @__PURE__ */ a("div", { className:
|
|
3815
|
+
/* @__PURE__ */ C("div", { className: Oe.content, children: [
|
|
3816
|
+
l && /* @__PURE__ */ a("div", { className: Oe.icon, children: l }),
|
|
3817
3817
|
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
3818
3818
|
At,
|
|
3819
3819
|
{
|
|
@@ -3834,11 +3834,11 @@ function mn({
|
|
|
3834
3834
|
}
|
|
3835
3835
|
) })
|
|
3836
3836
|
] }),
|
|
3837
|
-
/* @__PURE__ */
|
|
3837
|
+
/* @__PURE__ */ C("div", { className: Oe.actions, children: [
|
|
3838
3838
|
i && /* @__PURE__ */ a(
|
|
3839
3839
|
we,
|
|
3840
3840
|
{
|
|
3841
|
-
className:
|
|
3841
|
+
className: Oe.action,
|
|
3842
3842
|
onClick: i.onClick,
|
|
3843
3843
|
variant: "link",
|
|
3844
3844
|
children: i.label
|
|
@@ -3847,7 +3847,7 @@ function mn({
|
|
|
3847
3847
|
n && o && /* @__PURE__ */ a(
|
|
3848
3848
|
we,
|
|
3849
3849
|
{
|
|
3850
|
-
className:
|
|
3850
|
+
className: Oe.dismissible,
|
|
3851
3851
|
onClick: o,
|
|
3852
3852
|
variant: "ghost",
|
|
3853
3853
|
size: "sm",
|
|
@@ -3860,7 +3860,7 @@ function mn({
|
|
|
3860
3860
|
);
|
|
3861
3861
|
}
|
|
3862
3862
|
function pn({ className: t } = {}) {
|
|
3863
|
-
const { notice: e } =
|
|
3863
|
+
const { notice: e } = Ne();
|
|
3864
3864
|
return e ? /* @__PURE__ */ a(
|
|
3865
3865
|
mn,
|
|
3866
3866
|
{
|
|
@@ -3885,17 +3885,17 @@ function hn({
|
|
|
3885
3885
|
se.div,
|
|
3886
3886
|
{
|
|
3887
3887
|
"data-slot": "chat-footer",
|
|
3888
|
-
className:
|
|
3888
|
+
className: de(kt.container, e),
|
|
3889
3889
|
initial: { opacity: 0, scale: 1 },
|
|
3890
3890
|
animate: { opacity: 1, scale: 1 },
|
|
3891
3891
|
transition: { ...Be },
|
|
3892
3892
|
children: t
|
|
3893
3893
|
}
|
|
3894
|
-
) : /* @__PURE__ */
|
|
3894
|
+
) : /* @__PURE__ */ C(
|
|
3895
3895
|
se.div,
|
|
3896
3896
|
{
|
|
3897
3897
|
"data-slot": "chat-footer",
|
|
3898
|
-
className:
|
|
3898
|
+
className: de(kt.container, e),
|
|
3899
3899
|
initial: { opacity: 0, scale: 1 },
|
|
3900
3900
|
animate: { opacity: 1, scale: 1 },
|
|
3901
3901
|
transition: { ...Be },
|
|
@@ -3907,7 +3907,7 @@ function hn({
|
|
|
3907
3907
|
}
|
|
3908
3908
|
);
|
|
3909
3909
|
}
|
|
3910
|
-
const io = "ConversationView-module_container", ro = "ConversationView-module_withHeader",
|
|
3910
|
+
const io = "ConversationView-module_container", ro = "ConversationView-module_withHeader", Ye = {
|
|
3911
3911
|
container: io,
|
|
3912
3912
|
withHeader: ro
|
|
3913
3913
|
}, xt = Jt(function({
|
|
@@ -3915,32 +3915,32 @@ const io = "ConversationView-module_container", ro = "ConversationView-module_wi
|
|
|
3915
3915
|
children: i,
|
|
3916
3916
|
className: n
|
|
3917
3917
|
} = {}, o) {
|
|
3918
|
-
const { onClose: c } =
|
|
3919
|
-
if (
|
|
3918
|
+
const { onClose: c } = Ne();
|
|
3919
|
+
if (L(() => {
|
|
3920
3920
|
const r = (s) => {
|
|
3921
3921
|
s.key === "Escape" && c && c();
|
|
3922
3922
|
};
|
|
3923
3923
|
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
3924
3924
|
}, [c]), i) {
|
|
3925
|
-
const r =
|
|
3926
|
-
(s) =>
|
|
3925
|
+
const r = ne.Children.toArray(i).some(
|
|
3926
|
+
(s) => ne.isValidElement(s) && (s.type === St || typeof s.type == "function" && s.type.name === "AgentUIHeader")
|
|
3927
3927
|
);
|
|
3928
3928
|
return /* @__PURE__ */ a(
|
|
3929
3929
|
"div",
|
|
3930
3930
|
{
|
|
3931
3931
|
ref: o,
|
|
3932
3932
|
"data-slot": "conversation-view",
|
|
3933
|
-
className: `${
|
|
3933
|
+
className: `${Ye.container}${r ? ` ${Ye.withHeader}` : ""}${n ? ` ${n}` : ""}`,
|
|
3934
3934
|
children: i
|
|
3935
3935
|
}
|
|
3936
3936
|
);
|
|
3937
3937
|
}
|
|
3938
|
-
return /* @__PURE__ */
|
|
3938
|
+
return /* @__PURE__ */ C(
|
|
3939
3939
|
"div",
|
|
3940
3940
|
{
|
|
3941
3941
|
ref: o,
|
|
3942
3942
|
"data-slot": "conversation-view",
|
|
3943
|
-
className: `${
|
|
3943
|
+
className: `${Ye.container}${e ? ` ${Ye.withHeader}` : ""}${n ? ` ${n}` : ""}`,
|
|
3944
3944
|
children: [
|
|
3945
3945
|
e && /* @__PURE__ */ a(St, {}),
|
|
3946
3946
|
/* @__PURE__ */ a(dn, {}),
|
|
@@ -3964,9 +3964,9 @@ function go({
|
|
|
3964
3964
|
label: n,
|
|
3965
3965
|
disabled: o
|
|
3966
3966
|
} = {}) {
|
|
3967
|
-
const [c, r] =
|
|
3968
|
-
return /* @__PURE__ */ a("div", { className: e, children: /* @__PURE__ */ a("div", { className: nt.container, children: /* @__PURE__ */
|
|
3969
|
-
/* @__PURE__ */ a(Ue.Trigger, { asChild: !0, children: /* @__PURE__ */
|
|
3967
|
+
const [c, r] = ne.useState(!1), s = n ?? "Input Toolbar";
|
|
3968
|
+
return /* @__PURE__ */ a("div", { className: e, children: /* @__PURE__ */ a("div", { className: nt.container, children: /* @__PURE__ */ C(Ue.Root, { open: c, onOpenChange: r, children: [
|
|
3969
|
+
/* @__PURE__ */ a(Ue.Trigger, { asChild: !0, children: /* @__PURE__ */ C(
|
|
3970
3970
|
"button",
|
|
3971
3971
|
{
|
|
3972
3972
|
type: "button",
|
|
@@ -4031,7 +4031,7 @@ const mo = {
|
|
|
4031
4031
|
on,
|
|
4032
4032
|
{
|
|
4033
4033
|
...t,
|
|
4034
|
-
className:
|
|
4034
|
+
className: de("agenttic", t.className),
|
|
4035
4035
|
children: /* @__PURE__ */ a(
|
|
4036
4036
|
xt,
|
|
4037
4037
|
{
|
|
@@ -4055,20 +4055,20 @@ function po({
|
|
|
4055
4055
|
onExpand: g,
|
|
4056
4056
|
disabled: d,
|
|
4057
4057
|
notice: u,
|
|
4058
|
-
suggestions:
|
|
4059
|
-
clearSuggestions:
|
|
4058
|
+
suggestions: h,
|
|
4059
|
+
clearSuggestions: A,
|
|
4060
4060
|
focusOnMount: x,
|
|
4061
4061
|
customActions: N,
|
|
4062
|
-
actionOrder:
|
|
4062
|
+
actionOrder: $
|
|
4063
4063
|
}) {
|
|
4064
|
-
const
|
|
4065
|
-
(
|
|
4066
|
-
const D =
|
|
4067
|
-
e(D),
|
|
4064
|
+
const f = w(
|
|
4065
|
+
(T, M) => {
|
|
4066
|
+
const D = T.prompt ?? T.label;
|
|
4067
|
+
e(D), A == null || A();
|
|
4068
4068
|
},
|
|
4069
|
-
[e,
|
|
4069
|
+
[e, A]
|
|
4070
4070
|
);
|
|
4071
|
-
return /* @__PURE__ */
|
|
4071
|
+
return /* @__PURE__ */ C(
|
|
4072
4072
|
se.div,
|
|
4073
4073
|
{
|
|
4074
4074
|
"data-slot": "chat-footer",
|
|
@@ -4080,8 +4080,8 @@ function po({
|
|
|
4080
4080
|
!t && /* @__PURE__ */ a(
|
|
4081
4081
|
vt,
|
|
4082
4082
|
{
|
|
4083
|
-
suggestions:
|
|
4084
|
-
onSubmit:
|
|
4083
|
+
suggestions: h,
|
|
4084
|
+
onSubmit: f
|
|
4085
4085
|
}
|
|
4086
4086
|
),
|
|
4087
4087
|
u && /* @__PURE__ */ a(
|
|
@@ -4111,7 +4111,7 @@ function po({
|
|
|
4111
4111
|
showExpandButton: !1,
|
|
4112
4112
|
focusOnMount: x,
|
|
4113
4113
|
customActions: N,
|
|
4114
|
-
actionOrder:
|
|
4114
|
+
actionOrder: $,
|
|
4115
4115
|
disabled: d
|
|
4116
4116
|
}
|
|
4117
4117
|
)
|
|
@@ -4132,28 +4132,28 @@ function Gt({
|
|
|
4132
4132
|
onStop: g,
|
|
4133
4133
|
fromCompact: d = !1,
|
|
4134
4134
|
showHeader: u = !1,
|
|
4135
|
-
onClose:
|
|
4136
|
-
onExpand:
|
|
4135
|
+
onClose: h,
|
|
4136
|
+
onExpand: A,
|
|
4137
4137
|
notice: x,
|
|
4138
4138
|
emptyView: N,
|
|
4139
|
-
suggestions:
|
|
4140
|
-
clearSuggestions:
|
|
4141
|
-
messageRenderer:
|
|
4142
|
-
showAgentIcon:
|
|
4139
|
+
suggestions: $,
|
|
4140
|
+
clearSuggestions: f,
|
|
4141
|
+
messageRenderer: T,
|
|
4142
|
+
showAgentIcon: M,
|
|
4143
4143
|
focusOnMount: D = !1
|
|
4144
4144
|
}) {
|
|
4145
|
-
return
|
|
4146
|
-
const
|
|
4147
|
-
|
|
4145
|
+
return L(() => {
|
|
4146
|
+
const _ = (j) => {
|
|
4147
|
+
j.key === "Escape" && h && h();
|
|
4148
4148
|
};
|
|
4149
|
-
return document.addEventListener("keydown",
|
|
4150
|
-
}, [
|
|
4149
|
+
return document.addEventListener("keydown", _), () => document.removeEventListener("keydown", _);
|
|
4150
|
+
}, [h]), /* @__PURE__ */ C(
|
|
4151
4151
|
"div",
|
|
4152
4152
|
{
|
|
4153
4153
|
"data-slot": "conversation-view",
|
|
4154
|
-
className: `${
|
|
4154
|
+
className: `${Ye.container}${u ? ` ${Ye.withHeader}` : ""}`,
|
|
4155
4155
|
children: [
|
|
4156
|
-
u && /* @__PURE__ */ a(sn, { onClose:
|
|
4156
|
+
u && /* @__PURE__ */ a(sn, { onClose: h }),
|
|
4157
4157
|
/* @__PURE__ */ a(
|
|
4158
4158
|
ln,
|
|
4159
4159
|
{
|
|
@@ -4161,8 +4161,8 @@ function Gt({
|
|
|
4161
4161
|
isProcessing: l,
|
|
4162
4162
|
error: e,
|
|
4163
4163
|
emptyView: N,
|
|
4164
|
-
messageRenderer:
|
|
4165
|
-
showAgentIcon:
|
|
4164
|
+
messageRenderer: T,
|
|
4165
|
+
showAgentIcon: M
|
|
4166
4166
|
}
|
|
4167
4167
|
),
|
|
4168
4168
|
/* @__PURE__ */ a(
|
|
@@ -4177,10 +4177,10 @@ function Gt({
|
|
|
4177
4177
|
isProcessing: l,
|
|
4178
4178
|
onStop: g,
|
|
4179
4179
|
fromCompact: d,
|
|
4180
|
-
onExpand:
|
|
4180
|
+
onExpand: A,
|
|
4181
4181
|
notice: x,
|
|
4182
|
-
suggestions:
|
|
4183
|
-
clearSuggestions:
|
|
4182
|
+
suggestions: $,
|
|
4183
|
+
clearSuggestions: f,
|
|
4184
4184
|
focusOnMount: D
|
|
4185
4185
|
}
|
|
4186
4186
|
)
|
|
@@ -4201,208 +4201,208 @@ function bc({
|
|
|
4201
4201
|
onOpen: g,
|
|
4202
4202
|
onExpand: d,
|
|
4203
4203
|
onClose: u,
|
|
4204
|
-
onStop:
|
|
4205
|
-
emptyView:
|
|
4204
|
+
onStop: h,
|
|
4205
|
+
emptyView: A,
|
|
4206
4206
|
floatingChatState: x,
|
|
4207
4207
|
suggestions: N,
|
|
4208
|
-
clearSuggestions:
|
|
4209
|
-
messageRenderer:
|
|
4210
|
-
showAgentIcon:
|
|
4211
|
-
className:
|
|
4208
|
+
clearSuggestions: $,
|
|
4209
|
+
messageRenderer: f,
|
|
4210
|
+
showAgentIcon: T,
|
|
4211
|
+
className: M,
|
|
4212
4212
|
expandOnHover: D = !0,
|
|
4213
|
-
freeDrag:
|
|
4214
|
-
initialFreeDragPosition:
|
|
4215
|
-
onFreeDragEnd:
|
|
4213
|
+
freeDrag: _ = !1,
|
|
4214
|
+
initialFreeDragPosition: j,
|
|
4215
|
+
onFreeDragEnd: K,
|
|
4216
|
+
onChatPositionChange: H
|
|
4216
4217
|
}) {
|
|
4217
|
-
const [
|
|
4218
|
-
|
|
4219
|
-
|
|
4218
|
+
const [I, V] = Y(""), m = Za(x), z = O(!1), ie = O(!1), W = O(!1), [Se, ge] = Y(!1);
|
|
4219
|
+
L(() => {
|
|
4220
|
+
z.current = !1, ie.current = !1, W.current = !1;
|
|
4220
4221
|
}, [m.state]);
|
|
4221
|
-
const
|
|
4222
|
-
|
|
4223
|
-
clearTimeout(
|
|
4224
|
-
}),
|
|
4225
|
-
}, []),
|
|
4226
|
-
value:
|
|
4227
|
-
setValue:
|
|
4228
|
-
onSubmit: async (
|
|
4229
|
-
m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await n(
|
|
4222
|
+
const J = O(/* @__PURE__ */ new Set()), Ce = w(() => {
|
|
4223
|
+
J.current.forEach((S) => {
|
|
4224
|
+
clearTimeout(S);
|
|
4225
|
+
}), J.current.clear();
|
|
4226
|
+
}, []), v = Ya({
|
|
4227
|
+
value: I,
|
|
4228
|
+
setValue: V,
|
|
4229
|
+
onSubmit: async (S) => {
|
|
4230
|
+
m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await n(S);
|
|
4230
4231
|
},
|
|
4231
4232
|
isProcessing: e,
|
|
4232
4233
|
floatingChatState: m.state
|
|
4233
|
-
}), [
|
|
4234
|
+
}), [_e, ke] = Y(56), [me, Ve] = Y(
|
|
4234
4235
|
Ja
|
|
4235
|
-
),
|
|
4236
|
-
freeDrag:
|
|
4237
|
-
initialFreeDragPosition:
|
|
4236
|
+
), xe = O(null), pe = O(null), he = O(null), { x: y, y: De } = qa({
|
|
4237
|
+
freeDrag: _,
|
|
4238
|
+
initialFreeDragPosition: j,
|
|
4238
4239
|
side: me
|
|
4239
|
-
}),
|
|
4240
|
-
|
|
4241
|
-
}, [m, g, d]),
|
|
4242
|
-
var
|
|
4243
|
-
const
|
|
4244
|
-
return !(
|
|
4245
|
-
}, [
|
|
4240
|
+
}), te = pt(y), X = pt(De), Ee = qt(), Re = w(() => {
|
|
4241
|
+
z.current = !0, m.open(), g == null || g(), d == null || d();
|
|
4242
|
+
}, [m, g, d]), p = w(() => {
|
|
4243
|
+
var G, Z, oe;
|
|
4244
|
+
const S = (Z = (G = he.current) == null ? void 0 : G.ownerDocument) == null ? void 0 : Z.activeElement;
|
|
4245
|
+
return !(S && ((oe = he.current) != null && oe.contains(S)) || I.trim());
|
|
4246
|
+
}, [I, he]), R = (S) => S === "collapsed" || S === "minimized" ? b.COLLAPSED_SIZE : S === "compact" ? _e : b.EXPANDED_HEIGHT, q = w(() => {
|
|
4246
4247
|
if (D && m.state === "collapsed" && (m.setState("compact"), m.initialState === "collapsed")) {
|
|
4247
|
-
const
|
|
4248
|
-
m.state === "compact" &&
|
|
4249
|
-
},
|
|
4250
|
-
|
|
4248
|
+
const S = setTimeout(() => {
|
|
4249
|
+
m.state === "compact" && p() && m.setState("collapsed"), J.current.delete(S);
|
|
4250
|
+
}, b.AUTO_COLLAPSE_DELAY);
|
|
4251
|
+
J.current.add(S);
|
|
4251
4252
|
}
|
|
4252
|
-
}, [m,
|
|
4253
|
-
if (m.initialState === "collapsed" && m.state === "compact" &&
|
|
4254
|
-
const
|
|
4255
|
-
m.state === "compact" &&
|
|
4256
|
-
},
|
|
4257
|
-
|
|
4253
|
+
}, [m, p, D]), U = w(() => {
|
|
4254
|
+
if (m.initialState === "collapsed" && m.state === "compact" && p()) {
|
|
4255
|
+
const S = setTimeout(() => {
|
|
4256
|
+
m.state === "compact" && p() && m.setState("collapsed"), J.current.delete(S);
|
|
4257
|
+
}, b.AUTO_COLLAPSE_DELAY);
|
|
4258
|
+
J.current.add(S);
|
|
4258
4259
|
}
|
|
4259
|
-
}, [m,
|
|
4260
|
-
if (
|
|
4261
|
-
const
|
|
4262
|
-
|
|
4260
|
+
}, [m, p]), ae = w(async () => {
|
|
4261
|
+
if (v.value.trim()) {
|
|
4262
|
+
const S = v.value.trim();
|
|
4263
|
+
v.clear(), m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await n(S);
|
|
4263
4264
|
}
|
|
4264
|
-
}, [
|
|
4265
|
-
|
|
4266
|
-
}, [d, m]),
|
|
4267
|
-
|
|
4268
|
-
}, [
|
|
4269
|
-
(
|
|
4270
|
-
if (!
|
|
4265
|
+
}, [v, n, m, d]), ue = w(() => {
|
|
4266
|
+
W.current = !0, d == null || d(), m.setState("expanded");
|
|
4267
|
+
}, [d, m]), Me = w(() => {
|
|
4268
|
+
ie.current = !0, v.clear(), m.close(), u && u();
|
|
4269
|
+
}, [v, m, u]), fe = w(
|
|
4270
|
+
(S) => {
|
|
4271
|
+
if (!he.current || !pe.current)
|
|
4271
4272
|
return null;
|
|
4272
|
-
const
|
|
4273
|
+
const G = he.current.getBoundingClientRect(), Z = pe.current.getBoundingClientRect(), oe = window.getComputedStyle(he.current), ve = new DOMMatrixReadOnly(oe.transform), st = G.x - ve.e, Ae = G.y - ve.f, le = (S ?? me) === "left" ? Z.left : Z.right - b.COMPACT_WIDTH, qe = m.state === "minimized" ? window.innerHeight - b.COLLAPSED_SIZE : Z.bottom - b.EXPANDED_HEIGHT;
|
|
4273
4274
|
return {
|
|
4274
|
-
x:
|
|
4275
|
-
y:
|
|
4275
|
+
x: le - st,
|
|
4276
|
+
y: qe - Ae
|
|
4276
4277
|
};
|
|
4277
4278
|
},
|
|
4278
4279
|
[me, m.state]
|
|
4279
|
-
),
|
|
4280
|
-
(
|
|
4281
|
-
|
|
4280
|
+
), We = w(
|
|
4281
|
+
(S) => {
|
|
4282
|
+
S.target.closest(
|
|
4282
4283
|
re.NON_DRAGGABLE_SELECTORS
|
|
4283
|
-
) ||
|
|
4284
|
+
) || Ee.start(S.nativeEvent);
|
|
4284
4285
|
},
|
|
4285
|
-
[
|
|
4286
|
-
),
|
|
4287
|
-
(
|
|
4288
|
-
|
|
4289
|
-
|
|
4286
|
+
[Ee]
|
|
4287
|
+
), Te = w(
|
|
4288
|
+
(S, G) => {
|
|
4289
|
+
const Z = te.get(), oe = b.COMPACT_WIDTH, ve = (window.innerWidth - oe) / 2, Ae = Z < ve ? "left" : "right";
|
|
4290
|
+
if (me === Ae && (Ve(Ae), ht(Ae), H == null || H(Ae)), _) {
|
|
4291
|
+
K == null || K({ x: te.get(), y: X.get() });
|
|
4290
4292
|
return;
|
|
4291
4293
|
}
|
|
4292
|
-
const
|
|
4293
|
-
|
|
4294
|
-
const ze = pe(Pe);
|
|
4295
|
-
ze && (ye(ce, ze.x, {
|
|
4294
|
+
const ce = fe(Ae);
|
|
4295
|
+
ce && (ye(te, ce.x, {
|
|
4296
4296
|
...re.SPRING_CONFIG,
|
|
4297
|
-
velocity:
|
|
4298
|
-
}), ye(X,
|
|
4297
|
+
velocity: G.velocity.x * re.VELOCITY_MULTIPLIER
|
|
4298
|
+
}), ye(X, ce.y, {
|
|
4299
4299
|
...re.SPRING_CONFIG,
|
|
4300
|
-
velocity:
|
|
4300
|
+
velocity: G.velocity.y * re.VELOCITY_MULTIPLIER
|
|
4301
4301
|
}));
|
|
4302
4302
|
},
|
|
4303
|
-
[
|
|
4304
|
-
),
|
|
4305
|
-
|
|
4306
|
-
const
|
|
4307
|
-
if (
|
|
4303
|
+
[te, X, fe, _, K]
|
|
4304
|
+
), Ie = O(_);
|
|
4305
|
+
L(() => {
|
|
4306
|
+
const S = Ie.current;
|
|
4307
|
+
if (Ie.current = _, _ || !S)
|
|
4308
4308
|
return;
|
|
4309
|
-
const
|
|
4310
|
-
me !==
|
|
4311
|
-
const
|
|
4312
|
-
|
|
4313
|
-
}, [
|
|
4314
|
-
const
|
|
4315
|
-
|
|
4316
|
-
const
|
|
4317
|
-
if (
|
|
4309
|
+
const Z = b.VIEWPORT_OFFSET + te.get() + b.COMPACT_WIDTH / 2 < window.innerWidth / 2 ? "left" : "right";
|
|
4310
|
+
me !== Z && (Ve(Z), ht(Z));
|
|
4311
|
+
const oe = fe(Z);
|
|
4312
|
+
oe && (ye(te, oe.x, re.SPRING_CONFIG), ye(X, oe.y, re.SPRING_CONFIG));
|
|
4313
|
+
}, [_, te, X, fe, me]);
|
|
4314
|
+
const Pe = O(null), F = O(m.state === "minimized");
|
|
4315
|
+
L(() => {
|
|
4316
|
+
const S = F.current, G = m.state === "minimized";
|
|
4317
|
+
if (F.current = G, !_ || G === S)
|
|
4318
4318
|
return;
|
|
4319
|
-
if (
|
|
4320
|
-
|
|
4321
|
-
const
|
|
4322
|
-
return () =>
|
|
4319
|
+
if (G) {
|
|
4320
|
+
Pe.current = X.get();
|
|
4321
|
+
const oe = ye(X, 0, re.SPRING_CONFIG);
|
|
4322
|
+
return () => oe.stop();
|
|
4323
4323
|
}
|
|
4324
|
-
if (
|
|
4324
|
+
if (Pe.current === null)
|
|
4325
4325
|
return;
|
|
4326
|
-
const
|
|
4326
|
+
const Z = ye(
|
|
4327
4327
|
X,
|
|
4328
|
-
|
|
4328
|
+
Pe.current,
|
|
4329
4329
|
re.SPRING_CONFIG
|
|
4330
4330
|
);
|
|
4331
|
-
return
|
|
4332
|
-
}, [m.state,
|
|
4333
|
-
const
|
|
4334
|
-
return
|
|
4335
|
-
|
|
4336
|
-
}, [m.state,
|
|
4331
|
+
return Pe.current = null, () => Z.stop();
|
|
4332
|
+
}, [m.state, _, X]);
|
|
4333
|
+
const Je = O(m.state), yt = Je.current === "compact" && m.state === "expanded";
|
|
4334
|
+
return L(() => {
|
|
4335
|
+
Ce(), Je.current = m.state;
|
|
4336
|
+
}, [m.state, Ce]), L(() => {
|
|
4337
4337
|
if (m.state !== "expanded")
|
|
4338
4338
|
return;
|
|
4339
|
-
const
|
|
4340
|
-
if (
|
|
4341
|
-
const
|
|
4342
|
-
{ x:
|
|
4343
|
-
|
|
4344
|
-
|
|
4339
|
+
const S = () => {
|
|
4340
|
+
if (_) {
|
|
4341
|
+
const Z = Ot(
|
|
4342
|
+
{ x: te.get(), y: X.get() },
|
|
4343
|
+
b.COMPACT_WIDTH,
|
|
4344
|
+
b.EXPANDED_HEIGHT
|
|
4345
4345
|
);
|
|
4346
|
-
|
|
4346
|
+
te.set(Z.x), X.set(Z.y);
|
|
4347
4347
|
return;
|
|
4348
4348
|
}
|
|
4349
|
-
const
|
|
4350
|
-
|
|
4349
|
+
const G = fe();
|
|
4350
|
+
G && (te.set(G.x), X.set(G.y));
|
|
4351
4351
|
};
|
|
4352
|
-
return window.addEventListener("resize",
|
|
4353
|
-
}, [m.state,
|
|
4354
|
-
const
|
|
4352
|
+
return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
|
|
4353
|
+
}, [m.state, te, X, fe, _]), L(() => {
|
|
4354
|
+
const S = J.current;
|
|
4355
4355
|
return () => {
|
|
4356
|
-
|
|
4357
|
-
clearTimeout(
|
|
4358
|
-
}),
|
|
4356
|
+
S.forEach((G) => {
|
|
4357
|
+
clearTimeout(G);
|
|
4358
|
+
}), S.clear();
|
|
4359
4359
|
};
|
|
4360
|
-
}, []),
|
|
4361
|
-
if (m.state === "compact" &&
|
|
4362
|
-
const
|
|
4363
|
-
|
|
4360
|
+
}, []), L(() => {
|
|
4361
|
+
if (m.state === "compact" && xe.current) {
|
|
4362
|
+
const S = xe.current.scrollHeight + b.PADDING;
|
|
4363
|
+
ke(S);
|
|
4364
4364
|
}
|
|
4365
|
-
}, [m.state,
|
|
4365
|
+
}, [m.state, v.value]), o === "embedded" ? /* @__PURE__ */ a(
|
|
4366
4366
|
"div",
|
|
4367
4367
|
{
|
|
4368
4368
|
"data-slot": "chat-embedded",
|
|
4369
|
-
className:
|
|
4369
|
+
className: de(M, be.container, be.embedded),
|
|
4370
4370
|
children: /* @__PURE__ */ a(
|
|
4371
4371
|
Gt,
|
|
4372
4372
|
{
|
|
4373
4373
|
messages: t,
|
|
4374
|
-
inputValue:
|
|
4375
|
-
onInputChange:
|
|
4376
|
-
onSubmit:
|
|
4377
|
-
onKeyDown:
|
|
4378
|
-
textareaRef:
|
|
4374
|
+
inputValue: v.value,
|
|
4375
|
+
onInputChange: v.setValue,
|
|
4376
|
+
onSubmit: ae,
|
|
4377
|
+
onKeyDown: v.handleKeyDown,
|
|
4378
|
+
textareaRef: v.textareaRef,
|
|
4379
4379
|
placeholder: s,
|
|
4380
4380
|
isProcessing: e,
|
|
4381
|
-
onStop:
|
|
4381
|
+
onStop: h,
|
|
4382
4382
|
showHeader: !1,
|
|
4383
4383
|
notice: l,
|
|
4384
4384
|
suggestions: N,
|
|
4385
|
-
clearSuggestions:
|
|
4385
|
+
clearSuggestions: $,
|
|
4386
4386
|
error: i,
|
|
4387
|
-
emptyView:
|
|
4388
|
-
messageRenderer:
|
|
4389
|
-
showAgentIcon:
|
|
4390
|
-
onExpand:
|
|
4391
|
-
focusOnMount:
|
|
4387
|
+
emptyView: A,
|
|
4388
|
+
messageRenderer: f,
|
|
4389
|
+
showAgentIcon: T,
|
|
4390
|
+
onExpand: ue,
|
|
4391
|
+
focusOnMount: W.current
|
|
4392
4392
|
}
|
|
4393
4393
|
)
|
|
4394
4394
|
}
|
|
4395
|
-
) : /* @__PURE__ */
|
|
4395
|
+
) : /* @__PURE__ */ C(Ke, { children: [
|
|
4396
4396
|
/* @__PURE__ */ a(
|
|
4397
4397
|
"div",
|
|
4398
4398
|
{
|
|
4399
|
-
ref:
|
|
4399
|
+
ref: pe,
|
|
4400
4400
|
style: {
|
|
4401
4401
|
position: "fixed",
|
|
4402
|
-
top:
|
|
4403
|
-
left:
|
|
4404
|
-
right:
|
|
4405
|
-
bottom:
|
|
4402
|
+
top: b.VIEWPORT_OFFSET,
|
|
4403
|
+
left: b.VIEWPORT_OFFSET,
|
|
4404
|
+
right: b.VIEWPORT_OFFSET,
|
|
4405
|
+
bottom: b.VIEWPORT_OFFSET,
|
|
4406
4406
|
pointerEvents: "none"
|
|
4407
4407
|
}
|
|
4408
4408
|
}
|
|
@@ -4410,31 +4410,31 @@ function bc({
|
|
|
4410
4410
|
/* @__PURE__ */ a(
|
|
4411
4411
|
se.div,
|
|
4412
4412
|
{
|
|
4413
|
-
ref:
|
|
4413
|
+
ref: he,
|
|
4414
4414
|
"data-slot": "chat-floating",
|
|
4415
|
-
className:
|
|
4415
|
+
className: de(M, be.container, be.floating, {
|
|
4416
4416
|
[be.expanded]: m.state === "expanded",
|
|
4417
|
-
animating:
|
|
4417
|
+
animating: Se
|
|
4418
4418
|
}),
|
|
4419
|
-
onMouseLeave: m.state === "compact" ?
|
|
4419
|
+
onMouseLeave: m.state === "compact" ? U : void 0,
|
|
4420
4420
|
drag: m.state === "expanded",
|
|
4421
|
-
dragControls:
|
|
4421
|
+
dragControls: Ee,
|
|
4422
4422
|
dragListener: !1,
|
|
4423
|
-
dragConstraints:
|
|
4423
|
+
dragConstraints: pe,
|
|
4424
4424
|
dragMomentum: !1,
|
|
4425
|
-
dragElastic:
|
|
4425
|
+
dragElastic: _ ? 0 : 0.1,
|
|
4426
4426
|
dragTransition: { power: 0.1, timeConstant: 100 },
|
|
4427
|
-
onDragEnd:
|
|
4428
|
-
onPointerDown:
|
|
4427
|
+
onDragEnd: Te,
|
|
4428
|
+
onPointerDown: We,
|
|
4429
4429
|
initial: !1,
|
|
4430
4430
|
animate: {
|
|
4431
|
-
bottom: m.state === "minimized" ? 0 :
|
|
4431
|
+
bottom: m.state === "minimized" ? 0 : b.VIEWPORT_OFFSET
|
|
4432
4432
|
},
|
|
4433
4433
|
transition: He,
|
|
4434
4434
|
style: {
|
|
4435
|
-
x:
|
|
4435
|
+
x: te,
|
|
4436
4436
|
y: X,
|
|
4437
|
-
left:
|
|
4437
|
+
left: b.VIEWPORT_OFFSET
|
|
4438
4438
|
},
|
|
4439
4439
|
children: /* @__PURE__ */ a(
|
|
4440
4440
|
se.div,
|
|
@@ -4443,27 +4443,27 @@ function bc({
|
|
|
4443
4443
|
className: be.content,
|
|
4444
4444
|
initial: !1,
|
|
4445
4445
|
animate: {
|
|
4446
|
-
width: m.state === "collapsed" ?
|
|
4447
|
-
height:
|
|
4448
|
-
x: m.state === "collapsed" && me === "right" ?
|
|
4449
|
-
borderBottomLeftRadius: m.state === "minimized" ? 0 :
|
|
4450
|
-
borderBottomRightRadius: m.state === "minimized" ? 0 :
|
|
4451
|
-
transition:
|
|
4446
|
+
width: m.state === "collapsed" ? b.COLLAPSED_SIZE : b.COMPACT_WIDTH,
|
|
4447
|
+
height: R(m.state),
|
|
4448
|
+
x: m.state === "collapsed" && me === "right" ? b.COMPACT_WIDTH - b.COLLAPSED_SIZE : 0,
|
|
4449
|
+
borderBottomLeftRadius: m.state === "minimized" ? 0 : b.BORDER_RADIUS,
|
|
4450
|
+
borderBottomRightRadius: m.state === "minimized" ? 0 : b.BORDER_RADIUS,
|
|
4451
|
+
transition: v.value.trim() ? { duration: 0 } : He
|
|
4452
4452
|
},
|
|
4453
|
-
onAnimationStart: () =>
|
|
4454
|
-
onAnimationComplete: () =>
|
|
4453
|
+
onAnimationStart: () => ge(!0),
|
|
4454
|
+
onAnimationComplete: () => ge(!1),
|
|
4455
4455
|
style: {
|
|
4456
|
-
borderTopLeftRadius:
|
|
4457
|
-
borderTopRightRadius:
|
|
4456
|
+
borderTopLeftRadius: b.BORDER_RADIUS,
|
|
4457
|
+
borderTopRightRadius: b.BORDER_RADIUS
|
|
4458
4458
|
},
|
|
4459
|
-
children: /* @__PURE__ */
|
|
4459
|
+
children: /* @__PURE__ */ C(ct, { mode: "wait", children: [
|
|
4460
4460
|
m.state === "collapsed" && /* @__PURE__ */ a(
|
|
4461
4461
|
en,
|
|
4462
4462
|
{
|
|
4463
4463
|
icon: c,
|
|
4464
|
-
onClick:
|
|
4465
|
-
onHover:
|
|
4466
|
-
focusOnMount:
|
|
4464
|
+
onClick: Re,
|
|
4465
|
+
onHover: q,
|
|
4466
|
+
focusOnMount: ie.current
|
|
4467
4467
|
},
|
|
4468
4468
|
"collapsed"
|
|
4469
4469
|
),
|
|
@@ -4472,28 +4472,28 @@ function bc({
|
|
|
4472
4472
|
{
|
|
4473
4473
|
icon: c,
|
|
4474
4474
|
title: r,
|
|
4475
|
-
onClick:
|
|
4476
|
-
focusOnMount:
|
|
4475
|
+
onClick: Re,
|
|
4476
|
+
focusOnMount: ie.current
|
|
4477
4477
|
},
|
|
4478
4478
|
"minimized"
|
|
4479
4479
|
),
|
|
4480
|
-
m.state === "compact" && /* @__PURE__ */ a("div", { ref:
|
|
4480
|
+
m.state === "compact" && /* @__PURE__ */ a("div", { ref: xe, children: /* @__PURE__ */ a(
|
|
4481
4481
|
nn,
|
|
4482
4482
|
{
|
|
4483
|
-
value:
|
|
4484
|
-
onChange:
|
|
4485
|
-
onSubmit:
|
|
4486
|
-
onKeyDown:
|
|
4487
|
-
textareaRef:
|
|
4483
|
+
value: v.value,
|
|
4484
|
+
onChange: v.setValue,
|
|
4485
|
+
onSubmit: ae,
|
|
4486
|
+
onKeyDown: v.handleKeyDown,
|
|
4487
|
+
textareaRef: v.textareaRef,
|
|
4488
4488
|
placeholder: s,
|
|
4489
4489
|
isProcessing: e,
|
|
4490
|
-
onBlur:
|
|
4491
|
-
onExpand:
|
|
4492
|
-
showExpandButton: !
|
|
4493
|
-
focusOnMount:
|
|
4494
|
-
onStop:
|
|
4490
|
+
onBlur: U,
|
|
4491
|
+
onExpand: ue,
|
|
4492
|
+
showExpandButton: !v.value.trim(),
|
|
4493
|
+
focusOnMount: z.current,
|
|
4494
|
+
onStop: h,
|
|
4495
4495
|
suggestions: N,
|
|
4496
|
-
clearSuggestions:
|
|
4496
|
+
clearSuggestions: $
|
|
4497
4497
|
},
|
|
4498
4498
|
"compact"
|
|
4499
4499
|
) }),
|
|
@@ -4501,26 +4501,26 @@ function bc({
|
|
|
4501
4501
|
Gt,
|
|
4502
4502
|
{
|
|
4503
4503
|
messages: t,
|
|
4504
|
-
inputValue:
|
|
4505
|
-
onInputChange:
|
|
4506
|
-
onSubmit:
|
|
4507
|
-
onKeyDown:
|
|
4508
|
-
textareaRef:
|
|
4504
|
+
inputValue: v.value,
|
|
4505
|
+
onInputChange: v.setValue,
|
|
4506
|
+
onSubmit: ae,
|
|
4507
|
+
onKeyDown: v.handleKeyDown,
|
|
4508
|
+
textareaRef: v.textareaRef,
|
|
4509
4509
|
placeholder: s,
|
|
4510
4510
|
isProcessing: e,
|
|
4511
|
-
onStop:
|
|
4511
|
+
onStop: h,
|
|
4512
4512
|
showHeader: !0,
|
|
4513
|
-
onClose:
|
|
4514
|
-
fromCompact:
|
|
4513
|
+
onClose: Me,
|
|
4514
|
+
fromCompact: yt,
|
|
4515
4515
|
notice: l,
|
|
4516
4516
|
suggestions: N,
|
|
4517
|
-
clearSuggestions:
|
|
4517
|
+
clearSuggestions: $,
|
|
4518
4518
|
error: i,
|
|
4519
|
-
emptyView:
|
|
4520
|
-
messageRenderer:
|
|
4521
|
-
showAgentIcon:
|
|
4522
|
-
onExpand:
|
|
4523
|
-
focusOnMount:
|
|
4519
|
+
emptyView: A,
|
|
4520
|
+
messageRenderer: f,
|
|
4521
|
+
showAgentIcon: T,
|
|
4522
|
+
onExpand: ue,
|
|
4523
|
+
focusOnMount: W.current
|
|
4524
4524
|
},
|
|
4525
4525
|
"expanded"
|
|
4526
4526
|
)
|
|
@@ -4561,7 +4561,7 @@ const ho = "ImageUploader-module_container", fo = "ImageUploader-module_active",
|
|
|
4561
4561
|
onRemove: c
|
|
4562
4562
|
}) => {
|
|
4563
4563
|
const r = t.mime_type ? t.mime_type.split("/")[1].toUpperCase() : "", s = t.title || t.name || t.url.split("/").pop() || "image";
|
|
4564
|
-
return /* @__PURE__ */
|
|
4564
|
+
return /* @__PURE__ */ C(
|
|
4565
4565
|
"div",
|
|
4566
4566
|
{
|
|
4567
4567
|
className: ee.previewItem,
|
|
@@ -4606,7 +4606,7 @@ const ho = "ImageUploader-module_container", fo = "ImageUploader-module_active",
|
|
|
4606
4606
|
loading: "lazy"
|
|
4607
4607
|
}
|
|
4608
4608
|
),
|
|
4609
|
-
i && /* @__PURE__ */
|
|
4609
|
+
i && /* @__PURE__ */ C("div", { className: ee.previewMeta, children: [
|
|
4610
4610
|
/* @__PURE__ */ a(
|
|
4611
4611
|
"span",
|
|
4612
4612
|
{
|
|
@@ -4634,65 +4634,65 @@ const ho = "ImageUploader-module_container", fo = "ImageUploader-module_active",
|
|
|
4634
4634
|
onImageDragEnd: g,
|
|
4635
4635
|
acceptedFileTypes: d = ["image/jpeg", "image/png"],
|
|
4636
4636
|
maxFileSize: u,
|
|
4637
|
-
maxFiles:
|
|
4638
|
-
uploadingIndicator:
|
|
4637
|
+
maxFiles: h,
|
|
4638
|
+
uploadingIndicator: A,
|
|
4639
4639
|
className: x = "",
|
|
4640
4640
|
showFileMetadata: N = !0,
|
|
4641
|
-
allowDragToInsert:
|
|
4642
|
-
onError:
|
|
4643
|
-
visible:
|
|
4644
|
-
dropZoneRef:
|
|
4641
|
+
allowDragToInsert: $ = !0,
|
|
4642
|
+
onError: f,
|
|
4643
|
+
visible: T = !0,
|
|
4644
|
+
dropZoneRef: M
|
|
4645
4645
|
}, D) {
|
|
4646
|
-
const { textareaRef:
|
|
4646
|
+
const { textareaRef: _ } = Ne(), [j, K] = Y(!1), [H, I] = Y(!1), [V, m] = Y(!1), z = O(null), ie = O(null), W = O(0);
|
|
4647
4647
|
xn(D, () => ({
|
|
4648
4648
|
openFileDialog: () => {
|
|
4649
|
-
var
|
|
4650
|
-
(
|
|
4649
|
+
var p;
|
|
4650
|
+
(p = z.current) == null || p.click();
|
|
4651
4651
|
}
|
|
4652
|
-
})),
|
|
4653
|
-
const
|
|
4654
|
-
if (!
|
|
4652
|
+
})), L(() => {
|
|
4653
|
+
const p = M ? M.current : window;
|
|
4654
|
+
if (!p)
|
|
4655
4655
|
return;
|
|
4656
|
-
const R = (
|
|
4657
|
-
var
|
|
4658
|
-
(
|
|
4659
|
-
},
|
|
4660
|
-
|
|
4656
|
+
const R = (ae) => {
|
|
4657
|
+
var ue, Me;
|
|
4658
|
+
(Me = (ue = ae.dataTransfer) == null ? void 0 : ue.types) != null && Me.includes("Files") && (W.current += 1, I(!0));
|
|
4659
|
+
}, q = (ae) => {
|
|
4660
|
+
W.current -= 1, (W.current === 0 || ae.relatedTarget === null) && (W.current = 0, I(!1));
|
|
4661
4661
|
}, U = () => {
|
|
4662
|
-
|
|
4662
|
+
W.current = 0, I(!1);
|
|
4663
4663
|
};
|
|
4664
|
-
return
|
|
4664
|
+
return p.addEventListener(
|
|
4665
4665
|
"dragenter",
|
|
4666
4666
|
R
|
|
4667
|
-
),
|
|
4667
|
+
), p.addEventListener(
|
|
4668
4668
|
"dragleave",
|
|
4669
|
-
|
|
4670
|
-
),
|
|
4671
|
-
|
|
4669
|
+
q
|
|
4670
|
+
), p.addEventListener("drop", U), () => {
|
|
4671
|
+
p.removeEventListener(
|
|
4672
4672
|
"dragenter",
|
|
4673
4673
|
R
|
|
4674
|
-
),
|
|
4674
|
+
), p.removeEventListener(
|
|
4675
4675
|
"dragleave",
|
|
4676
|
-
|
|
4677
|
-
),
|
|
4676
|
+
q
|
|
4677
|
+
), p.removeEventListener("drop", U);
|
|
4678
4678
|
};
|
|
4679
|
-
}, [
|
|
4680
|
-
|
|
4679
|
+
}, [M]), L(() => () => {
|
|
4680
|
+
ie.current && clearTimeout(ie.current);
|
|
4681
4681
|
}, []);
|
|
4682
|
-
const
|
|
4683
|
-
const R = Math.min(
|
|
4684
|
-
return
|
|
4685
|
-
}, []),
|
|
4686
|
-
(
|
|
4687
|
-
if (!
|
|
4682
|
+
const Se = w((p) => {
|
|
4683
|
+
const R = Math.min(p, 10485760), q = Math.floor(R / (1024 * 1024));
|
|
4684
|
+
return q >= 1 ? `${q} MB` : `${Math.floor(R / 1024)} KB`;
|
|
4685
|
+
}, []), ge = w(
|
|
4686
|
+
(p) => {
|
|
4687
|
+
if (!p || p.length === 0)
|
|
4688
4688
|
return;
|
|
4689
|
-
const R = Array.from(
|
|
4689
|
+
const R = Array.from(p), q = R.filter(
|
|
4690
4690
|
(U) => d.includes(U.type)
|
|
4691
4691
|
);
|
|
4692
|
-
if (
|
|
4693
|
-
|
|
4694
|
-
const U = d.map((
|
|
4695
|
-
|
|
4692
|
+
if (q.length < R.length) {
|
|
4693
|
+
m(!0);
|
|
4694
|
+
const U = d.map((ae) => ae.split("/")[1].toUpperCase()).join(" or ");
|
|
4695
|
+
f == null || f(
|
|
4696
4696
|
je(
|
|
4697
4697
|
/* translators: %s: allowed file types (e.g., "JPEG or PNG") */
|
|
4698
4698
|
E(
|
|
@@ -4701,178 +4701,178 @@ const ho = "ImageUploader-module_container", fo = "ImageUploader-module_active",
|
|
|
4701
4701
|
),
|
|
4702
4702
|
U
|
|
4703
4703
|
)
|
|
4704
|
-
),
|
|
4705
|
-
|
|
4704
|
+
), ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => {
|
|
4705
|
+
m(!1);
|
|
4706
4706
|
}, 3e3);
|
|
4707
4707
|
}
|
|
4708
|
-
if (
|
|
4709
|
-
|
|
4708
|
+
if (h && q.length > h) {
|
|
4709
|
+
f == null || f(
|
|
4710
4710
|
je(
|
|
4711
4711
|
/* translators: %d: maximum number of files allowed */
|
|
4712
4712
|
E("Maximum %d files allowed.", "a8c-agenttic"),
|
|
4713
|
-
|
|
4713
|
+
h
|
|
4714
4714
|
)
|
|
4715
4715
|
);
|
|
4716
|
-
const U =
|
|
4716
|
+
const U = q.slice(0, h);
|
|
4717
4717
|
U.length > 0 && n(U);
|
|
4718
4718
|
return;
|
|
4719
4719
|
}
|
|
4720
|
-
|
|
4720
|
+
q.length > 0 && n(q);
|
|
4721
4721
|
},
|
|
4722
|
-
[n, d,
|
|
4723
|
-
),
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
}, [
|
|
4727
|
-
const
|
|
4728
|
-
if (!
|
|
4722
|
+
[n, d, h, f]
|
|
4723
|
+
), J = O(ge);
|
|
4724
|
+
L(() => {
|
|
4725
|
+
J.current = ge;
|
|
4726
|
+
}, [ge]), L(() => {
|
|
4727
|
+
const p = M == null ? void 0 : M.current;
|
|
4728
|
+
if (!p)
|
|
4729
4729
|
return;
|
|
4730
4730
|
const R = (U) => {
|
|
4731
4731
|
U.preventDefault();
|
|
4732
|
-
},
|
|
4733
|
-
var
|
|
4734
|
-
U.preventDefault(),
|
|
4732
|
+
}, q = (U) => {
|
|
4733
|
+
var ae;
|
|
4734
|
+
U.preventDefault(), W.current = 0, I(!1), K(!1), (ae = U.dataTransfer) != null && ae.files && (J.current(U.dataTransfer.files), c == null || c(Array.from(U.dataTransfer.files)));
|
|
4735
4735
|
};
|
|
4736
|
-
return
|
|
4737
|
-
|
|
4736
|
+
return p.addEventListener("dragover", R), p.addEventListener("drop", q), () => {
|
|
4737
|
+
p.removeEventListener(
|
|
4738
4738
|
"dragover",
|
|
4739
4739
|
R
|
|
4740
|
-
),
|
|
4740
|
+
), p.removeEventListener("drop", q);
|
|
4741
4741
|
};
|
|
4742
|
-
}, [
|
|
4743
|
-
const
|
|
4744
|
-
var
|
|
4745
|
-
const
|
|
4746
|
-
if (!
|
|
4742
|
+
}, [M, c]), L(() => {
|
|
4743
|
+
const p = (R) => {
|
|
4744
|
+
var Me;
|
|
4745
|
+
const q = _.current && document.activeElement === _.current, U = _.current && R.target && (R.target === _.current || _.current.contains(R.target));
|
|
4746
|
+
if (!q && !U)
|
|
4747
4747
|
return;
|
|
4748
|
-
const
|
|
4749
|
-
if (!
|
|
4748
|
+
const ae = (Me = R.clipboardData) == null ? void 0 : Me.items;
|
|
4749
|
+
if (!ae)
|
|
4750
4750
|
return;
|
|
4751
|
-
const
|
|
4752
|
-
for (let
|
|
4753
|
-
const We =
|
|
4751
|
+
const ue = [];
|
|
4752
|
+
for (let fe = 0; fe < ae.length; fe++) {
|
|
4753
|
+
const We = ae[fe];
|
|
4754
4754
|
if (We.type.startsWith("image/")) {
|
|
4755
|
-
const
|
|
4756
|
-
|
|
4755
|
+
const Te = We.getAsFile();
|
|
4756
|
+
Te && ue.push(Te);
|
|
4757
4757
|
}
|
|
4758
4758
|
}
|
|
4759
|
-
|
|
4759
|
+
ue.length > 0 && (R.preventDefault(), J.current(ue), r == null || r(ue));
|
|
4760
4760
|
};
|
|
4761
|
-
return window.addEventListener("paste",
|
|
4762
|
-
window.removeEventListener("paste",
|
|
4761
|
+
return window.addEventListener("paste", p), () => {
|
|
4762
|
+
window.removeEventListener("paste", p);
|
|
4763
4763
|
};
|
|
4764
4764
|
}, [r]);
|
|
4765
|
-
const
|
|
4766
|
-
|
|
4767
|
-
},
|
|
4768
|
-
|
|
4769
|
-
},
|
|
4770
|
-
if (
|
|
4771
|
-
const R = Array.from(
|
|
4772
|
-
|
|
4765
|
+
const Ce = (p) => {
|
|
4766
|
+
p.preventDefault(), p.stopPropagation(), K(!0);
|
|
4767
|
+
}, v = (p) => {
|
|
4768
|
+
p.preventDefault(), p.stopPropagation(), K(!1);
|
|
4769
|
+
}, _e = (p) => {
|
|
4770
|
+
if (p.preventDefault(), p.stopPropagation(), K(!1), W.current = 0, I(!1), p.dataTransfer.files) {
|
|
4771
|
+
const R = Array.from(p.dataTransfer.files);
|
|
4772
|
+
ge(p.dataTransfer.files), c == null || c(R);
|
|
4773
4773
|
}
|
|
4774
|
-
},
|
|
4775
|
-
if (
|
|
4776
|
-
const R = Array.from(
|
|
4777
|
-
|
|
4774
|
+
}, ke = (p) => {
|
|
4775
|
+
if (p.target.files) {
|
|
4776
|
+
const R = Array.from(p.target.files);
|
|
4777
|
+
ge(p.target.files), o == null || o(R);
|
|
4778
4778
|
}
|
|
4779
|
-
|
|
4780
|
-
},
|
|
4781
|
-
var
|
|
4782
|
-
(
|
|
4783
|
-
},
|
|
4784
|
-
(
|
|
4785
|
-
l == null || l(
|
|
4779
|
+
p.target.value = "";
|
|
4780
|
+
}, me = () => {
|
|
4781
|
+
var p;
|
|
4782
|
+
(p = z.current) == null || p.click();
|
|
4783
|
+
}, Ve = w(
|
|
4784
|
+
(p, R) => {
|
|
4785
|
+
l == null || l(p, R);
|
|
4786
4786
|
},
|
|
4787
4787
|
[l]
|
|
4788
|
-
), xe =
|
|
4789
|
-
(
|
|
4790
|
-
g == null || g(
|
|
4788
|
+
), xe = w(
|
|
4789
|
+
(p, R) => {
|
|
4790
|
+
g == null || g(p, R);
|
|
4791
4791
|
},
|
|
4792
4792
|
[g]
|
|
4793
|
-
),
|
|
4794
|
-
(
|
|
4795
|
-
|
|
4793
|
+
), pe = w(
|
|
4794
|
+
(p, R) => {
|
|
4795
|
+
p.stopPropagation(), s(R);
|
|
4796
4796
|
},
|
|
4797
4797
|
[s]
|
|
4798
4798
|
);
|
|
4799
|
-
if (!
|
|
4799
|
+
if (!T)
|
|
4800
4800
|
return null;
|
|
4801
|
-
const
|
|
4801
|
+
const he = e.length > 0, y = i.length > 0, De = H, te = !H && (he || y), X = he || y || H || V, Ee = u ? je(
|
|
4802
4802
|
/* translators: %s: maximum file size (e.g., "5 MB") */
|
|
4803
4803
|
E("Upload image files up to %s each.", "a8c-agenttic"),
|
|
4804
|
-
|
|
4805
|
-
) : "",
|
|
4804
|
+
Se(u)
|
|
4805
|
+
) : "", Re = je(
|
|
4806
4806
|
/* translators: %s: allowed file types (e.g., "JPEG or PNG") */
|
|
4807
4807
|
E("Only %s image files are allowed.", "a8c-agenttic"),
|
|
4808
|
-
d.map((
|
|
4808
|
+
d.map((p) => p.split("/")[1].toUpperCase()).join(" or ")
|
|
4809
4809
|
);
|
|
4810
4810
|
return /* @__PURE__ */ a(
|
|
4811
4811
|
"div",
|
|
4812
4812
|
{
|
|
4813
|
-
className: `${ee.container} ${
|
|
4813
|
+
className: `${ee.container} ${X ? ee.active : ""} ${x}`,
|
|
4814
4814
|
"data-slot": "image-uploader",
|
|
4815
4815
|
children: /* @__PURE__ */ a(
|
|
4816
4816
|
"div",
|
|
4817
4817
|
{
|
|
4818
|
-
className: `${ee.uploader} ${
|
|
4819
|
-
children: /* @__PURE__ */
|
|
4820
|
-
!
|
|
4818
|
+
className: `${ee.uploader} ${y ? ee.uploading : ""} ${j ? ee.draggingOver : ""}`,
|
|
4819
|
+
children: /* @__PURE__ */ C("div", { className: ee.content, children: [
|
|
4820
|
+
!V && /* @__PURE__ */ C(Ke, { children: [
|
|
4821
4821
|
/* @__PURE__ */ a(
|
|
4822
4822
|
"input",
|
|
4823
4823
|
{
|
|
4824
|
-
ref:
|
|
4824
|
+
ref: z,
|
|
4825
4825
|
type: "file",
|
|
4826
4826
|
accept: d.join(","),
|
|
4827
|
-
multiple: !
|
|
4828
|
-
onChange:
|
|
4827
|
+
multiple: !h || h > 1,
|
|
4828
|
+
onChange: ke,
|
|
4829
4829
|
className: ee.hiddenInput
|
|
4830
4830
|
}
|
|
4831
4831
|
),
|
|
4832
|
-
/* @__PURE__ */
|
|
4832
|
+
/* @__PURE__ */ C(
|
|
4833
4833
|
"div",
|
|
4834
4834
|
{
|
|
4835
4835
|
className: ee.clickArea,
|
|
4836
|
-
onClick:
|
|
4837
|
-
onDragOver:
|
|
4838
|
-
onDragLeave:
|
|
4839
|
-
onDrop:
|
|
4836
|
+
onClick: me,
|
|
4837
|
+
onDragOver: Ce,
|
|
4838
|
+
onDragLeave: v,
|
|
4839
|
+
onDrop: _e,
|
|
4840
4840
|
role: "button",
|
|
4841
4841
|
tabIndex: 0,
|
|
4842
|
-
onKeyDown: (
|
|
4843
|
-
(
|
|
4842
|
+
onKeyDown: (p) => {
|
|
4843
|
+
(p.key === "Enter" || p.key === " ") && me();
|
|
4844
4844
|
},
|
|
4845
4845
|
"aria-label": E(
|
|
4846
4846
|
"Click to upload images or drag and drop",
|
|
4847
4847
|
"a8c-agenttic"
|
|
4848
4848
|
),
|
|
4849
4849
|
children: [
|
|
4850
|
-
|
|
4850
|
+
De && /* @__PURE__ */ a("div", { className: ee.draggingMessage, children: /* @__PURE__ */ C("p", { children: [
|
|
4851
4851
|
/* @__PURE__ */ a("strong", { children: E(
|
|
4852
4852
|
"Drop files here to use",
|
|
4853
4853
|
"a8c-agenttic"
|
|
4854
4854
|
) }),
|
|
4855
4855
|
/* @__PURE__ */ a("br", {}),
|
|
4856
|
-
u &&
|
|
4856
|
+
u && Ee
|
|
4857
4857
|
] }) }),
|
|
4858
|
-
|
|
4859
|
-
|
|
4858
|
+
te && /* @__PURE__ */ C("div", { className: ee.preview, children: [
|
|
4859
|
+
he && e.map((p) => /* @__PURE__ */ a(
|
|
4860
4860
|
Eo,
|
|
4861
4861
|
{
|
|
4862
|
-
image:
|
|
4863
|
-
allowDragToInsert:
|
|
4862
|
+
image: p,
|
|
4863
|
+
allowDragToInsert: $,
|
|
4864
4864
|
showFileMetadata: N,
|
|
4865
|
-
onDragStart:
|
|
4865
|
+
onDragStart: Ve,
|
|
4866
4866
|
onDragEnd: xe,
|
|
4867
|
-
onRemove:
|
|
4867
|
+
onRemove: pe
|
|
4868
4868
|
},
|
|
4869
|
-
|
|
4869
|
+
p.id
|
|
4870
4870
|
)),
|
|
4871
|
-
|
|
4871
|
+
y && i.map(({ id: p }) => /* @__PURE__ */ a(
|
|
4872
4872
|
"div",
|
|
4873
4873
|
{
|
|
4874
4874
|
className: ee.previewItem,
|
|
4875
|
-
children:
|
|
4875
|
+
children: A || /* @__PURE__ */ a(
|
|
4876
4876
|
"div",
|
|
4877
4877
|
{
|
|
4878
4878
|
className: ee.uploadingIndicator,
|
|
@@ -4885,14 +4885,14 @@ const ho = "ImageUploader-module_container", fo = "ImageUploader-module_active",
|
|
|
4885
4885
|
}
|
|
4886
4886
|
)
|
|
4887
4887
|
},
|
|
4888
|
-
|
|
4888
|
+
p
|
|
4889
4889
|
))
|
|
4890
4890
|
] })
|
|
4891
4891
|
]
|
|
4892
4892
|
}
|
|
4893
4893
|
)
|
|
4894
4894
|
] }),
|
|
4895
|
-
|
|
4895
|
+
V && /* @__PURE__ */ a("div", { className: ee.invalidMessage, children: /* @__PURE__ */ a("p", { children: Re }) })
|
|
4896
4896
|
] })
|
|
4897
4897
|
}
|
|
4898
4898
|
)
|
|
@@ -4904,9 +4904,9 @@ const ho = "ImageUploader-module_container", fo = "ImageUploader-module_active",
|
|
|
4904
4904
|
message: $o
|
|
4905
4905
|
};
|
|
4906
4906
|
function Cc({ message: t = "" }) {
|
|
4907
|
-
return /* @__PURE__ */
|
|
4907
|
+
return /* @__PURE__ */ C("div", { className: ut.container, children: [
|
|
4908
4908
|
/* @__PURE__ */ a("div", { className: ut.line }),
|
|
4909
|
-
t && /* @__PURE__ */
|
|
4909
|
+
t && /* @__PURE__ */ C(Ke, { children: [
|
|
4910
4910
|
/* @__PURE__ */ a("span", { className: ut.message, children: t }),
|
|
4911
4911
|
/* @__PURE__ */ a("div", { className: ut.line })
|
|
4912
4912
|
] })
|
|
@@ -4927,7 +4927,7 @@ const Fo = "EmptyView-module_container", jo = "EmptyView-module_icon", Uo = "Emp
|
|
|
4927
4927
|
"a8c-agenttic"
|
|
4928
4928
|
),
|
|
4929
4929
|
help: o
|
|
4930
|
-
}) => /* @__PURE__ */
|
|
4930
|
+
}) => /* @__PURE__ */ C("div", { className: it.container, children: [
|
|
4931
4931
|
/* @__PURE__ */ a("div", { className: it.icon, children: i }),
|
|
4932
4932
|
/* @__PURE__ */ a("h2", { className: it.heading, children: n }),
|
|
4933
4933
|
t && t.length > 0 && /* @__PURE__ */ a("div", { className: it.suggestionsWrapper, children: /* @__PURE__ */ a(
|
|
@@ -4940,7 +4940,7 @@ const Fo = "EmptyView-module_container", jo = "EmptyView-module_icon", Uo = "Emp
|
|
|
4940
4940
|
}
|
|
4941
4941
|
) }),
|
|
4942
4942
|
o && /* @__PURE__ */ a("p", { className: it.help, children: o })
|
|
4943
|
-
] }), Vo = "ImageRenderer-module_container", Wo = "ImageRenderer-module_imageButton", zo = "ImageRenderer-module_selected", Go = "ImageRenderer-module_disabled", Zo = "ImageRenderer-module_image", Yo = "ImageRenderer-module_header",
|
|
4943
|
+
] }), Vo = "ImageRenderer-module_container", Wo = "ImageRenderer-module_imageButton", zo = "ImageRenderer-module_selected", Go = "ImageRenderer-module_disabled", Zo = "ImageRenderer-module_image", Yo = "ImageRenderer-module_header", Ze = {
|
|
4944
4944
|
container: Vo,
|
|
4945
4945
|
imageButton: Wo,
|
|
4946
4946
|
selected: zo,
|
|
@@ -4975,28 +4975,28 @@ const Tc = ({
|
|
|
4975
4975
|
header: i,
|
|
4976
4976
|
disabled: n = !1
|
|
4977
4977
|
}) => {
|
|
4978
|
-
const [o, c] =
|
|
4978
|
+
const [o, c] = Y(null), r = O(null), s = (l) => {
|
|
4979
4979
|
c(l.url), e(l);
|
|
4980
4980
|
};
|
|
4981
|
-
return
|
|
4981
|
+
return L(() => {
|
|
4982
4982
|
if (n || !o)
|
|
4983
4983
|
return;
|
|
4984
4984
|
const l = (g) => {
|
|
4985
4985
|
r.current && !r.current.contains(g.target) && (c(null), e(null));
|
|
4986
4986
|
};
|
|
4987
4987
|
return window.addEventListener("click", l, !0), () => window.removeEventListener("click", l, !0);
|
|
4988
|
-
}, [e, n, o]), /* @__PURE__ */
|
|
4989
|
-
i || /* @__PURE__ */
|
|
4988
|
+
}, [e, n, o]), /* @__PURE__ */ C(se.div, { children: [
|
|
4989
|
+
i || /* @__PURE__ */ C("div", { className: Ze.header, children: [
|
|
4990
4990
|
/* @__PURE__ */ a(Ko, {}),
|
|
4991
4991
|
" Done"
|
|
4992
4992
|
] }),
|
|
4993
|
-
/* @__PURE__ */ a("div", { className:
|
|
4993
|
+
/* @__PURE__ */ a("div", { className: Ze.container, ref: r, children: t.map((l) => /* @__PURE__ */ a(
|
|
4994
4994
|
"button",
|
|
4995
4995
|
{
|
|
4996
|
-
className:
|
|
4997
|
-
|
|
4998
|
-
!n && o === l.url ?
|
|
4999
|
-
n ?
|
|
4996
|
+
className: de(
|
|
4997
|
+
Ze.imageButton,
|
|
4998
|
+
!n && o === l.url ? Ze.selected : "",
|
|
4999
|
+
n ? Ze.disabled : ""
|
|
5000
5000
|
),
|
|
5001
5001
|
onClick: () => s(l),
|
|
5002
5002
|
disabled: n,
|
|
@@ -5006,7 +5006,7 @@ const Tc = ({
|
|
|
5006
5006
|
{
|
|
5007
5007
|
src: l.url,
|
|
5008
5008
|
alt: l.alt,
|
|
5009
|
-
className:
|
|
5009
|
+
className: Ze.image
|
|
5010
5010
|
}
|
|
5011
5011
|
)
|
|
5012
5012
|
},
|
|
@@ -5122,7 +5122,7 @@ function Ac({ className: t, size: e = 24 }) {
|
|
|
5122
5122
|
);
|
|
5123
5123
|
}
|
|
5124
5124
|
function Oc({ className: t, size: e = 24 }) {
|
|
5125
|
-
return /* @__PURE__ */
|
|
5125
|
+
return /* @__PURE__ */ C(
|
|
5126
5126
|
"svg",
|
|
5127
5127
|
{
|
|
5128
5128
|
width: e,
|
|
@@ -5153,7 +5153,7 @@ function Oc({ className: t, size: e = 24 }) {
|
|
|
5153
5153
|
);
|
|
5154
5154
|
}
|
|
5155
5155
|
function Lc({ className: t, size: e = 24 }) {
|
|
5156
|
-
return /* @__PURE__ */
|
|
5156
|
+
return /* @__PURE__ */ C(
|
|
5157
5157
|
"svg",
|
|
5158
5158
|
{
|
|
5159
5159
|
width: e,
|
|
@@ -5204,7 +5204,7 @@ function Nc({ className: t, size: e = 24 }) {
|
|
|
5204
5204
|
);
|
|
5205
5205
|
}
|
|
5206
5206
|
function xc({ className: t, size: e = 24 }) {
|
|
5207
|
-
return /* @__PURE__ */
|
|
5207
|
+
return /* @__PURE__ */ C(
|
|
5208
5208
|
"svg",
|
|
5209
5209
|
{
|
|
5210
5210
|
width: e,
|
|
@@ -5262,11 +5262,11 @@ const Jo = (t, e = "") => {
|
|
|
5262
5262
|
} catch (i) {
|
|
5263
5263
|
return console.warn(`Failed to get CSS variable ${t}:`, i), e;
|
|
5264
5264
|
}
|
|
5265
|
-
}, rt = ({ message: t, details: e }) => /* @__PURE__ */
|
|
5265
|
+
}, rt = ({ message: t, details: e }) => /* @__PURE__ */ C("div", { className: "chart-error", children: [
|
|
5266
5266
|
/* @__PURE__ */ a("strong", { children: "Chart Error:" }),
|
|
5267
5267
|
" ",
|
|
5268
5268
|
t,
|
|
5269
|
-
e && /* @__PURE__ */
|
|
5269
|
+
e && /* @__PURE__ */ C("details", { children: [
|
|
5270
5270
|
/* @__PURE__ */ a("summary", { children: "Show Details" }),
|
|
5271
5271
|
/* @__PURE__ */ a("pre", { children: e })
|
|
5272
5272
|
] })
|
|
@@ -5363,21 +5363,21 @@ const Jo = (t, e = "") => {
|
|
|
5363
5363
|
maxLabelLength: g = 15,
|
|
5364
5364
|
error: d,
|
|
5365
5365
|
...u
|
|
5366
|
-
} = t,
|
|
5366
|
+
} = t, h = (T, M) => !l || T.length <= M ? T : T.substring(0, M - 3) + "...", A = () => {
|
|
5367
5367
|
if (s === "item-comparison" && e && e.length > 0) {
|
|
5368
|
-
let
|
|
5369
|
-
return e.forEach((
|
|
5370
|
-
|
|
5371
|
-
const
|
|
5372
|
-
|
|
5368
|
+
let T = "";
|
|
5369
|
+
return e.forEach((M) => {
|
|
5370
|
+
M != null && M.data && M.data.forEach((D) => {
|
|
5371
|
+
const _ = D.label || "", j = h(_, g);
|
|
5372
|
+
j.length > T.length && (T = j);
|
|
5373
5373
|
});
|
|
5374
|
-
}), Mt(80, 6, 25,
|
|
5374
|
+
}), Mt(80, 6, 25, T.length);
|
|
5375
5375
|
}
|
|
5376
5376
|
return Mt();
|
|
5377
5377
|
}, x = {
|
|
5378
5378
|
...yn(r),
|
|
5379
|
-
bottom:
|
|
5380
|
-
},
|
|
5379
|
+
bottom: A()
|
|
5380
|
+
}, $ = s === "item-comparison" ? {
|
|
5381
5381
|
xScale: {
|
|
5382
5382
|
type: "band",
|
|
5383
5383
|
padding: 0.2
|
|
@@ -5385,7 +5385,7 @@ const Jo = (t, e = "") => {
|
|
|
5385
5385
|
axis: {
|
|
5386
5386
|
x: {
|
|
5387
5387
|
orientation: "bottom",
|
|
5388
|
-
tickFormat: (
|
|
5388
|
+
tickFormat: (T) => h(T, g),
|
|
5389
5389
|
tickLabelProps: {
|
|
5390
5390
|
fontSize: 11,
|
|
5391
5391
|
textAnchor: "end",
|
|
@@ -5403,7 +5403,7 @@ const Jo = (t, e = "") => {
|
|
|
5403
5403
|
dy: -15
|
|
5404
5404
|
}
|
|
5405
5405
|
}
|
|
5406
|
-
},
|
|
5406
|
+
}, f = {
|
|
5407
5407
|
data: e,
|
|
5408
5408
|
withTooltips: o,
|
|
5409
5409
|
renderTooltip: c,
|
|
@@ -5415,11 +5415,11 @@ const Jo = (t, e = "") => {
|
|
|
5415
5415
|
// TODO: Fix this inconsistency that seems to be in @automattic/charts
|
|
5416
5416
|
// Item-comparison mode requires axis config wrapped in 'options' prop
|
|
5417
5417
|
// Time-comparison mode requires axis config spread directly
|
|
5418
|
-
...s === "item-comparison" ? { options:
|
|
5418
|
+
...s === "item-comparison" ? { options: $ } : $,
|
|
5419
5419
|
...i && { currency: i },
|
|
5420
5420
|
...u
|
|
5421
5421
|
};
|
|
5422
|
-
return /* @__PURE__ */ a(fn, { error: d, children: /* @__PURE__ */ a(jn, { ...
|
|
5422
|
+
return /* @__PURE__ */ a(fn, { error: d, children: /* @__PURE__ */ a(jn, { ...f }) });
|
|
5423
5423
|
};
|
|
5424
5424
|
class Xo extends Dn {
|
|
5425
5425
|
constructor(e) {
|
|
@@ -5516,47 +5516,47 @@ const Qo = (t) => {
|
|
|
5516
5516
|
className: e = "",
|
|
5517
5517
|
config: i
|
|
5518
5518
|
}) => {
|
|
5519
|
-
const [n, o] =
|
|
5519
|
+
const [n, o] = Y(null), [c, r] = Y(
|
|
5520
5520
|
null
|
|
5521
|
-
), [s, l] =
|
|
5522
|
-
(
|
|
5523
|
-
var
|
|
5524
|
-
const { tooltipData:
|
|
5525
|
-
if (!
|
|
5521
|
+
), [s, l] = Y(300), g = O(null), d = w(
|
|
5522
|
+
(f) => {
|
|
5523
|
+
var H;
|
|
5524
|
+
const { tooltipData: T } = f, M = (H = T == null ? void 0 : T.nearestDatum) == null ? void 0 : H.datum;
|
|
5525
|
+
if (!M)
|
|
5526
5526
|
return null;
|
|
5527
|
-
const D = (
|
|
5527
|
+
const D = (I) => {
|
|
5528
5528
|
if (c != null && c.currency) {
|
|
5529
|
-
const { symbol:
|
|
5530
|
-
let
|
|
5531
|
-
return
|
|
5529
|
+
const { symbol: V, symbolPosition: m } = c.currency;
|
|
5530
|
+
let z;
|
|
5531
|
+
return I >= 1e6 ? z = `${(I / 1e6).toFixed(
|
|
5532
5532
|
1
|
|
5533
|
-
)}M` :
|
|
5533
|
+
)}M` : I >= 1e3 ? z = `${(I / 1e3).toFixed(1)}K` : z = I.toLocaleString(), m === "right" ? `${z}${V}` : `${V}${z}`;
|
|
5534
5534
|
}
|
|
5535
|
-
return
|
|
5536
|
-
},
|
|
5537
|
-
const
|
|
5538
|
-
((/* @__PURE__ */ new Date()).getTime() -
|
|
5535
|
+
return I >= 1e6 ? `${(I / 1e6).toFixed(1)}M` : I >= 1e3 ? `${(I / 1e3).toFixed(1)}K` : I.toLocaleString();
|
|
5536
|
+
}, _ = (I) => {
|
|
5537
|
+
const m = Math.floor(
|
|
5538
|
+
((/* @__PURE__ */ new Date()).getTime() - I.getTime()) / (1e3 * 60 * 60 * 24)
|
|
5539
5539
|
);
|
|
5540
|
-
return
|
|
5540
|
+
return m === 0 ? E("Today", "a8c-agenttic") : m === 1 ? E("Yesterday", "a8c-agenttic") : m < 7 ? je(
|
|
5541
5541
|
/* translators: %d: number of days */
|
|
5542
5542
|
E("%d days ago", "a8c-agenttic"),
|
|
5543
|
-
|
|
5544
|
-
) :
|
|
5543
|
+
m
|
|
5544
|
+
) : I.toLocaleDateString("en-US", {
|
|
5545
5545
|
year: "numeric",
|
|
5546
5546
|
month: "short",
|
|
5547
5547
|
day: "numeric"
|
|
5548
5548
|
});
|
|
5549
|
-
},
|
|
5550
|
-
(
|
|
5551
|
-
).map(([
|
|
5552
|
-
const
|
|
5549
|
+
}, j = M.label, K = Object.entries(
|
|
5550
|
+
(T == null ? void 0 : T.datumByKey) || {}
|
|
5551
|
+
).map(([I, V]) => {
|
|
5552
|
+
const m = V.datum;
|
|
5553
5553
|
return {
|
|
5554
|
-
key:
|
|
5555
|
-
value:
|
|
5554
|
+
key: I,
|
|
5555
|
+
value: m.value
|
|
5556
5556
|
};
|
|
5557
|
-
}).sort((
|
|
5558
|
-
return /* @__PURE__ */
|
|
5559
|
-
|
|
5557
|
+
}).sort((I, V) => V.value - I.value);
|
|
5558
|
+
return /* @__PURE__ */ C("div", { children: [
|
|
5559
|
+
j && /* @__PURE__ */ a(
|
|
5560
5560
|
"div",
|
|
5561
5561
|
{
|
|
5562
5562
|
style: {
|
|
@@ -5567,10 +5567,10 @@ const Qo = (t) => {
|
|
|
5567
5567
|
borderBottom: "1px solid #eee",
|
|
5568
5568
|
paddingBottom: "2px"
|
|
5569
5569
|
},
|
|
5570
|
-
children:
|
|
5570
|
+
children: j
|
|
5571
5571
|
}
|
|
5572
5572
|
),
|
|
5573
|
-
|
|
5573
|
+
M.date && /* @__PURE__ */ a(
|
|
5574
5574
|
"div",
|
|
5575
5575
|
{
|
|
5576
5576
|
style: {
|
|
@@ -5578,29 +5578,29 @@ const Qo = (t) => {
|
|
|
5578
5578
|
opacity: 0.8,
|
|
5579
5579
|
marginBottom: "4px"
|
|
5580
5580
|
},
|
|
5581
|
-
children:
|
|
5581
|
+
children: _(M.date)
|
|
5582
5582
|
}
|
|
5583
5583
|
),
|
|
5584
|
-
|
|
5584
|
+
K.map((I) => /* @__PURE__ */ C(
|
|
5585
5585
|
"div",
|
|
5586
5586
|
{
|
|
5587
5587
|
style: { marginBottom: "2px" },
|
|
5588
5588
|
children: [
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
|
|
5589
|
+
/* @__PURE__ */ C("strong", { children: [
|
|
5590
|
+
I.key,
|
|
5591
5591
|
":"
|
|
5592
5592
|
] }),
|
|
5593
5593
|
" ",
|
|
5594
|
-
D(
|
|
5594
|
+
D(I.value)
|
|
5595
5595
|
]
|
|
5596
5596
|
},
|
|
5597
|
-
|
|
5597
|
+
I.key
|
|
5598
5598
|
))
|
|
5599
5599
|
] });
|
|
5600
5600
|
},
|
|
5601
5601
|
[c == null ? void 0 : c.currency]
|
|
5602
5602
|
);
|
|
5603
|
-
|
|
5603
|
+
L(() => {
|
|
5604
5604
|
if (o(null), r(null), !t || typeof t != "string") {
|
|
5605
5605
|
o({
|
|
5606
5606
|
message: E("Invalid chart data provided", "a8c-agenttic"),
|
|
@@ -5609,8 +5609,8 @@ const Qo = (t) => {
|
|
|
5609
5609
|
return;
|
|
5610
5610
|
}
|
|
5611
5611
|
try {
|
|
5612
|
-
const
|
|
5613
|
-
if (!
|
|
5612
|
+
const f = JSON.parse(t.trim());
|
|
5613
|
+
if (!f.chartType) {
|
|
5614
5614
|
o({
|
|
5615
5615
|
message: E(
|
|
5616
5616
|
"Chart data must include chartType",
|
|
@@ -5620,7 +5620,7 @@ const Qo = (t) => {
|
|
|
5620
5620
|
});
|
|
5621
5621
|
return;
|
|
5622
5622
|
}
|
|
5623
|
-
if (!
|
|
5623
|
+
if (!f.data || !Array.isArray(f.data)) {
|
|
5624
5624
|
o({
|
|
5625
5625
|
message: E(
|
|
5626
5626
|
"Chart data must include a data array",
|
|
@@ -5630,7 +5630,7 @@ const Qo = (t) => {
|
|
|
5630
5630
|
});
|
|
5631
5631
|
return;
|
|
5632
5632
|
}
|
|
5633
|
-
if (
|
|
5633
|
+
if (f.data.length === 0) {
|
|
5634
5634
|
o({
|
|
5635
5635
|
message: E(
|
|
5636
5636
|
"No data points found for chart",
|
|
@@ -5640,37 +5640,37 @@ const Qo = (t) => {
|
|
|
5640
5640
|
});
|
|
5641
5641
|
return;
|
|
5642
5642
|
}
|
|
5643
|
-
const
|
|
5643
|
+
const T = f.data.map((D) => ({
|
|
5644
5644
|
...D,
|
|
5645
|
-
data: D.data.map((
|
|
5646
|
-
if (
|
|
5647
|
-
const
|
|
5648
|
-
return isNaN(
|
|
5649
|
-
`Invalid date string: "${
|
|
5645
|
+
data: D.data.map((_) => {
|
|
5646
|
+
if (_.date) {
|
|
5647
|
+
const j = new Date(_.date);
|
|
5648
|
+
return isNaN(j.getTime()) ? (console.warn(
|
|
5649
|
+
`Invalid date string: "${_.date}" in series "${D.label}"`
|
|
5650
5650
|
), {
|
|
5651
|
-
label:
|
|
5652
|
-
value:
|
|
5651
|
+
label: _.label,
|
|
5652
|
+
value: _.value,
|
|
5653
5653
|
date: void 0
|
|
5654
5654
|
}) : {
|
|
5655
|
-
label:
|
|
5656
|
-
value:
|
|
5657
|
-
date:
|
|
5655
|
+
label: _.label,
|
|
5656
|
+
value: _.value,
|
|
5657
|
+
date: j
|
|
5658
5658
|
};
|
|
5659
5659
|
}
|
|
5660
5660
|
return {
|
|
5661
|
-
label:
|
|
5662
|
-
value:
|
|
5661
|
+
label: _.label,
|
|
5662
|
+
value: _.value,
|
|
5663
5663
|
date: void 0
|
|
5664
5664
|
};
|
|
5665
5665
|
})
|
|
5666
|
-
})),
|
|
5667
|
-
chartType:
|
|
5668
|
-
title:
|
|
5669
|
-
data:
|
|
5670
|
-
currency:
|
|
5671
|
-
mode:
|
|
5666
|
+
})), M = {
|
|
5667
|
+
chartType: f.chartType,
|
|
5668
|
+
title: f.title,
|
|
5669
|
+
data: T,
|
|
5670
|
+
currency: f.currency,
|
|
5671
|
+
mode: f.mode || "time-comparison"
|
|
5672
5672
|
};
|
|
5673
|
-
r(
|
|
5673
|
+
r(M);
|
|
5674
5674
|
} catch {
|
|
5675
5675
|
o({
|
|
5676
5676
|
message: E(
|
|
@@ -5681,21 +5681,21 @@ const Qo = (t) => {
|
|
|
5681
5681
|
});
|
|
5682
5682
|
}
|
|
5683
5683
|
}, [t]);
|
|
5684
|
-
const u =
|
|
5685
|
-
if (g.current && g.current.disconnect(),
|
|
5686
|
-
const { width:
|
|
5687
|
-
l(
|
|
5688
|
-
for (const
|
|
5689
|
-
const
|
|
5684
|
+
const u = w((f) => {
|
|
5685
|
+
if (g.current && g.current.disconnect(), f) {
|
|
5686
|
+
const { width: T } = f.getBoundingClientRect(), M = Math.max(280, T - 4);
|
|
5687
|
+
l(M), g.current = new ResizeObserver((D) => {
|
|
5688
|
+
for (const _ of D) {
|
|
5689
|
+
const j = _.contentRect.width, K = Math.max(
|
|
5690
5690
|
280,
|
|
5691
|
-
|
|
5691
|
+
j - 4
|
|
5692
5692
|
);
|
|
5693
|
-
l(
|
|
5693
|
+
l(K);
|
|
5694
5694
|
}
|
|
5695
|
-
}), g.current.observe(
|
|
5695
|
+
}), g.current.observe(f);
|
|
5696
5696
|
}
|
|
5697
5697
|
}, []);
|
|
5698
|
-
if (
|
|
5698
|
+
if (L(() => () => {
|
|
5699
5699
|
g.current && (g.current.disconnect(), g.current = null);
|
|
5700
5700
|
}, []), n)
|
|
5701
5701
|
return /* @__PURE__ */ a(rt, { message: n.message, details: n.details });
|
|
@@ -5706,17 +5706,17 @@ const Qo = (t) => {
|
|
|
5706
5706
|
message: E("No chart data available", "a8c-agenttic")
|
|
5707
5707
|
}
|
|
5708
5708
|
);
|
|
5709
|
-
const
|
|
5709
|
+
const A = c.data.length > 1, x = s, N = {
|
|
5710
5710
|
data: c.data,
|
|
5711
5711
|
currency: c.currency,
|
|
5712
|
-
showLegend:
|
|
5712
|
+
showLegend: A,
|
|
5713
5713
|
withTooltips: !0,
|
|
5714
5714
|
renderTooltip: d,
|
|
5715
5715
|
error: null,
|
|
5716
5716
|
maxWidth: x,
|
|
5717
5717
|
aspectRatio: 1.2,
|
|
5718
5718
|
resizeDebounceTime: 300
|
|
5719
|
-
},
|
|
5719
|
+
}, $ = () => {
|
|
5720
5720
|
switch (c.chartType) {
|
|
5721
5721
|
case "line":
|
|
5722
5722
|
return /* @__PURE__ */ a(Qo, { ...N });
|
|
@@ -5741,14 +5741,14 @@ const Qo = (t) => {
|
|
|
5741
5741
|
);
|
|
5742
5742
|
}
|
|
5743
5743
|
};
|
|
5744
|
-
return /* @__PURE__ */ a(Xo, { chartData: t, children: /* @__PURE__ */
|
|
5744
|
+
return /* @__PURE__ */ a(Xo, { chartData: t, children: /* @__PURE__ */ C(
|
|
5745
5745
|
"div",
|
|
5746
5746
|
{
|
|
5747
5747
|
ref: u,
|
|
5748
5748
|
className: `chart-block ${e}`,
|
|
5749
5749
|
children: [
|
|
5750
5750
|
c.title && /* @__PURE__ */ a("h3", { className: "chart-block-title", children: c.title }),
|
|
5751
|
-
/* @__PURE__ */ a("div", { className: "chart-container", children:
|
|
5751
|
+
/* @__PURE__ */ a("div", { className: "chart-container", children: $() })
|
|
5752
5752
|
]
|
|
5753
5753
|
}
|
|
5754
5754
|
) });
|
|
@@ -5757,13 +5757,13 @@ function tc(t) {
|
|
|
5757
5757
|
return function(i) {
|
|
5758
5758
|
const { children: n, className: o, ...c } = i;
|
|
5759
5759
|
if (!(o == null ? void 0 : o.includes("language-chart")))
|
|
5760
|
-
return
|
|
5760
|
+
return ne.createElement(
|
|
5761
5761
|
"code",
|
|
5762
5762
|
{ className: o, ...c },
|
|
5763
5763
|
n
|
|
5764
5764
|
);
|
|
5765
5765
|
const s = typeof n == "string" ? n : "";
|
|
5766
|
-
return
|
|
5766
|
+
return ne.createElement(ec, {
|
|
5767
5767
|
data: s,
|
|
5768
5768
|
className: "markdown-chart",
|
|
5769
5769
|
config: t
|
|
@@ -5802,10 +5802,10 @@ function Ec(t = {}) {
|
|
|
5802
5802
|
e
|
|
5803
5803
|
), s = [...c.remarkPlugins, ...n];
|
|
5804
5804
|
return function({ children: g }) {
|
|
5805
|
-
const [d, u] =
|
|
5806
|
-
return
|
|
5807
|
-
o ? ic().then(async (
|
|
5808
|
-
const x = (await
|
|
5805
|
+
const [d, u] = ne.useState(g);
|
|
5806
|
+
return ne.useEffect(() => {
|
|
5807
|
+
o ? ic().then(async (h) => {
|
|
5808
|
+
const x = (await h.parseMarkdownIntoBlocks(g)).map((N) => h.parseIncompleteMarkdown(
|
|
5809
5809
|
N.trim()
|
|
5810
5810
|
)).join(`
|
|
5811
5811
|
|
|
@@ -5929,12 +5929,12 @@ export {
|
|
|
5929
5929
|
Ac as ZoomIcon,
|
|
5930
5930
|
Oc as ZoomIconFilled,
|
|
5931
5931
|
vc as animations,
|
|
5932
|
-
|
|
5932
|
+
de as cn,
|
|
5933
5933
|
Rc as createFeedbackActions,
|
|
5934
5934
|
Ec as createMessageRenderer,
|
|
5935
5935
|
yc as default,
|
|
5936
5936
|
_i as loadAgentticTranslations,
|
|
5937
|
-
|
|
5937
|
+
Ne as useAgentUIContext,
|
|
5938
5938
|
Za as useChat,
|
|
5939
5939
|
Ya as useInput
|
|
5940
5940
|
};
|