@opencx/widget-react 4.0.57 → 4.0.58

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,12 +1,12 @@
1
1
  import { jsx as r, jsxs as d, Fragment as J } from "react/jsx-runtime";
2
2
  import * as me from "@radix-ui/react-popover";
3
3
  import * as ee from "react";
4
- import L, { memo as rr, forwardRef as yt, useState as R, cloneElement as kt, createContext as or, useEffect as se, useContext as nr, useRef as B, useCallback as G, useMemo as Ct, createElement as ct } from "react";
5
- import { useWidget as O, useConfig as N, useSessions as U, useMessages as A, useWidgetRouter as H, useDocumentDir as ke, useWidgetTrigger as Z, useModes as zt, useCsat as Nt, useUploadFiles as sr, useIsAwaitingBotReply as St, useContact as _t, WidgetProvider as ar, WidgetTriggerProvider as ir } from "@opencx/widget-react-headless";
4
+ import L, { memo as rr, forwardRef as yt, useState as P, cloneElement as kt, createContext as or, useEffect as se, useContext as nr, useRef as B, useCallback as G, useMemo as Ct, createElement as ct } from "react";
5
+ import { useWidget as O, useConfig as z, useSessions as U, useMessages as A, useWidgetRouter as H, useDocumentDir as ke, useWidgetTrigger as Z, useModes as zt, useCsat as Nt, useUploadFiles as sr, useIsAwaitingBotReply as St, useContact as _t, WidgetProvider as ar, WidgetTriggerProvider as ir } from "@opencx/widget-react-headless";
6
6
  import { X as lr, ZoomOut as cr, ZoomIn as dr, RotateCcw as pr, FileText as It, FileSpreadsheet as Tt, CircleDashedIcon as mr, XIcon as Ce, SquareXIcon as hr, SquareCheckBigIcon as gr, SquareCheckIcon as ur, ShrinkIcon as wr, Minimize2Icon as fr, MinimizeIcon as xr, Maximize2Icon as vr, MaximizeIcon as br, ExpandIcon as yr, CircleXIcon as kr, CircleCheckBigIcon as Cr, CircleCheckIcon as Mt, CheckCheckIcon as zr, CheckIcon as Nr, ChevronLeftIcon as Sr, LoaderIcon as _r, ArrowUpIcon as Dt, PaperclipIcon as dt, CircleDashed as Ir, AlertCircle as Tr, Loader2 as Mr, FileAudio2Icon as Dr, FileVideo2Icon as Er, FileIcon as Rr, UserRoundIcon as Pr, ChevronRightIcon as jr, SendHorizontal as Or, ChevronDownIcon as Ar } from "lucide-react";
7
7
  import { clsx as Fr } from "clsx";
8
8
  import { twMerge as Hr } from "tailwind-merge";
9
- import { motion as re, AnimatePresence as M } from "framer-motion";
9
+ import { motion as re, AnimatePresence as D } from "framer-motion";
10
10
  import { Slot as Wr } from "@radix-ui/react-slot";
11
11
  import { cva as Lr } from "class-variance-authority";
12
12
  import Et from "remark-gfm";
@@ -61,26 +61,26 @@ const Q = {
61
61
  }, Y = rr(
62
62
  yt(
63
63
  ({ children: e, className: o, scale: t = 1.02, off: n = !1 }, s) => {
64
- const [i, a] = R(!1), [l, c] = R({ x: 0, y: 0 });
64
+ const [i, a] = P(!1), [l, c] = P({ x: 0, y: 0 });
65
65
  if (n || /translate/.test(
66
66
  e.props.className || ""
67
67
  )) return e;
68
68
  const v = (x) => {
69
- var E, g;
70
- const { clientX: z, clientY: I } = x, y = x.currentTarget.getBoundingClientRect(), k = z - (y.left + y.width / 2), D = I - (y.top + y.height / 2), j = Math.max(
69
+ var R, g;
70
+ const { clientX: C, clientY: T } = x, y = x.currentTarget.getBoundingClientRect(), N = C - (y.left + y.width / 2), _ = T - (y.top + y.height / 2), E = Math.max(
71
71
  -1,
72
- Math.min(1, k / (y.width / 2))
72
+ Math.min(1, N / (y.width / 2))
73
73
  ), w = Math.max(
74
74
  -1,
75
- Math.min(1, D / (y.height / 2))
76
- ), T = j * Q.x, P = w * Q.y;
77
- c({ x: T, y: P }), (g = (E = e.props).onMouseMove) == null || g.call(E, x);
75
+ Math.min(1, _ / (y.height / 2))
76
+ ), M = E * Q.x, j = w * Q.y;
77
+ c({ x: M, y: j }), (g = (R = e.props).onMouseMove) == null || g.call(R, x);
78
78
  }, b = () => {
79
- var x, z;
80
- a(!0), (z = (x = e.props).onMouseEnter) == null || z.call(x);
79
+ var x, C;
80
+ a(!0), (C = (x = e.props).onMouseEnter) == null || C.call(x);
81
81
  }, u = () => {
82
- var x, z;
83
- a(!1), c({ x: 0, y: 0 }), (z = (x = e.props).onMouseLeave) == null || z.call(x);
82
+ var x, C;
83
+ a(!1), c({ x: 0, y: 0 }), (C = (x = e.props).onMouseLeave) == null || C.call(x);
84
84
  }, h = {
85
85
  "--wobble-x": i ? `${l.x}px` : "0px",
86
86
  "--wobble-y": i ? `${l.y}px` : "0px",
@@ -129,7 +129,7 @@ const qr = 10, Vr = (e, o, t) => ({
129
129
  left: Gr,
130
130
  up: Zr,
131
131
  down: Kr
132
- }, C = yt(
132
+ }, k = yt(
133
133
  ({
134
134
  fadeIn: e = "down",
135
135
  distance: o = qr,
@@ -143,7 +143,7 @@ const qr = 10, Vr = (e, o, t) => ({
143
143
  return n && c.exit && typeof c.exit == "object" && !Array.isArray(c.exit) && (c.exit.transition = { duration: 0 }), /* @__PURE__ */ r(re.div, { ref: l, ...a, ...c, children: t });
144
144
  }
145
145
  );
146
- C.displayName = "MotionDiv";
146
+ k.displayName = "MotionDiv";
147
147
  const Jr = Lr(
148
148
  m(
149
149
  "inline-flex shrink-0 items-center justify-center gap-2",
@@ -197,7 +197,7 @@ const Jr = Lr(
197
197
  S.displayName = "Button";
198
198
  const Ot = or(null);
199
199
  function eo({ children: e }) {
200
- const [o, t] = R(!1), [n, s] = R(null), i = (l) => {
200
+ const [o, t] = P(!1), [n, s] = P(null), i = (l) => {
201
201
  s(l), t(!0);
202
202
  }, a = () => {
203
203
  t(!1), setTimeout(() => {
@@ -243,8 +243,8 @@ function to() {
243
243
  s
244
244
  );
245
245
  };
246
- }, []), /* @__PURE__ */ r(M, { mode: "wait", children: o && t && /* @__PURE__ */ r(
247
- C,
246
+ }, []), /* @__PURE__ */ r(D, { mode: "wait", children: o && t && /* @__PURE__ */ r(
247
+ k,
248
248
  {
249
249
  overrides: {
250
250
  initial: { y: 0 },
@@ -366,22 +366,22 @@ function $t({
366
366
  src: e,
367
367
  alt: o
368
368
  }) {
369
- const [t, n] = R(1), [s, i] = R({ x: 0, y: 0 }), [a, l] = R(!1), c = B({ x: 0, y: 0 }), p = B({ x: 0, y: 0 }), v = B(null), b = B(null), u = B(!1), h = (w) => Math.min(gt, Math.max(ht, w)), x = G(() => {
369
+ const [t, n] = P(1), [s, i] = P({ x: 0, y: 0 }), [a, l] = P(!1), c = B({ x: 0, y: 0 }), p = B({ x: 0, y: 0 }), v = B(null), b = B(null), u = B(!1), h = (w) => Math.min(gt, Math.max(ht, w)), x = G(() => {
370
370
  n(1), i({ x: 0, y: 0 });
371
- }, []), z = G(() => {
371
+ }, []), C = G(() => {
372
372
  n((w) => h(w + le));
373
- }, []), I = G(() => {
373
+ }, []), T = G(() => {
374
374
  n((w) => {
375
- const T = h(w - le);
376
- return T <= 1 && i({ x: 0, y: 0 }), T;
375
+ const M = h(w - le);
376
+ return M <= 1 && i({ x: 0, y: 0 }), M;
377
377
  });
378
378
  }, []);
379
379
  G((w) => {
380
380
  w.preventDefault(), w.stopPropagation();
381
- const T = w.deltaY > 0 ? -le : le;
382
- n((P) => {
383
- const E = h(P + T);
384
- return E <= 1 && i({ x: 0, y: 0 }), E;
381
+ const M = w.deltaY > 0 ? -le : le;
382
+ n((j) => {
383
+ const R = h(j + M);
384
+ return R <= 1 && i({ x: 0, y: 0 }), R;
385
385
  });
386
386
  }, []);
387
387
  const y = G(
@@ -389,24 +389,24 @@ function $t({
389
389
  w.preventDefault(), u.current = !1, l(!0), c.current = { x: w.clientX, y: w.clientY }, p.current = { ...s }, w.target.setPointerCapture(w.pointerId);
390
390
  },
391
391
  [s]
392
- ), k = G(
392
+ ), N = G(
393
393
  (w) => {
394
394
  if (!a) return;
395
- const T = w.clientX - c.current.x, P = w.clientY - c.current.y;
396
- if ((Math.abs(T) > 3 || Math.abs(P) > 3) && (u.current = !0), t <= 1) return;
397
- const E = {
398
- x: p.current.x + T / t,
399
- y: p.current.y + P / t
395
+ const M = w.clientX - c.current.x, j = w.clientY - c.current.y;
396
+ if ((Math.abs(M) > 3 || Math.abs(j) > 3) && (u.current = !0), t <= 1) return;
397
+ const R = {
398
+ x: p.current.x + M / t,
399
+ y: p.current.y + j / t
400
400
  };
401
401
  i(
402
- oo(E, t, v.current, b.current)
402
+ oo(R, t, v.current, b.current)
403
403
  );
404
404
  },
405
405
  [a, t]
406
- ), D = G(() => {
406
+ ), _ = G(() => {
407
407
  const w = u.current;
408
- l(!1), !w && n((T) => T > 1 ? (i({ x: 0, y: 0 }), 1) : ro);
409
- }, []), j = t > 1;
408
+ l(!1), !w && n((M) => M > 1 ? (i({ x: 0, y: 0 }), 1) : ro);
409
+ }, []), E = t > 1;
410
410
  return /* @__PURE__ */ d(
411
411
  "div",
412
412
  {
@@ -419,14 +419,14 @@ function $t({
419
419
  ref: v,
420
420
  className: m(
421
421
  "overflow-hidden max-h-full max-w-full rounded-2xl flex items-center justify-center",
422
- j && "size-full"
422
+ E && "size-full"
423
423
  ),
424
424
  onPointerDown: y,
425
- onPointerMove: k,
426
- onPointerUp: D,
427
- onPointerCancel: D,
425
+ onPointerMove: N,
426
+ onPointerUp: _,
427
+ onPointerCancel: _,
428
428
  style: {
429
- cursor: a ? "grabbing" : j ? "grab" : "zoom-in",
429
+ cursor: a ? "grabbing" : E ? "grab" : "zoom-in",
430
430
  touchAction: "none"
431
431
  },
432
432
  children: /* @__PURE__ */ r(
@@ -448,13 +448,13 @@ function $t({
448
448
  }
449
449
  ),
450
450
  /* @__PURE__ */ d("div", { className: "absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1 bg-black/60 backdrop-blur-sm rounded-full px-1.5 py-1 transition opacity-50 hover:opacity-100", children: [
451
- /* @__PURE__ */ r(we, { onClick: I, label: "Zoom out", disabled: t <= ht, children: /* @__PURE__ */ r(cr, { className: "size-3.5" }) }),
451
+ /* @__PURE__ */ r(we, { onClick: T, label: "Zoom out", disabled: t <= ht, children: /* @__PURE__ */ r(cr, { className: "size-3.5" }) }),
452
452
  /* @__PURE__ */ d("span", { className: "text-white text-xs font-medium min-w-[3ch] text-center tabular-nums", children: [
453
453
  Math.round(t * 100),
454
454
  "%"
455
455
  ] }),
456
- /* @__PURE__ */ r(we, { onClick: z, label: "Zoom in", disabled: t >= gt, children: /* @__PURE__ */ r(dr, { className: "size-3.5" }) }),
457
- j && /* @__PURE__ */ d(J, { children: [
456
+ /* @__PURE__ */ r(we, { onClick: C, label: "Zoom in", disabled: t >= gt, children: /* @__PURE__ */ r(dr, { className: "size-3.5" }) }),
457
+ E && /* @__PURE__ */ d(J, { children: [
458
458
  /* @__PURE__ */ r("div", { className: "w-px h-4 bg-white/30 mx-0.5" }),
459
459
  /* @__PURE__ */ r(we, { onClick: x, label: "Reset zoom", children: /* @__PURE__ */ r(pr, { className: "size-3.5" }) })
460
460
  ] })
@@ -610,7 +610,7 @@ function Se({
610
610
  messageType: o,
611
611
  messageId: t
612
612
  }) {
613
- const { anchorTarget: n } = N();
613
+ const { anchorTarget: n } = z();
614
614
  return /* @__PURE__ */ r(
615
615
  Yt,
616
616
  {
@@ -652,7 +652,7 @@ function X() {
652
652
  widgetCtx: { org: e }
653
653
  } = O(), {
654
654
  sessionState: { session: o }
655
- } = U(), t = N(), {
655
+ } = U(), t = z(), {
656
656
  messagesState: { messages: n }
657
657
  } = A(), {
658
658
  routerState: { screen: s }
@@ -778,8 +778,8 @@ function ve({
778
778
  ] });
779
779
  }
780
780
  function ao({ agent: e }) {
781
- return /* @__PURE__ */ r(M, { children: /* @__PURE__ */ d(
782
- C,
781
+ return /* @__PURE__ */ r(D, { children: /* @__PURE__ */ d(
782
+ k,
783
783
  {
784
784
  ...f("chat/bot_loading/root"),
785
785
  className: "flex flex-row items-end w-full gap-2 animate-pulse",
@@ -823,7 +823,7 @@ function oe({
823
823
  side: t,
824
824
  align: n
825
825
  }) {
826
- const { disableTooltips: s } = N();
826
+ const { disableTooltips: s } = z();
827
827
  return !o || s ? e : /* @__PURE__ */ d(lo, { children: [
828
828
  /* @__PURE__ */ r(co, { asChild: !0, children: e }),
829
829
  /* @__PURE__ */ r(
@@ -855,17 +855,17 @@ const ce = {
855
855
  transitionDuration: "1000ms"
856
856
  };
857
857
  function K() {
858
- var b, u, h, x, z, I, y, k, D, j, w, T, P, E, g, _, ie, Re, Pe, je, Oe, Ae, Fe, He, We, Le, $e, Be, Ye, Ue, Xe, qe, Ve, Ge, Ze, Ke, Qe, Je, et, tt, rt, ot, nt, st, at, it, lt;
859
- const { dir: e } = ke(), { isSmallScreen: o } = $(), { theme: t, inline: n } = N(), s = (q) => n ? "100%" : q, i = (q, ge) => o ? `100dv${q}` : ge, a = (q, ge) => s(i(q, ge)), l = {
858
+ var b, u, h, x, C, T, y, N, _, E, w, M, j, R, g, I, ie, Re, Pe, je, Oe, Ae, Fe, He, We, Le, $e, Be, Ye, Ue, Xe, qe, Ve, Ge, Ze, Ke, Qe, Je, et, tt, rt, ot, nt, st, at, it, lt;
859
+ const { dir: e } = ke(), { isSmallScreen: o } = $(), { theme: t, inline: n } = z(), s = (q) => n ? "100%" : q, i = (q, ge) => o ? `100dv${q}` : ge, a = (q, ge) => s(i(q, ge)), l = {
860
860
  zIndex: ((b = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : b.zIndex) ?? 1e7,
861
861
  offset: {
862
862
  bottom: ((h = (u = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : u.offset) == null ? void 0 : h.bottom) ?? 20,
863
- right: ((z = (x = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : x.offset) == null ? void 0 : z.right) ?? (e === "ltr" ? 20 : "initial"),
864
- left: ((y = (I = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : I.offset) == null ? void 0 : y.left) ?? (e === "rtl" ? 20 : "initial")
863
+ right: ((C = (x = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : x.offset) == null ? void 0 : C.right) ?? (e === "ltr" ? 20 : "initial"),
864
+ left: ((y = (T = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : T.offset) == null ? void 0 : y.left) ?? (e === "rtl" ? 20 : "initial")
865
865
  },
866
866
  size: {
867
- button: ((D = (k = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : k.size) == null ? void 0 : D.button) ?? 48,
868
- icon: ((w = (j = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : j.size) == null ? void 0 : w.icon) ?? 24
867
+ button: ((_ = (N = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : N.size) == null ? void 0 : _.button) ?? 48,
868
+ icon: ((w = (E = t == null ? void 0 : t.widgetTrigger) == null ? void 0 : E.size) == null ? void 0 : w.icon) ?? 24
869
869
  }
870
870
  }, c = (() => {
871
871
  const q = e === "ltr" ? l.offset.right : l.offset.left;
@@ -875,12 +875,12 @@ function K() {
875
875
  primaryColor: (t == null ? void 0 : t.primaryColor) ?? "hsl(0 0% 9%)",
876
876
  widgetTrigger: l,
877
877
  widgetContentContainer: {
878
- borderRadius: o ? "0px" : ((T = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : T.borderRadius) ?? "32px",
879
- zIndex: ((P = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : P.zIndex) ?? l.zIndex + 1,
880
- outline: ((E = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : E.outline) ?? "none",
878
+ borderRadius: o ? "0px" : ((M = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : M.borderRadius) ?? "32px",
879
+ zIndex: ((j = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : j.zIndex) ?? l.zIndex + 1,
880
+ outline: ((R = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : R.outline) ?? "none",
881
881
  // was: '1px solid'
882
882
  outlineColor: ((g = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : g.outlineColor) ?? "hsl(0 0% 50% / .5)",
883
- boxShadow: ((_ = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : _.boxShadow) ?? "0 0px 100px 0px rgb(0 0 0 / 0.25)",
883
+ boxShadow: ((I = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : I.boxShadow) ?? "0 0px 100px 0px rgb(0 0 0 / 0.25)",
884
884
  transitionProperty: ((ie = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : ie.transitionProperty) ?? "all",
885
885
  transitionTimingFunction: ((Re = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : Re.transitionTimingFunction) ?? ce.transitionTimingFunction,
886
886
  transitionDuration: ((Pe = t == null ? void 0 : t.widgetContentContainer) == null ? void 0 : Pe.transitionDuration) ?? ce.transitionDuration,
@@ -1053,7 +1053,7 @@ function qt(e) {
1053
1053
  }
1054
1054
  }
1055
1055
  function Vt() {
1056
- const { contentIframeRef: e } = O(), { inline: o } = N();
1056
+ const { contentIframeRef: e } = O(), { inline: o } = z();
1057
1057
  return {
1058
1058
  setWidth: (t) => {
1059
1059
  var n;
@@ -1140,7 +1140,7 @@ function De() {
1140
1140
  widgetCtx: { org: e }
1141
1141
  } = O(), {
1142
1142
  routerState: { screen: o }
1143
- } = H(), { textContent: t } = N();
1143
+ } = H(), { textContent: t } = z();
1144
1144
  return (() => {
1145
1145
  var s, i;
1146
1146
  switch (o) {
@@ -1170,7 +1170,7 @@ function go(e) {
1170
1170
  }
1171
1171
  }
1172
1172
  function uo() {
1173
- const { router: e } = N(), {
1173
+ const { router: e } = z(), {
1174
1174
  routerState: { screen: o },
1175
1175
  toSessionsScreen: t
1176
1176
  } = H();
@@ -1206,7 +1206,7 @@ function wo({
1206
1206
  function be({
1207
1207
  button: e
1208
1208
  }) {
1209
- const [o, t] = R(!1), {
1209
+ const [o, t] = P(!1), {
1210
1210
  routerState: { screen: n }
1211
1211
  } = H(), { isSmallScreen: s } = $(), { theme: i } = K(), { setWidth: a, setHeight: l } = Vt(), c = X();
1212
1212
  if (n !== "chat" && n !== "sessions") return null;
@@ -1254,13 +1254,14 @@ function be({
1254
1254
  function Gt({
1255
1255
  button: e
1256
1256
  }) {
1257
- var I, y;
1258
- const { close: o } = he(), { widgetCtx: t } = O(), { setIsOpen: n } = Z(), { resolveSession: s, sessionState: i } = U(), { isSmallScreen: a } = $(), l = X(), c = !i.session, p = ((I = i.session) == null ? void 0 : I.isOpened) === !1, v = e.onResolved || "stay-in-chat", b = e.behaviorBeforeSessionCreation || "disabled", u = e.behaviorIfSessionIsResolved || "disabled", h = !!(i.isResolvingSession || c && b === "disabled" || p && u === "disabled"), x = async () => {
1259
- const { success: k, error: D } = await s();
1260
- if (o(), !k) return console.error(D);
1257
+ var T, y;
1258
+ const { close: o } = he(), { widgetCtx: t } = O(), { setIsOpen: n } = Z(), { resolveSession: s, sessionState: i } = U(), { isSmallScreen: a } = $(), l = X(), c = !i.session, p = ((T = i.session) == null ? void 0 : T.isOpened) === !1, v = e.onResolved || "stay-in-chat", b = e.behaviorBeforeSessionCreation || "disabled", u = e.behaviorIfSessionIsResolved || "disabled", h = !!(i.isResolvingSession || c && b === "disabled" || p && u === "disabled"), x = async () => {
1259
+ const { success: N, error: _ } = await s();
1260
+ if (o(), !N)
1261
+ return console.error(_), !1;
1261
1262
  switch (v) {
1262
1263
  case "stay-in-chat":
1263
- return;
1264
+ break;
1264
1265
  case "close-widget":
1265
1266
  n(!1);
1266
1267
  break;
@@ -1274,7 +1275,8 @@ function Gt({
1274
1275
  F(v, Gt.name);
1275
1276
  break;
1276
1277
  }
1277
- }, z = () => {
1278
+ return !0;
1279
+ }, C = () => {
1278
1280
  if (c)
1279
1281
  switch (b) {
1280
1282
  case "disabled":
@@ -1285,7 +1287,7 @@ function Gt({
1285
1287
  default:
1286
1288
  F(
1287
1289
  b,
1288
- z.name
1290
+ C.name
1289
1291
  );
1290
1292
  }
1291
1293
  if (p)
@@ -1306,7 +1308,7 @@ function Gt({
1306
1308
  default:
1307
1309
  F(
1308
1310
  u,
1309
- z.name
1311
+ C.name
1310
1312
  );
1311
1313
  }
1312
1314
  };
@@ -1321,8 +1323,8 @@ function Gt({
1321
1323
  className: "rounded-full",
1322
1324
  disabled: h,
1323
1325
  onClick: () => {
1324
- var k;
1325
- return (k = e.onClicked) == null ? void 0 : k.call(e, l);
1326
+ var N;
1327
+ return (N = e.onClicked) == null ? void 0 : N.call(e, l);
1326
1328
  },
1327
1329
  children: /* @__PURE__ */ r(ne, { name: e.icon })
1328
1330
  }
@@ -1344,9 +1346,9 @@ function Gt({
1344
1346
  S,
1345
1347
  {
1346
1348
  variant: "destructive",
1347
- onClick: () => {
1348
- var k, D;
1349
- x(), (D = (k = e.confirmation) == null ? void 0 : k.onConfirmed) == null || D.call(k, l);
1349
+ onClick: async () => {
1350
+ var _, E;
1351
+ await x() && ((E = (_ = e.confirmation) == null ? void 0 : _.onResolved) == null || E.call(_, l));
1350
1352
  },
1351
1353
  disabled: i.isResolvingSession,
1352
1354
  children: e.confirmation.confirmButtonText || "Yes"
@@ -1362,8 +1364,8 @@ function Gt({
1362
1364
  size: "fit",
1363
1365
  className: "rounded-full",
1364
1366
  onClick: () => {
1365
- var k;
1366
- p || c ? z() : x(), (k = e.onClicked) == null || k.call(e, l);
1367
+ var N;
1368
+ p || c ? C() : x(), (N = e.onClicked) == null || N.call(e, l);
1367
1369
  },
1368
1370
  disabled: h,
1369
1371
  children: /* @__PURE__ */ r(ne, { name: e.icon })
@@ -1390,7 +1392,7 @@ const fo = {
1390
1392
  function xo() {
1391
1393
  const {
1392
1394
  routerState: { screen: e }
1393
- } = H(), { headerButtons: o } = N(), t = e === "chat" ? o == null ? void 0 : o.chatScreen : e === "sessions" ? o == null ? void 0 : o.sessionsScreen : [];
1395
+ } = H(), { headerButtons: o } = z(), t = e === "chat" ? o == null ? void 0 : o.chatScreen : e === "sessions" ? o == null ? void 0 : o.sessionsScreen : [];
1394
1396
  return !t || t.length === 0 ? /* @__PURE__ */ r(ye, { button: fo }) : /* @__PURE__ */ r(J, { children: t.map((n) => /* @__PURE__ */ r(
1395
1397
  ye,
1396
1398
  {
@@ -1438,7 +1440,7 @@ function vo() {
1438
1440
  };
1439
1441
  }
1440
1442
  function bo() {
1441
- const e = X(), { activeMode: o, Component: t } = zt(), { sendMessage: n } = A(), { createStateCheckpoint: s } = U(), [i, a] = R(!1), l = async (c) => {
1443
+ const e = X(), { activeMode: o, Component: t } = zt(), { sendMessage: n } = A(), { createStateCheckpoint: s } = U(), [i, a] = P(!1), l = async (c) => {
1442
1444
  try {
1443
1445
  a(!0), await n(c);
1444
1446
  } catch (p) {
@@ -1459,7 +1461,7 @@ function bo() {
1459
1461
  );
1460
1462
  }
1461
1463
  function V() {
1462
- const { dir: e } = ke(), o = N();
1464
+ const { dir: e } = ke(), o = z();
1463
1465
  return Ct(() => {
1464
1466
  const t = Br(o.language) ? o.language : "en";
1465
1467
  return {
@@ -1474,7 +1476,7 @@ const W = L.forwardRef(
1474
1476
  (e, o) => {
1475
1477
  var t, n, s;
1476
1478
  return /* @__PURE__ */ r(
1477
- C,
1479
+ k,
1478
1480
  {
1479
1481
  ...e,
1480
1482
  ref: o,
@@ -1523,7 +1525,7 @@ function ko() {
1523
1525
  isCsatSubmitted: s,
1524
1526
  submittedScore: i,
1525
1527
  submittedFeedback: a
1526
- } = Nt(), [l, c] = R(null), [p, v] = R(null), b = (h) => {
1528
+ } = Nt(), [l, c] = P(null), [p, v] = P(null), b = (h) => {
1527
1529
  c((x) => x === h ? null : h);
1528
1530
  }, u = () => {
1529
1531
  l && t({
@@ -1532,7 +1534,7 @@ function ko() {
1532
1534
  });
1533
1535
  };
1534
1536
  return !n && !s ? null : /* @__PURE__ */ d("div", { className: "w-1/2 min-w-80 max-w-96 mx-auto overflow-hidden", children: [
1535
- /* @__PURE__ */ r(M, { mode: "wait", children: n && !l ? /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground text-center pt-2", children: o("csat_title") }) }, "csat-requested-title") : s ? /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground text-center pt-2", children: o("csat_submitted_title") }) }, "csat-submitted-title") : null }),
1537
+ /* @__PURE__ */ r(D, { mode: "wait", children: n && !l ? /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground text-center pt-2", children: o("csat_title") }) }, "csat-requested-title") : s ? /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground text-center pt-2", children: o("csat_submitted_title") }) }, "csat-submitted-title") : null }),
1536
1538
  /* @__PURE__ */ r(
1537
1539
  "div",
1538
1540
  {
@@ -1564,7 +1566,7 @@ function ko() {
1564
1566
  ))
1565
1567
  }
1566
1568
  ),
1567
- /* @__PURE__ */ r(M, { mode: "wait", children: (l || i) && /* @__PURE__ */ r(W, { children: /* @__PURE__ */ d("div", { className: "pb-2 px-2 flex items-end", children: [
1569
+ /* @__PURE__ */ r(D, { mode: "wait", children: (l || i) && /* @__PURE__ */ r(W, { children: /* @__PURE__ */ d("div", { className: "pb-2 px-2 flex items-end", children: [
1568
1570
  /* @__PURE__ */ r(
1569
1571
  "textarea",
1570
1572
  {
@@ -1648,14 +1650,14 @@ function Co() {
1648
1650
  );
1649
1651
  }
1650
1652
  function xt() {
1651
- const { sessionState: e } = U(), { chatFooterItems: o } = N(), t = !!e.session && !e.session.isOpened, n = !t;
1652
- return /* @__PURE__ */ r(M, { mode: "wait", children: o == null ? void 0 : o.map((s, i) => s.showWhenSessionIsOpen === !1 && n || s.showWhenSessionIsResolved === !1 && t ? null : /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r("div", { className: "pb-2 text-center text-xs", children: /* @__PURE__ */ r(Se, { children: s.message }) }) }, `${s.message}-${i}`)) });
1653
+ const { sessionState: e } = U(), { chatFooterItems: o } = z(), t = !!e.session && !e.session.isOpened, n = !t;
1654
+ return /* @__PURE__ */ r(D, { mode: "wait", children: o == null ? void 0 : o.map((s, i) => s.showWhenSessionIsOpen === !1 && n || s.showWhenSessionIsResolved === !1 && t ? null : /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r("div", { className: "pb-2 text-center text-xs", children: /* @__PURE__ */ r(Se, { children: s.message }) }) }, `${s.message}-${i}`)) });
1653
1655
  }
1654
1656
  function zo({
1655
1657
  file: { status: e, file: o, error: t },
1656
1658
  onCancel: n
1657
1659
  }) {
1658
- const [s, i] = R(
1660
+ const [s, i] = P(
1659
1661
  null
1660
1662
  );
1661
1663
  se(() => {
@@ -1723,38 +1725,38 @@ function zo({
1723
1725
  );
1724
1726
  }
1725
1727
  function No() {
1726
- var E;
1727
- const { isSmallScreen: e } = $(), o = B(null), { sendMessage: t } = A(), { sessionState: n } = U(), { disableSendingWhenAwaitingAIReply: s } = N(), { t: i } = V(), [a, l] = R(""), {
1728
+ var R;
1729
+ const { isSmallScreen: e } = $(), o = B(null), { sendMessage: t } = A(), { sessionState: n } = U(), { disableSendingWhenAwaitingAIReply: s } = z(), { t: i } = V(), [a, l] = P(""), {
1728
1730
  allFiles: c,
1729
1731
  emptyTheFiles: p,
1730
1732
  handleCancelUpload: v,
1731
1733
  appendFiles: b,
1732
1734
  isUploading: u,
1733
1735
  successFiles: h
1734
- } = sr(), x = !!((E = n.session) != null && E.isHandedOff), { isAwaitingBotReply: z } = St(), I = s !== !1 && z, y = (g) => {
1736
+ } = sr(), x = !!((R = n.session) != null && R.isHandedOff), { isAwaitingBotReply: C } = St(), T = s !== !1 && C, y = (g) => {
1735
1737
  b(g);
1736
- }, k = !a.trim() && h.length === 0, D = async () => {
1737
- if (I || k) return;
1738
+ }, N = !a.trim() && h.length === 0, _ = async () => {
1739
+ if (T || N) return;
1738
1740
  u && console.info("please wait for the file(s) to upload");
1739
1741
  const g = a.trim();
1740
1742
  t({
1741
1743
  content: g,
1742
1744
  attachments: h.flatMap(
1743
- (_) => _.fileUrl ? [
1745
+ (I) => I.fileUrl ? [
1744
1746
  {
1745
- url: _.fileUrl,
1746
- type: _.file.type,
1747
- name: _.file.name,
1748
- id: _.id,
1749
- size: _.file.size
1747
+ url: I.fileUrl,
1748
+ type: I.file.type,
1749
+ name: I.file.name,
1750
+ id: I.id,
1751
+ size: I.file.size
1750
1752
  }
1751
1753
  ] : []
1752
1754
  )
1753
1755
  }), l(""), p();
1754
1756
  }, {
1755
- getRootProps: j,
1757
+ getRootProps: E,
1756
1758
  getInputProps: w,
1757
- open: T
1759
+ open: M
1758
1760
  } = Ur({
1759
1761
  onDrop: y,
1760
1762
  noClick: !0,
@@ -1775,16 +1777,16 @@ function No() {
1775
1777
  "application/pdf": [".pdf"],
1776
1778
  ...mt
1777
1779
  }
1778
- }), P = (g) => {
1779
- const _ = g.clipboardData;
1780
- _ && _.files.length > 0 && y(Array.from(_.files));
1780
+ }), j = (g) => {
1781
+ const I = g.clipboardData;
1782
+ I && I.files.length > 0 && y(Array.from(I.files));
1781
1783
  };
1782
1784
  return /* @__PURE__ */ d(
1783
1785
  "div",
1784
1786
  {
1785
1787
  ...f("chat/input_box/root"),
1786
1788
  className: "p-2 relative space-y-1",
1787
- ...j(),
1789
+ ...E(),
1788
1790
  children: [
1789
1791
  /* @__PURE__ */ r("input", { ...w() }),
1790
1792
  /* @__PURE__ */ d(
@@ -1810,7 +1812,7 @@ function No() {
1810
1812
  {
1811
1813
  ...f("chat/input_box/attachments_container"),
1812
1814
  className: "flex items-center gap-1",
1813
- children: /* @__PURE__ */ r(M, { mode: "popLayout", children: c.map((g) => /* @__PURE__ */ r(C, { snapExit: !0, children: /* @__PURE__ */ r(
1815
+ children: /* @__PURE__ */ r(D, { mode: "popLayout", children: c.map((g) => /* @__PURE__ */ r(k, { snapExit: !0, children: /* @__PURE__ */ r(
1814
1816
  zo,
1815
1817
  {
1816
1818
  onCancel: () => v(g.id),
@@ -1823,7 +1825,7 @@ function No() {
1823
1825
  "textarea",
1824
1826
  {
1825
1827
  ...f("chat/input_box/textarea"),
1826
- onPaste: P,
1828
+ onPaste: j,
1827
1829
  ref: o,
1828
1830
  id: "chat-input",
1829
1831
  value: a,
@@ -1841,7 +1843,7 @@ function No() {
1841
1843
  ),
1842
1844
  onChange: (g) => l(g.target.value),
1843
1845
  onKeyDown: async (g) => {
1844
- g.key === "Enter" && !g.shiftKey && (g.preventDefault(), D());
1846
+ g.key === "Enter" && !g.shiftKey && (g.preventDefault(), _());
1845
1847
  },
1846
1848
  placeholder: i("write_a_message_placeholder")
1847
1849
  }
@@ -1859,13 +1861,13 @@ function No() {
1859
1861
  children: /* @__PURE__ */ r(
1860
1862
  S,
1861
1863
  {
1862
- onClick: T,
1864
+ onClick: M,
1863
1865
  size: "fit",
1864
1866
  variant: "ghost",
1865
1867
  className: m(
1866
1868
  "rounded-full size-8 flex items-center justify-center p-0 overflow-hidden"
1867
1869
  ),
1868
- children: /* @__PURE__ */ r(M, { mode: "wait", children: I ? /* @__PURE__ */ r(C, { children: /* @__PURE__ */ r(dt, { className: "size-4 opacity-50" }) }, "paper-clip-disabled") : /* @__PURE__ */ r(C, { children: /* @__PURE__ */ r(dt, { className: "size-4" }) }, "paper-clip") })
1870
+ children: /* @__PURE__ */ r(D, { mode: "wait", children: T ? /* @__PURE__ */ r(k, { children: /* @__PURE__ */ r(dt, { className: "size-4 opacity-50" }) }, "paper-clip-disabled") : /* @__PURE__ */ r(k, { children: /* @__PURE__ */ r(dt, { className: "size-4" }) }, "paper-clip") })
1869
1871
  }
1870
1872
  )
1871
1873
  }
@@ -1874,10 +1876,10 @@ function No() {
1874
1876
  S,
1875
1877
  {
1876
1878
  size: "fit",
1877
- onClick: D,
1878
- disabled: I || u || k,
1879
+ onClick: _,
1880
+ disabled: T || u || N,
1879
1881
  className: "rounded-full size-8 flex items-center justify-center p-0",
1880
- children: /* @__PURE__ */ r(M, { mode: "wait", children: I || u ? /* @__PURE__ */ r(C, { snapExit: !0, children: /* @__PURE__ */ r(Ir, { className: "size-4 animate-spin animate-iteration-infinite" }) }, "loading") : /* @__PURE__ */ r(C, { snapExit: !0, children: /* @__PURE__ */ r(Dt, { className: "size-4" }) }, "send") })
1882
+ children: /* @__PURE__ */ r(D, { mode: "wait", children: T || u ? /* @__PURE__ */ r(k, { snapExit: !0, children: /* @__PURE__ */ r(Ir, { className: "size-4 animate-spin animate-iteration-infinite" }) }, "loading") : /* @__PURE__ */ r(k, { snapExit: !0, children: /* @__PURE__ */ r(Dt, { className: "size-4" }) }, "send") })
1881
1883
  }
1882
1884
  ) })
1883
1885
  ] })
@@ -1889,14 +1891,14 @@ function No() {
1889
1891
  );
1890
1892
  }
1891
1893
  function vt() {
1892
- const { widgetCtx: e } = O(), { router: o } = N(), { canCreateNewSession: t } = U(), { toSessionsScreen: n } = H(), { t: s } = V();
1894
+ const { widgetCtx: e } = O(), { router: o } = z(), { canCreateNewSession: t } = U(), { toSessionsScreen: n } = H(), { t: s } = V();
1893
1895
  return /* @__PURE__ */ r(J, { children: t || o != null && o.chatScreenOnly ? /* @__PURE__ */ r(S, { onClick: e.resetChat, className: "rounded-2xl w-full", children: s("new_conversation") }) : /* @__PURE__ */ r(S, { onClick: n, className: "rounded-2xl w-full", children: s("back_to_conversations") }) });
1894
1896
  }
1895
1897
  function So() {
1896
1898
  const { t: e } = V(), { isCsatRequested: o, isCsatSubmitted: t } = Nt();
1897
- return /* @__PURE__ */ r("div", { className: "p-2", children: /* @__PURE__ */ r("div", { className: "p-2 bg-muted rounded-3xl", children: /* @__PURE__ */ r(M, { mode: "wait", children: o || t ? /* @__PURE__ */ d(W, { children: [
1899
+ return /* @__PURE__ */ r("div", { className: "p-2", children: /* @__PURE__ */ r("div", { className: "p-2 bg-muted rounded-3xl", children: /* @__PURE__ */ r(D, { mode: "wait", children: o || t ? /* @__PURE__ */ d(W, { children: [
1898
1900
  /* @__PURE__ */ r(ko, {}),
1899
- /* @__PURE__ */ r(M, { mode: "wait", children: t && /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(vt, {}) }, "new-conv-or-back-to-convs-button") })
1901
+ /* @__PURE__ */ r(D, { mode: "wait", children: t && /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(vt, {}) }, "new-conv-or-back-to-convs-button") })
1900
1902
  ] }, "csat") : /* @__PURE__ */ d(W, { children: [
1901
1903
  /* @__PURE__ */ d("div", { className: "ps-2 flex items-center gap-1 pb-2", children: [
1902
1904
  /* @__PURE__ */ r(Mt, { className: "size-4 text-emerald-600" }),
@@ -1907,8 +1909,8 @@ function So() {
1907
1909
  }
1908
1910
  function _o() {
1909
1911
  var a;
1910
- const { initialQuestions: e, initialQuestionsPosition: o, thisWasHelpfulOrNot: t } = N(), { sessionState: n } = U(), { messagesState: s } = A(), i = s.messages.length === 0;
1911
- return /* @__PURE__ */ r("footer", { children: /* @__PURE__ */ r(M, { mode: "wait", children: n.session && !((a = n.session) != null && a.isOpened) ? /* @__PURE__ */ d(W, { children: [
1912
+ const { initialQuestions: e, initialQuestionsPosition: o, thisWasHelpfulOrNot: t } = z(), { sessionState: n } = U(), { messagesState: s } = A(), i = s.messages.length === 0;
1913
+ return /* @__PURE__ */ r("footer", { children: /* @__PURE__ */ r(D, { mode: "wait", children: n.session && !((a = n.session) != null && a.isOpened) ? /* @__PURE__ */ d(W, { children: [
1912
1914
  /* @__PURE__ */ r(So, {}),
1913
1915
  /* @__PURE__ */ r(xt, {})
1914
1916
  ] }, "session-closed") : /* @__PURE__ */ d(W, { children: [
@@ -1972,7 +1974,7 @@ function Qt({
1972
1974
  containerClassName: t
1973
1975
  }) {
1974
1976
  var a, l;
1975
- const { timestamps: n } = N();
1977
+ const { timestamps: n } = z();
1976
1978
  if (!((a = n == null ? void 0 : n.perMessageGroup) != null && a.enabled))
1977
1979
  return null;
1978
1980
  const s = (l = e[e.length - 1]) == null ? void 0 : l.timestamp;
@@ -2166,7 +2168,7 @@ function Oo() {
2166
2168
  initialQuestionsPosition: t,
2167
2169
  initialQuestions: n,
2168
2170
  bot: s
2169
- } = N();
2171
+ } = z();
2170
2172
  return /* @__PURE__ */ r(J, { children: e.length === 0 && o.length > 0 && /* @__PURE__ */ r(
2171
2173
  pe,
2172
2174
  {
@@ -2187,7 +2189,7 @@ function Oo() {
2187
2189
  function Ao() {
2188
2190
  const {
2189
2191
  messagesState: { messages: e }
2190
- } = A(), { chatBannerItems: o } = N();
2192
+ } = A(), { chatBannerItems: o } = z();
2191
2193
  return !(o != null && o.length) || e.length > 0 && o.every((t) => !t.persistent) ? null : /* @__PURE__ */ r("div", { className: "w-full text-center text-xs", children: o.map(
2192
2194
  ({ message: t, persistent: n }, s) => e.length > 0 && !n ? null : /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Se, { children: t }) }, `${t}-${s}`)
2193
2195
  ) });
@@ -2195,7 +2197,7 @@ function Ao() {
2195
2197
  function Fo() {
2196
2198
  const {
2197
2199
  messagesState: { messages: e }
2198
- } = A(), o = N(), {
2200
+ } = A(), o = z(), {
2199
2201
  advancedInitialMessages: t = [],
2200
2202
  initialQuestions: n,
2201
2203
  initialQuestionsPosition: s
@@ -2228,7 +2230,7 @@ function Ho() {
2228
2230
  function Wo() {
2229
2231
  const {
2230
2232
  messagesState: { messages: e }
2231
- } = A(), { isAwaitingBotReply: o } = St(), { componentStore: t } = O(), { bot: n, humanAgent: s } = N(), i = Ct(
2233
+ } = A(), { isAwaitingBotReply: o } = St(), { componentStore: t } = O(), { bot: n, humanAgent: s } = z(), i = Ct(
2232
2234
  () => Eo(e),
2233
2235
  [e]
2234
2236
  ), a = t.getComponent(
@@ -2253,14 +2255,14 @@ function Wo() {
2253
2255
  /* @__PURE__ */ r(Oo, {}),
2254
2256
  /* @__PURE__ */ r(Fo, {}),
2255
2257
  i.map((p, v) => {
2256
- var h, x, z, I;
2258
+ var h, x, C, T;
2257
2259
  const b = (h = p == null ? void 0 : p[0]) == null ? void 0 : h.type, u = (x = p[0]) == null ? void 0 : x.id;
2258
2260
  if (!b || !u) return null;
2259
2261
  if (Ro(p))
2260
2262
  return /* @__PURE__ */ r(Do, { messages: p }, u);
2261
2263
  if (Po(p)) {
2262
2264
  const y = v === i.length - 1;
2263
- return o && y ? null : ((z = p[0]) == null || z.agent, /* @__PURE__ */ r(
2265
+ return o && y ? null : ((C = p[0]) == null || C.agent, /* @__PURE__ */ r(
2264
2266
  pe,
2265
2267
  {
2266
2268
  messages: p,
@@ -2270,7 +2272,7 @@ function Wo() {
2270
2272
  ));
2271
2273
  }
2272
2274
  if (jo(p)) {
2273
- const y = (I = p[0]) == null ? void 0 : I.agent;
2275
+ const y = (T = p[0]) == null ? void 0 : T.agent;
2274
2276
  return /* @__PURE__ */ r(
2275
2277
  pe,
2276
2278
  {
@@ -2326,15 +2328,15 @@ function Lo() {
2326
2328
  },
2327
2329
  children: /* @__PURE__ */ d("div", { className: "size-full justify-between flex flex-col", children: [
2328
2330
  /* @__PURE__ */ r(Zt, {}),
2329
- /* @__PURE__ */ r(M, { mode: "wait", children: e ? /* @__PURE__ */ r(
2330
- C,
2331
+ /* @__PURE__ */ r(D, { mode: "wait", children: e ? /* @__PURE__ */ r(
2332
+ k,
2331
2333
  {
2332
2334
  className: "flex flex-col items-center justify-center w-full flex-1",
2333
2335
  children: /* @__PURE__ */ r(Kt, {})
2334
2336
  },
2335
2337
  "loading"
2336
2338
  ) : /* @__PURE__ */ d(
2337
- C,
2339
+ k,
2338
2340
  {
2339
2341
  className: "flex items-start h-full flex-1 overflow-auto",
2340
2342
  snapExit: !0,
@@ -2413,7 +2415,7 @@ function Bo({ className: e }) {
2413
2415
  );
2414
2416
  }
2415
2417
  function Jt({ className: e }) {
2416
- const { token: o } = N();
2418
+ const { token: o } = z();
2417
2419
  return /* @__PURE__ */ r(
2418
2420
  "div",
2419
2421
  {
@@ -2452,7 +2454,7 @@ function bt({
2452
2454
  session: e,
2453
2455
  className: o
2454
2456
  }) {
2455
- const { bot: t, humanAgent: n } = N(), { toChatScreen: s } = H(), i = e.assignee.kind === "human" ? (n == null ? void 0 : n.name) || e.assignee.name || "Support Agent" : (t == null ? void 0 : t.name) || "AI Support Agent", a = e.assignee.kind === "human" ? (n == null ? void 0 : n.avatarUrl) || e.assignee.avatarUrl || "" : (t == null ? void 0 : t.avatarUrl) || (t == null ? void 0 : t.avatar) || "";
2457
+ const { bot: t, humanAgent: n } = z(), { toChatScreen: s } = H(), i = e.assignee.kind === "human" ? (n == null ? void 0 : n.name) || e.assignee.name || "Support Agent" : (t == null ? void 0 : t.name) || "AI Support Agent", a = e.assignee.kind === "human" ? (n == null ? void 0 : n.avatarUrl) || e.assignee.avatarUrl || "" : (t == null ? void 0 : t.avatarUrl) || (t == null ? void 0 : t.avatar) || "";
2456
2458
  return /* @__PURE__ */ d(
2457
2459
  S,
2458
2460
  {
@@ -2465,13 +2467,13 @@ function bt({
2465
2467
  onClick: () => s(e.id),
2466
2468
  children: [
2467
2469
  /* @__PURE__ */ d("div", { className: "flex-1 flex gap-2 items-center", children: [
2468
- /* @__PURE__ */ r(M, { mode: "wait", children: /* @__PURE__ */ r(C, { snapExit: !0, children: /* @__PURE__ */ d(_e, { className: "size-10", children: [
2470
+ /* @__PURE__ */ r(D, { mode: "wait", children: /* @__PURE__ */ r(k, { snapExit: !0, children: /* @__PURE__ */ d(_e, { className: "size-10", children: [
2469
2471
  /* @__PURE__ */ r(Ie, { src: a, alt: "Agent Icon" }),
2470
2472
  /* @__PURE__ */ r(Te, { children: /* @__PURE__ */ r(Pr, { className: "size-4" }) })
2471
2473
  ] }) }) }),
2472
2474
  /* @__PURE__ */ d("div", { className: "flex-1", children: [
2473
- /* @__PURE__ */ r(M, { mode: "wait", children: /* @__PURE__ */ r(C, { snapExit: !0, children: i }, i) }),
2474
- /* @__PURE__ */ r(M, { mode: "wait", children: e.lastMessage ? /* @__PURE__ */ r(C, { snapExit: !0, children: /* @__PURE__ */ r(
2475
+ /* @__PURE__ */ r(D, { mode: "wait", children: /* @__PURE__ */ r(k, { snapExit: !0, children: i }, i) }),
2476
+ /* @__PURE__ */ r(D, { mode: "wait", children: e.lastMessage ? /* @__PURE__ */ r(k, { snapExit: !0, children: /* @__PURE__ */ r(
2475
2477
  Yt,
2476
2478
  {
2477
2479
  remarkPlugins: [Et],
@@ -2479,7 +2481,7 @@ function bt({
2479
2481
  className: "line-clamp-1 overflow-hidden text-ellipsis text-xs text-muted-foreground",
2480
2482
  children: e.lastMessage
2481
2483
  }
2482
- ) }, e.lastMessage || "content") : /* @__PURE__ */ r(C, { className: "w-1/2", snapExit: !0, children: /* @__PURE__ */ r($o, { className: "h-4 w-full" }) }, "skeleton") })
2484
+ ) }, e.lastMessage || "content") : /* @__PURE__ */ r(k, { className: "w-1/2", snapExit: !0, children: /* @__PURE__ */ r($o, { className: "h-4 w-full" }) }, "skeleton") })
2483
2485
  ] })
2484
2486
  ] }),
2485
2487
  /* @__PURE__ */ r(jr, { className: "size-4 text-muted-foreground shrink-0 rtl:-scale-100" })
@@ -2494,21 +2496,21 @@ function Uo() {
2494
2496
  closedSessions: i,
2495
2497
  canCreateNewSession: a
2496
2498
  } = U();
2497
- return /* @__PURE__ */ r("div", { className: "flex-1 flex flex-col overflow-scroll py-2 px-2", children: /* @__PURE__ */ r(M, { mode: "wait", children: n ? /* @__PURE__ */ r(
2498
- C,
2499
+ return /* @__PURE__ */ r("div", { className: "flex-1 flex flex-col overflow-scroll py-2 px-2", children: /* @__PURE__ */ r(D, { mode: "wait", children: n ? /* @__PURE__ */ r(
2500
+ k,
2499
2501
  {
2500
2502
  className: "flex-1 flex items-center justify-center",
2501
2503
  children: /* @__PURE__ */ r(Kt, {})
2502
2504
  },
2503
2505
  "loading"
2504
2506
  ) : /* @__PURE__ */ r(
2505
- C,
2507
+ k,
2506
2508
  {
2507
2509
  className: "flex-1 flex flex-col gap-2 relative",
2508
2510
  children: t.length ? /* @__PURE__ */ d(J, { children: [
2509
- /* @__PURE__ */ d(M, { children: [
2511
+ /* @__PURE__ */ d(D, { children: [
2510
2512
  s.length > 0 && /* @__PURE__ */ r(
2511
- C,
2513
+ k,
2512
2514
  {
2513
2515
  fadeIn: "up",
2514
2516
  delay: 0.2,
@@ -2519,7 +2521,7 @@ function Uo() {
2519
2521
  "open-sessions"
2520
2522
  ),
2521
2523
  i.length > 0 && /* @__PURE__ */ d(
2522
- C,
2524
+ k,
2523
2525
  {
2524
2526
  className: "space-y-2",
2525
2527
  delay: 0.2,
@@ -2619,7 +2621,7 @@ const de = ee.forwardRef(
2619
2621
  );
2620
2622
  de.displayName = "Input";
2621
2623
  function qo() {
2622
- const { contentIframeRef: e } = O(), { inline: o } = N(), t = B(null);
2624
+ const { contentIframeRef: e } = O(), { inline: o } = z(), t = B(null);
2623
2625
  return se(() => {
2624
2626
  const n = e == null ? void 0 : e.current;
2625
2627
  if (n && t.current) {
@@ -2645,24 +2647,24 @@ const Vo = ue.object({
2645
2647
  email: ue.string().email()
2646
2648
  });
2647
2649
  function Go() {
2648
- var y, k, D, j, w, T, P, E;
2650
+ var y, N, _, E, w, M, j, R;
2649
2651
  const {
2650
2652
  widgetCtx: { org: e }
2651
- } = O(), { setIsOpen: o } = Z(), { createUnverifiedContact: t } = _t(), { isSmallScreen: n } = $(), s = N(), { theme: i } = K(), { t: a } = V(), { observedElementRef: l } = qo();
2653
+ } = O(), { setIsOpen: o } = Z(), { createUnverifiedContact: t } = _t(), { isSmallScreen: n } = $(), s = z(), { theme: i } = K(), { t: a } = V(), { observedElementRef: l } = qo();
2652
2654
  Me({
2653
2655
  height: void 0,
2654
2656
  width: i.screens.welcome.width
2655
2657
  });
2656
- const [c, p] = R(((y = s.prefillUserData) == null ? void 0 : y.name) || ""), [v, b] = R(((k = s.prefillUserData) == null ? void 0 : k.email) || ""), u = (s.extraDataCollectionFields || []).filter(
2658
+ const [c, p] = P(((y = s.prefillUserData) == null ? void 0 : y.name) || ""), [v, b] = P(((N = s.prefillUserData) == null ? void 0 : N.email) || ""), u = (s.extraDataCollectionFields || []).filter(
2657
2659
  (g) => g !== "name" && g !== "email" && !!g
2658
- ), [h, x] = R({}), [z, I] = Xr(
2660
+ ), [h, x] = P({}), [C, T] = Xr(
2659
2661
  async (g) => {
2660
2662
  g.preventDefault();
2661
- const _ = Vo.safeParse({ name: c, email: v });
2662
- _.success && await t(
2663
+ const I = Vo.safeParse({ name: c, email: v });
2664
+ I.success && await t(
2663
2665
  {
2664
- email: _.data.email,
2665
- non_verified_name: _.data.name
2666
+ email: I.data.email,
2667
+ non_verified_name: I.data.name
2666
2668
  },
2667
2669
  // Only pass extra data if there is any
2668
2670
  Object.values(h).filter(Boolean).length ? h : void 0
@@ -2703,18 +2705,18 @@ function Go() {
2703
2705
  "text-primary-foreground"
2704
2706
  ),
2705
2707
  children: [
2706
- n && /* @__PURE__ */ r(C, { className: "absolute top-6 end-6", children: /* @__PURE__ */ r(S, { size: "selfless", onClick: () => o(!1), children: /* @__PURE__ */ r(Ce, { className: "size-4" }) }) }),
2707
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between w-full mb-2", children: (D = s.assets) != null && D.organizationLogo ? /* @__PURE__ */ r(
2708
+ n && /* @__PURE__ */ r(k, { className: "absolute top-6 end-6", children: /* @__PURE__ */ r(S, { size: "selfless", onClick: () => o(!1), children: /* @__PURE__ */ r(Ce, { className: "size-4" }) }) }),
2709
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between w-full mb-2", children: (_ = s.assets) != null && _.organizationLogo ? /* @__PURE__ */ r(
2708
2710
  "img",
2709
2711
  {
2710
- src: (j = s.assets) == null ? void 0 : j.organizationLogo,
2712
+ src: (E = s.assets) == null ? void 0 : E.organizationLogo,
2711
2713
  alt: "Company Logo",
2712
2714
  className: "h-8 w-auto object-contain"
2713
2715
  }
2714
2716
  ) : /* @__PURE__ */ r("h2", { className: "font-bold text-sm", children: e.name }) }),
2715
2717
  /* @__PURE__ */ d("div", { className: "space-y-2", children: [
2716
- /* @__PURE__ */ r("h1", { className: "text-[1.75rem] font-semibold tracking-tight leading-none", children: ((T = (w = s.textContent) == null ? void 0 : w.welcomeScreen) == null ? void 0 : T.title) || a("welcome_screen_title") }),
2717
- /* @__PURE__ */ r("p", { className: "text-sm", children: ((E = (P = s.textContent) == null ? void 0 : P.welcomeScreen) == null ? void 0 : E.description) || a("welcome_screen_description") })
2718
+ /* @__PURE__ */ r("h1", { className: "text-[1.75rem] font-semibold tracking-tight leading-none", children: ((M = (w = s.textContent) == null ? void 0 : w.welcomeScreen) == null ? void 0 : M.title) || a("welcome_screen_title") }),
2719
+ /* @__PURE__ */ r("p", { className: "text-sm", children: ((R = (j = s.textContent) == null ? void 0 : j.welcomeScreen) == null ? void 0 : R.description) || a("welcome_screen_description") })
2718
2720
  ] })
2719
2721
  ]
2720
2722
  }
@@ -2729,7 +2731,7 @@ function Go() {
2729
2731
  "rounded-3xl"
2730
2732
  ),
2731
2733
  children: [
2732
- /* @__PURE__ */ d("form", { onSubmit: I, className: "space-y-2", children: [
2734
+ /* @__PURE__ */ d("form", { onSubmit: T, className: "space-y-2", children: [
2733
2735
  /* @__PURE__ */ r(
2734
2736
  de,
2735
2737
  {
@@ -2755,9 +2757,9 @@ function Go() {
2755
2757
  de,
2756
2758
  {
2757
2759
  value: h[g],
2758
- onChange: (_) => x((ie) => ({
2760
+ onChange: (I) => x((ie) => ({
2759
2761
  ...ie,
2760
- [g]: _.target.value
2762
+ [g]: I.target.value
2761
2763
  })),
2762
2764
  placeholder: `${g} (${a("optional")})`
2763
2765
  },
@@ -2766,11 +2768,11 @@ function Go() {
2766
2768
  /* @__PURE__ */ d(
2767
2769
  S,
2768
2770
  {
2769
- disabled: z.loading,
2771
+ disabled: C.loading,
2770
2772
  className: "w-full",
2771
2773
  size: "lg",
2772
2774
  children: [
2773
- z.loading ? a("start_chat_button_loading") : a("start_chat_button"),
2775
+ C.loading ? a("start_chat_button_loading") : a("start_chat_button"),
2774
2776
  /* @__PURE__ */ r(Or, { className: "size-4 rtl:-scale-100" })
2775
2777
  ]
2776
2778
  }
@@ -2790,11 +2792,11 @@ function er() {
2790
2792
  const {
2791
2793
  routerState: { screen: e }
2792
2794
  } = H();
2793
- return /* @__PURE__ */ r("div", { className: "relative bg-background size-full", children: /* @__PURE__ */ r(M, { mode: "wait", children: (() => {
2795
+ return /* @__PURE__ */ r("div", { className: "relative bg-background size-full", children: /* @__PURE__ */ r(D, { mode: "wait", children: (() => {
2794
2796
  switch (e) {
2795
2797
  case "welcome":
2796
2798
  return /* @__PURE__ */ r(
2797
- C,
2799
+ k,
2798
2800
  {
2799
2801
  fadeIn: "right",
2800
2802
  className: "size-full",
@@ -2805,7 +2807,7 @@ function er() {
2805
2807
  );
2806
2808
  case "sessions":
2807
2809
  return /* @__PURE__ */ r(
2808
- C,
2810
+ k,
2809
2811
  {
2810
2812
  fadeIn: "right",
2811
2813
  className: "size-full",
@@ -2816,7 +2818,7 @@ function er() {
2816
2818
  );
2817
2819
  case "chat":
2818
2820
  return /* @__PURE__ */ r(
2819
- C,
2821
+ k,
2820
2822
  {
2821
2823
  fadeIn: "right",
2822
2824
  className: "size-full",
@@ -2830,7 +2832,7 @@ function er() {
2830
2832
  }
2831
2833
  })() }) });
2832
2834
  }
2833
- const Zo = "4.0.57", Ko = `<!DOCTYPE html>
2835
+ const Zo = "4.0.58", Ko = `<!DOCTYPE html>
2834
2836
  <html>
2835
2837
  <head>
2836
2838
  <style>
@@ -2849,7 +2851,7 @@ html, body {
2849
2851
  </body>
2850
2852
  </html>`;
2851
2853
  function tr() {
2852
- const { isOpen: e } = Z(), { contentIframeRef: o } = O(), { cssOverrides: t, inline: n } = N(), { theme: s, cssVars: i, computed: a } = K(), { dir: l } = V();
2854
+ const { isOpen: e } = Z(), { contentIframeRef: o } = O(), { cssOverrides: t, inline: n } = z(), { theme: s, cssVars: i, computed: a } = K(), { dir: l } = V();
2853
2855
  return /* @__PURE__ */ r(
2854
2856
  re.div,
2855
2857
  {
@@ -3007,7 +3009,7 @@ html, body {
3007
3009
  </html>`;
3008
3010
  function tn() {
3009
3011
  var p, v, b;
3010
- const { isOpen: e, setIsOpen: o } = Z(), { cssOverrides: t, assets: n, customComponents: s, accessibility: i } = N(), { theme: a, cssVars: l } = K(), c = ((p = i == null ? void 0 : i.widgetTriggerButton) == null ? void 0 : p.label) ?? "Chat with us";
3012
+ const { isOpen: e, setIsOpen: o } = Z(), { cssOverrides: t, assets: n, customComponents: s, accessibility: i } = z(), { theme: a, cssVars: l } = K(), c = ((p = i == null ? void 0 : i.widgetTriggerButton) == null ? void 0 : p.label) ?? "Chat with us";
3011
3013
  return s != null && s.widgetTrigger ? s.widgetTrigger({
3012
3014
  react: L,
3013
3015
  isOpen: e,
@@ -3069,8 +3071,8 @@ function tn() {
3069
3071
  "bg-primary",
3070
3072
  "text-primary-foreground"
3071
3073
  ),
3072
- children: /* @__PURE__ */ r(M, { mode: "wait", children: e ? /* @__PURE__ */ r(
3073
- C,
3074
+ children: /* @__PURE__ */ r(D, { mode: "wait", children: e ? /* @__PURE__ */ r(
3075
+ k,
3074
3076
  {
3075
3077
  snapExit: !0,
3076
3078
  fadeIn: "up",
@@ -3100,7 +3102,7 @@ function tn() {
3100
3102
  },
3101
3103
  "x-icon"
3102
3104
  ) : /* @__PURE__ */ r(
3103
- C,
3105
+ k,
3104
3106
  {
3105
3107
  snapExit: !0,
3106
3108
  overrides: {