@roudanio/maze 0.2.1 → 0.2.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.js CHANGED
@@ -1,440 +1,440 @@
1
- var fe, A, Je, X, Pe, Ze, Qe, et, Se, Ce, ye, tt, ee = {}, nt = [], bt = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, me = Array.isArray;
2
- function H(t, e) {
3
- for (var n in e) t[n] = e[n];
4
- return t;
1
+ var _e, M, Je, Y, Pe, Ze, Qe, et, ze, ye, be, tt, ne = {}, nt = [], yt = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ve = Array.isArray;
2
+ function B(e, t) {
3
+ for (var n in t) e[n] = t[n];
4
+ return e;
5
5
  }
6
- function ze(t) {
7
- t && t.parentNode && t.parentNode.removeChild(t);
6
+ function Ee(e) {
7
+ e && e.parentNode && e.parentNode.removeChild(e);
8
8
  }
9
- function Tt(t, e, n) {
10
- var o, i, s, a = {};
11
- for (s in e) s == "key" ? o = e[s] : s == "ref" ? i = e[s] : a[s] = e[s];
12
- if (arguments.length > 2 && (a.children = arguments.length > 3 ? fe.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) a[s] == null && (a[s] = t.defaultProps[s]);
13
- return se(t, a, o, i, null);
9
+ function bt(e, t, n) {
10
+ var o, i, s, l = {};
11
+ for (s in t) s == "key" ? o = t[s] : s == "ref" ? i = t[s] : l[s] = t[s];
12
+ if (arguments.length > 2 && (l.children = arguments.length > 3 ? _e.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (s in e.defaultProps) l[s] == null && (l[s] = e.defaultProps[s]);
13
+ return ae(e, l, o, i, null);
14
14
  }
15
- function se(t, e, n, o, i) {
16
- var s = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++Je, __i: -1, __u: 0 };
17
- return i == null && A.vnode != null && A.vnode(s), s;
15
+ function ae(e, t, n, o, i) {
16
+ var s = { type: e, props: t, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++Je, __i: -1, __u: 0 };
17
+ return i == null && M.vnode != null && M.vnode(s), s;
18
18
  }
19
- function _e(t) {
20
- return t.children;
19
+ function ge(e) {
20
+ return e.children;
21
21
  }
22
- function ae(t, e) {
23
- this.props = t, this.context = e;
22
+ function ce(e, t) {
23
+ this.props = e, this.context = t;
24
24
  }
25
- function K(t, e) {
26
- if (e == null) return t.__ ? K(t.__, t.__i + 1) : null;
27
- for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
28
- return typeof t.type == "function" ? K(t) : null;
25
+ function Z(e, t) {
26
+ if (t == null) return e.__ ? Z(e.__, e.__i + 1) : null;
27
+ for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
28
+ return typeof e.type == "function" ? Z(e) : null;
29
29
  }
30
- function ot(t) {
31
- var e, n;
32
- if ((t = t.__) != null && t.__c != null) {
33
- for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
34
- t.__e = t.__c.base = n.__e;
30
+ function ot(e) {
31
+ var t, n;
32
+ if ((e = e.__) != null && e.__c != null) {
33
+ for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) {
34
+ e.__e = e.__c.base = n.__e;
35
35
  break;
36
36
  }
37
- return ot(t);
37
+ return ot(e);
38
38
  }
39
39
  }
40
- function be(t) {
41
- (!t.__d && (t.__d = !0) && X.push(t) && !de.__r++ || Pe != A.debounceRendering) && ((Pe = A.debounceRendering) || Ze)(de);
40
+ function Te(e) {
41
+ (!e.__d && (e.__d = !0) && Y.push(e) && !fe.__r++ || Pe != M.debounceRendering) && ((Pe = M.debounceRendering) || Ze)(fe);
42
42
  }
43
- function de() {
44
- for (var t, e, n, o, i, s, a, r = 1; X.length; ) X.length > r && X.sort(Qe), t = X.shift(), r = X.length, t.__d && (n = void 0, i = (o = (e = t).__v).__e, s = [], a = [], e.__P && ((n = H({}, o)).__v = o.__v + 1, A.vnode && A.vnode(n), Ee(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [i] : null, s, i ?? K(o), !!(32 & o.__u), a), n.__v = o.__v, n.__.__k[n.__i] = n, st(s, n, a), n.__e != i && ot(n)));
45
- de.__r = 0;
43
+ function fe() {
44
+ for (var e, t, n, o, i, s, l, r = 1; Y.length; ) Y.length > r && Y.sort(Qe), e = Y.shift(), r = Y.length, e.__d && (n = void 0, i = (o = (t = e).__v).__e, s = [], l = [], t.__P && ((n = B({}, o)).__v = o.__v + 1, M.vnode && M.vnode(n), Le(t.__P, n, o, t.__n, t.__P.namespaceURI, 32 & o.__u ? [i] : null, s, i ?? Z(o), !!(32 & o.__u), l), n.__v = o.__v, n.__.__k[n.__i] = n, st(s, n, l), n.__e != i && ot(n)));
45
+ fe.__r = 0;
46
46
  }
47
- function rt(t, e, n, o, i, s, a, r, l, c, d) {
48
- var u, h, f, k, p, _, b = o && o.__k || nt, w = e.length;
49
- for (l = kt(n, e, b, l, w), u = 0; u < w; u++) (f = n.__k[u]) != null && (h = f.__i == -1 ? ee : b[f.__i] || ee, f.__i = u, _ = Ee(t, f, h, i, s, a, r, l, c, d), k = f.__e, f.ref && h.ref != f.ref && (h.ref && Le(h.ref, null, f), d.push(f.ref, f.__c || k, f)), p == null && k != null && (p = k), 4 & f.__u || h.__k === f.__k ? l = it(f, l, t) : typeof f.type == "function" && _ !== void 0 ? l = _ : k && (l = k.nextSibling), f.__u &= -7);
50
- return n.__e = p, l;
47
+ function rt(e, t, n, o, i, s, l, r, a, c, d) {
48
+ var u, h, f, p, v, _, b = o && o.__k || nt, C = t.length;
49
+ for (a = Tt(n, t, b, a, C), u = 0; u < C; u++) (f = n.__k[u]) != null && (h = f.__i == -1 ? ne : b[f.__i] || ne, f.__i = u, _ = Le(e, f, h, i, s, l, r, a, c, d), p = f.__e, f.ref && h.ref != f.ref && (h.ref && Ne(h.ref, null, f), d.push(f.ref, f.__c || p, f)), v == null && p != null && (v = p), 4 & f.__u || h.__k === f.__k ? a = it(f, a, e) : typeof f.type == "function" && _ !== void 0 ? a = _ : p && (a = p.nextSibling), f.__u &= -7);
50
+ return n.__e = v, a;
51
51
  }
52
- function kt(t, e, n, o, i) {
53
- var s, a, r, l, c, d = n.length, u = d, h = 0;
54
- for (t.__k = new Array(i), s = 0; s < i; s++) (a = e[s]) != null && typeof a != "boolean" && typeof a != "function" ? (l = s + h, (a = t.__k[s] = typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? se(null, a, null, null, null) : me(a) ? se(_e, { children: a }, null, null, null) : a.constructor == null && a.__b > 0 ? se(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : a).__ = t, a.__b = t.__b + 1, r = null, (c = a.__i = St(a, n, l, u)) != -1 && (u--, (r = n[c]) && (r.__u |= 2)), r == null || r.__v == null ? (c == -1 && (i > d ? h-- : i < d && h++), typeof a.type != "function" && (a.__u |= 4)) : c != l && (c == l - 1 ? h-- : c == l + 1 ? h++ : (c > l ? h-- : h++, a.__u |= 4))) : t.__k[s] = null;
55
- if (u) for (s = 0; s < d; s++) (r = n[s]) != null && (2 & r.__u) == 0 && (r.__e == o && (o = K(r)), lt(r, r));
52
+ function Tt(e, t, n, o, i) {
53
+ var s, l, r, a, c, d = n.length, u = d, h = 0;
54
+ for (e.__k = new Array(i), s = 0; s < i; s++) (l = t[s]) != null && typeof l != "boolean" && typeof l != "function" ? (a = s + h, (l = e.__k[s] = typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? ae(null, l, null, null, null) : ve(l) ? ae(ge, { children: l }, null, null, null) : l.constructor == null && l.__b > 0 ? ae(l.type, l.props, l.key, l.ref ? l.ref : null, l.__v) : l).__ = e, l.__b = e.__b + 1, r = null, (c = l.__i = kt(l, n, a, u)) != -1 && (u--, (r = n[c]) && (r.__u |= 2)), r == null || r.__v == null ? (c == -1 && (i > d ? h-- : i < d && h++), typeof l.type != "function" && (l.__u |= 4)) : c != a && (c == a - 1 ? h-- : c == a + 1 ? h++ : (c > a ? h-- : h++, l.__u |= 4))) : e.__k[s] = null;
55
+ if (u) for (s = 0; s < d; s++) (r = n[s]) != null && (2 & r.__u) == 0 && (r.__e == o && (o = Z(r)), at(r, r));
56
56
  return o;
57
57
  }
58
- function it(t, e, n) {
58
+ function it(e, t, n) {
59
59
  var o, i;
60
- if (typeof t.type == "function") {
61
- for (o = t.__k, i = 0; o && i < o.length; i++) o[i] && (o[i].__ = t, e = it(o[i], e, n));
62
- return e;
60
+ if (typeof e.type == "function") {
61
+ for (o = e.__k, i = 0; o && i < o.length; i++) o[i] && (o[i].__ = e, t = it(o[i], t, n));
62
+ return t;
63
63
  }
64
- t.__e != e && (e && t.type && !n.contains(e) && (e = K(t)), n.insertBefore(t.__e, e || null), e = t.__e);
64
+ e.__e != t && (t && e.type && !n.contains(t) && (t = Z(e)), n.insertBefore(e.__e, t || null), t = e.__e);
65
65
  do
66
- e = e && e.nextSibling;
67
- while (e != null && e.nodeType == 8);
68
- return e;
66
+ t = t && t.nextSibling;
67
+ while (t != null && t.nodeType == 8);
68
+ return t;
69
69
  }
70
- function St(t, e, n, o) {
71
- var i, s, a = t.key, r = t.type, l = e[n];
72
- if (l === null && t.key == null || l && a == l.key && r == l.type && (2 & l.__u) == 0) return n;
73
- if (o > (l != null && (2 & l.__u) == 0 ? 1 : 0)) for (i = n - 1, s = n + 1; i >= 0 || s < e.length; ) {
70
+ function kt(e, t, n, o) {
71
+ var i, s, l = e.key, r = e.type, a = t[n];
72
+ if (a === null && e.key == null || a && l == a.key && r == a.type && (2 & a.__u) == 0) return n;
73
+ if (o > (a != null && (2 & a.__u) == 0 ? 1 : 0)) for (i = n - 1, s = n + 1; i >= 0 || s < t.length; ) {
74
74
  if (i >= 0) {
75
- if ((l = e[i]) && (2 & l.__u) == 0 && a == l.key && r == l.type) return i;
75
+ if ((a = t[i]) && (2 & a.__u) == 0 && l == a.key && r == a.type) return i;
76
76
  i--;
77
77
  }
78
- if (s < e.length) {
79
- if ((l = e[s]) && (2 & l.__u) == 0 && a == l.key && r == l.type) return s;
78
+ if (s < t.length) {
79
+ if ((a = t[s]) && (2 & a.__u) == 0 && l == a.key && r == a.type) return s;
80
80
  s++;
81
81
  }
82
82
  }
83
83
  return -1;
84
84
  }
85
- function Ie(t, e, n) {
86
- e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || bt.test(e) ? n : n + "px";
85
+ function Ie(e, t, n) {
86
+ t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || yt.test(t) ? n : n + "px";
87
87
  }
88
- function re(t, e, n, o, i) {
88
+ function se(e, t, n, o, i) {
89
89
  var s;
90
- e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
90
+ e: if (t == "style") if (typeof n == "string") e.style.cssText = n;
91
91
  else {
92
- if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || Ie(t.style, e, "");
93
- if (n) for (e in n) o && n[e] == o[e] || Ie(t.style, e, n[e]);
92
+ if (typeof o == "string" && (e.style.cssText = o = ""), o) for (t in o) n && t in n || Ie(e.style, t, "");
93
+ if (n) for (t in n) o && n[t] == o[t] || Ie(e.style, t, n[t]);
94
94
  }
95
- else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(et, "$1")), e = e.toLowerCase() in t || e == "onFocusOut" || e == "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = n, n ? o ? n.u = o.u : (n.u = Se, t.addEventListener(e, s ? ye : Ce, s)) : t.removeEventListener(e, s ? ye : Ce, s);
95
+ else if (t[0] == "o" && t[1] == "n") s = t != (t = t.replace(et, "$1")), t = t.toLowerCase() in e || t == "onFocusOut" || t == "onFocusIn" ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + s] = n, n ? o ? n.u = o.u : (n.u = ze, e.addEventListener(t, s ? be : ye, s)) : e.removeEventListener(t, s ? be : ye, s);
96
96
  else {
97
- if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
98
- else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
99
- t[e] = n ?? "";
97
+ if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
98
+ 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 {
99
+ e[t] = n ?? "";
100
100
  break e;
101
101
  } catch {
102
102
  }
103
- typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
103
+ typeof n == "function" || (n == null || n === !1 && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
104
104
  }
105
105
  }
106
- function xe(t) {
107
- return function(e) {
106
+ function xe(e) {
107
+ return function(t) {
108
108
  if (this.l) {
109
- var n = this.l[e.type + t];
110
- if (e.t == null) e.t = Se++;
111
- else if (e.t < n.u) return;
112
- return n(A.event ? A.event(e) : e);
109
+ var n = this.l[t.type + e];
110
+ if (t.t == null) t.t = ze++;
111
+ else if (t.t < n.u) return;
112
+ return n(M.event ? M.event(t) : t);
113
113
  }
114
114
  };
115
115
  }
116
- function Ee(t, e, n, o, i, s, a, r, l, c) {
117
- var d, u, h, f, k, p, _, b, w, M, C, z, S, E, L, y, g, v = e.type;
118
- if (e.constructor != null) return null;
119
- 128 & n.__u && (l = !!(32 & n.__u), s = [r = e.__e = n.__e]), (d = A.__b) && d(e);
120
- e: if (typeof v == "function") try {
121
- if (b = e.props, w = "prototype" in v && v.prototype.render, M = (d = v.contextType) && o[d.__c], C = d ? M ? M.props.value : d.__ : o, n.__c ? _ = (u = e.__c = n.__c).__ = u.__E : (w ? e.__c = u = new v(b, C) : (e.__c = u = new ae(b, C), u.constructor = v, u.render = Et), M && M.sub(u), u.props = b, u.state || (u.state = {}), u.context = C, u.__n = o, h = u.__d = !0, u.__h = [], u._sb = []), w && u.__s == null && (u.__s = u.state), w && v.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = H({}, u.__s)), H(u.__s, v.getDerivedStateFromProps(b, u.__s))), f = u.props, k = u.state, u.__v = e, h) w && v.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), w && u.componentDidMount != null && u.__h.push(u.componentDidMount);
116
+ function Le(e, t, n, o, i, s, l, r, a, c) {
117
+ var d, u, h, f, p, v, _, b, C, T, g, k, w, y, S, N, z, E = t.type;
118
+ if (t.constructor != null) return null;
119
+ 128 & n.__u && (a = !!(32 & n.__u), s = [r = t.__e = n.__e]), (d = M.__b) && d(t);
120
+ e: if (typeof E == "function") try {
121
+ if (b = t.props, C = "prototype" in E && E.prototype.render, T = (d = E.contextType) && o[d.__c], g = d ? T ? T.props.value : d.__ : o, n.__c ? _ = (u = t.__c = n.__c).__ = u.__E : (C ? t.__c = u = new E(b, g) : (t.__c = u = new ce(b, g), u.constructor = E, u.render = zt), T && T.sub(u), u.props = b, u.state || (u.state = {}), u.context = g, u.__n = o, h = u.__d = !0, u.__h = [], u._sb = []), C && u.__s == null && (u.__s = u.state), C && E.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = B({}, u.__s)), B(u.__s, E.getDerivedStateFromProps(b, u.__s))), f = u.props, p = u.state, u.__v = t, h) C && E.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), C && u.componentDidMount != null && u.__h.push(u.componentDidMount);
122
122
  else {
123
- if (w && v.getDerivedStateFromProps == null && b !== f && u.componentWillReceiveProps != null && u.componentWillReceiveProps(b, C), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(b, u.__s, C) === !1 || e.__v == n.__v) {
124
- for (e.__v != n.__v && (u.props = b, u.state = u.__s, u.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(T) {
125
- T && (T.__ = e);
126
- }), z = 0; z < u._sb.length; z++) u.__h.push(u._sb[z]);
127
- u._sb = [], u.__h.length && a.push(u);
123
+ if (C && E.getDerivedStateFromProps == null && b !== f && u.componentWillReceiveProps != null && u.componentWillReceiveProps(b, g), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(b, u.__s, g) === !1 || t.__v == n.__v) {
124
+ for (t.__v != n.__v && (u.props = b, u.state = u.__s, u.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(L) {
125
+ L && (L.__ = t);
126
+ }), k = 0; k < u._sb.length; k++) u.__h.push(u._sb[k]);
127
+ u._sb = [], u.__h.length && l.push(u);
128
128
  break e;
129
129
  }
130
- u.componentWillUpdate != null && u.componentWillUpdate(b, u.__s, C), w && u.componentDidUpdate != null && u.__h.push(function() {
131
- u.componentDidUpdate(f, k, p);
130
+ u.componentWillUpdate != null && u.componentWillUpdate(b, u.__s, g), C && u.componentDidUpdate != null && u.__h.push(function() {
131
+ u.componentDidUpdate(f, p, v);
132
132
  });
133
133
  }
134
- if (u.context = C, u.props = b, u.__P = t, u.__e = !1, S = A.__r, E = 0, w) {
135
- for (u.state = u.__s, u.__d = !1, S && S(e), d = u.render(u.props, u.state, u.context), L = 0; L < u._sb.length; L++) u.__h.push(u._sb[L]);
134
+ if (u.context = g, u.props = b, u.__P = e, u.__e = !1, w = M.__r, y = 0, C) {
135
+ for (u.state = u.__s, u.__d = !1, w && w(t), d = u.render(u.props, u.state, u.context), S = 0; S < u._sb.length; S++) u.__h.push(u._sb[S]);
136
136
  u._sb = [];
137
137
  } else do
138
- u.__d = !1, S && S(e), d = u.render(u.props, u.state, u.context), u.state = u.__s;
139
- while (u.__d && ++E < 25);
140
- u.state = u.__s, u.getChildContext != null && (o = H(H({}, o), u.getChildContext())), w && !h && u.getSnapshotBeforeUpdate != null && (p = u.getSnapshotBeforeUpdate(f, k)), y = d, d != null && d.type === _e && d.key == null && (y = at(d.props.children)), r = rt(t, me(y) ? y : [y], e, n, o, i, s, a, r, l, c), u.base = e.__e, e.__u &= -161, u.__h.length && a.push(u), _ && (u.__E = u.__ = null);
141
- } catch (T) {
142
- if (e.__v = null, l || s != null) if (T.then) {
143
- for (e.__u |= l ? 160 : 128; r && r.nodeType == 8 && r.nextSibling; ) r = r.nextSibling;
144
- s[s.indexOf(r)] = null, e.__e = r;
145
- } else for (g = s.length; g--; ) ze(s[g]);
146
- else e.__e = n.__e, e.__k = n.__k;
147
- A.__e(T, e, n);
138
+ u.__d = !1, w && w(t), d = u.render(u.props, u.state, u.context), u.state = u.__s;
139
+ while (u.__d && ++y < 25);
140
+ u.state = u.__s, u.getChildContext != null && (o = B(B({}, o), u.getChildContext())), C && !h && u.getSnapshotBeforeUpdate != null && (v = u.getSnapshotBeforeUpdate(f, p)), N = d, d != null && d.type === ge && d.key == null && (N = lt(d.props.children)), r = rt(e, ve(N) ? N : [N], t, n, o, i, s, l, r, a, c), u.base = t.__e, t.__u &= -161, u.__h.length && l.push(u), _ && (u.__E = u.__ = null);
141
+ } catch (L) {
142
+ if (t.__v = null, a || s != null) if (L.then) {
143
+ for (t.__u |= a ? 160 : 128; r && r.nodeType == 8 && r.nextSibling; ) r = r.nextSibling;
144
+ s[s.indexOf(r)] = null, t.__e = r;
145
+ } else for (z = s.length; z--; ) Ee(s[z]);
146
+ else t.__e = n.__e, t.__k = n.__k;
147
+ M.__e(L, t, n);
148
148
  }
149
- else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : r = e.__e = zt(n.__e, e, n, o, i, s, a, l, c);
150
- return (d = A.diffed) && d(e), 128 & e.__u ? void 0 : r;
149
+ else s == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : r = t.__e = St(n.__e, t, n, o, i, s, l, a, c);
150
+ return (d = M.diffed) && d(t), 128 & t.__u ? void 0 : r;
151
151
  }
152
- function st(t, e, n) {
153
- for (var o = 0; o < n.length; o++) Le(n[o], n[++o], n[++o]);
154
- A.__c && A.__c(e, t), t.some(function(i) {
152
+ function st(e, t, n) {
153
+ for (var o = 0; o < n.length; o++) Ne(n[o], n[++o], n[++o]);
154
+ M.__c && M.__c(t, e), e.some(function(i) {
155
155
  try {
156
- t = i.__h, i.__h = [], t.some(function(s) {
156
+ e = i.__h, i.__h = [], e.some(function(s) {
157
157
  s.call(i);
158
158
  });
159
159
  } catch (s) {
160
- A.__e(s, i.__v);
160
+ M.__e(s, i.__v);
161
161
  }
162
162
  });
163
163
  }
164
- function at(t) {
165
- return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : me(t) ? t.map(at) : H({}, t);
164
+ function lt(e) {
165
+ return typeof e != "object" || e == null || e.__b && e.__b > 0 ? e : ve(e) ? e.map(lt) : B({}, e);
166
166
  }
167
- function zt(t, e, n, o, i, s, a, r, l) {
168
- var c, d, u, h, f, k, p, _ = n.props, b = e.props, w = e.type;
169
- if (w == "svg" ? i = "http://www.w3.org/2000/svg" : w == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) {
170
- for (c = 0; c < s.length; c++) if ((f = s[c]) && "setAttribute" in f == !!w && (w ? f.localName == w : f.nodeType == 3)) {
171
- t = f, s[c] = null;
167
+ function St(e, t, n, o, i, s, l, r, a) {
168
+ var c, d, u, h, f, p, v, _ = n.props, b = t.props, C = t.type;
169
+ if (C == "svg" ? i = "http://www.w3.org/2000/svg" : C == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) {
170
+ for (c = 0; c < s.length; c++) if ((f = s[c]) && "setAttribute" in f == !!C && (C ? f.localName == C : f.nodeType == 3)) {
171
+ e = f, s[c] = null;
172
172
  break;
173
173
  }
174
174
  }
175
- if (t == null) {
176
- if (w == null) return document.createTextNode(b);
177
- t = document.createElementNS(i, w, b.is && b), r && (A.__m && A.__m(e, s), r = !1), s = null;
175
+ if (e == null) {
176
+ if (C == null) return document.createTextNode(b);
177
+ e = document.createElementNS(i, C, b.is && b), r && (M.__m && M.__m(t, s), r = !1), s = null;
178
178
  }
179
- if (w == null) _ === b || r && t.data == b || (t.data = b);
179
+ if (C == null) _ === b || r && e.data == b || (e.data = b);
180
180
  else {
181
- if (s = s && fe.call(t.childNodes), _ = n.props || ee, !r && s != null) for (_ = {}, c = 0; c < t.attributes.length; c++) _[(f = t.attributes[c]).name] = f.value;
181
+ if (s = s && _e.call(e.childNodes), _ = n.props || ne, !r && s != null) for (_ = {}, c = 0; c < e.attributes.length; c++) _[(f = e.attributes[c]).name] = f.value;
182
182
  for (c in _) if (f = _[c], c != "children") {
183
183
  if (c == "dangerouslySetInnerHTML") u = f;
184
184
  else if (!(c in b)) {
185
185
  if (c == "value" && "defaultValue" in b || c == "checked" && "defaultChecked" in b) continue;
186
- re(t, c, null, f, i);
186
+ se(e, c, null, f, i);
187
187
  }
188
188
  }
189
- for (c in b) f = b[c], c == "children" ? h = f : c == "dangerouslySetInnerHTML" ? d = f : c == "value" ? k = f : c == "checked" ? p = f : r && typeof f != "function" || _[c] === f || re(t, c, f, _[c], i);
190
- if (d) r || u && (d.__html == u.__html || d.__html == t.innerHTML) || (t.innerHTML = d.__html), e.__k = [];
191
- else if (u && (t.innerHTML = ""), rt(e.type == "template" ? t.content : t, me(h) ? h : [h], e, n, o, w == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, a, s ? s[0] : n.__k && K(n, 0), r, l), s != null) for (c = s.length; c--; ) ze(s[c]);
192
- r || (c = "value", w == "progress" && k == null ? t.removeAttribute("value") : k != null && (k !== t[c] || w == "progress" && !k || w == "option" && k != _[c]) && re(t, c, k, _[c], i), c = "checked", p != null && p != t[c] && re(t, c, p, _[c], i));
189
+ for (c in b) f = b[c], c == "children" ? h = f : c == "dangerouslySetInnerHTML" ? d = f : c == "value" ? p = f : c == "checked" ? v = f : r && typeof f != "function" || _[c] === f || se(e, c, f, _[c], i);
190
+ if (d) r || u && (d.__html == u.__html || d.__html == e.innerHTML) || (e.innerHTML = d.__html), t.__k = [];
191
+ else if (u && (e.innerHTML = ""), rt(t.type == "template" ? e.content : e, ve(h) ? h : [h], t, n, o, C == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, l, s ? s[0] : n.__k && Z(n, 0), r, a), s != null) for (c = s.length; c--; ) Ee(s[c]);
192
+ r || (c = "value", C == "progress" && p == null ? e.removeAttribute("value") : p != null && (p !== e[c] || C == "progress" && !p || C == "option" && p != _[c]) && se(e, c, p, _[c], i), c = "checked", v != null && v != e[c] && se(e, c, v, _[c], i));
193
193
  }
194
- return t;
194
+ return e;
195
195
  }
196
- function Le(t, e, n) {
196
+ function Ne(e, t, n) {
197
197
  try {
198
- if (typeof t == "function") {
199
- var o = typeof t.__u == "function";
200
- o && t.__u(), o && e == null || (t.__u = t(e));
201
- } else t.current = e;
198
+ if (typeof e == "function") {
199
+ var o = typeof e.__u == "function";
200
+ o && e.__u(), o && t == null || (e.__u = e(t));
201
+ } else e.current = t;
202
202
  } catch (i) {
203
- A.__e(i, n);
203
+ M.__e(i, n);
204
204
  }
205
205
  }
206
- function lt(t, e, n) {
206
+ function at(e, t, n) {
207
207
  var o, i;
208
- if (A.unmount && A.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || Le(o, null, e)), (o = t.__c) != null) {
208
+ if (M.unmount && M.unmount(e), (o = e.ref) && (o.current && o.current != e.__e || Ne(o, null, t)), (o = e.__c) != null) {
209
209
  if (o.componentWillUnmount) try {
210
210
  o.componentWillUnmount();
211
211
  } catch (s) {
212
- A.__e(s, e);
212
+ M.__e(s, t);
213
213
  }
214
214
  o.base = o.__P = null;
215
215
  }
216
- if (o = t.__k) for (i = 0; i < o.length; i++) o[i] && lt(o[i], e, n || typeof t.type != "function");
217
- n || ze(t.__e), t.__c = t.__ = t.__e = void 0;
216
+ if (o = e.__k) for (i = 0; i < o.length; i++) o[i] && at(o[i], t, n || typeof e.type != "function");
217
+ n || Ee(e.__e), e.__c = e.__ = e.__e = void 0;
218
218
  }
219
- function Et(t, e, n) {
220
- return this.constructor(t, n);
219
+ function zt(e, t, n) {
220
+ return this.constructor(e, n);
221
221
  }
222
- function Re(t, e, n) {
223
- var o, i, s, a;
224
- e == document && (e = document.documentElement), A.__ && A.__(t, e), i = (o = !1) ? null : e.__k, s = [], a = [], Ee(e, t = e.__k = Tt(_e, null, [t]), i || ee, ee, e.namespaceURI, i ? null : e.firstChild ? fe.call(e.childNodes) : null, s, i ? i.__e : e.firstChild, o, a), st(s, t, a);
222
+ function Re(e, t, n) {
223
+ var o, i, s, l;
224
+ t == document && (t = document.documentElement), M.__ && M.__(e, t), i = (o = !1) ? null : t.__k, s = [], l = [], Le(t, e = t.__k = bt(ge, null, [e]), i || ne, ne, t.namespaceURI, i ? null : t.firstChild ? _e.call(t.childNodes) : null, s, i ? i.__e : t.firstChild, o, l), st(s, e, l);
225
225
  }
226
- function Lt(t) {
227
- function e(n) {
226
+ function Et(e) {
227
+ function t(n) {
228
228
  var o, i;
229
- return this.getChildContext || (o = /* @__PURE__ */ new Set(), (i = {})[e.__c] = this, this.getChildContext = function() {
229
+ return this.getChildContext || (o = /* @__PURE__ */ new Set(), (i = {})[t.__c] = this, this.getChildContext = function() {
230
230
  return i;
231
231
  }, this.componentWillUnmount = function() {
232
232
  o = null;
233
233
  }, this.shouldComponentUpdate = function(s) {
234
- this.props.value != s.value && o.forEach(function(a) {
235
- a.__e = !0, be(a);
234
+ this.props.value != s.value && o.forEach(function(l) {
235
+ l.__e = !0, Te(l);
236
236
  });
237
237
  }, this.sub = function(s) {
238
238
  o.add(s);
239
- var a = s.componentWillUnmount;
239
+ var l = s.componentWillUnmount;
240
240
  s.componentWillUnmount = function() {
241
- o && o.delete(s), a && a.call(s);
241
+ o && o.delete(s), l && l.call(s);
242
242
  };
243
243
  }), n.children;
244
244
  }
245
- return e.__c = "__cC" + tt++, e.__ = t, e.Provider = e.__l = (e.Consumer = function(n, o) {
245
+ return t.__c = "__cC" + tt++, t.__ = e, t.Provider = t.__l = (t.Consumer = function(n, o) {
246
246
  return n.children(o);
247
- }).contextType = e, e;
247
+ }).contextType = t, t;
248
248
  }
249
- fe = nt.slice, A = { __e: function(t, e, n, o) {
250
- for (var i, s, a; e = e.__; ) if ((i = e.__c) && !i.__) try {
251
- if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), a = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, o || {}), a = i.__d), a) return i.__E = i;
249
+ _e = nt.slice, M = { __e: function(e, t, n, o) {
250
+ for (var i, s, l; t = t.__; ) if ((i = t.__c) && !i.__) try {
251
+ if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(e)), l = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, o || {}), l = i.__d), l) return i.__E = i;
252
252
  } catch (r) {
253
- t = r;
253
+ e = r;
254
254
  }
255
- throw t;
256
- } }, Je = 0, ae.prototype.setState = function(t, e) {
255
+ throw e;
256
+ } }, Je = 0, ce.prototype.setState = function(e, t) {
257
257
  var n;
258
- n = this.__s != null && this.__s != this.state ? this.__s : this.__s = H({}, this.state), typeof t == "function" && (t = t(H({}, n), this.props)), t && H(n, t), t != null && this.__v && (e && this._sb.push(e), be(this));
259
- }, ae.prototype.forceUpdate = function(t) {
260
- this.__v && (this.__e = !0, t && this.__h.push(t), be(this));
261
- }, ae.prototype.render = _e, X = [], Ze = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Qe = function(t, e) {
262
- return t.__v.__b - e.__v.__b;
263
- }, de.__r = 0, et = /(PointerCapture)$|Capture$/i, Se = 0, Ce = xe(!1), ye = xe(!0), tt = 0;
264
- var Nt = 0;
265
- function m(t, e, n, o, i, s) {
266
- e || (e = {});
267
- var a, r, l = e;
268
- if ("ref" in l) for (r in l = {}, e) r == "ref" ? a = e[r] : l[r] = e[r];
269
- var c = { type: t, props: l, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Nt, __i: -1, __u: 0, __source: i, __self: s };
270
- if (typeof t == "function" && (a = t.defaultProps)) for (r in a) l[r] === void 0 && (l[r] = a[r]);
271
- return A.vnode && A.vnode(c), c;
272
- }
273
- var J, x, pe, Fe, te = 0, ct = [], F = A, De = F.__b, Oe = F.__r, $e = F.diffed, Ue = F.__c, Ge = F.unmount, We = F.__;
274
- function ve(t, e) {
275
- F.__h && F.__h(x, t, te || e), te = 0;
276
- var n = x.__H || (x.__H = { __: [], __h: [] });
277
- return t >= n.__.length && n.__.push({}), n.__[t];
278
- }
279
- function U(t) {
280
- return te = 1, Mt(dt, t);
281
- }
282
- function Mt(t, e, n) {
283
- var o = ve(J++, 2);
284
- if (o.t = t, !o.__c && (o.__ = [dt(void 0, e), function(r) {
285
- var l = o.__N ? o.__N[0] : o.__[0], c = o.t(l, r);
286
- l !== c && (o.__N = [c, o.__[1]], o.__c.setState({}));
287
- }], o.__c = x, !x.__f)) {
288
- var i = function(r, l, c) {
258
+ n = this.__s != null && this.__s != this.state ? this.__s : this.__s = B({}, this.state), typeof e == "function" && (e = e(B({}, n), this.props)), e && B(n, e), e != null && this.__v && (t && this._sb.push(t), Te(this));
259
+ }, ce.prototype.forceUpdate = function(e) {
260
+ this.__v && (this.__e = !0, e && this.__h.push(e), Te(this));
261
+ }, ce.prototype.render = ge, Y = [], Ze = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Qe = function(e, t) {
262
+ return e.__v.__b - t.__v.__b;
263
+ }, fe.__r = 0, et = /(PointerCapture)$|Capture$/i, ze = 0, ye = xe(!1), be = xe(!0), tt = 0;
264
+ var Lt = 0;
265
+ function m(e, t, n, o, i, s) {
266
+ t || (t = {});
267
+ var l, r, a = t;
268
+ if ("ref" in a) for (r in a = {}, t) r == "ref" ? l = t[r] : a[r] = t[r];
269
+ var c = { type: e, props: a, key: n, ref: l, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Lt, __i: -1, __u: 0, __source: i, __self: s };
270
+ if (typeof e == "function" && (l = e.defaultProps)) for (r in l) a[r] === void 0 && (a[r] = l[r]);
271
+ return M.vnode && M.vnode(c), c;
272
+ }
273
+ var Q, P, Ce, Fe, oe = 0, ct = [], R = M, De = R.__b, Oe = R.__r, $e = R.diffed, Ue = R.__c, Ge = R.unmount, We = R.__;
274
+ function pe(e, t) {
275
+ R.__h && R.__h(P, e, oe || t), oe = 0;
276
+ var n = P.__H || (P.__H = { __: [], __h: [] });
277
+ return e >= n.__.length && n.__.push({}), n.__[e];
278
+ }
279
+ function G(e) {
280
+ return oe = 1, Nt(dt, e);
281
+ }
282
+ function Nt(e, t, n) {
283
+ var o = pe(Q++, 2);
284
+ if (o.t = e, !o.__c && (o.__ = [dt(void 0, t), function(r) {
285
+ var a = o.__N ? o.__N[0] : o.__[0], c = o.t(a, r);
286
+ a !== c && (o.__N = [c, o.__[1]], o.__c.setState({}));
287
+ }], o.__c = P, !P.__f)) {
288
+ var i = function(r, a, c) {
289
289
  if (!o.__c.__H) return !0;
290
290
  var d = o.__c.__H.__.filter(function(h) {
291
291
  return !!h.__c;
292
292
  });
293
293
  if (d.every(function(h) {
294
294
  return !h.__N;
295
- })) return !s || s.call(this, r, l, c);
295
+ })) return !s || s.call(this, r, a, c);
296
296
  var u = o.__c.props !== r;
297
297
  return d.forEach(function(h) {
298
298
  if (h.__N) {
299
299
  var f = h.__[0];
300
300
  h.__ = h.__N, h.__N = void 0, f !== h.__[0] && (u = !0);
301
301
  }
302
- }), s && s.call(this, r, l, c) || u;
302
+ }), s && s.call(this, r, a, c) || u;
303
303
  };
304
- x.__f = !0;
305
- var s = x.shouldComponentUpdate, a = x.componentWillUpdate;
306
- x.componentWillUpdate = function(r, l, c) {
304
+ P.__f = !0;
305
+ var s = P.shouldComponentUpdate, l = P.componentWillUpdate;
306
+ P.componentWillUpdate = function(r, a, c) {
307
307
  if (this.__e) {
308
308
  var d = s;
309
- s = void 0, i(r, l, c), s = d;
309
+ s = void 0, i(r, a, c), s = d;
310
310
  }
311
- a && a.call(this, r, l, c);
312
- }, x.shouldComponentUpdate = i;
311
+ l && l.call(this, r, a, c);
312
+ }, P.shouldComponentUpdate = i;
313
313
  }
314
314
  return o.__N || o.__;
315
315
  }
316
- function R(t, e) {
317
- var n = ve(J++, 3);
318
- !F.__s && ut(n.__H, e) && (n.__ = t, n.u = e, x.__H.__h.push(n));
316
+ function x(e, t) {
317
+ var n = pe(Q++, 3);
318
+ !R.__s && ut(n.__H, t) && (n.__ = e, n.u = t, P.__H.__h.push(n));
319
319
  }
320
- function O(t) {
321
- return te = 5, Z(function() {
322
- return { current: t };
320
+ function F(e) {
321
+ return oe = 5, ee(function() {
322
+ return { current: e };
323
323
  }, []);
324
324
  }
325
- function Z(t, e) {
326
- var n = ve(J++, 7);
327
- return ut(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
325
+ function ee(e, t) {
326
+ var n = pe(Q++, 7);
327
+ return ut(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
328
328
  }
329
- function je(t, e) {
330
- return te = 8, Z(function() {
331
- return t;
332
- }, e);
329
+ function je(e, t) {
330
+ return oe = 8, ee(function() {
331
+ return e;
332
+ }, t);
333
333
  }
334
- function At(t) {
335
- var e = x.context[t.__c], n = ve(J++, 9);
336
- return n.c = t, e ? (n.__ == null && (n.__ = !0, e.sub(x)), e.props.value) : t.__;
334
+ function Mt(e) {
335
+ var t = P.context[e.__c], n = pe(Q++, 9);
336
+ return n.c = e, t ? (n.__ == null && (n.__ = !0, t.sub(P)), t.props.value) : e.__;
337
337
  }
338
- function Pt() {
339
- for (var t; t = ct.shift(); ) if (t.__P && t.__H) try {
340
- t.__H.__h.forEach(le), t.__H.__h.forEach(Te), t.__H.__h = [];
341
- } catch (e) {
342
- t.__H.__h = [], F.__e(e, t.__v);
338
+ function At() {
339
+ for (var e; e = ct.shift(); ) if (e.__P && e.__H) try {
340
+ e.__H.__h.forEach(ue), e.__H.__h.forEach(ke), e.__H.__h = [];
341
+ } catch (t) {
342
+ e.__H.__h = [], R.__e(t, e.__v);
343
343
  }
344
344
  }
345
- F.__b = function(t) {
346
- x = null, De && De(t);
347
- }, F.__ = function(t, e) {
348
- t && e.__k && e.__k.__m && (t.__m = e.__k.__m), We && We(t, e);
349
- }, F.__r = function(t) {
350
- Oe && Oe(t), J = 0;
351
- var e = (x = t.__c).__H;
352
- e && (pe === x ? (e.__h = [], x.__h = [], e.__.forEach(function(n) {
345
+ R.__b = function(e) {
346
+ P = null, De && De(e);
347
+ }, R.__ = function(e, t) {
348
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), We && We(e, t);
349
+ }, R.__r = function(e) {
350
+ Oe && Oe(e), Q = 0;
351
+ var t = (P = e.__c).__H;
352
+ t && (Ce === P ? (t.__h = [], P.__h = [], t.__.forEach(function(n) {
353
353
  n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
354
- })) : (e.__h.forEach(le), e.__h.forEach(Te), e.__h = [], J = 0)), pe = x;
355
- }, F.diffed = function(t) {
356
- $e && $e(t);
357
- var e = t.__c;
358
- e && e.__H && (e.__H.__h.length && (ct.push(e) !== 1 && Fe === F.requestAnimationFrame || ((Fe = F.requestAnimationFrame) || It)(Pt)), e.__H.__.forEach(function(n) {
354
+ })) : (t.__h.forEach(ue), t.__h.forEach(ke), t.__h = [], Q = 0)), Ce = P;
355
+ }, R.diffed = function(e) {
356
+ $e && $e(e);
357
+ var t = e.__c;
358
+ t && t.__H && (t.__H.__h.length && (ct.push(t) !== 1 && Fe === R.requestAnimationFrame || ((Fe = R.requestAnimationFrame) || Pt)(At)), t.__H.__.forEach(function(n) {
359
359
  n.u && (n.__H = n.u), n.u = void 0;
360
- })), pe = x = null;
361
- }, F.__c = function(t, e) {
362
- e.some(function(n) {
360
+ })), Ce = P = null;
361
+ }, R.__c = function(e, t) {
362
+ t.some(function(n) {
363
363
  try {
364
- n.__h.forEach(le), n.__h = n.__h.filter(function(o) {
365
- return !o.__ || Te(o);
364
+ n.__h.forEach(ue), n.__h = n.__h.filter(function(o) {
365
+ return !o.__ || ke(o);
366
366
  });
367
367
  } catch (o) {
368
- e.some(function(i) {
368
+ t.some(function(i) {
369
369
  i.__h && (i.__h = []);
370
- }), e = [], F.__e(o, n.__v);
370
+ }), t = [], R.__e(o, n.__v);
371
371
  }
372
- }), Ue && Ue(t, e);
373
- }, F.unmount = function(t) {
374
- Ge && Ge(t);
375
- var e, n = t.__c;
372
+ }), Ue && Ue(e, t);
373
+ }, R.unmount = function(e) {
374
+ Ge && Ge(e);
375
+ var t, n = e.__c;
376
376
  n && n.__H && (n.__H.__.forEach(function(o) {
377
377
  try {
378
- le(o);
378
+ ue(o);
379
379
  } catch (i) {
380
- e = i;
380
+ t = i;
381
381
  }
382
- }), n.__H = void 0, e && F.__e(e, n.__v));
382
+ }), n.__H = void 0, t && R.__e(t, n.__v));
383
383
  };
384
384
  var qe = typeof requestAnimationFrame == "function";
385
- function It(t) {
386
- var e, n = function() {
387
- clearTimeout(o), qe && cancelAnimationFrame(e), setTimeout(t);
385
+ function Pt(e) {
386
+ var t, n = function() {
387
+ clearTimeout(o), qe && cancelAnimationFrame(t), setTimeout(e);
388
388
  }, o = setTimeout(n, 100);
389
- qe && (e = requestAnimationFrame(n));
389
+ qe && (t = requestAnimationFrame(n));
390
390
  }
391
- function le(t) {
392
- var e = x, n = t.__c;
393
- typeof n == "function" && (t.__c = void 0, n()), x = e;
391
+ function ue(e) {
392
+ var t = P, n = e.__c;
393
+ typeof n == "function" && (e.__c = void 0, n()), P = t;
394
394
  }
395
- function Te(t) {
396
- var e = x;
397
- t.__c = t.__(), x = e;
395
+ function ke(e) {
396
+ var t = P;
397
+ e.__c = e.__(), P = t;
398
398
  }
399
- function ut(t, e) {
400
- return !t || t.length !== e.length || e.some(function(n, o) {
401
- return n !== t[o];
399
+ function ut(e, t) {
400
+ return !e || e.length !== t.length || t.some(function(n, o) {
401
+ return n !== e[o];
402
402
  });
403
403
  }
404
- function dt(t, e) {
405
- return typeof e == "function" ? e(t) : e;
404
+ function dt(e, t) {
405
+ return typeof t == "function" ? t(e) : t;
406
406
  }
407
- const xt = (t) => ({
408
- saveGameData(e) {
407
+ const It = (e) => ({
408
+ saveGameData(t) {
409
409
  try {
410
- localStorage.setItem(t, JSON.stringify(e));
410
+ localStorage.setItem(e, JSON.stringify(t));
411
411
  } catch (n) {
412
412
  console.error("Failed to save maze game data:", n);
413
413
  }
414
414
  },
415
415
  loadGameData() {
416
416
  try {
417
- const e = localStorage.getItem(t);
418
- return e ? JSON.parse(e) : null;
419
- } catch (e) {
420
- return console.error("Failed to load maze game data:", e), null;
417
+ const t = localStorage.getItem(e);
418
+ return t ? JSON.parse(t) : null;
419
+ } catch (t) {
420
+ return console.error("Failed to load maze game data:", t), null;
421
421
  }
422
422
  },
423
423
  resetGameData() {
424
424
  try {
425
- localStorage.removeItem(t);
426
- } catch (e) {
427
- console.error("Failed to reset maze game data:", e);
425
+ localStorage.removeItem(e);
426
+ } catch (t) {
427
+ console.error("Failed to reset maze game data:", t);
428
428
  }
429
429
  }
430
- }), ht = Lt(void 0), He = {
430
+ }), ht = Et(void 0), He = {
431
431
  currentLevel: 1,
432
432
  highestUnlockedLevel: 1,
433
433
  currentTier: 1,
434
434
  highestUnlockedTier: 1,
435
435
  levelScores: {},
436
436
  totalScore: 0
437
- }, ke = {
437
+ }, Se = {
438
438
  isGameActive: !0,
439
439
  levelTransitioning: !1,
440
440
  maze: null,
@@ -447,9 +447,9 @@ const xt = (t) => ({
447
447
  showClue: !1,
448
448
  playerPath: [],
449
449
  visitCounts: {}
450
- }, Rt = ({ children: t, config: e }) => {
451
- const n = xt(e.lcPrefix + "progress"), o = n.loadGameData(), [i, s] = U(() => o || { ...He });
452
- R(() => {
450
+ }, xt = ({ children: e, config: t }) => {
451
+ const n = It(t.lcPrefix + "progress"), o = n.loadGameData(), [i, s] = G(() => o || { ...He });
452
+ x(() => {
453
453
  const u = Object.values(i.levelScores).reduce(
454
454
  (h, f) => h + f,
455
455
  0
@@ -458,7 +458,7 @@ const xt = (t) => ({
458
458
  ...h,
459
459
  totalScore: u
460
460
  }));
461
- }, [i.levelScores]), R(() => {
461
+ }, [i.levelScores]), x(() => {
462
462
  n.saveGameData(i);
463
463
  }, [
464
464
  i.currentLevel,
@@ -468,26 +468,26 @@ const xt = (t) => ({
468
468
  i.levelScores,
469
469
  i.totalScore
470
470
  ]);
471
- const [a, r] = U({
472
- ...ke
473
- }), l = O(a);
474
- R(() => {
475
- l.current = a;
476
- }, [a]);
477
- const c = Z(() => [
478
- a.playerAtExit ? 1 : 0,
479
- a.foodCollected === a.totalFoodCount ? 1 : 0,
480
- a.showClue ? 0 : 1
471
+ const [l, r] = G({
472
+ ...Se
473
+ }), a = F(l);
474
+ x(() => {
475
+ a.current = l;
476
+ }, [l]);
477
+ const c = ee(() => [
478
+ l.playerAtExit ? 1 : 0,
479
+ l.foodCollected === l.totalFoodCount ? 1 : 0,
480
+ l.showClue ? 0 : 1
481
481
  ], [
482
- a.playerAtExit,
483
- a.foodCollected,
484
- a.totalFoodCount,
485
- a.showClue
482
+ l.playerAtExit,
483
+ l.foodCollected,
484
+ l.totalFoodCount,
485
+ l.showClue
486
486
  ]), d = () => {
487
487
  n.resetGameData(), s({
488
488
  ...He
489
489
  }), r({
490
- ...ke
490
+ ...Se
491
491
  });
492
492
  };
493
493
  return /* @__PURE__ */ m(
@@ -496,84 +496,84 @@ const xt = (t) => ({
496
496
  value: {
497
497
  gameProgress: i,
498
498
  setGameProgress: s,
499
- gamePlayState: a,
499
+ gamePlayState: l,
500
500
  setGamePlayState: r,
501
- gamePlayStateRef: l,
501
+ gamePlayStateRef: a,
502
502
  currentScore: c,
503
- config: e,
503
+ config: t,
504
504
  resetGame: d
505
505
  },
506
- children: t
506
+ children: e
507
507
  }
508
508
  );
509
- }, ne = () => {
510
- const t = At(ht);
511
- if (!t)
509
+ }, re = () => {
510
+ const e = Mt(ht);
511
+ if (!e)
512
512
  throw new Error("useGameContext must be used within a GameProvider");
513
- return t;
514
- }, oe = (t) => Z(() => {
515
- const e = t.map((r) => r.length), n = e.reduce((r, l) => r + l, 0), o = t.length, i = (r) => {
513
+ return e;
514
+ }, ie = (e) => ee(() => {
515
+ const t = e.map((r) => r.length), n = t.reduce((r, a) => r + a, 0), o = e.length, i = (r) => {
516
516
  if (r < 1 || r > n) return 0;
517
- let l = 0;
518
- for (let c = 0; c < e.length; c++)
519
- if (l += e[c], r <= l) return c + 1;
517
+ let a = 0;
518
+ for (let c = 0; c < t.length; c++)
519
+ if (a += t[c], r <= a) return c + 1;
520
520
  return 0;
521
- }, s = (r) => r < 1 || r > o ? 0 : e.slice(0, r - 1).reduce((l, c) => l + c, 0) + 1, a = {
521
+ }, s = (r) => r < 1 || r > o ? 0 : t.slice(0, r - 1).reduce((a, c) => a + c, 0) + 1, l = {
522
522
  getTotalLevels: () => n,
523
523
  getTotalTiers: () => o,
524
524
  getTierLevelsRange: (r) => {
525
525
  if (r < 1 || r > o) return [0, 0];
526
- const l = s(r), c = l + e[r - 1] - 1;
527
- return [l, c];
526
+ const a = s(r), c = a + t[r - 1] - 1;
527
+ return [a, c];
528
528
  },
529
529
  getTierByLevel: i,
530
530
  getFirstLevelOfTier: s,
531
531
  getLevelConfig: (r) => {
532
532
  if (r < 1 || r > n) return null;
533
- const l = i(r), c = s(l), d = r - c;
534
- return t[l - 1][d];
533
+ const a = i(r), c = s(a), d = r - c;
534
+ return e[a - 1][d];
535
535
  },
536
- getTierConfig: (r) => r < 1 || r > o ? null : t[r - 1],
537
- isLevelUnlocked: (r, l) => r <= l,
538
- isTierUnlocked: (r, l) => r <= l,
536
+ getTierConfig: (r) => r < 1 || r > o ? null : e[r - 1],
537
+ isLevelUnlocked: (r, a) => r <= a,
538
+ isTierUnlocked: (r, a) => r <= a,
539
539
  getNextLevelInfo: (r) => {
540
540
  if (r >= n) return null;
541
- const l = r + 1, c = i(r), d = i(l);
541
+ const a = r + 1, c = i(r), d = i(a);
542
542
  return {
543
- nextLevel: l,
543
+ nextLevel: a,
544
544
  nextTier: d,
545
545
  isTierChange: d > c
546
546
  };
547
547
  },
548
- getCurrentTierProgress: (r, l) => {
549
- const [c, d] = a.getTierLevelsRange(l), u = r - c + 1, h = d - c + 1;
548
+ getCurrentTierProgress: (r, a) => {
549
+ const [c, d] = l.getTierLevelsRange(a), u = r - c + 1, h = d - c + 1;
550
550
  return { current: u, total: h };
551
551
  },
552
552
  isLastLevelInTier: (r) => {
553
- const l = i(r), [, c] = a.getTierLevelsRange(l);
553
+ const a = i(r), [, c] = l.getTierLevelsRange(a);
554
554
  return r === c;
555
555
  },
556
556
  getPreviousLevelInfo: (r) => {
557
557
  if (r <= 1) return null;
558
- const l = r - 1, c = i(r), d = i(l);
558
+ const a = r - 1, c = i(r), d = i(a);
559
559
  return {
560
- prevLevel: l,
560
+ prevLevel: a,
561
561
  prevTier: d,
562
562
  isTierChange: d < c
563
563
  };
564
564
  }
565
565
  };
566
- return a;
567
- }, [t]), Ft = ({ onTierChange: t, disabled: e }) => {
568
- const { gameProgress: n, config: o } = ne(), { i18n: i, levelConfig: s } = o, { currentTier: a, highestUnlockedTier: r } = n, c = oe(s).getTotalTiers();
566
+ return l;
567
+ }, [e]), Rt = ({ onTierChange: e, disabled: t }) => {
568
+ const { gameProgress: n, config: o } = re(), { i18n: i, levelConfig: s } = o, { currentTier: l, highestUnlockedTier: r } = n, c = ie(s).getTotalTiers();
569
569
  return /* @__PURE__ */ m("div", { className: "tier-selector", children: /* @__PURE__ */ m(
570
570
  "select",
571
571
  {
572
- value: a,
572
+ value: l,
573
573
  onChange: (d) => {
574
- d.target && d.target.value && t(Number(d.target.value));
574
+ d.target && d.target.value && e(Number(d.target.value));
575
575
  },
576
- disabled: e,
576
+ disabled: t,
577
577
  className: "tier-dropdown",
578
578
  children: Array.from({ length: c }, (d, u) => u + 1).map((d) => /* @__PURE__ */ m(
579
579
  "option",
@@ -586,25 +586,25 @@ const xt = (t) => ({
586
586
  ))
587
587
  }
588
588
  ) });
589
- }, Dt = ({ onLevelChange: t, disabled: e }) => {
590
- const { gameProgress: n, config: o } = ne(), { i18n: i, levelConfig: s } = o, { currentTier: a, levelScores: r, currentLevel: l, highestUnlockedLevel: c } = n, d = oe(s), u = Z(() => {
591
- const [h, f] = d.getTierLevelsRange(a);
592
- return Array.from({ length: f - h + 1 }, (k, p) => {
593
- const _ = h + p, b = r[_] || 0;
589
+ }, Ft = ({ onLevelChange: e, disabled: t }) => {
590
+ const { gameProgress: n, config: o } = re(), { i18n: i, levelConfig: s } = o, { currentTier: l, levelScores: r, currentLevel: a, highestUnlockedLevel: c } = n, d = ie(s), u = ee(() => {
591
+ const [h, f] = d.getTierLevelsRange(l);
592
+ return Array.from({ length: f - h + 1 }, (p, v) => {
593
+ const _ = h + v, b = r[_] || 0;
594
594
  return {
595
595
  level: _,
596
596
  score: b
597
597
  };
598
598
  });
599
- }, [a, r]);
599
+ }, [l, r]);
600
600
  return /* @__PURE__ */ m("div", { className: "level-selector", children: /* @__PURE__ */ m(
601
601
  "select",
602
602
  {
603
- value: l,
603
+ value: a,
604
604
  onChange: (h) => {
605
- h.target && h.target.value && t(Number(h.target.value));
605
+ h.target && h.target.value && e(Number(h.target.value));
606
606
  },
607
- disabled: e,
607
+ disabled: t,
608
608
  className: "level-dropdown",
609
609
  children: u.map(({ level: h, score: f }) => /* @__PURE__ */ m(
610
610
  "option",
@@ -617,44 +617,44 @@ const xt = (t) => ({
617
617
  ))
618
618
  }
619
619
  ) });
620
- }, Q = ({
621
- isOpen: t,
622
- title: e,
620
+ }, te = ({
621
+ isOpen: e,
622
+ title: t,
623
623
  className: n = "",
624
624
  message: o,
625
625
  children: i,
626
626
  noConfirm: s = !1,
627
- noCancel: a = !1,
627
+ noCancel: l = !1,
628
628
  confirmText: r = "OK",
629
- cancelText: l = "Cancel",
629
+ cancelText: a = "Cancel",
630
630
  confirmClass: c = "",
631
631
  cancelClass: d = "",
632
632
  onConfirm: u,
633
633
  onCancel: h
634
634
  }) => {
635
- const f = O(null);
636
- return R(() => {
637
- const k = (p) => {
638
- p.key === "Escape" && h?.();
635
+ const f = F(null);
636
+ return x(() => {
637
+ const p = (v) => {
638
+ v.key === "Escape" && h?.();
639
639
  };
640
- return t && document.addEventListener("keydown", k), () => {
641
- document.removeEventListener("keydown", k);
640
+ return e && document.addEventListener("keydown", p), () => {
641
+ document.removeEventListener("keydown", p);
642
642
  };
643
- }, [t, h]), /* @__PURE__ */ m(
643
+ }, [e, h]), /* @__PURE__ */ m(
644
644
  "div",
645
645
  {
646
- className: `maze-dialog-overlay ${t ? "maze-dialog-visible" : ""}`,
646
+ className: `maze-dialog-overlay ${e ? "maze-dialog-visible" : ""}`,
647
647
  children: /* @__PURE__ */ m("div", { className: "maze-dialog " + n, ref: f, children: [
648
- /* @__PURE__ */ m("div", { className: "maze-dialog-title", children: e }),
648
+ /* @__PURE__ */ m("div", { className: "maze-dialog-title", children: t }),
649
649
  /* @__PURE__ */ m("div", { className: "maze-dialog-content", children: i || /* @__PURE__ */ m("div", { className: "maze-dialog-message", children: o }) }),
650
- (!a || !s) && /* @__PURE__ */ m("div", { className: "maze-dialog-buttons", children: [
651
- !a && /* @__PURE__ */ m(
650
+ (!l || !s) && /* @__PURE__ */ m("div", { className: "maze-dialog-buttons", children: [
651
+ !l && /* @__PURE__ */ m(
652
652
  "button",
653
653
  {
654
654
  type: "button",
655
655
  className: "maze-dialog-cancel " + d,
656
656
  onClick: h,
657
- children: l
657
+ children: a
658
658
  }
659
659
  ),
660
660
  !s && /* @__PURE__ */ m(
@@ -670,17 +670,17 @@ const xt = (t) => ({
670
670
  ] })
671
671
  }
672
672
  );
673
- }, j = {
673
+ }, q = {
674
674
  container: null,
675
675
  // attach Toast container to element, only need to execute once
676
- attachTo(t) {
677
- return this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = document.createElement("div"), this.container.className = "toast-container position-bottom", t.appendChild(this.container), this.container;
676
+ attachTo(e) {
677
+ return this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = document.createElement("div"), this.container.className = "toast-container position-bottom", e.appendChild(this.container), this.container;
678
678
  },
679
679
  // current toast element
680
680
  currentToast: null,
681
681
  currentTimer: null,
682
682
  // use it in any component
683
- show(t, e = 2e3) {
683
+ show(e, t = 2e3) {
684
684
  if (!this.container) {
685
685
  console.warn(
686
686
  "NativeToast: container not initialized, please call attachTo first"
@@ -689,66 +689,66 @@ const xt = (t) => ({
689
689
  }
690
690
  this.currentToast && this.container.contains(this.currentToast) && (this.container.removeChild(this.currentToast), this.currentToast = null), this.currentTimer && (clearTimeout(this.currentTimer), this.currentTimer = null);
691
691
  const n = document.createElement("div");
692
- n.className = "toast-message toast-visible", n.textContent = t, this.container.appendChild(n), this.currentToast = n, this.currentTimer = setTimeout(() => {
692
+ n.className = "toast-message toast-visible", n.textContent = e, this.container.appendChild(n), this.currentToast = n, this.currentTimer = setTimeout(() => {
693
693
  n.classList.remove("toast-visible"), setTimeout(() => {
694
694
  this.container && this.container.contains(n) && (this.container.removeChild(n), this.currentToast === n && (this.currentToast = null));
695
695
  }, 300), this.currentTimer = null;
696
- }, e);
696
+ }, t);
697
697
  },
698
698
  clearAll() {
699
699
  if (this.container)
700
700
  for (; this.container.firstChild; )
701
701
  this.container.removeChild(this.container.firstChild);
702
702
  }
703
- }, Ot = () => {
703
+ }, Dt = () => {
704
704
  const {
705
- gameProgress: t,
706
- setGameProgress: e,
705
+ gameProgress: e,
706
+ setGameProgress: t,
707
707
  gamePlayState: n,
708
708
  setGamePlayState: o,
709
709
  gamePlayStateRef: i,
710
710
  resetGame: s,
711
- config: a
712
- } = ne(), { i18n: r, levelConfig: l } = a, c = oe(l), { levelTransitioning: d, showClue: u } = n, { highestUnlockedLevel: h, totalScore: f } = t, k = c.getTotalLevels(), [p, _] = U(!1), [b, w] = U(!1), [M, C] = U(!1), z = (D) => {
713
- const I = c.getFirstLevelOfTier(D);
714
- c.isLevelUnlocked(I, h) && (e(($) => ({ ...$, currentTier: D })), S(I));
715
- }, S = (D) => {
716
- c.isLevelUnlocked(D, h) && (e((I) => ({ ...I, currentLevel: D })), j.show(r.levelGoToast.replace("%LEVEL%", D.toString())));
717
- }, E = () => {
711
+ config: l
712
+ } = re(), { i18n: r, levelConfig: a } = l, c = ie(a), { levelTransitioning: d, showClue: u } = n, { highestUnlockedLevel: h, totalScore: f } = e, p = c.getTotalLevels(), [v, _] = G(!1), [b, C] = G(!1), [T, g] = G(!1), k = (O) => {
713
+ const $ = c.getFirstLevelOfTier(O);
714
+ c.isLevelUnlocked($, h) && (t((W) => ({ ...W, currentTier: O })), w($));
715
+ }, w = (O) => {
716
+ c.isLevelUnlocked(O, h) && (t(($) => ({ ...$, currentLevel: O })), q.show(r.levelGoToast.replace("%LEVEL%", O.toString())));
717
+ }, y = () => {
718
718
  _(!0);
719
- }, L = () => {
719
+ }, S = () => {
720
720
  _(!1);
721
- }, y = () => {
722
- C(!0);
723
- }, g = () => {
724
- C(!1);
725
- }, v = () => {
726
- j.show(u ? r.cluePathDisabled : r.cluePathEnabled), o(() => ({
721
+ }, N = () => {
722
+ g(!0);
723
+ }, z = () => {
724
+ g(!1);
725
+ }, E = () => {
726
+ q.show(u ? r.cluePathDisabled : r.cluePathEnabled), o(() => ({
727
727
  ...i.current,
728
728
  // need to sync with ref
729
729
  showClue: !i.current.showClue
730
- })), C(!1);
731
- }, T = () => {
732
- w(!0);
733
- }, N = () => {
734
- s(), w(!1), j.show(r.resetDoneToast);
735
- }, P = () => {
736
- w(!1);
730
+ })), g(!1);
731
+ }, L = () => {
732
+ C(!0);
733
+ }, A = () => {
734
+ s(), C(!1), q.show(r.resetDoneToast);
735
+ }, I = () => {
736
+ C(!1);
737
737
  };
738
738
  return /* @__PURE__ */ m("div", { class: "game-panel-container", children: [
739
739
  /* @__PURE__ */ m("div", { className: "game-controls", children: [
740
740
  /* @__PURE__ */ m("div", { className: "selectors-container", children: [
741
741
  /* @__PURE__ */ m(
742
- Ft,
742
+ Rt,
743
743
  {
744
- onTierChange: z,
744
+ onTierChange: k,
745
745
  disabled: d
746
746
  }
747
747
  ),
748
748
  /* @__PURE__ */ m(
749
- Dt,
749
+ Ft,
750
750
  {
751
- onLevelChange: S,
751
+ onLevelChange: w,
752
752
  disabled: d
753
753
  }
754
754
  )
@@ -759,23 +759,23 @@ const xt = (t) => ({
759
759
  className: `settings-clue-button ${u ? "clue-on" : "clue-off"}`,
760
760
  disabled: u,
761
761
  title: "Toggle Clue",
762
- onClick: y,
762
+ onClick: N,
763
763
  children: u ? r.clueOn : r.clueOff
764
764
  }
765
765
  )
766
766
  ] }),
767
- /* @__PURE__ */ m("div", { className: "game-settings", children: /* @__PURE__ */ m("span", { className: "game-settings-icon", onClick: E, children: "★ " + f }) }),
767
+ /* @__PURE__ */ m("div", { className: "game-settings", children: /* @__PURE__ */ m("span", { className: "game-settings-icon", onClick: y, children: "★ " + f }) }),
768
768
  /* @__PURE__ */ m(
769
- Q,
769
+ te,
770
770
  {
771
- isOpen: p,
771
+ isOpen: v,
772
772
  title: r.settings,
773
773
  noConfirm: !0,
774
774
  cancelText: r.close,
775
- onCancel: L,
775
+ onCancel: S,
776
776
  children: [
777
777
  /* @__PURE__ */ m("div", { className: "settings-stats", children: [
778
- /* @__PURE__ */ m("div", { children: r.levelComplete + `: ${h}/${k}` }),
778
+ /* @__PURE__ */ m("div", { children: r.levelComplete + `: ${h}/${p}` }),
779
779
  /* @__PURE__ */ m("div", { children: r.starsCollected + ": " + f }),
780
780
  /* @__PURE__ */ m("div", { children: r.avgStarPerLevel + ": " + (f / h).toFixed(2) })
781
781
  ] }),
@@ -785,7 +785,7 @@ const xt = (t) => ({
785
785
  {
786
786
  className: "settings-reset-button",
787
787
  title: "Reset Game",
788
- onClick: T,
788
+ onClick: L,
789
789
  children: r.reset
790
790
  }
791
791
  ),
@@ -795,127 +795,127 @@ const xt = (t) => ({
795
795
  }
796
796
  ),
797
797
  /* @__PURE__ */ m(
798
- Q,
798
+ te,
799
799
  {
800
800
  isOpen: b,
801
801
  title: r.confirmReset,
802
802
  message: r.confirmResetMessage,
803
803
  confirmText: r.reset,
804
804
  cancelText: r.cancel,
805
- onConfirm: N,
806
- onCancel: P
805
+ onConfirm: A,
806
+ onCancel: I
807
807
  }
808
808
  ),
809
809
  /* @__PURE__ */ m(
810
- Q,
810
+ te,
811
811
  {
812
- isOpen: M,
812
+ isOpen: T,
813
813
  title: r.confirmClue,
814
814
  message: r.confirmClueMessage,
815
815
  confirmText: r.confirm,
816
816
  cancelText: r.cancel,
817
- onConfirm: v,
818
- onCancel: g
817
+ onConfirm: E,
818
+ onCancel: z
819
819
  }
820
820
  )
821
821
  ] });
822
822
  };
823
- function Ne(t, e) {
824
- if (!(t instanceof e))
823
+ function Me(e, t) {
824
+ if (!(e instanceof t))
825
825
  throw new TypeError("Cannot call a class as a function");
826
826
  }
827
- function $t(t, e) {
828
- for (var n = 0; n < e.length; n++) {
829
- var o = e[n];
830
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, o.key, o);
827
+ function Ot(e, t) {
828
+ for (var n = 0; n < t.length; n++) {
829
+ var o = t[n];
830
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
831
831
  }
832
832
  }
833
- function Me(t, e, n) {
834
- return e && $t(t.prototype, e), t;
833
+ function Ae(e, t, n) {
834
+ return t && Ot(e.prototype, t), e;
835
835
  }
836
- function Be(t) {
837
- return +t.replace(/px/, "");
836
+ function Be(e) {
837
+ return +e.replace(/px/, "");
838
838
  }
839
- function Ut(t) {
840
- var e = window.devicePixelRatio, n = getComputedStyle(t), o = Be(n.getPropertyValue("width")), i = Be(n.getPropertyValue("height"));
841
- t.setAttribute("width", (o * e).toString()), t.setAttribute("height", (i * e).toString());
839
+ function $t(e) {
840
+ var t = window.devicePixelRatio, n = getComputedStyle(e), o = Be(n.getPropertyValue("width")), i = Be(n.getPropertyValue("height"));
841
+ e.setAttribute("width", (o * t).toString()), e.setAttribute("height", (i * t).toString());
842
842
  }
843
- function W(t, e) {
844
- var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, o = Math.random() * (e - t) + t;
843
+ function j(e, t) {
844
+ var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, o = Math.random() * (t - e) + e;
845
845
  return Math.floor(o * Math.pow(10, n)) / Math.pow(10, n);
846
846
  }
847
- function Ve(t) {
848
- return t[W(0, t.length)];
847
+ function Ve(e) {
848
+ return e[j(0, e.length)];
849
849
  }
850
- var Gt = 125e-5, Wt = 5e-4, jt = 9e-4, qt = 1e-5, Ht = 6, Bt = 80, Vt = 0.9, Xt = 1.7, Yt = 0.2, Kt = 0.6, Jt = 0.03, Zt = 0.07, Qt = 15, en = 82, tn = 100, nn = 250, on = 40, rn = ["#fcf403", "#62fc03", "#f4fc03", "#03e7fc", "#03fca5", "#a503fc", "#fc03ad", "#fc03c2"];
851
- function Xe(t) {
852
- var e = 1920;
853
- return Math.log(t) / Math.log(e);
850
+ var Ut = 125e-5, Gt = 5e-4, Wt = 9e-4, jt = 1e-5, qt = 6, Ht = 80, Bt = 0.9, Vt = 1.7, Xt = 0.2, Yt = 0.6, Kt = 0.03, Jt = 0.07, Zt = 15, Qt = 82, en = 100, tn = 250, nn = 40, on = ["#fcf403", "#62fc03", "#f4fc03", "#03e7fc", "#03fca5", "#a503fc", "#fc03ad", "#fc03c2"];
851
+ function Xe(e) {
852
+ var t = 1920;
853
+ return Math.log(e) / Math.log(t);
854
854
  }
855
855
  var Ye = /* @__PURE__ */ function() {
856
- function t(e) {
857
- Ne(this, t);
858
- var n = e.initialPosition, o = e.direction, i = e.confettiRadius, s = e.confettiColors, a = e.emojis, r = e.emojiSize, l = e.canvasWidth, c = W(Vt, Xt, 3), d = c * Xe(l);
856
+ function e(t) {
857
+ Me(this, e);
858
+ var n = t.initialPosition, o = t.direction, i = t.confettiRadius, s = t.confettiColors, l = t.emojis, r = t.emojiSize, a = t.canvasWidth, c = j(Bt, Vt, 3), d = c * Xe(a);
859
859
  this.confettiSpeed = {
860
860
  x: d,
861
861
  y: d
862
- }, this.finalConfettiSpeedX = W(Yt, Kt, 3), this.rotationSpeed = a.length ? 0.01 : W(Jt, Zt, 3) * Xe(l), this.dragForceCoefficient = W(Wt, jt, 6), this.radius = {
862
+ }, this.finalConfettiSpeedX = j(Xt, Yt, 3), this.rotationSpeed = l.length ? 0.01 : j(Kt, Jt, 3) * Xe(a), this.dragForceCoefficient = j(Gt, Wt, 6), this.radius = {
863
863
  x: i,
864
864
  y: i
865
- }, this.initialRadius = i, this.rotationAngle = o === "left" ? W(0, 0.2, 3) : W(-0.2, 0, 3), this.emojiSize = r, this.emojiRotationAngle = W(0, 2 * Math.PI), this.radiusYUpdateDirection = "down";
866
- var u = o === "left" ? W(en, Qt) * Math.PI / 180 : W(-15, -82) * Math.PI / 180;
865
+ }, this.initialRadius = i, this.rotationAngle = o === "left" ? j(0, 0.2, 3) : j(-0.2, 0, 3), this.emojiSize = r, this.emojiRotationAngle = j(0, 2 * Math.PI), this.radiusYUpdateDirection = "down";
866
+ var u = o === "left" ? j(Qt, Zt) * Math.PI / 180 : j(-15, -82) * Math.PI / 180;
867
867
  this.absCos = Math.abs(Math.cos(u)), this.absSin = Math.abs(Math.sin(u));
868
- var h = W(-150, 0), f = {
868
+ var h = j(-150, 0), f = {
869
869
  x: n.x + (o === "left" ? -h : h) * this.absCos,
870
870
  y: n.y - h * this.absSin
871
871
  };
872
- this.currentPosition = Object.assign({}, f), this.initialPosition = Object.assign({}, f), this.color = a.length ? null : Ve(s), this.emoji = a.length ? Ve(a) : null, this.createdAt = (/* @__PURE__ */ new Date()).getTime(), this.direction = o;
872
+ this.currentPosition = Object.assign({}, f), this.initialPosition = Object.assign({}, f), this.color = l.length ? null : Ve(s), this.emoji = l.length ? Ve(l) : null, this.createdAt = (/* @__PURE__ */ new Date()).getTime(), this.direction = o;
873
873
  }
874
- return Me(t, [{
874
+ return Ae(e, [{
875
875
  key: "draw",
876
876
  value: function(n) {
877
- var o = this.currentPosition, i = this.radius, s = this.color, a = this.emoji, r = this.rotationAngle, l = this.emojiRotationAngle, c = this.emojiSize, d = window.devicePixelRatio;
878
- s ? (n.fillStyle = s, n.beginPath(), n.ellipse(o.x * d, o.y * d, i.x * d, i.y * d, r, 0, 2 * Math.PI), n.fill()) : a && (n.font = "".concat(c, "px serif"), n.save(), n.translate(d * o.x, d * o.y), n.rotate(l), n.textAlign = "center", n.fillText(a, 0, 0), n.restore());
877
+ var o = this.currentPosition, i = this.radius, s = this.color, l = this.emoji, r = this.rotationAngle, a = this.emojiRotationAngle, c = this.emojiSize, d = window.devicePixelRatio;
878
+ s ? (n.fillStyle = s, n.beginPath(), n.ellipse(o.x * d, o.y * d, i.x * d, i.y * d, r, 0, 2 * Math.PI), n.fill()) : l && (n.font = "".concat(c, "px serif"), n.save(), n.translate(d * o.x, d * o.y), n.rotate(a), n.textAlign = "center", n.fillText(l, 0, 0), n.restore());
879
879
  }
880
880
  }, {
881
881
  key: "updatePosition",
882
882
  value: function(n, o) {
883
- var i = this.confettiSpeed, s = this.dragForceCoefficient, a = this.finalConfettiSpeedX, r = this.radiusYUpdateDirection, l = this.rotationSpeed, c = this.createdAt, d = this.direction, u = o - c;
884
- if (i.x > a && (this.confettiSpeed.x -= s * n), this.currentPosition.x += i.x * (d === "left" ? -this.absCos : this.absCos) * n, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u + Gt * Math.pow(u, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : qt * n, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
883
+ var i = this.confettiSpeed, s = this.dragForceCoefficient, l = this.finalConfettiSpeedX, r = this.radiusYUpdateDirection, a = this.rotationSpeed, c = this.createdAt, d = this.direction, u = o - c;
884
+ if (i.x > l && (this.confettiSpeed.x -= s * n), this.currentPosition.x += i.x * (d === "left" ? -this.absCos : this.absCos) * n, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u + Ut * Math.pow(u, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : jt * n, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
885
885
  this.emojiRotationAngle += this.rotationSpeed * n % (2 * Math.PI);
886
886
  return;
887
887
  }
888
- r === "down" ? (this.radius.y -= n * l, this.radius.y <= 0 && (this.radius.y = 0, this.radiusYUpdateDirection = "up")) : (this.radius.y += n * l, this.radius.y >= this.initialRadius && (this.radius.y = this.initialRadius, this.radiusYUpdateDirection = "down"));
888
+ r === "down" ? (this.radius.y -= n * a, this.radius.y <= 0 && (this.radius.y = 0, this.radiusYUpdateDirection = "up")) : (this.radius.y += n * a, this.radius.y >= this.initialRadius && (this.radius.y = this.initialRadius, this.radiusYUpdateDirection = "down"));
889
889
  }
890
890
  }, {
891
891
  key: "getIsVisibleOnCanvas",
892
892
  value: function(n) {
893
- return this.currentPosition.y < n + tn;
893
+ return this.currentPosition.y < n + en;
894
894
  }
895
- }]), t;
895
+ }]), e;
896
896
  }();
897
- function sn() {
898
- var t = document.createElement("canvas");
899
- return t.style.position = "fixed", t.style.width = "100%", t.style.height = "100%", t.style.top = "0", t.style.left = "0", t.style.zIndex = "1000", t.style.pointerEvents = "none", document.body.appendChild(t), t;
897
+ function rn() {
898
+ var e = document.createElement("canvas");
899
+ return e.style.position = "fixed", e.style.width = "100%", e.style.height = "100%", e.style.top = "0", e.style.left = "0", e.style.zIndex = "1000", e.style.pointerEvents = "none", document.body.appendChild(e), e;
900
900
  }
901
- function an(t) {
902
- var e = t.confettiRadius, n = e === void 0 ? Ht : e, o = t.confettiNumber, i = o === void 0 ? t.confettiesNumber || (t.emojis ? on : nn) : o, s = t.confettiColors, a = s === void 0 ? rn : s, r = t.emojis, l = r === void 0 ? t.emojies || [] : r, c = t.emojiSize, d = c === void 0 ? Bt : c;
903
- return t.emojies && console.error("emojies argument is deprecated, please use emojis instead"), t.confettiesNumber && console.error("confettiesNumber argument is deprecated, please use confettiNumber instead"), {
901
+ function sn(e) {
902
+ var t = e.confettiRadius, n = t === void 0 ? qt : t, o = e.confettiNumber, i = o === void 0 ? e.confettiesNumber || (e.emojis ? nn : tn) : o, s = e.confettiColors, l = s === void 0 ? on : s, r = e.emojis, a = r === void 0 ? e.emojies || [] : r, c = e.emojiSize, d = c === void 0 ? Ht : c;
903
+ return e.emojies && console.error("emojies argument is deprecated, please use emojis instead"), e.confettiesNumber && console.error("confettiesNumber argument is deprecated, please use confettiNumber instead"), {
904
904
  confettiRadius: n,
905
905
  confettiNumber: i,
906
- confettiColors: a,
907
- emojis: l,
906
+ confettiColors: l,
907
+ emojis: a,
908
908
  emojiSize: d
909
909
  };
910
910
  }
911
911
  var ln = /* @__PURE__ */ function() {
912
- function t(e) {
912
+ function e(t) {
913
913
  var n = this;
914
- Ne(this, t), this.canvasContext = e, this.shapes = [], this.promise = new Promise(function(o) {
914
+ Me(this, e), this.canvasContext = t, this.shapes = [], this.promise = new Promise(function(o) {
915
915
  return n.resolvePromise = o;
916
916
  });
917
917
  }
918
- return Me(t, [{
918
+ return Ae(e, [{
919
919
  key: "getBatchCompletePromise",
920
920
  value: function() {
921
921
  return this.promise;
@@ -935,27 +935,27 @@ var ln = /* @__PURE__ */ function() {
935
935
  }, {
936
936
  key: "processShapes",
937
937
  value: function(n, o, i) {
938
- var s = this, a = n.timeDelta, r = n.currentTime;
939
- this.shapes = this.shapes.filter(function(l) {
940
- return l.updatePosition(a, r), l.draw(s.canvasContext), i ? l.getIsVisibleOnCanvas(o) : !0;
938
+ var s = this, l = n.timeDelta, r = n.currentTime;
939
+ this.shapes = this.shapes.filter(function(a) {
940
+ return a.updatePosition(l, r), a.draw(s.canvasContext), i ? a.getIsVisibleOnCanvas(o) : !0;
941
941
  });
942
942
  }
943
- }]), t;
944
- }(), cn = /* @__PURE__ */ function() {
945
- function t() {
946
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
947
- Ne(this, t), this.activeConfettiBatches = [], this.canvas = e.canvas || sn(), this.canvasContext = this.canvas.getContext("2d"), this.requestAnimationFrameRequested = !1, this.lastUpdated = (/* @__PURE__ */ new Date()).getTime(), this.iterationIndex = 0, this.loop = this.loop.bind(this), requestAnimationFrame(this.loop);
943
+ }]), e;
944
+ }(), an = /* @__PURE__ */ function() {
945
+ function e() {
946
+ var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
947
+ Me(this, e), this.activeConfettiBatches = [], this.canvas = t.canvas || rn(), this.canvasContext = this.canvas.getContext("2d"), this.requestAnimationFrameRequested = !1, this.lastUpdated = (/* @__PURE__ */ new Date()).getTime(), this.iterationIndex = 0, this.loop = this.loop.bind(this), requestAnimationFrame(this.loop);
948
948
  }
949
- return Me(t, [{
949
+ return Ae(e, [{
950
950
  key: "loop",
951
951
  value: function() {
952
- this.requestAnimationFrameRequested = !1, Ut(this.canvas);
952
+ this.requestAnimationFrameRequested = !1, $t(this.canvas);
953
953
  var n = (/* @__PURE__ */ new Date()).getTime(), o = n - this.lastUpdated, i = this.canvas.offsetHeight, s = this.iterationIndex % 10 === 0;
954
- this.activeConfettiBatches = this.activeConfettiBatches.filter(function(a) {
955
- return a.processShapes({
954
+ this.activeConfettiBatches = this.activeConfettiBatches.filter(function(l) {
955
+ return l.processShapes({
956
956
  timeDelta: o,
957
957
  currentTime: n
958
- }, i, s), s ? !a.complete() : !0;
958
+ }, i, s), s ? !l.complete() : !0;
959
959
  }), this.iterationIndex++, this.queueAnimationFrameIfNeeded(n);
960
960
  }
961
961
  }, {
@@ -966,35 +966,35 @@ var ln = /* @__PURE__ */ function() {
966
966
  }, {
967
967
  key: "addConfetti",
968
968
  value: function() {
969
- for (var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, o = an(n), i = o.confettiRadius, s = o.confettiNumber, a = o.confettiColors, r = o.emojis, l = o.emojiSize, c = this.canvas.getBoundingClientRect(), d = c.width, u = c.height, h = u * 5 / 7, f = {
969
+ for (var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, o = sn(n), i = o.confettiRadius, s = o.confettiNumber, l = o.confettiColors, r = o.emojis, a = o.emojiSize, c = this.canvas.getBoundingClientRect(), d = c.width, u = c.height, h = u * 5 / 7, f = {
970
970
  x: 0,
971
971
  y: h
972
- }, k = {
972
+ }, p = {
973
973
  x: d,
974
974
  y: h
975
- }, p = new ln(this.canvasContext), _ = 0; _ < s / 2; _++) {
975
+ }, v = new ln(this.canvasContext), _ = 0; _ < s / 2; _++) {
976
976
  var b = new Ye({
977
977
  initialPosition: f,
978
978
  direction: "right",
979
979
  confettiRadius: i,
980
- confettiColors: a,
980
+ confettiColors: l,
981
981
  confettiNumber: s,
982
982
  emojis: r,
983
- emojiSize: l,
983
+ emojiSize: a,
984
984
  canvasWidth: d
985
- }), w = new Ye({
986
- initialPosition: k,
985
+ }), C = new Ye({
986
+ initialPosition: p,
987
987
  direction: "left",
988
988
  confettiRadius: i,
989
- confettiColors: a,
989
+ confettiColors: l,
990
990
  confettiNumber: s,
991
991
  emojis: r,
992
- emojiSize: l,
992
+ emojiSize: a,
993
993
  canvasWidth: d
994
994
  });
995
- p.addShapes(b, w);
995
+ v.addShapes(b, C);
996
996
  }
997
- return this.activeConfettiBatches.push(p), this.queueAnimationFrameIfNeeded(), p.getBatchCompletePromise();
997
+ return this.activeConfettiBatches.push(v), this.queueAnimationFrameIfNeeded(), v.getBatchCompletePromise();
998
998
  }
999
999
  }, {
1000
1000
  key: "clearCanvas",
@@ -1006,91 +1006,91 @@ var ln = /* @__PURE__ */ function() {
1006
1006
  value: function() {
1007
1007
  this.canvas.remove();
1008
1008
  }
1009
- }]), t;
1009
+ }]), e;
1010
1010
  }();
1011
- const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1011
+ const cn = new an(), we = 3, un = ({ onRetry: e }) => {
1012
1012
  const {
1013
- config: e,
1013
+ config: t,
1014
1014
  currentScore: n,
1015
1015
  gamePlayState: o,
1016
1016
  setGamePlayState: i,
1017
1017
  gameProgress: s,
1018
- setGameProgress: a
1019
- } = ne(), { i18n: r, levelConfig: l } = e, [c, d, u] = n, { foodCollected: h, totalFoodCount: f, playerAtExit: k, levelTransitioning: p } = o, { currentLevel: _ } = s, [b, w] = U(!1);
1020
- R(() => {
1021
- k && p && (un.addConfetti(), j.show(r.levelCompleteToast), w(!0));
1022
- }, [k, p]);
1023
- const M = oe(l), C = M.getTotalLevels(), z = Z(() => _ >= C, [_, C]), S = () => {
1024
- w(!1), j.show(r.levelRestartToast), t?.();
1025
- }, E = () => {
1026
- w(!1), i((g) => ({
1027
- ...g,
1018
+ setGameProgress: l
1019
+ } = re(), { i18n: r, levelConfig: a } = t, [c, d, u] = n, { foodCollected: h, totalFoodCount: f, playerAtExit: p, levelTransitioning: v } = o, { currentLevel: _ } = s, [b, C] = G(!1);
1020
+ x(() => {
1021
+ p && v && (cn.addConfetti(), q.show(r.levelCompleteToast), C(!0));
1022
+ }, [p, v]);
1023
+ const T = ie(a), g = T.getTotalLevels(), k = ee(() => _ >= g, [_, g]), w = () => {
1024
+ C(!1), q.show(r.levelRestartToast), e?.();
1025
+ }, y = () => {
1026
+ C(!1), i((z) => ({
1027
+ ...z,
1028
1028
  isGameActive: !0,
1029
1029
  levelTransitioning: !1
1030
1030
  }));
1031
- }, L = () => {
1032
- w(!1);
1033
- const g = M.getNextLevelInfo(_);
1034
- if (!g) return;
1035
- const { nextLevel: v, nextTier: T, isTierChange: N } = g;
1036
- N && j.show(
1037
- r.tierUnlockedToast.replace("%TIER%", T.toString())
1038
- ), a((P) => ({
1039
- ...P,
1040
- currentLevel: v,
1041
- currentTier: T,
1042
- highestUnlockedLevel: Math.max(P.highestUnlockedLevel, v),
1043
- highestUnlockedTier: Math.max(P.highestUnlockedTier, T),
1031
+ }, S = () => {
1032
+ C(!1);
1033
+ const z = T.getNextLevelInfo(_);
1034
+ if (!z) return;
1035
+ const { nextLevel: E, nextTier: L, isTierChange: A } = z;
1036
+ A && q.show(
1037
+ r.tierUnlockedToast.replace("%TIER%", L.toString())
1038
+ ), l((I) => ({
1039
+ ...I,
1040
+ currentLevel: E,
1041
+ currentTier: L,
1042
+ highestUnlockedLevel: Math.max(I.highestUnlockedLevel, E),
1043
+ highestUnlockedTier: Math.max(I.highestUnlockedTier, L),
1044
1044
  levelScores: {
1045
- ...P.levelScores,
1046
- [P.currentLevel]: Math.max(
1045
+ ...I.levelScores,
1046
+ [I.currentLevel]: Math.max(
1047
1047
  Object.values(n).filter(Boolean).length,
1048
- P.levelScores[P.currentLevel] || 0
1048
+ I.levelScores[I.currentLevel] || 0
1049
1049
  )
1050
1050
  }
1051
1051
  }));
1052
- }, y = () => {
1053
- w(!1), a((g) => {
1054
- const v = Math.max(
1052
+ }, N = () => {
1053
+ C(!1), l((z) => {
1054
+ const E = Math.max(
1055
1055
  Object.values(n).filter(Boolean).length,
1056
- g.levelScores[g.currentLevel] || 0
1057
- ), T = {
1058
- ...g.levelScores,
1059
- [g.currentLevel]: v
1056
+ z.levelScores[z.currentLevel] || 0
1057
+ ), L = {
1058
+ ...z.levelScores,
1059
+ [z.currentLevel]: E
1060
1060
  };
1061
- let N = 0, P = 0;
1062
- const D = Object.entries(T).sort(
1063
- (I, $) => Number(I[0]) - Number($[0])
1061
+ let A = 0, I = 0;
1062
+ const O = Object.entries(L).sort(
1063
+ ($, W) => Number($[0]) - Number(W[0])
1064
1064
  );
1065
- for (const [I, $] of D)
1066
- if ($ < we) {
1067
- N = Number(I), P = M.getTierByLevel(N);
1065
+ for (const [$, W] of O)
1066
+ if (W < we) {
1067
+ A = Number($), I = T.getTierByLevel(A);
1068
1068
  break;
1069
1069
  }
1070
- return (N > 0 && N !== _ || v < we) && j.show(r.notCompleteLevel), (N === 0 || v < we) && t?.(), {
1071
- ...g,
1072
- currentLevel: N || g.currentLevel,
1073
- currentTier: P || g.currentTier,
1074
- levelScores: T
1070
+ return (A > 0 && A !== _ || E < we) && q.show(r.notCompleteLevel), (A === 0 || E < we) && e?.(), {
1071
+ ...z,
1072
+ currentLevel: A || z.currentLevel,
1073
+ currentTier: I || z.currentTier,
1074
+ levelScores: L
1075
1075
  };
1076
1076
  });
1077
1077
  };
1078
- return R(() => {
1079
- const g = document.querySelector(".maze-game-container"), v = (T) => {
1080
- b && ((T.key === " " || T.code === "Space") && g && (g.contains(document.activeElement) || document.activeElement === document.body) && (T.preventDefault(), z ? y() : L()), (T.key === "r" || T.code === "KeyR") && S(), (T.key === "c" || T.code === "KeyC") && E());
1078
+ return x(() => {
1079
+ const z = document.querySelector(".maze-game-container"), E = (L) => {
1080
+ b && ((L.key === " " || L.code === "Space") && z && (z.contains(document.activeElement) || document.activeElement === document.body) && (L.preventDefault(), k ? N() : S()), (L.key === "r" || L.code === "KeyR") && w(), (L.key === "c" || L.code === "KeyC") && y());
1081
1081
  };
1082
- return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
1083
- }, [b, z]), /* @__PURE__ */ m(
1084
- Q,
1082
+ return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
1083
+ }, [b, k]), /* @__PURE__ */ m(
1084
+ te,
1085
1085
  {
1086
1086
  className: "level-complete-dialog",
1087
1087
  isOpen: b,
1088
1088
  title: r.congratulations,
1089
1089
  cancelText: r.retry + " (R)",
1090
- onCancel: S,
1090
+ onCancel: w,
1091
1091
  noConfirm: !!d,
1092
1092
  confirmText: r.continue + " (C)",
1093
- onConfirm: E,
1093
+ onConfirm: y,
1094
1094
  confirmClass: "maze-continue-btn",
1095
1095
  children: [
1096
1096
  /* @__PURE__ */ m("div", { className: "maze-summary-message", children: [
@@ -1098,13 +1098,13 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1098
1098
  /* @__PURE__ */ m("div", { children: u ? "★ - " + r.withoutClue : "☆ - " + r.withClue }),
1099
1099
  /* @__PURE__ */ m("div", { children: (d ? "★ - " + r.collectAllStars : "☆ - " + r.notCollectAllStars) + ` (${h}/${f})` })
1100
1100
  ] }),
1101
- z && /* @__PURE__ */ m("div", { className: "all-levels-completed", children: r.allLevelsCompleted }),
1102
- /* @__PURE__ */ m("div", { className: "maze-go-next", children: z ? /* @__PURE__ */ m(
1101
+ k && /* @__PURE__ */ m("div", { className: "all-levels-completed", children: r.allLevelsCompleted }),
1102
+ /* @__PURE__ */ m("div", { className: "maze-go-next", children: k ? /* @__PURE__ */ m(
1103
1103
  "button",
1104
1104
  {
1105
1105
  className: "maze-go-next-btn",
1106
1106
  type: "button",
1107
- onClick: y,
1107
+ onClick: N,
1108
1108
  children: [
1109
1109
  /* @__PURE__ */ m("span", { children: r.lastOK }),
1110
1110
  /* @__PURE__ */ m("span", { className: "spacebar-tip", children: `(${r.spacebarTip})` })
@@ -1115,7 +1115,7 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1115
1115
  {
1116
1116
  className: "maze-go-next-btn",
1117
1117
  type: "button",
1118
- onClick: L,
1118
+ onClick: S,
1119
1119
  children: [
1120
1120
  /* @__PURE__ */ m("span", { children: r.nextLevel }),
1121
1121
  /* @__PURE__ */ m("span", { className: "spacebar-tip", children: `(${r.spacebarTip})` })
@@ -1126,239 +1126,226 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1126
1126
  ]
1127
1127
  }
1128
1128
  );
1129
- }, ft = (t, e) => {
1130
- const n = O({
1129
+ }, ft = (e, t) => {
1130
+ const n = F({
1131
1131
  canvasWidth: 0,
1132
1132
  canvasHeight: 0
1133
1133
  });
1134
- return R(() => {
1134
+ return x(() => {
1135
1135
  const o = () => {
1136
- const s = t.current;
1136
+ const s = e.current;
1137
1137
  if (!s) return;
1138
- const a = s.parentElement;
1139
- if (!a) return;
1140
- const r = a.clientWidth, l = window.devicePixelRatio || 1;
1138
+ const l = s.parentElement;
1139
+ if (!l) return;
1140
+ const r = l.clientWidth, a = window.devicePixelRatio || 1;
1141
1141
  s.style.width = `${r}px`, s.style.height = `${r}px`;
1142
- const c = r * l, d = r * l;
1143
- s.width = c, s.height = d, n.current = { canvasWidth: c, canvasHeight: d }, e?.();
1142
+ const c = r * a, d = r * a;
1143
+ s.width = c, s.height = d, n.current = { canvasWidth: c, canvasHeight: d }, t?.();
1144
1144
  };
1145
1145
  o();
1146
1146
  let i = null;
1147
- return window.ResizeObserver && t.current && (i = new ResizeObserver(o), i.observe(t.current.parentElement)), window.addEventListener("resize", o), () => {
1147
+ return window.ResizeObserver && e.current && (i = new ResizeObserver(o), i.observe(e.current.parentElement)), window.addEventListener("resize", o), () => {
1148
1148
  window.removeEventListener("resize", o), i?.disconnect();
1149
1149
  };
1150
- }, [t, e]), n;
1151
- }, mt = (t, e, n) => {
1152
- const o = O({ cellWidth: 0, cellHeight: 0 });
1153
- return R(() => {
1150
+ }, [e, t]), n;
1151
+ }, mt = (e, t, n) => {
1152
+ const o = F({ cellWidth: 0, cellHeight: 0 });
1153
+ return x(() => {
1154
1154
  const i = () => {
1155
- const a = t.current, r = e.maze;
1156
- if (!a || !r) return;
1157
- const { rows: l, cols: c } = r;
1158
- if (l <= 0 || c <= 0) return;
1159
- const d = (a.width - n * 2) / c, u = (a.height - n * 2) / l;
1155
+ const l = e.current, r = t.maze;
1156
+ if (!l || !r) return;
1157
+ const { rows: a, cols: c } = r;
1158
+ if (a <= 0 || c <= 0) return;
1159
+ const d = (l.width - n * 2) / c, u = (l.height - n * 2) / a;
1160
1160
  o.current = { cellWidth: d, cellHeight: u };
1161
1161
  };
1162
1162
  i();
1163
1163
  let s = null;
1164
- return t.current && window.ResizeObserver && (s = new ResizeObserver(i), s.observe(t.current)), () => {
1165
- t.current && s?.disconnect();
1164
+ return e.current && window.ResizeObserver && (s = new ResizeObserver(i), s.observe(e.current)), () => {
1165
+ e.current && s?.disconnect();
1166
1166
  };
1167
- }, [t, e.maze, n]), o;
1168
- }, ie = {
1167
+ }, [e, t.maze, n]), o;
1168
+ }, le = {
1169
1169
  ArrowUp: [-1, 0],
1170
1170
  ArrowDown: [1, 0],
1171
1171
  ArrowLeft: [0, -1],
1172
1172
  ArrowRight: [0, 1]
1173
1173
  }, _t = ({
1174
- containerRef: t,
1175
1174
  gamePlayStateRef: e,
1176
- setGamePlayState: n,
1177
- moveSpeed: o,
1175
+ setGamePlayState: t,
1176
+ moveSpeed: n,
1178
1177
  // move X grid units per frame, default 0.03
1179
- moveSpeedRef: i,
1178
+ moveSpeedRef: o,
1180
1179
  // alternative: ref to move speed for dynamic updates
1181
- playerRadius: s,
1180
+ playerRadius: i,
1182
1181
  // player radius in grid unit, default 0.2
1183
- onFoodCollected: a,
1184
- onExitReached: r,
1185
- onFirstMove: l
1182
+ onFoodCollected: s,
1183
+ onExitReached: l,
1184
+ onFirstMove: r
1186
1185
  }) => {
1187
- const c = () => i?.current ?? o ?? 0.03, d = O(!1), u = O(/* @__PURE__ */ new Set()), h = O(!1), f = je(
1188
- (C, z) => {
1189
- const S = e.current;
1190
- if (!S.maze)
1186
+ const a = () => o?.current ?? n ?? 0.03, c = F(!1), d = F(/* @__PURE__ */ new Set()), u = F(!1), h = je(
1187
+ (T, g) => {
1188
+ const k = e.current;
1189
+ if (!k.maze)
1191
1190
  return { canMove: !1, newCell: null };
1192
- const E = c(), [L, y] = ie[C];
1191
+ const w = a(), [y, S] = le[T];
1193
1192
  if (Ke(
1194
- z,
1195
- L,
1193
+ g,
1196
1194
  y,
1197
- s,
1198
- E,
1199
- S.maze
1195
+ S,
1196
+ i,
1197
+ w,
1198
+ k.maze
1200
1199
  ))
1201
1200
  return { canMove: !1, newCell: null };
1202
- const { row: v, col: T } = z, N = v + L * E, P = T + y * E, D = -0.5, I = S.maze.rows, $ = S.maze.cols;
1203
- if (N < D || N >= I || P < D || P >= $)
1201
+ const { row: z, col: E } = g, L = z + y * w, A = E + S * w, I = -0.5, O = k.maze.rows, $ = k.maze.cols;
1202
+ if (L < I || L >= O || A < I || A >= $)
1204
1203
  return { canMove: !1, newCell: null };
1205
- const B = v < 0 ? 0 : Math.floor(v), V = T < 0 ? 0 : Math.floor(T), G = N < 0 ? 0 : Math.floor(N), q = P < 0 ? 0 : Math.floor(P);
1206
- return G !== B || q !== V ? S.maze.isValid(G, q) ? {
1204
+ const W = z < 0 ? 0 : Math.floor(z), K = E < 0 ? 0 : Math.floor(E), D = L < 0 ? 0 : Math.floor(L), U = A < 0 ? 0 : Math.floor(A);
1205
+ return D !== W || U !== K ? k.maze.isValid(D, U) ? {
1207
1206
  canMove: !0,
1208
- newCell: { row: G, col: q }
1207
+ newCell: { row: D, col: U }
1209
1208
  } : { canMove: !1, newCell: null } : { canMove: !0, newCell: null };
1210
1209
  },
1211
- [s, c]
1212
- ), k = () => {
1213
- const C = e.current, { row: z, col: S } = C.playerCell, E = s * 2, L = C.foodCells.findIndex((v) => Math.sqrt(
1214
- Math.pow(z - v.row, 2) + Math.pow(S - v.col, 2)
1215
- ) < E);
1216
- L !== -1 && a && (a(), e.current = {
1210
+ [i, a]
1211
+ ), f = () => {
1212
+ const T = e.current, { row: g, col: k } = T.playerCell, w = i * 2, y = T.foodCells.findIndex((z) => Math.sqrt(
1213
+ Math.pow(g - z.row, 2) + Math.pow(k - z.col, 2)
1214
+ ) < w);
1215
+ y !== -1 && s && (s(), e.current = {
1217
1216
  ...e.current,
1218
1217
  foodCollected: e.current.foodCollected + 1,
1219
1218
  foodCells: e.current.foodCells.filter(
1220
- (v, T) => T !== L
1219
+ (z, E) => E !== y
1221
1220
  )
1222
1221
  });
1223
- const g = mn(
1224
- C.playerCell,
1225
- C.exitCell,
1226
- C.maze
1222
+ const N = fn(
1223
+ T.playerCell,
1224
+ T.exitCell,
1225
+ T.maze
1227
1226
  );
1228
- g && !e.current.playerAtExit ? (e.current = {
1227
+ N && !e.current.playerAtExit ? (e.current = {
1229
1228
  ...e.current,
1230
1229
  playerAtExit: !0,
1231
1230
  isGameActive: !1,
1232
1231
  // pause render loop and controls
1233
1232
  levelTransitioning: !0
1234
- }, r && r(), requestIdleCallback(
1233
+ }, l && l(), requestIdleCallback(
1235
1234
  () => {
1236
- n(() => ({ ...e.current }));
1235
+ t(() => ({ ...e.current }));
1237
1236
  },
1238
1237
  { timeout: 10 }
1239
- )) : !g && e.current.playerAtExit && (e.current = {
1238
+ )) : !N && e.current.playerAtExit && (e.current = {
1240
1239
  ...e.current,
1241
1240
  playerAtExit: !1,
1242
1241
  isGameActive: !0,
1243
1242
  levelTransitioning: !1
1244
1243
  });
1245
- }, p = (C) => {
1246
- const z = e.current, S = Math.round(C.row), E = Math.round(C.col), L = z.playerPath[z.playerPath.length - 1], y = L.row === S && L.col === E, g = Math.abs(L.row - S), v = Math.abs(L.col - E);
1247
- if ((g === 1 && v === 0 || g === 0 && v === 1) && !y) {
1248
- const N = `${L.row},${L.col}-${S},${E}`;
1244
+ }, p = (T) => {
1245
+ const g = e.current, k = Math.round(T.row), w = Math.round(T.col), y = g.playerPath[g.playerPath.length - 1], S = y.row === k && y.col === w, N = Math.abs(y.row - k), z = Math.abs(y.col - w);
1246
+ if ((N === 1 && z === 0 || N === 0 && z === 1) && !S) {
1247
+ const L = `${y.row},${y.col}-${k},${w}`;
1249
1248
  e.current = {
1250
1249
  ...e.current,
1251
1250
  playerPath: [
1252
1251
  ...e.current.playerPath,
1253
- { row: S, col: E }
1252
+ { row: k, col: w }
1254
1253
  ],
1255
1254
  visitCounts: {
1256
1255
  ...e.current.visitCounts,
1257
- [N]: (e.current.visitCounts[N] || 0) + 1
1256
+ [L]: (e.current.visitCounts[L] || 0) + 1
1258
1257
  }
1259
1258
  };
1260
1259
  }
1261
- }, _ = () => {
1262
- if (d.current || u.current.size === 0) return;
1263
- const C = e.current;
1264
- !C.playerCell || !Array.from(u.current).some(
1265
- (S) => {
1266
- const { canMove: E } = f(
1267
- S,
1268
- C.playerCell
1260
+ }, v = () => {
1261
+ if (c.current || d.current.size === 0) return;
1262
+ const T = e.current;
1263
+ !T.playerCell || !Array.from(d.current).some(
1264
+ (k) => {
1265
+ const { canMove: w } = h(
1266
+ k,
1267
+ T.playerCell
1269
1268
  );
1270
- return E;
1269
+ return w;
1271
1270
  }
1272
- ) || (!h.current && l && (h.current = !0, l()), d.current = !0);
1271
+ ) || (!u.current && r && (u.current = !0, r()), c.current = !0);
1273
1272
  };
1274
- R(() => {
1275
- const C = (y) => {
1276
- if (y.key === "ArrowUp" || y.key === "ArrowDown" || y.key === "ArrowLeft" || y.key === "ArrowRight" || y.key === " ") {
1277
- const g = document.activeElement;
1278
- if (g && (g.tagName === "INPUT" || g.tagName === "TEXTAREA" || g.getAttribute("contenteditable") === "true")) return;
1279
- y.preventDefault();
1273
+ x(() => {
1274
+ const T = (w) => {
1275
+ if (w.key === "ArrowUp" || w.key === "ArrowDown" || w.key === "ArrowLeft" || w.key === "ArrowRight" || w.key === " ") {
1276
+ const y = document.activeElement;
1277
+ if (y && (y.tagName === "INPUT" || y.tagName === "TEXTAREA" || y.getAttribute("contenteditable") === "true")) return;
1278
+ w.preventDefault();
1280
1279
  }
1281
- }, z = (y) => {
1282
- const g = y.key;
1283
- if (!(g in ie)) return;
1284
- const v = document.activeElement;
1285
- v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.getAttribute("contenteditable") === "true") || (y.preventDefault(), e.current.isGameActive && (u.current.has(g) || (u.current.add(g), d.current || _())));
1286
- }, S = (y) => {
1287
- const g = y.key;
1288
- if (!(g in ie)) return;
1289
- const v = document.activeElement;
1290
- v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.getAttribute("contenteditable") === "true") || (y.preventDefault(), u.current.delete(g), u.current.size === 0 && w());
1291
- }, E = (y) => {
1292
- y.preventDefault();
1293
- const g = e.current;
1294
- if (!g.isGameActive || !g.maze || d.current)
1295
- return;
1296
- const v = y.touches[0], T = document.elementFromPoint(v.clientX, v.clientY);
1297
- let N = null;
1298
- T && (T.classList.contains("maze-up") ? N = "ArrowUp" : T.classList.contains("maze-down") ? N = "ArrowDown" : T.classList.contains("maze-left") ? N = "ArrowLeft" : T.classList.contains("maze-right") && (N = "ArrowRight")), N && (u.current.clear(), u.current.add(N), _());
1299
- }, L = () => {
1300
- w();
1280
+ }, g = (w) => {
1281
+ const y = w.key;
1282
+ if (!(y in le)) return;
1283
+ const S = document.activeElement;
1284
+ S && (S.tagName === "INPUT" || S.tagName === "TEXTAREA" || S.getAttribute("contenteditable") === "true") || (w.preventDefault(), e.current.isGameActive && (d.current.has(y) || (d.current.add(y), c.current || v())));
1285
+ }, k = (w) => {
1286
+ const y = w.key;
1287
+ if (!(y in le)) return;
1288
+ const S = document.activeElement;
1289
+ S && (S.tagName === "INPUT" || S.tagName === "TEXTAREA" || S.getAttribute("contenteditable") === "true") || (w.preventDefault(), d.current.delete(y), d.current.size === 0 && b());
1301
1290
  };
1302
- return window.addEventListener("keydown", C, {
1291
+ return window.addEventListener("keydown", T, {
1303
1292
  capture: !0
1304
- }), window.addEventListener("keydown", z), window.addEventListener("keyup", S), t.current?.addEventListener("touchstart", E, {
1305
- passive: !1
1306
- }), t.current?.addEventListener("touchend", L), () => {
1307
- window.removeEventListener("keydown", C, {
1293
+ }), window.addEventListener("keydown", g), window.addEventListener("keyup", k), () => {
1294
+ window.removeEventListener("keydown", T, {
1308
1295
  capture: !0
1309
- }), window.removeEventListener("keydown", z), window.removeEventListener("keyup", S), t.current?.removeEventListener("touchstart", E), t.current?.removeEventListener("touchend", L);
1296
+ }), window.removeEventListener("keydown", g), window.removeEventListener("keyup", k);
1310
1297
  };
1311
1298
  }, []);
1312
- const b = je(() => {
1313
- if (!d.current || u.current.size === 0)
1299
+ const _ = je(() => {
1300
+ if (!c.current || d.current.size === 0)
1314
1301
  return e.current.playerCell;
1315
- const C = c(), z = e.current.playerCell;
1316
- let S = 0, E = 0, L = 0;
1317
- for (const Y of u.current) {
1318
- const { canMove: ge } = f(Y, z);
1319
- if (ge) {
1320
- const [Ae, yt] = ie[Y];
1321
- S += Ae, E += yt, L++;
1302
+ const T = a(), g = e.current.playerCell;
1303
+ let k = 0, w = 0, y = 0;
1304
+ for (const H of d.current) {
1305
+ const { canMove: J } = h(H, g);
1306
+ if (J) {
1307
+ const [V, X] = le[H];
1308
+ k += V, w += X, y++;
1322
1309
  }
1323
1310
  }
1324
- if (L === 0)
1311
+ if (y === 0)
1325
1312
  return e.current.playerCell;
1326
- const y = Math.sqrt(S * S + E * E), g = y > 0 ? S / y : 0, v = y > 0 ? E / y : 0, T = Number(
1327
- (z.row + g * C).toFixed(2)
1328
- ), N = Number(
1329
- (z.col + v * C).toFixed(2)
1330
- ), P = T - z.row, D = N - z.col, I = Math.sqrt(P * P + D * D);
1331
- if (I > 0) {
1332
- const Y = P / I, ge = D / I;
1313
+ const S = Math.sqrt(k * k + w * w), N = S > 0 ? k / S : 0, z = S > 0 ? w / S : 0, E = Number(
1314
+ (g.row + N * T).toFixed(2)
1315
+ ), L = Number(
1316
+ (g.col + z * T).toFixed(2)
1317
+ ), A = E - g.row, I = L - g.col, O = Math.sqrt(A * A + I * I);
1318
+ if (O > 0) {
1319
+ const H = A / O, J = I / O;
1333
1320
  if (Ke(
1334
- z,
1335
- Y,
1336
- ge,
1337
- s,
1338
- I,
1321
+ g,
1322
+ H,
1323
+ J,
1324
+ i,
1325
+ O,
1339
1326
  e.current.maze
1340
1327
  ))
1341
1328
  return e.current.playerCell;
1342
1329
  }
1343
1330
  e.current.playerCell = {
1344
- row: T,
1345
- col: N
1346
- }, k();
1347
- const $ = z.row < 0 ? 0 : Math.round(z.row), B = z.col < 0 ? 0 : Math.round(z.col), V = T < 0 ? 0 : Math.round(T), G = N < 0 ? 0 : Math.round(N);
1348
- return (V !== $ || G !== B) && p({ row: V, col: G }), e.current.playerCell;
1349
- }, [c, f]), w = () => {
1350
- d.current = !1, u.current.clear();
1331
+ row: E,
1332
+ col: L
1333
+ }, f();
1334
+ const $ = g.row < 0 ? 0 : Math.round(g.row), W = g.col < 0 ? 0 : Math.round(g.col), K = E < 0 ? 0 : Math.round(E), D = L < 0 ? 0 : Math.round(L);
1335
+ return (K !== $ || D !== W) && p({ row: K, col: D }), e.current.playerCell;
1336
+ }, [a, h]), b = () => {
1337
+ c.current = !1, d.current.clear();
1351
1338
  };
1352
1339
  return {
1353
- updatePlayerPos: b,
1354
- resetMovingState: w,
1340
+ updatePlayerPos: _,
1341
+ resetMovingState: b,
1355
1342
  resetFirstMoveState: () => {
1356
- h.current = !1;
1343
+ u.current = !1;
1357
1344
  }
1358
1345
  };
1359
1346
  };
1360
- function Ke(t, e, n, o, i, s) {
1361
- const a = t.row + e * i, r = t.col + n * i, l = { row: a, col: r }, c = [], d = t.row < 0 ? 0 : Math.floor(t.row), u = t.col < 0 ? 0 : Math.floor(t.col);
1347
+ function Ke(e, t, n, o, i, s) {
1348
+ const l = e.row + t * i, r = e.col + n * i, a = { row: l, col: r }, c = [], d = e.row < 0 ? 0 : Math.floor(e.row), u = e.col < 0 ? 0 : Math.floor(e.col);
1362
1349
  c.push({ row: d, col: u });
1363
1350
  const h = [
1364
1351
  [-1, 0],
@@ -1378,278 +1365,278 @@ function Ke(t, e, n, o, i, s) {
1378
1365
  [1, 1]
1379
1366
  // lower right, diagonal
1380
1367
  ];
1381
- for (const [f, k] of h) {
1382
- const p = d + f, _ = u + k;
1383
- s.isValid(p, _) && c.push({ row: p, col: _ });
1368
+ for (const [f, p] of h) {
1369
+ const v = d + f, _ = u + p;
1370
+ s.isValid(v, _) && c.push({ row: v, col: _ });
1384
1371
  }
1385
1372
  for (const f of c) {
1386
- const k = hn(f.row, f.col, s);
1387
- for (const p of k)
1388
- if (fn(l, p) < o)
1373
+ const p = dn(f.row, f.col, s);
1374
+ for (const v of p)
1375
+ if (hn(a, v) < o)
1389
1376
  return !0;
1390
1377
  }
1391
1378
  return !1;
1392
1379
  }
1393
- function hn(t, e, n) {
1394
- const o = [], i = n.grid[t][e];
1380
+ function dn(e, t, n) {
1381
+ const o = [], i = n.grid[e][t];
1395
1382
  return i.walls.top && o.push({
1396
- start: { row: t - 0.5, col: e - 0.5 },
1397
- end: { row: t - 0.5, col: e + 0.5 }
1383
+ start: { row: e - 0.5, col: t - 0.5 },
1384
+ end: { row: e - 0.5, col: t + 0.5 }
1398
1385
  }), i.walls.right && o.push({
1399
- start: { row: t - 0.5, col: e + 0.5 },
1400
- end: { row: t + 0.5, col: e + 0.5 }
1386
+ start: { row: e - 0.5, col: t + 0.5 },
1387
+ end: { row: e + 0.5, col: t + 0.5 }
1401
1388
  }), i.walls.bottom && o.push({
1402
- start: { row: t + 0.5, col: e - 0.5 },
1403
- end: { row: t + 0.5, col: e + 0.5 }
1389
+ start: { row: e + 0.5, col: t - 0.5 },
1390
+ end: { row: e + 0.5, col: t + 0.5 }
1404
1391
  }), i.walls.left && o.push({
1405
- start: { row: t - 0.5, col: e - 0.5 },
1406
- end: { row: t + 0.5, col: e - 0.5 }
1392
+ start: { row: e - 0.5, col: t - 0.5 },
1393
+ end: { row: e + 0.5, col: t - 0.5 }
1407
1394
  }), o;
1408
1395
  }
1409
- function fn(t, e) {
1410
- const { start: n, end: o } = e, i = o.col - n.col, s = o.row - n.row, a = t.col - n.col, r = t.row - n.row, l = i * i + s * s;
1411
- if (l === 0)
1412
- return Math.sqrt(a * a + r * r);
1396
+ function hn(e, t) {
1397
+ const { start: n, end: o } = t, i = o.col - n.col, s = o.row - n.row, l = e.col - n.col, r = e.row - n.row, a = i * i + s * s;
1398
+ if (a === 0)
1399
+ return Math.sqrt(l * l + r * r);
1413
1400
  const c = Math.max(
1414
1401
  0,
1415
1402
  Math.min(
1416
1403
  1,
1417
- (a * i + r * s) / l
1404
+ (l * i + r * s) / a
1418
1405
  )
1419
- ), d = n.col + c * i, u = n.row + c * s, h = t.col - d, f = t.row - u;
1406
+ ), d = n.col + c * i, u = n.row + c * s, h = e.col - d, f = e.row - u;
1420
1407
  return Math.sqrt(h * h + f * f);
1421
1408
  }
1422
- function mn(t, e, n) {
1423
- if (!n.isValid(e.row, e.col)) return !1;
1424
- const o = t.col >= e.col - 0.5 && t.col <= e.col + 0.5, i = t.row >= e.row + 0.5, s = t.row >= e.row - 0.5;
1409
+ function fn(e, t, n) {
1410
+ if (!n.isValid(t.row, t.col)) return !1;
1411
+ const o = e.col >= t.col - 0.5 && e.col <= t.col + 0.5, i = e.row >= t.row + 0.5, s = e.row >= t.row - 0.5;
1425
1412
  return o && i && s;
1426
1413
  }
1427
- function vt(t, e, n, o, i) {
1428
- if (!t || !e.maze) return;
1429
- const { canvasWidth: s, canvasHeight: a } = n, { cellWidth: r, cellHeight: l } = o, {
1414
+ function vt(e, t, n, o, i) {
1415
+ if (!e || !t.maze) return;
1416
+ const { canvasWidth: s, canvasHeight: l } = n, { cellWidth: r, cellHeight: a } = o, {
1430
1417
  maze: c,
1431
1418
  playerCell: d,
1432
1419
  // row, col, but floating allowed
1433
1420
  exitCell: u,
1434
1421
  foodCells: h,
1435
1422
  showClue: f,
1436
- playerPath: k,
1437
- visitCounts: p
1438
- } = e, {
1423
+ playerPath: p,
1424
+ visitCounts: v
1425
+ } = t, {
1439
1426
  padding: _,
1440
1427
  wallWidth: b,
1441
1428
  // need merge with level config when passed here
1442
- wallColor: w,
1443
- playerColor: M,
1444
- playerRadius: C,
1445
- foodColor: z,
1446
- backgroundColor: S,
1447
- clueColor: E,
1448
- exitColor: L,
1449
- exitWallWidth: y,
1450
- exitDashArray: g
1429
+ wallColor: C,
1430
+ playerColor: T,
1431
+ playerRadius: g,
1432
+ foodColor: k,
1433
+ backgroundColor: w,
1434
+ clueColor: y,
1435
+ exitColor: S,
1436
+ exitWallWidth: N,
1437
+ exitDashArray: z
1451
1438
  } = i;
1452
- t.clearRect(0, 0, s, a), t.save(), t.fillStyle = S, t.fillRect(0, 0, s, a), t.restore(), f && Cn({
1453
- ctx: t,
1454
- playerPath: k,
1455
- visitCounts: p,
1439
+ e.clearRect(0, 0, s, l), e.save(), e.fillStyle = w, e.fillRect(0, 0, s, l), e.restore(), f && Cn({
1440
+ ctx: e,
1441
+ playerPath: p,
1442
+ visitCounts: v,
1456
1443
  cellWidth: r,
1457
- cellHeight: l,
1444
+ cellHeight: a,
1458
1445
  padding: _,
1459
- clueColor: E
1460
- }), _n({
1461
- ctx: t,
1446
+ clueColor: y
1447
+ }), mn({
1448
+ ctx: e,
1462
1449
  maze: c,
1463
1450
  cellWidth: r,
1464
- cellHeight: l,
1451
+ cellHeight: a,
1465
1452
  padding: _,
1466
- wallColor: w,
1453
+ wallColor: C,
1467
1454
  wallWidth: b
1468
- }), gn({
1469
- ctx: t,
1455
+ }), vn({
1456
+ ctx: e,
1470
1457
  maze: c,
1471
1458
  exitCell: u,
1472
1459
  cellWidth: r,
1473
- cellHeight: l,
1460
+ cellHeight: a,
1474
1461
  padding: _,
1475
- exitColor: L,
1476
- exitWallWidth: y,
1477
- exitDashArray: g
1478
- }), pn({
1479
- ctx: t,
1462
+ exitColor: S,
1463
+ exitWallWidth: N,
1464
+ exitDashArray: z
1465
+ }), gn({
1466
+ ctx: e,
1480
1467
  foodCells: h,
1481
1468
  cellWidth: r,
1482
- cellHeight: l,
1469
+ cellHeight: a,
1483
1470
  padding: _,
1484
- foodColor: z
1485
- }), vn({
1486
- ctx: t,
1471
+ foodColor: k
1472
+ }), _n({
1473
+ ctx: e,
1487
1474
  playerCell: d,
1488
- playerRadius: C,
1475
+ playerRadius: g,
1489
1476
  cellWidth: r,
1490
- cellHeight: l,
1477
+ cellHeight: a,
1491
1478
  padding: _,
1492
- playerColor: M
1479
+ playerColor: T
1493
1480
  });
1494
1481
  }
1495
- function _n({
1496
- ctx: t,
1497
- maze: e,
1482
+ function mn({
1483
+ ctx: e,
1484
+ maze: t,
1498
1485
  cellWidth: n,
1499
1486
  cellHeight: o,
1500
1487
  padding: i,
1501
1488
  wallColor: s,
1502
- wallWidth: a
1489
+ wallWidth: l
1503
1490
  }) {
1504
- t.save(), t.strokeStyle = s, t.lineWidth = a, t.lineCap = "round", t.beginPath(), yn(e, n, o, i).forEach((l) => {
1505
- t.moveTo(l.x1, l.y1), t.lineTo(l.x2, l.y2);
1506
- }), t.stroke(), t.restore();
1491
+ e.save(), e.strokeStyle = s, e.lineWidth = l, e.lineCap = "round", e.beginPath(), wn(t, n, o, i).forEach((a) => {
1492
+ e.moveTo(a.x1, a.y1), e.lineTo(a.x2, a.y2);
1493
+ }), e.stroke(), e.restore();
1507
1494
  }
1508
- function vn({
1509
- ctx: t,
1510
- playerCell: e,
1495
+ function _n({
1496
+ ctx: e,
1497
+ playerCell: t,
1511
1498
  playerRadius: n,
1512
1499
  cellWidth: o,
1513
1500
  cellHeight: i,
1514
1501
  padding: s,
1515
- playerColor: a
1502
+ playerColor: l
1516
1503
  }) {
1517
- const { x: r, y: l } = he(
1518
- e.row,
1519
- e.col,
1504
+ const { x: r, y: a } = me(
1505
+ t.row,
1506
+ t.col,
1520
1507
  o,
1521
1508
  i,
1522
1509
  s
1523
1510
  ), c = Math.min(o, i) * Math.min(n, 0.5);
1524
- t.save(), t.fillStyle = a, t.beginPath(), t.arc(r, l, c, 0, Math.PI * 2), t.fill(), t.restore();
1511
+ e.save(), e.fillStyle = l, e.beginPath(), e.arc(r, a, c, 0, Math.PI * 2), e.fill(), e.restore();
1525
1512
  }
1526
- function gn({
1527
- ctx: t,
1528
- maze: e,
1513
+ function vn({
1514
+ ctx: e,
1515
+ maze: t,
1529
1516
  exitCell: n,
1530
1517
  cellWidth: o,
1531
1518
  cellHeight: i,
1532
1519
  padding: s,
1533
- exitColor: a,
1520
+ exitColor: l,
1534
1521
  exitWallWidth: r,
1535
- exitDashArray: l = [8, 12]
1522
+ exitDashArray: a = [8, 12]
1536
1523
  }) {
1537
1524
  const { row: c, col: d } = n;
1538
- if (!e.isValid(c, d)) return;
1525
+ if (!t.isValid(c, d)) return;
1539
1526
  const u = s + d * o, h = s + c * i;
1540
- t.save(), t.globalCompositeOperation = "destination-out", t.lineWidth = r, t.lineCap = "round", t.beginPath(), t.moveTo(u, h + i), t.lineTo(u + o, h + i), t.stroke(), t.globalCompositeOperation = "source-over", t.strokeStyle = a, t.lineWidth = r, t.setLineDash(l), t.beginPath(), t.moveTo(u, h + i), t.lineTo(u + o, h + i), t.stroke(), t.restore();
1527
+ e.save(), e.globalCompositeOperation = "destination-out", e.lineWidth = r, e.lineCap = "round", e.beginPath(), e.moveTo(u, h + i), e.lineTo(u + o, h + i), e.stroke(), e.globalCompositeOperation = "source-over", e.strokeStyle = l, e.lineWidth = r, e.setLineDash(a), e.beginPath(), e.moveTo(u, h + i), e.lineTo(u + o, h + i), e.stroke(), e.restore();
1541
1528
  }
1542
- function pn({
1543
- ctx: t,
1544
- foodCells: e,
1529
+ function gn({
1530
+ ctx: e,
1531
+ foodCells: t,
1545
1532
  cellWidth: n,
1546
1533
  cellHeight: o,
1547
1534
  padding: i,
1548
1535
  foodColor: s
1549
1536
  }) {
1550
- t.fillStyle = s;
1551
- const a = Math.min(n, o) * 0.25;
1552
- e.forEach((r) => {
1553
- const { x: l, y: c } = he(
1537
+ e.fillStyle = s;
1538
+ const l = Math.min(n, o) * 0.25;
1539
+ t.forEach((r) => {
1540
+ const { x: a, y: c } = me(
1554
1541
  r.row,
1555
1542
  r.col,
1556
1543
  n,
1557
1544
  o,
1558
1545
  i
1559
1546
  );
1560
- wn(t, l, c, a * 1.2, 5, a * 0.6);
1547
+ pn(e, a, c, l * 1.2, 5, l * 0.6);
1561
1548
  });
1562
1549
  }
1563
- function wn(t, e, n, o, i, s) {
1564
- t.save(), t.beginPath();
1565
- for (let a = 0; a < i * 2; a++) {
1566
- const r = a % 2 === 0 ? o : s, l = Math.PI * a / i;
1567
- t.lineTo(e + r * Math.sin(l), n + r * Math.cos(l));
1550
+ function pn(e, t, n, o, i, s) {
1551
+ e.save(), e.beginPath();
1552
+ for (let l = 0; l < i * 2; l++) {
1553
+ const r = l % 2 === 0 ? o : s, a = Math.PI * l / i;
1554
+ e.lineTo(t + r * Math.sin(a), n + r * Math.cos(a));
1568
1555
  }
1569
- t.closePath(), t.fill(), t.restore();
1556
+ e.closePath(), e.fill(), e.restore();
1570
1557
  }
1571
1558
  function Cn({
1572
- ctx: t,
1573
- playerPath: e,
1559
+ ctx: e,
1560
+ playerPath: t,
1574
1561
  visitCounts: n,
1575
1562
  cellWidth: o,
1576
1563
  cellHeight: i,
1577
1564
  padding: s,
1578
- clueColor: a
1565
+ clueColor: l
1579
1566
  }) {
1580
- if (!(!e || e.length < 2 || !n)) {
1581
- t.save();
1582
- for (let r = 1; r < e.length; r++) {
1583
- const l = e[r - 1], c = e[r], d = `${l.row},${l.col}-${c.row},${c.col}`, u = `${c.row},${c.col}-${l.row},${l.col}`, h = (n[d] || 0) + (n[u] || 0), f = Math.min(0.2 + h * 0.1, 0.9), k = Math.max(3, o * 0.1) + h * 0.5;
1567
+ if (!(!t || t.length < 2 || !n)) {
1568
+ e.save();
1569
+ for (let r = 1; r < t.length; r++) {
1570
+ const a = t[r - 1], c = t[r], d = `${a.row},${a.col}-${c.row},${c.col}`, u = `${c.row},${c.col}-${a.row},${a.col}`, h = (n[d] || 0) + (n[u] || 0), f = Math.min(0.2 + h * 0.1, 0.9), p = Math.max(3, o * 0.1) + h * 0.5;
1584
1571
  try {
1585
- t.strokeStyle = a.replace(")", `, ${f})`).replace("rgb(", "rgba(");
1572
+ e.strokeStyle = l.replace(")", `, ${f})`).replace("rgb(", "rgba(");
1586
1573
  } catch {
1587
- t.strokeStyle = `rgba(255, 0, 0, ${f})`;
1574
+ e.strokeStyle = `rgba(255, 0, 0, ${f})`;
1588
1575
  }
1589
- t.lineWidth = k, t.lineCap = "round", t.lineJoin = "round";
1590
- const { x: p, y: _ } = he(
1591
- l.row,
1592
- l.col,
1576
+ e.lineWidth = p, e.lineCap = "round", e.lineJoin = "round";
1577
+ const { x: v, y: _ } = me(
1578
+ a.row,
1579
+ a.col,
1593
1580
  o,
1594
1581
  i,
1595
1582
  s
1596
- ), { x: b, y: w } = he(
1583
+ ), { x: b, y: C } = me(
1597
1584
  c.row,
1598
1585
  c.col,
1599
1586
  o,
1600
1587
  i,
1601
1588
  s
1602
1589
  );
1603
- t.beginPath(), t.moveTo(p, _), t.lineTo(b, w), t.stroke();
1590
+ e.beginPath(), e.moveTo(v, _), e.lineTo(b, C), e.stroke();
1604
1591
  }
1605
- t.restore();
1592
+ e.restore();
1606
1593
  }
1607
1594
  }
1608
- function yn(t, e, n, o) {
1595
+ function wn(e, t, n, o) {
1609
1596
  const i = [];
1610
- for (let s = 0; s < t.rows; s++)
1611
- for (let a = 0; a < t.cols; a++) {
1612
- const r = t.grid[s][a], l = o + a * e, c = o + s * n;
1597
+ for (let s = 0; s < e.rows; s++)
1598
+ for (let l = 0; l < e.cols; l++) {
1599
+ const r = e.grid[s][l], a = o + l * t, c = o + s * n;
1613
1600
  r.walls.top && i.push({
1614
- x1: l,
1601
+ x1: a,
1615
1602
  y1: c,
1616
- x2: l + e,
1603
+ x2: a + t,
1617
1604
  y2: c
1618
1605
  }), r.walls.right && i.push({
1619
- x1: l + e,
1606
+ x1: a + t,
1620
1607
  y1: c,
1621
- x2: l + e,
1608
+ x2: a + t,
1622
1609
  y2: c + n
1623
1610
  }), r.walls.bottom && i.push({
1624
- x1: l,
1611
+ x1: a,
1625
1612
  y1: c + n,
1626
- x2: l + e,
1613
+ x2: a + t,
1627
1614
  y2: c + n
1628
1615
  }), r.walls.left && i.push({
1629
- x1: l,
1616
+ x1: a,
1630
1617
  y1: c,
1631
- x2: l,
1618
+ x2: a,
1632
1619
  y2: c + n
1633
1620
  });
1634
1621
  }
1635
1622
  return i;
1636
1623
  }
1637
- function he(t, e, n, o, i) {
1624
+ function me(e, t, n, o, i) {
1638
1625
  return {
1639
- x: i + e * n + n / 2,
1640
- y: i + t * o + o / 2
1626
+ x: i + t * n + n / 2,
1627
+ y: i + e * o + o / 2
1641
1628
  };
1642
1629
  }
1643
- function bn(t) {
1630
+ function yn(e) {
1644
1631
  return function() {
1645
- let e = t += 1831565813;
1646
- return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
1632
+ let t = e += 1831565813;
1633
+ return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
1647
1634
  };
1648
1635
  }
1649
- class Tn {
1636
+ class bn {
1650
1637
  // initially all walls exit
1651
- constructor(e, n) {
1652
- this.row = e, this.col = n;
1638
+ constructor(t, n) {
1639
+ this.row = t, this.col = n;
1653
1640
  }
1654
1641
  visited = !1;
1655
1642
  walls = { top: !0, right: !0, bottom: !0, left: !0 };
@@ -1670,25 +1657,25 @@ class gt {
1670
1657
  * @param entry Optional entry cell position
1671
1658
  * @param exit Optional exit cell position
1672
1659
  */
1673
- constructor(e, n, o, i, s = { row: 0, col: 0 }, a = { row: e - 1, col: n - 1 }) {
1674
- this.rows = e, this.cols = n, this.seed = i ?? Math.floor(Math.random() * 1e6), this.random = bn(this.seed), this.grid = this.initializeGrid(), this.generate(o, s, a);
1660
+ constructor(t, n, o, i, s = { row: 0, col: 0 }, l = { row: t - 1, col: n - 1 }) {
1661
+ this.rows = t, this.cols = n, this.seed = i ?? Math.floor(Math.random() * 1e6), this.random = yn(this.seed), this.grid = this.initializeGrid(), this.generate(o, s, l);
1675
1662
  }
1676
1663
  // Initialize the grid with new MazeCell objects
1677
1664
  initializeGrid() {
1678
- const e = [];
1665
+ const t = [];
1679
1666
  for (let n = 0; n < this.rows; n++) {
1680
- e[n] = [];
1667
+ t[n] = [];
1681
1668
  for (let o = 0; o < this.cols; o++)
1682
- e[n][o] = new Tn(n, o);
1669
+ t[n][o] = new bn(n, o);
1683
1670
  }
1684
- return e;
1671
+ return t;
1685
1672
  }
1686
1673
  // Check if coordinates are within the grid boundaries
1687
- isValid(e, n) {
1688
- return e >= 0 && e < this.rows && n >= 0 && n < this.cols;
1674
+ isValid(t, n) {
1675
+ return t >= 0 && t < this.rows && n >= 0 && n < this.cols;
1689
1676
  }
1690
1677
  // Get all valid neighbors (top, right, bottom, left)
1691
- getNeighbors(e, n) {
1678
+ getNeighbors(t, n) {
1692
1679
  const o = [], i = [
1693
1680
  { r: -1, c: 0 },
1694
1681
  // Top
@@ -1700,29 +1687,29 @@ class gt {
1700
1687
  // Left
1701
1688
  ];
1702
1689
  for (const s of i) {
1703
- const a = e + s.r, r = n + s.c;
1704
- this.isValid(a, r) && o.push({ row: a, col: r });
1690
+ const l = t + s.r, r = n + s.c;
1691
+ this.isValid(l, r) && o.push({ row: l, col: r });
1705
1692
  }
1706
1693
  return o;
1707
1694
  }
1708
1695
  // Get only neighbors that haven't been visited yet
1709
- getUnvisitedNeighbors(e, n) {
1710
- return this.getNeighbors(e, n).filter(
1696
+ getUnvisitedNeighbors(t, n) {
1697
+ return this.getNeighbors(t, n).filter(
1711
1698
  (o) => !this.grid[o.row][o.col].visited
1712
1699
  );
1713
1700
  }
1714
1701
  /**
1715
1702
  * Gets neighbors that have already been visited (part of the maze path).
1716
1703
  */
1717
- getVisitedNeighbors(e, n) {
1718
- return this.getNeighbors(e, n).filter(
1704
+ getVisitedNeighbors(t, n) {
1705
+ return this.getNeighbors(t, n).filter(
1719
1706
  (o) => this.grid[o.row][o.col].visited
1720
1707
  );
1721
1708
  }
1722
1709
  // Remove the wall between two adjacent cells
1723
- removeWall(e, n, o, i) {
1724
- const s = this.grid[e][n], a = this.grid[o][i];
1725
- e === o + 1 ? (s.walls.top = !1, a.walls.bottom = !1) : e === o - 1 ? (s.walls.bottom = !1, a.walls.top = !1) : n === i + 1 ? (s.walls.left = !1, a.walls.right = !1) : n === i - 1 && (s.walls.right = !1, a.walls.left = !1);
1710
+ removeWall(t, n, o, i) {
1711
+ const s = this.grid[t][n], l = this.grid[o][i];
1712
+ t === o + 1 ? (s.walls.top = !1, l.walls.bottom = !1) : t === o - 1 ? (s.walls.bottom = !1, l.walls.top = !1) : n === i + 1 ? (s.walls.left = !1, l.walls.right = !1) : n === i - 1 && (s.walls.right = !1, l.walls.left = !1);
1726
1713
  }
1727
1714
  // --- Generation Methods ---
1728
1715
  /**
@@ -1732,8 +1719,8 @@ class gt {
1732
1719
  * @param entry The entry cell position
1733
1720
  * @param exit The exit cell position
1734
1721
  */
1735
- generate(e, n = { row: 0, col: 0 }, o = { row: this.rows - 1, col: this.cols - 1 }) {
1736
- switch (e) {
1722
+ generate(t, n = { row: 0, col: 0 }, o = { row: this.rows - 1, col: this.cols - 1 }) {
1723
+ switch (t) {
1737
1724
  case "backtracking":
1738
1725
  this.generateWithBacktracking();
1739
1726
  break;
@@ -1741,82 +1728,82 @@ class gt {
1741
1728
  this.generateWithPrims();
1742
1729
  break;
1743
1730
  default:
1744
- throw new Error(`Unknown maze generation method: ${e}`);
1731
+ throw new Error(`Unknown maze generation method: ${t}`);
1745
1732
  }
1746
1733
  this.addOpenings(n, o);
1747
1734
  }
1748
1735
  // --- Backtracking Algorithm Implementation ---
1749
1736
  generateWithBacktracking() {
1750
- const e = [], n = this.randomNumber(this.rows), o = this.randomNumber(this.cols);
1737
+ const t = [], n = this.randomNumber(this.rows), o = this.randomNumber(this.cols);
1751
1738
  let i = { row: n, col: o };
1752
- for (this.grid[n][o].visited = !0, e.push(i); e.length > 0; ) {
1753
- i = e[e.length - 1];
1754
- const { row: s, col: a } = i, r = this.getUnvisitedNeighbors(s, a);
1739
+ for (this.grid[n][o].visited = !0, t.push(i); t.length > 0; ) {
1740
+ i = t[t.length - 1];
1741
+ const { row: s, col: l } = i, r = this.getUnvisitedNeighbors(s, l);
1755
1742
  if (r.length > 0) {
1756
- const l = this.randomPick(r), { row: c, col: d } = l;
1757
- this.removeWall(s, a, c, d), this.grid[c][d].visited = !0, e.push(l);
1743
+ const a = this.randomPick(r), { row: c, col: d } = a;
1744
+ this.removeWall(s, l, c, d), this.grid[c][d].visited = !0, t.push(a);
1758
1745
  } else
1759
- e.pop();
1746
+ t.pop();
1760
1747
  }
1761
1748
  }
1762
1749
  // --- Prim's Algorithm Implementation ---
1763
1750
  generateWithPrims() {
1764
- const e = [], n = (s, a) => {
1765
- const r = this.getNeighbors(s, a);
1766
- for (const l of r)
1767
- !this.grid[l.row][l.col].visited && !e.some(
1768
- (c) => c.row === l.row && c.col === l.col
1769
- ) && e.push(l);
1751
+ const t = [], n = (s, l) => {
1752
+ const r = this.getNeighbors(s, l);
1753
+ for (const a of r)
1754
+ !this.grid[a.row][a.col].visited && !t.some(
1755
+ (c) => c.row === a.row && c.col === a.col
1756
+ ) && t.push(a);
1770
1757
  }, o = this.randomNumber(this.rows), i = this.randomNumber(this.cols);
1771
- for (this.grid[o][i].visited = !0, n(o, i); e.length > 0; ) {
1772
- const s = this.randomNumber(e.length), a = e[s], { row: r, col: l } = a, c = this.getVisitedNeighbors(r, l);
1758
+ for (this.grid[o][i].visited = !0, n(o, i); t.length > 0; ) {
1759
+ const s = this.randomNumber(t.length), l = t[s], { row: r, col: a } = l, c = this.getVisitedNeighbors(r, a);
1773
1760
  if (c.length > 0) {
1774
1761
  const d = this.randomPick(c);
1775
- this.removeWall(r, l, d.row, d.col), this.grid[r][l].visited = !0, n(r, l);
1762
+ this.removeWall(r, a, d.row, d.col), this.grid[r][a].visited = !0, n(r, a);
1776
1763
  }
1777
- e.splice(s, 1);
1764
+ t.splice(s, 1);
1778
1765
  }
1779
1766
  }
1780
1767
  // --- Helper Methods ---
1781
1768
  /**
1782
1769
  * Adds openings at the entry and exit points of the maze.
1783
1770
  */
1784
- addOpenings(e, n) {
1785
- this.grid[e.row][e.col].walls.top = !1, this.isValid(n.row, n.col) && (this.grid[n.row][n.col].walls.bottom = !1);
1771
+ addOpenings(t, n) {
1772
+ this.grid[t.row][t.col].walls.top = !1, this.isValid(n.row, n.col) && (this.grid[n.row][n.col].walls.bottom = !1);
1786
1773
  }
1787
1774
  /**
1788
1775
  * Generates a random number between 0 and len-1.
1789
1776
  */
1790
- randomNumber(e) {
1791
- return Math.floor(this.random() * e);
1777
+ randomNumber(t) {
1778
+ return Math.floor(this.random() * t);
1792
1779
  }
1793
1780
  /**
1794
1781
  * Randomly picks an item from a list.
1795
1782
  */
1796
- randomPick(e) {
1797
- return e[Math.floor(this.random() * e.length)];
1783
+ randomPick(t) {
1784
+ return t[Math.floor(this.random() * t.length)];
1798
1785
  }
1799
1786
  }
1800
- const pt = (t, e, n) => {
1801
- if (!t.isValid(e, n)) return !1;
1802
- const o = t.grid[e][n];
1787
+ const pt = (e, t, n) => {
1788
+ if (!e.isValid(t, n)) return !1;
1789
+ const o = e.grid[t][n];
1803
1790
  return !o.walls.top || !o.walls.right || !o.walls.bottom || !o.walls.left;
1804
- }, kn = (t) => t === 1 ? 2 : t >= 2 && t <= 5 ? 3 : t >= 6 && t <= 11 ? 4 : t >= 12 && t <= 15 ? 5 : 6, Sn = (t, e) => {
1805
- if (!e)
1806
- return console.error(`Cannot find Level ${t}'s config.`), null;
1807
- const { size: n, seed: o, method: i, entry: s, exit: a } = e, r = n, l = n, c = s || { row: 0, col: 0 }, d = a || {
1791
+ }, Tn = (e) => e === 1 ? 2 : e >= 2 && e <= 5 ? 3 : e >= 6 && e <= 11 ? 4 : e >= 12 && e <= 15 ? 5 : 6, kn = (e, t) => {
1792
+ if (!t)
1793
+ return console.error(`Cannot find Level ${e}'s config.`), null;
1794
+ const { size: n, seed: o, method: i, entry: s, exit: l } = t, r = n, a = n, c = s || { row: 0, col: 0 }, d = l || {
1808
1795
  row: r - 1,
1809
- col: l - 1
1810
- }, u = new gt(r, l, i, o, c, d), h = kn(t), f = [];
1811
- for (let k = 0; k < h; k++) {
1812
- let p;
1796
+ col: a - 1
1797
+ }, u = new gt(r, a, i, o, c, d), h = Tn(e), f = [];
1798
+ for (let p = 0; p < h; p++) {
1799
+ let v;
1813
1800
  do
1814
- p = {
1801
+ v = {
1815
1802
  row: Math.floor(u.random() * r),
1816
- col: Math.floor(u.random() * l)
1803
+ col: Math.floor(u.random() * a)
1817
1804
  };
1818
- while (p.row === c.row && p.col === c.col || p.row === d.row && p.col === d.col || !pt(u, p.row, p.col) || f.some((_) => _.row === p.row && _.col === p.col));
1819
- f.push(p);
1805
+ while (v.row === c.row && v.col === c.col || v.row === d.row && v.col === d.col || !pt(u, v.row, v.col) || f.some((_) => _.row === v.row && _.col === v.col));
1806
+ f.push(v);
1820
1807
  }
1821
1808
  return {
1822
1809
  isGameActive: !0,
@@ -1832,282 +1819,291 @@ const pt = (t, e, n) => {
1832
1819
  playerPath: [c],
1833
1820
  visitCounts: { [`${c.row},${c.col}`]: 1 }
1834
1821
  };
1835
- }, zn = ({
1836
- size: t,
1837
- seed: e,
1822
+ }, Sn = ({
1823
+ size: e,
1824
+ seed: t,
1838
1825
  method: n,
1839
- foodCount: o
1826
+ foodCount: o,
1827
+ clue: i
1840
1828
  }) => {
1841
- const i = t, s = t, a = { row: 0, col: 0 }, r = { row: i - 1, col: s - 1 }, l = new gt(i, s, n, e, a, r), c = [];
1842
- for (let d = 0; d < o; d++) {
1843
- let u, h = 0;
1829
+ const s = e, l = e, r = { row: 0, col: 0 }, a = { row: s - 1, col: l - 1 }, c = new gt(s, l, n, t, r, a), d = [];
1830
+ for (let u = 0; u < o; u++) {
1831
+ let h, f = 0;
1844
1832
  do
1845
- u = {
1846
- row: Math.floor(l.random() * i),
1847
- col: Math.floor(l.random() * s)
1848
- }, h++;
1849
- while (h < 50 && (u.row === a.row && u.col === a.col || u.row === r.row && u.col === r.col || !pt(l, u.row, u.col) || c.some(
1850
- (f) => f.row === u.row && f.col === u.col
1833
+ h = {
1834
+ row: Math.floor(c.random() * s),
1835
+ col: Math.floor(c.random() * l)
1836
+ }, f++;
1837
+ while (f < 50 && (h.row === r.row && h.col === r.col || h.row === a.row && h.col === a.col || !pt(c, h.row, h.col) || d.some(
1838
+ (p) => p.row === h.row && p.col === h.col
1851
1839
  )));
1852
- h < 50 && c.push(u);
1840
+ f < 50 && d.push(h);
1853
1841
  }
1854
1842
  return {
1855
1843
  isGameActive: !0,
1856
1844
  levelTransitioning: !1,
1857
- maze: l,
1858
- playerCell: a,
1859
- exitCell: r,
1860
- foodCells: c,
1845
+ maze: c,
1846
+ playerCell: r,
1847
+ exitCell: a,
1848
+ foodCells: d,
1861
1849
  playerAtExit: !1,
1862
1850
  foodCollected: 0,
1863
- totalFoodCount: o
1851
+ totalFoodCount: o,
1852
+ showClue: i,
1853
+ playerPath: [r],
1854
+ visitCounts: { [`${r.row},${r.col}`]: 1 }
1864
1855
  };
1865
1856
  };
1866
- function En() {
1857
+ function zn() {
1867
1858
  const {
1868
- setGamePlayState: t,
1869
- gamePlayState: e,
1859
+ setGamePlayState: e,
1860
+ gamePlayState: t,
1870
1861
  gamePlayStateRef: n,
1871
1862
  gameProgress: o,
1872
1863
  config: i
1873
- } = ne(), s = O(null), a = O(null), { i18n: r, levelConfig: l, renderConfig: c } = i, d = oe(l), u = O(
1864
+ } = re(), s = F(null), l = F(null), { i18n: r, levelConfig: a, renderConfig: c } = i, d = ie(a), u = F(
1874
1865
  d.getLevelConfig(o.currentLevel)
1875
1866
  );
1876
- R(() => {
1877
- s.current && j.attachTo(s.current);
1867
+ x(() => {
1868
+ s.current && q.attachTo(s.current);
1878
1869
  }, []);
1879
- const h = O(), f = ft(a, () => {
1870
+ const h = F(), f = ft(l, () => {
1880
1871
  h.current?.();
1881
- }), k = mt(
1882
- a,
1883
- e,
1872
+ }), p = mt(
1873
+ l,
1874
+ t,
1884
1875
  c.padding
1885
1876
  );
1886
- R(() => {
1877
+ x(() => {
1887
1878
  u.current = d.getLevelConfig(
1888
1879
  o.currentLevel
1889
1880
  );
1890
1881
  }, [o.currentLevel]);
1891
- const p = () => {
1892
- const M = Sn(
1882
+ const v = () => {
1883
+ const T = kn(
1893
1884
  o.currentLevel,
1894
1885
  u.current
1895
1886
  );
1896
- M && t((C) => ({
1897
- ...C,
1898
- ...M
1887
+ T && e((g) => ({
1888
+ ...g,
1889
+ ...T
1899
1890
  }));
1900
1891
  };
1901
- R(() => {
1902
- p();
1892
+ x(() => {
1893
+ v();
1903
1894
  }, [o.currentLevel]);
1904
1895
  const _ = () => {
1905
- p();
1906
- }, { updatePlayerPos: b, resetMovingState: w } = _t({
1907
- containerRef: s,
1896
+ v();
1897
+ }, { updatePlayerPos: b, resetMovingState: C } = _t({
1908
1898
  gamePlayStateRef: n,
1909
- setGamePlayState: t,
1899
+ setGamePlayState: e,
1910
1900
  playerRadius: c.playerRadius,
1911
1901
  moveSpeed: c.gridMoveSpeed,
1912
1902
  onFoodCollected: () => {
1913
- const M = n.current.totalFoodCount - n.current.foodCollected - 1;
1914
- M > 0 ? j.show(
1915
- r.foodCollectedToast.replace("%NUM%", M.toString()),
1903
+ const T = n.current.totalFoodCount - n.current.foodCollected - 1;
1904
+ T > 0 ? q.show(
1905
+ r.foodCollectedToast.replace("%NUM%", T.toString()),
1916
1906
  3e3
1917
- ) : j.show(r.allFoodCollectedToast);
1907
+ ) : q.show(r.allFoodCollectedToast);
1918
1908
  }
1919
1909
  });
1920
- return R(() => {
1921
- w();
1922
- }, [o.currentLevel, w]), R(() => {
1923
- let M, C = !document.hidden;
1924
- const z = () => {
1925
- const L = a.current?.getContext("2d"), y = n.current;
1926
- if (!(C && y?.isGameActive && L && y?.maze)) {
1927
- M = requestAnimationFrame(z);
1910
+ return x(() => {
1911
+ C();
1912
+ }, [o.currentLevel, C]), x(() => {
1913
+ let T, g = !document.hidden;
1914
+ const k = () => {
1915
+ const S = l.current?.getContext("2d"), N = n.current;
1916
+ if (!(g && N?.isGameActive && S && N?.maze)) {
1917
+ T = requestAnimationFrame(k);
1928
1918
  return;
1929
1919
  }
1930
- b(), S(), M = requestAnimationFrame(z);
1931
- }, S = () => {
1932
- const L = a.current?.getContext("2d"), y = n.current;
1933
- if (L && y?.maze) {
1934
- const g = u.current?.wallWidth || c?.wallWidth, v = u.current?.exitColor || c?.exitColor, T = u.current?.exitWallWidth || c?.exitWallWidth, N = u.current?.exitDashArray || c?.exitDashArray;
1935
- vt(L, y, f.current, k.current, {
1920
+ b(), w(), T = requestAnimationFrame(k);
1921
+ }, w = () => {
1922
+ const S = l.current?.getContext("2d"), N = n.current;
1923
+ if (S && N?.maze) {
1924
+ const z = u.current?.wallWidth || c?.wallWidth, E = u.current?.exitColor || c?.exitColor, L = u.current?.exitWallWidth || c?.exitWallWidth, A = u.current?.exitDashArray || c?.exitDashArray;
1925
+ vt(S, N, f.current, p.current, {
1936
1926
  ...c,
1937
- wallWidth: g,
1938
- exitColor: v,
1939
- exitWallWidth: T,
1940
- exitDashArray: N
1927
+ wallWidth: z,
1928
+ exitColor: E,
1929
+ exitWallWidth: L,
1930
+ exitDashArray: A
1941
1931
  });
1942
1932
  }
1943
1933
  };
1944
- h.current = S;
1945
- const E = (L) => {
1946
- const y = C;
1947
- C = !document.hidden && document.visibilityState === "visible" && (!L || L.type !== "blur"), !y && C ? n.current?.levelTransitioning === !1 && t({
1934
+ h.current = w;
1935
+ const y = (S) => {
1936
+ const N = g;
1937
+ g = !document.hidden && document.visibilityState === "visible" && (!S || S.type !== "blur"), !N && g ? n.current?.levelTransitioning === !1 && e({
1948
1938
  ...n.current,
1949
1939
  isGameActive: !0
1950
- }) : y && !C && t({
1940
+ }) : N && !g && e({
1951
1941
  ...n.current,
1952
1942
  isGameActive: !1
1953
1943
  });
1954
1944
  };
1955
- return document.addEventListener("visibilitychange", E), window.addEventListener("blur", E), window.addEventListener("focus", E), M = requestAnimationFrame(z), () => {
1956
- cancelAnimationFrame(M), document.removeEventListener("visibilitychange", E), window.removeEventListener("blur", E), window.removeEventListener("focus", E);
1945
+ return document.addEventListener("visibilitychange", y), window.addEventListener("blur", y), window.addEventListener("focus", y), T = requestAnimationFrame(k), () => {
1946
+ cancelAnimationFrame(T), document.removeEventListener("visibilitychange", y), window.removeEventListener("blur", y), window.removeEventListener("focus", y);
1957
1947
  };
1958
- }, []), R(() => {
1959
- j.show(r.useArrowKeyTips, 3e3);
1948
+ }, []), x(() => {
1949
+ q.show(r.useArrowKeyTips, 3e3);
1960
1950
  }, []), /* @__PURE__ */ m("div", { className: "maze-game-container", children: [
1961
- /* @__PURE__ */ m(Ot, {}),
1962
- /* @__PURE__ */ m(dn, { onRetry: _ }),
1963
- /* @__PURE__ */ m("div", { className: "maze-canvas-container", ref: s, children: [
1964
- /* @__PURE__ */ m("canvas", { ref: a, className: "maze-game-canvas" }),
1965
- /* @__PURE__ */ m("div", { className: "maze-touch-area maze-up" }),
1966
- /* @__PURE__ */ m("div", { className: "maze-touch-area maze-down" }),
1967
- /* @__PURE__ */ m("div", { className: "maze-touch-area maze-left" }),
1968
- /* @__PURE__ */ m("div", { className: "maze-touch-area maze-right" })
1969
- ] })
1951
+ /* @__PURE__ */ m(Dt, {}),
1952
+ /* @__PURE__ */ m(un, { onRetry: _ }),
1953
+ /* @__PURE__ */ m("div", { className: "maze-canvas-container", ref: s, children: /* @__PURE__ */ m("canvas", { ref: l, className: "maze-game-canvas" }) })
1970
1954
  ] });
1971
1955
  }
1972
- const Ln = (t) => {
1973
- const e = Math.floor(t / 60), n = t % 60;
1974
- return `${e.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}`;
1975
- }, Nn = ({
1976
- timer: t,
1977
- onTimeUp: e
1956
+ const En = (e) => {
1957
+ const t = Math.floor(e / 60), n = e % 60;
1958
+ return `${t.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}`;
1959
+ }, Ln = ({
1960
+ timer: e,
1961
+ onTimeUp: t
1978
1962
  }) => {
1979
- const [n, o] = U(t), i = O(), s = O(!1);
1980
- return R(() => {
1981
- const a = () => {
1963
+ const [n, o] = G(e), i = F(), s = F(!1), l = F(0);
1964
+ return x(() => {
1965
+ const r = () => {
1982
1966
  !s.current && !i.current && (s.current = !0, i.current = setInterval(() => {
1983
- o((l) => l <= 1 ? (clearInterval(i.current), e(), 0) : l - 1);
1967
+ o((c) => (l.current = e - c + 1, c <= 1 ? (clearInterval(i.current), t(), 0) : c - 1));
1984
1968
  }, 1e3));
1985
- }, r = () => {
1986
- clearInterval(i.current), i.current = void 0;
1969
+ }, a = () => {
1970
+ clearInterval(i.current), i.current = void 0, window.dispatchEvent(
1971
+ new CustomEvent("maze:timeUsed", {
1972
+ detail: { timeUsed: l.current }
1973
+ })
1974
+ );
1987
1975
  };
1988
- return window.addEventListener("maze:firstMove", a), window.addEventListener("maze:gameSuccess", r), () => {
1989
- window.removeEventListener("maze:firstMove", a), window.removeEventListener("maze:gameSuccess", r), clearInterval(i.current);
1976
+ return window.addEventListener("maze:firstMove", r), window.addEventListener("maze:gameSuccess", a), () => {
1977
+ window.removeEventListener("maze:firstMove", r), window.removeEventListener("maze:gameSuccess", a), clearInterval(i.current);
1990
1978
  };
1991
- }, []), R(() => {
1992
- i.current && (clearInterval(i.current), i.current = void 0), o(t), s.current = !1;
1993
- }, [t]), /* @__PURE__ */ m("div", { className: "single-maze-timer", children: /* @__PURE__ */ m(
1979
+ }, []), x(() => {
1980
+ i.current && (clearInterval(i.current), i.current = void 0), o(e), s.current = !1, l.current = 0;
1981
+ }, [e]), /* @__PURE__ */ m("div", { className: "single-maze-timer", children: /* @__PURE__ */ m(
1994
1982
  "span",
1995
1983
  {
1996
1984
  className: `maze-timer-text ${n <= 10 && s.current ? "maze-timer-warning" : ""}`,
1997
1985
  children: [
1998
1986
  "⏱️ ",
1999
- Ln(n)
1987
+ En(n)
2000
1988
  ]
2001
1989
  }
2002
1990
  ) });
2003
1991
  };
2004
- function Mn({ config: t }) {
1992
+ function Nn({ config: e }) {
2005
1993
  const {
2006
- size: e,
1994
+ size: t,
2007
1995
  seed: n,
2008
1996
  method: o,
2009
1997
  foodCount: i,
2010
- renderConfig: s,
2011
- successCallback: a,
2012
- failCallback: r,
2013
- timer: l,
2014
- i18n: c
2015
- } = t, [d, u] = U({
2016
- ...ke
2017
- }), [h, f] = U(!1), [k, p] = U(!1), [_, b] = U(!1), [w, M] = U(""), C = O(null), z = O(null), S = O(d), E = O(), L = ft(C, () => {
2018
- E.current?.();
2019
- }), y = mt(C, d, s.padding);
2020
- R(() => {
2021
- S.current = d;
2022
- }, [d]);
2023
- const { updatePlayerPos: g, resetMovingState: v, resetFirstMoveState: T } = _t({
2024
- containerRef: z,
2025
- gamePlayStateRef: S,
2026
- setGamePlayState: u,
2027
- playerRadius: s.playerRadius,
2028
- moveSpeed: s.gridMoveSpeed,
1998
+ clue: s,
1999
+ renderConfig: l,
2000
+ successCallback: r,
2001
+ failCallback: a,
2002
+ timer: c,
2003
+ i18n: d
2004
+ } = e, [u, h] = G({
2005
+ ...Se
2006
+ }), [f, p] = G(!1), [v, _] = G(!1), [b, C] = G(!1), [T, g] = G(""), k = F(0), w = F(!1), y = F(null), S = F(null), N = F(u), z = F(), E = ft(y, () => {
2007
+ z.current?.();
2008
+ }), L = mt(y, u, l.padding);
2009
+ x(() => {
2010
+ N.current = u;
2011
+ }, [u]);
2012
+ const { updatePlayerPos: A, resetMovingState: I, resetFirstMoveState: O } = _t({
2013
+ gamePlayStateRef: N,
2014
+ setGamePlayState: h,
2015
+ playerRadius: l.playerRadius,
2016
+ moveSpeed: l.gridMoveSpeed,
2029
2017
  onFoodCollected: () => {
2030
2018
  console.log("Food collected in single maze");
2031
2019
  },
2032
2020
  onExitReached: () => {
2033
- k || P();
2021
+ w.current = !0, v || W();
2034
2022
  },
2035
2023
  onFirstMove: () => {
2036
2024
  window.dispatchEvent(new CustomEvent("maze:firstMove"));
2037
2025
  }
2038
- }), N = () => {
2039
- p(!0), M(`⏰ ${c.failMsg}`), b(!0), u((I) => ({
2040
- ...I,
2026
+ }), $ = () => {
2027
+ _(!0), g(`⏰ ${d.failMsg}`), C(!0), h((D) => ({
2028
+ ...D,
2041
2029
  isGameActive: !1
2042
- })), r && r();
2043
- }, P = () => {
2044
- p(!0), M(`🎉 ${c.successMsg}`), b(!0), window.dispatchEvent(new CustomEvent("maze:gameSuccess")), a && a();
2045
- }, D = () => {
2046
- b(!1);
2030
+ }));
2031
+ }, W = () => {
2032
+ _(!0), g(`🎉 ${d.successMsg}`), C(!0), window.dispatchEvent(new CustomEvent("maze:gameSuccess"));
2033
+ }, K = () => {
2034
+ C(!1), h((D) => ({
2035
+ ...D,
2036
+ showClue: !0
2037
+ })), w.current ? r?.(k.current) : a?.();
2047
2038
  };
2048
- return R(() => {
2039
+ return x(() => {
2049
2040
  (async () => {
2050
- f(!0);
2041
+ p(!0);
2051
2042
  try {
2052
- const $ = zn({
2053
- size: e,
2043
+ const U = Sn({
2044
+ size: t,
2054
2045
  seed: n,
2055
2046
  method: o,
2056
- foodCount: i
2047
+ foodCount: i,
2048
+ clue: s
2057
2049
  });
2058
- S.current = $, u($);
2059
- } catch ($) {
2060
- console.error("Error generating single maze:", $);
2050
+ N.current = U, h(U);
2051
+ } catch (U) {
2052
+ console.error("Error generating single maze:", U);
2061
2053
  } finally {
2062
- f(!1);
2054
+ p(!1);
2063
2055
  }
2064
2056
  })();
2065
- }, [t]), R(() => {
2066
- let I;
2067
- const $ = !document.hidden, B = () => {
2068
- const G = C.current?.getContext("2d"), q = S.current;
2069
- if (!($ && q?.isGameActive && G && q?.maze)) {
2070
- I = requestAnimationFrame(B);
2057
+ }, [e]), x(() => {
2058
+ let D;
2059
+ const U = !document.hidden, H = () => {
2060
+ const V = y.current?.getContext("2d"), X = N.current;
2061
+ if (!(U && X?.isGameActive && V && X?.maze)) {
2062
+ D = requestAnimationFrame(H);
2071
2063
  return;
2072
2064
  }
2073
- g(), V(), I = requestAnimationFrame(B);
2074
- }, V = () => {
2075
- const G = C.current?.getContext("2d"), q = S.current;
2076
- G && q?.maze && vt(
2077
- G,
2078
- q,
2065
+ A(), J(), D = requestAnimationFrame(H);
2066
+ }, J = () => {
2067
+ const V = y.current?.getContext("2d"), X = N.current;
2068
+ V && X?.maze && vt(
2069
+ V,
2070
+ X,
2071
+ E.current,
2079
2072
  L.current,
2080
- y.current,
2081
- s
2073
+ l
2082
2074
  );
2083
2075
  };
2084
- return E.current = V, I = requestAnimationFrame(B), () => {
2085
- cancelAnimationFrame(I);
2076
+ return z.current = J, D = requestAnimationFrame(H), () => {
2077
+ cancelAnimationFrame(D);
2086
2078
  };
2087
- }, []), R(() => {
2088
- v(), T();
2089
- }, [t, v, T]), h ? /* @__PURE__ */ m("div", { className: "single-maze-loading", children: /* @__PURE__ */ m("div", { children: "Generating maze..." }) }) : d ? /* @__PURE__ */ m("div", { className: "maze-game-container", children: [
2090
- /* @__PURE__ */ m(Nn, { timer: l, onTimeUp: N }),
2091
- /* @__PURE__ */ m("div", { className: "single-maze-canvas-container", ref: z, children: [
2092
- /* @__PURE__ */ m("canvas", { ref: C, className: "maze-game-canvas" }),
2093
- /* @__PURE__ */ m("div", { className: "maze-touch-area maze-up" }),
2094
- /* @__PURE__ */ m("div", { className: "maze-touch-area maze-down" }),
2095
- /* @__PURE__ */ m("div", { className: "maze-touch-area maze-left" }),
2096
- /* @__PURE__ */ m("div", { className: "maze-touch-area maze-right" })
2097
- ] }),
2079
+ }, []), x(() => {
2080
+ I(), O();
2081
+ }, [e, I, O]), x(() => {
2082
+ const D = (U) => {
2083
+ k.current = U.detail.timeUsed;
2084
+ };
2085
+ return window.addEventListener("maze:timeUsed", D), () => {
2086
+ window.removeEventListener(
2087
+ "maze:timeUsed",
2088
+ D
2089
+ );
2090
+ };
2091
+ }, []), f ? /* @__PURE__ */ m("div", { className: "single-maze-loading", children: /* @__PURE__ */ m("div", { children: "Generating maze..." }) }) : u ? /* @__PURE__ */ m("div", { className: "maze-game-container", children: [
2092
+ /* @__PURE__ */ m(Ln, { timer: c, onTimeUp: $ }),
2093
+ /* @__PURE__ */ m("div", { className: "single-maze-canvas-container", ref: S, children: /* @__PURE__ */ m("canvas", { ref: y, className: "maze-game-canvas" }) }),
2098
2094
  /* @__PURE__ */ m(
2099
- Q,
2095
+ te,
2100
2096
  {
2101
- isOpen: _,
2102
- title: w,
2097
+ isOpen: b,
2098
+ title: T,
2103
2099
  noConfirm: !0,
2104
2100
  cancelText: "OK",
2105
- onCancel: D
2101
+ onCancel: K
2106
2102
  }
2107
2103
  )
2108
2104
  ] }) : /* @__PURE__ */ m("div", { className: "single-maze-error", children: /* @__PURE__ */ m("div", { children: "Failed to generate maze" }) });
2109
2105
  }
2110
- const wt = [
2106
+ const Ct = [
2111
2107
  // Tier 1 (Levels 1-12) - Beginner
2112
2108
  [
2113
2109
  // debug
@@ -2265,8 +2261,8 @@ const wt = [
2265
2261
  { size: 68, seed: 33341, method: "backtracking" }
2266
2262
  // Level 60 - Master
2267
2263
  ]
2268
- ], An = 0.07, Ct = {
2269
- gridMoveSpeed: An,
2264
+ ], Mn = 0.07, wt = {
2265
+ gridMoveSpeed: Mn,
2270
2266
  padding: 10,
2271
2267
  wallWidth: 2,
2272
2268
  wallColor: "#000000",
@@ -2281,7 +2277,7 @@ const wt = [
2281
2277
  // default exit wall width if not specified in level config, should always be a little wider than normal wallWidth
2282
2278
  exitDashArray: [8, 12]
2283
2279
  // default dash: 8px dash, 12px gap
2284
- }, ce = {
2280
+ }, de = {
2285
2281
  lcPrefix: "maze-",
2286
2282
  i18n: {
2287
2283
  reset: "Reset",
@@ -2326,9 +2322,9 @@ const wt = [
2326
2322
  cluePathDisabled: "Clue Path Disabled",
2327
2323
  useArrowKeyTips: "Use arrow keys to navigate the maze. Press'C' to toggle path clue."
2328
2324
  },
2329
- renderConfig: Ct,
2330
- levelConfig: wt
2331
- }, ue = {
2325
+ renderConfig: wt,
2326
+ levelConfig: Ct
2327
+ }, he = {
2332
2328
  i18n: {
2333
2329
  successMsg: "Congratulations! You completed the maze!",
2334
2330
  failMsg: "Time is up!",
@@ -2337,8 +2333,9 @@ const wt = [
2337
2333
  size: 8,
2338
2334
  seed: 12345,
2339
2335
  method: "backtracking",
2336
+ clue: !1,
2340
2337
  foodCount: 3,
2341
- renderConfig: Ct,
2338
+ renderConfig: wt,
2342
2339
  timer: 10 * 60,
2343
2340
  // 10 minutes
2344
2341
  successCallback: () => {
@@ -2348,56 +2345,56 @@ const wt = [
2348
2345
  console.log("⏰ Time is up! Game failed.");
2349
2346
  }
2350
2347
  };
2351
- function Pn({ config: t = {} }) {
2352
- const e = { ...ce.i18n, ...t.i18n || {} }, n = {
2353
- ...ce.renderConfig,
2354
- ...t.renderConfig || {}
2355
- }, o = t.levelConfig || wt, i = {
2356
- ...ce,
2357
- ...t,
2358
- i18n: e,
2348
+ function An({ config: e = {} }) {
2349
+ const t = { ...de.i18n, ...e.i18n || {} }, n = {
2350
+ ...de.renderConfig,
2351
+ ...e.renderConfig || {}
2352
+ }, o = e.levelConfig || Ct, i = {
2353
+ ...de,
2354
+ ...e,
2355
+ i18n: t,
2359
2356
  levelConfig: o,
2360
2357
  renderConfig: n
2361
2358
  };
2362
- return /* @__PURE__ */ m(Rt, { config: i, children: /* @__PURE__ */ m(En, {}) });
2359
+ return /* @__PURE__ */ m(xt, { config: i, children: /* @__PURE__ */ m(zn, {}) });
2363
2360
  }
2364
- function In({
2365
- config: t = {}
2361
+ function Pn({
2362
+ config: e = {}
2366
2363
  }) {
2367
- const e = { ...ue.i18n, ...t.i18n || {} }, n = {
2368
- ...ue.renderConfig,
2369
- ...t.renderConfig || {}
2364
+ const t = { ...he.i18n, ...e.i18n || {} }, n = {
2365
+ ...he.renderConfig,
2366
+ ...e.renderConfig || {}
2370
2367
  }, o = {
2371
- ...ue,
2372
- ...t,
2373
- i18n: e,
2368
+ ...he,
2369
+ ...e,
2370
+ i18n: t,
2374
2371
  renderConfig: n
2375
2372
  };
2376
- return /* @__PURE__ */ m(Mn, { config: o });
2373
+ return /* @__PURE__ */ m(Nn, { config: o });
2377
2374
  }
2378
- const xn = {
2379
- root: "https://unpkg.com/@roudanio/maze@0.2.1/dist/",
2380
- ...ce
2375
+ const In = {
2376
+ root: "https://unpkg.com/@roudanio/maze@0.2.3/dist/",
2377
+ ...de
2381
2378
  };
2382
- `${JSON.stringify(xn, null, 2)}`;
2383
- const Rn = {
2384
- root: "https://unpkg.com/@roudanio/maze@0.2.1/dist/",
2385
- ...ue
2379
+ `${JSON.stringify(In, null, 2)}`;
2380
+ const xn = {
2381
+ root: "https://unpkg.com/@roudanio/maze@0.2.3/dist/",
2382
+ ...he
2386
2383
  };
2387
2384
  `${JSON.stringify(
2388
- Rn,
2389
- (t, e) => typeof e == "function" ? e.toString() : e,
2385
+ xn,
2386
+ (e, t) => typeof t == "function" ? t.toString() : t,
2390
2387
  2
2391
2388
  )}`;
2392
2389
  const Fn = {
2393
2390
  showNotice() {
2394
2391
  console.warn("Cannot find the root element");
2395
- const t = document.createElement("div");
2396
- t.style.textAlign = "center", t.style.padding = "20px", t.innerHTML = "Cannot find the root element", document.body.append(t);
2392
+ const e = document.createElement("div");
2393
+ e.style.textAlign = "center", e.style.padding = "20px", e.innerHTML = "Cannot find the root element", document.body.append(e);
2397
2394
  },
2398
- addLoadingIndicator(t) {
2399
- const e = document.createElement("div"), n = document.createElement("div");
2400
- e.style.cssText = `
2395
+ addLoadingIndicator(e) {
2396
+ const t = document.createElement("div"), n = document.createElement("div");
2397
+ t.style.cssText = `
2401
2398
  height: 30px;
2402
2399
  width: 100%;
2403
2400
  border: solid 2px #999;
@@ -2408,7 +2405,7 @@ const Fn = {
2408
2405
  background: #999;
2409
2406
  animation: loading 1.5s ease-in-out;
2410
2407
  transition: width 1.5s ease-in-out;
2411
- `, e.append(n), t.append(e);
2408
+ `, t.append(n), e.append(t);
2412
2409
  const o = document.createElement("style");
2413
2410
  o.innerHTML = `
2414
2411
  @keyframes loading {
@@ -2416,30 +2413,30 @@ const Fn = {
2416
2413
  100% { width: 99%; }
2417
2414
  }`, document.head.appendChild(o);
2418
2415
  },
2419
- async loadCSS(t) {
2420
- const e = document.createElement("link");
2421
- return e.rel = "stylesheet", e.href = "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap", document.head.appendChild(e), new Promise((n, o) => {
2416
+ async loadCSS(e) {
2417
+ const t = document.createElement("link");
2418
+ return t.rel = "stylesheet", t.href = "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap", document.head.appendChild(t), new Promise((n, o) => {
2422
2419
  const i = document.createElement("link");
2423
- i.rel = "stylesheet", i.type = "text/css", i.href = t, i.onload = n, i.onerror = o, document.head.appendChild(i);
2420
+ i.rel = "stylesheet", i.type = "text/css", i.href = e, i.onload = n, i.onerror = o, document.head.appendChild(i);
2424
2421
  });
2425
2422
  },
2426
- async init(t, e) {
2427
- const n = typeof t == "string" ? document.querySelector(t) : t;
2423
+ async init(e, t) {
2424
+ const n = typeof e == "string" ? document.querySelector(e) : e;
2428
2425
  if (!n) {
2429
2426
  this.showNotice();
2430
2427
  return;
2431
2428
  }
2432
- let { root: o = location.origin } = e;
2433
- o.at(-1) !== "/" && (o += "/"), this.addLoadingIndicator(n), await this.loadCSS(o + "maze.css"), n.innerHTML = "", Re(/* @__PURE__ */ m(Pn, { config: e }), n);
2429
+ let { root: o = location.origin } = t;
2430
+ o.at(-1) !== "/" && (o += "/"), this.addLoadingIndicator(n), await this.loadCSS(o + "maze.css"), n.innerHTML = "", Re(/* @__PURE__ */ m(An, { config: t }), n);
2434
2431
  },
2435
- async initSingle(t, e) {
2436
- const n = typeof t == "string" ? document.querySelector(t) : t;
2432
+ async initSingle(e, t) {
2433
+ const n = typeof e == "string" ? document.querySelector(e) : e;
2437
2434
  if (!n) {
2438
2435
  this.showNotice();
2439
2436
  return;
2440
2437
  }
2441
- let { root: o = location.origin } = e;
2442
- o.at(-1) !== "/" && (o += "/"), this.addLoadingIndicator(n), await this.loadCSS(o + "maze.css"), n.innerHTML = "", Re(/* @__PURE__ */ m(In, { config: e }), n);
2438
+ let { root: o = location.origin } = t;
2439
+ o.at(-1) !== "/" && (o += "/"), this.addLoadingIndicator(n), await this.loadCSS(o + "maze.css"), n.innerHTML = "", Re(/* @__PURE__ */ m(Pn, { config: t }), n);
2443
2440
  }
2444
2441
  };
2445
2442
  export {