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