@minicode-dev/chat 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/chunks/{BattleshipGameCard-8H-sBCsv.js → BattleshipGameCard-DwNzgH5G.js} +199 -199
  3. package/dist/chunks/{BattleshipGameCard-8H-sBCsv.js.map → BattleshipGameCard-DwNzgH5G.js.map} +1 -1
  4. package/dist/chunks/{BattleshipPrototype-CmQd5AUO.js → BattleshipPrototype-CSQxQJt5.js} +52 -52
  5. package/dist/chunks/{BattleshipPrototype-CmQd5AUO.js.map → BattleshipPrototype-CSQxQJt5.js.map} +1 -1
  6. package/dist/chunks/{ChatContext-CVW58bzC.js → ChatContext-D5rqvt5D.js} +2 -2
  7. package/dist/chunks/{ChatContext-CVW58bzC.js.map → ChatContext-D5rqvt5D.js.map} +1 -1
  8. package/dist/chunks/RacingLiveGameCard-_wvhDRlG.js +1873 -0
  9. package/dist/chunks/RacingLiveGameCard-_wvhDRlG.js.map +1 -0
  10. package/dist/chunks/{TanksGameCard-DnCufSH6.js → TanksGameCard-B-gtDYYg.js} +137 -137
  11. package/dist/chunks/{TanksGameCard-DnCufSH6.js.map → TanksGameCard-B-gtDYYg.js.map} +1 -1
  12. package/dist/chunks/{TanksLiveGameCard-D_27Jomp.js → TanksLiveGameCard-DXgd1J2Y.js} +392 -392
  13. package/dist/chunks/{TanksLiveGameCard-D_27Jomp.js.map → TanksLiveGameCard-DXgd1J2Y.js.map} +1 -1
  14. package/dist/chunks/{avalancheScene3d-CIE2WKQn.js → avalancheScene3d-CNbQyGUd.js} +2 -2
  15. package/dist/chunks/{avalancheScene3d-CIE2WKQn.js.map → avalancheScene3d-CNbQyGUd.js.map} +1 -1
  16. package/dist/chunks/{connect4Sounds-BqEHULjv.js → connect4Sounds-3a6h7gUC.js} +8 -8
  17. package/dist/chunks/{connect4Sounds-BqEHULjv.js.map → connect4Sounds-3a6h7gUC.js.map} +1 -1
  18. package/dist/chunks/createLiveScene-jrzyQogh.js +756 -0
  19. package/dist/chunks/{createLiveScene-MTGRv8rx.js.map → createLiveScene-jrzyQogh.js.map} +1 -1
  20. package/dist/chunks/createRaceScene-C-aw0dlX.js +291 -0
  21. package/dist/chunks/createRaceScene-C-aw0dlX.js.map +1 -0
  22. package/dist/chunks/{createTankScene-yhX6la27.js → createTankScene-6asWHKFf.js} +123 -125
  23. package/dist/chunks/{createTankScene-yhX6la27.js.map → createTankScene-6asWHKFf.js.map} +1 -1
  24. package/dist/chunks/fx-BNJvJYOu.js +871 -0
  25. package/dist/chunks/fx-BNJvJYOu.js.map +1 -0
  26. package/dist/chunks/{games-Bl_8raG6.js → games-D_9SiSBT.js} +708 -697
  27. package/dist/chunks/games-D_9SiSBT.js.map +1 -0
  28. package/dist/chunks/tank-DIn6Jyt8.js +605 -0
  29. package/dist/chunks/tank-DIn6Jyt8.js.map +1 -0
  30. package/dist/chunks/{tanks-live-BcKmrhnV.js → tanks-live-BRhYW4MG.js} +36 -36
  31. package/dist/chunks/{tanks-live-BcKmrhnV.js.map → tanks-live-BRhYW4MG.js.map} +1 -1
  32. package/dist/chunks/{tanksSounds-DTnidbiq.js → tanksSounds-tYPzje61.js} +4 -4
  33. package/dist/chunks/{tanksSounds-DTnidbiq.js.map → tanksSounds-tYPzje61.js.map} +1 -1
  34. package/dist/chunks/track-C1TWWT19.js +557 -0
  35. package/dist/chunks/track-C1TWWT19.js.map +1 -0
  36. package/dist/index.js +4234 -4018
  37. package/dist/index.js.map +1 -1
  38. package/dist/styles.css +1 -1
  39. package/index.d.ts +2 -0
  40. package/package.json +1 -1
  41. package/dist/chunks/RacingLiveGameCard-8j9QLnxW.js +0 -1654
  42. package/dist/chunks/RacingLiveGameCard-8j9QLnxW.js.map +0 -1
  43. package/dist/chunks/createLiveScene-MTGRv8rx.js +0 -758
  44. package/dist/chunks/createRaceScene-BiEtQsVs.js +0 -306
  45. package/dist/chunks/createRaceScene-BiEtQsVs.js.map +0 -1
  46. package/dist/chunks/decor-CyyCnmct.js +0 -418
  47. package/dist/chunks/decor-CyyCnmct.js.map +0 -1
  48. package/dist/chunks/fx-1ZwzmPWj.js +0 -458
  49. package/dist/chunks/fx-1ZwzmPWj.js.map +0 -1
  50. package/dist/chunks/games-Bl_8raG6.js.map +0 -1
  51. package/dist/chunks/rolldown-runtime-CGnMp29N.js +0 -10
  52. package/dist/chunks/tank-DjEQ4FXF.js +0 -553
  53. package/dist/chunks/tank-DjEQ4FXF.js.map +0 -1
  54. package/dist/chunks/track-BcnnpnAm.js +0 -259
  55. package/dist/chunks/track-BcnnpnAm.js.map +0 -1
  56. package/dist/chunks/util-DwI9bfS7.js +0 -57
  57. package/dist/chunks/util-DwI9bfS7.js.map +0 -1
@@ -1,82 +1,82 @@
1
- import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
- import { C as t, D as n, E as r, O as i, S as a, T as o, a as s, b as c, v as l, w as u, x as d, y as f } from "./games-Bl_8raG6.js";
3
- import { n as p, o as ee, s as m } from "./createPeerLink-DBVs_yvQ.js";
4
- import { t as h } from "./ChatContext-CVW58bzC.js";
5
- import { o as g } from "./connect4Sounds-BqEHULjv.js";
6
- import { n as _, r as v, t as te } from "./tanks-live-BcKmrhnV.js";
7
- import { a as ne, c as re, i as y, n as ie, o as b, r as ae, s as x, t as S } from "./tanksSounds-DTnidbiq.js";
8
- import { memo as C, useContext as w, useEffect as T, useRef as E, useState as D } from "react";
9
- import { AlertTriangle as O, CheckCircle2 as k, Link2 as oe, Loader2 as A, Settings2 as se } from "lucide-react";
10
- import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
1
+ import { C as e, D as t, E as n, O as r, S as i, T as a, a as o, b as s, v as c, w as l, x as u, y as d } from "./games-D_9SiSBT.js";
2
+ import { n as f, o as p, s as ee } from "./createPeerLink-DBVs_yvQ.js";
3
+ import { t as m } from "./ChatContext-D5rqvt5D.js";
4
+ import { o as h } from "./connect4Sounds-3a6h7gUC.js";
5
+ import { n as g, r as _, t as v } from "./tanks-live-BRhYW4MG.js";
6
+ import { c as y } from "./RacingLiveGameCard-_wvhDRlG.js";
7
+ import { a as te, c as ne, i as b, n as re, o as x, r as ie, s as S, t as C } from "./tanksSounds-tYPzje61.js";
8
+ import { memo as w, useContext as T, useEffect as E, useRef as D, useState as O } from "react";
9
+ import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
10
+ import { AlertTriangle as M, CheckCircle2 as ae, Link2 as N, Loader2 as oe, Settings2 as P } from "lucide-react";
11
11
  // src/games/tanks-live/net/createLiveMatch.js
12
- var ce = Object.freeze({
12
+ var se = Object.freeze({
13
13
  respawnMs: 3e3,
14
14
  shieldMs: 2e3
15
- }), le = (e) => typeof e == "number" && Number.isFinite(e), ue = (e) => typeof e == "string" && e.length > 0 && e.length < 160;
16
- function P({ game: e, selfId: s, isHost: h = String(s) === String(e.hostId), signaling: g, onChange: _ = () => {}, peerFactory: v = p, iceServers: te, iceTransportPolicy: ne, RTCPeerConnectionImpl: re } = {}) {
17
- s = String(s);
18
- let y = [String(e.hostId), String(e.guestId)];
19
- if (!y.includes(s) || y[0] === y[1]) throw Error("Invalid live match players");
20
- let ie = (te || []).some((e) => [e.urls].flat().some((e) => /^turns?:/i.test(String(e)))), b = y.find((e) => e !== s), ae = e.liveConfig ?? null, x = !ae, S = x ? d() : l(ae.mapId, ae.seed);
21
- if (!x && S.hash !== ae.mapHash) throw Error("El mapa no coincide con la invitación");
22
- let C = x ? 1 : ae.lives;
15
+ }), ce = (e) => typeof e == "number" && Number.isFinite(e), le = (e) => typeof e == "string" && e.length > 0 && e.length < 160;
16
+ function F({ game: o, selfId: m, isHost: h = String(m) === String(o.hostId), signaling: g, onChange: _ = () => {}, peerFactory: v = f, iceServers: y, iceTransportPolicy: te, RTCPeerConnectionImpl: ne } = {}) {
17
+ m = String(m);
18
+ let b = [String(o.hostId), String(o.guestId)];
19
+ if (!b.includes(m) || b[0] === b[1]) throw Error("Invalid live match players");
20
+ let re = (y || []).some((e) => [e.urls].flat().some((e) => /^turns?:/i.test(String(e)))), x = b.find((e) => e !== m), ie = o.liveConfig ?? null, S = !ie, C = S ? u() : c(ie.mapId, ie.seed);
21
+ if (!S && C.hash !== ie.mapHash) throw Error("El mapa no coincide con la invitación");
22
+ let w = S ? 1 : ie.lives;
23
23
  if (![
24
24
  1,
25
25
  3,
26
26
  5
27
- ].includes(C)) throw Error("Vidas inválidas");
28
- let w = (S.destructibles || []).map((e) => ({
27
+ ].includes(w)) throw Error("Vidas inválidas");
28
+ let T = (C.destructibles || []).map((e) => ({
29
29
  id: e.id,
30
30
  hp: e.hp
31
- })), T = (e, t) => {
32
- let n = a(e, t), r = S.spawns?.[t];
31
+ })), E = (e, t) => {
32
+ let n = i(e, t), r = C.spawns?.[t];
33
33
  return r && Object.assign(n, {
34
34
  x: r.x,
35
35
  z: r.z,
36
36
  yaw: r.yaw,
37
37
  turretYaw: r.yaw
38
38
  }), n;
39
- }, E = (e) => (S.destructibles || []).find((t) => t.id === e), D = y.map(T), O = [], k = [], oe = {}, A = 0, se = 0, j = 0, M = 0, N = [C, C], P = [0, 0], F = [null, null], I = "connecting", L = null, R = !1, z = {
39
+ }, D = (e) => (C.destructibles || []).find((t) => t.id === e), O = b.map(E), k = [], A = [], j = {}, M = 0, ae = 0, N = 0, oe = 0, P = [w, w], F = [0, 0], I = [null, null], L = "connecting", R = null, z = !1, B = {
40
40
  phase: "idle",
41
41
  rtt: null,
42
42
  route: null
43
- }, B = !1, V = !1, H = null, U = [], W = null, G = null, de = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Set(), fe = /* @__PURE__ */ new Set(), q = () => D.find((e) => e.id === s), pe = () => D.find((e) => e.id === b), me = () => {
44
- R || _({
45
- status: I,
46
- winner: L,
47
- net: z
43
+ }, ue = !1, V = !1, H = null, U = [], W = null, G = null, de = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Set(), fe = /* @__PURE__ */ new Set(), q = () => O.find((e) => e.id === m), pe = () => O.find((e) => e.id === x), me = () => {
44
+ z || _({
45
+ status: L,
46
+ winner: R,
47
+ net: B
48
48
  });
49
49
  }, J = (e) => {
50
- k.push(e), k.length > 200 && k.shift();
51
- }, Y = (t) => $.sendEvent({
52
- ...t,
53
- g: e.gameId,
54
- r: j
50
+ A.push(e), A.length > 200 && A.shift();
51
+ }, Y = (e) => $.sendEvent({
52
+ ...e,
53
+ g: o.gameId,
54
+ r: N
55
55
  }), X = (e) => {
56
56
  K.add(e), K.size > 2048 && K.delete(K.values().next().value);
57
- }, Z = (e) => Math.max(0, Math.round(P[e] - A)), he = () => ({
57
+ }, Z = (e) => Math.max(0, Math.round(F[e] - M)), he = () => ({
58
58
  k: "snapshot",
59
- hp: D.map((e) => e.hp),
60
- status: I,
61
- winner: L,
59
+ hp: O.map((e) => e.hp),
60
+ status: L,
61
+ winner: R,
62
62
  reason: H,
63
- ...x ? {} : {
64
- lives: [...N],
63
+ ...S ? {} : {
64
+ lives: [...P],
65
65
  shield: [0, 1].map(Z),
66
- destructibles: (S.destructibles || []).map((e) => ({
66
+ destructibles: (C.destructibles || []).map((e) => ({
67
67
  id: e.id,
68
68
  hp: e.hp
69
69
  }))
70
70
  }
71
71
  });
72
72
  function ge() {
73
- (S.destructibles || []).forEach((e, t) => {
74
- e.hp = w[t].hp, e.alive = !0;
73
+ (C.destructibles || []).forEach((e, t) => {
74
+ e.hp = T[t].hp, e.alive = !0;
75
75
  });
76
76
  }
77
77
  function _e(e) {
78
- let t = T(y[e], e);
79
- Object.assign(D[e], {
78
+ let t = E(b[e], e);
79
+ Object.assign(O[e], {
80
80
  x: t.x,
81
81
  z: t.z,
82
82
  yaw: t.yaw,
@@ -84,36 +84,36 @@ function P({ game: e, selfId: s, isHost: h = String(s) === String(e.hostId), sig
84
84
  speed: 0,
85
85
  hp: 100,
86
86
  alive: !0
87
- }), F[e] = null, P[e] = A + ce.shieldMs, y[e] === b && (U = [], G = null, W = null), J({
87
+ }), I[e] = null, F[e] = M + se.shieldMs, b[e] === x && (U = [], G = null, W = null), J({
88
88
  k: "respawn",
89
- target: y[e],
89
+ target: b[e],
90
90
  x: t.x,
91
91
  z: t.z,
92
- shield: ce.shieldMs
92
+ shield: se.shieldMs
93
93
  });
94
94
  }
95
95
  function ve(e, t) {
96
- N[e] = t, J({
96
+ P[e] = t, J({
97
97
  k: "life_lost",
98
- target: y[e],
99
- lives: [...N]
100
- }), t === 1 && C > 1 && J({
98
+ target: b[e],
99
+ lives: [...P]
100
+ }), t === 1 && w > 1 && J({
101
101
  k: "last_life",
102
- target: y[e]
103
- }), F[e] = t > 0 ? A + ce.respawnMs : null;
102
+ target: b[e]
103
+ }), I[e] = t > 0 ? M + se.respawnMs : null;
104
104
  }
105
105
  function Q(e, t) {
106
- x ? N[e] = 0 : (ve(e, Math.max(0, N[e] - 1)), Y({
106
+ S ? P[e] = 0 : (ve(e, Math.max(0, P[e] - 1)), Y({
107
107
  k: "life_lost",
108
- target: y[e],
109
- lives: [...N]
108
+ target: b[e],
109
+ lives: [...P]
110
110
  }));
111
111
  let n = {
112
112
  k: "destroyed",
113
- target: y[e]
113
+ target: b[e]
114
114
  };
115
- if (Y(n), J(n), N[e] === 0 && I === "playing") {
116
- let n = t === y[e] ? y[1 - e] : t;
115
+ if (Y(n), J(n), P[e] === 0 && L === "playing") {
116
+ let n = t === b[e] ? b[1 - e] : t;
117
117
  Y({
118
118
  k: "over",
119
119
  winner: n
@@ -123,29 +123,29 @@ function P({ game: e, selfId: s, isHost: h = String(s) === String(e.hostId), sig
123
123
  function ye(e, t) {
124
124
  let n = [];
125
125
  for (let { id: t, dmg: r } of e) {
126
- let e = y.indexOf(t);
127
- e < 0 || !D[e].alive || P[e] > A || (D[e].hp = Math.max(0, D[e].hp - r), D[e].alive = D[e].hp > 0, D[e].alive || n.push(e));
126
+ let e = b.indexOf(t);
127
+ e < 0 || !O[e].alive || F[e] > M || (O[e].hp = Math.max(0, O[e].hp - r), O[e].alive = O[e].hp > 0, O[e].alive || n.push(e));
128
128
  }
129
129
  return () => n.forEach((e) => Q(e, t));
130
130
  }
131
131
  function be() {
132
- D = y.map(T), O = [], N = [C, C], P = [0, 0], F = [null, null], ge(), U = [], W = null, G = null, de.clear(), K.clear(), fe.clear(), V = !1, H = null, L = null, I = z.phase === "connected" ? "playing" : "connecting", J({ k: "rematch" }), me();
132
+ O = b.map(E), k = [], P = [w, w], F = [0, 0], I = [null, null], ge(), U = [], W = null, G = null, de.clear(), K.clear(), fe.clear(), V = !1, H = null, R = null, L = B.phase === "connected" ? "playing" : "connecting", J({ k: "rematch" }), me();
133
133
  }
134
134
  function xe(e, t = !1) {
135
- (I !== "over" || t && L !== e) && (I = "over", L = e, O = [], $.clearManualTurn?.(), J({
135
+ (L !== "over" || t && R !== e) && (L = "over", R = e, k = [], $.clearManualTurn?.(), J({
136
136
  k: "over",
137
- winner: L
137
+ winner: R
138
138
  }), me());
139
139
  }
140
140
  function Se(e, t, n) {
141
- if (I !== "playing" || !ue(t.id) || K.has(t.id)) return !1;
142
- let r = D.find((t) => t.id === e);
143
- if (!r?.alive || A - (de.get(e) ?? -Infinity) < f.reloadMs - 20 || ![
141
+ if (L !== "playing" || !le(t.id) || K.has(t.id)) return !1;
142
+ let r = O.find((t) => t.id === e);
143
+ if (!r?.alive || M - (de.get(e) ?? -Infinity) < d.reloadMs - 20 || ![
144
144
  t.x,
145
145
  t.z,
146
146
  t.yaw
147
- ].every(le) || Math.hypot(t.x - (e === b && G ? G.x : r.x), t.z - (e === b && G ? G.z : r.z)) > 6) return !1;
148
- X(t.id), de.set(e, A);
147
+ ].every(ce) || Math.hypot(t.x - (e === x && G ? G.x : r.x), t.z - (e === x && G ? G.z : r.z)) > 6) return !1;
148
+ X(t.id), de.set(e, M);
149
149
  let i = {
150
150
  ...t,
151
151
  k: "fire",
@@ -155,34 +155,34 @@ function P({ game: e, selfId: s, isHost: h = String(s) === String(e.hostId), sig
155
155
  y: 1.4,
156
156
  age: 0
157
157
  };
158
- return O.push(i), J(i), n && Y({
158
+ return k.push(i), J(i), n && Y({
159
159
  ...t,
160
160
  k: "fire"
161
161
  }), !0;
162
162
  }
163
- function Ce(t) {
164
- if (R || I !== "playing" || t?.g !== e.gameId || t.r !== j || !Array.isArray(t.p) || t.p.length !== 5 || !t.p.every(le)) return;
165
- let [n, r, a, o, s] = t.p;
166
- if (!pe().alive || !i(n, r, {
167
- ...S,
163
+ function Ce(e) {
164
+ if (z || L !== "playing" || e?.g !== o.gameId || e.r !== N || !Array.isArray(e.p) || e.p.length !== 5 || !e.p.every(ce)) return;
165
+ let [t, n, i, a, s] = e.p;
166
+ if (!pe().alive || !r(t, n, {
167
+ ...C,
168
168
  destructibles: []
169
- }) || Math.abs(s) > f.speed + .1 || Math.abs(a) > 1e6 || Math.abs(o) > 1e6) return;
170
- let c = W === null ? .1 : Math.max(0, (A - W) / 1e3), l = G || pe();
171
- if (Math.hypot(n - l.x, r - l.z) > f.speed * c + 3) return;
169
+ }) || Math.abs(s) > d.speed + .1 || Math.abs(i) > 1e6 || Math.abs(a) > 1e6) return;
170
+ let c = W === null ? .1 : Math.max(0, (M - W) / 1e3), l = G || pe();
171
+ if (Math.hypot(t - l.x, n - l.z) > d.speed * c + 3) return;
172
172
  let u = {
173
173
  ...pe(),
174
- x: n,
175
- z: r,
176
- yaw: a,
177
- turretYaw: o,
174
+ x: t,
175
+ z: n,
176
+ yaw: i,
177
+ turretYaw: a,
178
178
  speed: s
179
179
  };
180
- G = u, W = A, U.push({
181
- time: A,
180
+ G = u, W = M, U.push({
181
+ time: M,
182
182
  pose: u
183
183
  }), U.length > 30 && U.shift();
184
184
  }
185
- let we = (e, t) => Object.keys(e).every((e) => t.includes(e)), Te = (e) => Array.isArray(e) && e.length === 2 && e.every((e) => Number.isInteger(e) && e >= 0 && e <= C), Ee = (e) => Te(e.lives) && Array.isArray(e.shield) && e.shield.length === 2 && e.shield.every((e) => Number.isInteger(e) && e >= 0 && e <= ce.shieldMs) && Array.isArray(e.destructibles) && e.destructibles.length === w.length && e.destructibles.every((e, t) => e && we(e, ["id", "hp"]) && e.id === w[t].id && Number.isInteger(e.hp) && e.hp >= 0 && e.hp <= w[t].hp);
185
+ let we = (e, t) => Object.keys(e).every((e) => t.includes(e)), Te = (e) => Array.isArray(e) && e.length === 2 && e.every((e) => Number.isInteger(e) && e >= 0 && e <= w), Ee = (e) => Te(e.lives) && Array.isArray(e.shield) && e.shield.length === 2 && e.shield.every((e) => Number.isInteger(e) && e >= 0 && e <= se.shieldMs) && Array.isArray(e.destructibles) && e.destructibles.length === T.length && e.destructibles.every((e, t) => e && we(e, ["id", "hp"]) && e.id === T[t].id && Number.isInteger(e.hp) && e.hp >= 0 && e.hp <= T[t].hp);
186
186
  function De(e, t, n, r) {
187
187
  J({
188
188
  k: "destructible_hit",
@@ -199,50 +199,50 @@ function P({ game: e, selfId: s, isHost: h = String(s) === String(e.hostId), sig
199
199
  z: e.z
200
200
  });
201
201
  }
202
- function Oe(t) {
203
- if (R || !t || t.g !== e.gameId || !Number.isInteger(t.r)) return;
204
- if (t.k === "round" && !h && I === "over" && fe.has(s) && t.r === j + 1) {
205
- j = t.r, be();
202
+ function Oe(e) {
203
+ if (z || !e || e.g !== o.gameId || !Number.isInteger(e.r)) return;
204
+ if (e.k === "round" && !h && L === "over" && fe.has(m) && e.r === N + 1) {
205
+ N = e.r, be();
206
206
  return;
207
207
  }
208
- if (t.r !== j) return;
209
- if (t.k === "sync" && h) {
208
+ if (e.r !== N) return;
209
+ if (e.k === "sync" && h) {
210
210
  Y(he());
211
211
  return;
212
212
  }
213
- if (t.k === "snapshot" && !h && Array.isArray(t.hp) && t.hp.length === 2 && t.hp.every((e) => Number.isInteger(e) && e >= 0 && e <= 100)) {
214
- if (!x && !Ee(t)) return;
215
- let e = x ? N : t.lives, n = t.status === "playing" && t.winner === null && t.hp.every((t, n) => t > 0 || !x && e[n] > 0), r = t.status === "over" && y.includes(t.winner) && (t.hp[1 - y.indexOf(t.winner)] === 0 && e[1 - y.indexOf(t.winner)] === (x ? N[1 - y.indexOf(t.winner)] : 0) || t.reason === "resigned");
213
+ if (e.k === "snapshot" && !h && Array.isArray(e.hp) && e.hp.length === 2 && e.hp.every((e) => Number.isInteger(e) && e >= 0 && e <= 100)) {
214
+ if (!S && !Ee(e)) return;
215
+ let t = S ? P : e.lives, n = e.status === "playing" && e.winner === null && e.hp.every((e, n) => e > 0 || !S && t[n] > 0), r = e.status === "over" && b.includes(e.winner) && (e.hp[1 - b.indexOf(e.winner)] === 0 && t[1 - b.indexOf(e.winner)] === (S ? P[1 - b.indexOf(e.winner)] : 0) || e.reason === "resigned");
216
216
  if (!n && !r) return;
217
- x || (t.destructibles.forEach((e, t) => {
218
- let n = S.destructibles[t];
217
+ S || (e.destructibles.forEach((e, t) => {
218
+ let n = C.destructibles[t];
219
219
  n.hp = e.hp, n.alive = e.hp > 0;
220
- }), D.forEach((e, n) => {
221
- let r = e.hp === 0;
222
- N[n] = t.lives[n], r && t.hp[n] > 0 && _e(n), P[n] = t.shield[n] ? A + t.shield[n] : 0, t.hp[n] === 0 && N[n] > 0 && F[n] === null && (F[n] = A + ce.respawnMs);
223
- })), D.forEach((e, n) => {
224
- e.hp = t.hp[n], e.alive = e.hp > 0;
225
- }), r && (V = !1, H = t.reason, xe(t.winner, !0));
220
+ }), O.forEach((t, n) => {
221
+ let r = t.hp === 0;
222
+ P[n] = e.lives[n], r && e.hp[n] > 0 && _e(n), F[n] = e.shield[n] ? M + e.shield[n] : 0, e.hp[n] === 0 && P[n] > 0 && I[n] === null && (I[n] = M + se.respawnMs);
223
+ })), O.forEach((t, n) => {
224
+ t.hp = e.hp[n], t.alive = t.hp > 0;
225
+ }), r && (V = !1, H = e.reason, xe(e.winner, !0));
226
226
  return;
227
227
  }
228
- if (t.k === "resign") {
229
- H = "resigned", xe(s, h), h && Y(he());
228
+ if (e.k === "resign") {
229
+ H = "resigned", xe(m, h), h && Y(he());
230
230
  return;
231
231
  }
232
- if (t.k === "rematch" && I === "over") {
233
- fe.add(b), ke();
232
+ if (e.k === "rematch" && L === "over") {
233
+ fe.add(x), ke();
234
234
  return;
235
235
  }
236
- if (I !== "playing" || (t.k === "fire" && Se(b, t, !1), !h && t.k === "hit" && ue(t.id) && !K.has(`hit:${t.id}`) && y.includes(t.target) && Array.isArray(t.hp) && t.hp.length === 2 && t.hp.every((e, t) => Number.isInteger(e) && e >= 0 && e <= D[t].hp) && [t.x, t.z].every(le) && (X(`hit:${t.id}`), D.forEach((e, n) => {
237
- e.hp = t.hp[n], e.alive = e.hp > 0;
238
- }), O = O.filter((e) => e.id !== t.id), J(t)), !h && t.k === "destroyed" && y.includes(t.target) && !K.has(`destroyed:${t.target}:${N[y.indexOf(t.target)]}`) && D.find((e) => e.id === t.target).hp === 0 && (X(`destroyed:${t.target}:${N[y.indexOf(t.target)]}`), J(t)), !h && t.k === "over" && y.includes(t.winner) && D.find((e) => e.id !== t.winner).hp === 0 && (x || N[1 - y.indexOf(t.winner)] === 0) && xe(t.winner), h || x)) return;
239
- let n = y.indexOf(t.target);
240
- if (t.k === "life_lost" && n >= 0 && D[n].hp === 0 && Te(t.lives) && t.lives[n] === N[n] - 1 && t.lives[1 - n] === N[1 - n] && ve(n, t.lives[n]), t.k === "respawn" && n >= 0 && D[n].hp === 0 && N[n] > 0 && we(t, [
236
+ if (L !== "playing" || (e.k === "fire" && Se(x, e, !1), !h && e.k === "hit" && le(e.id) && !K.has(`hit:${e.id}`) && b.includes(e.target) && Array.isArray(e.hp) && e.hp.length === 2 && e.hp.every((e, t) => Number.isInteger(e) && e >= 0 && e <= O[t].hp) && [e.x, e.z].every(ce) && (X(`hit:${e.id}`), O.forEach((t, n) => {
237
+ t.hp = e.hp[n], t.alive = t.hp > 0;
238
+ }), k = k.filter((t) => t.id !== e.id), J(e)), !h && e.k === "destroyed" && b.includes(e.target) && !K.has(`destroyed:${e.target}:${P[b.indexOf(e.target)]}`) && O.find((t) => t.id === e.target).hp === 0 && (X(`destroyed:${e.target}:${P[b.indexOf(e.target)]}`), J(e)), !h && e.k === "over" && b.includes(e.winner) && O.find((t) => t.id !== e.winner).hp === 0 && (S || P[1 - b.indexOf(e.winner)] === 0) && xe(e.winner), h || S)) return;
239
+ let t = b.indexOf(e.target);
240
+ if (e.k === "life_lost" && t >= 0 && O[t].hp === 0 && Te(e.lives) && e.lives[t] === P[t] - 1 && e.lives[1 - t] === P[1 - t] && ve(t, e.lives[t]), e.k === "respawn" && t >= 0 && O[t].hp === 0 && P[t] > 0 && we(e, [
241
241
  "k",
242
242
  "target",
243
243
  "g",
244
244
  "r"
245
- ]) && _e(n), t.k === "destructible_hit" && ue(t.id) && !K.has(`dh:${t.id}`) && we(t, [
245
+ ]) && _e(t), e.k === "destructible_hit" && le(e.id) && !K.has(`dh:${e.id}`) && we(e, [
246
246
  "k",
247
247
  "id",
248
248
  "target",
@@ -251,97 +251,97 @@ function P({ game: e, selfId: s, isHost: h = String(s) === String(e.hostId), sig
251
251
  "z",
252
252
  "g",
253
253
  "r"
254
- ]) && [t.x, t.z].every(le)) {
255
- let e = E(t.target);
256
- if (!r(e) || !Number.isInteger(t.hp) || t.hp < 0 || t.hp >= e.hp) return;
257
- X(`dh:${t.id}`), e.hp = t.hp, e.alive = t.hp > 0, O = O.filter((e) => e.id !== t.id), De(e, t.id, t.x, t.z);
254
+ ]) && [e.x, e.z].every(ce)) {
255
+ let t = D(e.target);
256
+ if (!n(t) || !Number.isInteger(e.hp) || e.hp < 0 || e.hp >= t.hp) return;
257
+ X(`dh:${e.id}`), t.hp = e.hp, t.alive = e.hp > 0, k = k.filter((t) => t.id !== e.id), De(t, e.id, e.x, e.z);
258
258
  }
259
- if (t.k === "barrel_explode" && we(t, [
259
+ if (e.k === "barrel_explode" && we(e, [
260
260
  "k",
261
261
  "target",
262
262
  "chained",
263
263
  "hp",
264
264
  "g",
265
265
  "r"
266
- ]) && !K.has(`be:${t.target}`)) {
267
- let e = E(t.target), n = t.chained === null ? null : E(t.chained);
268
- if (e?.kind !== "barrel" || r(e) || t.chained !== null && (n?.kind !== "barrel" || !r(n) || n === e) || !Array.isArray(t.hp) || t.hp.length !== 2 || !t.hp.every((e, t) => Number.isInteger(e) && e >= 0 && e <= D[t].hp)) return;
269
- X(`be:${t.target}`), n && (n.hp = 0, n.alive = !1), D.forEach((e, n) => {
270
- e.hp = t.hp[n], e.alive = e.hp > 0;
266
+ ]) && !K.has(`be:${e.target}`)) {
267
+ let t = D(e.target), r = e.chained === null ? null : D(e.chained);
268
+ if (t?.kind !== "barrel" || n(t) || e.chained !== null && (r?.kind !== "barrel" || !n(r) || r === t) || !Array.isArray(e.hp) || e.hp.length !== 2 || !e.hp.every((e, t) => Number.isInteger(e) && e >= 0 && e <= O[t].hp)) return;
269
+ X(`be:${e.target}`), r && (r.hp = 0, r.alive = !1), O.forEach((t, n) => {
270
+ t.hp = e.hp[n], t.alive = t.hp > 0;
271
271
  }), J({
272
272
  k: "barrel_explode",
273
- id: e.id,
274
- x: e.x,
275
- z: e.z,
276
- chained: n ? {
277
- id: n.id,
278
- x: n.x,
279
- z: n.z
273
+ id: t.id,
274
+ x: t.x,
275
+ z: t.z,
276
+ chained: r ? {
277
+ id: r.id,
278
+ x: r.x,
279
+ z: r.z
280
280
  } : null,
281
- hp: [...t.hp]
281
+ hp: [...e.hp]
282
282
  });
283
283
  }
284
284
  }
285
285
  let $ = v({
286
286
  configurationAuthority: h,
287
287
  signaling: g && {
288
- send(t) {
289
- let n = ee(t);
290
- if (!n) return Promise.reject(/* @__PURE__ */ Error("Invalid live signal"));
291
- let r = m({
292
- ...n,
293
- liveGame: e.gameId
288
+ send(e) {
289
+ let t = p(e);
290
+ if (!t) return Promise.reject(/* @__PURE__ */ Error("Invalid live signal"));
291
+ let n = ee({
292
+ ...t,
293
+ liveGame: o.gameId
294
294
  });
295
- return r ? g.send(r) : Promise.reject(/* @__PURE__ */ Error("Live signal too large"));
295
+ return n ? g.send(n) : Promise.reject(/* @__PURE__ */ Error("Live signal too large"));
296
296
  },
297
- subscribe(t) {
298
- return g.subscribe((n) => {
299
- ee(n?.text)?.liveGame === e.gameId && t(n);
297
+ subscribe(e) {
298
+ return g.subscribe((t) => {
299
+ p(t?.text)?.liveGame === o.gameId && e(t);
300
300
  });
301
301
  }
302
302
  },
303
- selfId: s,
304
- peerId: b,
305
- roomId: e.roomId,
306
- iceServers: te,
307
- iceTransportPolicy: ne,
308
- RTCPeerConnectionImpl: re,
303
+ selfId: m,
304
+ peerId: x,
305
+ roomId: o.roomId,
306
+ iceServers: y,
307
+ iceTransportPolicy: te,
308
+ RTCPeerConnectionImpl: ne,
309
309
  onMove: Ce,
310
310
  onEvent: Oe,
311
311
  onChange(e) {
312
- let t = z.phase;
313
- if (z = e, e.phase === "connected") {
314
- let e = B;
315
- B = !0, I !== "over" && (I = "playing"), t !== "connected" && queueMicrotask(() => {
316
- R || (V && Y({ k: "resign" }), h && e ? Y(he()) : h || Y({ k: "sync" }));
312
+ let t = B.phase;
313
+ if (B = e, e.phase === "connected") {
314
+ let e = ue;
315
+ ue = !0, L !== "over" && (L = "playing"), t !== "connected" && queueMicrotask(() => {
316
+ z || (V && Y({ k: "resign" }), h && e ? Y(he()) : h || Y({ k: "sync" }));
317
317
  });
318
- } else I !== "over" && (I = B ? "disconnected" : "connecting");
318
+ } else L !== "over" && (L = ue ? "disconnected" : "connecting");
319
319
  me();
320
320
  }
321
321
  });
322
322
  function ke() {
323
- h && fe.size === 2 && (j++, Y({ k: "round" }), be());
323
+ h && fe.size === 2 && (N++, Y({ k: "round" }), be());
324
324
  }
325
325
  return h ? $.connect() : $.setListening(!0), {
326
326
  setInput(e) {
327
- oe = { ...e };
327
+ j = { ...e };
328
328
  },
329
- step(r) {
330
- if (R) return;
331
- let i = Math.max(0, Math.min(Number(r) || 0, 100));
332
- if (A += i, I !== "playing") return;
333
- let a = i / 1e3;
334
- for (let e = 0; e < 2; e++) P[e] && A >= P[e] && (P[e] = 0, J({
329
+ step(n) {
330
+ if (z) return;
331
+ let r = Math.max(0, Math.min(Number(n) || 0, 100));
332
+ if (M += r, L !== "playing") return;
333
+ let i = r / 1e3;
334
+ for (let e = 0; e < 2; e++) F[e] && M >= F[e] && (F[e] = 0, J({
335
335
  k: "shield_end",
336
- target: y[e]
337
- })), h && F[e] !== null && A >= F[e] && N[e] > 0 && (_e(e), Y({
336
+ target: b[e]
337
+ })), h && I[e] !== null && M >= I[e] && P[e] > 0 && (_e(e), Y({
338
338
  k: "respawn",
339
- target: y[e]
339
+ target: b[e]
340
340
  }));
341
- let l = A - 100;
342
- for (; U.length > 1 && U[1].time <= l;) U.shift();
341
+ let c = M - 100;
342
+ for (; U.length > 1 && U[1].time <= c;) U.shift();
343
343
  if (U.length) {
344
- let e = U[0], t = U[1] || e, n = o(e.pose, t.pose, t.time === e.time ? 1 : (l - e.time) / (t.time - e.time));
344
+ let e = U[0], t = U[1] || e, n = a(e.pose, t.pose, t.time === e.time ? 1 : (c - e.time) / (t.time - e.time));
345
345
  for (let e of [
346
346
  "x",
347
347
  "z",
@@ -350,155 +350,155 @@ function P({ game: e, selfId: s, isHost: h = String(s) === String(e.hostId), sig
350
350
  "speed"
351
351
  ]) pe()[e] = n[e];
352
352
  }
353
- for (let e = a; e > 0; e -= .016) n(q(), oe, Math.min(e, .016), S);
354
- oe.fire && Se(s, {
355
- id: `${s}:${j}:${++M}`,
353
+ for (let e = i; e > 0; e -= .016) t(q(), j, Math.min(e, .016), C);
354
+ j.fire && Se(m, {
355
+ id: `${m}:${N}:${++oe}`,
356
356
  x: q().x,
357
357
  z: q().z,
358
358
  yaw: q().turretYaw,
359
- t: A
359
+ t: M
360
360
  }, !0);
361
- let d = z.rtt > 250 || z.move?.lossPct > 15 ? 10 : z.rtt > 100 ? 15 : 20;
362
- if (A >= se) {
363
- se = A + 1e3 / d;
364
- let t = q();
361
+ let u = B.rtt > 250 || B.move?.lossPct > 15 ? 10 : B.rtt > 100 ? 15 : 20;
362
+ if (M >= ae) {
363
+ ae = M + 1e3 / u;
364
+ let e = q();
365
365
  $.sendMove({
366
- g: e.gameId,
367
- r: j,
366
+ g: o.gameId,
367
+ r: N,
368
368
  p: [
369
- t.x,
370
- t.z,
371
- t.yaw,
372
- t.turretYaw,
373
- t.speed
369
+ e.x,
370
+ e.z,
371
+ e.yaw,
372
+ e.turretYaw,
373
+ e.speed
374
374
  ],
375
- t: A
375
+ t: M
376
376
  });
377
377
  }
378
- O = O.filter((e) => {
379
- let n = c(e, a, S, D);
378
+ k = k.filter((t) => {
379
+ let n = s(t, i, C, O);
380
380
  if (!n) return !0;
381
- if (h && n.target && I === "playing" && P[y.indexOf(n.target)] > A) J({
381
+ if (h && n.target && L === "playing" && F[b.indexOf(n.target)] > M) J({
382
382
  k: "impact",
383
383
  kind: "shield",
384
384
  target: n.target,
385
- x: e.x,
386
- z: e.z
385
+ x: t.x,
386
+ z: t.z
387
387
  });
388
- else if (h && n.target && I === "playing") {
389
- let t = D.find((e) => e.id === n.target);
390
- t.hp = Math.max(0, t.hp - f.damage), t.alive = t.hp > 0;
388
+ else if (h && n.target && L === "playing") {
389
+ let e = O.find((e) => e.id === n.target);
390
+ e.hp = Math.max(0, e.hp - d.damage), e.alive = e.hp > 0;
391
391
  let r = {
392
392
  k: "hit",
393
- id: e.id,
394
- target: t.id,
395
- dmg: f.damage,
396
- hp: D.map((e) => e.hp),
397
- x: e.x,
398
- z: e.z
393
+ id: t.id,
394
+ target: e.id,
395
+ dmg: d.damage,
396
+ hp: O.map((e) => e.hp),
397
+ x: t.x,
398
+ z: t.z
399
399
  };
400
- Y(r), J(r), t.alive || Q(y.indexOf(t.id), e.owner);
401
- } else if (h && n.kind === "destructible" && I === "playing") {
402
- let r = E(n.id), i = t(S, n.id, 1);
400
+ Y(r), J(r), e.alive || Q(b.indexOf(e.id), t.owner);
401
+ } else if (h && n.kind === "destructible" && L === "playing") {
402
+ let r = D(n.id), i = e(C, n.id, 1);
403
403
  if (Y({
404
404
  k: "destructible_hit",
405
- id: e.id,
405
+ id: t.id,
406
406
  target: n.id,
407
407
  hp: i.hp,
408
- x: e.x,
409
- z: e.z
410
- }), De(r, e.id, e.x, e.z), i.destroyed && r.kind === "barrel") {
411
- let t = u(S, r.id, D), n = ye(t.hits, e.owner), i = {
408
+ x: t.x,
409
+ z: t.z
410
+ }), De(r, t.id, t.x, t.z), i.destroyed && r.kind === "barrel") {
411
+ let e = l(C, r.id, O), n = ye(e.hits, t.owner), i = {
412
412
  k: "barrel_explode",
413
413
  target: r.id,
414
- chained: t.chained?.id ?? null,
415
- hp: D.map((e) => e.hp)
414
+ chained: e.chained?.id ?? null,
415
+ hp: O.map((e) => e.hp)
416
416
  };
417
417
  Y(i), J({
418
418
  k: "barrel_explode",
419
419
  id: r.id,
420
420
  x: r.x,
421
421
  z: r.z,
422
- chained: t.chained,
422
+ chained: e.chained,
423
423
  hp: [...i.hp]
424
424
  }), n();
425
425
  }
426
426
  } else J({
427
427
  k: "impact",
428
428
  kind: n.kind,
429
- x: e.x,
430
- z: e.z
429
+ x: t.x,
430
+ z: t.z
431
431
  }), n.shape === "rect" && J({
432
432
  k: "wall_hit",
433
433
  id: n.id,
434
434
  kind: n.obstacleKind,
435
- x: e.x,
436
- z: e.z
435
+ x: t.x,
436
+ z: t.z
437
437
  });
438
438
  return !1;
439
439
  });
440
440
  },
441
441
  getRender() {
442
442
  let e = {
443
- arena: S,
444
- map: S,
445
- maxLives: C,
446
- lives: [...N],
443
+ arena: C,
444
+ map: C,
445
+ maxLives: w,
446
+ lives: [...P],
447
447
  shield: [0, 1].map(Z),
448
- respawn: F.map((e) => e === null ? null : Math.max(0, Math.round(e - A))),
449
- destructibles: (S.destructibles || []).map((e) => ({
448
+ respawn: I.map((e) => e === null ? null : Math.max(0, Math.round(e - M))),
449
+ destructibles: (C.destructibles || []).map((e) => ({
450
450
  id: e.id,
451
451
  kind: e.kind,
452
452
  x: e.x,
453
453
  z: e.z,
454
454
  r: e.r,
455
455
  hp: e.hp,
456
- alive: r(e)
456
+ alive: n(e)
457
457
  })),
458
- tanks: D.map((e) => ({
458
+ tanks: O.map((e) => ({
459
459
  ...e,
460
- self: e.id === s,
461
- reload: Math.min(1, (A - (de.get(e.id) ?? -Infinity)) / f.reloadMs)
460
+ self: e.id === m,
461
+ reload: Math.min(1, (M - (de.get(e.id) ?? -Infinity)) / d.reloadMs)
462
462
  })),
463
- shells: O.map((e) => ({ ...e })),
464
- events: k,
465
- status: I,
466
- winner: L,
463
+ shells: k.map((e) => ({ ...e })),
464
+ events: A,
465
+ status: L,
466
+ winner: R,
467
467
  net: {
468
- ...z,
469
- turnConfigured: z.turnConfigured ?? ie
468
+ ...B,
469
+ turnConfigured: B.turnConfigured ?? re
470
470
  }
471
471
  };
472
- return k = [], e;
472
+ return A = [], e;
473
473
  },
474
474
  configureTurn(e, t) {
475
- return R || I === "over" ? Promise.reject(/* @__PURE__ */ Error("La partida ya terminó.")) : $.configureTurn(e, t);
475
+ return z || L === "over" ? Promise.reject(/* @__PURE__ */ Error("La partida ya terminó.")) : $.configureTurn(e, t);
476
476
  },
477
477
  reconnect() {
478
- !R && I !== "over" && ($.requestReconnect ? $.requestReconnect() : $.connect());
478
+ !z && L !== "over" && ($.requestReconnect ? $.requestReconnect() : $.connect());
479
479
  },
480
480
  rematch() {
481
- !R && I === "over" && (fe.add(s), Y({ k: "rematch" }), ke());
481
+ !z && L === "over" && (fe.add(m), Y({ k: "rematch" }), ke());
482
482
  },
483
483
  resign() {
484
- !R && I !== "over" && (V = !0, H = "resigned", Y({ k: "resign" }), xe(b));
484
+ !z && L !== "over" && (V = !0, H = "resigned", Y({ k: "resign" }), xe(x));
485
485
  },
486
486
  destroy() {
487
- R || (R = !0, $.destroy(), O = [], U = [], k = []);
487
+ z || (z = !0, $.destroy(), k = [], U = [], A = []);
488
488
  }
489
489
  };
490
490
  }
491
- var F = 180 / Math.PI, I = (e, t) => Number.isFinite(e) ? e : t;
492
- function L(e) {
491
+ var I = 180 / Math.PI, L = (e, t) => Number.isFinite(e) ? e : t;
492
+ function R(e) {
493
493
  let t = e || {}, n = t.bounds || t;
494
- if (Number.isFinite(n.minX) && Number.isFinite(n.maxX) && Number.isFinite(n.minZ) && Number.isFinite(n.maxZ)) return R({
494
+ if (Number.isFinite(n.minX) && Number.isFinite(n.maxX) && Number.isFinite(n.minZ) && Number.isFinite(n.maxZ)) return z({
495
495
  minX: n.minX,
496
496
  minZ: n.minZ,
497
497
  maxX: n.maxX,
498
498
  maxZ: n.maxZ
499
499
  });
500
- let r = I(t.width, I(t.size, 120)), i = I(t.depth, I(t.height, I(t.size, r)));
501
- return R(t.centered === !0 || t.origin === "center" ? {
500
+ let r = L(t.width, L(t.size, 120)), i = L(t.depth, L(t.height, L(t.size, r)));
501
+ return z(t.centered === !0 || t.origin === "center" ? {
502
502
  minX: -r / 2,
503
503
  minZ: -i / 2,
504
504
  maxX: r / 2,
@@ -510,7 +510,7 @@ function L(e) {
510
510
  maxZ: i
511
511
  });
512
512
  }
513
- function R(e) {
513
+ function z(e) {
514
514
  return {
515
515
  ...e,
516
516
  width: e.maxX - e.minX,
@@ -519,15 +519,15 @@ function R(e) {
519
519
  cz: (e.minZ + e.maxZ) / 2
520
520
  };
521
521
  }
522
- function z(e) {
522
+ function B(e) {
523
523
  return (e?.obstacles || []).filter((e) => Number.isFinite(e?.x) && Number.isFinite(e?.z)).map((e) => ({
524
524
  x: e.x,
525
525
  z: e.z,
526
- r: I(e.r, I(e.radius, 1.5)),
526
+ r: L(e.r, L(e.radius, 1.5)),
527
527
  kind: e.kind === "tree" ? "tree" : "rock"
528
528
  }));
529
529
  }
530
- var B = (e) => e ? e.k ?? e.type ?? null : null;
530
+ var ue = (e) => e ? e.k ?? e.type ?? null : null;
531
531
  function V(e, t) {
532
532
  let n = t || [], r = e?.tank ?? e?.by ?? e?.owner ?? e?.from;
533
533
  if (r != null) {
@@ -578,7 +578,7 @@ function de({ moveSpeed: e = .6, turnSpeed: t = .35, holdMs: n = 160 } = {}) {
578
578
  };
579
579
  }
580
580
  function K(e) {
581
- switch (B(e)) {
581
+ switch (ue(e)) {
582
582
  case "fire": return [{ type: "fire" }, { type: "projectile_start" }];
583
583
  case "impact": return [{
584
584
  type: "impact",
@@ -613,16 +613,16 @@ function Y(e) {
613
613
  shape: "rect",
614
614
  x: e.x,
615
615
  z: e.z,
616
- w: I(e.w, 2),
617
- d: I(e.d, 2),
618
- rot: I(e.rot, 0),
616
+ w: L(e.w, 2),
617
+ d: L(e.d, 2),
618
+ rot: L(e.rot, 0),
619
619
  kind: e.kind || "wall"
620
620
  } : {
621
621
  id: e.id,
622
622
  shape: "circle",
623
623
  x: e.x,
624
624
  z: e.z,
625
- r: I(e.r, I(e.radius, 1.5)),
625
+ r: L(e.r, L(e.radius, 1.5)),
626
626
  kind: e.kind || "rock"
627
627
  });
628
628
  }
@@ -631,7 +631,7 @@ function X(e) {
631
631
  id: String(e.id),
632
632
  x: e.x,
633
633
  z: e.z,
634
- r: I(e.r, e.kind === "barrel" ? .9 : 1.2),
634
+ r: L(e.r, e.kind === "barrel" ? .9 : 1.2),
635
635
  kind: e.kind === "barrel" ? "barrel" : "crate"
636
636
  }));
637
637
  }
@@ -665,7 +665,7 @@ var Q = /* @__PURE__ */ new Set([
665
665
  "health_pickup"
666
666
  ]);
667
667
  function ye(e, t) {
668
- let n = B(e), r = e?.target ?? e?.tank ?? e?.id, i = U(t?.tanks), a = i != null && r != null && String(r) === String(i.id);
668
+ let n = ue(e), r = e?.target ?? e?.tank ?? e?.id, i = U(t?.tanks), a = i != null && r != null && String(r) === String(i.id);
669
669
  switch (n) {
670
670
  case "life_lost": return ["life_lost"];
671
671
  case "crate_break": return ["crate_break"];
@@ -726,10 +726,10 @@ function Ce(e, { arena: t } = {}) {
726
726
  n.style.cssText = "width:100%;height:100%;display:block", e.appendChild(n);
727
727
  let r = n.getContext("2d");
728
728
  if (!r) throw n.remove(), Error("Canvas 2D unavailable");
729
- let i = L(t), a = me(t) ? t : null, o = a ? be[a.id] : {
729
+ let i = R(t), a = me(t) ? t : null, o = a ? be[a.id] : {
730
730
  bg: "#152519",
731
731
  ground: "#526348"
732
- }, s = a ? Y(t) : z(t).map((e) => ({
732
+ }, s = a ? Y(t) : B(t).map((e) => ({
733
733
  ...e,
734
734
  shape: "circle"
735
735
  })), c = a ? X(t) : [], l = a ? (t.decor || []).filter((e) => Se[e?.kind] && Number.isFinite(e.x) && Number.isFinite(e.z)) : [], u = 0, d = 1, f = 1, p = 1, ee = 0, m = 0;
@@ -770,19 +770,19 @@ function Ce(e, { arena: t } = {}) {
770
770
  };
771
771
  }
772
772
  // src/games/tanks-live/TanksLiveGameCard.jsx
773
- var we = /* @__PURE__ */ e({ default: () => je }), Te = (e, t) => {
774
- s.getState().act(e, t).catch(() => {});
773
+ var we = /* @__PURE__ */ y({ default: () => je }), Te = (e, t) => {
774
+ o.getState().act(e, t).catch(() => {});
775
775
  }, Ee = (e) => {
776
776
  e.throttle = 0, e.steer = 0, e.fire = !1;
777
777
  }, De = 3e3, Oe = (e) => me(e?.map) ? e.map : e?.arena;
778
778
  function $({ lives: e, max: t, label: n }) {
779
779
  if (!Number.isFinite(e)) return null;
780
780
  let r = Math.max(e, t || e);
781
- return /* @__PURE__ */ M("span", {
781
+ return /* @__PURE__ */ A("span", {
782
782
  className: `tl-hearts${e === 1 && r > 1 ? " tl-hearts--last" : ""}`,
783
783
  role: "img",
784
784
  "aria-label": `${n}: ${e} ${e === 1 ? "vida" : "vidas"}`,
785
- children: Array.from({ length: r }, (t, n) => /* @__PURE__ */ M("span", {
785
+ children: Array.from({ length: r }, (t, n) => /* @__PURE__ */ A("span", {
786
786
  className: n < e ? "tl-heart" : "tl-heart tl-heart--lost",
787
787
  "aria-hidden": "true",
788
788
  children: n < e ? "❤️" : "🖤"
@@ -794,45 +794,45 @@ function ke(e, t) {
794
794
  return n?.status === "applying" ? "Aplicando configuración…" : n?.status === "sharing" ? "Sincronizando con el otro jugador…" : n?.status === "waiting_peer" ? "Esperando al otro jugador para compartir la configuración…" : e?.phase === "connected" ? "¡Conexión establecida!" : n?.status === "failed" || e?.phase === "failed" || e?.ice === "failed" ? "No pudimos conectar. Puedes reintentar." : t ? "La conexión está tardando más de lo esperado" : e?.phase === "restarting" || e?.phase === "reconnecting" ? "Reconectando…" : e?.phase === "listening" ? "Esperando la conexión del otro jugador…" : e?.phase === "calling" ? "Buscando al otro jugador…" : e?.phase === "negotiating" ? "Buscando una conexión entre los jugadores…" : "Preparando partida…";
795
795
  }
796
796
  function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspended: i = !1 }) {
797
- let a = w(h)?.config?.webrtc, o = s((t) => t.games[e]), c = E(i);
797
+ let a = T(m)?.config?.webrtc, s = o((t) => t.games[e]), c = D(i);
798
798
  c.current = i;
799
- let l = E(null), u = E(null), d = E(null), f = E({
799
+ let l = D(null), u = D(null), d = D(null), f = D({
800
800
  throttle: 0,
801
801
  steer: 0,
802
802
  fire: !1
803
- }), [p, ee] = D(null), [m, C] = D(""), [ce, le] = D(!1), [ue, F] = D("loading"), [I, L] = D(!1), [R, z] = D(0), V = p?.net?.phase === "connected";
804
- T(() => {
805
- if (!o || o.status !== "active" || V) {
806
- z(0);
803
+ }), [p, ee] = O(null), [y, w] = O(""), [se, ce] = O(!1), [le, I] = O("loading"), [L, R] = O(!1), [z, B] = O(0), V = p?.net?.phase === "connected";
804
+ E(() => {
805
+ if (!s || s.status !== "active" || V) {
806
+ B(0);
807
807
  return;
808
808
  }
809
- let e = Date.now(), t = setInterval(() => z(Date.now() - e), 1e3);
809
+ let e = Date.now(), t = setInterval(() => B(Date.now() - e), 1e3);
810
810
  return () => clearInterval(t);
811
811
  }, [
812
812
  e,
813
- o?.status,
813
+ s?.status,
814
814
  V
815
- ]), T(() => {
816
- L(!1);
817
- }, [e, o?.status]), T(() => {
818
- i ? (Ee(f.current), x()) : d.current?.resize();
815
+ ]), E(() => {
816
+ R(!1);
817
+ }, [e, s?.status]), E(() => {
818
+ i ? (Ee(f.current), S()) : d.current?.resize();
819
819
  }, [i]);
820
- let H = ["active", "won"].includes(o?.status), [W, G] = D(null);
821
- if (T(() => {
820
+ let H = ["active", "won"].includes(s?.status), [W, G] = O(null);
821
+ if (E(() => {
822
822
  if (!H || !W || !l.current) return;
823
823
  let e = !1, t = null, n = {
824
824
  arena: W,
825
825
  lowPower: matchMedia("(pointer: coarse)").matches,
826
826
  reducedMotion: matchMedia("(prefers-reduced-motion: reduce)").matches,
827
827
  onEvent: (e) => {
828
- e.type === "context_lost" && le(!0);
828
+ e.type === "context_lost" && ce(!0);
829
829
  }
830
830
  }, r = () => {
831
- e || (t = Ce(l.current, n), d.current = t, F("2d"));
831
+ e || (t = Ce(l.current, n), d.current = t, I("2d"));
832
832
  };
833
- return ce ? r() : import("./createLiveScene-MTGRv8rx.js").then(({ createLiveScene: i }) => {
833
+ return se ? r() : import("./createLiveScene-jrzyQogh.js").then(({ createLiveScene: i }) => {
834
834
  if (!e) try {
835
- t = i(l.current, n), d.current = t, F("3d");
835
+ t = i(l.current, n), d.current = t, I("3d");
836
836
  } catch {
837
837
  r();
838
838
  }
@@ -842,32 +842,32 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
842
842
  }, [
843
843
  H,
844
844
  W,
845
- ce
846
- ]), T(() => {
847
- if (!H || o.status !== "active" || !l.current) return;
845
+ se
846
+ ]), E(() => {
847
+ if (!H || s.status !== "active" || !l.current) return;
848
848
  let n = !1, r = 0, i = performance.now(), p = 0, m = null, h = de(), g = /* @__PURE__ */ new Set();
849
- b();
849
+ x();
850
850
  let _;
851
851
  try {
852
- let n = s.getState().createLiveSignaling(e);
853
- _ = P({
852
+ let n = o.getState().createLiveSignaling(e);
853
+ _ = F({
854
854
  iceServers: a?.iceServers,
855
855
  iceTransportPolicy: a?.iceTransportPolicy,
856
- game: o,
856
+ game: s,
857
857
  selfId: String(t),
858
- isHost: String(o.hostId) === String(t),
858
+ isHost: String(s.hostId) === String(t),
859
859
  signaling: n
860
860
  }), u.current = _;
861
861
  } catch (e) {
862
- C(e.message || "No se pudo iniciar WebRTC");
862
+ w(e.message || "No se pudo iniciar WebRTC");
863
863
  return;
864
864
  }
865
865
  G(Oe(_.getRender()));
866
- let v = null, te = !1;
867
- function S() {
868
- g.clear(), Ee(f.current), x();
866
+ let v = null, y = !1;
867
+ function C() {
868
+ g.clear(), Ee(f.current), S();
869
869
  }
870
- function w(e, t) {
870
+ function T(e, t) {
871
871
  /^(INPUT|TEXTAREA|SELECT)$/.test(e.target?.tagName) || [
872
872
  "KeyW",
873
873
  "KeyA",
@@ -880,57 +880,57 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
880
880
  "Space"
881
881
  ].includes(e.code) && (e.preventDefault(), t ? g.add(e.code) : g.delete(e.code), f.current.throttle = Number(g.has("KeyW") || g.has("ArrowUp")) - Number(g.has("KeyS") || g.has("ArrowDown")), f.current.steer = Number(g.has("KeyD") || g.has("ArrowRight")) - Number(g.has("KeyA") || g.has("ArrowLeft")), f.current.fire = g.has("Space"));
882
882
  }
883
- let T = (e) => w(e, !0), E = (e) => w(e, !1), D = l.current;
884
- D.addEventListener("keydown", T), D.addEventListener("keyup", E), D.addEventListener("blur", S);
885
- let O = () => {
886
- document.hidden && S();
883
+ let E = (e) => T(e, !0), D = (e) => T(e, !1), O = l.current;
884
+ O.addEventListener("keydown", E), O.addEventListener("keyup", D), O.addEventListener("blur", C);
885
+ let k = () => {
886
+ document.hidden && C();
887
887
  };
888
- document.addEventListener("visibilitychange", O), ie({ type: "engine_start" }, e);
889
- function k(t) {
888
+ document.addEventListener("visibilitychange", k), re({ type: "engine_start" }, e);
889
+ function A(t) {
890
890
  if (n) return;
891
891
  let a = Math.min(80, t - i);
892
892
  i = t;
893
- let o = c.current || document.hidden;
894
- _.setInput(o ? {
893
+ let s = c.current || document.hidden;
894
+ _.setInput(s ? {
895
895
  throttle: 0,
896
896
  steer: 0,
897
897
  fire: !1
898
898
  } : f.current), _.step(a);
899
899
  let l = _.getRender();
900
- if (o || d.current?.render(l, a), o && (g.clear(), h.reset(), x(), te = !1), !o) for (let e of l.events || []) for (let t of K(e)) ie(t, e.id);
901
- if (!o) for (let e of l.events || []) for (let t of ye(e, l)) y(t);
900
+ if (s || d.current?.render(l, a), s && (g.clear(), h.reset(), S(), y = !1), !s) for (let e of l.events || []) for (let t of K(e)) re(t, e.id);
901
+ if (!s) for (let e of l.events || []) for (let t of ye(e, l)) b(t);
902
902
  let u = U(l.tanks);
903
903
  for (let e of l.events || []) {
904
904
  let n = e?.target ?? e?.tank;
905
- u && n != null && String(n) === String(u.id) && (B(e) === "life_lost" && (v = t + (Number.isFinite(e.respawnMs) ? e.respawnMs : De)), B(e) === "respawn" && (v = null));
905
+ u && n != null && String(n) === String(u.id) && (ue(e) === "life_lost" && (v = t + (Number.isFinite(e.respawnMs) ? e.respawnMs : De)), ue(e) === "respawn" && (v = null));
906
906
  }
907
907
  u?.alive !== !1 && v != null && t >= v && (v = null);
908
- let b = !o && l.status === "playing" && u?.alive !== !1 && _e(l, u) > 0;
909
- b !== te && (te = b, b ? ne("shield_loop") : re("shield_loop"));
910
- let S = u ? l.tanks.indexOf(u) : -1, C = Number.isFinite(l.respawn?.[S]) ? l.respawn[S] : v != null && l.status === "playing" ? Math.max(0, v - t) : 0;
911
- if (!o) for (let e of h.update(U(l.tanks), a)) ie(e);
912
- let w = fe(l);
913
- w && !m && (v = null, ee({
908
+ let x = !s && l.status === "playing" && u?.alive !== !1 && _e(l, u) > 0;
909
+ x !== y && (y = x, x ? te("shield_loop") : ne("shield_loop"));
910
+ let C = u ? l.tanks.indexOf(u) : -1, w = Number.isFinite(l.respawn?.[C]) ? l.respawn[C] : v != null && l.status === "playing" ? Math.max(0, v - t) : 0;
911
+ if (!s) for (let e of h.update(U(l.tanks), a)) re(e);
912
+ let T = fe(l);
913
+ T && !m && (v = null, ee({
914
914
  ...l,
915
915
  respawnIn: 0
916
- }), m = w, o || ae(m, e), s.getState().liveFinish?.(e, l.winner)), t - p > 100 && (p = t, ee({
916
+ }), m = T, s || ie(m, e), o.getState().liveFinish?.(e, l.winner)), t - p > 100 && (p = t, ee({
917
917
  ...l,
918
- respawnIn: C
919
- })), r = requestAnimationFrame(k);
918
+ respawnIn: w
919
+ })), r = requestAnimationFrame(A);
920
920
  }
921
- return r = requestAnimationFrame(k), () => {
922
- n = !0, cancelAnimationFrame(r), S(), _.destroy(), u.current = null, D.removeEventListener("keydown", T), D.removeEventListener("keyup", E), D.removeEventListener("blur", S), document.removeEventListener("visibilitychange", O);
921
+ return r = requestAnimationFrame(A), () => {
922
+ n = !0, cancelAnimationFrame(r), C(), _.destroy(), u.current = null, O.removeEventListener("keydown", E), O.removeEventListener("keyup", D), O.removeEventListener("blur", C), document.removeEventListener("visibilitychange", k);
923
923
  };
924
924
  }, [
925
925
  H,
926
926
  e,
927
927
  t
928
- ]), !o) return null;
929
- let q = String(t) === String(o.guestId), Y = p?.status === "over" || o.status === "won", X = p?.net, Z = X?.manualTurn, he = [
928
+ ]), !s) return null;
929
+ let q = String(t) === String(s.guestId), Y = p?.status === "over" || s.status === "won", X = p?.net, Z = X?.manualTurn, he = [
930
930
  "waiting_peer",
931
931
  "sharing",
932
932
  "applying"
933
- ].includes(Z?.status), Q = !V && (R >= 12e3 || X?.phase === "failed" || X?.ice === "failed" || Z?.status === "failed" || !!m), be = me(W) ? W : null, xe = ve(p), Se = (p?.tanks || []).some((e) => Number.isFinite(ge(p, e))) && (be != null || xe > 1), we = Math.ceil((p?.respawnIn || 0) / 1e3), Ae = V ? X?.route?.relay === !0 ? "TURN Relay" : X?.route?.relay === !1 ? "P2P" : null : null, je = async (e, t) => {
933
+ ].includes(Z?.status), Q = !V && (z >= 12e3 || X?.phase === "failed" || X?.ice === "failed" || Z?.status === "failed" || !!y), be = me(W) ? W : null, xe = ve(p), Se = (p?.tanks || []).some((e) => Number.isFinite(ge(p, e))) && (be != null || xe > 1), we = Math.ceil((p?.respawnIn || 0) / 1e3), Ae = V ? X?.route?.relay === !0 ? "TURN Relay" : X?.route?.relay === !1 ? "P2P" : null : null, je = async (e, t) => {
934
934
  if (!u.current?.configureTurn) throw Error("La partida aún no está preparada. Espera un momento y vuelve a intentarlo.");
935
935
  await u.current.configureTurn(e, t);
936
936
  };
@@ -954,22 +954,22 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
954
954
  f.current[e] = e !== "fire" && 0;
955
955
  }
956
956
  });
957
- return /* @__PURE__ */ N("section", {
957
+ return /* @__PURE__ */ j("section", {
958
958
  className: `chat-game-card tl-card${H ? " tl-card--active" : ""}`,
959
959
  "aria-label": "Tanques LIVE 3D",
960
960
  children: [
961
- /* @__PURE__ */ N("header", {
961
+ /* @__PURE__ */ j("header", {
962
962
  className: "tl-header",
963
- children: [/* @__PURE__ */ M("strong", { children: "Tanques LIVE 3D" }), /* @__PURE__ */ N("div", {
963
+ children: [/* @__PURE__ */ A("strong", { children: "Tanques LIVE 3D" }), /* @__PURE__ */ j("div", {
964
964
  className: "tl-header-actions",
965
965
  children: [
966
- /* @__PURE__ */ M(g, { manager: S() }),
967
- n && /* @__PURE__ */ M("button", {
966
+ /* @__PURE__ */ A(h, { manager: C() }),
967
+ n && /* @__PURE__ */ A("button", {
968
968
  onClick: n,
969
969
  "aria-label": "Minimizar",
970
970
  children: "−"
971
971
  }),
972
- r && /* @__PURE__ */ M("button", {
972
+ r && /* @__PURE__ */ A("button", {
973
973
  onClick: r,
974
974
  "aria-label": "Ocultar",
975
975
  children: "×"
@@ -977,83 +977,83 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
977
977
  ]
978
978
  })]
979
979
  }),
980
- o.status === "invited" && /* @__PURE__ */ N("div", {
980
+ s.status === "invited" && /* @__PURE__ */ j("div", {
981
981
  className: "tl-invite",
982
982
  children: [
983
- /* @__PURE__ */ M("span", {
983
+ /* @__PURE__ */ A("span", {
984
984
  className: "tl-invite-icon",
985
985
  "aria-hidden": "true",
986
986
  children: "🪖"
987
987
  }),
988
- /* @__PURE__ */ M("strong", { children: q ? "¿Listo para combatir?" : "Invitación enviada" }),
989
- /* @__PURE__ */ M("p", { children: q ? "Te invitaron a un combate en tiempo real." : "Esperando que el rival acepte…" }),
990
- q && /* @__PURE__ */ N("div", {
988
+ /* @__PURE__ */ A("strong", { children: q ? "¿Listo para combatir?" : "Invitación enviada" }),
989
+ /* @__PURE__ */ A("p", { children: q ? "Te invitaron a un combate en tiempo real." : "Esperando que el rival acepte…" }),
990
+ q && /* @__PURE__ */ j("div", {
991
991
  className: "tl-invite-actions",
992
- children: [/* @__PURE__ */ M("button", {
992
+ children: [/* @__PURE__ */ A("button", {
993
993
  className: "tl-button-primary",
994
994
  onClick: () => Te(e, "game_accept"),
995
995
  children: "Aceptar combate"
996
- }), /* @__PURE__ */ M("button", {
996
+ }), /* @__PURE__ */ A("button", {
997
997
  onClick: () => Te(e, "game_decline"),
998
998
  children: "Rechazar"
999
999
  })]
1000
1000
  })
1001
1001
  ]
1002
1002
  }),
1003
- H && !Y && /* @__PURE__ */ N("div", {
1003
+ H && !Y && /* @__PURE__ */ j("div", {
1004
1004
  className: `tl-connection tl-connection--${V ? "connected" : Q ? "problem" : "pending"}`,
1005
1005
  children: [
1006
- /* @__PURE__ */ N("div", {
1006
+ /* @__PURE__ */ j("div", {
1007
1007
  className: "tl-connection-heading",
1008
1008
  children: [
1009
- V ? /* @__PURE__ */ M(k, {
1009
+ V ? /* @__PURE__ */ A(ae, {
1010
1010
  size: 18,
1011
1011
  "aria-hidden": "true"
1012
- }) : Q ? /* @__PURE__ */ M(O, {
1012
+ }) : Q ? /* @__PURE__ */ A(M, {
1013
1013
  size: 18,
1014
1014
  "aria-hidden": "true"
1015
- }) : /* @__PURE__ */ M(A, {
1015
+ }) : /* @__PURE__ */ A(oe, {
1016
1016
  size: 18,
1017
1017
  className: "tl-connection-spinner",
1018
1018
  "aria-hidden": "true"
1019
1019
  }),
1020
- /* @__PURE__ */ N("div", { children: [/* @__PURE__ */ M("strong", { children: Q ? "Problemas de conexión" : ke(X, !1) }), Q && /* @__PURE__ */ M("p", { children: "No pudimos establecer una conexión con el otro jugador. Puedes configurar una conexión alternativa para continuar." })] }),
1021
- Ae && /* @__PURE__ */ M("span", {
1020
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("strong", { children: Q ? "Problemas de conexión" : ke(X, !1) }), Q && /* @__PURE__ */ A("p", { children: "No pudimos establecer una conexión con el otro jugador. Puedes configurar una conexión alternativa para continuar." })] }),
1021
+ Ae && /* @__PURE__ */ A("span", {
1022
1022
  className: "tl-route-badge",
1023
1023
  children: Ae
1024
1024
  })
1025
1025
  ]
1026
1026
  }),
1027
- !V && /* @__PURE__ */ M("p", {
1027
+ !V && /* @__PURE__ */ A("p", {
1028
1028
  className: "tl-connection-message",
1029
1029
  role: "status",
1030
- children: Q ? ke(X, R >= 12e3) : _(X)
1030
+ children: Q ? ke(X, z >= 12e3) : g(X)
1031
1031
  }),
1032
- Z?.status === "synchronized" && /* @__PURE__ */ M("p", {
1032
+ Z?.status === "synchronized" && /* @__PURE__ */ A("p", {
1033
1033
  className: "tl-connection-shared",
1034
1034
  role: "status",
1035
1035
  children: Z.received ? "Configuración recibida del otro jugador y aplicada en ambos." : "Configuración compartida y aplicada en ambos jugadores."
1036
1036
  }),
1037
- Z?.expiresAt != null && Z.expiresAt <= Date.now() && /* @__PURE__ */ M("p", {
1037
+ Z?.expiresAt != null && Z.expiresAt <= Date.now() && /* @__PURE__ */ A("p", {
1038
1038
  className: "tl-connection-expired",
1039
1039
  role: "status",
1040
1040
  children: "La validez indicada para las credenciales terminó. Introduce una configuración nueva si necesitas reconectar."
1041
1041
  }),
1042
- /* @__PURE__ */ N("div", {
1042
+ /* @__PURE__ */ j("div", {
1043
1043
  className: "tl-connection-actions",
1044
- children: [/* @__PURE__ */ N("button", {
1044
+ children: [/* @__PURE__ */ j("button", {
1045
1045
  type: "button",
1046
1046
  className: Q ? "tl-button-primary" : "",
1047
- onClick: () => L(!0),
1048
- children: [/* @__PURE__ */ M(se, {
1047
+ onClick: () => R(!0),
1048
+ children: [/* @__PURE__ */ A(P, {
1049
1049
  size: 15,
1050
1050
  "aria-hidden": "true"
1051
1051
  }), "Configurar conexión alternativa"]
1052
- }), !V && /* @__PURE__ */ N("button", {
1052
+ }), !V && /* @__PURE__ */ j("button", {
1053
1053
  type: "button",
1054
1054
  disabled: he,
1055
1055
  onClick: () => u.current?.reconnect(),
1056
- children: [/* @__PURE__ */ M(oe, {
1056
+ children: [/* @__PURE__ */ A(N, {
1057
1057
  size: 15,
1058
1058
  "aria-hidden": "true"
1059
1059
  }), "Reintentar conexión"]
@@ -1061,20 +1061,20 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
1061
1061
  })
1062
1062
  ]
1063
1063
  }),
1064
- /* @__PURE__ */ M(v, {
1065
- open: I && H && !Y,
1066
- onClose: () => L(!1),
1064
+ /* @__PURE__ */ A(_, {
1065
+ open: L && H && !Y,
1066
+ onClose: () => R(!1),
1067
1067
  onApply: je,
1068
1068
  manualTurn: Z
1069
1069
  }),
1070
- (H || p) && /* @__PURE__ */ N(j, { children: [
1071
- /* @__PURE__ */ N("div", {
1070
+ (H || p) && /* @__PURE__ */ j(k, { children: [
1071
+ /* @__PURE__ */ j("div", {
1072
1072
  className: "tl-hud",
1073
1073
  children: [
1074
- (p?.tanks || []).map((e) => /* @__PURE__ */ N("span", { children: [
1074
+ (p?.tanks || []).map((e) => /* @__PURE__ */ j("span", { children: [
1075
1075
  e.self ? "Tú" : "Rival",
1076
1076
  " ",
1077
- /* @__PURE__ */ M("meter", {
1077
+ /* @__PURE__ */ A("meter", {
1078
1078
  min: "0",
1079
1079
  max: "100",
1080
1080
  value: e.hp,
@@ -1083,18 +1083,18 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
1083
1083
  " ",
1084
1084
  e.hp,
1085
1085
  " HP",
1086
- Se && /* @__PURE__ */ M($, {
1086
+ Se && /* @__PURE__ */ A($, {
1087
1087
  lives: ge(p, e),
1088
1088
  max: xe,
1089
1089
  label: e.self ? "Tus vidas" : "Vidas del rival"
1090
1090
  }),
1091
- _e(p, e) > 0 && e.alive !== !1 && /* @__PURE__ */ M("span", {
1091
+ _e(p, e) > 0 && e.alive !== !1 && /* @__PURE__ */ A("span", {
1092
1092
  className: "tl-shield-badge",
1093
1093
  title: "Escudo activo",
1094
1094
  children: "🛡️"
1095
1095
  })
1096
1096
  ] }, e.id)),
1097
- be && /* @__PURE__ */ N("span", {
1097
+ be && /* @__PURE__ */ j("span", {
1098
1098
  className: "tl-map",
1099
1099
  children: [
1100
1100
  pe[be.id],
@@ -1102,17 +1102,17 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
1102
1102
  J(be)
1103
1103
  ]
1104
1104
  }),
1105
- /* @__PURE__ */ N("span", {
1105
+ /* @__PURE__ */ j("span", {
1106
1106
  role: "status",
1107
1107
  children: [
1108
- V ? Ae || "Conectado" : ke(X, R >= 12e3),
1108
+ V ? Ae || "Conectado" : ke(X, z >= 12e3),
1109
1109
  " ",
1110
1110
  Number.isFinite(X?.rtt) ? `· ${Math.round(X.rtt)} ms` : ""
1111
1111
  ]
1112
1112
  })
1113
1113
  ]
1114
1114
  }),
1115
- we > 0 && !Y && /* @__PURE__ */ N("div", {
1115
+ we > 0 && !Y && /* @__PURE__ */ j("div", {
1116
1116
  className: "tl-respawn",
1117
1117
  role: "status",
1118
1118
  children: [
@@ -1121,7 +1121,7 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
1121
1121
  " s…"
1122
1122
  ]
1123
1123
  }),
1124
- /* @__PURE__ */ M("div", {
1124
+ /* @__PURE__ */ A("div", {
1125
1125
  className: "tl-stage",
1126
1126
  ref: l,
1127
1127
  tabIndex: 0,
@@ -1140,10 +1140,10 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
1140
1140
  f.current.fire = !1;
1141
1141
  }
1142
1142
  }),
1143
- /* @__PURE__ */ N("div", {
1143
+ /* @__PURE__ */ j("div", {
1144
1144
  className: "tl-controls",
1145
1145
  children: [
1146
- /* @__PURE__ */ M("div", {
1146
+ /* @__PURE__ */ A("div", {
1147
1147
  className: "tl-joystick",
1148
1148
  role: "group",
1149
1149
  "aria-label": "Joystick de conducción",
@@ -1162,44 +1162,44 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
1162
1162
  onLostPointerCapture: () => Ee(f.current),
1163
1163
  children: "✥"
1164
1164
  }),
1165
- /* @__PURE__ */ N("div", {
1165
+ /* @__PURE__ */ j("div", {
1166
1166
  className: "tl-drive",
1167
1167
  "aria-label": "Controles de conducción",
1168
1168
  children: [
1169
- /* @__PURE__ */ M("button", {
1169
+ /* @__PURE__ */ A("button", {
1170
1170
  "aria-label": "Avanzar",
1171
1171
  ...Ne("throttle", 1),
1172
1172
  children: "▲"
1173
1173
  }),
1174
- /* @__PURE__ */ M("button", {
1174
+ /* @__PURE__ */ A("button", {
1175
1175
  "aria-label": "Girar izquierda",
1176
1176
  ...Ne("steer", -1),
1177
1177
  children: "◀"
1178
1178
  }),
1179
- /* @__PURE__ */ M("button", {
1179
+ /* @__PURE__ */ A("button", {
1180
1180
  "aria-label": "Retroceder",
1181
1181
  ...Ne("throttle", -1),
1182
1182
  children: "▼"
1183
1183
  }),
1184
- /* @__PURE__ */ M("button", {
1184
+ /* @__PURE__ */ A("button", {
1185
1185
  "aria-label": "Girar derecha",
1186
1186
  ...Ne("steer", 1),
1187
1187
  children: "▶"
1188
1188
  })
1189
1189
  ]
1190
1190
  }),
1191
- /* @__PURE__ */ M("button", {
1191
+ /* @__PURE__ */ A("button", {
1192
1192
  className: "tl-fire",
1193
1193
  ...Ne("fire", !0),
1194
1194
  children: "Disparar"
1195
1195
  })
1196
1196
  ]
1197
1197
  }),
1198
- /* @__PURE__ */ M("div", {
1198
+ /* @__PURE__ */ A("div", {
1199
1199
  className: "tl-reload",
1200
- children: /* @__PURE__ */ N("label", { children: [
1200
+ children: /* @__PURE__ */ j("label", { children: [
1201
1201
  "Recarga ",
1202
- /* @__PURE__ */ M("progress", {
1202
+ /* @__PURE__ */ A("progress", {
1203
1203
  max: "1",
1204
1204
  value: U(p?.tanks)?.reload ?? 1
1205
1205
  }),
@@ -1207,60 +1207,60 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
1207
1207
  (U(p?.tanks)?.reload ?? 1) >= 1 ? "Listo" : "Recargando…"
1208
1208
  ] })
1209
1209
  }),
1210
- /* @__PURE__ */ M("small", { children: "WASD / flechas · ratón o toca la arena para apuntar · espacio / clic para disparar" }),
1211
- /* @__PURE__ */ M("button", {
1212
- onClick: () => le((e) => !e),
1213
- children: ue === "2d" ? "Probar 3D" : "Vista 2D"
1210
+ /* @__PURE__ */ A("small", { children: "WASD / flechas · ratón o toca la arena para apuntar · espacio / clic para disparar" }),
1211
+ /* @__PURE__ */ A("button", {
1212
+ onClick: () => ce((e) => !e),
1213
+ children: le === "2d" ? "Probar 3D" : "Vista 2D"
1214
1214
  })
1215
1215
  ] }),
1216
- Y && /* @__PURE__ */ N("p", {
1216
+ Y && /* @__PURE__ */ j("p", {
1217
1217
  role: "status",
1218
1218
  children: [
1219
- String(p?.winner ?? o.winnerId) === String(t) ? "¡Victoria!" : "Fin del combate",
1219
+ String(p?.winner ?? s.winnerId) === String(t) ? "¡Victoria!" : "Fin del combate",
1220
1220
  " ",
1221
- /* @__PURE__ */ M("button", {
1221
+ /* @__PURE__ */ A("button", {
1222
1222
  onClick: () => {
1223
- Promise.resolve(s.getState().liveRematch?.(e)).catch(() => {});
1223
+ Promise.resolve(o.getState().liveRematch?.(e)).catch(() => {});
1224
1224
  },
1225
1225
  children: "Revancha"
1226
1226
  }),
1227
- be && /* @__PURE__ */ M("button", {
1227
+ be && /* @__PURE__ */ A("button", {
1228
1228
  onClick: () => {
1229
- Promise.resolve(s.getState().liveRematch?.(e, { newMap: !0 })).catch(() => {});
1229
+ Promise.resolve(o.getState().liveRematch?.(e, { newMap: !0 })).catch(() => {});
1230
1230
  },
1231
1231
  children: "Revancha en otro mapa 🎲"
1232
1232
  })
1233
1233
  ]
1234
1234
  }),
1235
- H && /* @__PURE__ */ N("details", {
1235
+ H && /* @__PURE__ */ j("details", {
1236
1236
  className: "tl-diagnostics",
1237
- children: [/* @__PURE__ */ M("summary", { children: "Diagnóstico de conexión" }), /* @__PURE__ */ M("pre", { children: JSON.stringify(te(p?.net), null, 2) })]
1237
+ children: [/* @__PURE__ */ A("summary", { children: "Diagnóstico de conexión" }), /* @__PURE__ */ A("pre", { children: JSON.stringify(v(p?.net), null, 2) })]
1238
1238
  }),
1239
- H && !Y && /* @__PURE__ */ M("button", {
1239
+ H && !Y && /* @__PURE__ */ A("button", {
1240
1240
  onClick: () => u.current?.resign(),
1241
1241
  children: "Rendirse"
1242
1242
  }),
1243
- o.pending && /* @__PURE__ */ M("p", {
1243
+ s.pending && /* @__PURE__ */ A("p", {
1244
1244
  role: "status",
1245
1245
  children: "Enviando…"
1246
1246
  }),
1247
- o.pendingEvent && o.error && /* @__PURE__ */ M("button", {
1247
+ s.pendingEvent && s.error && /* @__PURE__ */ A("button", {
1248
1248
  onClick: () => {
1249
- s.getState().retry(e).catch(() => {});
1249
+ o.getState().retry(e).catch(() => {});
1250
1250
  },
1251
1251
  children: "Reintentar envío"
1252
1252
  }),
1253
- m && /* @__PURE__ */ M("p", {
1253
+ y && /* @__PURE__ */ A("p", {
1254
1254
  role: "alert",
1255
- children: m
1255
+ children: y
1256
1256
  }),
1257
- o.error && /* @__PURE__ */ M("p", {
1257
+ s.error && /* @__PURE__ */ A("p", {
1258
1258
  role: "alert",
1259
- children: o.error
1259
+ children: s.error
1260
1260
  }),
1261
- !["closed", "declined"].includes(o.status) && /* @__PURE__ */ M("footer", {
1261
+ !["closed", "declined"].includes(s.status) && /* @__PURE__ */ A("footer", {
1262
1262
  className: "tl-footer",
1263
- children: /* @__PURE__ */ M("button", {
1263
+ children: /* @__PURE__ */ A("button", {
1264
1264
  onClick: () => Te(e, "game_end"),
1265
1265
  children: "Cerrar partida"
1266
1266
  })
@@ -1268,7 +1268,7 @@ function Ae({ gameKey: e, currentUserId: t, onMinimize: n, onDismiss: r, suspend
1268
1268
  ]
1269
1269
  });
1270
1270
  }
1271
- var je = C(Ae);
1272
- export { W as a, X as c, V as d, je as default, H as f, z as i, Y as l, F as n, B as o, G as p, L as r, me as s, we as t, _e as u };
1271
+ var je = w(Ae);
1272
+ export { W as a, X as c, V as d, je as default, H as f, B as i, Y as l, I as n, ue as o, G as p, R as r, me as s, we as t, _e as u };
1273
1273
 
1274
- //# sourceMappingURL=TanksLiveGameCard-D_27Jomp.js.map
1274
+ //# sourceMappingURL=TanksLiveGameCard-DXgd1J2Y.js.map