@opencx/widget 2.6.1 → 2.6.3

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.
Files changed (39) hide show
  1. package/dist/api-CAm3rFZk.js +1070 -0
  2. package/dist/api-CAm3rFZk.js.map +1 -0
  3. package/dist/api-oIDR-KZx.cjs +2 -0
  4. package/dist/api-oIDR-KZx.cjs.map +1 -0
  5. package/dist/basic.cjs +39 -39
  6. package/dist/basic.cjs.map +1 -1
  7. package/dist/basic.js +1214 -1213
  8. package/dist/basic.js.map +1 -1
  9. package/dist/core/client/api.d.ts +55 -42
  10. package/dist/core/client/chat.d.ts +10 -4
  11. package/dist/core/client/contact.d.ts +9 -3
  12. package/dist/core/client/index.d.ts +1 -1
  13. package/dist/core/index.d.ts +1 -1
  14. package/dist/core/sdk/index.d.ts +5 -4
  15. package/dist/core/types/contact.d.ts +2 -0
  16. package/dist/core/types/helpers.d.ts +2 -2
  17. package/dist/{index-B5YLfjom.cjs → index-CSptf_Dw.cjs} +4 -4
  18. package/dist/index-CSptf_Dw.cjs.map +1 -0
  19. package/dist/{index-EZN9_jan.js → index-cUkS-tdv.js} +237 -224
  20. package/dist/index-cUkS-tdv.js.map +1 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +6 -6
  23. package/dist/react-web/core-integration/ChatProvider.d.ts +11 -5
  24. package/dist/react-web/core-integration/hooks/useChatMessages.d.ts +10 -4
  25. package/dist/react-web/core-integration/hooks/useChatSession.d.ts +10 -4
  26. package/dist/react-web/core-integration/hooks/useContact.d.ts +10 -4
  27. package/dist/react-web/core-integration/hooks/usePreludeData.d.ts +1 -1
  28. package/dist/react-web/core-integration/hooks/useUploadFiles.d.ts +1 -1
  29. package/dist/react.cjs +1 -1
  30. package/dist/react.js +1 -1
  31. package/dist-embed/script.js +117 -112
  32. package/dist-embed/script.js.map +1 -1
  33. package/package.json +5 -6
  34. package/dist/api-BwKgAJ6p.cjs +0 -2
  35. package/dist/api-BwKgAJ6p.cjs.map +0 -1
  36. package/dist/api-DRZ9vPwy.js +0 -1360
  37. package/dist/api-DRZ9vPwy.js.map +0 -1
  38. package/dist/index-B5YLfjom.cjs.map +0 -1
  39. package/dist/index-EZN9_jan.js.map +0 -1
@@ -4,7 +4,7 @@ var He = (e, t, n) => ft(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import se, { createContext as $e, useContext as Xe, useMemo as H, useState as Ze, useEffect as de, useSyncExternalStore as gt, useLayoutEffect as pt, useRef as P, useCallback as he, useDebugValue as ht } from "react";
5
5
  import { v4 as mt } from "uuid";
6
6
  import { jsx as St } from "react/jsx-runtime";
7
- import { b as Et, A as vt, c as yt, d as wt, i as _t } from "./api-DRZ9vPwy.js";
7
+ import { b as Et, A as vt, c as yt, d as wt, i as _t } from "./api-CAm3rFZk.js";
8
8
  import { z as me } from "zod";
9
9
  function Ct(e) {
10
10
  const t = $e({});
@@ -392,11 +392,11 @@ const xt = {
392
392
  },
393
393
  storage: xt,
394
394
  logger: wt({ level: "debug" })
395
- }, It = me.object({
395
+ }, Nt = me.object({
396
396
  persistSession: me.boolean().optional(),
397
397
  useSoundEffects: me.boolean().optional()
398
398
  });
399
- function Nt({
399
+ function It({
400
400
  options: e,
401
401
  platform: t
402
402
  }) {
@@ -414,7 +414,7 @@ function Nt({
414
414
  logger: (t == null ? void 0 : t.logger) ?? ce.logger,
415
415
  audio: (t == null ? void 0 : t.audio) ?? ce.audio
416
416
  };
417
- }, [t]), a = H(() => Et(
417
+ }, [t]), c = H(() => Et(
418
418
  {
419
419
  ...e,
420
420
  settings: n
@@ -429,12 +429,12 @@ function Nt({
429
429
  `${e.token}:settings`
430
430
  );
431
431
  if (r) {
432
- const c = It.parse(
432
+ const a = Nt.parse(
433
433
  JSON.parse(r)
434
434
  );
435
- i((l) => ({
436
- ...l,
437
- ...c
435
+ i((u) => ({
436
+ ...u,
437
+ ...a
438
438
  }));
439
439
  }
440
440
  } catch (r) {
@@ -443,16 +443,16 @@ function Nt({
443
443
  })();
444
444
  }, [o.storage, e.token]);
445
445
  const d = H(() => new vt({
446
- config: a.getConfig()
447
- }), [a.config]), g = H(() => yt({
446
+ config: c.getConfig()
447
+ }), [c.config]), g = H(() => yt({
448
448
  api: d,
449
- config: a,
449
+ config: c,
450
450
  platform: o
451
- }), [a, o, d]);
451
+ }), [c, o, d]);
452
452
  return de(() => () => {
453
453
  g.cleanup();
454
454
  }, [g]), {
455
- config: a,
455
+ config: c,
456
456
  chat: g,
457
457
  api: d,
458
458
  widgetSettings: n,
@@ -466,7 +466,7 @@ function bn({
466
466
  components: n,
467
467
  platform: i
468
468
  }) {
469
- const o = Nt({ options: e, platform: i }), a = H(
469
+ const o = It({ options: e, platform: i }), c = H(
470
470
  () => new bt({
471
471
  components: n
472
472
  }),
@@ -483,7 +483,7 @@ function bn({
483
483
  {
484
484
  value: {
485
485
  ...o,
486
- componentStore: a,
486
+ componentStore: c,
487
487
  version: void 0,
488
488
  locale: d
489
489
  },
@@ -524,32 +524,32 @@ function Wt() {
524
524
  if (je) return Se;
525
525
  je = 1;
526
526
  var e = se;
527
- function t(r, c) {
528
- return r === c && (r !== 0 || 1 / r === 1 / c) || r !== r && c !== c;
527
+ function t(r, a) {
528
+ return r === a && (r !== 0 || 1 / r === 1 / a) || r !== r && a !== a;
529
529
  }
530
- var n = typeof Object.is == "function" ? Object.is : t, i = e.useState, o = e.useEffect, a = e.useLayoutEffect, d = e.useDebugValue;
531
- function g(r, c) {
532
- var l = c(), O = i({ inst: { value: l, getSnapshot: c } }), p = O[0].inst, U = O[1];
533
- return a(function() {
534
- p.value = l, p.getSnapshot = c, f(p) && U({ inst: p });
535
- }, [r, l, c]), o(function() {
536
- return f(p) && U({ inst: p }), r(function() {
537
- f(p) && U({ inst: p });
530
+ var n = typeof Object.is == "function" ? Object.is : t, i = e.useState, o = e.useEffect, c = e.useLayoutEffect, d = e.useDebugValue;
531
+ function g(r, a) {
532
+ var u = a(), b = i({ inst: { value: u, getSnapshot: a } }), S = b[0].inst, U = b[1];
533
+ return c(function() {
534
+ S.value = u, S.getSnapshot = a, f(S) && U({ inst: S });
535
+ }, [r, u, a]), o(function() {
536
+ return f(S) && U({ inst: S }), r(function() {
537
+ f(S) && U({ inst: S });
538
538
  });
539
- }, [r]), d(l), l;
539
+ }, [r]), d(u), u;
540
540
  }
541
541
  function f(r) {
542
- var c = r.getSnapshot;
542
+ var a = r.getSnapshot;
543
543
  r = r.value;
544
544
  try {
545
- var l = c();
546
- return !n(r, l);
545
+ var u = a();
546
+ return !n(r, u);
547
547
  } catch {
548
548
  return !0;
549
549
  }
550
550
  }
551
- function C(r, c) {
552
- return c();
551
+ function C(r, a) {
552
+ return a();
553
553
  }
554
554
  var s = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? C : g;
555
555
  return Se.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : s, Se;
@@ -565,115 +565,115 @@ var Ee = {};
565
565
  * LICENSE file in the root directory of this source tree.
566
566
  */
567
567
  var Ge;
568
- function zt() {
568
+ function Mt() {
569
569
  return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && function() {
570
570
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
571
571
  var e = se, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
572
572
  function n(_) {
573
573
  {
574
- for (var m = arguments.length, E = new Array(m > 1 ? m - 1 : 0), S = 1; S < m; S++)
575
- E[S - 1] = arguments[S];
574
+ for (var h = arguments.length, E = new Array(h > 1 ? h - 1 : 0), m = 1; m < h; m++)
575
+ E[m - 1] = arguments[m];
576
576
  i("error", _, E);
577
577
  }
578
578
  }
579
- function i(_, m, E) {
579
+ function i(_, h, E) {
580
580
  {
581
- var S = t.ReactDebugCurrentFrame, k = S.getStackAddendum();
582
- k !== "" && (m += "%s", E = E.concat([k]));
581
+ var m = t.ReactDebugCurrentFrame, k = m.getStackAddendum();
582
+ k !== "" && (h += "%s", E = E.concat([k]));
583
583
  var v = E.map(function(R) {
584
584
  return String(R);
585
585
  });
586
- v.unshift("Warning: " + m), Function.prototype.apply.call(console[_], console, v);
586
+ v.unshift("Warning: " + h), Function.prototype.apply.call(console[_], console, v);
587
587
  }
588
588
  }
589
- function o(_, m) {
590
- return _ === m && (_ !== 0 || 1 / _ === 1 / m) || _ !== _ && m !== m;
589
+ function o(_, h) {
590
+ return _ === h && (_ !== 0 || 1 / _ === 1 / h) || _ !== _ && h !== h;
591
591
  }
592
- var a = typeof Object.is == "function" ? Object.is : o, d = e.useState, g = e.useEffect, f = e.useLayoutEffect, C = e.useDebugValue, s = !1, r = !1;
593
- function c(_, m, E) {
592
+ var c = typeof Object.is == "function" ? Object.is : o, d = e.useState, g = e.useEffect, f = e.useLayoutEffect, C = e.useDebugValue, s = !1, r = !1;
593
+ function a(_, h, E) {
594
594
  s || e.startTransition !== void 0 && (s = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
595
- var S = m();
595
+ var m = h();
596
596
  if (!r) {
597
- var k = m();
598
- a(S, k) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), r = !0);
597
+ var k = h();
598
+ c(m, k) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), r = !0);
599
599
  }
600
600
  var v = d({
601
601
  inst: {
602
- value: S,
603
- getSnapshot: m
602
+ value: m,
603
+ getSnapshot: h
604
604
  }
605
605
  }), R = v[0].inst, V = v[1];
606
606
  return f(function() {
607
- R.value = S, R.getSnapshot = m, l(R) && V({
607
+ R.value = m, R.getSnapshot = h, u(R) && V({
608
608
  inst: R
609
609
  });
610
- }, [_, S, m]), g(function() {
611
- l(R) && V({
610
+ }, [_, m, h]), g(function() {
611
+ u(R) && V({
612
612
  inst: R
613
613
  });
614
614
  var q = function() {
615
- l(R) && V({
615
+ u(R) && V({
616
616
  inst: R
617
617
  });
618
618
  };
619
619
  return _(q);
620
- }, [_]), C(S), S;
620
+ }, [_]), C(m), m;
621
621
  }
622
- function l(_) {
623
- var m = _.getSnapshot, E = _.value;
622
+ function u(_) {
623
+ var h = _.getSnapshot, E = _.value;
624
624
  try {
625
- var S = m();
626
- return !a(E, S);
625
+ var m = h();
626
+ return !c(E, m);
627
627
  } catch {
628
628
  return !0;
629
629
  }
630
630
  }
631
- function O(_, m, E) {
632
- return m();
631
+ function b(_, h, E) {
632
+ return h();
633
633
  }
634
- var p = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", U = !p, u = U ? O : c, Y = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u;
634
+ var S = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", U = !S, l = U ? b : a, Y = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : l;
635
635
  Ee.useSyncExternalStore = Y, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
636
636
  }()), Ee;
637
637
  }
638
- process.env.NODE_ENV === "production" ? be.exports = Wt() : be.exports = zt();
639
- var Mt = be.exports;
638
+ process.env.NODE_ENV === "production" ? be.exports = Wt() : be.exports = Mt();
639
+ var zt = be.exports;
640
640
  const j = () => {
641
641
  }, L = (
642
642
  /*#__NOINLINE__*/
643
643
  j()
644
- ), ve = Object, h = (e) => e === L, F = (e) => typeof e == "function", G = (e, t) => ({
644
+ ), ve = Object, p = (e) => e === L, F = (e) => typeof e == "function", G = (e, t) => ({
645
645
  ...e,
646
646
  ...t
647
647
  }), qt = (e) => F(e.then), ue = /* @__PURE__ */ new WeakMap();
648
648
  let Bt = 0;
649
649
  const re = (e) => {
650
650
  const t = typeof e, n = e && e.constructor, i = n == Date;
651
- let o, a;
651
+ let o, c;
652
652
  if (ve(e) === e && !i && n != RegExp) {
653
653
  if (o = ue.get(e), o) return o;
654
654
  if (o = ++Bt + "~", ue.set(e, o), n == Array) {
655
- for (o = "@", a = 0; a < e.length; a++)
656
- o += re(e[a]) + ",";
655
+ for (o = "@", c = 0; c < e.length; c++)
656
+ o += re(e[c]) + ",";
657
657
  ue.set(e, o);
658
658
  }
659
659
  if (n == ve) {
660
660
  o = "#";
661
661
  const d = ve.keys(e).sort();
662
- for (; !h(a = d.pop()); )
663
- h(e[a]) || (o += a + ":" + re(e[a]) + ",");
662
+ for (; !p(c = d.pop()); )
663
+ p(e[c]) || (o += c + ":" + re(e[c]) + ",");
664
664
  ue.set(e, o);
665
665
  }
666
666
  } else
667
667
  o = i ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
668
668
  return o;
669
- }, M = /* @__PURE__ */ new WeakMap(), ye = {}, le = {}, Le = "undefined", fe = typeof window != Le, Oe = typeof document != Le, Ht = () => fe && typeof window.requestAnimationFrame != Le, Qe = (e, t) => {
670
- const n = M.get(e);
669
+ }, z = /* @__PURE__ */ new WeakMap(), ye = {}, le = {}, Le = "undefined", fe = typeof window != Le, Oe = typeof document != Le, Ht = () => fe && typeof window.requestAnimationFrame != Le, Qe = (e, t) => {
670
+ const n = z.get(e);
671
671
  return [
672
672
  // Getter
673
- () => !h(t) && e.get(t) || ye,
673
+ () => !p(t) && e.get(t) || ye,
674
674
  // Setter
675
675
  (i) => {
676
- if (!h(t)) {
676
+ if (!p(t)) {
677
677
  const o = e.get(t);
678
678
  t in le || (le[t] = o), n[5](t, G(o, i), o || ye);
679
679
  }
@@ -681,7 +681,7 @@ const re = (e) => {
681
681
  // Subscriber
682
682
  n[6],
683
683
  // Get server cache snapshot
684
- () => !h(t) && t in le ? le[t] : !h(t) && e.get(t) || ye
684
+ () => !p(t) && t in le ? le[t] : !p(t) && e.get(t) || ye
685
685
  ];
686
686
  };
687
687
  let Re = !0;
@@ -693,7 +693,7 @@ const jt = () => Re, [Te, Ae] = fe && window.addEventListener ? [
693
693
  j
694
694
  ], Gt = () => {
695
695
  const e = Oe && document.visibilityState;
696
- return h(e) || e !== "hidden";
696
+ return p(e) || e !== "hidden";
697
697
  }, Kt = (e) => (Oe && document.addEventListener("visibilitychange", e), Te("focus", e), () => {
698
698
  Oe && document.removeEventListener("visibilitychange", e), Ae("focus", e);
699
699
  }), Pt = (e) => {
@@ -737,79 +737,79 @@ var ne = {
737
737
  RECONNECT_EVENT: tt
738
738
  };
739
739
  async function rt(...e) {
740
- const [t, n, i, o] = e, a = G({
740
+ const [t, n, i, o] = e, c = G({
741
741
  populateCache: !0,
742
742
  throwOnError: !0
743
743
  }, typeof o == "boolean" ? {
744
744
  revalidate: o
745
745
  } : o || {});
746
- let d = a.populateCache;
747
- const g = a.rollbackOnError;
748
- let f = a.optimisticData;
749
- const C = (c) => typeof g == "function" ? g(c) : g !== !1, s = a.throwOnError;
746
+ let d = c.populateCache;
747
+ const g = c.rollbackOnError;
748
+ let f = c.optimisticData;
749
+ const C = (a) => typeof g == "function" ? g(a) : g !== !1, s = c.throwOnError;
750
750
  if (F(n)) {
751
- const c = n, l = [], O = t.keys();
752
- for (const p of O)
751
+ const a = n, u = [], b = t.keys();
752
+ for (const S of b)
753
753
  // Skip the special useSWRInfinite and useSWRSubscription keys.
754
- !/^\$(inf|sub)\$/.test(p) && c(t.get(p)._k) && l.push(p);
755
- return Promise.all(l.map(r));
754
+ !/^\$(inf|sub)\$/.test(S) && a(t.get(S)._k) && u.push(S);
755
+ return Promise.all(u.map(r));
756
756
  }
757
757
  return r(n);
758
- async function r(c) {
759
- const [l] = ke(c);
760
- if (!l) return;
761
- const [O, p] = Qe(t, l), [U, u, Y, _] = M.get(t), m = () => {
762
- const I = U[l];
763
- return (F(a.revalidate) ? a.revalidate(O().data, c) : a.revalidate !== !1) && (delete Y[l], delete _[l], I && I[0]) ? I[0](nt).then(() => O().data) : O().data;
758
+ async function r(a) {
759
+ const [u] = ke(a);
760
+ if (!u) return;
761
+ const [b, S] = Qe(t, u), [U, l, Y, _] = z.get(t), h = () => {
762
+ const N = U[u];
763
+ return (F(c.revalidate) ? c.revalidate(b().data, a) : c.revalidate !== !1) && (delete Y[u], delete _[u], N && N[0]) ? N[0](nt).then(() => b().data) : b().data;
764
764
  };
765
765
  if (e.length < 3)
766
- return m();
767
- let E = i, S;
766
+ return h();
767
+ let E = i, m;
768
768
  const k = De();
769
- u[l] = [
769
+ l[u] = [
770
770
  k,
771
771
  0
772
772
  ];
773
- const v = !h(f), R = O(), V = R.data, q = R._c, K = h(q) ? V : q;
774
- if (v && (f = F(f) ? f(K, V) : f, p({
773
+ const v = !p(f), R = b(), V = R.data, q = R._c, K = p(q) ? V : q;
774
+ if (v && (f = F(f) ? f(K, V) : f, S({
775
775
  data: f,
776
776
  _c: K
777
777
  })), F(E))
778
778
  try {
779
779
  E = E(K);
780
- } catch (I) {
781
- S = I;
780
+ } catch (N) {
781
+ m = N;
782
782
  }
783
783
  if (E && qt(E))
784
- if (E = await E.catch((I) => {
785
- S = I;
786
- }), k !== u[l][0]) {
787
- if (S) throw S;
784
+ if (E = await E.catch((N) => {
785
+ m = N;
786
+ }), k !== l[u][0]) {
787
+ if (m) throw m;
788
788
  return E;
789
- } else S && v && C(S) && (d = !0, p({
789
+ } else m && v && C(m) && (d = !0, S({
790
790
  data: K,
791
791
  _c: L
792
792
  }));
793
- if (d && !S)
793
+ if (d && !m)
794
794
  if (F(d)) {
795
- const I = d(E, K);
796
- p({
797
- data: I,
795
+ const N = d(E, K);
796
+ S({
797
+ data: N,
798
798
  error: L,
799
799
  _c: L
800
800
  });
801
801
  } else
802
- p({
802
+ S({
803
803
  data: E,
804
804
  error: L,
805
805
  _c: L
806
806
  });
807
- if (u[l][1] = De(), Promise.resolve(m()).then(() => {
808
- p({
807
+ if (l[u][1] = De(), Promise.resolve(h()).then(() => {
808
+ S({
809
809
  _c: L
810
810
  });
811
- }), S) {
812
- if (s) throw S;
811
+ }), m) {
812
+ if (s) throw m;
813
813
  return;
814
814
  }
815
815
  return E;
@@ -819,20 +819,20 @@ const Je = (e, t) => {
819
819
  for (const n in e)
820
820
  e[n][0] && e[n][0](t);
821
821
  }, Qt = (e, t) => {
822
- if (!M.has(e)) {
822
+ if (!z.has(e)) {
823
823
  const n = G(Yt, t), i = {}, o = rt.bind(L, e);
824
- let a = j;
824
+ let c = j;
825
825
  const d = {}, g = (s, r) => {
826
- const c = d[s] || [];
827
- return d[s] = c, c.push(r), () => c.splice(c.indexOf(r), 1);
828
- }, f = (s, r, c) => {
826
+ const a = d[s] || [];
827
+ return d[s] = a, a.push(r), () => a.splice(a.indexOf(r), 1);
828
+ }, f = (s, r, a) => {
829
829
  e.set(s, r);
830
- const l = d[s];
831
- if (l)
832
- for (const O of l)
833
- O(r, c);
830
+ const u = d[s];
831
+ if (u)
832
+ for (const b of u)
833
+ b(r, a);
834
834
  }, C = () => {
835
- if (!M.has(e) && (M.set(e, [
835
+ if (!z.has(e) && (z.set(e, [
836
836
  i,
837
837
  {},
838
838
  {},
@@ -842,8 +842,8 @@ const Je = (e, t) => {
842
842
  g
843
843
  ]), !oe)) {
844
844
  const s = n.initFocus(setTimeout.bind(L, Je.bind(L, i, et))), r = n.initReconnect(setTimeout.bind(L, Je.bind(L, i, tt)));
845
- a = () => {
846
- s && s(), r && r(), M.delete(e);
845
+ c = () => {
846
+ s && s(), r && r(), z.delete(e);
847
847
  };
848
848
  }
849
849
  };
@@ -851,16 +851,16 @@ const Je = (e, t) => {
851
851
  e,
852
852
  o,
853
853
  C,
854
- a
854
+ c
855
855
  ];
856
856
  }
857
857
  return [
858
858
  e,
859
- M.get(e)[4]
859
+ z.get(e)[4]
860
860
  ];
861
861
  }, en = (e, t, n, i, o) => {
862
- const a = n.errorRetryCount, d = o.retryCount, g = ~~((Math.random() + 0.5) * (1 << (d < 8 ? d : 8))) * n.errorRetryInterval;
863
- !h(a) && d > a || setTimeout(i, g, o);
862
+ const c = n.errorRetryCount, d = o.retryCount, g = ~~((Math.random() + 0.5) * (1 << (d < 8 ? d : 8))) * n.errorRetryInterval;
863
+ !p(c) && d > c || setTimeout(i, g, o);
864
864
  }, tn = (e, t) => re(e) == re(t), [ot, nn] = Qt(/* @__PURE__ */ new Map()), rn = G(
865
865
  {
866
866
  // events
@@ -891,8 +891,8 @@ const Je = (e, t) => {
891
891
  ), on = (e, t) => {
892
892
  const n = G(e, t);
893
893
  if (t) {
894
- const { use: i, fallback: o } = e, { use: a, fallback: d } = t;
895
- i && a && (n.use = i.concat(a)), o && d && (n.fallback = G(o, d));
894
+ const { use: i, fallback: o } = e, { use: c, fallback: d } = t;
895
+ i && c && (n.use = i.concat(c)), o && d && (n.fallback = G(o, d));
896
896
  }
897
897
  return n;
898
898
  }, sn = $e({}), an = "$inf$", st = fe && window.__SWR_DEVTOOLS_USE__, cn = st ? window.__SWR_DEVTOOLS_USE__ : [], un = () => {
@@ -905,19 +905,19 @@ const Je = (e, t) => {
905
905
  e[0],
906
906
  null,
907
907
  (e[1] === null ? e[2] : e[1]) || {}
908
- ], dn = () => G(rn, Xe(sn)), fn = (e) => (t, n, i) => e(t, n && ((...a) => {
909
- const [d] = ke(t), [, , , g] = M.get(ot);
908
+ ], dn = () => G(rn, Xe(sn)), fn = (e) => (t, n, i) => e(t, n && ((...c) => {
909
+ const [d] = ke(t), [, , , g] = z.get(ot);
910
910
  if (d.startsWith(an))
911
- return n(...a);
911
+ return n(...c);
912
912
  const f = g[d];
913
- return h(f) ? n(...a) : (delete g[d], f);
913
+ return p(f) ? n(...c) : (delete g[d], f);
914
914
  }), i), gn = cn.concat(fn), pn = (e) => function(...n) {
915
- const i = dn(), [o, a, d] = ln(n), g = on(i, d);
915
+ const i = dn(), [o, c, d] = ln(n), g = on(i, d);
916
916
  let f = e;
917
917
  const { use: C } = g, s = (C || []).concat(gn);
918
918
  for (let r = s.length; r--; )
919
919
  f = s[r](f);
920
- return f(o, a || g.fetcher || null, g);
920
+ return f(o, c || g.fetcher || null, g);
921
921
  }, hn = (e, t, n) => {
922
922
  const i = t[e] || (t[e] = []);
923
923
  return i.push(n), () => {
@@ -939,26 +939,26 @@ const Ye = se.use || ((e) => {
939
939
  }), Ce = {
940
940
  dedupe: !0
941
941
  }, mn = (e, t, n) => {
942
- const { cache: i, compare: o, suspense: a, fallbackData: d, revalidateOnMount: g, revalidateIfStale: f, refreshInterval: C, refreshWhenHidden: s, refreshWhenOffline: r, keepPreviousData: c } = n, [l, O, p, U] = M.get(i), [u, Y] = ke(e), _ = P(!1), m = P(!1), E = P(u), S = P(t), k = P(n), v = () => k.current, R = () => v().isVisible() && v().isOnline(), [V, q, K, I] = Qe(i, u), $ = P({}).current, it = h(d) ? n.fallback[u] : d, xe = (y, w) => {
942
+ const { cache: i, compare: o, suspense: c, fallbackData: d, revalidateOnMount: g, revalidateIfStale: f, refreshInterval: C, refreshWhenHidden: s, refreshWhenOffline: r, keepPreviousData: a } = n, [u, b, S, U] = z.get(i), [l, Y] = ke(e), _ = P(!1), h = P(!1), E = P(l), m = P(t), k = P(n), v = () => k.current, R = () => v().isVisible() && v().isOnline(), [V, q, K, N] = Qe(i, l), $ = P({}).current, it = p(d) ? n.fallback[l] : d, xe = (y, w) => {
943
943
  for (const A in $) {
944
- const b = A;
945
- if (b === "data") {
946
- if (!o(y[b], w[b]) && (!h(y[b]) || !o(ae, w[b])))
944
+ const O = A;
945
+ if (O === "data") {
946
+ if (!o(y[O], w[O]) && (!p(y[O]) || !o(ae, w[O])))
947
947
  return !1;
948
- } else if (w[b] !== y[b])
948
+ } else if (w[O] !== y[O])
949
949
  return !1;
950
950
  }
951
951
  return !0;
952
- }, Ie = H(() => {
953
- const y = !u || !t ? !1 : h(g) ? v().isPaused() || a ? !1 : h(f) ? !0 : f : g, w = (D) => {
952
+ }, Ne = H(() => {
953
+ const y = !l || !t ? !1 : p(g) ? v().isPaused() || c ? !1 : p(f) ? !0 : f : g, w = (D) => {
954
954
  const W = G(D);
955
955
  return delete W._k, y ? {
956
956
  isValidating: !0,
957
957
  isLoading: !0,
958
958
  ...W
959
959
  } : W;
960
- }, A = V(), b = I(), N = w(A), ee = A === b ? N : w(b);
961
- let T = N;
960
+ }, A = V(), O = N(), I = w(A), ee = A === O ? I : w(O);
961
+ let T = I;
962
962
  return [
963
963
  () => {
964
964
  const D = w(V());
@@ -968,63 +968,63 @@ const Ye = se.use || ((e) => {
968
968
  ];
969
969
  }, [
970
970
  i,
971
- u
972
- ]), X = Mt.useSyncExternalStore(he(
973
- (y) => K(u, (w, A) => {
971
+ l
972
+ ]), X = zt.useSyncExternalStore(he(
973
+ (y) => K(l, (w, A) => {
974
974
  xe(A, w) || y();
975
975
  }),
976
976
  // eslint-disable-next-line react-hooks/exhaustive-deps
977
977
  [
978
978
  i,
979
- u
979
+ l
980
980
  ]
981
- ), Ie[0], Ie[1]), Ne = !_.current, at = l[u] && l[u].length > 0, Z = X.data, Q = h(Z) ? it : Z, ie = X.error, Fe = P(Q), ae = c ? h(Z) ? Fe.current : Z : Q, Ue = at && !h(ie) ? !1 : Ne && !h(g) ? g : v().isPaused() ? !1 : a ? h(Q) ? !1 : f : h(Q) || f, We = !!(u && t && Ne && Ue), ct = h(X.isValidating) ? We : X.isValidating, ut = h(X.isLoading) ? We : X.isLoading, te = he(
981
+ ), Ne[0], Ne[1]), Ie = !_.current, at = u[l] && u[l].length > 0, Z = X.data, Q = p(Z) ? it : Z, ie = X.error, Fe = P(Q), ae = a ? p(Z) ? Fe.current : Z : Q, Ue = at && !p(ie) ? !1 : Ie && !p(g) ? g : v().isPaused() ? !1 : c ? p(Q) ? !1 : f : p(Q) || f, We = !!(l && t && Ie && Ue), ct = p(X.isValidating) ? We : X.isValidating, ut = p(X.isLoading) ? We : X.isLoading, te = he(
982
982
  async (y) => {
983
- const w = S.current;
984
- if (!u || !w || m.current || v().isPaused())
983
+ const w = m.current;
984
+ if (!l || !w || h.current || v().isPaused())
985
985
  return !1;
986
- let A, b, N = !0;
987
- const ee = y || {}, T = !p[u] || !ee.dedupe, D = () => Ke ? !m.current && u === E.current && _.current : u === E.current, W = {
986
+ let A, O, I = !0;
987
+ const ee = y || {}, T = !S[l] || !ee.dedupe, D = () => Ke ? !h.current && l === E.current && _.current : l === E.current, W = {
988
988
  isValidating: !1,
989
989
  isLoading: !1
990
- }, Me = () => {
990
+ }, ze = () => {
991
991
  q(W);
992
992
  }, qe = () => {
993
- const x = p[u];
994
- x && x[1] === b && delete p[u];
993
+ const x = S[l];
994
+ x && x[1] === O && delete S[l];
995
995
  }, Be = {
996
996
  isValidating: !0
997
997
  };
998
- h(V().data) && (Be.isLoading = !0);
998
+ p(V().data) && (Be.isLoading = !0);
999
999
  try {
1000
- if (T && (q(Be), n.loadingTimeout && h(V().data) && setTimeout(() => {
1001
- N && D() && v().onLoadingSlow(u, n);
1002
- }, n.loadingTimeout), p[u] = [
1000
+ if (T && (q(Be), n.loadingTimeout && p(V().data) && setTimeout(() => {
1001
+ I && D() && v().onLoadingSlow(l, n);
1002
+ }, n.loadingTimeout), S[l] = [
1003
1003
  w(Y),
1004
1004
  De()
1005
- ]), [A, b] = p[u], A = await A, T && setTimeout(qe, n.dedupingInterval), !p[u] || p[u][1] !== b)
1006
- return T && D() && v().onDiscarded(u), !1;
1005
+ ]), [A, O] = S[l], A = await A, T && setTimeout(qe, n.dedupingInterval), !S[l] || S[l][1] !== O)
1006
+ return T && D() && v().onDiscarded(l), !1;
1007
1007
  W.error = L;
1008
- const x = O[u];
1009
- if (!h(x) && // case 1
1010
- (b <= x[0] || // case 2
1011
- b <= x[1] || // case 3
1008
+ const x = b[l];
1009
+ if (!p(x) && // case 1
1010
+ (O <= x[0] || // case 2
1011
+ O <= x[1] || // case 3
1012
1012
  x[1] === 0))
1013
- return Me(), T && D() && v().onDiscarded(u), !1;
1014
- const z = V().data;
1015
- W.data = o(z, A) ? z : A, T && D() && v().onSuccess(A, u, n);
1013
+ return ze(), T && D() && v().onDiscarded(l), !1;
1014
+ const M = V().data;
1015
+ W.data = o(M, A) ? M : A, T && D() && v().onSuccess(A, l, n);
1016
1016
  } catch (x) {
1017
1017
  qe();
1018
- const z = v(), { shouldRetryOnError: ge } = z;
1019
- z.isPaused() || (W.error = x, T && D() && (z.onError(x, u, z), (ge === !0 || F(ge) && ge(x)) && (!v().revalidateOnFocus || !v().revalidateOnReconnect || R()) && z.onErrorRetry(x, u, z, (lt) => {
1020
- const pe = l[u];
1018
+ const M = v(), { shouldRetryOnError: ge } = M;
1019
+ M.isPaused() || (W.error = x, T && D() && (M.onError(x, l, M), (ge === !0 || F(ge) && ge(x)) && (!v().revalidateOnFocus || !v().revalidateOnReconnect || R()) && M.onErrorRetry(x, l, M, (lt) => {
1020
+ const pe = u[l];
1021
1021
  pe && pe[0] && pe[0](ne.ERROR_REVALIDATE_EVENT, lt);
1022
1022
  }, {
1023
1023
  retryCount: (ee.retryCount || 0) + 1,
1024
1024
  dedupe: !0
1025
1025
  })));
1026
1026
  }
1027
- return N = !1, Me(), !0;
1027
+ return I = !1, ze(), !0;
1028
1028
  },
1029
1029
  // `setState` is immutable, and `eventsCallback`, `fnArg`, and
1030
1030
  // `keyValidating` are depending on `key`, so we can exclude them from
@@ -1038,46 +1038,46 @@ const Ye = se.use || ((e) => {
1038
1038
  // even though it might cause unexpected behaviors.
1039
1039
  // eslint-disable-next-line react-hooks/exhaustive-deps
1040
1040
  [
1041
- u,
1041
+ l,
1042
1042
  i
1043
1043
  ]
1044
- ), ze = he(
1044
+ ), Me = he(
1045
1045
  // Use callback to make sure `keyRef.current` returns latest result every time
1046
1046
  (...y) => rt(i, E.current, ...y),
1047
1047
  // eslint-disable-next-line react-hooks/exhaustive-deps
1048
1048
  []
1049
1049
  );
1050
1050
  if (we(() => {
1051
- S.current = t, k.current = n, h(Z) || (Fe.current = Z);
1051
+ m.current = t, k.current = n, p(Z) || (Fe.current = Z);
1052
1052
  }), we(() => {
1053
- if (!u) return;
1053
+ if (!l) return;
1054
1054
  const y = te.bind(L, Ce);
1055
1055
  let w = 0;
1056
- const b = hn(u, l, (N, ee = {}) => {
1057
- if (N == ne.FOCUS_EVENT) {
1056
+ const O = hn(l, u, (I, ee = {}) => {
1057
+ if (I == ne.FOCUS_EVENT) {
1058
1058
  const T = Date.now();
1059
1059
  v().revalidateOnFocus && T > w && R() && (w = T + v().focusThrottleInterval, y());
1060
- } else if (N == ne.RECONNECT_EVENT)
1060
+ } else if (I == ne.RECONNECT_EVENT)
1061
1061
  v().revalidateOnReconnect && R() && y();
1062
1062
  else {
1063
- if (N == ne.MUTATE_EVENT)
1063
+ if (I == ne.MUTATE_EVENT)
1064
1064
  return te();
1065
- if (N == ne.ERROR_REVALIDATE_EVENT)
1065
+ if (I == ne.ERROR_REVALIDATE_EVENT)
1066
1066
  return te(ee);
1067
1067
  }
1068
1068
  });
1069
- return m.current = !1, E.current = u, _.current = !0, q({
1069
+ return h.current = !1, E.current = l, _.current = !0, q({
1070
1070
  _k: Y
1071
- }), Ue && (h(Q) || oe ? y() : $t(y)), () => {
1072
- m.current = !0, b();
1071
+ }), Ue && (p(Q) || oe ? y() : $t(y)), () => {
1072
+ h.current = !0, O();
1073
1073
  };
1074
1074
  }, [
1075
- u
1075
+ l
1076
1076
  ]), we(() => {
1077
1077
  let y;
1078
1078
  function w() {
1079
- const b = F(C) ? C(V().data) : C;
1080
- b && y !== -1 && (y = setTimeout(A, b));
1079
+ const O = F(C) ? C(V().data) : C;
1080
+ O && y !== -1 && (y = setTimeout(A, O));
1081
1081
  }
1082
1082
  function A() {
1083
1083
  !V().error && (s || v().isVisible()) && (r || v().isOnline()) ? te(Ce).then(w) : w();
@@ -1089,24 +1089,24 @@ const Ye = se.use || ((e) => {
1089
1089
  C,
1090
1090
  s,
1091
1091
  r,
1092
- u
1093
- ]), ht(ae), a && h(Q) && u) {
1092
+ l
1093
+ ]), ht(ae), c && p(Q) && l) {
1094
1094
  if (!Ke && oe)
1095
1095
  throw new Error("Fallback data is required when using suspense in SSR.");
1096
- S.current = t, k.current = n, m.current = !1;
1097
- const y = U[u];
1098
- if (!h(y)) {
1099
- const w = ze(y);
1096
+ m.current = t, k.current = n, h.current = !1;
1097
+ const y = U[l];
1098
+ if (!p(y)) {
1099
+ const w = Me(y);
1100
1100
  Ye(w);
1101
1101
  }
1102
- if (h(ie)) {
1102
+ if (p(ie)) {
1103
1103
  const w = te(Ce);
1104
- h(ae) || (w.status = "fulfilled", w.value = !0), Ye(w);
1104
+ p(ae) || (w.status = "fulfilled", w.value = !0), Ye(w);
1105
1105
  } else
1106
1106
  throw ie;
1107
1107
  }
1108
1108
  return {
1109
- mutate: ze,
1109
+ mutate: Me,
1110
1110
  get data() {
1111
1111
  return $.data = !0, ae;
1112
1112
  },
@@ -1133,45 +1133,58 @@ const B = /* @__PURE__ */ new Map();
1133
1133
  function Dn() {
1134
1134
  const [e, t] = Ze([]), { api: n } = J();
1135
1135
  function i(s) {
1136
- const r = s.map((c) => ({
1137
- file: c,
1136
+ const r = s.map((a) => ({
1137
+ file: a,
1138
1138
  id: mt(),
1139
1139
  status: "pending",
1140
1140
  progress: 0
1141
1141
  }));
1142
- t((c) => [...c, ...r]), r.forEach(d);
1142
+ t((a) => [...a, ...r]), r.forEach(d);
1143
1143
  }
1144
1144
  function o(s, r) {
1145
1145
  t(
1146
- (c) => c.map((l) => l.id === s ? { ...l, ...r } : l)
1146
+ (a) => a.map((u) => u.id === s ? { ...u, ...r } : u)
1147
1147
  );
1148
1148
  }
1149
- function a(s) {
1150
- t((r) => r.filter((c) => c.id !== s));
1149
+ function c(s) {
1150
+ t((r) => r.filter((a) => a.id !== s));
1151
1151
  }
1152
1152
  const d = async (s) => {
1153
1153
  const r = new AbortController();
1154
- B.set(s.id, r), t(
1155
- (O) => O.map(
1156
- (p) => p.id === s.id ? { ...p, status: "uploading", progress: 0 } : p
1157
- )
1158
- );
1159
- const { data: c, error: l } = await n.uploadFile({
1160
- file: s,
1161
- abortSignal: r.signal
1162
- });
1163
- c ? o(s.id, {
1164
- status: "success",
1165
- fileUrl: c.fileUrl,
1166
- progress: 100
1167
- }) : r.signal.aborted || o(s.id, {
1168
- status: "error",
1169
- error: l.message || "Upload failed",
1170
- progress: 0
1171
- }), B.delete(s.id);
1154
+ B.set(s.id, r);
1155
+ try {
1156
+ t(
1157
+ (u) => u.map(
1158
+ (b) => b.id === s.id ? { ...b, status: "uploading", progress: 0 } : b
1159
+ )
1160
+ );
1161
+ const a = await n.uploadFile(s, {
1162
+ signal: r.signal,
1163
+ onUploadProgress: (u) => {
1164
+ if (!u.total) return;
1165
+ const b = Math.round(
1166
+ u.loaded * 100 / u.total
1167
+ );
1168
+ o(s.id, { progress: b });
1169
+ }
1170
+ });
1171
+ o(s.id, {
1172
+ status: "success",
1173
+ fileUrl: a.fileUrl,
1174
+ progress: 100
1175
+ });
1176
+ } catch (a) {
1177
+ r.signal.aborted || o(s.id, {
1178
+ status: "error",
1179
+ error: a instanceof Error ? a.message : "Upload failed",
1180
+ progress: 0
1181
+ });
1182
+ } finally {
1183
+ B.delete(s.id);
1184
+ }
1172
1185
  }, g = (s) => {
1173
1186
  const r = B.get(s);
1174
- r && (r.abort(), B.delete(s)), a(s);
1187
+ r && (r.abort(), B.delete(s)), c(s);
1175
1188
  }, f = H(() => e.filter((s) => s.status === "success" && s.fileUrl), [e]);
1176
1189
  function C() {
1177
1190
  B.forEach((s) => s.abort()), B.clear(), t([]);
@@ -1187,11 +1200,11 @@ function Dn() {
1187
1200
  getFileById: (s) => e.find((r) => r.id === s),
1188
1201
  getUploadProgress: (s) => {
1189
1202
  var r;
1190
- return ((r = e.find((c) => c.id === s)) == null ? void 0 : r.progress) ?? 0;
1203
+ return ((r = e.find((a) => a.id === s)) == null ? void 0 : r.progress) ?? 0;
1191
1204
  },
1192
1205
  getUploadStatus: (s) => {
1193
1206
  var r;
1194
- return (r = e.find((c) => c.id === s)) == null ? void 0 : r.status;
1207
+ return (r = e.find((a) => a.id === s)) == null ? void 0 : r.status;
1195
1208
  },
1196
1209
  hasErrors: e.some((s) => s.status === "error"),
1197
1210
  isUploading: e.some((s) => s.status === "uploading")
@@ -1201,7 +1214,7 @@ function Vn() {
1201
1214
  const { chat: e } = J();
1202
1215
  return {
1203
1216
  contactState: Ve(e.contactState),
1204
- shouldCollectData: e.shouldCollectData
1217
+ contactManager: e.contactManager
1205
1218
  };
1206
1219
  }
1207
1220
  export {
@@ -1216,4 +1229,4 @@ export {
1216
1229
  Ve as h,
1217
1230
  J as u
1218
1231
  };
1219
- //# sourceMappingURL=index-EZN9_jan.js.map
1232
+ //# sourceMappingURL=index-cUkS-tdv.js.map