twd-js 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,93 +1,93 @@
1
- var O, h, xe, C, le, Se, Te, Ee, ne, G, X, M = {}, Re = [], Ue = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, q = Array.isArray;
1
+ var V, h, Re, $, de, Ce, $e, Ee, re, J, Z, A = {}, Ie = [], je = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, X = Array.isArray;
2
2
  function T(t, e) {
3
3
  for (var n in e) t[n] = e[n];
4
4
  return t;
5
5
  }
6
- function re(t) {
6
+ function oe(t) {
7
7
  t && t.parentNode && t.parentNode.removeChild(t);
8
8
  }
9
- function Fe(t, e, n) {
10
- var r, s, i, _ = {};
11
- for (i in e) i == "key" ? r = e[i] : i == "ref" ? s = e[i] : _[i] = e[i];
12
- if (arguments.length > 2 && (_.children = arguments.length > 3 ? O.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (i in t.defaultProps) _[i] === void 0 && (_[i] = t.defaultProps[i]);
13
- return B(t, _, r, s, null);
9
+ function Oe(t, e, n) {
10
+ var r, i, o, l = {};
11
+ for (o in e) o == "key" ? r = e[o] : o == "ref" ? i = e[o] : l[o] = e[o];
12
+ if (arguments.length > 2 && (l.children = arguments.length > 3 ? V.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (o in t.defaultProps) l[o] === void 0 && (l[o] = t.defaultProps[o]);
13
+ return U(t, l, r, i, null);
14
14
  }
15
- function B(t, e, n, r, s) {
16
- var i = { type: t, props: e, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: s ?? ++xe, __i: -1, __u: 0 };
17
- return s == null && h.vnode != null && h.vnode(i), i;
15
+ function U(t, e, n, r, i) {
16
+ var o = { type: t, props: e, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++Re, __i: -1, __u: 0 };
17
+ return i == null && h.vnode != null && h.vnode(o), o;
18
18
  }
19
- function L(t) {
19
+ function N(t) {
20
20
  return t.children;
21
21
  }
22
- function U(t, e) {
22
+ function F(t, e) {
23
23
  this.props = t, this.context = e;
24
24
  }
25
- function A(t, e) {
26
- if (e == null) return t.__ ? A(t.__, t.__i + 1) : null;
25
+ function I(t, e) {
26
+ if (e == null) return t.__ ? I(t.__, t.__i + 1) : null;
27
27
  for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
28
- return typeof t.type == "function" ? A(t) : null;
28
+ return typeof t.type == "function" ? I(t) : null;
29
29
  }
30
- function Ce(t) {
30
+ function We(t) {
31
31
  var e, n;
32
32
  if ((t = t.__) != null && t.__c != null) {
33
33
  for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
34
34
  t.__e = t.__c.base = n.__e;
35
35
  break;
36
36
  }
37
- return Ce(t);
37
+ return We(t);
38
38
  }
39
39
  }
40
- function ae(t) {
41
- (!t.__d && (t.__d = !0) && C.push(t) && !z.__r++ || le != h.debounceRendering) && ((le = h.debounceRendering) || Se)(z);
40
+ function ue(t) {
41
+ (!t.__d && (t.__d = !0) && $.push(t) && !O.__r++ || de != h.debounceRendering) && ((de = h.debounceRendering) || Ce)(O);
42
42
  }
43
- function z() {
44
- for (var t, e, n, r, s, i, _, l = 1; C.length; ) C.length > l && C.sort(Te), t = C.shift(), l = C.length, t.__d && (n = void 0, r = void 0, s = (r = (e = t).__v).__e, i = [], _ = [], e.__P && ((n = T({}, r)).__v = r.__v + 1, h.vnode && h.vnode(n), oe(e.__P, n, r, e.__n, e.__P.namespaceURI, 32 & r.__u ? [s] : null, i, s ?? A(r), !!(32 & r.__u), _), n.__v = r.__v, n.__.__k[n.__i] = n, We(i, n, _), r.__e = r.__ = null, n.__e != s && Ce(n)));
45
- z.__r = 0;
43
+ function O() {
44
+ for (var t, e, n, r, i, o, l, _ = 1; $.length; ) $.length > _ && $.sort($e), t = $.shift(), _ = $.length, t.__d && (n = void 0, r = void 0, i = (r = (e = t).__v).__e, o = [], l = [], e.__P && ((n = T({}, r)).__v = r.__v + 1, h.vnode && h.vnode(n), se(e.__P, n, r, e.__n, e.__P.namespaceURI, 32 & r.__u ? [i] : null, o, i ?? I(r), !!(32 & r.__u), l), n.__v = r.__v, n.__.__k[n.__i] = n, Ae(o, n, l), r.__e = r.__ = null, n.__e != i && We(n)));
45
+ O.__r = 0;
46
46
  }
47
- function $e(t, e, n, r, s, i, _, l, u, a, p) {
48
- var o, f, d, b, x, k, m, g = r && r.__k || Re, E = e.length;
49
- for (u = ze(n, e, g, u, E), o = 0; o < E; o++) (d = n.__k[o]) != null && (f = d.__i == -1 ? M : g[d.__i] || M, d.__i = o, k = oe(t, d, f, s, i, _, l, u, a, p), b = d.__e, d.ref && f.ref != d.ref && (f.ref && ie(f.ref, null, d), p.push(d.ref, d.__c || b, d)), x == null && b != null && (x = b), (m = !!(4 & d.__u)) || f.__k === d.__k ? u = Ae(d, u, t, m) : typeof d.type == "function" && k !== void 0 ? u = k : b && (u = b.nextSibling), d.__u &= -7);
50
- return n.__e = x, u;
47
+ function Le(t, e, n, r, i, o, l, _, p, a, d) {
48
+ var s, c, u, g, k, b, v, m = r && r.__k || Ie, R = e.length;
49
+ for (p = qe(n, e, m, p, R), s = 0; s < R; s++) (u = n.__k[s]) != null && (c = u.__i == -1 ? A : m[u.__i] || A, u.__i = s, b = se(t, u, c, i, o, l, _, p, a, d), g = u.__e, u.ref && c.ref != u.ref && (c.ref && ie(c.ref, null, u), d.push(u.ref, u.__c || g, u)), k == null && g != null && (k = g), (v = !!(4 & u.__u)) || c.__k === u.__k ? p = He(u, p, t, v) : typeof u.type == "function" && b !== void 0 ? p = b : g && (p = g.nextSibling), u.__u &= -7);
50
+ return n.__e = k, p;
51
51
  }
52
- function ze(t, e, n, r, s) {
53
- var i, _, l, u, a, p = n.length, o = p, f = 0;
54
- for (t.__k = new Array(s), i = 0; i < s; i++) (_ = e[i]) != null && typeof _ != "boolean" && typeof _ != "function" ? (typeof _ == "string" || typeof _ == "number" || typeof _ == "bigint" || _.constructor == String ? _ = t.__k[i] = B(null, _, null, null, null) : q(_) ? _ = t.__k[i] = B(L, { children: _ }, null, null, null) : _.constructor == null && _.__b > 0 ? _ = t.__k[i] = B(_.type, _.props, _.key, _.ref ? _.ref : null, _.__v) : t.__k[i] = _, u = i + f, _.__ = t, _.__b = t.__b + 1, (a = _.__i = je(_, n, u, o)) != -1 && (o--, (l = n[a]) && (l.__u |= 2)), l == null || l.__v == null ? (a == -1 && (s > p ? f-- : s < p && f++), typeof _.type != "function" && (_.__u |= 4)) : a != u && (a == u - 1 ? f-- : a == u + 1 ? f++ : (a > u ? f-- : f++, _.__u |= 4))) : t.__k[i] = null;
55
- if (o) for (i = 0; i < p; i++) (l = n[i]) != null && (2 & l.__u) == 0 && (l.__e == r && (r = A(l)), Me(l, l));
52
+ function qe(t, e, n, r, i) {
53
+ var o, l, _, p, a, d = n.length, s = d, c = 0;
54
+ for (t.__k = new Array(i), o = 0; o < i; o++) (l = e[o]) != null && typeof l != "boolean" && typeof l != "function" ? (typeof l == "string" || typeof l == "number" || typeof l == "bigint" || l.constructor == String ? l = t.__k[o] = U(null, l, null, null, null) : X(l) ? l = t.__k[o] = U(N, { children: l }, null, null, null) : l.constructor === void 0 && l.__b > 0 ? l = t.__k[o] = U(l.type, l.props, l.key, l.ref ? l.ref : null, l.__v) : t.__k[o] = l, p = o + c, l.__ = t, l.__b = t.__b + 1, _ = null, (a = l.__i = Ve(l, n, p, s)) != -1 && (s--, (_ = n[a]) && (_.__u |= 2)), _ == null || _.__v == null ? (a == -1 && (i > d ? c-- : i < d && c++), typeof l.type != "function" && (l.__u |= 4)) : a != p && (a == p - 1 ? c-- : a == p + 1 ? c++ : (a > p ? c-- : c++, l.__u |= 4))) : t.__k[o] = null;
55
+ if (s) for (o = 0; o < d; o++) (_ = n[o]) != null && (2 & _.__u) == 0 && (_.__e == r && (r = I(_)), Ne(_, _));
56
56
  return r;
57
57
  }
58
- function Ae(t, e, n, r) {
59
- var s, i;
58
+ function He(t, e, n, r) {
59
+ var i, o;
60
60
  if (typeof t.type == "function") {
61
- for (s = t.__k, i = 0; s && i < s.length; i++) s[i] && (s[i].__ = t, e = Ae(s[i], e, n, r));
61
+ for (i = t.__k, o = 0; i && o < i.length; o++) i[o] && (i[o].__ = t, e = He(i[o], e, n, r));
62
62
  return e;
63
63
  }
64
- t.__e != e && (r && (e && t.type && !e.parentNode && (e = A(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
64
+ t.__e != e && (r && (e && t.type && !e.parentNode && (e = I(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
65
65
  do
66
66
  e = e && e.nextSibling;
67
67
  while (e != null && e.nodeType == 8);
68
68
  return e;
69
69
  }
70
- function je(t, e, n, r) {
71
- var s, i, _, l = t.key, u = t.type, a = e[n], p = a != null && (2 & a.__u) == 0;
72
- if (a === null && l == null || p && l == a.key && u == a.type) return n;
73
- if (r > (p ? 1 : 0)) {
74
- for (s = n - 1, i = n + 1; s >= 0 || i < e.length; ) if ((a = e[_ = s >= 0 ? s-- : i++]) != null && (2 & a.__u) == 0 && l == a.key && u == a.type) return _;
70
+ function Ve(t, e, n, r) {
71
+ var i, o, l, _ = t.key, p = t.type, a = e[n], d = a != null && (2 & a.__u) == 0;
72
+ if (a === null && _ == null || d && _ == a.key && p == a.type) return n;
73
+ if (r > (d ? 1 : 0)) {
74
+ for (i = n - 1, o = n + 1; i >= 0 || o < e.length; ) if ((a = e[l = i >= 0 ? i-- : o++]) != null && (2 & a.__u) == 0 && _ == a.key && p == a.type) return l;
75
75
  }
76
76
  return -1;
77
77
  }
78
- function ce(t, e, n) {
79
- e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || Ue.test(e) ? n : n + "px";
78
+ function fe(t, e, n) {
79
+ e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || je.test(e) ? n : n + "px";
80
80
  }
81
- function D(t, e, n, r, s) {
82
- var i, _;
81
+ function B(t, e, n, r, i) {
82
+ var o, l;
83
83
  e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
84
84
  else {
85
- if (typeof r == "string" && (t.style.cssText = r = ""), r) for (e in r) n && e in n || ce(t.style, e, "");
86
- if (n) for (e in n) r && n[e] == r[e] || ce(t.style, e, n[e]);
85
+ if (typeof r == "string" && (t.style.cssText = r = ""), r) for (e in r) n && e in n || fe(t.style, e, "");
86
+ if (n) for (e in n) r && n[e] == r[e] || fe(t.style, e, n[e]);
87
87
  }
88
- else if (e[0] == "o" && e[1] == "n") i = e != (e = e.replace(Ee, "$1")), _ = e.toLowerCase(), e = _ in t || e == "onFocusOut" || e == "onFocusIn" ? _.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + i] = n, n ? r ? n.u = r.u : (n.u = ne, t.addEventListener(e, i ? X : G, i)) : t.removeEventListener(e, i ? X : G, i);
88
+ else if (e[0] == "o" && e[1] == "n") o = e != (e = e.replace(Ee, "$1")), l = e.toLowerCase(), e = l in t || e == "onFocusOut" || e == "onFocusIn" ? l.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + o] = n, n ? r ? n.u = r.u : (n.u = re, t.addEventListener(e, o ? Z : J, o)) : t.removeEventListener(e, o ? Z : J, o);
89
89
  else {
90
- if (s == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
90
+ if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
91
91
  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 {
92
92
  t[e] = n ?? "";
93
93
  break e;
@@ -96,99 +96,99 @@ function D(t, e, n, r, s) {
96
96
  typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
97
97
  }
98
98
  }
99
- function ue(t) {
99
+ function pe(t) {
100
100
  return function(e) {
101
101
  if (this.l) {
102
102
  var n = this.l[e.type + t];
103
- if (e.t == null) e.t = ne++;
103
+ if (e.t == null) e.t = re++;
104
104
  else if (e.t < n.u) return;
105
105
  return n(h.event ? h.event(e) : e);
106
106
  }
107
107
  };
108
108
  }
109
- function oe(t, e, n, r, s, i, _, l, u, a) {
110
- var p, o, f, d, b, x, k, m, g, E, R, N, W, _e, I, H, K, S = e.type;
111
- if (e.constructor != null) return null;
112
- 128 & n.__u && (u = !!(32 & n.__u), i = [l = e.__e = n.__e]), (p = h.__b) && p(e);
113
- e: if (typeof S == "function") try {
114
- if (m = e.props, g = "prototype" in S && S.prototype.render, E = (p = S.contextType) && r[p.__c], R = p ? E ? E.props.value : p.__ : r, n.__c ? k = (o = e.__c = n.__c).__ = o.__E : (g ? e.__c = o = new S(m, R) : (e.__c = o = new U(m, R), o.constructor = S, o.render = qe), E && E.sub(o), o.state || (o.state = {}), o.__n = r, f = o.__d = !0, o.__h = [], o._sb = []), g && o.__s == null && (o.__s = o.state), g && S.getDerivedStateFromProps != null && (o.__s == o.state && (o.__s = T({}, o.__s)), T(o.__s, S.getDerivedStateFromProps(m, o.__s))), d = o.props, b = o.state, o.__v = e, f) g && S.getDerivedStateFromProps == null && o.componentWillMount != null && o.componentWillMount(), g && o.componentDidMount != null && o.__h.push(o.componentDidMount);
109
+ function se(t, e, n, r, i, o, l, _, p, a) {
110
+ var d, s, c, u, g, k, b, v, m, R, C, z, W, ce, P, L, Y, x = e.type;
111
+ if (e.constructor !== void 0) return null;
112
+ 128 & n.__u && (p = !!(32 & n.__u), o = [_ = e.__e = n.__e]), (d = h.__b) && d(e);
113
+ e: if (typeof x == "function") try {
114
+ if (v = e.props, m = "prototype" in x && x.prototype.render, R = (d = x.contextType) && r[d.__c], C = d ? R ? R.props.value : d.__ : r, n.__c ? b = (s = e.__c = n.__c).__ = s.__E : (m ? e.__c = s = new x(v, C) : (e.__c = s = new F(v, C), s.constructor = x, s.render = Ke), R && R.sub(s), s.state || (s.state = {}), s.__n = r, c = s.__d = !0, s.__h = [], s._sb = []), m && s.__s == null && (s.__s = s.state), m && x.getDerivedStateFromProps != null && (s.__s == s.state && (s.__s = T({}, s.__s)), T(s.__s, x.getDerivedStateFromProps(v, s.__s))), u = s.props, g = s.state, s.__v = e, c) m && x.getDerivedStateFromProps == null && s.componentWillMount != null && s.componentWillMount(), m && s.componentDidMount != null && s.__h.push(s.componentDidMount);
115
115
  else {
116
- if (g && S.getDerivedStateFromProps == null && m !== d && o.componentWillReceiveProps != null && o.componentWillReceiveProps(m, R), e.__v == n.__v || !o.__e && o.shouldComponentUpdate != null && o.shouldComponentUpdate(m, o.__s, R) === !1) {
117
- for (e.__v != n.__v && (o.props = m, o.state = o.__s, o.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function($) {
118
- $ && ($.__ = e);
119
- }), N = 0; N < o._sb.length; N++) o.__h.push(o._sb[N]);
120
- o._sb = [], o.__h.length && _.push(o);
116
+ if (m && x.getDerivedStateFromProps == null && v !== u && s.componentWillReceiveProps != null && s.componentWillReceiveProps(v, C), e.__v == n.__v || !s.__e && s.shouldComponentUpdate != null && s.shouldComponentUpdate(v, s.__s, C) === !1) {
117
+ for (e.__v != n.__v && (s.props = v, s.state = s.__s, s.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(E) {
118
+ E && (E.__ = e);
119
+ }), z = 0; z < s._sb.length; z++) s.__h.push(s._sb[z]);
120
+ s._sb = [], s.__h.length && l.push(s);
121
121
  break e;
122
122
  }
123
- o.componentWillUpdate != null && o.componentWillUpdate(m, o.__s, R), g && o.componentDidUpdate != null && o.__h.push(function() {
124
- o.componentDidUpdate(d, b, x);
123
+ s.componentWillUpdate != null && s.componentWillUpdate(v, s.__s, C), m && s.componentDidUpdate != null && s.__h.push(function() {
124
+ s.componentDidUpdate(u, g, k);
125
125
  });
126
126
  }
127
- if (o.context = R, o.props = m, o.__P = t, o.__e = !1, W = h.__r, _e = 0, g) {
128
- for (o.state = o.__s, o.__d = !1, W && W(e), p = o.render(o.props, o.state, o.context), I = 0; I < o._sb.length; I++) o.__h.push(o._sb[I]);
129
- o._sb = [];
127
+ if (s.context = C, s.props = v, s.__P = t, s.__e = !1, W = h.__r, ce = 0, m) {
128
+ for (s.state = s.__s, s.__d = !1, W && W(e), d = s.render(s.props, s.state, s.context), P = 0; P < s._sb.length; P++) s.__h.push(s._sb[P]);
129
+ s._sb = [];
130
130
  } else do
131
- o.__d = !1, W && W(e), p = o.render(o.props, o.state, o.context), o.state = o.__s;
132
- while (o.__d && ++_e < 25);
133
- o.state = o.__s, o.getChildContext != null && (r = T(T({}, r), o.getChildContext())), g && !f && o.getSnapshotBeforeUpdate != null && (x = o.getSnapshotBeforeUpdate(d, b)), H = p, p != null && p.type === L && p.key == null && (H = He(p.props.children)), l = $e(t, q(H) ? H : [H], e, n, r, s, i, _, l, u, a), o.base = e.__e, e.__u &= -161, o.__h.length && _.push(o), k && (o.__E = o.__ = null);
134
- } catch ($) {
135
- if (e.__v = null, u || i != null) if ($.then) {
136
- for (e.__u |= u ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
137
- i[i.indexOf(l)] = null, e.__e = l;
131
+ s.__d = !1, W && W(e), d = s.render(s.props, s.state, s.context), s.state = s.__s;
132
+ while (s.__d && ++ce < 25);
133
+ s.state = s.__s, s.getChildContext != null && (r = T(T({}, r), s.getChildContext())), m && !c && s.getSnapshotBeforeUpdate != null && (k = s.getSnapshotBeforeUpdate(u, g)), L = d, d != null && d.type === N && d.key == null && (L = Me(d.props.children)), _ = Le(t, X(L) ? L : [L], e, n, r, i, o, l, _, p, a), s.base = e.__e, e.__u &= -161, s.__h.length && l.push(s), b && (s.__E = s.__ = null);
134
+ } catch (E) {
135
+ if (e.__v = null, p || o != null) if (E.then) {
136
+ for (e.__u |= p ? 160 : 128; _ && _.nodeType == 8 && _.nextSibling; ) _ = _.nextSibling;
137
+ o[o.indexOf(_)] = null, e.__e = _;
138
138
  } else {
139
- for (K = i.length; K--; ) re(i[K]);
140
- J(e);
139
+ for (Y = o.length; Y--; ) oe(o[Y]);
140
+ Q(e);
141
141
  }
142
- else e.__e = n.__e, e.__k = n.__k, $.then || J(e);
143
- h.__e($, e, n);
142
+ else e.__e = n.__e, e.__k = n.__k, E.then || Q(e);
143
+ h.__e(E, e, n);
144
144
  }
145
- else i == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = Oe(n.__e, e, n, r, s, i, _, u, a);
146
- return (p = h.diffed) && p(e), 128 & e.__u ? void 0 : l;
145
+ else o == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : _ = e.__e = Xe(n.__e, e, n, r, i, o, l, p, a);
146
+ return (d = h.diffed) && d(e), 128 & e.__u ? void 0 : _;
147
147
  }
148
- function J(t) {
149
- t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(J);
148
+ function Q(t) {
149
+ t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(Q);
150
150
  }
151
- function We(t, e, n) {
151
+ function Ae(t, e, n) {
152
152
  for (var r = 0; r < n.length; r++) ie(n[r], n[++r], n[++r]);
153
- h.__c && h.__c(e, t), t.some(function(s) {
153
+ h.__c && h.__c(e, t), t.some(function(i) {
154
154
  try {
155
- t = s.__h, s.__h = [], t.some(function(i) {
156
- i.call(s);
155
+ t = i.__h, i.__h = [], t.some(function(o) {
156
+ o.call(i);
157
157
  });
158
- } catch (i) {
159
- h.__e(i, s.__v);
158
+ } catch (o) {
159
+ h.__e(o, i.__v);
160
160
  }
161
161
  });
162
162
  }
163
- function He(t) {
164
- return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : q(t) ? t.map(He) : T({}, t);
163
+ function Me(t) {
164
+ return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : X(t) ? t.map(Me) : T({}, t);
165
165
  }
166
- function Oe(t, e, n, r, s, i, _, l, u) {
167
- var a, p, o, f, d, b, x, k = n.props || M, m = e.props, g = e.type;
168
- if (g == "svg" ? s = "http://www.w3.org/2000/svg" : g == "math" ? s = "http://www.w3.org/1998/Math/MathML" : s || (s = "http://www.w3.org/1999/xhtml"), i != null) {
169
- for (a = 0; a < i.length; a++) if ((d = i[a]) && "setAttribute" in d == !!g && (g ? d.localName == g : d.nodeType == 3)) {
170
- t = d, i[a] = null;
166
+ function Xe(t, e, n, r, i, o, l, _, p) {
167
+ var a, d, s, c, u, g, k, b = n.props || A, v = e.props, m = e.type;
168
+ if (m == "svg" ? i = "http://www.w3.org/2000/svg" : m == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), o != null) {
169
+ for (a = 0; a < o.length; a++) if ((u = o[a]) && "setAttribute" in u == !!m && (m ? u.localName == m : u.nodeType == 3)) {
170
+ t = u, o[a] = null;
171
171
  break;
172
172
  }
173
173
  }
174
174
  if (t == null) {
175
- if (g == null) return document.createTextNode(m);
176
- t = document.createElementNS(s, g, m.is && m), l && (h.__m && h.__m(e, i), l = !1), i = null;
175
+ if (m == null) return document.createTextNode(v);
176
+ t = document.createElementNS(i, m, v.is && v), _ && (h.__m && h.__m(e, o), _ = !1), o = null;
177
177
  }
178
- if (g == null) k === m || l && t.data == m || (t.data = m);
178
+ if (m == null) b === v || _ && t.data == v || (t.data = v);
179
179
  else {
180
- if (i = i && O.call(t.childNodes), !l && i != null) for (k = {}, a = 0; a < t.attributes.length; a++) k[(d = t.attributes[a]).name] = d.value;
181
- for (a in k) if (d = k[a], a != "children") {
182
- if (a == "dangerouslySetInnerHTML") o = d;
183
- else if (!(a in m)) {
184
- if (a == "value" && "defaultValue" in m || a == "checked" && "defaultChecked" in m) continue;
185
- D(t, a, null, d, s);
180
+ if (o = o && V.call(t.childNodes), !_ && o != null) for (b = {}, a = 0; a < t.attributes.length; a++) b[(u = t.attributes[a]).name] = u.value;
181
+ for (a in b) if (u = b[a], a != "children") {
182
+ if (a == "dangerouslySetInnerHTML") s = u;
183
+ else if (!(a in v)) {
184
+ if (a == "value" && "defaultValue" in v || a == "checked" && "defaultChecked" in v) continue;
185
+ B(t, a, null, u, i);
186
186
  }
187
187
  }
188
- for (a in m) d = m[a], a == "children" ? f = d : a == "dangerouslySetInnerHTML" ? p = d : a == "value" ? b = d : a == "checked" ? x = d : l && typeof d != "function" || k[a] === d || D(t, a, d, k[a], s);
189
- if (p) l || o && (p.__html == o.__html || p.__html == t.innerHTML) || (t.innerHTML = p.__html), e.__k = [];
190
- else if (o && (t.innerHTML = ""), $e(e.type == "template" ? t.content : t, q(f) ? f : [f], e, n, r, g == "foreignObject" ? "http://www.w3.org/1999/xhtml" : s, i, _, i ? i[0] : n.__k && A(n, 0), l, u), i != null) for (a = i.length; a--; ) re(i[a]);
191
- l || (a = "value", g == "progress" && b == null ? t.removeAttribute("value") : b != null && (b !== t[a] || g == "progress" && !b || g == "option" && b != k[a]) && D(t, a, b, k[a], s), a = "checked", x != null && x != t[a] && D(t, a, x, k[a], s));
188
+ for (a in v) u = v[a], a == "children" ? c = u : a == "dangerouslySetInnerHTML" ? d = u : a == "value" ? g = u : a == "checked" ? k = u : _ && typeof u != "function" || b[a] === u || B(t, a, u, b[a], i);
189
+ if (d) _ || s && (d.__html == s.__html || d.__html == t.innerHTML) || (t.innerHTML = d.__html), e.__k = [];
190
+ else if (s && (t.innerHTML = ""), Le(e.type == "template" ? t.content : t, X(c) ? c : [c], e, n, r, m == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, o, l, o ? o[0] : n.__k && I(n, 0), _, p), o != null) for (a = o.length; a--; ) oe(o[a]);
191
+ _ || (a = "value", m == "progress" && g == null ? t.removeAttribute("value") : g != null && (g !== t[a] || m == "progress" && !g || m == "option" && g != b[a]) && B(t, a, g, b[a], i), a = "checked", k != null && k != t[a] && B(t, a, k, b[a], i));
192
192
  }
193
193
  return t;
194
194
  }
@@ -198,186 +198,268 @@ function ie(t, e, n) {
198
198
  var r = typeof t.__u == "function";
199
199
  r && t.__u(), r && e == null || (t.__u = t(e));
200
200
  } else t.current = e;
201
- } catch (s) {
202
- h.__e(s, n);
201
+ } catch (i) {
202
+ h.__e(i, n);
203
203
  }
204
204
  }
205
- function Me(t, e, n) {
206
- var r, s;
205
+ function Ne(t, e, n) {
206
+ var r, i;
207
207
  if (h.unmount && h.unmount(t), (r = t.ref) && (r.current && r.current != t.__e || ie(r, null, e)), (r = t.__c) != null) {
208
208
  if (r.componentWillUnmount) try {
209
209
  r.componentWillUnmount();
210
- } catch (i) {
211
- h.__e(i, e);
210
+ } catch (o) {
211
+ h.__e(o, e);
212
212
  }
213
213
  r.base = r.__P = null;
214
214
  }
215
- if (r = t.__k) for (s = 0; s < r.length; s++) r[s] && Me(r[s], e, n || typeof t.type != "function");
216
- n || re(t.__e), t.__c = t.__ = t.__e = void 0;
215
+ if (r = t.__k) for (i = 0; i < r.length; i++) r[i] && Ne(r[i], e, n || typeof t.type != "function");
216
+ n || oe(t.__e), t.__c = t.__ = t.__e = void 0;
217
217
  }
218
- function qe(t, e, n) {
218
+ function Ke(t, e, n) {
219
219
  return this.constructor(t, n);
220
220
  }
221
- function Ve(t, e, n) {
222
- var r, s, i, _;
223
- e == document && (e = document.documentElement), h.__ && h.__(t, e), s = (r = !1) ? null : e.__k, i = [], _ = [], oe(e, t = e.__k = Fe(L, null, [t]), s || M, M, e.namespaceURI, s ? null : e.firstChild ? O.call(e.childNodes) : null, i, s ? s.__e : e.firstChild, r, _), We(i, t, _);
221
+ function Ye(t, e, n) {
222
+ var r, i, o, l;
223
+ e == document && (e = document.documentElement), h.__ && h.__(t, e), i = (r = !1) ? null : e.__k, o = [], l = [], se(e, t = e.__k = Oe(N, null, [t]), i || A, A, e.namespaceURI, i ? null : e.firstChild ? V.call(e.childNodes) : null, o, i ? i.__e : e.firstChild, r, l), Ae(o, t, l);
224
224
  }
225
- O = Re.slice, h = { __e: function(t, e, n, r) {
226
- for (var s, i, _; e = e.__; ) if ((s = e.__c) && !s.__) try {
227
- if ((i = s.constructor) && i.getDerivedStateFromError != null && (s.setState(i.getDerivedStateFromError(t)), _ = s.__d), s.componentDidCatch != null && (s.componentDidCatch(t, r || {}), _ = s.__d), _) return s.__E = s;
228
- } catch (l) {
229
- t = l;
225
+ V = Ie.slice, h = { __e: function(t, e, n, r) {
226
+ for (var i, o, l; e = e.__; ) if ((i = e.__c) && !i.__) try {
227
+ if ((o = i.constructor) && o.getDerivedStateFromError != null && (i.setState(o.getDerivedStateFromError(t)), l = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, r || {}), l = i.__d), l) return i.__E = i;
228
+ } catch (_) {
229
+ t = _;
230
230
  }
231
231
  throw t;
232
- } }, xe = 0, U.prototype.setState = function(t, e) {
232
+ } }, Re = 0, F.prototype.setState = function(t, e) {
233
233
  var n;
234
- n = this.__s != null && this.__s != this.state ? this.__s : this.__s = T({}, this.state), typeof t == "function" && (t = t(T({}, n), this.props)), t && T(n, t), t != null && this.__v && (e && this._sb.push(e), ae(this));
235
- }, U.prototype.forceUpdate = function(t) {
236
- this.__v && (this.__e = !0, t && this.__h.push(t), ae(this));
237
- }, U.prototype.render = L, C = [], Se = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Te = function(t, e) {
234
+ n = this.__s != null && this.__s != this.state ? this.__s : this.__s = T({}, this.state), typeof t == "function" && (t = t(T({}, n), this.props)), t && T(n, t), t != null && this.__v && (e && this._sb.push(e), ue(this));
235
+ }, F.prototype.forceUpdate = function(t) {
236
+ this.__v && (this.__e = !0, t && this.__h.push(t), ue(this));
237
+ }, F.prototype.render = N, $ = [], Ce = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, $e = function(t, e) {
238
238
  return t.__v.__b - e.__v.__b;
239
- }, z.__r = 0, Ee = /(PointerCapture)$|Capture$/i, ne = 0, G = ue(!1), X = ue(!0);
240
- var Ke = 0;
241
- function c(t, e, n, r, s, i) {
239
+ }, O.__r = 0, Ee = /(PointerCapture)$|Capture$/i, re = 0, J = pe(!1), Z = pe(!0);
240
+ var Ge = 0;
241
+ function f(t, e, n, r, i, o) {
242
242
  e || (e = {});
243
- var _, l, u = e;
244
- if ("ref" in u) for (l in u = {}, e) l == "ref" ? _ = e[l] : u[l] = e[l];
245
- var a = { type: t, props: u, key: n, ref: _, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Ke, __i: -1, __u: 0, __source: s, __self: i };
246
- if (typeof t == "function" && (_ = t.defaultProps)) for (l in _) u[l] === void 0 && (u[l] = _[l]);
243
+ var l, _, p = e;
244
+ if ("ref" in p) for (_ in p = {}, e) _ == "ref" ? l = e[_] : p[_] = e[_];
245
+ var a = { type: t, props: p, key: n, ref: l, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Ge, __i: -1, __u: 0, __source: i, __self: o };
246
+ if (typeof t == "function" && (l = t.defaultProps)) for (_ in l) p[_] === void 0 && (p[_] = l[_]);
247
247
  return h.vnode && h.vnode(a), a;
248
248
  }
249
- const Ye = (t) => {
250
- const { Component: e, createRoot: n } = t, r = document.createElement("div");
251
- r.setAttribute("id", "twd-sidebar-root"), document.body.appendChild(r), n(r).render(e);
252
- }, Ge = async (t, e, n) => {
253
- for (const r in t) await t[r]();
254
- Ye({ Component: e, createRoot: n });
249
+ const Je = {
250
+ // Colors
251
+ primary: "#3b82f6",
252
+ background: "#1e293b",
253
+ backgroundSecondary: "#334155",
254
+ border: "#475569",
255
+ borderLight: "#64748b",
256
+ text: "#f1f5f9",
257
+ textSecondary: "#cbd5e1",
258
+ textMuted: "#94a3b8",
259
+ // Status colors
260
+ success: "#22c55e",
261
+ successBg: "#14532d",
262
+ error: "#ef4444",
263
+ errorBg: "#7f1d1d",
264
+ warning: "#fbbf24",
265
+ warningBg: "#78350f",
266
+ skip: "#475569",
267
+ skipBg: "#334155",
268
+ // Interactive elements
269
+ buttonPrimary: "#3b82f6",
270
+ buttonPrimaryText: "#ffffff",
271
+ buttonSecondary: "#334155",
272
+ buttonSecondaryText: "#f1f5f9",
273
+ buttonBorder: "#475569",
274
+ // Spacing
275
+ spacingXs: "4px",
276
+ spacingSm: "6px",
277
+ spacingMd: "8px",
278
+ spacingLg: "12px",
279
+ spacingXl: "14px",
280
+ // Typography
281
+ fontSizeXs: "10px",
282
+ fontSizeSm: "12px",
283
+ fontSizeMd: "14px",
284
+ fontSizeLg: "16px",
285
+ fontWeightNormal: "400",
286
+ fontWeightMedium: "500",
287
+ fontWeightBold: "700",
288
+ // Layout
289
+ sidebarWidth: "320px",
290
+ borderRadius: "8px",
291
+ borderRadiusLg: "6px",
292
+ // Effects
293
+ shadow: "2px 0 8px rgba(0,0,0,0.3)",
294
+ shadowSm: "0 2px 4px rgba(0, 0, 0, 0.2)",
295
+ // Z-index
296
+ zIndexSidebar: "1000",
297
+ zIndexSticky: "1000",
298
+ // Animation
299
+ animationDuration: "0.2s",
300
+ // Icon colors
301
+ iconColor: "#f1f5f9",
302
+ iconColorSecondary: "#cbd5e1"
303
+ };
304
+ function Ze(t = {}) {
305
+ const e = { ...Je, ...t };
306
+ return Object.entries(e).map(([n, r]) => `${`--twd-${n.replace(/([A-Z])/g, "-$1").toLowerCase()}`}: ${r};`).join(`
307
+ `);
308
+ }
309
+ function Qe(t) {
310
+ const e = "twd-theme-variables";
311
+ let n = document.getElementById(e);
312
+ n || (n = document.createElement("style"), n.id = e, document.head.appendChild(n));
313
+ const r = Ze(t);
314
+ n.textContent = `
315
+ :root {
316
+ ${r}
317
+ }
318
+ `;
319
+ }
320
+ const et = (t) => {
321
+ const { Component: e, createRoot: n, theme: r } = t;
322
+ Qe(r);
323
+ const i = document.createElement("div");
324
+ i.setAttribute("id", "twd-sidebar-root"), document.body.appendChild(i), n(i).render(e);
325
+ }, tt = async (t, e, n, r) => {
326
+ for (const i in t) await t[i]();
327
+ et({ Component: e, createRoot: n, theme: r });
255
328
  };
256
- var j, y, Y, de, Q = 0, Le = [], v = h, fe = v.__b, pe = v.__r, he = v.diffed, ge = v.__c, me = v.unmount, ye = v.__;
257
- function Ne(t, e) {
258
- v.__h && v.__h(y, t, Q || e), Q = 0;
329
+ var M, y, G, he, q = 0, ze = [], w = h, ge = w.__b, me = w.__r, ve = w.diffed, ye = w.__c, we = w.unmount, be = w.__;
330
+ function ae(t, e) {
331
+ w.__h && w.__h(y, t, q || e), q = 0;
259
332
  var n = y.__H || (y.__H = { __: [], __h: [] });
260
333
  return t >= n.__.length && n.__.push({}), n.__[t];
261
334
  }
262
- function Z(t) {
263
- return Q = 1, Xe(Ie, t);
335
+ function ee(t) {
336
+ return q = 1, nt(Be, t);
264
337
  }
265
- function Xe(t, e, n) {
266
- var r = Ne(j++, 2);
267
- if (r.t = t, !r.__c && (r.__ = [Ie(void 0, e), function(l) {
268
- var u = r.__N ? r.__N[0] : r.__[0], a = r.t(u, l);
269
- u !== a && (r.__N = [a, r.__[1]], r.__c.setState({}));
338
+ function nt(t, e, n) {
339
+ var r = ae(M++, 2);
340
+ if (r.t = t, !r.__c && (r.__ = [Be(void 0, e), function(_) {
341
+ var p = r.__N ? r.__N[0] : r.__[0], a = r.t(p, _);
342
+ p !== a && (r.__N = [a, r.__[1]], r.__c.setState({}));
270
343
  }], r.__c = y, !y.__f)) {
271
- var s = function(l, u, a) {
344
+ var i = function(_, p, a) {
272
345
  if (!r.__c.__H) return !0;
273
- var p = r.__c.__H.__.filter(function(f) {
274
- return !!f.__c;
346
+ var d = r.__c.__H.__.filter(function(c) {
347
+ return !!c.__c;
275
348
  });
276
- if (p.every(function(f) {
277
- return !f.__N;
278
- })) return !i || i.call(this, l, u, a);
279
- var o = r.__c.props !== l;
280
- return p.forEach(function(f) {
281
- if (f.__N) {
282
- var d = f.__[0];
283
- f.__ = f.__N, f.__N = void 0, d !== f.__[0] && (o = !0);
349
+ if (d.every(function(c) {
350
+ return !c.__N;
351
+ })) return !o || o.call(this, _, p, a);
352
+ var s = r.__c.props !== _;
353
+ return d.forEach(function(c) {
354
+ if (c.__N) {
355
+ var u = c.__[0];
356
+ c.__ = c.__N, c.__N = void 0, u !== c.__[0] && (s = !0);
284
357
  }
285
- }), i && i.call(this, l, u, a) || o;
358
+ }), o && o.call(this, _, p, a) || s;
286
359
  };
287
360
  y.__f = !0;
288
- var i = y.shouldComponentUpdate, _ = y.componentWillUpdate;
289
- y.componentWillUpdate = function(l, u, a) {
361
+ var o = y.shouldComponentUpdate, l = y.componentWillUpdate;
362
+ y.componentWillUpdate = function(_, p, a) {
290
363
  if (this.__e) {
291
- var p = i;
292
- i = void 0, s(l, u, a), i = p;
364
+ var d = o;
365
+ o = void 0, i(_, p, a), o = d;
293
366
  }
294
- _ && _.call(this, l, u, a);
295
- }, y.shouldComponentUpdate = s;
367
+ l && l.call(this, _, p, a);
368
+ }, y.shouldComponentUpdate = i;
296
369
  }
297
370
  return r.__N || r.__;
298
371
  }
299
- function Je(t, e) {
300
- var n = Ne(j++, 3);
301
- !v.__s && et(n.__H, e) && (n.__ = t, n.u = e, y.__H.__h.push(n));
372
+ function le(t, e) {
373
+ var n = ae(M++, 3);
374
+ !w.__s && Pe(n.__H, e) && (n.__ = t, n.u = e, y.__H.__h.push(n));
375
+ }
376
+ function H(t) {
377
+ return q = 5, rt(function() {
378
+ return { current: t };
379
+ }, []);
302
380
  }
303
- function Qe() {
304
- for (var t; t = Le.shift(); ) if (t.__P && t.__H) try {
305
- t.__H.__h.forEach(F), t.__H.__h.forEach(ee), t.__H.__h = [];
381
+ function rt(t, e) {
382
+ var n = ae(M++, 7);
383
+ return Pe(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
384
+ }
385
+ function ot() {
386
+ for (var t; t = ze.shift(); ) if (t.__P && t.__H) try {
387
+ t.__H.__h.forEach(j), t.__H.__h.forEach(te), t.__H.__h = [];
306
388
  } catch (e) {
307
- t.__H.__h = [], v.__e(e, t.__v);
389
+ t.__H.__h = [], w.__e(e, t.__v);
308
390
  }
309
391
  }
310
- v.__b = function(t) {
311
- y = null, fe && fe(t);
312
- }, v.__ = function(t, e) {
313
- t && e.__k && e.__k.__m && (t.__m = e.__k.__m), ye && ye(t, e);
314
- }, v.__r = function(t) {
315
- pe && pe(t), j = 0;
392
+ w.__b = function(t) {
393
+ y = null, ge && ge(t);
394
+ }, w.__ = function(t, e) {
395
+ t && e.__k && e.__k.__m && (t.__m = e.__k.__m), be && be(t, e);
396
+ }, w.__r = function(t) {
397
+ me && me(t), M = 0;
316
398
  var e = (y = t.__c).__H;
317
- e && (Y === y ? (e.__h = [], y.__h = [], e.__.forEach(function(n) {
399
+ e && (G === y ? (e.__h = [], y.__h = [], e.__.forEach(function(n) {
318
400
  n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
319
- })) : (e.__h.forEach(F), e.__h.forEach(ee), e.__h = [], j = 0)), Y = y;
320
- }, v.diffed = function(t) {
321
- he && he(t);
401
+ })) : (e.__h.forEach(j), e.__h.forEach(te), e.__h = [], M = 0)), G = y;
402
+ }, w.diffed = function(t) {
403
+ ve && ve(t);
322
404
  var e = t.__c;
323
- e && e.__H && (e.__H.__h.length && (Le.push(e) !== 1 && de === v.requestAnimationFrame || ((de = v.requestAnimationFrame) || Ze)(Qe)), e.__H.__.forEach(function(n) {
405
+ e && e.__H && (e.__H.__h.length && (ze.push(e) !== 1 && he === w.requestAnimationFrame || ((he = w.requestAnimationFrame) || st)(ot)), e.__H.__.forEach(function(n) {
324
406
  n.u && (n.__H = n.u), n.u = void 0;
325
- })), Y = y = null;
326
- }, v.__c = function(t, e) {
407
+ })), G = y = null;
408
+ }, w.__c = function(t, e) {
327
409
  e.some(function(n) {
328
410
  try {
329
- n.__h.forEach(F), n.__h = n.__h.filter(function(r) {
330
- return !r.__ || ee(r);
411
+ n.__h.forEach(j), n.__h = n.__h.filter(function(r) {
412
+ return !r.__ || te(r);
331
413
  });
332
414
  } catch (r) {
333
- e.some(function(s) {
334
- s.__h && (s.__h = []);
335
- }), e = [], v.__e(r, n.__v);
415
+ e.some(function(i) {
416
+ i.__h && (i.__h = []);
417
+ }), e = [], w.__e(r, n.__v);
336
418
  }
337
- }), ge && ge(t, e);
338
- }, v.unmount = function(t) {
339
- me && me(t);
419
+ }), ye && ye(t, e);
420
+ }, w.unmount = function(t) {
421
+ we && we(t);
340
422
  var e, n = t.__c;
341
423
  n && n.__H && (n.__H.__.forEach(function(r) {
342
424
  try {
343
- F(r);
344
- } catch (s) {
345
- e = s;
425
+ j(r);
426
+ } catch (i) {
427
+ e = i;
346
428
  }
347
- }), n.__H = void 0, e && v.__e(e, n.__v));
429
+ }), n.__H = void 0, e && w.__e(e, n.__v));
348
430
  };
349
- var ve = typeof requestAnimationFrame == "function";
350
- function Ze(t) {
431
+ var ke = typeof requestAnimationFrame == "function";
432
+ function st(t) {
351
433
  var e, n = function() {
352
- clearTimeout(r), ve && cancelAnimationFrame(e), setTimeout(t);
434
+ clearTimeout(r), ke && cancelAnimationFrame(e), setTimeout(t);
353
435
  }, r = setTimeout(n, 35);
354
- ve && (e = requestAnimationFrame(n));
436
+ ke && (e = requestAnimationFrame(n));
355
437
  }
356
- function F(t) {
438
+ function j(t) {
357
439
  var e = y, n = t.__c;
358
440
  typeof n == "function" && (t.__c = void 0, n()), y = e;
359
441
  }
360
- function ee(t) {
442
+ function te(t) {
361
443
  var e = y;
362
444
  t.__c = t.__(), y = e;
363
445
  }
364
- function et(t, e) {
446
+ function Pe(t, e) {
365
447
  return !t || t.length !== e.length || e.some(function(n, r) {
366
448
  return n !== t[r];
367
449
  });
368
450
  }
369
- function Ie(t, e) {
451
+ function Be(t, e) {
370
452
  return typeof e == "function" ? e(t) : e;
371
453
  }
372
- const tt = (t) => {
454
+ const it = (t) => {
373
455
  const e = /* @__PURE__ */ new Map(), n = [];
374
456
  for (const r of t) e.set(r.id, { ...r, childrenNodes: [] });
375
457
  for (const r of e.values())
376
458
  r.parent ? e.get(r.parent)?.childrenNodes?.push(r) : n.push(r);
377
459
  return n;
378
- }, nt = {
460
+ }, at = {
379
461
  animation: "spin 1s linear infinite"
380
- }, rt = () => /* @__PURE__ */ c(
462
+ }, lt = () => /* @__PURE__ */ f(
381
463
  "svg",
382
464
  {
383
465
  xmlns: "http://www.w3.org/2000/svg",
@@ -385,23 +467,23 @@ const tt = (t) => {
385
467
  height: "24",
386
468
  viewBox: "0 0 24 24",
387
469
  fill: "none",
388
- stroke: "#364153",
470
+ stroke: "var(--twd-icon-color-secondary)",
389
471
  strokeWidth: "2",
390
472
  strokeLinecap: "round",
391
473
  strokeLinejoin: "round",
392
474
  className: "lucide lucide-loader-circle-icon lucide-loader-circle",
393
- style: nt,
475
+ style: at,
394
476
  "data-testid": "loader-icon",
395
- children: /* @__PURE__ */ c("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
477
+ children: /* @__PURE__ */ f("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
396
478
  }
397
- ), P = document.createElement("style");
398
- P && !document.getElementById("loader-spin-keyframes") && (P.id = "loader-spin-keyframes", P.innerHTML = `
479
+ ), D = document.createElement("style");
480
+ D && !document.getElementById("loader-spin-keyframes") && (D.id = "loader-spin-keyframes", D.innerHTML = `
399
481
  @keyframes spin {
400
482
  0% { transform: rotate(0deg); }
401
483
  100% { transform: rotate(360deg); }
402
484
  }
403
- `, document.head.appendChild(P));
404
- const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
485
+ `, document.head.appendChild(D));
486
+ const K = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ f(
405
487
  "svg",
406
488
  {
407
489
  xmlns: "http://www.w3.org/2000/svg",
@@ -409,7 +491,7 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
409
491
  height: "16",
410
492
  viewBox: "0 0 24 24",
411
493
  fill: "none",
412
- stroke: "#000",
494
+ stroke: "var(--twd-icon-color)",
413
495
  strokeWidth: "2",
414
496
  strokeLinecap: "round",
415
497
  strokeLinejoin: "round",
@@ -417,13 +499,13 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
417
499
  "data-testid": n,
418
500
  children: e
419
501
  }
420
- ), ot = () => /* @__PURE__ */ c(V, { className: "lucide-play-icon lucide-play", dataTestId: "play-icon", children: /* @__PURE__ */ c("path", { d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" }) }), De = ({ id: t, name: e, skip: n, only: r }) => /* @__PURE__ */ c(L, { children: [
502
+ ), _t = () => /* @__PURE__ */ f(K, { className: "lucide-play-icon lucide-play", dataTestId: "play-icon", children: /* @__PURE__ */ f("path", { d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" }) }), De = ({ id: t, name: e, skip: n, only: r }) => /* @__PURE__ */ f(N, { children: [
421
503
  e,
422
504
  " ",
423
- r && /* @__PURE__ */ c(
505
+ r && /* @__PURE__ */ f(
424
506
  "span",
425
507
  {
426
- style: { color: "#2563eb" },
508
+ style: { color: "var(--twd-primary)" },
427
509
  "data-testid": `only-indicator-${t}`,
428
510
  children: [
429
511
  " ",
@@ -431,10 +513,10 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
431
513
  ]
432
514
  }
433
515
  ),
434
- n && /* @__PURE__ */ c(
516
+ n && /* @__PURE__ */ f(
435
517
  "span",
436
518
  {
437
- style: { color: "#6b7280" },
519
+ style: { color: "var(--twd-text-secondary)" },
438
520
  "data-testid": `skip-indicator-${t}`,
439
521
  children: [
440
522
  " ",
@@ -442,36 +524,36 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
442
524
  ]
443
525
  }
444
526
  )
445
- ] }), it = (t) => {
527
+ ] }), ct = (t) => {
446
528
  switch (t.status) {
447
529
  case "pass":
448
530
  return {
449
531
  item: {
450
- background: "#dcfce7"
532
+ background: "var(--twd-success-bg)"
451
533
  },
452
534
  container: {
453
- borderLeft: "3px solid #00c951"
535
+ borderLeft: "3px solid var(--twd-success)"
454
536
  }
455
537
  };
456
538
  case "fail":
457
539
  return {
458
540
  item: {
459
- background: "#fee2e2"
541
+ background: "var(--twd-error-bg)"
460
542
  },
461
543
  container: {
462
- borderLeft: "3px solid #fb2c36"
544
+ borderLeft: "3px solid var(--twd-error)"
463
545
  }
464
546
  };
465
547
  case "skip":
466
548
  return {
467
549
  item: {
468
- background: "#f3f4f6"
550
+ background: "var(--twd-skip-bg)"
469
551
  }
470
552
  };
471
553
  case "running":
472
554
  return {
473
555
  item: {
474
- background: "#fef9c3"
556
+ background: "var(--twd-warning-bg)"
475
557
  }
476
558
  };
477
559
  default:
@@ -481,40 +563,72 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
481
563
  }
482
564
  };
483
565
  }
484
- }, st = (t) => t.startsWith("Assertion passed") || t.startsWith("Event fired") ? { color: "#0d542b", fontWeight: "700" } : t.startsWith("Test failed") ? { color: "#fb2c36", fontWeight: "700" } : {}, _t = ({
566
+ }, dt = (t) => t.startsWith("Assertion passed") || t.startsWith("Event fired") ? { color: "var(--twd-success)", fontWeight: "var(--twd-font-weight-bold)" } : t.startsWith("Test failed") ? { color: "var(--twd-error)", fontWeight: "var(--twd-font-weight-bold)" } : {}, ut = ({
485
567
  node: t,
486
568
  depth: e,
487
569
  id: n,
488
570
  runTest: r
489
571
  }) => {
490
- const s = it(t);
491
- return /* @__PURE__ */ c(
572
+ const i = ct(t), o = H(null), l = H(t.status), _ = H(t.logs?.length || 0), p = typeof window < "u" && sessionStorage.getItem("twd-last-run-test-name") === t.name;
573
+ le(() => {
574
+ const d = o.current;
575
+ if (!d || !t.logs || t.logs.length === 0) return;
576
+ const s = l.current === "running" && (t.status === "pass" || t.status === "fail"), c = t.logs.length > _.current;
577
+ (s || c) && setTimeout(() => {
578
+ d.scrollTop = d.scrollHeight;
579
+ }, 0), l.current = t.status, _.current = t.logs.length;
580
+ }, [t.status, t.logs]);
581
+ const a = () => {
582
+ switch (t.status) {
583
+ case "pass":
584
+ return "passed";
585
+ case "fail":
586
+ return "failed";
587
+ case "running":
588
+ return "running";
589
+ case "skip":
590
+ return "skipped";
591
+ default:
592
+ return "not run";
593
+ }
594
+ };
595
+ return /* @__PURE__ */ f(
492
596
  "li",
493
597
  {
494
598
  style: {
495
- marginBottom: "4px",
496
- marginLeft: e * 6,
497
- ...s.container
599
+ marginBottom: "var(--twd-spacing-xs)",
600
+ marginLeft: `calc(${e} * var(--twd-spacing-sm))`,
601
+ ...i.container
498
602
  },
499
603
  "data-testid": `test-list-item-${n}`,
604
+ "data-test-name": t.name,
605
+ role: "listitem",
606
+ "aria-label": `Test ${t.name}, status: ${a()}`,
500
607
  children: [
501
- /* @__PURE__ */ c(
608
+ /* @__PURE__ */ f(
502
609
  "div",
503
610
  {
504
611
  style: {
505
612
  display: "flex",
506
613
  alignItems: "left",
507
614
  justifyContent: "space-between",
508
- padding: "4px 6px",
509
- borderRadius: "4px",
510
- ...s.item
615
+ padding: "var(--twd-spacing-xs) var(--twd-spacing-sm)",
616
+ borderRadius: "var(--twd-border-radius)",
617
+ ...i.item,
618
+ ...p && {
619
+ border: "1px dashed var(--twd-border)"
620
+ }
511
621
  },
512
622
  children: [
513
- /* @__PURE__ */ c(
623
+ /* @__PURE__ */ f(
514
624
  "span",
515
625
  {
516
- style: { fontWeight: "500", color: "#374151", maxWidth: "220px" },
517
- children: /* @__PURE__ */ c(
626
+ style: {
627
+ fontWeight: "var(--twd-font-weight-medium)",
628
+ color: "var(--twd-text)",
629
+ maxWidth: "220px"
630
+ },
631
+ children: /* @__PURE__ */ f(
518
632
  De,
519
633
  {
520
634
  id: n,
@@ -525,19 +639,19 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
525
639
  )
526
640
  }
527
641
  ),
528
- /* @__PURE__ */ c(
642
+ /* @__PURE__ */ f(
529
643
  "button",
530
644
  {
531
645
  onClick: () => r(n),
532
646
  "aria-label": `Run ${t.name} test`,
533
647
  style: {
534
648
  background: "transparent",
535
- border: "1px solid #d1d5db",
536
- borderRadius: "4px",
649
+ border: "1px solid var(--twd-border-light)",
650
+ borderRadius: "var(--twd-border-radius)",
537
651
  padding: "0",
538
652
  cursor: "pointer",
539
653
  verticalAlign: "middle",
540
- fontSize: "12px",
654
+ fontSize: "var(--twd-font-size-sm)",
541
655
  width: "24px",
542
656
  height: "24px",
543
657
  display: "flex",
@@ -546,38 +660,39 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
546
660
  },
547
661
  disabled: t.status === "running",
548
662
  "data-testid": `run-test-button-${n}`,
549
- children: t.status === "running" ? /* @__PURE__ */ c(rt, {}) : /* @__PURE__ */ c(ot, {})
663
+ children: t.status === "running" ? /* @__PURE__ */ f(lt, {}) : /* @__PURE__ */ f(_t, {})
550
664
  }
551
665
  )
552
666
  ]
553
667
  }
554
668
  ),
555
- t.logs && t.logs.length > 0 && /* @__PURE__ */ c(
669
+ t.logs && t.logs.length > 0 && /* @__PURE__ */ f(
556
670
  "ul",
557
671
  {
672
+ ref: o,
558
673
  style: {
559
- borderRadius: "4px",
674
+ borderRadius: "var(--twd-border-radius)",
560
675
  maxHeight: "260px",
561
676
  overflowY: "auto",
562
677
  padding: 0,
563
- background: "#f3f4f6",
678
+ background: "var(--twd-background-secondary)",
564
679
  listStyle: "none",
565
- marginTop: "4px",
680
+ marginTop: "var(--twd-spacing-xs)",
566
681
  textAlign: "left"
567
682
  },
568
- children: t.logs.map((i, _) => /* @__PURE__ */ c(
683
+ children: t.logs.map((d, s) => /* @__PURE__ */ f(
569
684
  "li",
570
685
  {
571
686
  style: {
572
- fontSize: "12px",
573
- padding: "4px 6px",
574
- borderBottom: "1px solid #d1d5db",
575
- color: "#374151",
576
- ...st(i)
687
+ fontSize: "var(--twd-font-size-sm)",
688
+ padding: "var(--twd-spacing-xs) var(--twd-spacing-sm)",
689
+ borderBottom: "1px solid var(--twd-border-light)",
690
+ color: "var(--twd-text)",
691
+ ...dt(d)
577
692
  },
578
- children: i
693
+ children: d
579
694
  },
580
- _
695
+ s
581
696
  ))
582
697
  }
583
698
  )
@@ -585,65 +700,97 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
585
700
  },
586
701
  t.name
587
702
  );
588
- }, lt = () => /* @__PURE__ */ c(V, { className: "lucide-chevron-down-icon lucide-chevron-down", dataTestId: "chevron-down-icon", children: /* @__PURE__ */ c("path", { d: "m6 9 6 6 6-6" }) }), at = () => /* @__PURE__ */ c(V, { className: "lucide-chevron-right-icon lucide-chevron-right", dataTestId: "chevron-right-icon", children: /* @__PURE__ */ c("path", { d: "m9 18 6-6-6-6" }) }), ct = ({ tests: t, runTest: e }) => {
589
- const [n, r] = Z({}), s = (l) => r((u) => ({ ...u, [l]: !u[l] })), i = (l, u = 0) => {
590
- if (l.type === "test")
591
- return /* @__PURE__ */ c(
592
- _t,
703
+ }, ft = () => /* @__PURE__ */ f(K, { className: "lucide-chevron-down-icon lucide-chevron-down", dataTestId: "chevron-down-icon", children: /* @__PURE__ */ f("path", { d: "m6 9 6 6 6-6" }) }), pt = () => /* @__PURE__ */ f(K, { className: "lucide-chevron-right-icon lucide-chevron-right", dataTestId: "chevron-right-icon", children: /* @__PURE__ */ f("path", { d: "m9 18 6-6-6-6" }) }), ht = ({ tests: t, runTest: e }) => {
704
+ const [n, r] = ee({}), i = H(null), o = H(!1), l = (a) => r((d) => ({ ...d, [a]: !d[a] }));
705
+ le(() => {
706
+ if (o.current) return;
707
+ const a = sessionStorage.getItem("twd-last-run-test-name");
708
+ if (!a) return;
709
+ const d = setTimeout(() => {
710
+ const s = document.querySelector(`[data-test-name="${a}"]`);
711
+ if (s) {
712
+ const c = i.current?.closest('[data-testid="twd-sidebar"]');
713
+ if (c) {
714
+ const u = s.getBoundingClientRect(), g = c.getBoundingClientRect(), k = c.scrollTop, b = u.top - g.top + k;
715
+ c.scrollTo({
716
+ top: b - 150,
717
+ // 150px offset from top
718
+ behavior: "smooth"
719
+ });
720
+ }
721
+ o.current = !0;
722
+ }
723
+ }, 100);
724
+ return () => clearTimeout(d);
725
+ }, []);
726
+ const _ = (a, d = 0) => {
727
+ if (a.type === "test")
728
+ return /* @__PURE__ */ f(
729
+ ut,
593
730
  {
594
- node: l,
595
- depth: u,
596
- id: l.id,
597
- runTest: () => e(l.id)
731
+ node: a,
732
+ depth: d,
733
+ id: a.id,
734
+ runTest: () => e(a.id)
598
735
  },
599
- l.id
736
+ a.id
600
737
  );
601
- const a = n[l.id];
602
- return /* @__PURE__ */ c("li", { style: { marginLeft: u * 12 }, children: [
603
- /* @__PURE__ */ c(
738
+ const s = n[a.id];
739
+ return /* @__PURE__ */ f("li", { style: { marginLeft: `calc(${d} * var(--twd-spacing-lg))` }, children: [
740
+ /* @__PURE__ */ f(
604
741
  "span",
605
742
  {
606
743
  style: {
607
- fontWeight: "bold",
744
+ fontWeight: "var(--twd-font-weight-bold)",
608
745
  cursor: "pointer",
609
- color: "#374151",
746
+ color: "var(--twd-text)",
610
747
  display: "flex",
611
748
  alignItems: "center",
612
749
  justifyContent: "space-between",
613
- marginBottom: "4px",
614
- gap: "6px"
750
+ marginBottom: "var(--twd-spacing-xs)",
751
+ gap: "var(--twd-spacing-sm)"
615
752
  },
616
- "data-testid": `test-group-${l.name}`,
753
+ "data-testid": `test-group-${a.name}`,
617
754
  tabIndex: 0,
618
755
  role: "button",
619
- "aria-expanded": !a,
620
- onClick: () => s(l.id),
756
+ "aria-expanded": !s,
757
+ "aria-label": `${s ? "Expand" : "Collapse"} test suite ${a.name}`,
758
+ onClick: () => l(a.id),
621
759
  children: [
622
- /* @__PURE__ */ c(De, { id: l.id, name: l.name, skip: l.skip, only: l.only }),
623
- a ? /* @__PURE__ */ c(at, {}) : /* @__PURE__ */ c(lt, {})
760
+ /* @__PURE__ */ f(De, { id: a.id, name: a.name, skip: a.skip, only: a.only }),
761
+ s ? /* @__PURE__ */ f(pt, {}) : /* @__PURE__ */ f(ft, {})
624
762
  ]
625
763
  }
626
764
  ),
627
- !a && l.childrenNodes && l.childrenNodes.length > 0 && /* @__PURE__ */ c("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: l.childrenNodes.map((p) => i(p, u + 1)) })
628
- ] }, l.id);
629
- }, _ = tt(t);
630
- return /* @__PURE__ */ c("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: _.map((l) => i(l)) });
631
- }, ut = {
765
+ !s && a.childrenNodes && a.childrenNodes.length > 0 && /* @__PURE__ */ f("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: a.childrenNodes.map((c) => _(c, d + 1)) })
766
+ ] }, a.id);
767
+ }, p = it(t);
768
+ return /* @__PURE__ */ f(
769
+ "ul",
770
+ {
771
+ ref: i,
772
+ style: { listStyle: "none", padding: 0, margin: 0 },
773
+ role: "list",
774
+ "aria-label": "Test list",
775
+ children: p.map((a) => _(a))
776
+ }
777
+ );
778
+ }, gt = {
632
779
  left: {
633
780
  left: 0,
634
- borderTopRightRadius: "6px",
635
- borderBottomRightRadius: "6px",
781
+ borderTopRightRadius: "var(--twd-border-radius-lg)",
782
+ borderBottomRightRadius: "var(--twd-border-radius-lg)",
636
783
  borderTopLeftRadius: "0",
637
784
  borderBottomLeftRadius: "0"
638
785
  },
639
786
  right: {
640
787
  right: 0,
641
- borderTopLeftRadius: "6px",
642
- borderBottomLeftRadius: "6px",
788
+ borderTopLeftRadius: "var(--twd-border-radius-lg)",
789
+ borderBottomLeftRadius: "var(--twd-border-radius-lg)",
643
790
  borderTopRightRadius: "0",
644
791
  borderBottomRightRadius: "0"
645
792
  }
646
- }, dt = ({ setOpen: t, position: e }) => /* @__PURE__ */ c(
793
+ }, mt = ({ setOpen: t, position: e }) => /* @__PURE__ */ f(
647
794
  "button",
648
795
  {
649
796
  "aria-label": "Open TWD sidebar",
@@ -651,24 +798,24 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
651
798
  position: "fixed",
652
799
  top: "50%",
653
800
  transform: "translateY(-50%)",
654
- background: "#1A6EF4",
655
- color: "white",
656
- padding: "6px 10px",
801
+ background: "var(--twd-button-primary)",
802
+ color: "var(--twd-button-primary-text)",
803
+ padding: "var(--twd-spacing-sm) 10px",
657
804
  cursor: "pointer",
658
- fontSize: "12px",
659
- ...ut[e]
805
+ fontSize: "var(--twd-font-size-sm)",
806
+ ...gt[e]
660
807
  },
661
808
  onClick: () => t(!0),
662
809
  children: "TWD"
663
810
  }
664
- ), ft = ({ isOpen: t, position: e }) => {
665
- Je(() => {
666
- const n = document.documentElement;
667
- return t ? e === "left" ? n.style.marginLeft = "280px" : n.style.marginRight = "280px" : (n.style.marginRight = "0", n.style.marginLeft = "0"), () => {
811
+ ), vt = ({ isOpen: t, position: e }) => {
812
+ le(() => {
813
+ const n = document.documentElement, r = getComputedStyle(document.documentElement).getPropertyValue("--twd-sidebar-width") || "280px";
814
+ return t ? e === "left" ? n.style.marginLeft = r : n.style.marginRight = r : (n.style.marginRight = "0", n.style.marginLeft = "0"), () => {
668
815
  n.style.marginRight = "0", n.style.marginLeft = "0";
669
816
  };
670
817
  }, [t, e]);
671
- }, pt = () => typeof window < "u" ? (window.__TWD_STATE__ || (window.__TWD_STATE__ = {
818
+ }, yt = () => typeof window < "u" ? (window.__TWD_STATE__ || (window.__TWD_STATE__ = {
672
819
  handlers: /* @__PURE__ */ new Map(),
673
820
  beforeEachHooks: /* @__PURE__ */ new Map(),
674
821
  afterEachHooks: /* @__PURE__ */ new Map(),
@@ -678,109 +825,109 @@ const V = ({ className: t, children: e, dataTestId: n }) => /* @__PURE__ */ c(
678
825
  beforeEachHooks: /* @__PURE__ */ new Map(),
679
826
  afterEachHooks: /* @__PURE__ */ new Map(),
680
827
  stack: []
681
- }, se = pt(), w = se.handlers, be = se.beforeEachHooks, ke = se.afterEachHooks, ht = (t) => {
828
+ }, _e = yt(), S = _e.handlers, Se = _e.beforeEachHooks, xe = _e.afterEachHooks, wt = (t) => {
682
829
  const e = [], n = [];
683
830
  let r = t;
684
831
  for (; r; )
685
- be.has(r) && e.unshift(...be.get(r)), ke.has(r) && n.push(...ke.get(r)), r = w.get(r)?.parent;
832
+ Se.has(r) && e.unshift(...Se.get(r)), xe.has(r) && n.push(...xe.get(r)), r = S.get(r)?.parent;
686
833
  return { before: e, after: n };
687
- }, te = (t) => {
688
- const e = w.get(t);
689
- return e ? e.only ? !0 : e.children ? e.children.some((n) => te(n)) : !1 : !1;
690
- }, gt = (t) => {
691
- let e = w.get(t);
834
+ }, ne = (t) => {
835
+ const e = S.get(t);
836
+ return e ? e.only ? !0 : e.children ? e.children.some((n) => ne(n)) : !1 : !1;
837
+ }, bt = (t) => {
838
+ let e = S.get(t);
692
839
  for (; e?.parent; ) {
693
- const n = w.get(e.parent);
840
+ const n = S.get(e.parent);
694
841
  if (n?.only) return !0;
695
842
  e = n;
696
843
  }
697
844
  return !1;
698
- }, we = (t) => {
699
- let e = w.get(t);
845
+ }, Te = (t) => {
846
+ let e = S.get(t);
700
847
  for (; e; ) {
701
848
  if (e.skip) return !0;
702
849
  if (!e.parent) break;
703
- e = w.get(e.parent);
850
+ e = S.get(e.parent);
704
851
  }
705
852
  return !1;
706
853
  };
707
- class Pe {
854
+ class Ue {
708
855
  events;
709
856
  constructor(e) {
710
857
  this.events = e;
711
858
  }
712
859
  async runAll() {
713
- const e = Array.from(w.values()).filter(
860
+ const e = Array.from(S.values()).filter(
714
861
  (r) => !r.parent && r.type === "suite"
715
- ), n = Array.from(w.values()).some((r) => r.only);
862
+ ), n = Array.from(S.values()).some((r) => r.only);
716
863
  for (const r of e)
717
864
  await this.runSuite(r, n);
718
- return w;
865
+ return S;
719
866
  }
720
867
  async runSingle(e) {
721
- const n = w.get(e);
868
+ const n = S.get(e);
722
869
  if (!n || n.type !== "test") return;
723
870
  await this.runTest(n, !1);
724
871
  }
725
872
  async runSuite(e, n) {
726
- if (we(e.id) && !te(e.id)) {
873
+ if (Te(e.id) && !ne(e.id)) {
727
874
  this.events.onSkip?.(e);
728
875
  return;
729
876
  }
730
- if (n && !te(e.id)) return;
877
+ if (n && !ne(e.id)) return;
731
878
  this.events.onSuiteStart?.(e);
732
- const s = (e.children || []).map((i) => w.get(i));
733
- for (const i of s)
734
- i.type === "suite" ? await this.runSuite(i, n) : i.type === "test" && await this.runTest(i, n);
879
+ const i = (e.children || []).map((o) => S.get(o));
880
+ for (const o of i)
881
+ o.type === "suite" ? await this.runSuite(o, n) : o.type === "test" && await this.runTest(o, n);
735
882
  this.events.onSuiteEnd?.(e);
736
883
  }
737
884
  async runTest(e, n) {
738
- if ((we(e.id) || e.skip) && !e.only) {
885
+ if ((Te(e.id) || e.skip) && !e.only) {
739
886
  this.events.onSkip(e);
740
887
  return;
741
888
  }
742
- const s = gt(e.id);
743
- if (n && !e.only && !s) {
889
+ const i = bt(e.id);
890
+ if (n && !e.only && !i) {
744
891
  this.events.onSkip(e);
745
892
  return;
746
893
  }
747
894
  this.events.onStart?.(e);
748
- const i = ht(e.parent);
895
+ const o = wt(e.parent);
749
896
  try {
750
- for (const _ of i.before) await _();
897
+ for (const l of o.before) await l();
751
898
  e.logs = [], await e.handler(), this.events.onPass(e);
752
- } catch (_) {
753
- this.events.onFail(e, _);
899
+ } catch (l) {
900
+ this.events.onFail(e, l);
754
901
  } finally {
755
- for (const _ of i.after) await _();
902
+ for (const l of o.after) await l();
756
903
  }
757
904
  }
758
905
  }
759
- window.__testRunner = Pe;
760
- const mt = "1.3.3", yt = () => typeof window < "u" ? (window.__TWD_MOCK_STATE__ || (window.__TWD_MOCK_STATE__ = {
906
+ window.__testRunner = Ue;
907
+ const kt = "1.4.0", St = () => typeof window < "u" ? (window.__TWD_MOCK_STATE__ || (window.__TWD_MOCK_STATE__ = {
761
908
  rules: []
762
909
  }), window.__TWD_MOCK_STATE__) : {
763
910
  rules: []
764
- }, vt = yt(), Be = vt.rules, bt = async (t) => {
911
+ }, xt = St(), Fe = xt.rules, Tt = async (t) => {
765
912
  if ("serviceWorker" in navigator) {
766
913
  const e = t ?? "/mock-sw.js";
767
- await navigator.serviceWorker.register(`${e}?v=${mt}`), navigator.serviceWorker.controller || await new Promise((n) => {
914
+ await navigator.serviceWorker.register(`${e}?v=${kt}`), navigator.serviceWorker.controller || await new Promise((n) => {
768
915
  navigator.serviceWorker.addEventListener("controllerchange", n, { once: !0 });
769
916
  }), navigator.serviceWorker.addEventListener("message", (n) => {
770
917
  if (n.data?.type === "EXECUTED") {
771
- const { alias: r, request: s } = n.data, i = Be.find((_) => _.alias === r);
772
- i && (i.executed = !0, i.request = s);
918
+ const { alias: r, request: i } = n.data, o = Fe.find((l) => l.alias === r);
919
+ o && (o.executed = !0, o.request = i);
773
920
  }
774
921
  });
775
922
  }
776
- }, kt = () => Be, wt = () => /* @__PURE__ */ c(V, { className: "lucide-wifi-pen-icon lucide-wifi-pen", dataTestId: "wifi-pen-icon", children: [
777
- /* @__PURE__ */ c("path", { d: "M2 8.82a15 15 0 0 1 20 0" }),
778
- /* @__PURE__ */ c("path", { d: "M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z" }),
779
- /* @__PURE__ */ c("path", { d: "M5 12.859a10 10 0 0 1 10.5-2.222" }),
780
- /* @__PURE__ */ c("path", { d: "M8.5 16.429a5 5 0 0 1 3-1.406" })
781
- ] }), xt = () => {
782
- const t = kt(), e = t.filter((r) => r.executed);
783
- return /* @__PURE__ */ c(
923
+ }, Rt = () => Fe, Ct = () => /* @__PURE__ */ f(K, { className: "lucide-wifi-pen-icon lucide-wifi-pen", dataTestId: "wifi-pen-icon", children: [
924
+ /* @__PURE__ */ f("path", { d: "M2 8.82a15 15 0 0 1 20 0" }),
925
+ /* @__PURE__ */ f("path", { d: "M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z" }),
926
+ /* @__PURE__ */ f("path", { d: "M5 12.859a10 10 0 0 1 10.5-2.222" }),
927
+ /* @__PURE__ */ f("path", { d: "M8.5 16.429a5 5 0 0 1 3-1.406" })
928
+ ] }), $t = () => {
929
+ const t = Rt(), e = t.filter((r) => r.executed);
930
+ return /* @__PURE__ */ f(
784
931
  "button",
785
932
  {
786
933
  onClick: () => {
@@ -788,104 +935,120 @@ const mt = "1.3.3", yt = () => typeof window < "u" ? (window.__TWD_MOCK_STATE__
788
935
  },
789
936
  "aria-label": "View mock rules details in console",
790
937
  style: {
791
- background: "#f8fafc",
792
- border: "1px solid #cbd5e1",
793
- borderRadius: "6px",
794
- padding: "8px 12px",
938
+ background: "var(--twd-button-secondary)",
939
+ border: "1px solid var(--twd-button-border)",
940
+ borderRadius: "var(--twd-border-radius-lg)",
941
+ padding: "var(--twd-spacing-md) var(--twd-spacing-lg)",
795
942
  cursor: "pointer",
796
- fontSize: "12px",
797
- color: "#475569",
943
+ fontSize: "var(--twd-font-size-sm)",
944
+ color: "var(--twd-button-secondary-text)",
798
945
  display: "flex",
799
946
  alignItems: "center",
800
- gap: "8px",
947
+ gap: "var(--twd-spacing-md)",
801
948
  marginBottom: "10px",
802
949
  width: "100%",
803
950
  textAlign: "left",
804
- transition: "all 0.2s ease",
805
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)"
951
+ transition: "all var(--twd-animation-duration) ease",
952
+ boxShadow: "var(--twd-shadow-sm)"
806
953
  },
807
954
  children: [
808
- /* @__PURE__ */ c(wt, {}),
809
- /* @__PURE__ */ c("span", { style: { flex: 1 }, children: [
955
+ /* @__PURE__ */ f(Ct, {}),
956
+ /* @__PURE__ */ f("span", { style: { flex: 1 }, children: [
810
957
  "Rules: ",
811
958
  e.length,
812
959
  "/",
813
960
  t.length,
814
961
  " triggered"
815
962
  ] }),
816
- /* @__PURE__ */ c("span", { style: {
817
- fontSize: "10px",
818
- color: "#1E293B",
819
- fontWeight: "500"
963
+ /* @__PURE__ */ f("span", { style: {
964
+ fontSize: "var(--twd-font-size-xs)",
965
+ color: "var(--twd-text)",
966
+ fontWeight: "var(--twd-font-weight-medium)"
820
967
  }, children: "View rules in console" })
821
968
  ]
822
969
  }
823
970
  );
824
- }, St = {
825
- left: { left: 0, borderRight: "1px solid #e5e7eb" },
826
- right: { right: 0, borderLeft: "1px solid #e5e7eb" }
827
- }, Tt = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', Et = ({ open: t, position: e = "left" }) => {
828
- const [n, r] = Z(0), [s, i] = Z(t);
829
- ft({ isOpen: s, position: e });
830
- const _ = new Pe({
831
- onStart: (o) => {
832
- o.status = "running", r((f) => f + 1);
971
+ }, Et = {
972
+ left: { left: 0, borderRight: "1px solid var(--twd-border)" },
973
+ right: { right: 0, borderLeft: "1px solid var(--twd-border)" }
974
+ }, It = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', Wt = (t) => sessionStorage.getItem("twd-sidebar-open") ? sessionStorage.getItem("twd-sidebar-open") === "true" : t, Lt = ({ open: t, position: e = "left" }) => {
975
+ const [n, r] = ee(0), [i, o] = ee(Wt(t));
976
+ vt({ isOpen: i, position: e });
977
+ const l = new Ue({
978
+ onStart: (c) => {
979
+ c.status = "running", r((u) => u + 1);
833
980
  },
834
- onPass: (o) => {
835
- o.status = "pass", r((f) => f + 1);
981
+ onPass: (c) => {
982
+ c.status = "pass", r((u) => u + 1);
836
983
  },
837
- onFail: (o, f) => {
838
- o.status = "fail", console.error("Test failed:", o.name, f), o.logs.push(`Test failed: ${f.message}`), r((d) => d + 1);
984
+ onFail: (c, u) => {
985
+ c.status = "fail", console.error("Test failed:", c.name, u), c.logs.push(`Test failed: ${u.message}`), r((g) => g + 1);
839
986
  },
840
- onSkip: (o) => {
841
- o.status = "skip", r((f) => f + 1);
987
+ onSkip: (c) => {
988
+ c.status = "skip", r((u) => u + 1);
842
989
  }
843
- }), l = async () => {
844
- await _.runAll();
845
- }, u = async (o) => {
846
- const f = Array.from(w.values()).filter((d) => d.type === "test").find((d) => d.id === o);
847
- f && await _.runSingle(f.id);
848
- }, a = Array.from(w.values());
849
- if (!s)
850
- return /* @__PURE__ */ c(dt, { position: e, setOpen: i });
851
- const p = a.filter((o) => o.type === "test").length;
852
- return /* @__PURE__ */ c(
990
+ }), _ = (c) => {
991
+ o(c), sessionStorage.setItem("twd-sidebar-open", c.toString());
992
+ }, p = async () => {
993
+ sessionStorage.removeItem("twd-last-run-test-name"), await l.runAll();
994
+ }, a = async (c) => {
995
+ const u = Array.from(S.values()).filter((g) => g.type === "test").find((g) => g.id === c);
996
+ u && (sessionStorage.setItem("twd-last-run-test-name", u.name), await l.runSingle(u.id));
997
+ }, d = Array.from(S.values());
998
+ if (!i)
999
+ return /* @__PURE__ */ f(mt, { position: e, setOpen: _ });
1000
+ const s = d.filter((c) => c.type === "test").length;
1001
+ return /* @__PURE__ */ f(
853
1002
  "div",
854
1003
  {
855
1004
  style: {
856
- fontFamily: Tt,
1005
+ fontFamily: It,
857
1006
  position: "fixed",
858
1007
  top: 0,
859
1008
  bottom: 0,
860
- width: "280px",
861
- background: "#f9fafb",
862
- fontSize: "14px",
1009
+ width: "var(--twd-sidebar-width)",
1010
+ background: "var(--twd-background)",
1011
+ fontSize: "var(--twd-font-size-md)",
863
1012
  overflowY: "auto",
864
- boxShadow: "2px 0 6px rgba(0,0,0,0.1)",
1013
+ boxShadow: "var(--twd-shadow)",
865
1014
  textAlign: "left",
866
- zIndex: 1e3,
867
- ...St[e]
1015
+ zIndex: "var(--twd-z-index-sidebar)",
1016
+ ...Et[e]
868
1017
  },
869
1018
  "data-testid": "twd-sidebar",
1019
+ role: "complementary",
1020
+ "aria-label": "Test While Developing sidebar",
870
1021
  children: [
871
- /* @__PURE__ */ c("div", { style: { padding: "8px", background: "#f9fafb", position: "sticky", top: 0, zIndex: 1e3, borderBottom: "1px solid #e5e7eb" }, children: [
872
- /* @__PURE__ */ c("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "14px" }, children: [
873
- /* @__PURE__ */ c(
1022
+ /* @__PURE__ */ f("div", { style: {
1023
+ padding: "var(--twd-spacing-md)",
1024
+ background: "var(--twd-background)",
1025
+ position: "sticky",
1026
+ top: 0,
1027
+ zIndex: "var(--twd-z-index-sticky)",
1028
+ borderBottom: "1px solid var(--twd-border)"
1029
+ }, children: [
1030
+ /* @__PURE__ */ f("div", { style: {
1031
+ display: "flex",
1032
+ justifyContent: "space-between",
1033
+ alignItems: "center",
1034
+ marginBottom: "var(--twd-spacing-xl)"
1035
+ }, children: [
1036
+ /* @__PURE__ */ f(
874
1037
  "button",
875
1038
  {
876
- onClick: l,
1039
+ onClick: p,
877
1040
  style: {
878
- background: "#1A6EF4",
879
- color: "white",
880
- padding: "4px 8px",
881
- borderRadius: "4px",
1041
+ background: "var(--twd-button-primary)",
1042
+ color: "var(--twd-button-primary-text)",
1043
+ padding: "var(--twd-spacing-xs) var(--twd-spacing-md)",
1044
+ borderRadius: "var(--twd-border-radius)",
882
1045
  border: "none",
883
1046
  cursor: "pointer"
884
1047
  },
885
1048
  children: "Run All"
886
1049
  }
887
1050
  ),
888
- /* @__PURE__ */ c(
1051
+ /* @__PURE__ */ f(
889
1052
  "button",
890
1053
  {
891
1054
  "aria-label": "Close sidebar",
@@ -893,65 +1056,72 @@ const mt = "1.3.3", yt = () => typeof window < "u" ? (window.__TWD_MOCK_STATE__
893
1056
  background: "transparent",
894
1057
  border: "none",
895
1058
  cursor: "pointer",
896
- fontSize: "14px",
1059
+ fontSize: "var(--twd-font-size-md)",
897
1060
  paddingRight: "0",
898
1061
  paddingLeft: "0"
899
1062
  },
900
- onClick: () => i(!1),
1063
+ onClick: () => _(!1),
901
1064
  children: "✖"
902
1065
  }
903
1066
  )
904
1067
  ] }),
905
- /* @__PURE__ */ c("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: "14px", color: "#6b7280", marginBottom: "10px" }, children: [
906
- /* @__PURE__ */ c("span", { style: { color: "#374151" }, children: [
1068
+ /* @__PURE__ */ f("div", { style: {
1069
+ display: "flex",
1070
+ justifyContent: "space-between",
1071
+ alignItems: "center",
1072
+ fontSize: "var(--twd-font-size-md)",
1073
+ color: "var(--twd-text-secondary)",
1074
+ marginBottom: "10px"
1075
+ }, children: [
1076
+ /* @__PURE__ */ f("span", { style: { color: "var(--twd-text)" }, children: [
907
1077
  "Total: ",
908
- p
1078
+ s
909
1079
  ] }),
910
- /* @__PURE__ */ c("div", { style: { display: "flex", gap: "4px" }, children: [
911
- /* @__PURE__ */ c("span", { style: { color: "#00c951" }, children: [
1080
+ /* @__PURE__ */ f("div", { style: { display: "flex", gap: "var(--twd-spacing-xs)" }, children: [
1081
+ /* @__PURE__ */ f("span", { style: { color: "var(--twd-success)" }, children: [
912
1082
  "✓ ",
913
- a.filter((o) => o.status === "pass").length
1083
+ d.filter((c) => c.status === "pass").length
914
1084
  ] }),
915
- /* @__PURE__ */ c("span", { style: { color: "#fb2c36" }, children: [
1085
+ /* @__PURE__ */ f("span", { style: { color: "var(--twd-error)" }, children: [
916
1086
  "✗ ",
917
- a.filter((o) => o.status === "fail").length
1087
+ d.filter((c) => c.status === "fail").length
918
1088
  ] })
919
1089
  ] })
920
1090
  ] }),
921
- /* @__PURE__ */ c(xt, {})
1091
+ /* @__PURE__ */ f($t, {})
922
1092
  ] }),
923
- /* @__PURE__ */ c("div", { style: { padding: "8px" }, children: /* @__PURE__ */ c(
924
- ct,
1093
+ /* @__PURE__ */ f("div", { style: { padding: "var(--twd-spacing-md)" }, children: /* @__PURE__ */ f(
1094
+ ht,
925
1095
  {
926
- tests: a.map((o) => ({
927
- name: o.name,
928
- depth: o.depth,
929
- status: o.status,
930
- logs: o.logs,
931
- id: o.id,
932
- parent: o.parent,
933
- type: o.type,
934
- only: o.only,
935
- skip: o.skip
1096
+ tests: d.map((c) => ({
1097
+ name: c.name,
1098
+ depth: c.depth,
1099
+ status: c.status,
1100
+ logs: c.logs,
1101
+ id: c.id,
1102
+ parent: c.parent,
1103
+ type: c.type,
1104
+ only: c.only,
1105
+ skip: c.skip
936
1106
  })),
937
- runTest: u
1107
+ runTest: a
938
1108
  }
939
1109
  ) })
940
1110
  ]
941
1111
  }
942
1112
  );
943
- }, Rt = (t) => ({
1113
+ }, Ht = (t) => ({
944
1114
  render: (e) => {
945
- Ve(e, t);
1115
+ Ye(e, t);
946
1116
  }
947
- }), Ct = (t, e) => {
948
- const { open: n = !0, position: r = "left", serviceWorker: s = !0, serviceWorkerUrl: i = "/mock-sw.js" } = e || {};
949
- Ge(t, /* @__PURE__ */ c(Et, { open: n, position: r }), Rt), s && bt(i).then(() => {
1117
+ }), At = (t, e) => {
1118
+ const { open: n = !0, position: r = "left", serviceWorker: i = !0, serviceWorkerUrl: o = "/mock-sw.js", theme: l } = e || {};
1119
+ tt(t, /* @__PURE__ */ f(Lt, { open: n, position: r }), Ht, l), i && Tt(o).then(() => {
950
1120
  console.log("Request mocking initialized");
951
1121
  }).catch((_) => {
952
1122
  console.error("Error initializing request mocking:", _);
953
1123
  });
954
1124
  };
955
1125
  export {
956
- Ct as initTWD
1126
+ At as initTWD
957
1127
  };