@mblinkov/whats-missing 20.0.14 → 20.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/whats-missing.cjs.js +4 -17
- package/dist/whats-missing.es.js +232 -314
- package/package.json +1 -1
- package/src/Game.tsx +203 -285
package/dist/whats-missing.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
const
|
|
4
|
-
src: `${
|
|
1
|
+
import { jsx as t, jsxs as r, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as de, useEffect as j, useState as s, useMemo as ce } from "react";
|
|
3
|
+
const me = window.origin + "/cloud/speakid/games/whatsmissing/", W = (l, a) => l.map(([d, o]) => ({
|
|
4
|
+
src: `${me}${a}/${o.replace(/\s/g, "%20")}.png`,
|
|
5
5
|
name: o
|
|
6
|
-
})),
|
|
6
|
+
})), ge = [
|
|
7
7
|
["apple", "apple"],
|
|
8
8
|
["banana", "banana"],
|
|
9
9
|
["bread", "bread"],
|
|
@@ -29,7 +29,7 @@ const de = window.origin + "/cloud/speakid/games/whatsmissing/", W = (l, a) => l
|
|
|
29
29
|
["strawberry", "strawberry"],
|
|
30
30
|
["tomato", "tomato"],
|
|
31
31
|
["watermelon", "watermelon"]
|
|
32
|
-
],
|
|
32
|
+
], he = [
|
|
33
33
|
["bear", "bear"],
|
|
34
34
|
["cat", "cat"],
|
|
35
35
|
["crocodile", "crocodile"],
|
|
@@ -49,7 +49,7 @@ const de = window.origin + "/cloud/speakid/games/whatsmissing/", W = (l, a) => l
|
|
|
49
49
|
["tortoise", "tortoise"],
|
|
50
50
|
["wolf", "wolf"],
|
|
51
51
|
["zebra", "zebra"]
|
|
52
|
-
],
|
|
52
|
+
], pe = [
|
|
53
53
|
["ball", "ball"],
|
|
54
54
|
["balloon", "balloon"],
|
|
55
55
|
["blocks", "blocks"],
|
|
@@ -69,11 +69,11 @@ const de = window.origin + "/cloud/speakid/games/whatsmissing/", W = (l, a) => l
|
|
|
69
69
|
["teddy_bear", "teddy bear"],
|
|
70
70
|
["yo-yo", "yo-yo"],
|
|
71
71
|
["crayons", "crayons"]
|
|
72
|
-
],
|
|
73
|
-
food: W(
|
|
74
|
-
animals: W(
|
|
75
|
-
toys: W(
|
|
76
|
-
},
|
|
72
|
+
], Z = {
|
|
73
|
+
food: W(ge, "food"),
|
|
74
|
+
animals: W(he, "animals"),
|
|
75
|
+
toys: W(pe, "toys")
|
|
76
|
+
}, ue = `
|
|
77
77
|
@keyframes spin {
|
|
78
78
|
from { transform: rotate(0deg); }
|
|
79
79
|
to { transform: rotate(360deg); }
|
|
@@ -81,11 +81,11 @@ const de = window.origin + "/cloud/speakid/games/whatsmissing/", W = (l, a) => l
|
|
|
81
81
|
`;
|
|
82
82
|
if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
|
|
83
83
|
const l = document.createElement("style");
|
|
84
|
-
l.id = "spin-keyframes", l.innerHTML =
|
|
84
|
+
l.id = "spin-keyframes", l.innerHTML = ue, document.head.appendChild(l);
|
|
85
85
|
}
|
|
86
|
-
const
|
|
86
|
+
const fe = {
|
|
87
87
|
animation: "spin 1.4s linear infinite"
|
|
88
|
-
},
|
|
88
|
+
}, n = {
|
|
89
89
|
gmCenterScreen: {
|
|
90
90
|
position: "relative",
|
|
91
91
|
zIndex: 1,
|
|
@@ -233,382 +233,300 @@ const pe = {
|
|
|
233
233
|
},
|
|
234
234
|
gmHourglass: {
|
|
235
235
|
fontSize: "42px",
|
|
236
|
-
...
|
|
236
|
+
...fe
|
|
237
237
|
}
|
|
238
|
-
},
|
|
238
|
+
}, ye = () => {
|
|
239
239
|
const l = document.createElement("style");
|
|
240
240
|
l.textContent = `
|
|
241
|
-
html, body {
|
|
242
|
-
margin: 0;
|
|
243
|
-
padding: 0;
|
|
244
|
-
width: 100%;
|
|
245
|
-
height: 100%;
|
|
246
|
-
overflow: hidden;
|
|
247
|
-
background: radial-gradient(circle at center, #fff8f8 0%, #fdfdfd 80%, #ffffff 100%);
|
|
248
|
-
background-repeat: no-repeat;
|
|
249
|
-
background-size: cover;
|
|
250
|
-
transform-origin: center;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
241
|
#whats-missing-root, #whats-missing-root * {
|
|
254
242
|
box-sizing: border-box;
|
|
255
243
|
font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|
|
256
|
-
transform: none !important;
|
|
257
244
|
}
|
|
258
|
-
|
|
259
245
|
#whats-missing-root img {
|
|
260
246
|
max-width: 100%;
|
|
261
247
|
height: auto;
|
|
262
248
|
display: block;
|
|
263
249
|
user-select: none;
|
|
264
250
|
}
|
|
251
|
+
html, body { margin: 0; padding: 0; }
|
|
265
252
|
`, document.head.appendChild(l);
|
|
266
|
-
},
|
|
267
|
-
const d = Array.from(
|
|
268
|
-
{ length: l.length + 1 },
|
|
269
|
-
() => Array(a.length + 1).fill(0)
|
|
270
|
-
);
|
|
253
|
+
}, be = (l, a) => {
|
|
254
|
+
const d = Array.from({ length: l.length + 1 }, () => Array(a.length + 1).fill(0));
|
|
271
255
|
for (let o = 0; o <= l.length; o++) d[o][0] = o;
|
|
272
256
|
for (let o = 0; o <= a.length; o++) d[0][o] = o;
|
|
273
257
|
for (let o = 1; o <= l.length; o++)
|
|
274
|
-
for (let
|
|
275
|
-
d[o][
|
|
258
|
+
for (let m = 1; m <= a.length; m++)
|
|
259
|
+
d[o][m] = l[o - 1] === a[m - 1] ? d[o - 1][m - 1] : Math.min(d[o - 1][m - 1], d[o][m - 1], d[o - 1][m]) + 1;
|
|
276
260
|
return d[l.length][a.length];
|
|
277
261
|
};
|
|
278
|
-
function
|
|
279
|
-
const l =
|
|
280
|
-
j(() => (
|
|
262
|
+
function ke() {
|
|
263
|
+
const l = de(null);
|
|
264
|
+
j(() => (ye(), () => {
|
|
281
265
|
document.body.style.overflow = "";
|
|
282
266
|
}), []);
|
|
283
|
-
const [a, d] = s(null), [o,
|
|
284
|
-
null
|
|
285
|
-
), [X, B] = s([]), [ee, V] = s([]), [C, te] = s(!1);
|
|
267
|
+
const [a, d] = s(null), [o, m] = s([]), [w, J] = s(4), [b, E] = s(!1), [k, G] = s(1), [u, Q] = s(null), [h, v] = s("ready"), [F, Y] = s(3), [S, z] = s(10), [R, D] = s(20), [X, I] = s(0), [C, H] = s(!1), [T, U] = s(""), [f, M] = s(!1), [A, $] = s(!1), [N, x] = s(null), [ee, B] = s([]), [te, O] = s([]), [p, ne] = s(!1), [oe, P] = s(1);
|
|
286
268
|
j(() => {
|
|
287
|
-
const e = () =>
|
|
269
|
+
const e = () => {
|
|
270
|
+
const i = window.innerWidth < 768;
|
|
271
|
+
if (ne(i), i)
|
|
272
|
+
P(1);
|
|
273
|
+
else {
|
|
274
|
+
const y = Math.min(window.innerWidth / 1440, window.innerHeight / 768);
|
|
275
|
+
P(y);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
288
278
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
289
279
|
}, []);
|
|
290
|
-
const
|
|
280
|
+
const V = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), _ = () => {
|
|
291
281
|
if (!a) return;
|
|
292
|
-
const e =
|
|
293
|
-
|
|
294
|
-
}, q = (e = o,
|
|
295
|
-
const
|
|
296
|
-
let
|
|
297
|
-
for (;
|
|
298
|
-
|
|
299
|
-
c
|
|
282
|
+
const e = V(Z[a]);
|
|
283
|
+
m(e), E(!0), H(!1), G(1), I(0), B([]), O([]), q(e, [], !0);
|
|
284
|
+
}, q = (e = o, i = te, g = !1) => {
|
|
285
|
+
const c = V(e.length ? e : Z[a]);
|
|
286
|
+
let y = Math.floor(Math.random() * c.length), L = c[y].name, K = 0;
|
|
287
|
+
for (; i.includes(L) && K < 20; )
|
|
288
|
+
y = Math.floor(Math.random() * c.length), L = c[y].name, K++;
|
|
289
|
+
m(c), Q(y), O([...i, L]), M(!1), U(""), D(20), x(null), g ? (v("ready"), Y(3), z(10)) : (v("memorize"), z(10));
|
|
300
290
|
};
|
|
301
291
|
j(() => {
|
|
302
|
-
if (!(!
|
|
303
|
-
if (
|
|
304
|
-
if (F <= 0)
|
|
292
|
+
if (!(!b || C || f)) {
|
|
293
|
+
if (h === "ready")
|
|
294
|
+
if (F <= 0) v("memorize");
|
|
305
295
|
else {
|
|
306
|
-
const e = setTimeout(() =>
|
|
296
|
+
const e = setTimeout(() => Y((i) => i - 1), 1e3);
|
|
307
297
|
return () => clearTimeout(e);
|
|
308
298
|
}
|
|
309
|
-
if (
|
|
310
|
-
if (S <= 0)
|
|
299
|
+
if (h === "memorize")
|
|
300
|
+
if (S <= 0) v("guess");
|
|
311
301
|
else {
|
|
312
|
-
const e = setTimeout(() => z((
|
|
302
|
+
const e = setTimeout(() => z((i) => i - 1), 1e3);
|
|
313
303
|
return () => clearTimeout(e);
|
|
314
304
|
}
|
|
315
|
-
if (
|
|
305
|
+
if (h === "guess") {
|
|
316
306
|
if (R <= 0) {
|
|
317
|
-
M(!0),
|
|
318
|
-
const
|
|
319
|
-
B((
|
|
320
|
-
...
|
|
321
|
-
{
|
|
322
|
-
round: b,
|
|
323
|
-
answer: v,
|
|
324
|
-
correct: r,
|
|
325
|
-
result: "wrong"
|
|
326
|
-
}
|
|
307
|
+
M(!0), x("wrong");
|
|
308
|
+
const i = o[u].name;
|
|
309
|
+
B((g) => [
|
|
310
|
+
...g,
|
|
311
|
+
{ round: k, answer: T, correct: i, result: "wrong" }
|
|
327
312
|
]);
|
|
328
313
|
return;
|
|
329
314
|
}
|
|
330
|
-
const e = setTimeout(() =>
|
|
315
|
+
const e = setTimeout(() => D((i) => i - 1), 1e3);
|
|
331
316
|
return () => clearTimeout(e);
|
|
332
317
|
}
|
|
333
318
|
}
|
|
334
|
-
}, [
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
u,
|
|
342
|
-
o,
|
|
343
|
-
p,
|
|
344
|
-
b,
|
|
345
|
-
v
|
|
346
|
-
]);
|
|
347
|
-
const ne = () => {
|
|
348
|
-
if (p === null || A) return;
|
|
349
|
-
const e = o[p].name, r = v.toLowerCase().trim();
|
|
350
|
-
let h = "wrong";
|
|
351
|
-
r === e ? (I((m) => m + 1), y("correct"), h = "correct") : fe(r, e) === 1 ? (I((m) => m + 0.5), y("almost"), h = "almost") : (y("wrong"), h = "wrong"), B((m) => [
|
|
352
|
-
...m,
|
|
353
|
-
{ round: b, answer: r, correct: e, result: h }
|
|
354
|
-
]), N(!0), setTimeout(() => {
|
|
355
|
-
N(!1), M(!0);
|
|
319
|
+
}, [h, F, S, R, b, C, f, o, u, k, T]);
|
|
320
|
+
const ie = () => {
|
|
321
|
+
if (u === null || A) return;
|
|
322
|
+
const e = o[u].name, i = T.toLowerCase().trim();
|
|
323
|
+
let g = "wrong";
|
|
324
|
+
i === e ? (I((c) => c + 1), x("correct"), g = "correct") : be(i, e) === 1 ? (I((c) => c + 0.5), x("almost"), g = "almost") : (x("wrong"), g = "wrong"), B((c) => [...c, { round: k, answer: i, correct: e, result: g }]), $(!0), setTimeout(() => {
|
|
325
|
+
$(!1), M(!0);
|
|
356
326
|
}, 600);
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
},
|
|
360
|
-
() => /* @__PURE__ */
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
|
|
363
|
-
{
|
|
364
|
-
srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg",
|
|
365
|
-
type: "image/svg+xml"
|
|
366
|
-
}
|
|
367
|
-
),
|
|
368
|
-
/* @__PURE__ */ n(
|
|
369
|
-
"img",
|
|
370
|
-
{
|
|
371
|
-
src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png",
|
|
372
|
-
alt: "SPEAKID Logo",
|
|
373
|
-
style: t.gmLogoImg,
|
|
374
|
-
loading: "lazy"
|
|
375
|
-
}
|
|
376
|
-
)
|
|
327
|
+
}, re = () => k < w ? (G((e) => e + 1), q()) : H(!0), se = () => {
|
|
328
|
+
E(!1), H(!1), d(null);
|
|
329
|
+
}, le = ce(
|
|
330
|
+
() => /* @__PURE__ */ t("div", { style: n.gmLogoFixed, children: /* @__PURE__ */ r("picture", { children: [
|
|
331
|
+
/* @__PURE__ */ t("source", { srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg", type: "image/svg+xml" }),
|
|
332
|
+
/* @__PURE__ */ t("img", { src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png", alt: "SPEAKID Logo", style: n.gmLogoImg, loading: "lazy" })
|
|
377
333
|
] }) }),
|
|
378
334
|
[]
|
|
379
335
|
);
|
|
380
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ t(
|
|
381
337
|
"div",
|
|
382
338
|
{
|
|
383
339
|
ref: l,
|
|
384
340
|
style: {
|
|
341
|
+
width: "100%",
|
|
342
|
+
height: "100vh",
|
|
385
343
|
display: "flex",
|
|
386
344
|
justifyContent: "center",
|
|
387
345
|
alignItems: "center",
|
|
388
|
-
|
|
389
|
-
|
|
346
|
+
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
347
|
+
transition: "background 0.3s ease"
|
|
390
348
|
},
|
|
391
|
-
children: /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ t(
|
|
392
350
|
"div",
|
|
393
351
|
{
|
|
394
352
|
style: {
|
|
395
|
-
width:
|
|
396
|
-
height:
|
|
353
|
+
width: p ? "100%" : 1440,
|
|
354
|
+
height: p ? "100%" : 768,
|
|
397
355
|
display: "flex",
|
|
398
356
|
justifyContent: "center",
|
|
399
357
|
alignItems: "center",
|
|
400
|
-
flexDirection: "column",
|
|
401
358
|
overflow: "hidden",
|
|
402
|
-
borderRadius: "20px",
|
|
403
|
-
background: "
|
|
404
|
-
boxShadow: "0 0 40px rgba(0,0,0,0.
|
|
359
|
+
borderRadius: p ? 0 : "20px",
|
|
360
|
+
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
361
|
+
boxShadow: p ? "none" : "0 0 40px rgba(0,0,0,0.1)",
|
|
362
|
+
margin: p ? "0 auto" : "unset"
|
|
405
363
|
},
|
|
406
|
-
children: /* @__PURE__ */
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
"
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
"button",
|
|
424
|
-
{
|
|
425
|
-
style:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
},
|
|
429
|
-
onClick: () => Z(e),
|
|
430
|
-
children: e
|
|
431
|
-
},
|
|
432
|
-
e
|
|
433
|
-
)) })
|
|
434
|
-
] })
|
|
435
|
-
] }),
|
|
436
|
-
a && !f && /* @__PURE__ */ i("div", { style: t.gmCenterScreen, children: [
|
|
437
|
-
/* @__PURE__ */ i("h1", { style: t.gmHeadline1, children: [
|
|
438
|
-
"Theme selected: ",
|
|
439
|
-
a
|
|
440
|
-
] }),
|
|
441
|
-
/* @__PURE__ */ i("p", { style: t.gmBodyM, children: [
|
|
442
|
-
"Rounds: ",
|
|
443
|
-
x
|
|
444
|
-
] }),
|
|
445
|
-
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: $, children: "▶ Start game" })
|
|
446
|
-
] }),
|
|
447
|
-
k && /* @__PURE__ */ i("div", { style: t.gmCenterScreen, children: [
|
|
448
|
-
/* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "Results" }),
|
|
449
|
-
/* @__PURE__ */ i("h2", { style: t.gmHeadline3, children: [
|
|
450
|
-
"Your score: ",
|
|
451
|
-
Q,
|
|
452
|
-
" / ",
|
|
453
|
-
x
|
|
454
|
-
] }),
|
|
455
|
-
/* @__PURE__ */ n(
|
|
456
|
-
"p",
|
|
457
|
-
{
|
|
458
|
-
style: {
|
|
459
|
-
...t.gmBodyM,
|
|
460
|
-
color: "#10b981",
|
|
461
|
-
marginTop: 12
|
|
462
|
-
},
|
|
463
|
-
children: "Great job! 🎉 You did it!"
|
|
464
|
-
}
|
|
465
|
-
),
|
|
466
|
-
/* @__PURE__ */ i("table", { style: t.gmTable, children: [
|
|
467
|
-
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
468
|
-
/* @__PURE__ */ n("th", { children: "Round" }),
|
|
469
|
-
/* @__PURE__ */ n("th", { children: "Your Answer" }),
|
|
470
|
-
/* @__PURE__ */ n("th", { children: "Correct" }),
|
|
471
|
-
/* @__PURE__ */ n("th", { children: "Result" })
|
|
472
|
-
] }) }),
|
|
473
|
-
/* @__PURE__ */ n("tbody", { children: X.map((e, r) => /* @__PURE__ */ i("tr", { children: [
|
|
474
|
-
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.round }),
|
|
475
|
-
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.answer || "—" }),
|
|
476
|
-
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.correct }),
|
|
477
|
-
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
478
|
-
] }, r)) })
|
|
479
|
-
] }),
|
|
480
|
-
/* @__PURE__ */ i("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
481
|
-
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: $, children: "🔁 Play again" }),
|
|
482
|
-
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: re, children: "⬅️ Choose theme" })
|
|
483
|
-
] })
|
|
484
|
-
] }),
|
|
485
|
-
f && !k && /* @__PURE__ */ i("div", { style: t.gmGameLayout, children: [
|
|
486
|
-
/* @__PURE__ */ i(
|
|
487
|
-
"div",
|
|
488
|
-
{
|
|
489
|
-
style: {
|
|
490
|
-
minHeight: 160,
|
|
491
|
-
display: "flex",
|
|
492
|
-
flexDirection: "column",
|
|
493
|
-
justifyContent: "center",
|
|
494
|
-
alignItems: "center"
|
|
495
|
-
},
|
|
496
|
-
children: [
|
|
497
|
-
g === "ready" && /* @__PURE__ */ i(se, { children: [
|
|
498
|
-
/* @__PURE__ */ n(
|
|
499
|
-
"h1",
|
|
500
|
-
{
|
|
501
|
-
style: {
|
|
502
|
-
...t.gmHeadline1,
|
|
503
|
-
color: "#ec4c44"
|
|
504
|
-
},
|
|
505
|
-
children: "GET READY"
|
|
506
|
-
}
|
|
507
|
-
),
|
|
508
|
-
/* @__PURE__ */ n("div", { style: t.gmHourglass, children: "⏳" })
|
|
509
|
-
] }),
|
|
510
|
-
g === "memorize" && /* @__PURE__ */ i(
|
|
511
|
-
"p",
|
|
364
|
+
children: /* @__PURE__ */ t(
|
|
365
|
+
"div",
|
|
366
|
+
{
|
|
367
|
+
style: {
|
|
368
|
+
transform: p ? "none" : `scale(${oe})`,
|
|
369
|
+
transformOrigin: "center center",
|
|
370
|
+
width: "100%",
|
|
371
|
+
height: "100%",
|
|
372
|
+
display: "flex",
|
|
373
|
+
justifyContent: "center",
|
|
374
|
+
alignItems: "center"
|
|
375
|
+
},
|
|
376
|
+
children: /* @__PURE__ */ r("div", { id: "whats-missing-root", children: [
|
|
377
|
+
!p && le,
|
|
378
|
+
!a && !b && /* @__PURE__ */ r("div", { style: n.gmCenterScreen, children: [
|
|
379
|
+
/* @__PURE__ */ t("h1", { style: n.gmHeadline1, children: "WHAT'S MISSING?" }),
|
|
380
|
+
/* @__PURE__ */ t("p", { style: n.gmBodyM, children: "Select a theme:" }),
|
|
381
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ t("button", { style: n.gmButton, onClick: () => d(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
|
|
382
|
+
/* @__PURE__ */ r("div", { style: { marginTop: 24 }, children: [
|
|
383
|
+
/* @__PURE__ */ t("p", { style: n.gmBodyS, children: "Choose number of rounds:" }),
|
|
384
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ t(
|
|
385
|
+
"button",
|
|
512
386
|
{
|
|
513
387
|
style: {
|
|
514
|
-
...
|
|
515
|
-
|
|
388
|
+
...n.gmButton,
|
|
389
|
+
...w === e ? n.gmButtonActive : {}
|
|
516
390
|
},
|
|
517
|
-
|
|
391
|
+
onClick: () => J(e),
|
|
392
|
+
children: e
|
|
393
|
+
},
|
|
394
|
+
e
|
|
395
|
+
)) })
|
|
396
|
+
] })
|
|
397
|
+
] }),
|
|
398
|
+
a && !b && /* @__PURE__ */ r("div", { style: n.gmCenterScreen, children: [
|
|
399
|
+
/* @__PURE__ */ r("h1", { style: n.gmHeadline1, children: [
|
|
400
|
+
"Theme selected: ",
|
|
401
|
+
a
|
|
402
|
+
] }),
|
|
403
|
+
/* @__PURE__ */ r("p", { style: n.gmBodyM, children: [
|
|
404
|
+
"Rounds: ",
|
|
405
|
+
w
|
|
406
|
+
] }),
|
|
407
|
+
/* @__PURE__ */ t("button", { style: n.gmButton, onClick: _, children: "▶ Start game" })
|
|
408
|
+
] }),
|
|
409
|
+
C && /* @__PURE__ */ r("div", { style: n.gmCenterScreen, children: [
|
|
410
|
+
/* @__PURE__ */ t("h1", { style: n.gmHeadline1, children: "Results" }),
|
|
411
|
+
/* @__PURE__ */ r("h2", { style: n.gmHeadline3, children: [
|
|
412
|
+
"Your score: ",
|
|
413
|
+
X,
|
|
414
|
+
" / ",
|
|
415
|
+
w
|
|
416
|
+
] }),
|
|
417
|
+
/* @__PURE__ */ t("p", { style: { ...n.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
|
|
418
|
+
/* @__PURE__ */ r("table", { style: n.gmTable, children: [
|
|
419
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ r("tr", { children: [
|
|
420
|
+
/* @__PURE__ */ t("th", { children: "Round" }),
|
|
421
|
+
/* @__PURE__ */ t("th", { children: "Your Answer" }),
|
|
422
|
+
/* @__PURE__ */ t("th", { children: "Correct" }),
|
|
423
|
+
/* @__PURE__ */ t("th", { children: "Result" })
|
|
424
|
+
] }) }),
|
|
425
|
+
/* @__PURE__ */ t("tbody", { children: ee.map((e, i) => /* @__PURE__ */ r("tr", { children: [
|
|
426
|
+
/* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.round }),
|
|
427
|
+
/* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.answer || "—" }),
|
|
428
|
+
/* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.correct }),
|
|
429
|
+
/* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
430
|
+
] }, i)) })
|
|
431
|
+
] }),
|
|
432
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
433
|
+
/* @__PURE__ */ t("button", { style: n.gmButton, onClick: _, children: "🔁 Play again" }),
|
|
434
|
+
/* @__PURE__ */ t("button", { style: n.gmButton, onClick: se, children: "⬅️ Choose theme" })
|
|
435
|
+
] })
|
|
436
|
+
] }),
|
|
437
|
+
b && !C && /* @__PURE__ */ r("div", { style: n.gmGameLayout, children: [
|
|
438
|
+
/* @__PURE__ */ r(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
style: {
|
|
442
|
+
minHeight: 160,
|
|
443
|
+
display: "flex",
|
|
444
|
+
flexDirection: "column",
|
|
445
|
+
justifyContent: "center",
|
|
446
|
+
alignItems: "center"
|
|
447
|
+
},
|
|
448
|
+
children: [
|
|
449
|
+
h === "ready" && /* @__PURE__ */ r(ae, { children: [
|
|
450
|
+
/* @__PURE__ */ t("h1", { style: { ...n.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
451
|
+
/* @__PURE__ */ t("div", { style: n.gmHourglass, children: "⏳" })
|
|
452
|
+
] }),
|
|
453
|
+
h === "memorize" && /* @__PURE__ */ r("p", { style: { ...n.gmBodyM, color: "#10b981" }, children: [
|
|
518
454
|
"MEMORIZE (",
|
|
519
455
|
S,
|
|
520
456
|
")"
|
|
521
|
-
]
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
] })
|
|
529
|
-
]
|
|
530
|
-
}
|
|
531
|
-
),
|
|
532
|
-
g !== "ready" && /* @__PURE__ */ n(
|
|
533
|
-
"div",
|
|
534
|
-
{
|
|
535
|
-
style: {
|
|
536
|
-
...t.gmGrid,
|
|
537
|
-
gridTemplateColumns: C ? "repeat(2, 1fr)" : "repeat(3, 210px)",
|
|
538
|
-
gridAutoRows: C ? "150px" : "210px",
|
|
539
|
-
gap: C ? "12px" : "20px",
|
|
540
|
-
justifyItems: "center"
|
|
541
|
-
},
|
|
542
|
-
children: o.map((e, r) => {
|
|
543
|
-
const h = p === r && g === "guess" && !u;
|
|
544
|
-
return /* @__PURE__ */ n(
|
|
545
|
-
"div",
|
|
546
|
-
{
|
|
547
|
-
style: {
|
|
548
|
-
...t.gmCard,
|
|
549
|
-
...P === "correct" && p === r ? t.gmCorrect : {},
|
|
550
|
-
...P === "wrong" && p === r ? t.gmWrong : {}
|
|
551
|
-
},
|
|
552
|
-
children: !h && /* @__PURE__ */ n(
|
|
553
|
-
"img",
|
|
554
|
-
{
|
|
555
|
-
src: e.src,
|
|
556
|
-
alt: e.name,
|
|
557
|
-
style: {
|
|
558
|
-
width: "100%",
|
|
559
|
-
height: "100%",
|
|
560
|
-
objectFit: "cover"
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
)
|
|
564
|
-
},
|
|
565
|
-
r
|
|
566
|
-
);
|
|
567
|
-
})
|
|
568
|
-
}
|
|
569
|
-
),
|
|
570
|
-
/* @__PURE__ */ i("div", { style: { marginTop: 16, height: 80 }, children: [
|
|
571
|
-
g === "guess" && !u && /* @__PURE__ */ i("div", { children: [
|
|
572
|
-
/* @__PURE__ */ n(
|
|
573
|
-
"input",
|
|
574
|
-
{
|
|
575
|
-
type: "text",
|
|
576
|
-
placeholder: "Type the missing word",
|
|
577
|
-
value: v,
|
|
578
|
-
onChange: (e) => U(e.target.value),
|
|
579
|
-
style: t.gmInput
|
|
457
|
+
] }),
|
|
458
|
+
h === "guess" && !f && /* @__PURE__ */ r("p", { style: n.gmBodyM, children: [
|
|
459
|
+
"⏳ Time left: ",
|
|
460
|
+
R,
|
|
461
|
+
"s"
|
|
462
|
+
] })
|
|
463
|
+
]
|
|
580
464
|
}
|
|
581
465
|
),
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
"
|
|
466
|
+
h !== "ready" && /* @__PURE__ */ t(
|
|
467
|
+
"div",
|
|
584
468
|
{
|
|
585
469
|
style: {
|
|
586
|
-
...
|
|
587
|
-
|
|
470
|
+
...n.gmGrid,
|
|
471
|
+
gridTemplateColumns: p ? "repeat(2, 1fr)" : "repeat(3, 210px)",
|
|
472
|
+
gridAutoRows: p ? "150px" : "210px",
|
|
473
|
+
gap: p ? "12px" : "20px",
|
|
474
|
+
justifyItems: "center"
|
|
588
475
|
},
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
476
|
+
children: o.map((e, i) => {
|
|
477
|
+
const g = u === i && h === "guess" && !f;
|
|
478
|
+
return /* @__PURE__ */ t(
|
|
479
|
+
"div",
|
|
480
|
+
{
|
|
481
|
+
style: {
|
|
482
|
+
...n.gmCard,
|
|
483
|
+
...N === "correct" && u === i ? n.gmCorrect : {},
|
|
484
|
+
...N === "wrong" && u === i ? n.gmWrong : {}
|
|
485
|
+
},
|
|
486
|
+
children: !g && /* @__PURE__ */ t(
|
|
487
|
+
"img",
|
|
488
|
+
{
|
|
489
|
+
src: e.src,
|
|
490
|
+
alt: e.name,
|
|
491
|
+
style: {
|
|
492
|
+
width: "100%",
|
|
493
|
+
height: "100%",
|
|
494
|
+
objectFit: "cover"
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
)
|
|
498
|
+
},
|
|
499
|
+
i
|
|
500
|
+
);
|
|
501
|
+
})
|
|
592
502
|
}
|
|
593
|
-
)
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
503
|
+
),
|
|
504
|
+
/* @__PURE__ */ r("div", { style: { marginTop: 16, height: 80 }, children: [
|
|
505
|
+
h === "guess" && !f && /* @__PURE__ */ r("div", { children: [
|
|
506
|
+
/* @__PURE__ */ t(
|
|
507
|
+
"input",
|
|
508
|
+
{
|
|
509
|
+
type: "text",
|
|
510
|
+
placeholder: "Type the missing word",
|
|
511
|
+
value: T,
|
|
512
|
+
onChange: (e) => U(e.target.value),
|
|
513
|
+
style: n.gmInput
|
|
514
|
+
}
|
|
515
|
+
),
|
|
516
|
+
/* @__PURE__ */ t("button", { style: { ...n.gmButton, marginLeft: 8 }, onClick: ie, disabled: A, children: A ? "..." : "Check" })
|
|
517
|
+
] }),
|
|
518
|
+
f && /* @__PURE__ */ t("button", { style: n.gmButton, onClick: re, children: "Next round" })
|
|
519
|
+
] })
|
|
520
|
+
] })
|
|
603
521
|
] })
|
|
604
|
-
|
|
605
|
-
|
|
522
|
+
}
|
|
523
|
+
)
|
|
606
524
|
}
|
|
607
525
|
)
|
|
608
526
|
}
|
|
609
527
|
);
|
|
610
528
|
}
|
|
611
529
|
export {
|
|
612
|
-
|
|
613
|
-
|
|
530
|
+
ke as Game,
|
|
531
|
+
Z as themes
|
|
614
532
|
};
|