@medipha/chat 1.0.34 → 1.0.36

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
@@ -10508,68 +10508,105 @@ function gh(e) {
10508
10508
  };
10509
10509
  }
10510
10510
  //#endregion
10511
+ //#region node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/stringify.js
10512
+ var _h = [];
10513
+ for (let e = 0; e < 256; ++e) _h.push((e + 256).toString(16).slice(1));
10514
+ function vh(e, t = 0) {
10515
+ return (_h[e[t + 0]] + _h[e[t + 1]] + _h[e[t + 2]] + _h[e[t + 3]] + "-" + _h[e[t + 4]] + _h[e[t + 5]] + "-" + _h[e[t + 6]] + _h[e[t + 7]] + "-" + _h[e[t + 8]] + _h[e[t + 9]] + "-" + _h[e[t + 10]] + _h[e[t + 11]] + _h[e[t + 12]] + _h[e[t + 13]] + _h[e[t + 14]] + _h[e[t + 15]]).toLowerCase();
10516
+ }
10517
+ //#endregion
10518
+ //#region node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/rng.js
10519
+ var yh, bh = /* @__PURE__ */ new Uint8Array(16);
10520
+ function xh() {
10521
+ if (!yh) {
10522
+ if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
10523
+ yh = crypto.getRandomValues.bind(crypto);
10524
+ }
10525
+ return yh(bh);
10526
+ }
10527
+ //#endregion
10528
+ //#region node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/v7.js
10529
+ var Sh = {};
10530
+ function Ch(e, t, n) {
10531
+ let r;
10532
+ if (e) r = Th(e.random ?? e.rng?.() ?? xh(), e.msecs, e.seq, t, n);
10533
+ else {
10534
+ let e = Date.now(), i = xh();
10535
+ wh(Sh, e, i), r = Th(i, Sh.msecs, Sh.seq, t, n);
10536
+ }
10537
+ return t ?? vh(r);
10538
+ }
10539
+ function wh(e, t, n) {
10540
+ return e.msecs ??= -Infinity, e.seq ??= 0, t > e.msecs ? (e.seq = n[6] << 23 | n[7] << 16 | n[8] << 8 | n[9], e.msecs = t) : (e.seq = e.seq + 1 | 0, e.seq === 0 && e.msecs++), e;
10541
+ }
10542
+ function Th(e, t, n, r, i = 0) {
10543
+ if (e.length < 16) throw Error("Random bytes length must be >= 16");
10544
+ if (!r) r = /* @__PURE__ */ new Uint8Array(16), i = 0;
10545
+ else if (i < 0 || i + 16 > r.length) throw RangeError(`UUID byte range ${i}:${i + 15} is out of buffer bounds`);
10546
+ return t ??= Date.now(), n ??= e[6] * 127 << 24 | e[7] << 16 | e[8] << 8 | e[9], r[i++] = t / 1099511627776 & 255, r[i++] = t / 4294967296 & 255, r[i++] = t / 16777216 & 255, r[i++] = t / 65536 & 255, r[i++] = t / 256 & 255, r[i++] = t & 255, r[i++] = 112 | n >>> 28 & 15, r[i++] = n >>> 20 & 255, r[i++] = 128 | n >>> 14 & 63, r[i++] = n >>> 6 & 255, r[i++] = n << 2 & 255 | e[10] & 3, r[i++] = e[11], r[i++] = e[12], r[i++] = e[13], r[i++] = e[14], r[i++] = e[15], r;
10547
+ }
10548
+ //#endregion
10511
10549
  //#region src/features/composer/attachment-file-helpers.ts
10512
- var _h = ".jpg,.jpeg,.png,.webp,.gif,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.zip,.rar,.mp4,.mp3", vh = new Set(_h.slice(1).split(",.")), yh = /* @__PURE__ */ new Set([
10550
+ var Eh = ".jpg,.jpeg,.png,.webp,.gif,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.zip,.rar,.mp4,.mp3", Dh = new Set(Eh.slice(1).split(",.")), Oh = /* @__PURE__ */ new Set([
10513
10551
  "jpg",
10514
10552
  "jpeg",
10515
10553
  "png",
10516
10554
  "webp",
10517
10555
  "gif"
10518
- ]), bh = (e) => e.name.split(".").pop()?.toLowerCase() ?? "", xh = (e) => yh.has(bh(e)), Sh = {
10556
+ ]), kh = (e) => e.name.split(".").pop()?.toLowerCase() ?? "", Ah = (e) => Oh.has(kh(e)), jh = {
10519
10557
  "image/jpeg": "jpg",
10520
10558
  "image/png": "png",
10521
10559
  "image/webp": "webp",
10522
10560
  "image/gif": "gif"
10523
- }, Ch = (e) => {
10524
- if (xh(e)) return e;
10525
- let t = Sh[e.type];
10526
- return t ? new File([e], `anh-dan-${Date.now()}.${t}`, {
10561
+ }, Mh = (e) => {
10562
+ let t = jh[e.type] ?? (Ah(e) ? kh(e) : "");
10563
+ return t ? new File([e], `anh-dan-${Ch()}.${t}`, {
10527
10564
  type: e.type,
10528
10565
  lastModified: e.lastModified
10529
10566
  }) : e;
10530
- }, wh = (e) => [e.filter((e) => e.isImage), e.filter((e) => !e.isImage)].filter((e) => e.length > 0), Th = (e) => {
10531
- let t = e.filter((e) => vh.has(bh(e)));
10567
+ }, Nh = (e) => [e.filter((e) => e.isImage), e.filter((e) => !e.isImage)].filter((e) => e.length > 0), Ph = (e) => {
10568
+ let t = e.filter((e) => Dh.has(kh(e)));
10532
10569
  return {
10533
10570
  validFiles: t,
10534
10571
  hasRejectedFiles: t.length < e.length
10535
10572
  };
10536
- }, Eh = (e, t) => {
10537
- let n = !t?.forceDocument && xh(e);
10573
+ }, Fh = (e, t) => {
10574
+ let n = !t?.forceDocument && Ah(e);
10538
10575
  return {
10539
10576
  file: e,
10540
10577
  isImage: n,
10541
10578
  previewUrl: n ? URL.createObjectURL(e) : void 0
10542
10579
  };
10543
- }, Dh = (e) => {
10580
+ }, Ih = (e) => {
10544
10581
  e.previewUrl && URL.revokeObjectURL(e.previewUrl);
10545
10582
  };
10546
10583
  //#endregion
10547
10584
  //#region src/features/composer/use-pending-attachments.ts
10548
- function Oh() {
10585
+ function Lh() {
10549
10586
  let [e, t] = x([]);
10550
10587
  return {
10551
10588
  pendingAttachments: e,
10552
10589
  addFiles: f((e, n) => {
10553
- let { validFiles: r, hasRejectedFiles: i } = Th(e);
10554
- return r.length && t((e) => [...e, ...r.map((e) => Eh(e, n))]), i;
10590
+ let { validFiles: r, hasRejectedFiles: i } = Ph(e);
10591
+ return r.length && t((e) => [...e, ...r.map((e) => Fh(e, n))]), i;
10555
10592
  }, []),
10556
10593
  removeAt: f((e) => {
10557
10594
  t((t) => {
10558
10595
  let n = t[e];
10559
- return n && Dh(n), t.filter((t, n) => n !== e);
10596
+ return n && Ih(n), t.filter((t, n) => n !== e);
10560
10597
  });
10561
10598
  }, []),
10562
10599
  clear: f(() => {
10563
10600
  t([]);
10564
10601
  }, []),
10565
10602
  discardAll: f(() => {
10566
- t((e) => (e.forEach(Dh), []));
10603
+ t((e) => (e.forEach(Ih), []));
10567
10604
  }, [])
10568
10605
  };
10569
10606
  }
10570
10607
  //#endregion
10571
10608
  //#region src/features/composer/use-attachment-upload.ts
10572
- function kh(e, t, n) {
10609
+ function Rh(e, t, n) {
10573
10610
  return f(async (r) => {
10574
10611
  if (!r.files?.length || !r.conversationId) {
10575
10612
  t(r, "upload");
@@ -10610,17 +10647,17 @@ function kh(e, t, n) {
10610
10647
  }
10611
10648
  //#endregion
10612
10649
  //#region src/features/message-window/use-message-window.ts
10613
- var Ah = 1e5, jh = 1e3, Mh = {
10650
+ var zh = 1e5, Bh = 1e3, Vh = {
10614
10651
  oldestSequence: null,
10615
10652
  newestSequence: null,
10616
10653
  hasOlderMessages: !1,
10617
10654
  hasNewerMessages: !1
10618
- }, Nh = (e) => {
10655
+ }, Hh = (e) => {
10619
10656
  let t = String(e ?? "");
10620
10657
  return /^\d+$/.test(t) ? BigInt(t) : null;
10621
10658
  };
10622
- function Ph(e) {
10623
- let [t, n] = x([]), [r, i] = x(Mh), [a, o] = x(Ah), [s, c] = x("latest"), [l, u] = x(null), [d, p] = x(null), [m, g] = x(0), [_, y] = x(!1), [S, C] = x(!1), [w, T] = x(!1), [E, D] = x(!1), [O, k] = x(!1), A = b(!1), [j, M] = x(!0), [N, P] = x(""), ee = b(/* @__PURE__ */ new Map()), te = b(e), ne = b([]), re = b(Mh), ie = b("latest"), ae = b(!0), F = b(null), I = b({
10659
+ function Uh(e) {
10660
+ let [t, n] = x([]), [r, i] = x(Vh), [a, o] = x(zh), [s, c] = x("latest"), [l, u] = x(null), [d, p] = x(null), [m, g] = x(0), [_, y] = x(!1), [S, C] = x(!1), [w, T] = x(!1), [E, D] = x(!1), [O, k] = x(!1), A = b(!1), [j, M] = x(!0), [N, P] = x(""), ee = b(/* @__PURE__ */ new Map()), te = b(e), ne = b([]), re = b(Vh), ie = b("latest"), ae = b(!0), F = b(null), I = b({
10624
10661
  latest: !1,
10625
10662
  older: !1,
10626
10663
  newer: !1,
@@ -10630,8 +10667,8 @@ function Ph(e) {
10630
10667
  older: null,
10631
10668
  newer: null
10632
10669
  }), R = b(0), oe = b(!1), se = b(!1), [ce, le] = x(e);
10633
- ce !== e && (le(e), n([]), i(Mh), o(Ah), c("latest"), u(null), p(null), k(!1), A.current = !1, M(!0), P(""), ee.current.clear()), v(() => {
10634
- te.current = e, R.current += 1, ne.current = [], re.current = Mh, ie.current = "latest", ae.current = !0, F.current = null, oe.current = !1, I.current = {
10670
+ ce !== e && (le(e), n([]), i(Vh), o(zh), c("latest"), u(null), p(null), k(!1), A.current = !1, M(!0), P(""), ee.current.clear()), v(() => {
10671
+ te.current = e, R.current += 1, ne.current = [], re.current = Vh, ie.current = "latest", ae.current = !0, F.current = null, oe.current = !1, I.current = {
10635
10672
  latest: !1,
10636
10673
  older: !1,
10637
10674
  newer: !1,
@@ -10652,12 +10689,12 @@ function Ph(e) {
10652
10689
  }, []), pe = f((e) => {
10653
10690
  L.current[e] = window.setTimeout(() => {
10654
10691
  e === "older" && C(!0), e === "newer" && T(!0);
10655
- }, jh);
10692
+ }, Bh);
10656
10693
  }, []), me = f((e) => {
10657
10694
  let t = L.current[e];
10658
10695
  t && window.clearTimeout(t), L.current[e] = null, e === "older" && C(!1), e === "newer" && T(!1);
10659
10696
  }, []), he = f((e) => {
10660
- let t = Nh(e ?? null), n = Nh(F.current);
10697
+ let t = Hh(e ?? null), n = Hh(F.current);
10661
10698
  t === null || n !== null && t <= n || (F.current = t.toString());
10662
10699
  }, []), ge = f((t) => {
10663
10700
  let n = ci(t), r = n.messages.map((t) => na(t, e)).map(ue).filter((t) => V(t.conversationId, e));
@@ -10676,7 +10713,7 @@ function Ph(e) {
10676
10713
  newestSequence: i.newestSequence,
10677
10714
  hasOlderMessages: i.hasOlderMessages,
10678
10715
  hasNewerMessages: i.hasNewerMessages
10679
- }), o(Ah), ie.current = t, c(t), u(s), p(s ? a.findIndex((e) => V(e.id, s)) : null), i;
10716
+ }), o(zh), ie.current = t, c(t), u(s), p(s ? a.findIndex((e) => V(e.id, s)) : null), i;
10680
10717
  }, [ge, de]), ve = f((e, t) => {
10681
10718
  let r = ge(e), i = ne.current, a = ca(i, r.messages), s = Math.max(0, a.length - i.length);
10682
10719
  return ne.current = a, n(a), t === "older" ? (o((e) => e - s), de({
@@ -10793,7 +10830,7 @@ function Ph(e) {
10793
10830
  ]), Te = f((t) => {
10794
10831
  let r = t?.data ?? t, i = ue(na(r, e));
10795
10832
  if (!V(i.conversationId, e)) return;
10796
- let a = F.current, o = Nh(i.sequence ?? null), s = Nh(a);
10833
+ let a = F.current, o = Hh(i.sequence ?? null), s = Hh(a);
10797
10834
  if (he(i.sequence), !Ce()) {
10798
10835
  fe(!0);
10799
10836
  return;
@@ -10854,7 +10891,7 @@ function Ph(e) {
10854
10891
  e && re.current.hasNewerMessages && Se();
10855
10892
  }, [ye, Se]);
10856
10893
  return h(() => {
10857
- te.current = e, R.current += 1, ne.current = [], re.current = Mh, ie.current = "latest", ae.current = !0, F.current = null, ee.current.clear(), oe.current = !1, I.current = {
10894
+ te.current = e, R.current += 1, ne.current = [], re.current = Vh, ie.current = "latest", ae.current = !0, F.current = null, ee.current.clear(), oe.current = !1, I.current = {
10858
10895
  latest: !1,
10859
10896
  older: !1,
10860
10897
  newer: !1,
@@ -10896,24 +10933,24 @@ function Ph(e) {
10896
10933
  }
10897
10934
  //#endregion
10898
10935
  //#region src/store/messageRemovalStore.ts
10899
- var Fh = Br((e) => ({
10936
+ var Wh = Br((e) => ({
10900
10937
  lastRemoval: null,
10901
10938
  noteRemoval: (t, n) => e((e) => ({ lastRemoval: {
10902
10939
  conversationId: String(t),
10903
10940
  messageId: String(n),
10904
10941
  token: (e.lastRemoval?.token ?? 0) + 1
10905
10942
  } }))
10906
- })), Ih = (e) => {
10943
+ })), Gh = (e) => {
10907
10944
  let t = e?.data ?? e;
10908
10945
  return Array.isArray(t?.items) ? t.items : [];
10909
- }, Lh = (e, t) => {
10946
+ }, Kh = (e, t) => {
10910
10947
  let n = na(e?.data ?? e, t);
10911
10948
  return V(n.conversationId, t) ? n : null;
10912
- }, Rh = (e, t) => e.some((e) => String(e.id ?? "") === t), zh = (e) => {
10913
- let t = Fh((e) => e.lastRemoval);
10949
+ }, qh = (e, t) => e.some((e) => String(e.id ?? "") === t), Jh = (e) => {
10950
+ let t = Wh((e) => e.lastRemoval);
10914
10951
  return !e || !t ? null : V(t.conversationId, e) ? t.messageId : null;
10915
10952
  };
10916
- function Bh(e) {
10953
+ function Yh(e) {
10917
10954
  let [t, n] = x(null), [r, i] = x([]), [a, o] = x([]), [s, c] = x(null), [l, u] = x(""), d = b({}), p = b({
10918
10955
  media: r,
10919
10956
  file: a
@@ -10928,7 +10965,7 @@ function Bh(e) {
10928
10965
  if (e) {
10929
10966
  d.current[n] = r, c(n), u("");
10930
10967
  try {
10931
- let a = Ih(await Bs(e, {
10968
+ let a = Gh(await Bs(e, {
10932
10969
  type: n,
10933
10970
  senderId: t,
10934
10971
  from: r?.from,
@@ -10945,18 +10982,18 @@ function Bh(e) {
10945
10982
  h(() => {
10946
10983
  if (e) return Zs({
10947
10984
  onMessageSent: (t) => {
10948
- let n = Lh(t, e);
10985
+ let n = Kh(t, e);
10949
10986
  n && (n.type === "IMAGE" ? m("media", d.current.media) : n.type === "DOCUMENT" && m("file", d.current.file));
10950
10987
  },
10951
10988
  onMessageNew: (t) => {
10952
- let n = Lh(t, e);
10989
+ let n = Kh(t, e);
10953
10990
  n && (n.type === "IMAGE" ? m("media", d.current.media) : n.type === "DOCUMENT" && m("file", d.current.file));
10954
10991
  }
10955
10992
  });
10956
10993
  }, [e, m]);
10957
- let g = zh(e);
10994
+ let g = Jh(e);
10958
10995
  return h(() => {
10959
- g && (Rh(p.current.media, g) && m("media", d.current.media), Rh(p.current.file, g) && m("file", d.current.file));
10996
+ g && (qh(p.current.media, g) && m("media", d.current.media), qh(p.current.file, g) && m("file", d.current.file));
10960
10997
  }, [g]), {
10961
10998
  error: l,
10962
10999
  fileItems: a,
@@ -10967,7 +11004,7 @@ function Bh(e) {
10967
11004
  setSenderId: n
10968
11005
  };
10969
11006
  }
10970
- function Vh(e) {
11007
+ function Xh(e) {
10971
11008
  let [t, n] = x([]), [r, i] = x([]), a = b({
10972
11009
  media: t,
10973
11010
  file: r
@@ -10980,7 +11017,7 @@ function Vh(e) {
10980
11017
  }, [t, r]);
10981
11018
  let o = b(!0), s = f(() => {
10982
11019
  e && Promise.all([Bs(e, { type: "media" }), Bs(e, { type: "file" })]).then(([t, r]) => {
10983
- o.current && (n(Ih(t).map((t) => na(t, e))), i(Ih(r).map((t) => na(t, e))));
11020
+ o.current && (n(Gh(t).map((t) => na(t, e))), i(Gh(r).map((t) => na(t, e))));
10984
11021
  }).catch(() => {
10985
11022
  o.current && (n([]), i([]));
10986
11023
  });
@@ -10990,11 +11027,11 @@ function Vh(e) {
10990
11027
  o.current = !0, s();
10991
11028
  let t = Zs({
10992
11029
  onMessageSent: (t) => {
10993
- let n = Lh(t, e);
11030
+ let n = Kh(t, e);
10994
11031
  (n?.type === "IMAGE" || n?.type === "DOCUMENT") && s();
10995
11032
  },
10996
11033
  onMessageNew: (t) => {
10997
- let n = Lh(t, e);
11034
+ let n = Kh(t, e);
10998
11035
  (n?.type === "IMAGE" || n?.type === "DOCUMENT") && s();
10999
11036
  }
11000
11037
  });
@@ -11002,53 +11039,15 @@ function Vh(e) {
11002
11039
  o.current = !1, t();
11003
11040
  };
11004
11041
  }, [e, s]);
11005
- let c = zh(e);
11042
+ let c = Jh(e);
11006
11043
  return h(() => {
11007
- c && (Rh(a.current.media, c) || Rh(a.current.file, c)) && s();
11044
+ c && (qh(a.current.media, c) || qh(a.current.file, c)) && s();
11008
11045
  }, [c]), {
11009
11046
  filePreview: r,
11010
11047
  mediaPreview: t
11011
11048
  };
11012
11049
  }
11013
11050
  //#endregion
11014
- //#region node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/stringify.js
11015
- var Hh = [];
11016
- for (let e = 0; e < 256; ++e) Hh.push((e + 256).toString(16).slice(1));
11017
- function Uh(e, t = 0) {
11018
- return (Hh[e[t + 0]] + Hh[e[t + 1]] + Hh[e[t + 2]] + Hh[e[t + 3]] + "-" + Hh[e[t + 4]] + Hh[e[t + 5]] + "-" + Hh[e[t + 6]] + Hh[e[t + 7]] + "-" + Hh[e[t + 8]] + Hh[e[t + 9]] + "-" + Hh[e[t + 10]] + Hh[e[t + 11]] + Hh[e[t + 12]] + Hh[e[t + 13]] + Hh[e[t + 14]] + Hh[e[t + 15]]).toLowerCase();
11019
- }
11020
- //#endregion
11021
- //#region node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/rng.js
11022
- var Wh, Gh = /* @__PURE__ */ new Uint8Array(16);
11023
- function Kh() {
11024
- if (!Wh) {
11025
- if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
11026
- Wh = crypto.getRandomValues.bind(crypto);
11027
- }
11028
- return Wh(Gh);
11029
- }
11030
- //#endregion
11031
- //#region node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm-browser/v7.js
11032
- var qh = {};
11033
- function Jh(e, t, n) {
11034
- let r;
11035
- if (e) r = Xh(e.random ?? e.rng?.() ?? Kh(), e.msecs, e.seq, t, n);
11036
- else {
11037
- let e = Date.now(), i = Kh();
11038
- Yh(qh, e, i), r = Xh(i, qh.msecs, qh.seq, t, n);
11039
- }
11040
- return t ?? Uh(r);
11041
- }
11042
- function Yh(e, t, n) {
11043
- return e.msecs ??= -Infinity, e.seq ??= 0, t > e.msecs ? (e.seq = n[6] << 23 | n[7] << 16 | n[8] << 8 | n[9], e.msecs = t) : (e.seq = e.seq + 1 | 0, e.seq === 0 && e.msecs++), e;
11044
- }
11045
- function Xh(e, t, n, r, i = 0) {
11046
- if (e.length < 16) throw Error("Random bytes length must be >= 16");
11047
- if (!r) r = /* @__PURE__ */ new Uint8Array(16), i = 0;
11048
- else if (i < 0 || i + 16 > r.length) throw RangeError(`UUID byte range ${i}:${i + 15} is out of buffer bounds`);
11049
- return t ??= Date.now(), n ??= e[6] * 127 << 24 | e[7] << 16 | e[8] << 8 | e[9], r[i++] = t / 1099511627776 & 255, r[i++] = t / 4294967296 & 255, r[i++] = t / 16777216 & 255, r[i++] = t / 65536 & 255, r[i++] = t / 256 & 255, r[i++] = t & 255, r[i++] = 112 | n >>> 28 & 15, r[i++] = n >>> 20 & 255, r[i++] = 128 | n >>> 14 & 63, r[i++] = n >>> 6 & 255, r[i++] = n << 2 & 255 | e[10] & 3, r[i++] = e[11], r[i++] = e[12], r[i++] = e[13], r[i++] = e[14], r[i++] = e[15], r;
11050
- }
11051
- //#endregion
11052
11051
  //#region src/store/forwardStore.ts
11053
11052
  var Zh = Br((e) => ({
11054
11053
  forwardSource: null,
@@ -11074,7 +11073,7 @@ function Qh({ onForwarded: e }) {
11074
11073
  try {
11075
11074
  if (!ym(oc({
11076
11075
  conversationId: e,
11077
- clientMessageId: Jh(),
11076
+ clientMessageId: Ch(),
11078
11077
  type: "TEXT",
11079
11078
  content: [{
11080
11079
  type: "text",
@@ -11090,7 +11089,7 @@ function Qh({ onForwarded: e }) {
11090
11089
  });
11091
11090
  let a = {};
11092
11091
  n.forEach((e) => {
11093
- a[e] = Jh();
11092
+ a[e] = Ch();
11094
11093
  });
11095
11094
  try {
11096
11095
  if (!ym(uc({
@@ -11325,7 +11324,10 @@ function ag({ open: e, title: t, children: n, onClose: r, footer: i, width: a =
11325
11324
  width: a,
11326
11325
  footer: i ?? null,
11327
11326
  ...o ? { getContainer: !1 } : {},
11328
- children: n
11327
+ children: o ? n : /* @__PURE__ */ w("div", {
11328
+ className: "med-chat-root med-chat-root--portal",
11329
+ children: n
11330
+ })
11329
11331
  });
11330
11332
  }
11331
11333
  //#endregion
@@ -57890,7 +57892,7 @@ var yV = /* @__PURE__ */ new Map(), bV = /* @__PURE__ */ new Set(), xV = 2, SV =
57890
57892
  let be = f((t) => {
57891
57893
  if (!V(t.conversationId, e)) return;
57892
57894
  let n = String(t.messageId);
57893
- Fh.getState().noteRemoval(String(t.conversationId), n), ve.clearIfTarget(n), me.clearIfTarget(n), ge.clearIfTarget(n), ye.clearIfTarget(n), he.clearIfTarget(n), le(t);
57895
+ Wh.getState().noteRemoval(String(t.conversationId), n), ve.clearIfTarget(n), me.clearIfTarget(n), ge.clearIfTarget(n), ye.clearIfTarget(n), he.clearIfTarget(n), le(t);
57894
57896
  }, [
57895
57897
  e,
57896
57898
  ye.clearIfTarget,
@@ -62283,7 +62285,7 @@ var DK = u(function({ draftKey: e, conversationName: t, members: n, canMentionAl
62283
62285
  },
62284
62286
  transformPastedHTML: (e) => uK(iK(e)),
62285
62287
  handlePaste: (e, t) => {
62286
- let n = Array.from(t.clipboardData?.files ?? []).filter((e) => e.type.startsWith("image/")).map(Ch);
62288
+ let n = Array.from(t.clipboardData?.files ?? []).filter((e) => e.type.startsWith("image/")).map(Mh);
62287
62289
  return n.length !== 0 && (t.preventDefault(), O.current?.(n), !0);
62288
62290
  },
62289
62291
  handleKeyDown: (e, t) => {
@@ -62480,9 +62482,9 @@ function OK({ target: e, avatarUrl: t, senderName: n, onCancel: r }) {
62480
62482
  var kK = u(function({ conversationId: e, currentUserId: t, conversationTitle: n, composerPlaceholder: r, isCompactComposer: i, mentionMembers: a, canMentionAll: o, isGroup: s, disabled: c, lockedReason: l, pendingAttachmentsState: u, replyTargetState: d, replySenderName: f, replySenderAvatarUrl: p, emitOutgoingMessage: m, markMessageFailed: g, mergeOutgoingMessage: v, stickToLatest: y, onComposerError: S, onAttach: E, onAttachImages: D, onTypingStart: O, onTypingStop: k, uploadInputRef: A, imageUploadInputRef: j, acceptAttribute: M }, N) {
62481
62483
  let P = b(null), ee = b(null);
62482
62484
  _(N, () => ({ focusComposer: () => P.current?.focus() }), []);
62483
- let te = kh(m, g, v), ne = (n, r) => {
62485
+ let te = Rh(m, g, v), ne = (n, r) => {
62484
62486
  if (!e) return;
62485
- let i = Jh();
62487
+ let i = Ch();
62486
62488
  te({
62487
62489
  id: i,
62488
62490
  clientMessageId: i,
@@ -62504,7 +62506,7 @@ var kK = u(function({ conversationId: e, currentUserId: t, conversationTitle: n,
62504
62506
  });
62505
62507
  }, re = (n, r) => {
62506
62508
  if (!e) return;
62507
- let i = Jh();
62509
+ let i = Ch();
62508
62510
  m({
62509
62511
  id: i,
62510
62512
  clientMessageId: i,
@@ -62527,7 +62529,7 @@ var kK = u(function({ conversationId: e, currentUserId: t, conversationTitle: n,
62527
62529
  if (Wi({ content: n }).length > 3e3) return vm.error(`Tin nhắn không được dài quá ${Ui} ký tự`), !1;
62528
62530
  if (r.length > 0) {
62529
62531
  let e = zi(n);
62530
- e && re(n, d.replyTarget?.id ?? null), wh(r).forEach((t, n) => ne(t, !e && n === 0 ? d.replyTarget?.id ?? null : null)), u.clear();
62532
+ e && re(n, d.replyTarget?.id ?? null), Nh(r).forEach((t, n) => ne(t, !e && n === 0 ? d.replyTarget?.id ?? null : null)), u.clear();
62531
62533
  } else re(n, d.replyTarget?.id ?? null);
62532
62534
  return S(""), d.clearReply(), y(), !0;
62533
62535
  };
@@ -62637,9 +62639,9 @@ function AK({ typingNames: e }) {
62637
62639
  //#endregion
62638
62640
  //#region src/pages/conversation/index.tsx
62639
62641
  var jK = u(function({ conversationId: e, conversation: t, isLoadingConversation: n, currentUserId: r, authUser: i, accessToken: a, isSettingsOpen: o, onToggleSettings: s, onOpenSearch: c, onEditTitle: l, onOpenMembers: u, onOpenUserProfile: d, onNavigateBack: p, onOpenFullPage: m, onCloseConversation: v, composerPlaceholder: S, isCompactComposer: E }, D) {
62640
- let O = g(), [k, A] = x(""), j = String(t?.type ?? "").toUpperCase(), M = j === "GROUP", N = qF(e, j, r), P = jm((e) => e.hasUpdateGroupVerified), ee = !!t?.isVerified && !P, [te, ne] = x(!1), re = gh(e), ie = Oh(), ae = ch(), F = b(null), I = b(null), L = b(null), R = b(null), oe = b(null), se = b(null), [ce, le] = x(e);
62642
+ let O = g(), [k, A] = x(""), j = String(t?.type ?? "").toUpperCase(), M = j === "GROUP", N = qF(e, j, r), P = jm((e) => e.hasUpdateGroupVerified), ee = !!t?.isVerified && !P, [te, ne] = x(!1), re = gh(e), ie = Lh(), ae = ch(), F = b(null), I = b(null), L = b(null), R = b(null), oe = b(null), se = b(null), [ce, le] = x(e);
62641
62643
  ce !== e && (le(e), N.reset(), ne(!1));
62642
- let ue = Bh(e), z = Ph(e), { virtuosoRef: de, stickToLatestRef: fe, visibleDayLabel: pe, isNearBottomOfList: me, scrollToLatest: he, stickToLatest: ge, handleTimelineScrolling: _e, handleVisibleRangeChanged: ve, setScrollerRef: ye } = hh(z.messages, z.firstItemIndex, () => R.current?.closeMessageMenu()), { clearFocusedMessage: be, completeAroundFocus: xe, handleRealtimeMessage: Se, isFollowingLatest: Ce, loadAround: we, wasLastAroundNotFound: Te, loadLatest: Ee, reconcile: De, applyMessageRemoved: Oe, isRemovedMessageId: ke, updateMessageReactionSummary: Ae } = z, je = Qh({ onForwarded: ge }), Me = gm((t) => t.historyClearedTokenByConversation[e ?? ""] ?? 0), Ne = b(null);
62644
+ let ue = Yh(e), z = Uh(e), { virtuosoRef: de, stickToLatestRef: fe, visibleDayLabel: pe, isNearBottomOfList: me, scrollToLatest: he, stickToLatest: ge, handleTimelineScrolling: _e, handleVisibleRangeChanged: ve, setScrollerRef: ye } = hh(z.messages, z.firstItemIndex, () => R.current?.closeMessageMenu()), { clearFocusedMessage: be, completeAroundFocus: xe, handleRealtimeMessage: Se, isFollowingLatest: Ce, loadAround: we, wasLastAroundNotFound: Te, loadLatest: Ee, reconcile: De, applyMessageRemoved: Oe, isRemovedMessageId: ke, updateMessageReactionSummary: Ae } = z, je = Qh({ onForwarded: ge }), Me = gm((t) => t.historyClearedTokenByConversation[e ?? ""] ?? 0), Ne = b(null);
62643
62645
  _(D, () => ({
62644
62646
  loadAround: we,
62645
62647
  focusComposer: () => oe.current?.focusComposer()
@@ -62849,7 +62851,7 @@ var jK = u(function({ conversationId: e, conversation: t, isLoadingConversation:
62849
62851
  Ye,
62850
62852
  z,
62851
62853
  Ce
62852
- ]), Ze = kh(Xe, Ye, z.mergeOutgoingMessage), Qe = f((e) => {
62854
+ ]), Ze = Rh(Xe, Ye, z.mergeOutgoingMessage), Qe = f((e) => {
62853
62855
  if (e.type === "TEXT" || e.attachmentIds?.length && e.failureStage === "send") {
62854
62856
  Xe(e);
62855
62857
  return;
@@ -62956,7 +62958,7 @@ var jK = u(function({ conversationId: e, conversation: t, isLoadingConversation:
62956
62958
  onTypingStop: () => e && pc({ conversationId: e }),
62957
62959
  uploadInputRef: F,
62958
62960
  imageUploadInputRef: I,
62959
- acceptAttribute: _h
62961
+ acceptAttribute: Eh
62960
62962
  }),
62961
62963
  ae.imageLightbox ? /* @__PURE__ */ w(Fp, {
62962
62964
  state: ae.imageLightbox,
@@ -73237,7 +73239,7 @@ var d6 = {
73237
73239
  file: "Tài liệu"
73238
73240
  };
73239
73241
  function f6({ conversationId: e, initialTab: t, members: n, onBack: r, onForwardMessage: i, onJumpToMessage: a }) {
73240
- let [o, s] = x(t), [c, l] = x(Z3), [u, d] = x("all"), [f, p] = x(""), [m, g] = x(null), [_, v] = x(null), y = Bh(e), b = (e) => {
73242
+ let [o, s] = x(t), [c, l] = x(Z3), [u, d] = x("all"), [f, p] = x(""), [m, g] = x(null), [_, v] = x(null), y = Yh(e), b = (e) => {
73241
73243
  s(e), p(""), d("all");
73242
73244
  }, S = (e) => {
73243
73245
  let t = n.find((t) => Yp(t) === e);
@@ -73438,9 +73440,9 @@ function p6({ conversation: e, conversationId: t, onClose: n, onConversationUpda
73438
73440
  })]
73439
73441
  })
73440
73442
  }),
73441
- o ? null : /* @__PURE__ */ w("p", {
73443
+ /* @__PURE__ */ w("p", {
73442
73444
  className: "group-manage-hint",
73443
- children: "Chỉ trưởng nhóm mới có quyền gửi tin nhắn vào nhóm này."
73445
+ children: "Bật: mọi thành viên trong nhóm đều gửi được tin nhắn. Tắt: chỉ trưởng nhóm mới được gửi tin nhắn vào nhóm này."
73444
73446
  })
73445
73447
  ]
73446
73448
  })]
@@ -73734,12 +73736,12 @@ function v6({ members: e, memberCountLabel: t, currentUserId: n, isOwner: r, isL
73734
73736
  onClose: l,
73735
73737
  medium: !0,
73736
73738
  children: [
73737
- r && !_ ? /* @__PURE__ */ T("button", {
73739
+ /* @__PURE__ */ T("button", {
73738
73740
  className: "chat-modal-quick-add",
73739
73741
  type: "button",
73740
73742
  onClick: u,
73741
73743
  children: [/* @__PURE__ */ w(xr, {}), "Thêm thành viên"]
73742
- }) : null,
73744
+ }),
73743
73745
  /* @__PURE__ */ w("div", {
73744
73746
  className: "chat-modal-list-header",
73745
73747
  children: /* @__PURE__ */ T("strong", { children: [
@@ -74012,7 +74014,7 @@ function b6({ conversationId: e, currentUserId: t, onConversationUpdated: n, onD
74012
74014
  n
74013
74015
  ]), ce = f(async (t) => {
74014
74016
  if (!e || O) return !1;
74015
- if (!xh(t)) return vm.error("Ảnh đại diện chỉ nhận file jpg, jpeg, png, webp, gif"), !1;
74017
+ if (!Ah(t)) return vm.error("Ảnh đại diện chỉ nhận file jpg, jpeg, png, webp, gif"), !1;
74016
74018
  k(!0);
74017
74019
  try {
74018
74020
  let r = await Hs(t, e), i = r?.data ?? r ?? {};
@@ -74088,7 +74090,7 @@ function b6({ conversationId: e, currentUserId: t, onConversationUpdated: n, onD
74088
74090
  //#endregion
74089
74091
  //#region src/pages/Setting/conversation-settings-panel.tsx
74090
74092
  function x6({ conversation: e, conversationId: t, currentUserId: n, onClose: r, onConversationUpdated: i, onDeleteSuccess: a, onLeaveSuccess: o, onMembersChanged: s, onStartChat: c, onForwardMessage: l, onJumpToMessage: u }) {
74091
- let [d, f] = x(null), [p, m] = x(null), [h, g] = x(!1), [_, v] = x(""), [y, S] = x(null), [E, D] = x(null), O = b(null), { filePreview: k, mediaPreview: A } = Vh(t), j = e ? oi(e, n) : "Cuộc trò chuyện", M = ii(e), P = M ? void 0 : e?.members?.find((e) => !V(Yp(e) ?? "", n ?? "")), ee = P ? Jp(P) : void 0, te = ee ? [ee.departmentName, ee.jobTitleName].filter(Boolean).join(" · ") : "", ne = ee?.workStatusName?.trim() ?? "", re = jm((e) => e.hasUpdateGroupVerified), ie = jm((e) => e.hasDeleteGroupVerified), ae = !!e?.isVerified && !re, F = !!e?.isVerified && !ie, I = b6({
74093
+ let [d, f] = x(null), [p, m] = x(null), [h, g] = x(!1), [_, v] = x(""), [y, S] = x(null), [E, D] = x(null), O = b(null), { filePreview: k, mediaPreview: A } = Xh(t), j = e ? oi(e, n) : "Cuộc trò chuyện", M = ii(e), P = M ? void 0 : e?.members?.find((e) => !V(Yp(e) ?? "", n ?? "")), ee = P ? Jp(P) : void 0, te = ee ? [ee.departmentName, ee.jobTitleName].filter(Boolean).join(" · ") : "", ne = ee?.workStatusName?.trim() ?? "", re = jm((e) => e.hasUpdateGroupVerified), ie = jm((e) => e.hasDeleteGroupVerified), ae = !!e?.isVerified && !re, F = !!e?.isVerified && !ie, I = b6({
74092
74094
  conversationId: t,
74093
74095
  currentUserId: n,
74094
74096
  onConversationUpdated: i,
@@ -74222,7 +74224,7 @@ function x6({ conversation: e, conversationId: t, currentUserId: n, onClose: r,
74222
74224
  /* @__PURE__ */ T("div", {
74223
74225
  className: "settings-row-list",
74224
74226
  children: [
74225
- M && I.isOwner && !ae ? /* @__PURE__ */ T("button", {
74227
+ M ? /* @__PURE__ */ T("button", {
74226
74228
  className: "settings-row",
74227
74229
  type: "button",
74228
74230
  onClick: L,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipha/chat",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "Embeddable Medic-ERP chat module for React applications.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",