@minicode-dev/chat 0.1.8 → 0.1.9
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 +191 -124
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8811,27 +8811,105 @@ function Ll({ onSelect: e, onClose: t, disabled: n }) {
|
|
|
8811
8811
|
]
|
|
8812
8812
|
});
|
|
8813
8813
|
}
|
|
8814
|
-
// src/
|
|
8815
|
-
var Rl =
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8814
|
+
// src/media/emoji/emojiAutocompleteToken.js
|
|
8815
|
+
var Rl = new Map([
|
|
8816
|
+
[
|
|
8817
|
+
[":)", ":-)"],
|
|
8818
|
+
"🙂",
|
|
8819
|
+
"slightly_smiling_face",
|
|
8820
|
+
"Cara sonriente"
|
|
8821
|
+
],
|
|
8822
|
+
[
|
|
8823
|
+
[":D", ":-D"],
|
|
8824
|
+
"😄",
|
|
8825
|
+
"smile",
|
|
8826
|
+
"Sonrisa grande"
|
|
8827
|
+
],
|
|
8828
|
+
[
|
|
8829
|
+
[":O", ":-O"],
|
|
8830
|
+
"😮",
|
|
8831
|
+
"open_mouth",
|
|
8832
|
+
"Cara de asombro"
|
|
8833
|
+
],
|
|
8834
|
+
[
|
|
8835
|
+
[
|
|
8836
|
+
":/",
|
|
8837
|
+
":-/",
|
|
8838
|
+
":\\",
|
|
8839
|
+
":-\\"
|
|
8840
|
+
],
|
|
8841
|
+
"😕",
|
|
8842
|
+
"confused",
|
|
8843
|
+
"Cara confundida"
|
|
8844
|
+
],
|
|
8845
|
+
[
|
|
8846
|
+
[":(", ":-("],
|
|
8847
|
+
"🙁",
|
|
8848
|
+
"slightly_frowning_face",
|
|
8849
|
+
"Cara triste"
|
|
8850
|
+
],
|
|
8851
|
+
[
|
|
8852
|
+
[";)", ";-)"],
|
|
8853
|
+
"😉",
|
|
8854
|
+
"wink",
|
|
8855
|
+
"Guiño"
|
|
8856
|
+
],
|
|
8857
|
+
[
|
|
8858
|
+
[":P", ":-P"],
|
|
8859
|
+
"😛",
|
|
8860
|
+
"stuck_out_tongue",
|
|
8861
|
+
"Sacando la lengua"
|
|
8862
|
+
],
|
|
8863
|
+
[
|
|
8864
|
+
[":*", ":-*"],
|
|
8865
|
+
"😘",
|
|
8866
|
+
"kissing_heart",
|
|
8867
|
+
"Beso"
|
|
8868
|
+
],
|
|
8869
|
+
[
|
|
8870
|
+
[":|", ":-|"],
|
|
8871
|
+
"😐",
|
|
8872
|
+
"neutral_face",
|
|
8873
|
+
"Cara neutral"
|
|
8874
|
+
],
|
|
8875
|
+
[
|
|
8876
|
+
[":'("],
|
|
8877
|
+
"😢",
|
|
8878
|
+
"cry",
|
|
8879
|
+
"Cara llorando"
|
|
8880
|
+
],
|
|
8881
|
+
[
|
|
8882
|
+
["<3"],
|
|
8883
|
+
"❤️",
|
|
8884
|
+
"heart",
|
|
8885
|
+
"Corazón"
|
|
8886
|
+
]
|
|
8887
|
+
].flatMap(([e, t, n, r]) => e.map((e) => [e.toLowerCase(), {
|
|
8888
|
+
emoji: t,
|
|
8889
|
+
shortcode: n,
|
|
8890
|
+
label: r,
|
|
8891
|
+
source: "unicode"
|
|
8892
|
+
}])));
|
|
8893
|
+
function zl(e, t = e.length) {
|
|
8894
|
+
let n = e.slice(0, t), r = /(^|[^\p{L}\p{N}_/:\\])([:;<][^\s]{1,32})$/u.exec(n);
|
|
8895
|
+
if (!r) return null;
|
|
8896
|
+
let i = r[2], a = r.index + r[1].length, o = Rl.get(i.toLowerCase());
|
|
8897
|
+
return o ? {
|
|
8898
|
+
start: a,
|
|
8899
|
+
shortcode: i.slice(1),
|
|
8900
|
+
emoticon: {
|
|
8901
|
+
...o,
|
|
8902
|
+
emoticon: i
|
|
8826
8903
|
}
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8904
|
+
} : /^:[\p{L}\p{N}_+\p{M}-]{1,32}$/u.test(i) ? {
|
|
8905
|
+
start: a,
|
|
8906
|
+
shortcode: i.slice(1)
|
|
8907
|
+
} : null;
|
|
8831
8908
|
}
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8909
|
+
// src/ui/components/EmojiAutocomplete.jsx
|
|
8910
|
+
var Bl = 8, Vl = 48, Hl = (e) => typeof e == "string" ? e : e?.emoji || "", Ul = (e) => String(e || "").replace(/️/g, ""), Wl = (e) => String(e).normalize("NFD").replace(/\p{M}/gu, "").toLowerCase();
|
|
8911
|
+
function Gl({ shortcode: e, query: t }) {
|
|
8912
|
+
let n = Wl(e), r = Wl(t);
|
|
8835
8913
|
if (r && n.startsWith(r)) return /* @__PURE__ */ $(Et, { children: [
|
|
8836
8914
|
":",
|
|
8837
8915
|
/* @__PURE__ */ Q("mark", {
|
|
@@ -8857,30 +8935,31 @@ function Wl({ shortcode: e, query: t }) {
|
|
|
8857
8935
|
":"
|
|
8858
8936
|
] });
|
|
8859
8937
|
}
|
|
8860
|
-
function
|
|
8861
|
-
let a = Sa(), [o, s] = W([]), [c, l] = W(0), [u, d] = W(""), f = U(null), p = U(-1), { skinTone: m, recents: h, addRecent: g } = Bo() || {}, _ = Ho(), v = `chat-emoji-ac-${ce().replace(/:/g, "")}`, y = (e) => `${v}-opt-${e}`, b = B((e) => e.source === "custom" ? e.emoji : Co(e, m) || e.emoji, [m]), x = H(() => Array.isArray(h) ? h.map(
|
|
8938
|
+
function Kl({ textareaRef: e, value: t, onInsert: n, onClose: r, isOpen: i }) {
|
|
8939
|
+
let a = Sa(), [o, s] = W([]), [c, l] = W(0), [u, d] = W(""), f = U(null), p = U(-1), { skinTone: m, recents: h, addRecent: g } = Bo() || {}, _ = Ho(), v = `chat-emoji-ac-${ce().replace(/:/g, "")}`, y = (e) => `${v}-opt-${e}`, b = B((e) => e.source === "custom" ? e.emoji : Co(e, m) || e.emoji, [m]), x = H(() => Array.isArray(h) ? h.map(Hl).filter(Boolean) : [], [h]);
|
|
8862
8940
|
V(() => {
|
|
8863
8941
|
if (!i || !e.current) {
|
|
8864
8942
|
s([]);
|
|
8865
8943
|
return;
|
|
8866
8944
|
}
|
|
8867
|
-
let n = e.current.selectionStart, o =
|
|
8945
|
+
let n = e.current.selectionStart, o = zl(t, n);
|
|
8868
8946
|
if (!o || o.shortcode.length === 0) {
|
|
8869
8947
|
s([]), r();
|
|
8870
8948
|
return;
|
|
8871
8949
|
}
|
|
8872
8950
|
let c = (e, t) => [...xa(a, e), ...bo(e, { limit: t })].slice(0, t), u;
|
|
8873
|
-
if (o.
|
|
8874
|
-
|
|
8875
|
-
|
|
8951
|
+
if (o.emoticon) u = [o.emoticon];
|
|
8952
|
+
else if (o.shortcode.length === 1 && x.length) {
|
|
8953
|
+
let e = c(o.shortcode, Vl), t = (e) => {
|
|
8954
|
+
let t = [Ul(e.emoji), Ul(b(e))], n = x.findIndex((e) => t.includes(Ul(e)));
|
|
8876
8955
|
return n === -1 ? Infinity : n;
|
|
8877
8956
|
}, n = e.map((e, n) => ({
|
|
8878
8957
|
record: e,
|
|
8879
8958
|
order: n,
|
|
8880
8959
|
recent: t(e)
|
|
8881
8960
|
}));
|
|
8882
|
-
n.sort((e, t) => e.recent === t.recent ? e.order - t.order : e.recent - t.recent), u = n.slice(0,
|
|
8883
|
-
} else u = c(o.shortcode,
|
|
8961
|
+
n.sort((e, t) => e.recent === t.recent ? e.order - t.order : e.recent - t.recent), u = n.slice(0, Bl).map(({ record: e }) => e);
|
|
8962
|
+
} else u = c(o.shortcode, Bl);
|
|
8884
8963
|
u.length ? (p.current = o.start, d(o.shortcode), s(u), l(0)) : (s([]), r());
|
|
8885
8964
|
}, [
|
|
8886
8965
|
t,
|
|
@@ -9014,7 +9093,7 @@ function Gl({ textareaRef: e, value: t, onInsert: n, onClose: r, isOpen: i }) {
|
|
|
9014
9093
|
className: "chat-emoji-autocomplete-text",
|
|
9015
9094
|
children: [/* @__PURE__ */ Q("span", {
|
|
9016
9095
|
className: "chat-emoji-autocomplete-shortcode",
|
|
9017
|
-
children: /* @__PURE__ */ Q(
|
|
9096
|
+
children: e.emoticon || /* @__PURE__ */ Q(Gl, {
|
|
9018
9097
|
shortcode: e.shortcode,
|
|
9019
9098
|
query: u
|
|
9020
9099
|
})
|
|
@@ -9029,7 +9108,7 @@ function Gl({ textareaRef: e, value: t, onInsert: n, onClose: r, isOpen: i }) {
|
|
|
9029
9108
|
}) : null;
|
|
9030
9109
|
}
|
|
9031
9110
|
// src/ui/components/MessageComposer.jsx
|
|
9032
|
-
var
|
|
9111
|
+
var ql = ["connect4", "battleship"], Jl = [
|
|
9033
9112
|
{
|
|
9034
9113
|
type: "connect4",
|
|
9035
9114
|
label: "Conecta 4",
|
|
@@ -9051,7 +9130,7 @@ var Kl = ["connect4", "battleship"], ql = [
|
|
|
9051
9130
|
Icon: Ee
|
|
9052
9131
|
}
|
|
9053
9132
|
];
|
|
9054
|
-
function
|
|
9133
|
+
function Yl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, attachments: a = [], attachmentError: o, sending: s = !1, onAddAttachment: c, onRemoveAttachment: l, reply: u, onCancelReply: d, onInviteGame: f, gameInviteDisabled: p, gameTypes: m = ql, onOpenBattleshipPreview: h, editing: g = null, onStartEditLast: _, onCancelEdit: v }) {
|
|
9055
9134
|
let y = Sa(), b = U(null), x = U(null), [S, C] = W(520), [w, T] = W(520), E = U(null), D = U(null), O = U(null), k = U(null), [A, j] = W(null), [M, N] = W(!1), P = B(() => N(!1), []), F = B((e) => n(e), [n]), I = Os(c), L = I.status !== "idle", ee = a[0], R = _n(ee) ? "Enviando sticker…" : ee?.kind === "gif" ? "Enviando GIF…" : ee?.type?.startsWith("audio/") ? "Enviando audio…" : ee ? "Enviando archivo…" : "Enviando mensaje…";
|
|
9056
9135
|
V(() => {
|
|
9057
9136
|
s && (j(null), N(!1));
|
|
@@ -9141,19 +9220,7 @@ function Jl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
|
|
|
9141
9220
|
return;
|
|
9142
9221
|
}
|
|
9143
9222
|
}
|
|
9144
|
-
n(t), A && j(null);
|
|
9145
|
-
let a = e.target.selectionStart, o = t.substring(0, a), s = o.lastIndexOf(":");
|
|
9146
|
-
if (s >= 0) {
|
|
9147
|
-
let e = o.substring(s + 1);
|
|
9148
|
-
if (/^[\p{L}\p{N}_+\p{M}-]*$/u.test(e) && e.length > 0 && e.length <= 32) {
|
|
9149
|
-
let e = o.substring(0, s);
|
|
9150
|
-
if (!e || !/[\p{L}\p{N}]$/u.test(e)) {
|
|
9151
|
-
N(!0);
|
|
9152
|
-
return;
|
|
9153
|
-
}
|
|
9154
|
-
}
|
|
9155
|
-
}
|
|
9156
|
-
N(!1);
|
|
9223
|
+
n(t), A && j(null), N(!!zl(t, r));
|
|
9157
9224
|
}, [
|
|
9158
9225
|
n,
|
|
9159
9226
|
A,
|
|
@@ -9412,7 +9479,7 @@ function Jl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
|
|
|
9412
9479
|
children: [f && /* @__PURE__ */ $(Et, { children: [/* @__PURE__ */ Q("span", {
|
|
9413
9480
|
className: "chat-game-menu-title",
|
|
9414
9481
|
children: "Invitar a jugar"
|
|
9415
|
-
}),
|
|
9482
|
+
}), Jl.filter((e) => m.includes(e.type)).map(({ type: e, label: t, Icon: n }) => /* @__PURE__ */ $("button", {
|
|
9416
9483
|
type: "button",
|
|
9417
9484
|
role: "menuitem",
|
|
9418
9485
|
className: "chat-game-menu-item",
|
|
@@ -9507,7 +9574,7 @@ function Jl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
|
|
|
9507
9574
|
disabled: i
|
|
9508
9575
|
})]
|
|
9509
9576
|
}),
|
|
9510
|
-
/* @__PURE__ */ Q(
|
|
9577
|
+
/* @__PURE__ */ Q(Kl, {
|
|
9511
9578
|
textareaRef: b,
|
|
9512
9579
|
value: t,
|
|
9513
9580
|
onInsert: F,
|
|
@@ -9518,7 +9585,7 @@ function Jl({ onSendEffect: e, value: t, onChange: n, onSend: r, disabled: i, at
|
|
|
9518
9585
|
});
|
|
9519
9586
|
}
|
|
9520
9587
|
// src/games/shared/ChatGamePanel.jsx
|
|
9521
|
-
function
|
|
9588
|
+
function Xl({ gameKey: e, currentUserId: t }) {
|
|
9522
9589
|
let n = r((t) => t.games[e]), i = ls((t) => !!t.panels[e]?.minimized);
|
|
9523
9590
|
if (!n) return null;
|
|
9524
9591
|
let { setMinimized: a, dismiss: o } = ls.getState(), s = n.status === "active" && P(t, n.turnId), c = F(n), l = n.game === "tanks_live", u = j(n) && !n.pendingEvent;
|
|
@@ -9559,7 +9626,7 @@ function Yl({ gameKey: e, currentUserId: t }) {
|
|
|
9559
9626
|
});
|
|
9560
9627
|
}
|
|
9561
9628
|
// src/ui/components/ChatWindow.jsx
|
|
9562
|
-
function
|
|
9629
|
+
function Zl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEffect: r, effectError: i, BattleshipPreviewComponent: a = null, placement: o = "floating", theme: s, standalone: c, onDetach: l, onInstall: u, installHelp: d, onDismissInstallHelp: f, title: p, subtitle: m, headerType: h, headerSecondary: g, headerPresence: _, currentUserName: v, myPresence: y, onSetPresence: b, isOpen: x, isMaximized: S, isMinimized: C, onClose: w, onMinimize: T, onToggleMaximize: E, rooms: D, users: O, messages: k, onInviteGame: A, gameInviteDisabled: j, gameTypes: M, gameError: N, gamePanelKey: P, currentUserId: F, currentUserIds: I, onSelectRoom: L, onSelectUser: ee, selectedId: R, inputValue: z, onInputChange: te, onSend: ne, attachments: ie, onAddAttachment: ae, onRemoveAttachment: oe, status: B, disabled: se, onSearch: ce, searchResults: H, searchStatus: le, searchQuery: G, presenceStatus: ue, onCreateGroup: K, attachmentError: de, sending: fe, reply: q, onReply: pe, onCancelReply: J, privateRooms: Y, knownUsers: X, unreadCounts: he, onlineUsers: ge, editing: _e, onStartEditLast: ve, onCancelEdit: ye, onEditMessage: be, onReact: xe }) {
|
|
9563
9630
|
let [Se, Ce] = Yi(), we = U(null), [Te, Ee] = W(!0), [De, Oe] = W(!1);
|
|
9564
9631
|
V(() => {
|
|
9565
9632
|
Oe(!1);
|
|
@@ -9739,7 +9806,7 @@ function Xl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEf
|
|
|
9739
9806
|
onEditMessage: be,
|
|
9740
9807
|
editingId: _e?.messageId
|
|
9741
9808
|
}, `messages:${R}`),
|
|
9742
|
-
P && !De && /* @__PURE__ */ Q(
|
|
9809
|
+
P && !De && /* @__PURE__ */ Q(Xl, {
|
|
9743
9810
|
gameKey: P,
|
|
9744
9811
|
currentUserId: F
|
|
9745
9812
|
}, P),
|
|
@@ -9772,7 +9839,7 @@ function Xl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEf
|
|
|
9772
9839
|
role: "alert",
|
|
9773
9840
|
children: N
|
|
9774
9841
|
}),
|
|
9775
|
-
/* @__PURE__ */ Q(
|
|
9842
|
+
/* @__PURE__ */ Q(Yl, {
|
|
9776
9843
|
onSendEffect: r,
|
|
9777
9844
|
onInviteGame: A,
|
|
9778
9845
|
gameInviteDisabled: j,
|
|
@@ -9801,31 +9868,31 @@ function Xl({ effectsConfig: e, effectScope: t, effectIdentityScope: n, onSendEf
|
|
|
9801
9868
|
}) : null;
|
|
9802
9869
|
}
|
|
9803
9870
|
// src/pwa/chatApp.js
|
|
9804
|
-
var
|
|
9805
|
-
|
|
9806
|
-
},
|
|
9807
|
-
function
|
|
9808
|
-
if (
|
|
9809
|
-
if (
|
|
9871
|
+
var Ql = null, $l = () => typeof window < "u", eu = () => {
|
|
9872
|
+
$l() && window.dispatchEvent(new Event("chat-install-change"));
|
|
9873
|
+
}, tu = 0, nu = null;
|
|
9874
|
+
function ru() {
|
|
9875
|
+
if (!$l()) return () => {};
|
|
9876
|
+
if (tu++ === 0) {
|
|
9810
9877
|
let e = (e) => {
|
|
9811
|
-
e.preventDefault(),
|
|
9878
|
+
e.preventDefault(), Ql = e, eu();
|
|
9812
9879
|
}, t = () => {
|
|
9813
|
-
|
|
9880
|
+
Ql = null, eu();
|
|
9814
9881
|
};
|
|
9815
|
-
window.addEventListener("beforeinstallprompt", e), window.addEventListener("appinstalled", t),
|
|
9882
|
+
window.addEventListener("beforeinstallprompt", e), window.addEventListener("appinstalled", t), nu = () => {
|
|
9816
9883
|
window.removeEventListener("beforeinstallprompt", e), window.removeEventListener("appinstalled", t);
|
|
9817
9884
|
};
|
|
9818
9885
|
}
|
|
9819
9886
|
let e = !1;
|
|
9820
9887
|
return function() {
|
|
9821
|
-
e || (e = !0, --
|
|
9888
|
+
e || (e = !0, --tu === 0 && (nu?.(), nu = null, Ql = null));
|
|
9822
9889
|
};
|
|
9823
9890
|
}
|
|
9824
|
-
function
|
|
9825
|
-
let e = () =>
|
|
9891
|
+
function iu() {
|
|
9892
|
+
let e = () => $l() && (window.matchMedia("(display-mode: standalone)").matches || !!navigator.standalone), [t, n] = W(e), [r, i] = W(!!Ql), [a, o] = W("");
|
|
9826
9893
|
return V(() => {
|
|
9827
9894
|
let t = window.matchMedia("(display-mode: standalone)"), r = () => {
|
|
9828
|
-
n(e()), i(!!
|
|
9895
|
+
n(e()), i(!!Ql);
|
|
9829
9896
|
};
|
|
9830
9897
|
return window.addEventListener("chat-install-change", r), t.addEventListener("change", r), () => {
|
|
9831
9898
|
window.removeEventListener("chat-install-change", r), t.removeEventListener("change", r);
|
|
@@ -9838,12 +9905,12 @@ function ru() {
|
|
|
9838
9905
|
o("Para instalar el chat, abre la aplicación mediante HTTPS o localhost.");
|
|
9839
9906
|
return;
|
|
9840
9907
|
}
|
|
9841
|
-
if (!
|
|
9908
|
+
if (!Ql) {
|
|
9842
9909
|
o("Abre el menú del navegador y elige “Instalar LIRA Chat” o “Añadir al Dock / pantalla de inicio”. Si no aparece, abre esta ventana de chat en una pestaña del navegador.");
|
|
9843
9910
|
return;
|
|
9844
9911
|
}
|
|
9845
|
-
let e =
|
|
9846
|
-
|
|
9912
|
+
let e = Ql;
|
|
9913
|
+
Ql = null, eu();
|
|
9847
9914
|
try {
|
|
9848
9915
|
await e.prompt(), await e.userChoice;
|
|
9849
9916
|
} catch {
|
|
@@ -9854,19 +9921,19 @@ function ru() {
|
|
|
9854
9921
|
dismissInstallHelp: () => o("")
|
|
9855
9922
|
};
|
|
9856
9923
|
}
|
|
9857
|
-
var
|
|
9858
|
-
function
|
|
9859
|
-
if (
|
|
9924
|
+
var au = null;
|
|
9925
|
+
function ou({ path: e = "/chat", windowName: t = "lira-independent-chat" } = {}) {
|
|
9926
|
+
if (au && !au.closed) return au.focus(), !0;
|
|
9860
9927
|
let n = Math.min(520, window.screen.availWidth), r = Math.min(800, window.screen.availHeight);
|
|
9861
|
-
return
|
|
9928
|
+
return au = window.open(e, t, `popup=yes,width=${n},height=${r},resizable=yes,scrollbars=yes`), au ? (au.opener = null, au.focus(), !0) : !1;
|
|
9862
9929
|
}
|
|
9863
|
-
function
|
|
9864
|
-
e &&
|
|
9930
|
+
function su({ enabled: e = !0, path: t = "/chat", swUrl: n = "/chat-sw.js" } = {}) {
|
|
9931
|
+
e && $l() && "serviceWorker" in navigator && window.isSecureContext && window.location.pathname === t && navigator.serviceWorker.register(n, { scope: t }).catch((e) => console.warn("Chat service worker:", e));
|
|
9865
9932
|
}
|
|
9866
9933
|
// src/ui/connected/useChatController.js
|
|
9867
|
-
var
|
|
9868
|
-
function
|
|
9869
|
-
let n =
|
|
9934
|
+
var cu = 10485760;
|
|
9935
|
+
function lu({ isOpen: e = !1, isMinimized: t = !1 } = {}) {
|
|
9936
|
+
let n = iu(), { effects: i, features: a } = fr(), o = a?.games, s = H(() => [
|
|
9870
9937
|
"connect4",
|
|
9871
9938
|
"battleship",
|
|
9872
9939
|
"tanks",
|
|
@@ -10108,7 +10175,7 @@ function cu({ isOpen: e = !1, isMinimized: t = !1 } = {}) {
|
|
|
10108
10175
|
return;
|
|
10109
10176
|
}
|
|
10110
10177
|
else {
|
|
10111
|
-
if (!(e instanceof Blob) || !e.size || e.size >
|
|
10178
|
+
if (!(e instanceof Blob) || !e.size || e.size > cu) {
|
|
10112
10179
|
J("Máximo 10 MB por archivo.");
|
|
10113
10180
|
return;
|
|
10114
10181
|
}
|
|
@@ -10254,14 +10321,14 @@ function cu({ isOpen: e = !1, isMinimized: t = !1 } = {}) {
|
|
|
10254
10321
|
};
|
|
10255
10322
|
}
|
|
10256
10323
|
// src/ui/connected/chatUiStore.js
|
|
10257
|
-
var
|
|
10324
|
+
var uu = ue((e) => ({
|
|
10258
10325
|
isOpen: !1,
|
|
10259
10326
|
open: () => e({ isOpen: !0 }),
|
|
10260
10327
|
close: () => e({ isOpen: !1 }),
|
|
10261
10328
|
toggle: () => e((e) => ({ isOpen: !e.isOpen }))
|
|
10262
|
-
})),
|
|
10263
|
-
function
|
|
10264
|
-
let r = fr(), i = e === "embedded" || e === "page", a = t !== void 0, o =
|
|
10329
|
+
})), du = (e) => e, fu = (e = du) => K(uu, e), pu = (e) => !e || e === document || e === document.body || document.documentElement === e || typeof e.closest == "function" && !!e.closest(".chat-window");
|
|
10330
|
+
function mu({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
|
|
10331
|
+
let r = fr(), i = e === "embedded" || e === "page", a = t !== void 0, o = fu((e) => e.isOpen), s = i || !!(a ? t : o), [c, l] = W(!1), [u, d] = W(!1), f = U({});
|
|
10265
10332
|
f.current = {
|
|
10266
10333
|
controlled: a,
|
|
10267
10334
|
onOpenChange: n,
|
|
@@ -10269,7 +10336,7 @@ function pu({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
|
|
|
10269
10336
|
};
|
|
10270
10337
|
let p = B((e) => {
|
|
10271
10338
|
let { controlled: t, onOpenChange: n, onConfigOpenChange: r } = f.current;
|
|
10272
|
-
t ||
|
|
10339
|
+
t || uu.setState({ isOpen: e }), n?.(e), r?.(e);
|
|
10273
10340
|
}, []);
|
|
10274
10341
|
V(() => {
|
|
10275
10342
|
s && d(!1);
|
|
@@ -10286,14 +10353,14 @@ function pu({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
|
|
|
10286
10353
|
u,
|
|
10287
10354
|
g,
|
|
10288
10355
|
h
|
|
10289
|
-
]), y = B(() => l((e) => !e), []), b = r?.pwa, x = B(() =>
|
|
10356
|
+
]), y = B(() => l((e) => !e), []), b = r?.pwa, x = B(() => ou({
|
|
10290
10357
|
path: b?.path,
|
|
10291
10358
|
windowName: b?.windowName
|
|
10292
10359
|
}) ? (d(!1), p(!1), !0) : !1, [b, p]);
|
|
10293
10360
|
return V(() => {
|
|
10294
10361
|
if (!s || i) return;
|
|
10295
10362
|
let e = (e) => {
|
|
10296
|
-
e.key === "Escape" && !e.defaultPrevented &&
|
|
10363
|
+
e.key === "Escape" && !e.defaultPrevented && pu(e.target) && (e.preventDefault(), m ? h() : _());
|
|
10297
10364
|
};
|
|
10298
10365
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
10299
10366
|
}, [
|
|
@@ -10319,8 +10386,8 @@ function pu({ mode: e = "floating", open: t, onOpenChange: n } = {}) {
|
|
|
10319
10386
|
};
|
|
10320
10387
|
}
|
|
10321
10388
|
// src/ui/connected/ChatWindow.jsx
|
|
10322
|
-
var
|
|
10323
|
-
function
|
|
10389
|
+
var hu = "El navegador bloqueó la ventana. Permite ventanas emergentes para este sitio.", gu = (e) => typeof document > "u" ? null : (typeof e?.portalContainer == "function" ? e.portalContainer() : e?.portalContainer) || document.body;
|
|
10390
|
+
function _u({ open: e, onClose: t, theme: n, children: r }) {
|
|
10324
10391
|
let i = U(null), a = Zi(i, {
|
|
10325
10392
|
active: e,
|
|
10326
10393
|
autoFocus: e
|
|
@@ -10339,15 +10406,15 @@ function gu({ open: e, onClose: t, theme: n, children: r }) {
|
|
|
10339
10406
|
})
|
|
10340
10407
|
}) : null;
|
|
10341
10408
|
}
|
|
10342
|
-
function
|
|
10343
|
-
let o = fr(), s = e === "modal" || e === "embedded" ? e : "floating", c =
|
|
10409
|
+
function vu({ placement: e = "floating", open: t, onOpenChange: n, theme: r, className: i, BattleshipPreviewComponent: a = null }) {
|
|
10410
|
+
let o = fr(), s = e === "modal" || e === "embedded" ? e : "floating", c = mu({
|
|
10344
10411
|
mode: s,
|
|
10345
10412
|
open: t,
|
|
10346
10413
|
onOpenChange: n
|
|
10347
|
-
}), l =
|
|
10414
|
+
}), l = lu({
|
|
10348
10415
|
isOpen: c.isOpen,
|
|
10349
10416
|
isMinimized: c.isMinimized
|
|
10350
|
-
}), u = s === "floating", d = u && o?.features?.detach !== !1, f = /* @__PURE__ */ Q(
|
|
10417
|
+
}), u = s === "floating", d = u && o?.features?.detach !== !1, f = /* @__PURE__ */ Q(Zl, {
|
|
10351
10418
|
...l.windowProps,
|
|
10352
10419
|
BattleshipPreviewComponent: a,
|
|
10353
10420
|
placement: s,
|
|
@@ -10356,7 +10423,7 @@ function _u({ placement: e = "floating", open: t, onOpenChange: n, theme: r, cla
|
|
|
10356
10423
|
isMaximized: u && c.isMaximized,
|
|
10357
10424
|
isMinimized: c.isMinimized,
|
|
10358
10425
|
onDetach: d ? () => {
|
|
10359
|
-
c.detach() || l.setAttachmentError(
|
|
10426
|
+
c.detach() || l.setAttachmentError(hu);
|
|
10360
10427
|
} : void 0,
|
|
10361
10428
|
onClose: s === "embedded" ? void 0 : c.close,
|
|
10362
10429
|
onMinimize: u ? c.toggleMinimize : void 0,
|
|
@@ -10369,8 +10436,8 @@ function _u({ placement: e = "floating", open: t, onOpenChange: n, theme: r, cla
|
|
|
10369
10436
|
className: `mc-chat-embedded${i ? ` ${i}` : ""}`,
|
|
10370
10437
|
children: p
|
|
10371
10438
|
});
|
|
10372
|
-
let m =
|
|
10373
|
-
return m ? Tt(s === "modal" ? /* @__PURE__ */ Q(
|
|
10439
|
+
let m = gu(o);
|
|
10440
|
+
return m ? Tt(s === "modal" ? /* @__PURE__ */ Q(_u, {
|
|
10374
10441
|
open: c.isOpen,
|
|
10375
10442
|
onClose: c.close,
|
|
10376
10443
|
theme: r,
|
|
@@ -10384,15 +10451,15 @@ function _u({ placement: e = "floating", open: t, onOpenChange: n, theme: r, cla
|
|
|
10384
10451
|
}) : p, m) : null;
|
|
10385
10452
|
}
|
|
10386
10453
|
// src/ui/connected/ChatPage.jsx
|
|
10387
|
-
function
|
|
10388
|
-
let r = fr(), i =
|
|
10454
|
+
function yu({ theme: e, className: t, BattleshipPreviewComponent: n = null }) {
|
|
10455
|
+
let r = fr(), i = mu({ mode: "page" }), a = lu({
|
|
10389
10456
|
isOpen: !0,
|
|
10390
10457
|
isMinimized: !1
|
|
10391
10458
|
});
|
|
10392
10459
|
if (typeof document > "u") return null;
|
|
10393
10460
|
let o = (typeof r?.portalContainer == "function" ? r.portalContainer() : r?.portalContainer) || document.body, s = /* @__PURE__ */ Q($o.Provider, {
|
|
10394
10461
|
value: a.people,
|
|
10395
|
-
children: /* @__PURE__ */ Q(
|
|
10462
|
+
children: /* @__PURE__ */ Q(Zl, {
|
|
10396
10463
|
...a.windowProps,
|
|
10397
10464
|
BattleshipPreviewComponent: n,
|
|
10398
10465
|
placement: "page",
|
|
@@ -10409,13 +10476,13 @@ function vu({ theme: e, className: t, BattleshipPreviewComponent: n = null }) {
|
|
|
10409
10476
|
}) : s, o);
|
|
10410
10477
|
}
|
|
10411
10478
|
// src/ui/connected/ChatButton.jsx
|
|
10412
|
-
function
|
|
10413
|
-
let o = ln(en), s =
|
|
10479
|
+
function bu({ className: e, label: t = "Chat", onClick: n, pressed: r, badgeClassName: i, iconSize: a = 17 }) {
|
|
10480
|
+
let o = ln(en), s = fu((e) => e.isOpen), c = r ?? (n ? void 0 : s);
|
|
10414
10481
|
return /* @__PURE__ */ $("button", {
|
|
10415
10482
|
type: "button",
|
|
10416
10483
|
className: e ?? "mc-chat mc-chat-button",
|
|
10417
10484
|
onClick: (e) => {
|
|
10418
|
-
n ? n(e) :
|
|
10485
|
+
n ? n(e) : uu.getState().toggle();
|
|
10419
10486
|
},
|
|
10420
10487
|
"aria-label": o ? `${t}, ${o} mensajes nuevos` : t,
|
|
10421
10488
|
"aria-pressed": c,
|
|
@@ -10430,19 +10497,19 @@ function yu({ className: e, label: t = "Chat", onClick: n, pressed: r, badgeClas
|
|
|
10430
10497
|
});
|
|
10431
10498
|
}
|
|
10432
10499
|
// src/notifications/appBadge.js
|
|
10433
|
-
var
|
|
10500
|
+
var xu = /* @__PURE__ */ new WeakMap(), Su = (e, t, n, ...r) => {
|
|
10434
10501
|
try {
|
|
10435
10502
|
let i = e[t](...r);
|
|
10436
10503
|
i && typeof i.catch == "function" && i.catch(n);
|
|
10437
10504
|
} catch {
|
|
10438
10505
|
n();
|
|
10439
10506
|
}
|
|
10440
|
-
},
|
|
10441
|
-
function
|
|
10442
|
-
if (
|
|
10507
|
+
}, Cu = (e = ln) => xu.has(e);
|
|
10508
|
+
function wu({ store: e = ln, nav: t = globalThis.navigator, schedule: n = queueMicrotask } = {}) {
|
|
10509
|
+
if (xu.has(e)) return xu.get(e);
|
|
10443
10510
|
if (!t || !("setAppBadge" in t)) {
|
|
10444
10511
|
let t = () => {};
|
|
10445
|
-
return
|
|
10512
|
+
return xu.set(e, t), t;
|
|
10446
10513
|
}
|
|
10447
10514
|
let r, i = !1, a = () => {
|
|
10448
10515
|
i = !1;
|
|
@@ -10452,33 +10519,33 @@ function Cu({ store: e = ln, nav: t = globalThis.navigator, schedule: n = queueM
|
|
|
10452
10519
|
let o = () => {
|
|
10453
10520
|
r === a && (r = void 0);
|
|
10454
10521
|
};
|
|
10455
|
-
a > 0 ?
|
|
10522
|
+
a > 0 ? Su(t, "setAppBadge", o, a) : "clearAppBadge" in t ? Su(t, "clearAppBadge", o) : Su(t, "setAppBadge", o, 0);
|
|
10456
10523
|
};
|
|
10457
10524
|
a();
|
|
10458
10525
|
let o = e.subscribe(() => {
|
|
10459
10526
|
i || (i = !0, n(a));
|
|
10460
10527
|
}), s = () => {
|
|
10461
|
-
o(),
|
|
10528
|
+
o(), xu.delete(e);
|
|
10462
10529
|
};
|
|
10463
|
-
return
|
|
10530
|
+
return xu.set(e, s), s;
|
|
10464
10531
|
}
|
|
10465
10532
|
// src/ui/connected/ChatNotifications.jsx
|
|
10466
|
-
function
|
|
10533
|
+
function Tu() {
|
|
10467
10534
|
let e = fr()?.notifications, t = e !== !1, n = t && e?.desktop !== !1, r = t && e?.appBadge !== !1, a = t && e?.sound !== !1;
|
|
10468
10535
|
return V(() => n ? Yn() : void 0, [n]), V(() => {
|
|
10469
|
-
if (r && !
|
|
10536
|
+
if (r && !Cu()) return wu();
|
|
10470
10537
|
}, [r]), V(() => {
|
|
10471
10538
|
if (a && (w(), !o())) return i();
|
|
10472
10539
|
}, [a]), null;
|
|
10473
10540
|
}
|
|
10474
10541
|
// src/core/relay/fileRelay.js
|
|
10475
|
-
var
|
|
10542
|
+
var Eu = 10485760, Du = /* @__PURE__ */ new WeakMap(), Ou = (e) => (Du.has(e) || Du.set(e, {
|
|
10476
10543
|
pending: /* @__PURE__ */ new Map(),
|
|
10477
10544
|
files: /* @__PURE__ */ new Map()
|
|
10478
|
-
}),
|
|
10479
|
-
function
|
|
10545
|
+
}), Du.get(e));
|
|
10546
|
+
function ku(e, t, n) {
|
|
10480
10547
|
if (e?.readyState !== WebSocket.OPEN) return Promise.reject(/* @__PURE__ */ Error("Sin conexión"));
|
|
10481
|
-
let r =
|
|
10548
|
+
let r = Ou(e), i = crypto.randomUUID();
|
|
10482
10549
|
return new Promise((a, o) => {
|
|
10483
10550
|
let s = setTimeout(() => {
|
|
10484
10551
|
r.pending.delete(i), o(/* @__PURE__ */ Error("El servidor no confirmó el envío. Conservamos el borrador."));
|
|
@@ -10496,8 +10563,8 @@ function Ou(e, t, n) {
|
|
|
10496
10563
|
}));
|
|
10497
10564
|
});
|
|
10498
10565
|
}
|
|
10499
|
-
function
|
|
10500
|
-
let n =
|
|
10566
|
+
function Au(e, t) {
|
|
10567
|
+
let n = Ou(e), r = t.data || t.payload || {};
|
|
10501
10568
|
if (t.event === "CHAT_ACK" || t.event === "ERROR" || t.type === "ERROR") {
|
|
10502
10569
|
let e = n.pending.get(r.request_id);
|
|
10503
10570
|
return e ? (clearTimeout(e.timer), n.pending.delete(r.request_id), t.event === "CHAT_ACK" ? e.resolve() : e.reject(Error(r.message || "No se pudo enviar")), !0) : !1;
|
|
@@ -10505,7 +10572,7 @@ function ku(e, t) {
|
|
|
10505
10572
|
if (t.event !== "CHAT_FILE") return !1;
|
|
10506
10573
|
let i = Date.now();
|
|
10507
10574
|
for (let [e, t] of n.files) i - t.created > 6e4 && n.files.delete(e);
|
|
10508
|
-
if (!Number.isInteger(r.size) || r.size <= 0 || r.size >
|
|
10575
|
+
if (!Number.isInteger(r.size) || r.size <= 0 || r.size > Eu) return !0;
|
|
10509
10576
|
if (r.index === 0) {
|
|
10510
10577
|
if (n.files.size >= 4) return !0;
|
|
10511
10578
|
n.files.set(r.id, {
|
|
@@ -10522,8 +10589,8 @@ function ku(e, t) {
|
|
|
10522
10589
|
let o = atob(r.chunk), s = Uint8Array.from(o, (e) => e.charCodeAt(0));
|
|
10523
10590
|
return a.bytes += s.length, a.bytes > r.size || s.length > 32768 ? (n.files.delete(r.id), !0) : (a.parts.push(s), a.index++, r.final && a.bytes === r.size && (a.blob = new Blob(a.parts, { type: r.type })), !0);
|
|
10524
10591
|
}
|
|
10525
|
-
function
|
|
10526
|
-
let n =
|
|
10592
|
+
function ju(e, t) {
|
|
10593
|
+
let n = Ou(e);
|
|
10527
10594
|
return {
|
|
10528
10595
|
...t,
|
|
10529
10596
|
attachments: (t.attachments || []).map((e) => {
|
|
@@ -10539,13 +10606,13 @@ function Au(e, t) {
|
|
|
10539
10606
|
})
|
|
10540
10607
|
};
|
|
10541
10608
|
}
|
|
10542
|
-
function
|
|
10543
|
-
let t =
|
|
10609
|
+
function Mu(e) {
|
|
10610
|
+
let t = Du.get(e);
|
|
10544
10611
|
t && (t.pending.forEach(({ reject: e, timer: t }) => {
|
|
10545
10612
|
clearTimeout(t), e(/* @__PURE__ */ Error("Conexión interrumpida. Reintenta el envío."));
|
|
10546
10613
|
}), t.pending.clear(), t.files.clear());
|
|
10547
10614
|
}
|
|
10548
|
-
async function
|
|
10615
|
+
async function Nu(e, t, n, r = []) {
|
|
10549
10616
|
if (r.length > 1) throw Error("Envía un archivo o GIF por mensaje.");
|
|
10550
10617
|
let i = [];
|
|
10551
10618
|
for (let n of r) {
|
|
@@ -10558,11 +10625,11 @@ async function Mu(e, t, n, r = []) {
|
|
|
10558
10625
|
continue;
|
|
10559
10626
|
}
|
|
10560
10627
|
let r = n.file;
|
|
10561
|
-
if (!(r instanceof Blob) || !r.size || r.size >
|
|
10628
|
+
if (!(r instanceof Blob) || !r.size || r.size > Eu) throw Error("El archivo debe pesar entre 1 byte y 10 MB.");
|
|
10562
10629
|
let a = crypto.randomUUID();
|
|
10563
10630
|
for (let i = 0, o = 0; i < r.size; i += 32768, o++) {
|
|
10564
10631
|
let s = new Uint8Array(await r.slice(i, i + 32768).arrayBuffer()), c = btoa(String.fromCharCode(...s));
|
|
10565
|
-
await
|
|
10632
|
+
await ku(e, "CHAT_FILE", {
|
|
10566
10633
|
id: a,
|
|
10567
10634
|
room_id: t,
|
|
10568
10635
|
size: r.size,
|
|
@@ -10574,14 +10641,14 @@ async function Mu(e, t, n, r = []) {
|
|
|
10574
10641
|
}
|
|
10575
10642
|
i.push({ id: a });
|
|
10576
10643
|
}
|
|
10577
|
-
await
|
|
10644
|
+
await ku(e, "CHAT_MESSAGE", {
|
|
10578
10645
|
room_id: t,
|
|
10579
10646
|
message: n,
|
|
10580
10647
|
attachments: i
|
|
10581
10648
|
});
|
|
10582
10649
|
}
|
|
10583
10650
|
// src/net/webrtc/index.js
|
|
10584
|
-
var
|
|
10585
|
-
export {
|
|
10651
|
+
var Pu = ae(() => import("./chunks/WebRtcLab-B7xBlJy1.js")), Fu = "0.1.0", Iu = () => import("./chunks/BattleshipPrototype-CmQd5AUO.js");
|
|
10652
|
+
export { bu as ChatButton, E as ChatContext, Tu as ChatNotifications, yu as ChatPage, $o as ChatPeopleContext, vu as ChatWindow, Zl as ChatWindowShell, At as DEFAULT_CONFIG, y as DEFAULT_ICE_SERVERS, dn as EDIT_PREFIX, Tr as EFFECT_CATALOG, Br as EFFECT_PREFIX, Xo as EmojiPicker, ml as GifPicker, fi as LiraChatProvider, Xn as MAX_CHAT_MESSAGES, _ as MAX_SIGNAL_LENGTH, Fu as MINICODE_CHAT_VERSION, os as MessageBubble, Yl as MessageComposer, Es as MessageList, fn as REACT_PREFIX, gn as STICKER_NAME_PREFIX, Ll as StickerPicker, pi as TRANSPORT_STATUSES, m as WEBRTC_PREFIX, Pu as WebRtcLab, hi as assertTransport, z as chatConnectionStore, d as chatGamesStore, uu as chatUiStore, Mu as closeRelay, xi as configureKlipy, Au as consumeRelayEvent, t as createChatSignaling, lr as createChatStore, h as createPeerLink, Ut as createStandaloneTransport, Wr as decodeEffect, p as decodeSignal, xn as encodeEdit, Ur as encodeEffect, Sn as encodeReaction, g as encodeSignal, n as getChatAssetsBaseUrl, Er as getChatEffect, Dn as groupReactions, ju as hydrateRelayMessage, yn as isMessageAction, _n as isStickerAttachment, v as isWebrtcMessage, Iu as loadBattleshipPreview, It as normalizeConfig, Mt as normalizeUser, ou as openChatWindow, Cn as parseMessageAction, su as registerChatWorker, e as rtcSignals, Nu as sendRelayMessage, a as setChatAssetsBaseUrl, M as setChatConnectionStatus, wu as startAppBadge, ru as startChatApp, i as startConnect4Sounds, Yn as startDesktopNotifications, Vo as startEmojiPreferencesSync, Sc as startGifLibrarySync, un as startUnreadStorageSync, en as totalUnread, Yt as unreadScope, fr as useChatConfig, yr as useChatConnection, N as useChatConnectionStatus, S as useChatContext, r as useChatGames, Sr as useChatIdentity, iu as useChatInstall, hr as useChatStore, gr as useChatStoreApi, pr as useChatTransport, fu as useChatUi, ln as useChatUnread, xr as useChatUnreadTotal, te as withSignalFaults };
|
|
10586
10653
|
|
|
10587
10654
|
//# sourceMappingURL=index.js.map
|