@roudanio/maze 0.0.8 → 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 -2
- package/dist/maze.js +419 -341
- package/dist/maze.umd.js +2 -2
- package/package.json +1 -1
package/dist/maze.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
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
3
|
for (var o in e) t[o] = e[o];
|
|
4
4
|
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function ue(t) {
|
|
7
7
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
8
|
}
|
|
9
9
|
function ht(t, e, o) {
|
|
10
10
|
var n, i, r, s = {};
|
|
11
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 ?
|
|
13
|
-
return
|
|
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
14
|
}
|
|
15
|
-
function
|
|
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 ?? ++
|
|
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
17
|
return i == null && w.vnode != null && w.vnode(r), r;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function oe(t) {
|
|
20
20
|
return t.children;
|
|
21
21
|
}
|
|
22
22
|
function X(t, e) {
|
|
@@ -37,21 +37,21 @@ function je(t) {
|
|
|
37
37
|
return je(t);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
(!t.__d && (t.__d = !0) &&
|
|
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 t, e, o, n, i, r, s, l = 1;
|
|
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
47
|
function Ge(t, e, o, n, i, r, s, l, c, a, d) {
|
|
48
|
-
var u, _, h, v, g, p,
|
|
49
|
-
for (c = _t(o, e,
|
|
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
50
|
return o.__e = g, c;
|
|
51
51
|
}
|
|
52
52
|
function _t(t, e, o, n, i) {
|
|
53
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 ?
|
|
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
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
|
}
|
|
@@ -85,14 +85,14 @@ function ft(t, e, o, n) {
|
|
|
85
85
|
function Ce(t, e, o) {
|
|
86
86
|
e[0] == "-" ? t.setProperty(e, o ?? "") : t[e] = o == null ? "" : typeof o != "number" || dt.test(e) ? o : o + "px";
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function V(t, e, o, n, i) {
|
|
89
89
|
var r;
|
|
90
90
|
e: if (e == "style") if (typeof o == "string") t.style.cssText = o;
|
|
91
91
|
else {
|
|
92
92
|
if (typeof n == "string" && (t.style.cssText = n = ""), n) for (e in n) o && e in o || Ce(t.style, e, "");
|
|
93
93
|
if (o) for (e in o) n && o[e] == n[e] || Ce(t.style, e, o[e]);
|
|
94
94
|
}
|
|
95
|
-
else if (e[0] == "o" && e[1] == "n") r = e != (e = e.replace(
|
|
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);
|
|
96
96
|
else {
|
|
97
97
|
if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
98
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 {
|
|
@@ -107,42 +107,42 @@ function we(t) {
|
|
|
107
107
|
return function(e) {
|
|
108
108
|
if (this.l) {
|
|
109
109
|
var o = this.l[e.type + t];
|
|
110
|
-
if (e.t == null) e.t =
|
|
110
|
+
if (e.t == null) e.t = ce++;
|
|
111
111
|
else if (e.t < o.u) return;
|
|
112
112
|
return o(w.event ? w.event(e) : e);
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
var d, u, _, h, v, g, p,
|
|
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
118
|
if (e.constructor != null) return null;
|
|
119
119
|
128 & o.__u && (c = !!(32 & o.__u), r = [l = e.__e = o.__e]), (d = w.__b) && d(e);
|
|
120
|
-
e: if (typeof
|
|
121
|
-
if (
|
|
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);
|
|
122
122
|
else {
|
|
123
|
-
if (C &&
|
|
124
|
-
for (e.__v != o.__v && (u.props =
|
|
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
125
|
R && (R.__ = e);
|
|
126
|
-
}),
|
|
126
|
+
}), N = 0; N < u._sb.length; N++) u.__h.push(u._sb[N]);
|
|
127
127
|
u._sb = [], u.__h.length && s.push(u);
|
|
128
128
|
break e;
|
|
129
129
|
}
|
|
130
|
-
u.componentWillUpdate != null && u.componentWillUpdate(
|
|
130
|
+
u.componentWillUpdate != null && u.componentWillUpdate(m, u.__s, k), C && u.componentDidUpdate != null && u.__h.push(function() {
|
|
131
131
|
u.componentDidUpdate(h, v, g);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
if (u.context =
|
|
135
|
-
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]);
|
|
136
136
|
u._sb = [];
|
|
137
137
|
} else do
|
|
138
|
-
u.__d = !1,
|
|
139
|
-
while (u.__d && ++
|
|
140
|
-
u.state = u.__s, u.getChildContext != null && (n =
|
|
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
141
|
} catch (R) {
|
|
142
142
|
if (e.__v = null, c || r != null) if (R.then) {
|
|
143
143
|
for (e.__u |= c ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
144
144
|
r[r.indexOf(l)] = null, e.__e = l;
|
|
145
|
-
} else for (
|
|
145
|
+
} else for (O = r.length; O--; ) ue(r[O]);
|
|
146
146
|
else e.__e = o.__e, e.__k = o.__k;
|
|
147
147
|
w.__e(R, e, o);
|
|
148
148
|
}
|
|
@@ -150,7 +150,7 @@ function ue(t, e, o, n, i, r, s, l, c, a) {
|
|
|
150
150
|
return (d = w.diffed) && d(e), 128 & e.__u ? void 0 : l;
|
|
151
151
|
}
|
|
152
152
|
function We(t, e, o) {
|
|
153
|
-
for (var n = 0; n < o.length; n++)
|
|
153
|
+
for (var n = 0; n < o.length; n++) he(o[n], o[++n], o[++n]);
|
|
154
154
|
w.__c && w.__c(e, t), t.some(function(i) {
|
|
155
155
|
try {
|
|
156
156
|
t = i.__h, i.__h = [], t.some(function(r) {
|
|
@@ -162,10 +162,10 @@ function We(t, e, o) {
|
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
function Be(t) {
|
|
165
|
-
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t :
|
|
165
|
+
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : te(t) ? t.map(Be) : F({}, t);
|
|
166
166
|
}
|
|
167
167
|
function mt(t, e, o, n, i, r, s, l, c) {
|
|
168
|
-
var a, d, u, _, h, v, g, p = o.props,
|
|
168
|
+
var a, d, u, _, h, v, g, p = o.props, m = e.props, C = e.type;
|
|
169
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
170
|
for (a = 0; a < r.length; a++) if ((h = r[a]) && "setAttribute" in h == !!C && (C ? h.localName == C : h.nodeType == 3)) {
|
|
171
171
|
t = h, r[a] = null;
|
|
@@ -173,27 +173,27 @@ function mt(t, e, o, n, i, r, s, l, c) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
if (t == null) {
|
|
176
|
-
if (C == null) return document.createTextNode(
|
|
177
|
-
t = document.createElementNS(i, C,
|
|
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;
|
|
178
178
|
}
|
|
179
|
-
if (C == null) p ===
|
|
179
|
+
if (C == null) p === m || l && t.data == m || (t.data = m);
|
|
180
180
|
else {
|
|
181
|
-
if (r = r &&
|
|
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
182
|
for (a in p) if (h = p[a], a != "children") {
|
|
183
183
|
if (a == "dangerouslySetInnerHTML") u = h;
|
|
184
|
-
else if (!(a in
|
|
185
|
-
if (a == "value" && "defaultValue" in
|
|
186
|
-
|
|
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);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
for (a in
|
|
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
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,
|
|
192
|
-
l || (a = "value", C == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[a] || C == "progress" && !v || C == "option" && v != p[a]) &&
|
|
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));
|
|
193
193
|
}
|
|
194
194
|
return t;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function he(t, e, o) {
|
|
197
197
|
try {
|
|
198
198
|
if (typeof t == "function") {
|
|
199
199
|
var n = typeof t.__u == "function";
|
|
@@ -205,7 +205,7 @@ function de(t, e, o) {
|
|
|
205
205
|
}
|
|
206
206
|
function qe(t, e, o) {
|
|
207
207
|
var n, i;
|
|
208
|
-
if (w.unmount && w.unmount(t), (n = t.ref) && (n.current && n.current != t.__e ||
|
|
208
|
+
if (w.unmount && w.unmount(t), (n = t.ref) && (n.current && n.current != t.__e || he(n, null, e)), (n = t.__c) != null) {
|
|
209
209
|
if (n.componentWillUnmount) try {
|
|
210
210
|
n.componentWillUnmount();
|
|
211
211
|
} catch (r) {
|
|
@@ -214,14 +214,14 @@ function qe(t, e, o) {
|
|
|
214
214
|
n.base = n.__P = null;
|
|
215
215
|
}
|
|
216
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 ||
|
|
217
|
+
o || ue(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
218
218
|
}
|
|
219
219
|
function vt(t, e, o) {
|
|
220
220
|
return this.constructor(t, o);
|
|
221
221
|
}
|
|
222
222
|
function gt(t, e, o) {
|
|
223
223
|
var n, i, r, s;
|
|
224
|
-
e == document && (e = document.documentElement), w.__ && w.__(t, e), i = (n = !1) ? null : e.__k, r = [], s = [],
|
|
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);
|
|
225
225
|
}
|
|
226
226
|
function Ve(t) {
|
|
227
227
|
function e(o) {
|
|
@@ -232,7 +232,7 @@ function Ve(t) {
|
|
|
232
232
|
n = null;
|
|
233
233
|
}, this.shouldComponentUpdate = function(r) {
|
|
234
234
|
this.props.value != r.value && n.forEach(function(s) {
|
|
235
|
-
s.__e = !0,
|
|
235
|
+
s.__e = !0, le(s);
|
|
236
236
|
});
|
|
237
237
|
}, this.sub = function(r) {
|
|
238
238
|
n.add(r);
|
|
@@ -242,27 +242,27 @@ function Ve(t) {
|
|
|
242
242
|
};
|
|
243
243
|
}), o.children;
|
|
244
244
|
}
|
|
245
|
-
return e.__c = "__cC" +
|
|
245
|
+
return e.__c = "__cC" + Ue++, e.__ = t, e.Provider = e.__l = (e.Consumer = function(o, n) {
|
|
246
246
|
return o.children(n);
|
|
247
247
|
}).contextType = e, e;
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
ee = De.slice, w = { __e: function(t, e, o, n) {
|
|
250
250
|
for (var i, r, s; e = e.__; ) if ((i = e.__c) && !i.__) try {
|
|
251
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;
|
|
252
252
|
} catch (l) {
|
|
253
253
|
t = l;
|
|
254
254
|
}
|
|
255
255
|
throw t;
|
|
256
|
-
} },
|
|
256
|
+
} }, Fe = 0, X.prototype.setState = function(t, e) {
|
|
257
257
|
var o;
|
|
258
|
-
o = this.__s != null && this.__s != this.state ? this.__s : this.__s =
|
|
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
259
|
}, X.prototype.forceUpdate = function(t) {
|
|
260
|
-
this.__v && (this.__e = !0, t && this.__h.push(t),
|
|
261
|
-
}, X.prototype.render =
|
|
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
262
|
return t.__v.__b - e.__v.__b;
|
|
263
|
-
},
|
|
263
|
+
}, Q.__r = 0, Oe = /(PointerCapture)$|Capture$/i, ce = 0, re = we(!1), se = we(!0), Ue = 0;
|
|
264
264
|
var pt = 0;
|
|
265
|
-
function
|
|
265
|
+
function f(t, e, o, n, i, r) {
|
|
266
266
|
e || (e = {});
|
|
267
267
|
var s, l, c = e;
|
|
268
268
|
if ("ref" in c) for (l in c = {}, e) l == "ref" ? s = e[l] : c[l] = e[l];
|
|
@@ -270,9 +270,9 @@ function m(t, e, o, n, i, r) {
|
|
|
270
270
|
if (typeof t == "function" && (s = t.defaultProps)) for (l in s) c[l] === void 0 && (c[l] = s[l]);
|
|
271
271
|
return w.vnode && w.vnode(a), a;
|
|
272
272
|
}
|
|
273
|
-
var
|
|
274
|
-
function
|
|
275
|
-
|
|
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
276
|
var o = y.__H || (y.__H = { __: [], __h: [] });
|
|
277
277
|
return t >= o.__.length && o.__.push({}), o.__[t];
|
|
278
278
|
}
|
|
@@ -280,7 +280,7 @@ function I(t) {
|
|
|
280
280
|
return H = 1, Ct(Ke, t);
|
|
281
281
|
}
|
|
282
282
|
function Ct(t, e, o) {
|
|
283
|
-
var n =
|
|
283
|
+
var n = ne(j++, 2);
|
|
284
284
|
if (n.t = t, !n.__c && (n.__ = [Ke(void 0, e), function(l) {
|
|
285
285
|
var c = n.__N ? n.__N[0] : n.__[0], a = n.t(c, l);
|
|
286
286
|
c !== a && (n.__N = [a, n.__[1]], n.__c.setState({}));
|
|
@@ -313,73 +313,73 @@ function Ct(t, e, o) {
|
|
|
313
313
|
}
|
|
314
314
|
return n.__N || n.__;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
var o =
|
|
318
|
-
!
|
|
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));
|
|
319
319
|
}
|
|
320
320
|
function U(t) {
|
|
321
|
-
return H = 5,
|
|
321
|
+
return H = 5, W(function() {
|
|
322
322
|
return { current: t };
|
|
323
323
|
}, []);
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
var o =
|
|
325
|
+
function W(t, e) {
|
|
326
|
+
var o = ne(j++, 7);
|
|
327
327
|
return Je(o.__H, e) && (o.__ = t(), o.__H = e, o.__h = t), o.__;
|
|
328
328
|
}
|
|
329
329
|
function Se(t, e) {
|
|
330
|
-
return H = 8,
|
|
330
|
+
return H = 8, W(function() {
|
|
331
331
|
return t;
|
|
332
332
|
}, e);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
var e = y.context[t.__c], o =
|
|
334
|
+
function Xe(t) {
|
|
335
|
+
var e = y.context[t.__c], o = ne(j++, 9);
|
|
336
336
|
return o.c = t, e ? (o.__ == null && (o.__ = !0, e.sub(y)), e.props.value) : t.__;
|
|
337
337
|
}
|
|
338
338
|
function wt() {
|
|
339
|
-
for (var t; t =
|
|
340
|
-
t.__H.__h.forEach(
|
|
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
341
|
} catch (e) {
|
|
342
|
-
t.__H.__h = [],
|
|
342
|
+
t.__H.__h = [], z.__e(e, t.__v);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
z.__b = function(t) {
|
|
346
346
|
y = null, be && be(t);
|
|
347
|
-
},
|
|
348
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
349
|
-
},
|
|
350
|
-
ke && ke(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
351
|
var e = (y = t.__c).__H;
|
|
352
|
-
e && (
|
|
352
|
+
e && (ie === y ? (e.__h = [], y.__h = [], e.__.forEach(function(o) {
|
|
353
353
|
o.__N && (o.__ = o.__N), o.u = o.__N = void 0;
|
|
354
|
-
})) : (e.__h.forEach(
|
|
355
|
-
},
|
|
354
|
+
})) : (e.__h.forEach(J), e.__h.forEach(ae), e.__h = [], j = 0)), ie = y;
|
|
355
|
+
}, z.diffed = function(t) {
|
|
356
356
|
Te && Te(t);
|
|
357
357
|
var e = t.__c;
|
|
358
|
-
e && e.__H && (e.__H.__h.length && (
|
|
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) {
|
|
359
359
|
o.u && (o.__H = o.u), o.u = void 0;
|
|
360
|
-
})),
|
|
361
|
-
},
|
|
360
|
+
})), ie = y = null;
|
|
361
|
+
}, z.__c = function(t, e) {
|
|
362
362
|
e.some(function(o) {
|
|
363
363
|
try {
|
|
364
|
-
o.__h.forEach(
|
|
365
|
-
return !n.__ ||
|
|
364
|
+
o.__h.forEach(J), o.__h = o.__h.filter(function(n) {
|
|
365
|
+
return !n.__ || ae(n);
|
|
366
366
|
});
|
|
367
367
|
} catch (n) {
|
|
368
368
|
e.some(function(i) {
|
|
369
369
|
i.__h && (i.__h = []);
|
|
370
|
-
}), e = [],
|
|
370
|
+
}), e = [], z.__e(n, o.__v);
|
|
371
371
|
}
|
|
372
372
|
}), ze && ze(t, e);
|
|
373
|
-
},
|
|
374
|
-
|
|
373
|
+
}, z.unmount = function(t) {
|
|
374
|
+
Le && Le(t);
|
|
375
375
|
var e, o = t.__c;
|
|
376
376
|
o && o.__H && (o.__H.__.forEach(function(n) {
|
|
377
377
|
try {
|
|
378
|
-
|
|
378
|
+
J(n);
|
|
379
379
|
} catch (i) {
|
|
380
380
|
e = i;
|
|
381
381
|
}
|
|
382
|
-
}), o.__H = void 0, e &&
|
|
382
|
+
}), o.__H = void 0, e && z.__e(e, o.__v));
|
|
383
383
|
};
|
|
384
384
|
var Ne = typeof requestAnimationFrame == "function";
|
|
385
385
|
function yt(t) {
|
|
@@ -388,11 +388,11 @@ function yt(t) {
|
|
|
388
388
|
}, n = setTimeout(o, 100);
|
|
389
389
|
Ne && (e = requestAnimationFrame(o));
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function J(t) {
|
|
392
392
|
var e = y, o = t.__c;
|
|
393
393
|
typeof o == "function" && (t.__c = void 0, o()), y = e;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function ae(t) {
|
|
396
396
|
var e = y;
|
|
397
397
|
t.__c = t.__(), y = e;
|
|
398
398
|
}
|
|
@@ -443,12 +443,16 @@ const bt = (t) => ({
|
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
445
|
}), Ze = Ve(void 0), kt = ({ children: t, config: e }) => {
|
|
446
|
-
const o =
|
|
446
|
+
const o = bt(e.lcPrefix + "score"), n = o.loadGameData(), [i, r] = I({
|
|
447
447
|
currentLevel: 1,
|
|
448
448
|
highestUnlockedLevel: 1,
|
|
449
449
|
currentTier: 1,
|
|
450
450
|
highestUnlockedTier: 1,
|
|
451
|
-
currentScore:
|
|
451
|
+
currentScore: {
|
|
452
|
+
atExit: !1,
|
|
453
|
+
allFood: !1,
|
|
454
|
+
noClue: !0
|
|
455
|
+
},
|
|
452
456
|
totalScore: 0,
|
|
453
457
|
levelScores: {},
|
|
454
458
|
isGameActive: !0,
|
|
@@ -459,54 +463,56 @@ const bt = (t) => ({
|
|
|
459
463
|
foodPositions: [],
|
|
460
464
|
playerPath: [],
|
|
461
465
|
visitCounts: {},
|
|
462
|
-
moveCount: 0,
|
|
463
466
|
playerAtExit: !1,
|
|
464
467
|
foodCollected: 0,
|
|
465
468
|
totalFoodCount: 0,
|
|
466
469
|
showClue: !1,
|
|
467
|
-
...
|
|
470
|
+
...n || {}
|
|
468
471
|
});
|
|
469
|
-
|
|
470
|
-
|
|
472
|
+
E(() => {
|
|
473
|
+
o.saveGameData(i);
|
|
471
474
|
}, [
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
475
|
+
i.highestUnlockedLevel,
|
|
476
|
+
i.levelScores,
|
|
477
|
+
i.totalScore,
|
|
478
|
+
i.currentLevel
|
|
476
479
|
]);
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
...
|
|
480
|
+
const s = () => {
|
|
481
|
+
o.resetGameData(), r((l) => ({
|
|
482
|
+
...l,
|
|
480
483
|
currentLevel: 1,
|
|
481
484
|
highestUnlockedLevel: 1,
|
|
482
485
|
currentTier: 1,
|
|
483
486
|
highestUnlockedTier: 1,
|
|
484
|
-
currentScore:
|
|
487
|
+
currentScore: {
|
|
488
|
+
atExit: !1,
|
|
489
|
+
allFood: !1,
|
|
490
|
+
noClue: !0
|
|
491
|
+
},
|
|
485
492
|
totalScore: 0,
|
|
486
493
|
levelScores: {},
|
|
487
494
|
isGameActive: !0,
|
|
488
495
|
levelTransitioning: !1,
|
|
489
496
|
playerPath: [],
|
|
490
497
|
visitCounts: {},
|
|
491
|
-
moveCount: 0,
|
|
492
498
|
foodCollected: 0,
|
|
493
499
|
showClue: !1
|
|
494
500
|
}));
|
|
495
501
|
};
|
|
496
|
-
return /* @__PURE__ */
|
|
502
|
+
return /* @__PURE__ */ f(
|
|
497
503
|
Ze.Provider,
|
|
498
504
|
{
|
|
499
505
|
value: {
|
|
500
|
-
gameState:
|
|
501
|
-
setGameState:
|
|
502
|
-
config:
|
|
503
|
-
resetGame:
|
|
506
|
+
gameState: i,
|
|
507
|
+
setGameState: r,
|
|
508
|
+
config: e,
|
|
509
|
+
resetGame: s
|
|
504
510
|
},
|
|
505
511
|
children: t
|
|
506
512
|
}
|
|
507
513
|
);
|
|
508
514
|
}, _e = () => {
|
|
509
|
-
const t =
|
|
515
|
+
const t = Xe(Ze);
|
|
510
516
|
if (!t)
|
|
511
517
|
throw new Error("useGameContext must be used within a GameProvider");
|
|
512
518
|
return t;
|
|
@@ -531,14 +537,14 @@ function zt(t) {
|
|
|
531
537
|
var e = window.devicePixelRatio, o = getComputedStyle(t), n = xe(o.getPropertyValue("width")), i = xe(o.getPropertyValue("height"));
|
|
532
538
|
t.setAttribute("width", (n * e).toString()), t.setAttribute("height", (i * e).toString());
|
|
533
539
|
}
|
|
534
|
-
function
|
|
540
|
+
function A(t, e) {
|
|
535
541
|
var o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, n = Math.random() * (e - t) + t;
|
|
536
542
|
return Math.floor(n * Math.pow(10, o)) / Math.pow(10, o);
|
|
537
543
|
}
|
|
538
544
|
function Ae(t) {
|
|
539
|
-
return t[
|
|
545
|
+
return t[A(0, t.length)];
|
|
540
546
|
}
|
|
541
|
-
var
|
|
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"];
|
|
542
548
|
function Ee(t) {
|
|
543
549
|
var e = 1920;
|
|
544
550
|
return Math.log(t) / Math.log(e);
|
|
@@ -546,17 +552,17 @@ function Ee(t) {
|
|
|
546
552
|
var Ie = /* @__PURE__ */ function() {
|
|
547
553
|
function t(e) {
|
|
548
554
|
fe(this, t);
|
|
549
|
-
var o = e.initialPosition, n = e.direction, i = e.confettiRadius, r = e.confettiColors, s = e.emojis, l = e.emojiSize, c = e.canvasWidth, a =
|
|
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);
|
|
550
556
|
this.confettiSpeed = {
|
|
551
557
|
x: d,
|
|
552
558
|
y: d
|
|
553
|
-
}, this.finalConfettiSpeedX =
|
|
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 = {
|
|
554
560
|
x: i,
|
|
555
561
|
y: i
|
|
556
|
-
}, this.initialRadius = i, this.rotationAngle = n === "left" ?
|
|
557
|
-
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;
|
|
558
564
|
this.absCos = Math.abs(Math.cos(u)), this.absSin = Math.abs(Math.sin(u));
|
|
559
|
-
var _ =
|
|
565
|
+
var _ = A(-150, 0), h = {
|
|
560
566
|
x: o.x + (n === "left" ? -_ : _) * this.absCos,
|
|
561
567
|
y: o.y - _ * this.absSin
|
|
562
568
|
};
|
|
@@ -572,7 +578,7 @@ var Ie = /* @__PURE__ */ function() {
|
|
|
572
578
|
key: "updatePosition",
|
|
573
579
|
value: function(o, n) {
|
|
574
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;
|
|
575
|
-
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 +
|
|
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) {
|
|
576
582
|
this.emojiRotationAngle += this.rotationSpeed * o % (2 * Math.PI);
|
|
577
583
|
return;
|
|
578
584
|
}
|
|
@@ -581,7 +587,7 @@ var Ie = /* @__PURE__ */ function() {
|
|
|
581
587
|
}, {
|
|
582
588
|
key: "getIsVisibleOnCanvas",
|
|
583
589
|
value: function(o) {
|
|
584
|
-
return this.currentPosition.y < o +
|
|
590
|
+
return this.currentPosition.y < o + Dt;
|
|
585
591
|
}
|
|
586
592
|
}]), t;
|
|
587
593
|
}();
|
|
@@ -664,7 +670,7 @@ var qt = /* @__PURE__ */ function() {
|
|
|
664
670
|
x: d,
|
|
665
671
|
y: _
|
|
666
672
|
}, g = new qt(this.canvasContext), p = 0; p < r / 2; p++) {
|
|
667
|
-
var
|
|
673
|
+
var m = new Ie({
|
|
668
674
|
initialPosition: h,
|
|
669
675
|
direction: "right",
|
|
670
676
|
confettiRadius: i,
|
|
@@ -683,7 +689,7 @@ var qt = /* @__PURE__ */ function() {
|
|
|
683
689
|
emojiSize: c,
|
|
684
690
|
canvasWidth: d
|
|
685
691
|
});
|
|
686
|
-
g.addShapes(
|
|
692
|
+
g.addShapes(m, C);
|
|
687
693
|
}
|
|
688
694
|
return this.activeConfettiBatches.push(g), this.queueAnimationFrameIfNeeded(), g.getBatchCompletePromise();
|
|
689
695
|
}
|
|
@@ -699,7 +705,7 @@ var qt = /* @__PURE__ */ function() {
|
|
|
699
705
|
}
|
|
700
706
|
}]), t;
|
|
701
707
|
}();
|
|
702
|
-
const Qe = Ve(void 0),
|
|
708
|
+
const Qe = Ve(void 0), Yt = ({ children: t }) => {
|
|
703
709
|
const [e, o] = I(null), [n, i] = I(!1), [r, s] = I(
|
|
704
710
|
"info"
|
|
705
711
|
), [l, c] = I(null), a = Se(() => {
|
|
@@ -715,7 +721,7 @@ const Qe = Ve(void 0), Xt = ({ children: t }) => {
|
|
|
715
721
|
},
|
|
716
722
|
[n, a]
|
|
717
723
|
);
|
|
718
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ f(
|
|
719
725
|
Qe.Provider,
|
|
720
726
|
{
|
|
721
727
|
value: { message: e, visible: n, type: r, showToast: d, hideToast: a },
|
|
@@ -723,18 +729,18 @@ const Qe = Ve(void 0), Xt = ({ children: t }) => {
|
|
|
723
729
|
}
|
|
724
730
|
);
|
|
725
731
|
}, ve = () => {
|
|
726
|
-
const t =
|
|
732
|
+
const t = Xe(Qe);
|
|
727
733
|
if (!t)
|
|
728
734
|
throw new Error("useToast must be used within a ToastProvider");
|
|
729
735
|
return t;
|
|
730
|
-
},
|
|
736
|
+
}, Xt = ({
|
|
731
737
|
i18n: t,
|
|
732
738
|
totalTiers: e,
|
|
733
739
|
currentTier: o,
|
|
734
740
|
highestUnlockedTier: n,
|
|
735
741
|
onTierChange: i,
|
|
736
742
|
disabled: r
|
|
737
|
-
}) => /* @__PURE__ */
|
|
743
|
+
}) => /* @__PURE__ */ f("div", { className: "tier-selector", children: /* @__PURE__ */ f(
|
|
738
744
|
"select",
|
|
739
745
|
{
|
|
740
746
|
value: o,
|
|
@@ -743,7 +749,7 @@ const Qe = Ve(void 0), Xt = ({ children: t }) => {
|
|
|
743
749
|
},
|
|
744
750
|
disabled: r,
|
|
745
751
|
className: "tier-dropdown",
|
|
746
|
-
children: Array.from({ length: e }, (s, l) => l + 1).map((s) => /* @__PURE__ */
|
|
752
|
+
children: Array.from({ length: e }, (s, l) => l + 1).map((s) => /* @__PURE__ */ f(
|
|
747
753
|
"option",
|
|
748
754
|
{
|
|
749
755
|
value: s,
|
|
@@ -768,7 +774,7 @@ const Qe = Ve(void 0), Xt = ({ children: t }) => {
|
|
|
768
774
|
score: v
|
|
769
775
|
};
|
|
770
776
|
}))(e);
|
|
771
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ f("div", { className: "level-selector", children: /* @__PURE__ */ f(
|
|
772
778
|
"select",
|
|
773
779
|
{
|
|
774
780
|
value: o,
|
|
@@ -777,7 +783,7 @@ const Qe = Ve(void 0), Xt = ({ children: t }) => {
|
|
|
777
783
|
},
|
|
778
784
|
disabled: r,
|
|
779
785
|
className: "level-dropdown",
|
|
780
|
-
children: c.map(({ level: a, score: d }) => /* @__PURE__ */
|
|
786
|
+
children: c.map(({ level: a, score: d }) => /* @__PURE__ */ f(
|
|
781
787
|
"option",
|
|
782
788
|
{
|
|
783
789
|
value: a,
|
|
@@ -788,36 +794,53 @@ const Qe = Ve(void 0), Xt = ({ children: t }) => {
|
|
|
788
794
|
))
|
|
789
795
|
}
|
|
790
796
|
) });
|
|
791
|
-
},
|
|
797
|
+
}, K = ({
|
|
792
798
|
isOpen: t,
|
|
793
799
|
title: e,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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",
|
|
807
|
+
onConfirm: a,
|
|
808
|
+
onCancel: d
|
|
802
809
|
}) => {
|
|
803
|
-
const
|
|
804
|
-
return
|
|
805
|
-
const
|
|
806
|
-
|
|
810
|
+
const u = U(null);
|
|
811
|
+
return E(() => {
|
|
812
|
+
const _ = (h) => {
|
|
813
|
+
h.key === "Escape" && d?.();
|
|
807
814
|
};
|
|
808
|
-
return t && document.addEventListener("keydown",
|
|
809
|
-
document.removeEventListener("keydown",
|
|
815
|
+
return t && document.addEventListener("keydown", _), () => {
|
|
816
|
+
document.removeEventListener("keydown", _);
|
|
810
817
|
};
|
|
811
|
-
}, [t,
|
|
818
|
+
}, [t, d]), /* @__PURE__ */ f(
|
|
812
819
|
"div",
|
|
813
820
|
{
|
|
814
821
|
className: `maze-dialog-overlay ${t ? "maze-dialog-visible" : ""}`,
|
|
815
|
-
children: /* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
!
|
|
820
|
-
|
|
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
|
+
)
|
|
821
844
|
] })
|
|
822
845
|
] })
|
|
823
846
|
}
|
|
@@ -965,7 +988,7 @@ const ge = [
|
|
|
965
988
|
{ size: 68, seed: 33341, method: "backtracking" }
|
|
966
989
|
// Level 60 - Master
|
|
967
990
|
]
|
|
968
|
-
],
|
|
991
|
+
], Z = {
|
|
969
992
|
lcPrefix: "maze-",
|
|
970
993
|
i18n: {
|
|
971
994
|
reset: "Reset",
|
|
@@ -985,7 +1008,14 @@ const ge = [
|
|
|
985
1008
|
clueOff: "Clue: OFF",
|
|
986
1009
|
foodCollectedToast: "Food collected! %NUM% remaining.",
|
|
987
1010
|
allFoodCollectedToast: "All food collected! Head to the exit.",
|
|
988
|
-
|
|
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",
|
|
989
1019
|
levelComplete: "Level Complete",
|
|
990
1020
|
starsCollected: "Stars Collected",
|
|
991
1021
|
avgStarPerLevel: "Avg. Stars per Level",
|
|
@@ -993,6 +1023,9 @@ const ge = [
|
|
|
993
1023
|
tierUnlockedToast: "Tier %TIER% unlocked! 🎉",
|
|
994
1024
|
levelGoToast: "Level %LEVEL% - Go!",
|
|
995
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",
|
|
996
1029
|
cluePathEnabled: "Clue Path Enabled",
|
|
997
1030
|
cluePathDisabled: "Clue Path Disabled",
|
|
998
1031
|
useArrowKeyTips: "Use arrow keys to navigate the maze. Press'C' to toggle path clue."
|
|
@@ -1009,7 +1042,6 @@ const ge = [
|
|
|
1009
1042
|
playerAtExitColor: "#FFD700"
|
|
1010
1043
|
},
|
|
1011
1044
|
levelConfig: ge
|
|
1012
|
-
// levelsPerTier: 12,
|
|
1013
1045
|
}, Zt = (t) => t === 1 ? 2 : t >= 2 && t <= 5 ? 3 : t >= 6 && t <= 11 ? 4 : t >= 12 && t <= 15 ? 5 : 6;
|
|
1014
1046
|
class Qt {
|
|
1015
1047
|
// initially all walls exit
|
|
@@ -1182,8 +1214,11 @@ const no = (t, e, o) => {
|
|
|
1182
1214
|
foodCollected: 0,
|
|
1183
1215
|
playerPath: [a],
|
|
1184
1216
|
visitCounts: { [`${a.row},${a.col}`]: 1 },
|
|
1185
|
-
|
|
1186
|
-
|
|
1217
|
+
currentScore: {
|
|
1218
|
+
atExit: !1,
|
|
1219
|
+
allFood: !1,
|
|
1220
|
+
noClue: !0
|
|
1221
|
+
},
|
|
1187
1222
|
playerAtExit: !1,
|
|
1188
1223
|
isGameActive: !0,
|
|
1189
1224
|
levelTransitioning: !1
|
|
@@ -1194,13 +1229,16 @@ const no = (t, e, o) => {
|
|
|
1194
1229
|
config: o
|
|
1195
1230
|
}) => ({
|
|
1196
1231
|
generateCurrentLevelMaze: () => {
|
|
1197
|
-
const i = et(
|
|
1232
|
+
const i = et(
|
|
1233
|
+
t.currentLevel,
|
|
1234
|
+
o.levelConfig.flat()
|
|
1235
|
+
);
|
|
1198
1236
|
i && e((r) => ({
|
|
1199
1237
|
...r,
|
|
1200
1238
|
...i
|
|
1201
1239
|
}));
|
|
1202
1240
|
}
|
|
1203
|
-
}), ot = (t) =>
|
|
1241
|
+
}), ot = (t) => W(() => {
|
|
1204
1242
|
const e = t.map((l) => l.length), o = e.reduce((l, c) => l + c, 0), n = t.length, i = (l) => {
|
|
1205
1243
|
if (l < 1 || l > o) return 0;
|
|
1206
1244
|
let c = 0;
|
|
@@ -1254,7 +1292,7 @@ const no = (t, e, o) => {
|
|
|
1254
1292
|
};
|
|
1255
1293
|
return s;
|
|
1256
1294
|
}, [t]), io = () => {
|
|
1257
|
-
const { gameState: t, setGameState: e, resetGame: o, config: n } = _e(), i = n.
|
|
1295
|
+
const { gameState: t, setGameState: e, resetGame: o, config: n } = _e(), i = n.i18n, r = n.levelConfig, s = ot(r), { showToast: l } = ve(), {
|
|
1258
1296
|
totalScore: c,
|
|
1259
1297
|
showClue: a,
|
|
1260
1298
|
currentTier: d,
|
|
@@ -1262,23 +1300,23 @@ const no = (t, e, o) => {
|
|
|
1262
1300
|
highestUnlockedTier: _,
|
|
1263
1301
|
highestUnlockedLevel: h,
|
|
1264
1302
|
levelTransitioning: v
|
|
1265
|
-
} = t, g = s.getTotalLevels(), p = s.getTotalTiers(), [
|
|
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({
|
|
1266
1304
|
gameState: t,
|
|
1267
1305
|
setGameState: e,
|
|
1268
1306
|
config: n
|
|
1269
1307
|
});
|
|
1270
|
-
|
|
1271
|
-
|
|
1308
|
+
E(() => {
|
|
1309
|
+
M(s.getTierLevelsRange(d));
|
|
1272
1310
|
}, [d]);
|
|
1273
|
-
const
|
|
1274
|
-
const
|
|
1275
|
-
s.isLevelUnlocked(
|
|
1276
|
-
},
|
|
1277
|
-
s.isLevelUnlocked(
|
|
1278
|
-
...
|
|
1279
|
-
currentLevel:
|
|
1280
|
-
})),
|
|
1281
|
-
i.levelGoToast.replace("%LEVEL%",
|
|
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()),
|
|
1282
1320
|
"success"
|
|
1283
1321
|
));
|
|
1284
1322
|
}, R = () => {
|
|
@@ -1286,48 +1324,52 @@ const no = (t, e, o) => {
|
|
|
1286
1324
|
}, nt = () => {
|
|
1287
1325
|
C(!1);
|
|
1288
1326
|
}, it = () => {
|
|
1289
|
-
|
|
1327
|
+
b(!0);
|
|
1290
1328
|
}, rt = () => {
|
|
1291
|
-
|
|
1329
|
+
b(!1);
|
|
1292
1330
|
}, st = () => {
|
|
1293
|
-
e((
|
|
1294
|
-
...
|
|
1295
|
-
|
|
1296
|
-
|
|
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);
|
|
1297
1339
|
}, lt = () => {
|
|
1298
|
-
|
|
1340
|
+
k(!0);
|
|
1299
1341
|
}, at = () => {
|
|
1300
|
-
o(),
|
|
1342
|
+
o(), k(!1), l(i.resetDoneToast);
|
|
1301
1343
|
}, ct = () => {
|
|
1302
|
-
|
|
1344
|
+
k(!1);
|
|
1303
1345
|
};
|
|
1304
|
-
return /* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
|
|
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,
|
|
1309
1351
|
{
|
|
1310
1352
|
i18n: i,
|
|
1311
1353
|
totalTiers: p,
|
|
1312
1354
|
currentTier: d,
|
|
1313
1355
|
highestUnlockedTier: _,
|
|
1314
|
-
onTierChange:
|
|
1356
|
+
onTierChange: O,
|
|
1315
1357
|
disabled: v
|
|
1316
1358
|
}
|
|
1317
1359
|
),
|
|
1318
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ f(
|
|
1319
1361
|
Jt,
|
|
1320
1362
|
{
|
|
1321
1363
|
i18n: i,
|
|
1322
|
-
levelsRange:
|
|
1364
|
+
levelsRange: T,
|
|
1323
1365
|
currentLevel: u,
|
|
1324
1366
|
highestUnlockedLevel: h,
|
|
1325
|
-
onLevelChange:
|
|
1367
|
+
onLevelChange: L,
|
|
1326
1368
|
disabled: v
|
|
1327
1369
|
}
|
|
1328
1370
|
)
|
|
1329
1371
|
] }),
|
|
1330
|
-
/* @__PURE__ */
|
|
1372
|
+
/* @__PURE__ */ f(
|
|
1331
1373
|
"button",
|
|
1332
1374
|
{
|
|
1333
1375
|
className: `settings-clue-button ${a ? "clue-on" : "clue-off"}`,
|
|
@@ -1338,23 +1380,23 @@ const no = (t, e, o) => {
|
|
|
1338
1380
|
}
|
|
1339
1381
|
)
|
|
1340
1382
|
] }),
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
|
|
1383
|
+
/* @__PURE__ */ f("div", { className: "game-settings", children: /* @__PURE__ */ f("span", { className: "game-settings-icon", onClick: R, children: "★ " + c }) }),
|
|
1384
|
+
/* @__PURE__ */ f(
|
|
1385
|
+
K,
|
|
1344
1386
|
{
|
|
1345
|
-
isOpen:
|
|
1387
|
+
isOpen: m,
|
|
1346
1388
|
title: i.settings,
|
|
1347
1389
|
noConfirm: !0,
|
|
1348
1390
|
cancelText: i.close,
|
|
1349
1391
|
onCancel: nt,
|
|
1350
1392
|
children: [
|
|
1351
|
-
/* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
/* @__PURE__ */
|
|
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) })
|
|
1355
1397
|
] }),
|
|
1356
|
-
/* @__PURE__ */
|
|
1357
|
-
/* @__PURE__ */
|
|
1398
|
+
/* @__PURE__ */ f("div", { className: "settings-item-box", children: [
|
|
1399
|
+
/* @__PURE__ */ f(
|
|
1358
1400
|
"button",
|
|
1359
1401
|
{
|
|
1360
1402
|
className: "settings-reset-button",
|
|
@@ -1363,15 +1405,15 @@ const no = (t, e, o) => {
|
|
|
1363
1405
|
children: i.reset
|
|
1364
1406
|
}
|
|
1365
1407
|
),
|
|
1366
|
-
/* @__PURE__ */
|
|
1408
|
+
/* @__PURE__ */ f("div", { className: "settings-item-tip", children: i.resetTip })
|
|
1367
1409
|
] })
|
|
1368
1410
|
]
|
|
1369
1411
|
}
|
|
1370
1412
|
),
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
|
|
1413
|
+
/* @__PURE__ */ f(
|
|
1414
|
+
K,
|
|
1373
1415
|
{
|
|
1374
|
-
isOpen:
|
|
1416
|
+
isOpen: P,
|
|
1375
1417
|
title: i.confirmReset,
|
|
1376
1418
|
message: i.confirmResetMessage,
|
|
1377
1419
|
confirmText: i.reset,
|
|
@@ -1380,10 +1422,10 @@ const no = (t, e, o) => {
|
|
|
1380
1422
|
onCancel: ct
|
|
1381
1423
|
}
|
|
1382
1424
|
),
|
|
1383
|
-
/* @__PURE__ */
|
|
1384
|
-
|
|
1425
|
+
/* @__PURE__ */ f(
|
|
1426
|
+
K,
|
|
1385
1427
|
{
|
|
1386
|
-
isOpen:
|
|
1428
|
+
isOpen: N,
|
|
1387
1429
|
title: i.confirmClue,
|
|
1388
1430
|
message: i.confirmClueMessage,
|
|
1389
1431
|
confirmText: i.confirm,
|
|
@@ -1400,15 +1442,15 @@ const no = (t, e, o) => {
|
|
|
1400
1442
|
onClose: n,
|
|
1401
1443
|
position: i = "center",
|
|
1402
1444
|
type: r = "info"
|
|
1403
|
-
}) => t ? (
|
|
1445
|
+
}) => t ? (E(() => {
|
|
1404
1446
|
let s;
|
|
1405
1447
|
return e && o > 0 && n && (s = setTimeout(() => {
|
|
1406
1448
|
n();
|
|
1407
1449
|
}, o)), () => {
|
|
1408
1450
|
s && clearTimeout(s);
|
|
1409
1451
|
};
|
|
1410
|
-
}, [e, o, n]), /* @__PURE__ */
|
|
1411
|
-
|
|
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(() => {
|
|
1412
1454
|
const n = () => {
|
|
1413
1455
|
const i = t.current;
|
|
1414
1456
|
if (!i) return;
|
|
@@ -1430,7 +1472,7 @@ const no = (t, e, o) => {
|
|
|
1430
1472
|
setGameState: o,
|
|
1431
1473
|
onFoodCollected: n
|
|
1432
1474
|
}) => {
|
|
1433
|
-
|
|
1475
|
+
E(() => {
|
|
1434
1476
|
const i = (l) => {
|
|
1435
1477
|
if (!e.isGameActive || !e.maze) return;
|
|
1436
1478
|
const [c, a] = Me[l], { row: d, col: u } = e.playerPosition, _ = d + c, h = u + a;
|
|
@@ -1439,31 +1481,34 @@ const no = (t, e, o) => {
|
|
|
1439
1481
|
if (c === -1 && v.walls.top || c === 1 && v.walls.bottom || a === -1 && v.walls.left || a === 1 && v.walls.right)
|
|
1440
1482
|
return;
|
|
1441
1483
|
const g = { row: _, col: h }, p = `${_},${h}`;
|
|
1442
|
-
o((
|
|
1443
|
-
const C =
|
|
1444
|
-
(
|
|
1484
|
+
o((m) => {
|
|
1485
|
+
const C = m.foodPositions.some(
|
|
1486
|
+
(T) => T.row === _ && T.col === h
|
|
1445
1487
|
);
|
|
1446
1488
|
C && n();
|
|
1447
|
-
const
|
|
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;
|
|
1448
1490
|
return {
|
|
1449
|
-
...
|
|
1491
|
+
...m,
|
|
1450
1492
|
playerPosition: g,
|
|
1451
|
-
playerPath: [...
|
|
1452
|
-
foodPositions:
|
|
1453
|
-
(
|
|
1493
|
+
playerPath: [...m.playerPath, g],
|
|
1494
|
+
foodPositions: m.foodPositions.filter(
|
|
1495
|
+
(T) => !(T.row === _ && T.col === h)
|
|
1454
1496
|
),
|
|
1455
|
-
foodCollected:
|
|
1497
|
+
foodCollected: N,
|
|
1456
1498
|
// if not complete, then just 0, if complete, then count the ⭐️ by 3 conditions
|
|
1457
|
-
currentScore:
|
|
1499
|
+
currentScore: {
|
|
1500
|
+
atExit: k,
|
|
1501
|
+
allFood: b,
|
|
1502
|
+
noClue: !m.showClue
|
|
1503
|
+
},
|
|
1458
1504
|
visitCounts: {
|
|
1459
|
-
...
|
|
1460
|
-
[
|
|
1461
|
-
[p]: (
|
|
1505
|
+
...m.visitCounts,
|
|
1506
|
+
[P]: (m.visitCounts[P] || 0) + 1,
|
|
1507
|
+
[p]: (m.visitCounts[p] || 0) + 1
|
|
1462
1508
|
},
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
levelTransitioning: b
|
|
1509
|
+
playerAtExit: k,
|
|
1510
|
+
isGameActive: !k,
|
|
1511
|
+
levelTransitioning: k
|
|
1467
1512
|
};
|
|
1468
1513
|
});
|
|
1469
1514
|
}, r = (l) => {
|
|
@@ -1493,48 +1538,43 @@ const no = (t, e, o) => {
|
|
|
1493
1538
|
onLevelComplete: n,
|
|
1494
1539
|
onTierUnlocked: i
|
|
1495
1540
|
}) => {
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
n();
|
|
1499
|
-
const l = setTimeout(() => {
|
|
1500
|
-
s(
|
|
1501
|
-
t.currentScore,
|
|
1502
|
-
o.current.levelConfig
|
|
1503
|
-
);
|
|
1504
|
-
}, 1e3);
|
|
1505
|
-
return () => clearTimeout(l);
|
|
1506
|
-
}
|
|
1541
|
+
E(() => {
|
|
1542
|
+
t.levelTransitioning && n();
|
|
1507
1543
|
}, [t.levelTransitioning]);
|
|
1508
|
-
const r =
|
|
1509
|
-
const a = r.getNextLevelInfo(
|
|
1510
|
-
t.currentLevel
|
|
1511
|
-
);
|
|
1512
|
-
if (!a) return;
|
|
1513
|
-
const { nextLevel: d, nextTier: u, isTierChange: _ } = a, h = et(d, c.flat());
|
|
1514
|
-
h && e((v) => {
|
|
1515
|
-
_ && i(u);
|
|
1516
|
-
const g = { ...v.levelScores };
|
|
1517
|
-
return g[v.currentLevel] = Math.max(
|
|
1518
|
-
l,
|
|
1519
|
-
g[v.currentLevel] || 0
|
|
1520
|
-
), {
|
|
1521
|
-
...v,
|
|
1522
|
-
...h,
|
|
1523
|
-
currentLevel: d,
|
|
1524
|
-
currentTier: u,
|
|
1525
|
-
highestUnlockedLevel: Math.max(v.highestUnlockedLevel, d),
|
|
1526
|
-
highestUnlockedTier: Math.max(v.highestUnlockedTier, u),
|
|
1527
|
-
levelScores: g,
|
|
1528
|
-
totalScore: Object.values(g).reduce((p, f) => p + f, 0),
|
|
1529
|
-
showClue: !1,
|
|
1530
|
-
// reset to false on new level
|
|
1531
|
-
isGameActive: !0,
|
|
1532
|
-
levelTransitioning: !1
|
|
1533
|
-
};
|
|
1534
|
-
});
|
|
1535
|
-
};
|
|
1544
|
+
const r = o.levelConfig, s = ot(r);
|
|
1536
1545
|
return {
|
|
1537
|
-
|
|
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
|
+
}
|
|
1538
1578
|
};
|
|
1539
1579
|
};
|
|
1540
1580
|
function co(t, e) {
|
|
@@ -1549,31 +1589,31 @@ function co(t, e) {
|
|
|
1549
1589
|
foodColor: u,
|
|
1550
1590
|
clueColor: _,
|
|
1551
1591
|
backgroundColor: h
|
|
1552
|
-
} = e, v = r.cols, g = r.rows, p = (n - s * 2) / v,
|
|
1592
|
+
} = e, v = r.cols, g = r.rows, p = (n - s * 2) / v, m = (i - s * 2) / g;
|
|
1553
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, {
|
|
1554
1594
|
cellWidth: p,
|
|
1555
|
-
cellHeight:
|
|
1595
|
+
cellHeight: m,
|
|
1556
1596
|
padding: s,
|
|
1557
1597
|
clueColor: _
|
|
1558
1598
|
}), uo(t, {
|
|
1559
1599
|
cellWidth: p,
|
|
1560
|
-
cellHeight:
|
|
1600
|
+
cellHeight: m,
|
|
1561
1601
|
padding: s,
|
|
1562
1602
|
wallColor: c,
|
|
1563
1603
|
wallWidth: l
|
|
1564
1604
|
}), fo(t, {
|
|
1565
1605
|
cellWidth: p,
|
|
1566
|
-
cellHeight:
|
|
1606
|
+
cellHeight: m,
|
|
1567
1607
|
padding: s,
|
|
1568
1608
|
foodColor: u
|
|
1569
1609
|
}), t.playerAtExit || _o(t, {
|
|
1570
1610
|
cellWidth: p,
|
|
1571
|
-
cellHeight:
|
|
1611
|
+
cellHeight: m,
|
|
1572
1612
|
padding: s,
|
|
1573
1613
|
exitColor: d
|
|
1574
1614
|
}), ho(t, {
|
|
1575
1615
|
cellWidth: p,
|
|
1576
|
-
cellHeight:
|
|
1616
|
+
cellHeight: m,
|
|
1577
1617
|
padding: s,
|
|
1578
1618
|
playerColor: a
|
|
1579
1619
|
});
|
|
@@ -1589,7 +1629,7 @@ function uo(t, e) {
|
|
|
1589
1629
|
o.stroke(), o.restore();
|
|
1590
1630
|
}
|
|
1591
1631
|
function ho(t, e) {
|
|
1592
|
-
const { ctx: o, playerPosition: n } = t, { cellWidth: i, cellHeight: r, padding: s, playerColor: l } = e, { x: c, y: a } =
|
|
1632
|
+
const { ctx: o, playerPosition: n } = t, { cellWidth: i, cellHeight: r, padding: s, playerColor: l } = e, { x: c, y: a } = B(
|
|
1593
1633
|
n.row,
|
|
1594
1634
|
n.col,
|
|
1595
1635
|
i,
|
|
@@ -1599,7 +1639,7 @@ function ho(t, e) {
|
|
|
1599
1639
|
o.save(), o.fillStyle = l, o.beginPath(), o.arc(c, a, d, 0, Math.PI * 2), o.fill(), o.restore();
|
|
1600
1640
|
}
|
|
1601
1641
|
function _o(t, e) {
|
|
1602
|
-
const { ctx: o, exitPosition: n } = t, { cellWidth: i, cellHeight: r, padding: s, exitColor: l } = e, { x: c, y: a } =
|
|
1642
|
+
const { ctx: o, exitPosition: n } = t, { cellWidth: i, cellHeight: r, padding: s, exitColor: l } = e, { x: c, y: a } = B(
|
|
1603
1643
|
n.row,
|
|
1604
1644
|
n.col,
|
|
1605
1645
|
i,
|
|
@@ -1613,7 +1653,7 @@ function fo(t, e) {
|
|
|
1613
1653
|
o.fillStyle = l;
|
|
1614
1654
|
const c = Math.min(i, r) * 0.25;
|
|
1615
1655
|
n.forEach((a) => {
|
|
1616
|
-
const { x: d, y: u } =
|
|
1656
|
+
const { x: d, y: u } = B(
|
|
1617
1657
|
a.row,
|
|
1618
1658
|
a.col,
|
|
1619
1659
|
i,
|
|
@@ -1643,25 +1683,25 @@ function vo(t, e) {
|
|
|
1643
1683
|
o.strokeStyle = `rgba(255, 0, 0, ${g})`;
|
|
1644
1684
|
}
|
|
1645
1685
|
o.lineWidth = p, o.lineCap = "round", o.lineJoin = "round";
|
|
1646
|
-
const { x:
|
|
1686
|
+
const { x: m, y: C } = B(
|
|
1647
1687
|
d.row,
|
|
1648
1688
|
d.col,
|
|
1649
1689
|
r,
|
|
1650
1690
|
s,
|
|
1651
1691
|
l
|
|
1652
|
-
), { x:
|
|
1692
|
+
), { x: P, y: k } = B(
|
|
1653
1693
|
u.row,
|
|
1654
1694
|
u.col,
|
|
1655
1695
|
r,
|
|
1656
1696
|
s,
|
|
1657
1697
|
l
|
|
1658
1698
|
);
|
|
1659
|
-
o.beginPath(), o.moveTo(
|
|
1699
|
+
o.beginPath(), o.moveTo(m, C), o.lineTo(P, k), o.stroke();
|
|
1660
1700
|
}
|
|
1661
1701
|
o.restore();
|
|
1662
1702
|
}
|
|
1663
1703
|
}
|
|
1664
|
-
function
|
|
1704
|
+
function B(t, e, o, n, i) {
|
|
1665
1705
|
return {
|
|
1666
1706
|
x: i + e * o + o / 2,
|
|
1667
1707
|
y: i + t * n + n / 2
|
|
@@ -1669,7 +1709,7 @@ function W(t, e, o, n, i) {
|
|
|
1669
1709
|
}
|
|
1670
1710
|
const go = new Vt(), po = () => {
|
|
1671
1711
|
const { message: t, visible: e, type: o, hideToast: n } = ve();
|
|
1672
|
-
return /* @__PURE__ */
|
|
1712
|
+
return /* @__PURE__ */ f(
|
|
1673
1713
|
ro,
|
|
1674
1714
|
{
|
|
1675
1715
|
message: t,
|
|
@@ -1680,78 +1720,93 @@ const go = new Vt(), po = () => {
|
|
|
1680
1720
|
}
|
|
1681
1721
|
);
|
|
1682
1722
|
}, Co = () => {
|
|
1683
|
-
const { gameState: t, setGameState: e, config: o } = _e(), n = U(null), i = U(null), r = U(t), s = o.
|
|
1684
|
-
|
|
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(() => {
|
|
1685
1725
|
r.current = t;
|
|
1686
1726
|
}, [t]);
|
|
1687
|
-
const
|
|
1688
|
-
const
|
|
1689
|
-
if (
|
|
1727
|
+
const _ = () => {
|
|
1728
|
+
const b = t.totalFoodCount - t.foodCollected - 1;
|
|
1729
|
+
if (b > 0) {
|
|
1690
1730
|
l(
|
|
1691
|
-
s.foodCollectedToast.replace("%NUM%",
|
|
1731
|
+
s.foodCollectedToast.replace("%NUM%", b.toString()),
|
|
1692
1732
|
"success"
|
|
1693
1733
|
);
|
|
1694
1734
|
return;
|
|
1695
1735
|
}
|
|
1696
1736
|
l(s.allFoodCollectedToast, "success");
|
|
1697
|
-
},
|
|
1698
|
-
const
|
|
1699
|
-
if (!
|
|
1737
|
+
}, h = (b, T) => {
|
|
1738
|
+
const M = b.current?.getContext("2d");
|
|
1739
|
+
if (!M || !T.maze || c.current) return;
|
|
1700
1740
|
c.current = !0;
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1741
|
+
const x = { ...o.renderConfig || {} }, L = o.levelConfig.flat()[T.currentLevel - 1];
|
|
1742
|
+
x.wallWidth = L.wallWidth || x.wallWidth, co(
|
|
1703
1743
|
{
|
|
1704
|
-
ctx:
|
|
1705
|
-
width:
|
|
1706
|
-
height:
|
|
1707
|
-
maze:
|
|
1708
|
-
playerPosition:
|
|
1709
|
-
exitPosition:
|
|
1710
|
-
foodPositions:
|
|
1711
|
-
showClue:
|
|
1712
|
-
playerPath:
|
|
1713
|
-
visitCounts:
|
|
1714
|
-
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
|
|
1715
1755
|
},
|
|
1716
|
-
|
|
1756
|
+
x
|
|
1717
1757
|
), requestAnimationFrame(() => {
|
|
1718
1758
|
c.current = !1;
|
|
1719
1759
|
});
|
|
1720
1760
|
};
|
|
1721
|
-
|
|
1761
|
+
E(() => {
|
|
1722
1762
|
l(s.useArrowKeyTips, "info", 3e3);
|
|
1723
|
-
}, []), so(i,
|
|
1724
|
-
const { generateCurrentLevelMaze:
|
|
1763
|
+
}, []), so(i, h, r);
|
|
1764
|
+
const { generateCurrentLevelMaze: v } = tt({
|
|
1725
1765
|
gameState: t,
|
|
1726
1766
|
setGameState: e,
|
|
1727
1767
|
config: o
|
|
1728
1768
|
});
|
|
1729
|
-
|
|
1769
|
+
lo({
|
|
1730
1770
|
containerRef: n,
|
|
1731
1771
|
gameState: t,
|
|
1732
1772
|
setGameState: e,
|
|
1733
|
-
onFoodCollected:
|
|
1734
|
-
})
|
|
1773
|
+
onFoodCollected: _
|
|
1774
|
+
});
|
|
1775
|
+
const { goNextLevel: g, isLastLevel: p } = ao({
|
|
1735
1776
|
gameState: t,
|
|
1736
1777
|
setGameState: e,
|
|
1737
1778
|
config: o,
|
|
1738
1779
|
onLevelComplete: () => {
|
|
1739
|
-
go.addConfetti(), l(s.levelCompleteToast, "success");
|
|
1780
|
+
go.addConfetti(), l(s.levelCompleteToast, "success"), u(!0);
|
|
1740
1781
|
},
|
|
1741
|
-
onTierUnlocked: (
|
|
1782
|
+
onTierUnlocked: (b) => {
|
|
1742
1783
|
l(
|
|
1743
|
-
s.tierUnlockedToast.replace("%TIER%",
|
|
1784
|
+
s.tierUnlockedToast.replace("%TIER%", b.toString()),
|
|
1744
1785
|
"success"
|
|
1745
1786
|
);
|
|
1746
1787
|
}
|
|
1747
|
-
}),
|
|
1748
|
-
|
|
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();
|
|
1749
1804
|
}, [
|
|
1750
1805
|
t.currentLevel,
|
|
1751
1806
|
t.isGameActive,
|
|
1752
1807
|
t.levelTransitioning
|
|
1753
|
-
]),
|
|
1754
|
-
i.current && t.maze &&
|
|
1808
|
+
]), E(() => {
|
|
1809
|
+
i.current && t.maze && h(i, t);
|
|
1755
1810
|
}, [
|
|
1756
1811
|
t.maze,
|
|
1757
1812
|
t.playerPosition,
|
|
@@ -1761,34 +1816,57 @@ const go = new Vt(), po = () => {
|
|
|
1761
1816
|
t.playerPath,
|
|
1762
1817
|
t.visitCounts,
|
|
1763
1818
|
t.playerAtExit
|
|
1764
|
-
]), /* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
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" })
|
|
1773
1851
|
] })
|
|
1774
1852
|
] });
|
|
1775
1853
|
};
|
|
1776
1854
|
function wo() {
|
|
1777
|
-
return /* @__PURE__ */
|
|
1855
|
+
return /* @__PURE__ */ f(Yt, { children: /* @__PURE__ */ f(Co, {}) });
|
|
1778
1856
|
}
|
|
1779
1857
|
function yo({ config: t = {} }) {
|
|
1780
|
-
const e = { ...
|
|
1858
|
+
const e = { ...Z.i18n, ...t.i18n || {} }, o = { ...Z.renderConfig, ...t.renderConfig || {} }, n = t.levelConfig || ge;
|
|
1781
1859
|
return t = {
|
|
1782
|
-
...
|
|
1860
|
+
...Z,
|
|
1783
1861
|
...t,
|
|
1784
1862
|
i18n: e,
|
|
1785
1863
|
levelConfig: n,
|
|
1786
1864
|
renderConfig: o
|
|
1787
|
-
}, /* @__PURE__ */
|
|
1865
|
+
}, /* @__PURE__ */ f(kt, { config: t, children: /* @__PURE__ */ f(wo, {}) });
|
|
1788
1866
|
}
|
|
1789
1867
|
const bo = {
|
|
1790
|
-
root: "https://unpkg.com/@roudanio/maze@0.0.
|
|
1791
|
-
...
|
|
1868
|
+
root: "https://unpkg.com/@roudanio/maze@0.0.9/dist/",
|
|
1869
|
+
...Z
|
|
1792
1870
|
};
|
|
1793
1871
|
`${JSON.stringify(bo, null, 2)}`;
|
|
1794
1872
|
const ko = {
|
|
@@ -1824,7 +1902,7 @@ const ko = {
|
|
|
1824
1902
|
}`, document.head.appendChild(s), await (async (c) => new Promise((a, d) => {
|
|
1825
1903
|
const u = document.createElement("link");
|
|
1826
1904
|
u.rel = "stylesheet", u.type = "text/css", u.href = c, u.onload = a, u.onerror = d, document.head.appendChild(u);
|
|
1827
|
-
}))(n + "maze.css"), gt(/* @__PURE__ */
|
|
1905
|
+
}))(n + "maze.css"), gt(/* @__PURE__ */ f(yo, { config: e }), o);
|
|
1828
1906
|
}
|
|
1829
1907
|
};
|
|
1830
1908
|
export {
|