speakid-build-a-sentence 1.0.26 → 1.0.27

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