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