@roudanio/maze 0.0.4 → 0.0.5
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.iife.js +6 -6
- package/dist/maze.js +383 -364
- package/dist/maze.umd.js +5 -5
- package/package.json +1 -1
package/dist/maze.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ne,
|
|
1
|
+
var ne, y, qe, O, we, Xe, Ye, Je, de, ae, ce, Ke, B = {}, Ze = [], St = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, X = Array.isArray;
|
|
2
2
|
function I(e, t) {
|
|
3
3
|
for (var o in t) e[o] = t[o];
|
|
4
4
|
return e;
|
|
@@ -14,18 +14,18 @@ function D(e, t, o) {
|
|
|
14
14
|
}
|
|
15
15
|
function Z(e, t, o, n, i) {
|
|
16
16
|
var r = { type: e, props: t, key: o, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++qe, __i: -1, __u: 0 };
|
|
17
|
-
return i == null &&
|
|
17
|
+
return i == null && y.vnode != null && y.vnode(r), r;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function W(e) {
|
|
20
20
|
return e.children;
|
|
21
21
|
}
|
|
22
22
|
function R(e, t) {
|
|
23
23
|
this.props = e, this.context = t;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
if (t == null) return e.__ ?
|
|
25
|
+
function j(e, t) {
|
|
26
|
+
if (t == null) return e.__ ? j(e.__, e.__i + 1) : null;
|
|
27
27
|
for (var o; t < e.__k.length; t++) if ((o = e.__k[t]) != null && o.__e != null) return o.__e;
|
|
28
|
-
return typeof e.type == "function" ?
|
|
28
|
+
return typeof e.type == "function" ? j(e) : null;
|
|
29
29
|
}
|
|
30
30
|
function Qe(e) {
|
|
31
31
|
var t, o;
|
|
@@ -38,21 +38,21 @@ function Qe(e) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function ue(e) {
|
|
41
|
-
(!e.__d && (e.__d = !0) && O.push(e) && !te.__r++ || we !=
|
|
41
|
+
(!e.__d && (e.__d = !0) && O.push(e) && !te.__r++ || we != y.debounceRendering) && ((we = y.debounceRendering) || Xe)(te);
|
|
42
42
|
}
|
|
43
43
|
function te() {
|
|
44
|
-
for (var e, t, o, n, i, r, s,
|
|
44
|
+
for (var e, t, o, n, i, r, s, l = 1; O.length; ) O.length > l && O.sort(Ye), e = O.shift(), l = O.length, e.__d && (o = void 0, i = (n = (t = e).__v).__e, r = [], s = [], t.__P && ((o = I({}, n)).__v = n.__v + 1, y.vnode && y.vnode(o), fe(t.__P, o, n, t.__n, t.__P.namespaceURI, 32 & n.__u ? [i] : null, r, i ?? j(n), !!(32 & n.__u), s), o.__v = n.__v, o.__.__k[o.__i] = o, ot(r, o, s), o.__e != i && Qe(o)));
|
|
45
45
|
te.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function et(e, t, o, n, i, r, s,
|
|
48
|
-
var u, h, d,
|
|
49
|
-
for (
|
|
50
|
-
return o.__e =
|
|
47
|
+
function et(e, t, o, n, i, r, s, l, a, c, _) {
|
|
48
|
+
var u, h, d, v, m, C, g = n && n.__k || Ze, p = t.length;
|
|
49
|
+
for (a = Lt(o, t, g, a, p), u = 0; u < p; u++) (d = o.__k[u]) != null && (h = d.__i == -1 ? B : g[d.__i] || B, d.__i = u, C = fe(e, d, h, i, r, s, l, a, c, _), v = d.__e, d.ref && h.ref != d.ref && (h.ref && me(h.ref, null, d), _.push(d.ref, d.__c || v, d)), m == null && v != null && (m = v), 4 & d.__u || h.__k === d.__k ? a = tt(d, a, e) : typeof d.type == "function" && C !== void 0 ? a = C : v && (a = v.nextSibling), d.__u &= -7);
|
|
50
|
+
return o.__e = m, a;
|
|
51
51
|
}
|
|
52
52
|
function Lt(e, t, o, n, i) {
|
|
53
|
-
var r, s,
|
|
54
|
-
for (e.__k = new Array(i), r = 0; r < i; r++) (s = t[r]) != null && typeof s != "boolean" && typeof s != "function" ? (
|
|
55
|
-
if (u) for (r = 0; r < _; r++) (
|
|
53
|
+
var r, s, l, a, c, _ = o.length, u = _, h = 0;
|
|
54
|
+
for (e.__k = new Array(i), r = 0; r < i; r++) (s = t[r]) != null && typeof s != "boolean" && typeof s != "function" ? (a = r + h, (s = e.__k[r] = typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Z(null, s, null, null, null) : X(s) ? Z(W, { children: s }, null, null, null) : s.constructor == null && s.__b > 0 ? Z(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s).__ = e, s.__b = e.__b + 1, l = null, (c = s.__i = xt(s, o, a, u)) != -1 && (u--, (l = o[c]) && (l.__u |= 2)), l == null || l.__v == null ? (c == -1 && (i > _ ? h-- : i < _ && h++), typeof s.type != "function" && (s.__u |= 4)) : c != a && (c == a - 1 ? h-- : c == a + 1 ? h++ : (c > a ? h-- : h++, s.__u |= 4))) : e.__k[r] = null;
|
|
55
|
+
if (u) for (r = 0; r < _; r++) (l = o[r]) != null && (2 & l.__u) == 0 && (l.__e == n && (n = j(l)), it(l, l));
|
|
56
56
|
return n;
|
|
57
57
|
}
|
|
58
58
|
function tt(e, t, o) {
|
|
@@ -61,7 +61,7 @@ function tt(e, t, o) {
|
|
|
61
61
|
for (n = e.__k, i = 0; n && i < n.length; i++) n[i] && (n[i].__ = e, t = tt(n[i], t, o));
|
|
62
62
|
return t;
|
|
63
63
|
}
|
|
64
|
-
e.__e != t && (t && e.type && !o.contains(t) && (t =
|
|
64
|
+
e.__e != t && (t && e.type && !o.contains(t) && (t = j(e)), o.insertBefore(e.__e, t || null), t = e.__e);
|
|
65
65
|
do
|
|
66
66
|
t = t && t.nextSibling;
|
|
67
67
|
while (t != null && t.nodeType == 8);
|
|
@@ -73,22 +73,22 @@ function oe(e, t) {
|
|
|
73
73
|
}) : t.push(e)), t;
|
|
74
74
|
}
|
|
75
75
|
function xt(e, t, o, n) {
|
|
76
|
-
var i, r, s = e.key,
|
|
77
|
-
if (
|
|
78
|
-
if (n > (
|
|
76
|
+
var i, r, s = e.key, l = e.type, a = t[o];
|
|
77
|
+
if (a === null && e.key == null || a && s == a.key && l == a.type && (2 & a.__u) == 0) return o;
|
|
78
|
+
if (n > (a != null && (2 & a.__u) == 0 ? 1 : 0)) for (i = o - 1, r = o + 1; i >= 0 || r < t.length; ) {
|
|
79
79
|
if (i >= 0) {
|
|
80
|
-
if ((
|
|
80
|
+
if ((a = t[i]) && (2 & a.__u) == 0 && s == a.key && l == a.type) return i;
|
|
81
81
|
i--;
|
|
82
82
|
}
|
|
83
83
|
if (r < t.length) {
|
|
84
|
-
if ((
|
|
84
|
+
if ((a = t[r]) && (2 & a.__u) == 0 && s == a.key && l == a.type) return r;
|
|
85
85
|
r++;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return -1;
|
|
89
89
|
}
|
|
90
90
|
function be(e, t, o) {
|
|
91
|
-
t[0] == "-" ? e.setProperty(t, o ?? "") : e[t] = o == null ? "" : typeof o != "number" ||
|
|
91
|
+
t[0] == "-" ? e.setProperty(t, o ?? "") : e[t] = o == null ? "" : typeof o != "number" || St.test(t) ? o : o + "px";
|
|
92
92
|
}
|
|
93
93
|
function J(e, t, o, n, i) {
|
|
94
94
|
var r;
|
|
@@ -97,7 +97,7 @@ function J(e, t, o, n, i) {
|
|
|
97
97
|
if (typeof n == "string" && (e.style.cssText = n = ""), n) for (t in n) o && t in o || be(e.style, t, "");
|
|
98
98
|
if (o) for (t in o) n && o[t] == n[t] || be(e.style, t, o[t]);
|
|
99
99
|
}
|
|
100
|
-
else if (t[0] == "o" && t[1] == "n") r = t != (t = t.replace(Je, "$1")), t = t.toLowerCase() in e || t == "onFocusOut" || t == "onFocusIn" ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + r] = o, o ? n ? o.u = n.u : (o.u = de, e.addEventListener(t, r ? ce :
|
|
100
|
+
else if (t[0] == "o" && t[1] == "n") r = t != (t = t.replace(Je, "$1")), t = t.toLowerCase() in e || t == "onFocusOut" || t == "onFocusIn" ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + r] = o, o ? n ? o.u = n.u : (o.u = de, e.addEventListener(t, r ? ce : ae, r)) : e.removeEventListener(t, r ? ce : ae, r);
|
|
101
101
|
else {
|
|
102
102
|
if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
103
103
|
else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
|
|
@@ -114,16 +114,16 @@ function ke(e) {
|
|
|
114
114
|
var o = this.l[t.type + e];
|
|
115
115
|
if (t.t == null) t.t = de++;
|
|
116
116
|
else if (t.t < o.u) return;
|
|
117
|
-
return o(
|
|
117
|
+
return o(y.event ? y.event(t) : t);
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
function fe(e, t, o, n, i, r, s,
|
|
122
|
-
var _, u, h, d,
|
|
121
|
+
function fe(e, t, o, n, i, r, s, l, a, c) {
|
|
122
|
+
var _, u, h, d, v, m, C, g, p, T, k, E, P, F, M, N, S, z = t.type;
|
|
123
123
|
if (t.constructor != null) return null;
|
|
124
|
-
128 & o.__u && (
|
|
124
|
+
128 & o.__u && (a = !!(32 & o.__u), r = [l = t.__e = o.__e]), (_ = y.__b) && _(t);
|
|
125
125
|
e: if (typeof z == "function") try {
|
|
126
|
-
if (g = t.props, p = "prototype" in z && z.prototype.render, T = (_ = z.contextType) && n[_.__c], k = _ ? T ? T.props.value : _.__ : n, o.__c ?
|
|
126
|
+
if (g = t.props, p = "prototype" in z && z.prototype.render, T = (_ = z.contextType) && n[_.__c], k = _ ? T ? T.props.value : _.__ : n, o.__c ? C = (u = t.__c = o.__c).__ = u.__E : (p ? t.__c = u = new z(g, k) : (t.__c = u = new R(g, k), u.constructor = z, u.render = Et), T && T.sub(u), u.props = g, u.state || (u.state = {}), u.context = k, u.__n = n, h = u.__d = !0, u.__h = [], u._sb = []), p && u.__s == null && (u.__s = u.state), p && z.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = I({}, u.__s)), I(u.__s, z.getDerivedStateFromProps(g, u.__s))), d = u.props, v = u.state, u.__v = t, h) p && z.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), p && u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
127
127
|
else {
|
|
128
128
|
if (p && z.getDerivedStateFromProps == null && g !== d && u.componentWillReceiveProps != null && u.componentWillReceiveProps(g, k), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(g, u.__s, k) === !1 || t.__v == o.__v) {
|
|
129
129
|
for (t.__v != o.__v && (u.props = g, u.state = u.__s, u.__d = !1), t.__e = o.__e, t.__k = o.__k, t.__k.some(function(U) {
|
|
@@ -133,44 +133,44 @@ function fe(e, t, o, n, i, r, s, a, l, c) {
|
|
|
133
133
|
break e;
|
|
134
134
|
}
|
|
135
135
|
u.componentWillUpdate != null && u.componentWillUpdate(g, u.__s, k), p && u.componentDidUpdate != null && u.__h.push(function() {
|
|
136
|
-
u.componentDidUpdate(d,
|
|
136
|
+
u.componentDidUpdate(d, v, m);
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
if (u.context = k, u.props = g, u.__P = e, u.__e = !1, P =
|
|
139
|
+
if (u.context = k, u.props = g, u.__P = e, u.__e = !1, P = y.__r, F = 0, p) {
|
|
140
140
|
for (u.state = u.__s, u.__d = !1, P && P(t), _ = u.render(u.props, u.state, u.context), M = 0; M < u._sb.length; M++) u.__h.push(u._sb[M]);
|
|
141
141
|
u._sb = [];
|
|
142
142
|
} else do
|
|
143
143
|
u.__d = !1, P && P(t), _ = u.render(u.props, u.state, u.context), u.state = u.__s;
|
|
144
144
|
while (u.__d && ++F < 25);
|
|
145
|
-
u.state = u.__s, u.getChildContext != null && (n = I(I({}, n), u.getChildContext())), p && !h && u.getSnapshotBeforeUpdate != null && (
|
|
145
|
+
u.state = u.__s, u.getChildContext != null && (n = I(I({}, n), u.getChildContext())), p && !h && u.getSnapshotBeforeUpdate != null && (m = u.getSnapshotBeforeUpdate(d, v)), N = _, _ != null && _.type === W && _.key == null && (N = nt(_.props.children)), l = et(e, X(N) ? N : [N], t, o, n, i, r, s, l, a, c), u.base = t.__e, t.__u &= -161, u.__h.length && s.push(u), C && (u.__E = u.__ = null);
|
|
146
146
|
} catch (U) {
|
|
147
|
-
if (t.__v = null,
|
|
148
|
-
for (t.__u |=
|
|
149
|
-
r[r.indexOf(
|
|
150
|
-
} else for (
|
|
147
|
+
if (t.__v = null, a || r != null) if (U.then) {
|
|
148
|
+
for (t.__u |= a ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
149
|
+
r[r.indexOf(l)] = null, t.__e = l;
|
|
150
|
+
} else for (S = r.length; S--; ) he(r[S]);
|
|
151
151
|
else t.__e = o.__e, t.__k = o.__k;
|
|
152
|
-
|
|
152
|
+
y.__e(U, t, o);
|
|
153
153
|
}
|
|
154
|
-
else r == null && t.__v == o.__v ? (t.__k = o.__k, t.__e = o.__e) :
|
|
155
|
-
return (_ =
|
|
154
|
+
else r == null && t.__v == o.__v ? (t.__k = o.__k, t.__e = o.__e) : l = t.__e = At(o.__e, t, o, n, i, r, s, a, c);
|
|
155
|
+
return (_ = y.diffed) && _(t), 128 & t.__u ? void 0 : l;
|
|
156
156
|
}
|
|
157
157
|
function ot(e, t, o) {
|
|
158
158
|
for (var n = 0; n < o.length; n++) me(o[n], o[++n], o[++n]);
|
|
159
|
-
|
|
159
|
+
y.__c && y.__c(t, e), e.some(function(i) {
|
|
160
160
|
try {
|
|
161
161
|
e = i.__h, i.__h = [], e.some(function(r) {
|
|
162
162
|
r.call(i);
|
|
163
163
|
});
|
|
164
164
|
} catch (r) {
|
|
165
|
-
|
|
165
|
+
y.__e(r, i.__v);
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
function nt(e) {
|
|
170
170
|
return typeof e != "object" || e == null || e.__b && e.__b > 0 ? e : X(e) ? e.map(nt) : I({}, e);
|
|
171
171
|
}
|
|
172
|
-
function At(e, t, o, n, i, r, s,
|
|
173
|
-
var c, _, u, h, d,
|
|
172
|
+
function At(e, t, o, n, i, r, s, l, a) {
|
|
173
|
+
var c, _, u, h, d, v, m, C = o.props, g = t.props, p = t.type;
|
|
174
174
|
if (p == "svg" ? i = "http://www.w3.org/2000/svg" : p == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), r != null) {
|
|
175
175
|
for (c = 0; c < r.length; c++) if ((d = r[c]) && "setAttribute" in d == !!p && (p ? d.localName == p : d.nodeType == 3)) {
|
|
176
176
|
e = d, r[c] = null;
|
|
@@ -179,22 +179,22 @@ function At(e, t, o, n, i, r, s, a, l) {
|
|
|
179
179
|
}
|
|
180
180
|
if (e == null) {
|
|
181
181
|
if (p == null) return document.createTextNode(g);
|
|
182
|
-
e = document.createElementNS(i, p, g.is && g),
|
|
182
|
+
e = document.createElementNS(i, p, g.is && g), l && (y.__m && y.__m(t, r), l = !1), r = null;
|
|
183
183
|
}
|
|
184
|
-
if (p == null)
|
|
184
|
+
if (p == null) C === g || l && e.data == g || (e.data = g);
|
|
185
185
|
else {
|
|
186
|
-
if (r = r && ne.call(e.childNodes),
|
|
187
|
-
for (c in
|
|
186
|
+
if (r = r && ne.call(e.childNodes), C = o.props || B, !l && r != null) for (C = {}, c = 0; c < e.attributes.length; c++) C[(d = e.attributes[c]).name] = d.value;
|
|
187
|
+
for (c in C) if (d = C[c], c != "children") {
|
|
188
188
|
if (c == "dangerouslySetInnerHTML") u = d;
|
|
189
189
|
else if (!(c in g)) {
|
|
190
190
|
if (c == "value" && "defaultValue" in g || c == "checked" && "defaultChecked" in g) continue;
|
|
191
191
|
J(e, c, null, d, i);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
for (c in g) d = g[c], c == "children" ? h = d : c == "dangerouslySetInnerHTML" ? _ = d : c == "value" ?
|
|
195
|
-
if (_)
|
|
196
|
-
else if (u && (e.innerHTML = ""), et(t.type == "template" ? e.content : e, X(h) ? h : [h], t, o, n, p == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, r, s, r ? r[0] : o.__k &&
|
|
197
|
-
|
|
194
|
+
for (c in g) d = g[c], c == "children" ? h = d : c == "dangerouslySetInnerHTML" ? _ = d : c == "value" ? v = d : c == "checked" ? m = d : l && typeof d != "function" || C[c] === d || J(e, c, d, C[c], i);
|
|
195
|
+
if (_) l || u && (_.__html == u.__html || _.__html == e.innerHTML) || (e.innerHTML = _.__html), t.__k = [];
|
|
196
|
+
else if (u && (e.innerHTML = ""), et(t.type == "template" ? e.content : e, X(h) ? h : [h], t, o, n, p == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, r, s, r ? r[0] : o.__k && j(o, 0), l, a), r != null) for (c = r.length; c--; ) he(r[c]);
|
|
197
|
+
l || (c = "value", p == "progress" && v == null ? e.removeAttribute("value") : v != null && (v !== e[c] || p == "progress" && !v || p == "option" && v != C[c]) && J(e, c, v, C[c], i), c = "checked", m != null && m != e[c] && J(e, c, m, C[c], i));
|
|
198
198
|
}
|
|
199
199
|
return e;
|
|
200
200
|
}
|
|
@@ -205,16 +205,16 @@ function me(e, t, o) {
|
|
|
205
205
|
n && e.__u(), n && t == null || (e.__u = e(t));
|
|
206
206
|
} else e.current = t;
|
|
207
207
|
} catch (i) {
|
|
208
|
-
|
|
208
|
+
y.__e(i, o);
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
function it(e, t, o) {
|
|
212
212
|
var n, i;
|
|
213
|
-
if (
|
|
213
|
+
if (y.unmount && y.unmount(e), (n = e.ref) && (n.current && n.current != e.__e || me(n, null, t)), (n = e.__c) != null) {
|
|
214
214
|
if (n.componentWillUnmount) try {
|
|
215
215
|
n.componentWillUnmount();
|
|
216
216
|
} catch (r) {
|
|
217
|
-
|
|
217
|
+
y.__e(r, t);
|
|
218
218
|
}
|
|
219
219
|
n.base = n.__P = null;
|
|
220
220
|
}
|
|
@@ -226,7 +226,7 @@ function Et(e, t, o) {
|
|
|
226
226
|
}
|
|
227
227
|
function Mt(e, t, o) {
|
|
228
228
|
var n, i, r, s;
|
|
229
|
-
t == document && (t = document.documentElement),
|
|
229
|
+
t == document && (t = document.documentElement), y.__ && y.__(e, t), i = (n = !1) ? null : t.__k, r = [], s = [], fe(t, e = t.__k = D(W, null, [e]), i || B, B, t.namespaceURI, i ? null : t.firstChild ? ne.call(t.childNodes) : null, r, i ? i.__e : t.firstChild, n, s), ot(r, e, s);
|
|
230
230
|
}
|
|
231
231
|
function rt(e) {
|
|
232
232
|
function t(o) {
|
|
@@ -251,11 +251,11 @@ function rt(e) {
|
|
|
251
251
|
return o.children(n);
|
|
252
252
|
}).contextType = t, t;
|
|
253
253
|
}
|
|
254
|
-
ne = Ze.slice,
|
|
254
|
+
ne = Ze.slice, y = { __e: function(e, t, o, n) {
|
|
255
255
|
for (var i, r, s; t = t.__; ) if ((i = t.__c) && !i.__) try {
|
|
256
256
|
if ((r = i.constructor) && r.getDerivedStateFromError != null && (i.setState(r.getDerivedStateFromError(e)), s = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, n || {}), s = i.__d), s) return i.__E = i;
|
|
257
|
-
} catch (
|
|
258
|
-
e =
|
|
257
|
+
} catch (l) {
|
|
258
|
+
e = l;
|
|
259
259
|
}
|
|
260
260
|
throw e;
|
|
261
261
|
} }, qe = 0, R.prototype.setState = function(e, t) {
|
|
@@ -263,19 +263,19 @@ ne = Ze.slice, C = { __e: function(e, t, o, n) {
|
|
|
263
263
|
o = this.__s != null && this.__s != this.state ? this.__s : this.__s = I({}, this.state), typeof e == "function" && (e = e(I({}, o), this.props)), e && I(o, e), e != null && this.__v && (t && this._sb.push(t), ue(this));
|
|
264
264
|
}, R.prototype.forceUpdate = function(e) {
|
|
265
265
|
this.__v && (this.__e = !0, e && this.__h.push(e), ue(this));
|
|
266
|
-
}, R.prototype.render =
|
|
266
|
+
}, R.prototype.render = W, O = [], Xe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ye = function(e, t) {
|
|
267
267
|
return e.__v.__b - t.__v.__b;
|
|
268
|
-
}, te.__r = 0, Je = /(PointerCapture)$|Capture$/i, de = 0,
|
|
268
|
+
}, te.__r = 0, Je = /(PointerCapture)$|Capture$/i, de = 0, ae = ke(!1), ce = ke(!0), Ke = 0;
|
|
269
269
|
var It = 0;
|
|
270
270
|
function f(e, t, o, n, i, r) {
|
|
271
271
|
t || (t = {});
|
|
272
|
-
var s,
|
|
273
|
-
if ("ref" in
|
|
274
|
-
var c = { type: e, props:
|
|
275
|
-
if (typeof e == "function" && (s = e.defaultProps)) for (
|
|
276
|
-
return
|
|
272
|
+
var s, l, a = t;
|
|
273
|
+
if ("ref" in a) for (l in a = {}, t) l == "ref" ? s = t[l] : a[l] = t[l];
|
|
274
|
+
var c = { type: e, props: a, key: o, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --It, __i: -1, __u: 0, __source: i, __self: r };
|
|
275
|
+
if (typeof e == "function" && (s = e.defaultProps)) for (l in s) a[l] === void 0 && (a[l] = s[l]);
|
|
276
|
+
return y.vnode && y.vnode(c), c;
|
|
277
277
|
}
|
|
278
|
-
var
|
|
278
|
+
var H, w, re, Te, V = 0, st = [], b = y, ze = b.__b, Pe = b.__r, Ne = b.diffed, Se = b.__c, Le = b.unmount, xe = b.__;
|
|
279
279
|
function ie(e, t) {
|
|
280
280
|
b.__h && b.__h(w, e, V || t), V = 0;
|
|
281
281
|
var o = w.__H || (w.__H = { __: [], __h: [] });
|
|
@@ -285,59 +285,59 @@ function $(e) {
|
|
|
285
285
|
return V = 1, $t(ct, e);
|
|
286
286
|
}
|
|
287
287
|
function $t(e, t, o) {
|
|
288
|
-
var n = ie(
|
|
289
|
-
if (n.t = e, !n.__c && (n.__ = [o ? o(t) : ct(void 0, t), function(
|
|
290
|
-
var
|
|
291
|
-
|
|
288
|
+
var n = ie(H++, 2);
|
|
289
|
+
if (n.t = e, !n.__c && (n.__ = [o ? o(t) : ct(void 0, t), function(l) {
|
|
290
|
+
var a = n.__N ? n.__N[0] : n.__[0], c = n.t(a, l);
|
|
291
|
+
a !== c && (n.__N = [c, n.__[1]], n.__c.setState({}));
|
|
292
292
|
}], n.__c = w, !w.__f)) {
|
|
293
|
-
var i = function(
|
|
293
|
+
var i = function(l, a, c) {
|
|
294
294
|
if (!n.__c.__H) return !0;
|
|
295
295
|
var _ = n.__c.__H.__.filter(function(h) {
|
|
296
296
|
return !!h.__c;
|
|
297
297
|
});
|
|
298
298
|
if (_.every(function(h) {
|
|
299
299
|
return !h.__N;
|
|
300
|
-
})) return !r || r.call(this,
|
|
301
|
-
var u = n.__c.props !==
|
|
300
|
+
})) return !r || r.call(this, l, a, c);
|
|
301
|
+
var u = n.__c.props !== l;
|
|
302
302
|
return _.forEach(function(h) {
|
|
303
303
|
if (h.__N) {
|
|
304
304
|
var d = h.__[0];
|
|
305
305
|
h.__ = h.__N, h.__N = void 0, d !== h.__[0] && (u = !0);
|
|
306
306
|
}
|
|
307
|
-
}), r && r.call(this,
|
|
307
|
+
}), r && r.call(this, l, a, c) || u;
|
|
308
308
|
};
|
|
309
309
|
w.__f = !0;
|
|
310
310
|
var r = w.shouldComponentUpdate, s = w.componentWillUpdate;
|
|
311
|
-
w.componentWillUpdate = function(
|
|
311
|
+
w.componentWillUpdate = function(l, a, c) {
|
|
312
312
|
if (this.__e) {
|
|
313
313
|
var _ = r;
|
|
314
|
-
r = void 0, i(
|
|
314
|
+
r = void 0, i(l, a, c), r = _;
|
|
315
315
|
}
|
|
316
|
-
s && s.call(this,
|
|
316
|
+
s && s.call(this, l, a, c);
|
|
317
317
|
}, w.shouldComponentUpdate = i;
|
|
318
318
|
}
|
|
319
319
|
return n.__N || n.__;
|
|
320
320
|
}
|
|
321
321
|
function A(e, t) {
|
|
322
|
-
var o = ie(
|
|
323
|
-
!b.__s &&
|
|
322
|
+
var o = ie(H++, 3);
|
|
323
|
+
!b.__s && at(o.__H, t) && (o.__ = e, o.u = t, w.__H.__h.push(o));
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
return V = 5,
|
|
325
|
+
function G(e) {
|
|
326
|
+
return V = 5, ve(function() {
|
|
327
327
|
return { current: e };
|
|
328
328
|
}, []);
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
var o = ie(
|
|
332
|
-
return
|
|
330
|
+
function ve(e, t) {
|
|
331
|
+
var o = ie(H++, 7);
|
|
332
|
+
return at(o.__H, t) && (o.__ = e(), o.__H = t, o.__h = e), o.__;
|
|
333
333
|
}
|
|
334
334
|
function Ae(e, t) {
|
|
335
|
-
return V = 8,
|
|
335
|
+
return V = 8, ve(function() {
|
|
336
336
|
return e;
|
|
337
337
|
}, t);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
var t = w.context[e.__c], o = ie(
|
|
339
|
+
function lt(e) {
|
|
340
|
+
var t = w.context[e.__c], o = ie(H++, 9);
|
|
341
341
|
return o.c = e, t ? (o.__ == null && (o.__ = !0, t.sub(w)), t.props.value) : e.__;
|
|
342
342
|
}
|
|
343
343
|
function Rt() {
|
|
@@ -352,13 +352,13 @@ b.__b = function(e) {
|
|
|
352
352
|
}, b.__ = function(e, t) {
|
|
353
353
|
e && t.__k && t.__k.__m && (e.__m = t.__k.__m), xe && xe(e, t);
|
|
354
354
|
}, b.__r = function(e) {
|
|
355
|
-
Pe && Pe(e),
|
|
355
|
+
Pe && Pe(e), H = 0;
|
|
356
356
|
var t = (w = e.__c).__H;
|
|
357
357
|
t && (re === w ? (t.__h = [], w.__h = [], t.__.forEach(function(o) {
|
|
358
358
|
o.__N && (o.__ = o.__N), o.u = o.__N = void 0;
|
|
359
|
-
})) : (t.__h.forEach(Q), t.__h.forEach(_e), t.__h = [],
|
|
359
|
+
})) : (t.__h.forEach(Q), t.__h.forEach(_e), t.__h = [], H = 0)), re = w;
|
|
360
360
|
}, b.diffed = function(e) {
|
|
361
|
-
|
|
361
|
+
Ne && Ne(e);
|
|
362
362
|
var t = e.__c;
|
|
363
363
|
t && t.__H && (t.__H.__h.length && (st.push(t) !== 1 && Te === b.requestAnimationFrame || ((Te = b.requestAnimationFrame) || Ft)(Rt)), t.__H.__.forEach(function(o) {
|
|
364
364
|
o.u && (o.__H = o.u), o.u = void 0;
|
|
@@ -374,7 +374,7 @@ b.__b = function(e) {
|
|
|
374
374
|
i.__h && (i.__h = []);
|
|
375
375
|
}), t = [], b.__e(n, o.__v);
|
|
376
376
|
}
|
|
377
|
-
}),
|
|
377
|
+
}), Se && Se(e, t);
|
|
378
378
|
}, b.unmount = function(e) {
|
|
379
379
|
Le && Le(e);
|
|
380
380
|
var t, o = e.__c;
|
|
@@ -401,7 +401,7 @@ function _e(e) {
|
|
|
401
401
|
var t = w;
|
|
402
402
|
e.__c = e.__(), w = t;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function at(e, t) {
|
|
405
405
|
return !e || e.length !== t.length || t.some(function(o, n) {
|
|
406
406
|
return o !== e[n];
|
|
407
407
|
});
|
|
@@ -448,7 +448,7 @@ const Ut = (e) => ({
|
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
}), ut = rt(void 0), Ot = ({ children: e, config: t }) => {
|
|
451
|
-
const o =
|
|
451
|
+
const o = G(t), n = Ut(t.lcPrefix + "score"), i = n.loadGameData(), [r, s] = $({
|
|
452
452
|
currentLevel: 1,
|
|
453
453
|
highestUnlockedLevel: 1,
|
|
454
454
|
currentTier: 1,
|
|
@@ -479,9 +479,9 @@ const Ut = (e) => ({
|
|
|
479
479
|
r.totalScore,
|
|
480
480
|
r.currentLevel
|
|
481
481
|
]);
|
|
482
|
-
const
|
|
483
|
-
n.resetGameData(), s((
|
|
484
|
-
...
|
|
482
|
+
const l = () => {
|
|
483
|
+
n.resetGameData(), s((a) => ({
|
|
484
|
+
...a,
|
|
485
485
|
currentLevel: 1,
|
|
486
486
|
highestUnlockedLevel: 1,
|
|
487
487
|
currentTier: 1,
|
|
@@ -505,18 +505,18 @@ const Ut = (e) => ({
|
|
|
505
505
|
gameState: r,
|
|
506
506
|
setGameState: s,
|
|
507
507
|
config: o,
|
|
508
|
-
resetGame:
|
|
508
|
+
resetGame: l
|
|
509
509
|
},
|
|
510
510
|
children: e
|
|
511
511
|
}
|
|
512
512
|
);
|
|
513
513
|
}, _t = () => {
|
|
514
|
-
const e =
|
|
514
|
+
const e = lt(ut);
|
|
515
515
|
if (!e)
|
|
516
516
|
throw new Error("useGameContext must be used within a GameProvider");
|
|
517
517
|
return e;
|
|
518
518
|
};
|
|
519
|
-
function
|
|
519
|
+
function pe(e, t) {
|
|
520
520
|
if (!(e instanceof t))
|
|
521
521
|
throw new TypeError("Cannot call a class as a function");
|
|
522
522
|
}
|
|
@@ -532,7 +532,7 @@ function ge(e, t, o) {
|
|
|
532
532
|
function Me(e) {
|
|
533
533
|
return +e.replace(/px/, "");
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function Wt(e) {
|
|
536
536
|
var t = window.devicePixelRatio, o = getComputedStyle(e), n = Me(o.getPropertyValue("width")), i = Me(o.getPropertyValue("height"));
|
|
537
537
|
e.setAttribute("width", (n * t).toString()), e.setAttribute("height", (i * t).toString());
|
|
538
538
|
}
|
|
@@ -543,22 +543,22 @@ function x(e, t) {
|
|
|
543
543
|
function Ie(e) {
|
|
544
544
|
return e[x(0, e.length)];
|
|
545
545
|
}
|
|
546
|
-
var
|
|
546
|
+
var jt = 125e-5, Ht = 5e-4, Gt = 9e-4, Bt = 1e-5, Vt = 6, qt = 80, Xt = 0.9, Yt = 1.7, Jt = 0.2, Kt = 0.6, Zt = 0.03, Qt = 0.07, eo = 15, to = 82, oo = 100, no = 250, io = 40, ro = ["#fcf403", "#62fc03", "#f4fc03", "#03e7fc", "#03fca5", "#a503fc", "#fc03ad", "#fc03c2"];
|
|
547
547
|
function $e(e) {
|
|
548
548
|
var t = 1920;
|
|
549
549
|
return Math.log(e) / Math.log(t);
|
|
550
550
|
}
|
|
551
551
|
var Re = /* @__PURE__ */ function() {
|
|
552
552
|
function e(t) {
|
|
553
|
-
|
|
554
|
-
var o = t.initialPosition, n = t.direction, i = t.confettiRadius, r = t.confettiColors, s = t.emojis,
|
|
553
|
+
pe(this, e);
|
|
554
|
+
var o = t.initialPosition, n = t.direction, i = t.confettiRadius, r = t.confettiColors, s = t.emojis, l = t.emojiSize, a = t.canvasWidth, c = x(Xt, Yt, 3), _ = c * $e(a);
|
|
555
555
|
this.confettiSpeed = {
|
|
556
556
|
x: _,
|
|
557
557
|
y: _
|
|
558
|
-
}, this.finalConfettiSpeedX = x(Jt, Kt, 3), this.rotationSpeed = s.length ? 0.01 : x(Zt, Qt, 3) * $e(
|
|
558
|
+
}, this.finalConfettiSpeedX = x(Jt, Kt, 3), this.rotationSpeed = s.length ? 0.01 : x(Zt, Qt, 3) * $e(a), this.dragForceCoefficient = x(Ht, Gt, 6), this.radius = {
|
|
559
559
|
x: i,
|
|
560
560
|
y: i
|
|
561
|
-
}, this.initialRadius = i, this.rotationAngle = n === "left" ? x(0, 0.2, 3) : x(-0.2, 0, 3), this.emojiSize =
|
|
561
|
+
}, this.initialRadius = i, this.rotationAngle = n === "left" ? x(0, 0.2, 3) : x(-0.2, 0, 3), this.emojiSize = l, this.emojiRotationAngle = x(0, 2 * Math.PI), this.radiusYUpdateDirection = "down";
|
|
562
562
|
var u = n === "left" ? x(to, eo) * Math.PI / 180 : x(-15, -82) * Math.PI / 180;
|
|
563
563
|
this.absCos = Math.abs(Math.cos(u)), this.absSin = Math.abs(Math.sin(u));
|
|
564
564
|
var h = x(-150, 0), d = {
|
|
@@ -570,18 +570,18 @@ var Re = /* @__PURE__ */ function() {
|
|
|
570
570
|
return ge(e, [{
|
|
571
571
|
key: "draw",
|
|
572
572
|
value: function(o) {
|
|
573
|
-
var n = this.currentPosition, i = this.radius, r = this.color, s = this.emoji,
|
|
574
|
-
r ? (o.fillStyle = r, o.beginPath(), o.ellipse(n.x * _, n.y * _, i.x * _, i.y * _,
|
|
573
|
+
var n = this.currentPosition, i = this.radius, r = this.color, s = this.emoji, l = this.rotationAngle, a = this.emojiRotationAngle, c = this.emojiSize, _ = window.devicePixelRatio;
|
|
574
|
+
r ? (o.fillStyle = r, o.beginPath(), o.ellipse(n.x * _, n.y * _, i.x * _, i.y * _, l, 0, 2 * Math.PI), o.fill()) : s && (o.font = "".concat(c, "px serif"), o.save(), o.translate(_ * n.x, _ * n.y), o.rotate(a), o.textAlign = "center", o.fillText(s, 0, 0), o.restore());
|
|
575
575
|
}
|
|
576
576
|
}, {
|
|
577
577
|
key: "updatePosition",
|
|
578
578
|
value: function(o, n) {
|
|
579
|
-
var i = this.confettiSpeed, r = this.dragForceCoefficient, s = this.finalConfettiSpeedX,
|
|
580
|
-
if (i.x > s && (this.confettiSpeed.x -= r * o), this.currentPosition.x += i.x * (_ === "left" ? -this.absCos : this.absCos) * o, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u +
|
|
579
|
+
var i = this.confettiSpeed, r = this.dragForceCoefficient, s = this.finalConfettiSpeedX, l = this.radiusYUpdateDirection, a = this.rotationSpeed, c = this.createdAt, _ = this.direction, u = n - c;
|
|
580
|
+
if (i.x > s && (this.confettiSpeed.x -= r * o), this.currentPosition.x += i.x * (_ === "left" ? -this.absCos : this.absCos) * o, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u + jt * Math.pow(u, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : Bt * o, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
|
|
581
581
|
this.emojiRotationAngle += this.rotationSpeed * o % (2 * Math.PI);
|
|
582
582
|
return;
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
l === "down" ? (this.radius.y -= o * a, this.radius.y <= 0 && (this.radius.y = 0, this.radiusYUpdateDirection = "up")) : (this.radius.y += o * a, this.radius.y >= this.initialRadius && (this.radius.y = this.initialRadius, this.radiusYUpdateDirection = "down"));
|
|
585
585
|
}
|
|
586
586
|
}, {
|
|
587
587
|
key: "getIsVisibleOnCanvas",
|
|
@@ -594,20 +594,20 @@ function so() {
|
|
|
594
594
|
var e = document.createElement("canvas");
|
|
595
595
|
return e.style.position = "fixed", e.style.width = "100%", e.style.height = "100%", e.style.top = "0", e.style.left = "0", e.style.zIndex = "1000", e.style.pointerEvents = "none", document.body.appendChild(e), e;
|
|
596
596
|
}
|
|
597
|
-
function
|
|
598
|
-
var t = e.confettiRadius, o = t === void 0 ? Vt : t, n = e.confettiNumber, i = n === void 0 ? e.confettiesNumber || (e.emojis ? io : no) : n, r = e.confettiColors, s = r === void 0 ? ro : r,
|
|
597
|
+
function lo(e) {
|
|
598
|
+
var t = e.confettiRadius, o = t === void 0 ? Vt : t, n = e.confettiNumber, i = n === void 0 ? e.confettiesNumber || (e.emojis ? io : no) : n, r = e.confettiColors, s = r === void 0 ? ro : r, l = e.emojis, a = l === void 0 ? e.emojies || [] : l, c = e.emojiSize, _ = c === void 0 ? qt : c;
|
|
599
599
|
return e.emojies && console.error("emojies argument is deprecated, please use emojis instead"), e.confettiesNumber && console.error("confettiesNumber argument is deprecated, please use confettiNumber instead"), {
|
|
600
600
|
confettiRadius: o,
|
|
601
601
|
confettiNumber: i,
|
|
602
602
|
confettiColors: s,
|
|
603
|
-
emojis:
|
|
603
|
+
emojis: a,
|
|
604
604
|
emojiSize: _
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
|
-
var
|
|
607
|
+
var ao = /* @__PURE__ */ function() {
|
|
608
608
|
function e(t) {
|
|
609
609
|
var o = this;
|
|
610
|
-
|
|
610
|
+
pe(this, e), this.canvasContext = t, this.shapes = [], this.promise = new Promise(function(n) {
|
|
611
611
|
return o.resolvePromise = n;
|
|
612
612
|
});
|
|
613
613
|
}
|
|
@@ -631,21 +631,21 @@ var lo = /* @__PURE__ */ function() {
|
|
|
631
631
|
}, {
|
|
632
632
|
key: "processShapes",
|
|
633
633
|
value: function(o, n, i) {
|
|
634
|
-
var r = this, s = o.timeDelta,
|
|
635
|
-
this.shapes = this.shapes.filter(function(
|
|
636
|
-
return
|
|
634
|
+
var r = this, s = o.timeDelta, l = o.currentTime;
|
|
635
|
+
this.shapes = this.shapes.filter(function(a) {
|
|
636
|
+
return a.updatePosition(s, l), a.draw(r.canvasContext), i ? a.getIsVisibleOnCanvas(n) : !0;
|
|
637
637
|
});
|
|
638
638
|
}
|
|
639
639
|
}]), e;
|
|
640
640
|
}(), co = /* @__PURE__ */ function() {
|
|
641
641
|
function e() {
|
|
642
642
|
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
643
|
-
|
|
643
|
+
pe(this, e), this.activeConfettiBatches = [], this.canvas = t.canvas || so(), 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
644
|
}
|
|
645
645
|
return ge(e, [{
|
|
646
646
|
key: "loop",
|
|
647
647
|
value: function() {
|
|
648
|
-
this.requestAnimationFrameRequested = !1,
|
|
648
|
+
this.requestAnimationFrameRequested = !1, Wt(this.canvas);
|
|
649
649
|
var o = (/* @__PURE__ */ new Date()).getTime(), n = o - this.lastUpdated, i = this.canvas.offsetHeight, r = this.iterationIndex % 10 === 0;
|
|
650
650
|
this.activeConfettiBatches = this.activeConfettiBatches.filter(function(s) {
|
|
651
651
|
return s.processShapes({
|
|
@@ -662,35 +662,35 @@ var lo = /* @__PURE__ */ function() {
|
|
|
662
662
|
}, {
|
|
663
663
|
key: "addConfetti",
|
|
664
664
|
value: function() {
|
|
665
|
-
for (var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n =
|
|
665
|
+
for (var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = lo(o), i = n.confettiRadius, r = n.confettiNumber, s = n.confettiColors, l = n.emojis, a = n.emojiSize, c = this.canvas.getBoundingClientRect(), _ = c.width, u = c.height, h = u * 5 / 7, d = {
|
|
666
666
|
x: 0,
|
|
667
667
|
y: h
|
|
668
|
-
},
|
|
668
|
+
}, v = {
|
|
669
669
|
x: _,
|
|
670
670
|
y: h
|
|
671
|
-
},
|
|
671
|
+
}, m = new ao(this.canvasContext), C = 0; C < r / 2; C++) {
|
|
672
672
|
var g = new Re({
|
|
673
673
|
initialPosition: d,
|
|
674
674
|
direction: "right",
|
|
675
675
|
confettiRadius: i,
|
|
676
676
|
confettiColors: s,
|
|
677
677
|
confettiNumber: r,
|
|
678
|
-
emojis:
|
|
679
|
-
emojiSize:
|
|
678
|
+
emojis: l,
|
|
679
|
+
emojiSize: a,
|
|
680
680
|
canvasWidth: _
|
|
681
681
|
}), p = new Re({
|
|
682
|
-
initialPosition:
|
|
682
|
+
initialPosition: v,
|
|
683
683
|
direction: "left",
|
|
684
684
|
confettiRadius: i,
|
|
685
685
|
confettiColors: s,
|
|
686
686
|
confettiNumber: r,
|
|
687
|
-
emojis:
|
|
688
|
-
emojiSize:
|
|
687
|
+
emojis: l,
|
|
688
|
+
emojiSize: a,
|
|
689
689
|
canvasWidth: _
|
|
690
690
|
});
|
|
691
|
-
|
|
691
|
+
m.addShapes(g, p);
|
|
692
692
|
}
|
|
693
|
-
return this.activeConfettiBatches.push(
|
|
693
|
+
return this.activeConfettiBatches.push(m), this.queueAnimationFrameIfNeeded(), m.getBatchCompletePromise();
|
|
694
694
|
}
|
|
695
695
|
}, {
|
|
696
696
|
key: "clearCanvas",
|
|
@@ -719,8 +719,8 @@ function Ue(e, t) {
|
|
|
719
719
|
(Ue.prototype = new R()).isPureReactComponent = !0, Ue.prototype.shouldComponentUpdate = function(e, t) {
|
|
720
720
|
return Fe(this.props, e) || Fe(this.state, t);
|
|
721
721
|
};
|
|
722
|
-
var Oe =
|
|
723
|
-
|
|
722
|
+
var Oe = y.__b;
|
|
723
|
+
y.__b = function(e) {
|
|
724
724
|
e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), Oe && Oe(e);
|
|
725
725
|
};
|
|
726
726
|
var uo = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
|
|
@@ -731,14 +731,14 @@ function ht(e) {
|
|
|
731
731
|
}
|
|
732
732
|
return t.$$typeof = uo, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
|
|
733
733
|
}
|
|
734
|
-
var _o =
|
|
735
|
-
|
|
734
|
+
var _o = y.__e;
|
|
735
|
+
y.__e = function(e, t, o, n) {
|
|
736
736
|
if (e.then) {
|
|
737
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
738
|
}
|
|
739
739
|
_o(e, t, o, n);
|
|
740
740
|
};
|
|
741
|
-
var De =
|
|
741
|
+
var De = y.unmount;
|
|
742
742
|
function ft(e, t, o) {
|
|
743
743
|
return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(n) {
|
|
744
744
|
typeof n.__c == "function" && n.__c();
|
|
@@ -754,28 +754,28 @@ function mt(e, t, o) {
|
|
|
754
754
|
function se() {
|
|
755
755
|
this.__u = 0, this.o = null, this.__b = null;
|
|
756
756
|
}
|
|
757
|
-
function
|
|
757
|
+
function vt(e) {
|
|
758
758
|
var t = e.__.__c;
|
|
759
759
|
return t && t.__a && t.__a(e);
|
|
760
760
|
}
|
|
761
761
|
function K() {
|
|
762
762
|
this.i = null, this.l = null;
|
|
763
763
|
}
|
|
764
|
-
|
|
764
|
+
y.unmount = function(e) {
|
|
765
765
|
var t = e.__c;
|
|
766
766
|
t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), De && De(e);
|
|
767
767
|
}, (se.prototype = new R()).__c = function(e, t) {
|
|
768
768
|
var o = t.__c, n = this;
|
|
769
769
|
n.o == null && (n.o = []), n.o.push(o);
|
|
770
|
-
var i =
|
|
771
|
-
r || (r = !0, o.__R = null, i ? i(
|
|
770
|
+
var i = vt(n.__v), r = !1, s = function() {
|
|
771
|
+
r || (r = !0, o.__R = null, i ? i(l) : l());
|
|
772
772
|
};
|
|
773
773
|
o.__R = s;
|
|
774
|
-
var
|
|
774
|
+
var l = function() {
|
|
775
775
|
if (!--n.__u) {
|
|
776
776
|
if (n.state.__a) {
|
|
777
|
-
var
|
|
778
|
-
n.__v.__k[0] = mt(
|
|
777
|
+
var a = n.state.__a;
|
|
778
|
+
n.__v.__k[0] = mt(a, a.__c.__P, a.__c.__O);
|
|
779
779
|
}
|
|
780
780
|
var c;
|
|
781
781
|
for (n.setState({ __a: n.__b = null }); c = n.o.pop(); ) c.forceUpdate();
|
|
@@ -792,10 +792,10 @@ C.unmount = function(e) {
|
|
|
792
792
|
}
|
|
793
793
|
this.__b = null;
|
|
794
794
|
}
|
|
795
|
-
var i = t.__a && D(
|
|
796
|
-
return i && (i.__u &= -33), [D(
|
|
795
|
+
var i = t.__a && D(W, null, e.fallback);
|
|
796
|
+
return i && (i.__u &= -33), [D(W, null, t.__a ? null : e.children), i];
|
|
797
797
|
};
|
|
798
|
-
var
|
|
798
|
+
var We = function(e, t, o) {
|
|
799
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
800
|
for (; o.length > 3; ) o.pop()();
|
|
801
801
|
if (o[1] < o[0]) break;
|
|
@@ -803,10 +803,10 @@ var je = function(e, t, o) {
|
|
|
803
803
|
}
|
|
804
804
|
};
|
|
805
805
|
(K.prototype = new R()).__a = function(e) {
|
|
806
|
-
var t = this, o =
|
|
806
|
+
var t = this, o = vt(t.__v), n = t.l.get(e);
|
|
807
807
|
return n[0]++, function(i) {
|
|
808
808
|
var r = function() {
|
|
809
|
-
t.props.revealOrder ? (n.push(i),
|
|
809
|
+
t.props.revealOrder ? (n.push(i), We(t, e, n)) : i();
|
|
810
810
|
};
|
|
811
811
|
o ? o(r) : r();
|
|
812
812
|
};
|
|
@@ -819,10 +819,10 @@ var je = function(e, t, o) {
|
|
|
819
819
|
}, K.prototype.componentDidUpdate = K.prototype.componentDidMount = function() {
|
|
820
820
|
var e = this;
|
|
821
821
|
this.l.forEach(function(t, o) {
|
|
822
|
-
|
|
822
|
+
We(e, o, t);
|
|
823
823
|
});
|
|
824
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)/,
|
|
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)/, vo = /[A-Z0-9]/g, po = typeof document < "u", go = function(e) {
|
|
826
826
|
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
|
|
827
827
|
};
|
|
828
828
|
R.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
|
|
@@ -832,7 +832,7 @@ R.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveP
|
|
|
832
832
|
Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
|
|
833
833
|
} });
|
|
834
834
|
});
|
|
835
|
-
var
|
|
835
|
+
var je = y.event;
|
|
836
836
|
function Co() {
|
|
837
837
|
}
|
|
838
838
|
function yo() {
|
|
@@ -841,20 +841,20 @@ function yo() {
|
|
|
841
841
|
function wo() {
|
|
842
842
|
return this.defaultPrevented;
|
|
843
843
|
}
|
|
844
|
-
|
|
845
|
-
return
|
|
844
|
+
y.event = function(e) {
|
|
845
|
+
return je && (e = je(e)), e.persist = Co, e.isPropagationStopped = yo, e.isDefaultPrevented = wo, e.nativeEvent = e;
|
|
846
846
|
};
|
|
847
847
|
var bo = { enumerable: !1, configurable: !0, get: function() {
|
|
848
848
|
return this.class;
|
|
849
|
-
} },
|
|
850
|
-
|
|
849
|
+
} }, He = y.vnode;
|
|
850
|
+
y.vnode = function(e) {
|
|
851
851
|
typeof e.type == "string" && function(t) {
|
|
852
852
|
var o = t.props, n = t.type, i = {}, r = n.indexOf("-") === -1;
|
|
853
853
|
for (var s in o) {
|
|
854
|
-
var
|
|
855
|
-
if (!(s === "value" && "defaultValue" in o &&
|
|
856
|
-
var
|
|
857
|
-
s === "defaultValue" && "value" in o && o.value == null ? s = "value" : s === "download" &&
|
|
854
|
+
var l = o[s];
|
|
855
|
+
if (!(s === "value" && "defaultValue" in o && l == null || po && 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(vo, "-$&").toLowerCase() : l === null && (l = void 0), a === "oninput" && i[s = a] && (s = "oninputCapture"), i[s] = l;
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
860
|
n == "select" && i.multiple && Array.isArray(i.value) && (i.value = oe(o.children).forEach(function(c) {
|
|
@@ -862,14 +862,14 @@ C.vnode = function(e) {
|
|
|
862
862
|
})), n == "select" && i.defaultValue != null && (i.value = oe(o.children).forEach(function(c) {
|
|
863
863
|
c.props.selected = i.multiple ? i.defaultValue.indexOf(c.props.value) != -1 : i.defaultValue == c.props.value;
|
|
864
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,
|
|
865
|
+
}(e), e.$$typeof = ho, He && He(e);
|
|
866
866
|
};
|
|
867
|
-
var
|
|
868
|
-
|
|
869
|
-
|
|
867
|
+
var Ge = y.__r;
|
|
868
|
+
y.__r = function(e) {
|
|
869
|
+
Ge && Ge(e), e.__c;
|
|
870
870
|
};
|
|
871
|
-
var Be =
|
|
872
|
-
|
|
871
|
+
var Be = y.diffed;
|
|
872
|
+
y.diffed = function(e) {
|
|
873
873
|
Be && Be(e);
|
|
874
874
|
var t = e.props, o = e.__e;
|
|
875
875
|
o != null && e.type === "textarea" && "value" in t && t.value !== o.value && (o.value = t.value == null ? "" : t.value);
|
|
@@ -880,7 +880,7 @@ C.diffed = function(e) {
|
|
|
880
880
|
* This source code is licensed under the ISC license.
|
|
881
881
|
* See the LICENSE file in the root directory of this source tree.
|
|
882
882
|
*/
|
|
883
|
-
const ko = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(),
|
|
883
|
+
const ko = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pt = (...e) => e.filter((t, o, n) => !!t && t.trim() !== "" && n.indexOf(t) === o).join(" ").trim();
|
|
884
884
|
/**
|
|
885
885
|
* @license lucide-react v0.473.0 - ISC
|
|
886
886
|
*
|
|
@@ -913,18 +913,18 @@ const zo = ht(
|
|
|
913
913
|
className: i = "",
|
|
914
914
|
children: r,
|
|
915
915
|
iconNode: s,
|
|
916
|
-
...
|
|
917
|
-
},
|
|
916
|
+
...l
|
|
917
|
+
}, a) => D(
|
|
918
918
|
"svg",
|
|
919
919
|
{
|
|
920
|
-
ref:
|
|
920
|
+
ref: a,
|
|
921
921
|
...To,
|
|
922
922
|
width: t,
|
|
923
923
|
height: t,
|
|
924
924
|
stroke: e,
|
|
925
925
|
strokeWidth: n ? Number(o) * 24 / Number(t) : o,
|
|
926
|
-
className:
|
|
927
|
-
...
|
|
926
|
+
className: pt("lucide", i),
|
|
927
|
+
...l
|
|
928
928
|
},
|
|
929
929
|
[
|
|
930
930
|
...s.map(([c, _]) => D(c, _)),
|
|
@@ -943,7 +943,7 @@ const Po = (e, t) => {
|
|
|
943
943
|
({ className: n, ...i }, r) => D(zo, {
|
|
944
944
|
ref: r,
|
|
945
945
|
iconNode: t,
|
|
946
|
-
className:
|
|
946
|
+
className: pt(`lucide-${ko(e)}`, n),
|
|
947
947
|
...i
|
|
948
948
|
})
|
|
949
949
|
);
|
|
@@ -955,7 +955,7 @@ const Po = (e, t) => {
|
|
|
955
955
|
* This source code is licensed under the ISC license.
|
|
956
956
|
* See the LICENSE file in the root directory of this source tree.
|
|
957
957
|
*/
|
|
958
|
-
const
|
|
958
|
+
const No = [
|
|
959
959
|
[
|
|
960
960
|
"path",
|
|
961
961
|
{
|
|
@@ -964,18 +964,18 @@ const So = [
|
|
|
964
964
|
}
|
|
965
965
|
],
|
|
966
966
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
967
|
-
],
|
|
967
|
+
], So = Po("Settings", No), gt = rt(void 0), Lo = ({ children: e }) => {
|
|
968
968
|
const [t, o] = $(null), [n, i] = $(!1), [r, s] = $(
|
|
969
969
|
"info"
|
|
970
|
-
), [
|
|
971
|
-
i(!1),
|
|
972
|
-
}, [
|
|
970
|
+
), [l, a] = $(null), c = Ae(() => {
|
|
971
|
+
i(!1), l && (clearTimeout(l), a(null));
|
|
972
|
+
}, [l]), _ = Ae(
|
|
973
973
|
(u, h = "info", d = 3e3) => {
|
|
974
974
|
if (n && c(), o(u), s(h), i(!0), d > 0) {
|
|
975
|
-
const
|
|
975
|
+
const v = setTimeout(() => {
|
|
976
976
|
i(!1);
|
|
977
977
|
}, d);
|
|
978
|
-
|
|
978
|
+
a(v);
|
|
979
979
|
}
|
|
980
980
|
},
|
|
981
981
|
[n, c]
|
|
@@ -988,7 +988,7 @@ const So = [
|
|
|
988
988
|
}
|
|
989
989
|
);
|
|
990
990
|
}, Ce = () => {
|
|
991
|
-
const e =
|
|
991
|
+
const e = lt(gt);
|
|
992
992
|
if (!e)
|
|
993
993
|
throw new Error("useToast must be used within a ToastProvider");
|
|
994
994
|
return e;
|
|
@@ -1008,7 +1008,7 @@ const So = [
|
|
|
1008
1008
|
},
|
|
1009
1009
|
disabled: r,
|
|
1010
1010
|
className: "tier-dropdown",
|
|
1011
|
-
children: Array.from({ length: t }, (s,
|
|
1011
|
+
children: Array.from({ length: t }, (s, l) => l + 1).map((s) => /* @__PURE__ */ f(
|
|
1012
1012
|
"option",
|
|
1013
1013
|
{
|
|
1014
1014
|
value: s,
|
|
@@ -1035,27 +1035,27 @@ const So = [
|
|
|
1035
1035
|
"select",
|
|
1036
1036
|
{
|
|
1037
1037
|
value: o,
|
|
1038
|
-
onChange: (
|
|
1039
|
-
|
|
1038
|
+
onChange: (l) => {
|
|
1039
|
+
l.target && l.target.value && i(Number(l.target.value));
|
|
1040
1040
|
},
|
|
1041
1041
|
disabled: r,
|
|
1042
1042
|
className: "level-dropdown",
|
|
1043
|
-
children: s.map((
|
|
1043
|
+
children: s.map((l) => /* @__PURE__ */ f(
|
|
1044
1044
|
"option",
|
|
1045
1045
|
{
|
|
1046
|
-
value:
|
|
1047
|
-
disabled:
|
|
1046
|
+
value: l,
|
|
1047
|
+
disabled: l > n,
|
|
1048
1048
|
children: [
|
|
1049
1049
|
e.level,
|
|
1050
1050
|
" ",
|
|
1051
|
-
|
|
1051
|
+
l
|
|
1052
1052
|
]
|
|
1053
1053
|
},
|
|
1054
|
-
`level-${
|
|
1054
|
+
`level-${l}`
|
|
1055
1055
|
))
|
|
1056
1056
|
}
|
|
1057
1057
|
) });
|
|
1058
|
-
},
|
|
1058
|
+
}, le = ({
|
|
1059
1059
|
isOpen: e,
|
|
1060
1060
|
title: t,
|
|
1061
1061
|
message: o,
|
|
@@ -1063,11 +1063,11 @@ const So = [
|
|
|
1063
1063
|
noConfirm: i = !1,
|
|
1064
1064
|
noCancel: r = !1,
|
|
1065
1065
|
confirmText: s = "OK",
|
|
1066
|
-
cancelText:
|
|
1067
|
-
onConfirm:
|
|
1066
|
+
cancelText: l = "Cancel",
|
|
1067
|
+
onConfirm: a,
|
|
1068
1068
|
onCancel: c
|
|
1069
1069
|
}) => {
|
|
1070
|
-
const _ =
|
|
1070
|
+
const _ = G(null);
|
|
1071
1071
|
return A(() => {
|
|
1072
1072
|
const u = (h) => {
|
|
1073
1073
|
h.key === "Escape" && c?.();
|
|
@@ -1083,8 +1083,8 @@ const So = [
|
|
|
1083
1083
|
/* @__PURE__ */ f("div", { className: "maze-dialog-title", children: t }),
|
|
1084
1084
|
/* @__PURE__ */ f("div", { className: "maze-dialog-content", children: n || /* @__PURE__ */ f("div", { className: "maze-dialog-message", children: o }) }),
|
|
1085
1085
|
/* @__PURE__ */ f("div", { className: "maze-dialog-buttons", children: [
|
|
1086
|
-
!r && /* @__PURE__ */ f("button", { className: "maze-dialog-cancel", onClick: c, children:
|
|
1087
|
-
!i && /* @__PURE__ */ f("button", { className: "maze-dialog-confirm", onClick:
|
|
1086
|
+
!r && /* @__PURE__ */ f("button", { className: "maze-dialog-cancel", onClick: c, children: l }),
|
|
1087
|
+
!i && /* @__PURE__ */ f("button", { className: "maze-dialog-confirm", onClick: a, children: s })
|
|
1088
1088
|
] })
|
|
1089
1089
|
] })
|
|
1090
1090
|
}
|
|
@@ -1268,6 +1268,7 @@ const ye = [
|
|
|
1268
1268
|
renderConfig: {
|
|
1269
1269
|
padding: 10,
|
|
1270
1270
|
wallWidth: 4,
|
|
1271
|
+
minWallWidth: 1,
|
|
1271
1272
|
wallColor: "#000000",
|
|
1272
1273
|
exitColor: "#F44336",
|
|
1273
1274
|
foodColor: "#4CAF50",
|
|
@@ -1323,8 +1324,8 @@ class Ro {
|
|
|
1323
1324
|
// Left
|
|
1324
1325
|
];
|
|
1325
1326
|
for (const r of i) {
|
|
1326
|
-
const s = t + r.r,
|
|
1327
|
-
this.isValid(s,
|
|
1327
|
+
const s = t + r.r, l = o + r.c;
|
|
1328
|
+
this.isValid(s, l) && n.push({ row: s, col: l });
|
|
1328
1329
|
}
|
|
1329
1330
|
return n;
|
|
1330
1331
|
}
|
|
@@ -1375,10 +1376,10 @@ class Fo {
|
|
|
1375
1376
|
let i = { row: o, col: n };
|
|
1376
1377
|
for (this.maze.grid[o][n].visited = !0, t.push(i); t.length > 0; ) {
|
|
1377
1378
|
i = t[t.length - 1];
|
|
1378
|
-
const { row: r, col: s } = i,
|
|
1379
|
-
if (
|
|
1380
|
-
const
|
|
1381
|
-
this.maze.removeWall(r, s, c, _), this.maze.grid[c][_].visited = !0, t.push(
|
|
1379
|
+
const { row: r, col: s } = i, l = this.maze.getUnvisitedNeighbors(r, s);
|
|
1380
|
+
if (l.length > 0) {
|
|
1381
|
+
const a = this.randomPick(l), { row: c, col: _ } = a;
|
|
1382
|
+
this.maze.removeWall(r, s, c, _), this.maze.grid[c][_].visited = !0, t.push(a);
|
|
1382
1383
|
} else
|
|
1383
1384
|
t.pop();
|
|
1384
1385
|
}
|
|
@@ -1386,17 +1387,17 @@ class Fo {
|
|
|
1386
1387
|
// --- Prim's Algorithm Implementation ---
|
|
1387
1388
|
runPrims() {
|
|
1388
1389
|
const t = [], o = (r, s) => {
|
|
1389
|
-
const
|
|
1390
|
-
for (const
|
|
1391
|
-
!this.maze.grid[
|
|
1392
|
-
(c) => c.row ===
|
|
1393
|
-
) && t.push(
|
|
1390
|
+
const l = this.maze.getNeighbors(r, s);
|
|
1391
|
+
for (const a of l)
|
|
1392
|
+
!this.maze.grid[a.row][a.col].visited && !t.some(
|
|
1393
|
+
(c) => c.row === a.row && c.col === a.col
|
|
1394
|
+
) && t.push(a);
|
|
1394
1395
|
}, n = this.randomNumber(this.maze.rows), i = this.randomNumber(this.maze.cols);
|
|
1395
1396
|
for (this.maze.grid[n][i].visited = !0, o(n, i); t.length > 0; ) {
|
|
1396
|
-
const r = this.randomNumber(t.length), s = t[r], { row:
|
|
1397
|
+
const r = this.randomNumber(t.length), s = t[r], { row: l, col: a } = s, c = this.maze.getVisitedNeighbors(l, a);
|
|
1397
1398
|
if (c.length > 0) {
|
|
1398
1399
|
const _ = this.randomPick(c);
|
|
1399
|
-
this.maze.removeWall(
|
|
1400
|
+
this.maze.removeWall(l, a, _.row, _.col), this.maze.grid[l][a].visited = !0, o(l, a);
|
|
1400
1401
|
}
|
|
1401
1402
|
t.splice(r, 1);
|
|
1402
1403
|
}
|
|
@@ -1425,21 +1426,21 @@ const Oo = (e, t, o) => {
|
|
|
1425
1426
|
const o = e - 1, n = t[o];
|
|
1426
1427
|
if (!n)
|
|
1427
1428
|
return console.error(`Cannot find Level ${e}'s config.`), null;
|
|
1428
|
-
const i = n.size, r = i, s = i,
|
|
1429
|
+
const i = n.size, r = i, s = i, l = n.seed, a = n.method, c = n.entry || { row: 0, col: 0 }, _ = n.exit || {
|
|
1429
1430
|
row: r - 1,
|
|
1430
1431
|
col: s - 1
|
|
1431
|
-
}, u = Uo(r, s,
|
|
1432
|
-
for (let
|
|
1433
|
-
let
|
|
1432
|
+
}, u = Uo(r, s, a, l, c, _), h = Io(e), d = [];
|
|
1433
|
+
for (let v = 0; v < h; v++) {
|
|
1434
|
+
let m;
|
|
1434
1435
|
do
|
|
1435
|
-
|
|
1436
|
+
m = {
|
|
1436
1437
|
row: Math.floor(u.random() * r),
|
|
1437
1438
|
col: Math.floor(u.random() * s)
|
|
1438
1439
|
};
|
|
1439
|
-
while (
|
|
1440
|
-
(
|
|
1440
|
+
while (m.row === c.row && m.col === c.col || m.row === _.row && m.col === _.col || !Oo(u, m.row, m.col) || d.some(
|
|
1441
|
+
(C) => C.row === m.row && C.col === m.col
|
|
1441
1442
|
));
|
|
1442
|
-
d.push(
|
|
1443
|
+
d.push(m);
|
|
1443
1444
|
}
|
|
1444
1445
|
return {
|
|
1445
1446
|
maze: u,
|
|
@@ -1468,53 +1469,53 @@ const Oo = (e, t, o) => {
|
|
|
1468
1469
|
...i
|
|
1469
1470
|
}));
|
|
1470
1471
|
}
|
|
1471
|
-
}), wt = (e) =>
|
|
1472
|
-
const t = e.map((
|
|
1473
|
-
if (
|
|
1474
|
-
let
|
|
1472
|
+
}), wt = (e) => ve(() => {
|
|
1473
|
+
const t = e.map((l) => l.length), o = t.reduce((l, a) => l + a, 0), n = e.length, i = (l) => {
|
|
1474
|
+
if (l < 1 || l > o) return 0;
|
|
1475
|
+
let a = 0;
|
|
1475
1476
|
for (let c = 0; c < t.length; c++)
|
|
1476
|
-
if (
|
|
1477
|
+
if (a += t[c], l <= a) return c + 1;
|
|
1477
1478
|
return 0;
|
|
1478
|
-
}, r = (
|
|
1479
|
+
}, r = (l) => l < 1 || l > n ? 0 : t.slice(0, l - 1).reduce((a, c) => a + c, 0) + 1, s = {
|
|
1479
1480
|
getTotalLevels: () => o,
|
|
1480
1481
|
getTotalTiers: () => n,
|
|
1481
|
-
getTierLevelsRange: (
|
|
1482
|
-
if (
|
|
1483
|
-
const
|
|
1484
|
-
return [
|
|
1482
|
+
getTierLevelsRange: (l) => {
|
|
1483
|
+
if (l < 1 || l > n) return [0, 0];
|
|
1484
|
+
const a = r(l), c = a + t[l - 1] - 1;
|
|
1485
|
+
return [a, c];
|
|
1485
1486
|
},
|
|
1486
1487
|
getTierByLevel: i,
|
|
1487
1488
|
getFirstLevelOfTier: r,
|
|
1488
|
-
getLevelConfig: (
|
|
1489
|
-
if (
|
|
1490
|
-
const
|
|
1491
|
-
return e[
|
|
1489
|
+
getLevelConfig: (l) => {
|
|
1490
|
+
if (l < 1 || l > o) return null;
|
|
1491
|
+
const a = i(l), c = r(a), _ = l - c;
|
|
1492
|
+
return e[a - 1][_];
|
|
1492
1493
|
},
|
|
1493
|
-
getTierConfig: (
|
|
1494
|
-
isLevelUnlocked: (
|
|
1495
|
-
isTierUnlocked: (
|
|
1496
|
-
getNextLevelInfo: (
|
|
1497
|
-
if (
|
|
1498
|
-
const
|
|
1494
|
+
getTierConfig: (l) => l < 1 || l > n ? null : e[l - 1],
|
|
1495
|
+
isLevelUnlocked: (l, a) => l <= a,
|
|
1496
|
+
isTierUnlocked: (l, a) => l <= a,
|
|
1497
|
+
getNextLevelInfo: (l) => {
|
|
1498
|
+
if (l >= o) return null;
|
|
1499
|
+
const a = l + 1, c = i(l), _ = i(a);
|
|
1499
1500
|
return {
|
|
1500
|
-
nextLevel:
|
|
1501
|
+
nextLevel: a,
|
|
1501
1502
|
nextTier: _,
|
|
1502
1503
|
isTierChange: _ > c
|
|
1503
1504
|
};
|
|
1504
1505
|
},
|
|
1505
|
-
getCurrentTierProgress: (
|
|
1506
|
-
const [c, _] = s.getTierLevelsRange(
|
|
1506
|
+
getCurrentTierProgress: (l, a) => {
|
|
1507
|
+
const [c, _] = s.getTierLevelsRange(a), u = l - c + 1, h = _ - c + 1;
|
|
1507
1508
|
return { current: u, total: h };
|
|
1508
1509
|
},
|
|
1509
|
-
isLastLevelInTier: (
|
|
1510
|
-
const
|
|
1511
|
-
return
|
|
1510
|
+
isLastLevelInTier: (l) => {
|
|
1511
|
+
const a = i(l), [, c] = s.getTierLevelsRange(a);
|
|
1512
|
+
return l === c;
|
|
1512
1513
|
},
|
|
1513
|
-
getPreviousLevelInfo: (
|
|
1514
|
-
if (
|
|
1515
|
-
const
|
|
1514
|
+
getPreviousLevelInfo: (l) => {
|
|
1515
|
+
if (l <= 1) return null;
|
|
1516
|
+
const a = l - 1, c = i(l), _ = i(a);
|
|
1516
1517
|
return {
|
|
1517
|
-
prevLevel:
|
|
1518
|
+
prevLevel: a,
|
|
1518
1519
|
prevTier: _,
|
|
1519
1520
|
isTierChange: _ < c
|
|
1520
1521
|
};
|
|
@@ -1522,7 +1523,7 @@ const Oo = (e, t, o) => {
|
|
|
1522
1523
|
};
|
|
1523
1524
|
return s;
|
|
1524
1525
|
}, [e]), Do = () => {
|
|
1525
|
-
const { gameState: e, setGameState: t, resetGame: o, config: n } = _t(), i = n.current.i18n, r = n.current.levelConfig, s = wt(r), { showToast:
|
|
1526
|
+
const { gameState: e, setGameState: t, resetGame: o, config: n } = _t(), i = n.current.i18n, r = n.current.levelConfig, s = wt(r), { showToast: l } = Ce(), { currentLevel: a, totalScore: c, levelScores: _, currentScore: u, showClue: h } = e, d = _[a] || 0, v = s.getTotalTiers(), [m, C] = $(!1), [g, p] = $(!1), [T, k] = $(!1), [E, P] = $(s.getTierLevelsRange(1)), { generateCurrentLevelMaze: F } = yt({
|
|
1526
1527
|
gameState: e,
|
|
1527
1528
|
setGameState: t,
|
|
1528
1529
|
config: n
|
|
@@ -1537,25 +1538,25 @@ const Oo = (e, t, o) => {
|
|
|
1537
1538
|
s.isLevelUnlocked(
|
|
1538
1539
|
Y,
|
|
1539
1540
|
e.highestUnlockedLevel
|
|
1540
|
-
) && (t((
|
|
1541
|
-
},
|
|
1541
|
+
) && (t((Nt) => ({ ...Nt, currentTier: L })), N(Y));
|
|
1542
|
+
}, N = (L) => {
|
|
1542
1543
|
s.isLevelUnlocked(L, e.highestUnlockedLevel) && (t((Y) => ({
|
|
1543
1544
|
...Y,
|
|
1544
1545
|
currentLevel: L
|
|
1545
|
-
})), F(),
|
|
1546
|
+
})), F(), l(
|
|
1546
1547
|
i.levelGoToast.replace("%LEVEL%", L.toString()),
|
|
1547
1548
|
"success"
|
|
1548
1549
|
));
|
|
1549
|
-
},
|
|
1550
|
-
|
|
1550
|
+
}, S = () => {
|
|
1551
|
+
C(!0);
|
|
1551
1552
|
}, z = () => {
|
|
1552
|
-
|
|
1553
|
+
C(!1);
|
|
1553
1554
|
}, U = () => {
|
|
1554
1555
|
k(!0);
|
|
1555
1556
|
}, bt = () => {
|
|
1556
1557
|
k(!1);
|
|
1557
1558
|
}, kt = () => {
|
|
1558
|
-
t((L) => (
|
|
1559
|
+
t((L) => (l(L.showClue ? i.cluePathDisabled : i.cluePathEnabled), {
|
|
1559
1560
|
...L,
|
|
1560
1561
|
showClue: !L.showClue,
|
|
1561
1562
|
currentScore: Math.floor(L.currentScore / 2)
|
|
@@ -1564,7 +1565,7 @@ const Oo = (e, t, o) => {
|
|
|
1564
1565
|
}, Tt = () => {
|
|
1565
1566
|
p(!0);
|
|
1566
1567
|
}, zt = () => {
|
|
1567
|
-
o(), p(!1),
|
|
1568
|
+
o(), p(!1), l(i.resetDoneToast);
|
|
1568
1569
|
}, Pt = () => {
|
|
1569
1570
|
p(!1);
|
|
1570
1571
|
};
|
|
@@ -1575,7 +1576,7 @@ const Oo = (e, t, o) => {
|
|
|
1575
1576
|
xo,
|
|
1576
1577
|
{
|
|
1577
1578
|
i18n: i,
|
|
1578
|
-
totalTiers:
|
|
1579
|
+
totalTiers: v,
|
|
1579
1580
|
currentTier: e.currentTier,
|
|
1580
1581
|
highestUnlockedTier: e.highestUnlockedTier,
|
|
1581
1582
|
onTierChange: M,
|
|
@@ -1589,7 +1590,7 @@ const Oo = (e, t, o) => {
|
|
|
1589
1590
|
levelsRange: E,
|
|
1590
1591
|
currentLevel: e.currentLevel,
|
|
1591
1592
|
highestUnlockedLevel: e.highestUnlockedLevel,
|
|
1592
|
-
onLevelChange:
|
|
1593
|
+
onLevelChange: N,
|
|
1593
1594
|
disabled: e.levelTransitioning
|
|
1594
1595
|
}
|
|
1595
1596
|
)
|
|
@@ -1619,16 +1620,16 @@ const Oo = (e, t, o) => {
|
|
|
1619
1620
|
] })
|
|
1620
1621
|
] }),
|
|
1621
1622
|
/* @__PURE__ */ f("div", { className: "game-settings", children: /* @__PURE__ */ f(
|
|
1622
|
-
|
|
1623
|
+
So,
|
|
1623
1624
|
{
|
|
1624
|
-
onClick:
|
|
1625
|
+
onClick: S,
|
|
1625
1626
|
className: "game-settings-icon"
|
|
1626
1627
|
}
|
|
1627
1628
|
) }),
|
|
1628
1629
|
/* @__PURE__ */ f(
|
|
1629
|
-
|
|
1630
|
+
le,
|
|
1630
1631
|
{
|
|
1631
|
-
isOpen:
|
|
1632
|
+
isOpen: m,
|
|
1632
1633
|
title: i.settings,
|
|
1633
1634
|
noConfirm: !0,
|
|
1634
1635
|
cancelText: i.close,
|
|
@@ -1664,7 +1665,7 @@ const Oo = (e, t, o) => {
|
|
|
1664
1665
|
}
|
|
1665
1666
|
),
|
|
1666
1667
|
/* @__PURE__ */ f(
|
|
1667
|
-
|
|
1668
|
+
le,
|
|
1668
1669
|
{
|
|
1669
1670
|
isOpen: g,
|
|
1670
1671
|
title: i.confirmReset,
|
|
@@ -1676,7 +1677,7 @@ const Oo = (e, t, o) => {
|
|
|
1676
1677
|
}
|
|
1677
1678
|
),
|
|
1678
1679
|
/* @__PURE__ */ f(
|
|
1679
|
-
|
|
1680
|
+
le,
|
|
1680
1681
|
{
|
|
1681
1682
|
isOpen: T,
|
|
1682
1683
|
title: i.confirmClue,
|
|
@@ -1688,7 +1689,7 @@ const Oo = (e, t, o) => {
|
|
|
1688
1689
|
}
|
|
1689
1690
|
)
|
|
1690
1691
|
] });
|
|
1691
|
-
},
|
|
1692
|
+
}, Wo = ({
|
|
1692
1693
|
message: e,
|
|
1693
1694
|
visible: t,
|
|
1694
1695
|
duration: o = 2e3,
|
|
@@ -1702,15 +1703,15 @@ const Oo = (e, t, o) => {
|
|
|
1702
1703
|
}, o)), () => {
|
|
1703
1704
|
s && clearTimeout(s);
|
|
1704
1705
|
};
|
|
1705
|
-
}, [t, o, n]), /* @__PURE__ */ f("div", { className: `toast-container position-${i}`, children: /* @__PURE__ */ f("div", { className: `toast-message type-${r} ${t ? "toast-visible" : ""}`, children: e }) })) : null,
|
|
1706
|
+
}, [t, o, n]), /* @__PURE__ */ f("div", { className: `toast-container position-${i}`, children: /* @__PURE__ */ f("div", { className: `toast-message type-${r} ${t ? "toast-visible" : ""}`, children: e }) })) : null, jo = (e, t, o) => {
|
|
1706
1707
|
A(() => {
|
|
1707
1708
|
const n = () => {
|
|
1708
1709
|
const i = e.current;
|
|
1709
1710
|
if (!i) return;
|
|
1710
1711
|
const r = i.parentElement;
|
|
1711
1712
|
if (!r) return;
|
|
1712
|
-
const s = r.clientWidth,
|
|
1713
|
-
i.style.width = `${s}px`, i.style.height = `${s}px`, i.width = s *
|
|
1713
|
+
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(e, o.current);
|
|
1714
1715
|
};
|
|
1715
1716
|
return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
|
|
1716
1717
|
}, [e]);
|
|
@@ -1719,7 +1720,7 @@ const Oo = (e, t, o) => {
|
|
|
1719
1720
|
ArrowDown: [1, 0],
|
|
1720
1721
|
ArrowLeft: [0, -1],
|
|
1721
1722
|
ArrowRight: [0, 1]
|
|
1722
|
-
},
|
|
1723
|
+
}, Ho = ({
|
|
1723
1724
|
containerRef: e,
|
|
1724
1725
|
gameState: t,
|
|
1725
1726
|
setGameState: o,
|
|
@@ -1727,29 +1728,29 @@ const Oo = (e, t, o) => {
|
|
|
1727
1728
|
onFoodNotAllCollected: i
|
|
1728
1729
|
}) => {
|
|
1729
1730
|
A(() => {
|
|
1730
|
-
const r = (
|
|
1731
|
+
const r = (a) => {
|
|
1731
1732
|
if (!t.isGameActive || !t.maze) return;
|
|
1732
|
-
const [c, _] = Ve[
|
|
1733
|
-
if (!t.maze.isValid(d,
|
|
1734
|
-
const
|
|
1735
|
-
if (c === -1 &&
|
|
1733
|
+
const [c, _] = Ve[a], { row: u, col: h } = t.playerPosition, d = u + c, v = h + _;
|
|
1734
|
+
if (!t.maze.isValid(d, v)) return;
|
|
1735
|
+
const m = t.maze.grid[u][h];
|
|
1736
|
+
if (c === -1 && m.walls.top || c === 1 && m.walls.bottom || _ === -1 && m.walls.left || _ === 1 && m.walls.right)
|
|
1736
1737
|
return;
|
|
1737
|
-
const
|
|
1738
|
+
const C = { row: d, col: v }, g = `${d},${v}`;
|
|
1738
1739
|
o((p) => {
|
|
1739
1740
|
const T = p.foodPositions.some(
|
|
1740
|
-
(
|
|
1741
|
+
(S) => S.row === d && S.col === v
|
|
1741
1742
|
);
|
|
1742
1743
|
T && n();
|
|
1743
1744
|
const k = Math.max(
|
|
1744
1745
|
0,
|
|
1745
1746
|
p.currentScore - 1
|
|
1746
|
-
), E = `${u},${h}-${d},${
|
|
1747
|
+
), E = `${u},${h}-${d},${v}`, P = d === p.exitPosition.row && v === p.exitPosition.col, F = T ? p.foodCollected + 1 : p.foodCollected, M = F === p.totalFoodCount, N = P && M;
|
|
1747
1748
|
return P && !M && i(), {
|
|
1748
1749
|
...p,
|
|
1749
|
-
playerPosition:
|
|
1750
|
-
playerPath: [...p.playerPath,
|
|
1750
|
+
playerPosition: C,
|
|
1751
|
+
playerPath: [...p.playerPath, C],
|
|
1751
1752
|
foodPositions: p.foodPositions.filter(
|
|
1752
|
-
(
|
|
1753
|
+
(S) => !(S.row === d && S.col === v)
|
|
1753
1754
|
),
|
|
1754
1755
|
foodCollected: F,
|
|
1755
1756
|
currentScore: k,
|
|
@@ -1760,23 +1761,23 @@ const Oo = (e, t, o) => {
|
|
|
1760
1761
|
},
|
|
1761
1762
|
moveCount: p.moveCount + 1,
|
|
1762
1763
|
playerAtExit: P,
|
|
1763
|
-
isGameActive: !
|
|
1764
|
-
levelTransitioning:
|
|
1764
|
+
isGameActive: !N,
|
|
1765
|
+
levelTransitioning: N
|
|
1765
1766
|
};
|
|
1766
1767
|
});
|
|
1767
|
-
}, s = (
|
|
1768
|
+
}, s = (a) => {
|
|
1768
1769
|
if (!t.isGameActive || !t.maze) return;
|
|
1769
|
-
const c =
|
|
1770
|
-
c in Ve && (
|
|
1771
|
-
},
|
|
1772
|
-
if (
|
|
1773
|
-
const c =
|
|
1770
|
+
const c = a.key;
|
|
1771
|
+
c in Ve && (a.preventDefault(), r(c));
|
|
1772
|
+
}, l = (a) => {
|
|
1773
|
+
if (a.preventDefault(), !t.isGameActive || !t.maze) return;
|
|
1774
|
+
const c = a.touches[0], _ = document.elementFromPoint(c.clientX, c.clientY);
|
|
1774
1775
|
_ && (_.classList.contains("maze-up") ? r("ArrowUp") : _.classList.contains("maze-down") ? r("ArrowDown") : _.classList.contains("maze-left") ? r("ArrowLeft") : _.classList.contains("maze-right") && r("ArrowRight"));
|
|
1775
1776
|
};
|
|
1776
|
-
return window.addEventListener("keydown", s), e.current?.addEventListener("touchstart",
|
|
1777
|
+
return window.addEventListener("keydown", s), e.current?.addEventListener("touchstart", l, {
|
|
1777
1778
|
passive: !1
|
|
1778
1779
|
}), () => {
|
|
1779
|
-
window.removeEventListener("keydown", s), e.current?.removeEventListener("touchstart",
|
|
1780
|
+
window.removeEventListener("keydown", s), e.current?.removeEventListener("touchstart", l);
|
|
1780
1781
|
};
|
|
1781
1782
|
}, [
|
|
1782
1783
|
t.isGameActive,
|
|
@@ -1784,7 +1785,7 @@ const Oo = (e, t, o) => {
|
|
|
1784
1785
|
t.playerPosition,
|
|
1785
1786
|
t.exitPosition
|
|
1786
1787
|
]);
|
|
1787
|
-
},
|
|
1788
|
+
}, Go = ({
|
|
1788
1789
|
gameState: e,
|
|
1789
1790
|
setGameState: t,
|
|
1790
1791
|
config: o,
|
|
@@ -1794,36 +1795,36 @@ const Oo = (e, t, o) => {
|
|
|
1794
1795
|
A(() => {
|
|
1795
1796
|
if (e.levelTransitioning) {
|
|
1796
1797
|
n();
|
|
1797
|
-
const
|
|
1798
|
+
const l = setTimeout(() => {
|
|
1798
1799
|
s(
|
|
1799
1800
|
e.currentScore,
|
|
1800
1801
|
o.current.levelConfig
|
|
1801
1802
|
);
|
|
1802
1803
|
}, 1e3);
|
|
1803
|
-
return () => clearTimeout(
|
|
1804
|
+
return () => clearTimeout(l);
|
|
1804
1805
|
}
|
|
1805
1806
|
}, [e.levelTransitioning]);
|
|
1806
|
-
const r = wt(o.current.levelConfig), s = (
|
|
1807
|
+
const r = wt(o.current.levelConfig), s = (l, a) => {
|
|
1807
1808
|
const c = r.getNextLevelInfo(
|
|
1808
1809
|
e.currentLevel
|
|
1809
1810
|
);
|
|
1810
1811
|
if (!c) return;
|
|
1811
|
-
const { nextLevel: _, nextTier: u, isTierChange: h } = c, d = Ct(_,
|
|
1812
|
-
d && t((
|
|
1812
|
+
const { nextLevel: _, nextTier: u, isTierChange: h } = c, d = Ct(_, a.flat());
|
|
1813
|
+
d && t((v) => {
|
|
1813
1814
|
h && i(u);
|
|
1814
|
-
const
|
|
1815
|
-
return v
|
|
1816
|
-
|
|
1817
|
-
v
|
|
1815
|
+
const m = { ...v.levelScores };
|
|
1816
|
+
return m[v.currentLevel] = Math.max(
|
|
1817
|
+
l,
|
|
1818
|
+
m[v.currentLevel] || 0
|
|
1818
1819
|
), {
|
|
1819
|
-
...
|
|
1820
|
+
...v,
|
|
1820
1821
|
...d,
|
|
1821
1822
|
currentLevel: _,
|
|
1822
1823
|
currentTier: u,
|
|
1823
|
-
highestUnlockedLevel: Math.max(
|
|
1824
|
-
highestUnlockedTier: Math.max(
|
|
1825
|
-
levelScores:
|
|
1826
|
-
totalScore: Object.values(
|
|
1824
|
+
highestUnlockedLevel: Math.max(v.highestUnlockedLevel, _),
|
|
1825
|
+
highestUnlockedTier: Math.max(v.highestUnlockedTier, u),
|
|
1826
|
+
levelScores: m,
|
|
1827
|
+
totalScore: Object.values(m).reduce((C, g) => C + g, 0),
|
|
1827
1828
|
showClue: !1,
|
|
1828
1829
|
// reset to false on new level
|
|
1829
1830
|
isGameActive: !0,
|
|
@@ -1840,45 +1841,45 @@ function Bo(e, t) {
|
|
|
1840
1841
|
t.playerColor = e.playerAtExit ? t.playerAtExitColor : t.playerColor;
|
|
1841
1842
|
const {
|
|
1842
1843
|
padding: s,
|
|
1843
|
-
wallWidth:
|
|
1844
|
-
wallColor:
|
|
1844
|
+
wallWidth: l,
|
|
1845
|
+
wallColor: a,
|
|
1845
1846
|
playerColor: c,
|
|
1846
1847
|
exitColor: _,
|
|
1847
1848
|
foodColor: u,
|
|
1848
1849
|
clueColor: h,
|
|
1849
1850
|
backgroundColor: d
|
|
1850
|
-
} = t,
|
|
1851
|
+
} = t, v = r.cols, m = r.rows, C = (n - s * 2) / v, g = (i - s * 2) / m;
|
|
1851
1852
|
o.clearRect(0, 0, n, i), o.save(), o.fillStyle = d, o.fillRect(0, 0, n, i), o.restore(), e.showClue && e.playerPath && e.playerPath.length > 0 && Ko(e, {
|
|
1852
|
-
cellWidth:
|
|
1853
|
+
cellWidth: C,
|
|
1853
1854
|
cellHeight: g,
|
|
1854
1855
|
padding: s,
|
|
1855
1856
|
clueColor: h
|
|
1856
1857
|
}), Vo(e, {
|
|
1857
|
-
cellWidth:
|
|
1858
|
+
cellWidth: C,
|
|
1858
1859
|
cellHeight: g,
|
|
1859
1860
|
padding: s,
|
|
1860
|
-
wallColor:
|
|
1861
|
-
wallWidth:
|
|
1861
|
+
wallColor: a,
|
|
1862
|
+
wallWidth: l
|
|
1862
1863
|
}), Yo(e, {
|
|
1863
|
-
cellWidth:
|
|
1864
|
+
cellWidth: C,
|
|
1864
1865
|
cellHeight: g,
|
|
1865
1866
|
padding: s,
|
|
1866
1867
|
foodColor: u
|
|
1867
1868
|
}), e.playerAtExit || Xo(e, {
|
|
1868
|
-
cellWidth:
|
|
1869
|
+
cellWidth: C,
|
|
1869
1870
|
cellHeight: g,
|
|
1870
1871
|
padding: s,
|
|
1871
1872
|
exitColor: _
|
|
1872
1873
|
}), qo(e, {
|
|
1873
|
-
cellWidth:
|
|
1874
|
+
cellWidth: C,
|
|
1874
1875
|
cellHeight: g,
|
|
1875
1876
|
padding: s,
|
|
1876
1877
|
playerColor: c
|
|
1877
1878
|
});
|
|
1878
1879
|
}
|
|
1879
1880
|
function Vo(e, t) {
|
|
1880
|
-
const { ctx: o, maze: n } = e, { cellWidth: i, cellHeight: r, padding: s, wallColor:
|
|
1881
|
-
o.save(), o.strokeStyle =
|
|
1881
|
+
const { ctx: o, maze: n } = e, { cellWidth: i, cellHeight: r, padding: s, wallColor: l, wallWidth: a } = t;
|
|
1882
|
+
o.save(), o.strokeStyle = l, o.lineWidth = a, o.lineCap = "round", o.beginPath();
|
|
1882
1883
|
for (let c = 0; c < n.rows; c++)
|
|
1883
1884
|
for (let _ = 0; _ < n.cols; _++) {
|
|
1884
1885
|
const u = n.grid[c][_], h = s + _ * i, d = s + c * r;
|
|
@@ -1887,29 +1888,29 @@ function Vo(e, t) {
|
|
|
1887
1888
|
o.stroke(), o.restore();
|
|
1888
1889
|
}
|
|
1889
1890
|
function qo(e, t) {
|
|
1890
|
-
const { ctx: o, playerPosition: n } = e, { cellWidth: i, cellHeight: r, padding: s, playerColor:
|
|
1891
|
+
const { ctx: o, playerPosition: n } = e, { cellWidth: i, cellHeight: r, padding: s, playerColor: l } = t, { x: a, y: c } = q(
|
|
1891
1892
|
n.row,
|
|
1892
1893
|
n.col,
|
|
1893
1894
|
i,
|
|
1894
1895
|
r,
|
|
1895
1896
|
s
|
|
1896
1897
|
), _ = Math.min(i, r) * 0.35;
|
|
1897
|
-
o.save(), o.fillStyle =
|
|
1898
|
+
o.save(), o.fillStyle = l, o.beginPath(), o.arc(a, c, _, 0, Math.PI * 2), o.fill(), o.restore();
|
|
1898
1899
|
}
|
|
1899
1900
|
function Xo(e, t) {
|
|
1900
|
-
const { ctx: o, exitPosition: n } = e, { cellWidth: i, cellHeight: r, padding: s, exitColor:
|
|
1901
|
+
const { ctx: o, exitPosition: n } = e, { cellWidth: i, cellHeight: r, padding: s, exitColor: l } = t, { x: a, y: c } = q(
|
|
1901
1902
|
n.row,
|
|
1902
1903
|
n.col,
|
|
1903
1904
|
i,
|
|
1904
1905
|
r,
|
|
1905
1906
|
s
|
|
1906
1907
|
), _ = Math.min(i, r) * 0.35;
|
|
1907
|
-
o.save(), o.fillStyle =
|
|
1908
|
+
o.save(), o.fillStyle = l, o.beginPath(), o.arc(a, c, _, 0, Math.PI * 2), o.fill(), o.restore();
|
|
1908
1909
|
}
|
|
1909
1910
|
function Yo(e, t) {
|
|
1910
|
-
const { ctx: o, foodPositions: n } = e, { cellWidth: i, cellHeight: r, padding: s, foodColor:
|
|
1911
|
-
o.fillStyle =
|
|
1912
|
-
const
|
|
1911
|
+
const { ctx: o, foodPositions: n } = e, { cellWidth: i, cellHeight: r, padding: s, foodColor: l } = t;
|
|
1912
|
+
o.fillStyle = l;
|
|
1913
|
+
const a = Math.min(i, r) * 0.25;
|
|
1913
1914
|
n.forEach((c) => {
|
|
1914
1915
|
const { x: _, y: u } = q(
|
|
1915
1916
|
c.row,
|
|
@@ -1918,30 +1919,42 @@ function Yo(e, t) {
|
|
|
1918
1919
|
r,
|
|
1919
1920
|
s
|
|
1920
1921
|
);
|
|
1921
|
-
Jo(o, _, u,
|
|
1922
|
+
Jo(o, _, u, a * 1.2, 5, a * 0.6);
|
|
1922
1923
|
});
|
|
1923
1924
|
}
|
|
1924
1925
|
function Jo(e, t, o, n, i, r) {
|
|
1925
1926
|
e.save(), e.beginPath();
|
|
1926
1927
|
for (let s = 0; s < i * 2; s++) {
|
|
1927
|
-
const
|
|
1928
|
-
e.lineTo(t +
|
|
1928
|
+
const l = s % 2 === 0 ? n : r, a = Math.PI * s / i;
|
|
1929
|
+
e.lineTo(t + l * Math.sin(a), o + l * Math.cos(a));
|
|
1929
1930
|
}
|
|
1930
1931
|
e.closePath(), e.fill(), e.restore();
|
|
1931
1932
|
}
|
|
1932
1933
|
function Ko(e, t) {
|
|
1933
|
-
const { ctx: o, playerPath: n, visitCounts: i } = e, { cellWidth: r, cellHeight: s, padding:
|
|
1934
|
+
const { ctx: o, playerPath: n, visitCounts: i } = e, { cellWidth: r, cellHeight: s, padding: l, clueColor: a } = t;
|
|
1934
1935
|
if (!(!n || n.length < 2 || !i)) {
|
|
1935
1936
|
o.save();
|
|
1936
1937
|
for (let c = 1; c < n.length; c++) {
|
|
1937
|
-
const _ = n[c - 1], u = n[c], h = `${_.row},${_.col}-${u.row},${u.col}`, d = `${u.row},${u.col}-${_.row},${_.col}`,
|
|
1938
|
+
const _ = n[c - 1], u = n[c], h = `${_.row},${_.col}-${u.row},${u.col}`, d = `${u.row},${u.col}-${_.row},${_.col}`, v = (i[h] || 0) + (i[d] || 0), m = Math.min(0.2 + v * 0.1, 0.9), C = Math.max(3, r * 0.1) + v * 0.5;
|
|
1938
1939
|
try {
|
|
1939
|
-
o.strokeStyle =
|
|
1940
|
+
o.strokeStyle = a.replace(")", `, ${m})`).replace("rgb(", "rgba(");
|
|
1940
1941
|
} catch {
|
|
1941
|
-
o.strokeStyle = `rgba(255, 0, 0, ${
|
|
1942
|
+
o.strokeStyle = `rgba(255, 0, 0, ${m})`;
|
|
1942
1943
|
}
|
|
1943
|
-
o.lineWidth =
|
|
1944
|
-
const { x: g, y: p } = q(
|
|
1944
|
+
o.lineWidth = C, o.lineCap = "round", o.lineJoin = "round";
|
|
1945
|
+
const { x: g, y: p } = q(
|
|
1946
|
+
_.row,
|
|
1947
|
+
_.col,
|
|
1948
|
+
r,
|
|
1949
|
+
s,
|
|
1950
|
+
l
|
|
1951
|
+
), { x: T, y: k } = q(
|
|
1952
|
+
u.row,
|
|
1953
|
+
u.col,
|
|
1954
|
+
r,
|
|
1955
|
+
s,
|
|
1956
|
+
l
|
|
1957
|
+
);
|
|
1945
1958
|
o.beginPath(), o.moveTo(g, p), o.lineTo(T, k), o.stroke();
|
|
1946
1959
|
}
|
|
1947
1960
|
o.restore();
|
|
@@ -1956,7 +1969,7 @@ function q(e, t, o, n, i) {
|
|
|
1956
1969
|
const Zo = new co(), Qo = () => {
|
|
1957
1970
|
const { message: e, visible: t, type: o, hideToast: n } = Ce();
|
|
1958
1971
|
return /* @__PURE__ */ f(
|
|
1959
|
-
|
|
1972
|
+
Wo,
|
|
1960
1973
|
{
|
|
1961
1974
|
message: e,
|
|
1962
1975
|
visible: t,
|
|
@@ -1966,68 +1979,74 @@ const Zo = new co(), Qo = () => {
|
|
|
1966
1979
|
}
|
|
1967
1980
|
);
|
|
1968
1981
|
}, en = () => {
|
|
1969
|
-
const { gameState: e, setGameState: t, config: o } = _t(), n =
|
|
1982
|
+
const { gameState: e, setGameState: t, config: o } = _t(), n = G(null), i = G(null), r = G(e), s = o.current.i18n, { showToast: l } = Ce();
|
|
1970
1983
|
A(() => {
|
|
1971
1984
|
r.current = e;
|
|
1972
1985
|
}, [e]);
|
|
1973
|
-
const
|
|
1986
|
+
const a = () => {
|
|
1974
1987
|
const h = e.totalFoodCount - e.foodCollected - 1;
|
|
1975
1988
|
if (h > 0) {
|
|
1976
|
-
|
|
1989
|
+
l(
|
|
1977
1990
|
s.foodCollectedToast.replace("%NUM%", h.toString()),
|
|
1978
1991
|
"success"
|
|
1979
1992
|
);
|
|
1980
1993
|
return;
|
|
1981
1994
|
}
|
|
1982
|
-
|
|
1995
|
+
l(s.allFoodCollectedToast, "success");
|
|
1983
1996
|
}, c = () => {
|
|
1984
1997
|
const h = e.totalFoodCount - e.foodCollected - 1;
|
|
1985
|
-
|
|
1998
|
+
l(
|
|
1986
1999
|
s.warnNotAllFoodCollectedToast.replace("%NUM%", h.toString()),
|
|
1987
2000
|
"warning"
|
|
1988
2001
|
);
|
|
1989
2002
|
}, _ = (h, d) => {
|
|
1990
|
-
const
|
|
1991
|
-
|
|
1992
|
-
{
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2003
|
+
const v = h.current?.getContext("2d");
|
|
2004
|
+
if (v && d.maze) {
|
|
2005
|
+
const m = o.current.renderConfig || {}, g = o.current.levelConfig.flat()[d.currentLevel - 1];
|
|
2006
|
+
g.wallWidth ? m.wallWidth = g.wallWidth : d.currentLevel > 40 && (m.wallWidth -= m.wallWidth * 0.05 * (d.currentLevel - 40), m.wallWidth = Math.max(
|
|
2007
|
+
m.wallWidth,
|
|
2008
|
+
m.minWallWidth
|
|
2009
|
+
)), Bo(
|
|
2010
|
+
{
|
|
2011
|
+
ctx: v,
|
|
2012
|
+
width: h.current.width,
|
|
2013
|
+
height: h.current.height,
|
|
2014
|
+
maze: d.maze,
|
|
2015
|
+
playerPosition: d.playerPosition,
|
|
2016
|
+
exitPosition: d.exitPosition,
|
|
2017
|
+
foodPositions: d.foodPositions,
|
|
2018
|
+
showClue: d.showClue,
|
|
2019
|
+
playerPath: d.playerPath,
|
|
2020
|
+
visitCounts: d.visitCounts,
|
|
2021
|
+
playerAtExit: d.playerAtExit
|
|
2022
|
+
},
|
|
2023
|
+
m
|
|
2024
|
+
);
|
|
2025
|
+
}
|
|
2007
2026
|
};
|
|
2008
2027
|
A(() => {
|
|
2009
|
-
|
|
2010
|
-
}, []),
|
|
2028
|
+
l(s.useArrowKeyTips, "info", 3e3);
|
|
2029
|
+
}, []), jo(i, _, r);
|
|
2011
2030
|
const { generateCurrentLevelMaze: u } = yt({
|
|
2012
2031
|
gameState: e,
|
|
2013
2032
|
setGameState: t,
|
|
2014
2033
|
config: o
|
|
2015
2034
|
});
|
|
2016
|
-
return
|
|
2035
|
+
return Ho({
|
|
2017
2036
|
containerRef: n,
|
|
2018
2037
|
gameState: e,
|
|
2019
2038
|
setGameState: t,
|
|
2020
|
-
onFoodCollected:
|
|
2039
|
+
onFoodCollected: a,
|
|
2021
2040
|
onFoodNotAllCollected: c
|
|
2022
|
-
}),
|
|
2041
|
+
}), Go({
|
|
2023
2042
|
gameState: e,
|
|
2024
2043
|
setGameState: t,
|
|
2025
2044
|
config: o,
|
|
2026
2045
|
onLevelComplete: () => {
|
|
2027
|
-
Zo.addConfetti(),
|
|
2046
|
+
Zo.addConfetti(), l(s.levelCompleteToast, "success");
|
|
2028
2047
|
},
|
|
2029
2048
|
onTierUnlocked: (h) => {
|
|
2030
|
-
|
|
2049
|
+
l(
|
|
2031
2050
|
s.tierUnlockedToast.replace("%TIER%", h.toString()),
|
|
2032
2051
|
"success"
|
|
2033
2052
|
);
|
|
@@ -2066,7 +2085,7 @@ function on({ config: e = {} }) {
|
|
|
2066
2085
|
}, /* @__PURE__ */ f(Ot, { config: e, children: /* @__PURE__ */ f(tn, {}) });
|
|
2067
2086
|
}
|
|
2068
2087
|
const nn = {
|
|
2069
|
-
root: "https://unpkg.com/@roudanio/maze@0.0.
|
|
2088
|
+
root: "https://unpkg.com/@roudanio/maze@0.0.5/dist/",
|
|
2070
2089
|
...ee
|
|
2071
2090
|
};
|
|
2072
2091
|
`${JSON.stringify(nn, null, 2)}`;
|
|
@@ -2075,8 +2094,8 @@ const rn = {
|
|
|
2075
2094
|
const o = typeof e == "string" ? document.querySelector(e) : e;
|
|
2076
2095
|
if (!o) {
|
|
2077
2096
|
console.warn("Cannot find the root element");
|
|
2078
|
-
const
|
|
2079
|
-
|
|
2097
|
+
const a = document.createElement("div");
|
|
2098
|
+
a.style.textAlign = "center", a.style.padding = "20px", a.innerHTML = "Cannot find the root element", document.body.append(a);
|
|
2080
2099
|
return;
|
|
2081
2100
|
}
|
|
2082
2101
|
let { root: n = location.origin } = t;
|
|
@@ -2100,9 +2119,9 @@ const rn = {
|
|
|
2100
2119
|
@keyframes loading {
|
|
2101
2120
|
0% { width: 0%; }
|
|
2102
2121
|
100% { width: 99%; }
|
|
2103
|
-
}`, document.head.appendChild(s), await (async (
|
|
2122
|
+
}`, document.head.appendChild(s), await (async (a) => new Promise((c, _) => {
|
|
2104
2123
|
const u = document.createElement("link");
|
|
2105
|
-
u.rel = "stylesheet", u.type = "text/css", u.href =
|
|
2124
|
+
u.rel = "stylesheet", u.type = "text/css", u.href = a, u.onload = c, u.onerror = _, document.head.appendChild(u);
|
|
2106
2125
|
}))(n + "maze.css"), Mt(/* @__PURE__ */ f(on, { config: t }), o);
|
|
2107
2126
|
}
|
|
2108
2127
|
};
|