@vue/runtime-core 3.2.36 → 3.2.39

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.
@@ -14,7 +14,7 @@ function warn(msg, ...args) {
14
14
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
15
15
  const trace = getComponentTrace();
16
16
  if (appWarnHandler) {
17
- callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
17
+ callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
18
18
  msg + args.join(''),
19
19
  instance && instance.proxy,
20
20
  trace
@@ -161,7 +161,7 @@ function handleError(err, instance, type, throwInDev = true) {
161
161
  // app-level handling
162
162
  const appErrorHandler = instance.appContext.config.errorHandler;
163
163
  if (appErrorHandler) {
164
- callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
164
+ callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
165
165
  return;
166
166
  }
167
167
  }
@@ -178,15 +178,11 @@ let isFlushing = false;
178
178
  let isFlushPending = false;
179
179
  const queue = [];
180
180
  let flushIndex = 0;
181
- const pendingPreFlushCbs = [];
182
- let activePreFlushCbs = null;
183
- let preFlushIndex = 0;
184
181
  const pendingPostFlushCbs = [];
185
182
  let activePostFlushCbs = null;
186
183
  let postFlushIndex = 0;
187
184
  const resolvedPromise = /*#__PURE__*/ Promise.resolve();
188
185
  let currentFlushPromise = null;
189
- let currentPreFlushParentJob = null;
190
186
  function nextTick(fn) {
191
187
  const p = currentFlushPromise || resolvedPromise;
192
188
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
@@ -213,9 +209,8 @@ function queueJob(job) {
213
209
  // if the job is a watch() callback, the search will start with a +1 index to
214
210
  // allow it recursively trigger itself - it is the user's responsibility to
215
211
  // ensure it doesn't end up in an infinite loop.
216
- if ((!queue.length ||
217
- !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
218
- job !== currentPreFlushParentJob) {
212
+ if (!queue.length ||
213
+ !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
219
214
  if (job.id == null) {
220
215
  queue.push(job);
221
216
  }
@@ -237,45 +232,34 @@ function invalidateJob(job) {
237
232
  queue.splice(i, 1);
238
233
  }
239
234
  }
240
- function queueCb(cb, activeQueue, pendingQueue, index) {
235
+ function queuePostFlushCb(cb) {
241
236
  if (!shared.isArray(cb)) {
242
- if (!activeQueue ||
243
- !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
244
- pendingQueue.push(cb);
237
+ if (!activePostFlushCbs ||
238
+ !activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
239
+ pendingPostFlushCbs.push(cb);
245
240
  }
246
241
  }
247
242
  else {
248
243
  // if cb is an array, it is a component lifecycle hook which can only be
249
244
  // triggered by a job, which is already deduped in the main queue, so
250
245
  // we can skip duplicate check here to improve perf
251
- pendingQueue.push(...cb);
246
+ pendingPostFlushCbs.push(...cb);
252
247
  }
253
248
  queueFlush();
254
249
  }
255
- function queuePreFlushCb(cb) {
256
- queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
257
- }
258
- function queuePostFlushCb(cb) {
259
- queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
260
- }
261
- function flushPreFlushCbs(seen, parentJob = null) {
262
- if (pendingPreFlushCbs.length) {
263
- currentPreFlushParentJob = parentJob;
264
- activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
265
- pendingPreFlushCbs.length = 0;
266
- for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
267
- activePreFlushCbs[preFlushIndex]();
250
+ function flushPreFlushCbs(seen,
251
+ // if currently flushing, skip the current job itself
252
+ i = isFlushing ? flushIndex + 1 : 0) {
253
+ for (; i < queue.length; i++) {
254
+ const cb = queue[i];
255
+ if (cb && cb.pre) {
256
+ queue.splice(i, 1);
257
+ i--;
258
+ cb();
268
259
  }
269
- activePreFlushCbs = null;
270
- preFlushIndex = 0;
271
- currentPreFlushParentJob = null;
272
- // recursively flush until it drains
273
- flushPreFlushCbs(seen, parentJob);
274
260
  }
275
261
  }
276
262
  function flushPostFlushCbs(seen) {
277
- // flush any pre cbs queued during the flush (e.g. pre watchers)
278
- flushPreFlushCbs();
279
263
  if (pendingPostFlushCbs.length) {
280
264
  const deduped = [...new Set(pendingPostFlushCbs)];
281
265
  pendingPostFlushCbs.length = 0;
@@ -294,10 +278,19 @@ function flushPostFlushCbs(seen) {
294
278
  }
295
279
  }
296
280
  const getId = (job) => job.id == null ? Infinity : job.id;
281
+ const comparator = (a, b) => {
282
+ const diff = getId(a) - getId(b);
283
+ if (diff === 0) {
284
+ if (a.pre && !b.pre)
285
+ return -1;
286
+ if (b.pre && !a.pre)
287
+ return 1;
288
+ }
289
+ return diff;
290
+ };
297
291
  function flushJobs(seen) {
298
292
  isFlushPending = false;
299
293
  isFlushing = true;
300
- flushPreFlushCbs(seen);
301
294
  // Sort queue before flush.
302
295
  // This ensures that:
303
296
  // 1. Components are updated from parent to child. (because parent is always
@@ -305,7 +298,7 @@ function flushJobs(seen) {
305
298
  // priority number)
306
299
  // 2. If a component is unmounted during a parent component's update,
307
300
  // its update can be skipped.
308
- queue.sort((a, b) => getId(a) - getId(b));
301
+ queue.sort(comparator);
309
302
  // conditional usage of checkRecursiveUpdate must be determined out of
310
303
  // try ... catch block since Rollup by default de-optimizes treeshaking
311
304
  // inside try-catch. This can leave all warning code unshaked. Although
@@ -318,7 +311,7 @@ function flushJobs(seen) {
318
311
  if (job && job.active !== false) {
319
312
  if (false && check(job)) ;
320
313
  // console.log(`running:`, job.id)
321
- callWithErrorHandling(job, null, 14 /* SCHEDULER */);
314
+ callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
322
315
  }
323
316
  }
324
317
  }
@@ -330,10 +323,8 @@ function flushJobs(seen) {
330
323
  currentFlushPromise = null;
331
324
  // some postFlushCb queued jobs!
332
325
  // keep flushing until it drains.
333
- if (queue.length ||
334
- pendingPreFlushCbs.length ||
335
- pendingPostFlushCbs.length) {
336
- flushJobs(seen);
326
+ if (queue.length || pendingPostFlushCbs.length) {
327
+ flushJobs();
337
328
  }
338
329
  }
339
330
  }
@@ -403,7 +394,7 @@ function emit(instance, event, ...rawArgs) {
403
394
  handler = props[(handlerName = shared.toHandlerKey(shared.hyphenate(event)))];
404
395
  }
405
396
  if (handler) {
406
- callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
397
+ callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
407
398
  }
408
399
  const onceHandler = props[handlerName + `Once`];
409
400
  if (onceHandler) {
@@ -414,7 +405,7 @@ function emit(instance, event, ...rawArgs) {
414
405
  return;
415
406
  }
416
407
  instance.emitted[handlerName] = true;
417
- callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
408
+ callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
418
409
  }
419
410
  }
420
411
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
@@ -446,7 +437,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
446
437
  }
447
438
  }
448
439
  if (!raw && !hasExtends) {
449
- cache.set(comp, null);
440
+ if (shared.isObject(comp)) {
441
+ cache.set(comp, null);
442
+ }
450
443
  return null;
451
444
  }
452
445
  if (shared.isArray(raw)) {
@@ -455,7 +448,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
455
448
  else {
456
449
  shared.extend(normalized, raw);
457
450
  }
458
- cache.set(comp, normalized);
451
+ if (shared.isObject(comp)) {
452
+ cache.set(comp, normalized);
453
+ }
459
454
  return normalized;
460
455
  }
461
456
  // Check if an incoming prop key is a declared emit event listener.
@@ -561,7 +556,7 @@ function renderComponentRoot(instance) {
561
556
  let fallthroughAttrs;
562
557
  const prev = setCurrentRenderingInstance(instance);
563
558
  try {
564
- if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
559
+ if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
565
560
  // withProxy is a proxy with a different `has` trap only for
566
561
  // runtime-compiled render functions using `with` block.
567
562
  const proxyToUse = withProxy || proxy;
@@ -592,7 +587,7 @@ function renderComponentRoot(instance) {
592
587
  }
593
588
  catch (err) {
594
589
  blockStack.length = 0;
595
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
590
+ handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
596
591
  result = createVNode(Comment);
597
592
  }
598
593
  // attr merging
@@ -603,7 +598,7 @@ function renderComponentRoot(instance) {
603
598
  const keys = Object.keys(fallthroughAttrs);
604
599
  const { shapeFlag } = root;
605
600
  if (keys.length) {
606
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
601
+ if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
607
602
  if (propsOptions && keys.some(shared.isModelListener)) {
608
603
  // If a v-model listener (onUpdate:xxx) has a corresponding declared
609
604
  // prop, it indicates this component expects to handle v-model and
@@ -680,19 +675,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
680
675
  return true;
681
676
  }
682
677
  if (optimized && patchFlag >= 0) {
683
- if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
678
+ if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
684
679
  // slot content that references values that might have changed,
685
680
  // e.g. in a v-for
686
681
  return true;
687
682
  }
688
- if (patchFlag & 16 /* FULL_PROPS */) {
683
+ if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
689
684
  if (!prevProps) {
690
685
  return !!nextProps;
691
686
  }
692
687
  // presence of this flag indicates props are always non-null
693
688
  return hasPropsChanged(prevProps, nextProps, emits);
694
689
  }
695
- else if (patchFlag & 8 /* PROPS */) {
690
+ else if (patchFlag & 8 /* PatchFlags.PROPS */) {
696
691
  const dynamicProps = nextVNode.dynamicProps;
697
692
  for (let i = 0; i < dynamicProps.length; i++) {
698
693
  const key = dynamicProps[i];
@@ -935,7 +930,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
935
930
  if (delayEnter) {
936
931
  activeBranch.transition.afterLeave = () => {
937
932
  if (pendingId === suspense.pendingId) {
938
- move(pendingBranch, container, anchor, 0 /* ENTER */);
933
+ move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
939
934
  }
940
935
  };
941
936
  }
@@ -950,7 +945,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
950
945
  }
951
946
  if (!delayEnter) {
952
947
  // move content from off-dom container to actual container
953
- move(pendingBranch, container, anchor, 0 /* ENTER */);
948
+ move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
954
949
  }
955
950
  }
956
951
  setActiveBranch(suspense, pendingBranch);
@@ -1024,7 +1019,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
1024
1019
  const hydratedEl = instance.vnode.el;
1025
1020
  instance
1026
1021
  .asyncDep.catch(err => {
1027
- handleError(err, instance, 0 /* SETUP_FUNCTION */);
1022
+ handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
1028
1023
  })
1029
1024
  .then(asyncSetupResult => {
1030
1025
  // retry when the setup() promise resolves.
@@ -1092,7 +1087,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
1092
1087
  }
1093
1088
  function normalizeSuspenseChildren(vnode) {
1094
1089
  const { shapeFlag, children } = vnode;
1095
- const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
1090
+ const isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
1096
1091
  vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
1097
1092
  vnode.ssFallback = isSlotChildren
1098
1093
  ? normalizeSuspenseSlot(children.fallback)
@@ -1232,7 +1227,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1232
1227
  return traverse(s);
1233
1228
  }
1234
1229
  else if (shared.isFunction(s)) {
1235
- return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
1230
+ return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
1236
1231
  }
1237
1232
  else ;
1238
1233
  });
@@ -1240,7 +1235,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1240
1235
  else if (shared.isFunction(source)) {
1241
1236
  if (cb) {
1242
1237
  // getter with cb
1243
- getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
1238
+ getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
1244
1239
  }
1245
1240
  else {
1246
1241
  // no cb -> simple effect
@@ -1251,7 +1246,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1251
1246
  if (cleanup) {
1252
1247
  cleanup();
1253
1248
  }
1254
- return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
1249
+ return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
1255
1250
  };
1256
1251
  }
1257
1252
  }
@@ -1265,7 +1260,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1265
1260
  let cleanup;
1266
1261
  let onCleanup = (fn) => {
1267
1262
  cleanup = effect.onStop = () => {
1268
- callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
1263
+ callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
1269
1264
  };
1270
1265
  };
1271
1266
  // in SSR there is no need to setup an actual effect, and it should be noop
@@ -1277,7 +1272,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1277
1272
  getter();
1278
1273
  }
1279
1274
  else if (immediate) {
1280
- callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
1275
+ callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1281
1276
  getter(),
1282
1277
  isMultiSource ? [] : undefined,
1283
1278
  onCleanup
@@ -1303,7 +1298,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1303
1298
  if (cleanup) {
1304
1299
  cleanup();
1305
1300
  }
1306
- callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
1301
+ callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1307
1302
  newValue,
1308
1303
  // pass undefined as the old value when it's changed for the first time
1309
1304
  oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
@@ -1329,7 +1324,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1329
1324
  }
1330
1325
  else {
1331
1326
  // default: 'pre'
1332
- scheduler = () => queuePreFlushCb(job);
1327
+ job.pre = true;
1328
+ if (instance)
1329
+ job.id = instance.uid;
1330
+ scheduler = () => queueJob(job);
1333
1331
  }
1334
1332
  const effect = new reactivity.ReactiveEffect(getter, scheduler);
1335
1333
  // initial run
@@ -1392,7 +1390,7 @@ function createPathGetter(ctx, path) {
1392
1390
  };
1393
1391
  }
1394
1392
  function traverse(value, seen) {
1395
- if (!shared.isObject(value) || value["__v_skip" /* SKIP */]) {
1393
+ if (!shared.isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
1396
1394
  return value;
1397
1395
  }
1398
1396
  seen = seen || new Set();
@@ -1562,7 +1560,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
1562
1560
  const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1563
1561
  const callHook = (hook, args) => {
1564
1562
  hook &&
1565
- callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
1563
+ callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
1566
1564
  };
1567
1565
  const callAsyncHook = (hook, args) => {
1568
1566
  const done = args[1];
@@ -1698,10 +1696,10 @@ function getKeepAliveChild(vnode) {
1698
1696
  : vnode;
1699
1697
  }
1700
1698
  function setTransitionHooks(vnode, hooks) {
1701
- if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
1699
+ if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
1702
1700
  setTransitionHooks(vnode.component.subTree, hooks);
1703
1701
  }
1704
- else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
1702
+ else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
1705
1703
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1706
1704
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1707
1705
  }
@@ -1720,7 +1718,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1720
1718
  : String(parentKey) + String(child.key != null ? child.key : i);
1721
1719
  // handle fragment children case, e.g. v-for
1722
1720
  if (child.type === Fragment) {
1723
- if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
1721
+ if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */)
1724
1722
  keyedFragmentCount++;
1725
1723
  ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
1726
1724
  }
@@ -1735,7 +1733,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1735
1733
  // these children to force full diffs to ensure correct behavior.
1736
1734
  if (keyedFragmentCount > 1) {
1737
1735
  for (let i = 0; i < ret.length; i++) {
1738
- ret[i].patchFlag = -2 /* BAIL */;
1736
+ ret[i].patchFlag = -2 /* PatchFlags.BAIL */;
1739
1737
  }
1740
1738
  }
1741
1739
  return ret;
@@ -1806,7 +1804,7 @@ function defineAsyncComponent(source) {
1806
1804
  }
1807
1805
  const onError = (err) => {
1808
1806
  pendingRequest = null;
1809
- handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
1807
+ handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
1810
1808
  };
1811
1809
  // suspense-controlled or SSR.
1812
1810
  if ((suspensible && instance.suspense) ||
@@ -1913,7 +1911,7 @@ const KeepAliveImpl = {
1913
1911
  const storageContainer = createElement('div');
1914
1912
  sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
1915
1913
  const instance = vnode.component;
1916
- move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
1914
+ move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
1917
1915
  // in case props have changed
1918
1916
  patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
1919
1917
  queuePostRenderEffect(() => {
@@ -1929,7 +1927,7 @@ const KeepAliveImpl = {
1929
1927
  };
1930
1928
  sharedContext.deactivate = (vnode) => {
1931
1929
  const instance = vnode.component;
1932
- move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
1930
+ move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
1933
1931
  queuePostRenderEffect(() => {
1934
1932
  if (instance.da) {
1935
1933
  shared.invokeArrayFns(instance.da);
@@ -2011,8 +2009,8 @@ const KeepAliveImpl = {
2011
2009
  return children;
2012
2010
  }
2013
2011
  else if (!isVNode(rawVNode) ||
2014
- (!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
2015
- !(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
2012
+ (!(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) &&
2013
+ !(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */))) {
2016
2014
  current = null;
2017
2015
  return rawVNode;
2018
2016
  }
@@ -2034,7 +2032,7 @@ const KeepAliveImpl = {
2034
2032
  // clone vnode if it's reused because we are going to mutate it
2035
2033
  if (vnode.el) {
2036
2034
  vnode = cloneVNode(vnode);
2037
- if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
2035
+ if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
2038
2036
  rawVNode.ssContent = vnode;
2039
2037
  }
2040
2038
  }
@@ -2053,7 +2051,7 @@ const KeepAliveImpl = {
2053
2051
  setTransitionHooks(vnode, vnode.transition);
2054
2052
  }
2055
2053
  // avoid vnode being mounted as fresh
2056
- vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
2054
+ vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2057
2055
  // make this key the freshest
2058
2056
  keys.delete(key);
2059
2057
  keys.add(key);
@@ -2066,7 +2064,7 @@ const KeepAliveImpl = {
2066
2064
  }
2067
2065
  }
2068
2066
  // avoid vnode being unmounted
2069
- vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
2067
+ vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2070
2068
  current = vnode;
2071
2069
  return isSuspense(rawVNode.type) ? rawVNode : vnode;
2072
2070
  };
@@ -2089,10 +2087,10 @@ function matches(pattern, name) {
2089
2087
  return false;
2090
2088
  }
2091
2089
  function onActivated(hook, target) {
2092
- registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
2090
+ registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
2093
2091
  }
2094
2092
  function onDeactivated(hook, target) {
2095
- registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
2093
+ registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
2096
2094
  }
2097
2095
  function registerKeepAliveHook(hook, type, target = currentInstance) {
2098
2096
  // cache the deactivate branch check wrapper for injected hooks so the same
@@ -2136,16 +2134,16 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2136
2134
  }
2137
2135
  function resetShapeFlag(vnode) {
2138
2136
  let shapeFlag = vnode.shapeFlag;
2139
- if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
2140
- shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
2137
+ if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2138
+ shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2141
2139
  }
2142
- if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
2143
- shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
2140
+ if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2141
+ shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2144
2142
  }
2145
2143
  vnode.shapeFlag = shapeFlag;
2146
2144
  }
2147
2145
  function getInnerChild(vnode) {
2148
- return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
2146
+ return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
2149
2147
  }
2150
2148
 
2151
2149
  function injectHook(type, hook, target = currentInstance, prepend = false) {
@@ -2182,19 +2180,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2182
2180
  }
2183
2181
  const createHook = (lifecycle) => (hook, target = currentInstance) =>
2184
2182
  // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
2185
- (!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
2183
+ (!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
2186
2184
  injectHook(lifecycle, hook, target);
2187
- const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
2188
- const onMounted = createHook("m" /* MOUNTED */);
2189
- const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
2190
- const onUpdated = createHook("u" /* UPDATED */);
2191
- const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
2192
- const onUnmounted = createHook("um" /* UNMOUNTED */);
2193
- const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
2194
- const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
2195
- const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
2185
+ const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
2186
+ const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
2187
+ const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
2188
+ const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
2189
+ const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
2190
+ const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
2191
+ const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
2192
+ const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
2193
+ const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
2196
2194
  function onErrorCaptured(hook, target = currentInstance) {
2197
- injectHook("ec" /* ERROR_CAPTURED */, hook, target);
2195
+ injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
2198
2196
  }
2199
2197
 
2200
2198
  /**
@@ -2255,7 +2253,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2255
2253
  // disable tracking inside all lifecycle hooks
2256
2254
  // since they can potentially be called inside effects.
2257
2255
  reactivity.pauseTracking();
2258
- callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
2256
+ callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
2259
2257
  vnode.el,
2260
2258
  binding,
2261
2259
  vnode,
@@ -2300,7 +2298,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
2300
2298
  const Component = instance.type;
2301
2299
  // explicit self name has highest priority
2302
2300
  if (type === COMPONENTS) {
2303
- const selfName = getComponentName(Component);
2301
+ const selfName = getComponentName(Component, false /* do not include inferred name to avoid breaking existing code */);
2304
2302
  if (selfName &&
2305
2303
  (selfName === name ||
2306
2304
  selfName === shared.camelize(name) ||
@@ -2383,7 +2381,13 @@ function createSlots(slots, dynamicSlots) {
2383
2381
  }
2384
2382
  else if (slot) {
2385
2383
  // conditional single slot generated by <template v-if="..." #foo>
2386
- slots[slot.name] = slot.fn;
2384
+ slots[slot.name] = slot.key
2385
+ ? (...args) => {
2386
+ const res = slot.fn(...args);
2387
+ res.key = slot.key;
2388
+ return res;
2389
+ }
2390
+ : slot.fn;
2387
2391
  }
2388
2392
  }
2389
2393
  return slots;
@@ -2413,9 +2417,15 @@ fallback, noSlotted) {
2413
2417
  }
2414
2418
  openBlock();
2415
2419
  const validSlotContent = slot && ensureValidVNode(slot(props));
2416
- const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
2417
- ? 64 /* STABLE_FRAGMENT */
2418
- : -2 /* BAIL */);
2420
+ const rendered = createBlock(Fragment, {
2421
+ key: props.key ||
2422
+ // slot content array of a dynamic conditional slot may have a branch
2423
+ // key attached in the `createSlots` helper, respect that
2424
+ (validSlotContent && validSlotContent.key) ||
2425
+ `_${name}`
2426
+ }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */
2427
+ ? 64 /* PatchFlags.STABLE_FRAGMENT */
2428
+ : -2 /* PatchFlags.BAIL */);
2419
2429
  if (!noSlotted && rendered.scopeId) {
2420
2430
  rendered.slotScopeIds = [rendered.scopeId + '-s'];
2421
2431
  }
@@ -2443,10 +2453,12 @@ function ensureValidVNode(vnodes) {
2443
2453
  * For prefixing keys in v-on="obj" with "on"
2444
2454
  * @private
2445
2455
  */
2446
- function toHandlers(obj) {
2456
+ function toHandlers(obj, preserveCaseIfNecessary) {
2447
2457
  const ret = {};
2448
2458
  for (const key in obj) {
2449
- ret[shared.toHandlerKey(key)] = obj[key];
2459
+ ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
2460
+ ? `on:${key}`
2461
+ : shared.toHandlerKey(key)] = obj[key];
2450
2462
  }
2451
2463
  return ret;
2452
2464
  }
@@ -2496,23 +2508,23 @@ const PublicInstanceProxyHandlers = {
2496
2508
  const n = accessCache[key];
2497
2509
  if (n !== undefined) {
2498
2510
  switch (n) {
2499
- case 1 /* SETUP */:
2511
+ case 1 /* AccessTypes.SETUP */:
2500
2512
  return setupState[key];
2501
- case 2 /* DATA */:
2513
+ case 2 /* AccessTypes.DATA */:
2502
2514
  return data[key];
2503
- case 4 /* CONTEXT */:
2515
+ case 4 /* AccessTypes.CONTEXT */:
2504
2516
  return ctx[key];
2505
- case 3 /* PROPS */:
2517
+ case 3 /* AccessTypes.PROPS */:
2506
2518
  return props[key];
2507
2519
  // default: just fallthrough
2508
2520
  }
2509
2521
  }
2510
2522
  else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
2511
- accessCache[key] = 1 /* SETUP */;
2523
+ accessCache[key] = 1 /* AccessTypes.SETUP */;
2512
2524
  return setupState[key];
2513
2525
  }
2514
2526
  else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
2515
- accessCache[key] = 2 /* DATA */;
2527
+ accessCache[key] = 2 /* AccessTypes.DATA */;
2516
2528
  return data[key];
2517
2529
  }
2518
2530
  else if (
@@ -2520,15 +2532,15 @@ const PublicInstanceProxyHandlers = {
2520
2532
  // props
2521
2533
  (normalizedProps = instance.propsOptions[0]) &&
2522
2534
  shared.hasOwn(normalizedProps, key)) {
2523
- accessCache[key] = 3 /* PROPS */;
2535
+ accessCache[key] = 3 /* AccessTypes.PROPS */;
2524
2536
  return props[key];
2525
2537
  }
2526
2538
  else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
2527
- accessCache[key] = 4 /* CONTEXT */;
2539
+ accessCache[key] = 4 /* AccessTypes.CONTEXT */;
2528
2540
  return ctx[key];
2529
2541
  }
2530
2542
  else if (shouldCacheAccess) {
2531
- accessCache[key] = 0 /* OTHER */;
2543
+ accessCache[key] = 0 /* AccessTypes.OTHER */;
2532
2544
  }
2533
2545
  }
2534
2546
  const publicGetter = publicPropertiesMap[key];
@@ -2536,7 +2548,7 @@ const PublicInstanceProxyHandlers = {
2536
2548
  // public $xxx properties
2537
2549
  if (publicGetter) {
2538
2550
  if (key === '$attrs') {
2539
- reactivity.track(instance, "get" /* GET */, key);
2551
+ reactivity.track(instance, "get" /* TrackOpTypes.GET */, key);
2540
2552
  }
2541
2553
  return publicGetter(instance);
2542
2554
  }
@@ -2548,7 +2560,7 @@ const PublicInstanceProxyHandlers = {
2548
2560
  }
2549
2561
  else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
2550
2562
  // user may set custom properties to `this` that start with `$`
2551
- accessCache[key] = 4 /* CONTEXT */;
2563
+ accessCache[key] = 4 /* AccessTypes.CONTEXT */;
2552
2564
  return ctx[key];
2553
2565
  }
2554
2566
  else if (
@@ -2629,7 +2641,7 @@ function applyOptions(instance) {
2629
2641
  // call beforeCreate first before accessing other options since
2630
2642
  // the hook may mutate resolved options (#2791)
2631
2643
  if (options.beforeCreate) {
2632
- callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
2644
+ callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
2633
2645
  }
2634
2646
  const {
2635
2647
  // state
@@ -2710,7 +2722,7 @@ function applyOptions(instance) {
2710
2722
  });
2711
2723
  }
2712
2724
  if (created) {
2713
- callHook(created, instance, "c" /* CREATED */);
2725
+ callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
2714
2726
  }
2715
2727
  function registerLifecycleHook(register, hook) {
2716
2728
  if (shared.isArray(hook)) {
@@ -2856,7 +2868,9 @@ function resolveMergedOptions(instance) {
2856
2868
  }
2857
2869
  mergeOptions(resolved, base, optionMergeStrategies);
2858
2870
  }
2859
- cache.set(base, resolved);
2871
+ if (shared.isObject(base)) {
2872
+ cache.set(base, resolved);
2873
+ }
2860
2874
  return resolved;
2861
2875
  }
2862
2876
  function mergeOptions(to, from, strats, asMixin = false) {
@@ -2988,8 +3002,8 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
2988
3002
  // - #1942 if hmr is enabled with sfc component
2989
3003
  // - vite#872 non-sfc component used by sfc component
2990
3004
  (optimized || patchFlag > 0) &&
2991
- !(patchFlag & 16 /* FULL_PROPS */)) {
2992
- if (patchFlag & 8 /* PROPS */) {
3005
+ !(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
3006
+ if (patchFlag & 8 /* PatchFlags.PROPS */) {
2993
3007
  // Compiler-generated props & no keys change, just set the updated
2994
3008
  // the props.
2995
3009
  const propsToUpdate = instance.vnode.dynamicProps;
@@ -3068,7 +3082,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3068
3082
  }
3069
3083
  // trigger updates for $attrs in case it's used in component slots
3070
3084
  if (hasAttrsChanged) {
3071
- reactivity.trigger(instance, "set" /* SET */, '$attrs');
3085
+ reactivity.trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
3072
3086
  }
3073
3087
  }
3074
3088
  function setFullProps(instance, rawProps, props, attrs) {
@@ -3134,11 +3148,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3134
3148
  }
3135
3149
  }
3136
3150
  // boolean casting
3137
- if (opt[0 /* shouldCast */]) {
3151
+ if (opt[0 /* BooleanFlags.shouldCast */]) {
3138
3152
  if (isAbsent && !hasDefault) {
3139
3153
  value = false;
3140
3154
  }
3141
- else if (opt[1 /* shouldCastTrue */] &&
3155
+ else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
3142
3156
  (value === '' || value === shared.hyphenate(key))) {
3143
3157
  value = true;
3144
3158
  }
@@ -3176,7 +3190,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3176
3190
  }
3177
3191
  }
3178
3192
  if (!raw && !hasExtends) {
3179
- cache.set(comp, shared.EMPTY_ARR);
3193
+ if (shared.isObject(comp)) {
3194
+ cache.set(comp, shared.EMPTY_ARR);
3195
+ }
3180
3196
  return shared.EMPTY_ARR;
3181
3197
  }
3182
3198
  if (shared.isArray(raw)) {
@@ -3197,8 +3213,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3197
3213
  if (prop) {
3198
3214
  const booleanIndex = getTypeIndex(Boolean, prop.type);
3199
3215
  const stringIndex = getTypeIndex(String, prop.type);
3200
- prop[0 /* shouldCast */] = booleanIndex > -1;
3201
- prop[1 /* shouldCastTrue */] =
3216
+ prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
3217
+ prop[1 /* BooleanFlags.shouldCastTrue */] =
3202
3218
  stringIndex < 0 || booleanIndex < stringIndex;
3203
3219
  // if the prop needs boolean casting or default value
3204
3220
  if (booleanIndex > -1 || shared.hasOwn(prop, 'default')) {
@@ -3209,7 +3225,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3209
3225
  }
3210
3226
  }
3211
3227
  const res = [normalized, needCastKeys];
3212
- cache.set(comp, res);
3228
+ if (shared.isObject(comp)) {
3229
+ cache.set(comp, res);
3230
+ }
3213
3231
  return res;
3214
3232
  }
3215
3233
  function validatePropName(key) {
@@ -3272,7 +3290,7 @@ const normalizeVNodeSlots = (instance, children) => {
3272
3290
  instance.slots.default = () => normalized;
3273
3291
  };
3274
3292
  const initSlots = (instance, children) => {
3275
- if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
3293
+ if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
3276
3294
  const type = children._;
3277
3295
  if (type) {
3278
3296
  // users can get the shallow readonly version of the slots object through `this.$slots`,
@@ -3297,11 +3315,11 @@ const updateSlots = (instance, children, optimized) => {
3297
3315
  const { vnode, slots } = instance;
3298
3316
  let needDeletionCheck = true;
3299
3317
  let deletionComparisonTarget = shared.EMPTY_OBJ;
3300
- if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
3318
+ if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
3301
3319
  const type = children._;
3302
3320
  if (type) {
3303
3321
  // compiled slots.
3304
- if (optimized && type === 1 /* STABLE */) {
3322
+ if (optimized && type === 1 /* SlotFlags.STABLE */) {
3305
3323
  // compiled AND stable.
3306
3324
  // no need to update, and skip stale slots removal.
3307
3325
  needDeletionCheck = false;
@@ -3314,7 +3332,7 @@ const updateSlots = (instance, children, optimized) => {
3314
3332
  // when rendering the optimized slots by manually written render function,
3315
3333
  // we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
3316
3334
  // i.e. let the `renderSlot` create the bailed Fragment
3317
- if (!optimized && type === 1 /* STABLE */) {
3335
+ if (!optimized && type === 1 /* SlotFlags.STABLE */) {
3318
3336
  delete slots._;
3319
3337
  }
3320
3338
  }
@@ -3467,7 +3485,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3467
3485
  // because the template ref is forwarded to inner component
3468
3486
  return;
3469
3487
  }
3470
- const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
3488
+ const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
3471
3489
  ? getExposeProxy(vnode.component) || vnode.component.proxy
3472
3490
  : vnode.el;
3473
3491
  const value = isUnmount ? null : refValue;
@@ -3488,7 +3506,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3488
3506
  }
3489
3507
  }
3490
3508
  if (shared.isFunction(ref)) {
3491
- callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
3509
+ callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
3492
3510
  }
3493
3511
  else {
3494
3512
  const _isString = shared.isString(ref);
@@ -3525,7 +3543,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3525
3543
  setupState[ref] = value;
3526
3544
  }
3527
3545
  }
3528
- else if (reactivity.isRef(ref)) {
3546
+ else if (_isRef) {
3529
3547
  ref.value = value;
3530
3548
  if (rawRef.k)
3531
3549
  refs[rawRef.k] = value;
@@ -3545,7 +3563,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3545
3563
 
3546
3564
  let hasMismatch = false;
3547
3565
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
3548
- const isComment = (node) => node.nodeType === 8 /* COMMENT */;
3566
+ const isComment = (node) => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
3549
3567
  // Note: hydration is DOM-specific
3550
3568
  // But we have to place it in core due to tight coupling with core - splitting
3551
3569
  // it out creates a ton of unnecessary complexity.
@@ -3557,11 +3575,13 @@ function createHydrationFunctions(rendererInternals) {
3557
3575
  if (!container.hasChildNodes()) {
3558
3576
  patch(null, vnode, container);
3559
3577
  flushPostFlushCbs();
3578
+ container._vnode = vnode;
3560
3579
  return;
3561
3580
  }
3562
3581
  hasMismatch = false;
3563
3582
  hydrateNode(container.firstChild, vnode, null, null, null);
3564
3583
  flushPostFlushCbs();
3584
+ container._vnode = vnode;
3565
3585
  if (hasMismatch && !false) {
3566
3586
  // this error should show up in production
3567
3587
  console.error(`Hydration completed but contains mismatches.`);
@@ -3573,14 +3593,14 @@ function createHydrationFunctions(rendererInternals) {
3573
3593
  const { type, ref, shapeFlag, patchFlag } = vnode;
3574
3594
  const domType = node.nodeType;
3575
3595
  vnode.el = node;
3576
- if (patchFlag === -2 /* BAIL */) {
3596
+ if (patchFlag === -2 /* PatchFlags.BAIL */) {
3577
3597
  optimized = false;
3578
3598
  vnode.dynamicChildren = null;
3579
3599
  }
3580
3600
  let nextNode = null;
3581
3601
  switch (type) {
3582
3602
  case Text:
3583
- if (domType !== 3 /* TEXT */) {
3603
+ if (domType !== 3 /* DOMNodeTypes.TEXT */) {
3584
3604
  // #5728 empty text node inside a slot can cause hydration failure
3585
3605
  // because the server rendered HTML won't contain a text node
3586
3606
  if (vnode.children === '') {
@@ -3600,7 +3620,7 @@ function createHydrationFunctions(rendererInternals) {
3600
3620
  }
3601
3621
  break;
3602
3622
  case Comment:
3603
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
3623
+ if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
3604
3624
  nextNode = onMismatch();
3605
3625
  }
3606
3626
  else {
@@ -3608,7 +3628,7 @@ function createHydrationFunctions(rendererInternals) {
3608
3628
  }
3609
3629
  break;
3610
3630
  case Static:
3611
- if (domType !== 1 /* ELEMENT */) {
3631
+ if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
3612
3632
  nextNode = onMismatch();
3613
3633
  }
3614
3634
  else {
@@ -3619,7 +3639,10 @@ function createHydrationFunctions(rendererInternals) {
3619
3639
  const needToAdoptContent = !vnode.children.length;
3620
3640
  for (let i = 0; i < vnode.staticCount; i++) {
3621
3641
  if (needToAdoptContent)
3622
- vnode.children += nextNode.outerHTML;
3642
+ vnode.children +=
3643
+ nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
3644
+ ? nextNode.outerHTML
3645
+ : nextNode.data;
3623
3646
  if (i === vnode.staticCount - 1) {
3624
3647
  vnode.anchor = nextNode;
3625
3648
  }
@@ -3637,8 +3660,8 @@ function createHydrationFunctions(rendererInternals) {
3637
3660
  }
3638
3661
  break;
3639
3662
  default:
3640
- if (shapeFlag & 1 /* ELEMENT */) {
3641
- if (domType !== 1 /* ELEMENT */ ||
3663
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
3664
+ if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
3642
3665
  vnode.type.toLowerCase() !==
3643
3666
  node.tagName.toLowerCase()) {
3644
3667
  nextNode = onMismatch();
@@ -3647,7 +3670,7 @@ function createHydrationFunctions(rendererInternals) {
3647
3670
  nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3648
3671
  }
3649
3672
  }
3650
- else if (shapeFlag & 6 /* COMPONENT */) {
3673
+ else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
3651
3674
  // when setting up the render effect, if the initial vnode already
3652
3675
  // has .el set, the component will perform hydration instead of mount
3653
3676
  // on its sub-tree.
@@ -3686,15 +3709,15 @@ function createHydrationFunctions(rendererInternals) {
3686
3709
  vnode.component.subTree = subTree;
3687
3710
  }
3688
3711
  }
3689
- else if (shapeFlag & 64 /* TELEPORT */) {
3690
- if (domType !== 8 /* COMMENT */) {
3712
+ else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
3713
+ if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
3691
3714
  nextNode = onMismatch();
3692
3715
  }
3693
3716
  else {
3694
3717
  nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
3695
3718
  }
3696
3719
  }
3697
- else if (shapeFlag & 128 /* SUSPENSE */) {
3720
+ else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
3698
3721
  nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
3699
3722
  }
3700
3723
  else ;
@@ -3712,7 +3735,7 @@ function createHydrationFunctions(rendererInternals) {
3712
3735
  const forcePatchValue = (type === 'input' && dirs) || type === 'option';
3713
3736
  // skip props & children if this is hoisted static nodes
3714
3737
  // #5405 in dev, always hydrate children for HMR
3715
- if (forcePatchValue || patchFlag !== -1 /* HOISTED */) {
3738
+ if (forcePatchValue || patchFlag !== -1 /* PatchFlags.HOISTED */) {
3716
3739
  if (dirs) {
3717
3740
  invokeDirectiveHook(vnode, null, parentComponent, 'created');
3718
3741
  }
@@ -3720,7 +3743,7 @@ function createHydrationFunctions(rendererInternals) {
3720
3743
  if (props) {
3721
3744
  if (forcePatchValue ||
3722
3745
  !optimized ||
3723
- patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
3746
+ patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
3724
3747
  for (const key in props) {
3725
3748
  if ((forcePatchValue && key.endsWith('value')) ||
3726
3749
  (shared.isOn(key) && !shared.isReservedProp(key))) {
@@ -3749,7 +3772,7 @@ function createHydrationFunctions(rendererInternals) {
3749
3772
  }, parentSuspense);
3750
3773
  }
3751
3774
  // children
3752
- if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
3775
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
3753
3776
  // skip if element has innerHTML / textContent
3754
3777
  !(props && (props.innerHTML || props.textContent))) {
3755
3778
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -3761,7 +3784,7 @@ function createHydrationFunctions(rendererInternals) {
3761
3784
  remove(cur);
3762
3785
  }
3763
3786
  }
3764
- else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
3787
+ else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
3765
3788
  if (el.textContent !== vnode.children) {
3766
3789
  hasMismatch = true;
3767
3790
  el.textContent = vnode.children;
@@ -3900,7 +3923,7 @@ function baseCreateRenderer(options, createHydrationFns) {
3900
3923
  unmount(n1, parentComponent, parentSuspense, true);
3901
3924
  n1 = null;
3902
3925
  }
3903
- if (n2.patchFlag === -2 /* BAIL */) {
3926
+ if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
3904
3927
  optimized = false;
3905
3928
  n2.dynamicChildren = null;
3906
3929
  }
@@ -3921,16 +3944,16 @@ function baseCreateRenderer(options, createHydrationFns) {
3921
3944
  processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
3922
3945
  break;
3923
3946
  default:
3924
- if (shapeFlag & 1 /* ELEMENT */) {
3947
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
3925
3948
  processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
3926
3949
  }
3927
- else if (shapeFlag & 6 /* COMPONENT */) {
3950
+ else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
3928
3951
  processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
3929
3952
  }
3930
- else if (shapeFlag & 64 /* TELEPORT */) {
3953
+ else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
3931
3954
  type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
3932
3955
  }
3933
- else if (shapeFlag & 128 /* SUSPENSE */) {
3956
+ else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
3934
3957
  type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
3935
3958
  }
3936
3959
  else ;
@@ -3996,7 +4019,7 @@ function baseCreateRenderer(options, createHydrationFns) {
3996
4019
  const { type, props, shapeFlag, transition, patchFlag, dirs } = vnode;
3997
4020
  if (vnode.el &&
3998
4021
  hostCloneNode !== undefined &&
3999
- patchFlag === -1 /* HOISTED */) {
4022
+ patchFlag === -1 /* PatchFlags.HOISTED */) {
4000
4023
  // If a vnode has non-null el, it means it's being reused.
4001
4024
  // Only static vnodes can be reused, so its mounted DOM nodes should be
4002
4025
  // exactly the same, and we can simply do a clone here.
@@ -4007,10 +4030,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4007
4030
  el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
4008
4031
  // mount children first, since some props may rely on child content
4009
4032
  // being already rendered, e.g. `<select value>`
4010
- if (shapeFlag & 8 /* TEXT_CHILDREN */) {
4033
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
4011
4034
  hostSetElementText(el, vnode.children);
4012
4035
  }
4013
- else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
4036
+ else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4014
4037
  mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
4015
4038
  }
4016
4039
  if (dirs) {
@@ -4094,7 +4117,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4094
4117
  let { patchFlag, dynamicChildren, dirs } = n2;
4095
4118
  // #1426 take the old vnode's patch flag into account since user may clone a
4096
4119
  // compiler-generated vnode, which de-opts to FULL_PROPS
4097
- patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
4120
+ patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
4098
4121
  const oldProps = n1.props || shared.EMPTY_OBJ;
4099
4122
  const newProps = n2.props || shared.EMPTY_OBJ;
4100
4123
  let vnodeHook;
@@ -4120,21 +4143,21 @@ function baseCreateRenderer(options, createHydrationFns) {
4120
4143
  // generated by the compiler and can take the fast path.
4121
4144
  // in this path old node and new node are guaranteed to have the same shape
4122
4145
  // (i.e. at the exact same position in the source template)
4123
- if (patchFlag & 16 /* FULL_PROPS */) {
4146
+ if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
4124
4147
  // element props contain dynamic keys, full diff needed
4125
4148
  patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
4126
4149
  }
4127
4150
  else {
4128
4151
  // class
4129
4152
  // this flag is matched when the element has dynamic class bindings.
4130
- if (patchFlag & 2 /* CLASS */) {
4153
+ if (patchFlag & 2 /* PatchFlags.CLASS */) {
4131
4154
  if (oldProps.class !== newProps.class) {
4132
4155
  hostPatchProp(el, 'class', null, newProps.class, isSVG);
4133
4156
  }
4134
4157
  }
4135
4158
  // style
4136
4159
  // this flag is matched when the element has dynamic style bindings
4137
- if (patchFlag & 4 /* STYLE */) {
4160
+ if (patchFlag & 4 /* PatchFlags.STYLE */) {
4138
4161
  hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
4139
4162
  }
4140
4163
  // props
@@ -4143,7 +4166,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4143
4166
  // faster iteration.
4144
4167
  // Note dynamic keys like :[foo]="bar" will cause this optimization to
4145
4168
  // bail out and go through a full diff because we need to unset the old key
4146
- if (patchFlag & 8 /* PROPS */) {
4169
+ if (patchFlag & 8 /* PatchFlags.PROPS */) {
4147
4170
  // if the flag is present then dynamicProps must be non-null
4148
4171
  const propsToUpdate = n2.dynamicProps;
4149
4172
  for (let i = 0; i < propsToUpdate.length; i++) {
@@ -4159,7 +4182,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4159
4182
  }
4160
4183
  // text
4161
4184
  // This flag is matched when the element has only dynamic text children.
4162
- if (patchFlag & 1 /* TEXT */) {
4185
+ if (patchFlag & 1 /* PatchFlags.TEXT */) {
4163
4186
  if (n1.children !== n2.children) {
4164
4187
  hostSetElementText(el, n2.children);
4165
4188
  }
@@ -4193,7 +4216,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4193
4216
  // which also requires the correct parent container
4194
4217
  !isSameVNodeType(oldVNode, newVNode) ||
4195
4218
  // - In the case of a component, it could contain anything.
4196
- oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
4219
+ oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
4197
4220
  ? hostParentNode(oldVNode.el)
4198
4221
  : // In other cases, the parent container is not actually used so we
4199
4222
  // just pass the block element here to avoid a DOM parentNode call.
@@ -4246,7 +4269,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4246
4269
  }
4247
4270
  else {
4248
4271
  if (patchFlag > 0 &&
4249
- patchFlag & 64 /* STABLE_FRAGMENT */ &&
4272
+ patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
4250
4273
  dynamicChildren &&
4251
4274
  // #2715 the previous fragment could've been a BAILed one as a result
4252
4275
  // of renderSlot() with no valid children
@@ -4276,7 +4299,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4276
4299
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
4277
4300
  n2.slotScopeIds = slotScopeIds;
4278
4301
  if (n1 == null) {
4279
- if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
4302
+ if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
4280
4303
  parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
4281
4304
  }
4282
4305
  else {
@@ -4389,10 +4412,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4389
4412
  // activated hook for keep-alive roots.
4390
4413
  // #1742 activated hook must be accessed after first render
4391
4414
  // since the hook may be injected by a child keep-alive
4392
- if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
4415
+ if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
4393
4416
  (parent &&
4394
4417
  isAsyncWrapper(parent.vnode) &&
4395
- parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
4418
+ parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
4396
4419
  instance.a && queuePostRenderEffect(instance.a, parentSuspense);
4397
4420
  }
4398
4421
  instance.isMounted = true;
@@ -4469,7 +4492,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4469
4492
  reactivity.pauseTracking();
4470
4493
  // props update may have triggered pre-flush watchers.
4471
4494
  // flush them before the render update.
4472
- flushPreFlushCbs(undefined, instance.update);
4495
+ flushPreFlushCbs();
4473
4496
  reactivity.resetTracking();
4474
4497
  };
4475
4498
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -4479,22 +4502,22 @@ function baseCreateRenderer(options, createHydrationFns) {
4479
4502
  const { patchFlag, shapeFlag } = n2;
4480
4503
  // fast path
4481
4504
  if (patchFlag > 0) {
4482
- if (patchFlag & 128 /* KEYED_FRAGMENT */) {
4505
+ if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
4483
4506
  // this could be either fully-keyed or mixed (some keyed some not)
4484
4507
  // presence of patchFlag means children are guaranteed to be arrays
4485
4508
  patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
4486
4509
  return;
4487
4510
  }
4488
- else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
4511
+ else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
4489
4512
  // unkeyed
4490
4513
  patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
4491
4514
  return;
4492
4515
  }
4493
4516
  }
4494
4517
  // children has 3 possibilities: text, array or no children.
4495
- if (shapeFlag & 8 /* TEXT_CHILDREN */) {
4518
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
4496
4519
  // text children fast path
4497
- if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
4520
+ if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4498
4521
  unmountChildren(c1, parentComponent, parentSuspense);
4499
4522
  }
4500
4523
  if (c2 !== c1) {
@@ -4502,9 +4525,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4502
4525
  }
4503
4526
  }
4504
4527
  else {
4505
- if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
4528
+ if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4506
4529
  // prev children was array
4507
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
4530
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4508
4531
  // two arrays, cannot assume anything, do full diff
4509
4532
  patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
4510
4533
  }
@@ -4516,11 +4539,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4516
4539
  else {
4517
4540
  // prev children was text OR null
4518
4541
  // new children is array OR null
4519
- if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
4542
+ if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
4520
4543
  hostSetElementText(container, '');
4521
4544
  }
4522
4545
  // mount new if array
4523
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
4546
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4524
4547
  mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
4525
4548
  }
4526
4549
  }
@@ -4708,7 +4731,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4708
4731
  // There is no stable subsequence (e.g. a reverse)
4709
4732
  // OR current node is not among the stable sequence
4710
4733
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
4711
- move(nextChild, container, anchor, 2 /* REORDER */);
4734
+ move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
4712
4735
  }
4713
4736
  else {
4714
4737
  j--;
@@ -4719,15 +4742,15 @@ function baseCreateRenderer(options, createHydrationFns) {
4719
4742
  };
4720
4743
  const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
4721
4744
  const { el, type, transition, children, shapeFlag } = vnode;
4722
- if (shapeFlag & 6 /* COMPONENT */) {
4745
+ if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
4723
4746
  move(vnode.component.subTree, container, anchor, moveType);
4724
4747
  return;
4725
4748
  }
4726
- if (shapeFlag & 128 /* SUSPENSE */) {
4749
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
4727
4750
  vnode.suspense.move(container, anchor, moveType);
4728
4751
  return;
4729
4752
  }
4730
- if (shapeFlag & 64 /* TELEPORT */) {
4753
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
4731
4754
  type.move(vnode, container, anchor, internals);
4732
4755
  return;
4733
4756
  }
@@ -4744,11 +4767,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4744
4767
  return;
4745
4768
  }
4746
4769
  // single nodes
4747
- const needTransition = moveType !== 2 /* REORDER */ &&
4748
- shapeFlag & 1 /* ELEMENT */ &&
4770
+ const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
4771
+ shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
4749
4772
  transition;
4750
4773
  if (needTransition) {
4751
- if (moveType === 0 /* ENTER */) {
4774
+ if (moveType === 0 /* MoveType.ENTER */) {
4752
4775
  transition.beforeEnter(el);
4753
4776
  hostInsert(el, container, anchor);
4754
4777
  queuePostRenderEffect(() => transition.enter(el), parentSuspense);
@@ -4780,42 +4803,42 @@ function baseCreateRenderer(options, createHydrationFns) {
4780
4803
  if (ref != null) {
4781
4804
  setRef(ref, null, parentSuspense, vnode, true);
4782
4805
  }
4783
- if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
4806
+ if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
4784
4807
  parentComponent.ctx.deactivate(vnode);
4785
4808
  return;
4786
4809
  }
4787
- const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
4810
+ const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
4788
4811
  const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
4789
4812
  let vnodeHook;
4790
4813
  if (shouldInvokeVnodeHook &&
4791
4814
  (vnodeHook = props && props.onVnodeBeforeUnmount)) {
4792
4815
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
4793
4816
  }
4794
- if (shapeFlag & 6 /* COMPONENT */) {
4817
+ if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
4795
4818
  unmountComponent(vnode.component, parentSuspense, doRemove);
4796
4819
  }
4797
4820
  else {
4798
- if (shapeFlag & 128 /* SUSPENSE */) {
4821
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
4799
4822
  vnode.suspense.unmount(parentSuspense, doRemove);
4800
4823
  return;
4801
4824
  }
4802
4825
  if (shouldInvokeDirs) {
4803
4826
  invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
4804
4827
  }
4805
- if (shapeFlag & 64 /* TELEPORT */) {
4828
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
4806
4829
  vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
4807
4830
  }
4808
4831
  else if (dynamicChildren &&
4809
4832
  // #1153: fast path should not be taken for non-stable (v-for) fragments
4810
4833
  (type !== Fragment ||
4811
- (patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
4834
+ (patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
4812
4835
  // fast path for block nodes: only need to unmount dynamic children.
4813
4836
  unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
4814
4837
  }
4815
4838
  else if ((type === Fragment &&
4816
4839
  patchFlag &
4817
- (128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
4818
- (!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
4840
+ (128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
4841
+ (!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
4819
4842
  unmountChildren(children, parentComponent, parentSuspense);
4820
4843
  }
4821
4844
  if (doRemove) {
@@ -4850,7 +4873,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4850
4873
  transition.afterLeave();
4851
4874
  }
4852
4875
  };
4853
- if (vnode.shapeFlag & 1 /* ELEMENT */ &&
4876
+ if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
4854
4877
  transition &&
4855
4878
  !transition.persisted) {
4856
4879
  const { leave, delayLeave } = transition;
@@ -4920,10 +4943,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4920
4943
  }
4921
4944
  };
4922
4945
  const getNextHostNode = vnode => {
4923
- if (vnode.shapeFlag & 6 /* COMPONENT */) {
4946
+ if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
4924
4947
  return getNextHostNode(vnode.component.subTree);
4925
4948
  }
4926
- if (vnode.shapeFlag & 128 /* SUSPENSE */) {
4949
+ if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
4927
4950
  return vnode.suspense.next();
4928
4951
  }
4929
4952
  return hostNextSibling((vnode.anchor || vnode.el));
@@ -4937,6 +4960,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4937
4960
  else {
4938
4961
  patch(container._vnode || null, vnode, container, null, null, null, isSVG);
4939
4962
  }
4963
+ flushPreFlushCbs();
4940
4964
  flushPostFlushCbs();
4941
4965
  container._vnode = vnode;
4942
4966
  };
@@ -4986,8 +5010,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
4986
5010
  // guaranteed to be vnodes
4987
5011
  const c1 = ch1[i];
4988
5012
  let c2 = ch2[i];
4989
- if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
4990
- if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
5013
+ if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
5014
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
4991
5015
  c2 = ch2[i] = cloneIfMounted(ch2[i]);
4992
5016
  c2.el = c1.el;
4993
5017
  }
@@ -5080,7 +5104,7 @@ const TeleportImpl = {
5080
5104
  const mount = (container, anchor) => {
5081
5105
  // Teleport *always* has Array children. This is enforced in both the
5082
5106
  // compiler and vnode children normalization.
5083
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
5107
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
5084
5108
  mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
5085
5109
  }
5086
5110
  };
@@ -5116,7 +5140,7 @@ const TeleportImpl = {
5116
5140
  if (!wasDisabled) {
5117
5141
  // enabled -> disabled
5118
5142
  // move into main container
5119
- moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
5143
+ moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
5120
5144
  }
5121
5145
  }
5122
5146
  else {
@@ -5124,13 +5148,13 @@ const TeleportImpl = {
5124
5148
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
5125
5149
  const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
5126
5150
  if (nextTarget) {
5127
- moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
5151
+ moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
5128
5152
  }
5129
5153
  }
5130
5154
  else if (wasDisabled) {
5131
5155
  // disabled -> enabled
5132
5156
  // move into teleport target
5133
- moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
5157
+ moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
5134
5158
  }
5135
5159
  }
5136
5160
  }
@@ -5143,7 +5167,7 @@ const TeleportImpl = {
5143
5167
  // an unmounted teleport should always remove its children if not disabled
5144
5168
  if (doRemove || !isTeleportDisabled(props)) {
5145
5169
  hostRemove(anchor);
5146
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
5170
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
5147
5171
  for (let i = 0; i < children.length; i++) {
5148
5172
  const child = children[i];
5149
5173
  unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
@@ -5154,13 +5178,13 @@ const TeleportImpl = {
5154
5178
  move: moveTeleport,
5155
5179
  hydrate: hydrateTeleport
5156
5180
  };
5157
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
5181
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* TeleportMoveTypes.REORDER */) {
5158
5182
  // move target anchor if this is a target change.
5159
- if (moveType === 0 /* TARGET_CHANGE */) {
5183
+ if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
5160
5184
  insert(vnode.targetAnchor, container, parentAnchor);
5161
5185
  }
5162
5186
  const { el, anchor, shapeFlag, children, props } = vnode;
5163
- const isReorder = moveType === 2 /* REORDER */;
5187
+ const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
5164
5188
  // move main view anchor if this is a re-order.
5165
5189
  if (isReorder) {
5166
5190
  insert(el, container, parentAnchor);
@@ -5170,9 +5194,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
5170
5194
  // is not a reorder, or the teleport is disabled
5171
5195
  if (!isReorder || isTeleportDisabled(props)) {
5172
5196
  // Teleport has either Array children or no children.
5173
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
5197
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
5174
5198
  for (let i = 0; i < children.length; i++) {
5175
- move(children[i], container, parentAnchor, 2 /* REORDER */);
5199
+ move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
5176
5200
  }
5177
5201
  }
5178
5202
  }
@@ -5187,7 +5211,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
5187
5211
  // if multiple teleports rendered to the same target element, we need to
5188
5212
  // pick up from where the last teleport finished instead of the first node
5189
5213
  const targetNode = target._lpa || target.firstChild;
5190
- if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
5214
+ if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
5191
5215
  if (isTeleportDisabled(vnode.props)) {
5192
5216
  vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
5193
5217
  vnode.targetAnchor = targetNode;
@@ -5328,7 +5352,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
5328
5352
  : ref
5329
5353
  : null);
5330
5354
  };
5331
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
5355
+ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
5332
5356
  const vnode = {
5333
5357
  __v_isVNode: true,
5334
5358
  __v_skip: true,
@@ -5359,7 +5383,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5359
5383
  if (needFullChildrenNormalization) {
5360
5384
  normalizeChildren(vnode, children);
5361
5385
  // normalize suspense children
5362
- if (shapeFlag & 128 /* SUSPENSE */) {
5386
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
5363
5387
  type.normalize(vnode);
5364
5388
  }
5365
5389
  }
@@ -5367,8 +5391,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5367
5391
  // compiled element vnode - if children is passed, only possible types are
5368
5392
  // string or Array.
5369
5393
  vnode.shapeFlag |= shared.isString(children)
5370
- ? 8 /* TEXT_CHILDREN */
5371
- : 16 /* ARRAY_CHILDREN */;
5394
+ ? 8 /* ShapeFlags.TEXT_CHILDREN */
5395
+ : 16 /* ShapeFlags.ARRAY_CHILDREN */;
5372
5396
  }
5373
5397
  // track vnode for block tree
5374
5398
  if (isBlockTreeEnabled > 0 &&
@@ -5380,10 +5404,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5380
5404
  // component nodes also should always be patched, because even if the
5381
5405
  // component doesn't need to update, it needs to persist the instance on to
5382
5406
  // the next vnode so that it can be properly unmounted later.
5383
- (vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
5407
+ (vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
5384
5408
  // the EVENTS flag is only for hydration and if it is the only flag, the
5385
5409
  // vnode should not be considered dynamic due to handler caching.
5386
- vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
5410
+ vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
5387
5411
  currentBlock.push(vnode);
5388
5412
  }
5389
5413
  return vnode;
@@ -5402,14 +5426,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5402
5426
  normalizeChildren(cloned, children);
5403
5427
  }
5404
5428
  if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
5405
- if (cloned.shapeFlag & 6 /* COMPONENT */) {
5429
+ if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
5406
5430
  currentBlock[currentBlock.indexOf(type)] = cloned;
5407
5431
  }
5408
5432
  else {
5409
5433
  currentBlock.push(cloned);
5410
5434
  }
5411
5435
  }
5412
- cloned.patchFlag |= -2 /* BAIL */;
5436
+ cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
5413
5437
  return cloned;
5414
5438
  }
5415
5439
  // class component normalization.
@@ -5435,15 +5459,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5435
5459
  }
5436
5460
  // encode the vnode type information into a bitmap
5437
5461
  const shapeFlag = shared.isString(type)
5438
- ? 1 /* ELEMENT */
5462
+ ? 1 /* ShapeFlags.ELEMENT */
5439
5463
  : isSuspense(type)
5440
- ? 128 /* SUSPENSE */
5464
+ ? 128 /* ShapeFlags.SUSPENSE */
5441
5465
  : isTeleport(type)
5442
- ? 64 /* TELEPORT */
5466
+ ? 64 /* ShapeFlags.TELEPORT */
5443
5467
  : shared.isObject(type)
5444
- ? 4 /* STATEFUL_COMPONENT */
5468
+ ? 4 /* ShapeFlags.STATEFUL_COMPONENT */
5445
5469
  : shared.isFunction(type)
5446
- ? 2 /* FUNCTIONAL_COMPONENT */
5470
+ ? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
5447
5471
  : 0;
5448
5472
  return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);
5449
5473
  }
@@ -5488,8 +5512,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
5488
5512
  // fast paths only.
5489
5513
  patchFlag: extraProps && vnode.type !== Fragment
5490
5514
  ? patchFlag === -1 // hoisted node
5491
- ? 16 /* FULL_PROPS */
5492
- : patchFlag | 16 /* FULL_PROPS */
5515
+ ? 16 /* PatchFlags.FULL_PROPS */
5516
+ : patchFlag | 16 /* PatchFlags.FULL_PROPS */
5493
5517
  : patchFlag,
5494
5518
  dynamicProps: vnode.dynamicProps,
5495
5519
  dynamicChildren: vnode.dynamicChildren,
@@ -5568,10 +5592,10 @@ function normalizeChildren(vnode, children) {
5568
5592
  children = null;
5569
5593
  }
5570
5594
  else if (shared.isArray(children)) {
5571
- type = 16 /* ARRAY_CHILDREN */;
5595
+ type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
5572
5596
  }
5573
5597
  else if (typeof children === 'object') {
5574
- if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
5598
+ if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
5575
5599
  // Normalize slot to plain children for plain element and Teleport
5576
5600
  const slot = children.default;
5577
5601
  if (slot) {
@@ -5583,37 +5607,37 @@ function normalizeChildren(vnode, children) {
5583
5607
  return;
5584
5608
  }
5585
5609
  else {
5586
- type = 32 /* SLOTS_CHILDREN */;
5610
+ type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
5587
5611
  const slotFlag = children._;
5588
5612
  if (!slotFlag && !(InternalObjectKey in children)) {
5589
5613
  children._ctx = currentRenderingInstance;
5590
5614
  }
5591
- else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
5615
+ else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
5592
5616
  // a child component receives forwarded slots from the parent.
5593
5617
  // its slot type is determined by its parent's slot type.
5594
- if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
5595
- children._ = 1 /* STABLE */;
5618
+ if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
5619
+ children._ = 1 /* SlotFlags.STABLE */;
5596
5620
  }
5597
5621
  else {
5598
- children._ = 2 /* DYNAMIC */;
5599
- vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
5622
+ children._ = 2 /* SlotFlags.DYNAMIC */;
5623
+ vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
5600
5624
  }
5601
5625
  }
5602
5626
  }
5603
5627
  }
5604
5628
  else if (shared.isFunction(children)) {
5605
5629
  children = { default: children, _ctx: currentRenderingInstance };
5606
- type = 32 /* SLOTS_CHILDREN */;
5630
+ type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
5607
5631
  }
5608
5632
  else {
5609
5633
  children = String(children);
5610
5634
  // force teleport children to array so it can be moved around
5611
- if (shapeFlag & 64 /* TELEPORT */) {
5612
- type = 16 /* ARRAY_CHILDREN */;
5635
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
5636
+ type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
5613
5637
  children = [createTextVNode(children)];
5614
5638
  }
5615
5639
  else {
5616
- type = 8 /* TEXT_CHILDREN */;
5640
+ type = 8 /* ShapeFlags.TEXT_CHILDREN */;
5617
5641
  }
5618
5642
  }
5619
5643
  vnode.children = children;
@@ -5651,7 +5675,7 @@ function mergeProps(...args) {
5651
5675
  return ret;
5652
5676
  }
5653
5677
  function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
5654
- callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
5678
+ callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
5655
5679
  vnode,
5656
5680
  prevVNode
5657
5681
  ]);
@@ -5752,7 +5776,7 @@ const unsetCurrentInstance = () => {
5752
5776
  currentInstance = null;
5753
5777
  };
5754
5778
  function isStatefulComponent(instance) {
5755
- return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
5779
+ return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
5756
5780
  }
5757
5781
  let isInSSRComponentSetup = false;
5758
5782
  function setupComponent(instance, isSSR = false) {
@@ -5781,7 +5805,7 @@ function setupStatefulComponent(instance, isSSR) {
5781
5805
  setup.length > 1 ? createSetupContext(instance) : null);
5782
5806
  setCurrentInstance(instance);
5783
5807
  reactivity.pauseTracking();
5784
- const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [instance.props, setupContext]);
5808
+ const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [instance.props, setupContext]);
5785
5809
  reactivity.resetTracking();
5786
5810
  unsetCurrentInstance();
5787
5811
  if (shared.isPromise(setupResult)) {
@@ -5793,7 +5817,7 @@ function setupStatefulComponent(instance, isSSR) {
5793
5817
  handleSetupResult(instance, resolvedResult, isSSR);
5794
5818
  })
5795
5819
  .catch(e => {
5796
- handleError(e, instance, 0 /* SETUP_FUNCTION */);
5820
+ handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
5797
5821
  });
5798
5822
  }
5799
5823
  else {
@@ -5852,7 +5876,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
5852
5876
  // only do on-the-fly compile if not in SSR - SSR on-the-fly compilation
5853
5877
  // is done by server-renderer
5854
5878
  if (!isSSR && compile && !Component.render) {
5855
- const template = Component.template;
5879
+ const template = Component.template ||
5880
+ resolveMergedOptions(instance).template;
5856
5881
  if (template) {
5857
5882
  const { isCustomElement, compilerOptions } = instance.appContext.config;
5858
5883
  const { delimiters, compilerOptions: componentCompilerOptions } = Component;
@@ -5883,7 +5908,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
5883
5908
  function createAttrsProxy(instance) {
5884
5909
  return new Proxy(instance.attrs, {
5885
5910
  get(target, key) {
5886
- reactivity.track(instance, "get" /* GET */, '$attrs');
5911
+ reactivity.track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
5887
5912
  return target[key];
5888
5913
  }
5889
5914
  });
@@ -5921,10 +5946,10 @@ function getExposeProxy(instance) {
5921
5946
  }
5922
5947
  const classifyRE = /(?:^|[-_])(\w)/g;
5923
5948
  const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
5924
- function getComponentName(Component) {
5949
+ function getComponentName(Component, includeInferred = true) {
5925
5950
  return shared.isFunction(Component)
5926
5951
  ? Component.displayName || Component.name
5927
- : Component.name;
5952
+ : Component.name || (includeInferred && Component.__name);
5928
5953
  }
5929
5954
  /* istanbul ignore next */
5930
5955
  function formatComponentName(instance, Component, isRoot = false) {
@@ -6161,7 +6186,7 @@ function isMemoSame(cached, memo) {
6161
6186
  }
6162
6187
 
6163
6188
  // Core API ------------------------------------------------------------------
6164
- const version = "3.2.36";
6189
+ const version = "3.2.39";
6165
6190
  const _ssrUtils = {
6166
6191
  createComponentInstance,
6167
6192
  setupComponent,
@@ -6171,7 +6196,7 @@ const _ssrUtils = {
6171
6196
  normalizeVNode
6172
6197
  };
6173
6198
  /**
6174
- * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
6199
+ * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
6175
6200
  * @internal
6176
6201
  */
6177
6202
  const ssrUtils = (_ssrUtils );