speakid-build-a-sentence 1.0.23 → 1.0.25

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,5 +1,5 @@
1
1
  import { jsx as a, jsxs as x } from "react/jsx-runtime";
2
- import { useState as l, useCallback as ge, useRef as re, useEffect as Y, useMemo as sn, Component as dn } from "react";
2
+ import { useState as c, useCallback as ge, useRef as oe, useEffect as V, useMemo as sn, Component as dn } from "react";
3
3
  const an = `
4
4
  @keyframes spin {
5
5
  from { transform: rotate(0deg); }
@@ -173,33 +173,33 @@ const Te = {
173
173
  // ===== Анимационные стили =====
174
174
  ...Te
175
175
  }, ln = () => {
176
- const [u, s] = l([]), W = ge((H, I, f) => {
177
- const y = [];
178
- H.trim() || y.push({
176
+ const [u, s] = c([]), W = ge((H, I, f) => {
177
+ const b = [];
178
+ H.trim() || b.push({
179
179
  type: "empty",
180
180
  message: "Sentence cannot be empty"
181
- }), H.length > 41 && y.push({
181
+ }), H.length > 41 && b.push({
182
182
  type: "length",
183
183
  message: `Sentence is too long (${H.length}/41 characters)`
184
- }), H && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(H) && y.push({
184
+ }), H && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(H) && b.push({
185
185
  type: "characters",
186
186
  message: "Only Latin characters, numbers, spaces and punctuation are allowed"
187
187
  });
188
188
  const S = f.findIndex((C, K) => K !== I && C.toLowerCase().trim() === H.toLowerCase().trim());
189
- return S !== -1 && y.push({
189
+ return S !== -1 && b.push({
190
190
  type: "duplicate",
191
191
  message: `Duplicate sentence (same as sentence ${S + 1})`
192
- }), s(y), {
193
- isValid: y.length === 0,
194
- errors: y
192
+ }), s(b), {
193
+ isValid: b.length === 0,
194
+ errors: b
195
195
  };
196
196
  }, []), se = ge((H) => {
197
197
  const I = [];
198
- return H.forEach((f, y) => {
199
- const b = W(f, y, H);
200
- I.push(...b.errors.map((S) => ({
198
+ return H.forEach((f, b) => {
199
+ const y = W(f, b, H);
200
+ I.push(...y.errors.map((S) => ({
201
201
  ...S,
202
- message: `Sentence ${y + 1}: ${S.message}`
202
+ message: `Sentence ${b + 1}: ${S.message}`
203
203
  })));
204
204
  }), {
205
205
  isValid: I.length === 0,
@@ -216,7 +216,7 @@ const Te = {
216
216
  };
217
217
  }, cn = (u, s, W) => s && W ? `${u} word "${s}" ${W}` : s ? `${u} word "${s}"` : u, hn = (u, s, W = ["Enter", " "]) => {
218
218
  W.includes(u.key) && (u.preventDefault(), s());
219
- }, B = (u) => {
219
+ }, L = (u) => {
220
220
  const s = document.createElement("div");
221
221
  s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.left = "-10000px", s.style.width = "1px", s.style.height = "1px", s.style.overflow = "hidden", document.body.appendChild(s), s.textContent = u, setTimeout(() => {
222
222
  document.body.removeChild(s);
@@ -254,7 +254,7 @@ const Te = {
254
254
  s && s.remove(), document.head.appendChild(u);
255
255
  }, gn = (u) => [...u].sort(() => Math.random() - 0.5);
256
256
  function yn(u = {}) {
257
- const { logoUrl: s, showLogo: W = !0 } = u, se = re(null), { validateAllSentences: de, errors: H } = ln(), I = () => d || window.innerWidth < 768, f = () => d || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, y = (e = "medium") => {
257
+ const { logoUrl: s, showLogo: W = !0 } = u, se = oe(null), { validateAllSentences: de, errors: H } = ln(), I = () => d || window.innerWidth < 768, f = () => d || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, b = (e = "medium") => {
258
258
  if (!f())
259
259
  return {
260
260
  padding: "12px 24px",
@@ -282,24 +282,24 @@ function yn(u = {}) {
282
282
  };
283
283
  }
284
284
  };
285
- Y(() => (pn(), () => {
285
+ V(() => (pn(), () => {
286
286
  document.documentElement.style.overflow = "", document.body.style.overflow = "";
287
287
  const e = document.getElementById("magic-sentence-reset");
288
288
  e && e.remove();
289
289
  }), []);
290
- const [b, S] = l("select"), [C, K] = l(null), [ue, we] = l(null), [T, Z] = l([]), [D, fe] = l(0), [ae, me] = l([]), [k, le] = l([]), [q, xe] = l(20), [V, L] = l(0), [un, ye] = l(null), [M, z] = l(null), [c, _] = l(!1), [be, ce] = l(!1), [he, De] = l(
290
+ const [y, S] = 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(
291
291
  Number(localStorage.getItem("magicSentenceBest")) || 0
292
- ), U = re(null), Re = re(null), Se = re(0), [m, E] = l({ list: null, id: null, side: null }), [d, ze] = l(!1), [Ee, Q] = l(1), [We, ee] = l(null), [Pe, Be] = l(!1), [A, Le] = l(!1), [$, Me] = l(!1), [O, Ae] = l(!1), [N, $e] = l(!1), [G, Oe] = l(!1), [X, Ne] = l(!1), [j, Ge] = l(!1), [F, Xe] = l(!1), [wn, je] = l(!1), [fn, Fe] = l(!1);
293
- Y(() => {
292
+ ), J = oe(null), Re = oe(null), Se = oe(0), [m, E] = c({ list: null, id: null, side: null }), [d, ze] = c(!1), [Ee, Q] = c(1), [We, 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(() => {
294
294
  const e = () => {
295
- const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430, o = n < 700, p = t / n > 1.8, w = t === 768 && n === 1024, r = t === 1024 && n === 768, h = t === 820 && n === 1180, R = t === 1180 && n === 820, v = t === 540 && n === 720, oe = t === 720 && n === 540, He = t === 1024 && n === 1366, Ie = t === 1366 && n === 1024, Ce = t >= 1200 && n >= 600 && !i;
296
- Be(Ce), Le(w), Me(r), Ae(h), $e(R), Oe(v), Ne(oe), Ge(He), Xe(Ie), Fe(p);
297
- const rn = i && t > n || i || // ✅ ВСЕ мобильные устройства (включая portrait)
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
298
  n < 700 || p || // ✅ Широкие экраны
299
- t === 1366 && n === 766 || t === 1366 && n === 768 || t === 1280 && n === 720 || t === 1440 && n === 900 || w || r || h || R || v || oe || He || Ie || Ce;
300
- if (je(rn), ze(i), i)
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
301
  ee(null), Q(1);
302
- else if (o)
302
+ else if (r)
303
303
  ee(null), Q(1);
304
304
  else if (p) {
305
305
  const pe = Math.min(1e3, Math.min(t, n) * 0.9);
@@ -312,29 +312,29 @@ function yn(u = {}) {
312
312
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
313
313
  }, []);
314
314
  const ne = (e, t, n, i) => {
315
- if (c) return;
316
- let o = [...ae], p = [...k];
317
- const w = e === "bank" ? o : p, r = t === "bank" ? o : p, h = w.findIndex((oe) => oe.id === n);
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
318
  if (h === -1) return;
319
319
  const [R] = w.splice(h, 1);
320
320
  let v = i;
321
- e === t && v !== null && v !== void 0 && v > h && (v = v - 1), v == null || v < 0 || v > r.length ? r.push(R) : r.splice(v, 0, R), e === "bank" ? o = w : p = w, t === "bank" ? o = r : p = r, me(o), le(p);
322
- }, J = (e, t, n) => {
323
- if (e.preventDefault(), c) {
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
324
  E({ list: null, id: null, side: null });
325
325
  return;
326
326
  }
327
327
  const i = e.dataTransfer.getData("application/x-token") || (() => {
328
- const o = e.dataTransfer.getData("text/plain");
329
- if (!o) return "";
330
- const p = ae.some((h) => h.id === o), w = k.some((h) => h.id === o), r = p ? "bank" : w ? "selected" : null;
331
- return r ? JSON.stringify({ from: r, id: o }) : "";
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 }) : "";
332
332
  })();
333
333
  if (i) {
334
334
  try {
335
- const o = JSON.parse(i);
336
- if (!o || !o.id || !o.from) return;
337
- ne(o.from, t, o.id, n);
335
+ const r = JSON.parse(i);
336
+ if (!r || !r.id || !r.from) return;
337
+ ne(r.from, t, r.id, n);
338
338
  } catch {
339
339
  }
340
340
  E({ list: null, id: null, side: null });
@@ -348,49 +348,44 @@ function yn(u = {}) {
348
348
  return;
349
349
  const i = [...T];
350
350
  i[e] = t, Z(i);
351
- const o = de(i);
352
- o.isValid || console.warn("Validation errors:", o.errors);
351
+ const r = de(i);
352
+ r.isValid || console.warn("Validation errors:", r.errors);
353
353
  }, Je = (e) => e.trim().replace(/\s+/g, " "), ke = (e) => e <= 3 ? 20 : e <= 5 ? 18 : e <= 7 ? 16 : e <= 9 ? 14 : 12, Ye = () => {
354
- T.some((t) => t.trim().length === 0) || (Z((t) => t.map((n) => Je(n))), L(0), fe(0), Se.current = 0, ye(null), S("getready"));
354
+ T.some((t) => t.trim().length === 0) || (Z((t) => t.map((n) => Je(n))), M(0), fe(0), Se.current = 0, ye(null), S("getready"));
355
355
  };
356
- Y(() => {
357
- if (b === "getready") {
356
+ V(() => {
357
+ if (y === "getready") {
358
358
  const e = setTimeout(() => te(0), 3e3);
359
359
  return () => clearTimeout(e);
360
360
  }
361
- }, [b]);
361
+ }, [y]);
362
362
  const te = (e) => {
363
363
  const t = T[e];
364
364
  if (!t) return;
365
365
  const i = gn(
366
366
  t.trim().split(/\s+/).filter(Boolean)
367
- ).map((o, p) => ({
367
+ ).map((r, p) => ({
368
368
  id: `${Date.now()}-${e}-${p}-${Math.random().toString(36).slice(2)}`,
369
- text: o
369
+ text: r
370
370
  }));
371
371
  me(i), le([]), fe(e), Se.current = e, xe(ue || 20), z(null), _(!1), ce(!1), S("play");
372
372
  };
373
- Y(() => {
374
- if (b === "play" && !c)
375
- if (U.current !== null && window.clearTimeout(U.current), q > 0)
376
- U.current = window.setTimeout(() => xe((e) => e - 1), 1e3);
377
- else {
378
- _(!0);
379
- const e = T[D];
380
- if (!e) {
381
- z(null);
382
- return;
383
- }
384
- const t = e.trim().split(/\s+/), n = k.map((r) => r.text), i = t.filter((r) => !n.includes(r)).length, o = n.filter((r) => !t.includes(r)).length, p = t.filter((r, h) => r !== n[h]).length, w = i + o + p;
385
- w === 0 ? (z("correct"), be || (ce(!0), L((r) => r + 1)), P("correct"), B("Correct! Well done!")) : w === 1 ? (z("almost"), L((r) => r + 0.5), P("half"), B("Almost correct! Just one mistake.")) : (z("wrong"), P("wrong"), B("Not quite right. Keep trying!"));
373
+ V(() => (y === "play" && !l && (J.current !== null && window.clearTimeout(J.current), B > 0 ? J.current = window.setTimeout(() => xe((e) => e - 1), 1e3) : _(!0)), () => {
374
+ J.current !== null && window.clearTimeout(J.current);
375
+ }), [y, B, l]), V(() => {
376
+ if (y === "play" && l && B === 0) {
377
+ const e = T[D];
378
+ if (!e) {
379
+ z(null);
380
+ return;
386
381
  }
387
- return () => {
388
- U.current !== null && window.clearTimeout(U.current);
389
- };
390
- }, [b, q, c, T, D, k, be]);
382
+ 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;
383
+ 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!"));
384
+ }
385
+ }, [y, l, B, T, D, k, be]);
391
386
  const Ke = (e = !0) => {
392
387
  if (e) {
393
- if (c) {
388
+ if (l) {
394
389
  D + 1 < (C || 0) ? te(D + 1) : (S("results"), setTimeout(() => ie(), 600));
395
390
  return;
396
391
  }
@@ -399,15 +394,15 @@ function yn(u = {}) {
399
394
  D + 1 < (C || 0) ? te(D + 1) : (S("results"), setTimeout(() => ie(), 600));
400
395
  return;
401
396
  }
402
- const n = t.trim().split(/\s+/), i = k.map((h) => h.text), o = n.filter((h) => !i.includes(h)).length, p = i.filter((h) => !n.includes(h)).length, w = n.filter((h, R) => h !== i[R]).length, r = o + p + w;
403
- r === 0 ? (L((h) => h + 1), z("correct"), ce(!0), P("correct"), B("Correct! Well done!")) : r === 1 ? (L((h) => h + 0.5), z("almost"), P("half"), B("Almost correct! Just one mistake.")) : (z("wrong"), P("wrong"), B("Not quite right. Keep trying!")), D + 1 < (C || 0) ? setTimeout(() => te(D + 1), 800) : setTimeout(() => {
397
+ 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;
398
+ 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(() => {
404
399
  S("results"), setTimeout(() => ie(), 600);
405
400
  }, 800);
406
401
  }
407
402
  };
408
- Y(() => {
409
- b === "results" && V > he && (De(V), localStorage.setItem("magicSentenceBest", String(V)));
410
- }, [b, V, he]);
403
+ V(() => {
404
+ y === "results" && U > he && (De(U), localStorage.setItem("magicSentenceBest", String(U)));
405
+ }, [y, U, he]);
411
406
  const P = (e) => {
412
407
  const t = new (window.AudioContext || window.webkitAudioContext)(), n = t.createOscillator(), i = t.createGain();
413
408
  switch (n.connect(i), i.connect(t.destination), e) {
@@ -429,7 +424,7 @@ function yn(u = {}) {
429
424
  }
430
425
  i.gain.setValueAtTime(0.1, t.currentTime), n.start(), n.stop(t.currentTime + 0.2);
431
426
  }, ie = () => {
432
- const t = Date.now() + 2500, n = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], i = document.createElement("canvas"), o = i.getContext("2d");
427
+ const t = Date.now() + 2500, n = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], i = document.createElement("canvas"), r = i.getContext("2d");
433
428
  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);
434
429
  const p = Array.from({ length: 100 }).map(() => ({
435
430
  x: Math.random() * i.width,
@@ -439,8 +434,8 @@ function yn(u = {}) {
439
434
  speed: 2 + Math.random() * 4,
440
435
  tilt: Math.random() * 2 * Math.PI
441
436
  })), w = () => {
442
- o.clearRect(0, 0, i.width, i.height), p.forEach((r) => {
443
- o.fillStyle = r.color, o.beginPath(), o.ellipse(r.x, r.y, r.size, r.size / 2, r.tilt, 0, 2 * Math.PI), o.fill(), r.y += r.speed, r.x += Math.sin(r.tilt);
437
+ r.clearRect(0, 0, i.width, i.height), p.forEach((o) => {
438
+ 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);
444
439
  }), Date.now() < t ? requestAnimationFrame(w) : document.body.removeChild(i);
445
440
  };
446
441
  w();
@@ -457,7 +452,7 @@ function yn(u = {}) {
457
452
  onClick: () => qe(e),
458
453
  style: {
459
454
  ...g.gmButton,
460
- ...y("medium")
455
+ ...b("medium")
461
456
  },
462
457
  children: [
463
458
  e,
@@ -479,7 +474,7 @@ function yn(u = {}) {
479
474
  onClick: () => Ve(e),
480
475
  style: {
481
476
  ...g.gmButton,
482
- ...y("medium")
477
+ ...b("medium")
483
478
  },
484
479
  children: [
485
480
  e,
@@ -535,7 +530,7 @@ function yn(u = {}) {
535
530
  marginTop: 30,
536
531
  background: T.some((e) => e.trim().length === 0) ? "#ccc" : "#ec4c44",
537
532
  cursor: T.some((e) => e.trim().length === 0) ? "not-allowed" : "pointer",
538
- ...y("large")
533
+ ...b("large")
539
534
  },
540
535
  children: "PLAY"
541
536
  }
@@ -556,7 +551,7 @@ function yn(u = {}) {
556
551
  "/",
557
552
  C,
558
553
  " — ",
559
- c ? "TIME'S UP!" : `Time: ${q}s`
554
+ l ? "TIME'S UP!" : `Time: ${B}s`
560
555
  ] }),
561
556
  /* @__PURE__ */ a(
562
557
  "div",
@@ -574,8 +569,8 @@ function yn(u = {}) {
574
569
  {
575
570
  style: {
576
571
  height: "100%",
577
- width: `${q / (ue || 20) * 100}%`,
578
- background: q <= 5 ? "#ec4c44" : "#4caf50",
572
+ width: `${B / (ue || 20) * 100}%`,
573
+ background: B <= 5 ? "#ec4c44" : "#4caf50",
579
574
  transition: "width 1s linear"
580
575
  }
581
576
  }
@@ -586,7 +581,7 @@ function yn(u = {}) {
586
581
  "div",
587
582
  {
588
583
  onDragOver: (e) => e.preventDefault(),
589
- onDrop: (e) => J(e, "bank", null),
584
+ onDrop: (e) => Y(e, "bank", null),
590
585
  style: {
591
586
  display: "flex",
592
587
  flexWrap: I() ? "wrap" : "nowrap",
@@ -600,49 +595,49 @@ function yn(u = {}) {
600
595
  children: ae.map((e, t) => /* @__PURE__ */ a(
601
596
  "div",
602
597
  {
603
- draggable: !c,
598
+ draggable: !l,
604
599
  role: "button",
605
- tabIndex: c ? -1 : 0,
606
- "aria-label": c ? `Word: ${e.text} (time expired)` : cn("Drag word", e.text, "to build sentence"),
600
+ tabIndex: l ? -1 : 0,
601
+ "aria-label": l ? `Word: ${e.text} (time expired)` : cn("Drag word", e.text, "to build sentence"),
607
602
  onDragStart: (n) => {
608
- if (c) {
603
+ if (l) {
609
604
  n.preventDefault();
610
605
  return;
611
606
  }
612
607
  n.dataTransfer.setData(
613
608
  "application/x-token",
614
609
  JSON.stringify({ from: "bank", id: e.id })
615
- ), n.dataTransfer.setData("text/plain", e.id), B(`Dragging word: ${e.text}`);
610
+ ), n.dataTransfer.setData("text/plain", e.id), L(`Dragging word: ${e.text}`);
616
611
  },
617
612
  onKeyDown: (n) => {
618
- c || hn(n, () => ne("bank", "selected", e.id, null));
613
+ l || hn(n, () => ne("bank", "selected", e.id, null));
619
614
  },
620
615
  onDragOver: (n) => n.preventDefault(),
621
616
  onDrop: (n) => {
622
- const i = n.currentTarget.getBoundingClientRect(), o = i.left + i.width / 2, p = n.clientX > o ? t + 1 : t;
623
- E({ list: null, id: null, side: null }), n.stopPropagation(), J(n, "bank", p);
617
+ const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, p = n.clientX > r ? t + 1 : t;
618
+ E({ list: null, id: null, side: null }), n.stopPropagation(), Y(n, "bank", p);
624
619
  },
625
620
  onDragEnter: (n) => {
626
- if (c) return;
627
- const i = n.currentTarget.getBoundingClientRect(), o = i.left + i.width / 2;
628
- E({ list: "bank", id: e.id, side: n.clientX > o ? "right" : "left" });
621
+ if (l) return;
622
+ const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
623
+ E({ list: "bank", id: e.id, side: n.clientX > r ? "right" : "left" });
629
624
  },
630
625
  onDragLeave: () => E({ list: null, id: null, side: null }),
631
626
  onClick: () => {
632
- c || ne("bank", "selected", e.id, null);
627
+ l || ne("bank", "selected", e.id, null);
633
628
  },
634
629
  style: {
635
630
  padding: d || window.innerWidth < 768 ? "6px 10px" : "10px 16px",
636
631
  borderRadius: d || window.innerWidth < 768 ? "6px" : "10px",
637
632
  border: "1px solid #ccc",
638
- background: c ? "#f0f0f0" : "#f9f9f9",
639
- cursor: c ? "not-allowed" : m.list === "bank" && m.id === e.id ? "grabbing" : "grab",
633
+ background: l ? "#f0f0f0" : "#f9f9f9",
634
+ cursor: l ? "not-allowed" : m.list === "bank" && m.id === e.id ? "grabbing" : "grab",
640
635
  fontSize: d || window.innerWidth < 768 ? "12px" : "18px",
641
636
  ...m.list === "bank" && m.id === e.id && m.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
642
637
  ...m.list === "bank" && m.id === e.id && m.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
643
638
  flexShrink: 0,
644
639
  flexBasis: "auto",
645
- opacity: c ? 0.6 : 1,
640
+ opacity: l ? 0.6 : 1,
646
641
  transition: "opacity 0.3s ease, transform 0.2s ease",
647
642
  ...m.list === "bank" && m.id === e.id ? {
648
643
  transform: "scale(1.05)",
@@ -662,14 +657,14 @@ function yn(u = {}) {
662
657
  onDrop: (e) => {
663
658
  const t = e.currentTarget.getBoundingClientRect(), n = Array.from(e.currentTarget.children);
664
659
  if (n.length === 0) {
665
- J(e, "selected", 0);
660
+ Y(e, "selected", 0);
666
661
  return;
667
662
  }
668
- let i = k.length, o = 1 / 0;
663
+ let i = k.length, r = 1 / 0;
669
664
  n.forEach((p, w) => {
670
- const r = p.getBoundingClientRect(), h = r.left + r.width / 2, R = Math.abs(e.clientX - h);
671
- R < o && (o = R, i = e.clientX < h ? w : w + 1);
672
- }), e.clientX > t.right - 30 && (i = k.length), e.clientX < t.left + 30 && (i = 0), J(e, "selected", i);
665
+ const o = p.getBoundingClientRect(), h = o.left + o.width / 2, R = Math.abs(e.clientX - h);
666
+ R < r && (r = R, i = e.clientX < h ? w : w + 1);
667
+ }), e.clientX > t.right - 30 && (i = k.length), e.clientX < t.left + 30 && (i = 0), Y(e, "selected", i);
673
668
  },
674
669
  style: {
675
670
  minHeight: d || window.innerWidth < 768 ? "50px" : "70px",
@@ -679,7 +674,7 @@ function yn(u = {}) {
679
674
  // Убираем ограничение максимальной ширины
680
675
  minWidth: "245px",
681
676
  // Минимальная ширина для растягивания
682
- border: M === "correct" ? "2px dashed #4caf50" : M === "almost" ? "2px dashed #ff9800" : M === "wrong" ? "2px dashed #f44336" : "2px dashed #ccc",
677
+ border: A === "correct" ? "2px dashed #4caf50" : A === "almost" ? "2px dashed #ff9800" : A === "wrong" ? "2px dashed #f44336" : "2px dashed #ccc",
683
678
  borderRadius: d || window.innerWidth < 768 ? "8px" : "12px",
684
679
  padding: d || window.innerWidth < 768 ? "8px" : "12px",
685
680
  display: "flex",
@@ -687,16 +682,16 @@ function yn(u = {}) {
687
682
  alignItems: "center",
688
683
  justifyContent: "center",
689
684
  fontSize: `${ke(k.length)}px`,
690
- background: M === "correct" ? "#e8f5e8" : M === "almost" ? "#fff3e0" : M === "wrong" ? "#ffebee" : "#fafafa",
685
+ background: A === "correct" ? "#e8f5e8" : A === "almost" ? "#fff3e0" : A === "wrong" ? "#ffebee" : "#fafafa",
691
686
  overflowX: I() ? "hidden" : "auto",
692
687
  whiteSpace: I() ? "normal" : "nowrap"
693
688
  },
694
689
  children: k.map((e, t) => /* @__PURE__ */ a(
695
690
  "span",
696
691
  {
697
- draggable: !c,
692
+ draggable: !l,
698
693
  onDragStart: (n) => {
699
- if (c) {
694
+ if (l) {
700
695
  n.preventDefault();
701
696
  return;
702
697
  }
@@ -707,28 +702,28 @@ function yn(u = {}) {
707
702
  },
708
703
  onDragOver: (n) => n.preventDefault(),
709
704
  onDrop: (n) => {
710
- const i = n.currentTarget.getBoundingClientRect(), o = i.left + i.width / 2, p = i.width * 0.25, w = n.clientX < o - p ? t : n.clientX > o + p || n.clientX > o ? t + 1 : t;
711
- E({ list: null, id: null, side: null }), n.stopPropagation(), J(n, "selected", w);
705
+ 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;
706
+ E({ list: null, id: null, side: null }), n.stopPropagation(), Y(n, "selected", w);
712
707
  },
713
708
  onDragEnter: (n) => {
714
- if (c) return;
715
- const i = n.currentTarget.getBoundingClientRect(), o = i.left + i.width / 2;
716
- E({ list: "selected", id: e.id, side: n.clientX > o ? "right" : "left" });
709
+ if (l) return;
710
+ const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
711
+ E({ list: "selected", id: e.id, side: n.clientX > r ? "right" : "left" });
717
712
  },
718
713
  onDragLeave: () => E({ list: null, id: null, side: null }),
719
714
  onClick: () => {
720
- c || ne("selected", "bank", e.id, null);
715
+ l || ne("selected", "bank", e.id, null);
721
716
  },
722
- title: c ? "Time expired" : "Click to remove back to bank",
717
+ title: l ? "Time expired" : "Click to remove back to bank",
723
718
  style: {
724
719
  padding: f() ? "4px 6px" : "6px 10px",
725
720
  margin: f() ? "2px" : "4px",
726
721
  borderRadius: f() ? "4px" : "8px",
727
- background: c ? "#f0f0f0" : "#ffe9e7",
728
- border: c ? "1px solid #ccc" : "1px solid #ec4c44",
722
+ background: l ? "#f0f0f0" : "#ffe9e7",
723
+ border: l ? "1px solid #ccc" : "1px solid #ec4c44",
729
724
  ...m.list === "selected" && m.id === e.id && m.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
730
725
  ...m.list === "selected" && m.id === e.id && m.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
731
- cursor: c ? "not-allowed" : m.list === "selected" && m.id === e.id ? "grabbing" : "grab",
726
+ cursor: l ? "not-allowed" : m.list === "selected" && m.id === e.id ? "grabbing" : "grab",
732
727
  userSelect: "none",
733
728
  fontSize: `${ke(k.length)}px`,
734
729
  // Адаптивный размер шрифта для слов
@@ -736,7 +731,7 @@ function yn(u = {}) {
736
731
  // Более плотный шрифт
737
732
  whiteSpace: "nowrap",
738
733
  // Запрещаем перенос слов
739
- opacity: c ? 0.6 : 1,
734
+ opacity: l ? 0.6 : 1,
740
735
  transition: "opacity 0.3s ease, transform 0.2s ease",
741
736
  ...m.list === "selected" && m.id === e.id ? {
742
737
  transform: "scale(1.05)",
@@ -753,16 +748,16 @@ function yn(u = {}) {
753
748
  "button",
754
749
  {
755
750
  onClick: () => Ke(!0),
756
- disabled: !c && k.length === 0,
751
+ disabled: !l && k.length === 0,
757
752
  style: {
758
753
  marginTop: f() ? "15px" : "30px",
759
754
  fontSize: f() ? "14px" : "20px",
760
755
  padding: f() ? "6px 12px" : "10px 24px",
761
756
  borderRadius: f() ? "8px" : "12px",
762
- background: c || k.length > 0 ? "#ec4c44" : "#ccc",
757
+ background: l || k.length > 0 ? "#ec4c44" : "#ccc",
763
758
  color: "white",
764
759
  border: "none",
765
- cursor: c || k.length > 0 ? "pointer" : "not-allowed"
760
+ cursor: l || k.length > 0 ? "pointer" : "not-allowed"
766
761
  },
767
762
  children: "NEXT"
768
763
  }
@@ -770,26 +765,26 @@ function yn(u = {}) {
770
765
  ] }), tn = () => /* @__PURE__ */ x("div", { style: g.gmCenterScreen, children: [
771
766
  /* @__PURE__ */ a("h1", { style: {
772
767
  ...g.gmHeadline1,
773
- marginTop: (d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || A || $ || O || N || G || X || j || F, "0px"),
774
- marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || A || $ || O || N || G || X || j || F ? "2px" : "10px",
768
+ 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"),
769
+ 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",
775
770
  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)"
776
771
  }, children: "Game Over 🎯" }),
777
772
  /* @__PURE__ */ x("h2", { style: {
778
773
  ...g.gmHeadline2,
779
- marginTop: (d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || A || $ || O || N || G || X || j || F, "0px"),
780
- marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || A || $ || O || N || G || X || j || F ? "2px" : "16px",
774
+ 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"),
775
+ 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",
781
776
  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"
782
777
  }, children: [
783
778
  "Your score: ",
784
- V,
779
+ U,
785
780
  " out of ",
786
781
  C
787
782
  ] }),
788
783
  /* @__PURE__ */ x("p", { style: {
789
784
  ...g.gmBodyM,
790
785
  color: "#10b981",
791
- marginTop: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || A || $ || O || N || G || X || j || F ? "0px" : "12px",
792
- marginBottom: d && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || A || $ || O || N || G || X || j || F ? "2px" : "16px",
786
+ 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",
787
+ 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",
793
788
  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"
794
789
  }, children: [
795
790
  "Best score: ",
@@ -810,7 +805,7 @@ function yn(u = {}) {
810
805
  },
811
806
  style: {
812
807
  ...g.gmButton,
813
- ...y("medium")
808
+ ...b("medium")
814
809
  },
815
810
  children: "🔁 Play again"
816
811
  }
@@ -819,17 +814,17 @@ function yn(u = {}) {
819
814
  "button",
820
815
  {
821
816
  onClick: () => {
822
- P("click"), S("select"), K(null), we(null), Z([]), L(0), le([]), _(!1);
817
+ P("click"), S("select"), K(null), we(null), Z([]), M(0), le([]), _(!1);
823
818
  },
824
819
  style: {
825
820
  ...g.gmButton,
826
- ...y("medium")
821
+ ...b("medium")
827
822
  },
828
823
  children: "⬅️ Exit"
829
824
  }
830
825
  )
831
826
  ] })
832
- ] }), ve = !d && W, on = sn(
827
+ ] }), ve = !d && W, rn = sn(
833
828
  () => {
834
829
  if (d && window.innerWidth > window.innerHeight || window.innerHeight < 700 || !ve)
835
830
  return null;
@@ -908,13 +903,13 @@ function yn(u = {}) {
908
903
  alignItems: "center"
909
904
  },
910
905
  children: /* @__PURE__ */ x("div", { id: "magic-sentence-root", children: [
911
- on,
912
- b === "select" ? Ze() : null,
913
- b === "time" ? _e() : null,
914
- b === "type" ? Qe() : null,
915
- b === "getready" ? en() : null,
916
- b === "play" ? nn() : null,
917
- b === "results" ? tn() : null
906
+ rn,
907
+ y === "select" ? Ze() : null,
908
+ y === "time" ? _e() : null,
909
+ y === "type" ? Qe() : null,
910
+ y === "getready" ? en() : null,
911
+ y === "play" ? nn() : null,
912
+ y === "results" ? tn() : null
918
913
  ] })
919
914
  }
920
915
  )
@@ -996,7 +991,7 @@ class bn extends dn {
996
991
  export {
997
992
  bn as ErrorBoundary,
998
993
  yn as Game,
999
- B as announceToScreenReader,
994
+ L as announceToScreenReader,
1000
995
  cn as createAriaLabel,
1001
996
  yn as default,
1002
997
  hn as handleKeyDown,