@tempots/dom 23.0.2 → 24.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,65 +1,65 @@
1
- var Me = Object.defineProperty;
2
- var x = (t) => {
3
- throw TypeError(t);
1
+ var De = Object.defineProperty;
2
+ var X = (s) => {
3
+ throw TypeError(s);
4
4
  };
5
- var $e = (t, e, r) => e in t ? Me(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
6
- var u = (t, e, r) => $e(t, typeof e != "symbol" ? e + "" : e, r), ee = (t, e, r) => e.has(t) || x("Cannot " + r);
7
- var D = (t, e, r) => (ee(t, e, "read from private field"), r ? r.call(t) : e.get(t)), te = (t, e, r) => e.has(t) ? x("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), J = (t, e, r, s) => (ee(t, e, "write to private field"), s ? s.call(t, r) : e.set(t, r), r);
8
- const Fe = (t, e, r) => t + (e - t) * r;
9
- const Ve = (t, e, r) => {
10
- const s = Math.max(t.length, e.length);
5
+ var Oe = (s, e, t) => e in s ? De(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
6
+ var i = (s, e, t) => Oe(s, typeof e != "symbol" ? e + "" : e, t), Y = (s, e, t) => e.has(s) || X("Cannot " + t);
7
+ var A = (s, e, t) => (Y(s, e, "read from private field"), t ? t.call(s) : e.get(s)), Z = (s, e, t) => e.has(s) ? X("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), F = (s, e, t, r) => (Y(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
8
+ const Ae = (s, e, t) => s + (e - s) * t;
9
+ const Me = (s, e, t) => {
10
+ const r = Math.max(s.length, e.length);
11
11
  let n = "";
12
- for (let o = 0; o < s; o++) {
13
- let i = t.charCodeAt(o);
14
- isNaN(i) && (i = 97);
15
- let l = e.charCodeAt(o);
16
- isNaN(l) && (l = 97), n += String.fromCharCode(i + (l - i) * r);
12
+ for (let o = 0; o < r; o++) {
13
+ let l = s.charCodeAt(o);
14
+ isNaN(l) && (l = 97);
15
+ let c = e.charCodeAt(o);
16
+ isNaN(c) && (c = 97), n += String.fromCharCode(l + (c - l) * t);
17
17
  }
18
18
  return n;
19
- }, qe = (t, e, r) => new Date(t.getTime() + (e.getTime() - t.getTime()) * r), Ie = (t, e) => e, Be = (t) => typeof t == "number" ? Fe : typeof t == "string" ? Ve : t instanceof Date ? qe : Ie;
20
- var v;
21
- class T {
19
+ }, ke = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), Le = (s, e) => e, $e = (s) => typeof s == "number" ? Ae : typeof s == "string" ? Me : s instanceof Date ? ke : Le;
20
+ var w;
21
+ class M {
22
22
  /**
23
23
  * Creates a new instance of `ElementPosition`.
24
24
  * @param index - The index of the element.
25
25
  * @param total - The total number of elements in the collection.
26
26
  */
27
- constructor(e, r) {
27
+ constructor(e, t) {
28
28
  /**
29
29
  * The counter of the element starting from 1.
30
30
  */
31
- u(this, "counter");
31
+ i(this, "counter");
32
32
  /**
33
33
  * Checks if the element is the first element in the collection.
34
34
  * @returns `true` if the element is the first element, `false` otherwise.
35
35
  */
36
- u(this, "isFirst");
36
+ i(this, "isFirst");
37
37
  /**
38
38
  * Checks if the counter of the element is even.
39
39
  * @returns `true` if the counter is even, `false` otherwise.
40
40
  */
41
- u(this, "isEven");
41
+ i(this, "isEven");
42
42
  /**
43
43
  * Checks if the counter of the element is odd.
44
44
  * @returns `true` if the counter is odd, `false` otherwise.
45
45
  */
46
- u(this, "isOdd");
47
- te(this, v);
48
- u(this, "dispose", () => {
49
- D(this, v) != null && (D(this, v).dispose(), J(this, v, void 0));
46
+ i(this, "isOdd");
47
+ Z(this, w);
48
+ i(this, "dispose", () => {
49
+ A(this, w) != null && (A(this, w).dispose(), F(this, w, void 0));
50
50
  });
51
- this.index = e, this.total = r, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
51
+ this.index = e, this.total = t, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
52
52
  }
53
53
  /**
54
54
  * Checks if the element is the last element in the collection.
55
55
  * @returns `true` if the element is the last element, `false` otherwise.
56
56
  */
57
57
  get isLast() {
58
- return D(this, v) == null && J(this, v, this.total.map((e) => this.counter === e)), D(this, v);
58
+ return A(this, w) == null && F(this, w, this.total.map((e) => this.counter === e)), A(this, w);
59
59
  }
60
60
  }
61
- v = new WeakMap();
62
- const C = class C {
61
+ w = new WeakMap();
62
+ const k = class k {
63
63
  /**
64
64
  * Represents a signal with a value of type T.
65
65
  *
@@ -67,37 +67,37 @@ const C = class C {
67
67
  * @param equals - A function that determines whether two values of type T are equal.
68
68
  * @public
69
69
  */
70
- constructor(e, r) {
70
+ constructor(e, t) {
71
71
  /**
72
72
  * @internal
73
73
  */
74
- u(this, "$__signal__", !0);
74
+ i(this, "$__signal__", !0);
75
75
  /**
76
76
  * @internal
77
77
  */
78
- u(this, "_value");
78
+ i(this, "_value");
79
79
  /**
80
80
  * @internal
81
81
  */
82
- u(this, "_derivatives", []);
82
+ i(this, "_derivatives", []);
83
83
  /**
84
84
  * @internal
85
85
  */
86
- u(this, "_onValueListeners", []);
86
+ i(this, "_onValueListeners", []);
87
87
  /**
88
88
  * @internal
89
89
  */
90
- u(this, "_onDisposeListeners", []);
90
+ i(this, "_onDisposeListeners", []);
91
91
  /**
92
92
  * Gets the current value of the signal.
93
93
  * @returns The current value of the signal.
94
94
  */
95
- u(this, "get", () => this._value);
95
+ i(this, "get", () => this._value);
96
96
  /**
97
97
  * Checks if the signal has any registered listeners.
98
98
  * @returns `true` if the signal has listeners, `false` otherwise.
99
99
  */
100
- u(this, "hasListeners", () => this._onValueListeners.length > 0);
100
+ i(this, "hasListeners", () => this._onValueListeners.length > 0);
101
101
  /**
102
102
  * Registers a listener function to be called whenever the value of the signal changes.
103
103
  * The listener function will be immediately called with the current value of the signal.
@@ -105,37 +105,37 @@ const C = class C {
105
105
  *
106
106
  * @param listener - The listener function to be called when the value of the signal changes.
107
107
  */
108
- u(this, "on", (e) => (e(this.get()), this._onValueListeners.push(e), () => {
108
+ i(this, "on", (e) => (e(this.get()), this._onValueListeners.push(e), () => {
109
109
  this._onValueListeners.splice(this._onValueListeners.indexOf(e), 1);
110
110
  }));
111
111
  /**
112
112
  * @internal
113
113
  */
114
- u(this, "_setAndNotify", (e, r) => {
115
- const s = this.equals(this._value, e);
116
- s || (this._value = e), (r || !s) && this._onValueListeners.forEach((n) => n(e));
114
+ i(this, "_setAndNotify", (e, t) => {
115
+ const r = this.equals(this._value, e);
116
+ r || (this._value = e), (t || !r) && this._onValueListeners.forEach((n) => n(e));
117
117
  });
118
118
  /**
119
119
  * @internal
120
120
  */
121
- u(this, "_disposed", !1);
121
+ i(this, "_disposed", !1);
122
122
  /**
123
123
  * Checks whether the signal is disposed.
124
124
  * @returns True if the signal is disposed, false otherwise.
125
125
  */
126
- u(this, "isDisposed", () => this._disposed);
126
+ i(this, "isDisposed", () => this._disposed);
127
127
  /**
128
128
  * Adds a listener function to be called when the object is disposed.
129
129
  * @param listener - The listener function to be called when the object is disposed.
130
130
  * @returns A function that can be called to remove the listener.
131
131
  */
132
- u(this, "onDispose", (e) => {
132
+ i(this, "onDispose", (e) => {
133
133
  this._onDisposeListeners.push(e);
134
134
  });
135
135
  /**
136
136
  * Disposes the signal, releasing any resources associated with it.
137
137
  */
138
- u(this, "dispose", () => {
138
+ i(this, "dispose", () => {
139
139
  this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
140
140
  });
141
141
  /**
@@ -147,15 +147,15 @@ const C = class C {
147
147
  * @param equals - Optional equality function to determine if two mapped values are equal.
148
148
  * @returns - A new Computed instance with the mapped value.
149
149
  */
150
- u(this, "map", (e, r = (s, n) => s === n) => {
151
- const s = new E(() => {
150
+ i(this, "map", (e, t = (r, n) => r === n) => {
151
+ const r = new T(() => {
152
152
  try {
153
153
  return e(this.get());
154
154
  } catch (n) {
155
155
  throw console.error("Error in Signal.map:", n), n;
156
156
  }
157
- }, r);
158
- return this.setDerivative(s), s;
157
+ }, t);
158
+ return this.setDerivative(r), r;
159
159
  });
160
160
  /**
161
161
  * Returns a new Signal that applies the given function to the value of the current Signal,
@@ -167,15 +167,15 @@ const C = class C {
167
167
  * Defaults to a strict equality check (===).
168
168
  * @returns A new Signal that emits the values of the resulting Signal.
169
169
  */
170
- u(this, "flatMap", (e, r = (s, n) => s === n) => {
171
- const s = new E(() => {
170
+ i(this, "flatMap", (e, t = (r, n) => r === n) => {
171
+ const r = new T(() => {
172
172
  try {
173
173
  return e(this.get()).get();
174
174
  } catch (n) {
175
175
  throw console.error("Error in Signal.flatMap:", n), n;
176
176
  }
177
- }, r);
178
- return this.setDerivative(s), s;
177
+ }, t);
178
+ return this.setDerivative(r), r;
179
179
  });
180
180
  /**
181
181
  * Invokes a callback function with the current value of the signal, without modifying the signal.
@@ -183,24 +183,24 @@ const C = class C {
183
183
  * @param fn - The callback function to be invoked with the current value of the signal.
184
184
  * @returns A new signal that emits the same value as the original signal and invokes the callback function.
185
185
  */
186
- u(this, "tap", (e) => this.map((r) => (e(r), r)));
186
+ i(this, "tap", (e) => this.map((t) => (e(t), t)));
187
187
  /**
188
188
  * Returns a new Signal that emits the value at the specified key of the current value.
189
189
  *
190
190
  * @param key - The key of the value to retrieve.
191
191
  * @returns A new Signal that emits the value at the specified key.
192
192
  */
193
- u(this, "at", (e) => this.map((r) => r[e]));
193
+ i(this, "at", (e) => this.map((t) => t[e]));
194
194
  /**
195
195
  * @internal
196
196
  */
197
- u(this, "_$");
198
- u(this, "filter", (e, r) => {
199
- let s = r ?? this.get();
200
- const n = new E(() => {
197
+ i(this, "_$");
198
+ i(this, "filter", (e, t) => {
199
+ let r = t ?? this.get();
200
+ const n = new T(() => {
201
201
  try {
202
202
  const o = this.get();
203
- return s = e(o) ? o : s;
203
+ return r = e(o) ? o : r;
204
204
  } catch (o) {
205
205
  throw console.error("Error in Signal.filter:", o), o;
206
206
  }
@@ -217,16 +217,16 @@ const C = class C {
217
217
  * @param equals - Optional equality function to determine if two values are equal.
218
218
  * @returns - A new Computed object with the mapped and filtered values.
219
219
  */
220
- u(this, "filterMap", (e, r, s = (n, o) => n === o) => {
221
- let n = r;
222
- const o = new E(() => {
220
+ i(this, "filterMap", (e, t, r = (n, o) => n === o) => {
221
+ let n = t;
222
+ const o = new T(() => {
223
223
  try {
224
- const i = this.get(), l = e(i);
225
- return n = l ?? n;
226
- } catch (i) {
227
- throw console.error("Error in Signal.filterMap:", i), i;
224
+ const l = this.get(), c = e(l);
225
+ return n = c ?? n;
226
+ } catch (l) {
227
+ throw console.error("Error in Signal.filterMap:", l), l;
228
228
  }
229
- }, s);
229
+ }, r);
230
230
  return this.setDerivative(o), o;
231
231
  });
232
232
  /**
@@ -242,22 +242,22 @@ const C = class C {
242
242
  * @param equals - The equality function to compare the mapped values for equality.
243
243
  * @returns A property that holds the mapped value and can be observed for changes.
244
244
  */
245
- u(this, "mapAsync", (e, r, s, n = (o, i) => o === i) => {
246
- const o = V(r, n);
247
- let i = 0, l = new AbortController();
245
+ i(this, "mapAsync", (e, t, r, n = (o, l) => o === l) => {
246
+ const o = L(t, n);
247
+ let l = 0, c = new AbortController();
248
248
  return o.onDispose(
249
249
  this.on(async (a) => {
250
- const f = ++i;
251
- l.abort(), l = new AbortController();
250
+ const f = ++l;
251
+ c.abort(), c = new AbortController();
252
252
  try {
253
- const g = await e(a, { abortSignal: l.signal });
254
- f === i && o.set(g);
255
- } catch (g) {
256
- if (f === i)
257
- if (s != null)
258
- o.set(s(g));
253
+ const h = await e(a, { abortSignal: c.signal });
254
+ f === l && o.set(h);
255
+ } catch (h) {
256
+ if (f === l)
257
+ if (r != null)
258
+ o.set(r(h));
259
259
  else
260
- throw g;
260
+ throw h;
261
261
  }
262
262
  })
263
263
  ), o;
@@ -272,28 +272,28 @@ const C = class C {
272
272
  * @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
273
273
  * @returns A new signal containing the mapped values.
274
274
  */
275
- u(this, "mapMaybe", (e, r) => this.map((s) => e(s) ?? r));
275
+ i(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
276
276
  /**
277
277
  * Feeds a property into the signal and sets up disposal behavior.
278
278
  * @param prop - The property to feed into the signal.
279
279
  * @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
280
280
  * @returns The input property.
281
281
  */
282
- u(this, "feedProp", (e, r = !1) => {
283
- const s = this.on(e.set);
284
- return e.onDispose(s), r ? this.onDispose(e.dispose) : this.onDispose(s), e;
282
+ i(this, "feedProp", (e, t = !1) => {
283
+ const r = this.on(e.set);
284
+ return e.onDispose(r), t ? this.onDispose(e.dispose) : this.onDispose(r), e;
285
285
  });
286
286
  /**
287
287
  * Derives a new property from the current signal.
288
288
  * @param autoDisposeProp - Determines whether the derived property should be automatically disposed.
289
289
  * @returns The derived property.
290
290
  */
291
- u(this, "deriveProp", (e = !0) => this.feedProp(V(this.get()), e));
291
+ i(this, "deriveProp", (e = !0) => this.feedProp(L(this.get()), e));
292
292
  /**
293
293
  * Returns a signal that emits the count of values received so far.
294
294
  * @returns A signal that emits the count of values received so far.
295
295
  */
296
- u(this, "count", () => {
296
+ i(this, "count", () => {
297
297
  let e = 0;
298
298
  return this.map(() => ++e);
299
299
  });
@@ -303,7 +303,7 @@ const C = class C {
303
303
  * Additionally, when the computed value is disposed, it sets the signal as dirty.
304
304
  * @param computed - The computed value to add as a derivative.
305
305
  */
306
- u(this, "setDerivative", (e) => {
306
+ i(this, "setDerivative", (e) => {
307
307
  this._derivatives.push(e), e.onDispose(() => {
308
308
  this._derivatives.splice(
309
309
  this._derivatives.indexOf(e),
@@ -311,7 +311,7 @@ const C = class C {
311
311
  );
312
312
  }), e.onDispose(this.on(e.setDirty)), this.onDispose(e.dispose);
313
313
  });
314
- this.equals = r, this._value = e;
314
+ this.equals = t, this._value = e;
315
315
  }
316
316
  /**
317
317
  * Gets the value of the signal.
@@ -326,7 +326,7 @@ const C = class C {
326
326
  */
327
327
  get $() {
328
328
  return this._$ !== void 0 ? this._$ : this._$ = new Proxy(this, {
329
- get: (e, r) => this.at(r)
329
+ get: (e, t) => this.at(t)
330
330
  });
331
331
  }
332
332
  };
@@ -340,12 +340,12 @@ const C = class C {
340
340
  * @param equals - A function to compare two values of type O for equality. Defaults to strict equality (===).
341
341
  * @returns - A Signal that represents the result of the Promise.
342
342
  */
343
- u(C, "ofPromise", (e, r, s, n = (o, i) => o === i) => {
344
- const o = new C(r, n);
345
- return e.then((i) => o._setAndNotify(i, !1)).catch((i) => {
346
- s != null ? o._setAndNotify(s(i), !1) : console.error(
343
+ i(k, "ofPromise", (e, t, r, n = (o, l) => o === l) => {
344
+ const o = new k(t, n);
345
+ return e.then((l) => o._setAndNotify(l, !1)).catch((l) => {
346
+ r != null ? o._setAndNotify(r(l), !1) : console.error(
347
347
  "Unhandled promise rejection in Signal.ofPromise:",
348
- i
348
+ l
349
349
  );
350
350
  }), o;
351
351
  }), /**
@@ -354,54 +354,54 @@ u(C, "ofPromise", (e, r, s, n = (o, i) => o === i) => {
354
354
  * @param value - The value to check.
355
355
  * @returns `true` if the value is a Signal, `false` otherwise.
356
356
  */
357
- u(C, "is", (e) => (
357
+ i(k, "is", (e) => (
358
358
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
359
359
  e != null && e.$__signal__ === !0
360
360
  ));
361
- let h = C;
362
- const je = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
363
- class E extends h {
361
+ let d = k;
362
+ const Ne = typeof queueMicrotask == "function" ? queueMicrotask : (s) => Promise.resolve().then(s);
363
+ class T extends d {
364
364
  /**
365
365
  * Represents a Signal object.
366
366
  * @param _fn - The function that returns the value of the signal.
367
367
  * @param equals - The function used to compare two values of type T for equality.
368
368
  */
369
- constructor(r, s) {
370
- super(void 0, s);
369
+ constructor(t, r) {
370
+ super(void 0, r);
371
371
  /**
372
372
  * @internal
373
373
  */
374
- u(this, "$__computed__", !0);
374
+ i(this, "$__computed__", !0);
375
375
  /**
376
376
  * @internal
377
377
  */
378
- u(this, "_isDirty", !1);
378
+ i(this, "_isDirty", !1);
379
379
  /**
380
380
  * Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
381
381
  * If the signal is already dirty or disposed, this method does nothing.
382
382
  * It also marks all dependent signals as dirty and schedules a notification to update their values.
383
383
  */
384
- u(this, "setDirty", () => {
385
- this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((r) => r.setDirty()), this._scheduleNotify());
384
+ i(this, "setDirty", () => {
385
+ this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((t) => t.setDirty()), this._scheduleNotify());
386
386
  });
387
387
  /**
388
388
  * @internal
389
389
  */
390
- u(this, "_scheduleCount", 0);
390
+ i(this, "_scheduleCount", 0);
391
391
  /**
392
392
  * Schedules a notification to be executed asynchronously.
393
393
  * If the signal is dirty, it will be updated and notified.
394
394
  * @internal
395
395
  */
396
- u(this, "_scheduleNotify", () => {
397
- const r = ++this._scheduleCount;
398
- je(() => {
399
- this._scheduleCount !== r || this._disposed !== !1 || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !1));
396
+ i(this, "_scheduleNotify", () => {
397
+ const t = ++this._scheduleCount;
398
+ Ne(() => {
399
+ this._scheduleCount !== t || this._disposed !== !1 || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !1));
400
400
  });
401
401
  });
402
402
  /** {@inheritDoc Signal.get} */
403
- u(this, "get", () => (this._isDirty && (this._isDirty = !1, this._value = this._fn(), this._setAndNotify(this._value, !0)), this._value));
404
- this._fn = r, this.setDirty();
403
+ i(this, "get", () => (this._isDirty && (this._isDirty = !1, this._value = this._fn(), this._setAndNotify(this._value, !0)), this._value));
404
+ this._fn = t, this.setDirty();
405
405
  }
406
406
  /**
407
407
  * Checks if a value is an instance of `Computed`.
@@ -409,35 +409,35 @@ class E extends h {
409
409
  * @param value - The value to check.
410
410
  * @returns `true` if the value is an instance of `Computed`, `false` otherwise.
411
411
  */
412
- static is(r) {
413
- return r != null && r.$__computed__ === !0;
412
+ static is(t) {
413
+ return t != null && t.$__computed__ === !0;
414
414
  }
415
415
  /** {@inheritDoc Signal.value} */
416
416
  get value() {
417
417
  return this.get();
418
418
  }
419
419
  }
420
- const q = class q extends h {
420
+ const V = class V extends d {
421
421
  constructor() {
422
422
  super(...arguments);
423
423
  /**
424
424
  * @internal
425
425
  */
426
- u(this, "$__prop__", !0);
426
+ i(this, "$__prop__", !0);
427
427
  /**
428
428
  * Changes the value of the property and notifies its listeners.
429
429
  *
430
430
  * @param value - The new value of the property.
431
431
  */
432
- u(this, "set", (r) => {
433
- this._setAndNotify(r, !1);
432
+ i(this, "set", (t) => {
433
+ this._setAndNotify(t, !1);
434
434
  });
435
435
  /**
436
436
  * Updates the value of the signal by applying the provided function to the current value.
437
437
  * @param fn - The function to apply to the current value.
438
438
  */
439
- u(this, "update", (r) => {
440
- this._setAndNotify(r(this.get()), !1);
439
+ i(this, "update", (t) => {
440
+ this._setAndNotify(t(this.get()), !1);
441
441
  });
442
442
  /**
443
443
  * Creates a reducer function that combines the provided reducer function and effects.
@@ -445,15 +445,15 @@ const q = class q extends h {
445
445
  * @param effects - An array of effects to be executed after the state is updated.
446
446
  * @returns A dispatch function that can be used to update the state and trigger the effects.
447
447
  */
448
- u(this, "reducer", (r, ...s) => {
448
+ i(this, "reducer", (t, ...r) => {
449
449
  const n = this;
450
- return function o(i) {
451
- const l = n.value;
452
- n.update((a) => r(a, i)), !n.equals(l, n.value) && s.forEach(
450
+ return function o(l) {
451
+ const c = n.value;
452
+ n.update((a) => t(a, l)), !n.equals(c, n.value) && r.forEach(
453
453
  (a) => a({
454
- previousState: l,
454
+ previousState: c,
455
455
  state: n.value,
456
- action: i,
456
+ action: l,
457
457
  dispatch: o
458
458
  })
459
459
  );
@@ -470,9 +470,9 @@ const q = class q extends h {
470
470
  * Defaults to a strict equality check (===).
471
471
  * @returns A Prop object representing the isomorphism.
472
472
  */
473
- u(this, "iso", (r, s, n = (o, i) => o === i) => {
474
- const o = new q(r(this.get()), n);
475
- return o.onDispose(this.on((i) => o.set(r(i)))), o.on((i) => this._setAndNotify(s(i), !1)), o;
473
+ i(this, "iso", (t, r, n = (o, l) => o === l) => {
474
+ const o = new V(t(this.get()), n);
475
+ return o.onDispose(this.on((l) => o.set(t(l)))), o.on((l) => this._setAndNotify(r(l), !1)), o;
476
476
  });
477
477
  /**
478
478
  * Returns a `Prop` that represents the value at the specified key of the current value.
@@ -480,9 +480,9 @@ const q = class q extends h {
480
480
  * @param key - The key of the value to access.
481
481
  * @returns A `Prop` that represents the value at the specified key.
482
482
  */
483
- u(this, "atProp", (r) => this.iso(
484
- (s) => s[r],
485
- (s) => ({ ...this.value, [r]: s })
483
+ i(this, "atProp", (t) => this.iso(
484
+ (r) => r[t],
485
+ (r) => ({ ...this.value, [t]: r })
486
486
  ));
487
487
  }
488
488
  /**
@@ -491,8 +491,8 @@ const q = class q extends h {
491
491
  get value() {
492
492
  return this.get();
493
493
  }
494
- set value(r) {
495
- this._setAndNotify(r, !1);
494
+ set value(t) {
495
+ this._setAndNotify(t, !1);
496
496
  }
497
497
  };
498
498
  /**
@@ -500,15 +500,15 @@ const q = class q extends h {
500
500
  * @param value - The value to check.
501
501
  * @returns `true` if the value is a Prop, `false` otherwise.
502
502
  */
503
- u(q, "is", (r) => (
503
+ i(V, "is", (t) => (
504
504
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
505
- r != null && r.$__prop__ === !0
505
+ t != null && t.$__prop__ === !0
506
506
  ));
507
- let F = q;
508
- const X = (t, e, r = (s, n) => s === n) => {
509
- const s = new E(t, r);
510
- return e.forEach((n) => n.setDerivative(s)), s;
511
- }, Ue = (t, e) => X(t, e).dispose, V = (t, e = (r, s) => r === s) => new F(t, e), I = (t, e = (r, s) => r === s) => new h(t, e), d = {
507
+ let I = V;
508
+ const G = (s, e, t = (r, n) => r === n) => {
509
+ const r = new T(s, t);
510
+ return e.forEach((n) => n.setDerivative(r)), r;
511
+ }, He = (s, e) => G(s, e).dispose, L = (s, e = (t, r) => t === r) => new I(s, e), R = (s, e = (t, r) => t === r) => new d(s, e), ee = () => typeof window < "u" ? window : void 0, p = {
512
512
  /**
513
513
  * Maps a value or a Signal to a new value.
514
514
  * If the value is a Signal, it returns a new Signal with the mapped value.
@@ -520,7 +520,7 @@ const X = (t, e, r = (s, n) => s === n) => {
520
520
  * @param fn - The function to map the value.
521
521
  * @returns The mapped value.
522
522
  */
523
- map: (t, e) => h.is(t) ? t.map(e) : e(t),
523
+ map: (s, e) => d.is(s) ? s.map(e) : e(s),
524
524
  /**
525
525
  * Wraps a value or a Signal instance into a Signal.
526
526
  * If the value is already a Signal, it returns the value itself.
@@ -531,30 +531,30 @@ const X = (t, e, r = (s, n) => s === n) => {
531
531
  * @param equals - A function that determines if two values are equal. Defaults to strict equality (===).
532
532
  * @returns A Signal instance.
533
533
  */
534
- toSignal: (t, e) => h.is(t) ? t : I(t, e),
534
+ toSignal: (s, e) => d.is(s) ? s : R(s, e),
535
535
  /**
536
536
  * Wraps a value in a `Signal` if it is not already a `Signal`.
537
537
  * If the value is `null` or `undefined`, it returns `null` or `undefined` respectively.
538
538
  * @param value - The value to wrap or check.
539
539
  * @returns The wrapped value if it is not `null` or `undefined`, otherwise `null` or `undefined`.
540
540
  */
541
- maybeToSignal: (t, e) => {
542
- if (t != null)
543
- return d.toSignal(t, e);
541
+ maybeToSignal: (s, e) => {
542
+ if (s != null)
543
+ return p.toSignal(s, e);
544
544
  },
545
545
  /**
546
546
  * Gets the value from a `Signal` or the value itself if it is not a `Signal`.
547
547
  * @param value - The value or Signal instance to get the value from.
548
548
  * @returns The value.
549
549
  */
550
- get: (t) => h.is(t) ? t.get() : t,
550
+ get: (s) => d.is(s) ? s.get() : s,
551
551
  /**
552
552
  * Adds a listener to a `Signal` or calls the listener immediately if it is not a `Signal`.
553
553
  * @param value - The value or Signal instance to add the listener to.
554
554
  * @param listener - The listener to call when the value changes.
555
555
  * @returns A function to remove the listener.
556
556
  */
557
- on: (t, e) => h.is(t) ? t.on(e) : (e(t), () => {
557
+ on: (s, e) => d.is(s) ? s.on(e) : (e(s), () => {
558
558
  }),
559
559
  /**
560
560
  * Disposes of a value or a Signal.
@@ -562,103 +562,109 @@ const X = (t, e, r = (s, n) => s === n) => {
562
562
  * If the value is not a Signal, it does nothing.
563
563
  * @param value - The value or Signal instance to dispose of.
564
564
  */
565
- dispose: (t) => {
566
- h.is(t) && t.dispose();
565
+ dispose: (s) => {
566
+ d.is(s) && s.dispose();
567
567
  }
568
- }, Pt = (...t) => (e, r) => {
569
- const s = t.filter((n) => h.is(n));
570
- return X(
571
- () => e(...t.map((n) => d.get(n))),
572
- s,
573
- r
568
+ }, yt = (...s) => (e, t) => {
569
+ const r = s.filter((n) => d.is(n));
570
+ return G(
571
+ () => e(...s.map((n) => p.get(n))),
572
+ r,
573
+ t
574
574
  );
575
- }, Dt = (...t) => (e) => {
576
- const r = t.filter((s) => h.is(s));
577
- Ue(() => e(...t.map(d.get)), r);
575
+ }, wt = (...s) => (e) => {
576
+ const t = s.filter((r) => d.is(r));
577
+ He(() => e(...s.map(p.get)), t);
578
578
  };
579
- class se {
579
+ class te {
580
580
  constructor() {
581
- u(this, "_store", /* @__PURE__ */ new Map());
581
+ i(this, "_store", /* @__PURE__ */ new Map());
582
582
  /**
583
583
  * Retrieves the value associated with the specified key from the memory store.
584
584
  * @param key - The key to retrieve the value for.
585
585
  * @returns The value associated with the key, or `null` if the key is not found.
586
586
  */
587
- u(this, "getItem", (e) => this._store.get(e) ?? null);
587
+ i(this, "getItem", (e) => this._store.get(e) ?? null);
588
588
  /**
589
589
  * Sets the value associated with the specified key in the memory store.
590
590
  * @param key - The key to set the value for.
591
591
  * @param value - The value to set.
592
592
  */
593
- u(this, "setItem", (e, r) => {
594
- this._store.set(e, r);
593
+ i(this, "setItem", (e, t) => {
594
+ this._store.set(e, t);
595
595
  });
596
596
  }
597
597
  }
598
- const ne = ({
599
- key: t,
598
+ const se = ({
599
+ key: s,
600
600
  defaultValue: e,
601
- store: r,
602
- serialize: s = JSON.stringify,
601
+ store: t,
602
+ serialize: r = JSON.stringify,
603
603
  deserialize: n = JSON.parse,
604
- equals: o = (l, a) => l === a,
605
- onLoad: i = (l) => l
604
+ equals: o = (c, a) => c === a,
605
+ onLoad: l = (c) => c
606
606
  }) => {
607
- const l = r.getItem(t), a = new F(
608
- l != null ? i(n(l)) : typeof e == "function" ? e() : e,
607
+ const c = t.getItem(s), a = new I(
608
+ c != null ? l(n(c)) : typeof e == "function" ? e() : e,
609
609
  o
610
610
  );
611
611
  return a.on((f) => {
612
- r.setItem(t, s(f));
612
+ t.setItem(s, r(f));
613
613
  }), a;
614
- }, bt = (t) => ne({
615
- ...t,
616
- store: (window == null ? void 0 : window.localStorage) ?? new se()
617
- }), Tt = (t) => ne({
618
- ...t,
619
- store: (window == null ? void 0 : window.sessionStorage) ?? new se()
620
- });
621
- function re(t) {
622
- return typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : setTimeout(t, 0);
614
+ }, _t = (s) => {
615
+ var e;
616
+ return se({
617
+ ...s,
618
+ store: ((e = ee()) == null ? void 0 : e.localStorage) ?? new te()
619
+ });
620
+ }, vt = (s) => {
621
+ var e;
622
+ return se({
623
+ ...s,
624
+ store: ((e = ee()) == null ? void 0 : e.sessionStorage) ?? new te()
625
+ });
626
+ };
627
+ function K(s) {
628
+ return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
623
629
  }
624
- const Ge = (t, e, r, s) => {
625
- const n = (s == null ? void 0 : s.duration) ?? 300, o = (s == null ? void 0 : s.easing) ?? ((_) => _), i = (s == null ? void 0 : s.equals) ?? ((_, R) => _ === R);
626
- let l = s == null ? void 0 : s.interpolate, a = t, f = e(), g = performance.now(), w = null, U = !0;
627
- const G = new E(e, i), A = V(t, i);
628
- A.onDispose(() => {
629
- w !== null && cancelAnimationFrame(w);
630
- }), A.onDispose(G.dispose), r.forEach((_) => {
631
- _.setDerivative(G), _.onDispose(A.dispose);
630
+ const Ie = (s, e, t, r) => {
631
+ const n = (r == null ? void 0 : r.duration) ?? 300, o = (r == null ? void 0 : r.easing) ?? ((y) => y), l = (r == null ? void 0 : r.equals) ?? ((y, H) => y === H);
632
+ let c = r == null ? void 0 : r.interpolate, a = s, f = e(), h = performance.now(), P = null, O = !0;
633
+ const B = new T(e, l), C = L(s, l);
634
+ C.onDispose(() => {
635
+ P !== null && cancelAnimationFrame(P);
636
+ }), C.onDispose(B.dispose), t.forEach((y) => {
637
+ y.setDerivative(B), y.onDispose(C.dispose);
632
638
  });
633
- const Ne = (_) => {
634
- f = _, g = performance.now(), a = A.value, U && (U = !1, w = re(Z));
635
- }, Z = () => {
636
- const R = (performance.now() - g) / d.get(n), Re = o(R);
637
- l == null && (l = Be(a));
638
- let K = l(a, f, Re);
639
- R >= 1 ? (U = !0, K = f) : w = re(Z), A.set(K);
639
+ const be = (y) => {
640
+ f = y, h = performance.now(), a = C.value, O && (O = !1, P = K(J));
641
+ }, J = () => {
642
+ const H = (performance.now() - h) / p.get(n), Ee = o(H);
643
+ c == null && (c = $e(a));
644
+ let Q = c(a, f, Ee);
645
+ H >= 1 ? (O = !0, Q = f) : P = K(J), C.set(Q);
640
646
  };
641
- return G.on(Ne), A;
642
- }, Ot = (t, e) => {
643
- const { initialValue: r, ...s } = e ?? {};
644
- return Ge(
645
- r ?? t.get(),
646
- t.get,
647
- [t],
648
- s
647
+ return B.on(be), C;
648
+ }, St = (s, e) => {
649
+ const { initialValue: t, ...r } = e ?? {};
650
+ return Ie(
651
+ t ?? s.get(),
652
+ s.get,
653
+ [s],
654
+ r
649
655
  );
650
- }, Ct = (t, e) => {
651
- const { signals: r, literals: s } = Object.entries(t).reduce(
652
- ({ signals: o, literals: i }, [l, a]) => (h.is(a) ? o.push([l, a]) : i[l] = a, { signals: o, literals: i }),
656
+ }, Pt = (s, e) => {
657
+ const { signals: t, literals: r } = Object.entries(s).reduce(
658
+ ({ signals: o, literals: l }, [c, a]) => (d.is(a) ? o.push([c, a]) : l[c] = a, { signals: o, literals: l }),
653
659
  { signals: [], literals: {} }
654
- ), n = r.map(([, o]) => o);
655
- return X(() => (r.forEach(([o, i]) => s[o] = i.value), e(s)), n);
656
- }, oe = /* @__PURE__ */ new Set(["checked", "disabled", "hidden", "selected"]), ie = /* @__PURE__ */ new Set([
660
+ ), n = t.map(([, o]) => o);
661
+ return G(() => (t.forEach(([o, l]) => r[o] = l.value), e(r)), n);
662
+ }, re = /* @__PURE__ */ new Set(["checked", "disabled", "hidden", "selected"]), ne = /* @__PURE__ */ new Set([
657
663
  "rowSpan",
658
664
  "colSpan",
659
665
  "tabIndex",
660
666
  "valueAsNumber"
661
- ]), le = /* @__PURE__ */ new Set(["valueAsDate"]), ue = /* @__PURE__ */ new Set([
667
+ ]), ie = /* @__PURE__ */ new Set(["valueAsDate"]), oe = /* @__PURE__ */ new Set([
662
668
  "value",
663
669
  "textContent",
664
670
  "innerText",
@@ -666,25 +672,26 @@ const Ge = (t, e, r, s) => {
666
672
  "outerHTML",
667
673
  "className",
668
674
  "classList"
669
- ]), W = /* @__PURE__ */ new Map(), b = (t, e) => {
670
- if (W.has(t))
671
- return W.get(t);
672
- {
673
- const r = e(t);
674
- return W.set(t, r), r;
675
+ ]), Ve = (s, e) => re.has(s) ? (t) => {
676
+ t == null ? e[s] = null : e[s] = !!t;
677
+ } : ne.has(s) ? (t) => {
678
+ t == null ? e[s] = null : e[s] = Number(t);
679
+ } : ie.has(s) ? (t) => {
680
+ t == null ? e[s] = null : e[s] = t;
681
+ } : oe.has(s) ? (t) => {
682
+ t == null ? e[s] = null : e[s] = String(t);
683
+ } : (t) => {
684
+ t == null ? e.removeAttribute(s) : e.setAttribute(s, t);
685
+ }, Re = (s, e) => re.has(s) ? () => !!e[s] : ne.has(s) ? () => Number(e[s]) : ie.has(s) ? () => e[s] : oe.has(s) ? () => String(e[s]) : () => e.getAttribute(s), U = (s) => {
686
+ const e = s;
687
+ e && e.onblur && (e.onblur = null), !(!s || s.ownerDocument === void 0) && s.parentElement && s.parentElement.removeChild(s);
688
+ }, je = (s) => le(s) ? s : s.parentElement, le = (s) => s.nodeType === 1;
689
+ class ce extends Error {
690
+ constructor(e) {
691
+ super(`Provider not found: ${e.description}`);
675
692
  }
676
- }, Je = (t) => (e, r) => {
677
- r == null ? e[t] = null : e[t] = !!r;
678
- }, We = (t) => (e, r) => {
679
- r == null ? e[t] = null : e[t] = Number(r);
680
- }, He = (t) => (e, r) => {
681
- r == null ? e[t] = null : e[t] = r;
682
- }, ze = (t) => (e, r) => {
683
- r == null ? e[t] = null : e[t] = String(r);
684
- }, Xe = (t) => (e, r) => {
685
- r == null ? e.removeAttribute(t) : e.setAttribute(t, r);
686
- }, ae = (t) => oe.has(t) ? b(t, Je) : ie.has(t) ? b(t, We) : le.has(t) ? b(t, He) : ue.has(t) ? b(t, ze) : b(t, Xe), ce = (t) => (e) => oe.has(t) ? !!e[t] : ie.has(t) ? Number(e[t]) : le.has(t) ? e[t] : ue.has(t) ? String(e[t]) : e.getAttribute(t);
687
- class y {
693
+ }
694
+ class b {
688
695
  /**
689
696
  * Constructs a new `DOMContext` instance.
690
697
  *
@@ -694,7 +701,7 @@ class y {
694
701
  * @param providers - The `Providers` instance associated with this context.
695
702
  * @param isFirstLevel - A boolean value indicating whether this context is at the first level, meaning the outermost node in the generated DOM.
696
703
  */
697
- constructor(e, r, s, n, o) {
704
+ constructor(e, t, r, n) {
698
705
  /**
699
706
  * Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace.
700
707
  *
@@ -702,19 +709,54 @@ class y {
702
709
  * @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
703
710
  * @returns The newly created element.
704
711
  */
705
- u(this, "createElement", (e, r) => r !== void 0 ? this.document.createElementNS(r, e) : this.document.createElement(e));
712
+ i(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
713
+ /**
714
+ * Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace and appends it to the current element.
715
+ *
716
+ * @param tagName - The tag name of the element to create.
717
+ * @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
718
+ * @returns The newly created element.
719
+ */
720
+ i(this, "makeChildElement", (e, t) => {
721
+ const r = this.createElement(e, t);
722
+ return this.appendOrInsert(r), this.withElement(r);
723
+ });
706
724
  /**
707
725
  * Creates a new text node with the specified text content.
708
726
  * @param text - The text content for the new text node.
709
727
  * @returns A new `Text` node with the specified text content.
710
728
  */
711
- u(this, "createText", (e) => this.document.createTextNode(e));
729
+ i(this, "createText", (e) => this.document.createTextNode(e));
730
+ /**
731
+ * Creates a new text node with the specified text content and appends it to the current element.
732
+ * @param text - The text content for the new text node.
733
+ * @returns A new `DOMContext` with a reference to the new text node.
734
+ */
735
+ i(this, "makeChildText", (e) => {
736
+ const t = this.createText(e);
737
+ return this.appendOrInsert(t), this.withReference(t);
738
+ });
739
+ /**
740
+ * Sets the text content of the current element.
741
+ * @param text - The text content to set.
742
+ */
743
+ i(this, "setText", (e) => {
744
+ this.reference.nodeValue = e;
745
+ });
746
+ /**
747
+ * Gets the text content of the current element or text node.
748
+ * @returns The text content of the current element or text node.
749
+ */
750
+ i(this, "getText", () => {
751
+ var e;
752
+ return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
753
+ });
712
754
  /**
713
755
  * Creates a new `DOMContext` with a reference to a newly created text node.
714
756
  * The text node is appended or inserted to the current `DOMContext`.
715
757
  * The new `DOMContext` with the reference is returned.
716
758
  */
717
- u(this, "makeRef", () => {
759
+ i(this, "makeRef", () => {
718
760
  const e = this.createText("");
719
761
  return this.appendOrInsert(e), this.withReference(e);
720
762
  });
@@ -723,78 +765,67 @@ class y {
723
765
  *
724
766
  * @param child - The child node to append or insert.
725
767
  */
726
- u(this, "appendOrInsert", (e) => {
768
+ i(this, "appendOrInsert", (e) => {
727
769
  this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
728
770
  });
729
- /**
730
- * Creates a new `DOMContext` instance with the provided `document`.
731
- *
732
- * @param document - The `Document` to use for the `DOMContext`.
733
- * @returns A new `DOMContext` instance.
734
- */
735
- u(this, "withDocument", (e) => new y(e, this.element, this.reference, this.providers, !0));
736
771
  /**
737
772
  * Creates a new `DOMContext` instance with the provided `element`.
738
773
  * @param element - The DOM element to use in the new `DOMContext` instance.
739
774
  * @returns A new `DOMContext` instance with the provided `element`.
740
775
  */
741
- u(this, "withElement", (e) => new y(this.document, e, void 0, this.providers, !1));
776
+ i(this, "withElement", (e) => new b(this.document, e, void 0, this.providers));
742
777
  /**
743
- * Creates a new `DOMContext` instance with the `isFirstLevel` property set to `true`.
744
- * @returns A new `DOMContext` instance with the `isFirstLevel` property set to `true`.
745
- */
746
- u(this, "withFirstLevel", () => new y(
747
- this.document,
748
- this.element,
749
- this.reference,
750
- this.providers,
751
- !0
752
- ));
778
+ * Creates a new `DOMContext` instance with a reference to a DOM element selected by the provided `selector`.
779
+ * @param selector - The CSS selector for the target DOM element.
780
+ * @returns A new `DOMContext` instance with a reference to the selected DOM element.
781
+ */
782
+ i(this, "makePortal", (e) => {
783
+ const t = this.document.querySelector(e);
784
+ if (t == null)
785
+ throw new Error(`Cannot find element by selector for portal: ${e}`);
786
+ return this.withElement(t);
787
+ });
788
+ // /**
789
+ // * Creates a new `DOMContext` instance with the `isFirstLevel` property set to `true`.
790
+ // * @returns A new `DOMContext` instance with the `isFirstLevel` property set to `true`.
791
+ // */
792
+ // readonly withFirstLevel = (): DOMContext =>
793
+ // new BrowserContext(
794
+ // this.document,
795
+ // this.element,
796
+ // this.reference,
797
+ // this.providers,
798
+ // true
799
+ // )
753
800
  /**
754
801
  * Creates a new `DOMContext` instance with the specified reference.
755
802
  *
756
803
  * @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
757
804
  * @returns A new `DOMContext` instance with the specified reference.
758
805
  */
759
- u(this, "withReference", (e) => new y(
806
+ i(this, "withReference", (e) => new b(
760
807
  this.document,
761
808
  this.element,
762
809
  e,
763
- this.providers,
764
- this.isFirstLevel
765
- ));
766
- /** Creates a new DOMContext with the provided provider value.
767
- *
768
- * @param mark - The provider mark to associate the value with.
769
- * @param value - The value to set for the provider.
770
- * @returns A new DOMContext with the updated providers.
771
- */
772
- u(this, "withProvider", (e, r) => new y(
773
- this.document,
774
- this.element,
775
- this.reference,
776
- {
777
- ...this.providers,
778
- [e]: r
779
- },
780
- this.isFirstLevel
810
+ this.providers
811
+ // this.isFirstLevel
781
812
  ));
782
813
  /**
783
- * Returns a new DOMContext instance with the specified providers merged into
814
+ * Returns a new HTMLDOMContext instance with the specified providers merged into
784
815
  * the existing providers.
785
816
  *
786
817
  * @param providers - An object containing the providers to be merged into the existing providers.
787
- * @returns A new DOMContext instance with the merged providers.
818
+ * @returns A new HTMLDOMContext instance with the merged providers.
788
819
  */
789
- u(this, "withProviders", (e) => new y(
820
+ i(this, "withProviders", (e) => new b(
790
821
  this.document,
791
822
  this.element,
792
823
  this.reference,
793
824
  {
794
825
  ...this.providers,
795
826
  ...e
796
- },
797
- this.isFirstLevel
827
+ }
828
+ // this.isFirstLevel
798
829
  ));
799
830
  /**
800
831
  * Retrieves a provider for the given provider mark.
@@ -803,83 +834,329 @@ class y {
803
834
  * @returns The provider for the given mark.
804
835
  * @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
805
836
  */
806
- u(this, "getProvider", (e) => {
837
+ i(this, "getProvider", (e) => {
807
838
  if (this.providers[e] === void 0)
808
- throw new Qe(e);
839
+ throw new ce(e);
809
840
  return this.providers[e];
810
841
  });
811
- this.document = e, this.element = r, this.reference = s, this.providers = n, this.isFirstLevel = o;
842
+ i(this, "clear", (e) => {
843
+ e && (this.reference !== void 0 ? U(this.reference) : U(this.element));
844
+ });
845
+ /**
846
+ * Adds classes to the element.
847
+ * @param tokens - The class names to add.
848
+ */
849
+ i(this, "addClasses", (e) => {
850
+ this.element.classList.add(...e);
851
+ });
852
+ /**
853
+ * Removes classes from the element.
854
+ * @param tokens - The class names to remove.
855
+ */
856
+ i(this, "removeClasses", (e) => {
857
+ this.element.classList.remove(...e);
858
+ });
859
+ /**
860
+ * Gets the classes of the element.
861
+ * @returns The classes of the element.
862
+ */
863
+ i(this, "getClasses", () => Array.from(this.element.classList));
864
+ /**
865
+ * Adds an event listener to the element.
866
+ * @param event - The event to listen for.
867
+ * @param listener - The listener to call when the event occurs.
868
+ * @returns A function to remove the event listener.
869
+ */
870
+ i(this, "on", (e, t) => (this.element.addEventListener(e, t), (r) => {
871
+ r && this.element.removeEventListener(e, t);
872
+ }));
873
+ /**
874
+ * Returns `true` if the context is a browser DOM context.
875
+ * @returns `true` if the context is a browser DOM context.
876
+ */
877
+ i(this, "isBrowserDOM", () => !0);
878
+ /**
879
+ * Returns `true` if the context is a headless DOM context.
880
+ * @returns `true` if the context is a headless DOM context.
881
+ */
882
+ i(this, "isHeadlessDOM", () => !1);
883
+ /**
884
+ * Sets the style of the element.
885
+ * @param name - The name of the style to set.
886
+ * @param value - The value of the style to set.
887
+ */
888
+ i(this, "setStyle", (e, t) => {
889
+ this.element.style.setProperty(e, t);
890
+ });
891
+ /**
892
+ * Gets the style of the element.
893
+ * @param name - The name of the style to get.
894
+ * @returns The value of the style.
895
+ */
896
+ i(this, "getStyle", (e) => this.element.style.getPropertyValue(e));
897
+ i(this, "makeAccessors", (e) => ({
898
+ get: Re(e, this.element),
899
+ set: Ve(e, this.element)
900
+ }));
901
+ this.document = e, this.element = t, this.reference = r, this.providers = n;
812
902
  }
813
903
  /**
814
904
  * Creates a new `DOMContext` instance for the given `Element` and optional reference `Node`.
815
905
  *
816
- * @param element - The `Element` to create the `DOMContext` for.
906
+ * @param element - The `HTMLElement` to create the `DOMContext` for.
817
907
  * @param ref - An optional reference `Node` to associate with the `DOMContext`.
818
908
  * @returns A new `DOMContext` instance.
819
909
  */
820
- static of(e, r) {
821
- return new y(e.ownerDocument, e, r, {}, !0);
910
+ static of(e, t) {
911
+ return new b(e.ownerDocument, e, t, {});
822
912
  }
823
913
  }
824
- class Qe extends Error {
914
+ const g = Symbol("class"), _ = Symbol("style"), x = Symbol("handler"), ae = () => Math.random().toString(36).substring(2, 15), qe = (s) => s.replace(/<[^>]*>?/g, "");
915
+ class ue {
825
916
  constructor(e) {
826
- super(`Provider not found: ${e.description}`);
917
+ i(this, "id", ae());
918
+ i(this, "properties", {});
919
+ i(this, "children", []);
920
+ i(this, "isElement", () => !0);
921
+ i(this, "isText", () => !1);
922
+ i(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? qe(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
923
+ i(this, "removeChild", (e) => {
924
+ const t = this.children.indexOf(e);
925
+ t !== -1 && this.children.splice(t, 1);
926
+ });
927
+ i(this, "remove", () => {
928
+ if (this.parent != null)
929
+ this.parent.removeChild(this);
930
+ else
931
+ throw new Error("Parent is undefined");
932
+ });
933
+ i(this, "getPortals", () => {
934
+ const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
935
+ return this.isPortal() && e.unshift(this), e;
936
+ });
937
+ i(this, "elements", () => this.children.filter((e) => e.isElement()));
938
+ i(this, "hasInnerHTML", () => this.properties.innerHTML != null);
939
+ i(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
940
+ i(this, "getInnerText", () => this.properties.innerText ?? "");
941
+ i(this, "hasInnerText", () => this.properties.innerText != null);
942
+ i(this, "hasChildren", () => this.children.length > 0);
943
+ i(this, "hasClasses", () => this.properties[g] != null);
944
+ i(this, "hasStyles", () => this.properties[_] != null);
945
+ i(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
946
+ i(this, "hasHandlers", () => this.properties[x] != null);
947
+ i(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
948
+ i(this, "getById", (e) => {
949
+ if (this.properties.id === e)
950
+ return this;
951
+ for (const t of this.elements()) {
952
+ const r = t.getById(e);
953
+ if (r != null)
954
+ return r;
955
+ }
956
+ });
957
+ i(this, "trigger", (e, t) => {
958
+ ((this.properties[x] ?? {})[e] ?? []).forEach((n) => n(t));
959
+ });
960
+ i(this, "click", () => {
961
+ this.trigger("click", {});
962
+ });
963
+ i(this, "on", (e, t) => {
964
+ var o;
965
+ const r = (o = this.properties)[x] ?? (o[x] = {}), n = t;
966
+ return r[e] = [...r[e] ?? [], n], () => {
967
+ const l = r[e] ?? [], c = l.indexOf(n);
968
+ c !== -1 && (l.splice(c, 1), l.length === 0 ? (delete r[e], Object.keys(r).length === 0 && delete this.properties[x]) : r[e] = l);
969
+ };
970
+ });
971
+ i(this, "addClasses", (e) => {
972
+ var r;
973
+ if (e.length === 0)
974
+ return;
975
+ const t = (r = this.properties)[g] ?? (r[g] = []);
976
+ e.forEach((n) => {
977
+ t.includes(n) || t.push(n);
978
+ });
979
+ });
980
+ i(this, "removeClasses", (e) => {
981
+ var r;
982
+ if (e.length === 0)
983
+ return;
984
+ const t = (r = this.properties)[g] ?? (r[g] = []);
985
+ e.forEach((n) => {
986
+ const o = t.indexOf(n);
987
+ o !== -1 && t.splice(o, 1);
988
+ }), t.length === 0 && delete this.properties[g];
989
+ });
990
+ i(this, "getClasses", () => this.properties[g] ?? []);
991
+ i(this, "getAttributes", () => Object.entries(this.properties).filter(
992
+ ([e]) => !["innerText", "innerHTML"].includes(e)
993
+ ));
994
+ i(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
995
+ (e) => e === g ? [["class", this.getClasses()]] : e === _ ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
996
+ ));
997
+ i(this, "setStyle", (e, t) => {
998
+ var n;
999
+ const r = (n = this.properties)[_] ?? (n[_] = {});
1000
+ r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[_]);
1001
+ });
1002
+ i(this, "getStyle", (e) => {
1003
+ var t;
1004
+ return ((t = this.properties[_]) == null ? void 0 : t[e]) ?? "";
1005
+ });
1006
+ i(this, "getStyles", () => this.properties[_] ?? {});
1007
+ i(this, "makeAccessors", (e) => {
1008
+ const t = this.properties;
1009
+ return {
1010
+ get: () => t[e],
1011
+ set: (r) => t[e] = r
1012
+ };
1013
+ });
1014
+ this.parent = e;
827
1015
  }
828
1016
  }
829
- const m = (t) => {
830
- const e = t;
831
- e && e.onblur && (e.onblur = null), !(!t || t.ownerDocument === void 0) && t.parentElement && t.parentElement.removeChild(t);
832
- }, Ye = (t) => fe(t) ? t : t.parentElement, fe = (t) => t.nodeType === 1, he = (t) => (e) => {
833
- Se(e);
834
- const r = e.createText(t);
835
- return e.appendOrInsert(r), (s) => {
836
- s && m(r);
837
- };
838
- }, de = (t) => (e) => {
839
- Se(e);
840
- const r = e.createText(t.value);
841
- e.appendOrInsert(r);
842
- const s = t.on((n) => r.data = n);
1017
+ const Be = (s) => s.replace(/"/g, "&quot;"), Fe = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1018
+ class Ue extends ue {
1019
+ constructor(t, r, n) {
1020
+ super(n);
1021
+ i(this, "isPortal", () => !1);
1022
+ i(this, "toHTML", () => {
1023
+ const t = this.children.map((l) => l.toHTML()).join(""), r = this.namespace ? ` xmlns="${this.namespace}"` : "";
1024
+ let n = null;
1025
+ const o = this.getVisibleAttributes().map(([l, c]) => l === "class" ? ` class="${c.join(" ")}"` : l === "style" ? typeof c == "string" ? ` style="${c}"` : ` style="${Object.entries(c).map(([a, f]) => `${a}: ${f};`).join(" ")}"` : Ge.has(l) ? ` ${l}` : l === "innerHTML" ? (n = c, "") : l === "innerText" ? (n = Fe(c), "") : ` ${l}="${Be(c)}"`).join("");
1026
+ return ze.has(this.tagName) && t === "" ? `<${this.tagName}${r}${o} />` : `<${this.tagName}${r}${o}>${n ?? t}</${this.tagName}>`;
1027
+ });
1028
+ this.tagName = t, this.namespace = r;
1029
+ }
1030
+ }
1031
+ class he extends ue {
1032
+ constructor(t, r) {
1033
+ super(r);
1034
+ i(this, "isPortal", () => !0);
1035
+ i(this, "toHTML", () => "");
1036
+ i(this, "contentToHTML", () => this.children.map((t) => t.toHTML()).join(""));
1037
+ this.selector = t;
1038
+ }
1039
+ }
1040
+ class We {
1041
+ constructor(e) {
1042
+ i(this, "id", ae());
1043
+ i(this, "isElement", () => !1);
1044
+ i(this, "isText", () => !0);
1045
+ i(this, "getText", () => this.text);
1046
+ i(this, "toHTML", () => this.text);
1047
+ this.text = e;
1048
+ }
1049
+ }
1050
+ class E {
1051
+ constructor(e, t, r, n) {
1052
+ i(this, "appendOrInsert", (e) => {
1053
+ if (this.reference != null) {
1054
+ const t = this.element.children.indexOf(this.reference);
1055
+ this.element.children.splice(t, 0, e);
1056
+ } else
1057
+ this.element.children.push(e);
1058
+ });
1059
+ i(this, "makeChildElement", (e, t) => {
1060
+ const r = new Ue(e, t, this.element);
1061
+ return this.appendOrInsert(r), new E(
1062
+ r,
1063
+ void 0,
1064
+ this.container,
1065
+ this.providers
1066
+ );
1067
+ });
1068
+ i(this, "makeChildText", (e) => {
1069
+ const t = new We(e);
1070
+ return this.appendOrInsert(t), new E(
1071
+ this.element,
1072
+ t,
1073
+ this.container,
1074
+ this.providers
1075
+ );
1076
+ });
1077
+ i(this, "setText", (e) => {
1078
+ this.reference && this.reference.isText() && (this.reference.text = e);
1079
+ });
1080
+ i(this, "getText", () => {
1081
+ var e;
1082
+ return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
1083
+ });
1084
+ i(this, "makeRef", () => this.makeChildText(""));
1085
+ i(this, "makePortal", (e) => {
1086
+ const t = new he(e, this.element);
1087
+ return this.appendOrInsert(t), new E(
1088
+ t,
1089
+ void 0,
1090
+ this.container,
1091
+ this.providers
1092
+ );
1093
+ });
1094
+ i(this, "withProviders", (e) => new E(this.element, this.reference, this.container, {
1095
+ ...this.providers,
1096
+ ...e
1097
+ }));
1098
+ i(this, "getProvider", (e) => {
1099
+ if (this.providers[e] === void 0)
1100
+ throw new ce(e);
1101
+ return this.providers[e];
1102
+ });
1103
+ i(this, "clear", (e) => {
1104
+ e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
1105
+ });
1106
+ i(this, "on", (e, t) => this.element.on(e, t));
1107
+ i(this, "addClasses", (e) => this.element.addClasses(e));
1108
+ i(this, "removeClasses", (e) => this.element.removeClasses(e));
1109
+ i(this, "getClasses", () => this.element.getClasses());
1110
+ i(this, "isBrowserDOM", () => !1);
1111
+ i(this, "isHeadlessDOM", () => !0);
1112
+ i(this, "setStyle", (e, t) => this.element.setStyle(e, t));
1113
+ i(this, "getStyle", (e) => this.element.getStyle(e));
1114
+ i(this, "makeAccessors", (e) => this.element.makeAccessors(e));
1115
+ this.element = e, this.reference = t, this.container = r, this.providers = n;
1116
+ }
1117
+ }
1118
+ const Ge = /* @__PURE__ */ new Set([
1119
+ "checked",
1120
+ "disabled",
1121
+ "multiple",
1122
+ "readonly",
1123
+ "required",
1124
+ "selected"
1125
+ ]), ze = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), fe = (s) => (e) => {
1126
+ const t = e.makeChildText(s);
1127
+ return (r) => t.clear(r);
1128
+ }, de = (s) => (e) => {
1129
+ const t = e.makeChildText(s.value), r = s.on((n) => t.setText(n));
843
1130
  return (n) => {
844
- s(), n && m(r);
1131
+ r(), t.clear(n);
845
1132
  };
846
- }, Lt = (t) => h.is(t) ? de(t) : he(t), p = (...t) => (e) => {
847
- const r = t.map((s) => c(s)(e));
848
- return (s) => {
849
- r.forEach((n) => n(s));
1133
+ }, Ct = (s) => d.is(s) ? de(s) : fe(s), m = (...s) => (e) => {
1134
+ const t = s.map((r) => u(r)(e));
1135
+ return (r) => {
1136
+ t.forEach((n) => n(r));
850
1137
  };
851
- }, S = () => () => {
852
- }, Ze = (t) => (e) => (ye(e), e.element.classList.add(...t), (r) => {
853
- r && e.element.classList.remove(...t);
854
- }), Ke = (t) => (e) => {
855
- ye(e);
856
- const r = e.element;
857
- let s = [];
858
- const n = t.on((o) => {
859
- s.forEach((i) => r.classList.remove(i)), s = (o ?? "").split(" ").filter((i) => i.length > 0), r.classList.add(...s);
1138
+ }, v = () => () => {
1139
+ }, Je = (s) => (e) => (e.addClasses(s), (t) => {
1140
+ t && e.removeClasses(s);
1141
+ }), Qe = (s) => (e) => {
1142
+ let t = [];
1143
+ const r = s.on((n) => {
1144
+ e.removeClasses(t), t = (n ?? "").split(" ").filter((o) => o.length > 0), e.addClasses(t);
860
1145
  });
861
- return (o) => {
862
- n(), o && s.forEach((i) => r.classList.remove(i)), s.length = 0;
863
- };
864
- }, L = (t, e) => {
865
- const r = ae(t), s = ce(t);
866
1146
  return (n) => {
867
- _e(n, t);
868
- const o = s(n.element);
869
- return r(n.element, e), (i) => {
870
- i && r(n.element, o);
871
- };
1147
+ r(), n && e.removeClasses(t), t.length = 0;
872
1148
  };
873
- }, k = (t, e) => {
874
- const r = ae(t), s = ce(t);
875
- return (n) => {
876
- _e(n, t);
877
- const o = s(n.element), i = e.on((l) => r(n.element, l));
878
- return (l) => {
879
- i(), l && r(n.element, o);
880
- };
1149
+ }, $ = (s, e) => (t) => {
1150
+ const { get: r, set: n } = t.makeAccessors(s), o = r();
1151
+ return n(e), (l) => {
1152
+ l && n(o);
1153
+ };
1154
+ }, N = (s, e) => (t) => {
1155
+ const { get: r, set: n } = t.makeAccessors(s), o = r(), l = e.on(n);
1156
+ return (c) => {
1157
+ l(), c && n(o);
881
1158
  };
882
- }, P = new Proxy(
1159
+ }, D = new Proxy(
883
1160
  {},
884
1161
  {
885
1162
  /**
@@ -893,17 +1170,17 @@ const m = (t) => {
893
1170
  * @returns The renderable component for the specified attribute.
894
1171
  *
895
1172
  */
896
- get: (t, e) => e === "class" ? (r) => h.is(r) ? Ke(r) : Ze(
897
- (r ?? "").split(" ").filter((s) => s.length > 0)
898
- ) : (r) => h.is(r) ? k(
1173
+ get: (s, e) => e === "class" ? (t) => d.is(t) ? Qe(t) : Je(
1174
+ (t ?? "").split(" ").filter((r) => r.length > 0)
1175
+ ) : (t) => d.is(t) ? N(
899
1176
  e,
900
- r
901
- ) : L(
1177
+ t
1178
+ ) : $(
902
1179
  e,
903
- r
1180
+ t
904
1181
  )
905
1182
  }
906
- ), kt = new Proxy(
1183
+ ), xt = new Proxy(
907
1184
  {},
908
1185
  {
909
1186
  /**
@@ -914,12 +1191,12 @@ const m = (t) => {
914
1191
  * @returns The renderable component for the specified attribute.
915
1192
  *
916
1193
  */
917
- get: (t, e) => (r) => h.is(r) ? k(
1194
+ get: (s, e) => (t) => d.is(t) ? N(
918
1195
  `data-${e}`,
919
- r
920
- ) : L(`data-${e}`, r)
1196
+ t
1197
+ ) : $(`data-${e}`, t)
921
1198
  }
922
- ), Nt = new Proxy(
1199
+ ), Tt = new Proxy(
923
1200
  {},
924
1201
  {
925
1202
  /**
@@ -930,15 +1207,15 @@ const m = (t) => {
930
1207
  * @returns The renderable component for the specified attribute.
931
1208
  *
932
1209
  */
933
- get: (t, e) => (r) => h.is(r) ? k(
1210
+ get: (s, e) => (t) => d.is(t) ? N(
934
1211
  `aria-${e}`,
935
- r
936
- ) : L(
1212
+ t
1213
+ ) : $(
937
1214
  `aria-${e}`,
938
- r
1215
+ t
939
1216
  )
940
1217
  }
941
- ), Rt = new Proxy(
1218
+ ), bt = new Proxy(
942
1219
  {},
943
1220
  {
944
1221
  /**
@@ -949,15 +1226,15 @@ const m = (t) => {
949
1226
  * @returns The renderable component for the specified attribute.
950
1227
  *
951
1228
  */
952
- get: (t, e) => (r) => h.is(r) ? k(
1229
+ get: (s, e) => (t) => d.is(t) ? N(
953
1230
  e,
954
- r
955
- ) : L(
1231
+ t
1232
+ ) : $(
956
1233
  e,
957
- r
1234
+ t
958
1235
  )
959
1236
  }
960
- ), Mt = new Proxy(
1237
+ ), Et = new Proxy(
961
1238
  {},
962
1239
  {
963
1240
  /**
@@ -967,29 +1244,37 @@ const m = (t) => {
967
1244
  * @returns The renderable component for the specified attribute.
968
1245
  *
969
1246
  */
970
- get: (t, e) => (r) => h.is(r) ? k(
1247
+ get: (s, e) => (t) => d.is(t) ? N(
971
1248
  e,
972
- r
973
- ) : L(
1249
+ t
1250
+ ) : $(
974
1251
  e,
975
- r
1252
+ t
976
1253
  )
977
1254
  }
978
- ), c = (t) => t == null ? S : Array.isArray(t) ? p(...t.map(c)) : typeof t == "string" ? he(t) : h.is(t) ? de(t) : t, pe = (t, ...e) => (r) => {
979
- const s = r.createElement(t, void 0);
980
- r.isFirstLevel && N() && ve(s), r.appendOrInsert(s), r = r.withElement(s);
981
- const n = e.map((o) => c(o)(r));
1255
+ ), u = (s) => {
1256
+ if (s == null)
1257
+ return v;
1258
+ if (Array.isArray(s))
1259
+ return m(...s.map(u));
1260
+ if (typeof s == "string")
1261
+ return fe(s);
1262
+ if (d.is(s))
1263
+ return de(s);
1264
+ if (typeof s == "function")
1265
+ return s;
1266
+ throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
1267
+ }, pe = (s, ...e) => (t) => {
1268
+ const r = t.makeChildElement(s, void 0), n = e.map((o) => u(o)(r));
982
1269
  return (o) => {
983
- n.forEach((i) => i(!1)), o && m(s);
1270
+ n.forEach((l) => l(!1)), r.clear(o);
984
1271
  };
985
- }, me = (t, e, ...r) => (s) => {
986
- const n = s.createElement(t, e);
987
- s.isFirstLevel && N() && ve(n), s.appendOrInsert(n), s = s.withElement(n);
988
- const o = r.map((i) => c(i)(s));
989
- return (i) => {
990
- o.forEach((l) => l(!1)), i && m(n);
1272
+ }, ge = (s, e, ...t) => (r) => {
1273
+ const n = r.makeChildElement(s, e), o = t.map((l) => u(l)(n));
1274
+ return (l) => {
1275
+ o.forEach((c) => c(!1)), n.clear(l);
991
1276
  };
992
- }, $t = new Proxy(
1277
+ }, Dt = new Proxy(
993
1278
  {},
994
1279
  {
995
1280
  /**
@@ -997,9 +1282,9 @@ const m = (t) => {
997
1282
  * @param tagName - The HTML tag name.
998
1283
  * @returns A renderable function that creates and appends the HTML element to the DOM.
999
1284
  */
1000
- get: (t, e) => (...r) => pe(e, r.flatMap(c))
1285
+ get: (s, e) => (...t) => pe(e, t.flatMap(u))
1001
1286
  }
1002
- ), Ft = new Proxy(
1287
+ ), Ot = new Proxy(
1003
1288
  {},
1004
1289
  {
1005
1290
  /**
@@ -1007,9 +1292,9 @@ const m = (t) => {
1007
1292
  * @param type - The input type name.
1008
1293
  * @returns A renderable function that creates and appends the HTMLInput element to the DOM.
1009
1294
  */
1010
- get: (t, e) => (...r) => pe("input", P.type(e), ...r)
1295
+ get: (s, e) => (...t) => pe("input", D.type(e), ...t)
1011
1296
  }
1012
- ), xe = "http://www.w3.org/2000/svg", Vt = new Proxy(
1297
+ ), Xe = "http://www.w3.org/2000/svg", At = new Proxy(
1013
1298
  {},
1014
1299
  {
1015
1300
  /**
@@ -1017,9 +1302,9 @@ const m = (t) => {
1017
1302
  * @param tagName - The SVG tag name.
1018
1303
  * @returns A renderable function that creates and appends the SVG element to the DOM.
1019
1304
  */
1020
- get: (t, e) => (...r) => me(e, xe, r.flatMap(c))
1305
+ get: (s, e) => (...t) => ge(e, Xe, t.flatMap(u))
1021
1306
  }
1022
- ), et = "http://www.w3.org/1998/Math/MathML", qt = new Proxy(
1307
+ ), Ye = "http://www.w3.org/1998/Math/MathML", Mt = new Proxy(
1023
1308
  {},
1024
1309
  {
1025
1310
  /**
@@ -1027,108 +1312,35 @@ const m = (t) => {
1027
1312
  * @param tagName - The Math tag name.
1028
1313
  * @returns A renderable function that creates and appends the Math element to the DOM.
1029
1314
  */
1030
- get: (t, e) => (...r) => me(e, et, r.flatMap(c))
1031
- }
1032
- ), O = "data-tempo-attr", M = "data-tempo-class", ge = "data-tempo-node", $ = "data-tempo-text", tt = (t, e) => {
1033
- const r = t.getAttribute(e);
1034
- if (r != null) {
1035
- const s = t.getAttribute(O) ?? "{}", n = { ...JSON.parse(s), name: r };
1036
- t.setAttribute(
1037
- O,
1038
- JSON.stringify(n).replace(/"/g, "&quot;")
1039
- );
1315
+ get: (s, e) => (...t) => ge(e, Ye, t.flatMap(u))
1040
1316
  }
1041
- }, _e = (t, e) => {
1042
- N() && t.isFirstLevel && tt(t.element, e);
1043
- }, rt = (t) => {
1044
- t.querySelectorAll(`[${O}]`).forEach((e) => {
1045
- const r = JSON.parse(
1046
- (e.getAttribute(O) ?? "{}").replace(/&quot;/g, '"')
1047
- );
1048
- for (const [s, n] of Object.entries(r))
1049
- e.setAttribute(s, n);
1050
- e.removeAttribute(O);
1051
- });
1052
- };
1053
- function st(t) {
1054
- t.setAttribute(M, t.className);
1055
- }
1056
- const ye = (t) => {
1057
- N() && t.isFirstLevel && st(t.element);
1058
- }, nt = (t) => {
1059
- t.querySelectorAll(`[${M}]`).forEach((e) => {
1060
- const r = e.getAttribute(M);
1061
- r !== null && (e.className = r, e.removeAttribute(M));
1062
- });
1063
- }, ve = (t) => {
1064
- t.setAttribute(ge, "");
1065
- }, ot = (t) => {
1066
- t.querySelectorAll(`[${ge}]`).forEach((e) => {
1067
- m(e);
1068
- });
1069
- }, it = (t) => {
1070
- t.setAttribute($, t.textContent ?? "");
1071
- }, Se = (t) => {
1072
- N() && t.isFirstLevel && it(t.element);
1073
- }, lt = (t) => {
1074
- t.querySelectorAll(`[${$}]`).forEach((e) => {
1075
- e.textContent = e.getAttribute($), e.removeAttribute($);
1076
- });
1077
- }, ut = (t) => {
1078
- ot(t), nt(t), rt(t), lt(t);
1079
- }, we = () => {
1080
- const t = globalThis;
1081
- return t.__tempoSSR__ == null && (t.__tempoSSR__ = {
1082
- isSSR: !1,
1083
- counter: 0
1084
- }), t.__tempoSSR__;
1085
- }, Q = (t, e) => {
1086
- const r = we();
1087
- r[t] = e;
1088
- }, Ae = (t) => we()[t], H = (t) => {
1089
- Q("isSSR", t);
1090
- }, Y = () => Ae("counter"), at = () => {
1091
- Q("counter", (Y() ?? 0) + 1);
1092
- }, ct = () => {
1093
- Q("counter", (Y() ?? 0) - 1);
1094
- }, It = (t = 30) => (H(!0), new Promise((e, r) => {
1095
- let s;
1096
- const n = setInterval(() => {
1097
- Y() <= 0 && (clearInterval(n), clearTimeout(s), H(!1), e());
1098
- }, 30);
1099
- s = setTimeout(() => {
1100
- clearInterval(n), H(!1), r(new Error("SSR Timeout"));
1101
- }, t * 1e3);
1102
- })), Bt = (t) => (at(), c(t(ct))), N = () => Ae("isSSR"), Ee = (t, e) => {
1317
+ ), me = (s, e) => {
1103
1318
  if (typeof e == "function")
1104
- return Ee(t, { then: e });
1105
- const r = e.pending != null ? c(e.pending) : S, s = e.then, n = e.error != null ? (o) => c(e.error(o)) : () => S;
1319
+ return me(s, { then: e });
1320
+ const t = e.pending != null ? u(e.pending) : v, r = e.then, n = e.error != null ? (o) => u(e.error(o)) : () => v;
1106
1321
  return (o) => {
1107
- let i = !0;
1108
- const l = t();
1109
- o = o.makeRef();
1110
- let a = c(r)(o);
1111
- return l.then(
1112
- (f) => {
1113
- i && (a(!0), a = c(s(f))(o));
1322
+ let l = !0;
1323
+ const c = s(), a = o.makeRef();
1324
+ let f = u(t)(a);
1325
+ return c.then(
1326
+ (h) => {
1327
+ l && (f(!0), f = u(r(h))(a));
1114
1328
  },
1115
- (f) => {
1116
- i && (a(!0), a = c(n(f))(o));
1329
+ (h) => {
1330
+ l && (f(!0), f = u(n(h))(a));
1117
1331
  }
1118
- ), (f) => {
1119
- i = !1, a(f), f && o.reference && m(o.reference);
1332
+ ), (h) => {
1333
+ l = !1, f(h), a.clear(h);
1120
1334
  };
1121
1335
  };
1122
- }, jt = (t, e) => Ee(() => t, e), Pe = (t, e) => (r) => (r.element.addEventListener(t, e), (s) => {
1123
- s && r.element.removeEventListener(t, e);
1124
- }), ft = (t) => Pe("click", (e) => {
1336
+ }, kt = (s, e) => me(() => s, e), ye = (s, e) => (t) => t.on(s, e), Ze = (s) => ye("click", (e) => {
1125
1337
  e.preventDefault();
1126
- const r = e.target;
1338
+ const t = e.target;
1127
1339
  setTimeout(() => {
1128
- const s = r.ownerDocument != null ? r == null ? void 0 : r.checked : void 0;
1129
- s != null && t(!s);
1340
+ const r = t.ownerDocument != null ? t == null ? void 0 : t.checked : void 0;
1341
+ r != null && s(!r);
1130
1342
  }, 0);
1131
- }), B = new Proxy(
1343
+ }), j = new Proxy(
1132
1344
  {},
1133
1345
  {
1134
1346
  /**
@@ -1136,270 +1348,290 @@ const ye = (t) => {
1136
1348
  * @param fn - The function to call when the event is triggered.
1137
1349
  * @returns A `Renderable` function that adds the event listener to the element.
1138
1350
  */
1139
- get: (t, e) => (r) => Pe(e, r)
1351
+ get: (s, e) => (t) => ye(e, t)
1140
1352
  }
1141
- ), ht = (t) => (e) => {
1142
- const r = e.target;
1143
- t(r.value);
1144
- }, dt = (t) => (e) => {
1145
- const r = e.target;
1146
- t(r.valueAsNumber);
1147
- }, pt = (t) => (e) => {
1148
- const r = e.target;
1149
- if (r.value === "")
1353
+ ), Ke = (s) => (e) => {
1354
+ const t = e.target;
1355
+ s(t.value);
1356
+ }, et = (s) => (e) => {
1357
+ const t = e.target;
1358
+ s(t.valueAsNumber);
1359
+ }, tt = (s) => (e) => {
1360
+ const t = e.target;
1361
+ if (t.value === "")
1150
1362
  return;
1151
- const s = r.value.split("-"), n = new Date(
1152
- Number(s[0]),
1153
- Number(s[1]) - 1,
1154
- Number(s[2].substring(0, 2))
1363
+ const r = t.value.split("-"), n = new Date(
1364
+ Number(r[0]),
1365
+ Number(r[1]) - 1,
1366
+ Number(r[2].substring(0, 2))
1155
1367
  );
1156
- t(n);
1157
- }, mt = (t) => (e) => {
1158
- const r = e.target;
1159
- if (r.value === "")
1368
+ s(n);
1369
+ }, st = (s) => (e) => {
1370
+ const t = e.target;
1371
+ if (t.value === "")
1160
1372
  return;
1161
- const s = r.value.split("T"), n = s[0].split("-"), o = new Date(
1373
+ const r = t.value.split("T"), n = r[0].split("-"), o = new Date(
1162
1374
  Number(n[0]),
1163
1375
  Number(n[1]) - 1,
1164
1376
  Number(n[2])
1165
- ), i = s[1].split(":");
1166
- o.setHours(Number(i[0])), o.setMinutes(Number(i[1])), o.setSeconds(Number(i[2])), t(o);
1167
- }, Ut = (t) => (e) => {
1168
- const r = e.target;
1169
- t(r.checked);
1170
- }, Gt = (t) => (e) => {
1171
- e.preventDefault(), t();
1172
- }, Jt = (t) => (e) => {
1173
- e.stopPropagation(), t();
1174
- }, Wt = (t) => (e) => {
1175
- e.stopImmediatePropagation(), t();
1176
- }, Ht = (t, e = "input") => p(
1177
- P.valueAsDate(t),
1178
- B[e](pt(t.set))
1179
- ), zt = (t, e = "input") => p(
1180
- P.valueAsDate(t),
1181
- B[e](mt(t.set))
1182
- ), Xt = (t, e = "input") => p(
1183
- P.valueAsNumber(t),
1184
- B[e](dt(t.set))
1185
- ), Qt = (t, e = "input") => p(P.value(t), B[e](ht(t.set))), Yt = (t) => p(P.checked(t), ft(t.set)), j = (t, e) => {
1186
- if (h.is(t))
1187
- return (s) => {
1188
- s = s.makeRef();
1189
- let n, o;
1190
- const i = t.map((f) => Object.keys(f)[0]);
1191
- let l;
1192
- const a = i.on((f) => {
1193
- if (f !== l) {
1194
- o == null || o.dispose(), n == null || n(!0), o = t.map((w) => w[f]);
1195
- const g = e[f](o);
1196
- n = c(g)(s), l = f;
1377
+ ), l = r[1].split(":");
1378
+ o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), s(o);
1379
+ }, Lt = (s) => (e) => {
1380
+ const t = e.target;
1381
+ s(t.checked);
1382
+ }, $t = (s) => (e) => {
1383
+ e.preventDefault(), s();
1384
+ }, Nt = (s) => (e) => {
1385
+ e.stopPropagation(), s();
1386
+ }, Ht = (s) => (e) => {
1387
+ e.stopImmediatePropagation(), s();
1388
+ }, It = (s, e = "input") => m(
1389
+ D.valueAsDate(s),
1390
+ j[e](tt(s.set))
1391
+ ), Vt = (s, e = "input") => m(
1392
+ D.valueAsDate(s),
1393
+ j[e](st(s.set))
1394
+ ), Rt = (s, e = "input") => m(
1395
+ D.valueAsNumber(s),
1396
+ j[e](et(s.set))
1397
+ ), jt = (s, e = "input") => m(D.value(s), j[e](Ke(s.set))), qt = (s) => m(D.checked(s), Ze(s.set)), q = (s, e) => {
1398
+ if (d.is(s))
1399
+ return (r) => {
1400
+ const n = r.makeRef();
1401
+ let o, l;
1402
+ const c = s.map((h) => Object.keys(h)[0]);
1403
+ let a;
1404
+ const f = c.on((h) => {
1405
+ if (h !== a) {
1406
+ l == null || l.dispose(), o == null || o(!0), l = s.map((O) => O[h]);
1407
+ const P = e[h](l);
1408
+ o = u(P)(n), a = h;
1197
1409
  }
1198
1410
  });
1199
- return (f) => {
1200
- a(), f && s.reference != null && m(s.reference), n == null || n(!0);
1411
+ return (h) => {
1412
+ f(), n.clear(h), o == null || o(h);
1201
1413
  };
1202
1414
  };
1203
- const r = Object.keys(t)[0];
1204
- return c(e[r](I(t[r])));
1205
- }, De = (t, e, r) => j(
1206
- d.map(t, (s) => ({ [s[e]]: s })),
1415
+ const t = Object.keys(s)[0];
1416
+ return u(e[t](R(s[t])));
1417
+ }, we = (s, e, t) => q(
1418
+ p.map(s, (r) => ({ [r[e]]: r })),
1207
1419
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1208
- r
1209
- ), Zt = (t, e) => De(t, "kind", e), Kt = (t, e) => {
1210
- const r = d.map(t, ([s, n]) => ({ [s]: n }));
1211
- return j(r, e);
1212
- }, xt = (t, e) => De(t, "type", e), gt = (t, e) => j(
1213
- d.map(t, (r) => ({ [r]: !0 })),
1420
+ t
1421
+ ), Bt = (s, e) => we(s, "kind", e), Ft = (s, e) => {
1422
+ const t = p.map(s, ([r, n]) => ({ [r]: n }));
1423
+ return q(t, e);
1424
+ }, Ut = (s, e) => we(s, "type", e), rt = (s, e) => q(
1425
+ p.map(s, (t) => ({ [t]: !0 })),
1214
1426
  e
1215
- ), er = (t, e = {}) => (r) => {
1216
- const s = (e == null ? void 0 : e.firstSeparator) ?? t, n = (e == null ? void 0 : e.lastSeparator) ?? t;
1217
- return gt(
1218
- r.map((o) => o.isFirst ? "first" : o.isLast ? "last" : "other"),
1427
+ ), Wt = (s, e = {}) => (t) => {
1428
+ const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
1429
+ return rt(
1430
+ t.map((o) => o.isFirst ? "first" : o.isLast ? "last" : "other"),
1219
1431
  {
1220
- first: () => s,
1432
+ first: () => r,
1221
1433
  last: () => n,
1222
- other: () => t
1434
+ other: () => s
1223
1435
  }
1224
1436
  );
1225
- }, be = (t, e) => (r) => {
1226
- const s = Object.values(t).reduce((n, o) => {
1227
- const i = r.getProvider(o);
1228
- if (i == null)
1229
- throw new Error(`No provider found for mark: ${o.description}`);
1230
- return n[o] = i, n;
1437
+ }, _e = (s, e) => (t) => {
1438
+ const r = Object.values(s).reduce((n, o) => {
1439
+ const l = t.getProvider(o);
1440
+ return n[o] = l, n;
1231
1441
  }, {});
1232
- return c(e(s))(r);
1233
- }, tr = (t, e) => (r) => {
1234
- const s = [], n = Object.entries(t).reduce(
1235
- (o, [i, l]) => (s.push(
1236
- l((a) => (Reflect.set(o, i, a), null))(r)
1442
+ return u(e(r))(t);
1443
+ }, Gt = (s, e) => (t) => {
1444
+ const r = [], n = Object.entries(s).reduce(
1445
+ (o, [l, c]) => (r.push(
1446
+ c((a) => (Reflect.set(o, l, a), null))(t)
1237
1447
  ), o),
1238
1448
  {}
1239
1449
  );
1240
- return s.push(e(n)(r)), (o) => {
1241
- s.forEach((i) => i(o));
1450
+ return r.push(e(n)(t)), (o) => {
1451
+ r.forEach((l) => l(o));
1242
1452
  };
1243
- }, rr = (t, e) => be([t], (r) => c(e(r[t]))), sr = (t, e) => be(t, (r) => c(e(r))), nr = (t) => (e) => t(e), or = (t) => (e) => (e.appendOrInsert(t), (r) => {
1244
- r && m(t);
1245
- }), _t = (t, e, r) => {
1246
- if (h.is(t)) {
1247
- const s = t;
1453
+ }, nt = (s, e) => _e([s], (t) => u(e(t[s]))), zt = (s, e) => _e(s, (t) => u(e(t))), Jt = (s) => (e) => s(e) ?? (() => {
1454
+ }), Qt = (s) => (e) => (e.appendOrInsert(s), (t) => {
1455
+ t && U(s);
1456
+ }), it = (s, e, t) => {
1457
+ if (d.is(s)) {
1458
+ const r = s;
1248
1459
  return (n) => {
1249
- n = n.makeRef();
1250
- let o = null, i = !1;
1251
- const l = V(null), a = s.on((f) => {
1252
- f == null ? (o == null || o(!0), o = c((r == null ? void 0 : r()) ?? S)(n), i = !1) : (l.value = f, i || (o == null || o(!0), o = c(e(l))(n), i = !0));
1460
+ const o = n.makeRef();
1461
+ let l = null, c = !1;
1462
+ const a = L(null), f = r.on((h) => {
1463
+ h == null ? (l == null || l(!0), l = u((t == null ? void 0 : t()) ?? v)(o), c = !1) : (a.value = h, c || (l == null || l(!0), l = u(e(a))(
1464
+ o
1465
+ ), c = !0));
1253
1466
  });
1254
- return (f) => {
1255
- a(), o == null || o(f), f && n.reference && m(n.reference);
1467
+ return (h) => {
1468
+ f(), l == null || l(h), o.clear(h);
1256
1469
  };
1257
1470
  };
1258
1471
  } else {
1259
- const s = t;
1260
- if (s == null) {
1261
- const n = r == null ? void 0 : r();
1262
- return n != null ? c(n) : S;
1472
+ const r = s;
1473
+ if (r == null) {
1474
+ const n = t == null ? void 0 : t();
1475
+ return n != null ? u(n) : v;
1263
1476
  }
1264
- return c(e(I(s)));
1477
+ return u(e(R(r)));
1265
1478
  }
1266
- }, z = (t) => (e) => (r) => t(r, e), Te = (t, e, r) => Oe(
1267
- t,
1479
+ }, W = (s) => (e) => (t) => s(t, e), ve = (s, e, t) => Se(
1480
+ s,
1268
1481
  () => e,
1269
- () => r
1270
- ), Oe = (t, e, r) => _t(
1271
- d.map(t, (s) => s ? !0 : null),
1482
+ () => t
1483
+ ), Se = (s, e, t) => it(
1484
+ p.map(s, (r) => r ? !0 : null),
1272
1485
  e,
1273
- r ?? void 0
1274
- ), ir = (t, e, r) => yt(
1275
- t,
1486
+ t ?? void 0
1487
+ ), Xt = (s, e, t) => ot(
1488
+ s,
1276
1489
  () => e,
1277
- () => r
1278
- ), yt = (t, e, r) => Oe(
1279
- d.map(t, (s) => !s),
1490
+ () => t
1491
+ ), ot = (s, e, t) => Se(
1492
+ p.map(s, (r) => !r),
1280
1493
  e,
1281
- r
1282
- ), Ce = (t, e, r) => r != null ? Ce(t, (s) => {
1283
- const n = new T(
1284
- s.index,
1285
- s.total.map((o) => o - 1)
1494
+ t
1495
+ ), Pe = (s, e, t) => t != null ? Pe(s, (r) => {
1496
+ const n = new M(
1497
+ r.index,
1498
+ r.total.map((o) => o - 1)
1286
1499
  );
1287
- return p(
1288
- z(n.dispose),
1289
- c(e(s)),
1290
- Te(s.isLast, S, r(n))
1500
+ return m(
1501
+ W(n.dispose),
1502
+ u(e(r)),
1503
+ ve(r.isLast, v, t(n))
1291
1504
  );
1292
- }) : h.is(t) ? (s) => {
1293
- s = s.makeRef();
1294
- const n = Array.from(
1295
- { length: t.value },
1296
- (l, a) => a
1297
- ).map((l) => new T(l, t)), o = n.map(
1298
- (l) => c(e(l))(s)
1299
- ), i = t.on((l) => {
1300
- for (; l < o.length; )
1301
- n.pop().dispose(), o.pop()(!0);
1302
- for (let a = 0; a < l; a++)
1303
- if (n[a] == null) {
1304
- n[a] = new T(a, t);
1305
- const f = c(e(n[a]));
1306
- o[a] = f(s);
1505
+ }) : d.is(s) ? (r) => {
1506
+ const n = r.makeRef(), o = Array.from(
1507
+ { length: s.value },
1508
+ (a, f) => f
1509
+ ).map((a) => new M(a, s)), l = o.map(
1510
+ (a) => u(e(a))(n)
1511
+ ), c = s.on((a) => {
1512
+ for (; a < l.length; )
1513
+ o.pop().dispose(), l.pop()(!0);
1514
+ for (let f = 0; f < a; f++)
1515
+ if (o[f] == null) {
1516
+ o[f] = new M(f, s);
1517
+ const h = u(e(o[f]));
1518
+ l[f] = h(n);
1307
1519
  }
1308
1520
  });
1309
- return (l) => {
1310
- i(), l && s.reference && m(s.reference);
1521
+ return (a) => {
1522
+ c(), n.clear(a);
1311
1523
  };
1312
- } : p(
1313
- ...Array.from({ length: t }, (s, n) => n).map(
1314
- (s) => c(e(new T(s, I(t))))
1524
+ } : m(
1525
+ ...Array.from({ length: s }, (r, n) => n).map(
1526
+ (r) => u(e(new M(r, R(s))))
1315
1527
  )
1316
- ), vt = (t, e, r) => {
1317
- if (r != null)
1318
- return vt(t, (s, n) => {
1319
- const o = new T(
1528
+ ), lt = (s, e, t) => {
1529
+ if (t != null)
1530
+ return lt(s, (r, n) => {
1531
+ const o = new M(
1320
1532
  n.index,
1321
- n.total.map((i) => i - 1)
1533
+ n.total.map((l) => l - 1)
1322
1534
  );
1323
- return p([
1324
- z(o.dispose),
1325
- c(e(s, n)),
1326
- Te(n.isLast, S, r(o))
1535
+ return m([
1536
+ W(o.dispose),
1537
+ u(e(r, n)),
1538
+ ve(n.isLast, v, t(o))
1327
1539
  ]);
1328
1540
  });
1329
1541
  {
1330
- const s = d.map(t, (o) => o.length), n = d.toSignal(t);
1331
- return Ce(s, (o) => {
1332
- const i = n.map((l) => l[o.index]);
1333
- return p(
1334
- z(i.dispose),
1335
- c(e(i, o))
1542
+ const r = p.map(s, (o) => o.length), n = p.toSignal(s);
1543
+ return Pe(r, (o) => {
1544
+ const l = n.map((c) => c[o.index]);
1545
+ return m(
1546
+ W(l.dispose),
1547
+ u(e(l, o))
1336
1548
  );
1337
1549
  });
1338
1550
  }
1339
- }, lr = (t, e) => {
1340
- if (h.is(t)) {
1341
- const r = t;
1342
- return (s) => {
1343
- s = s.makeRef();
1344
- const n = r.map((l) => c(e(l)));
1551
+ }, ct = (s) => (e) => e.isBrowserDOM() ? s(e) ?? (() => {
1552
+ }) : () => {
1553
+ }, Yt = (s) => (e) => e.isHeadlessDOM() ? s(e) ?? (() => {
1554
+ }) : () => {
1555
+ }, Zt = (s) => ct((e) => s(e.element) ?? (() => {
1556
+ })), Kt = (s, e) => {
1557
+ if (d.is(s)) {
1558
+ const t = s;
1559
+ return (r) => {
1560
+ r = r.makeRef();
1561
+ const n = t.map((c) => u(e(c)));
1345
1562
  let o = () => {
1346
1563
  };
1347
- const i = n.on((l) => {
1348
- o(!0), o = l(s);
1564
+ const l = n.on((c) => {
1565
+ o(!0), o = c(r);
1349
1566
  });
1350
- return (l) => {
1351
- i(), o(l);
1567
+ return (c) => {
1568
+ l(), o(c);
1352
1569
  };
1353
1570
  };
1354
1571
  }
1355
- return c(e(t));
1356
- }, ur = (t, e, r = () => S) => j(
1357
- d.map(
1358
- t,
1359
- (s) => s.length > 0 ? { notEmpty: s } : { whenEmpty: null }
1572
+ return u(e(s));
1573
+ }, es = (s, e, t = () => v) => q(
1574
+ p.map(
1575
+ s,
1576
+ (r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
1360
1577
  ),
1361
1578
  {
1362
- notEmpty: (s) => e(s),
1363
- whenEmpty: () => r()
1579
+ notEmpty: (r) => e(r),
1580
+ whenEmpty: () => t()
1364
1581
  }
1365
- ), ar = (t) => (e) => t(e.element) ?? (() => {
1366
- }), Le = (t, e) => {
1367
- const r = t(e);
1368
- return () => r(!0);
1369
- }, cr = (t, e, { doc: r, clear: s } = {}) => {
1370
- const n = typeof e == "string" ? (r ?? document).querySelector(e) : e;
1582
+ ), z = (s, e) => {
1583
+ const t = s(e);
1584
+ return () => t(!0);
1585
+ }, ts = (s, e, { doc: t, clear: r } = {}) => {
1586
+ const n = typeof e == "string" ? (t ?? document).querySelector(e) : e;
1371
1587
  if (n === null)
1372
- throw new St(
1588
+ throw new at(
1373
1589
  `Cannot find element by selector for render: ${e}`
1374
1590
  );
1375
- s !== !1 && (r ?? n.ownerDocument) != null && ut(r ?? n.ownerDocument);
1376
- const o = Ye(n), i = fe(n) ? void 0 : n, l = y.of(o, i);
1377
- return Le(t, l);
1591
+ r !== !1 && (t ?? n.ownerDocument) != null && n.nodeType === 1 && (n.innerHTML = "");
1592
+ const o = je(n), l = le(n) ? void 0 : n, c = b.of(o, l);
1593
+ return z(s, c);
1594
+ }, ss = (s, e) => {
1595
+ const t = L(e), r = new he(":root", void 0), n = new E(r, void 0, { currentURL: t }, {});
1596
+ return {
1597
+ clear: z(s, n),
1598
+ root: r,
1599
+ currentURL: t
1600
+ };
1378
1601
  };
1379
- class St extends Error {
1602
+ class at extends Error {
1380
1603
  constructor(e) {
1381
1604
  super(e);
1382
1605
  }
1383
1606
  }
1384
- const fr = (t, e) => (r) => {
1385
- const s = r.document.querySelector(t);
1386
- if (s === null)
1387
- throw new Error(`Cannot find element by selector for portal: ${t}`);
1388
- return Le(
1389
- c(e),
1390
- r.withElement(s).withFirstLevel()
1391
- );
1392
- }, hr = (t) => Symbol(t), ke = (t, e) => (r) => c(e)(r.withProviders(t)), dr = (...t) => t.length > 0 ? t.reduceRight((e, r) => (s) => e(r(s))) : c, pr = (t, e, r) => ke({ [t]: e }, c(r)), mr = (t, e) => ke(t, c(e)), wt = (t, e) => (r) => {
1393
- const s = r.element, n = s.style.getPropertyValue(t);
1394
- return s.style.setProperty(t, e), (o) => {
1395
- o && s.style.setProperty(t, n);
1607
+ const rs = (s, e) => (t) => {
1608
+ const r = t.makePortal(s);
1609
+ return z(u(e), r);
1610
+ }, ut = (s) => Symbol(s), Ce = (s, e) => (t) => u(e)(t.withProviders(s)), ns = (...s) => s.length > 0 ? s.reduceRight((e, t) => (r) => e(t(r))) : u, ht = (s, e, t) => Ce({ [s]: e }, u(t)), is = (s, e) => Ce(s, u(e)), xe = ut("Probe"), S = /* @__PURE__ */ new Map(), ft = (s, e, t) => {
1611
+ if (S.has(s))
1612
+ throw new Error(`Probe already exists: ${s.description}`);
1613
+ return S.set(s, 0), ht(xe, (n) => {
1614
+ let o = S.get(n);
1615
+ if (o == null)
1616
+ throw new Error(`Probe not found: ${n.description}`);
1617
+ --o === 0 ? (e(), S.delete(n)) : S.set(n, o);
1618
+ }, t);
1619
+ }, dt = (s, e) => nt(xe, (t) => {
1620
+ const r = S.get(s);
1621
+ if (r == null)
1622
+ throw new Error(`Probe not found: ${s.description}`);
1623
+ return S.set(s, r + 1), e(() => t(s));
1624
+ }), Te = Symbol("globalProbe"), os = (s, e) => ft(Te, s, e), ls = (s) => dt(Te, s), pt = (s, e) => (t) => {
1625
+ const r = t.getStyle(s);
1626
+ return t.setStyle(s, e), (n) => {
1627
+ n && t.setStyle(s, r);
1396
1628
  };
1397
- }, At = (t, e) => (r) => {
1398
- const s = r.element, n = s.style.getPropertyValue(t);
1399
- return e.on((o) => s.style.setProperty(t, o)), (o) => {
1400
- o && s.style.setProperty(t, n);
1629
+ }, gt = (s, e) => (t) => {
1630
+ const r = t.getStyle(s);
1631
+ return e.on((n) => t.setStyle(s, n)), (n) => {
1632
+ n && t.setStyle(s, r);
1401
1633
  };
1402
- }, gr = new Proxy(
1634
+ }, cs = new Proxy(
1403
1635
  {},
1404
1636
  {
1405
1637
  /**
@@ -1410,118 +1642,117 @@ const fr = (t, e) => (r) => {
1410
1642
  * @returns The renderable component for the specified attribute.
1411
1643
  *
1412
1644
  */
1413
- get: (t, e) => (r) => h.is(r) ? At(e, r) : wt(e, r)
1645
+ get: (s, e) => (t) => d.is(t) ? gt(e, t) : pt(e, t)
1414
1646
  }
1415
1647
  );
1416
1648
  export {
1417
- jt as Async,
1418
- Yt as BindChecked,
1419
- Ht as BindDate,
1420
- zt as BindDateTime,
1421
- Xt as BindNumber,
1422
- Qt as BindText,
1423
- E as Computed,
1424
- er as Conjunction,
1425
- y as DOMContext,
1426
- or as DOMNode,
1649
+ kt as Async,
1650
+ qt as BindChecked,
1651
+ It as BindDate,
1652
+ Vt as BindDateTime,
1653
+ Rt as BindNumber,
1654
+ jt as BindText,
1655
+ b as BrowserContext,
1656
+ T as Computed,
1657
+ Wt as Conjunction,
1658
+ Qt as DOMNode,
1427
1659
  pe as El,
1428
- me as ElNS,
1429
- T as ElementPosition,
1430
- S as Empty,
1431
- _t as Ensure,
1432
- vt as ForEach,
1433
- p as Fragment,
1434
- yt as LazyUnless,
1435
- Oe as LazyWhen,
1436
- lr as MapSignal,
1437
- se as MemoryStore,
1438
- ur as NotEmpty,
1439
- ft as OnChecked,
1440
- nr as OnCtx,
1441
- ar as OnMount,
1442
- z as OnUnmount,
1443
- j as OneOf,
1444
- De as OneOfField,
1445
- Zt as OneOfKind,
1446
- Kt as OneOfTuple,
1447
- xt as OneOfType,
1448
- gt as OneOfValue,
1449
- fr as Portal,
1450
- F as Prop,
1451
- dr as Provide,
1452
- Qe as ProviderNotFoundError,
1453
- St as RenderingError,
1454
- Ce as Repeat,
1455
- h as Signal,
1456
- Ee as Task,
1457
- Lt as TextNode,
1458
- ir as Unless,
1459
- tr as Use,
1460
- rr as UseProvider,
1461
- sr as UseProviders,
1462
- Bt as UseSSRDone,
1463
- d as Value,
1464
- Te as When,
1465
- pr as WithProvider,
1466
- mr as WithProviders,
1467
- ve as _addNodeTracker,
1468
- ut as _clearSSR,
1469
- Ye as _getSelfOrParentElement,
1470
- fe as _isElement,
1471
- ce as _makeGetter,
1472
- ae as _makeSetter,
1473
- _e as _maybeAddAttributeTracker,
1474
- ye as _maybeAddClassTracker,
1475
- Se as _maybeAddTextTracker,
1476
- m as _removeDOMNode,
1477
- Xe as _setAttribute,
1478
- Je as _setBooleanProperty,
1479
- He as _setDateProperty,
1480
- We as _setNumberProperty,
1481
- ze as _setStringProperty,
1660
+ ge as ElNS,
1661
+ M as ElementPosition,
1662
+ v as Empty,
1663
+ it as Ensure,
1664
+ lt as ForEach,
1665
+ m as Fragment,
1666
+ E as HeadlessContext,
1667
+ Ue as HeadlessElement,
1668
+ he as HeadlessPortal,
1669
+ We as HeadlessText,
1670
+ ot as LazyUnless,
1671
+ Se as LazyWhen,
1672
+ Kt as MapSignal,
1673
+ te as MemoryStore,
1674
+ es as NotEmpty,
1675
+ ct as OnBrowserCtx,
1676
+ Ze as OnChecked,
1677
+ Jt as OnCtx,
1678
+ W as OnDispose,
1679
+ Zt as OnElement,
1680
+ Yt as OnHeadlessCtx,
1681
+ q as OneOf,
1682
+ we as OneOfField,
1683
+ Bt as OneOfKind,
1684
+ Ft as OneOfTuple,
1685
+ Ut as OneOfType,
1686
+ rt as OneOfValue,
1687
+ rs as Portal,
1688
+ I as Prop,
1689
+ ns as Provide,
1690
+ os as ProvideGlobalProbe,
1691
+ ft as ProvideProbe,
1692
+ ce as ProviderNotFoundError,
1693
+ at as RenderingError,
1694
+ Pe as Repeat,
1695
+ d as Signal,
1696
+ me as Task,
1697
+ Ct as TextNode,
1698
+ Xt as Unless,
1699
+ Gt as Use,
1700
+ ls as UseGlobalProbe,
1701
+ dt as UseProbe,
1702
+ nt as UseProvider,
1703
+ zt as UseProviders,
1704
+ p as Value,
1705
+ ve as When,
1706
+ ht as WithProvider,
1707
+ is as WithProviders,
1708
+ je as _getSelfOrParentElement,
1709
+ le as _isElement,
1710
+ Re as _makeGetter,
1711
+ Ve as _makeSetter,
1712
+ U as _removeDOMNode,
1482
1713
  de as _signalText,
1483
- he as _staticText,
1484
- Ot as animateSignal,
1485
- Ge as animateSignals,
1486
- Nt as aria,
1487
- P as attr,
1488
- kt as dataAttr,
1489
- Ut as emitChecked,
1490
- Gt as emitPreventDefault,
1491
- Wt as emitStopImmediatePropagation,
1492
- Jt as emitStopPropagation,
1493
- ht as emitValue,
1494
- pt as emitValueAsDate,
1495
- mt as emitValueAsDateTime,
1496
- dt as emitValueAsNumber,
1497
- Ie as endInterpolate,
1498
- Be as guessInterpolate,
1499
- $t as html,
1500
- Ft as input,
1501
- qe as interpolateDate,
1502
- Fe as interpolateNumber,
1503
- Ve as interpolateString,
1504
- N as isSSR,
1505
- bt as localStorageProp,
1506
- X as makeComputed,
1507
- Pt as makeComputedOf,
1508
- Ct as makeComputedRecord,
1509
- Ue as makeEffect,
1510
- Dt as makeEffectOf,
1511
- V as makeProp,
1512
- hr as makeProviderMark,
1513
- I as makeSignal,
1514
- qt as math,
1515
- Mt as mathAttr,
1516
- B as on,
1517
- It as prepareSSR,
1518
- lt as removeTextTrackers,
1519
- cr as render,
1520
- Le as renderWithContext,
1521
- c as renderableOfTNode,
1522
- Tt as sessionStorageProp,
1523
- ne as storedProp,
1524
- gr as style,
1525
- Vt as svg,
1526
- Rt as svgAttr
1714
+ fe as _staticText,
1715
+ St as animateSignal,
1716
+ Ie as animateSignals,
1717
+ Tt as aria,
1718
+ D as attr,
1719
+ xt as dataAttr,
1720
+ Lt as emitChecked,
1721
+ $t as emitPreventDefault,
1722
+ Ht as emitStopImmediatePropagation,
1723
+ Nt as emitStopPropagation,
1724
+ Ke as emitValue,
1725
+ tt as emitValueAsDate,
1726
+ st as emitValueAsDateTime,
1727
+ et as emitValueAsNumber,
1728
+ Le as endInterpolate,
1729
+ ee as getWindow,
1730
+ $e as guessInterpolate,
1731
+ Dt as html,
1732
+ Ot as input,
1733
+ ke as interpolateDate,
1734
+ Ae as interpolateNumber,
1735
+ Me as interpolateString,
1736
+ _t as localStorageProp,
1737
+ G as makeComputed,
1738
+ yt as makeComputedOf,
1739
+ Pt as makeComputedRecord,
1740
+ He as makeEffect,
1741
+ wt as makeEffectOf,
1742
+ L as makeProp,
1743
+ ut as makeProviderMark,
1744
+ R as makeSignal,
1745
+ Mt as math,
1746
+ Et as mathAttr,
1747
+ j as on,
1748
+ xe as probeMarker,
1749
+ ts as render,
1750
+ z as renderWithContext,
1751
+ u as renderableOfTNode,
1752
+ ss as runHeadless,
1753
+ vt as sessionStorageProp,
1754
+ se as storedProp,
1755
+ cs as style,
1756
+ At as svg,
1757
+ bt as svgAttr
1527
1758
  };