@roudanio/maze 0.2.0 → 0.2.2

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 fe, M, Je, X, Pe, Ze, Qe, et, Se, Ce, ye, tt, ee = {}, nt = [], bt = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, me = Array.isArray;
1
+ var fe, A, Je, X, Pe, Ze, Qe, et, Se, we, ye, tt, ee = {}, nt = [], bt = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, me = Array.isArray;
2
2
  function H(t, e) {
3
3
  for (var n in e) t[n] = e[n];
4
4
  return t;
@@ -14,7 +14,7 @@ function Tt(t, e, n) {
14
14
  }
15
15
  function se(t, e, n, o, i) {
16
16
  var s = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++Je, __i: -1, __u: 0 };
17
- return i == null && M.vnode != null && M.vnode(s), s;
17
+ return i == null && A.vnode != null && A.vnode(s), s;
18
18
  }
19
19
  function _e(t) {
20
20
  return t.children;
@@ -38,21 +38,21 @@ function ot(t) {
38
38
  }
39
39
  }
40
40
  function be(t) {
41
- (!t.__d && (t.__d = !0) && X.push(t) && !de.__r++ || Pe != M.debounceRendering) && ((Pe = M.debounceRendering) || Ze)(de);
41
+ (!t.__d && (t.__d = !0) && X.push(t) && !de.__r++ || Pe != A.debounceRendering) && ((Pe = A.debounceRendering) || Ze)(de);
42
42
  }
43
43
  function de() {
44
- for (var t, e, n, o, i, s, a, r = 1; X.length; ) X.length > r && X.sort(Qe), t = X.shift(), r = X.length, t.__d && (n = void 0, i = (o = (e = t).__v).__e, s = [], a = [], e.__P && ((n = H({}, o)).__v = o.__v + 1, M.vnode && M.vnode(n), Ee(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [i] : null, s, i ?? K(o), !!(32 & o.__u), a), n.__v = o.__v, n.__.__k[n.__i] = n, st(s, n, a), n.__e != i && ot(n)));
44
+ for (var t, e, n, o, i, s, a, r = 1; X.length; ) X.length > r && X.sort(Qe), t = X.shift(), r = X.length, t.__d && (n = void 0, i = (o = (e = t).__v).__e, s = [], a = [], e.__P && ((n = H({}, o)).__v = o.__v + 1, A.vnode && A.vnode(n), Ee(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [i] : null, s, i ?? K(o), !!(32 & o.__u), a), n.__v = o.__v, n.__.__k[n.__i] = n, st(s, n, a), n.__e != i && ot(n)));
45
45
  de.__r = 0;
46
46
  }
47
- function rt(t, e, n, o, i, s, a, r, l, u, d) {
48
- var c, h, f, k, p, _, b = o && o.__k || nt, w = e.length;
49
- for (l = kt(n, e, b, l, w), c = 0; c < w; c++) (f = n.__k[c]) != null && (h = f.__i == -1 ? ee : b[f.__i] || ee, f.__i = c, _ = Ee(t, f, h, i, s, a, r, l, u, d), k = f.__e, f.ref && h.ref != f.ref && (h.ref && Le(h.ref, null, f), d.push(f.ref, f.__c || k, f)), p == null && k != null && (p = k), 4 & f.__u || h.__k === f.__k ? l = it(f, l, t) : typeof f.type == "function" && _ !== void 0 ? l = _ : k && (l = k.nextSibling), f.__u &= -7);
47
+ function rt(t, e, n, o, i, s, a, r, l, c, d) {
48
+ var u, h, f, k, p, _, b = o && o.__k || nt, C = e.length;
49
+ for (l = kt(n, e, b, l, C), u = 0; u < C; u++) (f = n.__k[u]) != null && (h = f.__i == -1 ? ee : b[f.__i] || ee, f.__i = u, _ = Ee(t, f, h, i, s, a, r, l, c, d), k = f.__e, f.ref && h.ref != f.ref && (h.ref && Le(h.ref, null, f), d.push(f.ref, f.__c || k, f)), p == null && k != null && (p = k), 4 & f.__u || h.__k === f.__k ? l = it(f, l, t) : typeof f.type == "function" && _ !== void 0 ? l = _ : k && (l = k.nextSibling), f.__u &= -7);
50
50
  return n.__e = p, l;
51
51
  }
52
52
  function kt(t, e, n, o, i) {
53
- var s, a, r, l, u, d = n.length, c = d, h = 0;
54
- for (t.__k = new Array(i), s = 0; s < i; s++) (a = e[s]) != null && typeof a != "boolean" && typeof a != "function" ? (l = s + h, (a = t.__k[s] = typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? se(null, a, null, null, null) : me(a) ? se(_e, { children: a }, null, null, null) : a.constructor == null && a.__b > 0 ? se(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : a).__ = t, a.__b = t.__b + 1, r = null, (u = a.__i = St(a, n, l, c)) != -1 && (c--, (r = n[u]) && (r.__u |= 2)), r == null || r.__v == null ? (u == -1 && (i > d ? h-- : i < d && h++), typeof a.type != "function" && (a.__u |= 4)) : u != l && (u == l - 1 ? h-- : u == l + 1 ? h++ : (u > l ? h-- : h++, a.__u |= 4))) : t.__k[s] = null;
55
- if (c) for (s = 0; s < d; s++) (r = n[s]) != null && (2 & r.__u) == 0 && (r.__e == o && (o = K(r)), lt(r, r));
53
+ var s, a, r, l, c, d = n.length, u = d, h = 0;
54
+ for (t.__k = new Array(i), s = 0; s < i; s++) (a = e[s]) != null && typeof a != "boolean" && typeof a != "function" ? (l = s + h, (a = t.__k[s] = typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? se(null, a, null, null, null) : me(a) ? se(_e, { children: a }, null, null, null) : a.constructor == null && a.__b > 0 ? se(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : a).__ = t, a.__b = t.__b + 1, r = null, (c = a.__i = St(a, n, l, u)) != -1 && (u--, (r = n[c]) && (r.__u |= 2)), r == null || r.__v == null ? (c == -1 && (i > d ? h-- : i < d && h++), typeof a.type != "function" && (a.__u |= 4)) : c != l && (c == l - 1 ? h-- : c == l + 1 ? h++ : (c > l ? h-- : h++, a.__u |= 4))) : t.__k[s] = null;
55
+ if (u) for (s = 0; s < d; s++) (r = n[s]) != null && (2 & r.__u) == 0 && (r.__e == o && (o = K(r)), lt(r, r));
56
56
  return o;
57
57
  }
58
58
  function it(t, e, n) {
@@ -82,17 +82,17 @@ function St(t, e, n, o) {
82
82
  }
83
83
  return -1;
84
84
  }
85
- function xe(t, e, n) {
85
+ function Ie(t, e, n) {
86
86
  e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || bt.test(e) ? n : n + "px";
87
87
  }
88
88
  function re(t, e, n, o, i) {
89
89
  var s;
90
90
  e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
91
91
  else {
92
- if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || xe(t.style, e, "");
93
- if (n) for (e in n) o && n[e] == o[e] || xe(t.style, e, n[e]);
92
+ if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || Ie(t.style, e, "");
93
+ if (n) for (e in n) o && n[e] == o[e] || Ie(t.style, e, n[e]);
94
94
  }
95
- else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(et, "$1")), e = e.toLowerCase() in t || e == "onFocusOut" || e == "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = n, n ? o ? n.u = o.u : (n.u = Se, t.addEventListener(e, s ? ye : Ce, s)) : t.removeEventListener(e, s ? ye : Ce, s);
95
+ else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(et, "$1")), e = e.toLowerCase() in t || e == "onFocusOut" || e == "onFocusIn" ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = n, n ? o ? n.u = o.u : (n.u = Se, t.addEventListener(e, s ? ye : we, s)) : t.removeEventListener(e, s ? ye : we, s);
96
96
  else {
97
97
  if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
98
98
  else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
@@ -103,61 +103,61 @@ function re(t, e, n, o, i) {
103
103
  typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
104
104
  }
105
105
  }
106
- function Ie(t) {
106
+ function xe(t) {
107
107
  return function(e) {
108
108
  if (this.l) {
109
109
  var n = this.l[e.type + t];
110
110
  if (e.t == null) e.t = Se++;
111
111
  else if (e.t < n.u) return;
112
- return n(M.event ? M.event(e) : e);
112
+ return n(A.event ? A.event(e) : e);
113
113
  }
114
114
  };
115
115
  }
116
- function Ee(t, e, n, o, i, s, a, r, l, u) {
117
- var d, c, h, f, k, p, _, b, w, A, C, z, S, E, L, y, g, v = e.type;
116
+ function Ee(t, e, n, o, i, s, a, r, l, c) {
117
+ var d, u, h, f, k, p, _, b, C, M, w, z, S, E, L, y, g, v = e.type;
118
118
  if (e.constructor != null) return null;
119
- 128 & n.__u && (l = !!(32 & n.__u), s = [r = e.__e = n.__e]), (d = M.__b) && d(e);
119
+ 128 & n.__u && (l = !!(32 & n.__u), s = [r = e.__e = n.__e]), (d = A.__b) && d(e);
120
120
  e: if (typeof v == "function") try {
121
- if (b = e.props, w = "prototype" in v && v.prototype.render, A = (d = v.contextType) && o[d.__c], C = d ? A ? A.props.value : d.__ : o, n.__c ? _ = (c = e.__c = n.__c).__ = c.__E : (w ? e.__c = c = new v(b, C) : (e.__c = c = new ae(b, C), c.constructor = v, c.render = Et), A && A.sub(c), c.props = b, c.state || (c.state = {}), c.context = C, c.__n = o, h = c.__d = !0, c.__h = [], c._sb = []), w && c.__s == null && (c.__s = c.state), w && v.getDerivedStateFromProps != null && (c.__s == c.state && (c.__s = H({}, c.__s)), H(c.__s, v.getDerivedStateFromProps(b, c.__s))), f = c.props, k = c.state, c.__v = e, h) w && v.getDerivedStateFromProps == null && c.componentWillMount != null && c.componentWillMount(), w && c.componentDidMount != null && c.__h.push(c.componentDidMount);
121
+ if (b = e.props, C = "prototype" in v && v.prototype.render, M = (d = v.contextType) && o[d.__c], w = d ? M ? M.props.value : d.__ : o, n.__c ? _ = (u = e.__c = n.__c).__ = u.__E : (C ? e.__c = u = new v(b, w) : (e.__c = u = new ae(b, w), u.constructor = v, u.render = Et), M && M.sub(u), u.props = b, u.state || (u.state = {}), u.context = w, u.__n = o, h = u.__d = !0, u.__h = [], u._sb = []), C && u.__s == null && (u.__s = u.state), C && v.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = H({}, u.__s)), H(u.__s, v.getDerivedStateFromProps(b, u.__s))), f = u.props, k = u.state, u.__v = e, h) C && v.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), C && u.componentDidMount != null && u.__h.push(u.componentDidMount);
122
122
  else {
123
- if (w && v.getDerivedStateFromProps == null && b !== f && c.componentWillReceiveProps != null && c.componentWillReceiveProps(b, C), !c.__e && c.shouldComponentUpdate != null && c.shouldComponentUpdate(b, c.__s, C) === !1 || e.__v == n.__v) {
124
- for (e.__v != n.__v && (c.props = b, c.state = c.__s, c.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(T) {
123
+ if (C && v.getDerivedStateFromProps == null && b !== f && u.componentWillReceiveProps != null && u.componentWillReceiveProps(b, w), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(b, u.__s, w) === !1 || e.__v == n.__v) {
124
+ for (e.__v != n.__v && (u.props = b, u.state = u.__s, u.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(T) {
125
125
  T && (T.__ = e);
126
- }), z = 0; z < c._sb.length; z++) c.__h.push(c._sb[z]);
127
- c._sb = [], c.__h.length && a.push(c);
126
+ }), z = 0; z < u._sb.length; z++) u.__h.push(u._sb[z]);
127
+ u._sb = [], u.__h.length && a.push(u);
128
128
  break e;
129
129
  }
130
- c.componentWillUpdate != null && c.componentWillUpdate(b, c.__s, C), w && c.componentDidUpdate != null && c.__h.push(function() {
131
- c.componentDidUpdate(f, k, p);
130
+ u.componentWillUpdate != null && u.componentWillUpdate(b, u.__s, w), C && u.componentDidUpdate != null && u.__h.push(function() {
131
+ u.componentDidUpdate(f, k, p);
132
132
  });
133
133
  }
134
- if (c.context = C, c.props = b, c.__P = t, c.__e = !1, S = M.__r, E = 0, w) {
135
- for (c.state = c.__s, c.__d = !1, S && S(e), d = c.render(c.props, c.state, c.context), L = 0; L < c._sb.length; L++) c.__h.push(c._sb[L]);
136
- c._sb = [];
134
+ if (u.context = w, u.props = b, u.__P = t, u.__e = !1, S = A.__r, E = 0, C) {
135
+ for (u.state = u.__s, u.__d = !1, S && S(e), d = u.render(u.props, u.state, u.context), L = 0; L < u._sb.length; L++) u.__h.push(u._sb[L]);
136
+ u._sb = [];
137
137
  } else do
138
- c.__d = !1, S && S(e), d = c.render(c.props, c.state, c.context), c.state = c.__s;
139
- while (c.__d && ++E < 25);
140
- c.state = c.__s, c.getChildContext != null && (o = H(H({}, o), c.getChildContext())), w && !h && c.getSnapshotBeforeUpdate != null && (p = c.getSnapshotBeforeUpdate(f, k)), y = d, d != null && d.type === _e && d.key == null && (y = at(d.props.children)), r = rt(t, me(y) ? y : [y], e, n, o, i, s, a, r, l, u), c.base = e.__e, e.__u &= -161, c.__h.length && a.push(c), _ && (c.__E = c.__ = null);
138
+ u.__d = !1, S && S(e), d = u.render(u.props, u.state, u.context), u.state = u.__s;
139
+ while (u.__d && ++E < 25);
140
+ u.state = u.__s, u.getChildContext != null && (o = H(H({}, o), u.getChildContext())), C && !h && u.getSnapshotBeforeUpdate != null && (p = u.getSnapshotBeforeUpdate(f, k)), y = d, d != null && d.type === _e && d.key == null && (y = at(d.props.children)), r = rt(t, me(y) ? y : [y], e, n, o, i, s, a, r, l, c), u.base = e.__e, e.__u &= -161, u.__h.length && a.push(u), _ && (u.__E = u.__ = null);
141
141
  } catch (T) {
142
142
  if (e.__v = null, l || s != null) if (T.then) {
143
143
  for (e.__u |= l ? 160 : 128; r && r.nodeType == 8 && r.nextSibling; ) r = r.nextSibling;
144
144
  s[s.indexOf(r)] = null, e.__e = r;
145
145
  } else for (g = s.length; g--; ) ze(s[g]);
146
146
  else e.__e = n.__e, e.__k = n.__k;
147
- M.__e(T, e, n);
147
+ A.__e(T, e, n);
148
148
  }
149
- else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : r = e.__e = zt(n.__e, e, n, o, i, s, a, l, u);
150
- return (d = M.diffed) && d(e), 128 & e.__u ? void 0 : r;
149
+ else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : r = e.__e = zt(n.__e, e, n, o, i, s, a, l, c);
150
+ return (d = A.diffed) && d(e), 128 & e.__u ? void 0 : r;
151
151
  }
152
152
  function st(t, e, n) {
153
153
  for (var o = 0; o < n.length; o++) Le(n[o], n[++o], n[++o]);
154
- M.__c && M.__c(e, t), t.some(function(i) {
154
+ A.__c && A.__c(e, t), t.some(function(i) {
155
155
  try {
156
156
  t = i.__h, i.__h = [], t.some(function(s) {
157
157
  s.call(i);
158
158
  });
159
159
  } catch (s) {
160
- M.__e(s, i.__v);
160
+ A.__e(s, i.__v);
161
161
  }
162
162
  });
163
163
  }
@@ -165,31 +165,31 @@ function at(t) {
165
165
  return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : me(t) ? t.map(at) : H({}, t);
166
166
  }
167
167
  function zt(t, e, n, o, i, s, a, r, l) {
168
- var u, d, c, h, f, k, p, _ = n.props, b = e.props, w = e.type;
169
- if (w == "svg" ? i = "http://www.w3.org/2000/svg" : w == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) {
170
- for (u = 0; u < s.length; u++) if ((f = s[u]) && "setAttribute" in f == !!w && (w ? f.localName == w : f.nodeType == 3)) {
171
- t = f, s[u] = null;
168
+ var c, d, u, h, f, k, p, _ = n.props, b = e.props, C = e.type;
169
+ if (C == "svg" ? i = "http://www.w3.org/2000/svg" : C == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) {
170
+ for (c = 0; c < s.length; c++) if ((f = s[c]) && "setAttribute" in f == !!C && (C ? f.localName == C : f.nodeType == 3)) {
171
+ t = f, s[c] = null;
172
172
  break;
173
173
  }
174
174
  }
175
175
  if (t == null) {
176
- if (w == null) return document.createTextNode(b);
177
- t = document.createElementNS(i, w, b.is && b), r && (M.__m && M.__m(e, s), r = !1), s = null;
176
+ if (C == null) return document.createTextNode(b);
177
+ t = document.createElementNS(i, C, b.is && b), r && (A.__m && A.__m(e, s), r = !1), s = null;
178
178
  }
179
- if (w == null) _ === b || r && t.data == b || (t.data = b);
179
+ if (C == null) _ === b || r && t.data == b || (t.data = b);
180
180
  else {
181
- if (s = s && fe.call(t.childNodes), _ = n.props || ee, !r && s != null) for (_ = {}, u = 0; u < t.attributes.length; u++) _[(f = t.attributes[u]).name] = f.value;
182
- for (u in _) if (f = _[u], u != "children") {
183
- if (u == "dangerouslySetInnerHTML") c = f;
184
- else if (!(u in b)) {
185
- if (u == "value" && "defaultValue" in b || u == "checked" && "defaultChecked" in b) continue;
186
- re(t, u, null, f, i);
181
+ if (s = s && fe.call(t.childNodes), _ = n.props || ee, !r && s != null) for (_ = {}, c = 0; c < t.attributes.length; c++) _[(f = t.attributes[c]).name] = f.value;
182
+ for (c in _) if (f = _[c], c != "children") {
183
+ if (c == "dangerouslySetInnerHTML") u = f;
184
+ else if (!(c in b)) {
185
+ if (c == "value" && "defaultValue" in b || c == "checked" && "defaultChecked" in b) continue;
186
+ re(t, c, null, f, i);
187
187
  }
188
188
  }
189
- for (u in b) f = b[u], u == "children" ? h = f : u == "dangerouslySetInnerHTML" ? d = f : u == "value" ? k = f : u == "checked" ? p = f : r && typeof f != "function" || _[u] === f || re(t, u, f, _[u], i);
190
- if (d) r || c && (d.__html == c.__html || d.__html == t.innerHTML) || (t.innerHTML = d.__html), e.__k = [];
191
- else if (c && (t.innerHTML = ""), rt(e.type == "template" ? t.content : t, me(h) ? h : [h], e, n, o, w == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, a, s ? s[0] : n.__k && K(n, 0), r, l), s != null) for (u = s.length; u--; ) ze(s[u]);
192
- r || (u = "value", w == "progress" && k == null ? t.removeAttribute("value") : k != null && (k !== t[u] || w == "progress" && !k || w == "option" && k != _[u]) && re(t, u, k, _[u], i), u = "checked", p != null && p != t[u] && re(t, u, p, _[u], i));
189
+ for (c in b) f = b[c], c == "children" ? h = f : c == "dangerouslySetInnerHTML" ? d = f : c == "value" ? k = f : c == "checked" ? p = f : r && typeof f != "function" || _[c] === f || re(t, c, f, _[c], i);
190
+ if (d) r || u && (d.__html == u.__html || d.__html == t.innerHTML) || (t.innerHTML = d.__html), e.__k = [];
191
+ else if (u && (t.innerHTML = ""), rt(e.type == "template" ? t.content : t, me(h) ? h : [h], e, n, o, C == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, a, s ? s[0] : n.__k && K(n, 0), r, l), s != null) for (c = s.length; c--; ) ze(s[c]);
192
+ r || (c = "value", C == "progress" && k == null ? t.removeAttribute("value") : k != null && (k !== t[c] || C == "progress" && !k || C == "option" && k != _[c]) && re(t, c, k, _[c], i), c = "checked", p != null && p != t[c] && re(t, c, p, _[c], i));
193
193
  }
194
194
  return t;
195
195
  }
@@ -200,16 +200,16 @@ function Le(t, e, n) {
200
200
  o && t.__u(), o && e == null || (t.__u = t(e));
201
201
  } else t.current = e;
202
202
  } catch (i) {
203
- M.__e(i, n);
203
+ A.__e(i, n);
204
204
  }
205
205
  }
206
206
  function lt(t, e, n) {
207
207
  var o, i;
208
- if (M.unmount && M.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || Le(o, null, e)), (o = t.__c) != null) {
208
+ if (A.unmount && A.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || Le(o, null, e)), (o = t.__c) != null) {
209
209
  if (o.componentWillUnmount) try {
210
210
  o.componentWillUnmount();
211
211
  } catch (s) {
212
- M.__e(s, e);
212
+ A.__e(s, e);
213
213
  }
214
214
  o.base = o.__P = null;
215
215
  }
@@ -221,7 +221,7 @@ function Et(t, e, n) {
221
221
  }
222
222
  function Re(t, e, n) {
223
223
  var o, i, s, a;
224
- e == document && (e = document.documentElement), M.__ && M.__(t, e), i = (o = !1) ? null : e.__k, s = [], a = [], Ee(e, t = e.__k = Tt(_e, null, [t]), i || ee, ee, e.namespaceURI, i ? null : e.firstChild ? fe.call(e.childNodes) : null, s, i ? i.__e : e.firstChild, o, a), st(s, t, a);
224
+ e == document && (e = document.documentElement), A.__ && A.__(t, e), i = (o = !1) ? null : e.__k, s = [], a = [], Ee(e, t = e.__k = Tt(_e, null, [t]), i || ee, ee, e.namespaceURI, i ? null : e.firstChild ? fe.call(e.childNodes) : null, s, i ? i.__e : e.firstChild, o, a), st(s, t, a);
225
225
  }
226
226
  function Lt(t) {
227
227
  function e(n) {
@@ -246,7 +246,7 @@ function Lt(t) {
246
246
  return n.children(o);
247
247
  }).contextType = e, e;
248
248
  }
249
- fe = nt.slice, M = { __e: function(t, e, n, o) {
249
+ fe = nt.slice, A = { __e: function(t, e, n, o) {
250
250
  for (var i, s, a; e = e.__; ) if ((i = e.__c) && !i.__) try {
251
251
  if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), a = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, o || {}), a = i.__d), a) return i.__E = i;
252
252
  } catch (r) {
@@ -260,62 +260,62 @@ fe = nt.slice, M = { __e: function(t, e, n, o) {
260
260
  this.__v && (this.__e = !0, t && this.__h.push(t), be(this));
261
261
  }, ae.prototype.render = _e, X = [], Ze = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Qe = function(t, e) {
262
262
  return t.__v.__b - e.__v.__b;
263
- }, de.__r = 0, et = /(PointerCapture)$|Capture$/i, Se = 0, Ce = Ie(!1), ye = Ie(!0), tt = 0;
263
+ }, de.__r = 0, et = /(PointerCapture)$|Capture$/i, Se = 0, we = xe(!1), ye = xe(!0), tt = 0;
264
264
  var Nt = 0;
265
265
  function m(t, e, n, o, i, s) {
266
266
  e || (e = {});
267
267
  var a, r, l = e;
268
268
  if ("ref" in l) for (r in l = {}, e) r == "ref" ? a = e[r] : l[r] = e[r];
269
- var u = { type: t, props: l, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Nt, __i: -1, __u: 0, __source: i, __self: s };
269
+ var c = { type: t, props: l, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Nt, __i: -1, __u: 0, __source: i, __self: s };
270
270
  if (typeof t == "function" && (a = t.defaultProps)) for (r in a) l[r] === void 0 && (l[r] = a[r]);
271
- return M.vnode && M.vnode(u), u;
271
+ return A.vnode && A.vnode(c), c;
272
272
  }
273
- var J, I, pe, Fe, te = 0, ct = [], F = M, De = F.__b, Oe = F.__r, $e = F.diffed, Ue = F.__c, Ge = F.unmount, We = F.__;
273
+ var J, x, pe, Fe, te = 0, ct = [], F = A, De = F.__b, Oe = F.__r, $e = F.diffed, Ue = F.__c, Ge = F.unmount, We = F.__;
274
274
  function ve(t, e) {
275
- F.__h && F.__h(I, t, te || e), te = 0;
276
- var n = I.__H || (I.__H = { __: [], __h: [] });
275
+ F.__h && F.__h(x, t, te || e), te = 0;
276
+ var n = x.__H || (x.__H = { __: [], __h: [] });
277
277
  return t >= n.__.length && n.__.push({}), n.__[t];
278
278
  }
279
279
  function U(t) {
280
- return te = 1, At(dt, t);
280
+ return te = 1, Mt(dt, t);
281
281
  }
282
- function At(t, e, n) {
282
+ function Mt(t, e, n) {
283
283
  var o = ve(J++, 2);
284
284
  if (o.t = t, !o.__c && (o.__ = [dt(void 0, e), function(r) {
285
- var l = o.__N ? o.__N[0] : o.__[0], u = o.t(l, r);
286
- l !== u && (o.__N = [u, o.__[1]], o.__c.setState({}));
287
- }], o.__c = I, !I.__f)) {
288
- var i = function(r, l, u) {
285
+ var l = o.__N ? o.__N[0] : o.__[0], c = o.t(l, r);
286
+ l !== c && (o.__N = [c, o.__[1]], o.__c.setState({}));
287
+ }], o.__c = x, !x.__f)) {
288
+ var i = function(r, l, c) {
289
289
  if (!o.__c.__H) return !0;
290
290
  var d = o.__c.__H.__.filter(function(h) {
291
291
  return !!h.__c;
292
292
  });
293
293
  if (d.every(function(h) {
294
294
  return !h.__N;
295
- })) return !s || s.call(this, r, l, u);
296
- var c = o.__c.props !== r;
295
+ })) return !s || s.call(this, r, l, c);
296
+ var u = o.__c.props !== r;
297
297
  return d.forEach(function(h) {
298
298
  if (h.__N) {
299
299
  var f = h.__[0];
300
- h.__ = h.__N, h.__N = void 0, f !== h.__[0] && (c = !0);
300
+ h.__ = h.__N, h.__N = void 0, f !== h.__[0] && (u = !0);
301
301
  }
302
- }), s && s.call(this, r, l, u) || c;
302
+ }), s && s.call(this, r, l, c) || u;
303
303
  };
304
- I.__f = !0;
305
- var s = I.shouldComponentUpdate, a = I.componentWillUpdate;
306
- I.componentWillUpdate = function(r, l, u) {
304
+ x.__f = !0;
305
+ var s = x.shouldComponentUpdate, a = x.componentWillUpdate;
306
+ x.componentWillUpdate = function(r, l, c) {
307
307
  if (this.__e) {
308
308
  var d = s;
309
- s = void 0, i(r, l, u), s = d;
309
+ s = void 0, i(r, l, c), s = d;
310
310
  }
311
- a && a.call(this, r, l, u);
312
- }, I.shouldComponentUpdate = i;
311
+ a && a.call(this, r, l, c);
312
+ }, x.shouldComponentUpdate = i;
313
313
  }
314
314
  return o.__N || o.__;
315
315
  }
316
316
  function R(t, e) {
317
317
  var n = ve(J++, 3);
318
- !F.__s && ut(n.__H, e) && (n.__ = t, n.u = e, I.__H.__h.push(n));
318
+ !F.__s && ut(n.__H, e) && (n.__ = t, n.u = e, x.__H.__h.push(n));
319
319
  }
320
320
  function O(t) {
321
321
  return te = 5, Z(function() {
@@ -331,9 +331,9 @@ function je(t, e) {
331
331
  return t;
332
332
  }, e);
333
333
  }
334
- function Mt(t) {
335
- var e = I.context[t.__c], n = ve(J++, 9);
336
- return n.c = t, e ? (n.__ == null && (n.__ = !0, e.sub(I)), e.props.value) : t.__;
334
+ function At(t) {
335
+ var e = x.context[t.__c], n = ve(J++, 9);
336
+ return n.c = t, e ? (n.__ == null && (n.__ = !0, e.sub(x)), e.props.value) : t.__;
337
337
  }
338
338
  function Pt() {
339
339
  for (var t; t = ct.shift(); ) if (t.__P && t.__H) try {
@@ -343,21 +343,21 @@ function Pt() {
343
343
  }
344
344
  }
345
345
  F.__b = function(t) {
346
- I = null, De && De(t);
346
+ x = null, De && De(t);
347
347
  }, F.__ = function(t, e) {
348
348
  t && e.__k && e.__k.__m && (t.__m = e.__k.__m), We && We(t, e);
349
349
  }, F.__r = function(t) {
350
350
  Oe && Oe(t), J = 0;
351
- var e = (I = t.__c).__H;
352
- e && (pe === I ? (e.__h = [], I.__h = [], e.__.forEach(function(n) {
351
+ var e = (x = t.__c).__H;
352
+ e && (pe === x ? (e.__h = [], x.__h = [], e.__.forEach(function(n) {
353
353
  n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
354
- })) : (e.__h.forEach(le), e.__h.forEach(Te), e.__h = [], J = 0)), pe = I;
354
+ })) : (e.__h.forEach(le), e.__h.forEach(Te), e.__h = [], J = 0)), pe = x;
355
355
  }, F.diffed = function(t) {
356
356
  $e && $e(t);
357
357
  var e = t.__c;
358
- e && e.__H && (e.__H.__h.length && (ct.push(e) !== 1 && Fe === F.requestAnimationFrame || ((Fe = F.requestAnimationFrame) || xt)(Pt)), e.__H.__.forEach(function(n) {
358
+ e && e.__H && (e.__H.__h.length && (ct.push(e) !== 1 && Fe === F.requestAnimationFrame || ((Fe = F.requestAnimationFrame) || It)(Pt)), e.__H.__.forEach(function(n) {
359
359
  n.u && (n.__H = n.u), n.u = void 0;
360
- })), pe = I = null;
360
+ })), pe = x = null;
361
361
  }, F.__c = function(t, e) {
362
362
  e.some(function(n) {
363
363
  try {
@@ -382,19 +382,19 @@ F.__b = function(t) {
382
382
  }), n.__H = void 0, e && F.__e(e, n.__v));
383
383
  };
384
384
  var qe = typeof requestAnimationFrame == "function";
385
- function xt(t) {
385
+ function It(t) {
386
386
  var e, n = function() {
387
387
  clearTimeout(o), qe && cancelAnimationFrame(e), setTimeout(t);
388
388
  }, o = setTimeout(n, 100);
389
389
  qe && (e = requestAnimationFrame(n));
390
390
  }
391
391
  function le(t) {
392
- var e = I, n = t.__c;
393
- typeof n == "function" && (t.__c = void 0, n()), I = e;
392
+ var e = x, n = t.__c;
393
+ typeof n == "function" && (t.__c = void 0, n()), x = e;
394
394
  }
395
395
  function Te(t) {
396
- var e = I;
397
- t.__c = t.__(), I = e;
396
+ var e = x;
397
+ t.__c = t.__(), x = e;
398
398
  }
399
399
  function ut(t, e) {
400
400
  return !t || t.length !== e.length || e.some(function(n, o) {
@@ -404,7 +404,7 @@ function ut(t, e) {
404
404
  function dt(t, e) {
405
405
  return typeof e == "function" ? e(t) : e;
406
406
  }
407
- const It = (t) => ({
407
+ const xt = (t) => ({
408
408
  saveGameData(e) {
409
409
  try {
410
410
  localStorage.setItem(t, JSON.stringify(e));
@@ -448,15 +448,15 @@ const It = (t) => ({
448
448
  playerPath: [],
449
449
  visitCounts: {}
450
450
  }, Rt = ({ children: t, config: e }) => {
451
- const n = It(e.lcPrefix + "progress"), o = n.loadGameData(), [i, s] = U(() => o || { ...He });
451
+ const n = xt(e.lcPrefix + "progress"), o = n.loadGameData(), [i, s] = U(() => o || { ...He });
452
452
  R(() => {
453
- const c = Object.values(i.levelScores).reduce(
453
+ const u = Object.values(i.levelScores).reduce(
454
454
  (h, f) => h + f,
455
455
  0
456
456
  );
457
457
  s((h) => ({
458
458
  ...h,
459
- totalScore: c
459
+ totalScore: u
460
460
  }));
461
461
  }, [i.levelScores]), R(() => {
462
462
  n.saveGameData(i);
@@ -474,7 +474,7 @@ const It = (t) => ({
474
474
  R(() => {
475
475
  l.current = a;
476
476
  }, [a]);
477
- const u = Z(() => [
477
+ const c = Z(() => [
478
478
  a.playerAtExit ? 1 : 0,
479
479
  a.foodCollected === a.totalFoodCount ? 1 : 0,
480
480
  a.showClue ? 0 : 1
@@ -499,7 +499,7 @@ const It = (t) => ({
499
499
  gamePlayState: a,
500
500
  setGamePlayState: r,
501
501
  gamePlayStateRef: l,
502
- currentScore: u,
502
+ currentScore: c,
503
503
  config: e,
504
504
  resetGame: d
505
505
  },
@@ -507,7 +507,7 @@ const It = (t) => ({
507
507
  }
508
508
  );
509
509
  }, ne = () => {
510
- const t = Mt(ht);
510
+ const t = At(ht);
511
511
  if (!t)
512
512
  throw new Error("useGameContext must be used within a GameProvider");
513
513
  return t;
@@ -515,22 +515,22 @@ const It = (t) => ({
515
515
  const e = t.map((r) => r.length), n = e.reduce((r, l) => r + l, 0), o = t.length, i = (r) => {
516
516
  if (r < 1 || r > n) return 0;
517
517
  let l = 0;
518
- for (let u = 0; u < e.length; u++)
519
- if (l += e[u], r <= l) return u + 1;
518
+ for (let c = 0; c < e.length; c++)
519
+ if (l += e[c], r <= l) return c + 1;
520
520
  return 0;
521
- }, s = (r) => r < 1 || r > o ? 0 : e.slice(0, r - 1).reduce((l, u) => l + u, 0) + 1, a = {
521
+ }, s = (r) => r < 1 || r > o ? 0 : e.slice(0, r - 1).reduce((l, c) => l + c, 0) + 1, a = {
522
522
  getTotalLevels: () => n,
523
523
  getTotalTiers: () => o,
524
524
  getTierLevelsRange: (r) => {
525
525
  if (r < 1 || r > o) return [0, 0];
526
- const l = s(r), u = l + e[r - 1] - 1;
527
- return [l, u];
526
+ const l = s(r), c = l + e[r - 1] - 1;
527
+ return [l, c];
528
528
  },
529
529
  getTierByLevel: i,
530
530
  getFirstLevelOfTier: s,
531
531
  getLevelConfig: (r) => {
532
532
  if (r < 1 || r > n) return null;
533
- const l = i(r), u = s(l), d = r - u;
533
+ const l = i(r), c = s(l), d = r - c;
534
534
  return t[l - 1][d];
535
535
  },
536
536
  getTierConfig: (r) => r < 1 || r > o ? null : t[r - 1],
@@ -538,34 +538,34 @@ const It = (t) => ({
538
538
  isTierUnlocked: (r, l) => r <= l,
539
539
  getNextLevelInfo: (r) => {
540
540
  if (r >= n) return null;
541
- const l = r + 1, u = i(r), d = i(l);
541
+ const l = r + 1, c = i(r), d = i(l);
542
542
  return {
543
543
  nextLevel: l,
544
544
  nextTier: d,
545
- isTierChange: d > u
545
+ isTierChange: d > c
546
546
  };
547
547
  },
548
548
  getCurrentTierProgress: (r, l) => {
549
- const [u, d] = a.getTierLevelsRange(l), c = r - u + 1, h = d - u + 1;
550
- return { current: c, total: h };
549
+ const [c, d] = a.getTierLevelsRange(l), u = r - c + 1, h = d - c + 1;
550
+ return { current: u, total: h };
551
551
  },
552
552
  isLastLevelInTier: (r) => {
553
- const l = i(r), [, u] = a.getTierLevelsRange(l);
554
- return r === u;
553
+ const l = i(r), [, c] = a.getTierLevelsRange(l);
554
+ return r === c;
555
555
  },
556
556
  getPreviousLevelInfo: (r) => {
557
557
  if (r <= 1) return null;
558
- const l = r - 1, u = i(r), d = i(l);
558
+ const l = r - 1, c = i(r), d = i(l);
559
559
  return {
560
560
  prevLevel: l,
561
561
  prevTier: d,
562
- isTierChange: d < u
562
+ isTierChange: d < c
563
563
  };
564
564
  }
565
565
  };
566
566
  return a;
567
567
  }, [t]), Ft = ({ onTierChange: t, disabled: e }) => {
568
- const { gameProgress: n, config: o } = ne(), { i18n: i, levelConfig: s } = o, { currentTier: a, highestUnlockedTier: r } = n, u = oe(s).getTotalTiers();
568
+ const { gameProgress: n, config: o } = ne(), { i18n: i, levelConfig: s } = o, { currentTier: a, highestUnlockedTier: r } = n, c = oe(s).getTotalTiers();
569
569
  return /* @__PURE__ */ m("div", { className: "tier-selector", children: /* @__PURE__ */ m(
570
570
  "select",
571
571
  {
@@ -575,7 +575,7 @@ const It = (t) => ({
575
575
  },
576
576
  disabled: e,
577
577
  className: "tier-dropdown",
578
- children: Array.from({ length: u }, (d, c) => c + 1).map((d) => /* @__PURE__ */ m(
578
+ children: Array.from({ length: c }, (d, u) => u + 1).map((d) => /* @__PURE__ */ m(
579
579
  "option",
580
580
  {
581
581
  value: d,
@@ -587,7 +587,7 @@ const It = (t) => ({
587
587
  }
588
588
  ) });
589
589
  }, Dt = ({ onLevelChange: t, disabled: e }) => {
590
- const { gameProgress: n, config: o } = ne(), { i18n: i, levelConfig: s } = o, { currentTier: a, levelScores: r, currentLevel: l, highestUnlockedLevel: u } = n, d = oe(s), c = Z(() => {
590
+ const { gameProgress: n, config: o } = ne(), { i18n: i, levelConfig: s } = o, { currentTier: a, levelScores: r, currentLevel: l, highestUnlockedLevel: c } = n, d = oe(s), u = Z(() => {
591
591
  const [h, f] = d.getTierLevelsRange(a);
592
592
  return Array.from({ length: f - h + 1 }, (k, p) => {
593
593
  const _ = h + p, b = r[_] || 0;
@@ -606,11 +606,11 @@ const It = (t) => ({
606
606
  },
607
607
  disabled: e,
608
608
  className: "level-dropdown",
609
- children: c.map(({ level: h, score: f }) => /* @__PURE__ */ m(
609
+ children: u.map(({ level: h, score: f }) => /* @__PURE__ */ m(
610
610
  "option",
611
611
  {
612
612
  value: h,
613
- disabled: h > u,
613
+ disabled: h > c,
614
614
  children: `${i.level} ${h} ${"★".repeat(f)}`
615
615
  },
616
616
  `level-${h}`
@@ -627,9 +627,9 @@ const It = (t) => ({
627
627
  noCancel: a = !1,
628
628
  confirmText: r = "OK",
629
629
  cancelText: l = "Cancel",
630
- confirmClass: u = "",
630
+ confirmClass: c = "",
631
631
  cancelClass: d = "",
632
- onConfirm: c,
632
+ onConfirm: u,
633
633
  onCancel: h
634
634
  }) => {
635
635
  const f = O(null);
@@ -661,8 +661,8 @@ const It = (t) => ({
661
661
  "button",
662
662
  {
663
663
  type: "button",
664
- className: "maze-dialog-confirm " + u,
665
- onClick: c,
664
+ className: "maze-dialog-confirm " + c,
665
+ onClick: u,
666
666
  children: r
667
667
  }
668
668
  )
@@ -709,31 +709,31 @@ const It = (t) => ({
709
709
  gamePlayStateRef: i,
710
710
  resetGame: s,
711
711
  config: a
712
- } = ne(), { i18n: r, levelConfig: l } = a, u = oe(l), { levelTransitioning: d, showClue: c } = n, { highestUnlockedLevel: h, totalScore: f } = t, k = u.getTotalLevels(), [p, _] = U(!1), [b, w] = U(!1), [A, C] = U(!1), z = (D) => {
713
- const x = u.getFirstLevelOfTier(D);
714
- u.isLevelUnlocked(x, h) && (e(($) => ({ ...$, currentTier: D })), S(x));
712
+ } = ne(), { i18n: r, levelConfig: l } = a, c = oe(l), { levelTransitioning: d, showClue: u } = n, { highestUnlockedLevel: h, totalScore: f } = t, k = c.getTotalLevels(), [p, _] = U(!1), [b, C] = U(!1), [M, w] = U(!1), z = (D) => {
713
+ const I = c.getFirstLevelOfTier(D);
714
+ c.isLevelUnlocked(I, h) && (e(($) => ({ ...$, currentTier: D })), S(I));
715
715
  }, S = (D) => {
716
- u.isLevelUnlocked(D, h) && (e((x) => ({ ...x, currentLevel: D })), j.show(r.levelGoToast.replace("%LEVEL%", D.toString())));
716
+ c.isLevelUnlocked(D, h) && (e((I) => ({ ...I, currentLevel: D })), j.show(r.levelGoToast.replace("%LEVEL%", D.toString())));
717
717
  }, E = () => {
718
718
  _(!0);
719
719
  }, L = () => {
720
720
  _(!1);
721
721
  }, y = () => {
722
- C(!0);
722
+ w(!0);
723
723
  }, g = () => {
724
- C(!1);
724
+ w(!1);
725
725
  }, v = () => {
726
- j.show(c ? r.cluePathDisabled : r.cluePathEnabled), o(() => ({
726
+ j.show(u ? r.cluePathDisabled : r.cluePathEnabled), o(() => ({
727
727
  ...i.current,
728
728
  // need to sync with ref
729
729
  showClue: !i.current.showClue
730
- })), C(!1);
730
+ })), w(!1);
731
731
  }, T = () => {
732
- w(!0);
732
+ C(!0);
733
733
  }, N = () => {
734
- s(), w(!1), j.show(r.resetDoneToast);
734
+ s(), C(!1), j.show(r.resetDoneToast);
735
735
  }, P = () => {
736
- w(!1);
736
+ C(!1);
737
737
  };
738
738
  return /* @__PURE__ */ m("div", { class: "game-panel-container", children: [
739
739
  /* @__PURE__ */ m("div", { className: "game-controls", children: [
@@ -756,11 +756,11 @@ const It = (t) => ({
756
756
  /* @__PURE__ */ m(
757
757
  "button",
758
758
  {
759
- className: `settings-clue-button ${c ? "clue-on" : "clue-off"}`,
760
- disabled: c,
759
+ className: `settings-clue-button ${u ? "clue-on" : "clue-off"}`,
760
+ disabled: u,
761
761
  title: "Toggle Clue",
762
762
  onClick: y,
763
- children: c ? r.clueOn : r.clueOff
763
+ children: u ? r.clueOn : r.clueOff
764
764
  }
765
765
  )
766
766
  ] }),
@@ -809,7 +809,7 @@ const It = (t) => ({
809
809
  /* @__PURE__ */ m(
810
810
  Q,
811
811
  {
812
- isOpen: A,
812
+ isOpen: M,
813
813
  title: r.confirmClue,
814
814
  message: r.confirmClueMessage,
815
815
  confirmText: r.confirm,
@@ -830,7 +830,7 @@ function $t(t, e) {
830
830
  o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, o.key, o);
831
831
  }
832
832
  }
833
- function Ae(t, e, n) {
833
+ function Me(t, e, n) {
834
834
  return e && $t(t.prototype, e), t;
835
835
  }
836
836
  function Be(t) {
@@ -855,7 +855,7 @@ function Xe(t) {
855
855
  var Ye = /* @__PURE__ */ function() {
856
856
  function t(e) {
857
857
  Ne(this, t);
858
- var n = e.initialPosition, o = e.direction, i = e.confettiRadius, s = e.confettiColors, a = e.emojis, r = e.emojiSize, l = e.canvasWidth, u = W(Vt, Xt, 3), d = u * Xe(l);
858
+ var n = e.initialPosition, o = e.direction, i = e.confettiRadius, s = e.confettiColors, a = e.emojis, r = e.emojiSize, l = e.canvasWidth, c = W(Vt, Xt, 3), d = c * Xe(l);
859
859
  this.confettiSpeed = {
860
860
  x: d,
861
861
  y: d
@@ -863,25 +863,25 @@ var Ye = /* @__PURE__ */ function() {
863
863
  x: i,
864
864
  y: i
865
865
  }, this.initialRadius = i, this.rotationAngle = o === "left" ? W(0, 0.2, 3) : W(-0.2, 0, 3), this.emojiSize = r, this.emojiRotationAngle = W(0, 2 * Math.PI), this.radiusYUpdateDirection = "down";
866
- var c = o === "left" ? W(en, Qt) * Math.PI / 180 : W(-15, -82) * Math.PI / 180;
867
- this.absCos = Math.abs(Math.cos(c)), this.absSin = Math.abs(Math.sin(c));
866
+ var u = o === "left" ? W(en, Qt) * Math.PI / 180 : W(-15, -82) * Math.PI / 180;
867
+ this.absCos = Math.abs(Math.cos(u)), this.absSin = Math.abs(Math.sin(u));
868
868
  var h = W(-150, 0), f = {
869
869
  x: n.x + (o === "left" ? -h : h) * this.absCos,
870
870
  y: n.y - h * this.absSin
871
871
  };
872
872
  this.currentPosition = Object.assign({}, f), this.initialPosition = Object.assign({}, f), this.color = a.length ? null : Ve(s), this.emoji = a.length ? Ve(a) : null, this.createdAt = (/* @__PURE__ */ new Date()).getTime(), this.direction = o;
873
873
  }
874
- return Ae(t, [{
874
+ return Me(t, [{
875
875
  key: "draw",
876
876
  value: function(n) {
877
- var o = this.currentPosition, i = this.radius, s = this.color, a = this.emoji, r = this.rotationAngle, l = this.emojiRotationAngle, u = this.emojiSize, d = window.devicePixelRatio;
878
- s ? (n.fillStyle = s, n.beginPath(), n.ellipse(o.x * d, o.y * d, i.x * d, i.y * d, r, 0, 2 * Math.PI), n.fill()) : a && (n.font = "".concat(u, "px serif"), n.save(), n.translate(d * o.x, d * o.y), n.rotate(l), n.textAlign = "center", n.fillText(a, 0, 0), n.restore());
877
+ var o = this.currentPosition, i = this.radius, s = this.color, a = this.emoji, r = this.rotationAngle, l = this.emojiRotationAngle, c = this.emojiSize, d = window.devicePixelRatio;
878
+ s ? (n.fillStyle = s, n.beginPath(), n.ellipse(o.x * d, o.y * d, i.x * d, i.y * d, r, 0, 2 * Math.PI), n.fill()) : a && (n.font = "".concat(c, "px serif"), n.save(), n.translate(d * o.x, d * o.y), n.rotate(l), n.textAlign = "center", n.fillText(a, 0, 0), n.restore());
879
879
  }
880
880
  }, {
881
881
  key: "updatePosition",
882
882
  value: function(n, o) {
883
- var i = this.confettiSpeed, s = this.dragForceCoefficient, a = this.finalConfettiSpeedX, r = this.radiusYUpdateDirection, l = this.rotationSpeed, u = this.createdAt, d = this.direction, c = o - u;
884
- if (i.x > a && (this.confettiSpeed.x -= s * n), this.currentPosition.x += i.x * (d === "left" ? -this.absCos : this.absCos) * n, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * c + Gt * Math.pow(c, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : qt * n, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
883
+ var i = this.confettiSpeed, s = this.dragForceCoefficient, a = this.finalConfettiSpeedX, r = this.radiusYUpdateDirection, l = this.rotationSpeed, c = this.createdAt, d = this.direction, u = o - c;
884
+ if (i.x > a && (this.confettiSpeed.x -= s * n), this.currentPosition.x += i.x * (d === "left" ? -this.absCos : this.absCos) * n, this.currentPosition.y = this.initialPosition.y - i.y * this.absSin * u + Gt * Math.pow(u, 2) / 2, this.rotationSpeed -= this.emoji ? 1e-4 : qt * n, this.rotationSpeed < 0 && (this.rotationSpeed = 0), this.emoji) {
885
885
  this.emojiRotationAngle += this.rotationSpeed * n % (2 * Math.PI);
886
886
  return;
887
887
  }
@@ -899,7 +899,7 @@ function sn() {
899
899
  return t.style.position = "fixed", t.style.width = "100%", t.style.height = "100%", t.style.top = "0", t.style.left = "0", t.style.zIndex = "1000", t.style.pointerEvents = "none", document.body.appendChild(t), t;
900
900
  }
901
901
  function an(t) {
902
- var e = t.confettiRadius, n = e === void 0 ? Ht : e, o = t.confettiNumber, i = o === void 0 ? t.confettiesNumber || (t.emojis ? on : nn) : o, s = t.confettiColors, a = s === void 0 ? rn : s, r = t.emojis, l = r === void 0 ? t.emojies || [] : r, u = t.emojiSize, d = u === void 0 ? Bt : u;
902
+ var e = t.confettiRadius, n = e === void 0 ? Ht : e, o = t.confettiNumber, i = o === void 0 ? t.confettiesNumber || (t.emojis ? on : nn) : o, s = t.confettiColors, a = s === void 0 ? rn : s, r = t.emojis, l = r === void 0 ? t.emojies || [] : r, c = t.emojiSize, d = c === void 0 ? Bt : c;
903
903
  return t.emojies && console.error("emojies argument is deprecated, please use emojis instead"), t.confettiesNumber && console.error("confettiesNumber argument is deprecated, please use confettiNumber instead"), {
904
904
  confettiRadius: n,
905
905
  confettiNumber: i,
@@ -915,7 +915,7 @@ var ln = /* @__PURE__ */ function() {
915
915
  return n.resolvePromise = o;
916
916
  });
917
917
  }
918
- return Ae(t, [{
918
+ return Me(t, [{
919
919
  key: "getBatchCompletePromise",
920
920
  value: function() {
921
921
  return this.promise;
@@ -946,7 +946,7 @@ var ln = /* @__PURE__ */ function() {
946
946
  var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
947
947
  Ne(this, t), this.activeConfettiBatches = [], this.canvas = e.canvas || sn(), this.canvasContext = this.canvas.getContext("2d"), this.requestAnimationFrameRequested = !1, this.lastUpdated = (/* @__PURE__ */ new Date()).getTime(), this.iterationIndex = 0, this.loop = this.loop.bind(this), requestAnimationFrame(this.loop);
948
948
  }
949
- return Ae(t, [{
949
+ return Me(t, [{
950
950
  key: "loop",
951
951
  value: function() {
952
952
  this.requestAnimationFrameRequested = !1, Ut(this.canvas);
@@ -966,7 +966,7 @@ var ln = /* @__PURE__ */ function() {
966
966
  }, {
967
967
  key: "addConfetti",
968
968
  value: function() {
969
- for (var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, o = an(n), i = o.confettiRadius, s = o.confettiNumber, a = o.confettiColors, r = o.emojis, l = o.emojiSize, u = this.canvas.getBoundingClientRect(), d = u.width, c = u.height, h = c * 5 / 7, f = {
969
+ for (var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, o = an(n), i = o.confettiRadius, s = o.confettiNumber, a = o.confettiColors, r = o.emojis, l = o.emojiSize, c = this.canvas.getBoundingClientRect(), d = c.width, u = c.height, h = u * 5 / 7, f = {
970
970
  x: 0,
971
971
  y: h
972
972
  }, k = {
@@ -982,7 +982,7 @@ var ln = /* @__PURE__ */ function() {
982
982
  emojis: r,
983
983
  emojiSize: l,
984
984
  canvasWidth: d
985
- }), w = new Ye({
985
+ }), C = new Ye({
986
986
  initialPosition: k,
987
987
  direction: "left",
988
988
  confettiRadius: i,
@@ -992,7 +992,7 @@ var ln = /* @__PURE__ */ function() {
992
992
  emojiSize: l,
993
993
  canvasWidth: d
994
994
  });
995
- p.addShapes(b, w);
995
+ p.addShapes(b, C);
996
996
  }
997
997
  return this.activeConfettiBatches.push(p), this.queueAnimationFrameIfNeeded(), p.getBatchCompletePromise();
998
998
  }
@@ -1008,7 +1008,7 @@ var ln = /* @__PURE__ */ function() {
1008
1008
  }
1009
1009
  }]), t;
1010
1010
  }();
1011
- const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1011
+ const un = new cn(), Ce = 3, dn = ({ onRetry: t }) => {
1012
1012
  const {
1013
1013
  config: e,
1014
1014
  currentScore: n,
@@ -1016,21 +1016,21 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1016
1016
  setGamePlayState: i,
1017
1017
  gameProgress: s,
1018
1018
  setGameProgress: a
1019
- } = ne(), { i18n: r, levelConfig: l } = e, [u, d, c] = n, { foodCollected: h, totalFoodCount: f, playerAtExit: k, levelTransitioning: p } = o, { currentLevel: _ } = s, [b, w] = U(!1);
1019
+ } = ne(), { i18n: r, levelConfig: l } = e, [c, d, u] = n, { foodCollected: h, totalFoodCount: f, playerAtExit: k, levelTransitioning: p } = o, { currentLevel: _ } = s, [b, C] = U(!1);
1020
1020
  R(() => {
1021
- k && p && (un.addConfetti(), j.show(r.levelCompleteToast), w(!0));
1021
+ k && p && (un.addConfetti(), j.show(r.levelCompleteToast), C(!0));
1022
1022
  }, [k, p]);
1023
- const A = oe(l), C = A.getTotalLevels(), z = Z(() => _ >= C, [_, C]), S = () => {
1024
- w(!1), j.show(r.levelRestartToast), t?.();
1023
+ const M = oe(l), w = M.getTotalLevels(), z = Z(() => _ >= w, [_, w]), S = () => {
1024
+ C(!1), j.show(r.levelRestartToast), t?.();
1025
1025
  }, E = () => {
1026
- w(!1), i((g) => ({
1026
+ C(!1), i((g) => ({
1027
1027
  ...g,
1028
1028
  isGameActive: !0,
1029
1029
  levelTransitioning: !1
1030
1030
  }));
1031
1031
  }, L = () => {
1032
- w(!1);
1033
- const g = A.getNextLevelInfo(_);
1032
+ C(!1);
1033
+ const g = M.getNextLevelInfo(_);
1034
1034
  if (!g) return;
1035
1035
  const { nextLevel: v, nextTier: T, isTierChange: N } = g;
1036
1036
  N && j.show(
@@ -1050,7 +1050,7 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1050
1050
  }
1051
1051
  }));
1052
1052
  }, y = () => {
1053
- w(!1), a((g) => {
1053
+ C(!1), a((g) => {
1054
1054
  const v = Math.max(
1055
1055
  Object.values(n).filter(Boolean).length,
1056
1056
  g.levelScores[g.currentLevel] || 0
@@ -1060,14 +1060,14 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1060
1060
  };
1061
1061
  let N = 0, P = 0;
1062
1062
  const D = Object.entries(T).sort(
1063
- (x, $) => Number(x[0]) - Number($[0])
1063
+ (I, $) => Number(I[0]) - Number($[0])
1064
1064
  );
1065
- for (const [x, $] of D)
1066
- if ($ < we) {
1067
- N = Number(x), P = A.getTierByLevel(N);
1065
+ for (const [I, $] of D)
1066
+ if ($ < Ce) {
1067
+ N = Number(I), P = M.getTierByLevel(N);
1068
1068
  break;
1069
1069
  }
1070
- return (N > 0 && N !== _ || v < we) && j.show(r.notCompleteLevel), (N === 0 || v < we) && t?.(), {
1070
+ return (N > 0 && N !== _ || v < Ce) && j.show(r.notCompleteLevel), (N === 0 || v < Ce) && t?.(), {
1071
1071
  ...g,
1072
1072
  currentLevel: N || g.currentLevel,
1073
1073
  currentTier: P || g.currentTier,
@@ -1094,8 +1094,8 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1094
1094
  confirmClass: "maze-continue-btn",
1095
1095
  children: [
1096
1096
  /* @__PURE__ */ m("div", { className: "maze-summary-message", children: [
1097
- !!u && /* @__PURE__ */ m("div", { children: "★ - " + r.findYourExit }),
1098
- /* @__PURE__ */ m("div", { children: c ? "★ - " + r.withoutClue : "☆ - " + r.withClue }),
1097
+ !!c && /* @__PURE__ */ m("div", { children: "★ - " + r.findYourExit }),
1098
+ /* @__PURE__ */ m("div", { children: u ? "★ - " + r.withoutClue : "☆ - " + r.withClue }),
1099
1099
  /* @__PURE__ */ m("div", { children: (d ? "★ - " + r.collectAllStars : "☆ - " + r.notCollectAllStars) + ` (${h}/${f})` })
1100
1100
  ] }),
1101
1101
  z && /* @__PURE__ */ m("div", { className: "all-levels-completed", children: r.allLevelsCompleted }),
@@ -1139,8 +1139,8 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1139
1139
  if (!a) return;
1140
1140
  const r = a.clientWidth, l = window.devicePixelRatio || 1;
1141
1141
  s.style.width = `${r}px`, s.style.height = `${r}px`;
1142
- const u = r * l, d = r * l;
1143
- s.width = u, s.height = d, n.current = { canvasWidth: u, canvasHeight: d }, e?.();
1142
+ const c = r * l, d = r * l;
1143
+ s.width = c, s.height = d, n.current = { canvasWidth: c, canvasHeight: d }, e?.();
1144
1144
  };
1145
1145
  o();
1146
1146
  let i = null;
@@ -1154,10 +1154,10 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1154
1154
  const i = () => {
1155
1155
  const a = t.current, r = e.maze;
1156
1156
  if (!a || !r) return;
1157
- const { rows: l, cols: u } = r;
1158
- if (l <= 0 || u <= 0) return;
1159
- const d = (a.width - n * 2) / u, c = (a.height - n * 2) / l;
1160
- o.current = { cellWidth: d, cellHeight: c };
1157
+ const { rows: l, cols: c } = r;
1158
+ if (l <= 0 || c <= 0) return;
1159
+ const d = (a.width - n * 2) / c, u = (a.height - n * 2) / l;
1160
+ o.current = { cellWidth: d, cellHeight: u };
1161
1161
  };
1162
1162
  i();
1163
1163
  let s = null;
@@ -1184,12 +1184,12 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1184
1184
  onExitReached: r,
1185
1185
  onFirstMove: l
1186
1186
  }) => {
1187
- const u = () => i?.current ?? o ?? 0.03, d = O(!1), c = O(/* @__PURE__ */ new Set()), h = O(!1), f = je(
1188
- (C, z) => {
1187
+ const c = () => i?.current ?? o ?? 0.03, d = O(!1), u = O(/* @__PURE__ */ new Set()), h = O(!1), f = je(
1188
+ (w, z) => {
1189
1189
  const S = e.current;
1190
1190
  if (!S.maze)
1191
1191
  return { canMove: !1, newCell: null };
1192
- const E = u(), [L, y] = ie[C];
1192
+ const E = c(), [L, y] = ie[w];
1193
1193
  if (Ke(
1194
1194
  z,
1195
1195
  L,
@@ -1199,8 +1199,8 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1199
1199
  S.maze
1200
1200
  ))
1201
1201
  return { canMove: !1, newCell: null };
1202
- const { row: v, col: T } = z, N = v + L * E, P = T + y * E, D = -0.5, x = S.maze.rows, $ = S.maze.cols;
1203
- if (N < D || N >= x || P < D || P >= $)
1202
+ const { row: v, col: T } = z, N = v + L * E, P = T + y * E, D = -0.5, I = S.maze.rows, $ = S.maze.cols;
1203
+ if (N < D || N >= I || P < D || P >= $)
1204
1204
  return { canMove: !1, newCell: null };
1205
1205
  const B = v < 0 ? 0 : Math.floor(v), V = T < 0 ? 0 : Math.floor(T), G = N < 0 ? 0 : Math.floor(N), q = P < 0 ? 0 : Math.floor(P);
1206
1206
  return G !== B || q !== V ? S.maze.isValid(G, q) ? {
@@ -1208,9 +1208,9 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1208
1208
  newCell: { row: G, col: q }
1209
1209
  } : { canMove: !1, newCell: null } : { canMove: !0, newCell: null };
1210
1210
  },
1211
- [s, u]
1211
+ [s, c]
1212
1212
  ), k = () => {
1213
- const C = e.current, { row: z, col: S } = C.playerCell, E = s * 2, L = C.foodCells.findIndex((v) => Math.sqrt(
1213
+ const w = e.current, { row: z, col: S } = w.playerCell, E = s * 2, L = w.foodCells.findIndex((v) => Math.sqrt(
1214
1214
  Math.pow(z - v.row, 2) + Math.pow(S - v.col, 2)
1215
1215
  ) < E);
1216
1216
  L !== -1 && a && (a(), e.current = {
@@ -1221,9 +1221,9 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1221
1221
  )
1222
1222
  });
1223
1223
  const g = mn(
1224
- C.playerCell,
1225
- C.exitCell,
1226
- C.maze
1224
+ w.playerCell,
1225
+ w.exitCell,
1226
+ w.maze
1227
1227
  );
1228
1228
  g && !e.current.playerAtExit ? (e.current = {
1229
1229
  ...e.current,
@@ -1242,37 +1242,37 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1242
1242
  isGameActive: !0,
1243
1243
  levelTransitioning: !1
1244
1244
  });
1245
- }, p = (C) => {
1246
- const z = e.current, S = Math.round(C.row), E = Math.round(C.col), L = z.playerPath[z.playerPath.length - 1], y = L.row === S && L.col === E, g = Math.abs(L.row - S), v = Math.abs(L.col - E);
1245
+ }, p = (w) => {
1246
+ const z = e.current, S = Math.round(w.row), E = Math.round(w.col), L = z.playerPath?.[z.playerPath.length - 1], y = L?.row === S && L?.col === E, g = Math.abs(L?.row ?? 0 - S), v = Math.abs(L?.col ?? 0 - E);
1247
1247
  if ((g === 1 && v === 0 || g === 0 && v === 1) && !y) {
1248
- const N = `${L.row},${L.col}-${S},${E}`;
1248
+ const N = `${L?.row},${L?.col}-${S},${E}`;
1249
1249
  e.current = {
1250
1250
  ...e.current,
1251
1251
  playerPath: [
1252
- ...e.current.playerPath,
1252
+ ...e.current.playerPath ?? [],
1253
1253
  { row: S, col: E }
1254
1254
  ],
1255
1255
  visitCounts: {
1256
1256
  ...e.current.visitCounts,
1257
- [N]: (e.current.visitCounts[N] || 0) + 1
1257
+ [N]: (e.current.visitCounts?.[N] || 0) + 1
1258
1258
  }
1259
1259
  };
1260
1260
  }
1261
1261
  }, _ = () => {
1262
- if (d.current || c.current.size === 0) return;
1263
- const C = e.current;
1264
- !C.playerCell || !Array.from(c.current).some(
1262
+ if (d.current || u.current.size === 0) return;
1263
+ const w = e.current;
1264
+ !w.playerCell || !Array.from(u.current).some(
1265
1265
  (S) => {
1266
1266
  const { canMove: E } = f(
1267
1267
  S,
1268
- C.playerCell
1268
+ w.playerCell
1269
1269
  );
1270
1270
  return E;
1271
1271
  }
1272
1272
  ) || (!h.current && l && (h.current = !0, l()), d.current = !0);
1273
1273
  };
1274
1274
  R(() => {
1275
- const C = (y) => {
1275
+ const w = (y) => {
1276
1276
  if (y.key === "ArrowUp" || y.key === "ArrowDown" || y.key === "ArrowLeft" || y.key === "ArrowRight" || y.key === " ") {
1277
1277
  const g = document.activeElement;
1278
1278
  if (g && (g.tagName === "INPUT" || g.tagName === "TEXTAREA" || g.getAttribute("contenteditable") === "true")) return;
@@ -1282,12 +1282,12 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1282
1282
  const g = y.key;
1283
1283
  if (!(g in ie)) return;
1284
1284
  const v = document.activeElement;
1285
- v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.getAttribute("contenteditable") === "true") || (y.preventDefault(), e.current.isGameActive && (c.current.has(g) || (c.current.add(g), d.current || _())));
1285
+ v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.getAttribute("contenteditable") === "true") || (y.preventDefault(), e.current.isGameActive && (u.current.has(g) || (u.current.add(g), d.current || _())));
1286
1286
  }, S = (y) => {
1287
1287
  const g = y.key;
1288
1288
  if (!(g in ie)) return;
1289
1289
  const v = document.activeElement;
1290
- v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.getAttribute("contenteditable") === "true") || (y.preventDefault(), c.current.delete(g), c.current.size === 0 && w());
1290
+ v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.getAttribute("contenteditable") === "true") || (y.preventDefault(), u.current.delete(g), u.current.size === 0 && C());
1291
1291
  }, E = (y) => {
1292
1292
  y.preventDefault();
1293
1293
  const g = e.current;
@@ -1295,47 +1295,47 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1295
1295
  return;
1296
1296
  const v = y.touches[0], T = document.elementFromPoint(v.clientX, v.clientY);
1297
1297
  let N = null;
1298
- T && (T.classList.contains("maze-up") ? N = "ArrowUp" : T.classList.contains("maze-down") ? N = "ArrowDown" : T.classList.contains("maze-left") ? N = "ArrowLeft" : T.classList.contains("maze-right") && (N = "ArrowRight")), N && (c.current.clear(), c.current.add(N), _());
1298
+ T && (T.classList.contains("maze-up") ? N = "ArrowUp" : T.classList.contains("maze-down") ? N = "ArrowDown" : T.classList.contains("maze-left") ? N = "ArrowLeft" : T.classList.contains("maze-right") && (N = "ArrowRight")), N && (u.current.clear(), u.current.add(N), _());
1299
1299
  }, L = () => {
1300
- w();
1300
+ C();
1301
1301
  };
1302
- return window.addEventListener("keydown", C, {
1302
+ return window.addEventListener("keydown", w, {
1303
1303
  capture: !0
1304
1304
  }), window.addEventListener("keydown", z), window.addEventListener("keyup", S), t.current?.addEventListener("touchstart", E, {
1305
1305
  passive: !1
1306
1306
  }), t.current?.addEventListener("touchend", L), () => {
1307
- window.removeEventListener("keydown", C, {
1307
+ window.removeEventListener("keydown", w, {
1308
1308
  capture: !0
1309
1309
  }), window.removeEventListener("keydown", z), window.removeEventListener("keyup", S), t.current?.removeEventListener("touchstart", E), t.current?.removeEventListener("touchend", L);
1310
1310
  };
1311
1311
  }, []);
1312
1312
  const b = je(() => {
1313
- if (!d.current || c.current.size === 0)
1313
+ if (!d.current || u.current.size === 0)
1314
1314
  return e.current.playerCell;
1315
- const C = u(), z = e.current.playerCell;
1315
+ const w = c(), z = e.current.playerCell;
1316
1316
  let S = 0, E = 0, L = 0;
1317
- for (const Y of c.current) {
1317
+ for (const Y of u.current) {
1318
1318
  const { canMove: ge } = f(Y, z);
1319
1319
  if (ge) {
1320
- const [Me, yt] = ie[Y];
1321
- S += Me, E += yt, L++;
1320
+ const [Ae, yt] = ie[Y];
1321
+ S += Ae, E += yt, L++;
1322
1322
  }
1323
1323
  }
1324
1324
  if (L === 0)
1325
1325
  return e.current.playerCell;
1326
1326
  const y = Math.sqrt(S * S + E * E), g = y > 0 ? S / y : 0, v = y > 0 ? E / y : 0, T = Number(
1327
- (z.row + g * C).toFixed(2)
1327
+ (z.row + g * w).toFixed(2)
1328
1328
  ), N = Number(
1329
- (z.col + v * C).toFixed(2)
1330
- ), P = T - z.row, D = N - z.col, x = Math.sqrt(P * P + D * D);
1331
- if (x > 0) {
1332
- const Y = P / x, ge = D / x;
1329
+ (z.col + v * w).toFixed(2)
1330
+ ), P = T - z.row, D = N - z.col, I = Math.sqrt(P * P + D * D);
1331
+ if (I > 0) {
1332
+ const Y = P / I, ge = D / I;
1333
1333
  if (Ke(
1334
1334
  z,
1335
1335
  Y,
1336
1336
  ge,
1337
1337
  s,
1338
- x,
1338
+ I,
1339
1339
  e.current.maze
1340
1340
  ))
1341
1341
  return e.current.playerCell;
@@ -1346,20 +1346,20 @@ const un = new cn(), we = 3, dn = ({ onRetry: t }) => {
1346
1346
  }, k();
1347
1347
  const $ = z.row < 0 ? 0 : Math.round(z.row), B = z.col < 0 ? 0 : Math.round(z.col), V = T < 0 ? 0 : Math.round(T), G = N < 0 ? 0 : Math.round(N);
1348
1348
  return (V !== $ || G !== B) && p({ row: V, col: G }), e.current.playerCell;
1349
- }, [u, f]), w = () => {
1350
- d.current = !1, c.current.clear();
1349
+ }, [c, f]), C = () => {
1350
+ d.current = !1, u.current.clear();
1351
1351
  };
1352
1352
  return {
1353
1353
  updatePlayerPos: b,
1354
- resetMovingState: w,
1354
+ resetMovingState: C,
1355
1355
  resetFirstMoveState: () => {
1356
1356
  h.current = !1;
1357
1357
  }
1358
1358
  };
1359
1359
  };
1360
1360
  function Ke(t, e, n, o, i, s) {
1361
- const a = t.row + e * i, r = t.col + n * i, l = { row: a, col: r }, u = [], d = t.row < 0 ? 0 : Math.floor(t.row), c = t.col < 0 ? 0 : Math.floor(t.col);
1362
- u.push({ row: d, col: c });
1361
+ const a = t.row + e * i, r = t.col + n * i, l = { row: a, col: r }, c = [], d = t.row < 0 ? 0 : Math.floor(t.row), u = t.col < 0 ? 0 : Math.floor(t.col);
1362
+ c.push({ row: d, col: u });
1363
1363
  const h = [
1364
1364
  [-1, 0],
1365
1365
  // up
@@ -1379,10 +1379,10 @@ function Ke(t, e, n, o, i, s) {
1379
1379
  // lower right, diagonal
1380
1380
  ];
1381
1381
  for (const [f, k] of h) {
1382
- const p = d + f, _ = c + k;
1383
- s.isValid(p, _) && u.push({ row: p, col: _ });
1382
+ const p = d + f, _ = u + k;
1383
+ s.isValid(p, _) && c.push({ row: p, col: _ });
1384
1384
  }
1385
- for (const f of u) {
1385
+ for (const f of c) {
1386
1386
  const k = hn(f.row, f.col, s);
1387
1387
  for (const p of k)
1388
1388
  if (fn(l, p) < o)
@@ -1410,13 +1410,13 @@ function fn(t, e) {
1410
1410
  const { start: n, end: o } = e, i = o.col - n.col, s = o.row - n.row, a = t.col - n.col, r = t.row - n.row, l = i * i + s * s;
1411
1411
  if (l === 0)
1412
1412
  return Math.sqrt(a * a + r * r);
1413
- const u = Math.max(
1413
+ const c = Math.max(
1414
1414
  0,
1415
1415
  Math.min(
1416
1416
  1,
1417
1417
  (a * i + r * s) / l
1418
1418
  )
1419
- ), d = n.col + u * i, c = n.row + u * s, h = t.col - d, f = t.row - c;
1419
+ ), d = n.col + c * i, u = n.row + c * s, h = t.col - d, f = t.row - u;
1420
1420
  return Math.sqrt(h * h + f * f);
1421
1421
  }
1422
1422
  function mn(t, e, n) {
@@ -1427,10 +1427,10 @@ function mn(t, e, n) {
1427
1427
  function vt(t, e, n, o, i) {
1428
1428
  if (!t || !e.maze) return;
1429
1429
  const { canvasWidth: s, canvasHeight: a } = n, { cellWidth: r, cellHeight: l } = o, {
1430
- maze: u,
1430
+ maze: c,
1431
1431
  playerCell: d,
1432
1432
  // row, col, but floating allowed
1433
- exitCell: c,
1433
+ exitCell: u,
1434
1434
  foodCells: h,
1435
1435
  showClue: f,
1436
1436
  playerPath: k,
@@ -1439,9 +1439,9 @@ function vt(t, e, n, o, i) {
1439
1439
  padding: _,
1440
1440
  wallWidth: b,
1441
1441
  // need merge with level config when passed here
1442
- wallColor: w,
1443
- playerColor: A,
1444
- playerRadius: C,
1442
+ wallColor: C,
1443
+ playerColor: M,
1444
+ playerRadius: w,
1445
1445
  foodColor: z,
1446
1446
  backgroundColor: S,
1447
1447
  clueColor: E,
@@ -1449,26 +1449,26 @@ function vt(t, e, n, o, i) {
1449
1449
  exitWallWidth: y,
1450
1450
  exitDashArray: g
1451
1451
  } = i;
1452
- t.clearRect(0, 0, s, a), t.save(), t.fillStyle = S, t.fillRect(0, 0, s, a), t.restore(), f && Cn({
1452
+ t.clearRect(0, 0, s, a), t.save(), t.fillStyle = S, t.fillRect(0, 0, s, a), t.restore(), f && wn({
1453
1453
  ctx: t,
1454
- playerPath: k,
1455
- visitCounts: p,
1454
+ playerPath: k ?? [],
1455
+ visitCounts: p ?? {},
1456
1456
  cellWidth: r,
1457
1457
  cellHeight: l,
1458
1458
  padding: _,
1459
1459
  clueColor: E
1460
1460
  }), _n({
1461
1461
  ctx: t,
1462
- maze: u,
1462
+ maze: c,
1463
1463
  cellWidth: r,
1464
1464
  cellHeight: l,
1465
1465
  padding: _,
1466
- wallColor: w,
1466
+ wallColor: C,
1467
1467
  wallWidth: b
1468
1468
  }), gn({
1469
1469
  ctx: t,
1470
- maze: u,
1471
- exitCell: c,
1470
+ maze: c,
1471
+ exitCell: u,
1472
1472
  cellWidth: r,
1473
1473
  cellHeight: l,
1474
1474
  padding: _,
@@ -1485,11 +1485,11 @@ function vt(t, e, n, o, i) {
1485
1485
  }), vn({
1486
1486
  ctx: t,
1487
1487
  playerCell: d,
1488
- playerRadius: C,
1488
+ playerRadius: w,
1489
1489
  cellWidth: r,
1490
1490
  cellHeight: l,
1491
1491
  padding: _,
1492
- playerColor: A
1492
+ playerColor: M
1493
1493
  });
1494
1494
  }
1495
1495
  function _n({
@@ -1520,8 +1520,8 @@ function vn({
1520
1520
  o,
1521
1521
  i,
1522
1522
  s
1523
- ), u = Math.min(o, i) * Math.min(n, 0.5);
1524
- t.save(), t.fillStyle = a, t.beginPath(), t.arc(r, l, u, 0, Math.PI * 2), t.fill(), t.restore();
1523
+ ), c = Math.min(o, i) * Math.min(n, 0.5);
1524
+ t.save(), t.fillStyle = a, t.beginPath(), t.arc(r, l, c, 0, Math.PI * 2), t.fill(), t.restore();
1525
1525
  }
1526
1526
  function gn({
1527
1527
  ctx: t,
@@ -1534,10 +1534,10 @@ function gn({
1534
1534
  exitWallWidth: r,
1535
1535
  exitDashArray: l = [8, 12]
1536
1536
  }) {
1537
- const { row: u, col: d } = n;
1538
- if (!e.isValid(u, d)) return;
1539
- const c = s + d * o, h = s + u * i;
1540
- t.save(), t.globalCompositeOperation = "destination-out", t.lineWidth = r, t.lineCap = "round", t.beginPath(), t.moveTo(c, h + i), t.lineTo(c + o, h + i), t.stroke(), t.globalCompositeOperation = "source-over", t.strokeStyle = a, t.lineWidth = r, t.setLineDash(l), t.beginPath(), t.moveTo(c, h + i), t.lineTo(c + o, h + i), t.stroke(), t.restore();
1537
+ const { row: c, col: d } = n;
1538
+ if (!e.isValid(c, d)) return;
1539
+ const u = s + d * o, h = s + c * i;
1540
+ t.save(), t.globalCompositeOperation = "destination-out", t.lineWidth = r, t.lineCap = "round", t.beginPath(), t.moveTo(u, h + i), t.lineTo(u + o, h + i), t.stroke(), t.globalCompositeOperation = "source-over", t.strokeStyle = a, t.lineWidth = r, t.setLineDash(l), t.beginPath(), t.moveTo(u, h + i), t.lineTo(u + o, h + i), t.stroke(), t.restore();
1541
1541
  }
1542
1542
  function pn({
1543
1543
  ctx: t,
@@ -1550,17 +1550,17 @@ function pn({
1550
1550
  t.fillStyle = s;
1551
1551
  const a = Math.min(n, o) * 0.25;
1552
1552
  e.forEach((r) => {
1553
- const { x: l, y: u } = he(
1553
+ const { x: l, y: c } = he(
1554
1554
  r.row,
1555
1555
  r.col,
1556
1556
  n,
1557
1557
  o,
1558
1558
  i
1559
1559
  );
1560
- wn(t, l, u, a * 1.2, 5, a * 0.6);
1560
+ Cn(t, l, c, a * 1.2, 5, a * 0.6);
1561
1561
  });
1562
1562
  }
1563
- function wn(t, e, n, o, i, s) {
1563
+ function Cn(t, e, n, o, i, s) {
1564
1564
  t.save(), t.beginPath();
1565
1565
  for (let a = 0; a < i * 2; a++) {
1566
1566
  const r = a % 2 === 0 ? o : s, l = Math.PI * a / i;
@@ -1568,7 +1568,7 @@ function wn(t, e, n, o, i, s) {
1568
1568
  }
1569
1569
  t.closePath(), t.fill(), t.restore();
1570
1570
  }
1571
- function Cn({
1571
+ function wn({
1572
1572
  ctx: t,
1573
1573
  playerPath: e,
1574
1574
  visitCounts: n,
@@ -1580,7 +1580,7 @@ function Cn({
1580
1580
  if (!(!e || e.length < 2 || !n)) {
1581
1581
  t.save();
1582
1582
  for (let r = 1; r < e.length; r++) {
1583
- const l = e[r - 1], u = e[r], d = `${l.row},${l.col}-${u.row},${u.col}`, c = `${u.row},${u.col}-${l.row},${l.col}`, h = (n[d] || 0) + (n[c] || 0), f = Math.min(0.2 + h * 0.1, 0.9), k = Math.max(3, o * 0.1) + h * 0.5;
1583
+ const l = e[r - 1], c = e[r], d = `${l.row},${l.col}-${c.row},${c.col}`, u = `${c.row},${c.col}-${l.row},${l.col}`, h = (n[d] || 0) + (n[u] || 0), f = Math.min(0.2 + h * 0.1, 0.9), k = Math.max(3, o * 0.1) + h * 0.5;
1584
1584
  try {
1585
1585
  t.strokeStyle = a.replace(")", `, ${f})`).replace("rgb(", "rgba(");
1586
1586
  } catch {
@@ -1593,14 +1593,14 @@ function Cn({
1593
1593
  o,
1594
1594
  i,
1595
1595
  s
1596
- ), { x: b, y: w } = he(
1597
- u.row,
1598
- u.col,
1596
+ ), { x: b, y: C } = he(
1597
+ c.row,
1598
+ c.col,
1599
1599
  o,
1600
1600
  i,
1601
1601
  s
1602
1602
  );
1603
- t.beginPath(), t.moveTo(p, _), t.lineTo(b, w), t.stroke();
1603
+ t.beginPath(), t.moveTo(p, _), t.lineTo(b, C), t.stroke();
1604
1604
  }
1605
1605
  t.restore();
1606
1606
  }
@@ -1609,27 +1609,27 @@ function yn(t, e, n, o) {
1609
1609
  const i = [];
1610
1610
  for (let s = 0; s < t.rows; s++)
1611
1611
  for (let a = 0; a < t.cols; a++) {
1612
- const r = t.grid[s][a], l = o + a * e, u = o + s * n;
1612
+ const r = t.grid[s][a], l = o + a * e, c = o + s * n;
1613
1613
  r.walls.top && i.push({
1614
1614
  x1: l,
1615
- y1: u,
1615
+ y1: c,
1616
1616
  x2: l + e,
1617
- y2: u
1617
+ y2: c
1618
1618
  }), r.walls.right && i.push({
1619
1619
  x1: l + e,
1620
- y1: u,
1620
+ y1: c,
1621
1621
  x2: l + e,
1622
- y2: u + n
1622
+ y2: c + n
1623
1623
  }), r.walls.bottom && i.push({
1624
1624
  x1: l,
1625
- y1: u + n,
1625
+ y1: c + n,
1626
1626
  x2: l + e,
1627
- y2: u + n
1627
+ y2: c + n
1628
1628
  }), r.walls.left && i.push({
1629
1629
  x1: l,
1630
- y1: u,
1630
+ y1: c,
1631
1631
  x2: l,
1632
- y2: u + n
1632
+ y2: c + n
1633
1633
  });
1634
1634
  }
1635
1635
  return i;
@@ -1753,8 +1753,8 @@ class gt {
1753
1753
  i = e[e.length - 1];
1754
1754
  const { row: s, col: a } = i, r = this.getUnvisitedNeighbors(s, a);
1755
1755
  if (r.length > 0) {
1756
- const l = this.randomPick(r), { row: u, col: d } = l;
1757
- this.removeWall(s, a, u, d), this.grid[u][d].visited = !0, e.push(l);
1756
+ const l = this.randomPick(r), { row: c, col: d } = l;
1757
+ this.removeWall(s, a, c, d), this.grid[c][d].visited = !0, e.push(l);
1758
1758
  } else
1759
1759
  e.pop();
1760
1760
  }
@@ -1765,13 +1765,13 @@ class gt {
1765
1765
  const r = this.getNeighbors(s, a);
1766
1766
  for (const l of r)
1767
1767
  !this.grid[l.row][l.col].visited && !e.some(
1768
- (u) => u.row === l.row && u.col === l.col
1768
+ (c) => c.row === l.row && c.col === l.col
1769
1769
  ) && e.push(l);
1770
1770
  }, o = this.randomNumber(this.rows), i = this.randomNumber(this.cols);
1771
1771
  for (this.grid[o][i].visited = !0, n(o, i); e.length > 0; ) {
1772
- const s = this.randomNumber(e.length), a = e[s], { row: r, col: l } = a, u = this.getVisitedNeighbors(r, l);
1773
- if (u.length > 0) {
1774
- const d = this.randomPick(u);
1772
+ const s = this.randomNumber(e.length), a = e[s], { row: r, col: l } = a, c = this.getVisitedNeighbors(r, l);
1773
+ if (c.length > 0) {
1774
+ const d = this.randomPick(c);
1775
1775
  this.removeWall(r, l, d.row, d.col), this.grid[r][l].visited = !0, n(r, l);
1776
1776
  }
1777
1777
  e.splice(s, 1);
@@ -1804,33 +1804,33 @@ const pt = (t, e, n) => {
1804
1804
  }, kn = (t) => t === 1 ? 2 : t >= 2 && t <= 5 ? 3 : t >= 6 && t <= 11 ? 4 : t >= 12 && t <= 15 ? 5 : 6, Sn = (t, e) => {
1805
1805
  if (!e)
1806
1806
  return console.error(`Cannot find Level ${t}'s config.`), null;
1807
- const { size: n, seed: o, method: i, entry: s, exit: a } = e, r = n, l = n, u = s || { row: 0, col: 0 }, d = a || {
1807
+ const { size: n, seed: o, method: i, entry: s, exit: a } = e, r = n, l = n, c = s || { row: 0, col: 0 }, d = a || {
1808
1808
  row: r - 1,
1809
1809
  col: l - 1
1810
- }, c = new gt(r, l, i, o, u, d), h = kn(t), f = [];
1810
+ }, u = new gt(r, l, i, o, c, d), h = kn(t), f = [];
1811
1811
  for (let k = 0; k < h; k++) {
1812
1812
  let p;
1813
1813
  do
1814
1814
  p = {
1815
- row: Math.floor(c.random() * r),
1816
- col: Math.floor(c.random() * l)
1815
+ row: Math.floor(u.random() * r),
1816
+ col: Math.floor(u.random() * l)
1817
1817
  };
1818
- while (p.row === u.row && p.col === u.col || p.row === d.row && p.col === d.col || !pt(c, p.row, p.col) || f.some((_) => _.row === p.row && _.col === p.col));
1818
+ while (p.row === c.row && p.col === c.col || p.row === d.row && p.col === d.col || !pt(u, p.row, p.col) || f.some((_) => _.row === p.row && _.col === p.col));
1819
1819
  f.push(p);
1820
1820
  }
1821
1821
  return {
1822
1822
  isGameActive: !0,
1823
1823
  levelTransitioning: !1,
1824
- maze: c,
1825
- playerCell: u,
1824
+ maze: u,
1825
+ playerCell: c,
1826
1826
  exitCell: d,
1827
1827
  foodCells: f,
1828
1828
  playerAtExit: !1,
1829
1829
  foodCollected: 0,
1830
1830
  totalFoodCount: h,
1831
1831
  showClue: !1,
1832
- playerPath: [u],
1833
- visitCounts: { [`${u.row},${u.col}`]: 1 }
1832
+ playerPath: [c],
1833
+ visitCounts: { [`${c.row},${c.col}`]: 1 }
1834
1834
  };
1835
1835
  }, zn = ({
1836
1836
  size: t,
@@ -1838,18 +1838,18 @@ const pt = (t, e, n) => {
1838
1838
  method: n,
1839
1839
  foodCount: o
1840
1840
  }) => {
1841
- const i = t, s = t, a = { row: 0, col: 0 }, r = { row: i - 1, col: s - 1 }, l = new gt(i, s, n, e, a, r), u = [];
1841
+ const i = t, s = t, a = { row: 0, col: 0 }, r = { row: i - 1, col: s - 1 }, l = new gt(i, s, n, e, a, r), c = [];
1842
1842
  for (let d = 0; d < o; d++) {
1843
- let c, h = 0;
1843
+ let u, h = 0;
1844
1844
  do
1845
- c = {
1845
+ u = {
1846
1846
  row: Math.floor(l.random() * i),
1847
1847
  col: Math.floor(l.random() * s)
1848
1848
  }, h++;
1849
- while (h < 50 && (c.row === a.row && c.col === a.col || c.row === r.row && c.col === r.col || !pt(l, c.row, c.col) || u.some(
1850
- (f) => f.row === c.row && f.col === c.col
1849
+ while (h < 50 && (u.row === a.row && u.col === a.col || u.row === r.row && u.col === r.col || !pt(l, u.row, u.col) || c.some(
1850
+ (f) => f.row === u.row && f.col === u.col
1851
1851
  )));
1852
- h < 50 && u.push(c);
1852
+ h < 50 && c.push(u);
1853
1853
  }
1854
1854
  return {
1855
1855
  isGameActive: !0,
@@ -1857,14 +1857,10 @@ const pt = (t, e, n) => {
1857
1857
  maze: l,
1858
1858
  playerCell: a,
1859
1859
  exitCell: r,
1860
- foodCells: u,
1860
+ foodCells: c,
1861
1861
  playerAtExit: !1,
1862
1862
  foodCollected: 0,
1863
- totalFoodCount: o,
1864
- // not using these state actually
1865
- showClue: !1,
1866
- playerPath: [a],
1867
- visitCounts: { [`${a.row},${a.col}`]: 1 }
1863
+ totalFoodCount: o
1868
1864
  };
1869
1865
  };
1870
1866
  function En() {
@@ -1874,7 +1870,7 @@ function En() {
1874
1870
  gamePlayStateRef: n,
1875
1871
  gameProgress: o,
1876
1872
  config: i
1877
- } = ne(), s = O(null), a = O(null), { i18n: r, levelConfig: l, renderConfig: u } = i, d = oe(l), c = O(
1873
+ } = ne(), s = O(null), a = O(null), { i18n: r, levelConfig: l, renderConfig: c } = i, d = oe(l), u = O(
1878
1874
  d.getLevelConfig(o.currentLevel)
1879
1875
  );
1880
1876
  R(() => {
@@ -1885,21 +1881,21 @@ function En() {
1885
1881
  }), k = mt(
1886
1882
  a,
1887
1883
  e,
1888
- u.padding
1884
+ c.padding
1889
1885
  );
1890
1886
  R(() => {
1891
- c.current = d.getLevelConfig(
1887
+ u.current = d.getLevelConfig(
1892
1888
  o.currentLevel
1893
1889
  );
1894
1890
  }, [o.currentLevel]);
1895
1891
  const p = () => {
1896
- const A = Sn(
1892
+ const M = Sn(
1897
1893
  o.currentLevel,
1898
- c.current
1894
+ u.current
1899
1895
  );
1900
- A && t((C) => ({
1901
- ...C,
1902
- ...A
1896
+ M && t((w) => ({
1897
+ ...w,
1898
+ ...M
1903
1899
  }));
1904
1900
  };
1905
1901
  R(() => {
@@ -1907,37 +1903,37 @@ function En() {
1907
1903
  }, [o.currentLevel]);
1908
1904
  const _ = () => {
1909
1905
  p();
1910
- }, { updatePlayerPos: b, resetMovingState: w } = _t({
1906
+ }, { updatePlayerPos: b, resetMovingState: C } = _t({
1911
1907
  containerRef: s,
1912
1908
  gamePlayStateRef: n,
1913
1909
  setGamePlayState: t,
1914
- playerRadius: u.playerRadius,
1915
- moveSpeed: u.gridMoveSpeed,
1910
+ playerRadius: c.playerRadius,
1911
+ moveSpeed: c.gridMoveSpeed,
1916
1912
  onFoodCollected: () => {
1917
- const A = n.current.totalFoodCount - n.current.foodCollected - 1;
1918
- A > 0 ? j.show(
1919
- r.foodCollectedToast.replace("%NUM%", A.toString()),
1913
+ const M = n.current.totalFoodCount - n.current.foodCollected - 1;
1914
+ M > 0 ? j.show(
1915
+ r.foodCollectedToast.replace("%NUM%", M.toString()),
1920
1916
  3e3
1921
1917
  ) : j.show(r.allFoodCollectedToast);
1922
1918
  }
1923
1919
  });
1924
1920
  return R(() => {
1925
- w();
1926
- }, [o.currentLevel, w]), R(() => {
1927
- let A, C = !document.hidden;
1921
+ C();
1922
+ }, [o.currentLevel, C]), R(() => {
1923
+ let M, w = !document.hidden;
1928
1924
  const z = () => {
1929
1925
  const L = a.current?.getContext("2d"), y = n.current;
1930
- if (!(C && y?.isGameActive && L && y?.maze)) {
1931
- A = requestAnimationFrame(z);
1926
+ if (!(w && y?.isGameActive && L && y?.maze)) {
1927
+ M = requestAnimationFrame(z);
1932
1928
  return;
1933
1929
  }
1934
- b(), S(), A = requestAnimationFrame(z);
1930
+ b(), S(), M = requestAnimationFrame(z);
1935
1931
  }, S = () => {
1936
1932
  const L = a.current?.getContext("2d"), y = n.current;
1937
1933
  if (L && y?.maze) {
1938
- const g = c.current?.wallWidth || u?.wallWidth, v = c.current?.exitColor || u?.exitColor, T = c.current?.exitWallWidth || u?.exitWallWidth, N = c.current?.exitDashArray || u?.exitDashArray;
1934
+ const g = u.current?.wallWidth || c?.wallWidth, v = u.current?.exitColor || c?.exitColor, T = u.current?.exitWallWidth || c?.exitWallWidth, N = u.current?.exitDashArray || c?.exitDashArray;
1939
1935
  vt(L, y, f.current, k.current, {
1940
- ...u,
1936
+ ...c,
1941
1937
  wallWidth: g,
1942
1938
  exitColor: v,
1943
1939
  exitWallWidth: T,
@@ -1947,17 +1943,17 @@ function En() {
1947
1943
  };
1948
1944
  h.current = S;
1949
1945
  const E = (L) => {
1950
- const y = C;
1951
- C = !document.hidden && document.visibilityState === "visible" && (!L || L.type !== "blur"), !y && C ? n.current?.levelTransitioning === !1 && t({
1946
+ const y = w;
1947
+ w = !document.hidden && document.visibilityState === "visible" && (!L || L.type !== "blur"), !y && w ? n.current?.levelTransitioning === !1 && t({
1952
1948
  ...n.current,
1953
1949
  isGameActive: !0
1954
- }) : y && !C && t({
1950
+ }) : y && !w && t({
1955
1951
  ...n.current,
1956
1952
  isGameActive: !1
1957
1953
  });
1958
1954
  };
1959
- return document.addEventListener("visibilitychange", E), window.addEventListener("blur", E), window.addEventListener("focus", E), A = requestAnimationFrame(z), () => {
1960
- cancelAnimationFrame(A), document.removeEventListener("visibilitychange", E), window.removeEventListener("blur", E), window.removeEventListener("focus", E);
1955
+ return document.addEventListener("visibilitychange", E), window.addEventListener("blur", E), window.addEventListener("focus", E), M = requestAnimationFrame(z), () => {
1956
+ cancelAnimationFrame(M), document.removeEventListener("visibilitychange", E), window.removeEventListener("blur", E), window.removeEventListener("focus", E);
1961
1957
  };
1962
1958
  }, []), R(() => {
1963
1959
  j.show(r.useArrowKeyTips, 3e3);
@@ -2005,7 +2001,7 @@ const Ln = (t) => {
2005
2001
  }
2006
2002
  ) });
2007
2003
  };
2008
- function An({ config: t }) {
2004
+ function Mn({ config: t }) {
2009
2005
  const {
2010
2006
  size: e,
2011
2007
  seed: n,
@@ -2015,19 +2011,19 @@ function An({ config: t }) {
2015
2011
  successCallback: a,
2016
2012
  failCallback: r,
2017
2013
  timer: l,
2018
- i18n: u
2019
- } = t, [d, c] = U({
2014
+ i18n: c
2015
+ } = t, [d, u] = U({
2020
2016
  ...ke
2021
- }), [h, f] = U(!1), [k, p] = U(!1), [_, b] = U(!1), [w, A] = U(""), C = O(null), z = O(null), S = O(d), E = O(), L = ft(C, () => {
2017
+ }), [h, f] = U(!1), [k, p] = U(!1), [_, b] = U(!1), [C, M] = U(""), w = O(null), z = O(null), S = O(d), E = O(), L = ft(w, () => {
2022
2018
  E.current?.();
2023
- }), y = mt(C, d, s.padding);
2019
+ }), y = mt(w, d, s.padding);
2024
2020
  R(() => {
2025
2021
  S.current = d;
2026
2022
  }, [d]);
2027
2023
  const { updatePlayerPos: g, resetMovingState: v, resetFirstMoveState: T } = _t({
2028
2024
  containerRef: z,
2029
2025
  gamePlayStateRef: S,
2030
- setGamePlayState: c,
2026
+ setGamePlayState: u,
2031
2027
  playerRadius: s.playerRadius,
2032
2028
  moveSpeed: s.gridMoveSpeed,
2033
2029
  onFoodCollected: () => {
@@ -2040,12 +2036,12 @@ function An({ config: t }) {
2040
2036
  window.dispatchEvent(new CustomEvent("maze:firstMove"));
2041
2037
  }
2042
2038
  }), N = () => {
2043
- p(!0), A(`⏰ ${u.failMsg}`), b(!0), c((x) => ({
2044
- ...x,
2039
+ p(!0), M(`⏰ ${c.failMsg}`), b(!0), u((I) => ({
2040
+ ...I,
2045
2041
  isGameActive: !1
2046
2042
  })), r && r();
2047
2043
  }, P = () => {
2048
- p(!0), A(`🎉 ${u.successMsg}`), b(!0), window.dispatchEvent(new CustomEvent("maze:gameSuccess")), a && a();
2044
+ p(!0), M(`🎉 ${c.successMsg}`), b(!0), window.dispatchEvent(new CustomEvent("maze:gameSuccess")), a && a();
2049
2045
  }, D = () => {
2050
2046
  b(!1);
2051
2047
  };
@@ -2053,8 +2049,13 @@ function An({ config: t }) {
2053
2049
  (async () => {
2054
2050
  f(!0);
2055
2051
  try {
2056
- const $ = zn({ size: e, seed: n, method: o, foodCount: i });
2057
- S.current = $, c($);
2052
+ const $ = zn({
2053
+ size: e,
2054
+ seed: n,
2055
+ method: o,
2056
+ foodCount: i
2057
+ });
2058
+ S.current = $, u($);
2058
2059
  } catch ($) {
2059
2060
  console.error("Error generating single maze:", $);
2060
2061
  } finally {
@@ -2062,16 +2063,16 @@ function An({ config: t }) {
2062
2063
  }
2063
2064
  })();
2064
2065
  }, [t]), R(() => {
2065
- let x;
2066
+ let I;
2066
2067
  const $ = !document.hidden, B = () => {
2067
- const G = C.current?.getContext("2d"), q = S.current;
2068
+ const G = w.current?.getContext("2d"), q = S.current;
2068
2069
  if (!($ && q?.isGameActive && G && q?.maze)) {
2069
- x = requestAnimationFrame(B);
2070
+ I = requestAnimationFrame(B);
2070
2071
  return;
2071
2072
  }
2072
- g(), V(), x = requestAnimationFrame(B);
2073
+ g(), V(), I = requestAnimationFrame(B);
2073
2074
  }, V = () => {
2074
- const G = C.current?.getContext("2d"), q = S.current;
2075
+ const G = w.current?.getContext("2d"), q = S.current;
2075
2076
  G && q?.maze && vt(
2076
2077
  G,
2077
2078
  q,
@@ -2080,15 +2081,15 @@ function An({ config: t }) {
2080
2081
  s
2081
2082
  );
2082
2083
  };
2083
- return E.current = V, x = requestAnimationFrame(B), () => {
2084
- cancelAnimationFrame(x);
2084
+ return E.current = V, I = requestAnimationFrame(B), () => {
2085
+ cancelAnimationFrame(I);
2085
2086
  };
2086
2087
  }, []), R(() => {
2087
2088
  v(), T();
2088
2089
  }, [t, v, T]), h ? /* @__PURE__ */ m("div", { className: "single-maze-loading", children: /* @__PURE__ */ m("div", { children: "Generating maze..." }) }) : d ? /* @__PURE__ */ m("div", { className: "maze-game-container", children: [
2089
2090
  /* @__PURE__ */ m(Nn, { timer: l, onTimeUp: N }),
2090
2091
  /* @__PURE__ */ m("div", { className: "single-maze-canvas-container", ref: z, children: [
2091
- /* @__PURE__ */ m("canvas", { ref: C, className: "maze-game-canvas" }),
2092
+ /* @__PURE__ */ m("canvas", { ref: w, className: "maze-game-canvas" }),
2092
2093
  /* @__PURE__ */ m("div", { className: "maze-touch-area maze-up" }),
2093
2094
  /* @__PURE__ */ m("div", { className: "maze-touch-area maze-down" }),
2094
2095
  /* @__PURE__ */ m("div", { className: "maze-touch-area maze-left" }),
@@ -2098,7 +2099,7 @@ function An({ config: t }) {
2098
2099
  Q,
2099
2100
  {
2100
2101
  isOpen: _,
2101
- title: w,
2102
+ title: C,
2102
2103
  noConfirm: !0,
2103
2104
  cancelText: "OK",
2104
2105
  onCancel: D
@@ -2106,7 +2107,7 @@ function An({ config: t }) {
2106
2107
  )
2107
2108
  ] }) : /* @__PURE__ */ m("div", { className: "single-maze-error", children: /* @__PURE__ */ m("div", { children: "Failed to generate maze" }) });
2108
2109
  }
2109
- const wt = [
2110
+ const Ct = [
2110
2111
  // Tier 1 (Levels 1-12) - Beginner
2111
2112
  [
2112
2113
  // debug
@@ -2264,8 +2265,8 @@ const wt = [
2264
2265
  { size: 68, seed: 33341, method: "backtracking" }
2265
2266
  // Level 60 - Master
2266
2267
  ]
2267
- ], Mn = 0.07, Ct = {
2268
- gridMoveSpeed: Mn,
2268
+ ], An = 0.07, wt = {
2269
+ gridMoveSpeed: An,
2269
2270
  padding: 10,
2270
2271
  wallWidth: 2,
2271
2272
  wallColor: "#000000",
@@ -2325,8 +2326,8 @@ const wt = [
2325
2326
  cluePathDisabled: "Clue Path Disabled",
2326
2327
  useArrowKeyTips: "Use arrow keys to navigate the maze. Press'C' to toggle path clue."
2327
2328
  },
2328
- renderConfig: Ct,
2329
- levelConfig: wt
2329
+ renderConfig: wt,
2330
+ levelConfig: Ct
2330
2331
  }, ue = {
2331
2332
  i18n: {
2332
2333
  successMsg: "Congratulations! You completed the maze!",
@@ -2337,7 +2338,7 @@ const wt = [
2337
2338
  seed: 12345,
2338
2339
  method: "backtracking",
2339
2340
  foodCount: 3,
2340
- renderConfig: Ct,
2341
+ renderConfig: wt,
2341
2342
  timer: 10 * 60,
2342
2343
  // 10 minutes
2343
2344
  successCallback: () => {
@@ -2351,7 +2352,7 @@ function Pn({ config: t = {} }) {
2351
2352
  const e = { ...ce.i18n, ...t.i18n || {} }, n = {
2352
2353
  ...ce.renderConfig,
2353
2354
  ...t.renderConfig || {}
2354
- }, o = t.levelConfig || wt, i = {
2355
+ }, o = t.levelConfig || Ct, i = {
2355
2356
  ...ce,
2356
2357
  ...t,
2357
2358
  i18n: e,
@@ -2360,7 +2361,7 @@ function Pn({ config: t = {} }) {
2360
2361
  };
2361
2362
  return /* @__PURE__ */ m(Rt, { config: i, children: /* @__PURE__ */ m(En, {}) });
2362
2363
  }
2363
- function xn({
2364
+ function In({
2364
2365
  config: t = {}
2365
2366
  }) {
2366
2367
  const e = { ...ue.i18n, ...t.i18n || {} }, n = {
@@ -2372,15 +2373,15 @@ function xn({
2372
2373
  i18n: e,
2373
2374
  renderConfig: n
2374
2375
  };
2375
- return /* @__PURE__ */ m(An, { config: o });
2376
+ return /* @__PURE__ */ m(Mn, { config: o });
2376
2377
  }
2377
- const In = {
2378
- root: "https://unpkg.com/@roudanio/maze@0.2.0/dist/",
2378
+ const xn = {
2379
+ root: "https://unpkg.com/@roudanio/maze@0.2.2/dist/",
2379
2380
  ...ce
2380
2381
  };
2381
- `${JSON.stringify(In, null, 2)}`;
2382
+ `${JSON.stringify(xn, null, 2)}`;
2382
2383
  const Rn = {
2383
- root: "https://unpkg.com/@roudanio/maze@0.2.0/dist/",
2384
+ root: "https://unpkg.com/@roudanio/maze@0.2.2/dist/",
2384
2385
  ...ue
2385
2386
  };
2386
2387
  `${JSON.stringify(
@@ -2389,73 +2390,56 @@ const Rn = {
2389
2390
  2
2390
2391
  )}`;
2391
2392
  const Fn = {
2392
- async init(t, e) {
2393
- const n = typeof t == "string" ? document.querySelector(t) : t;
2394
- if (!n) {
2395
- console.warn("Cannot find the root element");
2396
- const l = document.createElement("div");
2397
- l.style.textAlign = "center", l.style.padding = "20px", l.innerHTML = "Cannot find the root element", document.body.append(l);
2398
- return;
2399
- }
2400
- let { root: o = location.origin } = e;
2401
- o.at(-1) !== "/" && (o += "/");
2402
- const i = document.createElement("div"), s = document.createElement("div");
2403
- i.style.cssText = `
2393
+ showNotice() {
2394
+ console.warn("Cannot find the root element");
2395
+ const t = document.createElement("div");
2396
+ t.style.textAlign = "center", t.style.padding = "20px", t.innerHTML = "Cannot find the root element", document.body.append(t);
2397
+ },
2398
+ addLoadingIndicator(t) {
2399
+ const e = document.createElement("div"), n = document.createElement("div");
2400
+ e.style.cssText = `
2404
2401
  height: 30px;
2405
2402
  width: 100%;
2406
2403
  border: solid 2px #999;
2407
2404
  margin: 20% auto;
2408
- `, s.style.cssText = `
2405
+ `, n.style.cssText = `
2409
2406
  width: 99%;
2410
2407
  height: 100%;
2411
2408
  background: #999;
2412
2409
  animation: loading 1.5s ease-in-out;
2413
2410
  transition: width 1.5s ease-in-out;
2414
- transition: width 1.5s ease-in-out;
2415
- `, i.append(s), n.append(i);
2416
- const a = document.createElement("style");
2417
- a.innerHTML = `
2411
+ `, e.append(n), t.append(e);
2412
+ const o = document.createElement("style");
2413
+ o.innerHTML = `
2418
2414
  @keyframes loading {
2419
2415
  0% { width: 0%; }
2420
2416
  100% { width: 99%; }
2421
- }`, document.head.appendChild(a), await (async (l) => new Promise((u, d) => {
2422
- const c = document.createElement("link");
2423
- c.rel = "stylesheet", c.type = "text/css", c.href = l, c.onload = u, c.onerror = d, document.head.appendChild(c);
2424
- }))(o + "maze.css"), Re(/* @__PURE__ */ m(Pn, { config: e }), n);
2417
+ }`, document.head.appendChild(o);
2418
+ },
2419
+ async loadCSS(t) {
2420
+ const e = document.createElement("link");
2421
+ return e.rel = "stylesheet", e.href = "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap", document.head.appendChild(e), new Promise((n, o) => {
2422
+ const i = document.createElement("link");
2423
+ i.rel = "stylesheet", i.type = "text/css", i.href = t, i.onload = n, i.onerror = o, document.head.appendChild(i);
2424
+ });
2425
+ },
2426
+ async init(t, e) {
2427
+ const n = typeof t == "string" ? document.querySelector(t) : t;
2428
+ if (!n) {
2429
+ this.showNotice();
2430
+ return;
2431
+ }
2432
+ let { root: o = location.origin } = e;
2433
+ o.at(-1) !== "/" && (o += "/"), this.addLoadingIndicator(n), await this.loadCSS(o + "maze.css"), n.innerHTML = "", Re(/* @__PURE__ */ m(Pn, { config: e }), n);
2425
2434
  },
2426
2435
  async initSingle(t, e) {
2427
2436
  const n = typeof t == "string" ? document.querySelector(t) : t;
2428
2437
  if (!n) {
2429
- console.warn("Cannot find the root element");
2430
- const l = document.createElement("div");
2431
- l.style.textAlign = "center", l.style.padding = "20px", l.innerHTML = "Cannot find the root element", document.body.append(l);
2438
+ this.showNotice();
2432
2439
  return;
2433
2440
  }
2434
2441
  let { root: o = location.origin } = e;
2435
- o.at(-1) !== "/" && (o += "/");
2436
- const i = document.createElement("div"), s = document.createElement("div");
2437
- i.style.cssText = `
2438
- height: 30px;
2439
- width: 100%;
2440
- border: solid 2px #999;
2441
- margin: 20% auto;
2442
- `, s.style.cssText = `
2443
- width: 99%;
2444
- height: 100%;
2445
- background: #999;
2446
- animation: loading 1.5s ease-in-out;
2447
- transition: width 1.5s ease-in-out;
2448
- transition: width 1.5s ease-in-out;
2449
- `, i.append(s), n.append(i);
2450
- const a = document.createElement("style");
2451
- a.innerHTML = `
2452
- @keyframes loading {
2453
- 0% { width: 0%; }
2454
- 100% { width: 99%; }
2455
- }`, document.head.appendChild(a), await (async (l) => new Promise((u, d) => {
2456
- const c = document.createElement("link");
2457
- c.rel = "stylesheet", c.type = "text/css", c.href = l, c.onload = u, c.onerror = d, document.head.appendChild(c);
2458
- }))(o + "maze.css"), Re(/* @__PURE__ */ m(xn, { config: e }), n);
2442
+ o.at(-1) !== "/" && (o += "/"), this.addLoadingIndicator(n), await this.loadCSS(o + "maze.css"), n.innerHTML = "", Re(/* @__PURE__ */ m(In, { config: e }), n);
2459
2443
  }
2460
2444
  };
2461
2445
  export {