@automattic/agenttic-ui 0.1.71 → 0.1.72

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