@novely/solid-renderer 0.36.1 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.jsx CHANGED
@@ -74,10 +74,8 @@ function createSignal(value, options) {
74
74
  };
75
75
  const setter = (value2) => {
76
76
  if (typeof value2 === "function") {
77
- if (Transition && Transition.running && Transition.sources.has(s))
78
- value2 = value2(s.tValue);
79
- else
80
- value2 = value2(s.value);
77
+ if (Transition && Transition.running && Transition.sources.has(s)) value2 = value2(s.tValue);
78
+ else value2 = value2(s.value);
81
79
  }
82
80
  return writeSignal(s, value2);
83
81
  };
@@ -85,25 +83,19 @@ function createSignal(value, options) {
85
83
  }
86
84
  function createComputed(fn, value, options) {
87
85
  const c = createComputation(fn, value, true, STALE);
88
- if (Scheduler && Transition && Transition.running)
89
- Updates.push(c);
90
- else
91
- updateComputation(c);
86
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
87
+ else updateComputation(c);
92
88
  }
93
89
  function createRenderEffect(fn, value, options) {
94
90
  const c = createComputation(fn, value, false, STALE);
95
- if (Scheduler && Transition && Transition.running)
96
- Updates.push(c);
97
- else
98
- updateComputation(c);
91
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
92
+ else updateComputation(c);
99
93
  }
100
94
  function createEffect(fn, value, options) {
101
95
  runEffects = runUserEffects;
102
96
  const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
103
- if (s)
104
- c.suspense = s;
105
- if (!options || !options.render)
106
- c.user = true;
97
+ if (s) c.suspense = s;
98
+ if (!options || !options.render) c.user = true;
107
99
  Effects ? Effects.push(c) : updateComputation(c);
108
100
  }
109
101
  function createMemo(fn, value, options) {
@@ -115,21 +107,18 @@ function createMemo(fn, value, options) {
115
107
  if (Scheduler && Transition && Transition.running) {
116
108
  c.tState = STALE;
117
109
  Updates.push(c);
118
- } else
119
- updateComputation(c);
110
+ } else updateComputation(c);
120
111
  return readSignal.bind(c);
121
112
  }
122
113
  function batch(fn) {
123
114
  return runUpdates(fn, false);
124
115
  }
125
116
  function untrack(fn) {
126
- if (!ExternalSourceConfig && Listener === null)
127
- return fn();
117
+ if (!ExternalSourceConfig && Listener === null) return fn();
128
118
  const listener = Listener;
129
119
  Listener = null;
130
120
  try {
131
- if (ExternalSourceConfig)
132
- return ExternalSourceConfig.untrack(fn);
121
+ if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
133
122
  return fn();
134
123
  } finally {
135
124
  Listener = listener;
@@ -143,10 +132,8 @@ function on(deps, fn, options) {
143
132
  let input;
144
133
  if (isArray) {
145
134
  input = Array(deps.length);
146
- for (let i = 0; i < deps.length; i++)
147
- input[i] = deps[i]();
148
- } else
149
- input = deps();
135
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
136
+ } else input = deps();
150
137
  if (defer2) {
151
138
  defer2 = false;
152
139
  return prevValue;
@@ -160,12 +147,9 @@ function onMount(fn) {
160
147
  createEffect(() => untrack(fn));
161
148
  }
162
149
  function onCleanup(fn) {
163
- if (Owner === null)
164
- ;
165
- else if (Owner.cleanups === null)
166
- Owner.cleanups = [fn];
167
- else
168
- Owner.cleanups.push(fn);
150
+ if (Owner === null) ;
151
+ else if (Owner.cleanups === null) Owner.cleanups = [fn];
152
+ else Owner.cleanups.push(fn);
169
153
  return fn;
170
154
  }
171
155
  function getOwner() {
@@ -242,8 +226,7 @@ var SuspenseContext;
242
226
  function readSignal() {
243
227
  const runningTransition = Transition && Transition.running;
244
228
  if (this.sources && (runningTransition ? this.tState : this.state)) {
245
- if ((runningTransition ? this.tState : this.state) === STALE)
246
- updateComputation(this);
229
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
247
230
  else {
248
231
  const updates = Updates;
249
232
  Updates = null;
@@ -268,8 +251,7 @@ function readSignal() {
268
251
  this.observerSlots.push(Listener.sources.length - 1);
269
252
  }
270
253
  }
271
- if (runningTransition && Transition.sources.has(this))
272
- return this.tValue;
254
+ if (runningTransition && Transition.sources.has(this)) return this.tValue;
273
255
  return this.value;
274
256
  }
275
257
  function writeSignal(node, value, isComp) {
@@ -281,34 +263,25 @@ function writeSignal(node, value, isComp) {
281
263
  Transition.sources.add(node);
282
264
  node.tValue = value;
283
265
  }
284
- if (!TransitionRunning)
285
- node.value = value;
286
- } else
287
- node.value = value;
266
+ if (!TransitionRunning) node.value = value;
267
+ } else node.value = value;
288
268
  if (node.observers && node.observers.length) {
289
269
  runUpdates(() => {
290
270
  for (let i = 0; i < node.observers.length; i += 1) {
291
271
  const o = node.observers[i];
292
272
  const TransitionRunning = Transition && Transition.running;
293
- if (TransitionRunning && Transition.disposed.has(o))
294
- continue;
273
+ if (TransitionRunning && Transition.disposed.has(o)) continue;
295
274
  if (TransitionRunning ? !o.tState : !o.state) {
296
- if (o.pure)
297
- Updates.push(o);
298
- else
299
- Effects.push(o);
300
- if (o.observers)
301
- markDownstream(o);
275
+ if (o.pure) Updates.push(o);
276
+ else Effects.push(o);
277
+ if (o.observers) markDownstream(o);
302
278
  }
303
- if (!TransitionRunning)
304
- o.state = STALE;
305
- else
306
- o.tState = STALE;
279
+ if (!TransitionRunning) o.state = STALE;
280
+ else o.tState = STALE;
307
281
  }
308
282
  if (Updates.length > 1e6) {
309
283
  Updates = [];
310
- if (false)
311
- ;
284
+ if (false) ;
312
285
  throw new Error();
313
286
  }
314
287
  }, false);
@@ -317,8 +290,7 @@ function writeSignal(node, value, isComp) {
317
290
  return value;
318
291
  }
319
292
  function updateComputation(node) {
320
- if (!node.fn)
321
- return;
293
+ if (!node.fn) return;
322
294
  cleanNode(node);
323
295
  const time = ExecCount;
324
296
  runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
@@ -363,8 +335,7 @@ function runComputation(node, value, time) {
363
335
  } else if (Transition && Transition.running && node.pure) {
364
336
  Transition.sources.add(node);
365
337
  node.tValue = nextValue;
366
- } else
367
- node.value = nextValue;
338
+ } else node.value = nextValue;
368
339
  node.updatedAt = time;
369
340
  }
370
341
  }
@@ -386,19 +357,14 @@ function createComputation(fn, init, pure, state = STALE, options) {
386
357
  c.state = 0;
387
358
  c.tState = state;
388
359
  }
389
- if (Owner === null)
390
- ;
360
+ if (Owner === null) ;
391
361
  else if (Owner !== UNOWNED) {
392
362
  if (Transition && Transition.running && Owner.pure) {
393
- if (!Owner.tOwned)
394
- Owner.tOwned = [c];
395
- else
396
- Owner.tOwned.push(c);
363
+ if (!Owner.tOwned) Owner.tOwned = [c];
364
+ else Owner.tOwned.push(c);
397
365
  } else {
398
- if (!Owner.owned)
399
- Owner.owned = [c];
400
- else
401
- Owner.owned.push(c);
366
+ if (!Owner.owned) Owner.owned = [c];
367
+ else Owner.owned.push(c);
402
368
  }
403
369
  }
404
370
  if (ExternalSourceConfig && c.fn) {
@@ -418,26 +384,20 @@ function createComputation(fn, init, pure, state = STALE, options) {
418
384
  }
419
385
  function runTop(node) {
420
386
  const runningTransition = Transition && Transition.running;
421
- if ((runningTransition ? node.tState : node.state) === 0)
422
- return;
423
- if ((runningTransition ? node.tState : node.state) === PENDING)
424
- return lookUpstream(node);
425
- if (node.suspense && untrack(node.suspense.inFallback))
426
- return node.suspense.effects.push(node);
387
+ if ((runningTransition ? node.tState : node.state) === 0) return;
388
+ if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
389
+ if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
427
390
  const ancestors = [node];
428
391
  while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
429
- if (runningTransition && Transition.disposed.has(node))
430
- return;
431
- if (runningTransition ? node.tState : node.state)
432
- ancestors.push(node);
392
+ if (runningTransition && Transition.disposed.has(node)) return;
393
+ if (runningTransition ? node.tState : node.state) ancestors.push(node);
433
394
  }
434
395
  for (let i = ancestors.length - 1; i >= 0; i--) {
435
396
  node = ancestors[i];
436
397
  if (runningTransition) {
437
398
  let top = node, prev = ancestors[i + 1];
438
399
  while ((top = top.owner) && top !== prev) {
439
- if (Transition.disposed.has(top))
440
- return;
400
+ if (Transition.disposed.has(top)) return;
441
401
  }
442
402
  }
443
403
  if ((runningTransition ? node.tState : node.state) === STALE) {
@@ -451,37 +411,29 @@ function runTop(node) {
451
411
  }
452
412
  }
453
413
  function runUpdates(fn, init) {
454
- if (Updates)
455
- return fn();
414
+ if (Updates) return fn();
456
415
  let wait = false;
457
- if (!init)
458
- Updates = [];
459
- if (Effects)
460
- wait = true;
461
- else
462
- Effects = [];
416
+ if (!init) Updates = [];
417
+ if (Effects) wait = true;
418
+ else Effects = [];
463
419
  ExecCount++;
464
420
  try {
465
421
  const res = fn();
466
422
  completeUpdates(wait);
467
423
  return res;
468
424
  } catch (err) {
469
- if (!wait)
470
- Effects = null;
425
+ if (!wait) Effects = null;
471
426
  Updates = null;
472
427
  handleError(err);
473
428
  }
474
429
  }
475
430
  function completeUpdates(wait) {
476
431
  if (Updates) {
477
- if (Scheduler && Transition && Transition.running)
478
- scheduleQueue(Updates);
479
- else
480
- runQueue(Updates);
432
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
433
+ else runQueue(Updates);
481
434
  Updates = null;
482
435
  }
483
- if (wait)
484
- return;
436
+ if (wait) return;
485
437
  let res;
486
438
  if (Transition) {
487
439
  if (!Transition.promises.size && !Transition.queue.size) {
@@ -495,16 +447,13 @@ function completeUpdates(wait) {
495
447
  }
496
448
  Transition = null;
497
449
  runUpdates(() => {
498
- for (const d of disposed)
499
- cleanNode(d);
450
+ for (const d of disposed) cleanNode(d);
500
451
  for (const v of sources) {
501
452
  v.value = v.tValue;
502
453
  if (v.owned) {
503
- for (let i = 0, len = v.owned.length; i < len; i++)
504
- cleanNode(v.owned[i]);
454
+ for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
505
455
  }
506
- if (v.tOwned)
507
- v.owned = v.tOwned;
456
+ if (v.tOwned) v.owned = v.tOwned;
508
457
  delete v.tValue;
509
458
  delete v.tOwned;
510
459
  v.tState = 0;
@@ -521,14 +470,11 @@ function completeUpdates(wait) {
521
470
  }
522
471
  const e = Effects;
523
472
  Effects = null;
524
- if (e.length)
525
- runUpdates(() => runEffects(e), false);
526
- if (res)
527
- res();
473
+ if (e.length) runUpdates(() => runEffects(e), false);
474
+ if (res) res();
528
475
  }
529
476
  function runQueue(queue) {
530
- for (let i = 0; i < queue.length; i++)
531
- runTop(queue[i]);
477
+ for (let i = 0; i < queue.length; i++) runTop(queue[i]);
532
478
  }
533
479
  function scheduleQueue(queue) {
534
480
  for (let i = 0; i < queue.length; i++) {
@@ -551,10 +497,8 @@ function runUserEffects(queue) {
551
497
  let i, userLength = 0;
552
498
  for (i = 0; i < queue.length; i++) {
553
499
  const e = queue[i];
554
- if (!e.user)
555
- runTop(e);
556
- else
557
- queue[userLength++] = e;
500
+ if (!e.user) runTop(e);
501
+ else queue[userLength++] = e;
558
502
  }
559
503
  if (sharedConfig.context) {
560
504
  if (sharedConfig.count) {
@@ -568,24 +512,19 @@ function runUserEffects(queue) {
568
512
  }
569
513
  setHydrateContext();
570
514
  }
571
- for (i = 0; i < userLength; i++)
572
- runTop(queue[i]);
515
+ for (i = 0; i < userLength; i++) runTop(queue[i]);
573
516
  }
574
517
  function lookUpstream(node, ignore) {
575
518
  const runningTransition = Transition && Transition.running;
576
- if (runningTransition)
577
- node.tState = 0;
578
- else
579
- node.state = 0;
519
+ if (runningTransition) node.tState = 0;
520
+ else node.state = 0;
580
521
  for (let i = 0; i < node.sources.length; i += 1) {
581
522
  const source = node.sources[i];
582
523
  if (source.sources) {
583
524
  const state = runningTransition ? source.tState : source.state;
584
525
  if (state === STALE) {
585
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
586
- runTop(source);
587
- } else if (state === PENDING)
588
- lookUpstream(source, ignore);
526
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
527
+ } else if (state === PENDING) lookUpstream(source, ignore);
589
528
  }
590
529
  }
591
530
  }
@@ -594,14 +533,10 @@ function markDownstream(node) {
594
533
  for (let i = 0; i < node.observers.length; i += 1) {
595
534
  const o = node.observers[i];
596
535
  if (runningTransition ? !o.tState : !o.state) {
597
- if (runningTransition)
598
- o.tState = PENDING;
599
- else
600
- o.state = PENDING;
601
- if (o.pure)
602
- Updates.push(o);
603
- else
604
- Effects.push(o);
536
+ if (runningTransition) o.tState = PENDING;
537
+ else o.state = PENDING;
538
+ if (o.pure) Updates.push(o);
539
+ else Effects.push(o);
605
540
  o.observers && markDownstream(o);
606
541
  }
607
542
  }
@@ -623,25 +558,20 @@ function cleanNode(node) {
623
558
  }
624
559
  if (Transition && Transition.running && node.pure) {
625
560
  if (node.tOwned) {
626
- for (i = node.tOwned.length - 1; i >= 0; i--)
627
- cleanNode(node.tOwned[i]);
561
+ for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
628
562
  delete node.tOwned;
629
563
  }
630
564
  reset(node, true);
631
565
  } else if (node.owned) {
632
- for (i = node.owned.length - 1; i >= 0; i--)
633
- cleanNode(node.owned[i]);
566
+ for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
634
567
  node.owned = null;
635
568
  }
636
569
  if (node.cleanups) {
637
- for (i = node.cleanups.length - 1; i >= 0; i--)
638
- node.cleanups[i]();
570
+ for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
639
571
  node.cleanups = null;
640
572
  }
641
- if (Transition && Transition.running)
642
- node.tState = 0;
643
- else
644
- node.state = 0;
573
+ if (Transition && Transition.running) node.tState = 0;
574
+ else node.state = 0;
645
575
  }
646
576
  function reset(node, top) {
647
577
  if (!top) {
@@ -649,21 +579,18 @@ function reset(node, top) {
649
579
  Transition.disposed.add(node);
650
580
  }
651
581
  if (node.owned) {
652
- for (let i = 0; i < node.owned.length; i++)
653
- reset(node.owned[i]);
582
+ for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
654
583
  }
655
584
  }
656
585
  function castError(err) {
657
- if (err instanceof Error)
658
- return err;
586
+ if (err instanceof Error) return err;
659
587
  return new Error(typeof err === "string" ? err : "Unknown error", {
660
588
  cause: err
661
589
  });
662
590
  }
663
591
  function runErrors(err, fns, owner) {
664
592
  try {
665
- for (const f of fns)
666
- f(err);
593
+ for (const f of fns) f(err);
667
594
  } catch (e) {
668
595
  handleError(e, owner && owner.owner || null);
669
596
  }
@@ -671,21 +598,17 @@ function runErrors(err, fns, owner) {
671
598
  function handleError(err, owner = Owner) {
672
599
  const fns = ERROR && owner && owner.context && owner.context[ERROR];
673
600
  const error = castError(err);
674
- if (!fns)
675
- throw error;
676
- if (Effects)
677
- Effects.push({
678
- fn() {
679
- runErrors(error, fns, owner);
680
- },
681
- state: STALE
682
- });
683
- else
684
- runErrors(error, fns, owner);
601
+ if (!fns) throw error;
602
+ if (Effects) Effects.push({
603
+ fn() {
604
+ runErrors(error, fns, owner);
605
+ },
606
+ state: STALE
607
+ });
608
+ else runErrors(error, fns, owner);
685
609
  }
686
610
  function resolveChildren(children2) {
687
- if (typeof children2 === "function" && !children2.length)
688
- return resolveChildren(children2());
611
+ if (typeof children2 === "function" && !children2.length) return resolveChildren(children2());
689
612
  if (Array.isArray(children2)) {
690
613
  const results = [];
691
614
  for (let i = 0; i < children2.length; i++) {
@@ -724,8 +647,7 @@ function from(producer) {
724
647
  }
725
648
  var FALLBACK = Symbol("fallback");
726
649
  function dispose(d) {
727
- for (let i = 0; i < d.length; i++)
728
- d[i]();
650
+ for (let i = 0; i < d.length; i++) d[i]();
729
651
  }
730
652
  function mapArray(list, mapFn, options = {}) {
731
653
  let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
@@ -763,8 +685,7 @@ function mapArray(list, mapFn, options = {}) {
763
685
  temp = new Array(newLen);
764
686
  tempdisposers = new Array(newLen);
765
687
  indexes && (tempIndexes = new Array(newLen));
766
- for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++)
767
- ;
688
+ for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++) ;
768
689
  for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
769
690
  temp[newEnd] = mapped[end];
770
691
  tempdisposers[newEnd] = disposers[end];
@@ -787,8 +708,7 @@ function mapArray(list, mapFn, options = {}) {
787
708
  indexes && (tempIndexes[j] = indexes[i]);
788
709
  j = newIndicesNext[j];
789
710
  newIndices.set(item, j);
790
- } else
791
- disposers[i]();
711
+ } else disposers[i]();
792
712
  }
793
713
  for (j = start; j < newLen; j++) {
794
714
  if (j in temp) {
@@ -798,8 +718,7 @@ function mapArray(list, mapFn, options = {}) {
798
718
  indexes[j] = tempIndexes[j];
799
719
  indexes[j](j);
800
720
  }
801
- } else
802
- mapped[j] = createRoot(mapper);
721
+ } else mapped[j] = createRoot(mapper);
803
722
  }
804
723
  mapped = mapped.slice(0, len = newLen);
805
724
  items = newItems.slice(0);
@@ -835,13 +754,11 @@ function trueFn() {
835
754
  }
836
755
  var propTraps = {
837
756
  get(_, property, receiver) {
838
- if (property === $PROXY)
839
- return receiver;
757
+ if (property === $PROXY) return receiver;
840
758
  return _.get(property);
841
759
  },
842
760
  has(_, property) {
843
- if (property === $PROXY)
844
- return true;
761
+ if (property === $PROXY) return true;
845
762
  return _.has(property);
846
763
  },
847
764
  set: trueFn,
@@ -867,8 +784,7 @@ function resolveSource(s) {
867
784
  function resolveSources() {
868
785
  for (let i = 0, length = this.length; i < length; ++i) {
869
786
  const v = this[i]();
870
- if (v !== void 0)
871
- return v;
787
+ if (v !== void 0) return v;
872
788
  }
873
789
  }
874
790
  function mergeProps(...sources) {
@@ -883,21 +799,18 @@ function mergeProps(...sources) {
883
799
  get(property) {
884
800
  for (let i = sources.length - 1; i >= 0; i--) {
885
801
  const v = resolveSource(sources[i])[property];
886
- if (v !== void 0)
887
- return v;
802
+ if (v !== void 0) return v;
888
803
  }
889
804
  },
890
805
  has(property) {
891
806
  for (let i = sources.length - 1; i >= 0; i--) {
892
- if (property in resolveSource(sources[i]))
893
- return true;
807
+ if (property in resolveSource(sources[i])) return true;
894
808
  }
895
809
  return false;
896
810
  },
897
811
  keys() {
898
812
  const keys2 = [];
899
- for (let i = 0; i < sources.length; i++)
900
- keys2.push(...Object.keys(resolveSource(sources[i])));
813
+ for (let i = 0; i < sources.length; i++) keys2.push(...Object.keys(resolveSource(sources[i])));
901
814
  return [...new Set(keys2)];
902
815
  }
903
816
  }, propTraps);
@@ -906,13 +819,11 @@ function mergeProps(...sources) {
906
819
  const defined = /* @__PURE__ */ Object.create(null);
907
820
  for (let i = sources.length - 1; i >= 0; i--) {
908
821
  const source = sources[i];
909
- if (!source)
910
- continue;
822
+ if (!source) continue;
911
823
  const sourceKeys = Object.getOwnPropertyNames(source);
912
824
  for (let i2 = sourceKeys.length - 1; i2 >= 0; i2--) {
913
825
  const key = sourceKeys[i2];
914
- if (key === "__proto__" || key === "constructor")
915
- continue;
826
+ if (key === "__proto__" || key === "constructor") continue;
916
827
  const desc = Object.getOwnPropertyDescriptor(source, key);
917
828
  if (!defined[key]) {
918
829
  defined[key] = desc.get ? {
@@ -923,10 +834,8 @@ function mergeProps(...sources) {
923
834
  } else {
924
835
  const sources2 = sourcesMap[key];
925
836
  if (sources2) {
926
- if (desc.get)
927
- sources2.push(desc.get.bind(source));
928
- else if (desc.value !== void 0)
929
- sources2.push(() => desc.value);
837
+ if (desc.get) sources2.push(desc.get.bind(source));
838
+ else if (desc.value !== void 0) sources2.push(() => desc.value);
930
839
  }
931
840
  }
932
841
  }
@@ -935,10 +844,8 @@ function mergeProps(...sources) {
935
844
  const definedKeys = Object.keys(defined);
936
845
  for (let i = definedKeys.length - 1; i >= 0; i--) {
937
846
  const key = definedKeys[i], desc = defined[key];
938
- if (desc && desc.get)
939
- Object.defineProperty(target, key, desc);
940
- else
941
- target[key] = desc ? desc.value : void 0;
847
+ if (desc && desc.get) Object.defineProperty(target, key, desc);
848
+ else target[key] = desc ? desc.value : void 0;
942
849
  }
943
850
  return target;
944
851
  }
@@ -1014,8 +921,7 @@ function Show(props) {
1014
921
  const child = props.children;
1015
922
  const fn = typeof child === "function" && child.length > 0;
1016
923
  return fn ? untrack(() => child(keyed ? c : () => {
1017
- if (!untrack(condition))
1018
- throw narrowedError("Show");
924
+ if (!untrack(condition)) throw narrowedError("Show");
1019
925
  return props.when;
1020
926
  })) : child;
1021
927
  }
@@ -1027,8 +933,7 @@ function Switch(props) {
1027
933
  const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1028
934
  const conditions = children(() => props.children), evalConditions = createMemo(() => {
1029
935
  let conds = conditions();
1030
- if (!Array.isArray(conds))
1031
- conds = [conds];
936
+ if (!Array.isArray(conds)) conds = [conds];
1032
937
  for (let i = 0; i < conds.length; i++) {
1033
938
  const c = conds[i].when;
1034
939
  if (c) {
@@ -1042,13 +947,11 @@ function Switch(props) {
1042
947
  });
1043
948
  return createMemo(() => {
1044
949
  const [index, when, cond] = evalConditions();
1045
- if (index < 0)
1046
- return props.fallback;
950
+ if (index < 0) return props.fallback;
1047
951
  const c = cond.children;
1048
952
  const fn = typeof c === "function" && c.length > 0;
1049
953
  return fn ? untrack(() => c(keyed ? when : () => {
1050
- if (untrack(evalConditions)[0] !== index)
1051
- throw narrowedError("Match");
954
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1052
955
  return cond.when;
1053
956
  })) : c;
1054
957
  }, void 0, void 0);
@@ -1113,12 +1016,10 @@ function reconcileArrays(parentNode, a, b) {
1113
1016
  }
1114
1017
  if (aEnd === aStart) {
1115
1018
  const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
1116
- while (bStart < bEnd)
1117
- parentNode.insertBefore(b[bStart++], node);
1019
+ while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
1118
1020
  } else if (bEnd === bStart) {
1119
1021
  while (aStart < aEnd) {
1120
- if (!map2 || !map2.has(a[aStart]))
1121
- a[aStart].remove();
1022
+ if (!map2 || !map2.has(a[aStart])) a[aStart].remove();
1122
1023
  aStart++;
1123
1024
  }
1124
1025
  } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
@@ -1130,28 +1031,22 @@ function reconcileArrays(parentNode, a, b) {
1130
1031
  if (!map2) {
1131
1032
  map2 = /* @__PURE__ */ new Map();
1132
1033
  let i = bStart;
1133
- while (i < bEnd)
1134
- map2.set(b[i], i++);
1034
+ while (i < bEnd) map2.set(b[i], i++);
1135
1035
  }
1136
1036
  const index = map2.get(a[aStart]);
1137
1037
  if (index != null) {
1138
1038
  if (bStart < index && index < bEnd) {
1139
1039
  let i = aStart, sequence = 1, t;
1140
1040
  while (++i < aEnd && i < bEnd) {
1141
- if ((t = map2.get(a[i])) == null || t !== index + sequence)
1142
- break;
1041
+ if ((t = map2.get(a[i])) == null || t !== index + sequence) break;
1143
1042
  sequence++;
1144
1043
  }
1145
1044
  if (sequence > index - bStart) {
1146
1045
  const node = a[aStart];
1147
- while (bStart < index)
1148
- parentNode.insertBefore(b[bStart++], node);
1149
- } else
1150
- parentNode.replaceChild(b[bStart++], a[aStart++]);
1151
- } else
1152
- aStart++;
1153
- } else
1154
- a[aStart++].remove();
1046
+ while (bStart < index) parentNode.insertBefore(b[bStart++], node);
1047
+ } else parentNode.replaceChild(b[bStart++], a[aStart++]);
1048
+ } else aStart++;
1049
+ } else a[aStart++].remove();
1155
1050
  }
1156
1051
  }
1157
1052
  }
@@ -1189,67 +1084,52 @@ function delegateEvents(eventNames, document2 = window.document) {
1189
1084
  }
1190
1085
  }
1191
1086
  function setAttribute(node, name, value) {
1192
- if (!!sharedConfig.context && node.isConnected)
1193
- return;
1194
- if (value == null)
1195
- node.removeAttribute(name);
1196
- else
1197
- node.setAttribute(name, value);
1087
+ if (!!sharedConfig.context && node.isConnected) return;
1088
+ if (value == null) node.removeAttribute(name);
1089
+ else node.setAttribute(name, value);
1198
1090
  }
1199
1091
  function setAttributeNS(node, namespace, name, value) {
1200
- if (!!sharedConfig.context && node.isConnected)
1201
- return;
1202
- if (value == null)
1203
- node.removeAttributeNS(namespace, name);
1204
- else
1205
- node.setAttributeNS(namespace, name, value);
1092
+ if (!!sharedConfig.context && node.isConnected) return;
1093
+ if (value == null) node.removeAttributeNS(namespace, name);
1094
+ else node.setAttributeNS(namespace, name, value);
1206
1095
  }
1207
1096
  function className(node, value) {
1208
- if (!!sharedConfig.context && node.isConnected)
1209
- return;
1210
- if (value == null)
1211
- node.removeAttribute("class");
1212
- else
1213
- node.className = value;
1097
+ if (!!sharedConfig.context && node.isConnected) return;
1098
+ if (value == null) node.removeAttribute("class");
1099
+ else node.className = value;
1214
1100
  }
1215
1101
  function addEventListener2(node, name, handler, delegate) {
1216
1102
  if (delegate) {
1217
1103
  if (Array.isArray(handler)) {
1218
1104
  node[`$$${name}`] = handler[0];
1219
1105
  node[`$$${name}Data`] = handler[1];
1220
- } else
1221
- node[`$$${name}`] = handler;
1106
+ } else node[`$$${name}`] = handler;
1222
1107
  } else if (Array.isArray(handler)) {
1223
1108
  const handlerFn = handler[0];
1224
1109
  node.addEventListener(name, handler[0] = (e) => handlerFn.call(node, handler[1], e));
1225
- } else
1226
- node.addEventListener(name, handler);
1110
+ } else node.addEventListener(name, handler);
1227
1111
  }
1228
1112
  function classList(node, value, prev = {}) {
1229
1113
  const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
1230
1114
  let i, len;
1231
1115
  for (i = 0, len = prevKeys.length; i < len; i++) {
1232
1116
  const key = prevKeys[i];
1233
- if (!key || key === "undefined" || value[key])
1234
- continue;
1117
+ if (!key || key === "undefined" || value[key]) continue;
1235
1118
  toggleClassKey(node, key, false);
1236
1119
  delete prev[key];
1237
1120
  }
1238
1121
  for (i = 0, len = classKeys.length; i < len; i++) {
1239
1122
  const key = classKeys[i], classValue = !!value[key];
1240
- if (!key || key === "undefined" || prev[key] === classValue || !classValue)
1241
- continue;
1123
+ if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
1242
1124
  toggleClassKey(node, key, true);
1243
1125
  prev[key] = classValue;
1244
1126
  }
1245
1127
  return prev;
1246
1128
  }
1247
1129
  function style(node, value, prev) {
1248
- if (!value)
1249
- return prev ? setAttribute(node, "style") : value;
1130
+ if (!value) return prev ? setAttribute(node, "style") : value;
1250
1131
  const nodeStyle = node.style;
1251
- if (typeof value === "string")
1252
- return nodeStyle.cssText = value;
1132
+ if (typeof value === "string") return nodeStyle.cssText = value;
1253
1133
  typeof prev === "string" && (nodeStyle.cssText = prev = void 0);
1254
1134
  prev || (prev = {});
1255
1135
  value || (value = {});
@@ -1280,25 +1160,21 @@ function use(fn, element, arg) {
1280
1160
  return untrack(() => fn(element, arg));
1281
1161
  }
1282
1162
  function insert(parent, accessor, marker, initial) {
1283
- if (marker !== void 0 && !initial)
1284
- initial = [];
1285
- if (typeof accessor !== "function")
1286
- return insertExpression(parent, accessor, initial, marker);
1163
+ if (marker !== void 0 && !initial) initial = [];
1164
+ if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
1287
1165
  createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
1288
1166
  }
1289
1167
  function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
1290
1168
  props || (props = {});
1291
1169
  for (const prop in prevProps) {
1292
1170
  if (!(prop in props)) {
1293
- if (prop === "children")
1294
- continue;
1171
+ if (prop === "children") continue;
1295
1172
  prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
1296
1173
  }
1297
1174
  }
1298
1175
  for (const prop in props) {
1299
1176
  if (prop === "children") {
1300
- if (!skipChildren)
1301
- insertExpression(node, props.children);
1177
+ if (!skipChildren) insertExpression(node, props.children);
1302
1178
  continue;
1303
1179
  }
1304
1180
  const value = props[prop];
@@ -1310,20 +1186,15 @@ function toPropertyName(name) {
1310
1186
  }
1311
1187
  function toggleClassKey(node, key, value) {
1312
1188
  const classNames = key.trim().split(/\s+/);
1313
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
1314
- node.classList.toggle(classNames[i], value);
1189
+ for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
1315
1190
  }
1316
1191
  function assignProp(node, prop, value, prev, isSVG, skipRef) {
1317
1192
  let isCE, isProp, isChildProp, propAlias, forceProp;
1318
- if (prop === "style")
1319
- return style(node, value, prev);
1320
- if (prop === "classList")
1321
- return classList(node, value, prev);
1322
- if (value === prev)
1323
- return prev;
1193
+ if (prop === "style") return style(node, value, prev);
1194
+ if (prop === "classList") return classList(node, value, prev);
1195
+ if (value === prev) return prev;
1324
1196
  if (prop === "ref") {
1325
- if (!skipRef)
1326
- value(node);
1197
+ if (!skipRef) value(node);
1327
1198
  } else if (prop.slice(0, 3) === "on:") {
1328
1199
  const e = prop.slice(3);
1329
1200
  prev && node.removeEventListener(e, prev);
@@ -1349,20 +1220,14 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
1349
1220
  if (forceProp) {
1350
1221
  prop = prop.slice(5);
1351
1222
  isProp = true;
1352
- } else if (!!sharedConfig.context && node.isConnected)
1353
- return value;
1354
- if (prop === "class" || prop === "className")
1355
- className(node, value);
1356
- else if (isCE && !isProp && !isChildProp)
1357
- node[toPropertyName(prop)] = value;
1358
- else
1359
- node[propAlias || prop] = value;
1223
+ } else if (!!sharedConfig.context && node.isConnected) return value;
1224
+ if (prop === "class" || prop === "className") className(node, value);
1225
+ else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
1226
+ else node[propAlias || prop] = value;
1360
1227
  } else {
1361
1228
  const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
1362
- if (ns)
1363
- setAttributeNS(node, ns, prop, value);
1364
- else
1365
- setAttribute(node, Aliases[prop] || prop, value);
1229
+ if (ns) setAttributeNS(node, ns, prop, value);
1230
+ else setAttribute(node, Aliases[prop] || prop, value);
1366
1231
  }
1367
1232
  return value;
1368
1233
  }
@@ -1381,15 +1246,13 @@ function eventHandler(e) {
1381
1246
  return node || document;
1382
1247
  }
1383
1248
  });
1384
- if (sharedConfig.registry && !sharedConfig.done)
1385
- sharedConfig.done = _$HY.done = true;
1249
+ if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
1386
1250
  while (node) {
1387
1251
  const handler = node[key];
1388
1252
  if (handler && !node.disabled) {
1389
1253
  const data = node[`${key}Data`];
1390
1254
  data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
1391
- if (e.cancelBubble)
1392
- return;
1255
+ if (e.cancelBubble) return;
1393
1256
  }
1394
1257
  node = node._$host || node.parentNode || node.host;
1395
1258
  }
@@ -1401,49 +1264,39 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
1401
1264
  let cleaned = [];
1402
1265
  for (let i = 0; i < current.length; i++) {
1403
1266
  const node = current[i];
1404
- if (node.nodeType === 8 && node.data.slice(0, 2) === "!$")
1405
- node.remove();
1406
- else
1407
- cleaned.push(node);
1267
+ if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
1268
+ else cleaned.push(node);
1408
1269
  }
1409
1270
  current = cleaned;
1410
1271
  }
1411
- while (typeof current === "function")
1412
- current = current();
1413
- if (value === current)
1414
- return current;
1272
+ while (typeof current === "function") current = current();
1273
+ if (value === current) return current;
1415
1274
  const t = typeof value, multi = marker !== void 0;
1416
1275
  parent = multi && current[0] && current[0].parentNode || parent;
1417
1276
  if (t === "string" || t === "number") {
1418
- if (hydrating)
1419
- return current;
1277
+ if (hydrating) return current;
1420
1278
  if (t === "number") {
1421
1279
  value = value.toString();
1422
- if (value === current)
1423
- return current;
1280
+ if (value === current) return current;
1424
1281
  }
1425
1282
  if (multi) {
1426
1283
  let node = current[0];
1427
1284
  if (node && node.nodeType === 3) {
1428
1285
  node.data !== value && (node.data = value);
1429
- } else
1430
- node = document.createTextNode(value);
1286
+ } else node = document.createTextNode(value);
1431
1287
  current = cleanChildren(parent, current, marker, node);
1432
1288
  } else {
1433
1289
  if (current !== "" && typeof current === "string") {
1434
1290
  current = parent.firstChild.data = value;
1435
- } else
1436
- current = parent.textContent = value;
1291
+ } else current = parent.textContent = value;
1437
1292
  }
1438
1293
  } else if (value == null || t === "boolean") {
1439
- if (hydrating)
1440
- return current;
1294
+ if (hydrating) return current;
1441
1295
  current = cleanChildren(parent, current, marker);
1442
1296
  } else if (t === "function") {
1443
1297
  createRenderEffect(() => {
1444
1298
  let v = value();
1445
- while (typeof v === "function")
1446
- v = v();
1299
+ while (typeof v === "function") v = v();
1447
1300
  current = insertExpression(parent, v, current, marker);
1448
1301
  });
1449
1302
  return () => current;
@@ -1455,60 +1308,49 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
1455
1308
  return () => current;
1456
1309
  }
1457
1310
  if (hydrating) {
1458
- if (!array.length)
1459
- return current;
1460
- if (marker === void 0)
1461
- return [...parent.childNodes];
1311
+ if (!array.length) return current;
1312
+ if (marker === void 0) return [...parent.childNodes];
1462
1313
  let node = array[0];
1463
1314
  let nodes = [node];
1464
- while ((node = node.nextSibling) !== marker)
1465
- nodes.push(node);
1315
+ while ((node = node.nextSibling) !== marker) nodes.push(node);
1466
1316
  return current = nodes;
1467
1317
  }
1468
1318
  if (array.length === 0) {
1469
1319
  current = cleanChildren(parent, current, marker);
1470
- if (multi)
1471
- return current;
1320
+ if (multi) return current;
1472
1321
  } else if (currentArray) {
1473
1322
  if (current.length === 0) {
1474
1323
  appendNodes(parent, array, marker);
1475
- } else
1476
- reconcileArrays(parent, current, array);
1324
+ } else reconcileArrays(parent, current, array);
1477
1325
  } else {
1478
1326
  current && cleanChildren(parent);
1479
1327
  appendNodes(parent, array);
1480
1328
  }
1481
1329
  current = array;
1482
1330
  } else if (value.nodeType) {
1483
- if (hydrating && value.parentNode)
1484
- return current = multi ? [value] : value;
1331
+ if (hydrating && value.parentNode) return current = multi ? [value] : value;
1485
1332
  if (Array.isArray(current)) {
1486
- if (multi)
1487
- return current = cleanChildren(parent, current, marker, value);
1333
+ if (multi) return current = cleanChildren(parent, current, marker, value);
1488
1334
  cleanChildren(parent, current, null, value);
1489
1335
  } else if (current == null || current === "" || !parent.firstChild) {
1490
1336
  parent.appendChild(value);
1491
- } else
1492
- parent.replaceChild(value, parent.firstChild);
1337
+ } else parent.replaceChild(value, parent.firstChild);
1493
1338
  current = value;
1494
- } else
1495
- ;
1339
+ } else ;
1496
1340
  return current;
1497
1341
  }
1498
1342
  function normalizeIncomingArray(normalized, array, current, unwrap) {
1499
1343
  let dynamic = false;
1500
1344
  for (let i = 0, len = array.length; i < len; i++) {
1501
1345
  let item = array[i], prev = current && current[normalized.length], t;
1502
- if (item == null || item === true || item === false)
1503
- ;
1346
+ if (item == null || item === true || item === false) ;
1504
1347
  else if ((t = typeof item) === "object" && item.nodeType) {
1505
1348
  normalized.push(item);
1506
1349
  } else if (Array.isArray(item)) {
1507
1350
  dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
1508
1351
  } else if (t === "function") {
1509
1352
  if (unwrap) {
1510
- while (typeof item === "function")
1511
- item = item();
1353
+ while (typeof item === "function") item = item();
1512
1354
  dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
1513
1355
  } else {
1514
1356
  normalized.push(item);
@@ -1516,21 +1358,17 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
1516
1358
  }
1517
1359
  } else {
1518
1360
  const value = String(item);
1519
- if (prev && prev.nodeType === 3 && prev.data === value)
1520
- normalized.push(prev);
1521
- else
1522
- normalized.push(document.createTextNode(value));
1361
+ if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
1362
+ else normalized.push(document.createTextNode(value));
1523
1363
  }
1524
1364
  }
1525
1365
  return dynamic;
1526
1366
  }
1527
1367
  function appendNodes(parent, array, marker = null) {
1528
- for (let i = 0, len = array.length; i < len; i++)
1529
- parent.insertBefore(array[i], marker);
1368
+ for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
1530
1369
  }
1531
1370
  function cleanChildren(parent, current, marker, replacement) {
1532
- if (marker === void 0)
1533
- return parent.textContent = "";
1371
+ if (marker === void 0) return parent.textContent = "";
1534
1372
  const node = replacement || document.createTextNode("");
1535
1373
  if (current.length) {
1536
1374
  let inserted = false;
@@ -1538,15 +1376,11 @@ function cleanChildren(parent, current, marker, replacement) {
1538
1376
  const el = current[i];
1539
1377
  if (node !== el) {
1540
1378
  const isParent = el.parentNode === parent;
1541
- if (!inserted && !i)
1542
- isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
1543
- else
1544
- isParent && el.remove();
1545
- } else
1546
- inserted = true;
1547
- }
1548
- } else
1549
- parent.insertBefore(node, marker);
1379
+ if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
1380
+ else isParent && el.remove();
1381
+ } else inserted = true;
1382
+ }
1383
+ } else parent.insertBefore(node, marker);
1550
1384
  return [node];
1551
1385
  }
1552
1386
  var RequestContext = Symbol();
@@ -1562,8 +1396,7 @@ function Portal(props) {
1562
1396
  let content;
1563
1397
  let hydrating = !!sharedConfig.context;
1564
1398
  createEffect(() => {
1565
- if (hydrating)
1566
- getOwner().user = hydrating = false;
1399
+ if (hydrating) getOwner().user = hydrating = false;
1567
1400
  content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
1568
1401
  const el = mount();
1569
1402
  if (el instanceof HTMLHeadElement) {
@@ -1609,10 +1442,8 @@ var cleanStores = (...stores) => {
1609
1442
  cleanTasks();
1610
1443
  for (let $store of stores) {
1611
1444
  if ($store) {
1612
- if ($store.mocked)
1613
- delete $store.mocked;
1614
- if ($store[clean])
1615
- $store[clean]();
1445
+ if ($store.mocked) delete $store.mocked;
1446
+ if ($store[clean]) $store[clean]();
1616
1447
  }
1617
1448
  }
1618
1449
  };
@@ -1646,8 +1477,7 @@ var atom = (initialValue) => {
1646
1477
  let index = listeners.indexOf(listener);
1647
1478
  if (~index) {
1648
1479
  listeners.splice(index, 1);
1649
- if (!--$atom.lc)
1650
- $atom.off();
1480
+ if (!--$atom.lc) $atom.off();
1651
1481
  }
1652
1482
  };
1653
1483
  },
@@ -1732,8 +1562,7 @@ var STORE_UNMOUNT_DELAY = 1e3;
1732
1562
  var onMount2 = ($store, initialize) => {
1733
1563
  let listener = (payload) => {
1734
1564
  let destroy = initialize(payload);
1735
- if (destroy)
1736
- $store.events[UNMOUNT].push(destroy);
1565
+ if (destroy) $store.events[UNMOUNT].push(destroy);
1737
1566
  };
1738
1567
  return on2($store, listener, MOUNT, (runListeners) => {
1739
1568
  let originListen = $store.listen;
@@ -1751,8 +1580,7 @@ var onMount2 = ($store, initialize) => {
1751
1580
  setTimeout(() => {
1752
1581
  if ($store.active && !$store.lc) {
1753
1582
  $store.active = false;
1754
- for (let destroy of $store.events[UNMOUNT])
1755
- destroy();
1583
+ for (let destroy of $store.events[UNMOUNT]) destroy();
1756
1584
  $store.events[UNMOUNT] = [];
1757
1585
  }
1758
1586
  }, STORE_UNMOUNT_DELAY);
@@ -1760,8 +1588,7 @@ var onMount2 = ($store, initialize) => {
1760
1588
  if (true) {
1761
1589
  let originClean = $store[clean];
1762
1590
  $store[clean] = () => {
1763
- for (let destroy of $store.events[UNMOUNT])
1764
- destroy();
1591
+ for (let destroy of $store.events[UNMOUNT]) destroy();
1765
1592
  $store.events[UNMOUNT] = [];
1766
1593
  $store.active = false;
1767
1594
  originClean();
@@ -1849,23 +1676,18 @@ function deepMap(initial = {}) {
1849
1676
  var has = Object.prototype.hasOwnProperty;
1850
1677
  function find(iter, tar, key) {
1851
1678
  for (key of iter.keys()) {
1852
- if (dequal(key, tar))
1853
- return key;
1679
+ if (dequal(key, tar)) return key;
1854
1680
  }
1855
1681
  }
1856
1682
  function dequal(foo, bar) {
1857
1683
  var ctor, len, tmp;
1858
- if (foo === bar)
1859
- return true;
1684
+ if (foo === bar) return true;
1860
1685
  if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
1861
- if (ctor === Date)
1862
- return foo.getTime() === bar.getTime();
1863
- if (ctor === RegExp)
1864
- return foo.toString() === bar.toString();
1686
+ if (ctor === Date) return foo.getTime() === bar.getTime();
1687
+ if (ctor === RegExp) return foo.toString() === bar.toString();
1865
1688
  if (ctor === Array) {
1866
1689
  if ((len = foo.length) === bar.length) {
1867
- while (len-- && dequal(foo[len], bar[len]))
1868
- ;
1690
+ while (len-- && dequal(foo[len], bar[len])) ;
1869
1691
  }
1870
1692
  return len === -1;
1871
1693
  }
@@ -1877,11 +1699,9 @@ function dequal(foo, bar) {
1877
1699
  tmp = len;
1878
1700
  if (tmp && typeof tmp === "object") {
1879
1701
  tmp = find(bar, tmp);
1880
- if (!tmp)
1881
- return false;
1702
+ if (!tmp) return false;
1882
1703
  }
1883
- if (!bar.has(tmp))
1884
- return false;
1704
+ if (!bar.has(tmp)) return false;
1885
1705
  }
1886
1706
  return true;
1887
1707
  }
@@ -1893,8 +1713,7 @@ function dequal(foo, bar) {
1893
1713
  tmp = len[0];
1894
1714
  if (tmp && typeof tmp === "object") {
1895
1715
  tmp = find(bar, tmp);
1896
- if (!tmp)
1897
- return false;
1716
+ if (!tmp) return false;
1898
1717
  }
1899
1718
  if (!dequal(len[1], bar.get(tmp))) {
1900
1719
  return false;
@@ -1907,25 +1726,21 @@ function dequal(foo, bar) {
1907
1726
  bar = new Uint8Array(bar);
1908
1727
  } else if (ctor === DataView) {
1909
1728
  if ((len = foo.byteLength) === bar.byteLength) {
1910
- while (len-- && foo.getInt8(len) === bar.getInt8(len))
1911
- ;
1729
+ while (len-- && foo.getInt8(len) === bar.getInt8(len)) ;
1912
1730
  }
1913
1731
  return len === -1;
1914
1732
  }
1915
1733
  if (ArrayBuffer.isView(foo)) {
1916
1734
  if ((len = foo.byteLength) === bar.byteLength) {
1917
- while (len-- && foo[len] === bar[len])
1918
- ;
1735
+ while (len-- && foo[len] === bar[len]) ;
1919
1736
  }
1920
1737
  return len === -1;
1921
1738
  }
1922
1739
  if (!ctor || typeof foo === "object") {
1923
1740
  len = 0;
1924
1741
  for (ctor in foo) {
1925
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor))
1926
- return false;
1927
- if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor]))
1928
- return false;
1742
+ if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
1743
+ if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
1929
1744
  }
1930
1745
  return Object.keys(bar).length === len;
1931
1746
  }
@@ -2109,8 +1924,7 @@ var createQueue = (queue, stopped = false) => {
2109
1924
  const run = async () => {
2110
1925
  const items = queue.slice();
2111
1926
  for await (const item of items) {
2112
- if (stopped)
2113
- break;
1927
+ if (stopped) break;
2114
1928
  try {
2115
1929
  await item();
2116
1930
  } catch (error) {
@@ -2230,15 +2044,13 @@ var createAudio = (options) => {
2230
2044
  let resume = false;
2231
2045
  const unregister = registerEventListeners({
2232
2046
  focus: () => {
2233
- if (!options.pauseOnBlur || !resume || state.destroyed)
2234
- return;
2047
+ if (!options.pauseOnBlur || !resume || state.destroyed) return;
2235
2048
  resume = false;
2236
2049
  queue.queue.push(playAudio);
2237
2050
  queue.execute();
2238
2051
  },
2239
2052
  blur: () => {
2240
- if (!options.pauseOnBlur || !state.playing || state.destroyed)
2241
- return;
2053
+ if (!options.pauseOnBlur || !state.playing || state.destroyed) return;
2242
2054
  resume = true;
2243
2055
  queue.queue.push(pauseAudio);
2244
2056
  queue.execute();
@@ -2250,8 +2062,7 @@ var createAudio = (options) => {
2250
2062
  destroyed: false
2251
2063
  };
2252
2064
  const playAudio = async () => {
2253
- if (state.destroyed)
2254
- return;
2065
+ if (state.destroyed) return;
2255
2066
  if (audioContext.state === "suspended") {
2256
2067
  await audioContext.resume();
2257
2068
  if (state.started) {
@@ -2265,8 +2076,7 @@ var createAudio = (options) => {
2265
2076
  }
2266
2077
  };
2267
2078
  const pauseAudio = async () => {
2268
- if (state.destroyed)
2269
- return;
2079
+ if (state.destroyed) return;
2270
2080
  if (audioContext.state === "suspended" && queue.queue.at(-1) === playAudio) {
2271
2081
  queue.queue.pop();
2272
2082
  }
@@ -2281,20 +2091,17 @@ var createAudio = (options) => {
2281
2091
  };
2282
2092
  const instance = {
2283
2093
  async play() {
2284
- if (state.destroyed)
2285
- return;
2094
+ if (state.destroyed) return;
2286
2095
  queue.queue.push(playAudio);
2287
2096
  return queue.execute();
2288
2097
  },
2289
2098
  async pause() {
2290
- if (state.destroyed)
2291
- return;
2099
+ if (state.destroyed) return;
2292
2100
  queue.queue.push(pauseAudio);
2293
2101
  return queue.execute();
2294
2102
  },
2295
2103
  async reset() {
2296
- if (state.destroyed)
2297
- return;
2104
+ if (state.destroyed) return;
2298
2105
  if (state.playing) {
2299
2106
  queue.queue.push(pauseAudio);
2300
2107
  }
@@ -2310,8 +2117,7 @@ var createAudio = (options) => {
2310
2117
  return queue.execute();
2311
2118
  },
2312
2119
  async stop() {
2313
- if (state.destroyed)
2314
- return;
2120
+ if (state.destroyed) return;
2315
2121
  queue.queue.push(
2316
2122
  pauseAudio,
2317
2123
  disconnectAudio,
@@ -2322,8 +2128,7 @@ var createAudio = (options) => {
2322
2128
  return queue.execute();
2323
2129
  },
2324
2130
  async destroy() {
2325
- if (state.destroyed)
2326
- return;
2131
+ if (state.destroyed) return;
2327
2132
  unregister();
2328
2133
  queue.queue = [
2329
2134
  pauseAudio,
@@ -2338,8 +2143,7 @@ var createAudio = (options) => {
2338
2143
  audioBuffer = null;
2339
2144
  },
2340
2145
  async fetch() {
2341
- if (state.destroyed)
2342
- return;
2146
+ if (state.destroyed) return;
2343
2147
  await fetchArrayBuffer();
2344
2148
  },
2345
2149
  get playing() {
@@ -2352,8 +2156,7 @@ var createAudio = (options) => {
2352
2156
  return pendingVolume;
2353
2157
  },
2354
2158
  set volume(value) {
2355
- if (state.destroyed)
2356
- return;
2159
+ if (state.destroyed) return;
2357
2160
  pendingVolume = value;
2358
2161
  queue.queue.push(setVolume);
2359
2162
  queue.execute();
@@ -2362,8 +2165,7 @@ var createAudio = (options) => {
2362
2165
  return pendingLoop;
2363
2166
  },
2364
2167
  set loop(value) {
2365
- if (state.destroyed)
2366
- return;
2168
+ if (state.destroyed) return;
2367
2169
  pendingLoop = value;
2368
2170
  queue.queue.push(setLoop);
2369
2171
  queue.execute();
@@ -2572,8 +2374,7 @@ var createAudio2 = (storageData) => {
2572
2374
  const getAudio = (type, src) => {
2573
2375
  const kind = type === "voice" ? "voices" : type;
2574
2376
  const cached = store[kind][src];
2575
- if (cached)
2576
- return cached;
2377
+ if (cached) return cached;
2577
2378
  const audio = createAudio({
2578
2379
  src,
2579
2380
  volume: getVolume(type),
@@ -2592,10 +2393,7 @@ var createAudio2 = (storageData) => {
2592
2393
  resource.pause();
2593
2394
  },
2594
2395
  play(loop) {
2595
- try {
2596
- resource.loop = loop;
2597
- } catch {
2598
- }
2396
+ resource.loop = loop;
2599
2397
  resource.play();
2600
2398
  },
2601
2399
  stop() {
@@ -2610,35 +2408,23 @@ var createAudio2 = (storageData) => {
2610
2408
  resource.play();
2611
2409
  },
2612
2410
  voiceStop() {
2613
- if (!store.voice)
2614
- return;
2411
+ if (!store.voice) return;
2615
2412
  store.voice.stop();
2616
2413
  store.voice = void 0;
2617
2414
  },
2618
2415
  start() {
2619
- if (unsubscribe !== noop)
2620
- return;
2416
+ if (unsubscribe !== noop) return;
2621
2417
  unsubscribe = storageData.subscribe(() => {
2622
2418
  for (const type of ["music", "sound", "voice"]) {
2623
2419
  const volume = getVolume(type);
2624
2420
  if (type === "music" || type === "sound") {
2625
2421
  for (const audio of Object.values(store[type])) {
2626
- if (!audio)
2627
- continue;
2628
- try {
2629
- audio.volume = volume;
2630
- } catch {
2631
- }
2422
+ if (!audio) continue;
2423
+ audio.volume = volume;
2632
2424
  }
2633
2425
  }
2634
- if (type === "voice") {
2635
- const audio = store.voice;
2636
- if (audio) {
2637
- try {
2638
- audio.volume = volume;
2639
- } catch {
2640
- }
2641
- }
2426
+ if (type === "voice" && store.voice) {
2427
+ store.voice.volume = volume;
2642
2428
  }
2643
2429
  }
2644
2430
  });
@@ -2659,11 +2445,10 @@ var createAudio2 = (storageData) => {
2659
2445
  };
2660
2446
  const clear = (keepAudio) => {
2661
2447
  context.voiceStop();
2662
- const musics = Object.entries(store.music).filter(([name]) => keepAudio.music && !keepAudio.music.has(name)).map(([_, h]) => h);
2663
- const sounds = Object.entries(store.sound).filter(([name]) => keepAudio.sounds && !keepAudio.sounds.has(name)).map(([_, h]) => h);
2448
+ const musics = Object.entries(store.music).filter(([name]) => !keepAudio.music.has(name)).map(([_, a]) => a);
2449
+ const sounds = Object.entries(store.sound).filter(([name]) => !keepAudio.sounds.has(name)).map(([_, a]) => a);
2664
2450
  for (const music of [...musics, ...sounds]) {
2665
- if (!music)
2666
- continue;
2451
+ if (!music) continue;
2667
2452
  music.stop();
2668
2453
  }
2669
2454
  };
@@ -2756,14 +2541,7 @@ var vibrate = (pattern) => {
2756
2541
  }
2757
2542
  }
2758
2543
  };
2759
- var toMedia = (media) => {
2760
- if (media === "portrait" || media === "landscape") {
2761
- return `(orientation: ${media})`;
2762
- }
2763
- return media;
2764
- };
2765
- var useBackground = (obj, set) => {
2766
- const backgrounds = Object.fromEntries(Object.entries(obj).map(([key, value]) => [toMedia(key), value]));
2544
+ var useBackground = (backgrounds, set) => {
2767
2545
  const mediaQueries = Object.keys(backgrounds).map((media) => matchMedia(media));
2768
2546
  const allMedia = mediaQueries.find(({ media }) => media === "all");
2769
2547
  const handle = () => {
@@ -2776,8 +2554,7 @@ var useBackground = (obj, set) => {
2776
2554
  }
2777
2555
  let disposed = false;
2778
2556
  Promise.resolve().then(() => {
2779
- if (disposed)
2780
- return;
2557
+ if (disposed) return;
2781
2558
  handle();
2782
2559
  });
2783
2560
  return {
@@ -2816,19 +2593,8 @@ var allEmpty = (target) => {
2816
2593
  }
2817
2594
  return true;
2818
2595
  };
2819
- var handleBackgroundAction = ($contextState, background, onChange) => {
2820
- const { clear } = $contextState.get().background;
2821
- clear && clear();
2822
- if (typeof background === "string") {
2823
- $contextState.mutate((s) => s.background, (prev) => {
2824
- return {
2825
- ...prev,
2826
- background
2827
- };
2828
- });
2829
- onChange?.(background);
2830
- return;
2831
- }
2596
+ var handleBackgroundAction = ($contextState, background) => {
2597
+ $contextState.get().background.clear?.();
2832
2598
  const { dispose: dispose2 } = useBackground(background, (value) => {
2833
2599
  $contextState.mutate((s) => s.background, (prev) => {
2834
2600
  return {
@@ -2836,14 +2602,8 @@ var handleBackgroundAction = ($contextState, background, onChange) => {
2836
2602
  background: value
2837
2603
  };
2838
2604
  });
2839
- onChange?.(value);
2840
- });
2841
- $contextState.mutate((s) => s.background, (prev) => {
2842
- return {
2843
- ...prev,
2844
- clear: dispose2
2845
- };
2846
2605
  });
2606
+ $contextState.mutate((s) => s.background.clear, () => dispose2);
2847
2607
  };
2848
2608
  var handleDialogAction = ($contextState, content, name, character, emotion, resolve) => {
2849
2609
  $contextState.mutate(
@@ -2923,10 +2683,8 @@ var handleClearAction = ($rendererState, $contextState, options, context, keep,
2923
2683
  }
2924
2684
  }
2925
2685
  for (const [id, obj] of Object.entries(custom)) {
2926
- if (!obj)
2927
- continue;
2928
- if (context.meta.goingBack && obj.fn.skipClearOnGoingBack)
2929
- continue;
2686
+ if (!obj) continue;
2687
+ if (context.meta.goingBack && obj.fn.skipClearOnGoingBack) continue;
2930
2688
  options.clearCustomAction(context, obj.fn);
2931
2689
  $contextState.mutate((s) => s.custom[id], void 0);
2932
2690
  }
@@ -3024,8 +2782,7 @@ var handleInputAction = ($contextState, options, context, label, onInput, setup,
3024
2782
  error,
3025
2783
  state: options.getStateFunction(context.id),
3026
2784
  get value() {
3027
- if (value)
3028
- return value;
2785
+ if (value) return value;
3029
2786
  return value = escapeHTML(input.value);
3030
2787
  }
3031
2788
  });
@@ -3216,8 +2973,7 @@ var getDocumentStyles = () => {
3216
2973
  var once = (fn) => {
3217
2974
  let ran = false;
3218
2975
  return () => {
3219
- if (ran)
3220
- return;
2976
+ if (ran) return;
3221
2977
  ran = true;
3222
2978
  fn();
3223
2979
  };
@@ -3257,7 +3013,6 @@ var Provider = (props) => {
3257
3013
  media: {
3258
3014
  hyperWide: useMedia("(max-aspect-ratio: 0.26)")
3259
3015
  },
3260
- characters: props.characters,
3261
3016
  getContext: props.getContext,
3262
3017
  removeContext: props.removeContext
3263
3018
  };
@@ -3418,10 +3173,9 @@ delegateEvents(["click"]);
3418
3173
  // src/components/DialogName.tsx
3419
3174
  var _tmpl$4 = /* @__PURE__ */ template(`<span class="action-dialog-name">`);
3420
3175
  var DialogName = (props) => {
3176
+ const data = useData();
3421
3177
  const color = () => {
3422
- const c = props.character;
3423
- const cs = props.characters;
3424
- return c ? c in cs ? cs[c].color : "#000" : "#000";
3178
+ return props.character ? data.options.getCharacterColor(props.character) : "#000";
3425
3179
  };
3426
3180
  return (() => {
3427
3181
  const _el$ = _tmpl$4();
@@ -3526,8 +3280,7 @@ var Modal = (props) => {
3526
3280
  const nodes = modalWindow.querySelectorAll("*");
3527
3281
  const tabbable = Array.from(nodes).filter((node) => node.tabIndex >= 0);
3528
3282
  let index = tabbable.indexOf(document.activeElement);
3529
- if (index === -1 && event.shiftKey)
3530
- index = 0;
3283
+ if (index === -1 && event.shiftKey) index = 0;
3531
3284
  index += tabbable.length + (event.shiftKey ? -1 : 1);
3532
3285
  index %= tabbable.length;
3533
3286
  tabbable[index].focus();
@@ -3813,16 +3566,14 @@ var Save = (props) => {
3813
3566
  const {
3814
3567
  contentDocument
3815
3568
  } = iframe();
3816
- if (!contentDocument)
3817
- return;
3569
+ if (!contentDocument) return;
3818
3570
  contentDocument.head.insertAdjacentHTML("beforeend", `<style>:root { font-size: 30%; background: black; cursor: pointer; } * { pointer-events: none; } *, *::before, *::after { animation-play-state: paused !important; }</style><style>${stylesheet()}</style>`);
3819
3571
  context.root = contentDocument.body;
3820
3572
  setIframeLoaded(true);
3821
3573
  };
3822
3574
  createEffect(async () => {
3823
3575
  const ready = props.observed && iframeLoaded() && !previewStarted();
3824
- if (!ready)
3825
- return;
3576
+ if (!ready) return;
3826
3577
  setPreviewStarted(true);
3827
3578
  setTimeout(() => {
3828
3579
  previewDone();
@@ -3849,8 +3600,7 @@ var Save = (props) => {
3849
3600
  onCleanup(() => {
3850
3601
  const state = useContextState(KEY);
3851
3602
  for (const custom of Object.values(state.get().custom)) {
3852
- if (!custom)
3853
- continue;
3603
+ if (!custom) continue;
3854
3604
  try {
3855
3605
  options.clearCustomAction(context, custom.fn);
3856
3606
  } catch {
@@ -3965,10 +3715,8 @@ var defaultSpeed = () => {
3965
3715
  var collectTextNodes = (el) => {
3966
3716
  const items = [];
3967
3717
  el.childNodes.forEach((child) => {
3968
- if (child.nodeName === "#text")
3969
- items.push(child);
3970
- else
3971
- items.push(...collectTextNodes(child));
3718
+ if (child.nodeName === "#text") items.push(child);
3719
+ else items.push(...collectTextNodes(child));
3972
3720
  });
3973
3721
  return items;
3974
3722
  };
@@ -4102,10 +3850,8 @@ var createTypewriter = ({
4102
3850
  const text = props.content;
4103
3851
  typewriter2?.destroy();
4104
3852
  setState("idle");
4105
- if (!text)
4106
- return;
4107
- if (!node)
4108
- return;
3853
+ if (!text) return;
3854
+ if (!node) return;
4109
3855
  if (PRM.matches || untrack(() => props.ignore)) {
4110
3856
  node.innerHTML = text;
4111
3857
  bypassed = true;
@@ -4178,8 +3924,7 @@ var Canvas = (props) => {
4178
3924
  }
4179
3925
  });
4180
3926
  const onResize = () => {
4181
- if (!local.resize)
4182
- return;
3927
+ if (!local.resize) return;
4183
3928
  const canvasElement = untrack(canvas);
4184
3929
  const canvasContext = untrack(ctx);
4185
3930
  if (canvasElement) {
@@ -4340,13 +4085,11 @@ var Game = (props) => {
4340
4085
  } = props;
4341
4086
  const [auto, setAuto] = createSignal(false);
4342
4087
  const onChoicesButtonClick = ([disabled, i]) => {
4343
- if (disabled)
4344
- return;
4088
+ if (disabled) return;
4345
4089
  choice().resolve?.(i);
4346
4090
  };
4347
4091
  const onInputButtonClick = () => {
4348
- if (input().error)
4349
- return;
4092
+ if (input().error) return;
4350
4093
  const {
4351
4094
  resolve,
4352
4095
  cleanup
@@ -4361,8 +4104,7 @@ var Game = (props) => {
4361
4104
  const onWriterEnd = (cb) => {
4362
4105
  return (prm) => {
4363
4106
  const next = untrack(auto);
4364
- if (!next)
4365
- return;
4107
+ if (!next) return;
4366
4108
  if (prm) {
4367
4109
  setAuto(false);
4368
4110
  } else {
@@ -4448,9 +4190,6 @@ var Game = (props) => {
4448
4190
  },
4449
4191
  get name() {
4450
4192
  return dialog().name;
4451
- },
4452
- get characters() {
4453
- return data.characters;
4454
4193
  }
4455
4194
  }), _el$4);
4456
4195
  addEventListener2(_el$4, "keydown", onKey(DialogWriter.clear, " "), true);
@@ -4469,14 +4208,12 @@ var Game = (props) => {
4469
4208
  keyed: true,
4470
4209
  children: (emotion) => {
4471
4210
  const character = dialog().miniature.character;
4472
- if (!character)
4473
- return null;
4211
+ if (!character) return null;
4474
4212
  if (!store.characters[character] || !store.characters[character].emotions[emotion]) {
4475
4213
  context.character(character).emotion(emotion, false);
4476
4214
  }
4477
4215
  const image = store.characters[character].emotions[emotion];
4478
- if ("src" in image)
4479
- return image;
4216
+ if ("src" in image) return image;
4480
4217
  const canvas = document.createElement("canvas");
4481
4218
  canvasDrawImages(canvas, void 0, Object.values(image));
4482
4219
  return canvas;
@@ -4732,8 +4469,7 @@ var MainMenu = () => {
4732
4469
  const language = () => storageData().meta[0];
4733
4470
  const rendererStore = from($rendererState);
4734
4471
  const goto = simple((screen) => {
4735
- if (!coreData().dataLoaded)
4736
- return;
4472
+ if (!coreData().dataLoaded) return;
4737
4473
  $rendererState.mutate((s) => s.screen, screen);
4738
4474
  });
4739
4475
  return (() => {
@@ -4806,17 +4542,13 @@ var Saves = () => {
4806
4542
  const processed = /* @__PURE__ */ new Set();
4807
4543
  onMount(() => {
4808
4544
  const listElement = list();
4809
- if (!listElement)
4810
- return;
4545
+ if (!listElement) return;
4811
4546
  const observer = new IntersectionObserver((entries2) => {
4812
4547
  const currentEntryTimestamps = [];
4813
4548
  entries2.forEach((entry) => {
4814
- if (!entry.isIntersecting)
4815
- return;
4816
- if (processed.has(entry.target))
4817
- return;
4818
- if (!(entry.target instanceof HTMLElement))
4819
- return;
4549
+ if (!entry.isIntersecting) return;
4550
+ if (processed.has(entry.target)) return;
4551
+ if (!(entry.target instanceof HTMLElement)) return;
4820
4552
  processed.add(entry.target);
4821
4553
  setLoadingAllowed((prev) => {
4822
4554
  if (entry.target instanceof HTMLElement) {
@@ -5073,7 +4805,6 @@ var createRootComponent = ({
5073
4805
  $contextState,
5074
4806
  coreOptions,
5075
4807
  setRoot,
5076
- characters,
5077
4808
  renderer,
5078
4809
  showAudioSettings,
5079
4810
  fullscreen,
@@ -5117,7 +4848,6 @@ var createRootComponent = ({
5117
4848
  options: coreOptions,
5118
4849
  renderer,
5119
4850
  emitter,
5120
- characters,
5121
4851
  get getContext() {
5122
4852
  return renderer.getContext;
5123
4853
  },
@@ -5190,25 +4920,6 @@ var createRootComponent = ({
5190
4920
  return Root;
5191
4921
  };
5192
4922
 
5193
- // src/custom-actions/show-arbitrary-character.ts
5194
- var SHOW_ARBITARY_CHARACTER = Symbol();
5195
- var createShowArbitraryCharacterAction = (_) => {
5196
- const showArbitraryCharacter = (params) => {
5197
- const handler = ({ rendererContext }) => {
5198
- const handle = rendererContext.character(params.id);
5199
- handle.append(params.classes, params.style, rendererContext.meta.restoring);
5200
- handle.emotion(params.emotion, true);
5201
- const extension = ((e) => Array.isArray(e) ? e : [e])(params.extendWith());
5202
- canvasDrawImages(handle.canvas, handle.ctx, extension.map((src) => imagePreloadWithCachingNotComplete(src)));
5203
- };
5204
- handler.id = SHOW_ARBITARY_CHARACTER;
5205
- handler.key = params.id;
5206
- handler.callOnlyLatest = true;
5207
- return ["custom", handler];
5208
- };
5209
- return showArbitraryCharacter;
5210
- };
5211
-
5212
4923
  // src/custom-actions/show-hide-image.ts
5213
4924
  var SHOW_IMAGE = Symbol();
5214
4925
  var showImage = (source, params = {}) => {
@@ -5328,7 +5039,6 @@ var createSolidRenderer = ({
5328
5039
  emitter,
5329
5040
  renderer(options) {
5330
5041
  const {
5331
- characters,
5332
5042
  characterAssetSizes
5333
5043
  } = options;
5334
5044
  const {
@@ -5343,11 +5053,7 @@ var createSolidRenderer = ({
5343
5053
  id: name,
5344
5054
  root: root(),
5345
5055
  background(background) {
5346
- handleBackgroundAction($contextState, background, (bg) => {
5347
- if (!isCSSImage(bg))
5348
- return;
5349
- renderer.misc.preloadImage(bg);
5350
- });
5056
+ handleBackgroundAction($contextState, background);
5351
5057
  },
5352
5058
  character(character) {
5353
5059
  const chars = useShared(name).characters;
@@ -5364,12 +5070,10 @@ var createSolidRenderer = ({
5364
5070
  canvas,
5365
5071
  ctx: canvasContext,
5366
5072
  emotions: {},
5367
- emotion(emotion, shouldRender) {
5073
+ async emotion(emotion, shouldRender) {
5368
5074
  let stored = this.emotions[emotion];
5369
5075
  if (!stored) {
5370
- const characterEmotion = characters[character].emotions[emotion];
5371
- const emotionData = ((unknown) => Array.isArray(unknown) ? unknown : [unknown])(characterEmotion);
5372
- stored = this.emotions[emotion] = emotionData.map((src) => imagePreloadWithCachingNotComplete(src));
5076
+ stored = this.emotions[emotion] = options.getCharacterAssets(character, emotion).map((src) => imagePreloadWithCachingNotComplete(src));
5373
5077
  }
5374
5078
  if (shouldRender && stored) {
5375
5079
  canvasContext.clearRect(0, 0, canvas.width, canvas.height);
@@ -5448,8 +5152,7 @@ var createSolidRenderer = ({
5448
5152
  },
5449
5153
  animate(classes) {
5450
5154
  const target2 = this.canvas;
5451
- if (!target2)
5452
- return;
5155
+ if (!target2) return;
5453
5156
  const classNames = classes.filter((className2) => !target2.classList.contains(className2));
5454
5157
  target2.classList.add(...classNames);
5455
5158
  const onAnimationEnd = () => {
@@ -5537,7 +5240,6 @@ var createSolidRenderer = ({
5537
5240
  const Root = createRootComponent({
5538
5241
  setRoot,
5539
5242
  renderer,
5540
- characters,
5541
5243
  fullscreen,
5542
5244
  emitter,
5543
5245
  controls,
@@ -5563,7 +5265,6 @@ var createSolidRenderer = ({
5563
5265
  preloadAudioBlocking
5564
5266
  },
5565
5267
  actions: {
5566
- showArbitraryCharacter: createShowArbitraryCharacterAction(options.characters),
5567
5268
  showImage,
5568
5269
  hideImage
5569
5270
  }