speakid-build-a-sentence 1.0.26 → 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 +383 -368
- 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,180 +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
|
-
const t =
|
|
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;
|
|
355
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;
|
|
356
|
-
},
|
|
357
|
-
T.some((
|
|
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"));
|
|
358
367
|
};
|
|
359
|
-
|
|
360
|
-
if (
|
|
361
|
-
const e = setTimeout(() =>
|
|
368
|
+
j(() => {
|
|
369
|
+
if (S === "getready") {
|
|
370
|
+
const e = setTimeout(() => ee(0), 3e3);
|
|
362
371
|
return () => clearTimeout(e);
|
|
363
372
|
}
|
|
364
|
-
}, [
|
|
365
|
-
const
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
).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) => ({
|
|
371
380
|
id: `${Date.now()}-${e}-${p}-${Math.random().toString(36).slice(2)}`,
|
|
372
|
-
text:
|
|
381
|
+
text: o
|
|
373
382
|
}));
|
|
374
|
-
me(
|
|
383
|
+
me(r), ie([]), fe(e), ye.current = e, ge(pe || 20), P(null), _(!1), se(!1), z("play");
|
|
375
384
|
};
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}), [
|
|
379
|
-
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) {
|
|
380
389
|
const e = T[D];
|
|
381
390
|
if (!e) {
|
|
382
|
-
|
|
391
|
+
P(null);
|
|
383
392
|
return;
|
|
384
393
|
}
|
|
385
|
-
const
|
|
386
|
-
|
|
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!"));
|
|
387
396
|
}
|
|
388
|
-
}, [
|
|
389
|
-
const
|
|
397
|
+
}, [S, l, W, T, D, I, xe]);
|
|
398
|
+
const tt = (e = !0) => {
|
|
390
399
|
if (e) {
|
|
391
400
|
if (l) {
|
|
392
|
-
D + 1 < (
|
|
401
|
+
D + 1 < (E || 0) ? ee(D + 1) : (z("results"), setTimeout(() => te(), 600));
|
|
393
402
|
return;
|
|
394
403
|
}
|
|
395
|
-
const
|
|
396
|
-
if (!
|
|
397
|
-
D + 1 < (
|
|
404
|
+
const n = T[D];
|
|
405
|
+
if (!n) {
|
|
406
|
+
D + 1 < (E || 0) ? ee(D + 1) : (z("results"), setTimeout(() => te(), 600));
|
|
398
407
|
return;
|
|
399
408
|
}
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
|
|
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);
|
|
403
412
|
}, 800);
|
|
404
413
|
}
|
|
405
414
|
};
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}, [
|
|
409
|
-
const
|
|
410
|
-
const
|
|
411
|
-
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) {
|
|
412
421
|
case "start":
|
|
413
|
-
|
|
422
|
+
t.frequency.value = 500;
|
|
414
423
|
break;
|
|
415
424
|
case "click":
|
|
416
|
-
|
|
425
|
+
t.frequency.value = 800;
|
|
417
426
|
break;
|
|
418
427
|
case "correct":
|
|
419
|
-
|
|
428
|
+
t.frequency.value = 1e3;
|
|
420
429
|
break;
|
|
421
430
|
case "half":
|
|
422
|
-
|
|
431
|
+
t.frequency.value = 700;
|
|
423
432
|
break;
|
|
424
433
|
case "wrong":
|
|
425
|
-
|
|
434
|
+
t.frequency.value = 200;
|
|
426
435
|
break;
|
|
427
436
|
}
|
|
428
|
-
|
|
429
|
-
},
|
|
430
|
-
const
|
|
431
|
-
|
|
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);
|
|
432
441
|
const p = Array.from({ length: 100 }).map(() => ({
|
|
433
|
-
x: Math.random() *
|
|
434
|
-
y: Math.random() *
|
|
442
|
+
x: Math.random() * r.width,
|
|
443
|
+
y: Math.random() * r.height - r.height,
|
|
435
444
|
size: 6 + Math.random() * 6,
|
|
436
|
-
color:
|
|
445
|
+
color: t[Math.floor(Math.random() * t.length)],
|
|
437
446
|
speed: 2 + Math.random() * 4,
|
|
438
447
|
tilt: Math.random() * 2 * Math.PI
|
|
439
|
-
})),
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}), 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);
|
|
443
452
|
};
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
/* @__PURE__ */ a("h1", { style:
|
|
447
|
-
/* @__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" }),
|
|
448
457
|
/* @__PURE__ */ a("div", { style: {
|
|
449
458
|
display: "flex",
|
|
450
|
-
gap:
|
|
459
|
+
gap: y() ? "8px" : "16px",
|
|
451
460
|
justifyContent: "center"
|
|
452
|
-
}, children: [3, 4, 5].map((e) => /* @__PURE__ */
|
|
461
|
+
}, children: [3, 4, 5].map((e) => /* @__PURE__ */ b(
|
|
453
462
|
"button",
|
|
454
463
|
{
|
|
455
|
-
onClick: () =>
|
|
464
|
+
onClick: () => Ke(e),
|
|
456
465
|
style: {
|
|
457
|
-
...
|
|
458
|
-
...
|
|
466
|
+
...u.gmButton,
|
|
467
|
+
...F("medium")
|
|
459
468
|
},
|
|
460
469
|
children: [
|
|
461
470
|
e,
|
|
@@ -464,20 +473,20 @@ function yn(u = {}) {
|
|
|
464
473
|
},
|
|
465
474
|
e
|
|
466
475
|
)) })
|
|
467
|
-
] }),
|
|
468
|
-
/* @__PURE__ */ a("h1", { style:
|
|
469
|
-
/* @__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" }),
|
|
470
479
|
/* @__PURE__ */ a("div", { style: {
|
|
471
480
|
display: "flex",
|
|
472
|
-
gap:
|
|
481
|
+
gap: y() ? "8px" : "16px",
|
|
473
482
|
justifyContent: "center"
|
|
474
|
-
}, children: [15, 20, 30].map((e) => /* @__PURE__ */
|
|
483
|
+
}, children: [15, 20, 30].map((e) => /* @__PURE__ */ b(
|
|
475
484
|
"button",
|
|
476
485
|
{
|
|
477
|
-
onClick: () =>
|
|
486
|
+
onClick: () => Ze(e),
|
|
478
487
|
style: {
|
|
479
|
-
...
|
|
480
|
-
...
|
|
488
|
+
...u.gmButton,
|
|
489
|
+
...F("medium")
|
|
481
490
|
},
|
|
482
491
|
children: [
|
|
483
492
|
e,
|
|
@@ -486,15 +495,15 @@ function yn(u = {}) {
|
|
|
486
495
|
},
|
|
487
496
|
e
|
|
488
497
|
)) })
|
|
489
|
-
] }),
|
|
490
|
-
/* @__PURE__ */
|
|
498
|
+
] }), ot = () => /* @__PURE__ */ b("div", { style: u.gmCenterScreen, children: [
|
|
499
|
+
/* @__PURE__ */ b("h2", { style: { ...u.gmBodyM, marginBottom: "0px" }, children: [
|
|
491
500
|
"Type down ",
|
|
492
|
-
|
|
501
|
+
E,
|
|
493
502
|
" sentence",
|
|
494
|
-
|
|
503
|
+
E && E > 1 ? "s" : "",
|
|
495
504
|
" for your student"
|
|
496
505
|
] }),
|
|
497
|
-
/* @__PURE__ */ a("p", { style: { ...
|
|
506
|
+
/* @__PURE__ */ a("p", { style: { ...u.gmBodyS, marginBottom: "16px", marginTop: "0px", color: "#6b7280" }, children: "Maximum 41 characters per sentence" }),
|
|
498
507
|
/* @__PURE__ */ a("div", { style: {
|
|
499
508
|
display: "flex",
|
|
500
509
|
flexDirection: "column",
|
|
@@ -505,75 +514,75 @@ function yn(u = {}) {
|
|
|
505
514
|
// Минимальная ширина по содержимому
|
|
506
515
|
maxWidth: "600px"
|
|
507
516
|
// Ограничиваем максимальную ширину
|
|
508
|
-
}, children: T.map((e,
|
|
517
|
+
}, children: T.map((e, n) => /* @__PURE__ */ a(
|
|
509
518
|
"input",
|
|
510
519
|
{
|
|
511
520
|
value: e,
|
|
512
|
-
placeholder: `Sentence ${
|
|
513
|
-
onChange: (
|
|
521
|
+
placeholder: `Sentence ${n + 1}`,
|
|
522
|
+
onChange: (t) => _e(n, t.target.value),
|
|
514
523
|
style: {
|
|
515
|
-
...
|
|
516
|
-
padding:
|
|
517
|
-
fontSize:
|
|
524
|
+
...u.gmInput,
|
|
525
|
+
padding: y() ? "8px 12px" : "12px 16px",
|
|
526
|
+
fontSize: y() ? "14px" : "16px",
|
|
518
527
|
width: "100%",
|
|
519
528
|
// Поля теперь будут шире благодаря увеличенной ширине контейнера
|
|
520
529
|
textAlign: "center"
|
|
521
530
|
// Центрируем placeholder текст
|
|
522
531
|
}
|
|
523
532
|
},
|
|
524
|
-
|
|
533
|
+
n
|
|
525
534
|
)) }),
|
|
526
535
|
/* @__PURE__ */ a(
|
|
527
536
|
"button",
|
|
528
537
|
{
|
|
529
|
-
onClick:
|
|
538
|
+
onClick: et,
|
|
530
539
|
disabled: T.some((e) => e.trim().length === 0),
|
|
531
540
|
style: {
|
|
532
|
-
...
|
|
541
|
+
...u.gmButton,
|
|
533
542
|
marginTop: 30,
|
|
534
543
|
background: T.some((e) => e.trim().length === 0) ? "#ccc" : "#ec4c44",
|
|
535
544
|
cursor: T.some((e) => e.trim().length === 0) ? "not-allowed" : "pointer",
|
|
536
|
-
...
|
|
545
|
+
...F("large")
|
|
537
546
|
},
|
|
538
547
|
children: "PLAY"
|
|
539
548
|
}
|
|
540
549
|
)
|
|
541
|
-
] }),
|
|
550
|
+
] }), it = () => /* @__PURE__ */ b("div", { style: u.gmReadyWrapper, children: [
|
|
542
551
|
/* @__PURE__ */ a("h1", { style: {
|
|
543
|
-
...
|
|
552
|
+
...u.gmHeadline1,
|
|
544
553
|
color: "#ec4c44"
|
|
545
554
|
}, children: "GET READY" }),
|
|
546
|
-
/* @__PURE__ */ a("div", { style:
|
|
547
|
-
] }),
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
marginBottom:
|
|
550
|
-
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"
|
|
551
560
|
}, children: [
|
|
552
561
|
"Round ",
|
|
553
562
|
D + 1,
|
|
554
563
|
"/",
|
|
555
|
-
|
|
564
|
+
E,
|
|
556
565
|
" — ",
|
|
557
|
-
l ? "TIME'S UP!" : `Time: ${
|
|
566
|
+
l ? "TIME'S UP!" : `Time: ${W}s`
|
|
558
567
|
] }),
|
|
559
568
|
/* @__PURE__ */ a(
|
|
560
569
|
"div",
|
|
561
570
|
{
|
|
562
571
|
style: {
|
|
563
572
|
width: "60%",
|
|
564
|
-
height:
|
|
573
|
+
height: y() ? "8px" : "14px",
|
|
565
574
|
borderRadius: 8,
|
|
566
575
|
background: "#eee",
|
|
567
576
|
overflow: "hidden",
|
|
568
|
-
marginBottom:
|
|
577
|
+
marginBottom: y() ? "10px" : "20px"
|
|
569
578
|
},
|
|
570
579
|
children: /* @__PURE__ */ a(
|
|
571
580
|
"div",
|
|
572
581
|
{
|
|
573
582
|
style: {
|
|
574
583
|
height: "100%",
|
|
575
|
-
width: `${
|
|
576
|
-
background:
|
|
584
|
+
width: `${W / (pe || 20) * 100}%`,
|
|
585
|
+
background: W <= 5 ? "#ec4c44" : "#4caf50",
|
|
577
586
|
transition: "width 1s linear"
|
|
578
587
|
}
|
|
579
588
|
}
|
|
@@ -587,63 +596,65 @@ function yn(u = {}) {
|
|
|
587
596
|
onDrop: (e) => Y(e, "bank", null),
|
|
588
597
|
style: {
|
|
589
598
|
display: "flex",
|
|
590
|
-
flexWrap:
|
|
591
|
-
gap:
|
|
599
|
+
flexWrap: N() ? "wrap" : "nowrap",
|
|
600
|
+
gap: m || h() < 768 ? "6px" : "10px",
|
|
592
601
|
justifyContent: "center",
|
|
593
|
-
marginBottom:
|
|
594
|
-
padding:
|
|
602
|
+
marginBottom: m || h() < 768 ? "15px" : "30px",
|
|
603
|
+
padding: m || h() < 768 ? "5px" : "10px",
|
|
595
604
|
width: "100%",
|
|
596
605
|
boxSizing: "border-box"
|
|
597
606
|
},
|
|
598
|
-
children:
|
|
607
|
+
children: oe.map((e, n) => /* @__PURE__ */ a(
|
|
599
608
|
"div",
|
|
600
609
|
{
|
|
601
610
|
draggable: !l,
|
|
602
611
|
role: "button",
|
|
603
612
|
tabIndex: l ? -1 : 0,
|
|
604
|
-
"aria-label": l ? `Word: ${e.text} (time expired)` :
|
|
605
|
-
onDragStart: (
|
|
613
|
+
"aria-label": l ? `Word: ${e.text} (time expired)` : mt("Drag word", e.text, "to build sentence"),
|
|
614
|
+
onDragStart: (t) => {
|
|
606
615
|
if (l) {
|
|
607
|
-
|
|
616
|
+
t.preventDefault();
|
|
608
617
|
return;
|
|
609
618
|
}
|
|
610
|
-
|
|
619
|
+
t.dataTransfer.setData(
|
|
611
620
|
"application/x-token",
|
|
612
621
|
JSON.stringify({ from: "bank", id: e.id })
|
|
613
|
-
),
|
|
622
|
+
), t.dataTransfer.setData("text/plain", e.id), A(`Dragging word: ${e.text}`);
|
|
614
623
|
},
|
|
615
|
-
onKeyDown: (
|
|
616
|
-
l ||
|
|
624
|
+
onKeyDown: (t) => {
|
|
625
|
+
l || gt(t, () => Q("bank", "selected", e.id, null));
|
|
617
626
|
},
|
|
618
|
-
onDragOver: (
|
|
619
|
-
onDrop: (
|
|
620
|
-
const
|
|
621
|
-
|
|
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);
|
|
622
631
|
},
|
|
623
|
-
onDragEnter: (
|
|
632
|
+
onDragEnter: (t) => {
|
|
624
633
|
if (l) return;
|
|
625
|
-
const
|
|
626
|
-
|
|
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" });
|
|
627
636
|
},
|
|
628
|
-
onDragLeave: () =>
|
|
637
|
+
onDragLeave: () => B({ list: null, id: null, side: null }),
|
|
629
638
|
onClick: () => {
|
|
630
|
-
l ||
|
|
639
|
+
l || Q("bank", "selected", e.id, null);
|
|
631
640
|
},
|
|
632
641
|
style: {
|
|
633
|
-
padding:
|
|
634
|
-
borderRadius:
|
|
642
|
+
padding: m || h() < 768 ? "6px 10px" : "10px 16px",
|
|
643
|
+
borderRadius: m || h() < 768 ? "6px" : "10px",
|
|
635
644
|
border: "1px solid #ccc",
|
|
636
645
|
background: l ? "#f0f0f0" : "#f9f9f9",
|
|
637
|
-
cursor: l ? "not-allowed" :
|
|
638
|
-
fontSize:
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
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" } : {},
|
|
642
653
|
flexShrink: 0,
|
|
643
654
|
flexBasis: "auto",
|
|
644
655
|
opacity: l ? 0.6 : 1,
|
|
645
656
|
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
646
|
-
...
|
|
657
|
+
...x.list === "bank" && x.id === e.id ? {
|
|
647
658
|
transform: "scale(1.05)",
|
|
648
659
|
boxShadow: "0 2px 8px rgba(59, 130, 246, 0.3)"
|
|
649
660
|
} : {}
|
|
@@ -659,77 +670,77 @@ function yn(u = {}) {
|
|
|
659
670
|
{
|
|
660
671
|
onDragOver: (e) => e.preventDefault(),
|
|
661
672
|
onDrop: (e) => {
|
|
662
|
-
const
|
|
663
|
-
if (
|
|
673
|
+
const n = e.currentTarget.getBoundingClientRect(), t = Array.from(e.currentTarget.children);
|
|
674
|
+
if (t.length === 0) {
|
|
664
675
|
Y(e, "selected", 0);
|
|
665
676
|
return;
|
|
666
677
|
}
|
|
667
|
-
let
|
|
668
|
-
|
|
669
|
-
const
|
|
670
|
-
R <
|
|
671
|
-
}), 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);
|
|
672
683
|
},
|
|
673
684
|
style: {
|
|
674
|
-
minHeight:
|
|
685
|
+
minHeight: m || h() < 768 ? "50px" : "70px",
|
|
675
686
|
width: "auto",
|
|
676
687
|
// Автоматическая ширина в зависимости от содержимого
|
|
677
688
|
maxWidth: "none",
|
|
678
689
|
// Убираем ограничение максимальной ширины
|
|
679
690
|
minWidth: "245px",
|
|
680
691
|
// Минимальная ширина для растягивания
|
|
681
|
-
border:
|
|
682
|
-
borderRadius:
|
|
683
|
-
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",
|
|
684
695
|
display: "flex",
|
|
685
|
-
flexWrap:
|
|
696
|
+
flexWrap: N() ? "wrap" : "nowrap",
|
|
686
697
|
alignItems: "center",
|
|
687
698
|
justifyContent: "center",
|
|
688
|
-
fontSize: `${
|
|
689
|
-
background:
|
|
690
|
-
overflowX:
|
|
691
|
-
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"
|
|
692
703
|
},
|
|
693
|
-
children:
|
|
704
|
+
children: I.map((e, n) => /* @__PURE__ */ a(
|
|
694
705
|
"span",
|
|
695
706
|
{
|
|
696
707
|
draggable: !l,
|
|
697
|
-
onDragStart: (
|
|
708
|
+
onDragStart: (t) => {
|
|
698
709
|
if (l) {
|
|
699
|
-
|
|
710
|
+
t.preventDefault();
|
|
700
711
|
return;
|
|
701
712
|
}
|
|
702
|
-
|
|
713
|
+
t.dataTransfer.setData(
|
|
703
714
|
"application/x-token",
|
|
704
715
|
JSON.stringify({ from: "selected", id: e.id })
|
|
705
|
-
),
|
|
716
|
+
), t.dataTransfer.setData("text/plain", e.id);
|
|
706
717
|
},
|
|
707
|
-
onDragOver: (
|
|
708
|
-
onDrop: (
|
|
709
|
-
const
|
|
710
|
-
|
|
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);
|
|
711
722
|
},
|
|
712
|
-
onDragEnter: (
|
|
723
|
+
onDragEnter: (t) => {
|
|
713
724
|
if (l) return;
|
|
714
|
-
const
|
|
715
|
-
|
|
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" });
|
|
716
727
|
},
|
|
717
|
-
onDragLeave: () =>
|
|
728
|
+
onDragLeave: () => B({ list: null, id: null, side: null }),
|
|
718
729
|
onClick: () => {
|
|
719
|
-
l ||
|
|
730
|
+
l || Q("selected", "bank", e.id, null);
|
|
720
731
|
},
|
|
721
732
|
title: l ? "Time expired" : "Click to remove back to bank",
|
|
722
733
|
style: {
|
|
723
|
-
padding:
|
|
724
|
-
margin:
|
|
725
|
-
borderRadius:
|
|
734
|
+
padding: y() ? "4px 6px" : "6px 10px",
|
|
735
|
+
margin: y() ? "2px" : "4px",
|
|
736
|
+
borderRadius: y() ? "4px" : "8px",
|
|
726
737
|
background: l ? "#f0f0f0" : "#ffe9e7",
|
|
727
738
|
border: l ? "1px solid #ccc" : "1px solid #ec4c44",
|
|
728
|
-
...
|
|
729
|
-
...
|
|
730
|
-
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",
|
|
731
742
|
userSelect: "none",
|
|
732
|
-
fontSize: `${
|
|
743
|
+
fontSize: `${we(I.length)}px`,
|
|
733
744
|
// Адаптивный размер шрифта для слов
|
|
734
745
|
fontFamily: '"Roboto", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',
|
|
735
746
|
// Более плотный шрифт
|
|
@@ -737,7 +748,7 @@ function yn(u = {}) {
|
|
|
737
748
|
// Запрещаем перенос слов
|
|
738
749
|
opacity: l ? 0.6 : 1,
|
|
739
750
|
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
740
|
-
...
|
|
751
|
+
...x.list === "selected" && x.id === e.id ? {
|
|
741
752
|
transform: "scale(1.05)",
|
|
742
753
|
boxShadow: "0 2px 8px rgba(59, 130, 246, 0.3)"
|
|
743
754
|
} : {}
|
|
@@ -751,116 +762,120 @@ function yn(u = {}) {
|
|
|
751
762
|
/* @__PURE__ */ a(
|
|
752
763
|
"button",
|
|
753
764
|
{
|
|
754
|
-
onClick: () =>
|
|
755
|
-
disabled: !l &&
|
|
765
|
+
onClick: () => tt(!0),
|
|
766
|
+
disabled: !l && I.length === 0,
|
|
756
767
|
style: {
|
|
757
|
-
marginTop:
|
|
758
|
-
fontSize:
|
|
759
|
-
padding:
|
|
760
|
-
borderRadius:
|
|
761
|
-
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",
|
|
762
773
|
color: "white",
|
|
763
774
|
border: "none",
|
|
764
|
-
cursor: l ||
|
|
775
|
+
cursor: l || I.length > 0 ? "pointer" : "not-allowed"
|
|
765
776
|
},
|
|
766
777
|
children: "NEXT"
|
|
767
778
|
}
|
|
768
779
|
)
|
|
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
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
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(
|
|
832
846
|
() => {
|
|
833
|
-
|
|
847
|
+
const e = h(), n = w();
|
|
848
|
+
if (m && e > n || n < 700 || !Se)
|
|
834
849
|
return null;
|
|
835
|
-
const
|
|
850
|
+
const t = s || (typeof window < "u" && window.origin ? `${window.origin}/cloud/speakid/games/magic%20sentence/logo` : "/cloud/speakid/games/magic%20sentence/logo");
|
|
836
851
|
return (
|
|
837
852
|
// ensure logo is positioned inside the square container
|
|
838
|
-
/* @__PURE__ */ a("div", { style: { ...
|
|
853
|
+
/* @__PURE__ */ a("div", { style: { ...u.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ b("picture", { children: [
|
|
839
854
|
/* @__PURE__ */ a(
|
|
840
855
|
"source",
|
|
841
856
|
{
|
|
842
|
-
srcSet: `${
|
|
857
|
+
srcSet: `${t}.svg`,
|
|
843
858
|
type: "image/svg+xml"
|
|
844
859
|
}
|
|
845
860
|
),
|
|
846
861
|
/* @__PURE__ */ a(
|
|
847
862
|
"img",
|
|
848
863
|
{
|
|
849
|
-
src: `${
|
|
864
|
+
src: `${t}.png`,
|
|
850
865
|
alt: "SPEAKID Logo",
|
|
851
|
-
style:
|
|
866
|
+
style: u.gmLogoImg,
|
|
852
867
|
loading: "lazy"
|
|
853
868
|
}
|
|
854
869
|
)
|
|
855
870
|
] }) })
|
|
856
871
|
);
|
|
857
872
|
},
|
|
858
|
-
[
|
|
873
|
+
[m, Se, s, $, H]
|
|
859
874
|
);
|
|
860
875
|
return /* @__PURE__ */ a(
|
|
861
876
|
"div",
|
|
862
877
|
{
|
|
863
|
-
ref:
|
|
878
|
+
ref: M,
|
|
864
879
|
style: {
|
|
865
880
|
width: "100%",
|
|
866
881
|
height: "100%",
|
|
@@ -880,19 +895,19 @@ function yn(u = {}) {
|
|
|
880
895
|
"div",
|
|
881
896
|
{
|
|
882
897
|
style: {
|
|
883
|
-
width:
|
|
884
|
-
height:
|
|
898
|
+
width: m ? "100%" : be || 1e3,
|
|
899
|
+
height: m ? "100%" : be || 1e3,
|
|
885
900
|
display: "flex",
|
|
886
901
|
justifyContent: "center",
|
|
887
902
|
alignItems: "center",
|
|
888
903
|
overflow: "hidden",
|
|
889
|
-
borderRadius:
|
|
904
|
+
borderRadius: m ? 0 : "20px",
|
|
890
905
|
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
891
|
-
boxShadow:
|
|
892
|
-
margin:
|
|
906
|
+
boxShadow: m ? "none" : "0 0 40px rgba(0,0,0,0.1)",
|
|
907
|
+
margin: m ? "0 auto" : "unset",
|
|
893
908
|
position: "relative",
|
|
894
909
|
// needed so absolute logo is inside the square
|
|
895
|
-
transform: `scale(${
|
|
910
|
+
transform: `scale(${ze})`
|
|
896
911
|
// ✅ Применяем масштаб для широких экранов
|
|
897
912
|
},
|
|
898
913
|
children: /* @__PURE__ */ a(
|
|
@@ -906,14 +921,14 @@ function yn(u = {}) {
|
|
|
906
921
|
justifyContent: "center",
|
|
907
922
|
alignItems: "center"
|
|
908
923
|
},
|
|
909
|
-
children: /* @__PURE__ */
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
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
|
|
917
932
|
] })
|
|
918
933
|
}
|
|
919
934
|
)
|
|
@@ -922,7 +937,7 @@ function yn(u = {}) {
|
|
|
922
937
|
}
|
|
923
938
|
);
|
|
924
939
|
}
|
|
925
|
-
class
|
|
940
|
+
class It extends pt {
|
|
926
941
|
constructor(s) {
|
|
927
942
|
super(s), this.state = { hasError: !1 };
|
|
928
943
|
}
|
|
@@ -932,17 +947,17 @@ class bn extends dn {
|
|
|
932
947
|
error: s
|
|
933
948
|
};
|
|
934
949
|
}
|
|
935
|
-
componentDidCatch(s,
|
|
936
|
-
console.error("Game Error:", s,
|
|
950
|
+
componentDidCatch(s, v) {
|
|
951
|
+
console.error("Game Error:", s, v), this.setState({
|
|
937
952
|
error: s,
|
|
938
|
-
errorInfo:
|
|
953
|
+
errorInfo: v
|
|
939
954
|
});
|
|
940
955
|
}
|
|
941
956
|
handleReset = () => {
|
|
942
957
|
this.setState({ hasError: !1, error: void 0, errorInfo: void 0 });
|
|
943
958
|
};
|
|
944
959
|
render() {
|
|
945
|
-
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: {
|
|
946
961
|
display: "flex",
|
|
947
962
|
flexDirection: "column",
|
|
948
963
|
alignItems: "center",
|
|
@@ -975,9 +990,9 @@ class bn extends dn {
|
|
|
975
990
|
children: "🔄 Restart Game"
|
|
976
991
|
}
|
|
977
992
|
),
|
|
978
|
-
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: [
|
|
979
994
|
/* @__PURE__ */ a("summary", { style: { cursor: "pointer", fontSize: "14px" }, children: "Technical Details (Development Only)" }),
|
|
980
|
-
/* @__PURE__ */
|
|
995
|
+
/* @__PURE__ */ b("pre", { style: {
|
|
981
996
|
backgroundColor: "#f3f4f6",
|
|
982
997
|
padding: "12px",
|
|
983
998
|
borderRadius: "4px",
|
|
@@ -993,12 +1008,12 @@ class bn extends dn {
|
|
|
993
1008
|
}
|
|
994
1009
|
}
|
|
995
1010
|
export {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
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
|
|
1003
1018
|
};
|
|
1004
1019
|
//# sourceMappingURL=speakid-build-a-sentence.es.js.map
|