speakid-build-a-sentence 1.0.20 → 1.0.22

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