@vue/compat 3.4.25 → 3.5.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.25
2
+ * @vue/compat v3.5.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -387,157 +387,280 @@ var Vue = (function () {
387
387
  function effectScope(detached) {
388
388
  return new EffectScope(detached);
389
389
  }
390
- function recordEffectScope(effect, scope = activeEffectScope) {
391
- if (scope && scope.active) {
392
- scope.effects.push(effect);
393
- }
394
- }
395
390
  function getCurrentScope() {
396
391
  return activeEffectScope;
397
392
  }
398
- function onScopeDispose(fn) {
393
+ function onScopeDispose(fn, failSilently = false) {
399
394
  if (activeEffectScope) {
400
395
  activeEffectScope.cleanups.push(fn);
401
- } else {
396
+ } else if (!failSilently) {
402
397
  warn$2(
403
398
  `onScopeDispose() is called when there is no active effect scope to be associated with.`
404
399
  );
405
400
  }
406
401
  }
407
402
 
408
- let activeEffect;
403
+ let activeSub;
409
404
  class ReactiveEffect {
410
- constructor(fn, trigger, scheduler, scope) {
405
+ constructor(fn) {
411
406
  this.fn = fn;
412
- this.trigger = trigger;
413
- this.scheduler = scheduler;
414
- this.active = true;
415
- this.deps = [];
416
407
  /**
417
408
  * @internal
418
409
  */
419
- this._dirtyLevel = 4;
410
+ this.deps = void 0;
420
411
  /**
421
412
  * @internal
422
413
  */
423
- this._trackId = 0;
414
+ this.depsTail = void 0;
424
415
  /**
425
416
  * @internal
426
417
  */
427
- this._runnings = 0;
418
+ this.flags = 1 | 4;
428
419
  /**
429
420
  * @internal
430
421
  */
431
- this._shouldSchedule = false;
422
+ this.nextEffect = void 0;
432
423
  /**
433
424
  * @internal
434
425
  */
435
- this._depsLength = 0;
436
- recordEffectScope(this, scope);
437
- }
438
- get dirty() {
439
- if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
440
- this._dirtyLevel = 1;
441
- pauseTracking();
442
- for (let i = 0; i < this._depsLength; i++) {
443
- const dep = this.deps[i];
444
- if (dep.computed) {
445
- triggerComputed(dep.computed);
446
- if (this._dirtyLevel >= 4) {
447
- break;
448
- }
449
- }
450
- }
451
- if (this._dirtyLevel === 1) {
452
- this._dirtyLevel = 0;
453
- }
454
- resetTracking();
426
+ this.cleanup = void 0;
427
+ this.scheduler = void 0;
428
+ if (activeEffectScope && activeEffectScope.active) {
429
+ activeEffectScope.effects.push(this);
455
430
  }
456
- return this._dirtyLevel >= 4;
457
431
  }
458
- set dirty(v) {
459
- this._dirtyLevel = v ? 4 : 0;
432
+ /**
433
+ * @internal
434
+ */
435
+ notify() {
436
+ if (this.flags & 2 && !(this.flags & 32)) {
437
+ return;
438
+ }
439
+ if (this.flags & 64) {
440
+ return this.trigger();
441
+ }
442
+ if (!(this.flags & 8)) {
443
+ this.flags |= 8;
444
+ this.nextEffect = batchedEffect;
445
+ batchedEffect = this;
446
+ }
460
447
  }
461
448
  run() {
462
- this._dirtyLevel = 0;
463
- if (!this.active) {
449
+ if (!(this.flags & 1)) {
464
450
  return this.fn();
465
451
  }
466
- let lastShouldTrack = shouldTrack;
467
- let lastEffect = activeEffect;
452
+ this.flags |= 2;
453
+ cleanupEffect(this);
454
+ prepareDeps(this);
455
+ const prevEffect = activeSub;
456
+ const prevShouldTrack = shouldTrack;
457
+ activeSub = this;
458
+ shouldTrack = true;
468
459
  try {
469
- shouldTrack = true;
470
- activeEffect = this;
471
- this._runnings++;
472
- preCleanupEffect(this);
473
460
  return this.fn();
474
461
  } finally {
475
- postCleanupEffect(this);
476
- this._runnings--;
477
- activeEffect = lastEffect;
478
- shouldTrack = lastShouldTrack;
462
+ if (activeSub !== this) {
463
+ warn$2(
464
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
465
+ );
466
+ }
467
+ cleanupDeps(this);
468
+ activeSub = prevEffect;
469
+ shouldTrack = prevShouldTrack;
470
+ this.flags &= ~2;
479
471
  }
480
472
  }
481
473
  stop() {
482
- var _a;
483
- if (this.active) {
484
- preCleanupEffect(this);
485
- postCleanupEffect(this);
486
- (_a = this.onStop) == null ? void 0 : _a.call(this);
487
- this.active = false;
474
+ if (this.flags & 1) {
475
+ for (let link = this.deps; link; link = link.nextDep) {
476
+ removeSub(link);
477
+ }
478
+ this.deps = this.depsTail = void 0;
479
+ cleanupEffect(this);
480
+ this.onStop && this.onStop();
481
+ this.flags &= ~1;
482
+ }
483
+ }
484
+ trigger() {
485
+ if (this.scheduler) {
486
+ this.scheduler();
487
+ } else {
488
+ this.runIfDirty();
489
+ }
490
+ }
491
+ /**
492
+ * @internal
493
+ */
494
+ runIfDirty() {
495
+ if (isDirty(this)) {
496
+ this.run();
488
497
  }
489
498
  }
499
+ get dirty() {
500
+ return isDirty(this);
501
+ }
490
502
  }
491
- function triggerComputed(computed) {
492
- return computed.value;
503
+ let batchDepth = 0;
504
+ let batchedEffect;
505
+ function startBatch() {
506
+ batchDepth++;
507
+ }
508
+ function endBatch() {
509
+ if (batchDepth > 1) {
510
+ batchDepth--;
511
+ return;
512
+ }
513
+ let error;
514
+ while (batchedEffect) {
515
+ let e = batchedEffect;
516
+ batchedEffect = void 0;
517
+ while (e) {
518
+ const next = e.nextEffect;
519
+ e.nextEffect = void 0;
520
+ e.flags &= ~8;
521
+ if (e.flags & 1) {
522
+ try {
523
+ e.trigger();
524
+ } catch (err) {
525
+ if (!error)
526
+ error = err;
527
+ }
528
+ }
529
+ e = next;
530
+ }
531
+ }
532
+ batchDepth--;
533
+ if (error)
534
+ throw error;
535
+ }
536
+ function prepareDeps(sub) {
537
+ for (let link = sub.deps; link; link = link.nextDep) {
538
+ link.version = -1;
539
+ link.prevActiveLink = link.dep.activeLink;
540
+ link.dep.activeLink = link;
541
+ }
542
+ }
543
+ function cleanupDeps(sub) {
544
+ let head;
545
+ let tail = sub.depsTail;
546
+ for (let link = tail; link; link = link.prevDep) {
547
+ if (link.version === -1) {
548
+ if (link === tail)
549
+ tail = link.prevDep;
550
+ removeSub(link);
551
+ removeDep(link);
552
+ } else {
553
+ head = link;
554
+ }
555
+ link.dep.activeLink = link.prevActiveLink;
556
+ link.prevActiveLink = void 0;
557
+ }
558
+ sub.deps = head;
559
+ sub.depsTail = tail;
493
560
  }
494
- function preCleanupEffect(effect2) {
495
- effect2._trackId++;
496
- effect2._depsLength = 0;
561
+ function isDirty(sub) {
562
+ for (let link = sub.deps; link; link = link.nextDep) {
563
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
564
+ return true;
565
+ }
566
+ }
567
+ if (sub._dirty) {
568
+ return true;
569
+ }
570
+ return false;
497
571
  }
498
- function postCleanupEffect(effect2) {
499
- if (effect2.deps.length > effect2._depsLength) {
500
- for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
501
- cleanupDepEffect(effect2.deps[i], effect2);
572
+ function refreshComputed(computed) {
573
+ if (computed.flags & 2) {
574
+ return false;
575
+ }
576
+ if (computed.flags & 4 && !(computed.flags & 16)) {
577
+ return;
578
+ }
579
+ computed.flags &= ~16;
580
+ if (computed.globalVersion === globalVersion) {
581
+ return;
582
+ }
583
+ computed.globalVersion = globalVersion;
584
+ const dep = computed.dep;
585
+ computed.flags |= 2;
586
+ if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
587
+ computed.flags &= ~2;
588
+ return;
589
+ }
590
+ const prevSub = activeSub;
591
+ const prevShouldTrack = shouldTrack;
592
+ activeSub = computed;
593
+ shouldTrack = true;
594
+ try {
595
+ prepareDeps(computed);
596
+ const value = computed.fn();
597
+ if (dep.version === 0 || hasChanged(value, computed._value)) {
598
+ computed._value = value;
599
+ dep.version++;
502
600
  }
503
- effect2.deps.length = effect2._depsLength;
601
+ } catch (err) {
602
+ dep.version++;
603
+ throw err;
604
+ } finally {
605
+ activeSub = prevSub;
606
+ shouldTrack = prevShouldTrack;
607
+ cleanupDeps(computed);
608
+ computed.flags &= ~2;
504
609
  }
505
610
  }
506
- function cleanupDepEffect(dep, effect2) {
507
- const trackId = dep.get(effect2);
508
- if (trackId !== void 0 && effect2._trackId !== trackId) {
509
- dep.delete(effect2);
510
- if (dep.size === 0) {
511
- dep.cleanup();
611
+ function removeSub(link) {
612
+ const { dep, prevSub, nextSub } = link;
613
+ if (prevSub) {
614
+ prevSub.nextSub = nextSub;
615
+ link.prevSub = void 0;
616
+ }
617
+ if (nextSub) {
618
+ nextSub.prevSub = prevSub;
619
+ link.nextSub = void 0;
620
+ }
621
+ if (dep.subs === link) {
622
+ dep.subs = prevSub;
623
+ }
624
+ if (!dep.subs && dep.computed) {
625
+ dep.computed.flags &= ~4;
626
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
627
+ removeSub(l);
512
628
  }
513
629
  }
514
630
  }
631
+ function removeDep(link) {
632
+ const { prevDep, nextDep } = link;
633
+ if (prevDep) {
634
+ prevDep.nextDep = nextDep;
635
+ link.prevDep = void 0;
636
+ }
637
+ if (nextDep) {
638
+ nextDep.prevDep = prevDep;
639
+ link.nextDep = void 0;
640
+ }
641
+ }
515
642
  function effect(fn, options) {
516
643
  if (fn.effect instanceof ReactiveEffect) {
517
644
  fn = fn.effect.fn;
518
645
  }
519
- const _effect = new ReactiveEffect(fn, NOOP, () => {
520
- if (_effect.dirty) {
521
- _effect.run();
522
- }
523
- });
646
+ const e = new ReactiveEffect(fn);
524
647
  if (options) {
525
- extend(_effect, options);
526
- if (options.scope)
527
- recordEffectScope(_effect, options.scope);
648
+ extend(e, options);
528
649
  }
529
- if (!options || !options.lazy) {
530
- _effect.run();
650
+ try {
651
+ e.run();
652
+ } catch (err) {
653
+ e.stop();
654
+ throw err;
531
655
  }
532
- const runner = _effect.run.bind(_effect);
533
- runner.effect = _effect;
656
+ const runner = e.run.bind(e);
657
+ runner.effect = e;
534
658
  return runner;
535
659
  }
536
660
  function stop(runner) {
537
661
  runner.effect.stop();
538
662
  }
539
663
  let shouldTrack = true;
540
- let pauseScheduleStack = 0;
541
664
  const trackStack = [];
542
665
  function pauseTracking() {
543
666
  trackStack.push(shouldTrack);
@@ -547,192 +670,414 @@ var Vue = (function () {
547
670
  const last = trackStack.pop();
548
671
  shouldTrack = last === void 0 ? true : last;
549
672
  }
550
- function pauseScheduling() {
551
- pauseScheduleStack++;
552
- }
553
- function resetScheduling() {
554
- pauseScheduleStack--;
555
- while (!pauseScheduleStack && queueEffectSchedulers.length) {
556
- queueEffectSchedulers.shift()();
673
+ function cleanupEffect(e) {
674
+ const { cleanup } = e;
675
+ e.cleanup = void 0;
676
+ if (cleanup) {
677
+ const prevSub = activeSub;
678
+ activeSub = void 0;
679
+ try {
680
+ cleanup();
681
+ } finally {
682
+ activeSub = prevSub;
683
+ }
557
684
  }
558
685
  }
559
- function trackEffect(effect2, dep, debuggerEventExtraInfo) {
560
- var _a;
561
- if (dep.get(effect2) !== effect2._trackId) {
562
- dep.set(effect2, effect2._trackId);
563
- const oldDep = effect2.deps[effect2._depsLength];
564
- if (oldDep !== dep) {
565
- if (oldDep) {
566
- cleanupDepEffect(oldDep, effect2);
567
- }
568
- effect2.deps[effect2._depsLength++] = dep;
569
- } else {
570
- effect2._depsLength++;
571
- }
686
+
687
+ let globalVersion = 0;
688
+ class Dep {
689
+ constructor(computed) {
690
+ this.computed = computed;
691
+ this.version = 0;
692
+ /**
693
+ * Link between this dep and the current active effect
694
+ */
695
+ this.activeLink = void 0;
696
+ /**
697
+ * Doubly linked list representing the subscribing effects (tail)
698
+ */
699
+ this.subs = void 0;
572
700
  {
573
- (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
701
+ this.subsHead = void 0;
574
702
  }
575
703
  }
576
- }
577
- const queueEffectSchedulers = [];
578
- function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
579
- var _a;
580
- pauseScheduling();
581
- for (const effect2 of dep.keys()) {
582
- let tracking;
583
- if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
584
- effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
585
- effect2._dirtyLevel = dirtyLevel;
586
- }
587
- if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
588
- {
589
- (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
704
+ track(debugInfo) {
705
+ if (!activeSub || !shouldTrack) {
706
+ return;
707
+ }
708
+ let link = this.activeLink;
709
+ if (link === void 0 || link.sub !== activeSub) {
710
+ link = this.activeLink = {
711
+ dep: this,
712
+ sub: activeSub,
713
+ version: this.version,
714
+ nextDep: void 0,
715
+ prevDep: void 0,
716
+ nextSub: void 0,
717
+ prevSub: void 0,
718
+ prevActiveLink: void 0
719
+ };
720
+ if (!activeSub.deps) {
721
+ activeSub.deps = activeSub.depsTail = link;
722
+ } else {
723
+ link.prevDep = activeSub.depsTail;
724
+ activeSub.depsTail.nextDep = link;
725
+ activeSub.depsTail = link;
590
726
  }
591
- effect2.trigger();
592
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
593
- effect2._shouldSchedule = false;
594
- if (effect2.scheduler) {
595
- queueEffectSchedulers.push(effect2.scheduler);
727
+ if (activeSub.flags & 4) {
728
+ addSub(link);
729
+ }
730
+ } else if (link.version === -1) {
731
+ link.version = this.version;
732
+ if (link.nextDep) {
733
+ const next = link.nextDep;
734
+ next.prevDep = link.prevDep;
735
+ if (link.prevDep) {
736
+ link.prevDep.nextDep = next;
737
+ }
738
+ link.prevDep = activeSub.depsTail;
739
+ link.nextDep = void 0;
740
+ activeSub.depsTail.nextDep = link;
741
+ activeSub.depsTail = link;
742
+ if (activeSub.deps === link) {
743
+ activeSub.deps = next;
596
744
  }
597
745
  }
598
746
  }
747
+ if (activeSub.onTrack) {
748
+ activeSub.onTrack(
749
+ extend(
750
+ {
751
+ effect: activeSub
752
+ },
753
+ debugInfo
754
+ )
755
+ );
756
+ }
757
+ return link;
758
+ }
759
+ trigger(debugInfo) {
760
+ this.version++;
761
+ globalVersion++;
762
+ this.notify(debugInfo);
763
+ }
764
+ notify(debugInfo) {
765
+ startBatch();
766
+ try {
767
+ if (true) {
768
+ for (let head = this.subsHead; head; head = head.nextSub) {
769
+ if (head.sub.onTrigger && !(head.sub.flags & 8)) {
770
+ head.sub.onTrigger(
771
+ extend(
772
+ {
773
+ effect: head.sub
774
+ },
775
+ debugInfo
776
+ )
777
+ );
778
+ }
779
+ }
780
+ }
781
+ for (let link = this.subs; link; link = link.prevSub) {
782
+ link.sub.notify();
783
+ }
784
+ } finally {
785
+ endBatch();
786
+ }
599
787
  }
600
- resetScheduling();
601
788
  }
602
-
603
- const createDep = (cleanup, computed) => {
604
- const dep = /* @__PURE__ */ new Map();
605
- dep.cleanup = cleanup;
606
- dep.computed = computed;
607
- return dep;
608
- };
609
-
789
+ function addSub(link) {
790
+ const computed = link.dep.computed;
791
+ if (computed && !link.dep.subs) {
792
+ computed.flags |= 4 | 16;
793
+ for (let l = computed.deps; l; l = l.nextDep) {
794
+ addSub(l);
795
+ }
796
+ }
797
+ const currentTail = link.dep.subs;
798
+ if (currentTail !== link) {
799
+ link.prevSub = currentTail;
800
+ if (currentTail)
801
+ currentTail.nextSub = link;
802
+ }
803
+ if (link.dep.subsHead === void 0) {
804
+ link.dep.subsHead = link;
805
+ }
806
+ link.dep.subs = link;
807
+ }
610
808
  const targetMap = /* @__PURE__ */ new WeakMap();
611
- const ITERATE_KEY = Symbol("iterate" );
612
- const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
809
+ const ITERATE_KEY = Symbol("Object iterate" );
810
+ const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
811
+ const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
613
812
  function track(target, type, key) {
614
- if (shouldTrack && activeEffect) {
813
+ if (shouldTrack && activeSub) {
615
814
  let depsMap = targetMap.get(target);
616
815
  if (!depsMap) {
617
816
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
618
817
  }
619
818
  let dep = depsMap.get(key);
620
819
  if (!dep) {
621
- depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
820
+ depsMap.set(key, dep = new Dep());
622
821
  }
623
- trackEffect(
624
- activeEffect,
625
- dep,
626
- {
822
+ {
823
+ dep.track({
627
824
  target,
628
825
  type,
629
826
  key
630
- }
631
- );
827
+ });
828
+ }
632
829
  }
633
830
  }
634
831
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
635
832
  const depsMap = targetMap.get(target);
636
833
  if (!depsMap) {
834
+ globalVersion++;
637
835
  return;
638
836
  }
639
837
  let deps = [];
640
838
  if (type === "clear") {
641
839
  deps = [...depsMap.values()];
642
- } else if (key === "length" && isArray(target)) {
643
- const newLength = Number(newValue);
644
- depsMap.forEach((dep, key2) => {
645
- if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
646
- deps.push(dep);
647
- }
648
- });
649
840
  } else {
650
- if (key !== void 0) {
651
- deps.push(depsMap.get(key));
652
- }
653
- switch (type) {
654
- case "add":
655
- if (!isArray(target)) {
656
- deps.push(depsMap.get(ITERATE_KEY));
657
- if (isMap(target)) {
658
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
659
- }
660
- } else if (isIntegerKey(key)) {
661
- deps.push(depsMap.get("length"));
841
+ const targetIsArray = isArray(target);
842
+ const isArrayIndex = targetIsArray && isIntegerKey(key);
843
+ if (targetIsArray && key === "length") {
844
+ const newLength = Number(newValue);
845
+ depsMap.forEach((dep, key2) => {
846
+ if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
847
+ deps.push(dep);
662
848
  }
663
- break;
664
- case "delete":
665
- if (!isArray(target)) {
666
- deps.push(depsMap.get(ITERATE_KEY));
849
+ });
850
+ } else {
851
+ const push = (dep) => dep && deps.push(dep);
852
+ if (key !== void 0) {
853
+ push(depsMap.get(key));
854
+ }
855
+ if (isArrayIndex) {
856
+ push(depsMap.get(ARRAY_ITERATE_KEY));
857
+ }
858
+ switch (type) {
859
+ case "add":
860
+ if (!targetIsArray) {
861
+ push(depsMap.get(ITERATE_KEY));
862
+ if (isMap(target)) {
863
+ push(depsMap.get(MAP_KEY_ITERATE_KEY));
864
+ }
865
+ } else if (isArrayIndex) {
866
+ push(depsMap.get("length"));
867
+ }
868
+ break;
869
+ case "delete":
870
+ if (!targetIsArray) {
871
+ push(depsMap.get(ITERATE_KEY));
872
+ if (isMap(target)) {
873
+ push(depsMap.get(MAP_KEY_ITERATE_KEY));
874
+ }
875
+ }
876
+ break;
877
+ case "set":
667
878
  if (isMap(target)) {
668
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
879
+ push(depsMap.get(ITERATE_KEY));
669
880
  }
670
- }
671
- break;
672
- case "set":
673
- if (isMap(target)) {
674
- deps.push(depsMap.get(ITERATE_KEY));
675
- }
676
- break;
881
+ break;
882
+ }
677
883
  }
678
884
  }
679
- pauseScheduling();
885
+ startBatch();
680
886
  for (const dep of deps) {
681
- if (dep) {
682
- triggerEffects(
683
- dep,
684
- 4,
685
- {
686
- target,
687
- type,
688
- key,
689
- newValue,
690
- oldValue,
691
- oldTarget
692
- }
693
- );
887
+ {
888
+ dep.trigger({
889
+ target,
890
+ type,
891
+ key,
892
+ newValue,
893
+ oldValue,
894
+ oldTarget
895
+ });
694
896
  }
695
897
  }
696
- resetScheduling();
898
+ endBatch();
697
899
  }
698
900
  function getDepFromReactive(object, key) {
699
901
  var _a;
700
902
  return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
701
903
  }
702
904
 
905
+ function reactiveReadArray(array) {
906
+ const raw = toRaw(array);
907
+ if (raw === array)
908
+ return raw;
909
+ track(raw, "iterate", ARRAY_ITERATE_KEY);
910
+ return isShallow(array) ? raw : raw.map(toReactive);
911
+ }
912
+ function shallowReadArray(arr) {
913
+ track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
914
+ return arr;
915
+ }
916
+ const arrayInstrumentations = {
917
+ __proto__: null,
918
+ [Symbol.iterator]() {
919
+ return iterator(this, Symbol.iterator, toReactive);
920
+ },
921
+ concat(...args) {
922
+ return reactiveReadArray(this).concat(
923
+ ...args.map((x) => reactiveReadArray(x))
924
+ );
925
+ },
926
+ entries() {
927
+ return iterator(this, "entries", (value) => {
928
+ value[1] = toReactive(value[1]);
929
+ return value;
930
+ });
931
+ },
932
+ every(fn, thisArg) {
933
+ return apply(this, "every", fn, thisArg);
934
+ },
935
+ filter(fn, thisArg) {
936
+ const result = apply(this, "filter", fn, thisArg);
937
+ return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
938
+ },
939
+ find(fn, thisArg) {
940
+ const result = apply(this, "find", fn, thisArg);
941
+ return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
942
+ },
943
+ findIndex(fn, thisArg) {
944
+ return apply(this, "findIndex", fn, thisArg);
945
+ },
946
+ findLast(fn, thisArg) {
947
+ const result = apply(this, "findLast", fn, thisArg);
948
+ return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
949
+ },
950
+ findLastIndex(fn, thisArg) {
951
+ return apply(this, "findLastIndex", fn, thisArg);
952
+ },
953
+ // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
954
+ forEach(fn, thisArg) {
955
+ return apply(this, "forEach", fn, thisArg);
956
+ },
957
+ includes(...args) {
958
+ return searchProxy(this, "includes", args);
959
+ },
960
+ indexOf(...args) {
961
+ return searchProxy(this, "indexOf", args);
962
+ },
963
+ join(separator) {
964
+ return reactiveReadArray(this).join(separator);
965
+ },
966
+ // keys() iterator only reads `length`, no optimisation required
967
+ lastIndexOf(...args) {
968
+ return searchProxy(this, "lastIndexOf", args);
969
+ },
970
+ map(fn, thisArg) {
971
+ return apply(this, "map", fn, thisArg);
972
+ },
973
+ pop() {
974
+ return noTracking(this, "pop");
975
+ },
976
+ push(...args) {
977
+ return noTracking(this, "push", args);
978
+ },
979
+ reduce(fn, ...args) {
980
+ return reduce(this, "reduce", fn, args);
981
+ },
982
+ reduceRight(fn, ...args) {
983
+ return reduce(this, "reduceRight", fn, args);
984
+ },
985
+ shift() {
986
+ return noTracking(this, "shift");
987
+ },
988
+ // slice could use ARRAY_ITERATE but also seems to beg for range tracking
989
+ some(fn, thisArg) {
990
+ return apply(this, "some", fn, thisArg);
991
+ },
992
+ splice(...args) {
993
+ return noTracking(this, "splice", args);
994
+ },
995
+ toReversed() {
996
+ return reactiveReadArray(this).toReversed();
997
+ },
998
+ toSorted(comparer) {
999
+ return reactiveReadArray(this).toSorted(comparer);
1000
+ },
1001
+ toSpliced(...args) {
1002
+ return reactiveReadArray(this).toSpliced(...args);
1003
+ },
1004
+ unshift(...args) {
1005
+ return noTracking(this, "unshift", args);
1006
+ },
1007
+ values() {
1008
+ return iterator(this, "values", toReactive);
1009
+ }
1010
+ };
1011
+ function iterator(self, method, wrapValue) {
1012
+ const arr = shallowReadArray(self);
1013
+ const iter = arr[method]();
1014
+ if (arr !== self && !isShallow(self)) {
1015
+ iter._next = iter.next;
1016
+ iter.next = () => {
1017
+ const result = iter._next();
1018
+ if (result.value) {
1019
+ result.value = wrapValue(result.value);
1020
+ }
1021
+ return result;
1022
+ };
1023
+ }
1024
+ return iter;
1025
+ }
1026
+ function apply(self, method, fn, thisArg) {
1027
+ const arr = shallowReadArray(self);
1028
+ let wrappedFn = fn;
1029
+ if (arr !== self) {
1030
+ if (!isShallow(self)) {
1031
+ wrappedFn = function(item, index) {
1032
+ return fn.call(this, toReactive(item), index, self);
1033
+ };
1034
+ } else if (fn.length > 2) {
1035
+ wrappedFn = function(item, index) {
1036
+ return fn.call(this, item, index, self);
1037
+ };
1038
+ }
1039
+ }
1040
+ return arr[method](wrappedFn, thisArg);
1041
+ }
1042
+ function reduce(self, method, fn, args) {
1043
+ const arr = shallowReadArray(self);
1044
+ let wrappedFn = fn;
1045
+ if (arr !== self) {
1046
+ if (!isShallow(self)) {
1047
+ wrappedFn = function(acc, item, index) {
1048
+ return fn.call(this, acc, toReactive(item), index, self);
1049
+ };
1050
+ } else if (fn.length > 3) {
1051
+ wrappedFn = function(acc, item, index) {
1052
+ return fn.call(this, acc, item, index, self);
1053
+ };
1054
+ }
1055
+ }
1056
+ return arr[method](wrappedFn, ...args);
1057
+ }
1058
+ function searchProxy(self, method, args) {
1059
+ const arr = toRaw(self);
1060
+ track(arr, "iterate", ARRAY_ITERATE_KEY);
1061
+ const res = arr[method](...args);
1062
+ if ((res === -1 || res === false) && isProxy(args[0])) {
1063
+ args[0] = toRaw(args[0]);
1064
+ return arr[method](...args);
1065
+ }
1066
+ return res;
1067
+ }
1068
+ function noTracking(self, method, args = []) {
1069
+ pauseTracking();
1070
+ startBatch();
1071
+ const res = toRaw(self)[method].apply(self, args);
1072
+ endBatch();
1073
+ resetTracking();
1074
+ return res;
1075
+ }
1076
+
703
1077
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
704
1078
  const builtInSymbols = new Set(
705
1079
  /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
706
1080
  );
707
- const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
708
- function createArrayInstrumentations() {
709
- const instrumentations = {};
710
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
711
- instrumentations[key] = function(...args) {
712
- const arr = toRaw(this);
713
- for (let i = 0, l = this.length; i < l; i++) {
714
- track(arr, "get", i + "");
715
- }
716
- const res = arr[key](...args);
717
- if (res === -1 || res === false) {
718
- return arr[key](...args.map(toRaw));
719
- } else {
720
- return res;
721
- }
722
- };
723
- });
724
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
725
- instrumentations[key] = function(...args) {
726
- pauseTracking();
727
- pauseScheduling();
728
- const res = toRaw(this)[key].apply(this, args);
729
- resetScheduling();
730
- resetTracking();
731
- return res;
732
- };
733
- });
734
- return instrumentations;
735
- }
736
1081
  function hasOwnProperty(key) {
737
1082
  if (!isSymbol(key))
738
1083
  key = String(key);
@@ -763,14 +1108,22 @@ var Vue = (function () {
763
1108
  }
764
1109
  const targetIsArray = isArray(target);
765
1110
  if (!isReadonly2) {
766
- if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
767
- return Reflect.get(arrayInstrumentations, key, receiver);
1111
+ let fn;
1112
+ if (targetIsArray && (fn = arrayInstrumentations[key])) {
1113
+ return fn;
768
1114
  }
769
1115
  if (key === "hasOwnProperty") {
770
1116
  return hasOwnProperty;
771
1117
  }
772
1118
  }
773
- const res = Reflect.get(target, key, receiver);
1119
+ const res = Reflect.get(
1120
+ target,
1121
+ key,
1122
+ // if this is a proxy wrapping a ref, return methods using the raw ref
1123
+ // as receiver so that we don't have to call `toRaw` on the ref in all
1124
+ // its class methods
1125
+ isRef(target) ? target : receiver
1126
+ );
774
1127
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
775
1128
  return res;
776
1129
  }
@@ -1269,110 +1622,8 @@ var Vue = (function () {
1269
1622
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1270
1623
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1271
1624
 
1272
- const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
1273
- class ComputedRefImpl {
1274
- constructor(getter, _setter, isReadonly, isSSR) {
1275
- this.getter = getter;
1276
- this._setter = _setter;
1277
- this.dep = void 0;
1278
- this.__v_isRef = true;
1279
- this["__v_isReadonly"] = false;
1280
- this.effect = new ReactiveEffect(
1281
- () => getter(this._value),
1282
- () => triggerRefValue(
1283
- this,
1284
- this.effect._dirtyLevel === 2 ? 2 : 3
1285
- )
1286
- );
1287
- this.effect.computed = this;
1288
- this.effect.active = this._cacheable = !isSSR;
1289
- this["__v_isReadonly"] = isReadonly;
1290
- }
1291
- get value() {
1292
- const self = toRaw(this);
1293
- if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1294
- triggerRefValue(self, 4);
1295
- }
1296
- trackRefValue(self);
1297
- if (self.effect._dirtyLevel >= 2) {
1298
- if (this._warnRecursive) {
1299
- warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1300
-
1301
- getter: `, this.getter);
1302
- }
1303
- triggerRefValue(self, 2);
1304
- }
1305
- return self._value;
1306
- }
1307
- set value(newValue) {
1308
- this._setter(newValue);
1309
- }
1310
- // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1311
- get _dirty() {
1312
- return this.effect.dirty;
1313
- }
1314
- set _dirty(v) {
1315
- this.effect.dirty = v;
1316
- }
1317
- // #endregion
1318
- }
1319
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1320
- let getter;
1321
- let setter;
1322
- const onlyGetter = isFunction(getterOrOptions);
1323
- if (onlyGetter) {
1324
- getter = getterOrOptions;
1325
- setter = () => {
1326
- warn$2("Write operation failed: computed value is readonly");
1327
- } ;
1328
- } else {
1329
- getter = getterOrOptions.get;
1330
- setter = getterOrOptions.set;
1331
- }
1332
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1333
- if (debugOptions && !isSSR) {
1334
- cRef.effect.onTrack = debugOptions.onTrack;
1335
- cRef.effect.onTrigger = debugOptions.onTrigger;
1336
- }
1337
- return cRef;
1338
- }
1339
-
1340
- function trackRefValue(ref2) {
1341
- var _a;
1342
- if (shouldTrack && activeEffect) {
1343
- ref2 = toRaw(ref2);
1344
- trackEffect(
1345
- activeEffect,
1346
- (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1347
- () => ref2.dep = void 0,
1348
- ref2 instanceof ComputedRefImpl ? ref2 : void 0
1349
- ),
1350
- {
1351
- target: ref2,
1352
- type: "get",
1353
- key: "value"
1354
- }
1355
- );
1356
- }
1357
- }
1358
- function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1359
- ref2 = toRaw(ref2);
1360
- const dep = ref2.dep;
1361
- if (dep) {
1362
- triggerEffects(
1363
- dep,
1364
- dirtyLevel,
1365
- {
1366
- target: ref2,
1367
- type: "set",
1368
- key: "value",
1369
- newValue: newVal
1370
- }
1371
- );
1372
- }
1373
- }
1374
1625
  function isRef(r) {
1375
- return !!(r && r.__v_isRef === true);
1626
+ return r ? r.__v_isRef === true : false;
1376
1627
  }
1377
1628
  function ref(value) {
1378
1629
  return createRef(value, false);
@@ -1389,27 +1640,49 @@ getter: `, this.getter);
1389
1640
  class RefImpl {
1390
1641
  constructor(value, __v_isShallow) {
1391
1642
  this.__v_isShallow = __v_isShallow;
1392
- this.dep = void 0;
1643
+ this.dep = new Dep();
1393
1644
  this.__v_isRef = true;
1394
1645
  this._rawValue = __v_isShallow ? value : toRaw(value);
1395
1646
  this._value = __v_isShallow ? value : toReactive(value);
1396
1647
  }
1397
1648
  get value() {
1398
- trackRefValue(this);
1649
+ {
1650
+ this.dep.track({
1651
+ target: this,
1652
+ type: "get",
1653
+ key: "value"
1654
+ });
1655
+ }
1399
1656
  return this._value;
1400
1657
  }
1401
- set value(newVal) {
1402
- const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
1403
- newVal = useDirectValue ? newVal : toRaw(newVal);
1404
- if (hasChanged(newVal, this._rawValue)) {
1405
- this._rawValue = newVal;
1406
- this._value = useDirectValue ? newVal : toReactive(newVal);
1407
- triggerRefValue(this, 4, newVal);
1658
+ set value(newValue) {
1659
+ const oldValue = this._rawValue;
1660
+ const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
1661
+ newValue = useDirectValue ? newValue : toRaw(newValue);
1662
+ if (hasChanged(newValue, oldValue)) {
1663
+ this._rawValue = newValue;
1664
+ this._value = useDirectValue ? newValue : toReactive(newValue);
1665
+ {
1666
+ this.dep.trigger({
1667
+ target: this,
1668
+ type: "set",
1669
+ key: "value",
1670
+ newValue,
1671
+ oldValue
1672
+ });
1673
+ }
1408
1674
  }
1409
1675
  }
1410
1676
  }
1411
1677
  function triggerRef(ref2) {
1412
- triggerRefValue(ref2, 4, ref2.value );
1678
+ {
1679
+ ref2.dep.trigger({
1680
+ target: ref2,
1681
+ type: "set",
1682
+ key: "value",
1683
+ newValue: ref2._value
1684
+ });
1685
+ }
1413
1686
  }
1414
1687
  function unref(ref2) {
1415
1688
  return isRef(ref2) ? ref2.value : ref2;
@@ -1434,12 +1707,9 @@ getter: `, this.getter);
1434
1707
  }
1435
1708
  class CustomRefImpl {
1436
1709
  constructor(factory) {
1437
- this.dep = void 0;
1438
1710
  this.__v_isRef = true;
1439
- const { get, set } = factory(
1440
- () => trackRefValue(this),
1441
- () => triggerRefValue(this)
1442
- );
1711
+ const dep = this.dep = new Dep();
1712
+ const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1443
1713
  this._get = get;
1444
1714
  this._set = set;
1445
1715
  }
@@ -1507,6 +1777,90 @@ getter: `, this.getter);
1507
1777
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1508
1778
  }
1509
1779
 
1780
+ class ComputedRefImpl {
1781
+ constructor(fn, setter, isSSR) {
1782
+ this.fn = fn;
1783
+ this.setter = setter;
1784
+ /**
1785
+ * @internal
1786
+ */
1787
+ this._value = void 0;
1788
+ /**
1789
+ * @internal
1790
+ */
1791
+ this.dep = new Dep(this);
1792
+ /**
1793
+ * @internal
1794
+ */
1795
+ this.__v_isRef = true;
1796
+ // A computed is also a subscriber that tracks other deps
1797
+ /**
1798
+ * @internal
1799
+ */
1800
+ this.deps = void 0;
1801
+ /**
1802
+ * @internal
1803
+ */
1804
+ this.depsTail = void 0;
1805
+ /**
1806
+ * @internal
1807
+ */
1808
+ this.flags = 16;
1809
+ /**
1810
+ * @internal
1811
+ */
1812
+ this.globalVersion = globalVersion - 1;
1813
+ // for backwards compat
1814
+ this.effect = this;
1815
+ this.__v_isReadonly = !setter;
1816
+ this.isSSR = isSSR;
1817
+ }
1818
+ /**
1819
+ * @internal
1820
+ */
1821
+ notify() {
1822
+ if (activeSub !== this) {
1823
+ this.flags |= 16;
1824
+ this.dep.notify();
1825
+ }
1826
+ }
1827
+ get value() {
1828
+ const link = this.dep.track({
1829
+ target: this,
1830
+ type: "get",
1831
+ key: "value"
1832
+ }) ;
1833
+ refreshComputed(this);
1834
+ if (link) {
1835
+ link.version = this.dep.version;
1836
+ }
1837
+ return this._value;
1838
+ }
1839
+ set value(newValue) {
1840
+ if (this.setter) {
1841
+ this.setter(newValue);
1842
+ } else {
1843
+ warn$2("Write operation failed: computed value is readonly");
1844
+ }
1845
+ }
1846
+ }
1847
+ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1848
+ let getter;
1849
+ let setter;
1850
+ if (isFunction(getterOrOptions)) {
1851
+ getter = getterOrOptions;
1852
+ } else {
1853
+ getter = getterOrOptions.get;
1854
+ setter = getterOrOptions.set;
1855
+ }
1856
+ const cRef = new ComputedRefImpl(getter, setter, isSSR);
1857
+ if (debugOptions && !isSSR) {
1858
+ cRef.onTrack = debugOptions.onTrack;
1859
+ cRef.onTrigger = debugOptions.onTrigger;
1860
+ }
1861
+ return cRef;
1862
+ }
1863
+
1510
1864
  const TrackOpTypes = {
1511
1865
  "GET": "get",
1512
1866
  "HAS": "has",
@@ -1799,7 +2153,7 @@ getter: `, this.getter);
1799
2153
  const middle = start + end >>> 1;
1800
2154
  const middleJob = queue[middle];
1801
2155
  const middleJobId = getId(middleJob);
1802
- if (middleJobId < id || middleJobId === id && middleJob.pre) {
2156
+ if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
1803
2157
  start = middle + 1;
1804
2158
  } else {
1805
2159
  end = middle;
@@ -1808,15 +2162,21 @@ getter: `, this.getter);
1808
2162
  return start;
1809
2163
  }
1810
2164
  function queueJob(job) {
1811
- if (!queue.length || !queue.includes(
1812
- job,
1813
- isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
1814
- )) {
2165
+ var _a;
2166
+ if (!(job.flags & 1)) {
1815
2167
  if (job.id == null) {
1816
2168
  queue.push(job);
2169
+ } else if (
2170
+ // fast path when the job id is larger than the tail
2171
+ !(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
2172
+ ) {
2173
+ queue.push(job);
1817
2174
  } else {
1818
2175
  queue.splice(findInsertionIndex(job.id), 0, job);
1819
2176
  }
2177
+ if (!(job.flags & 4)) {
2178
+ job.flags |= 1;
2179
+ }
1820
2180
  queueFlush();
1821
2181
  }
1822
2182
  }
@@ -1834,11 +2194,11 @@ getter: `, this.getter);
1834
2194
  }
1835
2195
  function queuePostFlushCb(cb) {
1836
2196
  if (!isArray(cb)) {
1837
- if (!activePostFlushCbs || !activePostFlushCbs.includes(
1838
- cb,
1839
- cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
1840
- )) {
2197
+ if (!(cb.flags & 1)) {
1841
2198
  pendingPostFlushCbs.push(cb);
2199
+ if (!(cb.flags & 4)) {
2200
+ cb.flags |= 1;
2201
+ }
1842
2202
  }
1843
2203
  } else {
1844
2204
  pendingPostFlushCbs.push(...cb);
@@ -1851,7 +2211,7 @@ getter: `, this.getter);
1851
2211
  }
1852
2212
  for (; i < queue.length; i++) {
1853
2213
  const cb = queue[i];
1854
- if (cb && cb.pre) {
2214
+ if (cb && cb.flags & 2) {
1855
2215
  if (instance && cb.id !== instance.uid) {
1856
2216
  continue;
1857
2217
  }
@@ -1861,6 +2221,7 @@ getter: `, this.getter);
1861
2221
  queue.splice(i, 1);
1862
2222
  i--;
1863
2223
  cb();
2224
+ cb.flags &= ~1;
1864
2225
  }
1865
2226
  }
1866
2227
  }
@@ -1883,6 +2244,7 @@ getter: `, this.getter);
1883
2244
  continue;
1884
2245
  }
1885
2246
  activePostFlushCbs[postFlushIndex]();
2247
+ activePostFlushCbs[postFlushIndex].flags &= ~1;
1886
2248
  }
1887
2249
  activePostFlushCbs = null;
1888
2250
  postFlushIndex = 0;
@@ -1892,9 +2254,11 @@ getter: `, this.getter);
1892
2254
  const comparator = (a, b) => {
1893
2255
  const diff = getId(a) - getId(b);
1894
2256
  if (diff === 0) {
1895
- if (a.pre && !b.pre)
2257
+ const isAPre = a.flags & 2;
2258
+ const isBPre = b.flags & 2;
2259
+ if (isAPre && !isBPre)
1896
2260
  return -1;
1897
- if (b.pre && !a.pre)
2261
+ if (isBPre && !isAPre)
1898
2262
  return 1;
1899
2263
  }
1900
2264
  return diff;
@@ -1910,11 +2274,12 @@ getter: `, this.getter);
1910
2274
  try {
1911
2275
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1912
2276
  const job = queue[flushIndex];
1913
- if (job && job.active !== false) {
2277
+ if (job && !(job.flags & 8)) {
1914
2278
  if (check(job)) {
1915
2279
  continue;
1916
2280
  }
1917
2281
  callWithErrorHandling(job, null, 14);
2282
+ job.flags &= ~1;
1918
2283
  }
1919
2284
  }
1920
2285
  } finally {
@@ -1996,7 +2361,6 @@ getter: `, this.getter);
1996
2361
  }
1997
2362
  instance.renderCache = [];
1998
2363
  isHmrUpdating = true;
1999
- instance.effect.dirty = true;
2000
2364
  instance.update();
2001
2365
  isHmrUpdating = false;
2002
2366
  });
@@ -2024,7 +2388,6 @@ getter: `, this.getter);
2024
2388
  instance.ceReload(newComp.styles);
2025
2389
  hmrDirtyComponents.delete(oldComp);
2026
2390
  } else if (instance.parent) {
2027
- instance.parent.effect.dirty = true;
2028
2391
  queueJob(instance.parent.update);
2029
2392
  } else if (instance.appContext.reload) {
2030
2393
  instance.appContext.reload();
@@ -3988,8 +4351,8 @@ If this is a native custom element, make sure to exclude it from component resol
3988
4351
  };
3989
4352
  };
3990
4353
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
3991
- const job = () => {
3992
- if (!effect.active || !effect.dirty) {
4354
+ const job = (immediateFirstRun) => {
4355
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
3993
4356
  return;
3994
4357
  }
3995
4358
  if (cb) {
@@ -4010,19 +4373,22 @@ If this is a native custom element, make sure to exclude it from component resol
4010
4373
  effect.run();
4011
4374
  }
4012
4375
  };
4013
- job.allowRecurse = !!cb;
4376
+ if (cb)
4377
+ job.flags |= 4;
4378
+ const effect = new ReactiveEffect(getter);
4014
4379
  let scheduler;
4015
4380
  if (flush === "sync") {
4381
+ effect.flags |= 64;
4016
4382
  scheduler = job;
4017
4383
  } else if (flush === "post") {
4018
4384
  scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
4019
4385
  } else {
4020
- job.pre = true;
4386
+ job.flags |= 2;
4021
4387
  if (instance)
4022
4388
  job.id = instance.uid;
4023
4389
  scheduler = () => queueJob(job);
4024
4390
  }
4025
- const effect = new ReactiveEffect(getter, NOOP, scheduler);
4391
+ effect.scheduler = scheduler;
4026
4392
  const scope = getCurrentScope();
4027
4393
  const unwatch = () => {
4028
4394
  effect.stop();
@@ -4036,7 +4402,7 @@ If this is a native custom element, make sure to exclude it from component resol
4036
4402
  }
4037
4403
  if (cb) {
4038
4404
  if (immediate) {
4039
- job();
4405
+ job(true);
4040
4406
  } else {
4041
4407
  oldValue = effect.run();
4042
4408
  }
@@ -4218,22 +4584,7 @@ If this is a native custom element, make sure to exclude it from component resol
4218
4584
  if (!children || !children.length) {
4219
4585
  return;
4220
4586
  }
4221
- let child = children[0];
4222
- if (children.length > 1) {
4223
- let hasFound = false;
4224
- for (const c of children) {
4225
- if (c.type !== Comment) {
4226
- if (hasFound) {
4227
- warn$1(
4228
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
4229
- );
4230
- break;
4231
- }
4232
- child = c;
4233
- hasFound = true;
4234
- }
4235
- }
4236
- }
4587
+ const child = findNonCommentChild(children);
4237
4588
  const rawProps = toRaw(props);
4238
4589
  const { mode } = rawProps;
4239
4590
  if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
@@ -4242,7 +4593,7 @@ If this is a native custom element, make sure to exclude it from component resol
4242
4593
  if (state.isLeaving) {
4243
4594
  return emptyPlaceholder(child);
4244
4595
  }
4245
- const innerChild = getKeepAliveChild(child);
4596
+ const innerChild = getInnerChild$1(child);
4246
4597
  if (!innerChild) {
4247
4598
  return emptyPlaceholder(child);
4248
4599
  }
@@ -4254,7 +4605,7 @@ If this is a native custom element, make sure to exclude it from component resol
4254
4605
  );
4255
4606
  setTransitionHooks(innerChild, enterHooks);
4256
4607
  const oldChild = instance.subTree;
4257
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4608
+ const oldInnerChild = oldChild && getInnerChild$1(oldChild);
4258
4609
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4259
4610
  const leavingHooks = resolveTransitionHooks(
4260
4611
  oldInnerChild,
@@ -4267,8 +4618,7 @@ If this is a native custom element, make sure to exclude it from component resol
4267
4618
  state.isLeaving = true;
4268
4619
  leavingHooks.afterLeave = () => {
4269
4620
  state.isLeaving = false;
4270
- if (instance.update.active !== false) {
4271
- instance.effect.dirty = true;
4621
+ if (!(instance.job.flags & 8)) {
4272
4622
  instance.update();
4273
4623
  }
4274
4624
  };
@@ -4296,6 +4646,25 @@ If this is a native custom element, make sure to exclude it from component resol
4296
4646
  {
4297
4647
  BaseTransitionImpl.__isBuiltIn = true;
4298
4648
  }
4649
+ function findNonCommentChild(children) {
4650
+ let child = children[0];
4651
+ if (children.length > 1) {
4652
+ let hasFound = false;
4653
+ for (const c of children) {
4654
+ if (c.type !== Comment) {
4655
+ if (hasFound) {
4656
+ warn$1(
4657
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
4658
+ );
4659
+ break;
4660
+ }
4661
+ child = c;
4662
+ hasFound = true;
4663
+ }
4664
+ }
4665
+ }
4666
+ return child;
4667
+ }
4299
4668
  const BaseTransition = BaseTransitionImpl;
4300
4669
  function getLeavingNodesForType(state, vnode) {
4301
4670
  const { leavingVNodes } = state;
@@ -4450,8 +4819,11 @@ If this is a native custom element, make sure to exclude it from component resol
4450
4819
  return vnode;
4451
4820
  }
4452
4821
  }
4453
- function getKeepAliveChild(vnode) {
4822
+ function getInnerChild$1(vnode) {
4454
4823
  if (!isKeepAlive(vnode)) {
4824
+ if (isTeleport(vnode.type) && vnode.children) {
4825
+ return findNonCommentChild(vnode.children);
4826
+ }
4455
4827
  return vnode;
4456
4828
  }
4457
4829
  if (vnode.component) {
@@ -4620,7 +4992,6 @@ If this is a native custom element, make sure to exclude it from component resol
4620
4992
  load().then(() => {
4621
4993
  loaded.value = true;
4622
4994
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4623
- instance.parent.effect.dirty = true;
4624
4995
  queueJob(instance.parent.update);
4625
4996
  }
4626
4997
  }).catch((err) => {
@@ -5232,10 +5603,20 @@ If this is a native custom element, make sure to exclude it from component resol
5232
5603
  function renderList(source, renderItem, cache, index) {
5233
5604
  let ret;
5234
5605
  const cached = cache && cache[index];
5235
- if (isArray(source) || isString(source)) {
5606
+ const sourceIsArray = isArray(source);
5607
+ const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5608
+ if (sourceIsArray || isString(source)) {
5609
+ if (sourceIsReactiveArray) {
5610
+ source = shallowReadArray(source);
5611
+ }
5236
5612
  ret = new Array(source.length);
5237
5613
  for (let i = 0, l = source.length; i < l; i++) {
5238
- ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
5614
+ ret[i] = renderItem(
5615
+ sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5616
+ i,
5617
+ void 0,
5618
+ cached && cached[i]
5619
+ );
5239
5620
  }
5240
5621
  } else if (typeof source === "number") {
5241
5622
  if (!Number.isInteger(source)) {
@@ -5606,7 +5987,6 @@ If this is a native custom element, make sure to exclude it from component resol
5606
5987
  $emit: (i) => i.emit,
5607
5988
  $options: (i) => resolveMergedOptions(i) ,
5608
5989
  $forceUpdate: (i) => i.f || (i.f = () => {
5609
- i.effect.dirty = true;
5610
5990
  queueJob(i.update);
5611
5991
  }),
5612
5992
  $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
@@ -6477,7 +6857,7 @@ If this is a native custom element, make sure to exclude it from component resol
6477
6857
  return vm;
6478
6858
  }
6479
6859
  }
6480
- Vue.version = `2.6.14-compat:${"3.4.25"}`;
6860
+ Vue.version = `2.6.14-compat:${"3.5.0-alpha.1"}`;
6481
6861
  Vue.config = singletonApp.config;
6482
6862
  Vue.use = (p, ...options) => {
6483
6863
  if (p && isFunction(p.install)) {
@@ -7495,7 +7875,9 @@ If you want to remount the same app, move your app creation logic into a factory
7495
7875
  function assertType(value, type) {
7496
7876
  let valid;
7497
7877
  const expectedType = getType(type);
7498
- if (isSimpleType(expectedType)) {
7878
+ if (expectedType === "null") {
7879
+ valid = value === null;
7880
+ } else if (isSimpleType(expectedType)) {
7499
7881
  const t = typeof value;
7500
7882
  valid = t === expectedType.toLowerCase();
7501
7883
  if (!valid && t === "object") {
@@ -7505,8 +7887,6 @@ If you want to remount the same app, move your app creation logic into a factory
7505
7887
  valid = isObject(value);
7506
7888
  } else if (expectedType === "Array") {
7507
7889
  valid = isArray(value);
7508
- } else if (expectedType === "null") {
7509
- valid = value === null;
7510
7890
  } else {
7511
7891
  valid = value instanceof type;
7512
7892
  }
@@ -9031,7 +9411,6 @@ Server rendered element contains fewer child nodes than client vdom.`
9031
9411
  } else {
9032
9412
  instance.next = n2;
9033
9413
  invalidateJob(instance.update);
9034
- instance.effect.dirty = true;
9035
9414
  instance.update();
9036
9415
  }
9037
9416
  } else {
@@ -9238,24 +9617,18 @@ Server rendered element contains fewer child nodes than client vdom.`
9238
9617
  }
9239
9618
  }
9240
9619
  };
9241
- const effect = instance.effect = new ReactiveEffect(
9242
- componentUpdateFn,
9243
- NOOP,
9244
- () => queueJob(update),
9245
- instance.scope
9246
- // track it in component's effect scope
9247
- );
9248
- const update = instance.update = () => {
9249
- if (effect.dirty) {
9250
- effect.run();
9251
- }
9252
- };
9253
- update.id = instance.uid;
9620
+ instance.scope.on();
9621
+ const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
9622
+ instance.scope.off();
9623
+ const update = instance.update = effect.run.bind(effect);
9624
+ const job = instance.job = effect.runIfDirty.bind(effect);
9625
+ job.id = instance.uid;
9626
+ effect.scheduler = () => queueJob(job);
9254
9627
  toggleRecurse(instance, true);
9255
9628
  {
9256
9629
  effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
9257
9630
  effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
9258
- update.ownerInstance = instance;
9631
+ job.ownerInstance = instance;
9259
9632
  }
9260
9633
  update();
9261
9634
  };
@@ -9722,7 +10095,7 @@ Server rendered element contains fewer child nodes than client vdom.`
9722
10095
  if (instance.type.__hmrId) {
9723
10096
  unregisterHMR(instance);
9724
10097
  }
9725
- const { bum, scope, update, subTree, um } = instance;
10098
+ const { bum, scope, job, subTree, um } = instance;
9726
10099
  if (bum) {
9727
10100
  invokeArrayFns(bum);
9728
10101
  }
@@ -9730,8 +10103,8 @@ Server rendered element contains fewer child nodes than client vdom.`
9730
10103
  instance.emit("hook:beforeDestroy");
9731
10104
  }
9732
10105
  scope.stop();
9733
- if (update) {
9734
- update.active = false;
10106
+ if (job) {
10107
+ job.flags |= 8;
9735
10108
  unmount(subTree, instance, parentSuspense, doRemove);
9736
10109
  }
9737
10110
  if (um) {
@@ -9823,8 +10196,14 @@ Server rendered element contains fewer child nodes than client vdom.`
9823
10196
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
9824
10197
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
9825
10198
  }
9826
- function toggleRecurse({ effect, update }, allowed) {
9827
- effect.allowRecurse = update.allowRecurse = allowed;
10199
+ function toggleRecurse({ effect, job }, allowed) {
10200
+ if (allowed) {
10201
+ effect.flags |= 32;
10202
+ job.flags |= 4;
10203
+ } else {
10204
+ effect.flags &= ~32;
10205
+ job.flags &= ~4;
10206
+ }
9828
10207
  }
9829
10208
  function needTransition(parentSuspense, transition) {
9830
10209
  return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
@@ -10622,6 +11001,7 @@ Component that was made reactive: `,
10622
11001
  effect: null,
10623
11002
  update: null,
10624
11003
  // will be set synchronously right after creation
11004
+ job: null,
10625
11005
  scope: new EffectScope(
10626
11006
  true
10627
11007
  /* detached */
@@ -11127,7 +11507,8 @@ Component that was made reactive: `,
11127
11507
  {},
11128
11508
  ["span", vueStyle, genRefFlag(obj)],
11129
11509
  "<",
11130
- formatValue(obj.value),
11510
+ // avoid debugger accessing value affecting behavior
11511
+ formatValue("_value" in obj ? obj._value : obj),
11131
11512
  `>`
11132
11513
  ];
11133
11514
  } else if (isReactive(obj)) {
@@ -11307,7 +11688,7 @@ Component that was made reactive: `,
11307
11688
  return true;
11308
11689
  }
11309
11690
 
11310
- const version = "3.4.25";
11691
+ const version = "3.5.0-alpha.1";
11311
11692
  const warn = warn$1 ;
11312
11693
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11313
11694
  const devtools = devtools$1 ;
@@ -12862,7 +13243,9 @@ Expected function or array of functions, received type ${typeof value}.`
12862
13243
  return;
12863
13244
  }
12864
13245
  const eventKey = hyphenate(event.key);
12865
- if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
13246
+ if (modifiers.some(
13247
+ (k) => k === eventKey || keyNames[k] === eventKey
13248
+ )) {
12866
13249
  return fn(event);
12867
13250
  }
12868
13251
  {