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