@nethesis/chat-island 0.1.11 → 0.1.13
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/components/NewChat.d.ts +2 -1
- package/dist/index.js +224 -214
- package/dist/xmpp.d.ts +4 -0
- package/dist-widget/index.widget.js +6 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2293,7 +2293,7 @@ function hn(e, ...t) {
|
|
|
2293
2293
|
}
|
|
2294
2294
|
//#endregion
|
|
2295
2295
|
//#region src/xmpp.ts
|
|
2296
|
-
var U = {
|
|
2296
|
+
var gn = "chat.internal", U = {
|
|
2297
2297
|
carbons: "urn:xmpp:carbons:2",
|
|
2298
2298
|
forward: "urn:xmpp:forward:0",
|
|
2299
2299
|
mam: "urn:xmpp:mam:2",
|
|
@@ -2323,7 +2323,7 @@ var U = {
|
|
|
2323
2323
|
reactions: "urn:xmpp:reactions:0",
|
|
2324
2324
|
reply: "urn:xmpp:reply:0",
|
|
2325
2325
|
fallback: "urn:xmpp:fallback:0"
|
|
2326
|
-
},
|
|
2326
|
+
}, _n = 3e4, vn = class {
|
|
2327
2327
|
xmpp;
|
|
2328
2328
|
me;
|
|
2329
2329
|
domain;
|
|
@@ -2341,9 +2341,9 @@ var U = {
|
|
|
2341
2341
|
cfg;
|
|
2342
2342
|
h;
|
|
2343
2343
|
constructor(e, t) {
|
|
2344
|
-
this.cfg = e, this.h = t, this.domain =
|
|
2344
|
+
this.cfg = e, this.h = t, this.domain = gn, this.mucHost = `conference.${gn}`, this.me = `${e.username}@${gn}`, this.xmpp = mn({
|
|
2345
2345
|
service: `wss://${e.host}/xmpp-websocket`,
|
|
2346
|
-
domain:
|
|
2346
|
+
domain: gn,
|
|
2347
2347
|
username: e.username,
|
|
2348
2348
|
password: e.token,
|
|
2349
2349
|
resource: "chat-island." + Math.random().toString(36).slice(2, 8)
|
|
@@ -2351,7 +2351,7 @@ var U = {
|
|
|
2351
2351
|
this.stopped || this.unauthorized || ((e === "connecting" || e === "opening" || e === "connect") && this.h.status("connecting"), (e === "disconnect" || e === "close") && (this.connected = !1, window.clearInterval(this.pingTimer), this.forgetPresence(), this.h.status("offline")), e === "disconnect" && this.scheduleRetry());
|
|
2352
2352
|
}), this.xmpp.on("error", (e) => {
|
|
2353
2353
|
if (!this.stopped) {
|
|
2354
|
-
if (
|
|
2354
|
+
if (bn(e)) {
|
|
2355
2355
|
this.unauthorized = !0, window.clearTimeout(this.retryTimer), this.h.status("unauthorized", e.message);
|
|
2356
2356
|
return;
|
|
2357
2357
|
}
|
|
@@ -2371,7 +2371,7 @@ var U = {
|
|
|
2371
2371
|
} catch {
|
|
2372
2372
|
return;
|
|
2373
2373
|
}
|
|
2374
|
-
window.clearInterval(this.pingTimer), this.pingTimer = window.setInterval(() => this.ping(),
|
|
2374
|
+
window.clearInterval(this.pingTimer), this.pingTimer = window.setInterval(() => this.ping(), _n), this.h.status("online");
|
|
2375
2375
|
}), this.xmpp.on("stanza", (e) => this.onStanza(e));
|
|
2376
2376
|
}
|
|
2377
2377
|
start() {
|
|
@@ -2410,7 +2410,7 @@ var U = {
|
|
|
2410
2410
|
let e = this.xmpp;
|
|
2411
2411
|
(e.status === "offline" ? this.xmpp.start() : e.connect(e.options.service).then(() => e.open({ domain: e.options.domain }))).catch((e) => {
|
|
2412
2412
|
if (!this.stopped) {
|
|
2413
|
-
if (
|
|
2413
|
+
if (bn(e)) {
|
|
2414
2414
|
this.unauthorized = !0, this.h.status("unauthorized", e.message);
|
|
2415
2415
|
return;
|
|
2416
2416
|
}
|
|
@@ -2734,7 +2734,7 @@ var U = {
|
|
|
2734
2734
|
if (e && r) {
|
|
2735
2735
|
let t = this.reactionOf(e);
|
|
2736
2736
|
t && this.mamReactions.get(n.attrs.queryid)?.push(t);
|
|
2737
|
-
let i = t ? void 0 : this.toMessage(e, n.attrs.id,
|
|
2737
|
+
let i = t ? void 0 : this.toMessage(e, n.attrs.id, xn(n.getChild("forwarded", U.forward)));
|
|
2738
2738
|
i && r.push(i);
|
|
2739
2739
|
}
|
|
2740
2740
|
return;
|
|
@@ -2749,7 +2749,7 @@ var U = {
|
|
|
2749
2749
|
let i = e.getChild("event", U.pubsubEvent);
|
|
2750
2750
|
if (i?.getChild("items")?.attrs.node === U.mucsubConfig) {
|
|
2751
2751
|
let t = W(e.attrs.from);
|
|
2752
|
-
this.isGroup(t) &&
|
|
2752
|
+
this.isGroup(t) && Sn(i, "presence")?.getChild("x", U.mucUser)?.getChild("destroy") && this.h.groupDestroyed(t);
|
|
2753
2753
|
return;
|
|
2754
2754
|
}
|
|
2755
2755
|
let a = e.getChild("x", U.conference);
|
|
@@ -2766,7 +2766,7 @@ var U = {
|
|
|
2766
2766
|
this.h.reaction(t);
|
|
2767
2767
|
return;
|
|
2768
2768
|
}
|
|
2769
|
-
let n = this.toMessage(e, e.getChild("stanza-id", U.sid)?.attrs.id,
|
|
2769
|
+
let n = this.toMessage(e, e.getChild("stanza-id", U.sid)?.attrs.id, xn(e));
|
|
2770
2770
|
if (n) {
|
|
2771
2771
|
this.h.message(n);
|
|
2772
2772
|
return;
|
|
@@ -2779,7 +2779,7 @@ var U = {
|
|
|
2779
2779
|
let t = e.getChild("event", U.pubsubEvent), n = e, r;
|
|
2780
2780
|
if (t && t.getChild("items")?.attrs.node === U.mucsubMessages) {
|
|
2781
2781
|
r = W(e.attrs.from);
|
|
2782
|
-
let i =
|
|
2782
|
+
let i = Cn(t);
|
|
2783
2783
|
if (!this.isGroup(r) || !i || W(i.attrs.from) !== r) return;
|
|
2784
2784
|
n = i;
|
|
2785
2785
|
} else if (e.attrs.type === "groupchat" && (r = W(e.attrs.from), !this.isGroup(r))) return;
|
|
@@ -2806,14 +2806,22 @@ var U = {
|
|
|
2806
2806
|
}
|
|
2807
2807
|
toMessage(e, t, n) {
|
|
2808
2808
|
let r = this.parseMessage(e, t, n);
|
|
2809
|
-
|
|
2809
|
+
if (r?.oob) {
|
|
2810
|
+
let e = this.uploadUrl(r.oob);
|
|
2811
|
+
r.body = r.body === r.oob ? e : r.body, r.oob = e;
|
|
2812
|
+
}
|
|
2813
|
+
return r && yn(r, Sn(e, "reply") ? e.getChild("event", U.pubsubEvent) ? Cn(e.getChild("event", U.pubsubEvent)) : e : void 0);
|
|
2814
|
+
}
|
|
2815
|
+
uploadUrl(e) {
|
|
2816
|
+
let t = e.indexOf("/upload/");
|
|
2817
|
+
return /^https:\/\/[^/]+\/upload\//.test(e) ? `https://${this.cfg.host}${e.slice(t)}` : e;
|
|
2810
2818
|
}
|
|
2811
2819
|
parseMessage(e, t, n) {
|
|
2812
2820
|
let r = e.getChild("event", U.pubsubEvent);
|
|
2813
2821
|
if (r && r.getChild("items")?.attrs.node === U.mucsubMessages) {
|
|
2814
2822
|
let i = W(e.attrs.from);
|
|
2815
2823
|
if (!this.isGroup(i)) return;
|
|
2816
|
-
let a =
|
|
2824
|
+
let a = Cn(r);
|
|
2817
2825
|
if (!a || W(a.attrs.from) !== i) return;
|
|
2818
2826
|
let o = (a.attrs.from ?? "").split("/")[1] ?? "", s = a.getChildText("body");
|
|
2819
2827
|
return s == null ? void 0 : {
|
|
@@ -2822,7 +2830,7 @@ var U = {
|
|
|
2822
2830
|
from: i,
|
|
2823
2831
|
to: this.cfg.username,
|
|
2824
2832
|
body: s,
|
|
2825
|
-
ts:
|
|
2833
|
+
ts: xn(a) !== n && a.getChild("delay", U.delay) ? xn(a) : n,
|
|
2826
2834
|
mine: o === this.cfg.username,
|
|
2827
2835
|
oob: a.getChild("x", U.oob)?.getChildText("url") ?? void 0,
|
|
2828
2836
|
room: i,
|
|
@@ -2862,7 +2870,7 @@ var U = {
|
|
|
2862
2870
|
};
|
|
2863
2871
|
}
|
|
2864
2872
|
}, W = (e = "") => e.split("/")[0];
|
|
2865
|
-
function
|
|
2873
|
+
function yn(e, t) {
|
|
2866
2874
|
let n = t?.getChild("reply", U.reply);
|
|
2867
2875
|
if (!n?.attrs.id) return e;
|
|
2868
2876
|
let r = n.attrs.to ?? "", i = e.room ? r.split("/")[1] ?? "" : G(W(r)), a = t.getChildren("fallback", U.fallback).find((e) => e.attrs.for === U.reply)?.getChild("body"), o = [...e.body], s = Number(a?.attrs.start ?? 0), c = Number(a?.attrs.end ?? 0);
|
|
@@ -2884,20 +2892,20 @@ function vn(e, t) {
|
|
|
2884
2892
|
}
|
|
2885
2893
|
};
|
|
2886
2894
|
}
|
|
2887
|
-
var
|
|
2895
|
+
var bn = (e) => e.name === "SASLError" || e.condition === "not-authorized", G = (e = "") => e.split("@")[0], xn = (e) => {
|
|
2888
2896
|
let t = e?.getChild("delay", U.delay)?.attrs.stamp;
|
|
2889
2897
|
return t ? Date.parse(t) : Date.now();
|
|
2890
2898
|
};
|
|
2891
|
-
function
|
|
2899
|
+
function Sn(e, t) {
|
|
2892
2900
|
for (let n of e.children) {
|
|
2893
2901
|
if (typeof n == "string") continue;
|
|
2894
2902
|
if (n.name === t) return n;
|
|
2895
|
-
let e =
|
|
2903
|
+
let e = Sn(n, t);
|
|
2896
2904
|
if (e) return e;
|
|
2897
2905
|
}
|
|
2898
2906
|
}
|
|
2899
|
-
var
|
|
2900
|
-
function
|
|
2907
|
+
var Cn = (e) => Sn(e, "message"), K;
|
|
2908
|
+
function wn() {
|
|
2901
2909
|
try {
|
|
2902
2910
|
K ??= new AudioContext(), K.state === "suspended" && K.resume();
|
|
2903
2911
|
let e = K.currentTime;
|
|
@@ -2917,7 +2925,7 @@ function Cn() {
|
|
|
2917
2925
|
}
|
|
2918
2926
|
//#endregion
|
|
2919
2927
|
//#region node_modules/zustand/esm/vanilla.mjs
|
|
2920
|
-
var
|
|
2928
|
+
var Tn = (e) => {
|
|
2921
2929
|
let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
|
|
2922
2930
|
let i = typeof e == "function" ? e(t) : e;
|
|
2923
2931
|
if (!Object.is(i, t)) {
|
|
@@ -2934,15 +2942,15 @@ var wn = (e) => {
|
|
|
2934
2942
|
}
|
|
2935
2943
|
}, o = t = e(r, i, a);
|
|
2936
2944
|
return a;
|
|
2937
|
-
},
|
|
2938
|
-
function
|
|
2939
|
-
let r =
|
|
2940
|
-
return
|
|
2945
|
+
}, En = (e) => e ? Tn(e) : Tn, { useDebugValue: Dn } = e, { useSyncExternalStoreWithSelector: On } = l, kn = (e) => e;
|
|
2946
|
+
function An(e, t = kn, n) {
|
|
2947
|
+
let r = On(e.subscribe, e.getState, e.getServerState || e.getInitialState, t, n);
|
|
2948
|
+
return Dn(r), r;
|
|
2941
2949
|
}
|
|
2942
|
-
var
|
|
2943
|
-
let t = typeof e == "function" ?
|
|
2950
|
+
var jn = (e) => {
|
|
2951
|
+
let t = typeof e == "function" ? En(e) : e, n = (e, n) => An(t, e, n);
|
|
2944
2952
|
return Object.assign(n, t), n;
|
|
2945
|
-
},
|
|
2953
|
+
}, Mn = (e) => e ? jn(e) : jn, Nn = (e) => e.room ?? (e.mine ? e.to : e.from), q = (e, t) => ({
|
|
2946
2954
|
peer: e,
|
|
2947
2955
|
kind: t && e.endsWith("@" + t) ? "group" : "chat",
|
|
2948
2956
|
messages: [],
|
|
@@ -2950,13 +2958,13 @@ var An = (e) => {
|
|
|
2950
2958
|
typing: !1,
|
|
2951
2959
|
loaded: !1,
|
|
2952
2960
|
complete: !1
|
|
2953
|
-
}),
|
|
2961
|
+
}), Pn = (e, t, n, r) => {
|
|
2954
2962
|
if (e.includes(t)) return e;
|
|
2955
2963
|
let i = [t, ...e];
|
|
2956
2964
|
if (i.length <= n) return i;
|
|
2957
2965
|
let a = [...i].reverse().find((e) => e !== r);
|
|
2958
2966
|
return i.filter((e) => e !== a);
|
|
2959
|
-
}, J =
|
|
2967
|
+
}, Fn = (e, t) => e.id === t.id || !!e.oid && e.oid === t.oid, J = Mn((e, t) => ({
|
|
2960
2968
|
me: "",
|
|
2961
2969
|
myName: "",
|
|
2962
2970
|
mucHost: "",
|
|
@@ -3025,10 +3033,10 @@ var An = (e) => {
|
|
|
3025
3033
|
seed: (t, n) => e((e) => {
|
|
3026
3034
|
let r = { ...e.conversations };
|
|
3027
3035
|
for (let i of t) {
|
|
3028
|
-
let t =
|
|
3036
|
+
let t = Nn(i);
|
|
3029
3037
|
if (!t || t === n) continue;
|
|
3030
3038
|
let a = r[t] ?? q(t, e.mucHost);
|
|
3031
|
-
if (a.messages.some((e) => e
|
|
3039
|
+
if (a.messages.some((e) => Fn(e, i))) continue;
|
|
3032
3040
|
if (a.loaded) {
|
|
3033
3041
|
r[t] = {
|
|
3034
3042
|
...a,
|
|
@@ -3045,10 +3053,10 @@ var An = (e) => {
|
|
|
3045
3053
|
return { conversations: r };
|
|
3046
3054
|
}),
|
|
3047
3055
|
addMessage: (t, n, r) => e((e) => {
|
|
3048
|
-
let i = e.conversations[t] ?? q(t, e.mucHost), a = i.messages.filter((e) => e
|
|
3056
|
+
let i = e.conversations[t] ?? q(t, e.mucHost), a = i.messages.filter((e) => !Fn(e, n) && !(e.pending && n.mine && e.body === n.body && e.oob === n.oob)), o = a.length;
|
|
3049
3057
|
for (; o > 0 && a[o - 1].ts > n.ts;) o--;
|
|
3050
3058
|
a.splice(o, 0, n);
|
|
3051
|
-
let s = e.open === t, c = r?.live && !n.mine && !s ? i.unread + 1 : i.unread, l =
|
|
3059
|
+
let s = e.open === t, c = r?.live && !n.mine && !s ? i.unread + 1 : i.unread, l = Pn(e.order, t, e.maxHeads, e.open);
|
|
3052
3060
|
return {
|
|
3053
3061
|
conversations: {
|
|
3054
3062
|
...e.conversations,
|
|
@@ -3063,12 +3071,12 @@ var An = (e) => {
|
|
|
3063
3071
|
};
|
|
3064
3072
|
}),
|
|
3065
3073
|
prependHistory: (t, n, r, i) => e((e) => {
|
|
3066
|
-
let a = e.conversations[t] ?? q(t, e.mucHost), o =
|
|
3074
|
+
let a = e.conversations[t] ?? q(t, e.mucHost), o = [...n.filter((e) => !a.messages.some((t) => Fn(t, e))), ...a.messages].sort((e, t) => e.ts - t.ts);
|
|
3067
3075
|
return { conversations: {
|
|
3068
3076
|
...e.conversations,
|
|
3069
3077
|
[t]: {
|
|
3070
3078
|
...a,
|
|
3071
|
-
messages:
|
|
3079
|
+
messages: o,
|
|
3072
3080
|
loaded: !0,
|
|
3073
3081
|
complete: r,
|
|
3074
3082
|
oldest: i ?? a.oldest
|
|
@@ -3099,7 +3107,7 @@ var An = (e) => {
|
|
|
3099
3107
|
...e.conversations,
|
|
3100
3108
|
[t]: q(t, e.mucHost)
|
|
3101
3109
|
},
|
|
3102
|
-
order:
|
|
3110
|
+
order: Pn(e.order, t, e.maxHeads, e.open),
|
|
3103
3111
|
open: t,
|
|
3104
3112
|
picker: !1
|
|
3105
3113
|
})),
|
|
@@ -3128,7 +3136,7 @@ var An = (e) => {
|
|
|
3128
3136
|
}));
|
|
3129
3137
|
//#endregion
|
|
3130
3138
|
//#region src/contacts.ts
|
|
3131
|
-
function
|
|
3139
|
+
function In(e, t, n) {
|
|
3132
3140
|
return Object.values(e ?? {}).filter((e) => e?.username && e.username !== n).map((e) => ({
|
|
3133
3141
|
username: e.username,
|
|
3134
3142
|
name: e.name || e.username,
|
|
@@ -3139,31 +3147,31 @@ function Pn(e, t, n) {
|
|
|
3139
3147
|
}
|
|
3140
3148
|
//#endregion
|
|
3141
3149
|
//#region src/api.ts
|
|
3142
|
-
async function
|
|
3150
|
+
async function Ln(e, t, n) {
|
|
3143
3151
|
let r = await fetch(`https://${e}/api${n}`, { headers: { Authorization: `Bearer ${t}` } });
|
|
3144
3152
|
if (!r.ok) throw Error(`${n}: HTTP ${r.status}`);
|
|
3145
3153
|
return await r.json();
|
|
3146
3154
|
}
|
|
3147
|
-
async function
|
|
3148
|
-
let i = await
|
|
3155
|
+
async function Rn(e, t, n, r) {
|
|
3156
|
+
let i = await Ln(e, t, "/user/endpoints/all"), a = {};
|
|
3149
3157
|
try {
|
|
3150
|
-
a = await
|
|
3158
|
+
a = await Ln(e, t, "/user/all_avatars");
|
|
3151
3159
|
} catch {}
|
|
3152
3160
|
let o = Object.values(i).find((e) => e.username === n)?.name;
|
|
3153
|
-
return o && r?.(o),
|
|
3161
|
+
return o && r?.(o), In(i, a, n).sort((e, t) => e.name.localeCompare(t.name));
|
|
3154
3162
|
}
|
|
3155
|
-
async function
|
|
3163
|
+
async function zn(e, t) {
|
|
3156
3164
|
let n = await fetch(`https://${e}/chat-gw/push/mobile`, { headers: { Authorization: `Bearer ${t}` } });
|
|
3157
3165
|
if (!n.ok) throw Error(`push/mobile: HTTP ${n.status}`);
|
|
3158
3166
|
return (await n.json()).users;
|
|
3159
3167
|
}
|
|
3160
|
-
async function
|
|
3168
|
+
async function Bn(e, t) {
|
|
3161
3169
|
let n = await fetch(`https://${e}/chat-gw/users/inactive`, { headers: { Authorization: `Bearer ${t}` } });
|
|
3162
3170
|
if (!n.ok) throw Error(`users/inactive: HTTP ${n.status}`);
|
|
3163
3171
|
let { users: r } = await n.json();
|
|
3164
3172
|
return Object.fromEntries(r.map((e) => [e.username, e.name || e.username]));
|
|
3165
3173
|
}
|
|
3166
|
-
async function
|
|
3174
|
+
async function Vn(e, t, n) {
|
|
3167
3175
|
let r = await fetch(`https://${e}/chat-gw/conversations/${encodeURIComponent(n)}`, {
|
|
3168
3176
|
method: "DELETE",
|
|
3169
3177
|
headers: { Authorization: `Bearer ${t}` }
|
|
@@ -3172,16 +3180,16 @@ async function zn(e, t, n) {
|
|
|
3172
3180
|
}
|
|
3173
3181
|
//#endregion
|
|
3174
3182
|
//#region src/push.ts
|
|
3175
|
-
var
|
|
3183
|
+
var Hn = (e) => {
|
|
3176
3184
|
let t = atob((e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"));
|
|
3177
3185
|
return Uint8Array.from(t, (e) => e.charCodeAt(0));
|
|
3178
|
-
},
|
|
3179
|
-
function
|
|
3180
|
-
|
|
3186
|
+
}, Un = !1;
|
|
3187
|
+
function Wn() {
|
|
3188
|
+
Un || (Un = !0, navigator.serviceWorker.addEventListener("message", (e) => {
|
|
3181
3189
|
e.data?.type === "chat-island-open" && typeof e.data.username == "string" && window.dispatchEvent(new CustomEvent("chat-island-open", { detail: { username: e.data.username } }));
|
|
3182
3190
|
}));
|
|
3183
3191
|
}
|
|
3184
|
-
async function
|
|
3192
|
+
async function Gn(e, t) {
|
|
3185
3193
|
if (!("serviceWorker" in navigator) || !("PushManager" in window)) throw Error("push not supported by this browser");
|
|
3186
3194
|
if (Notification.permission === "denied" || Notification.permission !== "granted" && await Notification.requestPermission() !== "granted") return null;
|
|
3187
3195
|
let n = `https://${e.host}/chat-gw`, r = await fetch(`${n}/push/vapid`);
|
|
@@ -3190,7 +3198,7 @@ async function Un(e, t) {
|
|
|
3190
3198
|
await navigator.serviceWorker.ready;
|
|
3191
3199
|
let o = await a.pushManager.getSubscription() ?? await a.pushManager.subscribe({
|
|
3192
3200
|
userVisibleOnly: !0,
|
|
3193
|
-
applicationServerKey:
|
|
3201
|
+
applicationServerKey: Hn(i.publicKey)
|
|
3194
3202
|
}), s = await fetch(`${n}/push/web`, {
|
|
3195
3203
|
method: "POST",
|
|
3196
3204
|
headers: {
|
|
@@ -3201,7 +3209,7 @@ async function Un(e, t) {
|
|
|
3201
3209
|
});
|
|
3202
3210
|
if (!s.ok) throw Error(`push/web: HTTP ${s.status} ${(await s.text()).slice(0, 120)}`);
|
|
3203
3211
|
let c = await s.json();
|
|
3204
|
-
return
|
|
3212
|
+
return Wn(), {
|
|
3205
3213
|
node: c.node,
|
|
3206
3214
|
service: c.service
|
|
3207
3215
|
};
|
|
@@ -3217,8 +3225,8 @@ function X(e, t) {
|
|
|
3217
3225
|
}
|
|
3218
3226
|
//#endregion
|
|
3219
3227
|
//#region src/components/Avatar.tsx
|
|
3220
|
-
var
|
|
3221
|
-
function
|
|
3228
|
+
var Kn = (e) => e.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("");
|
|
3229
|
+
function qn({ contact: e, username: t, size: n = 40 }) {
|
|
3222
3230
|
let r = e?.name || t, i = {
|
|
3223
3231
|
width: n,
|
|
3224
3232
|
height: n,
|
|
@@ -3233,13 +3241,13 @@ function Gn({ contact: e, username: t, size: n = 40 }) {
|
|
|
3233
3241
|
}) : /* @__PURE__ */ d("div", {
|
|
3234
3242
|
style: i,
|
|
3235
3243
|
className: "ci-rounded-full ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-font-medium ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900",
|
|
3236
|
-
children:
|
|
3244
|
+
children: Kn(r)
|
|
3237
3245
|
});
|
|
3238
3246
|
}
|
|
3239
|
-
function
|
|
3247
|
+
function Jn({ online: e, presence: t, mobile: n }) {
|
|
3240
3248
|
return /* @__PURE__ */ d("span", { className: `ci-absolute ci-bottom-0 ci-right-0 ci-w-3 ci-h-3 ci-rounded-full ci-ring-2 ci-ring-gray-50 dark:ci-ring-gray-950 ${t === "dnd" || t === "busy" ? "ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark" : e || n ? "ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark" : "ci-bg-gray-400 dark:ci-bg-gray-600"}` });
|
|
3241
3249
|
}
|
|
3242
|
-
function
|
|
3250
|
+
function Yn({ name: e, size: t = 40, avatar: n }) {
|
|
3243
3251
|
let r = {
|
|
3244
3252
|
width: t,
|
|
3245
3253
|
height: t,
|
|
@@ -3254,12 +3262,12 @@ function qn({ name: e, size: t = 40, avatar: n }) {
|
|
|
3254
3262
|
}) : /* @__PURE__ */ d("div", {
|
|
3255
3263
|
style: r,
|
|
3256
3264
|
className: "ci-rounded-full ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-font-medium ci-bg-iconSecondary dark:ci-bg-iconSecondaryDark ci-text-white",
|
|
3257
|
-
children:
|
|
3265
|
+
children: Kn(e || "G")
|
|
3258
3266
|
});
|
|
3259
3267
|
}
|
|
3260
3268
|
//#endregion
|
|
3261
3269
|
//#region src/components/Button.tsx
|
|
3262
|
-
var
|
|
3270
|
+
var Xn = "ci-flex ci-content-center ci-items-center ci-justify-center ci-tracking-wide ci-duration-200 ci-transform ci-outline-none focus:ci-ring-2 focus:ci-z-20 focus:ci-ring-offset-2 disabled:ci-opacity-40 disabled:ci-cursor-not-allowed ci-border ci-border-transparent focus:ci-ring-offset-white dark:focus:ci-ring-offset-black ci-text-sm ci-leading-4 ci-transition-colors ci-shrink-0 ci-font-light", Zn = {
|
|
3263
3271
|
default: "ci-bg-phoneIslandActive dark:ci-bg-phoneIslandActiveDark hover:ci-bg-gray-500 dark:hover:ci-bg-gray-50 focus:ci-ring-emerald-500 dark:focus:ci-ring-emerald-300 ci-text-primaryInvert dark:ci-text-primaryInvertDark ci-h-12 ci-w-12 ci-rounded-full",
|
|
3264
3272
|
green: "ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark hover:ci-bg-phoneIslandCallHover dark:hover:ci-bg-phoneIslandCallHoverDark focus:ci-ring-green-500 ci-text-white dark:ci-text-gray-950 ci-h-12 ci-w-12 ci-rounded-full",
|
|
3265
3273
|
red: "ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark hover:ci-bg-phoneIslandCloseHover dark:hover:ci-bg-phoneIslandCloseHoverDark focus:ci-ring-emerald-500 ci-text-white dark:ci-text-gray-950 ci-h-12 ci-w-12 ci-rounded-full",
|
|
@@ -3272,7 +3280,7 @@ function Z({ variant: e, className: t = "", children: n, ...r }) {
|
|
|
3272
3280
|
return /* @__PURE__ */ d("button", {
|
|
3273
3281
|
type: "button",
|
|
3274
3282
|
"aria-label": r["aria-label"] ?? r.title,
|
|
3275
|
-
className: `${
|
|
3283
|
+
className: `${Xn} ${Zn[e]} ${t}`,
|
|
3276
3284
|
...r,
|
|
3277
3285
|
children: n
|
|
3278
3286
|
});
|
|
@@ -3440,7 +3448,7 @@ var Q = {
|
|
|
3440
3448
|
};
|
|
3441
3449
|
//#endregion
|
|
3442
3450
|
//#region src/components/Dock.tsx
|
|
3443
|
-
function
|
|
3451
|
+
function Qn({ onDragStart: e, pushButton: t = !0 }) {
|
|
3444
3452
|
let { order: n, open: r, conversations: i, contacts: a, inactive: o, online: s, mobile: c, openChat: l, removeHead: p, picker: m, setPicker: h, status: g, push: _, enablePush: v, newChatButton: y } = J(w((e) => ({
|
|
3445
3453
|
order: e.order,
|
|
3446
3454
|
open: e.open,
|
|
@@ -3471,15 +3479,15 @@ function Xn({ onDragStart: e, pushButton: t = !0 }) {
|
|
|
3471
3479
|
title: t?.kind === "group" ? t.name ?? e : a[e]?.name ?? o[e] ?? e,
|
|
3472
3480
|
onClick: () => n ? J.getState().closeChat() : l(e),
|
|
3473
3481
|
className: `ci-relative ci-rounded-full ci-shadow-lg ci-transition-transform hover:ci-scale-105 ci-ring-2 ci-border-0 ci-p-0 ci-bg-transparent ${n ? "ci-ring-iconSecondary dark:ci-ring-iconSecondaryDark" : "ci-ring-gray-50 dark:ci-ring-gray-950"}`,
|
|
3474
|
-
children: [t?.kind === "group" ? /* @__PURE__ */ d(
|
|
3482
|
+
children: [t?.kind === "group" ? /* @__PURE__ */ d(Yn, {
|
|
3475
3483
|
name: t.name ?? e,
|
|
3476
3484
|
size: 48,
|
|
3477
3485
|
avatar: t.avatar
|
|
3478
|
-
}) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(
|
|
3486
|
+
}) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(qn, {
|
|
3479
3487
|
contact: a[e],
|
|
3480
3488
|
username: e,
|
|
3481
3489
|
size: 48
|
|
3482
|
-
}), /* @__PURE__ */ d(
|
|
3490
|
+
}), /* @__PURE__ */ d(Jn, {
|
|
3483
3491
|
online: s[e],
|
|
3484
3492
|
presence: a[e]?.presence,
|
|
3485
3493
|
mobile: c[e]
|
|
@@ -3515,7 +3523,7 @@ function Xn({ onDragStart: e, pushButton: t = !0 }) {
|
|
|
3515
3523
|
}
|
|
3516
3524
|
//#endregion
|
|
3517
3525
|
//#region src/shortcodes.ts
|
|
3518
|
-
var
|
|
3526
|
+
var $n = {
|
|
3519
3527
|
"+1": "👍",
|
|
3520
3528
|
thumbsup: "👍",
|
|
3521
3529
|
"-1": "👎",
|
|
@@ -3709,13 +3717,13 @@ var Zn = {
|
|
|
3709
3717
|
zzz: "💤",
|
|
3710
3718
|
sweat_drops: "💦",
|
|
3711
3719
|
dash: "💨"
|
|
3712
|
-
},
|
|
3720
|
+
}, er = /(```[\s\S]*?(?:```|$)|`[^`\n]*`?)/g, tr = /:([a-z0-9_+-]+):/g, nr = (e) => e.replace(tr, (e, t) => $n[t] ?? e);
|
|
3713
3721
|
function $(e) {
|
|
3714
|
-
return e.includes(":") ? e.split(
|
|
3722
|
+
return e.includes(":") ? e.split(er).map((e, t) => t % 2 ? e : nr(e)).join("") : e;
|
|
3715
3723
|
}
|
|
3716
3724
|
//#endregion
|
|
3717
3725
|
//#region src/components/EmojiPicker.tsx
|
|
3718
|
-
var
|
|
3726
|
+
var rr = [
|
|
3719
3727
|
{
|
|
3720
3728
|
label: "Smileys",
|
|
3721
3729
|
icon: "😀",
|
|
@@ -3746,7 +3754,7 @@ var tr = [
|
|
|
3746
3754
|
icon: "☕",
|
|
3747
3755
|
emojis: "☕ 🍵 🥤 🍕 🍔 🍟 🌭 🥪 🌮 🍝 🍣 🍩 🍪 🍫 🍎 🍌 🍓 🥐 🚗 🚕 🚌 🚆 ✈️ 🚀 🏠 🏢 🏖️ 🌍 ☀️ 🌤️ 🌧️ ⛈️ ❄️ ⚡ 🌈 🌙"
|
|
3748
3756
|
}
|
|
3749
|
-
],
|
|
3757
|
+
], ir = [
|
|
3750
3758
|
"👍",
|
|
3751
3759
|
"❤️",
|
|
3752
3760
|
"😂",
|
|
@@ -3754,7 +3762,7 @@ var tr = [
|
|
|
3754
3762
|
"😢",
|
|
3755
3763
|
"🙏"
|
|
3756
3764
|
];
|
|
3757
|
-
function
|
|
3765
|
+
function ar({ onPick: e, onClose: t, className: n = "" }) {
|
|
3758
3766
|
let [r, a] = c(0), o = s(null);
|
|
3759
3767
|
return i(() => {
|
|
3760
3768
|
let e = (e) => o.current && !o.current.contains(e.target) && t(), n = (e) => {
|
|
@@ -3770,7 +3778,7 @@ function rr({ onPick: e, onClose: t, className: n = "" }) {
|
|
|
3770
3778
|
className: `ci-z-30 ci-w-[21rem] ci-max-w-full ci-rounded-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ci-select-none ${n}`,
|
|
3771
3779
|
children: [/* @__PURE__ */ d("div", {
|
|
3772
3780
|
className: "ci-flex ci-gap-1 ci-px-2 ci-pt-2 ci-border-b ci-border-gray-300 dark:ci-border-gray-700",
|
|
3773
|
-
children:
|
|
3781
|
+
children: rr.map((e, t) => /* @__PURE__ */ d("button", {
|
|
3774
3782
|
type: "button",
|
|
3775
3783
|
title: e.label,
|
|
3776
3784
|
"aria-label": e.label,
|
|
@@ -3784,7 +3792,7 @@ function rr({ onPick: e, onClose: t, className: n = "" }) {
|
|
|
3784
3792
|
}, e.label))
|
|
3785
3793
|
}), /* @__PURE__ */ d("div", {
|
|
3786
3794
|
className: "ci-grid ci-grid-cols-7 ci-gap-1 ci-p-2 ci-h-64 ci-overflow-y-auto",
|
|
3787
|
-
children:
|
|
3795
|
+
children: rr[r].emojis.split(" ").map((t) => /* @__PURE__ */ d("button", {
|
|
3788
3796
|
type: "button",
|
|
3789
3797
|
onClick: () => e(t),
|
|
3790
3798
|
style: {
|
|
@@ -3799,27 +3807,27 @@ function rr({ onPick: e, onClose: t, className: n = "" }) {
|
|
|
3799
3807
|
}
|
|
3800
3808
|
//#endregion
|
|
3801
3809
|
//#region src/components/MessageList.tsx
|
|
3802
|
-
var
|
|
3810
|
+
var or = (e) => /\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e), sr = (e) => /\.(webm|ogg|oga|opus|mp3|m4a|wav)(\?|$)/i.test(e), cr = (e) => {
|
|
3803
3811
|
let t = e.split("/").pop() || "file";
|
|
3804
3812
|
try {
|
|
3805
3813
|
return decodeURIComponent(t);
|
|
3806
3814
|
} catch {
|
|
3807
3815
|
return t;
|
|
3808
3816
|
}
|
|
3809
|
-
},
|
|
3817
|
+
}, lr = (e) => {
|
|
3810
3818
|
try {
|
|
3811
3819
|
return new URL(e).protocol === "https:";
|
|
3812
3820
|
} catch {
|
|
3813
3821
|
return !1;
|
|
3814
3822
|
}
|
|
3815
|
-
},
|
|
3823
|
+
}, ur = (e) => new Date(e).toLocaleTimeString([], {
|
|
3816
3824
|
hour: "2-digit",
|
|
3817
3825
|
minute: "2-digit"
|
|
3818
|
-
}),
|
|
3826
|
+
}), dr = (e) => new Date(e).toLocaleDateString([], {
|
|
3819
3827
|
weekday: "short",
|
|
3820
3828
|
day: "numeric",
|
|
3821
3829
|
month: "short"
|
|
3822
|
-
}),
|
|
3830
|
+
}), fr = (e, t) => new Date(e).toDateString() === new Date(t).toDateString(), pr = (e) => {
|
|
3823
3831
|
if (!e.startsWith("{\"")) return null;
|
|
3824
3832
|
try {
|
|
3825
3833
|
let t = JSON.parse(e);
|
|
@@ -3830,17 +3838,17 @@ var ir = (e) => /\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e), ar = (e) => /\
|
|
|
3830
3838
|
} catch {
|
|
3831
3839
|
return null;
|
|
3832
3840
|
}
|
|
3833
|
-
},
|
|
3834
|
-
return
|
|
3841
|
+
}, mr = n(function({ url: e }) {
|
|
3842
|
+
return lr(e) ? or(e) ? /* @__PURE__ */ d("a", {
|
|
3835
3843
|
href: e,
|
|
3836
3844
|
target: "_blank",
|
|
3837
3845
|
rel: "noreferrer",
|
|
3838
3846
|
children: /* @__PURE__ */ d("img", {
|
|
3839
3847
|
src: e,
|
|
3840
|
-
alt:
|
|
3848
|
+
alt: cr(e),
|
|
3841
3849
|
className: "ci-max-w-full ci-max-h-60 ci-rounded-2xl ci-block"
|
|
3842
3850
|
})
|
|
3843
|
-
}) :
|
|
3851
|
+
}) : sr(e) ? /* @__PURE__ */ d("audio", {
|
|
3844
3852
|
controls: !0,
|
|
3845
3853
|
src: e,
|
|
3846
3854
|
className: "ci-max-w-full"
|
|
@@ -3857,15 +3865,15 @@ var ir = (e) => /\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e), ar = (e) => /\
|
|
|
3857
3865
|
stroke: "currentColor",
|
|
3858
3866
|
strokeWidth: "2",
|
|
3859
3867
|
children: /* @__PURE__ */ d("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" })
|
|
3860
|
-
}),
|
|
3868
|
+
}), cr(e)]
|
|
3861
3869
|
}) : /* @__PURE__ */ d("span", {
|
|
3862
3870
|
className: "ci-break-all",
|
|
3863
3871
|
children: e
|
|
3864
3872
|
});
|
|
3865
|
-
}),
|
|
3866
|
-
function
|
|
3873
|
+
}), hr = /(`[^`\n]+`)|(\*\*[^*\n]+\*\*|__[^_\n]+__)|(~~[^~\n]+~~)|(\*[^*\s][^*\n]*\*|_[^_\s][^_\n]*_)|\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<]+)/g;
|
|
3874
|
+
function gr({ text: e }) {
|
|
3867
3875
|
let t = [], n = 0;
|
|
3868
|
-
for (let r of e.matchAll(
|
|
3876
|
+
for (let r of e.matchAll(hr)) {
|
|
3869
3877
|
let i = r[0], a = r.index ?? 0;
|
|
3870
3878
|
a > n && t.push($(e.slice(n, a))), r[1] ? t.push(/* @__PURE__ */ d("code", {
|
|
3871
3879
|
className: "ci-px-1 ci-py-0.5 ci-rounded ci-bg-black/10 dark:ci-bg-white/10 ci-font-mono ci-text-[0.85em]",
|
|
@@ -3886,17 +3894,17 @@ function mr({ text: e }) {
|
|
|
3886
3894
|
}
|
|
3887
3895
|
return n < e.length && t.push($(e.slice(n))), /* @__PURE__ */ d(u, { children: t });
|
|
3888
3896
|
}
|
|
3889
|
-
var
|
|
3897
|
+
var _r = n(function({ text: e }) {
|
|
3890
3898
|
let t = e.split(/```[^\n]*\n?([\s\S]*?)```/g);
|
|
3891
3899
|
return /* @__PURE__ */ d("span", {
|
|
3892
3900
|
className: "ci-whitespace-pre-wrap ci-break-words",
|
|
3893
3901
|
children: t.map((e, t) => t % 2 ? /* @__PURE__ */ d("pre", {
|
|
3894
3902
|
className: "ci-my-1 ci-p-2 ci-rounded-xl ci-bg-black/10 dark:ci-bg-white/10 ci-font-mono ci-text-xs ci-overflow-x-auto ci-whitespace-pre",
|
|
3895
3903
|
children: e.replace(/\n$/, "")
|
|
3896
|
-
}, t) : /* @__PURE__ */ d(
|
|
3904
|
+
}, t) : /* @__PURE__ */ d(gr, { text: e.replace(/^(\s*)[-*] (?=\S)/gm, "$1• ") }, t))
|
|
3897
3905
|
});
|
|
3898
3906
|
});
|
|
3899
|
-
function
|
|
3907
|
+
function vr({ text: e, count: t }) {
|
|
3900
3908
|
return /* @__PURE__ */ f("span", {
|
|
3901
3909
|
className: "ci-italic ci-opacity-80",
|
|
3902
3910
|
children: [
|
|
@@ -3909,7 +3917,7 @@ function gr({ text: e, count: t }) {
|
|
|
3909
3917
|
]
|
|
3910
3918
|
});
|
|
3911
3919
|
}
|
|
3912
|
-
function
|
|
3920
|
+
function yr({ forMsg: e, me: t, onReact: n, nameOf: r, mine: i }) {
|
|
3913
3921
|
if (!e) return null;
|
|
3914
3922
|
let a = /* @__PURE__ */ new Map();
|
|
3915
3923
|
for (let [t, n] of Object.entries(e)) for (let e of n) a.set(e, [...a.get(e) ?? [], t]);
|
|
@@ -3934,7 +3942,7 @@ function _r({ forMsg: e, me: t, onReact: n, nameOf: r, mine: i }) {
|
|
|
3934
3942
|
})
|
|
3935
3943
|
}) : null;
|
|
3936
3944
|
}
|
|
3937
|
-
function
|
|
3945
|
+
function br({ reply: e, messages: t, mine: n, name: r }) {
|
|
3938
3946
|
let i = t.find((t) => t.oid === e.id), a = i ? i.oob ? "Attachment" : i.body : e.quote?.replace(/^[^:]*: /, "") ?? "", o = (t) => {
|
|
3939
3947
|
t.stopPropagation();
|
|
3940
3948
|
let n = document.querySelector(`.chat-island-root [data-oid="${CSS.escape(e.id)}"]`);
|
|
@@ -3958,7 +3966,7 @@ function vr({ reply: e, messages: t, mine: n, name: r }) {
|
|
|
3958
3966
|
})]
|
|
3959
3967
|
});
|
|
3960
3968
|
}
|
|
3961
|
-
function
|
|
3969
|
+
function xr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, reactions: o, me: l = "", onReact: u, onReply: p }) {
|
|
3962
3970
|
let m = J((e) => e.contacts), h = s(null), g = s(!0), [_, v] = c(null), [y, b] = c(null), x = (e) => m[e]?.name ?? e;
|
|
3963
3971
|
i(() => {
|
|
3964
3972
|
let e = h.current;
|
|
@@ -3992,7 +4000,7 @@ function yr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, rea
|
|
|
3992
4000
|
children: "Scroll up for older messages"
|
|
3993
4001
|
}),
|
|
3994
4002
|
e.map((t, n) => {
|
|
3995
|
-
let r = e[n - 1], i = !r || !
|
|
4003
|
+
let r = e[n - 1], i = !r || !fr(r.ts, t.ts), s = r && !i && r.mine === t.mine && r.nick === t.nick && t.ts - r.ts < 12e4, c = a && !t.mine && t.nick ? x(t.nick) : null, h = t.oid, g = !!u && !!h && !t.pending, y = g && /* @__PURE__ */ d("button", {
|
|
3996
4004
|
type: "button",
|
|
3997
4005
|
title: "React",
|
|
3998
4006
|
"aria-label": "React to this message",
|
|
@@ -4015,14 +4023,14 @@ function yr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, rea
|
|
|
4015
4023
|
"data-oid": t.oid,
|
|
4016
4024
|
children: [i && /* @__PURE__ */ d("div", {
|
|
4017
4025
|
className: "ci-text-center ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-py-2",
|
|
4018
|
-
children:
|
|
4026
|
+
children: dr(t.ts)
|
|
4019
4027
|
}), /* @__PURE__ */ f("div", {
|
|
4020
4028
|
className: `ci-group ci-flex ci-items-start ci-gap-1.5 ${t.mine ? "ci-justify-end" : "ci-justify-start"} ${s ? "ci-mt-0.5" : "ci-mt-2"}`,
|
|
4021
4029
|
children: [
|
|
4022
4030
|
c && /* @__PURE__ */ d("span", {
|
|
4023
4031
|
className: "ci-w-7 ci-shrink-0",
|
|
4024
4032
|
title: c,
|
|
4025
|
-
children: !s && /* @__PURE__ */ d(
|
|
4033
|
+
children: !s && /* @__PURE__ */ d(qn, {
|
|
4026
4034
|
contact: m[t.nick],
|
|
4027
4035
|
username: t.nick,
|
|
4028
4036
|
size: 28
|
|
@@ -4037,7 +4045,7 @@ function yr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, rea
|
|
|
4037
4045
|
role: "menu",
|
|
4038
4046
|
onClick: (e) => e.stopPropagation(),
|
|
4039
4047
|
className: `ci-absolute ci-bottom-full ci-mb-1 ci-z-20 ci-flex ci-items-center ci-gap-0.5 ci-p-1 ci-rounded-full ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ${t.mine ? "ci-right-0" : "ci-left-0"}`,
|
|
4040
|
-
children: [
|
|
4048
|
+
children: [ir.map((e) => /* @__PURE__ */ d("button", {
|
|
4041
4049
|
type: "button",
|
|
4042
4050
|
role: "menuitem",
|
|
4043
4051
|
"aria-label": e,
|
|
@@ -4061,28 +4069,28 @@ function yr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, rea
|
|
|
4061
4069
|
})]
|
|
4062
4070
|
}),
|
|
4063
4071
|
/* @__PURE__ */ f("div", {
|
|
4064
|
-
title:
|
|
4065
|
-
onDoubleClick: () => g && C(h,
|
|
4072
|
+
title: ur(t.ts),
|
|
4073
|
+
onDoubleClick: () => g && C(h, ir[0]),
|
|
4066
4074
|
className: `ci-px-3.5 ci-py-2 ci-rounded-3xl ci-text-sm ci-select-text ci-cursor-text ${t.mine ? "ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900 ci-rounded-br-lg" : "ci-bg-elevationL2 ci-text-gray-900 dark:ci-bg-elevationL2Dark dark:ci-text-white ci-rounded-bl-lg"} ${t.pending ? "ci-opacity-60" : ""}`,
|
|
4067
4075
|
children: [
|
|
4068
|
-
t.reply && /* @__PURE__ */ d(
|
|
4076
|
+
t.reply && /* @__PURE__ */ d(br, {
|
|
4069
4077
|
reply: t.reply,
|
|
4070
4078
|
messages: e,
|
|
4071
4079
|
mine: t.mine,
|
|
4072
4080
|
name: (e) => e === l ? "You" : x(e)
|
|
4073
4081
|
}),
|
|
4074
|
-
t.oob ? /* @__PURE__ */ d(
|
|
4075
|
-
t.oob && t.body && t.body !== t.oob && t.body !==
|
|
4082
|
+
t.oob ? /* @__PURE__ */ d(mr, { url: t.oob }) : pr(t.body) ? /* @__PURE__ */ d(vr, { ...pr(t.body) }) : /* @__PURE__ */ d(_r, { text: t.body }),
|
|
4083
|
+
t.oob && t.body && t.body !== t.oob && t.body !== cr(t.oob) && /* @__PURE__ */ d("div", {
|
|
4076
4084
|
className: "ci-text-xs ci-opacity-80 ci-mt-1",
|
|
4077
4085
|
children: t.body
|
|
4078
4086
|
}),
|
|
4079
4087
|
/* @__PURE__ */ d("span", {
|
|
4080
4088
|
className: "ci-block ci-text-right ci-text-[10px] ci-leading-none ci-opacity-60 ci-mt-1",
|
|
4081
|
-
children:
|
|
4089
|
+
children: ur(t.ts)
|
|
4082
4090
|
})
|
|
4083
4091
|
]
|
|
4084
4092
|
}),
|
|
4085
|
-
h && /* @__PURE__ */ d(
|
|
4093
|
+
h && /* @__PURE__ */ d(yr, {
|
|
4086
4094
|
forMsg: o?.[h],
|
|
4087
4095
|
me: l,
|
|
4088
4096
|
mine: t.mine,
|
|
@@ -4105,7 +4113,7 @@ function yr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, rea
|
|
|
4105
4113
|
})
|
|
4106
4114
|
})
|
|
4107
4115
|
]
|
|
4108
|
-
}), y && /* @__PURE__ */ d(
|
|
4116
|
+
}), y && /* @__PURE__ */ d(ar, {
|
|
4109
4117
|
className: "ci-absolute ci-bottom-2 ci-left-1/2 ci--translate-x-1/2",
|
|
4110
4118
|
onPick: (e) => C(y, e),
|
|
4111
4119
|
onClose: () => b(null)
|
|
@@ -4114,7 +4122,7 @@ function yr({ messages: e, typing: t, onLoadOlder: n, hasOlder: r, group: a, rea
|
|
|
4114
4122
|
}
|
|
4115
4123
|
//#endregion
|
|
4116
4124
|
//#region src/ogg.ts
|
|
4117
|
-
function
|
|
4125
|
+
function Sr(e, t, n) {
|
|
4118
4126
|
let r = e[t];
|
|
4119
4127
|
if (r === void 0) return null;
|
|
4120
4128
|
let i = 1;
|
|
@@ -4128,7 +4136,7 @@ function br(e, t, n) {
|
|
|
4128
4136
|
unknown: !n && o
|
|
4129
4137
|
};
|
|
4130
4138
|
}
|
|
4131
|
-
var
|
|
4139
|
+
var Cr = /* @__PURE__ */ new Set([
|
|
4132
4140
|
408125543,
|
|
4133
4141
|
524531317,
|
|
4134
4142
|
374648427,
|
|
@@ -4136,18 +4144,18 @@ var xr = /* @__PURE__ */ new Set([
|
|
|
4136
4144
|
225,
|
|
4137
4145
|
160
|
|
4138
4146
|
]);
|
|
4139
|
-
function
|
|
4147
|
+
function wr(e) {
|
|
4140
4148
|
let t = {
|
|
4141
4149
|
channels: 1,
|
|
4142
4150
|
packets: []
|
|
4143
4151
|
}, n = 0;
|
|
4144
4152
|
for (; n < e.length;) {
|
|
4145
|
-
let r =
|
|
4153
|
+
let r = Sr(e, n, !0);
|
|
4146
4154
|
if (!r) break;
|
|
4147
|
-
let i =
|
|
4155
|
+
let i = Sr(e, n + r.len, !1);
|
|
4148
4156
|
if (!i) break;
|
|
4149
4157
|
let a = n + r.len + i.len;
|
|
4150
|
-
if (
|
|
4158
|
+
if (Cr.has(r.value)) {
|
|
4151
4159
|
n = a;
|
|
4152
4160
|
continue;
|
|
4153
4161
|
}
|
|
@@ -4156,14 +4164,14 @@ function Sr(e) {
|
|
|
4156
4164
|
if (r.value === 25506) t.head = e.slice(a, o);
|
|
4157
4165
|
else if (r.value === 159) t.channels = e[a] || 1;
|
|
4158
4166
|
else if (r.value === 163 || r.value === 161) {
|
|
4159
|
-
let n =
|
|
4167
|
+
let n = Sr(e, a, !1);
|
|
4160
4168
|
n && (e[a + n.len + 2] >> 1 & 3 || t.packets.push(e.slice(a + n.len + 3, o)));
|
|
4161
4169
|
}
|
|
4162
4170
|
n = o;
|
|
4163
4171
|
}
|
|
4164
4172
|
return t;
|
|
4165
4173
|
}
|
|
4166
|
-
function
|
|
4174
|
+
function Tr(e) {
|
|
4167
4175
|
if (!e.length) return 0;
|
|
4168
4176
|
let t = e[0], n = t >> 3, r;
|
|
4169
4177
|
r = n < 12 ? [
|
|
@@ -4180,7 +4188,7 @@ function Cr(e) {
|
|
|
4180
4188
|
let i = t & 3, a = i === 0 ? 1 : i === 3 ? (e[1] ?? 0) & 63 : 2;
|
|
4181
4189
|
return Math.round(a * r * 48);
|
|
4182
4190
|
}
|
|
4183
|
-
var
|
|
4191
|
+
var Er = (() => {
|
|
4184
4192
|
let e = /* @__PURE__ */ new Uint32Array(256);
|
|
4185
4193
|
for (let t = 0; t < 256; t++) {
|
|
4186
4194
|
let n = t << 24;
|
|
@@ -4189,12 +4197,12 @@ var wr = (() => {
|
|
|
4189
4197
|
}
|
|
4190
4198
|
return e;
|
|
4191
4199
|
})();
|
|
4192
|
-
function
|
|
4200
|
+
function Dr(e) {
|
|
4193
4201
|
let t = 0;
|
|
4194
|
-
for (let n = 0; n < e.length; n++) t = (t << 8 ^
|
|
4202
|
+
for (let n = 0; n < e.length; n++) t = (t << 8 ^ Er[(t >>> 24 ^ e[n]) & 255]) >>> 0;
|
|
4195
4203
|
return t;
|
|
4196
4204
|
}
|
|
4197
|
-
function
|
|
4205
|
+
function Or(e, t, n, r, i) {
|
|
4198
4206
|
let a = [];
|
|
4199
4207
|
for (let t of e) {
|
|
4200
4208
|
let e = t.length;
|
|
@@ -4210,29 +4218,29 @@ function Er(e, t, n, r, i) {
|
|
|
4210
4218
|
], 0), s[5] = i, c.setUint32(6, t % 4294967296, !0), c.setUint32(10, Math.floor(t / 4294967296), !0), c.setUint32(14, n, !0), c.setUint32(18, r, !0), s[26] = a.length, s.set(a, 27);
|
|
4211
4219
|
let l = 27 + a.length;
|
|
4212
4220
|
for (let t of e) s.set(t, l), l += t.length;
|
|
4213
|
-
return c.setUint32(22,
|
|
4221
|
+
return c.setUint32(22, Dr(s), !0), s;
|
|
4214
4222
|
}
|
|
4215
|
-
function
|
|
4223
|
+
function kr(e) {
|
|
4216
4224
|
let t = /* @__PURE__ */ new Uint8Array(19), n = new DataView(t.buffer);
|
|
4217
4225
|
return t.set(new TextEncoder().encode("OpusHead"), 0), t[8] = 1, t[9] = e, n.setUint16(10, 312, !0), n.setUint32(12, 48e3, !0), t;
|
|
4218
4226
|
}
|
|
4219
|
-
function
|
|
4227
|
+
function Ar() {
|
|
4220
4228
|
let e = new TextEncoder().encode("chat-island"), t = new Uint8Array(12 + e.length + 4);
|
|
4221
4229
|
return t.set(new TextEncoder().encode("OpusTags"), 0), new DataView(t.buffer).setUint32(8, e.length, !0), t.set(e, 12), t;
|
|
4222
4230
|
}
|
|
4223
|
-
function
|
|
4224
|
-
let { head: t, channels: n, packets: r } =
|
|
4231
|
+
function jr(e) {
|
|
4232
|
+
let { head: t, channels: n, packets: r } = wr(e);
|
|
4225
4233
|
if (!r.length) return null;
|
|
4226
|
-
let i = t && t.length >= 19 && new TextDecoder().decode(t.slice(0, 8)) === "OpusHead", a = Math.random() * 4294967295 >>> 0, o = [
|
|
4234
|
+
let i = t && t.length >= 19 && new TextDecoder().decode(t.slice(0, 8)) === "OpusHead", a = Math.random() * 4294967295 >>> 0, o = [Or([i ? t : kr(n)], 0, a, 0, 2), Or([Ar()], 0, a, 1, 0)], s = 0, c = 2;
|
|
4227
4235
|
for (let e = 0; e < r.length;) {
|
|
4228
4236
|
let t = [], n = 0;
|
|
4229
4237
|
for (; e < r.length && t.length < 50;) {
|
|
4230
4238
|
let i = Math.floor(r[e].length / 255) + 1;
|
|
4231
4239
|
if (n + i > 255) break;
|
|
4232
|
-
t.push(r[e]), n += i, s +=
|
|
4240
|
+
t.push(r[e]), n += i, s += Tr(r[e]), e++;
|
|
4233
4241
|
}
|
|
4234
4242
|
if (!t.length) return null;
|
|
4235
|
-
o.push(
|
|
4243
|
+
o.push(Or(t, s, a, c++, e >= r.length ? 4 : 0));
|
|
4236
4244
|
}
|
|
4237
4245
|
let l = o.reduce((e, t) => e + t.length, 0), u = new Uint8Array(l), d = 0;
|
|
4238
4246
|
for (let e of o) u.set(e, d), d += e.length;
|
|
@@ -4240,22 +4248,22 @@ function kr(e) {
|
|
|
4240
4248
|
}
|
|
4241
4249
|
//#endregion
|
|
4242
4250
|
//#region src/components/Composer.tsx
|
|
4243
|
-
var
|
|
4251
|
+
var Mr = [
|
|
4244
4252
|
"audio/ogg;codecs=opus",
|
|
4245
4253
|
"audio/webm;codecs=opus",
|
|
4246
4254
|
"audio/mp4",
|
|
4247
4255
|
"audio/webm"
|
|
4248
4256
|
];
|
|
4249
|
-
async function
|
|
4257
|
+
async function Nr(e, t) {
|
|
4250
4258
|
let n = Date.now();
|
|
4251
4259
|
if (/webm/.test(t) && /opus/.test(t)) try {
|
|
4252
|
-
let t =
|
|
4260
|
+
let t = jr(new Uint8Array(await new Blob(e).arrayBuffer()));
|
|
4253
4261
|
if (t) return new File([t], `voice-${n}.ogg`, { type: "audio/ogg" });
|
|
4254
4262
|
} catch {}
|
|
4255
|
-
return new File(e, `voice-${n}.${
|
|
4263
|
+
return new File(e, `voice-${n}.${Pr(t)}`, { type: t.split(";")[0] });
|
|
4256
4264
|
}
|
|
4257
|
-
var
|
|
4258
|
-
function
|
|
4265
|
+
var Pr = (e) => /mp4/.test(e) ? "m4a" : /ogg/.test(e) ? "ogg" : "webm", Fr = (e) => `${Math.floor(e / 6e4)}:${String(Math.floor(e % 6e4 / 1e3)).padStart(2, "0")}`;
|
|
4266
|
+
function Ir({ onSend: e, onTyping: t, onFile: n, disabled: r, disabledText: o, focusKey: l }) {
|
|
4259
4267
|
let [u, p] = c(""), [m, h] = c(!1), g = s(null), _ = s(null), v = s(null), y = s(), b = s(!1), [x, S] = c(null), [C, w] = c(0), T = s(!1), E = s(!1), D = s(!1), O = s({});
|
|
4260
4268
|
i(() => v.current?.focus(), []), i(() => () => {
|
|
4261
4269
|
D.current = !0, T.current = !0, window.clearTimeout(y.current);
|
|
@@ -4296,9 +4304,9 @@ function Pr({ onSend: e, onTyping: t, onFile: n, disabled: r, disabledText: o, f
|
|
|
4296
4304
|
t.getTracks().forEach((e) => e.stop());
|
|
4297
4305
|
return;
|
|
4298
4306
|
}
|
|
4299
|
-
let r =
|
|
4307
|
+
let r = Mr.find((e) => MediaRecorder.isTypeSupported(e)), i = new MediaRecorder(e, r ? { mimeType: r } : void 0), a = [];
|
|
4300
4308
|
i.ondataavailable = (e) => e.data.size && a.push(e.data), i.onstop = () => {
|
|
4301
|
-
t.getTracks().forEach((e) => e.stop()), O.current = {}, S(null), !T.current && a.length &&
|
|
4309
|
+
t.getTracks().forEach((e) => e.stop()), O.current = {}, S(null), !T.current && a.length && Nr(a, i.mimeType || r || "").then(n);
|
|
4302
4310
|
}, T.current = !1, i.start(), O.current = {
|
|
4303
4311
|
r: i,
|
|
4304
4312
|
stream: t
|
|
@@ -4327,7 +4335,7 @@ function Pr({ onSend: e, onTyping: t, onFile: n, disabled: r, disabledText: o, f
|
|
|
4327
4335
|
}),
|
|
4328
4336
|
/* @__PURE__ */ f("div", {
|
|
4329
4337
|
className: "ci-flex-1 ci-flex ci-items-center ci-gap-2 ci-px-4 ci-py-2.5 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-sm",
|
|
4330
|
-
children: [/* @__PURE__ */ d("span", { className: "ci-w-2.5 ci-h-2.5 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-animate-pulse" }), /* @__PURE__ */ f("span", { children: ["Recording ",
|
|
4338
|
+
children: [/* @__PURE__ */ d("span", { className: "ci-w-2.5 ci-h-2.5 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-animate-pulse" }), /* @__PURE__ */ f("span", { children: ["Recording ", Fr(C)] })]
|
|
4331
4339
|
}),
|
|
4332
4340
|
/* @__PURE__ */ d(Z, {
|
|
4333
4341
|
variant: "green",
|
|
@@ -4341,7 +4349,7 @@ function Pr({ onSend: e, onTyping: t, onFile: n, disabled: r, disabledText: o, f
|
|
|
4341
4349
|
}) : /* @__PURE__ */ f("div", {
|
|
4342
4350
|
className: "ci-relative ci-flex ci-items-center ci-gap-2 ci-px-3 ci-py-3",
|
|
4343
4351
|
children: [
|
|
4344
|
-
m && /* @__PURE__ */ d(
|
|
4352
|
+
m && /* @__PURE__ */ d(ar, {
|
|
4345
4353
|
className: "ci-absolute ci-bottom-full ci-left-3 ci-mb-1",
|
|
4346
4354
|
onPick: ee,
|
|
4347
4355
|
onClose: () => h(!1)
|
|
@@ -4382,7 +4390,7 @@ function Pr({ onSend: e, onTyping: t, onFile: n, disabled: r, disabledText: o, f
|
|
|
4382
4390
|
let t = (u.match(/```/g) ?? []).length % 2 == 1;
|
|
4383
4391
|
e.key === "Enter" && !e.shiftKey && !t && (e.preventDefault(), j());
|
|
4384
4392
|
},
|
|
4385
|
-
className: "ci-block ci-w-full ci-resize-none ci-max-h-32 ci-pl-11 ci-pr-4 ci-py-2.5 ci-rounded-3xl ci-border-0 ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400 ci-outline-none focus:ci-ring-2 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-sm
|
|
4393
|
+
className: `${r ? "ci-overflow-hidden" : ""} ci-block ci-w-full ci-resize-none ci-max-h-32 ci-pl-11 ci-pr-4 ci-py-2.5 ci-rounded-3xl ci-border-0 ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400 ci-outline-none focus:ci-ring-2 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-sm`,
|
|
4386
4394
|
style: { height: Math.min(128, 40 + 20 * (u.split("\n").length - 1)) }
|
|
4387
4395
|
})]
|
|
4388
4396
|
}),
|
|
@@ -4407,14 +4415,14 @@ function Pr({ onSend: e, onTyping: t, onFile: n, disabled: r, disabledText: o, f
|
|
|
4407
4415
|
}
|
|
4408
4416
|
//#endregion
|
|
4409
4417
|
//#region src/components/ChatWindow.tsx
|
|
4410
|
-
var
|
|
4418
|
+
var Lr = (e) => !!e && ![
|
|
4411
4419
|
"offline",
|
|
4412
4420
|
"dnd",
|
|
4413
4421
|
"busy",
|
|
4414
4422
|
"ringing",
|
|
4415
4423
|
"onhold"
|
|
4416
4424
|
].includes(e);
|
|
4417
|
-
function
|
|
4425
|
+
function Rr({ peer: e, actions: t, onDragStart: n }) {
|
|
4418
4426
|
let { c: r, contacts: a, online: o, mobile: s, inactive: l, status: p, closeChat: m, openChat: h, markRead: g, order: _, me: v } = J(w((t) => ({
|
|
4419
4427
|
c: t.conversations[e],
|
|
4420
4428
|
contacts: t.contacts,
|
|
@@ -4463,17 +4471,17 @@ function Ir({ peer: e, actions: t, onDragStart: n }) {
|
|
|
4463
4471
|
className: `ci-flex ci-items-center ci-gap-3 ci-px-4 ci-py-3 ci-rounded-t-3xl ${n ? "ci-cursor-grab active:ci-cursor-grabbing ci-touch-none" : ""}`,
|
|
4464
4472
|
onPointerDown: n,
|
|
4465
4473
|
children: [
|
|
4466
|
-
r.kind === "group" ? /* @__PURE__ */ d(
|
|
4474
|
+
r.kind === "group" ? /* @__PURE__ */ d(Yn, {
|
|
4467
4475
|
name: r.name ?? e,
|
|
4468
4476
|
size: 36,
|
|
4469
4477
|
avatar: r.avatar
|
|
4470
4478
|
}) : /* @__PURE__ */ f("span", {
|
|
4471
4479
|
className: "ci-relative",
|
|
4472
|
-
children: [/* @__PURE__ */ d(
|
|
4480
|
+
children: [/* @__PURE__ */ d(qn, {
|
|
4473
4481
|
contact: b,
|
|
4474
4482
|
username: e,
|
|
4475
4483
|
size: 36
|
|
4476
|
-
}), /* @__PURE__ */ d(
|
|
4484
|
+
}), /* @__PURE__ */ d(Jn, {
|
|
4477
4485
|
online: o[e],
|
|
4478
4486
|
presence: b?.presence,
|
|
4479
4487
|
mobile: s[e]
|
|
@@ -4496,7 +4504,7 @@ function Ir({ peer: e, actions: t, onDragStart: n }) {
|
|
|
4496
4504
|
children: j ? "No longer active" : p === "online" ? r.kind === "group" ? k.map(O).join(", ") : r.typing ? "typing…" : o[e] ? "online" : s[e] ? "Mobile" : "offline" : p
|
|
4497
4505
|
})]
|
|
4498
4506
|
}),
|
|
4499
|
-
!j && r.kind !== "group" && b?.number &&
|
|
4507
|
+
!j && r.kind !== "group" && b?.number && Lr(b.presence) && /* @__PURE__ */ d(Z, {
|
|
4500
4508
|
variant: "call",
|
|
4501
4509
|
title: `Call ${b.number}`,
|
|
4502
4510
|
"aria-label": "Call",
|
|
@@ -4523,11 +4531,11 @@ function Ir({ peer: e, actions: t, onDragStart: n }) {
|
|
|
4523
4531
|
children: [
|
|
4524
4532
|
/* @__PURE__ */ f("span", {
|
|
4525
4533
|
className: "ci-relative",
|
|
4526
|
-
children: [/* @__PURE__ */ d(
|
|
4534
|
+
children: [/* @__PURE__ */ d(qn, {
|
|
4527
4535
|
contact: a[e],
|
|
4528
4536
|
username: e,
|
|
4529
4537
|
size: 28
|
|
4530
|
-
}), e !== v && /* @__PURE__ */ d(
|
|
4538
|
+
}), e !== v && /* @__PURE__ */ d(Jn, {
|
|
4531
4539
|
online: o[e],
|
|
4532
4540
|
presence: a[e]?.presence,
|
|
4533
4541
|
mobile: s[e]
|
|
@@ -4543,7 +4551,7 @@ function Ir({ peer: e, actions: t, onDragStart: n }) {
|
|
|
4543
4551
|
"aria-label": "Chat",
|
|
4544
4552
|
onClick: () => h(e),
|
|
4545
4553
|
children: Q.chat
|
|
4546
|
-
}), a[e]?.number &&
|
|
4554
|
+
}), a[e]?.number && Lr(a[e]?.presence) && /* @__PURE__ */ d(Z, {
|
|
4547
4555
|
variant: "call",
|
|
4548
4556
|
title: `Call ${a[e]?.number}`,
|
|
4549
4557
|
"aria-label": "Call",
|
|
@@ -4559,7 +4567,7 @@ function Ir({ peer: e, actions: t, onDragStart: n }) {
|
|
|
4559
4567
|
/* @__PURE__ */ f("div", {
|
|
4560
4568
|
className: "ci-flex-1 ci-min-h-0 ci-flex ci-flex-col ci-overflow-hidden ci-rounded-b-3xl",
|
|
4561
4569
|
children: [
|
|
4562
|
-
/* @__PURE__ */ d(
|
|
4570
|
+
/* @__PURE__ */ d(xr, {
|
|
4563
4571
|
messages: r.messages,
|
|
4564
4572
|
typing: r.typing,
|
|
4565
4573
|
group: r.kind === "group",
|
|
@@ -4589,10 +4597,10 @@ function Ir({ peer: e, actions: t, onDragStart: n }) {
|
|
|
4589
4597
|
children: Q.close
|
|
4590
4598
|
})]
|
|
4591
4599
|
}),
|
|
4592
|
-
/* @__PURE__ */ d(
|
|
4600
|
+
/* @__PURE__ */ d(Ir, {
|
|
4593
4601
|
focusKey: E,
|
|
4594
4602
|
disabled: p !== "online" || j,
|
|
4595
|
-
disabledText: j ? "
|
|
4603
|
+
disabledText: j ? "No longer active" : void 0,
|
|
4596
4604
|
onSend: (n) => t.send(e, n, C ?? void 0).then(() => T(null)),
|
|
4597
4605
|
onTyping: (n) => t.typing(e, n),
|
|
4598
4606
|
onFile: (n) => t.upload(e, n)
|
|
@@ -4604,75 +4612,76 @@ function Ir({ peer: e, actions: t, onDragStart: n }) {
|
|
|
4604
4612
|
}
|
|
4605
4613
|
//#endregion
|
|
4606
4614
|
//#region src/components/NewChat.tsx
|
|
4607
|
-
async function
|
|
4615
|
+
async function zr(e) {
|
|
4608
4616
|
let t = await createImageBitmap(e), n = Math.min(t.width, t.height), r = document.createElement("canvas");
|
|
4609
4617
|
return r.width = r.height = 128, r.getContext("2d")?.drawImage(t, (t.width - n) / 2, (t.height - n) / 2, n, n, 0, 0, 128, 128), r.toDataURL("image/jpeg", .8);
|
|
4610
4618
|
}
|
|
4611
|
-
function
|
|
4612
|
-
let { contacts:
|
|
4613
|
-
let e = Object.values(
|
|
4619
|
+
function Br({ onOpen: e, onCreateGroup: t, onDragStart: n }) {
|
|
4620
|
+
let { contacts: r, online: i, mobile: a, setPicker: l } = J(), [p, m] = c(""), [h, g] = c([]), [_, v] = c(""), [y, b] = c(!1), [x, S] = c(), C = s(null), w = o(() => {
|
|
4621
|
+
let e = Object.values(r), t = p.trim().toLowerCase();
|
|
4614
4622
|
return t ? e.filter((e) => (e.name ?? "").toLowerCase().includes(t) || e.username.includes(t)) : e;
|
|
4615
|
-
}, [
|
|
4616
|
-
|
|
4623
|
+
}, [r, p]), T = (e) => g((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), E = async () => {
|
|
4624
|
+
b(!0);
|
|
4617
4625
|
try {
|
|
4618
|
-
await t(
|
|
4626
|
+
await t(_.trim(), h, x);
|
|
4619
4627
|
} finally {
|
|
4620
|
-
|
|
4628
|
+
b(!1);
|
|
4621
4629
|
}
|
|
4622
4630
|
};
|
|
4623
4631
|
return /* @__PURE__ */ f("div", {
|
|
4624
4632
|
className: "ci-w-[22rem] ci-max-h-[30rem] ci-flex ci-flex-col ci-rounded-3xl ci-shadow-2xl ci-overflow-hidden ci-bg-gray-50 dark:ci-bg-gray-950 ci-text-gray-900 dark:ci-text-white",
|
|
4625
4633
|
children: [
|
|
4626
4634
|
/* @__PURE__ */ f("div", {
|
|
4627
|
-
className:
|
|
4635
|
+
className: `ci-px-4 ci-py-3 ci-flex ci-items-center ci-gap-2 ${n ? "ci-cursor-grab active:ci-cursor-grabbing ci-touch-none" : ""}`,
|
|
4636
|
+
onPointerDown: (e) => !e.target.closest("input, button") && n?.(e),
|
|
4628
4637
|
children: [/* @__PURE__ */ f("div", {
|
|
4629
4638
|
className: "ci-flex-1 ci-flex ci-items-center ci-gap-2 ci-px-4 ci-py-2 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-500 dark:ci-text-gray-400",
|
|
4630
4639
|
children: [Q.search, /* @__PURE__ */ d("input", {
|
|
4631
4640
|
autoFocus: !0,
|
|
4632
|
-
value:
|
|
4633
|
-
onChange: (e) =>
|
|
4641
|
+
value: p,
|
|
4642
|
+
onChange: (e) => m(e.target.value),
|
|
4634
4643
|
placeholder: "Search operators",
|
|
4635
4644
|
className: "ci-flex-1 ci-bg-transparent ci-border-0 ci-outline-none ci-text-sm ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400"
|
|
4636
4645
|
})]
|
|
4637
4646
|
}), /* @__PURE__ */ d(Z, {
|
|
4638
4647
|
variant: "small",
|
|
4639
|
-
onClick: () =>
|
|
4648
|
+
onClick: () => l(!1),
|
|
4640
4649
|
"aria-label": "Close",
|
|
4641
4650
|
children: Q.close
|
|
4642
4651
|
})]
|
|
4643
4652
|
}),
|
|
4644
|
-
|
|
4653
|
+
h.length > 0 && /* @__PURE__ */ d("div", {
|
|
4645
4654
|
className: "ci-px-4 ci-pb-2 ci-flex ci-flex-wrap ci-gap-1.5",
|
|
4646
|
-
children:
|
|
4655
|
+
children: h.map((e) => /* @__PURE__ */ f("button", {
|
|
4647
4656
|
type: "button",
|
|
4648
|
-
onClick: () =>
|
|
4657
|
+
onClick: () => T(e),
|
|
4649
4658
|
className: "ci-flex ci-items-center ci-gap-1 ci-pl-2.5 ci-pr-1.5 ci-py-1 ci-rounded-full ci-text-xs ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900 ci-border-0",
|
|
4650
|
-
children: [
|
|
4659
|
+
children: [r[e]?.name ?? e, Q.close]
|
|
4651
4660
|
}, e))
|
|
4652
4661
|
}),
|
|
4653
4662
|
/* @__PURE__ */ d("div", { className: "ci-border-t ci-border-gray-300 dark:ci-border-gray-700" }),
|
|
4654
4663
|
/* @__PURE__ */ f("ul", {
|
|
4655
4664
|
className: "ci-overflow-y-auto ci-py-1 ci-m-0 ci-p-0 ci-list-none ci-flex-1",
|
|
4656
|
-
children: [
|
|
4665
|
+
children: [w.length === 0 && /* @__PURE__ */ d("li", {
|
|
4657
4666
|
className: "ci-px-4 ci-py-6 ci-text-center ci-text-sm ci-text-gray-500 dark:ci-text-gray-400",
|
|
4658
4667
|
children: "No operators found"
|
|
4659
|
-
}),
|
|
4660
|
-
let t =
|
|
4668
|
+
}), w.map((e) => {
|
|
4669
|
+
let t = h.includes(e.username);
|
|
4661
4670
|
return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ f("button", {
|
|
4662
4671
|
type: "button",
|
|
4663
|
-
onClick: () =>
|
|
4672
|
+
onClick: () => T(e.username),
|
|
4664
4673
|
className: "ci-w-full ci-flex ci-items-center ci-gap-3 ci-px-4 ci-py-2 ci-bg-transparent ci-border-0 ci-text-left hover:ci-bg-gray-300/70 dark:hover:ci-bg-gray-700/30 ci-text-inherit",
|
|
4665
4674
|
children: [
|
|
4666
4675
|
/* @__PURE__ */ f("span", {
|
|
4667
4676
|
className: "ci-relative",
|
|
4668
|
-
children: [/* @__PURE__ */ d(
|
|
4677
|
+
children: [/* @__PURE__ */ d(qn, {
|
|
4669
4678
|
contact: e,
|
|
4670
4679
|
username: e.username,
|
|
4671
4680
|
size: 36
|
|
4672
|
-
}), /* @__PURE__ */ d(
|
|
4673
|
-
online:
|
|
4681
|
+
}), /* @__PURE__ */ d(Jn, {
|
|
4682
|
+
online: i[e.username],
|
|
4674
4683
|
presence: e.presence,
|
|
4675
|
-
mobile:
|
|
4684
|
+
mobile: a[e.username]
|
|
4676
4685
|
})]
|
|
4677
4686
|
}),
|
|
4678
4687
|
/* @__PURE__ */ f("span", {
|
|
@@ -4703,46 +4712,46 @@ function Rr({ onOpen: e, onCreateGroup: t }) {
|
|
|
4703
4712
|
}) }, e.username);
|
|
4704
4713
|
})]
|
|
4705
4714
|
}),
|
|
4706
|
-
|
|
4715
|
+
h.length > 0 && /* @__PURE__ */ d("div", {
|
|
4707
4716
|
className: "ci-border-t ci-border-gray-300 dark:ci-border-gray-700 ci-px-4 ci-py-3 ci-flex ci-items-center ci-gap-2",
|
|
4708
|
-
children:
|
|
4717
|
+
children: h.length === 1 ? /* @__PURE__ */ d(Z, {
|
|
4709
4718
|
variant: "default",
|
|
4710
4719
|
className: "ci-w-auto ci-h-10 ci-px-5",
|
|
4711
|
-
onClick: () => e(
|
|
4720
|
+
onClick: () => e(h[0]),
|
|
4712
4721
|
children: "Open chat"
|
|
4713
4722
|
}) : /* @__PURE__ */ f(u, { children: [
|
|
4714
4723
|
/* @__PURE__ */ d("input", {
|
|
4715
|
-
ref:
|
|
4724
|
+
ref: C,
|
|
4716
4725
|
type: "file",
|
|
4717
4726
|
accept: "image/*",
|
|
4718
4727
|
hidden: !0,
|
|
4719
|
-
onChange: (e) => e.target.files?.[0] &&
|
|
4728
|
+
onChange: (e) => e.target.files?.[0] && zr(e.target.files[0]).then(S).catch(() => {})
|
|
4720
4729
|
}),
|
|
4721
4730
|
/* @__PURE__ */ d("button", {
|
|
4722
4731
|
type: "button",
|
|
4723
4732
|
title: "Group picture",
|
|
4724
|
-
onClick: () =>
|
|
4733
|
+
onClick: () => C.current?.click(),
|
|
4725
4734
|
className: "ci-w-10 ci-h-10 ci-shrink-0 ci-rounded-full ci-border-0 ci-p-0 ci-overflow-hidden ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-500 dark:ci-text-gray-400 ci-flex ci-items-center ci-justify-center",
|
|
4726
|
-
children:
|
|
4727
|
-
src:
|
|
4735
|
+
children: x ? /* @__PURE__ */ d("img", {
|
|
4736
|
+
src: x,
|
|
4728
4737
|
alt: "",
|
|
4729
4738
|
draggable: !1,
|
|
4730
4739
|
className: "ci-w-full ci-h-full ci-object-cover"
|
|
4731
4740
|
}) : Q.camera
|
|
4732
4741
|
}),
|
|
4733
4742
|
/* @__PURE__ */ d("input", {
|
|
4734
|
-
value:
|
|
4735
|
-
onChange: (e) =>
|
|
4743
|
+
value: _,
|
|
4744
|
+
onChange: (e) => v(e.target.value),
|
|
4736
4745
|
placeholder: "Group name",
|
|
4737
|
-
onKeyDown: (e) => e.key === "Enter" &&
|
|
4746
|
+
onKeyDown: (e) => e.key === "Enter" && _.trim() && !y && E(),
|
|
4738
4747
|
className: "ci-flex-1 ci-min-w-0 ci-w-0 ci-px-4 ci-py-2 ci-rounded-3xl ci-border-0 ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-sm ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400 ci-outline-none focus:ci-ring-2 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500"
|
|
4739
4748
|
}),
|
|
4740
4749
|
/* @__PURE__ */ d(Z, {
|
|
4741
4750
|
variant: "green",
|
|
4742
4751
|
className: "ci-w-auto ci-h-10 ci-px-4 ci-shrink-0 ci-whitespace-nowrap",
|
|
4743
|
-
disabled: !
|
|
4744
|
-
onClick:
|
|
4745
|
-
children:
|
|
4752
|
+
disabled: !_.trim() || y,
|
|
4753
|
+
onClick: E,
|
|
4754
|
+
children: y ? "…" : "Create group"
|
|
4746
4755
|
})
|
|
4747
4756
|
] })
|
|
4748
4757
|
})
|
|
@@ -4751,22 +4760,22 @@ function Rr({ onOpen: e, onCreateGroup: t }) {
|
|
|
4751
4760
|
}
|
|
4752
4761
|
//#endregion
|
|
4753
4762
|
//#region src/theme.ts
|
|
4754
|
-
var
|
|
4763
|
+
var Vr = "chat-island-theme", Hr = () => {
|
|
4755
4764
|
try {
|
|
4756
|
-
let e = localStorage.getItem(
|
|
4765
|
+
let e = localStorage.getItem(Vr);
|
|
4757
4766
|
return e === "light" || e === "dark" || e === "system" ? e : void 0;
|
|
4758
4767
|
} catch {
|
|
4759
4768
|
return;
|
|
4760
4769
|
}
|
|
4761
4770
|
};
|
|
4762
|
-
function
|
|
4763
|
-
let [t, n] = c(() => e ??
|
|
4764
|
-
return i(() => n(e ??
|
|
4771
|
+
function Ur(e) {
|
|
4772
|
+
let [t, n] = c(() => e ?? Hr()), [r, a] = c(!1);
|
|
4773
|
+
return i(() => n(e ?? Hr()), [e]), i(() => {
|
|
4765
4774
|
let e = (e) => {
|
|
4766
4775
|
let t = e.detail?.theme;
|
|
4767
4776
|
if (t === "light" || t === "dark" || t === "system") {
|
|
4768
4777
|
try {
|
|
4769
|
-
localStorage.setItem(
|
|
4778
|
+
localStorage.setItem(Vr, t);
|
|
4770
4779
|
} catch {}
|
|
4771
4780
|
n(t);
|
|
4772
4781
|
}
|
|
@@ -4792,7 +4801,7 @@ function Vr(e) {
|
|
|
4792
4801
|
}
|
|
4793
4802
|
//#endregion
|
|
4794
4803
|
//#region src/ChatIsland.tsx
|
|
4795
|
-
function
|
|
4804
|
+
function Wr() {
|
|
4796
4805
|
let e = J.getState();
|
|
4797
4806
|
return Object.values(e.conversations).map((t) => {
|
|
4798
4807
|
let n = t.messages[t.messages.length - 1], r = e.contacts[t.peer];
|
|
@@ -4808,7 +4817,7 @@ function Hr() {
|
|
|
4808
4817
|
unread: t.unread,
|
|
4809
4818
|
members: t.members,
|
|
4810
4819
|
last: n ? {
|
|
4811
|
-
body:
|
|
4820
|
+
body: qr(n.body),
|
|
4812
4821
|
ts: n.ts,
|
|
4813
4822
|
mine: n.mine,
|
|
4814
4823
|
oob: n.oob,
|
|
@@ -4817,7 +4826,7 @@ function Hr() {
|
|
|
4817
4826
|
};
|
|
4818
4827
|
}).filter((e) => e.last || e.kind === "group").sort((e, t) => (t.last?.ts ?? 0) - (e.last?.ts ?? 0));
|
|
4819
4828
|
}
|
|
4820
|
-
var
|
|
4829
|
+
var Gr = class extends t {
|
|
4821
4830
|
state = { failed: !1 };
|
|
4822
4831
|
failures = [];
|
|
4823
4832
|
static getDerivedStateFromError() {
|
|
@@ -4835,7 +4844,7 @@ var Ur = class extends t {
|
|
|
4835
4844
|
return this.state.failed ? null : this.props.children;
|
|
4836
4845
|
}
|
|
4837
4846
|
};
|
|
4838
|
-
function
|
|
4847
|
+
function Kr(e) {
|
|
4839
4848
|
try {
|
|
4840
4849
|
let [t, n, r] = atob(e).split(":");
|
|
4841
4850
|
return t && n && r ? {
|
|
@@ -4847,9 +4856,9 @@ function Wr(e) {
|
|
|
4847
4856
|
return null;
|
|
4848
4857
|
}
|
|
4849
4858
|
}
|
|
4850
|
-
var
|
|
4851
|
-
function
|
|
4852
|
-
let g = o(() =>
|
|
4859
|
+
var qr = (e) => (pr(e) ? "Attachment" : $(e)).replace(/```[^\n]*\n?/g, "").replace(/(\*\*|__|~~|`)/g, "").replace(/(^|\s)[*_](\S[^*_]*)[*_]/g, "$1$2").replace(/\s+/g, " ").trim();
|
|
4860
|
+
function Jr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWorker: r, maxHeads: a = 5, newChatButton: l = !0, notifications: u = "click", sound: p = !0, drag: m = !0, onDragStart: h }) {
|
|
4861
|
+
let g = o(() => Kr(e), [e]), _ = Ur(n), v = s(g), y = s(p), b = s(u);
|
|
4853
4862
|
i(() => {
|
|
4854
4863
|
v.current = g, y.current = p, b.current = u;
|
|
4855
4864
|
}, [
|
|
@@ -4912,7 +4921,7 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
4912
4921
|
if (!t || !n) return;
|
|
4913
4922
|
let r = J.getState().conversations[e];
|
|
4914
4923
|
try {
|
|
4915
|
-
r?.kind === "group" && await t.leaveGroup(e, !!r.owner).catch(() => {}), await
|
|
4924
|
+
r?.kind === "group" && await t.leaveGroup(e, !!r.owner).catch(() => {}), await Vn(n.host, n.token, e), J.getState().removeConversation(e);
|
|
4916
4925
|
} catch (e) {
|
|
4917
4926
|
Y("chat-island-error", {
|
|
4918
4927
|
scope: "delete",
|
|
@@ -4961,11 +4970,11 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
4961
4970
|
let e = J.getState();
|
|
4962
4971
|
e.reset(), J.setState({
|
|
4963
4972
|
me: g.username,
|
|
4964
|
-
mucHost: `conference.${
|
|
4973
|
+
mucHost: `conference.${gn}`,
|
|
4965
4974
|
maxHeads: a,
|
|
4966
4975
|
newChatButton: l
|
|
4967
4976
|
});
|
|
4968
|
-
let t = new
|
|
4977
|
+
let t = new vn(g, {
|
|
4969
4978
|
status: (n, a) => {
|
|
4970
4979
|
if (e.setStatus(n, a), Y("chat-island-status", {
|
|
4971
4980
|
status: n,
|
|
@@ -4990,7 +4999,7 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
4990
4999
|
}).catch(() => {});
|
|
4991
5000
|
},
|
|
4992
5001
|
message: (r) => {
|
|
4993
|
-
let i =
|
|
5002
|
+
let i = Nn(r);
|
|
4994
5003
|
r.room && !J.getState().conversations[r.room]?.name && t.groupInfo(r.room).then((t) => e.setGroup(t.peer, t.name, t.members, t.avatar, t.owner)).catch(() => {}), e.addMessage(i, r, { live: !0 }), Y("chat-island-message", {
|
|
4995
5004
|
...r,
|
|
4996
5005
|
peer: i
|
|
@@ -5000,7 +5009,7 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
5000
5009
|
let n = J.getState(), r = document.visibilityState === "visible";
|
|
5001
5010
|
if (r && n.open === e) return;
|
|
5002
5011
|
let i = n.conversations[e], a = i?.kind === "group" ? i.name ?? e : n.contacts[e]?.name ?? n.inactive[e] ?? e, o = t.oob ? "Attachment" : $(t.body), s = i?.kind === "group", c = s && t.nick ? n.contacts[t.nick]?.name ?? t.nick : a, l = s && t.nick ? `${c}: ${o}` : o;
|
|
5003
|
-
y.current &&
|
|
5012
|
+
y.current && wn();
|
|
5004
5013
|
let u = s ? i?.avatar : n.contacts[e]?.avatar;
|
|
5005
5014
|
if (Y("chat-island-notify", {
|
|
5006
5015
|
peer: e,
|
|
@@ -5024,7 +5033,7 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
5024
5033
|
};
|
|
5025
5034
|
C.current = t;
|
|
5026
5035
|
let i = () => {
|
|
5027
|
-
r && !D.current && (D.current = !0,
|
|
5036
|
+
r && !D.current && (D.current = !0, Gn(g, r).then((e) => {
|
|
5028
5037
|
if (!e) {
|
|
5029
5038
|
D.current = !1, J.setState({ push: Notification.permission === "denied" ? "denied" : "ask" });
|
|
5030
5039
|
return;
|
|
@@ -5046,15 +5055,15 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
5046
5055
|
let s = () => t.stop();
|
|
5047
5056
|
window.addEventListener("pagehide", s), t.start();
|
|
5048
5057
|
let c = () => {
|
|
5049
|
-
|
|
5058
|
+
zn(g.host, g.token).then(e.setMobile).catch(() => {}), Bn(g.host, g.token).then(e.setInactive).catch(() => {});
|
|
5050
5059
|
};
|
|
5051
5060
|
c();
|
|
5052
5061
|
let u = window.setInterval(c, 12e4);
|
|
5053
|
-
|
|
5062
|
+
Rn(g.host, g.token, g.username, (e) => J.setState({ myName: e })).then(e.setContacts).catch((e) => Y("chat-island-error", {
|
|
5054
5063
|
scope: "contacts",
|
|
5055
5064
|
message: e.message
|
|
5056
5065
|
}));
|
|
5057
|
-
let d = X("chat-island-open", ({ username: t }) => t && e.openChat(t)), f = X("chat-island-close", () => e.closeChat()), p = X("chat-island-new", () => e.setPicker(!0)), m = X("chat-island-delete", ({ username: e }) => e && N.remove(e)), h = X("chat-island-contacts", ({ contacts: t }) => t && e.setContacts(t)), _ = X("chat-island-conversations-request", () => Y("chat-island-conversations", { conversations:
|
|
5066
|
+
let d = X("chat-island-open", ({ username: t }) => t && e.openChat(t)), f = X("chat-island-close", () => e.closeChat()), p = X("chat-island-new", () => e.setPicker(!0)), m = X("chat-island-delete", ({ username: e }) => e && N.remove(e)), h = X("chat-island-contacts", ({ contacts: t }) => t && e.setContacts(t)), _ = X("chat-island-conversations-request", () => Y("chat-island-conversations", { conversations: Wr() }));
|
|
5058
5067
|
return () => {
|
|
5059
5068
|
window.removeEventListener("pagehide", s), window.clearInterval(u), _(), p(), m(), d(), f(), h(), O.current && t.disablePush(O.current.service, O.current.node).catch(() => {}), O.current = null, t.stop(), C.current = null, D.current = !1;
|
|
5060
5069
|
};
|
|
@@ -5068,7 +5077,7 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
5068
5077
|
M === "online" && P && C.current?.announce(P.split(","));
|
|
5069
5078
|
}, [M, P]);
|
|
5070
5079
|
let te = J((e) => Object.values(e.conversations).map((e) => `${e.peer}:${e.kind}:${e.name ?? ""}:${(e.members ?? []).length}:${e.unread}:${e.messages[e.messages.length - 1]?.id ?? ""}`).join("|") + "#" + Object.keys(e.contacts).length + "#" + Object.values(e.online).filter(Boolean).length + "#" + Object.keys(e.inactive).length);
|
|
5071
|
-
i(() => Y("chat-island-conversations", { conversations:
|
|
5080
|
+
i(() => Y("chat-island-conversations", { conversations: Wr() }), [te]);
|
|
5072
5081
|
let ne = J((e) => Object.values(e.conversations).reduce((e, t) => e + t.unread, 0));
|
|
5073
5082
|
if (i(() => Y("chat-island-unread", { total: ne }), [ne]), !g) return null;
|
|
5074
5083
|
let re = m && !h && A.anchor ? {
|
|
@@ -5081,17 +5090,18 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
5081
5090
|
onClickCapture: A.onClickCapture,
|
|
5082
5091
|
className: `chat-island-root ${_ ? "ci-dark" : ""} ci-fixed ${ie} ci-z-[9999] ci-flex ci-items-end ci-gap-3 ci-font-sans ci-select-none`,
|
|
5083
5092
|
"data-status": M,
|
|
5084
|
-
children: /* @__PURE__ */ f(
|
|
5085
|
-
ee && /* @__PURE__ */ d(
|
|
5093
|
+
children: /* @__PURE__ */ f(Gr, { children: [
|
|
5094
|
+
ee && /* @__PURE__ */ d(Rr, {
|
|
5086
5095
|
peer: ee,
|
|
5087
5096
|
actions: N,
|
|
5088
5097
|
onDragStart: h ?? (m ? A.start : void 0)
|
|
5089
5098
|
}),
|
|
5090
|
-
j && /* @__PURE__ */ d(
|
|
5099
|
+
j && /* @__PURE__ */ d(Br, {
|
|
5091
5100
|
onOpen: (e) => J.getState().openChat(e),
|
|
5092
|
-
onCreateGroup: N.createGroup
|
|
5101
|
+
onCreateGroup: N.createGroup,
|
|
5102
|
+
onDragStart: h ?? (m ? A.start : void 0)
|
|
5093
5103
|
}),
|
|
5094
|
-
/* @__PURE__ */ d(
|
|
5104
|
+
/* @__PURE__ */ d(Qn, {
|
|
5095
5105
|
onDragStart: h ?? (m ? A.start : void 0),
|
|
5096
5106
|
pushButton: u !== "auto"
|
|
5097
5107
|
})
|
|
@@ -5099,4 +5109,4 @@ function Kr({ dataConfig: e, position: t = "bottom-right", theme: n, serviceWork
|
|
|
5099
5109
|
});
|
|
5100
5110
|
}
|
|
5101
5111
|
//#endregion
|
|
5102
|
-
export {
|
|
5112
|
+
export { Jr as ChatIsland, In as contactsFromOperators };
|