@solidjs/universal 2.0.0-beta.1 → 2.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.js CHANGED
@@ -1,9 +1,1189 @@
1
- import { createMemo, createRenderEffect, createComponent, merge, createRoot, flatten, untrack, runWithOwner } from 'solid-js';
1
+ import { createMemo as createMemo$1, createRenderEffect, createComponent, merge, createRoot, flatten, untrack as untrack$1, runWithOwner } from 'solid-js';
2
+
3
+ class NotReadyError extends Error {
4
+ source;
5
+ constructor(e) {
6
+ super();
7
+ this.source = e;
8
+ }
9
+ }
10
+ class StatusError extends Error {
11
+ source;
12
+ constructor(e, t) {
13
+ super(t instanceof Error ? t.message : String(t), {
14
+ cause: t
15
+ });
16
+ this.source = e;
17
+ }
18
+ }
19
+ const REACTIVE_NONE = 0;
20
+ const REACTIVE_CHECK = 1 << 0;
21
+ const REACTIVE_DIRTY = 1 << 1;
22
+ const REACTIVE_RECOMPUTING_DEPS = 1 << 2;
23
+ const REACTIVE_IN_HEAP = 1 << 3;
24
+ const REACTIVE_IN_HEAP_HEIGHT = 1 << 4;
25
+ const REACTIVE_ZOMBIE = 1 << 5;
26
+ const REACTIVE_DISPOSED = 1 << 6;
27
+ const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
28
+ const REACTIVE_SNAPSHOT_STALE = 1 << 8;
29
+ const REACTIVE_LAZY = 1 << 9;
30
+ const STATUS_PENDING = 1 << 0;
31
+ const STATUS_ERROR = 1 << 1;
32
+ const STATUS_UNINITIALIZED = 1 << 2;
33
+ const EFFECT_RENDER = 1;
34
+ const EFFECT_USER = 2;
35
+ const EFFECT_TRACKED = 3;
36
+ const NOT_PENDING = {};
37
+ const defaultContext = {};
38
+ function actualInsertIntoHeap(e, t) {
39
+ const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
40
+ if (n >= e.o) e.o = n + 1;
41
+ const i = e.o;
42
+ const r = t.l[i];
43
+ if (r === undefined) t.l[i] = e;else {
44
+ const t = r.T;
45
+ t.S = e;
46
+ e.T = t;
47
+ r.T = e;
48
+ }
49
+ if (i > t.R) t.R = i;
50
+ }
51
+ function insertIntoHeap(e, t) {
52
+ let n = e.O;
53
+ if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
54
+ if (n & REACTIVE_CHECK) {
55
+ e.O = n & -4 | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
56
+ } else e.O = n | REACTIVE_IN_HEAP;
57
+ if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
58
+ }
59
+ function insertIntoHeapHeight(e, t) {
60
+ let n = e.O;
61
+ if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
62
+ e.O = n | REACTIVE_IN_HEAP_HEIGHT;
63
+ actualInsertIntoHeap(e, t);
64
+ }
65
+ function deleteFromHeap(e, t) {
66
+ const n = e.O;
67
+ if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
68
+ e.O = n & -25;
69
+ const i = e.o;
70
+ if (e.T === e) t.l[i] = undefined;else {
71
+ const n = e.S;
72
+ const r = t.l[i];
73
+ const o = n ?? r;
74
+ if (e === r) t.l[i] = n;else e.T.S = n;
75
+ o.T = e.T;
76
+ }
77
+ e.T = e;
78
+ e.S = undefined;
79
+ }
80
+ function markHeap(e) {
81
+ if (e._) return;
82
+ e._ = true;
83
+ for (let t = 0; t <= e.R; t++) {
84
+ for (let n = e.l[t]; n !== undefined; n = n.S) {
85
+ if (n.O & REACTIVE_IN_HEAP) markNode(n);
86
+ }
87
+ }
88
+ }
89
+ function markNode(e, t = REACTIVE_DIRTY) {
90
+ const n = e.O;
91
+ if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
92
+ e.O = n & -4 | t;
93
+ for (let t = e.I; t !== null; t = t.p) {
94
+ markNode(t.h, REACTIVE_CHECK);
95
+ }
96
+ if (e.A !== null) {
97
+ for (let t = e.A; t !== null; t = t.N) {
98
+ for (let e = t.I; e !== null; e = e.p) {
99
+ markNode(e.h, REACTIVE_CHECK);
100
+ }
101
+ }
102
+ }
103
+ }
104
+ function runHeap(e, t) {
105
+ e._ = false;
106
+ for (e.P = 0; e.P <= e.R; e.P++) {
107
+ let n = e.l[e.P];
108
+ while (n !== undefined) {
109
+ if (n.O & REACTIVE_IN_HEAP) t(n);else adjustHeight(n, e);
110
+ n = e.l[e.P];
111
+ }
112
+ }
113
+ e.R = 0;
114
+ }
115
+ function adjustHeight(e, t) {
116
+ deleteFromHeap(e, t);
117
+ let n = e.o;
118
+ for (let t = e.C; t; t = t.D) {
119
+ const e = t.m;
120
+ const i = e.V || e;
121
+ if (i.L && i.o >= n) n = i.o + 1;
122
+ }
123
+ if (e.o !== n) {
124
+ e.o = n;
125
+ for (let n = e.I; n !== null; n = n.p) {
126
+ insertIntoHeapHeight(n.h, t);
127
+ }
128
+ }
129
+ }
130
+ const transitions = new Set();
131
+ const dirtyQueue = {
132
+ l: new Array(2e3).fill(undefined),
133
+ _: false,
134
+ P: 0,
135
+ R: 0
136
+ };
137
+ const zombieQueue = {
138
+ l: new Array(2e3).fill(undefined),
139
+ _: false,
140
+ P: 0,
141
+ R: 0
142
+ };
143
+ let clock = 0;
144
+ let activeTransition = null;
145
+ let scheduled = false;
146
+ function runLaneEffects(e) {
147
+ for (const t of activeLanes) {
148
+ if (t.k || t.U.size > 0) continue;
149
+ const n = t.W[e - 1];
150
+ if (n.length) {
151
+ t.W[e - 1] = [];
152
+ runQueue(n, e);
153
+ }
154
+ }
155
+ }
156
+ function schedule() {
157
+ if (scheduled) return;
158
+ scheduled = true;
159
+ if (!globalQueue.H && true) queueMicrotask(flush);
160
+ }
161
+ class Queue {
162
+ i = null;
163
+ G = [[], []];
164
+ F = [];
165
+ created = clock;
166
+ addChild(e) {
167
+ this.F.push(e);
168
+ e.i = this;
169
+ }
170
+ removeChild(e) {
171
+ const t = this.F.indexOf(e);
172
+ if (t >= 0) {
173
+ this.F.splice(t, 1);
174
+ e.i = null;
175
+ }
176
+ }
177
+ notify(e, t, n, i) {
178
+ if (this.i) return this.i.notify(e, t, n, i);
179
+ return false;
180
+ }
181
+ run(e) {
182
+ if (this.G[e - 1].length) {
183
+ const t = this.G[e - 1];
184
+ this.G[e - 1] = [];
185
+ runQueue(t, e);
186
+ }
187
+ for (let t = 0; t < this.F.length; t++) this.F[t].run?.(e);
188
+ }
189
+ enqueue(e, t) {
190
+ if (e) {
191
+ if (currentOptimisticLane) {
192
+ const n = findLane(currentOptimisticLane);
193
+ n.W[e - 1].push(t);
194
+ } else {
195
+ this.G[e - 1].push(t);
196
+ }
197
+ }
198
+ schedule();
199
+ }
200
+ stashQueues(e) {
201
+ e.G[0].push(...this.G[0]);
202
+ e.G[1].push(...this.G[1]);
203
+ this.G = [[], []];
204
+ for (let t = 0; t < this.F.length; t++) {
205
+ let n = this.F[t];
206
+ let i = e.F[t];
207
+ if (!i) {
208
+ i = {
209
+ G: [[], []],
210
+ F: []
211
+ };
212
+ e.F[t] = i;
213
+ }
214
+ n.stashQueues(i);
215
+ }
216
+ }
217
+ restoreQueues(e) {
218
+ this.G[0].push(...e.G[0]);
219
+ this.G[1].push(...e.G[1]);
220
+ for (let t = 0; t < e.F.length; t++) {
221
+ const n = e.F[t];
222
+ let i = this.F[t];
223
+ if (i) i.restoreQueues(n);
224
+ }
225
+ }
226
+ }
227
+ class GlobalQueue extends Queue {
228
+ H = false;
229
+ M = [];
230
+ $ = [];
231
+ j = new Set();
232
+ static K;
233
+ static Y;
234
+ static B = null;
235
+ flush() {
236
+ if (this.H) return;
237
+ this.H = true;
238
+ try {
239
+ runHeap(dirtyQueue, GlobalQueue.K);
240
+ if (activeTransition) {
241
+ const e = transitionComplete(activeTransition);
242
+ if (!e) {
243
+ let e = activeTransition;
244
+ runHeap(zombieQueue, GlobalQueue.K);
245
+ this.M = [];
246
+ this.$ = [];
247
+ this.j = new Set();
248
+ runLaneEffects(EFFECT_RENDER);
249
+ runLaneEffects(EFFECT_USER);
250
+ this.stashQueues(activeTransition.Z);
251
+ clock++;
252
+ scheduled = dirtyQueue.R >= dirtyQueue.P;
253
+ reassignPendingTransition(activeTransition.M);
254
+ activeTransition = null;
255
+ finalizePureQueue(null, true);
256
+ return;
257
+ }
258
+ this.M !== activeTransition.M && this.M.push(...activeTransition.M);
259
+ this.restoreQueues(activeTransition.Z);
260
+ transitions.delete(activeTransition);
261
+ const t = activeTransition;
262
+ activeTransition = null;
263
+ reassignPendingTransition(this.M);
264
+ finalizePureQueue(t);
265
+ } else {
266
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.K);
267
+ finalizePureQueue();
268
+ }
269
+ clock++;
270
+ scheduled = dirtyQueue.R >= dirtyQueue.P;
271
+ runLaneEffects(EFFECT_RENDER);
272
+ this.run(EFFECT_RENDER);
273
+ runLaneEffects(EFFECT_USER);
274
+ this.run(EFFECT_USER);
275
+ } finally {
276
+ this.H = false;
277
+ }
278
+ }
279
+ notify(e, t, n, i) {
280
+ if (t & STATUS_PENDING) {
281
+ if (n & STATUS_PENDING) {
282
+ const t = i !== undefined ? i : e.q;
283
+ if (activeTransition && t && !activeTransition.X.includes(t.source)) {
284
+ activeTransition.X.push(t.source);
285
+ schedule();
286
+ }
287
+ }
288
+ return true;
289
+ }
290
+ return false;
291
+ }
292
+ initTransition(e) {
293
+ if (e) e = currentTransition(e);
294
+ if (e && e === activeTransition) return;
295
+ if (!e && activeTransition && activeTransition.J === clock) return;
296
+ if (!activeTransition) {
297
+ activeTransition = e ?? {
298
+ J: clock,
299
+ M: [],
300
+ X: [],
301
+ $: [],
302
+ j: new Set(),
303
+ ee: [],
304
+ Z: {
305
+ G: [[], []],
306
+ F: []
307
+ },
308
+ te: false
309
+ };
310
+ } else if (e) {
311
+ const t = activeTransition;
312
+ t.te = e;
313
+ e.ee.push(...t.ee);
314
+ for (const n of activeLanes) {
315
+ if (n.ne === t) n.ne = e;
316
+ }
317
+ e.$.push(...t.$);
318
+ for (const n of t.j) {
319
+ e.j.add(n);
320
+ }
321
+ transitions.delete(t);
322
+ activeTransition = e;
323
+ }
324
+ transitions.add(activeTransition);
325
+ activeTransition.J = clock;
326
+ for (let e = 0; e < this.M.length; e++) {
327
+ const t = this.M[e];
328
+ t.ne = activeTransition;
329
+ activeTransition.M.push(t);
330
+ }
331
+ this.M = activeTransition.M;
332
+ for (let e = 0; e < this.$.length; e++) {
333
+ const t = this.$[e];
334
+ t.ne = activeTransition;
335
+ activeTransition.$.push(t);
336
+ }
337
+ this.$ = activeTransition.$;
338
+ for (const e of activeLanes) {
339
+ if (!e.ne) e.ne = activeTransition;
340
+ }
341
+ for (const e of this.j) activeTransition.j.add(e);
342
+ this.j = activeTransition.j;
343
+ }
344
+ }
345
+ function insertSubs(e, t = false) {
346
+ const n = e.ie || currentOptimisticLane;
347
+ const i = e.re !== undefined;
348
+ for (let r = e.I; r !== null; r = r.p) {
349
+ if (i && r.h.oe) {
350
+ r.h.O |= REACTIVE_SNAPSHOT_STALE;
351
+ continue;
352
+ }
353
+ if (t && n) {
354
+ r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
355
+ assignOrMergeLane(r.h, n);
356
+ } else if (t) {
357
+ r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
358
+ r.h.ie = undefined;
359
+ }
360
+ const e = r.h;
361
+ if (e.se === EFFECT_TRACKED) {
362
+ if (!e.ue) {
363
+ e.ue = true;
364
+ e.ce.enqueue(EFFECT_USER, e.ae);
365
+ }
366
+ continue;
367
+ }
368
+ const o = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
369
+ if (o.P > r.h.o) o.P = r.h.o;
370
+ insertIntoHeap(r.h, o);
371
+ }
372
+ }
373
+ function commitPendingNodes() {
374
+ const e = globalQueue.M;
375
+ for (let t = 0; t < e.length; t++) {
376
+ const n = e[t];
377
+ if (n.le !== NOT_PENDING) {
378
+ n.fe = n.le;
379
+ n.le = NOT_PENDING;
380
+ if (n.se && n.se !== EFFECT_TRACKED) n.ue = true;
381
+ }
382
+ if (n.Ee & STATUS_PENDING) {
383
+ const e = n.q?.source;
384
+ if (e && !(e.Ee & STATUS_PENDING)) {
385
+ n.Ee &= -6;
386
+ n.q = null;
387
+ }
388
+ } else n.Ee &= ~STATUS_UNINITIALIZED;
389
+ if (n.L) GlobalQueue.Y(n, false, true);
390
+ }
391
+ e.length = 0;
392
+ }
393
+ function finalizePureQueue(e = null, t = false) {
394
+ let n = !t;
395
+ if (n) commitPendingNodes();
396
+ if (!t) checkBoundaryChildren(globalQueue);
397
+ if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.K);
398
+ if (n) {
399
+ commitPendingNodes();
400
+ const t = e ? e.$ : globalQueue.$;
401
+ for (let e = 0; e < t.length; e++) {
402
+ const n = t[e];
403
+ n.ie = undefined;
404
+ if (n.le !== NOT_PENDING) {
405
+ n.fe = n.le;
406
+ n.le = NOT_PENDING;
407
+ }
408
+ const i = n.Te;
409
+ n.Te = NOT_PENDING;
410
+ if (i !== NOT_PENDING && n.fe !== i) insertSubs(n, true);
411
+ n.ne = null;
412
+ }
413
+ t.length = 0;
414
+ e ? e.j : globalQueue.j;
415
+ for (const t of activeLanes) {
416
+ const n = e ? t.ne === e : !t.ne;
417
+ if (!n) continue;
418
+ if (!t.k) {
419
+ if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
420
+ if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
421
+ }
422
+ if (t.de.ie === t) t.de.ie = undefined;
423
+ t.U.clear();
424
+ t.W[0].length = 0;
425
+ t.W[1].length = 0;
426
+ activeLanes.delete(t);
427
+ signalLanes.delete(t.de);
428
+ }
429
+ }
430
+ }
431
+ function checkBoundaryChildren(e) {
432
+ for (const t of e.F) {
433
+ t.checkSources?.();
434
+ checkBoundaryChildren(t);
435
+ }
436
+ }
437
+ function reassignPendingTransition(e) {
438
+ for (let t = 0; t < e.length; t++) {
439
+ e[t].ne = activeTransition;
440
+ }
441
+ }
442
+ const globalQueue = new GlobalQueue();
443
+ function flush() {
444
+ while (scheduled) {
445
+ globalQueue.flush();
446
+ }
447
+ }
448
+ function runQueue(e, t) {
449
+ for (let n = 0; n < e.length; n++) e[n](t);
450
+ }
451
+ function transitionComplete(e) {
452
+ if (e.te) return true;
453
+ if (e.ee.length) return false;
454
+ let t = true;
455
+ for (let n = 0; n < e.X.length; n++) {
456
+ const i = e.X[n];
457
+ if (i.Ee & STATUS_PENDING && i.q?.source === i) {
458
+ t = false;
459
+ break;
460
+ }
461
+ }
462
+ t && (e.te = true);
463
+ return t;
464
+ }
465
+ function currentTransition(e) {
466
+ while (e.te && typeof e.te === "object") e = e.te;
467
+ return e;
468
+ }
469
+ function runInTransition(e, t) {
470
+ const n = activeTransition;
471
+ try {
472
+ activeTransition = currentTransition(e);
473
+ return t();
474
+ } finally {
475
+ activeTransition = n;
476
+ }
477
+ }
478
+ const signalLanes = new WeakMap();
479
+ const activeLanes = new Set();
480
+ function getOrCreateLane(e) {
481
+ let t = signalLanes.get(e);
482
+ if (t) {
483
+ return findLane(t);
484
+ }
485
+ const n = e.Se;
486
+ const i = n?.ie ? findLane(n.ie) : null;
487
+ t = {
488
+ de: e,
489
+ U: new Set(),
490
+ W: [[], []],
491
+ k: null,
492
+ ne: activeTransition,
493
+ Re: i
494
+ };
495
+ signalLanes.set(e, t);
496
+ activeLanes.add(t);
497
+ e.Oe = false;
498
+ return t;
499
+ }
500
+ function findLane(e) {
501
+ while (e.k) e = e.k;
502
+ return e;
503
+ }
504
+ function mergeLanes(e, t) {
505
+ e = findLane(e);
506
+ t = findLane(t);
507
+ if (e === t) return e;
508
+ t.k = e;
509
+ for (const n of t.U) e.U.add(n);
510
+ e.W[0].push(...t.W[0]);
511
+ e.W[1].push(...t.W[1]);
512
+ return e;
513
+ }
514
+ function resolveLane(e) {
515
+ const t = e.ie;
516
+ if (!t) return undefined;
517
+ const n = findLane(t);
518
+ if (activeLanes.has(n)) return n;
519
+ e.ie = undefined;
520
+ return undefined;
521
+ }
522
+ function hasActiveOverride(e) {
523
+ return !!(e.Te !== undefined && e.Te !== NOT_PENDING);
524
+ }
525
+ function assignOrMergeLane(e, t) {
526
+ const n = findLane(t);
527
+ const i = e.ie;
528
+ if (i) {
529
+ if (i.k) {
530
+ e.ie = t;
531
+ return;
532
+ }
533
+ const r = findLane(i);
534
+ if (activeLanes.has(r)) {
535
+ if (r !== n && !hasActiveOverride(e)) {
536
+ if (n.Re && findLane(n.Re) === r) {
537
+ e.ie = t;
538
+ } else if (r.Re && findLane(r.Re) === n) ;else mergeLanes(n, r);
539
+ }
540
+ return;
541
+ }
542
+ }
543
+ e.ie = t;
544
+ }
545
+ function handleAsync(e, t, n) {
546
+ const i = typeof t === "object" && t !== null;
547
+ const r = i && untrack(() => t[Symbol.asyncIterator]);
548
+ const o = !r && i && untrack(() => typeof t.then === "function");
549
+ if (!o && !r) {
550
+ e._e = null;
551
+ return t;
552
+ }
553
+ e._e = t;
554
+ let s;
555
+ const handleError = n => {
556
+ if (e._e !== t) return;
557
+ globalQueue.initTransition(e.ne);
558
+ notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
559
+ e.J = clock;
560
+ };
561
+ const asyncWrite = (i, r) => {
562
+ if (e._e !== t) return;
563
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
564
+ globalQueue.initTransition(e.ne);
565
+ clearStatus(e);
566
+ const o = resolveLane(e);
567
+ if (o) o.U.delete(e);
568
+ if (e.Te !== undefined) {
569
+ if (e.Te !== undefined && e.Te !== NOT_PENDING) e.le = i;else {
570
+ e.fe = i;
571
+ insertSubs(e);
572
+ }
573
+ e.J = clock;
574
+ } else if (o) {
575
+ const t = e.fe;
576
+ const n = e.Ie;
577
+ if (!n || !n(i, t)) {
578
+ e.fe = i;
579
+ e.J = clock;
580
+ if (e.pe) {
581
+ setSignal(e.pe, i);
582
+ }
583
+ insertSubs(e, true);
584
+ }
585
+ } else {
586
+ setSignal(e, () => i);
587
+ }
588
+ schedule();
589
+ flush();
590
+ r?.();
591
+ };
592
+ if (o) {
593
+ let n = false,
594
+ i = true;
595
+ t.then(e => {
596
+ if (i) {
597
+ s = e;
598
+ n = true;
599
+ } else asyncWrite(e);
600
+ }, e => {
601
+ if (!i) handleError(e);
602
+ });
603
+ i = false;
604
+ if (!n) {
605
+ globalQueue.initTransition(e.ne);
606
+ throw new NotReadyError(context);
607
+ }
608
+ }
609
+ if (r) {
610
+ const n = t[Symbol.asyncIterator]();
611
+ let i = false;
612
+ const iterate = () => {
613
+ let e,
614
+ t = false,
615
+ r = true;
616
+ n.next().then(n => {
617
+ if (r) {
618
+ e = n;
619
+ t = true;
620
+ } else if (!n.done) asyncWrite(n.value, iterate);else {
621
+ schedule();
622
+ flush();
623
+ }
624
+ }, e => {
625
+ if (!r) handleError(e);
626
+ });
627
+ r = false;
628
+ if (t && !e.done) {
629
+ s = e.value;
630
+ i = true;
631
+ return iterate();
632
+ }
633
+ return t && e.done;
634
+ };
635
+ const r = iterate();
636
+ if (!i && !r) {
637
+ globalQueue.initTransition(e.ne);
638
+ throw new NotReadyError(context);
639
+ }
640
+ }
641
+ return s;
642
+ }
643
+ function clearStatus(e) {
644
+ e.Ee = e.Ee & STATUS_UNINITIALIZED;
645
+ e.q = null;
646
+ updatePendingSignal(e);
647
+ e.he?.();
648
+ }
649
+ function notifyStatus(e, t, n, i, r) {
650
+ if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError)) n = new StatusError(e, n);
651
+ const o = n instanceof NotReadyError && n.source === e;
652
+ const s = t === STATUS_PENDING && e.Te !== undefined && !o;
653
+ const u = s && hasActiveOverride(e);
654
+ if (!i) {
655
+ e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
656
+ e.q = n;
657
+ updatePendingSignal(e);
658
+ }
659
+ if (r && !i) {
660
+ assignOrMergeLane(e, r);
661
+ }
662
+ if (u && activeTransition && n instanceof NotReadyError) {
663
+ const e = n.source;
664
+ if (!activeTransition.X.includes(e)) {
665
+ activeTransition.X.push(e);
666
+ }
667
+ }
668
+ const c = i || u;
669
+ const a = i || s ? undefined : r;
670
+ if (e.he) {
671
+ if (c) {
672
+ e.he(t, n);
673
+ } else {
674
+ e.he();
675
+ }
676
+ return;
677
+ }
678
+ for (let i = e.I; i !== null; i = i.p) {
679
+ i.h.J = clock;
680
+ if (i.h.q !== n) {
681
+ !i.h.ne && globalQueue.M.push(i.h);
682
+ notifyStatus(i.h, t, n, c, a);
683
+ }
684
+ }
685
+ for (let i = e.A; i !== null; i = i.N) {
686
+ for (let e = i.I; e !== null; e = e.p) {
687
+ e.h.J = clock;
688
+ if (e.h.q !== n) {
689
+ !e.h.ne && globalQueue.M.push(e.h);
690
+ notifyStatus(e.h, t, n, c, a);
691
+ }
692
+ }
693
+ }
694
+ }
695
+ function unlinkSubs(e) {
696
+ const t = e.m;
697
+ const n = e.D;
698
+ const i = e.p;
699
+ const r = e.Ae;
700
+ if (i !== null) i.Ae = r;else t.Ne = r;
701
+ if (r !== null) r.p = i;else {
702
+ t.I = i;
703
+ if (i === null) {
704
+ t.ge?.();
705
+ t.L && !t.Pe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
706
+ }
707
+ }
708
+ return n;
709
+ }
710
+ function unobserved(e) {
711
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
712
+ let t = e.C;
713
+ while (t !== null) {
714
+ t = unlinkSubs(t);
715
+ }
716
+ e.C = null;
717
+ disposeChildren(e, true);
718
+ }
719
+ function link(e, t) {
720
+ const n = t.Ce;
721
+ if (n !== null && n.m === e) return;
722
+ let i = null;
723
+ const r = t.O & REACTIVE_RECOMPUTING_DEPS;
724
+ if (r) {
725
+ i = n !== null ? n.D : t.C;
726
+ if (i !== null && i.m === e) {
727
+ t.Ce = i;
728
+ return;
729
+ }
730
+ }
731
+ const o = e.Ne;
732
+ if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
733
+ const s = t.Ce = e.Ne = {
734
+ m: e,
735
+ h: t,
736
+ D: i,
737
+ Ae: o,
738
+ p: null
739
+ };
740
+ if (n !== null) n.D = s;else t.C = s;
741
+ if (o !== null) o.p = s;else e.I = s;
742
+ }
743
+ function isValidLink(e, t) {
744
+ const n = t.Ce;
745
+ if (n !== null) {
746
+ let i = t.C;
747
+ do {
748
+ if (i === e) return true;
749
+ if (i === n) break;
750
+ i = i.D;
751
+ } while (i !== null);
752
+ }
753
+ return false;
754
+ }
755
+ function markDisposal(e) {
756
+ let t = e.De;
757
+ while (t) {
758
+ t.O |= REACTIVE_ZOMBIE;
759
+ if (t.O & REACTIVE_IN_HEAP) {
760
+ deleteFromHeap(t, dirtyQueue);
761
+ insertIntoHeap(t, zombieQueue);
762
+ }
763
+ markDisposal(t);
764
+ t = t.ye;
765
+ }
766
+ }
767
+ function disposeChildren(e, t = false, n) {
768
+ if (e.O & REACTIVE_DISPOSED) return;
769
+ if (t) e.O = REACTIVE_DISPOSED;
770
+ let i = n ? e.ve : e.De;
771
+ while (i) {
772
+ const e = i.ye;
773
+ if (i.C) {
774
+ const e = i;
775
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
776
+ let t = e.C;
777
+ do {
778
+ t = unlinkSubs(t);
779
+ } while (t !== null);
780
+ e.C = null;
781
+ e.Ce = null;
782
+ }
783
+ disposeChildren(i, true);
784
+ i = e;
785
+ }
786
+ if (n) {
787
+ e.ve = null;
788
+ } else {
789
+ e.De = null;
790
+ e.we = 0;
791
+ }
792
+ runDisposal(e, n);
793
+ }
794
+ function runDisposal(e, t) {
795
+ let n = t ? e.be : e.me;
796
+ if (!n) return;
797
+ if (Array.isArray(n)) {
798
+ for (let e = 0; e < n.length; e++) {
799
+ const t = n[e];
800
+ t.call(t);
801
+ }
802
+ } else {
803
+ n.call(n);
804
+ }
805
+ t ? e.be = null : e.me = null;
806
+ }
807
+ let externalSourceConfig = null;
808
+ GlobalQueue.K = recompute;
809
+ GlobalQueue.Y = disposeChildren;
810
+ let tracking = false;
811
+ let stale = false;
812
+ let context = null;
813
+ let currentOptimisticLane = null;
814
+ function recompute(e, t = false) {
815
+ const n = e.se;
816
+ if (!t) {
817
+ if (e.ne && (!n || activeTransition) && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
818
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
819
+ if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);else {
820
+ markDisposal(e);
821
+ e.be = e.me;
822
+ e.ve = e.De;
823
+ e.me = null;
824
+ e.De = null;
825
+ e.we = 0;
826
+ }
827
+ }
828
+ const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
829
+ const r = e.Te !== undefined && e.Te !== NOT_PENDING;
830
+ const o = !!(e.Ee & STATUS_PENDING);
831
+ const s = context;
832
+ context = e;
833
+ e.Ce = null;
834
+ e.O = REACTIVE_RECOMPUTING_DEPS;
835
+ e.J = clock;
836
+ let u = e.le === NOT_PENDING ? e.fe : e.le;
837
+ let c = e.o;
838
+ let a = tracking;
839
+ let l = currentOptimisticLane;
840
+ tracking = true;
841
+ if (i) {
842
+ const t = resolveLane(e);
843
+ if (t) currentOptimisticLane = t;
844
+ }
845
+ try {
846
+ u = handleAsync(e, e.L(u));
847
+ clearStatus(e);
848
+ const t = resolveLane(e);
849
+ if (t) {
850
+ t.U.delete(e);
851
+ updatePendingSignal(t.de);
852
+ }
853
+ } catch (t) {
854
+ if (t instanceof NotReadyError && currentOptimisticLane) {
855
+ const t = findLane(currentOptimisticLane);
856
+ if (t.de !== e) {
857
+ t.U.add(e);
858
+ e.ie = t;
859
+ updatePendingSignal(t.de);
860
+ }
861
+ }
862
+ notifyStatus(e, t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, t, undefined, t instanceof NotReadyError ? e.ie : undefined);
863
+ } finally {
864
+ tracking = a;
865
+ e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
866
+ context = s;
867
+ }
868
+ if (!e.q) {
869
+ const s = e.Ce;
870
+ let a = s !== null ? s.D : e.C;
871
+ if (a !== null) {
872
+ do {
873
+ a = unlinkSubs(a);
874
+ } while (a !== null);
875
+ if (s !== null) s.D = null;else e.C = null;
876
+ }
877
+ const l = r ? e.Te : e.le === NOT_PENDING ? e.fe : e.le;
878
+ const f = !e.Ie || !e.Ie(l, u);
879
+ if (f) {
880
+ const s = r ? e.Te : undefined;
881
+ if (t || n && activeTransition !== e.ne || i) {
882
+ e.fe = u;
883
+ if (r && i) {
884
+ e.Te = u;
885
+ e.le = u;
886
+ }
887
+ } else e.le = u;
888
+ if (r && !i && o && !e.Oe) e.Te = u;
889
+ if (!r || i || e.Te !== s) insertSubs(e, i || r);
890
+ } else if (r) {
891
+ e.le = u;
892
+ } else if (e.o != c) {
893
+ for (let t = e.I; t !== null; t = t.p) {
894
+ insertIntoHeapHeight(t.h, t.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
895
+ }
896
+ }
897
+ }
898
+ currentOptimisticLane = l;
899
+ (!t || e.Ee & STATUS_PENDING) && !e.ne && !(activeTransition && r) && globalQueue.M.push(e);
900
+ e.ne && n && activeTransition !== e.ne && runInTransition(e.ne, () => recompute(e));
901
+ }
902
+ function updateIfNecessary(e) {
903
+ if (e.O & REACTIVE_CHECK) {
904
+ for (let t = e.C; t; t = t.D) {
905
+ const n = t.m;
906
+ const i = n.V || n;
907
+ if (i.L) {
908
+ updateIfNecessary(i);
909
+ }
910
+ if (e.O & REACTIVE_DIRTY) {
911
+ break;
912
+ }
913
+ }
914
+ }
915
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || e.q && e.J < clock && !e._e) {
916
+ recompute(e);
917
+ }
918
+ e.O = REACTIVE_NONE | e.O & REACTIVE_SNAPSHOT_STALE;
919
+ }
920
+ function computed(e, t, n) {
921
+ const i = n?.transparent;
922
+ const r = {
923
+ id: n?.id ?? (context?.id ),
924
+ Ve: i,
925
+ Ie: n?.equals != null ? n.equals : isEqual,
926
+ Ge: !!n?.pureWrite,
927
+ ge: n?.unobserved,
928
+ me: null,
929
+ ce: context?.ce ?? globalQueue,
930
+ Le: context?.Le ?? defaultContext,
931
+ we: 0,
932
+ L: e,
933
+ fe: t,
934
+ o: 0,
935
+ A: null,
936
+ S: undefined,
937
+ T: null,
938
+ C: null,
939
+ Ce: null,
940
+ I: null,
941
+ Ne: null,
942
+ i: context,
943
+ ye: null,
944
+ De: null,
945
+ O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
946
+ Ee: STATUS_UNINITIALIZED,
947
+ J: clock,
948
+ le: NOT_PENDING,
949
+ be: null,
950
+ ve: null,
951
+ _e: null,
952
+ ne: null
953
+ };
954
+ r.T = r;
955
+ const o = context?.t ? context.u : context;
956
+ if (context) {
957
+ const e = context.De;
958
+ if (e === null) {
959
+ context.De = r;
960
+ } else {
961
+ r.ye = e;
962
+ context.De = r;
963
+ }
964
+ }
965
+ if (o) r.o = o.o + 1;
966
+ !n?.lazy && recompute(r, true);
967
+ return r;
968
+ }
969
+ function isEqual(e, t) {
970
+ return e === t;
971
+ }
972
+ function untrack(e, t) {
973
+ if (!tracking && true) return e();
974
+ const n = tracking;
975
+ tracking = false;
976
+ try {
977
+ if (externalSourceConfig) ;
978
+ return e();
979
+ } finally {
980
+ tracking = n;
981
+ }
982
+ }
983
+ function read(e) {
984
+ let t = context;
985
+ if (t?.t) t = t.u;
986
+ if (e.O & REACTIVE_LAZY) {
987
+ e.O &= ~REACTIVE_LAZY;
988
+ recompute(e, true);
989
+ }
990
+ const n = e.V || e;
991
+ if (t && tracking) {
992
+ if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
993
+ link(e, t);
994
+ if (n.L) {
995
+ const i = e.O & REACTIVE_ZOMBIE;
996
+ if (n.o >= (i ? zombieQueue.P : dirtyQueue.P)) {
997
+ markNode(t);
998
+ markHeap(i ? zombieQueue : dirtyQueue);
999
+ updateIfNecessary(n);
1000
+ }
1001
+ const r = n.o;
1002
+ if (r >= t.o && e.i !== t) {
1003
+ t.o = r + 1;
1004
+ }
1005
+ }
1006
+ }
1007
+ if (n.Ee & STATUS_PENDING) {
1008
+ const i = n.q?.source;
1009
+ if (i && !(i.Ee & STATUS_PENDING)) clearStatus(n);else if (t && true) {
1010
+ if (currentOptimisticLane) {
1011
+ const i = n.ie;
1012
+ const r = findLane(currentOptimisticLane);
1013
+ if (i && findLane(i) === r && !hasActiveOverride(n)) {
1014
+ if (!tracking && e !== t) link(e, t);
1015
+ throw n.q;
1016
+ }
1017
+ } else {
1018
+ if (!tracking && e !== t) link(e, t);
1019
+ throw n.q;
1020
+ }
1021
+ } else if (!t && n.Ee & STATUS_UNINITIALIZED) {
1022
+ throw n.q;
1023
+ }
1024
+ }
1025
+ if (e.L && e.Ee & STATUS_ERROR) {
1026
+ if (e.J < clock) {
1027
+ recompute(e, true);
1028
+ return read(e);
1029
+ } else throw e.q;
1030
+ }
1031
+ if (e.Te !== undefined && e.Te !== NOT_PENDING) return e.Te;
1032
+ return !t || currentOptimisticLane !== null && (e.Te !== undefined || e.ie || n === e && stale || !!(n.Ee & STATUS_PENDING)) || e.le === NOT_PENDING || stale ? e.fe : e.le;
1033
+ }
1034
+ function setSignal(e, t) {
1035
+ if (e.ne && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
1036
+ const n = e.Te !== undefined && true;
1037
+ const i = e.Te !== undefined && e.Te !== NOT_PENDING;
1038
+ const r = n ? i ? e.Te : e.fe : e.le === NOT_PENDING ? e.fe : e.le;
1039
+ if (typeof t === "function") t = t(r);
1040
+ const o = !e.Ie || !e.Ie(r, t) || !!(e.Ee & STATUS_UNINITIALIZED);
1041
+ if (!o) {
1042
+ if (n && i && e.L) {
1043
+ insertSubs(e, true);
1044
+ schedule();
1045
+ }
1046
+ return t;
1047
+ }
1048
+ if (n) {
1049
+ const n = e.Te === NOT_PENDING;
1050
+ if (!n && e.ne) globalQueue.initTransition(e.ne);
1051
+ if (n) {
1052
+ e.le = e.fe;
1053
+ globalQueue.$.push(e);
1054
+ }
1055
+ e.Oe = true;
1056
+ const i = getOrCreateLane(e);
1057
+ e.ie = i;
1058
+ e.Te = t;
1059
+ } else {
1060
+ if (e.le === NOT_PENDING) globalQueue.M.push(e);
1061
+ e.le = t;
1062
+ }
1063
+ updatePendingSignal(e);
1064
+ if (e.pe) {
1065
+ setSignal(e.pe, t);
1066
+ }
1067
+ e.J = clock;
1068
+ insertSubs(e, n);
1069
+ schedule();
1070
+ return t;
1071
+ }
1072
+ function computePendingState(e) {
1073
+ const t = e;
1074
+ if (e.Te !== undefined && e.Te !== NOT_PENDING) {
1075
+ if (t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1076
+ if (e.Se) {
1077
+ const t = e.ie ? findLane(e.ie) : null;
1078
+ return !!(t && t.U.size > 0);
1079
+ }
1080
+ return true;
1081
+ }
1082
+ if (e.le !== NOT_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1083
+ return !!(t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED));
1084
+ }
1085
+ function updatePendingSignal(e) {
1086
+ if (e.Fe) {
1087
+ const t = computePendingState(e);
1088
+ const n = e.Fe;
1089
+ setSignal(n, t);
1090
+ if (!t && n.ie) {
1091
+ const t = resolveLane(e);
1092
+ if (t && t.U.size > 0) {
1093
+ const e = findLane(n.ie);
1094
+ if (e !== t) {
1095
+ mergeLanes(t, e);
1096
+ }
1097
+ }
1098
+ signalLanes.delete(n);
1099
+ n.ie = undefined;
1100
+ }
1101
+ }
1102
+ }
1103
+ function accessor(e) {
1104
+ const t = read.bind(null, e);
1105
+ t.$r = true;
1106
+ return t;
1107
+ }
1108
+ function createMemo(e, t, n) {
1109
+ let i = computed(e, t, n);
1110
+ return accessor(i);
1111
+ }
1112
+ function isWrappable(e) {
1113
+ return e != null && typeof e === "object" && !Object.isFrozen(e);
1114
+ }
1115
+ const DELETE = Symbol(0);
1116
+ function updatePath(e, t, n = 0) {
1117
+ let i,
1118
+ r = e;
1119
+ if (n < t.length - 1) {
1120
+ i = t[n];
1121
+ const o = typeof i;
1122
+ const s = Array.isArray(e);
1123
+ if (Array.isArray(i)) {
1124
+ for (let r = 0; r < i.length; r++) {
1125
+ t[n] = i[r];
1126
+ updatePath(e, t, n);
1127
+ }
1128
+ t[n] = i;
1129
+ return;
1130
+ } else if (s && o === "function") {
1131
+ for (let r = 0; r < e.length; r++) {
1132
+ if (i(e[r], r)) {
1133
+ t[n] = r;
1134
+ updatePath(e, t, n);
1135
+ }
1136
+ }
1137
+ t[n] = i;
1138
+ return;
1139
+ } else if (s && o === "object") {
1140
+ const {
1141
+ from: r = 0,
1142
+ to: o = e.length - 1,
1143
+ by: s = 1
1144
+ } = i;
1145
+ for (let i = r; i <= o; i += s) {
1146
+ t[n] = i;
1147
+ updatePath(e, t, n);
1148
+ }
1149
+ t[n] = i;
1150
+ return;
1151
+ } else if (n < t.length - 2) {
1152
+ updatePath(e[i], t, n + 1);
1153
+ return;
1154
+ }
1155
+ r = e[i];
1156
+ }
1157
+ let o = t[t.length - 1];
1158
+ if (typeof o === "function") {
1159
+ o = o(r);
1160
+ if (o === r) return;
1161
+ }
1162
+ if (i === undefined && o == undefined) return;
1163
+ if (o === DELETE) {
1164
+ delete e[i];
1165
+ } else if (i === undefined || isWrappable(r) && isWrappable(o) && !Array.isArray(o)) {
1166
+ const t = i !== undefined ? e[i] : e;
1167
+ const n = Object.keys(o);
1168
+ for (let e = 0; e < n.length; e++) t[n[e]] = o[n[e]];
1169
+ } else {
1170
+ e[i] = o;
1171
+ }
1172
+ }
1173
+ Object.assign(function storePath(...e) {
1174
+ return t => {
1175
+ updatePath(t, e);
1176
+ };
1177
+ }, {
1178
+ DELETE: DELETE
1179
+ });
2
1180
 
3
1181
  const effect = (fn, effectFn, initial) => createRenderEffect(fn, effectFn, initial, {
4
1182
  transparent: true
5
1183
  });
6
- const memo = fn => createMemo(() => fn());
1184
+ const memo = (fn, transparent) => transparent ? fn.$r ? fn : createMemo(() => fn(), undefined, {
1185
+ transparent: true
1186
+ }) : createMemo$1(() => fn());
7
1187
 
8
1188
  function createRenderer({
9
1189
  createElement,
@@ -193,7 +1373,7 @@ function createRenderer({
193
1373
  Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
194
1374
  }
195
1375
  function ref(fn, element) {
196
- const resolved = untrack(fn);
1376
+ const resolved = untrack$1(fn);
197
1377
  runWithOwner(null, () => applyRef(resolved, element));
198
1378
  }
199
1379
  return {