speakid-build-a-sentence 1.0.26 → 1.0.28

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