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