@roudanio/maze 0.2.4 → 0.3.0

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