@vue/runtime-core 3.5.0-alpha.4 → 3.5.0-alpha.5

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/runtime-core v3.5.0-alpha.4
2
+ * @vue/runtime-core v3.5.0-alpha.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -422,11 +422,8 @@ const TeleportImpl = {
422
422
  if (n1 == null) {
423
423
  const placeholder = n2.el = createText("");
424
424
  const mainAnchor = n2.anchor = createText("");
425
- const targetStart = n2.targetStart = createText("");
426
- const targetAnchor = n2.targetAnchor = createText("");
427
425
  insert(placeholder, container, anchor);
428
426
  insert(mainAnchor, container, anchor);
429
- targetStart[TeleportEndKey] = targetAnchor;
430
427
  const mount = (container2, anchor2) => {
431
428
  if (shapeFlag & 16) {
432
429
  mountChildren(
@@ -443,9 +440,8 @@ const TeleportImpl = {
443
440
  };
444
441
  const mountToTarget = () => {
445
442
  const target = n2.target = resolveTarget(n2.props, querySelector);
443
+ const targetAnchor = prepareAnchor(target, n2, createText, insert);
446
444
  if (target) {
447
- insert(targetStart, target);
448
- insert(targetAnchor, target);
449
445
  if (namespace !== "svg" && isTargetSVG(target)) {
450
446
  namespace = "svg";
451
447
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
@@ -604,7 +600,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
604
600
  }
605
601
  }
606
602
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
607
- o: { nextSibling, parentNode, querySelector }
603
+ o: { nextSibling, parentNode, querySelector, insert, createText }
608
604
  }, hydrateChildren) {
609
605
  const target = vnode.target = resolveTarget(
610
606
  vnode.props,
@@ -623,20 +619,28 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
623
619
  slotScopeIds,
624
620
  optimized
625
621
  );
626
- vnode.targetAnchor = targetNode;
622
+ vnode.targetStart = targetNode;
623
+ vnode.targetAnchor = targetNode && nextSibling(targetNode);
627
624
  } else {
628
625
  vnode.anchor = nextSibling(node);
629
626
  let targetAnchor = targetNode;
630
627
  while (targetAnchor) {
631
- targetAnchor = nextSibling(targetAnchor);
632
- if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
633
- vnode.targetAnchor = targetAnchor;
634
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
635
- break;
628
+ if (targetAnchor && targetAnchor.nodeType === 8) {
629
+ if (targetAnchor.data === "teleport start anchor") {
630
+ vnode.targetStart = targetAnchor;
631
+ } else if (targetAnchor.data === "teleport anchor") {
632
+ vnode.targetAnchor = targetAnchor;
633
+ target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
634
+ break;
635
+ }
636
636
  }
637
+ targetAnchor = nextSibling(targetAnchor);
638
+ }
639
+ if (!vnode.targetAnchor) {
640
+ prepareAnchor(target, vnode, createText, insert);
637
641
  }
638
642
  hydrateChildren(
639
- targetNode,
643
+ targetNode && nextSibling(targetNode),
640
644
  vnode,
641
645
  target,
642
646
  parentComponent,
@@ -662,6 +666,16 @@ function updateCssVars(vnode) {
662
666
  ctx.ut();
663
667
  }
664
668
  }
669
+ function prepareAnchor(target, vnode, createText, insert) {
670
+ const targetStart = vnode.targetStart = createText("");
671
+ const targetAnchor = vnode.targetAnchor = createText("");
672
+ targetStart[TeleportEndKey] = targetAnchor;
673
+ if (target) {
674
+ insert(targetStart, target);
675
+ insert(targetAnchor, target);
676
+ }
677
+ return targetAnchor;
678
+ }
665
679
 
666
680
  const leaveCbKey = Symbol("_leaveCb");
667
681
  const enterCbKey = Symbol("_enterCb");
@@ -1015,2160 +1029,2280 @@ function markAsyncBoundary(instance) {
1015
1029
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
1016
1030
  }
1017
1031
 
1018
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1019
- /*! #__NO_SIDE_EFFECTS__ */
1020
- // @__NO_SIDE_EFFECTS__
1021
- function defineAsyncComponent(source) {
1022
- if (shared.isFunction(source)) {
1023
- source = { loader: source };
1032
+ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1033
+ if (shared.isArray(rawRef)) {
1034
+ rawRef.forEach(
1035
+ (r, i) => setRef(
1036
+ r,
1037
+ oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
1038
+ parentSuspense,
1039
+ vnode,
1040
+ isUnmount
1041
+ )
1042
+ );
1043
+ return;
1024
1044
  }
1025
- const {
1026
- loader,
1027
- loadingComponent,
1028
- errorComponent,
1029
- delay = 200,
1030
- timeout,
1031
- // undefined = never times out
1032
- suspensible = true,
1033
- onError: userOnError
1034
- } = source;
1035
- let pendingRequest = null;
1036
- let resolvedComp;
1037
- let retries = 0;
1038
- const retry = () => {
1039
- retries++;
1040
- pendingRequest = null;
1041
- return load();
1042
- };
1043
- const load = () => {
1044
- let thisRequest;
1045
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1046
- err = err instanceof Error ? err : new Error(String(err));
1047
- if (userOnError) {
1048
- return new Promise((resolve, reject) => {
1049
- const userRetry = () => resolve(retry());
1050
- const userFail = () => reject(err);
1051
- userOnError(err, userRetry, userFail, retries + 1);
1052
- });
1053
- } else {
1054
- throw err;
1055
- }
1056
- }).then((comp) => {
1057
- if (thisRequest !== pendingRequest && pendingRequest) {
1058
- return pendingRequest;
1059
- }
1060
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
1061
- comp = comp.default;
1062
- }
1063
- resolvedComp = comp;
1064
- return comp;
1065
- }));
1066
- };
1067
- return defineComponent({
1068
- name: "AsyncComponentWrapper",
1069
- __asyncLoader: load,
1070
- get __asyncResolved() {
1071
- return resolvedComp;
1072
- },
1073
- setup() {
1074
- const instance = currentInstance;
1075
- markAsyncBoundary(instance);
1076
- if (resolvedComp) {
1077
- return () => createInnerComp(resolvedComp, instance);
1078
- }
1079
- const onError = (err) => {
1080
- pendingRequest = null;
1081
- handleError(
1082
- err,
1083
- instance,
1084
- 13,
1085
- !errorComponent
1086
- );
1087
- };
1088
- if (suspensible && instance.suspense || isInSSRComponentSetup) {
1089
- return load().then((comp) => {
1090
- return () => createInnerComp(comp, instance);
1091
- }).catch((err) => {
1092
- onError(err);
1093
- return () => errorComponent ? createVNode(errorComponent, {
1094
- error: err
1095
- }) : null;
1096
- });
1097
- }
1098
- const loaded = reactivity.ref(false);
1099
- const error = reactivity.ref();
1100
- const delayed = reactivity.ref(!!delay);
1101
- if (delay) {
1102
- setTimeout(() => {
1103
- delayed.value = false;
1104
- }, delay);
1045
+ if (isAsyncWrapper(vnode) && !isUnmount) {
1046
+ return;
1047
+ }
1048
+ const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
1049
+ const value = isUnmount ? null : refValue;
1050
+ const { i: owner, r: ref } = rawRef;
1051
+ const oldRef = oldRawRef && oldRawRef.r;
1052
+ const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
1053
+ const setupState = owner.setupState;
1054
+ if (oldRef != null && oldRef !== ref) {
1055
+ if (shared.isString(oldRef)) {
1056
+ refs[oldRef] = null;
1057
+ if (shared.hasOwn(setupState, oldRef)) {
1058
+ setupState[oldRef] = null;
1105
1059
  }
1106
- if (timeout != null) {
1107
- setTimeout(() => {
1108
- if (!loaded.value && !error.value) {
1109
- const err = new Error(
1110
- `Async component timed out after ${timeout}ms.`
1111
- );
1112
- onError(err);
1113
- error.value = err;
1060
+ } else if (reactivity.isRef(oldRef)) {
1061
+ oldRef.value = null;
1062
+ }
1063
+ }
1064
+ if (shared.isFunction(ref)) {
1065
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
1066
+ } else {
1067
+ const _isString = shared.isString(ref);
1068
+ const _isRef = reactivity.isRef(ref);
1069
+ if (_isString || _isRef) {
1070
+ const doSet = () => {
1071
+ if (rawRef.f) {
1072
+ const existing = _isString ? shared.hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
1073
+ if (isUnmount) {
1074
+ shared.isArray(existing) && shared.remove(existing, refValue);
1075
+ } else {
1076
+ if (!shared.isArray(existing)) {
1077
+ if (_isString) {
1078
+ refs[ref] = [refValue];
1079
+ if (shared.hasOwn(setupState, ref)) {
1080
+ setupState[ref] = refs[ref];
1081
+ }
1082
+ } else {
1083
+ ref.value = [refValue];
1084
+ if (rawRef.k) refs[rawRef.k] = ref.value;
1085
+ }
1086
+ } else if (!existing.includes(refValue)) {
1087
+ existing.push(refValue);
1088
+ }
1114
1089
  }
1115
- }, timeout);
1116
- }
1117
- load().then(() => {
1118
- loaded.value = true;
1119
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
1120
- queueJob(instance.parent.update);
1121
- }
1122
- }).catch((err) => {
1123
- onError(err);
1124
- error.value = err;
1125
- });
1126
- return () => {
1127
- if (loaded.value && resolvedComp) {
1128
- return createInnerComp(resolvedComp, instance);
1129
- } else if (error.value && errorComponent) {
1130
- return createVNode(errorComponent, {
1131
- error: error.value
1132
- });
1133
- } else if (loadingComponent && !delayed.value) {
1134
- return createVNode(loadingComponent);
1135
- }
1090
+ } else if (_isString) {
1091
+ refs[ref] = value;
1092
+ if (shared.hasOwn(setupState, ref)) {
1093
+ setupState[ref] = value;
1094
+ }
1095
+ } else if (_isRef) {
1096
+ ref.value = value;
1097
+ if (rawRef.k) refs[rawRef.k] = value;
1098
+ } else ;
1136
1099
  };
1100
+ if (value) {
1101
+ doSet.id = -1;
1102
+ queuePostRenderEffect(doSet, parentSuspense);
1103
+ } else {
1104
+ doSet();
1105
+ }
1137
1106
  }
1138
- });
1139
- }
1140
- function createInnerComp(comp, parent) {
1141
- const { ref: ref2, props, children, ce } = parent.vnode;
1142
- const vnode = createVNode(comp, props, children);
1143
- vnode.ref = ref2;
1144
- vnode.ce = ce;
1145
- delete parent.vnode.ce;
1146
- return vnode;
1107
+ }
1147
1108
  }
1148
1109
 
1149
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
1150
- const KeepAliveImpl = {
1151
- name: `KeepAlive`,
1152
- // Marker for special handling inside the renderer. We are not using a ===
1153
- // check directly on KeepAlive in the renderer, because importing it directly
1154
- // would prevent it from being tree-shaken.
1155
- __isKeepAlive: true,
1156
- props: {
1157
- include: [String, RegExp, Array],
1158
- exclude: [String, RegExp, Array],
1159
- max: [String, Number]
1160
- },
1161
- setup(props, { slots }) {
1162
- const instance = getCurrentInstance();
1163
- const sharedContext = instance.ctx;
1164
- if (!sharedContext.renderer) {
1165
- return () => {
1166
- const children = slots.default && slots.default();
1167
- return children && children.length === 1 ? children[0] : children;
1168
- };
1110
+ let hasLoggedMismatchError = false;
1111
+ const logMismatchError = () => {
1112
+ if (hasLoggedMismatchError) {
1113
+ return;
1114
+ }
1115
+ console.error("Hydration completed but contains mismatches.");
1116
+ hasLoggedMismatchError = true;
1117
+ };
1118
+ const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
1119
+ const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
1120
+ const getContainerType = (container) => {
1121
+ if (isSVGContainer(container)) return "svg";
1122
+ if (isMathMLContainer(container)) return "mathml";
1123
+ return void 0;
1124
+ };
1125
+ const isComment = (node) => node.nodeType === 8;
1126
+ function createHydrationFunctions(rendererInternals) {
1127
+ const {
1128
+ mt: mountComponent,
1129
+ p: patch,
1130
+ o: {
1131
+ patchProp,
1132
+ createText,
1133
+ nextSibling,
1134
+ parentNode,
1135
+ remove,
1136
+ insert,
1137
+ createComment
1169
1138
  }
1170
- const cache = /* @__PURE__ */ new Map();
1171
- const keys = /* @__PURE__ */ new Set();
1172
- let current = null;
1173
- const parentSuspense = instance.suspense;
1174
- const {
1175
- renderer: {
1176
- p: patch,
1177
- m: move,
1178
- um: _unmount,
1179
- o: { createElement }
1180
- }
1181
- } = sharedContext;
1182
- const storageContainer = createElement("div");
1183
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
1184
- const instance2 = vnode.component;
1185
- move(vnode, container, anchor, 0, parentSuspense);
1186
- patch(
1187
- instance2.vnode,
1188
- vnode,
1189
- container,
1190
- anchor,
1191
- instance2,
1192
- parentSuspense,
1193
- namespace,
1194
- vnode.slotScopeIds,
1195
- optimized
1196
- );
1197
- queuePostRenderEffect(() => {
1198
- instance2.isDeactivated = false;
1199
- if (instance2.a) {
1200
- shared.invokeArrayFns(instance2.a);
1201
- }
1202
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
1203
- if (vnodeHook) {
1204
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1205
- }
1206
- }, parentSuspense);
1207
- };
1208
- sharedContext.deactivate = (vnode) => {
1209
- const instance2 = vnode.component;
1210
- invalidateMount(instance2.m);
1211
- invalidateMount(instance2.a);
1212
- move(vnode, storageContainer, null, 1, parentSuspense);
1213
- queuePostRenderEffect(() => {
1214
- if (instance2.da) {
1215
- shared.invokeArrayFns(instance2.da);
1216
- }
1217
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
1218
- if (vnodeHook) {
1219
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1220
- }
1221
- instance2.isDeactivated = true;
1222
- }, parentSuspense);
1223
- };
1224
- function unmount(vnode) {
1225
- resetShapeFlag(vnode);
1226
- _unmount(vnode, instance, parentSuspense, true);
1227
- }
1228
- function pruneCache(filter) {
1229
- cache.forEach((vnode, key) => {
1230
- const name = getComponentName(vnode.type);
1231
- if (name && (!filter || !filter(name))) {
1232
- pruneCacheEntry(key);
1233
- }
1234
- });
1235
- }
1236
- function pruneCacheEntry(key) {
1237
- const cached = cache.get(key);
1238
- if (!current || !isSameVNodeType(cached, current)) {
1239
- unmount(cached);
1240
- } else if (current) {
1241
- resetShapeFlag(current);
1242
- }
1243
- cache.delete(key);
1244
- keys.delete(key);
1139
+ } = rendererInternals;
1140
+ const hydrate = (vnode, container) => {
1141
+ if (!container.hasChildNodes()) {
1142
+ patch(null, vnode, container);
1143
+ flushPostFlushCbs();
1144
+ container._vnode = vnode;
1145
+ return;
1245
1146
  }
1246
- watch(
1247
- () => [props.include, props.exclude],
1248
- ([include, exclude]) => {
1249
- include && pruneCache((name) => matches(include, name));
1250
- exclude && pruneCache((name) => !matches(exclude, name));
1251
- },
1252
- // prune post-render after `current` has been updated
1253
- { flush: "post", deep: true }
1147
+ hydrateNode(container.firstChild, vnode, null, null, null);
1148
+ flushPostFlushCbs();
1149
+ container._vnode = vnode;
1150
+ };
1151
+ const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
1152
+ optimized = optimized || !!vnode.dynamicChildren;
1153
+ const isFragmentStart = isComment(node) && node.data === "[";
1154
+ const onMismatch = () => handleMismatch(
1155
+ node,
1156
+ vnode,
1157
+ parentComponent,
1158
+ parentSuspense,
1159
+ slotScopeIds,
1160
+ isFragmentStart
1254
1161
  );
1255
- let pendingCacheKey = null;
1256
- const cacheSubtree = () => {
1257
- if (pendingCacheKey != null) {
1258
- if (isSuspense(instance.subTree.type)) {
1259
- queuePostRenderEffect(() => {
1260
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1261
- }, instance.subTree.suspense);
1162
+ const { type, ref, shapeFlag, patchFlag } = vnode;
1163
+ let domType = node.nodeType;
1164
+ vnode.el = node;
1165
+ if (patchFlag === -2) {
1166
+ optimized = false;
1167
+ vnode.dynamicChildren = null;
1168
+ }
1169
+ let nextNode = null;
1170
+ switch (type) {
1171
+ case Text:
1172
+ if (domType !== 3) {
1173
+ if (vnode.children === "") {
1174
+ insert(vnode.el = createText(""), parentNode(node), node);
1175
+ nextNode = node;
1176
+ } else {
1177
+ nextNode = onMismatch();
1178
+ }
1262
1179
  } else {
1263
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1180
+ if (node.data !== vnode.children) {
1181
+ logMismatchError();
1182
+ node.data = vnode.children;
1183
+ }
1184
+ nextNode = nextSibling(node);
1264
1185
  }
1265
- }
1266
- };
1267
- onMounted(cacheSubtree);
1268
- onUpdated(cacheSubtree);
1269
- onBeforeUnmount(() => {
1270
- cache.forEach((cached) => {
1271
- const { subTree, suspense } = instance;
1272
- const vnode = getInnerChild(subTree);
1273
- if (cached.type === vnode.type && cached.key === vnode.key) {
1274
- resetShapeFlag(vnode);
1275
- const da = vnode.component.da;
1276
- da && queuePostRenderEffect(da, suspense);
1277
- return;
1186
+ break;
1187
+ case Comment:
1188
+ if (isTemplateNode(node)) {
1189
+ nextNode = nextSibling(node);
1190
+ replaceNode(
1191
+ vnode.el = node.content.firstChild,
1192
+ node,
1193
+ parentComponent
1194
+ );
1195
+ } else if (domType !== 8 || isFragmentStart) {
1196
+ nextNode = onMismatch();
1197
+ } else {
1198
+ nextNode = nextSibling(node);
1278
1199
  }
1279
- unmount(cached);
1280
- });
1281
- });
1282
- return () => {
1283
- pendingCacheKey = null;
1284
- if (!slots.default) {
1285
- return null;
1286
- }
1287
- const children = slots.default();
1288
- const rawVNode = children[0];
1289
- if (children.length > 1) {
1290
- current = null;
1291
- return children;
1292
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
1293
- current = null;
1294
- return rawVNode;
1295
- }
1296
- let vnode = getInnerChild(rawVNode);
1297
- const comp = vnode.type;
1298
- const name = getComponentName(
1299
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
1300
- );
1301
- const { include, exclude, max } = props;
1302
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
1303
- current = vnode;
1304
- return rawVNode;
1305
- }
1306
- const key = vnode.key == null ? comp : vnode.key;
1307
- const cachedVNode = cache.get(key);
1308
- if (vnode.el) {
1309
- vnode = cloneVNode(vnode);
1310
- if (rawVNode.shapeFlag & 128) {
1311
- rawVNode.ssContent = vnode;
1200
+ break;
1201
+ case Static:
1202
+ if (isFragmentStart) {
1203
+ node = nextSibling(node);
1204
+ domType = node.nodeType;
1312
1205
  }
1313
- }
1314
- pendingCacheKey = key;
1315
- if (cachedVNode) {
1316
- vnode.el = cachedVNode.el;
1317
- vnode.component = cachedVNode.component;
1318
- if (vnode.transition) {
1319
- setTransitionHooks(vnode, vnode.transition);
1206
+ if (domType === 1 || domType === 3) {
1207
+ nextNode = node;
1208
+ const needToAdoptContent = !vnode.children.length;
1209
+ for (let i = 0; i < vnode.staticCount; i++) {
1210
+ if (needToAdoptContent)
1211
+ vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
1212
+ if (i === vnode.staticCount - 1) {
1213
+ vnode.anchor = nextNode;
1214
+ }
1215
+ nextNode = nextSibling(nextNode);
1216
+ }
1217
+ return isFragmentStart ? nextSibling(nextNode) : nextNode;
1218
+ } else {
1219
+ onMismatch();
1320
1220
  }
1321
- vnode.shapeFlag |= 512;
1322
- keys.delete(key);
1323
- keys.add(key);
1324
- } else {
1325
- keys.add(key);
1326
- if (max && keys.size > parseInt(max, 10)) {
1327
- pruneCacheEntry(keys.values().next().value);
1221
+ break;
1222
+ case Fragment:
1223
+ if (!isFragmentStart) {
1224
+ nextNode = onMismatch();
1225
+ } else {
1226
+ nextNode = hydrateFragment(
1227
+ node,
1228
+ vnode,
1229
+ parentComponent,
1230
+ parentSuspense,
1231
+ slotScopeIds,
1232
+ optimized
1233
+ );
1328
1234
  }
1329
- }
1330
- vnode.shapeFlag |= 256;
1331
- current = vnode;
1332
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
1333
- };
1334
- }
1335
- };
1336
- const KeepAlive = KeepAliveImpl;
1337
- function matches(pattern, name) {
1338
- if (shared.isArray(pattern)) {
1339
- return pattern.some((p) => matches(p, name));
1340
- } else if (shared.isString(pattern)) {
1341
- return pattern.split(",").includes(name);
1342
- } else if (shared.isRegExp(pattern)) {
1343
- return pattern.test(name);
1344
- }
1345
- return false;
1346
- }
1347
- function onActivated(hook, target) {
1348
- registerKeepAliveHook(hook, "a", target);
1349
- }
1350
- function onDeactivated(hook, target) {
1351
- registerKeepAliveHook(hook, "da", target);
1352
- }
1353
- function registerKeepAliveHook(hook, type, target = currentInstance) {
1354
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
1355
- let current = target;
1356
- while (current) {
1357
- if (current.isDeactivated) {
1358
- return;
1359
- }
1360
- current = current.parent;
1361
- }
1362
- return hook();
1363
- });
1364
- injectHook(type, wrappedHook, target);
1365
- if (target) {
1366
- let current = target.parent;
1367
- while (current && current.parent) {
1368
- if (isKeepAlive(current.parent.vnode)) {
1369
- injectToKeepAliveRoot(wrappedHook, type, target, current);
1370
- }
1371
- current = current.parent;
1235
+ break;
1236
+ default:
1237
+ if (shapeFlag & 1) {
1238
+ if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
1239
+ nextNode = onMismatch();
1240
+ } else {
1241
+ nextNode = hydrateElement(
1242
+ node,
1243
+ vnode,
1244
+ parentComponent,
1245
+ parentSuspense,
1246
+ slotScopeIds,
1247
+ optimized
1248
+ );
1249
+ }
1250
+ } else if (shapeFlag & 6) {
1251
+ vnode.slotScopeIds = slotScopeIds;
1252
+ const container = parentNode(node);
1253
+ if (isFragmentStart) {
1254
+ nextNode = locateClosingAnchor(node);
1255
+ } else if (isComment(node) && node.data === "teleport start") {
1256
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
1257
+ } else {
1258
+ nextNode = nextSibling(node);
1259
+ }
1260
+ mountComponent(
1261
+ vnode,
1262
+ container,
1263
+ null,
1264
+ parentComponent,
1265
+ parentSuspense,
1266
+ getContainerType(container),
1267
+ optimized
1268
+ );
1269
+ if (isAsyncWrapper(vnode)) {
1270
+ let subTree;
1271
+ if (isFragmentStart) {
1272
+ subTree = createVNode(Fragment);
1273
+ subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
1274
+ } else {
1275
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
1276
+ }
1277
+ subTree.el = node;
1278
+ vnode.component.subTree = subTree;
1279
+ }
1280
+ } else if (shapeFlag & 64) {
1281
+ if (domType !== 8) {
1282
+ nextNode = onMismatch();
1283
+ } else {
1284
+ nextNode = vnode.type.hydrate(
1285
+ node,
1286
+ vnode,
1287
+ parentComponent,
1288
+ parentSuspense,
1289
+ slotScopeIds,
1290
+ optimized,
1291
+ rendererInternals,
1292
+ hydrateChildren
1293
+ );
1294
+ }
1295
+ } else if (shapeFlag & 128) {
1296
+ nextNode = vnode.type.hydrate(
1297
+ node,
1298
+ vnode,
1299
+ parentComponent,
1300
+ parentSuspense,
1301
+ getContainerType(parentNode(node)),
1302
+ slotScopeIds,
1303
+ optimized,
1304
+ rendererInternals,
1305
+ hydrateNode
1306
+ );
1307
+ } else ;
1372
1308
  }
1373
- }
1374
- }
1375
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
1376
- const injected = injectHook(
1377
- type,
1378
- hook,
1379
- keepAliveRoot,
1380
- true
1381
- /* prepend */
1382
- );
1383
- onUnmounted(() => {
1384
- shared.remove(keepAliveRoot[type], injected);
1385
- }, target);
1386
- }
1387
- function resetShapeFlag(vnode) {
1388
- vnode.shapeFlag &= ~256;
1389
- vnode.shapeFlag &= ~512;
1390
- }
1391
- function getInnerChild(vnode) {
1392
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
1393
- }
1394
-
1395
- function injectHook(type, hook, target = currentInstance, prepend = false) {
1396
- if (target) {
1397
- const hooks = target[type] || (target[type] = []);
1398
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1399
- reactivity.pauseTracking();
1400
- const reset = setCurrentInstance(target);
1401
- const res = callWithAsyncErrorHandling(hook, target, type, args);
1402
- reset();
1403
- reactivity.resetTracking();
1404
- return res;
1405
- });
1406
- if (prepend) {
1407
- hooks.unshift(wrappedHook);
1408
- } else {
1409
- hooks.push(wrappedHook);
1309
+ if (ref != null) {
1310
+ setRef(ref, null, parentSuspense, vnode);
1410
1311
  }
1411
- return wrappedHook;
1412
- }
1413
- }
1414
- const createHook = (lifecycle) => (hook, target = currentInstance) => {
1415
- if (!isInSSRComponentSetup || lifecycle === "sp") {
1416
- injectHook(lifecycle, (...args) => hook(...args), target);
1417
- }
1418
- };
1419
- const onBeforeMount = createHook("bm");
1420
- const onMounted = createHook("m");
1421
- const onBeforeUpdate = createHook("bu");
1422
- const onUpdated = createHook("u");
1423
- const onBeforeUnmount = createHook("bum");
1424
- const onUnmounted = createHook("um");
1425
- const onServerPrefetch = createHook("sp");
1426
- const onRenderTriggered = createHook(
1427
- "rtg"
1428
- );
1429
- const onRenderTracked = createHook(
1430
- "rtc"
1431
- );
1432
- function onErrorCaptured(hook, target = currentInstance) {
1433
- injectHook("ec", hook, target);
1434
- }
1435
-
1436
- const COMPONENTS = "components";
1437
- const DIRECTIVES = "directives";
1438
- function resolveComponent(name, maybeSelfReference) {
1439
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
1440
- }
1441
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
1442
- function resolveDynamicComponent(component) {
1443
- if (shared.isString(component)) {
1444
- return resolveAsset(COMPONENTS, component, false) || component;
1445
- } else {
1446
- return component || NULL_DYNAMIC_COMPONENT;
1447
- }
1448
- }
1449
- function resolveDirective(name) {
1450
- return resolveAsset(DIRECTIVES, name);
1451
- }
1452
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
1453
- const instance = currentRenderingInstance || currentInstance;
1454
- if (instance) {
1455
- const Component = instance.type;
1456
- if (type === COMPONENTS) {
1457
- const selfName = getComponentName(
1458
- Component,
1459
- false
1460
- );
1461
- if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
1462
- return Component;
1312
+ return nextNode;
1313
+ };
1314
+ const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1315
+ optimized = optimized || !!vnode.dynamicChildren;
1316
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1317
+ const forcePatch = type === "input" || type === "option";
1318
+ if (forcePatch || patchFlag !== -1) {
1319
+ if (dirs) {
1320
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
1321
+ }
1322
+ let needCallTransitionHooks = false;
1323
+ if (isTemplateNode(el)) {
1324
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
1325
+ const content = el.content.firstChild;
1326
+ if (needCallTransitionHooks) {
1327
+ transition.beforeEnter(content);
1328
+ }
1329
+ replaceNode(content, el, parentComponent);
1330
+ vnode.el = el = content;
1331
+ }
1332
+ if (shapeFlag & 16 && // skip if element has innerHTML / textContent
1333
+ !(props && (props.innerHTML || props.textContent))) {
1334
+ let next = hydrateChildren(
1335
+ el.firstChild,
1336
+ vnode,
1337
+ el,
1338
+ parentComponent,
1339
+ parentSuspense,
1340
+ slotScopeIds,
1341
+ optimized
1342
+ );
1343
+ while (next) {
1344
+ if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
1345
+ logMismatchError();
1346
+ }
1347
+ const cur = next;
1348
+ next = next.nextSibling;
1349
+ remove(cur);
1350
+ }
1351
+ } else if (shapeFlag & 8) {
1352
+ if (el.textContent !== vnode.children) {
1353
+ if (!isMismatchAllowed(el, 0 /* TEXT */)) {
1354
+ logMismatchError();
1355
+ }
1356
+ el.textContent = vnode.children;
1357
+ }
1358
+ }
1359
+ if (props) {
1360
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
1361
+ for (const key in props) {
1362
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
1363
+ key[0] === ".") {
1364
+ patchProp(el, key, null, props[key], void 0, parentComponent);
1365
+ }
1366
+ }
1367
+ } else if (props.onClick) {
1368
+ patchProp(
1369
+ el,
1370
+ "onClick",
1371
+ null,
1372
+ props.onClick,
1373
+ void 0,
1374
+ parentComponent
1375
+ );
1376
+ } else if (patchFlag & 4 && reactivity.isReactive(props.style)) {
1377
+ for (const key in props.style) props.style[key];
1378
+ }
1379
+ }
1380
+ let vnodeHooks;
1381
+ if (vnodeHooks = props && props.onVnodeBeforeMount) {
1382
+ invokeVNodeHook(vnodeHooks, parentComponent, vnode);
1383
+ }
1384
+ if (dirs) {
1385
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
1386
+ }
1387
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
1388
+ queueEffectWithSuspense(() => {
1389
+ vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
1390
+ needCallTransitionHooks && transition.enter(el);
1391
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
1392
+ }, parentSuspense);
1463
1393
  }
1464
1394
  }
1465
- const res = (
1466
- // local registration
1467
- // check instance[type] first which is resolved for options API
1468
- resolve(instance[type] || Component[type], name) || // global registration
1469
- resolve(instance.appContext[type], name)
1470
- );
1471
- if (!res && maybeSelfReference) {
1472
- return Component;
1473
- }
1474
- return res;
1475
- }
1476
- }
1477
- function resolve(registry, name) {
1478
- return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
1479
- }
1480
-
1481
- function renderList(source, renderItem, cache, index) {
1482
- let ret;
1483
- const cached = cache && cache[index];
1484
- const sourceIsArray = shared.isArray(source);
1485
- const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
1486
- if (sourceIsArray || shared.isString(source)) {
1487
- if (sourceIsReactiveArray) {
1488
- source = reactivity.shallowReadArray(source);
1489
- }
1490
- ret = new Array(source.length);
1491
- for (let i = 0, l = source.length; i < l; i++) {
1492
- ret[i] = renderItem(
1493
- sourceIsReactiveArray ? reactivity.toReactive(source[i]) : source[i],
1494
- i,
1495
- void 0,
1496
- cached && cached[i]
1497
- );
1498
- }
1499
- } else if (typeof source === "number") {
1500
- ret = new Array(source);
1501
- for (let i = 0; i < source; i++) {
1502
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
1503
- }
1504
- } else if (shared.isObject(source)) {
1505
- if (source[Symbol.iterator]) {
1506
- ret = Array.from(
1507
- source,
1508
- (item, i) => renderItem(item, i, void 0, cached && cached[i])
1509
- );
1510
- } else {
1511
- const keys = Object.keys(source);
1512
- ret = new Array(keys.length);
1513
- for (let i = 0, l = keys.length; i < l; i++) {
1514
- const key = keys[i];
1515
- ret[i] = renderItem(source[key], key, i, cached && cached[i]);
1395
+ return el.nextSibling;
1396
+ };
1397
+ const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1398
+ optimized = optimized || !!parentVNode.dynamicChildren;
1399
+ const children = parentVNode.children;
1400
+ const l = children.length;
1401
+ for (let i = 0; i < l; i++) {
1402
+ const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
1403
+ const isText = vnode.type === Text;
1404
+ if (node) {
1405
+ if (isText && !optimized) {
1406
+ let next = children[i + 1];
1407
+ if (next && (next = normalizeVNode(next)).type === Text) {
1408
+ insert(
1409
+ createText(
1410
+ node.data.slice(vnode.children.length)
1411
+ ),
1412
+ container,
1413
+ nextSibling(node)
1414
+ );
1415
+ node.data = vnode.children;
1416
+ }
1417
+ }
1418
+ node = hydrateNode(
1419
+ node,
1420
+ vnode,
1421
+ parentComponent,
1422
+ parentSuspense,
1423
+ slotScopeIds,
1424
+ optimized
1425
+ );
1426
+ } else if (isText && !vnode.children) {
1427
+ insert(vnode.el = createText(""), container);
1428
+ } else {
1429
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
1430
+ logMismatchError();
1431
+ }
1432
+ patch(
1433
+ null,
1434
+ vnode,
1435
+ container,
1436
+ null,
1437
+ parentComponent,
1438
+ parentSuspense,
1439
+ getContainerType(container),
1440
+ slotScopeIds
1441
+ );
1516
1442
  }
1517
1443
  }
1518
- } else {
1519
- ret = [];
1520
- }
1521
- if (cache) {
1522
- cache[index] = ret;
1523
- }
1524
- return ret;
1525
- }
1526
-
1527
- function createSlots(slots, dynamicSlots) {
1528
- for (let i = 0; i < dynamicSlots.length; i++) {
1529
- const slot = dynamicSlots[i];
1530
- if (shared.isArray(slot)) {
1531
- for (let j = 0; j < slot.length; j++) {
1532
- slots[slot[j].name] = slot[j].fn;
1533
- }
1534
- } else if (slot) {
1535
- slots[slot.name] = slot.key ? (...args) => {
1536
- const res = slot.fn(...args);
1537
- if (res) res.key = slot.key;
1538
- return res;
1539
- } : slot.fn;
1444
+ return node;
1445
+ };
1446
+ const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1447
+ const { slotScopeIds: fragmentSlotScopeIds } = vnode;
1448
+ if (fragmentSlotScopeIds) {
1449
+ slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
1540
1450
  }
1541
- }
1542
- return slots;
1543
- }
1544
-
1545
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
1546
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
1547
- if (name !== "default") props.name = name;
1548
- return createVNode("slot", props, fallback && fallback());
1549
- }
1550
- let slot = slots[name];
1551
- if (slot && slot._c) {
1552
- slot._d = false;
1553
- }
1554
- openBlock();
1555
- const validSlotContent = slot && ensureValidVNode(slot(props));
1556
- const rendered = createBlock(
1557
- Fragment,
1558
- {
1559
- key: (props.key || // slot content array of a dynamic conditional slot may have a branch
1560
- // key attached in the `createSlots` helper, respect that
1561
- validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
1562
- (!validSlotContent && fallback ? "_fb" : "")
1563
- },
1564
- validSlotContent || (fallback ? fallback() : []),
1565
- validSlotContent && slots._ === 1 ? 64 : -2
1566
- );
1567
- if (!noSlotted && rendered.scopeId) {
1568
- rendered.slotScopeIds = [rendered.scopeId + "-s"];
1569
- }
1570
- if (slot && slot._c) {
1571
- slot._d = true;
1572
- }
1573
- return rendered;
1574
- }
1575
- function ensureValidVNode(vnodes) {
1576
- return vnodes.some((child) => {
1577
- if (!isVNode(child)) return true;
1578
- if (child.type === Comment) return false;
1579
- if (child.type === Fragment && !ensureValidVNode(child.children))
1580
- return false;
1581
- return true;
1582
- }) ? vnodes : null;
1583
- }
1584
-
1585
- function toHandlers(obj, preserveCaseIfNecessary) {
1586
- const ret = {};
1587
- for (const key in obj) {
1588
- ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
1589
- }
1590
- return ret;
1591
- }
1592
-
1593
- const getPublicInstance = (i) => {
1594
- if (!i) return null;
1595
- if (isStatefulComponent(i)) return getComponentPublicInstance(i);
1596
- return getPublicInstance(i.parent);
1597
- };
1598
- const publicPropertiesMap = (
1599
- // Move PURE marker to new line to workaround compiler discarding it
1600
- // due to type annotation
1601
- /* @__PURE__ */ shared.extend(/* @__PURE__ */ Object.create(null), {
1602
- $: (i) => i,
1603
- $el: (i) => i.vnode.el,
1604
- $data: (i) => i.data,
1605
- $props: (i) => i.props,
1606
- $attrs: (i) => i.attrs,
1607
- $slots: (i) => i.slots,
1608
- $refs: (i) => i.refs,
1609
- $parent: (i) => getPublicInstance(i.parent),
1610
- $root: (i) => getPublicInstance(i.root),
1611
- $emit: (i) => i.emit,
1612
- $options: (i) => resolveMergedOptions(i) ,
1613
- $forceUpdate: (i) => i.f || (i.f = () => {
1614
- queueJob(i.update);
1615
- }),
1616
- $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
1617
- $watch: (i) => instanceWatch.bind(i)
1618
- })
1619
- );
1620
- const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
1621
- const PublicInstanceProxyHandlers = {
1622
- get({ _: instance }, key) {
1623
- if (key === "__v_skip") {
1624
- return true;
1451
+ const container = parentNode(node);
1452
+ const next = hydrateChildren(
1453
+ nextSibling(node),
1454
+ vnode,
1455
+ container,
1456
+ parentComponent,
1457
+ parentSuspense,
1458
+ slotScopeIds,
1459
+ optimized
1460
+ );
1461
+ if (next && isComment(next) && next.data === "]") {
1462
+ return nextSibling(vnode.anchor = next);
1463
+ } else {
1464
+ logMismatchError();
1465
+ insert(vnode.anchor = createComment(`]`), container, next);
1466
+ return next;
1625
1467
  }
1626
- const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
1627
- let normalizedProps;
1628
- if (key[0] !== "$") {
1629
- const n = accessCache[key];
1630
- if (n !== void 0) {
1631
- switch (n) {
1632
- case 1 /* SETUP */:
1633
- return setupState[key];
1634
- case 2 /* DATA */:
1635
- return data[key];
1636
- case 4 /* CONTEXT */:
1637
- return ctx[key];
1638
- case 3 /* PROPS */:
1639
- return props[key];
1468
+ };
1469
+ const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
1470
+ if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
1471
+ logMismatchError();
1472
+ }
1473
+ vnode.el = null;
1474
+ if (isFragment) {
1475
+ const end = locateClosingAnchor(node);
1476
+ while (true) {
1477
+ const next2 = nextSibling(node);
1478
+ if (next2 && next2 !== end) {
1479
+ remove(next2);
1480
+ } else {
1481
+ break;
1640
1482
  }
1641
- } else if (hasSetupBinding(setupState, key)) {
1642
- accessCache[key] = 1 /* SETUP */;
1643
- return setupState[key];
1644
- } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
1645
- accessCache[key] = 2 /* DATA */;
1646
- return data[key];
1647
- } else if (
1648
- // only cache other properties when instance has declared (thus stable)
1649
- // props
1650
- (normalizedProps = instance.propsOptions[0]) && shared.hasOwn(normalizedProps, key)
1651
- ) {
1652
- accessCache[key] = 3 /* PROPS */;
1653
- return props[key];
1654
- } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
1655
- accessCache[key] = 4 /* CONTEXT */;
1656
- return ctx[key];
1657
- } else if (shouldCacheAccess) {
1658
- accessCache[key] = 0 /* OTHER */;
1659
1483
  }
1660
1484
  }
1661
- const publicGetter = publicPropertiesMap[key];
1662
- let cssModule, globalProperties;
1663
- if (publicGetter) {
1664
- if (key === "$attrs") {
1665
- reactivity.track(instance.attrs, "get", "");
1666
- }
1667
- return publicGetter(instance);
1668
- } else if (
1669
- // css module (injected by vue-loader)
1670
- (cssModule = type.__cssModules) && (cssModule = cssModule[key])
1671
- ) {
1672
- return cssModule;
1673
- } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
1674
- accessCache[key] = 4 /* CONTEXT */;
1675
- return ctx[key];
1676
- } else if (
1677
- // global properties
1678
- globalProperties = appContext.config.globalProperties, shared.hasOwn(globalProperties, key)
1679
- ) {
1680
- {
1681
- return globalProperties[key];
1485
+ const next = nextSibling(node);
1486
+ const container = parentNode(node);
1487
+ remove(node);
1488
+ patch(
1489
+ null,
1490
+ vnode,
1491
+ container,
1492
+ next,
1493
+ parentComponent,
1494
+ parentSuspense,
1495
+ getContainerType(container),
1496
+ slotScopeIds
1497
+ );
1498
+ return next;
1499
+ };
1500
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
1501
+ let match = 0;
1502
+ while (node) {
1503
+ node = nextSibling(node);
1504
+ if (node && isComment(node)) {
1505
+ if (node.data === open) match++;
1506
+ if (node.data === close) {
1507
+ if (match === 0) {
1508
+ return nextSibling(node);
1509
+ } else {
1510
+ match--;
1511
+ }
1512
+ }
1682
1513
  }
1683
- } else ;
1684
- },
1685
- set({ _: instance }, key, value) {
1686
- const { data, setupState, ctx } = instance;
1687
- if (hasSetupBinding(setupState, key)) {
1688
- setupState[key] = value;
1689
- return true;
1690
- } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
1691
- data[key] = value;
1692
- return true;
1693
- } else if (shared.hasOwn(instance.props, key)) {
1694
- return false;
1695
1514
  }
1696
- if (key[0] === "$" && key.slice(1) in instance) {
1697
- return false;
1698
- } else {
1699
- {
1700
- ctx[key] = value;
1515
+ return node;
1516
+ };
1517
+ const replaceNode = (newNode, oldNode, parentComponent) => {
1518
+ const parentNode2 = oldNode.parentNode;
1519
+ if (parentNode2) {
1520
+ parentNode2.replaceChild(newNode, oldNode);
1521
+ }
1522
+ let parent = parentComponent;
1523
+ while (parent) {
1524
+ if (parent.vnode.el === oldNode) {
1525
+ parent.vnode.el = parent.subTree.el = newNode;
1701
1526
  }
1527
+ parent = parent.parent;
1528
+ }
1529
+ };
1530
+ const isTemplateNode = (node) => {
1531
+ return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
1532
+ };
1533
+ return [hydrate, hydrateNode];
1534
+ }
1535
+ const allowMismatchAttr = "data-allow-mismatch";
1536
+ const MismatchTypeString = {
1537
+ [0 /* TEXT */]: "text",
1538
+ [1 /* CHILDREN */]: "children",
1539
+ [2 /* CLASS */]: "class",
1540
+ [3 /* STYLE */]: "style",
1541
+ [4 /* ATTRIBUTE */]: "attribute"
1542
+ };
1543
+ function isMismatchAllowed(el, allowedType) {
1544
+ if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
1545
+ while (el && !el.hasAttribute(allowMismatchAttr)) {
1546
+ el = el.parentElement;
1702
1547
  }
1548
+ }
1549
+ const allowedAttr = el && el.getAttribute(allowMismatchAttr);
1550
+ if (allowedAttr == null) {
1551
+ return false;
1552
+ } else if (allowedAttr === "") {
1703
1553
  return true;
1704
- },
1705
- has({
1706
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
1707
- }, key) {
1708
- let normalizedProps;
1709
- return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
1710
- },
1711
- defineProperty(target, key, descriptor) {
1712
- if (descriptor.get != null) {
1713
- target._.accessCache[key] = 0;
1714
- } else if (shared.hasOwn(descriptor, "value")) {
1715
- this.set(target, key, descriptor.value, null);
1554
+ } else {
1555
+ const list = allowedAttr.split(",");
1556
+ if (allowedType === 0 /* TEXT */ && list.includes("children")) {
1557
+ return true;
1716
1558
  }
1717
- return Reflect.defineProperty(target, key, descriptor);
1559
+ return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
1718
1560
  }
1561
+ }
1562
+
1563
+ const hydrateOnIdle = () => (hydrate) => {
1564
+ const id = requestIdleCallback(hydrate);
1565
+ return () => cancelIdleCallback(id);
1719
1566
  };
1720
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ shared.extend(
1721
- {},
1722
- PublicInstanceProxyHandlers,
1723
- {
1724
- get(target, key) {
1725
- if (key === Symbol.unscopables) {
1726
- return;
1567
+ const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
1568
+ const ob = new IntersectionObserver(
1569
+ (entries) => {
1570
+ for (const e of entries) {
1571
+ if (!e.isIntersecting) continue;
1572
+ ob.disconnect();
1573
+ hydrate();
1574
+ break;
1727
1575
  }
1728
- return PublicInstanceProxyHandlers.get(target, key, target);
1729
1576
  },
1730
- has(_, key) {
1731
- const has = key[0] !== "_" && !shared.isGloballyAllowed(key);
1732
- return has;
1577
+ {
1578
+ rootMargin: shared.isString(margin) ? margin : margin + "px"
1733
1579
  }
1734
- }
1735
- );
1736
-
1737
- function defineProps() {
1738
- return null;
1739
- }
1740
- function defineEmits() {
1741
- return null;
1742
- }
1743
- function defineExpose(exposed) {
1744
- }
1745
- function defineOptions(options) {
1746
- }
1747
- function defineSlots() {
1748
- return null;
1749
- }
1750
- function defineModel() {
1751
- }
1752
- function withDefaults(props, defaults) {
1753
- return null;
1754
- }
1755
- function useSlots() {
1756
- return getContext().slots;
1757
- }
1758
- function useAttrs() {
1759
- return getContext().attrs;
1760
- }
1761
- function getContext() {
1762
- const i = getCurrentInstance();
1763
- return i.setupContext || (i.setupContext = createSetupContext(i));
1764
- }
1765
- function normalizePropsOrEmits(props) {
1766
- return shared.isArray(props) ? props.reduce(
1767
- (normalized, p) => (normalized[p] = null, normalized),
1768
- {}
1769
- ) : props;
1770
- }
1771
- function mergeDefaults(raw, defaults) {
1772
- const props = normalizePropsOrEmits(raw);
1773
- for (const key in defaults) {
1774
- if (key.startsWith("__skip")) continue;
1775
- let opt = props[key];
1776
- if (opt) {
1777
- if (shared.isArray(opt) || shared.isFunction(opt)) {
1778
- opt = props[key] = { type: opt, default: defaults[key] };
1779
- } else {
1780
- opt.default = defaults[key];
1781
- }
1782
- } else if (opt === null) {
1783
- opt = props[key] = { default: defaults[key] };
1784
- } else ;
1785
- if (opt && defaults[`__skip_${key}`]) {
1786
- opt.skipFactory = true;
1580
+ );
1581
+ forEach((el) => ob.observe(el));
1582
+ return () => ob.disconnect();
1583
+ };
1584
+ const hydrateOnMediaQuery = (query) => (hydrate) => {
1585
+ if (query) {
1586
+ const mql = matchMedia(query);
1587
+ if (mql.matches) {
1588
+ hydrate();
1589
+ } else {
1590
+ mql.addEventListener("change", hydrate, { once: true });
1591
+ return () => mql.removeEventListener("change", hydrate);
1787
1592
  }
1788
1593
  }
1789
- return props;
1790
- }
1791
- function mergeModels(a, b) {
1792
- if (!a || !b) return a || b;
1793
- if (shared.isArray(a) && shared.isArray(b)) return a.concat(b);
1794
- return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
1795
- }
1796
- function createPropsRestProxy(props, excludedKeys) {
1797
- const ret = {};
1798
- for (const key in props) {
1799
- if (!excludedKeys.includes(key)) {
1800
- Object.defineProperty(ret, key, {
1801
- enumerable: true,
1802
- get: () => props[key]
1803
- });
1594
+ };
1595
+ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
1596
+ if (shared.isString(interactions)) interactions = [interactions];
1597
+ let hasHydrated = false;
1598
+ const doHydrate = (e) => {
1599
+ if (!hasHydrated) {
1600
+ hasHydrated = true;
1601
+ teardown();
1602
+ hydrate();
1603
+ e.target.dispatchEvent(new e.constructor(e.type, e));
1804
1604
  }
1805
- }
1806
- return ret;
1807
- }
1808
- function withAsyncContext(getAwaitable) {
1809
- const ctx = getCurrentInstance();
1810
- let awaitable = getAwaitable();
1811
- unsetCurrentInstance();
1812
- if (shared.isPromise(awaitable)) {
1813
- awaitable = awaitable.catch((e) => {
1814
- setCurrentInstance(ctx);
1815
- throw e;
1605
+ };
1606
+ const teardown = () => {
1607
+ forEach((el) => {
1608
+ for (const i of interactions) {
1609
+ el.removeEventListener(i, doHydrate);
1610
+ }
1816
1611
  });
1612
+ };
1613
+ forEach((el) => {
1614
+ for (const i of interactions) {
1615
+ el.addEventListener(i, doHydrate, { once: true });
1616
+ }
1617
+ });
1618
+ return teardown;
1619
+ };
1620
+ function forEachElement(node, cb) {
1621
+ if (isComment(node) && node.data === "[") {
1622
+ let depth = 1;
1623
+ let next = node.nextSibling;
1624
+ while (next) {
1625
+ if (next.nodeType === 1) {
1626
+ cb(next);
1627
+ } else if (isComment(next)) {
1628
+ if (next.data === "]") {
1629
+ if (--depth === 0) break;
1630
+ } else if (next.data === "[") {
1631
+ depth++;
1632
+ }
1633
+ }
1634
+ next = next.nextSibling;
1635
+ }
1636
+ } else {
1637
+ cb(node);
1817
1638
  }
1818
- return [awaitable, () => setCurrentInstance(ctx)];
1819
1639
  }
1820
1640
 
1821
- let shouldCacheAccess = true;
1822
- function applyOptions(instance) {
1823
- const options = resolveMergedOptions(instance);
1824
- const publicThis = instance.proxy;
1825
- const ctx = instance.ctx;
1826
- shouldCacheAccess = false;
1827
- if (options.beforeCreate) {
1828
- callHook(options.beforeCreate, instance, "bc");
1641
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1642
+ /*! #__NO_SIDE_EFFECTS__ */
1643
+ // @__NO_SIDE_EFFECTS__
1644
+ function defineAsyncComponent(source) {
1645
+ if (shared.isFunction(source)) {
1646
+ source = { loader: source };
1829
1647
  }
1830
1648
  const {
1831
- // state
1832
- data: dataOptions,
1833
- computed: computedOptions,
1834
- methods,
1835
- watch: watchOptions,
1836
- provide: provideOptions,
1837
- inject: injectOptions,
1838
- // lifecycle
1839
- created,
1840
- beforeMount,
1841
- mounted,
1842
- beforeUpdate,
1843
- updated,
1844
- activated,
1845
- deactivated,
1846
- beforeDestroy,
1847
- beforeUnmount,
1848
- destroyed,
1849
- unmounted,
1850
- render,
1851
- renderTracked,
1852
- renderTriggered,
1853
- errorCaptured,
1854
- serverPrefetch,
1855
- // public API
1856
- expose,
1857
- inheritAttrs,
1858
- // assets
1859
- components,
1860
- directives,
1861
- filters
1862
- } = options;
1863
- const checkDuplicateProperties = null;
1864
- if (injectOptions) {
1865
- resolveInjections(injectOptions, ctx, checkDuplicateProperties);
1866
- }
1867
- if (methods) {
1868
- for (const key in methods) {
1869
- const methodHandler = methods[key];
1870
- if (shared.isFunction(methodHandler)) {
1871
- {
1872
- ctx[key] = methodHandler.bind(publicThis);
1649
+ loader,
1650
+ loadingComponent,
1651
+ errorComponent,
1652
+ delay = 200,
1653
+ hydrate: hydrateStrategy,
1654
+ timeout,
1655
+ // undefined = never times out
1656
+ suspensible = true,
1657
+ onError: userOnError
1658
+ } = source;
1659
+ let pendingRequest = null;
1660
+ let resolvedComp;
1661
+ let retries = 0;
1662
+ const retry = () => {
1663
+ retries++;
1664
+ pendingRequest = null;
1665
+ return load();
1666
+ };
1667
+ const load = () => {
1668
+ let thisRequest;
1669
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1670
+ err = err instanceof Error ? err : new Error(String(err));
1671
+ if (userOnError) {
1672
+ return new Promise((resolve, reject) => {
1673
+ const userRetry = () => resolve(retry());
1674
+ const userFail = () => reject(err);
1675
+ userOnError(err, userRetry, userFail, retries + 1);
1676
+ });
1677
+ } else {
1678
+ throw err;
1679
+ }
1680
+ }).then((comp) => {
1681
+ if (thisRequest !== pendingRequest && pendingRequest) {
1682
+ return pendingRequest;
1683
+ }
1684
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
1685
+ comp = comp.default;
1686
+ }
1687
+ resolvedComp = comp;
1688
+ return comp;
1689
+ }));
1690
+ };
1691
+ return defineComponent({
1692
+ name: "AsyncComponentWrapper",
1693
+ __asyncLoader: load,
1694
+ __asyncHydrate(el, instance, hydrate) {
1695
+ const doHydrate = hydrateStrategy ? () => {
1696
+ const teardown = hydrateStrategy(
1697
+ hydrate,
1698
+ (cb) => forEachElement(el, cb)
1699
+ );
1700
+ if (teardown) {
1701
+ (instance.bum || (instance.bum = [])).push(teardown);
1873
1702
  }
1703
+ } : hydrate;
1704
+ if (resolvedComp) {
1705
+ doHydrate();
1706
+ } else {
1707
+ load().then(() => !instance.isUnmounted && doHydrate());
1708
+ }
1709
+ },
1710
+ get __asyncResolved() {
1711
+ return resolvedComp;
1712
+ },
1713
+ setup() {
1714
+ const instance = currentInstance;
1715
+ markAsyncBoundary(instance);
1716
+ if (resolvedComp) {
1717
+ return () => createInnerComp(resolvedComp, instance);
1718
+ }
1719
+ const onError = (err) => {
1720
+ pendingRequest = null;
1721
+ handleError(
1722
+ err,
1723
+ instance,
1724
+ 13,
1725
+ !errorComponent
1726
+ );
1727
+ };
1728
+ if (suspensible && instance.suspense || isInSSRComponentSetup) {
1729
+ return load().then((comp) => {
1730
+ return () => createInnerComp(comp, instance);
1731
+ }).catch((err) => {
1732
+ onError(err);
1733
+ return () => errorComponent ? createVNode(errorComponent, {
1734
+ error: err
1735
+ }) : null;
1736
+ });
1874
1737
  }
1875
- }
1876
- }
1877
- if (dataOptions) {
1878
- const data = dataOptions.call(publicThis, publicThis);
1879
- if (!shared.isObject(data)) ; else {
1880
- instance.data = reactivity.reactive(data);
1881
- }
1882
- }
1883
- shouldCacheAccess = true;
1884
- if (computedOptions) {
1885
- for (const key in computedOptions) {
1886
- const opt = computedOptions[key];
1887
- const get = shared.isFunction(opt) ? opt.bind(publicThis, publicThis) : shared.isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : shared.NOOP;
1888
- const set = !shared.isFunction(opt) && shared.isFunction(opt.set) ? opt.set.bind(publicThis) : shared.NOOP;
1889
- const c = computed({
1890
- get,
1891
- set
1892
- });
1893
- Object.defineProperty(ctx, key, {
1894
- enumerable: true,
1895
- configurable: true,
1896
- get: () => c.value,
1897
- set: (v) => c.value = v
1738
+ const loaded = reactivity.ref(false);
1739
+ const error = reactivity.ref();
1740
+ const delayed = reactivity.ref(!!delay);
1741
+ if (delay) {
1742
+ setTimeout(() => {
1743
+ delayed.value = false;
1744
+ }, delay);
1745
+ }
1746
+ if (timeout != null) {
1747
+ setTimeout(() => {
1748
+ if (!loaded.value && !error.value) {
1749
+ const err = new Error(
1750
+ `Async component timed out after ${timeout}ms.`
1751
+ );
1752
+ onError(err);
1753
+ error.value = err;
1754
+ }
1755
+ }, timeout);
1756
+ }
1757
+ load().then(() => {
1758
+ loaded.value = true;
1759
+ if (instance.parent && isKeepAlive(instance.parent.vnode)) {
1760
+ queueJob(instance.parent.update);
1761
+ }
1762
+ }).catch((err) => {
1763
+ onError(err);
1764
+ error.value = err;
1898
1765
  });
1766
+ return () => {
1767
+ if (loaded.value && resolvedComp) {
1768
+ return createInnerComp(resolvedComp, instance);
1769
+ } else if (error.value && errorComponent) {
1770
+ return createVNode(errorComponent, {
1771
+ error: error.value
1772
+ });
1773
+ } else if (loadingComponent && !delayed.value) {
1774
+ return createVNode(loadingComponent);
1775
+ }
1776
+ };
1899
1777
  }
1900
- }
1901
- if (watchOptions) {
1902
- for (const key in watchOptions) {
1903
- createWatcher(watchOptions[key], ctx, publicThis, key);
1778
+ });
1779
+ }
1780
+ function createInnerComp(comp, parent) {
1781
+ const { ref: ref2, props, children, ce } = parent.vnode;
1782
+ const vnode = createVNode(comp, props, children);
1783
+ vnode.ref = ref2;
1784
+ vnode.ce = ce;
1785
+ delete parent.vnode.ce;
1786
+ return vnode;
1787
+ }
1788
+
1789
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
1790
+ const KeepAliveImpl = {
1791
+ name: `KeepAlive`,
1792
+ // Marker for special handling inside the renderer. We are not using a ===
1793
+ // check directly on KeepAlive in the renderer, because importing it directly
1794
+ // would prevent it from being tree-shaken.
1795
+ __isKeepAlive: true,
1796
+ props: {
1797
+ include: [String, RegExp, Array],
1798
+ exclude: [String, RegExp, Array],
1799
+ max: [String, Number]
1800
+ },
1801
+ setup(props, { slots }) {
1802
+ const instance = getCurrentInstance();
1803
+ const sharedContext = instance.ctx;
1804
+ if (!sharedContext.renderer) {
1805
+ return () => {
1806
+ const children = slots.default && slots.default();
1807
+ return children && children.length === 1 ? children[0] : children;
1808
+ };
1904
1809
  }
1905
- }
1906
- if (provideOptions) {
1907
- const provides = shared.isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
1908
- Reflect.ownKeys(provides).forEach((key) => {
1909
- provide(key, provides[key]);
1910
- });
1911
- }
1912
- if (created) {
1913
- callHook(created, instance, "c");
1914
- }
1915
- function registerLifecycleHook(register, hook) {
1916
- if (shared.isArray(hook)) {
1917
- hook.forEach((_hook) => register(_hook.bind(publicThis)));
1918
- } else if (hook) {
1919
- register(hook.bind(publicThis));
1810
+ const cache = /* @__PURE__ */ new Map();
1811
+ const keys = /* @__PURE__ */ new Set();
1812
+ let current = null;
1813
+ const parentSuspense = instance.suspense;
1814
+ const {
1815
+ renderer: {
1816
+ p: patch,
1817
+ m: move,
1818
+ um: _unmount,
1819
+ o: { createElement }
1820
+ }
1821
+ } = sharedContext;
1822
+ const storageContainer = createElement("div");
1823
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
1824
+ const instance2 = vnode.component;
1825
+ move(vnode, container, anchor, 0, parentSuspense);
1826
+ patch(
1827
+ instance2.vnode,
1828
+ vnode,
1829
+ container,
1830
+ anchor,
1831
+ instance2,
1832
+ parentSuspense,
1833
+ namespace,
1834
+ vnode.slotScopeIds,
1835
+ optimized
1836
+ );
1837
+ queuePostRenderEffect(() => {
1838
+ instance2.isDeactivated = false;
1839
+ if (instance2.a) {
1840
+ shared.invokeArrayFns(instance2.a);
1841
+ }
1842
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
1843
+ if (vnodeHook) {
1844
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1845
+ }
1846
+ }, parentSuspense);
1847
+ };
1848
+ sharedContext.deactivate = (vnode) => {
1849
+ const instance2 = vnode.component;
1850
+ invalidateMount(instance2.m);
1851
+ invalidateMount(instance2.a);
1852
+ move(vnode, storageContainer, null, 1, parentSuspense);
1853
+ queuePostRenderEffect(() => {
1854
+ if (instance2.da) {
1855
+ shared.invokeArrayFns(instance2.da);
1856
+ }
1857
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
1858
+ if (vnodeHook) {
1859
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1860
+ }
1861
+ instance2.isDeactivated = true;
1862
+ }, parentSuspense);
1863
+ };
1864
+ function unmount(vnode) {
1865
+ resetShapeFlag(vnode);
1866
+ _unmount(vnode, instance, parentSuspense, true);
1920
1867
  }
1921
- }
1922
- registerLifecycleHook(onBeforeMount, beforeMount);
1923
- registerLifecycleHook(onMounted, mounted);
1924
- registerLifecycleHook(onBeforeUpdate, beforeUpdate);
1925
- registerLifecycleHook(onUpdated, updated);
1926
- registerLifecycleHook(onActivated, activated);
1927
- registerLifecycleHook(onDeactivated, deactivated);
1928
- registerLifecycleHook(onErrorCaptured, errorCaptured);
1929
- registerLifecycleHook(onRenderTracked, renderTracked);
1930
- registerLifecycleHook(onRenderTriggered, renderTriggered);
1931
- registerLifecycleHook(onBeforeUnmount, beforeUnmount);
1932
- registerLifecycleHook(onUnmounted, unmounted);
1933
- registerLifecycleHook(onServerPrefetch, serverPrefetch);
1934
- if (shared.isArray(expose)) {
1935
- if (expose.length) {
1936
- const exposed = instance.exposed || (instance.exposed = {});
1937
- expose.forEach((key) => {
1938
- Object.defineProperty(exposed, key, {
1939
- get: () => publicThis[key],
1940
- set: (val) => publicThis[key] = val
1941
- });
1868
+ function pruneCache(filter) {
1869
+ cache.forEach((vnode, key) => {
1870
+ const name = getComponentName(vnode.type);
1871
+ if (name && (!filter || !filter(name))) {
1872
+ pruneCacheEntry(key);
1873
+ }
1942
1874
  });
1943
- } else if (!instance.exposed) {
1944
- instance.exposed = {};
1945
1875
  }
1876
+ function pruneCacheEntry(key) {
1877
+ const cached = cache.get(key);
1878
+ if (!current || !isSameVNodeType(cached, current)) {
1879
+ unmount(cached);
1880
+ } else if (current) {
1881
+ resetShapeFlag(current);
1882
+ }
1883
+ cache.delete(key);
1884
+ keys.delete(key);
1885
+ }
1886
+ watch(
1887
+ () => [props.include, props.exclude],
1888
+ ([include, exclude]) => {
1889
+ include && pruneCache((name) => matches(include, name));
1890
+ exclude && pruneCache((name) => !matches(exclude, name));
1891
+ },
1892
+ // prune post-render after `current` has been updated
1893
+ { flush: "post", deep: true }
1894
+ );
1895
+ let pendingCacheKey = null;
1896
+ const cacheSubtree = () => {
1897
+ if (pendingCacheKey != null) {
1898
+ if (isSuspense(instance.subTree.type)) {
1899
+ queuePostRenderEffect(() => {
1900
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1901
+ }, instance.subTree.suspense);
1902
+ } else {
1903
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1904
+ }
1905
+ }
1906
+ };
1907
+ onMounted(cacheSubtree);
1908
+ onUpdated(cacheSubtree);
1909
+ onBeforeUnmount(() => {
1910
+ cache.forEach((cached) => {
1911
+ const { subTree, suspense } = instance;
1912
+ const vnode = getInnerChild(subTree);
1913
+ if (cached.type === vnode.type && cached.key === vnode.key) {
1914
+ resetShapeFlag(vnode);
1915
+ const da = vnode.component.da;
1916
+ da && queuePostRenderEffect(da, suspense);
1917
+ return;
1918
+ }
1919
+ unmount(cached);
1920
+ });
1921
+ });
1922
+ return () => {
1923
+ pendingCacheKey = null;
1924
+ if (!slots.default) {
1925
+ return null;
1926
+ }
1927
+ const children = slots.default();
1928
+ const rawVNode = children[0];
1929
+ if (children.length > 1) {
1930
+ current = null;
1931
+ return children;
1932
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
1933
+ current = null;
1934
+ return rawVNode;
1935
+ }
1936
+ let vnode = getInnerChild(rawVNode);
1937
+ const comp = vnode.type;
1938
+ const name = getComponentName(
1939
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
1940
+ );
1941
+ const { include, exclude, max } = props;
1942
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
1943
+ current = vnode;
1944
+ return rawVNode;
1945
+ }
1946
+ const key = vnode.key == null ? comp : vnode.key;
1947
+ const cachedVNode = cache.get(key);
1948
+ if (vnode.el) {
1949
+ vnode = cloneVNode(vnode);
1950
+ if (rawVNode.shapeFlag & 128) {
1951
+ rawVNode.ssContent = vnode;
1952
+ }
1953
+ }
1954
+ pendingCacheKey = key;
1955
+ if (cachedVNode) {
1956
+ vnode.el = cachedVNode.el;
1957
+ vnode.component = cachedVNode.component;
1958
+ if (vnode.transition) {
1959
+ setTransitionHooks(vnode, vnode.transition);
1960
+ }
1961
+ vnode.shapeFlag |= 512;
1962
+ keys.delete(key);
1963
+ keys.add(key);
1964
+ } else {
1965
+ keys.add(key);
1966
+ if (max && keys.size > parseInt(max, 10)) {
1967
+ pruneCacheEntry(keys.values().next().value);
1968
+ }
1969
+ }
1970
+ vnode.shapeFlag |= 256;
1971
+ current = vnode;
1972
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
1973
+ };
1946
1974
  }
1947
- if (render && instance.render === shared.NOOP) {
1948
- instance.render = render;
1949
- }
1950
- if (inheritAttrs != null) {
1951
- instance.inheritAttrs = inheritAttrs;
1952
- }
1953
- if (components) instance.components = components;
1954
- if (directives) instance.directives = directives;
1955
- if (serverPrefetch) {
1956
- markAsyncBoundary(instance);
1975
+ };
1976
+ const KeepAlive = KeepAliveImpl;
1977
+ function matches(pattern, name) {
1978
+ if (shared.isArray(pattern)) {
1979
+ return pattern.some((p) => matches(p, name));
1980
+ } else if (shared.isString(pattern)) {
1981
+ return pattern.split(",").includes(name);
1982
+ } else if (shared.isRegExp(pattern)) {
1983
+ return pattern.test(name);
1957
1984
  }
1985
+ return false;
1958
1986
  }
1959
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
1960
- if (shared.isArray(injectOptions)) {
1961
- injectOptions = normalizeInject(injectOptions);
1962
- }
1963
- for (const key in injectOptions) {
1964
- const opt = injectOptions[key];
1965
- let injected;
1966
- if (shared.isObject(opt)) {
1967
- if ("default" in opt) {
1968
- injected = inject(
1969
- opt.from || key,
1970
- opt.default,
1971
- true
1972
- );
1973
- } else {
1974
- injected = inject(opt.from || key);
1987
+ function onActivated(hook, target) {
1988
+ registerKeepAliveHook(hook, "a", target);
1989
+ }
1990
+ function onDeactivated(hook, target) {
1991
+ registerKeepAliveHook(hook, "da", target);
1992
+ }
1993
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
1994
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
1995
+ let current = target;
1996
+ while (current) {
1997
+ if (current.isDeactivated) {
1998
+ return;
1975
1999
  }
1976
- } else {
1977
- injected = inject(opt);
2000
+ current = current.parent;
1978
2001
  }
1979
- if (reactivity.isRef(injected)) {
1980
- Object.defineProperty(ctx, key, {
1981
- enumerable: true,
1982
- configurable: true,
1983
- get: () => injected.value,
1984
- set: (v) => injected.value = v
1985
- });
1986
- } else {
1987
- ctx[key] = injected;
2002
+ return hook();
2003
+ });
2004
+ injectHook(type, wrappedHook, target);
2005
+ if (target) {
2006
+ let current = target.parent;
2007
+ while (current && current.parent) {
2008
+ if (isKeepAlive(current.parent.vnode)) {
2009
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
2010
+ }
2011
+ current = current.parent;
1988
2012
  }
1989
2013
  }
1990
2014
  }
1991
- function callHook(hook, instance, type) {
1992
- callWithAsyncErrorHandling(
1993
- shared.isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
1994
- instance,
1995
- type
2015
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2016
+ const injected = injectHook(
2017
+ type,
2018
+ hook,
2019
+ keepAliveRoot,
2020
+ true
2021
+ /* prepend */
1996
2022
  );
2023
+ onUnmounted(() => {
2024
+ shared.remove(keepAliveRoot[type], injected);
2025
+ }, target);
1997
2026
  }
1998
- function createWatcher(raw, ctx, publicThis, key) {
1999
- const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
2000
- if (shared.isString(raw)) {
2001
- const handler = ctx[raw];
2002
- if (shared.isFunction(handler)) {
2003
- watch(getter, handler);
2004
- }
2005
- } else if (shared.isFunction(raw)) {
2006
- watch(getter, raw.bind(publicThis));
2007
- } else if (shared.isObject(raw)) {
2008
- if (shared.isArray(raw)) {
2009
- raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
2010
- } else {
2011
- const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
2012
- if (shared.isFunction(handler)) {
2013
- watch(getter, handler, raw);
2014
- }
2015
- }
2016
- } else ;
2027
+ function resetShapeFlag(vnode) {
2028
+ vnode.shapeFlag &= ~256;
2029
+ vnode.shapeFlag &= ~512;
2017
2030
  }
2018
- function resolveMergedOptions(instance) {
2019
- const base = instance.type;
2020
- const { mixins, extends: extendsOptions } = base;
2021
- const {
2022
- mixins: globalMixins,
2023
- optionsCache: cache,
2024
- config: { optionMergeStrategies }
2025
- } = instance.appContext;
2026
- const cached = cache.get(base);
2027
- let resolved;
2028
- if (cached) {
2029
- resolved = cached;
2030
- } else if (!globalMixins.length && !mixins && !extendsOptions) {
2031
- {
2032
- resolved = base;
2033
- }
2034
- } else {
2035
- resolved = {};
2036
- if (globalMixins.length) {
2037
- globalMixins.forEach(
2038
- (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
2039
- );
2040
- }
2041
- mergeOptions(resolved, base, optionMergeStrategies);
2042
- }
2043
- if (shared.isObject(base)) {
2044
- cache.set(base, resolved);
2045
- }
2046
- return resolved;
2031
+ function getInnerChild(vnode) {
2032
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2047
2033
  }
2048
- function mergeOptions(to, from, strats, asMixin = false) {
2049
- const { mixins, extends: extendsOptions } = from;
2050
- if (extendsOptions) {
2051
- mergeOptions(to, extendsOptions, strats, true);
2052
- }
2053
- if (mixins) {
2054
- mixins.forEach(
2055
- (m) => mergeOptions(to, m, strats, true)
2056
- );
2057
- }
2058
- for (const key in from) {
2059
- if (asMixin && key === "expose") ; else {
2060
- const strat = internalOptionMergeStrats[key] || strats && strats[key];
2061
- to[key] = strat ? strat(to[key], from[key]) : from[key];
2034
+
2035
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
2036
+ if (target) {
2037
+ const hooks = target[type] || (target[type] = []);
2038
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2039
+ reactivity.pauseTracking();
2040
+ const reset = setCurrentInstance(target);
2041
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
2042
+ reset();
2043
+ reactivity.resetTracking();
2044
+ return res;
2045
+ });
2046
+ if (prepend) {
2047
+ hooks.unshift(wrappedHook);
2048
+ } else {
2049
+ hooks.push(wrappedHook);
2062
2050
  }
2051
+ return wrappedHook;
2063
2052
  }
2064
- return to;
2065
- }
2066
- const internalOptionMergeStrats = {
2067
- data: mergeDataFn,
2068
- props: mergeEmitsOrPropsOptions,
2069
- emits: mergeEmitsOrPropsOptions,
2070
- // objects
2071
- methods: mergeObjectOptions,
2072
- computed: mergeObjectOptions,
2073
- // lifecycle
2074
- beforeCreate: mergeAsArray,
2075
- created: mergeAsArray,
2076
- beforeMount: mergeAsArray,
2077
- mounted: mergeAsArray,
2078
- beforeUpdate: mergeAsArray,
2079
- updated: mergeAsArray,
2080
- beforeDestroy: mergeAsArray,
2081
- beforeUnmount: mergeAsArray,
2082
- destroyed: mergeAsArray,
2083
- unmounted: mergeAsArray,
2084
- activated: mergeAsArray,
2085
- deactivated: mergeAsArray,
2086
- errorCaptured: mergeAsArray,
2087
- serverPrefetch: mergeAsArray,
2088
- // assets
2089
- components: mergeObjectOptions,
2090
- directives: mergeObjectOptions,
2091
- // watch
2092
- watch: mergeWatchOptions,
2093
- // provide / inject
2094
- provide: mergeDataFn,
2095
- inject: mergeInject
2096
- };
2097
- function mergeDataFn(to, from) {
2098
- if (!from) {
2099
- return to;
2100
- }
2101
- if (!to) {
2102
- return from;
2053
+ }
2054
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
2055
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
2056
+ injectHook(lifecycle, (...args) => hook(...args), target);
2103
2057
  }
2104
- return function mergedDataFn() {
2105
- return (shared.extend)(
2106
- shared.isFunction(to) ? to.call(this, this) : to,
2107
- shared.isFunction(from) ? from.call(this, this) : from
2108
- );
2109
- };
2058
+ };
2059
+ const onBeforeMount = createHook("bm");
2060
+ const onMounted = createHook("m");
2061
+ const onBeforeUpdate = createHook("bu");
2062
+ const onUpdated = createHook("u");
2063
+ const onBeforeUnmount = createHook("bum");
2064
+ const onUnmounted = createHook("um");
2065
+ const onServerPrefetch = createHook("sp");
2066
+ const onRenderTriggered = createHook(
2067
+ "rtg"
2068
+ );
2069
+ const onRenderTracked = createHook(
2070
+ "rtc"
2071
+ );
2072
+ function onErrorCaptured(hook, target = currentInstance) {
2073
+ injectHook("ec", hook, target);
2110
2074
  }
2111
- function mergeInject(to, from) {
2112
- return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
2075
+
2076
+ const COMPONENTS = "components";
2077
+ const DIRECTIVES = "directives";
2078
+ function resolveComponent(name, maybeSelfReference) {
2079
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2113
2080
  }
2114
- function normalizeInject(raw) {
2115
- if (shared.isArray(raw)) {
2116
- const res = {};
2117
- for (let i = 0; i < raw.length; i++) {
2118
- res[raw[i]] = raw[i];
2119
- }
2120
- return res;
2081
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2082
+ function resolveDynamicComponent(component) {
2083
+ if (shared.isString(component)) {
2084
+ return resolveAsset(COMPONENTS, component, false) || component;
2085
+ } else {
2086
+ return component || NULL_DYNAMIC_COMPONENT;
2121
2087
  }
2122
- return raw;
2123
- }
2124
- function mergeAsArray(to, from) {
2125
- return to ? [...new Set([].concat(to, from))] : from;
2126
2088
  }
2127
- function mergeObjectOptions(to, from) {
2128
- return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
2089
+ function resolveDirective(name) {
2090
+ return resolveAsset(DIRECTIVES, name);
2129
2091
  }
2130
- function mergeEmitsOrPropsOptions(to, from) {
2131
- if (to) {
2132
- if (shared.isArray(to) && shared.isArray(from)) {
2133
- return [.../* @__PURE__ */ new Set([...to, ...from])];
2092
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2093
+ const instance = currentRenderingInstance || currentInstance;
2094
+ if (instance) {
2095
+ const Component = instance.type;
2096
+ if (type === COMPONENTS) {
2097
+ const selfName = getComponentName(
2098
+ Component,
2099
+ false
2100
+ );
2101
+ if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
2102
+ return Component;
2103
+ }
2134
2104
  }
2135
- return shared.extend(
2136
- /* @__PURE__ */ Object.create(null),
2137
- normalizePropsOrEmits(to),
2138
- normalizePropsOrEmits(from != null ? from : {})
2105
+ const res = (
2106
+ // local registration
2107
+ // check instance[type] first which is resolved for options API
2108
+ resolve(instance[type] || Component[type], name) || // global registration
2109
+ resolve(instance.appContext[type], name)
2139
2110
  );
2140
- } else {
2141
- return from;
2111
+ if (!res && maybeSelfReference) {
2112
+ return Component;
2113
+ }
2114
+ return res;
2142
2115
  }
2143
2116
  }
2144
- function mergeWatchOptions(to, from) {
2145
- if (!to) return from;
2146
- if (!from) return to;
2147
- const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
2148
- for (const key in from) {
2149
- merged[key] = mergeAsArray(to[key], from[key]);
2150
- }
2151
- return merged;
2117
+ function resolve(registry, name) {
2118
+ return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
2152
2119
  }
2153
2120
 
2154
- function createAppContext() {
2155
- return {
2156
- app: null,
2157
- config: {
2158
- isNativeTag: shared.NO,
2159
- performance: false,
2160
- globalProperties: {},
2161
- optionMergeStrategies: {},
2162
- errorHandler: void 0,
2163
- warnHandler: void 0,
2164
- compilerOptions: {}
2165
- },
2166
- mixins: [],
2167
- components: {},
2168
- directives: {},
2169
- provides: /* @__PURE__ */ Object.create(null),
2170
- optionsCache: /* @__PURE__ */ new WeakMap(),
2171
- propsCache: /* @__PURE__ */ new WeakMap(),
2172
- emitsCache: /* @__PURE__ */ new WeakMap()
2173
- };
2174
- }
2175
- let uid$1 = 0;
2176
- function createAppAPI(render, hydrate) {
2177
- return function createApp(rootComponent, rootProps = null) {
2178
- if (!shared.isFunction(rootComponent)) {
2179
- rootComponent = shared.extend({}, rootComponent);
2121
+ function renderList(source, renderItem, cache, index) {
2122
+ let ret;
2123
+ const cached = cache && cache[index];
2124
+ const sourceIsArray = shared.isArray(source);
2125
+ if (sourceIsArray || shared.isString(source)) {
2126
+ const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
2127
+ if (sourceIsReactiveArray) {
2128
+ source = reactivity.shallowReadArray(source);
2180
2129
  }
2181
- if (rootProps != null && !shared.isObject(rootProps)) {
2182
- rootProps = null;
2130
+ ret = new Array(source.length);
2131
+ for (let i = 0, l = source.length; i < l; i++) {
2132
+ ret[i] = renderItem(
2133
+ sourceIsReactiveArray ? reactivity.toReactive(source[i]) : source[i],
2134
+ i,
2135
+ void 0,
2136
+ cached && cached[i]
2137
+ );
2183
2138
  }
2184
- const context = createAppContext();
2185
- const installedPlugins = /* @__PURE__ */ new WeakSet();
2186
- const pluginCleanupFns = [];
2187
- let isMounted = false;
2188
- const app = context.app = {
2189
- _uid: uid$1++,
2190
- _component: rootComponent,
2191
- _props: rootProps,
2192
- _container: null,
2193
- _context: context,
2194
- _instance: null,
2195
- version,
2196
- get config() {
2197
- return context.config;
2198
- },
2199
- set config(v) {
2200
- },
2201
- use(plugin, ...options) {
2202
- if (installedPlugins.has(plugin)) ; else if (plugin && shared.isFunction(plugin.install)) {
2203
- installedPlugins.add(plugin);
2204
- plugin.install(app, ...options);
2205
- } else if (shared.isFunction(plugin)) {
2206
- installedPlugins.add(plugin);
2207
- plugin(app, ...options);
2208
- } else ;
2209
- return app;
2210
- },
2211
- mixin(mixin) {
2212
- {
2213
- if (!context.mixins.includes(mixin)) {
2214
- context.mixins.push(mixin);
2215
- }
2216
- }
2217
- return app;
2218
- },
2219
- component(name, component) {
2220
- if (!component) {
2221
- return context.components[name];
2222
- }
2223
- context.components[name] = component;
2224
- return app;
2225
- },
2226
- directive(name, directive) {
2227
- if (!directive) {
2228
- return context.directives[name];
2229
- }
2230
- context.directives[name] = directive;
2231
- return app;
2232
- },
2233
- mount(rootContainer, isHydrate, namespace) {
2234
- if (!isMounted) {
2235
- const vnode = createVNode(rootComponent, rootProps);
2236
- vnode.appContext = context;
2237
- if (namespace === true) {
2238
- namespace = "svg";
2239
- } else if (namespace === false) {
2240
- namespace = void 0;
2241
- }
2242
- if (isHydrate && hydrate) {
2243
- hydrate(vnode, rootContainer);
2244
- } else {
2245
- render(vnode, rootContainer, namespace);
2246
- }
2247
- isMounted = true;
2248
- app._container = rootContainer;
2249
- rootContainer.__vue_app__ = app;
2250
- return getComponentPublicInstance(vnode.component);
2251
- }
2252
- },
2253
- onUnmount(cleanupFn) {
2254
- pluginCleanupFns.push(cleanupFn);
2255
- },
2256
- unmount() {
2257
- if (isMounted) {
2258
- callWithAsyncErrorHandling(
2259
- pluginCleanupFns,
2260
- app._instance,
2261
- 16
2262
- );
2263
- render(null, app._container);
2264
- delete app._container.__vue_app__;
2265
- }
2266
- },
2267
- provide(key, value) {
2268
- context.provides[key] = value;
2269
- return app;
2270
- },
2271
- runWithContext(fn) {
2272
- const lastApp = currentApp;
2273
- currentApp = app;
2274
- try {
2275
- return fn();
2276
- } finally {
2277
- currentApp = lastApp;
2278
- }
2279
- }
2280
- };
2281
- return app;
2282
- };
2139
+ } else if (typeof source === "number") {
2140
+ ret = new Array(source);
2141
+ for (let i = 0; i < source; i++) {
2142
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2143
+ }
2144
+ } else if (shared.isObject(source)) {
2145
+ if (source[Symbol.iterator]) {
2146
+ ret = Array.from(
2147
+ source,
2148
+ (item, i) => renderItem(item, i, void 0, cached && cached[i])
2149
+ );
2150
+ } else {
2151
+ const keys = Object.keys(source);
2152
+ ret = new Array(keys.length);
2153
+ for (let i = 0, l = keys.length; i < l; i++) {
2154
+ const key = keys[i];
2155
+ ret[i] = renderItem(source[key], key, i, cached && cached[i]);
2156
+ }
2157
+ }
2158
+ } else {
2159
+ ret = [];
2160
+ }
2161
+ if (cache) {
2162
+ cache[index] = ret;
2163
+ }
2164
+ return ret;
2283
2165
  }
2284
- let currentApp = null;
2285
2166
 
2286
- function provide(key, value) {
2287
- if (!currentInstance) ; else {
2288
- let provides = currentInstance.provides;
2289
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
2290
- if (parentProvides === provides) {
2291
- provides = currentInstance.provides = Object.create(parentProvides);
2167
+ function createSlots(slots, dynamicSlots) {
2168
+ for (let i = 0; i < dynamicSlots.length; i++) {
2169
+ const slot = dynamicSlots[i];
2170
+ if (shared.isArray(slot)) {
2171
+ for (let j = 0; j < slot.length; j++) {
2172
+ slots[slot[j].name] = slot[j].fn;
2173
+ }
2174
+ } else if (slot) {
2175
+ slots[slot.name] = slot.key ? (...args) => {
2176
+ const res = slot.fn(...args);
2177
+ if (res) res.key = slot.key;
2178
+ return res;
2179
+ } : slot.fn;
2292
2180
  }
2293
- provides[key] = value;
2294
2181
  }
2182
+ return slots;
2295
2183
  }
2296
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
2297
- const instance = currentInstance || currentRenderingInstance;
2298
- if (instance || currentApp) {
2299
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
2300
- if (provides && key in provides) {
2301
- return provides[key];
2302
- } else if (arguments.length > 1) {
2303
- return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
2304
- } else ;
2184
+
2185
+ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2186
+ if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2187
+ if (name !== "default") props.name = name;
2188
+ return createVNode("slot", props, fallback && fallback());
2189
+ }
2190
+ let slot = slots[name];
2191
+ if (slot && slot._c) {
2192
+ slot._d = false;
2193
+ }
2194
+ openBlock();
2195
+ const validSlotContent = slot && ensureValidVNode(slot(props));
2196
+ const rendered = createBlock(
2197
+ Fragment,
2198
+ {
2199
+ key: (props.key || // slot content array of a dynamic conditional slot may have a branch
2200
+ // key attached in the `createSlots` helper, respect that
2201
+ validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
2202
+ (!validSlotContent && fallback ? "_fb" : "")
2203
+ },
2204
+ validSlotContent || (fallback ? fallback() : []),
2205
+ validSlotContent && slots._ === 1 ? 64 : -2
2206
+ );
2207
+ if (!noSlotted && rendered.scopeId) {
2208
+ rendered.slotScopeIds = [rendered.scopeId + "-s"];
2209
+ }
2210
+ if (slot && slot._c) {
2211
+ slot._d = true;
2305
2212
  }
2213
+ return rendered;
2306
2214
  }
2307
- function hasInjectionContext() {
2308
- return !!(currentInstance || currentRenderingInstance || currentApp);
2215
+ function ensureValidVNode(vnodes) {
2216
+ return vnodes.some((child) => {
2217
+ if (!isVNode(child)) return true;
2218
+ if (child.type === Comment) return false;
2219
+ if (child.type === Fragment && !ensureValidVNode(child.children))
2220
+ return false;
2221
+ return true;
2222
+ }) ? vnodes : null;
2309
2223
  }
2310
2224
 
2311
- const internalObjectProto = {};
2312
- const createInternalObject = () => Object.create(internalObjectProto);
2313
- const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
2314
-
2315
- function initProps(instance, rawProps, isStateful, isSSR = false) {
2316
- const props = {};
2317
- const attrs = createInternalObject();
2318
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
2319
- setFullProps(instance, rawProps, props, attrs);
2320
- for (const key in instance.propsOptions[0]) {
2321
- if (!(key in props)) {
2322
- props[key] = void 0;
2323
- }
2324
- }
2325
- if (isStateful) {
2326
- instance.props = isSSR ? props : reactivity.shallowReactive(props);
2327
- } else {
2328
- if (!instance.type.props) {
2329
- instance.props = attrs;
2330
- } else {
2331
- instance.props = props;
2332
- }
2225
+ function toHandlers(obj, preserveCaseIfNecessary) {
2226
+ const ret = {};
2227
+ for (const key in obj) {
2228
+ ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
2333
2229
  }
2334
- instance.attrs = attrs;
2230
+ return ret;
2335
2231
  }
2336
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
2337
- const {
2338
- props,
2339
- attrs,
2340
- vnode: { patchFlag }
2341
- } = instance;
2342
- const rawCurrentProps = reactivity.toRaw(props);
2343
- const [options] = instance.propsOptions;
2344
- let hasAttrsChanged = false;
2345
- if (
2346
- // always force full diff in dev
2347
- // - #1942 if hmr is enabled with sfc component
2348
- // - vite#872 non-sfc component used by sfc component
2349
- (optimized || patchFlag > 0) && !(patchFlag & 16)
2350
- ) {
2351
- if (patchFlag & 8) {
2352
- const propsToUpdate = instance.vnode.dynamicProps;
2353
- for (let i = 0; i < propsToUpdate.length; i++) {
2354
- let key = propsToUpdate[i];
2355
- if (isEmitListener(instance.emitsOptions, key)) {
2356
- continue;
2357
- }
2358
- const value = rawProps[key];
2359
- if (options) {
2360
- if (shared.hasOwn(attrs, key)) {
2361
- if (value !== attrs[key]) {
2362
- attrs[key] = value;
2363
- hasAttrsChanged = true;
2364
- }
2365
- } else {
2366
- const camelizedKey = shared.camelize(key);
2367
- props[camelizedKey] = resolvePropValue(
2368
- options,
2369
- rawCurrentProps,
2370
- camelizedKey,
2371
- value,
2372
- instance,
2373
- false
2374
- );
2375
- }
2376
- } else {
2377
- if (value !== attrs[key]) {
2378
- attrs[key] = value;
2379
- hasAttrsChanged = true;
2380
- }
2232
+
2233
+ const getPublicInstance = (i) => {
2234
+ if (!i) return null;
2235
+ if (isStatefulComponent(i)) return getComponentPublicInstance(i);
2236
+ return getPublicInstance(i.parent);
2237
+ };
2238
+ const publicPropertiesMap = (
2239
+ // Move PURE marker to new line to workaround compiler discarding it
2240
+ // due to type annotation
2241
+ /* @__PURE__ */ shared.extend(/* @__PURE__ */ Object.create(null), {
2242
+ $: (i) => i,
2243
+ $el: (i) => i.vnode.el,
2244
+ $data: (i) => i.data,
2245
+ $props: (i) => i.props,
2246
+ $attrs: (i) => i.attrs,
2247
+ $slots: (i) => i.slots,
2248
+ $refs: (i) => i.refs,
2249
+ $parent: (i) => getPublicInstance(i.parent),
2250
+ $root: (i) => getPublicInstance(i.root),
2251
+ $emit: (i) => i.emit,
2252
+ $options: (i) => resolveMergedOptions(i) ,
2253
+ $forceUpdate: (i) => i.f || (i.f = () => {
2254
+ queueJob(i.update);
2255
+ }),
2256
+ $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
2257
+ $watch: (i) => instanceWatch.bind(i)
2258
+ })
2259
+ );
2260
+ const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
2261
+ const PublicInstanceProxyHandlers = {
2262
+ get({ _: instance }, key) {
2263
+ if (key === "__v_skip") {
2264
+ return true;
2265
+ }
2266
+ const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
2267
+ let normalizedProps;
2268
+ if (key[0] !== "$") {
2269
+ const n = accessCache[key];
2270
+ if (n !== void 0) {
2271
+ switch (n) {
2272
+ case 1 /* SETUP */:
2273
+ return setupState[key];
2274
+ case 2 /* DATA */:
2275
+ return data[key];
2276
+ case 4 /* CONTEXT */:
2277
+ return ctx[key];
2278
+ case 3 /* PROPS */:
2279
+ return props[key];
2381
2280
  }
2281
+ } else if (hasSetupBinding(setupState, key)) {
2282
+ accessCache[key] = 1 /* SETUP */;
2283
+ return setupState[key];
2284
+ } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
2285
+ accessCache[key] = 2 /* DATA */;
2286
+ return data[key];
2287
+ } else if (
2288
+ // only cache other properties when instance has declared (thus stable)
2289
+ // props
2290
+ (normalizedProps = instance.propsOptions[0]) && shared.hasOwn(normalizedProps, key)
2291
+ ) {
2292
+ accessCache[key] = 3 /* PROPS */;
2293
+ return props[key];
2294
+ } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
2295
+ accessCache[key] = 4 /* CONTEXT */;
2296
+ return ctx[key];
2297
+ } else if (shouldCacheAccess) {
2298
+ accessCache[key] = 0 /* OTHER */;
2382
2299
  }
2383
2300
  }
2384
- } else {
2385
- if (setFullProps(instance, rawProps, props, attrs)) {
2386
- hasAttrsChanged = true;
2387
- }
2388
- let kebabKey;
2389
- for (const key in rawCurrentProps) {
2390
- if (!rawProps || // for camelCase
2391
- !shared.hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
2392
- // and converted to camelCase (#955)
2393
- ((kebabKey = shared.hyphenate(key)) === key || !shared.hasOwn(rawProps, kebabKey))) {
2394
- if (options) {
2395
- if (rawPrevProps && // for camelCase
2396
- (rawPrevProps[key] !== void 0 || // for kebab-case
2397
- rawPrevProps[kebabKey] !== void 0)) {
2398
- props[key] = resolvePropValue(
2399
- options,
2400
- rawCurrentProps,
2401
- key,
2402
- void 0,
2403
- instance,
2404
- true
2405
- );
2406
- }
2407
- } else {
2408
- delete props[key];
2409
- }
2301
+ const publicGetter = publicPropertiesMap[key];
2302
+ let cssModule, globalProperties;
2303
+ if (publicGetter) {
2304
+ if (key === "$attrs") {
2305
+ reactivity.track(instance.attrs, "get", "");
2306
+ }
2307
+ return publicGetter(instance);
2308
+ } else if (
2309
+ // css module (injected by vue-loader)
2310
+ (cssModule = type.__cssModules) && (cssModule = cssModule[key])
2311
+ ) {
2312
+ return cssModule;
2313
+ } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
2314
+ accessCache[key] = 4 /* CONTEXT */;
2315
+ return ctx[key];
2316
+ } else if (
2317
+ // global properties
2318
+ globalProperties = appContext.config.globalProperties, shared.hasOwn(globalProperties, key)
2319
+ ) {
2320
+ {
2321
+ return globalProperties[key];
2410
2322
  }
2323
+ } else ;
2324
+ },
2325
+ set({ _: instance }, key, value) {
2326
+ const { data, setupState, ctx } = instance;
2327
+ if (hasSetupBinding(setupState, key)) {
2328
+ setupState[key] = value;
2329
+ return true;
2330
+ } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
2331
+ data[key] = value;
2332
+ return true;
2333
+ } else if (shared.hasOwn(instance.props, key)) {
2334
+ return false;
2411
2335
  }
2412
- if (attrs !== rawCurrentProps) {
2413
- for (const key in attrs) {
2414
- if (!rawProps || !shared.hasOwn(rawProps, key) && true) {
2415
- delete attrs[key];
2416
- hasAttrsChanged = true;
2417
- }
2336
+ if (key[0] === "$" && key.slice(1) in instance) {
2337
+ return false;
2338
+ } else {
2339
+ {
2340
+ ctx[key] = value;
2418
2341
  }
2419
2342
  }
2343
+ return true;
2344
+ },
2345
+ has({
2346
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions }
2347
+ }, key) {
2348
+ let normalizedProps;
2349
+ return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
2350
+ },
2351
+ defineProperty(target, key, descriptor) {
2352
+ if (descriptor.get != null) {
2353
+ target._.accessCache[key] = 0;
2354
+ } else if (shared.hasOwn(descriptor, "value")) {
2355
+ this.set(target, key, descriptor.value, null);
2356
+ }
2357
+ return Reflect.defineProperty(target, key, descriptor);
2420
2358
  }
2421
- if (hasAttrsChanged) {
2422
- reactivity.trigger(instance.attrs, "set", "");
2359
+ };
2360
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ shared.extend(
2361
+ {},
2362
+ PublicInstanceProxyHandlers,
2363
+ {
2364
+ get(target, key) {
2365
+ if (key === Symbol.unscopables) {
2366
+ return;
2367
+ }
2368
+ return PublicInstanceProxyHandlers.get(target, key, target);
2369
+ },
2370
+ has(_, key) {
2371
+ const has = key[0] !== "_" && !shared.isGloballyAllowed(key);
2372
+ return has;
2373
+ }
2423
2374
  }
2375
+ );
2376
+
2377
+ function defineProps() {
2378
+ return null;
2424
2379
  }
2425
- function setFullProps(instance, rawProps, props, attrs) {
2426
- const [options, needCastKeys] = instance.propsOptions;
2427
- let hasAttrsChanged = false;
2428
- let rawCastValues;
2429
- if (rawProps) {
2430
- for (let key in rawProps) {
2431
- if (shared.isReservedProp(key)) {
2432
- continue;
2433
- }
2434
- const value = rawProps[key];
2435
- let camelKey;
2436
- if (options && shared.hasOwn(options, camelKey = shared.camelize(key))) {
2437
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
2438
- props[camelKey] = value;
2439
- } else {
2440
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
2441
- }
2442
- } else if (!isEmitListener(instance.emitsOptions, key)) {
2443
- if (!(key in attrs) || value !== attrs[key]) {
2444
- attrs[key] = value;
2445
- hasAttrsChanged = true;
2446
- }
2380
+ function defineEmits() {
2381
+ return null;
2382
+ }
2383
+ function defineExpose(exposed) {
2384
+ }
2385
+ function defineOptions(options) {
2386
+ }
2387
+ function defineSlots() {
2388
+ return null;
2389
+ }
2390
+ function defineModel() {
2391
+ }
2392
+ function withDefaults(props, defaults) {
2393
+ return null;
2394
+ }
2395
+ function useSlots() {
2396
+ return getContext().slots;
2397
+ }
2398
+ function useAttrs() {
2399
+ return getContext().attrs;
2400
+ }
2401
+ function getContext() {
2402
+ const i = getCurrentInstance();
2403
+ return i.setupContext || (i.setupContext = createSetupContext(i));
2404
+ }
2405
+ function normalizePropsOrEmits(props) {
2406
+ return shared.isArray(props) ? props.reduce(
2407
+ (normalized, p) => (normalized[p] = null, normalized),
2408
+ {}
2409
+ ) : props;
2410
+ }
2411
+ function mergeDefaults(raw, defaults) {
2412
+ const props = normalizePropsOrEmits(raw);
2413
+ for (const key in defaults) {
2414
+ if (key.startsWith("__skip")) continue;
2415
+ let opt = props[key];
2416
+ if (opt) {
2417
+ if (shared.isArray(opt) || shared.isFunction(opt)) {
2418
+ opt = props[key] = { type: opt, default: defaults[key] };
2419
+ } else {
2420
+ opt.default = defaults[key];
2447
2421
  }
2422
+ } else if (opt === null) {
2423
+ opt = props[key] = { default: defaults[key] };
2424
+ } else ;
2425
+ if (opt && defaults[`__skip_${key}`]) {
2426
+ opt.skipFactory = true;
2448
2427
  }
2449
2428
  }
2450
- if (needCastKeys) {
2451
- const rawCurrentProps = reactivity.toRaw(props);
2452
- const castValues = rawCastValues || shared.EMPTY_OBJ;
2453
- for (let i = 0; i < needCastKeys.length; i++) {
2454
- const key = needCastKeys[i];
2455
- props[key] = resolvePropValue(
2456
- options,
2457
- rawCurrentProps,
2458
- key,
2459
- castValues[key],
2460
- instance,
2461
- !shared.hasOwn(castValues, key)
2462
- );
2429
+ return props;
2430
+ }
2431
+ function mergeModels(a, b) {
2432
+ if (!a || !b) return a || b;
2433
+ if (shared.isArray(a) && shared.isArray(b)) return a.concat(b);
2434
+ return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
2435
+ }
2436
+ function createPropsRestProxy(props, excludedKeys) {
2437
+ const ret = {};
2438
+ for (const key in props) {
2439
+ if (!excludedKeys.includes(key)) {
2440
+ Object.defineProperty(ret, key, {
2441
+ enumerable: true,
2442
+ get: () => props[key]
2443
+ });
2463
2444
  }
2464
2445
  }
2465
- return hasAttrsChanged;
2446
+ return ret;
2466
2447
  }
2467
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
2468
- const opt = options[key];
2469
- if (opt != null) {
2470
- const hasDefault = shared.hasOwn(opt, "default");
2471
- if (hasDefault && value === void 0) {
2472
- const defaultValue = opt.default;
2473
- if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
2474
- const { propsDefaults } = instance;
2475
- if (key in propsDefaults) {
2476
- value = propsDefaults[key];
2477
- } else {
2478
- const reset = setCurrentInstance(instance);
2479
- value = propsDefaults[key] = defaultValue.call(
2480
- null,
2481
- props
2482
- );
2483
- reset();
2484
- }
2485
- } else {
2486
- value = defaultValue;
2487
- }
2488
- }
2489
- if (opt[0 /* shouldCast */]) {
2490
- if (isAbsent && !hasDefault) {
2491
- value = false;
2492
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === shared.hyphenate(key))) {
2493
- value = true;
2448
+ function withAsyncContext(getAwaitable) {
2449
+ const ctx = getCurrentInstance();
2450
+ let awaitable = getAwaitable();
2451
+ unsetCurrentInstance();
2452
+ if (shared.isPromise(awaitable)) {
2453
+ awaitable = awaitable.catch((e) => {
2454
+ setCurrentInstance(ctx);
2455
+ throw e;
2456
+ });
2457
+ }
2458
+ return [awaitable, () => setCurrentInstance(ctx)];
2459
+ }
2460
+
2461
+ let shouldCacheAccess = true;
2462
+ function applyOptions(instance) {
2463
+ const options = resolveMergedOptions(instance);
2464
+ const publicThis = instance.proxy;
2465
+ const ctx = instance.ctx;
2466
+ shouldCacheAccess = false;
2467
+ if (options.beforeCreate) {
2468
+ callHook(options.beforeCreate, instance, "bc");
2469
+ }
2470
+ const {
2471
+ // state
2472
+ data: dataOptions,
2473
+ computed: computedOptions,
2474
+ methods,
2475
+ watch: watchOptions,
2476
+ provide: provideOptions,
2477
+ inject: injectOptions,
2478
+ // lifecycle
2479
+ created,
2480
+ beforeMount,
2481
+ mounted,
2482
+ beforeUpdate,
2483
+ updated,
2484
+ activated,
2485
+ deactivated,
2486
+ beforeDestroy,
2487
+ beforeUnmount,
2488
+ destroyed,
2489
+ unmounted,
2490
+ render,
2491
+ renderTracked,
2492
+ renderTriggered,
2493
+ errorCaptured,
2494
+ serverPrefetch,
2495
+ // public API
2496
+ expose,
2497
+ inheritAttrs,
2498
+ // assets
2499
+ components,
2500
+ directives,
2501
+ filters
2502
+ } = options;
2503
+ const checkDuplicateProperties = null;
2504
+ if (injectOptions) {
2505
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
2506
+ }
2507
+ if (methods) {
2508
+ for (const key in methods) {
2509
+ const methodHandler = methods[key];
2510
+ if (shared.isFunction(methodHandler)) {
2511
+ {
2512
+ ctx[key] = methodHandler.bind(publicThis);
2513
+ }
2494
2514
  }
2495
2515
  }
2496
2516
  }
2497
- return value;
2498
- }
2499
- const mixinPropsCache = /* @__PURE__ */ new WeakMap();
2500
- function normalizePropsOptions(comp, appContext, asMixin = false) {
2501
- const cache = asMixin ? mixinPropsCache : appContext.propsCache;
2502
- const cached = cache.get(comp);
2503
- if (cached) {
2504
- return cached;
2505
- }
2506
- const raw = comp.props;
2507
- const normalized = {};
2508
- const needCastKeys = [];
2509
- let hasExtends = false;
2510
- if (!shared.isFunction(comp)) {
2511
- const extendProps = (raw2) => {
2512
- hasExtends = true;
2513
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
2514
- shared.extend(normalized, props);
2515
- if (keys) needCastKeys.push(...keys);
2516
- };
2517
- if (!asMixin && appContext.mixins.length) {
2518
- appContext.mixins.forEach(extendProps);
2519
- }
2520
- if (comp.extends) {
2521
- extendProps(comp.extends);
2522
- }
2523
- if (comp.mixins) {
2524
- comp.mixins.forEach(extendProps);
2517
+ if (dataOptions) {
2518
+ const data = dataOptions.call(publicThis, publicThis);
2519
+ if (!shared.isObject(data)) ; else {
2520
+ instance.data = reactivity.reactive(data);
2525
2521
  }
2526
2522
  }
2527
- if (!raw && !hasExtends) {
2528
- if (shared.isObject(comp)) {
2529
- cache.set(comp, shared.EMPTY_ARR);
2523
+ shouldCacheAccess = true;
2524
+ if (computedOptions) {
2525
+ for (const key in computedOptions) {
2526
+ const opt = computedOptions[key];
2527
+ const get = shared.isFunction(opt) ? opt.bind(publicThis, publicThis) : shared.isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : shared.NOOP;
2528
+ const set = !shared.isFunction(opt) && shared.isFunction(opt.set) ? opt.set.bind(publicThis) : shared.NOOP;
2529
+ const c = computed({
2530
+ get,
2531
+ set
2532
+ });
2533
+ Object.defineProperty(ctx, key, {
2534
+ enumerable: true,
2535
+ configurable: true,
2536
+ get: () => c.value,
2537
+ set: (v) => c.value = v
2538
+ });
2530
2539
  }
2531
- return shared.EMPTY_ARR;
2532
2540
  }
2533
- if (shared.isArray(raw)) {
2534
- for (let i = 0; i < raw.length; i++) {
2535
- const normalizedKey = shared.camelize(raw[i]);
2536
- if (validatePropName(normalizedKey)) {
2537
- normalized[normalizedKey] = shared.EMPTY_OBJ;
2538
- }
2539
- }
2540
- } else if (raw) {
2541
- for (const key in raw) {
2542
- const normalizedKey = shared.camelize(key);
2543
- if (validatePropName(normalizedKey)) {
2544
- const opt = raw[key];
2545
- const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
2546
- if (prop) {
2547
- const booleanIndex = getTypeIndex(Boolean, prop.type);
2548
- const stringIndex = getTypeIndex(String, prop.type);
2549
- prop[0 /* shouldCast */] = booleanIndex > -1;
2550
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
2551
- if (booleanIndex > -1 || shared.hasOwn(prop, "default")) {
2552
- needCastKeys.push(normalizedKey);
2553
- }
2554
- }
2555
- }
2541
+ if (watchOptions) {
2542
+ for (const key in watchOptions) {
2543
+ createWatcher(watchOptions[key], ctx, publicThis, key);
2556
2544
  }
2557
2545
  }
2558
- const res = [normalized, needCastKeys];
2559
- if (shared.isObject(comp)) {
2560
- cache.set(comp, res);
2546
+ if (provideOptions) {
2547
+ const provides = shared.isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
2548
+ Reflect.ownKeys(provides).forEach((key) => {
2549
+ provide(key, provides[key]);
2550
+ });
2561
2551
  }
2562
- return res;
2563
- }
2564
- function validatePropName(key) {
2565
- if (key[0] !== "$" && !shared.isReservedProp(key)) {
2566
- return true;
2552
+ if (created) {
2553
+ callHook(created, instance, "c");
2567
2554
  }
2568
- return false;
2569
- }
2570
- function getType(ctor) {
2571
- if (ctor === null) {
2572
- return "null";
2555
+ function registerLifecycleHook(register, hook) {
2556
+ if (shared.isArray(hook)) {
2557
+ hook.forEach((_hook) => register(_hook.bind(publicThis)));
2558
+ } else if (hook) {
2559
+ register(hook.bind(publicThis));
2560
+ }
2573
2561
  }
2574
- if (typeof ctor === "function") {
2575
- return ctor.name || "";
2576
- } else if (typeof ctor === "object") {
2577
- const name = ctor.constructor && ctor.constructor.name;
2578
- return name || "";
2562
+ registerLifecycleHook(onBeforeMount, beforeMount);
2563
+ registerLifecycleHook(onMounted, mounted);
2564
+ registerLifecycleHook(onBeforeUpdate, beforeUpdate);
2565
+ registerLifecycleHook(onUpdated, updated);
2566
+ registerLifecycleHook(onActivated, activated);
2567
+ registerLifecycleHook(onDeactivated, deactivated);
2568
+ registerLifecycleHook(onErrorCaptured, errorCaptured);
2569
+ registerLifecycleHook(onRenderTracked, renderTracked);
2570
+ registerLifecycleHook(onRenderTriggered, renderTriggered);
2571
+ registerLifecycleHook(onBeforeUnmount, beforeUnmount);
2572
+ registerLifecycleHook(onUnmounted, unmounted);
2573
+ registerLifecycleHook(onServerPrefetch, serverPrefetch);
2574
+ if (shared.isArray(expose)) {
2575
+ if (expose.length) {
2576
+ const exposed = instance.exposed || (instance.exposed = {});
2577
+ expose.forEach((key) => {
2578
+ Object.defineProperty(exposed, key, {
2579
+ get: () => publicThis[key],
2580
+ set: (val) => publicThis[key] = val
2581
+ });
2582
+ });
2583
+ } else if (!instance.exposed) {
2584
+ instance.exposed = {};
2585
+ }
2579
2586
  }
2580
- return "";
2581
- }
2582
- function isSameType(a, b) {
2583
- return getType(a) === getType(b);
2584
- }
2585
- function getTypeIndex(type, expectedTypes) {
2586
- if (shared.isArray(expectedTypes)) {
2587
- return expectedTypes.findIndex((t) => isSameType(t, type));
2588
- } else if (shared.isFunction(expectedTypes)) {
2589
- return isSameType(expectedTypes, type) ? 0 : -1;
2587
+ if (render && instance.render === shared.NOOP) {
2588
+ instance.render = render;
2590
2589
  }
2591
- return -1;
2592
- }
2593
-
2594
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
2595
- const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
2596
- const normalizeSlot = (key, rawSlot, ctx) => {
2597
- if (rawSlot._n) {
2598
- return rawSlot;
2590
+ if (inheritAttrs != null) {
2591
+ instance.inheritAttrs = inheritAttrs;
2599
2592
  }
2600
- const normalized = withCtx((...args) => {
2601
- if (false) ;
2602
- return normalizeSlotValue(rawSlot(...args));
2603
- }, ctx);
2604
- normalized._c = false;
2605
- return normalized;
2606
- };
2607
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
2608
- const ctx = rawSlots._ctx;
2609
- for (const key in rawSlots) {
2610
- if (isInternalKey(key)) continue;
2611
- const value = rawSlots[key];
2612
- if (shared.isFunction(value)) {
2613
- slots[key] = normalizeSlot(key, value, ctx);
2614
- } else if (value != null) {
2615
- const normalized = normalizeSlotValue(value);
2616
- slots[key] = () => normalized;
2617
- }
2593
+ if (components) instance.components = components;
2594
+ if (directives) instance.directives = directives;
2595
+ if (serverPrefetch) {
2596
+ markAsyncBoundary(instance);
2618
2597
  }
2619
- };
2620
- const normalizeVNodeSlots = (instance, children) => {
2621
- const normalized = normalizeSlotValue(children);
2622
- instance.slots.default = () => normalized;
2623
- };
2624
- const assignSlots = (slots, children, optimized) => {
2625
- for (const key in children) {
2626
- if (optimized || key !== "_") {
2627
- slots[key] = children[key];
2628
- }
2598
+ }
2599
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
2600
+ if (shared.isArray(injectOptions)) {
2601
+ injectOptions = normalizeInject(injectOptions);
2629
2602
  }
2630
- };
2631
- const initSlots = (instance, children, optimized) => {
2632
- const slots = instance.slots = createInternalObject();
2633
- if (instance.vnode.shapeFlag & 32) {
2634
- const type = children._;
2635
- if (type) {
2636
- assignSlots(slots, children, optimized);
2637
- if (optimized) {
2638
- shared.def(slots, "_", type, true);
2603
+ for (const key in injectOptions) {
2604
+ const opt = injectOptions[key];
2605
+ let injected;
2606
+ if (shared.isObject(opt)) {
2607
+ if ("default" in opt) {
2608
+ injected = inject(
2609
+ opt.from || key,
2610
+ opt.default,
2611
+ true
2612
+ );
2613
+ } else {
2614
+ injected = inject(opt.from || key);
2639
2615
  }
2640
2616
  } else {
2641
- normalizeObjectSlots(children, slots);
2617
+ injected = inject(opt);
2618
+ }
2619
+ if (reactivity.isRef(injected)) {
2620
+ Object.defineProperty(ctx, key, {
2621
+ enumerable: true,
2622
+ configurable: true,
2623
+ get: () => injected.value,
2624
+ set: (v) => injected.value = v
2625
+ });
2626
+ } else {
2627
+ ctx[key] = injected;
2642
2628
  }
2643
- } else if (children) {
2644
- normalizeVNodeSlots(instance, children);
2645
2629
  }
2646
- };
2647
- const updateSlots = (instance, children, optimized) => {
2648
- const { vnode, slots } = instance;
2649
- let needDeletionCheck = true;
2650
- let deletionComparisonTarget = shared.EMPTY_OBJ;
2651
- if (vnode.shapeFlag & 32) {
2652
- const type = children._;
2653
- if (type) {
2654
- if (optimized && type === 1) {
2655
- needDeletionCheck = false;
2656
- } else {
2657
- assignSlots(slots, children, optimized);
2658
- }
2630
+ }
2631
+ function callHook(hook, instance, type) {
2632
+ callWithAsyncErrorHandling(
2633
+ shared.isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
2634
+ instance,
2635
+ type
2636
+ );
2637
+ }
2638
+ function createWatcher(raw, ctx, publicThis, key) {
2639
+ const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
2640
+ if (shared.isString(raw)) {
2641
+ const handler = ctx[raw];
2642
+ if (shared.isFunction(handler)) {
2643
+ watch(getter, handler);
2644
+ }
2645
+ } else if (shared.isFunction(raw)) {
2646
+ watch(getter, raw.bind(publicThis));
2647
+ } else if (shared.isObject(raw)) {
2648
+ if (shared.isArray(raw)) {
2649
+ raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
2659
2650
  } else {
2660
- needDeletionCheck = !children.$stable;
2661
- normalizeObjectSlots(children, slots);
2651
+ const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
2652
+ if (shared.isFunction(handler)) {
2653
+ watch(getter, handler, raw);
2654
+ }
2655
+ }
2656
+ } else ;
2657
+ }
2658
+ function resolveMergedOptions(instance) {
2659
+ const base = instance.type;
2660
+ const { mixins, extends: extendsOptions } = base;
2661
+ const {
2662
+ mixins: globalMixins,
2663
+ optionsCache: cache,
2664
+ config: { optionMergeStrategies }
2665
+ } = instance.appContext;
2666
+ const cached = cache.get(base);
2667
+ let resolved;
2668
+ if (cached) {
2669
+ resolved = cached;
2670
+ } else if (!globalMixins.length && !mixins && !extendsOptions) {
2671
+ {
2672
+ resolved = base;
2662
2673
  }
2663
- deletionComparisonTarget = children;
2664
- } else if (children) {
2665
- normalizeVNodeSlots(instance, children);
2666
- deletionComparisonTarget = { default: 1 };
2674
+ } else {
2675
+ resolved = {};
2676
+ if (globalMixins.length) {
2677
+ globalMixins.forEach(
2678
+ (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
2679
+ );
2680
+ }
2681
+ mergeOptions(resolved, base, optionMergeStrategies);
2667
2682
  }
2668
- if (needDeletionCheck) {
2669
- for (const key in slots) {
2670
- if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
2671
- delete slots[key];
2672
- }
2683
+ if (shared.isObject(base)) {
2684
+ cache.set(base, resolved);
2685
+ }
2686
+ return resolved;
2687
+ }
2688
+ function mergeOptions(to, from, strats, asMixin = false) {
2689
+ const { mixins, extends: extendsOptions } = from;
2690
+ if (extendsOptions) {
2691
+ mergeOptions(to, extendsOptions, strats, true);
2692
+ }
2693
+ if (mixins) {
2694
+ mixins.forEach(
2695
+ (m) => mergeOptions(to, m, strats, true)
2696
+ );
2697
+ }
2698
+ for (const key in from) {
2699
+ if (asMixin && key === "expose") ; else {
2700
+ const strat = internalOptionMergeStrats[key] || strats && strats[key];
2701
+ to[key] = strat ? strat(to[key], from[key]) : from[key];
2673
2702
  }
2674
2703
  }
2704
+ return to;
2705
+ }
2706
+ const internalOptionMergeStrats = {
2707
+ data: mergeDataFn,
2708
+ props: mergeEmitsOrPropsOptions,
2709
+ emits: mergeEmitsOrPropsOptions,
2710
+ // objects
2711
+ methods: mergeObjectOptions,
2712
+ computed: mergeObjectOptions,
2713
+ // lifecycle
2714
+ beforeCreate: mergeAsArray,
2715
+ created: mergeAsArray,
2716
+ beforeMount: mergeAsArray,
2717
+ mounted: mergeAsArray,
2718
+ beforeUpdate: mergeAsArray,
2719
+ updated: mergeAsArray,
2720
+ beforeDestroy: mergeAsArray,
2721
+ beforeUnmount: mergeAsArray,
2722
+ destroyed: mergeAsArray,
2723
+ unmounted: mergeAsArray,
2724
+ activated: mergeAsArray,
2725
+ deactivated: mergeAsArray,
2726
+ errorCaptured: mergeAsArray,
2727
+ serverPrefetch: mergeAsArray,
2728
+ // assets
2729
+ components: mergeObjectOptions,
2730
+ directives: mergeObjectOptions,
2731
+ // watch
2732
+ watch: mergeWatchOptions,
2733
+ // provide / inject
2734
+ provide: mergeDataFn,
2735
+ inject: mergeInject
2675
2736
  };
2676
-
2677
- function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2678
- if (shared.isArray(rawRef)) {
2679
- rawRef.forEach(
2680
- (r, i) => setRef(
2681
- r,
2682
- oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
2683
- parentSuspense,
2684
- vnode,
2685
- isUnmount
2686
- )
2687
- );
2688
- return;
2737
+ function mergeDataFn(to, from) {
2738
+ if (!from) {
2739
+ return to;
2689
2740
  }
2690
- if (isAsyncWrapper(vnode) && !isUnmount) {
2691
- return;
2741
+ if (!to) {
2742
+ return from;
2692
2743
  }
2693
- const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
2694
- const value = isUnmount ? null : refValue;
2695
- const { i: owner, r: ref } = rawRef;
2696
- const oldRef = oldRawRef && oldRawRef.r;
2697
- const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
2698
- const setupState = owner.setupState;
2699
- if (oldRef != null && oldRef !== ref) {
2700
- if (shared.isString(oldRef)) {
2701
- refs[oldRef] = null;
2702
- if (shared.hasOwn(setupState, oldRef)) {
2703
- setupState[oldRef] = null;
2704
- }
2705
- } else if (reactivity.isRef(oldRef)) {
2706
- oldRef.value = null;
2744
+ return function mergedDataFn() {
2745
+ return (shared.extend)(
2746
+ shared.isFunction(to) ? to.call(this, this) : to,
2747
+ shared.isFunction(from) ? from.call(this, this) : from
2748
+ );
2749
+ };
2750
+ }
2751
+ function mergeInject(to, from) {
2752
+ return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
2753
+ }
2754
+ function normalizeInject(raw) {
2755
+ if (shared.isArray(raw)) {
2756
+ const res = {};
2757
+ for (let i = 0; i < raw.length; i++) {
2758
+ res[raw[i]] = raw[i];
2707
2759
  }
2760
+ return res;
2708
2761
  }
2709
- if (shared.isFunction(ref)) {
2710
- callWithErrorHandling(ref, owner, 12, [value, refs]);
2711
- } else {
2712
- const _isString = shared.isString(ref);
2713
- const _isRef = reactivity.isRef(ref);
2714
- if (_isString || _isRef) {
2715
- const doSet = () => {
2716
- if (rawRef.f) {
2717
- const existing = _isString ? shared.hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
2718
- if (isUnmount) {
2719
- shared.isArray(existing) && shared.remove(existing, refValue);
2720
- } else {
2721
- if (!shared.isArray(existing)) {
2722
- if (_isString) {
2723
- refs[ref] = [refValue];
2724
- if (shared.hasOwn(setupState, ref)) {
2725
- setupState[ref] = refs[ref];
2726
- }
2727
- } else {
2728
- ref.value = [refValue];
2729
- if (rawRef.k) refs[rawRef.k] = ref.value;
2730
- }
2731
- } else if (!existing.includes(refValue)) {
2732
- existing.push(refValue);
2733
- }
2734
- }
2735
- } else if (_isString) {
2736
- refs[ref] = value;
2737
- if (shared.hasOwn(setupState, ref)) {
2738
- setupState[ref] = value;
2739
- }
2740
- } else if (_isRef) {
2741
- ref.value = value;
2742
- if (rawRef.k) refs[rawRef.k] = value;
2743
- } else ;
2744
- };
2745
- if (value) {
2746
- doSet.id = -1;
2747
- queuePostRenderEffect(doSet, parentSuspense);
2748
- } else {
2749
- doSet();
2750
- }
2762
+ return raw;
2763
+ }
2764
+ function mergeAsArray(to, from) {
2765
+ return to ? [...new Set([].concat(to, from))] : from;
2766
+ }
2767
+ function mergeObjectOptions(to, from) {
2768
+ return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
2769
+ }
2770
+ function mergeEmitsOrPropsOptions(to, from) {
2771
+ if (to) {
2772
+ if (shared.isArray(to) && shared.isArray(from)) {
2773
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
2751
2774
  }
2775
+ return shared.extend(
2776
+ /* @__PURE__ */ Object.create(null),
2777
+ normalizePropsOrEmits(to),
2778
+ normalizePropsOrEmits(from != null ? from : {})
2779
+ );
2780
+ } else {
2781
+ return from;
2752
2782
  }
2753
2783
  }
2754
-
2755
- let hasLoggedMismatchError = false;
2756
- const logMismatchError = () => {
2757
- if (hasLoggedMismatchError) {
2758
- return;
2784
+ function mergeWatchOptions(to, from) {
2785
+ if (!to) return from;
2786
+ if (!from) return to;
2787
+ const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
2788
+ for (const key in from) {
2789
+ merged[key] = mergeAsArray(to[key], from[key]);
2759
2790
  }
2760
- console.error("Hydration completed but contains mismatches.");
2761
- hasLoggedMismatchError = true;
2762
- };
2763
- const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
2764
- const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
2765
- const getContainerType = (container) => {
2766
- if (isSVGContainer(container)) return "svg";
2767
- if (isMathMLContainer(container)) return "mathml";
2768
- return void 0;
2769
- };
2770
- const isComment = (node) => node.nodeType === 8 /* COMMENT */;
2771
- function createHydrationFunctions(rendererInternals) {
2772
- const {
2773
- mt: mountComponent,
2774
- p: patch,
2775
- o: {
2776
- patchProp,
2777
- createText,
2778
- nextSibling,
2779
- parentNode,
2780
- remove,
2781
- insert,
2782
- createComment
2783
- }
2784
- } = rendererInternals;
2785
- const hydrate = (vnode, container) => {
2786
- if (!container.hasChildNodes()) {
2787
- patch(null, vnode, container);
2788
- flushPostFlushCbs();
2789
- container._vnode = vnode;
2790
- return;
2791
+ return merged;
2792
+ }
2793
+
2794
+ function createAppContext() {
2795
+ return {
2796
+ app: null,
2797
+ config: {
2798
+ isNativeTag: shared.NO,
2799
+ performance: false,
2800
+ globalProperties: {},
2801
+ optionMergeStrategies: {},
2802
+ errorHandler: void 0,
2803
+ warnHandler: void 0,
2804
+ compilerOptions: {}
2805
+ },
2806
+ mixins: [],
2807
+ components: {},
2808
+ directives: {},
2809
+ provides: /* @__PURE__ */ Object.create(null),
2810
+ optionsCache: /* @__PURE__ */ new WeakMap(),
2811
+ propsCache: /* @__PURE__ */ new WeakMap(),
2812
+ emitsCache: /* @__PURE__ */ new WeakMap()
2813
+ };
2814
+ }
2815
+ let uid$1 = 0;
2816
+ function createAppAPI(render, hydrate) {
2817
+ return function createApp(rootComponent, rootProps = null) {
2818
+ if (!shared.isFunction(rootComponent)) {
2819
+ rootComponent = shared.extend({}, rootComponent);
2791
2820
  }
2792
- hydrateNode(container.firstChild, vnode, null, null, null);
2793
- flushPostFlushCbs();
2794
- container._vnode = vnode;
2795
- };
2796
- const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
2797
- optimized = optimized || !!vnode.dynamicChildren;
2798
- const isFragmentStart = isComment(node) && node.data === "[";
2799
- const onMismatch = () => handleMismatch(
2800
- node,
2801
- vnode,
2802
- parentComponent,
2803
- parentSuspense,
2804
- slotScopeIds,
2805
- isFragmentStart
2806
- );
2807
- const { type, ref, shapeFlag, patchFlag } = vnode;
2808
- let domType = node.nodeType;
2809
- vnode.el = node;
2810
- if (patchFlag === -2) {
2811
- optimized = false;
2812
- vnode.dynamicChildren = null;
2821
+ if (rootProps != null && !shared.isObject(rootProps)) {
2822
+ rootProps = null;
2813
2823
  }
2814
- let nextNode = null;
2815
- switch (type) {
2816
- case Text:
2817
- if (domType !== 3 /* TEXT */) {
2818
- if (vnode.children === "") {
2819
- insert(vnode.el = createText(""), parentNode(node), node);
2820
- nextNode = node;
2821
- } else {
2822
- nextNode = onMismatch();
2823
- }
2824
- } else {
2825
- if (node.data !== vnode.children) {
2826
- logMismatchError();
2827
- node.data = vnode.children;
2824
+ const context = createAppContext();
2825
+ const installedPlugins = /* @__PURE__ */ new WeakSet();
2826
+ const pluginCleanupFns = [];
2827
+ let isMounted = false;
2828
+ const app = context.app = {
2829
+ _uid: uid$1++,
2830
+ _component: rootComponent,
2831
+ _props: rootProps,
2832
+ _container: null,
2833
+ _context: context,
2834
+ _instance: null,
2835
+ version,
2836
+ get config() {
2837
+ return context.config;
2838
+ },
2839
+ set config(v) {
2840
+ },
2841
+ use(plugin, ...options) {
2842
+ if (installedPlugins.has(plugin)) ; else if (plugin && shared.isFunction(plugin.install)) {
2843
+ installedPlugins.add(plugin);
2844
+ plugin.install(app, ...options);
2845
+ } else if (shared.isFunction(plugin)) {
2846
+ installedPlugins.add(plugin);
2847
+ plugin(app, ...options);
2848
+ } else ;
2849
+ return app;
2850
+ },
2851
+ mixin(mixin) {
2852
+ {
2853
+ if (!context.mixins.includes(mixin)) {
2854
+ context.mixins.push(mixin);
2828
2855
  }
2829
- nextNode = nextSibling(node);
2830
- }
2831
- break;
2832
- case Comment:
2833
- if (isTemplateNode(node)) {
2834
- nextNode = nextSibling(node);
2835
- replaceNode(
2836
- vnode.el = node.content.firstChild,
2837
- node,
2838
- parentComponent
2839
- );
2840
- } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
2841
- nextNode = onMismatch();
2842
- } else {
2843
- nextNode = nextSibling(node);
2844
- }
2845
- break;
2846
- case Static:
2847
- if (isFragmentStart) {
2848
- node = nextSibling(node);
2849
- domType = node.nodeType;
2850
2856
  }
2851
- if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
2852
- nextNode = node;
2853
- const needToAdoptContent = !vnode.children.length;
2854
- for (let i = 0; i < vnode.staticCount; i++) {
2855
- if (needToAdoptContent)
2856
- vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
2857
- if (i === vnode.staticCount - 1) {
2858
- vnode.anchor = nextNode;
2859
- }
2860
- nextNode = nextSibling(nextNode);
2861
- }
2862
- return isFragmentStart ? nextSibling(nextNode) : nextNode;
2863
- } else {
2864
- onMismatch();
2857
+ return app;
2858
+ },
2859
+ component(name, component) {
2860
+ if (!component) {
2861
+ return context.components[name];
2865
2862
  }
2866
- break;
2867
- case Fragment:
2868
- if (!isFragmentStart) {
2869
- nextNode = onMismatch();
2870
- } else {
2871
- nextNode = hydrateFragment(
2872
- node,
2873
- vnode,
2874
- parentComponent,
2875
- parentSuspense,
2876
- slotScopeIds,
2877
- optimized
2878
- );
2863
+ context.components[name] = component;
2864
+ return app;
2865
+ },
2866
+ directive(name, directive) {
2867
+ if (!directive) {
2868
+ return context.directives[name];
2879
2869
  }
2880
- break;
2881
- default:
2882
- if (shapeFlag & 1) {
2883
- if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
2884
- nextNode = onMismatch();
2885
- } else {
2886
- nextNode = hydrateElement(
2887
- node,
2888
- vnode,
2889
- parentComponent,
2890
- parentSuspense,
2891
- slotScopeIds,
2892
- optimized
2893
- );
2870
+ context.directives[name] = directive;
2871
+ return app;
2872
+ },
2873
+ mount(rootContainer, isHydrate, namespace) {
2874
+ if (!isMounted) {
2875
+ const vnode = createVNode(rootComponent, rootProps);
2876
+ vnode.appContext = context;
2877
+ if (namespace === true) {
2878
+ namespace = "svg";
2879
+ } else if (namespace === false) {
2880
+ namespace = void 0;
2894
2881
  }
2895
- } else if (shapeFlag & 6) {
2896
- vnode.slotScopeIds = slotScopeIds;
2897
- const container = parentNode(node);
2898
- if (isFragmentStart) {
2899
- nextNode = locateClosingAnchor(node);
2900
- } else if (isComment(node) && node.data === "teleport start") {
2901
- nextNode = locateClosingAnchor(node, node.data, "teleport end");
2882
+ if (isHydrate && hydrate) {
2883
+ hydrate(vnode, rootContainer);
2902
2884
  } else {
2903
- nextNode = nextSibling(node);
2885
+ render(vnode, rootContainer, namespace);
2904
2886
  }
2905
- mountComponent(
2906
- vnode,
2907
- container,
2908
- null,
2909
- parentComponent,
2910
- parentSuspense,
2911
- getContainerType(container),
2912
- optimized
2887
+ isMounted = true;
2888
+ app._container = rootContainer;
2889
+ rootContainer.__vue_app__ = app;
2890
+ return getComponentPublicInstance(vnode.component);
2891
+ }
2892
+ },
2893
+ onUnmount(cleanupFn) {
2894
+ pluginCleanupFns.push(cleanupFn);
2895
+ },
2896
+ unmount() {
2897
+ if (isMounted) {
2898
+ callWithAsyncErrorHandling(
2899
+ pluginCleanupFns,
2900
+ app._instance,
2901
+ 16
2913
2902
  );
2914
- if (isAsyncWrapper(vnode)) {
2915
- let subTree;
2916
- if (isFragmentStart) {
2917
- subTree = createVNode(Fragment);
2918
- subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
2919
- } else {
2920
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
2903
+ render(null, app._container);
2904
+ delete app._container.__vue_app__;
2905
+ }
2906
+ },
2907
+ provide(key, value) {
2908
+ context.provides[key] = value;
2909
+ return app;
2910
+ },
2911
+ runWithContext(fn) {
2912
+ const lastApp = currentApp;
2913
+ currentApp = app;
2914
+ try {
2915
+ return fn();
2916
+ } finally {
2917
+ currentApp = lastApp;
2918
+ }
2919
+ }
2920
+ };
2921
+ return app;
2922
+ };
2923
+ }
2924
+ let currentApp = null;
2925
+
2926
+ function provide(key, value) {
2927
+ if (!currentInstance) ; else {
2928
+ let provides = currentInstance.provides;
2929
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
2930
+ if (parentProvides === provides) {
2931
+ provides = currentInstance.provides = Object.create(parentProvides);
2932
+ }
2933
+ provides[key] = value;
2934
+ }
2935
+ }
2936
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
2937
+ const instance = currentInstance || currentRenderingInstance;
2938
+ if (instance || currentApp) {
2939
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
2940
+ if (provides && key in provides) {
2941
+ return provides[key];
2942
+ } else if (arguments.length > 1) {
2943
+ return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
2944
+ } else ;
2945
+ }
2946
+ }
2947
+ function hasInjectionContext() {
2948
+ return !!(currentInstance || currentRenderingInstance || currentApp);
2949
+ }
2950
+
2951
+ const internalObjectProto = {};
2952
+ const createInternalObject = () => Object.create(internalObjectProto);
2953
+ const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
2954
+
2955
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
2956
+ const props = {};
2957
+ const attrs = createInternalObject();
2958
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
2959
+ setFullProps(instance, rawProps, props, attrs);
2960
+ for (const key in instance.propsOptions[0]) {
2961
+ if (!(key in props)) {
2962
+ props[key] = void 0;
2963
+ }
2964
+ }
2965
+ if (isStateful) {
2966
+ instance.props = isSSR ? props : reactivity.shallowReactive(props);
2967
+ } else {
2968
+ if (!instance.type.props) {
2969
+ instance.props = attrs;
2970
+ } else {
2971
+ instance.props = props;
2972
+ }
2973
+ }
2974
+ instance.attrs = attrs;
2975
+ }
2976
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
2977
+ const {
2978
+ props,
2979
+ attrs,
2980
+ vnode: { patchFlag }
2981
+ } = instance;
2982
+ const rawCurrentProps = reactivity.toRaw(props);
2983
+ const [options] = instance.propsOptions;
2984
+ let hasAttrsChanged = false;
2985
+ if (
2986
+ // always force full diff in dev
2987
+ // - #1942 if hmr is enabled with sfc component
2988
+ // - vite#872 non-sfc component used by sfc component
2989
+ (optimized || patchFlag > 0) && !(patchFlag & 16)
2990
+ ) {
2991
+ if (patchFlag & 8) {
2992
+ const propsToUpdate = instance.vnode.dynamicProps;
2993
+ for (let i = 0; i < propsToUpdate.length; i++) {
2994
+ let key = propsToUpdate[i];
2995
+ if (isEmitListener(instance.emitsOptions, key)) {
2996
+ continue;
2997
+ }
2998
+ const value = rawProps[key];
2999
+ if (options) {
3000
+ if (shared.hasOwn(attrs, key)) {
3001
+ if (value !== attrs[key]) {
3002
+ attrs[key] = value;
3003
+ hasAttrsChanged = true;
2921
3004
  }
2922
- subTree.el = node;
2923
- vnode.component.subTree = subTree;
2924
- }
2925
- } else if (shapeFlag & 64) {
2926
- if (domType !== 8 /* COMMENT */) {
2927
- nextNode = onMismatch();
2928
3005
  } else {
2929
- nextNode = vnode.type.hydrate(
2930
- node,
2931
- vnode,
2932
- parentComponent,
2933
- parentSuspense,
2934
- slotScopeIds,
2935
- optimized,
2936
- rendererInternals,
2937
- hydrateChildren
3006
+ const camelizedKey = shared.camelize(key);
3007
+ props[camelizedKey] = resolvePropValue(
3008
+ options,
3009
+ rawCurrentProps,
3010
+ camelizedKey,
3011
+ value,
3012
+ instance,
3013
+ false
2938
3014
  );
2939
3015
  }
2940
- } else if (shapeFlag & 128) {
2941
- nextNode = vnode.type.hydrate(
2942
- node,
2943
- vnode,
2944
- parentComponent,
2945
- parentSuspense,
2946
- getContainerType(parentNode(node)),
2947
- slotScopeIds,
2948
- optimized,
2949
- rendererInternals,
2950
- hydrateNode
2951
- );
2952
- } else ;
2953
- }
2954
- if (ref != null) {
2955
- setRef(ref, null, parentSuspense, vnode);
2956
- }
2957
- return nextNode;
2958
- };
2959
- const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
2960
- optimized = optimized || !!vnode.dynamicChildren;
2961
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
2962
- const forcePatch = type === "input" || type === "option";
2963
- if (forcePatch || patchFlag !== -1) {
2964
- if (dirs) {
2965
- invokeDirectiveHook(vnode, null, parentComponent, "created");
2966
- }
2967
- let needCallTransitionHooks = false;
2968
- if (isTemplateNode(el)) {
2969
- needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
2970
- const content = el.content.firstChild;
2971
- if (needCallTransitionHooks) {
2972
- transition.beforeEnter(content);
2973
- }
2974
- replaceNode(content, el, parentComponent);
2975
- vnode.el = el = content;
2976
- }
2977
- if (shapeFlag & 16 && // skip if element has innerHTML / textContent
2978
- !(props && (props.innerHTML || props.textContent))) {
2979
- let next = hydrateChildren(
2980
- el.firstChild,
2981
- vnode,
2982
- el,
2983
- parentComponent,
2984
- parentSuspense,
2985
- slotScopeIds,
2986
- optimized
2987
- );
2988
- while (next) {
2989
- logMismatchError();
2990
- const cur = next;
2991
- next = next.nextSibling;
2992
- remove(cur);
2993
- }
2994
- } else if (shapeFlag & 8) {
2995
- if (el.textContent !== vnode.children) {
2996
- logMismatchError();
2997
- el.textContent = vnode.children;
3016
+ } else {
3017
+ if (value !== attrs[key]) {
3018
+ attrs[key] = value;
3019
+ hasAttrsChanged = true;
3020
+ }
2998
3021
  }
2999
3022
  }
3000
- if (props) {
3001
- if (forcePatch || !optimized || patchFlag & (16 | 32)) {
3002
- for (const key in props) {
3003
- if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
3004
- key[0] === ".") {
3005
- patchProp(el, key, null, props[key], void 0, parentComponent);
3006
- }
3023
+ }
3024
+ } else {
3025
+ if (setFullProps(instance, rawProps, props, attrs)) {
3026
+ hasAttrsChanged = true;
3027
+ }
3028
+ let kebabKey;
3029
+ for (const key in rawCurrentProps) {
3030
+ if (!rawProps || // for camelCase
3031
+ !shared.hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
3032
+ // and converted to camelCase (#955)
3033
+ ((kebabKey = shared.hyphenate(key)) === key || !shared.hasOwn(rawProps, kebabKey))) {
3034
+ if (options) {
3035
+ if (rawPrevProps && // for camelCase
3036
+ (rawPrevProps[key] !== void 0 || // for kebab-case
3037
+ rawPrevProps[kebabKey] !== void 0)) {
3038
+ props[key] = resolvePropValue(
3039
+ options,
3040
+ rawCurrentProps,
3041
+ key,
3042
+ void 0,
3043
+ instance,
3044
+ true
3045
+ );
3007
3046
  }
3008
- } else if (props.onClick) {
3009
- patchProp(
3010
- el,
3011
- "onClick",
3012
- null,
3013
- props.onClick,
3014
- void 0,
3015
- parentComponent
3016
- );
3017
- } else if (patchFlag & 4 && reactivity.isReactive(props.style)) {
3018
- for (const key in props.style) props.style[key];
3047
+ } else {
3048
+ delete props[key];
3019
3049
  }
3020
3050
  }
3021
- let vnodeHooks;
3022
- if (vnodeHooks = props && props.onVnodeBeforeMount) {
3023
- invokeVNodeHook(vnodeHooks, parentComponent, vnode);
3051
+ }
3052
+ if (attrs !== rawCurrentProps) {
3053
+ for (const key in attrs) {
3054
+ if (!rawProps || !shared.hasOwn(rawProps, key) && true) {
3055
+ delete attrs[key];
3056
+ hasAttrsChanged = true;
3057
+ }
3024
3058
  }
3025
- if (dirs) {
3026
- invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
3059
+ }
3060
+ }
3061
+ if (hasAttrsChanged) {
3062
+ reactivity.trigger(instance.attrs, "set", "");
3063
+ }
3064
+ }
3065
+ function setFullProps(instance, rawProps, props, attrs) {
3066
+ const [options, needCastKeys] = instance.propsOptions;
3067
+ let hasAttrsChanged = false;
3068
+ let rawCastValues;
3069
+ if (rawProps) {
3070
+ for (let key in rawProps) {
3071
+ if (shared.isReservedProp(key)) {
3072
+ continue;
3027
3073
  }
3028
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
3029
- queueEffectWithSuspense(() => {
3030
- vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
3031
- needCallTransitionHooks && transition.enter(el);
3032
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
3033
- }, parentSuspense);
3074
+ const value = rawProps[key];
3075
+ let camelKey;
3076
+ if (options && shared.hasOwn(options, camelKey = shared.camelize(key))) {
3077
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
3078
+ props[camelKey] = value;
3079
+ } else {
3080
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
3081
+ }
3082
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
3083
+ if (!(key in attrs) || value !== attrs[key]) {
3084
+ attrs[key] = value;
3085
+ hasAttrsChanged = true;
3086
+ }
3034
3087
  }
3035
3088
  }
3036
- return el.nextSibling;
3037
- };
3038
- const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
3039
- optimized = optimized || !!parentVNode.dynamicChildren;
3040
- const children = parentVNode.children;
3041
- const l = children.length;
3042
- for (let i = 0; i < l; i++) {
3043
- const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
3044
- const isText = vnode.type === Text;
3045
- if (node) {
3046
- if (isText && !optimized) {
3047
- let next = children[i + 1];
3048
- if (next && (next = normalizeVNode(next)).type === Text) {
3049
- insert(
3050
- createText(
3051
- node.data.slice(vnode.children.length)
3052
- ),
3053
- container,
3054
- nextSibling(node)
3055
- );
3056
- node.data = vnode.children;
3057
- }
3089
+ }
3090
+ if (needCastKeys) {
3091
+ const rawCurrentProps = reactivity.toRaw(props);
3092
+ const castValues = rawCastValues || shared.EMPTY_OBJ;
3093
+ for (let i = 0; i < needCastKeys.length; i++) {
3094
+ const key = needCastKeys[i];
3095
+ props[key] = resolvePropValue(
3096
+ options,
3097
+ rawCurrentProps,
3098
+ key,
3099
+ castValues[key],
3100
+ instance,
3101
+ !shared.hasOwn(castValues, key)
3102
+ );
3103
+ }
3104
+ }
3105
+ return hasAttrsChanged;
3106
+ }
3107
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3108
+ const opt = options[key];
3109
+ if (opt != null) {
3110
+ const hasDefault = shared.hasOwn(opt, "default");
3111
+ if (hasDefault && value === void 0) {
3112
+ const defaultValue = opt.default;
3113
+ if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
3114
+ const { propsDefaults } = instance;
3115
+ if (key in propsDefaults) {
3116
+ value = propsDefaults[key];
3117
+ } else {
3118
+ const reset = setCurrentInstance(instance);
3119
+ value = propsDefaults[key] = defaultValue.call(
3120
+ null,
3121
+ props
3122
+ );
3123
+ reset();
3058
3124
  }
3059
- node = hydrateNode(
3060
- node,
3061
- vnode,
3062
- parentComponent,
3063
- parentSuspense,
3064
- slotScopeIds,
3065
- optimized
3066
- );
3067
- } else if (isText && !vnode.children) {
3068
- insert(vnode.el = createText(""), container);
3069
3125
  } else {
3070
- logMismatchError();
3071
- patch(
3072
- null,
3073
- vnode,
3074
- container,
3075
- null,
3076
- parentComponent,
3077
- parentSuspense,
3078
- getContainerType(container),
3079
- slotScopeIds
3080
- );
3126
+ value = defaultValue;
3081
3127
  }
3082
3128
  }
3083
- return node;
3084
- };
3085
- const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
3086
- const { slotScopeIds: fragmentSlotScopeIds } = vnode;
3087
- if (fragmentSlotScopeIds) {
3088
- slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
3129
+ if (opt[0 /* shouldCast */]) {
3130
+ if (isAbsent && !hasDefault) {
3131
+ value = false;
3132
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === shared.hyphenate(key))) {
3133
+ value = true;
3134
+ }
3089
3135
  }
3090
- const container = parentNode(node);
3091
- const next = hydrateChildren(
3092
- nextSibling(node),
3093
- vnode,
3094
- container,
3095
- parentComponent,
3096
- parentSuspense,
3097
- slotScopeIds,
3098
- optimized
3099
- );
3100
- if (next && isComment(next) && next.data === "]") {
3101
- return nextSibling(vnode.anchor = next);
3102
- } else {
3103
- logMismatchError();
3104
- insert(vnode.anchor = createComment(`]`), container, next);
3105
- return next;
3136
+ }
3137
+ return value;
3138
+ }
3139
+ const mixinPropsCache = /* @__PURE__ */ new WeakMap();
3140
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
3141
+ const cache = asMixin ? mixinPropsCache : appContext.propsCache;
3142
+ const cached = cache.get(comp);
3143
+ if (cached) {
3144
+ return cached;
3145
+ }
3146
+ const raw = comp.props;
3147
+ const normalized = {};
3148
+ const needCastKeys = [];
3149
+ let hasExtends = false;
3150
+ if (!shared.isFunction(comp)) {
3151
+ const extendProps = (raw2) => {
3152
+ hasExtends = true;
3153
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
3154
+ shared.extend(normalized, props);
3155
+ if (keys) needCastKeys.push(...keys);
3156
+ };
3157
+ if (!asMixin && appContext.mixins.length) {
3158
+ appContext.mixins.forEach(extendProps);
3106
3159
  }
3107
- };
3108
- const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
3109
- logMismatchError();
3110
- vnode.el = null;
3111
- if (isFragment) {
3112
- const end = locateClosingAnchor(node);
3113
- while (true) {
3114
- const next2 = nextSibling(node);
3115
- if (next2 && next2 !== end) {
3116
- remove(next2);
3117
- } else {
3118
- break;
3119
- }
3160
+ if (comp.extends) {
3161
+ extendProps(comp.extends);
3162
+ }
3163
+ if (comp.mixins) {
3164
+ comp.mixins.forEach(extendProps);
3165
+ }
3166
+ }
3167
+ if (!raw && !hasExtends) {
3168
+ if (shared.isObject(comp)) {
3169
+ cache.set(comp, shared.EMPTY_ARR);
3170
+ }
3171
+ return shared.EMPTY_ARR;
3172
+ }
3173
+ if (shared.isArray(raw)) {
3174
+ for (let i = 0; i < raw.length; i++) {
3175
+ const normalizedKey = shared.camelize(raw[i]);
3176
+ if (validatePropName(normalizedKey)) {
3177
+ normalized[normalizedKey] = shared.EMPTY_OBJ;
3120
3178
  }
3121
3179
  }
3122
- const next = nextSibling(node);
3123
- const container = parentNode(node);
3124
- remove(node);
3125
- patch(
3126
- null,
3127
- vnode,
3128
- container,
3129
- next,
3130
- parentComponent,
3131
- parentSuspense,
3132
- getContainerType(container),
3133
- slotScopeIds
3134
- );
3135
- return next;
3136
- };
3137
- const locateClosingAnchor = (node, open = "[", close = "]") => {
3138
- let match = 0;
3139
- while (node) {
3140
- node = nextSibling(node);
3141
- if (node && isComment(node)) {
3142
- if (node.data === open) match++;
3143
- if (node.data === close) {
3144
- if (match === 0) {
3145
- return nextSibling(node);
3146
- } else {
3147
- match--;
3180
+ } else if (raw) {
3181
+ for (const key in raw) {
3182
+ const normalizedKey = shared.camelize(key);
3183
+ if (validatePropName(normalizedKey)) {
3184
+ const opt = raw[key];
3185
+ const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
3186
+ const propType = prop.type;
3187
+ let shouldCast = false;
3188
+ let shouldCastTrue = true;
3189
+ if (shared.isArray(propType)) {
3190
+ for (let index = 0; index < propType.length; ++index) {
3191
+ const type = propType[index];
3192
+ const typeName = shared.isFunction(type) && type.name;
3193
+ if (typeName === "Boolean") {
3194
+ shouldCast = true;
3195
+ break;
3196
+ } else if (typeName === "String") {
3197
+ shouldCastTrue = false;
3198
+ }
3148
3199
  }
3200
+ } else {
3201
+ shouldCast = shared.isFunction(propType) && propType.name === "Boolean";
3202
+ }
3203
+ prop[0 /* shouldCast */] = shouldCast;
3204
+ prop[1 /* shouldCastTrue */] = shouldCastTrue;
3205
+ if (shouldCast || shared.hasOwn(prop, "default")) {
3206
+ needCastKeys.push(normalizedKey);
3149
3207
  }
3150
3208
  }
3151
3209
  }
3152
- return node;
3153
- };
3154
- const replaceNode = (newNode, oldNode, parentComponent) => {
3155
- const parentNode2 = oldNode.parentNode;
3156
- if (parentNode2) {
3157
- parentNode2.replaceChild(newNode, oldNode);
3210
+ }
3211
+ const res = [normalized, needCastKeys];
3212
+ if (shared.isObject(comp)) {
3213
+ cache.set(comp, res);
3214
+ }
3215
+ return res;
3216
+ }
3217
+ function validatePropName(key) {
3218
+ if (key[0] !== "$" && !shared.isReservedProp(key)) {
3219
+ return true;
3220
+ }
3221
+ return false;
3222
+ }
3223
+
3224
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
3225
+ const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
3226
+ const normalizeSlot = (key, rawSlot, ctx) => {
3227
+ if (rawSlot._n) {
3228
+ return rawSlot;
3229
+ }
3230
+ const normalized = withCtx((...args) => {
3231
+ if (false) ;
3232
+ return normalizeSlotValue(rawSlot(...args));
3233
+ }, ctx);
3234
+ normalized._c = false;
3235
+ return normalized;
3236
+ };
3237
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
3238
+ const ctx = rawSlots._ctx;
3239
+ for (const key in rawSlots) {
3240
+ if (isInternalKey(key)) continue;
3241
+ const value = rawSlots[key];
3242
+ if (shared.isFunction(value)) {
3243
+ slots[key] = normalizeSlot(key, value, ctx);
3244
+ } else if (value != null) {
3245
+ const normalized = normalizeSlotValue(value);
3246
+ slots[key] = () => normalized;
3158
3247
  }
3159
- let parent = parentComponent;
3160
- while (parent) {
3161
- if (parent.vnode.el === oldNode) {
3162
- parent.vnode.el = parent.subTree.el = newNode;
3248
+ }
3249
+ };
3250
+ const normalizeVNodeSlots = (instance, children) => {
3251
+ const normalized = normalizeSlotValue(children);
3252
+ instance.slots.default = () => normalized;
3253
+ };
3254
+ const assignSlots = (slots, children, optimized) => {
3255
+ for (const key in children) {
3256
+ if (optimized || key !== "_") {
3257
+ slots[key] = children[key];
3258
+ }
3259
+ }
3260
+ };
3261
+ const initSlots = (instance, children, optimized) => {
3262
+ const slots = instance.slots = createInternalObject();
3263
+ if (instance.vnode.shapeFlag & 32) {
3264
+ const type = children._;
3265
+ if (type) {
3266
+ assignSlots(slots, children, optimized);
3267
+ if (optimized) {
3268
+ shared.def(slots, "_", type, true);
3163
3269
  }
3164
- parent = parent.parent;
3270
+ } else {
3271
+ normalizeObjectSlots(children, slots);
3165
3272
  }
3166
- };
3167
- const isTemplateNode = (node) => {
3168
- return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
3169
- };
3170
- return [hydrate, hydrateNode];
3171
- }
3273
+ } else if (children) {
3274
+ normalizeVNodeSlots(instance, children);
3275
+ }
3276
+ };
3277
+ const updateSlots = (instance, children, optimized) => {
3278
+ const { vnode, slots } = instance;
3279
+ let needDeletionCheck = true;
3280
+ let deletionComparisonTarget = shared.EMPTY_OBJ;
3281
+ if (vnode.shapeFlag & 32) {
3282
+ const type = children._;
3283
+ if (type) {
3284
+ if (optimized && type === 1) {
3285
+ needDeletionCheck = false;
3286
+ } else {
3287
+ assignSlots(slots, children, optimized);
3288
+ }
3289
+ } else {
3290
+ needDeletionCheck = !children.$stable;
3291
+ normalizeObjectSlots(children, slots);
3292
+ }
3293
+ deletionComparisonTarget = children;
3294
+ } else if (children) {
3295
+ normalizeVNodeSlots(instance, children);
3296
+ deletionComparisonTarget = { default: 1 };
3297
+ }
3298
+ if (needDeletionCheck) {
3299
+ for (const key in slots) {
3300
+ if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
3301
+ delete slots[key];
3302
+ }
3303
+ }
3304
+ }
3305
+ };
3172
3306
 
3173
3307
  const queuePostRenderEffect = queueEffectWithSuspense ;
3174
3308
  function createRenderer(options) {
@@ -3772,13 +3906,11 @@ function baseCreateRenderer(options, createHydrationFns) {
3772
3906
  null
3773
3907
  );
3774
3908
  };
3775
- if (isAsyncWrapperVNode && !type.__asyncResolved) {
3776
- type.__asyncLoader().then(
3777
- // note: we are moving the render call into an async callback,
3778
- // which means it won't track dependencies - but it's ok because
3779
- // a server-rendered async wrapper is already in resolved state
3780
- // and it will never need to change.
3781
- () => !instance.isUnmounted && hydrateSubTree()
3909
+ if (isAsyncWrapperVNode) {
3910
+ type.__asyncHydrate(
3911
+ el,
3912
+ instance,
3913
+ hydrateSubTree
3782
3914
  );
3783
3915
  } else {
3784
3916
  hydrateSubTree();
@@ -6384,7 +6516,7 @@ function isMemoSame(cached, memo) {
6384
6516
  return true;
6385
6517
  }
6386
6518
 
6387
- const version = "3.5.0-alpha.4";
6519
+ const version = "3.5.0-alpha.5";
6388
6520
  const warn$1 = shared.NOOP;
6389
6521
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6390
6522
  const devtools = void 0;
@@ -6483,6 +6615,10 @@ exports.guardReactiveProps = guardReactiveProps;
6483
6615
  exports.h = h;
6484
6616
  exports.handleError = handleError;
6485
6617
  exports.hasInjectionContext = hasInjectionContext;
6618
+ exports.hydrateOnIdle = hydrateOnIdle;
6619
+ exports.hydrateOnInteraction = hydrateOnInteraction;
6620
+ exports.hydrateOnMediaQuery = hydrateOnMediaQuery;
6621
+ exports.hydrateOnVisible = hydrateOnVisible;
6486
6622
  exports.initCustomFormatter = initCustomFormatter;
6487
6623
  exports.inject = inject;
6488
6624
  exports.isMemoSame = isMemoSame;