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