@manyducks.co/dolla 2.0.0-alpha.31 → 2.0.0-alpha.32

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,16 +1,16 @@
1
- var jt = Object.defineProperty;
2
- var ut = (r) => {
3
- throw TypeError(r);
1
+ var It = Object.defineProperty;
2
+ var it = (s) => {
3
+ throw TypeError(s);
4
4
  };
5
- var Rt = (r, t, e) => t in r ? jt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
6
- var o = (r, t, e) => Rt(r, typeof t != "symbol" ? t + "" : t, e), ct = (r, t, e) => t.has(r) || ut("Cannot " + e);
7
- var O = (r, t, e) => (ct(r, t, "read from private field"), e ? e.call(r) : t.get(r)), W = (r, t, e) => t.has(r) ? ut("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), T = (r, t, e, n) => (ct(r, t, "write to private field"), n ? n.call(r, e) : t.set(r, e), e);
8
- function kt(r) {
9
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
5
+ var jt = (s, t, e) => t in s ? It(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
6
+ var o = (s, t, e) => jt(s, typeof t != "symbol" ? t + "" : t, e), ot = (s, t, e) => t.has(s) || it("Cannot " + e);
7
+ var O = (s, t, e) => (ot(s, t, "read from private field"), e ? e.call(s) : t.get(s)), P = (s, t, e) => t.has(s) ? it("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), T = (s, t, e, n) => (ot(s, t, "write to private field"), n ? n.call(s, e) : t.set(s, e), e);
8
+ function Mt(s) {
9
+ return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
10
10
  }
11
- var P = { exports: {} }, at;
11
+ var q = { exports: {} }, ut;
12
12
  function Ut() {
13
- return at || (at = 1, function(r, t) {
13
+ return ut || (ut = 1, function(s, t) {
14
14
  Object.defineProperty(t, "__esModule", { value: !0 });
15
15
  var e = /* @__PURE__ */ function() {
16
16
  function h(a, f) {
@@ -37,15 +37,15 @@ function Ut() {
37
37
  return h.reduce(function(a, f) {
38
38
  return 16 > f ? a + "0" + f.toString(16) : a + f.toString(16);
39
39
  }, "#");
40
- }, s = function(h, a, f) {
41
- var l = 0.5 > f ? f * (1 + a) : f + a - f * a, d = 2 * f - l, p = function(w, v, S) {
42
- var z = Math.round, g = 0 > S ? S + 1 : 1 < S ? S - 1 : S;
43
- return g = g < 1 / 6 ? w + 6 * (v - w) * g : g < 1 / 2 ? v : g < 2 / 3 ? w + 6 * (v - w) * (2 / 3 - g) : w, z(255 * g);
40
+ }, r = function(h, a, f) {
41
+ var l = 0.5 > f ? f * (1 + a) : f + a - f * a, d = 2 * f - l, p = function(w, C, v) {
42
+ var z = Math.round, g = 0 > v ? v + 1 : 1 < v ? v - 1 : v;
43
+ return g = g < 1 / 6 ? w + 6 * (C - w) * g : g < 1 / 2 ? C : g < 2 / 3 ? w + 6 * (C - w) * (2 / 3 - g) : w, z(255 * g);
44
44
  }, _ = p(d, l, h + 1 / 3), x = p(d, l, h), y = p(d, l, h - 1 / 3);
45
45
  return [_, x, y];
46
46
  }, i = function(h, a, f, l) {
47
- var d = h % 1007 / 1007, p = function(w, v, S) {
48
- return w * (S - v) + v;
47
+ var d = h % 1007 / 1007, p = function(w, C, v) {
48
+ return w * (v - C) + C;
49
49
  }, _ = p(d, a.min, a.max), x = p(d, f.min, f.max), y = p(d, l.max, l.min);
50
50
  return [_, x, y];
51
51
  }, u = function(h) {
@@ -53,229 +53,229 @@ function Ut() {
53
53
  return a * f.charCodeAt(0) * l + 1;
54
54
  }, 1);
55
55
  }, c = function(h) {
56
- var a = h.str, f = h.hue, l = f === void 0 ? { min: 0, max: 360 } : f, d = h.sat, p = d === void 0 ? { min: 0.35, max: 0.65 } : d, _ = h.light, x = _ === void 0 ? { min: 0.3, max: 0.7 } : _, y = h.hashFunction, w = y === void 0 ? u : y, v = h.scheme, S = v === void 0 ? "hex" : v, z = i(w(a), l, p, x), g = e(z, 3), rt = g[0], st = g[1], it = g[2], ot = s(rt / 360, st, it), qt = n(ot);
57
- return S === "hsl" ? [rt, st, it] : S === "rgb" ? ot : qt;
56
+ var a = h.str, f = h.hue, l = f === void 0 ? { min: 0, max: 360 } : f, d = h.sat, p = d === void 0 ? { min: 0.35, max: 0.65 } : d, _ = h.light, x = _ === void 0 ? { min: 0.3, max: 0.7 } : _, y = h.hashFunction, w = y === void 0 ? u : y, C = h.scheme, v = C === void 0 ? "hex" : C, z = i(w(a), l, p, x), g = e(z, 3), et = g[0], nt = g[1], st = g[2], rt = r(et / 360, nt, st), Ft = n(rt);
57
+ return v === "hsl" ? [et, nt, st] : v === "rgb" ? rt : Ft;
58
58
  };
59
- t.default = c, r.exports = t.default;
60
- }(P, P.exports)), P.exports;
59
+ t.default = c, s.exports = t.default;
60
+ }(q, q.exports)), q.exports;
61
61
  }
62
- var Dt = Ut();
63
- const zt = /* @__PURE__ */ kt(Dt);
64
- function V(r) {
65
- const t = typeof r;
62
+ var Rt = Ut();
63
+ const Dt = /* @__PURE__ */ Mt(Rt);
64
+ function $(s) {
65
+ const t = typeof s;
66
66
  switch (t) {
67
67
  case "undefined":
68
68
  return t;
69
69
  case "number":
70
- return isNaN(r) ? "NaN" : t;
70
+ return isNaN(s) ? "NaN" : t;
71
71
  case "function":
72
- return /^\s*class\s+/.test(r.toString()) ? "class" : t;
72
+ return /^\s*class\s+/.test(s.toString()) ? "class" : t;
73
73
  case "object":
74
- return r === null ? "null" : r instanceof Promise ? "promise" : r instanceof Map ? "map" : r instanceof Set ? "set" : Array.isArray(r) ? "array" : t;
74
+ return s === null ? "null" : s instanceof Promise ? "promise" : s instanceof Map ? "map" : s instanceof Set ? "set" : Array.isArray(s) ? "array" : t;
75
75
  default:
76
76
  return t;
77
77
  }
78
78
  }
79
- function A(r) {
80
- return Array.isArray(r);
79
+ function A(s) {
80
+ return Array.isArray(s);
81
81
  }
82
- function bt(...r) {
83
- const t = r[0], e = (n) => A(n) && n.every((s) => t(s));
84
- return r.length < 2 ? e : e(r[1]);
82
+ function bt(...s) {
83
+ const t = s[0], e = (n) => A(n) && n.every((r) => t(r));
84
+ return s.length < 2 ? e : e(s[1]);
85
85
  }
86
- function xe(...r) {
87
- const t = r[0], e = b(r[2]) ? r[2] : "Expected an array of valid items. Got type: %t, value: %v", n = (s) => {
88
- if (A(s) && s.every((i) => t(i)))
86
+ function ye(...s) {
87
+ const t = s[0], e = k(s[2]) ? s[2] : "Expected an array of valid items. Got type: %t, value: %v", n = (r) => {
88
+ if (A(r) && r.every((i) => t(i)))
89
89
  return !0;
90
- throw new TypeError(U(s, e));
90
+ throw new TypeError(R(r, e));
91
91
  };
92
- return r.length < 2 ? n : n(r[1]);
92
+ return s.length < 2 ? n : n(s[1]);
93
93
  }
94
- function b(r) {
95
- return typeof r == "string";
94
+ function k(s) {
95
+ return typeof s == "string";
96
96
  }
97
- function Me(r, t) {
98
- if (b(r))
97
+ function ve(s, t) {
98
+ if (k(s))
99
99
  return !0;
100
- throw new TypeError(U(r, t ?? "Expected a string. Got type: %t, value: %v"));
100
+ throw new TypeError(R(s, t ?? "Expected a string. Got type: %t, value: %v"));
101
101
  }
102
- function I(r) {
103
- return typeof r == "function" && !Kt(r);
102
+ function V(s) {
103
+ return typeof s == "function" && !Gt(s);
104
104
  }
105
- function Gt(r) {
106
- return typeof r == "number" && !isNaN(r);
105
+ function zt(s) {
106
+ return typeof s == "number" && !isNaN(s);
107
107
  }
108
- function Kt(r) {
109
- return typeof r == "function" && /^\s*class\s+/.test(r.toString());
108
+ function Gt(s) {
109
+ return typeof s == "function" && /^\s*class\s+/.test(s.toString());
110
110
  }
111
- function ke(...r) {
112
- const t = r[0], e = b(r[2]) ? r[2] : `Expected instance of ${t.name}. Got type: %t, value: %v`, n = (s) => {
113
- if (s instanceof t)
111
+ function Se(...s) {
112
+ const t = s[0], e = k(s[2]) ? s[2] : `Expected instance of ${t.name}. Got type: %t, value: %v`, n = (r) => {
113
+ if (r instanceof t)
114
114
  return !0;
115
- throw new TypeError(U(s, e));
115
+ throw new TypeError(R(r, e));
116
116
  };
117
- return r.length < 2 ? n : n(r[1]);
117
+ return s.length < 2 ? n : n(s[1]);
118
118
  }
119
- function Z(r) {
120
- return r != null && typeof r == "object" && !A(r);
119
+ function Z(s) {
120
+ return s != null && typeof s == "object" && !A(s);
121
121
  }
122
- function be(r, t) {
123
- if (Z(r))
122
+ function Ce(s, t) {
123
+ if (Z(s))
124
124
  return !0;
125
- throw new TypeError(U(r, t));
125
+ throw new TypeError(R(s, t));
126
126
  }
127
- function U(r, t) {
128
- var s;
129
- const e = V(r), n = ((s = r == null ? void 0 : r.toString) == null ? void 0 : s.call(r)) || String(r);
127
+ function R(s, t) {
128
+ var r;
129
+ const e = $(s), n = ((r = s == null ? void 0 : s.toString) == null ? void 0 : r.call(s)) || String(s);
130
130
  return t.replaceAll("%t", e).replaceAll("%v", n);
131
131
  }
132
- var G, ht;
133
- function Bt() {
134
- return ht || (ht = 1, G = function r(t, e) {
132
+ var G, ct;
133
+ function Kt() {
134
+ return ct || (ct = 1, G = function s(t, e) {
135
135
  if (t === e) return !0;
136
136
  if (t && e && typeof t == "object" && typeof e == "object") {
137
137
  if (t.constructor !== e.constructor) return !1;
138
- var n, s, i;
138
+ var n, r, i;
139
139
  if (Array.isArray(t)) {
140
140
  if (n = t.length, n != e.length) return !1;
141
- for (s = n; s-- !== 0; )
142
- if (!r(t[s], e[s])) return !1;
141
+ for (r = n; r-- !== 0; )
142
+ if (!s(t[r], e[r])) return !1;
143
143
  return !0;
144
144
  }
145
145
  if (t instanceof Map && e instanceof Map) {
146
146
  if (t.size !== e.size) return !1;
147
- for (s of t.entries())
148
- if (!e.has(s[0])) return !1;
149
- for (s of t.entries())
150
- if (!r(s[1], e.get(s[0]))) return !1;
147
+ for (r of t.entries())
148
+ if (!e.has(r[0])) return !1;
149
+ for (r of t.entries())
150
+ if (!s(r[1], e.get(r[0]))) return !1;
151
151
  return !0;
152
152
  }
153
153
  if (t instanceof Set && e instanceof Set) {
154
154
  if (t.size !== e.size) return !1;
155
- for (s of t.entries())
156
- if (!e.has(s[0])) return !1;
155
+ for (r of t.entries())
156
+ if (!e.has(r[0])) return !1;
157
157
  return !0;
158
158
  }
159
159
  if (ArrayBuffer.isView(t) && ArrayBuffer.isView(e)) {
160
160
  if (n = t.length, n != e.length) return !1;
161
- for (s = n; s-- !== 0; )
162
- if (t[s] !== e[s]) return !1;
161
+ for (r = n; r-- !== 0; )
162
+ if (t[r] !== e[r]) return !1;
163
163
  return !0;
164
164
  }
165
165
  if (t.constructor === RegExp) return t.source === e.source && t.flags === e.flags;
166
166
  if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === e.valueOf();
167
167
  if (t.toString !== Object.prototype.toString) return t.toString() === e.toString();
168
168
  if (i = Object.keys(t), n = i.length, n !== Object.keys(e).length) return !1;
169
- for (s = n; s-- !== 0; )
170
- if (!Object.prototype.hasOwnProperty.call(e, i[s])) return !1;
171
- for (s = n; s-- !== 0; ) {
172
- var u = i[s];
173
- if (!r(t[u], e[u])) return !1;
169
+ for (r = n; r-- !== 0; )
170
+ if (!Object.prototype.hasOwnProperty.call(e, i[r])) return !1;
171
+ for (r = n; r-- !== 0; ) {
172
+ var u = i[r];
173
+ if (!s(t[u], e[u])) return !1;
174
174
  }
175
175
  return !0;
176
176
  }
177
177
  return t !== t && e !== e;
178
178
  }), G;
179
179
  }
180
- var Ht = Bt();
181
- const Yt = /* @__PURE__ */ kt(Ht), Zt = () => {
180
+ var Bt = Kt();
181
+ const Ht = /* @__PURE__ */ Mt(Bt), Zt = () => {
182
182
  };
183
183
  let K = 1;
184
- function J() {
184
+ function kt() {
185
185
  return K = K % Number.MAX_SAFE_INTEGER + 1, K.toString(36) + Date.now().toString(36);
186
186
  }
187
- function Et(r, t) {
188
- return Object.is(r, t);
187
+ function Et(s, t) {
188
+ return Object.is(s, t);
189
189
  }
190
- function Ee(r, t) {
191
- if (Object.is(r, t)) return !0;
192
- const e = V(r);
193
- if (e !== V(t))
190
+ function xe(s, t) {
191
+ if (Object.is(s, t)) return !0;
192
+ const e = $(s);
193
+ if (e !== $(t))
194
194
  return !1;
195
195
  switch (e) {
196
196
  case "object":
197
197
  let n = 0;
198
- for (const s in r) {
199
- if (r[s] !== t[s]) return !1;
198
+ for (const r in s) {
199
+ if (s[r] !== t[r]) return !1;
200
200
  n++;
201
201
  }
202
202
  return Object.keys(t).length === n;
203
203
  case "array":
204
- if (r.length !== t.length) return !1;
205
- for (let s = 0; s < r.length; s++)
206
- if (r[s] !== t[s]) return !1;
204
+ if (s.length !== t.length) return !1;
205
+ for (let r = 0; r < s.length; r++)
206
+ if (s[r] !== t[r]) return !1;
207
207
  return !0;
208
208
  case "map":
209
- if (r.size !== t.size) return !1;
210
- for (const s of r.keys())
211
- if (r[s] !== t[s]) return !1;
209
+ if (s.size !== t.size) return !1;
210
+ for (const r of s.keys())
211
+ if (s[r] !== t[r]) return !1;
212
212
  return !0;
213
213
  case "set":
214
- if (I(r.symmetricDifference))
215
- return r.symmetricDifference(t).size === 0;
216
- for (const s of r.keys())
217
- if (r[s] !== t.get(s)) return !1;
214
+ if (V(s.symmetricDifference))
215
+ return s.symmetricDifference(t).size === 0;
216
+ for (const r of s.keys())
217
+ if (s[r] !== t.get(r)) return !1;
218
218
  return !0;
219
219
  }
220
220
  return !1;
221
221
  }
222
- const Ae = Yt;
223
- function Jt(r, t) {
222
+ const Me = Ht;
223
+ function Yt(s, t) {
224
224
  const e = (n) => {
225
- const s = {};
225
+ const r = {};
226
226
  for (const i in n)
227
- r.includes(i) || (s[i] = n[i]);
228
- return s;
227
+ s.includes(i) || (r[i] = n[i]);
228
+ return r;
229
229
  };
230
230
  return t == null ? e : e(t);
231
231
  }
232
- function Oe(r) {
233
- return zt({
234
- str: r,
232
+ function be(s) {
233
+ return Dt({
234
+ str: s,
235
235
  sat: { min: 0.35, max: 0.55 },
236
236
  light: { min: 0.6, max: 0.6 }
237
237
  });
238
238
  }
239
- function Ve(r) {
240
- if (r instanceof RegExp)
241
- return (n) => r.test(n);
239
+ function ke(s) {
240
+ if (s instanceof RegExp)
241
+ return (n) => s.test(n);
242
242
  const t = {
243
243
  positive: [],
244
244
  negative: []
245
- }, e = r.split(",").map((n) => n.trim()).filter((n) => n !== "");
245
+ }, e = s.split(",").map((n) => n.trim()).filter((n) => n !== "");
246
246
  for (let n of e) {
247
- let s = "positive";
248
- n.startsWith("-") && (s = "negative", n = n.slice(1)), n === "*" ? t[s].push(function() {
247
+ let r = "positive";
248
+ n.startsWith("-") && (r = "negative", n = n.slice(1)), n === "*" ? t[r].push(function() {
249
249
  return !0;
250
- }) : n.endsWith("*") ? t[s].push(function(i) {
250
+ }) : n.endsWith("*") ? t[r].push(function(i) {
251
251
  return i.startsWith(n.slice(0, n.length - 1));
252
- }) : t[s].push(function(i) {
252
+ }) : t[r].push(function(i) {
253
253
  return i === n;
254
254
  });
255
255
  }
256
256
  return function(n) {
257
- const { positive: s, negative: i } = t;
258
- return !(i.some((u) => u(n)) || s.length > 0 && !s.some((u) => u(n)));
257
+ const { positive: r, negative: i } = t;
258
+ return !(i.some((u) => u(n)) || r.length > 0 && !r.some((u) => u(n)));
259
259
  };
260
260
  }
261
- var Xt = Object.defineProperty, Qt = (r, t, e) => t in r ? Xt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, lt = (r, t, e) => Qt(r, typeof t != "symbol" ? t + "" : t, e);
262
- class q {
261
+ var Xt = Object.defineProperty, Jt = (s, t, e) => t in s ? Xt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, at = (s, t, e) => Jt(s, typeof t != "symbol" ? t + "" : t, e);
262
+ class I {
263
263
  constructor() {
264
- lt(this, "_l", /* @__PURE__ */ new Map()), lt(this, "_a", (t) => {
264
+ at(this, "_l", /* @__PURE__ */ new Map()), at(this, "_a", (t) => {
265
265
  if (typeof t != "string" && !(t instanceof Symbol))
266
266
  throw new TypeError("Emitter: eventName should be a string or symbol");
267
267
  });
268
268
  }
269
269
  emit(t, ...e) {
270
270
  let n = this.listeners(t);
271
- for (const s of n)
271
+ for (const r of n)
272
272
  try {
273
- s(...e);
273
+ r(...e);
274
274
  } catch (i) {
275
275
  let u = this._l.get("error");
276
276
  if (u != null && u.length)
277
277
  for (const c of u)
278
- c(i, t, s, ...e);
278
+ c(i, t, r, ...e);
279
279
  else throw i;
280
280
  }
281
281
  return t != "*" && this.emit("*", t, ...e) || n.length > 0;
@@ -302,67 +302,67 @@ class q {
302
302
  return [...this._l.entries()].filter(([, t]) => t.length).map(([t]) => t);
303
303
  }
304
304
  }
305
- var $, E;
306
- class $e {
305
+ var L, E;
306
+ class Ee {
307
307
  constructor(t) {
308
308
  // #dolla;
309
- W(this, $);
310
- W(this, E);
311
- T(this, $, t.createLogger("Dolla.stats")), T(this, E, N());
309
+ P(this, L);
310
+ P(this, E);
311
+ T(this, L, t.createLogger("Dolla.stats")), T(this, E, W());
312
312
  let e;
313
313
  O(this, E).emitter.on("statsChanged", () => {
314
314
  e && clearTimeout(e), e = setTimeout(() => {
315
- O(this, $).info(O(this, E).stats);
315
+ O(this, L).info(O(this, E).stats);
316
316
  }, 200);
317
317
  });
318
318
  }
319
319
  }
320
- $ = new WeakMap(), E = new WeakMap();
320
+ L = new WeakMap(), E = new WeakMap();
321
321
  const B = Symbol.for("DollaStatsStore");
322
- function ft() {
323
- const r = new q(), t = {
322
+ function ht() {
323
+ const s = new I(), t = {
324
324
  watcherCount: 0,
325
325
  viewCount: 0
326
326
  };
327
- return r.on("_incrementViewCount", (e) => {
328
- t.viewCount += e, r.emit("statsChanged");
329
- }), r.on("_incrementWatcherCount", (e) => {
330
- t.watcherCount += e, r.emit("statsChanged");
331
- }), { emitter: r, stats: t };
327
+ return s.on("_incrementViewCount", (e) => {
328
+ t.viewCount += e, s.emit("statsChanged");
329
+ }), s.on("_incrementWatcherCount", (e) => {
330
+ t.watcherCount += e, s.emit("statsChanged");
331
+ }), { emitter: s, stats: t };
332
332
  }
333
- function N() {
334
- return typeof window < "u" ? (window[B] || (window[B] = ft()), window[B]) : ft();
333
+ function W() {
334
+ return typeof window < "u" ? (window[B] || (window[B] = ht()), window[B]) : ht();
335
335
  }
336
336
  function At() {
337
- N().emitter.emit("_incrementWatcherCount", 1);
337
+ W().emitter.emit("_incrementWatcherCount", 1);
338
338
  }
339
339
  function Ot() {
340
- N().emitter.emit("_incrementWatcherCount", -1);
340
+ W().emitter.emit("_incrementWatcherCount", -1);
341
341
  }
342
- function te() {
343
- N().emitter.emit("_incrementViewCount", 1);
342
+ function Qt() {
343
+ W().emitter.emit("_incrementViewCount", 1);
344
344
  }
345
- function ee() {
346
- N().emitter.emit("_incrementViewCount", -1);
345
+ function te() {
346
+ W().emitter.emit("_incrementViewCount", -1);
347
347
  }
348
- const Vt = Symbol.for("DollaState"), $t = Symbol.for("DollaRef"), Lt = Symbol.for("DollaMarkup"), M = Symbol.for("DollaMarkupElement"), ne = Symbol.for("DollaStore"), Nt = Symbol.for("DollaStoreFactory"), Le = Symbol.for("DollaRouter");
349
- function m(r) {
350
- return (r == null ? void 0 : r[Vt]) === !0;
348
+ const $t = Symbol.for("DollaState"), Vt = Symbol.for("DollaRef"), Lt = Symbol.for("DollaMarkup"), M = Symbol.for("DollaMarkupElement"), Ae = Symbol.for("DollaRouter");
349
+ function m(s) {
350
+ return (s == null ? void 0 : s[$t]) === !0;
351
351
  }
352
- function re(r) {
353
- return m(r) ? r.get() : r;
352
+ function ee(s) {
353
+ return m(s) ? s.get() : s;
354
354
  }
355
- function X(r) {
356
- return m(r) ? r : new Q({
355
+ function Y(s) {
356
+ return m(s) ? s : new X({
357
357
  get() {
358
- return r;
358
+ return s;
359
359
  },
360
360
  watch(t, e = {}) {
361
- return e != null && e.lazy || t(r), Zt;
361
+ return e != null && e.lazy || t(s), Zt;
362
362
  }
363
363
  });
364
364
  }
365
- class se {
365
+ class ne {
366
366
  constructor(t, e) {
367
367
  o(this, "value");
368
368
  o(this, "watchers", []);
@@ -390,11 +390,11 @@ class se {
390
390
  };
391
391
  }
392
392
  }
393
- var _t;
394
- _t = Vt;
395
- class Q {
393
+ var mt;
394
+ mt = $t;
395
+ class X {
396
396
  constructor(t) {
397
- o(this, _t, !0);
397
+ o(this, mt, !0);
398
398
  o(this, "__value");
399
399
  this.__value = t;
400
400
  }
@@ -405,12 +405,12 @@ class Q {
405
405
  return this.__value.watch(t, e);
406
406
  }
407
407
  }
408
- function Y(r, t) {
409
- const e = new se(r, t);
410
- return [new Q(e), (s) => e.set(s)];
408
+ function H(s, t) {
409
+ const e = new ne(s, t);
410
+ return [new X(e), (r) => e.set(r)];
411
411
  }
412
- const dt = Symbol("EMPTY");
413
- class ie {
412
+ const lt = Symbol("EMPTY");
413
+ class se {
414
414
  constructor(t, e, n) {
415
415
  o(this, "equals", Et);
416
416
  /**
@@ -440,7 +440,7 @@ class ie {
440
440
  /**
441
441
  * The current value as returned from `fn` (may be a State)
442
442
  */
443
- o(this, "value", dt);
443
+ o(this, "value", lt);
444
444
  /**
445
445
  * The current unwrapped value.
446
446
  */
@@ -449,7 +449,7 @@ class ie {
449
449
  * When value is a State, this function will stop watching its value.
450
450
  */
451
451
  o(this, "stopWatchingCurrentValue");
452
- this.sources = t.map(X), this.fn = e, n != null && n.equals && (this.equals = n.equals), this.previousSourceValues = new Array(t.length).fill(dt, 0, t.length);
452
+ this.sources = t.map(Y), this.fn = e, n != null && n.equals && (this.equals = n.equals), this.previousSourceValues = new Array(t.length).fill(lt, 0, t.length);
453
453
  }
454
454
  /*==========================*\
455
455
  || "Public" methods ||
@@ -473,24 +473,24 @@ class ie {
473
473
  }
474
474
  update() {
475
475
  const t = this.sources, e = this.previousSourceValues;
476
- let n = !1, s;
476
+ let n = !1, r;
477
477
  for (let i = 0; i < t.length; i++)
478
- s = t[i].get(), !n && !this.equals(s, e[i]) && (n = !0), e[i] = s;
478
+ r = t[i].get(), !n && !this.equals(r, e[i]) && (n = !0), e[i] = r;
479
479
  n && this.setValue(this.fn(...e));
480
480
  }
481
481
  getValue() {
482
482
  return this.isWatchingSources || this.update(), this.rawValue;
483
483
  }
484
484
  setValue(t) {
485
- this.stopWatchingCurrentValue && (this.stopWatchingCurrentValue(), this.stopWatchingCurrentValue = void 0), this.value = t, this.rawValue = re(t), this.isWatchingSources && m(t) ? this.stopWatchingCurrentValue = t.watch((e) => {
485
+ this.stopWatchingCurrentValue && (this.stopWatchingCurrentValue(), this.stopWatchingCurrentValue = void 0), this.value = t, this.rawValue = ee(t), this.isWatchingSources && m(t) ? this.stopWatchingCurrentValue = t.watch((e) => {
486
486
  this.rawValue = e, this.notify(e);
487
487
  }) : this.notify(this.rawValue);
488
488
  }
489
489
  startWatchingSources() {
490
490
  const t = this.previousSourceValues;
491
491
  for (let n = 0; n < this.sources.length; n++)
492
- this.sourceWatcher.watch([this.sources[n]], (s) => {
493
- if (t[n] = s, this.isWatchingSources) {
492
+ this.sourceWatcher.watch([this.sources[n]], (r) => {
493
+ if (t[n] = r, this.isWatchingSources) {
494
494
  const i = this.fn(...t);
495
495
  this.equals(i, this.value) || this.setValue(i);
496
496
  }
@@ -503,226 +503,60 @@ class ie {
503
503
  this.sourceWatcher.stopAll(), this.stopWatchingCurrentValue && (this.stopWatchingCurrentValue(), this.stopWatchingCurrentValue = void 0), this.isWatchingSources = !1;
504
504
  }
505
505
  }
506
- function oe(r, t, e) {
507
- const n = new ie(r, t, e);
508
- return new Q(n);
506
+ function re(s, t, e) {
507
+ const n = new se(s, t, e);
508
+ return new X(n);
509
509
  }
510
510
  function D() {
511
- const r = [];
511
+ const s = [];
512
512
  return {
513
513
  watch(t, e) {
514
514
  if (t.length === 0)
515
515
  throw new TypeError("Expected at least one state to watch.");
516
- t = t.map(X);
516
+ t = t.map(Y);
517
517
  let n;
518
- return t.length > 1 ? n = oe(t, e).watch(() => null) : n = t[0].watch(e), r.push(n), () => {
519
- let s = r.indexOf(n);
520
- s > -1 && r.splice(s, 1), n();
518
+ return t.length > 1 ? n = re(t, e).watch(() => null) : n = t[0].watch(e), s.push(n), () => {
519
+ let r = s.indexOf(n);
520
+ r > -1 && s.splice(r, 1), n();
521
521
  };
522
522
  },
523
523
  stopAll() {
524
- for (; r.length > 0; )
525
- r.pop()();
524
+ for (; s.length > 0; )
525
+ s.pop()();
526
526
  }
527
527
  };
528
528
  }
529
- function Ne(r) {
529
+ function Oe(s) {
530
530
  function t() {
531
531
  if (arguments.length === 1)
532
- r = arguments[0];
532
+ s = arguments[0];
533
533
  else if (arguments.length > 1)
534
534
  throw new Error(`Too many arguments. Expected 0 or 1. Got: ${arguments.length}`);
535
- return r;
536
- }
537
- return t[$t] = !0, t;
538
- }
539
- function ue(r) {
540
- return (r == null ? void 0 : r[$t]) === !0;
541
- }
542
- var L;
543
- class tt {
544
- constructor(t, e) {
545
- o(this, "type");
546
- o(this, "detail");
547
- W(this, L, !1);
548
- this.type = t, this.detail = e;
549
- }
550
- get propagationStopped() {
551
- return O(this, L);
552
- }
553
- stopPropagation() {
554
- T(this, L, !0);
555
- }
556
- get [Symbol.toStringTag]() {
557
- return "ContextEvent";
558
- }
559
- // stopImmediatePropagation() {}
560
- }
561
- L = new WeakMap();
562
- let ce = class {
563
- constructor(t) {
564
- o(this, "__store");
565
- this.__store = t;
566
- const e = Object.getOwnPropertyDescriptors(this.__store._logger);
567
- for (const n in e)
568
- n !== "setName" && Object.defineProperty(this, n, e[n]);
569
- }
570
- get isMounted() {
571
- return this.__store.isMounted;
572
- }
573
- setName(t) {
574
- return this.__store._logger.setName(t), this;
575
- }
576
- set(t, e) {
577
- return this.__store._elementContext.data[t] = e, e;
578
- }
579
- get(t) {
580
- let e = this.__store._elementContext;
581
- for (; ; ) {
582
- if (t in e.data)
583
- return e.data[t];
584
- if (e.parent)
585
- e = e.parent;
586
- else
587
- break;
588
- }
589
- return null;
590
- }
591
- // on<T = unknown>(eventName: string, listener: (...args: any) => void): void {
592
- // this.__store._elementContext.emitter.on(eventName, listener);
593
- // }
594
- // off<T = unknown>(eventName: string, listener: (...args: any) => void): void {
595
- // this.__store._elementContext.emitter.off(eventName, listener);
596
- // }
597
- // once<T = unknown>(eventName: string, listener: (...args: any) => void): void {
598
- // this.__store._elementContext.emitter.once(eventName, listener);
599
- // }
600
- on(t, e) {
601
- if (t === "*") {
602
- const n = (s, i) => {
603
- e(i);
604
- };
605
- this.__store._elementContext.emitter.on(t, n), this.__store._wildcardListeners.set(e, n);
606
- } else
607
- this.__store._elementContext.emitter.on(t, e);
608
- }
609
- off(t, e) {
610
- if (t === "*") {
611
- const n = this.__store._wildcardListeners.get(e);
612
- n && (this.__store._elementContext.emitter.off(t, n), this.__store._wildcardListeners.delete(e));
613
- } else
614
- this.__store._elementContext.emitter.off(t, e);
615
- }
616
- once(t, e) {
617
- if (t === "*") {
618
- const n = (s, i) => {
619
- this.__store._wildcardListeners.delete(e), e(i);
620
- };
621
- this.__store._elementContext.emitter.once(t, n), this.__store._wildcardListeners.set(e, n);
622
- } else
623
- this.__store._elementContext.emitter.once(t, e);
624
- }
625
- emit(t, e) {
626
- return this.__store._elementContext.emitter.emit(t, new tt(t, e));
627
- }
628
- onMount(t) {
629
- this.__store._emitter.on("mounted", t);
630
- }
631
- onUnmount(t) {
632
- this.__store._emitter.on("unmounted", t);
633
- }
634
- watch(t, e) {
635
- const n = this.__store;
636
- if (n.isMounted)
637
- return n._watcher.watch(t, e);
638
- {
639
- let s, i = !1;
640
- return n._emitter.on("mounted", () => {
641
- i || (s = n._watcher.watch(t, e));
642
- }), () => {
643
- s != null && (i = !0, s());
644
- };
645
- }
646
- }
647
- };
648
- class ae {
649
- constructor(t, e, n) {
650
- o(this, "key");
651
- o(this, "_fn");
652
- o(this, "_options");
653
- /**
654
- * Value is guaranteed to be set after `attach` is called.
655
- */
656
- o(this, "value");
657
- o(this, "isMounted", !1);
658
- o(this, "_elementContext");
659
- o(this, "_emitter", new q());
660
- o(this, "_wildcardListeners", /* @__PURE__ */ new Map());
661
- o(this, "_logger");
662
- o(this, "_watcher", D());
663
- this.key = t, this._fn = e, this._options = n;
664
- }
665
- get name() {
666
- return this._fn.name;
667
- }
668
- /**
669
- * Attaches this Store to the elementContext.
670
- * Returns false if there was already an instance attached, and true otherwise.
671
- */
672
- attach(t) {
673
- if (t.stores.has(this.key))
674
- return !1;
675
- this._elementContext = t, this._logger = t.root.createLogger(this._fn.name), this._emitter.on("error", (n, s, ...i) => {
676
- console.log({ error: n, eventName: s, args: i }), this._logger.crash(n);
677
- });
678
- const e = new ce(this);
679
- try {
680
- this.value = this._fn.call(e, this._options, e);
681
- } catch (n) {
682
- this._logger.crash(n);
683
- }
684
- return t.stores.set(this.key, this), !0;
685
- }
686
- handleMount() {
687
- this.isMounted = !0, this._emitter.emit("mounted");
688
- }
689
- handleUnmount() {
690
- this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
691
- }
692
- }
693
- function he(r) {
694
- return (r == null ? void 0 : r[Nt]) === !0;
695
- }
696
- function le(r) {
697
- return (r == null ? void 0 : r[ne]) === !0;
698
- }
699
- function Te(r) {
700
- const t = J();
701
- function e(n) {
702
- return new ae(t, r, n);
535
+ return s;
703
536
  }
704
- return e[Nt] = !0, e.key = t, e;
537
+ return t[Vt] = !0, t;
705
538
  }
706
- class H extends Error {
539
+ function ie(s) {
540
+ return (s == null ? void 0 : s[Vt]) === !0;
707
541
  }
708
- function Pe(r, t) {
542
+ function $e(s, t) {
709
543
  return t.outlet();
710
544
  }
711
- function fe(r) {
712
- for (var t, e, n = arguments, s = 1, i = "", u = "", c = [0], h = function(l) {
713
- s === 1 && (l || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? c.push(l ? n[l] : i) : s === 3 && (l || i) ? (c[1] = l ? n[l] : i, s = 2) : s === 2 && i === "..." && l ? c[2] = Object.assign(c[2] || {}, n[l]) : s === 2 && i && !l ? (c[2] = c[2] || {})[i] = !0 : s >= 5 && (s === 5 ? ((c[2] = c[2] || {})[e] = l ? i ? i + n[l] : n[l] : i, s = 6) : (l || i) && (c[2][e] += l ? i + n[l] : i)), i = "";
714
- }, a = 0; a < r.length; a++) {
715
- a && (s === 1 && h(), h(a));
716
- for (var f = 0; f < r[a].length; f++) t = r[a][f], s === 1 ? t === "<" ? (h(), c = [c, "", null], s = 3) : i += t : s === 4 ? i === "--" && t === ">" ? (s = 1, i = "") : i = t + i[0] : u ? t === u ? u = "" : i += t : t === '"' || t === "'" ? u = t : t === ">" ? (h(), s = 1) : s && (t === "=" ? (s = 5, e = i, i = "") : t === "/" && (s < 5 || r[a][f + 1] === ">") ? (h(), s === 3 && (c = c[0]), s = c, (c = c[0]).push(this.apply(null, s.slice(1))), s = 0) : t === " " || t === " " || t === `
717
- ` || t === "\r" ? (h(), s = 2) : i += t), s === 3 && i === "!--" && (s = 4, c = c[0]);
545
+ function oe(s) {
546
+ for (var t, e, n = arguments, r = 1, i = "", u = "", c = [0], h = function(l) {
547
+ r === 1 && (l || (i = i.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? c.push(l ? n[l] : i) : r === 3 && (l || i) ? (c[1] = l ? n[l] : i, r = 2) : r === 2 && i === "..." && l ? c[2] = Object.assign(c[2] || {}, n[l]) : r === 2 && i && !l ? (c[2] = c[2] || {})[i] = !0 : r >= 5 && (r === 5 ? ((c[2] = c[2] || {})[e] = l ? i ? i + n[l] : n[l] : i, r = 6) : (l || i) && (c[2][e] += l ? i + n[l] : i)), i = "";
548
+ }, a = 0; a < s.length; a++) {
549
+ a && (r === 1 && h(), h(a));
550
+ for (var f = 0; f < s[a].length; f++) t = s[a][f], r === 1 ? t === "<" ? (h(), c = [c, "", null], r = 3) : i += t : r === 4 ? i === "--" && t === ">" ? (r = 1, i = "") : i = t + i[0] : u ? t === u ? u = "" : i += t : t === '"' || t === "'" ? u = t : t === ">" ? (h(), r = 1) : r && (t === "=" ? (r = 5, e = i, i = "") : t === "/" && (r < 5 || s[a][f + 1] === ">") ? (h(), r === 3 && (c = c[0]), r = c, (c = c[0]).push(this.apply(null, r.slice(1))), r = 0) : t === " " || t === " " || t === `
551
+ ` || t === "\r" ? (h(), r = 2) : i += t), r === 3 && i === "!--" && (r = 4, c = c[0]);
718
552
  }
719
553
  return h(), c.length > 2 ? c.slice(1) : c[1];
720
554
  }
721
- var wt;
722
- wt = M;
723
- class pt {
555
+ var _t;
556
+ _t = M;
557
+ class ft {
724
558
  constructor(t) {
725
- o(this, wt, !0);
559
+ o(this, _t, !0);
726
560
  o(this, "node");
727
561
  this.node = t;
728
562
  }
@@ -736,33 +570,33 @@ class pt {
736
570
  this.node.parentNode && !t && this.node.parentNode.removeChild(this.node);
737
571
  }
738
572
  }
739
- const de = (r) => /^on[A-Z]/.test(r);
740
- var gt;
741
- gt = M;
742
- class pe {
743
- constructor({ tag: t, props: e, children: n, elementContext: s }) {
744
- o(this, gt, !0);
573
+ const ue = (s) => /^on[A-Z]/.test(s);
574
+ var wt;
575
+ wt = M;
576
+ class ce {
577
+ constructor({ tag: t, props: e, children: n, elementContext: r }) {
578
+ o(this, wt, !0);
745
579
  o(this, "node");
746
580
  o(this, "props");
747
581
  o(this, "childMarkup", []);
748
582
  o(this, "children", []);
749
583
  o(this, "stopCallbacks", []);
750
584
  o(this, "elementContext");
751
- o(this, "uniqueId", J());
585
+ o(this, "uniqueId", kt());
752
586
  o(this, "_batchWrite");
753
587
  // Track the ref so we can nullify it on unmount.
754
588
  o(this, "ref");
755
589
  // Prevents 'onClickOutside' handlers from firing in the same cycle in which the element is connected.
756
590
  o(this, "canClickAway", !1);
757
- if (s = { ...s }, this._batchWrite = s.root.batch.write.bind(s.root.batch), t.toLowerCase() === "svg" && (s.isSVG = !0), s.isSVG ? this.node = document.createElementNS("http://www.w3.org/2000/svg", t) : this.node = document.createElement(t), e.ref)
758
- if (ue(e.ref))
591
+ if (r = { ...r }, this._batchWrite = r.root.batch.write.bind(r.root.batch), t.toLowerCase() === "svg" && (r.isSVG = !0), r.isSVG ? this.node = document.createElementNS("http://www.w3.org/2000/svg", t) : this.node = document.createElement(t), e.ref)
592
+ if (ie(e.ref))
759
593
  this.ref = e.ref, this.ref(this.node);
760
594
  else
761
595
  throw new Error("Expected ref to be a function. Got: " + e.ref);
762
596
  this.props = {
763
- ...Jt(["ref", "class", "className"], e),
597
+ ...Yt(["ref", "class", "className"], e),
764
598
  class: e.className ?? e.class
765
- }, n && (this.childMarkup = n), this.elementContext = s, this.children = k(this.elementContext, this.childMarkup);
599
+ }, n && (this.childMarkup = n), this.elementContext = r, this.children = b(this.elementContext, this.childMarkup);
766
600
  }
767
601
  get isMounted() {
768
602
  return this.node.parentNode != null;
@@ -772,8 +606,8 @@ class pe {
772
606
  throw new Error(`HTML element requires a parent element as the first argument to connect. Got: ${t}`);
773
607
  if (!this.isMounted) {
774
608
  for (let n = 0; n < this.children.length; n++) {
775
- const s = this.children[n], i = n > 0 ? this.children[n - 1].node : void 0;
776
- s.mount(this.node, i);
609
+ const r = this.children[n], i = n > 0 ? this.children[n - 1].node : void 0;
610
+ r.mount(this.node, i);
777
611
  }
778
612
  this.applyProps(this.node, this.props), this.props.style && this.applyStyles(this.node, this.props.style, this.stopCallbacks), this.props.class && this.applyClasses(this.node, this.props.class, this.stopCallbacks);
779
613
  }
@@ -800,16 +634,16 @@ class pe {
800
634
  }
801
635
  attachProp(t, e, n) {
802
636
  m(t) ? this.stopCallbacks.push(
803
- t.watch((s) => {
804
- this._mutate(() => e(s), n);
637
+ t.watch((r) => {
638
+ this._mutate(() => e(r), n);
805
639
  })
806
640
  ) : this._mutate(() => e(t), n);
807
641
  }
808
642
  applyProps(t, e) {
809
643
  for (const n in e) {
810
- const s = e[n];
644
+ const r = e[n];
811
645
  if (n === "attributes") {
812
- const i = s;
646
+ const i = r;
813
647
  for (const u in i)
814
648
  this.attachProp(
815
649
  i[u],
@@ -819,37 +653,37 @@ class pe {
819
653
  this.getUpdateKey("attr", u)
820
654
  );
821
655
  } else if (n === "eventListeners") {
822
- const i = s;
656
+ const i = r;
823
657
  for (const u in i) {
824
- const c = m(s) ? (h) => s.get()(h) : s;
658
+ const c = m(r) ? (h) => r.get()(h) : r;
825
659
  t.addEventListener(u, c), this.stopCallbacks.push(() => {
826
660
  t.removeEventListener(u, c);
827
661
  });
828
662
  }
829
663
  } else if (n === "onClickOutside" || n === "onclickoutside") {
830
664
  const i = (c) => {
831
- this.canClickAway && !t.contains(c.target) && (m(s) ? s.get()(c) : s(c));
665
+ this.canClickAway && !t.contains(c.target) && (m(r) ? r.get()(c) : r(c));
832
666
  }, u = { capture: !0 };
833
667
  window.addEventListener("click", i, u), this.stopCallbacks.push(() => {
834
668
  window.removeEventListener("click", i, u);
835
669
  });
836
- } else if (de(n)) {
837
- const i = n.slice(2).toLowerCase(), u = m(s) ? (c) => s.get()(c) : s;
670
+ } else if (ue(n)) {
671
+ const i = n.slice(2).toLowerCase(), u = m(r) ? (c) => r.get()(c) : r;
838
672
  t.addEventListener(i, u), this.stopCallbacks.push(() => {
839
673
  t.removeEventListener(i, u);
840
674
  });
841
675
  } else if (n.includes("-"))
842
676
  this.attachProp(
843
- s,
677
+ r,
844
678
  (i) => {
845
679
  i == null ? t.removeAttribute(n) : t.setAttribute(n, String(i));
846
680
  },
847
681
  this.getUpdateKey("attr", n)
848
682
  );
849
- else if (!me.includes(n))
683
+ else if (!ae.includes(n))
850
684
  if (this.elementContext.isSVG)
851
685
  this.attachProp(
852
- s,
686
+ r,
853
687
  (i) => {
854
688
  i != null ? t.setAttribute(n, String(e[n])) : t.removeAttribute(n);
855
689
  },
@@ -860,7 +694,7 @@ class pe {
860
694
  case "contentEditable":
861
695
  case "value":
862
696
  this.attachProp(
863
- s,
697
+ r,
864
698
  (i) => {
865
699
  t[n] = String(i);
866
700
  },
@@ -869,7 +703,7 @@ class pe {
869
703
  break;
870
704
  case "for":
871
705
  this.attachProp(
872
- s,
706
+ r,
873
707
  (i) => {
874
708
  t.htmlFor = i;
875
709
  },
@@ -878,7 +712,7 @@ class pe {
878
712
  break;
879
713
  case "checked":
880
714
  this.attachProp(
881
- s,
715
+ r,
882
716
  (i) => {
883
717
  t.checked = i, i ? t.setAttribute("checked", "") : t.removeAttribute("checked");
884
718
  },
@@ -893,7 +727,7 @@ class pe {
893
727
  case "title": {
894
728
  const i = n.toLowerCase();
895
729
  this.attachProp(
896
- s,
730
+ r,
897
731
  (u) => {
898
732
  u == null ? t.removeAttribute(i) : t.setAttribute(i, String(u));
899
733
  },
@@ -904,7 +738,7 @@ class pe {
904
738
  case "autocomplete":
905
739
  case "autocapitalize":
906
740
  this.attachProp(
907
- s,
741
+ r,
908
742
  (i) => {
909
743
  typeof i == "string" ? t.autocomplete = i : i ? t.autocomplete = "on" : t.autocomplete = "off";
910
744
  },
@@ -913,7 +747,7 @@ class pe {
913
747
  break;
914
748
  default: {
915
749
  this.attachProp(
916
- s,
750
+ r,
917
751
  (i) => {
918
752
  t[n] = i;
919
753
  },
@@ -925,20 +759,20 @@ class pe {
925
759
  }
926
760
  }
927
761
  applyStyles(t, e, n) {
928
- const s = [];
762
+ const r = [];
929
763
  if (m(e)) {
930
764
  let i;
931
765
  const u = e.watch((c) => {
932
766
  this._mutate(
933
767
  () => {
934
- I(i) && i(), t.style.cssText = "", i = this.applyStyles(t, c, n);
768
+ V(i) && i(), t.style.cssText = "", i = this.applyStyles(t, c, n);
935
769
  },
936
770
  this.getUpdateKey("styles", "*")
937
771
  );
938
772
  });
939
- n.push(u), s.push(u);
773
+ n.push(u), r.push(u);
940
774
  } else {
941
- const i = Tt(e);
775
+ const i = Wt(e);
942
776
  for (const u in i) {
943
777
  const { value: c, priority: h } = i[u];
944
778
  if (m(c)) {
@@ -947,30 +781,30 @@ class pe {
947
781
  f ? t.style.setProperty(u, String(f), h) : t.style.removeProperty(u);
948
782
  });
949
783
  });
950
- n.push(a), s.push(a);
784
+ n.push(a), r.push(a);
951
785
  } else c != null && t.style.setProperty(u, String(c));
952
786
  }
953
787
  }
954
788
  return function() {
955
- for (const u of s)
789
+ for (const u of r)
956
790
  u(), n.splice(n.indexOf(u), 1);
957
791
  };
958
792
  }
959
793
  applyClasses(t, e, n) {
960
- const s = [];
794
+ const r = [];
961
795
  if (m(e)) {
962
796
  let i;
963
797
  const u = e.watch((c) => {
964
798
  this._mutate(
965
799
  () => {
966
- I(i) && i(), t.removeAttribute("class"), i = this.applyClasses(t, c, n);
800
+ V(i) && i(), t.removeAttribute("class"), i = this.applyClasses(t, c, n);
967
801
  },
968
802
  this.getUpdateKey("attr", "class")
969
803
  );
970
804
  });
971
- n.push(u), s.push(u);
805
+ n.push(u), r.push(u);
972
806
  } else {
973
- const i = Wt(e);
807
+ const i = Nt(e);
974
808
  for (const u in i) {
975
809
  const c = i[u];
976
810
  if (m(c)) {
@@ -979,55 +813,55 @@ class pe {
979
813
  a ? t.classList.add(u) : t.classList.remove(u);
980
814
  });
981
815
  });
982
- n.push(h), s.push(h);
816
+ n.push(h), r.push(h);
983
817
  } else c && t.classList.add(u);
984
818
  }
985
819
  }
986
820
  return function() {
987
- for (const u of s)
821
+ for (const u of r)
988
822
  u(), n.splice(n.indexOf(u), 1);
989
823
  };
990
824
  }
991
825
  }
992
- function Wt(r) {
826
+ function Nt(s) {
993
827
  let t = {};
994
- if (b(r)) {
995
- const e = r.split(" ");
828
+ if (k(s)) {
829
+ const e = s.split(" ");
996
830
  for (const n of e)
997
831
  t[n] = !0;
998
- } else Z(r) ? Object.assign(t, r) : Array.isArray(r) && Array.from(r).filter(Boolean).forEach((e) => {
999
- Object.assign(t, Wt(e));
832
+ } else Z(s) ? Object.assign(t, s) : Array.isArray(s) && Array.from(s).filter(Boolean).forEach((e) => {
833
+ Object.assign(t, Nt(e));
1000
834
  });
1001
835
  return delete t.undefined, t;
1002
836
  }
1003
- function Tt(r) {
837
+ function Wt(s) {
1004
838
  let t = {};
1005
- if (b(r)) {
1006
- const e = r.split(";").filter((n) => n.trim() !== "");
839
+ if (k(s)) {
840
+ const e = s.split(";").filter((n) => n.trim() !== "");
1007
841
  for (const n of e) {
1008
- const [s, i] = n.split(":"), u = {
842
+ const [r, i] = n.split(":"), u = {
1009
843
  value: i
1010
844
  };
1011
- i.includes("!important") ? (u.priority = "important", u.value = i.replace("!important", "").trim()) : u.value = i.trim(), t[mt(s.trim())] = u;
845
+ i.includes("!important") ? (u.priority = "important", u.value = i.replace("!important", "").trim()) : u.value = i.trim(), t[dt(r.trim())] = u;
1012
846
  }
1013
847
  }
1014
- if (Z(r))
1015
- for (const e in r)
1016
- e.startsWith("--") ? t[e] = { value: r[e] } : t[mt(e)] = { value: r[e] };
1017
- else Array.isArray(r) && Array.from(r).filter((e) => e != null).forEach((e) => {
1018
- Object.assign(t, Tt(e));
848
+ if (Z(s))
849
+ for (const e in s)
850
+ e.startsWith("--") ? t[e] = { value: s[e] } : t[dt(e)] = { value: s[e] };
851
+ else Array.isArray(s) && Array.from(s).filter((e) => e != null).forEach((e) => {
852
+ Object.assign(t, Wt(e));
1019
853
  });
1020
854
  return t;
1021
855
  }
1022
- function mt(r) {
1023
- return r.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, e) => (e ? "-" : "") + t.toLowerCase());
856
+ function dt(s) {
857
+ return s.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, e) => (e ? "-" : "") + t.toLowerCase());
1024
858
  }
1025
- const me = ["ref", "children", "class", "style", "data"];
1026
- var yt;
1027
- yt = M;
1028
- class _e {
859
+ const ae = ["ref", "children", "class", "style", "data"];
860
+ var gt;
861
+ gt = M;
862
+ class he {
1029
863
  constructor({ sources: t, renderFn: e, elementContext: n }) {
1030
- o(this, yt, !0);
864
+ o(this, gt, !0);
1031
865
  o(this, "node", document.createTextNode(""));
1032
866
  o(this, "children", []);
1033
867
  o(this, "renderFn");
@@ -1041,12 +875,12 @@ class _e {
1041
875
  }
1042
876
  mount(t, e) {
1043
877
  this.isMounted || (t.insertBefore(this.node, (e == null ? void 0 : e.nextSibling) ?? null), this.watcher.watch(this.sources, (...n) => {
1044
- const s = this.renderFn(...n);
1045
- if (!It(s))
1046
- throw console.error(s, n), new TypeError(
1047
- `Observer received invalid value to render. Got type: ${V(s)}, value: ${s}`
878
+ const r = this.renderFn(...n);
879
+ if (!qt(r))
880
+ throw console.error(r, n), new TypeError(
881
+ `Observer received invalid value to render. Got type: ${$(r)}, value: ${r}`
1048
882
  );
1049
- this.update(A(s) ? s : [s]);
883
+ this.update(A(r) ? r : [r]);
1050
884
  }));
1051
885
  }
1052
886
  unmount(t = !1) {
@@ -1062,20 +896,20 @@ class _e {
1062
896
  var i, u, c;
1063
897
  if (this.cleanup(!1), t == null || t.length === 0 || !this.isMounted)
1064
898
  return;
1065
- const e = t.flatMap((h) => Ft(h) ? h : k(this.elementContext, et(h)));
899
+ const e = t.flatMap((h) => Tt(h) ? h : b(this.elementContext, Q(h)));
1066
900
  for (const h of e) {
1067
901
  const a = ((i = this.children.at(-1)) == null ? void 0 : i.node) || this.node;
1068
902
  h.mount(this.node.parentNode, a), this.children.push(h);
1069
903
  }
1070
- const n = this.node.parentNode, s = ((c = (u = this.children.at(-1)) == null ? void 0 : u.node) == null ? void 0 : c.nextSibling) ?? null;
1071
- n.insertBefore(this.node, s);
904
+ const n = this.node.parentNode, r = ((c = (u = this.children.at(-1)) == null ? void 0 : u.node) == null ? void 0 : c.nextSibling) ?? null;
905
+ n.insertBefore(this.node, r);
1072
906
  }
1073
907
  }
1074
- var St;
1075
- St = M;
908
+ var yt;
909
+ yt = M;
1076
910
  class Pt {
1077
911
  constructor(t) {
1078
- o(this, St, !0);
912
+ o(this, yt, !0);
1079
913
  o(this, "node", document.createTextNode(""));
1080
914
  o(this, "isMounted", !1);
1081
915
  o(this, "source");
@@ -1099,19 +933,19 @@ class Pt {
1099
933
  update(t) {
1100
934
  var e, n;
1101
935
  if (this.cleanup(!1), t.length > 0) {
1102
- for (let s = 0; s < t.length; s++) {
1103
- const i = t[s], u = s > 0 ? this.elements[s - 1] : void 0;
936
+ for (let r = 0; r < t.length; r++) {
937
+ const i = t[r], u = r > 0 ? this.elements[r - 1] : void 0;
1104
938
  i.mount(this.node.parentElement, u == null ? void 0 : u.node), this.elements.push(i);
1105
939
  }
1106
940
  (n = this.node.parentNode) == null || n.insertBefore(this.node, ((e = this.elements.at(-1)) == null ? void 0 : e.node) ?? null);
1107
941
  }
1108
942
  }
1109
943
  }
1110
- var Ct;
1111
- Ct = M;
1112
- class we {
944
+ var vt;
945
+ vt = M;
946
+ class le {
1113
947
  constructor(t) {
1114
- o(this, Ct, !0);
948
+ o(this, vt, !0);
1115
949
  o(this, "config");
1116
950
  o(this, "element");
1117
951
  this.config = t;
@@ -1120,18 +954,158 @@ class we {
1120
954
  return this.element ? this.element.isMounted : !1;
1121
955
  }
1122
956
  mount(t, e) {
1123
- const { content: n, parent: s } = this.config;
1124
- Ft(n) ? this.element = n : this.element = F(k(this.config.elementContext, et(n))), this.element.mount(s);
957
+ const { content: n, parent: r } = this.config;
958
+ Tt(n) ? this.element = n : this.element = F(b(this.config.elementContext, Q(n))), this.element.mount(r);
1125
959
  }
1126
960
  unmount(t = !1) {
1127
961
  var e;
1128
962
  (e = this.element) != null && e.isMounted && this.element.unmount(t);
1129
963
  }
1130
964
  }
1131
- function Fe(r) {
1132
- return r;
965
+ var N;
966
+ class J {
967
+ constructor(t, e) {
968
+ o(this, "type");
969
+ o(this, "detail");
970
+ P(this, N, !1);
971
+ this.type = t, this.detail = e;
972
+ }
973
+ get propagationStopped() {
974
+ return O(this, N);
975
+ }
976
+ stopPropagation() {
977
+ T(this, N, !0);
978
+ }
979
+ get [Symbol.toStringTag]() {
980
+ return "ContextEvent";
981
+ }
982
+ // stopImmediatePropagation() {}
983
+ }
984
+ N = new WeakMap();
985
+ let fe = class {
986
+ constructor(t) {
987
+ o(this, "__store");
988
+ this.__store = t;
989
+ const e = Object.getOwnPropertyDescriptors(this.__store._logger);
990
+ for (const n in e)
991
+ n !== "setName" && Object.defineProperty(this, n, e[n]);
992
+ }
993
+ get isMounted() {
994
+ return this.__store.isMounted;
995
+ }
996
+ setName(t) {
997
+ return this.__store._logger.setName(t), this;
998
+ }
999
+ set(t, e) {
1000
+ return this.__store._elementContext.data[t] = e, e;
1001
+ }
1002
+ get(t) {
1003
+ let e = this.__store._elementContext;
1004
+ for (; ; ) {
1005
+ if (t in e.data)
1006
+ return e.data[t];
1007
+ if (e.parent)
1008
+ e = e.parent;
1009
+ else
1010
+ break;
1011
+ }
1012
+ return null;
1013
+ }
1014
+ on(t, e) {
1015
+ if (t === "*") {
1016
+ const n = (r, i) => {
1017
+ e(i);
1018
+ };
1019
+ this.__store._elementContext.emitter.on(t, n), this.__store._wildcardListeners.set(e, n);
1020
+ } else
1021
+ this.__store._elementContext.emitter.on(t, e);
1022
+ }
1023
+ off(t, e) {
1024
+ if (t === "*") {
1025
+ const n = this.__store._wildcardListeners.get(e);
1026
+ n && (this.__store._elementContext.emitter.off(t, n), this.__store._wildcardListeners.delete(e));
1027
+ } else
1028
+ this.__store._elementContext.emitter.off(t, e);
1029
+ }
1030
+ once(t, e) {
1031
+ if (t === "*") {
1032
+ const n = (r, i) => {
1033
+ this.__store._wildcardListeners.delete(e), e(i);
1034
+ };
1035
+ this.__store._elementContext.emitter.once(t, n), this.__store._wildcardListeners.set(e, n);
1036
+ } else
1037
+ this.__store._elementContext.emitter.once(t, e);
1038
+ }
1039
+ emit(t, e) {
1040
+ return this.__store._elementContext.emitter.emit(t, new J(t, e));
1041
+ }
1042
+ onMount(t) {
1043
+ this.__store._emitter.on("mounted", t);
1044
+ }
1045
+ onUnmount(t) {
1046
+ this.__store._emitter.on("unmounted", t);
1047
+ }
1048
+ watch(t, e) {
1049
+ const n = this.__store;
1050
+ if (n.isMounted)
1051
+ return n._watcher.watch(t, e);
1052
+ {
1053
+ let r, i = !1;
1054
+ return n._emitter.on("mounted", () => {
1055
+ i || (r = n._watcher.watch(t, e));
1056
+ }), () => {
1057
+ r != null && (i = !0, r());
1058
+ };
1059
+ }
1060
+ }
1061
+ };
1062
+ class de {
1063
+ constructor(t, e) {
1064
+ o(this, "fn");
1065
+ o(this, "_options");
1066
+ /**
1067
+ * Value is guaranteed to be set after `attach` is called.
1068
+ */
1069
+ o(this, "value");
1070
+ o(this, "isMounted", !1);
1071
+ o(this, "_elementContext");
1072
+ o(this, "_emitter", new I());
1073
+ o(this, "_wildcardListeners", /* @__PURE__ */ new Map());
1074
+ o(this, "_logger");
1075
+ o(this, "_watcher", D());
1076
+ this.fn = t, this._options = e;
1077
+ }
1078
+ get name() {
1079
+ return this.fn.name;
1080
+ }
1081
+ /**
1082
+ * Attaches this Store to the elementContext.
1083
+ * Returns false if there was already an instance attached, and true otherwise.
1084
+ */
1085
+ attach(t) {
1086
+ if (t.stores.has(this.fn))
1087
+ return !1;
1088
+ this._elementContext = t, this._logger = t.root.createLogger(this.fn.name), this._emitter.on("error", (n, r, ...i) => {
1089
+ console.log({ error: n, eventName: r, args: i }), this._logger.crash(n);
1090
+ });
1091
+ const e = new fe(this);
1092
+ try {
1093
+ this.value = this.fn.call(e, this._options, e);
1094
+ } catch (n) {
1095
+ this._logger.crash(n);
1096
+ }
1097
+ return t.stores.set(this.fn, this), !0;
1098
+ }
1099
+ handleMount() {
1100
+ this.isMounted = !0, this._emitter.emit("mounted");
1101
+ }
1102
+ handleUnmount() {
1103
+ this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
1104
+ }
1105
+ }
1106
+ class pt extends Error {
1133
1107
  }
1134
- class ge {
1108
+ class pe {
1135
1109
  constructor(t) {
1136
1110
  o(this, "__view");
1137
1111
  this.__view = t;
@@ -1174,7 +1148,7 @@ class ge {
1174
1148
  // }
1175
1149
  on(t, e) {
1176
1150
  if (t === "*") {
1177
- const n = (s, i) => {
1151
+ const n = (r, i) => {
1178
1152
  e(i);
1179
1153
  };
1180
1154
  this.__view._elementContext.emitter.on(t, n), this.__view._wildcardListeners.set(e, n);
@@ -1190,7 +1164,7 @@ class ge {
1190
1164
  }
1191
1165
  once(t, e) {
1192
1166
  if (t === "*") {
1193
- const n = (s, i) => {
1167
+ const n = (r, i) => {
1194
1168
  this.__view._wildcardListeners.delete(e), e(i);
1195
1169
  };
1196
1170
  this.__view._elementContext.emitter.once(t, n), this.__view._wildcardListeners.set(e, n);
@@ -1198,32 +1172,31 @@ class ge {
1198
1172
  this.__view._elementContext.emitter.once(t, e);
1199
1173
  }
1200
1174
  emit(t, e) {
1201
- return this.__view._elementContext.emitter.emit(t, new tt(t, e));
1175
+ return this.__view._elementContext.emitter.emit(t, new J(t, e));
1202
1176
  }
1203
- attachStore(t) {
1204
- if (t.attach(this.__view._elementContext))
1177
+ attachStore(t, e) {
1178
+ const n = new de(t, e);
1179
+ if (n.attach(this.__view._elementContext))
1205
1180
  this.__view._emitter.on("mounted", () => {
1206
- t.handleMount();
1181
+ n.handleMount();
1207
1182
  }), this.__view._emitter.on("unmounted", () => {
1208
- t.handleUnmount();
1183
+ n.handleUnmount();
1209
1184
  });
1210
1185
  else {
1211
- let n = t.name ? `'${t.name}'` : "this store";
1212
- this.__view._logger.warn(`An instance of ${n} was already attached to this context.`);
1186
+ let i = t.name ? `'${t.name}'` : "this store";
1187
+ this.__view._logger.warn(`An instance of ${i} was already attached to this context.`);
1213
1188
  }
1214
1189
  }
1215
1190
  useStore(t) {
1216
- if (he(t)) {
1217
- const e = t.key;
1218
- let n = this.__view._elementContext, s;
1219
- for (; s = n.stores.get(e), s == null && n.parent != null; )
1220
- n = n.parent;
1221
- if (s == null)
1222
- throw new H("Store not found on this context.");
1223
- return s.value;
1224
- } else throw le(t) ? new H(
1225
- "Received a Store instance. Please pass the Store factory function to useStore without calling it."
1226
- ) : new H("Invalid store.");
1191
+ if (V(t)) {
1192
+ let e = this.__view._elementContext, n;
1193
+ for (; n = e.stores.get(t), n == null && e.parent != null; )
1194
+ e = e.parent;
1195
+ if (n == null)
1196
+ throw new pt("Store not found on this context.");
1197
+ return n.value;
1198
+ } else
1199
+ throw new pt("Invalid store.");
1227
1200
  }
1228
1201
  beforeMount(t) {
1229
1202
  this.__view._emitter.on("beforeMount", t);
@@ -1242,24 +1215,24 @@ class ge {
1242
1215
  if (n.isMounted)
1243
1216
  return n._watcher.watch(t, e);
1244
1217
  {
1245
- let s, i = !1;
1218
+ let r, i = !1;
1246
1219
  return n._emitter.on("mounted", () => {
1247
- i || (s = n._watcher.watch(t, e));
1220
+ i || (r = n._watcher.watch(t, e));
1248
1221
  }), () => {
1249
- s != null && (i = !0, s());
1222
+ r != null && (i = !0, r());
1250
1223
  };
1251
1224
  }
1252
1225
  }
1253
1226
  outlet() {
1254
- return C("$outlet", { $children: this.__view._$children });
1227
+ return S("$outlet", { $children: this.__view._$children });
1255
1228
  }
1256
1229
  }
1257
- var vt;
1258
- vt = M;
1259
- const nt = class nt {
1260
- constructor(t, e, n, s = []) {
1261
- o(this, vt, !0);
1262
- o(this, "uniqueId", J());
1230
+ var St;
1231
+ St = M;
1232
+ const tt = class tt {
1233
+ constructor(t, e, n, r = []) {
1234
+ o(this, St, !0);
1235
+ o(this, "uniqueId", kt());
1263
1236
  o(this, "_elementContext");
1264
1237
  o(this, "_logger");
1265
1238
  o(this, "_view");
@@ -1269,7 +1242,7 @@ const nt = class nt {
1269
1242
  o(this, "_$children");
1270
1243
  o(this, "_setChildren");
1271
1244
  o(this, "_watcher", D());
1272
- o(this, "_emitter", new q());
1245
+ o(this, "_emitter", new I());
1273
1246
  o(this, "_wildcardListeners", /* @__PURE__ */ new Map());
1274
1247
  o(this, "isMounted", !1);
1275
1248
  this._elementContext = {
@@ -1277,13 +1250,13 @@ const nt = class nt {
1277
1250
  data: {},
1278
1251
  parent: t,
1279
1252
  viewName: e.name,
1280
- emitter: new q(),
1253
+ emitter: new I(),
1281
1254
  stores: /* @__PURE__ */ new Map()
1282
- }, this._logger = t.root.createLogger(e.name || "🌇 anonymous view", { uid: this.uniqueId }), this._view = e, this._props = n, this._childMarkup = s, [this._$children, this._setChildren] = Y([]), this._emitter.on("error", (i, u, ...c) => {
1255
+ }, this._logger = t.root.createLogger(e.name || "🌇 anonymous view", { uid: this.uniqueId }), this._view = e, this._props = n, this._childMarkup = r, [this._$children, this._setChildren] = H([]), this._emitter.on("error", (i, u, ...c) => {
1283
1256
  this._logger.error({ error: i, eventName: u, args: c }), this._logger.crash(i);
1284
1257
  }), this._elementContext.emitter.on("*", (i, u) => {
1285
1258
  var c;
1286
- u instanceof tt && (u.propagationStopped || (c = this._elementContext.parent) == null || c.emitter.emit(i, u));
1259
+ u instanceof J && (u.propagationStopped || (c = this._elementContext.parent) == null || c.emitter.emit(i, u));
1287
1260
  });
1288
1261
  }
1289
1262
  /*===============================*\
@@ -1295,51 +1268,51 @@ const nt = class nt {
1295
1268
  }
1296
1269
  mount(t, e) {
1297
1270
  const n = this.isMounted;
1298
- n || (this._initialize(), this._emitter.emit("beforeMount")), this._element && this._element.mount(t, e), n || (this.isMounted = !0, te(), requestAnimationFrame(() => {
1271
+ n || (this._initialize(), this._emitter.emit("beforeMount")), this._element && this._element.mount(t, e), n || (this.isMounted = !0, Qt(), requestAnimationFrame(() => {
1299
1272
  this._emitter.emit("mounted");
1300
1273
  }));
1301
1274
  }
1302
1275
  unmount(t = !1) {
1303
- this._emitter.emit("beforeUnmount"), this._element && this._element.unmount(t), this.isMounted && ee(), this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
1276
+ this._emitter.emit("beforeUnmount"), this._element && this._element.unmount(t), this.isMounted && te(), this.isMounted = !1, this._emitter.emit("unmounted"), this._emitter.clear(), this._watcher.stopAll();
1304
1277
  }
1305
1278
  setChildView(t) {
1306
1279
  this._childMarkup = [];
1307
- const e = new nt(this._elementContext, t, {});
1280
+ const e = new tt(this._elementContext, t, {});
1308
1281
  return this._setChildren([e]), e;
1309
1282
  }
1310
1283
  /*===============================*\
1311
1284
  || Internal ||
1312
1285
  \*===============================*/
1313
1286
  _initialize() {
1314
- const t = new ge(this);
1287
+ const t = new pe(this);
1315
1288
  let e;
1316
1289
  try {
1317
- e = this._view.call(t, this._props, t), this._childMarkup.length && this._setChildren(k(this._elementContext, this._childMarkup));
1290
+ e = this._view.call(t, this._props, t), this._childMarkup.length && this._setChildren(b(this._elementContext, this._childMarkup));
1318
1291
  } catch (n) {
1319
1292
  throw n instanceof Error && this._logger.crash(n), n;
1320
1293
  }
1321
1294
  if (e !== null) if (e instanceof Node)
1322
- this._element = F(k(this._elementContext, C("$node", { value: e })));
1323
- else if (R(e) || bt(R, e))
1324
- this._element = F(k(this._elementContext, e));
1295
+ this._element = F(b(this._elementContext, S("$node", { value: e })));
1296
+ else if (U(e) || bt(U, e))
1297
+ this._element = F(b(this._elementContext, e));
1325
1298
  else if (m(e))
1326
1299
  this._element = F(
1327
- k(this._elementContext, C("$observer", { sources: [e], renderFn: (n) => n }))
1300
+ b(this._elementContext, S("$observer", { sources: [e], renderFn: (n) => n }))
1328
1301
  );
1329
1302
  else {
1330
1303
  const n = new TypeError(
1331
- `Expected '${this._view.name}' function to return a DOM node, Markup element, Readable or null. Got: ${V(e)}`
1304
+ `Expected '${this._view.name}' function to return a DOM node, Markup element, Readable or null. Got: ${$(e)}`
1332
1305
  );
1333
1306
  this._logger.crash(n);
1334
1307
  }
1335
1308
  }
1336
1309
  };
1337
- let j = nt;
1338
- var xt;
1339
- xt = M;
1340
- class ye {
1341
- constructor({ elementContext: t, $items: e, renderFn: n, keyFn: s }) {
1342
- o(this, xt, !0);
1310
+ let j = tt;
1311
+ var Ct;
1312
+ Ct = M;
1313
+ class me {
1314
+ constructor({ elementContext: t, $items: e, renderFn: n, keyFn: r }) {
1315
+ o(this, Ct, !0);
1343
1316
  o(this, "node", document.createTextNode(""));
1344
1317
  o(this, "$items");
1345
1318
  o(this, "stopCallback");
@@ -1347,7 +1320,7 @@ class ye {
1347
1320
  o(this, "elementContext");
1348
1321
  o(this, "renderFn");
1349
1322
  o(this, "keyFn");
1350
- this.elementContext = t, this.$items = e, this.renderFn = n, this.keyFn = s;
1323
+ this.elementContext = t, this.$items = e, this.renderFn = n, this.keyFn = r;
1351
1324
  }
1352
1325
  get isMounted() {
1353
1326
  return this.node.parentNode != null;
@@ -1380,22 +1353,22 @@ class ye {
1380
1353
  value: a,
1381
1354
  index: n++
1382
1355
  });
1383
- const s = [];
1356
+ const r = [];
1384
1357
  for (const a of this.connectedItems)
1385
1358
  e.find((l) => l.key === a.key) || a.element.unmount(!1);
1386
1359
  for (const a of e) {
1387
1360
  const f = this.connectedItems.find((l) => l.key === a.key);
1388
1361
  if (f)
1389
- f.setValue(a.value), f.setIndex(a.index), s[a.index] = f;
1362
+ f.setValue(a.value), f.setIndex(a.index), r[a.index] = f;
1390
1363
  else {
1391
- const [l, d] = Y(a.value), [p, _] = Y(a.index);
1392
- s[a.index] = {
1364
+ const [l, d] = H(a.value), [p, _] = H(a.index);
1365
+ r[a.index] = {
1393
1366
  key: a.key,
1394
1367
  $value: l,
1395
1368
  setValue: d,
1396
1369
  $index: p,
1397
1370
  setIndex: _,
1398
- element: new j(this.elementContext, Se, {
1371
+ element: new j(this.elementContext, _e, {
1399
1372
  $value: l,
1400
1373
  $index: p,
1401
1374
  renderFn: this.renderFn
@@ -1403,161 +1376,158 @@ class ye {
1403
1376
  };
1404
1377
  }
1405
1378
  }
1406
- for (let a = 0; a < s.length; a++) {
1407
- const f = s[a], l = ((u = s[a - 1]) == null ? void 0 : u.element.node) ?? this.node;
1379
+ for (let a = 0; a < r.length; a++) {
1380
+ const f = r[a], l = ((u = r[a - 1]) == null ? void 0 : u.element.node) ?? this.node;
1408
1381
  f.element.mount(this.node.parentNode, l);
1409
1382
  }
1410
- this.connectedItems = s;
1411
- const i = ((c = s.at(-1)) == null ? void 0 : c.element.node) ?? this.node;
1383
+ this.connectedItems = r;
1384
+ const i = ((c = r.at(-1)) == null ? void 0 : c.element.node) ?? this.node;
1412
1385
  (h = this.node.parentNode) == null || h.insertBefore(this.node, i.nextSibling);
1413
1386
  }
1414
1387
  }
1415
- function Se({ $value: r, $index: t, renderFn: e }, n) {
1416
- return n.setName("@RepeatItem"), e.call(n, r, t, n);
1388
+ function _e({ $value: s, $index: t, renderFn: e }, n) {
1389
+ return n.setName("@RepeatItem"), e.call(n, s, t, n);
1417
1390
  }
1418
- function R(r) {
1419
- return (r == null ? void 0 : r[Lt]) === !0;
1391
+ function U(s) {
1392
+ return (s == null ? void 0 : s[Lt]) === !0;
1420
1393
  }
1421
- function Ft(r) {
1422
- return (r == null ? void 0 : r[M]) === !0;
1394
+ function Tt(s) {
1395
+ return (s == null ? void 0 : s[M]) === !0;
1423
1396
  }
1424
- function et(r) {
1425
- return A(r) || (r = [r]), r.flat(1 / 0).filter((t) => t != null && t !== !1).map((t) => R(t) ? t : t instanceof Node ? C("$node", { value: t }) : m(t) ? C("$observer", {
1397
+ function Q(s) {
1398
+ return A(s) || (s = [s]), s.flat(1 / 0).filter((t) => t != null && t !== !1).map((t) => U(t) ? t : t instanceof Node ? S("$node", { value: t }) : m(t) ? S("$observer", {
1426
1399
  sources: [t],
1427
1400
  renderFn: (e) => e
1428
- }) : C("$text", { value: t }));
1401
+ }) : S("$text", { value: t }));
1429
1402
  }
1430
- function C(r, t, ...e) {
1431
- return new Ce(r, t, ...e);
1403
+ function S(s, t, ...e) {
1404
+ return new we(s, t, ...e);
1432
1405
  }
1433
- var Mt;
1434
- Mt = Lt;
1435
- class Ce {
1406
+ var xt;
1407
+ xt = Lt;
1408
+ class we {
1436
1409
  constructor(t, e, ...n) {
1437
- o(this, Mt, !0);
1410
+ o(this, xt, !0);
1438
1411
  o(this, "type");
1439
1412
  o(this, "props");
1440
1413
  o(this, "children");
1441
- this.type = t, this.props = e, this.children = et(n);
1414
+ this.type = t, this.props = e, this.children = Q(n);
1442
1415
  }
1443
1416
  }
1444
- const Ie = fe.bind(C);
1445
- function qe(r, t, e) {
1446
- return C("$observer", {
1447
- sources: [r],
1417
+ const Le = oe.bind(S);
1418
+ function Ne(s, t, e) {
1419
+ return S("$observer", {
1420
+ sources: [s],
1448
1421
  renderFn: (n) => n && t ? t : !n && e ? e : null
1449
1422
  });
1450
1423
  }
1451
- function je(r, t, e) {
1452
- const n = X(r);
1453
- return C("$repeat", { $items: n, keyFn: t, renderFn: e });
1424
+ function We(s, t, e) {
1425
+ const n = Y(s);
1426
+ return S("$repeat", { $items: n, keyFn: t, renderFn: e });
1454
1427
  }
1455
- function Re(r, t) {
1456
- return C("$portal", { parent: r, content: t });
1428
+ function Pe(s, t) {
1429
+ return S("$portal", { parent: s, content: t });
1457
1430
  }
1458
- function k(r, t) {
1431
+ function b(s, t) {
1459
1432
  return (A(t) ? t : [t]).map((n) => {
1460
- if (I(n.type))
1461
- return new j(r, n.type, n.props, n.children);
1462
- if (b(n.type))
1433
+ if (V(n.type))
1434
+ return new j(s, n.type, n.props, n.children);
1435
+ if (k(n.type))
1463
1436
  switch (n.type) {
1464
1437
  case "$node": {
1465
- const s = n.props;
1466
- return new pt(s.value);
1438
+ const r = n.props;
1439
+ return new ft(r.value);
1467
1440
  }
1468
1441
  case "$text": {
1469
- const s = n.props;
1470
- return new pt(document.createTextNode(String(s.value)));
1442
+ const r = n.props;
1443
+ return new ft(document.createTextNode(String(r.value)));
1471
1444
  }
1472
1445
  case "$repeat": {
1473
- const s = n.props;
1474
- return new ye({
1475
- $items: s.$items,
1476
- keyFn: s.keyFn,
1477
- renderFn: s.renderFn,
1478
- elementContext: r
1446
+ const r = n.props;
1447
+ return new me({
1448
+ $items: r.$items,
1449
+ keyFn: r.keyFn,
1450
+ renderFn: r.renderFn,
1451
+ elementContext: s
1479
1452
  });
1480
1453
  }
1481
1454
  case "$observer": {
1482
- const s = n.props;
1483
- return new _e({
1484
- sources: s.sources,
1485
- renderFn: s.renderFn,
1486
- elementContext: r
1455
+ const r = n.props;
1456
+ return new he({
1457
+ sources: r.sources,
1458
+ renderFn: r.renderFn,
1459
+ elementContext: s
1487
1460
  });
1488
1461
  }
1489
1462
  case "$outlet": {
1490
- const s = n.props;
1491
- return new Pt(s.$children);
1463
+ const r = n.props;
1464
+ return new Pt(r.$children);
1492
1465
  }
1493
1466
  case "$portal": {
1494
- const s = n.props;
1495
- return new we({
1496
- content: s.content,
1497
- parent: s.parent,
1498
- elementContext: r
1467
+ const r = n.props;
1468
+ return new le({
1469
+ content: r.content,
1470
+ parent: r.parent,
1471
+ elementContext: s
1499
1472
  });
1500
1473
  }
1501
1474
  default:
1502
1475
  if (n.type.startsWith("$"))
1503
1476
  throw new Error(`Unknown markup type: ${n.type}`);
1504
- return new pe({
1477
+ return new ce({
1505
1478
  tag: n.type,
1506
1479
  props: n.props ?? {},
1507
1480
  children: n.children,
1508
- elementContext: r
1481
+ elementContext: s
1509
1482
  });
1510
1483
  }
1511
1484
  else
1512
1485
  throw new TypeError(`Expected a string or view function. Got: ${n.type}`);
1513
1486
  });
1514
1487
  }
1515
- function F(r) {
1516
- return r.length === 1 ? r[0] : new Pt(r);
1488
+ function F(s) {
1489
+ return s.length === 1 ? s[0] : new Pt(s);
1517
1490
  }
1518
- function It(r) {
1519
- return r == null || r === !1 || b(r) || Gt(r) || R(r) || m(r) || bt(It, r);
1491
+ function qt(s) {
1492
+ return s == null || s === !1 || k(s) || zt(s) || U(s) || m(s) || bt(qt, s);
1520
1493
  }
1521
1494
  export {
1522
- Zt as A,
1523
- Oe as B,
1524
- tt as C,
1525
- F as D,
1526
- k as E,
1527
- Te as F,
1528
- Et as G,
1529
- Re as H,
1530
- Le as I,
1531
- je as J,
1532
- Fe as K,
1533
- Pe as P,
1534
- $e as S,
1495
+ F as A,
1496
+ b as B,
1497
+ J as C,
1498
+ de as D,
1499
+ Et as E,
1500
+ Pe as F,
1501
+ We as G,
1502
+ Ae as I,
1503
+ $e as P,
1504
+ Ee as S,
1535
1505
  j as V,
1536
- Me as a,
1537
- xe as b,
1538
- be as c,
1539
- Y as d,
1540
- oe as e,
1541
- b as f,
1506
+ ve as a,
1507
+ ye as b,
1508
+ Ce as c,
1509
+ H as d,
1510
+ re as e,
1511
+ k as f,
1542
1512
  Z as g,
1543
- Ae as h,
1544
- I as i,
1545
- Ie as j,
1546
- qe as k,
1513
+ Me as h,
1514
+ V as i,
1515
+ Le as j,
1516
+ Ne as k,
1547
1517
  D as l,
1548
- Ve as m,
1549
- X as n,
1550
- re as o,
1551
- q as p,
1518
+ ke as m,
1519
+ Y as n,
1520
+ ee as o,
1521
+ I as p,
1552
1522
  m as q,
1553
- Ne as r,
1554
- Ee as s,
1555
- V as t,
1556
- ue as u,
1557
- he as v,
1558
- H as w,
1559
- le as x,
1560
- ke as y,
1561
- C as z
1523
+ Oe as r,
1524
+ xe as s,
1525
+ $ as t,
1526
+ ie as u,
1527
+ pt as v,
1528
+ Se as w,
1529
+ S as x,
1530
+ Zt as y,
1531
+ be as z
1562
1532
  };
1563
- //# sourceMappingURL=markup-D1i09ddt.js.map
1533
+ //# sourceMappingURL=markup-C-1VlVZi.js.map