@vue/runtime-core 3.4.27 → 3.4.28

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.4.27
2
+ * @vue/runtime-core v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -231,7 +231,8 @@ function flushPostFlushCbs(seen) {
231
231
  }
232
232
  activePostFlushCbs = deduped;
233
233
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
234
- activePostFlushCbs[postFlushIndex]();
234
+ const cb = activePostFlushCbs[postFlushIndex];
235
+ if (cb.active !== false) cb();
235
236
  }
236
237
  activePostFlushCbs = null;
237
238
  postFlushIndex = 0;
@@ -241,10 +242,8 @@ const getId = (job) => job.id == null ? Infinity : job.id;
241
242
  const comparator = (a, b) => {
242
243
  const diff = getId(a) - getId(b);
243
244
  if (diff === 0) {
244
- if (a.pre && !b.pre)
245
- return -1;
246
- if (b.pre && !a.pre)
247
- return 1;
245
+ if (a.pre && !b.pre) return -1;
246
+ if (b.pre && !a.pre) return 1;
248
247
  }
249
248
  return diff;
250
249
  };
@@ -273,8 +272,7 @@ function flushJobs(seen) {
273
272
  }
274
273
 
275
274
  function emit(instance, event, ...rawArgs) {
276
- if (instance.isUnmounted)
277
- return;
275
+ if (instance.isUnmounted) return;
278
276
  const props = instance.vnode.props || shared.EMPTY_OBJ;
279
277
  let args = rawArgs;
280
278
  const isModelListener = event.startsWith("update:");
@@ -386,8 +384,7 @@ function popScopeId() {
386
384
  }
387
385
  const withScopeId = (_id) => withCtx;
388
386
  function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
389
- if (!ctx)
390
- return fn;
387
+ if (!ctx) return fn;
391
388
  if (fn._n) {
392
389
  return fn;
393
390
  }
@@ -1077,7 +1074,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1077
1074
  next() {
1078
1075
  return suspense.activeBranch && next(suspense.activeBranch);
1079
1076
  },
1080
- registerDep(instance, setupRenderEffect) {
1077
+ registerDep(instance, setupRenderEffect, optimized2) {
1081
1078
  const isInPendingSuspense = !!suspense.pendingBranch;
1082
1079
  if (isInPendingSuspense) {
1083
1080
  suspense.deps++;
@@ -1108,7 +1105,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1108
1105
  hydratedEl ? null : next(instance.subTree),
1109
1106
  suspense,
1110
1107
  namespace,
1111
- optimized
1108
+ optimized2
1112
1109
  );
1113
1110
  if (placeholder) {
1114
1111
  remove(placeholder);
@@ -1232,244 +1229,52 @@ function isVNodeSuspensible(vnode) {
1232
1229
  return suspensible != null && suspensible !== false;
1233
1230
  }
1234
1231
 
1235
- const ssrContextKey = Symbol.for("v-scx");
1236
- const useSSRContext = () => {
1237
- {
1238
- const ctx = inject(ssrContextKey);
1239
- return ctx;
1240
- }
1241
- };
1242
-
1243
- function watchEffect(effect, options) {
1244
- return doWatch(effect, null, options);
1245
- }
1246
- function watchPostEffect(effect, options) {
1247
- return doWatch(
1248
- effect,
1249
- null,
1250
- { flush: "post" }
1251
- );
1252
- }
1253
- function watchSyncEffect(effect, options) {
1254
- return doWatch(
1255
- effect,
1256
- null,
1257
- { flush: "sync" }
1258
- );
1259
- }
1260
- const INITIAL_WATCHER_VALUE = {};
1261
- function watch(source, cb, options) {
1262
- return doWatch(source, cb, options);
1263
- }
1264
- function doWatch(source, cb, {
1265
- immediate,
1266
- deep,
1267
- flush,
1268
- once,
1269
- onTrack,
1270
- onTrigger
1271
- } = shared.EMPTY_OBJ) {
1272
- if (cb && once) {
1273
- const _cb = cb;
1274
- cb = (...args) => {
1275
- _cb(...args);
1276
- unwatch();
1277
- };
1278
- }
1279
- const instance = currentInstance;
1280
- const reactiveGetter = (source2) => deep === true ? source2 : (
1281
- // for deep: false, only traverse root-level properties
1282
- traverse(source2, deep === false ? 1 : void 0)
1283
- );
1284
- let getter;
1285
- let forceTrigger = false;
1286
- let isMultiSource = false;
1287
- if (reactivity.isRef(source)) {
1288
- getter = () => source.value;
1289
- forceTrigger = reactivity.isShallow(source);
1290
- } else if (reactivity.isReactive(source)) {
1291
- getter = () => reactiveGetter(source);
1292
- forceTrigger = true;
1293
- } else if (shared.isArray(source)) {
1294
- isMultiSource = true;
1295
- forceTrigger = source.some((s) => reactivity.isReactive(s) || reactivity.isShallow(s));
1296
- getter = () => source.map((s) => {
1297
- if (reactivity.isRef(s)) {
1298
- return s.value;
1299
- } else if (reactivity.isReactive(s)) {
1300
- return reactiveGetter(s);
1301
- } else if (shared.isFunction(s)) {
1302
- return callWithErrorHandling(s, instance, 2);
1303
- } else ;
1232
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
1233
+ if (target) {
1234
+ const hooks = target[type] || (target[type] = []);
1235
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1236
+ reactivity.pauseTracking();
1237
+ const reset = setCurrentInstance(target);
1238
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
1239
+ reset();
1240
+ reactivity.resetTracking();
1241
+ return res;
1304
1242
  });
1305
- } else if (shared.isFunction(source)) {
1306
- if (cb) {
1307
- getter = () => callWithErrorHandling(source, instance, 2);
1308
- } else {
1309
- getter = () => {
1310
- if (cleanup) {
1311
- cleanup();
1312
- }
1313
- return callWithAsyncErrorHandling(
1314
- source,
1315
- instance,
1316
- 3,
1317
- [onCleanup]
1318
- );
1319
- };
1320
- }
1321
- } else {
1322
- getter = shared.NOOP;
1323
- }
1324
- if (cb && deep) {
1325
- const baseGetter = getter;
1326
- getter = () => traverse(baseGetter());
1327
- }
1328
- let cleanup;
1329
- let onCleanup = (fn) => {
1330
- cleanup = effect.onStop = () => {
1331
- callWithErrorHandling(fn, instance, 4);
1332
- cleanup = effect.onStop = void 0;
1333
- };
1334
- };
1335
- let ssrCleanup;
1336
- if (isInSSRComponentSetup) {
1337
- onCleanup = shared.NOOP;
1338
- if (!cb) {
1339
- getter();
1340
- } else if (immediate) {
1341
- callWithAsyncErrorHandling(cb, instance, 3, [
1342
- getter(),
1343
- isMultiSource ? [] : void 0,
1344
- onCleanup
1345
- ]);
1346
- }
1347
- if (flush === "sync") {
1348
- const ctx = useSSRContext();
1349
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
1350
- } else {
1351
- return shared.NOOP;
1352
- }
1353
- }
1354
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1355
- const job = () => {
1356
- if (!effect.active || !effect.dirty) {
1357
- return;
1358
- }
1359
- if (cb) {
1360
- const newValue = effect.run();
1361
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
1362
- if (cleanup) {
1363
- cleanup();
1364
- }
1365
- callWithAsyncErrorHandling(cb, instance, 3, [
1366
- newValue,
1367
- // pass undefined as the old value when it's changed for the first time
1368
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1369
- onCleanup
1370
- ]);
1371
- oldValue = newValue;
1372
- }
1373
- } else {
1374
- effect.run();
1375
- }
1376
- };
1377
- job.allowRecurse = !!cb;
1378
- let scheduler;
1379
- if (flush === "sync") {
1380
- scheduler = job;
1381
- } else if (flush === "post") {
1382
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
1383
- } else {
1384
- job.pre = true;
1385
- if (instance)
1386
- job.id = instance.uid;
1387
- scheduler = () => queueJob(job);
1388
- }
1389
- const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
1390
- const scope = reactivity.getCurrentScope();
1391
- const unwatch = () => {
1392
- effect.stop();
1393
- if (scope) {
1394
- shared.remove(scope.effects, effect);
1395
- }
1396
- };
1397
- if (cb) {
1398
- if (immediate) {
1399
- job();
1243
+ if (prepend) {
1244
+ hooks.unshift(wrappedHook);
1400
1245
  } else {
1401
- oldValue = effect.run();
1246
+ hooks.push(wrappedHook);
1402
1247
  }
1403
- } else if (flush === "post") {
1404
- queuePostRenderEffect(
1405
- effect.run.bind(effect),
1406
- instance && instance.suspense
1407
- );
1408
- } else {
1409
- effect.run();
1410
- }
1411
- if (ssrCleanup)
1412
- ssrCleanup.push(unwatch);
1413
- return unwatch;
1414
- }
1415
- function instanceWatch(source, value, options) {
1416
- const publicThis = this.proxy;
1417
- const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
1418
- let cb;
1419
- if (shared.isFunction(value)) {
1420
- cb = value;
1421
- } else {
1422
- cb = value.handler;
1423
- options = value;
1248
+ return wrappedHook;
1424
1249
  }
1425
- const reset = setCurrentInstance(this);
1426
- const res = doWatch(getter, cb.bind(publicThis), options);
1427
- reset();
1428
- return res;
1429
- }
1430
- function createPathGetter(ctx, path) {
1431
- const segments = path.split(".");
1432
- return () => {
1433
- let cur = ctx;
1434
- for (let i = 0; i < segments.length && cur; i++) {
1435
- cur = cur[segments[i]];
1436
- }
1437
- return cur;
1438
- };
1439
1250
  }
1440
- function traverse(value, depth = Infinity, seen) {
1441
- if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
1442
- return value;
1443
- }
1444
- seen = seen || /* @__PURE__ */ new Set();
1445
- if (seen.has(value)) {
1446
- return value;
1447
- }
1448
- seen.add(value);
1449
- depth--;
1450
- if (reactivity.isRef(value)) {
1451
- traverse(value.value, depth, seen);
1452
- } else if (shared.isArray(value)) {
1453
- for (let i = 0; i < value.length; i++) {
1454
- traverse(value[i], depth, seen);
1455
- }
1456
- } else if (shared.isSet(value) || shared.isMap(value)) {
1457
- value.forEach((v) => {
1458
- traverse(v, depth, seen);
1459
- });
1460
- } else if (shared.isPlainObject(value)) {
1461
- for (const key in value) {
1462
- traverse(value[key], depth, seen);
1463
- }
1251
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
1252
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
1253
+ injectHook(lifecycle, (...args) => hook(...args), target);
1464
1254
  }
1465
- return value;
1255
+ };
1256
+ const onBeforeMount = createHook("bm");
1257
+ const onMounted = createHook("m");
1258
+ const onBeforeUpdate = createHook("bu");
1259
+ const onUpdated = createHook("u");
1260
+ const onBeforeUnmount = createHook("bum");
1261
+ const onUnmounted = createHook("um");
1262
+ const onServerPrefetch = createHook("sp");
1263
+ const onRenderTriggered = createHook(
1264
+ "rtg"
1265
+ );
1266
+ const onRenderTracked = createHook(
1267
+ "rtc"
1268
+ );
1269
+ function onErrorCaptured(hook, target = currentInstance) {
1270
+ injectHook("ec", hook, target);
1466
1271
  }
1467
1272
 
1468
1273
  function withDirectives(vnode, directives) {
1469
1274
  if (currentRenderingInstance === null) {
1470
1275
  return vnode;
1471
1276
  }
1472
- const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
1277
+ const instance = getComponentPublicInstance(currentRenderingInstance);
1473
1278
  const bindings = vnode.dirs || (vnode.dirs = []);
1474
1279
  for (let i = 0; i < directives.length; i++) {
1475
1280
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -1517,369 +1322,107 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
1517
1322
  }
1518
1323
  }
1519
1324
 
1520
- const leaveCbKey = Symbol("_leaveCb");
1521
- const enterCbKey = Symbol("_enterCb");
1522
- function useTransitionState() {
1523
- const state = {
1524
- isMounted: false,
1525
- isLeaving: false,
1526
- isUnmounting: false,
1527
- leavingVNodes: /* @__PURE__ */ new Map()
1528
- };
1529
- onMounted(() => {
1530
- state.isMounted = true;
1531
- });
1532
- onBeforeUnmount(() => {
1533
- state.isUnmounting = true;
1534
- });
1535
- return state;
1536
- }
1537
- const TransitionHookValidator = [Function, Array];
1538
- const BaseTransitionPropsValidators = {
1539
- mode: String,
1540
- appear: Boolean,
1541
- persisted: Boolean,
1542
- // enter
1543
- onBeforeEnter: TransitionHookValidator,
1544
- onEnter: TransitionHookValidator,
1545
- onAfterEnter: TransitionHookValidator,
1546
- onEnterCancelled: TransitionHookValidator,
1547
- // leave
1548
- onBeforeLeave: TransitionHookValidator,
1549
- onLeave: TransitionHookValidator,
1550
- onAfterLeave: TransitionHookValidator,
1551
- onLeaveCancelled: TransitionHookValidator,
1552
- // appear
1553
- onBeforeAppear: TransitionHookValidator,
1554
- onAppear: TransitionHookValidator,
1555
- onAfterAppear: TransitionHookValidator,
1556
- onAppearCancelled: TransitionHookValidator
1557
- };
1558
- const BaseTransitionImpl = {
1559
- name: `BaseTransition`,
1560
- props: BaseTransitionPropsValidators,
1561
- setup(props, { slots }) {
1562
- const instance = getCurrentInstance();
1563
- const state = useTransitionState();
1564
- return () => {
1565
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
1566
- if (!children || !children.length) {
1567
- return;
1568
- }
1569
- let child = children[0];
1570
- if (children.length > 1) {
1571
- for (const c of children) {
1572
- if (c.type !== Comment) {
1573
- child = c;
1574
- break;
1575
- }
1576
- }
1577
- }
1578
- const rawProps = reactivity.toRaw(props);
1579
- const { mode } = rawProps;
1580
- if (state.isLeaving) {
1581
- return emptyPlaceholder(child);
1582
- }
1583
- const innerChild = getKeepAliveChild(child);
1584
- if (!innerChild) {
1585
- return emptyPlaceholder(child);
1586
- }
1587
- const enterHooks = resolveTransitionHooks(
1588
- innerChild,
1589
- rawProps,
1590
- state,
1591
- instance
1325
+ function renderList(source, renderItem, cache, index) {
1326
+ let ret;
1327
+ const cached = cache && cache[index];
1328
+ if (shared.isArray(source) || shared.isString(source)) {
1329
+ ret = new Array(source.length);
1330
+ for (let i = 0, l = source.length; i < l; i++) {
1331
+ ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
1332
+ }
1333
+ } else if (typeof source === "number") {
1334
+ ret = new Array(source);
1335
+ for (let i = 0; i < source; i++) {
1336
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
1337
+ }
1338
+ } else if (shared.isObject(source)) {
1339
+ if (source[Symbol.iterator]) {
1340
+ ret = Array.from(
1341
+ source,
1342
+ (item, i) => renderItem(item, i, void 0, cached && cached[i])
1592
1343
  );
1593
- setTransitionHooks(innerChild, enterHooks);
1594
- const oldChild = instance.subTree;
1595
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
1596
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
1597
- const leavingHooks = resolveTransitionHooks(
1598
- oldInnerChild,
1599
- rawProps,
1600
- state,
1601
- instance
1602
- );
1603
- setTransitionHooks(oldInnerChild, leavingHooks);
1604
- if (mode === "out-in" && innerChild.type !== Comment) {
1605
- state.isLeaving = true;
1606
- leavingHooks.afterLeave = () => {
1607
- state.isLeaving = false;
1608
- if (instance.update.active !== false) {
1609
- instance.effect.dirty = true;
1610
- instance.update();
1611
- }
1612
- };
1613
- return emptyPlaceholder(child);
1614
- } else if (mode === "in-out" && innerChild.type !== Comment) {
1615
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
1616
- const leavingVNodesCache = getLeavingNodesForType(
1617
- state,
1618
- oldInnerChild
1619
- );
1620
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
1621
- el[leaveCbKey] = () => {
1622
- earlyRemove();
1623
- el[leaveCbKey] = void 0;
1624
- delete enterHooks.delayedLeave;
1625
- };
1626
- enterHooks.delayedLeave = delayedLeave;
1627
- };
1628
- }
1344
+ } else {
1345
+ const keys = Object.keys(source);
1346
+ ret = new Array(keys.length);
1347
+ for (let i = 0, l = keys.length; i < l; i++) {
1348
+ const key = keys[i];
1349
+ ret[i] = renderItem(source[key], key, i, cached && cached[i]);
1629
1350
  }
1630
- return child;
1631
- };
1351
+ }
1352
+ } else {
1353
+ ret = [];
1632
1354
  }
1633
- };
1634
- const BaseTransition = BaseTransitionImpl;
1635
- function getLeavingNodesForType(state, vnode) {
1636
- const { leavingVNodes } = state;
1637
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
1638
- if (!leavingVNodesCache) {
1639
- leavingVNodesCache = /* @__PURE__ */ Object.create(null);
1640
- leavingVNodes.set(vnode.type, leavingVNodesCache);
1355
+ if (cache) {
1356
+ cache[index] = ret;
1641
1357
  }
1642
- return leavingVNodesCache;
1358
+ return ret;
1643
1359
  }
1644
- function resolveTransitionHooks(vnode, props, state, instance) {
1645
- const {
1646
- appear,
1647
- mode,
1648
- persisted = false,
1649
- onBeforeEnter,
1650
- onEnter,
1651
- onAfterEnter,
1652
- onEnterCancelled,
1653
- onBeforeLeave,
1654
- onLeave,
1655
- onAfterLeave,
1656
- onLeaveCancelled,
1657
- onBeforeAppear,
1658
- onAppear,
1659
- onAfterAppear,
1660
- onAppearCancelled
1661
- } = props;
1662
- const key = String(vnode.key);
1663
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1664
- const callHook = (hook, args) => {
1665
- hook && callWithAsyncErrorHandling(
1666
- hook,
1667
- instance,
1668
- 9,
1669
- args
1670
- );
1671
- };
1672
- const callAsyncHook = (hook, args) => {
1673
- const done = args[1];
1674
- callHook(hook, args);
1675
- if (shared.isArray(hook)) {
1676
- if (hook.every((hook2) => hook2.length <= 1))
1677
- done();
1678
- } else if (hook.length <= 1) {
1679
- done();
1360
+
1361
+ function createSlots(slots, dynamicSlots) {
1362
+ for (let i = 0; i < dynamicSlots.length; i++) {
1363
+ const slot = dynamicSlots[i];
1364
+ if (shared.isArray(slot)) {
1365
+ for (let j = 0; j < slot.length; j++) {
1366
+ slots[slot[j].name] = slot[j].fn;
1367
+ }
1368
+ } else if (slot) {
1369
+ slots[slot.name] = slot.key ? (...args) => {
1370
+ const res = slot.fn(...args);
1371
+ if (res) res.key = slot.key;
1372
+ return res;
1373
+ } : slot.fn;
1680
1374
  }
1375
+ }
1376
+ return slots;
1377
+ }
1378
+
1379
+ /*! #__NO_SIDE_EFFECTS__ */
1380
+ // @__NO_SIDE_EFFECTS__
1381
+ function defineComponent(options, extraOptions) {
1382
+ return shared.isFunction(options) ? (
1383
+ // #8326: extend call and options.name access are considered side-effects
1384
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1385
+ /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
1386
+ ) : options;
1387
+ }
1388
+
1389
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1390
+ /*! #__NO_SIDE_EFFECTS__ */
1391
+ // @__NO_SIDE_EFFECTS__
1392
+ function defineAsyncComponent(source) {
1393
+ if (shared.isFunction(source)) {
1394
+ source = { loader: source };
1395
+ }
1396
+ const {
1397
+ loader,
1398
+ loadingComponent,
1399
+ errorComponent,
1400
+ delay = 200,
1401
+ timeout,
1402
+ // undefined = never times out
1403
+ suspensible = true,
1404
+ onError: userOnError
1405
+ } = source;
1406
+ let pendingRequest = null;
1407
+ let resolvedComp;
1408
+ let retries = 0;
1409
+ const retry = () => {
1410
+ retries++;
1411
+ pendingRequest = null;
1412
+ return load();
1681
1413
  };
1682
- const hooks = {
1683
- mode,
1684
- persisted,
1685
- beforeEnter(el) {
1686
- let hook = onBeforeEnter;
1687
- if (!state.isMounted) {
1688
- if (appear) {
1689
- hook = onBeforeAppear || onBeforeEnter;
1690
- } else {
1691
- return;
1692
- }
1693
- }
1694
- if (el[leaveCbKey]) {
1695
- el[leaveCbKey](
1696
- true
1697
- /* cancelled */
1698
- );
1699
- }
1700
- const leavingVNode = leavingVNodesCache[key];
1701
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
1702
- leavingVNode.el[leaveCbKey]();
1703
- }
1704
- callHook(hook, [el]);
1705
- },
1706
- enter(el) {
1707
- let hook = onEnter;
1708
- let afterHook = onAfterEnter;
1709
- let cancelHook = onEnterCancelled;
1710
- if (!state.isMounted) {
1711
- if (appear) {
1712
- hook = onAppear || onEnter;
1713
- afterHook = onAfterAppear || onAfterEnter;
1714
- cancelHook = onAppearCancelled || onEnterCancelled;
1715
- } else {
1716
- return;
1717
- }
1718
- }
1719
- let called = false;
1720
- const done = el[enterCbKey] = (cancelled) => {
1721
- if (called)
1722
- return;
1723
- called = true;
1724
- if (cancelled) {
1725
- callHook(cancelHook, [el]);
1726
- } else {
1727
- callHook(afterHook, [el]);
1728
- }
1729
- if (hooks.delayedLeave) {
1730
- hooks.delayedLeave();
1731
- }
1732
- el[enterCbKey] = void 0;
1733
- };
1734
- if (hook) {
1735
- callAsyncHook(hook, [el, done]);
1736
- } else {
1737
- done();
1738
- }
1739
- },
1740
- leave(el, remove) {
1741
- const key2 = String(vnode.key);
1742
- if (el[enterCbKey]) {
1743
- el[enterCbKey](
1744
- true
1745
- /* cancelled */
1746
- );
1747
- }
1748
- if (state.isUnmounting) {
1749
- return remove();
1750
- }
1751
- callHook(onBeforeLeave, [el]);
1752
- let called = false;
1753
- const done = el[leaveCbKey] = (cancelled) => {
1754
- if (called)
1755
- return;
1756
- called = true;
1757
- remove();
1758
- if (cancelled) {
1759
- callHook(onLeaveCancelled, [el]);
1760
- } else {
1761
- callHook(onAfterLeave, [el]);
1762
- }
1763
- el[leaveCbKey] = void 0;
1764
- if (leavingVNodesCache[key2] === vnode) {
1765
- delete leavingVNodesCache[key2];
1766
- }
1767
- };
1768
- leavingVNodesCache[key2] = vnode;
1769
- if (onLeave) {
1770
- callAsyncHook(onLeave, [el, done]);
1771
- } else {
1772
- done();
1773
- }
1774
- },
1775
- clone(vnode2) {
1776
- return resolveTransitionHooks(vnode2, props, state, instance);
1777
- }
1778
- };
1779
- return hooks;
1780
- }
1781
- function emptyPlaceholder(vnode) {
1782
- if (isKeepAlive(vnode)) {
1783
- vnode = cloneVNode(vnode);
1784
- vnode.children = null;
1785
- return vnode;
1786
- }
1787
- }
1788
- function getKeepAliveChild(vnode) {
1789
- if (!isKeepAlive(vnode)) {
1790
- return vnode;
1791
- }
1792
- const { shapeFlag, children } = vnode;
1793
- if (children) {
1794
- if (shapeFlag & 16) {
1795
- return children[0];
1796
- }
1797
- if (shapeFlag & 32 && shared.isFunction(children.default)) {
1798
- return children.default();
1799
- }
1800
- }
1801
- }
1802
- function setTransitionHooks(vnode, hooks) {
1803
- if (vnode.shapeFlag & 6 && vnode.component) {
1804
- setTransitionHooks(vnode.component.subTree, hooks);
1805
- } else if (vnode.shapeFlag & 128) {
1806
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1807
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1808
- } else {
1809
- vnode.transition = hooks;
1810
- }
1811
- }
1812
- function getTransitionRawChildren(children, keepComment = false, parentKey) {
1813
- let ret = [];
1814
- let keyedFragmentCount = 0;
1815
- for (let i = 0; i < children.length; i++) {
1816
- let child = children[i];
1817
- const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
1818
- if (child.type === Fragment) {
1819
- if (child.patchFlag & 128)
1820
- keyedFragmentCount++;
1821
- ret = ret.concat(
1822
- getTransitionRawChildren(child.children, keepComment, key)
1823
- );
1824
- } else if (keepComment || child.type !== Comment) {
1825
- ret.push(key != null ? cloneVNode(child, { key }) : child);
1826
- }
1827
- }
1828
- if (keyedFragmentCount > 1) {
1829
- for (let i = 0; i < ret.length; i++) {
1830
- ret[i].patchFlag = -2;
1831
- }
1832
- }
1833
- return ret;
1834
- }
1835
-
1836
- /*! #__NO_SIDE_EFFECTS__ */
1837
- // @__NO_SIDE_EFFECTS__
1838
- function defineComponent(options, extraOptions) {
1839
- return shared.isFunction(options) ? (
1840
- // #8326: extend call and options.name access are considered side-effects
1841
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1842
- /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
1843
- ) : options;
1844
- }
1845
-
1846
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1847
- /*! #__NO_SIDE_EFFECTS__ */
1848
- // @__NO_SIDE_EFFECTS__
1849
- function defineAsyncComponent(source) {
1850
- if (shared.isFunction(source)) {
1851
- source = { loader: source };
1852
- }
1853
- const {
1854
- loader,
1855
- loadingComponent,
1856
- errorComponent,
1857
- delay = 200,
1858
- timeout,
1859
- // undefined = never times out
1860
- suspensible = true,
1861
- onError: userOnError
1862
- } = source;
1863
- let pendingRequest = null;
1864
- let resolvedComp;
1865
- let retries = 0;
1866
- const retry = () => {
1867
- retries++;
1868
- pendingRequest = null;
1869
- return load();
1870
- };
1871
- const load = () => {
1872
- let thisRequest;
1873
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1874
- err = err instanceof Error ? err : new Error(String(err));
1875
- if (userOnError) {
1876
- return new Promise((resolve, reject) => {
1877
- const userRetry = () => resolve(retry());
1878
- const userFail = () => reject(err);
1879
- userOnError(err, userRetry, userFail, retries + 1);
1880
- });
1881
- } else {
1882
- throw err;
1414
+ const load = () => {
1415
+ let thisRequest;
1416
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1417
+ err = err instanceof Error ? err : new Error(String(err));
1418
+ if (userOnError) {
1419
+ return new Promise((resolve, reject) => {
1420
+ const userRetry = () => resolve(retry());
1421
+ const userFail = () => reject(err);
1422
+ userOnError(err, userRetry, userFail, retries + 1);
1423
+ });
1424
+ } else {
1425
+ throw err;
1883
1426
  }
1884
1427
  }).then((comp) => {
1885
1428
  if (thisRequest !== pendingRequest && pendingRequest) {
@@ -1974,346 +1517,9 @@ function createInnerComp(comp, parent) {
1974
1517
  return vnode;
1975
1518
  }
1976
1519
 
1977
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
1978
- const KeepAliveImpl = {
1979
- name: `KeepAlive`,
1980
- // Marker for special handling inside the renderer. We are not using a ===
1981
- // check directly on KeepAlive in the renderer, because importing it directly
1982
- // would prevent it from being tree-shaken.
1983
- __isKeepAlive: true,
1984
- props: {
1985
- include: [String, RegExp, Array],
1986
- exclude: [String, RegExp, Array],
1987
- max: [String, Number]
1988
- },
1989
- setup(props, { slots }) {
1990
- const instance = getCurrentInstance();
1991
- const sharedContext = instance.ctx;
1992
- if (!sharedContext.renderer) {
1993
- return () => {
1994
- const children = slots.default && slots.default();
1995
- return children && children.length === 1 ? children[0] : children;
1996
- };
1997
- }
1998
- const cache = /* @__PURE__ */ new Map();
1999
- const keys = /* @__PURE__ */ new Set();
2000
- let current = null;
2001
- const parentSuspense = instance.suspense;
2002
- const {
2003
- renderer: {
2004
- p: patch,
2005
- m: move,
2006
- um: _unmount,
2007
- o: { createElement }
2008
- }
2009
- } = sharedContext;
2010
- const storageContainer = createElement("div");
2011
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2012
- const instance2 = vnode.component;
2013
- move(vnode, container, anchor, 0, parentSuspense);
2014
- patch(
2015
- instance2.vnode,
2016
- vnode,
2017
- container,
2018
- anchor,
2019
- instance2,
2020
- parentSuspense,
2021
- namespace,
2022
- vnode.slotScopeIds,
2023
- optimized
2024
- );
2025
- queuePostRenderEffect(() => {
2026
- instance2.isDeactivated = false;
2027
- if (instance2.a) {
2028
- shared.invokeArrayFns(instance2.a);
2029
- }
2030
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
2031
- if (vnodeHook) {
2032
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2033
- }
2034
- }, parentSuspense);
2035
- };
2036
- sharedContext.deactivate = (vnode) => {
2037
- const instance2 = vnode.component;
2038
- move(vnode, storageContainer, null, 1, parentSuspense);
2039
- queuePostRenderEffect(() => {
2040
- if (instance2.da) {
2041
- shared.invokeArrayFns(instance2.da);
2042
- }
2043
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2044
- if (vnodeHook) {
2045
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2046
- }
2047
- instance2.isDeactivated = true;
2048
- }, parentSuspense);
2049
- };
2050
- function unmount(vnode) {
2051
- resetShapeFlag(vnode);
2052
- _unmount(vnode, instance, parentSuspense, true);
2053
- }
2054
- function pruneCache(filter) {
2055
- cache.forEach((vnode, key) => {
2056
- const name = getComponentName(vnode.type);
2057
- if (name && (!filter || !filter(name))) {
2058
- pruneCacheEntry(key);
2059
- }
2060
- });
2061
- }
2062
- function pruneCacheEntry(key) {
2063
- const cached = cache.get(key);
2064
- if (!current || !isSameVNodeType(cached, current)) {
2065
- unmount(cached);
2066
- } else if (current) {
2067
- resetShapeFlag(current);
2068
- }
2069
- cache.delete(key);
2070
- keys.delete(key);
2071
- }
2072
- watch(
2073
- () => [props.include, props.exclude],
2074
- ([include, exclude]) => {
2075
- include && pruneCache((name) => matches(include, name));
2076
- exclude && pruneCache((name) => !matches(exclude, name));
2077
- },
2078
- // prune post-render after `current` has been updated
2079
- { flush: "post", deep: true }
2080
- );
2081
- let pendingCacheKey = null;
2082
- const cacheSubtree = () => {
2083
- if (pendingCacheKey != null) {
2084
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2085
- }
2086
- };
2087
- onMounted(cacheSubtree);
2088
- onUpdated(cacheSubtree);
2089
- onBeforeUnmount(() => {
2090
- cache.forEach((cached) => {
2091
- const { subTree, suspense } = instance;
2092
- const vnode = getInnerChild(subTree);
2093
- if (cached.type === vnode.type && cached.key === vnode.key) {
2094
- resetShapeFlag(vnode);
2095
- const da = vnode.component.da;
2096
- da && queuePostRenderEffect(da, suspense);
2097
- return;
2098
- }
2099
- unmount(cached);
2100
- });
2101
- });
2102
- return () => {
2103
- pendingCacheKey = null;
2104
- if (!slots.default) {
2105
- return null;
2106
- }
2107
- const children = slots.default();
2108
- const rawVNode = children[0];
2109
- if (children.length > 1) {
2110
- current = null;
2111
- return children;
2112
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
2113
- current = null;
2114
- return rawVNode;
2115
- }
2116
- let vnode = getInnerChild(rawVNode);
2117
- const comp = vnode.type;
2118
- const name = getComponentName(
2119
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
2120
- );
2121
- const { include, exclude, max } = props;
2122
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
2123
- current = vnode;
2124
- return rawVNode;
2125
- }
2126
- const key = vnode.key == null ? comp : vnode.key;
2127
- const cachedVNode = cache.get(key);
2128
- if (vnode.el) {
2129
- vnode = cloneVNode(vnode);
2130
- if (rawVNode.shapeFlag & 128) {
2131
- rawVNode.ssContent = vnode;
2132
- }
2133
- }
2134
- pendingCacheKey = key;
2135
- if (cachedVNode) {
2136
- vnode.el = cachedVNode.el;
2137
- vnode.component = cachedVNode.component;
2138
- if (vnode.transition) {
2139
- setTransitionHooks(vnode, vnode.transition);
2140
- }
2141
- vnode.shapeFlag |= 512;
2142
- keys.delete(key);
2143
- keys.add(key);
2144
- } else {
2145
- keys.add(key);
2146
- if (max && keys.size > parseInt(max, 10)) {
2147
- pruneCacheEntry(keys.values().next().value);
2148
- }
2149
- }
2150
- vnode.shapeFlag |= 256;
2151
- current = vnode;
2152
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
2153
- };
2154
- }
2155
- };
2156
- const KeepAlive = KeepAliveImpl;
2157
- function matches(pattern, name) {
2158
- if (shared.isArray(pattern)) {
2159
- return pattern.some((p) => matches(p, name));
2160
- } else if (shared.isString(pattern)) {
2161
- return pattern.split(",").includes(name);
2162
- } else if (shared.isRegExp(pattern)) {
2163
- return pattern.test(name);
2164
- }
2165
- return false;
2166
- }
2167
- function onActivated(hook, target) {
2168
- registerKeepAliveHook(hook, "a", target);
2169
- }
2170
- function onDeactivated(hook, target) {
2171
- registerKeepAliveHook(hook, "da", target);
2172
- }
2173
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2174
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2175
- let current = target;
2176
- while (current) {
2177
- if (current.isDeactivated) {
2178
- return;
2179
- }
2180
- current = current.parent;
2181
- }
2182
- return hook();
2183
- });
2184
- injectHook(type, wrappedHook, target);
2185
- if (target) {
2186
- let current = target.parent;
2187
- while (current && current.parent) {
2188
- if (isKeepAlive(current.parent.vnode)) {
2189
- injectToKeepAliveRoot(wrappedHook, type, target, current);
2190
- }
2191
- current = current.parent;
2192
- }
2193
- }
2194
- }
2195
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2196
- const injected = injectHook(
2197
- type,
2198
- hook,
2199
- keepAliveRoot,
2200
- true
2201
- /* prepend */
2202
- );
2203
- onUnmounted(() => {
2204
- shared.remove(keepAliveRoot[type], injected);
2205
- }, target);
2206
- }
2207
- function resetShapeFlag(vnode) {
2208
- vnode.shapeFlag &= ~256;
2209
- vnode.shapeFlag &= ~512;
2210
- }
2211
- function getInnerChild(vnode) {
2212
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2213
- }
2214
-
2215
- function injectHook(type, hook, target = currentInstance, prepend = false) {
2216
- if (target) {
2217
- const hooks = target[type] || (target[type] = []);
2218
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2219
- if (target.isUnmounted) {
2220
- return;
2221
- }
2222
- reactivity.pauseTracking();
2223
- const reset = setCurrentInstance(target);
2224
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2225
- reset();
2226
- reactivity.resetTracking();
2227
- return res;
2228
- });
2229
- if (prepend) {
2230
- hooks.unshift(wrappedHook);
2231
- } else {
2232
- hooks.push(wrappedHook);
2233
- }
2234
- return wrappedHook;
2235
- }
2236
- }
2237
- const createHook = (lifecycle) => (hook, target = currentInstance) => (
2238
- // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
2239
- (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
2240
- );
2241
- const onBeforeMount = createHook("bm");
2242
- const onMounted = createHook("m");
2243
- const onBeforeUpdate = createHook("bu");
2244
- const onUpdated = createHook("u");
2245
- const onBeforeUnmount = createHook("bum");
2246
- const onUnmounted = createHook("um");
2247
- const onServerPrefetch = createHook("sp");
2248
- const onRenderTriggered = createHook(
2249
- "rtg"
2250
- );
2251
- const onRenderTracked = createHook(
2252
- "rtc"
2253
- );
2254
- function onErrorCaptured(hook, target = currentInstance) {
2255
- injectHook("ec", hook, target);
2256
- }
2257
-
2258
- function renderList(source, renderItem, cache, index) {
2259
- let ret;
2260
- const cached = cache && cache[index];
2261
- if (shared.isArray(source) || shared.isString(source)) {
2262
- ret = new Array(source.length);
2263
- for (let i = 0, l = source.length; i < l; i++) {
2264
- ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
2265
- }
2266
- } else if (typeof source === "number") {
2267
- ret = new Array(source);
2268
- for (let i = 0; i < source; i++) {
2269
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2270
- }
2271
- } else if (shared.isObject(source)) {
2272
- if (source[Symbol.iterator]) {
2273
- ret = Array.from(
2274
- source,
2275
- (item, i) => renderItem(item, i, void 0, cached && cached[i])
2276
- );
2277
- } else {
2278
- const keys = Object.keys(source);
2279
- ret = new Array(keys.length);
2280
- for (let i = 0, l = keys.length; i < l; i++) {
2281
- const key = keys[i];
2282
- ret[i] = renderItem(source[key], key, i, cached && cached[i]);
2283
- }
2284
- }
2285
- } else {
2286
- ret = [];
2287
- }
2288
- if (cache) {
2289
- cache[index] = ret;
2290
- }
2291
- return ret;
2292
- }
2293
-
2294
- function createSlots(slots, dynamicSlots) {
2295
- for (let i = 0; i < dynamicSlots.length; i++) {
2296
- const slot = dynamicSlots[i];
2297
- if (shared.isArray(slot)) {
2298
- for (let j = 0; j < slot.length; j++) {
2299
- slots[slot[j].name] = slot[j].fn;
2300
- }
2301
- } else if (slot) {
2302
- slots[slot.name] = slot.key ? (...args) => {
2303
- const res = slot.fn(...args);
2304
- if (res)
2305
- res.key = slot.key;
2306
- return res;
2307
- } : slot.fn;
2308
- }
2309
- }
2310
- return slots;
2311
- }
2312
-
2313
1520
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2314
1521
  if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2315
- if (name !== "default")
2316
- props.name = name;
1522
+ if (name !== "default") props.name = name;
2317
1523
  return createVNode("slot", props, fallback && fallback());
2318
1524
  }
2319
1525
  let slot = slots[name];
@@ -2342,10 +1548,8 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2342
1548
  }
2343
1549
  function ensureValidVNode(vnodes) {
2344
1550
  return vnodes.some((child) => {
2345
- if (!isVNode(child))
2346
- return true;
2347
- if (child.type === Comment)
2348
- return false;
1551
+ if (!isVNode(child)) return true;
1552
+ if (child.type === Comment) return false;
2349
1553
  if (child.type === Fragment && !ensureValidVNode(child.children))
2350
1554
  return false;
2351
1555
  return true;
@@ -2361,10 +1565,8 @@ function toHandlers(obj, preserveCaseIfNecessary) {
2361
1565
  }
2362
1566
 
2363
1567
  const getPublicInstance = (i) => {
2364
- if (!i)
2365
- return null;
2366
- if (isStatefulComponent(i))
2367
- return getExposeProxy(i) || i.proxy;
1568
+ if (!i) return null;
1569
+ if (isStatefulComponent(i)) return getComponentPublicInstance(i);
2368
1570
  return getPublicInstance(i.parent);
2369
1571
  };
2370
1572
  const publicPropertiesMap = (
@@ -2544,8 +1746,7 @@ function normalizePropsOrEmits(props) {
2544
1746
  function mergeDefaults(raw, defaults) {
2545
1747
  const props = normalizePropsOrEmits(raw);
2546
1748
  for (const key in defaults) {
2547
- if (key.startsWith("__skip"))
2548
- continue;
1749
+ if (key.startsWith("__skip")) continue;
2549
1750
  let opt = props[key];
2550
1751
  if (opt) {
2551
1752
  if (shared.isArray(opt) || shared.isFunction(opt)) {
@@ -2563,10 +1764,8 @@ function mergeDefaults(raw, defaults) {
2563
1764
  return props;
2564
1765
  }
2565
1766
  function mergeModels(a, b) {
2566
- if (!a || !b)
2567
- return a || b;
2568
- if (shared.isArray(a) && shared.isArray(b))
2569
- return a.concat(b);
1767
+ if (!a || !b) return a || b;
1768
+ if (shared.isArray(a) && shared.isArray(b)) return a.concat(b);
2570
1769
  return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
2571
1770
  }
2572
1771
  function createPropsRestProxy(props, excludedKeys) {
@@ -2726,10 +1925,8 @@ function applyOptions(instance) {
2726
1925
  if (inheritAttrs != null) {
2727
1926
  instance.inheritAttrs = inheritAttrs;
2728
1927
  }
2729
- if (components)
2730
- instance.components = components;
2731
- if (directives)
2732
- instance.directives = directives;
1928
+ if (components) instance.components = components;
1929
+ if (directives) instance.directives = directives;
2733
1930
  }
2734
1931
  function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
2735
1932
  if (shared.isArray(injectOptions)) {
@@ -2917,10 +2114,8 @@ function mergeEmitsOrPropsOptions(to, from) {
2917
2114
  }
2918
2115
  }
2919
2116
  function mergeWatchOptions(to, from) {
2920
- if (!to)
2921
- return from;
2922
- if (!from)
2923
- return to;
2117
+ if (!to) return from;
2118
+ if (!from) return to;
2924
2119
  const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
2925
2120
  for (const key in from) {
2926
2121
  merged[key] = mergeAsArray(to[key], from[key]);
@@ -3023,7 +2218,7 @@ function createAppAPI(render, hydrate) {
3023
2218
  isMounted = true;
3024
2219
  app._container = rootContainer;
3025
2220
  rootContainer.__vue_app__ = app;
3026
- return getExposeProxy(vnode.component) || vnode.component.proxy;
2221
+ return getComponentPublicInstance(vnode.component);
3027
2222
  }
3028
2223
  },
3029
2224
  unmount() {
@@ -3279,8 +2474,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3279
2474
  hasExtends = true;
3280
2475
  const [props, keys] = normalizePropsOptions(raw2, appContext, true);
3281
2476
  shared.extend(normalized, props);
3282
- if (keys)
3283
- needCastKeys.push(...keys);
2477
+ if (keys) needCastKeys.push(...keys);
3284
2478
  };
3285
2479
  if (!asMixin && appContext.mixins.length) {
3286
2480
  appContext.mixins.forEach(extendProps);
@@ -3375,8 +2569,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
3375
2569
  const normalizeObjectSlots = (rawSlots, slots, instance) => {
3376
2570
  const ctx = rawSlots._ctx;
3377
2571
  for (const key in rawSlots) {
3378
- if (isInternalKey(key))
3379
- continue;
2572
+ if (isInternalKey(key)) continue;
3380
2573
  const value = rawSlots[key];
3381
2574
  if (shared.isFunction(value)) {
3382
2575
  slots[key] = normalizeSlot(key, value, ctx);
@@ -3453,7 +2646,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3453
2646
  if (isAsyncWrapper(vnode) && !isUnmount) {
3454
2647
  return;
3455
2648
  }
3456
- const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
2649
+ const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
3457
2650
  const value = isUnmount ? null : refValue;
3458
2651
  const { i: owner, r: ref } = rawRef;
3459
2652
  const oldRef = oldRawRef && oldRawRef.r;
@@ -3489,8 +2682,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3489
2682
  }
3490
2683
  } else {
3491
2684
  ref.value = [refValue];
3492
- if (rawRef.k)
3493
- refs[rawRef.k] = ref.value;
2685
+ if (rawRef.k) refs[rawRef.k] = ref.value;
3494
2686
  }
3495
2687
  } else if (!existing.includes(refValue)) {
3496
2688
  existing.push(refValue);
@@ -3503,8 +2695,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3503
2695
  }
3504
2696
  } else if (_isRef) {
3505
2697
  ref.value = value;
3506
- if (rawRef.k)
3507
- refs[rawRef.k] = value;
2698
+ if (rawRef.k) refs[rawRef.k] = value;
3508
2699
  } else ;
3509
2700
  };
3510
2701
  if (value) {
@@ -3517,14 +2708,19 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3517
2708
  }
3518
2709
  }
3519
2710
 
3520
- let hasMismatch = false;
2711
+ let hasLoggedMismatchError = false;
2712
+ const logMismatchError = () => {
2713
+ if (hasLoggedMismatchError) {
2714
+ return;
2715
+ }
2716
+ console.error("Hydration completed but contains mismatches.");
2717
+ hasLoggedMismatchError = true;
2718
+ };
3521
2719
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
3522
2720
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
3523
2721
  const getContainerType = (container) => {
3524
- if (isSVGContainer(container))
3525
- return "svg";
3526
- if (isMathMLContainer(container))
3527
- return "mathml";
2722
+ if (isSVGContainer(container)) return "svg";
2723
+ if (isMathMLContainer(container)) return "mathml";
3528
2724
  return void 0;
3529
2725
  };
3530
2726
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -3549,13 +2745,9 @@ function createHydrationFunctions(rendererInternals) {
3549
2745
  container._vnode = vnode;
3550
2746
  return;
3551
2747
  }
3552
- hasMismatch = false;
3553
2748
  hydrateNode(container.firstChild, vnode, null, null, null);
3554
2749
  flushPostFlushCbs();
3555
2750
  container._vnode = vnode;
3556
- if (hasMismatch && true) {
3557
- console.error(`Hydration completed but contains mismatches.`);
3558
- }
3559
2751
  };
3560
2752
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
3561
2753
  optimized = optimized || !!vnode.dynamicChildren;
@@ -3587,7 +2779,7 @@ function createHydrationFunctions(rendererInternals) {
3587
2779
  }
3588
2780
  } else {
3589
2781
  if (node.data !== vnode.children) {
3590
- hasMismatch = true;
2782
+ logMismatchError();
3591
2783
  node.data = vnode.children;
3592
2784
  }
3593
2785
  nextNode = nextSibling(node);
@@ -3750,14 +2942,14 @@ function createHydrationFunctions(rendererInternals) {
3750
2942
  optimized
3751
2943
  );
3752
2944
  while (next) {
3753
- hasMismatch = true;
2945
+ logMismatchError();
3754
2946
  const cur = next;
3755
2947
  next = next.nextSibling;
3756
2948
  remove(cur);
3757
2949
  }
3758
2950
  } else if (shapeFlag & 8) {
3759
2951
  if (el.textContent !== vnode.children) {
3760
- hasMismatch = true;
2952
+ logMismatchError();
3761
2953
  el.textContent = vnode.children;
3762
2954
  }
3763
2955
  }
@@ -3822,9 +3014,9 @@ function createHydrationFunctions(rendererInternals) {
3822
3014
  optimized
3823
3015
  );
3824
3016
  } else if (vnode.type === Text && !vnode.children) {
3825
- continue;
3017
+ insert(vnode.el = createText(""), container);
3826
3018
  } else {
3827
- hasMismatch = true;
3019
+ logMismatchError();
3828
3020
  patch(
3829
3021
  null,
3830
3022
  vnode,
@@ -3857,13 +3049,13 @@ function createHydrationFunctions(rendererInternals) {
3857
3049
  if (next && isComment(next) && next.data === "]") {
3858
3050
  return nextSibling(vnode.anchor = next);
3859
3051
  } else {
3860
- hasMismatch = true;
3052
+ logMismatchError();
3861
3053
  insert(vnode.anchor = createComment(`]`), container, next);
3862
3054
  return next;
3863
3055
  }
3864
3056
  };
3865
3057
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
3866
- hasMismatch = true;
3058
+ logMismatchError();
3867
3059
  vnode.el = null;
3868
3060
  if (isFragment) {
3869
3061
  const end = locateClosingAnchor(node);
@@ -3896,8 +3088,7 @@ function createHydrationFunctions(rendererInternals) {
3896
3088
  while (node) {
3897
3089
  node = nextSibling(node);
3898
3090
  if (node && isComment(node)) {
3899
- if (node.data === open)
3900
- match++;
3091
+ if (node.data === open) match++;
3901
3092
  if (node.data === close) {
3902
3093
  if (match === 0) {
3903
3094
  return nextSibling(node);
@@ -4390,8 +3581,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4390
3581
  }
4391
3582
  }
4392
3583
  for (const key in newProps) {
4393
- if (shared.isReservedProp(key))
4394
- continue;
3584
+ if (shared.isReservedProp(key)) continue;
4395
3585
  const next = newProps[key];
4396
3586
  const prev = oldProps[key];
4397
3587
  if (next !== prev && key !== "value") {
@@ -4518,7 +3708,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4518
3708
  setupComponent(instance);
4519
3709
  }
4520
3710
  if (instance.asyncDep) {
4521
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
3711
+ parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
4522
3712
  if (!initialVNode.el) {
4523
3713
  const placeholder = instance.subTree = createVNode(Comment);
4524
3714
  processCommentNode(null, placeholder, container, anchor);
@@ -4740,571 +3930,1389 @@ function baseCreateRenderer(options, createHydrationFns) {
4740
3930
  return;
4741
3931
  }
4742
3932
  }
4743
- if (shapeFlag & 8) {
4744
- if (prevShapeFlag & 16) {
4745
- unmountChildren(c1, parentComponent, parentSuspense);
4746
- }
4747
- if (c2 !== c1) {
4748
- hostSetElementText(container, c2);
4749
- }
4750
- } else {
4751
- if (prevShapeFlag & 16) {
4752
- if (shapeFlag & 16) {
4753
- patchKeyedChildren(
4754
- c1,
4755
- c2,
4756
- container,
4757
- anchor,
4758
- parentComponent,
4759
- parentSuspense,
4760
- namespace,
4761
- slotScopeIds,
4762
- optimized
4763
- );
4764
- } else {
4765
- unmountChildren(c1, parentComponent, parentSuspense, true);
4766
- }
4767
- } else {
4768
- if (prevShapeFlag & 8) {
4769
- hostSetElementText(container, "");
4770
- }
4771
- if (shapeFlag & 16) {
4772
- mountChildren(
4773
- c2,
4774
- container,
4775
- anchor,
4776
- parentComponent,
4777
- parentSuspense,
4778
- namespace,
4779
- slotScopeIds,
4780
- optimized
4781
- );
4782
- }
3933
+ if (shapeFlag & 8) {
3934
+ if (prevShapeFlag & 16) {
3935
+ unmountChildren(c1, parentComponent, parentSuspense);
3936
+ }
3937
+ if (c2 !== c1) {
3938
+ hostSetElementText(container, c2);
3939
+ }
3940
+ } else {
3941
+ if (prevShapeFlag & 16) {
3942
+ if (shapeFlag & 16) {
3943
+ patchKeyedChildren(
3944
+ c1,
3945
+ c2,
3946
+ container,
3947
+ anchor,
3948
+ parentComponent,
3949
+ parentSuspense,
3950
+ namespace,
3951
+ slotScopeIds,
3952
+ optimized
3953
+ );
3954
+ } else {
3955
+ unmountChildren(c1, parentComponent, parentSuspense, true);
3956
+ }
3957
+ } else {
3958
+ if (prevShapeFlag & 8) {
3959
+ hostSetElementText(container, "");
3960
+ }
3961
+ if (shapeFlag & 16) {
3962
+ mountChildren(
3963
+ c2,
3964
+ container,
3965
+ anchor,
3966
+ parentComponent,
3967
+ parentSuspense,
3968
+ namespace,
3969
+ slotScopeIds,
3970
+ optimized
3971
+ );
3972
+ }
3973
+ }
3974
+ }
3975
+ };
3976
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
3977
+ c1 = c1 || shared.EMPTY_ARR;
3978
+ c2 = c2 || shared.EMPTY_ARR;
3979
+ const oldLength = c1.length;
3980
+ const newLength = c2.length;
3981
+ const commonLength = Math.min(oldLength, newLength);
3982
+ let i;
3983
+ for (i = 0; i < commonLength; i++) {
3984
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
3985
+ patch(
3986
+ c1[i],
3987
+ nextChild,
3988
+ container,
3989
+ null,
3990
+ parentComponent,
3991
+ parentSuspense,
3992
+ namespace,
3993
+ slotScopeIds,
3994
+ optimized
3995
+ );
3996
+ }
3997
+ if (oldLength > newLength) {
3998
+ unmountChildren(
3999
+ c1,
4000
+ parentComponent,
4001
+ parentSuspense,
4002
+ true,
4003
+ false,
4004
+ commonLength
4005
+ );
4006
+ } else {
4007
+ mountChildren(
4008
+ c2,
4009
+ container,
4010
+ anchor,
4011
+ parentComponent,
4012
+ parentSuspense,
4013
+ namespace,
4014
+ slotScopeIds,
4015
+ optimized,
4016
+ commonLength
4017
+ );
4018
+ }
4019
+ };
4020
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4021
+ let i = 0;
4022
+ const l2 = c2.length;
4023
+ let e1 = c1.length - 1;
4024
+ let e2 = l2 - 1;
4025
+ while (i <= e1 && i <= e2) {
4026
+ const n1 = c1[i];
4027
+ const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4028
+ if (isSameVNodeType(n1, n2)) {
4029
+ patch(
4030
+ n1,
4031
+ n2,
4032
+ container,
4033
+ null,
4034
+ parentComponent,
4035
+ parentSuspense,
4036
+ namespace,
4037
+ slotScopeIds,
4038
+ optimized
4039
+ );
4040
+ } else {
4041
+ break;
4042
+ }
4043
+ i++;
4044
+ }
4045
+ while (i <= e1 && i <= e2) {
4046
+ const n1 = c1[e1];
4047
+ const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
4048
+ if (isSameVNodeType(n1, n2)) {
4049
+ patch(
4050
+ n1,
4051
+ n2,
4052
+ container,
4053
+ null,
4054
+ parentComponent,
4055
+ parentSuspense,
4056
+ namespace,
4057
+ slotScopeIds,
4058
+ optimized
4059
+ );
4060
+ } else {
4061
+ break;
4062
+ }
4063
+ e1--;
4064
+ e2--;
4065
+ }
4066
+ if (i > e1) {
4067
+ if (i <= e2) {
4068
+ const nextPos = e2 + 1;
4069
+ const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
4070
+ while (i <= e2) {
4071
+ patch(
4072
+ null,
4073
+ c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
4074
+ container,
4075
+ anchor,
4076
+ parentComponent,
4077
+ parentSuspense,
4078
+ namespace,
4079
+ slotScopeIds,
4080
+ optimized
4081
+ );
4082
+ i++;
4083
+ }
4084
+ }
4085
+ } else if (i > e2) {
4086
+ while (i <= e1) {
4087
+ unmount(c1[i], parentComponent, parentSuspense, true);
4088
+ i++;
4089
+ }
4090
+ } else {
4091
+ const s1 = i;
4092
+ const s2 = i;
4093
+ const keyToNewIndexMap = /* @__PURE__ */ new Map();
4094
+ for (i = s2; i <= e2; i++) {
4095
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4096
+ if (nextChild.key != null) {
4097
+ keyToNewIndexMap.set(nextChild.key, i);
4098
+ }
4099
+ }
4100
+ let j;
4101
+ let patched = 0;
4102
+ const toBePatched = e2 - s2 + 1;
4103
+ let moved = false;
4104
+ let maxNewIndexSoFar = 0;
4105
+ const newIndexToOldIndexMap = new Array(toBePatched);
4106
+ for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
4107
+ for (i = s1; i <= e1; i++) {
4108
+ const prevChild = c1[i];
4109
+ if (patched >= toBePatched) {
4110
+ unmount(prevChild, parentComponent, parentSuspense, true);
4111
+ continue;
4112
+ }
4113
+ let newIndex;
4114
+ if (prevChild.key != null) {
4115
+ newIndex = keyToNewIndexMap.get(prevChild.key);
4116
+ } else {
4117
+ for (j = s2; j <= e2; j++) {
4118
+ if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
4119
+ newIndex = j;
4120
+ break;
4121
+ }
4122
+ }
4123
+ }
4124
+ if (newIndex === void 0) {
4125
+ unmount(prevChild, parentComponent, parentSuspense, true);
4126
+ } else {
4127
+ newIndexToOldIndexMap[newIndex - s2] = i + 1;
4128
+ if (newIndex >= maxNewIndexSoFar) {
4129
+ maxNewIndexSoFar = newIndex;
4130
+ } else {
4131
+ moved = true;
4132
+ }
4133
+ patch(
4134
+ prevChild,
4135
+ c2[newIndex],
4136
+ container,
4137
+ null,
4138
+ parentComponent,
4139
+ parentSuspense,
4140
+ namespace,
4141
+ slotScopeIds,
4142
+ optimized
4143
+ );
4144
+ patched++;
4145
+ }
4146
+ }
4147
+ const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
4148
+ j = increasingNewIndexSequence.length - 1;
4149
+ for (i = toBePatched - 1; i >= 0; i--) {
4150
+ const nextIndex = s2 + i;
4151
+ const nextChild = c2[nextIndex];
4152
+ const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
4153
+ if (newIndexToOldIndexMap[i] === 0) {
4154
+ patch(
4155
+ null,
4156
+ nextChild,
4157
+ container,
4158
+ anchor,
4159
+ parentComponent,
4160
+ parentSuspense,
4161
+ namespace,
4162
+ slotScopeIds,
4163
+ optimized
4164
+ );
4165
+ } else if (moved) {
4166
+ if (j < 0 || i !== increasingNewIndexSequence[j]) {
4167
+ move(nextChild, container, anchor, 2);
4168
+ } else {
4169
+ j--;
4170
+ }
4171
+ }
4172
+ }
4173
+ }
4174
+ };
4175
+ const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
4176
+ const { el, type, transition, children, shapeFlag } = vnode;
4177
+ if (shapeFlag & 6) {
4178
+ move(vnode.component.subTree, container, anchor, moveType);
4179
+ return;
4180
+ }
4181
+ if (shapeFlag & 128) {
4182
+ vnode.suspense.move(container, anchor, moveType);
4183
+ return;
4184
+ }
4185
+ if (shapeFlag & 64) {
4186
+ type.move(vnode, container, anchor, internals);
4187
+ return;
4188
+ }
4189
+ if (type === Fragment) {
4190
+ hostInsert(el, container, anchor);
4191
+ for (let i = 0; i < children.length; i++) {
4192
+ move(children[i], container, anchor, moveType);
4193
+ }
4194
+ hostInsert(vnode.anchor, container, anchor);
4195
+ return;
4196
+ }
4197
+ if (type === Static) {
4198
+ moveStaticNode(vnode, container, anchor);
4199
+ return;
4200
+ }
4201
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
4202
+ if (needTransition2) {
4203
+ if (moveType === 0) {
4204
+ transition.beforeEnter(el);
4205
+ hostInsert(el, container, anchor);
4206
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
4207
+ } else {
4208
+ const { leave, delayLeave, afterLeave } = transition;
4209
+ const remove2 = () => hostInsert(el, container, anchor);
4210
+ const performLeave = () => {
4211
+ leave(el, () => {
4212
+ remove2();
4213
+ afterLeave && afterLeave();
4214
+ });
4215
+ };
4216
+ if (delayLeave) {
4217
+ delayLeave(el, remove2, performLeave);
4218
+ } else {
4219
+ performLeave();
4220
+ }
4221
+ }
4222
+ } else {
4223
+ hostInsert(el, container, anchor);
4224
+ }
4225
+ };
4226
+ const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
4227
+ const {
4228
+ type,
4229
+ props,
4230
+ ref,
4231
+ children,
4232
+ dynamicChildren,
4233
+ shapeFlag,
4234
+ patchFlag,
4235
+ dirs,
4236
+ memoIndex
4237
+ } = vnode;
4238
+ if (ref != null) {
4239
+ setRef(ref, null, parentSuspense, vnode, true);
4240
+ }
4241
+ if (memoIndex != null) {
4242
+ parentComponent.renderCache[memoIndex] = void 0;
4243
+ }
4244
+ if (shapeFlag & 256) {
4245
+ parentComponent.ctx.deactivate(vnode);
4246
+ return;
4247
+ }
4248
+ const shouldInvokeDirs = shapeFlag & 1 && dirs;
4249
+ const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
4250
+ let vnodeHook;
4251
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
4252
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
4253
+ }
4254
+ if (shapeFlag & 6) {
4255
+ unmountComponent(vnode.component, parentSuspense, doRemove);
4256
+ } else {
4257
+ if (shapeFlag & 128) {
4258
+ vnode.suspense.unmount(parentSuspense, doRemove);
4259
+ return;
4260
+ }
4261
+ if (shouldInvokeDirs) {
4262
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
4263
+ }
4264
+ if (shapeFlag & 64) {
4265
+ vnode.type.remove(
4266
+ vnode,
4267
+ parentComponent,
4268
+ parentSuspense,
4269
+ optimized,
4270
+ internals,
4271
+ doRemove
4272
+ );
4273
+ } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
4274
+ (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
4275
+ unmountChildren(
4276
+ dynamicChildren,
4277
+ parentComponent,
4278
+ parentSuspense,
4279
+ false,
4280
+ true
4281
+ );
4282
+ } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
4283
+ unmountChildren(children, parentComponent, parentSuspense);
4284
+ }
4285
+ if (doRemove) {
4286
+ remove(vnode);
4287
+ }
4288
+ }
4289
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
4290
+ queuePostRenderEffect(() => {
4291
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4292
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4293
+ }, parentSuspense);
4294
+ }
4295
+ };
4296
+ const remove = (vnode) => {
4297
+ const { type, el, anchor, transition } = vnode;
4298
+ if (type === Fragment) {
4299
+ {
4300
+ removeFragment(el, anchor);
4301
+ }
4302
+ return;
4303
+ }
4304
+ if (type === Static) {
4305
+ removeStaticNode(vnode);
4306
+ return;
4307
+ }
4308
+ const performRemove = () => {
4309
+ hostRemove(el);
4310
+ if (transition && !transition.persisted && transition.afterLeave) {
4311
+ transition.afterLeave();
4312
+ }
4313
+ };
4314
+ if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
4315
+ const { leave, delayLeave } = transition;
4316
+ const performLeave = () => leave(el, performRemove);
4317
+ if (delayLeave) {
4318
+ delayLeave(vnode.el, performRemove, performLeave);
4319
+ } else {
4320
+ performLeave();
4321
+ }
4322
+ } else {
4323
+ performRemove();
4324
+ }
4325
+ };
4326
+ const removeFragment = (cur, end) => {
4327
+ let next;
4328
+ while (cur !== end) {
4329
+ next = hostNextSibling(cur);
4330
+ hostRemove(cur);
4331
+ cur = next;
4332
+ }
4333
+ hostRemove(end);
4334
+ };
4335
+ const unmountComponent = (instance, parentSuspense, doRemove) => {
4336
+ const { bum, scope, update, subTree, um, m, a } = instance;
4337
+ invalidateMount(m);
4338
+ invalidateMount(a);
4339
+ if (bum) {
4340
+ shared.invokeArrayFns(bum);
4341
+ }
4342
+ scope.stop();
4343
+ if (update) {
4344
+ update.active = false;
4345
+ unmount(subTree, instance, parentSuspense, doRemove);
4346
+ }
4347
+ if (um) {
4348
+ queuePostRenderEffect(um, parentSuspense);
4349
+ }
4350
+ queuePostRenderEffect(() => {
4351
+ instance.isUnmounted = true;
4352
+ }, parentSuspense);
4353
+ if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
4354
+ parentSuspense.deps--;
4355
+ if (parentSuspense.deps === 0) {
4356
+ parentSuspense.resolve();
4357
+ }
4358
+ }
4359
+ };
4360
+ const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
4361
+ for (let i = start; i < children.length; i++) {
4362
+ unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
4363
+ }
4364
+ };
4365
+ const getNextHostNode = (vnode) => {
4366
+ if (vnode.shapeFlag & 6) {
4367
+ return getNextHostNode(vnode.component.subTree);
4368
+ }
4369
+ if (vnode.shapeFlag & 128) {
4370
+ return vnode.suspense.next();
4371
+ }
4372
+ return hostNextSibling(vnode.anchor || vnode.el);
4373
+ };
4374
+ let isFlushing = false;
4375
+ const render = (vnode, container, namespace) => {
4376
+ if (vnode == null) {
4377
+ if (container._vnode) {
4378
+ unmount(container._vnode, null, null, true);
4379
+ }
4380
+ } else {
4381
+ patch(
4382
+ container._vnode || null,
4383
+ vnode,
4384
+ container,
4385
+ null,
4386
+ null,
4387
+ null,
4388
+ namespace
4389
+ );
4390
+ }
4391
+ if (!isFlushing) {
4392
+ isFlushing = true;
4393
+ flushPreFlushCbs();
4394
+ flushPostFlushCbs();
4395
+ isFlushing = false;
4396
+ }
4397
+ container._vnode = vnode;
4398
+ };
4399
+ const internals = {
4400
+ p: patch,
4401
+ um: unmount,
4402
+ m: move,
4403
+ r: remove,
4404
+ mt: mountComponent,
4405
+ mc: mountChildren,
4406
+ pc: patchChildren,
4407
+ pbc: patchBlockChildren,
4408
+ n: getNextHostNode,
4409
+ o: options
4410
+ };
4411
+ let hydrate;
4412
+ let hydrateNode;
4413
+ if (createHydrationFns) {
4414
+ [hydrate, hydrateNode] = createHydrationFns(
4415
+ internals
4416
+ );
4417
+ }
4418
+ return {
4419
+ render,
4420
+ hydrate,
4421
+ createApp: createAppAPI(render, hydrate)
4422
+ };
4423
+ }
4424
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
4425
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
4426
+ }
4427
+ function toggleRecurse({ effect, update }, allowed) {
4428
+ effect.allowRecurse = update.allowRecurse = allowed;
4429
+ }
4430
+ function needTransition(parentSuspense, transition) {
4431
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
4432
+ }
4433
+ function traverseStaticChildren(n1, n2, shallow = false) {
4434
+ const ch1 = n1.children;
4435
+ const ch2 = n2.children;
4436
+ if (shared.isArray(ch1) && shared.isArray(ch2)) {
4437
+ for (let i = 0; i < ch1.length; i++) {
4438
+ const c1 = ch1[i];
4439
+ let c2 = ch2[i];
4440
+ if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
4441
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
4442
+ c2 = ch2[i] = cloneIfMounted(ch2[i]);
4443
+ c2.el = c1.el;
4444
+ }
4445
+ if (!shallow && c2.patchFlag !== -2)
4446
+ traverseStaticChildren(c1, c2);
4447
+ }
4448
+ if (c2.type === Text) {
4449
+ c2.el = c1.el;
4450
+ }
4451
+ }
4452
+ }
4453
+ }
4454
+ function getSequence(arr) {
4455
+ const p = arr.slice();
4456
+ const result = [0];
4457
+ let i, j, u, v, c;
4458
+ const len = arr.length;
4459
+ for (i = 0; i < len; i++) {
4460
+ const arrI = arr[i];
4461
+ if (arrI !== 0) {
4462
+ j = result[result.length - 1];
4463
+ if (arr[j] < arrI) {
4464
+ p[i] = j;
4465
+ result.push(i);
4466
+ continue;
4467
+ }
4468
+ u = 0;
4469
+ v = result.length - 1;
4470
+ while (u < v) {
4471
+ c = u + v >> 1;
4472
+ if (arr[result[c]] < arrI) {
4473
+ u = c + 1;
4474
+ } else {
4475
+ v = c;
4476
+ }
4477
+ }
4478
+ if (arrI < arr[result[u]]) {
4479
+ if (u > 0) {
4480
+ p[i] = result[u - 1];
4481
+ }
4482
+ result[u] = i;
4483
+ }
4484
+ }
4485
+ }
4486
+ u = result.length;
4487
+ v = result[u - 1];
4488
+ while (u-- > 0) {
4489
+ result[u] = v;
4490
+ v = p[v];
4491
+ }
4492
+ return result;
4493
+ }
4494
+ function locateNonHydratedAsyncRoot(instance) {
4495
+ const subComponent = instance.subTree.component;
4496
+ if (subComponent) {
4497
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
4498
+ return subComponent;
4499
+ } else {
4500
+ return locateNonHydratedAsyncRoot(subComponent);
4501
+ }
4502
+ }
4503
+ }
4504
+ function invalidateMount(hooks) {
4505
+ if (hooks) {
4506
+ for (let i = 0; i < hooks.length; i++) hooks[i].active = false;
4507
+ }
4508
+ }
4509
+
4510
+ const ssrContextKey = Symbol.for("v-scx");
4511
+ const useSSRContext = () => {
4512
+ {
4513
+ const ctx = inject(ssrContextKey);
4514
+ return ctx;
4515
+ }
4516
+ };
4517
+
4518
+ function watchEffect(effect, options) {
4519
+ return doWatch(effect, null, options);
4520
+ }
4521
+ function watchPostEffect(effect, options) {
4522
+ return doWatch(
4523
+ effect,
4524
+ null,
4525
+ { flush: "post" }
4526
+ );
4527
+ }
4528
+ function watchSyncEffect(effect, options) {
4529
+ return doWatch(
4530
+ effect,
4531
+ null,
4532
+ { flush: "sync" }
4533
+ );
4534
+ }
4535
+ const INITIAL_WATCHER_VALUE = {};
4536
+ function watch(source, cb, options) {
4537
+ return doWatch(source, cb, options);
4538
+ }
4539
+ function doWatch(source, cb, {
4540
+ immediate,
4541
+ deep,
4542
+ flush,
4543
+ once,
4544
+ onTrack,
4545
+ onTrigger
4546
+ } = shared.EMPTY_OBJ) {
4547
+ if (cb && once) {
4548
+ const _cb = cb;
4549
+ cb = (...args) => {
4550
+ _cb(...args);
4551
+ unwatch();
4552
+ };
4553
+ }
4554
+ const instance = currentInstance;
4555
+ const reactiveGetter = (source2) => deep === true ? source2 : (
4556
+ // for deep: false, only traverse root-level properties
4557
+ traverse(source2, deep === false ? 1 : void 0)
4558
+ );
4559
+ let getter;
4560
+ let forceTrigger = false;
4561
+ let isMultiSource = false;
4562
+ if (reactivity.isRef(source)) {
4563
+ getter = () => source.value;
4564
+ forceTrigger = reactivity.isShallow(source);
4565
+ } else if (reactivity.isReactive(source)) {
4566
+ getter = () => reactiveGetter(source);
4567
+ forceTrigger = true;
4568
+ } else if (shared.isArray(source)) {
4569
+ isMultiSource = true;
4570
+ forceTrigger = source.some((s) => reactivity.isReactive(s) || reactivity.isShallow(s));
4571
+ getter = () => source.map((s) => {
4572
+ if (reactivity.isRef(s)) {
4573
+ return s.value;
4574
+ } else if (reactivity.isReactive(s)) {
4575
+ return reactiveGetter(s);
4576
+ } else if (shared.isFunction(s)) {
4577
+ return callWithErrorHandling(s, instance, 2);
4578
+ } else ;
4579
+ });
4580
+ } else if (shared.isFunction(source)) {
4581
+ if (cb) {
4582
+ getter = () => callWithErrorHandling(source, instance, 2);
4583
+ } else {
4584
+ getter = () => {
4585
+ if (cleanup) {
4586
+ cleanup();
4587
+ }
4588
+ return callWithAsyncErrorHandling(
4589
+ source,
4590
+ instance,
4591
+ 3,
4592
+ [onCleanup]
4593
+ );
4594
+ };
4595
+ }
4596
+ } else {
4597
+ getter = shared.NOOP;
4598
+ }
4599
+ if (cb && deep) {
4600
+ const baseGetter = getter;
4601
+ getter = () => traverse(baseGetter());
4602
+ }
4603
+ let cleanup;
4604
+ let onCleanup = (fn) => {
4605
+ cleanup = effect.onStop = () => {
4606
+ callWithErrorHandling(fn, instance, 4);
4607
+ cleanup = effect.onStop = void 0;
4608
+ };
4609
+ };
4610
+ let ssrCleanup;
4611
+ if (isInSSRComponentSetup) {
4612
+ onCleanup = shared.NOOP;
4613
+ if (!cb) {
4614
+ getter();
4615
+ } else if (immediate) {
4616
+ callWithAsyncErrorHandling(cb, instance, 3, [
4617
+ getter(),
4618
+ isMultiSource ? [] : void 0,
4619
+ onCleanup
4620
+ ]);
4621
+ }
4622
+ if (flush === "sync") {
4623
+ const ctx = useSSRContext();
4624
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
4625
+ } else {
4626
+ return shared.NOOP;
4627
+ }
4628
+ }
4629
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
4630
+ const job = () => {
4631
+ if (!effect.active || !effect.dirty) {
4632
+ return;
4633
+ }
4634
+ if (cb) {
4635
+ const newValue = effect.run();
4636
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
4637
+ if (cleanup) {
4638
+ cleanup();
4639
+ }
4640
+ callWithAsyncErrorHandling(cb, instance, 3, [
4641
+ newValue,
4642
+ // pass undefined as the old value when it's changed for the first time
4643
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
4644
+ onCleanup
4645
+ ]);
4646
+ oldValue = newValue;
4647
+ }
4648
+ } else {
4649
+ effect.run();
4650
+ }
4651
+ };
4652
+ job.allowRecurse = !!cb;
4653
+ let scheduler;
4654
+ if (flush === "sync") {
4655
+ scheduler = job;
4656
+ } else if (flush === "post") {
4657
+ scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
4658
+ } else {
4659
+ job.pre = true;
4660
+ if (instance) job.id = instance.uid;
4661
+ scheduler = () => queueJob(job);
4662
+ }
4663
+ const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
4664
+ const scope = reactivity.getCurrentScope();
4665
+ const unwatch = () => {
4666
+ effect.stop();
4667
+ if (scope) {
4668
+ shared.remove(scope.effects, effect);
4669
+ }
4670
+ };
4671
+ if (cb) {
4672
+ if (immediate) {
4673
+ job();
4674
+ } else {
4675
+ oldValue = effect.run();
4676
+ }
4677
+ } else if (flush === "post") {
4678
+ queuePostRenderEffect(
4679
+ effect.run.bind(effect),
4680
+ instance && instance.suspense
4681
+ );
4682
+ } else {
4683
+ effect.run();
4684
+ }
4685
+ if (ssrCleanup) ssrCleanup.push(unwatch);
4686
+ return unwatch;
4687
+ }
4688
+ function instanceWatch(source, value, options) {
4689
+ const publicThis = this.proxy;
4690
+ const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
4691
+ let cb;
4692
+ if (shared.isFunction(value)) {
4693
+ cb = value;
4694
+ } else {
4695
+ cb = value.handler;
4696
+ options = value;
4697
+ }
4698
+ const reset = setCurrentInstance(this);
4699
+ const res = doWatch(getter, cb.bind(publicThis), options);
4700
+ reset();
4701
+ return res;
4702
+ }
4703
+ function createPathGetter(ctx, path) {
4704
+ const segments = path.split(".");
4705
+ return () => {
4706
+ let cur = ctx;
4707
+ for (let i = 0; i < segments.length && cur; i++) {
4708
+ cur = cur[segments[i]];
4709
+ }
4710
+ return cur;
4711
+ };
4712
+ }
4713
+ function traverse(value, depth = Infinity, seen) {
4714
+ if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
4715
+ return value;
4716
+ }
4717
+ seen = seen || /* @__PURE__ */ new Set();
4718
+ if (seen.has(value)) {
4719
+ return value;
4720
+ }
4721
+ seen.add(value);
4722
+ depth--;
4723
+ if (reactivity.isRef(value)) {
4724
+ traverse(value.value, depth, seen);
4725
+ } else if (shared.isArray(value)) {
4726
+ for (let i = 0; i < value.length; i++) {
4727
+ traverse(value[i], depth, seen);
4728
+ }
4729
+ } else if (shared.isSet(value) || shared.isMap(value)) {
4730
+ value.forEach((v) => {
4731
+ traverse(v, depth, seen);
4732
+ });
4733
+ } else if (shared.isPlainObject(value)) {
4734
+ for (const key in value) {
4735
+ traverse(value[key], depth, seen);
4736
+ }
4737
+ for (const key of Object.getOwnPropertySymbols(value)) {
4738
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
4739
+ traverse(value[key], depth, seen);
4783
4740
  }
4784
4741
  }
4785
- };
4786
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4787
- c1 = c1 || shared.EMPTY_ARR;
4788
- c2 = c2 || shared.EMPTY_ARR;
4789
- const oldLength = c1.length;
4790
- const newLength = c2.length;
4791
- const commonLength = Math.min(oldLength, newLength);
4792
- let i;
4793
- for (i = 0; i < commonLength; i++) {
4794
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4795
- patch(
4796
- c1[i],
4797
- nextChild,
4798
- container,
4799
- null,
4800
- parentComponent,
4801
- parentSuspense,
4802
- namespace,
4803
- slotScopeIds,
4804
- optimized
4805
- );
4742
+ }
4743
+ return value;
4744
+ }
4745
+
4746
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
4747
+ const KeepAliveImpl = {
4748
+ name: `KeepAlive`,
4749
+ // Marker for special handling inside the renderer. We are not using a ===
4750
+ // check directly on KeepAlive in the renderer, because importing it directly
4751
+ // would prevent it from being tree-shaken.
4752
+ __isKeepAlive: true,
4753
+ props: {
4754
+ include: [String, RegExp, Array],
4755
+ exclude: [String, RegExp, Array],
4756
+ max: [String, Number]
4757
+ },
4758
+ setup(props, { slots }) {
4759
+ const instance = getCurrentInstance();
4760
+ const sharedContext = instance.ctx;
4761
+ if (!sharedContext.renderer) {
4762
+ return () => {
4763
+ const children = slots.default && slots.default();
4764
+ return children && children.length === 1 ? children[0] : children;
4765
+ };
4806
4766
  }
4807
- if (oldLength > newLength) {
4808
- unmountChildren(
4809
- c1,
4810
- parentComponent,
4811
- parentSuspense,
4812
- true,
4813
- false,
4814
- commonLength
4815
- );
4816
- } else {
4817
- mountChildren(
4818
- c2,
4767
+ const cache = /* @__PURE__ */ new Map();
4768
+ const keys = /* @__PURE__ */ new Set();
4769
+ let current = null;
4770
+ const parentSuspense = instance.suspense;
4771
+ const {
4772
+ renderer: {
4773
+ p: patch,
4774
+ m: move,
4775
+ um: _unmount,
4776
+ o: { createElement }
4777
+ }
4778
+ } = sharedContext;
4779
+ const storageContainer = createElement("div");
4780
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4781
+ const instance2 = vnode.component;
4782
+ move(vnode, container, anchor, 0, parentSuspense);
4783
+ patch(
4784
+ instance2.vnode,
4785
+ vnode,
4819
4786
  container,
4820
4787
  anchor,
4821
- parentComponent,
4788
+ instance2,
4822
4789
  parentSuspense,
4823
4790
  namespace,
4824
- slotScopeIds,
4825
- optimized,
4826
- commonLength
4791
+ vnode.slotScopeIds,
4792
+ optimized
4827
4793
  );
4828
- }
4829
- };
4830
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4831
- let i = 0;
4832
- const l2 = c2.length;
4833
- let e1 = c1.length - 1;
4834
- let e2 = l2 - 1;
4835
- while (i <= e1 && i <= e2) {
4836
- const n1 = c1[i];
4837
- const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4838
- if (isSameVNodeType(n1, n2)) {
4839
- patch(
4840
- n1,
4841
- n2,
4842
- container,
4843
- null,
4844
- parentComponent,
4845
- parentSuspense,
4846
- namespace,
4847
- slotScopeIds,
4848
- optimized
4849
- );
4850
- } else {
4851
- break;
4852
- }
4853
- i++;
4854
- }
4855
- while (i <= e1 && i <= e2) {
4856
- const n1 = c1[e1];
4857
- const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
4858
- if (isSameVNodeType(n1, n2)) {
4859
- patch(
4860
- n1,
4861
- n2,
4862
- container,
4863
- null,
4864
- parentComponent,
4865
- parentSuspense,
4866
- namespace,
4867
- slotScopeIds,
4868
- optimized
4869
- );
4870
- } else {
4871
- break;
4872
- }
4873
- e1--;
4874
- e2--;
4875
- }
4876
- if (i > e1) {
4877
- if (i <= e2) {
4878
- const nextPos = e2 + 1;
4879
- const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
4880
- while (i <= e2) {
4881
- patch(
4882
- null,
4883
- c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
4884
- container,
4885
- anchor,
4886
- parentComponent,
4887
- parentSuspense,
4888
- namespace,
4889
- slotScopeIds,
4890
- optimized
4891
- );
4892
- i++;
4893
- }
4894
- }
4895
- } else if (i > e2) {
4896
- while (i <= e1) {
4897
- unmount(c1[i], parentComponent, parentSuspense, true);
4898
- i++;
4899
- }
4900
- } else {
4901
- const s1 = i;
4902
- const s2 = i;
4903
- const keyToNewIndexMap = /* @__PURE__ */ new Map();
4904
- for (i = s2; i <= e2; i++) {
4905
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4906
- if (nextChild.key != null) {
4907
- keyToNewIndexMap.set(nextChild.key, i);
4908
- }
4909
- }
4910
- let j;
4911
- let patched = 0;
4912
- const toBePatched = e2 - s2 + 1;
4913
- let moved = false;
4914
- let maxNewIndexSoFar = 0;
4915
- const newIndexToOldIndexMap = new Array(toBePatched);
4916
- for (i = 0; i < toBePatched; i++)
4917
- newIndexToOldIndexMap[i] = 0;
4918
- for (i = s1; i <= e1; i++) {
4919
- const prevChild = c1[i];
4920
- if (patched >= toBePatched) {
4921
- unmount(prevChild, parentComponent, parentSuspense, true);
4922
- continue;
4923
- }
4924
- let newIndex;
4925
- if (prevChild.key != null) {
4926
- newIndex = keyToNewIndexMap.get(prevChild.key);
4927
- } else {
4928
- for (j = s2; j <= e2; j++) {
4929
- if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
4930
- newIndex = j;
4931
- break;
4932
- }
4933
- }
4794
+ queuePostRenderEffect(() => {
4795
+ instance2.isDeactivated = false;
4796
+ if (instance2.a) {
4797
+ shared.invokeArrayFns(instance2.a);
4934
4798
  }
4935
- if (newIndex === void 0) {
4936
- unmount(prevChild, parentComponent, parentSuspense, true);
4937
- } else {
4938
- newIndexToOldIndexMap[newIndex - s2] = i + 1;
4939
- if (newIndex >= maxNewIndexSoFar) {
4940
- maxNewIndexSoFar = newIndex;
4941
- } else {
4942
- moved = true;
4943
- }
4944
- patch(
4945
- prevChild,
4946
- c2[newIndex],
4947
- container,
4948
- null,
4949
- parentComponent,
4950
- parentSuspense,
4951
- namespace,
4952
- slotScopeIds,
4953
- optimized
4954
- );
4955
- patched++;
4799
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4800
+ if (vnodeHook) {
4801
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4956
4802
  }
4957
- }
4958
- const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
4959
- j = increasingNewIndexSequence.length - 1;
4960
- for (i = toBePatched - 1; i >= 0; i--) {
4961
- const nextIndex = s2 + i;
4962
- const nextChild = c2[nextIndex];
4963
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
4964
- if (newIndexToOldIndexMap[i] === 0) {
4965
- patch(
4966
- null,
4967
- nextChild,
4968
- container,
4969
- anchor,
4970
- parentComponent,
4971
- parentSuspense,
4972
- namespace,
4973
- slotScopeIds,
4974
- optimized
4975
- );
4976
- } else if (moved) {
4977
- if (j < 0 || i !== increasingNewIndexSequence[j]) {
4978
- move(nextChild, container, anchor, 2);
4979
- } else {
4980
- j--;
4981
- }
4803
+ }, parentSuspense);
4804
+ };
4805
+ sharedContext.deactivate = (vnode) => {
4806
+ const instance2 = vnode.component;
4807
+ invalidateMount(instance2.m);
4808
+ invalidateMount(instance2.a);
4809
+ move(vnode, storageContainer, null, 1, parentSuspense);
4810
+ queuePostRenderEffect(() => {
4811
+ if (instance2.da) {
4812
+ shared.invokeArrayFns(instance2.da);
4982
4813
  }
4983
- }
4984
- }
4985
- };
4986
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
4987
- const { el, type, transition, children, shapeFlag } = vnode;
4988
- if (shapeFlag & 6) {
4989
- move(vnode.component.subTree, container, anchor, moveType);
4990
- return;
4991
- }
4992
- if (shapeFlag & 128) {
4993
- vnode.suspense.move(container, anchor, moveType);
4994
- return;
4814
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4815
+ if (vnodeHook) {
4816
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4817
+ }
4818
+ instance2.isDeactivated = true;
4819
+ }, parentSuspense);
4820
+ };
4821
+ function unmount(vnode) {
4822
+ resetShapeFlag(vnode);
4823
+ _unmount(vnode, instance, parentSuspense, true);
4995
4824
  }
4996
- if (shapeFlag & 64) {
4997
- type.move(vnode, container, anchor, internals);
4998
- return;
4825
+ function pruneCache(filter) {
4826
+ cache.forEach((vnode, key) => {
4827
+ const name = getComponentName(vnode.type);
4828
+ if (name && (!filter || !filter(name))) {
4829
+ pruneCacheEntry(key);
4830
+ }
4831
+ });
4999
4832
  }
5000
- if (type === Fragment) {
5001
- hostInsert(el, container, anchor);
5002
- for (let i = 0; i < children.length; i++) {
5003
- move(children[i], container, anchor, moveType);
4833
+ function pruneCacheEntry(key) {
4834
+ const cached = cache.get(key);
4835
+ if (!current || !isSameVNodeType(cached, current)) {
4836
+ unmount(cached);
4837
+ } else if (current) {
4838
+ resetShapeFlag(current);
5004
4839
  }
5005
- hostInsert(vnode.anchor, container, anchor);
5006
- return;
5007
- }
5008
- if (type === Static) {
5009
- moveStaticNode(vnode, container, anchor);
5010
- return;
4840
+ cache.delete(key);
4841
+ keys.delete(key);
5011
4842
  }
5012
- const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
5013
- if (needTransition2) {
5014
- if (moveType === 0) {
5015
- transition.beforeEnter(el);
5016
- hostInsert(el, container, anchor);
5017
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5018
- } else {
5019
- const { leave, delayLeave, afterLeave } = transition;
5020
- const remove2 = () => hostInsert(el, container, anchor);
5021
- const performLeave = () => {
5022
- leave(el, () => {
5023
- remove2();
5024
- afterLeave && afterLeave();
5025
- });
5026
- };
5027
- if (delayLeave) {
5028
- delayLeave(el, remove2, performLeave);
4843
+ watch(
4844
+ () => [props.include, props.exclude],
4845
+ ([include, exclude]) => {
4846
+ include && pruneCache((name) => matches(include, name));
4847
+ exclude && pruneCache((name) => !matches(exclude, name));
4848
+ },
4849
+ // prune post-render after `current` has been updated
4850
+ { flush: "post", deep: true }
4851
+ );
4852
+ let pendingCacheKey = null;
4853
+ const cacheSubtree = () => {
4854
+ if (pendingCacheKey != null) {
4855
+ if (isSuspense(instance.subTree.type)) {
4856
+ queuePostRenderEffect(() => {
4857
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4858
+ }, instance.subTree.suspense);
5029
4859
  } else {
5030
- performLeave();
4860
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5031
4861
  }
5032
4862
  }
5033
- } else {
5034
- hostInsert(el, container, anchor);
5035
- }
5036
- };
5037
- const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
5038
- const {
5039
- type,
5040
- props,
5041
- ref,
5042
- children,
5043
- dynamicChildren,
5044
- shapeFlag,
5045
- patchFlag,
5046
- dirs
5047
- } = vnode;
5048
- if (ref != null) {
5049
- setRef(ref, null, parentSuspense, vnode, true);
5050
- }
5051
- if (shapeFlag & 256) {
5052
- parentComponent.ctx.deactivate(vnode);
5053
- return;
5054
- }
5055
- const shouldInvokeDirs = shapeFlag & 1 && dirs;
5056
- const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
5057
- let vnodeHook;
5058
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
5059
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
5060
- }
5061
- if (shapeFlag & 6) {
5062
- unmountComponent(vnode.component, parentSuspense, doRemove);
5063
- } else {
5064
- if (shapeFlag & 128) {
5065
- vnode.suspense.unmount(parentSuspense, doRemove);
5066
- return;
4863
+ };
4864
+ onMounted(cacheSubtree);
4865
+ onUpdated(cacheSubtree);
4866
+ onBeforeUnmount(() => {
4867
+ cache.forEach((cached) => {
4868
+ const { subTree, suspense } = instance;
4869
+ const vnode = getInnerChild(subTree);
4870
+ if (cached.type === vnode.type && cached.key === vnode.key) {
4871
+ resetShapeFlag(vnode);
4872
+ const da = vnode.component.da;
4873
+ da && queuePostRenderEffect(da, suspense);
4874
+ return;
4875
+ }
4876
+ unmount(cached);
4877
+ });
4878
+ });
4879
+ return () => {
4880
+ pendingCacheKey = null;
4881
+ if (!slots.default) {
4882
+ return null;
5067
4883
  }
5068
- if (shouldInvokeDirs) {
5069
- invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
4884
+ const children = slots.default();
4885
+ const rawVNode = children[0];
4886
+ if (children.length > 1) {
4887
+ current = null;
4888
+ return children;
4889
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
4890
+ current = null;
4891
+ return rawVNode;
5070
4892
  }
5071
- if (shapeFlag & 64) {
5072
- vnode.type.remove(
5073
- vnode,
5074
- parentComponent,
5075
- parentSuspense,
5076
- optimized,
5077
- internals,
5078
- doRemove
5079
- );
5080
- } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
5081
- (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
5082
- unmountChildren(
5083
- dynamicChildren,
5084
- parentComponent,
5085
- parentSuspense,
5086
- false,
5087
- true
5088
- );
5089
- } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
5090
- unmountChildren(children, parentComponent, parentSuspense);
4893
+ let vnode = getInnerChild(rawVNode);
4894
+ const comp = vnode.type;
4895
+ const name = getComponentName(
4896
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
4897
+ );
4898
+ const { include, exclude, max } = props;
4899
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4900
+ current = vnode;
4901
+ return rawVNode;
5091
4902
  }
5092
- if (doRemove) {
5093
- remove(vnode);
4903
+ const key = vnode.key == null ? comp : vnode.key;
4904
+ const cachedVNode = cache.get(key);
4905
+ if (vnode.el) {
4906
+ vnode = cloneVNode(vnode);
4907
+ if (rawVNode.shapeFlag & 128) {
4908
+ rawVNode.ssContent = vnode;
4909
+ }
4910
+ }
4911
+ pendingCacheKey = key;
4912
+ if (cachedVNode) {
4913
+ vnode.el = cachedVNode.el;
4914
+ vnode.component = cachedVNode.component;
4915
+ if (vnode.transition) {
4916
+ setTransitionHooks(vnode, vnode.transition);
4917
+ }
4918
+ vnode.shapeFlag |= 512;
4919
+ keys.delete(key);
4920
+ keys.add(key);
4921
+ } else {
4922
+ keys.add(key);
4923
+ if (max && keys.size > parseInt(max, 10)) {
4924
+ pruneCacheEntry(keys.values().next().value);
4925
+ }
4926
+ }
4927
+ vnode.shapeFlag |= 256;
4928
+ current = vnode;
4929
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
4930
+ };
4931
+ }
4932
+ };
4933
+ const KeepAlive = KeepAliveImpl;
4934
+ function matches(pattern, name) {
4935
+ if (shared.isArray(pattern)) {
4936
+ return pattern.some((p) => matches(p, name));
4937
+ } else if (shared.isString(pattern)) {
4938
+ return pattern.split(",").includes(name);
4939
+ } else if (shared.isRegExp(pattern)) {
4940
+ return pattern.test(name);
4941
+ }
4942
+ return false;
4943
+ }
4944
+ function onActivated(hook, target) {
4945
+ registerKeepAliveHook(hook, "a", target);
4946
+ }
4947
+ function onDeactivated(hook, target) {
4948
+ registerKeepAliveHook(hook, "da", target);
4949
+ }
4950
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
4951
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4952
+ let current = target;
4953
+ while (current) {
4954
+ if (current.isDeactivated) {
4955
+ return;
5094
4956
  }
4957
+ current = current.parent;
5095
4958
  }
5096
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5097
- queuePostRenderEffect(() => {
5098
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5099
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5100
- }, parentSuspense);
4959
+ return hook();
4960
+ });
4961
+ injectHook(type, wrappedHook, target);
4962
+ if (target) {
4963
+ let current = target.parent;
4964
+ while (current && current.parent) {
4965
+ if (isKeepAlive(current.parent.vnode)) {
4966
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
4967
+ }
4968
+ current = current.parent;
5101
4969
  }
4970
+ }
4971
+ }
4972
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4973
+ const injected = injectHook(
4974
+ type,
4975
+ hook,
4976
+ keepAliveRoot,
4977
+ true
4978
+ /* prepend */
4979
+ );
4980
+ onUnmounted(() => {
4981
+ shared.remove(keepAliveRoot[type], injected);
4982
+ }, target);
4983
+ }
4984
+ function resetShapeFlag(vnode) {
4985
+ vnode.shapeFlag &= ~256;
4986
+ vnode.shapeFlag &= ~512;
4987
+ }
4988
+ function getInnerChild(vnode) {
4989
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
4990
+ }
4991
+
4992
+ const leaveCbKey = Symbol("_leaveCb");
4993
+ const enterCbKey = Symbol("_enterCb");
4994
+ function useTransitionState() {
4995
+ const state = {
4996
+ isMounted: false,
4997
+ isLeaving: false,
4998
+ isUnmounting: false,
4999
+ leavingVNodes: /* @__PURE__ */ new Map()
5102
5000
  };
5103
- const remove = (vnode) => {
5104
- const { type, el, anchor, transition } = vnode;
5105
- if (type === Fragment) {
5106
- {
5107
- removeFragment(el, anchor);
5001
+ onMounted(() => {
5002
+ state.isMounted = true;
5003
+ });
5004
+ onBeforeUnmount(() => {
5005
+ state.isUnmounting = true;
5006
+ });
5007
+ return state;
5008
+ }
5009
+ const TransitionHookValidator = [Function, Array];
5010
+ const BaseTransitionPropsValidators = {
5011
+ mode: String,
5012
+ appear: Boolean,
5013
+ persisted: Boolean,
5014
+ // enter
5015
+ onBeforeEnter: TransitionHookValidator,
5016
+ onEnter: TransitionHookValidator,
5017
+ onAfterEnter: TransitionHookValidator,
5018
+ onEnterCancelled: TransitionHookValidator,
5019
+ // leave
5020
+ onBeforeLeave: TransitionHookValidator,
5021
+ onLeave: TransitionHookValidator,
5022
+ onAfterLeave: TransitionHookValidator,
5023
+ onLeaveCancelled: TransitionHookValidator,
5024
+ // appear
5025
+ onBeforeAppear: TransitionHookValidator,
5026
+ onAppear: TransitionHookValidator,
5027
+ onAfterAppear: TransitionHookValidator,
5028
+ onAppearCancelled: TransitionHookValidator
5029
+ };
5030
+ const recursiveGetSubtree = (instance) => {
5031
+ const subTree = instance.subTree;
5032
+ return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
5033
+ };
5034
+ const BaseTransitionImpl = {
5035
+ name: `BaseTransition`,
5036
+ props: BaseTransitionPropsValidators,
5037
+ setup(props, { slots }) {
5038
+ const instance = getCurrentInstance();
5039
+ const state = useTransitionState();
5040
+ return () => {
5041
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
5042
+ if (!children || !children.length) {
5043
+ return;
5108
5044
  }
5109
- return;
5110
- }
5111
- if (type === Static) {
5112
- removeStaticNode(vnode);
5113
- return;
5114
- }
5115
- const performRemove = () => {
5116
- hostRemove(el);
5117
- if (transition && !transition.persisted && transition.afterLeave) {
5118
- transition.afterLeave();
5045
+ let child = children[0];
5046
+ if (children.length > 1) {
5047
+ for (const c of children) {
5048
+ if (c.type !== Comment) {
5049
+ child = c;
5050
+ break;
5051
+ }
5052
+ }
5119
5053
  }
5120
- };
5121
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
5122
- const { leave, delayLeave } = transition;
5123
- const performLeave = () => leave(el, performRemove);
5124
- if (delayLeave) {
5125
- delayLeave(vnode.el, performRemove, performLeave);
5126
- } else {
5127
- performLeave();
5054
+ const rawProps = reactivity.toRaw(props);
5055
+ const { mode } = rawProps;
5056
+ if (state.isLeaving) {
5057
+ return emptyPlaceholder(child);
5128
5058
  }
5129
- } else {
5130
- performRemove();
5131
- }
5132
- };
5133
- const removeFragment = (cur, end) => {
5134
- let next;
5135
- while (cur !== end) {
5136
- next = hostNextSibling(cur);
5137
- hostRemove(cur);
5138
- cur = next;
5139
- }
5140
- hostRemove(end);
5141
- };
5142
- const unmountComponent = (instance, parentSuspense, doRemove) => {
5143
- const { bum, scope, update, subTree, um } = instance;
5144
- if (bum) {
5145
- shared.invokeArrayFns(bum);
5146
- }
5147
- scope.stop();
5148
- if (update) {
5149
- update.active = false;
5150
- unmount(subTree, instance, parentSuspense, doRemove);
5151
- }
5152
- if (um) {
5153
- queuePostRenderEffect(um, parentSuspense);
5154
- }
5155
- queuePostRenderEffect(() => {
5156
- instance.isUnmounted = true;
5157
- }, parentSuspense);
5158
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
5159
- parentSuspense.deps--;
5160
- if (parentSuspense.deps === 0) {
5161
- parentSuspense.resolve();
5059
+ const innerChild = getKeepAliveChild(child);
5060
+ if (!innerChild) {
5061
+ return emptyPlaceholder(child);
5162
5062
  }
5163
- }
5164
- };
5165
- const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
5166
- for (let i = start; i < children.length; i++) {
5167
- unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
5168
- }
5169
- };
5170
- const getNextHostNode = (vnode) => {
5171
- if (vnode.shapeFlag & 6) {
5172
- return getNextHostNode(vnode.component.subTree);
5173
- }
5174
- if (vnode.shapeFlag & 128) {
5175
- return vnode.suspense.next();
5176
- }
5177
- return hostNextSibling(vnode.anchor || vnode.el);
5063
+ let enterHooks = resolveTransitionHooks(
5064
+ innerChild,
5065
+ rawProps,
5066
+ state,
5067
+ instance,
5068
+ // #11061, ensure enterHooks is fresh after clone
5069
+ (hooks) => enterHooks = hooks
5070
+ );
5071
+ setTransitionHooks(innerChild, enterHooks);
5072
+ const oldChild = instance.subTree;
5073
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
5074
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
5075
+ const leavingHooks = resolveTransitionHooks(
5076
+ oldInnerChild,
5077
+ rawProps,
5078
+ state,
5079
+ instance
5080
+ );
5081
+ setTransitionHooks(oldInnerChild, leavingHooks);
5082
+ if (mode === "out-in" && innerChild.type !== Comment) {
5083
+ state.isLeaving = true;
5084
+ leavingHooks.afterLeave = () => {
5085
+ state.isLeaving = false;
5086
+ if (instance.update.active !== false) {
5087
+ instance.effect.dirty = true;
5088
+ instance.update();
5089
+ }
5090
+ };
5091
+ return emptyPlaceholder(child);
5092
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
5093
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
5094
+ const leavingVNodesCache = getLeavingNodesForType(
5095
+ state,
5096
+ oldInnerChild
5097
+ );
5098
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
5099
+ el[leaveCbKey] = () => {
5100
+ earlyRemove();
5101
+ el[leaveCbKey] = void 0;
5102
+ delete enterHooks.delayedLeave;
5103
+ };
5104
+ enterHooks.delayedLeave = delayedLeave;
5105
+ };
5106
+ }
5107
+ }
5108
+ return child;
5109
+ };
5110
+ }
5111
+ };
5112
+ const BaseTransition = BaseTransitionImpl;
5113
+ function getLeavingNodesForType(state, vnode) {
5114
+ const { leavingVNodes } = state;
5115
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
5116
+ if (!leavingVNodesCache) {
5117
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
5118
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
5119
+ }
5120
+ return leavingVNodesCache;
5121
+ }
5122
+ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
5123
+ const {
5124
+ appear,
5125
+ mode,
5126
+ persisted = false,
5127
+ onBeforeEnter,
5128
+ onEnter,
5129
+ onAfterEnter,
5130
+ onEnterCancelled,
5131
+ onBeforeLeave,
5132
+ onLeave,
5133
+ onAfterLeave,
5134
+ onLeaveCancelled,
5135
+ onBeforeAppear,
5136
+ onAppear,
5137
+ onAfterAppear,
5138
+ onAppearCancelled
5139
+ } = props;
5140
+ const key = String(vnode.key);
5141
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
5142
+ const callHook = (hook, args) => {
5143
+ hook && callWithAsyncErrorHandling(
5144
+ hook,
5145
+ instance,
5146
+ 9,
5147
+ args
5148
+ );
5178
5149
  };
5179
- let isFlushing = false;
5180
- const render = (vnode, container, namespace) => {
5181
- if (vnode == null) {
5182
- if (container._vnode) {
5183
- unmount(container._vnode, null, null, true);
5184
- }
5185
- } else {
5186
- patch(
5187
- container._vnode || null,
5188
- vnode,
5189
- container,
5190
- null,
5191
- null,
5192
- null,
5193
- namespace
5194
- );
5195
- }
5196
- if (!isFlushing) {
5197
- isFlushing = true;
5198
- flushPreFlushCbs();
5199
- flushPostFlushCbs();
5200
- isFlushing = false;
5150
+ const callAsyncHook = (hook, args) => {
5151
+ const done = args[1];
5152
+ callHook(hook, args);
5153
+ if (shared.isArray(hook)) {
5154
+ if (hook.every((hook2) => hook2.length <= 1)) done();
5155
+ } else if (hook.length <= 1) {
5156
+ done();
5201
5157
  }
5202
- container._vnode = vnode;
5203
5158
  };
5204
- const internals = {
5205
- p: patch,
5206
- um: unmount,
5207
- m: move,
5208
- r: remove,
5209
- mt: mountComponent,
5210
- mc: mountChildren,
5211
- pc: patchChildren,
5212
- pbc: patchBlockChildren,
5213
- n: getNextHostNode,
5214
- o: options
5215
- };
5216
- let hydrate;
5217
- let hydrateNode;
5218
- if (createHydrationFns) {
5219
- [hydrate, hydrateNode] = createHydrationFns(
5220
- internals
5221
- );
5222
- }
5223
- return {
5224
- render,
5225
- hydrate,
5226
- createApp: createAppAPI(render, hydrate)
5227
- };
5228
- }
5229
- function resolveChildrenNamespace({ type, props }, currentNamespace) {
5230
- return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5231
- }
5232
- function toggleRecurse({ effect, update }, allowed) {
5233
- effect.allowRecurse = update.allowRecurse = allowed;
5234
- }
5235
- function needTransition(parentSuspense, transition) {
5236
- return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
5237
- }
5238
- function traverseStaticChildren(n1, n2, shallow = false) {
5239
- const ch1 = n1.children;
5240
- const ch2 = n2.children;
5241
- if (shared.isArray(ch1) && shared.isArray(ch2)) {
5242
- for (let i = 0; i < ch1.length; i++) {
5243
- const c1 = ch1[i];
5244
- let c2 = ch2[i];
5245
- if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
5246
- if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
5247
- c2 = ch2[i] = cloneIfMounted(ch2[i]);
5248
- c2.el = c1.el;
5159
+ const hooks = {
5160
+ mode,
5161
+ persisted,
5162
+ beforeEnter(el) {
5163
+ let hook = onBeforeEnter;
5164
+ if (!state.isMounted) {
5165
+ if (appear) {
5166
+ hook = onBeforeAppear || onBeforeEnter;
5167
+ } else {
5168
+ return;
5249
5169
  }
5250
- if (!shallow)
5251
- traverseStaticChildren(c1, c2);
5252
5170
  }
5253
- if (c2.type === Text) {
5254
- c2.el = c1.el;
5171
+ if (el[leaveCbKey]) {
5172
+ el[leaveCbKey](
5173
+ true
5174
+ /* cancelled */
5175
+ );
5255
5176
  }
5256
- }
5257
- }
5258
- }
5259
- function getSequence(arr) {
5260
- const p = arr.slice();
5261
- const result = [0];
5262
- let i, j, u, v, c;
5263
- const len = arr.length;
5264
- for (i = 0; i < len; i++) {
5265
- const arrI = arr[i];
5266
- if (arrI !== 0) {
5267
- j = result[result.length - 1];
5268
- if (arr[j] < arrI) {
5269
- p[i] = j;
5270
- result.push(i);
5271
- continue;
5177
+ const leavingVNode = leavingVNodesCache[key];
5178
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
5179
+ leavingVNode.el[leaveCbKey]();
5272
5180
  }
5273
- u = 0;
5274
- v = result.length - 1;
5275
- while (u < v) {
5276
- c = u + v >> 1;
5277
- if (arr[result[c]] < arrI) {
5278
- u = c + 1;
5181
+ callHook(hook, [el]);
5182
+ },
5183
+ enter(el) {
5184
+ let hook = onEnter;
5185
+ let afterHook = onAfterEnter;
5186
+ let cancelHook = onEnterCancelled;
5187
+ if (!state.isMounted) {
5188
+ if (appear) {
5189
+ hook = onAppear || onEnter;
5190
+ afterHook = onAfterAppear || onAfterEnter;
5191
+ cancelHook = onAppearCancelled || onEnterCancelled;
5279
5192
  } else {
5280
- v = c;
5193
+ return;
5281
5194
  }
5282
5195
  }
5283
- if (arrI < arr[result[u]]) {
5284
- if (u > 0) {
5285
- p[i] = result[u - 1];
5196
+ let called = false;
5197
+ const done = el[enterCbKey] = (cancelled) => {
5198
+ if (called) return;
5199
+ called = true;
5200
+ if (cancelled) {
5201
+ callHook(cancelHook, [el]);
5202
+ } else {
5203
+ callHook(afterHook, [el]);
5286
5204
  }
5287
- result[u] = i;
5205
+ if (hooks.delayedLeave) {
5206
+ hooks.delayedLeave();
5207
+ }
5208
+ el[enterCbKey] = void 0;
5209
+ };
5210
+ if (hook) {
5211
+ callAsyncHook(hook, [el, done]);
5212
+ } else {
5213
+ done();
5214
+ }
5215
+ },
5216
+ leave(el, remove) {
5217
+ const key2 = String(vnode.key);
5218
+ if (el[enterCbKey]) {
5219
+ el[enterCbKey](
5220
+ true
5221
+ /* cancelled */
5222
+ );
5223
+ }
5224
+ if (state.isUnmounting) {
5225
+ return remove();
5226
+ }
5227
+ callHook(onBeforeLeave, [el]);
5228
+ let called = false;
5229
+ const done = el[leaveCbKey] = (cancelled) => {
5230
+ if (called) return;
5231
+ called = true;
5232
+ remove();
5233
+ if (cancelled) {
5234
+ callHook(onLeaveCancelled, [el]);
5235
+ } else {
5236
+ callHook(onAfterLeave, [el]);
5237
+ }
5238
+ el[leaveCbKey] = void 0;
5239
+ if (leavingVNodesCache[key2] === vnode) {
5240
+ delete leavingVNodesCache[key2];
5241
+ }
5242
+ };
5243
+ leavingVNodesCache[key2] = vnode;
5244
+ if (onLeave) {
5245
+ callAsyncHook(onLeave, [el, done]);
5246
+ } else {
5247
+ done();
5288
5248
  }
5249
+ },
5250
+ clone(vnode2) {
5251
+ const hooks2 = resolveTransitionHooks(
5252
+ vnode2,
5253
+ props,
5254
+ state,
5255
+ instance,
5256
+ postClone
5257
+ );
5258
+ if (postClone) postClone(hooks2);
5259
+ return hooks2;
5260
+ }
5261
+ };
5262
+ return hooks;
5263
+ }
5264
+ function emptyPlaceholder(vnode) {
5265
+ if (isKeepAlive(vnode)) {
5266
+ vnode = cloneVNode(vnode);
5267
+ vnode.children = null;
5268
+ return vnode;
5269
+ }
5270
+ }
5271
+ function getKeepAliveChild(vnode) {
5272
+ if (!isKeepAlive(vnode)) {
5273
+ return vnode;
5274
+ }
5275
+ const { shapeFlag, children } = vnode;
5276
+ if (children) {
5277
+ if (shapeFlag & 16) {
5278
+ return children[0];
5279
+ }
5280
+ if (shapeFlag & 32 && shared.isFunction(children.default)) {
5281
+ return children.default();
5289
5282
  }
5290
5283
  }
5291
- u = result.length;
5292
- v = result[u - 1];
5293
- while (u-- > 0) {
5294
- result[u] = v;
5295
- v = p[v];
5284
+ }
5285
+ function setTransitionHooks(vnode, hooks) {
5286
+ if (vnode.shapeFlag & 6 && vnode.component) {
5287
+ setTransitionHooks(vnode.component.subTree, hooks);
5288
+ } else if (vnode.shapeFlag & 128) {
5289
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
5290
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
5291
+ } else {
5292
+ vnode.transition = hooks;
5296
5293
  }
5297
- return result;
5298
5294
  }
5299
- function locateNonHydratedAsyncRoot(instance) {
5300
- const subComponent = instance.subTree.component;
5301
- if (subComponent) {
5302
- if (subComponent.asyncDep && !subComponent.asyncResolved) {
5303
- return subComponent;
5304
- } else {
5305
- return locateNonHydratedAsyncRoot(subComponent);
5295
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
5296
+ let ret = [];
5297
+ let keyedFragmentCount = 0;
5298
+ for (let i = 0; i < children.length; i++) {
5299
+ let child = children[i];
5300
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
5301
+ if (child.type === Fragment) {
5302
+ if (child.patchFlag & 128) keyedFragmentCount++;
5303
+ ret = ret.concat(
5304
+ getTransitionRawChildren(child.children, keepComment, key)
5305
+ );
5306
+ } else if (keepComment || child.type !== Comment) {
5307
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
5308
+ }
5309
+ }
5310
+ if (keyedFragmentCount > 1) {
5311
+ for (let i = 0; i < ret.length; i++) {
5312
+ ret[i].patchFlag = -2;
5306
5313
  }
5307
5314
  }
5315
+ return ret;
5308
5316
  }
5309
5317
 
5310
5318
  const isTeleport = (type) => type.__isTeleport;
@@ -5550,8 +5558,7 @@ function updateCssVars(vnode) {
5550
5558
  if (ctx && ctx.ut) {
5551
5559
  let node = vnode.children[0].el;
5552
5560
  while (node && node !== vnode.targetAnchor) {
5553
- if (node.nodeType === 1)
5554
- node.setAttribute("data-v-owner", ctx.uid);
5561
+ if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
5555
5562
  node = node.nextSibling;
5556
5563
  }
5557
5564
  ctx.ut();
@@ -5699,7 +5706,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5699
5706
  currentBlock.push(cloned);
5700
5707
  }
5701
5708
  }
5702
- cloned.patchFlag |= -2;
5709
+ cloned.patchFlag = -2;
5703
5710
  return cloned;
5704
5711
  }
5705
5712
  if (isClassComponent(type)) {
@@ -5731,8 +5738,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5731
5738
  );
5732
5739
  }
5733
5740
  function guardReactiveProps(props) {
5734
- if (!props)
5735
- return null;
5741
+ if (!props) return null;
5736
5742
  return reactivity.isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
5737
5743
  }
5738
5744
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
@@ -5781,7 +5787,10 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
5781
5787
  ce: vnode.ce
5782
5788
  };
5783
5789
  if (transition && cloneTransition) {
5784
- cloned.transition = transition.clone(cloned);
5790
+ setTransitionHooks(
5791
+ cloned,
5792
+ transition.clone(cloned)
5793
+ );
5785
5794
  }
5786
5795
  return cloned;
5787
5796
  }
@@ -5990,14 +5999,11 @@ let setInSSRSetupState;
5990
5999
  const g = shared.getGlobalThis();
5991
6000
  const registerGlobalSetter = (key, setter) => {
5992
6001
  let setters;
5993
- if (!(setters = g[key]))
5994
- setters = g[key] = [];
6002
+ if (!(setters = g[key])) setters = g[key] = [];
5995
6003
  setters.push(setter);
5996
6004
  return (v) => {
5997
- if (setters.length > 1)
5998
- setters.forEach((set) => set(v));
5999
- else
6000
- setters[0](v);
6005
+ if (setters.length > 1) setters.forEach((set) => set(v));
6006
+ else setters[0](v);
6001
6007
  };
6002
6008
  };
6003
6009
  internalSetCurrentInstance = registerGlobalSetter(
@@ -6153,7 +6159,7 @@ function createSetupContext(instance) {
6153
6159
  };
6154
6160
  }
6155
6161
  }
6156
- function getExposeProxy(instance) {
6162
+ function getComponentPublicInstance(instance) {
6157
6163
  if (instance.exposed) {
6158
6164
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(reactivity.proxyRefs(reactivity.markRaw(instance.exposed)), {
6159
6165
  get(target, key) {
@@ -6167,6 +6173,8 @@ function getExposeProxy(instance) {
6167
6173
  return key in target || key in publicPropertiesMap;
6168
6174
  }
6169
6175
  }));
6176
+ } else {
6177
+ return instance.proxy;
6170
6178
  }
6171
6179
  }
6172
6180
  function getComponentName(Component, includeInferred = true) {
@@ -6260,6 +6268,7 @@ function withMemo(memo, render, cache, index) {
6260
6268
  }
6261
6269
  const ret = render();
6262
6270
  ret.memo = memo.slice();
6271
+ ret.memoIndex = index;
6263
6272
  return cache[index] = ret;
6264
6273
  }
6265
6274
  function isMemoSame(cached, memo) {
@@ -6278,7 +6287,7 @@ function isMemoSame(cached, memo) {
6278
6287
  return true;
6279
6288
  }
6280
6289
 
6281
- const version = "3.4.27";
6290
+ const version = "3.4.28";
6282
6291
  const warn$1 = shared.NOOP;
6283
6292
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6284
6293
  const devtools = void 0;
@@ -6289,7 +6298,8 @@ const _ssrUtils = {
6289
6298
  renderComponentRoot,
6290
6299
  setCurrentRenderingInstance,
6291
6300
  isVNode: isVNode,
6292
- normalizeVNode
6301
+ normalizeVNode,
6302
+ getComponentPublicInstance
6293
6303
  };
6294
6304
  const ssrUtils = _ssrUtils ;
6295
6305
  const resolveFilter = null;