@vue/server-renderer 3.4.27 → 3.4.29

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.4.27
2
+ * @vue/server-renderer v3.4.29
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -75,9 +75,9 @@ const toHandlerKey = cacheStringFunction((str) => {
75
75
  return s;
76
76
  });
77
77
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
78
- const invokeArrayFns = (fns, arg) => {
78
+ const invokeArrayFns = (fns, ...arg) => {
79
79
  for (let i = 0; i < fns.length; i++) {
80
- fns[i](arg);
80
+ fns[i](...arg);
81
81
  }
82
82
  };
83
83
  const def = (obj, key, value, writable = false) => {
@@ -250,8 +250,7 @@ function escapeHtmlComment(src) {
250
250
  }
251
251
 
252
252
  function looseCompareArrays(a, b) {
253
- if (a.length !== b.length)
254
- return false;
253
+ if (a.length !== b.length) return false;
255
254
  let equal = true;
256
255
  for (let i = 0; equal && i < a.length; i++) {
257
256
  equal = looseEqual(a[i], b[i]);
@@ -259,8 +258,7 @@ function looseCompareArrays(a, b) {
259
258
  return equal;
260
259
  }
261
260
  function looseEqual(a, b) {
262
- if (a === b)
263
- return true;
261
+ if (a === b) return true;
264
262
  let aValidType = isDate(a);
265
263
  let bValidType = isDate(b);
266
264
  if (aValidType || bValidType) {
@@ -440,7 +438,7 @@ class ReactiveEffect {
440
438
  /**
441
439
  * @internal
442
440
  */
443
- this._dirtyLevel = 4;
441
+ this._dirtyLevel = 5;
444
442
  /**
445
443
  * @internal
446
444
  */
@@ -460,14 +458,18 @@ class ReactiveEffect {
460
458
  recordEffectScope(this, scope);
461
459
  }
462
460
  get dirty() {
463
- if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
461
+ if (this._dirtyLevel === 2)
462
+ return false;
463
+ if (this._dirtyLevel === 3 || this._dirtyLevel === 4) {
464
464
  this._dirtyLevel = 1;
465
465
  pauseTracking();
466
466
  for (let i = 0; i < this._depsLength; i++) {
467
467
  const dep = this.deps[i];
468
468
  if (dep.computed) {
469
+ if (dep.computed.effect._dirtyLevel === 2)
470
+ return true;
469
471
  triggerComputed(dep.computed);
470
- if (this._dirtyLevel >= 4) {
472
+ if (this._dirtyLevel >= 5) {
471
473
  break;
472
474
  }
473
475
  }
@@ -477,10 +479,10 @@ class ReactiveEffect {
477
479
  }
478
480
  resetTracking();
479
481
  }
480
- return this._dirtyLevel >= 4;
482
+ return this._dirtyLevel >= 5;
481
483
  }
482
484
  set dirty(v) {
483
- this._dirtyLevel = v ? 4 : 0;
485
+ this._dirtyLevel = v ? 5 : 0;
484
486
  }
485
487
  run() {
486
488
  this._dirtyLevel = 0;
@@ -578,9 +580,18 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
578
580
  var _a;
579
581
  pauseScheduling();
580
582
  for (const effect2 of dep.keys()) {
583
+ if (!dep.computed && effect2.computed) {
584
+ if (dep.get(effect2) === effect2._trackId && effect2._runnings > 0) {
585
+ effect2._dirtyLevel = 2;
586
+ continue;
587
+ }
588
+ }
581
589
  let tracking;
582
590
  if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
583
591
  effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
592
+ if (effect2.computed && effect2._dirtyLevel === 2) {
593
+ effect2._shouldSchedule = true;
594
+ }
584
595
  effect2._dirtyLevel = dirtyLevel;
585
596
  }
586
597
  if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
@@ -588,7 +599,7 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
588
599
  (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
589
600
  }
590
601
  effect2.trigger();
591
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
602
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 3) {
592
603
  effect2._shouldSchedule = false;
593
604
  if (effect2.scheduler) {
594
605
  queueEffectSchedulers.push(effect2.scheduler);
@@ -680,7 +691,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
680
691
  if (dep) {
681
692
  triggerEffects(
682
693
  dep,
683
- 4,
694
+ 5,
684
695
  {
685
696
  target,
686
697
  type,
@@ -729,8 +740,7 @@ function createArrayInstrumentations() {
729
740
  return instrumentations;
730
741
  }
731
742
  function hasOwnProperty(key) {
732
- if (!isSymbol(key))
733
- key = String(key);
743
+ if (!isSymbol(key)) key = String(key);
734
744
  const obj = toRaw(this);
735
745
  track(obj, "has", key);
736
746
  return obj.hasOwnProperty(key);
@@ -1214,7 +1224,11 @@ function shallowReadonly(target) {
1214
1224
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1215
1225
  if (!isObject(target)) {
1216
1226
  {
1217
- warn$2(`value cannot be made reactive: ${String(target)}`);
1227
+ warn$2(
1228
+ `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
1229
+ target
1230
+ )}`
1231
+ );
1218
1232
  }
1219
1233
  return target;
1220
1234
  }
@@ -1276,7 +1290,7 @@ class ComputedRefImpl {
1276
1290
  () => getter(this._value),
1277
1291
  () => triggerRefValue(
1278
1292
  this,
1279
- this.effect._dirtyLevel === 2 ? 2 : 3
1293
+ this.effect._dirtyLevel === 3 ? 3 : 4
1280
1294
  )
1281
1295
  );
1282
1296
  this.effect.computed = this;
@@ -1286,7 +1300,7 @@ class ComputedRefImpl {
1286
1300
  get value() {
1287
1301
  const self = toRaw(this);
1288
1302
  if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1289
- triggerRefValue(self, 4);
1303
+ triggerRefValue(self, 5);
1290
1304
  }
1291
1305
  trackRefValue(self);
1292
1306
  if (self.effect._dirtyLevel >= 2) {
@@ -1295,7 +1309,7 @@ class ComputedRefImpl {
1295
1309
 
1296
1310
  getter: `, this.getter);
1297
1311
  }
1298
- triggerRefValue(self, 2);
1312
+ triggerRefValue(self, 3);
1299
1313
  }
1300
1314
  return self._value;
1301
1315
  }
@@ -1346,7 +1360,7 @@ function trackRefValue(ref2) {
1346
1360
  );
1347
1361
  }
1348
1362
  }
1349
- function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1363
+ function triggerRefValue(ref2, dirtyLevel = 5, newVal, oldVal) {
1350
1364
  ref2 = toRaw(ref2);
1351
1365
  const dep = ref2.dep;
1352
1366
  if (dep) {
@@ -1357,7 +1371,8 @@ function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1357
1371
  target: ref2,
1358
1372
  type: "set",
1359
1373
  key: "value",
1360
- newValue: newVal
1374
+ newValue: newVal,
1375
+ oldValue: oldVal
1361
1376
  }
1362
1377
  );
1363
1378
  }
@@ -1402,6 +1417,7 @@ function warn$1(msg, ...args) {
1402
1417
  instance,
1403
1418
  11,
1404
1419
  [
1420
+ // eslint-disable-next-line no-restricted-syntax
1405
1421
  msg + args.map((a) => {
1406
1422
  var _a, _b;
1407
1423
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
@@ -1703,10 +1719,11 @@ function flushPostFlushCbs(seen) {
1703
1719
  seen = seen || /* @__PURE__ */ new Map();
1704
1720
  }
1705
1721
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1706
- if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1722
+ const cb = activePostFlushCbs[postFlushIndex];
1723
+ if (checkRecursiveUpdates(seen, cb)) {
1707
1724
  continue;
1708
1725
  }
1709
- activePostFlushCbs[postFlushIndex]();
1726
+ if (cb.active !== false) cb();
1710
1727
  }
1711
1728
  activePostFlushCbs = null;
1712
1729
  postFlushIndex = 0;
@@ -1716,10 +1733,8 @@ const getId = (job) => job.id == null ? Infinity : job.id;
1716
1733
  const comparator = (a, b) => {
1717
1734
  const diff = getId(a) - getId(b);
1718
1735
  if (diff === 0) {
1719
- if (a.pre && !b.pre)
1720
- return -1;
1721
- if (b.pre && !a.pre)
1722
- return 1;
1736
+ if (a.pre && !b.pre) return -1;
1737
+ if (b.pre && !a.pre) return 1;
1723
1738
  }
1724
1739
  return diff;
1725
1740
  };
@@ -1827,8 +1842,7 @@ function rerender(id, newRender) {
1827
1842
  }
1828
1843
  function reload(id, newComp) {
1829
1844
  const record = map.get(id);
1830
- if (!record)
1831
- return;
1845
+ if (!record) return;
1832
1846
  newComp = normalizeClassComponent(newComp);
1833
1847
  updateComponentDef(record.initialDef, newComp);
1834
1848
  const instances = [...record.instances];
@@ -1849,7 +1863,10 @@ function reload(id, newComp) {
1849
1863
  hmrDirtyComponents.delete(oldComp);
1850
1864
  } else if (instance.parent) {
1851
1865
  instance.parent.effect.dirty = true;
1852
- queueJob(instance.parent.update);
1866
+ queueJob(() => {
1867
+ instance.parent.update();
1868
+ hmrDirtyComponents.delete(oldComp);
1869
+ });
1853
1870
  } else if (instance.appContext.reload) {
1854
1871
  instance.appContext.reload();
1855
1872
  } else if (typeof window !== "undefined") {
@@ -1912,6 +1929,7 @@ function setDevtoolsHook(hook, target) {
1912
1929
  // (#4815)
1913
1930
  typeof window !== "undefined" && // some envs mock window but not fully
1914
1931
  window.HTMLElement && // also exclude jsdom
1932
+ // eslint-disable-next-line no-restricted-syntax
1915
1933
  !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
1916
1934
  ) {
1917
1935
  const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
@@ -1989,8 +2007,7 @@ function devtoolsComponentEmit(component, event, params) {
1989
2007
  }
1990
2008
 
1991
2009
  function emit(instance, event, ...rawArgs) {
1992
- if (instance.isUnmounted)
1993
- return;
2010
+ if (instance.isUnmounted) return;
1994
2011
  const props = instance.vnode.props || EMPTY_OBJ;
1995
2012
  {
1996
2013
  const {
@@ -2136,8 +2153,7 @@ function setCurrentRenderingInstance$1(instance) {
2136
2153
  return prev;
2137
2154
  }
2138
2155
  function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2139
- if (!ctx)
2140
- return fn;
2156
+ if (!ctx) return fn;
2141
2157
  if (fn._n) {
2142
2158
  return fn;
2143
2159
  }
@@ -2470,423 +2486,115 @@ function queueEffectWithSuspense(fn, suspense) {
2470
2486
  }
2471
2487
  }
2472
2488
 
2473
- const ssrContextKey = Symbol.for("v-scx");
2474
- const useSSRContext = () => {
2475
- {
2476
- const ctx = inject(ssrContextKey);
2477
- if (!ctx) {
2478
- warn$1(
2479
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
2480
- );
2489
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
2490
+ if (target) {
2491
+ const hooks = target[type] || (target[type] = []);
2492
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2493
+ pauseTracking();
2494
+ const reset = setCurrentInstance(target);
2495
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
2496
+ reset();
2497
+ resetTracking();
2498
+ return res;
2499
+ });
2500
+ if (prepend) {
2501
+ hooks.unshift(wrappedHook);
2502
+ } else {
2503
+ hooks.push(wrappedHook);
2481
2504
  }
2482
- return ctx;
2483
- }
2484
- };
2485
-
2486
- const INITIAL_WATCHER_VALUE = {};
2487
- function watch(source, cb, options) {
2488
- if (!isFunction(cb)) {
2505
+ return wrappedHook;
2506
+ } else {
2507
+ const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
2489
2508
  warn$1(
2490
- `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
2509
+ `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
2491
2510
  );
2492
2511
  }
2493
- return doWatch(source, cb, options);
2494
2512
  }
2495
- function doWatch(source, cb, {
2496
- immediate,
2497
- deep,
2498
- flush,
2499
- once,
2500
- onTrack,
2501
- onTrigger
2502
- } = EMPTY_OBJ) {
2503
- if (cb && once) {
2504
- const _cb = cb;
2505
- cb = (...args) => {
2506
- _cb(...args);
2507
- unwatch();
2508
- };
2513
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
2514
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
2515
+ injectHook(lifecycle, (...args) => hook(...args), target);
2509
2516
  }
2510
- if (deep !== void 0 && typeof deep === "number") {
2511
- warn$1(
2512
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
2513
- );
2514
- }
2515
- if (!cb) {
2516
- if (immediate !== void 0) {
2517
- warn$1(
2518
- `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
2519
- );
2520
- }
2521
- if (deep !== void 0) {
2522
- warn$1(
2523
- `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
2524
- );
2525
- }
2526
- if (once !== void 0) {
2527
- warn$1(
2528
- `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
2529
- );
2530
- }
2517
+ };
2518
+ const onBeforeMount = createHook("bm");
2519
+ const onMounted = createHook("m");
2520
+ const onBeforeUpdate = createHook("bu");
2521
+ const onUpdated = createHook("u");
2522
+ const onBeforeUnmount = createHook("bum");
2523
+ const onUnmounted = createHook("um");
2524
+ const onServerPrefetch = createHook("sp");
2525
+ const onRenderTriggered = createHook(
2526
+ "rtg"
2527
+ );
2528
+ const onRenderTracked = createHook(
2529
+ "rtc"
2530
+ );
2531
+ function onErrorCaptured(hook, target = currentInstance) {
2532
+ injectHook("ec", hook, target);
2533
+ }
2534
+
2535
+ function validateDirectiveName(name) {
2536
+ if (isBuiltInDirective(name)) {
2537
+ warn$1("Do not use built-in directive ids as custom directive id: " + name);
2531
2538
  }
2532
- const warnInvalidSource = (s) => {
2533
- warn$1(
2534
- `Invalid watch source: `,
2535
- s,
2536
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
2537
- );
2538
- };
2539
- const instance = currentInstance;
2540
- const reactiveGetter = (source2) => deep === true ? source2 : (
2541
- // for deep: false, only traverse root-level properties
2542
- traverse(source2, deep === false ? 1 : void 0)
2543
- );
2544
- let getter;
2545
- let forceTrigger = false;
2546
- let isMultiSource = false;
2547
- if (isRef(source)) {
2548
- getter = () => source.value;
2549
- forceTrigger = isShallow(source);
2550
- } else if (isReactive(source)) {
2551
- getter = () => reactiveGetter(source);
2552
- forceTrigger = true;
2553
- } else if (isArray(source)) {
2554
- isMultiSource = true;
2555
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
2556
- getter = () => source.map((s) => {
2557
- if (isRef(s)) {
2558
- return s.value;
2559
- } else if (isReactive(s)) {
2560
- return reactiveGetter(s);
2561
- } else if (isFunction(s)) {
2562
- return callWithErrorHandling(s, instance, 2);
2563
- } else {
2564
- warnInvalidSource(s);
2565
- }
2566
- });
2567
- } else if (isFunction(source)) {
2568
- if (cb) {
2569
- getter = () => callWithErrorHandling(source, instance, 2);
2570
- } else {
2571
- getter = () => {
2572
- if (cleanup) {
2573
- cleanup();
2574
- }
2575
- return callWithAsyncErrorHandling(
2576
- source,
2577
- instance,
2578
- 3,
2579
- [onCleanup]
2580
- );
2581
- };
2539
+ }
2540
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2541
+ const bindings = vnode.dirs;
2542
+ const oldBindings = prevVNode && prevVNode.dirs;
2543
+ for (let i = 0; i < bindings.length; i++) {
2544
+ const binding = bindings[i];
2545
+ if (oldBindings) {
2546
+ binding.oldValue = oldBindings[i].value;
2582
2547
  }
2583
- } else {
2584
- getter = NOOP;
2585
- warnInvalidSource(source);
2586
- }
2587
- if (cb && deep) {
2588
- const baseGetter = getter;
2589
- getter = () => traverse(baseGetter());
2590
- }
2591
- let cleanup;
2592
- let onCleanup = (fn) => {
2593
- cleanup = effect.onStop = () => {
2594
- callWithErrorHandling(fn, instance, 4);
2595
- cleanup = effect.onStop = void 0;
2596
- };
2597
- };
2598
- let ssrCleanup;
2599
- if (isInSSRComponentSetup) {
2600
- onCleanup = NOOP;
2601
- if (!cb) {
2602
- getter();
2603
- } else if (immediate) {
2604
- callWithAsyncErrorHandling(cb, instance, 3, [
2605
- getter(),
2606
- isMultiSource ? [] : void 0,
2607
- onCleanup
2548
+ let hook = binding.dir[name];
2549
+ if (hook) {
2550
+ pauseTracking();
2551
+ callWithAsyncErrorHandling(hook, instance, 8, [
2552
+ vnode.el,
2553
+ binding,
2554
+ vnode,
2555
+ prevVNode
2608
2556
  ]);
2609
- }
2610
- if (flush === "sync") {
2611
- const ctx = useSSRContext();
2612
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
2613
- } else {
2614
- return NOOP;
2557
+ resetTracking();
2615
2558
  }
2616
2559
  }
2617
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2618
- const job = () => {
2619
- if (!effect.active || !effect.dirty) {
2620
- return;
2621
- }
2622
- if (cb) {
2623
- const newValue = effect.run();
2624
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
2625
- if (cleanup) {
2626
- cleanup();
2627
- }
2628
- callWithAsyncErrorHandling(cb, instance, 3, [
2629
- newValue,
2630
- // pass undefined as the old value when it's changed for the first time
2631
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
2632
- onCleanup
2633
- ]);
2634
- oldValue = newValue;
2635
- }
2636
- } else {
2637
- effect.run();
2638
- }
2639
- };
2640
- job.allowRecurse = !!cb;
2641
- let scheduler;
2642
- if (flush === "sync") {
2643
- scheduler = job;
2644
- } else if (flush === "post") {
2645
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
2646
- } else {
2647
- job.pre = true;
2648
- if (instance)
2649
- job.id = instance.uid;
2650
- scheduler = () => queueJob(job);
2651
- }
2652
- const effect = new ReactiveEffect(getter, NOOP, scheduler);
2653
- const scope = getCurrentScope();
2654
- const unwatch = () => {
2655
- effect.stop();
2656
- if (scope) {
2657
- remove(scope.effects, effect);
2658
- }
2659
- };
2660
- {
2661
- effect.onTrack = onTrack;
2662
- effect.onTrigger = onTrigger;
2663
- }
2664
- if (cb) {
2665
- if (immediate) {
2666
- job();
2667
- } else {
2668
- oldValue = effect.run();
2669
- }
2670
- } else if (flush === "post") {
2671
- queuePostRenderEffect(
2672
- effect.run.bind(effect),
2673
- instance && instance.suspense
2674
- );
2675
- } else {
2676
- effect.run();
2677
- }
2678
- if (ssrCleanup)
2679
- ssrCleanup.push(unwatch);
2680
- return unwatch;
2681
- }
2682
- function instanceWatch(source, value, options) {
2683
- const publicThis = this.proxy;
2684
- const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
2685
- let cb;
2686
- if (isFunction(value)) {
2687
- cb = value;
2688
- } else {
2689
- cb = value.handler;
2690
- options = value;
2691
- }
2692
- const reset = setCurrentInstance(this);
2693
- const res = doWatch(getter, cb.bind(publicThis), options);
2694
- reset();
2695
- return res;
2696
- }
2697
- function createPathGetter(ctx, path) {
2698
- const segments = path.split(".");
2699
- return () => {
2700
- let cur = ctx;
2701
- for (let i = 0; i < segments.length && cur; i++) {
2702
- cur = cur[segments[i]];
2703
- }
2704
- return cur;
2705
- };
2706
- }
2707
- function traverse(value, depth = Infinity, seen) {
2708
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2709
- return value;
2710
- }
2711
- seen = seen || /* @__PURE__ */ new Set();
2712
- if (seen.has(value)) {
2713
- return value;
2714
- }
2715
- seen.add(value);
2716
- depth--;
2717
- if (isRef(value)) {
2718
- traverse(value.value, depth, seen);
2719
- } else if (isArray(value)) {
2720
- for (let i = 0; i < value.length; i++) {
2721
- traverse(value[i], depth, seen);
2722
- }
2723
- } else if (isSet(value) || isMap(value)) {
2724
- value.forEach((v) => {
2725
- traverse(v, depth, seen);
2726
- });
2727
- } else if (isPlainObject(value)) {
2728
- for (const key in value) {
2729
- traverse(value[key], depth, seen);
2730
- }
2731
- }
2732
- return value;
2733
- }
2734
-
2735
- function validateDirectiveName(name) {
2736
- if (isBuiltInDirective(name)) {
2737
- warn$1("Do not use built-in directive ids as custom directive id: " + name);
2738
- }
2739
- }
2740
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2741
- const bindings = vnode.dirs;
2742
- const oldBindings = prevVNode && prevVNode.dirs;
2743
- for (let i = 0; i < bindings.length; i++) {
2744
- const binding = bindings[i];
2745
- if (oldBindings) {
2746
- binding.oldValue = oldBindings[i].value;
2747
- }
2748
- let hook = binding.dir[name];
2749
- if (hook) {
2750
- pauseTracking();
2751
- callWithAsyncErrorHandling(hook, instance, 8, [
2752
- vnode.el,
2753
- binding,
2754
- vnode,
2755
- prevVNode
2756
- ]);
2757
- resetTracking();
2758
- }
2759
- }
2760
- }
2761
-
2762
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2763
-
2764
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2765
- function onActivated(hook, target) {
2766
- registerKeepAliveHook(hook, "a", target);
2767
- }
2768
- function onDeactivated(hook, target) {
2769
- registerKeepAliveHook(hook, "da", target);
2770
- }
2771
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2772
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2773
- let current = target;
2774
- while (current) {
2775
- if (current.isDeactivated) {
2776
- return;
2777
- }
2778
- current = current.parent;
2779
- }
2780
- return hook();
2781
- });
2782
- injectHook(type, wrappedHook, target);
2783
- if (target) {
2784
- let current = target.parent;
2785
- while (current && current.parent) {
2786
- if (isKeepAlive(current.parent.vnode)) {
2787
- injectToKeepAliveRoot(wrappedHook, type, target, current);
2788
- }
2789
- current = current.parent;
2790
- }
2791
- }
2792
- }
2793
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2794
- const injected = injectHook(
2795
- type,
2796
- hook,
2797
- keepAliveRoot,
2798
- true
2799
- /* prepend */
2800
- );
2801
- onUnmounted(() => {
2802
- remove(keepAliveRoot[type], injected);
2803
- }, target);
2804
- }
2805
-
2806
- function injectHook(type, hook, target = currentInstance, prepend = false) {
2807
- if (target) {
2808
- const hooks = target[type] || (target[type] = []);
2809
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2810
- if (target.isUnmounted) {
2811
- return;
2812
- }
2813
- pauseTracking();
2814
- const reset = setCurrentInstance(target);
2815
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2816
- reset();
2817
- resetTracking();
2818
- return res;
2819
- });
2820
- if (prepend) {
2821
- hooks.unshift(wrappedHook);
2822
- } else {
2823
- hooks.push(wrappedHook);
2824
- }
2825
- return wrappedHook;
2826
- } else {
2827
- const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
2828
- warn$1(
2829
- `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
2830
- );
2831
- }
2832
- }
2833
- const createHook = (lifecycle) => (hook, target = currentInstance) => (
2834
- // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
2835
- (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
2836
- );
2837
- const onBeforeMount = createHook("bm");
2838
- const onMounted = createHook("m");
2839
- const onBeforeUpdate = createHook("bu");
2840
- const onUpdated = createHook("u");
2841
- const onBeforeUnmount = createHook("bum");
2842
- const onUnmounted = createHook("um");
2843
- const onServerPrefetch = createHook("sp");
2844
- const onRenderTriggered = createHook(
2845
- "rtg"
2846
- );
2847
- const onRenderTracked = createHook(
2848
- "rtc"
2849
- );
2850
- function onErrorCaptured(hook, target = currentInstance) {
2851
- injectHook("ec", hook, target);
2852
- }
2853
-
2854
- const getPublicInstance = (i) => {
2855
- if (!i)
2856
- return null;
2857
- if (isStatefulComponent(i))
2858
- return getExposeProxy(i) || i.proxy;
2859
- return getPublicInstance(i.parent);
2860
- };
2861
- const publicPropertiesMap = (
2862
- // Move PURE marker to new line to workaround compiler discarding it
2863
- // due to type annotation
2864
- /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
2865
- $: (i) => i,
2866
- $el: (i) => i.vnode.el,
2867
- $data: (i) => i.data,
2868
- $props: (i) => shallowReadonly(i.props) ,
2869
- $attrs: (i) => shallowReadonly(i.attrs) ,
2870
- $slots: (i) => shallowReadonly(i.slots) ,
2871
- $refs: (i) => shallowReadonly(i.refs) ,
2872
- $parent: (i) => getPublicInstance(i.parent),
2873
- $root: (i) => getPublicInstance(i.root),
2874
- $emit: (i) => i.emit,
2875
- $options: (i) => resolveMergedOptions(i) ,
2876
- $forceUpdate: (i) => i.f || (i.f = () => {
2877
- i.effect.dirty = true;
2878
- queueJob(i.update);
2879
- }),
2880
- $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
2881
- $watch: (i) => instanceWatch.bind(i)
2882
- })
2883
- );
2884
- const isReservedPrefix = (key) => key === "_" || key === "$";
2885
- const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
2886
- const PublicInstanceProxyHandlers = {
2887
- get({ _: instance }, key) {
2888
- if (key === "__v_skip") {
2889
- return true;
2560
+ }
2561
+
2562
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2563
+
2564
+ const getPublicInstance = (i) => {
2565
+ if (!i) return null;
2566
+ if (isStatefulComponent(i)) return getComponentPublicInstance(i);
2567
+ return getPublicInstance(i.parent);
2568
+ };
2569
+ const publicPropertiesMap = (
2570
+ // Move PURE marker to new line to workaround compiler discarding it
2571
+ // due to type annotation
2572
+ /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
2573
+ $: (i) => i,
2574
+ $el: (i) => i.vnode.el,
2575
+ $data: (i) => i.data,
2576
+ $props: (i) => shallowReadonly(i.props) ,
2577
+ $attrs: (i) => shallowReadonly(i.attrs) ,
2578
+ $slots: (i) => shallowReadonly(i.slots) ,
2579
+ $refs: (i) => shallowReadonly(i.refs) ,
2580
+ $parent: (i) => getPublicInstance(i.parent),
2581
+ $root: (i) => getPublicInstance(i.root),
2582
+ $emit: (i) => i.emit,
2583
+ $options: (i) => resolveMergedOptions(i) ,
2584
+ $forceUpdate: (i) => i.f || (i.f = () => {
2585
+ i.effect.dirty = true;
2586
+ queueJob(i.update);
2587
+ }),
2588
+ $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
2589
+ $watch: (i) => instanceWatch.bind(i)
2590
+ })
2591
+ );
2592
+ const isReservedPrefix = (key) => key === "_" || key === "$";
2593
+ const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
2594
+ const PublicInstanceProxyHandlers = {
2595
+ get({ _: instance }, key) {
2596
+ if (key === "__v_skip") {
2597
+ return true;
2890
2598
  }
2891
2599
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
2892
2600
  if (key === "__isVue") {
@@ -3284,10 +2992,8 @@ function applyOptions(instance) {
3284
2992
  if (inheritAttrs != null) {
3285
2993
  instance.inheritAttrs = inheritAttrs;
3286
2994
  }
3287
- if (components)
3288
- instance.components = components;
3289
- if (directives)
3290
- instance.directives = directives;
2995
+ if (components) instance.components = components;
2996
+ if (directives) instance.directives = directives;
3291
2997
  }
3292
2998
  function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
3293
2999
  if (isArray(injectOptions)) {
@@ -3488,10 +3194,8 @@ function mergeEmitsOrPropsOptions(to, from) {
3488
3194
  }
3489
3195
  }
3490
3196
  function mergeWatchOptions(to, from) {
3491
- if (!to)
3492
- return from;
3493
- if (!from)
3494
- return to;
3197
+ if (!to) return from;
3198
+ if (!from) return to;
3495
3199
  const merged = extend(/* @__PURE__ */ Object.create(null), to);
3496
3200
  for (const key in from) {
3497
3201
  merged[key] = mergeAsArray(to[key], from[key]);
@@ -3641,7 +3345,7 @@ function createAppAPI(render, hydrate) {
3641
3345
  app._instance = vnode.component;
3642
3346
  devtoolsInitApp(app, version);
3643
3347
  }
3644
- return getExposeProxy(vnode.component) || vnode.component.proxy;
3348
+ return getComponentPublicInstance(vnode.component);
3645
3349
  } else {
3646
3350
  warn$1(
3647
3351
  `App has already been mounted.
@@ -3745,8 +3449,7 @@ function initProps(instance, rawProps, isStateful, isSSR = false) {
3745
3449
  }
3746
3450
  function isInHmrContext(instance) {
3747
3451
  while (instance) {
3748
- if (instance.type.__hmrId)
3749
- return true;
3452
+ if (instance.type.__hmrId) return true;
3750
3453
  instance = instance.parent;
3751
3454
  }
3752
3455
  }
@@ -3931,8 +3634,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3931
3634
  hasExtends = true;
3932
3635
  const [props, keys] = normalizePropsOptions(raw2, appContext, true);
3933
3636
  extend(normalized, props);
3934
- if (keys)
3935
- needCastKeys.push(...keys);
3637
+ if (keys) needCastKeys.push(...keys);
3936
3638
  };
3937
3639
  if (!asMixin && appContext.mixins.length) {
3938
3640
  appContext.mixins.forEach(extendProps);
@@ -4023,8 +3725,7 @@ function validateProps(rawProps, props, instance) {
4023
3725
  const options = instance.propsOptions[0];
4024
3726
  for (const key in options) {
4025
3727
  let opt = options[key];
4026
- if (opt == null)
4027
- continue;
3728
+ if (opt == null) continue;
4028
3729
  validateProp(
4029
3730
  key,
4030
3731
  resolvedValues[key],
@@ -4142,8 +3843,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
4142
3843
  const normalizeObjectSlots = (rawSlots, slots, instance) => {
4143
3844
  const ctx = rawSlots._ctx;
4144
3845
  for (const key in rawSlots) {
4145
- if (isInternalKey(key))
4146
- continue;
3846
+ if (isInternalKey(key)) continue;
4147
3847
  const value = rawSlots[key];
4148
3848
  if (isFunction(value)) {
4149
3849
  slots[key] = normalizeSlot(key, value, ctx);
@@ -4233,7 +3933,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4233
3933
  if (isAsyncWrapper(vnode) && !isUnmount) {
4234
3934
  return;
4235
3935
  }
4236
- const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
3936
+ const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
4237
3937
  const value = isUnmount ? null : refValue;
4238
3938
  const { i: owner, r: ref } = rawRef;
4239
3939
  if (!owner) {
@@ -4275,8 +3975,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4275
3975
  }
4276
3976
  } else {
4277
3977
  ref.value = [refValue];
4278
- if (rawRef.k)
4279
- refs[rawRef.k] = ref.value;
3978
+ if (rawRef.k) refs[rawRef.k] = ref.value;
4280
3979
  }
4281
3980
  } else if (!existing.includes(refValue)) {
4282
3981
  existing.push(refValue);
@@ -4289,8 +3988,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4289
3988
  }
4290
3989
  } else if (_isRef) {
4291
3990
  ref.value = value;
4292
- if (rawRef.k)
4293
- refs[rawRef.k] = value;
3991
+ if (rawRef.k) refs[rawRef.k] = value;
4294
3992
  } else {
4295
3993
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
4296
3994
  }
@@ -4849,8 +4547,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4849
4547
  }
4850
4548
  }
4851
4549
  for (const key in newProps) {
4852
- if (isReservedProp(key))
4853
- continue;
4550
+ if (isReservedProp(key)) continue;
4854
4551
  const next = newProps[key];
4855
4552
  const prev = oldProps[key];
4856
4553
  if (next !== prev && key !== "value") {
@@ -4987,7 +4684,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4987
4684
  }
4988
4685
  }
4989
4686
  if (instance.asyncDep) {
4990
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
4687
+ parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
4991
4688
  if (!initialVNode.el) {
4992
4689
  const placeholder = instance.subTree = createVNode(Comment);
4993
4690
  processCommentNode(null, placeholder, container, anchor);
@@ -5452,8 +5149,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5452
5149
  let moved = false;
5453
5150
  let maxNewIndexSoFar = 0;
5454
5151
  const newIndexToOldIndexMap = new Array(toBePatched);
5455
- for (i = 0; i < toBePatched; i++)
5456
- newIndexToOldIndexMap[i] = 0;
5152
+ for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
5457
5153
  for (i = s1; i <= e1; i++) {
5458
5154
  const prevChild = c1[i];
5459
5155
  if (patched >= toBePatched) {
@@ -5582,11 +5278,15 @@ function baseCreateRenderer(options, createHydrationFns) {
5582
5278
  dynamicChildren,
5583
5279
  shapeFlag,
5584
5280
  patchFlag,
5585
- dirs
5281
+ dirs,
5282
+ memoIndex
5586
5283
  } = vnode;
5587
5284
  if (ref != null) {
5588
5285
  setRef(ref, null, parentSuspense, vnode, true);
5589
5286
  }
5287
+ if (memoIndex != null) {
5288
+ parentComponent.renderCache[memoIndex] = void 0;
5289
+ }
5590
5290
  if (shapeFlag & 256) {
5591
5291
  parentComponent.ctx.deactivate(vnode);
5592
5292
  return;
@@ -5690,7 +5390,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5690
5390
  if (instance.type.__hmrId) {
5691
5391
  unregisterHMR(instance);
5692
5392
  }
5693
- const { bum, scope, update, subTree, um } = instance;
5393
+ const { bum, scope, update, subTree, um, m, a } = instance;
5394
+ invalidateMount(m);
5395
+ invalidateMount(a);
5694
5396
  if (bum) {
5695
5397
  invokeArrayFns(bum);
5696
5398
  }
@@ -5795,7 +5497,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
5795
5497
  c2 = ch2[i] = cloneIfMounted(ch2[i]);
5796
5498
  c2.el = c1.el;
5797
5499
  }
5798
- if (!shallow)
5500
+ if (!shallow && c2.patchFlag !== -2)
5799
5501
  traverseStaticChildren(c1, c2);
5800
5502
  }
5801
5503
  if (c2.type === Text) {
@@ -5857,8 +5559,331 @@ function locateNonHydratedAsyncRoot(instance) {
5857
5559
  }
5858
5560
  }
5859
5561
  }
5562
+ function invalidateMount(hooks) {
5563
+ if (hooks) {
5564
+ for (let i = 0; i < hooks.length; i++) hooks[i].active = false;
5565
+ }
5566
+ }
5860
5567
 
5861
- const isTeleport = (type) => type.__isTeleport;
5568
+ const ssrContextKey = Symbol.for("v-scx");
5569
+ const useSSRContext = () => {
5570
+ {
5571
+ const ctx = inject(ssrContextKey);
5572
+ if (!ctx) {
5573
+ warn$1(
5574
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
5575
+ );
5576
+ }
5577
+ return ctx;
5578
+ }
5579
+ };
5580
+
5581
+ const INITIAL_WATCHER_VALUE = {};
5582
+ function watch(source, cb, options) {
5583
+ if (!isFunction(cb)) {
5584
+ warn$1(
5585
+ `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
5586
+ );
5587
+ }
5588
+ return doWatch(source, cb, options);
5589
+ }
5590
+ function doWatch(source, cb, {
5591
+ immediate,
5592
+ deep,
5593
+ flush,
5594
+ once,
5595
+ onTrack,
5596
+ onTrigger
5597
+ } = EMPTY_OBJ) {
5598
+ if (cb && once) {
5599
+ const _cb = cb;
5600
+ cb = (...args) => {
5601
+ _cb(...args);
5602
+ unwatch();
5603
+ };
5604
+ }
5605
+ if (deep !== void 0 && typeof deep === "number") {
5606
+ warn$1(
5607
+ `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
5608
+ );
5609
+ }
5610
+ if (!cb) {
5611
+ if (immediate !== void 0) {
5612
+ warn$1(
5613
+ `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
5614
+ );
5615
+ }
5616
+ if (deep !== void 0) {
5617
+ warn$1(
5618
+ `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
5619
+ );
5620
+ }
5621
+ if (once !== void 0) {
5622
+ warn$1(
5623
+ `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
5624
+ );
5625
+ }
5626
+ }
5627
+ const warnInvalidSource = (s) => {
5628
+ warn$1(
5629
+ `Invalid watch source: `,
5630
+ s,
5631
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
5632
+ );
5633
+ };
5634
+ const instance = currentInstance;
5635
+ const reactiveGetter = (source2) => deep === true ? source2 : (
5636
+ // for deep: false, only traverse root-level properties
5637
+ traverse(source2, deep === false ? 1 : void 0)
5638
+ );
5639
+ let getter;
5640
+ let forceTrigger = false;
5641
+ let isMultiSource = false;
5642
+ if (isRef(source)) {
5643
+ getter = () => source.value;
5644
+ forceTrigger = isShallow(source);
5645
+ } else if (isReactive(source)) {
5646
+ getter = () => reactiveGetter(source);
5647
+ forceTrigger = true;
5648
+ } else if (isArray(source)) {
5649
+ isMultiSource = true;
5650
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
5651
+ getter = () => source.map((s) => {
5652
+ if (isRef(s)) {
5653
+ return s.value;
5654
+ } else if (isReactive(s)) {
5655
+ return reactiveGetter(s);
5656
+ } else if (isFunction(s)) {
5657
+ return callWithErrorHandling(s, instance, 2);
5658
+ } else {
5659
+ warnInvalidSource(s);
5660
+ }
5661
+ });
5662
+ } else if (isFunction(source)) {
5663
+ if (cb) {
5664
+ getter = () => callWithErrorHandling(source, instance, 2);
5665
+ } else {
5666
+ getter = () => {
5667
+ if (cleanup) {
5668
+ cleanup();
5669
+ }
5670
+ return callWithAsyncErrorHandling(
5671
+ source,
5672
+ instance,
5673
+ 3,
5674
+ [onCleanup]
5675
+ );
5676
+ };
5677
+ }
5678
+ } else {
5679
+ getter = NOOP;
5680
+ warnInvalidSource(source);
5681
+ }
5682
+ if (cb && deep) {
5683
+ const baseGetter = getter;
5684
+ getter = () => traverse(baseGetter());
5685
+ }
5686
+ let cleanup;
5687
+ let onCleanup = (fn) => {
5688
+ cleanup = effect.onStop = () => {
5689
+ callWithErrorHandling(fn, instance, 4);
5690
+ cleanup = effect.onStop = void 0;
5691
+ };
5692
+ };
5693
+ let ssrCleanup;
5694
+ if (isInSSRComponentSetup) {
5695
+ onCleanup = NOOP;
5696
+ if (!cb) {
5697
+ getter();
5698
+ } else if (immediate) {
5699
+ callWithAsyncErrorHandling(cb, instance, 3, [
5700
+ getter(),
5701
+ isMultiSource ? [] : void 0,
5702
+ onCleanup
5703
+ ]);
5704
+ }
5705
+ if (flush === "sync") {
5706
+ const ctx = useSSRContext();
5707
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
5708
+ } else {
5709
+ return NOOP;
5710
+ }
5711
+ }
5712
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
5713
+ const job = () => {
5714
+ if (!effect.active || !effect.dirty) {
5715
+ return;
5716
+ }
5717
+ if (cb) {
5718
+ const newValue = effect.run();
5719
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
5720
+ if (cleanup) {
5721
+ cleanup();
5722
+ }
5723
+ callWithAsyncErrorHandling(cb, instance, 3, [
5724
+ newValue,
5725
+ // pass undefined as the old value when it's changed for the first time
5726
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
5727
+ onCleanup
5728
+ ]);
5729
+ oldValue = newValue;
5730
+ }
5731
+ } else {
5732
+ effect.run();
5733
+ }
5734
+ };
5735
+ job.allowRecurse = !!cb;
5736
+ let scheduler;
5737
+ if (flush === "sync") {
5738
+ scheduler = job;
5739
+ } else if (flush === "post") {
5740
+ scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
5741
+ } else {
5742
+ job.pre = true;
5743
+ if (instance) job.id = instance.uid;
5744
+ scheduler = () => queueJob(job);
5745
+ }
5746
+ const effect = new ReactiveEffect(getter, NOOP, scheduler);
5747
+ const scope = getCurrentScope();
5748
+ const unwatch = () => {
5749
+ effect.stop();
5750
+ if (scope) {
5751
+ remove(scope.effects, effect);
5752
+ }
5753
+ };
5754
+ {
5755
+ effect.onTrack = onTrack;
5756
+ effect.onTrigger = onTrigger;
5757
+ }
5758
+ if (cb) {
5759
+ if (immediate) {
5760
+ job();
5761
+ } else {
5762
+ oldValue = effect.run();
5763
+ }
5764
+ } else if (flush === "post") {
5765
+ queuePostRenderEffect(
5766
+ effect.run.bind(effect),
5767
+ instance && instance.suspense
5768
+ );
5769
+ } else {
5770
+ effect.run();
5771
+ }
5772
+ if (ssrCleanup) ssrCleanup.push(unwatch);
5773
+ return unwatch;
5774
+ }
5775
+ function instanceWatch(source, value, options) {
5776
+ const publicThis = this.proxy;
5777
+ const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
5778
+ let cb;
5779
+ if (isFunction(value)) {
5780
+ cb = value;
5781
+ } else {
5782
+ cb = value.handler;
5783
+ options = value;
5784
+ }
5785
+ const reset = setCurrentInstance(this);
5786
+ const res = doWatch(getter, cb.bind(publicThis), options);
5787
+ reset();
5788
+ return res;
5789
+ }
5790
+ function createPathGetter(ctx, path) {
5791
+ const segments = path.split(".");
5792
+ return () => {
5793
+ let cur = ctx;
5794
+ for (let i = 0; i < segments.length && cur; i++) {
5795
+ cur = cur[segments[i]];
5796
+ }
5797
+ return cur;
5798
+ };
5799
+ }
5800
+ function traverse(value, depth = Infinity, seen) {
5801
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
5802
+ return value;
5803
+ }
5804
+ seen = seen || /* @__PURE__ */ new Set();
5805
+ if (seen.has(value)) {
5806
+ return value;
5807
+ }
5808
+ seen.add(value);
5809
+ depth--;
5810
+ if (isRef(value)) {
5811
+ traverse(value.value, depth, seen);
5812
+ } else if (isArray(value)) {
5813
+ for (let i = 0; i < value.length; i++) {
5814
+ traverse(value[i], depth, seen);
5815
+ }
5816
+ } else if (isSet(value) || isMap(value)) {
5817
+ value.forEach((v) => {
5818
+ traverse(v, depth, seen);
5819
+ });
5820
+ } else if (isPlainObject(value)) {
5821
+ for (const key in value) {
5822
+ traverse(value[key], depth, seen);
5823
+ }
5824
+ for (const key of Object.getOwnPropertySymbols(value)) {
5825
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
5826
+ traverse(value[key], depth, seen);
5827
+ }
5828
+ }
5829
+ }
5830
+ return value;
5831
+ }
5832
+
5833
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
5834
+ function onActivated(hook, target) {
5835
+ registerKeepAliveHook(hook, "a", target);
5836
+ }
5837
+ function onDeactivated(hook, target) {
5838
+ registerKeepAliveHook(hook, "da", target);
5839
+ }
5840
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
5841
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
5842
+ let current = target;
5843
+ while (current) {
5844
+ if (current.isDeactivated) {
5845
+ return;
5846
+ }
5847
+ current = current.parent;
5848
+ }
5849
+ return hook();
5850
+ });
5851
+ injectHook(type, wrappedHook, target);
5852
+ if (target) {
5853
+ let current = target.parent;
5854
+ while (current && current.parent) {
5855
+ if (isKeepAlive(current.parent.vnode)) {
5856
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
5857
+ }
5858
+ current = current.parent;
5859
+ }
5860
+ }
5861
+ }
5862
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
5863
+ const injected = injectHook(
5864
+ type,
5865
+ hook,
5866
+ keepAliveRoot,
5867
+ true
5868
+ /* prepend */
5869
+ );
5870
+ onUnmounted(() => {
5871
+ remove(keepAliveRoot[type], injected);
5872
+ }, target);
5873
+ }
5874
+
5875
+ function setTransitionHooks(vnode, hooks) {
5876
+ if (vnode.shapeFlag & 6 && vnode.component) {
5877
+ setTransitionHooks(vnode.component.subTree, hooks);
5878
+ } else if (vnode.shapeFlag & 128) {
5879
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
5880
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
5881
+ } else {
5882
+ vnode.transition = hooks;
5883
+ }
5884
+ }
5885
+
5886
+ const isTeleport = (type) => type.__isTeleport;
5862
5887
 
5863
5888
  const Fragment = Symbol.for("v-fgt");
5864
5889
  const Text = Symbol.for("v-txt");
@@ -5974,7 +5999,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5974
5999
  currentBlock.push(cloned);
5975
6000
  }
5976
6001
  }
5977
- cloned.patchFlag |= -2;
6002
+ cloned.patchFlag = -2;
5978
6003
  return cloned;
5979
6004
  }
5980
6005
  if (isClassComponent(type)) {
@@ -6015,8 +6040,7 @@ Component that was made reactive: `,
6015
6040
  );
6016
6041
  }
6017
6042
  function guardReactiveProps(props) {
6018
- if (!props)
6019
- return null;
6043
+ if (!props) return null;
6020
6044
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
6021
6045
  }
6022
6046
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
@@ -6065,7 +6089,10 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
6065
6089
  ce: vnode.ce
6066
6090
  };
6067
6091
  if (transition && cloneTransition) {
6068
- cloned.transition = transition.clone(cloned);
6092
+ setTransitionHooks(
6093
+ cloned,
6094
+ transition.clone(cloned)
6095
+ );
6069
6096
  }
6070
6097
  return cloned;
6071
6098
  }
@@ -6273,14 +6300,11 @@ let setInSSRSetupState;
6273
6300
  const g = getGlobalThis();
6274
6301
  const registerGlobalSetter = (key, setter) => {
6275
6302
  let setters;
6276
- if (!(setters = g[key]))
6277
- setters = g[key] = [];
6303
+ if (!(setters = g[key])) setters = g[key] = [];
6278
6304
  setters.push(setter);
6279
6305
  return (v) => {
6280
- if (setters.length > 1)
6281
- setters.forEach((set) => set(v));
6282
- else
6283
- setters[0](v);
6306
+ if (setters.length > 1) setters.forEach((set) => set(v));
6307
+ else setters[0](v);
6284
6308
  };
6285
6309
  };
6286
6310
  internalSetCurrentInstance = registerGlobalSetter(
@@ -6471,7 +6495,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6471
6495
  `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
6472
6496
  );
6473
6497
  } else {
6474
- warn$1(`Component is missing template or render function.`);
6498
+ warn$1(`Component is missing template or render function: `, Component);
6475
6499
  }
6476
6500
  }
6477
6501
  }
@@ -6538,7 +6562,7 @@ function createSetupContext(instance) {
6538
6562
  });
6539
6563
  }
6540
6564
  }
6541
- function getExposeProxy(instance) {
6565
+ function getComponentPublicInstance(instance) {
6542
6566
  if (instance.exposed) {
6543
6567
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
6544
6568
  get(target, key) {
@@ -6552,6 +6576,8 @@ function getExposeProxy(instance) {
6552
6576
  return key in target || key in publicPropertiesMap;
6553
6577
  }
6554
6578
  }));
6579
+ } else {
6580
+ return instance.proxy;
6555
6581
  }
6556
6582
  }
6557
6583
  const classifyRE = /(?:^|[-_])(\w)/g;
@@ -6596,7 +6622,7 @@ const computed = (getterOrOptions, debugOptions) => {
6596
6622
  return c;
6597
6623
  };
6598
6624
 
6599
- const version = "3.4.27";
6625
+ const version = "3.4.29";
6600
6626
  const warn = warn$1 ;
6601
6627
  const _ssrUtils = {
6602
6628
  createComponentInstance: createComponentInstance$1,
@@ -6604,7 +6630,8 @@ const _ssrUtils = {
6604
6630
  renderComponentRoot: renderComponentRoot$1,
6605
6631
  setCurrentRenderingInstance: setCurrentRenderingInstance$1,
6606
6632
  isVNode: isVNode$2,
6607
- normalizeVNode: normalizeVNode$1
6633
+ normalizeVNode: normalizeVNode$1,
6634
+ getComponentPublicInstance
6608
6635
  };
6609
6636
  const ssrUtils = _ssrUtils ;
6610
6637
 
@@ -6623,7 +6650,7 @@ const nodeOps = {
6623
6650
  }
6624
6651
  },
6625
6652
  createElement: (tag, namespace, is, props) => {
6626
- const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
6653
+ const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
6627
6654
  if (tag === "select" && props && props.multiple != null) {
6628
6655
  el.setAttribute("multiple", props.multiple);
6629
6656
  }
@@ -6652,8 +6679,7 @@ const nodeOps = {
6652
6679
  if (start && (start === end || start.nextSibling)) {
6653
6680
  while (true) {
6654
6681
  parent.insertBefore(start.cloneNode(true), anchor);
6655
- if (start === end || !(start = start.nextSibling))
6656
- break;
6682
+ if (start === end || !(start = start.nextSibling)) break;
6657
6683
  }
6658
6684
  } else {
6659
6685
  templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
@@ -6752,8 +6778,7 @@ function setStyle(style, name, val) {
6752
6778
  if (isArray(val)) {
6753
6779
  val.forEach((v) => setStyle(style, name, v));
6754
6780
  } else {
6755
- if (val == null)
6756
- val = "";
6781
+ if (val == null) val = "";
6757
6782
  {
6758
6783
  if (semicolonRE.test(val)) {
6759
6784
  warn(
@@ -6799,7 +6824,7 @@ function autoPrefix(style, rawName) {
6799
6824
  }
6800
6825
 
6801
6826
  const xlinkNS = "http://www.w3.org/1999/xlink";
6802
- function patchAttr(el, key, value, isSVG, instance) {
6827
+ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
6803
6828
  if (isSVG && key.startsWith("xlink:")) {
6804
6829
  if (value == null) {
6805
6830
  el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
@@ -6807,11 +6832,10 @@ function patchAttr(el, key, value, isSVG, instance) {
6807
6832
  el.setAttributeNS(xlinkNS, key, value);
6808
6833
  }
6809
6834
  } else {
6810
- const isBoolean = isSpecialBooleanAttr(key);
6811
6835
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
6812
6836
  el.removeAttribute(key);
6813
6837
  } else {
6814
- el.setAttribute(key, isBoolean ? "" : value);
6838
+ el.setAttribute(key, isBoolean ? "" : String(value));
6815
6839
  }
6816
6840
  }
6817
6841
  }
@@ -6828,7 +6852,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
6828
6852
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
6829
6853
  !tag.includes("-")) {
6830
6854
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
6831
- const newValue = value == null ? "" : value;
6855
+ const newValue = value == null ? "" : String(value);
6832
6856
  if (oldValue !== newValue || !("_value" in el)) {
6833
6857
  el.value = newValue;
6834
6858
  }
@@ -6972,6 +6996,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
6972
6996
  parentSuspense,
6973
6997
  unmountChildren
6974
6998
  );
6999
+ if (key === "value" || key === "checked" || key === "selected") {
7000
+ patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
7001
+ }
6975
7002
  } else {
6976
7003
  if (key === "true-value") {
6977
7004
  el._trueValue = nextValue;
@@ -7035,8 +7062,7 @@ const vModelText = {
7035
7062
  el[assignKey] = getModelAssigner(vnode);
7036
7063
  const castToNumber = number || vnode.props && vnode.props.type === "number";
7037
7064
  addEventListener(el, lazy ? "change" : "input", (e) => {
7038
- if (e.target.composing)
7039
- return;
7065
+ if (e.target.composing) return;
7040
7066
  let domValue = el.value;
7041
7067
  if (trim) {
7042
7068
  domValue = domValue.trim();
@@ -7061,17 +7087,16 @@ const vModelText = {
7061
7087
  mounted(el, { value }) {
7062
7088
  el.value = value == null ? "" : value;
7063
7089
  },
7064
- beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
7090
+ beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
7065
7091
  el[assignKey] = getModelAssigner(vnode);
7066
- if (el.composing)
7067
- return;
7092
+ if (el.composing) return;
7068
7093
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
7069
7094
  const newValue = value == null ? "" : value;
7070
7095
  if (elValue === newValue) {
7071
7096
  return;
7072
7097
  }
7073
7098
  if (document.activeElement === el && el.type !== "range") {
7074
- if (lazy) {
7099
+ if (lazy && value === oldValue) {
7075
7100
  return;
7076
7101
  }
7077
7102
  if (trim && el.value.trim() === newValue) {
@@ -7189,8 +7214,7 @@ const createApp = (...args) => {
7189
7214
  const { mount } = app;
7190
7215
  app.mount = (containerOrSelector) => {
7191
7216
  const container = normalizeContainer(containerOrSelector);
7192
- if (!container)
7193
- return;
7217
+ if (!container) return;
7194
7218
  const component = app._component;
7195
7219
  if (!isFunction(component) && !component.render && !component.template) {
7196
7220
  component.template = container.innerHTML;
@@ -7397,13 +7421,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
7397
7421
  fallbackRenderFn();
7398
7422
  }
7399
7423
  }
7400
- const commentTestRE = /^<!--.*-->$/s;
7424
+ const commentTestRE = /^<!--[\s\S]*-->$/;
7401
7425
  const commentRE = /<!--[^]*?-->/gm;
7402
7426
  function isComment(item) {
7403
- if (typeof item !== "string" || !commentTestRE.test(item))
7404
- return false;
7405
- if (item.length <= 8)
7406
- return true;
7427
+ if (typeof item !== "string" || !commentTestRE.test(item)) return false;
7428
+ if (item.length <= 8) return true;
7407
7429
  return !item.replace(commentRE, "").trim();
7408
7430
  }
7409
7431
 
@@ -7473,7 +7495,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
7473
7495
  return dir.getSSRProps(
7474
7496
  {
7475
7497
  dir,
7476
- instance,
7498
+ instance: ssrUtils.getComponentPublicInstance(instance.$),
7477
7499
  value,
7478
7500
  oldValue: void 0,
7479
7501
  arg,
@@ -7615,9 +7637,11 @@ function renderComponentSubTree(instance, slotScopeId) {
7615
7637
  }
7616
7638
  }
7617
7639
  if (slotScopeId) {
7618
- if (!hasCloned)
7619
- attrs = { ...attrs };
7620
- attrs[slotScopeId.trim()] = "";
7640
+ if (!hasCloned) attrs = { ...attrs };
7641
+ const slotScopeIdList = slotScopeId.trim().split(" ");
7642
+ for (let i = 0; i < slotScopeIdList.length; i++) {
7643
+ attrs[slotScopeIdList[i]] = "";
7644
+ }
7621
7645
  }
7622
7646
  const prev = setCurrentRenderingInstance(instance);
7623
7647
  try {
@@ -7764,8 +7788,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
7764
7788
  } = binding;
7765
7789
  if (getSSRProps) {
7766
7790
  const props = getSSRProps(binding, vnode);
7767
- if (props)
7768
- toMerge.push(props);
7791
+ if (props) toMerge.push(props);
7769
7792
  }
7770
7793
  }
7771
7794
  return mergeProps(rawProps || {}, ...toMerge);
@@ -7950,8 +7973,7 @@ function renderToWebStream(input, context = {}) {
7950
7973
  start(controller) {
7951
7974
  renderToSimpleStream(input, context, {
7952
7975
  push(content) {
7953
- if (cancelled)
7954
- return;
7976
+ if (cancelled) return;
7955
7977
  if (content != null) {
7956
7978
  controller.enqueue(encoder.encode(content));
7957
7979
  } else {