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