@minicode-dev/chat 0.1.13 → 0.1.15

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 (114) hide show
  1. package/CHANGELOG.md +112 -5
  2. package/README.md +401 -312
  3. package/assets/sounds/effects/avalanche.mp3 +0 -0
  4. package/assets/sounds/racing/car_boost.mp3 +0 -0
  5. package/assets/sounds/racing/car_boost.ogg +0 -0
  6. package/assets/sounds/racing/car_bump.mp3 +0 -0
  7. package/assets/sounds/racing/car_bump.ogg +0 -0
  8. package/assets/sounds/racing/car_drift_loop.mp3 +0 -0
  9. package/assets/sounds/racing/car_drift_loop.ogg +0 -0
  10. package/assets/sounds/racing/car_engine_loop.mp3 +0 -0
  11. package/assets/sounds/racing/car_engine_loop.ogg +0 -0
  12. package/assets/sounds/racing/car_engine_start.mp3 +0 -0
  13. package/assets/sounds/racing/car_engine_start.ogg +0 -0
  14. package/assets/sounds/racing/countdown_beep.mp3 +0 -0
  15. package/assets/sounds/racing/countdown_beep.ogg +0 -0
  16. package/assets/sounds/racing/countdown_go.mp3 +0 -0
  17. package/assets/sounds/racing/countdown_go.ogg +0 -0
  18. package/assets/sounds/racing/final_lap.mp3 +0 -0
  19. package/assets/sounds/racing/final_lap.ogg +0 -0
  20. package/assets/sounds/racing/finish_line.mp3 +0 -0
  21. package/assets/sounds/racing/finish_line.ogg +0 -0
  22. package/assets/sounds/racing/lap_complete.mp3 +0 -0
  23. package/assets/sounds/racing/lap_complete.ogg +0 -0
  24. package/assets/sounds/racing/music_circuit.mp3 +0 -0
  25. package/assets/sounds/racing/music_circuit.ogg +0 -0
  26. package/assets/sounds/racing/music_final_lap.mp3 +0 -0
  27. package/assets/sounds/racing/music_final_lap.ogg +0 -0
  28. package/assets/sounds/racing/race_defeat.mp3 +0 -0
  29. package/assets/sounds/racing/race_defeat.ogg +0 -0
  30. package/assets/sounds/racing/race_victory.mp3 +0 -0
  31. package/assets/sounds/racing/race_victory.ogg +0 -0
  32. package/assets/sounds/tanks/barrel_explode.mp3 +0 -0
  33. package/assets/sounds/tanks/barrel_explode.ogg +0 -0
  34. package/assets/sounds/tanks/crate_break.mp3 +0 -0
  35. package/assets/sounds/tanks/crate_break.ogg +0 -0
  36. package/assets/sounds/tanks/health_pickup.mp3 +0 -0
  37. package/assets/sounds/tanks/health_pickup.ogg +0 -0
  38. package/assets/sounds/tanks/last_life.mp3 +0 -0
  39. package/assets/sounds/tanks/last_life.ogg +0 -0
  40. package/assets/sounds/tanks/life_lost.mp3 +0 -0
  41. package/assets/sounds/tanks/life_lost.ogg +0 -0
  42. package/assets/sounds/tanks/respawn.mp3 +0 -0
  43. package/assets/sounds/tanks/respawn.ogg +0 -0
  44. package/assets/sounds/tanks/shield_end.mp3 +0 -0
  45. package/assets/sounds/tanks/shield_end.ogg +0 -0
  46. package/assets/sounds/tanks/shield_loop.mp3 +0 -0
  47. package/assets/sounds/tanks/shield_loop.ogg +0 -0
  48. package/assets/sounds/tanks/wall_hit.mp3 +0 -0
  49. package/assets/sounds/tanks/wall_hit.ogg +0 -0
  50. package/dist/chunks/{BattleshipGameCard-iRk8d4vR.js → BattleshipGameCard-8H-sBCsv.js} +146 -144
  51. package/dist/chunks/{BattleshipGameCard-iRk8d4vR.js.map → BattleshipGameCard-8H-sBCsv.js.map} +1 -1
  52. package/dist/chunks/{ChatContext-DjIEifGY.js → ChatContext-CVW58bzC.js} +2 -2
  53. package/dist/chunks/{ChatContext-DjIEifGY.js.map → ChatContext-CVW58bzC.js.map} +1 -1
  54. package/dist/chunks/RacingLiveGameCard-8j9QLnxW.js +1654 -0
  55. package/dist/chunks/RacingLiveGameCard-8j9QLnxW.js.map +1 -0
  56. package/dist/chunks/{TanksGameCard-GrqmdwJ7.js → TanksGameCard-DnCufSH6.js} +168 -166
  57. package/dist/chunks/{TanksGameCard-GrqmdwJ7.js.map → TanksGameCard-DnCufSH6.js.map} +1 -1
  58. package/dist/chunks/TanksLiveGameCard-D_27Jomp.js +1274 -0
  59. package/dist/chunks/TanksLiveGameCard-D_27Jomp.js.map +1 -0
  60. package/dist/chunks/avalancheScene3d-CIE2WKQn.js +1300 -0
  61. package/dist/chunks/avalancheScene3d-CIE2WKQn.js.map +1 -0
  62. package/dist/chunks/cars-D1PM7mVD.js +340 -0
  63. package/dist/chunks/cars-D1PM7mVD.js.map +1 -0
  64. package/dist/chunks/connect4Sounds-BqEHULjv.js +235 -0
  65. package/dist/chunks/connect4Sounds-BqEHULjv.js.map +1 -0
  66. package/dist/chunks/connectionStore-DwgIUl30.js +13 -0
  67. package/dist/chunks/connectionStore-DwgIUl30.js.map +1 -0
  68. package/dist/chunks/createLiveScene-MTGRv8rx.js +758 -0
  69. package/dist/chunks/createLiveScene-MTGRv8rx.js.map +1 -0
  70. package/dist/chunks/createRaceScene-BiEtQsVs.js +306 -0
  71. package/dist/chunks/createRaceScene-BiEtQsVs.js.map +1 -0
  72. package/dist/chunks/{createTankScene-6asWHKFf.js → createTankScene-yhX6la27.js} +125 -123
  73. package/dist/chunks/{createTankScene-6asWHKFf.js.map → createTankScene-yhX6la27.js.map} +1 -1
  74. package/dist/chunks/decor-CyyCnmct.js +418 -0
  75. package/dist/chunks/decor-CyyCnmct.js.map +1 -0
  76. package/dist/chunks/fx-1ZwzmPWj.js +458 -0
  77. package/dist/chunks/fx-1ZwzmPWj.js.map +1 -0
  78. package/dist/chunks/fx-DhXerGyt.js +248 -0
  79. package/dist/chunks/fx-DhXerGyt.js.map +1 -0
  80. package/dist/chunks/gameStatus-BChd29yI.js +62 -0
  81. package/dist/chunks/gameStatus-BChd29yI.js.map +1 -0
  82. package/dist/chunks/games-Bl_8raG6.js +3681 -0
  83. package/dist/chunks/games-Bl_8raG6.js.map +1 -0
  84. package/dist/chunks/rolldown-runtime-CGnMp29N.js +10 -0
  85. package/dist/chunks/tank-DjEQ4FXF.js +553 -0
  86. package/dist/chunks/tank-DjEQ4FXF.js.map +1 -0
  87. package/dist/chunks/tanks-live-BcKmrhnV.js +261 -0
  88. package/dist/chunks/tanks-live-BcKmrhnV.js.map +1 -0
  89. package/dist/chunks/{tanksSounds-CUNDIOal.js → tanksSounds-DTnidbiq.js} +44 -12
  90. package/dist/chunks/tanksSounds-DTnidbiq.js.map +1 -0
  91. package/dist/chunks/track-BcnnpnAm.js +259 -0
  92. package/dist/chunks/track-BcnnpnAm.js.map +1 -0
  93. package/dist/chunks/util-DwI9bfS7.js +57 -0
  94. package/dist/chunks/util-DwI9bfS7.js.map +1 -0
  95. package/dist/index.js +822 -635
  96. package/dist/index.js.map +1 -1
  97. package/dist/styles.css +1 -1
  98. package/index.d.ts +3 -1
  99. package/package.json +1 -1
  100. package/dist/chunks/TanksLiveGameCard-DSmQcUMh.js +0 -1225
  101. package/dist/chunks/TanksLiveGameCard-DSmQcUMh.js.map +0 -1
  102. package/dist/chunks/avalancheScene3d-Dnl2E3EA.js +0 -1878
  103. package/dist/chunks/avalancheScene3d-Dnl2E3EA.js.map +0 -1
  104. package/dist/chunks/connect4Sounds-Cv0q31VW.js +0 -3245
  105. package/dist/chunks/connect4Sounds-Cv0q31VW.js.map +0 -1
  106. package/dist/chunks/createLiveScene-819NWv84.js +0 -365
  107. package/dist/chunks/createLiveScene-819NWv84.js.map +0 -1
  108. package/dist/chunks/fx-BNJvJYOu.js +0 -871
  109. package/dist/chunks/fx-BNJvJYOu.js.map +0 -1
  110. package/dist/chunks/gameStatus-Cu1Z8un9.js +0 -69
  111. package/dist/chunks/gameStatus-Cu1Z8un9.js.map +0 -1
  112. package/dist/chunks/tank-DIn6Jyt8.js +0 -605
  113. package/dist/chunks/tank-DIn6Jyt8.js.map +0 -1
  114. package/dist/chunks/tanksSounds-CUNDIOal.js.map +0 -1
@@ -1,8 +1,10 @@
1
- import { _ as e, d as t, f as n, g as r, h as i, m as a, o, p as s, v as c, y as l } from "./connect4Sounds-Cv0q31VW.js";
2
- import { t as u } from "./ChatContext-DjIEifGY.js";
3
- import { c as d, f, l as p, t as m } from "./gameStatus-Cu1Z8un9.js";
1
+ import { a as e, c as t, d as n, f as r, l as i, o as a, p as o, s, u as c } from "./games-Bl_8raG6.js";
2
+ import { t as l } from "./ChatContext-CVW58bzC.js";
3
+ import { r as u } from "./connectionStore-DwgIUl30.js";
4
+ import { c as d, l as f, t as p } from "./gameStatus-BChd29yI.js";
5
+ import { o as m } from "./connect4Sounds-BqEHULjv.js";
4
6
  import { t as h } from "./webglSupport-2WjPEPZ_.js";
5
- import { a as g, i as _, n as v, o as y, r as b, t as ee } from "./tanksSounds-CUNDIOal.js";
7
+ import { l as g, n as _, o as v, r as y, s as b, t as ee } from "./tanksSounds-DTnidbiq.js";
6
8
  import { memo as x, useCallback as S, useContext as C, useEffect as w, useRef as T, useState as E, useSyncExternalStore as D } from "react";
7
9
  import { ChevronDown as te, Crosshair as O, Flag as ne, Layers as k, RotateCcw as re, Swords as ie, Video as A, Wind as ae, X as oe } from "lucide-react";
8
10
  import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
@@ -10,49 +12,49 @@ import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
10
12
  var P = 2500;
11
13
  function se(e) {
12
14
  let t = new Float32Array(e.length);
13
- for (let n = 0; n < e.length; n += 1) t[n] = e[n] / l;
15
+ for (let n = 0; n < e.length; n += 1) t[n] = e[n] / o;
14
16
  return t;
15
17
  }
16
18
  function F(e) {
17
19
  return {
18
- x: e.x * P / l,
19
- z: e.z * P / l
20
+ x: e.x * P / o,
21
+ z: e.z * P / o
20
22
  };
21
23
  }
22
24
  function ce(e) {
23
25
  let t = new Float32Array(e.heights.length);
24
- for (let n = 0; n < t.length; n += 1) t[n] = e.heights[n] / l;
26
+ for (let n = 0; n < t.length; n += 1) t[n] = e.heights[n] / o;
25
27
  return {
26
- size: c / l,
28
+ size: r / o,
27
29
  grid: 81,
28
30
  heights: t,
29
31
  obstacles: e.obstacles.map((e) => ({
30
32
  id: e.id,
31
33
  kind: e.kind,
32
- x: e.x / l,
33
- z: e.z / l,
34
- y: e.y / l,
35
- w: e.w / l,
36
- d: e.d / l,
37
- h: e.h / l
34
+ x: e.x / o,
35
+ z: e.z / o,
36
+ y: e.y / o,
37
+ w: e.w / o,
38
+ d: e.d / o,
39
+ h: e.h / o
38
40
  })),
39
41
  decor: e.decor.map((e) => ({
40
42
  id: e.id,
41
43
  kind: e.kind,
42
- x: e.x / l,
43
- z: e.z / l,
44
+ x: e.x / o,
45
+ z: e.z / o,
44
46
  scale: e.scale / 100
45
47
  })),
46
48
  tanks: e.tanks.map((e) => ({
47
49
  id: e.id,
48
- x: e.x / l,
49
- y: e.y / l,
50
- z: e.z / l,
50
+ x: e.x / o,
51
+ y: e.y / o,
52
+ z: e.z / o,
51
53
  hullYaw: e.hullYaw,
52
54
  yaw: e.yaw,
53
55
  pitch: e.pitch,
54
56
  hp: e.hp,
55
- fuel: e.fuel / l,
57
+ fuel: e.fuel / o,
56
58
  ammo: { ...e.ammo },
57
59
  alive: e.hp > 0
58
60
  })),
@@ -60,22 +62,22 @@ function ce(e) {
60
62
  turnPlayerId: e.phase === "playing" ? e.players[e.turnIndex] : null
61
63
  };
62
64
  }
63
- function I(t, n, { yaw: o, pitch: c, power: l, ammo: u, maxTicks: d = 600 } = {}) {
64
- let f = t.players.indexOf(n);
65
+ function I(e, r, { yaw: a, pitch: o, power: l, ammo: u, maxTicks: d = 600 } = {}) {
66
+ let f = e.players.indexOf(r);
65
67
  return f >= 0 && [
66
- [o, e.yaw],
67
- [c, e.pitch],
68
- [l, e.power]
69
- ].every(([e, [t, n]]) => Number.isInteger(e) && e >= t && e <= n) && typeof u == "string" && Object.hasOwn(r, u) ? se(a(s(t.tanks[f], {
70
- yaw: o,
71
- pitch: c,
68
+ [a, n.yaw],
69
+ [o, n.pitch],
70
+ [l, n.power]
71
+ ].every(([e, [t, n]]) => Number.isInteger(e) && e >= t && e <= n) && typeof u == "string" && Object.hasOwn(c, u) ? se(t(s(e.tanks[f], {
72
+ yaw: a,
73
+ pitch: o,
72
74
  power: l,
73
75
  ammo: u
74
76
  }), {
75
- wind: i(t.seed, t.ply),
76
- heights: t.heights,
77
- tanks: t.tanks,
78
- obstacles: t.obstacles,
77
+ wind: i(e.seed, e.ply),
78
+ heights: e.heights,
79
+ tanks: e.tanks,
80
+ obstacles: e.obstacles,
79
81
  maxTicks: d
80
82
  }).samples) : /* @__PURE__ */ new Float32Array();
81
83
  }
@@ -93,9 +95,9 @@ function R(e) {
93
95
  };
94
96
  }
95
97
  var ue = (e) => ({
96
- x: e.x / l,
97
- y: e.y / l,
98
- z: e.z / l
98
+ x: e.x / o,
99
+ y: e.y / o,
100
+ z: e.z / o
99
101
  });
100
102
  function de(e, t) {
101
103
  let n = e.logic?.lastTurn;
@@ -116,13 +118,13 @@ function de(e, t) {
116
118
  kind: e.impact.kind,
117
119
  tankId: e.impact.tankId
118
120
  },
119
- radius: e.radius / l
121
+ radius: e.radius / o
120
122
  })),
121
123
  craters: n.craters.map((e) => ({
122
- x: e.x / l,
123
- z: e.z / l,
124
- radius: e.radius / l,
125
- depth: e.depth / l
124
+ x: e.x / o,
125
+ z: e.z / o,
126
+ radius: e.radius / o,
127
+ depth: e.depth / o
126
128
  })),
127
129
  damage: { ...n.damage },
128
130
  destroyed: e.logic.tanks.filter((e) => e.hp === 0 && (r.find((t) => t.id === e.id)?.hp ?? 1) > 0).map((e) => e.id),
@@ -855,14 +857,14 @@ var Z = 60, Me = 6e4, Ne = {
855
857
  cluster: "Racimo"
856
858
  }, Q = (e, [t, n]) => Math.max(t, Math.min(n, Math.round(e))), Pe = (e) => (Math.round(e) % 360 + 360) % 360, Fe = () => typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
857
859
  function Ie() {
858
- let e = C(u)?.transport ?? null, t = S((t) => {
860
+ let e = C(l)?.transport ?? null, t = S((t) => {
859
861
  let n = e?.onStatus?.(t);
860
862
  return typeof n == "function" ? n : () => {};
861
863
  }, [e]), n = D(t, () => e?.getStatus?.() ?? null, () => null);
862
- return f() === "connected" || n === "connected";
864
+ return u() === "connected" || n === "connected";
863
865
  }
864
- function Le(e, ...n) {
865
- return Promise.resolve(t.getState()[e]?.(...n)).catch((e) => {
866
+ function Le(t, ...n) {
867
+ return Promise.resolve(e.getState()[t]?.(...n)).catch((e) => {
866
868
  throw e;
867
869
  });
868
870
  }
@@ -938,7 +940,7 @@ function Be(e, t, n, r) {
938
940
  o("none");
939
941
  }
940
942
  };
941
- return o("loading"), u || !h() ? f() : import("./createTankScene-6asWHKFf.js").then(({ createTankScene: e }) => {
943
+ return o("loading"), u || !h() ? f() : import("./createTankScene-yhX6la27.js").then(({ createTankScene: e }) => {
942
944
  if (!r) try {
943
945
  d(e(n, s), "3d");
944
946
  } catch {
@@ -951,7 +953,7 @@ function Be(e, t, n, r) {
951
953
  try {
952
954
  a?.dispose();
953
955
  } catch {}
954
- i.current = null, g();
956
+ i.current = null, b();
955
957
  };
956
958
  }, [
957
959
  e,
@@ -986,7 +988,7 @@ function Ve({ game: e, currentUserId: t }) {
986
988
  /* @__PURE__ */ M("p", {
987
989
  className: "chat-game-status",
988
990
  role: "status",
989
- children: m(e, t)
991
+ children: p(e, t)
990
992
  }),
991
993
  e.logic && /* @__PURE__ */ N("p", {
992
994
  className: "tk-history-score",
@@ -1001,18 +1003,18 @@ function Ve({ game: e, currentUserId: t }) {
1001
1003
  ]
1002
1004
  });
1003
1005
  }
1004
- function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c, onDismiss: l }) {
1005
- let u = Ie(), f = T(null), [h, g] = E(!1), [x, S] = E(null), [C, D] = E(!1), [P, se] = E("overview"), [F, ce] = E(""), [I, L] = E(!1), [ue, me] = E(() => Date.now()), he = T("init"), ge = T(0), z = [
1006
+ function He({ game: e, gameKey: t, currentUserId: r, variant: i, onMinimize: o, onDismiss: s }) {
1007
+ let l = Ie(), u = T(null), [h, b] = E(!1), [x, S] = E(null), [C, D] = E(!1), [P, se] = E("overview"), [F, ce] = E(""), [I, L] = E(!1), [ue, me] = E(() => Date.now()), he = T("init"), ge = T(0), z = [
1006
1008
  "active",
1007
1009
  "won",
1008
1010
  "draw",
1009
1011
  "conflict",
1010
1012
  "closed"
1011
- ].includes(t.status) && !!t.logic, { sceneRef: B, mode: V, use2d: _e } = Be(f, z, h, (e) => v(e, `${he.current}:${e.type}:${ge.current += 1}`)), H = String(a ?? t.ownId), ve = t.logic?.players ?? [t.hostId, t.guestId], U = ve.indexOf(H), W = p(H, t.guestId), G = U >= 0, K = d(t), q = n(t) && !C, J = (e, ...t) => {
1013
+ ].includes(e.status) && !!e.logic, { sceneRef: B, mode: V, use2d: _e } = Be(u, z, h, (e) => _(e, `${he.current}:${e.type}:${ge.current += 1}`)), H = String(r ?? e.ownId), ve = e.logic?.players ?? [e.hostId, e.guestId], U = ve.indexOf(H), W = f(H, e.guestId), G = U >= 0, K = d(e), q = a(e) && !C, J = (e, ...t) => {
1012
1014
  ce(""), Le(e, ...t).catch((e) => ce(e?.message || "No se pudo enviar."));
1013
1015
  };
1014
1016
  w(() => {
1015
- _();
1017
+ v();
1016
1018
  }, []);
1017
1019
  let Y = T({
1018
1020
  eventId: void 0,
@@ -1020,77 +1022,77 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1020
1022
  scene: null
1021
1023
  }), ye = T(Promise.resolve());
1022
1024
  w(() => {
1023
- let e = B.current;
1024
- if (!e || !t.logic) return;
1025
- let n = Y.current, r = t.lastAction?.eventId ?? null;
1026
- if (n.scene !== e) {
1025
+ let t = B.current;
1026
+ if (!t || !e.logic) return;
1027
+ let n = Y.current, r = e.lastAction?.eventId ?? null;
1028
+ if (n.scene !== t) {
1027
1029
  Y.current = {
1028
1030
  eventId: r,
1029
- logic: t.logic,
1030
- scene: e
1031
- }, e.setWorld(R(t));
1031
+ logic: e.logic,
1032
+ scene: t
1033
+ }, t.setWorld(R(e));
1032
1034
  return;
1033
1035
  }
1034
- if (n.logic === t.logic) return;
1035
- let i = n.logic, a = r !== n.eventId && t.lastAction?.entry?.[0] === 1;
1036
+ if (n.logic === e.logic) return;
1037
+ let i = n.logic, a = r !== n.eventId && e.lastAction?.entry?.[0] === 1;
1036
1038
  Y.current = {
1037
1039
  eventId: r,
1038
- logic: t.logic,
1039
- scene: e
1040
+ logic: e.logic,
1041
+ scene: t
1040
1042
  };
1041
- let o = a ? de(t, i) : null, s = R(t);
1043
+ let o = a ? de(e, i) : null, s = R(e);
1042
1044
  ye.current = ye.current.then(async () => {
1043
- if (B.current === e) {
1044
- if (!o) e.setWorld(s);
1045
+ if (B.current === t) {
1046
+ if (!o) t.setWorld(s);
1045
1047
  else {
1046
- he.current = r, o.destroyed.length && y("big_explosion", 15e3), D(!0), se("overview");
1048
+ he.current = r, o.destroyed.length && g("big_explosion", 15e3), D(!0), se("overview");
1047
1049
  try {
1048
- await e.playTurn(o);
1050
+ await t.playTurn(o);
1049
1051
  } catch {
1050
- e.setWorld(s);
1052
+ t.setWorld(s);
1051
1053
  }
1052
- B.current === e && D(!1);
1054
+ B.current === t && D(!1);
1053
1055
  }
1054
1056
  }
1055
1057
  });
1056
1058
  }, [
1057
- t,
1059
+ e,
1058
1060
  V,
1059
1061
  B
1060
1062
  ]);
1061
1063
  let be = T(K);
1062
1064
  w(() => {
1063
- !be.current && ["won", "draw"].includes(t.status) && ye.current.then(() => {
1064
- B.current?.celebrate?.(t.winnerId ?? null), G && b(p(t.winnerId, H) ? "victory" : "defeat", `${t.gameId}:end`);
1065
+ !be.current && ["won", "draw"].includes(e.status) && ye.current.then(() => {
1066
+ B.current?.celebrate?.(e.winnerId ?? null), G && y(f(e.winnerId, H) ? "victory" : "defeat", `${e.gameId}:end`);
1065
1067
  });
1066
1068
  }, [
1067
- t.status,
1068
- t.winnerId,
1069
- t.gameId,
1069
+ e.status,
1070
+ e.winnerId,
1071
+ e.gameId,
1070
1072
  H,
1071
1073
  G,
1072
1074
  B
1073
1075
  ]), w(() => {
1074
- if (!n(t) || !t.logic) {
1076
+ if (!a(e) || !e.logic) {
1075
1077
  S(null);
1076
1078
  return;
1077
1079
  }
1078
- let e = t.logic.tanks[U], r = t.logic.tanks[1 - U];
1080
+ let t = e.logic.tanks[U], n = e.logic.tanks[1 - U];
1079
1081
  S({
1080
1082
  move: 0,
1081
- yaw: pe(e, r),
1083
+ yaw: pe(t, n),
1082
1084
  pitch: 45,
1083
1085
  power: 60,
1084
1086
  ammo: "standard"
1085
1087
  });
1086
1088
  }, [
1087
- t.ply,
1088
- t.status,
1089
- t.pendingEvent,
1089
+ e.ply,
1090
+ e.status,
1091
+ e.pendingEvent,
1090
1092
  U
1091
1093
  ]), w(() => {
1092
- let e = B.current;
1093
- e && t.logic && (!x || !q ? e.setPreview(null) : (e.setAim(x), e.setPreview(fe(t, H, x))));
1094
+ let t = B.current;
1095
+ t && e.logic && (!x || !q ? t.setPreview(null) : (t.setAim(x), t.setPreview(fe(e, H, x))));
1094
1096
  }, [
1095
1097
  x,
1096
1098
  q,
@@ -1106,28 +1108,28 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1106
1108
  ply: -1,
1107
1109
  at: 0
1108
1110
  });
1109
- !C && t.status === "active" && xe.current.ply !== t.ply && (xe.current = {
1110
- ply: t.ply,
1111
+ !C && e.status === "active" && xe.current.ply !== e.ply && (xe.current = {
1112
+ ply: e.ply,
1111
1113
  at: Date.now()
1112
1114
  }), w(() => {
1113
- if (t.status !== "active" && t.status !== "invited") return;
1114
- let e = setInterval(() => me(Date.now()), 1e3);
1115
- return () => clearInterval(e);
1116
- }, [t.status]);
1115
+ if (e.status !== "active" && e.status !== "invited") return;
1116
+ let t = setInterval(() => me(Date.now()), 1e3);
1117
+ return () => clearInterval(t);
1118
+ }, [e.status]);
1117
1119
  let Se = Math.max(0, Z - Math.floor((ue - xe.current.at) / 1e3)), Ce = T(-1);
1118
1120
  w(() => {
1119
- !q || Se > 0 || Ce.current === t.ply || document.visibilityState !== "visible" || (Ce.current = t.ply, J("tkSkip", i));
1121
+ !q || Se > 0 || Ce.current === e.ply || document.visibilityState !== "visible" || (Ce.current = e.ply, J("tkSkip", t));
1120
1122
  }, [
1121
1123
  q,
1122
1124
  Se,
1123
- t.ply,
1124
- i
1125
+ e.ply,
1126
+ t
1125
1127
  ]);
1126
1128
  let X = (e) => S((t) => t && {
1127
1129
  ...t,
1128
1130
  ...e
1129
1131
  }), we = () => {
1130
- q && x && u && J("tkTurn", i, x);
1132
+ q && x && l && J("tkTurn", t, x);
1131
1133
  }, Te = T(null), Ee = (e) => {
1132
1134
  q && x && (Te.current = {
1133
1135
  x: e.clientX,
@@ -1135,38 +1137,38 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1135
1137
  yaw: x.yaw,
1136
1138
  pitch: x.pitch
1137
1139
  }, e.currentTarget.setPointerCapture?.(e.pointerId));
1138
- }, De = (t) => {
1140
+ }, De = (e) => {
1139
1141
  if (!Te.current) return;
1140
- let n = Te.current;
1142
+ let t = Te.current;
1141
1143
  X({
1142
- yaw: Pe(n.yaw - (t.clientX - n.x) * .4),
1143
- pitch: Q(n.pitch - (t.clientY - n.y) * .25, e.pitch)
1144
+ yaw: Pe(t.yaw - (e.clientX - t.x) * .4),
1145
+ pitch: Q(t.pitch - (e.clientY - t.y) * .25, n.pitch)
1144
1146
  });
1145
1147
  }, Oe = () => {
1146
1148
  Te.current = null;
1147
- }, ke = (t) => {
1149
+ }, ke = (e) => {
1148
1150
  if (!q || !x) return;
1149
- let n = t.shiftKey ? 10 : 2, r = {
1150
- ArrowLeft: () => X({ yaw: Pe(x.yaw + n) }),
1151
- ArrowRight: () => X({ yaw: Pe(x.yaw - n) }),
1152
- ArrowUp: () => X({ pitch: Q(x.pitch + 1, e.pitch) }),
1153
- ArrowDown: () => X({ pitch: Q(x.pitch - 1, e.pitch) }),
1154
- "+": () => X({ power: Q(x.power + 2, e.power) }),
1155
- "=": () => X({ power: Q(x.power + 2, e.power) }),
1156
- "-": () => X({ power: Q(x.power - 2, e.power) }),
1151
+ let t = e.shiftKey ? 10 : 2, r = {
1152
+ ArrowLeft: () => X({ yaw: Pe(x.yaw + t) }),
1153
+ ArrowRight: () => X({ yaw: Pe(x.yaw - t) }),
1154
+ ArrowUp: () => X({ pitch: Q(x.pitch + 1, n.pitch) }),
1155
+ ArrowDown: () => X({ pitch: Q(x.pitch - 1, n.pitch) }),
1156
+ "+": () => X({ power: Q(x.power + 2, n.power) }),
1157
+ "=": () => X({ power: Q(x.power + 2, n.power) }),
1158
+ "-": () => X({ power: Q(x.power - 2, n.power) }),
1157
1159
  Enter: we,
1158
1160
  " ": we
1159
- }[t.key];
1160
- r && (t.preventDefault(), r());
1161
- }, Ae = ve[1 - U] ?? (W ? t.hostId : t.guestId), je = () => J("invite", {
1162
- roomId: t.roomId,
1161
+ }[e.key];
1162
+ r && (e.preventDefault(), r());
1163
+ }, Ae = ve[1 - U] ?? (W ? e.hostId : e.guestId), je = () => J("invite", {
1164
+ roomId: e.roomId,
1163
1165
  opponentId: Ae,
1164
1166
  gameType: "tanks",
1165
- firstPlayerId: t.firstPlayerId === t.hostId ? t.guestId : t.hostId,
1166
- rematchOf: t.gameId
1167
- }), Fe = !u && !K ? "Sin conexión · esperando reconexión" : t.pending ? "Enviando…" : m(t, a), Ve = t.logic?.tanks ?? [], He = Ve[U], $ = t.logic ? R(t).wind : null, Ue = $ ? Math.hypot($.x, $.z) : 0, We = $ ? Math.round(Math.atan2($.z, $.x) * 180 / Math.PI) : 0, Ge = t.status === "invited" && !W && Date.now() - Date.parse(t.createdAt) > Me;
1167
+ firstPlayerId: e.firstPlayerId === e.hostId ? e.guestId : e.hostId,
1168
+ rematchOf: e.gameId
1169
+ }), Fe = !l && !K ? "Sin conexión · esperando reconexión" : e.pending ? "Enviando…" : p(e, r), Ve = e.logic?.tanks ?? [], He = Ve[U], $ = e.logic ? R(e).wind : null, Ue = $ ? Math.hypot($.x, $.z) : 0, We = $ ? Math.round(Math.atan2($.z, $.x) * 180 / Math.PI) : 0, Ge = e.status === "invited" && !W && Date.now() - Date.parse(e.createdAt) > Me;
1168
1170
  return /* @__PURE__ */ N("section", {
1169
- className: `chat-game-card tk-card${q ? " chat-game-card--my-turn" : ""}${s ? ` chat-game-card--${s}` : ""}`,
1171
+ className: `chat-game-card tk-card${q ? " chat-game-card--my-turn" : ""}${i ? ` chat-game-card--${i}` : ""}`,
1170
1172
  "aria-label": "Partida de Tanques de guerra",
1171
1173
  children: [
1172
1174
  /* @__PURE__ */ N("header", {
@@ -1182,13 +1184,13 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1182
1184
  "aria-hidden": "true"
1183
1185
  })] })]
1184
1186
  }),
1185
- s === "panel" && /* @__PURE__ */ M(o, { manager: ee() }),
1186
- c && /* @__PURE__ */ M("button", {
1187
+ i === "panel" && /* @__PURE__ */ M(m, { manager: ee() }),
1188
+ o && /* @__PURE__ */ M("button", {
1187
1189
  className: "chat-game-close",
1188
1190
  type: "button",
1189
1191
  "aria-label": "Minimizar tablero",
1190
1192
  title: "Minimizar tablero",
1191
- onClick: c,
1193
+ onClick: o,
1192
1194
  children: /* @__PURE__ */ M(te, {
1193
1195
  size: 16,
1194
1196
  "aria-hidden": "true"
@@ -1199,19 +1201,19 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1199
1201
  type: "button",
1200
1202
  "aria-label": "Finalizar partida para ambos jugadores",
1201
1203
  title: "Finalizar partida para ambos",
1202
- disabled: !u,
1203
- onClick: () => J("act", i, "game_end"),
1204
+ disabled: !l,
1205
+ onClick: () => J("act", t, "game_end"),
1204
1206
  children: /* @__PURE__ */ M(oe, {
1205
1207
  size: 16,
1206
1208
  "aria-hidden": "true"
1207
1209
  })
1208
1210
  }),
1209
- l && /* @__PURE__ */ M("button", {
1211
+ s && /* @__PURE__ */ M("button", {
1210
1212
  className: "chat-game-close",
1211
1213
  type: "button",
1212
1214
  "aria-label": "Cerrar tablero y volver al chat",
1213
1215
  title: "Cerrar tablero",
1214
- onClick: l,
1216
+ onClick: s,
1215
1217
  children: /* @__PURE__ */ M(oe, {
1216
1218
  size: 16,
1217
1219
  "aria-hidden": "true"
@@ -1224,7 +1226,7 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1224
1226
  role: "status",
1225
1227
  children: Fe
1226
1228
  }),
1227
- t.status === "invited" && /* @__PURE__ */ N("div", {
1229
+ e.status === "invited" && /* @__PURE__ */ N("div", {
1228
1230
  className: "tk-invite",
1229
1231
  children: [
1230
1232
  /* @__PURE__ */ M("p", { children: "Duelo de artillería por turnos: mueve tu tanque, apunta la torreta, elige la potencia y destruye al rival. 100 HP cada uno." }),
@@ -1233,14 +1235,14 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1233
1235
  children: [/* @__PURE__ */ M("button", {
1234
1236
  type: "button",
1235
1237
  className: "chat-game-action chat-game-action--primary",
1236
- disabled: !u || t.pending,
1237
- onClick: () => J("act", i, "game_accept"),
1238
+ disabled: !l || e.pending,
1239
+ onClick: () => J("act", t, "game_accept"),
1238
1240
  children: "Aceptar duelo"
1239
1241
  }), /* @__PURE__ */ M("button", {
1240
1242
  type: "button",
1241
1243
  className: "chat-game-action",
1242
- disabled: !u || t.pending,
1243
- onClick: () => J("act", i, "game_decline"),
1244
+ disabled: !l || e.pending,
1245
+ onClick: () => J("act", t, "game_decline"),
1244
1246
  children: "Rechazar"
1245
1247
  })]
1246
1248
  }),
@@ -1254,7 +1256,7 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1254
1256
  className: "tk-stage-wrap",
1255
1257
  children: [
1256
1258
  /* @__PURE__ */ M("div", {
1257
- ref: f,
1259
+ ref: u,
1258
1260
  className: `tk-stage${q ? " is-aiming" : ""}`,
1259
1261
  tabIndex: 0,
1260
1262
  role: "application",
@@ -1282,13 +1284,13 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1282
1284
  label: U === 0 ? "Tú" : "Verde",
1283
1285
  hp: Ve[0]?.hp ?? 100,
1284
1286
  color: le[0],
1285
- active: t.turnId === ve[0]
1287
+ active: e.turnId === ve[0]
1286
1288
  }),
1287
1289
  /* @__PURE__ */ M(ze, {
1288
1290
  label: U === 1 ? "Tú" : "Rojo",
1289
1291
  hp: Ve[1]?.hp ?? 100,
1290
1292
  color: le[1],
1291
- active: t.turnId === ve[1]
1293
+ active: e.turnId === ve[1]
1292
1294
  }),
1293
1295
  /* @__PURE__ */ N("div", {
1294
1296
  className: "tk-hud-meta",
@@ -1310,13 +1312,13 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1310
1312
  " m/s²"
1311
1313
  ]
1312
1314
  }),
1313
- t.logic && /* @__PURE__ */ N("span", { children: [
1315
+ e.logic && /* @__PURE__ */ N("span", { children: [
1314
1316
  "Disparo ",
1315
- Math.min(t.logic.shots + 1, t.logic.maxShots),
1317
+ Math.min(e.logic.shots + 1, e.logic.maxShots),
1316
1318
  "/",
1317
- t.logic.maxShots
1319
+ e.logic.maxShots
1318
1320
  ] }),
1319
- t.status === "active" && !C && /* @__PURE__ */ N("span", {
1321
+ e.status === "active" && !C && /* @__PURE__ */ N("span", {
1320
1322
  className: Se <= 10 ? "tk-timer is-low" : "tk-timer",
1321
1323
  children: [Se, "s"]
1322
1324
  })
@@ -1340,7 +1342,7 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1340
1342
  type: "button",
1341
1343
  className: "chat-game-action",
1342
1344
  "aria-pressed": _e,
1343
- onClick: () => g(!_e),
1345
+ onClick: () => b(!_e),
1344
1346
  title: "Cambiar vista",
1345
1347
  children: [/* @__PURE__ */ M(k, {
1346
1348
  size: 14,
@@ -1367,8 +1369,8 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1367
1369
  ] })
1368
1370
  ] }), /* @__PURE__ */ M("input", {
1369
1371
  type: "range",
1370
- min: e.move[0],
1371
- max: e.move[1],
1372
+ min: n.move[0],
1373
+ max: n.move[1],
1372
1374
  value: x.move,
1373
1375
  onChange: (e) => X({ move: Number(e.target.value) }),
1374
1376
  "aria-valuetext": `${(x.move * .5).toFixed(1)} metros`
@@ -1378,8 +1380,8 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1378
1380
  className: "tk-control",
1379
1381
  children: [/* @__PURE__ */ N("span", { children: ["Torreta ", /* @__PURE__ */ N("strong", { children: [x.yaw, "°"] })] }), /* @__PURE__ */ M("input", {
1380
1382
  type: "range",
1381
- min: e.yaw[0],
1382
- max: e.yaw[1],
1383
+ min: n.yaw[0],
1384
+ max: n.yaw[1],
1383
1385
  value: x.yaw,
1384
1386
  onChange: (e) => X({ yaw: Number(e.target.value) }),
1385
1387
  "aria-valuetext": `${x.yaw} grados`
@@ -1389,8 +1391,8 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1389
1391
  className: "tk-control",
1390
1392
  children: [/* @__PURE__ */ N("span", { children: ["Elevación ", /* @__PURE__ */ N("strong", { children: [x.pitch, "°"] })] }), /* @__PURE__ */ M("input", {
1391
1393
  type: "range",
1392
- min: e.pitch[0],
1393
- max: e.pitch[1],
1394
+ min: n.pitch[0],
1395
+ max: n.pitch[1],
1394
1396
  value: x.pitch,
1395
1397
  onChange: (e) => X({ pitch: Number(e.target.value) }),
1396
1398
  "aria-valuetext": `${x.pitch} grados`
@@ -1400,8 +1402,8 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1400
1402
  className: "tk-control",
1401
1403
  children: [/* @__PURE__ */ N("span", { children: ["Potencia ", /* @__PURE__ */ M("strong", { children: x.power })] }), /* @__PURE__ */ M("input", {
1402
1404
  type: "range",
1403
- min: e.power[0],
1404
- max: e.power[1],
1405
+ min: n.power[0],
1406
+ max: n.power[1],
1405
1407
  value: x.power,
1406
1408
  onChange: (e) => X({ power: Number(e.target.value) }),
1407
1409
  "aria-valuetext": `Potencia ${x.power}`
@@ -1411,8 +1413,8 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1411
1413
  className: "tk-ammo",
1412
1414
  role: "radiogroup",
1413
1415
  "aria-label": "Munición",
1414
- children: Object.keys(r).map((e) => {
1415
- let t = r[e].cost === 0 ? "∞" : He.ammo[e] ?? 0;
1416
+ children: Object.keys(c).map((e) => {
1417
+ let t = c[e].cost === 0 ? "∞" : He.ammo[e] ?? 0;
1416
1418
  return /* @__PURE__ */ N("button", {
1417
1419
  type: "button",
1418
1420
  role: "radio",
@@ -1431,7 +1433,7 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1431
1433
  /* @__PURE__ */ N("button", {
1432
1434
  type: "button",
1433
1435
  className: "tk-fire",
1434
- disabled: !u || t.pending,
1436
+ disabled: !l || e.pending,
1435
1437
  onClick: we,
1436
1438
  children: [/* @__PURE__ */ M(O, {
1437
1439
  size: 18,
@@ -1440,43 +1442,43 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1440
1442
  })
1441
1443
  ]
1442
1444
  }),
1443
- t.status === "conflict" && /* @__PURE__ */ N(j, { children: [t.error && /* @__PURE__ */ M("p", {
1445
+ e.status === "conflict" && /* @__PURE__ */ N(j, { children: [e.error && /* @__PURE__ */ M("p", {
1444
1446
  className: "chat-game-error",
1445
1447
  role: "alert",
1446
- children: t.error
1448
+ children: e.error
1447
1449
  }), /* @__PURE__ */ M(Re, {
1448
- sync: t.sync,
1449
- connected: u,
1450
- onResync: () => J("requestResync", i),
1451
- onAdoptOffer: () => J("adoptResyncOffer", i)
1450
+ sync: e.sync,
1451
+ connected: l,
1452
+ onResync: () => J("requestResync", t),
1453
+ onAdoptOffer: () => J("adoptResyncOffer", t)
1452
1454
  })] }),
1453
- t.status !== "conflict" && t.error && /* @__PURE__ */ M("p", {
1455
+ e.status !== "conflict" && e.error && /* @__PURE__ */ M("p", {
1454
1456
  className: "chat-game-error",
1455
1457
  role: "alert",
1456
- children: t.error
1458
+ children: e.error
1457
1459
  }),
1458
1460
  F && /* @__PURE__ */ M("p", {
1459
1461
  className: "chat-game-error",
1460
1462
  role: "alert",
1461
1463
  children: F
1462
1464
  }),
1463
- t.pendingEvent && !t.pending && /* @__PURE__ */ M("div", {
1465
+ e.pendingEvent && !e.pending && /* @__PURE__ */ M("div", {
1464
1466
  className: "chat-game-actions",
1465
1467
  children: /* @__PURE__ */ M("button", {
1466
1468
  type: "button",
1467
1469
  className: "chat-game-action chat-game-action--primary",
1468
- disabled: !u,
1469
- onClick: () => J("retry", i),
1470
+ disabled: !l,
1471
+ onClick: () => J("retry", t),
1470
1472
  children: "Reintentar envío"
1471
1473
  })
1472
1474
  }),
1473
- t.status === "active" && G && /* @__PURE__ */ M("div", {
1475
+ e.status === "active" && G && /* @__PURE__ */ M("div", {
1474
1476
  className: "chat-game-actions tk-secondary",
1475
1477
  children: I ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("button", {
1476
1478
  type: "button",
1477
1479
  className: "chat-game-action chat-game-action--danger",
1478
1480
  onClick: () => {
1479
- L(!1), J("tkResign", i);
1481
+ L(!1), J("tkResign", t);
1480
1482
  },
1481
1483
  children: "Confirmar rendición"
1482
1484
  }), /* @__PURE__ */ M("button", {
@@ -1487,7 +1489,7 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1487
1489
  })] }) : /* @__PURE__ */ N("button", {
1488
1490
  type: "button",
1489
1491
  className: "chat-game-action",
1490
- disabled: !u || !!t.pendingEvent,
1492
+ disabled: !l || !!e.pendingEvent,
1491
1493
  onClick: () => L(!0),
1492
1494
  children: [/* @__PURE__ */ M(ne, {
1493
1495
  size: 14,
@@ -1499,12 +1501,12 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1499
1501
  "won",
1500
1502
  "draw",
1501
1503
  "closed"
1502
- ].includes(t.status) && G && /* @__PURE__ */ M("div", {
1504
+ ].includes(e.status) && G && /* @__PURE__ */ M("div", {
1503
1505
  className: "chat-game-actions",
1504
1506
  children: /* @__PURE__ */ N("button", {
1505
1507
  type: "button",
1506
1508
  className: "chat-game-action chat-game-action--primary",
1507
- disabled: !u,
1509
+ disabled: !l,
1508
1510
  onClick: je,
1509
1511
  children: [/* @__PURE__ */ M(re, {
1510
1512
  size: 14,
@@ -1515,14 +1517,14 @@ function He({ game: t, gameKey: i, currentUserId: a, variant: s, onMinimize: c,
1515
1517
  ]
1516
1518
  });
1517
1519
  }
1518
- function $({ gameKey: e, currentUserId: n, variant: r = "panel", onMinimize: i, onDismiss: a }) {
1519
- let o = t((t) => t.games[e]);
1520
+ function $({ gameKey: t, currentUserId: n, variant: r = "panel", onMinimize: i, onDismiss: a }) {
1521
+ let o = e((e) => e.games[t]);
1520
1522
  return o ? r === "history" ? /* @__PURE__ */ M(Ve, {
1521
1523
  game: o,
1522
1524
  currentUserId: n
1523
1525
  }) : /* @__PURE__ */ M(He, {
1524
1526
  game: o,
1525
- gameKey: e,
1527
+ gameKey: t,
1526
1528
  currentUserId: n,
1527
1529
  variant: r,
1528
1530
  onMinimize: i,
@@ -1532,4 +1534,4 @@ function $({ gameKey: e, currentUserId: n, variant: r = "panel", onMinimize: i,
1532
1534
  var Ue = x($);
1533
1535
  export { Ue as default };
1534
1536
 
1535
- //# sourceMappingURL=TanksGameCard-GrqmdwJ7.js.map
1537
+ //# sourceMappingURL=TanksGameCard-DnCufSH6.js.map