@mblinkov/whats-missing 20.0.23 → 20.0.25

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,9 +1,9 @@
1
- import { jsx as t, jsxs as m, Fragment as ze } from "react/jsx-runtime";
2
- import { useRef as _, useState as c, useEffect as V, useLayoutEffect as se, useMemo as Ce } from "react";
3
- const ke = window.origin + "/cloud/speakid/games/whatsmissing/", Y = (l, f) => l.map(([h, i]) => ({
4
- src: `${ke}${f}/${i.replace(/\s/g, "%20")}.png`,
5
- name: i
6
- })), Se = [
1
+ import { jsx as t, jsxs as s, Fragment as he } from "react/jsx-runtime";
2
+ import { useRef as U, useState as l, useEffect as oe, useLayoutEffect as re, useMemo as pe } from "react";
3
+ const fe = window.origin + "/cloud/speakid/games/whatsmissing/", P = (i, y) => i.map(([m, o]) => ({
4
+ src: `${fe}${y}/${o.replace(/\s/g, "%20")}.png`,
5
+ name: o
6
+ })), ye = [
7
7
  ["apple", "apple"],
8
8
  ["banana", "banana"],
9
9
  ["bread", "bread"],
@@ -29,7 +29,7 @@ const ke = window.origin + "/cloud/speakid/games/whatsmissing/", Y = (l, f) => l
29
29
  ["strawberry", "strawberry"],
30
30
  ["tomato", "tomato"],
31
31
  ["watermelon", "watermelon"]
32
- ], Te = [
32
+ ], xe = [
33
33
  ["bear", "bear"],
34
34
  ["cat", "cat"],
35
35
  ["crocodile", "crocodile"],
@@ -49,7 +49,7 @@ const ke = window.origin + "/cloud/speakid/games/whatsmissing/", Y = (l, f) => l
49
49
  ["tortoise", "tortoise"],
50
50
  ["wolf", "wolf"],
51
51
  ["zebra", "zebra"]
52
- ], Me = [
52
+ ], be = [
53
53
  ["ball", "ball"],
54
54
  ["balloon", "balloon"],
55
55
  ["blocks", "blocks"],
@@ -69,21 +69,21 @@ const ke = window.origin + "/cloud/speakid/games/whatsmissing/", Y = (l, f) => l
69
69
  ["teddy_bear", "teddy bear"],
70
70
  ["yo-yo", "yo-yo"],
71
71
  ["crayons", "crayons"]
72
- ], re = {
73
- food: Y(Se, "food"),
74
- animals: Y(Te, "animals"),
75
- toys: Y(Me, "toys")
76
- }, Re = `
72
+ ], ie = {
73
+ food: P(ye, "food"),
74
+ animals: P(xe, "animals"),
75
+ toys: P(be, "toys")
76
+ }, we = `
77
77
  @keyframes spin {
78
78
  from { transform: rotate(0deg); }
79
79
  to { transform: rotate(360deg); }
80
80
  }
81
81
  `;
82
82
  if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
83
- const l = document.createElement("style");
84
- l.id = "spin-keyframes", l.innerHTML = Re, document.head.appendChild(l);
83
+ const i = document.createElement("style");
84
+ i.id = "spin-keyframes", i.innerHTML = we, document.head.appendChild(i);
85
85
  }
86
- const Ee = {
86
+ const ve = {
87
87
  animation: "spin 1.4s linear infinite"
88
88
  }, n = {
89
89
  gmCenterScreen: {
@@ -236,188 +236,167 @@ const Ee = {
236
236
  },
237
237
  gmHourglass: {
238
238
  fontSize: "42px",
239
- ...Ee
239
+ ...ve
240
240
  }
241
- }, Ie = () => {
242
- const l = document.createElement("style");
243
- l.textContent = `
244
- /* scope only inside game root */
241
+ }, ke = () => {
242
+ const i = document.createElement("style");
243
+ i.textContent = `
245
244
  #whats-missing-root, #whats-missing-root * { box-sizing: border-box; }
246
245
  #whats-missing-root img { max-width:100%; height:auto; display:block; user-select:none; }
247
- `, document.head.appendChild(l);
248
- }, Be = (l, f) => {
249
- const h = Array.from({ length: l.length + 1 }, () => Array(f.length + 1).fill(0));
250
- for (let i = 0; i <= l.length; i++) h[i][0] = i;
251
- for (let i = 0; i <= f.length; i++) h[0][i] = i;
252
- for (let i = 1; i <= l.length; i++)
253
- for (let u = 1; u <= f.length; u++)
254
- h[i][u] = l[i - 1] === f[u - 1] ? h[i - 1][u - 1] : Math.min(h[i - 1][u - 1], h[i][u - 1], h[i - 1][u]) + 1;
255
- return h[l.length][f.length];
246
+ `, document.head.appendChild(i);
247
+ }, Ce = (i, y) => {
248
+ const m = Array.from({ length: i.length + 1 }, () => Array(y.length + 1).fill(0));
249
+ for (let o = 0; o <= i.length; o++) m[o][0] = o;
250
+ for (let o = 0; o <= y.length; o++) m[0][o] = o;
251
+ for (let o = 1; o <= i.length; o++)
252
+ for (let g = 1; g <= y.length; g++)
253
+ m[o][g] = i[o - 1] === y[g - 1] ? m[o - 1][g - 1] : Math.min(m[o - 1][g - 1], m[o][g - 1], m[o - 1][g]) + 1;
254
+ return m[i.length][y.length];
256
255
  };
257
- function Le(l, f = { minDesktopWidth: 1200, forceResize: !1 }) {
258
- const h = _(null), i = f.minDesktopWidth ?? 1200, u = !!f.forceResize;
259
- se(() => {
260
- if (typeof window > "u" || !l || !l.current) return;
261
- const s = l.current, S = () => {
256
+ function ze(i, y = { minDesktopWidth: 1200, forceResize: !1 }) {
257
+ const m = U(null), o = y.minDesktopWidth ?? 1200, g = !!y.forceResize;
258
+ re(() => {
259
+ if (typeof window > "u" || !i || !i.current) return;
260
+ const d = i.current, B = () => {
262
261
  try {
263
- const r = document.body, b = getComputedStyle(r), y = parseFloat(r.style && r.style.zoom || "");
264
- if (y && !isNaN(y) && y > 0) return y;
265
- const T = parseFloat(b.zoom || "");
262
+ const a = document.body, u = getComputedStyle(a), T = parseFloat(a.style && a.style.zoom || "");
266
263
  if (T && !isNaN(T) && T > 0) return T;
267
- const a = document.createElement("div");
268
- a.style.position = "absolute", a.style.left = "0", a.style.top = "0", a.style.width = "100px", a.style.height = "1px", a.style.visibility = "hidden", a.style.pointerEvents = "none", document.documentElement.appendChild(a);
269
- const C = a.getBoundingClientRect();
270
- if (document.documentElement.removeChild(a), C && C.width > 0) {
271
- const M = C.width / 100;
272
- if (!isNaN(M) && M > 0) return M;
264
+ const k = parseFloat(u.zoom || "");
265
+ if (k && !isNaN(k) && k > 0) return k;
266
+ const h = document.createElement("div");
267
+ h.style.position = "absolute", h.style.left = "0", h.style.top = "0", h.style.width = "100px", h.style.height = "1px", h.style.visibility = "hidden", h.style.pointerEvents = "none", document.documentElement.appendChild(h);
268
+ const x = h.getBoundingClientRect();
269
+ if (document.documentElement.removeChild(h), x && x.width > 0) {
270
+ const A = x.width / 100;
271
+ if (!isNaN(A) && A > 0) return A;
273
272
  }
274
273
  } catch {
275
274
  }
276
275
  return 1;
277
- }, H = () => {
278
- if (i && window.innerWidth < i) {
279
- z();
276
+ }, C = () => {
277
+ if (o && window.innerWidth < o) {
278
+ I();
280
279
  return;
281
280
  }
282
- const r = S();
283
- if (!r || r === 1) {
284
- z();
281
+ const a = B();
282
+ if (!a || a === 1) {
283
+ I();
285
284
  return;
286
285
  }
287
- h.current || (h.current = {
288
- transform: s.style.transform || null,
289
- transformOrigin: s.style.transformOrigin || null,
290
- width: s.style.width || null,
291
- height: s.style.height || null,
292
- willChange: s.style.willChange || null
286
+ m.current || (m.current = {
287
+ transform: d.style.transform || null,
288
+ transformOrigin: d.style.transformOrigin || null,
289
+ width: d.style.width || null,
290
+ height: d.style.height || null,
291
+ willChange: d.style.willChange || null
293
292
  });
294
- const b = 1 / r;
295
- u && (s.style.width = `${r * 100}%`, s.style.height = `${r * 100}%`), s.style.transformOrigin = "50% 50%", s.style.transform = `scale(${b})`, s.style.willChange = "transform", typeof process < "u" && process.env?.NODE_ENV === "development" && console.debug("[useNeutralizeBodyZoom] applied scale:", { scale: r, inv: b, forceResize: u });
296
- }, z = () => {
297
- if (!h.current) return;
298
- const r = h.current;
299
- r.transform === null ? s.style.removeProperty("transform") : s.style.transform = r.transform, r.transformOrigin === null ? s.style.removeProperty("transform-origin") : s.style.transformOrigin = r.transformOrigin, r.width === null ? s.style.removeProperty("width") : s.style.width = r.width, r.height === null ? s.style.removeProperty("height") : s.style.height = r.height, r.willChange === null ? s.style.removeProperty("will-change") : s.style.willChange = r.willChange, h.current = null, typeof process < "u" && process.env?.NODE_ENV === "development" && console.debug("[useNeutralizeBodyZoom] restored original styles");
293
+ const u = 1 / a;
294
+ g && (d.style.width = `${a * 100}%`, d.style.height = `${a * 100}%`), d.style.transformOrigin = "50% 50%", d.style.transform = `scale(${u})`, d.style.willChange = "transform";
295
+ }, I = () => {
296
+ if (!m.current) return;
297
+ const a = m.current;
298
+ d.style.transform = a.transform ?? "", d.style.transformOrigin = a.transformOrigin ?? "", d.style.width = a.width ?? "", d.style.height = a.height ?? "", d.style.willChange = a.willChange ?? "", m.current = null;
300
299
  };
301
- let E = 0;
302
- const x = () => {
303
- cancelAnimationFrame(E), E = requestAnimationFrame(H);
304
- }, I = new MutationObserver((r) => {
305
- for (const b of r)
306
- if (b.type === "attributes" && (b.attributeName === "style" || b.attributeName === "class")) {
307
- x();
300
+ let v = 0;
301
+ const z = () => {
302
+ cancelAnimationFrame(v), v = requestAnimationFrame(C);
303
+ }, S = new MutationObserver((a) => {
304
+ for (const u of a)
305
+ if (u.type === "attributes" && (u.attributeName === "style" || u.attributeName === "class")) {
306
+ z();
308
307
  break;
309
308
  }
310
309
  });
311
- return I.observe(document.body, { attributes: !0, attributeFilter: ["style", "class"] }), window.addEventListener("resize", x), x(), () => {
312
- cancelAnimationFrame(E), I.disconnect(), window.removeEventListener("resize", x), z();
310
+ return S.observe(document.body, { attributes: !0, attributeFilter: ["style", "class"] }), window.addEventListener("resize", z), z(), () => {
311
+ cancelAnimationFrame(v), S.disconnect(), window.removeEventListener("resize", z), I();
313
312
  };
314
- }, [l, i, u]);
313
+ }, [i, o, g]);
315
314
  }
316
- function We() {
317
- const l = _(null), f = _(null), [h, i] = c(null);
318
- Le(l, { minDesktopWidth: 1200, forceResize: !1 }), V(() => (Ie(), () => {
315
+ function Ie({
316
+ gameCubeSize: i,
317
+ screenHeight: y,
318
+ screenWidth: m
319
+ }) {
320
+ const o = U(null), g = U(null), [d, B] = l(null);
321
+ ze(o, { minDesktopWidth: 1200, forceResize: !1 }), oe(() => (ke(), () => {
319
322
  document.body.style.overflow = "";
320
323
  }), []);
321
- const [u, s] = c(null), [S, H] = c([]), [z, E] = c(4), [x, I] = c(!1), [r, b] = c(1), [y, T] = c(null), [a, C] = c("ready"), [M, Z] = c(3), [j, F] = c(10), [O, K] = c(20), [le, $] = c(0), [A, D] = c(!1), [W, U] = c(""), [R, G] = c(!1), [P, J] = c(!1), [Q, B] = c(null), [ae, q] = c([]), [de, X] = c([]), [w, ce] = c(!1), [L, ee] = c(null);
322
- se(() => {
323
- const e = f.current;
324
+ const [C, I] = l(null), [v, z] = l([]), [S, a] = l(4), [u, T] = l(!1), [k, h] = l(1), [x, A] = l(null), [b, L] = l("ready"), [V, Z] = l(3), [F, $] = l(10), [G, _] = l(20), [se, N] = l(0), [j, O] = l(!1), [E, K] = l(""), [M, D] = l(!1), [q, J] = l(!1), [Q, W] = l(null), [le, Y] = l([]), [ae, X] = l([]), [w, Se] = l(!1);
325
+ re(() => {
326
+ const e = g.current;
324
327
  if (!e || typeof window > "u") return;
325
- let o = null;
328
+ let r = null;
326
329
  try {
327
- o = new ResizeObserver((g) => {
328
- for (const d of g) {
329
- const p = d.contentRect;
330
- i(Math.round(Math.min(p.width, p.height)));
330
+ r = new ResizeObserver((p) => {
331
+ for (const c of p) {
332
+ const f = c.contentRect;
333
+ B(Math.round(Math.min(f.width, f.height)));
331
334
  }
332
- }), o.observe(e), i(Math.round(Math.min(e.clientWidth, e.clientHeight)));
335
+ }), r.observe(e), B(Math.round(Math.min(e.clientWidth, e.clientHeight)));
333
336
  } catch {
334
- i(Math.round(Math.min(e.clientWidth, e.clientHeight)));
337
+ B(Math.round(Math.min(e.clientWidth, e.clientHeight)));
335
338
  }
336
- return () => {
337
- o && o.disconnect();
338
- };
339
- }, [w]), V(() => {
340
- const e = () => {
341
- const g = window.visualViewport, d = g ? Math.round(g.width) : window.innerWidth, p = g ? Math.round(g.height) : window.innerHeight, k = 820, v = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || "ontouchstart" in window), N = d <= k || v && p > d;
342
- if (ce(N), N) {
343
- ee(null);
344
- return;
345
- }
346
- const pe = 0.88, fe = 1e3, ie = 40, ye = Math.max(360, d - ie), be = Math.max(360, p - ie), xe = Math.min(ye, be), we = Math.max(360, Math.round(xe * pe)), ve = Math.min(we, fe);
347
- ee(ve);
348
- };
349
- e(), window.addEventListener("resize", e);
350
- const o = window.visualViewport;
351
- return o && typeof o.addEventListener == "function" && (o.addEventListener("resize", e), o.addEventListener("scroll", e)), () => {
352
- window.removeEventListener("resize", e), o && typeof o.removeEventListener == "function" && (o.removeEventListener("resize", e), o.removeEventListener("scroll", e));
353
- };
354
- }, []);
355
- const te = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), ne = () => {
356
- if (!u) return;
357
- const e = te(re[u]);
358
- H(e), I(!0), D(!1), b(1), $(0), q([]), X([]), oe(e, [], !0);
359
- }, oe = (e = S, o = de, g = !1) => {
360
- const d = te(e.length ? e : re[u]);
361
- let p = Math.floor(Math.random() * d.length), k = d[p].name, v = 0;
362
- for (; o.includes(k) && v < 20; )
363
- p = Math.floor(Math.random() * d.length), k = d[p].name, v++;
364
- H(d), T(p), X([...o, k]), G(!1), U(""), K(20), B(null), g ? (C("ready"), Z(3), F(10)) : (C("memorize"), F(10));
339
+ return () => r?.disconnect();
340
+ }, [w]);
341
+ const ee = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), te = () => {
342
+ if (!C) return;
343
+ const e = ee(ie[C]);
344
+ z(e), T(!0), O(!1), h(1), N(0), Y([]), X([]), ne(e, [], !0);
345
+ }, ne = (e = v, r = ae, p = !1) => {
346
+ const c = ee(e.length ? e : ie[C]);
347
+ let f = Math.floor(Math.random() * c.length), H = c[f].name, R = 0;
348
+ for (; r.includes(H) && R < 20; )
349
+ f = Math.floor(Math.random() * c.length), H = c[f].name, R++;
350
+ z(c), A(f), X([...r, H]), D(!1), K(""), _(20), W(null), p ? (L("ready"), Z(3), $(10)) : (L("memorize"), $(10));
365
351
  };
366
- V(() => {
367
- if (!(!x || A || R)) {
368
- if (a === "ready")
369
- if (M <= 0) C("memorize");
352
+ oe(() => {
353
+ if (!(!u || j || M)) {
354
+ if (b === "ready")
355
+ if (V <= 0) L("memorize");
370
356
  else {
371
- const e = setTimeout(() => Z((o) => o - 1), 1e3);
357
+ const e = setTimeout(() => Z((r) => r - 1), 1e3);
372
358
  return () => clearTimeout(e);
373
359
  }
374
- if (a === "memorize")
375
- if (j <= 0) C("guess");
360
+ if (b === "memorize")
361
+ if (F <= 0) L("guess");
376
362
  else {
377
- const e = setTimeout(() => F((o) => o - 1), 1e3);
363
+ const e = setTimeout(() => $((r) => r - 1), 1e3);
378
364
  return () => clearTimeout(e);
379
365
  }
380
- if (a === "guess") {
381
- if (O <= 0) {
382
- G(!0), B("wrong");
383
- const o = S[y].name;
384
- q((g) => [
385
- ...g,
386
- { round: r, answer: W, correct: o, result: "wrong" }
387
- ]);
366
+ if (b === "guess") {
367
+ if (G <= 0) {
368
+ D(!0), W("wrong");
369
+ const r = v[x].name;
370
+ Y((p) => [...p, { round: k, answer: E, correct: r, result: "wrong" }]);
388
371
  return;
389
372
  }
390
- const e = setTimeout(() => K((o) => o - 1), 1e3);
373
+ const e = setTimeout(() => _((r) => r - 1), 1e3);
391
374
  return () => clearTimeout(e);
392
375
  }
393
376
  }
394
- }, [a, M, j, O, x, A, R, S, y, r, W]);
395
- const me = () => {
396
- if (y === null || P) return;
397
- const e = S[y].name, o = W.toLowerCase().trim();
398
- let g = "wrong";
399
- o === e ? ($((d) => d + 1), B("correct"), g = "correct") : Be(o, e) === 1 ? ($((d) => d + 0.5), B("almost"), g = "almost") : (B("wrong"), g = "wrong"), q((d) => [...d, { round: r, answer: o, correct: e, result: g }]), J(!0), setTimeout(() => {
400
- J(!1), G(!0);
377
+ }, [b, V, F, G, u, j, M, v, x, k, E]);
378
+ const de = () => {
379
+ if (x === null || q) return;
380
+ const e = v[x].name, r = E.toLowerCase().trim();
381
+ let p = "wrong";
382
+ r === e ? (N((c) => c + 1), W("correct"), p = "correct") : Ce(r, e) === 1 ? (N((c) => c + 0.5), W("almost"), p = "almost") : (W("wrong"), p = "wrong"), Y((c) => [...c, { round: k, answer: r, correct: e, result: p }]), J(!0), setTimeout(() => {
383
+ J(!1), D(!0);
401
384
  }, 600);
402
- }, ue = () => r < z ? (b((e) => e + 1), oe()) : D(!0), ge = () => {
403
- I(!1), D(!1), s(null);
404
- }, he = Ce(
405
- () => (
406
- // ensure logo is positioned inside the square container
407
- /* @__PURE__ */ t("div", { style: { ...n.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ m("picture", { children: [
408
- /* @__PURE__ */ t("source", { srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg", type: "image/svg+xml" }),
409
- /* @__PURE__ */ t("img", { src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png", alt: "SPEAKID Logo", style: n.gmLogoImg, loading: "lazy" })
410
- ] }) })
411
- ),
385
+ }, ce = () => k < S ? (h((e) => e + 1), ne()) : O(!0), me = () => {
386
+ T(!1), O(!1), I(null);
387
+ }, ge = pe(
388
+ () => /* @__PURE__ */ t("div", { style: { ...n.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ s("picture", { children: [
389
+ /* @__PURE__ */ t("source", { srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg", type: "image/svg+xml" }),
390
+ /* @__PURE__ */ t("img", { src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png", alt: "SPEAKID Logo", style: n.gmLogoImg, loading: "lazy" })
391
+ ] }) }),
412
392
  []
413
393
  );
414
394
  return /* @__PURE__ */ t(
415
395
  "div",
416
396
  {
417
- ref: l,
397
+ ref: o,
418
398
  style: {
419
- // center relative to viewport so site layout doesn't push the game off-center
420
- position: "absolute",
399
+ position: "fixed",
421
400
  inset: 0,
422
401
  display: "flex",
423
402
  justifyContent: "center",
@@ -425,18 +404,18 @@ function We() {
425
404
  background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
426
405
  transition: "background 0.3s ease",
427
406
  overflow: "hidden",
428
- zIndex: 1,
407
+ zIndex: 9999,
429
408
  pointerEvents: "auto"
430
409
  },
431
410
  children: /* @__PURE__ */ t(
432
411
  "div",
433
412
  {
434
- ref: f,
413
+ ref: g,
435
414
  style: {
436
- width: w ? "100%" : L ? `${L}px` : "1000px",
437
- height: w ? "100%" : L ? `${L}px` : "1000px",
415
+ width: i ? `${i}px` : w ? "100%" : "1000px",
416
+ height: i ? `${i}px` : w ? "100%" : "1000px",
438
417
  maxWidth: "calc(100vw - 24px)",
439
- maxHeight: "calc(100vh - 40px)",
418
+ maxHeight: "calc(100vh - 20px)",
440
419
  display: "flex",
441
420
  justifyContent: "center",
442
421
  alignItems: "center",
@@ -458,69 +437,69 @@ function We() {
458
437
  justifyContent: "center",
459
438
  alignItems: "center"
460
439
  },
461
- children: /* @__PURE__ */ m("div", { id: "whats-missing-root", children: [
462
- !w && he,
463
- !u && !x && /* @__PURE__ */ m("div", { style: n.gmCenterScreen, children: [
440
+ children: /* @__PURE__ */ s("div", { id: "whats-missing-root", children: [
441
+ !w && ge,
442
+ !C && !u && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
464
443
  /* @__PURE__ */ t("h1", { style: n.gmHeadline1, children: "WHAT'S MISSING?" }),
465
444
  /* @__PURE__ */ t("p", { style: n.gmBodyM, children: "Select a theme:" }),
466
- /* @__PURE__ */ t("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ t("button", { style: n.gmButton, onClick: () => s(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
467
- /* @__PURE__ */ m("div", { style: { marginTop: 24 }, children: [
445
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ t("button", { style: n.gmButton, onClick: () => I(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
446
+ /* @__PURE__ */ s("div", { style: { marginTop: 24 }, children: [
468
447
  /* @__PURE__ */ t("p", { style: n.gmBodyS, children: "Choose number of rounds:" }),
469
448
  /* @__PURE__ */ t("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ t(
470
449
  "button",
471
450
  {
472
451
  style: {
473
452
  ...n.gmButton,
474
- ...z === e ? n.gmButtonActive : {}
453
+ ...S === e ? n.gmButtonActive : {}
475
454
  },
476
- onClick: () => E(e),
455
+ onClick: () => a(e),
477
456
  children: e
478
457
  },
479
458
  e
480
459
  )) })
481
460
  ] })
482
461
  ] }),
483
- u && !x && /* @__PURE__ */ m("div", { style: n.gmCenterScreen, children: [
484
- /* @__PURE__ */ m("h1", { style: n.gmHeadline1, children: [
462
+ C && !u && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
463
+ /* @__PURE__ */ s("h1", { style: n.gmHeadline1, children: [
485
464
  "Theme selected: ",
486
- u
465
+ C
487
466
  ] }),
488
- /* @__PURE__ */ m("p", { style: n.gmBodyM, children: [
467
+ /* @__PURE__ */ s("p", { style: n.gmBodyM, children: [
489
468
  "Rounds: ",
490
- z
469
+ S
491
470
  ] }),
492
- /* @__PURE__ */ t("button", { style: n.gmButton, onClick: ne, children: "▶ Start game" })
471
+ /* @__PURE__ */ t("button", { style: n.gmButton, onClick: te, children: "▶ Start game" })
493
472
  ] }),
494
- A && /* @__PURE__ */ m("div", { style: n.gmCenterScreen, children: [
473
+ j && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
495
474
  /* @__PURE__ */ t("h1", { style: n.gmHeadline1, children: "Results" }),
496
- /* @__PURE__ */ m("h2", { style: n.gmHeadline3, children: [
475
+ /* @__PURE__ */ s("h2", { style: n.gmHeadline3, children: [
497
476
  "Your score: ",
498
- le,
477
+ se,
499
478
  " / ",
500
- z
479
+ S
501
480
  ] }),
502
481
  /* @__PURE__ */ t("p", { style: { ...n.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
503
- /* @__PURE__ */ m("table", { style: n.gmTable, children: [
504
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ m("tr", { children: [
482
+ /* @__PURE__ */ s("table", { style: n.gmTable, children: [
483
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ s("tr", { children: [
505
484
  /* @__PURE__ */ t("th", { children: "Round" }),
506
485
  /* @__PURE__ */ t("th", { children: "Your Answer" }),
507
486
  /* @__PURE__ */ t("th", { children: "Correct" }),
508
487
  /* @__PURE__ */ t("th", { children: "Result" })
509
488
  ] }) }),
510
- /* @__PURE__ */ t("tbody", { children: ae.map((e, o) => /* @__PURE__ */ m("tr", { children: [
489
+ /* @__PURE__ */ t("tbody", { children: le.map((e, r) => /* @__PURE__ */ s("tr", { children: [
511
490
  /* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.round }),
512
491
  /* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.answer || "—" }),
513
492
  /* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.correct }),
514
493
  /* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
515
- ] }, o)) })
494
+ ] }, r)) })
516
495
  ] }),
517
- /* @__PURE__ */ m("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
518
- /* @__PURE__ */ t("button", { style: n.gmButton, onClick: ne, children: "🔁 Play again" }),
519
- /* @__PURE__ */ t("button", { style: n.gmButton, onClick: ge, children: "⬅️ Choose theme" })
496
+ /* @__PURE__ */ s("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
497
+ /* @__PURE__ */ t("button", { style: n.gmButton, onClick: te, children: "🔁 Play again" }),
498
+ /* @__PURE__ */ t("button", { style: n.gmButton, onClick: me, children: "⬅️ Choose theme" })
520
499
  ] })
521
500
  ] }),
522
- x && !A && /* @__PURE__ */ m("div", { style: n.gmGameLayout, children: [
523
- /* @__PURE__ */ m(
501
+ u && !j && /* @__PURE__ */ s("div", { style: n.gmGameLayout, children: [
502
+ /* @__PURE__ */ s(
524
503
  "div",
525
504
  {
526
505
  style: {
@@ -531,79 +510,79 @@ function We() {
531
510
  alignItems: "center"
532
511
  },
533
512
  children: [
534
- a === "ready" && /* @__PURE__ */ m(ze, { children: [
513
+ b === "ready" && /* @__PURE__ */ s(he, { children: [
535
514
  /* @__PURE__ */ t("h1", { style: { ...n.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
536
515
  /* @__PURE__ */ t("div", { style: n.gmHourglass, children: "⏳" })
537
516
  ] }),
538
- a === "memorize" && /* @__PURE__ */ m("p", { style: { ...n.gmBodyM, color: "#10b981" }, children: [
517
+ b === "memorize" && /* @__PURE__ */ s("p", { style: { ...n.gmBodyM, color: "#10b981" }, children: [
539
518
  "MEMORIZE (",
540
- j,
519
+ F,
541
520
  ")"
542
521
  ] }),
543
- a === "guess" && !R && /* @__PURE__ */ m("p", { style: n.gmBodyM, children: [
522
+ b === "guess" && !M && /* @__PURE__ */ s("p", { style: n.gmBodyM, children: [
544
523
  "⏳ Time left: ",
545
- O,
524
+ G,
546
525
  "s"
547
526
  ] })
548
527
  ]
549
528
  }
550
529
  ),
551
- a !== "ready" && (() => {
552
- const e = w ? 12 : 20, o = 32, g = h ?? L ?? (w ? 360 : 1e3), d = w ? 2 : 3, p = Math.max(
530
+ b !== "ready" && (() => {
531
+ const e = w ? 12 : 20, r = 32, p = i ?? d ?? (w ? 360 : 1e3), c = w ? 2 : 3, f = Math.max(
553
532
  90,
554
- Math.floor((g - o - e * (d - 1)) / d)
533
+ Math.floor((p - r - e * (c - 1)) / c)
555
534
  );
556
535
  return /* @__PURE__ */ t(
557
536
  "div",
558
537
  {
559
538
  style: {
560
539
  ...n.gmGrid,
561
- gridTemplateColumns: `repeat(${d}, ${p}px)`,
562
- gridAutoRows: `${p}px`,
540
+ gridTemplateColumns: `repeat(${c}, ${f}px)`,
541
+ gridAutoRows: `${f}px`,
563
542
  gap: `${e}px`,
564
543
  justifyContent: "center",
565
544
  justifyItems: "center",
566
545
  padding: 8,
567
546
  boxSizing: "border-box"
568
547
  },
569
- children: S.map((k, v) => {
570
- const N = y === v && a === "guess" && !R;
548
+ children: v.map((H, R) => {
549
+ const ue = x === R && b === "guess" && !M;
571
550
  return /* @__PURE__ */ t(
572
551
  "div",
573
552
  {
574
553
  style: {
575
554
  ...n.gmCard,
576
- width: `${p}px`,
577
- height: `${p}px`,
555
+ width: `${f}px`,
556
+ height: `${f}px`,
578
557
  padding: w ? 8 : 10,
579
558
  boxSizing: "border-box",
580
- ...Q === "correct" && y === v ? n.gmCorrect : {},
581
- ...Q === "wrong" && y === v ? n.gmWrong : {}
559
+ ...Q === "correct" && x === R ? n.gmCorrect : {},
560
+ ...Q === "wrong" && x === R ? n.gmWrong : {}
582
561
  },
583
- children: !N && /* @__PURE__ */ t(
562
+ children: !ue && /* @__PURE__ */ t(
584
563
  "img",
585
564
  {
586
- src: k.src,
587
- alt: k.name,
565
+ src: H.src,
566
+ alt: H.name,
588
567
  style: { width: "100%", height: "100%", objectFit: "cover", display: "block" }
589
568
  }
590
569
  )
591
570
  },
592
- v
571
+ R
593
572
  );
594
573
  })
595
574
  }
596
575
  );
597
576
  })(),
598
- /* @__PURE__ */ m("div", { style: { marginTop: 16, height: 80 }, children: [
599
- a === "guess" && !R && /* @__PURE__ */ m("div", { children: [
577
+ /* @__PURE__ */ s("div", { style: { marginTop: 16, height: 80 }, children: [
578
+ b === "guess" && !M && /* @__PURE__ */ s("div", { children: [
600
579
  /* @__PURE__ */ t(
601
580
  "input",
602
581
  {
603
582
  type: "text",
604
583
  placeholder: "Type the missing word",
605
- value: W,
606
- onChange: (e) => U(e.target.value),
584
+ value: E,
585
+ onChange: (e) => K(e.target.value),
607
586
  style: n.gmInput
608
587
  }
609
588
  ),
@@ -611,13 +590,13 @@ function We() {
611
590
  "button",
612
591
  {
613
592
  style: { ...n.gmButton, marginLeft: 8 },
614
- onClick: me,
615
- disabled: P,
616
- children: P ? "..." : "Check"
593
+ onClick: de,
594
+ disabled: q,
595
+ children: q ? "..." : "Check"
617
596
  }
618
597
  )
619
598
  ] }),
620
- R && /* @__PURE__ */ t("button", { type: "button", style: n.gmButton, onClick: ue, children: "Next round" })
599
+ M && /* @__PURE__ */ t("button", { type: "button", style: n.gmButton, onClick: ce, children: "Next round" })
621
600
  ] })
622
601
  ] })
623
602
  ] })
@@ -629,6 +608,6 @@ function We() {
629
608
  );
630
609
  }
631
610
  export {
632
- We as Game,
633
- re as themes
611
+ Ie as Game,
612
+ ie as themes
634
613
  };