speakid-hangman 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { jsx as o, jsxs as m, Fragment as G } from "react/jsx-runtime";
2
- import { useState as u, useMemo as Q, useCallback as he, useEffect as ue } from "react";
2
+ import { useState as h, useMemo as Q, useCallback as ue, useEffect as he } from "react";
3
3
  const l = {
4
4
  gmCenterScreen: {
5
5
  position: "relative",
@@ -209,12 +209,12 @@ function je({
209
209
  maxMistakes: J,
210
210
  size: P = 200
211
211
  }) {
212
- const p = P, h = P * 1.25, w = Math.max(3, P / 100), C = 10 * (p / 200), x = 240 * (h / 250), y = 150 * (p / 200), b = 80 * (p / 200), ee = 20 * (h / 250), _ = 240 * (h / 250), M = 80 * (p / 200), N = 20 * (h / 250), L = 150 * (p / 200), H = 150 * (p / 200), S = 20 * (h / 250), I = 50 * (h / 250), F = 150 * (p / 200), R = 70 * (h / 250), U = 20 * (p / 200), T = 150 * (p / 200), te = 90 * (h / 250), Y = 150 * (h / 250), f = 150 * (p / 200), B = 110 * (h / 250), d = 130 * (p / 200), D = 130 * (h / 250), ne = 150 * (p / 200), E = 110 * (h / 250), me = 170 * (p / 200), W = 130 * (h / 250), oe = 150 * (p / 200), V = 150 * (h / 250), g = 130 * (p / 200), re = 190 * (h / 250), j = 150 * (p / 200), ie = 150 * (h / 250), a = 170 * (p / 200), ae = 190 * (h / 250), k = r === 0 || r <= J * 0.5 ? "#1f2937" : r <= J * 0.75 ? "#f59e0b" : "#ec4c44";
212
+ const p = P, u = P * 1.25, w = Math.max(3, P / 100), C = 10 * (p / 200), x = 240 * (u / 250), y = 150 * (p / 200), b = 80 * (p / 200), ee = 20 * (u / 250), _ = 240 * (u / 250), M = 80 * (p / 200), N = 20 * (u / 250), L = 150 * (p / 200), H = 150 * (p / 200), S = 20 * (u / 250), I = 50 * (u / 250), F = 150 * (p / 200), R = 70 * (u / 250), U = 20 * (p / 200), T = 150 * (p / 200), te = 90 * (u / 250), D = 150 * (u / 250), f = 150 * (p / 200), B = 110 * (u / 250), d = 130 * (p / 200), O = 130 * (u / 250), ne = 150 * (p / 200), E = 110 * (u / 250), me = 170 * (p / 200), W = 130 * (u / 250), oe = 150 * (p / 200), V = 150 * (u / 250), g = 130 * (p / 200), re = 190 * (u / 250), j = 150 * (p / 200), ie = 150 * (u / 250), a = 170 * (p / 200), ae = 190 * (u / 250), k = r === 0 || r <= J * 0.5 ? "#1f2937" : r <= J * 0.75 ? "#f59e0b" : "#ec4c44";
213
213
  return /* @__PURE__ */ m(
214
214
  "svg",
215
215
  {
216
216
  width: p,
217
- height: h,
217
+ height: u,
218
218
  viewBox: "0 0 200 250",
219
219
  style: {
220
220
  display: "block",
@@ -288,7 +288,7 @@ function je({
288
288
  x1: T,
289
289
  y1: te,
290
290
  x2: T,
291
- y2: Y,
291
+ y2: D,
292
292
  stroke: k,
293
293
  strokeWidth: w
294
294
  }
@@ -299,7 +299,7 @@ function je({
299
299
  x1: f,
300
300
  y1: B,
301
301
  x2: d,
302
- y2: D,
302
+ y2: O,
303
303
  stroke: k,
304
304
  strokeWidth: w
305
305
  }
@@ -346,7 +346,7 @@ function Oe({
346
346
  screenHeight: J = 800,
347
347
  screenWidth: P = 800,
348
348
  logoUrl: p,
349
- showLogo: h = !0,
349
+ showLogo: u = !0,
350
350
  baseURL: w
351
351
  } = {}) {
352
352
  const C = {
@@ -367,7 +367,7 @@ function Oe({
367
367
  Environment: ["tree", "forest", "air", "water", "pollution", "recycle", "nature", "clean", "waste", "plastic", "energy", "animal", "climate", "earth", "ocean", "river", "planet", "save", "green", "environment", "litter", "organic"],
368
368
  Space: ["planet", "star", "sun", "moon", "astronaut", "rocket", "space", "galaxy", "universe", "telescope", "comet", "asteroid", "orbit", "gravity", "alien", "spaceship", "mars", "satellite", "sky", "eclipse"],
369
369
  Devices: ["computer", "laptop", "phone", "tablet", "tv", "keyboard", "mouse", "printer", "camera", "headphones", "charger", "screen", "watch", "microphone", "speaker", "console", "router", "battery", "cable", "remote"]
370
- }, [x, y] = u("lobby"), [b, ee] = u(""), [_] = u("Normal"), [M, N] = u(0), [L, H] = u(1), [S, I] = u(""), [F, R] = u([]), [U, T] = u(0), [te, Y] = u(0), [f, B] = u(null), [d, D] = u(null), [ne, E] = u(1), [me, W] = u([]), oe = _ === "Easy" ? 8 : _ === "Normal" ? 6 : 4, V = w || (typeof window < "u" && window.origin ? `${window.origin}/cloud/speakid/games/hangman` : "/cloud/speakid/games/hangman"), [g, re] = u(!1), [j, ie] = u(!1), [a, ae] = u(!1), [$, k] = u(!1), s = Q(() => {
370
+ }, [x, y] = h("lobby"), [b, ee] = h(""), [_] = h("Normal"), [M, N] = h(0), [L, H] = h(1), [S, I] = h(""), [F, R] = h([]), [U, T] = h(0), [te, D] = h(0), [f, B] = h(null), [d, O] = h(null), [ne, E] = h(1), [me, W] = h([]), oe = _ === "Easy" ? 8 : _ === "Normal" ? 6 : 4, V = w || (typeof window < "u" && window.origin ? `${window.origin}/cloud/speakid/games/hangman` : "/cloud/speakid/games/hangman"), [g, re] = h(!1), [j, ie] = h(!1), [a, ae] = h(!1), [$, k] = h(!1), s = Q(() => {
371
371
  const e = (d || r || 1e3) / 400, n = a ? 0.8 : 1, i = $ ? 0.9 : 1, c = n * i;
372
372
  return {
373
373
  headline1: g ? Math.max(24, Math.min(30, 30 * e * c)) : Math.max(28, Math.min(32, 32 * e * i)),
@@ -397,26 +397,26 @@ function Oe({
397
397
  const e = (d || r || 1e3) / 400, n = $ ? 0.9 : 1;
398
398
  return Math.max(6, Math.min(10, 8 * e * n));
399
399
  }, [d, r, $]), we = (e, n) => e.split("").every((i) => n.includes(i)), ke = (e, n) => e.split("").map((i) => n.includes(i) ? i : "_").join(" "), Me = (e) => "abcdefghijklmnopqrstuvwxyz".split("").filter((i) => !e.includes(i)), Z = (e, n = []) => {
400
- var A;
400
+ var Y;
401
401
  if (!e || !C[e]) {
402
402
  const z = Object.keys(C)[0];
403
- return ((A = C[z]) == null ? void 0 : A[0]) || "";
403
+ return ((Y = C[z]) == null ? void 0 : Y[0]) || "";
404
404
  }
405
405
  const i = C[e];
406
406
  if (!i || i.length === 0)
407
407
  return "";
408
- const c = i.filter((z) => !n.includes(z)), X = c.length > 0 ? c : i;
409
- if (X.length === 0)
408
+ const c = i.filter((z) => !n.includes(z)), A = c.length > 0 ? c : i;
409
+ if (A.length === 0)
410
410
  return "";
411
411
  let q;
412
412
  if (typeof crypto < "u" && crypto.getRandomValues) {
413
413
  const z = new Uint32Array(1);
414
414
  crypto.getRandomValues(z);
415
415
  const ge = z[0] / 4294967295;
416
- q = Math.floor(ge * X.length);
416
+ q = Math.floor(ge * A.length);
417
417
  } else
418
- q = Math.floor(Math.random() * X.length);
419
- return X[q];
418
+ q = Math.floor(Math.random() * A.length);
419
+ return A[q];
420
420
  }, $e = () => {
421
421
  if (!b) return;
422
422
  W([]);
@@ -425,19 +425,19 @@ function Oe({
425
425
  y("category");
426
426
  return;
427
427
  }
428
- I(e), W([e]), R([]), T(0), H(1), Y(0), B(null), y("game");
429
- }, se = he((e) => {
428
+ I(e), W([e]), R([]), T(0), H(1), D(0), B(null), y("game");
429
+ }, se = ue((e) => {
430
430
  if (x !== "game" || f !== null) return;
431
431
  const n = e.toLowerCase();
432
432
  /^[a-z]$/.test(n) && (R((i) => i.includes(n) ? i : [...i, n]), I((i) => (i && !i.includes(n) && T((c) => c + 1), i)));
433
- }, [x, f]), le = he((e) => {
433
+ }, [x, f]), le = ue((e) => {
434
434
  se(e.key);
435
435
  }, [se]);
436
- ue(() => {
436
+ he(() => {
437
437
  if (x === "game")
438
438
  return window.addEventListener("keydown", le), () => window.removeEventListener("keydown", le);
439
439
  }, [x, le]);
440
- const ve = S ? ke(S, F) : "", xe = S ? we(S, F) : !1, ye = U >= 10, Se = Me(F), ce = he(() => {
440
+ const ve = S ? ke(S, F) : "", xe = S ? we(S, F) : !1, ye = U >= 10, Se = Me(F), ce = ue(() => {
441
441
  if (!b || L >= M) {
442
442
  y("result");
443
443
  return;
@@ -447,9 +447,9 @@ function Oe({
447
447
  return n ? (I(n), [...e, n]) : e;
448
448
  }), R([]), T(0), B(null);
449
449
  }, [b, L, M]);
450
- ue(() => {
450
+ he(() => {
451
451
  if (xe && f === null) {
452
- B("win"), Y((n) => n + 1);
452
+ B("win"), D((n) => n + 1);
453
453
  const e = setTimeout(() => {
454
454
  ce();
455
455
  }, 2e3);
@@ -473,19 +473,19 @@ function Oe({
473
473
  return n ? (I(n), [...e, n]) : e;
474
474
  }), R([]), T(0), B(null);
475
475
  };
476
- ue(() => {
476
+ he(() => {
477
477
  const e = () => {
478
- const n = window.innerWidth, i = window.innerHeight, c = i < 800, A = n < 768 || c || (n === 926 && i === 428 || n === 932 && i === 430), z = i < 700, ge = n / i > 1.8, We = n === 1024 && i === 600, ze = A && n > i, Ce = n >= 1200 && n <= 1400;
479
- if (re(A), ie(We), ae(ze), k(Ce), A)
480
- D(null), E(1);
478
+ const n = window.innerWidth, i = window.innerHeight, c = n < 768, A = n > i && n < 1e3 && i < 500, Y = c || A || (n === 926 && i === 428 || n === 932 && i === 430), z = i < 700, ge = n / i > 1.8, We = n === 1024 && i === 600, ze = Y && n > i, Ce = n >= 1200 && n <= 1400;
479
+ if (re(Y), ie(We), ae(ze), k(Ce), Y)
480
+ O(null), E(1);
481
481
  else if (z)
482
- D(null), E(1);
482
+ O(null), E(1);
483
483
  else {
484
484
  const He = n - 80, Ie = i - 80, be = Math.min(He, Ie);
485
485
  let pe;
486
486
  r && r >= 320 ? pe = Math.min(r, be) : pe = Math.min(1e3, be * 0.9);
487
487
  const Re = Math.max(400, Math.min(1200, pe));
488
- D(Re), E(ge ? 0.85 : 1);
488
+ O(Re), E(ge ? 0.85 : 1);
489
489
  }
490
490
  };
491
491
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
@@ -534,7 +534,7 @@ function Oe({
534
534
  <path d="M 35% 85% Q 37% 83%, 39% 85% T 43% 85% T 47% 85%"
535
535
  fill="none" stroke="#FF4500" stroke-width="3.5" stroke-linecap="round"/>
536
536
  </svg>
537
- `, Fe = !g && typeof window < "u" && window.innerWidth >= 768 && window.innerWidth < 1024, de = !g && h && (x !== "game" || Fe), Te = {
537
+ `, Fe = !g && typeof window < "u" && window.innerWidth >= 768 && window.innerWidth < 1024, de = !g && u && (x !== "game" || Fe), Te = {
538
538
  ...l.gmCenterScreen,
539
539
  width: "100%",
540
540
  height: "100%",
@@ -546,7 +546,7 @@ function Oe({
546
546
  position: "relative",
547
547
  boxSizing: "border-box",
548
548
  background: "transparent"
549
- }, O = Q(
549
+ }, X = Q(
550
550
  () => {
551
551
  if (!de)
552
552
  return null;
@@ -575,7 +575,7 @@ function Oe({
575
575
  },
576
576
  [g, de, p, x]
577
577
  ), Be = () => x === "lobby" ? /* @__PURE__ */ m(G, { children: [
578
- O,
578
+ X,
579
579
  /* @__PURE__ */ o("div", { dangerouslySetInnerHTML: { __html: K } }),
580
580
  /* @__PURE__ */ o("h1", { style: {
581
581
  ...l.gmHeadline1,
@@ -687,7 +687,7 @@ function Oe({
687
687
  )
688
688
  ] })
689
689
  ] }) : x === "category" ? /* @__PURE__ */ m(G, { children: [
690
- O,
690
+ X,
691
691
  /* @__PURE__ */ o("div", { dangerouslySetInnerHTML: { __html: K } }),
692
692
  /* @__PURE__ */ o(
693
693
  "button",
@@ -747,7 +747,7 @@ function Oe({
747
747
  e
748
748
  )) })
749
749
  ] }) : x === "rounds" ? /* @__PURE__ */ m(G, { children: [
750
- O,
750
+ X,
751
751
  /* @__PURE__ */ o("div", { dangerouslySetInnerHTML: { __html: K } }),
752
752
  /* @__PURE__ */ o(
753
753
  "button",
@@ -808,7 +808,7 @@ function Oe({
808
808
  e
809
809
  )) })
810
810
  ] }) : x === "game" ? /* @__PURE__ */ m(G, { children: [
811
- O,
811
+ X,
812
812
  !a && /* @__PURE__ */ o("div", { dangerouslySetInnerHTML: { __html: K } }),
813
813
  " ",
814
814
  /* @__PURE__ */ m("div", { style: {
@@ -992,7 +992,7 @@ function Oe({
992
992
  marginBottom: `${t}px`
993
993
  }, children: "Type a letter on your keyboard" })
994
994
  ] }) : x === "result" ? /* @__PURE__ */ m(G, { children: [
995
- O,
995
+ X,
996
996
  /* @__PURE__ */ o("h1", { style: {
997
997
  ...l.gmHeadline1,
998
998
  fontSize: `${s.headline1}px`,
@@ -1025,7 +1025,7 @@ function Oe({
1025
1025
  }
1026
1026
  W([]);
1027
1027
  const e = Z(b, []);
1028
- e && (I(e), W([e]), R([]), T(0), H(1), Y(0), B(null), y("game"));
1028
+ e && (I(e), W([e]), R([]), T(0), H(1), D(0), B(null), y("game"));
1029
1029
  },
1030
1030
  onMouseEnter: (e) => {
1031
1031
  e.currentTarget.style.backgroundColor = "#d43a32";