@roudanio/maze 0.0.7 → 0.0.9

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