speakid-build-a-sentence 1.0.15 → 1.0.16
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.
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/speakid-build-a-sentence.cjs.js +61 -0
- package/dist/speakid-build-a-sentence.cjs.js.map +1 -0
- package/dist/speakid-build-a-sentence.es.js +377 -654
- package/dist/speakid-build-a-sentence.es.js.map +1 -1
- package/package.json +3 -3
- package/dist/speakid-build-a-sentence.umd.js +0 -82
- package/dist/speakid-build-a-sentence.umd.js.map +0 -1
|
@@ -1,283 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @license React
|
|
5
|
-
* react-jsx-runtime.production.js
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
var Pe;
|
|
13
|
-
function an() {
|
|
14
|
-
if (Pe) return pe;
|
|
15
|
-
Pe = 1;
|
|
16
|
-
var p = Symbol.for("react.transitional.element"), d = Symbol.for("react.fragment");
|
|
17
|
-
function S(j, W, w) {
|
|
18
|
-
var P = null;
|
|
19
|
-
if (w !== void 0 && (P = "" + w), W.key !== void 0 && (P = "" + W.key), "key" in W) {
|
|
20
|
-
w = {};
|
|
21
|
-
for (var R in W)
|
|
22
|
-
R !== "key" && (w[R] = W[R]);
|
|
23
|
-
} else w = W;
|
|
24
|
-
return W = w.ref, {
|
|
25
|
-
$$typeof: p,
|
|
26
|
-
type: j,
|
|
27
|
-
key: P,
|
|
28
|
-
ref: W !== void 0 ? W : null,
|
|
29
|
-
props: w
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return pe.Fragment = d, pe.jsx = S, pe.jsxs = S, pe;
|
|
33
|
-
}
|
|
34
|
-
var fe = {};
|
|
35
|
-
/**
|
|
36
|
-
* @license React
|
|
37
|
-
* react-jsx-runtime.development.js
|
|
38
|
-
*
|
|
39
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the MIT license found in the
|
|
42
|
-
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/
|
|
44
|
-
var He;
|
|
45
|
-
function ln() {
|
|
46
|
-
return He || (He = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
47
|
-
function p(e) {
|
|
48
|
-
if (e == null) return null;
|
|
49
|
-
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof === V ? null : e.displayName || e.name || null;
|
|
51
|
-
if (typeof e == "string") return e;
|
|
52
|
-
switch (e) {
|
|
53
|
-
case E:
|
|
54
|
-
return "Fragment";
|
|
55
|
-
case _:
|
|
56
|
-
return "Profiler";
|
|
57
|
-
case U:
|
|
58
|
-
return "StrictMode";
|
|
59
|
-
case I:
|
|
60
|
-
return "Suspense";
|
|
61
|
-
case ae:
|
|
62
|
-
return "SuspenseList";
|
|
63
|
-
case $:
|
|
64
|
-
return "Activity";
|
|
65
|
-
}
|
|
66
|
-
if (typeof e == "object")
|
|
67
|
-
switch (typeof e.tag == "number" && console.error(
|
|
68
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
-
), e.$$typeof) {
|
|
70
|
-
case ge:
|
|
71
|
-
return "Portal";
|
|
72
|
-
case se:
|
|
73
|
-
return e.displayName || "Context";
|
|
74
|
-
case he:
|
|
75
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case me:
|
|
77
|
-
var a = e.render;
|
|
78
|
-
return e = e.displayName, e || (e = a.displayName || a.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
-
case z:
|
|
80
|
-
return a = e.displayName || null, a !== null ? a : p(e.type) || "Memo";
|
|
81
|
-
case J:
|
|
82
|
-
a = e._payload, e = e._init;
|
|
83
|
-
try {
|
|
84
|
-
return p(e(a));
|
|
85
|
-
} catch {
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
function d(e) {
|
|
91
|
-
return "" + e;
|
|
92
|
-
}
|
|
93
|
-
function S(e) {
|
|
94
|
-
try {
|
|
95
|
-
d(e);
|
|
96
|
-
var a = !1;
|
|
97
|
-
} catch {
|
|
98
|
-
a = !0;
|
|
99
|
-
}
|
|
100
|
-
if (a) {
|
|
101
|
-
a = console;
|
|
102
|
-
var r = a.error, b = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
-
return r.call(
|
|
104
|
-
a,
|
|
105
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
b
|
|
107
|
-
), d(e);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function j(e) {
|
|
111
|
-
if (e === E) return "<>";
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof === J)
|
|
113
|
-
return "<...>";
|
|
114
|
-
try {
|
|
115
|
-
var a = p(e);
|
|
116
|
-
return a ? "<" + a + ">" : "<...>";
|
|
117
|
-
} catch {
|
|
118
|
-
return "<...>";
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function W() {
|
|
122
|
-
var e = we.A;
|
|
123
|
-
return e === null ? null : e.getOwner();
|
|
124
|
-
}
|
|
125
|
-
function w() {
|
|
126
|
-
return Error("react-stack-top-frame");
|
|
127
|
-
}
|
|
128
|
-
function P(e) {
|
|
129
|
-
if (le.call(e, "key")) {
|
|
130
|
-
var a = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
-
if (a && a.isReactWarning) return !1;
|
|
132
|
-
}
|
|
133
|
-
return e.key !== void 0;
|
|
134
|
-
}
|
|
135
|
-
function R(e, a) {
|
|
136
|
-
function r() {
|
|
137
|
-
c || (c = !0, console.error(
|
|
138
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
-
a
|
|
140
|
-
));
|
|
141
|
-
}
|
|
142
|
-
r.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
-
get: r,
|
|
144
|
-
configurable: !0
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function f() {
|
|
148
|
-
var e = p(this.type);
|
|
149
|
-
return F[e] || (F[e] = !0, console.error(
|
|
150
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
|
-
}
|
|
153
|
-
function D(e, a, r, b, de, G) {
|
|
154
|
-
var x = r.ref;
|
|
155
|
-
return e = {
|
|
156
|
-
$$typeof: oe,
|
|
157
|
-
type: e,
|
|
158
|
-
key: a,
|
|
159
|
-
props: r,
|
|
160
|
-
_owner: b
|
|
161
|
-
}, (x !== void 0 ? x : null) !== null ? Object.defineProperty(e, "ref", {
|
|
162
|
-
enumerable: !1,
|
|
163
|
-
get: f
|
|
164
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
165
|
-
configurable: !1,
|
|
166
|
-
enumerable: !1,
|
|
167
|
-
writable: !0,
|
|
168
|
-
value: 0
|
|
169
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
170
|
-
configurable: !1,
|
|
171
|
-
enumerable: !1,
|
|
172
|
-
writable: !0,
|
|
173
|
-
value: null
|
|
174
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
175
|
-
configurable: !1,
|
|
176
|
-
enumerable: !1,
|
|
177
|
-
writable: !0,
|
|
178
|
-
value: de
|
|
179
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
180
|
-
configurable: !1,
|
|
181
|
-
enumerable: !1,
|
|
182
|
-
writable: !0,
|
|
183
|
-
value: G
|
|
184
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
185
|
-
}
|
|
186
|
-
function y(e, a, r, b, de, G) {
|
|
187
|
-
var x = a.children;
|
|
188
|
-
if (x !== void 0)
|
|
189
|
-
if (b)
|
|
190
|
-
if (M(x)) {
|
|
191
|
-
for (b = 0; b < x.length; b++)
|
|
192
|
-
T(x[b]);
|
|
193
|
-
Object.freeze && Object.freeze(x);
|
|
194
|
-
} else
|
|
195
|
-
console.error(
|
|
196
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
|
-
);
|
|
198
|
-
else T(x);
|
|
199
|
-
if (le.call(a, "key")) {
|
|
200
|
-
x = p(e);
|
|
201
|
-
var O = Object.keys(a).filter(function(Se) {
|
|
202
|
-
return Se !== "key";
|
|
203
|
-
});
|
|
204
|
-
b = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", L[x + b] || (O = 0 < O.length ? "{" + O.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
206
|
-
let props = %s;
|
|
207
|
-
<%s {...props} />
|
|
208
|
-
React keys must be passed directly to JSX without using spread:
|
|
209
|
-
let props = %s;
|
|
210
|
-
<%s key={someKey} {...props} />`,
|
|
211
|
-
b,
|
|
212
|
-
x,
|
|
213
|
-
O,
|
|
214
|
-
x
|
|
215
|
-
), L[x + b] = !0);
|
|
216
|
-
}
|
|
217
|
-
if (x = null, r !== void 0 && (S(r), x = "" + r), P(a) && (S(a.key), x = "" + a.key), "key" in a) {
|
|
218
|
-
r = {};
|
|
219
|
-
for (var ce in a)
|
|
220
|
-
ce !== "key" && (r[ce] = a[ce]);
|
|
221
|
-
} else r = a;
|
|
222
|
-
return x && R(
|
|
223
|
-
r,
|
|
224
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
225
|
-
), D(
|
|
226
|
-
e,
|
|
227
|
-
x,
|
|
228
|
-
r,
|
|
229
|
-
W(),
|
|
230
|
-
de,
|
|
231
|
-
G
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
function T(e) {
|
|
235
|
-
H(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === J && (e._payload.status === "fulfilled" ? H(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
236
|
-
}
|
|
237
|
-
function H(e) {
|
|
238
|
-
return typeof e == "object" && e !== null && e.$$typeof === oe;
|
|
239
|
-
}
|
|
240
|
-
var B = on, oe = Symbol.for("react.transitional.element"), ge = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), he = Symbol.for("react.consumer"), se = Symbol.for("react.context"), me = Symbol.for("react.forward_ref"), I = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), J = Symbol.for("react.lazy"), $ = Symbol.for("react.activity"), V = Symbol.for("react.client.reference"), we = B.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, le = Object.prototype.hasOwnProperty, M = Array.isArray, A = console.createTask ? console.createTask : function() {
|
|
241
|
-
return null;
|
|
242
|
-
};
|
|
243
|
-
B = {
|
|
244
|
-
react_stack_bottom_frame: function(e) {
|
|
245
|
-
return e();
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
var c, F = {}, X = B.react_stack_bottom_frame.bind(
|
|
249
|
-
B,
|
|
250
|
-
w
|
|
251
|
-
)(), xe = A(j(w)), L = {};
|
|
252
|
-
fe.Fragment = E, fe.jsx = function(e, a, r) {
|
|
253
|
-
var b = 1e4 > we.recentlyCreatedOwnerStacks++;
|
|
254
|
-
return y(
|
|
255
|
-
e,
|
|
256
|
-
a,
|
|
257
|
-
r,
|
|
258
|
-
!1,
|
|
259
|
-
b ? Error("react-stack-top-frame") : X,
|
|
260
|
-
b ? A(j(e)) : xe
|
|
261
|
-
);
|
|
262
|
-
}, fe.jsxs = function(e, a, r) {
|
|
263
|
-
var b = 1e4 > we.recentlyCreatedOwnerStacks++;
|
|
264
|
-
return y(
|
|
265
|
-
e,
|
|
266
|
-
a,
|
|
267
|
-
r,
|
|
268
|
-
!0,
|
|
269
|
-
b ? Error("react-stack-top-frame") : X,
|
|
270
|
-
b ? A(j(e)) : xe
|
|
271
|
-
);
|
|
272
|
-
};
|
|
273
|
-
})()), fe;
|
|
274
|
-
}
|
|
275
|
-
var Ce;
|
|
276
|
-
function dn() {
|
|
277
|
-
return Ce || (Ce = 1, process.env.NODE_ENV === "production" ? ve.exports = an() : ve.exports = ln()), ve.exports;
|
|
278
|
-
}
|
|
279
|
-
var s = dn();
|
|
280
|
-
const cn = `
|
|
1
|
+
import { jsx as a, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useCallback as ce, useRef as We, useEffect as V, Component as Ye } from "react";
|
|
3
|
+
const Ke = `
|
|
281
4
|
@keyframes magic-sentence-spin {
|
|
282
5
|
from { transform: rotate(0deg); }
|
|
283
6
|
to { transform: rotate(360deg); }
|
|
@@ -312,10 +35,10 @@ const cn = `
|
|
|
312
35
|
}
|
|
313
36
|
`;
|
|
314
37
|
if (typeof document < "u" && !document.getElementById("magic-sentence-keyframes")) {
|
|
315
|
-
const
|
|
316
|
-
|
|
38
|
+
const w = document.createElement("style");
|
|
39
|
+
w.id = "magic-sentence-keyframes", w.innerHTML = Ke, document.head.appendChild(w);
|
|
317
40
|
}
|
|
318
|
-
const
|
|
41
|
+
const Se = {
|
|
319
42
|
spin: {
|
|
320
43
|
animation: "magic-sentence-spin 1.4s linear infinite"
|
|
321
44
|
},
|
|
@@ -334,7 +57,7 @@ const Ae = {
|
|
|
334
57
|
glow: {
|
|
335
58
|
animation: "magic-sentence-glow 1s ease-in-out infinite"
|
|
336
59
|
}
|
|
337
|
-
},
|
|
60
|
+
}, g = {
|
|
338
61
|
gmCenterScreen: {
|
|
339
62
|
position: "relative",
|
|
340
63
|
zIndex: 1,
|
|
@@ -448,62 +171,62 @@ const Ae = {
|
|
|
448
171
|
},
|
|
449
172
|
gmHourglass: {
|
|
450
173
|
fontSize: "42px",
|
|
451
|
-
...
|
|
174
|
+
...Se.spin
|
|
452
175
|
},
|
|
453
176
|
// ===== Анимационные стили =====
|
|
454
|
-
...
|
|
455
|
-
},
|
|
456
|
-
const [
|
|
457
|
-
const
|
|
458
|
-
|
|
177
|
+
...Se
|
|
178
|
+
}, _e = () => {
|
|
179
|
+
const [w, r] = p([]), y = ce((S, M, C) => {
|
|
180
|
+
const c = [];
|
|
181
|
+
S.trim() || c.push({
|
|
459
182
|
type: "empty",
|
|
460
183
|
message: "Sentence cannot be empty"
|
|
461
|
-
}),
|
|
184
|
+
}), S.length > 41 && c.push({
|
|
462
185
|
type: "length",
|
|
463
|
-
message: `Sentence is too long (${
|
|
464
|
-
}),
|
|
186
|
+
message: `Sentence is too long (${S.length}/41 characters)`
|
|
187
|
+
}), S && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(S) && c.push({
|
|
465
188
|
type: "characters",
|
|
466
189
|
message: "Only Latin characters, numbers, spaces and punctuation are allowed"
|
|
467
190
|
});
|
|
468
|
-
const
|
|
469
|
-
return
|
|
191
|
+
const m = C.findIndex((k, I) => I !== M && k.toLowerCase().trim() === S.toLowerCase().trim());
|
|
192
|
+
return m !== -1 && c.push({
|
|
470
193
|
type: "duplicate",
|
|
471
|
-
message: `Duplicate sentence (same as sentence ${
|
|
472
|
-
}),
|
|
473
|
-
isValid:
|
|
474
|
-
errors:
|
|
194
|
+
message: `Duplicate sentence (same as sentence ${m + 1})`
|
|
195
|
+
}), r(c), {
|
|
196
|
+
isValid: c.length === 0,
|
|
197
|
+
errors: c
|
|
475
198
|
};
|
|
476
|
-
}, []),
|
|
477
|
-
const
|
|
478
|
-
return
|
|
479
|
-
const D =
|
|
480
|
-
|
|
481
|
-
...
|
|
482
|
-
message: `Sentence ${
|
|
199
|
+
}, []), B = ce((S) => {
|
|
200
|
+
const M = [];
|
|
201
|
+
return S.forEach((C, c) => {
|
|
202
|
+
const D = y(C, c, S);
|
|
203
|
+
M.push(...D.errors.map((m) => ({
|
|
204
|
+
...m,
|
|
205
|
+
message: `Sentence ${c + 1}: ${m.message}`
|
|
483
206
|
})));
|
|
484
207
|
}), {
|
|
485
|
-
isValid:
|
|
486
|
-
errors:
|
|
208
|
+
isValid: M.length === 0,
|
|
209
|
+
errors: M
|
|
487
210
|
};
|
|
488
|
-
}, [
|
|
489
|
-
|
|
211
|
+
}, [y]), ne = ce(() => {
|
|
212
|
+
r([]);
|
|
490
213
|
}, []);
|
|
491
214
|
return {
|
|
492
|
-
errors:
|
|
493
|
-
validateSentence:
|
|
494
|
-
validateAllSentences:
|
|
495
|
-
clearErrors:
|
|
215
|
+
errors: w,
|
|
216
|
+
validateSentence: y,
|
|
217
|
+
validateAllSentences: B,
|
|
218
|
+
clearErrors: ne
|
|
496
219
|
};
|
|
497
|
-
},
|
|
498
|
-
|
|
499
|
-
},
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
document.body.removeChild(
|
|
220
|
+
}, en = (w, r, y) => r && y ? `${w} word "${r}" ${y}` : r ? `${w} word "${r}"` : w, nn = (w, r, y = ["Enter", " "]) => {
|
|
221
|
+
y.includes(w.key) && (w.preventDefault(), r());
|
|
222
|
+
}, E = (w) => {
|
|
223
|
+
const r = document.createElement("div");
|
|
224
|
+
r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r.style.position = "absolute", r.style.left = "-10000px", r.style.width = "1px", r.style.height = "1px", r.style.overflow = "hidden", document.body.appendChild(r), r.textContent = w, setTimeout(() => {
|
|
225
|
+
document.body.removeChild(r);
|
|
503
226
|
}, 1e3);
|
|
504
|
-
},
|
|
505
|
-
const
|
|
506
|
-
|
|
227
|
+
}, tn = () => {
|
|
228
|
+
const w = document.createElement("style");
|
|
229
|
+
w.textContent = `
|
|
507
230
|
#magic-sentence-root, #magic-sentence-root * {
|
|
508
231
|
box-sizing: border-box;
|
|
509
232
|
font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|
|
@@ -529,17 +252,17 @@ const Ae = {
|
|
|
529
252
|
height: 100% !important;
|
|
530
253
|
overflow: hidden !important;
|
|
531
254
|
}
|
|
532
|
-
`, document.head.appendChild(
|
|
533
|
-
},
|
|
534
|
-
function
|
|
535
|
-
const { logoUrl:
|
|
536
|
-
if (!
|
|
255
|
+
`, document.head.appendChild(w);
|
|
256
|
+
}, on = (w) => [...w].sort(() => Math.random() - 0.5);
|
|
257
|
+
function ln(w = {}) {
|
|
258
|
+
const { logoUrl: r, showLogo: y = !0, baseURL: B } = w, ne = We(null), { validateAllSentences: S, errors: M } = _e(), C = () => l || window.innerWidth < 768, c = () => l || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, D = (e = "medium") => {
|
|
259
|
+
if (!c())
|
|
537
260
|
return {
|
|
538
261
|
padding: "12px 24px",
|
|
539
262
|
fontSize: "16px",
|
|
540
263
|
minWidth: "auto"
|
|
541
264
|
};
|
|
542
|
-
switch (
|
|
265
|
+
switch (e) {
|
|
543
266
|
case "small":
|
|
544
267
|
return {
|
|
545
268
|
padding: "4px 6px",
|
|
@@ -560,201 +283,201 @@ function wn(p = {}) {
|
|
|
560
283
|
};
|
|
561
284
|
}
|
|
562
285
|
};
|
|
563
|
-
|
|
286
|
+
V(() => (tn(), () => {
|
|
564
287
|
document.body.style.overflow = "";
|
|
565
288
|
}), []);
|
|
566
|
-
const [
|
|
289
|
+
const [m, k] = p("select"), [I, pe] = p(null), [ge, he] = p(null), [H, q] = p([]), [T, we] = p(0), [te, ue] = p([]), [v, ie] = p([]), [L, me] = p(20), [J, Y] = p(0), [rn, fe] = p(null), [A, z] = p(null), [d, K] = p(!1), [oe, ve] = p(
|
|
567
290
|
Number(localStorage.getItem("magicSentenceBest")) || 0
|
|
568
|
-
),
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
const
|
|
572
|
-
if (
|
|
573
|
-
|
|
574
|
-
else if (
|
|
575
|
-
|
|
291
|
+
), U = We(null), [b, P] = p({ list: null, index: null, side: null }), [l, ke] = p(!1), [sn, re] = p(1), [xe, se] = p(null), [He, Ie] = p(!1), [$, Ce] = p(!1), [G, De] = p(!1), [N, Te] = p(!1), [j, Pe] = p(!1), [O, Re] = p(!1), [F, ze] = p(!1), [Z, Ee] = p(!1), [Q, Be] = p(!1);
|
|
292
|
+
V(() => {
|
|
293
|
+
const e = () => {
|
|
294
|
+
const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430, o = n < 700, u = t === 768 && n === 1024, x = t === 1024 && n === 768, s = t === 820 && n === 1180, h = t === 1180 && n === 820, X = t === 540 && n === 720, W = t === 720 && n === 540, le = t === 1024 && n === 1366, Ue = t === 1366 && n === 1024, Ve = t >= 1200 && n >= 600 && !i;
|
|
295
|
+
if (Ie(Ve), Ce(u), De(x), Te(s), Pe(h), Re(X), ze(W), Ee(le), Be(Ue), ke(i), i)
|
|
296
|
+
se(null), re(1);
|
|
297
|
+
else if (o)
|
|
298
|
+
se(null), re(1);
|
|
576
299
|
else {
|
|
577
|
-
const
|
|
578
|
-
|
|
300
|
+
const qe = Math.min(1e3, Math.min(t, n) * 0.9);
|
|
301
|
+
se(qe), re(1);
|
|
579
302
|
}
|
|
580
303
|
};
|
|
581
|
-
return
|
|
304
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
582
305
|
}, []);
|
|
583
|
-
const
|
|
584
|
-
if (
|
|
585
|
-
let
|
|
586
|
-
const
|
|
587
|
-
if (
|
|
588
|
-
const [
|
|
589
|
-
let
|
|
590
|
-
|
|
591
|
-
},
|
|
592
|
-
if (
|
|
593
|
-
|
|
306
|
+
const _ = (e, t, n, i) => {
|
|
307
|
+
if (d) return;
|
|
308
|
+
let o = [...te], u = [...v];
|
|
309
|
+
const x = e === "bank" ? o : u, s = t === "bank" ? o : u, h = x.findIndex((le) => le.id === n);
|
|
310
|
+
if (h === -1) return;
|
|
311
|
+
const [X] = x.splice(h, 1);
|
|
312
|
+
let W = i;
|
|
313
|
+
e === t && W !== null && W !== void 0 && W > h && (W = W - 1), W == null || W < 0 || W > s.length ? s.push(X) : s.splice(W, 0, X), e === "bank" ? o = x : u = x, t === "bank" ? o = s : u = s, ue(o), ie(u);
|
|
314
|
+
}, ee = (e, t, n) => {
|
|
315
|
+
if (e.preventDefault(), d) {
|
|
316
|
+
P({ list: null, index: null, side: null });
|
|
594
317
|
return;
|
|
595
318
|
}
|
|
596
|
-
const
|
|
597
|
-
const
|
|
598
|
-
if (!
|
|
599
|
-
const
|
|
600
|
-
return
|
|
319
|
+
const i = e.dataTransfer.getData("application/x-token") || (() => {
|
|
320
|
+
const o = e.dataTransfer.getData("text/plain");
|
|
321
|
+
if (!o) return "";
|
|
322
|
+
const u = te.some((h) => h.id === o), x = v.some((h) => h.id === o), s = u ? "bank" : x ? "selected" : null;
|
|
323
|
+
return s ? JSON.stringify({ from: s, id: o }) : "";
|
|
601
324
|
})();
|
|
602
|
-
if (
|
|
325
|
+
if (i) {
|
|
603
326
|
try {
|
|
604
|
-
const
|
|
605
|
-
if (!
|
|
606
|
-
|
|
327
|
+
const o = JSON.parse(i);
|
|
328
|
+
if (!o || !o.id || !o.from) return;
|
|
329
|
+
_(o.from, t, o.id, n);
|
|
607
330
|
} catch {
|
|
608
331
|
}
|
|
609
|
-
|
|
332
|
+
P({ list: null, index: null, side: null });
|
|
610
333
|
}
|
|
611
|
-
},
|
|
612
|
-
|
|
613
|
-
},
|
|
614
|
-
|
|
615
|
-
},
|
|
616
|
-
if (
|
|
334
|
+
}, Me = (e) => {
|
|
335
|
+
pe(e), q(Array(e).fill("")), k("time");
|
|
336
|
+
}, Le = (e) => {
|
|
337
|
+
he(e), k("type");
|
|
338
|
+
}, Ae = (e, t) => {
|
|
339
|
+
if (t.length > 41 || t && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(t))
|
|
617
340
|
return;
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
},
|
|
623
|
-
|
|
341
|
+
const i = [...H];
|
|
342
|
+
i[e] = t, q(i);
|
|
343
|
+
const o = S(i);
|
|
344
|
+
o.isValid || console.warn("Validation errors:", o.errors);
|
|
345
|
+
}, $e = (e) => e.trim().replace(/\s+/g, " "), ye = (e) => e <= 3 ? 20 : e <= 5 ? 18 : e <= 7 ? 16 : e <= 9 ? 14 : 12, Ge = () => {
|
|
346
|
+
H.some((t) => t.trim().length === 0) || (q((t) => t.map((n) => $e(n))), Y(0), we(0), fe(null), k("getready"));
|
|
624
347
|
};
|
|
625
|
-
|
|
626
|
-
if (
|
|
627
|
-
const
|
|
628
|
-
return () => clearTimeout(
|
|
348
|
+
V(() => {
|
|
349
|
+
if (m === "getready") {
|
|
350
|
+
const e = setTimeout(() => ae(0), 3e3);
|
|
351
|
+
return () => clearTimeout(e);
|
|
629
352
|
}
|
|
630
|
-
}, [
|
|
631
|
-
const
|
|
632
|
-
const
|
|
633
|
-
if (!
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
).map((
|
|
637
|
-
id: `${Date.now()}-${
|
|
638
|
-
text:
|
|
353
|
+
}, [m]);
|
|
354
|
+
const ae = (e) => {
|
|
355
|
+
const t = H[e];
|
|
356
|
+
if (!t) return;
|
|
357
|
+
const i = on(
|
|
358
|
+
t.trim().split(/\s+/).filter(Boolean)
|
|
359
|
+
).map((o, u) => ({
|
|
360
|
+
id: `${Date.now()}-${e}-${u}-${Math.random().toString(36).slice(2)}`,
|
|
361
|
+
text: o
|
|
639
362
|
}));
|
|
640
|
-
|
|
363
|
+
ue(i), ie([]), we(e), me(ge || 20), z(null), K(!1), k("play");
|
|
641
364
|
};
|
|
642
|
-
|
|
643
|
-
if (
|
|
644
|
-
if (
|
|
645
|
-
|
|
365
|
+
V(() => {
|
|
366
|
+
if (m === "play" && !d)
|
|
367
|
+
if (U.current !== null && window.clearTimeout(U.current), L > 0)
|
|
368
|
+
U.current = window.setTimeout(() => me((e) => e - 1), 1e3);
|
|
646
369
|
else {
|
|
647
|
-
|
|
648
|
-
const
|
|
649
|
-
|
|
370
|
+
K(!0);
|
|
371
|
+
const t = H[T].trim().split(/\s+/), n = v.map((s) => s.text), i = t.filter((s) => !n.includes(s)).length, o = n.filter((s) => !t.includes(s)).length, u = t.filter((s, h) => s !== n[h]).length, x = i + o + u;
|
|
372
|
+
x === 0 ? (z("correct"), R("correct"), E("Correct! Well done!")) : x === 1 ? (z("almost"), R("half"), E("Almost correct! Just one mistake.")) : (z("wrong"), R("wrong"), E("Not quite right. Keep trying!"));
|
|
650
373
|
}
|
|
651
374
|
return () => {
|
|
652
|
-
|
|
375
|
+
U.current !== null && window.clearTimeout(U.current);
|
|
653
376
|
};
|
|
654
|
-
}, [
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
657
|
-
|
|
377
|
+
}, [m, L, d, H, T, v]);
|
|
378
|
+
const Ne = (e = !0) => {
|
|
379
|
+
if (d && e) {
|
|
380
|
+
T + 1 < (I || 0) ? ae(T + 1) : (k("results"), setTimeout(() => de(), 600));
|
|
658
381
|
return;
|
|
659
382
|
}
|
|
660
|
-
if (
|
|
661
|
-
const
|
|
662
|
-
|
|
383
|
+
if (e && !d) {
|
|
384
|
+
const n = H[T].trim().split(/\s+/), i = v.map((h) => h.text), o = n.filter((h) => !i.includes(h)).length, u = i.filter((h) => !n.includes(h)).length, x = n.filter((h, X) => h !== i[X]).length, s = o + u + x;
|
|
385
|
+
s === 0 && L > 0 ? (Y((h) => h + 1), z("correct"), R("correct"), E("Correct! Well done!")) : s === 1 ? (Y((h) => h + 0.5), z("almost"), R("half"), E("Almost correct! Just one mistake.")) : (z("wrong"), R("wrong"), E("Not quite right. Keep trying!")), T + 1 < (I || 0) ? setTimeout(() => ae(T + 1), 800) : (k("results"), setTimeout(() => de(), 600));
|
|
663
386
|
}
|
|
664
387
|
};
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}, [
|
|
668
|
-
const
|
|
669
|
-
const
|
|
670
|
-
switch (
|
|
388
|
+
V(() => {
|
|
389
|
+
m === "results" && J > oe && (ve(J), localStorage.setItem("magicSentenceBest", String(J)));
|
|
390
|
+
}, [m, J, oe]);
|
|
391
|
+
const R = (e) => {
|
|
392
|
+
const t = new (window.AudioContext || window.webkitAudioContext)(), n = t.createOscillator(), i = t.createGain();
|
|
393
|
+
switch (n.connect(i), i.connect(t.destination), e) {
|
|
671
394
|
case "start":
|
|
672
|
-
|
|
395
|
+
n.frequency.value = 500;
|
|
673
396
|
break;
|
|
674
397
|
case "click":
|
|
675
|
-
|
|
398
|
+
n.frequency.value = 800;
|
|
676
399
|
break;
|
|
677
400
|
case "correct":
|
|
678
|
-
|
|
401
|
+
n.frequency.value = 1e3;
|
|
679
402
|
break;
|
|
680
403
|
case "half":
|
|
681
|
-
|
|
404
|
+
n.frequency.value = 700;
|
|
682
405
|
break;
|
|
683
406
|
case "wrong":
|
|
684
|
-
|
|
407
|
+
n.frequency.value = 200;
|
|
685
408
|
break;
|
|
686
409
|
}
|
|
687
|
-
|
|
688
|
-
},
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
const
|
|
692
|
-
x: Math.random() *
|
|
693
|
-
y: Math.random() *
|
|
410
|
+
i.gain.setValueAtTime(0.1, t.currentTime), n.start(), n.stop(t.currentTime + 0.2);
|
|
411
|
+
}, de = () => {
|
|
412
|
+
const t = Date.now() + 2500, n = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], i = document.createElement("canvas"), o = i.getContext("2d");
|
|
413
|
+
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);
|
|
414
|
+
const u = Array.from({ length: 100 }).map(() => ({
|
|
415
|
+
x: Math.random() * i.width,
|
|
416
|
+
y: Math.random() * i.height - i.height,
|
|
694
417
|
size: 6 + Math.random() * 6,
|
|
695
|
-
color:
|
|
418
|
+
color: n[Math.floor(Math.random() * n.length)],
|
|
696
419
|
speed: 2 + Math.random() * 4,
|
|
697
420
|
tilt: Math.random() * 2 * Math.PI
|
|
698
|
-
})),
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}), Date.now() <
|
|
421
|
+
})), x = () => {
|
|
422
|
+
o.clearRect(0, 0, i.width, i.height), u.forEach((s) => {
|
|
423
|
+
o.fillStyle = s.color, o.beginPath(), o.ellipse(s.x, s.y, s.size, s.size / 2, s.tilt, 0, 2 * Math.PI), o.fill(), s.y += s.speed, s.x += Math.sin(s.tilt);
|
|
424
|
+
}), Date.now() < t ? requestAnimationFrame(x) : document.body.removeChild(i);
|
|
702
425
|
};
|
|
703
|
-
|
|
704
|
-
},
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
/* @__PURE__ */
|
|
426
|
+
x();
|
|
427
|
+
}, je = () => /* @__PURE__ */ f("div", { style: g.gmCenterScreen, children: [
|
|
428
|
+
/* @__PURE__ */ a("h1", { style: g.gmHeadline1, children: "MAGIC SENTENCE" }),
|
|
429
|
+
/* @__PURE__ */ a("p", { style: g.gmBodyM, children: "Select number of rounds" }),
|
|
430
|
+
/* @__PURE__ */ a("div", { style: {
|
|
708
431
|
display: "flex",
|
|
709
|
-
gap:
|
|
432
|
+
gap: c() ? "8px" : "16px",
|
|
710
433
|
justifyContent: "center"
|
|
711
|
-
}, children: [3, 4, 5].map((
|
|
434
|
+
}, children: [3, 4, 5].map((e) => /* @__PURE__ */ f(
|
|
712
435
|
"button",
|
|
713
436
|
{
|
|
714
|
-
onClick: () =>
|
|
437
|
+
onClick: () => Me(e),
|
|
715
438
|
style: {
|
|
716
|
-
...
|
|
439
|
+
...g.gmButton,
|
|
717
440
|
...D("medium")
|
|
718
441
|
},
|
|
719
442
|
children: [
|
|
720
|
-
|
|
443
|
+
e,
|
|
721
444
|
" ROUNDS"
|
|
722
445
|
]
|
|
723
446
|
},
|
|
724
|
-
|
|
447
|
+
e
|
|
725
448
|
)) })
|
|
726
|
-
] }),
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
449
|
+
] }), Oe = () => /* @__PURE__ */ f("div", { style: g.gmCenterScreen, children: [
|
|
450
|
+
/* @__PURE__ */ a("h1", { style: g.gmHeadline1, children: "MAGIC SENTENCE" }),
|
|
451
|
+
/* @__PURE__ */ a("p", { style: g.gmBodyM, children: "Select time per round" }),
|
|
452
|
+
/* @__PURE__ */ a("div", { style: {
|
|
730
453
|
display: "flex",
|
|
731
|
-
gap:
|
|
454
|
+
gap: c() ? "8px" : "16px",
|
|
732
455
|
justifyContent: "center"
|
|
733
|
-
}, children: [15, 20, 30].map((
|
|
456
|
+
}, children: [15, 20, 30].map((e) => /* @__PURE__ */ f(
|
|
734
457
|
"button",
|
|
735
458
|
{
|
|
736
|
-
onClick: () =>
|
|
459
|
+
onClick: () => Le(e),
|
|
737
460
|
style: {
|
|
738
|
-
...
|
|
461
|
+
...g.gmButton,
|
|
739
462
|
...D("medium")
|
|
740
463
|
},
|
|
741
464
|
children: [
|
|
742
|
-
|
|
465
|
+
e,
|
|
743
466
|
"s"
|
|
744
467
|
]
|
|
745
468
|
},
|
|
746
|
-
|
|
469
|
+
e
|
|
747
470
|
)) })
|
|
748
|
-
] }),
|
|
749
|
-
/* @__PURE__ */
|
|
471
|
+
] }), Fe = () => /* @__PURE__ */ f("div", { style: g.gmCenterScreen, children: [
|
|
472
|
+
/* @__PURE__ */ f("h2", { style: { ...g.gmBodyM, marginBottom: "0px" }, children: [
|
|
750
473
|
"Type down ",
|
|
751
|
-
|
|
474
|
+
I,
|
|
752
475
|
" sentence",
|
|
753
|
-
|
|
476
|
+
I && I > 1 ? "s" : "",
|
|
754
477
|
" for your student"
|
|
755
478
|
] }),
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ a("p", { style: { ...g.gmBodyS, marginBottom: "16px", marginTop: "0px", color: "#6b7280" }, children: "Maximum 41 characters per sentence" }),
|
|
480
|
+
/* @__PURE__ */ a("div", { style: {
|
|
758
481
|
display: "flex",
|
|
759
482
|
flexDirection: "column",
|
|
760
483
|
gap: 12,
|
|
@@ -764,317 +487,317 @@ function wn(p = {}) {
|
|
|
764
487
|
// Минимальная ширина по содержимому
|
|
765
488
|
maxWidth: "600px"
|
|
766
489
|
// Ограничиваем максимальную ширину
|
|
767
|
-
}, children:
|
|
490
|
+
}, children: H.map((e, t) => /* @__PURE__ */ a(
|
|
768
491
|
"input",
|
|
769
492
|
{
|
|
770
|
-
value:
|
|
771
|
-
placeholder: `Sentence ${
|
|
772
|
-
onChange: (
|
|
493
|
+
value: e,
|
|
494
|
+
placeholder: `Sentence ${t + 1}`,
|
|
495
|
+
onChange: (n) => Ae(t, n.target.value),
|
|
773
496
|
style: {
|
|
774
|
-
...
|
|
775
|
-
padding:
|
|
776
|
-
fontSize:
|
|
497
|
+
...g.gmInput,
|
|
498
|
+
padding: c() ? "8px 12px" : "12px 16px",
|
|
499
|
+
fontSize: c() ? "14px" : "16px",
|
|
777
500
|
width: "100%",
|
|
778
501
|
// Поля теперь будут шире благодаря увеличенной ширине контейнера
|
|
779
502
|
textAlign: "center"
|
|
780
503
|
// Центрируем placeholder текст
|
|
781
504
|
}
|
|
782
505
|
},
|
|
783
|
-
|
|
506
|
+
t
|
|
784
507
|
)) }),
|
|
785
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ a(
|
|
786
509
|
"button",
|
|
787
510
|
{
|
|
788
|
-
onClick:
|
|
789
|
-
disabled:
|
|
511
|
+
onClick: Ge,
|
|
512
|
+
disabled: H.some((e) => e.trim().length === 0),
|
|
790
513
|
style: {
|
|
791
|
-
...
|
|
514
|
+
...g.gmButton,
|
|
792
515
|
marginTop: 30,
|
|
793
|
-
background:
|
|
794
|
-
cursor:
|
|
516
|
+
background: H.some((e) => e.trim().length === 0) ? "#ccc" : "#ec4c44",
|
|
517
|
+
cursor: H.some((e) => e.trim().length === 0) ? "not-allowed" : "pointer",
|
|
795
518
|
...D("large")
|
|
796
519
|
},
|
|
797
520
|
children: "PLAY"
|
|
798
521
|
}
|
|
799
522
|
)
|
|
800
|
-
] }), Ze = () => /* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
...
|
|
803
|
-
fontSize:
|
|
523
|
+
] }), Ze = () => /* @__PURE__ */ f("div", { style: g.gmReadyWrapper, children: [
|
|
524
|
+
/* @__PURE__ */ a("h1", { style: {
|
|
525
|
+
...g.gmHeadline1,
|
|
526
|
+
fontSize: c() ? "36px" : "72px",
|
|
804
527
|
color: "#ec4c44",
|
|
805
528
|
marginBottom: "20px",
|
|
806
529
|
animation: "pulse 1s ease-in-out infinite"
|
|
807
530
|
}, children: "GET READY" }),
|
|
808
|
-
/* @__PURE__ */
|
|
809
|
-
] }), Qe = () => /* @__PURE__ */
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
marginBottom:
|
|
812
|
-
fontSize:
|
|
531
|
+
/* @__PURE__ */ a("div", { style: g.gmHourglass, children: "⏳" })
|
|
532
|
+
] }), Qe = () => /* @__PURE__ */ f("div", { style: g.gmGameLayout, children: [
|
|
533
|
+
/* @__PURE__ */ f("h2", { style: {
|
|
534
|
+
marginBottom: c() ? "5px" : "10px",
|
|
535
|
+
fontSize: c() ? "16px" : "20px"
|
|
813
536
|
}, children: [
|
|
814
537
|
"Round ",
|
|
815
|
-
|
|
538
|
+
T + 1,
|
|
816
539
|
"/",
|
|
817
|
-
|
|
540
|
+
I,
|
|
818
541
|
" — ",
|
|
819
|
-
|
|
542
|
+
d ? "TIME'S UP!" : `Time: ${L}s`
|
|
820
543
|
] }),
|
|
821
|
-
/* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ a(
|
|
822
545
|
"div",
|
|
823
546
|
{
|
|
824
547
|
style: {
|
|
825
548
|
width: "60%",
|
|
826
|
-
height:
|
|
549
|
+
height: c() ? "8px" : "14px",
|
|
827
550
|
borderRadius: 8,
|
|
828
551
|
background: "#eee",
|
|
829
552
|
overflow: "hidden",
|
|
830
|
-
marginBottom:
|
|
553
|
+
marginBottom: c() ? "10px" : "20px"
|
|
831
554
|
},
|
|
832
|
-
children: /* @__PURE__ */
|
|
555
|
+
children: /* @__PURE__ */ a(
|
|
833
556
|
"div",
|
|
834
557
|
{
|
|
835
558
|
style: {
|
|
836
559
|
height: "100%",
|
|
837
|
-
width: `${
|
|
838
|
-
background:
|
|
560
|
+
width: `${L / (ge || 20) * 100}%`,
|
|
561
|
+
background: L <= 5 ? "#ec4c44" : "#4caf50",
|
|
839
562
|
transition: "width 1s linear"
|
|
840
563
|
}
|
|
841
564
|
}
|
|
842
565
|
)
|
|
843
566
|
}
|
|
844
567
|
),
|
|
845
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ a(
|
|
846
569
|
"div",
|
|
847
570
|
{
|
|
848
|
-
onDragOver: (
|
|
849
|
-
onDrop: (
|
|
571
|
+
onDragOver: (e) => e.preventDefault(),
|
|
572
|
+
onDrop: (e) => ee(e, "bank", null),
|
|
850
573
|
style: {
|
|
851
574
|
display: "flex",
|
|
852
|
-
flexWrap:
|
|
853
|
-
gap:
|
|
575
|
+
flexWrap: C() ? "wrap" : "nowrap",
|
|
576
|
+
gap: l || window.innerWidth < 768 ? "6px" : "10px",
|
|
854
577
|
justifyContent: "center",
|
|
855
|
-
marginBottom:
|
|
856
|
-
padding:
|
|
578
|
+
marginBottom: l || window.innerWidth < 768 ? "15px" : "30px",
|
|
579
|
+
padding: l || window.innerWidth < 768 ? "5px" : "10px",
|
|
857
580
|
width: "100%",
|
|
858
581
|
boxSizing: "border-box"
|
|
859
582
|
},
|
|
860
|
-
children:
|
|
583
|
+
children: te.map((e, t) => /* @__PURE__ */ a(
|
|
861
584
|
"div",
|
|
862
585
|
{
|
|
863
|
-
draggable: !
|
|
586
|
+
draggable: !d,
|
|
864
587
|
role: "button",
|
|
865
|
-
tabIndex:
|
|
866
|
-
"aria-label":
|
|
867
|
-
onDragStart: (
|
|
868
|
-
if (
|
|
869
|
-
|
|
588
|
+
tabIndex: d ? -1 : 0,
|
|
589
|
+
"aria-label": d ? `Word: ${e.text} (time expired)` : en("Drag word", e.text, "to build sentence"),
|
|
590
|
+
onDragStart: (n) => {
|
|
591
|
+
if (d) {
|
|
592
|
+
n.preventDefault();
|
|
870
593
|
return;
|
|
871
594
|
}
|
|
872
|
-
|
|
595
|
+
n.dataTransfer.setData(
|
|
873
596
|
"application/x-token",
|
|
874
|
-
JSON.stringify({ from: "bank", id:
|
|
875
|
-
),
|
|
597
|
+
JSON.stringify({ from: "bank", id: e.id })
|
|
598
|
+
), n.dataTransfer.setData("text/plain", e.id), E(`Dragging word: ${e.text}`);
|
|
876
599
|
},
|
|
877
|
-
onKeyDown: (
|
|
878
|
-
|
|
600
|
+
onKeyDown: (n) => {
|
|
601
|
+
d || nn(n, () => _("bank", "selected", e.id, null));
|
|
879
602
|
},
|
|
880
|
-
onDragOver: (
|
|
881
|
-
onDrop: (
|
|
882
|
-
const
|
|
883
|
-
|
|
603
|
+
onDragOver: (n) => n.preventDefault(),
|
|
604
|
+
onDrop: (n) => {
|
|
605
|
+
const i = n.currentTarget.getBoundingClientRect(), o = i.left + i.width / 2, u = n.clientX > o ? t + 1 : t;
|
|
606
|
+
P({ list: null, index: null, side: null }), n.stopPropagation(), ee(n, "bank", u);
|
|
884
607
|
},
|
|
885
|
-
onDragEnter: (
|
|
886
|
-
if (
|
|
887
|
-
const
|
|
888
|
-
|
|
608
|
+
onDragEnter: (n) => {
|
|
609
|
+
if (d) return;
|
|
610
|
+
const i = n.currentTarget.getBoundingClientRect(), o = i.left + i.width / 2;
|
|
611
|
+
P({ list: "bank", index: t, side: n.clientX > o ? "right" : "left" });
|
|
889
612
|
},
|
|
890
|
-
onDragLeave: () =>
|
|
613
|
+
onDragLeave: () => P({ list: null, index: null, side: null }),
|
|
891
614
|
onClick: () => {
|
|
892
|
-
|
|
615
|
+
d || _("bank", "selected", e.id, null);
|
|
893
616
|
},
|
|
894
617
|
style: {
|
|
895
|
-
padding:
|
|
896
|
-
borderRadius:
|
|
618
|
+
padding: l || window.innerWidth < 768 ? "6px 10px" : "10px 16px",
|
|
619
|
+
borderRadius: l || window.innerWidth < 768 ? "6px" : "10px",
|
|
897
620
|
border: "1px solid #ccc",
|
|
898
|
-
background:
|
|
899
|
-
cursor:
|
|
900
|
-
fontSize:
|
|
901
|
-
borderLeft:
|
|
902
|
-
borderRight:
|
|
621
|
+
background: d ? "#f0f0f0" : "#f9f9f9",
|
|
622
|
+
cursor: d ? "not-allowed" : "pointer",
|
|
623
|
+
fontSize: l || window.innerWidth < 768 ? "12px" : "18px",
|
|
624
|
+
borderLeft: b.list === "bank" && b.index === t && b.side === "left" ? "3px solid #3b82f6" : "1px solid #ccc",
|
|
625
|
+
borderRight: b.list === "bank" && b.index === t && b.side === "right" ? "3px solid #3b82f6" : "1px solid #ccc",
|
|
903
626
|
flexShrink: 0,
|
|
904
627
|
flexBasis: "auto",
|
|
905
|
-
opacity:
|
|
628
|
+
opacity: d ? 0.6 : 1,
|
|
906
629
|
transition: "opacity 0.3s ease"
|
|
907
630
|
},
|
|
908
|
-
children:
|
|
631
|
+
children: e.text
|
|
909
632
|
},
|
|
910
|
-
|
|
633
|
+
e.id
|
|
911
634
|
))
|
|
912
635
|
}
|
|
913
636
|
),
|
|
914
|
-
/* @__PURE__ */
|
|
637
|
+
/* @__PURE__ */ a(
|
|
915
638
|
"div",
|
|
916
639
|
{
|
|
917
|
-
onDragOver: (
|
|
918
|
-
onDrop: (
|
|
640
|
+
onDragOver: (e) => e.preventDefault(),
|
|
641
|
+
onDrop: (e) => ee(e, "selected", null),
|
|
919
642
|
style: {
|
|
920
|
-
minHeight:
|
|
643
|
+
minHeight: l || window.innerWidth < 768 ? "50px" : "70px",
|
|
921
644
|
width: "auto",
|
|
922
645
|
// Автоматическая ширина в зависимости от содержимого
|
|
923
646
|
maxWidth: "none",
|
|
924
647
|
// Убираем ограничение максимальной ширины
|
|
925
648
|
minWidth: "245px",
|
|
926
649
|
// Минимальная ширина для растягивания
|
|
927
|
-
border:
|
|
928
|
-
borderRadius:
|
|
929
|
-
padding:
|
|
650
|
+
border: A === "correct" ? "2px dashed #4caf50" : A === "almost" ? "2px dashed #ff9800" : A === "wrong" ? "2px dashed #f44336" : "2px dashed #ccc",
|
|
651
|
+
borderRadius: l || window.innerWidth < 768 ? "8px" : "12px",
|
|
652
|
+
padding: l || window.innerWidth < 768 ? "8px" : "12px",
|
|
930
653
|
display: "flex",
|
|
931
|
-
flexWrap:
|
|
654
|
+
flexWrap: C() ? "wrap" : "nowrap",
|
|
932
655
|
alignItems: "center",
|
|
933
656
|
justifyContent: "center",
|
|
934
|
-
fontSize: `${
|
|
935
|
-
background:
|
|
936
|
-
overflowX:
|
|
937
|
-
whiteSpace:
|
|
657
|
+
fontSize: `${ye(v.length)}px`,
|
|
658
|
+
background: A === "correct" ? "#e8f5e8" : A === "almost" ? "#fff3e0" : A === "wrong" ? "#ffebee" : "#fafafa",
|
|
659
|
+
overflowX: C() ? "hidden" : "auto",
|
|
660
|
+
whiteSpace: C() ? "normal" : "nowrap"
|
|
938
661
|
},
|
|
939
|
-
children:
|
|
662
|
+
children: v.map((e, t) => /* @__PURE__ */ a(
|
|
940
663
|
"span",
|
|
941
664
|
{
|
|
942
|
-
draggable: !
|
|
943
|
-
onDragStart: (
|
|
944
|
-
if (
|
|
945
|
-
|
|
665
|
+
draggable: !d,
|
|
666
|
+
onDragStart: (n) => {
|
|
667
|
+
if (d) {
|
|
668
|
+
n.preventDefault();
|
|
946
669
|
return;
|
|
947
670
|
}
|
|
948
|
-
|
|
671
|
+
n.dataTransfer.setData(
|
|
949
672
|
"application/x-token",
|
|
950
|
-
JSON.stringify({ from: "selected", id:
|
|
951
|
-
),
|
|
673
|
+
JSON.stringify({ from: "selected", id: e.id })
|
|
674
|
+
), n.dataTransfer.setData("text/plain", e.id);
|
|
952
675
|
},
|
|
953
|
-
onDragOver: (
|
|
954
|
-
onDrop: (
|
|
955
|
-
const
|
|
956
|
-
|
|
676
|
+
onDragOver: (n) => n.preventDefault(),
|
|
677
|
+
onDrop: (n) => {
|
|
678
|
+
const i = n.currentTarget.getBoundingClientRect(), o = i.left + i.width / 2, u = n.clientX > o ? t + 1 : t;
|
|
679
|
+
P({ list: null, index: null, side: null }), n.stopPropagation(), ee(n, "selected", u);
|
|
957
680
|
},
|
|
958
|
-
onDragEnter: (
|
|
959
|
-
if (
|
|
960
|
-
const
|
|
961
|
-
|
|
681
|
+
onDragEnter: (n) => {
|
|
682
|
+
if (d) return;
|
|
683
|
+
const i = n.currentTarget.getBoundingClientRect(), o = i.left + i.width / 2;
|
|
684
|
+
P({ list: "selected", index: t, side: n.clientX > o ? "right" : "left" });
|
|
962
685
|
},
|
|
963
|
-
onDragLeave: () =>
|
|
686
|
+
onDragLeave: () => P({ list: null, index: null, side: null }),
|
|
964
687
|
onClick: () => {
|
|
965
|
-
|
|
688
|
+
d || _("selected", "bank", e.id, null);
|
|
966
689
|
},
|
|
967
|
-
title:
|
|
690
|
+
title: d ? "Time expired" : "Click to remove back to bank",
|
|
968
691
|
style: {
|
|
969
|
-
padding:
|
|
970
|
-
margin:
|
|
971
|
-
borderRadius:
|
|
972
|
-
background:
|
|
973
|
-
border:
|
|
974
|
-
borderLeft:
|
|
975
|
-
borderRight:
|
|
976
|
-
cursor:
|
|
692
|
+
padding: c() ? "4px 6px" : "6px 10px",
|
|
693
|
+
margin: c() ? "2px" : "4px",
|
|
694
|
+
borderRadius: c() ? "4px" : "8px",
|
|
695
|
+
background: d ? "#f0f0f0" : "#ffe9e7",
|
|
696
|
+
border: d ? "1px solid #ccc" : "1px solid #ec4c44",
|
|
697
|
+
borderLeft: b.list === "selected" && b.index === t && b.side === "left" ? "3px solid #3b82f6" : void 0,
|
|
698
|
+
borderRight: b.list === "selected" && b.index === t && b.side === "right" ? "3px solid #3b82f6" : void 0,
|
|
699
|
+
cursor: d ? "not-allowed" : "pointer",
|
|
977
700
|
userSelect: "none",
|
|
978
|
-
fontSize: `${
|
|
701
|
+
fontSize: `${ye(v.length)}px`,
|
|
979
702
|
// Адаптивный размер шрифта для слов
|
|
980
703
|
fontFamily: '"Roboto", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',
|
|
981
704
|
// Более плотный шрифт
|
|
982
705
|
whiteSpace: "nowrap",
|
|
983
706
|
// Запрещаем перенос слов
|
|
984
|
-
opacity:
|
|
707
|
+
opacity: d ? 0.6 : 1,
|
|
985
708
|
transition: "opacity 0.3s ease"
|
|
986
709
|
},
|
|
987
|
-
children:
|
|
710
|
+
children: e.text
|
|
988
711
|
},
|
|
989
|
-
|
|
712
|
+
e.id
|
|
990
713
|
))
|
|
991
714
|
}
|
|
992
715
|
),
|
|
993
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ a(
|
|
994
717
|
"button",
|
|
995
718
|
{
|
|
996
|
-
onClick: () =>
|
|
997
|
-
disabled: !
|
|
719
|
+
onClick: () => Ne(!0),
|
|
720
|
+
disabled: !d && v.length === 0,
|
|
998
721
|
style: {
|
|
999
|
-
marginTop:
|
|
1000
|
-
fontSize:
|
|
1001
|
-
padding:
|
|
1002
|
-
borderRadius:
|
|
1003
|
-
background:
|
|
722
|
+
marginTop: c() ? "15px" : "30px",
|
|
723
|
+
fontSize: c() ? "14px" : "20px",
|
|
724
|
+
padding: c() ? "6px 12px" : "10px 24px",
|
|
725
|
+
borderRadius: c() ? "8px" : "12px",
|
|
726
|
+
background: d || v.length > 0 ? "#ec4c44" : "#ccc",
|
|
1004
727
|
color: "white",
|
|
1005
728
|
border: "none",
|
|
1006
|
-
cursor:
|
|
729
|
+
cursor: d || v.length > 0 ? "pointer" : "not-allowed"
|
|
1007
730
|
},
|
|
1008
731
|
children: "NEXT"
|
|
1009
732
|
}
|
|
1010
733
|
)
|
|
1011
|
-
] }),
|
|
1012
|
-
/* @__PURE__ */
|
|
1013
|
-
...
|
|
1014
|
-
marginTop: (
|
|
1015
|
-
marginBottom:
|
|
1016
|
-
fontSize:
|
|
734
|
+
] }), Xe = () => /* @__PURE__ */ f("div", { style: g.gmCenterScreen, children: [
|
|
735
|
+
/* @__PURE__ */ a("h1", { style: {
|
|
736
|
+
...g.gmHeadline1,
|
|
737
|
+
marginTop: (l && 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 || $ || G || N || j || O || F || Z || Q, "0px"),
|
|
738
|
+
marginBottom: l && 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 || $ || G || N || j || O || F || Z || Q ? "2px" : "10px",
|
|
739
|
+
fontSize: l && 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)"
|
|
1017
740
|
}, children: "Game Over 🎯" }),
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
...
|
|
1020
|
-
marginTop: (
|
|
1021
|
-
marginBottom:
|
|
1022
|
-
fontSize:
|
|
741
|
+
/* @__PURE__ */ f("h2", { style: {
|
|
742
|
+
...g.gmHeadline2,
|
|
743
|
+
marginTop: (l && 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 || $ || G || N || j || O || F || Z || Q, "0px"),
|
|
744
|
+
marginBottom: l && 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 || $ || G || N || j || O || F || Z || Q ? "2px" : "16px",
|
|
745
|
+
fontSize: l && 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"
|
|
1023
746
|
}, children: [
|
|
1024
747
|
"Your score: ",
|
|
1025
|
-
|
|
748
|
+
J,
|
|
1026
749
|
" out of ",
|
|
1027
|
-
|
|
750
|
+
I
|
|
1028
751
|
] }),
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
...
|
|
752
|
+
/* @__PURE__ */ f("p", { style: {
|
|
753
|
+
...g.gmBodyM,
|
|
1031
754
|
color: "#10b981",
|
|
1032
|
-
marginTop:
|
|
1033
|
-
marginBottom:
|
|
1034
|
-
fontSize:
|
|
755
|
+
marginTop: l && 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 || $ || G || N || j || O || F || Z || Q ? "0px" : "12px",
|
|
756
|
+
marginBottom: l && 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 || $ || G || N || j || O || F || Z || Q ? "2px" : "16px",
|
|
757
|
+
fontSize: l && 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"
|
|
1035
758
|
}, children: [
|
|
1036
759
|
"Best score: ",
|
|
1037
|
-
|
|
760
|
+
oe
|
|
1038
761
|
] }),
|
|
1039
|
-
/* @__PURE__ */
|
|
762
|
+
/* @__PURE__ */ f("div", { style: {
|
|
1040
763
|
display: "flex",
|
|
1041
|
-
gap:
|
|
1042
|
-
marginTop:
|
|
764
|
+
gap: l && window.innerWidth > window.innerHeight || l && 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",
|
|
765
|
+
marginTop: l && window.innerWidth > window.innerHeight || l && 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 || He ? "12px" : "24px"
|
|
1043
766
|
}, children: [
|
|
1044
|
-
/* @__PURE__ */
|
|
767
|
+
/* @__PURE__ */ a(
|
|
1045
768
|
"button",
|
|
1046
769
|
{
|
|
1047
770
|
onClick: () => {
|
|
1048
|
-
|
|
1049
|
-
|
|
771
|
+
de(), R("start"), setTimeout(() => {
|
|
772
|
+
k("getready"), fe(null), K(!1);
|
|
1050
773
|
}, 800);
|
|
1051
774
|
},
|
|
1052
775
|
style: {
|
|
1053
|
-
...
|
|
776
|
+
...g.gmButton,
|
|
1054
777
|
...D("medium")
|
|
1055
778
|
},
|
|
1056
779
|
children: "🔁 Play again"
|
|
1057
780
|
}
|
|
1058
781
|
),
|
|
1059
|
-
/* @__PURE__ */
|
|
782
|
+
/* @__PURE__ */ a(
|
|
1060
783
|
"button",
|
|
1061
784
|
{
|
|
1062
785
|
onClick: () => {
|
|
1063
|
-
|
|
786
|
+
R("click"), k("select"), pe(null), he(null), q([]), Y(0), ie([]), K(!1);
|
|
1064
787
|
},
|
|
1065
788
|
style: {
|
|
1066
|
-
...
|
|
789
|
+
...g.gmButton,
|
|
1067
790
|
...D("medium")
|
|
1068
791
|
},
|
|
1069
792
|
children: "⬅️ Exit"
|
|
1070
793
|
}
|
|
1071
794
|
)
|
|
1072
795
|
] })
|
|
1073
|
-
] }),
|
|
1074
|
-
return /* @__PURE__ */
|
|
796
|
+
] }), be = r || (B ? `${B.endsWith("/") ? B.slice(0, -1) : B}/logo.svg` : typeof window < "u" && window.origin ? `${window.origin}/browser/speakid/games/magic%20sentence/logo.svg` : null), Je = !l && y && !(window.innerWidth > window.innerHeight) && window.innerHeight >= 700;
|
|
797
|
+
return /* @__PURE__ */ a(
|
|
1075
798
|
"div",
|
|
1076
799
|
{
|
|
1077
|
-
ref:
|
|
800
|
+
ref: ne,
|
|
1078
801
|
style: {
|
|
1079
802
|
width: "100%",
|
|
1080
803
|
height: "100%",
|
|
@@ -1090,23 +813,23 @@ function wn(p = {}) {
|
|
|
1090
813
|
right: 0,
|
|
1091
814
|
bottom: 0
|
|
1092
815
|
},
|
|
1093
|
-
children: /* @__PURE__ */
|
|
816
|
+
children: /* @__PURE__ */ a(
|
|
1094
817
|
"div",
|
|
1095
818
|
{
|
|
1096
819
|
style: {
|
|
1097
|
-
width:
|
|
1098
|
-
height:
|
|
820
|
+
width: l ? "100%" : xe || 1e3,
|
|
821
|
+
height: l ? "100%" : xe || 1e3,
|
|
1099
822
|
display: "flex",
|
|
1100
823
|
justifyContent: "center",
|
|
1101
824
|
alignItems: "center",
|
|
1102
825
|
overflow: "hidden",
|
|
1103
|
-
borderRadius:
|
|
826
|
+
borderRadius: l ? 0 : "20px",
|
|
1104
827
|
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
1105
|
-
boxShadow:
|
|
1106
|
-
margin:
|
|
828
|
+
boxShadow: l ? "none" : "0 0 40px rgba(0,0,0,0.1)",
|
|
829
|
+
margin: l ? "0 auto" : "unset",
|
|
1107
830
|
position: "relative"
|
|
1108
831
|
},
|
|
1109
|
-
children: /* @__PURE__ */
|
|
832
|
+
children: /* @__PURE__ */ a(
|
|
1110
833
|
"div",
|
|
1111
834
|
{
|
|
1112
835
|
style: {
|
|
@@ -1117,25 +840,25 @@ function wn(p = {}) {
|
|
|
1117
840
|
justifyContent: "center",
|
|
1118
841
|
alignItems: "center"
|
|
1119
842
|
},
|
|
1120
|
-
children: /* @__PURE__ */
|
|
1121
|
-
|
|
1122
|
-
...
|
|
843
|
+
children: /* @__PURE__ */ f("div", { id: "magic-sentence-root", children: [
|
|
844
|
+
Je ? /* @__PURE__ */ a("div", { style: {
|
|
845
|
+
...g.gmLogoFixed,
|
|
1123
846
|
display: "block"
|
|
1124
|
-
}, children:
|
|
847
|
+
}, children: be ? /* @__PURE__ */ a(
|
|
1125
848
|
"img",
|
|
1126
849
|
{
|
|
1127
|
-
src:
|
|
850
|
+
src: be,
|
|
1128
851
|
alt: "SPEAKID Logo",
|
|
1129
|
-
style:
|
|
852
|
+
style: g.gmLogoImg,
|
|
1130
853
|
loading: "lazy"
|
|
1131
854
|
}
|
|
1132
|
-
) : /* @__PURE__ */
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
855
|
+
) : /* @__PURE__ */ a("div", { style: g.gmLogoImg, children: "SPEAKID" }) }) : null,
|
|
856
|
+
m === "select" ? je() : null,
|
|
857
|
+
m === "time" ? Oe() : null,
|
|
858
|
+
m === "type" ? Fe() : null,
|
|
859
|
+
m === "getready" ? Ze() : null,
|
|
860
|
+
m === "play" ? Qe() : null,
|
|
861
|
+
m === "results" ? Xe() : null
|
|
1139
862
|
] })
|
|
1140
863
|
}
|
|
1141
864
|
)
|
|
@@ -1144,27 +867,27 @@ function wn(p = {}) {
|
|
|
1144
867
|
}
|
|
1145
868
|
);
|
|
1146
869
|
}
|
|
1147
|
-
class
|
|
1148
|
-
constructor(
|
|
1149
|
-
super(
|
|
870
|
+
class cn extends Ye {
|
|
871
|
+
constructor(r) {
|
|
872
|
+
super(r), this.state = { hasError: !1 };
|
|
1150
873
|
}
|
|
1151
|
-
static getDerivedStateFromError(
|
|
874
|
+
static getDerivedStateFromError(r) {
|
|
1152
875
|
return {
|
|
1153
876
|
hasError: !0,
|
|
1154
|
-
error:
|
|
877
|
+
error: r
|
|
1155
878
|
};
|
|
1156
879
|
}
|
|
1157
|
-
componentDidCatch(
|
|
1158
|
-
console.error("Game Error:",
|
|
1159
|
-
error:
|
|
1160
|
-
errorInfo:
|
|
880
|
+
componentDidCatch(r, y) {
|
|
881
|
+
console.error("Game Error:", r, y), this.setState({
|
|
882
|
+
error: r,
|
|
883
|
+
errorInfo: y
|
|
1161
884
|
});
|
|
1162
885
|
}
|
|
1163
886
|
handleReset = () => {
|
|
1164
887
|
this.setState({ hasError: !1, error: void 0, errorInfo: void 0 });
|
|
1165
888
|
};
|
|
1166
889
|
render() {
|
|
1167
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
890
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ f("div", { style: {
|
|
1168
891
|
display: "flex",
|
|
1169
892
|
flexDirection: "column",
|
|
1170
893
|
alignItems: "center",
|
|
@@ -1176,9 +899,9 @@ class xn extends sn {
|
|
|
1176
899
|
color: "#dc2626",
|
|
1177
900
|
fontFamily: "system-ui, sans-serif"
|
|
1178
901
|
}, children: [
|
|
1179
|
-
/* @__PURE__ */
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
-
/* @__PURE__ */
|
|
902
|
+
/* @__PURE__ */ a("h1", { style: { fontSize: "24px", marginBottom: "16px" }, children: "🚨 Oops! Something went wrong" }),
|
|
903
|
+
/* @__PURE__ */ a("p", { style: { fontSize: "16px", marginBottom: "24px", maxWidth: "500px" }, children: "The game encountered an unexpected error. Don't worry, your progress is saved!" }),
|
|
904
|
+
/* @__PURE__ */ a(
|
|
1182
905
|
"button",
|
|
1183
906
|
{
|
|
1184
907
|
onClick: this.handleReset,
|
|
@@ -1192,14 +915,14 @@ class xn extends sn {
|
|
|
1192
915
|
cursor: "pointer",
|
|
1193
916
|
transition: "background-color 0.2s"
|
|
1194
917
|
},
|
|
1195
|
-
onMouseOver: (
|
|
1196
|
-
onMouseOut: (
|
|
918
|
+
onMouseOver: (r) => r.currentTarget.style.backgroundColor = "#b91c1c",
|
|
919
|
+
onMouseOut: (r) => r.currentTarget.style.backgroundColor = "#dc2626",
|
|
1197
920
|
children: "🔄 Restart Game"
|
|
1198
921
|
}
|
|
1199
922
|
),
|
|
1200
|
-
typeof process < "u" && process.env.NODE_ENV === "development" && this.state.error && /* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */
|
|
923
|
+
typeof process < "u" && process.env.NODE_ENV === "development" && this.state.error && /* @__PURE__ */ f("details", { style: { marginTop: "20px", textAlign: "left", maxWidth: "600px" }, children: [
|
|
924
|
+
/* @__PURE__ */ a("summary", { style: { cursor: "pointer", fontSize: "14px" }, children: "Technical Details (Development Only)" }),
|
|
925
|
+
/* @__PURE__ */ f("pre", { style: {
|
|
1203
926
|
backgroundColor: "#f3f4f6",
|
|
1204
927
|
padding: "12px",
|
|
1205
928
|
borderRadius: "4px",
|
|
@@ -1215,12 +938,12 @@ class xn extends sn {
|
|
|
1215
938
|
}
|
|
1216
939
|
}
|
|
1217
940
|
export {
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
941
|
+
cn as ErrorBoundary,
|
|
942
|
+
ln as Game,
|
|
943
|
+
E as announceToScreenReader,
|
|
944
|
+
en as createAriaLabel,
|
|
945
|
+
ln as default,
|
|
946
|
+
nn as handleKeyDown,
|
|
947
|
+
_e as useValidation
|
|
1225
948
|
};
|
|
1226
949
|
//# sourceMappingURL=speakid-build-a-sentence.es.js.map
|