@tempots/dom 31.5.0 → 31.6.1

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,66 +1,56 @@
1
- var We = Object.defineProperty;
2
- var pe = (s) => {
3
- throw TypeError(s);
4
- };
5
- var Ue = (s, e, t) => e in s ? We(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
6
- var o = (s, e, t) => Ue(s, typeof e != "symbol" ? e + "" : e, t), ge = (s, e, t) => e.has(s) || pe("Cannot " + t);
7
- var J = (s, e, t) => (ge(s, e, "read from private field"), t ? t.call(s) : e.get(s)), me = (s, e, t) => e.has(s) ? pe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), le = (s, e, t, r) => (ge(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
8
- const Je = (s, e, t) => s + (e - s) * t;
9
- const Ge = (s, e, t) => {
10
- const r = Math.max(s.length, e.length);
1
+ const ke = (t, e, s) => t + (e - t) * s;
2
+ const $e = (t, e, s) => {
3
+ const r = Math.max(t.length, e.length);
11
4
  let n = "";
12
5
  for (let i = 0; i < r; i++) {
13
- let l = s.charCodeAt(i);
14
- isNaN(l) && (l = 97);
15
- let c = e.charCodeAt(i);
16
- isNaN(c) && (c = 97), n += String.fromCharCode(l + (c - l) * t);
6
+ let o = t.charCodeAt(i);
7
+ isNaN(o) && (o = 97);
8
+ let l = e.charCodeAt(i);
9
+ isNaN(l) && (l = 97), n += String.fromCharCode(o + (l - o) * s);
17
10
  }
18
11
  return n;
19
- }, Xe = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), Ye = (s, e) => e, Qe = (s) => typeof s == "number" ? Je : typeof s == "string" ? Ge : s instanceof Date ? Xe : Ye;
20
- var M;
21
- class ce {
12
+ }, Ne = (t, e, s) => new Date(t.getTime() + (e.getTime() - t.getTime()) * s), Re = (t, e) => e, Ve = (t) => typeof t == "number" ? ke : typeof t == "string" ? $e : t instanceof Date ? Ne : Re;
13
+ class se {
22
14
  /**
23
15
  * Creates a new instance of `ElementPosition`.
24
16
  * @param index - The index of the element.
25
17
  * @param total - The total number of elements in the collection.
26
18
  */
27
- constructor(e, t) {
28
- /**
29
- * The counter of the element starting from 1.
30
- */
31
- o(this, "counter");
32
- /**
33
- * Checks if the element is the first element in the collection.
34
- * @returns `true` if the element is the first element, `false` otherwise.
35
- */
36
- o(this, "isFirst");
37
- /**
38
- * Checks if the counter of the element is even.
39
- * @returns `true` if the counter is even, `false` otherwise.
40
- */
41
- o(this, "isEven");
42
- /**
43
- * Checks if the counter of the element is odd.
44
- * @returns `true` if the counter is odd, `false` otherwise.
45
- */
46
- o(this, "isOdd");
47
- me(this, M);
48
- o(this, "dispose", () => {
49
- var e;
50
- (e = J(this, M)) == null || e.dispose(), le(this, M, void 0);
51
- });
52
- this.index = e, this.total = t, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
19
+ constructor(e, s) {
20
+ this.index = e, this.total = s, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
53
21
  }
22
+ /**
23
+ * The counter of the element starting from 1.
24
+ */
25
+ counter;
26
+ /**
27
+ * Checks if the element is the first element in the collection.
28
+ * @returns `true` if the element is the first element, `false` otherwise.
29
+ */
30
+ isFirst;
31
+ /**
32
+ * Checks if the counter of the element is even.
33
+ * @returns `true` if the counter is even, `false` otherwise.
34
+ */
35
+ isEven;
36
+ /**
37
+ * Checks if the counter of the element is odd.
38
+ * @returns `true` if the counter is odd, `false` otherwise.
39
+ */
40
+ isOdd;
41
+ #e;
54
42
  /**
55
43
  * Checks if the element is the last element in the collection.
56
44
  * @returns `true` if the element is the last element, `false` otherwise.
57
45
  */
58
46
  get isLast() {
59
- return J(this, M) == null && le(this, M, this.total.map((e) => this.counter === e)), J(this, M);
47
+ return this.#e == null && (this.#e = this.total.map((e) => this.counter === e)), this.#e;
60
48
  }
49
+ dispose = () => {
50
+ this.#e?.dispose(), this.#e = void 0;
51
+ };
61
52
  }
62
- M = new WeakMap();
63
- const F = class F {
53
+ class m {
64
54
  /**
65
55
  * Represents a signal with a value of type T.
66
56
  *
@@ -68,316 +58,94 @@ const F = class F {
68
58
  * @param equals - A function that determines whether two values of type T are equal.
69
59
  * @public
70
60
  */
71
- constructor(e, t) {
72
- /**
73
- * @internal
74
- */
75
- o(this, "$__signal__", !0);
76
- /**
77
- * @internal
78
- */
79
- o(this, "_value");
80
- /**
81
- * @internal
82
- */
83
- o(this, "_derivatives", []);
84
- /**
85
- * @internal
86
- */
87
- o(this, "_onValueListeners", []);
88
- /**
89
- * @internal
90
- */
91
- o(this, "_onDisposeListeners", []);
92
- /**
93
- * Gets the current value of the signal.
94
- * @returns The current value of the signal.
95
- */
96
- o(this, "get", () => this._value);
97
- /**
98
- * Checks if the signal has any registered listeners.
99
- * @returns `true` if the signal has listeners, `false` otherwise.
100
- */
101
- o(this, "hasListeners", () => this._onValueListeners.length > 0);
102
- /**
103
- * Registers a listener function to be called whenever the value of the signal changes.
104
- * The listener function will be immediately called with the current value of the signal.
105
- * Returns a function that can be called to unregister the listener.
106
- *
107
- * @param listener - The listener function to be called when the value of the signal changes.
108
- * @param options - Options for the listener.
109
- */
110
- o(this, "on", (e, t = {}) => {
111
- t.skipInitial || e(this.get(), void 0);
112
- const r = t.once ? (i, l) => {
113
- n(), e(i, l);
114
- } : e;
115
- this._onValueListeners.push(r);
116
- const n = () => {
117
- this._onValueListeners.splice(
118
- this._onValueListeners.indexOf(r),
119
- 1
120
- ), t.abortSignal != null && t.abortSignal.removeEventListener("abort", n);
121
- };
122
- return t.abortSignal != null && t.abortSignal.addEventListener("abort", n), n;
123
- });
124
- /**
125
- * @internal
126
- */
127
- o(this, "_setAndNotify", (e) => {
128
- if (this._disposed) return;
129
- const t = this._value;
130
- this.equals(t, e) || (this._value = e, this._onValueListeners.forEach((n) => n(e, t)));
131
- });
132
- /**
133
- * @internal
134
- */
135
- o(this, "_disposed", !1);
136
- /**
137
- * Checks whether the signal is disposed.
138
- * @returns True if the signal is disposed, false otherwise.
139
- */
140
- o(this, "isDisposed", () => this._disposed);
141
- /**
142
- * Adds a listener function to be called when the object is disposed.
143
- * @param listener - The listener function to be called when the object is disposed.
144
- * @returns A function that can be called to remove the listener.
145
- */
146
- o(this, "onDispose", (e) => {
147
- this._onDisposeListeners.push(e);
148
- });
149
- /**
150
- * Disposes the signal, releasing any resources associated with it.
151
- */
152
- o(this, "dispose", () => {
153
- this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
154
- });
155
- /**
156
- * Creates a new computed signal by applying a transformation function to this signal's value.
157
- *
158
- * The `map` method is one of the most commonly used signal operations. It creates a new
159
- * computed signal that automatically updates whenever the source signal changes. The
160
- * transformation function is called with the current value and should return the new value.
161
- *
162
- * @example
163
- * ```typescript
164
- * const count = prop(5)
165
- *
166
- * // Transform to different types
167
- * const doubled = count.map(n => n * 2)
168
- * const message = count.map(n => `Count is ${n}`)
169
- * const isEven = count.map(n => n % 2 === 0)
170
- *
171
- * // Use in UI
172
- * html.div(
173
- * html.div('Original: ', count.map(String)),
174
- * html.div('Doubled: ', doubled.map(String)),
175
- * html.div('Message: ', message),
176
- * html.div('Is even: ', isEven.map(String))
177
- * )
178
- * ```
179
- *
180
- * @example
181
- * ```typescript
182
- * // Chain multiple transformations
183
- * const user = prop({ name: 'John', age: 30 })
184
- * const greeting = user
185
- * .map(u => u.name)
186
- * .map(name => name.toUpperCase())
187
- * .map(name => `Hello, ${name}!`)
188
- * ```
189
- *
190
- * @example
191
- * ```typescript
192
- * // With custom equality function for objects
193
- * const items = prop([{ id: 1, name: 'Item 1' }])
194
- * const itemNames = items.map(
195
- * items => items.map(item => item.name),
196
- * (a, b) => JSON.stringify(a) === JSON.stringify(b) // deep equality
197
- * )
198
- * ```
199
- *
200
- * @typeParam O - The type of the transformed value
201
- * @param fn - Function that transforms the signal's value to a new value
202
- * @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
203
- * @returns A new computed signal with the transformed value
204
- */
205
- o(this, "map", (e, t = (r, n) => r === n) => {
206
- const r = new N(() => {
207
- try {
208
- return e(this.get());
209
- } catch (n) {
210
- throw console.error("Error in Signal.map:", n), n;
211
- }
212
- }, t);
213
- return this.setDerivative(r), r;
214
- });
215
- /**
216
- * Returns a new Signal that applies the given function to the value of the current Signal,
217
- * and then flattens the resulting Signal.
218
- *
219
- * @typeParam O - The type of the value emitted by the resulting Signal.
220
- * @param fn - The function to apply to the value of the current Signal.
221
- * @param equals - A function that determines whether two values of type O are equal.
222
- * Defaults to a strict equality check (===).
223
- * @returns A new Signal that emits the values of the resulting Signal.
224
- */
225
- o(this, "flatMap", (e, t = (r, n) => r === n) => {
226
- const r = new N(() => {
227
- try {
228
- return e(this.get()).get();
229
- } catch (n) {
230
- throw console.error("Error in Signal.flatMap:", n), n;
231
- }
232
- }, t);
233
- return this.setDerivative(r), r;
234
- });
235
- /**
236
- * Invokes a callback function with the current value of the signal, without modifying the signal.
237
- *
238
- * @param fn - The callback function to be invoked with the current value of the signal.
239
- * @returns A new signal that emits the same value as the original signal and invokes the callback function.
240
- */
241
- o(this, "tap", (e) => this.map((t) => (e(t), t)));
242
- /**
243
- * Returns a new Signal that emits the value at the specified key of the current value.
244
- *
245
- * @param key - The key of the value to retrieve.
246
- * @returns A new Signal that emits the value at the specified key.
247
- */
248
- o(this, "at", (e) => this.map((t) => t[e]));
249
- /**
250
- * @internal
251
- */
252
- o(this, "_$");
253
- o(this, "filter", (e, t) => {
254
- let r = t ?? this.get();
255
- const n = new N(() => {
256
- try {
257
- const i = this.get();
258
- return r = e(i) ? i : r;
259
- } catch (i) {
260
- throw console.error("Error in Signal.filter:", i), i;
261
- }
262
- }, this.equals);
263
- return this.setDerivative(n), n;
264
- });
265
- /**
266
- * Returns a new Computed object that applies the provided mapping function to the value of this Signal,
267
- * and filters out values that are `undefined` or `null`.
268
- *
269
- * @typeParam O - The type of the mapped value.
270
- * @param fn - The mapping function to apply to the value of this Signal.
271
- * @param startValue - The initial value for the Computed object.
272
- * @param equals - Optional equality function to determine if two values are equal.
273
- * @returns - A new Computed object with the mapped and filtered values.
274
- */
275
- o(this, "filterMap", (e, t, r = (n, i) => n === i) => {
276
- let n = t;
277
- const i = new N(() => {
278
- try {
279
- const l = this.get(), c = e(l);
280
- return n = c ?? n;
281
- } catch (l) {
282
- throw console.error("Error in Signal.filterMap:", l), l;
283
- }
284
- }, r);
285
- return this.setDerivative(i), i;
286
- });
287
- /**
288
- * Maps the values emitted by the signal to a new value asynchronously using the provided function.
289
- * If the function throws an error, it will be caught and logged.
290
- * If a recovery function is provided, it will be called with the error and its return value will be used as the mapped value.
291
- * If no recovery function is provided, the error will be logged as an unhandled promise rejection.
292
- *
293
- * @typeParam O - The type of the mapped value.
294
- * @param fn - The function to map the values emitted by the signal. The second argument to this function allows to cancel the previously running mapping function if it has not completed by the time a new value is emitted.
295
- * @param alt - The alternate value to use if the signal is disposed or the mapping function throws an error.
296
- * @param recover - The recovery function to handle errors thrown by the mapping function.
297
- * @param equals - The equality function to compare the mapped values for equality.
298
- * @returns A property that holds the mapped value and can be observed for changes.
299
- */
300
- o(this, "mapAsync", (e, t, r, n = (i, l) => i === l) => {
301
- const i = w(t, n);
302
- let l = 0, c = new AbortController();
303
- return i.onDispose(
304
- this.on(async (a) => {
305
- const u = ++l;
306
- c.abort(), c = new AbortController();
307
- try {
308
- const h = await e(a, { abortSignal: c.signal });
309
- u === l && i.set(h);
310
- } catch (h) {
311
- if (u === l)
312
- if (r != null)
313
- i.set(r(h));
314
- else
315
- throw h;
316
- }
317
- })
318
- ), i;
319
- });
320
- /**
321
- * Maps the values of the signal using the provided function `fn`, and returns a new signal
322
- * containing the mapped values. If the mapped value is `undefined` or `null`, it is replaced
323
- * with the provided `alt` value.
324
- *
325
- * @typeParam O - The type of the mapped value.
326
- * @param fn - The function used to map the values of the signal.
327
- * @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
328
- * @returns A new signal containing the mapped values.
329
- */
330
- o(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
331
- /**
332
- * Feeds a property into the signal and sets up disposal behavior.
333
- * @param prop - The property to feed into the signal.
334
- * @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
335
- * @returns The input property.
336
- */
337
- o(this, "feedProp", (e, t = !1) => {
338
- const r = this.on(e.set);
339
- return e.onDispose(r), t ? this.onDispose(e.dispose) : this.onDispose(r), e;
340
- });
341
- /**
342
- * Derives a new property from the current signal.
343
- * @param options - The options for the derived property.
344
- * @param options.autoDisposeProp - Determines whether the derived property should be automatically disposed.
345
- * @param options.equals - A function that determines if two values are equal.
346
- * @returns The derived property.
347
- */
348
- o(this, "deriveProp", ({
349
- autoDisposeProp: e = !0,
350
- equals: t
351
- } = {}) => this.feedProp(w(this.get(), t), e));
352
- /**
353
- * Derives a new signal from the current signal. Useful to create a new signal that emits the same values as the current signal but can be disposed independently.
354
- * @returns A new signal that emits the same values as the current signal.
355
- */
356
- o(this, "derive", () => this.map((e) => e));
357
- /**
358
- * Returns a signal that emits the count of values received so far.
359
- * @returns A signal that emits the count of values received so far.
360
- */
361
- o(this, "count", () => {
362
- let e = 0;
363
- return this.map(() => ++e);
364
- });
365
- /**
366
- * Adds a computed value as a derivative of the signal.
367
- * When the computed value is disposed, it is automatically removed from the derivatives list.
368
- * Additionally, when the computed value is disposed, it sets the signal as dirty.
369
- * @param computed - The computed value to add as a derivative.
370
- */
371
- o(this, "setDerivative", (e) => {
372
- this._derivatives.push(e), e.onDispose(() => {
373
- this._derivatives.splice(
374
- this._derivatives.indexOf(e),
375
- 1
376
- );
377
- }), e.onDispose(this.on(e.setDirty)), this.onDispose(e.dispose);
378
- });
379
- this.equals = t, this._value = e;
61
+ constructor(e, s) {
62
+ this.equals = s, this._value = e;
380
63
  }
64
+ /**
65
+ * Creates a Signal that holds the result of a Promise, with proper error handling.
66
+ *
67
+ * This static method creates a signal that starts with an initial value and updates
68
+ * when the promise resolves. If the promise rejects, an optional recovery function
69
+ * can provide a fallback value.
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * // Basic usage with API call
74
+ * const userData = Signal.ofPromise(
75
+ * fetch('/api/user').then(r => r.json()),
76
+ * { loading: true }, // initial state
77
+ * error => ({ error: error.message, loading: false }) // error recovery
78
+ * )
79
+ *
80
+ * // Use in UI
81
+ * Ensure(userData,
82
+ * (user) => html.div('Welcome, ', user.map(u => u.name)),
83
+ * () => html.div('Loading...')
84
+ * )
85
+ * ```
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * // With custom equality function
90
+ * const config = Signal.ofPromise(
91
+ * loadConfig(),
92
+ * {},
93
+ * () => ({}),
94
+ * (a, b) => JSON.stringify(a) === JSON.stringify(b) // deep equality
95
+ * )
96
+ * ```
97
+ *
98
+ * @typeParam O - The type of the value returned by the Promise
99
+ * @param promise - The Promise to use to feed the Signal
100
+ * @param init - The initial value of the Signal before the Promise resolves
101
+ * @param recover - Optional function to recover from Promise rejection and provide an alternative value
102
+ * @param equals - Function to compare two values for equality (defaults to strict equality)
103
+ * @returns A Signal that represents the result of the Promise
104
+ */
105
+ static ofPromise = (e, s, r, n = (i, o) => i === o) => {
106
+ const i = new m(s, n);
107
+ return e.then((o) => i._setAndNotify(o)).catch((o) => {
108
+ r != null ? i._setAndNotify(r(o)) : console.error(
109
+ "Unhandled promise rejection in Signal.ofPromise:",
110
+ o
111
+ );
112
+ }), i;
113
+ };
114
+ /**
115
+ * Checks if a value is a Signal.
116
+ *
117
+ * @param value - The value to check.
118
+ * @returns `true` if the value is a Signal, `false` otherwise.
119
+ */
120
+ static is = (e) => (
121
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
122
+ e != null && e.$__signal__ === !0
123
+ );
124
+ /**
125
+ * @internal
126
+ */
127
+ $__signal__ = !0;
128
+ /**
129
+ * @internal
130
+ */
131
+ _value;
132
+ /**
133
+ * @internal
134
+ */
135
+ _derivatives = [];
136
+ /**
137
+ * @internal
138
+ */
139
+ _onValueListeners = [];
140
+ /**
141
+ * @internal
142
+ */
143
+ _onDisposeListeners = [];
144
+ /**
145
+ * Gets the current value of the signal.
146
+ * @returns The current value of the signal.
147
+ */
148
+ get = () => this._value;
381
149
  /**
382
150
  * Gets the value of the signal.
383
151
  * @returns The current value of the signal.
@@ -385,119 +153,307 @@ const F = class F {
385
153
  get value() {
386
154
  return this._value;
387
155
  }
156
+ /**
157
+ * Checks if the signal has any registered listeners.
158
+ * @returns `true` if the signal has listeners, `false` otherwise.
159
+ */
160
+ hasListeners = () => this._onValueListeners.length > 0;
161
+ /**
162
+ * Registers a listener function to be called whenever the value of the signal changes.
163
+ * The listener function will be immediately called with the current value of the signal.
164
+ * Returns a function that can be called to unregister the listener.
165
+ *
166
+ * @param listener - The listener function to be called when the value of the signal changes.
167
+ * @param options - Options for the listener.
168
+ */
169
+ on = (e, s = {}) => {
170
+ s.skipInitial || e(this.get(), void 0);
171
+ const r = s.once ? (i, o) => {
172
+ n(), e(i, o);
173
+ } : e;
174
+ this._onValueListeners.push(r);
175
+ const n = () => {
176
+ this._onValueListeners.splice(
177
+ this._onValueListeners.indexOf(r),
178
+ 1
179
+ ), s.abortSignal != null && s.abortSignal.removeEventListener("abort", n);
180
+ };
181
+ return s.abortSignal != null && s.abortSignal.addEventListener("abort", n), n;
182
+ };
183
+ /**
184
+ * @internal
185
+ */
186
+ _setAndNotify = (e) => {
187
+ if (this._disposed) return;
188
+ const s = this._value;
189
+ this.equals(s, e) || (this._value = e, this._onValueListeners.forEach((n) => n(e, s)));
190
+ };
191
+ /**
192
+ * @internal
193
+ */
194
+ _disposed = !1;
195
+ /**
196
+ * Checks whether the signal is disposed.
197
+ * @returns True if the signal is disposed, false otherwise.
198
+ */
199
+ isDisposed = () => this._disposed;
200
+ /**
201
+ * Adds a listener function to be called when the object is disposed.
202
+ * @param listener - The listener function to be called when the object is disposed.
203
+ * @returns A function that can be called to remove the listener.
204
+ */
205
+ onDispose = (e) => {
206
+ this._onDisposeListeners.push(e);
207
+ };
208
+ /**
209
+ * Disposes the signal, releasing any resources associated with it.
210
+ */
211
+ dispose = () => {
212
+ this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
213
+ };
214
+ /**
215
+ * Creates a new computed signal by applying a transformation function to this signal's value.
216
+ *
217
+ * The `map` method is one of the most commonly used signal operations. It creates a new
218
+ * computed signal that automatically updates whenever the source signal changes. The
219
+ * transformation function is called with the current value and should return the new value.
220
+ *
221
+ * @example
222
+ * ```typescript
223
+ * const count = prop(5)
224
+ *
225
+ * // Transform to different types
226
+ * const doubled = count.map(n => n * 2)
227
+ * const message = count.map(n => `Count is ${n}`)
228
+ * const isEven = count.map(n => n % 2 === 0)
229
+ *
230
+ * // Use in UI
231
+ * html.div(
232
+ * html.div('Original: ', count.map(String)),
233
+ * html.div('Doubled: ', doubled.map(String)),
234
+ * html.div('Message: ', message),
235
+ * html.div('Is even: ', isEven.map(String))
236
+ * )
237
+ * ```
238
+ *
239
+ * @example
240
+ * ```typescript
241
+ * // Chain multiple transformations
242
+ * const user = prop({ name: 'John', age: 30 })
243
+ * const greeting = user
244
+ * .map(u => u.name)
245
+ * .map(name => name.toUpperCase())
246
+ * .map(name => `Hello, ${name}!`)
247
+ * ```
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * // With custom equality function for objects
252
+ * const items = prop([{ id: 1, name: 'Item 1' }])
253
+ * const itemNames = items.map(
254
+ * items => items.map(item => item.name),
255
+ * (a, b) => JSON.stringify(a) === JSON.stringify(b) // deep equality
256
+ * )
257
+ * ```
258
+ *
259
+ * @typeParam O - The type of the transformed value
260
+ * @param fn - Function that transforms the signal's value to a new value
261
+ * @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
262
+ * @returns A new computed signal with the transformed value
263
+ */
264
+ map = (e, s = (r, n) => r === n) => {
265
+ const r = new H(() => {
266
+ try {
267
+ return e(this.get());
268
+ } catch (n) {
269
+ throw console.error("Error in Signal.map:", n), n;
270
+ }
271
+ }, s);
272
+ return this.setDerivative(r), r;
273
+ };
274
+ /**
275
+ * Returns a new Signal that applies the given function to the value of the current Signal,
276
+ * and then flattens the resulting Signal.
277
+ *
278
+ * @typeParam O - The type of the value emitted by the resulting Signal.
279
+ * @param fn - The function to apply to the value of the current Signal.
280
+ * @param equals - A function that determines whether two values of type O are equal.
281
+ * Defaults to a strict equality check (===).
282
+ * @returns A new Signal that emits the values of the resulting Signal.
283
+ */
284
+ flatMap = (e, s = (r, n) => r === n) => {
285
+ const r = new H(() => {
286
+ try {
287
+ return e(this.get()).get();
288
+ } catch (n) {
289
+ throw console.error("Error in Signal.flatMap:", n), n;
290
+ }
291
+ }, s);
292
+ return this.setDerivative(r), r;
293
+ };
294
+ /**
295
+ * Invokes a callback function with the current value of the signal, without modifying the signal.
296
+ *
297
+ * @param fn - The callback function to be invoked with the current value of the signal.
298
+ * @returns A new signal that emits the same value as the original signal and invokes the callback function.
299
+ */
300
+ tap = (e) => this.map((s) => (e(s), s));
301
+ /**
302
+ * Returns a new Signal that emits the value at the specified key of the current value.
303
+ *
304
+ * @param key - The key of the value to retrieve.
305
+ * @returns A new Signal that emits the value at the specified key.
306
+ */
307
+ at = (e) => this.map((s) => s[e]);
308
+ /**
309
+ * @internal
310
+ */
311
+ _$;
388
312
  /**
389
313
  * Represents a collection of signals mapping to each key/field in the wrapped value.
390
314
  * @typeParam T - The type of the signals.
391
315
  */
392
316
  get $() {
393
317
  return this._$ !== void 0 ? this._$ : this._$ = new Proxy(this, {
394
- get: (e, t) => this.at(t)
318
+ get: (e, s) => this.at(s)
395
319
  });
396
320
  }
397
- };
398
- /**
399
- * Creates a Signal that holds the result of a Promise, with proper error handling.
400
- *
401
- * This static method creates a signal that starts with an initial value and updates
402
- * when the promise resolves. If the promise rejects, an optional recovery function
403
- * can provide a fallback value.
404
- *
405
- * @example
406
- * ```typescript
407
- * // Basic usage with API call
408
- * const userData = Signal.ofPromise(
409
- * fetch('/api/user').then(r => r.json()),
410
- * { loading: true }, // initial state
411
- * error => ({ error: error.message, loading: false }) // error recovery
412
- * )
413
- *
414
- * // Use in UI
415
- * Ensure(userData,
416
- * (user) => html.div('Welcome, ', user.map(u => u.name)),
417
- * () => html.div('Loading...')
418
- * )
419
- * ```
420
- *
421
- * @example
422
- * ```typescript
423
- * // With custom equality function
424
- * const config = Signal.ofPromise(
425
- * loadConfig(),
426
- * {},
427
- * () => ({}),
428
- * (a, b) => JSON.stringify(a) === JSON.stringify(b) // deep equality
429
- * )
430
- * ```
431
- *
432
- * @typeParam O - The type of the value returned by the Promise
433
- * @param promise - The Promise to use to feed the Signal
434
- * @param init - The initial value of the Signal before the Promise resolves
435
- * @param recover - Optional function to recover from Promise rejection and provide an alternative value
436
- * @param equals - Function to compare two values for equality (defaults to strict equality)
437
- * @returns A Signal that represents the result of the Promise
438
- */
439
- o(F, "ofPromise", (e, t, r, n = (i, l) => i === l) => {
440
- const i = new F(t, n);
441
- return e.then((l) => i._setAndNotify(l)).catch((l) => {
442
- r != null ? i._setAndNotify(r(l)) : console.error(
443
- "Unhandled promise rejection in Signal.ofPromise:",
444
- l
445
- );
446
- }), i;
447
- }), /**
448
- * Checks if a value is a Signal.
449
- *
450
- * @param value - The value to check.
451
- * @returns `true` if the value is a Signal, `false` otherwise.
452
- */
453
- o(F, "is", (e) => (
454
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
455
- e != null && e.$__signal__ === !0
456
- ));
457
- let d = F;
458
- const Ze = typeof queueMicrotask == "function" ? queueMicrotask : (s) => Promise.resolve().then(s);
459
- class N extends d {
321
+ filter = (e, s) => {
322
+ let r = s ?? this.get();
323
+ const n = new H(() => {
324
+ try {
325
+ const i = this.get();
326
+ return r = e(i) ? i : r;
327
+ } catch (i) {
328
+ throw console.error("Error in Signal.filter:", i), i;
329
+ }
330
+ }, this.equals);
331
+ return this.setDerivative(n), n;
332
+ };
333
+ /**
334
+ * Returns a new Computed object that applies the provided mapping function to the value of this Signal,
335
+ * and filters out values that are `undefined` or `null`.
336
+ *
337
+ * @typeParam O - The type of the mapped value.
338
+ * @param fn - The mapping function to apply to the value of this Signal.
339
+ * @param startValue - The initial value for the Computed object.
340
+ * @param equals - Optional equality function to determine if two values are equal.
341
+ * @returns - A new Computed object with the mapped and filtered values.
342
+ */
343
+ filterMap = (e, s, r = (n, i) => n === i) => {
344
+ let n = s;
345
+ const i = new H(() => {
346
+ try {
347
+ const o = this.get(), l = e(o);
348
+ return n = l ?? n;
349
+ } catch (o) {
350
+ throw console.error("Error in Signal.filterMap:", o), o;
351
+ }
352
+ }, r);
353
+ return this.setDerivative(i), i;
354
+ };
355
+ /**
356
+ * Maps the values emitted by the signal to a new value asynchronously using the provided function.
357
+ * If the function throws an error, it will be caught and logged.
358
+ * If a recovery function is provided, it will be called with the error and its return value will be used as the mapped value.
359
+ * If no recovery function is provided, the error will be logged as an unhandled promise rejection.
360
+ *
361
+ * @typeParam O - The type of the mapped value.
362
+ * @param fn - The function to map the values emitted by the signal. The second argument to this function allows to cancel the previously running mapping function if it has not completed by the time a new value is emitted.
363
+ * @param alt - The alternate value to use if the signal is disposed or the mapping function throws an error.
364
+ * @param recover - The recovery function to handle errors thrown by the mapping function.
365
+ * @param equals - The equality function to compare the mapped values for equality.
366
+ * @returns A property that holds the mapped value and can be observed for changes.
367
+ */
368
+ mapAsync = (e, s, r, n = (i, o) => i === o) => {
369
+ const i = _(s, n);
370
+ let o = 0, l = new AbortController();
371
+ return i.onDispose(
372
+ this.on(async (c) => {
373
+ const a = ++o;
374
+ l.abort(), l = new AbortController();
375
+ try {
376
+ const u = await e(c, { abortSignal: l.signal });
377
+ a === o && i.set(u);
378
+ } catch (u) {
379
+ if (a === o)
380
+ if (r != null)
381
+ i.set(r(u));
382
+ else
383
+ throw u;
384
+ }
385
+ })
386
+ ), i;
387
+ };
388
+ /**
389
+ * Maps the values of the signal using the provided function `fn`, and returns a new signal
390
+ * containing the mapped values. If the mapped value is `undefined` or `null`, it is replaced
391
+ * with the provided `alt` value.
392
+ *
393
+ * @typeParam O - The type of the mapped value.
394
+ * @param fn - The function used to map the values of the signal.
395
+ * @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
396
+ * @returns A new signal containing the mapped values.
397
+ */
398
+ mapMaybe = (e, s) => this.map((r) => e(r) ?? s);
399
+ /**
400
+ * Feeds a property into the signal and sets up disposal behavior.
401
+ * @param prop - The property to feed into the signal.
402
+ * @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
403
+ * @returns The input property.
404
+ */
405
+ feedProp = (e, s = !1) => {
406
+ const r = this.on(e.set);
407
+ return e.onDispose(r), s ? this.onDispose(e.dispose) : this.onDispose(r), e;
408
+ };
409
+ /**
410
+ * Derives a new property from the current signal.
411
+ * @param options - The options for the derived property.
412
+ * @param options.autoDisposeProp - Determines whether the derived property should be automatically disposed.
413
+ * @param options.equals - A function that determines if two values are equal.
414
+ * @returns The derived property.
415
+ */
416
+ deriveProp = ({
417
+ autoDisposeProp: e = !0,
418
+ equals: s
419
+ } = {}) => this.feedProp(_(this.get(), s), e);
420
+ /**
421
+ * Derives a new signal from the current signal. Useful to create a new signal that emits the same values as the current signal but can be disposed independently.
422
+ * @returns A new signal that emits the same values as the current signal.
423
+ */
424
+ derive = () => this.map((e) => e);
425
+ /**
426
+ * Returns a signal that emits the count of values received so far.
427
+ * @returns A signal that emits the count of values received so far.
428
+ */
429
+ count = () => {
430
+ let e = 0;
431
+ return this.map(() => ++e);
432
+ };
433
+ /**
434
+ * Adds a computed value as a derivative of the signal.
435
+ * When the computed value is disposed, it is automatically removed from the derivatives list.
436
+ * Additionally, when the computed value is disposed, it sets the signal as dirty.
437
+ * @param computed - The computed value to add as a derivative.
438
+ */
439
+ setDerivative = (e) => {
440
+ this._derivatives.push(e), e.onDispose(() => {
441
+ this._derivatives.splice(
442
+ this._derivatives.indexOf(e),
443
+ 1
444
+ );
445
+ }), e.onDispose(this.on(e.setDirty)), this.onDispose(e.dispose);
446
+ };
447
+ }
448
+ const je = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
449
+ class H extends m {
460
450
  /**
461
451
  * Represents a Signal object.
462
452
  * @param _fn - The function that returns the value of the signal.
463
453
  * @param equals - The function used to compare two values of type T for equality.
464
454
  */
465
- constructor(t, r) {
466
- super(void 0, r);
467
- /**
468
- * @internal
469
- */
470
- o(this, "$__computed__", !0);
471
- /**
472
- * @internal
473
- */
474
- o(this, "_isDirty", !1);
475
- /**
476
- * Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
477
- * If the signal is already dirty or disposed, this method does nothing.
478
- * It also marks all dependent signals as dirty and schedules a notification to update their values.
479
- */
480
- o(this, "setDirty", () => {
481
- this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((t) => t.setDirty()), this._scheduleNotify());
482
- });
483
- /**
484
- * @internal
485
- */
486
- o(this, "_scheduleCount", 0);
487
- /**
488
- * Schedules a notification to be executed asynchronously.
489
- * If the signal is dirty, it will be updated and notified.
490
- * @internal
491
- */
492
- o(this, "_scheduleNotify", () => {
493
- const t = ++this._scheduleCount;
494
- Ze(() => {
495
- this._scheduleCount !== t || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()));
496
- });
497
- });
498
- /** {@inheritDoc Signal.get} */
499
- o(this, "get", () => (this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn())), this._value));
500
- this._fn = t, this.setDirty();
455
+ constructor(e, s) {
456
+ super(void 0, s), this._fn = e, this.setDirty();
501
457
  }
502
458
  /**
503
459
  * Checks if a value is an instance of `Computed`.
@@ -505,135 +461,164 @@ class N extends d {
505
461
  * @param value - The value to check.
506
462
  * @returns `true` if the value is an instance of `Computed`, `false` otherwise.
507
463
  */
508
- static is(t) {
509
- return t != null && t.$__computed__ === !0;
464
+ static is(e) {
465
+ return e != null && e.$__computed__ === !0;
510
466
  }
467
+ /**
468
+ * @internal
469
+ */
470
+ $__computed__ = !0;
471
+ /**
472
+ * @internal
473
+ */
474
+ _isDirty = !1;
475
+ /**
476
+ * Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
477
+ * If the signal is already dirty or disposed, this method does nothing.
478
+ * It also marks all dependent signals as dirty and schedules a notification to update their values.
479
+ */
480
+ setDirty = () => {
481
+ this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((e) => e.setDirty()), this._scheduleNotify());
482
+ };
483
+ /**
484
+ * @internal
485
+ */
486
+ _scheduleCount = 0;
487
+ /**
488
+ * Schedules a notification to be executed asynchronously.
489
+ * If the signal is dirty, it will be updated and notified.
490
+ * @internal
491
+ */
492
+ _scheduleNotify = () => {
493
+ const e = ++this._scheduleCount;
494
+ je(() => {
495
+ this._scheduleCount !== e || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()));
496
+ });
497
+ };
498
+ /** {@inheritDoc Signal.get} */
499
+ get = () => (this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn())), this._value);
511
500
  /** {@inheritDoc Signal.value} */
512
501
  get value() {
513
502
  return this.get();
514
503
  }
515
504
  }
516
- const te = class te extends d {
517
- constructor() {
518
- super(...arguments);
519
- /**
520
- * @internal
521
- */
522
- o(this, "$__prop__", !0);
523
- /**
524
- * Changes the value of the property and notifies its listeners.
525
- *
526
- * @param value - The new value of the property.
527
- */
528
- o(this, "set", (t) => {
529
- this._setAndNotify(t);
530
- });
531
- /**
532
- * Updates the value of the signal by applying the provided function to the current value.
533
- * @param fn - The function to apply to the current value.
534
- */
535
- o(this, "update", (t) => {
536
- this._setAndNotify(t(this.get()));
537
- });
538
- /**
539
- * Creates a reducer function that combines the provided reducer function and effects.
540
- * @param fn - The reducer function that takes the current state and an action, and returns the new state.
541
- * @param effects - An array of effects to be executed after the state is updated.
542
- * @returns A dispatch function that can be used to update the state and trigger the effects.
543
- */
544
- o(this, "reducer", (t, ...r) => {
545
- const n = this;
546
- return function i(l) {
547
- const c = n.value;
548
- n.update((a) => t(a, l)), !n.equals(c, n.value) && r.forEach(
549
- (a) => a({
550
- previousState: c,
551
- state: n.value,
552
- action: l,
553
- dispatch: i
554
- })
555
- );
556
- };
557
- });
558
- /**
559
- * Creates an isomorphism for the Signal.
560
- * An isomorphism is a pair of functions that convert values between two types,
561
- * along with an equality function to compare values of the second type.
562
- *
563
- * @param to - A function that converts values from type T to type O.
564
- * @param from - A function that converts values from type O to type T.
565
- * @param equals - An optional function that compares values of type O for equality.
566
- * Defaults to a strict equality check (===).
567
- * @returns A Prop object representing the isomorphism.
568
- */
569
- o(this, "iso", (t, r, n = (i, l) => i === l) => {
570
- const i = new te(t(this.get()), n);
571
- return i.onDispose(this.on((l) => i.set(t(l)))), i.on((l) => this._setAndNotify(r(l))), i;
572
- });
573
- /**
574
- * Returns a `Prop` that represents the value at the specified key of the current value.
575
- *
576
- * @param key - The key of the value to access.
577
- * @returns A `Prop` that represents the value at the specified key.
578
- */
579
- o(this, "atProp", (t) => this.iso(
580
- (r) => r[t],
581
- (r) => ({ ...this.value, [t]: r })
582
- ));
583
- }
505
+ class Y extends m {
506
+ /**
507
+ * Checks if a value is a Prop.
508
+ * @param value - The value to check.
509
+ * @returns `true` if the value is a Prop, `false` otherwise.
510
+ */
511
+ static is = (e) => (
512
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
513
+ e != null && e.$__prop__ === !0
514
+ );
515
+ /**
516
+ * @internal
517
+ */
518
+ $__prop__ = !0;
519
+ /**
520
+ * Changes the value of the property and notifies its listeners.
521
+ *
522
+ * @param value - The new value of the property.
523
+ */
524
+ set = (e) => {
525
+ this._setAndNotify(e);
526
+ };
527
+ /**
528
+ * Updates the value of the signal by applying the provided function to the current value.
529
+ * @param fn - The function to apply to the current value.
530
+ */
531
+ update = (e) => {
532
+ this._setAndNotify(e(this.get()));
533
+ };
534
+ /**
535
+ * Creates a reducer function that combines the provided reducer function and effects.
536
+ * @param fn - The reducer function that takes the current state and an action, and returns the new state.
537
+ * @param effects - An array of effects to be executed after the state is updated.
538
+ * @returns A dispatch function that can be used to update the state and trigger the effects.
539
+ */
540
+ reducer = (e, ...s) => {
541
+ const r = this;
542
+ return function n(i) {
543
+ const o = r.value;
544
+ r.update((l) => e(l, i)), !r.equals(o, r.value) && s.forEach(
545
+ (l) => l({
546
+ previousState: o,
547
+ state: r.value,
548
+ action: i,
549
+ dispatch: n
550
+ })
551
+ );
552
+ };
553
+ };
554
+ /**
555
+ * Creates an isomorphism for the Signal.
556
+ * An isomorphism is a pair of functions that convert values between two types,
557
+ * along with an equality function to compare values of the second type.
558
+ *
559
+ * @param to - A function that converts values from type T to type O.
560
+ * @param from - A function that converts values from type O to type T.
561
+ * @param equals - An optional function that compares values of type O for equality.
562
+ * Defaults to a strict equality check (===).
563
+ * @returns A Prop object representing the isomorphism.
564
+ */
565
+ iso = (e, s, r = (n, i) => n === i) => {
566
+ const n = new Y(e(this.get()), r);
567
+ return n.onDispose(this.on((i) => n.set(e(i)))), n.on((i) => this._setAndNotify(s(i))), n;
568
+ };
569
+ /**
570
+ * Returns a `Prop` that represents the value at the specified key of the current value.
571
+ *
572
+ * @param key - The key of the value to access.
573
+ * @returns A `Prop` that represents the value at the specified key.
574
+ */
575
+ atProp = (e) => this.iso(
576
+ (s) => s[e],
577
+ (s) => ({ ...this.value, [e]: s })
578
+ );
584
579
  /**
585
580
  * Access for the current value of the property.
586
581
  */
587
582
  get value() {
588
583
  return this.get();
589
584
  }
590
- set value(t) {
591
- this._setAndNotify(t);
585
+ set value(e) {
586
+ this._setAndNotify(e);
592
587
  }
593
- };
594
- /**
595
- * Checks if a value is a Prop.
596
- * @param value - The value to check.
597
- * @returns `true` if the value is a Prop, `false` otherwise.
598
- */
599
- o(te, "is", (t) => (
600
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
601
- t != null && t.$__prop__ === !0
602
- ));
603
- let X = te;
604
- const ae = (s, e, t = (r, n) => r === n) => {
605
- const r = new N(s, t);
588
+ }
589
+ const re = (t, e, s = (r, n) => r === n) => {
590
+ const r = new H(t, s);
606
591
  return e.forEach((n) => n.setDerivative(r)), r;
607
- }, ze = (s, e, t = {}) => {
608
- let r = t.once ? () => {
609
- i(), s();
610
- } : s;
611
- if (t.skipInitial) {
612
- let l = !1;
613
- const c = r;
592
+ }, qe = (t, e, s = {}) => {
593
+ let r = s.once ? () => {
594
+ i(), t();
595
+ } : t;
596
+ if (s.skipInitial) {
597
+ let o = !1;
598
+ const l = r;
614
599
  r = () => {
615
- l ? c() : l = !0;
600
+ o ? l() : o = !0;
616
601
  };
617
602
  }
618
- const n = ae(r, e), i = () => {
619
- n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", i);
603
+ const n = re(r, e), i = () => {
604
+ n.dispose(), s.abortSignal != null && s.abortSignal.removeEventListener("abort", i);
620
605
  };
621
- return t.abortSignal != null && t.abortSignal.addEventListener("abort", i), i;
622
- }, w = (s, e = (t, r) => t === r) => new X(s, e), se = (s, e = (t, r) => t === r) => new d(s, e), ue = () => (
606
+ return s.abortSignal != null && s.abortSignal.addEventListener("abort", i), i;
607
+ }, _ = (t, e = (s, r) => s === r) => new Y(t, e), Q = (t, e = (s, r) => s === r) => new m(t, e), ne = () => (
623
608
  /* c8 ignore next */
624
609
  typeof window < "u" ? window : void 0
625
610
  );
626
- function Se(s) {
627
- return s != null && s !== !1 && s !== 0 && s !== "";
611
+ function he(t) {
612
+ return t != null && t !== !1 && t !== 0 && t !== "";
628
613
  }
629
- function Ke(s) {
630
- return !Se(s);
614
+ function Fe(t) {
615
+ return !he(t);
631
616
  }
632
- function et(s) {
633
- return s == null;
617
+ function Be(t) {
618
+ return t == null;
634
619
  }
635
- function tt(s) {
636
- return s != null;
620
+ function We(t) {
621
+ return t != null;
637
622
  }
638
623
  const y = {
639
624
  /**
@@ -647,7 +632,7 @@ const y = {
647
632
  * @param fn - The function to map the value.
648
633
  * @returns The mapped value.
649
634
  */
650
- map: (s, e) => d.is(s) ? s.map(e) : e(s),
635
+ map: (t, e) => m.is(t) ? t.map(e) : e(t),
651
636
  /**
652
637
  * Wraps a value or a Signal instance into a Signal.
653
638
  * If the value is already a Signal, it returns the value itself.
@@ -658,30 +643,30 @@ const y = {
658
643
  * @param equals - A function that determines if two values are equal. Defaults to strict equality (===).
659
644
  * @returns A Signal instance.
660
645
  */
661
- toSignal: (s, e) => d.is(s) ? s : se(s, e),
646
+ toSignal: (t, e) => m.is(t) ? t.derive() : Q(t, e),
662
647
  /**
663
648
  * Wraps a value in a `Signal` if it is not already a `Signal`.
664
649
  * If the value is `null` or `undefined`, it returns `null` or `undefined` respectively.
665
650
  * @param value - The value to wrap or check.
666
651
  * @returns The wrapped value if it is not `null` or `undefined`, otherwise `null` or `undefined`.
667
652
  */
668
- maybeToSignal: (s, e) => {
669
- if (s != null)
670
- return y.toSignal(s, e);
653
+ maybeToSignal: (t, e) => {
654
+ if (t != null)
655
+ return y.toSignal(t, e);
671
656
  },
672
657
  /**
673
658
  * Gets the value from a `Signal` or the value itself if it is not a `Signal`.
674
659
  * @param value - The value or Signal instance to get the value from.
675
660
  * @returns The value.
676
661
  */
677
- get: (s) => d.is(s) ? s.get() : s,
662
+ get: (t) => m.is(t) ? t.get() : t,
678
663
  /**
679
664
  * Adds a listener to a `Signal` or calls the listener immediately if it is not a `Signal`.
680
665
  * @param value - The value or Signal instance to add the listener to.
681
666
  * @param listener - The listener to call when the value changes.
682
667
  * @returns A function to remove the listener.
683
668
  */
684
- on: (s, e) => d.is(s) ? s.on(e) : (e(s), () => {
669
+ on: (t, e) => m.is(t) ? t.on(e) : (e(t), () => {
685
670
  }),
686
671
  /**
687
672
  * Disposes of a value or a Signal.
@@ -689,8 +674,8 @@ const y = {
689
674
  * If the value is not a Signal, it does nothing.
690
675
  * @param value - The value or Signal instance to dispose of.
691
676
  */
692
- dispose: (s) => {
693
- d.is(s) && s.dispose();
677
+ dispose: (t) => {
678
+ m.is(t) && t.dispose();
694
679
  },
695
680
  /**
696
681
  * Derives a Prop from a Signal.
@@ -702,522 +687,271 @@ const y = {
702
687
  * @param options.equals - A function that determines if two values are equal.
703
688
  * @returns A Prop instance.
704
689
  */
705
- deriveProp: (s, {
690
+ deriveProp: (t, {
706
691
  autoDisposeProp: e = !0,
707
- equals: t
708
- } = {}) => d.is(s) ? s.deriveProp({ autoDisposeProp: e, equals: t }) : w(s, t),
692
+ equals: s
693
+ } = {}) => m.is(t) ? t.deriveProp({ autoDisposeProp: e, equals: s }) : _(t, s),
709
694
  /**
710
695
  * Creates a new signal that emits `true` if the value is truthy, `false` otherwise.
711
696
  * @param value - The value or signal to check.
712
697
  * @returns A signal that emits `true` if the value is truthy, `false` otherwise.
713
698
  */
714
- truthy: (s) => y.map(s, Se),
699
+ truthy: (t) => y.map(t, he),
715
700
  /**
716
701
  * Creates a new signal that emits `true` if the value is falsy, `false` otherwise.
717
702
  * @param value - The value or signal to check.
718
703
  * @returns A signal that emits `true` if the value is falsy, `false` otherwise.
719
704
  */
720
- falsy: (s) => y.map(s, Ke),
705
+ falsy: (t) => y.map(t, Fe),
721
706
  /**
722
707
  * Creates a new signal that emits `true` if the value is null or undefined, `false` otherwise.
723
708
  * @param value - The value or signal to check.
724
709
  * @returns A signal that emits `true` if the value is null or undefined, `false` otherwise.
725
710
  */
726
- nil: (s) => y.map(s, et),
711
+ nil: (t) => y.map(t, Be),
727
712
  /**
728
713
  * Creates a new signal that emits `true` if the value is not null or undefined, `false` otherwise.
729
714
  * @param value - The value or signal to check.
730
715
  * @returns A signal that emits `true` if the value is not null or undefined, `false` otherwise.
731
716
  */
732
- defined: (s) => y.map(s, tt)
733
- }, he = (...s) => (e, t) => {
734
- if (s.length === 1)
735
- return y.toSignal(s[0]).map(e);
736
- const r = s.filter((n) => d.is(n));
737
- return ae(
738
- () => e(...s.map((n) => y.get(n))),
717
+ defined: (t) => y.map(t, We)
718
+ }, ie = (...t) => (e, s) => {
719
+ if (t.length === 1)
720
+ return y.toSignal(t[0]).map(e);
721
+ const r = t.filter((n) => m.is(n));
722
+ return re(
723
+ () => e(...t.map((n) => y.get(n))),
739
724
  r,
740
- t
725
+ s
741
726
  );
742
- }, qt = (s) => {
743
- const e = Object.keys(s);
744
- return he(...Object.values(s))(
745
- (...t) => Object.fromEntries(e.map((r, n) => [r, t[n]]))
727
+ }, Ht = (t) => {
728
+ const e = Object.keys(t);
729
+ return ie(...Object.values(t))(
730
+ (...s) => Object.fromEntries(e.map((r, n) => [r, s[n]]))
746
731
  );
747
- }, Ft = (...s) => (e, t = {}) => {
748
- const r = s.filter((n) => d.is(n));
749
- return ze(
750
- () => e(...s.map(y.get)),
732
+ }, kt = (...t) => (e, s = {}) => {
733
+ const r = t.filter((n) => m.is(n));
734
+ return qe(
735
+ () => e(...t.map(y.get)),
751
736
  r,
752
- t
737
+ s
753
738
  );
754
739
  };
755
- class Ae {
756
- constructor() {
757
- o(this, "_store", /* @__PURE__ */ new Map());
758
- /**
759
- * Retrieves the value associated with the specified key from the memory store.
760
- * @param key - The key to retrieve the value for.
761
- * @returns The value associated with the key, or `null` if the key is not found.
762
- */
763
- o(this, "getItem", (e) => this._store.get(e) ?? null);
764
- /**
765
- * Sets the value associated with the specified key in the memory store.
766
- * @param key - The key to set the value for.
767
- * @param value - The value to set.
768
- */
769
- o(this, "setItem", (e, t) => {
770
- this._store.set(e, t);
771
- });
772
- }
740
+ class fe {
741
+ _store = /* @__PURE__ */ new Map();
742
+ /**
743
+ * Retrieves the value associated with the specified key from the memory store.
744
+ * @param key - The key to retrieve the value for.
745
+ * @returns The value associated with the key, or `null` if the key is not found.
746
+ */
747
+ getItem = (e) => this._store.get(e) ?? null;
748
+ /**
749
+ * Sets the value associated with the specified key in the memory store.
750
+ * @param key - The key to set the value for.
751
+ * @param value - The value to set.
752
+ */
753
+ setItem = (e, s) => {
754
+ this._store.set(e, s);
755
+ };
773
756
  }
774
- const ve = ({
775
- key: s,
757
+ const de = ({
758
+ key: t,
776
759
  defaultValue: e,
777
- store: t,
760
+ store: s,
778
761
  serialize: r = JSON.stringify,
779
762
  deserialize: n = JSON.parse,
780
- equals: i = (u, h) => u === h,
781
- onLoad: l = (u) => u,
782
- syncTabs: c = !0,
783
- onKeyChange: a = "load"
763
+ equals: i = (a, u) => a === u,
764
+ onLoad: o = (a) => a,
765
+ syncTabs: l = !0,
766
+ onKeyChange: c = "load"
784
767
  }) => {
785
- let u = y.get(s);
786
- const h = t.getItem(u), p = new X(
787
- h != null ? l(n(h)) : typeof e == "function" ? e() : e,
768
+ let a = y.get(t);
769
+ const u = s.getItem(a), p = new Y(
770
+ u != null ? o(n(u)) : typeof e == "function" ? e() : e,
788
771
  i
789
- ), T = ue(), g = c && typeof (T == null ? void 0 : T.BroadcastChannel) == "function";
790
- let m = !1, S = null, P = null;
791
- const v = (b) => {
792
- if (!g) return null;
793
- const k = `tempo:storedProp:${b}`, A = new T.BroadcastChannel(k), H = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, O = (U) => {
794
- const E = U.data;
795
- if (!(E == null || typeof E != "object" || E.key !== b || typeof E.value != "string" || E.sourceId != null && E.sourceId === H))
772
+ ), d = ne(), f = l && typeof d?.BroadcastChannel == "function";
773
+ let g = !1, w = null, C = null;
774
+ const S = (b) => {
775
+ if (!f) return null;
776
+ const D = `tempo:storedProp:${b}`, A = new d.BroadcastChannel(D), O = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, x = (j) => {
777
+ const v = j.data;
778
+ if (!(v == null || typeof v != "object" || v.key !== b || typeof v.value != "string" || v.sourceId != null && v.sourceId === O))
796
779
  try {
797
- m = !0;
798
- const oe = l(n(E.value));
799
- p.set(oe);
800
- } catch (oe) {
780
+ g = !0;
781
+ const te = o(n(v.value));
782
+ p.set(te);
783
+ } catch (te) {
801
784
  console.warn(
802
785
  `Failed to sync storedProp for key "${b}" via BroadcastChannel`,
803
- oe
786
+ te
804
787
  );
805
788
  } finally {
806
- m = !1;
789
+ g = !1;
807
790
  }
808
791
  };
809
- return A.addEventListener("message", O), p.onDispose(() => {
810
- A == null || A.removeEventListener("message", O), A == null || A.close();
811
- }), { channel: A, instanceId: H, handleMessage: O };
812
- }, D = v(u);
813
- D && (S = D.channel, P = D.instanceId);
814
- const ie = (b) => {
815
- const k = u;
816
- if (k === b) return;
817
- const A = p.get(), H = r(A);
818
- if (t.setItem(k, H), S != null && (S.close(), S = null, P = null), u = b, a === "load") {
819
- const U = t.getItem(b);
820
- if (U != null)
792
+ return A.addEventListener("message", x), p.onDispose(() => {
793
+ A?.removeEventListener("message", x), A?.close();
794
+ }), { channel: A, instanceId: O, handleMessage: x };
795
+ }, P = S(a);
796
+ P && (w = P.channel, C = P.instanceId);
797
+ const ee = (b) => {
798
+ const D = a;
799
+ if (D === b) return;
800
+ const A = p.get(), O = r(A);
801
+ if (s.setItem(D, O), w != null && (w.close(), w = null, C = null), a = b, c === "load") {
802
+ const j = s.getItem(b);
803
+ if (j != null)
821
804
  try {
822
- const E = l(n(U));
823
- p.set(E);
824
- } catch (E) {
805
+ const v = o(n(j));
806
+ p.set(v);
807
+ } catch (v) {
825
808
  console.warn(
826
809
  `Failed to load storedProp from new key "${b}"`,
827
- E
810
+ v
828
811
  );
829
812
  }
830
813
  else
831
- t.setItem(b, H);
832
- } else a === "migrate" && t.setItem(b, H);
833
- const O = v(b);
834
- O && (S = O.channel, P = O.instanceId);
814
+ s.setItem(b, O);
815
+ } else c === "migrate" && s.setItem(b, O);
816
+ const x = S(b);
817
+ x && (w = x.channel, C = x.instanceId);
835
818
  };
836
- return d.is(s) && p.onDispose(s.on(ie)), p.on((b, k) => {
819
+ return m.is(t) && p.onDispose(t.on(ee)), p.on((b, D) => {
837
820
  const A = r(b);
838
- t.setItem(u, A), S != null && !m && k !== void 0 && P != null && S.postMessage({
839
- key: u,
821
+ s.setItem(a, A), w != null && !g && D !== void 0 && C != null && w.postMessage({
822
+ key: a,
840
823
  value: A,
841
- sourceId: P
824
+ sourceId: C
842
825
  });
843
826
  }), p;
844
- }, Bt = (s) => {
845
- var e;
846
- return ve({
847
- ...s,
848
- /* c8 ignore next 3 */
849
- store: ((e = ue()) == null ? void 0 : e.localStorage) ?? new Ae()
850
- });
851
- }, Wt = (s) => {
852
- var e;
853
- return ve({
854
- ...s,
855
- /* c8 ignore next 3 */
856
- store: ((e = ue()) == null ? void 0 : e.sessionStorage) ?? new Ae()
857
- });
858
- };
859
- function ye(s) {
860
- return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
827
+ }, $t = (t) => de({
828
+ ...t,
829
+ /* c8 ignore next 3 */
830
+ store: ne()?.localStorage ?? new fe()
831
+ }), Nt = (t) => de({
832
+ ...t,
833
+ /* c8 ignore next 3 */
834
+ store: ne()?.sessionStorage ?? new fe()
835
+ });
836
+ function ae(t) {
837
+ return typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : setTimeout(t, 0);
861
838
  }
862
- const st = (s, e, t, r) => {
863
- const n = (r == null ? void 0 : r.duration) ?? 300, i = (r == null ? void 0 : r.easing) ?? ((v) => v), l = (r == null ? void 0 : r.equals) ?? ((v, D) => v === D);
864
- let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), p = null, T = !0;
865
- const g = new N(e, l), m = w(s, l);
866
- m.onDispose(() => {
839
+ const Ue = (t, e, s, r) => {
840
+ const n = r?.duration ?? 300, i = r?.easing ?? ((S) => S), o = r?.equals ?? ((S, P) => S === P);
841
+ let l = r?.interpolate, c = t, a = e(), u = performance.now(), p = null, d = !0;
842
+ const f = new H(e, o), g = _(t, o);
843
+ g.onDispose(() => {
867
844
  p !== null && cancelAnimationFrame(p);
868
- }), m.onDispose(g.dispose), t.forEach((v) => {
869
- v.setDerivative(g), v.onDispose(m.dispose);
845
+ }), g.onDispose(f.dispose), s.forEach((S) => {
846
+ S.setDerivative(f), S.onDispose(g.dispose);
870
847
  });
871
- const S = (v) => {
872
- u = v, h = performance.now(), a = m.value, T && (T = !1, p = ye(P));
873
- }, P = () => {
874
- const D = (performance.now() - h) / y.get(n), ie = i(D);
875
- c == null && (c = Qe(a));
876
- let b = c(a, u, ie);
877
- D >= 1 ? (T = !0, b = u) : p = ye(P), m.set(b);
878
- };
879
- return g.on(S), m;
880
- }, Ut = (s, e) => {
881
- const { initialValue: t, ...r } = e ?? {};
882
- return st(
848
+ const w = (S) => {
849
+ a = S, u = performance.now(), c = g.value, d && (d = !1, p = ae(C));
850
+ }, C = () => {
851
+ const P = (performance.now() - u) / y.get(n), ee = i(P);
852
+ l == null && (l = Ve(c));
853
+ let b = l(c, a, ee);
854
+ P >= 1 ? (d = !0, b = a) : p = ae(C), g.set(b);
855
+ };
856
+ return f.on(w), g;
857
+ }, Rt = (t, e) => {
858
+ const { initialValue: s, ...r } = e ?? {};
859
+ return Ue(
883
860
  /* c8 ignore next 2 */
884
- t ?? s.get(),
885
- s.get,
886
- [s],
861
+ s ?? t.get(),
862
+ t.get,
863
+ [t],
887
864
  r
888
865
  );
889
- }, rt = (s, e) => {
890
- const t = Object.values(s).filter(d.is), r = Object.keys(s);
891
- return ae(() => {
866
+ }, Je = (t, e) => {
867
+ const s = Object.values(t).filter(m.is), r = Object.keys(t);
868
+ return re(() => {
892
869
  const n = {};
893
870
  for (const i of r)
894
- n[i] = y.get(s[i]);
871
+ n[i] = y.get(t[i]);
895
872
  return e(n);
896
- }, t);
897
- }, Jt = (s) => rt(s, (e) => e), Gt = (s, e) => {
898
- const t = w(s.get());
873
+ }, s);
874
+ }, Vt = (t) => Je(t, (e) => e), jt = (t, e) => {
875
+ const s = _(t.get());
899
876
  let r = null;
900
- const n = s.on((i) => {
877
+ const n = t.on((i) => {
901
878
  r != null && clearTimeout(r), r = setTimeout(
902
879
  () => {
903
- r = null, t.set(i);
880
+ r = null, s.set(i);
904
881
  },
905
882
  typeof e == "function" ? e(i) : e
906
883
  );
907
884
  });
908
- return t.onDispose(() => {
885
+ return s.onDispose(() => {
909
886
  n(), r != null && clearTimeout(r);
910
- }), t;
911
- }, Xt = (s) => {
887
+ }), s;
888
+ }, qt = (t) => {
912
889
  let e;
913
- return s.map((t) => {
890
+ return t.map((s) => {
914
891
  const r = e;
915
- return e = t, r;
892
+ return e = s, r;
916
893
  });
917
- }, Yt = ({
918
- size: s = void 0,
894
+ }, Ft = ({
895
+ size: t = void 0,
919
896
  signal: e
920
897
  }) => {
921
- const t = [];
922
- return e.map((r) => (t.push(r), s != null && t.length > s && t.shift(), t.slice()));
923
- }, Qt = (s) => (...e) => he(
924
- s,
898
+ const s = [];
899
+ return e.map((r) => (s.push(r), t != null && s.length > t && s.shift(), s.slice()));
900
+ }, Bt = (t) => (...e) => ie(
901
+ t,
925
902
  ...e
926
- )((t, ...r) => t(...r));
927
- function Zt(...s) {
928
- return he(...s)((...e) => {
929
- for (const t of e) if (t != null) return t;
903
+ )((s, ...r) => s(...r));
904
+ function Wt(...t) {
905
+ return ie(...t)((...e) => {
906
+ for (const s of e) if (s != null) return s;
930
907
  });
931
908
  }
932
- const _e = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), Ee = /* @__PURE__ */ new Set(["selected"]), Ce = /* @__PURE__ */ new Set([
909
+ const pe = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), me = /* @__PURE__ */ new Set(["selected"]), ge = /* @__PURE__ */ new Set([
933
910
  "rowSpan",
934
911
  "colSpan",
935
912
  "tabIndex",
936
- "valueAsNumber"
937
- ]), we = /* @__PURE__ */ new Set(["valueAsDate"]), xe = /* @__PURE__ */ new Set([
938
- "value",
939
- "textContent",
940
- "innerText",
941
- "innerHTML",
942
- "outerHTML",
943
- "className",
944
- "classList"
945
- ]), nt = (s, e) => Ee.has(s) ? (t) => {
946
- t == null || t !== !0 ? e.removeAttribute(s) : e.setAttribute(s, "");
947
- } : _e.has(s) ? (t) => {
948
- t == null ? e[s] = null : e[s] = !!t;
949
- } : Ce.has(s) ? (t) => {
950
- t == null ? e[s] = null : e[s] = Number(t);
951
- } : we.has(s) ? (t) => {
952
- t == null ? e[s] = null : e[s] = t;
953
- } : xe.has(s) ? (t) => {
954
- t == null ? e[s] = null : e[s] = String(t);
955
- } : (t) => {
956
- t == null ? e.removeAttribute(s) : e.setAttribute(s, t);
957
- }, it = (s, e) => Ee.has(s) ? () => e.hasAttribute(s) : _e.has(s) ? () => !!e[s] : Ce.has(s) ? () => Number(e[s]) : we.has(s) ? () => e[s] : xe.has(s) ? () => String(e[s]) : () => e.getAttribute(s), Y = (s) => {
958
- const e = s;
959
- e && e.onblur && (e.onblur = null), !(!s || s.ownerDocument === void 0) && s.parentElement && s.parentElement.removeChild(s);
960
- }, ot = (s) => Pe(s) ? s : s.parentElement, Pe = (s) => s.nodeType === 1;
961
- class De extends Error {
962
- constructor(e) {
963
- super(`Provider not found: ${e.description}`);
964
- }
965
- }
966
- class R {
967
- /**
968
- * Constructs a new `DOMContext` instance.
969
- *
970
- * @param document - The `Document` instance associated with this context.
971
- * @param element - The `Element` instance associated with this context.
972
- * @param reference - An optional `Node` instance that serves as a reference for this context.
973
- * @param providers - The `Providers` instance associated with this context.
974
- * @param isFirstLevel - A boolean value indicating whether this context is at the first level, meaning the outermost node in the generated DOM.
975
- */
976
- constructor(e, t, r, n) {
977
- /**
978
- * Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace.
979
- *
980
- * @param tagName - The tag name of the element to create.
981
- * @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
982
- * @returns The newly created element.
983
- */
984
- o(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
985
- /**
986
- * Creates a new child element and appends it to the current element, returning a new context.
987
- *
988
- * This method creates a new DOM element with the specified tag name and namespace,
989
- * appends it to the current element, and returns a new DOMContext focused on the
990
- * newly created child element. This is the primary method for building DOM trees.
991
- *
992
- * @example
993
- * ```typescript
994
- * // Create HTML elements
995
- * const divCtx = ctx.makeChildElement('div', undefined)
996
- * const spanCtx = divCtx.makeChildElement('span', undefined)
997
- *
998
- * // Create SVG elements
999
- * const svgCtx = ctx.makeChildElement('svg', 'http://www.w3.org/2000/svg')
1000
- * const circleCtx = svgCtx.makeChildElement('circle', 'http://www.w3.org/2000/svg')
1001
- * ```
1002
- *
1003
- * @param tagName - The tag name of the element to create (e.g., 'div', 'span', 'svg')
1004
- * @param namespace - The namespace URI for the element, or undefined for HTML elements
1005
- * @returns A new DOMContext focused on the newly created child element
1006
- */
1007
- o(this, "makeChildElement", (e, t) => {
1008
- const r = this.createElement(e, t);
1009
- return this.appendOrInsert(r), this.withElement(r);
1010
- });
1011
- /**
1012
- * Creates a new text node with the specified text content.
1013
- * @param text - The text content for the new text node.
1014
- * @returns A new `Text` node with the specified text content.
1015
- */
1016
- o(this, "createText", (e) => this.document.createTextNode(e));
1017
- /**
1018
- * Creates a new text node with the specified text content and appends it to the current element.
1019
- * @param text - The text content for the new text node.
1020
- * @returns A new `DOMContext` with a reference to the new text node.
1021
- */
1022
- o(this, "makeChildText", (e) => {
1023
- const t = this.createText(e);
1024
- return this.appendOrInsert(t), this.withReference(t);
1025
- });
1026
- /**
1027
- * Sets the text content of the current element.
1028
- * @param text - The text content to set.
1029
- */
1030
- o(this, "setText", (e) => {
1031
- this.reference.nodeValue = e;
1032
- });
1033
- /**
1034
- * Gets the text content of the current element or text node.
1035
- * @returns The text content of the current element or text node.
1036
- */
1037
- o(this, "getText", () => {
1038
- var e;
1039
- return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
1040
- });
1041
- /**
1042
- * Creates a new `DOMContext` with a reference to a newly created text node.
1043
- * The text node is appended or inserted to the current `DOMContext`.
1044
- * The new `DOMContext` with the reference is returned.
1045
- */
1046
- o(this, "makeRef", () => {
1047
- const e = this.createText("");
1048
- return this.appendOrInsert(e), this.withReference(e);
1049
- });
1050
- /**
1051
- * Appends or inserts a child node to the element, depending on whether a reference node is provided.
1052
- *
1053
- * @param child - The child node to append or insert.
1054
- */
1055
- o(this, "appendOrInsert", (e) => {
1056
- this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
1057
- });
1058
- /**
1059
- * Creates a new `DOMContext` instance with the provided `element`.
1060
- * @param element - The DOM element to use in the new `DOMContext` instance.
1061
- * @returns A new `DOMContext` instance with the provided `element`.
1062
- */
1063
- o(this, "withElement", (e) => new R(this.document, e, void 0, this.providers));
1064
- /**
1065
- * Creates a portal to render content in a different part of the DOM tree.
1066
- *
1067
- * Portals allow you to render child components into a DOM node that exists outside
1068
- * the parent component's DOM hierarchy. This is useful for modals, tooltips,
1069
- * dropdowns, and other UI elements that need to break out of their container's
1070
- * styling or z-index context.
1071
- *
1072
- * @example
1073
- * ```typescript
1074
- * // Portal to a modal container
1075
- * const modalCtx = ctx.makePortal('#modal-root')
1076
- * const modal = modalCtx.makeChildElement('div', undefined)
1077
- *
1078
- * // Add modal content
1079
- * modal.makeChildText('This renders in #modal-root')
1080
- * ```
1081
- *
1082
- * @example
1083
- * ```typescript
1084
- * // Portal to an existing element reference
1085
- * const tooltipContainer = document.getElementById('tooltip-container')!
1086
- * const tooltipCtx = ctx.makePortal(tooltipContainer)
1087
- *
1088
- * // Render tooltip content
1089
- * const tooltip = tooltipCtx.makeChildElement('div', undefined)
1090
- * tooltip.addClasses(['tooltip', 'tooltip-top'])
1091
- * ```
1092
- *
1093
- * @example
1094
- * ```typescript
1095
- * // Portal for dropdown menu
1096
- * const dropdownCtx = ctx.makePortal('body') // Render at body level
1097
- * const dropdown = dropdownCtx.makeChildElement('div', undefined)
1098
- * dropdown.addClasses(['dropdown-menu'])
1099
- * dropdown.setStyle('position', 'absolute')
1100
- * dropdown.setStyle('top', '100px')
1101
- * dropdown.setStyle('left', '50px')
1102
- * ```
1103
- *
1104
- * @param selector - CSS selector string or HTMLElement reference for the portal target
1105
- * @returns A new DOMContext focused on the portal target element
1106
- * @throws {Error} When the selector doesn't match any element in the document
1107
- */
1108
- o(this, "makePortal", (e) => {
1109
- const t = typeof e == "string" ? this.document.querySelector(e) : e;
1110
- if (t == null)
1111
- throw new Error(`Cannot find element by selector for portal: ${e}`);
1112
- return this.withElement(t);
1113
- });
1114
- /**
1115
- * Creates a new `DOMContext` instance with the specified reference.
1116
- *
1117
- * @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
1118
- * @returns A new `DOMContext` instance with the specified reference.
1119
- */
1120
- o(this, "withReference", (e) => new R(this.document, this.element, e, this.providers));
1121
- /**
1122
- * Sets a provider for the given provider mark.
1123
- *
1124
- * @param mark - The provider mark to set the provider for.
1125
- * @param value - The provider to set for the given mark.
1126
- * @returns A new `DOMContext` instance with the specified provider.
1127
- */
1128
- o(this, "setProvider", (e, t, r) => new R(this.document, this.element, this.reference, {
1129
- ...this.providers,
1130
- [e]: [t, r]
1131
- }));
1132
- /**
1133
- * Retrieves a provider for the given provider mark.
1134
- *
1135
- * @param mark - The provider mark to retrieve the provider for.
1136
- * @returns The provider for the given mark.
1137
- * @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
1138
- */
1139
- o(this, "getProvider", (e) => {
1140
- if (this.providers[e] === void 0)
1141
- throw new De(e);
1142
- const [t, r] = this.providers[e];
1143
- return { value: t, onUse: r };
1144
- });
1145
- o(this, "clear", (e) => {
1146
- e && (this.reference !== void 0 ? Y(this.reference) : Y(this.element));
1147
- });
1148
- /**
1149
- * Adds classes to the element.
1150
- * @param tokens - The class names to add.
1151
- */
1152
- o(this, "addClasses", (e) => {
1153
- this.element.classList.add(...e);
1154
- });
1155
- /**
1156
- * Removes classes from the element.
1157
- * @param tokens - The class names to remove.
1158
- */
1159
- o(this, "removeClasses", (e) => {
1160
- this.element.classList.remove(...e);
1161
- });
1162
- /**
1163
- * Gets the classes of the element.
1164
- * @returns The classes of the element.
1165
- */
1166
- o(this, "getClasses", () => Array.from(this.element.classList));
1167
- /**
1168
- * Adds an event listener to the element.
1169
- * @param event - The event to listen for.
1170
- * @param listener - The listener to call when the event occurs.
1171
- * @param options - The options for the event listener.
1172
- * @returns A function to remove the event listener.
1173
- */
1174
- o(this, "on", (e, t, r) => {
1175
- const n = (i) => t(i, this);
1176
- return this.element.addEventListener(e, n, r), (i) => {
1177
- i && this.element.removeEventListener(e, n, r);
1178
- };
1179
- });
1180
- /**
1181
- * Returns `true` if the context is a browser DOM context.
1182
- * @returns `true` if the context is a browser DOM context.
1183
- * @deprecated Use `isBrowser()` instead.
1184
- */
1185
- o(this, "isBrowserDOM", () => !0);
1186
- /**
1187
- * Returns `true` if the context is a browser context.
1188
- * @returns `true` if the context is a browser context.
1189
- */
1190
- o(this, "isBrowser", () => !0);
1191
- /**
1192
- * Returns `true` if the context is a headless DOM context.
1193
- * @returns `true` if the context is a headless DOM context.
1194
- */
1195
- o(this, "isHeadlessDOM", () => !1);
1196
- /**
1197
- * Returns `true` if the context is a headless context.
1198
- * @returns `true` if the context is a headless context.
1199
- */
1200
- o(this, "isHeadless", () => !1);
1201
- /**
1202
- * Sets the style of the element.
1203
- * @param name - The name of the style to set.
1204
- * @param value - The value of the style to set.
1205
- */
1206
- o(this, "setStyle", (e, t) => {
1207
- this.element.style[e] = t;
1208
- });
1209
- /**
1210
- * Gets the style of the element.
1211
- * @param name - The name of the style to get.
1212
- * @returns The value of the style.
1213
- */
1214
- o(this, "getStyle", (e) => this.element.style[e]);
1215
- o(this, "makeAccessors", (e) => ({
1216
- get: it(e, this.element),
1217
- set: nt(e, this.element)
1218
- }));
1219
- o(this, "getWindow", () => this.document.defaultView);
1220
- this.document = e, this.element = t, this.reference = r, this.providers = n;
913
+ "valueAsNumber"
914
+ ]), ye = /* @__PURE__ */ new Set(["valueAsDate"]), be = /* @__PURE__ */ new Set([
915
+ "value",
916
+ "textContent",
917
+ "innerText",
918
+ "innerHTML",
919
+ "outerHTML",
920
+ "className",
921
+ "classList"
922
+ ]), Ge = (t, e) => me.has(t) ? (s) => {
923
+ s == null || s !== !0 ? e.removeAttribute(t) : e.setAttribute(t, "");
924
+ } : pe.has(t) ? (s) => {
925
+ s == null ? e[t] = null : e[t] = !!s;
926
+ } : ge.has(t) ? (s) => {
927
+ s == null ? e[t] = null : e[t] = Number(s);
928
+ } : ye.has(t) ? (s) => {
929
+ s == null ? e[t] = null : e[t] = s;
930
+ } : be.has(t) ? (s) => {
931
+ s == null ? e[t] = null : e[t] = String(s);
932
+ } : (s) => {
933
+ s == null ? e.removeAttribute(t) : e.setAttribute(t, s);
934
+ }, Xe = (t, e) => me.has(t) ? () => e.hasAttribute(t) : pe.has(t) ? () => !!e[t] : ge.has(t) ? () => Number(e[t]) : ye.has(t) ? () => e[t] : be.has(t) ? () => String(e[t]) : () => e.getAttribute(t), B = (t) => {
935
+ const e = t;
936
+ e && e.onblur && (e.onblur = null), !(!t || t.ownerDocument === void 0) && t.parentElement && t.parentElement.removeChild(t);
937
+ }, Ye = (t) => we(t) ? t : t.parentElement, we = (t) => t.nodeType === 1;
938
+ class Se extends Error {
939
+ constructor(e) {
940
+ super(`Provider not found: ${e.description}`);
941
+ }
942
+ }
943
+ class k {
944
+ /**
945
+ * Constructs a new `DOMContext` instance.
946
+ *
947
+ * @param document - The `Document` instance associated with this context.
948
+ * @param element - The `Element` instance associated with this context.
949
+ * @param reference - An optional `Node` instance that serves as a reference for this context.
950
+ * @param providers - The `Providers` instance associated with this context.
951
+ * @param isFirstLevel - A boolean value indicating whether this context is at the first level, meaning the outermost node in the generated DOM.
952
+ */
953
+ constructor(e, s, r, n) {
954
+ this.document = e, this.element = s, this.reference = r, this.providers = n;
1221
955
  }
1222
956
  /**
1223
957
  * Creates a new `DOMContext` instance for the given `Element` and optional reference `Node`.
@@ -1227,509 +961,739 @@ class R {
1227
961
  * @param providers - The providers to associate with the `DOMContext`.
1228
962
  * @returns A new `DOMContext` instance.
1229
963
  */
1230
- static of(e, t, r) {
1231
- return new R(e.ownerDocument, e, t, r);
964
+ static of(e, s, r) {
965
+ return new k(e.ownerDocument, e, s, r);
1232
966
  }
967
+ /**
968
+ * Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace.
969
+ *
970
+ * @param tagName - The tag name of the element to create.
971
+ * @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
972
+ * @returns The newly created element.
973
+ */
974
+ createElement = (e, s) => s !== void 0 ? this.document.createElementNS(s, e) : this.document.createElement(e);
975
+ /**
976
+ * Creates a new child element and appends it to the current element, returning a new context.
977
+ *
978
+ * This method creates a new DOM element with the specified tag name and namespace,
979
+ * appends it to the current element, and returns a new DOMContext focused on the
980
+ * newly created child element. This is the primary method for building DOM trees.
981
+ *
982
+ * @example
983
+ * ```typescript
984
+ * // Create HTML elements
985
+ * const divCtx = ctx.makeChildElement('div', undefined)
986
+ * const spanCtx = divCtx.makeChildElement('span', undefined)
987
+ *
988
+ * // Create SVG elements
989
+ * const svgCtx = ctx.makeChildElement('svg', 'http://www.w3.org/2000/svg')
990
+ * const circleCtx = svgCtx.makeChildElement('circle', 'http://www.w3.org/2000/svg')
991
+ * ```
992
+ *
993
+ * @param tagName - The tag name of the element to create (e.g., 'div', 'span', 'svg')
994
+ * @param namespace - The namespace URI for the element, or undefined for HTML elements
995
+ * @returns A new DOMContext focused on the newly created child element
996
+ */
997
+ makeChildElement = (e, s) => {
998
+ const r = this.createElement(e, s);
999
+ return this.appendOrInsert(r), this.withElement(r);
1000
+ };
1001
+ /**
1002
+ * Creates a new text node with the specified text content.
1003
+ * @param text - The text content for the new text node.
1004
+ * @returns A new `Text` node with the specified text content.
1005
+ */
1006
+ createText = (e) => this.document.createTextNode(e);
1007
+ /**
1008
+ * Creates a new text node with the specified text content and appends it to the current element.
1009
+ * @param text - The text content for the new text node.
1010
+ * @returns A new `DOMContext` with a reference to the new text node.
1011
+ */
1012
+ makeChildText = (e) => {
1013
+ const s = this.createText(e);
1014
+ return this.appendOrInsert(s), this.withReference(s);
1015
+ };
1016
+ /**
1017
+ * Sets the text content of the current element.
1018
+ * @param text - The text content to set.
1019
+ */
1020
+ setText = (e) => {
1021
+ this.reference.nodeValue = e;
1022
+ };
1023
+ /**
1024
+ * Gets the text content of the current element or text node.
1025
+ * @returns The text content of the current element or text node.
1026
+ */
1027
+ getText = () => this.reference?.nodeValue ?? this.element.textContent ?? "";
1028
+ /**
1029
+ * Creates a new `DOMContext` with a reference to a newly created text node.
1030
+ * The text node is appended or inserted to the current `DOMContext`.
1031
+ * The new `DOMContext` with the reference is returned.
1032
+ */
1033
+ makeRef = () => {
1034
+ const e = this.createText("");
1035
+ return this.appendOrInsert(e), this.withReference(e);
1036
+ };
1037
+ /**
1038
+ * Appends or inserts a child node to the element, depending on whether a reference node is provided.
1039
+ *
1040
+ * @param child - The child node to append or insert.
1041
+ */
1042
+ appendOrInsert = (e) => {
1043
+ this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
1044
+ };
1045
+ /**
1046
+ * Creates a new `DOMContext` instance with the provided `element`.
1047
+ * @param element - The DOM element to use in the new `DOMContext` instance.
1048
+ * @returns A new `DOMContext` instance with the provided `element`.
1049
+ */
1050
+ withElement = (e) => new k(this.document, e, void 0, this.providers);
1051
+ /**
1052
+ * Creates a portal to render content in a different part of the DOM tree.
1053
+ *
1054
+ * Portals allow you to render child components into a DOM node that exists outside
1055
+ * the parent component's DOM hierarchy. This is useful for modals, tooltips,
1056
+ * dropdowns, and other UI elements that need to break out of their container's
1057
+ * styling or z-index context.
1058
+ *
1059
+ * @example
1060
+ * ```typescript
1061
+ * // Portal to a modal container
1062
+ * const modalCtx = ctx.makePortal('#modal-root')
1063
+ * const modal = modalCtx.makeChildElement('div', undefined)
1064
+ *
1065
+ * // Add modal content
1066
+ * modal.makeChildText('This renders in #modal-root')
1067
+ * ```
1068
+ *
1069
+ * @example
1070
+ * ```typescript
1071
+ * // Portal to an existing element reference
1072
+ * const tooltipContainer = document.getElementById('tooltip-container')!
1073
+ * const tooltipCtx = ctx.makePortal(tooltipContainer)
1074
+ *
1075
+ * // Render tooltip content
1076
+ * const tooltip = tooltipCtx.makeChildElement('div', undefined)
1077
+ * tooltip.addClasses(['tooltip', 'tooltip-top'])
1078
+ * ```
1079
+ *
1080
+ * @example
1081
+ * ```typescript
1082
+ * // Portal for dropdown menu
1083
+ * const dropdownCtx = ctx.makePortal('body') // Render at body level
1084
+ * const dropdown = dropdownCtx.makeChildElement('div', undefined)
1085
+ * dropdown.addClasses(['dropdown-menu'])
1086
+ * dropdown.setStyle('position', 'absolute')
1087
+ * dropdown.setStyle('top', '100px')
1088
+ * dropdown.setStyle('left', '50px')
1089
+ * ```
1090
+ *
1091
+ * @param selector - CSS selector string or HTMLElement reference for the portal target
1092
+ * @returns A new DOMContext focused on the portal target element
1093
+ * @throws {Error} When the selector doesn't match any element in the document
1094
+ */
1095
+ makePortal = (e) => {
1096
+ const s = typeof e == "string" ? this.document.querySelector(e) : e;
1097
+ if (s == null)
1098
+ throw new Error(`Cannot find element by selector for portal: ${e}`);
1099
+ return this.withElement(s);
1100
+ };
1101
+ /**
1102
+ * Creates a new `DOMContext` instance with the specified reference.
1103
+ *
1104
+ * @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
1105
+ * @returns A new `DOMContext` instance with the specified reference.
1106
+ */
1107
+ withReference = (e) => new k(this.document, this.element, e, this.providers);
1108
+ /**
1109
+ * Sets a provider for the given provider mark.
1110
+ *
1111
+ * @param mark - The provider mark to set the provider for.
1112
+ * @param value - The provider to set for the given mark.
1113
+ * @returns A new `DOMContext` instance with the specified provider.
1114
+ */
1115
+ setProvider = (e, s, r) => new k(this.document, this.element, this.reference, {
1116
+ ...this.providers,
1117
+ [e]: [s, r]
1118
+ });
1119
+ /**
1120
+ * Retrieves a provider for the given provider mark.
1121
+ *
1122
+ * @param mark - The provider mark to retrieve the provider for.
1123
+ * @returns The provider for the given mark.
1124
+ * @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
1125
+ */
1126
+ getProvider = (e) => {
1127
+ if (this.providers[e] === void 0)
1128
+ throw new Se(e);
1129
+ const [s, r] = this.providers[e];
1130
+ return { value: s, onUse: r };
1131
+ };
1132
+ clear = (e) => {
1133
+ e && (this.reference !== void 0 ? B(this.reference) : B(this.element));
1134
+ };
1135
+ /**
1136
+ * Adds classes to the element.
1137
+ * @param tokens - The class names to add.
1138
+ */
1139
+ addClasses = (e) => {
1140
+ this.element.classList.add(...e);
1141
+ };
1142
+ /**
1143
+ * Removes classes from the element.
1144
+ * @param tokens - The class names to remove.
1145
+ */
1146
+ removeClasses = (e) => {
1147
+ this.element.classList.remove(...e);
1148
+ };
1149
+ /**
1150
+ * Gets the classes of the element.
1151
+ * @returns The classes of the element.
1152
+ */
1153
+ getClasses = () => Array.from(this.element.classList);
1154
+ /**
1155
+ * Adds an event listener to the element.
1156
+ * @param event - The event to listen for.
1157
+ * @param listener - The listener to call when the event occurs.
1158
+ * @param options - The options for the event listener.
1159
+ * @returns A function to remove the event listener.
1160
+ */
1161
+ on = (e, s, r) => {
1162
+ const n = (i) => s(i, this);
1163
+ return this.element.addEventListener(e, n, r), (i) => {
1164
+ i && this.element.removeEventListener(e, n, r);
1165
+ };
1166
+ };
1167
+ /**
1168
+ * Returns `true` if the context is a browser DOM context.
1169
+ * @returns `true` if the context is a browser DOM context.
1170
+ * @deprecated Use `isBrowser()` instead.
1171
+ */
1172
+ isBrowserDOM = () => !0;
1173
+ /**
1174
+ * Returns `true` if the context is a browser context.
1175
+ * @returns `true` if the context is a browser context.
1176
+ */
1177
+ isBrowser = () => !0;
1178
+ /**
1179
+ * Returns `true` if the context is a headless DOM context.
1180
+ * @returns `true` if the context is a headless DOM context.
1181
+ */
1182
+ isHeadlessDOM = () => !1;
1183
+ /**
1184
+ * Returns `true` if the context is a headless context.
1185
+ * @returns `true` if the context is a headless context.
1186
+ */
1187
+ isHeadless = () => !1;
1188
+ /**
1189
+ * Sets the style of the element.
1190
+ * @param name - The name of the style to set.
1191
+ * @param value - The value of the style to set.
1192
+ */
1193
+ setStyle = (e, s) => {
1194
+ this.element.style[e] = s;
1195
+ };
1196
+ /**
1197
+ * Gets the style of the element.
1198
+ * @param name - The name of the style to get.
1199
+ * @returns The value of the style.
1200
+ */
1201
+ getStyle = (e) => this.element.style[e];
1202
+ makeAccessors = (e) => ({
1203
+ get: Xe(e, this.element),
1204
+ set: Ge(e, this.element)
1205
+ });
1206
+ getWindow = () => this.document.defaultView;
1233
1207
  }
1234
- const lt = (s) => Symbol(s), fe = (s, e) => {
1235
- const t = s(e);
1236
- return (r = !0) => t(r);
1237
- }, zt = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers: i = {} } = {}) => {
1238
- const l = typeof e == "string" ? (t ?? document).querySelector(e) : e;
1239
- if (l === null)
1240
- throw new ct(
1208
+ const Qe = (t) => Symbol(t), oe = (t, e) => {
1209
+ const s = t(e);
1210
+ return (r = !0) => s(r);
1211
+ }, Ut = (t, e, { doc: s, clear: r, disposeWithParent: n = !0, providers: i = {} } = {}) => {
1212
+ const o = typeof e == "string" ? (s ?? document).querySelector(e) : e;
1213
+ if (o === null)
1214
+ throw new Ze(
1241
1215
  `Cannot find element by selector for render: ${e}`
1242
1216
  );
1243
- r !== !1 && (t ?? l.ownerDocument) != null && l.nodeType === 1 && (l.innerHTML = "");
1244
- const c = ot(l), a = Pe(l) ? void 0 : l, u = R.of(c, a, i), h = fe(s, u);
1217
+ r !== !1 && (s ?? o.ownerDocument) != null && o.nodeType === 1 && (o.innerHTML = "");
1218
+ const l = Ye(o), c = we(o) ? void 0 : o, a = k.of(l, c, i), u = oe(t, a);
1245
1219
  let p;
1246
- return n && (p = new MutationObserver((T) => {
1247
- var g;
1248
- (g = T[0]) == null || g.removedNodes.forEach((m) => {
1249
- m === l && (p == null || p.disconnect(), h(l.nodeType !== 1));
1220
+ return n && (p = new MutationObserver((d) => {
1221
+ d[0]?.removedNodes.forEach((f) => {
1222
+ f === o && (p?.disconnect(), u(o.nodeType !== 1));
1250
1223
  });
1251
- }), p.observe(l.parentElement, {
1224
+ }), p.observe(o.parentElement, {
1252
1225
  childList: !0,
1253
1226
  subtree: !1,
1254
1227
  attributes: !1
1255
1228
  })), () => {
1256
- p == null || p.disconnect(), h(!0);
1229
+ p?.disconnect(), u(!0);
1257
1230
  };
1258
- }, Kt = (s, {
1231
+ }, Jt = (t, {
1259
1232
  startUrl: e = "https://example.com",
1260
- selector: t,
1233
+ selector: s,
1261
1234
  providers: r = {}
1262
1235
  } = {
1263
1236
  selector: "body"
1264
1237
  }) => {
1265
- const n = y.toSignal(e).deriveProp(), i = new ke(t, void 0), l = new V(i, void 0, { currentURL: n }, r);
1238
+ const n = y.toSignal(e).deriveProp(), i = new Ee(s, void 0), o = new $(i, void 0, { currentURL: n }, r);
1266
1239
  return {
1267
- clear: fe(s(), l),
1240
+ clear: oe(t(), o),
1268
1241
  root: i,
1269
1242
  currentURL: n
1270
1243
  };
1271
1244
  };
1272
- class ct extends Error {
1245
+ class Ze extends Error {
1273
1246
  constructor(e) {
1274
1247
  super(e);
1275
1248
  }
1276
1249
  }
1277
- const Le = "data-tts-node", Q = "data-tts-class", Z = "data-tts-style", z = "data-tts-html", K = "data-tts-text", ee = "data-tts-attrs";
1278
- class es {
1250
+ const Te = "data-tts-node", W = "data-tts-class", U = "data-tts-style", J = "data-tts-html", G = "data-tts-text", X = "data-tts-attrs";
1251
+ class Gt {
1252
+ /**
1253
+ * Selects elements from the headless environment.
1254
+ * @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
1255
+ * @returns An array of elements.
1256
+ */
1257
+ select;
1258
+ /**
1259
+ * Gets the value of an attribute from an element.
1260
+ * @param el - The element to get the attribute from.
1261
+ * @param attr - The attribute to get the value from.
1262
+ * @returns The value of the attribute or null if the attribute is not set.
1263
+ */
1264
+ getAttribute;
1265
+ /**
1266
+ * Sets the value of an attribute on an element.
1267
+ * @param el - The element to set the attribute on.
1268
+ * @param attr - The attribute to set the value of.
1269
+ * @param value - The value to set the attribute to.
1270
+ */
1271
+ setAttribute;
1272
+ /**
1273
+ * Gets the class of an element.
1274
+ * @param el - The element to get the class from.
1275
+ * @returns The class of the element or an empty string if the class is not set.
1276
+ */
1277
+ getClass;
1278
+ /**
1279
+ * Sets the class of an element.
1280
+ * @param el - The element to set the class on.
1281
+ * @param cls - The class to set.
1282
+ */
1283
+ setClass;
1284
+ /**
1285
+ * Gets the styles of an element.
1286
+ * @param el - The element to get the styles from.
1287
+ * @returns The styles of the element.
1288
+ */
1289
+ getStyles;
1290
+ /**
1291
+ * Sets the styles of an element.
1292
+ * @param el - The element to set the styles on.
1293
+ */
1294
+ setStyles;
1295
+ /**
1296
+ * Appends HTML to an element.
1297
+ * @param el - The element to append the HTML to.
1298
+ * @param html - The HTML to append.
1299
+ */
1300
+ appendHTML;
1301
+ /**
1302
+ * Gets the inner HTML of an element.
1303
+ * @param el - The element to get the inner HTML from.
1304
+ * @returns The inner HTML of the element or an empty string if the inner HTML is not set.
1305
+ */
1306
+ getInnerHTML;
1307
+ /**
1308
+ * Sets the inner HTML of an element.
1309
+ * @param el - The element to set the inner HTML on.
1310
+ * @param html - The inner HTML to set.
1311
+ */
1312
+ setInnerHTML;
1313
+ /**
1314
+ * Gets the inner text of an element.
1315
+ * @param el - The element to get the inner text from.
1316
+ * @returns The inner text of the element or an empty string if the inner text is not set.
1317
+ */
1318
+ getInnerText;
1319
+ /**
1320
+ * Sets the inner text of an element.
1321
+ * @param el - The element to set the inner text on.
1322
+ * @param text - The inner text to set.
1323
+ */
1324
+ setInnerText;
1279
1325
  constructor({
1280
1326
  select: e,
1281
- getAttribute: t,
1327
+ getAttribute: s,
1282
1328
  setAttribute: r,
1283
1329
  getClass: n,
1284
1330
  setClass: i,
1285
- getStyles: l,
1286
- setStyles: c,
1287
- appendHTML: a,
1288
- getInnerHTML: u,
1289
- setInnerHTML: h,
1331
+ getStyles: o,
1332
+ setStyles: l,
1333
+ appendHTML: c,
1334
+ getInnerHTML: a,
1335
+ setInnerHTML: u,
1290
1336
  getInnerText: p,
1291
- setInnerText: T
1337
+ setInnerText: d
1292
1338
  }) {
1293
- /**
1294
- * Selects elements from the headless environment.
1295
- * @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
1296
- * @returns An array of elements.
1297
- */
1298
- o(this, "select");
1299
- /**
1300
- * Gets the value of an attribute from an element.
1301
- * @param el - The element to get the attribute from.
1302
- * @param attr - The attribute to get the value from.
1303
- * @returns The value of the attribute or null if the attribute is not set.
1304
- */
1305
- o(this, "getAttribute");
1306
- /**
1307
- * Sets the value of an attribute on an element.
1308
- * @param el - The element to set the attribute on.
1309
- * @param attr - The attribute to set the value of.
1310
- * @param value - The value to set the attribute to.
1311
- */
1312
- o(this, "setAttribute");
1313
- /**
1314
- * Gets the class of an element.
1315
- * @param el - The element to get the class from.
1316
- * @returns The class of the element or an empty string if the class is not set.
1317
- */
1318
- o(this, "getClass");
1319
- /**
1320
- * Sets the class of an element.
1321
- * @param el - The element to set the class on.
1322
- * @param cls - The class to set.
1323
- */
1324
- o(this, "setClass");
1325
- /**
1326
- * Gets the styles of an element.
1327
- * @param el - The element to get the styles from.
1328
- * @returns The styles of the element.
1329
- */
1330
- o(this, "getStyles");
1331
- /**
1332
- * Sets the styles of an element.
1333
- * @param el - The element to set the styles on.
1334
- */
1335
- o(this, "setStyles");
1336
- /**
1337
- * Appends HTML to an element.
1338
- * @param el - The element to append the HTML to.
1339
- * @param html - The HTML to append.
1340
- */
1341
- o(this, "appendHTML");
1342
- /**
1343
- * Gets the inner HTML of an element.
1344
- * @param el - The element to get the inner HTML from.
1345
- * @returns The inner HTML of the element or an empty string if the inner HTML is not set.
1346
- */
1347
- o(this, "getInnerHTML");
1348
- /**
1349
- * Sets the inner HTML of an element.
1350
- * @param el - The element to set the inner HTML on.
1351
- * @param html - The inner HTML to set.
1352
- */
1353
- o(this, "setInnerHTML");
1354
- /**
1355
- * Gets the inner text of an element.
1356
- * @param el - The element to get the inner text from.
1357
- * @returns The inner text of the element or an empty string if the inner text is not set.
1358
- */
1359
- o(this, "getInnerText");
1360
- /**
1361
- * Sets the inner text of an element.
1362
- * @param el - The element to set the inner text on.
1363
- * @param text - The inner text to set.
1364
- */
1365
- o(this, "setInnerText");
1366
- /**
1367
- * Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
1368
- * returned by `runHeadless`.
1369
- *
1370
- * @param root - The HeadlessPortal containing the content to set.
1371
- * @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
1372
- * when you render on the server and then hydrate on the client.
1373
- */
1374
- o(this, "setFromRoot", (e, t) => {
1375
- e.getPortals().forEach((n) => {
1376
- const i = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
1377
- for (const l of i) {
1378
- if (l == null)
1379
- throw new Error(
1380
- `Cannot find element by selector for render: ${n.selector}`
1381
- );
1382
- if (n.hasChildren() && this.appendHTML(l, n.contentToHTML(t)), n.hasInnerHTML()) {
1383
- if (t) {
1384
- const c = this.getInnerHTML(l);
1385
- c != null && this.setAttribute(l, z, c);
1386
- }
1387
- this.setInnerHTML(l, n.getInnerHTML());
1339
+ this.select = e, this.getAttribute = s, this.setAttribute = r, this.getClass = n, this.setClass = i, this.getStyles = o, this.setStyles = l, this.appendHTML = c, this.getInnerHTML = a, this.setInnerHTML = u, this.getInnerText = p, this.setInnerText = d;
1340
+ }
1341
+ /**
1342
+ * Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
1343
+ * returned by `runHeadless`.
1344
+ *
1345
+ * @param root - The HeadlessPortal containing the content to set.
1346
+ * @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
1347
+ * when you render on the server and then hydrate on the client.
1348
+ */
1349
+ setFromRoot = (e, s) => {
1350
+ e.getPortals().forEach((n) => {
1351
+ const i = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
1352
+ for (const o of i) {
1353
+ if (o == null)
1354
+ throw new Error(
1355
+ `Cannot find element by selector for render: ${n.selector}`
1356
+ );
1357
+ if (n.hasChildren() && this.appendHTML(o, n.contentToHTML(s)), n.hasInnerHTML()) {
1358
+ if (s) {
1359
+ const l = this.getInnerHTML(o);
1360
+ l != null && this.setAttribute(o, J, l);
1388
1361
  }
1389
- if (n.hasInnerText()) {
1390
- if (t) {
1391
- const c = this.getInnerText(l);
1392
- c != null && this.setAttribute(l, K, c);
1393
- }
1394
- this.setInnerText(l, n.getInnerText());
1362
+ this.setInnerHTML(o, n.getInnerHTML());
1363
+ }
1364
+ if (n.hasInnerText()) {
1365
+ if (s) {
1366
+ const l = this.getInnerText(o);
1367
+ l != null && this.setAttribute(o, G, l);
1395
1368
  }
1396
- if (n.hasClasses()) {
1397
- if (t) {
1398
- const c = this.getClass(l);
1399
- c != null && this.setAttribute(l, Q, c);
1400
- }
1401
- this.setClass(l, n.getClasses().join(" "));
1369
+ this.setInnerText(o, n.getInnerText());
1370
+ }
1371
+ if (n.hasClasses()) {
1372
+ if (s) {
1373
+ const l = this.getClass(o);
1374
+ l != null && this.setAttribute(o, W, l);
1402
1375
  }
1403
- if (n.hasStyles()) {
1404
- if (t) {
1405
- const c = this.getStyles(l);
1406
- Object.keys(c).length > 0 && this.setAttribute(
1407
- l,
1408
- Z,
1409
- JSON.stringify(c)
1410
- );
1411
- }
1412
- this.setStyles(l, n.getStyles());
1376
+ this.setClass(o, n.getClasses().join(" "));
1377
+ }
1378
+ if (n.hasStyles()) {
1379
+ if (s) {
1380
+ const l = this.getStyles(o);
1381
+ Object.keys(l).length > 0 && this.setAttribute(
1382
+ o,
1383
+ U,
1384
+ JSON.stringify(l)
1385
+ );
1413
1386
  }
1414
- if (n.hasAttributes()) {
1415
- const c = n.getAttributes();
1416
- if (t) {
1417
- const a = [];
1418
- c.forEach(([u]) => {
1419
- const h = this.getAttribute(l, u);
1420
- h != null && a.push([u, h]);
1421
- }), a.length > 0 && this.setAttribute(
1422
- l,
1423
- ee,
1424
- JSON.stringify(Object.fromEntries(a))
1425
- );
1426
- }
1427
- c.forEach(([a, u]) => {
1428
- this.setAttribute(l, a, u);
1429
- });
1387
+ this.setStyles(o, n.getStyles());
1388
+ }
1389
+ if (n.hasAttributes()) {
1390
+ const l = n.getAttributes();
1391
+ if (s) {
1392
+ const c = [];
1393
+ l.forEach(([a]) => {
1394
+ const u = this.getAttribute(o, a);
1395
+ u != null && c.push([a, u]);
1396
+ }), c.length > 0 && this.setAttribute(
1397
+ o,
1398
+ X,
1399
+ JSON.stringify(Object.fromEntries(c))
1400
+ );
1430
1401
  }
1402
+ l.forEach(([c, a]) => {
1403
+ this.setAttribute(o, c, a);
1404
+ });
1431
1405
  }
1432
- });
1406
+ }
1433
1407
  });
1434
- this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass = i, this.getStyles = l, this.setStyles = c, this.appendHTML = a, this.getInnerHTML = u, this.setInnerHTML = h, this.getInnerText = p, this.setInnerText = T;
1435
- }
1408
+ };
1436
1409
  }
1437
- const at = () => {
1438
- document.querySelectorAll(`[${Le}]`).forEach(Y);
1439
- }, ut = (s) => {
1440
- const e = s.getAttribute(Q);
1441
- s.removeAttribute(Q), e != null && s.setAttribute("class", e);
1442
- }, ht = () => {
1443
- document.querySelectorAll(`[${Q}]`).forEach((e) => ut(e));
1444
- }, ft = (s) => {
1445
- const e = s.getAttribute(z);
1446
- s.removeAttribute(z), e != null && (s.innerHTML = e);
1447
- }, dt = () => {
1448
- document.querySelectorAll(`[${z}]`).forEach((e) => ft(e));
1449
- }, pt = (s) => {
1450
- const e = s.getAttribute(K);
1451
- s.removeAttribute(K), e != null && (s.innerText = e);
1452
- }, gt = () => {
1453
- document.querySelectorAll(`[${K}]`).forEach((e) => pt(e));
1454
- }, Me = (s) => JSON.parse(s.replace(/&quot;/g, '"')), mt = (s) => {
1455
- const e = s.getAttribute(Z);
1456
- if (s.removeAttribute(Z), e != null) {
1457
- const t = Me(e);
1458
- Object.entries(t).forEach(([r, n]) => {
1459
- s.style.setProperty(r, n);
1410
+ const ze = () => {
1411
+ document.querySelectorAll(`[${Te}]`).forEach(B);
1412
+ }, Ke = (t) => {
1413
+ const e = t.getAttribute(W);
1414
+ t.removeAttribute(W), e != null && t.setAttribute("class", e);
1415
+ }, et = () => {
1416
+ document.querySelectorAll(`[${W}]`).forEach((e) => Ke(e));
1417
+ }, tt = (t) => {
1418
+ const e = t.getAttribute(J);
1419
+ t.removeAttribute(J), e != null && (t.innerHTML = e);
1420
+ }, st = () => {
1421
+ document.querySelectorAll(`[${J}]`).forEach((e) => tt(e));
1422
+ }, rt = (t) => {
1423
+ const e = t.getAttribute(G);
1424
+ t.removeAttribute(G), e != null && (t.innerText = e);
1425
+ }, nt = () => {
1426
+ document.querySelectorAll(`[${G}]`).forEach((e) => rt(e));
1427
+ }, ve = (t) => JSON.parse(t.replace(/&quot;/g, '"')), it = (t) => {
1428
+ const e = t.getAttribute(U);
1429
+ if (t.removeAttribute(U), e != null) {
1430
+ const s = ve(e);
1431
+ Object.entries(s).forEach(([r, n]) => {
1432
+ t.style.setProperty(r, n);
1460
1433
  });
1461
1434
  }
1462
- }, yt = () => {
1463
- document.querySelectorAll(`[${Z}]`).forEach((e) => mt(e));
1464
- }, Tt = (s) => {
1465
- const e = s.getAttribute(ee);
1466
- if (s.removeAttribute(ee), e != null) {
1467
- const t = Me(e);
1468
- Object.entries(t).forEach(([r, n]) => {
1469
- n == null ? s.removeAttribute(r) : s.setAttribute(r, n);
1435
+ }, ot = () => {
1436
+ document.querySelectorAll(`[${U}]`).forEach((e) => it(e));
1437
+ }, lt = (t) => {
1438
+ const e = t.getAttribute(X);
1439
+ if (t.removeAttribute(X), e != null) {
1440
+ const s = ve(e);
1441
+ Object.entries(s).forEach(([r, n]) => {
1442
+ n == null ? t.removeAttribute(r) : t.setAttribute(r, n);
1470
1443
  });
1471
1444
  }
1472
- }, bt = () => {
1473
- document.querySelectorAll(`[${ee}]`).forEach((e) => Tt(e));
1474
- }, ts = () => {
1475
- at(), ht(), gt(), dt(), yt(), bt();
1476
- }, C = Symbol("class"), L = Symbol("style"), $ = Symbol("handler"), Oe = () => Math.random().toString(36).substring(2, 15), St = (s) => s.replace(/<[^>]*>?/g, "");
1477
- class Ie {
1445
+ }, ct = () => {
1446
+ document.querySelectorAll(`[${X}]`).forEach((e) => lt(e));
1447
+ }, Xt = () => {
1448
+ ze(), et(), nt(), st(), ot(), ct();
1449
+ }, M = Symbol("class"), I = Symbol("style"), q = Symbol("handler"), Ae = () => Math.random().toString(36).substring(2, 15), at = (t) => t.replace(/<[^>]*>?/g, "");
1450
+ class _e {
1478
1451
  constructor(e) {
1479
- o(this, "id", Oe());
1480
- o(this, "properties", {});
1481
- o(this, "children", []);
1482
- o(this, "isElement", () => !0);
1483
- o(this, "isText", () => !1);
1484
- o(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? St(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
1485
- o(this, "removeChild", (e) => {
1486
- const t = this.children.indexOf(e);
1487
- t !== -1 && this.children.splice(t, 1);
1488
- });
1489
- o(this, "remove", () => {
1490
- if (this.parent != null)
1491
- this.parent.removeChild(this);
1492
- else
1493
- throw new Error("Parent is undefined");
1494
- });
1495
- o(this, "getPortals", () => {
1496
- const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
1497
- return this.isPortal() && e.unshift(this), e;
1498
- });
1499
- o(this, "elements", () => this.children.filter((e) => e.isElement()));
1500
- o(this, "hasInnerHTML", () => this.properties.innerHTML != null);
1501
- o(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
1502
- o(this, "getInnerText", () => this.properties.innerText ?? "");
1503
- o(this, "hasInnerText", () => this.properties.innerText != null);
1504
- o(this, "hasChildren", () => this.children.length > 0);
1505
- o(this, "hasClasses", () => this.properties[C] != null);
1506
- o(this, "hasStyles", () => this.properties[L] != null);
1507
- o(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
1508
- o(this, "hasHandlers", () => this.properties[$] != null);
1509
- o(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
1510
- o(this, "getById", (e) => {
1511
- if (this.properties.id === e)
1512
- return this;
1513
- for (const t of this.elements()) {
1514
- const r = t.getById(e);
1515
- if (r != null)
1516
- return r;
1517
- }
1518
- });
1519
- o(this, "trigger", (e, t) => {
1520
- ((this.properties[$] ?? {})[e] ?? []).forEach((n) => n(t));
1521
- });
1522
- o(this, "click", () => {
1523
- this.trigger("click", {});
1524
- });
1525
- o(this, "on", (e, t, r, n) => {
1526
- var a;
1527
- const i = (a = this.properties)[$] ?? (a[$] = {}), l = n != null && n.once ? (u) => {
1528
- c(), t(u, r);
1529
- } : (u) => t(u, r);
1530
- i[e] = [...i[e] ?? [], l];
1531
- const c = () => {
1532
- const u = i[e] ?? [], h = u.indexOf(l);
1533
- h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[$]) : i[e] = u, (n == null ? void 0 : n.signal) != null && n.signal.removeEventListener("abort", c));
1534
- };
1535
- return (n == null ? void 0 : n.signal) != null && n.signal.addEventListener("abort", c), c;
1536
- });
1537
- o(this, "addClasses", (e) => {
1538
- var r;
1539
- if (e.length === 0)
1540
- return;
1541
- const t = (r = this.properties)[C] ?? (r[C] = []);
1542
- e.forEach((n) => {
1543
- t.includes(n) || t.push(n);
1544
- });
1545
- });
1546
- o(this, "removeClasses", (e) => {
1547
- var r;
1548
- if (e.length === 0)
1549
- return;
1550
- const t = (r = this.properties)[C] ?? (r[C] = []);
1551
- e.forEach((n) => {
1552
- const i = t.indexOf(n);
1553
- i !== -1 && t.splice(i, 1);
1554
- }), t.length === 0 && delete this.properties[C];
1555
- });
1556
- o(this, "getClasses", () => this.properties[C] ?? []);
1557
- o(this, "getAttributes", () => Object.entries(this.properties).filter(
1558
- ([e]) => !["innerText", "innerHTML"].includes(e)
1559
- ));
1560
- o(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
1561
- (e) => e === C ? [["class", this.getClasses()]] : e === L ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
1562
- ));
1563
- o(this, "setStyle", (e, t) => {
1564
- var n;
1565
- const r = (n = this.properties)[L] ?? (n[L] = {});
1566
- r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[L]);
1567
- });
1568
- o(this, "getStyle", (e) => {
1569
- var t;
1570
- return ((t = this.properties[L]) == null ? void 0 : t[e]) ?? "";
1571
- });
1572
- o(this, "getStyles", () => this.properties[L] ?? {});
1573
- o(this, "makeAccessors", (e) => {
1574
- const t = this.properties;
1575
- return {
1576
- get: () => t[e],
1577
- set: (r) => t[e] = r
1578
- };
1579
- });
1580
1452
  this.parent = e;
1581
1453
  }
1582
- }
1583
- const At = (s) => s.replace(/"/g, "&quot;"), vt = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1584
- class _t extends Ie {
1585
- constructor(t, r, n) {
1586
- super(n);
1587
- o(this, "isPortal", () => !1);
1588
- o(this, "toHTML", (t = !1) => {
1589
- const r = this.children.map((a) => a.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
1590
- let i = null;
1591
- const l = this.getVisibleAttributes().map(([a, u]) => a === "class" ? ` class="${u.join(" ")}"` : a === "style" ? typeof u == "string" ? ` style="${u}"` : ` style="${Object.entries(u).map(([h, p]) => `${h}: ${p};`).join(" ")}"` : Ct.has(a) ? ` ${a}` : a === "innerHTML" ? (i = u, "") : a === "innerText" ? (i = vt(u), "") : ` ${a}="${At(u)}"`).join(""), c = t ? ` ${Le}` : "";
1592
- return wt.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${i ?? r}</${this.tagName}>`;
1454
+ id = Ae();
1455
+ properties = {};
1456
+ children = [];
1457
+ isElement = () => !0;
1458
+ isText = () => !1;
1459
+ getText = () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? at(this.properties.innerHTML) : this.children.map((e) => e.getText()).join("");
1460
+ removeChild = (e) => {
1461
+ const s = this.children.indexOf(e);
1462
+ s !== -1 && this.children.splice(s, 1);
1463
+ };
1464
+ remove = () => {
1465
+ if (this.parent != null)
1466
+ this.parent.removeChild(this);
1467
+ else
1468
+ throw new Error("Parent is undefined");
1469
+ };
1470
+ getPortals = () => {
1471
+ const e = this.elements().flatMap((s) => s.isPortal() ? [s, ...s.getPortals()] : s.getPortals());
1472
+ return this.isPortal() && e.unshift(this), e;
1473
+ };
1474
+ elements = () => this.children.filter((e) => e.isElement());
1475
+ hasInnerHTML = () => this.properties.innerHTML != null;
1476
+ getInnerHTML = () => this.properties.innerHTML ?? "";
1477
+ getInnerText = () => this.properties.innerText ?? "";
1478
+ hasInnerText = () => this.properties.innerText != null;
1479
+ hasChildren = () => this.children.length > 0;
1480
+ hasClasses = () => this.properties[M] != null;
1481
+ hasStyles = () => this.properties[I] != null;
1482
+ hasAttributes = () => Object.keys(this.properties).length > 0;
1483
+ hasHandlers = () => this.properties[q] != null;
1484
+ hasRenderableProperties = () => this.hasClasses() || this.hasAttributes() || this.hasStyles();
1485
+ getById = (e) => {
1486
+ if (this.properties.id === e)
1487
+ return this;
1488
+ for (const s of this.elements()) {
1489
+ const r = s.getById(e);
1490
+ if (r != null)
1491
+ return r;
1492
+ }
1493
+ };
1494
+ trigger = (e, s) => {
1495
+ ((this.properties[q] ?? {})[e] ?? []).forEach((n) => n(s));
1496
+ };
1497
+ click = () => {
1498
+ this.trigger("click", {});
1499
+ };
1500
+ on = (e, s, r, n) => {
1501
+ const i = this.properties[q] ??= {}, o = n?.once ? (c) => {
1502
+ l(), s(c, r);
1503
+ } : (c) => s(c, r);
1504
+ i[e] = [...i[e] ?? [], o];
1505
+ const l = () => {
1506
+ const c = i[e] ?? [], a = c.indexOf(o);
1507
+ a !== -1 && (c.splice(a, 1), c.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[q]) : i[e] = c, n?.signal != null && n.signal.removeEventListener("abort", l));
1508
+ };
1509
+ return n?.signal != null && n.signal.addEventListener("abort", l), l;
1510
+ };
1511
+ addClasses = (e) => {
1512
+ if (e.length === 0)
1513
+ return;
1514
+ const s = this.properties[M] ??= [];
1515
+ e.forEach((r) => {
1516
+ s.includes(r) || s.push(r);
1593
1517
  });
1594
- this.tagName = t, this.namespace = r;
1518
+ };
1519
+ removeClasses = (e) => {
1520
+ if (e.length === 0)
1521
+ return;
1522
+ const s = this.properties[M] ??= [];
1523
+ e.forEach((r) => {
1524
+ const n = s.indexOf(r);
1525
+ n !== -1 && s.splice(n, 1);
1526
+ }), s.length === 0 && delete this.properties[M];
1527
+ };
1528
+ getClasses = () => this.properties[M] ?? [];
1529
+ getAttributes = () => Object.entries(this.properties).filter(
1530
+ ([e]) => !["innerText", "innerHTML"].includes(e)
1531
+ );
1532
+ getVisibleAttributes = () => Reflect.ownKeys(this.properties).flatMap(
1533
+ (e) => e === M ? [["class", this.getClasses()]] : e === I ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
1534
+ );
1535
+ setStyle = (e, s) => {
1536
+ const r = this.properties[I] ??= {};
1537
+ r[e] = s, s === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[I]);
1538
+ };
1539
+ getStyle = (e) => this.properties[I]?.[e] ?? "";
1540
+ getStyles = () => this.properties[I] ?? {};
1541
+ makeAccessors = (e) => {
1542
+ const s = this.properties;
1543
+ return {
1544
+ get: () => s[e],
1545
+ set: (r) => s[e] = r
1546
+ };
1547
+ };
1548
+ }
1549
+ const ut = (t) => t.replace(/"/g, "&quot;"), ht = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1550
+ class ft extends _e {
1551
+ constructor(e, s, r) {
1552
+ super(r), this.tagName = e, this.namespace = s;
1595
1553
  }
1554
+ isPortal = () => !1;
1555
+ toHTML = (e = !1) => {
1556
+ const s = this.children.map((l) => l.toHTML()).join(""), r = this.namespace ? ` xmlns="${this.namespace}"` : "";
1557
+ let n = null;
1558
+ const i = this.getVisibleAttributes().map(([l, c]) => l === "class" ? ` class="${c.join(" ")}"` : l === "style" ? typeof c == "string" ? ` style="${c}"` : ` style="${Object.entries(c).map(([a, u]) => `${a}: ${u};`).join(" ")}"` : pt.has(l) ? ` ${l}` : l === "innerHTML" ? (n = c, "") : l === "innerText" ? (n = ht(c), "") : ` ${l}="${ut(c)}"`).join(""), o = e ? ` ${Te}` : "";
1559
+ return mt.has(this.tagName) && s === "" ? `<${this.tagName}${r}${i}${o} />` : `<${this.tagName}${r}${i}${o}>${n ?? s}</${this.tagName}>`;
1560
+ };
1596
1561
  }
1597
- class ke extends Ie {
1598
- constructor(t, r) {
1599
- super(r);
1600
- o(this, "isPortal", () => !0);
1601
- o(this, "toHTML", () => "");
1602
- o(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
1603
- this.selector = t;
1562
+ class Ee extends _e {
1563
+ constructor(e, s) {
1564
+ super(s), this.selector = e;
1604
1565
  }
1566
+ isPortal = () => !0;
1567
+ toHTML = () => "";
1568
+ contentToHTML = (e = !1) => this.children.map((s) => s.toHTML(e)).join("");
1605
1569
  }
1606
- class Et {
1570
+ class dt {
1607
1571
  constructor(e) {
1608
- o(this, "id", Oe());
1609
- o(this, "isElement", () => !1);
1610
- o(this, "isText", () => !0);
1611
- o(this, "getText", () => this.text);
1612
- o(this, "toHTML", () => this.text);
1613
1572
  this.text = e;
1614
1573
  }
1574
+ id = Ae();
1575
+ isElement = () => !1;
1576
+ isText = () => !0;
1577
+ getText = () => this.text;
1578
+ toHTML = () => this.text;
1615
1579
  }
1616
- class V {
1617
- constructor(e, t, r, n) {
1618
- o(this, "appendOrInsert", (e) => {
1619
- if (this.reference != null) {
1620
- const t = this.element.children.indexOf(this.reference);
1621
- this.element.children.splice(t, 0, e);
1622
- } else
1623
- this.element.children.push(e);
1624
- });
1625
- o(this, "makeChildElement", (e, t) => {
1626
- const r = new _t(e, t, this.element);
1627
- return this.appendOrInsert(r), new V(
1628
- r,
1629
- void 0,
1630
- this.container,
1631
- this.providers
1632
- );
1633
- });
1634
- o(this, "makeChildText", (e) => {
1635
- const t = new Et(e);
1636
- return this.appendOrInsert(t), new V(
1637
- this.element,
1638
- t,
1639
- this.container,
1640
- this.providers
1641
- );
1642
- });
1643
- o(this, "setText", (e) => {
1644
- this.reference && this.reference.isText() && (this.reference.text = e);
1645
- });
1646
- o(this, "getText", () => {
1647
- var e;
1648
- return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
1649
- });
1650
- o(this, "makeRef", () => this.makeChildText(""));
1651
- o(this, "makePortal", (e) => {
1652
- const t = new ke(e, this.element);
1653
- return this.appendOrInsert(t), new V(
1654
- t,
1655
- void 0,
1656
- this.container,
1657
- this.providers
1658
- );
1659
- });
1660
- /**
1661
- * Sets a provider for the given provider mark.
1662
- *
1663
- * @param mark - The provider mark to set the provider for.
1664
- * @param value - The provider to set for the given mark.
1665
- * @returns A new `DOMContext` instance with the specified provider.
1666
- */
1667
- o(this, "setProvider", (e, t, r) => new V(this.element, this.reference, this.container, {
1668
- ...this.providers,
1669
- [e]: [t, r]
1670
- }));
1671
- o(this, "getProvider", (e) => {
1672
- if (this.providers[e] === void 0)
1673
- throw new De(e);
1674
- const [t, r] = this.providers[e];
1675
- return { value: t, onUse: r };
1676
- });
1677
- o(this, "clear", (e) => {
1678
- e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
1679
- });
1680
- o(this, "on", (e, t) => this.element.on(e, t, this));
1681
- o(this, "addClasses", (e) => this.element.addClasses(e));
1682
- o(this, "removeClasses", (e) => this.element.removeClasses(e));
1683
- o(this, "getClasses", () => this.element.getClasses());
1684
- o(this, "isBrowserDOM", () => !1);
1685
- o(this, "isBrowser", () => !1);
1686
- o(this, "isHeadlessDOM", () => !0);
1687
- o(this, "isHeadless", () => !0);
1688
- o(this, "setStyle", (e, t) => this.element.setStyle(e, t));
1689
- o(this, "getStyle", (e) => this.element.getStyle(e));
1690
- o(this, "makeAccessors", (e) => this.element.makeAccessors(e));
1691
- this.element = e, this.reference = t, this.container = r, this.providers = n;
1580
+ class $ {
1581
+ constructor(e, s, r, n) {
1582
+ this.element = e, this.reference = s, this.container = r, this.providers = n;
1692
1583
  }
1584
+ appendOrInsert = (e) => {
1585
+ if (this.reference != null) {
1586
+ const s = this.element.children.indexOf(this.reference);
1587
+ this.element.children.splice(s, 0, e);
1588
+ } else
1589
+ this.element.children.push(e);
1590
+ };
1591
+ makeChildElement = (e, s) => {
1592
+ const r = new ft(e, s, this.element);
1593
+ return this.appendOrInsert(r), new $(
1594
+ r,
1595
+ void 0,
1596
+ this.container,
1597
+ this.providers
1598
+ );
1599
+ };
1600
+ makeChildText = (e) => {
1601
+ const s = new dt(e);
1602
+ return this.appendOrInsert(s), new $(
1603
+ this.element,
1604
+ s,
1605
+ this.container,
1606
+ this.providers
1607
+ );
1608
+ };
1609
+ setText = (e) => {
1610
+ this.reference && this.reference.isText() && (this.reference.text = e);
1611
+ };
1612
+ getText = () => this.reference?.getText() ?? this.element.getText();
1613
+ makeRef = () => this.makeChildText("");
1614
+ makePortal = (e) => {
1615
+ const s = new Ee(e, this.element);
1616
+ return this.appendOrInsert(s), new $(
1617
+ s,
1618
+ void 0,
1619
+ this.container,
1620
+ this.providers
1621
+ );
1622
+ };
1623
+ /**
1624
+ * Sets a provider for the given provider mark.
1625
+ *
1626
+ * @param mark - The provider mark to set the provider for.
1627
+ * @param value - The provider to set for the given mark.
1628
+ * @returns A new `DOMContext` instance with the specified provider.
1629
+ */
1630
+ setProvider = (e, s, r) => new $(this.element, this.reference, this.container, {
1631
+ ...this.providers,
1632
+ [e]: [s, r]
1633
+ });
1634
+ getProvider = (e) => {
1635
+ if (this.providers[e] === void 0)
1636
+ throw new Se(e);
1637
+ const [s, r] = this.providers[e];
1638
+ return { value: s, onUse: r };
1639
+ };
1640
+ clear = (e) => {
1641
+ e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
1642
+ };
1643
+ on = (e, s) => this.element.on(e, s, this);
1644
+ addClasses = (e) => this.element.addClasses(e);
1645
+ removeClasses = (e) => this.element.removeClasses(e);
1646
+ getClasses = () => this.element.getClasses();
1647
+ isBrowserDOM = () => !1;
1648
+ isBrowser = () => !1;
1649
+ isHeadlessDOM = () => !0;
1650
+ isHeadless = () => !0;
1651
+ setStyle = (e, s) => this.element.setStyle(e, s);
1652
+ getStyle = (e) => this.element.getStyle(e);
1653
+ makeAccessors = (e) => this.element.makeAccessors(e);
1693
1654
  }
1694
- const Ct = /* @__PURE__ */ new Set([
1655
+ const pt = /* @__PURE__ */ new Set([
1695
1656
  "checked",
1696
1657
  "disabled",
1697
1658
  "multiple",
1698
1659
  "readonly",
1699
1660
  "required",
1700
1661
  "selected"
1701
- ]), wt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), He = (s) => (e) => e.makeChildText(s).clear, $e = (s) => (e) => {
1702
- const t = e.makeChildText(s.value), r = s.on(t.setText);
1662
+ ]), mt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), Ce = (t) => (e) => e.makeChildText(t).clear, Pe = (t) => (e) => {
1663
+ const s = e.makeChildText(t.value), r = t.on(s.setText);
1703
1664
  return (n) => {
1704
- r(), t.clear(n);
1665
+ r(), s.clear(n);
1705
1666
  };
1706
- }, ss = (s) => d.is(s) ? $e(s) : He(s), _ = (...s) => (e) => {
1707
- const t = s.map((r) => f(r)(e));
1667
+ }, Yt = (t) => m.is(t) ? Pe(t) : Ce(t), T = (...t) => (e) => {
1668
+ const s = t.map((r) => h(r)(e));
1708
1669
  return (r) => {
1709
- t.forEach((n) => n(r));
1710
- };
1711
- }, x = () => () => {
1712
- }, xt = (s) => (e) => (e.addClasses(s), (t) => {
1713
- t && e.removeClasses(s);
1714
- }), Pt = (s) => (e) => {
1715
- let t = [];
1716
- const r = s.on((n) => {
1717
- e.removeClasses(t), t = (n ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(t);
1670
+ s.forEach((n) => n(r));
1671
+ };
1672
+ }, E = () => () => {
1673
+ }, gt = (t) => (e) => (e.addClasses(t), (s) => {
1674
+ s && e.removeClasses(t);
1675
+ }), yt = (t) => (e) => {
1676
+ let s = [];
1677
+ const r = t.on((n) => {
1678
+ e.removeClasses(s), s = (n ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(s);
1718
1679
  });
1719
1680
  return (n) => {
1720
- r(), n && e.removeClasses(t), t.length = 0;
1681
+ r(), n && e.removeClasses(s), s.length = 0;
1721
1682
  };
1722
- }, B = (s, e) => (t) => {
1723
- const { get: r, set: n } = t.makeAccessors(s), i = r();
1724
- return n(e), (l) => {
1725
- l && n(i);
1683
+ }, bt = (t, e) => (s) => {
1684
+ const { get: r, set: n } = s.makeAccessors(t), i = r();
1685
+ return n(e), (o) => {
1686
+ o && n(i);
1726
1687
  };
1727
- }, W = (s, e) => (t) => {
1728
- const { get: r, set: n } = t.makeAccessors(s), i = r(), l = e.on(n);
1729
- return (c) => {
1730
- l(), c && n(i);
1688
+ }, wt = (t, e) => (s) => {
1689
+ const { get: r, set: n } = s.makeAccessors(t), i = r(), o = e.on(n);
1690
+ return (l) => {
1691
+ o(), l && n(i);
1731
1692
  };
1732
- }, j = new Proxy(
1693
+ }, N = (t, e) => m.is(e) ? wt(t, e) : bt(t, e), Z = (t = "") => (e, s) => {
1694
+ const r = t ? `${t}${e}` : e;
1695
+ return N(r, s);
1696
+ }, R = new Proxy(
1733
1697
  {},
1734
1698
  {
1735
1699
  /**
@@ -1743,18 +1707,12 @@ const Ct = /* @__PURE__ */ new Set([
1743
1707
  * @returns The renderable component for the specified attribute.
1744
1708
  *
1745
1709
  */
1746
- get: (s, e) => e === "class" ? (t) => d.is(t) ? Pt(t) : xt(
1710
+ get: (t, e) => e === "class" ? (s) => m.is(s) ? yt(s) : gt(
1747
1711
  /* c8 ignore next */
1748
- (t ?? "").split(" ").filter((r) => r.length > 0)
1749
- ) : (t) => d.is(t) ? W(
1750
- e,
1751
- t
1752
- ) : B(
1753
- e,
1754
- t
1755
- )
1712
+ (s ?? "").split(" ").filter((r) => r.length > 0)
1713
+ ) : e === "set" ? Z() : (s) => N(e, s)
1756
1714
  }
1757
- ), rs = new Proxy(
1715
+ ), Qt = new Proxy(
1758
1716
  {},
1759
1717
  {
1760
1718
  /**
@@ -1765,12 +1723,9 @@ const Ct = /* @__PURE__ */ new Set([
1765
1723
  * @returns The renderable component for the specified attribute.
1766
1724
  *
1767
1725
  */
1768
- get: (s, e) => (t) => d.is(t) ? W(
1769
- `data-${e}`,
1770
- t
1771
- ) : B(`data-${e}`, t)
1726
+ get: (t, e) => e === "set" ? Z("data-") : (s) => N(`data-${e}`, s)
1772
1727
  }
1773
- ), ns = new Proxy(
1728
+ ), Zt = new Proxy(
1774
1729
  {},
1775
1730
  {
1776
1731
  /**
@@ -1781,15 +1736,9 @@ const Ct = /* @__PURE__ */ new Set([
1781
1736
  * @returns The renderable component for the specified attribute.
1782
1737
  *
1783
1738
  */
1784
- get: (s, e) => (t) => d.is(t) ? W(
1785
- `aria-${e}`,
1786
- t
1787
- ) : B(
1788
- `aria-${e}`,
1789
- t
1790
- )
1739
+ get: (t, e) => e === "set" ? Z("aria-") : (s) => N(`aria-${e}`, s)
1791
1740
  }
1792
- ), is = new Proxy(
1741
+ ), zt = new Proxy(
1793
1742
  {},
1794
1743
  {
1795
1744
  /**
@@ -1800,15 +1749,9 @@ const Ct = /* @__PURE__ */ new Set([
1800
1749
  * @returns The renderable component for the specified attribute.
1801
1750
  *
1802
1751
  */
1803
- get: (s, e) => (t) => d.is(t) ? W(
1804
- e,
1805
- t
1806
- ) : B(
1807
- e,
1808
- t
1809
- )
1752
+ get: (t, e) => e === "set" ? Z() : (s) => N(e, s)
1810
1753
  }
1811
- ), os = new Proxy(
1754
+ ), Kt = new Proxy(
1812
1755
  {},
1813
1756
  {
1814
1757
  /**
@@ -1818,37 +1761,31 @@ const Ct = /* @__PURE__ */ new Set([
1818
1761
  * @returns The renderable component for the specified attribute.
1819
1762
  *
1820
1763
  */
1821
- get: (s, e) => (t) => d.is(t) ? W(
1822
- e,
1823
- t
1824
- ) : B(
1825
- e,
1826
- t
1827
- )
1764
+ get: (t, e) => (s) => N(e, s)
1828
1765
  }
1829
- ), f = (s) => {
1830
- if (s == null)
1831
- return x;
1832
- if (Array.isArray(s))
1833
- return _(...s.map(f));
1834
- if (typeof s == "string")
1835
- return He(s);
1836
- if (d.is(s))
1837
- return $e(s);
1838
- if (typeof s == "function")
1839
- return s;
1840
- throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
1841
- }, Ne = (s, ...e) => (t) => {
1842
- const r = t.makeChildElement(s, void 0), n = e.map((i) => f(i)(r));
1766
+ ), h = (t) => {
1767
+ if (t == null)
1768
+ return E;
1769
+ if (Array.isArray(t))
1770
+ return T(...t.map(h));
1771
+ if (typeof t == "string")
1772
+ return Ce(t);
1773
+ if (m.is(t))
1774
+ return Pe(t);
1775
+ if (typeof t == "function")
1776
+ return t;
1777
+ throw new Error(`Unknown type: '${typeof t}' for child: ${t}`);
1778
+ }, xe = (t, ...e) => (s) => {
1779
+ const r = s.makeChildElement(t, void 0), n = e.map((i) => h(i)(r));
1843
1780
  return (i) => {
1844
- n.forEach((l) => l(!1)), r.clear(i);
1781
+ n.forEach((o) => o(!1)), r.clear(i);
1845
1782
  };
1846
- }, Re = (s, e, ...t) => (r) => {
1847
- const n = r.makeChildElement(s, e), i = t.map((l) => f(l)(n));
1848
- return (l) => {
1849
- i.forEach((c) => c(!1)), n.clear(l);
1783
+ }, Le = (t, e, ...s) => (r) => {
1784
+ const n = r.makeChildElement(t, e), i = s.map((o) => h(o)(n));
1785
+ return (o) => {
1786
+ i.forEach((l) => l(!1)), n.clear(o);
1850
1787
  };
1851
- }, ls = new Proxy(
1788
+ }, es = new Proxy(
1852
1789
  {},
1853
1790
  {
1854
1791
  /**
@@ -1856,9 +1793,9 @@ const Ct = /* @__PURE__ */ new Set([
1856
1793
  * @param tagName - The HTML tag name.
1857
1794
  * @returns A renderable function that creates and appends the HTML element to the DOM.
1858
1795
  */
1859
- get: (s, e) => (...t) => Ne(e, t.flatMap(f))
1796
+ get: (t, e) => (...s) => xe(e, s.flatMap(h))
1860
1797
  }
1861
- ), cs = new Proxy(
1798
+ ), ts = new Proxy(
1862
1799
  {},
1863
1800
  {
1864
1801
  /**
@@ -1866,9 +1803,9 @@ const Ct = /* @__PURE__ */ new Set([
1866
1803
  * @param type - The input type name.
1867
1804
  * @returns A renderable function that creates and appends the HTMLInput element to the DOM.
1868
1805
  */
1869
- get: (s, e) => (...t) => Ne("input", j.type(e), ...t)
1806
+ get: (t, e) => (...s) => xe("input", R.type(e), ...s)
1870
1807
  }
1871
- ), Dt = "http://www.w3.org/2000/svg", as = new Proxy(
1808
+ ), St = "http://www.w3.org/2000/svg", ss = new Proxy(
1872
1809
  {},
1873
1810
  {
1874
1811
  /**
@@ -1876,9 +1813,9 @@ const Ct = /* @__PURE__ */ new Set([
1876
1813
  * @param tagName - The SVG tag name.
1877
1814
  * @returns A renderable function that creates and appends the SVG element to the DOM.
1878
1815
  */
1879
- get: (s, e) => (...t) => Re(e, Dt, t.flatMap(f))
1816
+ get: (t, e) => (...s) => Le(e, St, s.flatMap(h))
1880
1817
  }
1881
- ), Lt = "http://www.w3.org/1998/Math/MathML", us = new Proxy(
1818
+ ), Tt = "http://www.w3.org/1998/Math/MathML", rs = new Proxy(
1882
1819
  {},
1883
1820
  {
1884
1821
  /**
@@ -1886,35 +1823,35 @@ const Ct = /* @__PURE__ */ new Set([
1886
1823
  * @param tagName - The Math tag name.
1887
1824
  * @returns A renderable function that creates and appends the Math element to the DOM.
1888
1825
  */
1889
- get: (s, e) => (...t) => Re(e, Lt, t.flatMap(f))
1826
+ get: (t, e) => (...s) => Le(e, Tt, s.flatMap(h))
1890
1827
  }
1891
- ), Ve = (s, e) => {
1828
+ ), De = (t, e) => {
1892
1829
  if (typeof e == "function")
1893
- return Ve(s, { then: e });
1894
- const t = e.pending != null ? f(e.pending()) : x, r = e.then, n = e.error != null ? (i) => f(e.error(i)) : () => x;
1830
+ return De(t, { then: e });
1831
+ const s = e.pending != null ? h(e.pending()) : E, r = e.then, n = e.error != null ? (i) => h(e.error(i)) : () => E;
1895
1832
  return (i) => {
1896
- let l = !0;
1897
- const c = s(), a = i.makeRef();
1898
- let u = f(t)(a);
1899
- return c.then(
1900
- (h) => {
1901
- l && (u(!0), u = f(r(h))(a));
1833
+ let o = !0;
1834
+ const l = t(), c = i.makeRef();
1835
+ let a = h(s)(c);
1836
+ return l.then(
1837
+ (u) => {
1838
+ o && (a(!0), a = h(r(u))(c));
1902
1839
  },
1903
- (h) => {
1904
- l && (u(!0), u = f(n(h))(a));
1840
+ (u) => {
1841
+ o && (a(!0), a = h(n(u))(c));
1905
1842
  }
1906
- ), (h) => {
1907
- l = !1, u(h), a.clear(h);
1843
+ ), (u) => {
1844
+ o = !1, a(u), c.clear(u);
1908
1845
  };
1909
1846
  };
1910
- }, hs = (s, e) => Ve(() => s, e), je = (s, e, t) => (r) => r.on(s, e, t), Mt = (s) => je("click", (e, t) => {
1847
+ }, ns = (t, e) => De(() => t, e), Oe = (t, e, s) => (r) => r.on(t, e, s), vt = (t) => Oe("click", (e, s) => {
1911
1848
  e.preventDefault();
1912
1849
  const r = e.target;
1913
1850
  setTimeout(() => {
1914
- const n = r.ownerDocument != null ? r == null ? void 0 : r.checked : void 0;
1915
- n != null && s(!n, t);
1851
+ const n = r.ownerDocument != null ? r?.checked : void 0;
1852
+ n != null && t(!n, s);
1916
1853
  }, 0);
1917
- }), re = new Proxy(
1854
+ }), z = new Proxy(
1918
1855
  {},
1919
1856
  {
1920
1857
  /**
@@ -1922,321 +1859,334 @@ const Ct = /* @__PURE__ */ new Set([
1922
1859
  * @param fn - The function to call when the event is triggered.
1923
1860
  * @returns A `Renderable` function that adds the event listener to the element.
1924
1861
  */
1925
- get: (s, e) => (t) => je(e, t)
1862
+ get: (t, e) => (s) => Oe(e, s)
1926
1863
  }
1927
- ), Ot = (s, e) => (t) => {
1928
- (e == null ? void 0 : e.preventDefault) === !0 && t.preventDefault(), (e == null ? void 0 : e.stopPropagation) === !0 && t.stopPropagation(), (e == null ? void 0 : e.stopImmediatePropagation) === !0 && t.stopImmediatePropagation(), s(t);
1929
- }, I = (s, e) => Ot((t) => {
1930
- const r = t.target;
1931
- s(r, t);
1932
- }, e), It = (s, e) => I(
1933
- (t, r) => s(t.value, r),
1864
+ ), At = (t, e) => (s) => {
1865
+ e?.preventDefault === !0 && s.preventDefault(), e?.stopPropagation === !0 && s.stopPropagation(), e?.stopImmediatePropagation === !0 && s.stopImmediatePropagation(), t(s);
1866
+ }, L = (t, e) => At((s) => {
1867
+ const r = s.target;
1868
+ t(r, s);
1869
+ }, e), _t = (t, e) => L(
1870
+ (s, r) => t(s.value, r),
1934
1871
  e
1935
- ), kt = (s, e) => I(
1936
- (t, r) => s(t.valueAsNumber, r),
1872
+ ), Et = (t, e) => L(
1873
+ (s, r) => t(s.valueAsNumber, r),
1937
1874
  e
1938
- ), Ht = (s, e) => I((t, r) => {
1939
- if (t.value === "")
1875
+ ), Ct = (t, e) => L((s, r) => {
1876
+ if (s.value === "")
1940
1877
  return;
1941
- const n = t.value.split("-"), i = new Date(
1878
+ const n = s.value.split("-"), i = new Date(
1942
1879
  Number(n[0]),
1943
1880
  Number(n[1]) - 1,
1944
1881
  Number(n[2].substring(0, 2))
1945
1882
  );
1946
- s(i, r);
1947
- }, e), fs = (s, e) => I((t, r) => {
1948
- if (t.value === "") {
1949
- s(null, r);
1883
+ t(i, r);
1884
+ }, e), is = (t, e) => L((s, r) => {
1885
+ if (s.value === "") {
1886
+ t(null, r);
1950
1887
  return;
1951
1888
  }
1952
- const n = t.value.split("-"), i = new Date(
1889
+ const n = s.value.split("-"), i = new Date(
1953
1890
  Number(n[0]),
1954
1891
  Number(n[1]) - 1,
1955
1892
  Number(n[2].substring(0, 2))
1956
1893
  );
1957
- s(i, r);
1958
- }, e), $t = (s, e) => I((t, r) => {
1959
- if (t.value === "")
1894
+ t(i, r);
1895
+ }, e), Pt = (t, e) => L((s, r) => {
1896
+ if (s.value === "")
1960
1897
  return;
1961
- const n = t.value.split("T"), i = n[0].split("-"), l = new Date(
1898
+ const n = s.value.split("T"), i = n[0].split("-"), o = new Date(
1962
1899
  Number(i[0]),
1963
1900
  Number(i[1]) - 1,
1964
1901
  Number(i[2])
1965
- ), c = n[1].split(":");
1966
- l.setHours(Number(c[0])), l.setMinutes(Number(c[1])), l.setSeconds(Number(c[2])), s(l, r);
1967
- }, e), ds = (s, e) => I((t, r) => {
1968
- if (t.value === "") {
1969
- s(null, r);
1902
+ ), l = n[1].split(":");
1903
+ o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), t(o, r);
1904
+ }, e), os = (t, e) => L((s, r) => {
1905
+ if (s.value === "") {
1906
+ t(null, r);
1970
1907
  return;
1971
1908
  }
1972
- const n = t.value.split("T");
1909
+ const n = s.value.split("T");
1973
1910
  if (n.length !== 2) {
1974
- s(null, r);
1911
+ t(null, r);
1975
1912
  return;
1976
1913
  }
1977
- const i = n[0].split("-"), l = new Date(
1914
+ const i = n[0].split("-"), o = new Date(
1978
1915
  Number(i[0]),
1979
1916
  Number(i[1]) - 1,
1980
1917
  Number(i[2])
1981
- ), c = n[1].split(":");
1982
- l.setHours(Number(c[0] ?? 0)), l.setMinutes(Number(c[1] ?? 0)), l.setSeconds(Number(c[2] ?? 0)), s(l, r);
1983
- }, e), ps = (s, e) => I((t, r) => {
1984
- s(t.checked, r);
1985
- }, e), gs = (s, e = "input") => _(j.valueAsDate(s), re[e](Ht(s.set))), ms = (s, e = "input") => _(j.valueAsDate(s), re[e]($t(s.set))), ys = (s, e = "input") => _(j.valueAsNumber(s), re[e](kt(s.set))), Ts = (s, e = "input") => _(j.value(s), re[e](It(s.set))), bs = (s) => _(j.checked(s), Mt(s.set)), ne = (s, e) => {
1986
- if (d.is(s))
1987
- return (r) => {
1988
- const n = r.makeRef();
1989
- let i, l;
1990
- const c = s.map((h) => Object.keys(h)[0]);
1991
- let a;
1992
- const u = c.on((h) => {
1993
- if (h !== a) {
1994
- a = h, l == null || l.dispose(), i == null || i(!0), l = s.map((T) => T[h]);
1995
- const p = e[h](l);
1996
- i = f(p)(n);
1918
+ ), l = n[1].split(":");
1919
+ o.setHours(Number(l[0] ?? 0)), o.setMinutes(Number(l[1] ?? 0)), o.setSeconds(Number(l[2] ?? 0)), t(o, r);
1920
+ }, e), ls = (t, e) => L((s, r) => {
1921
+ t(s.checked, r);
1922
+ }, e), cs = (t, e = "input") => T(R.valueAsDate(t), z[e](Ct(t.set))), as = (t, e = "input") => T(R.valueAsDate(t), z[e](Pt(t.set))), us = (t, e = "input") => T(R.valueAsNumber(t), z[e](Et(t.set))), hs = (t, e = "input") => T(R.value(t), z[e](_t(t.set))), fs = (t) => T(R.checked(t), vt(t.set)), le = (t, e, s) => m.is(t) ? e(t) : s(t), xt = (t, e, s) => {
1923
+ const r = t.makeRef();
1924
+ let n = () => {
1925
+ };
1926
+ const i = e.on((o) => {
1927
+ n(!0), n = h(s(o))(r);
1928
+ });
1929
+ return (o) => {
1930
+ n(o), i(), r.clear(o);
1931
+ };
1932
+ }, K = (t, e) => {
1933
+ function s(n) {
1934
+ return (i) => {
1935
+ const o = i.makeRef();
1936
+ let l, c;
1937
+ const a = n.map((d) => Object.keys(d)[0]);
1938
+ let u;
1939
+ const p = a.on((d) => {
1940
+ if (d !== u) {
1941
+ u = d, c?.dispose(), l?.(!0), c = n.map((g) => g[d]);
1942
+ const f = e[d](c);
1943
+ l = h(f)(o);
1997
1944
  }
1998
1945
  });
1999
- return (h) => {
2000
- l == null || l.dispose(), u(), n.clear(h), i == null || i(h);
1946
+ return (d) => {
1947
+ c?.dispose(), p(), o.clear(d), l?.(d);
2001
1948
  };
2002
1949
  };
2003
- const t = Object.keys(s)[0];
2004
- return f(e[t](se(s[t])));
2005
- }, qe = (s, e, t) => ne(
2006
- y.map(s, (r) => ({ [r[e]]: r })),
1950
+ }
1951
+ function r(n) {
1952
+ const i = Object.keys(n)[0];
1953
+ return h(e[i](Q(n[i])));
1954
+ }
1955
+ return le(t, s, r);
1956
+ }, Me = (t, e, s) => K(
1957
+ y.map(t, (r) => ({ [r[e]]: r })),
2007
1958
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2008
- t
2009
- ), Ss = (s, e) => qe(s, "kind", e), As = (s, e) => {
2010
- const t = y.map(s, ([r, n]) => ({ [r]: n }));
2011
- return ne(t, e);
2012
- }, vs = (s, e) => qe(s, "type", e), Nt = (s, e) => ne(
2013
- y.map(s, (t) => ({ [t]: !0 })),
1959
+ s
1960
+ ), ds = (t, e) => Me(t, "kind", e), ps = (t, e) => {
1961
+ const s = y.map(t, ([r, n]) => ({ [r]: n }));
1962
+ return K(s, e);
1963
+ }, ms = (t, e) => Me(t, "type", e), Lt = (t, e) => K(
1964
+ y.map(t, (s) => ({ [s]: !0 })),
2014
1965
  e
2015
- ), _s = (s, e = {}) => (t) => {
2016
- const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
2017
- return Nt(
2018
- t.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
1966
+ ), gs = (t, e = {}) => (s) => {
1967
+ const r = e?.firstSeparator ?? t, n = e?.lastSeparator ?? t;
1968
+ return Lt(
1969
+ s.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
2019
1970
  {
2020
1971
  first: r,
2021
1972
  last: n,
2022
- other: s
1973
+ other: t
2023
1974
  }
2024
1975
  );
2025
- }, Es = (s) => (e) => (e.appendOrInsert(s), (t) => {
2026
- t && Y(s);
2027
- }), Cs = (s, e, t) => {
2028
- if (d.is(s)) {
2029
- const r = s;
2030
- return (n) => {
2031
- const i = n.makeRef();
2032
- let l = () => {
2033
- }, c = !1, a = null;
2034
- const u = r.on((h) => {
2035
- h == null ? (l(!0), l = f(t == null ? void 0 : t())(i), c = !1, a == null || a.dispose(), a = null) : c ? a.set(h) : (a = w(h), l(!0), l = f(e(a))(
2036
- i
2037
- ), c = !0);
1976
+ }, ys = (t) => (e) => (e.appendOrInsert(t), (s) => {
1977
+ s && B(t);
1978
+ }), bs = (t, e, s) => {
1979
+ function r(i) {
1980
+ return (o) => {
1981
+ const l = o.makeRef();
1982
+ let c = () => {
1983
+ }, a = !1, u = null;
1984
+ const p = i.on((d) => {
1985
+ d == null ? (c(!0), c = h(s?.())(l), a = !1, u?.dispose(), u = null) : a ? u.set(d) : (u = _(d), c(!0), c = h(e(u))(
1986
+ l
1987
+ ), a = !0);
2038
1988
  });
2039
- return (h) => {
2040
- a == null || a.dispose(), u(), l == null || l(h), i.clear(h);
1989
+ return (d) => {
1990
+ u?.dispose(), p(), c?.(d), l.clear(d);
2041
1991
  };
2042
1992
  };
2043
- } else {
2044
- const r = s;
2045
- if (r == null) {
2046
- const n = t == null ? void 0 : t();
2047
- return n != null ? f(n) : x;
1993
+ }
1994
+ function n(i) {
1995
+ if (i == null) {
1996
+ const o = s?.();
1997
+ return o != null ? h(o) : E;
2048
1998
  }
2049
- return f(e(se(r)));
1999
+ return h(e(Q(i)));
2050
2000
  }
2051
- }, ws = (...s) => (e, t) => (r) => {
2001
+ return le(
2002
+ t,
2003
+ r,
2004
+ n
2005
+ );
2006
+ }, ws = (...t) => (e, s) => (r) => {
2052
2007
  const n = r.makeRef();
2053
- if (s.some(
2054
- (g) => !d.is(g) && g == null
2008
+ if (t.some(
2009
+ (f) => !m.is(f) && f == null
2055
2010
  ))
2056
- return (t != null ? f(t == null ? void 0 : t()) : x)(
2011
+ return (s != null ? h(s?.()) : E)(
2057
2012
  n
2058
2013
  );
2059
- const l = s.map(() => null), c = s.map(
2060
- (g) => d.is(g) ? g.value != null : g != null
2014
+ const o = t.map(() => null), l = t.map(
2015
+ (f) => m.is(f) ? f.value != null : f != null
2061
2016
  );
2062
- let a = null;
2063
- const u = w(c.every((g) => g)), h = (g, m) => {
2064
- if (g.value != null) {
2065
- if (l[m] == null) {
2066
- const S = w(g.value);
2067
- l[m] = S;
2017
+ let c = null;
2018
+ const a = _(l.every((f) => f)), u = (f, g) => {
2019
+ if (f.value != null) {
2020
+ if (o[g] == null) {
2021
+ const w = _(f.value);
2022
+ o[g] = w;
2068
2023
  } else
2069
- l[m].value = g.value;
2070
- c[m] = !0;
2024
+ o[g].value = f.value;
2025
+ l[g] = !0;
2071
2026
  } else
2072
- c[m] = !1;
2027
+ l[g] = !1;
2073
2028
  };
2074
- let p = s.length - 1;
2075
- const T = s.map((g, m) => {
2076
- if (!d.is(g)) {
2077
- const S = w(g);
2078
- return l[m] = S, () => {
2029
+ let p = t.length - 1;
2030
+ const d = t.map((f, g) => {
2031
+ if (!m.is(f)) {
2032
+ const w = _(f);
2033
+ return o[g] = w, () => {
2079
2034
  };
2080
2035
  }
2081
- return g.on(() => {
2082
- h(g, m), p === 0 ? u.value = c.every((S) => S) : p--;
2036
+ return f.on(() => {
2037
+ u(f, g), p === 0 ? a.value = l.every((w) => w) : p--;
2083
2038
  });
2084
2039
  });
2085
- return u.on((g) => {
2086
- a == null || a(!0), a = null, g ? a = f(e(...l))(n) : a = f((t == null ? void 0 : t()) ?? x)(n);
2087
- }), (g) => {
2088
- l.forEach((m) => m == null ? void 0 : m.dispose()), u.dispose(), T.forEach((m) => m()), a == null || a(g), n.clear(g);
2089
- };
2090
- }, q = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), Fe = (s, e, t) => {
2091
- if (d.is(s)) {
2092
- const r = s;
2093
- return (n) => {
2094
- const i = n.makeRef();
2095
- let l = () => {
2096
- };
2097
- const c = r.on((a) => {
2098
- l(!0), a ? l = f(e())(i) : l = f(t == null ? void 0 : t())(i);
2099
- });
2100
- return (a) => {
2101
- l(a), c(), i.clear(a);
2102
- };
2103
- };
2104
- } else {
2105
- if (s) {
2040
+ return a.on((f) => {
2041
+ c?.(!0), c = null, f ? c = h(e(...o))(n) : c = h(s?.() ?? E)(n);
2042
+ }), (f) => {
2043
+ o.forEach((g) => g?.dispose()), a.dispose(), d.forEach((g) => g()), c?.(f), n.clear(f);
2044
+ };
2045
+ }, V = (...t) => (e) => (s) => t.forEach((r) => {
2046
+ typeof r == "function" ? r(s, e) : r.dispose(s, e);
2047
+ }), Ie = (t, e, s) => le(
2048
+ t,
2049
+ (r) => (n) => xt(
2050
+ n,
2051
+ r,
2052
+ (i) => i ? e() : s?.()
2053
+ ),
2054
+ (r) => {
2055
+ if (r) {
2106
2056
  const n = e();
2107
- return n != null ? f(n) : x;
2057
+ return n != null ? h(n) : E;
2108
2058
  }
2109
- return f(t == null ? void 0 : t());
2059
+ return h(s?.());
2110
2060
  }
2111
- }, xs = (s, e, t) => Fe(
2112
- y.map(s, (r) => !r),
2061
+ ), Ss = (t, e, s) => Ie(
2062
+ y.map(t, (r) => !r),
2113
2063
  e,
2114
- t
2115
- ), Be = (s, e, t) => {
2116
- if (t != null)
2117
- return Be(s, (r) => {
2118
- const n = new ce(
2064
+ s
2065
+ ), He = (t, e, s) => {
2066
+ if (s != null)
2067
+ return He(t, (r) => {
2068
+ const n = new se(
2119
2069
  r.index,
2120
2070
  r.total.map((i) => i - 1)
2121
2071
  );
2122
- return _(
2123
- q(n.dispose),
2124
- f(e(r)),
2125
- Fe(
2072
+ return T(
2073
+ V(n.dispose),
2074
+ h(e(r)),
2075
+ Ie(
2126
2076
  r.isLast,
2127
- () => x,
2128
- () => t(n)
2077
+ () => E,
2078
+ () => s(n)
2129
2079
  )
2130
2080
  );
2131
2081
  });
2132
- if (d.is(s))
2082
+ if (m.is(t))
2133
2083
  return (r) => {
2134
- const n = s.derive(), i = r.makeRef(), l = [];
2135
- return n.on((c) => {
2136
- const a = l.splice(c);
2137
- for (const u of a)
2138
- u(!0);
2139
- for (let u = l.length; u < c; u++) {
2140
- const h = new ce(u, n);
2141
- l.push(
2142
- _(
2143
- q(h.dispose),
2144
- f(e(h))
2084
+ const n = t.derive(), i = r.makeRef(), o = [];
2085
+ return n.on((l) => {
2086
+ const c = o.splice(l);
2087
+ for (const a of c)
2088
+ a(!0);
2089
+ for (let a = o.length; a < l; a++) {
2090
+ const u = new se(a, n);
2091
+ o.push(
2092
+ T(
2093
+ V(u.dispose),
2094
+ h(e(u))
2145
2095
  )(i)
2146
2096
  );
2147
2097
  }
2148
- }), (c) => {
2098
+ }), (l) => {
2149
2099
  n.dispose();
2150
- for (const a of l)
2151
- a(c);
2152
- l.length = 0, i.clear(c);
2100
+ for (const c of o)
2101
+ c(l);
2102
+ o.length = 0, i.clear(l);
2153
2103
  };
2154
2104
  };
2155
2105
  {
2156
- const r = se(s);
2157
- return _(
2158
- ...Array.from({ length: s }, (n, i) => i).map((n) => {
2159
- const i = new ce(n, r);
2160
- return _(
2161
- q(i.dispose),
2162
- f(e(i))
2106
+ const r = Q(t);
2107
+ return T(
2108
+ ...Array.from({ length: t }, (n, i) => i).map((n) => {
2109
+ const i = new se(n, r);
2110
+ return T(
2111
+ V(i.dispose),
2112
+ h(e(i))
2163
2113
  );
2164
2114
  })
2165
2115
  );
2166
2116
  }
2167
- }, Ps = (s, e, t) => {
2168
- const r = y.map(s, (i) => i.length), n = y.toSignal(s);
2169
- return Be(
2117
+ }, Ts = (t, e, s) => {
2118
+ const r = y.map(t, (i) => i.length), n = y.toSignal(t);
2119
+ return He(
2170
2120
  r,
2171
2121
  (i) => {
2172
- const l = n.map((c) => c[i.index]);
2173
- return _(
2174
- q(l.dispose),
2175
- f(e(l, i))
2122
+ const o = n.map((l) => l[i.index]);
2123
+ return T(
2124
+ V(o.dispose),
2125
+ h(e(o, i))
2176
2126
  );
2177
2127
  },
2178
- t
2128
+ s
2179
2129
  );
2180
- }, Ds = (s, e) => {
2181
- if (d.is(s)) {
2182
- const t = s;
2130
+ }, vs = (t, e) => {
2131
+ if (m.is(t)) {
2132
+ const s = t;
2183
2133
  return (r) => {
2184
2134
  r = r.makeRef();
2185
- const n = t.map((c) => f(e(c)));
2135
+ const n = s.map((l) => h(e(l)));
2186
2136
  let i = () => {
2187
2137
  };
2188
- const l = n.on((c) => {
2189
- i(!0), i = c(r);
2138
+ const o = n.on((l) => {
2139
+ i(!0), i = l(r);
2190
2140
  });
2191
- return (c) => {
2192
- l(), i(c);
2141
+ return (l) => {
2142
+ o(), i(l);
2193
2143
  };
2194
2144
  };
2195
2145
  }
2196
- return f(e(s));
2197
- }, Ls = (s, e, t = () => x) => ne(
2146
+ return h(e(t));
2147
+ }, As = (t, e, s = () => E) => K(
2198
2148
  y.map(
2199
- s,
2149
+ t,
2200
2150
  (r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
2201
2151
  ),
2202
2152
  {
2203
2153
  notEmpty: (r) => e(r),
2204
- whenEmpty: () => t()
2154
+ whenEmpty: () => s()
2205
2155
  }
2206
- ), Ms = (s, e) => (t) => {
2207
- const r = t.makePortal(s), n = fe(f(e), r);
2156
+ ), _s = (t, e) => (s) => {
2157
+ const r = s.makePortal(t), n = oe(h(e), r);
2208
2158
  return () => n(!0);
2209
- }, G = /* @__PURE__ */ new Map(), Rt = (s) => ({
2210
- mark: lt(`Probe(${s.description})`),
2159
+ }, F = /* @__PURE__ */ new Map(), Dt = (t) => ({
2160
+ mark: Qe(`Probe(${t.description})`),
2211
2161
  create: ({ callback: e = () => {
2212
- }, timeout: t = 10 } = {}) => {
2213
- const r = (c) => {
2214
- clearTimeout(n), G.delete(s), e(c);
2162
+ }, timeout: s = 10 } = {}) => {
2163
+ const r = (l) => {
2164
+ clearTimeout(n), F.delete(t), e(l);
2215
2165
  };
2216
- if (G.has(s))
2217
- throw new Error(`Probe already exists: ${s.description}`);
2218
- const n = setTimeout(() => r("timeout"), t), i = { counter: 0, timeoutId: n };
2219
- return G.set(s, i), {
2166
+ if (F.has(t))
2167
+ throw new Error(`Probe already exists: ${t.description}`);
2168
+ const n = setTimeout(() => r("timeout"), s), i = { counter: 0, timeoutId: n };
2169
+ return F.set(t, i), {
2220
2170
  value: () => {
2221
2171
  clearTimeout(n);
2222
- const c = G.get(s);
2223
- c != null && --c.counter === 0 && r("resolved");
2172
+ const l = F.get(t);
2173
+ l != null && --l.counter === 0 && r("resolved");
2224
2174
  },
2225
2175
  dispose: () => r("disposed"),
2226
2176
  onUse: () => i.counter++
2227
2177
  };
2228
2178
  }
2229
- }), Os = Rt(Symbol("GlobalProbe")), Te = (s, e) => (t) => {
2230
- const r = t.getStyle(s);
2231
- return t.setStyle(s, e), (n) => {
2232
- n && t.setStyle(s, r);
2179
+ }), Es = Dt(Symbol("GlobalProbe")), Ot = (t, e) => (s) => {
2180
+ const r = s.getStyle(t);
2181
+ return s.setStyle(t, e), (n) => {
2182
+ n && s.setStyle(t, r);
2233
2183
  };
2234
- }, be = (s, e) => (t) => {
2235
- const r = t.getStyle(s), n = e.on((i) => t.setStyle(s, i));
2184
+ }, Mt = (t, e) => (s) => {
2185
+ const r = s.getStyle(t), n = e.on((i) => s.setStyle(t, i));
2236
2186
  return (i) => {
2237
- n(), i && t.setStyle(s, r);
2187
+ n(), i && s.setStyle(t, r);
2238
2188
  };
2239
- }, Is = new Proxy({}, {
2189
+ }, ue = (t, e) => m.is(e) ? Mt(t, e) : Ot(t, e), Cs = new Proxy({}, {
2240
2190
  /**
2241
2191
  * Creates a renderable component for the specified `style` property.
2242
2192
  *
@@ -2245,168 +2195,168 @@ const Ct = /* @__PURE__ */ new Set([
2245
2195
  * @returns The renderable component for the specified attribute.
2246
2196
  *
2247
2197
  */
2248
- get: (s, e) => e === "variable" ? (t, r) => d.is(r) ? be(t, r) : Te(t, r) : (t) => d.is(t) ? be(e, t) : Te(e, t)
2249
- }), Vt = (s) => (e) => {
2198
+ get: (t, e) => e === "variable" ? (s, r) => ue(s, r) : (s) => ue(e, s)
2199
+ }), It = (t) => (e) => {
2250
2200
  if (e.isBrowser()) {
2251
- const t = s(e);
2252
- if (t != null)
2253
- return f(t)(e);
2201
+ const s = t(e);
2202
+ if (s != null)
2203
+ return h(s)(e);
2254
2204
  }
2255
2205
  return () => {
2256
2206
  };
2257
- }, ks = (s) => (e) => {
2258
- const t = s(e);
2259
- return t == null ? () => {
2260
- } : f(t)(e);
2261
- }, Hs = (s) => Vt((e) => s(e.element)), $s = (s) => (e) => {
2207
+ }, Ps = (t) => (e) => {
2208
+ const s = t(e);
2209
+ return s == null ? () => {
2210
+ } : h(s)(e);
2211
+ }, xs = (t) => It((e) => t(e.element)), Ls = (t) => (e) => {
2262
2212
  if (e.isHeadlessDOM()) {
2263
- const t = s(e);
2264
- if (t)
2265
- return f(t)(e);
2213
+ const s = t(e);
2214
+ if (s)
2215
+ return h(s)(e);
2266
2216
  }
2267
2217
  return () => {
2268
2218
  };
2269
- }, de = (s) => (e) => {
2270
- let t = e;
2219
+ }, ce = (t) => (e) => {
2220
+ let s = e;
2271
2221
  function r() {
2272
- return t;
2222
+ return s;
2273
2223
  }
2274
- function n(c) {
2275
- t = c;
2224
+ function n(l) {
2225
+ s = l;
2276
2226
  }
2277
- const i = [], l = s({
2278
- use: ({ mark: c }) => {
2279
- const { value: a, onUse: u } = r().getProvider(c);
2280
- return u == null || u(), a;
2227
+ const i = [], o = t({
2228
+ use: ({ mark: l }) => {
2229
+ const { value: c, onUse: a } = r().getProvider(l);
2230
+ return a?.(), c;
2281
2231
  },
2282
- set: ({ mark: c, create: a }, u) => {
2283
- const { value: h, dispose: p, onUse: T } = a(u, r());
2284
- i.push(p), n(r().setProvider(c, h, T));
2232
+ set: ({ mark: l, create: c }, a) => {
2233
+ const { value: u, dispose: p, onUse: d } = c(a, r());
2234
+ i.push(p), n(r().setProvider(l, u, d));
2285
2235
  }
2286
2236
  });
2287
- return l == null ? () => {
2288
- } : _(
2289
- f(l),
2290
- q(() => i.forEach((c) => c()))
2237
+ return o == null ? () => {
2238
+ } : T(
2239
+ h(o),
2240
+ V(() => i.forEach((l) => l()))
2291
2241
  )(r());
2292
- }, Ns = (s, e, t) => de(({ set: r }) => (r(s, e), t())), Rs = (s, e) => de(({ use: t }) => e(t(s))), Vs = (...s) => (e) => de(({ use: t }) => {
2293
- const r = s.map(t);
2242
+ }, Ds = (t, e, s) => ce(({ set: r }) => (r(t, e), s())), Os = (t, e) => ce(({ use: s }) => e(s(t))), Ms = (...t) => (e) => ce(({ use: s }) => {
2243
+ const r = t.map(s);
2294
2244
  return e(...r);
2295
2245
  });
2296
2246
  export {
2297
- hs as Async,
2298
- bs as BindChecked,
2299
- gs as BindDate,
2300
- ms as BindDateTime,
2301
- ys as BindNumber,
2302
- Ts as BindText,
2303
- R as BrowserContext,
2304
- Q as CLASS_PLACEHOLDER_ATTR,
2305
- N as Computed,
2306
- _s as Conjunction,
2307
- Es as DOMNode,
2308
- Ne as El,
2309
- Re as ElNS,
2310
- ce as ElementPosition,
2311
- x as Empty,
2312
- Cs as Ensure,
2247
+ ns as Async,
2248
+ fs as BindChecked,
2249
+ cs as BindDate,
2250
+ as as BindDateTime,
2251
+ us as BindNumber,
2252
+ hs as BindText,
2253
+ k as BrowserContext,
2254
+ W as CLASS_PLACEHOLDER_ATTR,
2255
+ H as Computed,
2256
+ gs as Conjunction,
2257
+ ys as DOMNode,
2258
+ xe as El,
2259
+ Le as ElNS,
2260
+ se as ElementPosition,
2261
+ E as Empty,
2262
+ bs as Ensure,
2313
2263
  ws as EnsureAll,
2314
- Ps as ForEach,
2315
- _ as Fragment,
2316
- Os as GlobalProbe,
2317
- es as HeadlessAdapter,
2318
- V as HeadlessContext,
2319
- _t as HeadlessElement,
2320
- ke as HeadlessPortal,
2321
- Et as HeadlessText,
2322
- Ds as MapSignal,
2323
- Ae as MemoryStore,
2324
- Ls as NotEmpty,
2325
- Mt as OnChecked,
2326
- q as OnDispose,
2327
- ne as OneOf,
2328
- qe as OneOfField,
2329
- Ss as OneOfKind,
2330
- As as OneOfTuple,
2331
- vs as OneOfType,
2332
- Nt as OneOfValue,
2333
- Ms as Portal,
2334
- X as Prop,
2335
- Ns as Provide,
2336
- De as ProviderNotFoundError,
2337
- ct as RenderingError,
2338
- Be as Repeat,
2339
- d as Signal,
2340
- Ve as Task,
2341
- ss as TextNode,
2342
- xs as Unless,
2343
- Rs as Use,
2344
- Vs as UseMany,
2264
+ Ts as ForEach,
2265
+ T as Fragment,
2266
+ Es as GlobalProbe,
2267
+ Gt as HeadlessAdapter,
2268
+ $ as HeadlessContext,
2269
+ ft as HeadlessElement,
2270
+ Ee as HeadlessPortal,
2271
+ dt as HeadlessText,
2272
+ vs as MapSignal,
2273
+ fe as MemoryStore,
2274
+ As as NotEmpty,
2275
+ vt as OnChecked,
2276
+ V as OnDispose,
2277
+ K as OneOf,
2278
+ Me as OneOfField,
2279
+ ds as OneOfKind,
2280
+ ps as OneOfTuple,
2281
+ ms as OneOfType,
2282
+ Lt as OneOfValue,
2283
+ _s as Portal,
2284
+ Y as Prop,
2285
+ Ds as Provide,
2286
+ Se as ProviderNotFoundError,
2287
+ Ze as RenderingError,
2288
+ He as Repeat,
2289
+ m as Signal,
2290
+ De as Task,
2291
+ Yt as TextNode,
2292
+ Ss as Unless,
2293
+ Os as Use,
2294
+ Ms as UseMany,
2345
2295
  y as Value,
2346
- Fe as When,
2347
- Vt as WithBrowserCtx,
2348
- ks as WithCtx,
2349
- Hs as WithElement,
2350
- $s as WithHeadlessCtx,
2351
- de as WithProvider,
2352
- Le as _NODE_PLACEHOLDER_ATTR,
2353
- ot as _getSelfOrParentElement,
2354
- Pe as _isElement,
2355
- it as _makeGetter,
2356
- nt as _makeSetter,
2357
- Y as _removeDOMNode,
2358
- $e as _signalText,
2359
- He as _staticText,
2360
- Ut as animateSignal,
2361
- st as animateSignals,
2362
- ns as aria,
2363
- j as attr,
2364
- Qt as bind,
2365
- Zt as coalesce,
2366
- ae as computed,
2367
- he as computedOf,
2368
- rt as computedRecord,
2369
- rs as dataAttr,
2370
- Gt as delaySignal,
2371
- ze as effect,
2372
- Ft as effectOf,
2373
- Ot as emit,
2374
- ps as emitChecked,
2375
- I as emitTarget,
2376
- It as emitValue,
2377
- Ht as emitValueAsDate,
2378
- $t as emitValueAsDateTime,
2379
- fs as emitValueAsNullableDate,
2380
- ds as emitValueAsNullableDateTime,
2381
- kt as emitValueAsNumber,
2382
- Ye as endInterpolate,
2383
- ue as getWindow,
2384
- Qe as guessInterpolate,
2385
- ls as html,
2386
- cs as input,
2387
- Xe as interpolateDate,
2388
- Je as interpolateNumber,
2389
- Ge as interpolateString,
2390
- qt as joinSignals,
2391
- Bt as localStorageProp,
2392
- Rt as makeProbe,
2393
- lt as makeProviderMark,
2394
- us as math,
2395
- os as mathAttr,
2396
- Jt as merge,
2397
- re as on,
2398
- Xt as previousSignal,
2399
- w as prop,
2400
- zt as render,
2401
- fe as renderWithContext,
2402
- f as renderableOfTNode,
2403
- ts as restoreTempoPlaceholders,
2404
- Kt as runHeadless,
2405
- Wt as sessionStorageProp,
2406
- se as signal,
2407
- Yt as slidingWindowSignal,
2408
- ve as storedProp,
2409
- Is as style,
2410
- as as svg,
2411
- is as svgAttr
2296
+ Ie as When,
2297
+ It as WithBrowserCtx,
2298
+ Ps as WithCtx,
2299
+ xs as WithElement,
2300
+ Ls as WithHeadlessCtx,
2301
+ ce as WithProvider,
2302
+ Te as _NODE_PLACEHOLDER_ATTR,
2303
+ Ye as _getSelfOrParentElement,
2304
+ we as _isElement,
2305
+ Xe as _makeGetter,
2306
+ Ge as _makeSetter,
2307
+ B as _removeDOMNode,
2308
+ Pe as _signalText,
2309
+ Ce as _staticText,
2310
+ Rt as animateSignal,
2311
+ Ue as animateSignals,
2312
+ Zt as aria,
2313
+ R as attr,
2314
+ Bt as bind,
2315
+ Wt as coalesce,
2316
+ re as computed,
2317
+ ie as computedOf,
2318
+ Je as computedRecord,
2319
+ Qt as dataAttr,
2320
+ jt as delaySignal,
2321
+ qe as effect,
2322
+ kt as effectOf,
2323
+ At as emit,
2324
+ ls as emitChecked,
2325
+ L as emitTarget,
2326
+ _t as emitValue,
2327
+ Ct as emitValueAsDate,
2328
+ Pt as emitValueAsDateTime,
2329
+ is as emitValueAsNullableDate,
2330
+ os as emitValueAsNullableDateTime,
2331
+ Et as emitValueAsNumber,
2332
+ Re as endInterpolate,
2333
+ ne as getWindow,
2334
+ Ve as guessInterpolate,
2335
+ es as html,
2336
+ ts as input,
2337
+ Ne as interpolateDate,
2338
+ ke as interpolateNumber,
2339
+ $e as interpolateString,
2340
+ Ht as joinSignals,
2341
+ $t as localStorageProp,
2342
+ Dt as makeProbe,
2343
+ Qe as makeProviderMark,
2344
+ rs as math,
2345
+ Kt as mathAttr,
2346
+ Vt as merge,
2347
+ z as on,
2348
+ qt as previousSignal,
2349
+ _ as prop,
2350
+ Ut as render,
2351
+ oe as renderWithContext,
2352
+ h as renderableOfTNode,
2353
+ Xt as restoreTempoPlaceholders,
2354
+ Jt as runHeadless,
2355
+ Nt as sessionStorageProp,
2356
+ Q as signal,
2357
+ Ft as slidingWindowSignal,
2358
+ de as storedProp,
2359
+ Cs as style,
2360
+ ss as svg,
2361
+ zt as svgAttr
2412
2362
  };