@vue/server-renderer 3.5.17 → 3.6.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/server-renderer v3.5.17
2
+ * @vue/server-renderer v3.6.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -18,6 +18,8 @@ const NOOP = () => {
18
18
  const NO = () => false;
19
19
  const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
20
20
  (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
21
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
22
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
21
23
  const isModelListener = (key) => key.startsWith("onUpdate:");
22
24
  const extend = Object.assign;
23
25
  const remove = (arr, el) => {
@@ -50,6 +52,7 @@ const isReservedProp = /* @__PURE__ */ makeMap(
50
52
  // the leading comma is intentional so empty string "" is also included
51
53
  ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
52
54
  );
55
+ const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
53
56
  const isBuiltInDirective = /* @__PURE__ */ makeMap(
54
57
  "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
55
58
  );
@@ -61,10 +64,9 @@ const cacheStringFunction = (fn) => {
61
64
  };
62
65
  };
63
66
  const camelizeRE = /-(\w)/g;
67
+ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
64
68
  const camelize = cacheStringFunction(
65
- (str) => {
66
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
67
- }
69
+ (str) => str.replace(camelizeRE, camelizeReplacer)
68
70
  );
69
71
  const hyphenateRE = /\B([A-Z])/g;
70
72
  const hyphenate = cacheStringFunction(
@@ -101,6 +103,10 @@ let _globalThis;
101
103
  const getGlobalThis = () => {
102
104
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
103
105
  };
106
+ function canSetValueDirectly(tagName) {
107
+ return tagName !== "PROGRESS" && // custom elements may use _value internally
108
+ !tagName.includes("-");
109
+ }
104
110
 
105
111
  function normalizeStyle(value) {
106
112
  if (isArray(value)) {
@@ -208,6 +214,24 @@ function isRenderableAttrValue(value) {
208
214
  const type = typeof value;
209
215
  return type === "string" || type === "number" || type === "boolean";
210
216
  }
217
+ function shouldSetAsAttr(tagName, key) {
218
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
219
+ return true;
220
+ }
221
+ if (key === "form") {
222
+ return true;
223
+ }
224
+ if (key === "list" && tagName === "INPUT") {
225
+ return true;
226
+ }
227
+ if (key === "type" && tagName === "TEXTAREA") {
228
+ return true;
229
+ }
230
+ if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
231
+ return true;
232
+ }
233
+ return false;
234
+ }
211
235
 
212
236
  const escapeRE = /["'&<>]/;
213
237
  function escapeHtml(string) {
@@ -307,7 +331,20 @@ const isRef$1 = (val) => {
307
331
  return !!(val && val["__v_isRef"] === true);
308
332
  };
309
333
  const toDisplayString = (val) => {
310
- return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
334
+ switch (typeof val) {
335
+ case "string":
336
+ return val;
337
+ case "object":
338
+ if (val) {
339
+ if (isRef$1(val)) {
340
+ return toDisplayString(val.value);
341
+ } else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) {
342
+ return JSON.stringify(val, replacer, 2);
343
+ }
344
+ }
345
+ default:
346
+ return val == null ? "" : String(val);
347
+ }
311
348
  };
312
349
  const replacer = (_key, val) => {
313
350
  if (isRef$1(val)) {
@@ -342,571 +379,407 @@ const stringifySymbol = (v, i = "") => {
342
379
  );
343
380
  };
344
381
 
345
- function warn$2(msg, ...args) {
346
- console.warn(`[Vue warn] ${msg}`, ...args);
347
- }
348
-
349
- let activeEffectScope;
350
- class EffectScope {
351
- constructor(detached = false) {
352
- this.detached = detached;
353
- /**
354
- * @internal
355
- */
356
- this._active = true;
357
- /**
358
- * @internal track `on` calls, allow `on` call multiple times
359
- */
360
- this._on = 0;
361
- /**
362
- * @internal
363
- */
364
- this.effects = [];
365
- /**
366
- * @internal
367
- */
368
- this.cleanups = [];
369
- this._isPaused = false;
370
- this.parent = activeEffectScope;
371
- if (!detached && activeEffectScope) {
372
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
373
- this
374
- ) - 1;
375
- }
376
- }
377
- get active() {
378
- return this._active;
379
- }
380
- pause() {
381
- if (this._active) {
382
- this._isPaused = true;
383
- let i, l;
384
- if (this.scopes) {
385
- for (i = 0, l = this.scopes.length; i < l; i++) {
386
- this.scopes[i].pause();
387
- }
388
- }
389
- for (i = 0, l = this.effects.length; i < l; i++) {
390
- this.effects[i].pause();
391
- }
392
- }
393
- }
394
- /**
395
- * Resumes the effect scope, including all child scopes and effects.
396
- */
397
- resume() {
398
- if (this._active) {
399
- if (this._isPaused) {
400
- this._isPaused = false;
401
- let i, l;
402
- if (this.scopes) {
403
- for (i = 0, l = this.scopes.length; i < l; i++) {
404
- this.scopes[i].resume();
405
- }
406
- }
407
- for (i = 0, l = this.effects.length; i < l; i++) {
408
- this.effects[i].resume();
409
- }
410
- }
411
- }
412
- }
413
- run(fn) {
414
- if (this._active) {
415
- const currentEffectScope = activeEffectScope;
416
- try {
417
- activeEffectScope = this;
418
- return fn();
419
- } finally {
420
- activeEffectScope = currentEffectScope;
421
- }
422
- } else {
423
- warn$2(`cannot run an inactive effect scope.`);
424
- }
425
- }
426
- /**
427
- * This should only be called on non-detached scopes
428
- * @internal
429
- */
430
- on() {
431
- if (++this._on === 1) {
432
- this.prevScope = activeEffectScope;
433
- activeEffectScope = this;
434
- }
435
- }
436
- /**
437
- * This should only be called on non-detached scopes
438
- * @internal
439
- */
440
- off() {
441
- if (this._on > 0 && --this._on === 0) {
442
- activeEffectScope = this.prevScope;
443
- this.prevScope = void 0;
444
- }
445
- }
446
- stop(fromParent) {
447
- if (this._active) {
448
- this._active = false;
449
- let i, l;
450
- for (i = 0, l = this.effects.length; i < l; i++) {
451
- this.effects[i].stop();
452
- }
453
- this.effects.length = 0;
454
- for (i = 0, l = this.cleanups.length; i < l; i++) {
455
- this.cleanups[i]();
382
+ function getSequence(arr) {
383
+ const p = arr.slice();
384
+ const result = [0];
385
+ let i, j, u, v, c;
386
+ const len = arr.length;
387
+ for (i = 0; i < len; i++) {
388
+ const arrI = arr[i];
389
+ if (arrI !== 0) {
390
+ j = result[result.length - 1];
391
+ if (arr[j] < arrI) {
392
+ p[i] = j;
393
+ result.push(i);
394
+ continue;
456
395
  }
457
- this.cleanups.length = 0;
458
- if (this.scopes) {
459
- for (i = 0, l = this.scopes.length; i < l; i++) {
460
- this.scopes[i].stop(true);
396
+ u = 0;
397
+ v = result.length - 1;
398
+ while (u < v) {
399
+ c = u + v >> 1;
400
+ if (arr[result[c]] < arrI) {
401
+ u = c + 1;
402
+ } else {
403
+ v = c;
461
404
  }
462
- this.scopes.length = 0;
463
405
  }
464
- if (!this.detached && this.parent && !fromParent) {
465
- const last = this.parent.scopes.pop();
466
- if (last && last !== this) {
467
- this.parent.scopes[this.index] = last;
468
- last.index = this.index;
406
+ if (arrI < arr[result[u]]) {
407
+ if (u > 0) {
408
+ p[i] = result[u - 1];
469
409
  }
410
+ result[u] = i;
470
411
  }
471
- this.parent = void 0;
472
412
  }
473
413
  }
474
- }
475
- function getCurrentScope() {
476
- return activeEffectScope;
414
+ u = result.length;
415
+ v = result[u - 1];
416
+ while (u-- > 0) {
417
+ result[u] = v;
418
+ v = p[v];
419
+ }
420
+ return result;
477
421
  }
478
422
 
479
- let activeSub;
480
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
481
- class ReactiveEffect {
482
- constructor(fn) {
483
- this.fn = fn;
484
- /**
485
- * @internal
486
- */
487
- this.deps = void 0;
488
- /**
489
- * @internal
490
- */
491
- this.depsTail = void 0;
492
- /**
493
- * @internal
494
- */
495
- this.flags = 1 | 4;
496
- /**
497
- * @internal
498
- */
499
- this.next = void 0;
500
- /**
501
- * @internal
502
- */
503
- this.cleanup = void 0;
504
- this.scheduler = void 0;
505
- if (activeEffectScope && activeEffectScope.active) {
506
- activeEffectScope.effects.push(this);
507
- }
508
- }
509
- pause() {
510
- this.flags |= 64;
511
- }
512
- resume() {
513
- if (this.flags & 64) {
514
- this.flags &= -65;
515
- if (pausedQueueEffects.has(this)) {
516
- pausedQueueEffects.delete(this);
517
- this.trigger();
518
- }
519
- }
520
- }
521
- /**
522
- * @internal
523
- */
524
- notify() {
525
- if (this.flags & 2 && !(this.flags & 32)) {
526
- return;
527
- }
528
- if (!(this.flags & 8)) {
529
- batch(this);
530
- }
531
- }
532
- run() {
533
- if (!(this.flags & 1)) {
534
- return this.fn();
535
- }
536
- this.flags |= 2;
537
- cleanupEffect(this);
538
- prepareDeps(this);
539
- const prevEffect = activeSub;
540
- const prevShouldTrack = shouldTrack;
541
- activeSub = this;
542
- shouldTrack = true;
543
- try {
544
- return this.fn();
545
- } finally {
546
- if (activeSub !== this) {
547
- warn$2(
548
- "Active effect was not restored correctly - this is likely a Vue internal bug."
549
- );
550
- }
551
- cleanupDeps(this);
552
- activeSub = prevEffect;
553
- shouldTrack = prevShouldTrack;
554
- this.flags &= -3;
555
- }
556
- }
557
- stop() {
558
- if (this.flags & 1) {
559
- for (let link = this.deps; link; link = link.nextDep) {
560
- removeSub(link);
561
- }
562
- this.deps = this.depsTail = void 0;
563
- cleanupEffect(this);
564
- this.onStop && this.onStop();
565
- this.flags &= -2;
566
- }
423
+ function normalizeCssVarValue(value) {
424
+ if (value == null) {
425
+ return "initial";
567
426
  }
568
- trigger() {
569
- if (this.flags & 64) {
570
- pausedQueueEffects.add(this);
571
- } else if (this.scheduler) {
572
- this.scheduler();
573
- } else {
574
- this.runIfDirty();
575
- }
427
+ if (typeof value === "string") {
428
+ return value === "" ? " " : value;
576
429
  }
577
- /**
578
- * @internal
579
- */
580
- runIfDirty() {
581
- if (isDirty(this)) {
582
- this.run();
430
+ if (typeof value !== "number" || !Number.isFinite(value)) {
431
+ {
432
+ console.warn(
433
+ "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
434
+ value
435
+ );
583
436
  }
584
437
  }
585
- get dirty() {
586
- return isDirty(this);
587
- }
438
+ return String(value);
588
439
  }
440
+
441
+ function warn$2(msg, ...args) {
442
+ console.warn(`[Vue warn] ${msg}`, ...args);
443
+ }
444
+
445
+ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
446
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
447
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
448
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
449
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
450
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
451
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
452
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
453
+ return ReactiveFlags2;
454
+ })(ReactiveFlags || {});
455
+ const notifyBuffer = [];
589
456
  let batchDepth = 0;
590
- let batchedSub;
591
- let batchedComputed;
592
- function batch(sub, isComputed = false) {
593
- sub.flags |= 8;
594
- if (isComputed) {
595
- sub.next = batchedComputed;
596
- batchedComputed = sub;
597
- return;
457
+ let activeSub = void 0;
458
+ let notifyIndex = 0;
459
+ let notifyBufferLength = 0;
460
+ function setActiveSub(sub) {
461
+ try {
462
+ return activeSub;
463
+ } finally {
464
+ activeSub = sub;
598
465
  }
599
- sub.next = batchedSub;
600
- batchedSub = sub;
601
466
  }
602
467
  function startBatch() {
603
- batchDepth++;
468
+ ++batchDepth;
604
469
  }
605
470
  function endBatch() {
606
- if (--batchDepth > 0) {
607
- return;
608
- }
609
- if (batchedComputed) {
610
- let e = batchedComputed;
611
- batchedComputed = void 0;
612
- while (e) {
613
- const next = e.next;
614
- e.next = void 0;
615
- e.flags &= -9;
616
- e = next;
617
- }
618
- }
619
- let error;
620
- while (batchedSub) {
621
- let e = batchedSub;
622
- batchedSub = void 0;
623
- while (e) {
624
- const next = e.next;
625
- e.next = void 0;
626
- e.flags &= -9;
627
- if (e.flags & 1) {
628
- try {
629
- ;
630
- e.trigger();
631
- } catch (err) {
632
- if (!error) error = err;
633
- }
634
- }
635
- e = next;
636
- }
637
- }
638
- if (error) throw error;
639
- }
640
- function prepareDeps(sub) {
641
- for (let link = sub.deps; link; link = link.nextDep) {
642
- link.version = -1;
643
- link.prevActiveLink = link.dep.activeLink;
644
- link.dep.activeLink = link;
471
+ if (!--batchDepth && notifyBufferLength) {
472
+ flush();
645
473
  }
646
474
  }
647
- function cleanupDeps(sub) {
648
- let head;
649
- let tail = sub.depsTail;
650
- let link = tail;
651
- while (link) {
652
- const prev = link.prevDep;
653
- if (link.version === -1) {
654
- if (link === tail) tail = prev;
655
- removeSub(link);
656
- removeDep(link);
657
- } else {
658
- head = link;
659
- }
660
- link.dep.activeLink = link.prevActiveLink;
661
- link.prevActiveLink = void 0;
662
- link = prev;
475
+ function link(dep, sub) {
476
+ const prevDep = sub.depsTail;
477
+ if (prevDep !== void 0 && prevDep.dep === dep) {
478
+ return;
663
479
  }
664
- sub.deps = head;
665
- sub.depsTail = tail;
666
- }
667
- function isDirty(sub) {
668
- for (let link = sub.deps; link; link = link.nextDep) {
669
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
670
- return true;
480
+ let nextDep = void 0;
481
+ const recursedCheck = sub.flags & 4 /* RecursedCheck */;
482
+ if (recursedCheck) {
483
+ nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
484
+ if (nextDep !== void 0 && nextDep.dep === dep) {
485
+ sub.depsTail = nextDep;
486
+ return;
671
487
  }
672
488
  }
673
- if (sub._dirty) {
674
- return true;
675
- }
676
- return false;
677
- }
678
- function refreshComputed(computed) {
679
- if (computed.flags & 4 && !(computed.flags & 16)) {
489
+ const prevSub = dep.subsTail;
490
+ if (prevSub !== void 0 && prevSub.sub === sub && (!recursedCheck || isValidLink(prevSub, sub))) {
680
491
  return;
681
492
  }
682
- computed.flags &= -17;
683
- if (computed.globalVersion === globalVersion) {
684
- return;
493
+ const newLink = sub.depsTail = dep.subsTail = {
494
+ dep,
495
+ sub,
496
+ prevDep,
497
+ nextDep,
498
+ prevSub,
499
+ nextSub: void 0
500
+ };
501
+ if (nextDep !== void 0) {
502
+ nextDep.prevDep = newLink;
685
503
  }
686
- computed.globalVersion = globalVersion;
687
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
688
- return;
504
+ if (prevDep !== void 0) {
505
+ prevDep.nextDep = newLink;
506
+ } else {
507
+ sub.deps = newLink;
689
508
  }
690
- computed.flags |= 2;
691
- const dep = computed.dep;
692
- const prevSub = activeSub;
693
- const prevShouldTrack = shouldTrack;
694
- activeSub = computed;
695
- shouldTrack = true;
696
- try {
697
- prepareDeps(computed);
698
- const value = computed.fn(computed._value);
699
- if (dep.version === 0 || hasChanged(value, computed._value)) {
700
- computed.flags |= 128;
701
- computed._value = value;
702
- dep.version++;
703
- }
704
- } catch (err) {
705
- dep.version++;
706
- throw err;
707
- } finally {
708
- activeSub = prevSub;
709
- shouldTrack = prevShouldTrack;
710
- cleanupDeps(computed);
711
- computed.flags &= -3;
509
+ if (prevSub !== void 0) {
510
+ prevSub.nextSub = newLink;
511
+ } else {
512
+ dep.subs = newLink;
712
513
  }
713
514
  }
714
- function removeSub(link, soft = false) {
715
- const { dep, prevSub, nextSub } = link;
716
- if (prevSub) {
717
- prevSub.nextSub = nextSub;
718
- link.prevSub = void 0;
515
+ function unlink(link2, sub = link2.sub) {
516
+ const dep = link2.dep;
517
+ const prevDep = link2.prevDep;
518
+ const nextDep = link2.nextDep;
519
+ const nextSub = link2.nextSub;
520
+ const prevSub = link2.prevSub;
521
+ if (nextDep !== void 0) {
522
+ nextDep.prevDep = prevDep;
523
+ } else {
524
+ sub.depsTail = prevDep;
719
525
  }
720
- if (nextSub) {
721
- nextSub.prevSub = prevSub;
722
- link.nextSub = void 0;
526
+ if (prevDep !== void 0) {
527
+ prevDep.nextDep = nextDep;
528
+ } else {
529
+ sub.deps = nextDep;
723
530
  }
724
- if (dep.subsHead === link) {
725
- dep.subsHead = nextSub;
531
+ if (nextSub !== void 0) {
532
+ nextSub.prevSub = prevSub;
533
+ } else {
534
+ dep.subsTail = prevSub;
726
535
  }
727
- if (dep.subs === link) {
728
- dep.subs = prevSub;
729
- if (!prevSub && dep.computed) {
730
- dep.computed.flags &= -5;
731
- for (let l = dep.computed.deps; l; l = l.nextDep) {
732
- removeSub(l, true);
536
+ if (prevSub !== void 0) {
537
+ prevSub.nextSub = nextSub;
538
+ } else if ((dep.subs = nextSub) === void 0) {
539
+ let toRemove = dep.deps;
540
+ if (toRemove !== void 0) {
541
+ do {
542
+ toRemove = unlink(toRemove, dep);
543
+ } while (toRemove !== void 0);
544
+ dep.flags |= 16 /* Dirty */;
545
+ }
546
+ }
547
+ return nextDep;
548
+ }
549
+ function propagate(link2) {
550
+ let next = link2.nextSub;
551
+ let stack;
552
+ top: do {
553
+ const sub = link2.sub;
554
+ let flags = sub.flags;
555
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
556
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
557
+ sub.flags = flags | 32 /* Pending */;
558
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
559
+ flags = 0 /* None */;
560
+ } else if (!(flags & 4 /* RecursedCheck */)) {
561
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
562
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
563
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
564
+ flags &= 1 /* Mutable */;
565
+ } else {
566
+ flags = 0 /* None */;
567
+ }
568
+ if (flags & 2 /* Watching */) {
569
+ notifyBuffer[notifyBufferLength++] = sub;
570
+ }
571
+ if (flags & 1 /* Mutable */) {
572
+ const subSubs = sub.subs;
573
+ if (subSubs !== void 0) {
574
+ link2 = subSubs;
575
+ if (subSubs.nextSub !== void 0) {
576
+ stack = { value: next, prev: stack };
577
+ next = link2.nextSub;
578
+ }
579
+ continue;
580
+ }
733
581
  }
734
582
  }
735
- }
736
- if (!soft && !--dep.sc && dep.map) {
737
- dep.map.delete(dep.key);
738
- }
739
- }
740
- function removeDep(link) {
741
- const { prevDep, nextDep } = link;
742
- if (prevDep) {
743
- prevDep.nextDep = nextDep;
744
- link.prevDep = void 0;
745
- }
746
- if (nextDep) {
747
- nextDep.prevDep = prevDep;
748
- link.nextDep = void 0;
749
- }
750
- }
751
- let shouldTrack = true;
752
- const trackStack = [];
753
- function pauseTracking() {
754
- trackStack.push(shouldTrack);
755
- shouldTrack = false;
756
- }
757
- function resetTracking() {
758
- const last = trackStack.pop();
759
- shouldTrack = last === void 0 ? true : last;
760
- }
761
- function cleanupEffect(e) {
762
- const { cleanup } = e;
763
- e.cleanup = void 0;
764
- if (cleanup) {
765
- const prevSub = activeSub;
766
- activeSub = void 0;
767
- try {
768
- cleanup();
769
- } finally {
770
- activeSub = prevSub;
583
+ if ((link2 = next) !== void 0) {
584
+ next = link2.nextSub;
585
+ continue;
771
586
  }
772
- }
587
+ while (stack !== void 0) {
588
+ link2 = stack.value;
589
+ stack = stack.prev;
590
+ if (link2 !== void 0) {
591
+ next = link2.nextSub;
592
+ continue top;
593
+ }
594
+ }
595
+ break;
596
+ } while (true);
773
597
  }
774
-
775
- let globalVersion = 0;
776
- class Link {
777
- constructor(sub, dep) {
778
- this.sub = sub;
779
- this.dep = dep;
780
- this.version = dep.version;
781
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
782
- }
598
+ function startTracking(sub) {
599
+ sub.depsTail = void 0;
600
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
601
+ return setActiveSub(sub);
783
602
  }
784
- class Dep {
785
- // TODO isolatedDeclarations "__v_skip"
786
- constructor(computed) {
787
- this.computed = computed;
788
- this.version = 0;
789
- /**
790
- * Link between this dep and the current active effect
791
- */
792
- this.activeLink = void 0;
793
- /**
794
- * Doubly linked list representing the subscribing effects (tail)
795
- */
796
- this.subs = void 0;
797
- /**
798
- * For object property deps cleanup
799
- */
800
- this.map = void 0;
801
- this.key = void 0;
802
- /**
803
- * Subscriber counter
804
- */
805
- this.sc = 0;
806
- /**
807
- * @internal
808
- */
809
- this.__v_skip = true;
810
- {
811
- this.subsHead = void 0;
812
- }
603
+ function endTracking(sub, prevSub) {
604
+ if (activeSub !== sub) {
605
+ warn$2(
606
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
607
+ );
813
608
  }
814
- track(debugInfo) {
815
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
816
- return;
609
+ activeSub = prevSub;
610
+ const depsTail = sub.depsTail;
611
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
612
+ while (toRemove !== void 0) {
613
+ toRemove = unlink(toRemove, sub);
614
+ }
615
+ sub.flags &= -5 /* RecursedCheck */;
616
+ }
617
+ function flush() {
618
+ while (notifyIndex < notifyBufferLength) {
619
+ const effect = notifyBuffer[notifyIndex];
620
+ notifyBuffer[notifyIndex++] = void 0;
621
+ effect.notify();
622
+ }
623
+ notifyIndex = 0;
624
+ notifyBufferLength = 0;
625
+ }
626
+ function checkDirty(link2, sub) {
627
+ let stack;
628
+ let checkDepth = 0;
629
+ top: do {
630
+ const dep = link2.dep;
631
+ const depFlags = dep.flags;
632
+ let dirty = false;
633
+ if (sub.flags & 16 /* Dirty */) {
634
+ dirty = true;
635
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
636
+ if (dep.update()) {
637
+ const subs = dep.subs;
638
+ if (subs.nextSub !== void 0) {
639
+ shallowPropagate(subs);
640
+ }
641
+ dirty = true;
642
+ }
643
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
644
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
645
+ stack = { value: link2, prev: stack };
646
+ }
647
+ link2 = dep.deps;
648
+ sub = dep;
649
+ ++checkDepth;
650
+ continue;
817
651
  }
818
- let link = this.activeLink;
819
- if (link === void 0 || link.sub !== activeSub) {
820
- link = this.activeLink = new Link(activeSub, this);
821
- if (!activeSub.deps) {
822
- activeSub.deps = activeSub.depsTail = link;
823
- } else {
824
- link.prevDep = activeSub.depsTail;
825
- activeSub.depsTail.nextDep = link;
826
- activeSub.depsTail = link;
827
- }
828
- addSub(link);
829
- } else if (link.version === -1) {
830
- link.version = this.version;
831
- if (link.nextDep) {
832
- const next = link.nextDep;
833
- next.prevDep = link.prevDep;
834
- if (link.prevDep) {
835
- link.prevDep.nextDep = next;
836
- }
837
- link.prevDep = activeSub.depsTail;
838
- link.nextDep = void 0;
839
- activeSub.depsTail.nextDep = link;
840
- activeSub.depsTail = link;
841
- if (activeSub.deps === link) {
842
- activeSub.deps = next;
843
- }
844
- }
845
- }
846
- if (activeSub.onTrack) {
847
- activeSub.onTrack(
848
- extend(
849
- {
850
- effect: activeSub
851
- },
852
- debugInfo
853
- )
854
- );
652
+ if (!dirty && link2.nextDep !== void 0) {
653
+ link2 = link2.nextDep;
654
+ continue;
855
655
  }
856
- return link;
857
- }
858
- trigger(debugInfo) {
859
- this.version++;
860
- globalVersion++;
861
- this.notify(debugInfo);
862
- }
863
- notify(debugInfo) {
864
- startBatch();
865
- try {
866
- if (true) {
867
- for (let head = this.subsHead; head; head = head.nextSub) {
868
- if (head.sub.onTrigger && !(head.sub.flags & 8)) {
869
- head.sub.onTrigger(
870
- extend(
871
- {
872
- effect: head.sub
873
- },
874
- debugInfo
875
- )
876
- );
656
+ while (checkDepth) {
657
+ --checkDepth;
658
+ const firstSub = sub.subs;
659
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
660
+ if (hasMultipleSubs) {
661
+ link2 = stack.value;
662
+ stack = stack.prev;
663
+ } else {
664
+ link2 = firstSub;
665
+ }
666
+ if (dirty) {
667
+ if (sub.update()) {
668
+ if (hasMultipleSubs) {
669
+ shallowPropagate(firstSub);
877
670
  }
671
+ sub = link2.sub;
672
+ continue;
878
673
  }
674
+ } else {
675
+ sub.flags &= -33 /* Pending */;
676
+ }
677
+ sub = link2.sub;
678
+ if (link2.nextDep !== void 0) {
679
+ link2 = link2.nextDep;
680
+ continue top;
681
+ }
682
+ dirty = false;
683
+ }
684
+ return dirty;
685
+ } while (true);
686
+ }
687
+ function shallowPropagate(link2) {
688
+ do {
689
+ const sub = link2.sub;
690
+ const nextSub = link2.nextSub;
691
+ const subFlags = sub.flags;
692
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
693
+ sub.flags = subFlags | 16 /* Dirty */;
694
+ }
695
+ link2 = nextSub;
696
+ } while (link2 !== void 0);
697
+ }
698
+ function isValidLink(checkLink, sub) {
699
+ const depsTail = sub.depsTail;
700
+ if (depsTail !== void 0) {
701
+ let link2 = sub.deps;
702
+ do {
703
+ if (link2 === checkLink) {
704
+ return true;
879
705
  }
880
- for (let link = this.subs; link; link = link.prevSub) {
881
- if (link.sub.notify()) {
882
- ;
883
- link.sub.dep.notify();
884
- }
706
+ if (link2 === depsTail) {
707
+ break;
885
708
  }
886
- } finally {
887
- endBatch();
888
- }
709
+ link2 = link2.nextDep;
710
+ } while (link2 !== void 0);
889
711
  }
712
+ return false;
890
713
  }
891
- function addSub(link) {
892
- link.dep.sc++;
893
- if (link.sub.flags & 4) {
894
- const computed = link.dep.computed;
895
- if (computed && !link.dep.subs) {
896
- computed.flags |= 4 | 16;
897
- for (let l = computed.deps; l; l = l.nextDep) {
898
- addSub(l);
899
- }
714
+
715
+ const triggerEventInfos = [];
716
+ function onTrack(sub, debugInfo) {
717
+ if (sub.onTrack) {
718
+ sub.onTrack(
719
+ extend(
720
+ {
721
+ effect: sub
722
+ },
723
+ debugInfo
724
+ )
725
+ );
726
+ }
727
+ }
728
+ function onTrigger(sub) {
729
+ if (sub.onTrigger) {
730
+ const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
731
+ sub.onTrigger(
732
+ extend(
733
+ {
734
+ effect: sub
735
+ },
736
+ debugInfo
737
+ )
738
+ );
739
+ }
740
+ }
741
+ function setupOnTrigger(target) {
742
+ Object.defineProperty(target.prototype, "onTrigger", {
743
+ get() {
744
+ return this._onTrigger;
745
+ },
746
+ set(val) {
747
+ if (val && !this._onTrigger) setupFlagsHandler(this);
748
+ this._onTrigger = val;
900
749
  }
901
- const currentTail = link.dep.subs;
902
- if (currentTail !== link) {
903
- link.prevSub = currentTail;
904
- if (currentTail) currentTail.nextSub = link;
750
+ });
751
+ }
752
+ function setupFlagsHandler(target) {
753
+ target._flags = target.flags;
754
+ Object.defineProperty(target, "flags", {
755
+ get() {
756
+ return target._flags;
757
+ },
758
+ set(value) {
759
+ if (!(target._flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && !!(value & (ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
760
+ onTrigger(this);
761
+ }
762
+ target._flags = value;
905
763
  }
906
- if (link.dep.subsHead === void 0) {
907
- link.dep.subsHead = link;
764
+ });
765
+ }
766
+
767
+ class Dep {
768
+ constructor(map, key) {
769
+ this.map = map;
770
+ this.key = key;
771
+ this._subs = void 0;
772
+ this.subsTail = void 0;
773
+ this.flags = ReactiveFlags.None;
774
+ }
775
+ get subs() {
776
+ return this._subs;
777
+ }
778
+ set subs(value) {
779
+ this._subs = value;
780
+ if (value === void 0) {
781
+ this.map.delete(this.key);
908
782
  }
909
- link.dep.subs = link;
910
783
  }
911
784
  }
912
785
  const targetMap = /* @__PURE__ */ new WeakMap();
@@ -920,36 +793,34 @@ const ARRAY_ITERATE_KEY = Symbol(
920
793
  "Array iterate"
921
794
  );
922
795
  function track(target, type, key) {
923
- if (shouldTrack && activeSub) {
796
+ if (activeSub !== void 0) {
924
797
  let depsMap = targetMap.get(target);
925
798
  if (!depsMap) {
926
799
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
927
800
  }
928
801
  let dep = depsMap.get(key);
929
802
  if (!dep) {
930
- depsMap.set(key, dep = new Dep());
931
- dep.map = depsMap;
932
- dep.key = key;
803
+ depsMap.set(key, dep = new Dep(depsMap, key));
933
804
  }
934
805
  {
935
- dep.track({
806
+ onTrack(activeSub, {
936
807
  target,
937
808
  type,
938
809
  key
939
810
  });
940
811
  }
812
+ link(dep, activeSub);
941
813
  }
942
814
  }
943
815
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
944
816
  const depsMap = targetMap.get(target);
945
817
  if (!depsMap) {
946
- globalVersion++;
947
818
  return;
948
819
  }
949
820
  const run = (dep) => {
950
- if (dep) {
821
+ if (dep !== void 0 && dep.subs !== void 0) {
951
822
  {
952
- dep.trigger({
823
+ triggerEventInfos.push({
953
824
  target,
954
825
  type,
955
826
  key,
@@ -958,6 +829,11 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
958
829
  oldTarget
959
830
  });
960
831
  }
832
+ propagate(dep.subs);
833
+ shallowPropagate(dep.subs);
834
+ {
835
+ triggerEventInfos.pop();
836
+ }
961
837
  }
962
838
  };
963
839
  startBatch();
@@ -1178,11 +1054,11 @@ function searchProxy(self, method, args) {
1178
1054
  return res;
1179
1055
  }
1180
1056
  function noTracking(self, method, args = []) {
1181
- pauseTracking();
1182
1057
  startBatch();
1058
+ const prevSub = setActiveSub();
1183
1059
  const res = toRaw(self)[method].apply(self, args);
1060
+ setActiveSub(prevSub);
1184
1061
  endBatch();
1185
- resetTracking();
1186
1062
  return res;
1187
1063
  }
1188
1064
 
@@ -1228,14 +1104,18 @@ class BaseReactiveHandler {
1228
1104
  return hasOwnProperty;
1229
1105
  }
1230
1106
  }
1107
+ const wasRef = isRef(target);
1231
1108
  const res = Reflect.get(
1232
1109
  target,
1233
1110
  key,
1234
1111
  // if this is a proxy wrapping a ref, return methods using the raw ref
1235
1112
  // as receiver so that we don't have to call `toRaw` on the ref in all
1236
1113
  // its class methods
1237
- isRef(target) ? target : receiver
1114
+ wasRef ? target : receiver
1238
1115
  );
1116
+ if (wasRef && key !== "value") {
1117
+ return res;
1118
+ }
1239
1119
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1240
1120
  return res;
1241
1121
  }
@@ -1678,96 +1558,307 @@ function markRaw(value) {
1678
1558
  if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1679
1559
  def(value, "__v_skip", true);
1680
1560
  }
1681
- return value;
1682
- }
1683
- const toReactive = (value) => isObject(value) ? reactive(value) : value;
1684
- const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1685
-
1686
- function isRef(r) {
1687
- return r ? r["__v_isRef"] === true : false;
1688
- }
1689
- function unref(ref2) {
1690
- return isRef(ref2) ? ref2.value : ref2;
1691
- }
1692
- const shallowUnwrapHandlers = {
1693
- get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1694
- set: (target, key, value, receiver) => {
1695
- const oldValue = target[key];
1696
- if (isRef(oldValue) && !isRef(value)) {
1697
- oldValue.value = value;
1698
- return true;
1699
- } else {
1700
- return Reflect.set(target, key, value, receiver);
1561
+ return value;
1562
+ }
1563
+ const toReactive = (value) => isObject(value) ? reactive(value) : value;
1564
+ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1565
+
1566
+ function isRef(r) {
1567
+ return r ? r["__v_isRef"] === true : false;
1568
+ }
1569
+ function unref(ref2) {
1570
+ return isRef(ref2) ? ref2.value : ref2;
1571
+ }
1572
+ const shallowUnwrapHandlers = {
1573
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1574
+ set: (target, key, value, receiver) => {
1575
+ const oldValue = target[key];
1576
+ if (isRef(oldValue) && !isRef(value)) {
1577
+ oldValue.value = value;
1578
+ return true;
1579
+ } else {
1580
+ return Reflect.set(target, key, value, receiver);
1581
+ }
1582
+ }
1583
+ };
1584
+ function proxyRefs(objectWithRefs) {
1585
+ return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1586
+ }
1587
+
1588
+ class ReactiveEffect {
1589
+ constructor(fn) {
1590
+ this.deps = void 0;
1591
+ this.depsTail = void 0;
1592
+ this.subs = void 0;
1593
+ this.subsTail = void 0;
1594
+ this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
1595
+ /**
1596
+ * @internal
1597
+ */
1598
+ this.cleanups = [];
1599
+ /**
1600
+ * @internal
1601
+ */
1602
+ this.cleanupsLength = 0;
1603
+ if (fn !== void 0) {
1604
+ this.fn = fn;
1605
+ }
1606
+ if (activeEffectScope) {
1607
+ link(this, activeEffectScope);
1608
+ }
1609
+ }
1610
+ // @ts-expect-error
1611
+ fn() {
1612
+ }
1613
+ get active() {
1614
+ return !(this.flags & 1024);
1615
+ }
1616
+ pause() {
1617
+ this.flags |= 256;
1618
+ }
1619
+ resume() {
1620
+ const flags = this.flags &= -257;
1621
+ if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
1622
+ this.notify();
1623
+ }
1624
+ }
1625
+ notify() {
1626
+ if (!(this.flags & 256) && this.dirty) {
1627
+ this.run();
1628
+ }
1629
+ }
1630
+ run() {
1631
+ if (!this.active) {
1632
+ return this.fn();
1633
+ }
1634
+ cleanup(this);
1635
+ const prevSub = startTracking(this);
1636
+ try {
1637
+ return this.fn();
1638
+ } finally {
1639
+ endTracking(this, prevSub);
1640
+ const flags = this.flags;
1641
+ if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
1642
+ this.flags = flags & ~ReactiveFlags.Recursed;
1643
+ this.notify();
1644
+ }
1645
+ }
1646
+ }
1647
+ stop() {
1648
+ if (!this.active) {
1649
+ return;
1650
+ }
1651
+ this.flags = 1024;
1652
+ let dep = this.deps;
1653
+ while (dep !== void 0) {
1654
+ dep = unlink(dep, this);
1655
+ }
1656
+ const sub = this.subs;
1657
+ if (sub !== void 0) {
1658
+ unlink(sub);
1659
+ }
1660
+ cleanup(this);
1661
+ }
1662
+ get dirty() {
1663
+ const flags = this.flags;
1664
+ if (flags & ReactiveFlags.Dirty) {
1665
+ return true;
1666
+ }
1667
+ if (flags & ReactiveFlags.Pending) {
1668
+ if (checkDirty(this.deps, this)) {
1669
+ this.flags = flags | ReactiveFlags.Dirty;
1670
+ return true;
1671
+ } else {
1672
+ this.flags = flags & ~ReactiveFlags.Pending;
1673
+ }
1674
+ }
1675
+ return false;
1676
+ }
1677
+ }
1678
+ {
1679
+ setupOnTrigger(ReactiveEffect);
1680
+ }
1681
+ function cleanup(sub) {
1682
+ const l = sub.cleanupsLength;
1683
+ if (l) {
1684
+ for (let i = 0; i < l; i++) {
1685
+ sub.cleanups[i]();
1686
+ }
1687
+ sub.cleanupsLength = 0;
1688
+ }
1689
+ }
1690
+
1691
+ let activeEffectScope;
1692
+ class EffectScope {
1693
+ constructor(detached = false) {
1694
+ this.deps = void 0;
1695
+ this.depsTail = void 0;
1696
+ this.subs = void 0;
1697
+ this.subsTail = void 0;
1698
+ this.flags = 0;
1699
+ /**
1700
+ * @internal
1701
+ */
1702
+ this.cleanups = [];
1703
+ /**
1704
+ * @internal
1705
+ */
1706
+ this.cleanupsLength = 0;
1707
+ if (!detached && activeEffectScope) {
1708
+ link(this, activeEffectScope);
1709
+ }
1710
+ }
1711
+ get active() {
1712
+ return !(this.flags & 1024);
1713
+ }
1714
+ pause() {
1715
+ if (!(this.flags & 256)) {
1716
+ this.flags |= 256;
1717
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1718
+ const dep = link2.dep;
1719
+ if ("pause" in dep) {
1720
+ dep.pause();
1721
+ }
1722
+ }
1723
+ }
1724
+ }
1725
+ /**
1726
+ * Resumes the effect scope, including all child scopes and effects.
1727
+ */
1728
+ resume() {
1729
+ const flags = this.flags;
1730
+ if (flags & 256) {
1731
+ this.flags = flags & -257;
1732
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1733
+ const dep = link2.dep;
1734
+ if ("resume" in dep) {
1735
+ dep.resume();
1736
+ }
1737
+ }
1738
+ }
1739
+ }
1740
+ run(fn) {
1741
+ const prevSub = setActiveSub();
1742
+ const prevScope = activeEffectScope;
1743
+ try {
1744
+ activeEffectScope = this;
1745
+ return fn();
1746
+ } finally {
1747
+ activeEffectScope = prevScope;
1748
+ setActiveSub(prevSub);
1749
+ }
1750
+ }
1751
+ stop() {
1752
+ if (!this.active) {
1753
+ return;
1754
+ }
1755
+ this.flags = 1024;
1756
+ let dep = this.deps;
1757
+ while (dep !== void 0) {
1758
+ const node = dep.dep;
1759
+ if ("stop" in node) {
1760
+ dep = dep.nextDep;
1761
+ node.stop();
1762
+ } else {
1763
+ dep = unlink(dep, this);
1764
+ }
1701
1765
  }
1766
+ const sub = this.subs;
1767
+ if (sub !== void 0) {
1768
+ unlink(sub);
1769
+ }
1770
+ cleanup(this);
1771
+ }
1772
+ }
1773
+ function setCurrentScope(scope) {
1774
+ try {
1775
+ return activeEffectScope;
1776
+ } finally {
1777
+ activeEffectScope = scope;
1702
1778
  }
1703
- };
1704
- function proxyRefs(objectWithRefs) {
1705
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1706
1779
  }
1707
1780
 
1708
1781
  class ComputedRefImpl {
1709
- constructor(fn, setter, isSSR) {
1782
+ constructor(fn, setter) {
1710
1783
  this.fn = fn;
1711
1784
  this.setter = setter;
1712
1785
  /**
1713
1786
  * @internal
1714
1787
  */
1715
1788
  this._value = void 0;
1716
- /**
1717
- * @internal
1718
- */
1719
- this.dep = new Dep(this);
1720
- /**
1721
- * @internal
1722
- */
1723
- this.__v_isRef = true;
1724
- // TODO isolatedDeclarations "__v_isReadonly"
1725
- // A computed is also a subscriber that tracks other deps
1726
- /**
1727
- * @internal
1728
- */
1789
+ this.subs = void 0;
1790
+ this.subsTail = void 0;
1729
1791
  this.deps = void 0;
1730
- /**
1731
- * @internal
1732
- */
1733
1792
  this.depsTail = void 0;
1793
+ this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
1734
1794
  /**
1735
1795
  * @internal
1736
1796
  */
1737
- this.flags = 16;
1738
- /**
1739
- * @internal
1740
- */
1741
- this.globalVersion = globalVersion - 1;
1742
- /**
1743
- * @internal
1744
- */
1745
- this.next = void 0;
1746
- // for backwards compat
1747
- this.effect = this;
1797
+ this.__v_isRef = true;
1748
1798
  this["__v_isReadonly"] = !setter;
1749
- this.isSSR = isSSR;
1799
+ }
1800
+ // TODO isolatedDeclarations "__v_isReadonly"
1801
+ // for backwards compat
1802
+ get effect() {
1803
+ return this;
1804
+ }
1805
+ // for backwards compat
1806
+ get dep() {
1807
+ return this;
1750
1808
  }
1751
1809
  /**
1752
1810
  * @internal
1811
+ * for backwards compat
1753
1812
  */
1754
- notify() {
1755
- this.flags |= 16;
1756
- if (!(this.flags & 8) && // avoid infinite self recursion
1757
- activeSub !== this) {
1758
- batch(this, true);
1813
+ get _dirty() {
1814
+ const flags = this.flags;
1815
+ if (flags & ReactiveFlags.Dirty) {
1759
1816
  return true;
1760
1817
  }
1818
+ if (flags & ReactiveFlags.Pending) {
1819
+ if (checkDirty(this.deps, this)) {
1820
+ this.flags = flags | ReactiveFlags.Dirty;
1821
+ return true;
1822
+ } else {
1823
+ this.flags = flags & ~ReactiveFlags.Pending;
1824
+ }
1825
+ }
1826
+ return false;
1827
+ }
1828
+ /**
1829
+ * @internal
1830
+ * for backwards compat
1831
+ */
1832
+ set _dirty(v) {
1833
+ if (v) {
1834
+ this.flags |= ReactiveFlags.Dirty;
1835
+ } else {
1836
+ this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
1837
+ }
1761
1838
  }
1762
1839
  get value() {
1763
- const link = this.dep.track({
1764
- target: this,
1765
- type: "get",
1766
- key: "value"
1767
- }) ;
1768
- refreshComputed(this);
1769
- if (link) {
1770
- link.version = this.dep.version;
1840
+ const flags = this.flags;
1841
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
1842
+ if (this.update()) {
1843
+ const subs = this.subs;
1844
+ if (subs !== void 0) {
1845
+ shallowPropagate(subs);
1846
+ }
1847
+ }
1848
+ } else if (flags & ReactiveFlags.Pending) {
1849
+ this.flags = flags & ~ReactiveFlags.Pending;
1850
+ }
1851
+ if (activeSub !== void 0) {
1852
+ {
1853
+ onTrack(activeSub, {
1854
+ target: this,
1855
+ type: "get",
1856
+ key: "value"
1857
+ });
1858
+ }
1859
+ link(this, activeSub);
1860
+ } else if (activeEffectScope !== void 0) {
1861
+ link(this, activeEffectScope);
1771
1862
  }
1772
1863
  return this._value;
1773
1864
  }
@@ -1778,6 +1869,23 @@ class ComputedRefImpl {
1778
1869
  warn$2("Write operation failed: computed value is readonly");
1779
1870
  }
1780
1871
  }
1872
+ update() {
1873
+ const prevSub = startTracking(this);
1874
+ try {
1875
+ const oldValue = this._value;
1876
+ const newValue = this.fn(oldValue);
1877
+ if (hasChanged(oldValue, newValue)) {
1878
+ this._value = newValue;
1879
+ return true;
1880
+ }
1881
+ return false;
1882
+ } finally {
1883
+ endTracking(this, prevSub);
1884
+ }
1885
+ }
1886
+ }
1887
+ {
1888
+ setupOnTrigger(ComputedRefImpl);
1781
1889
  }
1782
1890
  function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1783
1891
  let getter;
@@ -1788,179 +1896,148 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1788
1896
  getter = getterOrOptions.get;
1789
1897
  setter = getterOrOptions.set;
1790
1898
  }
1791
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1899
+ const cRef = new ComputedRefImpl(getter, setter);
1792
1900
  return cRef;
1793
1901
  }
1794
1902
 
1795
1903
  const INITIAL_WATCHER_VALUE = {};
1796
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1797
1904
  let activeWatcher = void 0;
1798
1905
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1799
1906
  if (owner) {
1800
- let cleanups = cleanupMap.get(owner);
1801
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1802
- cleanups.push(cleanupFn);
1907
+ const { call } = owner.options;
1908
+ if (call) {
1909
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1910
+ } else {
1911
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1912
+ }
1803
1913
  } else if (!failSilently) {
1804
1914
  warn$2(
1805
1915
  `onWatcherCleanup() was called when there was no active watcher to associate with.`
1806
1916
  );
1807
1917
  }
1808
1918
  }
1809
- function watch$1(source, cb, options = EMPTY_OBJ) {
1810
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1811
- const warnInvalidSource = (s) => {
1812
- (options.onWarn || warn$2)(
1813
- `Invalid watch source: `,
1814
- s,
1815
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1816
- );
1817
- };
1818
- const reactiveGetter = (source2) => {
1819
- if (deep) return source2;
1820
- if (isShallow(source2) || deep === false || deep === 0)
1821
- return traverse(source2, 1);
1822
- return traverse(source2);
1823
- };
1824
- let effect;
1825
- let getter;
1826
- let cleanup;
1827
- let boundCleanup;
1828
- let forceTrigger = false;
1829
- let isMultiSource = false;
1830
- if (isRef(source)) {
1831
- getter = () => source.value;
1832
- forceTrigger = isShallow(source);
1833
- } else if (isReactive(source)) {
1834
- getter = () => reactiveGetter(source);
1835
- forceTrigger = true;
1836
- } else if (isArray(source)) {
1837
- isMultiSource = true;
1838
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1839
- getter = () => source.map((s) => {
1840
- if (isRef(s)) {
1841
- return s.value;
1842
- } else if (isReactive(s)) {
1843
- return reactiveGetter(s);
1844
- } else if (isFunction(s)) {
1845
- return call ? call(s, 2) : s();
1919
+ class WatcherEffect extends ReactiveEffect {
1920
+ constructor(source, cb, options = EMPTY_OBJ) {
1921
+ const { deep, once, call, onWarn } = options;
1922
+ let getter;
1923
+ let forceTrigger = false;
1924
+ let isMultiSource = false;
1925
+ if (isRef(source)) {
1926
+ getter = () => source.value;
1927
+ forceTrigger = isShallow(source);
1928
+ } else if (isReactive(source)) {
1929
+ getter = () => reactiveGetter(source, deep);
1930
+ forceTrigger = true;
1931
+ } else if (isArray(source)) {
1932
+ isMultiSource = true;
1933
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1934
+ getter = () => source.map((s) => {
1935
+ if (isRef(s)) {
1936
+ return s.value;
1937
+ } else if (isReactive(s)) {
1938
+ return reactiveGetter(s, deep);
1939
+ } else if (isFunction(s)) {
1940
+ return call ? call(s, 2) : s();
1941
+ } else {
1942
+ warnInvalidSource(s, onWarn);
1943
+ }
1944
+ });
1945
+ } else if (isFunction(source)) {
1946
+ if (cb) {
1947
+ getter = call ? () => call(source, 2) : source;
1846
1948
  } else {
1847
- warnInvalidSource(s);
1848
- }
1849
- });
1850
- } else if (isFunction(source)) {
1851
- if (cb) {
1852
- getter = call ? () => call(source, 2) : source;
1853
- } else {
1854
- getter = () => {
1855
- if (cleanup) {
1856
- pauseTracking();
1949
+ getter = () => {
1950
+ if (this.cleanupsLength) {
1951
+ const prevSub = setActiveSub();
1952
+ try {
1953
+ cleanup(this);
1954
+ } finally {
1955
+ setActiveSub(prevSub);
1956
+ }
1957
+ }
1958
+ const currentEffect = activeWatcher;
1959
+ activeWatcher = this;
1857
1960
  try {
1858
- cleanup();
1961
+ return call ? call(source, 3, [
1962
+ this.boundCleanup
1963
+ ]) : source(this.boundCleanup);
1859
1964
  } finally {
1860
- resetTracking();
1965
+ activeWatcher = currentEffect;
1861
1966
  }
1862
- }
1863
- const currentEffect = activeWatcher;
1864
- activeWatcher = effect;
1865
- try {
1866
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1867
- } finally {
1868
- activeWatcher = currentEffect;
1869
- }
1967
+ };
1968
+ }
1969
+ } else {
1970
+ getter = NOOP;
1971
+ warnInvalidSource(source, onWarn);
1972
+ }
1973
+ if (cb && deep) {
1974
+ const baseGetter = getter;
1975
+ const depth = deep === true ? Infinity : deep;
1976
+ getter = () => traverse(baseGetter(), depth);
1977
+ }
1978
+ super(getter);
1979
+ this.cb = cb;
1980
+ this.options = options;
1981
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
1982
+ this.forceTrigger = forceTrigger;
1983
+ this.isMultiSource = isMultiSource;
1984
+ if (once && cb) {
1985
+ const _cb = cb;
1986
+ cb = (...args) => {
1987
+ _cb(...args);
1988
+ this.stop();
1870
1989
  };
1871
1990
  }
1872
- } else {
1873
- getter = NOOP;
1874
- warnInvalidSource(source);
1875
- }
1876
- if (cb && deep) {
1877
- const baseGetter = getter;
1878
- const depth = deep === true ? Infinity : deep;
1879
- getter = () => traverse(baseGetter(), depth);
1880
- }
1881
- const scope = getCurrentScope();
1882
- const watchHandle = () => {
1883
- effect.stop();
1884
- if (scope && scope.active) {
1885
- remove(scope.effects, effect);
1991
+ this.cb = cb;
1992
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1993
+ {
1994
+ this.onTrack = options.onTrack;
1995
+ this.onTrigger = options.onTrigger;
1886
1996
  }
1887
- };
1888
- if (once && cb) {
1889
- const _cb = cb;
1890
- cb = (...args) => {
1891
- _cb(...args);
1892
- watchHandle();
1893
- };
1894
1997
  }
1895
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1896
- const job = (immediateFirstRun) => {
1897
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
1998
+ run(initialRun = false) {
1999
+ const oldValue = this.oldValue;
2000
+ const newValue = this.oldValue = super.run();
2001
+ if (!this.cb) {
1898
2002
  return;
1899
2003
  }
1900
- if (cb) {
1901
- const newValue = effect.run();
1902
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1903
- if (cleanup) {
1904
- cleanup();
1905
- }
1906
- const currentWatcher = activeWatcher;
1907
- activeWatcher = effect;
1908
- try {
1909
- const args = [
1910
- newValue,
1911
- // pass undefined as the old value when it's changed for the first time
1912
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1913
- boundCleanup
1914
- ];
1915
- oldValue = newValue;
1916
- call ? call(cb, 3, args) : (
1917
- // @ts-expect-error
1918
- cb(...args)
1919
- );
1920
- } finally {
1921
- activeWatcher = currentWatcher;
1922
- }
1923
- }
1924
- } else {
1925
- effect.run();
2004
+ const { immediate, deep, call } = this.options;
2005
+ if (initialRun && !immediate) {
2006
+ return;
1926
2007
  }
1927
- };
1928
- if (augmentJob) {
1929
- augmentJob(job);
1930
- }
1931
- effect = new ReactiveEffect(getter);
1932
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1933
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1934
- cleanup = effect.onStop = () => {
1935
- const cleanups = cleanupMap.get(effect);
1936
- if (cleanups) {
1937
- if (call) {
1938
- call(cleanups, 4);
1939
- } else {
1940
- for (const cleanup2 of cleanups) cleanup2();
2008
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2009
+ cleanup(this);
2010
+ const currentWatcher = activeWatcher;
2011
+ activeWatcher = this;
2012
+ try {
2013
+ const args = [
2014
+ newValue,
2015
+ // pass undefined as the old value when it's changed for the first time
2016
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2017
+ this.boundCleanup
2018
+ ];
2019
+ call ? call(this.cb, 3, args) : (
2020
+ // @ts-expect-error
2021
+ this.cb(...args)
2022
+ );
2023
+ } finally {
2024
+ activeWatcher = currentWatcher;
1941
2025
  }
1942
- cleanupMap.delete(effect);
1943
- }
1944
- };
1945
- {
1946
- effect.onTrack = options.onTrack;
1947
- effect.onTrigger = options.onTrigger;
1948
- }
1949
- if (cb) {
1950
- if (immediate) {
1951
- job(true);
1952
- } else {
1953
- oldValue = effect.run();
1954
2026
  }
1955
- } else if (scheduler) {
1956
- scheduler(job.bind(null, true), true);
1957
- } else {
1958
- effect.run();
1959
2027
  }
1960
- watchHandle.pause = effect.pause.bind(effect);
1961
- watchHandle.resume = effect.resume.bind(effect);
1962
- watchHandle.stop = watchHandle;
1963
- return watchHandle;
2028
+ }
2029
+ function reactiveGetter(source, deep) {
2030
+ if (deep) return source;
2031
+ if (isShallow(source) || deep === false || deep === 0)
2032
+ return traverse(source, 1);
2033
+ return traverse(source);
2034
+ }
2035
+ function warnInvalidSource(s, onWarn) {
2036
+ (onWarn || warn$2)(
2037
+ `Invalid watch source: `,
2038
+ s,
2039
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2040
+ );
1964
2041
  }
1965
2042
  function traverse(value, depth = Infinity, seen) {
1966
2043
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -1996,8 +2073,8 @@ function traverse(value, depth = Infinity, seen) {
1996
2073
  }
1997
2074
 
1998
2075
  const stack = [];
1999
- function pushWarningContext$1(vnode) {
2000
- stack.push(vnode);
2076
+ function pushWarningContext$1(ctx) {
2077
+ stack.push(ctx);
2001
2078
  }
2002
2079
  function popWarningContext$1() {
2003
2080
  stack.pop();
@@ -2006,8 +2083,9 @@ let isWarning = false;
2006
2083
  function warn$1(msg, ...args) {
2007
2084
  if (isWarning) return;
2008
2085
  isWarning = true;
2009
- pauseTracking();
2010
- const instance = stack.length ? stack[stack.length - 1].component : null;
2086
+ const prevSub = setActiveSub();
2087
+ const entry = stack.length ? stack[stack.length - 1] : null;
2088
+ const instance = isVNode$2(entry) ? entry.component : entry;
2011
2089
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
2012
2090
  const trace = getComponentTrace();
2013
2091
  if (appWarnHandler) {
@@ -2021,9 +2099,9 @@ function warn$1(msg, ...args) {
2021
2099
  var _a, _b;
2022
2100
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
2023
2101
  }).join(""),
2024
- instance && instance.proxy,
2102
+ instance && instance.proxy || instance,
2025
2103
  trace.map(
2026
- ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
2104
+ ({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
2027
2105
  ).join("\n"),
2028
2106
  trace
2029
2107
  ]
@@ -2037,27 +2115,31 @@ function warn$1(msg, ...args) {
2037
2115
  }
2038
2116
  console.warn(...warnArgs);
2039
2117
  }
2040
- resetTracking();
2118
+ setActiveSub(prevSub);
2041
2119
  isWarning = false;
2042
2120
  }
2043
2121
  function getComponentTrace() {
2044
- let currentVNode = stack[stack.length - 1];
2045
- if (!currentVNode) {
2122
+ let currentCtx = stack[stack.length - 1];
2123
+ if (!currentCtx) {
2046
2124
  return [];
2047
2125
  }
2048
2126
  const normalizedStack = [];
2049
- while (currentVNode) {
2127
+ while (currentCtx) {
2050
2128
  const last = normalizedStack[0];
2051
- if (last && last.vnode === currentVNode) {
2129
+ if (last && last.ctx === currentCtx) {
2052
2130
  last.recurseCount++;
2053
2131
  } else {
2054
2132
  normalizedStack.push({
2055
- vnode: currentVNode,
2133
+ ctx: currentCtx,
2056
2134
  recurseCount: 0
2057
2135
  });
2058
2136
  }
2059
- const parentInstance = currentVNode.component && currentVNode.component.parent;
2060
- currentVNode = parentInstance && parentInstance.vnode;
2137
+ if (isVNode$2(currentCtx)) {
2138
+ const parent = currentCtx.component && currentCtx.component.parent;
2139
+ currentCtx = parent && parent.vnode || parent;
2140
+ } else {
2141
+ currentCtx = currentCtx.parent;
2142
+ }
2061
2143
  }
2062
2144
  return normalizedStack;
2063
2145
  }
@@ -2069,16 +2151,13 @@ function formatTrace(trace) {
2069
2151
  });
2070
2152
  return logs;
2071
2153
  }
2072
- function formatTraceEntry({ vnode, recurseCount }) {
2154
+ function formatTraceEntry({ ctx, recurseCount }) {
2073
2155
  const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
2074
- const isRoot = vnode.component ? vnode.component.parent == null : false;
2075
- const open = ` at <${formatComponentName(
2076
- vnode.component,
2077
- vnode.type,
2078
- isRoot
2079
- )}`;
2156
+ const instance = isVNode$2(ctx) ? ctx.component : ctx;
2157
+ const isRoot = instance ? instance.parent == null : false;
2158
+ const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
2080
2159
  const close = `>` + postfix;
2081
- return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
2160
+ return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
2082
2161
  }
2083
2162
  function formatProps(props) {
2084
2163
  const res = [];
@@ -2171,11 +2250,10 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
2171
2250
  }
2172
2251
  }
2173
2252
  function handleError(err, instance, type, throwInDev = true) {
2174
- const contextVNode = instance ? instance.vnode : null;
2175
2253
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
2176
2254
  if (instance) {
2177
2255
  let cur = instance.parent;
2178
- const exposedInstance = instance.proxy;
2256
+ const exposedInstance = instance.proxy || instance;
2179
2257
  const errorInfo = ErrorTypeStrings[type] ;
2180
2258
  while (cur) {
2181
2259
  const errorCapturedHooks = cur.ec;
@@ -2189,26 +2267,26 @@ function handleError(err, instance, type, throwInDev = true) {
2189
2267
  cur = cur.parent;
2190
2268
  }
2191
2269
  if (errorHandler) {
2192
- pauseTracking();
2270
+ const prevSub = setActiveSub();
2193
2271
  callWithErrorHandling(errorHandler, null, 10, [
2194
2272
  err,
2195
2273
  exposedInstance,
2196
2274
  errorInfo
2197
2275
  ]);
2198
- resetTracking();
2276
+ setActiveSub(prevSub);
2199
2277
  return;
2200
2278
  }
2201
2279
  }
2202
- logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
2280
+ logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
2203
2281
  }
2204
- function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
2282
+ function logError(err, type, instance, throwInDev = true, throwInProd = false) {
2205
2283
  {
2206
2284
  const info = ErrorTypeStrings[type];
2207
- if (contextVNode) {
2208
- pushWarningContext$1(contextVNode);
2285
+ if (instance) {
2286
+ pushWarningContext$1(instance);
2209
2287
  }
2210
2288
  warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
2211
- if (contextVNode) {
2289
+ if (instance) {
2212
2290
  popWarningContext$1();
2213
2291
  }
2214
2292
  if (throwInDev) {
@@ -2219,26 +2297,23 @@ function logError(err, type, contextVNode, throwInDev = true, throwInProd = fals
2219
2297
  }
2220
2298
  }
2221
2299
 
2222
- const queue = [];
2223
- let flushIndex = -1;
2224
- const pendingPostFlushCbs = [];
2225
- let activePostFlushCbs = null;
2300
+ const jobs = [];
2301
+ let postJobs = [];
2302
+ let activePostJobs = null;
2303
+ let currentFlushPromise = null;
2304
+ let jobsLength = 0;
2305
+ let flushIndex = 0;
2226
2306
  let postFlushIndex = 0;
2227
2307
  const resolvedPromise = /* @__PURE__ */ Promise.resolve();
2228
- let currentFlushPromise = null;
2229
2308
  const RECURSION_LIMIT = 100;
2230
2309
  function nextTick(fn) {
2231
2310
  const p = currentFlushPromise || resolvedPromise;
2232
2311
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2233
2312
  }
2234
- function findInsertionIndex(id) {
2235
- let start = flushIndex + 1;
2236
- let end = queue.length;
2313
+ function findInsertionIndex(order, queue, start, end) {
2237
2314
  while (start < end) {
2238
2315
  const middle = start + end >>> 1;
2239
- const middleJob = queue[middle];
2240
- const middleJobId = getId(middleJob);
2241
- if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
2316
+ if (queue[middle].order <= order) {
2242
2317
  start = middle + 1;
2243
2318
  } else {
2244
2319
  end = middle;
@@ -2246,130 +2321,168 @@ function findInsertionIndex(id) {
2246
2321
  }
2247
2322
  return start;
2248
2323
  }
2249
- function queueJob(job) {
2250
- if (!(job.flags & 1)) {
2251
- const jobId = getId(job);
2252
- const lastJob = queue[queue.length - 1];
2253
- if (!lastJob || // fast path when the job id is larger than the tail
2254
- !(job.flags & 2) && jobId >= getId(lastJob)) {
2255
- queue.push(job);
2324
+ function queueJob(job, id, isPre = false) {
2325
+ if (queueJobWorker(
2326
+ job,
2327
+ id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
2328
+ jobs,
2329
+ jobsLength,
2330
+ flushIndex
2331
+ )) {
2332
+ jobsLength++;
2333
+ queueFlush();
2334
+ }
2335
+ }
2336
+ function queueJobWorker(job, order, queue, length, flushIndex2) {
2337
+ const flags = job.flags;
2338
+ if (!(flags & 1)) {
2339
+ job.flags = flags | 1;
2340
+ job.order = order;
2341
+ if (flushIndex2 === length || // fast path when the job id is larger than the tail
2342
+ order >= queue[length - 1].order) {
2343
+ queue[length] = job;
2256
2344
  } else {
2257
- queue.splice(findInsertionIndex(jobId), 0, job);
2345
+ queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
2258
2346
  }
2259
- job.flags |= 1;
2260
- queueFlush();
2347
+ return true;
2261
2348
  }
2349
+ return false;
2262
2350
  }
2351
+ const doFlushJobs = () => {
2352
+ try {
2353
+ flushJobs();
2354
+ } catch (e) {
2355
+ currentFlushPromise = null;
2356
+ throw e;
2357
+ }
2358
+ };
2263
2359
  function queueFlush() {
2264
2360
  if (!currentFlushPromise) {
2265
- currentFlushPromise = resolvedPromise.then(flushJobs);
2361
+ currentFlushPromise = resolvedPromise.then(doFlushJobs);
2266
2362
  }
2267
2363
  }
2268
- function queuePostFlushCb(cb) {
2269
- if (!isArray(cb)) {
2270
- if (activePostFlushCbs && cb.id === -1) {
2271
- activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2272
- } else if (!(cb.flags & 1)) {
2273
- pendingPostFlushCbs.push(cb);
2274
- cb.flags |= 1;
2364
+ function queuePostFlushCb(jobs2, id = Infinity) {
2365
+ if (!isArray(jobs2)) {
2366
+ if (activePostJobs && id === -1) {
2367
+ activePostJobs.splice(postFlushIndex, 0, jobs2);
2368
+ } else {
2369
+ queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
2275
2370
  }
2276
2371
  } else {
2277
- pendingPostFlushCbs.push(...cb);
2372
+ for (const job of jobs2) {
2373
+ queueJobWorker(job, id, postJobs, postJobs.length, 0);
2374
+ }
2278
2375
  }
2279
2376
  queueFlush();
2280
2377
  }
2281
- function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2378
+ function flushPreFlushCbs(instance, seen) {
2282
2379
  {
2283
2380
  seen = seen || /* @__PURE__ */ new Map();
2284
2381
  }
2285
- for (; i < queue.length; i++) {
2286
- const cb = queue[i];
2287
- if (cb && cb.flags & 2) {
2288
- if (instance && cb.id !== instance.uid) {
2289
- continue;
2290
- }
2291
- if (checkRecursiveUpdates(seen, cb)) {
2292
- continue;
2293
- }
2294
- queue.splice(i, 1);
2295
- i--;
2296
- if (cb.flags & 4) {
2297
- cb.flags &= -2;
2298
- }
2299
- cb();
2300
- if (!(cb.flags & 4)) {
2301
- cb.flags &= -2;
2302
- }
2382
+ for (let i = flushIndex; i < jobsLength; i++) {
2383
+ const cb = jobs[i];
2384
+ if (cb.order & 1 || cb.order === Infinity) {
2385
+ continue;
2386
+ }
2387
+ if (instance && cb.order !== instance.uid * 2) {
2388
+ continue;
2389
+ }
2390
+ if (checkRecursiveUpdates(seen, cb)) {
2391
+ continue;
2392
+ }
2393
+ jobs.splice(i, 1);
2394
+ i--;
2395
+ jobsLength--;
2396
+ if (cb.flags & 2) {
2397
+ cb.flags &= -2;
2398
+ }
2399
+ cb();
2400
+ if (!(cb.flags & 2)) {
2401
+ cb.flags &= -2;
2303
2402
  }
2304
2403
  }
2305
2404
  }
2306
2405
  function flushPostFlushCbs(seen) {
2307
- if (pendingPostFlushCbs.length) {
2308
- const deduped = [...new Set(pendingPostFlushCbs)].sort(
2309
- (a, b) => getId(a) - getId(b)
2310
- );
2311
- pendingPostFlushCbs.length = 0;
2312
- if (activePostFlushCbs) {
2313
- activePostFlushCbs.push(...deduped);
2406
+ if (postJobs.length) {
2407
+ if (activePostJobs) {
2408
+ activePostJobs.push(...postJobs);
2409
+ postJobs.length = 0;
2314
2410
  return;
2315
2411
  }
2316
- activePostFlushCbs = deduped;
2412
+ activePostJobs = postJobs;
2413
+ postJobs = [];
2317
2414
  {
2318
2415
  seen = seen || /* @__PURE__ */ new Map();
2319
2416
  }
2320
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2321
- const cb = activePostFlushCbs[postFlushIndex];
2417
+ while (postFlushIndex < activePostJobs.length) {
2418
+ const cb = activePostJobs[postFlushIndex++];
2322
2419
  if (checkRecursiveUpdates(seen, cb)) {
2323
2420
  continue;
2324
2421
  }
2325
- if (cb.flags & 4) {
2422
+ if (cb.flags & 2) {
2326
2423
  cb.flags &= -2;
2327
2424
  }
2328
- if (!(cb.flags & 8)) cb();
2329
- cb.flags &= -2;
2425
+ if (!(cb.flags & 4)) {
2426
+ try {
2427
+ cb();
2428
+ } finally {
2429
+ cb.flags &= -2;
2430
+ }
2431
+ }
2330
2432
  }
2331
- activePostFlushCbs = null;
2433
+ activePostJobs = null;
2332
2434
  postFlushIndex = 0;
2333
2435
  }
2334
2436
  }
2335
- const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2437
+ let isFlushing = false;
2438
+ function flushOnAppMount() {
2439
+ if (!isFlushing) {
2440
+ isFlushing = true;
2441
+ flushPreFlushCbs();
2442
+ flushPostFlushCbs();
2443
+ isFlushing = false;
2444
+ }
2445
+ }
2336
2446
  function flushJobs(seen) {
2337
2447
  {
2338
- seen = seen || /* @__PURE__ */ new Map();
2448
+ seen || (seen = /* @__PURE__ */ new Map());
2339
2449
  }
2340
- const check = (job) => checkRecursiveUpdates(seen, job) ;
2341
2450
  try {
2342
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
2343
- const job = queue[flushIndex];
2344
- if (job && !(job.flags & 8)) {
2345
- if (check(job)) {
2451
+ while (flushIndex < jobsLength) {
2452
+ const job = jobs[flushIndex];
2453
+ jobs[flushIndex++] = void 0;
2454
+ if (!(job.flags & 4)) {
2455
+ if (checkRecursiveUpdates(seen, job)) {
2346
2456
  continue;
2347
2457
  }
2348
- if (job.flags & 4) {
2458
+ if (job.flags & 2) {
2349
2459
  job.flags &= ~1;
2350
2460
  }
2351
- callWithErrorHandling(
2352
- job,
2353
- job.i,
2354
- job.i ? 15 : 14
2355
- );
2356
- if (!(job.flags & 4)) {
2357
- job.flags &= ~1;
2461
+ try {
2462
+ job();
2463
+ } catch (err) {
2464
+ handleError(
2465
+ err,
2466
+ job.i,
2467
+ job.i ? 15 : 14
2468
+ );
2469
+ } finally {
2470
+ if (!(job.flags & 2)) {
2471
+ job.flags &= ~1;
2472
+ }
2358
2473
  }
2359
2474
  }
2360
2475
  }
2361
2476
  } finally {
2362
- for (; flushIndex < queue.length; flushIndex++) {
2363
- const job = queue[flushIndex];
2364
- if (job) {
2365
- job.flags &= -2;
2366
- }
2477
+ while (flushIndex < jobsLength) {
2478
+ jobs[flushIndex].flags &= -2;
2479
+ jobs[flushIndex++] = void 0;
2367
2480
  }
2368
- flushIndex = -1;
2369
- queue.length = 0;
2481
+ flushIndex = 0;
2482
+ jobsLength = 0;
2370
2483
  flushPostFlushCbs(seen);
2371
2484
  currentFlushPromise = null;
2372
- if (queue.length || pendingPostFlushCbs.length) {
2485
+ if (jobsLength || postJobs.length) {
2373
2486
  flushJobs(seen);
2374
2487
  }
2375
2488
  }
@@ -2436,10 +2549,17 @@ function rerender(id, newRender) {
2436
2549
  instance.render = newRender;
2437
2550
  normalizeClassComponent(instance.type).render = newRender;
2438
2551
  }
2439
- instance.renderCache = [];
2440
2552
  isHmrUpdating = true;
2441
- instance.update();
2442
- isHmrUpdating = false;
2553
+ if (instance.vapor) {
2554
+ instance.hmrRerender();
2555
+ } else {
2556
+ const i = instance;
2557
+ i.renderCache = [];
2558
+ i.effect.run();
2559
+ }
2560
+ nextTick(() => {
2561
+ isHmrUpdating = false;
2562
+ });
2443
2563
  });
2444
2564
  }
2445
2565
  function reload(id, newComp) {
@@ -2448,42 +2568,54 @@ function reload(id, newComp) {
2448
2568
  newComp = normalizeClassComponent(newComp);
2449
2569
  updateComponentDef(record.initialDef, newComp);
2450
2570
  const instances = [...record.instances];
2451
- for (let i = 0; i < instances.length; i++) {
2452
- const instance = instances[i];
2453
- const oldComp = normalizeClassComponent(instance.type);
2454
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2455
- if (!dirtyInstances) {
2456
- if (oldComp !== record.initialDef) {
2457
- updateComponentDef(oldComp, newComp);
2458
- }
2459
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2460
- }
2461
- dirtyInstances.add(instance);
2462
- instance.appContext.propsCache.delete(instance.type);
2463
- instance.appContext.emitsCache.delete(instance.type);
2464
- instance.appContext.optionsCache.delete(instance.type);
2465
- if (instance.ceReload) {
2571
+ if (newComp.vapor) {
2572
+ for (const instance of instances) {
2573
+ instance.hmrReload(newComp);
2574
+ }
2575
+ } else {
2576
+ for (const instance of instances) {
2577
+ const oldComp = normalizeClassComponent(instance.type);
2578
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2579
+ if (!dirtyInstances) {
2580
+ if (oldComp !== record.initialDef) {
2581
+ updateComponentDef(oldComp, newComp);
2582
+ }
2583
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2584
+ }
2466
2585
  dirtyInstances.add(instance);
2467
- instance.ceReload(newComp.styles);
2468
- dirtyInstances.delete(instance);
2469
- } else if (instance.parent) {
2470
- queueJob(() => {
2471
- isHmrUpdating = true;
2472
- instance.parent.update();
2473
- isHmrUpdating = false;
2586
+ instance.appContext.propsCache.delete(instance.type);
2587
+ instance.appContext.emitsCache.delete(instance.type);
2588
+ instance.appContext.optionsCache.delete(instance.type);
2589
+ if (instance.ceReload) {
2590
+ dirtyInstances.add(instance);
2591
+ instance.ceReload(newComp.styles);
2474
2592
  dirtyInstances.delete(instance);
2475
- });
2476
- } else if (instance.appContext.reload) {
2477
- instance.appContext.reload();
2478
- } else if (typeof window !== "undefined") {
2479
- window.location.reload();
2480
- } else {
2481
- console.warn(
2482
- "[HMR] Root or manually mounted instance modified. Full reload required."
2483
- );
2484
- }
2485
- if (instance.root.ce && instance !== instance.root) {
2486
- instance.root.ce._removeChildStyle(oldComp);
2593
+ } else if (instance.parent) {
2594
+ queueJob(() => {
2595
+ isHmrUpdating = true;
2596
+ const parent = instance.parent;
2597
+ if (parent.vapor) {
2598
+ parent.hmrRerender();
2599
+ } else {
2600
+ parent.effect.run();
2601
+ }
2602
+ nextTick(() => {
2603
+ isHmrUpdating = false;
2604
+ });
2605
+ dirtyInstances.delete(instance);
2606
+ });
2607
+ } else if (instance.appContext.reload) {
2608
+ instance.appContext.reload();
2609
+ } else if (typeof window !== "undefined") {
2610
+ window.location.reload();
2611
+ } else {
2612
+ console.warn(
2613
+ "[HMR] Root or manually mounted instance modified. Full reload required."
2614
+ );
2615
+ }
2616
+ if (instance.root.ce && instance !== instance.root) {
2617
+ instance.root.ce._removeChildStyle(oldComp);
2618
+ }
2487
2619
  }
2488
2620
  }
2489
2621
  queuePostFlushCb(() => {
@@ -2658,14 +2790,14 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2658
2790
  }
2659
2791
  let hook = binding.dir[name];
2660
2792
  if (hook) {
2661
- pauseTracking();
2793
+ const prevSub = setActiveSub();
2662
2794
  callWithAsyncErrorHandling(hook, instance, 8, [
2663
2795
  vnode.el,
2664
2796
  binding,
2665
2797
  vnode,
2666
2798
  prevVNode
2667
2799
  ]);
2668
- resetTracking();
2800
+ setActiveSub(prevSub);
2669
2801
  }
2670
2802
  }
2671
2803
  }
@@ -2785,8 +2917,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2785
2917
  }
2786
2918
  };
2787
2919
  if (value) {
2788
- doSet.id = -1;
2789
- queuePostRenderEffect(doSet, parentSuspense);
2920
+ queuePostRenderEffect(doSet, -1, parentSuspense);
2790
2921
  } else {
2791
2922
  doSet();
2792
2923
  }
@@ -2805,7 +2936,7 @@ function onActivated(hook, target) {
2805
2936
  function onDeactivated(hook, target) {
2806
2937
  registerKeepAliveHook(hook, "da", target);
2807
2938
  }
2808
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2939
+ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2809
2940
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2810
2941
  let current = target;
2811
2942
  while (current) {
@@ -2819,7 +2950,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
2819
2950
  injectHook(type, wrappedHook, target);
2820
2951
  if (target) {
2821
2952
  let current = target.parent;
2822
- while (current && current.parent) {
2953
+ while (current && current.parent && current.parent.vnode) {
2823
2954
  if (isKeepAlive(current.parent.vnode)) {
2824
2955
  injectToKeepAliveRoot(wrappedHook, type, target, current);
2825
2956
  }
@@ -2844,12 +2975,14 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2844
2975
  if (target) {
2845
2976
  const hooks = target[type] || (target[type] = []);
2846
2977
  const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2847
- pauseTracking();
2848
- const reset = setCurrentInstance(target);
2849
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2850
- reset();
2851
- resetTracking();
2852
- return res;
2978
+ const prevSub = setActiveSub();
2979
+ const prev = setCurrentInstance(target);
2980
+ try {
2981
+ return callWithAsyncErrorHandling(hook, target, type, args);
2982
+ } finally {
2983
+ setCurrentInstance(...prev);
2984
+ setActiveSub(prevSub);
2985
+ }
2853
2986
  });
2854
2987
  if (prepend) {
2855
2988
  hooks.unshift(wrappedHook);
@@ -2901,8 +3034,9 @@ function ensureValidVNode$1(vnodes) {
2901
3034
  }
2902
3035
 
2903
3036
  const getPublicInstance = (i) => {
2904
- if (!i) return null;
2905
- if (isStatefulComponent(i)) return getComponentPublicInstance(i);
3037
+ if (!i || i.vapor) return null;
3038
+ if (isStatefulComponent(i))
3039
+ return getComponentPublicInstance(i);
2906
3040
  return getPublicInstance(i.parent);
2907
3041
  };
2908
3042
  const publicPropertiesMap = (
@@ -3571,7 +3705,7 @@ function createAppContext() {
3571
3705
  };
3572
3706
  }
3573
3707
  let uid$1 = 0;
3574
- function createAppAPI(render, hydrate) {
3708
+ function createAppAPI(mount, unmount, getPublicInstance, render) {
3575
3709
  return function createApp(rootComponent, rootProps = null) {
3576
3710
  if (!isFunction(rootComponent)) {
3577
3711
  rootComponent = extend({}, rootComponent);
@@ -3664,31 +3798,15 @@ function createAppAPI(render, hydrate) {
3664
3798
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
3665
3799
  );
3666
3800
  }
3667
- const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
3668
- vnode.appContext = context;
3669
- if (namespace === true) {
3670
- namespace = "svg";
3671
- } else if (namespace === false) {
3672
- namespace = void 0;
3673
- }
3674
- {
3675
- context.reload = () => {
3676
- const cloned = cloneVNode(vnode);
3677
- cloned.el = null;
3678
- render(cloned, rootContainer, namespace);
3679
- };
3680
- }
3801
+ const instance = mount(app, rootContainer, isHydrate, namespace);
3681
3802
  {
3682
- render(vnode, rootContainer, namespace);
3803
+ app._instance = instance;
3804
+ devtoolsInitApp(app, version);
3683
3805
  }
3684
3806
  isMounted = true;
3685
3807
  app._container = rootContainer;
3686
3808
  rootContainer.__vue_app__ = app;
3687
- {
3688
- app._instance = vnode.component;
3689
- devtoolsInitApp(app, version);
3690
- }
3691
- return getComponentPublicInstance(vnode.component);
3809
+ return getPublicInstance(instance);
3692
3810
  } else {
3693
3811
  warn$1(
3694
3812
  `App has already been mounted.
@@ -3711,7 +3829,7 @@ If you want to remount the same app, move your app creation logic into a factory
3711
3829
  app._instance,
3712
3830
  16
3713
3831
  );
3714
- render(null, app._container);
3832
+ unmount(app);
3715
3833
  {
3716
3834
  app._instance = null;
3717
3835
  devtoolsUnmountApp(app);
@@ -3752,6 +3870,7 @@ If you want to remount the same app, move your app creation logic into a factory
3752
3870
  let currentApp = null;
3753
3871
 
3754
3872
  function provide(key, value) {
3873
+ const currentInstance = getCurrentGenericInstance();
3755
3874
  if (!currentInstance) {
3756
3875
  {
3757
3876
  warn$1(`provide() can only be used inside setup().`);
@@ -3766,9 +3885,9 @@ function provide(key, value) {
3766
3885
  }
3767
3886
  }
3768
3887
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
3769
- const instance = currentInstance || currentRenderingInstance;
3888
+ const instance = getCurrentGenericInstance();
3770
3889
  if (instance || currentApp) {
3771
- let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
3890
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
3772
3891
  if (provides && key in provides) {
3773
3892
  return provides[key];
3774
3893
  } else if (arguments.length > 1) {
@@ -3786,7 +3905,7 @@ const createInternalObject = () => Object.create(internalObjectProto);
3786
3905
  const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
3787
3906
 
3788
3907
  function initProps(instance, rawProps, isStateful, isSSR = false) {
3789
- const props = {};
3908
+ const props = instance.props = {};
3790
3909
  const attrs = createInternalObject();
3791
3910
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
3792
3911
  setFullProps(instance, rawProps, props, attrs);
@@ -3796,7 +3915,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
3796
3915
  }
3797
3916
  }
3798
3917
  {
3799
- validateProps(rawProps || {}, props, instance);
3918
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
3800
3919
  }
3801
3920
  if (isStateful) {
3802
3921
  instance.props = isSSR ? props : shallowReactive(props);
@@ -3848,11 +3967,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3848
3967
  const camelizedKey = camelize(key);
3849
3968
  props[camelizedKey] = resolvePropValue(
3850
3969
  options,
3851
- rawCurrentProps,
3852
3970
  camelizedKey,
3853
3971
  value,
3854
3972
  instance,
3855
- false
3973
+ baseResolveDefault
3856
3974
  );
3857
3975
  }
3858
3976
  } else {
@@ -3879,10 +3997,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3879
3997
  rawPrevProps[kebabKey] !== void 0)) {
3880
3998
  props[key] = resolvePropValue(
3881
3999
  options,
3882
- rawCurrentProps,
3883
4000
  key,
3884
4001
  void 0,
3885
4002
  instance,
4003
+ baseResolveDefault,
3886
4004
  true
3887
4005
  );
3888
4006
  }
@@ -3904,7 +4022,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3904
4022
  trigger(instance.attrs, "set", "");
3905
4023
  }
3906
4024
  {
3907
- validateProps(rawProps || {}, props, instance);
4025
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
3908
4026
  }
3909
4027
  }
3910
4028
  function setFullProps(instance, rawProps, props, attrs) {
@@ -3933,39 +4051,37 @@ function setFullProps(instance, rawProps, props, attrs) {
3933
4051
  }
3934
4052
  }
3935
4053
  if (needCastKeys) {
3936
- const rawCurrentProps = toRaw(props);
3937
4054
  const castValues = rawCastValues || EMPTY_OBJ;
3938
4055
  for (let i = 0; i < needCastKeys.length; i++) {
3939
4056
  const key = needCastKeys[i];
3940
4057
  props[key] = resolvePropValue(
3941
4058
  options,
3942
- rawCurrentProps,
3943
4059
  key,
3944
4060
  castValues[key],
3945
4061
  instance,
4062
+ baseResolveDefault,
3946
4063
  !hasOwn(castValues, key)
3947
4064
  );
3948
4065
  }
3949
4066
  }
3950
4067
  return hasAttrsChanged;
3951
4068
  }
3952
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
4069
+ function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
3953
4070
  const opt = options[key];
3954
4071
  if (opt != null) {
3955
4072
  const hasDefault = hasOwn(opt, "default");
3956
4073
  if (hasDefault && value === void 0) {
3957
4074
  const defaultValue = opt.default;
3958
4075
  if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
3959
- const { propsDefaults } = instance;
3960
- if (key in propsDefaults) {
3961
- value = propsDefaults[key];
4076
+ const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
4077
+ if (hasOwn(cachedDefaults, key)) {
4078
+ value = cachedDefaults[key];
3962
4079
  } else {
3963
- const reset = setCurrentInstance(instance);
3964
- value = propsDefaults[key] = defaultValue.call(
3965
- null,
3966
- props
4080
+ value = cachedDefaults[key] = resolveDefault(
4081
+ defaultValue,
4082
+ instance,
4083
+ key
3967
4084
  );
3968
- reset();
3969
4085
  }
3970
4086
  } else {
3971
4087
  value = defaultValue;
@@ -3984,6 +4100,17 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3984
4100
  }
3985
4101
  return value;
3986
4102
  }
4103
+ function baseResolveDefault(factory, instance, key) {
4104
+ let value;
4105
+ const prev = setCurrentInstance(instance);
4106
+ const props = toRaw(instance.props);
4107
+ value = factory.call(
4108
+ null,
4109
+ props
4110
+ );
4111
+ setCurrentInstance(...prev);
4112
+ return value;
4113
+ }
3987
4114
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
3988
4115
  function normalizePropsOptions(comp, appContext, asMixin = false) {
3989
4116
  const cache = asMixin ? mixinPropsCache : appContext.propsCache;
@@ -4018,6 +4145,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4018
4145
  }
4019
4146
  return EMPTY_ARR;
4020
4147
  }
4148
+ baseNormalizePropsOptions(raw, normalized, needCastKeys);
4149
+ const res = [normalized, needCastKeys];
4150
+ if (isObject(comp)) {
4151
+ cache.set(comp, res);
4152
+ }
4153
+ return res;
4154
+ }
4155
+ function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
4021
4156
  if (isArray(raw)) {
4022
4157
  for (let i = 0; i < raw.length; i++) {
4023
4158
  if (!isString(raw[i])) {
@@ -4062,11 +4197,6 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4062
4197
  }
4063
4198
  }
4064
4199
  }
4065
- const res = [normalized, needCastKeys];
4066
- if (isObject(comp)) {
4067
- cache.set(comp, res);
4068
- }
4069
- return res;
4070
4200
  }
4071
4201
  function validatePropName(key) {
4072
4202
  if (key[0] !== "$" && !isReservedProp(key)) {
@@ -4088,26 +4218,26 @@ function getType(ctor) {
4088
4218
  }
4089
4219
  return "";
4090
4220
  }
4091
- function validateProps(rawProps, props, instance) {
4092
- const resolvedValues = toRaw(props);
4093
- const options = instance.propsOptions[0];
4221
+ function validateProps(rawProps, resolvedProps, options) {
4222
+ resolvedProps = toRaw(resolvedProps);
4094
4223
  const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
4095
4224
  for (const key in options) {
4096
- let opt = options[key];
4097
- if (opt == null) continue;
4098
- validateProp(
4099
- key,
4100
- resolvedValues[key],
4101
- opt,
4102
- shallowReadonly(resolvedValues) ,
4103
- !camelizePropsKey.includes(key)
4104
- );
4225
+ const opt = options[key];
4226
+ if (opt != null) {
4227
+ validateProp(
4228
+ key,
4229
+ resolvedProps[key],
4230
+ opt,
4231
+ resolvedProps,
4232
+ !camelizePropsKey.includes(key)
4233
+ );
4234
+ }
4105
4235
  }
4106
4236
  }
4107
- function validateProp(name, value, prop, props, isAbsent) {
4108
- const { type, required, validator, skipCheck } = prop;
4237
+ function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
4238
+ const { type, required, validator, skipCheck } = propOptions;
4109
4239
  if (required && isAbsent) {
4110
- warn$1('Missing required prop: "' + name + '"');
4240
+ warn$1('Missing required prop: "' + key + '"');
4111
4241
  return;
4112
4242
  }
4113
4243
  if (value == null && !required) {
@@ -4123,12 +4253,12 @@ function validateProp(name, value, prop, props, isAbsent) {
4123
4253
  isValid = valid;
4124
4254
  }
4125
4255
  if (!isValid) {
4126
- warn$1(getInvalidTypeMessage(name, value, expectedTypes));
4256
+ warn$1(getInvalidTypeMessage(key, value, expectedTypes));
4127
4257
  return;
4128
4258
  }
4129
4259
  }
4130
- if (validator && !validator(value, props)) {
4131
- warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
4260
+ if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
4261
+ warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
4132
4262
  }
4133
4263
  }
4134
4264
  const isSimpleType = /* @__PURE__ */ makeMap(
@@ -4199,7 +4329,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
4199
4329
  return rawSlot;
4200
4330
  }
4201
4331
  const normalized = withCtx((...args) => {
4202
- if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
4332
+ if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
4203
4333
  warn$1(
4204
4334
  `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
4205
4335
  );
@@ -4296,12 +4426,15 @@ const updateSlots = (instance, children, optimized) => {
4296
4426
 
4297
4427
  let supported;
4298
4428
  let perf;
4429
+ let cachedNow$1 = 0;
4430
+ const p$1 = /* @__PURE__ */ Promise.resolve();
4431
+ const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
4299
4432
  function startMeasure(instance, type) {
4300
4433
  if (instance.appContext.config.performance && isSupported()) {
4301
4434
  perf.mark(`vue-${type}-${instance.uid}`);
4302
4435
  }
4303
4436
  {
4304
- devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
4437
+ devtoolsPerfStart(instance, type, getNow$1());
4305
4438
  }
4306
4439
  }
4307
4440
  function endMeasure(instance, type) {
@@ -4318,7 +4451,7 @@ function endMeasure(instance, type) {
4318
4451
  perf.clearMarks(endTag);
4319
4452
  }
4320
4453
  {
4321
- devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
4454
+ devtoolsPerfEnd(instance, type, getNow$1());
4322
4455
  }
4323
4456
  }
4324
4457
  function isSupported() {
@@ -4399,6 +4532,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4399
4532
  optimized
4400
4533
  );
4401
4534
  break;
4535
+ case VaporSlot:
4536
+ getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
4537
+ break;
4402
4538
  default:
4403
4539
  if (shapeFlag & 1) {
4404
4540
  processElement(
@@ -4611,11 +4747,15 @@ function baseCreateRenderer(options, createHydrationFns) {
4611
4747
  }
4612
4748
  hostInsert(el, container, anchor);
4613
4749
  if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
4614
- queuePostRenderEffect(() => {
4615
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4616
- needCallTransitionHooks && transition.enter(el);
4617
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4618
- }, parentSuspense);
4750
+ queuePostRenderEffect(
4751
+ () => {
4752
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4753
+ needCallTransitionHooks && transition.enter(el);
4754
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4755
+ },
4756
+ void 0,
4757
+ parentSuspense
4758
+ );
4619
4759
  }
4620
4760
  };
4621
4761
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
@@ -4627,8 +4767,8 @@ function baseCreateRenderer(options, createHydrationFns) {
4627
4767
  hostSetScopeId(el, slotScopeIds[i]);
4628
4768
  }
4629
4769
  }
4630
- if (parentComponent) {
4631
- let subTree = parentComponent.subTree;
4770
+ let subTree = parentComponent && parentComponent.subTree;
4771
+ if (subTree) {
4632
4772
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
4633
4773
  subTree = filterSingleRoot(subTree.children) || subTree;
4634
4774
  }
@@ -4745,10 +4885,14 @@ function baseCreateRenderer(options, createHydrationFns) {
4745
4885
  patchProps(el, oldProps, newProps, parentComponent, namespace);
4746
4886
  }
4747
4887
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
4748
- queuePostRenderEffect(() => {
4749
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4750
- dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4751
- }, parentSuspense);
4888
+ queuePostRenderEffect(
4889
+ () => {
4890
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4891
+ dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4892
+ },
4893
+ void 0,
4894
+ parentSuspense
4895
+ );
4752
4896
  }
4753
4897
  };
4754
4898
  const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
@@ -4876,7 +5020,22 @@ function baseCreateRenderer(options, createHydrationFns) {
4876
5020
  };
4877
5021
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4878
5022
  n2.slotScopeIds = slotScopeIds;
4879
- if (n1 == null) {
5023
+ if (n2.type.__vapor) {
5024
+ if (n1 == null) {
5025
+ getVaporInterface(parentComponent, n2).mount(
5026
+ n2,
5027
+ container,
5028
+ anchor,
5029
+ parentComponent
5030
+ );
5031
+ } else {
5032
+ getVaporInterface(parentComponent, n2).update(
5033
+ n1,
5034
+ n2,
5035
+ shouldUpdateComponent(n1, n2, optimized)
5036
+ );
5037
+ }
5038
+ } else if (n1 == null) {
4880
5039
  if (n2.shapeFlag & 512) {
4881
5040
  parentComponent.ctx.activate(
4882
5041
  n2,
@@ -4962,15 +5121,52 @@ function baseCreateRenderer(options, createHydrationFns) {
4962
5121
  return;
4963
5122
  } else {
4964
5123
  instance.next = n2;
4965
- instance.update();
5124
+ instance.effect.run();
4966
5125
  }
4967
5126
  } else {
4968
5127
  n2.el = n1.el;
4969
5128
  instance.vnode = n2;
4970
5129
  }
4971
5130
  };
4972
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
4973
- const componentUpdateFn = () => {
5131
+ class SetupRenderEffect extends ReactiveEffect {
5132
+ constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
5133
+ const prevScope = setCurrentScope(instance.scope);
5134
+ super();
5135
+ this.instance = instance;
5136
+ this.initialVNode = initialVNode;
5137
+ this.container = container;
5138
+ this.anchor = anchor;
5139
+ this.parentSuspense = parentSuspense;
5140
+ this.namespace = namespace;
5141
+ this.optimized = optimized;
5142
+ setCurrentScope(prevScope);
5143
+ this.job = instance.job = () => {
5144
+ if (this.dirty) {
5145
+ this.run();
5146
+ }
5147
+ };
5148
+ this.job.i = instance;
5149
+ {
5150
+ this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5151
+ this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5152
+ }
5153
+ }
5154
+ notify() {
5155
+ if (!(this.flags & 256)) {
5156
+ const job = this.job;
5157
+ queueJob(job, job.i.uid);
5158
+ }
5159
+ }
5160
+ fn() {
5161
+ const {
5162
+ instance,
5163
+ initialVNode,
5164
+ container,
5165
+ anchor,
5166
+ parentSuspense,
5167
+ namespace,
5168
+ optimized
5169
+ } = this;
4974
5170
  if (!instance.isMounted) {
4975
5171
  let vnodeHook;
4976
5172
  const { el, props } = initialVNode;
@@ -5014,23 +5210,24 @@ function baseCreateRenderer(options, createHydrationFns) {
5014
5210
  initialVNode.el = subTree.el;
5015
5211
  }
5016
5212
  if (m) {
5017
- queuePostRenderEffect(m, parentSuspense);
5213
+ queuePostRenderEffect(m, void 0, parentSuspense);
5018
5214
  }
5019
5215
  if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
5020
5216
  const scopedInitialVNode = initialVNode;
5021
5217
  queuePostRenderEffect(
5022
5218
  () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
5219
+ void 0,
5023
5220
  parentSuspense
5024
5221
  );
5025
5222
  }
5026
- if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
5027
- instance.a && queuePostRenderEffect(instance.a, parentSuspense);
5223
+ if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
5224
+ instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
5028
5225
  }
5029
5226
  instance.isMounted = true;
5030
5227
  {
5031
5228
  devtoolsComponentAdded(instance);
5032
5229
  }
5033
- initialVNode = container = anchor = null;
5230
+ this.initialVNode = this.container = this.anchor = null;
5034
5231
  } else {
5035
5232
  let { next, bu, u, parent, vnode } = instance;
5036
5233
  {
@@ -5042,7 +5239,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5042
5239
  }
5043
5240
  nonHydratedAsyncRoot.asyncDep.then(() => {
5044
5241
  if (!instance.isUnmounted) {
5045
- componentUpdateFn();
5242
+ this.fn();
5046
5243
  }
5047
5244
  });
5048
5245
  return;
@@ -5098,11 +5295,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5098
5295
  updateHOCHostEl(instance, nextTree.el);
5099
5296
  }
5100
5297
  if (u) {
5101
- queuePostRenderEffect(u, parentSuspense);
5298
+ queuePostRenderEffect(u, void 0, parentSuspense);
5102
5299
  }
5103
5300
  if (vnodeHook = next.props && next.props.onVnodeUpdated) {
5104
5301
  queuePostRenderEffect(
5105
5302
  () => invokeVNodeHook(vnodeHook, parent, next, vnode),
5303
+ void 0,
5106
5304
  parentSuspense
5107
5305
  );
5108
5306
  }
@@ -5113,21 +5311,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5113
5311
  popWarningContext$1();
5114
5312
  }
5115
5313
  }
5116
- };
5117
- instance.scope.on();
5118
- const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
5119
- instance.scope.off();
5120
- const update = instance.update = effect.run.bind(effect);
5121
- const job = instance.job = effect.runIfDirty.bind(effect);
5122
- job.i = instance;
5123
- job.id = instance.uid;
5124
- effect.scheduler = () => queueJob(job);
5125
- toggleRecurse(instance, true);
5126
- {
5127
- effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5128
- effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5129
5314
  }
5130
- update();
5315
+ }
5316
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
5317
+ const effect = instance.effect = new SetupRenderEffect(
5318
+ instance,
5319
+ initialVNode,
5320
+ container,
5321
+ anchor,
5322
+ parentSuspense,
5323
+ namespace,
5324
+ optimized
5325
+ );
5326
+ instance.update = effect.run.bind(effect);
5327
+ toggleRecurse(instance, true);
5328
+ effect.run();
5131
5329
  };
5132
5330
  const updateComponentPreRender = (instance, nextVNode, optimized) => {
5133
5331
  nextVNode.component = instance;
@@ -5136,9 +5334,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5136
5334
  instance.next = null;
5137
5335
  updateProps(instance, nextVNode.props, prevProps, optimized);
5138
5336
  updateSlots(instance, nextVNode.children, optimized);
5139
- pauseTracking();
5337
+ const prevSub = setActiveSub();
5140
5338
  flushPreFlushCbs(instance);
5141
- resetTracking();
5339
+ setActiveSub(prevSub);
5142
5340
  };
5143
5341
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5144
5342
  const c1 = n1 && n1.children;
@@ -5415,7 +5613,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5415
5613
  );
5416
5614
  } else if (moved) {
5417
5615
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
5418
- move(nextChild, container, anchor, 2);
5616
+ move(
5617
+ nextChild,
5618
+ container,
5619
+ anchor,
5620
+ 2,
5621
+ parentComponent
5622
+ );
5419
5623
  } else {
5420
5624
  j--;
5421
5625
  }
@@ -5423,10 +5627,20 @@ function baseCreateRenderer(options, createHydrationFns) {
5423
5627
  }
5424
5628
  }
5425
5629
  };
5426
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
5630
+ const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
5427
5631
  const { el, type, transition, children, shapeFlag } = vnode;
5428
5632
  if (shapeFlag & 6) {
5429
- move(vnode.component.subTree, container, anchor, moveType);
5633
+ if (type.__vapor) {
5634
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
5635
+ } else {
5636
+ move(
5637
+ vnode.component.subTree,
5638
+ container,
5639
+ anchor,
5640
+ moveType,
5641
+ parentComponent
5642
+ );
5643
+ }
5430
5644
  return;
5431
5645
  }
5432
5646
  if (shapeFlag & 128) {
@@ -5434,13 +5648,25 @@ function baseCreateRenderer(options, createHydrationFns) {
5434
5648
  return;
5435
5649
  }
5436
5650
  if (shapeFlag & 64) {
5437
- type.move(vnode, container, anchor, internals);
5651
+ type.move(
5652
+ vnode,
5653
+ container,
5654
+ anchor,
5655
+ internals,
5656
+ parentComponent
5657
+ );
5438
5658
  return;
5439
5659
  }
5440
5660
  if (type === Fragment) {
5441
5661
  hostInsert(el, container, anchor);
5442
5662
  for (let i = 0; i < children.length; i++) {
5443
- move(children[i], container, anchor, moveType);
5663
+ move(
5664
+ children[i],
5665
+ container,
5666
+ anchor,
5667
+ moveType,
5668
+ parentComponent
5669
+ );
5444
5670
  }
5445
5671
  hostInsert(vnode.anchor, container, anchor);
5446
5672
  return;
@@ -5454,7 +5680,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5454
5680
  if (moveType === 0) {
5455
5681
  transition.beforeEnter(el);
5456
5682
  hostInsert(el, container, anchor);
5457
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5683
+ queuePostRenderEffect(
5684
+ () => transition.enter(el),
5685
+ void 0,
5686
+ parentSuspense
5687
+ );
5458
5688
  } else {
5459
5689
  const { leave, delayLeave, afterLeave } = transition;
5460
5690
  const remove2 = () => {
@@ -5496,9 +5726,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5496
5726
  optimized = false;
5497
5727
  }
5498
5728
  if (ref != null) {
5499
- pauseTracking();
5729
+ const prevSub = setActiveSub();
5500
5730
  setRef(ref, null, parentSuspense, vnode, true);
5501
- resetTracking();
5731
+ setActiveSub(prevSub);
5502
5732
  }
5503
5733
  if (cacheIndex != null) {
5504
5734
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -5514,7 +5744,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5514
5744
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
5515
5745
  }
5516
5746
  if (shapeFlag & 6) {
5517
- unmountComponent(vnode.component, parentSuspense, doRemove);
5747
+ if (type.__vapor) {
5748
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
5749
+ return;
5750
+ } else {
5751
+ unmountComponent(vnode.component, parentSuspense, doRemove);
5752
+ }
5518
5753
  } else {
5519
5754
  if (shapeFlag & 128) {
5520
5755
  vnode.suspense.unmount(parentSuspense, doRemove);
@@ -5548,15 +5783,23 @@ function baseCreateRenderer(options, createHydrationFns) {
5548
5783
  } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
5549
5784
  unmountChildren(children, parentComponent, parentSuspense);
5550
5785
  }
5786
+ if (type === VaporSlot) {
5787
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
5788
+ return;
5789
+ }
5551
5790
  if (doRemove) {
5552
5791
  remove(vnode);
5553
5792
  }
5554
5793
  }
5555
5794
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5556
- queuePostRenderEffect(() => {
5557
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5558
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5559
- }, parentSuspense);
5795
+ queuePostRenderEffect(
5796
+ () => {
5797
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5798
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5799
+ },
5800
+ void 0,
5801
+ parentSuspense
5802
+ );
5560
5803
  }
5561
5804
  };
5562
5805
  const remove = (vnode) => {
@@ -5613,7 +5856,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5613
5856
  const {
5614
5857
  bum,
5615
5858
  scope,
5616
- job,
5859
+ effect,
5617
5860
  subTree,
5618
5861
  um,
5619
5862
  m,
@@ -5632,16 +5875,18 @@ function baseCreateRenderer(options, createHydrationFns) {
5632
5875
  });
5633
5876
  }
5634
5877
  scope.stop();
5635
- if (job) {
5636
- job.flags |= 8;
5878
+ if (effect) {
5879
+ effect.stop();
5637
5880
  unmount(subTree, instance, parentSuspense, doRemove);
5638
5881
  }
5639
5882
  if (um) {
5640
- queuePostRenderEffect(um, parentSuspense);
5883
+ queuePostRenderEffect(um, void 0, parentSuspense);
5641
5884
  }
5642
- queuePostRenderEffect(() => {
5643
- instance.isUnmounted = true;
5644
- }, parentSuspense);
5885
+ queuePostRenderEffect(
5886
+ () => instance.isUnmounted = true,
5887
+ void 0,
5888
+ parentSuspense
5889
+ );
5645
5890
  if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
5646
5891
  parentSuspense.deps--;
5647
5892
  if (parentSuspense.deps === 0) {
@@ -5659,6 +5904,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5659
5904
  };
5660
5905
  const getNextHostNode = (vnode) => {
5661
5906
  if (vnode.shapeFlag & 6) {
5907
+ if (vnode.type.__vapor) {
5908
+ return hostNextSibling(vnode.component.block);
5909
+ }
5662
5910
  return getNextHostNode(vnode.component.subTree);
5663
5911
  }
5664
5912
  if (vnode.shapeFlag & 128) {
@@ -5668,7 +5916,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5668
5916
  const teleportEnd = el && el[TeleportEndKey];
5669
5917
  return teleportEnd ? hostNextSibling(teleportEnd) : el;
5670
5918
  };
5671
- let isFlushing = false;
5672
5919
  const render = (vnode, container, namespace) => {
5673
5920
  if (vnode == null) {
5674
5921
  if (container._vnode) {
@@ -5686,12 +5933,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5686
5933
  );
5687
5934
  }
5688
5935
  container._vnode = vnode;
5689
- if (!isFlushing) {
5690
- isFlushing = true;
5691
- flushPreFlushCbs();
5692
- flushPostFlushCbs();
5693
- isFlushing = false;
5694
- }
5936
+ flushOnAppMount();
5695
5937
  };
5696
5938
  const internals = {
5697
5939
  p: patch,
@@ -5699,6 +5941,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5699
5941
  m: move,
5700
5942
  r: remove,
5701
5943
  mt: mountComponent,
5944
+ umt: unmountComponent,
5702
5945
  mc: mountChildren,
5703
5946
  pc: patchChildren,
5704
5947
  pbc: patchBlockChildren,
@@ -5706,22 +5949,51 @@ function baseCreateRenderer(options, createHydrationFns) {
5706
5949
  o: options
5707
5950
  };
5708
5951
  let hydrate;
5952
+ const mountApp = (app, container, isHydrate, namespace) => {
5953
+ const vnode = app._ceVNode || createVNode(app._component, app._props);
5954
+ vnode.appContext = app._context;
5955
+ if (namespace === true) {
5956
+ namespace = "svg";
5957
+ } else if (namespace === false) {
5958
+ namespace = void 0;
5959
+ }
5960
+ {
5961
+ app._context.reload = () => {
5962
+ const cloned = cloneVNode(vnode);
5963
+ cloned.el = null;
5964
+ render(cloned, container, namespace);
5965
+ };
5966
+ }
5967
+ {
5968
+ render(vnode, container, namespace);
5969
+ }
5970
+ return vnode.component;
5971
+ };
5972
+ const unmountApp = (app) => {
5973
+ render(null, app._container);
5974
+ };
5709
5975
  return {
5710
5976
  render,
5711
5977
  hydrate,
5712
- createApp: createAppAPI(render)
5978
+ internals,
5979
+ createApp: createAppAPI(
5980
+ mountApp,
5981
+ unmountApp,
5982
+ getComponentPublicInstance)
5713
5983
  };
5714
5984
  }
5715
5985
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
5716
5986
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5717
5987
  }
5718
- function toggleRecurse({ effect, job }, allowed) {
5719
- if (allowed) {
5720
- effect.flags |= 32;
5721
- job.flags |= 4;
5722
- } else {
5723
- effect.flags &= -33;
5724
- job.flags &= -5;
5988
+ function toggleRecurse({ effect, job, vapor }, allowed) {
5989
+ if (!vapor) {
5990
+ if (allowed) {
5991
+ effect.flags |= 128;
5992
+ job.flags |= 2;
5993
+ } else {
5994
+ effect.flags &= -129;
5995
+ job.flags &= -3;
5996
+ }
5725
5997
  }
5726
5998
  }
5727
5999
  function needTransition(parentSuspense, transition) {
@@ -5754,46 +6026,6 @@ function traverseStaticChildren(n1, n2, shallow = false) {
5754
6026
  }
5755
6027
  }
5756
6028
  }
5757
- function getSequence(arr) {
5758
- const p = arr.slice();
5759
- const result = [0];
5760
- let i, j, u, v, c;
5761
- const len = arr.length;
5762
- for (i = 0; i < len; i++) {
5763
- const arrI = arr[i];
5764
- if (arrI !== 0) {
5765
- j = result[result.length - 1];
5766
- if (arr[j] < arrI) {
5767
- p[i] = j;
5768
- result.push(i);
5769
- continue;
5770
- }
5771
- u = 0;
5772
- v = result.length - 1;
5773
- while (u < v) {
5774
- c = u + v >> 1;
5775
- if (arr[result[c]] < arrI) {
5776
- u = c + 1;
5777
- } else {
5778
- v = c;
5779
- }
5780
- }
5781
- if (arrI < arr[result[u]]) {
5782
- if (u > 0) {
5783
- p[i] = result[u - 1];
5784
- }
5785
- result[u] = i;
5786
- }
5787
- }
5788
- }
5789
- u = result.length;
5790
- v = result[u - 1];
5791
- while (u-- > 0) {
5792
- result[u] = v;
5793
- v = p[v];
5794
- }
5795
- return result;
5796
- }
5797
6029
  function locateNonHydratedAsyncRoot(instance) {
5798
6030
  const subComponent = instance.subTree.component;
5799
6031
  if (subComponent) {
@@ -5807,8 +6039,22 @@ function locateNonHydratedAsyncRoot(instance) {
5807
6039
  function invalidateMount(hooks) {
5808
6040
  if (hooks) {
5809
6041
  for (let i = 0; i < hooks.length; i++)
5810
- hooks[i].flags |= 8;
6042
+ hooks[i].flags |= 4;
6043
+ }
6044
+ }
6045
+ function getVaporInterface(instance, vnode) {
6046
+ const ctx = instance ? instance.appContext : vnode.appContext;
6047
+ const res = ctx && ctx.vapor;
6048
+ if (!res) {
6049
+ warn$1(
6050
+ `Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
6051
+ \`\`\`
6052
+ import { vaporInteropPlugin } from 'vue'
6053
+ app.use(vaporInteropPlugin)
6054
+ \`\`\``
6055
+ );
5811
6056
  }
6057
+ return res;
5812
6058
  }
5813
6059
 
5814
6060
  const ssrContextKey = Symbol.for("v-scx");
@@ -5832,8 +6078,41 @@ function watch(source, cb, options) {
5832
6078
  }
5833
6079
  return doWatch(source, cb, options);
5834
6080
  }
6081
+ class RenderWatcherEffect extends WatcherEffect {
6082
+ constructor(instance, source, cb, options, flush) {
6083
+ super(source, cb, options);
6084
+ this.flush = flush;
6085
+ const job = () => {
6086
+ if (this.dirty) {
6087
+ this.run();
6088
+ }
6089
+ };
6090
+ if (cb) {
6091
+ this.flags |= 128;
6092
+ job.flags |= 2;
6093
+ }
6094
+ if (instance) {
6095
+ job.i = instance;
6096
+ }
6097
+ this.job = job;
6098
+ }
6099
+ notify() {
6100
+ const flags = this.flags;
6101
+ if (!(flags & 256)) {
6102
+ const flush = this.flush;
6103
+ const job = this.job;
6104
+ if (flush === "post") {
6105
+ queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
6106
+ } else if (flush === "pre") {
6107
+ queueJob(job, job.i ? job.i.uid : void 0, true);
6108
+ } else {
6109
+ job();
6110
+ }
6111
+ }
6112
+ }
6113
+ }
5835
6114
  function doWatch(source, cb, options = EMPTY_OBJ) {
5836
- const { immediate, deep, flush, once } = options;
6115
+ const { immediate, deep, flush = "pre", once } = options;
5837
6116
  if (!cb) {
5838
6117
  if (immediate !== void 0) {
5839
6118
  warn$1(
@@ -5870,42 +6149,32 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
5870
6149
  }
5871
6150
  const instance = currentInstance;
5872
6151
  baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
5873
- let isPre = false;
5874
- if (flush === "post") {
5875
- baseWatchOptions.scheduler = (job) => {
5876
- queuePostRenderEffect(job, instance && instance.suspense);
5877
- };
5878
- } else if (flush !== "sync") {
5879
- isPre = true;
5880
- baseWatchOptions.scheduler = (job, isFirstRun) => {
5881
- if (isFirstRun) {
5882
- job();
5883
- } else {
5884
- queueJob(job);
5885
- }
5886
- };
6152
+ const effect = new RenderWatcherEffect(
6153
+ instance,
6154
+ source,
6155
+ cb,
6156
+ baseWatchOptions,
6157
+ flush
6158
+ );
6159
+ if (cb) {
6160
+ effect.run(true);
6161
+ } else if (flush === "post") {
6162
+ queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
6163
+ } else {
6164
+ effect.run(true);
5887
6165
  }
5888
- baseWatchOptions.augmentJob = (job) => {
5889
- if (cb) {
5890
- job.flags |= 4;
5891
- }
5892
- if (isPre) {
5893
- job.flags |= 2;
5894
- if (instance) {
5895
- job.id = instance.uid;
5896
- job.i = instance;
5897
- }
5898
- }
5899
- };
5900
- const watchHandle = watch$1(source, cb, baseWatchOptions);
6166
+ const stop = effect.stop.bind(effect);
6167
+ stop.pause = effect.pause.bind(effect);
6168
+ stop.resume = effect.resume.bind(effect);
6169
+ stop.stop = stop;
5901
6170
  if (isInSSRComponentSetup) {
5902
6171
  if (ssrCleanup) {
5903
- ssrCleanup.push(watchHandle);
6172
+ ssrCleanup.push(stop);
5904
6173
  } else if (runsImmediately) {
5905
- watchHandle();
6174
+ stop();
5906
6175
  }
5907
6176
  }
5908
- return watchHandle;
6177
+ return stop;
5909
6178
  }
5910
6179
  function instanceWatch(source, value, options) {
5911
6180
  const publicThis = this.proxy;
@@ -5917,9 +6186,9 @@ function instanceWatch(source, value, options) {
5917
6186
  cb = value.handler;
5918
6187
  options = value;
5919
6188
  }
5920
- const reset = setCurrentInstance(this);
6189
+ const prev = setCurrentInstance(this);
5921
6190
  const res = doWatch(getter, cb.bind(publicThis), options);
5922
- reset();
6191
+ setCurrentInstance(...prev);
5923
6192
  return res;
5924
6193
  }
5925
6194
  function createPathGetter(ctx, path) {
@@ -5933,21 +6202,26 @@ function createPathGetter(ctx, path) {
5933
6202
  };
5934
6203
  }
5935
6204
 
5936
- const getModelModifiers = (props, modelName) => {
5937
- return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
6205
+ const getModelModifiers = (props, modelName, getter) => {
6206
+ return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
5938
6207
  };
5939
6208
 
5940
6209
  function emit(instance, event, ...rawArgs) {
6210
+ return baseEmit(
6211
+ instance,
6212
+ instance.vnode.props || EMPTY_OBJ,
6213
+ defaultPropGetter,
6214
+ event,
6215
+ ...rawArgs
6216
+ );
6217
+ }
6218
+ function baseEmit(instance, props, getter, event, ...rawArgs) {
5941
6219
  if (instance.isUnmounted) return;
5942
- const props = instance.vnode.props || EMPTY_OBJ;
5943
6220
  {
5944
- const {
5945
- emitsOptions,
5946
- propsOptions: [propsOptions]
5947
- } = instance;
6221
+ const { emitsOptions, propsOptions } = instance;
5948
6222
  if (emitsOptions) {
5949
6223
  if (!(event in emitsOptions) && true) {
5950
- if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
6224
+ if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
5951
6225
  warn$1(
5952
6226
  `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
5953
6227
  );
@@ -5967,7 +6241,7 @@ function emit(instance, event, ...rawArgs) {
5967
6241
  }
5968
6242
  let args = rawArgs;
5969
6243
  const isModelListener = event.startsWith("update:");
5970
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
6244
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
5971
6245
  if (modifiers) {
5972
6246
  if (modifiers.trim) {
5973
6247
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -5981,7 +6255,7 @@ function emit(instance, event, ...rawArgs) {
5981
6255
  }
5982
6256
  {
5983
6257
  const lowerCaseEvent = event.toLowerCase();
5984
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
6258
+ if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
5985
6259
  warn$1(
5986
6260
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
5987
6261
  instance,
@@ -5993,10 +6267,10 @@ function emit(instance, event, ...rawArgs) {
5993
6267
  }
5994
6268
  }
5995
6269
  let handlerName;
5996
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
5997
- props[handlerName = toHandlerKey(camelize(event))];
6270
+ let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
6271
+ getter(props, handlerName = toHandlerKey(camelize(event)));
5998
6272
  if (!handler && isModelListener) {
5999
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
6273
+ handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
6000
6274
  }
6001
6275
  if (handler) {
6002
6276
  callWithAsyncErrorHandling(
@@ -6006,7 +6280,7 @@ function emit(instance, event, ...rawArgs) {
6006
6280
  args
6007
6281
  );
6008
6282
  }
6009
- const onceHandler = props[handlerName + `Once`];
6283
+ const onceHandler = getter(props, handlerName + `Once`);
6010
6284
  if (onceHandler) {
6011
6285
  if (!instance.emitted) {
6012
6286
  instance.emitted = {};
@@ -6022,6 +6296,9 @@ function emit(instance, event, ...rawArgs) {
6022
6296
  );
6023
6297
  }
6024
6298
  }
6299
+ function defaultPropGetter(props, key) {
6300
+ return props[key];
6301
+ }
6025
6302
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
6026
6303
  const cache = appContext.emitsCache;
6027
6304
  const cached = cache.get(comp);
@@ -6348,7 +6625,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
6348
6625
  return false;
6349
6626
  }
6350
6627
  function updateHOCHostEl({ vnode, parent }, el) {
6351
- while (parent) {
6628
+ while (parent && !parent.vapor) {
6352
6629
  const root = parent.subTree;
6353
6630
  if (root.suspense && root.suspense.activeBranch === vnode) {
6354
6631
  root.el = vnode.el;
@@ -6363,7 +6640,7 @@ function updateHOCHostEl({ vnode, parent }, el) {
6363
6640
  }
6364
6641
 
6365
6642
  const isSuspense = (type) => type.__isSuspense;
6366
- function queueEffectWithSuspense(fn, suspense) {
6643
+ function queueEffectWithSuspense(fn, id, suspense) {
6367
6644
  if (suspense && suspense.pendingBranch) {
6368
6645
  if (isArray(fn)) {
6369
6646
  suspense.effects.push(...fn);
@@ -6371,7 +6648,7 @@ function queueEffectWithSuspense(fn, suspense) {
6371
6648
  suspense.effects.push(fn);
6372
6649
  }
6373
6650
  } else {
6374
- queuePostFlushCb(fn);
6651
+ queuePostFlushCb(fn, id);
6375
6652
  }
6376
6653
  }
6377
6654
 
@@ -6379,6 +6656,7 @@ const Fragment = Symbol.for("v-fgt");
6379
6656
  const Text = Symbol.for("v-txt");
6380
6657
  const Comment = Symbol.for("v-cmt");
6381
6658
  const Static = Symbol.for("v-stc");
6659
+ const VaporSlot = Symbol.for("v-vps");
6382
6660
  let currentBlock = null;
6383
6661
  let isBlockTreeEnabled = 1;
6384
6662
  function setBlockTracking(value, inVOnce = false) {
@@ -6699,6 +6977,40 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
6699
6977
  ]);
6700
6978
  }
6701
6979
 
6980
+ let currentInstance = null;
6981
+ const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
6982
+ const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
6983
+ let isInSSRComponentSetup = false;
6984
+ let setInSSRSetupState;
6985
+ let simpleSetCurrentInstance;
6986
+ {
6987
+ const g = getGlobalThis();
6988
+ const registerGlobalSetter = (key, setter) => {
6989
+ let setters;
6990
+ if (!(setters = g[key])) setters = g[key] = [];
6991
+ setters.push(setter);
6992
+ return (v) => {
6993
+ if (setters.length > 1) setters.forEach((set) => set(v));
6994
+ else setters[0](v);
6995
+ };
6996
+ };
6997
+ simpleSetCurrentInstance = registerGlobalSetter(
6998
+ `__VUE_INSTANCE_SETTERS__`,
6999
+ (v) => currentInstance = v
7000
+ );
7001
+ setInSSRSetupState = registerGlobalSetter(
7002
+ `__VUE_SSR_SETTERS__`,
7003
+ (v) => isInSSRComponentSetup = v
7004
+ );
7005
+ }
7006
+ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
7007
+ try {
7008
+ return [currentInstance, setCurrentScope(scope)];
7009
+ } finally {
7010
+ simpleSetCurrentInstance(instance);
7011
+ }
7012
+ };
7013
+
6702
7014
  const emptyAppContext = createAppContext();
6703
7015
  let uid = 0;
6704
7016
  function createComponentInstance$1(vnode, parent, suspense) {
@@ -6743,7 +7055,7 @@ function createComponentInstance$1(vnode, parent, suspense) {
6743
7055
  // to be set immediately
6744
7056
  emitted: null,
6745
7057
  // props default value
6746
- propsDefaults: EMPTY_OBJ,
7058
+ propsDefaults: null,
6747
7059
  // inheritAttrs
6748
7060
  inheritAttrs: type.inheritAttrs,
6749
7061
  // state
@@ -6790,44 +7102,6 @@ function createComponentInstance$1(vnode, parent, suspense) {
6790
7102
  }
6791
7103
  return instance;
6792
7104
  }
6793
- let currentInstance = null;
6794
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
6795
- let internalSetCurrentInstance;
6796
- let setInSSRSetupState;
6797
- {
6798
- const g = getGlobalThis();
6799
- const registerGlobalSetter = (key, setter) => {
6800
- let setters;
6801
- if (!(setters = g[key])) setters = g[key] = [];
6802
- setters.push(setter);
6803
- return (v) => {
6804
- if (setters.length > 1) setters.forEach((set) => set(v));
6805
- else setters[0](v);
6806
- };
6807
- };
6808
- internalSetCurrentInstance = registerGlobalSetter(
6809
- `__VUE_INSTANCE_SETTERS__`,
6810
- (v) => currentInstance = v
6811
- );
6812
- setInSSRSetupState = registerGlobalSetter(
6813
- `__VUE_SSR_SETTERS__`,
6814
- (v) => isInSSRComponentSetup = v
6815
- );
6816
- }
6817
- const setCurrentInstance = (instance) => {
6818
- const prev = currentInstance;
6819
- internalSetCurrentInstance(instance);
6820
- instance.scope.on();
6821
- return () => {
6822
- instance.scope.off();
6823
- internalSetCurrentInstance(prev);
6824
- };
6825
- };
6826
- const unsetCurrentInstance = () => {
6827
- currentInstance && currentInstance.scope.off();
6828
- internalSetCurrentInstance(null);
6829
- };
6830
- const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
6831
7105
  function validateComponentName(name, { isNativeTag }) {
6832
7106
  if (isBuiltInTag(name) || isNativeTag(name)) {
6833
7107
  warn$1(
@@ -6838,13 +7112,16 @@ function validateComponentName(name, { isNativeTag }) {
6838
7112
  function isStatefulComponent(instance) {
6839
7113
  return instance.vnode.shapeFlag & 4;
6840
7114
  }
6841
- let isInSSRComponentSetup = false;
6842
7115
  function setupComponent$1(instance, isSSR = false, optimized = false) {
6843
7116
  isSSR && setInSSRSetupState(isSSR);
6844
- const { props, children } = instance.vnode;
7117
+ const { props, children, vi } = instance.vnode;
6845
7118
  const isStateful = isStatefulComponent(instance);
6846
- initProps(instance, props, isStateful, isSSR);
6847
- initSlots(instance, children, optimized || isSSR);
7119
+ if (vi) {
7120
+ vi(instance);
7121
+ } else {
7122
+ initProps(instance, props, isStateful, isSSR);
7123
+ initSlots(instance, children, optimized || isSSR);
7124
+ }
6848
7125
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
6849
7126
  isSSR && setInSSRSetupState(false);
6850
7127
  return setupResult;
@@ -6881,9 +7158,9 @@ function setupStatefulComponent(instance, isSSR) {
6881
7158
  }
6882
7159
  const { setup } = Component;
6883
7160
  if (setup) {
6884
- pauseTracking();
7161
+ const prevSub = setActiveSub();
6885
7162
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
6886
- const reset = setCurrentInstance(instance);
7163
+ const prev = setCurrentInstance(instance);
6887
7164
  const setupResult = callWithErrorHandling(
6888
7165
  setup,
6889
7166
  instance,
@@ -6894,12 +7171,15 @@ function setupStatefulComponent(instance, isSSR) {
6894
7171
  ]
6895
7172
  );
6896
7173
  const isAsyncSetup = isPromise(setupResult);
6897
- resetTracking();
6898
- reset();
7174
+ setActiveSub(prevSub);
7175
+ setCurrentInstance(...prev);
6899
7176
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
6900
7177
  markAsyncBoundary(instance);
6901
7178
  }
6902
7179
  if (isAsyncSetup) {
7180
+ const unsetCurrentInstance = () => {
7181
+ setCurrentInstance(null, void 0);
7182
+ };
6903
7183
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
6904
7184
  if (isSSR) {
6905
7185
  return setupResult.then((resolvedResult) => {
@@ -6957,13 +7237,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6957
7237
  instance.render = Component.render || NOOP;
6958
7238
  }
6959
7239
  {
6960
- const reset = setCurrentInstance(instance);
6961
- pauseTracking();
7240
+ const prevInstance = setCurrentInstance(instance);
7241
+ const prevSub = setActiveSub();
6962
7242
  try {
6963
7243
  applyOptions(instance);
6964
7244
  } finally {
6965
- resetTracking();
6966
- reset();
7245
+ setActiveSub(prevSub);
7246
+ setCurrentInstance(...prevInstance);
6967
7247
  }
6968
7248
  }
6969
7249
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -7000,29 +7280,6 @@ function getSlotsProxy(instance) {
7000
7280
  });
7001
7281
  }
7002
7282
  function createSetupContext(instance) {
7003
- const expose = (exposed) => {
7004
- {
7005
- if (instance.exposed) {
7006
- warn$1(`expose() should be called only once per setup().`);
7007
- }
7008
- if (exposed != null) {
7009
- let exposedType = typeof exposed;
7010
- if (exposedType === "object") {
7011
- if (isArray(exposed)) {
7012
- exposedType = "array";
7013
- } else if (isRef(exposed)) {
7014
- exposedType = "ref";
7015
- }
7016
- }
7017
- if (exposedType !== "object") {
7018
- warn$1(
7019
- `expose() should be passed a plain object, received ${exposedType}.`
7020
- );
7021
- }
7022
- }
7023
- }
7024
- instance.exposed = exposed || {};
7025
- };
7026
7283
  {
7027
7284
  let attrsProxy;
7028
7285
  let slotsProxy;
@@ -7036,10 +7293,33 @@ function createSetupContext(instance) {
7036
7293
  get emit() {
7037
7294
  return (event, ...args) => instance.emit(event, ...args);
7038
7295
  },
7039
- expose
7296
+ expose: (exposed) => expose(instance, exposed)
7040
7297
  });
7041
7298
  }
7042
7299
  }
7300
+ function expose(instance, exposed) {
7301
+ {
7302
+ if (instance.exposed) {
7303
+ warn$1(`expose() should be called only once per setup().`);
7304
+ }
7305
+ if (exposed != null) {
7306
+ let exposedType = typeof exposed;
7307
+ if (exposedType === "object") {
7308
+ if (isArray(exposed)) {
7309
+ exposedType = "array";
7310
+ } else if (isRef(exposed)) {
7311
+ exposedType = "ref";
7312
+ }
7313
+ }
7314
+ if (exposedType !== "object") {
7315
+ warn$1(
7316
+ `expose() should be passed a plain object, received ${exposedType}.`
7317
+ );
7318
+ }
7319
+ }
7320
+ }
7321
+ instance.exposed = exposed || {};
7322
+ }
7043
7323
  function getComponentPublicInstance(instance) {
7044
7324
  if (instance.exposed) {
7045
7325
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
@@ -7047,7 +7327,9 @@ function getComponentPublicInstance(instance) {
7047
7327
  if (key in target) {
7048
7328
  return target[key];
7049
7329
  } else if (key in publicPropertiesMap) {
7050
- return publicPropertiesMap[key](instance);
7330
+ return publicPropertiesMap[key](
7331
+ instance
7332
+ );
7051
7333
  }
7052
7334
  },
7053
7335
  has(target, key) {
@@ -7090,17 +7372,10 @@ function isClassComponent(value) {
7090
7372
  }
7091
7373
 
7092
7374
  const computed = (getterOrOptions, debugOptions) => {
7093
- const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
7094
- {
7095
- const i = getCurrentInstance();
7096
- if (i && i.appContext.config.warnRecursiveComputed) {
7097
- c._warnRecursive = true;
7098
- }
7099
- }
7100
- return c;
7375
+ return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
7101
7376
  };
7102
7377
 
7103
- const version = "3.5.17";
7378
+ const version = "3.6.0-alpha.1";
7104
7379
  const warn = warn$1 ;
7105
7380
  const _ssrUtils = {
7106
7381
  createComponentInstance: createComponentInstance$1,
@@ -7269,11 +7544,11 @@ function patchStyle(el, prev, next) {
7269
7544
  }
7270
7545
  const semicolonRE = /[^\\];\s*$/;
7271
7546
  const importantRE = /\s*!important$/;
7272
- function setStyle(style, name, val) {
7273
- if (isArray(val)) {
7274
- val.forEach((v) => setStyle(style, name, v));
7547
+ function setStyle(style, name, rawVal) {
7548
+ if (isArray(rawVal)) {
7549
+ rawVal.forEach((v) => setStyle(style, name, v));
7275
7550
  } else {
7276
- if (val == null) val = "";
7551
+ const val = rawVal == null ? "" : String(rawVal);
7277
7552
  {
7278
7553
  if (semicolonRE.test(val)) {
7279
7554
  warn(
@@ -7346,8 +7621,7 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
7346
7621
  return;
7347
7622
  }
7348
7623
  const tag = el.tagName;
7349
- if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
7350
- !tag.includes("-")) {
7624
+ if (key === "value" && canSetValueDirectly(tag)) {
7351
7625
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
7352
7626
  const newValue = value == null ? (
7353
7627
  // #11647: value should be set as empty string for null and undefined,
@@ -7475,8 +7749,6 @@ function patchStopImmediatePropagation(e, value) {
7475
7749
  }
7476
7750
  }
7477
7751
 
7478
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
7479
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
7480
7752
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
7481
7753
  const isSVG = namespace === "svg";
7482
7754
  if (key === "class") {
@@ -7516,24 +7788,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
7516
7788
  }
7517
7789
  return false;
7518
7790
  }
7519
- if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
7520
- return false;
7521
- }
7522
- if (key === "form") {
7523
- return false;
7524
- }
7525
- if (key === "list" && el.tagName === "INPUT") {
7526
- return false;
7527
- }
7528
- if (key === "type" && el.tagName === "TEXTAREA") {
7791
+ if (shouldSetAsAttr(el.tagName, key)) {
7529
7792
  return false;
7530
7793
  }
7531
- if (key === "width" || key === "height") {
7532
- const tag = el.tagName;
7533
- if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
7534
- return false;
7535
- }
7536
- }
7537
7794
  if (isNativeOn(key) && isString(value)) {
7538
7795
  return false;
7539
7796
  }
@@ -7721,9 +7978,23 @@ function ssrRenderStyle(raw) {
7721
7978
  if (isString(raw)) {
7722
7979
  return escapeHtml(raw);
7723
7980
  }
7724
- const styles = normalizeStyle(raw);
7981
+ const styles = normalizeStyle(ssrResetCssVars(raw));
7725
7982
  return escapeHtml(stringifyStyle(styles));
7726
7983
  }
7984
+ function ssrResetCssVars(raw) {
7985
+ if (!isArray(raw) && isObject(raw)) {
7986
+ const res = {};
7987
+ for (const key in raw) {
7988
+ if (key.startsWith(":--")) {
7989
+ res[key.slice(1)] = normalizeCssVarValue(raw[key]);
7990
+ } else {
7991
+ res[key] = raw[key];
7992
+ }
7993
+ }
7994
+ return res;
7995
+ }
7996
+ return raw;
7997
+ }
7727
7998
 
7728
7999
  function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
7729
8000
  return renderComponentVNode(