@automattic/agenttic-ui 0.1.70 → 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/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import './global.css';import './index.css';/* empty css */
2
- import { jsx as a, jsxs as w, Fragment as Ke } from "react/jsx-runtime";
2
+ import { jsx as a, jsxs as C, Fragment as Ke } from "react/jsx-runtime";
3
3
  import * as Yt from "react";
4
- import ae, { useState as Z, useEffect as O, useCallback as b, useRef as A, createContext as On, useContext as Ln, useId as Nn, useMemo as rt, memo as Kt, forwardRef as Jt, useImperativeHandle as xn, Component as Dn } from "react";
5
- import { c as pe } from "./QuestionCard-KolZKB58.js";
6
- import { Q as Pc } from "./QuestionCard-KolZKB58.js";
7
- import { motion as se, AnimatePresence as ot, useMotionValue as pt, useDragControls as qt, animate as ye } from "framer-motion";
8
- import { setLocaleData as Ht, __ as E, sprintf as Fe } from "@wordpress/i18n";
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
+ import { Q as Fc } from "./QuestionCard-KolZKB58.js";
7
+ import { motion as se, AnimatePresence as ct, useMotionValue as pt, useDragControls as qt, animate as ye } from "framer-motion";
8
+ import { setLocaleData as Ht, __ as E, sprintf as je } from "@wordpress/i18n";
9
9
  import { Slot as En } from "@radix-ui/react-slot";
10
- import * as je from "@radix-ui/react-popover";
10
+ import * as Ue from "@radix-ui/react-popover";
11
11
  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 y = {
15
+ const b = {
16
16
  COLLAPSED_SIZE: 56,
17
17
  COMPACT_WIDTH: 372,
18
18
  EXPANDED_HEIGHT: 520,
@@ -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] = Z(e);
1714
- O(() => {
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 = b(() => {
1717
+ const o = i === "expanded", c = w(() => {
1718
1718
  n("expanded");
1719
- }, []), r = b(() => {
1719
+ }, []), r = w(() => {
1720
1720
  n(e);
1721
- }, [e]), s = b(() => {
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 = A(null), l = b(() => {
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 = b(() => {
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 h = u.scrollHeight, M = 40, x = 200;
1755
+ const h = u.scrollHeight, A = 40, x = 200;
1756
1756
  u.style.height = `${Math.min(
1757
- Math.max(h, M),
1757
+ Math.max(h, A),
1758
1758
  x
1759
1759
  )}px`;
1760
- }, []), d = b(
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 O(() => {
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] = Z(!0);
1779
- return O(() => {
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 - y.VIEWPORT_OFFSET * 2, c = 2 * y.VIEWPORT_OFFSET + n - window.innerHeight;
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 - y.COMPACT_WIDTH - y.VIEWPORT_OFFSET * 2 : 0;
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
- y.COMPACT_WIDTH,
1816
- y.EXPANDED_HEIGHT
1815
+ b.COMPACT_WIDTH,
1816
+ b.EXPANDED_HEIGHT
1817
1817
  );
1818
1818
  }
1819
1819
  function ht(t) {
@@ -1827,16 +1827,16 @@ const It = {
1827
1827
  type: "spring",
1828
1828
  stiffness: 300,
1829
1829
  damping: 30
1830
- }, Ue = {
1830
+ }, Be = {
1831
1831
  type: "spring",
1832
1832
  damping: 40,
1833
1833
  stiffness: 500,
1834
1834
  mass: 0.8
1835
1835
  }, ft = {
1836
- ...Ue,
1836
+ ...Be,
1837
1837
  stiffness: 1e3,
1838
1838
  damping: 90
1839
- }, Be = {
1839
+ }, He = {
1840
1840
  type: "spring",
1841
1841
  damping: 40,
1842
1842
  stiffness: 500,
@@ -1868,17 +1868,17 @@ const It = {
1868
1868
  }, Si = {
1869
1869
  "0%": { backgroundPosition: "-200% 0" },
1870
1870
  "100%": { backgroundPosition: "200% 0" }
1871
- }, hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1871
+ }, vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1872
1872
  __proto__: null,
1873
1873
  fadeVariants: Xa,
1874
- fastSpring: Ue,
1874
+ fastSpring: Be,
1875
1875
  fastSpringWithDelay: ft,
1876
1876
  getDragConstraints: Ii,
1877
- morphSpring: Be,
1877
+ morphSpring: He,
1878
1878
  springConfig: It,
1879
1879
  thinkingGradientKeyframes: Si
1880
1880
  }, Symbol.toStringTag, { value: "Module" })), Qa = On(null);
1881
- function Oe() {
1881
+ function Ne() {
1882
1882
  const t = Ln(Qa);
1883
1883
  if (!t)
1884
1884
  throw new Error(
@@ -1889,7 +1889,7 @@ function Oe() {
1889
1889
  function Vt({ children: t, value: e }) {
1890
1890
  return /* @__PURE__ */ a(Qa.Provider, { value: e, children: t });
1891
1891
  }
1892
- const ki = "button-module_button", Mi = "button-module_pressed", Ai = "button-module_primary", Oi = "button-module_ghost", Li = "button-module_outline", Ni = "button-module_transparent", xi = "button-module_link", Di = "button-module_icon", Ei = "button-module_sm", Ri = "button-module_lg", Pi = "button-module_withTextAndIcon", Qe = {
1892
+ const ki = "button-module_button", Mi = "button-module_pressed", Ai = "button-module_primary", Oi = "button-module_ghost", Li = "button-module_outline", Ni = "button-module_transparent", xi = "button-module_link", Di = "button-module_icon", Ei = "button-module_sm", Ri = "button-module_lg", Pi = "button-module_withTextAndIcon", et = {
1893
1893
  button: ki,
1894
1894
  pressed: Mi,
1895
1895
  primary: Ai,
@@ -1913,17 +1913,17 @@ const ki = "button-module_button", Mi = "button-module_pressed", Ai = "button-mo
1913
1913
  ...l
1914
1914
  }, g) {
1915
1915
  const d = r ? En : "button", u = !!o, h = n || (u && !c ? "icon" : void 0);
1916
- return /* @__PURE__ */ w(
1916
+ return /* @__PURE__ */ C(
1917
1917
  d,
1918
1918
  {
1919
1919
  ref: g,
1920
1920
  "data-slot": "button",
1921
- className: pe(
1922
- Qe.button,
1923
- Qe[i],
1924
- h && Qe[h],
1925
- u && c ? Qe.withTextAndIcon : void 0,
1926
- s ? Qe.pressed : void 0,
1921
+ className: de(
1922
+ et.button,
1923
+ et[i],
1924
+ h && et[h],
1925
+ u && c ? et.withTextAndIcon : void 0,
1926
+ s ? et.pressed : void 0,
1927
1927
  e
1928
1928
  ),
1929
1929
  "aria-pressed": s,
@@ -1966,8 +1966,8 @@ function en({
1966
1966
  onHover: i,
1967
1967
  focusOnMount: n = !1
1968
1968
  }) {
1969
- const o = A(null), c = A(n);
1970
- return O(() => {
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,
@@ -1983,7 +1983,7 @@ function en({
1983
1983
  opacity: 1,
1984
1984
  scale: 1,
1985
1985
  transition: {
1986
- ...Be,
1986
+ ...He,
1987
1987
  delay: 0.2
1988
1988
  }
1989
1989
  },
@@ -2067,7 +2067,7 @@ function Hi({ className: t, size: e = 24 }) {
2067
2067
  }
2068
2068
  );
2069
2069
  }
2070
- const Vi = "ChatInput-module_container", Wi = "ChatInput-module_textareaContainer", zi = "ChatInput-module_actions", Gi = "ChatInput-module_containerStacked", Zi = "ChatInput-module_button", $e = {
2070
+ const Vi = "ChatInput-module_container", Wi = "ChatInput-module_textareaContainer", zi = "ChatInput-module_actions", Gi = "ChatInput-module_containerStacked", Zi = "ChatInput-module_button", Fe = {
2071
2071
  container: Vi,
2072
2072
  textareaContainer: Wi,
2073
2073
  actions: zi,
@@ -2104,19 +2104,19 @@ function Ji({
2104
2104
  interval: e = 3e3,
2105
2105
  className: i = ""
2106
2106
  }) {
2107
- const [n, o] = Z(0);
2108
- return O(() => {
2107
+ const [n, o] = Y(0);
2108
+ return L(() => {
2109
2109
  const c = setInterval(() => {
2110
2110
  o(
2111
2111
  (r) => (r + 1) % t.length
2112
2112
  );
2113
2113
  }, e);
2114
2114
  return () => clearInterval(c);
2115
- }, [t.length, e]), /* @__PURE__ */ a(ot, { mode: "wait", children: /* @__PURE__ */ a(
2115
+ }, [t.length, e]), /* @__PURE__ */ a(ct, { mode: "wait", children: /* @__PURE__ */ a(
2116
2116
  se.span,
2117
2117
  {
2118
2118
  "data-slot": "animated-placeholder",
2119
- className: pe(Ki.container, i),
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 },
@@ -2144,90 +2144,90 @@ function Nt({
2144
2144
  fromCompact: d = !1,
2145
2145
  onExpand: u,
2146
2146
  showExpandButton: h = !0,
2147
- focusOnMount: M = !1,
2147
+ focusOnMount: A = !1,
2148
2148
  customActions: x = [],
2149
2149
  actionOrder: N = "before-submit",
2150
- onStop: j,
2151
- disabled: p,
2152
- onMouseEnter: _,
2153
- onMouseLeave: k,
2150
+ onStop: $,
2151
+ disabled: f,
2152
+ onMouseEnter: T,
2153
+ onMouseLeave: M,
2154
2154
  expandOnClick: D = !1,
2155
- layout: C = "inline"
2155
+ layout: _ = "inline"
2156
2156
  }) {
2157
- const H = Nn(), { variant: Y, floatingChatState: z, isInputOverLimit: S } = Oe(), m = (
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
- p !== void 0 ? !p : (t.trim() || r) && !S
2160
- ), V = b(
2161
- (T) => {
2162
- const Te = T.key.toLowerCase();
2163
- if (Te === "enter" && !T.shiftKey && (T.nativeEvent.isComposing || T.keyCode === 229)) {
2164
- T.preventDefault();
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 (Te === "enter" && !T.shiftKey && !m) {
2168
- T.preventDefault();
2167
+ if (_e === "enter" && !v.shiftKey && !V) {
2168
+ v.preventDefault();
2169
2169
  return;
2170
2170
  }
2171
- ((T.metaKey || T.ctrlKey) && Te === "z" || T.ctrlKey && Te === "y") && T.stopPropagation(), n(T);
2171
+ ((v.metaKey || v.ctrlKey) && _e === "z" || v.ctrlKey && _e === "y") && v.stopPropagation(), n(v);
2172
2172
  },
2173
- [m, n]
2174
- ), G = (T) => T.endsWith("…") ? T : `${T}…`, ne = Array.isArray(c);
2175
- let q;
2176
- ne ? q = c.map(G) : c ? q = G(c) : q = "";
2177
- const _e = A(M);
2178
- O(() => {
2179
- _e.current && o.current && o.current.focus(), _e.current = !1;
2180
- }, [_e, o]);
2181
- const ie = () => x.map((T) => /* @__PURE__ */ a(
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: T.className || $e.button,
2185
- onClick: T.onClick,
2186
- disabled: T.disabled,
2187
- variant: T.variant || "ghost",
2188
- icon: T.icon,
2189
- "aria-label": T["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
- T.id
2192
- )), oe = () => Y === "embedded" || z === "expanded" || D ? null : h && u ? /* @__PURE__ */ a(
2191
+ v.id
2192
+ )), J = () => K === "embedded" || H === "expanded" || D ? null : h && u ? /* @__PURE__ */ a(
2193
2193
  we,
2194
2194
  {
2195
- className: $e.button,
2195
+ className: Fe.button,
2196
2196
  onClick: u,
2197
2197
  variant: "ghost",
2198
2198
  icon: /* @__PURE__ */ a(an, {}),
2199
2199
  "aria-label": E("Expand conversation", "a8c-agenttic")
2200
2200
  }
2201
- ) : null, P = () => {
2202
- if (r && !j)
2201
+ ) : null, Ce = () => {
2202
+ if (r && !$)
2203
2203
  return null;
2204
- const T = () => {
2205
- r && j ? j() : i();
2204
+ const v = () => {
2205
+ r && $ ? $() : i();
2206
2206
  };
2207
2207
  return /* @__PURE__ */ a(
2208
2208
  we,
2209
2209
  {
2210
- className: $e.button,
2211
- onClick: T,
2212
- disabled: !m,
2210
+ className: Fe.button,
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__ */ w(
2219
+ return /* @__PURE__ */ C(
2220
2220
  "div",
2221
2221
  {
2222
2222
  "data-slot": "chat-input",
2223
- className: `${$e.container}${C === "stacked" ? ` ${$e.containerStacked}` : ""}`,
2224
- onMouseEnter: _,
2225
- onMouseLeave: k,
2223
+ className: `${Fe.container}${_ === "stacked" ? ` ${Fe.containerStacked}` : ""}`,
2224
+ onMouseEnter: T,
2225
+ onMouseLeave: M,
2226
2226
  children: [
2227
- /* @__PURE__ */ w(
2227
+ /* @__PURE__ */ C(
2228
2228
  se.div,
2229
2229
  {
2230
- className: $e.textareaContainer,
2230
+ className: Fe.textareaContainer,
2231
2231
  initial: {
2232
2232
  opacity: 0
2233
2233
  },
@@ -2237,24 +2237,24 @@ function Nt({
2237
2237
  transition: t.trim() ? { duration: 0 } : ft
2238
2238
  },
2239
2239
  children: [
2240
- !t && ne && /* @__PURE__ */ a(
2240
+ !t && ie && /* @__PURE__ */ a(
2241
2241
  Ji,
2242
2242
  {
2243
- texts: q
2243
+ texts: W
2244
2244
  }
2245
2245
  ),
2246
2246
  /* @__PURE__ */ a(
2247
2247
  tn,
2248
2248
  {
2249
- id: H,
2249
+ id: j,
2250
2250
  ref: o,
2251
2251
  value: t,
2252
- onChange: (T) => e(T.target.value),
2253
- onKeyDown: V,
2252
+ onChange: (v) => e(v.target.value),
2253
+ onKeyDown: m,
2254
2254
  onBlur: s,
2255
2255
  onFocus: l,
2256
2256
  onClick: g,
2257
- placeholder: ne ? "" : q,
2257
+ placeholder: ie ? "" : W,
2258
2258
  rows: 1,
2259
2259
  "aria-label": E("Chat input", "a8c-agenttic")
2260
2260
  }
@@ -2262,10 +2262,10 @@ function Nt({
2262
2262
  ]
2263
2263
  }
2264
2264
  ),
2265
- /* @__PURE__ */ w(
2265
+ /* @__PURE__ */ C(
2266
2266
  se.div,
2267
2267
  {
2268
- className: $e.actions,
2268
+ className: Fe.actions,
2269
2269
  initial: {
2270
2270
  opacity: d ? 1 : 0,
2271
2271
  scale: d ? 1 : 0.5
@@ -2273,13 +2273,13 @@ function Nt({
2273
2273
  animate: {
2274
2274
  opacity: 1,
2275
2275
  scale: 1,
2276
- transition: t.trim() ? { duration: 0 } : Ue
2276
+ transition: t.trim() ? { duration: 0 } : Be
2277
2277
  },
2278
2278
  children: [
2279
- oe(),
2280
- N === "before-submit" && ie(),
2281
- P(),
2282
- N === "after-submit" && ie()
2279
+ J(),
2280
+ N === "before-submit" && ge(),
2281
+ Ce(),
2282
+ N === "after-submit" && ge()
2283
2283
  ]
2284
2284
  }
2285
2285
  )
@@ -2309,97 +2309,100 @@ function qi({ className: t, size: e = 24 }) {
2309
2309
  }
2310
2310
  );
2311
2311
  }
2312
- const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-module_chevron", er = "SuggestionDropdown-module_chevronOpen", tr = "SuggestionDropdown-module_dropdown", ar = "SuggestionDropdown-module_option", et = {
2312
+ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-module_chevron", er = "SuggestionDropdown-module_chevronOpen", tr = "SuggestionDropdown-module_dropdown", ar = "SuggestionDropdown-module_option", tt = {
2313
2313
  container: Xi,
2314
2314
  chevron: Qi,
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_floating", nt = {
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,
2322
- floating: or
2323
- }, cr = (t, e) => !t || !e ? `${t}${e}` : /\s$/.test(t) || /^\s/.test(e) ? `${t}${e}` : `${t} ${e}`, sr = ({
2322
+ "suggestion-content--with-description": "Suggestions-module_suggestion-content--with-description",
2323
+ label: or,
2324
+ description: cr,
2325
+ floating: sr
2326
+ }, lr = (t, e) => !t || !e ? `${t}${e}` : /\s$/.test(t) || /^\s/.test(e) ? `${t}${e}` : `${t} ${e}`, dr = ({
2324
2327
  suggestion: t,
2325
2328
  onSelect: e,
2326
2329
  availableSuggestions: i,
2327
2330
  onOpenChange: n
2328
2331
  }) => {
2329
- var j;
2330
- const [o, c] = ae.useState(!1), r = ae.useRef(null), [s, l] = ae.useState(null), [g, d] = ae.useState(null), [u, h] = ae.useState(void 0), M = ae.useCallback(
2331
- (p) => {
2332
- if (r.current = p, !p) {
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) {
2333
2336
  l(null), d(null);
2334
2337
  return;
2335
2338
  }
2336
2339
  l(
2337
- p.closest(".agenttic") ?? p
2340
+ f.closest(".agenttic") ?? f
2338
2341
  ), d(
2339
- p.closest(
2342
+ f.closest(
2340
2343
  '[data-slot="conversation-view"]'
2341
2344
  ) ?? null
2342
2345
  );
2343
2346
  },
2344
2347
  []
2345
- ), x = ae.useCallback((p) => {
2346
- var _;
2347
- if (p) {
2348
- const k = (_ = r.current) == null ? void 0 : _.closest(
2348
+ ), x = ne.useCallback((f) => {
2349
+ var T;
2350
+ if (f) {
2351
+ const M = (T = r.current) == null ? void 0 : T.closest(
2349
2352
  '[data-slot="suggestions"]'
2350
2353
  );
2351
- k && h(k.clientWidth * 0.9);
2354
+ M && h(M.clientWidth * 0.9);
2352
2355
  }
2353
- c(p), n == null || n(p);
2354
- }, [n]), N = (p) => {
2355
- const { options: _, ...k } = t, D = {
2356
- ...k,
2357
- prompt: cr(
2356
+ c(f), n == null || n(f);
2357
+ }, [n]), N = (f) => {
2358
+ const { options: T, ...M } = t, D = {
2359
+ ...M,
2360
+ prompt: lr(
2358
2361
  t.prompt ?? t.label,
2359
- p.value
2362
+ f.value
2360
2363
  ),
2361
- label: `${t.label} ${p.label}`
2364
+ label: `${t.label} ${f.label}`
2362
2365
  };
2363
2366
  e == null || e(D, i), x(!1);
2364
2367
  };
2365
- return /* @__PURE__ */ a("div", { ref: M, className: et.container, children: /* @__PURE__ */ w(je.Root, { open: o, onOpenChange: x, children: [
2366
- /* @__PURE__ */ a(je.Trigger, { asChild: !0, children: /* @__PURE__ */ w(
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(
2367
2370
  we,
2368
2371
  {
2369
2372
  variant: "outline",
2370
- className: nt.button,
2373
+ className: Le.button,
2371
2374
  children: [
2372
2375
  t.label,
2373
2376
  /* @__PURE__ */ a(
2374
2377
  qi,
2375
2378
  {
2376
2379
  size: 14,
2377
- className: `${et.chevron} ${o ? et.chevronOpen : ""}`
2380
+ className: `${tt.chevron} ${o ? tt.chevronOpen : ""}`
2378
2381
  }
2379
2382
  )
2380
2383
  ]
2381
2384
  }
2382
2385
  ) }),
2383
- s && /* @__PURE__ */ a(je.Portal, { container: s, children: /* @__PURE__ */ a(
2384
- je.Content,
2386
+ s && /* @__PURE__ */ a(Ue.Portal, { container: s, children: /* @__PURE__ */ a(
2387
+ Ue.Content,
2385
2388
  {
2386
- className: et.dropdown,
2389
+ className: tt.dropdown,
2387
2390
  side: "top",
2388
2391
  align: "start",
2389
2392
  sideOffset: 4,
2390
2393
  collisionBoundary: g,
2391
2394
  "aria-label": t.label,
2392
2395
  style: u ? { width: u } : void 0,
2393
- children: (j = t.options) == null ? void 0 : j.map((p) => /* @__PURE__ */ a(
2396
+ children: ($ = t.options) == null ? void 0 : $.map((f) => /* @__PURE__ */ a(
2394
2397
  "button",
2395
2398
  {
2396
2399
  type: "button",
2397
2400
  "data-slot": "suggestion-option",
2398
- className: et.option,
2399
- onClick: () => N(p),
2400
- children: p.label
2401
+ className: tt.option,
2402
+ onClick: () => N(f),
2403
+ children: f.label
2401
2404
  },
2402
- p.id
2405
+ f.id
2403
2406
  ))
2404
2407
  }
2405
2408
  ) })
@@ -2415,20 +2418,20 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
2415
2418
  onDropdownOpenChange: s,
2416
2419
  translateY: l = "-100%"
2417
2420
  }) => {
2418
- const { variant: g } = Oe(), d = rt(
2421
+ const { variant: g } = Ne(), d = ot(
2419
2422
  () => g === "floating" ? e == null ? void 0 : e.slice(0, 3) : e,
2420
2423
  [e, g]
2421
- ), u = async (h, M) => {
2424
+ ), u = async (h, A) => {
2422
2425
  let x = !0;
2423
- h.action && (x = await h.action()), x && i && h.prompt && i(h, M);
2426
+ h.action && (x = await h.action()), x && i && h.prompt && i(h, A);
2424
2427
  };
2425
- return !d || d.length === 0 ? null : /* @__PURE__ */ a(ot, { children: o && /* @__PURE__ */ a(
2428
+ return !d || d.length === 0 ? null : /* @__PURE__ */ a(ct, { children: o && /* @__PURE__ */ a(
2426
2429
  se.div,
2427
2430
  {
2428
2431
  "data-slot": "suggestions",
2429
- className: pe(
2430
- nt.container,
2431
- n === "vertical" ? nt.vertical : n === "floating" ? nt.floating : "",
2432
+ className: de(
2433
+ Le.container,
2434
+ n === "vertical" ? Le.vertical : n === "floating" ? Le.floating : "",
2432
2435
  t
2433
2436
  ),
2434
2437
  initial: { opacity: 0, y: "-80%" },
@@ -2438,69 +2441,96 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
2438
2441
  onMouseEnter: c,
2439
2442
  onMouseLeave: r,
2440
2443
  children: d.map(
2441
- (h, M) => /* @__PURE__ */ a(
2442
- se.div,
2443
- {
2444
- initial: { opacity: 0, y: 10 },
2445
- animate: { opacity: 1, y: 0 },
2446
- exit: { opacity: 0, y: 10 },
2447
- transition: {
2448
- ...ft,
2449
- delay: M * 0.05
2444
+ (h, A) => {
2445
+ const x = !!h.description && n !== "horizontal";
2446
+ return /* @__PURE__ */ a(
2447
+ se.div,
2448
+ {
2449
+ initial: { opacity: 0, y: 10 },
2450
+ animate: { opacity: 1, y: 0 },
2451
+ exit: { opacity: 0, y: 10 },
2452
+ transition: {
2453
+ ...ft,
2454
+ delay: A * 0.05
2455
+ },
2456
+ children: h.options && h.options.length > 0 ? /* @__PURE__ */ a(
2457
+ dr,
2458
+ {
2459
+ suggestion: h,
2460
+ onSelect: u,
2461
+ availableSuggestions: d,
2462
+ onOpenChange: s
2463
+ }
2464
+ ) : /* @__PURE__ */ a(
2465
+ we,
2466
+ {
2467
+ onClick: (N) => {
2468
+ N.stopPropagation(), u(
2469
+ h,
2470
+ d
2471
+ );
2472
+ },
2473
+ variant: "outline",
2474
+ className: Le.button,
2475
+ children: /* @__PURE__ */ C(
2476
+ "div",
2477
+ {
2478
+ className: de(
2479
+ Le["suggestion-content"],
2480
+ x ? Le["suggestion-content--with-description"] : ""
2481
+ ),
2482
+ children: [
2483
+ /* @__PURE__ */ a(
2484
+ "span",
2485
+ {
2486
+ className: Le.label,
2487
+ children: h.label
2488
+ }
2489
+ ),
2490
+ x && /* @__PURE__ */ a(
2491
+ "span",
2492
+ {
2493
+ className: Le.description,
2494
+ children: h.description
2495
+ }
2496
+ )
2497
+ ]
2498
+ }
2499
+ )
2500
+ }
2501
+ )
2450
2502
  },
2451
- children: h.options && h.options.length > 0 ? /* @__PURE__ */ a(
2452
- sr,
2453
- {
2454
- suggestion: h,
2455
- onSelect: u,
2456
- availableSuggestions: d,
2457
- onOpenChange: s
2458
- }
2459
- ) : /* @__PURE__ */ a(
2460
- we,
2461
- {
2462
- onClick: (x) => {
2463
- x.stopPropagation(), u(
2464
- h,
2465
- d
2466
- );
2467
- },
2468
- variant: "outline",
2469
- className: nt.button,
2470
- children: h.label
2471
- }
2472
- )
2473
- },
2474
- h.id
2475
- )
2503
+ h.id
2504
+ );
2505
+ }
2476
2506
  )
2477
2507
  }
2478
2508
  ) });
2479
2509
  };
2480
- function lr() {
2481
- const t = A(/* @__PURE__ */ new Map()), e = b((c) => {
2510
+ function ur() {
2511
+ const t = O(/* @__PURE__ */ new Map()), e = w((c) => {
2482
2512
  const r = t.current.get(c);
2483
2513
  r && (clearTimeout(r), t.current.delete(c));
2484
- }, []), i = b(
2514
+ }, []), i = w(
2485
2515
  (c, r, s) => {
2486
2516
  e(c);
2487
2517
  const l = setTimeout(r, s);
2488
2518
  return t.current.set(c, l), l;
2489
2519
  },
2490
2520
  [e]
2491
- ), n = b(() => {
2521
+ ), n = w(() => {
2492
2522
  t.current.forEach((c) => {
2493
2523
  clearTimeout(c);
2494
2524
  }), t.current.clear();
2495
- }, []), o = b((c) => t.current.has(c), []);
2496
- return O(() => n, [n]), {
2525
+ }, []), o = w((c) => t.current.has(c), []);
2526
+ return L(() => n, [n]), {
2497
2527
  setNamedTimeout: i,
2498
2528
  clearNamedTimeout: e,
2499
2529
  clearAllTimeouts: n,
2500
2530
  hasTimeout: o
2501
2531
  };
2502
2532
  }
2503
- const dr = 4e3;
2533
+ const gr = 4e3;
2504
2534
  function nn({
2505
2535
  value: t,
2506
2536
  onChange: e,
@@ -2515,35 +2545,35 @@ function nn({
2515
2545
  showExpandButton: d = !0,
2516
2546
  focusOnMount: u = !1,
2517
2547
  customActions: h,
2518
- actionOrder: M,
2548
+ actionOrder: A,
2519
2549
  onStop: x,
2520
2550
  suggestions: N,
2521
- clearSuggestions: j,
2522
- handleSuggestionSubmit: p,
2523
- expandOnClick: _ = !1
2551
+ clearSuggestions: $,
2552
+ handleSuggestionSubmit: f,
2553
+ expandOnClick: T = !1
2524
2554
  }) {
2525
- const [k, D] = Z(!1), [C, H] = Z(!1), { setNamedTimeout: Y, clearAllTimeouts: z } = lr(), S = b(() => {
2526
- Y(
2555
+ const [M, D] = Y(!1), [_, j] = Y(!1), { setNamedTimeout: K, clearAllTimeouts: H } = ur(), I = w(() => {
2556
+ K(
2527
2557
  "hide-suggestions",
2528
2558
  () => {
2529
2559
  D(!1);
2530
2560
  },
2531
- dr
2561
+ gr
2532
2562
  );
2533
- }, [Y]), m = b(() => {
2534
- C || S();
2535
- }, [C, S]), V = b(() => {
2536
- z(), D(!0);
2537
- }, [z]), G = b(
2538
- (q) => {
2539
- H(q), q ? V() : S();
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();
2540
2570
  },
2541
- [S, V]
2542
- ), ne = b(() => {
2543
- _ && g && !t && g();
2544
- }, [_, g, t]);
2545
- return O(() => {
2546
- if (z(), t) {
2571
+ [I, m]
2572
+ ), ie = w(() => {
2573
+ T && g && !t && g();
2574
+ }, [T, g, t]);
2575
+ return L(() => {
2576
+ if (H(), t) {
2547
2577
  D(!1);
2548
2578
  return;
2549
2579
  }
@@ -2551,18 +2581,18 @@ function nn({
2551
2581
  D(!1);
2552
2582
  return;
2553
2583
  }
2554
- if (C) {
2584
+ if (_) {
2555
2585
  D(!0);
2556
2586
  return;
2557
2587
  }
2558
- D(!0), S();
2588
+ D(!0), I();
2559
2589
  }, [
2560
2590
  t,
2561
2591
  N,
2562
- C,
2563
- z,
2564
- S
2565
- ]), /* @__PURE__ */ w(Ke, { children: [
2592
+ _,
2593
+ H,
2594
+ I
2595
+ ]), /* @__PURE__ */ C(Ke, { children: [
2566
2596
  /* @__PURE__ */ a(
2567
2597
  Nt,
2568
2598
  {
@@ -2575,36 +2605,36 @@ function nn({
2575
2605
  isProcessing: r,
2576
2606
  onBlur: s,
2577
2607
  onFocus: l,
2578
- onClick: ne,
2608
+ onClick: ie,
2579
2609
  onExpand: g,
2580
2610
  showExpandButton: d,
2581
2611
  focusOnMount: u,
2582
2612
  customActions: h,
2583
- actionOrder: M,
2613
+ actionOrder: A,
2584
2614
  onStop: x,
2585
- expandOnClick: _,
2586
- onMouseEnter: V,
2587
- onMouseLeave: () => m()
2615
+ expandOnClick: T,
2616
+ onMouseEnter: m,
2617
+ onMouseLeave: () => V()
2588
2618
  }
2589
2619
  ),
2590
2620
  !t && /* @__PURE__ */ a(
2591
2621
  vt,
2592
2622
  {
2593
2623
  suggestions: N,
2594
- onSubmit: p,
2624
+ onSubmit: f,
2595
2625
  layout: "floating",
2596
- visible: k,
2597
- onMouseEnter: V,
2598
- onMouseLeave: () => m(),
2599
- onDropdownOpenChange: G
2626
+ visible: M,
2627
+ onMouseEnter: m,
2628
+ onMouseLeave: () => V(),
2629
+ onDropdownOpenChange: z
2600
2630
  }
2601
2631
  )
2602
2632
  ] });
2603
2633
  }
2604
- const ur = "MinimizedView-module_button", gr = "MinimizedView-module_chevron", mr = "MinimizedView-module_title", _t = {
2605
- button: ur,
2606
- chevron: gr,
2607
- title: mr
2634
+ const mr = "MinimizedView-module_button", pr = "MinimizedView-module_chevron", hr = "MinimizedView-module_title", _t = {
2635
+ button: mr,
2636
+ chevron: pr,
2637
+ title: hr
2608
2638
  };
2609
2639
  function rn({
2610
2640
  icon: t = /* @__PURE__ */ a(Lt, { size: 26 }),
@@ -2612,8 +2642,8 @@ function rn({
2612
2642
  onClick: i,
2613
2643
  focusOnMount: n = !1
2614
2644
  }) {
2615
- const o = A(null), c = A(n);
2616
- return O(() => {
2645
+ const o = O(null), c = O(n);
2646
+ return L(() => {
2617
2647
  c.current && o.current && o.current.focus(), c.current = !1;
2618
2648
  }, [c, o]), /* @__PURE__ */ a(
2619
2649
  se.div,
@@ -2629,7 +2659,7 @@ function rn({
2629
2659
  opacity: 1,
2630
2660
  scale: 1,
2631
2661
  transition: {
2632
- ...Be,
2662
+ ...He,
2633
2663
  delay: 0.2
2634
2664
  }
2635
2665
  },
@@ -2640,7 +2670,7 @@ function rn({
2640
2670
  duration: 0.15
2641
2671
  }
2642
2672
  },
2643
- children: /* @__PURE__ */ w(
2673
+ children: /* @__PURE__ */ C(
2644
2674
  we,
2645
2675
  {
2646
2676
  ref: o,
@@ -2658,14 +2688,14 @@ function rn({
2658
2688
  }
2659
2689
  );
2660
2690
  }
2661
- const pr = "Chat-module_container", hr = "Chat-module_embedded", fr = "Chat-module_floating", vr = "Chat-module_content", yr = "Chat-module_expanded", be = {
2662
- container: pr,
2663
- embedded: hr,
2664
- floating: fr,
2665
- content: vr,
2666
- expanded: yr
2691
+ const fr = "Chat-module_container", vr = "Chat-module_embedded", yr = "Chat-module_floating", br = "Chat-module_content", wr = "Chat-module_expanded", be = {
2692
+ container: fr,
2693
+ embedded: vr,
2694
+ floating: yr,
2695
+ content: br,
2696
+ expanded: wr
2667
2697
  };
2668
- function br() {
2698
+ function Cr() {
2669
2699
  return /* @__PURE__ */ a(
2670
2700
  "div",
2671
2701
  {
@@ -2700,253 +2730,253 @@ function on({
2700
2730
  onOpen: d,
2701
2731
  onExpand: u,
2702
2732
  onClose: h,
2703
- onStop: M,
2733
+ onStop: A,
2704
2734
  emptyView: x,
2705
2735
  floatingChatState: N,
2706
- suggestions: j,
2707
- clearSuggestions: p,
2708
- onSuggestionClick: _,
2709
- messageRenderer: k,
2736
+ suggestions: $,
2737
+ clearSuggestions: f,
2738
+ onSuggestionClick: T,
2739
+ messageRenderer: M,
2710
2740
  messagesPosition: D,
2711
- showAgentIcon: C,
2712
- className: H,
2713
- inputValue: Y,
2714
- onInputChange: z,
2715
- draggableStates: S = ["expanded"],
2741
+ showAgentIcon: _,
2742
+ className: j,
2743
+ inputValue: K,
2744
+ onInputChange: H,
2745
+ draggableStates: I = ["expanded"],
2716
2746
  // Default to only expanded for backward compatibility
2717
- locale: m = "en",
2718
- maxInputLength: V = 600,
2747
+ locale: V = "en",
2748
+ maxInputLength: m = 600,
2719
2749
  // Default to 600 characters
2720
- onInputLimitExceeded: G,
2721
- expandOnClick: ne,
2722
- expandOnHover: q = !0,
2723
- thinkingMessage: _e,
2724
- initialChatPosition: ie,
2725
- onChatPositionChange: oe,
2726
- onTypingStatusChange: P,
2727
- freeDrag: T = !1,
2728
- initialFreeDragPosition: Te,
2729
- onFreeDragEnd: ge
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
2730
2760
  }) {
2731
- const Le = Y !== void 0, [De, Ne] = Z(""), le = Le ? Y : De, Ee = Le ? z : Ne, v = Za(N), ce = A(!1), X = A(!1), ke = A(!1), [He, Ie] = Z(!1), [f, R] = Z(!1), [K, U] = Z(!1), te = Ti(), [fe, me] = Z(!1);
2732
- O(() => {
2733
- _i(m, {
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, {
2734
2764
  domain: "a8c-agenttic"
2735
2765
  }) || console.warn(
2736
- `Translations could not be loaded for locale: ${m}, defaulting to English`
2766
+ `Translations could not be loaded for locale: ${V}, defaulting to English`
2737
2767
  );
2738
- }, [m]), O(() => {
2739
- const I = le.length > 0, F = K && te && I;
2740
- F !== fe && (me(F), P == null || P(F));
2768
+ }, [V]), L(() => {
2769
+ const k = pe.length > 0, P = q && ae && k;
2770
+ P !== ue && (Me(P), Ce == null || Ce(P));
2741
2771
  }, [
2742
- K,
2743
- te,
2744
- le.length,
2745
- fe,
2746
- P
2772
+ q,
2773
+ ae,
2774
+ pe.length,
2775
+ ue,
2776
+ Ce
2747
2777
  ]);
2748
- const xe = b(() => {
2778
+ const fe = w(() => {
2749
2779
  U(!0);
2750
- }, []), Ve = b(() => {
2780
+ }, []), We = w(() => {
2751
2781
  U(!1);
2752
- }, []), Ce = le.length > V;
2753
- O(() => {
2754
- Ce && (G == null || G());
2755
- }, [Ce, G]), O(() => {
2756
- ce.current = !1, X.current = !1, ke.current = !1;
2757
- }, [v.state]);
2758
- const ve = A(/* @__PURE__ */ new Set()), Je = b(() => {
2759
- ve.current.forEach((I) => {
2760
- clearTimeout(I);
2761
- }), ve.current.clear();
2762
- }, []), B = Ya({
2763
- value: le,
2764
- setValue: Ee,
2765
- onSubmit: async (I) => {
2766
- v.state !== "expanded" && (u == null || u()), v.setState("expanded"), await o(I);
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);
2767
2797
  },
2768
2798
  isProcessing: i,
2769
- isInputOverLimit: Ce,
2770
- floatingChatState: v.state
2771
- }), [ct, L] = Z(56), [$, J] = Z(
2772
- Ja(ie)
2773
- ), de = A(null), Me = A(null), Se = A(null), { x: Re, y: We } = qa({
2774
- freeDrag: T,
2775
- initialFreeDragPosition: Te,
2776
- side: $
2777
- }), he = pt(Re), ue = pt(We), yt = qt(), bt = b(
2778
- async (I, F) => {
2779
- const W = I.prompt ?? I.label;
2780
- if (I.autoSubmit) {
2781
- p == null || p();
2782
- const Q = W.trim();
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();
2783
2813
  Q && await o(Q);
2784
2814
  } else {
2785
- const Q = W.endsWith(" ") ? W : `${W} `;
2786
- B.setValue(Q), p == null || p(), B.textareaRef.current && (B.textareaRef.current.focus(), B.textareaRef.current.setSelectionRange(
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(
2787
2817
  Q.length,
2788
2818
  Q.length
2789
2819
  ));
2790
2820
  }
2791
- _ == null || _(I, F);
2821
+ T == null || T(k, P);
2792
2822
  },
2793
- [p, o, _, B]
2794
- ), wt = b(() => {
2795
- ce.current = !0, v.open(), d == null || d(), u == null || u();
2796
- }, [v, d, u]), qe = b(() => {
2797
- var F, W, Q;
2798
- const I = (W = (F = Se.current) == null ? void 0 : F.ownerDocument) == null ? void 0 : W.activeElement;
2799
- return !(I && ((Q = Se.current) != null && Q.contains(I)) || le.trim());
2800
- }, [le, Se]), Ct = b(
2801
- (I) => I === "collapsed" || I === "minimized" ? y.COLLAPSED_SIZE : I === "compact" ? ct : y.EXPANDED_HEIGHT,
2802
- [ct]
2803
- ), bn = b(() => {
2804
- if (q && v.state === "collapsed" && (v.setState("compact"), v.initialState === "collapsed")) {
2805
- const I = setTimeout(() => {
2806
- v.state === "compact" && qe() && v.setState("collapsed"), ve.current.delete(I);
2807
- }, y.AUTO_COLLAPSE_DELAY);
2808
- ve.current.add(I);
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);
2809
2839
  }
2810
- }, [v, qe, q]), Dt = b(() => {
2811
- if (v.initialState === "collapsed" && v.state === "compact" && qe()) {
2812
- const I = setTimeout(() => {
2813
- v.state === "compact" && qe() && v.setState("collapsed"), ve.current.delete(I);
2814
- }, y.AUTO_COLLAPSE_DELAY);
2815
- ve.current.add(I);
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);
2816
2846
  }
2817
- }, [v, qe]), Et = b(async () => {
2818
- const I = B.value.trim();
2819
- B.clear(), v.state !== "expanded" && (u == null || u()), v.setState("expanded"), await o(I);
2820
- }, [B, o, v, u]), Rt = b(() => {
2821
- ke.current = !0, u == null || u(), v.setState("expanded");
2822
- }, [u, v]), wn = b(() => {
2823
- X.current = !0, B.clear(), v.close(), h && h();
2824
- }, [B, v, h]), ze = b(
2825
- (I) => {
2826
- if (!Se.current || !Me.current)
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)
2827
2857
  return null;
2828
- const F = Se.current.getBoundingClientRect(), W = Me.current.getBoundingClientRect(), Q = window.getComputedStyle(Se.current), lt = new DOMMatrixReadOnly(Q.transform), Ut = F.x - lt.e, Pe = F.y - lt.f, Xe = I ?? $, Bt = Ct(v.state), Mn = Xe === "left" ? W.left : W.right - y.COMPACT_WIDTH, An = v.state === "minimized" ? window.innerHeight - Bt : W.bottom - Bt;
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;
2829
2859
  return {
2830
2860
  x: Mn - Ut,
2831
- y: An - Pe
2861
+ y: An - $e
2832
2862
  };
2833
2863
  },
2834
- [$, v.state, Ct]
2835
- ), Cn = b(
2836
- (I) => {
2837
- const F = I.target;
2838
- if (F.ownerDocument !== document)
2864
+ [S, y.state, Ct]
2865
+ ), Cn = w(
2866
+ (k) => {
2867
+ const P = k.target;
2868
+ if (P.ownerDocument !== document)
2839
2869
  return;
2840
- F.closest(
2870
+ P.closest(
2841
2871
  re.NON_DRAGGABLE_SELECTORS
2842
- ) || (I.preventDefault(), yt.start(I.nativeEvent));
2872
+ ) || (k.preventDefault(), qe.start(k.nativeEvent));
2843
2873
  },
2844
- [yt]
2845
- ), _n = b(() => {
2874
+ [qe]
2875
+ ), _n = w(() => {
2846
2876
  R(!0);
2847
- }, []), Tn = b(
2848
- (I, F) => {
2849
- if (R(!1), T) {
2850
- ge == null || ge({ x: he.get(), y: ue.get() });
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() });
2851
2883
  return;
2852
2884
  }
2853
- const W = F.point.x, Q = y.COMPACT_WIDTH, lt = (window.innerWidth - Q) / 2, Pe = W < lt ? "left" : "right";
2854
- $ !== Pe && (J(Pe), ht(Pe), oe == null || oe(Pe));
2855
- const Xe = ze(Pe);
2856
- Xe && (ye(he, Xe.x, {
2885
+ const Qe = ze($e);
2886
+ Qe && (ye(ce, Qe.x, {
2857
2887
  ...re.SPRING_CONFIG,
2858
- velocity: F.velocity.x * re.VELOCITY_MULTIPLIER
2859
- }), ye(ue, Xe.y, {
2888
+ velocity: P.velocity.x * re.VELOCITY_MULTIPLIER
2889
+ }), ye(le, Qe.y, {
2860
2890
  ...re.SPRING_CONFIG,
2861
- velocity: F.velocity.y * re.VELOCITY_MULTIPLIER
2891
+ velocity: P.velocity.y * re.VELOCITY_MULTIPLIER
2862
2892
  }));
2863
2893
  },
2864
2894
  [
2865
- he,
2866
- ue,
2895
+ ce,
2896
+ le,
2867
2897
  ze,
2868
- oe,
2869
- $,
2870
- T,
2871
- ge
2898
+ J,
2899
+ S,
2900
+ v,
2901
+ ke
2872
2902
  ]
2873
- ), Pt = A(T);
2874
- O(() => {
2875
- const I = Pt.current;
2876
- if (Pt.current = T, T || !I)
2903
+ ), Pt = O(v);
2904
+ L(() => {
2905
+ const k = Pt.current;
2906
+ if (Pt.current = v, v || !k)
2877
2907
  return;
2878
- const W = y.VIEWPORT_OFFSET + he.get() + y.COMPACT_WIDTH / 2 < window.innerWidth / 2 ? "left" : "right";
2879
- $ !== W && (J(W), ht(W), oe == null || oe(W));
2880
- const Q = ze(W);
2881
- Q && (ye(he, Q.x, re.SPRING_CONFIG), ye(ue, Q.y, re.SPRING_CONFIG));
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));
2882
2912
  }, [
2883
- T,
2884
- he,
2885
- ue,
2913
+ v,
2914
+ ce,
2915
+ le,
2886
2916
  ze,
2887
- oe,
2888
- $
2917
+ J,
2918
+ S
2889
2919
  ]);
2890
- const st = A(null), $t = A(v.state === "minimized");
2891
- O(() => {
2892
- const I = $t.current, F = v.state === "minimized";
2893
- if ($t.current = F, !T || F === I)
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)
2894
2924
  return;
2895
- if (F) {
2896
- st.current = ue.get();
2897
- const Q = ye(ue, 0, re.SPRING_CONFIG);
2925
+ if (P) {
2926
+ lt.current = le.get();
2927
+ const Q = ye(le, 0, re.SPRING_CONFIG);
2898
2928
  return () => Q.stop();
2899
2929
  }
2900
- if (st.current === null)
2930
+ if (lt.current === null)
2901
2931
  return;
2902
- const W = ye(
2903
- ue,
2904
- st.current,
2932
+ const B = ye(
2933
+ le,
2934
+ lt.current,
2905
2935
  re.SPRING_CONFIG
2906
2936
  );
2907
- return st.current = null, () => W.stop();
2908
- }, [v.state, T, ue]);
2909
- const Ft = A(v.state), In = Ft.current === "compact" && v.state === "expanded";
2910
- O(() => {
2911
- Je(), Ft.current = v.state;
2912
- }, [v.state, Je]), O(() => {
2913
- const I = () => {
2914
- if (T) {
2915
- const W = Ot(
2916
- { x: he.get(), y: ue.get() },
2917
- y.COMPACT_WIDTH,
2918
- y.EXPANDED_HEIGHT
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
2919
2949
  );
2920
- he.set(W.x), ue.set(W.y);
2950
+ ce.set(B.x), le.set(B.y);
2921
2951
  return;
2922
2952
  }
2923
- const F = ze();
2924
- F && (he.set(F.x), v.state !== "minimized" && ue.set(F.y));
2953
+ const P = ze();
2954
+ P && (ce.set(P.x), y.state !== "minimized" && le.set(P.y));
2925
2955
  };
2926
- return window.addEventListener("resize", I), () => window.removeEventListener("resize", I);
2927
- }, [v.state, he, ue, ze, T]), O(() => {
2928
- const I = ve.current;
2956
+ return window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
2957
+ }, [y.state, ce, le, ze, v]), L(() => {
2958
+ const k = Ie.current;
2929
2959
  return () => {
2930
- I.forEach((F) => {
2931
- clearTimeout(F);
2932
- }), I.clear();
2960
+ k.forEach((P) => {
2961
+ clearTimeout(P);
2962
+ }), k.clear();
2933
2963
  };
2934
- }, []), O(() => {
2935
- if (v.state === "compact" && de.current) {
2936
- const I = de.current.scrollHeight + y.PADDING;
2937
- L(I);
2964
+ }, []), L(() => {
2965
+ if (y.state === "compact" && Z.current) {
2966
+ const k = Z.current.scrollHeight + b.PADDING;
2967
+ yt(k);
2938
2968
  }
2939
- }, [v.state, B.value]);
2940
- const Sn = x && ["floating", "embedded"].includes(c) && e.length === 0 && ae.isValidElement(x) ? ae.cloneElement(x, {
2969
+ }, [y.state, F.value]);
2970
+ const Sn = x && ["floating", "embedded"].includes(c) && e.length === 0 && ne.isValidElement(x) ? ne.cloneElement(x, {
2941
2971
  onSuggestionClick: bt
2942
- }) : void 0, kn = Ce ? {
2943
- message: Fe(
2972
+ }) : void 0, kn = Te ? {
2973
+ message: je(
2944
2974
  /* translators: %d: maximum number of characters allowed */
2945
2975
  E(
2946
2976
  "Message is too long. Please keep it under %d characters.",
2947
2977
  "a8c-agenttic"
2948
2978
  ),
2949
- V
2979
+ m
2950
2980
  ),
2951
2981
  dismissible: !1,
2952
2982
  status: "error"
@@ -2956,103 +2986,103 @@ function on({
2956
2986
  isProcessing: i,
2957
2987
  error: n,
2958
2988
  // Input state
2959
- inputValue: B.value,
2960
- setInputValue: B.setValue,
2961
- clearInput: B.clear,
2962
- textareaRef: B.textareaRef,
2963
- handleKeyDown: B.handleKeyDown,
2989
+ inputValue: F.value,
2990
+ setInputValue: F.setValue,
2991
+ clearInput: F.clear,
2992
+ textareaRef: F.textareaRef,
2993
+ handleKeyDown: F.handleKeyDown,
2964
2994
  // Actions
2965
2995
  onSubmit: o,
2966
2996
  handleSubmit: Et,
2967
- onStop: M,
2997
+ onStop: A,
2968
2998
  // UI state
2969
2999
  variant: c,
2970
3000
  placeholder: l,
2971
3001
  emptyView: Sn,
2972
- messageRenderer: k,
3002
+ messageRenderer: M,
2973
3003
  messagesPosition: D,
2974
- showAgentIcon: C,
3004
+ showAgentIcon: _,
2975
3005
  // Floating chat specific
2976
- floatingChatState: v.state,
3006
+ floatingChatState: y.state,
2977
3007
  triggerIcon: r,
2978
3008
  onOpen: wt,
2979
3009
  onExpand: Rt,
2980
3010
  onClose: wn,
2981
3011
  // Suggestions
2982
- suggestions: j,
2983
- clearSuggestions: p,
3012
+ suggestions: $,
3013
+ clearSuggestions: f,
2984
3014
  handleSuggestionSubmit: bt,
2985
3015
  // Notice
2986
3016
  notice: kn,
2987
3017
  // Thinking message
2988
- thinkingMessage: _e,
3018
+ thinkingMessage: Se,
2989
3019
  // Internal state for components
2990
- focusOnMount: ke.current,
3020
+ focusOnMount: X.current,
2991
3021
  fromCompact: In,
2992
- showExpandButton: !B.value.trim(),
3022
+ showExpandButton: !F.value.trim(),
2993
3023
  // Input validation
2994
- isInputOverLimit: Ce,
3024
+ isInputOverLimit: Te,
2995
3025
  // Focus handlers for typing status
2996
- onInputFocus: xe,
2997
- onInputBlur: Ve
3026
+ onInputFocus: fe,
3027
+ onInputBlur: We
2998
3028
  };
2999
3029
  return c === "embedded" ? /* @__PURE__ */ a(Vt, { value: jt, children: /* @__PURE__ */ a(
3000
3030
  "div",
3001
3031
  {
3002
3032
  "data-slot": "chat-embedded",
3003
- className: pe(
3004
- H,
3033
+ className: de(
3034
+ j,
3005
3035
  be.container,
3006
3036
  be.embedded
3007
3037
  ),
3008
3038
  children: t
3009
3039
  }
3010
- ) }) : /* @__PURE__ */ w(Vt, { value: jt, children: [
3040
+ ) }) : /* @__PURE__ */ C(Vt, { value: jt, children: [
3011
3041
  /* @__PURE__ */ a(
3012
3042
  "div",
3013
3043
  {
3014
- ref: Me,
3044
+ ref: oe,
3015
3045
  style: {
3016
3046
  position: "fixed",
3017
- top: y.VIEWPORT_OFFSET,
3018
- left: y.VIEWPORT_OFFSET,
3019
- right: y.VIEWPORT_OFFSET,
3020
- bottom: y.VIEWPORT_OFFSET,
3047
+ top: b.VIEWPORT_OFFSET,
3048
+ left: b.VIEWPORT_OFFSET,
3049
+ right: b.VIEWPORT_OFFSET,
3050
+ bottom: b.VIEWPORT_OFFSET,
3021
3051
  pointerEvents: "none"
3022
3052
  }
3023
3053
  }
3024
3054
  ),
3025
- f && /* @__PURE__ */ a(br, {}),
3055
+ p && /* @__PURE__ */ a(Cr, {}),
3026
3056
  /* @__PURE__ */ a(
3027
3057
  se.div,
3028
3058
  {
3029
- ref: Se,
3059
+ ref: ve,
3030
3060
  "data-slot": "chat-floating",
3031
- className: pe(H, be.container, be.floating, {
3032
- [be.expanded]: v.state === "expanded",
3033
- animating: He
3061
+ className: de(j, be.container, be.floating, {
3062
+ [be.expanded]: y.state === "expanded",
3063
+ animating: Ee
3034
3064
  }),
3035
- onMouseLeave: v.state === "compact" ? Dt : void 0,
3036
- drag: S.includes(v.state),
3037
- dragControls: yt,
3065
+ onMouseLeave: y.state === "compact" ? Dt : void 0,
3066
+ drag: I.includes(y.state),
3067
+ dragControls: qe,
3038
3068
  dragListener: !1,
3039
- dragConstraints: f ? Me : !1,
3069
+ dragConstraints: p ? oe : !1,
3040
3070
  dragMomentum: !1,
3041
- dragElastic: T ? 0 : 0.1,
3071
+ dragElastic: v ? 0 : 0.1,
3042
3072
  dragTransition: { power: 0.1, timeConstant: 100 },
3043
3073
  onDragStart: _n,
3044
3074
  onDragEnd: Tn,
3045
3075
  onPointerDown: Cn,
3046
3076
  initial: !1,
3047
3077
  animate: {
3048
- bottom: v.state === "minimized" ? 0 : y.VIEWPORT_OFFSET
3078
+ bottom: y.state === "minimized" ? 0 : b.VIEWPORT_OFFSET
3049
3079
  },
3050
- transition: Be,
3080
+ transition: He,
3051
3081
  style: {
3052
- x: he,
3053
- y: ue,
3054
- left: y.VIEWPORT_OFFSET,
3055
- cursor: S.includes(v.state) ? "grab" : "default"
3082
+ x: ce,
3083
+ y: le,
3084
+ left: b.VIEWPORT_OFFSET,
3085
+ cursor: I.includes(y.state) ? "grab" : "default"
3056
3086
  },
3057
3087
  children: /* @__PURE__ */ a(
3058
3088
  se.div,
@@ -3061,64 +3091,64 @@ function on({
3061
3091
  className: be.content,
3062
3092
  initial: !1,
3063
3093
  animate: {
3064
- width: v.state === "collapsed" ? y.COLLAPSED_SIZE : y.COMPACT_WIDTH,
3065
- height: Ct(v.state),
3066
- x: v.state === "collapsed" && $ === "right" ? y.COMPACT_WIDTH - y.COLLAPSED_SIZE : 0,
3067
- borderBottomLeftRadius: v.state === "minimized" ? 0 : y.BORDER_RADIUS,
3068
- borderBottomRightRadius: v.state === "minimized" ? 0 : y.BORDER_RADIUS,
3069
- transition: B.value.trim() ? { duration: 0 } : Be
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
3070
3100
  },
3071
- onAnimationStart: () => Ie(!0),
3072
- onAnimationComplete: () => Ie(!1),
3101
+ onAnimationStart: () => Re(!0),
3102
+ onAnimationComplete: () => Re(!1),
3073
3103
  style: {
3074
- borderTopLeftRadius: y.BORDER_RADIUS,
3075
- borderTopRightRadius: y.BORDER_RADIUS
3104
+ borderTopLeftRadius: b.BORDER_RADIUS,
3105
+ borderTopRightRadius: b.BORDER_RADIUS
3076
3106
  },
3077
- children: /* @__PURE__ */ w(ot, { mode: "wait", children: [
3078
- v.state === "collapsed" && /* @__PURE__ */ a(
3107
+ children: /* @__PURE__ */ C(ct, { mode: "wait", children: [
3108
+ y.state === "collapsed" && /* @__PURE__ */ a(
3079
3109
  en,
3080
3110
  {
3081
3111
  icon: r,
3082
3112
  onClick: wt,
3083
3113
  onHover: bn,
3084
- focusOnMount: X.current
3114
+ focusOnMount: te.current
3085
3115
  },
3086
3116
  "collapsed"
3087
3117
  ),
3088
- v.state === "minimized" && /* @__PURE__ */ a(
3118
+ y.state === "minimized" && /* @__PURE__ */ a(
3089
3119
  rn,
3090
3120
  {
3091
3121
  icon: r,
3092
3122
  title: s,
3093
3123
  onClick: wt,
3094
- focusOnMount: X.current
3124
+ focusOnMount: te.current
3095
3125
  },
3096
3126
  "minimized"
3097
3127
  ),
3098
- v.state === "compact" && /* @__PURE__ */ a("div", { ref: de, children: /* @__PURE__ */ a(
3128
+ y.state === "compact" && /* @__PURE__ */ a("div", { ref: Z, children: /* @__PURE__ */ a(
3099
3129
  nn,
3100
3130
  {
3101
- value: B.value,
3102
- onChange: B.setValue,
3131
+ value: F.value,
3132
+ onChange: F.setValue,
3103
3133
  onSubmit: Et,
3104
- onKeyDown: B.handleKeyDown,
3105
- textareaRef: B.textareaRef,
3134
+ onKeyDown: F.handleKeyDown,
3135
+ textareaRef: F.textareaRef,
3106
3136
  placeholder: l,
3107
3137
  isProcessing: i,
3108
3138
  onBlur: Dt,
3109
- onFocus: xe,
3139
+ onFocus: fe,
3110
3140
  onExpand: Rt,
3111
- showExpandButton: !B.value.trim(),
3112
- focusOnMount: ce.current,
3113
- onStop: M,
3114
- suggestions: j,
3115
- clearSuggestions: p,
3141
+ showExpandButton: !F.value.trim(),
3142
+ focusOnMount: De.current,
3143
+ onStop: A,
3144
+ suggestions: $,
3145
+ clearSuggestions: f,
3116
3146
  handleSuggestionSubmit: bt,
3117
- expandOnClick: ne
3147
+ expandOnClick: ie
3118
3148
  },
3119
3149
  "compact"
3120
3150
  ) }),
3121
- v.state === "expanded" && t
3151
+ y.state === "expanded" && t
3122
3152
  ] })
3123
3153
  }
3124
3154
  )
@@ -3146,8 +3176,8 @@ function cn({ className: t, size: e = 24 }) {
3146
3176
  }
3147
3177
  );
3148
3178
  }
3149
- const wr = "ChatHeader-module_container", Cr = {
3150
- container: wr
3179
+ const _r = "ChatHeader-module_container", Tr = {
3180
+ container: _r
3151
3181
  };
3152
3182
  function sn({ onClose: t, className: e }) {
3153
3183
  return /* @__PURE__ */ a(
@@ -3155,10 +3185,10 @@ function sn({ onClose: t, className: e }) {
3155
3185
  {
3156
3186
  "data-slot": "chat-header",
3157
3187
  "data-draggable": "true",
3158
- className: Cr.container,
3188
+ className: Tr.container,
3159
3189
  initial: { opacity: 0 },
3160
3190
  animate: { opacity: 1 },
3161
- transition: { ...Ue, delay: 0.1 },
3191
+ transition: { ...Be, delay: 0.1 },
3162
3192
  children: t && /* @__PURE__ */ a(
3163
3193
  we,
3164
3194
  {
@@ -3172,17 +3202,17 @@ function sn({ onClose: t, className: e }) {
3172
3202
  );
3173
3203
  }
3174
3204
  function St({ className: t } = {}) {
3175
- const { onClose: e } = Oe();
3205
+ const { onClose: e } = Ne();
3176
3206
  return /* @__PURE__ */ a(sn, { onClose: e, className: t });
3177
3207
  }
3178
- const _r = 0.12, Tr = 1;
3179
- function Ir({
3208
+ const Ir = 0.12, Sr = 1;
3209
+ function kr({
3180
3210
  scrollAreaRef: t,
3181
3211
  visibleMessages: e
3182
3212
  }) {
3183
- const i = A(0), n = A(!0), o = A(!0), c = A(0), r = A(null), s = b(() => {
3213
+ const i = O(0), n = O(!0), o = O(!0), c = O(0), r = O(null), s = w(() => {
3184
3214
  cancelAnimationFrame(c.current), c.current = 0, r.current = null;
3185
- }, []), l = b(() => {
3215
+ }, []), l = w(() => {
3186
3216
  s();
3187
3217
  const g = () => {
3188
3218
  const d = t.current;
@@ -3194,21 +3224,21 @@ function Ir({
3194
3224
  o.current = !1, s();
3195
3225
  return;
3196
3226
  }
3197
- const u = Sr(d);
3227
+ const u = Mr(d);
3198
3228
  if (u === null || d.scrollTop >= u) {
3199
3229
  s();
3200
3230
  return;
3201
3231
  }
3202
3232
  const h = u - d.scrollTop;
3203
- if (h <= Tr) {
3233
+ if (h <= Sr) {
3204
3234
  d.scrollTop = u, s();
3205
3235
  return;
3206
3236
  }
3207
- d.scrollTop += Math.ceil(h * _r), r.current = d.scrollTop, c.current = requestAnimationFrame(g);
3237
+ d.scrollTop += Math.ceil(h * Ir), r.current = d.scrollTop, c.current = requestAnimationFrame(g);
3208
3238
  };
3209
3239
  c.current = requestAnimationFrame(g);
3210
3240
  }, [t, s]);
3211
- O(() => {
3241
+ L(() => {
3212
3242
  const g = t.current;
3213
3243
  if (!g)
3214
3244
  return;
@@ -3222,7 +3252,7 @@ function Ir({
3222
3252
  }), () => {
3223
3253
  g.removeEventListener("wheel", d), g.removeEventListener("touchmove", d);
3224
3254
  };
3225
- }, [t, s]), O(() => s, [s]), O(() => {
3255
+ }, [t, s]), L(() => s, [s]), L(() => {
3226
3256
  const g = t.current;
3227
3257
  if (!g || e.length === 0) {
3228
3258
  i.current = e.length;
@@ -3248,12 +3278,12 @@ function Ir({
3248
3278
  s
3249
3279
  ]);
3250
3280
  }
3251
- function Sr(t) {
3281
+ function Mr(t) {
3252
3282
  const e = t.querySelectorAll('[data-role="user"]'), i = e[e.length - 1];
3253
3283
  return (i == null ? void 0 : i.offsetTop) ?? null;
3254
3284
  }
3255
- function kr({ className: t, size: e = 28 }) {
3256
- return /* @__PURE__ */ w(
3285
+ function Ar({ className: t, size: e = 28 }) {
3286
+ return /* @__PURE__ */ C(
3257
3287
  "svg",
3258
3288
  {
3259
3289
  className: t,
@@ -3288,8 +3318,8 @@ function kr({ className: t, size: e = 28 }) {
3288
3318
  }
3289
3319
  );
3290
3320
  }
3291
- const Mr = "MessageActions-module_container", Wt = {
3292
- container: Mr
3321
+ const Or = "MessageActions-module_container", Wt = {
3322
+ container: Or
3293
3323
  };
3294
3324
  function zt({
3295
3325
  message: t,
@@ -3338,15 +3368,15 @@ function zt({
3338
3368
  }
3339
3369
  );
3340
3370
  }
3341
- const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-module_bubble", Nr = "Message-module_error", xr = "Message-module_icon", Dr = "Message-module_content", Er = "Message-module_disabled", Ge = {
3342
- message: Ar,
3343
- user: Or,
3344
- bubble: Lr,
3345
- error: Nr,
3346
- icon: xr,
3347
- content: Dr,
3348
- disabled: Er
3349
- }, Rr = ae.forwardRef(
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
+ message: Lr,
3373
+ user: Nr,
3374
+ bubble: xr,
3375
+ error: Dr,
3376
+ icon: Er,
3377
+ content: Rr,
3378
+ disabled: Pr
3379
+ }, $r = ne.forwardRef(
3350
3380
  function({
3351
3381
  message: e,
3352
3382
  messageRenderer: i = At,
@@ -3369,7 +3399,7 @@ const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-m
3369
3399
  }
3370
3400
  return null;
3371
3401
  }) });
3372
- return /* @__PURE__ */ w(
3402
+ return /* @__PURE__ */ C(
3373
3403
  se.div,
3374
3404
  {
3375
3405
  ref: o,
@@ -3378,14 +3408,14 @@ const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-m
3378
3408
  animate: "visible",
3379
3409
  "data-slot": "message",
3380
3410
  "data-role": e.role,
3381
- className: pe(
3411
+ className: de(
3382
3412
  Ge.message,
3383
3413
  Ge[e.role],
3384
3414
  e.disabled ? Ge.disabled : void 0
3385
3415
  ),
3386
3416
  children: [
3387
- r && /* @__PURE__ */ a("div", { className: Ge.icon, "aria-hidden": "true", children: /* @__PURE__ */ a(kr, { size: 28 }) }),
3388
- /* @__PURE__ */ w(
3417
+ r && /* @__PURE__ */ a("div", { className: Ge.icon, "aria-hidden": "true", children: /* @__PURE__ */ a(Ar, { size: 28 }) }),
3418
+ /* @__PURE__ */ C(
3389
3419
  "div",
3390
3420
  {
3391
3421
  className: Ge.content,
@@ -3404,20 +3434,20 @@ const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-m
3404
3434
  }
3405
3435
  );
3406
3436
  }
3407
- ), Pr = "Messages-module_container", $r = "Messages-module_bottomMessages", dt = {
3408
- container: Pr,
3409
- bottomMessages: $r
3410
- }, Fr = "Thinking-module_container", jr = "Thinking-module_icon", Ur = "Thinking-module_content", Tt = {
3437
+ ), Fr = "Messages-module_container", jr = "Messages-module_bottomMessages", at = {
3411
3438
  container: Fr,
3412
- icon: jr,
3413
- content: Ur
3414
- }, Br = Kt(
3415
- ae.forwardRef(
3439
+ bottomMessages: jr
3440
+ }, Ur = "Thinking-module_container", Br = "Thinking-module_icon", Hr = "Thinking-module_content", Tt = {
3441
+ container: Ur,
3442
+ icon: Br,
3443
+ content: Hr
3444
+ }, Vr = Kt(
3445
+ ne.forwardRef(
3416
3446
  function({
3417
3447
  content: e = E("Thinking…", "a8c-agenttic")
3418
3448
  }, i) {
3419
- const n = rt(() => /* @__PURE__ */ a(Lt, {}), []);
3420
- return /* @__PURE__ */ w(
3449
+ const n = ot(() => /* @__PURE__ */ a(Lt, {}), []);
3450
+ return /* @__PURE__ */ C(
3421
3451
  "div",
3422
3452
  {
3423
3453
  ref: i,
@@ -3431,7 +3461,7 @@ const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-m
3431
3461
  );
3432
3462
  }
3433
3463
  )
3434
- ), Hr = (t) => t.map((e) => ({
3464
+ ), Wr = (t) => t.map((e) => ({
3435
3465
  ...e,
3436
3466
  content: e.content.filter(
3437
3467
  (i) => i.type !== "context" && i.type !== "data"
@@ -3447,23 +3477,27 @@ function ln({
3447
3477
  messagesPosition: r = "top",
3448
3478
  showAgentIcon: s
3449
3479
  }) {
3450
- const l = A(null), g = Hr(t);
3451
- Ir({ scrollAreaRef: l, visibleMessages: g });
3452
- const d = rt(() => {
3453
- const M = g.filter(
3480
+ const l = O(null), g = Wr(t);
3481
+ kr({ scrollAreaRef: l, visibleMessages: g });
3482
+ const d = ot(() => {
3483
+ const A = g.filter(
3454
3484
  (N) => N.role === "agent"
3455
3485
  );
3456
- return M.length ? M[M.length - 1].content.filter((N) => N.type === "text").map((N) => N.text).join(" ") : "";
3486
+ return A.length ? A[A.length - 1].content.filter((N) => N.type === "text").map((N) => N.text).join(" ") : "";
3457
3487
  }, [g]), [u] = Rn(d, 1e3), h = d !== u;
3458
3488
  return g.length === 0 && !e ? n ? /* @__PURE__ */ a(
3459
3489
  "div",
3460
3490
  {
3461
3491
  "data-slot": "messages",
3462
- className: `${dt.container} ${dt.emptyState}`,
3492
+ className: de(
3493
+ at.container,
3494
+ at.emptyState,
3495
+ r === "bottom" ? at.bottomMessages : ""
3496
+ ),
3463
3497
  ref: l,
3464
3498
  children: n
3465
3499
  }
3466
- ) : null : /* @__PURE__ */ w(Ke, { children: [
3500
+ ) : null : /* @__PURE__ */ C(Ke, { children: [
3467
3501
  /* @__PURE__ */ a(
3468
3502
  "div",
3469
3503
  {
@@ -3483,22 +3517,22 @@ function ln({
3483
3517
  "div",
3484
3518
  {
3485
3519
  "data-slot": "messages",
3486
- className: pe(
3487
- dt.container,
3488
- r === "bottom" ? dt.bottomMessages : ""
3520
+ className: de(
3521
+ at.container,
3522
+ r === "bottom" ? at.bottomMessages : ""
3489
3523
  ),
3490
3524
  ref: l,
3491
- children: /* @__PURE__ */ w(ot, { mode: "popLayout", children: [
3492
- g.map((M) => /* @__PURE__ */ a(
3493
- Rr,
3525
+ children: /* @__PURE__ */ C(ct, { mode: "popLayout", children: [
3526
+ g.map((A) => /* @__PURE__ */ a(
3527
+ $r,
3494
3528
  {
3495
- message: M,
3529
+ message: A,
3496
3530
  messageRenderer: o,
3497
3531
  showAgentIcon: s
3498
3532
  },
3499
- M.reactKey || M.id
3533
+ A.reactKey || A.id
3500
3534
  )),
3501
- e && !h && /* @__PURE__ */ a(Br, { content: c }),
3535
+ e && !h && /* @__PURE__ */ a(Vr, { content: c }),
3502
3536
  i && /* @__PURE__ */ a(
3503
3537
  "div",
3504
3538
  {
@@ -3526,7 +3560,7 @@ function dn({ className: t } = {}) {
3526
3560
  messagesPosition: r,
3527
3561
  showAgentIcon: s,
3528
3562
  thinkingMessage: l
3529
- } = Oe();
3563
+ } = Ne();
3530
3564
  return /* @__PURE__ */ a(
3531
3565
  ln,
3532
3566
  {
@@ -3542,7 +3576,7 @@ function dn({ className: t } = {}) {
3542
3576
  }
3543
3577
  );
3544
3578
  }
3545
- function Vr({ className: t, size: e = 24 }) {
3579
+ function zr({ className: t, size: e = 24 }) {
3546
3580
  return /* @__PURE__ */ a(
3547
3581
  "svg",
3548
3582
  {
@@ -3578,22 +3612,22 @@ function un({
3578
3612
  handleKeyDown: d,
3579
3613
  textareaRef: u,
3580
3614
  placeholder: h,
3581
- isProcessing: M,
3615
+ isProcessing: A,
3582
3616
  onStop: x,
3583
3617
  fromCompact: N,
3584
- onExpand: j,
3585
- showExpandButton: p,
3586
- focusOnMount: _,
3587
- onInputFocus: k,
3618
+ onExpand: $,
3619
+ showExpandButton: f,
3620
+ focusOnMount: T,
3621
+ onInputFocus: M,
3588
3622
  onInputBlur: D
3589
- } = Oe(), C = (z) => {
3590
- o == null || o(z), !z.defaultPrevented && d(z);
3591
- }, H = rt(() => r ? [{
3623
+ } = Ne(), _ = (H) => {
3624
+ o == null || o(H), !H.defaultPrevented && d(H);
3625
+ }, j = ot(() => r ? [{
3592
3626
  id: "image-upload",
3593
- icon: /* @__PURE__ */ a(Vr, {}),
3627
+ icon: /* @__PURE__ */ a(zr, {}),
3594
3628
  onClick: () => {
3595
- var S;
3596
- return (S = r.current) == null ? void 0 : S.openFileDialog();
3629
+ var I;
3630
+ return (I = r.current) == null ? void 0 : I.openFileDialog();
3597
3631
  },
3598
3632
  variant: "ghost",
3599
3633
  "aria-label": E("Upload image", "a8c-agenttic")
@@ -3604,19 +3638,19 @@ function un({
3604
3638
  value: s,
3605
3639
  onChange: l,
3606
3640
  onSubmit: g,
3607
- onKeyDown: C,
3608
- onFocus: k,
3641
+ onKeyDown: _,
3642
+ onFocus: M,
3609
3643
  onBlur: D,
3610
3644
  textareaRef: u,
3611
3645
  placeholder: h,
3612
- isProcessing: M,
3646
+ isProcessing: A,
3613
3647
  onStop: x,
3614
3648
  fromCompact: N,
3615
- onExpand: j,
3616
- showExpandButton: p,
3617
- focusOnMount: _,
3649
+ onExpand: $,
3650
+ showExpandButton: f,
3651
+ focusOnMount: T,
3618
3652
  disabled: e,
3619
- customActions: H,
3653
+ customActions: j,
3620
3654
  actionOrder: n,
3621
3655
  className: t,
3622
3656
  layout: c ?? (r ? "stacked" : "inline")
@@ -3635,7 +3669,7 @@ function gn({
3635
3669
  messages: r,
3636
3670
  variant: s,
3637
3671
  emptyView: l
3638
- } = Oe(), g = b(
3672
+ } = Ne(), g = w(
3639
3673
  (d, u) => {
3640
3674
  try {
3641
3675
  const h = d.prompt ?? d.label;
@@ -3656,8 +3690,8 @@ function gn({
3656
3690
  }
3657
3691
  );
3658
3692
  }
3659
- function Wr({ className: t, size: e = 18 }) {
3660
- return /* @__PURE__ */ w(
3693
+ function Gr({ className: t, size: e = 18 }) {
3694
+ return /* @__PURE__ */ C(
3661
3695
  "svg",
3662
3696
  {
3663
3697
  width: e,
@@ -3690,8 +3724,8 @@ function Wr({ className: t, size: e = 18 }) {
3690
3724
  }
3691
3725
  );
3692
3726
  }
3693
- function zr({ className: t, size: e = 18 }) {
3694
- return /* @__PURE__ */ w(
3727
+ function Zr({ className: t, size: e = 18 }) {
3728
+ return /* @__PURE__ */ C(
3695
3729
  "svg",
3696
3730
  {
3697
3731
  width: e,
@@ -3730,16 +3764,16 @@ function zr({ className: t, size: e = 18 }) {
3730
3764
  }
3731
3765
  );
3732
3766
  }
3733
- const Gr = "Notice-module_container", Zr = "Notice-module_isSuccess", Yr = "Notice-module_icon", Kr = "Notice-module_isWarning", Jr = "Notice-module_isError", qr = "Notice-module_content", Xr = "Notice-module_actions", Qr = "Notice-module_action", eo = "Notice-module_dismissible", Ae = {
3734
- container: Gr,
3735
- isSuccess: Zr,
3736
- icon: Yr,
3737
- isWarning: Kr,
3738
- isError: Jr,
3739
- content: qr,
3740
- actions: Xr,
3741
- action: Qr,
3742
- dismissible: eo
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
+ container: Yr,
3769
+ isSuccess: Kr,
3770
+ icon: Jr,
3771
+ isWarning: qr,
3772
+ isError: Xr,
3773
+ content: Qr,
3774
+ actions: eo,
3775
+ action: to,
3776
+ dismissible: ao
3743
3777
  };
3744
3778
  function mn({
3745
3779
  icon: t,
@@ -3750,36 +3784,36 @@ function mn({
3750
3784
  className: c,
3751
3785
  status: r
3752
3786
  }) {
3753
- const l = b(() => {
3754
- if (ae.isValidElement(t))
3787
+ const l = w(() => {
3788
+ if (ne.isValidElement(t))
3755
3789
  return t;
3756
3790
  if (t === !1 || t === null)
3757
3791
  return null;
3758
3792
  switch (r) {
3759
3793
  case "warning":
3760
- return /* @__PURE__ */ a(Wr, {});
3794
+ return /* @__PURE__ */ a(Gr, {});
3761
3795
  case "error":
3762
- return /* @__PURE__ */ a(zr, {});
3796
+ return /* @__PURE__ */ a(Zr, {});
3763
3797
  default:
3764
3798
  return null;
3765
3799
  }
3766
3800
  }, [t, r])();
3767
- return /* @__PURE__ */ w(
3801
+ return /* @__PURE__ */ C(
3768
3802
  "div",
3769
3803
  {
3770
3804
  "data-slot": "notice",
3771
- className: pe(
3772
- Ae.container,
3805
+ className: de(
3806
+ Oe.container,
3773
3807
  {
3774
- [Ae.isSuccess]: r === "success",
3775
- [Ae.isWarning]: r === "warning",
3776
- [Ae.isError]: r === "error"
3808
+ [Oe.isSuccess]: r === "success",
3809
+ [Oe.isWarning]: r === "warning",
3810
+ [Oe.isError]: r === "error"
3777
3811
  },
3778
3812
  c
3779
3813
  ),
3780
3814
  children: [
3781
- /* @__PURE__ */ w("div", { className: Ae.content, children: [
3782
- l && /* @__PURE__ */ a("div", { className: Ae.icon, children: l }),
3815
+ /* @__PURE__ */ C("div", { className: Oe.content, children: [
3816
+ l && /* @__PURE__ */ a("div", { className: Oe.icon, children: l }),
3783
3817
  /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
3784
3818
  At,
3785
3819
  {
@@ -3800,11 +3834,11 @@ function mn({
3800
3834
  }
3801
3835
  ) })
3802
3836
  ] }),
3803
- /* @__PURE__ */ w("div", { className: Ae.actions, children: [
3837
+ /* @__PURE__ */ C("div", { className: Oe.actions, children: [
3804
3838
  i && /* @__PURE__ */ a(
3805
3839
  we,
3806
3840
  {
3807
- className: Ae.action,
3841
+ className: Oe.action,
3808
3842
  onClick: i.onClick,
3809
3843
  variant: "link",
3810
3844
  children: i.label
@@ -3813,7 +3847,7 @@ function mn({
3813
3847
  n && o && /* @__PURE__ */ a(
3814
3848
  we,
3815
3849
  {
3816
- className: Ae.dismissible,
3850
+ className: Oe.dismissible,
3817
3851
  onClick: o,
3818
3852
  variant: "ghost",
3819
3853
  size: "sm",
@@ -3826,7 +3860,7 @@ function mn({
3826
3860
  );
3827
3861
  }
3828
3862
  function pn({ className: t } = {}) {
3829
- const { notice: e } = Oe();
3863
+ const { notice: e } = Ne();
3830
3864
  return e ? /* @__PURE__ */ a(
3831
3865
  mn,
3832
3866
  {
@@ -3840,8 +3874,8 @@ function pn({ className: t } = {}) {
3840
3874
  }
3841
3875
  ) : null;
3842
3876
  }
3843
- const to = "ChatFooter-module_container", kt = {
3844
- container: to
3877
+ const no = "ChatFooter-module_container", kt = {
3878
+ container: no
3845
3879
  };
3846
3880
  function hn({
3847
3881
  children: t,
@@ -3851,20 +3885,20 @@ function hn({
3851
3885
  se.div,
3852
3886
  {
3853
3887
  "data-slot": "chat-footer",
3854
- className: pe(kt.container, e),
3888
+ className: de(kt.container, e),
3855
3889
  initial: { opacity: 0, scale: 1 },
3856
3890
  animate: { opacity: 1, scale: 1 },
3857
- transition: { ...Ue },
3891
+ transition: { ...Be },
3858
3892
  children: t
3859
3893
  }
3860
- ) : /* @__PURE__ */ w(
3894
+ ) : /* @__PURE__ */ C(
3861
3895
  se.div,
3862
3896
  {
3863
3897
  "data-slot": "chat-footer",
3864
- className: pe(kt.container, e),
3898
+ className: de(kt.container, e),
3865
3899
  initial: { opacity: 0, scale: 1 },
3866
3900
  animate: { opacity: 1, scale: 1 },
3867
- transition: { ...Ue },
3901
+ transition: { ...Be },
3868
3902
  children: [
3869
3903
  /* @__PURE__ */ a(gn, {}),
3870
3904
  /* @__PURE__ */ a(pn, {}),
@@ -3873,23 +3907,23 @@ function hn({
3873
3907
  }
3874
3908
  );
3875
3909
  }
3876
- const ao = "ConversationView-module_container", no = "ConversationView-module_withHeader", Ye = {
3877
- container: ao,
3878
- withHeader: no
3910
+ const io = "ConversationView-module_container", ro = "ConversationView-module_withHeader", Ye = {
3911
+ container: io,
3912
+ withHeader: ro
3879
3913
  }, xt = Jt(function({
3880
3914
  showHeader: e = !0,
3881
3915
  children: i,
3882
3916
  className: n
3883
3917
  } = {}, o) {
3884
- const { onClose: c } = Oe();
3885
- if (O(() => {
3918
+ const { onClose: c } = Ne();
3919
+ if (L(() => {
3886
3920
  const r = (s) => {
3887
3921
  s.key === "Escape" && c && c();
3888
3922
  };
3889
3923
  return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
3890
3924
  }, [c]), i) {
3891
- const r = ae.Children.toArray(i).some(
3892
- (s) => ae.isValidElement(s) && (s.type === St || typeof s.type == "function" && s.type.name === "AgentUIHeader")
3925
+ const r = ne.Children.toArray(i).some(
3926
+ (s) => ne.isValidElement(s) && (s.type === St || typeof s.type == "function" && s.type.name === "AgentUIHeader")
3893
3927
  );
3894
3928
  return /* @__PURE__ */ a(
3895
3929
  "div",
@@ -3901,7 +3935,7 @@ const ao = "ConversationView-module_container", no = "ConversationView-module_wi
3901
3935
  }
3902
3936
  );
3903
3937
  }
3904
- return /* @__PURE__ */ w(
3938
+ return /* @__PURE__ */ C(
3905
3939
  "div",
3906
3940
  {
3907
3941
  ref: o,
@@ -3916,27 +3950,27 @@ const ao = "ConversationView-module_container", no = "ConversationView-module_wi
3916
3950
  );
3917
3951
  });
3918
3952
  xt.displayName = "AgentUIConversationView";
3919
- const io = "AgentUIInputToolbar-module_container", ro = "AgentUIInputToolbar-module_button", oo = "AgentUIInputToolbar-module_icon", co = "AgentUIInputToolbar-module_iconOpen", so = "AgentUIInputToolbar-module_dropdown", tt = {
3920
- container: io,
3921
- button: ro,
3922
- icon: oo,
3923
- iconOpen: co,
3924
- dropdown: so
3953
+ const oo = "AgentUIInputToolbar-module_container", co = "AgentUIInputToolbar-module_button", so = "AgentUIInputToolbar-module_icon", lo = "AgentUIInputToolbar-module_iconOpen", uo = "AgentUIInputToolbar-module_dropdown", nt = {
3954
+ container: oo,
3955
+ button: co,
3956
+ icon: so,
3957
+ iconOpen: lo,
3958
+ dropdown: uo
3925
3959
  };
3926
- function lo({
3960
+ function go({
3927
3961
  children: t,
3928
3962
  className: e,
3929
3963
  icon: i,
3930
3964
  label: n,
3931
3965
  disabled: o
3932
3966
  } = {}) {
3933
- const [c, r] = ae.useState(!1), s = n ?? "Input Toolbar";
3934
- return /* @__PURE__ */ a("div", { className: e, children: /* @__PURE__ */ a("div", { className: tt.container, children: /* @__PURE__ */ w(je.Root, { open: c, onOpenChange: r, children: [
3935
- /* @__PURE__ */ a(je.Trigger, { asChild: !0, children: /* @__PURE__ */ w(
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(
3936
3970
  "button",
3937
3971
  {
3938
3972
  type: "button",
3939
- className: tt.button,
3973
+ className: nt.button,
3940
3974
  "aria-label": s,
3941
3975
  disabled: o,
3942
3976
  children: [
@@ -3950,7 +3984,7 @@ function lo({
3950
3984
  viewBox: "0 0 24 24",
3951
3985
  fill: "none",
3952
3986
  "aria-hidden": "true",
3953
- className: `${tt.icon} ${c ? tt.iconOpen : ""}`,
3987
+ className: `${nt.icon} ${c ? nt.iconOpen : ""}`,
3954
3988
  children: /* @__PURE__ */ a(
3955
3989
  "path",
3956
3990
  {
@@ -3966,9 +4000,9 @@ function lo({
3966
4000
  }
3967
4001
  ) }),
3968
4002
  /* @__PURE__ */ a(
3969
- je.Content,
4003
+ Ue.Content,
3970
4004
  {
3971
- className: tt.dropdown,
4005
+ className: nt.dropdown,
3972
4006
  side: "bottom",
3973
4007
  align: "start",
3974
4008
  sideOffset: 8,
@@ -3979,7 +4013,7 @@ function lo({
3979
4013
  )
3980
4014
  ] }) }) });
3981
4015
  }
3982
- const uo = {
4016
+ const mo = {
3983
4017
  // Core container with state management
3984
4018
  Container: on,
3985
4019
  // Individual composable components
@@ -3988,16 +4022,16 @@ const uo = {
3988
4022
  Input: un,
3989
4023
  Suggestions: gn,
3990
4024
  Notice: pn,
3991
- InputToolbar: lo,
4025
+ InputToolbar: go,
3992
4026
  // Convenience wrappers
3993
4027
  Footer: hn,
3994
4028
  ConversationView: xt
3995
- }, fc = Object.assign(
4029
+ }, yc = Object.assign(
3996
4030
  (t) => /* @__PURE__ */ a(
3997
4031
  on,
3998
4032
  {
3999
4033
  ...t,
4000
- className: pe("agenttic", t.className),
4034
+ className: de("agenttic", t.className),
4001
4035
  children: /* @__PURE__ */ a(
4002
4036
  xt,
4003
4037
  {
@@ -4006,9 +4040,9 @@ const uo = {
4006
4040
  )
4007
4041
  }
4008
4042
  ),
4009
- uo
4043
+ mo
4010
4044
  );
4011
- function go({
4045
+ function po({
4012
4046
  inputValue: t,
4013
4047
  onInputChange: e,
4014
4048
  onSubmit: i,
@@ -4022,32 +4056,32 @@ function go({
4022
4056
  disabled: d,
4023
4057
  notice: u,
4024
4058
  suggestions: h,
4025
- clearSuggestions: M,
4059
+ clearSuggestions: A,
4026
4060
  focusOnMount: x,
4027
4061
  customActions: N,
4028
- actionOrder: j
4062
+ actionOrder: $
4029
4063
  }) {
4030
- const p = b(
4031
- (_, k) => {
4032
- const D = _.prompt ?? _.label;
4033
- e(D), M == null || M();
4064
+ const f = w(
4065
+ (T, M) => {
4066
+ const D = T.prompt ?? T.label;
4067
+ e(D), A == null || A();
4034
4068
  },
4035
- [e, M]
4069
+ [e, A]
4036
4070
  );
4037
- return /* @__PURE__ */ w(
4071
+ return /* @__PURE__ */ C(
4038
4072
  se.div,
4039
4073
  {
4040
4074
  "data-slot": "chat-footer",
4041
4075
  className: kt.container,
4042
4076
  initial: { opacity: 0, scale: 1 },
4043
4077
  animate: { opacity: 1, scale: 1 },
4044
- transition: { ...Ue },
4078
+ transition: { ...Be },
4045
4079
  children: [
4046
4080
  !t && /* @__PURE__ */ a(
4047
4081
  vt,
4048
4082
  {
4049
4083
  suggestions: h,
4050
- onSubmit: p
4084
+ onSubmit: f
4051
4085
  }
4052
4086
  ),
4053
4087
  u && /* @__PURE__ */ a(
@@ -4077,7 +4111,7 @@ function go({
4077
4111
  showExpandButton: !1,
4078
4112
  focusOnMount: x,
4079
4113
  customActions: N,
4080
- actionOrder: j,
4114
+ actionOrder: $,
4081
4115
  disabled: d
4082
4116
  }
4083
4117
  )
@@ -4099,21 +4133,21 @@ function Gt({
4099
4133
  fromCompact: d = !1,
4100
4134
  showHeader: u = !1,
4101
4135
  onClose: h,
4102
- onExpand: M,
4136
+ onExpand: A,
4103
4137
  notice: x,
4104
4138
  emptyView: N,
4105
- suggestions: j,
4106
- clearSuggestions: p,
4107
- messageRenderer: _,
4108
- showAgentIcon: k,
4139
+ suggestions: $,
4140
+ clearSuggestions: f,
4141
+ messageRenderer: T,
4142
+ showAgentIcon: M,
4109
4143
  focusOnMount: D = !1
4110
4144
  }) {
4111
- return O(() => {
4112
- const C = (H) => {
4113
- H.key === "Escape" && h && h();
4145
+ return L(() => {
4146
+ const _ = (j) => {
4147
+ j.key === "Escape" && h && h();
4114
4148
  };
4115
- return document.addEventListener("keydown", C), () => document.removeEventListener("keydown", C);
4116
- }, [h]), /* @__PURE__ */ w(
4149
+ return document.addEventListener("keydown", _), () => document.removeEventListener("keydown", _);
4150
+ }, [h]), /* @__PURE__ */ C(
4117
4151
  "div",
4118
4152
  {
4119
4153
  "data-slot": "conversation-view",
@@ -4127,12 +4161,12 @@ function Gt({
4127
4161
  isProcessing: l,
4128
4162
  error: e,
4129
4163
  emptyView: N,
4130
- messageRenderer: _,
4131
- showAgentIcon: k
4164
+ messageRenderer: T,
4165
+ showAgentIcon: M
4132
4166
  }
4133
4167
  ),
4134
4168
  /* @__PURE__ */ a(
4135
- go,
4169
+ po,
4136
4170
  {
4137
4171
  inputValue: i,
4138
4172
  onInputChange: n,
@@ -4143,10 +4177,10 @@ function Gt({
4143
4177
  isProcessing: l,
4144
4178
  onStop: g,
4145
4179
  fromCompact: d,
4146
- onExpand: M,
4180
+ onExpand: A,
4147
4181
  notice: x,
4148
- suggestions: j,
4149
- clearSuggestions: p,
4182
+ suggestions: $,
4183
+ clearSuggestions: f,
4150
4184
  focusOnMount: D
4151
4185
  }
4152
4186
  )
@@ -4154,7 +4188,7 @@ function Gt({
4154
4188
  }
4155
4189
  );
4156
4190
  }
4157
- function vc({
4191
+ function bc({
4158
4192
  messages: t,
4159
4193
  isProcessing: e,
4160
4194
  error: i,
@@ -4168,207 +4202,207 @@ function vc({
4168
4202
  onExpand: d,
4169
4203
  onClose: u,
4170
4204
  onStop: h,
4171
- emptyView: M,
4205
+ emptyView: A,
4172
4206
  floatingChatState: x,
4173
4207
  suggestions: N,
4174
- clearSuggestions: j,
4175
- messageRenderer: p,
4176
- showAgentIcon: _,
4177
- className: k,
4208
+ clearSuggestions: $,
4209
+ messageRenderer: f,
4210
+ showAgentIcon: T,
4211
+ className: M,
4178
4212
  expandOnHover: D = !0,
4179
- freeDrag: C = !1,
4180
- initialFreeDragPosition: H,
4181
- onFreeDragEnd: Y
4213
+ freeDrag: _ = !1,
4214
+ initialFreeDragPosition: j,
4215
+ onFreeDragEnd: K,
4216
+ onChatPositionChange: H
4182
4217
  }) {
4183
- const [z, S] = Z(""), m = Za(x), V = A(!1), G = A(!1), ne = A(!1), [q, _e] = Z(!1);
4184
- O(() => {
4185
- V.current = !1, G.current = !1, ne.current = !1;
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;
4186
4221
  }, [m.state]);
4187
- const ie = A(/* @__PURE__ */ new Set()), oe = b(() => {
4188
- ie.current.forEach((L) => {
4189
- clearTimeout(L);
4190
- }), ie.current.clear();
4191
- }, []), P = Ya({
4192
- value: z,
4193
- setValue: S,
4194
- onSubmit: async (L) => {
4195
- m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await n(L);
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);
4196
4231
  },
4197
4232
  isProcessing: e,
4198
4233
  floatingChatState: m.state
4199
- }), [T, Te] = Z(56), [ge, Le] = Z(
4234
+ }), [_e, ke] = Y(56), [me, Ve] = Y(
4200
4235
  Ja
4201
- ), De = A(null), Ne = A(null), le = A(null), { x: Ee, y: v } = qa({
4202
- freeDrag: C,
4203
- initialFreeDragPosition: H,
4204
- side: ge
4205
- }), ce = pt(Ee), X = pt(v), ke = qt(), He = b(() => {
4206
- V.current = !0, m.open(), g == null || g(), d == null || d();
4207
- }, [m, g, d]), Ie = b(() => {
4208
- var $, J, de;
4209
- const L = (J = ($ = le.current) == null ? void 0 : $.ownerDocument) == null ? void 0 : J.activeElement;
4210
- return !(L && ((de = le.current) != null && de.contains(L)) || z.trim());
4211
- }, [z, le]), f = (L) => L === "collapsed" || L === "minimized" ? y.COLLAPSED_SIZE : L === "compact" ? T : y.EXPANDED_HEIGHT, R = b(() => {
4236
+ ), xe = O(null), pe = O(null), he = O(null), { x: y, y: De } = qa({
4237
+ freeDrag: _,
4238
+ initialFreeDragPosition: j,
4239
+ side: me
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(() => {
4212
4247
  if (D && m.state === "collapsed" && (m.setState("compact"), m.initialState === "collapsed")) {
4213
- const L = setTimeout(() => {
4214
- m.state === "compact" && Ie() && m.setState("collapsed"), ie.current.delete(L);
4215
- }, y.AUTO_COLLAPSE_DELAY);
4216
- ie.current.add(L);
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);
4217
4252
  }
4218
- }, [m, Ie, D]), K = b(() => {
4219
- if (m.initialState === "collapsed" && m.state === "compact" && Ie()) {
4220
- const L = setTimeout(() => {
4221
- m.state === "compact" && Ie() && m.setState("collapsed"), ie.current.delete(L);
4222
- }, y.AUTO_COLLAPSE_DELAY);
4223
- ie.current.add(L);
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);
4224
4259
  }
4225
- }, [m, Ie]), U = b(async () => {
4226
- if (P.value.trim()) {
4227
- const L = P.value.trim();
4228
- P.clear(), m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await n(L);
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);
4229
4264
  }
4230
- }, [P, n, m, d]), te = b(() => {
4231
- ne.current = !0, d == null || d(), m.setState("expanded");
4232
- }, [d, m]), fe = b(() => {
4233
- G.current = !0, P.clear(), m.close(), u && u();
4234
- }, [P, m, u]), me = b(
4235
- (L) => {
4236
- if (!le.current || !Ne.current)
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)
4237
4272
  return null;
4238
- const $ = le.current.getBoundingClientRect(), J = Ne.current.getBoundingClientRect(), de = window.getComputedStyle(le.current), Me = new DOMMatrixReadOnly(de.transform), Se = $.x - Me.e, Re = $.y - Me.f, he = (L ?? ge) === "left" ? J.left : J.right - y.COMPACT_WIDTH, ue = m.state === "minimized" ? window.innerHeight - y.COLLAPSED_SIZE : J.bottom - y.EXPANDED_HEIGHT;
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;
4239
4274
  return {
4240
- x: he - Se,
4241
- y: ue - Re
4275
+ x: le - st,
4276
+ y: qe - Ae
4242
4277
  };
4243
4278
  },
4244
- [ge, m.state]
4245
- ), xe = b(
4246
- (L) => {
4247
- L.target.closest(
4279
+ [me, m.state]
4280
+ ), We = w(
4281
+ (S) => {
4282
+ S.target.closest(
4248
4283
  re.NON_DRAGGABLE_SELECTORS
4249
- ) || ke.start(L.nativeEvent);
4284
+ ) || Ee.start(S.nativeEvent);
4250
4285
  },
4251
- [ke]
4252
- ), Ve = b(
4253
- (L, $) => {
4254
- if (C) {
4255
- Y == null || Y({ x: ce.get(), y: X.get() });
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() });
4256
4292
  return;
4257
4293
  }
4258
- const J = $.point.x, de = y.COMPACT_WIDTH, Me = (window.innerWidth - de) / 2, Re = J < Me ? "left" : "right";
4259
- Le(Re), ht(Re);
4260
- const We = me(Re);
4261
- We && (ye(ce, We.x, {
4294
+ const ce = fe(Ae);
4295
+ ce && (ye(te, ce.x, {
4262
4296
  ...re.SPRING_CONFIG,
4263
- velocity: $.velocity.x * re.VELOCITY_MULTIPLIER
4264
- }), ye(X, We.y, {
4297
+ velocity: G.velocity.x * re.VELOCITY_MULTIPLIER
4298
+ }), ye(X, ce.y, {
4265
4299
  ...re.SPRING_CONFIG,
4266
- velocity: $.velocity.y * re.VELOCITY_MULTIPLIER
4300
+ velocity: G.velocity.y * re.VELOCITY_MULTIPLIER
4267
4301
  }));
4268
4302
  },
4269
- [ce, X, me, C, Y]
4270
- ), Ce = A(C);
4271
- O(() => {
4272
- const L = Ce.current;
4273
- if (Ce.current = C, C || !L)
4303
+ [te, X, fe, _, K]
4304
+ ), Ie = O(_);
4305
+ L(() => {
4306
+ const S = Ie.current;
4307
+ if (Ie.current = _, _ || !S)
4274
4308
  return;
4275
- const J = y.VIEWPORT_OFFSET + ce.get() + y.COMPACT_WIDTH / 2 < window.innerWidth / 2 ? "left" : "right";
4276
- ge !== J && (Le(J), ht(J));
4277
- const de = me(J);
4278
- de && (ye(ce, de.x, re.SPRING_CONFIG), ye(X, de.y, re.SPRING_CONFIG));
4279
- }, [C, ce, X, me, ge]);
4280
- const ve = A(null), Je = A(m.state === "minimized");
4281
- O(() => {
4282
- const L = Je.current, $ = m.state === "minimized";
4283
- if (Je.current = $, !C || $ === L)
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)
4284
4318
  return;
4285
- if ($) {
4286
- ve.current = X.get();
4287
- const de = ye(X, 0, re.SPRING_CONFIG);
4288
- return () => de.stop();
4319
+ if (G) {
4320
+ Pe.current = X.get();
4321
+ const oe = ye(X, 0, re.SPRING_CONFIG);
4322
+ return () => oe.stop();
4289
4323
  }
4290
- if (ve.current === null)
4324
+ if (Pe.current === null)
4291
4325
  return;
4292
- const J = ye(
4326
+ const Z = ye(
4293
4327
  X,
4294
- ve.current,
4328
+ Pe.current,
4295
4329
  re.SPRING_CONFIG
4296
4330
  );
4297
- return ve.current = null, () => J.stop();
4298
- }, [m.state, C, X]);
4299
- const B = A(m.state), ct = B.current === "compact" && m.state === "expanded";
4300
- return O(() => {
4301
- oe(), B.current = m.state;
4302
- }, [m.state, oe]), O(() => {
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(() => {
4303
4337
  if (m.state !== "expanded")
4304
4338
  return;
4305
- const L = () => {
4306
- if (C) {
4307
- const J = Ot(
4308
- { x: ce.get(), y: X.get() },
4309
- y.COMPACT_WIDTH,
4310
- y.EXPANDED_HEIGHT
4339
+ const S = () => {
4340
+ if (_) {
4341
+ const Z = Ot(
4342
+ { x: te.get(), y: X.get() },
4343
+ b.COMPACT_WIDTH,
4344
+ b.EXPANDED_HEIGHT
4311
4345
  );
4312
- ce.set(J.x), X.set(J.y);
4346
+ te.set(Z.x), X.set(Z.y);
4313
4347
  return;
4314
4348
  }
4315
- const $ = me();
4316
- $ && (ce.set($.x), X.set($.y));
4349
+ const G = fe();
4350
+ G && (te.set(G.x), X.set(G.y));
4317
4351
  };
4318
- return window.addEventListener("resize", L), () => window.removeEventListener("resize", L);
4319
- }, [m.state, ce, X, me, C]), O(() => {
4320
- const L = ie.current;
4352
+ return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
4353
+ }, [m.state, te, X, fe, _]), L(() => {
4354
+ const S = J.current;
4321
4355
  return () => {
4322
- L.forEach(($) => {
4323
- clearTimeout($);
4324
- }), L.clear();
4356
+ S.forEach((G) => {
4357
+ clearTimeout(G);
4358
+ }), S.clear();
4325
4359
  };
4326
- }, []), O(() => {
4327
- if (m.state === "compact" && De.current) {
4328
- const L = De.current.scrollHeight + y.PADDING;
4329
- Te(L);
4360
+ }, []), L(() => {
4361
+ if (m.state === "compact" && xe.current) {
4362
+ const S = xe.current.scrollHeight + b.PADDING;
4363
+ ke(S);
4330
4364
  }
4331
- }, [m.state, P.value]), o === "embedded" ? /* @__PURE__ */ a(
4365
+ }, [m.state, v.value]), o === "embedded" ? /* @__PURE__ */ a(
4332
4366
  "div",
4333
4367
  {
4334
4368
  "data-slot": "chat-embedded",
4335
- className: pe(k, be.container, be.embedded),
4369
+ className: de(M, be.container, be.embedded),
4336
4370
  children: /* @__PURE__ */ a(
4337
4371
  Gt,
4338
4372
  {
4339
4373
  messages: t,
4340
- inputValue: P.value,
4341
- onInputChange: P.setValue,
4342
- onSubmit: U,
4343
- onKeyDown: P.handleKeyDown,
4344
- textareaRef: P.textareaRef,
4374
+ inputValue: v.value,
4375
+ onInputChange: v.setValue,
4376
+ onSubmit: ae,
4377
+ onKeyDown: v.handleKeyDown,
4378
+ textareaRef: v.textareaRef,
4345
4379
  placeholder: s,
4346
4380
  isProcessing: e,
4347
4381
  onStop: h,
4348
4382
  showHeader: !1,
4349
4383
  notice: l,
4350
4384
  suggestions: N,
4351
- clearSuggestions: j,
4385
+ clearSuggestions: $,
4352
4386
  error: i,
4353
- emptyView: M,
4354
- messageRenderer: p,
4355
- showAgentIcon: _,
4356
- onExpand: te,
4357
- focusOnMount: ne.current
4387
+ emptyView: A,
4388
+ messageRenderer: f,
4389
+ showAgentIcon: T,
4390
+ onExpand: ue,
4391
+ focusOnMount: W.current
4358
4392
  }
4359
4393
  )
4360
4394
  }
4361
- ) : /* @__PURE__ */ w(Ke, { children: [
4395
+ ) : /* @__PURE__ */ C(Ke, { children: [
4362
4396
  /* @__PURE__ */ a(
4363
4397
  "div",
4364
4398
  {
4365
- ref: Ne,
4399
+ ref: pe,
4366
4400
  style: {
4367
4401
  position: "fixed",
4368
- top: y.VIEWPORT_OFFSET,
4369
- left: y.VIEWPORT_OFFSET,
4370
- right: y.VIEWPORT_OFFSET,
4371
- bottom: y.VIEWPORT_OFFSET,
4402
+ top: b.VIEWPORT_OFFSET,
4403
+ left: b.VIEWPORT_OFFSET,
4404
+ right: b.VIEWPORT_OFFSET,
4405
+ bottom: b.VIEWPORT_OFFSET,
4372
4406
  pointerEvents: "none"
4373
4407
  }
4374
4408
  }
@@ -4376,31 +4410,31 @@ function vc({
4376
4410
  /* @__PURE__ */ a(
4377
4411
  se.div,
4378
4412
  {
4379
- ref: le,
4413
+ ref: he,
4380
4414
  "data-slot": "chat-floating",
4381
- className: pe(k, be.container, be.floating, {
4415
+ className: de(M, be.container, be.floating, {
4382
4416
  [be.expanded]: m.state === "expanded",
4383
- animating: q
4417
+ animating: Se
4384
4418
  }),
4385
- onMouseLeave: m.state === "compact" ? K : void 0,
4419
+ onMouseLeave: m.state === "compact" ? U : void 0,
4386
4420
  drag: m.state === "expanded",
4387
- dragControls: ke,
4421
+ dragControls: Ee,
4388
4422
  dragListener: !1,
4389
- dragConstraints: Ne,
4423
+ dragConstraints: pe,
4390
4424
  dragMomentum: !1,
4391
- dragElastic: C ? 0 : 0.1,
4425
+ dragElastic: _ ? 0 : 0.1,
4392
4426
  dragTransition: { power: 0.1, timeConstant: 100 },
4393
- onDragEnd: Ve,
4394
- onPointerDown: xe,
4427
+ onDragEnd: Te,
4428
+ onPointerDown: We,
4395
4429
  initial: !1,
4396
4430
  animate: {
4397
- bottom: m.state === "minimized" ? 0 : y.VIEWPORT_OFFSET
4431
+ bottom: m.state === "minimized" ? 0 : b.VIEWPORT_OFFSET
4398
4432
  },
4399
- transition: Be,
4433
+ transition: He,
4400
4434
  style: {
4401
- x: ce,
4435
+ x: te,
4402
4436
  y: X,
4403
- left: y.VIEWPORT_OFFSET
4437
+ left: b.VIEWPORT_OFFSET
4404
4438
  },
4405
4439
  children: /* @__PURE__ */ a(
4406
4440
  se.div,
@@ -4409,27 +4443,27 @@ function vc({
4409
4443
  className: be.content,
4410
4444
  initial: !1,
4411
4445
  animate: {
4412
- width: m.state === "collapsed" ? y.COLLAPSED_SIZE : y.COMPACT_WIDTH,
4413
- height: f(m.state),
4414
- x: m.state === "collapsed" && ge === "right" ? y.COMPACT_WIDTH - y.COLLAPSED_SIZE : 0,
4415
- borderBottomLeftRadius: m.state === "minimized" ? 0 : y.BORDER_RADIUS,
4416
- borderBottomRightRadius: m.state === "minimized" ? 0 : y.BORDER_RADIUS,
4417
- transition: P.value.trim() ? { duration: 0 } : Be
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
4418
4452
  },
4419
- onAnimationStart: () => _e(!0),
4420
- onAnimationComplete: () => _e(!1),
4453
+ onAnimationStart: () => ge(!0),
4454
+ onAnimationComplete: () => ge(!1),
4421
4455
  style: {
4422
- borderTopLeftRadius: y.BORDER_RADIUS,
4423
- borderTopRightRadius: y.BORDER_RADIUS
4456
+ borderTopLeftRadius: b.BORDER_RADIUS,
4457
+ borderTopRightRadius: b.BORDER_RADIUS
4424
4458
  },
4425
- children: /* @__PURE__ */ w(ot, { mode: "wait", children: [
4459
+ children: /* @__PURE__ */ C(ct, { mode: "wait", children: [
4426
4460
  m.state === "collapsed" && /* @__PURE__ */ a(
4427
4461
  en,
4428
4462
  {
4429
4463
  icon: c,
4430
- onClick: He,
4431
- onHover: R,
4432
- focusOnMount: G.current
4464
+ onClick: Re,
4465
+ onHover: q,
4466
+ focusOnMount: ie.current
4433
4467
  },
4434
4468
  "collapsed"
4435
4469
  ),
@@ -4438,28 +4472,28 @@ function vc({
4438
4472
  {
4439
4473
  icon: c,
4440
4474
  title: r,
4441
- onClick: He,
4442
- focusOnMount: G.current
4475
+ onClick: Re,
4476
+ focusOnMount: ie.current
4443
4477
  },
4444
4478
  "minimized"
4445
4479
  ),
4446
- m.state === "compact" && /* @__PURE__ */ a("div", { ref: De, children: /* @__PURE__ */ a(
4480
+ m.state === "compact" && /* @__PURE__ */ a("div", { ref: xe, children: /* @__PURE__ */ a(
4447
4481
  nn,
4448
4482
  {
4449
- value: P.value,
4450
- onChange: P.setValue,
4451
- onSubmit: U,
4452
- onKeyDown: P.handleKeyDown,
4453
- textareaRef: P.textareaRef,
4483
+ value: v.value,
4484
+ onChange: v.setValue,
4485
+ onSubmit: ae,
4486
+ onKeyDown: v.handleKeyDown,
4487
+ textareaRef: v.textareaRef,
4454
4488
  placeholder: s,
4455
4489
  isProcessing: e,
4456
- onBlur: K,
4457
- onExpand: te,
4458
- showExpandButton: !P.value.trim(),
4459
- focusOnMount: V.current,
4490
+ onBlur: U,
4491
+ onExpand: ue,
4492
+ showExpandButton: !v.value.trim(),
4493
+ focusOnMount: z.current,
4460
4494
  onStop: h,
4461
4495
  suggestions: N,
4462
- clearSuggestions: j
4496
+ clearSuggestions: $
4463
4497
  },
4464
4498
  "compact"
4465
4499
  ) }),
@@ -4467,26 +4501,26 @@ function vc({
4467
4501
  Gt,
4468
4502
  {
4469
4503
  messages: t,
4470
- inputValue: P.value,
4471
- onInputChange: P.setValue,
4472
- onSubmit: U,
4473
- onKeyDown: P.handleKeyDown,
4474
- textareaRef: P.textareaRef,
4504
+ inputValue: v.value,
4505
+ onInputChange: v.setValue,
4506
+ onSubmit: ae,
4507
+ onKeyDown: v.handleKeyDown,
4508
+ textareaRef: v.textareaRef,
4475
4509
  placeholder: s,
4476
4510
  isProcessing: e,
4477
4511
  onStop: h,
4478
4512
  showHeader: !0,
4479
- onClose: fe,
4480
- fromCompact: ct,
4513
+ onClose: Me,
4514
+ fromCompact: yt,
4481
4515
  notice: l,
4482
4516
  suggestions: N,
4483
- clearSuggestions: j,
4517
+ clearSuggestions: $,
4484
4518
  error: i,
4485
- emptyView: M,
4486
- messageRenderer: p,
4487
- showAgentIcon: _,
4488
- onExpand: te,
4489
- focusOnMount: ne.current
4519
+ emptyView: A,
4520
+ messageRenderer: f,
4521
+ showAgentIcon: T,
4522
+ onExpand: ue,
4523
+ focusOnMount: W.current
4490
4524
  },
4491
4525
  "expanded"
4492
4526
  )
@@ -4497,27 +4531,27 @@ function vc({
4497
4531
  )
4498
4532
  ] });
4499
4533
  }
4500
- const mo = "ImageUploader-module_container", po = "ImageUploader-module_active", ho = "ImageUploader-module_uploader", fo = "ImageUploader-module_uploading", vo = "ImageUploader-module_content", yo = "ImageUploader-module_hiddenInput", bo = "ImageUploader-module_clickArea", wo = "ImageUploader-module_draggingMessage", Co = "ImageUploader-module_draggingOver", _o = "ImageUploader-module_preview", To = "ImageUploader-module_previewItem", Io = "ImageUploader-module_removeButton", So = "ImageUploader-module_previewImage", ko = "ImageUploader-module_previewMeta", Mo = "ImageUploader-module_previewFilename", Ao = "ImageUploader-module_previewType", Oo = "ImageUploader-module_uploadingIndicator", Lo = "ImageUploader-module_spinner", No = "ImageUploader-module_invalidMessage", ee = {
4501
- container: mo,
4502
- active: po,
4503
- uploader: ho,
4504
- uploading: fo,
4505
- content: vo,
4506
- hiddenInput: yo,
4507
- clickArea: bo,
4508
- draggingMessage: wo,
4509
- draggingOver: Co,
4510
- preview: _o,
4511
- previewItem: To,
4512
- removeButton: Io,
4513
- previewImage: So,
4514
- previewMeta: ko,
4515
- previewFilename: Mo,
4516
- previewType: Ao,
4517
- uploadingIndicator: Oo,
4518
- spinner: Lo,
4519
- invalidMessage: No
4520
- }, xo = Kt(
4534
+ const ho = "ImageUploader-module_container", fo = "ImageUploader-module_active", vo = "ImageUploader-module_uploader", yo = "ImageUploader-module_uploading", bo = "ImageUploader-module_content", wo = "ImageUploader-module_hiddenInput", Co = "ImageUploader-module_clickArea", _o = "ImageUploader-module_draggingMessage", To = "ImageUploader-module_draggingOver", Io = "ImageUploader-module_preview", So = "ImageUploader-module_previewItem", ko = "ImageUploader-module_removeButton", Mo = "ImageUploader-module_previewImage", Ao = "ImageUploader-module_previewMeta", Oo = "ImageUploader-module_previewFilename", Lo = "ImageUploader-module_previewType", No = "ImageUploader-module_uploadingIndicator", xo = "ImageUploader-module_spinner", Do = "ImageUploader-module_invalidMessage", ee = {
4535
+ container: ho,
4536
+ active: fo,
4537
+ uploader: vo,
4538
+ uploading: yo,
4539
+ content: bo,
4540
+ hiddenInput: wo,
4541
+ clickArea: Co,
4542
+ draggingMessage: _o,
4543
+ draggingOver: To,
4544
+ preview: Io,
4545
+ previewItem: So,
4546
+ removeButton: ko,
4547
+ previewImage: Mo,
4548
+ previewMeta: Ao,
4549
+ previewFilename: Oo,
4550
+ previewType: Lo,
4551
+ uploadingIndicator: No,
4552
+ spinner: xo,
4553
+ invalidMessage: Do
4554
+ }, Eo = Kt(
4521
4555
  ({
4522
4556
  image: t,
4523
4557
  allowDragToInsert: e,
@@ -4527,7 +4561,7 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
4527
4561
  onRemove: c
4528
4562
  }) => {
4529
4563
  const r = t.mime_type ? t.mime_type.split("/")[1].toUpperCase() : "", s = t.title || t.name || t.url.split("/").pop() || "image";
4530
- return /* @__PURE__ */ w(
4564
+ return /* @__PURE__ */ C(
4531
4565
  "div",
4532
4566
  {
4533
4567
  className: ee.previewItem,
@@ -4572,7 +4606,7 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
4572
4606
  loading: "lazy"
4573
4607
  }
4574
4608
  ),
4575
- i && /* @__PURE__ */ w("div", { className: ee.previewMeta, children: [
4609
+ i && /* @__PURE__ */ C("div", { className: ee.previewMeta, children: [
4576
4610
  /* @__PURE__ */ a(
4577
4611
  "span",
4578
4612
  {
@@ -4588,7 +4622,7 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
4588
4622
  t.id
4589
4623
  );
4590
4624
  }
4591
- ), yc = Jt(function({
4625
+ ), wc = Jt(function({
4592
4626
  images: e = [],
4593
4627
  uploadingImages: i = [],
4594
4628
  onFilesSelected: n,
@@ -4601,65 +4635,65 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
4601
4635
  acceptedFileTypes: d = ["image/jpeg", "image/png"],
4602
4636
  maxFileSize: u,
4603
4637
  maxFiles: h,
4604
- uploadingIndicator: M,
4638
+ uploadingIndicator: A,
4605
4639
  className: x = "",
4606
4640
  showFileMetadata: N = !0,
4607
- allowDragToInsert: j = !0,
4608
- onError: p,
4609
- visible: _ = !0,
4610
- dropZoneRef: k
4641
+ allowDragToInsert: $ = !0,
4642
+ onError: f,
4643
+ visible: T = !0,
4644
+ dropZoneRef: M
4611
4645
  }, D) {
4612
- const { textareaRef: C } = Oe(), [H, Y] = Z(!1), [z, S] = Z(!1), [m, V] = Z(!1), G = A(null), ne = A(null), q = A(0);
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);
4613
4647
  xn(D, () => ({
4614
4648
  openFileDialog: () => {
4615
- var f;
4616
- (f = G.current) == null || f.click();
4649
+ var p;
4650
+ (p = z.current) == null || p.click();
4617
4651
  }
4618
- })), O(() => {
4619
- const f = k ? k.current : window;
4620
- if (!f)
4652
+ })), L(() => {
4653
+ const p = M ? M.current : window;
4654
+ if (!p)
4621
4655
  return;
4622
- const R = (te) => {
4623
- var fe, me;
4624
- (me = (fe = te.dataTransfer) == null ? void 0 : fe.types) != null && me.includes("Files") && (q.current += 1, S(!0));
4625
- }, K = (te) => {
4626
- q.current -= 1, (q.current === 0 || te.relatedTarget === null) && (q.current = 0, S(!1));
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));
4627
4661
  }, U = () => {
4628
- q.current = 0, S(!1);
4662
+ W.current = 0, I(!1);
4629
4663
  };
4630
- return f.addEventListener(
4664
+ return p.addEventListener(
4631
4665
  "dragenter",
4632
4666
  R
4633
- ), f.addEventListener(
4667
+ ), p.addEventListener(
4634
4668
  "dragleave",
4635
- K
4636
- ), f.addEventListener("drop", U), () => {
4637
- f.removeEventListener(
4669
+ q
4670
+ ), p.addEventListener("drop", U), () => {
4671
+ p.removeEventListener(
4638
4672
  "dragenter",
4639
4673
  R
4640
- ), f.removeEventListener(
4674
+ ), p.removeEventListener(
4641
4675
  "dragleave",
4642
- K
4643
- ), f.removeEventListener("drop", U);
4676
+ q
4677
+ ), p.removeEventListener("drop", U);
4644
4678
  };
4645
- }, [k]), O(() => () => {
4646
- ne.current && clearTimeout(ne.current);
4679
+ }, [M]), L(() => () => {
4680
+ ie.current && clearTimeout(ie.current);
4647
4681
  }, []);
4648
- const _e = b((f) => {
4649
- const R = Math.min(f, 10485760), K = Math.floor(R / (1024 * 1024));
4650
- return K >= 1 ? `${K} MB` : `${Math.floor(R / 1024)} KB`;
4651
- }, []), ie = b(
4652
- (f) => {
4653
- if (!f || f.length === 0)
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)
4654
4688
  return;
4655
- const R = Array.from(f), K = R.filter(
4689
+ const R = Array.from(p), q = R.filter(
4656
4690
  (U) => d.includes(U.type)
4657
4691
  );
4658
- if (K.length < R.length) {
4659
- V(!0);
4660
- const U = d.map((te) => te.split("/")[1].toUpperCase()).join(" or ");
4661
- p == null || p(
4662
- Fe(
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
+ je(
4663
4697
  /* translators: %s: allowed file types (e.g., "JPEG or PNG") */
4664
4698
  E(
4665
4699
  "Only %s image files are allowed.",
@@ -4667,178 +4701,178 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
4667
4701
  ),
4668
4702
  U
4669
4703
  )
4670
- ), ne.current && clearTimeout(ne.current), ne.current = setTimeout(() => {
4671
- V(!1);
4704
+ ), ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => {
4705
+ m(!1);
4672
4706
  }, 3e3);
4673
4707
  }
4674
- if (h && K.length > h) {
4675
- p == null || p(
4676
- Fe(
4708
+ if (h && q.length > h) {
4709
+ f == null || f(
4710
+ je(
4677
4711
  /* translators: %d: maximum number of files allowed */
4678
4712
  E("Maximum %d files allowed.", "a8c-agenttic"),
4679
4713
  h
4680
4714
  )
4681
4715
  );
4682
- const U = K.slice(0, h);
4716
+ const U = q.slice(0, h);
4683
4717
  U.length > 0 && n(U);
4684
4718
  return;
4685
4719
  }
4686
- K.length > 0 && n(K);
4720
+ q.length > 0 && n(q);
4687
4721
  },
4688
- [n, d, h, p]
4689
- ), oe = A(ie);
4690
- O(() => {
4691
- oe.current = ie;
4692
- }, [ie]), O(() => {
4693
- const f = k == null ? void 0 : k.current;
4694
- if (!f)
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)
4695
4729
  return;
4696
4730
  const R = (U) => {
4697
4731
  U.preventDefault();
4698
- }, K = (U) => {
4699
- var te;
4700
- U.preventDefault(), q.current = 0, S(!1), Y(!1), (te = U.dataTransfer) != null && te.files && (oe.current(U.dataTransfer.files), c == null || c(Array.from(U.dataTransfer.files)));
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)));
4701
4735
  };
4702
- return f.addEventListener("dragover", R), f.addEventListener("drop", K), () => {
4703
- f.removeEventListener(
4736
+ return p.addEventListener("dragover", R), p.addEventListener("drop", q), () => {
4737
+ p.removeEventListener(
4704
4738
  "dragover",
4705
4739
  R
4706
- ), f.removeEventListener("drop", K);
4740
+ ), p.removeEventListener("drop", q);
4707
4741
  };
4708
- }, [k, c]), O(() => {
4709
- const f = (R) => {
4710
- var me;
4711
- const K = C.current && document.activeElement === C.current, U = C.current && R.target && (R.target === C.current || C.current.contains(R.target));
4712
- if (!K && !U)
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)
4713
4747
  return;
4714
- const te = (me = R.clipboardData) == null ? void 0 : me.items;
4715
- if (!te)
4748
+ const ae = (Me = R.clipboardData) == null ? void 0 : Me.items;
4749
+ if (!ae)
4716
4750
  return;
4717
- const fe = [];
4718
- for (let xe = 0; xe < te.length; xe++) {
4719
- const Ve = te[xe];
4720
- if (Ve.type.startsWith("image/")) {
4721
- const Ce = Ve.getAsFile();
4722
- Ce && fe.push(Ce);
4751
+ const ue = [];
4752
+ for (let fe = 0; fe < ae.length; fe++) {
4753
+ const We = ae[fe];
4754
+ if (We.type.startsWith("image/")) {
4755
+ const Te = We.getAsFile();
4756
+ Te && ue.push(Te);
4723
4757
  }
4724
4758
  }
4725
- fe.length > 0 && (R.preventDefault(), oe.current(fe), r == null || r(fe));
4759
+ ue.length > 0 && (R.preventDefault(), J.current(ue), r == null || r(ue));
4726
4760
  };
4727
- return window.addEventListener("paste", f), () => {
4728
- window.removeEventListener("paste", f);
4761
+ return window.addEventListener("paste", p), () => {
4762
+ window.removeEventListener("paste", p);
4729
4763
  };
4730
4764
  }, [r]);
4731
- const P = (f) => {
4732
- f.preventDefault(), f.stopPropagation(), Y(!0);
4733
- }, T = (f) => {
4734
- f.preventDefault(), f.stopPropagation(), Y(!1);
4735
- }, Te = (f) => {
4736
- if (f.preventDefault(), f.stopPropagation(), Y(!1), q.current = 0, S(!1), f.dataTransfer.files) {
4737
- const R = Array.from(f.dataTransfer.files);
4738
- ie(f.dataTransfer.files), c == null || c(R);
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);
4739
4773
  }
4740
- }, ge = (f) => {
4741
- if (f.target.files) {
4742
- const R = Array.from(f.target.files);
4743
- ie(f.target.files), o == null || o(R);
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);
4744
4778
  }
4745
- f.target.value = "";
4746
- }, Le = () => {
4747
- var f;
4748
- (f = G.current) == null || f.click();
4749
- }, De = b(
4750
- (f, R) => {
4751
- l == null || l(f, R);
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);
4752
4786
  },
4753
4787
  [l]
4754
- ), Ne = b(
4755
- (f, R) => {
4756
- g == null || g(f, R);
4788
+ ), xe = w(
4789
+ (p, R) => {
4790
+ g == null || g(p, R);
4757
4791
  },
4758
4792
  [g]
4759
- ), le = b(
4760
- (f, R) => {
4761
- f.stopPropagation(), s(R);
4793
+ ), pe = w(
4794
+ (p, R) => {
4795
+ p.stopPropagation(), s(R);
4762
4796
  },
4763
4797
  [s]
4764
4798
  );
4765
- if (!_)
4799
+ if (!T)
4766
4800
  return null;
4767
- const Ee = e.length > 0, v = i.length > 0, ce = z, X = !z && (Ee || v), ke = Ee || v || z || m, He = u ? Fe(
4801
+ const he = e.length > 0, y = i.length > 0, De = H, te = !H && (he || y), X = he || y || H || V, Ee = u ? je(
4768
4802
  /* translators: %s: maximum file size (e.g., "5 MB") */
4769
4803
  E("Upload image files up to %s each.", "a8c-agenttic"),
4770
- _e(u)
4771
- ) : "", Ie = Fe(
4804
+ Se(u)
4805
+ ) : "", Re = je(
4772
4806
  /* translators: %s: allowed file types (e.g., "JPEG or PNG") */
4773
4807
  E("Only %s image files are allowed.", "a8c-agenttic"),
4774
- d.map((f) => f.split("/")[1].toUpperCase()).join(" or ")
4808
+ d.map((p) => p.split("/")[1].toUpperCase()).join(" or ")
4775
4809
  );
4776
4810
  return /* @__PURE__ */ a(
4777
4811
  "div",
4778
4812
  {
4779
- className: `${ee.container} ${ke ? ee.active : ""} ${x}`,
4813
+ className: `${ee.container} ${X ? ee.active : ""} ${x}`,
4780
4814
  "data-slot": "image-uploader",
4781
4815
  children: /* @__PURE__ */ a(
4782
4816
  "div",
4783
4817
  {
4784
- className: `${ee.uploader} ${v ? ee.uploading : ""} ${H ? ee.draggingOver : ""}`,
4785
- children: /* @__PURE__ */ w("div", { className: ee.content, children: [
4786
- !m && /* @__PURE__ */ w(Ke, { children: [
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: [
4787
4821
  /* @__PURE__ */ a(
4788
4822
  "input",
4789
4823
  {
4790
- ref: G,
4824
+ ref: z,
4791
4825
  type: "file",
4792
4826
  accept: d.join(","),
4793
4827
  multiple: !h || h > 1,
4794
- onChange: ge,
4828
+ onChange: ke,
4795
4829
  className: ee.hiddenInput
4796
4830
  }
4797
4831
  ),
4798
- /* @__PURE__ */ w(
4832
+ /* @__PURE__ */ C(
4799
4833
  "div",
4800
4834
  {
4801
4835
  className: ee.clickArea,
4802
- onClick: Le,
4803
- onDragOver: P,
4804
- onDragLeave: T,
4805
- onDrop: Te,
4836
+ onClick: me,
4837
+ onDragOver: Ce,
4838
+ onDragLeave: v,
4839
+ onDrop: _e,
4806
4840
  role: "button",
4807
4841
  tabIndex: 0,
4808
- onKeyDown: (f) => {
4809
- (f.key === "Enter" || f.key === " ") && Le();
4842
+ onKeyDown: (p) => {
4843
+ (p.key === "Enter" || p.key === " ") && me();
4810
4844
  },
4811
4845
  "aria-label": E(
4812
4846
  "Click to upload images or drag and drop",
4813
4847
  "a8c-agenttic"
4814
4848
  ),
4815
4849
  children: [
4816
- ce && /* @__PURE__ */ a("div", { className: ee.draggingMessage, children: /* @__PURE__ */ w("p", { children: [
4850
+ De && /* @__PURE__ */ a("div", { className: ee.draggingMessage, children: /* @__PURE__ */ C("p", { children: [
4817
4851
  /* @__PURE__ */ a("strong", { children: E(
4818
4852
  "Drop files here to use",
4819
4853
  "a8c-agenttic"
4820
4854
  ) }),
4821
4855
  /* @__PURE__ */ a("br", {}),
4822
- u && He
4856
+ u && Ee
4823
4857
  ] }) }),
4824
- X && /* @__PURE__ */ w("div", { className: ee.preview, children: [
4825
- Ee && e.map((f) => /* @__PURE__ */ a(
4826
- xo,
4858
+ te && /* @__PURE__ */ C("div", { className: ee.preview, children: [
4859
+ he && e.map((p) => /* @__PURE__ */ a(
4860
+ Eo,
4827
4861
  {
4828
- image: f,
4829
- allowDragToInsert: j,
4862
+ image: p,
4863
+ allowDragToInsert: $,
4830
4864
  showFileMetadata: N,
4831
- onDragStart: De,
4832
- onDragEnd: Ne,
4833
- onRemove: le
4865
+ onDragStart: Ve,
4866
+ onDragEnd: xe,
4867
+ onRemove: pe
4834
4868
  },
4835
- f.id
4869
+ p.id
4836
4870
  )),
4837
- v && i.map(({ id: f }) => /* @__PURE__ */ a(
4871
+ y && i.map(({ id: p }) => /* @__PURE__ */ a(
4838
4872
  "div",
4839
4873
  {
4840
4874
  className: ee.previewItem,
4841
- children: M || /* @__PURE__ */ a(
4875
+ children: A || /* @__PURE__ */ a(
4842
4876
  "div",
4843
4877
  {
4844
4878
  className: ee.uploadingIndicator,
@@ -4851,40 +4885,40 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
4851
4885
  }
4852
4886
  )
4853
4887
  },
4854
- f
4888
+ p
4855
4889
  ))
4856
4890
  ] })
4857
4891
  ]
4858
4892
  }
4859
4893
  )
4860
4894
  ] }),
4861
- m && /* @__PURE__ */ a("div", { className: ee.invalidMessage, children: /* @__PURE__ */ a("p", { children: Ie }) })
4895
+ V && /* @__PURE__ */ a("div", { className: ee.invalidMessage, children: /* @__PURE__ */ a("p", { children: Re }) })
4862
4896
  ] })
4863
4897
  }
4864
4898
  )
4865
4899
  }
4866
4900
  );
4867
- }), Do = "MessageDivider-module_container", Eo = "MessageDivider-module_line", Ro = "MessageDivider-module_message", ut = {
4868
- container: Do,
4869
- line: Eo,
4870
- message: Ro
4901
+ }), Ro = "MessageDivider-module_container", Po = "MessageDivider-module_line", $o = "MessageDivider-module_message", ut = {
4902
+ container: Ro,
4903
+ line: Po,
4904
+ message: $o
4871
4905
  };
4872
- function bc({ message: t = "" }) {
4873
- return /* @__PURE__ */ w("div", { className: ut.container, children: [
4906
+ function Cc({ message: t = "" }) {
4907
+ return /* @__PURE__ */ C("div", { className: ut.container, children: [
4874
4908
  /* @__PURE__ */ a("div", { className: ut.line }),
4875
- t && /* @__PURE__ */ w(Ke, { children: [
4909
+ t && /* @__PURE__ */ C(Ke, { children: [
4876
4910
  /* @__PURE__ */ a("span", { className: ut.message, children: t }),
4877
4911
  /* @__PURE__ */ a("div", { className: ut.line })
4878
4912
  ] })
4879
4913
  ] });
4880
4914
  }
4881
- const Po = "EmptyView-module_container", $o = "EmptyView-module_icon", Fo = "EmptyView-module_heading", jo = "EmptyView-module_help", Uo = "EmptyView-module_suggestionsWrapper", at = {
4882
- container: Po,
4883
- icon: $o,
4884
- heading: Fo,
4885
- help: jo,
4886
- suggestionsWrapper: Uo
4887
- }, wc = ({
4915
+ const Fo = "EmptyView-module_container", jo = "EmptyView-module_icon", Uo = "EmptyView-module_heading", Bo = "EmptyView-module_help", Ho = "EmptyView-module_suggestionsWrapper", it = {
4916
+ container: Fo,
4917
+ icon: jo,
4918
+ heading: Uo,
4919
+ help: Bo,
4920
+ suggestionsWrapper: Ho
4921
+ }, _c = ({
4888
4922
  suggestions: t,
4889
4923
  onSuggestionClick: e,
4890
4924
  icon: i = "✨",
@@ -4893,10 +4927,10 @@ const Po = "EmptyView-module_container", $o = "EmptyView-module_icon", Fo = "Emp
4893
4927
  "a8c-agenttic"
4894
4928
  ),
4895
4929
  help: o
4896
- }) => /* @__PURE__ */ w("div", { className: at.container, children: [
4897
- /* @__PURE__ */ a("div", { className: at.icon, children: i }),
4898
- /* @__PURE__ */ a("h2", { className: at.heading, children: n }),
4899
- t && t.length > 0 && /* @__PURE__ */ a("div", { className: at.suggestionsWrapper, children: /* @__PURE__ */ a(
4930
+ }) => /* @__PURE__ */ C("div", { className: it.container, children: [
4931
+ /* @__PURE__ */ a("div", { className: it.icon, children: i }),
4932
+ /* @__PURE__ */ a("h2", { className: it.heading, children: n }),
4933
+ t && t.length > 0 && /* @__PURE__ */ a("div", { className: it.suggestionsWrapper, children: /* @__PURE__ */ a(
4900
4934
  vt,
4901
4935
  {
4902
4936
  suggestions: t,
@@ -4905,16 +4939,16 @@ const Po = "EmptyView-module_container", $o = "EmptyView-module_icon", Fo = "Emp
4905
4939
  layout: "vertical"
4906
4940
  }
4907
4941
  ) }),
4908
- o && /* @__PURE__ */ a("p", { className: at.help, children: o })
4909
- ] }), Bo = "ImageRenderer-module_container", Ho = "ImageRenderer-module_imageButton", Vo = "ImageRenderer-module_selected", Wo = "ImageRenderer-module_disabled", zo = "ImageRenderer-module_image", Go = "ImageRenderer-module_header", Ze = {
4910
- container: Bo,
4911
- imageButton: Ho,
4912
- selected: Vo,
4913
- disabled: Wo,
4914
- image: zo,
4915
- header: Go
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", Ze = {
4944
+ container: Vo,
4945
+ imageButton: Wo,
4946
+ selected: zo,
4947
+ disabled: Go,
4948
+ image: Zo,
4949
+ header: Yo
4916
4950
  };
4917
- function Zo({ className: t, size: e = 24 }) {
4951
+ function Ko({ className: t, size: e = 24 }) {
4918
4952
  return /* @__PURE__ */ a(
4919
4953
  "svg",
4920
4954
  {
@@ -4935,31 +4969,31 @@ function Zo({ className: t, size: e = 24 }) {
4935
4969
  }
4936
4970
  );
4937
4971
  }
4938
- const Cc = ({
4972
+ const Tc = ({
4939
4973
  images: t,
4940
4974
  onSelect: e,
4941
4975
  header: i,
4942
4976
  disabled: n = !1
4943
4977
  }) => {
4944
- const [o, c] = Z(null), r = A(null), s = (l) => {
4978
+ const [o, c] = Y(null), r = O(null), s = (l) => {
4945
4979
  c(l.url), e(l);
4946
4980
  };
4947
- return O(() => {
4981
+ return L(() => {
4948
4982
  if (n || !o)
4949
4983
  return;
4950
4984
  const l = (g) => {
4951
4985
  r.current && !r.current.contains(g.target) && (c(null), e(null));
4952
4986
  };
4953
4987
  return window.addEventListener("click", l, !0), () => window.removeEventListener("click", l, !0);
4954
- }, [e, n, o]), /* @__PURE__ */ w(se.div, { children: [
4955
- i || /* @__PURE__ */ w("div", { className: Ze.header, children: [
4956
- /* @__PURE__ */ a(Zo, {}),
4988
+ }, [e, n, o]), /* @__PURE__ */ C(se.div, { children: [
4989
+ i || /* @__PURE__ */ C("div", { className: Ze.header, children: [
4990
+ /* @__PURE__ */ a(Ko, {}),
4957
4991
  " Done"
4958
4992
  ] }),
4959
4993
  /* @__PURE__ */ a("div", { className: Ze.container, ref: r, children: t.map((l) => /* @__PURE__ */ a(
4960
4994
  "button",
4961
4995
  {
4962
- className: pe(
4996
+ className: de(
4963
4997
  Ze.imageButton,
4964
4998
  !n && o === l.url ? Ze.selected : "",
4965
4999
  n ? Ze.disabled : ""
@@ -4980,7 +5014,7 @@ const Cc = ({
4980
5014
  )) })
4981
5015
  ] });
4982
5016
  };
4983
- function _c({ className: t, size: e = 24 }) {
5017
+ function Ic({ className: t, size: e = 24 }) {
4984
5018
  return /* @__PURE__ */ a(
4985
5019
  "svg",
4986
5020
  {
@@ -5000,7 +5034,7 @@ function _c({ className: t, size: e = 24 }) {
5000
5034
  }
5001
5035
  );
5002
5036
  }
5003
- function Tc({ className: t, size: e = 24 }) {
5037
+ function Sc({ className: t, size: e = 24 }) {
5004
5038
  return /* @__PURE__ */ a(
5005
5039
  "svg",
5006
5040
  {
@@ -5021,7 +5055,7 @@ function Tc({ className: t, size: e = 24 }) {
5021
5055
  }
5022
5056
  );
5023
5057
  }
5024
- function Ic({ className: t, size: e = 24 }) {
5058
+ function kc({ className: t, size: e = 24 }) {
5025
5059
  return /* @__PURE__ */ a(
5026
5060
  "svg",
5027
5061
  {
@@ -5042,7 +5076,7 @@ function Ic({ className: t, size: e = 24 }) {
5042
5076
  }
5043
5077
  );
5044
5078
  }
5045
- function Sc({ className: t, size: e = 24 }) {
5079
+ function Mc({ className: t, size: e = 24 }) {
5046
5080
  return /* @__PURE__ */ a(
5047
5081
  "svg",
5048
5082
  {
@@ -5065,7 +5099,7 @@ function Sc({ className: t, size: e = 24 }) {
5065
5099
  }
5066
5100
  );
5067
5101
  }
5068
- function kc({ className: t, size: e = 24 }) {
5102
+ function Ac({ className: t, size: e = 24 }) {
5069
5103
  return /* @__PURE__ */ a(
5070
5104
  "svg",
5071
5105
  {
@@ -5087,8 +5121,8 @@ function kc({ className: t, size: e = 24 }) {
5087
5121
  }
5088
5122
  );
5089
5123
  }
5090
- function Mc({ className: t, size: e = 24 }) {
5091
- return /* @__PURE__ */ w(
5124
+ function Oc({ className: t, size: e = 24 }) {
5125
+ return /* @__PURE__ */ C(
5092
5126
  "svg",
5093
5127
  {
5094
5128
  width: e,
@@ -5118,8 +5152,8 @@ function Mc({ className: t, size: e = 24 }) {
5118
5152
  }
5119
5153
  );
5120
5154
  }
5121
- function Ac({ className: t, size: e = 24 }) {
5122
- return /* @__PURE__ */ w(
5155
+ function Lc({ className: t, size: e = 24 }) {
5156
+ return /* @__PURE__ */ C(
5123
5157
  "svg",
5124
5158
  {
5125
5159
  width: e,
@@ -5148,7 +5182,7 @@ function Ac({ className: t, size: e = 24 }) {
5148
5182
  }
5149
5183
  );
5150
5184
  }
5151
- function Oc({ className: t, size: e = 24 }) {
5185
+ function Nc({ className: t, size: e = 24 }) {
5152
5186
  return /* @__PURE__ */ a(
5153
5187
  "svg",
5154
5188
  {
@@ -5169,8 +5203,8 @@ function Oc({ className: t, size: e = 24 }) {
5169
5203
  }
5170
5204
  );
5171
5205
  }
5172
- function Lc({ className: t, size: e = 24 }) {
5173
- return /* @__PURE__ */ w(
5206
+ function xc({ className: t, size: e = 24 }) {
5207
+ return /* @__PURE__ */ C(
5174
5208
  "svg",
5175
5209
  {
5176
5210
  width: e,
@@ -5201,7 +5235,7 @@ function Lc({ className: t, size: e = 24 }) {
5201
5235
  }
5202
5236
  );
5203
5237
  }
5204
- function Nc({ className: t, size: e = 24 }) {
5238
+ function Dc({ className: t, size: e = 24 }) {
5205
5239
  return /* @__PURE__ */ a(
5206
5240
  "svg",
5207
5241
  {
@@ -5222,17 +5256,17 @@ function Nc({ className: t, size: e = 24 }) {
5222
5256
  }
5223
5257
  );
5224
5258
  }
5225
- const Yo = (t, e = "") => {
5259
+ const Jo = (t, e = "") => {
5226
5260
  try {
5227
5261
  return getComputedStyle(document.documentElement).getPropertyValue(t).trim() || e;
5228
5262
  } catch (i) {
5229
5263
  return console.warn(`Failed to get CSS variable ${t}:`, i), e;
5230
5264
  }
5231
- }, it = ({ message: t, details: e }) => /* @__PURE__ */ w("div", { className: "chart-error", children: [
5265
+ }, rt = ({ message: t, details: e }) => /* @__PURE__ */ C("div", { className: "chart-error", children: [
5232
5266
  /* @__PURE__ */ a("strong", { children: "Chart Error:" }),
5233
5267
  " ",
5234
5268
  t,
5235
- e && /* @__PURE__ */ w("details", { children: [
5269
+ e && /* @__PURE__ */ C("details", { children: [
5236
5270
  /* @__PURE__ */ a("summary", { children: "Show Details" }),
5237
5271
  /* @__PURE__ */ a("pre", { children: e })
5238
5272
  ] })
@@ -5240,8 +5274,8 @@ const Yo = (t, e = "") => {
5240
5274
  children: t,
5241
5275
  error: e
5242
5276
  }) => {
5243
- const i = rt(() => {
5244
- const o = [Yo("--color-primary", "#4F46E5"), "#f0b849", "#00a32a", "#8c5e94"];
5277
+ const i = ot(() => {
5278
+ const o = [Jo("--color-primary", "#4F46E5"), "#f0b849", "#00a32a", "#8c5e94"];
5245
5279
  return {
5246
5280
  ...$n,
5247
5281
  colors: o,
@@ -5259,7 +5293,7 @@ const Yo = (t, e = "") => {
5259
5293
  legendGlyphSize: 12
5260
5294
  };
5261
5295
  }, []);
5262
- return e ? /* @__PURE__ */ a(it, { message: e.message, details: e.details }) : /* @__PURE__ */ a("div", { className: "chart-block", children: /* @__PURE__ */ a("div", { className: "chart-container", children: /* @__PURE__ */ a(Fn, { theme: i, children: t }) }) });
5296
+ return e ? /* @__PURE__ */ a(rt, { message: e.message, details: e.details }) : /* @__PURE__ */ a("div", { className: "chart-block", children: /* @__PURE__ */ a("div", { className: "chart-container", children: /* @__PURE__ */ a(Fn, { theme: i, children: t }) }) });
5263
5297
  }, Mt = (t = 80, e = 6, i = 25, n) => Math.max(t, (n ?? 5) * e + i), Zt = (t) => {
5264
5298
  if (t instanceof Date)
5265
5299
  return t;
@@ -5316,7 +5350,7 @@ const Yo = (t, e = "") => {
5316
5350
  },
5317
5351
  ...t,
5318
5352
  bottom: Mt(120)
5319
- }), Ko = (t) => {
5353
+ }), qo = (t) => {
5320
5354
  const {
5321
5355
  data: e,
5322
5356
  currency: i,
@@ -5329,21 +5363,21 @@ const Yo = (t, e = "") => {
5329
5363
  maxLabelLength: g = 15,
5330
5364
  error: d,
5331
5365
  ...u
5332
- } = t, h = (_, k) => !l || _.length <= k ? _ : _.substring(0, k - 3) + "...", M = () => {
5366
+ } = t, h = (T, M) => !l || T.length <= M ? T : T.substring(0, M - 3) + "...", A = () => {
5333
5367
  if (s === "item-comparison" && e && e.length > 0) {
5334
- let _ = "";
5335
- return e.forEach((k) => {
5336
- k != null && k.data && k.data.forEach((D) => {
5337
- const C = D.label || "", H = h(C, g);
5338
- H.length > _.length && (_ = H);
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);
5339
5373
  });
5340
- }), Mt(80, 6, 25, _.length);
5374
+ }), Mt(80, 6, 25, T.length);
5341
5375
  }
5342
5376
  return Mt();
5343
5377
  }, x = {
5344
5378
  ...yn(r),
5345
- bottom: M()
5346
- }, j = s === "item-comparison" ? {
5379
+ bottom: A()
5380
+ }, $ = s === "item-comparison" ? {
5347
5381
  xScale: {
5348
5382
  type: "band",
5349
5383
  padding: 0.2
@@ -5351,7 +5385,7 @@ const Yo = (t, e = "") => {
5351
5385
  axis: {
5352
5386
  x: {
5353
5387
  orientation: "bottom",
5354
- tickFormat: (_) => h(_, g),
5388
+ tickFormat: (T) => h(T, g),
5355
5389
  tickLabelProps: {
5356
5390
  fontSize: 11,
5357
5391
  textAnchor: "end",
@@ -5369,7 +5403,7 @@ const Yo = (t, e = "") => {
5369
5403
  dy: -15
5370
5404
  }
5371
5405
  }
5372
- }, p = {
5406
+ }, f = {
5373
5407
  data: e,
5374
5408
  withTooltips: o,
5375
5409
  renderTooltip: c,
@@ -5381,13 +5415,13 @@ const Yo = (t, e = "") => {
5381
5415
  // TODO: Fix this inconsistency that seems to be in @automattic/charts
5382
5416
  // Item-comparison mode requires axis config wrapped in 'options' prop
5383
5417
  // Time-comparison mode requires axis config spread directly
5384
- ...s === "item-comparison" ? { options: j } : j,
5418
+ ...s === "item-comparison" ? { options: $ } : $,
5385
5419
  ...i && { currency: i },
5386
5420
  ...u
5387
5421
  };
5388
- return /* @__PURE__ */ a(fn, { error: d, children: /* @__PURE__ */ a(jn, { ...p }) });
5422
+ return /* @__PURE__ */ a(fn, { error: d, children: /* @__PURE__ */ a(jn, { ...f }) });
5389
5423
  };
5390
- class Jo extends Dn {
5424
+ class Xo extends Dn {
5391
5425
  constructor(e) {
5392
5426
  super(e), this.state = {
5393
5427
  hasError: !1,
@@ -5424,7 +5458,7 @@ class Jo extends Dn {
5424
5458
  if (this.state.hasError) {
5425
5459
  const i = ((e = this.state.error) == null ? void 0 : e.message) || "An error occurred while rendering the chart";
5426
5460
  return /* @__PURE__ */ a(
5427
- it,
5461
+ rt,
5428
5462
  {
5429
5463
  message: i,
5430
5464
  details: [
@@ -5438,7 +5472,7 @@ class Jo extends Dn {
5438
5472
  return this.props.children;
5439
5473
  }
5440
5474
  }
5441
- const qo = (t) => {
5475
+ const Qo = (t) => {
5442
5476
  const {
5443
5477
  data: e,
5444
5478
  currency: i,
@@ -5477,52 +5511,52 @@ const qo = (t) => {
5477
5511
  ...g
5478
5512
  };
5479
5513
  return /* @__PURE__ */ a(fn, { error: l, children: /* @__PURE__ */ a(Un, { ...u }) });
5480
- }, Xo = ({
5514
+ }, ec = ({
5481
5515
  data: t,
5482
5516
  className: e = "",
5483
5517
  config: i
5484
5518
  }) => {
5485
- const [n, o] = Z(null), [c, r] = Z(
5519
+ const [n, o] = Y(null), [c, r] = Y(
5486
5520
  null
5487
- ), [s, l] = Z(300), g = A(null), d = b(
5488
- (p) => {
5489
- var z;
5490
- const { tooltipData: _ } = p, k = (z = _ == null ? void 0 : _.nearestDatum) == null ? void 0 : z.datum;
5491
- if (!k)
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)
5492
5526
  return null;
5493
- const D = (S) => {
5527
+ const D = (I) => {
5494
5528
  if (c != null && c.currency) {
5495
- const { symbol: m, symbolPosition: V } = c.currency;
5496
- let G;
5497
- return S >= 1e6 ? G = `${(S / 1e6).toFixed(
5529
+ const { symbol: V, symbolPosition: m } = c.currency;
5530
+ let z;
5531
+ return I >= 1e6 ? z = `${(I / 1e6).toFixed(
5498
5532
  1
5499
- )}M` : S >= 1e3 ? G = `${(S / 1e3).toFixed(1)}K` : G = S.toLocaleString(), V === "right" ? `${G}${m}` : `${m}${G}`;
5533
+ )}M` : I >= 1e3 ? z = `${(I / 1e3).toFixed(1)}K` : z = I.toLocaleString(), m === "right" ? `${z}${V}` : `${V}${z}`;
5500
5534
  }
5501
- return S >= 1e6 ? `${(S / 1e6).toFixed(1)}M` : S >= 1e3 ? `${(S / 1e3).toFixed(1)}K` : S.toLocaleString();
5502
- }, C = (S) => {
5503
- const V = Math.floor(
5504
- ((/* @__PURE__ */ new Date()).getTime() - S.getTime()) / (1e3 * 60 * 60 * 24)
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)
5505
5539
  );
5506
- return V === 0 ? E("Today", "a8c-agenttic") : V === 1 ? E("Yesterday", "a8c-agenttic") : V < 7 ? Fe(
5540
+ return m === 0 ? E("Today", "a8c-agenttic") : m === 1 ? E("Yesterday", "a8c-agenttic") : m < 7 ? je(
5507
5541
  /* translators: %d: number of days */
5508
5542
  E("%d days ago", "a8c-agenttic"),
5509
- V
5510
- ) : S.toLocaleDateString("en-US", {
5543
+ m
5544
+ ) : I.toLocaleDateString("en-US", {
5511
5545
  year: "numeric",
5512
5546
  month: "short",
5513
5547
  day: "numeric"
5514
5548
  });
5515
- }, H = k.label, Y = Object.entries(
5516
- (_ == null ? void 0 : _.datumByKey) || {}
5517
- ).map(([S, m]) => {
5518
- const V = m.datum;
5549
+ }, j = M.label, K = Object.entries(
5550
+ (T == null ? void 0 : T.datumByKey) || {}
5551
+ ).map(([I, V]) => {
5552
+ const m = V.datum;
5519
5553
  return {
5520
- key: S,
5521
- value: V.value
5554
+ key: I,
5555
+ value: m.value
5522
5556
  };
5523
- }).sort((S, m) => m.value - S.value);
5524
- return /* @__PURE__ */ w("div", { children: [
5525
- H && /* @__PURE__ */ a(
5557
+ }).sort((I, V) => V.value - I.value);
5558
+ return /* @__PURE__ */ C("div", { children: [
5559
+ j && /* @__PURE__ */ a(
5526
5560
  "div",
5527
5561
  {
5528
5562
  style: {
@@ -5533,10 +5567,10 @@ const qo = (t) => {
5533
5567
  borderBottom: "1px solid #eee",
5534
5568
  paddingBottom: "2px"
5535
5569
  },
5536
- children: H
5570
+ children: j
5537
5571
  }
5538
5572
  ),
5539
- k.date && /* @__PURE__ */ a(
5573
+ M.date && /* @__PURE__ */ a(
5540
5574
  "div",
5541
5575
  {
5542
5576
  style: {
@@ -5544,29 +5578,29 @@ const qo = (t) => {
5544
5578
  opacity: 0.8,
5545
5579
  marginBottom: "4px"
5546
5580
  },
5547
- children: C(k.date)
5581
+ children: _(M.date)
5548
5582
  }
5549
5583
  ),
5550
- Y.map((S) => /* @__PURE__ */ w(
5584
+ K.map((I) => /* @__PURE__ */ C(
5551
5585
  "div",
5552
5586
  {
5553
5587
  style: { marginBottom: "2px" },
5554
5588
  children: [
5555
- /* @__PURE__ */ w("strong", { children: [
5556
- S.key,
5589
+ /* @__PURE__ */ C("strong", { children: [
5590
+ I.key,
5557
5591
  ":"
5558
5592
  ] }),
5559
5593
  " ",
5560
- D(S.value)
5594
+ D(I.value)
5561
5595
  ]
5562
5596
  },
5563
- S.key
5597
+ I.key
5564
5598
  ))
5565
5599
  ] });
5566
5600
  },
5567
5601
  [c == null ? void 0 : c.currency]
5568
5602
  );
5569
- O(() => {
5603
+ L(() => {
5570
5604
  if (o(null), r(null), !t || typeof t != "string") {
5571
5605
  o({
5572
5606
  message: E("Invalid chart data provided", "a8c-agenttic"),
@@ -5575,8 +5609,8 @@ const qo = (t) => {
5575
5609
  return;
5576
5610
  }
5577
5611
  try {
5578
- const p = JSON.parse(t.trim());
5579
- if (!p.chartType) {
5612
+ const f = JSON.parse(t.trim());
5613
+ if (!f.chartType) {
5580
5614
  o({
5581
5615
  message: E(
5582
5616
  "Chart data must include chartType",
@@ -5586,7 +5620,7 @@ const qo = (t) => {
5586
5620
  });
5587
5621
  return;
5588
5622
  }
5589
- if (!p.data || !Array.isArray(p.data)) {
5623
+ if (!f.data || !Array.isArray(f.data)) {
5590
5624
  o({
5591
5625
  message: E(
5592
5626
  "Chart data must include a data array",
@@ -5596,7 +5630,7 @@ const qo = (t) => {
5596
5630
  });
5597
5631
  return;
5598
5632
  }
5599
- if (p.data.length === 0) {
5633
+ if (f.data.length === 0) {
5600
5634
  o({
5601
5635
  message: E(
5602
5636
  "No data points found for chart",
@@ -5606,37 +5640,37 @@ const qo = (t) => {
5606
5640
  });
5607
5641
  return;
5608
5642
  }
5609
- const _ = p.data.map((D) => ({
5643
+ const T = f.data.map((D) => ({
5610
5644
  ...D,
5611
- data: D.data.map((C) => {
5612
- if (C.date) {
5613
- const H = new Date(C.date);
5614
- return isNaN(H.getTime()) ? (console.warn(
5615
- `Invalid date string: "${C.date}" in series "${D.label}"`
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}"`
5616
5650
  ), {
5617
- label: C.label,
5618
- value: C.value,
5651
+ label: _.label,
5652
+ value: _.value,
5619
5653
  date: void 0
5620
5654
  }) : {
5621
- label: C.label,
5622
- value: C.value,
5623
- date: H
5655
+ label: _.label,
5656
+ value: _.value,
5657
+ date: j
5624
5658
  };
5625
5659
  }
5626
5660
  return {
5627
- label: C.label,
5628
- value: C.value,
5661
+ label: _.label,
5662
+ value: _.value,
5629
5663
  date: void 0
5630
5664
  };
5631
5665
  })
5632
- })), k = {
5633
- chartType: p.chartType,
5634
- title: p.title,
5635
- data: _,
5636
- currency: p.currency,
5637
- mode: p.mode || "time-comparison"
5666
+ })), M = {
5667
+ chartType: f.chartType,
5668
+ title: f.title,
5669
+ data: T,
5670
+ currency: f.currency,
5671
+ mode: f.mode || "time-comparison"
5638
5672
  };
5639
- r(k);
5673
+ r(M);
5640
5674
  } catch {
5641
5675
  o({
5642
5676
  message: E(
@@ -5647,48 +5681,48 @@ const qo = (t) => {
5647
5681
  });
5648
5682
  }
5649
5683
  }, [t]);
5650
- const u = b((p) => {
5651
- if (g.current && g.current.disconnect(), p) {
5652
- const { width: _ } = p.getBoundingClientRect(), k = Math.max(280, _ - 4);
5653
- l(k), g.current = new ResizeObserver((D) => {
5654
- for (const C of D) {
5655
- const H = C.contentRect.width, Y = Math.max(
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(
5656
5690
  280,
5657
- H - 4
5691
+ j - 4
5658
5692
  );
5659
- l(Y);
5693
+ l(K);
5660
5694
  }
5661
- }), g.current.observe(p);
5695
+ }), g.current.observe(f);
5662
5696
  }
5663
5697
  }, []);
5664
- if (O(() => () => {
5698
+ if (L(() => () => {
5665
5699
  g.current && (g.current.disconnect(), g.current = null);
5666
5700
  }, []), n)
5667
- return /* @__PURE__ */ a(it, { message: n.message, details: n.details });
5701
+ return /* @__PURE__ */ a(rt, { message: n.message, details: n.details });
5668
5702
  if (!c)
5669
5703
  return /* @__PURE__ */ a(
5670
- it,
5704
+ rt,
5671
5705
  {
5672
5706
  message: E("No chart data available", "a8c-agenttic")
5673
5707
  }
5674
5708
  );
5675
- const M = c.data.length > 1, x = s, N = {
5709
+ const A = c.data.length > 1, x = s, N = {
5676
5710
  data: c.data,
5677
5711
  currency: c.currency,
5678
- showLegend: M,
5712
+ showLegend: A,
5679
5713
  withTooltips: !0,
5680
5714
  renderTooltip: d,
5681
5715
  error: null,
5682
5716
  maxWidth: x,
5683
5717
  aspectRatio: 1.2,
5684
5718
  resizeDebounceTime: 300
5685
- }, j = () => {
5719
+ }, $ = () => {
5686
5720
  switch (c.chartType) {
5687
5721
  case "line":
5688
- return /* @__PURE__ */ a(qo, { ...N });
5722
+ return /* @__PURE__ */ a(Qo, { ...N });
5689
5723
  case "bar":
5690
5724
  return /* @__PURE__ */ a(
5691
- Ko,
5725
+ qo,
5692
5726
  {
5693
5727
  ...N,
5694
5728
  mode: c.mode
@@ -5696,9 +5730,9 @@ const qo = (t) => {
5696
5730
  );
5697
5731
  default:
5698
5732
  return /* @__PURE__ */ a(
5699
- it,
5733
+ rt,
5700
5734
  {
5701
- message: Fe(
5735
+ message: je(
5702
5736
  /* translators: %s: chart type name */
5703
5737
  E("Unsupported chart type: %s", "a8c-agenttic"),
5704
5738
  c.chartType
@@ -5707,48 +5741,48 @@ const qo = (t) => {
5707
5741
  );
5708
5742
  }
5709
5743
  };
5710
- return /* @__PURE__ */ a(Jo, { chartData: t, children: /* @__PURE__ */ w(
5744
+ return /* @__PURE__ */ a(Xo, { chartData: t, children: /* @__PURE__ */ C(
5711
5745
  "div",
5712
5746
  {
5713
5747
  ref: u,
5714
5748
  className: `chart-block ${e}`,
5715
5749
  children: [
5716
5750
  c.title && /* @__PURE__ */ a("h3", { className: "chart-block-title", children: c.title }),
5717
- /* @__PURE__ */ a("div", { className: "chart-container", children: j() })
5751
+ /* @__PURE__ */ a("div", { className: "chart-container", children: $() })
5718
5752
  ]
5719
5753
  }
5720
5754
  ) });
5721
5755
  };
5722
- function Qo(t) {
5756
+ function tc(t) {
5723
5757
  return function(i) {
5724
5758
  const { children: n, className: o, ...c } = i;
5725
5759
  if (!(o == null ? void 0 : o.includes("language-chart")))
5726
- return ae.createElement(
5760
+ return ne.createElement(
5727
5761
  "code",
5728
5762
  { className: o, ...c },
5729
5763
  n
5730
5764
  );
5731
5765
  const s = typeof n == "string" ? n : "";
5732
- return ae.createElement(Xo, {
5766
+ return ne.createElement(ec, {
5733
5767
  data: s,
5734
5768
  className: "markdown-chart",
5735
5769
  config: t
5736
5770
  });
5737
5771
  };
5738
5772
  }
5739
- function ec(t) {
5773
+ function ac(t) {
5740
5774
  var n, o;
5741
5775
  const e = {}, i = [];
5742
- return (n = t == null ? void 0 : t.charts) != null && n.enabled && (e.code = Qo(t.charts.config)), (o = t == null ? void 0 : t.gfm) != null && o.enabled && i.push(Pn), { components: e, remarkPlugins: i };
5776
+ return (n = t == null ? void 0 : t.charts) != null && n.enabled && (e.code = tc(t.charts.config)), (o = t == null ? void 0 : t.gfm) != null && o.enabled && i.push(Pn), { components: e, remarkPlugins: i };
5743
5777
  }
5744
- function tc(t, e = {}) {
5778
+ function nc(t, e = {}) {
5745
5779
  return {
5746
5780
  ...t,
5747
5781
  ...e
5748
5782
  };
5749
5783
  }
5750
5784
  let gt = null, mt = null;
5751
- async function ac() {
5785
+ async function ic() {
5752
5786
  return gt || mt || (mt = Promise.all([
5753
5787
  import("./parseIncompleteMarkdown-Di9Hun9H.js"),
5754
5788
  import("./parseBlocks-CiOUXvxi.js")
@@ -5757,20 +5791,20 @@ async function ac() {
5757
5791
  parseMarkdownIntoBlocks: e.parseMarkdownIntoBlocks
5758
5792
  }, gt)), mt);
5759
5793
  }
5760
- function xc(t = {}) {
5794
+ function Ec(t = {}) {
5761
5795
  const {
5762
5796
  components: e = {},
5763
5797
  extensions: i = {},
5764
5798
  remarkPlugins: n = [],
5765
5799
  enableStreaming: o = !1
5766
- } = t, c = ec(i), r = tc(
5800
+ } = t, c = ac(i), r = nc(
5767
5801
  c.components,
5768
5802
  e
5769
5803
  ), s = [...c.remarkPlugins, ...n];
5770
5804
  return function({ children: g }) {
5771
- const [d, u] = ae.useState(g);
5772
- return ae.useEffect(() => {
5773
- o ? ac().then(async (h) => {
5805
+ const [d, u] = ne.useState(g);
5806
+ return ne.useEffect(() => {
5807
+ o ? ic().then(async (h) => {
5774
5808
  const x = (await h.parseMarkdownIntoBlocks(g)).map((N) => h.parseIncompleteMarkdown(
5775
5809
  N.trim()
5776
5810
  )).join(`
@@ -5790,7 +5824,7 @@ function xc(t = {}) {
5790
5824
  );
5791
5825
  };
5792
5826
  }
5793
- const Dc = (t) => {
5827
+ const Rc = (t) => {
5794
5828
  const e = t.condition || (() => !0), i = {}, n = [], o = () => {
5795
5829
  n.forEach((r) => r());
5796
5830
  }, c = async (r, s) => {
@@ -5843,64 +5877,64 @@ const Dc = (t) => {
5843
5877
  };
5844
5878
  };
5845
5879
  export {
5846
- fc as AgentUI,
5880
+ yc as AgentUI,
5847
5881
  on as AgentUIContainer,
5848
5882
  xt as AgentUIConversationView,
5849
5883
  hn as AgentUIFooter,
5850
5884
  St as AgentUIHeader,
5851
5885
  un as AgentUIInput,
5852
- lo as AgentUIInputToolbar,
5886
+ go as AgentUIInputToolbar,
5853
5887
  dn as AgentUIMessages,
5854
5888
  pn as AgentUINotice,
5855
5889
  Vt as AgentUIProvider,
5856
5890
  gn as AgentUISuggestions,
5857
- Lc as AltIcon,
5891
+ xc as AltIcon,
5858
5892
  Ji as AnimatedPlaceholder,
5859
5893
  Bi as ArrowUpIcon,
5860
- kr as AssistantAvatarIcon,
5861
- Ko as BarChart,
5894
+ Ar as AssistantAvatarIcon,
5895
+ qo as BarChart,
5862
5896
  Lt as BigSkyIcon,
5863
- Nc as BlurIcon,
5864
- Xo as ChartBlock,
5865
- vc as Chat,
5866
- go as ChatFooter,
5897
+ Dc as BlurIcon,
5898
+ ec as ChartBlock,
5899
+ bc as Chat,
5900
+ po as ChatFooter,
5867
5901
  sn as ChatHeader,
5868
5902
  Nt as ChatInput,
5869
5903
  an as ChevronUpIcon,
5870
5904
  en as CollapsedView,
5871
5905
  nn as CompactView,
5872
5906
  Gt as ConversationView,
5873
- Ic as CopyIcon,
5874
- wc as EmptyView,
5875
- Cc as ImageRenderer,
5876
- yc as ImageUploader,
5877
- qo as LineChart,
5878
- Rr as Message,
5907
+ kc as CopyIcon,
5908
+ _c as EmptyView,
5909
+ Tc as ImageRenderer,
5910
+ wc as ImageUploader,
5911
+ Qo as LineChart,
5912
+ $r as Message,
5879
5913
  zt as MessageActions,
5880
- bc as MessageDivider,
5914
+ Cc as MessageDivider,
5881
5915
  ln as Messages,
5882
5916
  rn as MinimizedView,
5883
5917
  mn as Notice,
5884
- Vr as PlusIcon,
5885
- Pc as QuestionCard,
5886
- Oc as RegenerateAltIcon,
5887
- Ac as RegenerateIcon,
5918
+ zr as PlusIcon,
5919
+ Fc as QuestionCard,
5920
+ Nc as RegenerateAltIcon,
5921
+ Lc as RegenerateIcon,
5888
5922
  Hi as StopIcon,
5889
- Sc as StylesIcon,
5923
+ Mc as StylesIcon,
5890
5924
  vt as Suggestions,
5891
- Br as ThinkingMessage,
5892
- Tc as ThumbsDownIcon,
5893
- _c as ThumbsUpIcon,
5925
+ Vr as ThinkingMessage,
5926
+ Sc as ThumbsDownIcon,
5927
+ Ic as ThumbsUpIcon,
5894
5928
  cn as XIcon,
5895
- kc as ZoomIcon,
5896
- Mc as ZoomIconFilled,
5897
- hc as animations,
5898
- pe as cn,
5899
- Dc as createFeedbackActions,
5900
- xc as createMessageRenderer,
5901
- fc as default,
5929
+ Ac as ZoomIcon,
5930
+ Oc as ZoomIconFilled,
5931
+ vc as animations,
5932
+ de as cn,
5933
+ Rc as createFeedbackActions,
5934
+ Ec as createMessageRenderer,
5935
+ yc as default,
5902
5936
  _i as loadAgentticTranslations,
5903
- Oe as useAgentUIContext,
5937
+ Ne as useAgentUIContext,
5904
5938
  Za as useChat,
5905
5939
  Ya as useInput
5906
5940
  };