@vue/server-renderer 3.5.17 → 3.6.0-alpha.2

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.2
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,404 @@ 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)) {
680
- return;
681
- }
682
- computed.flags &= -17;
683
- if (computed.globalVersion === globalVersion) {
684
- return;
489
+ const prevSub = dep.subsTail;
490
+ const newLink = sub.depsTail = dep.subsTail = {
491
+ dep,
492
+ sub,
493
+ prevDep,
494
+ nextDep,
495
+ prevSub,
496
+ nextSub: void 0
497
+ };
498
+ if (nextDep !== void 0) {
499
+ nextDep.prevDep = newLink;
685
500
  }
686
- computed.globalVersion = globalVersion;
687
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
688
- return;
501
+ if (prevDep !== void 0) {
502
+ prevDep.nextDep = newLink;
503
+ } else {
504
+ sub.deps = newLink;
689
505
  }
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;
506
+ if (prevSub !== void 0) {
507
+ prevSub.nextSub = newLink;
508
+ } else {
509
+ dep.subs = newLink;
712
510
  }
713
511
  }
714
- function removeSub(link, soft = false) {
715
- const { dep, prevSub, nextSub } = link;
716
- if (prevSub) {
717
- prevSub.nextSub = nextSub;
718
- link.prevSub = void 0;
512
+ function unlink(link2, sub = link2.sub) {
513
+ const dep = link2.dep;
514
+ const prevDep = link2.prevDep;
515
+ const nextDep = link2.nextDep;
516
+ const nextSub = link2.nextSub;
517
+ const prevSub = link2.prevSub;
518
+ if (nextDep !== void 0) {
519
+ nextDep.prevDep = prevDep;
520
+ } else {
521
+ sub.depsTail = prevDep;
719
522
  }
720
- if (nextSub) {
721
- nextSub.prevSub = prevSub;
722
- link.nextSub = void 0;
523
+ if (prevDep !== void 0) {
524
+ prevDep.nextDep = nextDep;
525
+ } else {
526
+ sub.deps = nextDep;
723
527
  }
724
- if (dep.subsHead === link) {
725
- dep.subsHead = nextSub;
528
+ if (nextSub !== void 0) {
529
+ nextSub.prevSub = prevSub;
530
+ } else {
531
+ dep.subsTail = prevSub;
726
532
  }
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);
533
+ if (prevSub !== void 0) {
534
+ prevSub.nextSub = nextSub;
535
+ } else if ((dep.subs = nextSub) === void 0) {
536
+ let toRemove = dep.deps;
537
+ if (toRemove !== void 0) {
538
+ do {
539
+ toRemove = unlink(toRemove, dep);
540
+ } while (toRemove !== void 0);
541
+ dep.flags |= 16 /* Dirty */;
542
+ }
543
+ }
544
+ return nextDep;
545
+ }
546
+ function propagate(link2) {
547
+ let next = link2.nextSub;
548
+ let stack;
549
+ top: do {
550
+ const sub = link2.sub;
551
+ let flags = sub.flags;
552
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
553
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
554
+ sub.flags = flags | 32 /* Pending */;
555
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
556
+ flags = 0 /* None */;
557
+ } else if (!(flags & 4 /* RecursedCheck */)) {
558
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
559
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
560
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
561
+ flags &= 1 /* Mutable */;
562
+ } else {
563
+ flags = 0 /* None */;
564
+ }
565
+ if (flags & 2 /* Watching */) {
566
+ notifyBuffer[notifyBufferLength++] = sub;
567
+ }
568
+ if (flags & 1 /* Mutable */) {
569
+ const subSubs = sub.subs;
570
+ if (subSubs !== void 0) {
571
+ link2 = subSubs;
572
+ if (subSubs.nextSub !== void 0) {
573
+ stack = { value: next, prev: stack };
574
+ next = link2.nextSub;
575
+ }
576
+ continue;
577
+ }
733
578
  }
734
579
  }
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;
580
+ if ((link2 = next) !== void 0) {
581
+ next = link2.nextSub;
582
+ continue;
771
583
  }
772
- }
584
+ while (stack !== void 0) {
585
+ link2 = stack.value;
586
+ stack = stack.prev;
587
+ if (link2 !== void 0) {
588
+ next = link2.nextSub;
589
+ continue top;
590
+ }
591
+ }
592
+ break;
593
+ } while (true);
773
594
  }
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
- }
595
+ function startTracking(sub) {
596
+ sub.depsTail = void 0;
597
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
598
+ return setActiveSub(sub);
783
599
  }
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
- }
600
+ function endTracking(sub, prevSub) {
601
+ if (activeSub !== sub) {
602
+ warn$2(
603
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
604
+ );
813
605
  }
814
- track(debugInfo) {
815
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
816
- return;
606
+ activeSub = prevSub;
607
+ const depsTail = sub.depsTail;
608
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
609
+ while (toRemove !== void 0) {
610
+ toRemove = unlink(toRemove, sub);
611
+ }
612
+ sub.flags &= -5 /* RecursedCheck */;
613
+ }
614
+ function flush() {
615
+ while (notifyIndex < notifyBufferLength) {
616
+ const effect = notifyBuffer[notifyIndex];
617
+ notifyBuffer[notifyIndex++] = void 0;
618
+ effect.notify();
619
+ }
620
+ notifyIndex = 0;
621
+ notifyBufferLength = 0;
622
+ }
623
+ function checkDirty(link2, sub) {
624
+ let stack;
625
+ let checkDepth = 0;
626
+ top: do {
627
+ const dep = link2.dep;
628
+ const depFlags = dep.flags;
629
+ let dirty = false;
630
+ if (sub.flags & 16 /* Dirty */) {
631
+ dirty = true;
632
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
633
+ if (dep.update()) {
634
+ const subs = dep.subs;
635
+ if (subs.nextSub !== void 0) {
636
+ shallowPropagate(subs);
637
+ }
638
+ dirty = true;
639
+ }
640
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
641
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
642
+ stack = { value: link2, prev: stack };
643
+ }
644
+ link2 = dep.deps;
645
+ sub = dep;
646
+ ++checkDepth;
647
+ continue;
817
648
  }
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
- );
649
+ if (!dirty && link2.nextDep !== void 0) {
650
+ link2 = link2.nextDep;
651
+ continue;
855
652
  }
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
- );
653
+ while (checkDepth) {
654
+ --checkDepth;
655
+ const firstSub = sub.subs;
656
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
657
+ if (hasMultipleSubs) {
658
+ link2 = stack.value;
659
+ stack = stack.prev;
660
+ } else {
661
+ link2 = firstSub;
662
+ }
663
+ if (dirty) {
664
+ if (sub.update()) {
665
+ if (hasMultipleSubs) {
666
+ shallowPropagate(firstSub);
877
667
  }
668
+ sub = link2.sub;
669
+ continue;
878
670
  }
671
+ } else {
672
+ sub.flags &= -33 /* Pending */;
673
+ }
674
+ sub = link2.sub;
675
+ if (link2.nextDep !== void 0) {
676
+ link2 = link2.nextDep;
677
+ continue top;
678
+ }
679
+ dirty = false;
680
+ }
681
+ return dirty;
682
+ } while (true);
683
+ }
684
+ function shallowPropagate(link2) {
685
+ do {
686
+ const sub = link2.sub;
687
+ const nextSub = link2.nextSub;
688
+ const subFlags = sub.flags;
689
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
690
+ sub.flags = subFlags | 16 /* Dirty */;
691
+ }
692
+ link2 = nextSub;
693
+ } while (link2 !== void 0);
694
+ }
695
+ function isValidLink(checkLink, sub) {
696
+ const depsTail = sub.depsTail;
697
+ if (depsTail !== void 0) {
698
+ let link2 = sub.deps;
699
+ do {
700
+ if (link2 === checkLink) {
701
+ return true;
879
702
  }
880
- for (let link = this.subs; link; link = link.prevSub) {
881
- if (link.sub.notify()) {
882
- ;
883
- link.sub.dep.notify();
884
- }
703
+ if (link2 === depsTail) {
704
+ break;
885
705
  }
886
- } finally {
887
- endBatch();
888
- }
706
+ link2 = link2.nextDep;
707
+ } while (link2 !== void 0);
889
708
  }
709
+ return false;
890
710
  }
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
- }
711
+
712
+ const triggerEventInfos = [];
713
+ function onTrack(sub, debugInfo) {
714
+ if (sub.onTrack) {
715
+ sub.onTrack(
716
+ extend(
717
+ {
718
+ effect: sub
719
+ },
720
+ debugInfo
721
+ )
722
+ );
723
+ }
724
+ }
725
+ function onTrigger(sub) {
726
+ if (sub.onTrigger) {
727
+ const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
728
+ sub.onTrigger(
729
+ extend(
730
+ {
731
+ effect: sub
732
+ },
733
+ debugInfo
734
+ )
735
+ );
736
+ }
737
+ }
738
+ function setupOnTrigger(target) {
739
+ Object.defineProperty(target.prototype, "onTrigger", {
740
+ get() {
741
+ return this._onTrigger;
742
+ },
743
+ set(val) {
744
+ if (val && !this._onTrigger) setupFlagsHandler(this);
745
+ this._onTrigger = val;
900
746
  }
901
- const currentTail = link.dep.subs;
902
- if (currentTail !== link) {
903
- link.prevSub = currentTail;
904
- if (currentTail) currentTail.nextSub = link;
747
+ });
748
+ }
749
+ function setupFlagsHandler(target) {
750
+ target._flags = target.flags;
751
+ Object.defineProperty(target, "flags", {
752
+ get() {
753
+ return target._flags;
754
+ },
755
+ set(value) {
756
+ if (!(target._flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) && !!(value & (ReactiveFlags.Dirty | ReactiveFlags.Pending))) {
757
+ onTrigger(this);
758
+ }
759
+ target._flags = value;
905
760
  }
906
- if (link.dep.subsHead === void 0) {
907
- link.dep.subsHead = link;
761
+ });
762
+ }
763
+
764
+ class Dep {
765
+ constructor(map, key) {
766
+ this.map = map;
767
+ this.key = key;
768
+ this._subs = void 0;
769
+ this.subsTail = void 0;
770
+ this.flags = ReactiveFlags.None;
771
+ }
772
+ get subs() {
773
+ return this._subs;
774
+ }
775
+ set subs(value) {
776
+ this._subs = value;
777
+ if (value === void 0) {
778
+ this.map.delete(this.key);
908
779
  }
909
- link.dep.subs = link;
910
780
  }
911
781
  }
912
782
  const targetMap = /* @__PURE__ */ new WeakMap();
@@ -920,36 +790,34 @@ const ARRAY_ITERATE_KEY = Symbol(
920
790
  "Array iterate"
921
791
  );
922
792
  function track(target, type, key) {
923
- if (shouldTrack && activeSub) {
793
+ if (activeSub !== void 0) {
924
794
  let depsMap = targetMap.get(target);
925
795
  if (!depsMap) {
926
796
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
927
797
  }
928
798
  let dep = depsMap.get(key);
929
799
  if (!dep) {
930
- depsMap.set(key, dep = new Dep());
931
- dep.map = depsMap;
932
- dep.key = key;
800
+ depsMap.set(key, dep = new Dep(depsMap, key));
933
801
  }
934
802
  {
935
- dep.track({
803
+ onTrack(activeSub, {
936
804
  target,
937
805
  type,
938
806
  key
939
807
  });
940
808
  }
809
+ link(dep, activeSub);
941
810
  }
942
811
  }
943
812
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
944
813
  const depsMap = targetMap.get(target);
945
814
  if (!depsMap) {
946
- globalVersion++;
947
815
  return;
948
816
  }
949
817
  const run = (dep) => {
950
- if (dep) {
818
+ if (dep !== void 0 && dep.subs !== void 0) {
951
819
  {
952
- dep.trigger({
820
+ triggerEventInfos.push({
953
821
  target,
954
822
  type,
955
823
  key,
@@ -958,6 +826,11 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
958
826
  oldTarget
959
827
  });
960
828
  }
829
+ propagate(dep.subs);
830
+ shallowPropagate(dep.subs);
831
+ {
832
+ triggerEventInfos.pop();
833
+ }
961
834
  }
962
835
  };
963
836
  startBatch();
@@ -1178,11 +1051,11 @@ function searchProxy(self, method, args) {
1178
1051
  return res;
1179
1052
  }
1180
1053
  function noTracking(self, method, args = []) {
1181
- pauseTracking();
1182
1054
  startBatch();
1055
+ const prevSub = setActiveSub();
1183
1056
  const res = toRaw(self)[method].apply(self, args);
1057
+ setActiveSub(prevSub);
1184
1058
  endBatch();
1185
- resetTracking();
1186
1059
  return res;
1187
1060
  }
1188
1061
 
@@ -1228,14 +1101,18 @@ class BaseReactiveHandler {
1228
1101
  return hasOwnProperty;
1229
1102
  }
1230
1103
  }
1104
+ const wasRef = isRef(target);
1231
1105
  const res = Reflect.get(
1232
1106
  target,
1233
1107
  key,
1234
1108
  // if this is a proxy wrapping a ref, return methods using the raw ref
1235
1109
  // as receiver so that we don't have to call `toRaw` on the ref in all
1236
1110
  // its class methods
1237
- isRef(target) ? target : receiver
1111
+ wasRef ? target : receiver
1238
1112
  );
1113
+ if (wasRef && key !== "value") {
1114
+ return res;
1115
+ }
1239
1116
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1240
1117
  return res;
1241
1118
  }
@@ -1678,96 +1555,305 @@ function markRaw(value) {
1678
1555
  if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1679
1556
  def(value, "__v_skip", true);
1680
1557
  }
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);
1558
+ return value;
1559
+ }
1560
+ const toReactive = (value) => isObject(value) ? reactive(value) : value;
1561
+ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1562
+
1563
+ function isRef(r) {
1564
+ return r ? r["__v_isRef"] === true : false;
1565
+ }
1566
+ function unref(ref2) {
1567
+ return isRef(ref2) ? ref2.value : ref2;
1568
+ }
1569
+ const shallowUnwrapHandlers = {
1570
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1571
+ set: (target, key, value, receiver) => {
1572
+ const oldValue = target[key];
1573
+ if (isRef(oldValue) && !isRef(value)) {
1574
+ oldValue.value = value;
1575
+ return true;
1576
+ } else {
1577
+ return Reflect.set(target, key, value, receiver);
1578
+ }
1579
+ }
1580
+ };
1581
+ function proxyRefs(objectWithRefs) {
1582
+ return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1583
+ }
1584
+
1585
+ class ReactiveEffect {
1586
+ constructor(fn) {
1587
+ this.deps = void 0;
1588
+ this.depsTail = void 0;
1589
+ this.subs = void 0;
1590
+ this.subsTail = void 0;
1591
+ this.flags = ReactiveFlags.Watching | ReactiveFlags.Dirty;
1592
+ /**
1593
+ * @internal
1594
+ */
1595
+ this.cleanups = [];
1596
+ /**
1597
+ * @internal
1598
+ */
1599
+ this.cleanupsLength = 0;
1600
+ if (fn !== void 0) {
1601
+ this.fn = fn;
1602
+ }
1603
+ if (activeEffectScope) {
1604
+ link(this, activeEffectScope);
1605
+ }
1606
+ }
1607
+ // @ts-expect-error
1608
+ fn() {
1609
+ }
1610
+ get active() {
1611
+ return !(this.flags & 1024);
1612
+ }
1613
+ pause() {
1614
+ this.flags |= 256;
1615
+ }
1616
+ resume() {
1617
+ const flags = this.flags &= -257;
1618
+ if (flags & (ReactiveFlags.Dirty | ReactiveFlags.Pending)) {
1619
+ this.notify();
1620
+ }
1621
+ }
1622
+ notify() {
1623
+ if (!(this.flags & 256) && this.dirty) {
1624
+ this.run();
1625
+ }
1626
+ }
1627
+ run() {
1628
+ if (!this.active) {
1629
+ return this.fn();
1630
+ }
1631
+ cleanup(this);
1632
+ const prevSub = startTracking(this);
1633
+ try {
1634
+ return this.fn();
1635
+ } finally {
1636
+ endTracking(this, prevSub);
1637
+ const flags = this.flags;
1638
+ if ((flags & (ReactiveFlags.Recursed | 128)) === (ReactiveFlags.Recursed | 128)) {
1639
+ this.flags = flags & ~ReactiveFlags.Recursed;
1640
+ this.notify();
1641
+ }
1642
+ }
1643
+ }
1644
+ stop() {
1645
+ if (!this.active) {
1646
+ return;
1647
+ }
1648
+ this.flags = 1024;
1649
+ let dep = this.deps;
1650
+ while (dep !== void 0) {
1651
+ dep = unlink(dep, this);
1652
+ }
1653
+ const sub = this.subs;
1654
+ if (sub !== void 0) {
1655
+ unlink(sub);
1656
+ }
1657
+ cleanup(this);
1658
+ }
1659
+ get dirty() {
1660
+ const flags = this.flags;
1661
+ if (flags & ReactiveFlags.Dirty) {
1662
+ return true;
1663
+ }
1664
+ if (flags & ReactiveFlags.Pending) {
1665
+ if (checkDirty(this.deps, this)) {
1666
+ this.flags = flags | ReactiveFlags.Dirty;
1667
+ return true;
1668
+ } else {
1669
+ this.flags = flags & ~ReactiveFlags.Pending;
1670
+ }
1671
+ }
1672
+ return false;
1673
+ }
1674
+ }
1675
+ {
1676
+ setupOnTrigger(ReactiveEffect);
1677
+ }
1678
+ function cleanup(sub) {
1679
+ const l = sub.cleanupsLength;
1680
+ if (l) {
1681
+ for (let i = 0; i < l; i++) {
1682
+ sub.cleanups[i]();
1683
+ }
1684
+ sub.cleanupsLength = 0;
1685
+ }
1686
+ }
1687
+
1688
+ let activeEffectScope;
1689
+ class EffectScope {
1690
+ constructor(detached = false) {
1691
+ this.deps = void 0;
1692
+ this.depsTail = void 0;
1693
+ this.subs = void 0;
1694
+ this.subsTail = void 0;
1695
+ this.flags = 0;
1696
+ /**
1697
+ * @internal
1698
+ */
1699
+ this.cleanups = [];
1700
+ /**
1701
+ * @internal
1702
+ */
1703
+ this.cleanupsLength = 0;
1704
+ if (!detached && activeEffectScope) {
1705
+ link(this, activeEffectScope);
1706
+ }
1707
+ }
1708
+ get active() {
1709
+ return !(this.flags & 1024);
1710
+ }
1711
+ pause() {
1712
+ if (!(this.flags & 256)) {
1713
+ this.flags |= 256;
1714
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1715
+ const dep = link2.dep;
1716
+ if ("pause" in dep) {
1717
+ dep.pause();
1718
+ }
1719
+ }
1720
+ }
1721
+ }
1722
+ /**
1723
+ * Resumes the effect scope, including all child scopes and effects.
1724
+ */
1725
+ resume() {
1726
+ const flags = this.flags;
1727
+ if (flags & 256) {
1728
+ this.flags = flags & -257;
1729
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1730
+ const dep = link2.dep;
1731
+ if ("resume" in dep) {
1732
+ dep.resume();
1733
+ }
1734
+ }
1735
+ }
1736
+ }
1737
+ run(fn) {
1738
+ const prevScope = activeEffectScope;
1739
+ try {
1740
+ activeEffectScope = this;
1741
+ return fn();
1742
+ } finally {
1743
+ activeEffectScope = prevScope;
1744
+ }
1745
+ }
1746
+ stop() {
1747
+ if (!this.active) {
1748
+ return;
1749
+ }
1750
+ this.flags = 1024;
1751
+ let dep = this.deps;
1752
+ while (dep !== void 0) {
1753
+ const node = dep.dep;
1754
+ if ("stop" in node) {
1755
+ dep = dep.nextDep;
1756
+ node.stop();
1757
+ } else {
1758
+ dep = unlink(dep, this);
1759
+ }
1701
1760
  }
1761
+ const sub = this.subs;
1762
+ if (sub !== void 0) {
1763
+ unlink(sub);
1764
+ }
1765
+ cleanup(this);
1766
+ }
1767
+ }
1768
+ function setCurrentScope(scope) {
1769
+ try {
1770
+ return activeEffectScope;
1771
+ } finally {
1772
+ activeEffectScope = scope;
1702
1773
  }
1703
- };
1704
- function proxyRefs(objectWithRefs) {
1705
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1706
1774
  }
1707
1775
 
1708
1776
  class ComputedRefImpl {
1709
- constructor(fn, setter, isSSR) {
1777
+ constructor(fn, setter) {
1710
1778
  this.fn = fn;
1711
1779
  this.setter = setter;
1712
1780
  /**
1713
1781
  * @internal
1714
1782
  */
1715
1783
  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
- */
1784
+ this.subs = void 0;
1785
+ this.subsTail = void 0;
1729
1786
  this.deps = void 0;
1730
- /**
1731
- * @internal
1732
- */
1733
1787
  this.depsTail = void 0;
1788
+ this.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
1734
1789
  /**
1735
1790
  * @internal
1736
1791
  */
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;
1792
+ this.__v_isRef = true;
1748
1793
  this["__v_isReadonly"] = !setter;
1749
- this.isSSR = isSSR;
1794
+ }
1795
+ // TODO isolatedDeclarations "__v_isReadonly"
1796
+ // for backwards compat
1797
+ get effect() {
1798
+ return this;
1799
+ }
1800
+ // for backwards compat
1801
+ get dep() {
1802
+ return this;
1750
1803
  }
1751
1804
  /**
1752
1805
  * @internal
1806
+ * for backwards compat
1753
1807
  */
1754
- notify() {
1755
- this.flags |= 16;
1756
- if (!(this.flags & 8) && // avoid infinite self recursion
1757
- activeSub !== this) {
1758
- batch(this, true);
1808
+ get _dirty() {
1809
+ const flags = this.flags;
1810
+ if (flags & ReactiveFlags.Dirty) {
1759
1811
  return true;
1760
1812
  }
1813
+ if (flags & ReactiveFlags.Pending) {
1814
+ if (checkDirty(this.deps, this)) {
1815
+ this.flags = flags | ReactiveFlags.Dirty;
1816
+ return true;
1817
+ } else {
1818
+ this.flags = flags & ~ReactiveFlags.Pending;
1819
+ }
1820
+ }
1821
+ return false;
1822
+ }
1823
+ /**
1824
+ * @internal
1825
+ * for backwards compat
1826
+ */
1827
+ set _dirty(v) {
1828
+ if (v) {
1829
+ this.flags |= ReactiveFlags.Dirty;
1830
+ } else {
1831
+ this.flags &= ~(ReactiveFlags.Dirty | ReactiveFlags.Pending);
1832
+ }
1761
1833
  }
1762
1834
  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;
1835
+ const flags = this.flags;
1836
+ if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) {
1837
+ if (this.update()) {
1838
+ const subs = this.subs;
1839
+ if (subs !== void 0) {
1840
+ shallowPropagate(subs);
1841
+ }
1842
+ }
1843
+ } else if (flags & ReactiveFlags.Pending) {
1844
+ this.flags = flags & ~ReactiveFlags.Pending;
1845
+ }
1846
+ if (activeSub !== void 0) {
1847
+ {
1848
+ onTrack(activeSub, {
1849
+ target: this,
1850
+ type: "get",
1851
+ key: "value"
1852
+ });
1853
+ }
1854
+ link(this, activeSub);
1855
+ } else if (activeEffectScope !== void 0) {
1856
+ link(this, activeEffectScope);
1771
1857
  }
1772
1858
  return this._value;
1773
1859
  }
@@ -1778,6 +1864,23 @@ class ComputedRefImpl {
1778
1864
  warn$2("Write operation failed: computed value is readonly");
1779
1865
  }
1780
1866
  }
1867
+ update() {
1868
+ const prevSub = startTracking(this);
1869
+ try {
1870
+ const oldValue = this._value;
1871
+ const newValue = this.fn(oldValue);
1872
+ if (hasChanged(oldValue, newValue)) {
1873
+ this._value = newValue;
1874
+ return true;
1875
+ }
1876
+ return false;
1877
+ } finally {
1878
+ endTracking(this, prevSub);
1879
+ }
1880
+ }
1881
+ }
1882
+ {
1883
+ setupOnTrigger(ComputedRefImpl);
1781
1884
  }
1782
1885
  function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1783
1886
  let getter;
@@ -1788,179 +1891,148 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1788
1891
  getter = getterOrOptions.get;
1789
1892
  setter = getterOrOptions.set;
1790
1893
  }
1791
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1894
+ const cRef = new ComputedRefImpl(getter, setter);
1792
1895
  return cRef;
1793
1896
  }
1794
1897
 
1795
1898
  const INITIAL_WATCHER_VALUE = {};
1796
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1797
1899
  let activeWatcher = void 0;
1798
1900
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1799
1901
  if (owner) {
1800
- let cleanups = cleanupMap.get(owner);
1801
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1802
- cleanups.push(cleanupFn);
1902
+ const { call } = owner.options;
1903
+ if (call) {
1904
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1905
+ } else {
1906
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1907
+ }
1803
1908
  } else if (!failSilently) {
1804
1909
  warn$2(
1805
1910
  `onWatcherCleanup() was called when there was no active watcher to associate with.`
1806
1911
  );
1807
1912
  }
1808
1913
  }
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();
1914
+ class WatcherEffect extends ReactiveEffect {
1915
+ constructor(source, cb, options = EMPTY_OBJ) {
1916
+ const { deep, once, call, onWarn } = options;
1917
+ let getter;
1918
+ let forceTrigger = false;
1919
+ let isMultiSource = false;
1920
+ if (isRef(source)) {
1921
+ getter = () => source.value;
1922
+ forceTrigger = isShallow(source);
1923
+ } else if (isReactive(source)) {
1924
+ getter = () => reactiveGetter(source, deep);
1925
+ forceTrigger = true;
1926
+ } else if (isArray(source)) {
1927
+ isMultiSource = true;
1928
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1929
+ getter = () => source.map((s) => {
1930
+ if (isRef(s)) {
1931
+ return s.value;
1932
+ } else if (isReactive(s)) {
1933
+ return reactiveGetter(s, deep);
1934
+ } else if (isFunction(s)) {
1935
+ return call ? call(s, 2) : s();
1936
+ } else {
1937
+ warnInvalidSource(s, onWarn);
1938
+ }
1939
+ });
1940
+ } else if (isFunction(source)) {
1941
+ if (cb) {
1942
+ getter = call ? () => call(source, 2) : source;
1846
1943
  } 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();
1944
+ getter = () => {
1945
+ if (this.cleanupsLength) {
1946
+ const prevSub = setActiveSub();
1947
+ try {
1948
+ cleanup(this);
1949
+ } finally {
1950
+ setActiveSub(prevSub);
1951
+ }
1952
+ }
1953
+ const currentEffect = activeWatcher;
1954
+ activeWatcher = this;
1857
1955
  try {
1858
- cleanup();
1956
+ return call ? call(source, 3, [
1957
+ this.boundCleanup
1958
+ ]) : source(this.boundCleanup);
1859
1959
  } finally {
1860
- resetTracking();
1960
+ activeWatcher = currentEffect;
1861
1961
  }
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
- }
1962
+ };
1963
+ }
1964
+ } else {
1965
+ getter = NOOP;
1966
+ warnInvalidSource(source, onWarn);
1967
+ }
1968
+ if (cb && deep) {
1969
+ const baseGetter = getter;
1970
+ const depth = deep === true ? Infinity : deep;
1971
+ getter = () => traverse(baseGetter(), depth);
1972
+ }
1973
+ super(getter);
1974
+ this.cb = cb;
1975
+ this.options = options;
1976
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
1977
+ this.forceTrigger = forceTrigger;
1978
+ this.isMultiSource = isMultiSource;
1979
+ if (once && cb) {
1980
+ const _cb = cb;
1981
+ cb = (...args) => {
1982
+ _cb(...args);
1983
+ this.stop();
1870
1984
  };
1871
1985
  }
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);
1986
+ this.cb = cb;
1987
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1988
+ {
1989
+ this.onTrack = options.onTrack;
1990
+ this.onTrigger = options.onTrigger;
1886
1991
  }
1887
- };
1888
- if (once && cb) {
1889
- const _cb = cb;
1890
- cb = (...args) => {
1891
- _cb(...args);
1892
- watchHandle();
1893
- };
1894
1992
  }
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) {
1993
+ run(initialRun = false) {
1994
+ const oldValue = this.oldValue;
1995
+ const newValue = this.oldValue = super.run();
1996
+ if (!this.cb) {
1898
1997
  return;
1899
1998
  }
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();
1999
+ const { immediate, deep, call } = this.options;
2000
+ if (initialRun && !immediate) {
2001
+ return;
1926
2002
  }
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();
2003
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2004
+ cleanup(this);
2005
+ const currentWatcher = activeWatcher;
2006
+ activeWatcher = this;
2007
+ try {
2008
+ const args = [
2009
+ newValue,
2010
+ // pass undefined as the old value when it's changed for the first time
2011
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2012
+ this.boundCleanup
2013
+ ];
2014
+ call ? call(this.cb, 3, args) : (
2015
+ // @ts-expect-error
2016
+ this.cb(...args)
2017
+ );
2018
+ } finally {
2019
+ activeWatcher = currentWatcher;
1941
2020
  }
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
2021
  }
1955
- } else if (scheduler) {
1956
- scheduler(job.bind(null, true), true);
1957
- } else {
1958
- effect.run();
1959
2022
  }
1960
- watchHandle.pause = effect.pause.bind(effect);
1961
- watchHandle.resume = effect.resume.bind(effect);
1962
- watchHandle.stop = watchHandle;
1963
- return watchHandle;
2023
+ }
2024
+ function reactiveGetter(source, deep) {
2025
+ if (deep) return source;
2026
+ if (isShallow(source) || deep === false || deep === 0)
2027
+ return traverse(source, 1);
2028
+ return traverse(source);
2029
+ }
2030
+ function warnInvalidSource(s, onWarn) {
2031
+ (onWarn || warn$2)(
2032
+ `Invalid watch source: `,
2033
+ s,
2034
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2035
+ );
1964
2036
  }
1965
2037
  function traverse(value, depth = Infinity, seen) {
1966
2038
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -1996,8 +2068,8 @@ function traverse(value, depth = Infinity, seen) {
1996
2068
  }
1997
2069
 
1998
2070
  const stack = [];
1999
- function pushWarningContext$1(vnode) {
2000
- stack.push(vnode);
2071
+ function pushWarningContext$1(ctx) {
2072
+ stack.push(ctx);
2001
2073
  }
2002
2074
  function popWarningContext$1() {
2003
2075
  stack.pop();
@@ -2006,8 +2078,9 @@ let isWarning = false;
2006
2078
  function warn$1(msg, ...args) {
2007
2079
  if (isWarning) return;
2008
2080
  isWarning = true;
2009
- pauseTracking();
2010
- const instance = stack.length ? stack[stack.length - 1].component : null;
2081
+ const prevSub = setActiveSub();
2082
+ const entry = stack.length ? stack[stack.length - 1] : null;
2083
+ const instance = isVNode$2(entry) ? entry.component : entry;
2011
2084
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
2012
2085
  const trace = getComponentTrace();
2013
2086
  if (appWarnHandler) {
@@ -2021,9 +2094,9 @@ function warn$1(msg, ...args) {
2021
2094
  var _a, _b;
2022
2095
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
2023
2096
  }).join(""),
2024
- instance && instance.proxy,
2097
+ instance && instance.proxy || instance,
2025
2098
  trace.map(
2026
- ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
2099
+ ({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
2027
2100
  ).join("\n"),
2028
2101
  trace
2029
2102
  ]
@@ -2037,27 +2110,31 @@ function warn$1(msg, ...args) {
2037
2110
  }
2038
2111
  console.warn(...warnArgs);
2039
2112
  }
2040
- resetTracking();
2113
+ setActiveSub(prevSub);
2041
2114
  isWarning = false;
2042
2115
  }
2043
2116
  function getComponentTrace() {
2044
- let currentVNode = stack[stack.length - 1];
2045
- if (!currentVNode) {
2117
+ let currentCtx = stack[stack.length - 1];
2118
+ if (!currentCtx) {
2046
2119
  return [];
2047
2120
  }
2048
2121
  const normalizedStack = [];
2049
- while (currentVNode) {
2122
+ while (currentCtx) {
2050
2123
  const last = normalizedStack[0];
2051
- if (last && last.vnode === currentVNode) {
2124
+ if (last && last.ctx === currentCtx) {
2052
2125
  last.recurseCount++;
2053
2126
  } else {
2054
2127
  normalizedStack.push({
2055
- vnode: currentVNode,
2128
+ ctx: currentCtx,
2056
2129
  recurseCount: 0
2057
2130
  });
2058
2131
  }
2059
- const parentInstance = currentVNode.component && currentVNode.component.parent;
2060
- currentVNode = parentInstance && parentInstance.vnode;
2132
+ if (isVNode$2(currentCtx)) {
2133
+ const parent = currentCtx.component && currentCtx.component.parent;
2134
+ currentCtx = parent && parent.vnode || parent;
2135
+ } else {
2136
+ currentCtx = currentCtx.parent;
2137
+ }
2061
2138
  }
2062
2139
  return normalizedStack;
2063
2140
  }
@@ -2069,16 +2146,13 @@ function formatTrace(trace) {
2069
2146
  });
2070
2147
  return logs;
2071
2148
  }
2072
- function formatTraceEntry({ vnode, recurseCount }) {
2149
+ function formatTraceEntry({ ctx, recurseCount }) {
2073
2150
  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
- )}`;
2151
+ const instance = isVNode$2(ctx) ? ctx.component : ctx;
2152
+ const isRoot = instance ? instance.parent == null : false;
2153
+ const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
2080
2154
  const close = `>` + postfix;
2081
- return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
2155
+ return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
2082
2156
  }
2083
2157
  function formatProps(props) {
2084
2158
  const res = [];
@@ -2171,11 +2245,10 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
2171
2245
  }
2172
2246
  }
2173
2247
  function handleError(err, instance, type, throwInDev = true) {
2174
- const contextVNode = instance ? instance.vnode : null;
2175
2248
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
2176
2249
  if (instance) {
2177
2250
  let cur = instance.parent;
2178
- const exposedInstance = instance.proxy;
2251
+ const exposedInstance = instance.proxy || instance;
2179
2252
  const errorInfo = ErrorTypeStrings[type] ;
2180
2253
  while (cur) {
2181
2254
  const errorCapturedHooks = cur.ec;
@@ -2189,26 +2262,26 @@ function handleError(err, instance, type, throwInDev = true) {
2189
2262
  cur = cur.parent;
2190
2263
  }
2191
2264
  if (errorHandler) {
2192
- pauseTracking();
2265
+ const prevSub = setActiveSub();
2193
2266
  callWithErrorHandling(errorHandler, null, 10, [
2194
2267
  err,
2195
2268
  exposedInstance,
2196
2269
  errorInfo
2197
2270
  ]);
2198
- resetTracking();
2271
+ setActiveSub(prevSub);
2199
2272
  return;
2200
2273
  }
2201
2274
  }
2202
- logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
2275
+ logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
2203
2276
  }
2204
- function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
2277
+ function logError(err, type, instance, throwInDev = true, throwInProd = false) {
2205
2278
  {
2206
2279
  const info = ErrorTypeStrings[type];
2207
- if (contextVNode) {
2208
- pushWarningContext$1(contextVNode);
2280
+ if (instance) {
2281
+ pushWarningContext$1(instance);
2209
2282
  }
2210
2283
  warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
2211
- if (contextVNode) {
2284
+ if (instance) {
2212
2285
  popWarningContext$1();
2213
2286
  }
2214
2287
  if (throwInDev) {
@@ -2219,26 +2292,23 @@ function logError(err, type, contextVNode, throwInDev = true, throwInProd = fals
2219
2292
  }
2220
2293
  }
2221
2294
 
2222
- const queue = [];
2223
- let flushIndex = -1;
2224
- const pendingPostFlushCbs = [];
2225
- let activePostFlushCbs = null;
2295
+ const jobs = [];
2296
+ let postJobs = [];
2297
+ let activePostJobs = null;
2298
+ let currentFlushPromise = null;
2299
+ let jobsLength = 0;
2300
+ let flushIndex = 0;
2226
2301
  let postFlushIndex = 0;
2227
2302
  const resolvedPromise = /* @__PURE__ */ Promise.resolve();
2228
- let currentFlushPromise = null;
2229
2303
  const RECURSION_LIMIT = 100;
2230
2304
  function nextTick(fn) {
2231
2305
  const p = currentFlushPromise || resolvedPromise;
2232
2306
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
2233
2307
  }
2234
- function findInsertionIndex(id) {
2235
- let start = flushIndex + 1;
2236
- let end = queue.length;
2308
+ function findInsertionIndex(order, queue, start, end) {
2237
2309
  while (start < end) {
2238
2310
  const middle = start + end >>> 1;
2239
- const middleJob = queue[middle];
2240
- const middleJobId = getId(middleJob);
2241
- if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
2311
+ if (queue[middle].order <= order) {
2242
2312
  start = middle + 1;
2243
2313
  } else {
2244
2314
  end = middle;
@@ -2246,130 +2316,168 @@ function findInsertionIndex(id) {
2246
2316
  }
2247
2317
  return start;
2248
2318
  }
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);
2319
+ function queueJob(job, id, isPre = false) {
2320
+ if (queueJobWorker(
2321
+ job,
2322
+ id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1,
2323
+ jobs,
2324
+ jobsLength,
2325
+ flushIndex
2326
+ )) {
2327
+ jobsLength++;
2328
+ queueFlush();
2329
+ }
2330
+ }
2331
+ function queueJobWorker(job, order, queue, length, flushIndex2) {
2332
+ const flags = job.flags;
2333
+ if (!(flags & 1)) {
2334
+ job.flags = flags | 1;
2335
+ job.order = order;
2336
+ if (flushIndex2 === length || // fast path when the job id is larger than the tail
2337
+ order >= queue[length - 1].order) {
2338
+ queue[length] = job;
2256
2339
  } else {
2257
- queue.splice(findInsertionIndex(jobId), 0, job);
2340
+ queue.splice(findInsertionIndex(order, queue, flushIndex2, length), 0, job);
2258
2341
  }
2259
- job.flags |= 1;
2260
- queueFlush();
2342
+ return true;
2261
2343
  }
2344
+ return false;
2262
2345
  }
2346
+ const doFlushJobs = () => {
2347
+ try {
2348
+ flushJobs();
2349
+ } catch (e) {
2350
+ currentFlushPromise = null;
2351
+ throw e;
2352
+ }
2353
+ };
2263
2354
  function queueFlush() {
2264
2355
  if (!currentFlushPromise) {
2265
- currentFlushPromise = resolvedPromise.then(flushJobs);
2356
+ currentFlushPromise = resolvedPromise.then(doFlushJobs);
2266
2357
  }
2267
2358
  }
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;
2359
+ function queuePostFlushCb(jobs2, id = Infinity) {
2360
+ if (!isArray(jobs2)) {
2361
+ if (activePostJobs && id === -1) {
2362
+ activePostJobs.splice(postFlushIndex, 0, jobs2);
2363
+ } else {
2364
+ queueJobWorker(jobs2, id, postJobs, postJobs.length, 0);
2275
2365
  }
2276
2366
  } else {
2277
- pendingPostFlushCbs.push(...cb);
2367
+ for (const job of jobs2) {
2368
+ queueJobWorker(job, id, postJobs, postJobs.length, 0);
2369
+ }
2278
2370
  }
2279
2371
  queueFlush();
2280
2372
  }
2281
- function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2373
+ function flushPreFlushCbs(instance, seen) {
2282
2374
  {
2283
2375
  seen = seen || /* @__PURE__ */ new Map();
2284
2376
  }
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
- }
2377
+ for (let i = flushIndex; i < jobsLength; i++) {
2378
+ const cb = jobs[i];
2379
+ if (cb.order & 1 || cb.order === Infinity) {
2380
+ continue;
2381
+ }
2382
+ if (instance && cb.order !== instance.uid * 2) {
2383
+ continue;
2384
+ }
2385
+ if (checkRecursiveUpdates(seen, cb)) {
2386
+ continue;
2387
+ }
2388
+ jobs.splice(i, 1);
2389
+ i--;
2390
+ jobsLength--;
2391
+ if (cb.flags & 2) {
2392
+ cb.flags &= -2;
2393
+ }
2394
+ cb();
2395
+ if (!(cb.flags & 2)) {
2396
+ cb.flags &= -2;
2303
2397
  }
2304
2398
  }
2305
2399
  }
2306
2400
  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);
2401
+ if (postJobs.length) {
2402
+ if (activePostJobs) {
2403
+ activePostJobs.push(...postJobs);
2404
+ postJobs.length = 0;
2314
2405
  return;
2315
2406
  }
2316
- activePostFlushCbs = deduped;
2407
+ activePostJobs = postJobs;
2408
+ postJobs = [];
2317
2409
  {
2318
2410
  seen = seen || /* @__PURE__ */ new Map();
2319
2411
  }
2320
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
2321
- const cb = activePostFlushCbs[postFlushIndex];
2412
+ while (postFlushIndex < activePostJobs.length) {
2413
+ const cb = activePostJobs[postFlushIndex++];
2322
2414
  if (checkRecursiveUpdates(seen, cb)) {
2323
2415
  continue;
2324
2416
  }
2325
- if (cb.flags & 4) {
2417
+ if (cb.flags & 2) {
2326
2418
  cb.flags &= -2;
2327
2419
  }
2328
- if (!(cb.flags & 8)) cb();
2329
- cb.flags &= -2;
2420
+ if (!(cb.flags & 4)) {
2421
+ try {
2422
+ cb();
2423
+ } finally {
2424
+ cb.flags &= -2;
2425
+ }
2426
+ }
2330
2427
  }
2331
- activePostFlushCbs = null;
2428
+ activePostJobs = null;
2332
2429
  postFlushIndex = 0;
2333
2430
  }
2334
2431
  }
2335
- const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
2432
+ let isFlushing = false;
2433
+ function flushOnAppMount() {
2434
+ if (!isFlushing) {
2435
+ isFlushing = true;
2436
+ flushPreFlushCbs();
2437
+ flushPostFlushCbs();
2438
+ isFlushing = false;
2439
+ }
2440
+ }
2336
2441
  function flushJobs(seen) {
2337
2442
  {
2338
- seen = seen || /* @__PURE__ */ new Map();
2443
+ seen || (seen = /* @__PURE__ */ new Map());
2339
2444
  }
2340
- const check = (job) => checkRecursiveUpdates(seen, job) ;
2341
2445
  try {
2342
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
2343
- const job = queue[flushIndex];
2344
- if (job && !(job.flags & 8)) {
2345
- if (check(job)) {
2446
+ while (flushIndex < jobsLength) {
2447
+ const job = jobs[flushIndex];
2448
+ jobs[flushIndex++] = void 0;
2449
+ if (!(job.flags & 4)) {
2450
+ if (checkRecursiveUpdates(seen, job)) {
2346
2451
  continue;
2347
2452
  }
2348
- if (job.flags & 4) {
2453
+ if (job.flags & 2) {
2349
2454
  job.flags &= ~1;
2350
2455
  }
2351
- callWithErrorHandling(
2352
- job,
2353
- job.i,
2354
- job.i ? 15 : 14
2355
- );
2356
- if (!(job.flags & 4)) {
2357
- job.flags &= ~1;
2456
+ try {
2457
+ job();
2458
+ } catch (err) {
2459
+ handleError(
2460
+ err,
2461
+ job.i,
2462
+ job.i ? 15 : 14
2463
+ );
2464
+ } finally {
2465
+ if (!(job.flags & 2)) {
2466
+ job.flags &= ~1;
2467
+ }
2358
2468
  }
2359
2469
  }
2360
2470
  }
2361
2471
  } finally {
2362
- for (; flushIndex < queue.length; flushIndex++) {
2363
- const job = queue[flushIndex];
2364
- if (job) {
2365
- job.flags &= -2;
2366
- }
2472
+ while (flushIndex < jobsLength) {
2473
+ jobs[flushIndex].flags &= -2;
2474
+ jobs[flushIndex++] = void 0;
2367
2475
  }
2368
- flushIndex = -1;
2369
- queue.length = 0;
2476
+ flushIndex = 0;
2477
+ jobsLength = 0;
2370
2478
  flushPostFlushCbs(seen);
2371
2479
  currentFlushPromise = null;
2372
- if (queue.length || pendingPostFlushCbs.length) {
2480
+ if (jobsLength || postJobs.length) {
2373
2481
  flushJobs(seen);
2374
2482
  }
2375
2483
  }
@@ -2436,10 +2544,17 @@ function rerender(id, newRender) {
2436
2544
  instance.render = newRender;
2437
2545
  normalizeClassComponent(instance.type).render = newRender;
2438
2546
  }
2439
- instance.renderCache = [];
2440
2547
  isHmrUpdating = true;
2441
- instance.update();
2442
- isHmrUpdating = false;
2548
+ if (instance.vapor) {
2549
+ instance.hmrRerender();
2550
+ } else {
2551
+ const i = instance;
2552
+ i.renderCache = [];
2553
+ i.effect.run();
2554
+ }
2555
+ nextTick(() => {
2556
+ isHmrUpdating = false;
2557
+ });
2443
2558
  });
2444
2559
  }
2445
2560
  function reload(id, newComp) {
@@ -2448,42 +2563,54 @@ function reload(id, newComp) {
2448
2563
  newComp = normalizeClassComponent(newComp);
2449
2564
  updateComponentDef(record.initialDef, newComp);
2450
2565
  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) {
2566
+ if (newComp.__vapor) {
2567
+ for (const instance of instances) {
2568
+ instance.hmrReload(newComp);
2569
+ }
2570
+ } else {
2571
+ for (const instance of instances) {
2572
+ const oldComp = normalizeClassComponent(instance.type);
2573
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2574
+ if (!dirtyInstances) {
2575
+ if (oldComp !== record.initialDef) {
2576
+ updateComponentDef(oldComp, newComp);
2577
+ }
2578
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2579
+ }
2466
2580
  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;
2581
+ instance.appContext.propsCache.delete(instance.type);
2582
+ instance.appContext.emitsCache.delete(instance.type);
2583
+ instance.appContext.optionsCache.delete(instance.type);
2584
+ if (instance.ceReload) {
2585
+ dirtyInstances.add(instance);
2586
+ instance.ceReload(newComp.styles);
2474
2587
  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);
2588
+ } else if (instance.parent) {
2589
+ queueJob(() => {
2590
+ isHmrUpdating = true;
2591
+ const parent = instance.parent;
2592
+ if (parent.vapor) {
2593
+ parent.hmrRerender();
2594
+ } else {
2595
+ parent.effect.run();
2596
+ }
2597
+ nextTick(() => {
2598
+ isHmrUpdating = false;
2599
+ });
2600
+ dirtyInstances.delete(instance);
2601
+ });
2602
+ } else if (instance.appContext.reload) {
2603
+ instance.appContext.reload();
2604
+ } else if (typeof window !== "undefined") {
2605
+ window.location.reload();
2606
+ } else {
2607
+ console.warn(
2608
+ "[HMR] Root or manually mounted instance modified. Full reload required."
2609
+ );
2610
+ }
2611
+ if (instance.root.ce && instance !== instance.root) {
2612
+ instance.root.ce._removeChildStyle(oldComp);
2613
+ }
2487
2614
  }
2488
2615
  }
2489
2616
  queuePostFlushCb(() => {
@@ -2658,14 +2785,14 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2658
2785
  }
2659
2786
  let hook = binding.dir[name];
2660
2787
  if (hook) {
2661
- pauseTracking();
2788
+ const prevSub = setActiveSub();
2662
2789
  callWithAsyncErrorHandling(hook, instance, 8, [
2663
2790
  vnode.el,
2664
2791
  binding,
2665
2792
  vnode,
2666
2793
  prevVNode
2667
2794
  ]);
2668
- resetTracking();
2795
+ setActiveSub(prevSub);
2669
2796
  }
2670
2797
  }
2671
2798
  }
@@ -2785,8 +2912,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2785
2912
  }
2786
2913
  };
2787
2914
  if (value) {
2788
- doSet.id = -1;
2789
- queuePostRenderEffect(doSet, parentSuspense);
2915
+ queuePostRenderEffect(doSet, -1, parentSuspense);
2790
2916
  } else {
2791
2917
  doSet();
2792
2918
  }
@@ -2805,7 +2931,7 @@ function onActivated(hook, target) {
2805
2931
  function onDeactivated(hook, target) {
2806
2932
  registerKeepAliveHook(hook, "da", target);
2807
2933
  }
2808
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2934
+ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2809
2935
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2810
2936
  let current = target;
2811
2937
  while (current) {
@@ -2819,7 +2945,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
2819
2945
  injectHook(type, wrappedHook, target);
2820
2946
  if (target) {
2821
2947
  let current = target.parent;
2822
- while (current && current.parent) {
2948
+ while (current && current.parent && current.parent.vnode) {
2823
2949
  if (isKeepAlive(current.parent.vnode)) {
2824
2950
  injectToKeepAliveRoot(wrappedHook, type, target, current);
2825
2951
  }
@@ -2844,12 +2970,14 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2844
2970
  if (target) {
2845
2971
  const hooks = target[type] || (target[type] = []);
2846
2972
  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;
2973
+ const prevSub = setActiveSub();
2974
+ const prev = setCurrentInstance(target);
2975
+ try {
2976
+ return callWithAsyncErrorHandling(hook, target, type, args);
2977
+ } finally {
2978
+ setCurrentInstance(...prev);
2979
+ setActiveSub(prevSub);
2980
+ }
2853
2981
  });
2854
2982
  if (prepend) {
2855
2983
  hooks.unshift(wrappedHook);
@@ -2901,8 +3029,9 @@ function ensureValidVNode$1(vnodes) {
2901
3029
  }
2902
3030
 
2903
3031
  const getPublicInstance = (i) => {
2904
- if (!i) return null;
2905
- if (isStatefulComponent(i)) return getComponentPublicInstance(i);
3032
+ if (!i || i.vapor) return null;
3033
+ if (isStatefulComponent(i))
3034
+ return getComponentPublicInstance(i);
2906
3035
  return getPublicInstance(i.parent);
2907
3036
  };
2908
3037
  const publicPropertiesMap = (
@@ -3571,7 +3700,7 @@ function createAppContext() {
3571
3700
  };
3572
3701
  }
3573
3702
  let uid$1 = 0;
3574
- function createAppAPI(render, hydrate) {
3703
+ function createAppAPI(mount, unmount, getPublicInstance, render) {
3575
3704
  return function createApp(rootComponent, rootProps = null) {
3576
3705
  if (!isFunction(rootComponent)) {
3577
3706
  rootComponent = extend({}, rootComponent);
@@ -3664,31 +3793,15 @@ function createAppAPI(render, hydrate) {
3664
3793
  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
3794
  );
3666
3795
  }
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
- }
3796
+ const instance = mount(app, rootContainer, isHydrate, namespace);
3681
3797
  {
3682
- render(vnode, rootContainer, namespace);
3798
+ app._instance = instance;
3799
+ devtoolsInitApp(app, version);
3683
3800
  }
3684
3801
  isMounted = true;
3685
3802
  app._container = rootContainer;
3686
3803
  rootContainer.__vue_app__ = app;
3687
- {
3688
- app._instance = vnode.component;
3689
- devtoolsInitApp(app, version);
3690
- }
3691
- return getComponentPublicInstance(vnode.component);
3804
+ return getPublicInstance(instance);
3692
3805
  } else {
3693
3806
  warn$1(
3694
3807
  `App has already been mounted.
@@ -3711,7 +3824,7 @@ If you want to remount the same app, move your app creation logic into a factory
3711
3824
  app._instance,
3712
3825
  16
3713
3826
  );
3714
- render(null, app._container);
3827
+ unmount(app);
3715
3828
  {
3716
3829
  app._instance = null;
3717
3830
  devtoolsUnmountApp(app);
@@ -3752,6 +3865,7 @@ If you want to remount the same app, move your app creation logic into a factory
3752
3865
  let currentApp = null;
3753
3866
 
3754
3867
  function provide(key, value) {
3868
+ const currentInstance = getCurrentGenericInstance();
3755
3869
  if (!currentInstance) {
3756
3870
  {
3757
3871
  warn$1(`provide() can only be used inside setup().`);
@@ -3766,9 +3880,9 @@ function provide(key, value) {
3766
3880
  }
3767
3881
  }
3768
3882
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
3769
- const instance = currentInstance || currentRenderingInstance;
3883
+ const instance = getCurrentGenericInstance();
3770
3884
  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;
3885
+ let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.appContext && instance.appContext.provides : instance.parent.provides : void 0;
3772
3886
  if (provides && key in provides) {
3773
3887
  return provides[key];
3774
3888
  } else if (arguments.length > 1) {
@@ -3786,7 +3900,7 @@ const createInternalObject = () => Object.create(internalObjectProto);
3786
3900
  const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
3787
3901
 
3788
3902
  function initProps(instance, rawProps, isStateful, isSSR = false) {
3789
- const props = {};
3903
+ const props = instance.props = {};
3790
3904
  const attrs = createInternalObject();
3791
3905
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
3792
3906
  setFullProps(instance, rawProps, props, attrs);
@@ -3796,7 +3910,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
3796
3910
  }
3797
3911
  }
3798
3912
  {
3799
- validateProps(rawProps || {}, props, instance);
3913
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
3800
3914
  }
3801
3915
  if (isStateful) {
3802
3916
  instance.props = isSSR ? props : shallowReactive(props);
@@ -3848,11 +3962,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3848
3962
  const camelizedKey = camelize(key);
3849
3963
  props[camelizedKey] = resolvePropValue(
3850
3964
  options,
3851
- rawCurrentProps,
3852
3965
  camelizedKey,
3853
3966
  value,
3854
3967
  instance,
3855
- false
3968
+ baseResolveDefault
3856
3969
  );
3857
3970
  }
3858
3971
  } else {
@@ -3879,10 +3992,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3879
3992
  rawPrevProps[kebabKey] !== void 0)) {
3880
3993
  props[key] = resolvePropValue(
3881
3994
  options,
3882
- rawCurrentProps,
3883
3995
  key,
3884
3996
  void 0,
3885
3997
  instance,
3998
+ baseResolveDefault,
3886
3999
  true
3887
4000
  );
3888
4001
  }
@@ -3904,7 +4017,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3904
4017
  trigger(instance.attrs, "set", "");
3905
4018
  }
3906
4019
  {
3907
- validateProps(rawProps || {}, props, instance);
4020
+ validateProps(rawProps || {}, props, instance.propsOptions[0]);
3908
4021
  }
3909
4022
  }
3910
4023
  function setFullProps(instance, rawProps, props, attrs) {
@@ -3933,39 +4046,37 @@ function setFullProps(instance, rawProps, props, attrs) {
3933
4046
  }
3934
4047
  }
3935
4048
  if (needCastKeys) {
3936
- const rawCurrentProps = toRaw(props);
3937
4049
  const castValues = rawCastValues || EMPTY_OBJ;
3938
4050
  for (let i = 0; i < needCastKeys.length; i++) {
3939
4051
  const key = needCastKeys[i];
3940
4052
  props[key] = resolvePropValue(
3941
4053
  options,
3942
- rawCurrentProps,
3943
4054
  key,
3944
4055
  castValues[key],
3945
4056
  instance,
4057
+ baseResolveDefault,
3946
4058
  !hasOwn(castValues, key)
3947
4059
  );
3948
4060
  }
3949
4061
  }
3950
4062
  return hasAttrsChanged;
3951
4063
  }
3952
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
4064
+ function resolvePropValue(options, key, value, instance, resolveDefault, isAbsent = false) {
3953
4065
  const opt = options[key];
3954
4066
  if (opt != null) {
3955
4067
  const hasDefault = hasOwn(opt, "default");
3956
4068
  if (hasDefault && value === void 0) {
3957
4069
  const defaultValue = opt.default;
3958
4070
  if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
3959
- const { propsDefaults } = instance;
3960
- if (key in propsDefaults) {
3961
- value = propsDefaults[key];
4071
+ const cachedDefaults = instance.propsDefaults || (instance.propsDefaults = {});
4072
+ if (hasOwn(cachedDefaults, key)) {
4073
+ value = cachedDefaults[key];
3962
4074
  } else {
3963
- const reset = setCurrentInstance(instance);
3964
- value = propsDefaults[key] = defaultValue.call(
3965
- null,
3966
- props
4075
+ value = cachedDefaults[key] = resolveDefault(
4076
+ defaultValue,
4077
+ instance,
4078
+ key
3967
4079
  );
3968
- reset();
3969
4080
  }
3970
4081
  } else {
3971
4082
  value = defaultValue;
@@ -3984,6 +4095,17 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3984
4095
  }
3985
4096
  return value;
3986
4097
  }
4098
+ function baseResolveDefault(factory, instance, key) {
4099
+ let value;
4100
+ const prev = setCurrentInstance(instance);
4101
+ const props = toRaw(instance.props);
4102
+ value = factory.call(
4103
+ null,
4104
+ props
4105
+ );
4106
+ setCurrentInstance(...prev);
4107
+ return value;
4108
+ }
3987
4109
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
3988
4110
  function normalizePropsOptions(comp, appContext, asMixin = false) {
3989
4111
  const cache = asMixin ? mixinPropsCache : appContext.propsCache;
@@ -4018,6 +4140,14 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4018
4140
  }
4019
4141
  return EMPTY_ARR;
4020
4142
  }
4143
+ baseNormalizePropsOptions(raw, normalized, needCastKeys);
4144
+ const res = [normalized, needCastKeys];
4145
+ if (isObject(comp)) {
4146
+ cache.set(comp, res);
4147
+ }
4148
+ return res;
4149
+ }
4150
+ function baseNormalizePropsOptions(raw, normalized, needCastKeys) {
4021
4151
  if (isArray(raw)) {
4022
4152
  for (let i = 0; i < raw.length; i++) {
4023
4153
  if (!isString(raw[i])) {
@@ -4062,11 +4192,6 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4062
4192
  }
4063
4193
  }
4064
4194
  }
4065
- const res = [normalized, needCastKeys];
4066
- if (isObject(comp)) {
4067
- cache.set(comp, res);
4068
- }
4069
- return res;
4070
4195
  }
4071
4196
  function validatePropName(key) {
4072
4197
  if (key[0] !== "$" && !isReservedProp(key)) {
@@ -4088,26 +4213,26 @@ function getType(ctor) {
4088
4213
  }
4089
4214
  return "";
4090
4215
  }
4091
- function validateProps(rawProps, props, instance) {
4092
- const resolvedValues = toRaw(props);
4093
- const options = instance.propsOptions[0];
4216
+ function validateProps(rawProps, resolvedProps, options) {
4217
+ resolvedProps = toRaw(resolvedProps);
4094
4218
  const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
4095
4219
  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
- );
4220
+ const opt = options[key];
4221
+ if (opt != null) {
4222
+ validateProp(
4223
+ key,
4224
+ resolvedProps[key],
4225
+ opt,
4226
+ resolvedProps,
4227
+ !camelizePropsKey.includes(key)
4228
+ );
4229
+ }
4105
4230
  }
4106
4231
  }
4107
- function validateProp(name, value, prop, props, isAbsent) {
4108
- const { type, required, validator, skipCheck } = prop;
4232
+ function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
4233
+ const { type, required, validator, skipCheck } = propOptions;
4109
4234
  if (required && isAbsent) {
4110
- warn$1('Missing required prop: "' + name + '"');
4235
+ warn$1('Missing required prop: "' + key + '"');
4111
4236
  return;
4112
4237
  }
4113
4238
  if (value == null && !required) {
@@ -4123,12 +4248,12 @@ function validateProp(name, value, prop, props, isAbsent) {
4123
4248
  isValid = valid;
4124
4249
  }
4125
4250
  if (!isValid) {
4126
- warn$1(getInvalidTypeMessage(name, value, expectedTypes));
4251
+ warn$1(getInvalidTypeMessage(key, value, expectedTypes));
4127
4252
  return;
4128
4253
  }
4129
4254
  }
4130
- if (validator && !validator(value, props)) {
4131
- warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
4255
+ if (validator && !validator(value, shallowReadonly(resolvedProps) )) {
4256
+ warn$1('Invalid prop: custom validator check failed for prop "' + key + '".');
4132
4257
  }
4133
4258
  }
4134
4259
  const isSimpleType = /* @__PURE__ */ makeMap(
@@ -4199,7 +4324,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
4199
4324
  return rawSlot;
4200
4325
  }
4201
4326
  const normalized = withCtx((...args) => {
4202
- if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
4327
+ if (currentInstance && !currentInstance.vapor && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
4203
4328
  warn$1(
4204
4329
  `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
4330
  );
@@ -4296,12 +4421,15 @@ const updateSlots = (instance, children, optimized) => {
4296
4421
 
4297
4422
  let supported;
4298
4423
  let perf;
4424
+ let cachedNow$1 = 0;
4425
+ const p$1 = /* @__PURE__ */ Promise.resolve();
4426
+ const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
4299
4427
  function startMeasure(instance, type) {
4300
4428
  if (instance.appContext.config.performance && isSupported()) {
4301
4429
  perf.mark(`vue-${type}-${instance.uid}`);
4302
4430
  }
4303
4431
  {
4304
- devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
4432
+ devtoolsPerfStart(instance, type, getNow$1());
4305
4433
  }
4306
4434
  }
4307
4435
  function endMeasure(instance, type) {
@@ -4318,7 +4446,7 @@ function endMeasure(instance, type) {
4318
4446
  perf.clearMarks(endTag);
4319
4447
  }
4320
4448
  {
4321
- devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
4449
+ devtoolsPerfEnd(instance, type, getNow$1());
4322
4450
  }
4323
4451
  }
4324
4452
  function isSupported() {
@@ -4399,6 +4527,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4399
4527
  optimized
4400
4528
  );
4401
4529
  break;
4530
+ case VaporSlot:
4531
+ getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor);
4532
+ break;
4402
4533
  default:
4403
4534
  if (shapeFlag & 1) {
4404
4535
  processElement(
@@ -4611,11 +4742,15 @@ function baseCreateRenderer(options, createHydrationFns) {
4611
4742
  }
4612
4743
  hostInsert(el, container, anchor);
4613
4744
  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);
4745
+ queuePostRenderEffect(
4746
+ () => {
4747
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4748
+ needCallTransitionHooks && transition.enter(el);
4749
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4750
+ },
4751
+ void 0,
4752
+ parentSuspense
4753
+ );
4619
4754
  }
4620
4755
  };
4621
4756
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
@@ -4627,8 +4762,8 @@ function baseCreateRenderer(options, createHydrationFns) {
4627
4762
  hostSetScopeId(el, slotScopeIds[i]);
4628
4763
  }
4629
4764
  }
4630
- if (parentComponent) {
4631
- let subTree = parentComponent.subTree;
4765
+ let subTree = parentComponent && parentComponent.subTree;
4766
+ if (subTree) {
4632
4767
  if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
4633
4768
  subTree = filterSingleRoot(subTree.children) || subTree;
4634
4769
  }
@@ -4745,10 +4880,14 @@ function baseCreateRenderer(options, createHydrationFns) {
4745
4880
  patchProps(el, oldProps, newProps, parentComponent, namespace);
4746
4881
  }
4747
4882
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
4748
- queuePostRenderEffect(() => {
4749
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4750
- dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4751
- }, parentSuspense);
4883
+ queuePostRenderEffect(
4884
+ () => {
4885
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4886
+ dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4887
+ },
4888
+ void 0,
4889
+ parentSuspense
4890
+ );
4752
4891
  }
4753
4892
  };
4754
4893
  const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
@@ -4876,7 +5015,22 @@ function baseCreateRenderer(options, createHydrationFns) {
4876
5015
  };
4877
5016
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4878
5017
  n2.slotScopeIds = slotScopeIds;
4879
- if (n1 == null) {
5018
+ if (n2.type.__vapor) {
5019
+ if (n1 == null) {
5020
+ getVaporInterface(parentComponent, n2).mount(
5021
+ n2,
5022
+ container,
5023
+ anchor,
5024
+ parentComponent
5025
+ );
5026
+ } else {
5027
+ getVaporInterface(parentComponent, n2).update(
5028
+ n1,
5029
+ n2,
5030
+ shouldUpdateComponent(n1, n2, optimized)
5031
+ );
5032
+ }
5033
+ } else if (n1 == null) {
4880
5034
  if (n2.shapeFlag & 512) {
4881
5035
  parentComponent.ctx.activate(
4882
5036
  n2,
@@ -4962,15 +5116,52 @@ function baseCreateRenderer(options, createHydrationFns) {
4962
5116
  return;
4963
5117
  } else {
4964
5118
  instance.next = n2;
4965
- instance.update();
5119
+ instance.effect.run();
4966
5120
  }
4967
5121
  } else {
4968
5122
  n2.el = n1.el;
4969
5123
  instance.vnode = n2;
4970
5124
  }
4971
5125
  };
4972
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
4973
- const componentUpdateFn = () => {
5126
+ class SetupRenderEffect extends ReactiveEffect {
5127
+ constructor(instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) {
5128
+ const prevScope = setCurrentScope(instance.scope);
5129
+ super();
5130
+ this.instance = instance;
5131
+ this.initialVNode = initialVNode;
5132
+ this.container = container;
5133
+ this.anchor = anchor;
5134
+ this.parentSuspense = parentSuspense;
5135
+ this.namespace = namespace;
5136
+ this.optimized = optimized;
5137
+ setCurrentScope(prevScope);
5138
+ this.job = instance.job = () => {
5139
+ if (this.dirty) {
5140
+ this.run();
5141
+ }
5142
+ };
5143
+ this.job.i = instance;
5144
+ {
5145
+ this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5146
+ this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5147
+ }
5148
+ }
5149
+ notify() {
5150
+ if (!(this.flags & 256)) {
5151
+ const job = this.job;
5152
+ queueJob(job, job.i.uid);
5153
+ }
5154
+ }
5155
+ fn() {
5156
+ const {
5157
+ instance,
5158
+ initialVNode,
5159
+ container,
5160
+ anchor,
5161
+ parentSuspense,
5162
+ namespace,
5163
+ optimized
5164
+ } = this;
4974
5165
  if (!instance.isMounted) {
4975
5166
  let vnodeHook;
4976
5167
  const { el, props } = initialVNode;
@@ -5014,23 +5205,24 @@ function baseCreateRenderer(options, createHydrationFns) {
5014
5205
  initialVNode.el = subTree.el;
5015
5206
  }
5016
5207
  if (m) {
5017
- queuePostRenderEffect(m, parentSuspense);
5208
+ queuePostRenderEffect(m, void 0, parentSuspense);
5018
5209
  }
5019
5210
  if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
5020
5211
  const scopedInitialVNode = initialVNode;
5021
5212
  queuePostRenderEffect(
5022
5213
  () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
5214
+ void 0,
5023
5215
  parentSuspense
5024
5216
  );
5025
5217
  }
5026
- if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
5027
- instance.a && queuePostRenderEffect(instance.a, parentSuspense);
5218
+ if (initialVNode.shapeFlag & 256 || parent && parent.vnode && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
5219
+ instance.a && queuePostRenderEffect(instance.a, void 0, parentSuspense);
5028
5220
  }
5029
5221
  instance.isMounted = true;
5030
5222
  {
5031
5223
  devtoolsComponentAdded(instance);
5032
5224
  }
5033
- initialVNode = container = anchor = null;
5225
+ this.initialVNode = this.container = this.anchor = null;
5034
5226
  } else {
5035
5227
  let { next, bu, u, parent, vnode } = instance;
5036
5228
  {
@@ -5042,7 +5234,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5042
5234
  }
5043
5235
  nonHydratedAsyncRoot.asyncDep.then(() => {
5044
5236
  if (!instance.isUnmounted) {
5045
- componentUpdateFn();
5237
+ this.fn();
5046
5238
  }
5047
5239
  });
5048
5240
  return;
@@ -5098,11 +5290,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5098
5290
  updateHOCHostEl(instance, nextTree.el);
5099
5291
  }
5100
5292
  if (u) {
5101
- queuePostRenderEffect(u, parentSuspense);
5293
+ queuePostRenderEffect(u, void 0, parentSuspense);
5102
5294
  }
5103
5295
  if (vnodeHook = next.props && next.props.onVnodeUpdated) {
5104
5296
  queuePostRenderEffect(
5105
5297
  () => invokeVNodeHook(vnodeHook, parent, next, vnode),
5298
+ void 0,
5106
5299
  parentSuspense
5107
5300
  );
5108
5301
  }
@@ -5113,21 +5306,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5113
5306
  popWarningContext$1();
5114
5307
  }
5115
5308
  }
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
5309
  }
5130
- update();
5310
+ }
5311
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
5312
+ const effect = instance.effect = new SetupRenderEffect(
5313
+ instance,
5314
+ initialVNode,
5315
+ container,
5316
+ anchor,
5317
+ parentSuspense,
5318
+ namespace,
5319
+ optimized
5320
+ );
5321
+ instance.update = effect.run.bind(effect);
5322
+ toggleRecurse(instance, true);
5323
+ effect.run();
5131
5324
  };
5132
5325
  const updateComponentPreRender = (instance, nextVNode, optimized) => {
5133
5326
  nextVNode.component = instance;
@@ -5136,9 +5329,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5136
5329
  instance.next = null;
5137
5330
  updateProps(instance, nextVNode.props, prevProps, optimized);
5138
5331
  updateSlots(instance, nextVNode.children, optimized);
5139
- pauseTracking();
5332
+ const prevSub = setActiveSub();
5140
5333
  flushPreFlushCbs(instance);
5141
- resetTracking();
5334
+ setActiveSub(prevSub);
5142
5335
  };
5143
5336
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5144
5337
  const c1 = n1 && n1.children;
@@ -5415,7 +5608,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5415
5608
  );
5416
5609
  } else if (moved) {
5417
5610
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
5418
- move(nextChild, container, anchor, 2);
5611
+ move(
5612
+ nextChild,
5613
+ container,
5614
+ anchor,
5615
+ 2,
5616
+ parentComponent
5617
+ );
5419
5618
  } else {
5420
5619
  j--;
5421
5620
  }
@@ -5423,10 +5622,20 @@ function baseCreateRenderer(options, createHydrationFns) {
5423
5622
  }
5424
5623
  }
5425
5624
  };
5426
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
5625
+ const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
5427
5626
  const { el, type, transition, children, shapeFlag } = vnode;
5428
5627
  if (shapeFlag & 6) {
5429
- move(vnode.component.subTree, container, anchor, moveType);
5628
+ if (type.__vapor) {
5629
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor);
5630
+ } else {
5631
+ move(
5632
+ vnode.component.subTree,
5633
+ container,
5634
+ anchor,
5635
+ moveType,
5636
+ parentComponent
5637
+ );
5638
+ }
5430
5639
  return;
5431
5640
  }
5432
5641
  if (shapeFlag & 128) {
@@ -5434,13 +5643,25 @@ function baseCreateRenderer(options, createHydrationFns) {
5434
5643
  return;
5435
5644
  }
5436
5645
  if (shapeFlag & 64) {
5437
- type.move(vnode, container, anchor, internals);
5646
+ type.move(
5647
+ vnode,
5648
+ container,
5649
+ anchor,
5650
+ internals,
5651
+ parentComponent
5652
+ );
5438
5653
  return;
5439
5654
  }
5440
5655
  if (type === Fragment) {
5441
5656
  hostInsert(el, container, anchor);
5442
5657
  for (let i = 0; i < children.length; i++) {
5443
- move(children[i], container, anchor, moveType);
5658
+ move(
5659
+ children[i],
5660
+ container,
5661
+ anchor,
5662
+ moveType,
5663
+ parentComponent
5664
+ );
5444
5665
  }
5445
5666
  hostInsert(vnode.anchor, container, anchor);
5446
5667
  return;
@@ -5454,7 +5675,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5454
5675
  if (moveType === 0) {
5455
5676
  transition.beforeEnter(el);
5456
5677
  hostInsert(el, container, anchor);
5457
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5678
+ queuePostRenderEffect(
5679
+ () => transition.enter(el),
5680
+ void 0,
5681
+ parentSuspense
5682
+ );
5458
5683
  } else {
5459
5684
  const { leave, delayLeave, afterLeave } = transition;
5460
5685
  const remove2 = () => {
@@ -5496,9 +5721,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5496
5721
  optimized = false;
5497
5722
  }
5498
5723
  if (ref != null) {
5499
- pauseTracking();
5724
+ const prevSub = setActiveSub();
5500
5725
  setRef(ref, null, parentSuspense, vnode, true);
5501
- resetTracking();
5726
+ setActiveSub(prevSub);
5502
5727
  }
5503
5728
  if (cacheIndex != null) {
5504
5729
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -5514,7 +5739,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5514
5739
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
5515
5740
  }
5516
5741
  if (shapeFlag & 6) {
5517
- unmountComponent(vnode.component, parentSuspense, doRemove);
5742
+ if (type.__vapor) {
5743
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
5744
+ return;
5745
+ } else {
5746
+ unmountComponent(vnode.component, parentSuspense, doRemove);
5747
+ }
5518
5748
  } else {
5519
5749
  if (shapeFlag & 128) {
5520
5750
  vnode.suspense.unmount(parentSuspense, doRemove);
@@ -5548,15 +5778,23 @@ function baseCreateRenderer(options, createHydrationFns) {
5548
5778
  } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
5549
5779
  unmountChildren(children, parentComponent, parentSuspense);
5550
5780
  }
5781
+ if (type === VaporSlot) {
5782
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
5783
+ return;
5784
+ }
5551
5785
  if (doRemove) {
5552
5786
  remove(vnode);
5553
5787
  }
5554
5788
  }
5555
5789
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5556
- queuePostRenderEffect(() => {
5557
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5558
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5559
- }, parentSuspense);
5790
+ queuePostRenderEffect(
5791
+ () => {
5792
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5793
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5794
+ },
5795
+ void 0,
5796
+ parentSuspense
5797
+ );
5560
5798
  }
5561
5799
  };
5562
5800
  const remove = (vnode) => {
@@ -5613,7 +5851,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5613
5851
  const {
5614
5852
  bum,
5615
5853
  scope,
5616
- job,
5854
+ effect,
5617
5855
  subTree,
5618
5856
  um,
5619
5857
  m,
@@ -5632,16 +5870,18 @@ function baseCreateRenderer(options, createHydrationFns) {
5632
5870
  });
5633
5871
  }
5634
5872
  scope.stop();
5635
- if (job) {
5636
- job.flags |= 8;
5873
+ if (effect) {
5874
+ effect.stop();
5637
5875
  unmount(subTree, instance, parentSuspense, doRemove);
5638
5876
  }
5639
5877
  if (um) {
5640
- queuePostRenderEffect(um, parentSuspense);
5878
+ queuePostRenderEffect(um, void 0, parentSuspense);
5641
5879
  }
5642
- queuePostRenderEffect(() => {
5643
- instance.isUnmounted = true;
5644
- }, parentSuspense);
5880
+ queuePostRenderEffect(
5881
+ () => instance.isUnmounted = true,
5882
+ void 0,
5883
+ parentSuspense
5884
+ );
5645
5885
  if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
5646
5886
  parentSuspense.deps--;
5647
5887
  if (parentSuspense.deps === 0) {
@@ -5659,6 +5899,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5659
5899
  };
5660
5900
  const getNextHostNode = (vnode) => {
5661
5901
  if (vnode.shapeFlag & 6) {
5902
+ if (vnode.type.__vapor) {
5903
+ return hostNextSibling(vnode.component.block);
5904
+ }
5662
5905
  return getNextHostNode(vnode.component.subTree);
5663
5906
  }
5664
5907
  if (vnode.shapeFlag & 128) {
@@ -5668,7 +5911,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5668
5911
  const teleportEnd = el && el[TeleportEndKey];
5669
5912
  return teleportEnd ? hostNextSibling(teleportEnd) : el;
5670
5913
  };
5671
- let isFlushing = false;
5672
5914
  const render = (vnode, container, namespace) => {
5673
5915
  if (vnode == null) {
5674
5916
  if (container._vnode) {
@@ -5686,12 +5928,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5686
5928
  );
5687
5929
  }
5688
5930
  container._vnode = vnode;
5689
- if (!isFlushing) {
5690
- isFlushing = true;
5691
- flushPreFlushCbs();
5692
- flushPostFlushCbs();
5693
- isFlushing = false;
5694
- }
5931
+ flushOnAppMount();
5695
5932
  };
5696
5933
  const internals = {
5697
5934
  p: patch,
@@ -5699,6 +5936,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5699
5936
  m: move,
5700
5937
  r: remove,
5701
5938
  mt: mountComponent,
5939
+ umt: unmountComponent,
5702
5940
  mc: mountChildren,
5703
5941
  pc: patchChildren,
5704
5942
  pbc: patchBlockChildren,
@@ -5706,22 +5944,51 @@ function baseCreateRenderer(options, createHydrationFns) {
5706
5944
  o: options
5707
5945
  };
5708
5946
  let hydrate;
5947
+ const mountApp = (app, container, isHydrate, namespace) => {
5948
+ const vnode = app._ceVNode || createVNode(app._component, app._props);
5949
+ vnode.appContext = app._context;
5950
+ if (namespace === true) {
5951
+ namespace = "svg";
5952
+ } else if (namespace === false) {
5953
+ namespace = void 0;
5954
+ }
5955
+ {
5956
+ app._context.reload = () => {
5957
+ const cloned = cloneVNode(vnode);
5958
+ cloned.el = null;
5959
+ render(cloned, container, namespace);
5960
+ };
5961
+ }
5962
+ {
5963
+ render(vnode, container, namespace);
5964
+ }
5965
+ return vnode.component;
5966
+ };
5967
+ const unmountApp = (app) => {
5968
+ render(null, app._container);
5969
+ };
5709
5970
  return {
5710
5971
  render,
5711
5972
  hydrate,
5712
- createApp: createAppAPI(render)
5973
+ internals,
5974
+ createApp: createAppAPI(
5975
+ mountApp,
5976
+ unmountApp,
5977
+ getComponentPublicInstance)
5713
5978
  };
5714
5979
  }
5715
5980
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
5716
5981
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5717
5982
  }
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;
5983
+ function toggleRecurse({ effect, job, vapor }, allowed) {
5984
+ if (!vapor) {
5985
+ if (allowed) {
5986
+ effect.flags |= 128;
5987
+ job.flags |= 2;
5988
+ } else {
5989
+ effect.flags &= -129;
5990
+ job.flags &= -3;
5991
+ }
5725
5992
  }
5726
5993
  }
5727
5994
  function needTransition(parentSuspense, transition) {
@@ -5754,48 +6021,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
5754
6021
  }
5755
6022
  }
5756
6023
  }
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
6024
  function locateNonHydratedAsyncRoot(instance) {
5798
- const subComponent = instance.subTree.component;
6025
+ const subComponent = instance.vapor ? null : instance.subTree.component;
5799
6026
  if (subComponent) {
5800
6027
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
5801
6028
  return subComponent;
@@ -5807,8 +6034,22 @@ function locateNonHydratedAsyncRoot(instance) {
5807
6034
  function invalidateMount(hooks) {
5808
6035
  if (hooks) {
5809
6036
  for (let i = 0; i < hooks.length; i++)
5810
- hooks[i].flags |= 8;
6037
+ hooks[i].flags |= 4;
6038
+ }
6039
+ }
6040
+ function getVaporInterface(instance, vnode) {
6041
+ const ctx = instance ? instance.appContext : vnode.appContext;
6042
+ const res = ctx && ctx.vapor;
6043
+ if (!res) {
6044
+ warn$1(
6045
+ `Vapor component found in vdom tree but vapor-in-vdom interop was not installed. Make sure to install it:
6046
+ \`\`\`
6047
+ import { vaporInteropPlugin } from 'vue'
6048
+ app.use(vaporInteropPlugin)
6049
+ \`\`\``
6050
+ );
5811
6051
  }
6052
+ return res;
5812
6053
  }
5813
6054
 
5814
6055
  const ssrContextKey = Symbol.for("v-scx");
@@ -5832,8 +6073,41 @@ function watch(source, cb, options) {
5832
6073
  }
5833
6074
  return doWatch(source, cb, options);
5834
6075
  }
6076
+ class RenderWatcherEffect extends WatcherEffect {
6077
+ constructor(instance, source, cb, options, flush) {
6078
+ super(source, cb, options);
6079
+ this.flush = flush;
6080
+ const job = () => {
6081
+ if (this.dirty) {
6082
+ this.run();
6083
+ }
6084
+ };
6085
+ if (cb) {
6086
+ this.flags |= 128;
6087
+ job.flags |= 2;
6088
+ }
6089
+ if (instance) {
6090
+ job.i = instance;
6091
+ }
6092
+ this.job = job;
6093
+ }
6094
+ notify() {
6095
+ const flags = this.flags;
6096
+ if (!(flags & 256)) {
6097
+ const flush = this.flush;
6098
+ const job = this.job;
6099
+ if (flush === "post") {
6100
+ queuePostRenderEffect(job, void 0, job.i ? job.i.suspense : null);
6101
+ } else if (flush === "pre") {
6102
+ queueJob(job, job.i ? job.i.uid : void 0, true);
6103
+ } else {
6104
+ job();
6105
+ }
6106
+ }
6107
+ }
6108
+ }
5835
6109
  function doWatch(source, cb, options = EMPTY_OBJ) {
5836
- const { immediate, deep, flush, once } = options;
6110
+ const { immediate, deep, flush = "pre", once } = options;
5837
6111
  if (!cb) {
5838
6112
  if (immediate !== void 0) {
5839
6113
  warn$1(
@@ -5870,42 +6144,32 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
5870
6144
  }
5871
6145
  const instance = currentInstance;
5872
6146
  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
- };
6147
+ const effect = new RenderWatcherEffect(
6148
+ instance,
6149
+ source,
6150
+ cb,
6151
+ baseWatchOptions,
6152
+ flush
6153
+ );
6154
+ if (cb) {
6155
+ effect.run(true);
6156
+ } else if (flush === "post") {
6157
+ queuePostRenderEffect(effect.job, void 0, instance && instance.suspense);
6158
+ } else {
6159
+ effect.run(true);
5887
6160
  }
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);
6161
+ const stop = effect.stop.bind(effect);
6162
+ stop.pause = effect.pause.bind(effect);
6163
+ stop.resume = effect.resume.bind(effect);
6164
+ stop.stop = stop;
5901
6165
  if (isInSSRComponentSetup) {
5902
6166
  if (ssrCleanup) {
5903
- ssrCleanup.push(watchHandle);
6167
+ ssrCleanup.push(stop);
5904
6168
  } else if (runsImmediately) {
5905
- watchHandle();
6169
+ stop();
5906
6170
  }
5907
6171
  }
5908
- return watchHandle;
6172
+ return stop;
5909
6173
  }
5910
6174
  function instanceWatch(source, value, options) {
5911
6175
  const publicThis = this.proxy;
@@ -5917,9 +6181,9 @@ function instanceWatch(source, value, options) {
5917
6181
  cb = value.handler;
5918
6182
  options = value;
5919
6183
  }
5920
- const reset = setCurrentInstance(this);
6184
+ const prev = setCurrentInstance(this);
5921
6185
  const res = doWatch(getter, cb.bind(publicThis), options);
5922
- reset();
6186
+ setCurrentInstance(...prev);
5923
6187
  return res;
5924
6188
  }
5925
6189
  function createPathGetter(ctx, path) {
@@ -5933,21 +6197,26 @@ function createPathGetter(ctx, path) {
5933
6197
  };
5934
6198
  }
5935
6199
 
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`];
6200
+ const getModelModifiers = (props, modelName, getter) => {
6201
+ return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
5938
6202
  };
5939
6203
 
5940
6204
  function emit(instance, event, ...rawArgs) {
6205
+ return baseEmit(
6206
+ instance,
6207
+ instance.vnode.props || EMPTY_OBJ,
6208
+ defaultPropGetter,
6209
+ event,
6210
+ ...rawArgs
6211
+ );
6212
+ }
6213
+ function baseEmit(instance, props, getter, event, ...rawArgs) {
5941
6214
  if (instance.isUnmounted) return;
5942
- const props = instance.vnode.props || EMPTY_OBJ;
5943
6215
  {
5944
- const {
5945
- emitsOptions,
5946
- propsOptions: [propsOptions]
5947
- } = instance;
6216
+ const { emitsOptions, propsOptions } = instance;
5948
6217
  if (emitsOptions) {
5949
6218
  if (!(event in emitsOptions) && true) {
5950
- if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
6219
+ if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) {
5951
6220
  warn$1(
5952
6221
  `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
5953
6222
  );
@@ -5967,7 +6236,7 @@ function emit(instance, event, ...rawArgs) {
5967
6236
  }
5968
6237
  let args = rawArgs;
5969
6238
  const isModelListener = event.startsWith("update:");
5970
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
6239
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
5971
6240
  if (modifiers) {
5972
6241
  if (modifiers.trim) {
5973
6242
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -5981,7 +6250,7 @@ function emit(instance, event, ...rawArgs) {
5981
6250
  }
5982
6251
  {
5983
6252
  const lowerCaseEvent = event.toLowerCase();
5984
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
6253
+ if (lowerCaseEvent !== event && getter(props, toHandlerKey(lowerCaseEvent))) {
5985
6254
  warn$1(
5986
6255
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
5987
6256
  instance,
@@ -5993,10 +6262,10 @@ function emit(instance, event, ...rawArgs) {
5993
6262
  }
5994
6263
  }
5995
6264
  let handlerName;
5996
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
5997
- props[handlerName = toHandlerKey(camelize(event))];
6265
+ let handler = getter(props, handlerName = toHandlerKey(event)) || // also try camelCase event handler (#2249)
6266
+ getter(props, handlerName = toHandlerKey(camelize(event)));
5998
6267
  if (!handler && isModelListener) {
5999
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
6268
+ handler = getter(props, handlerName = toHandlerKey(hyphenate(event)));
6000
6269
  }
6001
6270
  if (handler) {
6002
6271
  callWithAsyncErrorHandling(
@@ -6006,7 +6275,7 @@ function emit(instance, event, ...rawArgs) {
6006
6275
  args
6007
6276
  );
6008
6277
  }
6009
- const onceHandler = props[handlerName + `Once`];
6278
+ const onceHandler = getter(props, handlerName + `Once`);
6010
6279
  if (onceHandler) {
6011
6280
  if (!instance.emitted) {
6012
6281
  instance.emitted = {};
@@ -6022,6 +6291,9 @@ function emit(instance, event, ...rawArgs) {
6022
6291
  );
6023
6292
  }
6024
6293
  }
6294
+ function defaultPropGetter(props, key) {
6295
+ return props[key];
6296
+ }
6025
6297
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
6026
6298
  const cache = appContext.emitsCache;
6027
6299
  const cached = cache.get(comp);
@@ -6348,7 +6620,7 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
6348
6620
  return false;
6349
6621
  }
6350
6622
  function updateHOCHostEl({ vnode, parent }, el) {
6351
- while (parent) {
6623
+ while (parent && !parent.vapor) {
6352
6624
  const root = parent.subTree;
6353
6625
  if (root.suspense && root.suspense.activeBranch === vnode) {
6354
6626
  root.el = vnode.el;
@@ -6363,7 +6635,7 @@ function updateHOCHostEl({ vnode, parent }, el) {
6363
6635
  }
6364
6636
 
6365
6637
  const isSuspense = (type) => type.__isSuspense;
6366
- function queueEffectWithSuspense(fn, suspense) {
6638
+ function queueEffectWithSuspense(fn, id, suspense) {
6367
6639
  if (suspense && suspense.pendingBranch) {
6368
6640
  if (isArray(fn)) {
6369
6641
  suspense.effects.push(...fn);
@@ -6371,7 +6643,7 @@ function queueEffectWithSuspense(fn, suspense) {
6371
6643
  suspense.effects.push(fn);
6372
6644
  }
6373
6645
  } else {
6374
- queuePostFlushCb(fn);
6646
+ queuePostFlushCb(fn, id);
6375
6647
  }
6376
6648
  }
6377
6649
 
@@ -6379,6 +6651,7 @@ const Fragment = Symbol.for("v-fgt");
6379
6651
  const Text = Symbol.for("v-txt");
6380
6652
  const Comment = Symbol.for("v-cmt");
6381
6653
  const Static = Symbol.for("v-stc");
6654
+ const VaporSlot = Symbol.for("v-vps");
6382
6655
  let currentBlock = null;
6383
6656
  let isBlockTreeEnabled = 1;
6384
6657
  function setBlockTracking(value, inVOnce = false) {
@@ -6699,6 +6972,40 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
6699
6972
  ]);
6700
6973
  }
6701
6974
 
6975
+ let currentInstance = null;
6976
+ const getCurrentGenericInstance = () => currentInstance || currentRenderingInstance;
6977
+ const getCurrentInstance = () => currentInstance && !currentInstance.vapor ? currentInstance : currentRenderingInstance;
6978
+ let isInSSRComponentSetup = false;
6979
+ let setInSSRSetupState;
6980
+ let simpleSetCurrentInstance;
6981
+ {
6982
+ const g = getGlobalThis();
6983
+ const registerGlobalSetter = (key, setter) => {
6984
+ let setters;
6985
+ if (!(setters = g[key])) setters = g[key] = [];
6986
+ setters.push(setter);
6987
+ return (v) => {
6988
+ if (setters.length > 1) setters.forEach((set) => set(v));
6989
+ else setters[0](v);
6990
+ };
6991
+ };
6992
+ simpleSetCurrentInstance = registerGlobalSetter(
6993
+ `__VUE_INSTANCE_SETTERS__`,
6994
+ (v) => currentInstance = v
6995
+ );
6996
+ setInSSRSetupState = registerGlobalSetter(
6997
+ `__VUE_SSR_SETTERS__`,
6998
+ (v) => isInSSRComponentSetup = v
6999
+ );
7000
+ }
7001
+ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope : void 0) => {
7002
+ try {
7003
+ return [currentInstance, setCurrentScope(scope)];
7004
+ } finally {
7005
+ simpleSetCurrentInstance(instance);
7006
+ }
7007
+ };
7008
+
6702
7009
  const emptyAppContext = createAppContext();
6703
7010
  let uid = 0;
6704
7011
  function createComponentInstance$1(vnode, parent, suspense) {
@@ -6743,7 +7050,7 @@ function createComponentInstance$1(vnode, parent, suspense) {
6743
7050
  // to be set immediately
6744
7051
  emitted: null,
6745
7052
  // props default value
6746
- propsDefaults: EMPTY_OBJ,
7053
+ propsDefaults: null,
6747
7054
  // inheritAttrs
6748
7055
  inheritAttrs: type.inheritAttrs,
6749
7056
  // state
@@ -6790,44 +7097,6 @@ function createComponentInstance$1(vnode, parent, suspense) {
6790
7097
  }
6791
7098
  return instance;
6792
7099
  }
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
7100
  function validateComponentName(name, { isNativeTag }) {
6832
7101
  if (isBuiltInTag(name) || isNativeTag(name)) {
6833
7102
  warn$1(
@@ -6838,13 +7107,16 @@ function validateComponentName(name, { isNativeTag }) {
6838
7107
  function isStatefulComponent(instance) {
6839
7108
  return instance.vnode.shapeFlag & 4;
6840
7109
  }
6841
- let isInSSRComponentSetup = false;
6842
7110
  function setupComponent$1(instance, isSSR = false, optimized = false) {
6843
7111
  isSSR && setInSSRSetupState(isSSR);
6844
- const { props, children } = instance.vnode;
7112
+ const { props, children, vi } = instance.vnode;
6845
7113
  const isStateful = isStatefulComponent(instance);
6846
- initProps(instance, props, isStateful, isSSR);
6847
- initSlots(instance, children, optimized || isSSR);
7114
+ if (vi) {
7115
+ vi(instance);
7116
+ } else {
7117
+ initProps(instance, props, isStateful, isSSR);
7118
+ initSlots(instance, children, optimized || isSSR);
7119
+ }
6848
7120
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
6849
7121
  isSSR && setInSSRSetupState(false);
6850
7122
  return setupResult;
@@ -6881,9 +7153,9 @@ function setupStatefulComponent(instance, isSSR) {
6881
7153
  }
6882
7154
  const { setup } = Component;
6883
7155
  if (setup) {
6884
- pauseTracking();
7156
+ const prevSub = setActiveSub();
6885
7157
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
6886
- const reset = setCurrentInstance(instance);
7158
+ const prev = setCurrentInstance(instance);
6887
7159
  const setupResult = callWithErrorHandling(
6888
7160
  setup,
6889
7161
  instance,
@@ -6894,12 +7166,15 @@ function setupStatefulComponent(instance, isSSR) {
6894
7166
  ]
6895
7167
  );
6896
7168
  const isAsyncSetup = isPromise(setupResult);
6897
- resetTracking();
6898
- reset();
7169
+ setActiveSub(prevSub);
7170
+ setCurrentInstance(...prev);
6899
7171
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
6900
7172
  markAsyncBoundary(instance);
6901
7173
  }
6902
7174
  if (isAsyncSetup) {
7175
+ const unsetCurrentInstance = () => {
7176
+ setCurrentInstance(null, void 0);
7177
+ };
6903
7178
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
6904
7179
  if (isSSR) {
6905
7180
  return setupResult.then((resolvedResult) => {
@@ -6957,13 +7232,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6957
7232
  instance.render = Component.render || NOOP;
6958
7233
  }
6959
7234
  {
6960
- const reset = setCurrentInstance(instance);
6961
- pauseTracking();
7235
+ const prevInstance = setCurrentInstance(instance);
7236
+ const prevSub = setActiveSub();
6962
7237
  try {
6963
7238
  applyOptions(instance);
6964
7239
  } finally {
6965
- resetTracking();
6966
- reset();
7240
+ setActiveSub(prevSub);
7241
+ setCurrentInstance(...prevInstance);
6967
7242
  }
6968
7243
  }
6969
7244
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -7000,29 +7275,6 @@ function getSlotsProxy(instance) {
7000
7275
  });
7001
7276
  }
7002
7277
  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
7278
  {
7027
7279
  let attrsProxy;
7028
7280
  let slotsProxy;
@@ -7036,10 +7288,33 @@ function createSetupContext(instance) {
7036
7288
  get emit() {
7037
7289
  return (event, ...args) => instance.emit(event, ...args);
7038
7290
  },
7039
- expose
7291
+ expose: (exposed) => expose(instance, exposed)
7040
7292
  });
7041
7293
  }
7042
7294
  }
7295
+ function expose(instance, exposed) {
7296
+ {
7297
+ if (instance.exposed) {
7298
+ warn$1(`expose() should be called only once per setup().`);
7299
+ }
7300
+ if (exposed != null) {
7301
+ let exposedType = typeof exposed;
7302
+ if (exposedType === "object") {
7303
+ if (isArray(exposed)) {
7304
+ exposedType = "array";
7305
+ } else if (isRef(exposed)) {
7306
+ exposedType = "ref";
7307
+ }
7308
+ }
7309
+ if (exposedType !== "object") {
7310
+ warn$1(
7311
+ `expose() should be passed a plain object, received ${exposedType}.`
7312
+ );
7313
+ }
7314
+ }
7315
+ }
7316
+ instance.exposed = exposed || {};
7317
+ }
7043
7318
  function getComponentPublicInstance(instance) {
7044
7319
  if (instance.exposed) {
7045
7320
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
@@ -7047,7 +7322,9 @@ function getComponentPublicInstance(instance) {
7047
7322
  if (key in target) {
7048
7323
  return target[key];
7049
7324
  } else if (key in publicPropertiesMap) {
7050
- return publicPropertiesMap[key](instance);
7325
+ return publicPropertiesMap[key](
7326
+ instance
7327
+ );
7051
7328
  }
7052
7329
  },
7053
7330
  has(target, key) {
@@ -7090,17 +7367,10 @@ function isClassComponent(value) {
7090
7367
  }
7091
7368
 
7092
7369
  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;
7370
+ return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
7101
7371
  };
7102
7372
 
7103
- const version = "3.5.17";
7373
+ const version = "3.6.0-alpha.2";
7104
7374
  const warn = warn$1 ;
7105
7375
  const _ssrUtils = {
7106
7376
  createComponentInstance: createComponentInstance$1,
@@ -7269,11 +7539,11 @@ function patchStyle(el, prev, next) {
7269
7539
  }
7270
7540
  const semicolonRE = /[^\\];\s*$/;
7271
7541
  const importantRE = /\s*!important$/;
7272
- function setStyle(style, name, val) {
7273
- if (isArray(val)) {
7274
- val.forEach((v) => setStyle(style, name, v));
7542
+ function setStyle(style, name, rawVal) {
7543
+ if (isArray(rawVal)) {
7544
+ rawVal.forEach((v) => setStyle(style, name, v));
7275
7545
  } else {
7276
- if (val == null) val = "";
7546
+ const val = rawVal == null ? "" : String(rawVal);
7277
7547
  {
7278
7548
  if (semicolonRE.test(val)) {
7279
7549
  warn(
@@ -7346,8 +7616,7 @@ function patchDOMProp(el, key, value, parentComponent, attrName) {
7346
7616
  return;
7347
7617
  }
7348
7618
  const tag = el.tagName;
7349
- if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
7350
- !tag.includes("-")) {
7619
+ if (key === "value" && canSetValueDirectly(tag)) {
7351
7620
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
7352
7621
  const newValue = value == null ? (
7353
7622
  // #11647: value should be set as empty string for null and undefined,
@@ -7475,8 +7744,6 @@ function patchStopImmediatePropagation(e, value) {
7475
7744
  }
7476
7745
  }
7477
7746
 
7478
- const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
7479
- key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
7480
7747
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
7481
7748
  const isSVG = namespace === "svg";
7482
7749
  if (key === "class") {
@@ -7516,24 +7783,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
7516
7783
  }
7517
7784
  return false;
7518
7785
  }
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") {
7786
+ if (shouldSetAsAttr(el.tagName, key)) {
7529
7787
  return false;
7530
7788
  }
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
7789
  if (isNativeOn(key) && isString(value)) {
7538
7790
  return false;
7539
7791
  }
@@ -7721,9 +7973,23 @@ function ssrRenderStyle(raw) {
7721
7973
  if (isString(raw)) {
7722
7974
  return escapeHtml(raw);
7723
7975
  }
7724
- const styles = normalizeStyle(raw);
7976
+ const styles = normalizeStyle(ssrResetCssVars(raw));
7725
7977
  return escapeHtml(stringifyStyle(styles));
7726
7978
  }
7979
+ function ssrResetCssVars(raw) {
7980
+ if (!isArray(raw) && isObject(raw)) {
7981
+ const res = {};
7982
+ for (const key in raw) {
7983
+ if (key.startsWith(":--")) {
7984
+ res[key.slice(1)] = normalizeCssVarValue(raw[key]);
7985
+ } else {
7986
+ res[key] = raw[key];
7987
+ }
7988
+ }
7989
+ return res;
7990
+ }
7991
+ return raw;
7992
+ }
7727
7993
 
7728
7994
  function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
7729
7995
  return renderComponentVNode(