speakid-build-a-sentence 1.0.20 → 1.0.22
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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as l, jsxs as y } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
2
|
+
import { useState as h, useCallback as we, useRef as Q, useEffect as V, useMemo as dn, Component as an } from "react";
|
|
3
|
+
const ln = `
|
|
4
4
|
@keyframes spin {
|
|
5
5
|
from { transform: rotate(0deg); }
|
|
6
6
|
to { transform: rotate(360deg); }
|
|
@@ -36,9 +36,9 @@ const dn = `
|
|
|
36
36
|
`;
|
|
37
37
|
if (typeof document < "u" && !document.getElementById("game-keyframes")) {
|
|
38
38
|
const w = document.createElement("style");
|
|
39
|
-
w.id = "game-keyframes", w.innerHTML =
|
|
39
|
+
w.id = "game-keyframes", w.innerHTML = ln, document.head.appendChild(w);
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const De = {
|
|
42
42
|
spin: {
|
|
43
43
|
animation: "spin 1.4s linear infinite"
|
|
44
44
|
},
|
|
@@ -168,60 +168,60 @@ const Te = {
|
|
|
168
168
|
},
|
|
169
169
|
gmHourglass: {
|
|
170
170
|
fontSize: "42px",
|
|
171
|
-
...
|
|
171
|
+
...De.spin
|
|
172
172
|
},
|
|
173
173
|
// ===== Анимационные стили =====
|
|
174
|
-
...
|
|
175
|
-
},
|
|
176
|
-
const [w, s] =
|
|
177
|
-
const
|
|
178
|
-
|
|
174
|
+
...De
|
|
175
|
+
}, cn = () => {
|
|
176
|
+
const [w, s] = h([]), H = we((z, E, m) => {
|
|
177
|
+
const W = [];
|
|
178
|
+
z.trim() || W.push({
|
|
179
179
|
type: "empty",
|
|
180
180
|
message: "Sentence cannot be empty"
|
|
181
|
-
}),
|
|
181
|
+
}), z.length > 41 && W.push({
|
|
182
182
|
type: "length",
|
|
183
|
-
message: `Sentence is too long (${
|
|
184
|
-
}),
|
|
183
|
+
message: `Sentence is too long (${z.length}/41 characters)`
|
|
184
|
+
}), z && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(z) && W.push({
|
|
185
185
|
type: "characters",
|
|
186
186
|
message: "Only Latin characters, numbers, spaces and punctuation are allowed"
|
|
187
187
|
});
|
|
188
|
-
const k =
|
|
189
|
-
return k !== -1 &&
|
|
188
|
+
const k = m.findIndex((R, ee) => ee !== E && R.toLowerCase().trim() === z.toLowerCase().trim());
|
|
189
|
+
return k !== -1 && W.push({
|
|
190
190
|
type: "duplicate",
|
|
191
191
|
message: `Duplicate sentence (same as sentence ${k + 1})`
|
|
192
|
-
}), s(
|
|
193
|
-
isValid:
|
|
194
|
-
errors:
|
|
192
|
+
}), s(W), {
|
|
193
|
+
isValid: W.length === 0,
|
|
194
|
+
errors: W
|
|
195
195
|
};
|
|
196
|
-
}, []),
|
|
197
|
-
const
|
|
198
|
-
return
|
|
199
|
-
const
|
|
200
|
-
|
|
196
|
+
}, []), le = we((z) => {
|
|
197
|
+
const E = [];
|
|
198
|
+
return z.forEach((m, W) => {
|
|
199
|
+
const b = H(m, W, z);
|
|
200
|
+
E.push(...b.errors.map((k) => ({
|
|
201
201
|
...k,
|
|
202
|
-
message: `Sentence ${
|
|
202
|
+
message: `Sentence ${W + 1}: ${k.message}`
|
|
203
203
|
})));
|
|
204
204
|
}), {
|
|
205
|
-
isValid:
|
|
206
|
-
errors:
|
|
205
|
+
isValid: E.length === 0,
|
|
206
|
+
errors: E
|
|
207
207
|
};
|
|
208
|
-
}, [
|
|
208
|
+
}, [H]), ce = we(() => {
|
|
209
209
|
s([]);
|
|
210
210
|
}, []);
|
|
211
211
|
return {
|
|
212
212
|
errors: w,
|
|
213
|
-
validateSentence:
|
|
214
|
-
validateAllSentences:
|
|
215
|
-
clearErrors:
|
|
213
|
+
validateSentence: H,
|
|
214
|
+
validateAllSentences: le,
|
|
215
|
+
clearErrors: ce
|
|
216
216
|
};
|
|
217
|
-
},
|
|
218
|
-
|
|
217
|
+
}, un = (w, s, H) => s && H ? `${w} word "${s}" ${H}` : s ? `${w} word "${s}"` : w, hn = (w, s, H = ["Enter", " "]) => {
|
|
218
|
+
H.includes(w.key) && (w.preventDefault(), s());
|
|
219
219
|
}, L = (w) => {
|
|
220
220
|
const s = document.createElement("div");
|
|
221
221
|
s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.left = "-10000px", s.style.width = "1px", s.style.height = "1px", s.style.overflow = "hidden", document.body.appendChild(s), s.textContent = w, setTimeout(() => {
|
|
222
222
|
document.body.removeChild(s);
|
|
223
223
|
}, 1e3);
|
|
224
|
-
},
|
|
224
|
+
}, gn = () => {
|
|
225
225
|
const w = document.createElement("style");
|
|
226
226
|
w.id = "magic-sentence-reset", w.textContent = `
|
|
227
227
|
#magic-sentence-root, #magic-sentence-root * {
|
|
@@ -253,9 +253,9 @@ const Te = {
|
|
|
253
253
|
const s = document.getElementById("magic-sentence-reset");
|
|
254
254
|
s && s.remove(), document.head.appendChild(w);
|
|
255
255
|
}, pn = (w) => [...w].sort(() => Math.random() - 0.5);
|
|
256
|
-
function
|
|
257
|
-
const { logoUrl: s, showLogo:
|
|
258
|
-
if (!
|
|
256
|
+
function bn(w = {}) {
|
|
257
|
+
const { logoUrl: s, showLogo: H = !0 } = w, le = Q(null), { validateAllSentences: ce, errors: z } = cn(), E = () => a || window.innerWidth < 768, m = () => a || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, W = (e = "medium") => {
|
|
258
|
+
if (!m())
|
|
259
259
|
return {
|
|
260
260
|
padding: "12px 24px",
|
|
261
261
|
fontSize: "16px",
|
|
@@ -282,52 +282,52 @@ function xn(w = {}) {
|
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
|
-
|
|
285
|
+
V(() => (gn(), () => {
|
|
286
286
|
document.documentElement.style.overflow = "", document.body.style.overflow = "";
|
|
287
287
|
const e = document.getElementById("magic-sentence-reset");
|
|
288
288
|
e && e.remove();
|
|
289
289
|
}), []);
|
|
290
|
-
const [
|
|
290
|
+
const [b, k] = h("select"), [R, ee] = h(null), [fe, me] = h(null), [T, ne] = h([]), [C, xe] = h(0), [ue, ye] = h([]), [S, he] = h([]), [U, be] = h(20), [J, B] = h(0), [wn, We] = h(null), [A, v] = h(null), [c, te] = h(!1), [Y, K] = h(!1), [ge, Re] = h(
|
|
291
291
|
Number(localStorage.getItem("magicSentenceBest")) || 0
|
|
292
|
-
),
|
|
293
|
-
|
|
292
|
+
), Z = Q(null), ze = Q(null), Se = Q(0), [x, M] = h({ list: null, id: null, side: null }), [a, Ee] = h(!1), [Pe, ie] = h(1), [ke, re] = h(null), [Be, Me] = h(!1), [$, Le] = h(!1), [O, Ae] = h(!1), [N, $e] = h(!1), [G, Oe] = h(!1), [X, Ne] = h(!1), [j, Ge] = h(!1), [F, Xe] = h(!1), [q, je] = h(!1), [fn, Fe] = h(!1), [mn, qe] = h(!1);
|
|
293
|
+
V(() => {
|
|
294
294
|
const e = () => {
|
|
295
|
-
const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430, r = n < 700,
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
n < 700 ||
|
|
299
|
-
t === 1366 && n === 766 || t === 1366 && n === 768 || t === 1280 && n === 720 || t === 1440 && n === 900 ||
|
|
300
|
-
if (
|
|
295
|
+
const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430, r = n < 700, u = t / n > 1.8, p = t === 768 && n === 1024, o = t === 1024 && n === 768, d = t === 820 && n === 1180, D = t === 1180 && n === 820, I = t === 540 && n === 720, ae = t === 720 && n === 540, Ie = t === 1024 && n === 1366, Te = t === 1366 && n === 1024, Ce = t >= 1200 && n >= 600 && !i;
|
|
296
|
+
Me(Ce), Le(p), Ae(o), $e(d), Oe(D), Ne(I), Ge(ae), Xe(Ie), je(Te), qe(u);
|
|
297
|
+
const sn = i && t > n || i || // ✅ ВСЕ мобильные устройства (включая portrait)
|
|
298
|
+
n < 700 || u || // ✅ Широкие экраны
|
|
299
|
+
t === 1366 && n === 766 || t === 1366 && n === 768 || t === 1280 && n === 720 || t === 1440 && n === 900 || p || o || d || D || I || ae || Ie || Te || Ce;
|
|
300
|
+
if (Fe(sn), Ee(i), i)
|
|
301
301
|
re(null), ie(1);
|
|
302
302
|
else if (r)
|
|
303
303
|
re(null), ie(1);
|
|
304
|
-
else if (
|
|
305
|
-
const
|
|
306
|
-
re(
|
|
304
|
+
else if (u) {
|
|
305
|
+
const pe = Math.min(1e3, Math.min(t, n) * 0.9);
|
|
306
|
+
re(pe), ie(0.85);
|
|
307
307
|
} else {
|
|
308
|
-
const
|
|
309
|
-
re(
|
|
308
|
+
const pe = Math.min(1e3, Math.min(t, n) * 0.9);
|
|
309
|
+
re(pe), ie(1);
|
|
310
310
|
}
|
|
311
311
|
};
|
|
312
312
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
313
313
|
}, []);
|
|
314
314
|
const oe = (e, t, n, i) => {
|
|
315
|
-
if (
|
|
316
|
-
let r = [...
|
|
317
|
-
const
|
|
315
|
+
if (c) return;
|
|
316
|
+
let r = [...ue], u = [...S];
|
|
317
|
+
const p = e === "bank" ? r : u, o = t === "bank" ? r : u, d = p.findIndex((ae) => ae.id === n);
|
|
318
318
|
if (d === -1) return;
|
|
319
|
-
const [
|
|
320
|
-
let
|
|
321
|
-
e === t &&
|
|
322
|
-
},
|
|
323
|
-
if (e.preventDefault(),
|
|
324
|
-
|
|
319
|
+
const [D] = p.splice(d, 1);
|
|
320
|
+
let I = i;
|
|
321
|
+
e === t && I !== null && I !== void 0 && I > d && (I = I - 1), I == null || I < 0 || I > o.length ? o.push(D) : o.splice(I, 0, D), e === "bank" ? r = p : u = p, t === "bank" ? r = o : u = o, ye(r), he(u);
|
|
322
|
+
}, _ = (e, t, n) => {
|
|
323
|
+
if (e.preventDefault(), c) {
|
|
324
|
+
M({ list: null, id: null, side: null });
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
327
|
const i = e.dataTransfer.getData("application/x-token") || (() => {
|
|
328
328
|
const r = e.dataTransfer.getData("text/plain");
|
|
329
329
|
if (!r) return "";
|
|
330
|
-
const
|
|
330
|
+
const u = ue.some((d) => d.id === r), p = S.some((d) => d.id === r), o = u ? "bank" : p ? "selected" : null;
|
|
331
331
|
return o ? JSON.stringify({ from: o, id: r }) : "";
|
|
332
332
|
})();
|
|
333
333
|
if (i) {
|
|
@@ -337,90 +337,103 @@ function xn(w = {}) {
|
|
|
337
337
|
oe(r.from, t, r.id, n);
|
|
338
338
|
} catch {
|
|
339
339
|
}
|
|
340
|
-
|
|
340
|
+
M({ list: null, id: null, side: null });
|
|
341
341
|
}
|
|
342
|
-
}, qe = (e) => {
|
|
343
|
-
_(e), Re.current = e, Q(Array(e).fill("")), k("time");
|
|
344
342
|
}, Ve = (e) => {
|
|
343
|
+
ee(e), ze.current = e, ne(Array(e).fill("")), k("time");
|
|
344
|
+
}, Ue = (e) => {
|
|
345
345
|
me(e), k("type");
|
|
346
346
|
}, Je = (e, t) => {
|
|
347
347
|
if (t.length > 41 || t && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(t))
|
|
348
348
|
return;
|
|
349
|
-
const i = [...
|
|
350
|
-
i[e] = t,
|
|
351
|
-
const r =
|
|
349
|
+
const i = [...T];
|
|
350
|
+
i[e] = t, ne(i);
|
|
351
|
+
const r = ce(i);
|
|
352
352
|
r.isValid || console.warn("Validation errors:", r.errors);
|
|
353
|
-
},
|
|
354
|
-
|
|
353
|
+
}, Ye = (e) => e.trim().replace(/\s+/g, " "), ve = (e) => e <= 3 ? 20 : e <= 5 ? 18 : e <= 7 ? 16 : e <= 9 ? 14 : 12, Ke = () => {
|
|
354
|
+
T.some((t) => t.trim().length === 0) || (ne((t) => t.map((n) => Ye(n))), B(0), xe(0), Se.current = 0, We(null), k("getready"));
|
|
355
355
|
};
|
|
356
|
-
|
|
357
|
-
if (
|
|
358
|
-
const e = setTimeout(() =>
|
|
356
|
+
V(() => {
|
|
357
|
+
if (b === "getready") {
|
|
358
|
+
const e = setTimeout(() => se(0), 3e3);
|
|
359
359
|
return () => clearTimeout(e);
|
|
360
360
|
}
|
|
361
|
-
}, [
|
|
362
|
-
const
|
|
363
|
-
const t =
|
|
361
|
+
}, [b]);
|
|
362
|
+
const se = (e) => {
|
|
363
|
+
const t = T[e];
|
|
364
364
|
if (!t) return;
|
|
365
365
|
const i = pn(
|
|
366
366
|
t.trim().split(/\s+/).filter(Boolean)
|
|
367
|
-
).map((r,
|
|
368
|
-
id: `${Date.now()}-${e}-${
|
|
367
|
+
).map((r, u) => ({
|
|
368
|
+
id: `${Date.now()}-${e}-${u}-${Math.random().toString(36).slice(2)}`,
|
|
369
369
|
text: r
|
|
370
370
|
}));
|
|
371
|
-
ye(i),
|
|
372
|
-
},
|
|
373
|
-
|
|
374
|
-
if (
|
|
375
|
-
|
|
371
|
+
ye(i), he([]), xe(e), Se.current = e, be(fe || 20), v(null), te(!1), K(!1), k("play");
|
|
372
|
+
}, f = Q(null);
|
|
373
|
+
V(() => {
|
|
374
|
+
if (b !== "play" || c) {
|
|
375
|
+
f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
|
-
const e =
|
|
378
|
+
const e = T[C];
|
|
379
379
|
if (!e) {
|
|
380
|
-
|
|
380
|
+
v(null), f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
|
-
if (
|
|
384
|
-
|
|
383
|
+
if (S.length === 0) {
|
|
384
|
+
v(null), f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
385
385
|
return;
|
|
386
386
|
}
|
|
387
|
-
const t = e.trim().split(/\s+/), n =
|
|
388
|
-
if (n.length === t.length && n.every((r,
|
|
389
|
-
|
|
390
|
-
else {
|
|
391
|
-
|
|
392
|
-
const r = t.filter((d) => !n.includes(d)).length,
|
|
393
|
-
|
|
394
|
-
}
|
|
387
|
+
const t = e.trim().split(/\s+/), n = S.map((r) => r.text);
|
|
388
|
+
if (n.length === t.length && n.every((r, u) => r === t[u]))
|
|
389
|
+
f.current !== null && (window.clearTimeout(f.current), f.current = null), v("correct"), Y || (K(!0), B((r) => r + 1), P("correct"), L("Correct! Well done!"));
|
|
390
|
+
else if (n.length >= t.length) {
|
|
391
|
+
f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
392
|
+
const r = t.filter((d) => !n.includes(d)).length, u = n.filter((d) => !t.includes(d)).length, p = t.filter((d, D) => d !== n[D]).length, o = r + u + p;
|
|
393
|
+
v(o === 1 ? "almost" : "wrong"), Y && (K(!1), B((d) => Math.max(0, d - 1)));
|
|
394
|
+
} else
|
|
395
|
+
v(null), f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
395
396
|
return () => {
|
|
396
|
-
|
|
397
|
+
f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
397
398
|
};
|
|
398
|
-
}, [
|
|
399
|
-
if (
|
|
400
|
-
if (
|
|
401
|
-
|
|
399
|
+
}, [b, S, T, C, c, A, Y, R]), V(() => {
|
|
400
|
+
if (b === "play" && !c)
|
|
401
|
+
if (Z.current !== null && window.clearTimeout(Z.current), U > 0)
|
|
402
|
+
Z.current = window.setTimeout(() => be((e) => e - 1), 1e3);
|
|
402
403
|
else {
|
|
403
|
-
|
|
404
|
-
const
|
|
405
|
-
|
|
404
|
+
te(!0);
|
|
405
|
+
const e = T[C];
|
|
406
|
+
if (!e) {
|
|
407
|
+
v(null);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const t = e.trim().split(/\s+/), n = S.map((o) => o.text), i = t.filter((o) => !n.includes(o)).length, r = n.filter((o) => !t.includes(o)).length, u = t.filter((o, d) => o !== n[d]).length, p = i + r + u;
|
|
411
|
+
p === 0 ? (v("correct"), Y || (K(!0), B((o) => o + 1)), P("correct"), L("Correct! Well done!")) : p === 1 ? (v("almost"), B((o) => o + 0.5), P("half"), L("Almost correct! Just one mistake.")) : (v("wrong"), P("wrong"), L("Not quite right. Keep trying!"));
|
|
406
412
|
}
|
|
407
413
|
return () => {
|
|
408
|
-
|
|
414
|
+
Z.current !== null && window.clearTimeout(Z.current);
|
|
409
415
|
};
|
|
410
|
-
}, [
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
const
|
|
418
|
-
|
|
416
|
+
}, [b, U, c, T, C, S, Y]);
|
|
417
|
+
const Ze = (e = !0) => {
|
|
418
|
+
if (e) {
|
|
419
|
+
if (c) {
|
|
420
|
+
C + 1 < (R || 0) ? se(C + 1) : (k("results"), setTimeout(() => de(), 600));
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const t = T[C];
|
|
424
|
+
if (!t) {
|
|
425
|
+
C + 1 < (R || 0) ? se(C + 1) : (k("results"), setTimeout(() => de(), 600));
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const n = t.trim().split(/\s+/), i = S.map((d) => d.text), r = n.filter((d) => !i.includes(d)).length, u = i.filter((d) => !n.includes(d)).length, p = n.filter((d, D) => d !== i[D]).length, o = r + u + p;
|
|
429
|
+
o === 0 ? (B((d) => d + 1), v("correct"), K(!0), P("correct"), L("Correct! Well done!")) : o === 1 ? (B((d) => d + 0.5), v("almost"), P("half"), L("Almost correct! Just one mistake.")) : (v("wrong"), P("wrong"), L("Not quite right. Keep trying!")), C + 1 < (R || 0) ? setTimeout(() => se(C + 1), 800) : setTimeout(() => {
|
|
430
|
+
k("results"), setTimeout(() => de(), 600);
|
|
431
|
+
}, 800);
|
|
419
432
|
}
|
|
420
433
|
};
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}, [
|
|
434
|
+
V(() => {
|
|
435
|
+
b === "results" && J > ge && (Re(J), localStorage.setItem("magicSentenceBest", String(J)));
|
|
436
|
+
}, [b, J, ge]);
|
|
424
437
|
const P = (e) => {
|
|
425
438
|
const t = new (window.AudioContext || window.webkitAudioContext)(), n = t.createOscillator(), i = t.createGain();
|
|
426
439
|
switch (n.connect(i), i.connect(t.destination), e) {
|
|
@@ -441,36 +454,36 @@ function xn(w = {}) {
|
|
|
441
454
|
break;
|
|
442
455
|
}
|
|
443
456
|
i.gain.setValueAtTime(0.1, t.currentTime), n.start(), n.stop(t.currentTime + 0.2);
|
|
444
|
-
},
|
|
457
|
+
}, de = () => {
|
|
445
458
|
const t = Date.now() + 2500, n = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], i = document.createElement("canvas"), r = i.getContext("2d");
|
|
446
459
|
i.width = window.innerWidth, i.height = window.innerHeight, i.style.position = "fixed", i.style.top = "0", i.style.left = "0", i.style.pointerEvents = "none", document.body.appendChild(i);
|
|
447
|
-
const
|
|
460
|
+
const u = Array.from({ length: 100 }).map(() => ({
|
|
448
461
|
x: Math.random() * i.width,
|
|
449
462
|
y: Math.random() * i.height - i.height,
|
|
450
463
|
size: 6 + Math.random() * 6,
|
|
451
464
|
color: n[Math.floor(Math.random() * n.length)],
|
|
452
465
|
speed: 2 + Math.random() * 4,
|
|
453
466
|
tilt: Math.random() * 2 * Math.PI
|
|
454
|
-
})),
|
|
455
|
-
r.clearRect(0, 0, i.width, i.height),
|
|
467
|
+
})), p = () => {
|
|
468
|
+
r.clearRect(0, 0, i.width, i.height), u.forEach((o) => {
|
|
456
469
|
r.fillStyle = o.color, r.beginPath(), r.ellipse(o.x, o.y, o.size, o.size / 2, o.tilt, 0, 2 * Math.PI), r.fill(), o.y += o.speed, o.x += Math.sin(o.tilt);
|
|
457
|
-
}), Date.now() < t ? requestAnimationFrame(
|
|
470
|
+
}), Date.now() < t ? requestAnimationFrame(p) : document.body.removeChild(i);
|
|
458
471
|
};
|
|
459
|
-
|
|
460
|
-
},
|
|
472
|
+
p();
|
|
473
|
+
}, _e = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
461
474
|
/* @__PURE__ */ l("h1", { style: g.gmHeadline1, children: "MAGIC SENTENCE" }),
|
|
462
475
|
/* @__PURE__ */ l("p", { style: g.gmBodyM, children: "Select number of rounds" }),
|
|
463
476
|
/* @__PURE__ */ l("div", { style: {
|
|
464
477
|
display: "flex",
|
|
465
|
-
gap:
|
|
478
|
+
gap: m() ? "8px" : "16px",
|
|
466
479
|
justifyContent: "center"
|
|
467
480
|
}, children: [3, 4, 5].map((e) => /* @__PURE__ */ y(
|
|
468
481
|
"button",
|
|
469
482
|
{
|
|
470
|
-
onClick: () =>
|
|
483
|
+
onClick: () => Ve(e),
|
|
471
484
|
style: {
|
|
472
485
|
...g.gmButton,
|
|
473
|
-
...
|
|
486
|
+
...W("medium")
|
|
474
487
|
},
|
|
475
488
|
children: [
|
|
476
489
|
e,
|
|
@@ -479,20 +492,20 @@ function xn(w = {}) {
|
|
|
479
492
|
},
|
|
480
493
|
e
|
|
481
494
|
)) })
|
|
482
|
-
] }),
|
|
495
|
+
] }), Qe = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
483
496
|
/* @__PURE__ */ l("h1", { style: g.gmHeadline1, children: "MAGIC SENTENCE" }),
|
|
484
497
|
/* @__PURE__ */ l("p", { style: g.gmBodyM, children: "Select time per round" }),
|
|
485
498
|
/* @__PURE__ */ l("div", { style: {
|
|
486
499
|
display: "flex",
|
|
487
|
-
gap:
|
|
500
|
+
gap: m() ? "8px" : "16px",
|
|
488
501
|
justifyContent: "center"
|
|
489
502
|
}, children: [15, 20, 30].map((e) => /* @__PURE__ */ y(
|
|
490
503
|
"button",
|
|
491
504
|
{
|
|
492
|
-
onClick: () =>
|
|
505
|
+
onClick: () => Ue(e),
|
|
493
506
|
style: {
|
|
494
507
|
...g.gmButton,
|
|
495
|
-
...
|
|
508
|
+
...W("medium")
|
|
496
509
|
},
|
|
497
510
|
children: [
|
|
498
511
|
e,
|
|
@@ -501,12 +514,12 @@ function xn(w = {}) {
|
|
|
501
514
|
},
|
|
502
515
|
e
|
|
503
516
|
)) })
|
|
504
|
-
] }),
|
|
517
|
+
] }), en = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
505
518
|
/* @__PURE__ */ y("h2", { style: { ...g.gmBodyM, marginBottom: "0px" }, children: [
|
|
506
519
|
"Type down ",
|
|
507
|
-
|
|
520
|
+
R,
|
|
508
521
|
" sentence",
|
|
509
|
-
|
|
522
|
+
R && R > 1 ? "s" : "",
|
|
510
523
|
" for your student"
|
|
511
524
|
] }),
|
|
512
525
|
/* @__PURE__ */ l("p", { style: { ...g.gmBodyS, marginBottom: "16px", marginTop: "0px", color: "#6b7280" }, children: "Maximum 41 characters per sentence" }),
|
|
@@ -520,7 +533,7 @@ function xn(w = {}) {
|
|
|
520
533
|
// Минимальная ширина по содержимому
|
|
521
534
|
maxWidth: "600px"
|
|
522
535
|
// Ограничиваем максимальную ширину
|
|
523
|
-
}, children:
|
|
536
|
+
}, children: T.map((e, t) => /* @__PURE__ */ l(
|
|
524
537
|
"input",
|
|
525
538
|
{
|
|
526
539
|
value: e,
|
|
@@ -528,8 +541,8 @@ function xn(w = {}) {
|
|
|
528
541
|
onChange: (n) => Je(t, n.target.value),
|
|
529
542
|
style: {
|
|
530
543
|
...g.gmInput,
|
|
531
|
-
padding:
|
|
532
|
-
fontSize:
|
|
544
|
+
padding: m() ? "8px 12px" : "12px 16px",
|
|
545
|
+
fontSize: m() ? "14px" : "16px",
|
|
533
546
|
width: "100%",
|
|
534
547
|
// Поля теперь будут шире благодаря увеличенной ширине контейнера
|
|
535
548
|
textAlign: "center"
|
|
@@ -541,54 +554,54 @@ function xn(w = {}) {
|
|
|
541
554
|
/* @__PURE__ */ l(
|
|
542
555
|
"button",
|
|
543
556
|
{
|
|
544
|
-
onClick:
|
|
545
|
-
disabled:
|
|
557
|
+
onClick: Ke,
|
|
558
|
+
disabled: T.some((e) => e.trim().length === 0),
|
|
546
559
|
style: {
|
|
547
560
|
...g.gmButton,
|
|
548
561
|
marginTop: 30,
|
|
549
|
-
background:
|
|
550
|
-
cursor:
|
|
551
|
-
...
|
|
562
|
+
background: T.some((e) => e.trim().length === 0) ? "#ccc" : "#ec4c44",
|
|
563
|
+
cursor: T.some((e) => e.trim().length === 0) ? "not-allowed" : "pointer",
|
|
564
|
+
...W("large")
|
|
552
565
|
},
|
|
553
566
|
children: "PLAY"
|
|
554
567
|
}
|
|
555
568
|
)
|
|
556
|
-
] }),
|
|
569
|
+
] }), nn = () => /* @__PURE__ */ y("div", { style: g.gmReadyWrapper, children: [
|
|
557
570
|
/* @__PURE__ */ l("h1", { style: {
|
|
558
571
|
...g.gmHeadline1,
|
|
559
572
|
color: "#ec4c44"
|
|
560
573
|
}, children: "GET READY" }),
|
|
561
574
|
/* @__PURE__ */ l("div", { style: g.gmHourglass, children: "⏳" })
|
|
562
|
-
] }),
|
|
575
|
+
] }), tn = () => /* @__PURE__ */ y("div", { style: g.gmGameLayout, children: [
|
|
563
576
|
/* @__PURE__ */ y("h2", { style: {
|
|
564
|
-
marginBottom:
|
|
565
|
-
fontSize:
|
|
577
|
+
marginBottom: m() ? "5px" : "10px",
|
|
578
|
+
fontSize: m() ? "16px" : "20px"
|
|
566
579
|
}, children: [
|
|
567
580
|
"Round ",
|
|
568
|
-
|
|
581
|
+
C + 1,
|
|
569
582
|
"/",
|
|
570
|
-
|
|
583
|
+
R,
|
|
571
584
|
" — ",
|
|
572
|
-
|
|
585
|
+
c ? "TIME'S UP!" : `Time: ${U}s`
|
|
573
586
|
] }),
|
|
574
587
|
/* @__PURE__ */ l(
|
|
575
588
|
"div",
|
|
576
589
|
{
|
|
577
590
|
style: {
|
|
578
591
|
width: "60%",
|
|
579
|
-
height:
|
|
592
|
+
height: m() ? "8px" : "14px",
|
|
580
593
|
borderRadius: 8,
|
|
581
594
|
background: "#eee",
|
|
582
595
|
overflow: "hidden",
|
|
583
|
-
marginBottom:
|
|
596
|
+
marginBottom: m() ? "10px" : "20px"
|
|
584
597
|
},
|
|
585
598
|
children: /* @__PURE__ */ l(
|
|
586
599
|
"div",
|
|
587
600
|
{
|
|
588
601
|
style: {
|
|
589
602
|
height: "100%",
|
|
590
|
-
width: `${
|
|
591
|
-
background:
|
|
603
|
+
width: `${U / (fe || 20) * 100}%`,
|
|
604
|
+
background: U <= 5 ? "#ec4c44" : "#4caf50",
|
|
592
605
|
transition: "width 1s linear"
|
|
593
606
|
}
|
|
594
607
|
}
|
|
@@ -599,26 +612,26 @@ function xn(w = {}) {
|
|
|
599
612
|
"div",
|
|
600
613
|
{
|
|
601
614
|
onDragOver: (e) => e.preventDefault(),
|
|
602
|
-
onDrop: (e) =>
|
|
615
|
+
onDrop: (e) => _(e, "bank", null),
|
|
603
616
|
style: {
|
|
604
617
|
display: "flex",
|
|
605
|
-
flexWrap:
|
|
606
|
-
gap:
|
|
618
|
+
flexWrap: E() ? "wrap" : "nowrap",
|
|
619
|
+
gap: a || window.innerWidth < 768 ? "6px" : "10px",
|
|
607
620
|
justifyContent: "center",
|
|
608
|
-
marginBottom:
|
|
609
|
-
padding:
|
|
621
|
+
marginBottom: a || window.innerWidth < 768 ? "15px" : "30px",
|
|
622
|
+
padding: a || window.innerWidth < 768 ? "5px" : "10px",
|
|
610
623
|
width: "100%",
|
|
611
624
|
boxSizing: "border-box"
|
|
612
625
|
},
|
|
613
|
-
children:
|
|
626
|
+
children: ue.map((e, t) => /* @__PURE__ */ l(
|
|
614
627
|
"div",
|
|
615
628
|
{
|
|
616
|
-
draggable: !
|
|
629
|
+
draggable: !c,
|
|
617
630
|
role: "button",
|
|
618
|
-
tabIndex:
|
|
619
|
-
"aria-label":
|
|
631
|
+
tabIndex: c ? -1 : 0,
|
|
632
|
+
"aria-label": c ? `Word: ${e.text} (time expired)` : un("Drag word", e.text, "to build sentence"),
|
|
620
633
|
onDragStart: (n) => {
|
|
621
|
-
if (
|
|
634
|
+
if (c) {
|
|
622
635
|
n.preventDefault();
|
|
623
636
|
return;
|
|
624
637
|
}
|
|
@@ -628,36 +641,36 @@ function xn(w = {}) {
|
|
|
628
641
|
), n.dataTransfer.setData("text/plain", e.id), L(`Dragging word: ${e.text}`);
|
|
629
642
|
},
|
|
630
643
|
onKeyDown: (n) => {
|
|
631
|
-
|
|
644
|
+
c || hn(n, () => oe("bank", "selected", e.id, null));
|
|
632
645
|
},
|
|
633
646
|
onDragOver: (n) => n.preventDefault(),
|
|
634
647
|
onDrop: (n) => {
|
|
635
|
-
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2,
|
|
636
|
-
|
|
648
|
+
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, u = n.clientX > r ? t + 1 : t;
|
|
649
|
+
M({ list: null, id: null, side: null }), n.stopPropagation(), _(n, "bank", u);
|
|
637
650
|
},
|
|
638
651
|
onDragEnter: (n) => {
|
|
639
|
-
if (
|
|
652
|
+
if (c) return;
|
|
640
653
|
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
|
|
641
|
-
|
|
654
|
+
M({ list: "bank", id: e.id, side: n.clientX > r ? "right" : "left" });
|
|
642
655
|
},
|
|
643
|
-
onDragLeave: () =>
|
|
656
|
+
onDragLeave: () => M({ list: null, id: null, side: null }),
|
|
644
657
|
onClick: () => {
|
|
645
|
-
|
|
658
|
+
c || oe("bank", "selected", e.id, null);
|
|
646
659
|
},
|
|
647
660
|
style: {
|
|
648
|
-
padding:
|
|
649
|
-
borderRadius:
|
|
661
|
+
padding: a || window.innerWidth < 768 ? "6px 10px" : "10px 16px",
|
|
662
|
+
borderRadius: a || window.innerWidth < 768 ? "6px" : "10px",
|
|
650
663
|
border: "1px solid #ccc",
|
|
651
|
-
background:
|
|
652
|
-
cursor:
|
|
653
|
-
fontSize:
|
|
654
|
-
...
|
|
655
|
-
...
|
|
664
|
+
background: c ? "#f0f0f0" : "#f9f9f9",
|
|
665
|
+
cursor: c ? "not-allowed" : x.list === "bank" && x.id === e.id ? "grabbing" : "grab",
|
|
666
|
+
fontSize: a || window.innerWidth < 768 ? "12px" : "18px",
|
|
667
|
+
...x.list === "bank" && x.id === e.id && x.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
|
|
668
|
+
...x.list === "bank" && x.id === e.id && x.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
|
|
656
669
|
flexShrink: 0,
|
|
657
670
|
flexBasis: "auto",
|
|
658
|
-
opacity:
|
|
671
|
+
opacity: c ? 0.6 : 1,
|
|
659
672
|
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
660
|
-
...
|
|
673
|
+
...x.list === "bank" && x.id === e.id ? {
|
|
661
674
|
transform: "scale(1.05)",
|
|
662
675
|
boxShadow: "0 2px 8px rgba(59, 130, 246, 0.3)"
|
|
663
676
|
} : {}
|
|
@@ -675,17 +688,17 @@ function xn(w = {}) {
|
|
|
675
688
|
onDrop: (e) => {
|
|
676
689
|
const t = e.currentTarget.getBoundingClientRect(), n = Array.from(e.currentTarget.children);
|
|
677
690
|
if (n.length === 0) {
|
|
678
|
-
|
|
691
|
+
_(e, "selected", 0);
|
|
679
692
|
return;
|
|
680
693
|
}
|
|
681
|
-
let i =
|
|
682
|
-
n.forEach((
|
|
683
|
-
const o =
|
|
684
|
-
|
|
685
|
-
}), e.clientX > t.right - 30 && (i =
|
|
694
|
+
let i = S.length, r = 1 / 0;
|
|
695
|
+
n.forEach((u, p) => {
|
|
696
|
+
const o = u.getBoundingClientRect(), d = o.left + o.width / 2, D = Math.abs(e.clientX - d);
|
|
697
|
+
D < r && (r = D, i = e.clientX < d ? p : p + 1);
|
|
698
|
+
}), e.clientX > t.right - 30 && (i = S.length), e.clientX < t.left + 30 && (i = 0), _(e, "selected", i);
|
|
686
699
|
},
|
|
687
700
|
style: {
|
|
688
|
-
minHeight:
|
|
701
|
+
minHeight: a || window.innerWidth < 768 ? "50px" : "70px",
|
|
689
702
|
width: "auto",
|
|
690
703
|
// Автоматическая ширина в зависимости от содержимого
|
|
691
704
|
maxWidth: "none",
|
|
@@ -693,23 +706,23 @@ function xn(w = {}) {
|
|
|
693
706
|
minWidth: "245px",
|
|
694
707
|
// Минимальная ширина для растягивания
|
|
695
708
|
border: A === "correct" ? "2px dashed #4caf50" : A === "almost" ? "2px dashed #ff9800" : A === "wrong" ? "2px dashed #f44336" : "2px dashed #ccc",
|
|
696
|
-
borderRadius:
|
|
697
|
-
padding:
|
|
709
|
+
borderRadius: a || window.innerWidth < 768 ? "8px" : "12px",
|
|
710
|
+
padding: a || window.innerWidth < 768 ? "8px" : "12px",
|
|
698
711
|
display: "flex",
|
|
699
|
-
flexWrap:
|
|
712
|
+
flexWrap: E() ? "wrap" : "nowrap",
|
|
700
713
|
alignItems: "center",
|
|
701
714
|
justifyContent: "center",
|
|
702
|
-
fontSize: `${ve(
|
|
715
|
+
fontSize: `${ve(S.length)}px`,
|
|
703
716
|
background: A === "correct" ? "#e8f5e8" : A === "almost" ? "#fff3e0" : A === "wrong" ? "#ffebee" : "#fafafa",
|
|
704
|
-
overflowX:
|
|
705
|
-
whiteSpace:
|
|
717
|
+
overflowX: E() ? "hidden" : "auto",
|
|
718
|
+
whiteSpace: E() ? "normal" : "nowrap"
|
|
706
719
|
},
|
|
707
|
-
children:
|
|
720
|
+
children: S.map((e, t) => /* @__PURE__ */ l(
|
|
708
721
|
"span",
|
|
709
722
|
{
|
|
710
|
-
draggable: !
|
|
723
|
+
draggable: !c,
|
|
711
724
|
onDragStart: (n) => {
|
|
712
|
-
if (
|
|
725
|
+
if (c) {
|
|
713
726
|
n.preventDefault();
|
|
714
727
|
return;
|
|
715
728
|
}
|
|
@@ -720,38 +733,38 @@ function xn(w = {}) {
|
|
|
720
733
|
},
|
|
721
734
|
onDragOver: (n) => n.preventDefault(),
|
|
722
735
|
onDrop: (n) => {
|
|
723
|
-
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2,
|
|
724
|
-
|
|
736
|
+
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, u = i.width * 0.25, p = n.clientX < r - u ? t : n.clientX > r + u || n.clientX > r ? t + 1 : t;
|
|
737
|
+
M({ list: null, id: null, side: null }), n.stopPropagation(), _(n, "selected", p);
|
|
725
738
|
},
|
|
726
739
|
onDragEnter: (n) => {
|
|
727
|
-
if (
|
|
740
|
+
if (c) return;
|
|
728
741
|
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
|
|
729
|
-
|
|
742
|
+
M({ list: "selected", id: e.id, side: n.clientX > r ? "right" : "left" });
|
|
730
743
|
},
|
|
731
|
-
onDragLeave: () =>
|
|
744
|
+
onDragLeave: () => M({ list: null, id: null, side: null }),
|
|
732
745
|
onClick: () => {
|
|
733
|
-
|
|
746
|
+
c || oe("selected", "bank", e.id, null);
|
|
734
747
|
},
|
|
735
|
-
title:
|
|
748
|
+
title: c ? "Time expired" : "Click to remove back to bank",
|
|
736
749
|
style: {
|
|
737
|
-
padding:
|
|
738
|
-
margin:
|
|
739
|
-
borderRadius:
|
|
740
|
-
background:
|
|
741
|
-
border:
|
|
742
|
-
...
|
|
743
|
-
...
|
|
744
|
-
cursor:
|
|
750
|
+
padding: m() ? "4px 6px" : "6px 10px",
|
|
751
|
+
margin: m() ? "2px" : "4px",
|
|
752
|
+
borderRadius: m() ? "4px" : "8px",
|
|
753
|
+
background: c ? "#f0f0f0" : "#ffe9e7",
|
|
754
|
+
border: c ? "1px solid #ccc" : "1px solid #ec4c44",
|
|
755
|
+
...x.list === "selected" && x.id === e.id && x.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
|
|
756
|
+
...x.list === "selected" && x.id === e.id && x.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
|
|
757
|
+
cursor: c ? "not-allowed" : x.list === "selected" && x.id === e.id ? "grabbing" : "grab",
|
|
745
758
|
userSelect: "none",
|
|
746
|
-
fontSize: `${ve(
|
|
759
|
+
fontSize: `${ve(S.length)}px`,
|
|
747
760
|
// Адаптивный размер шрифта для слов
|
|
748
761
|
fontFamily: '"Roboto", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',
|
|
749
762
|
// Более плотный шрифт
|
|
750
763
|
whiteSpace: "nowrap",
|
|
751
764
|
// Запрещаем перенос слов
|
|
752
|
-
opacity:
|
|
765
|
+
opacity: c ? 0.6 : 1,
|
|
753
766
|
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
754
|
-
...
|
|
767
|
+
...x.list === "selected" && x.id === e.id ? {
|
|
755
768
|
transform: "scale(1.05)",
|
|
756
769
|
boxShadow: "0 2px 8px rgba(59, 130, 246, 0.3)"
|
|
757
770
|
} : {}
|
|
@@ -765,65 +778,65 @@ function xn(w = {}) {
|
|
|
765
778
|
/* @__PURE__ */ l(
|
|
766
779
|
"button",
|
|
767
780
|
{
|
|
768
|
-
onClick: () =>
|
|
769
|
-
disabled: !
|
|
781
|
+
onClick: () => Ze(!0),
|
|
782
|
+
disabled: !c && S.length === 0,
|
|
770
783
|
style: {
|
|
771
|
-
marginTop:
|
|
772
|
-
fontSize:
|
|
773
|
-
padding:
|
|
774
|
-
borderRadius:
|
|
775
|
-
background:
|
|
784
|
+
marginTop: m() ? "15px" : "30px",
|
|
785
|
+
fontSize: m() ? "14px" : "20px",
|
|
786
|
+
padding: m() ? "6px 12px" : "10px 24px",
|
|
787
|
+
borderRadius: m() ? "8px" : "12px",
|
|
788
|
+
background: c || S.length > 0 ? "#ec4c44" : "#ccc",
|
|
776
789
|
color: "white",
|
|
777
790
|
border: "none",
|
|
778
|
-
cursor:
|
|
791
|
+
cursor: c || S.length > 0 ? "pointer" : "not-allowed"
|
|
779
792
|
},
|
|
780
793
|
children: "NEXT"
|
|
781
794
|
}
|
|
782
795
|
)
|
|
783
|
-
] }),
|
|
796
|
+
] }), rn = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
784
797
|
/* @__PURE__ */ l("h1", { style: {
|
|
785
798
|
...g.gmHeadline1,
|
|
786
|
-
marginTop: (
|
|
787
|
-
marginBottom:
|
|
788
|
-
fontSize:
|
|
799
|
+
marginTop: (a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q, "0px"),
|
|
800
|
+
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "10px",
|
|
801
|
+
fontSize: a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "32px" : "clamp(28px, 4vw, 40px)"
|
|
789
802
|
}, children: "Game Over 🎯" }),
|
|
790
803
|
/* @__PURE__ */ y("h2", { style: {
|
|
791
804
|
...g.gmHeadline2,
|
|
792
|
-
marginTop: (
|
|
793
|
-
marginBottom:
|
|
794
|
-
fontSize:
|
|
805
|
+
marginTop: (a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q, "0px"),
|
|
806
|
+
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "16px",
|
|
807
|
+
fontSize: a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "18px" : "24px"
|
|
795
808
|
}, children: [
|
|
796
809
|
"Your score: ",
|
|
797
|
-
|
|
810
|
+
J,
|
|
798
811
|
" out of ",
|
|
799
|
-
|
|
812
|
+
R
|
|
800
813
|
] }),
|
|
801
814
|
/* @__PURE__ */ y("p", { style: {
|
|
802
815
|
...g.gmBodyM,
|
|
803
816
|
color: "#10b981",
|
|
804
|
-
marginTop:
|
|
805
|
-
marginBottom:
|
|
806
|
-
fontSize:
|
|
817
|
+
marginTop: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "0px" : "12px",
|
|
818
|
+
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "16px",
|
|
819
|
+
fontSize: a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "14px" : "16px"
|
|
807
820
|
}, children: [
|
|
808
821
|
"Best score: ",
|
|
809
|
-
|
|
822
|
+
ge
|
|
810
823
|
] }),
|
|
811
824
|
/* @__PURE__ */ y("div", { style: {
|
|
812
825
|
display: "flex",
|
|
813
|
-
gap:
|
|
814
|
-
marginTop:
|
|
826
|
+
gap: a && window.innerWidth > window.innerHeight || a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "6px" : "12px",
|
|
827
|
+
marginTop: a && window.innerWidth > window.innerHeight || a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "2px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || Be ? "12px" : "24px"
|
|
815
828
|
}, children: [
|
|
816
829
|
/* @__PURE__ */ l(
|
|
817
830
|
"button",
|
|
818
831
|
{
|
|
819
832
|
onClick: () => {
|
|
820
|
-
|
|
821
|
-
k("getready"), We(null),
|
|
833
|
+
de(), P("start"), setTimeout(() => {
|
|
834
|
+
k("getready"), We(null), te(!1);
|
|
822
835
|
}, 800);
|
|
823
836
|
},
|
|
824
837
|
style: {
|
|
825
838
|
...g.gmButton,
|
|
826
|
-
...
|
|
839
|
+
...W("medium")
|
|
827
840
|
},
|
|
828
841
|
children: "🔁 Play again"
|
|
829
842
|
}
|
|
@@ -832,21 +845,49 @@ function xn(w = {}) {
|
|
|
832
845
|
"button",
|
|
833
846
|
{
|
|
834
847
|
onClick: () => {
|
|
835
|
-
P("click"), k("select"),
|
|
848
|
+
P("click"), k("select"), ee(null), me(null), ne([]), B(0), he([]), te(!1);
|
|
836
849
|
},
|
|
837
850
|
style: {
|
|
838
851
|
...g.gmButton,
|
|
839
|
-
...
|
|
852
|
+
...W("medium")
|
|
840
853
|
},
|
|
841
854
|
children: "⬅️ Exit"
|
|
842
855
|
}
|
|
843
856
|
)
|
|
844
857
|
] })
|
|
845
|
-
] }),
|
|
858
|
+
] }), He = !a && H, on = dn(
|
|
859
|
+
() => {
|
|
860
|
+
if (a && window.innerWidth > window.innerHeight || window.innerHeight < 700 || !He)
|
|
861
|
+
return null;
|
|
862
|
+
const e = s || (typeof window < "u" && window.origin ? `${window.origin}/cloud/speakid/games/magic%20sentence/logo` : "/cloud/speakid/games/magic%20sentence/logo");
|
|
863
|
+
return (
|
|
864
|
+
// ensure logo is positioned inside the square container
|
|
865
|
+
/* @__PURE__ */ l("div", { style: { ...g.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ y("picture", { children: [
|
|
866
|
+
/* @__PURE__ */ l(
|
|
867
|
+
"source",
|
|
868
|
+
{
|
|
869
|
+
srcSet: `${e}.svg`,
|
|
870
|
+
type: "image/svg+xml"
|
|
871
|
+
}
|
|
872
|
+
),
|
|
873
|
+
/* @__PURE__ */ l(
|
|
874
|
+
"img",
|
|
875
|
+
{
|
|
876
|
+
src: `${e}.png`,
|
|
877
|
+
alt: "SPEAKID Logo",
|
|
878
|
+
style: g.gmLogoImg,
|
|
879
|
+
loading: "lazy"
|
|
880
|
+
}
|
|
881
|
+
)
|
|
882
|
+
] }) })
|
|
883
|
+
);
|
|
884
|
+
},
|
|
885
|
+
[a, He, s]
|
|
886
|
+
);
|
|
846
887
|
return /* @__PURE__ */ l(
|
|
847
888
|
"div",
|
|
848
889
|
{
|
|
849
|
-
ref:
|
|
890
|
+
ref: le,
|
|
850
891
|
style: {
|
|
851
892
|
width: "100%",
|
|
852
893
|
height: "100%",
|
|
@@ -866,19 +907,19 @@ function xn(w = {}) {
|
|
|
866
907
|
"div",
|
|
867
908
|
{
|
|
868
909
|
style: {
|
|
869
|
-
width:
|
|
870
|
-
height:
|
|
910
|
+
width: a ? "100%" : ke || 1e3,
|
|
911
|
+
height: a ? "100%" : ke || 1e3,
|
|
871
912
|
display: "flex",
|
|
872
913
|
justifyContent: "center",
|
|
873
914
|
alignItems: "center",
|
|
874
915
|
overflow: "hidden",
|
|
875
|
-
borderRadius:
|
|
916
|
+
borderRadius: a ? 0 : "20px",
|
|
876
917
|
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
877
|
-
boxShadow:
|
|
878
|
-
margin:
|
|
918
|
+
boxShadow: a ? "none" : "0 0 40px rgba(0,0,0,0.1)",
|
|
919
|
+
margin: a ? "0 auto" : "unset",
|
|
879
920
|
position: "relative",
|
|
880
921
|
// needed so absolute logo is inside the square
|
|
881
|
-
transform: `scale(${
|
|
922
|
+
transform: `scale(${Pe})`
|
|
882
923
|
// ✅ Применяем масштаб для широких экранов
|
|
883
924
|
},
|
|
884
925
|
children: /* @__PURE__ */ l(
|
|
@@ -893,21 +934,13 @@ function xn(w = {}) {
|
|
|
893
934
|
alignItems: "center"
|
|
894
935
|
},
|
|
895
936
|
children: /* @__PURE__ */ y("div", { id: "magic-sentence-root", children: [
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
}
|
|
904
|
-
) }) : null,
|
|
905
|
-
x === "select" ? Ze() : null,
|
|
906
|
-
x === "time" ? _e() : null,
|
|
907
|
-
x === "type" ? Qe() : null,
|
|
908
|
-
x === "getready" ? en() : null,
|
|
909
|
-
x === "play" ? nn() : null,
|
|
910
|
-
x === "results" ? tn() : null
|
|
937
|
+
on,
|
|
938
|
+
b === "select" ? _e() : null,
|
|
939
|
+
b === "time" ? Qe() : null,
|
|
940
|
+
b === "type" ? en() : null,
|
|
941
|
+
b === "getready" ? nn() : null,
|
|
942
|
+
b === "play" ? tn() : null,
|
|
943
|
+
b === "results" ? rn() : null
|
|
911
944
|
] })
|
|
912
945
|
}
|
|
913
946
|
)
|
|
@@ -916,7 +949,7 @@ function xn(w = {}) {
|
|
|
916
949
|
}
|
|
917
950
|
);
|
|
918
951
|
}
|
|
919
|
-
class
|
|
952
|
+
class Wn extends an {
|
|
920
953
|
constructor(s) {
|
|
921
954
|
super(s), this.state = { hasError: !1 };
|
|
922
955
|
}
|
|
@@ -926,10 +959,10 @@ class yn extends sn {
|
|
|
926
959
|
error: s
|
|
927
960
|
};
|
|
928
961
|
}
|
|
929
|
-
componentDidCatch(s,
|
|
930
|
-
console.error("Game Error:", s,
|
|
962
|
+
componentDidCatch(s, H) {
|
|
963
|
+
console.error("Game Error:", s, H), this.setState({
|
|
931
964
|
error: s,
|
|
932
|
-
errorInfo:
|
|
965
|
+
errorInfo: H
|
|
933
966
|
});
|
|
934
967
|
}
|
|
935
968
|
handleReset = () => {
|
|
@@ -987,12 +1020,12 @@ class yn extends sn {
|
|
|
987
1020
|
}
|
|
988
1021
|
}
|
|
989
1022
|
export {
|
|
990
|
-
|
|
991
|
-
|
|
1023
|
+
Wn as ErrorBoundary,
|
|
1024
|
+
bn as Game,
|
|
992
1025
|
L as announceToScreenReader,
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1026
|
+
un as createAriaLabel,
|
|
1027
|
+
bn as default,
|
|
1028
|
+
hn as handleKeyDown,
|
|
1029
|
+
cn as useValidation
|
|
997
1030
|
};
|
|
998
1031
|
//# sourceMappingURL=speakid-build-a-sentence.es.js.map
|