@gamebob/axon-surge 0.6.0 → 0.8.0

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.
@@ -1,4 +1,4 @@
1
- class k {
1
+ class K {
2
2
  listeners = /* @__PURE__ */ new Map();
3
3
  on(t, e) {
4
4
  return this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set()), this.listeners.get(t).add(e), () => this.off(t, e);
@@ -15,7 +15,7 @@ class k {
15
15
  this.listeners.clear();
16
16
  }
17
17
  }
18
- class B {
18
+ class W {
19
19
  animationFrameId = null;
20
20
  lastTime = 0;
21
21
  isRunning = !1;
@@ -36,7 +36,7 @@ class B {
36
36
  this.lastTime = t, this.updateCallback(e), this.renderCallback(), this.animationFrameId = requestAnimationFrame(this.tick);
37
37
  }
38
38
  }
39
- class H {
39
+ class V {
40
40
  position;
41
41
  radius = 32;
42
42
  integrity = 3;
@@ -60,7 +60,7 @@ class H {
60
60
  this.position = { x: t, y: e }, this.integrity = this.maxIntegrity, this.pulsePhase = 0;
61
61
  }
62
62
  }
63
- class N {
63
+ class D {
64
64
  id;
65
65
  position = { x: 0, y: 0 };
66
66
  velocity = { x: 0, y: 0 };
@@ -114,7 +114,7 @@ class N {
114
114
  this.active = !1, this.isGrabbed = !1, this.isThrown = !1, this.wasManipulated = !1, this.isDying = !1, this.deathType = "none", this.deathTimer = 0, this.sliceAngle = 0, this.position = { x: 0, y: 0 }, this.velocity = { x: 0, y: 0 }, this.rotation = 0, this.strategy = null, this.maxSpeed = 200;
115
115
  }
116
116
  }
117
- class K {
117
+ class F {
118
118
  pointerPosition = { x: 0, y: 0 };
119
119
  isPointerDown = !1;
120
120
  grabbedEnemy = null;
@@ -218,7 +218,7 @@ class K {
218
218
  this.grabbedEnemy = null, this.dragStart = null, this.pointerHistory = [], this.isPointerDown = !1;
219
219
  }
220
220
  }
221
- class W {
221
+ class Y {
222
222
  cellSize;
223
223
  grid = /* @__PURE__ */ new Map();
224
224
  constructor(t = 100) {
@@ -245,7 +245,7 @@ class W {
245
245
  return i;
246
246
  }
247
247
  }
248
- class V {
248
+ class J {
249
249
  hitstopTime = 0;
250
250
  shakeTime = 0;
251
251
  shakeDuration = 0.14;
@@ -285,7 +285,7 @@ class V {
285
285
  };
286
286
  }
287
287
  }
288
- const w = {
288
+ const R = {
289
289
  es: {
290
290
  title: "AXON SURGE",
291
291
  startButton: "INICIAR ENLACE",
@@ -631,7 +631,7 @@ const w = {
631
631
  tutorialStep2Text: "步骤 2: 朝目标快速挥动抛投",
632
632
  tutorialDragWarning: "最佳策略是快速挥动抛投!"
633
633
  }
634
- }, U = [
634
+ }, H = [
635
635
  "es",
636
636
  "en",
637
637
  "fr",
@@ -648,45 +648,62 @@ const w = {
648
648
  "ko",
649
649
  "zh"
650
650
  ];
651
- function F(E) {
652
- return U.includes(E);
651
+ function N(E) {
652
+ return H.includes(E);
653
653
  }
654
- const O = "axon_surge_language";
655
- class Y {
654
+ const k = "axon_surge_language", U = "axon_surge_language_explicit";
655
+ class Z {
656
656
  currentLanguage;
657
657
  constructor(t) {
658
- if (t && w[t])
659
- this.currentLanguage = t;
660
- else {
661
- let e = "es";
662
- try {
663
- const i = localStorage.getItem(O);
664
- i && F(i) && (e = i);
665
- } catch {
658
+ this.currentLanguage = this.detectLanguage(t);
659
+ }
660
+ detectLanguage(t) {
661
+ if (t && N(t))
662
+ return t;
663
+ try {
664
+ const e = localStorage.getItem(U) === "true", i = localStorage.getItem(k);
665
+ if (e && i && N(i))
666
+ return i;
667
+ } catch {
668
+ }
669
+ try {
670
+ const e = (document.documentElement.lang || document.body?.getAttribute("lang") || document.documentElement.getAttribute("data-lang") || "").toLowerCase();
671
+ if (e) {
672
+ const i = e.split("-")[0];
673
+ if (i && N(i))
674
+ return i;
666
675
  }
667
- this.currentLanguage = e;
676
+ } catch {
677
+ }
678
+ try {
679
+ const e = (navigator.language || navigator.languages && navigator.languages[0] || "").toLowerCase();
680
+ if (e) {
681
+ const i = e.split("-")[0];
682
+ if (i && N(i))
683
+ return i;
684
+ }
685
+ } catch {
668
686
  }
687
+ return "en";
669
688
  }
670
- setLanguage(t) {
671
- if (w[t]) {
672
- this.currentLanguage = t;
689
+ setLanguage(t, e = !0) {
690
+ if (R[t] && (this.currentLanguage = t, e))
673
691
  try {
674
- localStorage.setItem(O, t);
692
+ localStorage.setItem(k, t), localStorage.setItem(U, "true");
675
693
  } catch {
676
694
  }
677
- }
678
695
  }
679
696
  getLanguage() {
680
697
  return this.currentLanguage;
681
698
  }
682
699
  translate(t, e) {
683
- let s = (w[this.currentLanguage] || w.es)[t] || w.es[t] || String(t);
700
+ let s = (R[this.currentLanguage] || R.en)[t] || R.en[t] || String(t);
684
701
  return e && Object.entries(e).forEach(([a, l]) => {
685
702
  s = s.replace(`{${a}}`, String(l));
686
703
  }), s;
687
704
  }
688
705
  }
689
- class J {
706
+ class X {
690
707
  execute(t) {
691
708
  const { thrownEnemy: e, targetEnemy: i, shockwaves: s, particles: a, floatingTexts: l } = t;
692
709
  i.active = !1, s.push({
@@ -725,7 +742,7 @@ class J {
725
742
  });
726
743
  }
727
744
  }
728
- class Z {
745
+ class _ {
729
746
  execute(t) {
730
747
  const { thrownEnemy: e, pools: i, shockwaves: s, particles: a, floatingTexts: l, eventBus: r } = t, n = e.position;
731
748
  i.push({
@@ -771,7 +788,7 @@ class Z {
771
788
  }), e.active = !1, r.emit("onPoolCreated", { position: n });
772
789
  }
773
790
  }
774
- class X {
791
+ class $ {
775
792
  execute(t) {
776
793
  const { thrownEnemy: e, targetEnemy: i, allEnemies: s, shockwaves: a, particles: l, floatingTexts: r } = t, n = i.position;
777
794
  e.active = !1, i.active = !1, a.push({
@@ -820,7 +837,7 @@ class X {
820
837
  });
821
838
  }
822
839
  }
823
- class $ {
840
+ class z {
824
841
  execute(t) {
825
842
  const { thrownEnemy: e, targetEnemy: i, vortices: s, shockwaves: a } = t, l = {
826
843
  x: (e.position.x + i.position.x) / 2,
@@ -847,27 +864,27 @@ class $ {
847
864
  }
848
865
  class S {
849
866
  static createEnemy(t, e, i) {
850
- const s = `enemy_${Date.now()}_${Math.random()}`, a = new N(s);
867
+ const s = `enemy_${Date.now()}_${Math.random()}`, a = new D(s);
851
868
  return this.configureEnemy(a, t, e, i), a;
852
869
  }
853
870
  static configureEnemy(t, e, i, s) {
854
871
  t.type = e, t.position = { ...i }, t.active = !0, t.isGrabbed = !1, t.isThrown = !1;
855
872
  const a = s.x - i.x, l = s.y - i.y, r = Math.atan2(l, a);
856
873
  let n = 70, o = 100, h = 20, c = "#ff2a5f", u = null;
857
- e === "piercer" ? (n = 95, o = 140, h = 18, c = "#ff2a5f", u = new J()) : e === "spore" ? (n = 65, o = 90, h = 24, c = "#39ff14", u = new Z()) : e === "cluster" ? (n = 50, o = 75, h = 26, c = "#ffd700", u = new X()) : e === "parasite" ? (n = 80, o = 110, h = 22, c = "#9d4edd", u = new $()) : e === "micro" && (n = 130, o = 160, h = 12, c = "#ffd700"), t.radius = h, t.color = c, t.strategy = u, t.maxSpeed = o, t.velocity = {
874
+ e === "piercer" ? (n = 95, o = 140, h = 18, c = "#ff2a5f", u = new X()) : e === "spore" ? (n = 65, o = 90, h = 24, c = "#39ff14", u = new _()) : e === "cluster" ? (n = 50, o = 75, h = 26, c = "#ffd700", u = new $()) : e === "parasite" ? (n = 80, o = 110, h = 22, c = "#9d4edd", u = new z()) : e === "micro" && (n = 130, o = 160, h = 12, c = "#ffd700"), t.radius = h, t.color = c, t.strategy = u, t.maxSpeed = o, t.velocity = {
858
875
  x: Math.cos(r) * n,
859
876
  y: Math.sin(r) * n
860
877
  };
861
878
  }
862
879
  }
863
- class z {
880
+ class q {
864
881
  spatialHash;
865
882
  eventBus;
866
883
  i18n;
867
884
  currentThrowKills = 0;
868
885
  currentThrowPos = null;
869
886
  constructor(t, e) {
870
- this.spatialHash = new W(100), this.eventBus = t, this.i18n = e;
887
+ this.spatialHash = new Y(100), this.eventBus = t, this.i18n = e;
871
888
  }
872
889
  update(t, e, i, s, a, l, r, n, o, h, c, u, p, f) {
873
890
  this.spatialHash.clear();
@@ -888,8 +905,8 @@ class z {
888
905
  if (!x.active || x.isGrabbed || x.isDying || x.isThrown && x.type === "piercer") continue;
889
906
  const L = m.position.x - x.position.x, A = m.position.y - x.position.y, b = Math.hypot(L, A);
890
907
  if (b > 2 && b <= m.radius) {
891
- const M = Math.pow(1 - b / m.radius, 0.7), y = m.pullForce * M, g = Math.atan2(A, L);
892
- x.velocity.x += Math.cos(g) * y * t, x.velocity.y += Math.sin(g) * y * t, x.position.x += Math.cos(g) * y * t * 0.8, x.position.y += Math.sin(g) * y * t * 0.8;
908
+ const M = Math.pow(1 - b / m.radius, 0.7), T = m.pullForce * M, g = Math.atan2(A, L);
909
+ x.velocity.x += Math.cos(g) * T * t, x.velocity.y += Math.sin(g) * T * t, x.position.x += Math.cos(g) * T * t * 0.8, x.position.y += Math.sin(g) * T * t * 0.8;
893
910
  }
894
911
  }
895
912
  m.duration >= m.maxDuration && a.splice(d, 1);
@@ -915,11 +932,11 @@ class z {
915
932
  if (b.active && !b.isGrabbed) {
916
933
  b.triggerDissolveDeath();
917
934
  for (let M = 0; M < 8; M++) {
918
- const y = Math.random() * Math.PI * 2, g = 100 + Math.random() * 200;
935
+ const T = Math.random() * Math.PI * 2, g = 100 + Math.random() * 200;
919
936
  r.push({
920
937
  id: Math.random().toString(),
921
938
  position: { ...b.position },
922
- velocity: { x: Math.cos(y) * g, y: Math.sin(y) * g },
939
+ velocity: { x: Math.cos(T) * g, y: Math.sin(T) * g },
923
940
  color: "#00f0ff",
924
941
  radius: 3 + Math.random() * 3,
925
942
  alpha: 1,
@@ -942,10 +959,10 @@ class z {
942
959
  break;
943
960
  }
944
961
  }
945
- let T = !1;
962
+ let y = !1;
946
963
  for (const d of i)
947
964
  if (!(!d.active || !d.isThrown || d.isDying)) {
948
- if (T = !0, d.position.x < -120 || d.position.x > u + 120 || d.position.y < -120 || d.position.y > p + 120) {
965
+ if (y = !0, d.position.x < -120 || d.position.x > u + 120 || d.position.y < -120 || d.position.y > p + 120) {
949
966
  d.active = !1, d.isThrown = !1;
950
967
  continue;
951
968
  }
@@ -967,11 +984,11 @@ class z {
967
984
  maxLifetime: 0.45
968
985
  });
969
986
  for (let M = 0; M < 16; M++) {
970
- const y = Math.random() * Math.PI * 2, g = 150 + Math.random() * 300;
987
+ const T = Math.random() * Math.PI * 2, g = 150 + Math.random() * 300;
971
988
  r.push({
972
989
  id: Math.random().toString(),
973
990
  position: { ...m.position },
974
- velocity: { x: Math.cos(y) * g, y: Math.sin(y) * g },
991
+ velocity: { x: Math.cos(T) * g, y: Math.sin(T) * g },
975
992
  color: "#ff2a5f",
976
993
  radius: 3 + Math.random() * 3,
977
994
  alpha: 1,
@@ -981,12 +998,12 @@ class z {
981
998
  }
982
999
  f && f();
983
1000
  } else {
984
- const M = d.type === m.type, y = M ? 360 : 250;
1001
+ const M = d.type === m.type, T = M ? 360 : 250;
985
1002
  l.push({
986
1003
  id: Math.random().toString(),
987
1004
  position: { ...this.currentThrowPos },
988
1005
  radius: 15,
989
- maxRadius: y,
1006
+ maxRadius: T,
990
1007
  color: d.color,
991
1008
  alpha: 1,
992
1009
  lifetime: 0,
@@ -1039,11 +1056,11 @@ class z {
1039
1056
  const I = g * Math.PI * 2 / 8, v = {
1040
1057
  x: this.currentThrowPos.x + Math.cos(I) * 15,
1041
1058
  y: this.currentThrowPos.y + Math.sin(I) * 15
1042
- }, P = S.createEnemy("micro", v, {
1059
+ }, G = S.createEnemy("micro", v, {
1043
1060
  x: v.x + Math.cos(I) * 220,
1044
1061
  y: v.y + Math.sin(I) * 220
1045
1062
  });
1046
- P.isThrown = !0, i.push(P);
1063
+ G.isThrown = !0, i.push(G);
1047
1064
  }
1048
1065
  this.killEnemyWithChainReaction(d, b, s, a, l, r, i), this.killEnemyWithChainReaction(m, b, s, a, l, r, i);
1049
1066
  } else
@@ -1051,7 +1068,7 @@ class z {
1051
1068
  for (const g of i) {
1052
1069
  if (g === d || g === m || !g.active || g.isGrabbed || g.isDying) continue;
1053
1070
  const I = g.position.x - this.currentThrowPos.x, v = g.position.y - this.currentThrowPos.y;
1054
- Math.hypot(I, v) <= y && (this.killEnemyWithChainReaction(g, b, s, a, l, r, i), this.currentThrowKills++);
1071
+ Math.hypot(I, v) <= T && (this.killEnemyWithChainReaction(g, b, s, a, l, r, i), this.currentThrowKills++);
1055
1072
  }
1056
1073
  f && f();
1057
1074
  break;
@@ -1059,7 +1076,7 @@ class z {
1059
1076
  }
1060
1077
  }
1061
1078
  }
1062
- h.value = this.currentThrowKills, !T && this.currentThrowKills > 0 && (this.currentThrowKills >= 2 && this.currentThrowPos && n.push({
1079
+ h.value = this.currentThrowKills, !y && this.currentThrowKills > 0 && (this.currentThrowKills >= 2 && this.currentThrowPos && n.push({
1063
1080
  id: Math.random().toString(),
1064
1081
  text: `MULTIKILL x${this.currentThrowKills}!`,
1065
1082
  position: { ...this.currentThrowPos },
@@ -1125,11 +1142,11 @@ class z {
1125
1142
  })) : t.type === "piercer" ? t.triggerSliceDeath(e) : t.triggerDissolveDeath();
1126
1143
  }
1127
1144
  }
1128
- class _ {
1145
+ class j {
1129
1146
  pool = [];
1130
1147
  constructor(t = 500) {
1131
1148
  for (let e = 0; e < t; e++) {
1132
- const i = new N(`pool_enemy_${e}`);
1149
+ const i = new D(`pool_enemy_${e}`);
1133
1150
  this.pool.push(i);
1134
1151
  }
1135
1152
  }
@@ -1137,7 +1154,7 @@ class _ {
1137
1154
  for (const e of this.pool)
1138
1155
  if (!e.active)
1139
1156
  return e.reset(), e;
1140
- const t = new N(`fallback_enemy_${Date.now()}_${Math.random()}`);
1157
+ const t = new D(`fallback_enemy_${Date.now()}_${Math.random()}`);
1141
1158
  return this.pool.push(t), t;
1142
1159
  }
1143
1160
  resetAll() {
@@ -1174,10 +1191,10 @@ class C {
1174
1191
  y: (Math.random() - 0.5) * 60
1175
1192
  }, c = { x: n.x + h.x, y: n.y + h.y }, u = t.get();
1176
1193
  S.configureEnemy(u, "spore", c, s);
1177
- const p = s.x - c.x, f = s.y - c.y, T = Math.atan2(f, p);
1194
+ const p = s.x - c.x, f = s.y - c.y, y = Math.atan2(f, p);
1178
1195
  u.velocity = {
1179
- x: Math.cos(T) * (50 + Math.random() * 20),
1180
- y: Math.sin(T) * (50 + Math.random() * 20)
1196
+ x: Math.cos(y) * (50 + Math.random() * 20),
1197
+ y: Math.sin(y) * (50 + Math.random() * 20)
1181
1198
  }, a.push(u);
1182
1199
  }
1183
1200
  return a;
@@ -1229,7 +1246,7 @@ class C {
1229
1246
  return a;
1230
1247
  }
1231
1248
  }
1232
- class q {
1249
+ class Q {
1233
1250
  wave = 1;
1234
1251
  pool;
1235
1252
  spawnTimer = 0;
@@ -1237,7 +1254,7 @@ class q {
1237
1254
  patternCooldown = 0;
1238
1255
  initialGracePeriod = 6;
1239
1256
  constructor() {
1240
- this.pool = new _(500);
1257
+ this.pool = new j(500);
1241
1258
  }
1242
1259
  reset() {
1243
1260
  this.wave = 1, this.spawnTimer = 0, this.waveTimer = 0, this.patternCooldown = 0;
@@ -1274,8 +1291,8 @@ class q {
1274
1291
  if (a === p) continue;
1275
1292
  const f = t[p];
1276
1293
  if (!f.active || f.isGrabbed || f.isDying) continue;
1277
- const T = l.position.x - f.position.x, d = l.position.y - f.position.y, m = Math.hypot(T, d);
1278
- m > 0 && m < 70 && (r += T / m, n += d / m, o++);
1294
+ const y = l.position.x - f.position.x, d = l.position.y - f.position.y, m = Math.hypot(y, d);
1295
+ m > 0 && m < 70 && (r += y / m, n += d / m, o++);
1279
1296
  }
1280
1297
  o > 0 && (r /= o, n /= o, l.velocity.x += r * 60 * e, l.velocity.y += n * 60 * e);
1281
1298
  const h = i.x - l.position.x, c = i.y - l.position.y, u = Math.hypot(h, c);
@@ -1293,7 +1310,7 @@ class q {
1293
1310
  }
1294
1311
  }
1295
1312
  }
1296
- const R = {
1313
+ const w = {
1297
1314
  bioluminescent: {
1298
1315
  bgInner: "#081220",
1299
1316
  bgMid: "#050b16",
@@ -1342,41 +1359,91 @@ const R = {
1342
1359
  tendrilMagenta: "#b5008c",
1343
1360
  tendrilCyan: "#0077b6"
1344
1361
  }
1345
- }, D = "axon_surge_theme";
1346
- class j {
1347
- currentTheme = "bioluminescent";
1348
- constructor(t) {
1349
- if (t)
1350
- this.setTheme(t);
1351
- else {
1352
- try {
1353
- const e = localStorage.getItem(D);
1354
- e && R[e] && (this.currentTheme = e);
1355
- } catch {
1362
+ }, P = "axon_surge_theme", O = "axon_surge_theme_explicit";
1363
+ class tt {
1364
+ currentTheme = "dark";
1365
+ isExplicit = !1;
1366
+ targetElement;
1367
+ constructor(t, e) {
1368
+ if (e !== void 0 && (this.targetElement = e), t && w[t]) {
1369
+ this.currentTheme = t, this.isExplicit = !0, this.applyThemeToDOM();
1370
+ return;
1371
+ }
1372
+ try {
1373
+ const i = localStorage.getItem(O) === "true", s = localStorage.getItem(P);
1374
+ if (i && s && w[s]) {
1375
+ this.currentTheme = s, this.isExplicit = !0, this.applyThemeToDOM();
1376
+ return;
1356
1377
  }
1357
- this.applyThemeToDOM();
1378
+ } catch {
1358
1379
  }
1380
+ this.currentTheme = this.detectParentOrSystemTheme();
1359
1381
  }
1360
- setTheme(t) {
1361
- if (R[t]) {
1362
- this.currentTheme = t, this.applyThemeToDOM();
1363
- try {
1364
- localStorage.setItem(D, t);
1365
- } catch {
1366
- }
1382
+ setTargetElement(t) {
1383
+ this.targetElement = t, this.isExplicit ? this.applyThemeToDOM() : this.currentTheme = this.detectParentOrSystemTheme();
1384
+ }
1385
+ setTheme(t, e = !0) {
1386
+ if (w[t])
1387
+ if (this.currentTheme = t, this.isExplicit = e, e) {
1388
+ this.applyThemeToDOM();
1389
+ try {
1390
+ localStorage.setItem(P, t), localStorage.setItem(O, "true");
1391
+ } catch {
1392
+ }
1393
+ } else
1394
+ this.removeThemeClasses();
1395
+ }
1396
+ clearExplicitTheme() {
1397
+ this.isExplicit = !1;
1398
+ try {
1399
+ localStorage.removeItem(P), localStorage.removeItem(O);
1400
+ } catch {
1367
1401
  }
1402
+ this.removeThemeClasses(), this.currentTheme = this.detectParentOrSystemTheme();
1368
1403
  }
1369
1404
  getTheme() {
1370
- return this.currentTheme;
1405
+ return this.isExplicit || (this.currentTheme = this.detectParentOrSystemTheme()), this.currentTheme;
1371
1406
  }
1372
1407
  getPalette() {
1373
- return R[this.currentTheme] || R.bioluminescent;
1408
+ return w[this.getTheme()] || w.dark;
1409
+ }
1410
+ detectParentOrSystemTheme() {
1411
+ try {
1412
+ const t = [
1413
+ this.targetElement || null,
1414
+ this.targetElement?.parentElement || null,
1415
+ document.body,
1416
+ document.documentElement
1417
+ ];
1418
+ for (const e of t)
1419
+ if (e) {
1420
+ if (e.classList.contains("theme-light") || e.getAttribute("data-theme") === "light")
1421
+ return "light";
1422
+ if (e.classList.contains("theme-bioluminescent") || e.classList.contains("theme-bio") || e.getAttribute("data-theme") === "bioluminescent" || e.getAttribute("data-theme") === "bio")
1423
+ return "bioluminescent";
1424
+ if (e.classList.contains("theme-dark") || e.getAttribute("data-theme") === "dark")
1425
+ return "dark";
1426
+ }
1427
+ } catch {
1428
+ }
1429
+ try {
1430
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: light)").matches)
1431
+ return "light";
1432
+ } catch {
1433
+ }
1434
+ return "dark";
1435
+ }
1436
+ removeThemeClasses() {
1437
+ const t = ["theme-bioluminescent", "theme-dark", "theme-light"];
1438
+ this.targetElement && this.targetElement.classList.remove(...t), document.documentElement.classList.remove(...t), document.documentElement.removeAttribute("data-theme");
1374
1439
  }
1375
1440
  applyThemeToDOM() {
1376
- document.documentElement.setAttribute("data-theme", this.currentTheme);
1441
+ if (this.removeThemeClasses(), !this.isExplicit) return;
1442
+ const t = `theme-${this.currentTheme}`;
1443
+ this.targetElement && this.targetElement.classList.add(t), document.documentElement.classList.add(t);
1377
1444
  }
1378
1445
  }
1379
- class Q {
1446
+ class et {
1380
1447
  maxDistance = 450;
1381
1448
  maxThickness = 28;
1382
1449
  minThickness = 4;
@@ -1391,27 +1458,27 @@ class Q {
1391
1458
  if (h <= 0 || h > this.maxDistance) continue;
1392
1459
  const c = Math.min(1, Math.max(0, h / this.maxDistance)), u = this.minThickness + (this.maxThickness - this.minThickness) * c, p = this.minLength + (this.maxLength - this.minLength) * c, f = 0.35 + (1 - c) * 0.55;
1393
1460
  if (t.save(), t.globalAlpha = f, t.shadowColor = a.color, t.shadowBlur = 12 + (1 - c) * 16, t.strokeStyle = a.color, t.lineWidth = u, t.lineCap = "round", t.beginPath(), n === 0 || n === i) {
1394
- const T = Math.max(0, o - p / 2), d = Math.min(s, o + p / 2);
1395
- t.moveTo(n, T), t.lineTo(n, d);
1461
+ const y = Math.max(0, o - p / 2), d = Math.min(s, o + p / 2);
1462
+ t.moveTo(n, y), t.lineTo(n, d);
1396
1463
  } else {
1397
- const T = Math.max(0, n - p / 2), d = Math.min(i, n + p / 2);
1398
- t.moveTo(T, o), t.lineTo(d, o);
1464
+ const y = Math.max(0, n - p / 2), d = Math.min(i, n + p / 2);
1465
+ t.moveTo(y, o), t.lineTo(d, o);
1399
1466
  }
1400
1467
  t.stroke(), t.strokeStyle = "#ffffff", t.lineWidth = Math.max(1.5, u * 0.25), t.globalAlpha = f * 0.8, t.stroke(), t.restore();
1401
1468
  }
1402
1469
  }
1403
1470
  }
1404
- class tt {
1471
+ class it {
1405
1472
  render(t, e, i, s, a) {
1406
1473
  const l = (210 + (a - 1) * 38 + Math.sin(s * 0.12) * 15) % 360, r = `hsl(${l}, 45%, 8%)`, n = `hsl(${(l + 30) % 360}, 40%, 4%)`, o = `hsl(${(l + 60) % 360}, 50%, 2%)`, h = t.createRadialGradient(e / 2, i / 2, 40, e / 2, i / 2, Math.max(e, i));
1407
1474
  h.addColorStop(0, r), h.addColorStop(0.55, n), h.addColorStop(1, o), t.fillStyle = h, t.fillRect(0, 0, e, i);
1408
1475
  const c = (l + 75) % 360, u = e * 0.35 + Math.sin(s * 0.25) * 70, p = i * 0.45 + Math.cos(s * 0.2) * 60, f = t.createRadialGradient(u, p, 20, u, p, 400);
1409
1476
  f.addColorStop(0, `hsla(${c}, 65%, 12%, 0.35)`), f.addColorStop(1, "rgba(0, 0, 0, 0)"), t.fillStyle = f, t.beginPath(), t.arc(u, p, 400, 0, Math.PI * 2), t.fill();
1410
- const T = (l + 160) % 360, d = e * 0.68 + Math.cos(s * 0.28) * 60, m = i * 0.55 + Math.sin(s * 0.22) * 55, x = t.createRadialGradient(d, m, 20, d, m, 440);
1411
- x.addColorStop(0, `hsla(${T}, 60%, 10%, 0.3)`), x.addColorStop(1, "rgba(0, 0, 0, 0)"), t.fillStyle = x, t.beginPath(), t.arc(d, m, 440, 0, Math.PI * 2), t.fill();
1477
+ const y = (l + 160) % 360, d = e * 0.68 + Math.cos(s * 0.28) * 60, m = i * 0.55 + Math.sin(s * 0.22) * 55, x = t.createRadialGradient(d, m, 20, d, m, 440);
1478
+ x.addColorStop(0, `hsla(${y}, 60%, 10%, 0.3)`), x.addColorStop(1, "rgba(0, 0, 0, 0)"), t.fillStyle = x, t.beginPath(), t.arc(d, m, 440, 0, Math.PI * 2), t.fill();
1412
1479
  }
1413
1480
  }
1414
- class et {
1481
+ class st {
1415
1482
  render(t, e, i) {
1416
1483
  if (!e.isActive) return;
1417
1484
  const s = e.getLauncher(), a = e.getTarget();
@@ -1436,7 +1503,7 @@ class et {
1436
1503
  t.restore();
1437
1504
  }
1438
1505
  }
1439
- class it {
1506
+ class at {
1440
1507
  canvas;
1441
1508
  ctx;
1442
1509
  themeManager;
@@ -1444,12 +1511,12 @@ class it {
1444
1511
  bgRenderer;
1445
1512
  tutorialArrowRenderer;
1446
1513
  constructor(t, e) {
1447
- this.canvas = t, this.ctx = t.getContext("2d"), this.themeManager = e, this.indicatorRenderer = new Q(), this.bgRenderer = new tt(), this.tutorialArrowRenderer = new et();
1514
+ this.canvas = t, this.ctx = t.getContext("2d"), this.themeManager = e, this.indicatorRenderer = new et(), this.bgRenderer = new it(), this.tutorialArrowRenderer = new st();
1448
1515
  }
1449
1516
  render(t, e, i, s, a, l, r, n, o, h, c = 1, u) {
1450
1517
  if (!this.ctx) return;
1451
- const p = this.themeManager.getPalette(), { width: f, height: T } = this.canvas, d = n.getShakeOffset();
1452
- this.ctx.save(), this.ctx.translate(d.x, d.y), this.bgRenderer.render(this.ctx, f, T, t.pulsePhase, c), this.drawToxicPools(i, t.pulsePhase), this.drawGravityVortices(s, t.pulsePhase), this.drawShockwaves(a), this.drawCoreFilaments(t, p), this.drawParticles(l), this.indicatorRenderer.render(this.ctx, e, f, T), this.drawOrganicEnemies(e, t.pulsePhase, p), u && this.tutorialArrowRenderer.render(this.ctx, u, t.pulsePhase), o ? this.drawPsionicTendril(t.position, o.position, p) : t && this.drawHoverTendril(t.position, h, e, p), this.drawOrganicConsciousnessCore(t, p), this.drawFloatingTexts(r), n.flashAlpha > 0 && (this.ctx.fillStyle = `rgba(255, 255, 255, ${n.flashAlpha})`, this.ctx.fillRect(0, 0, f, T)), this.ctx.restore();
1518
+ const p = this.themeManager.getPalette(), { width: f, height: y } = this.canvas, d = n.getShakeOffset();
1519
+ this.ctx.save(), this.ctx.translate(d.x, d.y), this.bgRenderer.render(this.ctx, f, y, t.pulsePhase, c), this.drawToxicPools(i, t.pulsePhase), this.drawGravityVortices(s, t.pulsePhase), this.drawShockwaves(a), this.drawCoreFilaments(t, p), this.drawParticles(l), this.indicatorRenderer.render(this.ctx, e, f, y), this.drawOrganicEnemies(e, t.pulsePhase, p), u && this.tutorialArrowRenderer.render(this.ctx, u, t.pulsePhase), o ? this.drawPsionicTendril(t.position, o.position, p) : t && this.drawHoverTendril(t.position, h, e, p), this.drawOrganicConsciousnessCore(t, p), this.drawFloatingTexts(r), n.flashAlpha > 0 && (this.ctx.fillStyle = `rgba(255, 255, 255, ${n.flashAlpha})`, this.ctx.fillRect(0, 0, f, y)), this.ctx.restore();
1453
1520
  }
1454
1521
  drawToxicPools(t, e) {
1455
1522
  if (this.ctx)
@@ -1460,18 +1527,18 @@ class it {
1460
1527
  n.addColorStop(0, `rgba(57, 255, 20, ${a * 0.9})`), n.addColorStop(0.4, `rgba(16, 185, 129, ${a * 0.65})`), n.addColorStop(0.8, `rgba(5, 80, 45, ${a * 0.35})`), n.addColorStop(1, "rgba(2, 35, 15, 0)"), this.ctx.fillStyle = n, this.ctx.shadowColor = "#39ff14", this.ctx.shadowBlur = 30, this.ctx.beginPath();
1461
1528
  const o = 70;
1462
1529
  for (let h = 0; h <= o; h++) {
1463
- const c = h * Math.PI * 2 / o, u = Math.sin(c * 5 + e * 3) * 14, p = Math.cos(c * 3 - e * 2) * 9, f = i.radius + u + p, T = l + Math.cos(c) * f, d = r + Math.sin(c) * f;
1464
- h === 0 ? this.ctx.moveTo(T, d) : this.ctx.lineTo(T, d);
1530
+ const c = h * Math.PI * 2 / o, u = Math.sin(c * 5 + e * 3) * 14, p = Math.cos(c * 3 - e * 2) * 9, f = i.radius + u + p, y = l + Math.cos(c) * f, d = r + Math.sin(c) * f;
1531
+ h === 0 ? this.ctx.moveTo(y, d) : this.ctx.lineTo(y, d);
1465
1532
  }
1466
1533
  this.ctx.closePath(), this.ctx.fill(), this.ctx.strokeStyle = `rgba(57, 255, 20, ${a * 0.8})`, this.ctx.lineWidth = 2.5, this.ctx.beginPath();
1467
1534
  for (let h = 0; h <= o; h++) {
1468
- const c = h * Math.PI * 2 / o, u = Math.sin(c * 6 + e * 4) * 8, p = i.radius * 0.75 + u, f = l + Math.cos(c) * p, T = r + Math.sin(c) * p;
1469
- h === 0 ? this.ctx.moveTo(f, T) : this.ctx.lineTo(f, T);
1535
+ const c = h * Math.PI * 2 / o, u = Math.sin(c * 6 + e * 4) * 8, p = i.radius * 0.75 + u, f = l + Math.cos(c) * p, y = r + Math.sin(c) * p;
1536
+ h === 0 ? this.ctx.moveTo(f, y) : this.ctx.lineTo(f, y);
1470
1537
  }
1471
1538
  this.ctx.closePath(), this.ctx.stroke();
1472
1539
  for (let h = 0; h < 6; h++) {
1473
- const c = h * Math.PI * 0.33 + e * 1.5, u = i.radius * 0.5 * (0.3 + Math.sin(e * 2 + h) * 0.3), p = l + Math.cos(c) * u, f = r + Math.sin(c) * u, T = 3 + Math.sin(e * 3 + h) * 2;
1474
- this.ctx.fillStyle = `rgba(255, 255, 255, ${a * 0.8})`, this.ctx.beginPath(), this.ctx.arc(p, f, Math.max(1, T), 0, Math.PI * 2), this.ctx.fill();
1540
+ const c = h * Math.PI * 0.33 + e * 1.5, u = i.radius * 0.5 * (0.3 + Math.sin(e * 2 + h) * 0.3), p = l + Math.cos(c) * u, f = r + Math.sin(c) * u, y = 3 + Math.sin(e * 3 + h) * 2;
1541
+ this.ctx.fillStyle = `rgba(255, 255, 255, ${a * 0.8})`, this.ctx.beginPath(), this.ctx.arc(p, f, Math.max(1, y), 0, Math.PI * 2), this.ctx.fill();
1475
1542
  }
1476
1543
  this.ctx.restore();
1477
1544
  }
@@ -1643,7 +1710,7 @@ class it {
1643
1710
  this.ctx.save(), this.ctx.globalAlpha = e.alpha, this.ctx.fillStyle = e.color, this.ctx.font = `900 ${e.size}px Orbitron, sans-serif`, this.ctx.textAlign = "center", this.ctx.shadowColor = e.color, this.ctx.shadowBlur = 12, this.ctx.fillText(e.text, e.position.x, e.position.y), this.ctx.restore();
1644
1711
  }
1645
1712
  }
1646
- class st {
1713
+ class nt {
1647
1714
  container;
1648
1715
  i18n;
1649
1716
  waveLabelElement;
@@ -1675,7 +1742,7 @@ class st {
1675
1742
  this.container.style.display = "none";
1676
1743
  }
1677
1744
  }
1678
- class at {
1745
+ class ot {
1679
1746
  container;
1680
1747
  i18n;
1681
1748
  onStartCallback;
@@ -1701,7 +1768,7 @@ class at {
1701
1768
  this.container.style.display = "none";
1702
1769
  }
1703
1770
  }
1704
- class nt {
1771
+ class rt {
1705
1772
  modal;
1706
1773
  card;
1707
1774
  i18n;
@@ -1746,13 +1813,13 @@ class nt {
1746
1813
  ko: "한국어 (KO)",
1747
1814
  zh: "中文 (ZH)"
1748
1815
  };
1749
- for (const y of U) {
1816
+ for (const T of H) {
1750
1817
  const g = document.createElement("option");
1751
- g.value = y, g.textContent = l[y], this.i18n.getLanguage() === y && (g.selected = !0), a.appendChild(g);
1818
+ g.value = T, g.textContent = l[T], this.i18n.getLanguage() === T && (g.selected = !0), a.appendChild(g);
1752
1819
  }
1753
1820
  a.addEventListener("change", () => {
1754
- const y = a.value;
1755
- this.i18n.setLanguage(y), this.onLanguageChangedCallback && this.onLanguageChangedCallback(y), this.renderContent();
1821
+ const T = a.value;
1822
+ this.i18n.setLanguage(T), this.onLanguageChangedCallback && this.onLanguageChangedCallback(T), this.renderContent();
1756
1823
  });
1757
1824
  const r = document.createElement("span");
1758
1825
  r.className = "axon-select-arrow", r.textContent = "▼", s.appendChild(a), s.appendChild(r), e.appendChild(i), e.appendChild(s);
@@ -1767,10 +1834,10 @@ class nt {
1767
1834
  { id: "dark", label: "DARK" },
1768
1835
  { id: "light", label: "LIGHT" }
1769
1836
  ];
1770
- for (const y of c) {
1837
+ for (const T of c) {
1771
1838
  const g = document.createElement("button");
1772
- g.type = "button", g.className = `axon-toggle-btn ${this.themeManager.getTheme() === y.id ? "active" : ""}`, g.textContent = y.label, g.addEventListener("click", () => {
1773
- this.themeManager.setTheme(y.id), this.renderContent();
1839
+ g.type = "button", g.className = `axon-toggle-btn ${this.themeManager.getTheme() === T.id ? "active" : ""}`, g.textContent = T.label, g.addEventListener("click", () => {
1840
+ this.themeManager.setTheme(T.id), this.renderContent();
1774
1841
  }), h.appendChild(g);
1775
1842
  }
1776
1843
  n.appendChild(o), n.appendChild(h);
@@ -1780,14 +1847,14 @@ class nt {
1780
1847
  p.textContent = this.i18n.translate("hapticsLabel");
1781
1848
  const f = document.createElement("div");
1782
1849
  f.className = "axon-toggle-group";
1783
- const T = [
1850
+ const y = [
1784
1851
  { enabled: !0, label: this.i18n.translate("hapticsOn") },
1785
1852
  { enabled: !1, label: this.i18n.translate("hapticsOff") }
1786
1853
  ];
1787
- for (const y of T) {
1854
+ for (const T of y) {
1788
1855
  const g = document.createElement("button");
1789
- g.type = "button", g.className = `axon-toggle-btn ${this.hapticsEnabled === y.enabled ? "active" : ""}`, g.textContent = y.label, g.addEventListener("click", () => {
1790
- this.hapticsEnabled = y.enabled, localStorage.setItem("axon_surge_haptics", String(y.enabled)), this.hapticsEnabled && this.platform.haptics.selectionChanged(), this.renderContent();
1856
+ g.type = "button", g.className = `axon-toggle-btn ${this.hapticsEnabled === T.enabled ? "active" : ""}`, g.textContent = T.label, g.addEventListener("click", () => {
1857
+ this.hapticsEnabled = T.enabled, localStorage.setItem("axon_surge_haptics", String(T.enabled)), this.hapticsEnabled && this.platform.haptics.selectionChanged(), this.renderContent();
1791
1858
  }), f.appendChild(g);
1792
1859
  }
1793
1860
  u.appendChild(p), u.appendChild(f);
@@ -1801,10 +1868,10 @@ class nt {
1801
1868
  { enabled: !0, label: this.i18n.translate("hapticsOn") },
1802
1869
  { enabled: !1, label: this.i18n.translate("hapticsOff") }
1803
1870
  ];
1804
- for (const y of A) {
1871
+ for (const T of A) {
1805
1872
  const g = document.createElement("button");
1806
- g.type = "button", g.className = `axon-toggle-btn ${L === y.enabled ? "active" : ""}`, g.textContent = y.label, g.addEventListener("click", () => {
1807
- localStorage.setItem("axon_surge_show_tutorial", String(y.enabled)), this.renderContent();
1873
+ g.type = "button", g.className = `axon-toggle-btn ${L === T.enabled ? "active" : ""}`, g.textContent = T.label, g.addEventListener("click", () => {
1874
+ localStorage.setItem("axon_surge_show_tutorial", String(T.enabled)), this.renderContent();
1808
1875
  }), x.appendChild(g);
1809
1876
  }
1810
1877
  d.appendChild(m), d.appendChild(x);
@@ -1825,8 +1892,8 @@ class nt {
1825
1892
  this.modal.close();
1826
1893
  }
1827
1894
  }
1828
- const G = "axon_surge_show_tutorial";
1829
- class ot {
1895
+ const B = "axon_surge_show_tutorial";
1896
+ class ht {
1830
1897
  isActive = !1;
1831
1898
  showWarning = !1;
1832
1899
  dummyLauncher = null;
@@ -1835,14 +1902,14 @@ class ot {
1835
1902
  initialTargetPos = { x: 0, y: 0 };
1836
1903
  isTutorialEnabled() {
1837
1904
  try {
1838
- return localStorage.getItem(G) !== "false";
1905
+ return localStorage.getItem(B) !== "false";
1839
1906
  } catch {
1840
1907
  return !0;
1841
1908
  }
1842
1909
  }
1843
1910
  setTutorialEnabled(t) {
1844
1911
  try {
1845
- localStorage.setItem(G, String(t));
1912
+ localStorage.setItem(B, String(t));
1846
1913
  } catch {
1847
1914
  }
1848
1915
  }
@@ -1902,7 +1969,7 @@ class ot {
1902
1969
  this.isActive = !1, this.showWarning = !1;
1903
1970
  }
1904
1971
  }
1905
- class rt {
1972
+ class lt {
1906
1973
  container;
1907
1974
  i18n;
1908
1975
  tutorialManager;
@@ -1938,7 +2005,7 @@ class rt {
1938
2005
  this.container.style.display = "none";
1939
2006
  }
1940
2007
  }
1941
- class ht {
2008
+ class ct {
1942
2009
  fillElement;
1943
2010
  killsCount = 0;
1944
2011
  currentLevel = 1;
@@ -1969,7 +2036,7 @@ class ht {
1969
2036
  this.fillElement && this.fillElement.parentElement && (this.fillElement.parentElement.style.display = "none");
1970
2037
  }
1971
2038
  }
1972
- class lt {
2039
+ class dt {
1973
2040
  haptics = {
1974
2041
  impact: async (t) => {
1975
2042
  if ("vibrate" in navigator) {
@@ -2009,7 +2076,7 @@ class lt {
2009
2076
  }
2010
2077
  };
2011
2078
  }
2012
- class ct {
2079
+ class ut {
2013
2080
  container;
2014
2081
  canvas;
2015
2082
  i18n;
@@ -2041,7 +2108,7 @@ class ct {
2041
2108
  isRunning = !1;
2042
2109
  isPaused = !1;
2043
2110
  constructor(t) {
2044
- this.container = t.root, this.container.classList.add("axon-game-root"), this.i18n = new Y(t.language), this.themeManager = new j(t.theme), this.platform = t.platform || new lt(), this.canvas = document.createElement("canvas"), this.canvas.className = "axon-canvas", this.container.appendChild(this.canvas), this.resizeCanvas(), window.addEventListener("resize", () => this.resizeCanvas()), this.eventBus = new k(), this.core = new H(this.canvas.width / 2, this.canvas.height / 2), this.inputManager = new K(this.canvas), this.physicsEngine = new z(this.eventBus, this.i18n), this.waveDirector = new q(), this.renderer = new it(this.canvas, this.themeManager), this.juice = new V(), this.settingsModal = new nt(
2111
+ this.container = t.root, this.container.classList.add("axon-game-root"), this.i18n = new Z(t.language), this.themeManager = new tt(t.theme, this.container), this.platform = t.platform || new dt(), this.canvas = document.createElement("canvas"), this.canvas.className = "axon-canvas", this.container.appendChild(this.canvas), this.resizeCanvas(), window.addEventListener("resize", () => this.resizeCanvas()), this.eventBus = new K(), this.core = new V(this.canvas.width / 2, this.canvas.height / 2), this.inputManager = new F(this.canvas), this.physicsEngine = new q(this.eventBus, this.i18n), this.waveDirector = new Q(), this.renderer = new at(this.canvas, this.themeManager), this.juice = new J(), this.settingsModal = new rt(
2045
2112
  this.container,
2046
2113
  this.i18n,
2047
2114
  this.themeManager,
@@ -2050,20 +2117,26 @@ class ct {
2050
2117
  () => {
2051
2118
  this.isPaused = !1;
2052
2119
  }
2053
- ), this.interactiveTutorial = new ot(), this.tutorialOverlay = new rt(this.container, this.i18n, this.interactiveTutorial), this.hud = new st(this.container, this.i18n, () => {
2120
+ ), this.interactiveTutorial = new ht(), this.tutorialOverlay = new lt(this.container, this.i18n, this.interactiveTutorial), this.hud = new nt(this.container, this.i18n, () => {
2054
2121
  this.isPaused = !0, this.settingsModal.show();
2055
- }), this.hud.show(), this.progressBar = new ht(this.hud.progressSlot, (e) => {
2122
+ }), this.hud.show(), this.progressBar = new ct(this.hud.progressSlot, (e) => {
2056
2123
  this.waveDirector.wave = e;
2057
- }), this.startMenu = new at(this.container, this.i18n, () => this.startGame()), this.initAmbientArena(), this.gameLoop = new B(
2124
+ }), this.startMenu = new ot(this.container, this.i18n, () => this.startGame()), this.initAmbientArena(), this.gameLoop = new W(
2058
2125
  (e) => this.update(e),
2059
2126
  () => this.render()
2060
2127
  ), this.setupEvents(), this.gameLoop.start();
2061
2128
  }
2062
2129
  setLanguage(t) {
2063
- this.i18n.setLanguage(t), this.onLanguageChanged(t);
2130
+ this.i18n.setLanguage(t, !1), this.onLanguageChanged(t);
2064
2131
  }
2065
2132
  setTheme(t) {
2066
- this.themeManager.setTheme(t);
2133
+ this.themeManager.setTheme(t, !1);
2134
+ }
2135
+ getLanguage() {
2136
+ return this.i18n.getLanguage();
2137
+ }
2138
+ getTheme() {
2139
+ return this.themeManager.getTheme();
2067
2140
  }
2068
2141
  onLanguageChanged(t) {
2069
2142
  this.startMenu.renderContent(), this.hud.renderLabels(), this.tutorialOverlay.updateLanguage();
@@ -2169,15 +2242,18 @@ class ct {
2169
2242
  this.interactiveTutorial.isActive ? this.interactiveTutorial : void 0
2170
2243
  );
2171
2244
  }
2245
+ destroy() {
2246
+ this.gameLoop.stop(), this.canvas.remove();
2247
+ }
2172
2248
  }
2173
- function dt(E) {
2174
- return new ct(E);
2249
+ function pt(E) {
2250
+ return new ut(E);
2175
2251
  }
2176
2252
  export {
2177
- lt as BrowserPlatform,
2178
- ct as GameEngine,
2179
- U as LANGUAGES,
2180
- j as ThemeManager,
2181
- dt as createAxonSurge,
2182
- F as isLanguage
2253
+ dt as BrowserPlatform,
2254
+ ut as GameEngine,
2255
+ H as LANGUAGES,
2256
+ tt as ThemeManager,
2257
+ pt as createAxonSurge,
2258
+ N as isLanguage
2183
2259
  };