@roudanio/maze 0.0.7 → 0.0.9
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/maze.css +1 -1
- package/dist/maze.iife.js +2 -27
- package/dist/maze.js +1010 -1241
- package/dist/maze.umd.js +2 -27
- package/package.json +1 -1
package/dist/maze.js
CHANGED
|
@@ -1,243 +1,238 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
3
|
-
for (var o in
|
|
4
|
-
return
|
|
1
|
+
var ee, w, Fe, $, pe, Re, $e, Oe, ce, re, se, Ue, G = {}, De = [], dt = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, te = Array.isArray;
|
|
2
|
+
function F(t, e) {
|
|
3
|
+
for (var o in e) t[o] = e[o];
|
|
4
|
+
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
function ue(t) {
|
|
7
|
+
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function ht(t, e, o) {
|
|
10
10
|
var n, i, r, s = {};
|
|
11
|
-
for (r in
|
|
12
|
-
if (arguments.length > 2 && (s.children = arguments.length > 3 ?
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
function
|
|
16
|
-
var r = { type:
|
|
17
|
-
return i == null &&
|
|
18
|
-
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
function
|
|
23
|
-
this.props =
|
|
24
|
-
}
|
|
25
|
-
function
|
|
26
|
-
if (
|
|
27
|
-
for (var o;
|
|
28
|
-
return typeof
|
|
29
|
-
}
|
|
30
|
-
function
|
|
31
|
-
var
|
|
32
|
-
if ((
|
|
33
|
-
for (
|
|
34
|
-
|
|
11
|
+
for (r in e) r == "key" ? n = e[r] : r == "ref" ? i = e[r] : s[r] = e[r];
|
|
12
|
+
if (arguments.length > 2 && (s.children = arguments.length > 3 ? ee.call(arguments, 2) : o), typeof t == "function" && t.defaultProps != null) for (r in t.defaultProps) s[r] == null && (s[r] = t.defaultProps[r]);
|
|
13
|
+
return Y(t, s, n, i, null);
|
|
14
|
+
}
|
|
15
|
+
function Y(t, e, o, n, i) {
|
|
16
|
+
var r = { type: t, props: e, key: o, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++Fe, __i: -1, __u: 0 };
|
|
17
|
+
return i == null && w.vnode != null && w.vnode(r), r;
|
|
18
|
+
}
|
|
19
|
+
function oe(t) {
|
|
20
|
+
return t.children;
|
|
21
|
+
}
|
|
22
|
+
function X(t, e) {
|
|
23
|
+
this.props = t, this.context = e;
|
|
24
|
+
}
|
|
25
|
+
function D(t, e) {
|
|
26
|
+
if (e == null) return t.__ ? D(t.__, t.__i + 1) : null;
|
|
27
|
+
for (var o; e < t.__k.length; e++) if ((o = t.__k[e]) != null && o.__e != null) return o.__e;
|
|
28
|
+
return typeof t.type == "function" ? D(t) : null;
|
|
29
|
+
}
|
|
30
|
+
function je(t) {
|
|
31
|
+
var e, o;
|
|
32
|
+
if ((t = t.__) != null && t.__c != null) {
|
|
33
|
+
for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((o = t.__k[e]) != null && o.__e != null) {
|
|
34
|
+
t.__e = t.__c.base = o.__e;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return je(t);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
(!
|
|
40
|
+
function le(t) {
|
|
41
|
+
(!t.__d && (t.__d = !0) && $.push(t) && !Q.__r++ || pe != w.debounceRendering) && ((pe = w.debounceRendering) || Re)(Q);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
for (var
|
|
45
|
-
|
|
43
|
+
function Q() {
|
|
44
|
+
for (var t, e, o, n, i, r, s, l = 1; $.length; ) $.length > l && $.sort($e), t = $.shift(), l = $.length, t.__d && (o = void 0, i = (n = (e = t).__v).__e, r = [], s = [], e.__P && ((o = F({}, n)).__v = n.__v + 1, w.vnode && w.vnode(o), de(e.__P, o, n, e.__n, e.__P.namespaceURI, 32 & n.__u ? [i] : null, r, i ?? D(n), !!(32 & n.__u), s), o.__v = n.__v, o.__.__k[o.__i] = o, We(r, o, s), o.__e != i && je(o)));
|
|
45
|
+
Q.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
var u,
|
|
49
|
-
for (
|
|
50
|
-
return o.__e = g,
|
|
47
|
+
function Ge(t, e, o, n, i, r, s, l, c, a, d) {
|
|
48
|
+
var u, _, h, v, g, p, m = n && n.__k || De, C = e.length;
|
|
49
|
+
for (c = _t(o, e, m, c, C), u = 0; u < C; u++) (h = o.__k[u]) != null && (_ = h.__i == -1 ? G : m[h.__i] || G, h.__i = u, p = de(t, h, _, i, r, s, l, c, a, d), v = h.__e, h.ref && _.ref != h.ref && (_.ref && he(_.ref, null, h), d.push(h.ref, h.__c || v, h)), g == null && v != null && (g = v), 4 & h.__u || _.__k === h.__k ? c = He(h, c, t) : typeof h.type == "function" && p !== void 0 ? c = p : v && (c = v.nextSibling), h.__u &= -7);
|
|
50
|
+
return o.__e = g, c;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
var r, s, l,
|
|
54
|
-
for (
|
|
55
|
-
if (u) for (r = 0; r <
|
|
52
|
+
function _t(t, e, o, n, i) {
|
|
53
|
+
var r, s, l, c, a, d = o.length, u = d, _ = 0;
|
|
54
|
+
for (t.__k = new Array(i), r = 0; r < i; r++) (s = e[r]) != null && typeof s != "boolean" && typeof s != "function" ? (c = r + _, (s = t.__k[r] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Y(null, s, null, null, null) : te(s) ? Y(oe, { children: s }, null, null, null) : s.constructor == null && s.__b > 0 ? Y(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = t, s.__b = t.__b + 1, l = null, (a = s.__i = ft(s, o, c, u)) != -1 && (u--, (l = o[a]) && (l.__u |= 2)), l == null || l.__v == null ? (a == -1 && (i > d ? _-- : i < d && _++), typeof s.type != "function" && (s.__u |= 4)) : a != c && (a == c - 1 ? _-- : a == c + 1 ? _++ : (a > c ? _-- : _++, s.__u |= 4))) : t.__k[r] = null;
|
|
55
|
+
if (u) for (r = 0; r < d; r++) (l = o[r]) != null && (2 & l.__u) == 0 && (l.__e == n && (n = D(l)), qe(l, l));
|
|
56
56
|
return n;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function He(t, e, o) {
|
|
59
59
|
var n, i;
|
|
60
|
-
if (typeof
|
|
61
|
-
for (n =
|
|
62
|
-
return
|
|
60
|
+
if (typeof t.type == "function") {
|
|
61
|
+
for (n = t.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = t, e = He(n[i], e, o));
|
|
62
|
+
return e;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
t.__e != e && (e && t.type && !o.contains(e) && (e = D(t)), o.insertBefore(t.__e, e || null), e = t.__e);
|
|
65
65
|
do
|
|
66
|
-
|
|
67
|
-
while (
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
function oe(e, t) {
|
|
71
|
-
return t = t || [], e == null || typeof e == "boolean" || (X(e) ? e.some(function(o) {
|
|
72
|
-
oe(o, t);
|
|
73
|
-
}) : t.push(e)), t;
|
|
66
|
+
e = e && e.nextSibling;
|
|
67
|
+
while (e != null && e.nodeType == 8);
|
|
68
|
+
return e;
|
|
74
69
|
}
|
|
75
|
-
function
|
|
76
|
-
var i, r, s =
|
|
77
|
-
if (
|
|
78
|
-
if (n > (
|
|
70
|
+
function ft(t, e, o, n) {
|
|
71
|
+
var i, r, s = t.key, l = t.type, c = e[o];
|
|
72
|
+
if (c === null && t.key == null || c && s == c.key && l == c.type && (2 & c.__u) == 0) return o;
|
|
73
|
+
if (n > (c != null && (2 & c.__u) == 0 ? 1 : 0)) for (i = o - 1, r = o + 1; i >= 0 || r < e.length; ) {
|
|
79
74
|
if (i >= 0) {
|
|
80
|
-
if ((
|
|
75
|
+
if ((c = e[i]) && (2 & c.__u) == 0 && s == c.key && l == c.type) return i;
|
|
81
76
|
i--;
|
|
82
77
|
}
|
|
83
|
-
if (r <
|
|
84
|
-
if ((
|
|
78
|
+
if (r < e.length) {
|
|
79
|
+
if ((c = e[r]) && (2 & c.__u) == 0 && s == c.key && l == c.type) return r;
|
|
85
80
|
r++;
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
83
|
return -1;
|
|
89
84
|
}
|
|
90
|
-
function
|
|
91
|
-
|
|
85
|
+
function Ce(t, e, o) {
|
|
86
|
+
e[0] == "-" ? t.setProperty(e, o ?? "") : t[e] = o == null ? "" : typeof o != "number" || dt.test(e) ? o : o + "px";
|
|
92
87
|
}
|
|
93
|
-
function
|
|
88
|
+
function V(t, e, o, n, i) {
|
|
94
89
|
var r;
|
|
95
|
-
e: if (
|
|
90
|
+
e: if (e == "style") if (typeof o == "string") t.style.cssText = o;
|
|
96
91
|
else {
|
|
97
|
-
if (typeof n == "string" && (
|
|
98
|
-
if (o) for (
|
|
92
|
+
if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) o && e in o || Ce(t.style, e, "");
|
|
93
|
+
if (o) for (e in o) n && o[e] == n[e] || Ce(t.style, e, o[e]);
|
|
99
94
|
}
|
|
100
|
-
else if (
|
|
95
|
+
else if (e[0] == "o" && e[1] == "n") r = e != (e = e.replace(Oe, "$1")), e = e.toLowerCase() in t || e == "onFocusOut" || e == "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + r] = o, o ? n ? o.u = n.u : (o.u = ce, t.addEventListener(e, r ? se : re, r)) : t.removeEventListener(e, r ? se : re, r);
|
|
101
96
|
else {
|
|
102
|
-
if (i == "http://www.w3.org/2000/svg")
|
|
103
|
-
else if (
|
|
104
|
-
e
|
|
97
|
+
if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
98
|
+
else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
|
|
99
|
+
t[e] = o ?? "";
|
|
105
100
|
break e;
|
|
106
101
|
} catch {
|
|
107
102
|
}
|
|
108
|
-
typeof o == "function" || (o == null || o === !1 &&
|
|
103
|
+
typeof o == "function" || (o == null || o === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && o == 1 ? "" : o));
|
|
109
104
|
}
|
|
110
105
|
}
|
|
111
|
-
function
|
|
112
|
-
return function(
|
|
106
|
+
function we(t) {
|
|
107
|
+
return function(e) {
|
|
113
108
|
if (this.l) {
|
|
114
|
-
var o = this.l[
|
|
115
|
-
if (
|
|
116
|
-
else if (
|
|
117
|
-
return o(
|
|
109
|
+
var o = this.l[e.type + t];
|
|
110
|
+
if (e.t == null) e.t = ce++;
|
|
111
|
+
else if (e.t < o.u) return;
|
|
112
|
+
return o(w.event ? w.event(e) : e);
|
|
118
113
|
}
|
|
119
114
|
};
|
|
120
115
|
}
|
|
121
|
-
function
|
|
122
|
-
var
|
|
123
|
-
if (
|
|
124
|
-
128 & o.__u && (
|
|
125
|
-
e: if (typeof
|
|
126
|
-
if (
|
|
116
|
+
function de(t, e, o, n, i, r, s, l, c, a) {
|
|
117
|
+
var d, u, _, h, v, g, p, m, C, P, k, N, b, T, M, x, O, L = e.type;
|
|
118
|
+
if (e.constructor != null) return null;
|
|
119
|
+
128 & o.__u && (c = !!(32 & o.__u), r = [l = e.__e = o.__e]), (d = w.__b) && d(e);
|
|
120
|
+
e: if (typeof L == "function") try {
|
|
121
|
+
if (m = e.props, C = "prototype" in L && L.prototype.render, P = (d = L.contextType) && n[d.__c], k = d ? P ? P.props.value : d.__ : n, o.__c ? p = (u = e.__c = o.__c).__ = u.__E : (C ? e.__c = u = new L(m, k) : (e.__c = u = new X(m, k), u.constructor = L, u.render = vt), P && P.sub(u), u.props = m, u.state || (u.state = {}), u.context = k, u.__n = n, _ = u.__d = !0, u.__h = [], u._sb = []), C && u.__s == null && (u.__s = u.state), C && L.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = F({}, u.__s)), F(u.__s, L.getDerivedStateFromProps(m, u.__s))), h = u.props, v = u.state, u.__v = e, _) C && L.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), C && u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
127
122
|
else {
|
|
128
|
-
if (
|
|
129
|
-
for (
|
|
130
|
-
|
|
131
|
-
}),
|
|
123
|
+
if (C && L.getDerivedStateFromProps == null && m !== h && u.componentWillReceiveProps != null && u.componentWillReceiveProps(m, k), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(m, u.__s, k) === !1 || e.__v == o.__v) {
|
|
124
|
+
for (e.__v != o.__v && (u.props = m, u.state = u.__s, u.__d = !1), e.__e = o.__e, e.__k = o.__k, e.__k.some(function(R) {
|
|
125
|
+
R && (R.__ = e);
|
|
126
|
+
}), N = 0; N < u._sb.length; N++) u.__h.push(u._sb[N]);
|
|
132
127
|
u._sb = [], u.__h.length && s.push(u);
|
|
133
128
|
break e;
|
|
134
129
|
}
|
|
135
|
-
u.componentWillUpdate != null && u.componentWillUpdate(
|
|
136
|
-
u.componentDidUpdate(
|
|
130
|
+
u.componentWillUpdate != null && u.componentWillUpdate(m, u.__s, k), C && u.componentDidUpdate != null && u.__h.push(function() {
|
|
131
|
+
u.componentDidUpdate(h, v, g);
|
|
137
132
|
});
|
|
138
133
|
}
|
|
139
|
-
if (u.context = k, u.props =
|
|
140
|
-
for (u.state = u.__s, u.__d = !1,
|
|
134
|
+
if (u.context = k, u.props = m, u.__P = t, u.__e = !1, b = w.__r, T = 0, C) {
|
|
135
|
+
for (u.state = u.__s, u.__d = !1, b && b(e), d = u.render(u.props, u.state, u.context), M = 0; M < u._sb.length; M++) u.__h.push(u._sb[M]);
|
|
141
136
|
u._sb = [];
|
|
142
137
|
} else do
|
|
143
|
-
u.__d = !1,
|
|
144
|
-
while (u.__d && ++
|
|
145
|
-
u.state = u.__s, u.getChildContext != null && (n =
|
|
146
|
-
} catch (
|
|
147
|
-
if (
|
|
148
|
-
for (
|
|
149
|
-
r[r.indexOf(l)] = null,
|
|
150
|
-
} else for (
|
|
151
|
-
else
|
|
152
|
-
|
|
138
|
+
u.__d = !1, b && b(e), d = u.render(u.props, u.state, u.context), u.state = u.__s;
|
|
139
|
+
while (u.__d && ++T < 25);
|
|
140
|
+
u.state = u.__s, u.getChildContext != null && (n = F(F({}, n), u.getChildContext())), C && !_ && u.getSnapshotBeforeUpdate != null && (g = u.getSnapshotBeforeUpdate(h, v)), x = d, d != null && d.type === oe && d.key == null && (x = Be(d.props.children)), l = Ge(t, te(x) ? x : [x], e, o, n, i, r, s, l, c, a), u.base = e.__e, e.__u &= -161, u.__h.length && s.push(u), p && (u.__E = u.__ = null);
|
|
141
|
+
} catch (R) {
|
|
142
|
+
if (e.__v = null, c || r != null) if (R.then) {
|
|
143
|
+
for (e.__u |= c ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
144
|
+
r[r.indexOf(l)] = null, e.__e = l;
|
|
145
|
+
} else for (O = r.length; O--; ) ue(r[O]);
|
|
146
|
+
else e.__e = o.__e, e.__k = o.__k;
|
|
147
|
+
w.__e(R, e, o);
|
|
153
148
|
}
|
|
154
|
-
else r == null &&
|
|
155
|
-
return (
|
|
149
|
+
else r == null && e.__v == o.__v ? (e.__k = o.__k, e.__e = o.__e) : l = e.__e = mt(o.__e, e, o, n, i, r, s, c, a);
|
|
150
|
+
return (d = w.diffed) && d(e), 128 & e.__u ? void 0 : l;
|
|
156
151
|
}
|
|
157
|
-
function
|
|
158
|
-
for (var n = 0; n < o.length; n++)
|
|
159
|
-
|
|
152
|
+
function We(t, e, o) {
|
|
153
|
+
for (var n = 0; n < o.length; n++) he(o[n], o[++n], o[++n]);
|
|
154
|
+
w.__c && w.__c(e, t), t.some(function(i) {
|
|
160
155
|
try {
|
|
161
|
-
|
|
156
|
+
t = i.__h, i.__h = [], t.some(function(r) {
|
|
162
157
|
r.call(i);
|
|
163
158
|
});
|
|
164
159
|
} catch (r) {
|
|
165
|
-
|
|
160
|
+
w.__e(r, i.__v);
|
|
166
161
|
}
|
|
167
162
|
});
|
|
168
163
|
}
|
|
169
|
-
function
|
|
170
|
-
return typeof
|
|
164
|
+
function Be(t) {
|
|
165
|
+
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : te(t) ? t.map(Be) : F({}, t);
|
|
171
166
|
}
|
|
172
|
-
function
|
|
173
|
-
var
|
|
174
|
-
if (
|
|
175
|
-
for (
|
|
176
|
-
|
|
167
|
+
function mt(t, e, o, n, i, r, s, l, c) {
|
|
168
|
+
var a, d, u, _, h, v, g, p = o.props, m = e.props, C = e.type;
|
|
169
|
+
if (C == "svg" ? i = "http://www.w3.org/2000/svg" : C == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), r != null) {
|
|
170
|
+
for (a = 0; a < r.length; a++) if ((h = r[a]) && "setAttribute" in h == !!C && (C ? h.localName == C : h.nodeType == 3)) {
|
|
171
|
+
t = h, r[a] = null;
|
|
177
172
|
break;
|
|
178
173
|
}
|
|
179
174
|
}
|
|
180
|
-
if (
|
|
181
|
-
if (
|
|
182
|
-
|
|
175
|
+
if (t == null) {
|
|
176
|
+
if (C == null) return document.createTextNode(m);
|
|
177
|
+
t = document.createElementNS(i, C, m.is && m), l && (w.__m && w.__m(e, r), l = !1), r = null;
|
|
183
178
|
}
|
|
184
|
-
if (
|
|
179
|
+
if (C == null) p === m || l && t.data == m || (t.data = m);
|
|
185
180
|
else {
|
|
186
|
-
if (r = r &&
|
|
187
|
-
for (
|
|
188
|
-
if (
|
|
189
|
-
else if (!(
|
|
190
|
-
if (
|
|
191
|
-
|
|
181
|
+
if (r = r && ee.call(t.childNodes), p = o.props || G, !l && r != null) for (p = {}, a = 0; a < t.attributes.length; a++) p[(h = t.attributes[a]).name] = h.value;
|
|
182
|
+
for (a in p) if (h = p[a], a != "children") {
|
|
183
|
+
if (a == "dangerouslySetInnerHTML") u = h;
|
|
184
|
+
else if (!(a in m)) {
|
|
185
|
+
if (a == "value" && "defaultValue" in m || a == "checked" && "defaultChecked" in m) continue;
|
|
186
|
+
V(t, a, null, h, i);
|
|
192
187
|
}
|
|
193
188
|
}
|
|
194
|
-
for (
|
|
195
|
-
if (
|
|
196
|
-
else if (u && (
|
|
197
|
-
l || (
|
|
189
|
+
for (a in m) h = m[a], a == "children" ? _ = h : a == "dangerouslySetInnerHTML" ? d = h : a == "value" ? v = h : a == "checked" ? g = h : l && typeof h != "function" || p[a] === h || V(t, a, h, p[a], i);
|
|
190
|
+
if (d) l || u && (d.__html == u.__html || d.__html == t.innerHTML) || (t.innerHTML = d.__html), e.__k = [];
|
|
191
|
+
else if (u && (t.innerHTML = ""), Ge(e.type == "template" ? t.content : t, te(_) ? _ : [_], e, o, n, C == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, r, s, r ? r[0] : o.__k && D(o, 0), l, c), r != null) for (a = r.length; a--; ) ue(r[a]);
|
|
192
|
+
l || (a = "value", C == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[a] || C == "progress" && !v || C == "option" && v != p[a]) && V(t, a, v, p[a], i), a = "checked", g != null && g != t[a] && V(t, a, g, p[a], i));
|
|
198
193
|
}
|
|
199
|
-
return
|
|
194
|
+
return t;
|
|
200
195
|
}
|
|
201
|
-
function
|
|
196
|
+
function he(t, e, o) {
|
|
202
197
|
try {
|
|
203
|
-
if (typeof
|
|
204
|
-
var n = typeof
|
|
205
|
-
n &&
|
|
206
|
-
} else
|
|
198
|
+
if (typeof t == "function") {
|
|
199
|
+
var n = typeof t.__u == "function";
|
|
200
|
+
n && t.__u(), n && e == null || (t.__u = t(e));
|
|
201
|
+
} else t.current = e;
|
|
207
202
|
} catch (i) {
|
|
208
|
-
|
|
203
|
+
w.__e(i, o);
|
|
209
204
|
}
|
|
210
205
|
}
|
|
211
|
-
function
|
|
206
|
+
function qe(t, e, o) {
|
|
212
207
|
var n, i;
|
|
213
|
-
if (
|
|
208
|
+
if (w.unmount && w.unmount(t), (n = t.ref) && (n.current && n.current != t.__e || he(n, null, e)), (n = t.__c) != null) {
|
|
214
209
|
if (n.componentWillUnmount) try {
|
|
215
210
|
n.componentWillUnmount();
|
|
216
211
|
} catch (r) {
|
|
217
|
-
|
|
212
|
+
w.__e(r, e);
|
|
218
213
|
}
|
|
219
214
|
n.base = n.__P = null;
|
|
220
215
|
}
|
|
221
|
-
if (n =
|
|
222
|
-
o ||
|
|
216
|
+
if (n = t.__k) for (i = 0; i < n.length; i++) n[i] && qe(n[i], e, o || typeof t.type != "function");
|
|
217
|
+
o || ue(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
223
218
|
}
|
|
224
|
-
function
|
|
225
|
-
return this.constructor(
|
|
219
|
+
function vt(t, e, o) {
|
|
220
|
+
return this.constructor(t, o);
|
|
226
221
|
}
|
|
227
|
-
function
|
|
222
|
+
function gt(t, e, o) {
|
|
228
223
|
var n, i, r, s;
|
|
229
|
-
|
|
224
|
+
e == document && (e = document.documentElement), w.__ && w.__(t, e), i = (n = !1) ? null : e.__k, r = [], s = [], de(e, t = e.__k = ht(oe, null, [t]), i || G, G, e.namespaceURI, i ? null : e.firstChild ? ee.call(e.childNodes) : null, r, i ? i.__e : e.firstChild, n, s), We(r, t, s);
|
|
230
225
|
}
|
|
231
|
-
function
|
|
232
|
-
function
|
|
226
|
+
function Ve(t) {
|
|
227
|
+
function e(o) {
|
|
233
228
|
var n, i;
|
|
234
|
-
return this.getChildContext || (n = /* @__PURE__ */ new Set(), (i = {})[
|
|
229
|
+
return this.getChildContext || (n = /* @__PURE__ */ new Set(), (i = {})[e.__c] = this, this.getChildContext = function() {
|
|
235
230
|
return i;
|
|
236
231
|
}, this.componentWillUnmount = function() {
|
|
237
232
|
n = null;
|
|
238
233
|
}, this.shouldComponentUpdate = function(r) {
|
|
239
234
|
this.props.value != r.value && n.forEach(function(s) {
|
|
240
|
-
s.__e = !0,
|
|
235
|
+
s.__e = !0, le(s);
|
|
241
236
|
});
|
|
242
237
|
}, this.sub = function(r) {
|
|
243
238
|
n.add(r);
|
|
@@ -247,187 +242,187 @@ function rt(e) {
|
|
|
247
242
|
};
|
|
248
243
|
}), o.children;
|
|
249
244
|
}
|
|
250
|
-
return
|
|
245
|
+
return e.__c = "__cC" + Ue++, e.__ = t, e.Provider = e.__l = (e.Consumer = function(o, n) {
|
|
251
246
|
return o.children(n);
|
|
252
|
-
}).contextType =
|
|
247
|
+
}).contextType = e, e;
|
|
253
248
|
}
|
|
254
|
-
|
|
255
|
-
for (var i, r, s;
|
|
256
|
-
if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(
|
|
249
|
+
ee = De.slice, w = { __e: function(t, e, o, n) {
|
|
250
|
+
for (var i, r, s; e = e.__; ) if ((i = e.__c) && !i.__) try {
|
|
251
|
+
if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(t)), s = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, n || {}), s = i.__d), s) return i.__E = i;
|
|
257
252
|
} catch (l) {
|
|
258
|
-
|
|
253
|
+
t = l;
|
|
259
254
|
}
|
|
260
|
-
throw
|
|
261
|
-
} },
|
|
255
|
+
throw t;
|
|
256
|
+
} }, Fe = 0, X.prototype.setState = function(t, e) {
|
|
262
257
|
var o;
|
|
263
|
-
o = this.__s != null && this.__s != this.state ? this.__s : this.__s =
|
|
264
|
-
},
|
|
265
|
-
this.__v && (this.__e = !0,
|
|
266
|
-
},
|
|
267
|
-
return
|
|
268
|
-
},
|
|
269
|
-
var
|
|
270
|
-
function
|
|
271
|
-
|
|
272
|
-
var s, l,
|
|
273
|
-
if ("ref" in
|
|
274
|
-
var
|
|
275
|
-
if (typeof
|
|
276
|
-
return
|
|
277
|
-
}
|
|
278
|
-
var
|
|
279
|
-
function
|
|
280
|
-
|
|
281
|
-
var o =
|
|
282
|
-
return
|
|
283
|
-
}
|
|
284
|
-
function
|
|
285
|
-
return
|
|
286
|
-
}
|
|
287
|
-
function
|
|
288
|
-
var n =
|
|
289
|
-
if (n.t =
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
}], n.__c =
|
|
293
|
-
var i = function(l,
|
|
258
|
+
o = this.__s != null && this.__s != this.state ? this.__s : this.__s = F({}, this.state), typeof t == "function" && (t = t(F({}, o), this.props)), t && F(o, t), t != null && this.__v && (e && this._sb.push(e), le(this));
|
|
259
|
+
}, X.prototype.forceUpdate = function(t) {
|
|
260
|
+
this.__v && (this.__e = !0, t && this.__h.push(t), le(this));
|
|
261
|
+
}, X.prototype.render = oe, $ = [], Re = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, $e = function(t, e) {
|
|
262
|
+
return t.__v.__b - e.__v.__b;
|
|
263
|
+
}, Q.__r = 0, Oe = /(PointerCapture)$|Capture$/i, ce = 0, re = we(!1), se = we(!0), Ue = 0;
|
|
264
|
+
var pt = 0;
|
|
265
|
+
function f(t, e, o, n, i, r) {
|
|
266
|
+
e || (e = {});
|
|
267
|
+
var s, l, c = e;
|
|
268
|
+
if ("ref" in c) for (l in c = {}, e) l == "ref" ? s = e[l] : c[l] = e[l];
|
|
269
|
+
var a = { type: t, props: c, key: o, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --pt, __i: -1, __u: 0, __source: i, __self: r };
|
|
270
|
+
if (typeof t == "function" && (s = t.defaultProps)) for (l in s) c[l] === void 0 && (c[l] = s[l]);
|
|
271
|
+
return w.vnode && w.vnode(a), a;
|
|
272
|
+
}
|
|
273
|
+
var j, y, ie, ye, H = 0, Ye = [], z = w, be = z.__b, ke = z.__r, Te = z.diffed, ze = z.__c, Le = z.unmount, Pe = z.__;
|
|
274
|
+
function ne(t, e) {
|
|
275
|
+
z.__h && z.__h(y, t, H || e), H = 0;
|
|
276
|
+
var o = y.__H || (y.__H = { __: [], __h: [] });
|
|
277
|
+
return t >= o.__.length && o.__.push({}), o.__[t];
|
|
278
|
+
}
|
|
279
|
+
function I(t) {
|
|
280
|
+
return H = 1, Ct(Ke, t);
|
|
281
|
+
}
|
|
282
|
+
function Ct(t, e, o) {
|
|
283
|
+
var n = ne(j++, 2);
|
|
284
|
+
if (n.t = t, !n.__c && (n.__ = [Ke(void 0, e), function(l) {
|
|
285
|
+
var c = n.__N ? n.__N[0] : n.__[0], a = n.t(c, l);
|
|
286
|
+
c !== a && (n.__N = [a, n.__[1]], n.__c.setState({}));
|
|
287
|
+
}], n.__c = y, !y.__f)) {
|
|
288
|
+
var i = function(l, c, a) {
|
|
294
289
|
if (!n.__c.__H) return !0;
|
|
295
|
-
var
|
|
296
|
-
return !!
|
|
290
|
+
var d = n.__c.__H.__.filter(function(_) {
|
|
291
|
+
return !!_.__c;
|
|
297
292
|
});
|
|
298
|
-
if (
|
|
299
|
-
return !
|
|
300
|
-
})) return !r || r.call(this, l,
|
|
293
|
+
if (d.every(function(_) {
|
|
294
|
+
return !_.__N;
|
|
295
|
+
})) return !r || r.call(this, l, c, a);
|
|
301
296
|
var u = n.__c.props !== l;
|
|
302
|
-
return
|
|
303
|
-
if (
|
|
304
|
-
var
|
|
305
|
-
|
|
297
|
+
return d.forEach(function(_) {
|
|
298
|
+
if (_.__N) {
|
|
299
|
+
var h = _.__[0];
|
|
300
|
+
_.__ = _.__N, _.__N = void 0, h !== _.__[0] && (u = !0);
|
|
306
301
|
}
|
|
307
|
-
}), r && r.call(this, l,
|
|
302
|
+
}), r && r.call(this, l, c, a) || u;
|
|
308
303
|
};
|
|
309
|
-
|
|
310
|
-
var r =
|
|
311
|
-
|
|
304
|
+
y.__f = !0;
|
|
305
|
+
var r = y.shouldComponentUpdate, s = y.componentWillUpdate;
|
|
306
|
+
y.componentWillUpdate = function(l, c, a) {
|
|
312
307
|
if (this.__e) {
|
|
313
|
-
var
|
|
314
|
-
r = void 0, i(l,
|
|
308
|
+
var d = r;
|
|
309
|
+
r = void 0, i(l, c, a), r = d;
|
|
315
310
|
}
|
|
316
|
-
s && s.call(this, l,
|
|
317
|
-
},
|
|
311
|
+
s && s.call(this, l, c, a);
|
|
312
|
+
}, y.shouldComponentUpdate = i;
|
|
318
313
|
}
|
|
319
314
|
return n.__N || n.__;
|
|
320
315
|
}
|
|
321
|
-
function
|
|
322
|
-
var o =
|
|
323
|
-
!
|
|
316
|
+
function E(t, e) {
|
|
317
|
+
var o = ne(j++, 3);
|
|
318
|
+
!z.__s && Je(o.__H, e) && (o.__ = t, o.u = e, y.__H.__h.push(o));
|
|
324
319
|
}
|
|
325
|
-
function
|
|
326
|
-
return
|
|
327
|
-
return { current:
|
|
320
|
+
function U(t) {
|
|
321
|
+
return H = 5, W(function() {
|
|
322
|
+
return { current: t };
|
|
328
323
|
}, []);
|
|
329
324
|
}
|
|
330
|
-
function
|
|
331
|
-
var o =
|
|
332
|
-
return
|
|
325
|
+
function W(t, e) {
|
|
326
|
+
var o = ne(j++, 7);
|
|
327
|
+
return Je(o.__H, e) && (o.__ = t(), o.__H = e, o.__h = t), o.__;
|
|
333
328
|
}
|
|
334
|
-
function
|
|
335
|
-
return
|
|
336
|
-
return
|
|
337
|
-
},
|
|
329
|
+
function Se(t, e) {
|
|
330
|
+
return H = 8, W(function() {
|
|
331
|
+
return t;
|
|
332
|
+
}, e);
|
|
338
333
|
}
|
|
339
|
-
function
|
|
340
|
-
var
|
|
341
|
-
return o.c =
|
|
334
|
+
function Xe(t) {
|
|
335
|
+
var e = y.context[t.__c], o = ne(j++, 9);
|
|
336
|
+
return o.c = t, e ? (o.__ == null && (o.__ = !0, e.sub(y)), e.props.value) : t.__;
|
|
342
337
|
}
|
|
343
|
-
function
|
|
344
|
-
for (var
|
|
345
|
-
|
|
346
|
-
} catch (
|
|
347
|
-
|
|
338
|
+
function wt() {
|
|
339
|
+
for (var t; t = Ye.shift(); ) if (t.__P && t.__H) try {
|
|
340
|
+
t.__H.__h.forEach(J), t.__H.__h.forEach(ae), t.__H.__h = [];
|
|
341
|
+
} catch (e) {
|
|
342
|
+
t.__H.__h = [], z.__e(e, t.__v);
|
|
348
343
|
}
|
|
349
344
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
},
|
|
353
|
-
|
|
354
|
-
},
|
|
355
|
-
|
|
356
|
-
var
|
|
357
|
-
|
|
345
|
+
z.__b = function(t) {
|
|
346
|
+
y = null, be && be(t);
|
|
347
|
+
}, z.__ = function(t, e) {
|
|
348
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Pe && Pe(t, e);
|
|
349
|
+
}, z.__r = function(t) {
|
|
350
|
+
ke && ke(t), j = 0;
|
|
351
|
+
var e = (y = t.__c).__H;
|
|
352
|
+
e && (ie === y ? (e.__h = [], y.__h = [], e.__.forEach(function(o) {
|
|
358
353
|
o.__N && (o.__ = o.__N), o.u = o.__N = void 0;
|
|
359
|
-
})) : (
|
|
360
|
-
},
|
|
361
|
-
|
|
362
|
-
var
|
|
363
|
-
|
|
354
|
+
})) : (e.__h.forEach(J), e.__h.forEach(ae), e.__h = [], j = 0)), ie = y;
|
|
355
|
+
}, z.diffed = function(t) {
|
|
356
|
+
Te && Te(t);
|
|
357
|
+
var e = t.__c;
|
|
358
|
+
e && e.__H && (e.__H.__h.length && (Ye.push(e) !== 1 && ye === z.requestAnimationFrame || ((ye = z.requestAnimationFrame) || yt)(wt)), e.__H.__.forEach(function(o) {
|
|
364
359
|
o.u && (o.__H = o.u), o.u = void 0;
|
|
365
|
-
})),
|
|
366
|
-
},
|
|
367
|
-
|
|
360
|
+
})), ie = y = null;
|
|
361
|
+
}, z.__c = function(t, e) {
|
|
362
|
+
e.some(function(o) {
|
|
368
363
|
try {
|
|
369
|
-
o.__h.forEach(
|
|
370
|
-
return !n.__ ||
|
|
364
|
+
o.__h.forEach(J), o.__h = o.__h.filter(function(n) {
|
|
365
|
+
return !n.__ || ae(n);
|
|
371
366
|
});
|
|
372
367
|
} catch (n) {
|
|
373
|
-
|
|
368
|
+
e.some(function(i) {
|
|
374
369
|
i.__h && (i.__h = []);
|
|
375
|
-
}),
|
|
370
|
+
}), e = [], z.__e(n, o.__v);
|
|
376
371
|
}
|
|
377
|
-
}),
|
|
378
|
-
},
|
|
379
|
-
Le && Le(
|
|
380
|
-
var
|
|
372
|
+
}), ze && ze(t, e);
|
|
373
|
+
}, z.unmount = function(t) {
|
|
374
|
+
Le && Le(t);
|
|
375
|
+
var e, o = t.__c;
|
|
381
376
|
o && o.__H && (o.__H.__.forEach(function(n) {
|
|
382
377
|
try {
|
|
383
|
-
|
|
378
|
+
J(n);
|
|
384
379
|
} catch (i) {
|
|
385
|
-
|
|
380
|
+
e = i;
|
|
386
381
|
}
|
|
387
|
-
}), o.__H = void 0,
|
|
382
|
+
}), o.__H = void 0, e && z.__e(e, o.__v));
|
|
388
383
|
};
|
|
389
|
-
var
|
|
390
|
-
function
|
|
391
|
-
var
|
|
392
|
-
clearTimeout(n),
|
|
384
|
+
var Ne = typeof requestAnimationFrame == "function";
|
|
385
|
+
function yt(t) {
|
|
386
|
+
var e, o = function() {
|
|
387
|
+
clearTimeout(n), Ne && cancelAnimationFrame(e), setTimeout(t);
|
|
393
388
|
}, n = setTimeout(o, 100);
|
|
394
|
-
|
|
389
|
+
Ne && (e = requestAnimationFrame(o));
|
|
395
390
|
}
|
|
396
|
-
function
|
|
397
|
-
var
|
|
398
|
-
typeof o == "function" && (
|
|
391
|
+
function J(t) {
|
|
392
|
+
var e = y, o = t.__c;
|
|
393
|
+
typeof o == "function" && (t.__c = void 0, o()), y = e;
|
|
399
394
|
}
|
|
400
|
-
function
|
|
401
|
-
var
|
|
402
|
-
|
|
395
|
+
function ae(t) {
|
|
396
|
+
var e = y;
|
|
397
|
+
t.__c = t.__(), y = e;
|
|
403
398
|
}
|
|
404
|
-
function
|
|
405
|
-
return !
|
|
406
|
-
return o !==
|
|
399
|
+
function Je(t, e) {
|
|
400
|
+
return !t || t.length !== e.length || e.some(function(o, n) {
|
|
401
|
+
return o !== t[n];
|
|
407
402
|
});
|
|
408
403
|
}
|
|
409
|
-
function
|
|
410
|
-
return typeof
|
|
404
|
+
function Ke(t, e) {
|
|
405
|
+
return typeof e == "function" ? e(t) : e;
|
|
411
406
|
}
|
|
412
|
-
const
|
|
413
|
-
saveGameData(
|
|
407
|
+
const bt = (t) => ({
|
|
408
|
+
saveGameData(e) {
|
|
414
409
|
try {
|
|
415
410
|
const o = {
|
|
416
|
-
highestUnlockedLevel:
|
|
417
|
-
levelScores:
|
|
418
|
-
totalScore:
|
|
419
|
-
currentLevel:
|
|
411
|
+
highestUnlockedLevel: e.highestUnlockedLevel,
|
|
412
|
+
levelScores: e.levelScores,
|
|
413
|
+
totalScore: e.totalScore,
|
|
414
|
+
currentLevel: e.currentLevel
|
|
420
415
|
};
|
|
421
|
-
localStorage.setItem(
|
|
416
|
+
localStorage.setItem(t, JSON.stringify(o));
|
|
422
417
|
} catch (o) {
|
|
423
418
|
console.error("Failed to save maze game data:", o);
|
|
424
419
|
}
|
|
425
420
|
},
|
|
426
421
|
loadGameData() {
|
|
427
422
|
try {
|
|
428
|
-
const
|
|
429
|
-
if (!
|
|
430
|
-
const o = JSON.parse(
|
|
423
|
+
const e = localStorage.getItem(t);
|
|
424
|
+
if (!e) return null;
|
|
425
|
+
const o = JSON.parse(e);
|
|
431
426
|
return {
|
|
432
427
|
highestUnlockedLevel: o.highestUnlockedLevel,
|
|
433
428
|
levelScores: o.levelScores,
|
|
@@ -436,24 +431,28 @@ const Ut = (e) => ({
|
|
|
436
431
|
currentTier: Math.ceil(o.currentLevel / 12),
|
|
437
432
|
highestUnlockedTier: Math.ceil(o.highestUnlockedLevel / 12)
|
|
438
433
|
};
|
|
439
|
-
} catch (
|
|
440
|
-
return console.error("Failed to load maze game data:",
|
|
434
|
+
} catch (e) {
|
|
435
|
+
return console.error("Failed to load maze game data:", e), null;
|
|
441
436
|
}
|
|
442
437
|
},
|
|
443
438
|
resetGameData() {
|
|
444
439
|
try {
|
|
445
|
-
localStorage.removeItem(
|
|
446
|
-
} catch (
|
|
447
|
-
console.error("Failed to reset game state:",
|
|
440
|
+
localStorage.removeItem(t);
|
|
441
|
+
} catch (e) {
|
|
442
|
+
console.error("Failed to reset game state:", e);
|
|
448
443
|
}
|
|
449
444
|
}
|
|
450
|
-
}),
|
|
451
|
-
const o =
|
|
445
|
+
}), Ze = Ve(void 0), kt = ({ children: t, config: e }) => {
|
|
446
|
+
const o = bt(e.lcPrefix + "score"), n = o.loadGameData(), [i, r] = I({
|
|
452
447
|
currentLevel: 1,
|
|
453
448
|
highestUnlockedLevel: 1,
|
|
454
449
|
currentTier: 1,
|
|
455
450
|
highestUnlockedTier: 1,
|
|
456
|
-
currentScore:
|
|
451
|
+
currentScore: {
|
|
452
|
+
atExit: !1,
|
|
453
|
+
allFood: !1,
|
|
454
|
+
noClue: !0
|
|
455
|
+
},
|
|
457
456
|
totalScore: 0,
|
|
458
457
|
levelScores: {},
|
|
459
458
|
isGameActive: !0,
|
|
@@ -464,154 +463,156 @@ const Ut = (e) => ({
|
|
|
464
463
|
foodPositions: [],
|
|
465
464
|
playerPath: [],
|
|
466
465
|
visitCounts: {},
|
|
467
|
-
moveCount: 0,
|
|
468
466
|
playerAtExit: !1,
|
|
469
467
|
foodCollected: 0,
|
|
470
468
|
totalFoodCount: 0,
|
|
471
469
|
showClue: !1,
|
|
472
|
-
...
|
|
470
|
+
...n || {}
|
|
473
471
|
});
|
|
474
|
-
|
|
475
|
-
|
|
472
|
+
E(() => {
|
|
473
|
+
o.saveGameData(i);
|
|
476
474
|
}, [
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
475
|
+
i.highestUnlockedLevel,
|
|
476
|
+
i.levelScores,
|
|
477
|
+
i.totalScore,
|
|
478
|
+
i.currentLevel
|
|
481
479
|
]);
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
...
|
|
480
|
+
const s = () => {
|
|
481
|
+
o.resetGameData(), r((l) => ({
|
|
482
|
+
...l,
|
|
485
483
|
currentLevel: 1,
|
|
486
484
|
highestUnlockedLevel: 1,
|
|
487
485
|
currentTier: 1,
|
|
488
486
|
highestUnlockedTier: 1,
|
|
489
|
-
currentScore:
|
|
487
|
+
currentScore: {
|
|
488
|
+
atExit: !1,
|
|
489
|
+
allFood: !1,
|
|
490
|
+
noClue: !0
|
|
491
|
+
},
|
|
490
492
|
totalScore: 0,
|
|
491
493
|
levelScores: {},
|
|
492
494
|
isGameActive: !0,
|
|
493
495
|
levelTransitioning: !1,
|
|
494
496
|
playerPath: [],
|
|
495
497
|
visitCounts: {},
|
|
496
|
-
moveCount: 0,
|
|
497
498
|
foodCollected: 0,
|
|
498
499
|
showClue: !1
|
|
499
500
|
}));
|
|
500
501
|
};
|
|
501
|
-
return /* @__PURE__ */
|
|
502
|
-
|
|
502
|
+
return /* @__PURE__ */ f(
|
|
503
|
+
Ze.Provider,
|
|
503
504
|
{
|
|
504
505
|
value: {
|
|
505
|
-
gameState:
|
|
506
|
-
setGameState:
|
|
507
|
-
config:
|
|
508
|
-
resetGame:
|
|
506
|
+
gameState: i,
|
|
507
|
+
setGameState: r,
|
|
508
|
+
config: e,
|
|
509
|
+
resetGame: s
|
|
509
510
|
},
|
|
510
|
-
children:
|
|
511
|
+
children: t
|
|
511
512
|
}
|
|
512
513
|
);
|
|
513
|
-
},
|
|
514
|
-
const
|
|
515
|
-
if (!
|
|
514
|
+
}, _e = () => {
|
|
515
|
+
const t = Xe(Ze);
|
|
516
|
+
if (!t)
|
|
516
517
|
throw new Error("useGameContext must be used within a GameProvider");
|
|
517
|
-
return
|
|
518
|
+
return t;
|
|
518
519
|
};
|
|
519
|
-
function
|
|
520
|
-
if (!(
|
|
520
|
+
function fe(t, e) {
|
|
521
|
+
if (!(t instanceof e))
|
|
521
522
|
throw new TypeError("Cannot call a class as a function");
|
|
522
523
|
}
|
|
523
|
-
function
|
|
524
|
-
for (var o = 0; o <
|
|
525
|
-
var n =
|
|
526
|
-
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(
|
|
524
|
+
function Tt(t, e) {
|
|
525
|
+
for (var o = 0; o < e.length; o++) {
|
|
526
|
+
var n = e[o];
|
|
527
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);
|
|
527
528
|
}
|
|
528
529
|
}
|
|
529
|
-
function
|
|
530
|
-
return
|
|
530
|
+
function me(t, e, o) {
|
|
531
|
+
return e && Tt(t.prototype, e), t;
|
|
531
532
|
}
|
|
532
|
-
function
|
|
533
|
-
return +
|
|
533
|
+
function xe(t) {
|
|
534
|
+
return +t.replace(/px/, "");
|
|
534
535
|
}
|
|
535
|
-
function
|
|
536
|
-
var
|
|
537
|
-
|
|
536
|
+
function zt(t) {
|
|
537
|
+
var e = window.devicePixelRatio, o = getComputedStyle(t), n = xe(o.getPropertyValue("width")), i = xe(o.getPropertyValue("height"));
|
|
538
|
+
t.setAttribute("width", (n * e).toString()), t.setAttribute("height", (i * e).toString());
|
|
538
539
|
}
|
|
539
|
-
function
|
|
540
|
-
var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, n = Math.random() * (
|
|
540
|
+
function A(t, e) {
|
|
541
|
+
var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, n = Math.random() * (e - t) + t;
|
|
541
542
|
return Math.floor(n * Math.pow(10, o)) / Math.pow(10, o);
|
|
542
543
|
}
|
|
543
|
-
function
|
|
544
|
-
return
|
|
544
|
+
function Ae(t) {
|
|
545
|
+
return t[A(0, t.length)];
|
|
545
546
|
}
|
|
546
|
-
var
|
|
547
|
-
function
|
|
548
|
-
var
|
|
549
|
-
return Math.log(
|
|
547
|
+
var Lt = 125e-5, Pt = 5e-4, St = 9e-4, Nt = 1e-5, xt = 6, At = 80, Et = 0.9, It = 1.7, Mt = 0.2, Ft = 0.6, Rt = 0.03, $t = 0.07, Ot = 15, Ut = 82, Dt = 100, jt = 250, Gt = 40, Ht = ["#fcf403", "#62fc03", "#f4fc03", "#03e7fc", "#03fca5", "#a503fc", "#fc03ad", "#fc03c2"];
|
|
548
|
+
function Ee(t) {
|
|
549
|
+
var e = 1920;
|
|
550
|
+
return Math.log(t) / Math.log(e);
|
|
550
551
|
}
|
|
551
|
-
var
|
|
552
|
-
function e
|
|
553
|
-
|
|
554
|
-
var o =
|
|
552
|
+
var Ie = /* @__PURE__ */ function() {
|
|
553
|
+
function t(e) {
|
|
554
|
+
fe(this, t);
|
|
555
|
+
var o = e.initialPosition, n = e.direction, i = e.confettiRadius, r = e.confettiColors, s = e.emojis, l = e.emojiSize, c = e.canvasWidth, a = A(Et, It, 3), d = a * Ee(c);
|
|
555
556
|
this.confettiSpeed = {
|
|
556
|
-
x:
|
|
557
|
-
y:
|
|
558
|
-
}, this.finalConfettiSpeedX =
|
|
557
|
+
x: d,
|
|
558
|
+
y: d
|
|
559
|
+
}, this.finalConfettiSpeedX = A(Mt, Ft, 3), this.rotationSpeed = s.length ? 0.01 : A(Rt, $t, 3) * Ee(c), this.dragForceCoefficient = A(Pt, St, 6), this.radius = {
|
|
559
560
|
x: i,
|
|
560
561
|
y: i
|
|
561
|
-
}, this.initialRadius = i, this.rotationAngle = n === "left" ?
|
|
562
|
-
var u = n === "left" ?
|
|
562
|
+
}, this.initialRadius = i, this.rotationAngle = n === "left" ? A(0, 0.2, 3) : A(-0.2, 0, 3), this.emojiSize = l, this.emojiRotationAngle = A(0, 2 * Math.PI), this.radiusYUpdateDirection = "down";
|
|
563
|
+
var u = n === "left" ? A(Ut, Ot) * Math.PI / 180 : A(-15, -82) * Math.PI / 180;
|
|
563
564
|
this.absCos = Math.abs(Math.cos(u)), this.absSin = Math.abs(Math.sin(u));
|
|
564
|
-
var
|
|
565
|
-
x: o.x + (n === "left" ? -
|
|
566
|
-
y: o.y -
|
|
565
|
+
var _ = A(-150, 0), h = {
|
|
566
|
+
x: o.x + (n === "left" ? -_ : _) * this.absCos,
|
|
567
|
+
y: o.y - _ * this.absSin
|
|
567
568
|
};
|
|
568
|
-
this.currentPosition = Object.assign({},
|
|
569
|
+
this.currentPosition = Object.assign({}, h), this.initialPosition = Object.assign({}, h), this.color = s.length ? null : Ae(r), this.emoji = s.length ? Ae(s) : null, this.createdAt = (/* @__PURE__ */ new Date()).getTime(), this.direction = n;
|
|
569
570
|
}
|
|
570
|
-
return
|
|
571
|
+
return me(t, [{
|
|
571
572
|
key: "draw",
|
|
572
573
|
value: function(o) {
|
|
573
|
-
var n = this.currentPosition, i = this.radius, r = this.color, s = this.emoji, l = this.rotationAngle,
|
|
574
|
-
r ? (o.fillStyle = r, o.beginPath(), o.ellipse(n.x *
|
|
574
|
+
var n = this.currentPosition, i = this.radius, r = this.color, s = this.emoji, l = this.rotationAngle, c = this.emojiRotationAngle, a = this.emojiSize, d = window.devicePixelRatio;
|
|
575
|
+
r ? (o.fillStyle = r, o.beginPath(), o.ellipse(n.x * d, n.y * d, i.x * d, i.y * d, l, 0, 2 * Math.PI), o.fill()) : s && (o.font = "".concat(a, "px serif"), o.save(), o.translate(d * n.x, d * n.y), o.rotate(c), o.textAlign = "center", o.fillText(s, 0, 0), o.restore());
|
|
575
576
|
}
|
|
576
577
|
}, {
|
|
577
578
|
key: "updatePosition",
|
|
578
579
|
value: function(o, n) {
|
|
579
|
-
var i = this.confettiSpeed, r = this.dragForceCoefficient, s = this.finalConfettiSpeedX, l = this.radiusYUpdateDirection,
|
|
580
|
-
if (i.x > s && (this.confettiSpeed.x -= r * o), this.currentPosition.x += i.x * (
|
|
580
|
+
var i = this.confettiSpeed, r = this.dragForceCoefficient, s = this.finalConfettiSpeedX, l = this.radiusYUpdateDirection, c = this.rotationSpeed, a = this.createdAt, d = this.direction, u = n - a;
|
|
581
|
+
if (i.x > s && (this.confettiSpeed.x -= r * o), this.currentPosition.x += i.x * (d === "left" ? -this.absCos : this.absCos) * o, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u + Lt * Math.pow(u, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : Nt * o, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
|
|
581
582
|
this.emojiRotationAngle += this.rotationSpeed * o % (2 * Math.PI);
|
|
582
583
|
return;
|
|
583
584
|
}
|
|
584
|
-
l === "down" ? (this.radius.y -= o *
|
|
585
|
+
l === "down" ? (this.radius.y -= o * c, this.radius.y <= 0 && (this.radius.y = 0, this.radiusYUpdateDirection = "up")) : (this.radius.y += o * c, this.radius.y >= this.initialRadius && (this.radius.y = this.initialRadius, this.radiusYUpdateDirection = "down"));
|
|
585
586
|
}
|
|
586
587
|
}, {
|
|
587
588
|
key: "getIsVisibleOnCanvas",
|
|
588
589
|
value: function(o) {
|
|
589
|
-
return this.currentPosition.y < o +
|
|
590
|
+
return this.currentPosition.y < o + Dt;
|
|
590
591
|
}
|
|
591
|
-
}]),
|
|
592
|
+
}]), t;
|
|
592
593
|
}();
|
|
593
|
-
function
|
|
594
|
-
var
|
|
595
|
-
return
|
|
594
|
+
function Wt() {
|
|
595
|
+
var t = document.createElement("canvas");
|
|
596
|
+
return t.style.position = "fixed", t.style.width = "100%", t.style.height = "100%", t.style.top = "0", t.style.left = "0", t.style.zIndex = "1000", t.style.pointerEvents = "none", document.body.appendChild(t), t;
|
|
596
597
|
}
|
|
597
|
-
function
|
|
598
|
-
var
|
|
599
|
-
return
|
|
598
|
+
function Bt(t) {
|
|
599
|
+
var e = t.confettiRadius, o = e === void 0 ? xt : e, n = t.confettiNumber, i = n === void 0 ? t.confettiesNumber || (t.emojis ? Gt : jt) : n, r = t.confettiColors, s = r === void 0 ? Ht : r, l = t.emojis, c = l === void 0 ? t.emojies || [] : l, a = t.emojiSize, d = a === void 0 ? At : a;
|
|
600
|
+
return t.emojies && console.error("emojies argument is deprecated, please use emojis instead"), t.confettiesNumber && console.error("confettiesNumber argument is deprecated, please use confettiNumber instead"), {
|
|
600
601
|
confettiRadius: o,
|
|
601
602
|
confettiNumber: i,
|
|
602
603
|
confettiColors: s,
|
|
603
|
-
emojis:
|
|
604
|
-
emojiSize:
|
|
604
|
+
emojis: c,
|
|
605
|
+
emojiSize: d
|
|
605
606
|
};
|
|
606
607
|
}
|
|
607
|
-
var
|
|
608
|
-
function e
|
|
608
|
+
var qt = /* @__PURE__ */ function() {
|
|
609
|
+
function t(e) {
|
|
609
610
|
var o = this;
|
|
610
|
-
|
|
611
|
+
fe(this, t), this.canvasContext = e, this.shapes = [], this.promise = new Promise(function(n) {
|
|
611
612
|
return o.resolvePromise = n;
|
|
612
613
|
});
|
|
613
614
|
}
|
|
614
|
-
return
|
|
615
|
+
return me(t, [{
|
|
615
616
|
key: "getBatchCompletePromise",
|
|
616
617
|
value: function() {
|
|
617
618
|
return this.promise;
|
|
@@ -632,20 +633,20 @@ var ao = /* @__PURE__ */ function() {
|
|
|
632
633
|
key: "processShapes",
|
|
633
634
|
value: function(o, n, i) {
|
|
634
635
|
var r = this, s = o.timeDelta, l = o.currentTime;
|
|
635
|
-
this.shapes = this.shapes.filter(function(
|
|
636
|
-
return
|
|
636
|
+
this.shapes = this.shapes.filter(function(c) {
|
|
637
|
+
return c.updatePosition(s, l), c.draw(r.canvasContext), i ? c.getIsVisibleOnCanvas(n) : !0;
|
|
637
638
|
});
|
|
638
639
|
}
|
|
639
|
-
}]),
|
|
640
|
-
}(),
|
|
641
|
-
function
|
|
642
|
-
var
|
|
643
|
-
|
|
640
|
+
}]), t;
|
|
641
|
+
}(), Vt = /* @__PURE__ */ function() {
|
|
642
|
+
function t() {
|
|
643
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
644
|
+
fe(this, t), this.activeConfettiBatches = [], this.canvas = e.canvas || Wt(), this.canvasContext = this.canvas.getContext("2d"), this.requestAnimationFrameRequested = !1, this.lastUpdated = (/* @__PURE__ */ new Date()).getTime(), this.iterationIndex = 0, this.loop = this.loop.bind(this), requestAnimationFrame(this.loop);
|
|
644
645
|
}
|
|
645
|
-
return
|
|
646
|
+
return me(t, [{
|
|
646
647
|
key: "loop",
|
|
647
648
|
value: function() {
|
|
648
|
-
this.requestAnimationFrameRequested = !1,
|
|
649
|
+
this.requestAnimationFrameRequested = !1, zt(this.canvas);
|
|
649
650
|
var o = (/* @__PURE__ */ new Date()).getTime(), n = o - this.lastUpdated, i = this.canvas.offsetHeight, r = this.iterationIndex % 10 === 0;
|
|
650
651
|
this.activeConfettiBatches = this.activeConfettiBatches.filter(function(s) {
|
|
651
652
|
return s.processShapes({
|
|
@@ -662,33 +663,33 @@ var ao = /* @__PURE__ */ function() {
|
|
|
662
663
|
}, {
|
|
663
664
|
key: "addConfetti",
|
|
664
665
|
value: function() {
|
|
665
|
-
for (var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n =
|
|
666
|
+
for (var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = Bt(o), i = n.confettiRadius, r = n.confettiNumber, s = n.confettiColors, l = n.emojis, c = n.emojiSize, a = this.canvas.getBoundingClientRect(), d = a.width, u = a.height, _ = u * 5 / 7, h = {
|
|
666
667
|
x: 0,
|
|
667
|
-
y:
|
|
668
|
-
},
|
|
669
|
-
x:
|
|
670
|
-
y:
|
|
671
|
-
}, g = new
|
|
672
|
-
var
|
|
673
|
-
initialPosition:
|
|
668
|
+
y: _
|
|
669
|
+
}, v = {
|
|
670
|
+
x: d,
|
|
671
|
+
y: _
|
|
672
|
+
}, g = new qt(this.canvasContext), p = 0; p < r / 2; p++) {
|
|
673
|
+
var m = new Ie({
|
|
674
|
+
initialPosition: h,
|
|
674
675
|
direction: "right",
|
|
675
676
|
confettiRadius: i,
|
|
676
677
|
confettiColors: s,
|
|
677
678
|
confettiNumber: r,
|
|
678
679
|
emojis: l,
|
|
679
|
-
emojiSize:
|
|
680
|
-
canvasWidth:
|
|
681
|
-
}),
|
|
682
|
-
initialPosition:
|
|
680
|
+
emojiSize: c,
|
|
681
|
+
canvasWidth: d
|
|
682
|
+
}), C = new Ie({
|
|
683
|
+
initialPosition: v,
|
|
683
684
|
direction: "left",
|
|
684
685
|
confettiRadius: i,
|
|
685
686
|
confettiColors: s,
|
|
686
687
|
confettiNumber: r,
|
|
687
688
|
emojis: l,
|
|
688
|
-
emojiSize:
|
|
689
|
-
canvasWidth:
|
|
689
|
+
emojiSize: c,
|
|
690
|
+
canvasWidth: d
|
|
690
691
|
});
|
|
691
|
-
g.addShapes(
|
|
692
|
+
g.addShapes(m, C);
|
|
692
693
|
}
|
|
693
694
|
return this.activeConfettiBatches.push(g), this.queueAnimationFrameIfNeeded(), g.getBatchCompletePromise();
|
|
694
695
|
}
|
|
@@ -702,304 +703,44 @@ var ao = /* @__PURE__ */ function() {
|
|
|
702
703
|
value: function() {
|
|
703
704
|
this.canvas.remove();
|
|
704
705
|
}
|
|
705
|
-
}]),
|
|
706
|
+
}]), t;
|
|
706
707
|
}();
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
return e;
|
|
710
|
-
}
|
|
711
|
-
function Fe(e, t) {
|
|
712
|
-
for (var o in e) if (o !== "__source" && !(o in t)) return !0;
|
|
713
|
-
for (var n in t) if (n !== "__source" && e[n] !== t[n]) return !0;
|
|
714
|
-
return !1;
|
|
715
|
-
}
|
|
716
|
-
function Ue(e, t) {
|
|
717
|
-
this.props = e, this.context = t;
|
|
718
|
-
}
|
|
719
|
-
(Ue.prototype = new $()).isPureReactComponent = !0, Ue.prototype.shouldComponentUpdate = function(e, t) {
|
|
720
|
-
return Fe(this.props, e) || Fe(this.state, t);
|
|
721
|
-
};
|
|
722
|
-
var Oe = y.__b;
|
|
723
|
-
y.__b = function(e) {
|
|
724
|
-
e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), Oe && Oe(e);
|
|
725
|
-
};
|
|
726
|
-
var uo = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
|
|
727
|
-
function ht(e) {
|
|
728
|
-
function t(o) {
|
|
729
|
-
var n = dt({}, o);
|
|
730
|
-
return delete n.ref, e(n, o.ref || null);
|
|
731
|
-
}
|
|
732
|
-
return t.$$typeof = uo, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
|
|
733
|
-
}
|
|
734
|
-
var _o = y.__e;
|
|
735
|
-
y.__e = function(e, t, o, n) {
|
|
736
|
-
if (e.then) {
|
|
737
|
-
for (var i, r = t; r = r.__; ) if ((i = r.__c) && i.__c) return t.__e == null && (t.__e = o.__e, t.__k = o.__k), i.__c(e, t);
|
|
738
|
-
}
|
|
739
|
-
_o(e, t, o, n);
|
|
740
|
-
};
|
|
741
|
-
var De = y.unmount;
|
|
742
|
-
function ft(e, t, o) {
|
|
743
|
-
return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(n) {
|
|
744
|
-
typeof n.__c == "function" && n.__c();
|
|
745
|
-
}), e.__c.__H = null), (e = dt({}, e)).__c != null && (e.__c.__P === o && (e.__c.__P = t), e.__c.__e = !0, e.__c = null), e.__k = e.__k && e.__k.map(function(n) {
|
|
746
|
-
return ft(n, t, o);
|
|
747
|
-
})), e;
|
|
748
|
-
}
|
|
749
|
-
function mt(e, t, o) {
|
|
750
|
-
return e && o && (e.__v = null, e.__k = e.__k && e.__k.map(function(n) {
|
|
751
|
-
return mt(n, t, o);
|
|
752
|
-
}), e.__c && e.__c.__P === t && (e.__e && o.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = o)), e;
|
|
753
|
-
}
|
|
754
|
-
function se() {
|
|
755
|
-
this.__u = 0, this.o = null, this.__b = null;
|
|
756
|
-
}
|
|
757
|
-
function pt(e) {
|
|
758
|
-
var t = e.__.__c;
|
|
759
|
-
return t && t.__a && t.__a(e);
|
|
760
|
-
}
|
|
761
|
-
function K() {
|
|
762
|
-
this.i = null, this.l = null;
|
|
763
|
-
}
|
|
764
|
-
y.unmount = function(e) {
|
|
765
|
-
var t = e.__c;
|
|
766
|
-
t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), De && De(e);
|
|
767
|
-
}, (se.prototype = new $()).__c = function(e, t) {
|
|
768
|
-
var o = t.__c, n = this;
|
|
769
|
-
n.o == null && (n.o = []), n.o.push(o);
|
|
770
|
-
var i = pt(n.__v), r = !1, s = function() {
|
|
771
|
-
r || (r = !0, o.__R = null, i ? i(l) : l());
|
|
772
|
-
};
|
|
773
|
-
o.__R = s;
|
|
774
|
-
var l = function() {
|
|
775
|
-
if (!--n.__u) {
|
|
776
|
-
if (n.state.__a) {
|
|
777
|
-
var a = n.state.__a;
|
|
778
|
-
n.__v.__k[0] = mt(a, a.__c.__P, a.__c.__O);
|
|
779
|
-
}
|
|
780
|
-
var c;
|
|
781
|
-
for (n.setState({ __a: n.__b = null }); c = n.o.pop(); ) c.forceUpdate();
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
n.__u++ || 32 & t.__u || n.setState({ __a: n.__b = n.__v.__k[0] }), e.then(s, s);
|
|
785
|
-
}, se.prototype.componentWillUnmount = function() {
|
|
786
|
-
this.o = [];
|
|
787
|
-
}, se.prototype.render = function(e, t) {
|
|
788
|
-
if (this.__b) {
|
|
789
|
-
if (this.__v.__k) {
|
|
790
|
-
var o = document.createElement("div"), n = this.__v.__k[0].__c;
|
|
791
|
-
this.__v.__k[0] = ft(this.__b, o, n.__O = n.__P);
|
|
792
|
-
}
|
|
793
|
-
this.__b = null;
|
|
794
|
-
}
|
|
795
|
-
var i = t.__a && W(j, null, e.fallback);
|
|
796
|
-
return i && (i.__u &= -33), [W(j, null, t.__a ? null : e.children), i];
|
|
797
|
-
};
|
|
798
|
-
var We = function(e, t, o) {
|
|
799
|
-
if (++o[1] === o[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (o = e.i; o; ) {
|
|
800
|
-
for (; o.length > 3; ) o.pop()();
|
|
801
|
-
if (o[1] < o[0]) break;
|
|
802
|
-
e.i = o = o[2];
|
|
803
|
-
}
|
|
804
|
-
};
|
|
805
|
-
(K.prototype = new $()).__a = function(e) {
|
|
806
|
-
var t = this, o = pt(t.__v), n = t.l.get(e);
|
|
807
|
-
return n[0]++, function(i) {
|
|
808
|
-
var r = function() {
|
|
809
|
-
t.props.revealOrder ? (n.push(i), We(t, e, n)) : i();
|
|
810
|
-
};
|
|
811
|
-
o ? o(r) : r();
|
|
812
|
-
};
|
|
813
|
-
}, K.prototype.render = function(e) {
|
|
814
|
-
this.i = null, this.l = /* @__PURE__ */ new Map();
|
|
815
|
-
var t = oe(e.children);
|
|
816
|
-
e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
|
|
817
|
-
for (var o = t.length; o--; ) this.l.set(t[o], this.i = [1, 0, this.i]);
|
|
818
|
-
return e.children;
|
|
819
|
-
}, K.prototype.componentDidUpdate = K.prototype.componentDidMount = function() {
|
|
820
|
-
var e = this;
|
|
821
|
-
this.l.forEach(function(t, o) {
|
|
822
|
-
We(e, o, t);
|
|
823
|
-
});
|
|
824
|
-
};
|
|
825
|
-
var ho = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, fo = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, mo = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, po = /[A-Z0-9]/g, vo = typeof document < "u", go = function(e) {
|
|
826
|
-
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
|
|
827
|
-
};
|
|
828
|
-
$.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
|
|
829
|
-
Object.defineProperty($.prototype, e, { configurable: !0, get: function() {
|
|
830
|
-
return this["UNSAFE_" + e];
|
|
831
|
-
}, set: function(t) {
|
|
832
|
-
Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
|
|
833
|
-
} });
|
|
834
|
-
});
|
|
835
|
-
var je = y.event;
|
|
836
|
-
function Co() {
|
|
837
|
-
}
|
|
838
|
-
function yo() {
|
|
839
|
-
return this.cancelBubble;
|
|
840
|
-
}
|
|
841
|
-
function wo() {
|
|
842
|
-
return this.defaultPrevented;
|
|
843
|
-
}
|
|
844
|
-
y.event = function(e) {
|
|
845
|
-
return je && (e = je(e)), e.persist = Co, e.isPropagationStopped = yo, e.isDefaultPrevented = wo, e.nativeEvent = e;
|
|
846
|
-
};
|
|
847
|
-
var bo = { enumerable: !1, configurable: !0, get: function() {
|
|
848
|
-
return this.class;
|
|
849
|
-
} }, He = y.vnode;
|
|
850
|
-
y.vnode = function(e) {
|
|
851
|
-
typeof e.type == "string" && function(t) {
|
|
852
|
-
var o = t.props, n = t.type, i = {}, r = n.indexOf("-") === -1;
|
|
853
|
-
for (var s in o) {
|
|
854
|
-
var l = o[s];
|
|
855
|
-
if (!(s === "value" && "defaultValue" in o && l == null || vo && s === "children" && n === "noscript" || s === "class" || s === "className")) {
|
|
856
|
-
var a = s.toLowerCase();
|
|
857
|
-
s === "defaultValue" && "value" in o && o.value == null ? s = "value" : s === "download" && l === !0 ? l = "" : a === "translate" && l === "no" ? l = !1 : a[0] === "o" && a[1] === "n" ? a === "ondoubleclick" ? s = "ondblclick" : a !== "onchange" || n !== "input" && n !== "textarea" || go(o.type) ? a === "onfocus" ? s = "onfocusin" : a === "onblur" ? s = "onfocusout" : mo.test(s) && (s = a) : a = s = "oninput" : r && fo.test(s) ? s = s.replace(po, "-$&").toLowerCase() : l === null && (l = void 0), a === "oninput" && i[s = a] && (s = "oninputCapture"), i[s] = l;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
n == "select" && i.multiple && Array.isArray(i.value) && (i.value = oe(o.children).forEach(function(c) {
|
|
861
|
-
c.props.selected = i.value.indexOf(c.props.value) != -1;
|
|
862
|
-
})), n == "select" && i.defaultValue != null && (i.value = oe(o.children).forEach(function(c) {
|
|
863
|
-
c.props.selected = i.multiple ? i.defaultValue.indexOf(c.props.value) != -1 : i.defaultValue == c.props.value;
|
|
864
|
-
})), o.class && !o.className ? (i.class = o.class, Object.defineProperty(i, "className", bo)) : (o.className && !o.class || o.class && o.className) && (i.class = i.className = o.className), t.props = i;
|
|
865
|
-
}(e), e.$$typeof = ho, He && He(e);
|
|
866
|
-
};
|
|
867
|
-
var Ge = y.__r;
|
|
868
|
-
y.__r = function(e) {
|
|
869
|
-
Ge && Ge(e), e.__c;
|
|
870
|
-
};
|
|
871
|
-
var Be = y.diffed;
|
|
872
|
-
y.diffed = function(e) {
|
|
873
|
-
Be && Be(e);
|
|
874
|
-
var t = e.props, o = e.__e;
|
|
875
|
-
o != null && e.type === "textarea" && "value" in t && t.value !== o.value && (o.value = t.value == null ? "" : t.value);
|
|
876
|
-
};
|
|
877
|
-
/**
|
|
878
|
-
* @license lucide-react v0.473.0 - ISC
|
|
879
|
-
*
|
|
880
|
-
* This source code is licensed under the ISC license.
|
|
881
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
882
|
-
*/
|
|
883
|
-
const ko = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), vt = (...e) => e.filter((t, o, n) => !!t && t.trim() !== "" && n.indexOf(t) === o).join(" ").trim();
|
|
884
|
-
/**
|
|
885
|
-
* @license lucide-react v0.473.0 - ISC
|
|
886
|
-
*
|
|
887
|
-
* This source code is licensed under the ISC license.
|
|
888
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
889
|
-
*/
|
|
890
|
-
var To = {
|
|
891
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
892
|
-
width: 24,
|
|
893
|
-
height: 24,
|
|
894
|
-
viewBox: "0 0 24 24",
|
|
895
|
-
fill: "none",
|
|
896
|
-
stroke: "currentColor",
|
|
897
|
-
strokeWidth: 2,
|
|
898
|
-
strokeLinecap: "round",
|
|
899
|
-
strokeLinejoin: "round"
|
|
900
|
-
};
|
|
901
|
-
/**
|
|
902
|
-
* @license lucide-react v0.473.0 - ISC
|
|
903
|
-
*
|
|
904
|
-
* This source code is licensed under the ISC license.
|
|
905
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
906
|
-
*/
|
|
907
|
-
const zo = ht(
|
|
908
|
-
({
|
|
909
|
-
color: e = "currentColor",
|
|
910
|
-
size: t = 24,
|
|
911
|
-
strokeWidth: o = 2,
|
|
912
|
-
absoluteStrokeWidth: n,
|
|
913
|
-
className: i = "",
|
|
914
|
-
children: r,
|
|
915
|
-
iconNode: s,
|
|
916
|
-
...l
|
|
917
|
-
}, a) => W(
|
|
918
|
-
"svg",
|
|
919
|
-
{
|
|
920
|
-
ref: a,
|
|
921
|
-
...To,
|
|
922
|
-
width: t,
|
|
923
|
-
height: t,
|
|
924
|
-
stroke: e,
|
|
925
|
-
strokeWidth: n ? Number(o) * 24 / Number(t) : o,
|
|
926
|
-
className: vt("lucide", i),
|
|
927
|
-
...l
|
|
928
|
-
},
|
|
929
|
-
[
|
|
930
|
-
...s.map(([c, _]) => W(c, _)),
|
|
931
|
-
...Array.isArray(r) ? r : [r]
|
|
932
|
-
]
|
|
933
|
-
)
|
|
934
|
-
);
|
|
935
|
-
/**
|
|
936
|
-
* @license lucide-react v0.473.0 - ISC
|
|
937
|
-
*
|
|
938
|
-
* This source code is licensed under the ISC license.
|
|
939
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
940
|
-
*/
|
|
941
|
-
const Po = (e, t) => {
|
|
942
|
-
const o = ht(
|
|
943
|
-
({ className: n, ...i }, r) => W(zo, {
|
|
944
|
-
ref: r,
|
|
945
|
-
iconNode: t,
|
|
946
|
-
className: vt(`lucide-${ko(e)}`, n),
|
|
947
|
-
...i
|
|
948
|
-
})
|
|
949
|
-
);
|
|
950
|
-
return o.displayName = `${e}`, o;
|
|
951
|
-
};
|
|
952
|
-
/**
|
|
953
|
-
* @license lucide-react v0.473.0 - ISC
|
|
954
|
-
*
|
|
955
|
-
* This source code is licensed under the ISC license.
|
|
956
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
957
|
-
*/
|
|
958
|
-
const No = [
|
|
959
|
-
[
|
|
960
|
-
"path",
|
|
961
|
-
{
|
|
962
|
-
d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",
|
|
963
|
-
key: "1qme2f"
|
|
964
|
-
}
|
|
965
|
-
],
|
|
966
|
-
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
967
|
-
], So = Po("Settings", No), gt = rt(void 0), Lo = ({ children: e }) => {
|
|
968
|
-
const [t, o] = R(null), [n, i] = R(!1), [r, s] = R(
|
|
708
|
+
const Qe = Ve(void 0), Yt = ({ children: t }) => {
|
|
709
|
+
const [e, o] = I(null), [n, i] = I(!1), [r, s] = I(
|
|
969
710
|
"info"
|
|
970
|
-
), [l,
|
|
971
|
-
i(!1), l && (clearTimeout(l),
|
|
972
|
-
}, [l]),
|
|
973
|
-
(u,
|
|
974
|
-
if (n &&
|
|
975
|
-
const
|
|
711
|
+
), [l, c] = I(null), a = Se(() => {
|
|
712
|
+
i(!1), l && (clearTimeout(l), c(null));
|
|
713
|
+
}, [l]), d = Se(
|
|
714
|
+
(u, _ = "info", h = 3e3) => {
|
|
715
|
+
if (n && a(), o(u), s(_), i(!0), h > 0) {
|
|
716
|
+
const v = setTimeout(() => {
|
|
976
717
|
i(!1);
|
|
977
|
-
},
|
|
978
|
-
|
|
718
|
+
}, h);
|
|
719
|
+
c(v);
|
|
979
720
|
}
|
|
980
721
|
},
|
|
981
|
-
[n,
|
|
722
|
+
[n, a]
|
|
982
723
|
);
|
|
983
|
-
return /* @__PURE__ */
|
|
984
|
-
|
|
724
|
+
return /* @__PURE__ */ f(
|
|
725
|
+
Qe.Provider,
|
|
985
726
|
{
|
|
986
|
-
value: { message:
|
|
987
|
-
children:
|
|
727
|
+
value: { message: e, visible: n, type: r, showToast: d, hideToast: a },
|
|
728
|
+
children: t
|
|
988
729
|
}
|
|
989
730
|
);
|
|
990
|
-
},
|
|
991
|
-
const
|
|
992
|
-
if (!
|
|
731
|
+
}, ve = () => {
|
|
732
|
+
const t = Xe(Qe);
|
|
733
|
+
if (!t)
|
|
993
734
|
throw new Error("useToast must be used within a ToastProvider");
|
|
994
|
-
return
|
|
995
|
-
},
|
|
996
|
-
i18n:
|
|
997
|
-
totalTiers:
|
|
735
|
+
return t;
|
|
736
|
+
}, Xt = ({
|
|
737
|
+
i18n: t,
|
|
738
|
+
totalTiers: e,
|
|
998
739
|
currentTier: o,
|
|
999
740
|
highestUnlockedTier: n,
|
|
1000
741
|
onTierChange: i,
|
|
1001
742
|
disabled: r
|
|
1002
|
-
}) => /* @__PURE__ */
|
|
743
|
+
}) => /* @__PURE__ */ f("div", { className: "tier-selector", children: /* @__PURE__ */ f(
|
|
1003
744
|
"select",
|
|
1004
745
|
{
|
|
1005
746
|
value: o,
|
|
@@ -1008,98 +749,113 @@ const No = [
|
|
|
1008
749
|
},
|
|
1009
750
|
disabled: r,
|
|
1010
751
|
className: "tier-dropdown",
|
|
1011
|
-
children: Array.from({ length:
|
|
752
|
+
children: Array.from({ length: e }, (s, l) => l + 1).map((s) => /* @__PURE__ */ f(
|
|
1012
753
|
"option",
|
|
1013
754
|
{
|
|
1014
755
|
value: s,
|
|
1015
756
|
disabled: s > n,
|
|
1016
|
-
children:
|
|
1017
|
-
e.tier,
|
|
1018
|
-
" ",
|
|
1019
|
-
s
|
|
1020
|
-
]
|
|
757
|
+
children: t.tier + " " + s
|
|
1021
758
|
},
|
|
1022
759
|
`tier-${s}`
|
|
1023
760
|
))
|
|
1024
761
|
}
|
|
1025
|
-
) }),
|
|
1026
|
-
i18n:
|
|
1027
|
-
levelsRange:
|
|
762
|
+
) }), Jt = ({
|
|
763
|
+
i18n: t,
|
|
764
|
+
levelsRange: e,
|
|
1028
765
|
currentLevel: o,
|
|
1029
766
|
highestUnlockedLevel: n,
|
|
1030
767
|
onLevelChange: i,
|
|
1031
768
|
disabled: r
|
|
1032
769
|
}) => {
|
|
1033
|
-
const s =
|
|
1034
|
-
|
|
770
|
+
const { gameState: s } = _e(), c = (([a, d]) => Array.from({ length: d - a + 1 }, (u, _) => {
|
|
771
|
+
const h = a + _, v = s.levelScores[h] || 0;
|
|
772
|
+
return {
|
|
773
|
+
level: h,
|
|
774
|
+
score: v
|
|
775
|
+
};
|
|
776
|
+
}))(e);
|
|
777
|
+
return /* @__PURE__ */ f("div", { className: "level-selector", children: /* @__PURE__ */ f(
|
|
1035
778
|
"select",
|
|
1036
779
|
{
|
|
1037
780
|
value: o,
|
|
1038
|
-
onChange: (
|
|
1039
|
-
|
|
781
|
+
onChange: (a) => {
|
|
782
|
+
a.target && a.target.value && i(Number(a.target.value));
|
|
1040
783
|
},
|
|
1041
784
|
disabled: r,
|
|
1042
785
|
className: "level-dropdown",
|
|
1043
|
-
children:
|
|
786
|
+
children: c.map(({ level: a, score: d }) => /* @__PURE__ */ f(
|
|
1044
787
|
"option",
|
|
1045
788
|
{
|
|
1046
|
-
value:
|
|
1047
|
-
disabled:
|
|
1048
|
-
children:
|
|
1049
|
-
e.level,
|
|
1050
|
-
" ",
|
|
1051
|
-
l
|
|
1052
|
-
]
|
|
789
|
+
value: a,
|
|
790
|
+
disabled: a > n,
|
|
791
|
+
children: `${t.level} ${a} ${"★".repeat(d)}`
|
|
1053
792
|
},
|
|
1054
|
-
`level-${
|
|
793
|
+
`level-${a}`
|
|
1055
794
|
))
|
|
1056
795
|
}
|
|
1057
796
|
) });
|
|
1058
|
-
},
|
|
1059
|
-
isOpen:
|
|
1060
|
-
title:
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
797
|
+
}, K = ({
|
|
798
|
+
isOpen: t,
|
|
799
|
+
title: e,
|
|
800
|
+
className: o = "",
|
|
801
|
+
message: n,
|
|
802
|
+
children: i,
|
|
803
|
+
noConfirm: r = !1,
|
|
804
|
+
noCancel: s = !1,
|
|
805
|
+
confirmText: l = "OK",
|
|
806
|
+
cancelText: c = "Cancel",
|
|
1067
807
|
onConfirm: a,
|
|
1068
|
-
onCancel:
|
|
808
|
+
onCancel: d
|
|
1069
809
|
}) => {
|
|
1070
|
-
const
|
|
1071
|
-
return
|
|
1072
|
-
const
|
|
1073
|
-
h.key === "Escape" &&
|
|
810
|
+
const u = U(null);
|
|
811
|
+
return E(() => {
|
|
812
|
+
const _ = (h) => {
|
|
813
|
+
h.key === "Escape" && d?.();
|
|
1074
814
|
};
|
|
1075
|
-
return
|
|
1076
|
-
document.removeEventListener("keydown",
|
|
815
|
+
return t && document.addEventListener("keydown", _), () => {
|
|
816
|
+
document.removeEventListener("keydown", _);
|
|
1077
817
|
};
|
|
1078
|
-
}, [
|
|
818
|
+
}, [t, d]), /* @__PURE__ */ f(
|
|
1079
819
|
"div",
|
|
1080
820
|
{
|
|
1081
|
-
className: `maze-dialog-overlay ${
|
|
1082
|
-
children: /* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */
|
|
1084
|
-
/* @__PURE__ */
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
!
|
|
1087
|
-
|
|
821
|
+
className: `maze-dialog-overlay ${t ? "maze-dialog-visible" : ""}`,
|
|
822
|
+
children: /* @__PURE__ */ f("div", { className: "maze-dialog " + o, ref: u, children: [
|
|
823
|
+
/* @__PURE__ */ f("div", { className: "maze-dialog-title", children: e }),
|
|
824
|
+
/* @__PURE__ */ f("div", { className: "maze-dialog-content", children: i || /* @__PURE__ */ f("div", { className: "maze-dialog-message", children: n }) }),
|
|
825
|
+
(!s || !r) && /* @__PURE__ */ f("div", { className: "maze-dialog-buttons", children: [
|
|
826
|
+
!s && /* @__PURE__ */ f(
|
|
827
|
+
"button",
|
|
828
|
+
{
|
|
829
|
+
type: "button",
|
|
830
|
+
className: "maze-dialog-cancel",
|
|
831
|
+
onClick: d,
|
|
832
|
+
children: c
|
|
833
|
+
}
|
|
834
|
+
),
|
|
835
|
+
!r && /* @__PURE__ */ f(
|
|
836
|
+
"button",
|
|
837
|
+
{
|
|
838
|
+
type: "button",
|
|
839
|
+
className: "maze-dialog-confirm",
|
|
840
|
+
onClick: a,
|
|
841
|
+
children: l
|
|
842
|
+
}
|
|
843
|
+
)
|
|
1088
844
|
] })
|
|
1089
845
|
] })
|
|
1090
846
|
}
|
|
1091
847
|
);
|
|
1092
848
|
};
|
|
1093
|
-
function
|
|
849
|
+
function Kt(t) {
|
|
1094
850
|
return function() {
|
|
1095
|
-
let
|
|
1096
|
-
return
|
|
851
|
+
let e = t += 1831565813;
|
|
852
|
+
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
1097
853
|
};
|
|
1098
854
|
}
|
|
1099
|
-
const
|
|
855
|
+
const ge = [
|
|
1100
856
|
// Tier 1 (Levels 1-12) - Beginner
|
|
1101
857
|
[
|
|
1102
|
-
{ size: 8, seed: 12345, method: "backtracking" },
|
|
858
|
+
{ size: 8, seed: 12345, method: "backtracking", wallWidth: 4 },
|
|
1103
859
|
// Level 1 - Very easy, small maze
|
|
1104
860
|
{ size: 8, seed: 23456, method: "backtracking" },
|
|
1105
861
|
// Level 2 - Very easy
|
|
@@ -1232,14 +988,11 @@ const ye = [
|
|
|
1232
988
|
{ size: 68, seed: 33341, method: "backtracking" }
|
|
1233
989
|
// Level 60 - Master
|
|
1234
990
|
]
|
|
1235
|
-
],
|
|
991
|
+
], Z = {
|
|
1236
992
|
lcPrefix: "maze-",
|
|
1237
993
|
i18n: {
|
|
1238
994
|
reset: "Reset",
|
|
1239
995
|
resetTip: "Reset all game data and highest score.",
|
|
1240
|
-
total: "Total",
|
|
1241
|
-
levelScore: "Level Score",
|
|
1242
|
-
bestScore: "Best Score",
|
|
1243
996
|
confirmReset: "Confirm Reset",
|
|
1244
997
|
confirmResetMessage: "Are you sure you want to reset the game? All progress will be lost.",
|
|
1245
998
|
cancel: "Cancel",
|
|
@@ -1247,28 +1000,39 @@ const ye = [
|
|
|
1247
1000
|
confirm: "Confirm",
|
|
1248
1001
|
resetDoneToast: "Game reset! Starting from Level 1...",
|
|
1249
1002
|
confirmClue: "Confirm to turn on clue?",
|
|
1250
|
-
confirmClueMessage: "Are you sure you want to turn on clue? Your
|
|
1003
|
+
confirmClueMessage: "Are you sure you want to turn on clue? Your will lose 1 ★.",
|
|
1251
1004
|
level: "Level",
|
|
1252
1005
|
tier: "Tier",
|
|
1253
1006
|
settings: "Settings",
|
|
1254
1007
|
clueOn: "Clue: ON",
|
|
1255
1008
|
clueOff: "Clue: OFF",
|
|
1256
|
-
clueTip: "Turn on clue will halve your current score in this level",
|
|
1257
1009
|
foodCollectedToast: "Food collected! %NUM% remaining.",
|
|
1258
1010
|
allFoodCollectedToast: "All food collected! Head to the exit.",
|
|
1259
|
-
|
|
1011
|
+
congratulations: "Congratulations!",
|
|
1012
|
+
findYourExit: "Find your exit!",
|
|
1013
|
+
withoutClue: "Without clue!",
|
|
1014
|
+
withClue: "You used the clue!",
|
|
1015
|
+
collectAllStars: "Collect all stars!",
|
|
1016
|
+
notCollectAllStars: "Not collect all stars.",
|
|
1017
|
+
nextLevel: "Next Level ➤",
|
|
1018
|
+
retry: "Retry",
|
|
1019
|
+
levelComplete: "Level Complete",
|
|
1020
|
+
starsCollected: "Stars Collected",
|
|
1021
|
+
avgStarPerLevel: "Avg. Stars per Level",
|
|
1260
1022
|
levelCompleteToast: "Level completed! 🎉",
|
|
1261
1023
|
tierUnlockedToast: "Tier %TIER% unlocked! 🎉",
|
|
1262
1024
|
levelGoToast: "Level %LEVEL% - Go!",
|
|
1263
1025
|
levelRestartToast: "Level restarted",
|
|
1026
|
+
allLevelsCompleted: "You completed all levels!",
|
|
1027
|
+
continueMessage: "You haven't collected all stars. You can click 'Continue' button to collect all stars.",
|
|
1028
|
+
continue: "Continue",
|
|
1264
1029
|
cluePathEnabled: "Clue Path Enabled",
|
|
1265
1030
|
cluePathDisabled: "Clue Path Disabled",
|
|
1266
1031
|
useArrowKeyTips: "Use arrow keys to navigate the maze. Press'C' to toggle path clue."
|
|
1267
1032
|
},
|
|
1268
1033
|
renderConfig: {
|
|
1269
1034
|
padding: 10,
|
|
1270
|
-
wallWidth:
|
|
1271
|
-
minWallWidth: 1,
|
|
1035
|
+
wallWidth: 2,
|
|
1272
1036
|
wallColor: "#000000",
|
|
1273
1037
|
exitColor: "#F44336",
|
|
1274
1038
|
foodColor: "#4CAF50",
|
|
@@ -1277,42 +1041,41 @@ const ye = [
|
|
|
1277
1041
|
playerColor: "#4CAF50",
|
|
1278
1042
|
playerAtExitColor: "#FFD700"
|
|
1279
1043
|
},
|
|
1280
|
-
levelConfig:
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
class Ro {
|
|
1044
|
+
levelConfig: ge
|
|
1045
|
+
}, Zt = (t) => t === 1 ? 2 : t >= 2 && t <= 5 ? 3 : t >= 6 && t <= 11 ? 4 : t >= 12 && t <= 15 ? 5 : 6;
|
|
1046
|
+
class Qt {
|
|
1284
1047
|
// initially all walls exit
|
|
1285
|
-
constructor(
|
|
1286
|
-
this.row =
|
|
1048
|
+
constructor(e, o) {
|
|
1049
|
+
this.row = e, this.col = o;
|
|
1287
1050
|
}
|
|
1288
1051
|
visited = !1;
|
|
1289
1052
|
walls = { top: !0, right: !0, bottom: !0, left: !0 };
|
|
1290
1053
|
}
|
|
1291
|
-
class
|
|
1054
|
+
class eo {
|
|
1292
1055
|
rows;
|
|
1293
1056
|
cols;
|
|
1294
1057
|
grid;
|
|
1295
1058
|
seed;
|
|
1296
1059
|
random;
|
|
1297
|
-
constructor(
|
|
1298
|
-
this.rows =
|
|
1060
|
+
constructor(e, o, n) {
|
|
1061
|
+
this.rows = e, this.cols = o, this.seed = n ?? Math.floor(Math.random() * 1e6), this.random = Kt(this.seed), this.grid = this.initializeGrid();
|
|
1299
1062
|
}
|
|
1300
1063
|
// Initialize the grid with new MazeCell objects
|
|
1301
1064
|
initializeGrid() {
|
|
1302
|
-
const
|
|
1065
|
+
const e = [];
|
|
1303
1066
|
for (let o = 0; o < this.rows; o++) {
|
|
1304
|
-
|
|
1067
|
+
e[o] = [];
|
|
1305
1068
|
for (let n = 0; n < this.cols; n++)
|
|
1306
|
-
|
|
1069
|
+
e[o][n] = new Qt(o, n);
|
|
1307
1070
|
}
|
|
1308
|
-
return
|
|
1071
|
+
return e;
|
|
1309
1072
|
}
|
|
1310
1073
|
// Check if coordinates are within the grid boundaries
|
|
1311
|
-
isValid(
|
|
1312
|
-
return
|
|
1074
|
+
isValid(e, o) {
|
|
1075
|
+
return e >= 0 && e < this.rows && o >= 0 && o < this.cols;
|
|
1313
1076
|
}
|
|
1314
1077
|
// Get all valid neighbors (top, right, bottom, left)
|
|
1315
|
-
getNeighbors(
|
|
1078
|
+
getNeighbors(e, o) {
|
|
1316
1079
|
const n = [], i = [
|
|
1317
1080
|
{ r: -1, c: 0 },
|
|
1318
1081
|
// Top
|
|
@@ -1324,35 +1087,35 @@ class $o {
|
|
|
1324
1087
|
// Left
|
|
1325
1088
|
];
|
|
1326
1089
|
for (const r of i) {
|
|
1327
|
-
const s =
|
|
1090
|
+
const s = e + r.r, l = o + r.c;
|
|
1328
1091
|
this.isValid(s, l) && n.push({ row: s, col: l });
|
|
1329
1092
|
}
|
|
1330
1093
|
return n;
|
|
1331
1094
|
}
|
|
1332
1095
|
// Get only neighbors that haven't been visited yet
|
|
1333
|
-
getUnvisitedNeighbors(
|
|
1334
|
-
return this.getNeighbors(
|
|
1096
|
+
getUnvisitedNeighbors(e, o) {
|
|
1097
|
+
return this.getNeighbors(e, o).filter(
|
|
1335
1098
|
(n) => !this.grid[n.row][n.col].visited
|
|
1336
1099
|
);
|
|
1337
1100
|
}
|
|
1338
1101
|
/**
|
|
1339
1102
|
* Gets neighbors that have already been visited (part of the maze path).
|
|
1340
1103
|
*/
|
|
1341
|
-
getVisitedNeighbors(
|
|
1342
|
-
return this.getNeighbors(
|
|
1104
|
+
getVisitedNeighbors(e, o) {
|
|
1105
|
+
return this.getNeighbors(e, o).filter(
|
|
1343
1106
|
(n) => this.grid[n.row][n.col].visited
|
|
1344
1107
|
);
|
|
1345
1108
|
}
|
|
1346
1109
|
// Remove the wall between two adjacent cells
|
|
1347
|
-
removeWall(
|
|
1348
|
-
const r = this.grid[
|
|
1349
|
-
|
|
1110
|
+
removeWall(e, o, n, i) {
|
|
1111
|
+
const r = this.grid[e][o], s = this.grid[n][i];
|
|
1112
|
+
e === n + 1 ? (r.walls.top = !1, s.walls.bottom = !1) : e === n - 1 ? (r.walls.bottom = !1, s.walls.top = !1) : o === i + 1 ? (r.walls.left = !1, s.walls.right = !1) : o === i - 1 && (r.walls.right = !1, s.walls.left = !1);
|
|
1350
1113
|
}
|
|
1351
1114
|
}
|
|
1352
|
-
class
|
|
1115
|
+
class to {
|
|
1353
1116
|
maze;
|
|
1354
|
-
constructor(
|
|
1355
|
-
switch (this.maze = new
|
|
1117
|
+
constructor(e, o, n, i, r = { row: 0, col: 0 }, s = { row: e - 1, col: o - 1 }) {
|
|
1118
|
+
switch (this.maze = new eo(e, o, i), n) {
|
|
1356
1119
|
case "backtracking":
|
|
1357
1120
|
this.runBacktracking();
|
|
1358
1121
|
break;
|
|
@@ -1372,744 +1135,750 @@ class Fo {
|
|
|
1372
1135
|
}
|
|
1373
1136
|
// --- Backtracking Algorithm Implementation ---
|
|
1374
1137
|
runBacktracking() {
|
|
1375
|
-
const
|
|
1138
|
+
const e = [], o = this.randomNumber(this.maze.rows), n = this.randomNumber(this.maze.cols);
|
|
1376
1139
|
let i = { row: o, col: n };
|
|
1377
|
-
for (this.maze.grid[o][n].visited = !0,
|
|
1378
|
-
i =
|
|
1140
|
+
for (this.maze.grid[o][n].visited = !0, e.push(i); e.length > 0; ) {
|
|
1141
|
+
i = e[e.length - 1];
|
|
1379
1142
|
const { row: r, col: s } = i, l = this.maze.getUnvisitedNeighbors(r, s);
|
|
1380
1143
|
if (l.length > 0) {
|
|
1381
|
-
const
|
|
1382
|
-
this.maze.removeWall(r, s,
|
|
1144
|
+
const c = this.randomPick(l), { row: a, col: d } = c;
|
|
1145
|
+
this.maze.removeWall(r, s, a, d), this.maze.grid[a][d].visited = !0, e.push(c);
|
|
1383
1146
|
} else
|
|
1384
|
-
|
|
1147
|
+
e.pop();
|
|
1385
1148
|
}
|
|
1386
1149
|
}
|
|
1387
1150
|
// --- Prim's Algorithm Implementation ---
|
|
1388
1151
|
runPrims() {
|
|
1389
|
-
const
|
|
1152
|
+
const e = [], o = (r, s) => {
|
|
1390
1153
|
const l = this.maze.getNeighbors(r, s);
|
|
1391
|
-
for (const
|
|
1392
|
-
!this.maze.grid[
|
|
1393
|
-
(
|
|
1394
|
-
) &&
|
|
1154
|
+
for (const c of l)
|
|
1155
|
+
!this.maze.grid[c.row][c.col].visited && !e.some(
|
|
1156
|
+
(a) => a.row === c.row && a.col === c.col
|
|
1157
|
+
) && e.push(c);
|
|
1395
1158
|
}, n = this.randomNumber(this.maze.rows), i = this.randomNumber(this.maze.cols);
|
|
1396
|
-
for (this.maze.grid[n][i].visited = !0, o(n, i);
|
|
1397
|
-
const r = this.randomNumber(
|
|
1398
|
-
if (
|
|
1399
|
-
const
|
|
1400
|
-
this.maze.removeWall(l,
|
|
1159
|
+
for (this.maze.grid[n][i].visited = !0, o(n, i); e.length > 0; ) {
|
|
1160
|
+
const r = this.randomNumber(e.length), s = e[r], { row: l, col: c } = s, a = this.maze.getVisitedNeighbors(l, c);
|
|
1161
|
+
if (a.length > 0) {
|
|
1162
|
+
const d = this.randomPick(a);
|
|
1163
|
+
this.maze.removeWall(l, c, d.row, d.col), this.maze.grid[l][c].visited = !0, o(l, c);
|
|
1401
1164
|
}
|
|
1402
|
-
|
|
1165
|
+
e.splice(r, 1);
|
|
1403
1166
|
}
|
|
1404
1167
|
}
|
|
1405
1168
|
// --- Helper ---
|
|
1406
|
-
addOpenings(
|
|
1407
|
-
this.maze.grid[
|
|
1169
|
+
addOpenings(e, o) {
|
|
1170
|
+
this.maze.grid[e.row][e.col].walls.top = !1, this.maze.grid[o.row][o.col].walls.bottom = !1;
|
|
1408
1171
|
}
|
|
1409
1172
|
// random number
|
|
1410
|
-
randomNumber(
|
|
1411
|
-
return Math.floor(this.maze.random() *
|
|
1173
|
+
randomNumber(e) {
|
|
1174
|
+
return Math.floor(this.maze.random() * e);
|
|
1412
1175
|
}
|
|
1413
1176
|
// Randomly pick an item from a list
|
|
1414
|
-
randomPick(
|
|
1415
|
-
return
|
|
1177
|
+
randomPick(e) {
|
|
1178
|
+
return e[Math.floor(this.maze.random() * e.length)];
|
|
1416
1179
|
}
|
|
1417
1180
|
}
|
|
1418
|
-
function
|
|
1419
|
-
return new
|
|
1181
|
+
function oo(t, e, o, n, i, r) {
|
|
1182
|
+
return new to(t, e, o, n, i, r).getMaze();
|
|
1420
1183
|
}
|
|
1421
|
-
const
|
|
1422
|
-
if (!
|
|
1423
|
-
const n =
|
|
1184
|
+
const no = (t, e, o) => {
|
|
1185
|
+
if (!t.isValid(e, o)) return !1;
|
|
1186
|
+
const n = t.grid[e][o];
|
|
1424
1187
|
return !n.walls.top || !n.walls.right || !n.walls.bottom || !n.walls.left;
|
|
1425
|
-
},
|
|
1426
|
-
const o =
|
|
1188
|
+
}, et = (t, e = ge.flat()) => {
|
|
1189
|
+
const o = t - 1, n = e[o];
|
|
1427
1190
|
if (!n)
|
|
1428
|
-
return console.error(`Cannot find Level ${
|
|
1429
|
-
const i = n.size, r = i, s = i, l = n.seed,
|
|
1191
|
+
return console.error(`Cannot find Level ${t}'s config.`), null;
|
|
1192
|
+
const i = n.size, r = i, s = i, l = n.seed, c = n.method, a = n.entry || { row: 0, col: 0 }, d = n.exit || {
|
|
1430
1193
|
row: r - 1,
|
|
1431
1194
|
col: s - 1
|
|
1432
|
-
}, u =
|
|
1433
|
-
for (let
|
|
1195
|
+
}, u = oo(r, s, c, l, a, d), _ = Zt(t), h = [];
|
|
1196
|
+
for (let v = 0; v < _; v++) {
|
|
1434
1197
|
let g;
|
|
1435
1198
|
do
|
|
1436
1199
|
g = {
|
|
1437
1200
|
row: Math.floor(u.random() * r),
|
|
1438
1201
|
col: Math.floor(u.random() * s)
|
|
1439
1202
|
};
|
|
1440
|
-
while (g.row ===
|
|
1441
|
-
(
|
|
1203
|
+
while (g.row === a.row && g.col === a.col || g.row === d.row && g.col === d.col || !no(u, g.row, g.col) || h.some(
|
|
1204
|
+
(p) => p.row === g.row && p.col === g.col
|
|
1442
1205
|
));
|
|
1443
|
-
|
|
1206
|
+
h.push(g);
|
|
1444
1207
|
}
|
|
1445
1208
|
return {
|
|
1446
1209
|
maze: u,
|
|
1447
|
-
playerPosition:
|
|
1448
|
-
exitPosition:
|
|
1449
|
-
foodPositions:
|
|
1450
|
-
totalFoodCount:
|
|
1210
|
+
playerPosition: a,
|
|
1211
|
+
exitPosition: d,
|
|
1212
|
+
foodPositions: h,
|
|
1213
|
+
totalFoodCount: _,
|
|
1451
1214
|
foodCollected: 0,
|
|
1452
|
-
playerPath: [
|
|
1453
|
-
visitCounts: { [`${
|
|
1454
|
-
|
|
1455
|
-
|
|
1215
|
+
playerPath: [a],
|
|
1216
|
+
visitCounts: { [`${a.row},${a.col}`]: 1 },
|
|
1217
|
+
currentScore: {
|
|
1218
|
+
atExit: !1,
|
|
1219
|
+
allFood: !1,
|
|
1220
|
+
noClue: !0
|
|
1221
|
+
},
|
|
1456
1222
|
playerAtExit: !1,
|
|
1457
1223
|
isGameActive: !0,
|
|
1458
1224
|
levelTransitioning: !1
|
|
1459
1225
|
};
|
|
1460
|
-
},
|
|
1461
|
-
gameState:
|
|
1462
|
-
setGameState:
|
|
1226
|
+
}, tt = ({
|
|
1227
|
+
gameState: t,
|
|
1228
|
+
setGameState: e,
|
|
1463
1229
|
config: o
|
|
1464
1230
|
}) => ({
|
|
1465
1231
|
generateCurrentLevelMaze: () => {
|
|
1466
|
-
const i =
|
|
1467
|
-
|
|
1232
|
+
const i = et(
|
|
1233
|
+
t.currentLevel,
|
|
1234
|
+
o.levelConfig.flat()
|
|
1235
|
+
);
|
|
1236
|
+
i && e((r) => ({
|
|
1468
1237
|
...r,
|
|
1469
1238
|
...i
|
|
1470
1239
|
}));
|
|
1471
1240
|
}
|
|
1472
|
-
}),
|
|
1473
|
-
const
|
|
1241
|
+
}), ot = (t) => W(() => {
|
|
1242
|
+
const e = t.map((l) => l.length), o = e.reduce((l, c) => l + c, 0), n = t.length, i = (l) => {
|
|
1474
1243
|
if (l < 1 || l > o) return 0;
|
|
1475
|
-
let
|
|
1476
|
-
for (let
|
|
1477
|
-
if (
|
|
1244
|
+
let c = 0;
|
|
1245
|
+
for (let a = 0; a < e.length; a++)
|
|
1246
|
+
if (c += e[a], l <= c) return a + 1;
|
|
1478
1247
|
return 0;
|
|
1479
|
-
}, r = (l) => l < 1 || l > n ? 0 :
|
|
1248
|
+
}, r = (l) => l < 1 || l > n ? 0 : e.slice(0, l - 1).reduce((c, a) => c + a, 0) + 1, s = {
|
|
1480
1249
|
getTotalLevels: () => o,
|
|
1481
1250
|
getTotalTiers: () => n,
|
|
1482
1251
|
getTierLevelsRange: (l) => {
|
|
1483
1252
|
if (l < 1 || l > n) return [0, 0];
|
|
1484
|
-
const
|
|
1485
|
-
return [
|
|
1253
|
+
const c = r(l), a = c + e[l - 1] - 1;
|
|
1254
|
+
return [c, a];
|
|
1486
1255
|
},
|
|
1487
1256
|
getTierByLevel: i,
|
|
1488
1257
|
getFirstLevelOfTier: r,
|
|
1489
1258
|
getLevelConfig: (l) => {
|
|
1490
1259
|
if (l < 1 || l > o) return null;
|
|
1491
|
-
const
|
|
1492
|
-
return
|
|
1260
|
+
const c = i(l), a = r(c), d = l - a;
|
|
1261
|
+
return t[c - 1][d];
|
|
1493
1262
|
},
|
|
1494
|
-
getTierConfig: (l) => l < 1 || l > n ? null :
|
|
1495
|
-
isLevelUnlocked: (l,
|
|
1496
|
-
isTierUnlocked: (l,
|
|
1263
|
+
getTierConfig: (l) => l < 1 || l > n ? null : t[l - 1],
|
|
1264
|
+
isLevelUnlocked: (l, c) => l <= c,
|
|
1265
|
+
isTierUnlocked: (l, c) => l <= c,
|
|
1497
1266
|
getNextLevelInfo: (l) => {
|
|
1498
1267
|
if (l >= o) return null;
|
|
1499
|
-
const
|
|
1268
|
+
const c = l + 1, a = i(l), d = i(c);
|
|
1500
1269
|
return {
|
|
1501
|
-
nextLevel:
|
|
1502
|
-
nextTier:
|
|
1503
|
-
isTierChange:
|
|
1270
|
+
nextLevel: c,
|
|
1271
|
+
nextTier: d,
|
|
1272
|
+
isTierChange: d > a
|
|
1504
1273
|
};
|
|
1505
1274
|
},
|
|
1506
|
-
getCurrentTierProgress: (l,
|
|
1507
|
-
const [
|
|
1508
|
-
return { current: u, total:
|
|
1275
|
+
getCurrentTierProgress: (l, c) => {
|
|
1276
|
+
const [a, d] = s.getTierLevelsRange(c), u = l - a + 1, _ = d - a + 1;
|
|
1277
|
+
return { current: u, total: _ };
|
|
1509
1278
|
},
|
|
1510
1279
|
isLastLevelInTier: (l) => {
|
|
1511
|
-
const
|
|
1512
|
-
return l ===
|
|
1280
|
+
const c = i(l), [, a] = s.getTierLevelsRange(c);
|
|
1281
|
+
return l === a;
|
|
1513
1282
|
},
|
|
1514
1283
|
getPreviousLevelInfo: (l) => {
|
|
1515
1284
|
if (l <= 1) return null;
|
|
1516
|
-
const
|
|
1285
|
+
const c = l - 1, a = i(l), d = i(c);
|
|
1517
1286
|
return {
|
|
1518
|
-
prevLevel:
|
|
1519
|
-
prevTier:
|
|
1520
|
-
isTierChange:
|
|
1287
|
+
prevLevel: c,
|
|
1288
|
+
prevTier: d,
|
|
1289
|
+
isTierChange: d < a
|
|
1521
1290
|
};
|
|
1522
1291
|
}
|
|
1523
1292
|
};
|
|
1524
1293
|
return s;
|
|
1525
|
-
}, [
|
|
1526
|
-
const { gameState:
|
|
1527
|
-
|
|
1528
|
-
|
|
1294
|
+
}, [t]), io = () => {
|
|
1295
|
+
const { gameState: t, setGameState: e, resetGame: o, config: n } = _e(), i = n.i18n, r = n.levelConfig, s = ot(r), { showToast: l } = ve(), {
|
|
1296
|
+
totalScore: c,
|
|
1297
|
+
showClue: a,
|
|
1298
|
+
currentTier: d,
|
|
1299
|
+
currentLevel: u,
|
|
1300
|
+
highestUnlockedTier: _,
|
|
1301
|
+
highestUnlockedLevel: h,
|
|
1302
|
+
levelTransitioning: v
|
|
1303
|
+
} = t, g = s.getTotalLevels(), p = s.getTotalTiers(), [m, C] = I(!1), [P, k] = I(!1), [N, b] = I(!1), [T, M] = I(s.getTierLevelsRange(1)), { generateCurrentLevelMaze: x } = tt({
|
|
1304
|
+
gameState: t,
|
|
1305
|
+
setGameState: e,
|
|
1529
1306
|
config: n
|
|
1530
1307
|
});
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
s.isLevelUnlocked(
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
)
|
|
1542
|
-
|
|
1543
|
-
s.isLevelUnlocked(L, e.highestUnlockedLevel) && (t((Y) => ({
|
|
1544
|
-
...Y,
|
|
1545
|
-
currentLevel: L
|
|
1546
|
-
})), F(), l(
|
|
1547
|
-
i.levelGoToast.replace("%LEVEL%", L.toString()),
|
|
1308
|
+
E(() => {
|
|
1309
|
+
M(s.getTierLevelsRange(d));
|
|
1310
|
+
}, [d]);
|
|
1311
|
+
const O = (S) => {
|
|
1312
|
+
const q = s.getFirstLevelOfTier(S);
|
|
1313
|
+
s.isLevelUnlocked(q, h) && (e((ut) => ({ ...ut, currentTier: S })), L(q));
|
|
1314
|
+
}, L = (S) => {
|
|
1315
|
+
s.isLevelUnlocked(S, h) && (e((q) => ({
|
|
1316
|
+
...q,
|
|
1317
|
+
currentLevel: S
|
|
1318
|
+
})), x(), l(
|
|
1319
|
+
i.levelGoToast.replace("%LEVEL%", S.toString()),
|
|
1548
1320
|
"success"
|
|
1549
1321
|
));
|
|
1550
|
-
},
|
|
1551
|
-
|
|
1552
|
-
},
|
|
1553
|
-
|
|
1554
|
-
},
|
|
1322
|
+
}, R = () => {
|
|
1323
|
+
C(!0);
|
|
1324
|
+
}, nt = () => {
|
|
1325
|
+
C(!1);
|
|
1326
|
+
}, it = () => {
|
|
1327
|
+
b(!0);
|
|
1328
|
+
}, rt = () => {
|
|
1329
|
+
b(!1);
|
|
1330
|
+
}, st = () => {
|
|
1331
|
+
e((S) => (l(S.showClue ? i.cluePathDisabled : i.cluePathEnabled), {
|
|
1332
|
+
...S,
|
|
1333
|
+
currentScore: {
|
|
1334
|
+
...S.currentScore,
|
|
1335
|
+
noClue: S.showClue
|
|
1336
|
+
},
|
|
1337
|
+
showClue: !S.showClue
|
|
1338
|
+
})), b(!1);
|
|
1339
|
+
}, lt = () => {
|
|
1555
1340
|
k(!0);
|
|
1556
|
-
},
|
|
1341
|
+
}, at = () => {
|
|
1342
|
+
o(), k(!1), l(i.resetDoneToast);
|
|
1343
|
+
}, ct = () => {
|
|
1557
1344
|
k(!1);
|
|
1558
|
-
}, kt = () => {
|
|
1559
|
-
t((L) => (l(L.showClue ? i.cluePathDisabled : i.cluePathEnabled), {
|
|
1560
|
-
...L,
|
|
1561
|
-
showClue: !L.showClue,
|
|
1562
|
-
currentScore: Math.floor(L.currentScore / 2)
|
|
1563
|
-
// half the current score
|
|
1564
|
-
})), k(!1);
|
|
1565
|
-
}, Tt = () => {
|
|
1566
|
-
p(!0);
|
|
1567
|
-
}, zt = () => {
|
|
1568
|
-
o(), p(!1), l(i.resetDoneToast);
|
|
1569
|
-
}, Pt = () => {
|
|
1570
|
-
p(!1);
|
|
1571
1345
|
};
|
|
1572
|
-
return /* @__PURE__ */
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
|
|
1346
|
+
return /* @__PURE__ */ f("div", { class: "game-panel-container", children: [
|
|
1347
|
+
/* @__PURE__ */ f("div", { className: "game-controls", children: [
|
|
1348
|
+
/* @__PURE__ */ f("div", { className: "selectors-container", children: [
|
|
1349
|
+
/* @__PURE__ */ f(
|
|
1350
|
+
Xt,
|
|
1577
1351
|
{
|
|
1578
1352
|
i18n: i,
|
|
1579
|
-
totalTiers:
|
|
1580
|
-
currentTier:
|
|
1581
|
-
highestUnlockedTier:
|
|
1582
|
-
onTierChange:
|
|
1583
|
-
disabled:
|
|
1353
|
+
totalTiers: p,
|
|
1354
|
+
currentTier: d,
|
|
1355
|
+
highestUnlockedTier: _,
|
|
1356
|
+
onTierChange: O,
|
|
1357
|
+
disabled: v
|
|
1584
1358
|
}
|
|
1585
1359
|
),
|
|
1586
|
-
/* @__PURE__ */
|
|
1587
|
-
|
|
1360
|
+
/* @__PURE__ */ f(
|
|
1361
|
+
Jt,
|
|
1588
1362
|
{
|
|
1589
1363
|
i18n: i,
|
|
1590
|
-
levelsRange:
|
|
1591
|
-
currentLevel:
|
|
1592
|
-
highestUnlockedLevel:
|
|
1593
|
-
onLevelChange:
|
|
1594
|
-
disabled:
|
|
1364
|
+
levelsRange: T,
|
|
1365
|
+
currentLevel: u,
|
|
1366
|
+
highestUnlockedLevel: h,
|
|
1367
|
+
onLevelChange: L,
|
|
1368
|
+
disabled: v
|
|
1595
1369
|
}
|
|
1596
1370
|
)
|
|
1597
1371
|
] }),
|
|
1598
|
-
/* @__PURE__ */
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
i.bestScore,
|
|
1609
|
-
":"
|
|
1610
|
-
] }),
|
|
1611
|
-
/* @__PURE__ */ m("span", { className: "score-data", children: d })
|
|
1612
|
-
] }),
|
|
1613
|
-
/* @__PURE__ */ m("div", { className: "score-box totalscore", children: [
|
|
1614
|
-
/* @__PURE__ */ m("span", { className: "score-label", children: [
|
|
1615
|
-
i.total,
|
|
1616
|
-
":"
|
|
1617
|
-
] }),
|
|
1618
|
-
/* @__PURE__ */ m("span", { className: "score-data", children: c })
|
|
1619
|
-
] })
|
|
1620
|
-
] })
|
|
1372
|
+
/* @__PURE__ */ f(
|
|
1373
|
+
"button",
|
|
1374
|
+
{
|
|
1375
|
+
className: `settings-clue-button ${a ? "clue-on" : "clue-off"}`,
|
|
1376
|
+
disabled: a,
|
|
1377
|
+
title: "Toggle Clue",
|
|
1378
|
+
onClick: it,
|
|
1379
|
+
children: a ? i.clueOn : i.clueOff
|
|
1380
|
+
}
|
|
1381
|
+
)
|
|
1621
1382
|
] }),
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
|
|
1383
|
+
/* @__PURE__ */ f("div", { className: "game-settings", children: /* @__PURE__ */ f("span", { className: "game-settings-icon", onClick: R, children: "★ " + c }) }),
|
|
1384
|
+
/* @__PURE__ */ f(
|
|
1385
|
+
K,
|
|
1624
1386
|
{
|
|
1625
|
-
|
|
1626
|
-
className: "game-settings-icon"
|
|
1627
|
-
}
|
|
1628
|
-
) }),
|
|
1629
|
-
/* @__PURE__ */ m(
|
|
1630
|
-
le,
|
|
1631
|
-
{
|
|
1632
|
-
isOpen: g,
|
|
1387
|
+
isOpen: m,
|
|
1633
1388
|
title: i.settings,
|
|
1634
1389
|
noConfirm: !0,
|
|
1635
1390
|
cancelText: i.close,
|
|
1636
|
-
onCancel:
|
|
1391
|
+
onCancel: nt,
|
|
1637
1392
|
children: [
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
|
|
1642
|
-
{
|
|
1643
|
-
className: `settings-clue-button ${h ? "clue-on" : "clue-off"}`,
|
|
1644
|
-
disabled: h,
|
|
1645
|
-
title: "Toggle Clue",
|
|
1646
|
-
onClick: U,
|
|
1647
|
-
children: h ? i.clueOn : i.clueOff
|
|
1648
|
-
}
|
|
1649
|
-
),
|
|
1650
|
-
/* @__PURE__ */ m("div", { className: "settings-item-tip", children: i.clueTip })
|
|
1393
|
+
/* @__PURE__ */ f("div", { className: "settings-stats", children: [
|
|
1394
|
+
/* @__PURE__ */ f("div", { children: i.levelComplete + `: ${h}/${g}` }),
|
|
1395
|
+
/* @__PURE__ */ f("div", { children: i.starsCollected + ": " + c }),
|
|
1396
|
+
/* @__PURE__ */ f("div", { children: i.avgStarPerLevel + ": " + (c / h).toFixed(2) })
|
|
1651
1397
|
] }),
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1398
|
+
/* @__PURE__ */ f("div", { className: "settings-item-box", children: [
|
|
1399
|
+
/* @__PURE__ */ f(
|
|
1654
1400
|
"button",
|
|
1655
1401
|
{
|
|
1656
1402
|
className: "settings-reset-button",
|
|
1657
1403
|
title: "Reset Game",
|
|
1658
|
-
onClick:
|
|
1404
|
+
onClick: lt,
|
|
1659
1405
|
children: i.reset
|
|
1660
1406
|
}
|
|
1661
1407
|
),
|
|
1662
|
-
/* @__PURE__ */
|
|
1408
|
+
/* @__PURE__ */ f("div", { className: "settings-item-tip", children: i.resetTip })
|
|
1663
1409
|
] })
|
|
1664
1410
|
]
|
|
1665
1411
|
}
|
|
1666
1412
|
),
|
|
1667
|
-
/* @__PURE__ */
|
|
1668
|
-
|
|
1413
|
+
/* @__PURE__ */ f(
|
|
1414
|
+
K,
|
|
1669
1415
|
{
|
|
1670
|
-
isOpen:
|
|
1416
|
+
isOpen: P,
|
|
1671
1417
|
title: i.confirmReset,
|
|
1672
1418
|
message: i.confirmResetMessage,
|
|
1673
1419
|
confirmText: i.reset,
|
|
1674
1420
|
cancelText: i.cancel,
|
|
1675
|
-
onConfirm:
|
|
1676
|
-
onCancel:
|
|
1421
|
+
onConfirm: at,
|
|
1422
|
+
onCancel: ct
|
|
1677
1423
|
}
|
|
1678
1424
|
),
|
|
1679
|
-
/* @__PURE__ */
|
|
1680
|
-
|
|
1425
|
+
/* @__PURE__ */ f(
|
|
1426
|
+
K,
|
|
1681
1427
|
{
|
|
1682
|
-
isOpen:
|
|
1428
|
+
isOpen: N,
|
|
1683
1429
|
title: i.confirmClue,
|
|
1684
1430
|
message: i.confirmClueMessage,
|
|
1685
1431
|
confirmText: i.confirm,
|
|
1686
1432
|
cancelText: i.cancel,
|
|
1687
|
-
onConfirm:
|
|
1688
|
-
onCancel:
|
|
1433
|
+
onConfirm: st,
|
|
1434
|
+
onCancel: rt
|
|
1689
1435
|
}
|
|
1690
1436
|
)
|
|
1691
1437
|
] });
|
|
1692
|
-
},
|
|
1693
|
-
message:
|
|
1694
|
-
visible:
|
|
1438
|
+
}, ro = ({
|
|
1439
|
+
message: t,
|
|
1440
|
+
visible: e,
|
|
1695
1441
|
duration: o = 2e3,
|
|
1696
1442
|
onClose: n,
|
|
1697
1443
|
position: i = "center",
|
|
1698
1444
|
type: r = "info"
|
|
1699
|
-
}) =>
|
|
1445
|
+
}) => t ? (E(() => {
|
|
1700
1446
|
let s;
|
|
1701
|
-
return
|
|
1447
|
+
return e && o > 0 && n && (s = setTimeout(() => {
|
|
1702
1448
|
n();
|
|
1703
1449
|
}, o)), () => {
|
|
1704
1450
|
s && clearTimeout(s);
|
|
1705
1451
|
};
|
|
1706
|
-
}, [
|
|
1707
|
-
|
|
1452
|
+
}, [e, o, n]), /* @__PURE__ */ f("div", { className: `toast-container position-${i}`, children: /* @__PURE__ */ f("div", { className: `toast-message type-${r} ${e ? "toast-visible" : ""}`, children: t }) })) : null, so = (t, e, o) => {
|
|
1453
|
+
E(() => {
|
|
1708
1454
|
const n = () => {
|
|
1709
|
-
const i =
|
|
1455
|
+
const i = t.current;
|
|
1710
1456
|
if (!i) return;
|
|
1711
1457
|
const r = i.parentElement;
|
|
1712
1458
|
if (!r) return;
|
|
1713
1459
|
const s = r.clientWidth, l = window.devicePixelRatio || 1;
|
|
1714
|
-
i.style.width = `${s}px`, i.style.height = `${s}px`, i.width = s * l, i.height = s * l, t
|
|
1460
|
+
i.style.width = `${s}px`, i.style.height = `${s}px`, i.width = s * l, i.height = s * l, e(t, o.current);
|
|
1715
1461
|
};
|
|
1716
1462
|
return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
|
|
1717
|
-
}, [
|
|
1718
|
-
},
|
|
1463
|
+
}, [t]);
|
|
1464
|
+
}, Me = {
|
|
1719
1465
|
ArrowUp: [-1, 0],
|
|
1720
1466
|
ArrowDown: [1, 0],
|
|
1721
1467
|
ArrowLeft: [0, -1],
|
|
1722
1468
|
ArrowRight: [0, 1]
|
|
1723
|
-
},
|
|
1724
|
-
containerRef:
|
|
1725
|
-
gameState:
|
|
1469
|
+
}, lo = ({
|
|
1470
|
+
containerRef: t,
|
|
1471
|
+
gameState: e,
|
|
1726
1472
|
setGameState: o,
|
|
1727
|
-
onFoodCollected: n
|
|
1728
|
-
onFoodNotAllCollected: i
|
|
1473
|
+
onFoodCollected: n
|
|
1729
1474
|
}) => {
|
|
1730
|
-
|
|
1731
|
-
const
|
|
1732
|
-
if (!
|
|
1733
|
-
const [c,
|
|
1734
|
-
if (!
|
|
1735
|
-
const
|
|
1736
|
-
if (c === -1 &&
|
|
1475
|
+
E(() => {
|
|
1476
|
+
const i = (l) => {
|
|
1477
|
+
if (!e.isGameActive || !e.maze) return;
|
|
1478
|
+
const [c, a] = Me[l], { row: d, col: u } = e.playerPosition, _ = d + c, h = u + a;
|
|
1479
|
+
if (!e.maze.isValid(_, h)) return;
|
|
1480
|
+
const v = e.maze.grid[d][u];
|
|
1481
|
+
if (c === -1 && v.walls.top || c === 1 && v.walls.bottom || a === -1 && v.walls.left || a === 1 && v.walls.right)
|
|
1737
1482
|
return;
|
|
1738
|
-
const
|
|
1739
|
-
o((
|
|
1740
|
-
const
|
|
1741
|
-
(
|
|
1483
|
+
const g = { row: _, col: h }, p = `${_},${h}`;
|
|
1484
|
+
o((m) => {
|
|
1485
|
+
const C = m.foodPositions.some(
|
|
1486
|
+
(T) => T.row === _ && T.col === h
|
|
1742
1487
|
);
|
|
1743
|
-
|
|
1744
|
-
const k =
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
playerPath: [...p.playerPath, v],
|
|
1752
|
-
foodPositions: p.foodPositions.filter(
|
|
1753
|
-
(S) => !(S.row === d && S.col === f)
|
|
1488
|
+
C && n();
|
|
1489
|
+
const P = `${d},${u}-${_},${h}`, k = _ === m.exitPosition.row && h === m.exitPosition.col, N = C ? m.foodCollected + 1 : m.foodCollected, b = N === m.totalFoodCount;
|
|
1490
|
+
return {
|
|
1491
|
+
...m,
|
|
1492
|
+
playerPosition: g,
|
|
1493
|
+
playerPath: [...m.playerPath, g],
|
|
1494
|
+
foodPositions: m.foodPositions.filter(
|
|
1495
|
+
(T) => !(T.row === _ && T.col === h)
|
|
1754
1496
|
),
|
|
1755
|
-
foodCollected:
|
|
1756
|
-
|
|
1497
|
+
foodCollected: N,
|
|
1498
|
+
// if not complete, then just 0, if complete, then count the ⭐️ by 3 conditions
|
|
1499
|
+
currentScore: {
|
|
1500
|
+
atExit: k,
|
|
1501
|
+
allFood: b,
|
|
1502
|
+
noClue: !m.showClue
|
|
1503
|
+
},
|
|
1757
1504
|
visitCounts: {
|
|
1758
|
-
...
|
|
1759
|
-
[
|
|
1760
|
-
[
|
|
1505
|
+
...m.visitCounts,
|
|
1506
|
+
[P]: (m.visitCounts[P] || 0) + 1,
|
|
1507
|
+
[p]: (m.visitCounts[p] || 0) + 1
|
|
1761
1508
|
},
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
levelTransitioning: N
|
|
1509
|
+
playerAtExit: k,
|
|
1510
|
+
isGameActive: !k,
|
|
1511
|
+
levelTransitioning: k
|
|
1766
1512
|
};
|
|
1767
1513
|
});
|
|
1768
|
-
},
|
|
1769
|
-
if (!
|
|
1770
|
-
const c =
|
|
1771
|
-
c in
|
|
1772
|
-
},
|
|
1773
|
-
if (
|
|
1774
|
-
const c =
|
|
1775
|
-
|
|
1514
|
+
}, r = (l) => {
|
|
1515
|
+
if (!e.isGameActive || !e.maze) return;
|
|
1516
|
+
const c = l.key;
|
|
1517
|
+
c in Me && (l.preventDefault(), i(c));
|
|
1518
|
+
}, s = (l) => {
|
|
1519
|
+
if (l.preventDefault(), !e.isGameActive || !e.maze) return;
|
|
1520
|
+
const c = l.touches[0], a = document.elementFromPoint(c.clientX, c.clientY);
|
|
1521
|
+
a && (a.classList.contains("maze-up") ? i("ArrowUp") : a.classList.contains("maze-down") ? i("ArrowDown") : a.classList.contains("maze-left") ? i("ArrowLeft") : a.classList.contains("maze-right") && i("ArrowRight"));
|
|
1776
1522
|
};
|
|
1777
|
-
return window.addEventListener("keydown",
|
|
1523
|
+
return window.addEventListener("keydown", r), t.current?.addEventListener("touchstart", s, {
|
|
1778
1524
|
passive: !1
|
|
1779
1525
|
}), () => {
|
|
1780
|
-
window.removeEventListener("keydown",
|
|
1526
|
+
window.removeEventListener("keydown", r), t.current?.removeEventListener("touchstart", s);
|
|
1781
1527
|
};
|
|
1782
1528
|
}, [
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1529
|
+
e.isGameActive,
|
|
1530
|
+
e.maze,
|
|
1531
|
+
e.playerPosition,
|
|
1532
|
+
e.exitPosition
|
|
1787
1533
|
]);
|
|
1788
|
-
},
|
|
1789
|
-
gameState:
|
|
1790
|
-
setGameState:
|
|
1534
|
+
}, ao = ({
|
|
1535
|
+
gameState: t,
|
|
1536
|
+
setGameState: e,
|
|
1791
1537
|
config: o,
|
|
1792
1538
|
onLevelComplete: n,
|
|
1793
1539
|
onTierUnlocked: i
|
|
1794
1540
|
}) => {
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
s(
|
|
1800
|
-
e.currentScore,
|
|
1801
|
-
o.current.levelConfig
|
|
1802
|
-
);
|
|
1803
|
-
}, 1e3);
|
|
1804
|
-
return () => clearTimeout(l);
|
|
1805
|
-
}
|
|
1806
|
-
}, [e.levelTransitioning]);
|
|
1807
|
-
const r = wt(o.current.levelConfig), s = (l, a) => {
|
|
1808
|
-
const c = r.getNextLevelInfo(
|
|
1809
|
-
e.currentLevel
|
|
1810
|
-
);
|
|
1811
|
-
if (!c) return;
|
|
1812
|
-
const { nextLevel: _, nextTier: u, isTierChange: h } = c, d = Ct(_, a.flat());
|
|
1813
|
-
d && t((f) => {
|
|
1814
|
-
h && i(u);
|
|
1815
|
-
const g = { ...f.levelScores };
|
|
1816
|
-
return g[f.currentLevel] = Math.max(
|
|
1817
|
-
l,
|
|
1818
|
-
g[f.currentLevel] || 0
|
|
1819
|
-
), {
|
|
1820
|
-
...f,
|
|
1821
|
-
...d,
|
|
1822
|
-
currentLevel: _,
|
|
1823
|
-
currentTier: u,
|
|
1824
|
-
highestUnlockedLevel: Math.max(f.highestUnlockedLevel, _),
|
|
1825
|
-
highestUnlockedTier: Math.max(f.highestUnlockedTier, u),
|
|
1826
|
-
levelScores: g,
|
|
1827
|
-
totalScore: Object.values(g).reduce((v, C) => v + C, 0),
|
|
1828
|
-
showClue: !1,
|
|
1829
|
-
// reset to false on new level
|
|
1830
|
-
isGameActive: !0,
|
|
1831
|
-
levelTransitioning: !1
|
|
1832
|
-
};
|
|
1833
|
-
});
|
|
1834
|
-
};
|
|
1541
|
+
E(() => {
|
|
1542
|
+
t.levelTransitioning && n();
|
|
1543
|
+
}, [t.levelTransitioning]);
|
|
1544
|
+
const r = o.levelConfig, s = ot(r);
|
|
1835
1545
|
return {
|
|
1836
|
-
|
|
1546
|
+
goNextLevel: () => {
|
|
1547
|
+
const a = s.getNextLevelInfo(
|
|
1548
|
+
t.currentLevel
|
|
1549
|
+
);
|
|
1550
|
+
if (!a) return;
|
|
1551
|
+
const { nextLevel: d, nextTier: u, isTierChange: _ } = a, h = et(d, r.flat());
|
|
1552
|
+
h && e((v) => {
|
|
1553
|
+
_ && i(u);
|
|
1554
|
+
const g = { ...v.levelScores };
|
|
1555
|
+
return g[v.currentLevel] = Math.max(
|
|
1556
|
+
Object.values(v.currentScore).filter(Boolean).length,
|
|
1557
|
+
g[v.currentLevel] || 0
|
|
1558
|
+
), {
|
|
1559
|
+
...v,
|
|
1560
|
+
...h,
|
|
1561
|
+
currentLevel: d,
|
|
1562
|
+
currentTier: u,
|
|
1563
|
+
highestUnlockedLevel: Math.max(v.highestUnlockedLevel, d),
|
|
1564
|
+
highestUnlockedTier: Math.max(v.highestUnlockedTier, u),
|
|
1565
|
+
levelScores: g,
|
|
1566
|
+
totalScore: Object.values(g).reduce((p, m) => p + m, 0),
|
|
1567
|
+
showClue: !1,
|
|
1568
|
+
// reset to false on new level
|
|
1569
|
+
isGameActive: !0,
|
|
1570
|
+
levelTransitioning: !1
|
|
1571
|
+
};
|
|
1572
|
+
});
|
|
1573
|
+
},
|
|
1574
|
+
isLastLevel: () => {
|
|
1575
|
+
const a = s.getTotalLevels();
|
|
1576
|
+
return t.currentLevel >= a;
|
|
1577
|
+
}
|
|
1837
1578
|
};
|
|
1838
1579
|
};
|
|
1839
|
-
function
|
|
1840
|
-
const { ctx: o, width: n, height: i, maze: r } =
|
|
1841
|
-
|
|
1580
|
+
function co(t, e) {
|
|
1581
|
+
const { ctx: o, width: n, height: i, maze: r } = t;
|
|
1582
|
+
e.playerColor = t.playerAtExit ? e.playerAtExitColor : e.playerColor;
|
|
1842
1583
|
const {
|
|
1843
1584
|
padding: s,
|
|
1844
1585
|
wallWidth: l,
|
|
1845
|
-
wallColor:
|
|
1846
|
-
playerColor:
|
|
1847
|
-
exitColor:
|
|
1586
|
+
wallColor: c,
|
|
1587
|
+
playerColor: a,
|
|
1588
|
+
exitColor: d,
|
|
1848
1589
|
foodColor: u,
|
|
1849
|
-
clueColor:
|
|
1850
|
-
backgroundColor:
|
|
1851
|
-
} =
|
|
1852
|
-
o.clearRect(0, 0, n, i), o.save(), o.fillStyle =
|
|
1853
|
-
cellWidth:
|
|
1854
|
-
cellHeight:
|
|
1590
|
+
clueColor: _,
|
|
1591
|
+
backgroundColor: h
|
|
1592
|
+
} = e, v = r.cols, g = r.rows, p = (n - s * 2) / v, m = (i - s * 2) / g;
|
|
1593
|
+
o.clearRect(0, 0, n, i), o.save(), o.fillStyle = h, o.fillRect(0, 0, n, i), o.restore(), t.showClue && t.playerPath && t.playerPath.length > 0 && vo(t, {
|
|
1594
|
+
cellWidth: p,
|
|
1595
|
+
cellHeight: m,
|
|
1855
1596
|
padding: s,
|
|
1856
|
-
clueColor:
|
|
1857
|
-
}),
|
|
1858
|
-
cellWidth:
|
|
1859
|
-
cellHeight:
|
|
1597
|
+
clueColor: _
|
|
1598
|
+
}), uo(t, {
|
|
1599
|
+
cellWidth: p,
|
|
1600
|
+
cellHeight: m,
|
|
1860
1601
|
padding: s,
|
|
1861
|
-
wallColor:
|
|
1602
|
+
wallColor: c,
|
|
1862
1603
|
wallWidth: l
|
|
1863
|
-
}),
|
|
1864
|
-
cellWidth:
|
|
1865
|
-
cellHeight:
|
|
1604
|
+
}), fo(t, {
|
|
1605
|
+
cellWidth: p,
|
|
1606
|
+
cellHeight: m,
|
|
1866
1607
|
padding: s,
|
|
1867
1608
|
foodColor: u
|
|
1868
|
-
}),
|
|
1869
|
-
cellWidth:
|
|
1870
|
-
cellHeight:
|
|
1609
|
+
}), t.playerAtExit || _o(t, {
|
|
1610
|
+
cellWidth: p,
|
|
1611
|
+
cellHeight: m,
|
|
1871
1612
|
padding: s,
|
|
1872
|
-
exitColor:
|
|
1873
|
-
}),
|
|
1874
|
-
cellWidth:
|
|
1875
|
-
cellHeight:
|
|
1613
|
+
exitColor: d
|
|
1614
|
+
}), ho(t, {
|
|
1615
|
+
cellWidth: p,
|
|
1616
|
+
cellHeight: m,
|
|
1876
1617
|
padding: s,
|
|
1877
|
-
playerColor:
|
|
1618
|
+
playerColor: a
|
|
1878
1619
|
});
|
|
1879
1620
|
}
|
|
1880
|
-
function
|
|
1881
|
-
const { ctx: o, maze: n } =
|
|
1882
|
-
o.save(), o.strokeStyle = l, o.lineWidth =
|
|
1883
|
-
for (let
|
|
1884
|
-
for (let
|
|
1885
|
-
const u = n.grid[
|
|
1886
|
-
u.walls.top && (o.moveTo(
|
|
1621
|
+
function uo(t, e) {
|
|
1622
|
+
const { ctx: o, maze: n } = t, { cellWidth: i, cellHeight: r, padding: s, wallColor: l, wallWidth: c } = e;
|
|
1623
|
+
o.save(), o.strokeStyle = l, o.lineWidth = c, o.lineCap = "round", o.beginPath();
|
|
1624
|
+
for (let a = 0; a < n.rows; a++)
|
|
1625
|
+
for (let d = 0; d < n.cols; d++) {
|
|
1626
|
+
const u = n.grid[a][d], _ = s + d * i, h = s + a * r;
|
|
1627
|
+
u.walls.top && (o.moveTo(_, h), o.lineTo(_ + i, h)), u.walls.right && (o.moveTo(_ + i, h), o.lineTo(_ + i, h + r)), u.walls.bottom && (o.moveTo(_ + i, h + r), o.lineTo(_, h + r)), u.walls.left && (o.moveTo(_, h + r), o.lineTo(_, h));
|
|
1887
1628
|
}
|
|
1888
1629
|
o.stroke(), o.restore();
|
|
1889
1630
|
}
|
|
1890
|
-
function
|
|
1891
|
-
const { ctx: o, playerPosition: n } =
|
|
1631
|
+
function ho(t, e) {
|
|
1632
|
+
const { ctx: o, playerPosition: n } = t, { cellWidth: i, cellHeight: r, padding: s, playerColor: l } = e, { x: c, y: a } = B(
|
|
1892
1633
|
n.row,
|
|
1893
1634
|
n.col,
|
|
1894
1635
|
i,
|
|
1895
1636
|
r,
|
|
1896
1637
|
s
|
|
1897
|
-
),
|
|
1898
|
-
o.save(), o.fillStyle = l, o.beginPath(), o.arc(
|
|
1638
|
+
), d = Math.min(i, r) * 0.35;
|
|
1639
|
+
o.save(), o.fillStyle = l, o.beginPath(), o.arc(c, a, d, 0, Math.PI * 2), o.fill(), o.restore();
|
|
1899
1640
|
}
|
|
1900
|
-
function
|
|
1901
|
-
const { ctx: o, exitPosition: n } =
|
|
1641
|
+
function _o(t, e) {
|
|
1642
|
+
const { ctx: o, exitPosition: n } = t, { cellWidth: i, cellHeight: r, padding: s, exitColor: l } = e, { x: c, y: a } = B(
|
|
1902
1643
|
n.row,
|
|
1903
1644
|
n.col,
|
|
1904
1645
|
i,
|
|
1905
1646
|
r,
|
|
1906
1647
|
s
|
|
1907
|
-
),
|
|
1908
|
-
o.save(), o.fillStyle = l, o.beginPath(), o.arc(
|
|
1648
|
+
), d = Math.min(i, r) * 0.35;
|
|
1649
|
+
o.save(), o.fillStyle = l, o.beginPath(), o.arc(c, a, d, 0, Math.PI * 2), o.fill(), o.restore();
|
|
1909
1650
|
}
|
|
1910
|
-
function
|
|
1911
|
-
const { ctx: o, foodPositions: n } =
|
|
1651
|
+
function fo(t, e) {
|
|
1652
|
+
const { ctx: o, foodPositions: n } = t, { cellWidth: i, cellHeight: r, padding: s, foodColor: l } = e;
|
|
1912
1653
|
o.fillStyle = l;
|
|
1913
|
-
const
|
|
1914
|
-
n.forEach((
|
|
1915
|
-
const { x:
|
|
1916
|
-
|
|
1917
|
-
|
|
1654
|
+
const c = Math.min(i, r) * 0.25;
|
|
1655
|
+
n.forEach((a) => {
|
|
1656
|
+
const { x: d, y: u } = B(
|
|
1657
|
+
a.row,
|
|
1658
|
+
a.col,
|
|
1918
1659
|
i,
|
|
1919
1660
|
r,
|
|
1920
1661
|
s
|
|
1921
1662
|
);
|
|
1922
|
-
|
|
1663
|
+
mo(o, d, u, c * 1.2, 5, c * 0.6);
|
|
1923
1664
|
});
|
|
1924
1665
|
}
|
|
1925
|
-
function
|
|
1926
|
-
|
|
1666
|
+
function mo(t, e, o, n, i, r) {
|
|
1667
|
+
t.save(), t.beginPath();
|
|
1927
1668
|
for (let s = 0; s < i * 2; s++) {
|
|
1928
|
-
const l = s % 2 === 0 ? n : r,
|
|
1929
|
-
|
|
1669
|
+
const l = s % 2 === 0 ? n : r, c = Math.PI * s / i;
|
|
1670
|
+
t.lineTo(e + l * Math.sin(c), o + l * Math.cos(c));
|
|
1930
1671
|
}
|
|
1931
|
-
|
|
1672
|
+
t.closePath(), t.fill(), t.restore();
|
|
1932
1673
|
}
|
|
1933
|
-
function
|
|
1934
|
-
const { ctx: o, playerPath: n, visitCounts: i } =
|
|
1674
|
+
function vo(t, e) {
|
|
1675
|
+
const { ctx: o, playerPath: n, visitCounts: i } = t, { cellWidth: r, cellHeight: s, padding: l, clueColor: c } = e;
|
|
1935
1676
|
if (!(!n || n.length < 2 || !i)) {
|
|
1936
1677
|
o.save();
|
|
1937
|
-
for (let
|
|
1938
|
-
const
|
|
1678
|
+
for (let a = 1; a < n.length; a++) {
|
|
1679
|
+
const d = n[a - 1], u = n[a], _ = `${d.row},${d.col}-${u.row},${u.col}`, h = `${u.row},${u.col}-${d.row},${d.col}`, v = (i[_] || 0) + (i[h] || 0), g = Math.min(0.2 + v * 0.1, 0.9), p = Math.max(3, r * 0.1) + v * 0.5;
|
|
1939
1680
|
try {
|
|
1940
|
-
o.strokeStyle =
|
|
1681
|
+
o.strokeStyle = c.replace(")", `, ${g})`).replace("rgb(", "rgba(");
|
|
1941
1682
|
} catch {
|
|
1942
1683
|
o.strokeStyle = `rgba(255, 0, 0, ${g})`;
|
|
1943
1684
|
}
|
|
1944
|
-
o.lineWidth =
|
|
1945
|
-
const { x:
|
|
1946
|
-
|
|
1947
|
-
|
|
1685
|
+
o.lineWidth = p, o.lineCap = "round", o.lineJoin = "round";
|
|
1686
|
+
const { x: m, y: C } = B(
|
|
1687
|
+
d.row,
|
|
1688
|
+
d.col,
|
|
1948
1689
|
r,
|
|
1949
1690
|
s,
|
|
1950
1691
|
l
|
|
1951
|
-
), { x:
|
|
1692
|
+
), { x: P, y: k } = B(
|
|
1952
1693
|
u.row,
|
|
1953
1694
|
u.col,
|
|
1954
1695
|
r,
|
|
1955
1696
|
s,
|
|
1956
1697
|
l
|
|
1957
1698
|
);
|
|
1958
|
-
o.beginPath(), o.moveTo(
|
|
1699
|
+
o.beginPath(), o.moveTo(m, C), o.lineTo(P, k), o.stroke();
|
|
1959
1700
|
}
|
|
1960
1701
|
o.restore();
|
|
1961
1702
|
}
|
|
1962
1703
|
}
|
|
1963
|
-
function
|
|
1704
|
+
function B(t, e, o, n, i) {
|
|
1964
1705
|
return {
|
|
1965
|
-
x: i +
|
|
1966
|
-
y: i +
|
|
1706
|
+
x: i + e * o + o / 2,
|
|
1707
|
+
y: i + t * n + n / 2
|
|
1967
1708
|
};
|
|
1968
1709
|
}
|
|
1969
|
-
const
|
|
1970
|
-
const { message:
|
|
1971
|
-
return /* @__PURE__ */
|
|
1972
|
-
|
|
1710
|
+
const go = new Vt(), po = () => {
|
|
1711
|
+
const { message: t, visible: e, type: o, hideToast: n } = ve();
|
|
1712
|
+
return /* @__PURE__ */ f(
|
|
1713
|
+
ro,
|
|
1973
1714
|
{
|
|
1974
|
-
message:
|
|
1975
|
-
visible:
|
|
1715
|
+
message: t,
|
|
1716
|
+
visible: e,
|
|
1976
1717
|
type: o,
|
|
1977
1718
|
onClose: n,
|
|
1978
1719
|
position: "top"
|
|
1979
1720
|
}
|
|
1980
1721
|
);
|
|
1981
|
-
},
|
|
1982
|
-
const { gameState:
|
|
1983
|
-
|
|
1984
|
-
r.current =
|
|
1985
|
-
}, [
|
|
1986
|
-
const
|
|
1987
|
-
const
|
|
1988
|
-
if (
|
|
1722
|
+
}, Co = () => {
|
|
1723
|
+
const { gameState: t, setGameState: e, config: o } = _e(), n = U(null), i = U(null), r = U(t), s = o.i18n, { showToast: l } = ve(), c = U(!1), a = U(!1), [d, u] = I(!1);
|
|
1724
|
+
E(() => {
|
|
1725
|
+
r.current = t;
|
|
1726
|
+
}, [t]);
|
|
1727
|
+
const _ = () => {
|
|
1728
|
+
const b = t.totalFoodCount - t.foodCollected - 1;
|
|
1729
|
+
if (b > 0) {
|
|
1989
1730
|
l(
|
|
1990
|
-
s.foodCollectedToast.replace("%NUM%",
|
|
1731
|
+
s.foodCollectedToast.replace("%NUM%", b.toString()),
|
|
1991
1732
|
"success"
|
|
1992
1733
|
);
|
|
1993
1734
|
return;
|
|
1994
1735
|
}
|
|
1995
1736
|
l(s.allFoodCollectedToast, "success");
|
|
1996
|
-
},
|
|
1997
|
-
const
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
}, u = (d, f) => {
|
|
2003
|
-
const g = d.current?.getContext("2d");
|
|
2004
|
-
if (!g || !f.maze || a.current) return;
|
|
2005
|
-
a.current = !0;
|
|
2006
|
-
const v = { ...o.current.renderConfig || {} }, p = o.current.levelConfig.flat()[f.currentLevel - 1];
|
|
2007
|
-
p.wallWidth ? v.wallWidth = p.wallWidth : f.maze.cols > 40 && (v.wallWidth -= v.wallWidth * 0.05 * (f.maze.cols - 40), v.wallWidth = Math.max(
|
|
2008
|
-
v.wallWidth,
|
|
2009
|
-
v.minWallWidth
|
|
2010
|
-
)), Bo(
|
|
1737
|
+
}, h = (b, T) => {
|
|
1738
|
+
const M = b.current?.getContext("2d");
|
|
1739
|
+
if (!M || !T.maze || c.current) return;
|
|
1740
|
+
c.current = !0;
|
|
1741
|
+
const x = { ...o.renderConfig || {} }, L = o.levelConfig.flat()[T.currentLevel - 1];
|
|
1742
|
+
x.wallWidth = L.wallWidth || x.wallWidth, co(
|
|
2011
1743
|
{
|
|
2012
|
-
ctx:
|
|
2013
|
-
width:
|
|
2014
|
-
height:
|
|
2015
|
-
maze:
|
|
2016
|
-
playerPosition:
|
|
2017
|
-
exitPosition:
|
|
2018
|
-
foodPositions:
|
|
2019
|
-
showClue:
|
|
2020
|
-
playerPath:
|
|
2021
|
-
visitCounts:
|
|
2022
|
-
playerAtExit:
|
|
1744
|
+
ctx: M,
|
|
1745
|
+
width: b.current.width,
|
|
1746
|
+
height: b.current.height,
|
|
1747
|
+
maze: T.maze,
|
|
1748
|
+
playerPosition: T.playerPosition,
|
|
1749
|
+
exitPosition: T.exitPosition,
|
|
1750
|
+
foodPositions: T.foodPositions,
|
|
1751
|
+
showClue: T.showClue,
|
|
1752
|
+
playerPath: T.playerPath,
|
|
1753
|
+
visitCounts: T.visitCounts,
|
|
1754
|
+
playerAtExit: T.playerAtExit
|
|
2023
1755
|
},
|
|
2024
|
-
|
|
1756
|
+
x
|
|
2025
1757
|
), requestAnimationFrame(() => {
|
|
2026
|
-
|
|
1758
|
+
c.current = !1;
|
|
2027
1759
|
});
|
|
2028
1760
|
};
|
|
2029
|
-
|
|
1761
|
+
E(() => {
|
|
2030
1762
|
l(s.useArrowKeyTips, "info", 3e3);
|
|
2031
|
-
}, []),
|
|
2032
|
-
const { generateCurrentLevelMaze:
|
|
2033
|
-
gameState:
|
|
2034
|
-
setGameState:
|
|
1763
|
+
}, []), so(i, h, r);
|
|
1764
|
+
const { generateCurrentLevelMaze: v } = tt({
|
|
1765
|
+
gameState: t,
|
|
1766
|
+
setGameState: e,
|
|
2035
1767
|
config: o
|
|
2036
1768
|
});
|
|
2037
|
-
|
|
1769
|
+
lo({
|
|
2038
1770
|
containerRef: n,
|
|
2039
|
-
gameState:
|
|
2040
|
-
setGameState:
|
|
2041
|
-
onFoodCollected:
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
gameState:
|
|
2045
|
-
setGameState:
|
|
1771
|
+
gameState: t,
|
|
1772
|
+
setGameState: e,
|
|
1773
|
+
onFoodCollected: _
|
|
1774
|
+
});
|
|
1775
|
+
const { goNextLevel: g, isLastLevel: p } = ao({
|
|
1776
|
+
gameState: t,
|
|
1777
|
+
setGameState: e,
|
|
2046
1778
|
config: o,
|
|
2047
1779
|
onLevelComplete: () => {
|
|
2048
|
-
|
|
1780
|
+
go.addConfetti(), l(s.levelCompleteToast, "success"), u(!0);
|
|
2049
1781
|
},
|
|
2050
|
-
onTierUnlocked: (
|
|
1782
|
+
onTierUnlocked: (b) => {
|
|
2051
1783
|
l(
|
|
2052
|
-
s.tierUnlockedToast.replace("%TIER%",
|
|
1784
|
+
s.tierUnlockedToast.replace("%TIER%", b.toString()),
|
|
2053
1785
|
"success"
|
|
2054
1786
|
);
|
|
2055
1787
|
}
|
|
2056
|
-
}),
|
|
2057
|
-
|
|
1788
|
+
}), m = W(
|
|
1789
|
+
() => p(),
|
|
1790
|
+
[t.currentLevel]
|
|
1791
|
+
), C = W(() => t.foodCollected === t.totalFoodCount, [t.foodCollected, t.totalFoodCount]), P = () => {
|
|
1792
|
+
a.current = !1, u(!1), g();
|
|
1793
|
+
}, k = () => {
|
|
1794
|
+
a.current = !1, u(!1), v(), l(s.levelRestartToast, "info");
|
|
1795
|
+
}, N = () => {
|
|
1796
|
+
a.current = !0, u(!1), e((b) => ({
|
|
1797
|
+
...b,
|
|
1798
|
+
isGameActive: !0,
|
|
1799
|
+
levelTransitioning: !1
|
|
1800
|
+
}));
|
|
1801
|
+
};
|
|
1802
|
+
return E(() => {
|
|
1803
|
+
t.isGameActive && !t.levelTransitioning && !a.current && v();
|
|
2058
1804
|
}, [
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
]),
|
|
2063
|
-
i.current &&
|
|
1805
|
+
t.currentLevel,
|
|
1806
|
+
t.isGameActive,
|
|
1807
|
+
t.levelTransitioning
|
|
1808
|
+
]), E(() => {
|
|
1809
|
+
i.current && t.maze && h(i, t);
|
|
2064
1810
|
}, [
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
]), /* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
1811
|
+
t.maze,
|
|
1812
|
+
t.playerPosition,
|
|
1813
|
+
t.exitPosition,
|
|
1814
|
+
t.foodPositions,
|
|
1815
|
+
t.showClue,
|
|
1816
|
+
t.playerPath,
|
|
1817
|
+
t.visitCounts,
|
|
1818
|
+
t.playerAtExit
|
|
1819
|
+
]), /* @__PURE__ */ f("div", { className: "maze-game-container", children: [
|
|
1820
|
+
/* @__PURE__ */ f(po, {}),
|
|
1821
|
+
/* @__PURE__ */ f(io, {}),
|
|
1822
|
+
/* @__PURE__ */ f(
|
|
1823
|
+
K,
|
|
1824
|
+
{
|
|
1825
|
+
className: "level-complete-dialog",
|
|
1826
|
+
isOpen: d,
|
|
1827
|
+
title: s.congratulations,
|
|
1828
|
+
cancelText: s.retry,
|
|
1829
|
+
onCancel: k,
|
|
1830
|
+
noConfirm: C,
|
|
1831
|
+
confirmText: s.continue,
|
|
1832
|
+
onConfirm: N,
|
|
1833
|
+
children: [
|
|
1834
|
+
/* @__PURE__ */ f("div", { className: "maze-summary-message", children: [
|
|
1835
|
+
t.currentScore.atExit && /* @__PURE__ */ f("div", { children: "★ - " + s.findYourExit }),
|
|
1836
|
+
/* @__PURE__ */ f("div", { children: t.currentScore.noClue ? "★ - " + s.withoutClue : "☆ - " + s.withClue }),
|
|
1837
|
+
/* @__PURE__ */ f("div", { children: (t.currentScore.allFood ? "★ - " + s.collectAllStars : "☆ - " + s.notCollectAllStars) + ` (${t.foodCollected}/${t.totalFoodCount})` })
|
|
1838
|
+
] }),
|
|
1839
|
+
m && /* @__PURE__ */ f("div", { className: "all-levels-completed", children: s.allLevelsCompleted }),
|
|
1840
|
+
/* @__PURE__ */ f("div", { className: "go-next-level", children: m ? "OK" : /* @__PURE__ */ f("button", { type: "button", onClick: P, children: s.nextLevel }) }),
|
|
1841
|
+
!C && /* @__PURE__ */ f("div", { className: "not-all-stars-collected", children: s.continueMessage })
|
|
1842
|
+
]
|
|
1843
|
+
}
|
|
1844
|
+
),
|
|
1845
|
+
/* @__PURE__ */ f("div", { className: "maze-canvas-container", ref: n, children: [
|
|
1846
|
+
/* @__PURE__ */ f("canvas", { ref: i, className: "maze-game-canvas" }),
|
|
1847
|
+
/* @__PURE__ */ f("div", { className: "maze-touch-area maze-up" }),
|
|
1848
|
+
/* @__PURE__ */ f("div", { className: "maze-touch-area maze-down" }),
|
|
1849
|
+
/* @__PURE__ */ f("div", { className: "maze-touch-area maze-left" }),
|
|
1850
|
+
/* @__PURE__ */ f("div", { className: "maze-touch-area maze-right" })
|
|
2082
1851
|
] })
|
|
2083
1852
|
] });
|
|
2084
1853
|
};
|
|
2085
|
-
function
|
|
2086
|
-
return /* @__PURE__ */
|
|
2087
|
-
}
|
|
2088
|
-
function
|
|
2089
|
-
const
|
|
2090
|
-
return
|
|
2091
|
-
...
|
|
2092
|
-
...
|
|
2093
|
-
i18n:
|
|
1854
|
+
function wo() {
|
|
1855
|
+
return /* @__PURE__ */ f(Yt, { children: /* @__PURE__ */ f(Co, {}) });
|
|
1856
|
+
}
|
|
1857
|
+
function yo({ config: t = {} }) {
|
|
1858
|
+
const e = { ...Z.i18n, ...t.i18n || {} }, o = { ...Z.renderConfig, ...t.renderConfig || {} }, n = t.levelConfig || ge;
|
|
1859
|
+
return t = {
|
|
1860
|
+
...Z,
|
|
1861
|
+
...t,
|
|
1862
|
+
i18n: e,
|
|
2094
1863
|
levelConfig: n,
|
|
2095
1864
|
renderConfig: o
|
|
2096
|
-
}, /* @__PURE__ */
|
|
1865
|
+
}, /* @__PURE__ */ f(kt, { config: t, children: /* @__PURE__ */ f(wo, {}) });
|
|
2097
1866
|
}
|
|
2098
|
-
const
|
|
2099
|
-
root: "https://unpkg.com/@roudanio/maze@0.0.
|
|
2100
|
-
...
|
|
1867
|
+
const bo = {
|
|
1868
|
+
root: "https://unpkg.com/@roudanio/maze@0.0.9/dist/",
|
|
1869
|
+
...Z
|
|
2101
1870
|
};
|
|
2102
|
-
`${JSON.stringify(
|
|
2103
|
-
const
|
|
2104
|
-
async init(
|
|
2105
|
-
const o = typeof
|
|
1871
|
+
`${JSON.stringify(bo, null, 2)}`;
|
|
1872
|
+
const ko = {
|
|
1873
|
+
async init(t, e) {
|
|
1874
|
+
const o = typeof t == "string" ? document.querySelector(t) : t;
|
|
2106
1875
|
if (!o) {
|
|
2107
1876
|
console.warn("Cannot find the root element");
|
|
2108
|
-
const
|
|
2109
|
-
|
|
1877
|
+
const c = document.createElement("div");
|
|
1878
|
+
c.style.textAlign = "center", c.style.padding = "20px", c.innerHTML = "Cannot find the root element", document.body.append(c);
|
|
2110
1879
|
return;
|
|
2111
1880
|
}
|
|
2112
|
-
let { root: n = location.origin } =
|
|
1881
|
+
let { root: n = location.origin } = e;
|
|
2113
1882
|
n.at(-1) !== "/" && (n += "/");
|
|
2114
1883
|
const i = document.createElement("div"), r = document.createElement("div");
|
|
2115
1884
|
i.style.cssText = `
|
|
@@ -2130,12 +1899,12 @@ const rn = {
|
|
|
2130
1899
|
@keyframes loading {
|
|
2131
1900
|
0% { width: 0%; }
|
|
2132
1901
|
100% { width: 99%; }
|
|
2133
|
-
}`, document.head.appendChild(s), await (async (
|
|
1902
|
+
}`, document.head.appendChild(s), await (async (c) => new Promise((a, d) => {
|
|
2134
1903
|
const u = document.createElement("link");
|
|
2135
|
-
u.rel = "stylesheet", u.type = "text/css", u.href =
|
|
2136
|
-
}))(n + "maze.css"),
|
|
1904
|
+
u.rel = "stylesheet", u.type = "text/css", u.href = c, u.onload = a, u.onerror = d, document.head.appendChild(u);
|
|
1905
|
+
}))(n + "maze.css"), gt(/* @__PURE__ */ f(yo, { config: e }), o);
|
|
2137
1906
|
}
|
|
2138
1907
|
};
|
|
2139
1908
|
export {
|
|
2140
|
-
|
|
1909
|
+
ko as default
|
|
2141
1910
|
};
|